@peerbots/core 0.2.5 → 1.0.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 (123) hide show
  1. package/.changeset/config.json +1 -1
  2. package/.github/workflows/storybook.yml +9 -1
  3. package/CHANGELOG.md +100 -0
  4. package/dist/index.d.mts +643 -131
  5. package/dist/index.d.ts +643 -131
  6. package/dist/index.js +7 -6
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +7 -6
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +6 -3
  11. package/src/charts/DistributionBarChart.tsx +10 -4
  12. package/src/charts/DistributionHistogram.tsx +13 -5
  13. package/src/charts/LineGraph.stories.tsx +60 -0
  14. package/src/charts/LineGraph.tsx +216 -0
  15. package/src/charts/index.ts +2 -0
  16. package/src/docs/DesignSystem.mdx +241 -25
  17. package/src/styles/theme.css +8 -0
  18. package/src/ui/feedback/Alert.stories.tsx +56 -0
  19. package/src/ui/feedback/Alert.tsx +168 -0
  20. package/src/ui/{Dialog.stories.tsx → feedback/Dialog.stories.tsx} +2 -2
  21. package/src/ui/{Dialog.tsx → feedback/Dialog.tsx} +2 -2
  22. package/src/ui/feedback/EmptyState.stories.tsx +57 -0
  23. package/src/ui/feedback/EmptyState.tsx +123 -0
  24. package/src/ui/feedback/Popover.stories.tsx +130 -0
  25. package/src/ui/feedback/Popover.tsx +135 -0
  26. package/src/ui/feedback/Skeleton.stories.tsx +88 -0
  27. package/src/ui/{Skeleton.tsx → feedback/Skeleton.tsx} +2 -2
  28. package/src/ui/feedback/Spinner.stories.tsx +77 -0
  29. package/src/ui/feedback/Spinner.tsx +62 -0
  30. package/src/ui/{Tooltip.stories.tsx → feedback/Tooltip.stories.tsx} +3 -3
  31. package/src/ui/{Tooltip.tsx → feedback/Tooltip.tsx} +2 -2
  32. package/src/ui/feedback/index.ts +7 -0
  33. package/src/ui/forms/Button.stories.tsx +181 -0
  34. package/src/ui/forms/Button.tsx +323 -0
  35. package/src/ui/{Checkbox.stories.tsx → forms/Checkbox.stories.tsx} +2 -2
  36. package/src/ui/{Checkbox.tsx → forms/Checkbox.tsx} +2 -2
  37. package/src/ui/forms/ChipGroup.stories.tsx +118 -0
  38. package/src/ui/forms/ChipGroup.tsx +239 -0
  39. package/src/ui/{Dropdown.tsx → forms/Dropdown.tsx} +1 -1
  40. package/src/ui/{Field.stories.tsx → forms/Field.stories.tsx} +3 -3
  41. package/src/ui/{Field.tsx → forms/Field.tsx} +1 -1
  42. package/src/ui/{Input.stories.tsx → forms/Input.stories.tsx} +6 -6
  43. package/src/ui/{Input.tsx → forms/Input.tsx} +1 -1
  44. package/src/ui/{Label.stories.tsx → forms/Label.stories.tsx} +2 -2
  45. package/src/ui/{Label.tsx → forms/Label.tsx} +2 -2
  46. package/src/ui/{NumberField.stories.tsx → forms/NumberField.stories.tsx} +2 -2
  47. package/src/ui/{NumberField.tsx → forms/NumberField.tsx} +8 -9
  48. package/src/ui/forms/PeerbotsColorSelector.stories.tsx +49 -0
  49. package/src/ui/forms/PeerbotsColorSelector.tsx +100 -0
  50. package/src/ui/{Select.stories.tsx → forms/Select.stories.tsx} +2 -2
  51. package/src/ui/{Select.tsx → forms/Select.tsx} +5 -3
  52. package/src/ui/{Slider.stories.tsx → forms/Slider.stories.tsx} +6 -4
  53. package/src/ui/{Slider.tsx → forms/Slider.tsx} +7 -3
  54. package/src/ui/forms/SliderWithNumberField.stories.tsx +136 -0
  55. package/src/ui/{SliderWithNumberField.tsx → forms/SliderWithNumberField.tsx} +19 -7
  56. package/src/ui/{Switch.stories.tsx → forms/Switch.stories.tsx} +2 -2
  57. package/src/ui/{Switch.tsx → forms/Switch.tsx} +1 -1
  58. package/src/ui/{TabRadio.stories.tsx → forms/TabRadio.stories.tsx} +3 -3
  59. package/src/ui/{TabRadio.tsx → forms/TabRadio.tsx} +1 -1
  60. package/src/ui/{TextArea.stories.tsx → forms/TextArea.stories.tsx} +5 -3
  61. package/src/ui/{TextArea.tsx → forms/TextArea.tsx} +1 -1
  62. package/src/ui/forms/index.ts +15 -0
  63. package/src/ui/foundations/Anchor.stories.tsx +39 -0
  64. package/src/ui/foundations/Anchor.tsx +96 -0
  65. package/src/ui/foundations/CodeBlock.stories.tsx +86 -0
  66. package/src/ui/foundations/CodeBlock.tsx +148 -0
  67. package/src/ui/foundations/Colors.stories.tsx +80 -0
  68. package/src/ui/{Icon.stories.tsx → foundations/Icon.stories.tsx} +1 -1
  69. package/src/ui/{Icon.tsx → foundations/Icon.tsx} +1 -1
  70. package/src/ui/{IconRegistry.tsx → foundations/IconRegistry.tsx} +261 -57
  71. package/src/ui/foundations/SocialLinks.stories.tsx +38 -0
  72. package/src/ui/foundations/SocialLinks.tsx +117 -0
  73. package/src/ui/foundations/Typography.stories.tsx +58 -0
  74. package/src/ui/foundations/Typography.tsx +163 -0
  75. package/src/ui/foundations/index.ts +6 -0
  76. package/src/ui/index.ts +7 -28
  77. package/src/ui/layout/Accordion.stories.tsx +86 -0
  78. package/src/ui/layout/Accordion.tsx +205 -0
  79. package/src/ui/layout/Card.stories.tsx +151 -0
  80. package/src/ui/layout/Card.tsx +124 -0
  81. package/src/ui/layout/Collapsible.stories.tsx +54 -0
  82. package/src/ui/layout/Collapsible.tsx +54 -0
  83. package/src/ui/{Separator.stories.tsx → layout/Separator.stories.tsx} +2 -2
  84. package/src/ui/{Separator.tsx → layout/Separator.tsx} +1 -1
  85. package/src/ui/{SettingsPanel.stories.tsx → layout/SettingsPanel.stories.tsx} +5 -5
  86. package/src/ui/{SettingsPanel.tsx → layout/SettingsPanel.tsx} +33 -29
  87. package/src/ui/layout/index.ts +5 -0
  88. package/src/ui/media/Avatar.stories.tsx +89 -0
  89. package/src/ui/media/Avatar.tsx +122 -0
  90. package/src/ui/media/Dropzone.stories.tsx +95 -0
  91. package/src/ui/media/Dropzone.tsx +328 -0
  92. package/src/ui/media/FileUpload.stories.tsx +62 -0
  93. package/src/ui/media/FileUpload.tsx +175 -0
  94. package/src/ui/media/index.ts +3 -0
  95. package/src/ui/{AuthFormUI.stories.tsx → patterns/AuthFormUI.stories.tsx} +1 -1
  96. package/src/ui/{AuthFormUI.tsx → patterns/AuthFormUI.tsx} +24 -23
  97. package/src/ui/patterns/CopyButton.stories.tsx +77 -0
  98. package/src/ui/patterns/CopyButton.tsx +93 -0
  99. package/src/ui/patterns/SearchInput.stories.tsx +51 -0
  100. package/src/ui/patterns/SearchInput.tsx +93 -0
  101. package/src/ui/patterns/Stepper.stories.tsx +129 -0
  102. package/src/ui/patterns/Stepper.tsx +295 -0
  103. package/src/ui/{TabSelection.stories.tsx → patterns/TabSelection.stories.tsx} +1 -1
  104. package/src/ui/{TabSelection.tsx → patterns/TabSelection.tsx} +2 -2
  105. package/src/ui/patterns/index.ts +6 -0
  106. package/src/ui/patterns/useClipboard.ts +75 -0
  107. package/src/ui/types.ts +48 -0
  108. package/src/ui/Alert.stories.tsx +0 -41
  109. package/src/ui/Alert.tsx +0 -72
  110. package/src/ui/Anchor.stories.tsx +0 -25
  111. package/src/ui/Anchor.tsx +0 -32
  112. package/src/ui/BasePanel.stories.tsx +0 -36
  113. package/src/ui/BasePanel.tsx +0 -59
  114. package/src/ui/Button.stories.tsx +0 -108
  115. package/src/ui/Button.tsx +0 -121
  116. package/src/ui/Collapsible.stories.tsx +0 -91
  117. package/src/ui/Collapsible.tsx +0 -52
  118. package/src/ui/Colors.stories.tsx +0 -67
  119. package/src/ui/Popover.tsx +0 -42
  120. package/src/ui/Skeleton.stories.tsx +0 -43
  121. package/src/ui/SliderWithNumberField.stories.tsx +0 -101
  122. package/src/ui/Typography.stories.tsx +0 -87
  123. package/src/ui/Typography.tsx +0 -80
