@blockle/blocks 0.4.0 → 0.5.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/README.md CHANGED
@@ -46,9 +46,18 @@ import { makeTokens, makeComponentTheme, makeTheme } from "@blockle/blocks";
46
46
 
47
47
  const tokens = makeTokens({ ... });
48
48
 
49
- const button = makeComponentTheme({
50
- type: 'button',
51
- ...
49
+ const button = makeComponentTheme('button', {
50
+ base: style({
51
+ ...
52
+ }),
53
+ variants: {
54
+ primary: style({
55
+ ...
56
+ }),
57
+ secondary: style({
58
+ ...
59
+ })
60
+ },
52
61
  });
53
62
 
54
63
  const theme = makeTheme({
@@ -269,7 +269,7 @@ type CreateComponentTheme<T extends Theme$1> = {
269
269
  compoundVariants?: Array<{
270
270
  style: string;
271
271
  variants: {
272
- [VariantGroup in keyof T['variants']]?: T['variants'][VariantGroup];
272
+ [VariantGroup in keyof T['variants']]?: T['variants'][VariantGroup] extends string ? T['variants'][VariantGroup] : boolean;
273
273
  };
274
274
  }>;
275
275
  defaultVariants?: {
@@ -282,14 +282,17 @@ type CreateThemeProps<T extends Theme$1> = {
282
282
  type: T['type'];
283
283
  base?: boolean;
284
284
  };
285
- declare const makeComponentTheme: <T extends ComponentThemes>(options: T) => T;
285
+ declare const makeComponentTheme: <T extends "button" | "link" | "spinner" | "divider" | "dialog", const O extends ComponentThemesMap[T]>(name: T, options: O) => O;
286
286
 
287
287
  type ButtonTheme = {
288
288
  type: 'button';
289
+ base: boolean;
289
290
  variants: {
290
291
  variant: 'solid' | 'outline' | 'ghost' | 'link';
291
292
  intent: 'neutral' | 'danger';
292
293
  size: 'small' | 'medium' | 'large';
294
+ loading: boolean;
295
+ disabled: boolean;
293
296
  };
294
297
  };
295
298
  type ButtonThemeProps = CreateThemeProps<ButtonTheme>;
@@ -570,7 +573,7 @@ type TextProps = {
570
573
  declare const Text: React.FC<TextProps>;
571
574
 
572
575
  type LinkProps = {
573
- variant: LinkTheme['variants']['variant'];
576
+ variant?: LinkTheme['variants']['variant'];
574
577
  underline?: LinkTheme['variants']['underline'];
575
578
  children?: ReactNode;
576
579
  className?: string;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const makeComponentTheme = (options) => options;
2
+ const makeComponentTheme = (name, options) => options;
3
3
  exports.makeComponentTheme = makeComponentTheme;
@@ -1,4 +1,4 @@
1
- const makeComponentTheme = (options) => options;
1
+ const makeComponentTheme = (name, options) => options;
2
2
  export {
3
3
  makeComponentTheme
4
4
  };
@@ -7,8 +7,7 @@ const styles_themes_momotaro_components_helpers_css_cjs = require("./helpers.css
7
7
  const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
8
8
  fileScope.setFileScope("src/themes/momotaro/components/button.css.ts?used", "blocks");
9
9
  const primaryColor = css.createVar("primaryColor");
10
- const button = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme({
11
- type: "button",
10
+ const button = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme("button", {
12
11
  base: css.style([styles_lib_css_atoms_sprinkles_css_cjs.atoms({
13
12
  display: "inline-flex",
14
13
  placeItems: "center",
@@ -17,8 +16,6 @@ const button = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme({
17
16
  fontWeight: "medium"
18
17
  }), styles_themes_momotaro_components_helpers_css_cjs.focusable], "button_base"),
19
18
  variants: {
20
- // ...
21
- // styleVariants could be used to but lacks correct typings atm
22
19
  variant: {
23
20
  solid: css.style({
24
21
  color: styles_lib_css_theme_vars_css_cjs.vars.color.white,
@@ -6,8 +6,7 @@ import { focusable } from "./helpers.css.mjs";
6
6
  import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
7
7
  setFileScope("src/themes/momotaro/components/button.css.ts?used", "blocks");
8
8
  const primaryColor = createVar("primaryColor");
9
- const button = makeComponentTheme({
10
- type: "button",
9
+ const button = makeComponentTheme("button", {
11
10
  base: style([atoms({
12
11
  display: "inline-flex",
13
12
  placeItems: "center",
@@ -16,8 +15,6 @@ const button = makeComponentTheme({
16
15
  fontWeight: "medium"
17
16
  }), focusable], "button_base"),
18
17
  variants: {
19
- // ...
20
- // styleVariants could be used to but lacks correct typings atm
21
18
  variant: {
22
19
  solid: style({
23
20
  color: vars.color.white,
@@ -4,8 +4,7 @@ const css = require("@vanilla-extract/css");
4
4
  const styles_lib_css_theme_makeComponentTheme_cjs = require("../../../lib/css/theme/makeComponentTheme.cjs");
5
5
  const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
6
6
  fileScope.setFileScope("src/themes/momotaro/components/dialog.css.ts?used", "blocks");
7
- const dialog = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme({
8
- type: "dialog",
7
+ const dialog = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme("dialog", {
9
8
  base: css.style([styles_lib_css_atoms_sprinkles_css_cjs.atoms({
10
9
  display: "flex",
11
10
  flexDirection: "column",
@@ -3,8 +3,7 @@ import { style } from "@vanilla-extract/css";
3
3
  import { makeComponentTheme } from "../../../lib/css/theme/makeComponentTheme.mjs";
4
4
  import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
5
5
  setFileScope("src/themes/momotaro/components/dialog.css.ts?used", "blocks");
6
- const dialog = makeComponentTheme({
7
- type: "dialog",
6
+ const dialog = makeComponentTheme("dialog", {
8
7
  base: style([atoms({
9
8
  display: "flex",
10
9
  flexDirection: "column",
@@ -2,8 +2,7 @@
2
2
  const fileScope = require("@vanilla-extract/css/fileScope");
3
3
  const styles_lib_css_theme_makeComponentTheme_cjs = require("../../../lib/css/theme/makeComponentTheme.cjs");
4
4
  fileScope.setFileScope("src/themes/momotaro/components/divider.css.ts?used", "blocks");
5
- const divider = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme({
6
- type: "divider",
5
+ const divider = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme("divider", {
7
6
  defaultVariants: {
8
7
  color: "textLight"
9
8
  }
@@ -1,8 +1,7 @@
1
1
  import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
2
  import { makeComponentTheme } from "../../../lib/css/theme/makeComponentTheme.mjs";
3
3
  setFileScope("src/themes/momotaro/components/divider.css.ts?used", "blocks");
4
- const divider = makeComponentTheme({
5
- type: "divider",
4
+ const divider = makeComponentTheme("divider", {
6
5
  defaultVariants: {
7
6
  color: "textLight"
8
7
  }
@@ -4,8 +4,7 @@ const css = require("@vanilla-extract/css");
4
4
  const styles_lib_css_theme_makeComponentTheme_cjs = require("../../../lib/css/theme/makeComponentTheme.cjs");
5
5
  const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
6
6
  fileScope.setFileScope("src/themes/momotaro/components/link.css.ts?used", "blocks");
7
- const link = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme({
8
- type: "link",
7
+ const link = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme("link", {
9
8
  base: css.style({
10
9
  outline: "none",
11
10
  border: "none",
@@ -3,8 +3,7 @@ import { style } from "@vanilla-extract/css";
3
3
  import { makeComponentTheme } from "../../../lib/css/theme/makeComponentTheme.mjs";
4
4
  import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
5
5
  setFileScope("src/themes/momotaro/components/link.css.ts?used", "blocks");
6
- const link = makeComponentTheme({
7
- type: "link",
6
+ const link = makeComponentTheme("link", {
8
7
  base: style({
9
8
  outline: "none",
10
9
  border: "none",
@@ -11,8 +11,7 @@ const spinAnimation = css.keyframes({
11
11
  transform: "rotate(360deg)"
12
12
  }
13
13
  }, "spinAnimation");
14
- const spinner = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme({
15
- type: "spinner",
14
+ const spinner = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme("spinner", {
16
15
  base: css.style({
17
16
  aspectRatio: "1 / 1",
18
17
  overflow: "hidden",
@@ -10,8 +10,7 @@ const spinAnimation = keyframes({
10
10
  transform: "rotate(360deg)"
11
11
  }
12
12
  }, "spinAnimation");
13
- const spinner = makeComponentTheme({
14
- type: "spinner",
13
+ const spinner = makeComponentTheme("spinner", {
15
14
  base: style({
16
15
  aspectRatio: "1 / 1",
17
16
  overflow: "hidden",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockle/blocks",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Blocks design system",
5
5
  "repository": "git@github.com:Blockle/blocks.git",
6
6
  "license": "MIT",