@peerbots/core 0.1.2 → 0.2.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/CHANGELOG.md +14 -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 +11 -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
- package/.changeset/big-loops-drum.md +0 -5
- package/.changeset/deep-brooms-taste.md +0 -5
|
@@ -31,20 +31,20 @@ export const Default: Story = {
|
|
|
31
31
|
|
|
32
32
|
export const Variations: Story = {
|
|
33
33
|
render: () => (
|
|
34
|
-
<div className="flex flex-col gap-8 p-4 max-w-sm">
|
|
35
|
-
<div className="space-y-4">
|
|
36
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
34
|
+
<div className="pb:flex pb:flex-col pb:gap-8 pb:p-4 pb:max-w-sm">
|
|
35
|
+
<div className="pb:space-y-4">
|
|
36
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
37
37
|
Option Types
|
|
38
38
|
</Heading>
|
|
39
|
-
<div className="space-y-4">
|
|
40
|
-
<div className="space-y-1">
|
|
41
|
-
<Text variant="small" className="font-bold">
|
|
39
|
+
<div className="pb:space-y-4">
|
|
40
|
+
<div className="pb:space-y-1">
|
|
41
|
+
<Text variant="small" className="pb:font-bold">
|
|
42
42
|
String Options
|
|
43
43
|
</Text>
|
|
44
44
|
<Select options={simpleOptions} />
|
|
45
45
|
</div>
|
|
46
|
-
<div className="space-y-1">
|
|
47
|
-
<Text variant="small" className="font-bold">
|
|
46
|
+
<div className="pb:space-y-1">
|
|
47
|
+
<Text variant="small" className="pb:font-bold">
|
|
48
48
|
Object Options (Label/Value)
|
|
49
49
|
</Text>
|
|
50
50
|
<Select options={objectOptions} defaultValue="apple" />
|
|
@@ -52,13 +52,13 @@ export const Variations: Story = {
|
|
|
52
52
|
</div>
|
|
53
53
|
</div>
|
|
54
54
|
|
|
55
|
-
<div className="space-y-4">
|
|
56
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
55
|
+
<div className="pb:space-y-4">
|
|
56
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
57
57
|
States
|
|
58
58
|
</Heading>
|
|
59
|
-
<div className="space-y-4">
|
|
60
|
-
<div className="space-y-1">
|
|
61
|
-
<Text variant="small" className="font-bold">
|
|
59
|
+
<div className="pb:space-y-4">
|
|
60
|
+
<div className="pb:space-y-1">
|
|
61
|
+
<Text variant="small" className="pb:font-bold">
|
|
62
62
|
Disabled
|
|
63
63
|
</Text>
|
|
64
64
|
<Select
|
package/src/ui/Select.tsx
CHANGED
|
@@ -40,7 +40,7 @@ export const Select = React.forwardRef<HTMLButtonElement, SelectProps>(
|
|
|
40
40
|
const selectId = propsId || generatedId;
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
|
-
<div className="w-full">
|
|
43
|
+
<div className="pb:w-full">
|
|
44
44
|
<BaseSelect.Root
|
|
45
45
|
value={value === undefined ? null : String(value)}
|
|
46
46
|
defaultValue={
|
|
@@ -62,8 +62,8 @@ export const Select = React.forwardRef<HTMLButtonElement, SelectProps>(
|
|
|
62
62
|
ref={ref}
|
|
63
63
|
id={selectId}
|
|
64
64
|
className={cn(
|
|
65
|
-
"flex w-full items-center justify-between rounded-md border-0 py-1.5 pl-3 pr-3 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-primary sm:text-sm sm:leading-6 bg-primary/10 min-h-[36px]",
|
|
66
|
-
disabled && "opacity-50 cursor-not-allowed",
|
|
65
|
+
"pb:flex pb:w-full pb:items-center pb:justify-between pb:rounded-md pb:border-0 pb:py-1.5 pb:pl-3 pb:pr-3 pb:text-gray-900 pb:ring-1 pb:ring-inset pb:ring-gray-300 pb:focus:ring-2 pb:focus:ring-primary pb:sm:text-sm pb:sm:leading-6 pb:bg-primary/10 pb:min-h-[36px]",
|
|
66
|
+
disabled && "pb:opacity-50 pb:cursor-not-allowed",
|
|
67
67
|
className,
|
|
68
68
|
)}
|
|
69
69
|
onFocus={onFocus}
|
|
@@ -83,9 +83,9 @@ export const Select = React.forwardRef<HTMLButtonElement, SelectProps>(
|
|
|
83
83
|
<BaseSelect.Portal>
|
|
84
84
|
<BaseSelect.Positioner
|
|
85
85
|
sideOffset={4}
|
|
86
|
-
className="z-50 w-[var(--anchor-width)]"
|
|
86
|
+
className="pb:z-50 pb:w-[var(--anchor-width)]"
|
|
87
87
|
>
|
|
88
|
-
<BaseSelect.Popup className="max-h-60 overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm">
|
|
88
|
+
<BaseSelect.Popup className="pb:max-h-60 pb:overflow-auto pb:rounded-md pb:bg-white pb:py-1 pb:text-base pb:shadow-lg pb:ring-1 pb:ring-black pb:ring-opacity-5 focus:pb:outline-none pb:sm:text-sm">
|
|
89
89
|
{options.map((option, index) => {
|
|
90
90
|
const label =
|
|
91
91
|
typeof option === "object" ? option.label : option;
|
|
@@ -95,10 +95,10 @@ export const Select = React.forwardRef<HTMLButtonElement, SelectProps>(
|
|
|
95
95
|
<BaseSelect.Item
|
|
96
96
|
key={`${value}-${index}`}
|
|
97
97
|
value={value}
|
|
98
|
-
className="relative cursor-default select-none py-2 pl-3 pr-9 text-gray-900 hover:bg-gray-100 data-[highlighted]:bg-gray-100 data-[selected]:font-semibold"
|
|
98
|
+
className="pb:relative pb:cursor-default pb:select-none pb:py-2 pb:pl-3 pb:pr-9 pb:text-gray-900 pb:hover:bg-gray-100 data-[highlighted]:pb:bg-gray-100 data-[selected]:pb:font-semibold"
|
|
99
99
|
>
|
|
100
100
|
<BaseSelect.ItemText>{label}</BaseSelect.ItemText>
|
|
101
|
-
<BaseSelect.ItemIndicator className="absolute inset-y-0 right-0 flex items-center pr-4 text-primary">
|
|
101
|
+
<BaseSelect.ItemIndicator className="pb:absolute pb:inset-y-0 pb:right-0 pb:flex pb:items-center pb:pr-4 pb:text-primary">
|
|
102
102
|
<Icon size="sm">
|
|
103
103
|
<path
|
|
104
104
|
strokeLinecap="round"
|
|
@@ -22,9 +22,9 @@ export const Default: Story = {
|
|
|
22
22
|
orientation: "horizontal",
|
|
23
23
|
},
|
|
24
24
|
render: (args) => (
|
|
25
|
-
<div className="w-64">
|
|
25
|
+
<div className="pb:w-64">
|
|
26
26
|
<Text>Above the separator</Text>
|
|
27
|
-
<Separator {...args} className="my-4" />
|
|
27
|
+
<Separator {...args} className="pb:my-4" />
|
|
28
28
|
<Text>Below the separator</Text>
|
|
29
29
|
</div>
|
|
30
30
|
),
|
|
@@ -32,23 +32,23 @@ export const Default: Story = {
|
|
|
32
32
|
|
|
33
33
|
export const Variations: Story = {
|
|
34
34
|
render: () => (
|
|
35
|
-
<div className="flex flex-col gap-12 p-4">
|
|
36
|
-
<div className="space-y-4">
|
|
37
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
35
|
+
<div className="pb:flex pb:flex-col pb:gap-12 pb:p-4">
|
|
36
|
+
<div className="pb:space-y-4">
|
|
37
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
38
38
|
Horizontal (Default)
|
|
39
39
|
</Heading>
|
|
40
|
-
<div className="w-64">
|
|
40
|
+
<div className="pb:w-64">
|
|
41
41
|
<Text variant="small">Item A</Text>
|
|
42
|
-
<Separator className="my-2" />
|
|
42
|
+
<Separator className="pb:my-2" />
|
|
43
43
|
<Text variant="small">Item B</Text>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
46
|
|
|
47
|
-
<div className="space-y-4">
|
|
48
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
47
|
+
<div className="pb:space-y-4">
|
|
48
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
49
49
|
Vertical
|
|
50
50
|
</Heading>
|
|
51
|
-
<div className="flex h-8 items-center gap-4 text-sm">
|
|
51
|
+
<div className="pb:flex pb:h-8 pb:items-center pb:gap-4 pb:text-sm">
|
|
52
52
|
<Text variant="small">Option 1</Text>
|
|
53
53
|
<Separator orientation="vertical" />
|
|
54
54
|
<Text variant="small">Option 2</Text>
|
package/src/ui/Separator.tsx
CHANGED
|
@@ -17,8 +17,8 @@ export const Separator = React.forwardRef<
|
|
|
17
17
|
ref={ref}
|
|
18
18
|
orientation={orientation}
|
|
19
19
|
className={cn(
|
|
20
|
-
"shrink-0 bg-gray-200",
|
|
21
|
-
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
20
|
+
"pb:shrink-0 pb:bg-gray-200",
|
|
21
|
+
orientation === "horizontal" ? "pb:h-[1px] pb:w-full" : "pb:h-full pb:w-[1px]",
|
|
22
22
|
className,
|
|
23
23
|
)}
|
|
24
24
|
{...props}
|
|
@@ -19,9 +19,9 @@ export const Default: Story = {
|
|
|
19
19
|
args: {
|
|
20
20
|
title: "Account Settings",
|
|
21
21
|
children: (
|
|
22
|
-
<div className="space-y-4">
|
|
22
|
+
<div className="pb:space-y-4">
|
|
23
23
|
<Text>This is the content of the settings panel.</Text>
|
|
24
|
-
<div className="flex gap-2">
|
|
24
|
+
<div className="pb:flex pb:gap-2">
|
|
25
25
|
<Button variant="primary">Save Changes</Button>
|
|
26
26
|
<Button variant="secondary">Cancel</Button>
|
|
27
27
|
</div>
|
|
@@ -32,17 +32,17 @@ export const Default: Story = {
|
|
|
32
32
|
|
|
33
33
|
export const Variations: Story = {
|
|
34
34
|
render: () => (
|
|
35
|
-
<div className="flex flex-col gap-12 p-4 max-w-2xl bg-gray-50">
|
|
36
|
-
<div className="space-y-4">
|
|
37
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
35
|
+
<div className="pb:flex pb:flex-col pb:gap-12 pb:p-4 pb:max-w-2xl pb:bg-gray-50">
|
|
36
|
+
<div className="pb:space-y-4">
|
|
37
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
38
38
|
Default
|
|
39
39
|
</Heading>
|
|
40
40
|
<SettingsPanel title="Notification Settings">
|
|
41
|
-
<div className="space-y-4">
|
|
41
|
+
<div className="pb:space-y-4">
|
|
42
42
|
<Text>Manage how you receive notifications.</Text>
|
|
43
|
-
<div className="flex items-center gap-2 p-2 rounded bg-white">
|
|
43
|
+
<div className="pb:flex pb:items-center pb:gap-2 pb:p-2 pb:rounded pb:bg-white">
|
|
44
44
|
<Checkbox id="email-notif" />
|
|
45
|
-
<Label htmlFor="email-notif" className="text-sm">
|
|
45
|
+
<Label htmlFor="email-notif" className="pb:text-sm">
|
|
46
46
|
Email Notifications
|
|
47
47
|
</Label>
|
|
48
48
|
</div>
|
|
@@ -50,22 +50,22 @@ export const Variations: Story = {
|
|
|
50
50
|
</SettingsPanel>
|
|
51
51
|
</div>
|
|
52
52
|
|
|
53
|
-
<div className="space-y-4">
|
|
54
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
53
|
+
<div className="pb:space-y-4">
|
|
54
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
55
55
|
No Title
|
|
56
56
|
</Heading>
|
|
57
57
|
<SettingsPanel>
|
|
58
|
-
<Text className="italic">
|
|
58
|
+
<Text className="pb:italic">
|
|
59
59
|
Panel without a title rendered as a simple container.
|
|
60
60
|
</Text>
|
|
61
61
|
</SettingsPanel>
|
|
62
62
|
</div>
|
|
63
63
|
|
|
64
|
-
<div className="space-y-4">
|
|
65
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
64
|
+
<div className="pb:space-y-4">
|
|
65
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
66
66
|
Collapsible States
|
|
67
67
|
</Heading>
|
|
68
|
-
<div className="space-y-4">
|
|
68
|
+
<div className="pb:space-y-4">
|
|
69
69
|
<SettingsPanel title="Collapsible (Default Open)" collapsible={true}>
|
|
70
70
|
<Text>This panel can be toggled and starts open.</Text>
|
|
71
71
|
</SettingsPanel>
|
package/src/ui/SettingsPanel.tsx
CHANGED
|
@@ -34,13 +34,13 @@ export function SettingsPanel({
|
|
|
34
34
|
headingLevel = 3,
|
|
35
35
|
}: SettingsPanelProps) {
|
|
36
36
|
const content = (
|
|
37
|
-
<div className={cn("flex flex-col", contentClassName)}>{children}</div>
|
|
37
|
+
<div className={cn("pb:flex pb:flex-col", contentClassName)}>{children}</div>
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
return (
|
|
41
41
|
<div
|
|
42
42
|
className={cn(
|
|
43
|
-
"m-2 p-4 bg-white shadow-xl rounded-lg flex flex-1 flex-col",
|
|
43
|
+
"pb:m-2 pb:p-4 pb:bg-white pb:shadow-xl pb:rounded-lg pb:flex pb:flex-1 pb:flex-col",
|
|
44
44
|
className,
|
|
45
45
|
)}
|
|
46
46
|
>
|
|
@@ -48,7 +48,7 @@ export function SettingsPanel({
|
|
|
48
48
|
<Collapsible
|
|
49
49
|
title={
|
|
50
50
|
typeof title === "string" ? (
|
|
51
|
-
<Heading level={headingLevel} className="text-gray-600">
|
|
51
|
+
<Heading level={headingLevel} className="pb:text-gray-600">
|
|
52
52
|
{title}
|
|
53
53
|
</Heading>
|
|
54
54
|
) : (
|
|
@@ -63,9 +63,9 @@ export function SettingsPanel({
|
|
|
63
63
|
) : (
|
|
64
64
|
<>
|
|
65
65
|
{title && (
|
|
66
|
-
<div className="flex items-center justify-between mb-2 empty:hidden">
|
|
66
|
+
<div className="pb:flex pb:items-center pb:justify-between pb:mb-2 empty:hidden">
|
|
67
67
|
{typeof title === "string" ? (
|
|
68
|
-
<Heading level={headingLevel} className="text-gray-600">
|
|
68
|
+
<Heading level={headingLevel} className="pb:text-gray-600">
|
|
69
69
|
{title}
|
|
70
70
|
</Heading>
|
|
71
71
|
) : (
|
|
@@ -21,21 +21,21 @@ export const Default: Story = {
|
|
|
21
21
|
|
|
22
22
|
export const Variations: Story = {
|
|
23
23
|
render: () => (
|
|
24
|
-
<div className="flex flex-col space-y-3">
|
|
24
|
+
<div className="pb:flex pb:flex-col pb:space-y-3">
|
|
25
25
|
{/* Circle Skeleton */}
|
|
26
|
-
<Skeleton className="h-12 w-12 rounded-full" />
|
|
26
|
+
<Skeleton className="pb:h-12 pb:w-12 pb:rounded-full" />
|
|
27
27
|
|
|
28
28
|
{/* Rectangular Skeletons */}
|
|
29
|
-
<div className="space-y-2">
|
|
30
|
-
<Skeleton className="h-4 w-[250px]" />
|
|
31
|
-
<Skeleton className="h-4 w-[200px]" />
|
|
29
|
+
<div className="pb:space-y-2">
|
|
30
|
+
<Skeleton className="pb:h-4 pb:w-[250px]" />
|
|
31
|
+
<Skeleton className="pb:h-4 pb:w-[200px]" />
|
|
32
32
|
</div>
|
|
33
33
|
|
|
34
|
-
<div className="flex items-center space-x-4 mt-6">
|
|
35
|
-
<Skeleton className="h-12 w-12 rounded-full" />
|
|
36
|
-
<div className="space-y-2">
|
|
37
|
-
<Skeleton className="h-4 w-[250px]" />
|
|
38
|
-
<Skeleton className="h-4 w-[200px]" />
|
|
34
|
+
<div className="pb:flex pb:items-center pb:space-x-4 pb:mt-6">
|
|
35
|
+
<Skeleton className="pb:h-12 pb:w-12 pb:rounded-full" />
|
|
36
|
+
<div className="pb:space-y-2">
|
|
37
|
+
<Skeleton className="pb:h-4 pb:w-[250px]" />
|
|
38
|
+
<Skeleton className="pb:h-4 pb:w-[200px]" />
|
|
39
39
|
</div>
|
|
40
40
|
</div>
|
|
41
41
|
</div>
|
package/src/ui/Skeleton.tsx
CHANGED
|
@@ -8,7 +8,7 @@ export interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
8
8
|
export function Skeleton({ className, ...props }: SkeletonProps) {
|
|
9
9
|
return (
|
|
10
10
|
<div
|
|
11
|
-
className={cn("animate-pulse rounded-md bg-gray-200/50", className)}
|
|
11
|
+
className={cn("pb:animate-pulse pb:rounded-md pb:bg-gray-200/50", className)}
|
|
12
12
|
{...props}
|
|
13
13
|
/>
|
|
14
14
|
);
|
|
@@ -21,8 +21,8 @@ const InteractiveSlider = (props: React.ComponentProps<typeof Slider>) => {
|
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
|
-
<div className="space-y-2">
|
|
25
|
-
<div className="w-80">
|
|
24
|
+
<div className="pb:space-y-2">
|
|
25
|
+
<div className="pb:w-80">
|
|
26
26
|
<Slider
|
|
27
27
|
{...props}
|
|
28
28
|
value={value}
|
|
@@ -33,7 +33,7 @@ const InteractiveSlider = (props: React.ComponentProps<typeof Slider>) => {
|
|
|
33
33
|
}}
|
|
34
34
|
/>
|
|
35
35
|
</div>
|
|
36
|
-
<Text variant="small" className="text-slate-500">
|
|
36
|
+
<Text variant="small" className="pb:text-slate-500">
|
|
37
37
|
Value: {value}
|
|
38
38
|
</Text>
|
|
39
39
|
</div>
|
|
@@ -50,7 +50,7 @@ const RangeChangeableSlider = ({
|
|
|
50
50
|
const [val, setVal] = useState(50);
|
|
51
51
|
|
|
52
52
|
return (
|
|
53
|
-
<div className="space-y-4 border p-4 rounded-lg bg-white shadow-sm">
|
|
53
|
+
<div className="pb:space-y-4 pb:border pb:p-4 pb:rounded-lg pb:bg-white pb:shadow-sm">
|
|
54
54
|
<Slider
|
|
55
55
|
{...args}
|
|
56
56
|
min={min}
|
|
@@ -58,11 +58,11 @@ const RangeChangeableSlider = ({
|
|
|
58
58
|
value={val}
|
|
59
59
|
onChange={(v: number | number[]) => setVal(Array.isArray(v) ? v[0] : v)}
|
|
60
60
|
/>
|
|
61
|
-
<div className="flex space-x-4">
|
|
62
|
-
<div className="flex flex-col gap-1">
|
|
61
|
+
<div className="pb:flex pb:space-x-4">
|
|
62
|
+
<div className="pb:flex pb:flex-col pb:gap-1">
|
|
63
63
|
<Text
|
|
64
64
|
variant="small"
|
|
65
|
-
className="uppercase text-slate-400 font-bold text-[10px]"
|
|
65
|
+
className="pb:uppercase pb:text-slate-400 pb:font-bold pb:text-[10px]"
|
|
66
66
|
>
|
|
67
67
|
Min
|
|
68
68
|
</Text>
|
|
@@ -70,13 +70,13 @@ const RangeChangeableSlider = ({
|
|
|
70
70
|
type="number"
|
|
71
71
|
value={min}
|
|
72
72
|
onChange={(e) => setMin(Number(e.target.value))}
|
|
73
|
-
className="w-20"
|
|
73
|
+
className="pb:w-20"
|
|
74
74
|
/>
|
|
75
75
|
</div>
|
|
76
|
-
<div className="flex flex-col gap-1">
|
|
76
|
+
<div className="pb:flex pb:flex-col pb:gap-1">
|
|
77
77
|
<Text
|
|
78
78
|
variant="small"
|
|
79
|
-
className="uppercase text-slate-400 font-bold text-[10px]"
|
|
79
|
+
className="pb:uppercase pb:text-slate-400 pb:font-bold pb:text-[10px]"
|
|
80
80
|
>
|
|
81
81
|
Max
|
|
82
82
|
</Text>
|
|
@@ -84,11 +84,11 @@ const RangeChangeableSlider = ({
|
|
|
84
84
|
type="number"
|
|
85
85
|
value={max}
|
|
86
86
|
onChange={(e) => setMax(Number(e.target.value))}
|
|
87
|
-
className="w-20"
|
|
87
|
+
className="pb:w-20"
|
|
88
88
|
/>
|
|
89
89
|
</div>
|
|
90
|
-
<div className="flex flex-col justify-end">
|
|
91
|
-
<Text variant="small" className="text-slate-600 font-medium">
|
|
90
|
+
<div className="pb:flex pb:flex-col pb:justify-end">
|
|
91
|
+
<Text variant="small" className="pb:text-slate-600 pb:font-medium">
|
|
92
92
|
Current: {val}
|
|
93
93
|
</Text>
|
|
94
94
|
</div>
|
|
@@ -108,20 +108,20 @@ export const Default: Story = {
|
|
|
108
108
|
|
|
109
109
|
export const Variations: Story = {
|
|
110
110
|
render: () => (
|
|
111
|
-
<div className="flex flex-col gap-12 p-4">
|
|
112
|
-
<div className="space-y-4">
|
|
113
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
111
|
+
<div className="pb:flex pb:flex-col pb:gap-12 pb:p-4">
|
|
112
|
+
<div className="pb:space-y-4">
|
|
113
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
114
114
|
Width Responsiveness
|
|
115
115
|
</Heading>
|
|
116
|
-
<div className="space-y-6">
|
|
117
|
-
<div className="space-y-1">
|
|
118
|
-
<Text variant="small" className="italic text-black">
|
|
116
|
+
<div className="pb:space-y-6">
|
|
117
|
+
<div className="pb:space-y-1">
|
|
118
|
+
<Text variant="small" className="pb:italic pb:text-black">
|
|
119
119
|
Full Width (Container Default)
|
|
120
120
|
</Text>
|
|
121
121
|
<Slider defaultValue={30} />
|
|
122
122
|
</div>
|
|
123
|
-
<div className="space-y-1 w-40">
|
|
124
|
-
<Text variant="small" className="italic text-black">
|
|
123
|
+
<div className="pb:space-y-1 pb:w-40">
|
|
124
|
+
<Text variant="small" className="pb:italic pb:text-black">
|
|
125
125
|
Narrow (w-40)
|
|
126
126
|
</Text>
|
|
127
127
|
<Slider defaultValue={70} />
|
|
@@ -129,8 +129,8 @@ export const Variations: Story = {
|
|
|
129
129
|
</div>
|
|
130
130
|
</div>
|
|
131
131
|
|
|
132
|
-
<div className="space-y-4">
|
|
133
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
132
|
+
<div className="pb:space-y-4">
|
|
133
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
134
134
|
Dynamic Range Test
|
|
135
135
|
</Heading>
|
|
136
136
|
<RangeChangeableSlider args={{}} />
|
package/src/ui/Slider.tsx
CHANGED
|
@@ -39,10 +39,10 @@ export const Slider = React.forwardRef<HTMLDivElement, SliderProps>(
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
|
-
<div className={cn("w-full flex items-center gap-4", className)}>
|
|
43
|
-
{icon && <div className="text-gray-500 shrink-0">{icon}</div>}
|
|
42
|
+
<div className={cn("pb:w-full pb:flex pb:items-center pb:gap-4", className)}>
|
|
43
|
+
{icon && <div className="pb:text-gray-500 pb:shrink-0">{icon}</div>}
|
|
44
44
|
|
|
45
|
-
<div className="flex-grow flex items-center h-8 min-w-[120px]">
|
|
45
|
+
<div className="pb:flex-grow pb:flex pb:items-center pb:h-8 pb:min-w-[120px]">
|
|
46
46
|
<BaseSlider.Root
|
|
47
47
|
ref={ref}
|
|
48
48
|
min={min}
|
|
@@ -72,16 +72,16 @@ export const Slider = React.forwardRef<HTMLDivElement, SliderProps>(
|
|
|
72
72
|
handleChange(val as number | number[], event);
|
|
73
73
|
}}
|
|
74
74
|
className={cn(
|
|
75
|
-
"relative flex items-center w-full h-full group touch-none select-none",
|
|
76
|
-
disabled && "opacity-50 cursor-not-allowed",
|
|
75
|
+
"pb:relative pb:flex pb:items-center pb:w-full pb:h-full pb:group pb:touch-none pb:select-none",
|
|
76
|
+
disabled && "pb:opacity-50 pb:cursor-not-allowed",
|
|
77
77
|
className,
|
|
78
78
|
)}
|
|
79
79
|
>
|
|
80
|
-
<BaseSlider.Control className="flex items-center w-full h-full relative cursor-pointer">
|
|
81
|
-
<BaseSlider.Track className="relative bg-gray-200 rounded-full w-full h-1.5 overflow-hidden transition-colors group-hover:bg-gray-300">
|
|
82
|
-
<BaseSlider.Indicator className="absolute bg-primary rounded-full h-full" />
|
|
80
|
+
<BaseSlider.Control className="pb:flex pb:items-center pb:w-full pb:h-full pb:relative pb:cursor-pointer">
|
|
81
|
+
<BaseSlider.Track className="pb:relative pb:bg-gray-200 pb:rounded-full pb:w-full pb:h-1.5 pb:overflow-hidden pb:transition-colors group-pb:hover:bg-gray-300">
|
|
82
|
+
<BaseSlider.Indicator className="pb:absolute pb:bg-primary pb:rounded-full pb:h-full" />
|
|
83
83
|
</BaseSlider.Track>
|
|
84
|
-
<BaseSlider.Thumb className="z-10 block w-4.5 h-4.5 bg-white shadow-md rounded-full border-2 border-primary focus:outline-none focus:ring-4 focus:ring-primary/20 cursor-grab active:cursor-grabbing hover:scale-110 active:scale-95 transition-transform" />
|
|
84
|
+
<BaseSlider.Thumb className="pb:z-10 pb:block pb:w-4.5 pb:h-4.5 pb:bg-white pb:shadow-md pb:rounded-full pb:border-2 pb:border-primary focus:pb:outline-none focus:pb:ring-4 focus:pb:ring-primary/20 pb:cursor-grab active:pb:cursor-grabbing pb:hover:scale-110 active:pb:scale-95 pb:transition-transform" />
|
|
85
85
|
</BaseSlider.Control>
|
|
86
86
|
</BaseSlider.Root>
|
|
87
87
|
</div>
|
|
@@ -41,7 +41,7 @@ export const Default: Story = {
|
|
|
41
41
|
defaultValue: 50,
|
|
42
42
|
},
|
|
43
43
|
render: (args) => (
|
|
44
|
-
<div className="w-80 p-4">
|
|
44
|
+
<div className="pb:w-80 pb:p-4">
|
|
45
45
|
<InteractiveSliderWithNumberField
|
|
46
46
|
{...(args as React.ComponentProps<typeof SliderWithNumberField>)}
|
|
47
47
|
/>
|
|
@@ -51,28 +51,28 @@ export const Default: Story = {
|
|
|
51
51
|
|
|
52
52
|
export const Variations: Story = {
|
|
53
53
|
render: () => (
|
|
54
|
-
<div className="flex flex-col gap-12 p-4">
|
|
55
|
-
<div className="space-y-4">
|
|
56
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
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
57
|
Responsive Layouts
|
|
58
58
|
</Heading>
|
|
59
|
-
<div className="space-y-8 max-w-lg">
|
|
60
|
-
<div className="space-y-2">
|
|
61
|
-
<Text variant="small" className="font-bold underline">
|
|
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
62
|
Flexible (Full width of container)
|
|
63
63
|
</Text>
|
|
64
64
|
<InteractiveSliderWithNumberField defaultValue={50} />
|
|
65
65
|
</div>
|
|
66
66
|
|
|
67
|
-
<div className="space-y-2 w-64 border-l border-r border-dotted px-2 bg-gray-50 py-4">
|
|
68
|
-
<Text variant="small" className="font-bold underline">
|
|
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
69
|
Narrow Container (w-64)
|
|
70
70
|
</Text>
|
|
71
71
|
<InteractiveSliderWithNumberField defaultValue={50} />
|
|
72
72
|
</div>
|
|
73
73
|
|
|
74
|
-
<div className="space-y-2 w-48 border-l border-r border-dotted px-2 bg-gray-50 py-4">
|
|
75
|
-
<Text variant="small" className="font-bold underline">
|
|
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
76
|
Very Narrow (w-48) - Wraps
|
|
77
77
|
</Text>
|
|
78
78
|
<InteractiveSliderWithNumberField defaultValue={50} />
|
|
@@ -80,12 +80,12 @@ export const Variations: Story = {
|
|
|
80
80
|
</div>
|
|
81
81
|
</div>
|
|
82
82
|
|
|
83
|
-
<div className="space-y-4">
|
|
84
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
83
|
+
<div className="pb:space-y-4">
|
|
84
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
85
85
|
Configuration
|
|
86
86
|
</Heading>
|
|
87
|
-
<div className="space-y-4 max-w-sm">
|
|
88
|
-
<div className="space-y-1">
|
|
87
|
+
<div className="pb:space-y-4 pb:max-w-sm">
|
|
88
|
+
<div className="pb:space-y-1">
|
|
89
89
|
<Text variant="small">Custom Step (0.5)</Text>
|
|
90
90
|
<InteractiveSliderWithNumberField
|
|
91
91
|
step={0.5}
|
|
@@ -45,12 +45,12 @@ export const SliderWithNumberField = React.forwardRef<
|
|
|
45
45
|
<div
|
|
46
46
|
ref={ref}
|
|
47
47
|
className={cn(
|
|
48
|
-
"flex flex-row items-center gap-4 w-full min-w-0 sm:flex-nowrap flex-wrap",
|
|
48
|
+
"pb:flex pb:flex-row pb:items-center pb:gap-4 pb:w-full pb:min-w-0 pb:sm:flex-nowrap pb:flex-wrap",
|
|
49
49
|
className,
|
|
50
50
|
)}
|
|
51
51
|
{...props}
|
|
52
52
|
>
|
|
53
|
-
<div className="flex-grow min-w-[120px]">
|
|
53
|
+
<div className="pb:flex-grow pb:min-w-[120px]">
|
|
54
54
|
<Slider
|
|
55
55
|
min={min}
|
|
56
56
|
max={max}
|
|
@@ -59,10 +59,10 @@ export const SliderWithNumberField = React.forwardRef<
|
|
|
59
59
|
defaultValue={defaultValue}
|
|
60
60
|
disabled={disabled}
|
|
61
61
|
onChange={handleChange}
|
|
62
|
-
className="w-full"
|
|
62
|
+
className="pb:w-full"
|
|
63
63
|
/>
|
|
64
64
|
</div>
|
|
65
|
-
<div className={cn(inputWidth, "shrink-0")}>
|
|
65
|
+
<div className={cn(inputWidth, "pb:shrink-0")}>
|
|
66
66
|
<NumberField
|
|
67
67
|
value={value}
|
|
68
68
|
defaultValue={defaultValue}
|
|
@@ -26,7 +26,7 @@ export const Default: Story = {
|
|
|
26
26
|
const InteractiveSwitch = () => {
|
|
27
27
|
const [checked, setChecked] = useState(false);
|
|
28
28
|
return (
|
|
29
|
-
<div className="flex flex-col gap-2">
|
|
29
|
+
<div className="pb:flex pb:flex-col pb:gap-2">
|
|
30
30
|
<Switch
|
|
31
31
|
checked={checked}
|
|
32
32
|
onChange={(val) => setChecked(val)}
|
|
@@ -41,25 +41,25 @@ const InteractiveSwitch = () => {
|
|
|
41
41
|
|
|
42
42
|
export const Variations: Story = {
|
|
43
43
|
render: () => (
|
|
44
|
-
<div className="flex flex-col gap-12 p-4">
|
|
45
|
-
<div className="space-y-4">
|
|
46
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
44
|
+
<div className="pb:flex pb:flex-col pb:gap-12 pb:p-4">
|
|
45
|
+
<div className="pb:space-y-4">
|
|
46
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
47
47
|
States
|
|
48
48
|
</Heading>
|
|
49
|
-
<div className="flex flex-col gap-4">
|
|
50
|
-
<div className="flex items-center gap-2">
|
|
49
|
+
<div className="pb:flex pb:flex-col pb:gap-4">
|
|
50
|
+
<div className="pb:flex pb:items-center pb:gap-2">
|
|
51
51
|
<Switch defaultChecked={false} aria-label="Unchecked switch" />
|
|
52
52
|
<Text variant="small">Unchecked</Text>
|
|
53
53
|
</div>
|
|
54
|
-
<div className="flex items-center gap-2">
|
|
54
|
+
<div className="pb:flex pb:items-center pb:gap-2">
|
|
55
55
|
<Switch defaultChecked={true} aria-label="Checked switch" />
|
|
56
56
|
<Text variant="small">Checked</Text>
|
|
57
57
|
</div>
|
|
58
|
-
<div className="flex items-center gap-2">
|
|
58
|
+
<div className="pb:flex pb:items-center pb:gap-2">
|
|
59
59
|
<Switch disabled aria-label="Disabled switch" />
|
|
60
60
|
<Text variant="small">Disabled Unchecked</Text>
|
|
61
61
|
</div>
|
|
62
|
-
<div className="flex items-center gap-2">
|
|
62
|
+
<div className="pb:flex pb:items-center pb:gap-2">
|
|
63
63
|
<Switch
|
|
64
64
|
disabled
|
|
65
65
|
defaultChecked={true}
|
|
@@ -70,8 +70,8 @@ export const Variations: Story = {
|
|
|
70
70
|
</div>
|
|
71
71
|
</div>
|
|
72
72
|
|
|
73
|
-
<div className="space-y-4">
|
|
74
|
-
<Heading level={4} className="text-sm font-medium text-black uppercase">
|
|
73
|
+
<div className="pb:space-y-4">
|
|
74
|
+
<Heading level={4} className="pb:text-sm pb:font-medium pb:text-black pb:uppercase">
|
|
75
75
|
Interactive
|
|
76
76
|
</Heading>
|
|
77
77
|
<InteractiveSwitch />
|
package/src/ui/Switch.tsx
CHANGED
|
@@ -28,7 +28,7 @@ export const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>(
|
|
|
28
28
|
const autoId = React.useId();
|
|
29
29
|
const id = externalId ?? autoId;
|
|
30
30
|
return (
|
|
31
|
-
<div className={cn("flex items-center gap-2", className)}>
|
|
31
|
+
<div className={cn("pb:flex pb:items-center pb:gap-2", className)}>
|
|
32
32
|
<BaseSwitch.Root
|
|
33
33
|
ref={ref}
|
|
34
34
|
id={id}
|
|
@@ -39,16 +39,16 @@ export const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>(
|
|
|
39
39
|
}}
|
|
40
40
|
disabled={disabled}
|
|
41
41
|
className={cn(
|
|
42
|
-
"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",
|
|
43
|
-
"data-[checked]:bg-primary data-[unchecked]:bg-gray-200",
|
|
44
|
-
disabled && "opacity-50 cursor-not-allowed",
|
|
42
|
+
"pb:relative pb:inline-flex pb:h-6 pb:w-11 pb:flex-shrink-0 pb:cursor-pointer pb:rounded-full pb:border-2 pb:border-transparent pb:transition-colors pb:duration-200 pb:ease-in-out pb:focus:outline-none pb:focus:ring-2 pb:focus:ring-primary pb:focus:ring-offset-2",
|
|
43
|
+
"pb:data-[checked]:bg-primary pb:data-[unchecked]:bg-gray-200",
|
|
44
|
+
disabled && "pb:opacity-50 pb:cursor-not-allowed",
|
|
45
45
|
)}
|
|
46
46
|
{...props}
|
|
47
47
|
>
|
|
48
48
|
<BaseSwitch.Thumb
|
|
49
49
|
className={cn(
|
|
50
|
-
"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out",
|
|
51
|
-
"data-[checked]:translate-x-5 data-[unchecked]:translate-x-0",
|
|
50
|
+
"pb:pointer-events-none pb:inline-block pb:h-5 pb:w-5 pb:transform pb:rounded-full pb:bg-white pb:shadow pb:ring-0 pb:transition pb:duration-200 pb:ease-in-out",
|
|
51
|
+
"pb:data-[checked]:translate-x-5 pb:data-[unchecked]:translate-x-0",
|
|
52
52
|
)}
|
|
53
53
|
/>
|
|
54
54
|
</BaseSwitch.Root>
|