@tale-ui/react 0.0.3 → 0.1.1
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/CHANGELOG.md +3 -2036
- package/README.md +56 -25
- package/container/Container.d.ts +12 -0
- package/container/Container.js +40 -0
- package/container/index.d.ts +2 -0
- package/container/index.js +18 -0
- package/esm/container/Container.d.ts +12 -0
- package/esm/container/Container.js +32 -0
- package/esm/container/index.d.ts +2 -0
- package/esm/container/index.js +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/package.json +125 -111
package/README.md
CHANGED
|
@@ -1,47 +1,78 @@
|
|
|
1
|
-
|
|
1
|
+
# @tale-ui/react
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Tale UI is a library of unstyled React components. You gain complete control over your app's CSS and accessibility features.
|
|
3
|
+
A library of headless, accessible React components. You gain complete control over your app's CSS and accessibility features.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
|
-
Install the package in your project directory with:
|
|
10
|
-
|
|
11
7
|
```bash
|
|
12
|
-
|
|
8
|
+
pnpm add @tale-ui/react @tale-ui/react-styles
|
|
13
9
|
```
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
`@tale-ui/react-styles` provides the default look for every component — built on `@tale-ui/core` design tokens.
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
## Quick Start
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
```tsx
|
|
16
|
+
import '@tale-ui/react-styles';
|
|
17
|
+
import { Button } from '@tale-ui/react/button';
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
export default function App() {
|
|
20
|
+
return <Button className="tale-button tale-button--primary">Click me</Button>;
|
|
21
|
+
}
|
|
22
|
+
```
|
|
22
23
|
|
|
23
|
-
For
|
|
24
|
-
Use the "tale-ui" tag on Stack Overflow to make it easier for the community to find your question.
|
|
24
|
+
For the full setup guide (colours, typography, dark mode): [docs/react-setup.md](../../docs/react-setup.md)
|
|
25
25
|
|
|
26
|
-
##
|
|
26
|
+
## Components
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
### Form Controls
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
There are many other ways to [support Tale UI](https://mui.com/material-ui/getting-started/faq/#mui-is-awesome-how-can-i-support-the-project) beyond contributing to the code base.
|
|
30
|
+
Button · Checkbox · Checkbox Group · Combobox · Input · Number Field · Radio · Radio Group · Select · Slider · Switch · Toggle · Toggle Group
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
### Layout
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
Accordion · Collapsible · Scroll Area · Separator · Tabs
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
### Overlay
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
Alert Dialog · Dialog · Drawer · Popover · Preview Card · Tooltip
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
### Navigation
|
|
41
|
+
|
|
42
|
+
Context Menu · Menu · Menubar · Navigation Menu · Toolbar
|
|
43
|
+
|
|
44
|
+
### Feedback & Display
|
|
45
|
+
|
|
46
|
+
Avatar · Meter · Progress · Toast
|
|
47
|
+
|
|
48
|
+
### Form Structure
|
|
49
|
+
|
|
50
|
+
Autocomplete · Field · Fieldset · Form
|
|
51
|
+
|
|
52
|
+
### Utilities
|
|
42
53
|
|
|
43
|
-
|
|
54
|
+
Container · CSP Provider · Direction Provider · `mergeProps` · `useRender`
|
|
44
55
|
|
|
45
|
-
|
|
56
|
+
All components are imported from `@tale-ui/react/{name}`:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { Dialog } from '@tale-ui/react/dialog';
|
|
60
|
+
import { Select } from '@tale-ui/react/select';
|
|
61
|
+
import { Container } from '@tale-ui/react/container';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Styling
|
|
65
|
+
|
|
66
|
+
Components are **headless** — they render accessible HTML with state exposed via data attributes (`data-disabled`, `data-open`, `data-checked`, etc.) but include no styles of their own.
|
|
67
|
+
|
|
68
|
+
Default styles live in `@tale-ui/react-styles`. See the [styles README](../styles/README.md) for architecture details and CSS class naming conventions.
|
|
69
|
+
|
|
70
|
+
## Documentation
|
|
71
|
+
|
|
72
|
+
- [React setup guide](../../docs/react-setup.md) — full consumer walkthrough
|
|
73
|
+
- [CSS design tokens](../css/docs/design-tokens.md) — all token values
|
|
74
|
+
- [Contributing](../../CONTRIBUTING.md)
|
|
75
|
+
|
|
76
|
+
## License
|
|
46
77
|
|
|
47
|
-
|
|
78
|
+
MIT — see [LICENSE](../../LICENSE).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const CONTAINER_COLORS: readonly ["brand", "random", "red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "indigo", "violet", "purple", "fuchsia", "pink", "rose"];
|
|
3
|
+
export type ContainerColor = typeof CONTAINER_COLORS[number];
|
|
4
|
+
export type ContainerProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
color?: ContainerColor;
|
|
6
|
+
};
|
|
7
|
+
export declare function Container({
|
|
8
|
+
color,
|
|
9
|
+
children,
|
|
10
|
+
style,
|
|
11
|
+
...props
|
|
12
|
+
}: ContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.CONTAINER_COLORS = void 0;
|
|
8
|
+
exports.Container = Container;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _color = require("@tale-ui/utils/color");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
const CONTAINER_COLORS = exports.CONTAINER_COLORS = ['brand', 'random', 'red', 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', 'teal', 'cyan', 'sky', 'indigo', 'violet', 'purple', 'fuchsia', 'pink', 'rose'];
|
|
13
|
+
// Computed once per page load — changes on hard refresh
|
|
14
|
+
const randomBase = (0, _color.randomBaseColor)('named');
|
|
15
|
+
const randomPalette = (0, _color.generatePalette)(randomBase, 'named');
|
|
16
|
+
const randomColorVars = Object.fromEntries(randomPalette.map(({
|
|
17
|
+
shade,
|
|
18
|
+
hex
|
|
19
|
+
}) => [`--color-${shade}`, hex]));
|
|
20
|
+
function getColorVars(color) {
|
|
21
|
+
if (color === 'brand') return undefined;
|
|
22
|
+
if (color === 'random') return randomColorVars;
|
|
23
|
+
return Object.fromEntries(_color.NAMED_SHADES.map(shade => [`--color-${shade}`, `var(--${color}-${shade})`]));
|
|
24
|
+
}
|
|
25
|
+
function Container({
|
|
26
|
+
color = 'brand',
|
|
27
|
+
children,
|
|
28
|
+
style,
|
|
29
|
+
...props
|
|
30
|
+
}) {
|
|
31
|
+
const colorVars = getColorVars(color);
|
|
32
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
33
|
+
style: {
|
|
34
|
+
...colorVars,
|
|
35
|
+
...style
|
|
36
|
+
},
|
|
37
|
+
...props,
|
|
38
|
+
children: children
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "CONTAINER_COLORS", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Container.CONTAINER_COLORS;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "Container", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _Container.Container;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _Container = require("./Container");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const CONTAINER_COLORS: readonly ["brand", "random", "red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "indigo", "violet", "purple", "fuchsia", "pink", "rose"];
|
|
3
|
+
export type ContainerColor = typeof CONTAINER_COLORS[number];
|
|
4
|
+
export type ContainerProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
color?: ContainerColor;
|
|
6
|
+
};
|
|
7
|
+
export declare function Container({
|
|
8
|
+
color,
|
|
9
|
+
children,
|
|
10
|
+
style,
|
|
11
|
+
...props
|
|
12
|
+
}: ContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { randomBaseColor, generatePalette, NAMED_SHADES } from '@tale-ui/utils/color';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export const CONTAINER_COLORS = ['brand', 'random', 'red', 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', 'teal', 'cyan', 'sky', 'indigo', 'violet', 'purple', 'fuchsia', 'pink', 'rose'];
|
|
5
|
+
// Computed once per page load — changes on hard refresh
|
|
6
|
+
const randomBase = randomBaseColor('named');
|
|
7
|
+
const randomPalette = generatePalette(randomBase, 'named');
|
|
8
|
+
const randomColorVars = Object.fromEntries(randomPalette.map(({
|
|
9
|
+
shade,
|
|
10
|
+
hex
|
|
11
|
+
}) => [`--color-${shade}`, hex]));
|
|
12
|
+
function getColorVars(color) {
|
|
13
|
+
if (color === 'brand') return undefined;
|
|
14
|
+
if (color === 'random') return randomColorVars;
|
|
15
|
+
return Object.fromEntries(NAMED_SHADES.map(shade => [`--color-${shade}`, `var(--${color}-${shade})`]));
|
|
16
|
+
}
|
|
17
|
+
export function Container({
|
|
18
|
+
color = 'brand',
|
|
19
|
+
children,
|
|
20
|
+
style,
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
23
|
+
const colorVars = getColorVars(color);
|
|
24
|
+
return /*#__PURE__*/_jsx("div", {
|
|
25
|
+
style: {
|
|
26
|
+
...colorVars,
|
|
27
|
+
...style
|
|
28
|
+
},
|
|
29
|
+
...props,
|
|
30
|
+
children: children
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Container, CONTAINER_COLORS } from "./Container.js";
|
package/esm/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./checkbox/index.js";
|
|
|
7
7
|
export * from "./checkbox-group/index.js";
|
|
8
8
|
export * from "./collapsible/index.js";
|
|
9
9
|
export * from "./combobox/index.js";
|
|
10
|
+
export * from "./container/index.js";
|
|
10
11
|
export * from "./context-menu/index.js";
|
|
11
12
|
export * from "./csp-provider/index.js";
|
|
12
13
|
export * from "./dialog/index.js";
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @tale-ui/react v0.
|
|
2
|
+
* @tale-ui/react v0.1.1
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -14,6 +14,7 @@ export * from "./checkbox/index.js";
|
|
|
14
14
|
export * from "./checkbox-group/index.js";
|
|
15
15
|
export * from "./collapsible/index.js";
|
|
16
16
|
export * from "./combobox/index.js";
|
|
17
|
+
export * from "./container/index.js";
|
|
17
18
|
export * from "./context-menu/index.js";
|
|
18
19
|
export * from "./csp-provider/index.js";
|
|
19
20
|
export * from "./dialog/index.js";
|
package/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./checkbox/index.js";
|
|
|
7
7
|
export * from "./checkbox-group/index.js";
|
|
8
8
|
export * from "./collapsible/index.js";
|
|
9
9
|
export * from "./combobox/index.js";
|
|
10
|
+
export * from "./container/index.js";
|
|
10
11
|
export * from "./context-menu/index.js";
|
|
11
12
|
export * from "./csp-provider/index.js";
|
|
12
13
|
export * from "./dialog/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @tale-ui/react v0.
|
|
2
|
+
* @tale-ui/react v0.1.1
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -109,6 +109,17 @@ Object.keys(_combobox).forEach(function (key) {
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
});
|
|
112
|
+
var _container = require("./container");
|
|
113
|
+
Object.keys(_container).forEach(function (key) {
|
|
114
|
+
if (key === "default" || key === "__esModule") return;
|
|
115
|
+
if (key in exports && exports[key] === _container[key]) return;
|
|
116
|
+
Object.defineProperty(exports, key, {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () {
|
|
119
|
+
return _container[key];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
112
123
|
var _contextMenu = require("./context-menu");
|
|
113
124
|
Object.keys(_contextMenu).forEach(function (key) {
|
|
114
125
|
if (key === "default" || key === "__esModule") return;
|