@febkosq8/arc 0.3.0 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -5
- package/components/index.css +263 -114
- package/dist/arc.js +1115 -0
- package/dist/avatar.d.ts +18 -0
- package/dist/button-double-click.d.ts +18 -0
- package/dist/button-group.d.ts +8 -0
- package/dist/button-long-press.d.ts +20 -0
- package/dist/button.d.ts +21 -0
- package/dist/card.d.ts +17 -0
- package/dist/date-handler.d.ts +13 -0
- package/dist/divider.d.ts +2 -0
- package/dist/dropdown-multi.d.ts +16 -0
- package/dist/dropdown.d.ts +19 -0
- package/dist/error-text.d.ts +5 -0
- package/dist/hash-navigation.d.ts +34 -0
- package/dist/index.d.ts +41 -0
- package/dist/input-timestamp.d.ts +7 -0
- package/dist/input.d.ts +19 -0
- package/dist/menu.d.ts +29 -0
- package/dist/modal.d.ts +15 -0
- package/dist/pill-link.d.ts +8 -0
- package/dist/pill.d.ts +5 -0
- package/dist/preview-card.d.ts +12 -0
- package/dist/select.d.ts +18 -0
- package/dist/switch.d.ts +10 -0
- package/dist/tag.d.ts +6 -0
- package/dist/text-link.d.ts +6 -0
- package/dist/theme-switcher.d.ts +5 -0
- package/dist/typing-animation.d.ts +23 -0
- package/package.json +49 -35
- package/.prettierrc +0 -8
- package/components/button.tsx +0 -42
- package/components/card.tsx +0 -32
- package/components/index.ts +0 -8
- package/components/input.tsx +0 -21
- package/components/menu.tsx +0 -80
- package/components/pill.tsx +0 -20
- package/components/switch.tsx +0 -82
- package/components/text-area.tsx +0 -21
- package/components/theme-switcher.tsx +0 -81
- package/eslint.config.mjs +0 -36
- package/index.html +0 -11
- package/tsconfig.json +0 -27
- package/vite.config.ts +0 -37
package/components/input.tsx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { cx } from "@rinzai/zen";
|
|
2
|
-
import { ComponentPropsWithoutRef } from "react";
|
|
3
|
-
|
|
4
|
-
const Input = ({ className, ...rest }: ComponentPropsWithoutRef<"input">) => {
|
|
5
|
-
return (
|
|
6
|
-
<input
|
|
7
|
-
{...rest}
|
|
8
|
-
autoComplete="off"
|
|
9
|
-
className={cx(
|
|
10
|
-
className,
|
|
11
|
-
"h-10",
|
|
12
|
-
"placeholder:gray-800 rounded border border-border bg-input pl-5 text-foreground",
|
|
13
|
-
"focus:border-transparent focus:outline-none focus:ring-2 focus:ring-ring",
|
|
14
|
-
"disabled:cursor-not-allowed disabled:border-muted",
|
|
15
|
-
"whitespace-pre-wrap",
|
|
16
|
-
)}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default Input;
|
package/components/menu.tsx
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import Pill from "@feb/pill";
|
|
2
|
-
import { faChevronDown, faChevronRight } from "@fortawesome/free-solid-svg-icons";
|
|
3
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
|
-
import * as DropdownBaseMenu from "@radix-ui/react-dropdown-menu";
|
|
5
|
-
import { cx } from "@rinzai/zen";
|
|
6
|
-
import { ReactNode } from "react";
|
|
7
|
-
|
|
8
|
-
interface MenuProps {
|
|
9
|
-
className?: string;
|
|
10
|
-
active?: boolean;
|
|
11
|
-
buttonText: string | ReactNode;
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface MenuComponent extends React.FC<MenuProps> {
|
|
16
|
-
Item: typeof DropdownBaseMenu.Item;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const MenuComponent = ({ className, active, buttonText, children }:MenuProps) => {
|
|
20
|
-
return (
|
|
21
|
-
<DropdownBaseMenu.Root>
|
|
22
|
-
<DropdownBaseMenu.Trigger asChild>
|
|
23
|
-
<Pill active={active} className={cx("w-fit", className)}>
|
|
24
|
-
{buttonText}
|
|
25
|
-
<FontAwesomeIcon icon={faChevronDown} className="-mr-1 ml-2 h-4 w-4" aria-hidden="true" />
|
|
26
|
-
</Pill>
|
|
27
|
-
</DropdownBaseMenu.Trigger>
|
|
28
|
-
<DropdownBaseMenu.Portal>
|
|
29
|
-
<DropdownBaseMenu.Content
|
|
30
|
-
loop={true}
|
|
31
|
-
sideOffset={2}
|
|
32
|
-
className="w-fit origin-top-right divide-y border-2 border-border divide-border rounded-md bg-background shadow-lg ring-1 ring-background ring-opacity-5 focus:outline-none focus-visible:ring-0"
|
|
33
|
-
>
|
|
34
|
-
{children}
|
|
35
|
-
</DropdownBaseMenu.Content>
|
|
36
|
-
</DropdownBaseMenu.Portal>
|
|
37
|
-
</DropdownBaseMenu.Root>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const Menu: MenuComponent = Object.assign(MenuComponent, {
|
|
42
|
-
Item: DropdownBaseMenu.Item,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
interface MenuSubProps {
|
|
46
|
-
active?: boolean;
|
|
47
|
-
buttonText: string;
|
|
48
|
-
children: ReactNode;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const MenuSub = ({ active, buttonText, children }: MenuSubProps) => {
|
|
52
|
-
return (
|
|
53
|
-
<DropdownBaseMenu.Sub>
|
|
54
|
-
<DropdownBaseMenu.SubTrigger asChild>
|
|
55
|
-
<Pill active={active} className="flex w-full items-center justify-between whitespace-nowrap">
|
|
56
|
-
{buttonText}
|
|
57
|
-
<FontAwesomeIcon icon={faChevronRight} className="-mr-1 ml-2 h-4 w-4" aria-hidden="true" />
|
|
58
|
-
</Pill>
|
|
59
|
-
</DropdownBaseMenu.SubTrigger>
|
|
60
|
-
<DropdownBaseMenu.Portal>
|
|
61
|
-
<DropdownBaseMenu.SubContent
|
|
62
|
-
loop={true}
|
|
63
|
-
sideOffset={2}
|
|
64
|
-
arrowPadding={2}
|
|
65
|
-
className="w-fit origin-top-right divide-y border-2 border-gray-600 divide-gray-100 rounded-md bg-neutral-900 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none"
|
|
66
|
-
>
|
|
67
|
-
{children}
|
|
68
|
-
<DropdownBaseMenu.Arrow className="fill-black dark:fill-stone-200 size-2" />
|
|
69
|
-
</DropdownBaseMenu.SubContent>
|
|
70
|
-
</DropdownBaseMenu.Portal>
|
|
71
|
-
</DropdownBaseMenu.Sub>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
Object.assign(Menu, {
|
|
76
|
-
Item: DropdownBaseMenu.Item,
|
|
77
|
-
Sub: MenuSub,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
export default Menu;
|
package/components/pill.tsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { cx } from "@rinzai/zen";
|
|
2
|
-
|
|
3
|
-
interface PillProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
-
active?: boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const Pill = (({ active, className, ...props }:PillProps) => {
|
|
8
|
-
return (
|
|
9
|
-
<button
|
|
10
|
-
className={cx(
|
|
11
|
-
`rounded-md p-3 text-xl font-bold transition inline-flex w-full items-center justify-center text-foreground hover:bg-accent hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-opacity-75 whitespace-nowrap hover:ring-0 hover:outline-none `,
|
|
12
|
-
active ? "text-primary" : "text-muted-foreground",
|
|
13
|
-
className,
|
|
14
|
-
)}
|
|
15
|
-
{...props}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export default Pill;
|
package/components/switch.tsx
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { faCircle } from "@fortawesome/free-solid-svg-icons";
|
|
2
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
3
|
-
import { Switch as SwitchBase } from "@headlessui/react";
|
|
4
|
-
import { cva, cx } from "@rinzai/zen";
|
|
5
|
-
import { JSX } from "react";
|
|
6
|
-
interface SwitchProps {
|
|
7
|
-
checked?: boolean;
|
|
8
|
-
onChange?: (checked: boolean) => void;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
variant?: "primary" | "danger" | "success";
|
|
11
|
-
children?: (checked: boolean) => JSX.Element;
|
|
12
|
-
}
|
|
13
|
-
const Switch = ({
|
|
14
|
-
checked = false,
|
|
15
|
-
onChange,
|
|
16
|
-
disabled = false,
|
|
17
|
-
variant = "primary",
|
|
18
|
-
children,
|
|
19
|
-
...rest
|
|
20
|
-
}: SwitchProps) => {
|
|
21
|
-
return (
|
|
22
|
-
<SwitchBase
|
|
23
|
-
checked={checked}
|
|
24
|
-
disabled={disabled}
|
|
25
|
-
onChange={onChange}
|
|
26
|
-
className={SwitchVariants({ variant, checked, disabled })}
|
|
27
|
-
{...rest}
|
|
28
|
-
>
|
|
29
|
-
{children ? (
|
|
30
|
-
children(checked)
|
|
31
|
-
) : (
|
|
32
|
-
<div className="relative w-full h-full">
|
|
33
|
-
<FontAwesomeIcon
|
|
34
|
-
icon={faCircle}
|
|
35
|
-
className={cx(
|
|
36
|
-
`absolute top-1/2 transform -translate-y-1/2 `,
|
|
37
|
-
checked ? "left-6 text-blue-600" : "left-1 text-blue-600",
|
|
38
|
-
disabled && "text-gray-400 dark:text-gray-200",
|
|
39
|
-
`inline-block h-4 w-4 rounded-full border border-blue-500 [transition:_all_0.5s_cubic-bezier(1,0,0,1)]`,
|
|
40
|
-
)}
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
)}
|
|
44
|
-
</SwitchBase>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
const SwitchVariants = cva("relative inline-flex h-6 w-11 items-center rounded-full", {
|
|
48
|
-
variants: {
|
|
49
|
-
variant: {
|
|
50
|
-
danger: "",
|
|
51
|
-
success: "",
|
|
52
|
-
primary: "",
|
|
53
|
-
},
|
|
54
|
-
checked: {
|
|
55
|
-
true: "bg-gray-400 dark:bg-gray-200",
|
|
56
|
-
false: "bg-gray-400 dark:bg-gray-200",
|
|
57
|
-
},
|
|
58
|
-
disabled: {
|
|
59
|
-
true: "dark:bg-gray-600 ring-2 ring-slate-900 dark:ring-slate-400",
|
|
60
|
-
false: "",
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
compoundVariants: [
|
|
64
|
-
{
|
|
65
|
-
variant: "danger",
|
|
66
|
-
checked: true,
|
|
67
|
-
className: "bg-red-600",
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
variant: "primary",
|
|
71
|
-
checked: true,
|
|
72
|
-
className: "bg-blue-600",
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
variant: "success",
|
|
76
|
-
checked: true,
|
|
77
|
-
className: "bg-green-600",
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
});
|
|
81
|
-
export default Switch
|
|
82
|
-
|
package/components/text-area.tsx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { cx } from "@rinzai/zen";
|
|
2
|
-
import { ComponentPropsWithoutRef } from "react";
|
|
3
|
-
|
|
4
|
-
const TextArea = ({ className, ...rest }: ComponentPropsWithoutRef<"textarea">) => {
|
|
5
|
-
return (
|
|
6
|
-
<textarea
|
|
7
|
-
{...rest}
|
|
8
|
-
autoComplete="off"
|
|
9
|
-
className={cx(
|
|
10
|
-
className,
|
|
11
|
-
"min-h-[200px] max-h-96 !overflow-auto",
|
|
12
|
-
"placeholder:gray-800 rounded border border-border bg-input p-2 text-foreground",
|
|
13
|
-
"focus:border-transparent focus:outline-none focus:ring-2 focus:ring-ring",
|
|
14
|
-
"disabled:cursor-not-allowed disabled:border-muted",
|
|
15
|
-
"whitespace-pre-wrap",
|
|
16
|
-
)}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default TextArea;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { faLaptop, faMoon, faSun } from "@fortawesome/free-solid-svg-icons";
|
|
2
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
3
|
-
import Menu from "@feb/menu";
|
|
4
|
-
import Pill from "@feb/pill";
|
|
5
|
-
import { useEffect, useState } from "react";
|
|
6
|
-
type Color = "light" | "dark" | "system";
|
|
7
|
-
|
|
8
|
-
export default function ThemeSwitcher() {
|
|
9
|
-
const colorModeIcon = { light: faSun, dark: faMoon, system: faLaptop };
|
|
10
|
-
const localStorageString = `theme`;
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (typeof window !== "undefined" && !(localStorageString in localStorage)) {
|
|
13
|
-
localStorage.setItem(localStorageString, "system");
|
|
14
|
-
}
|
|
15
|
-
}, []);
|
|
16
|
-
const [colorMode, setColorMode] = useState<Color>(
|
|
17
|
-
typeof window !== "undefined" ? ((localStorage.getItem(localStorageString) as Color) ?? "system") : "system",
|
|
18
|
-
);
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (["light", "dark"].includes(colorMode)) {
|
|
21
|
-
if (colorMode === "dark") {
|
|
22
|
-
document.documentElement.classList.add("dark");
|
|
23
|
-
setColorMode("dark");
|
|
24
|
-
} else if (colorMode === "light") {
|
|
25
|
-
document.documentElement.classList.remove("dark");
|
|
26
|
-
setColorMode("light");
|
|
27
|
-
}
|
|
28
|
-
localStorage.setItem(localStorageString, colorMode);
|
|
29
|
-
} else {
|
|
30
|
-
const isSystemThemeDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
31
|
-
if (isSystemThemeDark) {
|
|
32
|
-
document.documentElement.classList.add("dark");
|
|
33
|
-
} else {
|
|
34
|
-
document.documentElement.classList.remove("dark");
|
|
35
|
-
}
|
|
36
|
-
localStorage.setItem(localStorageString, "system");
|
|
37
|
-
}
|
|
38
|
-
}, [colorMode]);
|
|
39
|
-
return (
|
|
40
|
-
<Menu buttonText={<FontAwesomeIcon icon={colorModeIcon[colorMode] ?? faLaptop} />}>
|
|
41
|
-
<>
|
|
42
|
-
<Menu.Item className="focus-visible:outline-none">
|
|
43
|
-
<Pill
|
|
44
|
-
active={colorMode === "system"}
|
|
45
|
-
title="System Theme"
|
|
46
|
-
onClick={() => {
|
|
47
|
-
setColorMode("system");
|
|
48
|
-
}}
|
|
49
|
-
className="flex w-full whitespace-nowrap p-6 rounded-t-sm rounded-b-none"
|
|
50
|
-
>
|
|
51
|
-
<FontAwesomeIcon icon={faLaptop} className={"size-4"} />
|
|
52
|
-
</Pill>
|
|
53
|
-
</Menu.Item>
|
|
54
|
-
<Menu.Item className="focus-visible:outline-none">
|
|
55
|
-
<Pill
|
|
56
|
-
active={colorMode === "light"}
|
|
57
|
-
title="Light Theme"
|
|
58
|
-
onClick={() => {
|
|
59
|
-
setColorMode("light");
|
|
60
|
-
}}
|
|
61
|
-
className="flex w-full whitespace-nowrap p-6 rounded-none"
|
|
62
|
-
>
|
|
63
|
-
<FontAwesomeIcon icon={faSun} className={"size-4"} />
|
|
64
|
-
</Pill>
|
|
65
|
-
</Menu.Item>
|
|
66
|
-
<Menu.Item className="focus-visible:outline-none">
|
|
67
|
-
<Pill
|
|
68
|
-
active={colorMode === "dark"}
|
|
69
|
-
title="Dark Theme"
|
|
70
|
-
onClick={() => {
|
|
71
|
-
setColorMode("dark");
|
|
72
|
-
}}
|
|
73
|
-
className="flex w-full whitespace-nowrap p-6 rounded-b-sm rounded-t-none"
|
|
74
|
-
>
|
|
75
|
-
<FontAwesomeIcon icon={faMoon} className={"size-4"} />
|
|
76
|
-
</Pill>
|
|
77
|
-
</Menu.Item>
|
|
78
|
-
</>
|
|
79
|
-
</Menu>
|
|
80
|
-
);
|
|
81
|
-
}
|
package/eslint.config.mjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import eslint from '@eslint/js';
|
|
2
|
-
import globals from 'globals';
|
|
3
|
-
import tseslint from 'typescript-eslint';
|
|
4
|
-
export default tseslint.config(
|
|
5
|
-
{
|
|
6
|
-
ignores: ['**/*.js', '**/*.d.ts', 'dist/*'],
|
|
7
|
-
},
|
|
8
|
-
eslint.configs.recommended,
|
|
9
|
-
...tseslint.configs.recommendedTypeChecked,
|
|
10
|
-
{
|
|
11
|
-
languageOptions: {
|
|
12
|
-
parserOptions: {
|
|
13
|
-
project: ['tsconfig.json'],
|
|
14
|
-
projectService: true,
|
|
15
|
-
},
|
|
16
|
-
globals: {
|
|
17
|
-
...globals.browser,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
rules: {
|
|
21
|
-
'@typescript-eslint/no-unused-vars': [
|
|
22
|
-
'error',
|
|
23
|
-
{
|
|
24
|
-
argsIgnorePattern: '^_',
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
'@typescript-eslint/no-empty-object-type': 'off',
|
|
28
|
-
'@typescript-eslint/no-misused-promises': [
|
|
29
|
-
'error',
|
|
30
|
-
{
|
|
31
|
-
checksVoidReturn: false,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
);
|
package/index.html
DELETED
package/tsconfig.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"jsx": "react-jsx",
|
|
5
|
-
"target": "ESNext",
|
|
6
|
-
"lib": ["ESNext", "DOM"],
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"allowSyntheticDefaultImports": true,
|
|
10
|
-
"strict": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"noFallthroughCasesInSwitch": true,
|
|
13
|
-
"module": "ESNext",
|
|
14
|
-
"moduleResolution": "Bundler",
|
|
15
|
-
"moduleDetection": "force",
|
|
16
|
-
"resolveJsonModule": true,
|
|
17
|
-
"isolatedModules": true,
|
|
18
|
-
"noEmit": true,
|
|
19
|
-
// "verbatimModuleSyntax": true,
|
|
20
|
-
"baseUrl": ".",
|
|
21
|
-
"paths": {
|
|
22
|
-
"@feb/*": ["components/*"]
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"allowDefaultProject": true,
|
|
26
|
-
"exclude": ["node_modules", "dist", "demo"]
|
|
27
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import react from '@vitejs/plugin-react-swc';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
import tailwindcss from 'tailwindcss';
|
|
4
|
-
import { defineConfig } from 'vite';
|
|
5
|
-
import dts from 'vite-plugin-dts';
|
|
6
|
-
import tsConfigPaths from 'vite-tsconfig-paths';
|
|
7
|
-
import config from './package.json' with {type:"json"};
|
|
8
|
-
export default defineConfig({
|
|
9
|
-
plugins: [
|
|
10
|
-
react(),
|
|
11
|
-
tsConfigPaths(),
|
|
12
|
-
dts({
|
|
13
|
-
include: ['components/'],
|
|
14
|
-
}),
|
|
15
|
-
],
|
|
16
|
-
css: {
|
|
17
|
-
postcss: {
|
|
18
|
-
plugins: [tailwindcss],
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
build: {
|
|
23
|
-
lib: {
|
|
24
|
-
entry: resolve('components', 'index.ts'),
|
|
25
|
-
formats: ['es'],
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
rollupOptions: {
|
|
29
|
-
external: [...Object.keys(config.peerDependencies)],
|
|
30
|
-
output: {
|
|
31
|
-
globals: {
|
|
32
|
-
react: 'React',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|