@blockle/blocks 0.8.8 → 0.8.9

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.
Files changed (90) hide show
  1. package/dist/index.cjs +77 -736
  2. package/dist/index.d.mts +1 -0
  3. package/dist/index.mjs +56 -714
  4. package/dist/momotaro.chunk.d.ts +423 -410
  5. package/dist/reset.css.d.mts +2 -0
  6. package/dist/reset.css.d.ts +1 -1
  7. package/dist/styles/components/display/Divider/Divider.cjs +226 -0
  8. package/dist/styles/components/display/Divider/Divider.mjs +227 -0
  9. package/dist/styles/components/{Divider → display/Divider}/divider.css.cjs +2 -2
  10. package/dist/styles/components/{Divider → display/Divider}/divider.css.mjs +2 -2
  11. package/dist/styles/components/form/Button/Button.cjs +55 -0
  12. package/dist/styles/components/{Button → form/Button}/Button.css.cjs +2 -2
  13. package/dist/styles/components/{Button → form/Button}/Button.css.mjs +2 -2
  14. package/dist/styles/components/form/Button/Button.mjs +56 -0
  15. package/dist/styles/components/form/Checkbox/Checkbox.cjs +47 -0
  16. package/dist/styles/components/form/Checkbox/Checkbox.mjs +48 -0
  17. package/dist/styles/components/{Checkbox → form/Checkbox}/checkbox.css.cjs +2 -2
  18. package/dist/styles/components/{Checkbox → form/Checkbox}/checkbox.css.mjs +2 -2
  19. package/dist/styles/components/form/Input/Input.cjs +27 -0
  20. package/dist/styles/components/form/Input/Input.mjs +28 -0
  21. package/dist/styles/components/{Input → form/Input}/input.css.cjs +2 -2
  22. package/dist/styles/components/{Input → form/Input}/input.css.mjs +2 -2
  23. package/dist/styles/components/form/Radio/Radio.cjs +23 -0
  24. package/dist/styles/components/form/Radio/Radio.mjs +24 -0
  25. package/dist/styles/components/{Radio → form/Radio}/radio.css.cjs +2 -2
  26. package/dist/styles/components/{Radio → form/Radio}/radio.css.mjs +2 -2
  27. package/dist/styles/components/form/Switch/Switch.cjs +61 -0
  28. package/dist/styles/components/form/Switch/Switch.mjs +62 -0
  29. package/dist/styles/components/{Switch → form/Switch}/switch.css.cjs +2 -2
  30. package/dist/styles/components/{Switch → form/Switch}/switch.css.mjs +2 -2
  31. package/dist/styles/components/other/BlocksProvider/BlocksProvider.cjs +20 -0
  32. package/dist/styles/components/other/BlocksProvider/BlocksProvider.mjs +21 -0
  33. package/dist/styles/components/overlay/Dialog/Dialog.cjs +245 -0
  34. package/dist/styles/components/overlay/Dialog/Dialog.mjs +246 -0
  35. package/dist/styles/components/{Dialog → overlay/Dialog}/dialog.css.cjs +2 -2
  36. package/dist/styles/components/{Dialog → overlay/Dialog}/dialog.css.mjs +2 -2
  37. package/dist/styles/components/typography/Heading/Heading.cjs +14 -0
  38. package/dist/styles/components/typography/Heading/Heading.mjs +15 -0
  39. package/dist/styles/components/{Heading → typography/Heading}/heading.css.cjs +2 -2
  40. package/dist/styles/components/{Heading → typography/Heading}/heading.css.mjs +2 -2
  41. package/dist/styles/components/typography/Text/Text.cjs +9 -0
  42. package/dist/styles/components/typography/Text/Text.mjs +10 -0
  43. package/dist/styles/components/{Text → typography/Text}/text.css.cjs +2 -2
  44. package/dist/styles/components/{Text → typography/Text}/text.css.mjs +2 -2
  45. package/dist/styles/lib/css/atoms/atoms.cjs +1 -0
  46. package/dist/styles/lib/css/atoms/atoms.mjs +1 -0
  47. package/dist/styles/lib/css/atoms/sprinkles.css.cjs +2 -6
  48. package/dist/styles/lib/css/atoms/sprinkles.css.mjs +2 -6
  49. package/dist/styles/lib/css/layers/layers.css.cjs +1 -1
  50. package/dist/styles/lib/css/layers/layers.css.mjs +1 -1
  51. package/dist/styles/lib/theme/vars.css.cjs +1 -1
  52. package/dist/styles/lib/theme/vars.css.mjs +1 -1
  53. package/dist/styles/lib/utils/atom-props.cjs +15 -0
  54. package/dist/styles/lib/utils/atom-props.mjs +16 -0
  55. package/dist/styles/themes/momotaro/components/button.css.cjs +1 -1
  56. package/dist/styles/themes/momotaro/components/button.css.mjs +1 -1
  57. package/dist/styles/themes/momotaro/components/checkbox.css.cjs +1 -1
  58. package/dist/styles/themes/momotaro/components/checkbox.css.mjs +1 -1
  59. package/dist/styles/themes/momotaro/components/dialog.css.cjs +1 -1
  60. package/dist/styles/themes/momotaro/components/dialog.css.mjs +1 -1
  61. package/dist/styles/themes/momotaro/components/divider.css.cjs +1 -1
  62. package/dist/styles/themes/momotaro/components/divider.css.mjs +1 -1
  63. package/dist/styles/themes/momotaro/components/dropdown.css.cjs +54 -0
  64. package/dist/styles/themes/momotaro/components/dropdown.css.mjs +55 -0
  65. package/dist/styles/themes/momotaro/components/helpers.css.cjs +1 -1
  66. package/dist/styles/themes/momotaro/components/helpers.css.mjs +1 -1
  67. package/dist/styles/themes/momotaro/components/index.cjs +2 -0
  68. package/dist/styles/themes/momotaro/components/index.mjs +2 -0
  69. package/dist/styles/themes/momotaro/components/input.css.cjs +1 -1
  70. package/dist/styles/themes/momotaro/components/input.css.mjs +1 -1
  71. package/dist/styles/themes/momotaro/components/label.css.cjs +1 -1
  72. package/dist/styles/themes/momotaro/components/label.css.mjs +1 -1
  73. package/dist/styles/themes/momotaro/components/link.css.cjs +1 -1
  74. package/dist/styles/themes/momotaro/components/link.css.mjs +1 -1
  75. package/dist/styles/themes/momotaro/components/progress.css.cjs +1 -1
  76. package/dist/styles/themes/momotaro/components/progress.css.mjs +1 -1
  77. package/dist/styles/themes/momotaro/components/radio.css.cjs +1 -1
  78. package/dist/styles/themes/momotaro/components/radio.css.mjs +1 -1
  79. package/dist/styles/themes/momotaro/components/spinner.css.cjs +1 -1
  80. package/dist/styles/themes/momotaro/components/spinner.css.mjs +1 -1
  81. package/dist/styles/themes/momotaro/components/switch.css.cjs +1 -1
  82. package/dist/styles/themes/momotaro/components/switch.css.mjs +1 -1
  83. package/dist/styles/themes/momotaro/index.cjs +1 -0
  84. package/dist/styles/themes/momotaro/index.mjs +1 -0
  85. package/dist/styles/themes/momotaro/momotaro.css.cjs +1 -1
  86. package/dist/styles/themes/momotaro/momotaro.css.mjs +1 -1
  87. package/dist/styles/themes/momotaro/tokens.css.cjs +1 -1
  88. package/dist/styles/themes/momotaro/tokens.css.mjs +1 -1
  89. package/dist/themes/momotaro.d.mts +1 -0
  90. package/package.json +47 -37
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -1,2 +1,2 @@
1
1
 
