@blockle/blocks 0.5.1 → 0.7.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/dist/index.cjs +264 -186
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +262 -184
- package/dist/momotaro.chunk.d.ts +337 -251
- package/dist/styles/components/Input/input.css.cjs +14 -0
- package/dist/styles/components/Input/input.css.mjs +15 -0
- package/dist/styles/lib/css/atoms/atomicProperties.cjs +17 -17
- package/dist/styles/lib/css/atoms/atomicProperties.mjs +1 -1
- package/dist/styles/lib/theme/makeComponentTheme.cjs +5 -0
- package/dist/styles/lib/theme/makeComponentTheme.mjs +6 -0
- package/dist/styles/lib/theme/makeTheme.cjs +12 -0
- package/dist/styles/lib/{css/theme → theme}/makeTheme.mjs +3 -2
- package/dist/styles/lib/theme/vars.css.cjs +9 -0
- package/dist/styles/lib/{css/theme → theme}/vars.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/button.css.cjs +21 -12
- package/dist/styles/themes/momotaro/components/button.css.mjs +14 -5
- package/dist/styles/themes/momotaro/components/checkbox.css.cjs +53 -0
- package/dist/styles/themes/momotaro/components/checkbox.css.mjs +54 -0
- package/dist/styles/themes/momotaro/components/dialog.css.cjs +25 -6
- package/dist/styles/themes/momotaro/components/dialog.css.mjs +24 -5
- package/dist/styles/themes/momotaro/components/divider.css.cjs +2 -2
- package/dist/styles/themes/momotaro/components/divider.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/helpers.css.cjs +20 -5
- package/dist/styles/themes/momotaro/components/helpers.css.mjs +18 -3
- package/dist/styles/themes/momotaro/components/index.cjs +11 -3
- package/dist/styles/themes/momotaro/components/index.mjs +11 -3
- package/dist/styles/themes/momotaro/components/input.css.cjs +40 -0
- package/dist/styles/themes/momotaro/components/input.css.mjs +41 -0
- package/dist/styles/themes/momotaro/components/label.css.cjs +33 -0
- package/dist/styles/themes/momotaro/components/label.css.mjs +34 -0
- package/dist/styles/themes/momotaro/components/link.css.cjs +6 -4
- package/dist/styles/themes/momotaro/components/link.css.mjs +5 -3
- package/dist/styles/themes/momotaro/components/radio.css.cjs +53 -0
- package/dist/styles/themes/momotaro/components/radio.css.mjs +54 -0
- package/dist/styles/themes/momotaro/components/spinner.css.cjs +2 -2
- package/dist/styles/themes/momotaro/components/spinner.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/transitions.cjs +3 -0
- package/dist/styles/themes/momotaro/components/transitions.mjs +4 -0
- package/dist/styles/themes/momotaro/momotaro.css.cjs +2 -2
- package/dist/styles/themes/momotaro/momotaro.css.mjs +1 -1
- package/dist/styles/themes/momotaro/tokens.css.cjs +4 -4
- package/dist/styles/themes/momotaro/tokens.css.mjs +4 -4
- package/package.json +2 -2
- package/dist/styles/lib/css/theme/makeComponentTheme.cjs +0 -3
- package/dist/styles/lib/css/theme/makeComponentTheme.mjs +0 -4
- package/dist/styles/lib/css/theme/makeTheme.cjs +0 -11
- package/dist/styles/lib/css/theme/vars.css.cjs +0 -9
- /package/dist/styles/lib/{css/theme → theme}/makeVanillaTheme.cjs +0 -0
- /package/dist/styles/lib/{css/theme → theme}/makeVanillaTheme.mjs +0 -0
- /package/dist/styles/lib/{css/theme → theme}/tokens.cjs +0 -0
- /package/dist/styles/lib/{css/theme → theme}/tokens.mjs +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const styles_lib_css_atoms_breakpoints_cjs = require("./styles/lib/css/atoms/breakpoints.cjs");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const styles_lib_theme_makeComponentTheme_cjs = require("./styles/lib/theme/makeComponentTheme.cjs");
|
|
5
|
+
const styles_lib_theme_makeTheme_cjs = require("./styles/lib/theme/makeTheme.cjs");
|
|
6
|
+
const styles_lib_theme_vars_css_cjs = require("./styles/lib/theme/vars.css.cjs");
|
|
7
7
|
const styles_lib_css_atoms_sprinkles_css_cjs = require("./styles/lib/css/atoms/sprinkles.css.cjs");
|
|
8
8
|
const react = require("react");
|
|
9
9
|
const jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
const styles_components_Button_Button_css_cjs = require("./styles/components/Button/Button.css.cjs");
|
|
11
|
-
const styles_components_Divider_divider_css_cjs = require("./styles/components/Divider/divider.css.cjs");
|
|
12
11
|
const styles_components_Dialog_dialog_css_cjs = require("./styles/components/Dialog/dialog.css.cjs");
|
|
13
12
|
const reactDom = require("react-dom");
|
|
13
|
+
const styles_components_Divider_divider_css_cjs = require("./styles/components/Divider/divider.css.cjs");
|
|
14
|
+
const styles_components_Input_input_css_cjs = require("./styles/components/Input/input.css.cjs");
|
|
14
15
|
const classnames = (...args) => {
|
|
15
16
|
const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
|
|
16
17
|
return className || void 0;
|
|
17
18
|
};
|
|
18
19
|
const BlocksProviderContext = react.createContext(null);
|
|
19
|
-
const BlocksProvider = ({
|
|
20
|
-
|
|
20
|
+
const BlocksProvider = ({
|
|
21
|
+
children,
|
|
22
|
+
theme,
|
|
23
|
+
className,
|
|
24
|
+
...restProps
|
|
25
|
+
}) => {
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BlocksProviderContext.Provider, { value: theme, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: classnames(theme.vars, styles_lib_css_atoms_sprinkles_css_cjs.atoms({ fontFamily: "primary" }), className),
|
|
30
|
+
...restProps,
|
|
31
|
+
children
|
|
32
|
+
}
|
|
33
|
+
) });
|
|
21
34
|
};
|
|
22
35
|
const defaultElement$1 = "div";
|
|
23
36
|
const Box = react.forwardRef(function Box2({ className, as, ...restProps }, ref) {
|
|
@@ -40,55 +53,58 @@ const useTheme = () => {
|
|
|
40
53
|
}
|
|
41
54
|
return theme;
|
|
42
55
|
};
|
|
43
|
-
|
|
44
|
-
function useComponentStyles(name, props) {
|
|
56
|
+
function useComponentStyles(name, props, useDefaultVariants = true) {
|
|
45
57
|
const { components } = useTheme();
|
|
46
58
|
const component = components[name];
|
|
47
59
|
if (!component) {
|
|
48
|
-
console.
|
|
60
|
+
console.warn(`Component ${name} is not defined in the theme`);
|
|
49
61
|
return "";
|
|
50
62
|
}
|
|
51
63
|
const classNames = [];
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
64
|
+
const variants = props.variants ?? {};
|
|
65
|
+
const variantsWithDefaults = { ...variants };
|
|
66
|
+
for (const key in props) {
|
|
67
|
+
const value = props[key];
|
|
68
|
+
if (typeof value === "boolean" && value) {
|
|
69
|
+
classNames.push(component[key]);
|
|
59
70
|
}
|
|
60
71
|
}
|
|
61
|
-
if (propsWithDefaults.base && component.base) {
|
|
62
|
-
classNames.push(component.base);
|
|
63
|
-
}
|
|
64
72
|
if (!component.variants) {
|
|
65
73
|
return classNames.join(" ");
|
|
66
74
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
const { defaultVariants } = component;
|
|
76
|
+
if (useDefaultVariants && defaultVariants) {
|
|
77
|
+
const keys2 = Object.keys(defaultVariants);
|
|
78
|
+
for (const key of keys2) {
|
|
79
|
+
if (variantsWithDefaults[key] === void 0 && defaultVariants[key]) {
|
|
80
|
+
variantsWithDefaults[key] = defaultVariants[key];
|
|
81
|
+
}
|
|
72
82
|
}
|
|
73
|
-
|
|
83
|
+
}
|
|
84
|
+
const keys = Object.keys(variantsWithDefaults);
|
|
85
|
+
const componentVariants = component.variants;
|
|
86
|
+
for (const key of keys) {
|
|
87
|
+
const value = variantsWithDefaults[key];
|
|
88
|
+
if (value === void 0) {
|
|
74
89
|
continue;
|
|
75
90
|
}
|
|
76
91
|
if (typeof value === "boolean") {
|
|
77
|
-
if (value) {
|
|
78
|
-
classNames.push(
|
|
92
|
+
if (value && componentVariants[key]) {
|
|
93
|
+
classNames.push(componentVariants[key]);
|
|
79
94
|
}
|
|
80
95
|
continue;
|
|
81
96
|
}
|
|
82
|
-
const variant =
|
|
97
|
+
const variant = componentVariants[key][value];
|
|
83
98
|
if (variant) {
|
|
84
99
|
classNames.push(variant);
|
|
85
100
|
}
|
|
86
101
|
}
|
|
87
|
-
|
|
88
|
-
|
|
102
|
+
const { compoundVariants } = component;
|
|
103
|
+
if (compoundVariants) {
|
|
104
|
+
for (const compoundVariant of compoundVariants) {
|
|
89
105
|
const keys2 = Object.keys(compoundVariant.variants);
|
|
90
106
|
const matches = keys2.every((key) => {
|
|
91
|
-
const value =
|
|
107
|
+
const value = variantsWithDefaults[key];
|
|
92
108
|
if (value === void 0) {
|
|
93
109
|
return false;
|
|
94
110
|
}
|
|
@@ -104,10 +120,13 @@ function useComponentStyles(name, props) {
|
|
|
104
120
|
const useComponentStyleDefaultProps = (name) => {
|
|
105
121
|
const { components } = useTheme();
|
|
106
122
|
const component = components[name];
|
|
107
|
-
|
|
123
|
+
if (!component) {
|
|
124
|
+
return {};
|
|
125
|
+
}
|
|
126
|
+
return component.defaultVariants ?? {};
|
|
108
127
|
};
|
|
109
128
|
const Spinner = ({ className, size, color, ...restProps }) => {
|
|
110
|
-
const spinnerClassName = useComponentStyles("spinner", { base: true, size, color });
|
|
129
|
+
const spinnerClassName = useComponentStyles("spinner", { base: true, variants: { size, color } });
|
|
111
130
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { color, className: classnames(spinnerClassName, className), ...restProps });
|
|
112
131
|
};
|
|
113
132
|
const Button = react.forwardRef(function Button2({
|
|
@@ -124,26 +143,22 @@ const Button = react.forwardRef(function Button2({
|
|
|
124
143
|
disabled,
|
|
125
144
|
...restProps
|
|
126
145
|
}, ref) {
|
|
127
|
-
const isLinkVariant = variant === "link";
|
|
128
146
|
const buttonClassName = useComponentStyles("button", {
|
|
129
147
|
base: true,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
148
|
+
variants: {
|
|
149
|
+
variant,
|
|
150
|
+
intent,
|
|
151
|
+
size,
|
|
152
|
+
disabled,
|
|
153
|
+
loading
|
|
154
|
+
}
|
|
135
155
|
});
|
|
136
|
-
const linkClassName = useComponentStyles("link", { base: true, variant: "primary" });
|
|
137
156
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
138
157
|
Box,
|
|
139
158
|
{
|
|
140
159
|
ref,
|
|
141
160
|
as: "button",
|
|
142
|
-
className: classnames(
|
|
143
|
-
styles_components_Button_Button_css_cjs.buttonReset,
|
|
144
|
-
isLinkVariant ? linkClassName : buttonClassName,
|
|
145
|
-
className
|
|
146
|
-
),
|
|
161
|
+
className: classnames(styles_components_Button_Button_css_cjs.buttonReset, buttonClassName, className),
|
|
147
162
|
width,
|
|
148
163
|
type,
|
|
149
164
|
disabled: disabled || loading,
|
|
@@ -157,140 +172,6 @@ const Button = react.forwardRef(function Button2({
|
|
|
157
172
|
}
|
|
158
173
|
);
|
|
159
174
|
});
|
|
160
|
-
const Heading = ({
|
|
161
|
-
className,
|
|
162
|
-
level = 1,
|
|
163
|
-
children,
|
|
164
|
-
align,
|
|
165
|
-
fontSize,
|
|
166
|
-
fontWeight = "strong",
|
|
167
|
-
fontFamily,
|
|
168
|
-
...restProps
|
|
169
|
-
}) => {
|
|
170
|
-
const as = `h${level}`;
|
|
171
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
172
|
-
Box,
|
|
173
|
-
{
|
|
174
|
-
as,
|
|
175
|
-
className,
|
|
176
|
-
fontFamily,
|
|
177
|
-
fontWeight,
|
|
178
|
-
fontSize,
|
|
179
|
-
textAlign: align,
|
|
180
|
-
padding: "none",
|
|
181
|
-
margin: "none",
|
|
182
|
-
...restProps,
|
|
183
|
-
children
|
|
184
|
-
}
|
|
185
|
-
);
|
|
186
|
-
};
|
|
187
|
-
const justifyContentMap = {
|
|
188
|
-
left: "flex-start",
|
|
189
|
-
right: "flex-end",
|
|
190
|
-
center: "center",
|
|
191
|
-
between: "space-between",
|
|
192
|
-
around: "space-around"
|
|
193
|
-
};
|
|
194
|
-
const alignItemsMap = {
|
|
195
|
-
left: "flex-start",
|
|
196
|
-
right: "flex-end",
|
|
197
|
-
center: "center",
|
|
198
|
-
stretch: "stretch"
|
|
199
|
-
};
|
|
200
|
-
const Inline = ({
|
|
201
|
-
alignX,
|
|
202
|
-
alignY,
|
|
203
|
-
as = "div",
|
|
204
|
-
children,
|
|
205
|
-
display = "flex",
|
|
206
|
-
gap,
|
|
207
|
-
...props
|
|
208
|
-
}) => {
|
|
209
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
210
|
-
Box,
|
|
211
|
-
{
|
|
212
|
-
as,
|
|
213
|
-
display,
|
|
214
|
-
gap,
|
|
215
|
-
flexDirection: "row",
|
|
216
|
-
justifyContent: alignX ? justifyContentMap[alignX] : void 0,
|
|
217
|
-
alignItems: alignY ? alignItemsMap[alignY] : void 0,
|
|
218
|
-
flexWrap: "wrap",
|
|
219
|
-
...props,
|
|
220
|
-
children
|
|
221
|
-
}
|
|
222
|
-
);
|
|
223
|
-
};
|
|
224
|
-
const Stack = ({
|
|
225
|
-
as = "div",
|
|
226
|
-
display = "flex",
|
|
227
|
-
children,
|
|
228
|
-
gap,
|
|
229
|
-
alignX,
|
|
230
|
-
...restProps
|
|
231
|
-
}) => {
|
|
232
|
-
if (process.env.NODE_ENV === "development" && restProps.start !== void 0 && as !== "ol") {
|
|
233
|
-
console.warn('Stack: start prop is only valid when as="ol"');
|
|
234
|
-
}
|
|
235
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
236
|
-
Box,
|
|
237
|
-
{
|
|
238
|
-
as,
|
|
239
|
-
display,
|
|
240
|
-
gap,
|
|
241
|
-
flexDirection: "column",
|
|
242
|
-
alignItems: alignX ? alignItemsMap[alignX] : void 0,
|
|
243
|
-
...restProps,
|
|
244
|
-
children
|
|
245
|
-
}
|
|
246
|
-
);
|
|
247
|
-
};
|
|
248
|
-
const Text = ({
|
|
249
|
-
as = "span",
|
|
250
|
-
children,
|
|
251
|
-
color,
|
|
252
|
-
fontSize,
|
|
253
|
-
fontWeight,
|
|
254
|
-
fontFamily,
|
|
255
|
-
textAlign,
|
|
256
|
-
...restProps
|
|
257
|
-
}) => {
|
|
258
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
259
|
-
Box,
|
|
260
|
-
{
|
|
261
|
-
as,
|
|
262
|
-
color,
|
|
263
|
-
fontSize,
|
|
264
|
-
fontWeight,
|
|
265
|
-
fontFamily,
|
|
266
|
-
textAlign,
|
|
267
|
-
padding: "none",
|
|
268
|
-
margin: "none",
|
|
269
|
-
...restProps,
|
|
270
|
-
children
|
|
271
|
-
}
|
|
272
|
-
);
|
|
273
|
-
};
|
|
274
|
-
const defaultElement = "a";
|
|
275
|
-
const Link = react.forwardRef(function Link2({ as, className, variant, underline, ...restProps }, ref) {
|
|
276
|
-
const Component = as || defaultElement;
|
|
277
|
-
const linkClassName = useComponentStyles("link", { base: true, variant, underline });
|
|
278
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Box, { ref, as: Component, className: classnames(className, linkClassName), ...restProps });
|
|
279
|
-
});
|
|
280
|
-
const Divider = ({ className, color, ...restProps }) => {
|
|
281
|
-
const dividerClass = useComponentStyles("divider", { base: true });
|
|
282
|
-
const dividerDefaults = useComponentStyleDefaultProps("divider");
|
|
283
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
284
|
-
Box,
|
|
285
|
-
{
|
|
286
|
-
role: "separator",
|
|
287
|
-
width: "full",
|
|
288
|
-
backgroundColor: color ?? dividerDefaults.color,
|
|
289
|
-
className: classnames(className, dividerClass, styles_components_Divider_divider_css_cjs.divider),
|
|
290
|
-
...restProps
|
|
291
|
-
}
|
|
292
|
-
);
|
|
293
|
-
};
|
|
294
175
|
const useLayer = () => {
|
|
295
176
|
const layerRef = react.useRef();
|
|
296
177
|
react.useEffect(
|
|
@@ -303,7 +184,9 @@ const useLayer = () => {
|
|
|
303
184
|
);
|
|
304
185
|
return () => {
|
|
305
186
|
if (!layerRef.current) {
|
|
306
|
-
|
|
187
|
+
const div = document.createElement("div");
|
|
188
|
+
div.dataset.layer = "blocks";
|
|
189
|
+
layerRef.current = div;
|
|
307
190
|
document.body.append(layerRef.current);
|
|
308
191
|
}
|
|
309
192
|
return layerRef.current;
|
|
@@ -394,7 +277,14 @@ const Portal = ({ children, container }) => {
|
|
|
394
277
|
container || document.body
|
|
395
278
|
);
|
|
396
279
|
};
|
|
397
|
-
const Dialog = ({
|
|
280
|
+
const Dialog = ({
|
|
281
|
+
children,
|
|
282
|
+
open,
|
|
283
|
+
className,
|
|
284
|
+
onRequestClose,
|
|
285
|
+
size,
|
|
286
|
+
...restProps
|
|
287
|
+
}) => {
|
|
398
288
|
const dialogRef = react.useRef(null);
|
|
399
289
|
const layer = useLayer();
|
|
400
290
|
const [visible, hide] = useVisibilityState(open);
|
|
@@ -431,8 +321,8 @@ const Dialog = ({ children, open, className, onRequestClose }) => {
|
|
|
431
321
|
document.removeEventListener("keydown", handleKeyDown);
|
|
432
322
|
};
|
|
433
323
|
}, [open, enabled]);
|
|
434
|
-
const backdropClassName = useComponentStyles("dialog", { backdrop: true });
|
|
435
|
-
const dialogClassName = useComponentStyles("dialog", { base: true });
|
|
324
|
+
const backdropClassName = useComponentStyles("dialog", { backdrop: true }, false);
|
|
325
|
+
const dialogClassName = useComponentStyles("dialog", { base: true, variants: { size } });
|
|
436
326
|
if (!visible) {
|
|
437
327
|
return null;
|
|
438
328
|
}
|
|
@@ -449,6 +339,7 @@ const Dialog = ({ children, open, className, onRequestClose }) => {
|
|
|
449
339
|
{
|
|
450
340
|
ref: dialogRef,
|
|
451
341
|
as: "dialog",
|
|
342
|
+
"aria-modal": "true",
|
|
452
343
|
open: true,
|
|
453
344
|
className: classnames(
|
|
454
345
|
styles_components_Dialog_dialog_css_cjs.dialog,
|
|
@@ -456,16 +347,201 @@ const Dialog = ({ children, open, className, onRequestClose }) => {
|
|
|
456
347
|
dialogClassName,
|
|
457
348
|
className
|
|
458
349
|
),
|
|
350
|
+
...restProps,
|
|
459
351
|
children
|
|
460
352
|
}
|
|
461
353
|
)
|
|
462
354
|
}
|
|
463
355
|
) }) });
|
|
464
356
|
};
|
|
357
|
+
const Divider = ({ className, color, ...restProps }) => {
|
|
358
|
+
const dividerClass = useComponentStyles("divider", { base: true });
|
|
359
|
+
const dividerDefaults = useComponentStyleDefaultProps("divider");
|
|
360
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
361
|
+
Box,
|
|
362
|
+
{
|
|
363
|
+
role: "separator",
|
|
364
|
+
width: "full",
|
|
365
|
+
backgroundColor: color ?? dividerDefaults.color,
|
|
366
|
+
className: classnames(className, dividerClass, styles_components_Divider_divider_css_cjs.divider),
|
|
367
|
+
...restProps
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
};
|
|
371
|
+
const Heading = ({
|
|
372
|
+
className,
|
|
373
|
+
level = 1,
|
|
374
|
+
children,
|
|
375
|
+
align,
|
|
376
|
+
fontSize,
|
|
377
|
+
fontWeight = "strong",
|
|
378
|
+
fontFamily,
|
|
379
|
+
...restProps
|
|
380
|
+
}) => {
|
|
381
|
+
const as = `h${level}`;
|
|
382
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
383
|
+
Box,
|
|
384
|
+
{
|
|
385
|
+
as,
|
|
386
|
+
className,
|
|
387
|
+
fontFamily,
|
|
388
|
+
fontWeight,
|
|
389
|
+
fontSize,
|
|
390
|
+
textAlign: align,
|
|
391
|
+
padding: "none",
|
|
392
|
+
margin: "none",
|
|
393
|
+
...restProps,
|
|
394
|
+
children
|
|
395
|
+
}
|
|
396
|
+
);
|
|
397
|
+
};
|
|
398
|
+
const justifyContentMap = {
|
|
399
|
+
left: "flex-start",
|
|
400
|
+
right: "flex-end",
|
|
401
|
+
center: "center",
|
|
402
|
+
between: "space-between",
|
|
403
|
+
around: "space-around"
|
|
404
|
+
};
|
|
405
|
+
const alignItemsMap = {
|
|
406
|
+
left: "flex-start",
|
|
407
|
+
right: "flex-end",
|
|
408
|
+
center: "center",
|
|
409
|
+
stretch: "stretch"
|
|
410
|
+
};
|
|
411
|
+
const Inline = ({
|
|
412
|
+
alignX,
|
|
413
|
+
alignY,
|
|
414
|
+
as = "div",
|
|
415
|
+
children,
|
|
416
|
+
display = "flex",
|
|
417
|
+
gap,
|
|
418
|
+
...props
|
|
419
|
+
}) => {
|
|
420
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
421
|
+
Box,
|
|
422
|
+
{
|
|
423
|
+
as,
|
|
424
|
+
display,
|
|
425
|
+
gap,
|
|
426
|
+
flexDirection: "row",
|
|
427
|
+
justifyContent: alignX ? justifyContentMap[alignX] : void 0,
|
|
428
|
+
alignItems: alignY ? alignItemsMap[alignY] : void 0,
|
|
429
|
+
flexWrap: "wrap",
|
|
430
|
+
...props,
|
|
431
|
+
children
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
};
|
|
435
|
+
const Input = react.forwardRef(function Input2({ className, name, type = "text", startSlot, endSlot, label, placeholder, ...restProps }, ref) {
|
|
436
|
+
const id = react.useId();
|
|
437
|
+
const containerClassName = useComponentStyles("input", { container: true }, false);
|
|
438
|
+
const inputClassName = useComponentStyles("input", { input: true });
|
|
439
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { display: "flex", alignItems: "center", className: classnames(containerClassName, className), children: [
|
|
440
|
+
startSlot,
|
|
441
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
442
|
+
Box,
|
|
443
|
+
{
|
|
444
|
+
as: "input",
|
|
445
|
+
id,
|
|
446
|
+
ref,
|
|
447
|
+
name,
|
|
448
|
+
type,
|
|
449
|
+
placeholder: placeholder || label,
|
|
450
|
+
width: "full",
|
|
451
|
+
overflow: "hidden",
|
|
452
|
+
className: classnames(styles_components_Input_input_css_cjs.input, inputClassName),
|
|
453
|
+
...restProps
|
|
454
|
+
}
|
|
455
|
+
),
|
|
456
|
+
endSlot
|
|
457
|
+
] }) });
|
|
458
|
+
});
|
|
459
|
+
const Label = ({
|
|
460
|
+
visualOnly,
|
|
461
|
+
children,
|
|
462
|
+
className,
|
|
463
|
+
required,
|
|
464
|
+
size,
|
|
465
|
+
cursor,
|
|
466
|
+
...restProps
|
|
467
|
+
}) => {
|
|
468
|
+
const Component = visualOnly ? "span" : "label";
|
|
469
|
+
const containerClassName = useComponentStyles("label", {
|
|
470
|
+
base: true,
|
|
471
|
+
variants: { required, size }
|
|
472
|
+
});
|
|
473
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
474
|
+
Component,
|
|
475
|
+
{
|
|
476
|
+
className: classnames(containerClassName, className, styles_lib_css_atoms_sprinkles_css_cjs.atoms({ cursor })),
|
|
477
|
+
...restProps,
|
|
478
|
+
children
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
};
|
|
482
|
+
const defaultElement = "a";
|
|
483
|
+
const Link = react.forwardRef(function Link2({ as, className, variant, underline, ...restProps }, ref) {
|
|
484
|
+
const Component = as || defaultElement;
|
|
485
|
+
const linkClassName = useComponentStyles("link", {
|
|
486
|
+
base: true,
|
|
487
|
+
variants: { variant, underline }
|
|
488
|
+
});
|
|
489
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { ref, as: Component, className: classnames(className, linkClassName), ...restProps });
|
|
490
|
+
});
|
|
491
|
+
const Stack = ({
|
|
492
|
+
as = "div",
|
|
493
|
+
display = "flex",
|
|
494
|
+
children,
|
|
495
|
+
gap,
|
|
496
|
+
alignX,
|
|
497
|
+
...restProps
|
|
498
|
+
}) => {
|
|
499
|
+
if (process.env.NODE_ENV === "development" && restProps.start !== void 0 && as !== "ol") {
|
|
500
|
+
console.warn('Stack: start prop is only valid when as="ol"');
|
|
501
|
+
}
|
|
502
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
503
|
+
Box,
|
|
504
|
+
{
|
|
505
|
+
as,
|
|
506
|
+
display,
|
|
507
|
+
gap,
|
|
508
|
+
flexDirection: "column",
|
|
509
|
+
alignItems: alignX ? alignItemsMap[alignX] : void 0,
|
|
510
|
+
...restProps,
|
|
511
|
+
children
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
};
|
|
515
|
+
const Text = ({
|
|
516
|
+
as = "span",
|
|
517
|
+
children,
|
|
518
|
+
color,
|
|
519
|
+
fontSize,
|
|
520
|
+
fontWeight,
|
|
521
|
+
fontFamily,
|
|
522
|
+
textAlign,
|
|
523
|
+
...restProps
|
|
524
|
+
}) => {
|
|
525
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
526
|
+
Box,
|
|
527
|
+
{
|
|
528
|
+
as,
|
|
529
|
+
color,
|
|
530
|
+
fontSize,
|
|
531
|
+
fontWeight,
|
|
532
|
+
fontFamily,
|
|
533
|
+
textAlign,
|
|
534
|
+
padding: "none",
|
|
535
|
+
margin: "none",
|
|
536
|
+
...restProps,
|
|
537
|
+
children
|
|
538
|
+
}
|
|
539
|
+
);
|
|
540
|
+
};
|
|
465
541
|
exports.breakpointQuery = styles_lib_css_atoms_breakpoints_cjs.breakpointQuery;
|
|
466
|
-
exports.makeComponentTheme =
|
|
467
|
-
exports.makeTheme =
|
|
468
|
-
exports.vars =
|
|
542
|
+
exports.makeComponentTheme = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme;
|
|
543
|
+
exports.makeTheme = styles_lib_theme_makeTheme_cjs.makeTheme;
|
|
544
|
+
exports.vars = styles_lib_theme_vars_css_cjs.vars;
|
|
469
545
|
exports.atoms = styles_lib_css_atoms_sprinkles_css_cjs.atoms;
|
|
470
546
|
exports.BlocksProvider = BlocksProvider;
|
|
471
547
|
exports.Box = Box;
|
|
@@ -474,6 +550,8 @@ exports.Dialog = Dialog;
|
|
|
474
550
|
exports.Divider = Divider;
|
|
475
551
|
exports.Heading = Heading;
|
|
476
552
|
exports.Inline = Inline;
|
|
553
|
+
exports.Input = Input;
|
|
554
|
+
exports.Label = Label;
|
|
477
555
|
exports.Link = Link;
|
|
478
556
|
exports.Spinner = Spinner;
|
|
479
557
|
exports.Stack = Stack;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { BlocksProvider, BlocksProviderProps,
|
|
1
|
+
export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, makeComponentTheme, makeTheme, useComponentStyleDefaultProps, useComponentStyles, vars } from './momotaro.chunk.js';
|