@blockle/blocks 0.11.3 → 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
@@ -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,23 +205,18 @@ 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
212
  const [position, setPosition] = react.useState({ x: 0, y: 0 });
214
- const dropdownRef = react.useRef(null);
215
- const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles(
216
- "dropdown",
217
- { base: true, variants: { variant } },
218
- false
219
- );
213
+ const popoverRef = react.useRef(null);
214
+ const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("popover", { base: true }, false);
220
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
222
  react.useEffect(() => {
@@ -229,7 +224,7 @@ const Dropdown = ({
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,13 +237,13 @@ 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 () => {
@@ -264,12 +259,12 @@ const Dropdown = ({
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,10 +288,19 @@ const Dropdown = ({
297
288
  }
298
289
  ) });
299
290
  };
300
- const Tooltip = ({ align = "top", children, label }) => {
291
+ const Tooltip = ({
292
+ align = "top",
293
+ children,
294
+ label,
295
+ colorScheme
296
+ }) => {
301
297
  const id = react.useId();
302
298
  const ref = react.useRef(null);
303
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
304
  react.useEffect(() => {
305
305
  const element = ref.current;
306
306
  if (!element) {
@@ -336,7 +336,7 @@ const Tooltip = ({ align = "top", children, label }) => {
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
  )
@@ -376,11 +376,8 @@ type SwitchTheme = {
376
376
  base: string;
377
377
  slider: string;
378
378
  };
379
- type DropdownTheme = {
379
+ type PopoverTheme = {
380
380
  base: string;
381
- variants: {
382
- variant: 'solid' | 'outline';
383
- };
384
381
  };
385
382
  type SelectTheme = {
386
383
  wrapper?: string;
@@ -400,21 +397,28 @@ type SliderTheme = {
400
397
  colorScheme: 'primary' | 'secondary';
401
398
  };
402
399
  };
400
+ type TooltipTheme = {
401
+ base: string;
402
+ variants: {
403
+ colorScheme: 'primary' | 'secondary';
404
+ };
405
+ };
403
406
  type ComponentThemes = {
404
407
  button: ButtonTheme;
405
408
  checkbox: CheckboxTheme;
406
409
  dialog: DialogTheme;
407
410
  divider: DividerTheme;
408
- dropdown: DropdownTheme;
409
411
  input: InputTheme;
410
412
  label: LabelTheme;
411
413
  link: LinkTheme;
414
+ popover: PopoverTheme;
412
415
  progress: ProgressTheme;
413
416
  radio: RadioTheme;
414
417
  select: SelectTheme;
418
+ slider: SliderTheme;
415
419
  spinner: SpinnerTheme;
416
420
  switch: SwitchTheme;
417
- slider: SliderTheme;
421
+ tooltip: TooltipTheme;
418
422
  };
419
423
  /**
420
424
  * ComponentThemeProps is a helper type to define the props passed to useComponentStyles.
@@ -1069,7 +1073,7 @@ type DialogProps = {
1069
1073
  };
1070
1074
  declare const Dialog: React.FC<DialogProps>;
1071
1075
 
1072
- type DropdownProps = {
1076
+ type PopoverProps = {
1073
1077
  align?: 'top' | 'bottom' | 'left' | 'right';
1074
1078
  anchorElement: React.RefObject<HTMLElement>;
1075
1079
  children: React.ReactNode;
@@ -1078,14 +1082,14 @@ type DropdownProps = {
1078
1082
  open: boolean;
1079
1083
  repositionOnScroll?: boolean;
1080
1084
  style?: React.CSSProperties;
1081
- variant?: DropdownTheme['variants']['variant'];
1082
1085
  } & HTMLElementProps<HTMLDivElement>;
1083
1086
 
1084
1087
  type ReactElement = React.ReactElement<any, string | React.JSXElementConstructor<any>>;
1085
1088
  type TooltipProps = {
1086
- align?: DropdownProps['align'];
1089
+ align?: PopoverProps['align'];
1087
1090
  children: ReactElement;
1088
1091
  label: React.ReactNode;
1092
+ colorScheme?: TooltipTheme['variants']['colorScheme'];
1089
1093
  };
1090
1094
  declare const Tooltip: React.FC<TooltipProps>;
1091
1095
 
@@ -3,30 +3,32 @@ const styles_themes_momotaro_components_button_css_cjs = require("./button.css.c
3
3
  const styles_themes_momotaro_components_checkbox_css_cjs = require("./checkbox.css.cjs");
4
4
  const styles_themes_momotaro_components_dialog_css_cjs = require("./dialog.css.cjs");
5
5
  const styles_themes_momotaro_components_divider_css_cjs = require("./divider.css.cjs");
6
- const styles_themes_momotaro_components_dropdown_css_cjs = require("./dropdown.css.cjs");
7
6
  const styles_themes_momotaro_components_input_css_cjs = require("./input.css.cjs");
8
7
  const styles_themes_momotaro_components_label_css_cjs = require("./label.css.cjs");
9
8
  const styles_themes_momotaro_components_link_css_cjs = require("./link.css.cjs");
9
+ const styles_themes_momotaro_components_popover_css_cjs = require("./popover.css.cjs");
10
10
  const styles_themes_momotaro_components_progress_css_cjs = require("./progress.css.cjs");
11
11
  const styles_themes_momotaro_components_radio_css_cjs = require("./radio.css.cjs");
12
12
  const styles_themes_momotaro_components_select_css_cjs = require("./select.css.cjs");
13
13
  const styles_themes_momotaro_components_slider_css_cjs = require("./slider.css.cjs");
14
14
  const styles_themes_momotaro_components_spinner_css_cjs = require("./spinner.css.cjs");
15
15
  const styles_themes_momotaro_components_switch_css_cjs = require("./switch.css.cjs");
16
+ const styles_themes_momotaro_components_tooltip_css_cjs = require("./tooltip.css.cjs");
16
17
  const components = {
17
18
  button: styles_themes_momotaro_components_button_css_cjs.button,
18
19
  checkbox: styles_themes_momotaro_components_checkbox_css_cjs.checkbox,
19
20
  dialog: styles_themes_momotaro_components_dialog_css_cjs.dialog,
20
21
  divider: styles_themes_momotaro_components_divider_css_cjs.divider,
21
- dropdown: styles_themes_momotaro_components_dropdown_css_cjs.dropdown,
22
22
  input: styles_themes_momotaro_components_input_css_cjs.input,
23
23
  label: styles_themes_momotaro_components_label_css_cjs.label,
24
24
  link: styles_themes_momotaro_components_link_css_cjs.link,
25
+ popover: styles_themes_momotaro_components_popover_css_cjs.popover,
25
26
  progress: styles_themes_momotaro_components_progress_css_cjs.progress,
26
27
  radio: styles_themes_momotaro_components_radio_css_cjs.radio,
27
28
  select: styles_themes_momotaro_components_select_css_cjs.select,
29
+ slider: styles_themes_momotaro_components_slider_css_cjs.slider,
28
30
  spinner: styles_themes_momotaro_components_spinner_css_cjs.spinner,
29
31
  switch: styles_themes_momotaro_components_switch_css_cjs.switchTheme,
30
- slider: styles_themes_momotaro_components_slider_css_cjs.slider
32
+ tooltip: styles_themes_momotaro_components_tooltip_css_cjs.tooltip
31
33
  };
32
34
  exports.components = components;
@@ -2,31 +2,33 @@ import { button } from "./button.css.mjs";
2
2
  import { checkbox } from "./checkbox.css.mjs";
3
3
  import { dialog } from "./dialog.css.mjs";
4
4
  import { divider } from "./divider.css.mjs";
5
- import { dropdown } from "./dropdown.css.mjs";
6
5
  import { input } from "./input.css.mjs";
7
6
  import { label } from "./label.css.mjs";
8
7
  import { link } from "./link.css.mjs";
8
+ import { popover } from "./popover.css.mjs";
9
9
  import { progress } from "./progress.css.mjs";
10
10
  import { radio } from "./radio.css.mjs";
11
11
  import { select } from "./select.css.mjs";
12
12
  import { slider } from "./slider.css.mjs";
13
13
  import { spinner } from "./spinner.css.mjs";
14
14
  import { switchTheme } from "./switch.css.mjs";
15
+ import { tooltip } from "./tooltip.css.mjs";
15
16
  const components = {
16
17
  button,
17
18
  checkbox,
18
19
  dialog,
19
20
  divider,
20
- dropdown,
21
21
  input,
22
22
  label,
23
23
  link,
24
+ popover,
24
25
  progress,
25
26
  radio,
26
27
  select,
28
+ slider,
27
29
  spinner,
28
30
  switch: switchTheme,
29
- slider
31
+ tooltip
30
32
  };
31
33
  export {
32
34
  components
@@ -2,16 +2,15 @@
2
2
  const fileScope = require("@vanilla-extract/css/fileScope");
3
3
  const styles_lib_css_style_style_cjs = require("../../../lib/css/style/style.cjs");
4
4
  const styles_lib_theme_makeComponentTheme_cjs = require("../../../lib/theme/makeComponentTheme.cjs");
5
- fileScope.setFileScope("src/themes/momotaro/components/dropdown.css.ts", "@blockle/blocks");
6
- const dropdown = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("dropdown", {
5
+ fileScope.setFileScope("src/themes/momotaro/components/popover.css.ts", "@blockle/blocks");
6
+ const popover = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("popover", {
7
7
  base: styles_lib_css_style_style_cjs.style({
8
8
  backgroundColor: "white",
9
9
  borderRadius: "small",
10
10
  boxShadow: "medium",
11
11
  padding: "medium",
12
- vars: {
13
- "--spacing": "0.5rem"
14
- },
12
+ margin: "small",
13
+ // Space between the popover and the anchor element
15
14
  selectors: {
16
15
  "&[data-open]": {
17
16
  transform: "scale(1)",
@@ -26,28 +25,7 @@ const dropdown = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("dro
26
25
  opacity: 0
27
26
  }
28
27
  }
29
- }),
30
- variants: {
31
- variant: {
32
- solid: styles_lib_css_style_style_cjs.style({
33
- backgroundColor: "white",
34
- border: "none",
35
- boxShadow: "medium",
36
- color: "black",
37
- padding: "medium"
38
- }),
39
- outline: styles_lib_css_style_style_cjs.style({
40
- backgroundColor: "transparent",
41
- border: "1px solid black",
42
- boxShadow: "none",
43
- color: "black",
44
- padding: "medium"
45
- })
46
- }
47
- },
48
- defaultVariants: {
49
- variant: "solid"
50
- }
28
+ })
51
29
  });
52
30
  fileScope.endFileScope();
53
- exports.dropdown = dropdown;
31
+ exports.popover = popover;
@@ -1,16 +1,15 @@
1
1
  import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
2
  import { style } from "../../../lib/css/style/style.mjs";
3
3
  import { makeComponentTheme } from "../../../lib/theme/makeComponentTheme.mjs";
4
- setFileScope("src/themes/momotaro/components/dropdown.css.ts", "@blockle/blocks");
5
- const dropdown = makeComponentTheme("dropdown", {
4
+ setFileScope("src/themes/momotaro/components/popover.css.ts", "@blockle/blocks");
5
+ const popover = makeComponentTheme("popover", {
6
6
  base: style({
7
7
  backgroundColor: "white",
8
8
  borderRadius: "small",
9
9
  boxShadow: "medium",
10
10
  padding: "medium",
11
- vars: {
12
- "--spacing": "0.5rem"
13
- },
11
+ margin: "small",
12
+ // Space between the popover and the anchor element
14
13
  selectors: {
15
14
  "&[data-open]": {
16
15
  transform: "scale(1)",
@@ -25,30 +24,9 @@ const dropdown = makeComponentTheme("dropdown", {
25
24
  opacity: 0
26
25
  }
27
26
  }
28
- }),
29
- variants: {
30
- variant: {
31
- solid: style({
32
- backgroundColor: "white",
33
- border: "none",
34
- boxShadow: "medium",
35
- color: "black",
36
- padding: "medium"
37
- }),
38
- outline: style({
39
- backgroundColor: "transparent",
40
- border: "1px solid black",
41
- boxShadow: "none",
42
- color: "black",
43
- padding: "medium"
44
- })
45
- }
46
- },
47
- defaultVariants: {
48
- variant: "solid"
49
- }
27
+ })
50
28
  });
51
29
  endFileScope();
52
30
  export {
53
- dropdown
31
+ popover
54
32
  };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ const fileScope = require("@vanilla-extract/css/fileScope");
3
+ const styles_lib_css_style_style_cjs = require("../../../lib/css/style/style.cjs");
4
+ const styles_lib_theme_makeComponentTheme_cjs = require("../../../lib/theme/makeComponentTheme.cjs");
5
+ fileScope.setFileScope("src/themes/momotaro/components/tooltip.css.ts", "@blockle/blocks");
6
+ const tooltip = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("tooltip", {
7
+ base: styles_lib_css_style_style_cjs.style({
8
+ backgroundColor: "primary",
9
+ padding: "small"
10
+ }),
11
+ variants: {
12
+ colorScheme: {
13
+ primary: styles_lib_css_style_style_cjs.style({
14
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
15
+ boxShadow: "0 0 0 1px rgba(255, 255, 255, 0.1)",
16
+ color: "white"
17
+ }),
18
+ secondary: styles_lib_css_style_style_cjs.style({
19
+ backgroundColor: "rgba(255, 255, 255, 0.8)",
20
+ boxShadow: "0 0 0 1px rgba(0, 0, 0, 0.1)",
21
+ color: "black"
22
+ })
23
+ }
24
+ },
25
+ defaultVariants: {
26
+ colorScheme: "primary"
27
+ }
28
+ });
29
+ fileScope.endFileScope();
30
+ exports.tooltip = tooltip;
@@ -0,0 +1,31 @@
1
+ import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
+ import { style } from "../../../lib/css/style/style.mjs";
3
+ import { makeComponentTheme } from "../../../lib/theme/makeComponentTheme.mjs";
4
+ setFileScope("src/themes/momotaro/components/tooltip.css.ts", "@blockle/blocks");
5
+ const tooltip = makeComponentTheme("tooltip", {
6
+ base: style({
7
+ backgroundColor: "primary",
8
+ padding: "small"
9
+ }),
10
+ variants: {
11
+ colorScheme: {
12
+ primary: style({
13
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
14
+ boxShadow: "0 0 0 1px rgba(255, 255, 255, 0.1)",
15
+ color: "white"
16
+ }),
17
+ secondary: style({
18
+ backgroundColor: "rgba(255, 255, 255, 0.8)",
19
+ boxShadow: "0 0 0 1px rgba(0, 0, 0, 0.1)",
20
+ color: "black"
21
+ })
22
+ }
23
+ },
24
+ defaultVariants: {
25
+ colorScheme: "primary"
26
+ }
27
+ });
28
+ endFileScope();
29
+ export {
30
+ tooltip
31
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockle/blocks",
3
- "version": "0.11.3",
3
+ "version": "0.12.0",
4
4
  "description": "Blocks design system",
5
5
  "repository": "git@github.com:Blockle/blocks.git",
6
6
  "license": "MIT",