@regardio/react 0.5.7 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/background-slideshow/index.d.mts +34 -0
- package/dist/background-slideshow/index.mjs +110 -0
- package/dist/blurry-gradient/index.d.mts +16 -0
- package/dist/blurry-gradient/index.mjs +93 -0
- package/dist/button/index.d.mts +2 -0
- package/dist/button/index.mjs +3 -0
- package/dist/button-BiSQpBbc.mjs +129 -0
- package/dist/carousel/index.d.mts +74 -0
- package/dist/carousel/index.mjs +136 -0
- package/dist/checkbox/index.d.mts +28 -0
- package/dist/checkbox/index.mjs +70 -0
- package/dist/checkbox-group/index.d.mts +16 -0
- package/dist/checkbox-group/index.mjs +29 -0
- package/dist/chunk-BTpB_u-K.mjs +18 -0
- package/dist/countdown/index.d.mts +4 -0
- package/dist/countdown/index.mjs +58 -0
- package/dist/field/index.d.mts +68 -0
- package/dist/field/index.mjs +115 -0
- package/dist/fieldset/index.d.mts +34 -0
- package/dist/fieldset/index.mjs +61 -0
- package/dist/form/index.d.mts +21 -0
- package/dist/form/index.mjs +31 -0
- package/dist/generic-error/index.d.mts +44 -0
- package/dist/generic-error/index.mjs +57 -0
- package/dist/grid/index.d.mts +101 -0
- package/dist/grid/index.mjs +219 -0
- package/dist/heading/index.d.mts +27 -0
- package/dist/heading/index.mjs +28 -0
- package/dist/highlight/index.d.mts +17 -0
- package/dist/highlight/index.mjs +35 -0
- package/dist/hooks/use-current-route-data.d.mts +8 -0
- package/dist/hooks/use-current-route-data.mjs +22 -0
- package/dist/hooks/{use-focus-search.d.ts → use-focus-search.d.mts} +4 -3
- package/dist/hooks/use-focus-search.mjs +23 -0
- package/dist/hooks/use-matches-data.d.mts +10 -0
- package/dist/hooks/use-matches-data.mjs +23 -0
- package/dist/hooks/use-media-query.d.mts +9 -0
- package/dist/hooks/use-media-query.mjs +28 -0
- package/dist/hooks/use-mobile.d.mts +4 -0
- package/dist/hooks/use-mobile.mjs +22 -0
- package/dist/hooks/use-nonce.d.mts +6 -0
- package/dist/hooks/use-nonce.mjs +13 -0
- package/dist/hooks/use-orientation.d.mts +12 -0
- package/dist/hooks/use-orientation.mjs +32 -0
- package/dist/hooks/use-user.d.mts +53 -0
- package/dist/hooks/use-user.mjs +39 -0
- package/dist/icon-button/index.d.mts +28 -0
- package/dist/icon-button/index.mjs +36 -0
- package/dist/if/index.d.mts +13 -0
- package/dist/if/index.mjs +21 -0
- package/dist/iframe/index.d.mts +11 -0
- package/dist/iframe/index.mjs +15 -0
- package/dist/index-Bj5_XfEC.d.mts +29 -0
- package/dist/index-C_evL5vG.d.mts +35 -0
- package/dist/input/index.d.mts +2 -0
- package/dist/input/index.mjs +3 -0
- package/dist/input-CtR6aRVi.mjs +73 -0
- package/dist/link/index.d.mts +71 -0
- package/dist/link/index.mjs +129 -0
- package/dist/list/index.d.mts +72 -0
- package/dist/list/index.mjs +54 -0
- package/dist/markdown-container/index.d.mts +23 -0
- package/dist/markdown-container/index.mjs +71 -0
- package/dist/password-input/index.d.mts +23 -0
- package/dist/password-input/index.mjs +92 -0
- package/dist/picture/index.d.mts +39 -0
- package/dist/picture/index.mjs +3 -0
- package/dist/picture-DkX3W5zl.mjs +69 -0
- package/dist/protected-email/index.d.mts +24 -0
- package/dist/protected-email/index.mjs +37 -0
- package/dist/radio/index.d.mts +28 -0
- package/dist/radio/index.mjs +72 -0
- package/dist/radio-group/index.d.mts +16 -0
- package/dist/radio-group/index.mjs +29 -0
- package/dist/slider/index.d.mts +63 -0
- package/dist/slider/index.mjs +133 -0
- package/dist/switch/index.d.mts +29 -0
- package/dist/switch/index.mjs +87 -0
- package/dist/text/index.d.mts +25 -0
- package/dist/text/index.mjs +32 -0
- package/dist/text-EQC4zJbE.mjs +52 -0
- package/dist/toggle/index.d.mts +25 -0
- package/dist/toggle/index.mjs +82 -0
- package/dist/utils/author/index.d.mts +4 -0
- package/dist/utils/author/index.mjs +26 -0
- package/dist/utils/text/{index.d.ts → index.d.mts} +9 -8
- package/dist/utils/text/index.mjs +3 -0
- package/package.json +131 -83
- package/src/background-slideshow/background-slideshow.tsx +1 -2
- package/src/blurry-gradient/blurry-gradient.tsx +1 -1
- package/src/button/button.stories.tsx +161 -0
- package/src/button/button.test.tsx +73 -0
- package/src/button/button.tsx +118 -0
- package/src/button/index.ts +2 -0
- package/src/carousel/carousel-content.tsx +17 -14
- package/src/carousel/carousel-item.tsx +18 -18
- package/src/carousel/carousel-next.tsx +22 -17
- package/src/carousel/carousel-previous.tsx +22 -17
- package/src/carousel/carousel-root.tsx +91 -86
- package/src/checkbox/checkbox.stories.tsx +118 -0
- package/src/checkbox/checkbox.tsx +102 -0
- package/src/checkbox/index.ts +2 -0
- package/src/checkbox-group/checkbox-group.tsx +40 -0
- package/src/checkbox-group/index.ts +2 -0
- package/src/countdown/countdown.tsx +1 -1
- package/src/field/field.stories.tsx +105 -0
- package/src/field/field.test.tsx +61 -0
- package/src/field/field.tsx +186 -0
- package/src/field/index.ts +12 -0
- package/src/fieldset/fieldset.stories.tsx +204 -0
- package/src/fieldset/fieldset.test.tsx +63 -0
- package/src/fieldset/fieldset.tsx +86 -0
- package/src/fieldset/index.ts +7 -0
- package/src/form/form.stories.tsx +230 -0
- package/src/form/form.test.tsx +68 -0
- package/src/form/form.tsx +38 -0
- package/src/form/index.ts +2 -0
- package/src/generic-error/generic-error.tsx +2 -3
- package/src/grid/grid-item.tsx +77 -36
- package/src/grid/grid-root.tsx +49 -22
- package/src/heading/heading.tsx +7 -3
- package/src/highlight/highlight.tsx +1 -1
- package/src/hooks/use-current-route-data.ts +4 -2
- package/src/hooks/use-focus-search.ts +3 -1
- package/src/hooks/use-matches-data.ts +2 -0
- package/src/hooks/use-media-query.ts +2 -0
- package/src/hooks/use-mobile.ts +3 -1
- package/src/hooks/use-nonce.ts +3 -3
- package/src/hooks/use-orientation.ts +2 -0
- package/src/hooks/use-user.tsx +3 -2
- package/src/icon-button/icon-button.stories.tsx +128 -7
- package/src/icon-button/icon-button.test.tsx +152 -0
- package/src/icon-button/icon-button.tsx +43 -9
- package/src/if/if.tsx +3 -1
- package/src/input/index.ts +2 -0
- package/src/input/input.stories.tsx +151 -0
- package/src/input/input.test.tsx +65 -0
- package/src/input/input.tsx +113 -0
- package/src/link/link.tsx +4 -3
- package/src/list/list-item.tsx +10 -13
- package/src/list/list-root-context.ts +3 -3
- package/src/list/list-root.tsx +10 -13
- package/src/password-input/index.ts +1 -1
- package/src/password-input/password-input.tsx +104 -27
- package/src/protected-email/protected-email.tsx +6 -1
- package/src/radio/index.ts +2 -0
- package/src/radio/radio.tsx +103 -0
- package/src/radio-group/index.ts +2 -0
- package/src/radio-group/radio-group.tsx +40 -0
- package/src/slider/index.ts +18 -0
- package/src/slider/slider.tsx +201 -0
- package/src/switch/index.ts +2 -0
- package/src/switch/switch.stories.tsx +118 -0
- package/src/switch/switch.tsx +112 -0
- package/src/text/text.tsx +6 -1
- package/src/toggle/index.ts +2 -0
- package/src/toggle/toggle.stories.tsx +232 -0
- package/src/toggle/toggle.test.tsx +149 -0
- package/src/toggle/toggle.tsx +88 -0
- package/src/utils/text/text.tsx +8 -16
- package/dist/background-slideshow/index.d.ts +0 -24
- package/dist/background-slideshow/index.js +0 -165
- package/dist/blurry-gradient/index.d.ts +0 -16
- package/dist/blurry-gradient/index.js +0 -128
- package/dist/carousel/index.d.ts +0 -36
- package/dist/carousel/index.js +0 -171
- package/dist/countdown/index.d.ts +0 -5
- package/dist/countdown/index.js +0 -73
- package/dist/generic-error/index.d.ts +0 -43
- package/dist/generic-error/index.js +0 -47
- package/dist/grid/index.d.ts +0 -1196
- package/dist/grid/index.js +0 -239
- package/dist/heading/index.d.ts +0 -24
- package/dist/heading/index.js +0 -99
- package/dist/highlight/index.d.ts +0 -13
- package/dist/highlight/index.js +0 -59
- package/dist/hooks/use-current-route-data.d.ts +0 -7
- package/dist/hooks/use-current-route-data.js +0 -16
- package/dist/hooks/use-focus-search.js +0 -19
- package/dist/hooks/use-matches-data.d.ts +0 -9
- package/dist/hooks/use-matches-data.js +0 -15
- package/dist/hooks/use-media-query.d.ts +0 -8
- package/dist/hooks/use-media-query.js +0 -20
- package/dist/hooks/use-mobile.d.ts +0 -3
- package/dist/hooks/use-mobile.js +0 -19
- package/dist/hooks/use-nonce.d.ts +0 -7
- package/dist/hooks/use-nonce.js +0 -8
- package/dist/hooks/use-orientation.d.ts +0 -11
- package/dist/hooks/use-orientation.js +0 -29
- package/dist/hooks/use-user.d.ts +0 -50
- package/dist/hooks/use-user.js +0 -25
- package/dist/icon-button/index.d.ts +0 -9
- package/dist/icon-button/index.js +0 -17
- package/dist/if/index.d.ts +0 -10
- package/dist/if/index.js +0 -24
- package/dist/iframe/index.d.ts +0 -10
- package/dist/iframe/index.js +0 -17
- package/dist/link/index.d.ts +0 -55
- package/dist/link/index.js +0 -195
- package/dist/list/index.d.ts +0 -69
- package/dist/list/index.js +0 -65
- package/dist/markdown-container/index.d.ts +0 -22
- package/dist/markdown-container/index.js +0 -128
- package/dist/password-input/index.d.ts +0 -11
- package/dist/password-input/index.js +0 -46
- package/dist/picture/index.d.ts +0 -38
- package/dist/picture/index.js +0 -68
- package/dist/protected-email/index.d.ts +0 -20
- package/dist/protected-email/index.js +0 -30
- package/dist/text/index.d.ts +0 -20
- package/dist/text/index.js +0 -38
- package/dist/utils/author/index.d.ts +0 -3
- package/dist/utils/author/index.js +0 -33
- package/dist/utils/text/index.js +0 -73
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { CheckboxGroup as CheckboxGroup$1 } from "@base-ui/react/checkbox-group";
|
|
3
|
+
|
|
4
|
+
//#region src/checkbox-group/checkbox-group.d.ts
|
|
5
|
+
type CheckboxGroupOrientation = "horizontal" | "vertical";
|
|
6
|
+
interface CheckboxGroupProps extends Omit<ComponentProps<typeof CheckboxGroup$1>, "className"> {
|
|
7
|
+
className?: string;
|
|
8
|
+
orientation?: CheckboxGroupOrientation;
|
|
9
|
+
}
|
|
10
|
+
declare const CheckboxGroup: ({
|
|
11
|
+
className,
|
|
12
|
+
orientation,
|
|
13
|
+
...props
|
|
14
|
+
}: CheckboxGroupProps) => React.JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { CheckboxGroup, type CheckboxGroupOrientation, type CheckboxGroupProps };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { tv } from "@regardio/tailwind/utils";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { CheckboxGroup as CheckboxGroup$1 } from "@base-ui/react/checkbox-group";
|
|
4
|
+
|
|
5
|
+
//#region src/checkbox-group/checkbox-group.tsx
|
|
6
|
+
const checkboxGroup = tv({
|
|
7
|
+
base: [
|
|
8
|
+
"flex",
|
|
9
|
+
"flex-col",
|
|
10
|
+
"gap-2"
|
|
11
|
+
],
|
|
12
|
+
defaultVariants: { orientation: "vertical" },
|
|
13
|
+
variants: { orientation: {
|
|
14
|
+
horizontal: ["flex-row", "gap-4"],
|
|
15
|
+
vertical: ["flex-col", "gap-2"]
|
|
16
|
+
} }
|
|
17
|
+
});
|
|
18
|
+
const CheckboxGroup = ({ className, orientation = "vertical", ...props }) => {
|
|
19
|
+
return /* @__PURE__ */ jsx(CheckboxGroup$1, {
|
|
20
|
+
className: checkboxGroup({
|
|
21
|
+
className,
|
|
22
|
+
orientation
|
|
23
|
+
}),
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { CheckboxGroup };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) {
|
|
6
|
+
__defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
if (symbols) {
|
|
12
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { __exportAll as t };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { cn } from "@regardio/tailwind/utils";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/countdown/countdown.tsx
|
|
6
|
+
function Countdown() {
|
|
7
|
+
const [timerValue, setTimerValue] = useState(0);
|
|
8
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
setIsMounted(true);
|
|
11
|
+
const intervalId = setInterval(() => {
|
|
12
|
+
setTimerValue((prevValue) => {
|
|
13
|
+
return prevValue + 1;
|
|
14
|
+
});
|
|
15
|
+
}, 1e3);
|
|
16
|
+
return () => {
|
|
17
|
+
return clearInterval(intervalId);
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: cn("before:absolute", "before:bg-white", "before:content-[\"\"]", "before:h-[180px]", "before:rounded-full", "before:w-[180px]", "flex", "h-[240px]", "items-center", "justify-center", "relative", "rounded-full", "w-[240px]"),
|
|
22
|
+
style: { background: `conic-gradient(
|
|
23
|
+
transparent ${6 * (isMounted ? timerValue : 0)}deg,
|
|
24
|
+
hsl(var(--red-500)) 0deg,
|
|
25
|
+
hsl(var(--red-500)) 15deg,
|
|
26
|
+
hsl(var(--coral-500)) 15deg,
|
|
27
|
+
hsl(var(--coral-500)) 45deg,
|
|
28
|
+
hsl(var(--orange-500)) 45deg,
|
|
29
|
+
hsl(var(--orange-500)) 75deg,
|
|
30
|
+
hsl(var(--yellow-500)) 75deg,
|
|
31
|
+
hsl(var(--yellow-500)) 105deg,
|
|
32
|
+
hsl(var(--olive-500)) 105deg,
|
|
33
|
+
hsl(var(--olive-500)) 135deg,
|
|
34
|
+
hsl(var(--lime-500)) 135deg,
|
|
35
|
+
hsl(var(--lime-500)) 165deg,
|
|
36
|
+
hsl(var(--green-500)) 165deg,
|
|
37
|
+
hsl(var(--green-500)) 195deg,
|
|
38
|
+
hsl(var(--teal-500)) 195deg,
|
|
39
|
+
hsl(var(--teal-500)) 225deg,
|
|
40
|
+
hsl(var(--cyan-500)) 225deg,
|
|
41
|
+
hsl(var(--cyan-500)) 255deg,
|
|
42
|
+
hsl(var(--blue-500)) 255deg,
|
|
43
|
+
hsl(var(--blue-500)) 285deg,
|
|
44
|
+
hsl(var(--purple-500)) 285deg,
|
|
45
|
+
hsl(var(--purple-500)) 315deg,
|
|
46
|
+
hsl(var(--pink-500)) 315deg,
|
|
47
|
+
hsl(var(--pink-500)) 345deg,
|
|
48
|
+
hsl(var(--red-500)) 345deg
|
|
49
|
+
)` },
|
|
50
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
51
|
+
className: cn("text-foreground", "relative", "text-3xl", "font-bold"),
|
|
52
|
+
children: isMounted ? timerValue < 10 ? `0${timerValue}` : timerValue : 0
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { Countdown };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { Field as Field$1 } from "@base-ui/react/field";
|
|
3
|
+
|
|
4
|
+
//#region src/field/field.d.ts
|
|
5
|
+
declare const fieldRootVariants: {
|
|
6
|
+
readonly default: readonly [];
|
|
7
|
+
readonly required: readonly ["after:content-[\"*\"]", "after:ml-1", "after:text-red-500"];
|
|
8
|
+
};
|
|
9
|
+
type FieldRootVariant = keyof typeof fieldRootVariants;
|
|
10
|
+
type FieldLabelVariant = "default" | "error";
|
|
11
|
+
type FieldDescriptionVariant = "default" | "error";
|
|
12
|
+
type FieldItemLayout = "default" | "horizontal";
|
|
13
|
+
interface FieldRootProps extends Omit<ComponentProps<typeof Field$1.Root>, "className"> {
|
|
14
|
+
className?: string;
|
|
15
|
+
variant?: FieldRootVariant;
|
|
16
|
+
}
|
|
17
|
+
interface FieldLabelProps extends Omit<ComponentProps<typeof Field$1.Label>, "className"> {
|
|
18
|
+
className?: string;
|
|
19
|
+
variant?: FieldLabelVariant;
|
|
20
|
+
}
|
|
21
|
+
interface FieldDescriptionProps extends Omit<ComponentProps<typeof Field$1.Description>, "className"> {
|
|
22
|
+
className?: string;
|
|
23
|
+
variant?: FieldDescriptionVariant;
|
|
24
|
+
}
|
|
25
|
+
interface FieldErrorProps extends Omit<ComponentProps<typeof Field$1.Error>, "className"> {
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
interface FieldItemProps extends ComponentProps<"div"> {
|
|
29
|
+
className?: string;
|
|
30
|
+
layout?: FieldItemLayout;
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
declare const FieldRoot: ({
|
|
34
|
+
className,
|
|
35
|
+
variant,
|
|
36
|
+
...props
|
|
37
|
+
}: FieldRootProps) => React.JSX.Element;
|
|
38
|
+
declare const FieldLabel: ({
|
|
39
|
+
className,
|
|
40
|
+
variant,
|
|
41
|
+
...props
|
|
42
|
+
}: FieldLabelProps) => React.JSX.Element;
|
|
43
|
+
declare const FieldDescription: ({
|
|
44
|
+
className,
|
|
45
|
+
variant,
|
|
46
|
+
...props
|
|
47
|
+
}: FieldDescriptionProps) => React.JSX.Element;
|
|
48
|
+
declare const FieldError: ({
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
51
|
+
}: FieldErrorProps) => React.JSX.Element;
|
|
52
|
+
declare const FieldItem: ({
|
|
53
|
+
className,
|
|
54
|
+
layout,
|
|
55
|
+
children,
|
|
56
|
+
...props
|
|
57
|
+
}: FieldItemProps) => React.JSX.Element;
|
|
58
|
+
declare const Field: {
|
|
59
|
+
Control: typeof Field$1.Control;
|
|
60
|
+
Description: typeof FieldDescription;
|
|
61
|
+
Error: typeof FieldError;
|
|
62
|
+
Item: typeof FieldItem;
|
|
63
|
+
Label: typeof FieldLabel;
|
|
64
|
+
Root: typeof FieldRoot;
|
|
65
|
+
Validity: typeof Field$1.Validity;
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { Field, type FieldDescriptionProps, type FieldDescriptionVariant, type FieldErrorProps, type FieldItemLayout, type FieldItemProps, type FieldLabelProps, type FieldLabelVariant, type FieldRootProps, type FieldRootVariant };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { tv } from "@regardio/tailwind/utils";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Field as Field$1 } from "@base-ui/react/field";
|
|
4
|
+
|
|
5
|
+
//#region src/field/field.tsx
|
|
6
|
+
const fieldRoot = tv({
|
|
7
|
+
base: ["space-y-1"],
|
|
8
|
+
defaultVariants: { variant: "default" },
|
|
9
|
+
variants: { variant: {
|
|
10
|
+
default: [],
|
|
11
|
+
required: [
|
|
12
|
+
"after:content-[\"*\"]",
|
|
13
|
+
"after:ml-1",
|
|
14
|
+
"after:text-red-500"
|
|
15
|
+
]
|
|
16
|
+
} }
|
|
17
|
+
});
|
|
18
|
+
const fieldLabel = tv({
|
|
19
|
+
base: [
|
|
20
|
+
"block",
|
|
21
|
+
"text-sm",
|
|
22
|
+
"font-medium",
|
|
23
|
+
"text-gray-700",
|
|
24
|
+
"mb-1"
|
|
25
|
+
],
|
|
26
|
+
defaultVariants: { variant: "default" },
|
|
27
|
+
variants: { variant: {
|
|
28
|
+
default: [],
|
|
29
|
+
error: ["text-red-600"]
|
|
30
|
+
} }
|
|
31
|
+
});
|
|
32
|
+
const fieldDescription = tv({
|
|
33
|
+
base: [
|
|
34
|
+
"text-sm",
|
|
35
|
+
"text-gray-500",
|
|
36
|
+
"mt-1"
|
|
37
|
+
],
|
|
38
|
+
defaultVariants: { variant: "default" },
|
|
39
|
+
variants: { variant: {
|
|
40
|
+
default: [],
|
|
41
|
+
error: ["text-red-600"]
|
|
42
|
+
} }
|
|
43
|
+
});
|
|
44
|
+
const fieldError = tv({ base: [
|
|
45
|
+
"text-sm",
|
|
46
|
+
"text-red-600",
|
|
47
|
+
"mt-1"
|
|
48
|
+
] });
|
|
49
|
+
const fieldItem = tv({
|
|
50
|
+
base: ["flex", "flex-col"],
|
|
51
|
+
defaultVariants: { layout: "default" },
|
|
52
|
+
variants: { layout: {
|
|
53
|
+
default: [],
|
|
54
|
+
horizontal: [
|
|
55
|
+
"flex-row",
|
|
56
|
+
"items-center",
|
|
57
|
+
"gap-2"
|
|
58
|
+
]
|
|
59
|
+
} }
|
|
60
|
+
});
|
|
61
|
+
const FieldRoot = ({ className, variant, ...props }) => {
|
|
62
|
+
return /* @__PURE__ */ jsx(Field$1.Root, {
|
|
63
|
+
className: fieldRoot({
|
|
64
|
+
className,
|
|
65
|
+
variant
|
|
66
|
+
}),
|
|
67
|
+
...props
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const FieldLabel = ({ className, variant, ...props }) => {
|
|
71
|
+
return /* @__PURE__ */ jsx(Field$1.Label, {
|
|
72
|
+
className: fieldLabel({
|
|
73
|
+
className,
|
|
74
|
+
variant
|
|
75
|
+
}),
|
|
76
|
+
...props
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const FieldDescription = ({ className, variant, ...props }) => {
|
|
80
|
+
return /* @__PURE__ */ jsx(Field$1.Description, {
|
|
81
|
+
className: fieldDescription({
|
|
82
|
+
className,
|
|
83
|
+
variant
|
|
84
|
+
}),
|
|
85
|
+
...props
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
const FieldError = ({ className, ...props }) => {
|
|
89
|
+
return /* @__PURE__ */ jsx(Field$1.Error, {
|
|
90
|
+
className: fieldError({ className }),
|
|
91
|
+
...props
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
const FieldItem = ({ className, layout, children, ...props }) => {
|
|
95
|
+
return /* @__PURE__ */ jsx("div", {
|
|
96
|
+
className: fieldItem({
|
|
97
|
+
className,
|
|
98
|
+
layout
|
|
99
|
+
}),
|
|
100
|
+
...props,
|
|
101
|
+
children
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
const Field = {
|
|
105
|
+
Control: Field$1.Control,
|
|
106
|
+
Description: FieldDescription,
|
|
107
|
+
Error: FieldError,
|
|
108
|
+
Item: FieldItem,
|
|
109
|
+
Label: FieldLabel,
|
|
110
|
+
Root: FieldRoot,
|
|
111
|
+
Validity: Field$1.Validity
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
export { Field };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { Fieldset as Fieldset$1 } from "@base-ui/react/fieldset";
|
|
3
|
+
|
|
4
|
+
//#region src/fieldset/fieldset.d.ts
|
|
5
|
+
declare const fieldsetRootVariants: {
|
|
6
|
+
readonly compact: readonly ["space-y-2"];
|
|
7
|
+
readonly default: readonly ["space-y-4"];
|
|
8
|
+
};
|
|
9
|
+
type FieldsetRootVariant = keyof typeof fieldsetRootVariants;
|
|
10
|
+
type FieldsetLegendSize = "default" | "small";
|
|
11
|
+
interface FieldsetRootProps extends Omit<ComponentProps<typeof Fieldset$1.Root>, "className"> {
|
|
12
|
+
className?: string;
|
|
13
|
+
variant?: FieldsetRootVariant;
|
|
14
|
+
}
|
|
15
|
+
interface FieldsetLegendProps extends Omit<ComponentProps<typeof Fieldset$1.Legend>, "className"> {
|
|
16
|
+
className?: string;
|
|
17
|
+
size?: FieldsetLegendSize;
|
|
18
|
+
}
|
|
19
|
+
declare const FieldsetRoot: ({
|
|
20
|
+
className,
|
|
21
|
+
variant,
|
|
22
|
+
...props
|
|
23
|
+
}: FieldsetRootProps) => React.JSX.Element;
|
|
24
|
+
declare const FieldsetLegend: ({
|
|
25
|
+
className,
|
|
26
|
+
size,
|
|
27
|
+
...props
|
|
28
|
+
}: FieldsetLegendProps) => React.JSX.Element;
|
|
29
|
+
declare const Fieldset: {
|
|
30
|
+
Legend: typeof FieldsetLegend;
|
|
31
|
+
Root: typeof FieldsetRoot;
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { Fieldset, type FieldsetLegendProps, type FieldsetLegendSize, type FieldsetRootProps, type FieldsetRootVariant };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { tv } from "@regardio/tailwind/utils";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Fieldset as Fieldset$1 } from "@base-ui/react/fieldset";
|
|
4
|
+
|
|
5
|
+
//#region src/fieldset/fieldset.tsx
|
|
6
|
+
const fieldsetRoot = tv({
|
|
7
|
+
base: [
|
|
8
|
+
"border",
|
|
9
|
+
"border-gray-200",
|
|
10
|
+
"rounded-lg",
|
|
11
|
+
"p-4"
|
|
12
|
+
],
|
|
13
|
+
defaultVariants: { variant: "default" },
|
|
14
|
+
variants: { variant: {
|
|
15
|
+
compact: ["space-y-2"],
|
|
16
|
+
default: ["space-y-4"]
|
|
17
|
+
} }
|
|
18
|
+
});
|
|
19
|
+
const fieldsetLegend = tv({
|
|
20
|
+
base: [
|
|
21
|
+
"text-lg",
|
|
22
|
+
"font-semibold",
|
|
23
|
+
"text-gray-900",
|
|
24
|
+
"mb-2"
|
|
25
|
+
],
|
|
26
|
+
defaultVariants: { size: "default" },
|
|
27
|
+
variants: { size: {
|
|
28
|
+
default: [],
|
|
29
|
+
small: [
|
|
30
|
+
"text-base",
|
|
31
|
+
"font-medium",
|
|
32
|
+
"text-gray-900",
|
|
33
|
+
"mb-1"
|
|
34
|
+
]
|
|
35
|
+
} }
|
|
36
|
+
});
|
|
37
|
+
const FieldsetRoot = ({ className, variant, ...props }) => {
|
|
38
|
+
return /* @__PURE__ */ jsx(Fieldset$1.Root, {
|
|
39
|
+
className: fieldsetRoot({
|
|
40
|
+
className,
|
|
41
|
+
variant
|
|
42
|
+
}),
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const FieldsetLegend = ({ className, size, ...props }) => {
|
|
47
|
+
return /* @__PURE__ */ jsx(Fieldset$1.Legend, {
|
|
48
|
+
className: fieldsetLegend({
|
|
49
|
+
className,
|
|
50
|
+
size
|
|
51
|
+
}),
|
|
52
|
+
...props
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const Fieldset = {
|
|
56
|
+
Legend: FieldsetLegend,
|
|
57
|
+
Root: FieldsetRoot
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { Fieldset };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { Form as Form$1 } from "@base-ui/react/form";
|
|
3
|
+
|
|
4
|
+
//#region src/form/form.d.ts
|
|
5
|
+
declare const formVariants: {
|
|
6
|
+
readonly compact: readonly ["space-y-4"];
|
|
7
|
+
readonly default: readonly ["space-y-6"];
|
|
8
|
+
readonly inline: readonly ["flex", "flex-wrap", "gap-4", "items-end"];
|
|
9
|
+
};
|
|
10
|
+
type FormVariant = keyof typeof formVariants;
|
|
11
|
+
interface FormProps extends Omit<ComponentProps<typeof Form$1>, "className"> {
|
|
12
|
+
className?: string;
|
|
13
|
+
variant?: FormVariant;
|
|
14
|
+
}
|
|
15
|
+
declare const Form: ({
|
|
16
|
+
className,
|
|
17
|
+
variant,
|
|
18
|
+
...props
|
|
19
|
+
}: FormProps) => React.JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Form, type FormProps, type FormVariant };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { tv } from "@regardio/tailwind/utils";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Form as Form$1 } from "@base-ui/react/form";
|
|
4
|
+
|
|
5
|
+
//#region src/form/form.tsx
|
|
6
|
+
const form = tv({
|
|
7
|
+
base: [],
|
|
8
|
+
defaultVariants: { variant: "default" },
|
|
9
|
+
variants: { variant: {
|
|
10
|
+
compact: ["space-y-4"],
|
|
11
|
+
default: ["space-y-6"],
|
|
12
|
+
inline: [
|
|
13
|
+
"flex",
|
|
14
|
+
"flex-wrap",
|
|
15
|
+
"gap-4",
|
|
16
|
+
"items-end"
|
|
17
|
+
]
|
|
18
|
+
} }
|
|
19
|
+
});
|
|
20
|
+
const Form = ({ className, variant, ...props }) => {
|
|
21
|
+
return /* @__PURE__ */ jsx(Form$1, {
|
|
22
|
+
className: form({
|
|
23
|
+
className,
|
|
24
|
+
variant
|
|
25
|
+
}),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Form };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/generic-error/generic-error.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Descriptor returned from getErrorDescriptor to help apps localize messages.
|
|
4
|
+
*/
|
|
5
|
+
type ErrorDescriptor = {
|
|
6
|
+
type: "http";
|
|
7
|
+
status: number;
|
|
8
|
+
statusText: string;
|
|
9
|
+
defaultId: string;
|
|
10
|
+
defaultMessage: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: "error";
|
|
13
|
+
defaultId: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
message?: string;
|
|
16
|
+
stack?: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: "unknown";
|
|
19
|
+
defaultId: string;
|
|
20
|
+
defaultMessage: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Compute a normalized error descriptor from a React Router error.
|
|
24
|
+
* Apps can use this to map to i18n keys.
|
|
25
|
+
*/
|
|
26
|
+
declare function getErrorDescriptor(error: unknown): ErrorDescriptor;
|
|
27
|
+
/**
|
|
28
|
+
* GenericError
|
|
29
|
+
*
|
|
30
|
+
* A reusable error boundary component for React Router apps.
|
|
31
|
+
* - Displays status-based messages for route responses
|
|
32
|
+
* - Shows stack traces in development for non-response errors
|
|
33
|
+
*
|
|
34
|
+
* For localization, apps may either:
|
|
35
|
+
* - Wrap this component and use `getErrorDescriptor(useRouteError())` to map to i18n keys
|
|
36
|
+
* - Or provide a custom `renderMessage` to override the displayed details
|
|
37
|
+
*/
|
|
38
|
+
declare function GenericError({
|
|
39
|
+
renderMessage
|
|
40
|
+
}?: {
|
|
41
|
+
renderMessage?: (descriptor: ErrorDescriptor) => React.JSX.Element;
|
|
42
|
+
}): React.JSX.Element;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { type ErrorDescriptor, GenericError, getErrorDescriptor };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isRouteErrorResponse, useRouteError } from "react-router";
|
|
3
|
+
|
|
4
|
+
//#region src/generic-error/generic-error.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Compute a normalized error descriptor from a React Router error.
|
|
7
|
+
* Apps can use this to map to i18n keys.
|
|
8
|
+
*/
|
|
9
|
+
function getErrorDescriptor(error) {
|
|
10
|
+
if (isRouteErrorResponse(error)) {
|
|
11
|
+
const status = error.status;
|
|
12
|
+
const statusText = error.statusText || "Error";
|
|
13
|
+
return {
|
|
14
|
+
defaultId: status === 404 ? "errors.404" : "errors.http",
|
|
15
|
+
defaultMessage: status === 404 ? "Not found" : `Error ${status}`,
|
|
16
|
+
status,
|
|
17
|
+
statusText,
|
|
18
|
+
type: "http"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (error instanceof Error) return {
|
|
22
|
+
defaultId: "errors.runtime",
|
|
23
|
+
defaultMessage: "An unexpected error occurred.",
|
|
24
|
+
message: error.message,
|
|
25
|
+
type: "error",
|
|
26
|
+
...error.stack ? { stack: error.stack } : {}
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
defaultId: "errors.unknown",
|
|
30
|
+
defaultMessage: "An unexpected error occurred.",
|
|
31
|
+
type: "unknown"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* GenericError
|
|
36
|
+
*
|
|
37
|
+
* A reusable error boundary component for React Router apps.
|
|
38
|
+
* - Displays status-based messages for route responses
|
|
39
|
+
* - Shows stack traces in development for non-response errors
|
|
40
|
+
*
|
|
41
|
+
* For localization, apps may either:
|
|
42
|
+
* - Wrap this component and use `getErrorDescriptor(useRouteError())` to map to i18n keys
|
|
43
|
+
* - Or provide a custom `renderMessage` to override the displayed details
|
|
44
|
+
*/
|
|
45
|
+
function GenericError({ renderMessage } = {}) {
|
|
46
|
+
const descriptor = getErrorDescriptor(useRouteError());
|
|
47
|
+
return /* @__PURE__ */ jsxs("main", {
|
|
48
|
+
className: "pt-2xl p-sm container mx-auto",
|
|
49
|
+
children: [/* @__PURE__ */ jsx("h1", { children: descriptor.type === "http" ? `Error ${descriptor.status}` : "Error" }), renderMessage ? renderMessage(descriptor) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", { children: descriptor.type === "http" ? descriptor.defaultMessage : descriptor.type === "error" ? descriptor.message || descriptor.defaultMessage : descriptor.defaultMessage }), import.meta.env.DEV && descriptor.type === "error" && descriptor.stack && /* @__PURE__ */ jsx("pre", {
|
|
50
|
+
className: "w-full p-sm overflow-x-auto",
|
|
51
|
+
children: /* @__PURE__ */ jsx("code", { children: descriptor.stack })
|
|
52
|
+
})] })]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { GenericError, getErrorDescriptor };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/grid/grid-item.d.ts
|
|
4
|
+
declare const GRID_ITEM_VARIANTS: {
|
|
5
|
+
readonly end: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, "auto"];
|
|
6
|
+
readonly rowSpan: readonly [1, 2, 3, 4, 5, 6, "full"];
|
|
7
|
+
readonly span: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "full"];
|
|
8
|
+
readonly spanLg: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "full"];
|
|
9
|
+
readonly spanMd: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "full"];
|
|
10
|
+
readonly spanSm: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "full"];
|
|
11
|
+
readonly spanXl: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "full"];
|
|
12
|
+
readonly spanXs: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "full"];
|
|
13
|
+
readonly start: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, "auto"];
|
|
14
|
+
};
|
|
15
|
+
interface GridItemVariantProps {
|
|
16
|
+
end?: (typeof GRID_ITEM_VARIANTS.end)[number];
|
|
17
|
+
rowSpan?: (typeof GRID_ITEM_VARIANTS.rowSpan)[number];
|
|
18
|
+
span?: (typeof GRID_ITEM_VARIANTS.span)[number];
|
|
19
|
+
spanLg?: (typeof GRID_ITEM_VARIANTS.spanLg)[number];
|
|
20
|
+
spanMd?: (typeof GRID_ITEM_VARIANTS.spanMd)[number];
|
|
21
|
+
spanSm?: (typeof GRID_ITEM_VARIANTS.spanSm)[number];
|
|
22
|
+
spanXl?: (typeof GRID_ITEM_VARIANTS.spanXl)[number];
|
|
23
|
+
spanXs?: (typeof GRID_ITEM_VARIANTS.spanXs)[number];
|
|
24
|
+
start?: (typeof GRID_ITEM_VARIANTS.start)[number];
|
|
25
|
+
}
|
|
26
|
+
interface GridItemSlotProps {
|
|
27
|
+
class?: string;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
interface GridItemSlots {
|
|
31
|
+
root: (props?: GridItemSlotProps) => string;
|
|
32
|
+
}
|
|
33
|
+
type GridItemStyleFn = (props?: GridItemVariantProps) => GridItemSlots;
|
|
34
|
+
declare const gridItem: GridItemStyleFn;
|
|
35
|
+
type GridItemVariants = GridItemVariantProps;
|
|
36
|
+
interface GridItemProps extends HTMLAttributes<HTMLDivElement>, GridItemVariants {
|
|
37
|
+
classNames?: {
|
|
38
|
+
root?: string;
|
|
39
|
+
};
|
|
40
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
41
|
+
}
|
|
42
|
+
declare const GridItem: ({
|
|
43
|
+
children,
|
|
44
|
+
className,
|
|
45
|
+
classNames,
|
|
46
|
+
span,
|
|
47
|
+
spanXs,
|
|
48
|
+
spanSm,
|
|
49
|
+
spanMd,
|
|
50
|
+
spanLg,
|
|
51
|
+
spanXl,
|
|
52
|
+
start,
|
|
53
|
+
end,
|
|
54
|
+
rowSpan,
|
|
55
|
+
ref,
|
|
56
|
+
...props
|
|
57
|
+
}: GridItemProps) => React.JSX.Element;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/grid/grid-root.d.ts
|
|
60
|
+
declare const GRID_VARIANTS: {
|
|
61
|
+
readonly align: readonly ["center", "end", "start", "stretch"];
|
|
62
|
+
readonly flow: readonly ["column", "dense", "row"];
|
|
63
|
+
};
|
|
64
|
+
interface GridVariantProps {
|
|
65
|
+
align?: (typeof GRID_VARIANTS.align)[number];
|
|
66
|
+
flow?: (typeof GRID_VARIANTS.flow)[number];
|
|
67
|
+
}
|
|
68
|
+
interface GridSlotProps {
|
|
69
|
+
class?: string;
|
|
70
|
+
className?: string;
|
|
71
|
+
}
|
|
72
|
+
interface GridSlots {
|
|
73
|
+
root: (props?: GridSlotProps) => string;
|
|
74
|
+
}
|
|
75
|
+
type GridStyleFn = (props?: GridVariantProps) => GridSlots;
|
|
76
|
+
declare const grid: GridStyleFn;
|
|
77
|
+
type GridVariants = GridVariantProps;
|
|
78
|
+
interface GridContextValue {
|
|
79
|
+
styles: ReturnType<typeof grid>;
|
|
80
|
+
}
|
|
81
|
+
declare function useGrid(): GridContextValue;
|
|
82
|
+
interface GridRootProps extends HTMLAttributes<HTMLDivElement>, GridVariants {
|
|
83
|
+
classNames?: {
|
|
84
|
+
root?: string;
|
|
85
|
+
};
|
|
86
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
87
|
+
}
|
|
88
|
+
declare const GridRoot: ({
|
|
89
|
+
children,
|
|
90
|
+
className,
|
|
91
|
+
classNames,
|
|
92
|
+
flow,
|
|
93
|
+
align,
|
|
94
|
+
ref,
|
|
95
|
+
...props
|
|
96
|
+
}: GridRootProps) => React.JSX.Element;
|
|
97
|
+
declare namespace index_parts_d_exports {
|
|
98
|
+
export { GridItem as Item, GridRoot as Root };
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { index_parts_d_exports as Grid, type GridItemProps, type GridItemVariants, type GridRootProps, gridItem, useGrid };
|