@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
package/dist/if/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
type Condition<Value = unknown> = Value | false | null | undefined | 0 | '';
|
|
4
|
-
declare function If<Value = unknown>({ condition, children, fallback, }: React.PropsWithoutRef<{
|
|
5
|
-
condition: Condition<Value>;
|
|
6
|
-
children: React.ReactNode | ((value: Value) => React.ReactNode);
|
|
7
|
-
fallback?: React.ReactNode;
|
|
8
|
-
}>): react_jsx_runtime.JSX.Element | null;
|
|
9
|
-
|
|
10
|
-
export { If };
|
package/dist/if/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
// src/if/if.tsx
|
|
5
|
-
function If({
|
|
6
|
-
condition,
|
|
7
|
-
children,
|
|
8
|
-
fallback
|
|
9
|
-
}) {
|
|
10
|
-
return useMemo(() => {
|
|
11
|
-
if (condition) {
|
|
12
|
-
if (typeof children === "function") {
|
|
13
|
-
return /* @__PURE__ */ jsx(Fragment, { children: children(condition) });
|
|
14
|
-
}
|
|
15
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
16
|
-
}
|
|
17
|
-
if (fallback) {
|
|
18
|
-
return /* @__PURE__ */ jsx(Fragment, { children: fallback });
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}, [condition, fallback, children]);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { If };
|
package/dist/iframe/index.d.ts
DELETED
package/dist/iframe/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { cn } from '@regardio/tailwind/utils';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
// src/iframe/iframe.tsx
|
|
5
|
-
var Iframe = ({ src, title, className }) => /* @__PURE__ */ jsx(
|
|
6
|
-
"iframe",
|
|
7
|
-
{
|
|
8
|
-
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
|
|
9
|
-
allowFullScreen: true,
|
|
10
|
-
className: cn("w-full aspect-video border-0", className),
|
|
11
|
-
loading: "lazy",
|
|
12
|
-
src,
|
|
13
|
-
title
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
export { Iframe };
|
package/dist/link/index.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import { NavLinkProps } from 'react-router';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Context for providing a path resolver function.
|
|
7
|
-
* This allows projects to inject their own localization logic.
|
|
8
|
-
*/
|
|
9
|
-
type PathResolver = (routeKey: string) => string;
|
|
10
|
-
declare const PathResolverProvider: react.Provider<PathResolver | null>;
|
|
11
|
-
declare function usePathResolver(): PathResolver | null;
|
|
12
|
-
interface LinkBaseProps extends Omit<NavLinkProps, 'to'> {
|
|
13
|
-
to?: string | Partial<{
|
|
14
|
-
pathname?: string;
|
|
15
|
-
search?: string;
|
|
16
|
-
hash?: string;
|
|
17
|
-
}> | undefined;
|
|
18
|
-
routeKey?: string;
|
|
19
|
-
viewTransition?: boolean;
|
|
20
|
-
}
|
|
21
|
-
declare const LinkBase: ({ className, to, routeKey, children, onClick, viewTransition, ...props }: LinkBaseProps) => react_jsx_runtime.JSX.Element;
|
|
22
|
-
declare const arrowVariants: {
|
|
23
|
-
readonly darr: "darr";
|
|
24
|
-
readonly larr: "larr";
|
|
25
|
-
readonly rarr: "rarr";
|
|
26
|
-
readonly uarr: "uarr";
|
|
27
|
-
};
|
|
28
|
-
declare const linkVariants: {
|
|
29
|
-
readonly button: readonly ["block", "button", "mt-s", "relative", "rarr", "text-right", "text-sm", "tracking-wider", "uppercase"];
|
|
30
|
-
readonly code: readonly ["font-monospace"];
|
|
31
|
-
readonly link: readonly ["rarr", "!bg-transparent", "uppercase", "!tracking-wider"];
|
|
32
|
-
readonly navtitle: readonly ["block", "uppercase", "tracking-wider"];
|
|
33
|
-
readonly primary: readonly [];
|
|
34
|
-
readonly subtitle: readonly ["text-lg"];
|
|
35
|
-
};
|
|
36
|
-
type LinkArrow = keyof typeof arrowVariants;
|
|
37
|
-
type LinkVariant = keyof typeof linkVariants;
|
|
38
|
-
interface LinkProps extends Omit<NavLinkProps, 'to'> {
|
|
39
|
-
arrow?: LinkArrow;
|
|
40
|
-
to?: string | Partial<{
|
|
41
|
-
pathname?: string;
|
|
42
|
-
search?: string;
|
|
43
|
-
hash?: string;
|
|
44
|
-
}>;
|
|
45
|
-
routeKey?: string;
|
|
46
|
-
variant?: LinkVariant;
|
|
47
|
-
viewTransition?: boolean;
|
|
48
|
-
}
|
|
49
|
-
declare const Link: ({ arrow, children, className, routeKey, to, variant, viewTransition, ...props }: LinkProps) => react_jsx_runtime.JSX.Element;
|
|
50
|
-
interface MarkdownLinkProps extends Omit<LinkProps, 'to'> {
|
|
51
|
-
href?: string;
|
|
52
|
-
}
|
|
53
|
-
declare const MarkdownLink: React.FC<MarkdownLinkProps>;
|
|
54
|
-
|
|
55
|
-
export { Link, LinkBase, type LinkBaseProps, type LinkProps, MarkdownLink, type MarkdownLinkProps, type PathResolver, PathResolverProvider, usePathResolver };
|
package/dist/link/index.js
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { tv } from '@regardio/tailwind/utils';
|
|
2
|
-
import React, { createContext, useContext, useCallback, isValidElement, cloneElement } from 'react';
|
|
3
|
-
import { NavLink } from 'react-router';
|
|
4
|
-
import '@regardio/js/text';
|
|
5
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
// src/link/link.tsx
|
|
8
|
-
var lowerCaseSzett = (text, _returnType) => {
|
|
9
|
-
const processString = (str) => {
|
|
10
|
-
const parts = str.split(/(ß)/g);
|
|
11
|
-
return parts.map(
|
|
12
|
-
(part, index) => part === "\xDF" ? /* @__PURE__ */ jsx(
|
|
13
|
-
"span",
|
|
14
|
-
{
|
|
15
|
-
className: "lowercase",
|
|
16
|
-
children: part
|
|
17
|
-
},
|
|
18
|
-
index.toString()
|
|
19
|
-
) : part
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
if (typeof text === "string") {
|
|
23
|
-
return processString(text);
|
|
24
|
-
}
|
|
25
|
-
if (isValidElement(text)) {
|
|
26
|
-
const element = text;
|
|
27
|
-
const { children, ...props } = element.props;
|
|
28
|
-
return cloneElement(element, {
|
|
29
|
-
...props,
|
|
30
|
-
children: lowerCaseSzett(children)
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
if (Array.isArray(text)) {
|
|
34
|
-
return text.map((child, index) => /* @__PURE__ */ jsx(React.Fragment, { children: lowerCaseSzett(child) }, index.toString()));
|
|
35
|
-
}
|
|
36
|
-
return text;
|
|
37
|
-
};
|
|
38
|
-
var PathResolverContext = createContext(null);
|
|
39
|
-
var PathResolverProvider = PathResolverContext.Provider;
|
|
40
|
-
function usePathResolver() {
|
|
41
|
-
return useContext(PathResolverContext);
|
|
42
|
-
}
|
|
43
|
-
var LinkBase = ({
|
|
44
|
-
className,
|
|
45
|
-
to,
|
|
46
|
-
routeKey,
|
|
47
|
-
children,
|
|
48
|
-
onClick,
|
|
49
|
-
viewTransition = true,
|
|
50
|
-
...props
|
|
51
|
-
}) => {
|
|
52
|
-
const pathResolver = usePathResolver();
|
|
53
|
-
let path;
|
|
54
|
-
if (routeKey && pathResolver) {
|
|
55
|
-
path = pathResolver(routeKey);
|
|
56
|
-
} else if (typeof to === "string") {
|
|
57
|
-
path = to;
|
|
58
|
-
} else {
|
|
59
|
-
path = to?.pathname ?? "";
|
|
60
|
-
if (to?.search) path += to.search;
|
|
61
|
-
if (to?.hash) path += to.hash;
|
|
62
|
-
}
|
|
63
|
-
const isExternal = path.startsWith("tel:") || path.startsWith("mailto:") || path.startsWith("#") || path.startsWith("http");
|
|
64
|
-
const handleClick = useCallback(
|
|
65
|
-
(event) => {
|
|
66
|
-
onClick?.(event);
|
|
67
|
-
if (event.defaultPrevented) return;
|
|
68
|
-
if (path.startsWith("tel:") || path.startsWith("mailto:")) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (path.startsWith("#")) {
|
|
72
|
-
event.preventDefault();
|
|
73
|
-
const element = document.getElementById(path.substring(1));
|
|
74
|
-
if (element) {
|
|
75
|
-
element.scrollIntoView({ behavior: "smooth" });
|
|
76
|
-
}
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (path.startsWith("http")) {
|
|
80
|
-
event.preventDefault();
|
|
81
|
-
window.open(path, "_blank", "noopener,noreferrer");
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
[onClick, path]
|
|
86
|
-
);
|
|
87
|
-
if (!path) {
|
|
88
|
-
return /* @__PURE__ */ jsx(Fragment, { children: typeof children === "function" ? null : children });
|
|
89
|
-
}
|
|
90
|
-
if (isExternal) {
|
|
91
|
-
const externalState = {
|
|
92
|
-
isActive: false,
|
|
93
|
-
isPending: false,
|
|
94
|
-
isTransitioning: false
|
|
95
|
-
};
|
|
96
|
-
const resolvedClassName = typeof className === "function" ? className(externalState) : className;
|
|
97
|
-
const resolvedStyle = typeof props.style === "function" ? props.style(externalState) : props.style;
|
|
98
|
-
return /* @__PURE__ */ jsx(
|
|
99
|
-
"a",
|
|
100
|
-
{
|
|
101
|
-
className: resolvedClassName,
|
|
102
|
-
href: path,
|
|
103
|
-
onClick: handleClick,
|
|
104
|
-
style: resolvedStyle,
|
|
105
|
-
children: typeof children === "function" ? children(externalState) : children
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
return /* @__PURE__ */ jsx(
|
|
110
|
-
NavLink,
|
|
111
|
-
{
|
|
112
|
-
...props,
|
|
113
|
-
className,
|
|
114
|
-
onClick: handleClick,
|
|
115
|
-
to: path,
|
|
116
|
-
viewTransition,
|
|
117
|
-
children
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
};
|
|
121
|
-
var arrowVariants = {
|
|
122
|
-
darr: "darr",
|
|
123
|
-
larr: "larr",
|
|
124
|
-
rarr: "rarr",
|
|
125
|
-
uarr: "uarr"
|
|
126
|
-
};
|
|
127
|
-
var linkVariants = {
|
|
128
|
-
button: [
|
|
129
|
-
"block",
|
|
130
|
-
"button",
|
|
131
|
-
"mt-s",
|
|
132
|
-
"relative",
|
|
133
|
-
"rarr",
|
|
134
|
-
"text-right",
|
|
135
|
-
"text-sm",
|
|
136
|
-
"tracking-wider",
|
|
137
|
-
"uppercase"
|
|
138
|
-
],
|
|
139
|
-
code: ["font-monospace"],
|
|
140
|
-
link: ["rarr", "!bg-transparent", "uppercase", "!tracking-wider"],
|
|
141
|
-
navtitle: ["block", "uppercase", "tracking-wider"],
|
|
142
|
-
primary: [],
|
|
143
|
-
subtitle: ["text-lg"]
|
|
144
|
-
};
|
|
145
|
-
var link = tv({
|
|
146
|
-
base: [],
|
|
147
|
-
defaultVariants: {
|
|
148
|
-
variant: "primary"
|
|
149
|
-
},
|
|
150
|
-
variants: {
|
|
151
|
-
arrow: arrowVariants,
|
|
152
|
-
variant: linkVariants
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
var Link = ({
|
|
156
|
-
arrow,
|
|
157
|
-
children,
|
|
158
|
-
className,
|
|
159
|
-
routeKey,
|
|
160
|
-
to,
|
|
161
|
-
variant,
|
|
162
|
-
viewTransition,
|
|
163
|
-
...props
|
|
164
|
-
}) => {
|
|
165
|
-
return /* @__PURE__ */ jsx(
|
|
166
|
-
LinkBase,
|
|
167
|
-
{
|
|
168
|
-
...props,
|
|
169
|
-
className: link({
|
|
170
|
-
arrow,
|
|
171
|
-
className: typeof className === "string" ? className : void 0,
|
|
172
|
-
variant
|
|
173
|
-
}),
|
|
174
|
-
routeKey,
|
|
175
|
-
to,
|
|
176
|
-
viewTransition,
|
|
177
|
-
children: lowerCaseSzett(children)
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
};
|
|
181
|
-
var MarkdownLink = ({ children, href, ...props }) => {
|
|
182
|
-
if (href) {
|
|
183
|
-
return /* @__PURE__ */ jsx(
|
|
184
|
-
Link,
|
|
185
|
-
{
|
|
186
|
-
to: href,
|
|
187
|
-
...props,
|
|
188
|
-
children
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
return null;
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
export { Link, LinkBase, MarkdownLink, PathResolverProvider, usePathResolver };
|
package/dist/list/index.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ComponentPropsWithoutRef, ReactNode, ForwardedRef } from 'react';
|
|
3
|
-
|
|
4
|
-
type ListItemElement = 'li' | 'dd' | 'dt' | 'div' | 'span';
|
|
5
|
-
type ListItemProps<T extends ListItemElement = 'li'> = Omit<ComponentPropsWithoutRef<T>, 'children'> & {
|
|
6
|
-
/**
|
|
7
|
-
* The element type to render.
|
|
8
|
-
* Falls back to the defaultItemElement from ListRoot context, or 'li'.
|
|
9
|
-
*/
|
|
10
|
-
render?: T;
|
|
11
|
-
/**
|
|
12
|
-
* The content of the list item.
|
|
13
|
-
*/
|
|
14
|
-
children?: ReactNode;
|
|
15
|
-
};
|
|
16
|
-
declare function ListItemImpl<T extends ListItemElement = 'li'>(props: ListItemProps<T>, ref: ForwardedRef<HTMLElement>): react_jsx_runtime.JSX.Element;
|
|
17
|
-
declare const ListItem: <T extends ListItemElement = "li">(props: ListItemProps<T> & {
|
|
18
|
-
ref?: ForwardedRef<HTMLElement>;
|
|
19
|
-
}) => ReturnType<typeof ListItemImpl>;
|
|
20
|
-
declare namespace ListItem {
|
|
21
|
-
type Props<T extends ListItemElement = 'li'> = ListItemProps<T>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface ListRootContextValue {
|
|
25
|
-
/**
|
|
26
|
-
* Default element type for list items.
|
|
27
|
-
* @default 'li'
|
|
28
|
-
*/
|
|
29
|
-
defaultItemElement: 'li' | 'dd' | 'dt' | 'div' | 'span';
|
|
30
|
-
/**
|
|
31
|
-
* Default className to apply to all list items.
|
|
32
|
-
*/
|
|
33
|
-
defaultItemClassName?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
type ListRootElement = 'ul' | 'ol' | 'dl' | 'div' | 'menu' | 'nav';
|
|
37
|
-
type ListRootProps<T extends ListRootElement = 'ul'> = Omit<ComponentPropsWithoutRef<T>, 'children'> & {
|
|
38
|
-
/**
|
|
39
|
-
* The element type to render.
|
|
40
|
-
* @default 'ul'
|
|
41
|
-
*/
|
|
42
|
-
render?: T;
|
|
43
|
-
/**
|
|
44
|
-
* The content of the list.
|
|
45
|
-
*/
|
|
46
|
-
children?: ReactNode;
|
|
47
|
-
/**
|
|
48
|
-
* Default element type for list items.
|
|
49
|
-
* When render is 'dl', defaults to 'dd'. Otherwise defaults to 'li'.
|
|
50
|
-
*/
|
|
51
|
-
defaultItemElement?: ListRootContextValue['defaultItemElement'];
|
|
52
|
-
/**
|
|
53
|
-
* Default className to apply to all list items.
|
|
54
|
-
*/
|
|
55
|
-
defaultItemClassName?: string;
|
|
56
|
-
};
|
|
57
|
-
declare function ListRootImpl<T extends ListRootElement = 'ul'>(props: ListRootProps<T>, ref: ForwardedRef<HTMLElement>): react_jsx_runtime.JSX.Element;
|
|
58
|
-
declare const ListRoot: <T extends ListRootElement = "ul">(props: ListRootProps<T> & {
|
|
59
|
-
ref?: ForwardedRef<HTMLElement>;
|
|
60
|
-
}) => ReturnType<typeof ListRootImpl>;
|
|
61
|
-
declare namespace ListRoot {
|
|
62
|
-
type Props<T extends ListRootElement = 'ul'> = ListRootProps<T>;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
declare namespace index_parts {
|
|
66
|
-
export { ListItem as Item, ListRoot as Root };
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export { index_parts as List, type ListItemProps, type ListRootContextValue, type ListRootProps };
|
package/dist/list/index.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { createContext, forwardRef, useMemo, useContext } from 'react';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
// src/list/index.parts.ts
|
|
11
|
-
var index_parts_exports = {};
|
|
12
|
-
__export(index_parts_exports, {
|
|
13
|
-
Item: () => ListItem,
|
|
14
|
-
Root: () => ListRoot
|
|
15
|
-
});
|
|
16
|
-
var ListRootContext = createContext(void 0);
|
|
17
|
-
function useListRootContext() {
|
|
18
|
-
return useContext(ListRootContext);
|
|
19
|
-
}
|
|
20
|
-
function ListItemImpl(props, ref) {
|
|
21
|
-
const context = useListRootContext();
|
|
22
|
-
const { render, children, className, ...elementProps } = props;
|
|
23
|
-
const resolvedElement = render ?? context?.defaultItemElement ?? "li";
|
|
24
|
-
const resolvedClassName = context?.defaultItemClassName ? className ? `${context.defaultItemClassName} ${className}` : context.defaultItemClassName : className;
|
|
25
|
-
const Component = resolvedElement;
|
|
26
|
-
return /* @__PURE__ */ jsx(
|
|
27
|
-
Component,
|
|
28
|
-
{
|
|
29
|
-
className: resolvedClassName,
|
|
30
|
-
ref,
|
|
31
|
-
...elementProps,
|
|
32
|
-
children
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
var ListItem = forwardRef(ListItemImpl);
|
|
37
|
-
function ListRootImpl(props, ref) {
|
|
38
|
-
const {
|
|
39
|
-
render = "ul",
|
|
40
|
-
children,
|
|
41
|
-
defaultItemElement,
|
|
42
|
-
defaultItemClassName,
|
|
43
|
-
...elementProps
|
|
44
|
-
} = props;
|
|
45
|
-
const resolvedDefaultItemElement = defaultItemElement ?? (render === "dl" ? "dd" : "li");
|
|
46
|
-
const contextValue = useMemo(
|
|
47
|
-
() => ({
|
|
48
|
-
defaultItemClassName,
|
|
49
|
-
defaultItemElement: resolvedDefaultItemElement
|
|
50
|
-
}),
|
|
51
|
-
[resolvedDefaultItemElement, defaultItemClassName]
|
|
52
|
-
);
|
|
53
|
-
const Component = render;
|
|
54
|
-
return /* @__PURE__ */ jsx(ListRootContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
55
|
-
Component,
|
|
56
|
-
{
|
|
57
|
-
ref,
|
|
58
|
-
...elementProps,
|
|
59
|
-
children
|
|
60
|
-
}
|
|
61
|
-
) });
|
|
62
|
-
}
|
|
63
|
-
var ListRoot = forwardRef(ListRootImpl);
|
|
64
|
-
|
|
65
|
-
export { index_parts_exports as List };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { MarkdownToJSX } from 'markdown-to-jsx';
|
|
2
|
-
import react__default from 'react';
|
|
3
|
-
|
|
4
|
-
declare function transformLink(to: string | Partial<{
|
|
5
|
-
pathname?: string;
|
|
6
|
-
search?: string;
|
|
7
|
-
hash?: string;
|
|
8
|
-
}> | undefined): string;
|
|
9
|
-
type MDXComponent<P = object> = react__default.ComponentType<P>;
|
|
10
|
-
type MarkdownOverrides = MarkdownToJSX.Options['overrides'];
|
|
11
|
-
type MarkdownContainerProps = react__default.PropsWithChildren<{
|
|
12
|
-
characters?: number;
|
|
13
|
-
className?: string;
|
|
14
|
-
locale: string;
|
|
15
|
-
paragraphs?: number;
|
|
16
|
-
sentences?: number;
|
|
17
|
-
mdxComponents?: Record<string, MDXComponent>;
|
|
18
|
-
markdownOverrides?: MarkdownOverrides;
|
|
19
|
-
}>;
|
|
20
|
-
declare const MarkdownContainer: react__default.FC<MarkdownContainerProps>;
|
|
21
|
-
|
|
22
|
-
export { type MDXComponent, MarkdownContainer, type MarkdownContainerProps, type MarkdownOverrides, transformLink };
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { MDXProvider } from '@mdx-js/react';
|
|
2
|
-
import { cn } from '@regardio/tailwind/utils';
|
|
3
|
-
import Markdown from 'markdown-to-jsx';
|
|
4
|
-
import { typographicQuotes, replaceShyInString } from '@regardio/js/text';
|
|
5
|
-
import React, { isValidElement, cloneElement } from 'react';
|
|
6
|
-
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
// src/markdown-container/markdown-container.tsx
|
|
9
|
-
function replaceShyInReactNode(node) {
|
|
10
|
-
if (typeof node === "string") {
|
|
11
|
-
return node.replace(/\u00AD/g, "");
|
|
12
|
-
}
|
|
13
|
-
if (isValidElement(node)) {
|
|
14
|
-
const element = node;
|
|
15
|
-
const { children, ...props } = element.props;
|
|
16
|
-
return cloneElement(element, {
|
|
17
|
-
...props,
|
|
18
|
-
children: replaceShyInReactNode(children)
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
if (Array.isArray(node)) {
|
|
22
|
-
return node.map((child, index) => /* @__PURE__ */ jsx(React.Fragment, { children: replaceShyInReactNode(child) }, index.toString()));
|
|
23
|
-
}
|
|
24
|
-
return node;
|
|
25
|
-
}
|
|
26
|
-
function shy(input) {
|
|
27
|
-
if (input === null) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
if (typeof input === "string") {
|
|
31
|
-
return replaceShyInString(input);
|
|
32
|
-
}
|
|
33
|
-
return replaceShyInReactNode(input);
|
|
34
|
-
}
|
|
35
|
-
function replaceSpecialChars(text, locale) {
|
|
36
|
-
return shy(typographicQuotes(text, locale));
|
|
37
|
-
}
|
|
38
|
-
var doubleNewlineRegex = /\n\n+/;
|
|
39
|
-
function processTextOutsideMDXComponents(text, locale) {
|
|
40
|
-
const mdxTagRegex = /(<\/?[A-Za-z][^>]*>)/g;
|
|
41
|
-
return text.split(mdxTagRegex).map((part) => mdxTagRegex.test(part) ? part : replaceSpecialChars(part, locale)).join("");
|
|
42
|
-
}
|
|
43
|
-
function transformLink(to) {
|
|
44
|
-
const targetDomainSubstring = "regard";
|
|
45
|
-
if (typeof to === "string") {
|
|
46
|
-
try {
|
|
47
|
-
const url = new URL(to);
|
|
48
|
-
if (url.hostname.includes(targetDomainSubstring)) {
|
|
49
|
-
return url.pathname + (url.search ?? "") + (url.hash ?? "");
|
|
50
|
-
}
|
|
51
|
-
return to;
|
|
52
|
-
} catch {
|
|
53
|
-
return to;
|
|
54
|
-
}
|
|
55
|
-
} else if (to?.pathname) {
|
|
56
|
-
return to.pathname + (to.search ?? "") + (to.hash ?? "");
|
|
57
|
-
}
|
|
58
|
-
return "";
|
|
59
|
-
}
|
|
60
|
-
var truncateText = (text, maxSentences, maxCharacters, maxParagraphs) => {
|
|
61
|
-
if (maxSentences === void 0 && maxCharacters === void 0 && maxParagraphs === void 0) {
|
|
62
|
-
return text;
|
|
63
|
-
}
|
|
64
|
-
const paragraphs = text.split(doubleNewlineRegex);
|
|
65
|
-
let truncatedText = "";
|
|
66
|
-
let charCount = 0;
|
|
67
|
-
let sentenceCount = 0;
|
|
68
|
-
let paragraphCount = 0;
|
|
69
|
-
for (const paragraph of paragraphs) {
|
|
70
|
-
if (maxParagraphs !== void 0 && paragraphCount >= maxParagraphs) {
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
const sentenceRegex = /(?<!\.\.\.)(?<!\b\w\.)\.(?:\s+|\n+)/g;
|
|
74
|
-
const parts = paragraph.split(sentenceRegex);
|
|
75
|
-
const delimiters = paragraph.match(sentenceRegex) || [];
|
|
76
|
-
for (let i = 0; i < parts.length; i++) {
|
|
77
|
-
const part = parts[i];
|
|
78
|
-
const delimiter = delimiters[i] || "";
|
|
79
|
-
if (part !== void 0) {
|
|
80
|
-
if ((maxSentences === void 0 || sentenceCount < maxSentences) && (maxCharacters === void 0 || charCount + part.length + delimiter.length <= maxCharacters)) {
|
|
81
|
-
truncatedText += part + delimiter;
|
|
82
|
-
charCount += part.length + delimiter.length;
|
|
83
|
-
if (delimiter.includes(".")) {
|
|
84
|
-
sentenceCount++;
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
paragraphCount++;
|
|
92
|
-
if (maxSentences !== void 0 && sentenceCount >= maxSentences || maxCharacters !== void 0 && charCount >= maxCharacters) {
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
if (paragraphCount < paragraphs.length) {
|
|
96
|
-
truncatedText += "\n\n";
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return truncatedText.trim();
|
|
100
|
-
};
|
|
101
|
-
var MarkdownContainer = (props) => {
|
|
102
|
-
const rawText = props.children?.toString() || "";
|
|
103
|
-
let processedText = processTextOutsideMDXComponents(rawText, props.locale);
|
|
104
|
-
const shouldTruncate = Number.isInteger(props.sentences) || Number.isInteger(props.characters) || Number.isInteger(props.paragraphs);
|
|
105
|
-
if (shouldTruncate) {
|
|
106
|
-
processedText = truncateText(
|
|
107
|
-
processedText,
|
|
108
|
-
props.sentences,
|
|
109
|
-
props.characters,
|
|
110
|
-
props.paragraphs
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
return /* @__PURE__ */ jsx(MDXProvider, { components: props.mdxComponents, children: /* @__PURE__ */ jsx(
|
|
114
|
-
Markdown,
|
|
115
|
-
{
|
|
116
|
-
className: cn("markdown", props.className),
|
|
117
|
-
options: {
|
|
118
|
-
disableParsingRawHTML: false,
|
|
119
|
-
forceWrapper: true,
|
|
120
|
-
tagfilter: false,
|
|
121
|
-
...props.markdownOverrides ? { overrides: props.markdownOverrides } : {}
|
|
122
|
-
},
|
|
123
|
-
children: processedText
|
|
124
|
-
}
|
|
125
|
-
) });
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
export { MarkdownContainer, transformLink };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Input } from '@base-ui/react/input';
|
|
3
|
-
|
|
4
|
-
interface InputProps extends React.ComponentPropsWithoutRef<typeof Input> {
|
|
5
|
-
}
|
|
6
|
-
interface PasswordInputProps extends InputProps {
|
|
7
|
-
className?: string;
|
|
8
|
-
}
|
|
9
|
-
declare const PasswordInput: ({ className, ...props }: PasswordInputProps) => react_jsx_runtime.JSX.Element;
|
|
10
|
-
|
|
11
|
-
export { type InputProps, PasswordInput, type PasswordInputProps };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Button } from '@base-ui/react/button';
|
|
2
|
-
import { Input } from '@base-ui/react/input';
|
|
3
|
-
import { cn } from '@regardio/tailwind/utils';
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
// src/password-input/password-input.tsx
|
|
8
|
-
var PasswordInput = ({ className, ...props }) => {
|
|
9
|
-
const [showPassword, setShowPassword] = useState(false);
|
|
10
|
-
const togglePasswordVisibility = () => {
|
|
11
|
-
setShowPassword(!showPassword);
|
|
12
|
-
};
|
|
13
|
-
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
14
|
-
/* @__PURE__ */ jsx(
|
|
15
|
-
Input,
|
|
16
|
-
{
|
|
17
|
-
autoComplete: "off",
|
|
18
|
-
className: cn(className),
|
|
19
|
-
type: showPassword ? "text" : "password",
|
|
20
|
-
...props
|
|
21
|
-
}
|
|
22
|
-
),
|
|
23
|
-
/* @__PURE__ */ jsx(
|
|
24
|
-
Button,
|
|
25
|
-
{
|
|
26
|
-
className: cn(
|
|
27
|
-
"absolute",
|
|
28
|
-
"right-[14px]",
|
|
29
|
-
"top-[35px]",
|
|
30
|
-
"flex",
|
|
31
|
-
"h-6",
|
|
32
|
-
"w-[20px]",
|
|
33
|
-
"cursor-pointer",
|
|
34
|
-
"flex-col",
|
|
35
|
-
"items-end",
|
|
36
|
-
"justify-center",
|
|
37
|
-
"text-gray-500"
|
|
38
|
-
),
|
|
39
|
-
onClick: togglePasswordVisibility,
|
|
40
|
-
children: showPassword ? "Off" : "On"
|
|
41
|
-
}
|
|
42
|
-
)
|
|
43
|
-
] });
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export { PasswordInput };
|