@blockle/blocks 0.7.1 → 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
@@ -213,38 +213,6 @@ const Checkbox = react.forwardRef(function Checkbox2({ name, label, required, cl
213
213
  label && /* @__PURE__ */ jsxRuntime.jsx(Label, { visualOnly: true, required, children: label })
214
214
  ] });
215
215
  });
216
- const useLayer = () => {
217
- const layerRef = react.useRef();
218
- react.useEffect(
219
- () => () => {
220
- if (layerRef.current) {
221
- layerRef.current.remove();
222
- }
223
- },
224
- []
225
- );
226
- return () => {
227
- if (!layerRef.current) {
228
- const div = document.createElement("div");
229
- div.dataset.layer = "blocks";
230
- layerRef.current = div;
231
- document.body.append(layerRef.current);
232
- }
233
- return layerRef.current;
234
- };
235
- };
236
- const useVisibilityState = (open) => {
237
- const [visible, setVisible] = react.useState(open);
238
- const hide = react.useCallback(() => {
239
- setVisible(false);
240
- }, []);
241
- react.useEffect(() => {
242
- if (open) {
243
- setVisible(true);
244
- }
245
- }, [open]);
246
- return [visible, hide];
247
- };
248
216
  const focusableSelectors = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
249
217
  const getFirstFocusableElement = (container) => {
250
218
  const focusable = container.querySelector(focusableSelectors);
@@ -272,7 +240,38 @@ const useFocusLock = ({ ref, active }) => {
272
240
  };
273
241
  }, [active]);
274
242
  };
275
- 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
+ };
276
275
  const useRestoreFocus = (active) => {
277
276
  const [target, setTarget] = react.useState(null);
278
277
  useIsomorphicLayoutEffect(() => {
@@ -286,6 +285,25 @@ const useRestoreFocus = (active) => {
286
285
  }
287
286
  }, [active]);
288
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
+ };
289
307
  const DialogContext = react.createContext(void 0);
290
308
  const useNestedDialog = (open) => {
291
309
  const parentDialog = react.useContext(DialogContext);
@@ -300,24 +318,6 @@ const useNestedDialog = (open) => {
300
318
  }, [parentDialog, open]);
301
319
  return !!parentDialog;
302
320
  };
303
- const usePreventBodyScroll = (enabled = true) => {
304
- useIsomorphicLayoutEffect(() => {
305
- const prevValue = document.body.style.getPropertyValue("overflow");
306
- if (enabled) {
307
- document.body.style.overflow = "hidden";
308
- }
309
- return () => {
310
- document.body.style.overflow = prevValue;
311
- };
312
- }, [enabled]);
313
- };
314
- const Portal = ({ children, container }) => {
315
- const context = useTheme();
316
- return reactDom.createPortal(
317
- /* @__PURE__ */ jsxRuntime.jsx(BlocksProvider, { theme: context, children }),
318
- container || document.body
319
- );
320
- };
321
321
  const Dialog = ({
322
322
  children,
323
323
  open,
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ 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
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
- import { createContext, forwardRef, useContext, useRef, useEffect, useState, useCallback, useLayoutEffect, useId } from "react";
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
11
  import { container, input, icon } from "./styles/components/Checkbox/checkbox.css.mjs";
12
12
  import { backdropLeaveAnimation, backdropLeave, backdrop, dialogLeave, dialog } from "./styles/components/Dialog/dialog.css.mjs";
@@ -213,38 +213,6 @@ const Checkbox = forwardRef(function Checkbox2({ name, label, required, classNam
213
213
  label && /* @__PURE__ */ jsx(Label, { visualOnly: true, required, children: label })
214
214
  ] });
215
215
  });
216
- const useLayer = () => {
217
- const layerRef = useRef();
218
- useEffect(
219
- () => () => {
220
- if (layerRef.current) {
221
- layerRef.current.remove();
222
- }
223
- },
224
- []
225
- );
226
- return () => {
227
- if (!layerRef.current) {
228
- const div = document.createElement("div");
229
- div.dataset.layer = "blocks";
230
- layerRef.current = div;
231
- document.body.append(layerRef.current);
232
- }
233
- return layerRef.current;
234
- };
235
- };
236
- const useVisibilityState = (open) => {
237
- const [visible, setVisible] = useState(open);
238
- const hide = useCallback(() => {
239
- setVisible(false);
240
- }, []);
241
- useEffect(() => {
242
- if (open) {
243
- setVisible(true);
244
- }
245
- }, [open]);
246
- return [visible, hide];
247
- };
248
216
  const focusableSelectors = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
249
217
  const getFirstFocusableElement = (container2) => {
250
218
  const focusable = container2.querySelector(focusableSelectors);
@@ -272,7 +240,38 @@ const useFocusLock = ({ ref, active }) => {
272
240
  };
273
241
  }, [active]);
274
242
  };
275
- 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
+ };
276
275
  const useRestoreFocus = (active) => {
277
276
  const [target, setTarget] = useState(null);
278
277
  useIsomorphicLayoutEffect(() => {
@@ -286,6 +285,25 @@ const useRestoreFocus = (active) => {
286
285
  }
287
286
  }, [active]);
288
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
+ };
289
307
  const DialogContext = createContext(void 0);
