@nicolassancho/storybook-core 4.4.0 → 4.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
@@ -75,6 +75,22 @@ const App = () => <Button variant="primary">Click Me</Button>;
75
75
  The full guide (install, links and images, the Next.js App Router) is the **Consumers** page in
76
76
  [Storybook](https://nicolassancho.github.io/Storybook-core/).
77
77
 
78
+ ## Versioning
79
+
80
+ The package follows [Semantic Versioning](https://semver.org/), and every release has a section in
81
+ [CHANGELOG.md](CHANGELOG.md).
82
+
83
+ - **Major:** a change that can break an app that upgrades: a removed or renamed component, prop or
84
+ export, a new required prop, or a narrower peer dependency range.
85
+ - **Minor:** a new component, prop, variant or token, or a change you can see in the look or the
86
+ behavior of an existing component. Check your screens after a minor upgrade.
87
+ - **Patch:** no change an app can see, such as packaging, CI or documentation.
88
+
89
+ A deprecated component or prop is marked `@deprecated` in its JSDoc, which editors show where it is
90
+ used, and listed under **Deprecated** in the changelog with its replacement. It keeps working for
91
+ the rest of that major version and is removed in the next one, whose changelog explains the
92
+ migration under **Migrating**. `SearchInput`, deprecated in 4.3.0, is removed in 5.0.0.
93
+
78
94
  ## Development
79
95
 
80
96
  ```bash
@@ -6,9 +6,9 @@ export declare const buttonStyles: import("tailwind-variants").TVReturnType<{
6
6
  outline: "rounded-sm border border-neutral-400 bg-surface text-neutral-900";
7
7
  };
8
8
  size: {
9
- small: "text-xs px-2 py-1";
10
- medium: "text-sm px-4 py-2";
11
- large: "text-lg px-6 py-3";
9
+ small: "gap-1 text-xs px-2 py-1";
10
+ medium: "gap-2 text-sm px-4 py-2";
11
+ large: "gap-3 text-lg px-6 py-3";
12
12
  };
13
13
  disabled: {
14
14
  true: "opacity-50 cursor-not-allowed";
@@ -25,9 +25,9 @@ export declare const buttonStyles: import("tailwind-variants").TVReturnType<{
25
25
  outline: "rounded-sm border border-neutral-400 bg-surface text-neutral-900";
26
26
  };
27
27
  size: {
28
- small: "text-xs px-2 py-1";
29
- medium: "text-sm px-4 py-2";
30
- large: "text-lg px-6 py-3";
28
+ small: "gap-1 text-xs px-2 py-1";
29
+ medium: "gap-2 text-sm px-4 py-2";
30
+ large: "gap-3 text-lg px-6 py-3";
31
31
  };
32
32
  disabled: {
33
33
  true: "opacity-50 cursor-not-allowed";
@@ -44,9 +44,9 @@ export declare const buttonStyles: import("tailwind-variants").TVReturnType<{
44
44
  outline: "rounded-sm border border-neutral-400 bg-surface text-neutral-900";
45
45
  };
46
46
  size: {
47
- small: "text-xs px-2 py-1";
48
- medium: "text-sm px-4 py-2";
49
- large: "text-lg px-6 py-3";
47
+ small: "gap-1 text-xs px-2 py-1";
48
+ medium: "gap-2 text-sm px-4 py-2";
49
+ large: "gap-3 text-lg px-6 py-3";
50
50
  };
51
51
  disabled: {
52
52
  true: "opacity-50 cursor-not-allowed";
@@ -1,6 +1,7 @@
1
1
  import { tv } from "tailwind-variants";
2
2
  // Shared by Button and ButtonLink, not exported from `src/index.js`. The hover classes are in
3
- // `compoundVariants` because `enabled:` never matches an `<a>`.
3
+ // `compoundVariants` because `enabled:` never matches an `<a>`. The gap between children (an icon
4
+ // and a label) is half the horizontal padding, so it scales with the size.
4
5
  export const buttonStyles = tv({
5
6
  base: "font-bold inline-flex items-center enabled:cursor-pointer focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-surface",
6
7
  variants: {
@@ -11,9 +12,9 @@ export const buttonStyles = tv({
11
12
  outline: "rounded-sm border border-neutral-400 bg-surface text-neutral-900",
12
13
  },
13
14
  size: {
14
- small: "text-xs px-2 py-1",
15
- medium: "text-sm px-4 py-2",
16
- large: "text-lg px-6 py-3",
15
+ small: "gap-1 text-xs px-2 py-1",
16
+ medium: "gap-2 text-sm px-4 py-2",
17
+ large: "gap-3 text-lg px-6 py-3",
17
18
  },
18
19
  disabled: {
19
20
  true: "opacity-50 cursor-not-allowed",
@@ -3,7 +3,12 @@ import { IconsMap } from "./iconsMap.js";
3
3
  export interface IconProps {
4
4
  name: keyof typeof IconsMap;
5
5
  size?: "small" | "medium" | "large";
6
- color?: "primary" | "secondary" | "danger" | "black";
6
+ /**
7
+ * Icon color. `current` (the default) takes the text color of the element around it, so an icon
8
+ * inside a button or a link matches its label in every variant, theme and brand. The other values
9
+ * set a token color.
10
+ */
11
+ color?: "current" | "primary" | "secondary" | "danger" | "black";
7
12
  /**
8
13
  * Accessible name for icons that convey meaning on their own.
9
14
  * Without it the icon is treated as decorative and hidden from screen readers.
@@ -10,6 +10,7 @@ const iconStyles = tv({
10
10
  large: "w-8 h-8",
11
11
  },
12
12
  color: {
13
+ current: "text-current",
13
14
  primary: "text-primary",
14
15
  secondary: "text-secondary",
15
16
  danger: "text-danger",
@@ -18,10 +19,10 @@ const iconStyles = tv({
18
19
  },
19
20
  defaultVariants: {
20
21
  size: "medium",
21
- color: "primary",
22
+ color: "current",
22
23
  },
23
24
  });
24
- export const Icon = ({ name, size, color = "black", ariaLabel }) => {
25
+ export const Icon = ({ name, size, color = "current", ariaLabel }) => {
25
26
  const IconComponent = IconsMap[name];
26
27
  const a11yProps = ariaLabel
27
28
  ? { role: "img", "aria-label": ariaLabel }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nicolassancho/storybook-core",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "Accessible React + Tailwind component library built with tailwind-variants and documented in Storybook.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",