storybook 10.1.0-alpha.1 → 10.1.0-alpha.11

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 (202) hide show
  1. package/dist/_browser-chunks/Color-FTG7SQDA.js +1097 -0
  2. package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
  3. package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
  4. package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
  5. package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
  6. package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
  7. package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
  8. package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
  9. package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-74YHFU5B.js} +44 -109
  10. package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
  11. package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
  12. package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
  13. package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
  14. package/dist/_browser-chunks/chunk-BE2DAXKJ.js +2966 -0
  15. package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
  16. package/dist/_browser-chunks/chunk-EBHB6RPS.js +61 -0
  17. package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
  18. package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
  19. package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
  20. package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
  21. package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
  22. package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
  23. package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
  24. package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
  25. package/dist/_browser-chunks/chunk-L4RMQ7D7.js +223 -0
  26. package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
  27. package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
  28. package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
  29. package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
  30. package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
  31. package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
  32. package/dist/_browser-chunks/chunk-WXP2XJ3O.js +950 -0
  33. package/dist/_browser-chunks/chunk-X3DUQ5RA.js +47 -0
  34. package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
  35. package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
  36. package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
  37. package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
  38. package/dist/_browser-chunks/{syntaxhighlighter-DK2ODWXH.js → syntaxhighlighter-WKBQ5RC7.js} +707 -1851
  39. package/dist/_node-chunks/{builder-manager-6UBDPV7P.js → builder-manager-PMPHOSM2.js} +495 -1013
  40. package/dist/_node-chunks/camelcase-K3IOOFQW.js +18 -0
  41. package/dist/_node-chunks/{chunk-QNUGJO6L.js → chunk-32NE3UE3.js} +15 -24
  42. package/dist/_node-chunks/chunk-4GZCFQFG.js +58 -0
  43. package/dist/_node-chunks/chunk-5QK5MSOI.js +943 -0
  44. package/dist/_node-chunks/{chunk-3FPF5Y2F.js → chunk-6ZOLETQK.js} +8 -10
  45. package/dist/_node-chunks/chunk-7I22Y76Z.js +1047 -0
  46. package/dist/_node-chunks/chunk-AKTRSR3O.js +72 -0
  47. package/dist/_node-chunks/chunk-BBOP3XCK.js +119 -0
  48. package/dist/_node-chunks/chunk-C2GQVDWI.js +34 -0
  49. package/dist/_node-chunks/{chunk-SCTKVDWR.js → chunk-GG2WQZSG.js} +4619 -7350
  50. package/dist/_node-chunks/chunk-GQJOWVVR.js +3214 -0
  51. package/dist/_node-chunks/chunk-JCRM2YVK.js +3009 -0
  52. package/dist/_node-chunks/chunk-KK4AT5F3.js +1029 -0
  53. package/dist/_node-chunks/chunk-L7MYXJUM.js +1114 -0
  54. package/dist/_node-chunks/{chunk-LAU7VVPC.js → chunk-LCZO45L7.js} +469 -983
  55. package/dist/_node-chunks/chunk-LR3QITDI.js +209 -0
  56. package/dist/_node-chunks/chunk-LXG4DK35.js +3171 -0
  57. package/dist/_node-chunks/chunk-MJ3WOS6F.js +37 -0
  58. package/dist/_node-chunks/chunk-PHOZWZZO.js +61 -0
  59. package/dist/_node-chunks/chunk-QECOQWRJ.js +936 -0
  60. package/dist/_node-chunks/chunk-QH4V5YDB.js +20 -0
  61. package/dist/_node-chunks/chunk-R6HWGZWD.js +26 -0
  62. package/dist/_node-chunks/chunk-SPQXMU2Q.js +759 -0
  63. package/dist/_node-chunks/chunk-TXZY6V6O.js +1564 -0
  64. package/dist/_node-chunks/chunk-UGDPX5LE.js +756 -0
  65. package/dist/_node-chunks/chunk-UY26MQLT.js +603 -0
  66. package/dist/_node-chunks/chunk-WK3EMYK6.js +61 -0
  67. package/dist/_node-chunks/{chunk-CJHAP7SE.js → chunk-WLHMN7AP.js} +292 -688
  68. package/dist/_node-chunks/chunk-XGVLB4UJ.js +54 -0
  69. package/dist/_node-chunks/{chunk-J7N7PD5Q.js → chunk-YHRFI6BE.js} +87 -227
  70. package/dist/_node-chunks/chunk-YK4KVMFW.js +18 -0
  71. package/dist/_node-chunks/chunk-ZZALGOA6.js +4523 -0
  72. package/dist/_node-chunks/chunk-ZZPBSYA5.js +301 -0
  73. package/dist/_node-chunks/chunk-ZZSRFAC6.js +45571 -0
  74. package/dist/_node-chunks/dist-4DWOCZUD.js +121 -0
  75. package/dist/_node-chunks/globby-AAARUKEU.js +3452 -0
  76. package/dist/_node-chunks/lib-HEUKGL62.js +366 -0
  77. package/dist/_node-chunks/mdx-N42X6CFJ-DCVRPS6N.js +14329 -0
  78. package/dist/_node-chunks/p-limit-F5ZKJ6WZ.js +116 -0
  79. package/dist/_node-chunks/plugin-7YY7JXCH.js +123 -0
  80. package/dist/_node-chunks/{plugin-HJLCLGNT.js → plugin-SZP3CW6W.js} +36 -56
  81. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-TGKNDPO6.js +46623 -0
  82. package/dist/_node-chunks/webpack-mock-plugin-LNTZZFBE.js +92 -0
  83. package/dist/actions/decorator.js +21 -42
  84. package/dist/actions/index.js +3 -3
  85. package/dist/babel/index.d.ts +671 -335
  86. package/dist/babel/index.js +11 -11
  87. package/dist/bin/core.js +592 -1546
  88. package/dist/bin/dispatcher.js +26 -37
  89. package/dist/bin/loader.js +23 -34
  90. package/dist/channels/index.js +98 -234
  91. package/dist/cli/index.js +1966 -5347
  92. package/dist/client-logger/index.js +31 -61
  93. package/dist/common/index.d.ts +210 -3
  94. package/dist/common/index.js +28 -20
  95. package/dist/components/index.d.ts +472 -280
  96. package/dist/components/index.js +15992 -75
  97. package/dist/core-events/index.js +2 -66
  98. package/dist/core-server/index.js +3837 -7191
  99. package/dist/core-server/presets/common-manager.css +2 -2
  100. package/dist/core-server/presets/common-manager.js +2511 -5219
  101. package/dist/core-server/presets/common-override-preset.js +31 -60
  102. package/dist/core-server/presets/common-preset.js +434 -924
  103. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +15 -19
  104. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +12 -17
  105. package/dist/csf/index.js +534 -1172
  106. package/dist/csf-tools/index.d.ts +15 -4
  107. package/dist/csf-tools/index.js +9 -9
  108. package/dist/docs-tools/index.js +6 -6
  109. package/dist/highlight/index.js +2 -2
  110. package/dist/instrumenter/index.js +199 -415
  111. package/dist/manager/globals-runtime.js +47968 -56484
  112. package/dist/manager/globals.js +2 -3
  113. package/dist/manager/runtime.js +4901 -10318
  114. package/dist/manager-api/index.d.ts +11 -3
  115. package/dist/manager-api/index.js +1250 -2397
  116. package/dist/manager-errors.d.ts +3 -0
  117. package/dist/manager-errors.js +3 -3
  118. package/dist/node-logger/index.d.ts +1 -1
  119. package/dist/node-logger/index.js +1270 -2593
  120. package/dist/preview/globals.js +2 -3
  121. package/dist/preview/runtime.js +10767 -22386
  122. package/dist/preview-api/index.d.ts +67 -68
  123. package/dist/preview-api/index.js +15 -15
  124. package/dist/preview-errors.d.ts +3 -0
  125. package/dist/preview-errors.js +4 -4
  126. package/dist/router/index.js +347 -899
  127. package/dist/server-errors.d.ts +3 -0
  128. package/dist/server-errors.js +10 -10
  129. package/dist/telemetry/index.js +24 -24
  130. package/dist/test/index.js +6129 -11914
  131. package/dist/theming/create.d.ts +4 -2
  132. package/dist/theming/create.js +4 -4
  133. package/dist/theming/index.d.ts +3397 -2628
  134. package/dist/theming/index.js +502 -1091
  135. package/dist/types/index.d.ts +50 -5
  136. package/dist/types/index.js +2 -11
  137. package/dist/viewport/index.js +3 -3
  138. package/package.json +17 -9
  139. package/dist/_browser-chunks/Color-7ZNS6F6B.js +0 -1676
  140. package/dist/_browser-chunks/WithTooltip-SK46ZJ2J.js +0 -13
  141. package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
  142. package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
  143. package/dist/_browser-chunks/chunk-BOOOPFZF.js +0 -2335
  144. package/dist/_browser-chunks/chunk-C4XOKMDU.js +0 -270
  145. package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
  146. package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
  147. package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
  148. package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
  149. package/dist/_browser-chunks/chunk-I74EUU5O.js +0 -5809
  150. package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
  151. package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
  152. package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
  153. package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
  154. package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
  155. package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
  156. package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
  157. package/dist/_browser-chunks/chunk-RNE2IUTB.js +0 -1300
  158. package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
  159. package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
  160. package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
  161. package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
  162. package/dist/_browser-chunks/chunk-W4QKLQSC.js +0 -4182
  163. package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
  164. package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
  165. package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
  166. package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
  167. package/dist/_node-chunks/camelcase-WKJOVNPM.js +0 -18
  168. package/dist/_node-chunks/chunk-2RIKHYCS.js +0 -304
  169. package/dist/_node-chunks/chunk-3JCSHYSU.js +0 -1657
  170. package/dist/_node-chunks/chunk-4GE6Q4MX.js +0 -1531
  171. package/dist/_node-chunks/chunk-5SEHHENC.js +0 -64656
  172. package/dist/_node-chunks/chunk-6GD23U64.js +0 -420
  173. package/dist/_node-chunks/chunk-6OAXYS5T.js +0 -1544
  174. package/dist/_node-chunks/chunk-7TNUMFKR.js +0 -4741
  175. package/dist/_node-chunks/chunk-BCDHUXAJ.js +0 -4272
  176. package/dist/_node-chunks/chunk-BYVQZ2HU.js +0 -220
  177. package/dist/_node-chunks/chunk-DAMVKHAC.js +0 -101
  178. package/dist/_node-chunks/chunk-FEOC7OX2.js +0 -1586
  179. package/dist/_node-chunks/chunk-FY7XZPLY.js +0 -2248
  180. package/dist/_node-chunks/chunk-GD2FXWDF.js +0 -697
  181. package/dist/_node-chunks/chunk-HM6B7FE5.js +0 -18
  182. package/dist/_node-chunks/chunk-HORWITP7.js +0 -90
  183. package/dist/_node-chunks/chunk-II4AFH3V.js +0 -28
  184. package/dist/_node-chunks/chunk-MF2PUEWG.js +0 -5029
  185. package/dist/_node-chunks/chunk-RVE4UTVQ.js +0 -1518
  186. package/dist/_node-chunks/chunk-TUFWZUTO.js +0 -69
  187. package/dist/_node-chunks/chunk-TXHNWNH4.js +0 -79
  188. package/dist/_node-chunks/chunk-ULWNTI6M.js +0 -1198
  189. package/dist/_node-chunks/chunk-VYRFXLRO.js +0 -6712
  190. package/dist/_node-chunks/chunk-WNOSTIYP.js +0 -34
  191. package/dist/_node-chunks/chunk-X67VGZN4.js +0 -1250
  192. package/dist/_node-chunks/chunk-XCEBYOA4.js +0 -61
  193. package/dist/_node-chunks/chunk-XW7YMR7I.js +0 -111
  194. package/dist/_node-chunks/chunk-ZRFYQ46H.js +0 -61
  195. package/dist/_node-chunks/dist-APCKHSY3.js +0 -175
  196. package/dist/_node-chunks/globby-TSGXGDA2.js +0 -5222
  197. package/dist/_node-chunks/lib-DZ5TVIU5.js +0 -518
  198. package/dist/_node-chunks/mdx-N42X6CFJ-Z6BYQCPN.js +0 -22017
  199. package/dist/_node-chunks/p-limit-MLJNGG2K.js +0 -168
  200. package/dist/_node-chunks/plugin-J3JI3ZKJ.js +0 -159
  201. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-3QHNTM5B.js +0 -69102
  202. package/dist/_node-chunks/webpack-mock-plugin-4Y3MWPJ6.js +0 -124
