@peerbots/core 0.1.3 → 0.2.1
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/CHANGELOG.md +12 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +16 -3
- package/src/charts/DistributionBarChart.tsx +2 -2
- package/src/charts/DistributionHistogram.tsx +2 -2
- package/src/docs/DesignSystem.mdx +46 -0
- package/src/styles/theme.css +13 -13
- package/src/ui/Alert.stories.tsx +1 -1
- package/src/ui/Alert.tsx +9 -9
- package/src/ui/Anchor.tsx +1 -1
- package/src/ui/AuthFormUI.stories.tsx +2 -2
- package/src/ui/AuthFormUI.tsx +28 -28
- package/src/ui/BasePanel.stories.tsx +2 -2
- package/src/ui/BasePanel.tsx +5 -5
- package/src/ui/Button.stories.tsx +16 -16
- package/src/ui/Button.tsx +17 -17
- package/src/ui/Checkbox.stories.tsx +6 -6
- package/src/ui/Checkbox.tsx +4 -4
- package/src/ui/Collapsible.stories.tsx +21 -21
- package/src/ui/Collapsible.tsx +3 -3
- package/src/ui/Colors.stories.tsx +23 -23
- package/src/ui/Dialog.stories.tsx +3 -3
- package/src/ui/Dialog.tsx +2 -2
- package/src/ui/Dropdown.tsx +3 -3
- package/src/ui/Field.stories.tsx +19 -19
- package/src/ui/Field.tsx +14 -14
- package/src/ui/Icon.stories.tsx +17 -17
- package/src/ui/Icon.tsx +5 -5
- package/src/ui/Input.stories.tsx +15 -15
- package/src/ui/Input.tsx +8 -8
- package/src/ui/Label.stories.tsx +6 -6
- package/src/ui/Label.tsx +2 -2
- package/src/ui/NumberField.stories.tsx +14 -14
- package/src/ui/NumberField.tsx +9 -9
- package/src/ui/Popover.tsx +2 -2
- package/src/ui/Select.stories.tsx +13 -13
- package/src/ui/Select.tsx +7 -7
- package/src/ui/Separator.stories.tsx +10 -10
- package/src/ui/Separator.tsx +2 -2
- package/src/ui/SettingsPanel.stories.tsx +14 -14
- package/src/ui/SettingsPanel.tsx +5 -5
- package/src/ui/Skeleton.stories.tsx +10 -10
- package/src/ui/Skeleton.tsx +1 -1
- package/src/ui/Slider.stories.tsx +23 -23
- package/src/ui/Slider.tsx +9 -9
- package/src/ui/SliderWithNumberField.stories.tsx +15 -15
- package/src/ui/SliderWithNumberField.tsx +4 -4
- package/src/ui/Switch.stories.tsx +11 -11
- package/src/ui/Switch.tsx +6 -6
- package/src/ui/TabRadio.stories.tsx +16 -16
- package/src/ui/TabRadio.tsx +7 -7
- package/src/ui/TabSelection.stories.tsx +1 -1
- package/src/ui/TabSelection.tsx +8 -8
- package/src/ui/TextArea.stories.tsx +12 -12
- package/src/ui/TextArea.tsx +1 -1
- package/src/ui/Tooltip.stories.tsx +13 -13
- package/src/ui/Tooltip.tsx +3 -3
- package/src/ui/Typography.stories.tsx +16 -16
- package/src/ui/Typography.tsx +11 -11
|
@@ -16,11 +16,11 @@ type Story = StoryObj<typeof Dialog>;
|
|
|
16
16
|
export const Default: Story = {
|
|
17
17
|
render: () => (
|
|
18
18
|
<Dialog trigger={<Button>Open Default Dialog</Button>}>
|
|
19
|
-
<DialogTitle className="text-xl font-bold mb-2">Dialog Title</DialogTitle>
|
|
20
|
-
<DialogDescription className="text-black mb-6">
|
|
19
|
+
<DialogTitle className="pb:text-xl pb:font-bold pb:mb-2">Dialog Title</DialogTitle>
|
|
20
|
+
<DialogDescription className="pb:text-black pb:mb-6">
|
|
21
21
|
This is a description of the dialog content.
|
|
22
22
|
</DialogDescription>
|
|
23
|
-
<div className="flex justify-end gap-2">
|
|
23
|
+
<div className="pb:flex pb:justify-end pb:gap-2">
|
|
24
24
|
<DialogClose render={<Button variant="secondary">Cancel</Button>} />
|
|
25
25
|
<DialogClose render={<Button variant="primary">Confirm</Button>} />
|
|
26
26
|
</div>
|
package/src/ui/Dialog.tsx
CHANGED
|
@@ -31,10 +31,10 @@ export function Dialog({
|
|
|
31
31
|
<BaseDialog.Trigger>{trigger}</BaseDialog.Trigger>
|
|
32
32
|
))}
|
|
33
33
|
<BaseDialog.Portal>
|
|
34
|
-
<BaseDialog.Backdrop className="fixed inset-0 z-50 bg-black/40 transition-all duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" />
|
|
34
|
+
<BaseDialog.Backdrop className="pb:fixed pb:inset-0 pb:z-50 pb:bg-black/40 pb:transition-all pb:duration-200 data-[state=open]:pb:animate-in data-[state=closed]:pb:animate-out pb:data-[state=closed]:fade-out-0 pb:data-[state=open]:fade-in-0" />
|
|
35
35
|
<BaseDialog.Popup
|
|
36
36
|
className={cn(
|
|
37
|
-
"fixed left-[50%] top-[50%] z-50 grid w-auto max-w-[90vw] translate-x-[-50%] translate-y-[-50%] gap-4 border bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
37
|
+
"pb:fixed pb:left-[50%] pb:top-[50%] pb:z-50 pb:grid pb:w-auto pb:max-w-[90vw] pb:translate-x-[-50%] pb:translate-y-[-50%] pb:gap-4 pb:border pb:bg-white pb:p-6 pb:shadow-lg pb:duration-200 data-[state=open]:pb:animate-in data-[state=closed]:pb:animate-out data-[state=closed]:pb:fade-out-0 data-[state=open]:pb:fade-in-0 data-[state=closed]:pb:zoom-out-95 data-[state=open]:pb:zoom-in-95 data-[state=closed]:pb:slide-out-to-left-1/2 data-[state=closed]:pb:slide-out-to-top-[48%] data-[state=open]:pb:slide-in-from-left-1/2 data-[state=open]:pb:slide-in-from-top-[48%] sm:rounded-lg",
|
|
38
38
|
className,
|
|
39
39
|
)}
|
|
40
40
|
>
|
package/src/ui/Dropdown.tsx
CHANGED
|
@@ -26,7 +26,7 @@ export function Dropdown({
|
|
|
26
26
|
<BaseMenu.Positioner align={align} sideOffset={5}>
|
|
27
27
|
<BaseMenu.Popup
|
|
28
28
|
className={cn(
|
|
29
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-white p-1 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
29
|
+
"pb:z-50 pb:min-w-[8rem] pb:overflow-hidden pb:rounded-md pb:border pb:bg-white pb:p-1 pb:shadow-md pb:data-[state=open]:animate-in pb:data-[state=closed]:animate-out pb:data-[state=closed]:fade-out-0 pb:data-[state=open]:fade-in-0 pb:data-[state=closed]:zoom-out-95 pb:data-[state=open]:zoom-in-95",
|
|
30
30
|
className,
|
|
31
31
|
)}
|
|
32
32
|
>
|
|
@@ -45,7 +45,7 @@ export const DropdownItem = React.forwardRef<
|
|
|
45
45
|
<BaseMenu.Item
|
|
46
46
|
ref={ref}
|
|
47
47
|
className={cn(
|
|
48
|
-
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[highlighted]:bg-gray-100 data-[highlighted]:text-gray-900",
|
|
48
|
+
"pb:relative pb:flex pb:cursor-default pb:select-none pb:items-center pb:rounded-sm pb:px-2 pb:py-1.5 pb:text-sm pb:outline-none pb:transition-colors pb:data-[highlighted]:bg-gray-100 pb:data-[highlighted]:text-gray-900",
|
|
49
49
|
className,
|
|
50
50
|
)}
|
|
51
51
|
{...props}
|
|
@@ -59,7 +59,7 @@ export const DropdownSeparator = React.forwardRef<
|
|
|
59
59
|
>(({ className, ...props }, ref) => (
|
|
60
60
|
<BaseMenu.Separator
|
|
61
61
|
ref={ref}
|
|
62
|
-
className={cn("
|
|
62
|
+
className={cn("pb:-mx-1 pb:my-1 pb:h-px pb:bg-gray-100", className)}
|
|
63
63
|
{...props}
|
|
64
64
|
/>
|
|
65
65
|
));
|
package/src/ui/Field.stories.tsx
CHANGED
|
@@ -36,15 +36,15 @@ export const Default: Story = {
|
|
|
36
36
|
|
|
37
37
|
export const Variations: Story = {
|
|
38
38
|
render: () => (
|
|
39
|
-
<div className="flex flex-col gap-12 p-4 max-w-2xl">
|
|
40
|
-
<div className="space-y-4">
|
|
39
|
+
<div className="pb:flex pb:flex-col pb:gap-12 pb:p-4 pb:max-w-2xl">
|
|
40
|
+
<div className="pb:space-y-4">
|
|
41
41
|
<Heading
|
|
42
42
|
level={4}
|
|
43
|
-
className="text-sm font-medium text-black uppercase tracking-wider"
|
|
43
|
+
className="pb:text-sm pb:font-medium pb:text-black pb:uppercase pb:tracking-wider"
|
|
44
44
|
>
|
|
45
45
|
Basic Inputs
|
|
46
46
|
</Heading>
|
|
47
|
-
<div className="grid gap-6">
|
|
47
|
+
<div className="pb:grid pb:gap-6">
|
|
48
48
|
<Field
|
|
49
49
|
label="Text Input"
|
|
50
50
|
description="Standard text field"
|
|
@@ -61,14 +61,14 @@ export const Variations: Story = {
|
|
|
61
61
|
</div>
|
|
62
62
|
</div>
|
|
63
63
|
|
|
64
|
-
<div className="space-y-4">
|
|
64
|
+
<div className="pb:space-y-4">
|
|
65
65
|
<Heading
|
|
66
66
|
level={4}
|
|
67
|
-
className="text-sm font-medium text-black uppercase tracking-wider"
|
|
67
|
+
className="pb:text-sm pb:font-medium pb:text-black pb:uppercase pb:tracking-wider"
|
|
68
68
|
>
|
|
69
69
|
Selection & Toggles
|
|
70
70
|
</Heading>
|
|
71
|
-
<div className="grid gap-6">
|
|
71
|
+
<div className="pb:grid pb:gap-6">
|
|
72
72
|
<Field label="Select Language">
|
|
73
73
|
<Select
|
|
74
74
|
options={[
|
|
@@ -81,7 +81,7 @@ export const Variations: Story = {
|
|
|
81
81
|
</Field>
|
|
82
82
|
<Field
|
|
83
83
|
label="Enable Notifications"
|
|
84
|
-
className="flex-row items-center justify-between"
|
|
84
|
+
className="pb:flex-row pb:items-center pb:justify-between"
|
|
85
85
|
>
|
|
86
86
|
<Switch />
|
|
87
87
|
</Field>
|
|
@@ -95,14 +95,14 @@ export const Variations: Story = {
|
|
|
95
95
|
</div>
|
|
96
96
|
</div>
|
|
97
97
|
|
|
98
|
-
<div className="space-y-4">
|
|
98
|
+
<div className="pb:space-y-4">
|
|
99
99
|
<Heading
|
|
100
100
|
level={4}
|
|
101
|
-
className="text-sm font-medium text-black uppercase tracking-wider"
|
|
101
|
+
className="pb:text-sm pb:font-medium pb:text-black pb:uppercase pb:tracking-wider"
|
|
102
102
|
>
|
|
103
103
|
Sliders
|
|
104
104
|
</Heading>
|
|
105
|
-
<div className="grid gap-6">
|
|
105
|
+
<div className="pb:grid pb:gap-6">
|
|
106
106
|
<Field label="Simple Slider" tooltip="Adjust volume">
|
|
107
107
|
<Slider defaultValue={50} />
|
|
108
108
|
</Field>
|
|
@@ -117,14 +117,14 @@ export const Variations: Story = {
|
|
|
117
117
|
</div>
|
|
118
118
|
</div>
|
|
119
119
|
|
|
120
|
-
<div className="space-y-4">
|
|
120
|
+
<div className="pb:space-y-4">
|
|
121
121
|
<Heading
|
|
122
122
|
level={4}
|
|
123
|
-
className="text-sm font-medium text-black uppercase tracking-wider"
|
|
123
|
+
className="pb:text-sm pb:font-medium pb:text-black pb:uppercase pb:tracking-wider"
|
|
124
124
|
>
|
|
125
125
|
Layout Variations
|
|
126
126
|
</Heading>
|
|
127
|
-
<div className="grid gap-6">
|
|
127
|
+
<div className="pb:grid pb:gap-6">
|
|
128
128
|
<Field
|
|
129
129
|
label="Label on Left"
|
|
130
130
|
labelPlacement="left"
|
|
@@ -145,18 +145,18 @@ export const Variations: Story = {
|
|
|
145
145
|
</div>
|
|
146
146
|
</div>
|
|
147
147
|
|
|
148
|
-
<div className="space-y-4">
|
|
148
|
+
<div className="pb:space-y-4">
|
|
149
149
|
<Heading
|
|
150
150
|
level={4}
|
|
151
|
-
className="text-sm font-medium text-black uppercase tracking-wider"
|
|
151
|
+
className="pb:text-sm pb:font-medium pb:text-black pb:uppercase pb:tracking-wider"
|
|
152
152
|
>
|
|
153
153
|
Field Groups
|
|
154
154
|
</Heading>
|
|
155
|
-
<div className="border rounded-lg p-6 bg-gray-50/50">
|
|
156
|
-
<Heading level={5} className="font-bold mb-4">
|
|
155
|
+
<div className="pb:border pb:rounded-lg pb:p-6 pb:bg-gray-50/50">
|
|
156
|
+
<Heading level={5} className="pb:font-bold pb:mb-4">
|
|
157
157
|
Settings Group
|
|
158
158
|
</Heading>
|
|
159
|
-
<div className="flex flex-col gap-4">
|
|
159
|
+
<div className="pb:flex pb:flex-col pb:gap-4">
|
|
160
160
|
<Field
|
|
161
161
|
label="Break up long sentences"
|
|
162
162
|
labelPlacement="right"
|
package/src/ui/Field.tsx
CHANGED
|
@@ -42,19 +42,19 @@ export const Field = React.forwardRef<HTMLDivElement, FieldProps>(
|
|
|
42
42
|
<BaseField.Root
|
|
43
43
|
ref={ref}
|
|
44
44
|
className={cn(
|
|
45
|
-
"flex w-full",
|
|
46
|
-
isHorizontal ? "flex-col gap-1" : "flex-col gap-1.5",
|
|
45
|
+
"pb:flex pb:w-full",
|
|
46
|
+
isHorizontal ? "pb:flex-col pb:gap-1" : "pb:flex-col pb:gap-1.5",
|
|
47
47
|
className as string,
|
|
48
48
|
)}
|
|
49
49
|
{...props}
|
|
50
50
|
>
|
|
51
51
|
<div
|
|
52
52
|
className={cn(
|
|
53
|
-
"flex",
|
|
54
|
-
isHorizontal ? "flex-row items-center gap-2" : "flex-col gap-1.5",
|
|
53
|
+
"pb:flex",
|
|
54
|
+
isHorizontal ? "pb:flex-row pb:items-center pb:gap-2" : "pb:flex-col pb:gap-1.5",
|
|
55
55
|
)}
|
|
56
56
|
>
|
|
57
|
-
{labelOnRight && <div className="relative">{children}</div>}
|
|
57
|
+
{labelOnRight && <div className="pb:relative">{children}</div>}
|
|
58
58
|
|
|
59
59
|
{label && (
|
|
60
60
|
<BaseField.Label
|
|
@@ -62,13 +62,13 @@ export const Field = React.forwardRef<HTMLDivElement, FieldProps>(
|
|
|
62
62
|
<Label
|
|
63
63
|
tooltip={tooltip}
|
|
64
64
|
className={cn(
|
|
65
|
-
"mb-0",
|
|
66
|
-
labelWeight === "normal" && "font-normal",
|
|
65
|
+
"pb:mb-0",
|
|
66
|
+
labelWeight === "normal" && "pb:font-normal",
|
|
67
67
|
)}
|
|
68
68
|
{...props}
|
|
69
69
|
>
|
|
70
|
-
<span className="flex items-center gap-1">
|
|
71
|
-
{icon && <span className="flex-shrink-0">{icon}</span>}
|
|
70
|
+
<span className="pb:flex pb:items-center pb:gap-1">
|
|
71
|
+
{icon && <span className="pb:flex-shrink-0">{icon}</span>}
|
|
72
72
|
{label}
|
|
73
73
|
</span>
|
|
74
74
|
</Label>
|
|
@@ -76,14 +76,14 @@ export const Field = React.forwardRef<HTMLDivElement, FieldProps>(
|
|
|
76
76
|
/>
|
|
77
77
|
)}
|
|
78
78
|
|
|
79
|
-
{!labelOnRight && <div className="relative">{children}</div>}
|
|
79
|
+
{!labelOnRight && <div className="pb:relative">{children}</div>}
|
|
80
80
|
</div>
|
|
81
81
|
|
|
82
82
|
{description && (
|
|
83
83
|
<BaseField.Description
|
|
84
84
|
className={cn(
|
|
85
|
-
"text-xs text-gray-500",
|
|
86
|
-
labelOnRight && "ml-7", // Aligns description with label text when child is on left
|
|
85
|
+
"pb:text-xs pb:text-gray-500",
|
|
86
|
+
labelOnRight && "pb:ml-7", // Aligns description with label text when child is on left
|
|
87
87
|
)}
|
|
88
88
|
>
|
|
89
89
|
{description}
|
|
@@ -93,8 +93,8 @@ export const Field = React.forwardRef<HTMLDivElement, FieldProps>(
|
|
|
93
93
|
{error && (
|
|
94
94
|
<BaseField.Error
|
|
95
95
|
className={cn(
|
|
96
|
-
"text-xs text-red-600 font-medium",
|
|
97
|
-
labelOnRight && "ml-7",
|
|
96
|
+
"pb:text-xs pb:text-red-600 pb:font-medium",
|
|
97
|
+
labelOnRight && "pb:ml-7",
|
|
98
98
|
)}
|
|
99
99
|
>
|
|
100
100
|
{error}
|
package/src/ui/Icon.stories.tsx
CHANGED
|
@@ -88,7 +88,7 @@ export const Default: Story = {
|
|
|
88
88
|
|
|
89
89
|
export const NamedIcons: Story = {
|
|
90
90
|
render: () => (
|
|
91
|
-
<div className="grid grid-cols-6 gap-4 p-4">
|
|
91
|
+
<div className="pb:grid pb:grid-cols-6 pb:gap-4 pb:p-4">
|
|
92
92
|
{[
|
|
93
93
|
"arrowDown",
|
|
94
94
|
"arrowDownToLine",
|
|
@@ -145,7 +145,7 @@ export const NamedIcons: Story = {
|
|
|
145
145
|
"xCircle",
|
|
146
146
|
"zap",
|
|
147
147
|
].map((name) => (
|
|
148
|
-
<div key={name} className="flex flex-col items-center">
|
|
148
|
+
<div key={name} className="pb:flex pb:flex-col pb:items-center">
|
|
149
149
|
<Icon name={name as IconName} />
|
|
150
150
|
<Text variant="small">{name}</Text>
|
|
151
151
|
</div>
|
|
@@ -156,35 +156,35 @@ export const NamedIcons: Story = {
|
|
|
156
156
|
|
|
157
157
|
export const Variations: Story = {
|
|
158
158
|
render: () => (
|
|
159
|
-
<div className="flex flex-col gap-12 p-4">
|
|
160
|
-
<div className="space-y-4">
|
|
161
|
-
<Text variant="small" className="font-bold underline uppercase">
|
|
159
|
+
<div className="pb:flex pb:flex-col pb:gap-12 pb:p-4">
|
|
160
|
+
<div className="pb:space-y-4">
|
|
161
|
+
<Text variant="small" className="pb:font-bold pb:underline pb:uppercase">
|
|
162
162
|
Different Sizes
|
|
163
163
|
</Text>
|
|
164
|
-
<div className="flex items-end gap-4">
|
|
164
|
+
<div className="pb:flex pb:items-end pb:gap-4">
|
|
165
165
|
<Icon size="sm">{CheckPath}</Icon>
|
|
166
166
|
<Icon size="md">{CheckPath}</Icon>
|
|
167
167
|
<Icon size="lg">{CheckPath}</Icon>
|
|
168
168
|
<Icon size="xl">{CheckPath}</Icon>
|
|
169
169
|
</div>
|
|
170
170
|
</div>
|
|
171
|
-
<div className="space-y-4">
|
|
172
|
-
<Text variant="small" className="font-bold underline uppercase">
|
|
171
|
+
<div className="pb:space-y-4">
|
|
172
|
+
<Text variant="small" className="pb:font-bold pb:underline pb:uppercase">
|
|
173
173
|
Different Content & Colors
|
|
174
174
|
</Text>
|
|
175
|
-
<div className="flex gap-4">
|
|
176
|
-
<Icon className="text-red-500">{XPath}</Icon>
|
|
177
|
-
<Icon className="text-primary">{CheckPath}</Icon>
|
|
175
|
+
<div className="pb:flex pb:gap-4">
|
|
176
|
+
<Icon className="pb:text-red-500">{XPath}</Icon>
|
|
177
|
+
<Icon className="pb:text-primary">{CheckPath}</Icon>
|
|
178
178
|
</div>
|
|
179
179
|
</div>
|
|
180
|
-
<div className="space-y-4">
|
|
181
|
-
<Text variant="small" className="font-bold underline uppercase">
|
|
180
|
+
<div className="pb:space-y-4">
|
|
181
|
+
<Text variant="small" className="pb:font-bold pb:underline pb:uppercase">
|
|
182
182
|
Using Named Icons
|
|
183
183
|
</Text>
|
|
184
|
-
<div className="flex gap-4">
|
|
185
|
-
<Icon name="check" className="text-green-500" />
|
|
186
|
-
<Icon name="x" className="text-red-500" />
|
|
187
|
-
<Icon name="plus" className="text-blue-500" />
|
|
184
|
+
<div className="pb:flex pb:gap-4">
|
|
185
|
+
<Icon name="check" className="pb:text-green-500" />
|
|
186
|
+
<Icon name="x" className="pb:text-red-500" />
|
|
187
|
+
<Icon name="plus" className="pb:text-blue-500" />
|
|
188
188
|
</div>
|
|
189
189
|
</div>
|
|
190
190
|
</div>
|
package/src/ui/Icon.tsx
CHANGED
|
@@ -12,10 +12,10 @@ export interface IconProps extends React.SVGProps<SVGSVGElement> {
|
|
|
12
12
|
export const Icon = React.forwardRef<SVGSVGElement, IconProps>(
|
|
13
13
|
({ className, size = "md", name, children, ...props }, ref) => {
|
|
14
14
|
const sizes = {
|
|
15
|
-
sm: "w-3 h-3",
|
|
16
|
-
md: "w-4 h-4",
|
|
17
|
-
lg: "w-6 h-6",
|
|
18
|
-
xl: "w-8 h-8",
|
|
15
|
+
sm: "pb:w-3 pb:h-3",
|
|
16
|
+
md: "pb:w-4 pb:h-4",
|
|
17
|
+
lg: "pb:w-6 pb:h-6",
|
|
18
|
+
xl: "pb:w-8 pb:h-8",
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const iconContent = name ? icons[name] : children;
|
|
@@ -30,7 +30,7 @@ export const Icon = React.forwardRef<SVGSVGElement, IconProps>(
|
|
|
30
30
|
strokeWidth="1.5"
|
|
31
31
|
strokeLinecap="round"
|
|
32
32
|
strokeLinejoin="round"
|
|
33
|
-
className={cn(sizes[size], "inline-block", className)}
|
|
33
|
+
className={cn(sizes[size], "pb:inline-block", className)}
|
|
34
34
|
{...props}
|
|
35
35
|
>
|
|
36
36
|
{iconContent}
|
package/src/ui/Input.stories.tsx
CHANGED
|
@@ -22,26 +22,26 @@ export const Default: Story = {
|
|
|
22
22
|
|
|
23
23
|
export const Variations: Story = {
|
|
24
24
|
render: () => (
|
|
25
|
-
<div className="flex flex-col gap-8 p-4 max-w-sm">
|
|
26
|
-
<div className="space-y-4">
|
|
27
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
25
|
+
<div className="pb:flex pb:flex-col pb:gap-8 pb:p-4 pb:max-w-sm">
|
|
26
|
+
<div className="pb:space-y-4">
|
|
27
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
28
28
|
Input Styles
|
|
29
29
|
</Heading>
|
|
30
|
-
<div className="space-y-4">
|
|
31
|
-
<div className="space-y-1">
|
|
32
|
-
<Text variant="small" className="font-bold">
|
|
30
|
+
<div className="pb:space-y-4">
|
|
31
|
+
<div className="pb:space-y-1">
|
|
32
|
+
<Text variant="small" className="pb:font-bold">
|
|
33
33
|
With Placeholder
|
|
34
34
|
</Text>
|
|
35
35
|
<Input placeholder="Type here..." />
|
|
36
36
|
</div>
|
|
37
|
-
<div className="space-y-1">
|
|
38
|
-
<Text variant="small" className="font-bold">
|
|
37
|
+
<div className="pb:space-y-1">
|
|
38
|
+
<Text variant="small" className="pb:font-bold">
|
|
39
39
|
With Value
|
|
40
40
|
</Text>
|
|
41
41
|
<Input defaultValue="Initial value" />
|
|
42
42
|
</div>
|
|
43
|
-
<div className="space-y-1">
|
|
44
|
-
<Text variant="small" className="font-bold">
|
|
43
|
+
<div className="pb:space-y-1">
|
|
44
|
+
<Text variant="small" className="pb:font-bold">
|
|
45
45
|
Password Type
|
|
46
46
|
</Text>
|
|
47
47
|
<Input type="password" placeholder="Password..." />
|
|
@@ -49,13 +49,13 @@ export const Variations: Story = {
|
|
|
49
49
|
</div>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
|
-
<div className="space-y-4">
|
|
53
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
52
|
+
<div className="pb:space-y-4">
|
|
53
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
54
54
|
States
|
|
55
55
|
</Heading>
|
|
56
|
-
<div className="space-y-4">
|
|
57
|
-
<div className="space-y-1">
|
|
58
|
-
<Text variant="small" className="font-bold">
|
|
56
|
+
<div className="pb:space-y-4">
|
|
57
|
+
<div className="pb:space-y-1">
|
|
58
|
+
<Text variant="small" className="pb:font-bold">
|
|
59
59
|
Disabled
|
|
60
60
|
</Text>
|
|
61
61
|
<Input disabled defaultValue="Can't edit me" />
|
package/src/ui/Input.tsx
CHANGED
|
@@ -10,9 +10,9 @@ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>
|
|
|
10
10
|
export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
11
11
|
({ className, leftIcon, rightIcon, id, ...props }, ref) => {
|
|
12
12
|
const inputClasses = cn(
|
|
13
|
-
"block w-full rounded-md border-0 px-1.5 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary sm:text-sm sm:leading-6 bg-primary/10 appearance-none",
|
|
14
|
-
leftIcon && "pl-10",
|
|
15
|
-
rightIcon && "pr-10",
|
|
13
|
+
"pb:block pb:w-full pb:rounded-md pb:border-0 pb:px-1.5 pb:py-1.5 pb:text-gray-900 pb:shadow-sm pb:ring-1 pb:ring-inset pb:ring-gray-300 pb:placeholder:text-gray-400 pb:focus:ring-2 pb:focus:ring-inset pb:focus:ring-primary pb:sm:text-sm pb:sm:leading-6 pb:bg-primary/10 pb:appearance-none",
|
|
14
|
+
leftIcon && "pb:pl-10",
|
|
15
|
+
rightIcon && "pb:pr-10",
|
|
16
16
|
className,
|
|
17
17
|
);
|
|
18
18
|
|
|
@@ -23,16 +23,16 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<div className="relative">
|
|
26
|
+
<div className="pb:relative">
|
|
27
27
|
{leftIcon && (
|
|
28
|
-
<div className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
|
29
|
-
<span className="text-gray-500 sm:text-sm">{leftIcon}</span>
|
|
28
|
+
<div className="pb:pointer-events-none pb:absolute pb:inset-y-0 pb:left-0 pb:flex pb:items-center pb:pl-3">
|
|
29
|
+
<span className="pb:text-gray-500 pb:sm:text-sm">{leftIcon}</span>
|
|
30
30
|
</div>
|
|
31
31
|
)}
|
|
32
32
|
<BaseInput ref={ref} id={id} className={inputClasses} {...props} />
|
|
33
33
|
{rightIcon && (
|
|
34
|
-
<div className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3">
|
|
35
|
-
<span className="text-gray-500 sm:text-sm">{rightIcon}</span>
|
|
34
|
+
<div className="pb:pointer-events-none pb:absolute pb:inset-y-0 pb:right-0 pb:flex pb:items-center pb:pr-3">
|
|
35
|
+
<span className="pb:text-gray-500 pb:sm:text-sm">{rightIcon}</span>
|
|
36
36
|
</div>
|
|
37
37
|
)}
|
|
38
38
|
</div>
|
package/src/ui/Label.stories.tsx
CHANGED
|
@@ -19,18 +19,18 @@ export const Default: Story = {};
|
|
|
19
19
|
|
|
20
20
|
export const Variations: Story = {
|
|
21
21
|
render: () => (
|
|
22
|
-
<div className="flex flex-col gap-12 p-4">
|
|
23
|
-
<div className="space-y-2">
|
|
24
|
-
<Text variant="small" className="font-bold underline uppercase">
|
|
22
|
+
<div className="pb:flex pb:flex-col pb:gap-12 pb:p-4">
|
|
23
|
+
<div className="pb:space-y-2">
|
|
24
|
+
<Text variant="small" className="pb:font-bold pb:underline pb:uppercase">
|
|
25
25
|
With Tooltip
|
|
26
26
|
</Text>
|
|
27
27
|
<Label tooltip="Extra information here.">Hover the help icon</Label>
|
|
28
28
|
</div>
|
|
29
|
-
<div className="space-y-2">
|
|
30
|
-
<Text variant="small" className="font-bold underline uppercase">
|
|
29
|
+
<div className="pb:space-y-2">
|
|
30
|
+
<Text variant="small" className="pb:font-bold pb:underline pb:uppercase">
|
|
31
31
|
With Associated Input
|
|
32
32
|
</Text>
|
|
33
|
-
<div className="space-y-1">
|
|
33
|
+
<div className="pb:space-y-1">
|
|
34
34
|
<Label htmlFor="v-input" tooltip="This is required">
|
|
35
35
|
Email Address
|
|
36
36
|
</Label>
|
package/src/ui/Label.tsx
CHANGED
|
@@ -12,12 +12,12 @@ export function Label({ children, tooltip, className, ...props }: LabelProps) {
|
|
|
12
12
|
return (
|
|
13
13
|
<label
|
|
14
14
|
className={cn(
|
|
15
|
-
"relative block text-sm font-bold leading-6 text-gray-600 mb-1 group-focus-within:text-gray-800",
|
|
15
|
+
"pb:relative pb:block pb:text-sm pb:font-bold pb:leading-6 pb:text-gray-600 pb:mb-1 pb:group-focus-within:text-gray-800",
|
|
16
16
|
className,
|
|
17
17
|
)}
|
|
18
18
|
{...props}
|
|
19
19
|
>
|
|
20
|
-
<div className="flex items-center gap-1">
|
|
20
|
+
<div className="pb:flex pb:items-center pb:gap-1">
|
|
21
21
|
{children}
|
|
22
22
|
{tooltip && <HelperTooltip content={tooltip} />}
|
|
23
23
|
</div>
|
|
@@ -27,8 +27,8 @@ export const Default: Story = {
|
|
|
27
27
|
const InteractiveExample = (args: React.ComponentProps<typeof NumberField>) => {
|
|
28
28
|
const [value, setValue] = useState<number | null>(args.defaultValue ?? 10);
|
|
29
29
|
return (
|
|
30
|
-
<div className="space-y-2">
|
|
31
|
-
<div className="max-w-[200px]">
|
|
30
|
+
<div className="pb:space-y-2">
|
|
31
|
+
<div className="pb:max-w-[200px]">
|
|
32
32
|
<NumberField
|
|
33
33
|
{...args}
|
|
34
34
|
value={value}
|
|
@@ -42,20 +42,20 @@ const InteractiveExample = (args: React.ComponentProps<typeof NumberField>) => {
|
|
|
42
42
|
|
|
43
43
|
export const Variations: Story = {
|
|
44
44
|
render: () => (
|
|
45
|
-
<div className="flex flex-col gap-12 p-4">
|
|
46
|
-
<div className="space-y-4">
|
|
47
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
45
|
+
<div className="pb:flex pb:flex-col pb:gap-12 pb:p-4">
|
|
46
|
+
<div className="pb:space-y-4">
|
|
47
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
48
48
|
Configuration
|
|
49
49
|
</Heading>
|
|
50
|
-
<div className="grid gap-8">
|
|
51
|
-
<div className="space-y-2">
|
|
52
|
-
<Text variant="small" className="font-bold">
|
|
50
|
+
<div className="pb:grid pb:gap-8">
|
|
51
|
+
<div className="pb:space-y-2">
|
|
52
|
+
<Text variant="small" className="pb:font-bold">
|
|
53
53
|
With Buttons & Large Step
|
|
54
54
|
</Text>
|
|
55
55
|
<NumberField showButtons defaultValue={50} step={10} />
|
|
56
56
|
</div>
|
|
57
|
-
<div className="space-y-2">
|
|
58
|
-
<Text variant="small" className="font-bold">
|
|
57
|
+
<div className="pb:space-y-2">
|
|
58
|
+
<Text variant="small" className="pb:font-bold">
|
|
59
59
|
Small Step (0.1) & Limits (0-1)
|
|
60
60
|
</Text>
|
|
61
61
|
<NumberField
|
|
@@ -66,8 +66,8 @@ export const Variations: Story = {
|
|
|
66
66
|
max={1}
|
|
67
67
|
/>
|
|
68
68
|
</div>
|
|
69
|
-
<div className="space-y-2">
|
|
70
|
-
<Text variant="small" className="font-bold">
|
|
69
|
+
<div className="pb:space-y-2">
|
|
70
|
+
<Text variant="small" className="pb:font-bold">
|
|
71
71
|
Disabled
|
|
72
72
|
</Text>
|
|
73
73
|
<NumberField disabled defaultValue={123} />
|
|
@@ -75,8 +75,8 @@ export const Variations: Story = {
|
|
|
75
75
|
</div>
|
|
76
76
|
</div>
|
|
77
77
|
|
|
78
|
-
<div className="space-y-4">
|
|
79
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
78
|
+
<div className="pb:space-y-4">
|
|
79
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
80
80
|
Interactive State
|
|
81
81
|
</Heading>
|
|
82
82
|
<InteractiveExample showButtons={true} />
|
package/src/ui/NumberField.tsx
CHANGED
|
@@ -41,7 +41,7 @@ export const NumberField = React.forwardRef<HTMLDivElement, NumberFieldProps>(
|
|
|
41
41
|
const numberId = propsId || generatedId;
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
|
-
<div className="w-full">
|
|
44
|
+
<div className="pb:w-full">
|
|
45
45
|
<BaseNumberField.Root
|
|
46
46
|
ref={ref}
|
|
47
47
|
value={value}
|
|
@@ -57,19 +57,19 @@ export const NumberField = React.forwardRef<HTMLDivElement, NumberFieldProps>(
|
|
|
57
57
|
}}
|
|
58
58
|
disabled={disabled}
|
|
59
59
|
readOnly={readOnly}
|
|
60
|
-
className={cn("flex flex-col gap-1", className)}
|
|
60
|
+
className={cn("pb:flex pb:flex-col pb:gap-1", className)}
|
|
61
61
|
{...props}
|
|
62
62
|
>
|
|
63
63
|
<div
|
|
64
64
|
className={cn(
|
|
65
|
-
"group relative flex items-center rounded-md border-0 bg-primary/10 ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-primary shadow-sm",
|
|
66
|
-
disabled && "opacity-50 cursor-not-allowed",
|
|
65
|
+
"pb:group pb:relative pb:flex pb:items-center pb:rounded-md pb:border-0 pb:bg-primary/10 pb:ring-1 pb:ring-inset pb:ring-gray-300 pb:focus-within:ring-2 pb:focus-within:ring-primary pb:shadow-sm",
|
|
66
|
+
disabled && "pb:opacity-50 pb:cursor-not-allowed",
|
|
67
67
|
)}
|
|
68
68
|
>
|
|
69
69
|
{showButtons && (
|
|
70
70
|
<BaseNumberField.Decrement
|
|
71
71
|
aria-label="Decrement"
|
|
72
|
-
className="relative z-20 flex items-center justify-center w-8 h-9 text-gray-500 hover:text-gray-700 hover:bg-gray-100/50 rounded-l-md border-r border-gray-300 disabled:opacity-30 cursor-pointer"
|
|
72
|
+
className="pb:relative pb:z-20 pb:flex pb:items-center pb:justify-center pb:w-8 pb:h-9 pb:text-gray-500 pb:hover:text-gray-700 pb:hover:bg-gray-100/50 pb:rounded-l-md pb:border-r pb:border-gray-300 disabled:pb:opacity-30 pb:cursor-pointer"
|
|
73
73
|
>
|
|
74
74
|
<Icon size="sm">
|
|
75
75
|
<path
|
|
@@ -85,15 +85,15 @@ export const NumberField = React.forwardRef<HTMLDivElement, NumberFieldProps>(
|
|
|
85
85
|
id={numberId}
|
|
86
86
|
placeholder={placeholder}
|
|
87
87
|
className={cn(
|
|
88
|
-
"block w-full bg-transparent border-0 px-3 py-1.5 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6 text-center appearance-none relative z-0",
|
|
89
|
-
!showButtons && "rounded-md",
|
|
88
|
+
"pb:block pb:w-full pb:bg-transparent pb:border-0 pb:px-3 pb:py-1.5 pb:text-gray-900 pb:placeholder:text-gray-400 pb:focus:ring-0 pb:sm:text-sm pb:sm:leading-6 pb:text-center pb:appearance-none pb:relative pb:z-0",
|
|
89
|
+
!showButtons && "pb:rounded-md",
|
|
90
90
|
)}
|
|
91
91
|
/>
|
|
92
92
|
|
|
93
93
|
{showButtons && (
|
|
94
94
|
<BaseNumberField.Increment
|
|
95
95
|
aria-label="Increment"
|
|
96
|
-
className="relative z-20 flex items-center justify-center w-8 h-9 text-gray-500 hover:text-gray-700 hover:bg-gray-100/50 rounded-r-md border-l border-gray-300 disabled:opacity-30 cursor-pointer"
|
|
96
|
+
className="pb:relative pb:z-20 pb:flex pb:items-center pb:justify-center pb:w-8 pb:h-9 pb:text-gray-500 pb:hover:text-gray-700 pb:hover:bg-gray-100/50 pb:rounded-r-md pb:border-l pb:border-gray-300 disabled:pb:opacity-30 pb:cursor-pointer"
|
|
97
97
|
>
|
|
98
98
|
<Icon size="sm">
|
|
99
99
|
<path
|
|
@@ -105,7 +105,7 @@ export const NumberField = React.forwardRef<HTMLDivElement, NumberFieldProps>(
|
|
|
105
105
|
</BaseNumberField.Increment>
|
|
106
106
|
)}
|
|
107
107
|
|
|
108
|
-
<BaseNumberField.ScrubArea className="absolute inset-0 z-10 cursor-ew-resize opacity-0 hover:opacity-10 transition-opacity bg-primary/5 rounded-md pointer-events-none group-hover:pointer-events-auto" />
|
|
108
|
+
<BaseNumberField.ScrubArea className="pb:absolute pb:inset-0 pb:z-10 pb:cursor-ew-resize pb:opacity-0 pb:hover:opacity-10 pb:transition-opacity pb:bg-primary/5 pb:rounded-md pb:pointer-events-none group-pb:hover:pointer-events-auto" />
|
|
109
109
|
</div>
|
|
110
110
|
</BaseNumberField.Root>
|
|
111
111
|
</div>
|
package/src/ui/Popover.tsx
CHANGED
|
@@ -28,12 +28,12 @@ export function Popover({
|
|
|
28
28
|
<BasePopover.Positioner side={side} align={align} sideOffset={5}>
|
|
29
29
|
<BasePopover.Popup
|
|
30
30
|
className={cn(
|
|
31
|
-
"z-50 w-72 rounded-md border bg-white p-4 shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
31
|
+
"pb:z-50 pb:w-72 pb:rounded-md pb:border pb:bg-white pb:p-4 pb:shadow-md pb:outline-none pb:data-[state=open]:animate-in pb:data-[state=closed]:animate-out pb:data-[state=closed]:fade-out-0 pb:data-[state=open]:fade-in-0 pb:data-[state=closed]:zoom-out-95 pb:data-[state=open]:zoom-in-95",
|
|
32
32
|
className,
|
|
33
33
|
)}
|
|
34
34
|
>
|
|
35
35
|
{children}
|
|
36
|
-
<BasePopover.Arrow className="fill-white stroke-gray-200" />
|
|
36
|
+
<BasePopover.Arrow className="pb:fill-white pb:stroke-gray-200" />
|
|
37
37
|
</BasePopover.Popup>
|
|
38
38
|
</BasePopover.Positioner>
|
|
39
39
|
</BasePopover.Portal>
|