@blockle/blocks 0.7.0 → 0.7.2

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
@@ -5,13 +5,15 @@ const styles_lib_theme_makeComponentTheme_cjs = require("./styles/lib/theme/make
5
5
  const styles_lib_theme_makeTheme_cjs = require("./styles/lib/theme/makeTheme.cjs");
6
6
  const styles_lib_theme_vars_css_cjs = require("./styles/lib/theme/vars.css.cjs");
7
7
  const styles_lib_css_atoms_sprinkles_css_cjs = require("./styles/lib/css/atoms/sprinkles.css.cjs");
8
- const react = require("react");
9
8
  const jsxRuntime = require("react/jsx-runtime");
9
+ const react = require("react");
10
10
  const styles_components_Button_Button_css_cjs = require("./styles/components/Button/Button.css.cjs");
11
+ const styles_components_Checkbox_checkbox_css_cjs = require("./styles/components/Checkbox/checkbox.css.cjs");
11
12
  const styles_components_Dialog_dialog_css_cjs = require("./styles/components/Dialog/dialog.css.cjs");
12
13
  const reactDom = require("react-dom");
13
14
  const styles_components_Divider_divider_css_cjs = require("./styles/components/Divider/divider.css.cjs");
14
15
  const styles_components_Input_input_css_cjs = require("./styles/components/Input/input.css.cjs");
16
+ const styles_components_Radio_radio_css_cjs = require("./styles/components/Radio/radio.css.cjs");
15
17
  const classnames = (...args) => {
16
18
  const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
17
19
  return className || void 0;
@@ -172,38 +174,45 @@ const Button = react.forwardRef(function Button2({
172
174
  }
173
175
  );
174
176
  });
175
- const useLayer = () => {
176
- const layerRef = react.useRef();
177
- react.useEffect(
178
- () => () => {
179
- if (layerRef.current) {
180
- layerRef.current.remove();
181
- }
182
- },
183
- []
184
- );
185
- return () => {
186
- if (!layerRef.current) {
187
- const div = document.createElement("div");
188
- div.dataset.layer = "blocks";
189
- layerRef.current = div;
190
- document.body.append(layerRef.current);
191
- }
192
- return layerRef.current;
193
- };
194
- };
195
- const useVisibilityState = (open) => {
196
- const [visible, setVisible] = react.useState(open);
197
- const hide = react.useCallback(() => {
198
- setVisible(false);
199
- }, []);
200
- react.useEffect(() => {
201
- if (open) {
202
- setVisible(true);
177
+ const Label = ({
178
+ visualOnly,
179
+ children,
180
+ className,
181
+ required,
182
+ size,
183
+ cursor,
184
+ ...restProps
185
+ }) => {
186
+ const Component = visualOnly ? "span" : "label";
187
+ const containerClassName = useComponentStyles("label", {
188
+ base: true,
189
+ variants: { required, size }
190
+ });
191
+ return /* @__PURE__ */ jsxRuntime.jsx(
192
+ Component,
193
+ {
194
+ className: classnames(containerClassName, className, styles_lib_css_atoms_sprinkles_css_cjs.atoms({ cursor })),
195
+ ...restProps,
196
+ children
203
197
  }
204
- }, [open]);
205
- return [visible, hide];
198
+ );
206
199
  };
200
+ const Checkbox = react.forwardRef(function Checkbox2({ name, label, required, className, ...restProps }, ref) {
201
+ const containerClassName = useComponentStyles("checkbox", { base: true }, false);
202
+ const iconClassName = useComponentStyles("checkbox", { icon: true }, false);
203
+ const labelClassName = useComponentStyles("checkbox", { label: true }, false);
204
+ const input = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classnames(styles_components_Checkbox_checkbox_css_cjs.container, containerClassName, className), children: [
205
+ /* @__PURE__ */ jsxRuntime.jsx("input", { ref, type: "checkbox", name, className: styles_components_Checkbox_checkbox_css_cjs.input, ...restProps }),
206
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classnames(styles_components_Checkbox_checkbox_css_cjs.icon, iconClassName) })
207
+ ] });
208
+ if (!label) {
209
+ return input;
210
+ }
211
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: labelClassName, children: [
212
+ input,
213
+ label && /* @__PURE__ */ jsxRuntime.jsx(Label, { visualOnly: true, required, children: label })
214
+ ] });
215
+ });
207
216
  const focusableSelectors = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
208
217
  const getFirstFocusableElement = (container) => {
209
218
  const focusable = container.querySelector(focusableSelectors);
@@ -231,7 +240,38 @@ const useFocusLock = ({ ref, active }) => {
231
240
  };
232
241
  }, [active]);
233
242
  };