@@ -1,1300 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-MM7DTO55.js";
4
-
5
- // src/components/components/ActionBar/ActionBar.tsx
6
- import React from "react";
7
- import { styled } from "storybook/theming";
8
- var Container = styled.div(({ theme }) => ({
9
- position: "absolute",
10
- bottom: 0,
11
- right: 0,
12
- maxWidth: "100%",
13
- display: "flex",
14
- background: theme.background.content,
15
- zIndex: 1
16
- }));
17
- var ActionButton = styled.button(
18
- ({ theme }) => ({
19
- margin: 0,
20
- border: "0 none",
21
- padding: "4px 10px",
22
- cursor: "pointer",
23
- display: "flex",
24
- alignItems: "center",
25
- color: theme.color.defaultText,
26
- background: theme.background.content,
27
- fontSize: 12,
28
- lineHeight: "16px",
29
- fontFamily: theme.typography.fonts.base,
30
- fontWeight: theme.typography.weight.bold,
31
- borderTop: `1px solid ${theme.appBorderColor}`,
32
- borderLeft: `1px solid ${theme.appBorderColor}`,
33
- marginLeft: -1,
34
- borderRadius: `4px 0 0 0`,
35
- "&:not(:last-child)": { borderRight: `1px solid ${theme.appBorderColor}` },
36
- "& + *": {
37
- borderLeft: `1px solid ${theme.appBorderColor}`,
38
- borderRadius: 0
39
- },
40
- "&:focus": {
41
- boxShadow: `${theme.color.secondary} 0 -3px 0 0 inset`,
42
- outline: "0 none",
43
- "@media (forced-colors: active)": {
44
- outline: "1px solid highlight"
45
- }
46
- }
47
- }),
48
- ({ disabled }) => disabled && {
49
- cursor: "not-allowed",
50
- opacity: 0.5
51
- }
52
- );
53
- ActionButton.displayName = "ActionButton";
54
- var ActionBar = /* @__PURE__ */ __name(({ actionItems, ...props }) => React.createElement(Container, { ...props }, actionItems.map(({ title, className, onClick, disabled }, index) => React.createElement(ActionButton, { key: index, className, onClick, disabled: !!disabled }, title))), "ActionBar");
55
-
56
- // src/components/components/ScrollArea/ScrollArea.tsx
57
- import React11, { forwardRef as forwardRef4 } from "react";
58
-
59
- // ../node_modules/@radix-ui/react-scroll-area/dist/index.mjs
60
- import * as React23 from "react";
61
-
62
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-primitive/dist/index.mjs
63
- import * as React4 from "react";
64
- import * as ReactDOM from "react-dom";
65
-
66
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-slot/dist/index.mjs
67
- import * as React3 from "react";
68
-
69
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
70
- import * as React2 from "react";
71
- function setRef(ref, value) {
72
- if (typeof ref === "function") {
73
- ref(value);
74
- } else if (ref !== null && ref !== void 0) {
75
- ref.current = value;
76
- }
77
- }
78
- __name(setRef, "setRef");
79
- function composeRefs(...refs) {
80
- return (node) => refs.forEach((ref) => setRef(ref, node));
81
- }
82
- __name(composeRefs, "composeRefs");
83
- function useComposedRefs(...refs) {
84
- return React2.useCallback(composeRefs(...refs), refs);
85
- }
86
- __name(useComposedRefs, "useComposedRefs");
87
-
88
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-slot/dist/index.mjs
89
- import { Fragment, jsx } from "react/jsx-runtime";
90
- var Slot = React3.forwardRef((props, forwardedRef) => {
91
- const { children, ...slotProps } = props;
92
- const childrenArray = React3.Children.toArray(children);
93
- const slottable = childrenArray.find(isSlottable);
94
- if (slottable) {
95
- const newElement = slottable.props.children;
96
- const newChildren = childrenArray.map((child) => {
97
- if (child === slottable) {
98
- if (React3.Children.count(newElement) > 1) return React3.Children.only(null);
99
- return React3.isValidElement(newElement) ? newElement.props.children : null;
100
- } else {
101
- return child;
102
- }
103
- });
104
- return jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React3.isValidElement(newElement) ? React3.cloneElement(newElement, void 0, newChildren) : null });
105
- }
106
- return jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
107
- });
108
- Slot.displayName = "Slot";
109
- var SlotClone = React3.forwardRef((props, forwardedRef) => {
110
- const { children, ...slotProps } = props;
111
- if (React3.isValidElement(children)) {
112
- const childrenRef = getElementRef(children);
113
- return React3.cloneElement(children, {
114
- ...mergeProps(slotProps, children.props),
115
- // @ts-ignore
116
- ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef
117
- });
118
- }
119
- return React3.Children.count(children) > 1 ? React3.Children.only(null) : null;
120
- });
121
- SlotClone.displayName = "SlotClone";
122
- var Slottable = /* @__PURE__ */ __name(({ children }) => {
123
- return jsx(Fragment, { children });
124
- }, "Slottable");
125
- function isSlottable(child) {
126
- return React3.isValidElement(child) && child.type === Slottable;
127
- }
128
- __name(isSlottable, "isSlottable");
129
- function mergeProps(slotProps, childProps) {
130
- const overrideProps = { ...childProps };
131
- for (const propName in childProps) {
132
- const slotPropValue = slotProps[propName];
133
- const childPropValue = childProps[propName];
134
- const isHandler = /^on[A-Z]/.test(propName);
135
- if (isHandler) {
136
- if (slotPropValue && childPropValue) {
137
- overrideProps[propName] = (...args) => {
138
- childPropValue(...args);
139
- slotPropValue(...args);
140
- };
141
- } else if (slotPropValue) {
142
- overrideProps[propName] = slotPropValue;
143
- }
144
- } else if (propName === "style") {
145
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
146
- } else if (propName === "className") {
147
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
148
- }
149
- }
150
- return { ...slotProps, ...overrideProps };
151
- }
152
- __name(mergeProps, "mergeProps");
153
- function getElementRef(element) {
154
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
155
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
156
- if (mayWarn) {
157
- return element.ref;
158
- }
159
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
160
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
161
- if (mayWarn) {
162
- return element.props.ref;
163
- }
164
- return element.props.ref || element.ref;
165
- }
166
- __name(getElementRef, "getElementRef");
167
-
168
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-primitive/dist/index.mjs
169
- import { jsx as jsx2 } from "react/jsx-runtime";
170
- var NODES = [
171
- "a",
172
- "button",
173
- "div",
174
- "form",
175
- "h2",
176
- "h3",
177
- "img",
178
- "input",
179
- "label",
180
- "li",
181
- "nav",
182
- "ol",
183
- "p",
184
- "span",
185
- "svg",
186
- "ul"
187
- ];
188
- var Primitive = NODES.reduce((primitive, node) => {
189
- const Node = React4.forwardRef((props, forwardedRef) => {
190
- const { asChild, ...primitiveProps } = props;
191
- const Comp = asChild ? Slot : node;
192
- if (typeof window !== "undefined") {
193
- window[Symbol.for("radix-ui")] = true;
194
- }
195
- return jsx2(Comp, { ...primitiveProps, ref: forwardedRef });
196
- });
197
- Node.displayName = `Primitive.${node}`;
198
- return { ...primitive, [node]: Node };
199
- }, {});
200
-
201
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-presence/dist/index.mjs
202
- import * as React22 from "react";
203
- import * as ReactDOM2 from "react-dom";
204
-
205
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
206
- import * as React5 from "react";
207
- var useLayoutEffect2 = Boolean(globalThis?.document) ? React5.useLayoutEffect : () => {
208
- };
209
-
210
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-presence/dist/index.mjs
211
- import * as React6 from "react";
212
- function useStateMachine(initialState, machine) {
213
- return React6.useReducer((state, event) => {
214
- const nextState = machine[state][event];
215
- return nextState ?? state;
216
- }, initialState);
217
- }
218
- __name(useStateMachine, "useStateMachine");
219
- var Presence = /* @__PURE__ */ __name((props) => {
220
- const { present, children } = props;
221
- const presence = usePresence(present);
222
- const child = typeof children === "function" ? children({ present: presence.isPresent }) : React22.Children.only(children);
223
- const ref = useComposedRefs(presence.ref, getElementRef2(child));
224
- const forceMount = typeof children === "function";
225
- return forceMount || presence.isPresent ? React22.cloneElement(child, { ref }) : null;
226
- }, "Presence");
227
- Presence.displayName = "Presence";
228
- function usePresence(present) {
229
- const [node, setNode] = React22.useState();
230
- const stylesRef = React22.useRef({});
231
- const prevPresentRef = React22.useRef(present);
232
- const prevAnimationNameRef = React22.useRef("none");
233
- const initialState = present ? "mounted" : "unmounted";
234
- const [state, send] = useStateMachine(initialState, {
235
- mounted: {
236
- UNMOUNT: "unmounted",
237
- ANIMATION_OUT: "unmountSuspended"
238
- },
239
- unmountSuspended: {
240
- MOUNT: "mounted",
241
- ANIMATION_END: "unmounted"
242
- },
243
- unmounted: {
244
- MOUNT: "mounted"
245
- }
246
- });
247
- React22.useEffect(() => {
248
- const currentAnimationName = getAnimationName(stylesRef.current);
249
- prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
250
- }, [state]);
251
- useLayoutEffect2(() => {
252
- const styles = stylesRef.current;
253
- const wasPresent = prevPresentRef.current;
254
- const hasPresentChanged = wasPresent !== present;
255
- if (hasPresentChanged) {
256
- const prevAnimationName = prevAnimationNameRef.current;
257
- const currentAnimationName = getAnimationName(styles);
258
- if (present) {
259
- send("MOUNT");
260
- } else if (currentAnimationName === "none" || styles?.display === "none") {
261
- send("UNMOUNT");
262
- } else {
263
- const isAnimating = prevAnimationName !== currentAnimationName;
264
- if (wasPresent && isAnimating) {
265
- send("ANIMATION_OUT");
266
- } else {
267
- send("UNMOUNT");
268
- }
269
- }
270
- prevPresentRef.current = present;
271
- }
272
- }, [present, send]);
273
- useLayoutEffect2(() => {
274
- if (node) {
275
- const handleAnimationEnd = /* @__PURE__ */ __name((event) => {
276
- const currentAnimationName = getAnimationName(stylesRef.current);
277
- const isCurrentAnimation = currentAnimationName.includes(event.animationName);
278
- if (event.target === node && isCurrentAnimation) {
279
- ReactDOM2.flushSync(() => send("ANIMATION_END"));
280
- }
281
- }, "handleAnimationEnd");
282
- const handleAnimationStart = /* @__PURE__ */ __name((event) => {
283
- if (event.target === node) {
284
- prevAnimationNameRef.current = getAnimationName(stylesRef.current);
285
- }
286
- }, "handleAnimationStart");
287
- node.addEventListener("animationstart", handleAnimationStart);
288
- node.addEventListener("animationcancel", handleAnimationEnd);
289
- node.addEventListener("animationend", handleAnimationEnd);
290
- return () => {
291
- node.removeEventListener("animationstart", handleAnimationStart);
292
- node.removeEventListener("animationcancel", handleAnimationEnd);
293
- node.removeEventListener("animationend", handleAnimationEnd);
294
- };
295
- } else {
296
- send("ANIMATION_END");
297
- }
298
- }, [node, send]);
299
- return {
300
- isPresent: ["mounted", "unmountSuspended"].includes(state),
301
- ref: React22.useCallback((node2) => {
302
- if (node2) stylesRef.current = getComputedStyle(node2);
303
- setNode(node2);
304
- }, [])
305
- };
306
- }
307
- __name(usePresence, "usePresence");
308
- function getAnimationName(styles) {
309
- return styles?.animationName || "none";
310
- }
311
- __name(getAnimationName, "getAnimationName");
312
- function getElementRef2(element) {
313
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
314
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
315
- if (mayWarn) {
316
- return element.ref;
317
- }
318
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
319
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
320
- if (mayWarn) {
321
- return element.props.ref;
322
- }
323
- return element.props.ref || element.ref;
324
- }
325
- __name(getElementRef2, "getElementRef");
326
-
327
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-context/dist/index.mjs
328
- import * as React7 from "react";
329
- import { jsx as jsx3 } from "react/jsx-runtime";
330
- function createContextScope(scopeName, createContextScopeDeps = []) {
331
- let defaultContexts = [];
332
- function createContext3(rootComponentName, defaultContext) {
333
- const BaseContext = React7.createContext(defaultContext);
334
- const index = defaultContexts.length;
335
- defaultContexts = [...defaultContexts, defaultContext];
336
- function Provider(props) {
337
- const { scope, children, ...context } = props;
338
- const Context = scope?.[scopeName][index] || BaseContext;
339
- const value = React7.useMemo(() => context, Object.values(context));
340
- return jsx3(Context.Provider, { value, children });
341
- }
342
- __name(Provider, "Provider");
343
- function useContext22(consumerName, scope) {
344
- const Context = scope?.[scopeName][index] || BaseContext;
345
- const context = React7.useContext(Context);
346
- if (context) return context;
347
- if (defaultContext !== void 0) return defaultContext;
348
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
349
- }
350
- __name(useContext22, "useContext2");
351
- Provider.displayName = rootComponentName + "Provider";
352
- return [Provider, useContext22];
353
- }
354
- __name(createContext3, "createContext3");
355
- const createScope = /* @__PURE__ */ __name(() => {
356
- const scopeContexts = defaultContexts.map((defaultContext) => {
357
- return React7.createContext(defaultContext);
358
- });
359
- return /* @__PURE__ */ __name(function useScope(scope) {
360
- const contexts = scope?.[scopeName] || scopeContexts;
361
- return React7.useMemo(
362
- () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
363
- [scope, contexts]
364
- );
365
- }, "useScope");
366
- }, "createScope");
367
- createScope.scopeName = scopeName;
368
- return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
369
- }
370
- __name(createContextScope, "createContextScope");
371
- function composeContextScopes(...scopes) {
372
- const baseScope = scopes[0];
373
- if (scopes.length === 1) return baseScope;
374
- const createScope = /* @__PURE__ */ __name(() => {
375
- const scopeHooks = scopes.map((createScope2) => ({
376
- useScope: createScope2(),
377
- scopeName: createScope2.scopeName
378
- }));
379
- return /* @__PURE__ */ __name(function useComposedScopes(overrideScopes) {
380
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
381
- const scopeProps = useScope(overrideScopes);
382
- const currentScope = scopeProps[`__scope${scopeName}`];
383
- return { ...nextScopes2, ...currentScope };
384
- }, {});
385
- return React7.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
386
- }, "useComposedScopes");
387
- }, "createScope");
388
- createScope.scopeName = baseScope.scopeName;
389
- return createScope;
390
- }
391
- __name(composeContextScopes, "composeContextScopes");
392
-
393
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
394
- import * as React8 from "react";
395
- function useCallbackRef(callback) {
396
- const callbackRef = React8.useRef(callback);
397
- React8.useEffect(() => {
398
- callbackRef.current = callback;
399
- });
400
- return React8.useMemo(() => (...args) => callbackRef.current?.(...args), []);
401
- }
402
- __name(useCallbackRef, "useCallbackRef");
403
-
404
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-direction/dist/index.mjs
405
- import * as React9 from "react";
406
- import { jsx as jsx4 } from "react/jsx-runtime";
407
- var DirectionContext = React9.createContext(void 0);
408
- function useDirection(localDir) {
409
- const globalDir = React9.useContext(DirectionContext);
410
- return localDir || globalDir || "ltr";
411
- }
412
- __name(useDirection, "useDirection");
413
-
414
- // ../node_modules/@radix-ui/number/dist/index.mjs
415
- function clamp(value, [min, max]) {
416
- return Math.min(max, Math.max(min, value));
417
- }
418
- __name(clamp, "clamp");
419
-
420
- // ../node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/primitive/dist/index.mjs
421
- function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
422
- return /* @__PURE__ */ __name(function handleEvent(event) {
423
- originalEventHandler?.(event);
424
- if (checkForDefaultPrevented === false || !event.defaultPrevented) {
425
- return ourEventHandler?.(event);
426
- }
427
- }, "handleEvent");
428
- }
429
- __name(composeEventHandlers, "composeEventHandlers");
430
-
431
- // ../node_modules/@radix-ui/react-scroll-area/dist/index.mjs
432
- import * as React10 from "react";
433
- import { Fragment as Fragment2, jsx as jsx5, jsxs } from "react/jsx-runtime";
434
- function useStateMachine2(initialState, machine) {
435
- return React10.useReducer((state, event) => {
436
- const nextState = machine[state][event];
437
- return nextState ?? state;
438
- }, initialState);
439
- }
440
- __name(useStateMachine2, "useStateMachine");
441
- var SCROLL_AREA_NAME = "ScrollArea";
442
- var [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME);
443
- var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
444
- var ScrollArea = React23.forwardRef(
445
- (props, forwardedRef) => {
446
- const {
447
- __scopeScrollArea,
448
- type = "hover",
449
- dir,
450
- scrollHideDelay = 600,
451
- ...scrollAreaProps
452
- } = props;
453
- const [scrollArea, setScrollArea] = React23.useState(null);
454
- const [viewport, setViewport] = React23.useState(null);
455
- const [content, setContent] = React23.useState(null);
456
- const [scrollbarX, setScrollbarX] = React23.useState(null);
457
- const [scrollbarY, setScrollbarY] = React23.useState(null);
458
- const [cornerWidth, setCornerWidth] = React23.useState(0);
459
- const [cornerHeight, setCornerHeight] = React23.useState(0);
460
- const [scrollbarXEnabled, setScrollbarXEnabled] = React23.useState(false);
461
- const [scrollbarYEnabled, setScrollbarYEnabled] = React23.useState(false);
462
- const composedRefs = useComposedRefs(forwardedRef, (node) => setScrollArea(node));
463
- const direction = useDirection(dir);
464
- return jsx5(
465
- ScrollAreaProvider,
466
- {
467
- scope: __scopeScrollArea,
468
- type,
469
- dir: direction,
470
- scrollHideDelay,
471
- scrollArea,
472
- viewport,
473
- onViewportChange: setViewport,
474
- content,
475
- onContentChange: setContent,
476
- scrollbarX,
477
- onScrollbarXChange: setScrollbarX,
478
- scrollbarXEnabled,
479
- onScrollbarXEnabledChange: setScrollbarXEnabled,
480
- scrollbarY,
481
- onScrollbarYChange: setScrollbarY,
482
- scrollbarYEnabled,
483
- onScrollbarYEnabledChange: setScrollbarYEnabled,
484
- onCornerWidthChange: setCornerWidth,
485
- onCornerHeightChange: setCornerHeight,
486
- children: jsx5(
487
- Primitive.div,
488
- {
489
- dir: direction,
490
- ...scrollAreaProps,
491
- ref: composedRefs,
492
- style: {
493
- position: "relative",
494
- // Pass corner sizes as CSS vars to reduce re-renders of context consumers
495
- ["--radix-scroll-area-corner-width"]: cornerWidth + "px",
496
- ["--radix-scroll-area-corner-height"]: cornerHeight + "px",
497
- ...props.style
498
- }
499
- }
500
- )
501
- }
502
- );
503
- }
504
- );
505
- ScrollArea.displayName = SCROLL_AREA_NAME;
506
- var VIEWPORT_NAME = "ScrollAreaViewport";
507
- var ScrollAreaViewport = React23.forwardRef(
508
- (props, forwardedRef) => {
509
- const { __scopeScrollArea, children, asChild, nonce, ...viewportProps } = props;
510
- const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
511
- const ref = React23.useRef(null);
512
- const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);
513
- return jsxs(Fragment2, { children: [
514
- jsx5(
515
- "style",
516
- {
517
- dangerouslySetInnerHTML: {
518
- __html: `
519
- [data-radix-scroll-area-viewport] {
520
- scrollbar-width: none;
521
- -ms-overflow-style: none;
522
- -webkit-overflow-scrolling: touch;
523
- }
524
- [data-radix-scroll-area-viewport]::-webkit-scrollbar {
525
- display: none;
526
- }
527
- :where([data-radix-scroll-area-viewport]) {
528
- display: flex;
529
- flex-direction: column;
530
- align-items: stretch;
531
- }
532
- :where([data-radix-scroll-area-content]) {
533
- flex-grow: 1;
534
- }
535
- `
536
- },
537
- nonce
538
- }
539
- ),
540
- jsx5(
541
- Primitive.div,
542
- {
543
- "data-radix-scroll-area-viewport": "",
544
- ...viewportProps,
545
- asChild,
546
- ref: composedRefs,
547
- style: {
548
- /**
549
- * We don't support `visible` because the intention is to have at least one scrollbar
550
- * if this component is used and `visible` will behave like `auto` in that case
551
- * https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
552
- *
553
- * We don't handle `auto` because the intention is for the native implementation
554
- * to be hidden if using this component. We just want to ensure the node is scrollable
555
- * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
556
- * the browser from having to work out whether to render native scrollbars or not,
557
- * we tell it to with the intention of hiding them in CSS.
558
- */
559
- overflowX: context.scrollbarXEnabled ? "scroll" : "hidden",
560
- overflowY: context.scrollbarYEnabled ? "scroll" : "hidden",
561
- ...props.style
562
- },
563
- children: getSubtree({ asChild, children }, (children2) => jsx5(
564
- "div",
565
- {
566
- "data-radix-scroll-area-content": "",
567
- ref: context.onContentChange,
568
- style: { minWidth: context.scrollbarXEnabled ? "fit-content" : void 0 },
569
- children: children2
570
- }
571
- ))
572
- }
573
- )
574
- ] });
575
- }
576
- );
577
- ScrollAreaViewport.displayName = VIEWPORT_NAME;
578
- var SCROLLBAR_NAME = "ScrollAreaScrollbar";
579
- var ScrollAreaScrollbar = React23.forwardRef(
580
- (props, forwardedRef) => {
581
- const { forceMount, ...scrollbarProps } = props;
582
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
583
- const { onScrollbarXEnabledChange, onScrollbarYEnabledChange } = context;
584
- const isHorizontal = props.orientation === "horizontal";
585
- React23.useEffect(() => {
586
- isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);
587
- return () => {
588
- isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);
589
- };
590
- }, [isHorizontal, onScrollbarXEnabledChange, onScrollbarYEnabledChange]);
591
- return context.type === "hover" ? jsx5(ScrollAreaScrollbarHover, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "scroll" ? jsx5(ScrollAreaScrollbarScroll, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "auto" ? jsx5(ScrollAreaScrollbarAuto, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "always" ? jsx5(ScrollAreaScrollbarVisible, { ...scrollbarProps, ref: forwardedRef }) : null;
592
- }
593
- );
594
- ScrollAreaScrollbar.displayName = SCROLLBAR_NAME;
595
- var ScrollAreaScrollbarHover = React23.forwardRef((props, forwardedRef) => {
596
- const { forceMount, ...scrollbarProps } = props;
597
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
598
- const [visible, setVisible] = React23.useState(false);
599
- React23.useEffect(() => {
600
- const scrollArea = context.scrollArea;
601
- let hideTimer = 0;
602
- if (scrollArea) {
603
- const handlePointerEnter = /* @__PURE__ */ __name(() => {
604
- window.clearTimeout(hideTimer);
605
- setVisible(true);
606
- }, "handlePointerEnter");
607
- const handlePointerLeave = /* @__PURE__ */ __name(() => {
608
- hideTimer = window.setTimeout(() => setVisible(false), context.scrollHideDelay);
609
- }, "handlePointerLeave");
610
- scrollArea.addEventListener("pointerenter", handlePointerEnter);
611
- scrollArea.addEventListener("pointerleave", handlePointerLeave);
612
- return () => {
613
- window.clearTimeout(hideTimer);
614
- scrollArea.removeEventListener("pointerenter", handlePointerEnter);
615
- scrollArea.removeEventListener("pointerleave", handlePointerLeave);
616
- };
617
- }
618
- }, [context.scrollArea, context.scrollHideDelay]);
619
- return jsx5(Presence, { present: forceMount || visible, children: jsx5(
620
- ScrollAreaScrollbarAuto,
621
- {
622
- "data-state": visible ? "visible" : "hidden",
623
- ...scrollbarProps,
624
- ref: forwardedRef
625
- }
626
- ) });
627
- });
628
- var ScrollAreaScrollbarScroll = React23.forwardRef((props, forwardedRef) => {
629
- const { forceMount, ...scrollbarProps } = props;
630
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
631
- const isHorizontal = props.orientation === "horizontal";
632
- const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
633
- const [state, send] = useStateMachine2("hidden", {
634
- hidden: {
635
- SCROLL: "scrolling"
636
- },
637
- scrolling: {
638
- SCROLL_END: "idle",
639
- POINTER_ENTER: "interacting"
640
- },
641
- interacting: {
642
- SCROLL: "interacting",
643
- POINTER_LEAVE: "idle"
644
- },
645
- idle: {
646
- HIDE: "hidden",
647
- SCROLL: "scrolling",
648
- POINTER_ENTER: "interacting"
649
- }
650
- });
651
- React23.useEffect(() => {
652
- if (state === "idle") {
653
- const hideTimer = window.setTimeout(() => send("HIDE"), context.scrollHideDelay);
654
- return () => window.clearTimeout(hideTimer);
655
- }
656
- }, [state, context.scrollHideDelay, send]);
657
- React23.useEffect(() => {
658
- const viewport = context.viewport;
659
- const scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop";
660
- if (viewport) {
661
- let prevScrollPos = viewport[scrollDirection];
662
- const handleScroll = /* @__PURE__ */ __name(() => {
663
- const scrollPos = viewport[scrollDirection];
664
- const hasScrollInDirectionChanged = prevScrollPos !== scrollPos;
665
- if (hasScrollInDirectionChanged) {
666
- send("SCROLL");
667
- debounceScrollEnd();
668
- }
669
- prevScrollPos = scrollPos;
670
- }, "handleScroll");
671
- viewport.addEventListener("scroll", handleScroll);
672
- return () => viewport.removeEventListener("scroll", handleScroll);
673
- }
674
- }, [context.viewport, isHorizontal, send, debounceScrollEnd]);
675
- return jsx5(Presence, { present: forceMount || state !== "hidden", children: jsx5(
676
- ScrollAreaScrollbarVisible,
677
- {
678
- "data-state": state === "hidden" ? "hidden" : "visible",
679
- ...scrollbarProps,
680
- ref: forwardedRef,
681
- onPointerEnter: composeEventHandlers(props.onPointerEnter, () => send("POINTER_ENTER")),
682
- onPointerLeave: composeEventHandlers(props.onPointerLeave, () => send("POINTER_LEAVE"))
683
- }
684
- ) });
685
- });
686
- var ScrollAreaScrollbarAuto = React23.forwardRef((props, forwardedRef) => {
687
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
688
- const { forceMount, ...scrollbarProps } = props;
689
- const [visible, setVisible] = React23.useState(false);
690
- const isHorizontal = props.orientation === "horizontal";
691
- const handleResize = useDebounceCallback(() => {
692
- if (context.viewport) {
693
- const isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth;
694
- const isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight;
695
- setVisible(isHorizontal ? isOverflowX : isOverflowY);
696
- }
697
- }, 10);
698
- useResizeObserver(context.viewport, handleResize);
699
- useResizeObserver(context.content, handleResize);
700
- return jsx5(Presence, { present: forceMount || visible, children: jsx5(
701
- ScrollAreaScrollbarVisible,
702
- {
703
- "data-state": visible ? "visible" : "hidden",
704
- ...scrollbarProps,
705
- ref: forwardedRef
706
- }
707
- ) });
708
- });
709
- var ScrollAreaScrollbarVisible = React23.forwardRef((props, forwardedRef) => {
710
- const { orientation = "vertical", ...scrollbarProps } = props;
711
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
712
- const thumbRef = React23.useRef(null);
713
- const pointerOffsetRef = React23.useRef(0);
714
- const [sizes, setSizes] = React23.useState({
715
- content: 0,
716
- viewport: 0,
717
- scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
718
- });
719
- const thumbRatio = getThumbRatio(sizes.viewport, sizes.content);
720
- const commonProps = {
721
- ...scrollbarProps,
722
- sizes,
723
- onSizesChange: setSizes,
724
- hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),
725
- onThumbChange: /* @__PURE__ */ __name((thumb) => thumbRef.current = thumb, "onThumbChange"),
726
- onThumbPointerUp: /* @__PURE__ */ __name(() => pointerOffsetRef.current = 0, "onThumbPointerUp"),
727
- onThumbPointerDown: /* @__PURE__ */ __name((pointerPos) => pointerOffsetRef.current = pointerPos, "onThumbPointerDown")
728
- };
729
- function getScrollPosition(pointerPos, dir) {
730
- return getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir);
731
- }
732
- __name(getScrollPosition, "getScrollPosition");
733
- if (orientation === "horizontal") {
734
- return jsx5(
735
- ScrollAreaScrollbarX,
736
- {
737
- ...commonProps,
738
- ref: forwardedRef,
739
- onThumbPositionChange: /* @__PURE__ */ __name(() => {
740
- if (context.viewport && thumbRef.current) {
741
- const scrollPos = context.viewport.scrollLeft;
742
- const offset = getThumbOffsetFromScroll(scrollPos, sizes, context.dir);
743
- thumbRef.current.style.transform = `translate3d(${offset}px, 0, 0)`;
744
- }
745
- }, "onThumbPositionChange"),
746
- onWheelScroll: /* @__PURE__ */ __name((scrollPos) => {
747
- if (context.viewport) context.viewport.scrollLeft = scrollPos;
748
- }, "onWheelScroll"),
749
- onDragScroll: /* @__PURE__ */ __name((pointerPos) => {
750
- if (context.viewport) {
751
- context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir);
752
- }
753
- }, "onDragScroll")
754
- }
755
- );
756
- }
757
- if (orientation === "vertical") {
758
- return jsx5(
759
- ScrollAreaScrollbarY,
760
- {
761
- ...commonProps,
762
- ref: forwardedRef,
763
- onThumbPositionChange: /* @__PURE__ */ __name(() => {
764
- if (context.viewport && thumbRef.current) {
765
- const scrollPos = context.viewport.scrollTop;
766
- const offset = getThumbOffsetFromScroll(scrollPos, sizes);
767
- thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`;
768
- }
769
- }, "onThumbPositionChange"),
770
- onWheelScroll: /* @__PURE__ */ __name((scrollPos) => {
771
- if (context.viewport) context.viewport.scrollTop = scrollPos;
772
- }, "onWheelScroll"),
773
- onDragScroll: /* @__PURE__ */ __name((pointerPos) => {
774
- if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);
775
- }, "onDragScroll")
776
- }
777
- );
778
- }
779
- return null;
780
- });
781
- var ScrollAreaScrollbarX = React23.forwardRef((props, forwardedRef) => {
782
- const { sizes, onSizesChange, ...scrollbarProps } = props;
783
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
784
- const [computedStyle, setComputedStyle] = React23.useState();
785
- const ref = React23.useRef(null);
786
- const composeRefs2 = useComposedRefs(forwardedRef, ref, context.onScrollbarXChange);
787
- React23.useEffect(() => {
788
- if (ref.current) setComputedStyle(getComputedStyle(ref.current));
789
- }, [ref]);
790
- return jsx5(
791
- ScrollAreaScrollbarImpl,
792
- {
793
- "data-orientation": "horizontal",
794
- ...scrollbarProps,
795
- ref: composeRefs2,
796
- sizes,
797
- style: {
798
- bottom: 0,
799
- left: context.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
800
- right: context.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
801
- ["--radix-scroll-area-thumb-width"]: getThumbSize(sizes) + "px",
802
- ...props.style
803
- },
804
- onThumbPointerDown: /* @__PURE__ */ __name((pointerPos) => props.onThumbPointerDown(pointerPos.x), "onThumbPointerDown"),
805
- onDragScroll: /* @__PURE__ */ __name((pointerPos) => props.onDragScroll(pointerPos.x), "onDragScroll"),
806
- onWheelScroll: /* @__PURE__ */ __name((event, maxScrollPos) => {
807
- if (context.viewport) {
808
- const scrollPos = context.viewport.scrollLeft + event.deltaX;
809
- props.onWheelScroll(scrollPos);
810
- if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {
811
- event.preventDefault();
812
- }
813
- }
814
- }, "onWheelScroll"),
815
- onResize: /* @__PURE__ */ __name(() => {
816
- if (ref.current && context.viewport && computedStyle) {
817
- onSizesChange({
818
- content: context.viewport.scrollWidth,
819
- viewport: context.viewport.offsetWidth,
820
- scrollbar: {
821
- size: ref.current.clientWidth,
822
- paddingStart: toInt(computedStyle.paddingLeft),
823
- paddingEnd: toInt(computedStyle.paddingRight)
824
- }
825
- });
826
- }
827
- }, "onResize")
828
- }
829
- );
830
- });
831
- var ScrollAreaScrollbarY = React23.forwardRef((props, forwardedRef) => {
832
- const { sizes, onSizesChange, ...scrollbarProps } = props;
833
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
834
- const [computedStyle, setComputedStyle] = React23.useState();
835
- const ref = React23.useRef(null);
836
- const composeRefs2 = useComposedRefs(forwardedRef, ref, context.onScrollbarYChange);
837
- React23.useEffect(() => {
838
- if (ref.current) setComputedStyle(getComputedStyle(ref.current));
839
- }, [ref]);
840
- return jsx5(
841
- ScrollAreaScrollbarImpl,
842
- {
843
- "data-orientation": "vertical",
844
- ...scrollbarProps,
845
- ref: composeRefs2,
846
- sizes,
847
- style: {
848
- top: 0,
849
- right: context.dir === "ltr" ? 0 : void 0,
850
- left: context.dir === "rtl" ? 0 : void 0,
851
- bottom: "var(--radix-scroll-area-corner-height)",
852
- ["--radix-scroll-area-thumb-height"]: getThumbSize(sizes) + "px",
853
- ...props.style
854
- },
855
- onThumbPointerDown: /* @__PURE__ */ __name((pointerPos) => props.onThumbPointerDown(pointerPos.y), "onThumbPointerDown"),
856
- onDragScroll: /* @__PURE__ */ __name((pointerPos) => props.onDragScroll(pointerPos.y), "onDragScroll"),
857
- onWheelScroll: /* @__PURE__ */ __name((event, maxScrollPos) => {
858
- if (context.viewport) {
859
- const scrollPos = context.viewport.scrollTop + event.deltaY;
860
- props.onWheelScroll(scrollPos);
861
- if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {
862
- event.preventDefault();
863
- }
864
- }
865
- }, "onWheelScroll"),
866
- onResize: /* @__PURE__ */ __name(() => {
867
- if (ref.current && context.viewport && computedStyle) {
868
- onSizesChange({
869
- content: context.viewport.scrollHeight,
870
- viewport: context.viewport.offsetHeight,
871
- scrollbar: {
872
- size: ref.current.clientHeight,
873
- paddingStart: toInt(computedStyle.paddingTop),
874
- paddingEnd: toInt(computedStyle.paddingBottom)
875
- }
876
- });
877
- }
878
- }, "onResize")
879
- }
880
- );
881
- });
882
- var [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME);
883
- var ScrollAreaScrollbarImpl = React23.forwardRef((props, forwardedRef) => {
884
- const {
885
- __scopeScrollArea,
886
- sizes,
887
- hasThumb,
888
- onThumbChange,
889
- onThumbPointerUp,
890
- onThumbPointerDown,
891
- onThumbPositionChange,
892
- onDragScroll,
893
- onWheelScroll,
894
- onResize,
895
- ...scrollbarProps
896
- } = props;
897
- const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
898
- const [scrollbar, setScrollbar] = React23.useState(null);
899
- const composeRefs2 = useComposedRefs(forwardedRef, (node) => setScrollbar(node));
900
- const rectRef = React23.useRef(null);
901
- const prevWebkitUserSelectRef = React23.useRef("");
902
- const viewport = context.viewport;
903
- const maxScrollPos = sizes.content - sizes.viewport;
904
- const handleWheelScroll = useCallbackRef(onWheelScroll);
905
- const handleThumbPositionChange = useCallbackRef(onThumbPositionChange);
906
- const handleResize = useDebounceCallback(onResize, 10);
907
- function handleDragScroll(event) {
908
- if (rectRef.current) {
909
- const x = event.clientX - rectRef.current.left;
910
- const y = event.clientY - rectRef.current.top;
911
- onDragScroll({ x, y });
912
- }
913
- }
914
- __name(handleDragScroll, "handleDragScroll");
915
- React23.useEffect(() => {
916
- const handleWheel = /* @__PURE__ */ __name((event) => {
917
- const element = event.target;
918
- const isScrollbarWheel = scrollbar?.contains(element);
919
- if (isScrollbarWheel) handleWheelScroll(event, maxScrollPos);
920
- }, "handleWheel");
921
- document.addEventListener("wheel", handleWheel, { passive: false });
922
- return () => document.removeEventListener("wheel", handleWheel, { passive: false });
923
- }, [viewport, scrollbar, maxScrollPos, handleWheelScroll]);
924
- React23.useEffect(handleThumbPositionChange, [sizes, handleThumbPositionChange]);
925
- useResizeObserver(scrollbar, handleResize);
926
- useResizeObserver(context.content, handleResize);
927
- return jsx5(
928
- ScrollbarProvider,
929
- {
930
- scope: __scopeScrollArea,
931
- scrollbar,
932
- hasThumb,
933
- onThumbChange: useCallbackRef(onThumbChange),
934
- onThumbPointerUp: useCallbackRef(onThumbPointerUp),
935
- onThumbPositionChange: handleThumbPositionChange,
936
- onThumbPointerDown: useCallbackRef(onThumbPointerDown),
937
- children: jsx5(
938
- Primitive.div,
939
- {
940
- ...scrollbarProps,
941
- ref: composeRefs2,
942
- style: { position: "absolute", ...scrollbarProps.style },
943
- onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
944
- const mainPointer = 0;
945
- if (event.button === mainPointer) {
946
- const element = event.target;
947
- element.setPointerCapture(event.pointerId);
948
- rectRef.current = scrollbar.getBoundingClientRect();
949
- prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
950
- document.body.style.webkitUserSelect = "none";
951
- if (context.viewport) context.viewport.style.scrollBehavior = "auto";
952
- handleDragScroll(event);
953
- }
954
- }),
955
- onPointerMove: composeEventHandlers(props.onPointerMove, handleDragScroll),
956
- onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
957
- const element = event.target;
958
- if (element.hasPointerCapture(event.pointerId)) {
959
- element.releasePointerCapture(event.pointerId);
960
- }
961
- document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
962
- if (context.viewport) context.viewport.style.scrollBehavior = "";
963
- rectRef.current = null;
964
- })
965
- }
966
- )
967
- }
968
- );
969
- });
970
- var THUMB_NAME = "ScrollAreaThumb";
971
- var ScrollAreaThumb = React23.forwardRef(
972
- (props, forwardedRef) => {
973
- const { forceMount, ...thumbProps } = props;
974
- const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);
975
- return jsx5(Presence, { present: forceMount || scrollbarContext.hasThumb, children: jsx5(ScrollAreaThumbImpl, { ref: forwardedRef, ...thumbProps }) });
976
- }
977
- );
978
- var ScrollAreaThumbImpl = React23.forwardRef(
979
- (props, forwardedRef) => {
980
- const { __scopeScrollArea, style, ...thumbProps } = props;
981
- const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);
982
- const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);
983
- const { onThumbPositionChange } = scrollbarContext;
984
- const composedRef = useComposedRefs(
985
- forwardedRef,
986
- (node) => scrollbarContext.onThumbChange(node)
987
- );
988
- const removeUnlinkedScrollListenerRef = React23.useRef();
989
- const debounceScrollEnd = useDebounceCallback(() => {
990
- if (removeUnlinkedScrollListenerRef.current) {
991
- removeUnlinkedScrollListenerRef.current();
992
- removeUnlinkedScrollListenerRef.current = void 0;
993
- }
994
- }, 100);
995
- React23.useEffect(() => {
996
- const viewport = scrollAreaContext.viewport;
997
- if (viewport) {
998
- const handleScroll = /* @__PURE__ */ __name(() => {
999
- debounceScrollEnd();
1000
- if (!removeUnlinkedScrollListenerRef.current) {
1001
- const listener = addUnlinkedScrollListener(viewport, onThumbPositionChange);
1002
- removeUnlinkedScrollListenerRef.current = listener;
1003
- onThumbPositionChange();
1004
- }
1005
- }, "handleScroll");
1006
- onThumbPositionChange();
1007
- viewport.addEventListener("scroll", handleScroll);
1008
- return () => viewport.removeEventListener("scroll", handleScroll);
1009
- }
1010
- }, [scrollAreaContext.viewport, debounceScrollEnd, onThumbPositionChange]);
1011
- return jsx5(
1012
- Primitive.div,
1013
- {
1014
- "data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
1015
- ...thumbProps,
1016
- ref: composedRef,
1017
- style: {
1018
- width: "var(--radix-scroll-area-thumb-width)",
1019
- height: "var(--radix-scroll-area-thumb-height)",
1020
- ...style
1021
- },
1022
- onPointerDownCapture: composeEventHandlers(props.onPointerDownCapture, (event) => {
1023
- const thumb = event.target;
1024
- const thumbRect = thumb.getBoundingClientRect();
1025
- const x = event.clientX - thumbRect.left;
1026
- const y = event.clientY - thumbRect.top;
1027
- scrollbarContext.onThumbPointerDown({ x, y });
1028
- }),
1029
- onPointerUp: composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp)
1030
- }
1031
- );
1032
- }
1033
- );
1034
- ScrollAreaThumb.displayName = THUMB_NAME;
1035
- var CORNER_NAME = "ScrollAreaCorner";
1036
- var ScrollAreaCorner = React23.forwardRef(
1037
- (props, forwardedRef) => {
1038
- const context = useScrollAreaContext(CORNER_NAME, props.__scopeScrollArea);
1039
- const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
1040
- const hasCorner = context.type !== "scroll" && hasBothScrollbarsVisible;
1041
- return hasCorner ? jsx5(ScrollAreaCornerImpl, { ...props, ref: forwardedRef }) : null;
1042
- }
1043
- );
1044
- ScrollAreaCorner.displayName = CORNER_NAME;
1045
- var ScrollAreaCornerImpl = React23.forwardRef((props, forwardedRef) => {
1046
- const { __scopeScrollArea, ...cornerProps } = props;
1047
- const context = useScrollAreaContext(CORNER_NAME, __scopeScrollArea);
1048
- const [width, setWidth] = React23.useState(0);
1049
- const [height, setHeight] = React23.useState(0);
1050
- const hasSize = Boolean(width && height);
1051
- useResizeObserver(context.scrollbarX, () => {
1052
- const height2 = context.scrollbarX?.offsetHeight || 0;
1053
- context.onCornerHeightChange(height2);
1054
- setHeight(height2);
1055
- });
1056
- useResizeObserver(context.scrollbarY, () => {
1057
- const width2 = context.scrollbarY?.offsetWidth || 0;
1058
- context.onCornerWidthChange(width2);
1059
- setWidth(width2);
1060
- });
1061
- return hasSize ? jsx5(
1062
- Primitive.div,
1063
- {
1064
- ...cornerProps,
1065
- ref: forwardedRef,
1066
- style: {
1067
- width,
1068
- height,
1069
- position: "absolute",
1070
- right: context.dir === "ltr" ? 0 : void 0,
1071
- left: context.dir === "rtl" ? 0 : void 0,
1072
- bottom: 0,
1073
- ...props.style
1074
- }
1075
- }
1076
- ) : null;
1077
- });
1078
- function toInt(value) {
1079
- return value ? parseInt(value, 10) : 0;
1080
- }
1081
- __name(toInt, "toInt");
1082
- function getThumbRatio(viewportSize, contentSize) {
1083
- const ratio = viewportSize / contentSize;
1084
- return isNaN(ratio) ? 0 : ratio;
1085
- }
1086
- __name(getThumbRatio, "getThumbRatio");
1087
- function getThumbSize(sizes) {
1088
- const ratio = getThumbRatio(sizes.viewport, sizes.content);
1089
- const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
1090
- const thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio;
1091
- return Math.max(thumbSize, 18);
1092
- }
1093
- __name(getThumbSize, "getThumbSize");
1094
- function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes, dir = "ltr") {
1095
- const thumbSizePx = getThumbSize(sizes);
1096
- const thumbCenter = thumbSizePx / 2;
1097
- const offset = pointerOffset || thumbCenter;
1098
- const thumbOffsetFromEnd = thumbSizePx - offset;
1099
- const minPointerPos = sizes.scrollbar.paddingStart + offset;
1100
- const maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd;
1101
- const maxScrollPos = sizes.content - sizes.viewport;
1102
- const scrollRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
1103
- const interpolate = linearScale([minPointerPos, maxPointerPos], scrollRange);
1104
- return interpolate(pointerPos);
1105
- }
1106
- __name(getScrollPositionFromPointer, "getScrollPositionFromPointer");
1107
- function getThumbOffsetFromScroll(scrollPos, sizes, dir = "ltr") {
1108
- const thumbSizePx = getThumbSize(sizes);
1109
- const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
1110
- const scrollbar = sizes.scrollbar.size - scrollbarPadding;
1111
- const maxScrollPos = sizes.content - sizes.viewport;
1112
- const maxThumbPos = scrollbar - thumbSizePx;
1113
- const scrollClampRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
1114
- const scrollWithoutMomentum = clamp(scrollPos, scrollClampRange);
1115
- const interpolate = linearScale([0, maxScrollPos], [0, maxThumbPos]);
1116
- return interpolate(scrollWithoutMomentum);
1117
- }
1118
- __name(getThumbOffsetFromScroll, "getThumbOffsetFromScroll");
1119
- function linearScale(input, output) {
1120
- return (value) => {
1121
- if (input[0] === input[1] || output[0] === output[1]) return output[0];
1122
- const ratio = (output[1] - output[0]) / (input[1] - input[0]);
1123
- return output[0] + ratio * (value - input[0]);
1124
- };
1125
- }
1126
- __name(linearScale, "linearScale");
1127
- function isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {
1128
- return scrollPos > 0 && scrollPos < maxScrollPos;
1129
- }
1130
- __name(isScrollingWithinScrollbarBounds, "isScrollingWithinScrollbarBounds");
1131
- var addUnlinkedScrollListener = /* @__PURE__ */ __name((node, handler = () => {
1132
- }) => {
1133
- let prevPosition = { left: node.scrollLeft, top: node.scrollTop };
1134
- let rAF = 0;
1135
- (/* @__PURE__ */ __name(function loop() {
1136
- const position = { left: node.scrollLeft, top: node.scrollTop };
1137
- const isHorizontalScroll = prevPosition.left !== position.left;
1138
- const isVerticalScroll = prevPosition.top !== position.top;
1139
- if (isHorizontalScroll || isVerticalScroll) handler();
1140
- prevPosition = position;
1141
- rAF = window.requestAnimationFrame(loop);
1142
- }, "loop"))();
1143
- return () => window.cancelAnimationFrame(rAF);
1144
- }, "addUnlinkedScrollListener");
1145
- function useDebounceCallback(callback, delay) {
1146
- const handleCallback = useCallbackRef(callback);
1147
- const debounceTimerRef = React23.useRef(0);
1148
- React23.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
1149
- return React23.useCallback(() => {
1150
- window.clearTimeout(debounceTimerRef.current);
1151
- debounceTimerRef.current = window.setTimeout(handleCallback, delay);
1152
- }, [handleCallback, delay]);
1153
- }
1154
- __name(useDebounceCallback, "useDebounceCallback");
1155
- function useResizeObserver(element, onResize) {
1156
- const handleResize = useCallbackRef(onResize);
1157
- useLayoutEffect2(() => {
1158
- let rAF = 0;
1159
- if (element) {
1160
- const resizeObserver = new ResizeObserver(() => {
1161
- cancelAnimationFrame(rAF);
1162
- rAF = window.requestAnimationFrame(handleResize);
1163
- });
1164
- resizeObserver.observe(element);
1165
- return () => {
1166
- window.cancelAnimationFrame(rAF);
1167
- resizeObserver.unobserve(element);
1168
- };
1169
- }
1170
- }, [element, handleResize]);
1171
- }
1172
- __name(useResizeObserver, "useResizeObserver");
1173
- function getSubtree(options, content) {
1174
- const { asChild, children } = options;
1175
- if (!asChild) return typeof content === "function" ? content(children) : content;
1176
- const firstChild = React23.Children.only(children);
1177
- return React23.cloneElement(firstChild, {
1178
- children: typeof content === "function" ? content(firstChild.props.children) : content
1179
- });
1180
- }
1181
- __name(getSubtree, "getSubtree");
1182
- var Root = ScrollArea;
1183
- var Viewport = ScrollAreaViewport;
1184
- var Scrollbar = ScrollAreaScrollbar;
1185
- var Thumb = ScrollAreaThumb;
1186
- var Corner = ScrollAreaCorner;
1187
-
1188
- // src/components/components/ScrollArea/ScrollArea.tsx
1189
- import { styled as styled2 } from "storybook/theming";
1190
- var ScrollAreaRoot = styled2(Root)(
1191
- ({ scrollbarsize, offset }) => ({
1192
- width: "100%",
1193
- height: "100%",
1194
- overflow: "hidden",
1195
- "--scrollbar-size": `${scrollbarsize + offset}px`,
1196
- "--radix-scroll-area-thumb-width": `${scrollbarsize}px`
1197
- })
1198
- );
1199
- var ScrollAreaViewport2 = styled2(Viewport)({
1200
- width: "100%",
1201
- height: "100%"
1202
- });
1203
- var ScrollAreaScrollbar2 = styled2(Scrollbar)(({ offset, horizontal, vertical }) => ({
1204
- display: "flex",
1205
- userSelect: "none",
1206
- // ensures no selection
1207
- touchAction: "none",
1208
- // disable browser handling of all panning and zooming gestures on touch devices
1209
- background: "transparent",
1210
- transition: "all 0.2s ease-out",
1211
- borderRadius: "var(--scrollbar-size)",
1212
- zIndex: 1,
1213
- '&[data-orientation="vertical"]': {
1214
- width: "var(--scrollbar-size)",
1215
- paddingRight: offset,
1216
- marginTop: offset,
1217
- marginBottom: horizontal === "true" && vertical === "true" ? 0 : offset
1218
- },
1219
- '&[data-orientation="horizontal"]': {
1220
- flexDirection: "column",
1221
- height: "var(--scrollbar-size)",
1222
- paddingBottom: offset,
1223
- marginLeft: offset,
1224
- marginRight: horizontal === "true" && vertical === "true" ? 0 : offset
1225
- }
1226
- }));
1227
- var ScrollAreaThumb2 = styled2(Thumb)(({ theme }) => ({
1228
- flex: 1,
1229
- background: theme.textMutedColor,
1230
- opacity: 0.5,
1231
- borderRadius: `var(--scrollbar-size)`,
1232
- position: "relative",
1233
- transition: "opacity 0.2s ease-out",
1234
- "&:hover": { opacity: 0.8 },
1235
- /* increase target size for touch devices https://www.w3.org/WAI/WCAG21/Understanding/target-size.html */
1236
- "::before": {
1237
- content: '""',
1238
- position: "absolute",
1239
- top: "50%",
1240
- left: "50%",
1241
- transform: "translate(-50%,-50%)",
1242
- width: "100%",
1243
- height: "100%"
1244
- }
1245
- }));
1246
- var ScrollArea2 = forwardRef4(
1247
- ({ children, horizontal = false, vertical = false, offset = 2, scrollbarSize = 6, className }, ref) => React11.createElement(ScrollAreaRoot, { scrollbarsize: scrollbarSize, offset, className }, React11.createElement(ScrollAreaViewport2, { ref }, children), horizontal && React11.createElement(
1248
- ScrollAreaScrollbar2,
1249
- {
1250
- orientation: "horizontal",
1251
- offset,
1252
- horizontal: horizontal.toString(),
1253
- vertical: vertical.toString()
1254
- },
1255
- React11.createElement(ScrollAreaThumb2, null)
1256
- ), vertical && React11.createElement(
1257
- ScrollAreaScrollbar2,
1258
- {
1259
- orientation: "vertical",
1260
- offset,
1261
- horizontal: horizontal.toString(),
1262
- vertical: vertical.toString()
1263
- },
1264
- React11.createElement(ScrollAreaThumb2, null)
1265
- ), horizontal && vertical && React11.createElement(Corner, null))
1266
- );
1267
- ScrollArea2.displayName = "ScrollArea";
1268
-
1269
- // src/components/components/syntaxhighlighter/clipboard.ts
1270
- import { global } from "@storybook/global";
1271
- var { document: document2, window: globalWindow } = global;
1272
- async function copyUsingClipboardAPI(text) {
1273
- try {
1274
- await globalWindow.top?.navigator.clipboard.writeText(text);
1275
- } catch {
1276
- await globalWindow.navigator.clipboard.writeText(text);
1277
- }
1278
- }
1279
- __name(copyUsingClipboardAPI, "copyUsingClipboardAPI");
1280
- async function copyUsingWorkAround(text) {
1281
- const tmp = document2.createElement("TEXTAREA");
1282
- const focus = document2.activeElement;
1283
- tmp.value = text;
1284
- document2.body.appendChild(tmp);
1285
- tmp.select();
1286
- document2.execCommand("copy");
1287
- document2.body.removeChild(tmp);
1288
- focus.focus();
1289
- }
1290
- __name(copyUsingWorkAround, "copyUsingWorkAround");
1291
- function createCopyToClipboardFunction() {
1292
- return globalWindow.navigator?.clipboard ? copyUsingClipboardAPI : copyUsingWorkAround;
1293
- }
1294
- __name(createCopyToClipboardFunction, "createCopyToClipboardFunction");
1295
-
1296
- export {
1297
- ActionBar,
1298
- ScrollArea2 as ScrollArea,
1299
- createCopyToClipboardFunction
1300
- };