@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.
Files changed (81) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +11 -0
  3. package/.github/workflows/publish.yml +42 -0
  4. package/.github/workflows/storybook.yml +46 -0
  5. package/.storybook/main.ts +28 -0
  6. package/.storybook/preview.ts +22 -0
  7. package/README.md +9 -0
  8. package/dist/index.css +1 -0
  9. package/dist/index.d.mts +704 -0
  10. package/dist/index.d.ts +704 -0
  11. package/dist/index.js +5 -0
  12. package/dist/index.mjs +5 -0
  13. package/package.json +60 -0
  14. package/src/charts/DistributionBarChart.stories.tsx +41 -0
  15. package/src/charts/DistributionBarChart.tsx +170 -0
  16. package/src/charts/DistributionHistogram.stories.tsx +56 -0
  17. package/src/charts/DistributionHistogram.tsx +193 -0
  18. package/src/charts/index.ts +10 -0
  19. package/src/global.d.ts +1 -0
  20. package/src/helpers/SEO.tsx +41 -0
  21. package/src/index.ts +6 -0
  22. package/src/styles/theme.css +60 -0
  23. package/src/ui/Alert.stories.tsx +41 -0
  24. package/src/ui/Alert.tsx +72 -0
  25. package/src/ui/Anchor.stories.tsx +25 -0
  26. package/src/ui/Anchor.tsx +32 -0
  27. package/src/ui/AuthFormUI.stories.tsx +67 -0
  28. package/src/ui/AuthFormUI.tsx +217 -0
  29. package/src/ui/BasePanel.stories.tsx +36 -0
  30. package/src/ui/BasePanel.tsx +59 -0
  31. package/src/ui/Button.stories.tsx +108 -0
  32. package/src/ui/Button.tsx +121 -0
  33. package/src/ui/Checkbox.stories.tsx +61 -0
  34. package/src/ui/Checkbox.tsx +45 -0
  35. package/src/ui/Collapsible.stories.tsx +91 -0
  36. package/src/ui/Collapsible.tsx +52 -0
  37. package/src/ui/Colors.stories.tsx +67 -0
  38. package/src/ui/Dialog.stories.tsx +29 -0
  39. package/src/ui/Dialog.tsx +56 -0
  40. package/src/ui/Dropdown.tsx +66 -0
  41. package/src/ui/Field.stories.tsx +181 -0
  42. package/src/ui/Field.tsx +108 -0
  43. package/src/ui/Icon.stories.tsx +192 -0
  44. package/src/ui/Icon.tsx +42 -0
  45. package/src/ui/IconRegistry.tsx +189 -0
  46. package/src/ui/Input.stories.tsx +67 -0
  47. package/src/ui/Input.tsx +43 -0
  48. package/src/ui/Label.stories.tsx +42 -0
  49. package/src/ui/Label.tsx +26 -0
  50. package/src/ui/NumberField.stories.tsx +86 -0
  51. package/src/ui/NumberField.tsx +116 -0
  52. package/src/ui/Popover.tsx +42 -0
  53. package/src/ui/Select.stories.tsx +74 -0
  54. package/src/ui/Select.tsx +122 -0
  55. package/src/ui/Separator.stories.tsx +61 -0
  56. package/src/ui/Separator.tsx +28 -0
  57. package/src/ui/SettingsPanel.stories.tsx +83 -0
  58. package/src/ui/SettingsPanel.tsx +81 -0
  59. package/src/ui/Skeleton.stories.tsx +43 -0
  60. package/src/ui/Skeleton.tsx +15 -0
  61. package/src/ui/Slider.stories.tsx +140 -0
  62. package/src/ui/Slider.tsx +95 -0
  63. package/src/ui/SliderWithNumberField.stories.tsx +101 -0
  64. package/src/ui/SliderWithNumberField.tsx +88 -0
  65. package/src/ui/Switch.stories.tsx +81 -0
  66. package/src/ui/Switch.tsx +60 -0
  67. package/src/ui/TabRadio.stories.tsx +153 -0
  68. package/src/ui/TabRadio.tsx +68 -0
  69. package/src/ui/TabSelection.stories.tsx +44 -0
  70. package/src/ui/TabSelection.tsx +91 -0
  71. package/src/ui/TextArea.stories.tsx +64 -0
  72. package/src/ui/TextArea.tsx +24 -0
  73. package/src/ui/Tooltip.stories.tsx +84 -0
  74. package/src/ui/Tooltip.tsx +61 -0
  75. package/src/ui/Typography.stories.tsx +87 -0
  76. package/src/ui/Typography.tsx +80 -0
  77. package/src/ui/index.ts +28 -0
  78. package/src/ui/utils.ts +6 -0
  79. package/tsconfig.json +12 -0
  80. package/vitest.config.ts +36 -0
  81. 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
+ };
@@ -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";
@@ -0,0 +1,6 @@
1
+ import { type ClassValue, clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs));
6
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2020",
4
+ "jsx": "react-jsx",
5
+ "moduleResolution": "bundler",
6
+ "ignoreDeprecations": "6.0",
7
+ "strict": true,
8
+ "declaration": true,
9
+ "skipLibCheck": true,
10
+ "esModuleInterop": true
11
+ }
12
+ }
@@ -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" />