@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.
- package/README.md +25 -0
- package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.cjs +20 -0
- package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.d.ts +6 -0
- package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.js +20 -0
- package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.spec.d.ts +1 -0
- package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
- package/dist/components/accessibility/VisuallyHidden/index.d.ts +1 -0
- package/dist/components/accessibility/VisuallyHidden/visually-hidden.css.cjs +16 -0
- package/dist/components/accessibility/VisuallyHidden/visually-hidden.css.d.ts +1 -0
- package/dist/components/accessibility/VisuallyHidden/visually-hidden.css.js +16 -0
- package/dist/components/display/Divider/Divider.cjs +28 -0
- package/dist/components/display/Divider/Divider.d.ts +7 -0
- package/dist/components/display/Divider/Divider.js +28 -0
- package/dist/components/display/Divider/Divider.spec.d.ts +1 -0
- package/dist/components/display/Divider/Divider.stories.d.ts +6 -0
- package/dist/components/display/Divider/divider.css.cjs +16 -0
- package/dist/components/display/Divider/divider.css.d.ts +1 -0
- package/dist/components/display/Divider/divider.css.js +16 -0
- package/dist/components/display/Divider/index.d.ts +1 -0
- package/dist/components/feedback/Progress/Progress.cjs +55 -0
- package/dist/components/feedback/Progress/Progress.d.ts +16 -0
- package/dist/components/feedback/Progress/Progress.js +55 -0
- package/dist/components/feedback/Progress/Progress.stories.d.ts +5 -0
- package/dist/components/feedback/Progress/index.d.ts +1 -0
- package/dist/components/feedback/Spinner/Spinner.cjs +27 -0
- package/dist/components/feedback/Spinner/Spinner.d.ts +10 -0
- package/dist/components/feedback/Spinner/Spinner.js +27 -0
- package/dist/components/feedback/Spinner/Spinner.stories.d.ts +5 -0
- package/dist/components/feedback/Spinner/index.d.ts +1 -0
- package/dist/components/form/Button/Button.cjs +58 -0
- package/dist/components/form/Button/Button.css.cjs +16 -0
- package/dist/components/form/Button/Button.css.d.ts +1 -0
- package/dist/components/form/Button/Button.css.js +16 -0
- package/dist/components/form/Button/Button.d.ts +21 -0
- package/dist/components/form/Button/Button.js +58 -0
- package/dist/components/form/Button/Button.spec.d.ts +1 -0
- package/dist/components/form/Button/Button.stories.d.ts +7 -0
- package/dist/components/form/Button/index.d.ts +1 -0
- package/dist/components/form/Checkbox/Checkbox.cjs +80 -0
- package/dist/components/form/Checkbox/Checkbox.d.ts +9 -0
- package/dist/components/form/Checkbox/Checkbox.js +80 -0
- package/dist/components/form/Checkbox/Checkbox.spec.d.ts +1 -0
- package/dist/components/form/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/components/form/Checkbox/checkbox.css.cjs +32 -0
- package/dist/components/form/Checkbox/checkbox.css.d.ts +3 -0
- package/dist/components/form/Checkbox/checkbox.css.js +32 -0
- package/dist/components/form/Checkbox/index.d.ts +1 -0
- package/dist/components/form/Input/Input.cjs +52 -0
- package/dist/components/form/Input/Input.d.ts +10 -0
- package/dist/components/form/Input/Input.js +52 -0
- package/dist/components/form/Input/Input.spec.d.ts +1 -0
- package/dist/components/form/Input/Input.stories.d.ts +5 -0
- package/dist/components/form/Input/index.d.ts +1 -0
- package/dist/components/form/Input/input.css.cjs +21 -0
- package/dist/components/form/Input/input.css.d.ts +1 -0
- package/dist/components/form/Input/input.css.js +21 -0
- package/dist/components/form/Label/Label.cjs +34 -0
- package/dist/components/form/Label/Label.d.ts +18 -0
- package/dist/components/form/Label/Label.js +34 -0
- package/dist/components/form/Label/Label.spec.d.ts +1 -0
- package/dist/components/form/Label/Label.stories.d.ts +6 -0
- package/dist/components/form/Label/index.d.ts +1 -0
- package/dist/components/form/Radio/Radio.cjs +50 -0
- package/dist/components/form/Radio/Radio.d.ts +8 -0
- package/dist/components/form/Radio/Radio.js +50 -0
- package/dist/components/form/Radio/Radio.spec.d.ts +1 -0
- package/dist/components/form/Radio/Radio.stories.d.ts +6 -0
- package/dist/components/form/Radio/RadioGroup.d.ts +8 -0
- package/dist/components/form/Radio/index.d.ts +2 -0
- package/dist/components/form/Radio/radio.css.cjs +32 -0
- package/dist/components/form/Radio/radio.css.d.ts +3 -0
- package/dist/components/form/Radio/radio.css.js +32 -0
- package/dist/components/form/Select/Select.cjs +73 -0
- package/dist/components/form/Select/Select.d.ts +11 -0
- package/dist/components/form/Select/Select.js +73 -0
- package/dist/components/form/Select/Select.stories.d.ts +5 -0
- package/dist/components/form/Select/index.d.ts +1 -0
- package/dist/components/form/Select/select.css.cjs +38 -0
- package/dist/components/form/Select/select.css.d.ts +3 -0
- package/dist/components/form/Select/select.css.js +38 -0
- package/dist/components/form/Slider/Slider.cjs +139 -0
- package/dist/components/form/Slider/Slider.d.ts +22 -0
- package/dist/components/form/Slider/Slider.js +139 -0
- package/dist/components/form/Slider/Slider.spec.d.ts +1 -0
- package/dist/components/form/Slider/Slider.stories.d.ts +7 -0
- package/dist/components/form/Slider/index.d.ts +1 -0
- package/dist/components/form/Slider/slider.css.cjs +75 -0
- package/dist/components/form/Slider/slider.css.d.ts +5 -0
- package/dist/components/form/Slider/slider.css.js +75 -0
- package/dist/components/form/Slider/usePointerProgress.cjs +46 -0
- package/dist/components/form/Slider/usePointerProgress.d.ts +11 -0
- package/dist/components/form/Slider/usePointerProgress.js +46 -0
- package/dist/components/form/Switch/Switch.cjs +73 -0
- package/dist/components/form/Switch/Switch.d.ts +6 -0
- package/dist/components/form/Switch/Switch.js +73 -0
- package/dist/components/form/Switch/Switch.stories.d.ts +5 -0
- package/dist/components/form/Switch/index.d.ts +1 -0
- package/dist/components/form/Switch/switch.css.cjs +27 -0
- package/dist/components/form/Switch/switch.css.d.ts +2 -0
- package/dist/components/form/Switch/switch.css.js +27 -0
- package/dist/components/layout/Box/Box.cjs +26 -0
- package/dist/components/layout/Box/Box.d.ts +10 -0
- package/dist/components/layout/Box/Box.js +26 -0
- package/dist/components/layout/Box/Box.spec.d.ts +1 -0
- package/dist/components/layout/Box/Box.stories.d.ts +6 -0
- package/dist/components/layout/Box/index.d.ts +1 -0
- package/dist/components/layout/Inline/Inline.cjs +30 -0
- package/dist/components/layout/Inline/Inline.d.ts +12 -0
- package/dist/components/layout/Inline/Inline.js +30 -0
- package/dist/components/layout/Inline/Inline.stories.d.ts +6 -0
- package/dist/components/layout/Inline/index.d.ts +1 -0
- package/dist/components/layout/Stack/Stack.cjs +27 -0
- package/dist/components/layout/Stack/Stack.d.ts +16 -0
- package/dist/components/layout/Stack/Stack.js +27 -0
- package/dist/components/layout/Stack/Stack.stories.d.ts +6 -0
- package/dist/components/layout/Stack/index.d.ts +1 -0
- package/dist/components/navigation/Link/Link.cjs +33 -0
- package/dist/components/navigation/Link/Link.d.ts +11 -0
- package/dist/components/navigation/Link/Link.js +33 -0
- package/dist/components/navigation/Link/Link.stories.d.ts +6 -0
- package/dist/components/navigation/Link/Link.test.d.ts +1 -0
- package/dist/components/navigation/Link/index.d.ts +1 -0
- package/dist/components/overlay/Dialog/Dialog.cjs +81 -0
- package/dist/components/overlay/Dialog/Dialog.d.ts +12 -0
- package/dist/components/overlay/Dialog/Dialog.js +81 -0
- package/dist/components/overlay/Dialog/Dialog.stories.d.ts +7 -0
- package/dist/components/overlay/Dialog/Dialog.test.d.ts +1 -0
- package/dist/components/overlay/Dialog/dialog.css.cjs +22 -0
- package/dist/components/overlay/Dialog/dialog.css.d.ts +1 -0
- package/dist/components/overlay/Dialog/dialog.css.js +22 -0
- package/dist/components/overlay/Dialog/dialogHelper.cjs +21 -0
- package/dist/components/overlay/Dialog/dialogHelper.d.ts +6 -0
- package/dist/components/overlay/Dialog/dialogHelper.js +21 -0
- package/dist/components/overlay/Dialog/index.d.ts +1 -0
- package/dist/components/overlay/Popover/Popover.cjs +112 -0
- package/dist/components/overlay/Popover/Popover.d.ts +12 -0
- package/dist/components/overlay/Popover/Popover.js +112 -0
- package/dist/components/overlay/Popover/Popover.stories.d.ts +5 -0
- package/dist/components/overlay/Popover/index.d.ts +1 -0
- package/dist/components/overlay/Popover/popover-utils.cjs +62 -0
- package/dist/components/overlay/Popover/popover-utils.d.ts +2 -0
- package/dist/components/overlay/Popover/popover-utils.js +62 -0
- package/dist/components/overlay/Portal/Portal.cjs +15 -0
- package/dist/components/overlay/Portal/Portal.d.ts +5 -0
- package/dist/components/overlay/Portal/Portal.js +15 -0
- package/dist/components/overlay/Portal/index.d.ts +1 -0
- package/dist/components/overlay/Tooltip/Tooltip.cjs +73 -0
- package/dist/components/overlay/Tooltip/Tooltip.d.ts +12 -0
- package/dist/components/overlay/Tooltip/Tooltip.js +73 -0
- package/dist/components/overlay/Tooltip/Tooltip.stories.d.ts +5 -0
- package/dist/components/overlay/Tooltip/index.d.ts +1 -0
- package/dist/components/providers/BlocksProvider/BlocksProvider.cjs +35 -0
- package/dist/components/providers/BlocksProvider/BlocksProvider.d.ts +9 -0
- package/dist/components/providers/BlocksProvider/BlocksProvider.js +35 -0
- package/dist/components/providers/BlocksProvider/BlocksProvider.test.d.ts +1 -0
- package/dist/components/providers/BlocksProvider/context.cjs +5 -0
- package/dist/components/providers/BlocksProvider/context.d.ts +5 -0
- package/dist/components/providers/BlocksProvider/context.js +5 -0
- package/dist/components/providers/BlocksProvider/index.d.ts +2 -0
- package/dist/components/typography/Heading/Heading.cjs +24 -0
- package/dist/components/typography/Heading/Heading.d.ts +7 -0
- package/dist/components/typography/Heading/Heading.js +24 -0
- package/dist/components/typography/Heading/Heading.test.d.ts +1 -0
- package/dist/components/typography/Heading/heading.css.cjs +16 -0
- package/dist/components/typography/Heading/heading.css.d.ts +1 -0
- package/dist/components/typography/Heading/heading.css.js +16 -0
- package/dist/components/typography/Heading/heading.stories.d.ts +12 -0
- package/dist/components/typography/Heading/index.d.ts +1 -0
- package/dist/components/typography/Text/Text.cjs +21 -0
- package/dist/components/typography/Text/Text.d.ts +11 -0
- package/dist/components/typography/Text/Text.js +21 -0
- package/dist/components/typography/Text/Text.stories.d.ts +5 -0
- package/dist/components/typography/Text/Text.test.d.ts +1 -0
- package/dist/components/typography/Text/index.d.ts +1 -0
- package/dist/components/typography/Text/text.css.cjs +16 -0
- package/dist/components/typography/Text/text.css.d.ts +1 -0
- package/dist/components/typography/Text/text.css.js +16 -0
- package/dist/hooks/useClickOutside/useClickOutside.cjs +23 -0
- package/dist/hooks/useClickOutside/useClickOutside.d.ts +6 -0
- package/dist/hooks/useClickOutside/useClickOutside.js +23 -0
- package/dist/hooks/useComponentStyles/index.d.ts +2 -0
- package/dist/hooks/useComponentStyles/useComponentStyleDefaultProps.cjs +12 -0
- package/dist/hooks/useComponentStyles/useComponentStyleDefaultProps.d.ts +7 -0
- package/dist/hooks/useComponentStyles/useComponentStyleDefaultProps.js +12 -0
- package/dist/hooks/useComponentStyles/useComponentStyles.cjs +74 -0
- package/dist/hooks/useComponentStyles/useComponentStyles.d.ts +2 -0
- package/dist/hooks/useComponentStyles/useComponentStyles.js +74 -0
- package/dist/hooks/useControlledValue/index.d.ts +1 -0
- package/dist/hooks/useControlledValue/useControlledValue.cjs +33 -0
- package/dist/hooks/useControlledValue/useControlledValue.d.ts +8 -0
- package/dist/hooks/useControlledValue/useControlledValue.js +33 -0
- package/dist/hooks/useIsomorphicLayoutEffect/index.d.ts +1 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs +6 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +5 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +6 -0
- package/dist/hooks/useKeyboard/index.d.ts +1 -0
- package/dist/hooks/useKeyboard/useKeyboard.cjs +21 -0
- package/dist/hooks/useKeyboard/useKeyboard.d.ts +6 -0
- package/dist/hooks/useKeyboard/useKeyboard.js +21 -0
- package/dist/hooks/useLayer/index.d.ts +1 -0
- package/dist/hooks/useLayer/useLayer.cjs +27 -0
- package/dist/hooks/useLayer/useLayer.d.ts +1 -0
- package/dist/hooks/useLayer/useLayer.js +27 -0
- package/dist/hooks/usePreventBodyScroll/index.d.ts +1 -0
- package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.cjs +31 -0
- package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.d.ts +1 -0
- package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.js +31 -0
- package/dist/hooks/useRestoreFocus/index.d.ts +1 -0
- package/dist/hooks/useRestoreFocus/useRestoreFocus.cjs +19 -0
- package/dist/hooks/useRestoreFocus/useRestoreFocus.d.ts +4 -0
- package/dist/hooks/useRestoreFocus/useRestoreFocus.js +19 -0
- package/dist/hooks/useTheme/index.d.ts +1 -0
- package/dist/hooks/useTheme/useTheme.cjs +13 -0
- package/dist/hooks/useTheme/useTheme.d.ts +2 -0
- package/dist/hooks/useTheme/useTheme.js +13 -0
- package/dist/hooks/useVisibilityState/index.d.ts +1 -0
- package/dist/hooks/useVisibilityState/useVisibilityState.cjs +17 -0
- package/dist/hooks/useVisibilityState/useVisibilityState.d.ts +3 -0
- package/dist/hooks/useVisibilityState/useVisibilityState.js +17 -0
- package/dist/index.cjs +58 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +58 -0
- 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,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,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 @@
|
|
|
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 @@
|
|
|
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 {};
|