234
- const useIsomorphicLayoutEffect = typeof window !== "undefined" ? react.useLayoutEffect : react.useEffect;
243
+ const useLayer = () => {
244
+ const layerRef = react.useRef();
245
+ react.useEffect(
246
+ () => () => {
247
+ if (layerRef.current) {
248
+ layerRef.current.remove();
249
+ }
250
+ },
251
+ []
252
+ );
253
+ return () => {
254
+ if (!layerRef.current) {
255
+ const div = document.createElement("div");
256
+ div.dataset.layer = "blocks";
257
+ layerRef.current = div;
258
+ document.body.append(layerRef.current);
259
+ }
260
+ return layerRef.current;
261
+ };
262
+ };
263
+ const useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
264
+ const usePreventBodyScroll = (enabled = true) => {
265
+ useIsomorphicLayoutEffect(() => {
266
+ const prevValue = document.body.style.getPropertyValue("overflow");
267
+ if (enabled) {
268
+ document.body.style.overflow = "hidden";
269
+ }
270
+ return () => {
271
+ document.body.style.overflow = prevValue;
272
+ };
273
+ }, [enabled]);
274
+ };
235
275
  const useRestoreFocus = (active) => {
236
276
  const [target, setTarget] = react.useState(null);
237
277
  useIsomorphicLayoutEffect(() => {
@@ -245,6 +285,25 @@ const useRestoreFocus = (active) => {
245
285
  }
246
286
  }, [active]);
247
287
  };
288
+ const useVisibilityState = (open) => {
289
+ const [visible, setVisible] = react.useState(open);
290
+ const hide = react.useCallback(() => {
291
+ setVisible(false);
292
+ }, []);
293
+ react.useEffect(() => {
294
+ if (open) {
295
+ setVisible(true);
296
+ }
297
+ }, [open]);
298
+ return [visible, hide];
299
+ };
300
+ const Portal = ({ children, container }) => {
301
+ const context = useTheme();
302
+ return reactDom.createPortal(
303
+ /* @__PURE__ */ jsxRuntime.jsx(BlocksProvider, { theme: context, children }),
304
+ container || document.body
305
+ );
306
+ };
248
307
  const DialogContext = react.createContext(void 0);
249
308
  const useNestedDialog = (open) => {
250
309
  const parentDialog = react.useContext(DialogContext);
@@ -259,24 +318,6 @@ const useNestedDialog = (open) => {
259
318
  }, [parentDialog, open]);
260
319
  return !!parentDialog;
261
320
  };
262
- const usePreventBodyScroll = (enabled = true) => {
263
- useIsomorphicLayoutEffect(() => {
264
- const prevValue = document.body.style.getPropertyValue("overflow");
265
- if (enabled) {
266
- document.body.style.overflow = "hidden";
267
- }
268
- return () => {
269
- document.body.style.overflow = prevValue;
270
- };
271
- }, [enabled]);
272
- };
273
- const Portal = ({ children, container }) => {
274
- const context = useTheme();
275
- return reactDom.createPortal(
276
- /* @__PURE__ */ jsxRuntime.jsx(BlocksProvider, { theme: context, children }),
277
- container || document.body
278
- );
279
- };
280
321
  const Dialog = ({
281
322
  children,
282
323
  open,
@@ -456,29 +497,6 @@ const Input = react.forwardRef(function Input2({ className, name, type = "text",
456
497
  endSlot
457
498
  ] }) });
458
499
  });
459
- const Label = ({
460
- visualOnly,
461
- children,
462
- className,
463
- required,
464
- size,
465
- cursor,
466
- ...restProps
467
- }) => {
468
- const Component = visualOnly ? "span" : "label";
469
- const containerClassName = useComponentStyles("label", {
470
- base: true,
471
- variants: { required, size }
472
- });
473
- return /* @__PURE__ */ jsxRuntime.jsx(
474
- Component,
475
- {
476
- className: classnames(containerClassName, className, styles_lib_css_atoms_sprinkles_css_cjs.atoms({ cursor })),
477
- ...restProps,
478
- children
479
- }
480
- );
481
- };
482
500
  const defaultElement = "a";
483
501
  const Link = react.forwardRef(function Link2({ as, className, variant, underline, ...restProps }, ref) {
484
502
  const Component = as || defaultElement;
@@ -488,6 +506,22 @@ const Link = react.forwardRef(function Link2({ as, className, variant, underline
488
506
  });
489
507
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { ref, as: Component, className: classnames(className, linkClassName), ...restProps });
490
508
  });
