@blockle/blocks-react 1.0.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.
Files changed (223) hide show
  1. package/README.md +25 -0
  2. package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.cjs +20 -0
  3. package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.d.ts +6 -0
  4. package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.js +20 -0
  5. package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.spec.d.ts +1 -0
  6. package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
  7. package/dist/components/accessibility/VisuallyHidden/index.d.ts +1 -0
  8. package/dist/components/accessibility/VisuallyHidden/visually-hidden.css.cjs +16 -0
  9. package/dist/components/accessibility/VisuallyHidden/visually-hidden.css.d.ts +1 -0
  10. package/dist/components/accessibility/VisuallyHidden/visually-hidden.css.js +16 -0
  11. package/dist/components/display/Divider/Divider.cjs +28 -0
  12. package/dist/components/display/Divider/Divider.d.ts +7 -0
  13. package/dist/components/display/Divider/Divider.js +28 -0
  14. package/dist/components/display/Divider/Divider.spec.d.ts +1 -0
  15. package/dist/components/display/Divider/Divider.stories.d.ts +6 -0
  16. package/dist/components/display/Divider/divider.css.cjs +16 -0
  17. package/dist/components/display/Divider/divider.css.d.ts +1 -0
  18. package/dist/components/display/Divider/divider.css.js +16 -0
  19. package/dist/components/display/Divider/index.d.ts +1 -0
  20. package/dist/components/feedback/Progress/Progress.cjs +55 -0
  21. package/dist/components/feedback/Progress/Progress.d.ts +16 -0
  22. package/dist/components/feedback/Progress/Progress.js +55 -0
  23. package/dist/components/feedback/Progress/Progress.stories.d.ts +5 -0
  24. package/dist/components/feedback/Progress/index.d.ts +1 -0
  25. package/dist/components/feedback/Spinner/Spinner.cjs +27 -0
  26. package/dist/components/feedback/Spinner/Spinner.d.ts +10 -0
  27. package/dist/components/feedback/Spinner/Spinner.js +27 -0
  28. package/dist/components/feedback/Spinner/Spinner.stories.d.ts +5 -0
  29. package/dist/components/feedback/Spinner/index.d.ts +1 -0
  30. package/dist/components/form/Button/Button.cjs +58 -0
  31. package/dist/components/form/Button/Button.css.cjs +16 -0
  32. package/dist/components/form/Button/Button.css.d.ts +1 -0
  33. package/dist/components/form/Button/Button.css.js +16 -0
  34. package/dist/components/form/Button/Button.d.ts +21 -0
  35. package/dist/components/form/Button/Button.js +58 -0
  36. package/dist/components/form/Button/Button.spec.d.ts +1 -0
  37. package/dist/components/form/Button/Button.stories.d.ts +7 -0
  38. package/dist/components/form/Button/index.d.ts +1 -0
  39. package/dist/components/form/Checkbox/Checkbox.cjs +80 -0
  40. package/dist/components/form/Checkbox/Checkbox.d.ts +9 -0
  41. package/dist/components/form/Checkbox/Checkbox.js +80 -0
  42. package/dist/components/form/Checkbox/Checkbox.spec.d.ts +1 -0
  43. package/dist/components/form/Checkbox/Checkbox.stories.d.ts +5 -0
  44. package/dist/components/form/Checkbox/checkbox.css.cjs +32 -0
  45. package/dist/components/form/Checkbox/checkbox.css.d.ts +3 -0
  46. package/dist/components/form/Checkbox/checkbox.css.js +32 -0
  47. package/dist/components/form/Checkbox/index.d.ts +1 -0
  48. package/dist/components/form/Input/Input.cjs +52 -0
  49. package/dist/components/form/Input/Input.d.ts +10 -0
  50. package/dist/components/form/Input/Input.js +52 -0
  51. package/dist/components/form/Input/Input.spec.d.ts +1 -0
  52. package/dist/components/form/Input/Input.stories.d.ts +5 -0
  53. package/dist/components/form/Input/index.d.ts +1 -0
  54. package/dist/components/form/Input/input.css.cjs +21 -0
  55. package/dist/components/form/Input/input.css.d.ts +1 -0
  56. package/dist/components/form/Input/input.css.js +21 -0
  57. package/dist/components/form/Label/Label.cjs +34 -0
  58. package/dist/components/form/Label/Label.d.ts +18 -0
  59. package/dist/components/form/Label/Label.js +34 -0
  60. package/dist/components/form/Label/Label.spec.d.ts +1 -0
  61. package/dist/components/form/Label/Label.stories.d.ts +6 -0
  62. package/dist/components/form/Label/index.d.ts +1 -0
  63. package/dist/components/form/Radio/Radio.cjs +50 -0
  64. package/dist/components/form/Radio/Radio.d.ts +8 -0
  65. package/dist/components/form/Radio/Radio.js +50 -0
  66. package/dist/components/form/Radio/Radio.spec.d.ts +1 -0
  67. package/dist/components/form/Radio/Radio.stories.d.ts +6 -0
  68. package/dist/components/form/Radio/RadioGroup.d.ts +8 -0
  69. package/dist/components/form/Radio/index.d.ts +2 -0
  70. package/dist/components/form/Radio/radio.css.cjs +32 -0
  71. package/dist/components/form/Radio/radio.css.d.ts +3 -0
  72. package/dist/components/form/Radio/radio.css.js +32 -0
  73. package/dist/components/form/Select/Select.cjs +73 -0
  74. package/dist/components/form/Select/Select.d.ts +11 -0
  75. package/dist/components/form/Select/Select.js +73 -0
  76. package/dist/components/form/Select/Select.stories.d.ts +5 -0
  77. package/dist/components/form/Select/index.d.ts +1 -0
  78. package/dist/components/form/Select/select.css.cjs +38 -0
  79. package/dist/components/form/Select/select.css.d.ts +3 -0
  80. package/dist/components/form/Select/select.css.js +38 -0
  81. package/dist/components/form/Slider/Slider.cjs +139 -0
  82. package/dist/components/form/Slider/Slider.d.ts +22 -0
  83. package/dist/components/form/Slider/Slider.js +139 -0
  84. package/dist/components/form/Slider/Slider.spec.d.ts +1 -0
  85. package/dist/components/form/Slider/Slider.stories.d.ts +7 -0
  86. package/dist/components/form/Slider/index.d.ts +1 -0
  87. package/dist/components/form/Slider/slider.css.cjs +75 -0
  88. package/dist/components/form/Slider/slider.css.d.ts +5 -0
  89. package/dist/components/form/Slider/slider.css.js +75 -0
  90. package/dist/components/form/Slider/usePointerProgress.cjs +46 -0
  91. package/dist/components/form/Slider/usePointerProgress.d.ts +11 -0
  92. package/dist/components/form/Slider/usePointerProgress.js +46 -0
  93. package/dist/components/form/Switch/Switch.cjs +73 -0
  94. package/dist/components/form/Switch/Switch.d.ts +6 -0
  95. package/dist/components/form/Switch/Switch.js +73 -0
  96. package/dist/components/form/Switch/Switch.stories.d.ts +5 -0
  97. package/dist/components/form/Switch/index.d.ts +1 -0
  98. package/dist/components/form/Switch/switch.css.cjs +27 -0
  99. package/dist/components/form/Switch/switch.css.d.ts +2 -0
  100. package/dist/components/form/Switch/switch.css.js +27 -0
  101. package/dist/components/layout/Box/Box.cjs +26 -0
  102. package/dist/components/layout/Box/Box.d.ts +10 -0
  103. package/dist/components/layout/Box/Box.js +26 -0
  104. package/dist/components/layout/Box/Box.spec.d.ts +1 -0
  105. package/dist/components/layout/Box/Box.stories.d.ts +6 -0
  106. package/dist/components/layout/Box/index.d.ts +1 -0
  107. package/dist/components/layout/Inline/Inline.cjs +30 -0
  108. package/dist/components/layout/Inline/Inline.d.ts +12 -0
  109. package/dist/components/layout/Inline/Inline.js +30 -0
  110. package/dist/components/layout/Inline/Inline.stories.d.ts +6 -0
  111. package/dist/components/layout/Inline/index.d.ts +1 -0
  112. package/dist/components/layout/Stack/Stack.cjs +27 -0
  113. package/dist/components/layout/Stack/Stack.d.ts +16 -0
  114. package/dist/components/layout/Stack/Stack.js +27 -0
  115. package/dist/components/layout/Stack/Stack.stories.d.ts +6 -0
  116. package/dist/components/layout/Stack/index.d.ts +1 -0
  117. package/dist/components/navigation/Link/Link.cjs +33 -0
  118. package/dist/components/navigation/Link/Link.d.ts +11 -0
  119. package/dist/components/navigation/Link/Link.js +33 -0
  120. package/dist/components/navigation/Link/Link.stories.d.ts +6 -0
  121. package/dist/components/navigation/Link/Link.test.d.ts +1 -0
  122. package/dist/components/navigation/Link/index.d.ts +1 -0
  123. package/dist/components/overlay/Dialog/Dialog.cjs +81 -0
  124. package/dist/components/overlay/Dialog/Dialog.d.ts +12 -0
  125. package/dist/components/overlay/Dialog/Dialog.js +81 -0
  126. package/dist/components/overlay/Dialog/Dialog.stories.d.ts +7 -0
  127. package/dist/components/overlay/Dialog/Dialog.test.d.ts +1 -0
  128. package/dist/components/overlay/Dialog/dialog.css.cjs +22 -0
  129. package/dist/components/overlay/Dialog/dialog.css.d.ts +1 -0
  130. package/dist/components/overlay/Dialog/dialog.css.js +22 -0
  131. package/dist/components/overlay/Dialog/dialogHelper.cjs +21 -0
  132. package/dist/components/overlay/Dialog/dialogHelper.d.ts +6 -0
  133. package/dist/components/overlay/Dialog/dialogHelper.js +21 -0
  134. package/dist/components/overlay/Dialog/index.d.ts +1 -0
  135. package/dist/components/overlay/Popover/Popover.cjs +112 -0
  136. package/dist/components/overlay/Popover/Popover.d.ts +12 -0
  137. package/dist/components/overlay/Popover/Popover.js +112 -0
  138. package/dist/components/overlay/Popover/Popover.stories.d.ts +5 -0
  139. package/dist/components/overlay/Popover/index.d.ts +1 -0
  140. package/dist/components/overlay/Popover/popover-utils.cjs +62 -0
  141. package/dist/components/overlay/Popover/popover-utils.d.ts +2 -0
  142. package/dist/components/overlay/Popover/popover-utils.js +62 -0
  143. package/dist/components/overlay/Portal/Portal.cjs +15 -0
  144. package/dist/components/overlay/Portal/Portal.d.ts +5 -0
  145. package/dist/components/overlay/Portal/Portal.js +15 -0
  146. package/dist/components/overlay/Portal/index.d.ts +1 -0
  147. package/dist/components/overlay/Tooltip/Tooltip.cjs +73 -0
  148. package/dist/components/overlay/Tooltip/Tooltip.d.ts +12 -0
  149. package/dist/components/overlay/Tooltip/Tooltip.js +73 -0
  150. package/dist/components/overlay/Tooltip/Tooltip.stories.d.ts +5 -0
  151. package/dist/components/overlay/Tooltip/index.d.ts +1 -0
  152. package/dist/components/providers/BlocksProvider/BlocksProvider.cjs +35 -0
  153. package/dist/components/providers/BlocksProvider/BlocksProvider.d.ts +9 -0
  154. package/dist/components/providers/BlocksProvider/BlocksProvider.js +35 -0
  155. package/dist/components/providers/BlocksProvider/BlocksProvider.test.d.ts +1 -0
  156. package/dist/components/providers/BlocksProvider/context.cjs +5 -0
  157. package/dist/components/providers/BlocksProvider/context.d.ts +5 -0
  158. package/dist/components/providers/BlocksProvider/context.js +5 -0
  159. package/dist/components/providers/BlocksProvider/index.d.ts +2 -0
  160. package/dist/components/typography/Heading/Heading.cjs +24 -0
  161. package/dist/components/typography/Heading/Heading.d.ts +7 -0
  162. package/dist/components/typography/Heading/Heading.js +24 -0
  163. package/dist/components/typography/Heading/Heading.test.d.ts +1 -0
  164. package/dist/components/typography/Heading/heading.css.cjs +16 -0
  165. package/dist/components/typography/Heading/heading.css.d.ts +1 -0
  166. package/dist/components/typography/Heading/heading.css.js +16 -0
  167. package/dist/components/typography/Heading/heading.stories.d.ts +12 -0
  168. package/dist/components/typography/Heading/index.d.ts +1 -0
  169. package/dist/components/typography/Text/Text.cjs +21 -0
  170. package/dist/components/typography/Text/Text.d.ts +11 -0
  171. package/dist/components/typography/Text/Text.js +21 -0
  172. package/dist/components/typography/Text/Text.stories.d.ts +5 -0
  173. package/dist/components/typography/Text/Text.test.d.ts +1 -0
  174. package/dist/components/typography/Text/index.d.ts +1 -0
  175. package/dist/components/typography/Text/text.css.cjs +16 -0
  176. package/dist/components/typography/Text/text.css.d.ts +1 -0
  177. package/dist/components/typography/Text/text.css.js +16 -0
  178. package/dist/hooks/useClickOutside/useClickOutside.cjs +23 -0
  179. package/dist/hooks/useClickOutside/useClickOutside.d.ts +6 -0
  180. package/dist/hooks/useClickOutside/useClickOutside.js +23 -0
  181. package/dist/hooks/useComponentStyles/index.d.ts +2 -0
  182. package/dist/hooks/useComponentStyles/useComponentStyleDefaultProps.cjs +12 -0
  183. package/dist/hooks/useComponentStyles/useComponentStyleDefaultProps.d.ts +7 -0
  184. package/dist/hooks/useComponentStyles/useComponentStyleDefaultProps.js +12 -0
  185. package/dist/hooks/useComponentStyles/useComponentStyles.cjs +74 -0
  186. package/dist/hooks/useComponentStyles/useComponentStyles.d.ts +2 -0
  187. package/dist/hooks/useComponentStyles/useComponentStyles.js +74 -0
  188. package/dist/hooks/useControlledValue/index.d.ts +1 -0
  189. package/dist/hooks/useControlledValue/useControlledValue.cjs +33 -0
  190. package/dist/hooks/useControlledValue/useControlledValue.d.ts +8 -0
  191. package/dist/hooks/useControlledValue/useControlledValue.js +33 -0
  192. package/dist/hooks/useIsomorphicLayoutEffect/index.d.ts +1 -0
  193. package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs +6 -0
  194. package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +5 -0
  195. package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +6 -0
  196. package/dist/hooks/useKeyboard/index.d.ts +1 -0
  197. package/dist/hooks/useKeyboard/useKeyboard.cjs +21 -0
  198. package/dist/hooks/useKeyboard/useKeyboard.d.ts +6 -0
  199. package/dist/hooks/useKeyboard/useKeyboard.js +21 -0
  200. package/dist/hooks/useLayer/index.d.ts +1 -0
  201. package/dist/hooks/useLayer/useLayer.cjs +27 -0
  202. package/dist/hooks/useLayer/useLayer.d.ts +1 -0
  203. package/dist/hooks/useLayer/useLayer.js +27 -0
  204. package/dist/hooks/usePreventBodyScroll/index.d.ts +1 -0
  205. package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.cjs +31 -0
  206. package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.d.ts +1 -0
  207. package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.js +31 -0
  208. package/dist/hooks/useRestoreFocus/index.d.ts +1 -0
  209. package/dist/hooks/useRestoreFocus/useRestoreFocus.cjs +19 -0
  210. package/dist/hooks/useRestoreFocus/useRestoreFocus.d.ts +4 -0
  211. package/dist/hooks/useRestoreFocus/useRestoreFocus.js +19 -0
  212. package/dist/hooks/useTheme/index.d.ts +1 -0
  213. package/dist/hooks/useTheme/useTheme.cjs +13 -0
  214. package/dist/hooks/useTheme/useTheme.d.ts +2 -0
  215. package/dist/hooks/useTheme/useTheme.js +13 -0
  216. package/dist/hooks/useVisibilityState/index.d.ts +1 -0
  217. package/dist/hooks/useVisibilityState/useVisibilityState.cjs +17 -0
  218. package/dist/hooks/useVisibilityState/useVisibilityState.d.ts +3 -0
  219. package/dist/hooks/useVisibilityState/useVisibilityState.js +17 -0
  220. package/dist/index.cjs +58 -0
  221. package/dist/index.d.ts +27 -0
  222. package/dist/index.js +58 -0
  223. package/package.json +47 -0
