@peerbots/core 0.1.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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.github/workflows/publish.yml +42 -0
- package/.github/workflows/storybook.yml +46 -0
- package/.storybook/main.ts +28 -0
- package/.storybook/preview.ts +22 -0
- package/README.md +9 -0
- package/dist/index.css +1 -0
- package/dist/index.d.mts +704 -0
- package/dist/index.d.ts +704 -0
- package/dist/index.js +5 -0
- package/dist/index.mjs +5 -0
- package/package.json +60 -0
- package/src/charts/DistributionBarChart.stories.tsx +41 -0
- package/src/charts/DistributionBarChart.tsx +170 -0
- package/src/charts/DistributionHistogram.stories.tsx +56 -0
- package/src/charts/DistributionHistogram.tsx +193 -0
- package/src/charts/index.ts +10 -0
- package/src/global.d.ts +1 -0
- package/src/helpers/SEO.tsx +41 -0
- package/src/index.ts +6 -0
- package/src/styles/theme.css +60 -0
- package/src/ui/Alert.stories.tsx +41 -0
- package/src/ui/Alert.tsx +72 -0
- package/src/ui/Anchor.stories.tsx +25 -0
- package/src/ui/Anchor.tsx +32 -0
- package/src/ui/AuthFormUI.stories.tsx +67 -0
- package/src/ui/AuthFormUI.tsx +217 -0
- package/src/ui/BasePanel.stories.tsx +36 -0
- package/src/ui/BasePanel.tsx +59 -0
- package/src/ui/Button.stories.tsx +108 -0
- package/src/ui/Button.tsx +121 -0
- package/src/ui/Checkbox.stories.tsx +61 -0
- package/src/ui/Checkbox.tsx +45 -0
- package/src/ui/Collapsible.stories.tsx +91 -0
- package/src/ui/Collapsible.tsx +52 -0
- package/src/ui/Colors.stories.tsx +67 -0
- package/src/ui/Dialog.stories.tsx +29 -0
- package/src/ui/Dialog.tsx +56 -0
- package/src/ui/Dropdown.tsx +66 -0
- package/src/ui/Field.stories.tsx +181 -0
- package/src/ui/Field.tsx +108 -0
- package/src/ui/Icon.stories.tsx +192 -0
- package/src/ui/Icon.tsx +42 -0
- package/src/ui/IconRegistry.tsx +189 -0
- package/src/ui/Input.stories.tsx +67 -0
- package/src/ui/Input.tsx +43 -0
- package/src/ui/Label.stories.tsx +42 -0
- package/src/ui/Label.tsx +26 -0
- package/src/ui/NumberField.stories.tsx +86 -0
- package/src/ui/NumberField.tsx +116 -0
- package/src/ui/Popover.tsx +42 -0
- package/src/ui/Select.stories.tsx +74 -0
- package/src/ui/Select.tsx +122 -0
- package/src/ui/Separator.stories.tsx +61 -0
- package/src/ui/Separator.tsx +28 -0
- package/src/ui/SettingsPanel.stories.tsx +83 -0
- package/src/ui/SettingsPanel.tsx +81 -0
- package/src/ui/Skeleton.stories.tsx +43 -0
- package/src/ui/Skeleton.tsx +15 -0
- package/src/ui/Slider.stories.tsx +140 -0
- package/src/ui/Slider.tsx +95 -0
- package/src/ui/SliderWithNumberField.stories.tsx +101 -0
- package/src/ui/SliderWithNumberField.tsx +88 -0
- package/src/ui/Switch.stories.tsx +81 -0
- package/src/ui/Switch.tsx +60 -0
- package/src/ui/TabRadio.stories.tsx +153 -0
- package/src/ui/TabRadio.tsx +68 -0
- package/src/ui/TabSelection.stories.tsx +44 -0
- package/src/ui/TabSelection.tsx +91 -0
- package/src/ui/TextArea.stories.tsx +64 -0
- package/src/ui/TextArea.tsx +24 -0
- package/src/ui/Tooltip.stories.tsx +84 -0
- package/src/ui/Tooltip.tsx +61 -0
- package/src/ui/Typography.stories.tsx +87 -0
- package/src/ui/Typography.tsx +80 -0
- package/src/ui/index.ts +28 -0
- package/src/ui/utils.ts +6 -0
- package/tsconfig.json +12 -0
- package/vitest.config.ts +36 -0
- package/vitest.shims.d.ts +1 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { clsx, type ClassValue } from "clsx";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
|
|
5
|
+
function cn(...inputs: ClassValue[]) {
|
|
6
|
+
return twMerge(clsx(inputs));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const headingSizes = {
|
|
10
|
+
1: "text-4xl font-bold",
|
|
11
|
+
2: "text-3xl font-bold",
|
|
12
|
+
3: "text-2xl font-bold",
|
|
13
|
+
4: "text-xl font-bold",
|
|
14
|
+
5: "text-lg font-bold",
|
|
15
|
+
6: "text-base font-bold",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const textVariants = {
|
|
19
|
+
default: "text-base text-slate-950",
|
|
20
|
+
muted: "text-sm text-slate-600",
|
|
21
|
+
error: "text-sm text-red-600 font-medium",
|
|
22
|
+
small: "text-xs text-slate-600",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
26
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Heading = ({
|
|
31
|
+
level = 1,
|
|
32
|
+
className,
|
|
33
|
+
children,
|
|
34
|
+
...props
|
|
35
|
+
}: HeadingProps) => {
|
|
36
|
+
return React.createElement(
|
|
37
|
+
`h${level}`,
|
|
38
|
+
{ className: cn(headingSizes[level], className), ...props },
|
|
39
|
+
children,
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
44
|
+
variant?: "default" | "muted" | "error" | "small";
|
|
45
|
+
as?: React.ElementType;
|
|
46
|
+
children?: React.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const Text = ({
|
|
50
|
+
variant = "default",
|
|
51
|
+
as: Component = "p",
|
|
52
|
+
className,
|
|
53
|
+
children,
|
|
54
|
+
...props
|
|
55
|
+
}: TextProps) => {
|
|
56
|
+
return React.createElement(
|
|
57
|
+
Component,
|
|
58
|
+
{ className: cn(textVariants[variant], className), ...props },
|
|
59
|
+
children,
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const TypographyList = ({ args }: { args: Record<string, unknown> }) => {
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
className="space-y-4"
|
|
67
|
+
{...(args as React.HTMLAttributes<HTMLDivElement>)}
|
|
68
|
+
>
|
|
69
|
+
<Heading level={1}>Heading 1</Heading>
|
|
70
|
+
<Heading level={2}>Heading 2</Heading>
|
|
71
|
+
<Heading level={3}>Heading 3</Heading>
|
|
72
|
+
<Text>Body text</Text>
|
|
73
|
+
<Text variant="muted">Caption text</Text>
|
|
74
|
+
<Text variant="small">Small text</Text>
|
|
75
|
+
<Text variant="small" as="span">
|
|
76
|
+
Small span text
|
|
77
|
+
</Text>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
};
|
package/src/ui/index.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export * from "./Button";
|
|
2
|
+
export * from "./Input";
|
|
3
|
+
export * from "./Select";
|
|
4
|
+
export * from "./Typography";
|
|
5
|
+
export * from "./Icon";
|
|
6
|
+
export * from "./Slider";
|
|
7
|
+
export * from "./SliderWithNumberField";
|
|
8
|
+
export * from "./Tooltip";
|
|
9
|
+
export * from "./utils";
|
|
10
|
+
export * from "./Dialog";
|
|
11
|
+
export * from "./Popover";
|
|
12
|
+
export * from "./Dropdown";
|
|
13
|
+
export * from "./Collapsible";
|
|
14
|
+
export * from "./Switch";
|
|
15
|
+
export * from "./Label";
|
|
16
|
+
export * from "./BasePanel";
|
|
17
|
+
export * from "./TabRadio";
|
|
18
|
+
export * from "./NumberField";
|
|
19
|
+
export * from "./Field";
|
|
20
|
+
export * from "./Anchor";
|
|
21
|
+
export * from "./TextArea";
|
|
22
|
+
export * from "./Checkbox";
|
|
23
|
+
export * from "./SettingsPanel";
|
|
24
|
+
export * from "./Separator";
|
|
25
|
+
export * from "./Skeleton";
|
|
26
|
+
export * from "./AuthFormUI";
|
|
27
|
+
export * from "./Alert";
|
|
28
|
+
export * from "./TabSelection";
|
package/src/ui/utils.ts
ADDED
package/tsconfig.json
ADDED
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
|
|
4
|
+
import { defineConfig } from 'vitest/config';
|
|
5
|
+
|
|
6
|
+
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
7
|
+
|
|
8
|
+
import { playwright } from '@vitest/browser-playwright';
|
|
9
|
+
|
|
10
|
+
const dirname =
|
|
11
|
+
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
|
|
13
|
+
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
|
14
|
+
export default defineConfig({
|
|
15
|
+
test: {
|
|
16
|
+
projects: [
|
|
17
|
+
{
|
|
18
|
+
extends: true,
|
|
19
|
+
plugins: [
|
|
20
|
+
// The plugin will run tests for the stories defined in your Storybook config
|
|
21
|
+
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
22
|
+
storybookTest({ configDir: path.join(dirname, '.storybook') }),
|
|
23
|
+
],
|
|
24
|
+
test: {
|
|
25
|
+
name: 'storybook',
|
|
26
|
+
browser: {
|
|
27
|
+
enabled: true,
|
|
28
|
+
headless: true,
|
|
29
|
+
provider: playwright({}),
|
|
30
|
+
instances: [{ browser: 'chromium' }],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="@vitest/browser-playwright" />
|