509
+ const Radio = react.forwardRef(function Checkbox3({ name, label, className, ...restProps }, ref) {
510
+ const containerClassName = useComponentStyles("radio", { base: true }, false);
511
+ const iconClassName = useComponentStyles("radio", { icon: true }, false);
512
+ const labelClassName = useComponentStyles("checkbox", { label: true }, false);
513
+ const input = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classnames(styles_components_Radio_radio_css_cjs.container, containerClassName, className), children: [
514
+ /* @__PURE__ */ jsxRuntime.jsx("input", { ref, type: "radio", name, className: styles_components_Radio_radio_css_cjs.input, ...restProps }),
515
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classnames(styles_components_Radio_radio_css_cjs.icon, iconClassName) })
516
+ ] });
517
+ if (!label) {
518
+ return input;
519
+ }
520
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: labelClassName, children: [
521
+ input,
522
+ label && /* @__PURE__ */ jsxRuntime.jsx(Label, { visualOnly: true, children: label })
523
+ ] });
524
+ });
491
525
  const Stack = ({
492
526
  as = "div",
493
527
  display = "flex",
@@ -546,6 +580,7 @@ exports.atoms = styles_lib_css_atoms_sprinkles_css_cjs.atoms;
546
580
  exports.BlocksProvider = BlocksProvider;
547
581
  exports.Box = Box;
548
582
  exports.Button = Button;
583
+ exports.Checkbox = Checkbox;
549
584
  exports.Dialog = Dialog;
550
585
  exports.Divider = Divider;
551
586
  exports.Heading = Heading;
@@ -553,6 +588,8 @@ exports.Inline = Inline;
553
588
  exports.Input = Input;
554
589
  exports.Label = Label;
555
590
  exports.Link = Link;
591
+ exports.Portal = Portal;
592
+ exports.Radio = Radio;
556
593
  exports.Spinner = Spinner;
557
594
  exports.Stack = Stack;
558
595
  exports.Text = Text;
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, makeComponentTheme, makeTheme, useComponentStyleDefaultProps, useComponentStyles, vars } from './momotaro.chunk.js';
1
+ export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Portal, PortalProps, Radio, RadioProps, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, makeComponentTheme, makeTheme, useComponentStyleDefaultProps, useComponentStyles, vars } from './momotaro.chunk.js';
package/dist/index.mjs CHANGED
@@ -5,13 +5,15 @@ import { makeComponentTheme } from "./styles/lib/theme/makeComponentTheme.mjs";
5
5
  import { makeTheme } from "./styles/lib/theme/makeTheme.mjs";
6
6
  import { vars } from "./styles/lib/theme/vars.css.mjs";
7
7
  import { atoms } from "./styles/lib/css/atoms/sprinkles.css.mjs";
8
- import { createContext, forwardRef, useContext, useRef, useEffect, useState, useCallback, useLayoutEffect, useId } from "react";
9
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { createContext, forwardRef, useContext, useEffect, useRef, useLayoutEffect, useState, useCallback, useId } from "react";
10
10
  import { buttonReset } from "./styles/components/Button/Button.css.mjs";
11
+ import { container, input, icon } from "./styles/components/Checkbox/checkbox.css.mjs";
11
12
  import { backdropLeaveAnimation, backdropLeave, backdrop, dialogLeave, dialog } from "./styles/components/Dialog/dialog.css.mjs";
12
13
  import { createPortal } from "react-dom";
13
14
  import { divider } from "./styles/components/Divider/divider.css.mjs";
14
- import { input } from "./styles/components/Input/input.css.mjs";
15
+ import { input as input$1 } from "./styles/components/Input/input.css.mjs";
16
+ import { container as container$1, input as input$2, icon as icon$1 } from "./styles/components/Radio/radio.css.mjs";
15
17
  const classnames = (...args) => {
16
18
  const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
17
19
  return className || void 0;
@@ -172,45 +174,52 @@ const Button = forwardRef(function Button2({
172
174
  }
173
175
  );
174
176
  });
