@regardio/react 0.5.7 → 0.6.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 +36 -0
- package/dist/background-slideshow/index.mjs +110 -0
- package/dist/blurry-gradient/index.d.mts +17 -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 +40 -0
- package/dist/carousel/index.mjs +141 -0
- package/dist/checkbox/index.d.mts +37 -0
- package/dist/checkbox/index.mjs +70 -0
- package/dist/checkbox-group/index.d.mts +17 -0
- package/dist/checkbox-group/index.mjs +29 -0
- package/dist/chunk-BTpB_u-K.mjs +18 -0
- package/dist/countdown/index.d.mts +6 -0
- package/dist/countdown/index.mjs +58 -0
- package/dist/field/index.d.mts +66 -0
- package/dist/field/index.mjs +115 -0
- package/dist/fieldset/index.d.mts +33 -0
- package/dist/fieldset/index.mjs +61 -0
- package/dist/form/index.d.mts +22 -0
- package/dist/form/index.mjs +31 -0
- package/dist/generic-error/{index.d.ts → index.d.mts} +22 -18
- package/dist/generic-error/index.mjs +57 -0
- package/dist/grid/index.d.mts +1197 -0
- package/dist/grid/index.mjs +221 -0
- package/dist/heading/index.d.mts +31 -0
- package/dist/heading/index.mjs +29 -0
- package/dist/highlight/index.d.mts +18 -0
- package/dist/highlight/index.mjs +35 -0
- package/dist/hooks/{use-current-route-data.d.ts → use-current-route-data.d.mts} +3 -2
- package/dist/hooks/use-current-route-data.mjs +20 -0
- package/dist/hooks/{use-focus-search.d.ts → use-focus-search.d.mts} +4 -3
- package/dist/hooks/use-focus-search.mjs +21 -0
- package/dist/hooks/{use-matches-data.d.ts → use-matches-data.d.mts} +3 -2
- package/dist/hooks/use-matches-data.mjs +21 -0
- package/dist/hooks/{use-media-query.d.ts → use-media-query.d.mts} +3 -2
- package/dist/hooks/use-media-query.mjs +26 -0
- package/dist/hooks/use-mobile.d.mts +4 -0
- package/dist/hooks/use-mobile.mjs +20 -0
- package/dist/hooks/use-nonce.d.mts +8 -0
- package/dist/hooks/use-nonce.mjs +13 -0
- package/dist/hooks/{use-orientation.d.ts → use-orientation.d.mts} +3 -2
- package/dist/hooks/use-orientation.mjs +30 -0
- package/dist/hooks/use-user.d.mts +55 -0
- package/dist/hooks/use-user.mjs +39 -0
- package/dist/icon-button/index.d.mts +29 -0
- package/dist/icon-button/index.mjs +36 -0
- package/dist/if/index.d.mts +15 -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-Bm-tWhsb.d.mts +30 -0
- package/dist/index-YT2CkvL6.d.mts +36 -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 +73 -0
- package/dist/link/index.mjs +129 -0
- package/dist/list/index.d.mts +71 -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 +24 -0
- package/dist/password-input/index.mjs +92 -0
- package/dist/picture/{index.d.ts → index.d.mts} +21 -20
- package/dist/picture/index.mjs +3 -0
- package/dist/picture-DkX3W5zl.mjs +69 -0
- package/dist/protected-email/{index.d.ts → index.d.mts} +14 -8
- package/dist/protected-email/index.mjs +37 -0
- package/dist/radio/index.d.mts +37 -0
- package/dist/radio/index.mjs +72 -0
- package/dist/radio-group/index.d.mts +17 -0
- package/dist/radio-group/index.mjs +29 -0
- package/dist/slider/index.d.mts +85 -0
- package/dist/slider/index.mjs +133 -0
- package/dist/switch/index.d.mts +38 -0
- package/dist/switch/index.mjs +87 -0
- package/dist/text/index.d.mts +26 -0
- package/dist/text/index.mjs +32 -0
- package/dist/text-CPlUND-Z.mjs +58 -0
- package/dist/toggle/index.d.mts +59 -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} +4 -3
- package/dist/utils/text/index.mjs +3 -0
- package/package.json +5 -117
- package/src/button/button.stories.tsx +161 -0
- package/src/button/button.test.tsx +73 -0
- package/src/button/button.tsx +112 -0
- package/src/button/index.ts +2 -0
- package/src/carousel/carousel-next.tsx +2 -2
- package/src/carousel/carousel-previous.tsx +2 -2
- package/src/checkbox/checkbox.stories.tsx +118 -0
- package/src/checkbox/checkbox.tsx +91 -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/field/field.stories.tsx +105 -0
- package/src/field/field.test.tsx +61 -0
- package/src/field/field.tsx +165 -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 +75 -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/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/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/password-input/index.ts +1 -1
- package/src/password-input/password-input.tsx +104 -27
- package/src/radio/index.ts +2 -0
- package/src/radio/radio.tsx +92 -0
- package/src/radio-group/index.ts +2 -0
- package/src/radio-group/radio-group.tsx +36 -0
- package/src/slider/index.ts +18 -0
- package/src/slider/slider.tsx +179 -0
- package/src/switch/index.ts +2 -0
- package/src/switch/switch.stories.tsx +118 -0
- package/src/switch/switch.tsx +101 -0
- 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/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.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.js +0 -16
- package/dist/hooks/use-focus-search.js +0 -19
- package/dist/hooks/use-matches-data.js +0 -15
- 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.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.js +0 -68
- 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,29 @@
|
|
|
1
|
+
import { t as Button } from "../index-YT2CkvL6.mjs";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
import * as react_jsx_runtime22 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/icon-button/icon-button.d.ts
|
|
6
|
+
declare const iconButtonVariants: {
|
|
7
|
+
readonly default: readonly ["p-2"];
|
|
8
|
+
readonly lg: readonly ["p-3"];
|
|
9
|
+
readonly md: readonly ["p-2"];
|
|
10
|
+
readonly sm: readonly ["p-1"];
|
|
11
|
+
};
|
|
12
|
+
type IconButtonSize = keyof typeof iconButtonVariants;
|
|
13
|
+
interface IconButtonProps extends Omit<ComponentProps<typeof Button>, 'size'> {
|
|
14
|
+
icon: ReactNode;
|
|
15
|
+
size?: IconButtonSize;
|
|
16
|
+
title?: string;
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
children?: never;
|
|
19
|
+
}
|
|
20
|
+
declare const IconButton: ({
|
|
21
|
+
icon,
|
|
22
|
+
size,
|
|
23
|
+
title,
|
|
24
|
+
"aria-label": ariaLabel,
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: IconButtonProps) => react_jsx_runtime22.JSX.Element;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { IconButton, type IconButtonProps };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { t as Button } from "../button-BiSQpBbc.mjs";
|
|
2
|
+
import { tv } from "@regardio/tailwind/utils";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/icon-button/icon-button.tsx
|
|
6
|
+
const iconButton = tv({
|
|
7
|
+
base: [
|
|
8
|
+
"flex",
|
|
9
|
+
"items-center",
|
|
10
|
+
"justify-center"
|
|
11
|
+
],
|
|
12
|
+
defaultVariants: { size: "md" },
|
|
13
|
+
variants: { size: {
|
|
14
|
+
default: ["p-2"],
|
|
15
|
+
lg: ["p-3"],
|
|
16
|
+
md: ["p-2"],
|
|
17
|
+
sm: ["p-1"]
|
|
18
|
+
} }
|
|
19
|
+
});
|
|
20
|
+
const IconButton = ({ icon, size = "md", title, "aria-label": ariaLabel, className, ...props }) => {
|
|
21
|
+
const finalAriaLabel = ariaLabel || title;
|
|
22
|
+
const finalTitle = title || ariaLabel;
|
|
23
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
24
|
+
"aria-label": finalAriaLabel,
|
|
25
|
+
className: iconButton({
|
|
26
|
+
className,
|
|
27
|
+
size
|
|
28
|
+
}),
|
|
29
|
+
title: finalTitle,
|
|
30
|
+
...props,
|
|
31
|
+
children: icon
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { IconButton };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/if/if.d.ts
|
|
4
|
+
type Condition<Value = unknown> = Value | false | null | undefined | 0 | '';
|
|
5
|
+
declare function If<Value = unknown>({
|
|
6
|
+
condition,
|
|
7
|
+
children,
|
|
8
|
+
fallback
|
|
9
|
+
}: React.PropsWithoutRef<{
|
|
10
|
+
condition: Condition<Value>;
|
|
11
|
+
children: React.ReactNode | ((value: Value) => React.ReactNode);
|
|
12
|
+
fallback?: React.ReactNode;
|
|
13
|
+
}>): react_jsx_runtime6.JSX.Element | null;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { If };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/if/if.tsx
|
|
5
|
+
function If({ condition, children, fallback }) {
|
|
6
|
+
return useMemo(() => {
|
|
7
|
+
if (condition) {
|
|
8
|
+
if (typeof children === "function") return /* @__PURE__ */ jsx(Fragment, { children: children(condition) });
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
10
|
+
}
|
|
11
|
+
if (fallback) return /* @__PURE__ */ jsx(Fragment, { children: fallback });
|
|
12
|
+
return null;
|
|
13
|
+
}, [
|
|
14
|
+
condition,
|
|
15
|
+
fallback,
|
|
16
|
+
children
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { If };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from "@regardio/tailwind/utils";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/iframe/iframe.tsx
|
|
5
|
+
const Iframe = ({ src, title, className }) => /* @__PURE__ */ jsx("iframe", {
|
|
6
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
|
|
7
|
+
allowFullScreen: true,
|
|
8
|
+
className: cn("w-full aspect-video border-0", className),
|
|
9
|
+
loading: "lazy",
|
|
10
|
+
src,
|
|
11
|
+
title
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Iframe };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
3
|
+
import { Input } from "@base-ui/react/input";
|
|
4
|
+
|
|
5
|
+
//#region src/input/input.d.ts
|
|
6
|
+
declare const inputVariants: {
|
|
7
|
+
readonly default: readonly ["w-full", "px-3", "py-2", "border", "border-gray-300", "rounded-md", "bg-white", "text-gray-900", "placeholder-gray-500", "focus:outline-none", "focus:ring-2", "focus:ring-blue-500", "focus:border-blue-500", "transition-colors", "duration-200"];
|
|
8
|
+
readonly error: readonly ["border-red-300", "text-red-900", "placeholder-red-500", "focus:ring-red-500", "focus:border-red-500"];
|
|
9
|
+
readonly success: readonly ["border-green-300", "text-green-900", "placeholder-green-500", "focus:ring-green-500", "focus:border-green-500"];
|
|
10
|
+
};
|
|
11
|
+
declare const inputSizes: {
|
|
12
|
+
readonly lg: readonly ["px-4", "py-3", "text-lg"];
|
|
13
|
+
readonly md: readonly ["px-3", "py-2", "text-base"];
|
|
14
|
+
readonly sm: readonly ["px-2", "py-1", "text-sm"];
|
|
15
|
+
};
|
|
16
|
+
type InputVariant = keyof typeof inputVariants;
|
|
17
|
+
type InputSize = keyof typeof inputSizes;
|
|
18
|
+
interface InputProps extends Omit<ComponentProps<typeof Input>, 'className' | 'size'> {
|
|
19
|
+
className?: string;
|
|
20
|
+
variant?: InputVariant;
|
|
21
|
+
size?: InputSize;
|
|
22
|
+
}
|
|
23
|
+
declare const Input$1: ({
|
|
24
|
+
className,
|
|
25
|
+
variant,
|
|
26
|
+
size,
|
|
27
|
+
...props
|
|
28
|
+
}: InputProps) => react_jsx_runtime5.JSX.Element;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { InputVariant as i, InputProps as n, InputSize as r, Input$1 as t };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as react_jsx_runtime46 from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@base-ui/react/button";
|
|
4
|
+
|
|
5
|
+
//#region src/button/button.d.ts
|
|
6
|
+
declare const buttonVariants: {
|
|
7
|
+
readonly destructive: readonly ["bg-red-600", "text-white", "border-red-600", "hover:bg-red-700", "hover:border-red-700", "focus-visible:ring-2", "focus-visible:ring-red-500", "focus-visible:ring-offset-2"];
|
|
8
|
+
readonly ghost: readonly ["bg-transparent", "text-gray-900", "border-transparent", "hover:bg-gray-100", "hover:border-transparent", "focus-visible:ring-2", "focus-visible:ring-gray-500", "focus-visible:ring-offset-2"];
|
|
9
|
+
readonly outline: readonly ["bg-transparent", "text-gray-900", "border-gray-300", "hover:bg-gray-50", "hover:border-gray-400", "focus-visible:ring-2", "focus-visible:ring-gray-500", "focus-visible:ring-offset-2"];
|
|
10
|
+
readonly primary: readonly ["bg-blue-600", "text-white", "border-blue-600", "hover:bg-blue-700", "hover:border-blue-700", "focus-visible:ring-2", "focus-visible:ring-blue-500", "focus-visible:ring-offset-2"];
|
|
11
|
+
readonly secondary: readonly ["bg-gray-100", "text-gray-900", "border-gray-300", "hover:bg-gray-200", "hover:border-gray-400", "focus-visible:ring-2", "focus-visible:ring-gray-500", "focus-visible:ring-offset-2"];
|
|
12
|
+
};
|
|
13
|
+
declare const buttonSizes: {
|
|
14
|
+
readonly '2xl': readonly ["px-10", "py-5", "text-2xl", "font-medium", "rounded-lg"];
|
|
15
|
+
readonly lg: readonly ["px-6", "py-3", "text-lg", "font-medium", "rounded-lg"];
|
|
16
|
+
readonly md: readonly ["px-4", "py-2", "text-base", "font-medium", "rounded-md"];
|
|
17
|
+
readonly sm: readonly ["px-3", "py-1.5", "text-sm", "font-medium", "rounded-md"];
|
|
18
|
+
readonly xl: readonly ["px-8", "py-4", "text-xl", "font-medium", "rounded-lg"];
|
|
19
|
+
};
|
|
20
|
+
type ButtonVariant = keyof typeof buttonVariants;
|
|
21
|
+
type ButtonSize = keyof typeof buttonSizes;
|
|
22
|
+
interface ButtonProps extends Omit<ComponentProps<typeof Button>, 'className'> {
|
|
23
|
+
variant?: ButtonVariant;
|
|
24
|
+
size?: ButtonSize;
|
|
25
|
+
className?: string;
|
|
26
|
+
type?: 'button' | 'submit' | 'reset';
|
|
27
|
+
}
|
|
28
|
+
declare const Button$1: ({
|
|
29
|
+
children,
|
|
30
|
+
className,
|
|
31
|
+
variant,
|
|
32
|
+
size,
|
|
33
|
+
...props
|
|
34
|
+
}: ButtonProps) => react_jsx_runtime46.JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { ButtonVariant as i, ButtonProps as n, ButtonSize as r, Button$1 as t };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { tv } from "@regardio/tailwind/utils";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Input } from "@base-ui/react/input";
|
|
4
|
+
|
|
5
|
+
//#region src/input/input.tsx
|
|
6
|
+
const input = tv({
|
|
7
|
+
base: [
|
|
8
|
+
"w-full",
|
|
9
|
+
"px-3",
|
|
10
|
+
"py-2",
|
|
11
|
+
"border",
|
|
12
|
+
"border-gray-300",
|
|
13
|
+
"rounded-md",
|
|
14
|
+
"bg-white",
|
|
15
|
+
"text-gray-900",
|
|
16
|
+
"placeholder-gray-500",
|
|
17
|
+
"focus:outline-none",
|
|
18
|
+
"focus:ring-2",
|
|
19
|
+
"focus:ring-blue-500",
|
|
20
|
+
"focus:border-blue-500",
|
|
21
|
+
"transition-colors",
|
|
22
|
+
"duration-200"
|
|
23
|
+
],
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
size: "md",
|
|
26
|
+
variant: "default"
|
|
27
|
+
},
|
|
28
|
+
variants: {
|
|
29
|
+
size: {
|
|
30
|
+
lg: [
|
|
31
|
+
"px-4",
|
|
32
|
+
"py-3",
|
|
33
|
+
"text-lg"
|
|
34
|
+
],
|
|
35
|
+
md: [],
|
|
36
|
+
sm: [
|
|
37
|
+
"px-2",
|
|
38
|
+
"py-1",
|
|
39
|
+
"text-sm"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
variant: {
|
|
43
|
+
default: [],
|
|
44
|
+
error: [
|
|
45
|
+
"border-red-300",
|
|
46
|
+
"text-red-900",
|
|
47
|
+
"placeholder-red-500",
|
|
48
|
+
"focus:ring-red-500",
|
|
49
|
+
"focus:border-red-500"
|
|
50
|
+
],
|
|
51
|
+
success: [
|
|
52
|
+
"border-green-300",
|
|
53
|
+
"text-green-900",
|
|
54
|
+
"placeholder-green-500",
|
|
55
|
+
"focus:ring-green-500",
|
|
56
|
+
"focus:border-green-500"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const Input$1 = ({ className, variant, size, ...props }) => {
|
|
62
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
63
|
+
className: input({
|
|
64
|
+
className,
|
|
65
|
+
size,
|
|
66
|
+
variant
|
|
67
|
+
}),
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
export { Input$1 as t };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as react10 from "react";
|
|
2
|
+
import * as react_jsx_runtime43 from "react/jsx-runtime";
|
|
3
|
+
import { NavLinkProps } from "react-router";
|
|
4
|
+
|
|
5
|
+
//#region src/link/link.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Context for providing a path resolver function.
|
|
8
|
+
* This allows projects to inject their own localization logic.
|
|
9
|
+
*/
|
|
10
|
+
type PathResolver = (routeKey: string) => string;
|
|
11
|
+
declare const PathResolverProvider: react10.Provider<PathResolver | null>;
|
|
12
|
+
declare function usePathResolver(): PathResolver | null;
|
|
13
|
+
interface LinkBaseProps extends Omit<NavLinkProps, 'to'> {
|
|
14
|
+
to?: string | Partial<{
|
|
15
|
+
pathname?: string;
|
|
16
|
+
search?: string;
|
|
17
|
+
hash?: string;
|
|
18
|
+
}> | undefined;
|
|
19
|
+
routeKey?: string;
|
|
20
|
+
viewTransition?: boolean;
|
|
21
|
+
}
|
|
22
|
+
declare const LinkBase: ({
|
|
23
|
+
className,
|
|
24
|
+
to,
|
|
25
|
+
routeKey,
|
|
26
|
+
children,
|
|
27
|
+
onClick,
|
|
28
|
+
viewTransition,
|
|
29
|
+
...props
|
|
30
|
+
}: LinkBaseProps) => react_jsx_runtime43.JSX.Element;
|
|
31
|
+
declare const arrowVariants: {
|
|
32
|
+
readonly darr: "darr";
|
|
33
|
+
readonly larr: "larr";
|
|
34
|
+
readonly rarr: "rarr";
|
|
35
|
+
readonly uarr: "uarr";
|
|
36
|
+
};
|
|
37
|
+
declare const linkVariants: {
|
|
38
|
+
readonly button: readonly ["block", "button", "mt-s", "relative", "rarr", "text-right", "text-sm", "tracking-wider", "uppercase"];
|
|
39
|
+
readonly code: readonly ["font-monospace"];
|
|
40
|
+
readonly link: readonly ["rarr", "!bg-transparent", "uppercase", "!tracking-wider"];
|
|
41
|
+
readonly navtitle: readonly ["block", "uppercase", "tracking-wider"];
|
|
42
|
+
readonly primary: readonly [];
|
|
43
|
+
readonly subtitle: readonly ["text-lg"];
|
|
44
|
+
};
|
|
45
|
+
type LinkArrow = keyof typeof arrowVariants;
|
|
46
|
+
type LinkVariant = keyof typeof linkVariants;
|
|
47
|
+
interface LinkProps extends Omit<NavLinkProps, 'to'> {
|
|
48
|
+
arrow?: LinkArrow;
|
|
49
|
+
to?: string | Partial<{
|
|
50
|
+
pathname?: string;
|
|
51
|
+
search?: string;
|
|
52
|
+
hash?: string;
|
|
53
|
+
}>;
|
|
54
|
+
routeKey?: string;
|
|
55
|
+
variant?: LinkVariant;
|
|
56
|
+
viewTransition?: boolean;
|
|
57
|
+
}
|
|
58
|
+
declare const Link: ({
|
|
59
|
+
arrow,
|
|
60
|
+
children,
|
|
61
|
+
className,
|
|
62
|
+
routeKey,
|
|
63
|
+
to,
|
|
64
|
+
variant,
|
|
65
|
+
viewTransition,
|
|
66
|
+
...props
|
|
67
|
+
}: LinkProps) => react_jsx_runtime43.JSX.Element;
|
|
68
|
+
interface MarkdownLinkProps extends Omit<LinkProps, 'to'> {
|
|
69
|
+
href?: string;
|
|
70
|
+
}
|
|
71
|
+
declare const MarkdownLink: React.FC<MarkdownLinkProps>;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { Link, LinkBase, type LinkBaseProps, type LinkProps, MarkdownLink, type MarkdownLinkProps, type PathResolver, PathResolverProvider, usePathResolver };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { t as lowerCaseSzett } from "../text-CPlUND-Z.mjs";
|
|
2
|
+
import { createContext, useCallback, useContext } from "react";
|
|
3
|
+
import { tv } from "@regardio/tailwind/utils";
|
|
4
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
|
+
import { NavLink } from "react-router";
|
|
6
|
+
|
|
7
|
+
//#region src/link/link.tsx
|
|
8
|
+
const PathResolverContext = createContext(null);
|
|
9
|
+
const PathResolverProvider = PathResolverContext.Provider;
|
|
10
|
+
function usePathResolver() {
|
|
11
|
+
return useContext(PathResolverContext);
|
|
12
|
+
}
|
|
13
|
+
const LinkBase = ({ className, to, routeKey, children, onClick, viewTransition = true, ...props }) => {
|
|
14
|
+
const pathResolver = usePathResolver();
|
|
15
|
+
let path;
|
|
16
|
+
if (routeKey && pathResolver) path = pathResolver(routeKey);
|
|
17
|
+
else if (typeof to === "string") path = to;
|
|
18
|
+
else {
|
|
19
|
+
path = to?.pathname ?? "";
|
|
20
|
+
if (to?.search) path += to.search;
|
|
21
|
+
if (to?.hash) path += to.hash;
|
|
22
|
+
}
|
|
23
|
+
const isExternal = path.startsWith("tel:") || path.startsWith("mailto:") || path.startsWith("#") || path.startsWith("http");
|
|
24
|
+
const handleClick = useCallback((event) => {
|
|
25
|
+
onClick?.(event);
|
|
26
|
+
if (event.defaultPrevented) return;
|
|
27
|
+
if (path.startsWith("tel:") || path.startsWith("mailto:")) return;
|
|
28
|
+
if (path.startsWith("#")) {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
const element = document.getElementById(path.substring(1));
|
|
31
|
+
if (element) element.scrollIntoView({ behavior: "smooth" });
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (path.startsWith("http")) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
window.open(path, "_blank", "noopener,noreferrer");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}, [onClick, path]);
|
|
40
|
+
if (!path) return /* @__PURE__ */ jsx(Fragment, { children: typeof children === "function" ? null : children });
|
|
41
|
+
if (isExternal) {
|
|
42
|
+
const externalState = {
|
|
43
|
+
isActive: false,
|
|
44
|
+
isPending: false,
|
|
45
|
+
isTransitioning: false
|
|
46
|
+
};
|
|
47
|
+
const resolvedClassName = typeof className === "function" ? className(externalState) : className;
|
|
48
|
+
const resolvedStyle = typeof props.style === "function" ? props.style(externalState) : props.style;
|
|
49
|
+
return /* @__PURE__ */ jsx("a", {
|
|
50
|
+
className: resolvedClassName,
|
|
51
|
+
href: path,
|
|
52
|
+
onClick: handleClick,
|
|
53
|
+
style: resolvedStyle,
|
|
54
|
+
children: typeof children === "function" ? children(externalState) : children
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */ jsx(NavLink, {
|
|
58
|
+
...props,
|
|
59
|
+
className,
|
|
60
|
+
onClick: handleClick,
|
|
61
|
+
to: path,
|
|
62
|
+
viewTransition,
|
|
63
|
+
children
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const link = tv({
|
|
67
|
+
base: [],
|
|
68
|
+
defaultVariants: { variant: "primary" },
|
|
69
|
+
variants: {
|
|
70
|
+
arrow: {
|
|
71
|
+
darr: "darr",
|
|
72
|
+
larr: "larr",
|
|
73
|
+
rarr: "rarr",
|
|
74
|
+
uarr: "uarr"
|
|
75
|
+
},
|
|
76
|
+
variant: {
|
|
77
|
+
button: [
|
|
78
|
+
"block",
|
|
79
|
+
"button",
|
|
80
|
+
"mt-s",
|
|
81
|
+
"relative",
|
|
82
|
+
"rarr",
|
|
83
|
+
"text-right",
|
|
84
|
+
"text-sm",
|
|
85
|
+
"tracking-wider",
|
|
86
|
+
"uppercase"
|
|
87
|
+
],
|
|
88
|
+
code: ["font-monospace"],
|
|
89
|
+
link: [
|
|
90
|
+
"rarr",
|
|
91
|
+
"!bg-transparent",
|
|
92
|
+
"uppercase",
|
|
93
|
+
"!tracking-wider"
|
|
94
|
+
],
|
|
95
|
+
navtitle: [
|
|
96
|
+
"block",
|
|
97
|
+
"uppercase",
|
|
98
|
+
"tracking-wider"
|
|
99
|
+
],
|
|
100
|
+
primary: [],
|
|
101
|
+
subtitle: ["text-lg"]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
const Link = ({ arrow, children, className, routeKey, to, variant, viewTransition, ...props }) => {
|
|
106
|
+
return /* @__PURE__ */ jsx(LinkBase, {
|
|
107
|
+
...props,
|
|
108
|
+
className: link({
|
|
109
|
+
arrow,
|
|
110
|
+
className: typeof className === "string" ? className : void 0,
|
|
111
|
+
variant
|
|
112
|
+
}),
|
|
113
|
+
routeKey,
|
|
114
|
+
to,
|
|
115
|
+
viewTransition,
|
|
116
|
+
children: lowerCaseSzett(children)
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const MarkdownLink = ({ children, href, ...props }) => {
|
|
120
|
+
if (href) return /* @__PURE__ */ jsx(Link, {
|
|
121
|
+
to: href,
|
|
122
|
+
...props,
|
|
123
|
+
children
|
|
124
|
+
});
|
|
125
|
+
return null;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
//#endregion
|
|
129
|
+
export { Link, LinkBase, MarkdownLink, PathResolverProvider, usePathResolver };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ForwardedRef, ReactNode } from "react";
|
|
2
|
+
import * as react_jsx_runtime45 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/list/list-item.d.ts
|
|
5
|
+
type ListItemElement = 'li' | 'dd' | 'dt' | 'div' | 'span';
|
|
6
|
+
type ListItemProps<T extends ListItemElement = 'li'> = Omit<ComponentPropsWithoutRef<T>, 'children'> & {
|
|
7
|
+
/**
|
|
8
|
+
* The element type to render.
|
|
9
|
+
* Falls back to the defaultItemElement from ListRoot context, or 'li'.
|
|
10
|
+
*/
|
|
11
|
+
render?: T;
|
|
12
|
+
/**
|
|
13
|
+
* The content of the list item.
|
|
14
|
+
*/
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
declare function ListItemImpl<T extends ListItemElement = 'li'>(props: ListItemProps<T>, ref: ForwardedRef<HTMLElement>): react_jsx_runtime45.JSX.Element;
|
|
18
|
+
declare const ListItem: <T extends ListItemElement = "li">(props: ListItemProps<T> & {
|
|
19
|
+
ref?: ForwardedRef<HTMLElement>;
|
|
20
|
+
}) => ReturnType<typeof ListItemImpl>;
|
|
21
|
+
declare namespace ListItem {
|
|
22
|
+
type Props<T extends ListItemElement = 'li'> = ListItemProps<T>;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/list/list-root-context.d.ts
|
|
26
|
+
interface ListRootContextValue {
|
|
27
|
+
/**
|
|
28
|
+
* Default element type for list items.
|
|
29
|
+
* @default 'li'
|
|
30
|
+
*/
|
|
31
|
+
defaultItemElement: 'li' | 'dd' | 'dt' | 'div' | 'span';
|
|
32
|
+
/**
|
|
33
|
+
* Default className to apply to all list items.
|
|
34
|
+
*/
|
|
35
|
+
defaultItemClassName?: string;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/list/list-root.d.ts
|
|
39
|
+
type ListRootElement = 'ul' | 'ol' | 'dl' | 'div' | 'menu' | 'nav';
|
|
40
|
+
type ListRootProps<T extends ListRootElement = 'ul'> = Omit<ComponentPropsWithoutRef<T>, 'children'> & {
|
|
41
|
+
/**
|
|
42
|
+
* The element type to render.
|
|
43
|
+
* @default 'ul'
|
|
44
|
+
*/
|
|
45
|
+
render?: T;
|
|
46
|
+
/**
|
|
47
|
+
* The content of the list.
|
|
48
|
+
*/
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Default element type for list items.
|
|
52
|
+
* When render is 'dl', defaults to 'dd'. Otherwise defaults to 'li'.
|
|
53
|
+
*/
|
|
54
|
+
defaultItemElement?: ListRootContextValue['defaultItemElement'];
|
|
55
|
+
/**
|
|
56
|
+
* Default className to apply to all list items.
|
|
57
|
+
*/
|
|
58
|
+
defaultItemClassName?: string;
|
|
59
|
+
};
|
|
60
|
+
declare function ListRootImpl<T extends ListRootElement = 'ul'>(props: ListRootProps<T>, ref: ForwardedRef<HTMLElement>): react_jsx_runtime45.JSX.Element;
|
|
61
|
+
declare const ListRoot: <T extends ListRootElement = "ul">(props: ListRootProps<T> & {
|
|
62
|
+
ref?: ForwardedRef<HTMLElement>;
|
|
63
|
+
}) => ReturnType<typeof ListRootImpl>;
|
|
64
|
+
declare namespace ListRoot {
|
|
65
|
+
type Props<T extends ListRootElement = 'ul'> = ListRootProps<T>;
|
|
66
|
+
}
|
|
67
|
+
declare namespace index_parts_d_exports {
|
|
68
|
+
export { ListItem as Item, ListRoot as Root };
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { index_parts_d_exports as List, type ListItemProps, type ListRootContextValue, type ListRootProps };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { t as __exportAll } from "../chunk-BTpB_u-K.mjs";
|
|
2
|
+
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/list/list-root-context.ts
|
|
6
|
+
const ListRootContext = createContext(void 0);
|
|
7
|
+
function useListRootContext() {
|
|
8
|
+
return useContext(ListRootContext);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/list/list-item.tsx
|
|
13
|
+
function ListItemImpl(props, ref) {
|
|
14
|
+
const context = useListRootContext();
|
|
15
|
+
const { render, children, className, ...elementProps } = props;
|
|
16
|
+
return /* @__PURE__ */ jsx(render ?? context?.defaultItemElement ?? "li", {
|
|
17
|
+
className: context?.defaultItemClassName ? className ? `${context.defaultItemClassName} ${className}` : context.defaultItemClassName : className,
|
|
18
|
+
ref,
|
|
19
|
+
...elementProps,
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const ListItem = forwardRef(ListItemImpl);
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/list/list-root.tsx
|
|
27
|
+
function ListRootImpl(props, ref) {
|
|
28
|
+
const { render = "ul", children, defaultItemElement, defaultItemClassName, ...elementProps } = props;
|
|
29
|
+
const resolvedDefaultItemElement = defaultItemElement ?? (render === "dl" ? "dd" : "li");
|
|
30
|
+
const contextValue = useMemo(() => ({
|
|
31
|
+
defaultItemClassName,
|
|
32
|
+
defaultItemElement: resolvedDefaultItemElement
|
|
33
|
+
}), [resolvedDefaultItemElement, defaultItemClassName]);
|
|
34
|
+
const Component = render;
|
|
35
|
+
return /* @__PURE__ */ jsx(ListRootContext.Provider, {
|
|
36
|
+
value: contextValue,
|
|
37
|
+
children: /* @__PURE__ */ jsx(Component, {
|
|
38
|
+
ref,
|
|
39
|
+
...elementProps,
|
|
40
|
+
children
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const ListRoot = forwardRef(ListRootImpl);
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/list/index.parts.ts
|
|
48
|
+
var index_parts_exports = /* @__PURE__ */ __exportAll({
|
|
49
|
+
Item: () => ListItem,
|
|
50
|
+
Root: () => ListRoot
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { index_parts_exports as List };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarkdownToJSX } from "markdown-to-jsx";
|
|
3
|
+
|
|
4
|
+
//#region src/markdown-container/markdown-container.d.ts
|
|
5
|
+
declare function transformLink(to: string | Partial<{
|
|
6
|
+
pathname?: string;
|
|
7
|
+
search?: string;
|
|
8
|
+
hash?: string;
|
|
9
|
+
}> | undefined): string;
|
|
10
|
+
type MDXComponent<P = object> = React.ComponentType<P>;
|
|
11
|
+
type MarkdownOverrides = MarkdownToJSX.Options['overrides'];
|
|
12
|
+
type MarkdownContainerProps = React.PropsWithChildren<{
|
|
13
|
+
characters?: number;
|
|
14
|
+
className?: string;
|
|
15
|
+
locale: string;
|
|
16
|
+
paragraphs?: number;
|
|
17
|
+
sentences?: number;
|
|
18
|
+
mdxComponents?: Record<string, MDXComponent>;
|
|
19
|
+
markdownOverrides?: MarkdownOverrides;
|
|
20
|
+
}>;
|
|
21
|
+
declare const MarkdownContainer: React.FC<MarkdownContainerProps>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { type MDXComponent, MarkdownContainer, type MarkdownContainerProps, type MarkdownOverrides, transformLink };
|