@nicolassancho/storybook-core 4.9.0 → 4.11.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 +6 -6
- package/dist/components/Atoms/Text/Text.d.ts +8 -1
- package/dist/components/Atoms/Text/Text.js +14 -2
- package/dist/components/Atoms/TextLink/TextLink.d.ts +26 -0
- package/dist/components/Atoms/TextLink/TextLink.js +7 -0
- package/dist/components/Layouts/Container/Container.d.ts +9 -2
- package/dist/components/Layouts/Container/Container.js +15 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,12 +33,12 @@ documented in Storybook. It is published to npm as `@nicolassancho/storybook-cor
|
|
|
33
33
|
|
|
34
34
|
## Components
|
|
35
35
|
|
|
36
|
-
| Layer | Components
|
|
37
|
-
| --------- |
|
|
38
|
-
| Atoms | Badge, Button, ButtonLink, Card, Chip, ChipLink, Icon, Image, Label, RadioButton, SearchInput (deprecated), Spinner, TableSkeleton, Text |
|
|
39
|
-
| Molecules | Alert, Breadcrumbs, CartIcon, EmptyState, Input, Pagination, Popover, ProductCard, ProductDetails, RadioGroup, Select, SidebarNav, Table
|
|
40
|
-
| Organisms | Footer, Header, ProductGrid
|
|
41
|
-
| Layouts | Container, Grid
|
|
36
|
+
| Layer | Components |
|
|
37
|
+
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
38
|
+
| Atoms | Badge, Button, ButtonLink, Card, Chip, ChipLink, Icon, Image, Label, RadioButton, SearchInput (deprecated), Spinner, TableSkeleton, Text, TextLink |
|
|
39
|
+
| Molecules | Alert, Breadcrumbs, CartIcon, EmptyState, Input, Pagination, Popover, ProductCard, ProductDetails, RadioGroup, Select, SidebarNav, Table |
|
|
40
|
+
| Organisms | Footer, Header, ProductGrid |
|
|
41
|
+
| Layouts | Container, Grid |
|
|
42
42
|
|
|
43
43
|
The palette and the contrast of each text color are documented under **Foundations / Colors** in
|
|
44
44
|
Storybook.
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export interface TextProps {
|
|
2
|
+
export interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
|
+
/**
|
|
4
|
+
* The element to render, such as `p`, `span` or `h1` to `h6`. Pass an HTML element name: only
|
|
5
|
+
* global HTML attributes (`id`, `aria-*`, `data-*` and so on) are typed, and they are passed to
|
|
6
|
+
* the element.
|
|
7
|
+
*/
|
|
3
8
|
as?: React.ElementType;
|
|
9
|
+
/** A ref to the rendered element. */
|
|
10
|
+
ref?: React.Ref<HTMLElement>;
|
|
4
11
|
/**
|
|
5
12
|
* Text color. Every option reaches the 4.5:1 text contrast on white.
|
|
6
13
|
*/
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
13
|
import { tv } from "tailwind-variants";
|
|
3
14
|
const textStyles = tv({
|
|
@@ -39,6 +50,7 @@ const textStyles = tv({
|
|
|
39
50
|
underline: false,
|
|
40
51
|
},
|
|
41
52
|
});
|
|
42
|
-
export const Text = (
|
|
43
|
-
|
|
53
|
+
export const Text = (_a) => {
|
|
54
|
+
var { as: Component = "div", font = "body", color = "dark", size = "medium", weight = "normal", underline = false, children, className = "" } = _a, props = __rest(_a, ["as", "font", "color", "size", "weight", "underline", "children", "className"]);
|
|
55
|
+
return (_jsx(Component, Object.assign({}, props, { className: textStyles({ font, color, size, weight, underline, className }), children: children })));
|
|
44
56
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface TextLinkProps {
|
|
3
|
+
/** Where the link goes, for example `/products/42`. It needs no JavaScript. */
|
|
4
|
+
href: string;
|
|
5
|
+
/** Link contents */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Component used to render the link. Receives `href`, `className` and `children`, so a
|
|
9
|
+
* framework link (e.g. `next/link`) can be passed directly. Defaults to a plain `<a>`. Define it
|
|
10
|
+
* outside the render function: an inline definition remounts the link.
|
|
11
|
+
*/
|
|
12
|
+
LinkComponent?: React.ElementType<{
|
|
13
|
+
href: string;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Additional classes for custom styling
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A link in content, such as a sentence or a table cell. It is always underlined, so it reads as a
|
|
24
|
+
* link without hover. For a call to action, use `ButtonLink`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const TextLink: React.FC<TextLinkProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { linkStyles } from "../../styles/linkStyles.js";
|
|
3
|
+
/**
|
|
4
|
+
* A link in content, such as a sentence or a table cell. It is always underlined, so it reads as a
|
|
5
|
+
* link without hover. For a call to action, use `ButtonLink`.
|
|
6
|
+
*/
|
|
7
|
+
export const TextLink = ({ href, children, LinkComponent = "a", className, }) => (_jsx(LinkComponent, { href: href, className: linkStyles({ variant: "inline", className }), children: children }));
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export interface ContainerProps {
|
|
2
|
+
export interface ContainerProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Element to render. Defaults to a `div`; pass `main`, `section` and so on for a landmark. Pass
|
|
6
|
+
* an HTML element name: only global HTML attributes (`id`, `aria-*`, `data-*` and so on) are
|
|
7
|
+
* typed, and they are passed to the element. A `section` is only a landmark when it has an
|
|
8
|
+
* accessible name, so pass `aria-labelledby` (or `aria-label`) with it.
|
|
9
|
+
*/
|
|
5
10
|
as?: React.ElementType;
|
|
11
|
+
/** A ref to the rendered element. */
|
|
12
|
+
ref?: React.Ref<HTMLElement>;
|
|
6
13
|
className?: string;
|
|
7
14
|
}
|
|
8
15
|
/**
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
13
|
import { tv } from "tailwind-variants";
|
|
3
14
|
const containerStyles = tv({
|
|
@@ -8,4 +19,7 @@ const containerStyles = tv({
|
|
|
8
19
|
* use it for their content, so page content wrapped in a `Container` lines up with both. Their
|
|
9
20
|
* background, shadow and borders stay full-width.
|
|
10
21
|
*/
|
|
11
|
-
export const Container = (
|
|
22
|
+
export const Container = (_a) => {
|
|
23
|
+
var { children, as: Component = "div", className } = _a, props = __rest(_a, ["children", "as", "className"]);
|
|
24
|
+
return (_jsx(Component, Object.assign({}, props, { className: containerStyles({ className }), children: children })));
|
|
25
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./components/Atoms/ChipLink/ChipLink.js";
|
|
|
7
7
|
export * from "./components/Atoms/Spinner/Spinner.js";
|
|
8
8
|
export * from "./components/Atoms/TableSkeleton/TableSkeleton.js";
|
|
9
9
|
export * from "./components/Atoms/Text/Text.js";
|
|
10
|
+
export * from "./components/Atoms/TextLink/TextLink.js";
|
|
10
11
|
export * from "./components/Atoms/Icon/Icon.js";
|
|
11
12
|
export * from "./components/Atoms/Image/Image.js";
|
|
12
13
|
export * from "./components/Atoms/Label/Label.js";
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./components/Atoms/ChipLink/ChipLink.js";
|
|
|
8
8
|
export * from "./components/Atoms/Spinner/Spinner.js";
|
|
9
9
|
export * from "./components/Atoms/TableSkeleton/TableSkeleton.js";
|
|
10
10
|
export * from "./components/Atoms/Text/Text.js";
|
|
11
|
+
export * from "./components/Atoms/TextLink/TextLink.js";
|
|
11
12
|
export * from "./components/Atoms/Icon/Icon.js";
|
|
12
13
|
export * from "./components/Atoms/Image/Image.js";
|
|
13
14
|
export * from "./components/Atoms/Label/Label.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nicolassancho/storybook-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.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",
|