175
- const useLayer = () => {
176
- const layerRef = useRef();
177
- useEffect(
178
- () => () => {
179
- if (layerRef.current) {
180
- layerRef.current.remove();
181
- }
182
- },
183
- []
184
- );
185
- return () => {
186
- if (!layerRef.current) {
187
- const div = document.createElement("div");
188
- div.dataset.layer = "blocks";
189
- layerRef.current = div;
190
- document.body.append(layerRef.current);
191
- }
192
- return layerRef.current;
193
- };
194
- };
195
- const useVisibilityState = (open) => {
196
- const [visible, setVisible] = useState(open);
197
- const hide = useCallback(() => {
198
- setVisible(false);
199
- }, []);
200
- useEffect(() => {
201
- if (open) {
202
- setVisible(true);
177
+ const Label = ({
178
+ visualOnly,
179
+ children,
180
+ className,
181
+ required,
182
+ size,
183
+ cursor,
184
+ ...restProps
185
+ }) => {
186
+ const Component = visualOnly ? "span" : "label";
187
+ const containerClassName = useComponentStyles("label", {
188
+ base: true,
189
+ variants: { required, size }
190
+ });
191
+ return /* @__PURE__ */ jsx(
192
+ Component,
193
+ {
194
+ className: classnames(containerClassName, className, atoms({ cursor })),
195
+ ...restProps,
196
+ children
203
197
  }
204
- }, [open]);
205
- return [visible, hide];
198
+ );
206
199
  };
200
+ const Checkbox = forwardRef(function Checkbox2({ name, label, required, className, ...restProps }, ref) {
201
+ const containerClassName = useComponentStyles("checkbox", { base: true }, false);
202
+ const iconClassName = useComponentStyles("checkbox", { icon: true }, false);
203
+ const labelClassName = useComponentStyles("checkbox", { label: true }, false);
204
+ const input$12 = /* @__PURE__ */ jsxs("div", { className: classnames(container, containerClassName, className), children: [
205
+ /* @__PURE__ */ jsx("input", { ref, type: "checkbox", name, className: input, ...restProps }),
206
+ /* @__PURE__ */ jsx("div", { className: classnames(icon, iconClassName) })
207
+ ] });
208
+ if (!label) {
209
+ return input$12;
210
+ }
211
+ return /* @__PURE__ */ jsxs("label", { className: labelClassName, children: [
212
+ input$12,
213
+ label && /* @__PURE__ */ jsx(Label, { visualOnly: true, required, children: label })
214
+ ] });
215
+ });
207
216
  const focusableSelectors = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
208
- const getFirstFocusableElement = (container) => {
209
- const focusable = container.querySelector(focusableSelectors);
217
+ const getFirstFocusableElement = (container2) => {
218
+ const focusable = container2.querySelector(focusableSelectors);
210
219
  return focusable || null;
211
220
  };
212
- const focusFirstElement = (container) => {
213
- const focusable = getFirstFocusableElement(container);
221
+ const focusFirstElement = (container2) => {
222
+ const focusable = getFirstFocusableElement(container2);
214
223
  if (focusable) {
215
224
  focusable.focus();
216
225
  }
@@ -231,7 +240,38 @@ const useFocusLock = ({ ref, active }) => {
231
240
  };
232
241
  }, [active]);
233
242
  };
234
- const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
243
+ const useLayer = () => {
244
+ const layerRef = useRef();
245
+ useEffect(
246
+ () => () => {
247
+ if (layerRef.current) {
248
+ layerRef.current.remove();
249
+ }
250
+ },
251
+ []
252
+ );
253
+ return () => {
254
+ if (!layerRef.current) {
255
+ const div = document.createElement("div");
256
+ div.dataset.layer = "blocks";
257
+ layerRef.current = div;
258
+ document.body.append(layerRef.current);
259
+ }
260
+ return layerRef.current;
261
+ };
262
+ };
263
+ const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
264
+ const usePreventBodyScroll = (enabled = true) => {
265
+ useIsomorphicLayoutEffect(() => {
266
+ const prevValue = document.body.style.getPropertyValue("overflow");
267
+ if (enabled) {
268
+ document.body.style.overflow = "hidden";
269
+ }
270
+ return () => {
271
+ document.body.style.overflow = prevValue;
272
+ };
273
+ }, [enabled]);
274
+ };
235
275
  const useRestoreFocus = (active) => {
236
276
  const [target, setTarget] = useState(null);
237
277
  useIsomorphicLayoutEffect(() => {
@@ -245,6 +285,25 @@ const useRestoreFocus = (active) => {
245
285
  }
246
286
  }, [active]);
247
287
  };
288
+ const useVisibilityState = (open) => {
289
+ const [visible, setVisible] = useState(open);
290
+ const hide = useCallback(() => {
291
+ setVisible(false);
292
+ }, []);
293
+ useEffect(() => {
294
+ if (open) {
295
+ setVisible(true);
296
+ }
297
+ }, [open]);
298
+ return [visible, hide];
299
+ };
300
+ const Portal = ({ children, container: container2 }) => {
301
+ const context = useTheme();
302
+ return createPortal(
303
+ /* @__PURE__ */ jsx(BlocksProvider, { theme: context, children }),
304
+ container2 || document.body
305
+ );
306
+ };
248
307
  const DialogContext = createContext(void 0);
249
308
  const useNestedDialog = (open) => {
250
309
  const parentDialog = useContext(DialogContext);
@@ -259,24 +318,6 @@ const useNestedDialog = (open) => {
259
318
  }, [parentDialog, open]);
260
319
  return !!parentDialog;
261
320
  };
262
- const usePreventBodyScroll = (enabled = true) => {
263
- useIsomorphicLayoutEffect(() => {
264
- const prevValue = document.body.style.getPropertyValue("overflow");
265
- if (enabled) {
266
- document.body.style.overflow = "hidden";
267
- }
268
- return () => {
269
- document.body.style.overflow = prevValue;
270
- };
271
- }, [enabled]);
272
- };
273
- const Portal = ({ children, container }) => {
274
- const context = useTheme();
275
- return createPortal(
276
- /* @__PURE__ */ jsx(BlocksProvider, { theme: context, children }),
277
- container || document.body
278
- );
279
- };
280
321
  const Dialog = ({
281
322
  children,
282
323
  open,
@@ -449,36 +490,13 @@ const Input = forwardRef(function Input2({ className, name, type = "text", start
449
490
  placeholder: placeholder || label,
450
491
  width: "full",
451
492
  overflow: "hidden",
452
- className: classnames(input, inputClassName),
493
+ className: classnames(input$1, inputClassName),
453
494
  ...restProps
454
495
  }
455
496
  ),
456
497
  endSlot
457
498
  ] }) });
