@nicolassancho/storybook-core 4.10.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.
|
@@ -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
|
};
|
|
@@ -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/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",
|