@brightlocal/ui-components 0.1.2 → 0.1.4
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/dist/accordion.cjs +1 -1
- package/dist/accordion.d.ts +74 -4
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +100 -105
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +30 -10
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +129 -132
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +22 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +1 -1
- package/dist/aspect-ratio.cjs +1 -1
- package/dist/aspect-ratio.d.ts +11 -1
- package/dist/aspect-ratio.d.ts.map +1 -1
- package/dist/aspect-ratio.js +16 -20
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.d.ts +43 -3
- package/dist/avatar.d.ts.map +1 -1
- package/dist/avatar.js +18 -16
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +24 -9
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +34 -32
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +177 -170
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +38 -307
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +411 -508
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts +63 -8
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +97 -93
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts +17 -45
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +49 -50
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts +16 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +31 -29
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +58 -18
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +60 -51
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.d.ts +99 -9
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +142 -128
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.d.ts +18 -15
- package/dist/centred-layout.d.ts.map +1 -1
- package/dist/centred-layout.js +44 -33
- package/dist/chart.cjs +4 -4
- package/dist/chart.d.ts +70 -7
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +71 -66
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +9 -5
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +61 -82
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.d.ts +65 -8
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/collapsible.js +41 -55
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts +28 -18
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +191 -160
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +115 -9
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +176 -152
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts +188 -20
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +120 -122
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +75 -9
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +221 -82
- package/dist/description.cjs +1 -0
- package/dist/description.d.ts +37 -0
- package/dist/description.d.ts.map +1 -0
- package/dist/description.js +25 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +73 -9
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +103 -112
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts +92 -0
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +67 -52
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts +95 -11
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +146 -106
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +26 -6
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +55 -53
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +27 -17
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +86 -79
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts +36 -6
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +44 -42
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +367 -386
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +21 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +51 -41
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +1 -1
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +25 -26
- package/dist/input.cjs +1 -1
- package/dist/input.d.ts +38 -24
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +68 -136
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts +20 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +31 -18
- package/dist/link.cjs +1 -1
- package/dist/link.js +1 -1
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +9 -4
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +20 -21
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts +43 -6
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +100 -78
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.d.ts +6 -54
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/navigation-menu.js +73 -84
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +8 -10
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +78 -86
- package/dist/popover.cjs +1 -1
- package/dist/popover.d.ts +59 -4
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +42 -34
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +9 -2
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +71 -59
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.d.ts +33 -10
- package/dist/radio-group.d.ts.map +1 -1
- package/dist/radio-group.js +56 -66
- package/dist/rating.d.ts +4 -0
- package/dist/rating.d.ts.map +1 -1
- package/dist/resizable.cjs +1 -1
- package/dist/resizable.d.ts +58 -6
- package/dist/resizable.d.ts.map +1 -1
- package/dist/resizable.js +38 -37
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +46 -5
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +42 -38
- package/dist/select.cjs +1 -1
- package/dist/select.d.ts +30 -0
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +64 -54
- package/dist/separator.cjs +1 -1
- package/dist/separator.d.ts +52 -5
- package/dist/separator.d.ts.map +1 -1
- package/dist/separator.js +45 -35
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +85 -19
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +117 -115
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +24 -2
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +15 -9
- package/dist/slider.cjs +1 -1
- package/dist/slider.d.ts +18 -4
- package/dist/slider.d.ts.map +1 -1
- package/dist/slider.js +72 -66
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts +21 -22
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +46 -48
- package/dist/split-layout.d.ts +4 -1
- package/dist/split-layout.d.ts.map +1 -1
- package/dist/switch.cjs +1 -1
- package/dist/switch.d.ts +2 -12
- package/dist/switch.d.ts.map +1 -1
- package/dist/switch.js +37 -41
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +16 -12
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +56 -58
- package/dist/tabs.d.ts +27 -3
- package/dist/tabs.d.ts.map +1 -1
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.d.ts +57 -7
- package/dist/toggle-group.d.ts.map +1 -1
- package/dist/toggle-group.js +60 -67
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.d.ts +12 -26
- package/dist/toggle.d.ts.map +1 -1
- package/dist/toggle.js +16 -20
- package/package.json +9 -3
- package/src/blocks/data-table.tsx +43 -33
- package/src/blocks/sidebar.tsx +158 -541
- package/src/components/accordion.tsx +164 -78
- package/src/components/alert-dialog.tsx +156 -111
- package/src/components/alert.tsx +27 -14
- package/src/components/aspect-ratio.tsx +25 -16
- package/src/components/avatar.tsx +56 -8
- package/src/components/badge.tsx +65 -42
- package/src/components/breadcrumb.tsx +159 -83
- package/src/components/button.tsx +42 -63
- package/src/components/calendar.tsx +22 -6
- package/src/components/card.tsx +92 -40
- package/src/components/carousel.tsx +240 -115
- package/src/components/centred-layout.tsx +68 -49
- package/src/components/chart.tsx +118 -47
- package/src/components/checkbox.tsx +43 -79
- package/src/components/collapsible.tsx +95 -26
- package/src/components/combobox.tsx +243 -153
- package/src/components/command.tsx +295 -121
- package/src/components/context-menu.tsx +279 -82
- package/src/components/date-picker.tsx +282 -31
- package/src/components/description.tsx +60 -0
- package/src/components/dialog.tsx +163 -87
- package/src/components/drawer.tsx +76 -2
- package/src/components/dropdown-menu.tsx +143 -37
- package/src/components/field.tsx +38 -11
- package/src/components/global-layout.tsx +116 -77
- package/src/components/hover-card.tsx +54 -14
- package/src/components/input-group.tsx +56 -18
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +4 -5
- package/src/components/input.tsx +93 -186
- package/src/components/label.tsx +56 -15
- package/src/components/link.tsx +1 -1
- package/src/components/logo.tsx +12 -7
- package/src/components/menubar.tsx +61 -5
- package/src/components/navigation-menu.tsx +37 -99
- package/src/components/pagination.tsx +13 -19
- package/src/components/popover.tsx +103 -20
- package/src/components/progress.tsx +82 -60
- package/src/components/radio-group.tsx +44 -25
- package/src/components/rating.tsx +4 -0
- package/src/components/resizable.tsx +88 -38
- package/src/components/scroll-area.tsx +123 -56
- package/src/components/select.tsx +22 -2
- package/src/components/separator.tsx +101 -24
- package/src/components/sheet.tsx +186 -90
- package/src/components/skeleton.tsx +40 -10
- package/src/components/slider.tsx +83 -57
- package/src/components/sonner.tsx +34 -34
- package/src/components/split-layout.tsx +4 -1
- package/src/components/switch.figma.tsx +7 -11
- package/src/components/switch.tsx +9 -19
- package/src/components/table.tsx +23 -18
- package/src/components/tabs.tsx +27 -3
- package/src/components/toggle-group.tsx +115 -86
- package/src/components/toggle.figma.tsx +13 -19
- package/src/components/toggle.tsx +20 -34
- package/src/index.ts +1 -1
- package/dist/input-base.cjs +0 -1
- package/dist/input-base.d.ts +0 -28
- package/dist/input-base.d.ts.map +0 -1
- package/dist/input-base.js +0 -56
- package/src/components/input-base.tsx +0 -86
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
5
|
-
import { type VariantProps } from "class-variance-authority";
|
|
6
5
|
|
|
7
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
8
|
-
import {
|
|
9
|
-
toggleVariants,
|
|
10
|
-
ToggleSize,
|
|
11
|
-
ToggleVariant,
|
|
12
|
-
} from "@brightlocal/ui-components/toggle";
|
|
7
|
+
import { toggleVariants } from "./toggle";
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
variant
|
|
9
|
+
/**
|
|
10
|
+
* Context value for sharing variant and size props between ToggleGroup and ToggleGroupItem.
|
|
11
|
+
*/
|
|
12
|
+
type ToggleGroupContextValue = {
|
|
13
|
+
/** Visual style variant inherited by child items */
|
|
14
|
+
variant?: "default" | "outline";
|
|
15
|
+
/** Size variant inherited by child items */
|
|
16
|
+
size?: "default" | "sm" | "lg";
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const ToggleGroupContext = React.createContext<ToggleGroupContextValue>({
|
|
20
|
+
size: "default",
|
|
21
|
+
variant: "default",
|
|
19
22
|
});
|
|
20
23
|
|
|
21
24
|
type ToggleGroupProps = {
|
|
@@ -25,88 +28,114 @@ type ToggleGroupProps = {
|
|
|
25
28
|
trackingEl?: string;
|
|
26
29
|
/** Tracking label for analytics context */
|
|
27
30
|
trackingLabel?: string;
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Visual style variant
|
|
33
|
+
* @default "default"
|
|
34
|
+
*/
|
|
35
|
+
variant?: "default" | "outline";
|
|
36
|
+
/**
|
|
37
|
+
* Size variant
|
|
38
|
+
* @default "default"
|
|
39
|
+
*/
|
|
40
|
+
size?: "default" | "sm" | "lg";
|
|
41
|
+
} & React.ComponentProps<typeof ToggleGroupPrimitive.Root>;
|
|
30
42
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
43
|
+
const ToggleGroup = React.forwardRef<
|
|
44
|
+
React.ComponentRef<typeof ToggleGroupPrimitive.Root>,
|
|
45
|
+
ToggleGroupProps
|
|
46
|
+
>(
|
|
47
|
+
(
|
|
48
|
+
{
|
|
49
|
+
className,
|
|
50
|
+
variant,
|
|
51
|
+
size,
|
|
52
|
+
children,
|
|
53
|
+
dataHook,
|
|
54
|
+
trackingEl,
|
|
55
|
+
trackingLabel,
|
|
56
|
+
...props
|
|
57
|
+
},
|
|
58
|
+
ref
|
|
59
|
+
) => {
|
|
60
|
+
return (
|
|
61
|
+
<ToggleGroupPrimitive.Root
|
|
62
|
+
ref={ref}
|
|
63
|
+
className={cn(
|
|
64
|
+
"group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",
|
|
65
|
+
className
|
|
66
|
+
)}
|
|
67
|
+
data-hook={dataHook}
|
|
68
|
+
data-size={size}
|
|
69
|
+
data-slot="toggle-group"
|
|
70
|
+
data-tracking-el={trackingEl || `toggle-group-${variant}`}
|
|
71
|
+
data-tracking-label={trackingLabel}
|
|
72
|
+
data-variant={variant}
|
|
73
|
+
{...props}
|
|
74
|
+
>
|
|
75
|
+
<ToggleGroupContext.Provider value={{ variant, size }}>
|
|
76
|
+
{children}
|
|
77
|
+
</ToggleGroupContext.Provider>
|
|
78
|
+
</ToggleGroupPrimitive.Root>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
ToggleGroup.displayName = "ToggleGroup";
|
|
61
84
|
|
|
62
85
|
type ToggleGroupItemProps = {
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
-
/** Tracking label for analytics context */
|
|
68
|
-
trackingLabel?: string;
|
|
86
|
+
/** Unique value for the toggle item (REQUIRED) */
|
|
87
|
+
value: string;
|
|
88
|
+
/** Data hook for automated testing */
|
|
89
|
+
dataHook?: string;
|
|
69
90
|
/** ARIA label for accessibility (required when no text content) */
|
|
70
91
|
ariaLabel?: string;
|
|
71
|
-
|
|
72
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Visual style variant (inherited from ToggleGroup if not specified)
|
|
94
|
+
* @default "default"
|
|
95
|
+
*/
|
|
96
|
+
variant?: "default" | "outline";
|
|
97
|
+
/**
|
|
98
|
+
* Size variant (inherited from ToggleGroup if not specified)
|
|
99
|
+
* @default "default"
|
|
100
|
+
*/
|
|
101
|
+
size?: "default" | "sm" | "lg";
|
|
102
|
+
} & Omit<React.ComponentProps<typeof ToggleGroupPrimitive.Item>, "value">;
|
|
73
103
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
104
|
+
const ToggleGroupItem = React.forwardRef<
|
|
105
|
+
React.ComponentRef<typeof ToggleGroupPrimitive.Item>,
|
|
106
|
+
ToggleGroupItemProps
|
|
107
|
+
>(
|
|
108
|
+
(
|
|
109
|
+
{ className, children, variant, size, ariaLabel, dataHook, ...props },
|
|
110
|
+
ref
|
|
111
|
+
) => {
|
|
112
|
+
const context = React.useContext(ToggleGroupContext);
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<ToggleGroupPrimitive.Item
|
|
116
|
+
ref={ref}
|
|
117
|
+
aria-label={ariaLabel}
|
|
118
|
+
className={cn(
|
|
119
|
+
toggleVariants({
|
|
120
|
+
variant: context.variant || variant,
|
|
121
|
+
size: context.size || size,
|
|
122
|
+
}),
|
|
123
|
+
"w-auto min-w-0 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",
|
|
124
|
+
className
|
|
125
|
+
)}
|
|
126
|
+
data-hook={dataHook}
|
|
127
|
+
data-size={context.size || size}
|
|
128
|
+
data-slot="toggle-group-item"
|
|
129
|
+
data-variant={context.variant || variant}
|
|
130
|
+
{...props}
|
|
131
|
+
>
|
|
132
|
+
{children}
|
|
133
|
+
</ToggleGroupPrimitive.Item>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
);
|
|
86
137
|
|
|
87
|
-
|
|
88
|
-
<ToggleGroupPrimitive.Item
|
|
89
|
-
aria-label={ariaLabel}
|
|
90
|
-
className={cn(
|
|
91
|
-
toggleVariants({
|
|
92
|
-
variant: context.variant || variant,
|
|
93
|
-
size: context.size || size,
|
|
94
|
-
}),
|
|
95
|
-
"w-auto min-w-0 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",
|
|
96
|
-
className
|
|
97
|
-
)}
|
|
98
|
-
data-hook={dataHook}
|
|
99
|
-
data-size={context.size || size}
|
|
100
|
-
data-slot="toggle-group-item"
|
|
101
|
-
data-tracking-el={trackingEl || `toggle-group-item-${props.value}`}
|
|
102
|
-
data-tracking-label={trackingLabel}
|
|
103
|
-
data-variant={context.variant || variant}
|
|
104
|
-
{...props}
|
|
105
|
-
>
|
|
106
|
-
{children}
|
|
107
|
-
</ToggleGroupPrimitive.Item>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
138
|
+
ToggleGroupItem.displayName = "ToggleGroupItem";
|
|
110
139
|
|
|
111
140
|
export { ToggleGroup, ToggleGroupItem };
|
|
112
141
|
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { figma } from "@figma/code-connect";
|
|
3
|
-
import {
|
|
4
|
-
Toggle,
|
|
5
|
-
ToggleVariant,
|
|
6
|
-
ToggleSize,
|
|
7
|
-
} from "@brightlocal/ui-components/toggle";
|
|
3
|
+
import { Toggle } from "@brightlocal/ui-components/toggle";
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
6
|
* Figma Code Connect mapping for Toggle component
|
|
@@ -18,20 +14,18 @@ figma.connect(
|
|
|
18
14
|
Toggle,
|
|
19
15
|
"https://www.figma.com/design/p3krmC8DBUgqpbq6cLzaal/Design-System---UI-Components?node-id=17429-129988&m=dev",
|
|
20
16
|
{
|
|
21
|
-
imports: [
|
|
22
|
-
"import { Toggle, ToggleVariant, ToggleSize } from '@brightlocal/ui-components/toggle'",
|
|
23
|
-
],
|
|
17
|
+
imports: ["import { Toggle } from '@brightlocal/ui-components/toggle'"],
|
|
24
18
|
props: {
|
|
25
|
-
// Map Figma variant property to code
|
|
19
|
+
// Map Figma variant property to code string
|
|
26
20
|
variant: figma.enum("Variant", {
|
|
27
|
-
Default:
|
|
28
|
-
Outline:
|
|
21
|
+
Default: "default",
|
|
22
|
+
Outline: "outline",
|
|
29
23
|
}),
|
|
30
|
-
// Map Figma size property to code
|
|
24
|
+
// Map Figma size property to code string
|
|
31
25
|
size: figma.enum("Size", {
|
|
32
|
-
sm:
|
|
33
|
-
default:
|
|
34
|
-
lg:
|
|
26
|
+
sm: "sm",
|
|
27
|
+
default: "default",
|
|
28
|
+
lg: "lg",
|
|
35
29
|
}),
|
|
36
30
|
// Map Figma properties
|
|
37
31
|
disabled: figma.boolean("Disabled"),
|
|
@@ -46,8 +40,8 @@ figma.connect(
|
|
|
46
40
|
ariaLabel: figma.string("ARIA Label"),
|
|
47
41
|
},
|
|
48
42
|
example: (props: {
|
|
49
|
-
variant?:
|
|
50
|
-
size?:
|
|
43
|
+
variant?: "default" | "outline";
|
|
44
|
+
size?: "default" | "sm" | "lg";
|
|
51
45
|
disabled?: boolean;
|
|
52
46
|
pressed?: boolean;
|
|
53
47
|
showText?: boolean;
|
|
@@ -67,10 +61,10 @@ figma.connect(
|
|
|
67
61
|
dataHook={props.dataHook || "toggle"}
|
|
68
62
|
disabled={props.disabled}
|
|
69
63
|
pressed={props.pressed}
|
|
70
|
-
size={props.size ||
|
|
64
|
+
size={props.size || "default"}
|
|
71
65
|
trackingEl={props.trackingEl}
|
|
72
66
|
trackingLabel={props.trackingLabel}
|
|
73
|
-
variant={props.variant ||
|
|
67
|
+
variant={props.variant || "default"}
|
|
74
68
|
>
|
|
75
69
|
{icon}
|
|
76
70
|
{props.showText && (props.text || "Toggle")}
|
|
@@ -1,49 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import * as React from "react";
|
|
2
4
|
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
3
5
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
6
|
|
|
5
7
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
6
8
|
|
|
7
|
-
/**
|
|
8
|
-
* Visual style variants for Toggle
|
|
9
|
-
*/
|
|
10
|
-
export enum ToggleVariant {
|
|
11
|
-
/** Default variant with transparent background */
|
|
12
|
-
DEFAULT = "default",
|
|
13
|
-
/** Outline variant with border styling */
|
|
14
|
-
OUTLINE = "outline",
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Size variants for Toggle
|
|
19
|
-
*/
|
|
20
|
-
export enum ToggleSize {
|
|
21
|
-
/** Small size (32px height) */
|
|
22
|
-
SM = "sm",
|
|
23
|
-
/** Default size (36px height) */
|
|
24
|
-
DEFAULT = "default",
|
|
25
|
-
/** Large size (40px height) */
|
|
26
|
-
LG = "lg",
|
|
27
|
-
}
|
|
28
|
-
|
|
29
9
|
const toggleVariants = cva(
|
|
30
|
-
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:shadow-default outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
|
|
10
|
+
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:shadow-default outline-none transition-[color,box-shadow] duration-150 ease-in-out aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
|
|
31
11
|
{
|
|
32
12
|
variants: {
|
|
33
13
|
variant: {
|
|
34
|
-
|
|
35
|
-
|
|
14
|
+
default: "bg-transparent",
|
|
15
|
+
outline:
|
|
36
16
|
"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
37
17
|
},
|
|
38
18
|
size: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
19
|
+
default: "h-9 px-2 min-w-9",
|
|
20
|
+
sm: "h-8 px-1.5 min-w-8",
|
|
21
|
+
lg: "h-10 px-2.5 min-w-10",
|
|
42
22
|
},
|
|
43
23
|
},
|
|
44
24
|
defaultVariants: {
|
|
45
|
-
variant:
|
|
46
|
-
size:
|
|
25
|
+
variant: "default",
|
|
26
|
+
size: "default",
|
|
47
27
|
},
|
|
48
28
|
}
|
|
49
29
|
);
|
|
@@ -58,10 +38,16 @@ export interface ToggleProps
|
|
|
58
38
|
trackingEl?: string;
|
|
59
39
|
/** Tracking label for analytics context */
|
|
60
40
|
trackingLabel?: string;
|
|
61
|
-
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Visual style variant
|
|
43
|
+
* @default "default"
|
|
44
|
+
*/
|
|
45
|
+
variant?: "default" | "outline";
|
|
46
|
+
/**
|
|
47
|
+
* Size variant
|
|
48
|
+
* @default "default"
|
|
49
|
+
*/
|
|
50
|
+
size?: "default" | "sm" | "lg";
|
|
65
51
|
/** ARIA label for accessibility (required when no text content) */
|
|
66
52
|
ariaLabel?: string;
|
|
67
53
|
}
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from "./components/combobox";
|
|
|
18
18
|
export * from "./components/command";
|
|
19
19
|
export * from "./components/date-picker";
|
|
20
20
|
export * from "./components/context-menu";
|
|
21
|
+
export * from "./components/description";
|
|
21
22
|
export * from "./components/dialog";
|
|
22
23
|
export * from "./components/drawer";
|
|
23
24
|
export * from "./components/dropdown-menu";
|
|
@@ -25,7 +26,6 @@ export * from "./components/field";
|
|
|
25
26
|
export * from "./components/global-layout";
|
|
26
27
|
export * from "./components/hover-card";
|
|
27
28
|
export * from "./components/input";
|
|
28
|
-
export * from "./components/input-base";
|
|
29
29
|
export * from "./components/input-group";
|
|
30
30
|
export * from "./components/input-otp";
|
|
31
31
|
export * from "./components/label";
|
package/dist/input-base.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),i=require("react"),u=require("class-variance-authority"),c=require("@brightlocal/ui-components/lib/utils");function d(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const f=d(i),r=u.cva(["flex w-full min-w-0 h-9","border border-input bg-background rounded-sm","outline-none transition-all","text-sm font-sans","text-foreground","overflow-hidden text-ellipsis","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-muted-foreground","placeholder:overflow-hidden placeholder:text-ellipsis","items-center px-3 pb-[1px] leading-5"],{variants:{hasIcon:{true:"pl-9",false:""},hasSecondaryIcon:{true:"pr-9",false:""}},defaultVariants:{hasIcon:!1,hasSecondaryIcon:!1}}),o=f.forwardRef(({className:e,hasIcon:n=!1,hasSecondaryIcon:t=!1,...a},s)=>l.jsx("input",{ref:s,className:c.cn(r({hasIcon:n,hasSecondaryIcon:t}),e),"data-slot":"input",...a}));o.displayName="BaseInputElement";exports.BaseInputElement=o;exports.inputVariants=r;
|
package/dist/input-base.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Shared input variant styles
|
|
4
|
-
* These can be reused across different input components
|
|
5
|
-
*/
|
|
6
|
-
export declare const inputVariants: (props?: ({
|
|
7
|
-
hasIcon?: boolean | null | undefined;
|
|
8
|
-
hasSecondaryIcon?: boolean | null | undefined;
|
|
9
|
-
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
|
-
/**
|
|
11
|
-
* Base input element without label/description wrapper
|
|
12
|
-
* Use this for composing custom input components
|
|
13
|
-
*
|
|
14
|
-
* For inputs with label/description, compose with Field, FieldLabel, FieldDescription
|
|
15
|
-
* For full-featured input with all props, use the Input component
|
|
16
|
-
*/
|
|
17
|
-
export interface BaseInputElementProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
18
|
-
/**
|
|
19
|
-
* Whether the input has an icon (adds left padding)
|
|
20
|
-
*/
|
|
21
|
-
hasIcon?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Whether the input has a secondary icon (adds right padding)
|
|
24
|
-
*/
|
|
25
|
-
hasSecondaryIcon?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export declare const BaseInputElement: React.ForwardRefExoticComponent<BaseInputElementProps & React.RefAttributes<HTMLInputElement>>;
|
|
28
|
-
//# sourceMappingURL=input-base.d.ts.map
|
package/dist/input-base.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-base.d.ts","sourceRoot":"","sources":["../../src/components/input-base.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;GAGG;AACH,eAAO,MAAM,aAAa;;;8EAsCzB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAC3C,MAAM,CACP;IACC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,gBAAgB,gGAY3B,CAAC"}
|
package/dist/input-base.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import * as n from "react";
|
|
3
|
-
import { cva as l } from "class-variance-authority";
|
|
4
|
-
import { cn as i } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
-
const d = l(
|
|
6
|
-
[
|
|
7
|
-
// Layout & Size
|
|
8
|
-
"flex w-full min-w-0 h-9",
|
|
9
|
-
// Appearance
|
|
10
|
-
"border border-input bg-background rounded-sm",
|
|
11
|
-
"outline-none transition-all",
|
|
12
|
-
// Typography
|
|
13
|
-
"text-sm font-sans",
|
|
14
|
-
"text-foreground",
|
|
15
|
-
"overflow-hidden text-ellipsis",
|
|
16
|
-
// States - Focus
|
|
17
|
-
"focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background",
|
|
18
|
-
"focus-visible:shadow-default",
|
|
19
|
-
// States - Disabled
|
|
20
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
21
|
-
// Pseudo-elements
|
|
22
|
-
"placeholder:text-muted-foreground",
|
|
23
|
-
"placeholder:overflow-hidden placeholder:text-ellipsis",
|
|
24
|
-
// Text input alignment - uses design token for text/sm line-height (20px)
|
|
25
|
-
"items-center px-3 pb-[1px] leading-5"
|
|
26
|
-
],
|
|
27
|
-
{
|
|
28
|
-
variants: {
|
|
29
|
-
hasIcon: {
|
|
30
|
-
true: "pl-9",
|
|
31
|
-
false: ""
|
|
32
|
-
},
|
|
33
|
-
hasSecondaryIcon: {
|
|
34
|
-
true: "pr-9",
|
|
35
|
-
false: ""
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
defaultVariants: {
|
|
39
|
-
hasIcon: !1,
|
|
40
|
-
hasSecondaryIcon: !1
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
), f = n.forwardRef(({ className: e, hasIcon: o = !1, hasSecondaryIcon: a = !1, ...t }, s) => /* @__PURE__ */ r(
|
|
44
|
-
"input",
|
|
45
|
-
{
|
|
46
|
-
ref: s,
|
|
47
|
-
className: i(d({ hasIcon: o, hasSecondaryIcon: a }), e),
|
|
48
|
-
"data-slot": "input",
|
|
49
|
-
...t
|
|
50
|
-
}
|
|
51
|
-
));
|
|
52
|
-
f.displayName = "BaseInputElement";
|
|
53
|
-
export {
|
|
54
|
-
f as BaseInputElement,
|
|
55
|
-
d as inputVariants
|
|
56
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { cva } from "class-variance-authority";
|
|
5
|
-
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Shared input variant styles
|
|
9
|
-
* These can be reused across different input components
|
|
10
|
-
*/
|
|
11
|
-
export const inputVariants = cva(
|
|
12
|
-
[
|
|
13
|
-
// Layout & Size
|
|
14
|
-
"flex w-full min-w-0 h-9",
|
|
15
|
-
// Appearance
|
|
16
|
-
"border border-input bg-background rounded-sm",
|
|
17
|
-
"outline-none transition-all",
|
|
18
|
-
// Typography
|
|
19
|
-
"text-sm font-sans",
|
|
20
|
-
"text-foreground",
|
|
21
|
-
"overflow-hidden text-ellipsis",
|
|
22
|
-
// States - Focus
|
|
23
|
-
"focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background",
|
|
24
|
-
"focus-visible:shadow-default",
|
|
25
|
-
// States - Disabled
|
|
26
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
27
|
-
// Pseudo-elements
|
|
28
|
-
"placeholder:text-muted-foreground",
|
|
29
|
-
"placeholder:overflow-hidden placeholder:text-ellipsis",
|
|
30
|
-
// Text input alignment - uses design token for text/sm line-height (20px)
|
|
31
|
-
"items-center px-3 pb-[1px] leading-5",
|
|
32
|
-
],
|
|
33
|
-
{
|
|
34
|
-
variants: {
|
|
35
|
-
hasIcon: {
|
|
36
|
-
true: "pl-9",
|
|
37
|
-
false: "",
|
|
38
|
-
},
|
|
39
|
-
hasSecondaryIcon: {
|
|
40
|
-
true: "pr-9",
|
|
41
|
-
false: "",
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
defaultVariants: {
|
|
45
|
-
hasIcon: false,
|
|
46
|
-
hasSecondaryIcon: false,
|
|
47
|
-
},
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Base input element without label/description wrapper
|
|
53
|
-
* Use this for composing custom input components
|
|
54
|
-
*
|
|
55
|
-
* For inputs with label/description, compose with Field, FieldLabel, FieldDescription
|
|
56
|
-
* For full-featured input with all props, use the Input component
|
|
57
|
-
*/
|
|
58
|
-
export interface BaseInputElementProps extends Omit<
|
|
59
|
-
React.InputHTMLAttributes<HTMLInputElement>,
|
|
60
|
-
"size"
|
|
61
|
-
> {
|
|
62
|
-
/**
|
|
63
|
-
* Whether the input has an icon (adds left padding)
|
|
64
|
-
*/
|
|
65
|
-
hasIcon?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Whether the input has a secondary icon (adds right padding)
|
|
68
|
-
*/
|
|
69
|
-
hasSecondaryIcon?: boolean;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export const BaseInputElement = React.forwardRef<
|
|
73
|
-
HTMLInputElement,
|
|
74
|
-
BaseInputElementProps
|
|
75
|
-
>(({ className, hasIcon = false, hasSecondaryIcon = false, ...props }, ref) => {
|
|
76
|
-
return (
|
|
77
|
-
<input
|
|
78
|
-
ref={ref}
|
|
79
|
-
className={cn(inputVariants({ hasIcon, hasSecondaryIcon }), className)}
|
|
80
|
-
data-slot="input"
|
|
81
|
-
{...props}
|
|
82
|
-
/>
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
BaseInputElement.displayName = "BaseInputElement";
|