@@ -1,101 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import SliderWithNumberField from "./SliderWithNumberField";
3
- import React, { useState } from "react";
4
- import { Heading, Text } from "./Typography";
5
-
6
- const meta: Meta<typeof SliderWithNumberField> = {
7
- title: "UI/SliderWithNumberField",
8
- component: SliderWithNumberField,
9
- argTypes: {
10
- onChange: { action: "changed" },
11
- min: { control: { type: "number" } },
12
- max: { control: { type: "number" } },
13
- step: { control: { type: "number" } },
14
- disabled: { control: "boolean" },
15
- },
16
- };
17
-
18
- export default meta;
19
- type Story = StoryObj<typeof SliderWithNumberField>;
20
-
21
- const InteractiveSliderWithNumberField = (
22
- props: React.ComponentProps<typeof SliderWithNumberField>,
23
- ) => {
24
- const [value, setValue] = useState(props.value || props.defaultValue || 0);
25
- return (
26
- <SliderWithNumberField
27
- {...props}
28
- value={value}
29
- onChange={(v) => {
30
- setValue(v);
31
- props.onChange?.(v as number, new Event("change")); // Match signature
32
- }}
33
- />
34
- );
35
- };
36
-
37
- export const Default: Story = {
38
- args: {
39
- min: 0,
40
- max: 100,
41
- defaultValue: 50,
42
- },
43
- render: (args) => (
44
- <div className="pb:w-80 pb:p-4">
45
- <InteractiveSliderWithNumberField
46
- {...(args as React.ComponentProps<typeof SliderWithNumberField>)}
47
- />
48
- </div>
49
- ),
50
- };
51
-
52
- export const Variations: Story = {
53
- render: () => (
54
- <div className="pb:flex pb:flex-col pb:gap-12 pb:p-4">
55
- <div className="pb:space-y-4">
56
- <Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
57
- Responsive Layouts
58
- </Heading>
59
- <div className="pb:space-y-8 pb:max-w-lg">
60
- <div className="pb:space-y-2">
61
- <Text variant="small" className="pb:font-bold pb:underline">
62
- Flexible (Full width of container)
63
- </Text>
64
- <InteractiveSliderWithNumberField defaultValue={50} />
65
- </div>
66
-
67
- <div className="pb:space-y-2 pb:w-64 pb:border-l pb:border-r pb:border-dotted pb:px-2 pb:bg-gray-50 pb:py-4">
68
- <Text variant="small" className="pb:font-bold pb:underline">
69
- Narrow Container (w-64)
70
- </Text>
71
- <InteractiveSliderWithNumberField defaultValue={50} />
72
- </div>
73
-
74
- <div className="pb:space-y-2 pb:w-48 pb:border-l pb:border-r pb:border-dotted pb:px-2 pb:bg-gray-50 pb:py-4">
75
- <Text variant="small" className="pb:font-bold pb:underline">
76
- Very Narrow (w-48) - Wraps
77
- </Text>
78
- <InteractiveSliderWithNumberField defaultValue={50} />
79
- </div>
80
- </div>
81
- </div>
82
-
83
- <div className="pb:space-y-4">
84
- <Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
85
- Configuration
86
- </Heading>
87
- <div className="pb:space-y-4 pb:max-w-sm">
88
- <div className="pb:space-y-1">
89
- <Text variant="small">Custom Step (0.5)</Text>
90
- <InteractiveSliderWithNumberField
91
- step={0.5}
92
- defaultValue={2.5}
93
- min={0}
94
- max={10}
95
- />
96
- </div>
97
- </div>
98
- </div>
99
- </div>
100
- ),
101
- };
@@ -1,87 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { Heading, Text } from "./Typography";
3
-
4
- const meta: Meta = {
5
- title: "UI/Typography",
6
- tags: ["autodocs"],
7
- };
8
-
9
- export default meta;
10
-
11
- export const Default: StoryObj = {
12
- render: () => (
13
- <div className="pb:space-y-4 pb:max-w-lg">
14
- <Heading level={2}>Core Typography</Heading>
15
- <Text>
16
- The quick brown fox jumps over the lazy dog. This is our standard body
17
- text used across the application.
18
- </Text>
19
- </div>
20
- ),
21
- };
22
-
23
- export const Variations: StoryObj = {
24
- render: () => (
25
- <div className="pb:flex pb:flex-col pb:gap-12 pb:p-4">
26
- <div className="pb:space-y-4">
27
- <Heading
28
- level={4}
29
- className="pb:text-sm pb:font-medium pb:text-black pb:uppercase pb:tracking-wider pb:border-b pb:pb-1"
30
- >
31
- Headings
32
- </Heading>
33
- <div className="pb:space-y-4">
34
- <Heading level={1}>Heading 1</Heading>
35
- <Heading level={2}>Heading 2</Heading>
36
- <Heading level={3}>Heading 3</Heading>
37
- <Heading level={4}>Heading 4</Heading>
38
- <Heading level={5}>Heading 5</Heading>
39
- <Heading level={6}>Heading 6</Heading>
40
- </div>
41
- </div>
42
-
43
- <div className="pb:space-y-4">
44
- <Heading
45
- level={4}
46
- className="pb:text-sm pb:font-medium pb:text-black pb:uppercase pb:tracking-wider pb:border-b pb:pb-1"
47
- >
48
- Text Variants
49
- </Heading>
50
- <div className="pb:space-y-4">
51
- <div className="pb:space-y-1">
52
- <Text variant="small" className="pb:italic pb:font-bold">
53
- Default
54
- </Text>
55
- <Text variant="default">
56
- The quick brown fox jumps over the lazy dog.
57
- </Text>
58
- </div>
59
- <div className="pb:space-y-1">
60
- <Text variant="small" className="pb:italic pb:font-bold">
61
- Small
62
- </Text>
63
- <Text variant="small">
64
- The quick brown fox jumps over the lazy dog.
65
- </Text>
66
- </div>
67
- <div className="pb:space-y-1">
68
- <Text variant="small" className="pb:italic pb:font-bold">
69
- Muted
70
- </Text>
71
- <Text variant="muted">
72
- The quick brown fox jumps over the lazy dog.
73
- </Text>
74
- </div>
75
- <div className="pb:space-y-1">
76
- <Text variant="small" className="pb:italic pb:font-bold">
77
- Error
78
- </Text>
79
- <Text variant="error">
80
- The quick brown fox jumps over the lazy dog.
81
- </Text>
82
- </div>
83
- </div>
84
- </div>
85
- </div>
86
- ),
87
- };
@@ -1,80 +0,0 @@
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: "pb:text-4xl pb:font-bold",
11
- 2: "pb:text-3xl pb:font-bold",
12
- 3: "pb:text-2xl pb:font-bold",
13
- 4: "pb:text-xl pb:font-bold",
14
- 5: "pb:text-lg pb:font-bold",
15
- 6: "pb:text-base pb:font-bold",
16
- };
17
-
18
- const textVariants = {
19
- default: "pb:text-base pb:text-slate-950",
20
- muted: "pb:text-sm pb:text-slate-600",
21
- error: "pb:text-sm pb:text-red-600 pb:font-medium",
22
- small: "pb:text-xs pb: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="pb: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
- };