@blockle/blocks 0.11.2 → 0.12.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.
package/dist/index.cjs CHANGED
@@ -8,7 +8,7 @@ const styles_lib_theme_vars_css_cjs = require("./styles/lib/theme/vars.css.cjs")
8
8
  const styles_components_display_Divider_Divider_cjs = require("./styles/components/display/Divider/Divider.cjs");
9
9
  const styles_lib_css_atoms_sprinkles_css_cjs = require("./styles/lib/css/atoms/sprinkles.css.cjs");
10
10
  const jsxRuntime = require("react/jsx-runtime");
11
- const require$$0 = require("react");
11
+ const react = require("react");
12
12
  const styles_components_form_Button_Button_cjs = require("./styles/components/form/Button/Button.cjs");
13
13
  const styles_components_form_Checkbox_Checkbox_cjs = require("./styles/components/form/Checkbox/Checkbox.cjs");
14
14
  const styles_components_form_Input_Input_cjs = require("./styles/components/form/Input/Input.cjs");
@@ -20,7 +20,7 @@ const styles_components_other_BlocksProvider_BlocksProvider_cjs = require("./sty
20
20
  const styles_components_overlay_Dialog_Dialog_cjs = require("./styles/components/overlay/Dialog/Dialog.cjs");
21
21
  const styles_components_typography_Heading_Heading_cjs = require("./styles/components/typography/Heading/Heading.cjs");
22
22
  const styles_components_typography_Text_Text_cjs = require("./styles/components/typography/Text/Text.cjs");
23
- const Progress = require$$0.forwardRef(function Progress2({ value, max = 100, className, ...restProps }, ref) {
23
+ const Progress = react.forwardRef(function Progress2({ value, max = 100, className, ...restProps }, ref) {
24
24
  const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles(
25
25
  "progress",
26
26
  {
@@ -120,7 +120,7 @@ const Stack = ({
120
120
  );
121
121
  };
122
122
  const Slottable = styles_components_display_Divider_Divider_cjs.createSlottable("a");
123
- const Link = require$$0.forwardRef(function Link2({ asChild, className, children, variant, underline, ...restProps }, ref) {
123
+ const Link = react.forwardRef(function Link2({ asChild, className, children, variant, underline, ...restProps }, ref) {
124
124
  const linkClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("link", {
125
125
  base: true,
126
126
  variants: { variant, underline }
@@ -137,7 +137,7 @@ const Link = require$$0.forwardRef(function Link2({ asChild, className, children
137
137
  );
138
138
  });
139
139
  const useClickOutside = (ref, onClickOutside, { enabled = true } = {}) => {
140
- require$$0.useEffect(() => {
140
+ react.useEffect(() => {
141
141
  if (!enabled) {
142
142
  return;
143
143
  }
@@ -152,19 +152,19 @@ const useClickOutside = (ref, onClickOutside, { enabled = true } = {}) => {
152
152
  };
153
153
  }, [ref, onClickOutside, enabled]);
154
154
  };
155
- function getDropdownPosition(align, anchorRef, dropdownRef) {
156
- if (!anchorRef.current || !dropdownRef.current) {
155
+ function getDopoverPosition(align, anchorRef, popoverRef) {
156
+ if (!anchorRef.current || !popoverRef.current) {
157
157
  return [0, 0];
158
158
  }
159
- dropdownRef.current.style.transform = "none";
160
- dropdownRef.current.style.transitionDuration = "0s";
159
+ popoverRef.current.style.transform = "none";
160
+ popoverRef.current.style.transitionDuration = "0s";
161
161
  const anchorRect = anchorRef.current.getBoundingClientRect();
162
- const dropdownRect = dropdownRef.current.getBoundingClientRect();
163
- const dropdownStyles = getComputedStyle(dropdownRef.current);
164
- const marginTop = Number.parseFloat(dropdownStyles.getPropertyValue("margin-top"));
165
- const marginRight = Number.parseFloat(dropdownStyles.getPropertyValue("margin-right"));
166
- const marginBottom = Number.parseFloat(dropdownStyles.getPropertyValue("margin-bottom"));
167
- const marginLeft = Number.parseFloat(dropdownStyles.getPropertyValue("margin-left"));
162
+ const popoverRect = popoverRef.current.getBoundingClientRect();
163
+ const popoverStyles = getComputedStyle(popoverRef.current);
164
+ const marginTop = Number.parseFloat(popoverStyles.getPropertyValue("margin-top"));
165
+ const marginRight = Number.parseFloat(popoverStyles.getPropertyValue("margin-right"));
166
+ const marginBottom = Number.parseFloat(popoverStyles.getPropertyValue("margin-bottom"));
167
+ const marginLeft = Number.parseFloat(popoverStyles.getPropertyValue("margin-left"));
168
168
  const marginY = marginTop + marginBottom;
169
169
  const marginX = marginRight + marginLeft;
170
170
  const docHeight = document.documentElement.clientHeight;
@@ -173,30 +173,30 @@ function getDropdownPosition(align, anchorRef, dropdownRef) {
173
173
  const docScrollLeft = document.documentElement.scrollLeft;
174
174
  const anchorLeft = anchorRect.left + docScrollLeft;
175
175
  const anchorTop = anchorRect.top + docScrollTop;
176
- const topPosition = anchorRect.top - (dropdownRect.height + marginTop);
177
- const rightPosition = anchorRect.left + anchorRect.width + dropdownRect.width;
178
- const bottomPosition = anchorRect.top + anchorRect.height + dropdownRect.height;
179
- const leftPosition = anchorRect.left - dropdownRect.width;
180
- const offsetX = anchorLeft - (dropdownRect.width - anchorRect.width) / 2;
181
- const offsetY = anchorTop - (dropdownRect.height - anchorRect.height) / 2;
182
- dropdownRef.current.style.transform = "";
183
- dropdownRef.current.style.transitionDuration = "";
176
+ const topPosition = anchorRect.top - (popoverRect.height + marginTop);
177
+ const rightPosition = anchorRect.left + anchorRect.width + popoverRect.width;
178
+ const bottomPosition = anchorRect.top + anchorRect.height + popoverRect.height;
179
+ const leftPosition = anchorRect.left - popoverRect.width;
180
+ const offsetX = anchorLeft - marginLeft - (popoverRect.width - anchorRect.width) / 2;
181
+ const offsetY = anchorTop - marginTop - (popoverRect.height - anchorRect.height) / 2;
182
+ popoverRef.current.style.transform = "";
183
+ popoverRef.current.style.transitionDuration = "";
184
184
  switch (align) {
185
185
  case "top": {
186
- return topPosition > 0 ? [offsetX, anchorTop - dropdownRect.height - marginY] : [offsetX, anchorTop + anchorRect.height];
186
+ return topPosition > 0 ? [offsetX, anchorTop - popoverRect.height - marginY] : [offsetX, anchorTop + anchorRect.height];
187
187
  }
188
188
  case "bottom": {
189
- return bottomPosition < docHeight || topPosition < 0 ? [offsetX, anchorTop + anchorRect.height] : [offsetX, anchorTop - dropdownRect.height - marginY];
189
+ return bottomPosition < docHeight || topPosition < 0 ? [offsetX, anchorTop + anchorRect.height] : [offsetX, anchorTop - popoverRect.height - marginY];
190
190
  }
191
191
  case "left": {
192
- return leftPosition > docWidth || leftPosition > 0 ? [anchorLeft - dropdownRect.width - marginX, offsetY] : [anchorLeft + anchorRect.width, offsetY];
192
+ return leftPosition > docWidth || leftPosition > 0 ? [anchorLeft - popoverRect.width - marginX, offsetY] : [anchorLeft + anchorRect.width, offsetY];
193
193
  }
194
194
  case "right": {
195
- return rightPosition < docWidth || leftPosition < 0 ? [anchorLeft + anchorRect.width, offsetY] : [anchorLeft - dropdownRect.width - marginX, offsetY];
195
+ return rightPosition < docWidth || leftPosition < 0 ? [anchorLeft + anchorRect.width, offsetY] : [anchorLeft - popoverRect.width - marginX, offsetY];
196
196
  }
197
197
  }
198
198
  }
199
- const Dropdown = ({
199
+ const Popover = ({
200
200
  align = "bottom",
201
201
  anchorElement,
202
202
  children,
@@ -205,31 +205,26 @@ const Dropdown = ({
205
205
  open,
206
206
  repositionOnScroll,
207
207
  style,
208
- variant,
209
208
  ...restProps
210
209
  }) => {
211
210
  const layer = styles_components_overlay_Dialog_Dialog_cjs.useLayer();
212
211
  const [visible, hide] = styles_components_overlay_Dialog_Dialog_cjs.useVisibilityState(open);
213
- const [position, setPosition] = require$$0.useState({ x: 0, y: 0 });
214
- const dropdownRef = require$$0.useRef(null);
215
- const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles(
216
- "dropdown",
217
- { base: true, variants: { variant } },
218
- false
219
- );
220
- require$$0.useLayoutEffect(() => {
212
+ const [position, setPosition] = react.useState({ x: 0, y: 0 });
213
+ const popoverRef = react.useRef(null);
214
+ const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("popover", { base: true }, false);
215
+ react.useLayoutEffect(() => {
221
216
  if (!visible) {
222
217
  return;
223
218
  }
224
- const position2 = getDropdownPosition(align, anchorElement, dropdownRef);
219
+ const position2 = getDopoverPosition(align, anchorElement, popoverRef);
225
220
  setPosition({ x: position2[0], y: position2[1] });
226
221
  }, [align, anchorElement, visible]);
227
- require$$0.useEffect(() => {
222
+ react.useEffect(() => {
228
223
  if (!open || !repositionOnScroll) {
229
224
  return;
230
225
  }
231
226
  function handleResize() {
232
- const position2 = getDropdownPosition(align, anchorElement, dropdownRef);
227
+ const position2 = getDopoverPosition(align, anchorElement, popoverRef);
233
228
  setPosition({ x: position2[0], y: position2[1] });
234
229
  }
235
230
  window.addEventListener("resize", handleResize);
@@ -242,34 +237,34 @@ const Dropdown = ({
242
237
  styles_components_overlay_Dialog_Dialog_cjs.useIsomorphicLayoutEffect(() => {
243
238
  var _a;
244
239
  if (!open) {
245
- (_a = dropdownRef.current) == null ? void 0 : _a.removeAttribute("data-open");
240
+ (_a = popoverRef.current) == null ? void 0 : _a.removeAttribute("data-open");
246
241
  return;
247
242
  }
248
243
  let timer = requestAnimationFrame(() => {
249
244
  timer = requestAnimationFrame(() => {
250
245
  var _a2;
251
- (_a2 = dropdownRef.current) == null ? void 0 : _a2.setAttribute("data-open", "");
246
+ (_a2 = popoverRef.current) == null ? void 0 : _a2.setAttribute("data-open", "");
252
247
  });
253
248
  });
254
249
  return () => {
255
250
  cancelAnimationFrame(timer);
256
251
  };
257
252
  }, [open, visible]);
258
- const onAnimationEnd = require$$0.useCallback(() => {
253
+ const onAnimationEnd = react.useCallback(() => {
259
254
  if (!open) {
260
255
  hide();
261
256
  }
262
257
  }, [hide, open]);
263
- require$$0.useEffect(() => {
258
+ react.useEffect(() => {
264
259
  if (open) {
265
260
  return;
266
261
  }
267
- if (!styles_components_overlay_Dialog_Dialog_cjs.hasAnimationDuration(dropdownRef.current)) {
262
+ if (!styles_components_overlay_Dialog_Dialog_cjs.hasAnimationDuration(popoverRef.current)) {
268
263
  hide();
269
264
  }
270
265
  }, [hide, open]);
271
266
  styles_components_overlay_Dialog_Dialog_cjs.useKeyboard("Escape", onRequestClose, { enabled: visible });
272
- useClickOutside(dropdownRef, onRequestClose, { enabled: visible });
267
+ useClickOutside(popoverRef, onRequestClose, { enabled: visible });
273
268
  if (!visible) {
274
269
  return null;
275
270
  }
@@ -277,7 +272,7 @@ const Dropdown = ({
277
272
  return /* @__PURE__ */ jsxRuntime.jsx(styles_components_overlay_Dialog_Dialog_cjs.Portal, { container: layer(), children: /* @__PURE__ */ jsxRuntime.jsx(
278
273
  styles_components_display_Divider_Divider_cjs.Box,
279
274
  {
280
- ref: dropdownRef,
275
+ ref: popoverRef,
281
276
  "data-open": dataOpen,
282
277
  onAnimationEnd,
283
278
  onTransitionEnd: onAnimationEnd,
@@ -285,10 +280,6 @@ const Dropdown = ({
285
280
  position: "absolute",
286
281
  style: {
287
282
  ...style,
288
- // TODO Think about how to handle this, perhaps we could add a custom class to the dropdown
289
- // Or we remove it from getDropdownPosition?
290
- // "horizontal" ? "vertical"
291
- margin: align === "bottom" || align === "top" ? "var(--spacing) 0" : "0 var(--spacing)",
292
283
  left: position.x,
293
284
  top: position.y
294
285
  },
@@ -297,11 +288,20 @@ const Dropdown = ({
297
288
  }
298
289
  ) });
299
290
  };
300
- const Tooltip = ({ align = "top", children, label }) => {
301
- const id = require$$0.useId();
302
- const ref = require$$0.useRef(null);
303
- const [open, setOpen] = require$$0.useState(false);
304
- require$$0.useEffect(() => {
291
+ const Tooltip = ({
292
+ align = "top",
293
+ children,
294
+ label,
295
+ colorScheme
296
+ }) => {
297
+ const id = react.useId();
298
+ const ref = react.useRef(null);
299
+ const [open, setOpen] = react.useState(false);
300
+ const tooltipClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("tooltip", {
301
+ base: true,
302
+ variants: { colorScheme }
303
+ });
304
+ react.useEffect(() => {
305
305
  const element = ref.current;
306
306
  if (!element) {
307
307
  return;
@@ -323,20 +323,20 @@ const Tooltip = ({ align = "top", children, label }) => {
323
323
  element.removeEventListener("focusout", onLeave);
324
324
  };
325
325
  }, [ref, setOpen]);
326
- if (require$$0.Children.count(children) !== 1) {
326
+ if (react.Children.count(children) !== 1) {
327
327
  throw new Error("Tooltip component can only have one child");
328
328
  }
329
- const child = require$$0.Children.toArray(children)[0];
330
- if (!require$$0.isValidElement(child)) {
329
+ const child = react.Children.toArray(children)[0];
330
+ if (!react.isValidElement(child)) {
331
331
  return null;
332
332
  }
333
333
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
334
- require$$0.cloneElement(child, {
334
+ react.cloneElement(child, {
335
335
  ref: styles_components_display_Divider_Divider_cjs.composeRefs(ref, child.ref),
336
336
  ["aria-describedby"]: open ? id : void 0
337
337
  }),
338
338
  /* @__PURE__ */ jsxRuntime.jsx(
339
- Dropdown,
339
+ Popover,
340
340
  {
341
341
  id,
342
342
  role: "tooltip",
@@ -346,6 +346,7 @@ const Tooltip = ({ align = "top", children, label }) => {
346
346
  setOpen(false);
347
347
  },
348
348
  align,
349
+ className: tooltipClassName,
349
350
  children: label
350
351
  }
351
352
  )
package/dist/index.mjs CHANGED
@@ -154,19 +154,19 @@ const useClickOutside = (ref, onClickOutside, { enabled = true } = {}) => {
154
154
  };
155
155
  }, [ref, onClickOutside, enabled]);
156
156
  };
157
- function getDropdownPosition(align, anchorRef, dropdownRef) {
158
- if (!anchorRef.current || !dropdownRef.current) {
157
+ function getDopoverPosition(align, anchorRef, popoverRef) {
158
+ if (!anchorRef.current || !popoverRef.current) {
159
159
  return [0, 0];
160
160
  }
161
- dropdownRef.current.style.transform = "none";
162
- dropdownRef.current.style.transitionDuration = "0s";
161
+ popoverRef.current.style.transform = "none";
162
+ popoverRef.current.style.transitionDuration = "0s";
163
163
  const anchorRect = anchorRef.current.getBoundingClientRect();
164
- const dropdownRect = dropdownRef.current.getBoundingClientRect();
165
- const dropdownStyles = getComputedStyle(dropdownRef.current);
166
- const marginTop = Number.parseFloat(dropdownStyles.getPropertyValue("margin-top"));
167
- const marginRight = Number.parseFloat(dropdownStyles.getPropertyValue("margin-right"));
168
- const marginBottom = Number.parseFloat(dropdownStyles.getPropertyValue("margin-bottom"));
169
- const marginLeft = Number.parseFloat(dropdownStyles.getPropertyValue("margin-left"));
164
+ const popoverRect = popoverRef.current.getBoundingClientRect();
165
+ const popoverStyles = getComputedStyle(popoverRef.current);
166
+ const marginTop = Number.parseFloat(popoverStyles.getPropertyValue("margin-top"));
167
+ const marginRight = Number.parseFloat(popoverStyles.getPropertyValue("margin-right"));
168
+ const marginBottom = Number.parseFloat(popoverStyles.getPropertyValue("margin-bottom"));
169
+ const marginLeft = Number.parseFloat(popoverStyles.getPropertyValue("margin-left"));
170
170
  const marginY = marginTop + marginBottom;
171
171
  const marginX = marginRight + marginLeft;
172
172
  const docHeight = document.documentElement.clientHeight;
@@ -175,30 +175,30 @@ function getDropdownPosition(align, anchorRef, dropdownRef) {
175
175
  const docScrollLeft = document.documentElement.scrollLeft;
176
176
  const anchorLeft = anchorRect.left + docScrollLeft;
177
177
  const anchorTop = anchorRect.top + docScrollTop;
178
- const topPosition = anchorRect.top - (dropdownRect.height + marginTop);
179
- const rightPosition = anchorRect.left + anchorRect.width + dropdownRect.width;
180
- const bottomPosition = anchorRect.top + anchorRect.height + dropdownRect.height;
181
- const leftPosition = anchorRect.left - dropdownRect.width;
182
- const offsetX = anchorLeft - (dropdownRect.width - anchorRect.width) / 2;
183
- const offsetY = anchorTop - (dropdownRect.height - anchorRect.height) / 2;
184
- dropdownRef.current.style.transform = "";
185
- dropdownRef.current.style.transitionDuration = "";
178
+ const topPosition = anchorRect.top - (popoverRect.height + marginTop);
179
+ const rightPosition = anchorRect.left + anchorRect.width + popoverRect.width;
180
+ const bottomPosition = anchorRect.top + anchorRect.height + popoverRect.height;
181
+ const leftPosition = anchorRect.left - popoverRect.width;
182
+ const offsetX = anchorLeft - marginLeft - (popoverRect.width - anchorRect.width) / 2;
183
+ const offsetY = anchorTop - marginTop - (popoverRect.height - anchorRect.height) / 2;
184
+ popoverRef.current.style.transform = "";
185
+ popoverRef.current.style.transitionDuration = "";
186
186
  switch (align) {
187
187
  case "top": {
188
- return topPosition > 0 ? [offsetX, anchorTop - dropdownRect.height - marginY] : [offsetX, anchorTop + anchorRect.height];
188
+ return topPosition > 0 ? [offsetX, anchorTop - popoverRect.height - marginY] : [offsetX, anchorTop + anchorRect.height];
189
189
  }
190
190
  case "bottom": {
191
- return bottomPosition < docHeight || topPosition < 0 ? [offsetX, anchorTop + anchorRect.height] : [offsetX, anchorTop - dropdownRect.height - marginY];
191
+ return bottomPosition < docHeight || topPosition < 0 ? [offsetX, anchorTop + anchorRect.height] : [offsetX, anchorTop - popoverRect.height - marginY];
192
192
  }
193
193
  case "left": {
194
- return leftPosition > docWidth || leftPosition > 0 ? [anchorLeft - dropdownRect.width - marginX, offsetY] : [anchorLeft + anchorRect.width, offsetY];
194
+ return leftPosition > docWidth || leftPosition > 0 ? [anchorLeft - popoverRect.width - marginX, offsetY] : [anchorLeft + anchorRect.width, offsetY];
195
195
  }
196
196
  case "right": {
197
- return rightPosition < docWidth || leftPosition < 0 ? [anchorLeft + anchorRect.width, offsetY] : [anchorLeft - dropdownRect.width - marginX, offsetY];
197
+ return rightPosition < docWidth || leftPosition < 0 ? [anchorLeft + anchorRect.width, offsetY] : [anchorLeft - popoverRect.width - marginX, offsetY];
198
198
  }
199
199
  }
200
200
  }
201
- const Dropdown = ({
201
+ const Popover = ({
202
202
  align = "bottom",
203
203
  anchorElement,
204
204
  children,
@@ -207,23 +207,18 @@ const Dropdown = ({
207
207
  open,
208
208
  repositionOnScroll,
209
209
  style: style2,
210
- variant,
211
210
  ...restProps
212
211
  }) => {
213
212
  const layer = useLayer();
214
213
  const [visible, hide] = useVisibilityState(open);
215
214
  const [position, setPosition] = useState({ x: 0, y: 0 });
216
- const dropdownRef = useRef(null);
217
- const containerClassName = useComponentStyles(
218
- "dropdown",
219
- { base: true, variants: { variant } },
220
- false
221
- );
215
+ const popoverRef = useRef(null);
216
+ const containerClassName = useComponentStyles("popover", { base: true }, false);
222
217
  useLayoutEffect(() => {
223
218
  if (!visible) {
224
219
  return;
225
220
  }
226
- const position2 = getDropdownPosition(align, anchorElement, dropdownRef);
221
+ const position2 = getDopoverPosition(align, anchorElement, popoverRef);
227
222
  setPosition({ x: position2[0], y: position2[1] });
228
223
  }, [align, anchorElement, visible]);
229
224
  useEffect(() => {
@@ -231,7 +226,7 @@ const Dropdown = ({
231
226
  return;
232
227
  }
233
228
  function handleResize() {
234
- const position2 = getDropdownPosition(align, anchorElement, dropdownRef);
229
+ const position2 = getDopoverPosition(align, anchorElement, popoverRef);
235
230
  setPosition({ x: position2[0], y: position2[1] });
236
231
  }
237
232
  window.addEventListener("resize", handleResize);
@@ -244,13 +239,13 @@ const Dropdown = ({
244
239
  useIsomorphicLayoutEffect(() => {
245
240
  var _a;
246
241
  if (!open) {
247
- (_a = dropdownRef.current) == null ? void 0 : _a.removeAttribute("data-open");
242
+ (_a = popoverRef.current) == null ? void 0 : _a.removeAttribute("data-open");
248
243
  return;
249
244
  }
250
245
  let timer = requestAnimationFrame(() => {
251
246
  timer = requestAnimationFrame(() => {
252
247
  var _a2;
253
- (_a2 = dropdownRef.current) == null ? void 0 : _a2.setAttribute("data-open", "");
248
+ (_a2 = popoverRef.current) == null ? void 0 : _a2.setAttribute("data-open", "");
254
249
  });
255
250
  });
256
251
  return () => {
@@ -266,12 +261,12 @@ const Dropdown = ({
266
261
  if (open) {
267
262
  return;
268
263
  }
269
- if (!hasAnimationDuration(dropdownRef.current)) {
264
+ if (!hasAnimationDuration(popoverRef.current)) {
270
265
  hide();
271
266
  }
272
267
  }, [hide, open]);
273
268
  useKeyboard("Escape", onRequestClose, { enabled: visible });
274
- useClickOutside(dropdownRef, onRequestClose, { enabled: visible });
269
+ useClickOutside(popoverRef, onRequestClose, { enabled: visible });
275
270
  if (!visible) {
276
271
  return null;
277
272
  }
@@ -279,7 +274,7 @@ const Dropdown = ({
279
274
  return /* @__PURE__ */ jsx(Portal, { container: layer(), children: /* @__PURE__ */ jsx(
280
275
  Box,
281
276
  {
282
- ref: dropdownRef,
277
+ ref: popoverRef,
283
278
  "data-open": dataOpen,
284
279
  onAnimationEnd,
285
280
  onTransitionEnd: onAnimationEnd,
@@ -287,10 +282,6 @@ const Dropdown = ({
287
282
  position: "absolute",
288
283
  style: {
289
284
  ...style2,
290
- // TODO Think about how to handle this, perhaps we could add a custom class to the dropdown
291
- // Or we remove it from getDropdownPosition?
292
- // "horizontal" ? "vertical"
293
- margin: align === "bottom" || align === "top" ? "var(--spacing) 0" : "0 var(--spacing)",
294
285
  left: position.x,
295
286
  top: position.y
296
287
  },
@@ -299,10 +290,19 @@ const Dropdown = ({
299
290
  }
300
291
  ) });
301
292
  };
302
- const Tooltip = ({ align = "top", children, label }) => {
293
+ const Tooltip = ({
294
+ align = "top",
295
+ children,
296
+ label,
297
+ colorScheme
298
+ }) => {
303
299
  const id = useId();
304
300
  const ref = useRef(null);
305
301
  const [open, setOpen] = useState(false);
302
+ const tooltipClassName = useComponentStyles("tooltip", {
303
+ base: true,
304
+ variants: { colorScheme }
305
+ });
306
306
  useEffect(() => {
307
307
  const element = ref.current;
308
308
  if (!element) {
@@ -338,7 +338,7 @@ const Tooltip = ({ align = "top", children, label }) => {
338
338
  ["aria-describedby"]: open ? id : void 0
339
339
  }),
340
340
  /* @__PURE__ */ jsx(
341
- Dropdown,
341
+ Popover,
342
342
  {
343
343
  id,
344
344
  role: "tooltip",
@@ -348,6 +348,7 @@ const Tooltip = ({ align = "top", children, label }) => {
348
348
  setOpen(false);
349
349
  },
350
350
  align,
351
+ className: tooltipClassName,
351
352
  children: label
352
353
  }
353
354
  )