2
- export { }
2
+ export { }
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const styles_components_display_Divider_divider_css_cjs = require("./divider.css.cjs");
4
+ const react = require("react");
5
+ const styles_lib_utils_atomProps_cjs = require("../../../lib/utils/atom-props.cjs");
6
+ const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
7
+ const BlocksProviderContext = react.createContext(null);
8
+ const useTheme = () => {
9
+ const theme = react.useContext(BlocksProviderContext);
10
+ if (!theme) {
11
+ throw new Error("useTheme must be used within a BlocksProvider");
12
+ }
13
+ return theme;
14
+ };
15
+ function useComponentStyles(name, props, useDefaultVariants = true) {
16
+ const { components } = useTheme();
17
+ const component = components[name];
18
+ if (!component) {
19
+ console.warn(`Component ${name} is not defined in the theme`);
20
+ return "";
21
+ }
22
+ const classNames = [];
23
+ const variants = props.variants ?? {};
24
+ const variantsWithDefaults = { ...variants };
25
+ for (const key in props) {
26
+ const value = props[key];
27
+ if (typeof value === "boolean" && value) {
28
+ classNames.push(component[key]);
29
+ }
30
+ }
31
+ if (!component.variants) {
32
+ return classNames.join(" ");
33
+ }
34
+ const { defaultVariants } = component;
35
+ if (useDefaultVariants && defaultVariants) {
36
+ const keys2 = Object.keys(defaultVariants);
37
+ for (const key of keys2) {
38
+ if (variantsWithDefaults[key] === void 0 && defaultVariants[key]) {
39
+ variantsWithDefaults[key] = defaultVariants[key];
40
+ }
41
+ }
42
+ }
43
+ const keys = Object.keys(variantsWithDefaults);
44
+ const componentVariants = component.variants;
45
+ for (const key of keys) {
46
+ const value = variantsWithDefaults[key];
47
+ if (value === void 0 || componentVariants[key] === void 0) {
48
+ continue;
49
+ }
50
+ if (typeof value === "boolean") {
51
+ if (value && componentVariants[key]) {
52
+ classNames.push(componentVariants[key]);
53
+ }
54
+ continue;
55
+ }
56
+ const variant = componentVariants[key][value];
57
+ if (variant) {
58
+ classNames.push(variant);
59
+ }
60
+ }
61
+ const { compoundVariants } = component;
62
+ if (compoundVariants) {
63
+ for (const compoundVariant of compoundVariants) {
64
+ const keys2 = Object.keys(compoundVariant.variants);
65
+ const matches = keys2.every((key) => {
66
+ const value = variantsWithDefaults[key];
67
+ if (value === void 0) {
68
+ return false;
69
+ }
70
+ return value === compoundVariant.variants[key];
71
+ });
72
+ if (matches) {
73
+ classNames.push(compoundVariant.style);
74
+ }
75
+ }
76
+ }
77
+ return classNames.join(" ");
78
+ }
79
+ const useComponentStyleDefaultProps = (name) => {
80
+ const { components } = useTheme();
81
+ const component = components[name];
82
+ if (!component) {
83
+ return {};
84
+ }
85
+ return component.defaultVariants ?? {};
86
+ };
87
+ const classnames = (...args) => {
88
+ const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
89
+ return className || void 0;
90
+ };
91
+ function setRef(ref, value) {
92
+ if (typeof ref === "function") {
93
+ ref(value);
94
+ } else if (ref !== null && ref !== void 0) {
95
+ ref.current = value;
96
+ }
97
+ }
98
+ function composeRefs(...refs) {
99
+ return (node) => {
100
+ for (const ref of refs) {
101
+ setRef(ref, node);
102
+ }
103
+ };
104
+ }
105
+ function mergeProps(slotProps, childProps) {
106
+ const overrideProps = {};
107
+ for (const propName in childProps) {
108
+ const slotPropValue = slotProps[propName];
109
+ const childPropValue = childProps[propName];
110
+ if (childPropValue === void 0) {
111
+ continue;
112
+ }
113
+ if (slotPropValue === void 0) {
114
+ overrideProps[propName] = childPropValue;
115
+ continue;
116
+ }
117
+ if (typeof slotPropValue === "function" && typeof childPropValue === "function") {
118
+ overrideProps[propName] = (...args) => {
119
+ childPropValue(...args);
120
+ slotPropValue(...args);
121
+ };
122
+ } else if (propName === "style") {
123
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
124
+ } else if (propName === "className") {
125
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
126
+ } else {
127
+ overrideProps[propName] = childPropValue;
128
+ }
129
+ }
130
+ return { ...slotProps, ...overrideProps };
131
+ }
132
+ function createSlottable(defaultElement) {
133
+ function Slottable2(props, ref) {
134
+ const { asChild, children, ...slotProps } = props;
135
+ const Component = defaultElement;
136
+ if (!asChild) {
137
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, ...slotProps, children });
138
+ }
139
+ const childrenArray = react.Children.toArray(children);
140
+ const slot = childrenArray.find((child) => {
141
+ if (!react.isValidElement(child)) {
142
+ return false;
143
+ }
144
+ return child.type === Slot;
145
+ });
146
+ if (!slot) {
147
+ const Slot2 = childrenArray[0];
148
+ if (!react.isValidElement(childrenArray[0])) {
149
+ if (process.env.NODE_ENV === "development") {
150
+ console.warn("Slottable: First child is not a valid React element");
151
+ }
152
+ return null;
153
+ }
154
+ if (!react.isValidElement(Slot2)) {
155
+ return null;
156
+ }
157
+ return react.cloneElement(
158
+ Slot2,
159
+ {
160
+ ...mergeProps(slotProps, Slot2.props),
161
+ ref: composeRefs(ref, Slot2.ref)
162
+ },
163
+ Slot2.props.children
164
+ );
165
+ }
166
+ if (!react.isValidElement(slot) || !react.isValidElement(slot.props.children)) {
167
+ return null;
168
+ }
169
+ const newChildren = childrenArray.map((child) => {
170
+ if (!react.isValidElement(child)) {
171
+ return child;
172
+ }
173
+ if (child.type === Slot) {
174
+ return slot.props.children.props.children;
175
+ }
176
+ return child;
177
+ });
178
+ return react.cloneElement(
179
+ slot.props.children,
180
+ {
181
+ ...mergeProps(slotProps, slot.props),
182
+ ref: composeRefs(ref, slot.props.children.ref)
183
+ },
184
+ newChildren
185
+ );
186
+ }
187
+ return react.forwardRef(Slottable2);
188
+ }
189
+ const Slot = ({ children }) => children;
190
+ const Slottable = createSlottable("div");
191
+ const Box = react.forwardRef(function Box2({ asChild, className, children, ...restProps }, ref) {
192
+ const [atomsProps, otherProps] = styles_lib_utils_atomProps_cjs.getAtomsAndProps(restProps);
193
+ return /* @__PURE__ */ jsxRuntime.jsx(
194
+ Slottable,
195
+ {
196
+ ref,
197
+ asChild,
198
+ className: classnames(className, styles_lib_css_atoms_sprinkles_css_cjs.atoms(atomsProps)),
199
+ ...otherProps,
200
+ children
201
+ }
202
+ );
203
+ });
204
+ const Divider = ({ className, color, ...restProps }) => {
205
+ const dividerClass = useComponentStyles("divider", { base: true });
206
+ const dividerDefaults = useComponentStyleDefaultProps("divider");
207
+ return /* @__PURE__ */ jsxRuntime.jsx(
208
+ Box,
209
+ {
210
+ role: "separator",
211
+ width: "full",
212
+ backgroundColor: color ?? dividerDefaults.color,
213
+ className: classnames(className, dividerClass, styles_components_display_Divider_divider_css_cjs.divider),
214
+ ...restProps
215
+ }
216
+ );
217
+ };
218
+ exports.BlocksProviderContext = BlocksProviderContext;
219
+ exports.Box = Box;
220
+ exports.Divider = Divider;
221
+ exports.Slot = Slot;
222
+ exports.classnames = classnames;
223
+ exports.createSlottable = createSlottable;
224
+ exports.useComponentStyleDefaultProps = useComponentStyleDefaultProps;
225
+ exports.useComponentStyles = useComponentStyles;
226
+ exports.useTheme = useTheme;
@@ -0,0 +1,227 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { divider } from "./divider.css.mjs";
3
+ import { createContext, useContext, forwardRef, Children, isValidElement, cloneElement } from "react";
4
+ import { getAtomsAndProps } from "../../../lib/utils/atom-props.mjs";
5
+ import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
6
+ const BlocksProviderContext = createContext(null);
7
+ const useTheme = () => {
8
+ const theme = useContext(BlocksProviderContext);
9
+ if (!theme) {
10
+ throw new Error("useTheme must be used within a BlocksProvider");
11
+ }
12
+ return theme;
13
+ };
14
+ function useComponentStyles(name, props, useDefaultVariants = true) {
15
+ const { components } = useTheme();
16
+ const component = components[name];
17
+ if (!component) {
18
+ console.warn(`Component ${name} is not defined in the theme`);
19
+ return "";
20
+ }
21
+ const classNames = [];
22
+ const variants = props.variants ?? {};
23
+ const variantsWithDefaults = { ...variants };
24
+ for (const key in props) {
25
+ const value = props[key];
26
+ if (typeof value === "boolean" && value) {
27
+ classNames.push(component[key]);
28
+ }
29
+ }
30
+ if (!component.variants) {
31
+ return classNames.join(" ");
32
+ }
33
+ const { defaultVariants } = component;
34
+ if (useDefaultVariants && defaultVariants) {
35
+ const keys2 = Object.keys(defaultVariants);
36
+ for (const key of keys2) {
37
+ if (variantsWithDefaults[key] === void 0 && defaultVariants[key]) {
38
+ variantsWithDefaults[key] = defaultVariants[key];
39
+ }
40
+ }
41
+ }
42
+ const keys = Object.keys(variantsWithDefaults);
43
+ const componentVariants = component.variants;
44
+ for (const key of keys) {
45
+ const value = variantsWithDefaults[key];
46
+ if (value === void 0 || componentVariants[key] === void 0) {
47
+ continue;
48
+ }
49
+ if (typeof value === "boolean") {
50
+ if (value && componentVariants[key]) {
51
+ classNames.push(componentVariants[key]);
52
+ }
53
+ continue;
54
+ }
55
+ const variant = componentVariants[key][value];
56
+ if (variant) {
57
+ classNames.push(variant);
58
+ }
59
+ }
60
+ const { compoundVariants } = component;
61
+ if (compoundVariants) {
62
+ for (const compoundVariant of compoundVariants) {
63
+ const keys2 = Object.keys(compoundVariant.variants);
64
+ const matches = keys2.every((key) => {
65
+ const value = variantsWithDefaults[key];
66
+ if (value === void 0) {
67
+ return false;
68
+ }
69
+ return value === compoundVariant.variants[key];
70
+ });
71
+ if (matches) {
72
+ classNames.push(compoundVariant.style);
73
+ }
74
+ }
75
+ }
76
+ return classNames.join(" ");
77
+ }
78
+ const useComponentStyleDefaultProps = (name) => {
79
+ const { components } = useTheme();
80
+ const component = components[name];
81
+ if (!component) {
82
+ return {};
83
+ }
84
+ return component.defaultVariants ?? {};
85
+ };
86
+ const classnames = (...args) => {
87
+ const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
88
+ return className || void 0;
89
+ };
90
+ function setRef(ref, value) {
91
+ if (typeof ref === "function") {
92
+ ref(value);
93
+ } else if (ref !== null && ref !== void 0) {
94
+ ref.current = value;
95
+ }
96
+ }
97
+ function composeRefs(...refs) {
98
+ return (node) => {
99
+ for (const ref of refs) {
100
+ setRef(ref, node);
101
+ }
102
+ };
103
+ }
104
+ function mergeProps(slotProps, childProps) {
105
+ const overrideProps = {};
106
+ for (const propName in childProps) {
107
+ const slotPropValue = slotProps[propName];
108
+ const childPropValue = childProps[propName];
109
+ if (childPropValue === void 0) {
110
+ continue;
111
+ }
112
+ if (slotPropValue === void 0) {
113
+ overrideProps[propName] = childPropValue;
114
+ continue;
115
+ }
116
+ if (typeof slotPropValue === "function" && typeof childPropValue === "function") {
117
+ overrideProps[propName] = (...args) => {
118
+ childPropValue(...args);
119
+ slotPropValue(...args);
120
+ };
121
+ } else if (propName === "style") {
122
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
123
+ } else if (propName === "className") {
124
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
125
+ } else {
126
+ overrideProps[propName] = childPropValue;
127
+ }
128
+ }
129
+ return { ...slotProps, ...overrideProps };
130
+ }
131
+ function createSlottable(defaultElement) {
132
+ function Slottable2(props, ref) {
133
+ const { asChild, children, ...slotProps } = props;
134
+ const Component = defaultElement;
135
+ if (!asChild) {
136
+ return /* @__PURE__ */ jsx(Component, { ref, ...slotProps, children });
137
+ }
138
+ const childrenArray = Children.toArray(children);
139
+ const slot = childrenArray.find((child) => {
140
+ if (!isValidElement(child)) {
141
+ return false;
142
+ }
143
+ return child.type === Slot;
144
+ });
145
+ if (!slot) {
146
+ const Slot2 = childrenArray[0];
147
+ if (!isValidElement(childrenArray[0])) {
148
+ if (process.env.NODE_ENV === "development") {
149
+ console.warn("Slottable: First child is not a valid React element");
150
+ }
151
+ return null;
152
+ }
153
+ if (!isValidElement(Slot2)) {
154
+ return null;
155
+ }
156
+ return cloneElement(
157
+ Slot2,
158
+ {
159
+ ...mergeProps(slotProps, Slot2.props),
160
+ ref: composeRefs(ref, Slot2.ref)
161
+ },
162
+ Slot2.props.children
163
+ );
164
+ }
165
+ if (!isValidElement(slot) || !isValidElement(slot.props.children)) {
166
+ return null;
167
+ }
168
+ const newChildren = childrenArray.map((child) => {
169
+ if (!isValidElement(child)) {
170
+ return child;
171
+ }
172
+ if (child.type === Slot) {
173
+ return slot.props.children.props.children;
174
+ }
175
+ return child;
176
+ });
177
+ return cloneElement(
178
+ slot.props.children,
179
+ {
180
+ ...mergeProps(slotProps, slot.props),
181
+ ref: composeRefs(ref, slot.props.children.ref)
182
+ },
183
+ newChildren
184
+ );
185
+ }
186
+ return forwardRef(Slottable2);
187
+ }
188
+ const Slot = ({ children }) => children;
189
+ const Slottable = createSlottable("div");
190
+ const Box = forwardRef(function Box2({ asChild, className, children, ...restProps }, ref) {
191
+ const [atomsProps, otherProps] = getAtomsAndProps(restProps);
192
+ return /* @__PURE__ */ jsx(
193
+ Slottable,
194
+ {
195
+ ref,
196
+ asChild,
197
+ className: classnames(className, atoms(atomsProps)),
198
+ ...otherProps,
199
+ children
200
+ }
201
+ );
202
+ });
203
+ const Divider = ({ className, color, ...restProps }) => {
204
+ const dividerClass = useComponentStyles("divider", { base: true });
205
+ const dividerDefaults = useComponentStyleDefaultProps("divider");
206
+ return /* @__PURE__ */ jsx(
207
+ Box,
208
+ {
209
+ role: "separator",
210
+ width: "full",
211
+ backgroundColor: color ?? dividerDefaults.color,
212
+ className: classnames(className, dividerClass, divider),
213
+ ...restProps
214
+ }
215
+ );
216
+ };
217
+ export {
218
+ BlocksProviderContext,
219
+ Box,
220
+ Divider,
221
+ Slot,
222
+ classnames,
223
+ createSlottable,
224
+ useComponentStyleDefaultProps,
225
+ useComponentStyles,
226
+ useTheme
227
+ };
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  const fileScope = require("@vanilla-extract/css/fileScope");
3
3
  const css = require("@vanilla-extract/css");
