@brightlocal/ui-components 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +1 -1
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.js +30 -30
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +4 -3
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +10 -10
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +6 -3
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +5 -0
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +49 -36
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.d.ts +3 -8
- package/dist/centred-layout.d.ts.map +1 -1
- package/dist/centred-layout.js +33 -48
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +7 -7
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts +6 -1
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +116 -103
- package/dist/command.cjs +1 -1
- package/dist/command.js +3 -3
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.js +3 -3
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.js +10 -10
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +12 -19
- package/dist/header.d.ts.map +1 -1
- package/dist/header.js +4 -1
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.js +63 -63
- package/dist/link.cjs +1 -1
- package/dist/link.js +2 -2
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +17 -16
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.js +3 -3
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/navigation-menu.js +2 -1
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.js +16 -16
- package/dist/rating.cjs +1 -1
- package/dist/rating.js +8 -8
- package/dist/resizable.cjs +1 -1
- package/dist/resizable.d.ts +1 -1
- package/dist/resizable.js +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.js +20 -20
- package/dist/sheet.d.ts +1 -1
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +9 -8
- package/package.json +1 -1
- package/src/blocks/data-table.tsx +5 -5
- package/src/blocks/sidebar.tsx +3 -2
- package/src/components/accordion.tsx +1 -1
- package/src/components/breadcrumb.tsx +1 -1
- package/src/components/calendar.tsx +6 -3
- package/src/components/card.tsx +24 -1
- package/src/components/centred-layout.tsx +6 -29
- package/src/components/checkbox.tsx +1 -1
- package/src/components/combobox.tsx +21 -5
- package/src/components/command.tsx +3 -3
- package/src/components/context-menu.tsx +3 -3
- package/src/components/dropdown-menu.tsx +4 -4
- package/src/components/field.tsx +9 -14
- package/src/components/header.tsx +4 -1
- package/src/components/input-password.tsx +4 -4
- package/src/components/link.tsx +1 -1
- package/src/components/logo.tsx +10 -9
- package/src/components/menubar.tsx +3 -3
- package/src/components/navigation-menu.tsx +2 -1
- package/src/components/pagination.tsx +3 -3
- package/src/components/rating.tsx +2 -2
- package/src/components/resizable.tsx +1 -1
- package/src/components/select.tsx +4 -4
- package/src/components/sonner.tsx +6 -5
package/dist/card.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import * as e from "react";
|
|
3
|
-
import { cva as
|
|
3
|
+
import { cva as x } from "class-variance-authority";
|
|
4
4
|
import { cn as s } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
-
const
|
|
6
|
-
[
|
|
5
|
+
const l = e.createContext({ flush: !1 }), g = x(
|
|
6
|
+
[
|
|
7
|
+
"flex",
|
|
8
|
+
"flex-col",
|
|
9
|
+
"gap-8",
|
|
10
|
+
"rounded-xl",
|
|
11
|
+
"py-8",
|
|
12
|
+
"transition-colors",
|
|
13
|
+
"w-full"
|
|
14
|
+
],
|
|
7
15
|
{
|
|
8
16
|
variants: {
|
|
9
17
|
variant: {
|
|
@@ -27,36 +35,41 @@ const n = e.createContext({ flush: !1 }), p = m(
|
|
|
27
35
|
variant: "default"
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
|
-
),
|
|
38
|
+
), N = e.forwardRef(
|
|
31
39
|
({
|
|
32
40
|
className: r,
|
|
33
41
|
variant: a = "default",
|
|
34
42
|
dataHook: t,
|
|
35
43
|
trackingEl: d,
|
|
36
44
|
trackingLabel: c,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
maxWidth: n = "400px",
|
|
46
|
+
children: i,
|
|
47
|
+
style: f,
|
|
48
|
+
...u
|
|
49
|
+
}, p) => {
|
|
50
|
+
const m = a === "transparent-flush", C = n !== void 0 ? {
|
|
51
|
+
maxWidth: typeof n == "number" ? `${n}px` : n
|
|
52
|
+
} : void 0;
|
|
53
|
+
return /* @__PURE__ */ o(l.Provider, { value: { flush: m }, children: /* @__PURE__ */ o(
|
|
42
54
|
"div",
|
|
43
55
|
{
|
|
44
|
-
ref:
|
|
45
|
-
className: s(
|
|
56
|
+
ref: p,
|
|
57
|
+
className: s(g({ variant: a }), r),
|
|
46
58
|
"data-hook": t,
|
|
47
59
|
"data-slot": "card",
|
|
48
60
|
"data-tracking-el": d || `card-${a}`,
|
|
49
61
|
"data-tracking-label": c,
|
|
50
|
-
...
|
|
51
|
-
|
|
62
|
+
style: { ...C, ...f },
|
|
63
|
+
...u,
|
|
64
|
+
children: i
|
|
52
65
|
}
|
|
53
66
|
) });
|
|
54
67
|
}
|
|
55
68
|
);
|
|
56
|
-
|
|
57
|
-
const
|
|
69
|
+
N.displayName = "Card";
|
|
70
|
+
const b = e.forwardRef(
|
|
58
71
|
({ className: r, ...a }, t) => {
|
|
59
|
-
const { flush: d } = e.useContext(
|
|
72
|
+
const { flush: d } = e.useContext(l);
|
|
60
73
|
return /* @__PURE__ */ o(
|
|
61
74
|
"div",
|
|
62
75
|
{
|
|
@@ -72,8 +85,8 @@ const x = e.forwardRef(
|
|
|
72
85
|
);
|
|
73
86
|
}
|
|
74
87
|
);
|
|
75
|
-
|
|
76
|
-
const
|
|
88
|
+
b.displayName = "CardHeader";
|
|
89
|
+
const v = e.forwardRef(
|
|
77
90
|
({ className: r, ...a }, t) => /* @__PURE__ */ o(
|
|
78
91
|
"div",
|
|
79
92
|
{
|
|
@@ -84,8 +97,8 @@ const g = e.forwardRef(
|
|
|
84
97
|
}
|
|
85
98
|
)
|
|
86
99
|
);
|
|
87
|
-
|
|
88
|
-
const
|
|
100
|
+
v.displayName = "CardTitle";
|
|
101
|
+
const h = e.forwardRef(
|
|
89
102
|
({ className: r, ...a }, t) => /* @__PURE__ */ o(
|
|
90
103
|
"div",
|
|
91
104
|
{
|
|
@@ -99,8 +112,8 @@ const N = e.forwardRef(
|
|
|
99
112
|
}
|
|
100
113
|
)
|
|
101
114
|
);
|
|
102
|
-
|
|
103
|
-
const
|
|
115
|
+
h.displayName = "CardDescription";
|
|
116
|
+
const w = e.forwardRef(
|
|
104
117
|
({ className: r, ...a }, t) => /* @__PURE__ */ o(
|
|
105
118
|
"div",
|
|
106
119
|
{
|
|
@@ -114,10 +127,10 @@ const h = e.forwardRef(
|
|
|
114
127
|
}
|
|
115
128
|
)
|
|
116
129
|
);
|
|
117
|
-
|
|
118
|
-
const
|
|
130
|
+
w.displayName = "CardAction";
|
|
131
|
+
const y = e.forwardRef(
|
|
119
132
|
({ className: r, ...a }, t) => {
|
|
120
|
-
const { flush: d } = e.useContext(
|
|
133
|
+
const { flush: d } = e.useContext(l);
|
|
121
134
|
return /* @__PURE__ */ o(
|
|
122
135
|
"div",
|
|
123
136
|
{
|
|
@@ -129,10 +142,10 @@ const b = e.forwardRef(
|
|
|
129
142
|
);
|
|
130
143
|
}
|
|
131
144
|
);
|
|
132
|
-
|
|
133
|
-
const
|
|
145
|
+
y.displayName = "CardContent";
|
|
146
|
+
const R = e.forwardRef(
|
|
134
147
|
({ className: r, ...a }, t) => {
|
|
135
|
-
const { flush: d } = e.useContext(
|
|
148
|
+
const { flush: d } = e.useContext(l);
|
|
136
149
|
return /* @__PURE__ */ o(
|
|
137
150
|
"div",
|
|
138
151
|
{
|
|
@@ -144,13 +157,13 @@ const v = e.forwardRef(
|
|
|
144
157
|
);
|
|
145
158
|
}
|
|
146
159
|
);
|
|
147
|
-
|
|
160
|
+
R.displayName = "CardFooter";
|
|
148
161
|
export {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
N as Card,
|
|
163
|
+
w as CardAction,
|
|
164
|
+
y as CardContent,
|
|
165
|
+
h as CardDescription,
|
|
166
|
+
R as CardFooter,
|
|
167
|
+
b as CardHeader,
|
|
168
|
+
v as CardTitle
|
|
156
169
|
};
|
package/dist/centred-layout.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),y=require("react"),o=require("@brightlocal/ui-components/lib/utils");function m(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const c=m(y),l=c.forwardRef(({className:e,children:a,dataHook:t,trackingEl:r,trackingLabel:d,...i},f)=>n.jsx("div",{ref:f,className:o.cn("bg-background flex min-h-screen w-full flex-col items-center justify-center gap-4 p-section",e),"data-hook":t,"data-slot":"centred-layout","data-tracking-el":r,"data-tracking-label":d,...i,children:a}));l.displayName="CentredLayout";const s=c.forwardRef(({className:e,children:a,...t},r)=>n.jsx("div",{ref:r,className:o.cn("flex w-full items-center justify-center lg:justify-start",e),"data-slot":"centred-layout-header",...t,children:a}));s.displayName="CentredLayoutHeader";const u=c.forwardRef(({className:e,children:a,...t},r)=>n.jsx("div",{ref:r,className:o.cn("flex w-full flex-1 flex-col items-center justify-center",e),"data-slot":"centred-layout-content",...t,children:a}));u.displayName="CentredLayoutContent";exports.CentredLayout=l;exports.CentredLayoutContent=u;exports.CentredLayoutHeader=s;
|
package/dist/centred-layout.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
/**
|
|
3
|
-
* CentredLayout provides a
|
|
3
|
+
* CentredLayout provides a full-page centered container.
|
|
4
4
|
*
|
|
5
5
|
* Spacing tokens used:
|
|
6
6
|
* - Padding: section-padding-x/y tokens (responsive: 16px mobile, 24px desktop)
|
|
7
7
|
* - Header to content gap: gap-4 (spacing.4 = 16px)
|
|
8
|
-
* - Max width: max-w-7xl (1280px) by default
|
|
9
8
|
*
|
|
10
|
-
* The component centers content horizontally and vertically.
|
|
9
|
+
* The component takes full page width/height and centers content horizontally and vertically.
|
|
11
10
|
*
|
|
12
11
|
* @example
|
|
13
12
|
* // Basic usage
|
|
@@ -41,13 +40,9 @@ interface CentredLayoutProps extends React.ComponentProps<"div"> {
|
|
|
41
40
|
* Tracking label for analytics context
|
|
42
41
|
*/
|
|
43
42
|
trackingLabel?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Custom max-width value (overrides default 1280px)
|
|
46
|
-
*/
|
|
47
|
-
maxWidth?: string | number;
|
|
48
43
|
}
|
|
49
44
|
/**
|
|
50
|
-
* CentredLayout component for centering content with
|
|
45
|
+
* CentredLayout component for centering content with full page width/height.
|
|
51
46
|
*/
|
|
52
47
|
declare const CentredLayout: React.ForwardRefExoticComponent<Omit<CentredLayoutProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
53
48
|
interface CentredLayoutHeaderProps extends React.ComponentProps<"div"> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"centred-layout.d.ts","sourceRoot":"","sources":["../../src/components/centred-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B
|
|
1
|
+
{"version":3,"file":"centred-layout.d.ts","sourceRoot":"","sources":["../../src/components/centred-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC9D;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,QAAA,MAAM,aAAa,wGAuBlB,CAAC;AAQF,UAAU,wBAAyB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACpE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;GAGG;AACH,QAAA,MAAM,mBAAmB,8GAiBvB,CAAC;AAQH,UAAU,yBAA0B,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACrE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;GAEG;AACH,QAAA,MAAM,oBAAoB,+GAiBxB,CAAC;AAQH,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,CAAC;AAEpE,YAAY,EACV,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,GAC1B,CAAC"}
|
package/dist/centred-layout.js
CHANGED
|
@@ -1,71 +1,56 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
3
|
import { cn as l } from "@brightlocal/ui-components/lib/utils";
|
|
4
|
-
const
|
|
5
|
-
({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// Base styles with section-padding tokens (responsive: 16px mobile, 24px desktop) and gap-4 for header/content spacing
|
|
23
|
-
"bg-background flex min-h-screen flex-col items-center justify-center gap-4 p-section",
|
|
24
|
-
!e && "max-w-7xl",
|
|
25
|
-
t
|
|
26
|
-
),
|
|
27
|
-
"data-hook": r,
|
|
28
|
-
"data-slot": "centred-layout",
|
|
29
|
-
"data-tracking-el": s,
|
|
30
|
-
"data-tracking-label": d,
|
|
31
|
-
style: i,
|
|
32
|
-
...c,
|
|
33
|
-
children: a
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
}
|
|
4
|
+
const f = o.forwardRef(
|
|
5
|
+
({ className: e, children: t, dataHook: a, trackingEl: r, trackingLabel: d, ...s }, c) => /* @__PURE__ */ n(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
ref: c,
|
|
9
|
+
className: l(
|
|
10
|
+
// Base styles with section-padding tokens (responsive: 16px mobile, 24px desktop) and gap-4 for header/content spacing
|
|
11
|
+
"bg-background flex min-h-screen w-full flex-col items-center justify-center gap-4 p-section",
|
|
12
|
+
e
|
|
13
|
+
),
|
|
14
|
+
"data-hook": a,
|
|
15
|
+
"data-slot": "centred-layout",
|
|
16
|
+
"data-tracking-el": r,
|
|
17
|
+
"data-tracking-label": d,
|
|
18
|
+
...s,
|
|
19
|
+
children: t
|
|
20
|
+
}
|
|
21
|
+
)
|
|
37
22
|
);
|
|
38
|
-
|
|
39
|
-
const
|
|
23
|
+
f.displayName = "CentredLayout";
|
|
24
|
+
const i = o.forwardRef(({ className: e, children: t, ...a }, r) => /* @__PURE__ */ n(
|
|
40
25
|
"div",
|
|
41
26
|
{
|
|
42
27
|
ref: r,
|
|
43
28
|
className: l(
|
|
44
29
|
"flex w-full items-center justify-center lg:justify-start",
|
|
45
|
-
|
|
30
|
+
e
|
|
46
31
|
),
|
|
47
32
|
"data-slot": "centred-layout-header",
|
|
48
33
|
...a,
|
|
49
|
-
children:
|
|
34
|
+
children: t
|
|
50
35
|
}
|
|
51
36
|
));
|
|
52
|
-
|
|
53
|
-
const
|
|
37
|
+
i.displayName = "CentredLayoutHeader";
|
|
38
|
+
const u = o.forwardRef(({ className: e, children: t, ...a }, r) => /* @__PURE__ */ n(
|
|
54
39
|
"div",
|
|
55
40
|
{
|
|
56
41
|
ref: r,
|
|
57
42
|
className: l(
|
|
58
|
-
"flex flex-1 flex-col items-center justify-center",
|
|
59
|
-
|
|
43
|
+
"flex w-full flex-1 flex-col items-center justify-center",
|
|
44
|
+
e
|
|
60
45
|
),
|
|
61
46
|
"data-slot": "centred-layout-content",
|
|
62
47
|
...a,
|
|
63
|
-
children:
|
|
48
|
+
children: t
|
|
64
49
|
}
|
|
65
50
|
));
|
|
66
|
-
|
|
51
|
+
u.displayName = "CentredLayoutContent";
|
|
67
52
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
53
|
+
f as CentredLayout,
|
|
54
|
+
u as CentredLayoutContent,
|
|
55
|
+
i as CentredLayoutHeader
|
|
71
56
|
};
|
package/dist/checkbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),g=require("react"),m=require("@radix-ui/react-checkbox"),x=require("@brightlocal/icons"),p=require("class-variance-authority"),v=require("@brightlocal/ui-components/lib/utils");function s(e){const r=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(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const c=s(g),i=s(m),y=p.cva(["size-4 shrink-0 self-start mt-0.5","bg-background peer border border-ring dark:bg-input/30 rounded-xs transition-colors outline-none","data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary","focus-visible:border-ring focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50"],{variants:{error:{true:["border-red-600/40 dark:border-red-400/60","focus-visible:border-destructive focus-visible:shadow-destructive"]}},defaultVariants:{error:!1}}),n=c.forwardRef(({className:e,disabled:r=!1,error:t,dataHook:a,trackingEl:d,trackingLabel:u,id:l,...b},f)=>{const k=c.useId(),h=l||k;return o.jsx(i.Root,{ref:f,"aria-invalid":t?"true":void 0,className:v.cn(y({error:t}),e),"data-hook":a,"data-slot":"checkbox","data-tracking-el":d,"data-tracking-label":u,disabled:r,id:h,...b,children:o.jsx(i.Indicator,{className:"flex items-center justify-center text-current transition-none","data-slot":"checkbox-indicator",children:o.jsx(x.CheckIcon,{size:14})})})});n.displayName="Checkbox";exports.Checkbox=n;
|
package/dist/checkbox.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import * as a from "@radix-ui/react-checkbox";
|
|
4
4
|
import { CheckIcon as k } from "@brightlocal/icons";
|
|
5
5
|
import { cva as u } from "class-variance-authority";
|
|
6
6
|
import { cn as h } from "@brightlocal/ui-components/lib/utils";
|
|
@@ -32,7 +32,7 @@ const p = u(
|
|
|
32
32
|
error: !1
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
), x =
|
|
35
|
+
), x = t.forwardRef(
|
|
36
36
|
({
|
|
37
37
|
className: o,
|
|
38
38
|
disabled: i = !1,
|
|
@@ -43,9 +43,9 @@ const p = u(
|
|
|
43
43
|
id: n,
|
|
44
44
|
...l
|
|
45
45
|
}, b) => {
|
|
46
|
-
const m =
|
|
46
|
+
const m = t.useId(), f = n || m;
|
|
47
47
|
return /* @__PURE__ */ e(
|
|
48
|
-
|
|
48
|
+
a.Root,
|
|
49
49
|
{
|
|
50
50
|
ref: b,
|
|
51
51
|
"aria-invalid": r ? "true" : void 0,
|
|
@@ -58,11 +58,11 @@ const p = u(
|
|
|
58
58
|
id: f,
|
|
59
59
|
...l,
|
|
60
60
|
children: /* @__PURE__ */ e(
|
|
61
|
-
|
|
61
|
+
a.Indicator,
|
|
62
62
|
{
|
|
63
63
|
className: "flex items-center justify-center text-current transition-none",
|
|
64
64
|
"data-slot": "checkbox-indicator",
|
|
65
|
-
children: /* @__PURE__ */ e(k, {
|
|
65
|
+
children: /* @__PURE__ */ e(k, { size: 14 })
|
|
66
66
|
}
|
|
67
67
|
)
|
|
68
68
|
}
|
package/dist/combobox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),U=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),U=require("react"),T=require("@brightlocal/icons"),V=require("class-variance-authority"),f=require("@brightlocal/ui-components/lib/utils"),I=require("@brightlocal/ui-components/popover"),l=require("@brightlocal/ui-components/command");function $(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const a in o)if(a!=="default"){const t=Object.getOwnPropertyDescriptor(o,a);Object.defineProperty(e,a,t.get?t:{enumerable:!0,get:()=>o[a]})}}return e.default=o,Object.freeze(e)}const n=$(U),E=n.createContext(null);function y(){const o=n.useContext(E);if(!o)throw new Error("Combobox components must be used within a <Combobox>");return o}function F({value:o,onValueChange:e,open:a,onOpenChange:t,shouldFilter:s=!0,disabled:i=!1,children:c}){const[g,d]=n.useState(""),[m,C]=n.useState(!1),[x,u]=n.useState(()=>new Map),v=o!==void 0,p=a!==void 0,h=v?o:g,w=p?a:m,j=n.useCallback(b=>{p||C(b),t?.(b)},[p,t]),N=n.useCallback(b=>{v||d(b),e?.(b)},[v,e]),S=n.useCallback((b,R)=>{u(k=>{if(k.get(b)===R)return k;const L=new Map(k);return L.set(b,R),L})},[]),D=n.useMemo(()=>({open:w,setOpen:j,value:h,onValueChange:N,shouldFilter:s,disabled:i,itemLabels:x,registerItem:S}),[w,j,h,N,s,i,x,S]);return r.jsx(E.Provider,{value:D,children:r.jsx(I.Popover,{open:w,onOpenChange:j,children:c})})}const A=V.cva(["relative flex w-full items-center justify-between gap-2","px-4 py-2 h-9","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"],{variants:{variant:{default:[]}},defaultVariants:{variant:"default"}}),O=n.forwardRef(({className:o,variant:e,dataHook:a,trackingEl:t,trackingLabel:s,children:i,...c},g)=>{const{open:d,disabled:m,value:C}=y(),x=n.useId(),u=!C;return r.jsx(I.PopoverTrigger,{asChild:!0,children:r.jsxs("button",{ref:g,"aria-controls":d?x:void 0,"aria-expanded":d,"aria-haspopup":"listbox",className:f.cn(A({variant:e}),o),"data-hook":a,"data-placeholder":u,"data-slot":"combobox-trigger","data-state":d?"open":"closed","data-tracking-el":t||"combobox-trigger","data-tracking-label":s,disabled:m||c.disabled,role:"combobox",type:"button",...c,children:[i,r.jsx(T.ChevronsUpDownIcon,{"aria-hidden":"true",className:"text-muted-foreground ml-auto shrink-0",size:16})]})})});O.displayName="ComboboxTrigger";function H({placeholder:o,className:e}){const{value:a,itemLabels:t}=y(),s=a?t.get(a)||a:o;return r.jsx("span",{className:f.cn("text-foreground overflow-hidden text-sm leading-normal font-medium text-ellipsis whitespace-nowrap",e),"data-slot":"combobox-value",children:s})}function B({dataHook:o,className:e,children:a,align:t="start",hideList:s=!1}){const{shouldFilter:i}=y();return r.jsx(I.PopoverContent,{align:t,className:f.cn("w-[var(--radix-popover-trigger-width)] p-0",e),"data-slot":"combobox-popover",side:"bottom",children:r.jsx(l.Command,{className:f.cn("border-0 shadow-none",s&&"[&_[data-slot='command-input-wrapper']]:border-b-0"),"data-slot":"combobox-command",dataHook:o||"combobox-command",shouldFilter:i,children:a})})}const P=n.forwardRef((o,e)=>r.jsx(l.CommandInput,{ref:e,"data-slot":"combobox-input",...o}));P.displayName="ComboboxInput";const q=n.forwardRef((o,e)=>r.jsx(l.CommandList,{ref:e,"data-slot":"combobox-list",...o}));q.displayName="ComboboxList";const _=n.forwardRef((o,e)=>r.jsx(l.CommandEmpty,{ref:e,"data-slot":"combobox-empty",...o}));_.displayName="ComboboxEmpty";const z=n.forwardRef((o,e)=>r.jsx(l.CommandGroup,{ref:e,"data-slot":"combobox-group",...o}));z.displayName="ComboboxGroup";function J(o,e,a){if(!e||!e.trim())return o;const t=new RegExp(`(${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi"),s=o.split(t);return r.jsx("span",{children:s.map((i,c)=>c%2===1?r.jsx("span",{className:a,children:i},c):r.jsx(n.Fragment,{children:i},c))})}const M=n.forwardRef(({value:o,label:e,dataHook:a,children:t,className:s,highlight:i,highlightClassName:c,...g},d)=>{const{value:m,onValueChange:C,setOpen:x,registerItem:u}=y(),v=m===o,p=n.useMemo(()=>e||(typeof t=="string"?t:typeof t=="number"?String(t):o),[e,t,o]),h=n.useRef(u);n.useEffect(()=>{h.current=u},[u]),n.useEffect(()=>{h.current(o,p)},[o,p]);const w=()=>{C(o===m?"":o),x(!1)},j=()=>i&&typeof t=="string"?J(t,i,c||"text-sm leading-normal font-semibold"):t;return r.jsxs(l.CommandItem,{ref:d,className:f.cn("justify-between",s),"data-slot":"combobox-item",dataHook:a,value:o,onSelect:w,...g,children:[j(),v&&r.jsx(T.CheckIcon,{"aria-hidden":"true",className:"text-muted-foreground shrink-0",size:16})]})});M.displayName="ComboboxItem";const G=n.forwardRef((o,e)=>r.jsx(l.CommandSeparator,{ref:e,"data-slot":"combobox-separator",...o}));G.displayName="ComboboxSeparator";function K({className:o,children:e}){return r.jsx("div",{className:f.cn("text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",o),"data-slot":"combobox-loading",children:e||r.jsxs(r.Fragment,{children:[r.jsx("div",{"aria-hidden":"true",className:"size-4 animate-spin rounded-full border-2 border-current border-t-transparent [animation-duration:0.6s]"}),"Loading..."]})})}exports.Combobox=F;exports.ComboboxContent=B;exports.ComboboxEmpty=_;exports.ComboboxGroup=z;exports.ComboboxInput=P;exports.ComboboxItem=M;exports.ComboboxList=q;exports.ComboboxLoading=K;exports.ComboboxSeparator=G;exports.ComboboxTrigger=O;exports.ComboboxValue=H;
|
package/dist/combobox.d.ts
CHANGED
|
@@ -50,8 +50,13 @@ export interface ComboboxContentProps {
|
|
|
50
50
|
children: React.ReactNode;
|
|
51
51
|
/** Alignment of the popover relative to trigger */
|
|
52
52
|
align?: "start" | "center" | "end";
|
|
53
|
+
/**
|
|
54
|
+
* Hide the list area (and the input border). Useful for async search
|
|
55
|
+
* where you want to hide results until a minimum character count.
|
|
56
|
+
*/
|
|
57
|
+
hideList?: boolean;
|
|
53
58
|
}
|
|
54
|
-
declare function ComboboxContent({ dataHook, className, children, align, }: ComboboxContentProps): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
declare function ComboboxContent({ dataHook, className, children, align, hideList, }: ComboboxContentProps): import("react/jsx-runtime").JSX.Element;
|
|
55
60
|
export interface ComboboxInputProps extends React.ComponentProps<typeof CommandInput> {
|
|
56
61
|
/** Current input value. Use for controlled/async search. */
|
|
57
62
|
value?: string;
|
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;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQlE,OAAO,EAEL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAgC5C,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,iBAAS,QAAQ,CAAC,EAChB,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,uBAAuB,EACtC,IAAI,EAAE,cAAc,EACpB,YAAY,EAAE,sBAAsB,EACpC,YAAmB,EACnB,QAAgB,EAChB,QAAQ,GACT,EAAE,aAAa,2CAwEf;AAMD,QAAA,MAAM,uBAAuB;;8EAgD5B,CAAC;AAEF,MAAM,WAAW,oBACf,SACE,KAAK,CAAC,oBAA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