290
308
  const useNestedDialog = (open) => {
291
309
  const parentDialog = useContext(DialogContext);
@@ -300,24 +318,6 @@ const useNestedDialog = (open) => {
300
318
  }, [parentDialog, open]);
301
319
  return !!parentDialog;
302
320
  };
303
- const usePreventBodyScroll = (enabled = true) => {
304
- useIsomorphicLayoutEffect(() => {
305
- const prevValue = document.body.style.getPropertyValue("overflow");
306
- if (enabled) {
307
- document.body.style.overflow = "hidden";
308
- }
309
- return () => {
310
- document.body.style.overflow = prevValue;
311
- };
312
- }, [enabled]);
313
- };
314
- const Portal = ({ children, container: container2 }) => {
315
- const context = useTheme();
316
- return createPortal(
317
- /* @__PURE__ */ jsx(BlocksProvider, { theme: context, children }),
318
- container2 || document.body
319
- );
320
- };
321
321
  const Dialog = ({
322
322
  children,
323
323
  open,
@@ -1,6 +1,6 @@
1
1
  import { ForwardRefComponent } from '@radix-ui/react-polymorphic';
2
2
  import * as react from 'react';
3
- import react__default, { 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,8 +569,8 @@ 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
 
@@ -586,21 +586,21 @@ declare const Checkbox: react__default.ForwardRefExoticComponent<{
586
586
  } & HTMLElementProps<HTMLInputElement> & react__default.RefAttributes<HTMLInputElement>>;
587
587
 
588
588
  type DialogProps = {
589
- children?: ReactNode;
589
+ children?: React.ReactNode;
590
590
  open: boolean;
591
591
  onRequestClose: () => void;
592
592
  className?: string;
593
593
  size?: DialogTheme['variants']['size'];
594
594
  'aria-label'?: string;
595
595
  };
596
- declare const Dialog: FC<DialogProps>;
596
+ declare const Dialog: React.FC<DialogProps>;
597
597
 
598
598
  type DividerProps = {
599
599
  className?: string;
600
600
  color?: Atoms['backgroundColor'];
601
601
  style?: React.CSSProperties;
602
602
  };
603
- declare const Divider: FC<DividerProps>;
603
+ declare const Divider: React.FC<DividerProps>;
604
604
 
605
605
  type HeadingProps = {
606
606
  align?: Atoms['textAlign'];
@@ -645,16 +645,16 @@ type InputProps = {
645
645
  className?: string;
646
646
  name: string;
647
647
  type?: OptionalLiteral<'email' | 'number' | 'password' | 'tel' | 'text' | 'url'>;
648
- startSlot?: ReactNode;
649
- endSlot?: ReactNode;
648
+ startSlot?: React.ReactNode;
649
+ endSlot?: React.ReactNode;
650
650
  label: string;
651
651
  } & Omit<HTMLElementProps<HTMLInputElement>, 'type'>;
652
652
  declare const Input: react.ForwardRefExoticComponent<{
653
653
  className?: string | undefined;
654
654
  name: string;
655
655
  type?: OptionalLiteral<"number" | "text" | "tel" | "url" | "email" | "password"> | undefined;
656
- startSlot?: ReactNode;
657
- endSlot?: ReactNode;
656
+ startSlot?: React.ReactNode;
657
+ endSlot?: React.ReactNode;
658
658
  label: string;
659
659
  } & Omit<HTMLElementProps<HTMLInputElement>, "type"> & react.RefAttributes<HTMLInputElement>>;
660
660
 
@@ -669,7 +669,7 @@ type LabelProps = {
669
669
  declare const Label: React.FC<LabelProps>;
670
670
 
671
671
  type LinkProps = {
672
- children?: ReactNode;
672
+ children?: React.ReactNode;
673
673
  underline?: LinkTheme['variants']['underline'];
674
674
  variant?: LinkTheme['variants']['variant'];
675
675
  } & Atoms & HTMLElementProps<HTMLAnchorElement>;
@@ -677,10 +677,10 @@ type PolymorphicLink = ForwardRefComponent<'a', LinkProps>;
677
677
  declare const Link: PolymorphicLink;
678
678
 
679
679
  type PortalProps = {
680
- children: ReactNode;
680
+ children: React.ReactNode;
681
681
  container?: HTMLElement;
682
682
  };
683
- declare const Portal: FC<PortalProps>;
683
+ declare const Portal: React.FC<PortalProps>;
684
684
 
685
685
  type RadioProps = {
686
686
  name: string;
@@ -699,7 +699,7 @@ type SpinnerProps = {
699
699
  size?: SpinnerTheme['variants']['size'];
700
700
  style?: React.CSSProperties;
701
701
  } & MarginAtoms;
702
- declare const Spinner: FC<SpinnerProps>;
702
+ declare const Spinner: React.FC<SpinnerProps>;
703
703
 
704
704
  type StackProps = {
705
705
  alignX?: keyof AlignItemsMap;
@@ -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.1",
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",