458
499
  });
459
- const Label = ({
460
- visualOnly,
461
- children,
462
- className,
463
- required,
464
- size,
465
- cursor,
466
- ...restProps
467
- }) => {
468
- const Component = visualOnly ? "span" : "label";
469
- const containerClassName = useComponentStyles("label", {
470
- base: true,
471
- variants: { required, size }
472
- });
473
- return /* @__PURE__ */ jsx(
474
- Component,
475
- {
476
- className: classnames(containerClassName, className, atoms({ cursor })),
477
- ...restProps,
478
- children
479
- }
480
- );
481
- };
482
500
  const defaultElement = "a";
483
501
  const Link = forwardRef(function Link2({ as, className, variant, underline, ...restProps }, ref) {
484
502
  const Component = as || defaultElement;
@@ -488,6 +506,22 @@ const Link = forwardRef(function Link2({ as, className, variant, underline, ...r
488
506
  });
489
507
  return /* @__PURE__ */ jsx(Box, { ref, as: Component, className: classnames(className, linkClassName), ...restProps });
490
508
  });
509
+ const Radio = forwardRef(function Checkbox3({ name, label, className, ...restProps }, ref) {
510
+ const containerClassName = useComponentStyles("radio", { base: true }, false);
511
+ const iconClassName = useComponentStyles("radio", { icon: true }, false);
512
+ const labelClassName = useComponentStyles("checkbox", { label: true }, false);
513
+ const input2 = /* @__PURE__ */ jsxs("div", { className: classnames(container$1, containerClassName, className), children: [
514
+ /* @__PURE__ */ jsx("input", { ref, type: "radio", name, className: input$2, ...restProps }),
515
+ /* @__PURE__ */ jsx("div", { className: classnames(icon$1, iconClassName) })
516
+ ] });
517
+ if (!label) {
518
+ return input2;
519
+ }
520
+ return /* @__PURE__ */ jsxs("label", { className: labelClassName, children: [
521
+ input2,
522
+ label && /* @__PURE__ */ jsx(Label, { visualOnly: true, children: label })
523
+ ] });
524
+ });
491
525
  const Stack = ({
492
526
  as = "div",
493
527
  display = "flex",
@@ -542,6 +576,7 @@ export {
542
576
  BlocksProvider,
543
577
  Box,
544
578
  Button,
579
+ Checkbox,
545
580
  Dialog,
546
581
  Divider,
547
582
  Heading,
@@ -549,6 +584,8 @@ export {
549
584
  Input,
550
585
  Label,
551
586
  Link,
587
+ Portal,
588
+ Radio,
552
589
  Spinner,
553
590
  Stack,
554
591
  Text,
@@ -1,6 +1,6 @@
1
1
  import { ForwardRefComponent } from '@radix-ui/react-polymorphic';
2
2
  import * as react from 'react';
3
- import { HTMLProps, ReactNode, FC } from 'react';
3
+ import react__default from 'react';
4
4
  import * as _vanilla_extract_sprinkles from '@vanilla-extract/sprinkles';
5
5
 
6
6
  declare const atoms: ((props: {
@@ -545,10 +545,10 @@ type BoxProps = {
545
545
  type PolymorphicBox = ForwardRefComponent<'div', BoxProps>;
546
546
  declare const Box: PolymorphicBox;
547
547
 
548
- type HTMLElementProps<E extends Element> = Omit<HTMLProps<E>, keyof Atoms | 'as' | 'ref'>;
548
+ type HTMLElementProps<E extends Element> = Omit<React.HTMLProps<E>, keyof Atoms | 'as' | 'ref'>;
549
549
 
550
550
  type ButtonProps = {
551
- children: ReactNode;
551
+ children: React.ReactNode;
552
552
  type?: 'button' | 'submit' | 'reset';
553
553
  variant?: ButtonTheme['variants']['variant'];
554
554
  intent?: ButtonTheme['variants']['intent'];
@@ -556,12 +556,12 @@ type ButtonProps = {
556
556
  width?: Atoms['width'];
557
557
  alignSelf?: Atoms['alignSelf'];
558
558
  loading?: boolean;
559
- startSlot?: ReactNode;
560
- endSlot?: ReactNode;
559
+ startSlot?: React.ReactNode;
560
+ endSlot?: React.ReactNode;
561
561
  disabled?: boolean;
562
562
  } & Omit<HTMLElementProps<HTMLButtonElement>, 'size'>;
563
563
  declare const Button: react.ForwardRefExoticComponent<{
564
- children: ReactNode;
564
+ children: React.ReactNode;
565
565
  type?: "button" | "submit" | "reset" | undefined;
566
566
  variant?: "outline" | "solid" | "ghost" | undefined;
567
567
  intent?: "danger" | "neutral" | undefined;
@@ -569,27 +569,38 @@ declare const Button: react.ForwardRefExoticComponent<{
569
569
  width?: Atoms['width'];
570
570
  alignSelf?: Atoms['alignSelf'];
571
571
  loading?: boolean | undefined;
572
- startSlot?: ReactNode;
573
- endSlot?: ReactNode;
572
+ startSlot?: React.ReactNode;
573
+ endSlot?: React.ReactNode;
574
574
  disabled?: boolean | undefined;
575
575
  } & Omit<HTMLElementProps<HTMLButtonElement>, "size"> & react.RefAttributes<HTMLButtonElement>>;
576
576
 
577
+ type CheckboxProps = {
578
+ name: string;
579
+ label?: react__default.ReactNode;
580
+ required?: boolean;
581
+ } & HTMLElementProps<HTMLInputElement>;
582
+ declare const Checkbox: react__default.ForwardRefExoticComponent<{
583
+ name: string;
584
+ label?: react__default.ReactNode;
585
+ required?: boolean | undefined;
586
+ } & HTMLElementProps<HTMLInputElement> & react__default.RefAttributes<HTMLInputElement>>;
587
+
577
588
  type DialogProps = {
578
- children?: ReactNode;
589
+ children?: React.ReactNode;
579
590
  open: boolean;
580
591
  onRequestClose: () => void;
581
592
  className?: string;
582
593
  size?: DialogTheme['variants']['size'];
583
594
  'aria-label'?: string;
584
595
  };
585
- declare const Dialog: FC<DialogProps>;
596
+ declare const Dialog: React.FC<DialogProps>;
586
597
 
587
598
  type DividerProps = {
588
599
  className?: string;
589
600
  color?: Atoms['backgroundColor'];
590
601
  style?: React.CSSProperties;
591
602
  };
592
- declare const Divider: FC<DividerProps>;
603
+ declare const Divider: React.FC<DividerProps>;
593
604
 
594
605
  type HeadingProps = {
595
606
  align?: Atoms['textAlign'];
@@ -634,16 +645,16 @@ type InputProps = {
634
645
  className?: string;
635
646
  name: string;
636
647
  type?: OptionalLiteral<'email' | 'number' | 'password' | 'tel' | 'text' | 'url'>;
637
- startSlot?: ReactNode;
638
- endSlot?: ReactNode;
648
+ startSlot?: React.ReactNode;
649
+ endSlot?: React.ReactNode;
639
650
  label: string;
640
651
  } & Omit<HTMLElementProps<HTMLInputElement>, 'type'>;
641
652
  declare const Input: react.ForwardRefExoticComponent<{
642
653
  className?: string | undefined;
643
654
  name: string;
644
655
  type?: OptionalLiteral<"number" | "text" | "tel" | "url" | "email" | "password"> | undefined;
645
- startSlot?: ReactNode;
646
- endSlot?: ReactNode;
656
+ startSlot?: React.ReactNode;
657
+ endSlot?: React.ReactNode;
647
658
  label: string;
648
659
  } & Omit<HTMLElementProps<HTMLInputElement>, "type"> & react.RefAttributes<HTMLInputElement>>;
649
660
 
@@ -658,20 +669,37 @@ type LabelProps = {
658
669
  declare const Label: React.FC<LabelProps>;
659
670
 
660
671
  type LinkProps = {
661
- children?: ReactNode;
672
+ children?: React.ReactNode;
662
673
  underline?: LinkTheme['variants']['underline'];
663
674
  variant?: LinkTheme['variants']['variant'];
664
675
  } & Atoms & HTMLElementProps<HTMLAnchorElement>;
665
676
  type PolymorphicLink = ForwardRefComponent<'a', LinkProps>;
666
677
  declare const Link: PolymorphicLink;
667
678
 
679
+ type PortalProps = {
680
+ children: React.ReactNode;
681
+ container?: HTMLElement;
682
+ };
683
+ declare const Portal: React.FC<PortalProps>;
684
+
685
+ type RadioProps = {
686
+ name: string;
687
+ value: string;
688
+ label?: React.ReactNode;
689
+ } & HTMLElementProps<HTMLInputElement>;
690
+ declare const Radio: react.ForwardRefExoticComponent<{
691
+ name: string;
692
+ value: string;
693
+ label?: React.ReactNode;
694
+ } & HTMLElementProps<HTMLInputElement> & react.RefAttributes<HTMLInputElement>>;
695
+
668
696
  type SpinnerProps = {
669
697
  className?: string;
670
698
  color?: SpinnerTheme['variants']['color'];
671
699
  size?: SpinnerTheme['variants']['size'];
672
700
  style?: React.CSSProperties;
673
701
  } & MarginAtoms;
674
- declare const Spinner: FC<SpinnerProps>;
702
+ declare const Spinner: React.FC<SpinnerProps>;
675
703
 
676
704
  type StackProps = {
677
705
  alignX?: keyof AlignItemsMap;
@@ -719,4 +747,4 @@ declare const classnames: (...args: Args[]) => string | undefined;
719
747
 
720
748
  declare const momotaro: Theme;
721
749
 
722
- export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, makeComponentTheme, makeTheme, momotaro, useComponentStyleDefaultProps, useComponentStyles, vars };
750
+ export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Portal, PortalProps, Radio, RadioProps, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, makeComponentTheme, makeTheme, momotaro, useComponentStyleDefaultProps, useComponentStyles, vars };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ const fileScope = require("@vanilla-extract/css/fileScope");
3
+ const css = require("@vanilla-extract/css");
4
+ const styles_lib_css_layers_layers_css_cjs = require("../../lib/css/layers/layers.css.cjs");
5
+ fileScope.setFileScope("src/components/Checkbox/checkbox.css.ts?used", "blocks");
6
+ const container = css.style({
7
+ "@layer": {
8
+ [styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
9
+ position: "relative",
10
+ cursor: "pointer",
11
+ overflow: "hidden"
12
+ }
13
+ }
14
+ }, "container");
15
+ const input = css.style({
16
+ position: "absolute",
17
+ inset: 0,
18
+ opacity: 0,
19
+ "@layer": {
20
+ [styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
21
+ all: "unset"
22
+ }
23
+ }
24
+ }, "input");
25
+ const icon = css.style({
26
+ pointerEvents: "none"
27
+ }, "icon");
28
+ fileScope.endFileScope();
29
+ exports.container = container;
30
+ exports.icon = icon;
31
+ exports.input = input;
@@ -0,0 +1,32 @@
1
+ import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
+ import { style } from "@vanilla-extract/css";
3
+ import { blocksLayer } from "../../lib/css/layers/layers.css.mjs";
4
+ setFileScope("src/components/Checkbox/checkbox.css.ts?used", "blocks");
5
+ const container = style({
6
+ "@layer": {
7
+ [blocksLayer]: {
8
+ position: "relative",
9
+ cursor: "pointer",
10
+ overflow: "hidden"
11
+ }
12
+ }
13
+ }, "container");
14
+ const input = style({
15
+ position: "absolute",
16
+ inset: 0,
17
+ opacity: 0,
18
+ "@layer": {
19
+ [blocksLayer]: {
20
+ all: "unset"
21
+ }
22
+ }
23
+ }, "input");
24
+ const icon = style({
25
+ pointerEvents: "none"
26
+ }, "icon");
27
+ endFileScope();
28
+ export {
29
+ container,
30
+ icon,
31
+ input
32
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ const fileScope = require("@vanilla-extract/css/fileScope");
3
+ const css = require("@vanilla-extract/css");
4
+ const styles_lib_css_layers_layers_css_cjs = require("../../lib/css/layers/layers.css.cjs");
5
+ fileScope.setFileScope("src/components/Radio/radio.css.ts?used", "blocks");
6
+ const container = css.style({
7
+ "@layer": {
8
+ [styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
9
+ position: "relative",
10
+ cursor: "pointer",
11
+ overflow: "hidden"
12
+ }
13
+ }
14
+ }, "container");
15
+ const input = css.style({
16
+ position: "absolute",
17
+ inset: 0,
18
+ opacity: 0,
19
+ "@layer": {
20
+ [styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
21
+ all: "unset"
22
+ }
23
+ }
24
+ }, "input");
25
+ const icon = css.style({
26
+ pointerEvents: "none"
27
+ }, "icon");
28
+ fileScope.endFileScope();
29
+ exports.container = container;
30
+ exports.icon = icon;
31
+ exports.input = input;
@@ -0,0 +1,32 @@
1
+ import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
+ import { style } from "@vanilla-extract/css";
3
+ import { blocksLayer } from "../../lib/css/layers/layers.css.mjs";
4
+ setFileScope("src/components/Radio/radio.css.ts?used", "blocks");
5
+ const container = style({
6
+ "@layer": {
7
+ [blocksLayer]: {
8
+ position: "relative",
9
+ cursor: "pointer",
10
+ overflow: "hidden"
11
+ }
12
+ }
13
+ }, "container");
14
+ const input = style({
15
+ position: "absolute",
16
+ inset: 0,
17
+ opacity: 0,
18
+ "@layer": {
19
+ [blocksLayer]: {
20
+ all: "unset"
21
+ }
22
+ }
23
+ }, "input");
24
+ const icon = style({
25
+ pointerEvents: "none"
26
+ }, "icon");
27
+ endFileScope();
28
+ export {
29
+ container,
30
+ icon,
31
+ input
32
+ };
@@ -2,6 +2,7 @@
2
2
  const tokens = {
3
3
  typography: {
4
4
  fontFamily: {
5
+ body: "Roboto, sans-serif",
5
6
  primary: "Roboto, sans-serif",
6
7
  secondary: "Roboto, sans-serif"
7
8
  },
@@ -1,6 +1,7 @@
1
1
  const tokens = {
2
2
  typography: {
3
3
  fontFamily: {
4
+ body: "Roboto, sans-serif",
4
5
  primary: "Roboto, sans-serif",
5
6
  secondary: "Roboto, sans-serif"
6
7
  },
@@ -11,11 +11,12 @@ const focusable = css.style({
11
11
  transitionDuration: styles_lib_theme_vars_css_cjs.vars.transition.fast,
12
12
  transitionProperty: "box-shadow"
13
13
  },
14
- ":disabled": {
15
- opacity: 0.5,
16
- cursor: "auto"
17
- },
18
14
  selectors: {
15
+ "&:disabled, &[disabled]": {
16
+ opacity: 0.5,
17
+ cursor: "auto",
18
+ pointerEvents: "none"
19
+ },
19
20
  "&:has(input:focus-visible)": {
20
21
  outline: "2px solid transparent",
21
22
  outlineOffset: "2px",
@@ -10,11 +10,12 @@ const focusable = style({
10
10
  transitionDuration: vars.transition.fast,
11
11
  transitionProperty: "box-shadow"
12
12
  },
13
- ":disabled": {
14
- opacity: 0.5,
15
- cursor: "auto"
16
- },
17
13
  selectors: {
14
+ "&:disabled, &[disabled]": {
15
+ opacity: 0.5,
16
+ cursor: "auto",
17
+ pointerEvents: "none"
18
+ },
18
19
  "&:has(input:focus-visible)": {
19
20
  outline: "2px solid transparent",
20
21
  outlineOffset: "2px",
@@ -55,6 +55,7 @@ const tokens = {
55
55
  },
56
56
  typography: {
57
57
  fontFamily: {
58
+ body: '"Rubik", sans-serif',
58
59
  primary: '"Rubik", sans-serif',
59
60
  secondary: '"Rubik", sans-serif'
60
61
  },
@@ -54,6 +54,7 @@ const tokens = {
54
54
  },
55
55
  typography: {
56
56
  fontFamily: {
57
+ body: '"Rubik", sans-serif',
57
58
  primary: '"Rubik", sans-serif',
58
59
  secondary: '"Rubik", sans-serif'
59
60
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockle/blocks",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "Blocks design system",
5
5
  "repository": "git@github.com:Blockle/blocks.git",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  "build-storybook": "storybook build",
41
41
  "coverage": "vitest run --coverage",
42
42
  "fix": "crackle fix",
43
- "lint": "eslint . --resolve-plugins-relative-to /Users/niek/Projects/blockle/blocks/",
43
+ "lint": "eslint .",
44
44
  "storybook": "storybook dev -p 6006 --no-open",
45
45
  "test": "vitest",
46
46
  "ts": "tsc --noemit --project ./tsconfig.json",
@@ -71,19 +71,19 @@
71
71
  "@storybook/react": "^7.3.1",
72
72
  "@storybook/react-vite": "^7.3.1",
73
73
  "@storybook/testing-library": "^0.2.0",
74
- "@testing-library/jest-dom": "^6.1.3",
74
+ "@testing-library/jest-dom": "^6.1.4",
75
75
  "@testing-library/react": "^14.0.0",
76
- "@types/react": "^18.2.25",
77
- "@types/react-dom": "^18.2.11",
78
- "@typescript-eslint/eslint-plugin": "^6.7.4",
79
- "@typescript-eslint/parser": "^6.7.4",
76
+ "@types/react": "^18.2.28",
77
+ "@types/react-dom": "^18.2.13",
78
+ "@typescript-eslint/eslint-plugin": "^6.8.0",
79
+ "@typescript-eslint/parser": "^6.8.0",
80
80
  "@vanilla-extract/vite-plugin": "^3.8.2",
81
81
  "@vitest/coverage-v8": "^0.34.6",
82
82
  "cross-env": "^7.0.3",
83
83
  "eslint": "^8.51.0",
84
84
  "eslint-config-prettier": "^9.0.0",
85
85
  "eslint-plugin-jest": "^27.4.2",
86
- "eslint-plugin-prettier": "^5.0.0",
86
+ "eslint-plugin-prettier": "^5.0.1",
87
87
  "eslint-plugin-react": "^7.33.2",
88
88
  "eslint-plugin-react-hooks": "^4.6.0",
89
89
  "eslint-plugin-storybook": "^0.6.15",