@@ -0,0 +1,80 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const blocksCore = require("@blockle/blocks-core");
6
+ const react = require("react");
7
+ const Label = require("../Label/Label.cjs");
8
+ const checkbox_css = require("./checkbox.css.cjs");
9
+ const useComponentStyles = require("../../../hooks/useComponentStyles/useComponentStyles.cjs");
10
+ const Checkbox = ({
11
+ children,
12
+ className,
13
+ id,
14
+ name,
15
+ ref,
16
+ required,
17
+ ...restProps
18
+ }) => {
19
+ const containerClassName = useComponentStyles.useComponentStyles(
20
+ "checkbox",
21
+ { base: true },
22
+ false
23
+ );
24
+ const iconClassName = useComponentStyles.useComponentStyles("checkbox", { icon: true }, false);
25
+ const labelClassName = useComponentStyles.useComponentStyles("checkbox", { label: true }, false);
26
+ const reactId = react.useId();
27
+ const inputId = id || reactId;
28
+ const input = /* @__PURE__ */ jsxRuntime.jsxs(
29
+ "div",
30
+ {
31
+ className: blocksCore.classnames(checkbox_css.container, containerClassName, className),
32
+ children: [
33
+ /* @__PURE__ */ jsxRuntime.jsx(
34
+ "input",
35
+ {
36
+ ref,
37
+ type: "checkbox",
38
+ name,
39
+ id: inputId,
40
+ className: checkbox_css.input,
41
+ ...restProps
42
+ }
43
+ ),
44
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: blocksCore.classnames(checkbox_css.icon, iconClassName), "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(DefaultIcon, {}) })
45
+ ]
46
+ }
47
+ );
48
+ if (!children) {
49
+ return input;
50
+ }
51
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: labelClassName, children: [
52
+ input,
53
+ children && /* @__PURE__ */ jsxRuntime.jsx(Label.Label, { required, htmlFor: inputId, children })
54
+ ] });
55
+ };
56
+ const DefaultIcon = () => {
57
+ return (
58
+ // TOOD - replace with actual icon component renderer
59
+ /* @__PURE__ */ jsxRuntime.jsx(
60
+ "svg",
61
+ {
62
+ viewBox: "0 0 24 24",
63
+ fill: "none",
64
+ strokeWidth: "1.5",
65
+ stroke: "currentColor",
66
+ style: { width: "1rem", height: "1rem", display: "block" },
67
+ role: "presentation",
68
+ children: /* @__PURE__ */ jsxRuntime.jsx(
69
+ "path",
70
+ {
71
+ strokeLinecap: "round",
72
+ strokeLinejoin: "round",
73
+ d: "m4.5 12.75 6 6 9-13.5"
74
+ }
75
+ )
76
+ }
77
+ )
78
+ );
79
+ };
80
+ exports.Checkbox = Checkbox;
@@ -0,0 +1,9 @@
1
+ import { HTMLElementProps } from '@blockle/blocks-core';
2
+ import { default as React } from 'react';
3
+ export type CheckboxProps = {
4
+ children?: React.ReactNode;
5
+ name: string;
6
+ ref?: React.Ref<HTMLInputElement>;
7
+ required?: boolean;
8
+ } & HTMLElementProps<HTMLInputElement>;
9
+ export declare const Checkbox: React.FC<CheckboxProps>;
@@ -0,0 +1,80 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import { classnames } from "@blockle/blocks-core";
4
+ import { useId } from "react";
5
+ import { Label } from "../Label/Label.js";
6
+ import { input, icon, container } from "./checkbox.css.js";
7
+ import { useComponentStyles } from "../../../hooks/useComponentStyles/useComponentStyles.js";
8
+ const Checkbox = ({
9
+ children,
10
+ className,
11
+ id,
12
+ name,
13
+ ref,
14
+ required,
15
+ ...restProps
16
+ }) => {
17
+ const containerClassName = useComponentStyles(
18
+ "checkbox",
19
+ { base: true },
20
+ false
21
+ );
22
+ const iconClassName = useComponentStyles("checkbox", { icon: true }, false);
23
+ const labelClassName = useComponentStyles("checkbox", { label: true }, false);
24
+ const reactId = useId();
25
+ const inputId = id || reactId;
26
+ const input$1 = /* @__PURE__ */ jsxs(
27
+ "div",
28
+ {
29
+ className: classnames(container, containerClassName, className),
30
+ children: [
31
+ /* @__PURE__ */ jsx(
32
+ "input",
33
+ {
34
+ ref,
35
+ type: "checkbox",
36
+ name,
37
+ id: inputId,
38
+ className: input,
39
+ ...restProps
40
+ }
41
+ ),
42
+ /* @__PURE__ */ jsx("div", { className: classnames(icon, iconClassName), "aria-hidden": true, children: /* @__PURE__ */ jsx(DefaultIcon, {}) })
43
+ ]
44
+ }
45
+ );
46
+ if (!children) {
47
+ return input$1;
48
+ }
49
+ return /* @__PURE__ */ jsxs("span", { className: labelClassName, children: [
50
+ input$1,
51
+ children && /* @__PURE__ */ jsx(Label, { required, htmlFor: inputId, children })
52
+ ] });
53
+ };
54
+ const DefaultIcon = () => {
55
+ return (
56
+ // TOOD - replace with actual icon component renderer
57
+ /* @__PURE__ */ jsx(
58
+ "svg",
59
+ {
60
+ viewBox: "0 0 24 24",
61
+ fill: "none",
62
+ strokeWidth: "1.5",
63
+ stroke: "currentColor",
64
+ style: { width: "1rem", height: "1rem", display: "block" },
65
+ role: "presentation",
66
+ children: /* @__PURE__ */ jsx(
67
+ "path",
68
+ {
69
+ strokeLinecap: "round",
70
+ strokeLinejoin: "round",
71
+ d: "m4.5 12.75 6 6 9-13.5"
72
+ }
73
+ )
74
+ }
75
+ )
76
+ );
77
+ };
78
+ export {
79
+ Checkbox
80
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { CheckboxProps } from './Checkbox';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ export declare const Default: StoryObj<CheckboxProps>;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const fileScope = require("@vanilla-extract/css/fileScope");
4
+ const blocksCore = require("@blockle/blocks-core");
5
+ const css = require("@vanilla-extract/css");
6
+ fileScope.setFileScope("src/components/form/Checkbox/checkbox.css.ts", "@blockle/blocks-react");
7
+ const container = css.style({
8
+ "@layer": {
9
+ [blocksCore.blocksLayer]: {
10
+ position: "relative",
11
+ cursor: "pointer",
12
+ overflow: "hidden"
13
+ }
14
+ }
15
+ });
16
+ const input = css.style({
17
+ position: "absolute",
18
+ inset: 0,
19
+ opacity: 0,
20
+ "@layer": {
21
+ [blocksCore.blocksLayer]: {
22
+ all: "unset"
23
+ }
24
+ }
25
+ });
26
+ const icon = css.style({
27
+ pointerEvents: "none"
28
+ });
29
+ fileScope.endFileScope();
30
+ exports.container = container;
31
+ exports.icon = icon;
32
+ exports.input = input;
@@ -0,0 +1,3 @@
1
+ export declare const container: string;
2
+ export declare const input: string;
3
+ export declare const icon: string;
@@ -0,0 +1,32 @@
1
+ import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
+ import { blocksLayer } from "@blockle/blocks-core";
3
+ import { style } from "@vanilla-extract/css";
4
+ setFileScope("src/components/form/Checkbox/checkbox.css.ts", "@blockle/blocks-react");
5
+ const container = style({
6
+ "@layer": {
7
+ [blocksLayer]: {
8
+ position: "relative",
9
+ cursor: "pointer",
10
+ overflow: "hidden"
11
+ }
12
+ }
13
+ });
14
+ const input = style({
15
+ position: "absolute",
16
+ inset: 0,
17
+ opacity: 0,
18
+ "@layer": {
19
+ [blocksLayer]: {
20
+ all: "unset"
21
+ }
22
+ }
23
+ });
24
+ const icon = style({
25
+ pointerEvents: "none"
26
+ });
27
+ endFileScope();
28
+ export {
29
+ container,
30
+ icon,
31
+ input
32
+ };
@@ -0,0 +1 @@
1
+ export { Checkbox, type CheckboxProps } from './Checkbox';
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const react = require("react");
6
+ const blocksCore = require("@blockle/blocks-core");
7
+ const input_css = require("./input.css.cjs");
8
+ const useComponentStyles = require("../../../hooks/useComponentStyles/useComponentStyles.cjs");
9
+ const Box = require("../../layout/Box/Box.cjs");
10
+ const Input = ({
11
+ className,
12
+ endSlot,
13
+ name,
14
+ placeholder,
15
+ ref,
16
+ startSlot,
17
+ type = "text",
18
+ ...restProps
19
+ }) => {
20
+ const id = react.useId();
21
+ const containerClassName = useComponentStyles.useComponentStyles(
22
+ "input",
23
+ { container: true },
24
+ false
25
+ );
26
+ const inputClassName = useComponentStyles.useComponentStyles("input", { input: true });
27
+ return /* @__PURE__ */ jsxRuntime.jsx(Box.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(
28
+ Box.Box,
29
+ {
30
+ display: "flex",
31
+ alignItems: "center",
32
+ className: blocksCore.classnames(containerClassName, className),
33
+ children: [
34
+ startSlot,
35
+ /* @__PURE__ */ jsxRuntime.jsx(
36
+ "input",
37
+ {
38
+ id,
39
+ ref,
40
+ name,
41
+ type,
42
+ placeholder,
43
+ className: blocksCore.classnames(input_css.input, inputClassName),
44
+ ...restProps
45
+ }
46
+ ),
47
+ endSlot
48
+ ]
49
+ }
50
+ ) });
51
+ };
52
+ exports.Input = Input;
@@ -0,0 +1,10 @@
1
+ import { HTMLElementProps, OptionalLiteral } from '@blockle/blocks-core';
2
+ export type InputProps = {
3
+ className?: string;
4
+ endSlot?: React.ReactNode;
5
+ name: string;
6
+ ref?: React.Ref<HTMLInputElement>;
7
+ startSlot?: React.ReactNode;
8
+ type?: OptionalLiteral<'email' | 'number' | 'password' | 'tel' | 'text' | 'url'>;
9
+ } & Omit<HTMLElementProps<HTMLInputElement>, 'type'>;
10
+ export declare const Input: React.FC<InputProps>;
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useId } from "react";
4
+ import { classnames } from "@blockle/blocks-core";
5
+ import { input } from "./input.css.js";
6
+ import { useComponentStyles } from "../../../hooks/useComponentStyles/useComponentStyles.js";
7
+ import { Box } from "../../layout/Box/Box.js";
8
+ const Input = ({
9
+ className,
10
+ endSlot,
11
+ name,
12
+ placeholder,
13
+ ref,
14
+ startSlot,
15
+ type = "text",
16
+ ...restProps
17
+ }) => {
18
+ const id = useId();
19
+ const containerClassName = useComponentStyles(
20
+ "input",
21
+ { container: true },
22
+ false
23
+ );
24
+ const inputClassName = useComponentStyles("input", { input: true });
25
+ return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(
26
+ Box,
27
+ {
28
+ display: "flex",
29
+ alignItems: "center",
30
+ className: classnames(containerClassName, className),
31
+ children: [
32
+ startSlot,
33
+ /* @__PURE__ */ jsx(
34
+ "input",
35
+ {
36
+ id,
37
+ ref,
38
+ name,
39
+ type,
40
+ placeholder,
41
+ className: classnames(input, inputClassName),
42
+ ...restProps
43
+ }
44
+ ),
45
+ endSlot
46
+ ]
47
+ }
48
+ ) });
49
+ };
50
+ export {
51
+ Input
52
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { Input, InputProps } from './Input';
3
+ declare const _default: Meta<typeof Input>;
4
+ export default _default;
5
+ export declare const Default: StoryObj<InputProps>;
@@ -0,0 +1 @@
1
+ export { Input, type InputProps } from './Input';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const fileScope = require("@vanilla-extract/css/fileScope");
4
+ const blocksCore = require("@blockle/blocks-core");
5
+ const css = require("@vanilla-extract/css");
6
+ fileScope.setFileScope("src/components/form/Input/input.css.ts", "@blockle/blocks-react");
7
+ const input = css.style({
8
+ "@layer": {
9
+ [blocksCore.blocksLayer]: {
10
+ appearance: "none",
11
+ width: "100%",
12
+ selectors: {
13
+ "&:-webkit-autofill": {
14
+ transitionDelay: "9999s"
15
+ }
16
+ }
17
+ }
18
+ }
19
+ });
20
+ fileScope.endFileScope();
21
+ exports.input = input;
@@ -0,0 +1 @@
1
+ export declare const input: string;
@@ -0,0 +1,21 @@
1
+ import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
+ import { blocksLayer } from "@blockle/blocks-core";
3
+ import { style } from "@vanilla-extract/css";
4
+ setFileScope("src/components/form/Input/input.css.ts", "@blockle/blocks-react");
5
+ const input = style({
6
+ "@layer": {
7
+ [blocksLayer]: {
8
+ appearance: "none",
9
+ width: "100%",
10
+ selectors: {
11
+ "&:-webkit-autofill": {
12
+ transitionDelay: "9999s"
13
+ }
14
+ }
15
+ }
16
+ }
17
+ });
18
+ endFileScope();
19
+ export {
20
+ input
21
+ };
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const blocksCore = require("@blockle/blocks-core");
6
+ const useComponentStyles = require("../../../hooks/useComponentStyles/useComponentStyles.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 = useComponentStyles.useComponentStyles("label", {
18
+ base: true,
19
+ variants: { required, size }
20
+ });
21
+ return /* @__PURE__ */ jsxRuntime.jsx(
22
+ Component,
23
+ {
24
+ className: blocksCore.classnames(
25
+ containerClassName,
26
+ className,
27
+ blocksCore.sprinkles({ cursor })
28
+ ),
29
+ ...restProps,
30
+ children
31
+ }
32
+ );
33
+ };
34
+ exports.Label = Label;
@@ -0,0 +1,18 @@
1
+ import { ComponentThemes, HTMLElementProps, Sprinkles } from '@blockle/blocks-core';
2
+ type LabelTheme = ComponentThemes['label'];
3
+ export type LabelProps = {
4
+ /**
5
+ * If true, the label will be rendered as a span element
6
+ * but will still have the same styles as a label.
7
+ * Useful for when you want to use a label element but
8
+ * can't because of the parent element's structure.
9
+ */
10
+ asSpan?: boolean;
11
+ htmlFor?: string;
12
+ children?: React.ReactNode;
13
+ required?: boolean;
14
+ size?: LabelTheme['variants']['size'];
15
+ cursor?: Sprinkles['cursor'];
16
+ } & HTMLElementProps<HTMLLabelElement>;
17
+ export declare const Label: React.FC<LabelProps>;
18
+ export {};
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { classnames, sprinkles } from "@blockle/blocks-core";
4
+ import { useComponentStyles } from "../../../hooks/useComponentStyles/useComponentStyles.js";
5
+ const Label = ({
6
+ asSpan,
7
+ children,
8
+ className,
9
+ required,
10
+ size,
11
+ cursor,
12
+ ...restProps
13
+ }) => {
14
+ const Component = asSpan ? "span" : "label";
15
+ const containerClassName = useComponentStyles("label", {
16
+ base: true,
17
+ variants: { required, size }
18
+ });
19
+ return /* @__PURE__ */ jsx(
20
+ Component,
21
+ {
22
+ className: classnames(
23
+ containerClassName,
24
+ className,
25
+ sprinkles({ cursor })
26
+ ),
27
+ ...restProps,
28
+ children
29
+ }
30
+ );
31
+ };
32
+ export {
33
+ Label
34
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { LabelProps } from './Label';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ export declare const Default: StoryObj<LabelProps>;
6
+ export declare const WithInput: StoryObj<LabelProps>;
@@ -0,0 +1 @@
1
+ export { Label, type LabelProps } from './Label';
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const blocksCore = require("@blockle/blocks-core");
6
+ const react = require("react");
7
+ const radio_css = require("./radio.css.cjs");
8
+ const useComponentStyles = require("../../../hooks/useComponentStyles/useComponentStyles.cjs");
9
+ const Label = require("../Label/Label.cjs");
10
+ const Radio = ({
11
+ name,
12
+ children,
13
+ className,
14
+ ref,
15
+ ...restProps
16
+ }) => {
17
+ const rid = react.useId();
18
+ const id = restProps.id ?? rid;
19
+ const containerClassName = useComponentStyles.useComponentStyles("radio", { base: true }, false);
20
+ const iconClassName = useComponentStyles.useComponentStyles("radio", { icon: true }, false);
21
+ const labelClassName = useComponentStyles.useComponentStyles("checkbox", { label: true }, false);
22
+ const input = /* @__PURE__ */ jsxRuntime.jsxs(
23
+ "div",
24
+ {
25
+ className: blocksCore.classnames(radio_css.container, containerClassName, className),
26
+ children: [
27
+ /* @__PURE__ */ jsxRuntime.jsx(
28
+ "input",
29
+ {
30
+ ref,
31
+ type: "radio",
32
+ name,
33
+ id,
34
+ className: radio_css.input,
35
+ ...restProps
36
+ }
37
+ ),
38
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: blocksCore.classnames(radio_css.icon, iconClassName) })
39
+ ]
40
+ }
41
+ );
42
+ if (!children) {
43
+ return input;
44
+ }
45
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: id, className: labelClassName, children: [
46
+ input,
47
+ /* @__PURE__ */ jsxRuntime.jsx(Label.Label, { asSpan: true, children })
48
+ ] });
49
+ };
50
+ exports.Radio = Radio;
@@ -0,0 +1,8 @@
1
+ import { HTMLElementProps } from '@blockle/blocks-core';
2
+ export type RadioProps = {
3
+ children?: React.ReactNode;
4
+ name: string;
5
+ ref?: React.Ref<HTMLInputElement>;
6
+ value: string;
7
+ } & HTMLElementProps<HTMLInputElement>;
8
+ export declare const Radio: React.FC<RadioProps>;
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import { classnames } from "@blockle/blocks-core";
4
+ import { useId } from "react";
5
+ import { input, icon, container } from "./radio.css.js";
6
+ import { useComponentStyles } from "../../../hooks/useComponentStyles/useComponentStyles.js";
7
+ import { Label } from "../Label/Label.js";
8
+ const Radio = ({
9
+ name,
10
+ children,
11
+ className,
12
+ ref,
13
+ ...restProps
14
+ }) => {
15
+ const rid = useId();
16
+ const id = restProps.id ?? rid;
17
+ const containerClassName = useComponentStyles("radio", { base: true }, false);
18
+ const iconClassName = useComponentStyles("radio", { icon: true }, false);
19
+ const labelClassName = useComponentStyles("checkbox", { label: true }, false);
20
+ const input$1 = /* @__PURE__ */ jsxs(
21
+ "div",
22
+ {
23
+ className: classnames(container, containerClassName, className),
24
+ children: [
25
+ /* @__PURE__ */ jsx(
26
+ "input",
27
+ {
28
+ ref,
29
+ type: "radio",
30
+ name,
31
+ id,
32
+ className: input,
33
+ ...restProps
34
+ }
35
+ ),
36
+ /* @__PURE__ */ jsx("div", { className: classnames(icon, iconClassName) })
37
+ ]
38
+ }
39
+ );
40
+ if (!children) {
41
+ return input$1;
42
+ }
43
+ return /* @__PURE__ */ jsxs("label", { htmlFor: id, className: labelClassName, children: [
44
+ input$1,
45
+ /* @__PURE__ */ jsx(Label, { asSpan: true, children })
46
+ ] });
47
+ };
48
+ export {
49
+ Radio
50
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { RadioProps } from './Radio';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ export declare const Default: StoryObj<RadioProps>;
6
+ export declare const WithRadioGroup: StoryObj<RadioProps>;
@@ -0,0 +1,8 @@
1
+ export type RadioGroupProps = {
2
+ 'aria-labelledby'?: string;
3
+ children: React.ReactNode;
4
+ className?: string;
5
+ required?: boolean;
6
+ style?: React.CSSProperties;
7
+ };
8
+ export declare const RadioGroup: React.FC<RadioGroupProps>;
@@ -0,0 +1,2 @@
1
+ export { Radio, type RadioProps } from './Radio';
2
+ export { RadioGroup, type RadioGroupProps } from './RadioGroup';