4
- const styles_lib_css_layers_layers_css_cjs = require("../../lib/css/layers/layers.css.cjs");
5
- fileScope.setFileScope("src/components/Divider/divider.css.ts?used", "blocks");
4
+ const styles_lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
5
+ fileScope.setFileScope("src/components/display/Divider/divider.css.ts", "blocks");
6
6
  const divider = css.style({
7
7
  "@layer": {
8
8
  [styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
@@ -1,7 +1,7 @@
1
1
  import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
2
  import { style } from "@vanilla-extract/css";
3
- import { blocksLayer } from "../../lib/css/layers/layers.css.mjs";
4
- setFileScope("src/components/Divider/divider.css.ts?used", "blocks");
3
+ import { blocksLayer } from "../../../lib/css/layers/layers.css.mjs";
4
+ setFileScope("src/components/display/Divider/divider.css.ts", "blocks");
5
5
  const divider = style({
6
6
  "@layer": {
7
7
  [blocksLayer]: {
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const react = require("react");
4
+ const styles_lib_utils_atomProps_cjs = require("../../../lib/utils/atom-props.cjs");
5
+ const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
6
+ const styles_components_form_Button_Button_css_cjs = require("./Button.css.cjs");
7
+ const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
8
+ const Spinner = ({ className, size, color, ...restProps }) => {
9
+ const spinnerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("spinner", { base: true, variants: { size, color } });
10
+ return /* @__PURE__ */ jsxRuntime.jsx(styles_components_display_Divider_Divider_cjs.Box, { color, className: styles_components_display_Divider_Divider_cjs.classnames(spinnerClassName, className), ...restProps });
11
+ };
12
+ const Slottable = styles_components_display_Divider_Divider_cjs.createSlottable("button");
13
+ const Button = react.forwardRef(function Button2({
14
+ children,
15
+ className,
16
+ variant,
17
+ intent,
18
+ size,
19
+ startSlot,
20
+ endSlot,
21
+ loading,
22
+ disabled,
23
+ asChild,
24
+ ...restProps
25
+ }, ref) {
26
+ const buttonClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("button", {
27
+ base: true,
28
+ variants: {
29
+ variant,
30
+ intent,
31
+ size,
32
+ disabled,
33
+ loading
34
+ }
35
+ });
36
+ const [atomsProps, otherProps] = styles_lib_utils_atomProps_cjs.getAtomsAndProps(restProps);
37
+ return /* @__PURE__ */ jsxRuntime.jsxs(
38
+ Slottable,
39
+ {
40
+ ref,
41
+ asChild,
42
+ disabled: disabled || loading,
43
+ className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Button_Button_css_cjs.buttonReset, buttonClassName, styles_lib_css_atoms_sprinkles_css_cjs.atoms(atomsProps), className),
44
+ ...otherProps,
45
+ children: [
46
+ startSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { children: startSlot }),
47
+ loading && /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size }),
48
+ /* @__PURE__ */ jsxRuntime.jsx(styles_components_display_Divider_Divider_cjs.Slot, { children }),
49
+ endSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { children: endSlot })
50
+ ]
51
+ }
52
+ );
53
+ });
54
+ exports.Button = Button;
55
+ exports.Spinner = Spinner;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  const fileScope = require("@vanilla-extract/css/fileScope");
3
3
  const css = require("@vanilla-extract/css");
4
- const styles_lib_css_layers_layers_css_cjs = require("../../lib/css/layers/layers.css.cjs");
5
- fileScope.setFileScope("src/components/Button/Button.css.ts?used", "blocks");
4
+ const styles_lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
5
+ fileScope.setFileScope("src/components/form/Button/Button.css.ts", "blocks");
6
6
  const buttonReset = css.style({
7
7
  "@layer": {
8
8
  [styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
@@ -1,7 +1,7 @@
1
1
  import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
2
  import { style } from "@vanilla-extract/css";
3
- import { blocksLayer } from "../../lib/css/layers/layers.css.mjs";
4
- setFileScope("src/components/Button/Button.css.ts?used", "blocks");
3
+ import { blocksLayer } from "../../../lib/css/layers/layers.css.mjs";
4
+ setFileScope("src/components/form/Button/Button.css.ts", "blocks");
5
5
  const buttonReset = style({
6
6
  "@layer": {
7
7
  [blocksLayer]: {
@@ -0,0 +1,56 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { getAtomsAndProps } from "../../../lib/utils/atom-props.mjs";
4
+ import { useComponentStyles, Box, classnames, createSlottable, Slot } from "../../display/Divider/Divider.mjs";
5
+ import { buttonReset } from "./Button.css.mjs";
6
+ import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
7
+ const Spinner = ({ className, size, color, ...restProps }) => {
8
+ const spinnerClassName = useComponentStyles("spinner", { base: true, variants: { size, color } });
9
+ return /* @__PURE__ */ jsx(Box, { color, className: classnames(spinnerClassName, className), ...restProps });
10
+ };
11
+ const Slottable = createSlottable("button");
12
+ const Button = forwardRef(function Button2({
13
+ children,
14
+ className,
15
+ variant,
16
+ intent,
17
+ size,
18
+ startSlot,
19
+ endSlot,
20
+ loading,
21
+ disabled,
22
+ asChild,
23
+ ...restProps
24
+ }, ref) {
25
+ const buttonClassName = useComponentStyles("button", {
26
+ base: true,
27
+ variants: {
28
+ variant,
29
+ intent,
30
+ size,
31
+ disabled,
32
+ loading
33
+ }
34
+ });
35
+ const [atomsProps, otherProps] = getAtomsAndProps(restProps);
36
+ return /* @__PURE__ */ jsxs(
37
+ Slottable,
38
+ {
39
+ ref,
40
+ asChild,
41
+ disabled: disabled || loading,
42
+ className: classnames(buttonReset, buttonClassName, atoms(atomsProps), className),
43
+ ...otherProps,
44
+ children: [
45
+ startSlot && /* @__PURE__ */ jsx("div", { children: startSlot }),
46
+ loading && /* @__PURE__ */ jsx(Spinner, { size }),
47
+ /* @__PURE__ */ jsx(Slot, { children }),
48
+ endSlot && /* @__PURE__ */ jsx("div", { children: endSlot })
49
+ ]
50
+ }
51
+ );
52
+ });
53
+ export {
54
+ Button,
55
+ Spinner
56
+ };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const react = require("react");
4
+ const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
5
+ const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
6
+ const styles_components_form_Checkbox_checkbox_css_cjs = require("./checkbox.css.cjs");
7
+ const Label = ({
8
+ asSpan,
9
+ children,
10
+ className,
11
+ required,
12
+ size,
13
+ cursor,
14
+ ...restProps
15
+ }) => {
16
+ const Component = asSpan ? "span" : "label";
17
+ const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("label", {
18
+ base: true,
19
+ variants: { required, size }
20
+ });
21
+ return /* @__PURE__ */ jsxRuntime.jsx(
22
+ Component,
23
+ {
24
+ className: styles_components_display_Divider_Divider_cjs.classnames(containerClassName, className, styles_lib_css_atoms_sprinkles_css_cjs.atoms({ cursor })),
25
+ ...restProps,
26
+ children
27
+ }
28
+ );
29
+ };
30
+ const Checkbox = react.forwardRef(function Checkbox2({ name, label, required, className, ...restProps }, ref) {
31
+ const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { base: true }, false);
32
+ const iconClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { icon: true }, false);
33
+ const labelClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { label: true }, false);
34
+ const input = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Checkbox_checkbox_css_cjs.container, containerClassName, className), children: [
35
+ /* @__PURE__ */ jsxRuntime.jsx("input", { ref, type: "checkbox", name, className: styles_components_form_Checkbox_checkbox_css_cjs.input, ...restProps }),
36
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Checkbox_checkbox_css_cjs.icon, iconClassName) })
37
+ ] });
38
+ if (!label) {
39
+ return input;
40
+ }
41
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: labelClassName, children: [
42
+ input,
43
+ label && /* @__PURE__ */ jsxRuntime.jsx(Label, { asSpan: true, required, children: label })
44
+ ] });
45
+ });
46
+ exports.Checkbox = Checkbox;
47
+ exports.Label = Label;