@blockle/blocks 0.1.0 → 0.2.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/LICENSE +1 -1
- package/README.md +43 -12
- package/dist/index.cjs +119 -0
- package/dist/index.d.ts +1 -28
- package/dist/index.mjs +119 -0
- package/dist/reset.css.cjs +5 -0
- package/dist/reset.css.d.ts +390 -0
- package/dist/reset.css.mjs +4 -0
- package/dist/styles/lib/css/atoms/atomicProperties.cjs +70 -0
- package/dist/styles/lib/css/atoms/atomicProperties.mjs +71 -0
- package/dist/styles/lib/css/atoms/breakpoints.cjs +11 -0
- package/dist/styles/lib/css/atoms/breakpoints.mjs +12 -0
- package/dist/styles/lib/css/atoms/sprinkles.css.cjs +45 -0
- package/dist/styles/lib/css/atoms/sprinkles.css.mjs +46 -0
- package/dist/styles/lib/css/reset/reset.css.cjs +37 -0
- package/dist/styles/lib/css/reset/reset.css.mjs +36 -0
- package/dist/styles/lib/css/theme/makeTheme.cjs +10 -0
- package/dist/styles/lib/css/theme/makeTheme.mjs +11 -0
- package/dist/styles/lib/css/theme/makeVanillaTheme.cjs +16 -0
- package/dist/styles/lib/css/theme/makeVanillaTheme.mjs +17 -0
- package/dist/styles/lib/css/theme/tokens.cjs +77 -0
- package/dist/styles/lib/css/theme/tokens.mjs +78 -0
- package/dist/styles/lib/css/theme/vars.css.cjs +9 -0
- package/dist/styles/lib/css/theme/vars.css.mjs +10 -0
- package/dist/styles/themes/momotaro/momotaroTheme.css.cjs +11 -0
- package/dist/styles/themes/momotaro/momotaroTheme.css.mjs +12 -0
- package/dist/styles/themes/momotaro/tokens.cjs +77 -0
- package/dist/styles/themes/momotaro/tokens.mjs +78 -0
- package/dist/themes/momotaro.cjs +4 -0
- package/dist/themes/momotaro.d.ts +1 -0
- package/dist/themes/momotaro.mjs +4 -0
- package/package.json +59 -79
- package/reset.css/index.d.ts +1 -0
- package/reset.css/package.json +5 -0
- package/themes/momotaro/index.d.ts +1 -0
- package/themes/momotaro/package.json +5 -0
- package/dist/Badge/Badge.d.ts +0 -7
- package/dist/Badge/Badge.spec.d.ts +0 -1
- package/dist/Badge/Badge.stories.d.ts +0 -1
- package/dist/Badge/index.d.ts +0 -1
- package/dist/Box/Box.d.ts +0 -10
- package/dist/Box/index.d.ts +0 -1
- package/dist/Button/Button.d.ts +0 -13
- package/dist/Button/Button.spec.d.ts +0 -1
- package/dist/Button/Button.stories.d.ts +0 -1
- package/dist/Button/index.d.ts +0 -1
- package/dist/Card/Card.d.ts +0 -11
- package/dist/Card/Card.spec.d.ts +0 -1
- package/dist/Card/Card.stories.d.ts +0 -1
- package/dist/Card/index.d.ts +0 -1
- package/dist/Dialog/Dialog.d.ts +0 -13
- package/dist/Dialog/index.d.ts +0 -1
- package/dist/Divider/Divider.d.ts +0 -4
- package/dist/Divider/index.d.ts +0 -1
- package/dist/Drawer/Drawer.d.ts +0 -10
- package/dist/Drawer/index.d.ts +0 -1
- package/dist/Dropdown/Dropdown.d.ts +0 -17
- package/dist/Dropdown/index.d.ts +0 -1
- package/dist/FlatButton/FlatButton.d.ts +0 -15
- package/dist/FlatButton/index.d.ts +0 -1
- package/dist/Grid/Grid.d.ts +0 -10
- package/dist/Grid/index.d.ts +0 -1
- package/dist/Icon/Icon.d.ts +0 -26
- package/dist/Icon/Icon.spec.d.ts +0 -1
- package/dist/Icon/index.d.ts +0 -1
- package/dist/IconButton/IconButton.d.ts +0 -12
- package/dist/IconButton/index.d.ts +0 -1
- package/dist/Inline/Inline.d.ts +0 -8
- package/dist/Inline/index.d.ts +0 -1
- package/dist/Link/Link.d.ts +0 -9
- package/dist/Link/index.d.ts +0 -1
- package/dist/Loader/Loader.d.ts +0 -4
- package/dist/Loader/index.d.ts +0 -1
- package/dist/OutlineButton/OutlineButton.d.ts +0 -12
- package/dist/OutlineButton/index.d.ts +0 -1
- package/dist/Panel/Panel.d.ts +0 -10
- package/dist/Panel/index.d.ts +0 -1
- package/dist/Paper/Paper.d.ts +0 -14
- package/dist/Paper/Paper.spec.d.ts +0 -1
- package/dist/Paper/index.d.ts +0 -1
- package/dist/RippleBox/RippleBox.d.ts +0 -8
- package/dist/RippleBox/createRipple.d.ts +0 -2
- package/dist/RippleBox/index.d.ts +0 -1
- package/dist/Stack/Stack.d.ts +0 -13
- package/dist/Stack/index.d.ts +0 -1
- package/dist/Tag/Tag.d.ts +0 -8
- package/dist/Tag/index.d.ts +0 -1
- package/dist/Text/Text.d.ts +0 -10
- package/dist/Text/Text.spec.d.ts +0 -1
- package/dist/Text/index.d.ts +0 -1
- package/dist/TextField/TextField.d.ts +0 -22
- package/dist/TextField/TextField.stories.d.ts +0 -1
- package/dist/TextField/index.d.ts +0 -1
- package/dist/blockle-blocks.esm.js +0 -823
- package/dist/blockle-blocks.js +0 -854
- package/dist/blocks.css +0 -2554
- package/dist/blocks.css.map +0 -1
- package/dist/cx.d.ts +0 -3
- package/dist/setupTests.d.ts +0 -1
- package/dist/useAnimationState/index.d.ts +0 -1
- package/dist/useAnimationState/useAnimationState.d.ts +0 -6
- package/dist/useFlip/animate.d.ts +0 -14
- package/dist/useFlip/index.d.ts +0 -1
- package/dist/useFlip/useFlip.d.ts +0 -8
- package/dist/useLayer/index.d.ts +0 -1
- package/dist/useLayer/useLayer.d.ts +0 -1
- package/dist/useStyles/blocks.d.ts +0 -34
- package/dist/useStyles/index.d.ts +0 -2
- package/dist/useStyles/useStyles.d.ts +0 -3
- package/dist/utils/animate/animateCss.d.ts +0 -11
- package/dist/utils/animate/index.d.ts +0 -1
- package/dist/utils/getEventPosition.d.ts +0 -6
- package/dist/utils/index.d.ts +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,27 +1,58 @@
|
|
|
1
1
|
# @blockle/blocks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Blocks design system
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
npm install @blockle/blocks
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Setup
|
|
12
12
|
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
```jsx
|
|
14
|
+
import React from 'react';
|
|
15
|
+
|
|
16
|
+
import '@blockle/blocks/reset.css';
|
|
17
|
+
import { ThemeProvider } from '@blockle/blocks';
|
|
18
|
+
import { theme } from '@blockle/blocks/themes/momotaro';
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
// const Link = makeLinkComponent(...)
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
const App = () => (
|
|
23
|
+
<ThemeProvider theme={theme} spritePath="/public/" linkComponent={Link}>
|
|
24
|
+
...
|
|
25
|
+
</ThemeProvider>
|
|
26
|
+
);
|
|
21
27
|
```
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
import React from 'react';
|
|
24
33
|
import { Button } from '@blockle/blocks';
|
|
25
34
|
|
|
26
|
-
const
|
|
35
|
+
const App = () => <Button>Click me</Button>;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Theming
|
|
39
|
+
|
|
40
|
+
yourTheme.css.ts
|
|
41
|
+
|
|
42
|
+
```jsx
|
|
43
|
+
import { makeTokens, makeComponentTheme, makeTheme } from "@blockle/blocks";
|
|
44
|
+
|
|
45
|
+
const tokens = makeTokens({ ... });
|
|
46
|
+
|
|
47
|
+
const button = makeComponentTheme({
|
|
48
|
+
type: 'button',
|
|
49
|
+
...
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const theme = makeTheme({
|
|
53
|
+
tokens,
|
|
54
|
+
components: {
|
|
55
|
+
button
|
|
56
|
+
}
|
|
57
|
+
});
|
|
27
58
|
```
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const styles_lib_css_atoms_sprinkles_css_cjs = require("./styles/lib/css/atoms/sprinkles.css.cjs");
|
|
5
|
+
const react = require("react");
|
|
6
|
+
const styles_lib_css_theme_vars_css_cjs = require("./styles/lib/css/theme/vars.css.cjs");
|
|
7
|
+
const classnames = (...args) => {
|
|
8
|
+
const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
|
|
9
|
+
return className || void 0;
|
|
10
|
+
};
|
|
11
|
+
const BlocksProvider = ({ children, theme }) => {
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classnames(theme.vars, styles_lib_css_atoms_sprinkles_css_cjs.atoms({ fontFamily: "standard" })), children });
|
|
13
|
+
};
|
|
14
|
+
const defaultElement = "div";
|
|
15
|
+
const Box = react.forwardRef(function Box2({ className, as, ...restProps }, ref) {
|
|
16
|
+
const Component = as || defaultElement;
|
|
17
|
+
const atomProps = {};
|
|
18
|
+
const otherProps = {};
|
|
19
|
+
for (const [name, value] of Object.entries(restProps)) {
|
|
20
|
+
if (styles_lib_css_atoms_sprinkles_css_cjs.atoms.properties.has(name)) {
|
|
21
|
+
atomProps[name] = value;
|
|
22
|
+
} else {
|
|
23
|
+
otherProps[name] = value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, className: classnames(className, styles_lib_css_atoms_sprinkles_css_cjs.atoms(atomProps)), ...otherProps });
|
|
27
|
+
});
|
|
28
|
+
const justifyContentMap = {
|
|
29
|
+
left: "flex-start",
|
|
30
|
+
right: "flex-end",
|
|
31
|
+
center: "center",
|
|
32
|
+
between: "space-between",
|
|
33
|
+
around: "space-around"
|
|
34
|
+
};
|
|
35
|
+
const alignItemsMap = {
|
|
36
|
+
left: "flex-start",
|
|
37
|
+
right: "flex-end",
|
|
38
|
+
center: "center",
|
|
39
|
+
stretch: "stretch"
|
|
40
|
+
};
|
|
41
|
+
const Inline = ({
|
|
42
|
+
alignX,
|
|
43
|
+
alignY,
|
|
44
|
+
as = "div",
|
|
45
|
+
children,
|
|
46
|
+
display = "flex",
|
|
47
|
+
gap,
|
|
48
|
+
...props
|
|
49
|
+
}) => {
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
51
|
+
Box,
|
|
52
|
+
{
|
|
53
|
+
as,
|
|
54
|
+
display,
|
|
55
|
+
gap,
|
|
56
|
+
flexDirection: "row",
|
|
57
|
+
justifyContent: alignX ? justifyContentMap[alignX] : void 0,
|
|
58
|
+
alignItems: alignY ? alignItemsMap[alignY] : void 0,
|
|
59
|
+
flexWrap: "wrap",
|
|
60
|
+
...props,
|
|
61
|
+
children
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
const Stack = ({
|
|
66
|
+
as = "div",
|
|
67
|
+
display = "flex",
|
|
68
|
+
children,
|
|
69
|
+
gap,
|
|
70
|
+
alignX,
|
|
71
|
+
...restProps
|
|
72
|
+
}) => {
|
|
73
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
74
|
+
Box,
|
|
75
|
+
{
|
|
76
|
+
as,
|
|
77
|
+
display,
|
|
78
|
+
gap,
|
|
79
|
+
flexDirection: "column",
|
|
80
|
+
alignItems: alignX ? alignItemsMap[alignX] : void 0,
|
|
81
|
+
...restProps,
|
|
82
|
+
children
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
const Text = ({
|
|
87
|
+
as = "span",
|
|
88
|
+
children,
|
|
89
|
+
color,
|
|
90
|
+
fontSize,
|
|
91
|
+
fontWeight,
|
|
92
|
+
fontFamily,
|
|
93
|
+
textAlign,
|
|
94
|
+
...restProps
|
|
95
|
+
}) => {
|
|
96
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
97
|
+
Box,
|
|
98
|
+
{
|
|
99
|
+
as,
|
|
100
|
+
color,
|
|
101
|
+
fontSize,
|
|
102
|
+
fontWeight,
|
|
103
|
+
fontFamily,
|
|
104
|
+
textAlign,
|
|
105
|
+
padding: "none",
|
|
106
|
+
margin: "none",
|
|
107
|
+
...restProps,
|
|
108
|
+
children
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
exports.atoms = styles_lib_css_atoms_sprinkles_css_cjs.atoms;
|
|
113
|
+
exports.vars = styles_lib_css_theme_vars_css_cjs.vars;
|
|
114
|
+
exports.BlocksProvider = BlocksProvider;
|
|
115
|
+
exports.Box = Box;
|
|
116
|
+
exports.Inline = Inline;
|
|
117
|
+
exports.Stack = Stack;
|
|
118
|
+
exports.Text = Text;
|
|
119
|
+
exports.classnames = classnames;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './Box';
|
|
3
|
-
export * from './Button';
|
|
4
|
-
export * from './Card';
|
|
5
|
-
export * from './cx';
|
|
6
|
-
export * from './Dialog';
|
|
7
|
-
export * from './Divider';
|
|
8
|
-
export * from './Drawer';
|
|
9
|
-
export * from './Dropdown';
|
|
10
|
-
export * from './FlatButton';
|
|
11
|
-
export * from './Grid';
|
|
12
|
-
export * from './Icon';
|
|
13
|
-
export * from './IconButton';
|
|
14
|
-
export * from './Inline';
|
|
15
|
-
export * from './Link';
|
|
16
|
-
export * from './Loader';
|
|
17
|
-
export * from './OutlineButton';
|
|
18
|
-
export * from './Panel';
|
|
19
|
-
export * from './Paper';
|
|
20
|
-
export * from './RippleBox';
|
|
21
|
-
export * from './Stack';
|
|
22
|
-
export * from './Tag';
|
|
23
|
-
export * from './Text';
|
|
24
|
-
export * from './TextField';
|
|
25
|
-
export * from './useAnimationState';
|
|
26
|
-
export * from './useFlip';
|
|
27
|
-
export * from './useLayer';
|
|
28
|
-
export * from './useStyles';
|
|
1
|
+
export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Inline, InlineProps, Stack, StackProps, Text, TextProps, atoms, classnames, vars } from './reset.css.js';
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { atoms } from "./styles/lib/css/atoms/sprinkles.css.mjs";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { vars } from "./styles/lib/css/theme/vars.css.mjs";
|
|
5
|
+
const classnames = (...args) => {
|
|
6
|
+
const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
|
|
7
|
+
return className || void 0;
|
|
8
|
+
};
|
|
9
|
+
const BlocksProvider = ({ children, theme }) => {
|
|
10
|
+
return /* @__PURE__ */ jsx("div", { className: classnames(theme.vars, atoms({ fontFamily: "standard" })), children });
|
|
11
|
+
};
|
|
12
|
+
const defaultElement = "div";
|
|
13
|
+
const Box = forwardRef(function Box2({ className, as, ...restProps }, ref) {
|
|
14
|
+
const Component = as || defaultElement;
|
|
15
|
+
const atomProps = {};
|
|
16
|
+
const otherProps = {};
|
|
17
|
+
for (const [name, value] of Object.entries(restProps)) {
|
|
18
|
+
if (atoms.properties.has(name)) {
|
|
19
|
+
atomProps[name] = value;
|
|
20
|
+
} else {
|
|
21
|
+
otherProps[name] = value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ jsx(Component, { ref, className: classnames(className, atoms(atomProps)), ...otherProps });
|
|
25
|
+
});
|
|
26
|
+
const justifyContentMap = {
|
|
27
|
+
left: "flex-start",
|
|
28
|
+
right: "flex-end",
|
|
29
|
+
center: "center",
|
|
30
|
+
between: "space-between",
|
|
31
|
+
around: "space-around"
|
|
32
|
+
};
|
|
33
|
+
const alignItemsMap = {
|
|
34
|
+
left: "flex-start",
|
|
35
|
+
right: "flex-end",
|
|
36
|
+
center: "center",
|
|
37
|
+
stretch: "stretch"
|
|
38
|
+
};
|
|
39
|
+
const Inline = ({
|
|
40
|
+
alignX,
|
|
41
|
+
alignY,
|
|
42
|
+
as = "div",
|
|
43
|
+
children,
|
|
44
|
+
display = "flex",
|
|
45
|
+
gap,
|
|
46
|
+
...props
|
|
47
|
+
}) => {
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
Box,
|
|
50
|
+
{
|
|
51
|
+
as,
|
|
52
|
+
display,
|
|
53
|
+
gap,
|
|
54
|
+
flexDirection: "row",
|
|
55
|
+
justifyContent: alignX ? justifyContentMap[alignX] : void 0,
|
|
56
|
+
alignItems: alignY ? alignItemsMap[alignY] : void 0,
|
|
57
|
+
flexWrap: "wrap",
|
|
58
|
+
...props,
|
|
59
|
+
children
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
const Stack = ({
|
|
64
|
+
as = "div",
|
|
65
|
+
display = "flex",
|
|
66
|
+
children,
|
|
67
|
+
gap,
|
|
68
|
+
alignX,
|
|
69
|
+
...restProps
|
|
70
|
+
}) => {
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
Box,
|
|
73
|
+
{
|
|
74
|
+
as,
|
|
75
|
+
display,
|
|
76
|
+
gap,
|
|
77
|
+
flexDirection: "column",
|
|
78
|
+
alignItems: alignX ? alignItemsMap[alignX] : void 0,
|
|
79
|
+
...restProps,
|
|
80
|
+
children
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
const Text = ({
|
|
85
|
+
as = "span",
|
|
86
|
+
children,
|
|
87
|
+
color,
|
|
88
|
+
fontSize,
|
|
89
|
+
fontWeight,
|
|
90
|
+
fontFamily,
|
|
91
|
+
textAlign,
|
|
92
|
+
...restProps
|
|
93
|
+
}) => {
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
95
|
+
Box,
|
|
96
|
+
{
|
|
97
|
+
as,
|
|
98
|
+
color,
|
|
99
|
+
fontSize,
|
|
100
|
+
fontWeight,
|
|
101
|
+
fontFamily,
|
|
102
|
+
textAlign,
|
|
103
|
+
padding: "none",
|
|
104
|
+
margin: "none",
|
|
105
|
+
...restProps,
|
|
106
|
+
children
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
export {
|
|
111
|
+
BlocksProvider,
|
|
112
|
+
Box,
|
|
113
|
+
Inline,
|
|
114
|
+
Stack,
|
|
115
|
+
Text,
|
|
116
|
+
atoms,
|
|
117
|
+
classnames,
|
|
118
|
+
vars
|
|
119
|
+
};
|