@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
package/dist/collapsible.d.ts
CHANGED
|
@@ -1,18 +1,75 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Props for the Collapsible component
|
|
5
|
+
*/
|
|
6
|
+
export interface CollapsibleProps extends React.ComponentProps<typeof CollapsiblePrimitive.Root> {
|
|
7
|
+
/**
|
|
8
|
+
* Data hook for automated testing (required)
|
|
9
|
+
*/
|
|
3
10
|
dataHook: string;
|
|
11
|
+
/**
|
|
12
|
+
* Tracking element identifier for analytics
|
|
13
|
+
*/
|
|
4
14
|
trackingEl?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Tracking label for analytics context
|
|
17
|
+
*/
|
|
5
18
|
trackingLabel?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Collapsible component that shows/hides content with animation
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <Collapsible dataHook="my-collapsible">
|
|
26
|
+
* <CollapsibleTrigger>Toggle</CollapsibleTrigger>
|
|
27
|
+
* <CollapsibleContent>Content</CollapsibleContent>
|
|
28
|
+
* </Collapsible>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
declare const Collapsible: React.ForwardRefExoticComponent<Omit<CollapsibleProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
/**
|
|
33
|
+
* Props for the CollapsibleTrigger component
|
|
34
|
+
*/
|
|
35
|
+
export interface CollapsibleTriggerProps extends React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger> {
|
|
36
|
+
/**
|
|
37
|
+
* Data hook for automated testing
|
|
38
|
+
*/
|
|
39
|
+
dataHook?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Tracking element identifier for analytics
|
|
42
|
+
*/
|
|
9
43
|
trackingEl?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Tracking label for analytics context
|
|
46
|
+
*/
|
|
10
47
|
trackingLabel?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Trigger button that toggles the collapsible content
|
|
51
|
+
*/
|
|
52
|
+
declare const CollapsibleTrigger: React.ForwardRefExoticComponent<Omit<CollapsibleTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
53
|
+
/**
|
|
54
|
+
* Props for the CollapsibleContent component
|
|
55
|
+
*/
|
|
56
|
+
export interface CollapsibleContentProps extends React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent> {
|
|
57
|
+
/**
|
|
58
|
+
* Data hook for automated testing
|
|
59
|
+
*/
|
|
60
|
+
dataHook?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Tracking element identifier for analytics
|
|
63
|
+
*/
|
|
14
64
|
trackingEl?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Tracking label for analytics context
|
|
67
|
+
*/
|
|
15
68
|
trackingLabel?: string;
|
|
16
|
-
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Content container that is shown/hidden based on collapsible state
|
|
72
|
+
*/
|
|
73
|
+
declare const CollapsibleContent: React.ForwardRefExoticComponent<Omit<CollapsibleContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
17
74
|
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
18
75
|
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../src/components/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../src/components/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAC5D,OAAO,oBAAoB,CAAC,IAAI,CACjC;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,WAAW,sGAcf,CAAC;AAIH;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,KAAK,CAAC,cAAc,CACnE,OAAO,oBAAoB,CAAC,kBAAkB,CAC/C;IACC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,QAAA,MAAM,kBAAkB,gHActB,CAAC;AAIH;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,KAAK,CAAC,cAAc,CACnE,OAAO,oBAAoB,CAAC,kBAAkB,CAC/C;IACC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,QAAA,MAAM,kBAAkB,6GActB,CAAC;AAIH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/collapsible.js
CHANGED
|
@@ -1,58 +1,44 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as i from "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
trackingLabel: t,
|
|
41
|
-
...o
|
|
42
|
-
}) {
|
|
43
|
-
return /* @__PURE__ */ e(
|
|
44
|
-
i.CollapsibleContent,
|
|
45
|
-
{
|
|
46
|
-
"data-hook": a,
|
|
47
|
-
"data-slot": "collapsible-content",
|
|
48
|
-
"data-tracking-el": l,
|
|
49
|
-
"data-tracking-label": t,
|
|
50
|
-
...o
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
}
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import * as s from "@radix-ui/react-collapsible";
|
|
4
|
+
const n = i.forwardRef(({ dataHook: a, trackingEl: l, trackingLabel: t, ...o }, e) => /* @__PURE__ */ r(
|
|
5
|
+
s.Root,
|
|
6
|
+
{
|
|
7
|
+
ref: e,
|
|
8
|
+
"data-hook": a,
|
|
9
|
+
"data-slot": "collapsible",
|
|
10
|
+
"data-tracking-el": l,
|
|
11
|
+
"data-tracking-label": t,
|
|
12
|
+
...o
|
|
13
|
+
}
|
|
14
|
+
));
|
|
15
|
+
n.displayName = "Collapsible";
|
|
16
|
+
const p = i.forwardRef(({ dataHook: a, trackingEl: l, trackingLabel: t, ...o }, e) => /* @__PURE__ */ r(
|
|
17
|
+
s.CollapsibleTrigger,
|
|
18
|
+
{
|
|
19
|
+
ref: e,
|
|
20
|
+
"data-hook": a,
|
|
21
|
+
"data-slot": "collapsible-trigger",
|
|
22
|
+
"data-tracking-el": l,
|
|
23
|
+
"data-tracking-label": t,
|
|
24
|
+
...o
|
|
25
|
+
}
|
|
26
|
+
));
|
|
27
|
+
p.displayName = "CollapsibleTrigger";
|
|
28
|
+
const d = i.forwardRef(({ dataHook: a, trackingEl: l, trackingLabel: t, ...o }, e) => /* @__PURE__ */ r(
|
|
29
|
+
s.CollapsibleContent,
|
|
30
|
+
{
|
|
31
|
+
ref: e,
|
|
32
|
+
"data-hook": a,
|
|
33
|
+
"data-slot": "collapsible-content",
|
|
34
|
+
"data-tracking-el": l,
|
|
35
|
+
"data-tracking-label": t,
|
|
36
|
+
...o
|
|
37
|
+
}
|
|
38
|
+
));
|
|
39
|
+
d.displayName = "CollapsibleContent";
|
|
54
40
|
export {
|
|
55
41
|
n as Collapsible,
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
d as CollapsibleContent,
|
|
43
|
+
p as CollapsibleTrigger
|
|
58
44
|
};
|
package/dist/combobox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),R=require("react"),p=require("@brightlocal/icons"),E=require("@brightlocal/ui-components/checkbox"),V=require("class-variance-authority"),D=require("@brightlocal/ui-components/lib/utils"),f=require("@brightlocal/ui-components/popover"),l=require("@brightlocal/ui-components/command");function U(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const a in n)if(a!=="default"){const c=Object.getOwnPropertyDescriptor(n,a);Object.defineProperty(t,a,c.get?c:{enumerable:!0,get:()=>n[a]})}}return t.default=n,Object.freeze(t)}const m=U(R),x="font-sans text-sm leading-normal font-normal text-foreground",B="bg-accent flex size-5 shrink-0 items-center justify-center rounded-full text-xs font-medium",H="size-5 rounded-full object-cover",J=V.cva(["relative flex w-full items-center justify-start gap-2","px-4 py-2","border border-input rounded-md outline-none","bg-neutral-50 shadow-xs","dark:bg-white/5 dark:border-white/15","text-sm font-normal font-sans text-foreground","data-[placeholder=true]:text-muted-foreground","hover:bg-accent","focus-visible:outline-none focus-visible:border-ring dark:focus-visible:border-neutral-500 focus-visible:bg-background","focus-visible:shadow-default","data-[state=open]:border-ring","disabled:cursor-not-allowed disabled:opacity-50","disabled:hover:bg-neutral-50","transition-[background-color,border-color,box-shadow] duration-200 ease-out","[&_svg]:pointer-events-none [&_svg]:shrink-0","[&_svg:not([class*='size-'])]:size-4","[&_svg:not([class*='text-'])]:text-muted-foreground"],{variants:{variant:{default:["h-9"],withGroupLabel:["self-stretch"]}},defaultVariants:{variant:"default"}});function S({src:n,fallback:t,alt:a,dataSlot:c}){return e.jsx("span",{className:B,"data-slot":c,children:n?e.jsx("img",{alt:a||"",className:H,src:n}):t||"?"})}const I=m.forwardRef(({id:n,variant:t="default",dataHook:a,trackingEl:c,trackingLabel:y,items:i,value:u,onValueChange:A,placeholder:g="Select an option...",groupLabel:j,disabled:_,emptyMessage:O="No results found.",searchPlaceholder:z="Search",showAvatar:L=!1,avatarSrc:$,avatarFallback:q,className:T,menuItemType:F="simple","aria-label":G},M)=>{const[b,v]=m.useState(!1),w=m.useId(),d=i.find(o=>o.value===u),P=!d,k=m.useMemo(()=>t!=="withGroupLabel"?{"":i}:i.reduce((o,r)=>{const s=r.group||"";return o[s]||(o[s]=[]),o[s].push(r),o},{}),[i,t]),N=o=>{A?.(o===u?"":o),v(!1)},C=(o,r)=>{const s=o.icon,h=r?e.jsx(p.CheckIcon,{className:"text-muted-foreground ml-auto size-4 shrink-0"}):null;switch(F){case"checkbox":return e.jsxs(e.Fragment,{children:[e.jsx(E.Checkbox,{checked:r,className:"pointer-events-none self-center",dataHook:`${a}-checkbox-${o.value}`}),e.jsx("span",{className:x,children:o.label})]});case"icon":return e.jsxs(e.Fragment,{children:[s&&e.jsx(s,{className:"text-muted-foreground size-4 shrink-0"}),e.jsx("span",{className:x,children:o.label}),h]});case"avatar":return e.jsxs(e.Fragment,{children:[e.jsx(S,{alt:o.label,dataSlot:"menu-item-avatar",fallback:o.avatarFallback,src:o.avatarSrc}),e.jsx("span",{className:x,children:o.label}),h]});case"simple":default:return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:x,children:o.label}),h]})}};return e.jsxs(f.Popover,{open:b,onOpenChange:v,children:[e.jsx(f.PopoverTrigger,{asChild:!0,children:e.jsx("button",{ref:M,"aria-controls":b?w:void 0,"aria-expanded":b,"aria-haspopup":"listbox","aria-label":G,className:D.cn(J({variant:t}),T),"data-hook":a,"data-placeholder":P,"data-slot":"combobox-trigger","data-tracking-el":c||`combobox-${t}`,"data-tracking-label":y,disabled:_,id:n,role:"combobox",type:"button",children:t==="withGroupLabel"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex w-full flex-col items-start pr-6",children:[j&&e.jsx("span",{className:"text-muted-foreground overflow-hidden font-sans text-xs leading-4 font-normal text-ellipsis",children:j}),e.jsx("span",{className:"text-foreground overflow-hidden font-sans text-sm leading-5 font-medium text-ellipsis whitespace-nowrap",children:d?d.label:g})]}),e.jsx(p.ChevronDownIcon,{className:"text-muted-foreground absolute top-1/2 right-4 size-4 shrink-0 -translate-y-1/2"})]}):e.jsxs(e.Fragment,{children:[L&&e.jsx(S,{alt:d?.label,dataSlot:"combobox-avatar",fallback:q,src:$}),e.jsx("span",{className:"text-foreground overflow-hidden text-sm leading-normal font-medium text-ellipsis whitespace-nowrap",children:d?d.label:g}),e.jsx(p.ChevronsUpDownIcon,{className:"text-muted-foreground ml-auto size-4 shrink-0"})]})})}),e.jsx(f.PopoverContent,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0","data-slot":"combobox-popover",children:e.jsxs(l.Command,{className:"border-0 shadow-none","data-slot":"combobox-command",dataHook:`${a}-command`,id:w,children:[e.jsx(l.CommandInput,{dataHook:`${a}-search`,placeholder:z}),e.jsxs(l.CommandList,{children:[e.jsx(l.CommandEmpty,{children:O}),t==="withGroupLabel"&&Object.keys(k).length>1?Object.entries(k).map(([o,r])=>e.jsx(l.CommandGroup,{heading:o,children:r.map(s=>e.jsx(l.CommandItem,{dataHook:`${a}-item-${s.value}`,value:s.value,onSelect:N,children:C(s,u===s.value)},s.value))},o)):e.jsx(l.CommandGroup,{children:i.map(o=>e.jsx(l.CommandItem,{dataHook:`${a}-item-${o.value}`,value:o.value,onSelect:N,children:C(o,u===o.value)},o.value))})]})]})})]})});I.displayName="Combobox";exports.Combobox=I;
|
package/dist/combobox.d.ts
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
+
import { LucideIcon } from '@brightlocal/icons';
|
|
1
2
|
import { VariantProps } from 'class-variance-authority';
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
/**
|
|
4
5
|
* Visual style variants for Combobox
|
|
6
|
+
* - `default`: Default variant with standard combobox styling
|
|
7
|
+
* - `withGroupLabel`: Variant with group label showing category above selection
|
|
5
8
|
*/
|
|
6
|
-
export
|
|
7
|
-
/** Default variant with standard combobox styling */
|
|
8
|
-
DEFAULT = "default",
|
|
9
|
-
/** Variant with group label showing category above selection */
|
|
10
|
-
WITH_GROUP_LABEL = "withGroupLabel"
|
|
11
|
-
}
|
|
9
|
+
export type ComboboxVariant = "default" | "withGroupLabel";
|
|
12
10
|
/**
|
|
13
|
-
*
|
|
11
|
+
* Menu item type variants for Combobox dropdown items
|
|
12
|
+
* - `simple`: Simple text-only menu item
|
|
13
|
+
* - `checkbox`: Menu item with checkbox
|
|
14
|
+
* - `icon`: Menu item with icon
|
|
15
|
+
* - `avatar`: Menu item with avatar
|
|
14
16
|
*/
|
|
15
|
-
export
|
|
16
|
-
/** Standard size (36px height) */
|
|
17
|
-
DEFAULT = "default",
|
|
18
|
-
/** Large size (48px height) */
|
|
19
|
-
LG = "lg"
|
|
20
|
-
}
|
|
17
|
+
export type ComboboxMenuItemType = "simple" | "checkbox" | "icon" | "avatar";
|
|
21
18
|
export interface ComboboxItem {
|
|
22
19
|
/** Unique value for the item */
|
|
23
20
|
value: string;
|
|
@@ -25,12 +22,19 @@ export interface ComboboxItem {
|
|
|
25
22
|
label: string;
|
|
26
23
|
/** Optional group/category for the item */
|
|
27
24
|
group?: string;
|
|
25
|
+
/** Icon component for icon menu item type */
|
|
26
|
+
icon?: LucideIcon;
|
|
27
|
+
/** Avatar image source URL for avatar menu item type */
|
|
28
|
+
avatarSrc?: string;
|
|
29
|
+
/** Avatar fallback text/initials for avatar menu item type */
|
|
30
|
+
avatarFallback?: string;
|
|
28
31
|
}
|
|
29
32
|
declare const comboboxTriggerVariants: (props?: ({
|
|
30
33
|
variant?: "default" | "withGroupLabel" | null | undefined;
|
|
31
|
-
size?: "default" | "lg" | null | undefined;
|
|
32
34
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
33
35
|
interface ComboboxProps extends VariantProps<typeof comboboxTriggerVariants> {
|
|
36
|
+
/** Optional id for the combobox trigger, used with FieldLabel htmlFor */
|
|
37
|
+
id?: string;
|
|
34
38
|
/** Data hook for automated testing (REQUIRED) */
|
|
35
39
|
dataHook: string;
|
|
36
40
|
/** Tracking element identifier for analytics */
|
|
@@ -47,18 +51,24 @@ interface ComboboxProps extends VariantProps<typeof comboboxTriggerVariants> {
|
|
|
47
51
|
placeholder?: string;
|
|
48
52
|
/** Group label text (only for withGroupLabel variant) */
|
|
49
53
|
groupLabel?: string;
|
|
50
|
-
/** Label text displayed above the combobox */
|
|
51
|
-
label?: string;
|
|
52
|
-
/** Description text displayed below the combobox */
|
|
53
|
-
description?: string;
|
|
54
54
|
/** Disabled state */
|
|
55
55
|
disabled?: boolean;
|
|
56
56
|
/** Empty state message when no results found */
|
|
57
57
|
emptyMessage?: string;
|
|
58
58
|
/** Search placeholder text */
|
|
59
59
|
searchPlaceholder?: string;
|
|
60
|
+
/** Whether to show the avatar */
|
|
61
|
+
showAvatar?: boolean;
|
|
62
|
+
/** Avatar image source URL */
|
|
63
|
+
avatarSrc?: string;
|
|
64
|
+
/** Avatar fallback text/initials */
|
|
65
|
+
avatarFallback?: string;
|
|
60
66
|
/** Custom className for the trigger button */
|
|
61
67
|
className?: string;
|
|
68
|
+
/** Menu item type for dropdown items */
|
|
69
|
+
menuItemType?: ComboboxMenuItemType;
|
|
70
|
+
/** Accessible label for the combobox (used when no visible label is provided) */
|
|
71
|
+
"aria-label"?: string;
|
|
62
72
|
}
|
|
63
73
|
declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLButtonElement>>;
|
|
64
74
|
export { Combobox, type ComboboxProps };
|
package/dist/combobox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/components/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/components/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAiBlE;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE7E,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAYD,QAAA,MAAM,uBAAuB;;8EAqD5B,CAAC;AAEF,UAAU,aAAc,SAAQ,YAAY,CAAC,OAAO,uBAAuB,CAAC;IAC1E,yEAAyE;IACzE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gDAAgD;IAChD,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,iFAAiF;IACjF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA2BD,QAAA,MAAM,QAAQ,yFA2Nb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,CAAC"}
|