@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/date-picker.js
CHANGED
|
@@ -1,95 +1,234 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as
|
|
3
|
-
import { format as
|
|
4
|
-
import { Calendar as N } from "
|
|
5
|
-
import { cn as
|
|
6
|
-
import { inputVariants as
|
|
7
|
-
import { Calendar as
|
|
8
|
-
import { Popover as y, PopoverTrigger as
|
|
9
|
-
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import * as m from "react";
|
|
3
|
+
import { format as w } from "date-fns";
|
|
4
|
+
import { Calendar as N } from "@brightlocal/icons";
|
|
5
|
+
import { cn as c } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
import { inputVariants as v } from "./input.js";
|
|
7
|
+
import { Calendar as S } from "@brightlocal/ui-components/calendar";
|
|
8
|
+
import { Popover as y, PopoverTrigger as C, PopoverContent as $ } from "@brightlocal/ui-components/popover";
|
|
9
|
+
import { Select as j, SelectTrigger as E, SelectValue as L, SelectContent as M, SelectItem as O } from "@brightlocal/ui-components/select";
|
|
10
|
+
const T = m.forwardRef(
|
|
10
11
|
({
|
|
11
|
-
className:
|
|
12
|
-
dataHook:
|
|
13
|
-
trackingEl:
|
|
14
|
-
trackingLabel:
|
|
15
|
-
date:
|
|
16
|
-
onDateChange:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...
|
|
23
|
-
},
|
|
24
|
-
const [
|
|
25
|
-
|
|
12
|
+
className: t,
|
|
13
|
+
dataHook: r,
|
|
14
|
+
trackingEl: s,
|
|
15
|
+
trackingLabel: D,
|
|
16
|
+
date: a,
|
|
17
|
+
onDateChange: u,
|
|
18
|
+
placeholder: p = "Pick a date",
|
|
19
|
+
disabled: n,
|
|
20
|
+
dateFormat: d = "PPP",
|
|
21
|
+
presets: o,
|
|
22
|
+
id: b,
|
|
23
|
+
...f
|
|
24
|
+
}, k) => {
|
|
25
|
+
const [x, g] = m.useState(!1), h = /* @__PURE__ */ e(
|
|
26
|
+
S,
|
|
27
|
+
{
|
|
28
|
+
captionLayout: "dropdown",
|
|
29
|
+
className: c(
|
|
30
|
+
"border-0 shadow-none",
|
|
31
|
+
o && "border-border rounded-lg border"
|
|
32
|
+
),
|
|
33
|
+
dataHook: `${r}-calendar`,
|
|
34
|
+
disabled: n,
|
|
35
|
+
endMonth: new Date(2100, 11, 31),
|
|
36
|
+
mode: "single",
|
|
37
|
+
selected: a,
|
|
38
|
+
startMonth: new Date(1900, 0, 1),
|
|
39
|
+
onSelect: (l) => {
|
|
40
|
+
u?.(l), g(!1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
return /* @__PURE__ */ e(
|
|
26
45
|
"div",
|
|
27
46
|
{
|
|
28
|
-
ref:
|
|
29
|
-
className:
|
|
30
|
-
"data-hook":
|
|
47
|
+
ref: k,
|
|
48
|
+
className: c("flex w-full flex-col gap-2", t),
|
|
49
|
+
"data-hook": r,
|
|
31
50
|
"data-slot": "date-picker",
|
|
32
|
-
"data-tracking-el":
|
|
33
|
-
"data-tracking-label":
|
|
34
|
-
...
|
|
35
|
-
children: [
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
"data-tracking-el": s || "date-picker",
|
|
52
|
+
"data-tracking-label": D,
|
|
53
|
+
...f,
|
|
54
|
+
children: /* @__PURE__ */ i(y, { open: x, onOpenChange: g, children: [
|
|
55
|
+
/* @__PURE__ */ e(C, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "relative flex w-full items-center", children: [
|
|
56
|
+
/* @__PURE__ */ e(
|
|
57
|
+
N,
|
|
58
|
+
{
|
|
59
|
+
className: c(
|
|
60
|
+
"text-muted-foreground pointer-events-none absolute left-3 flex size-4 items-center",
|
|
61
|
+
n && "opacity-50"
|
|
62
|
+
),
|
|
63
|
+
"data-slot": "calendar-icon"
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ e(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
"aria-label": f["aria-label"] ?? "Select date",
|
|
70
|
+
className: c(
|
|
71
|
+
v({ hasIcon: !0 }),
|
|
72
|
+
"cursor-pointer justify-start text-left",
|
|
73
|
+
!a && "text-muted-foreground"
|
|
74
|
+
),
|
|
75
|
+
"data-hook": `${r}-trigger`,
|
|
76
|
+
"data-slot": "date-picker-trigger",
|
|
77
|
+
disabled: n,
|
|
78
|
+
id: b,
|
|
79
|
+
type: "button",
|
|
80
|
+
children: a ? w(a, d) : /* @__PURE__ */ e("span", { children: p })
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] }) }),
|
|
84
|
+
/* @__PURE__ */ e($, { align: "start", className: "w-auto rounded-lg p-0", children: o ? /* @__PURE__ */ i("div", { className: "flex flex-col gap-2 p-2", children: [
|
|
85
|
+
/* @__PURE__ */ i(
|
|
86
|
+
j,
|
|
87
|
+
{
|
|
88
|
+
disabled: n,
|
|
89
|
+
value: a ? o.find(
|
|
90
|
+
(l) => l.date().toDateString() === a.toDateString()
|
|
91
|
+
)?.label : void 0,
|
|
92
|
+
onValueChange: (l) => {
|
|
93
|
+
const P = o.find((I) => I.label === l);
|
|
94
|
+
P && u?.(P.date());
|
|
95
|
+
},
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ e(
|
|
98
|
+
E,
|
|
99
|
+
{
|
|
100
|
+
className: "w-full",
|
|
101
|
+
dataHook: `${r}-preset-select`,
|
|
102
|
+
children: /* @__PURE__ */ e(L, { placeholder: p })
|
|
103
|
+
}
|
|
64
104
|
),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
105
|
+
/* @__PURE__ */ e(M, { children: o.map((l) => /* @__PURE__ */ e(
|
|
106
|
+
O,
|
|
107
|
+
{
|
|
108
|
+
"data-hook": `${r}-preset-${l.label.toLowerCase().replace(/\s+/g, "-")}`,
|
|
109
|
+
value: l.label,
|
|
110
|
+
children: l.label
|
|
111
|
+
},
|
|
112
|
+
l.label
|
|
113
|
+
)) })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
h
|
|
118
|
+
] }) : h })
|
|
119
|
+
] })
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
T.displayName = "DatePicker";
|
|
125
|
+
const V = [
|
|
126
|
+
{
|
|
127
|
+
label: "Today",
|
|
128
|
+
date: () => /* @__PURE__ */ new Date()
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
label: "Tomorrow",
|
|
132
|
+
date: () => {
|
|
133
|
+
const t = /* @__PURE__ */ new Date();
|
|
134
|
+
return t.setDate(t.getDate() + 1), t;
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
label: "In 3 days",
|
|
139
|
+
date: () => {
|
|
140
|
+
const t = /* @__PURE__ */ new Date();
|
|
141
|
+
return t.setDate(t.getDate() + 3), t;
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
label: "In a week",
|
|
146
|
+
date: () => {
|
|
147
|
+
const t = /* @__PURE__ */ new Date();
|
|
148
|
+
return t.setDate(t.getDate() + 7), t;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
], z = m.forwardRef(({ presets: t = V, ...r }, s) => /* @__PURE__ */ e(T, { ref: s, presets: t, ...r }));
|
|
152
|
+
z.displayName = "DatePickerPreset";
|
|
153
|
+
const R = m.forwardRef(
|
|
154
|
+
({
|
|
155
|
+
className: t,
|
|
156
|
+
dataHook: r,
|
|
157
|
+
trackingEl: s,
|
|
158
|
+
trackingLabel: D,
|
|
159
|
+
dateRange: a,
|
|
160
|
+
onDateRangeChange: u,
|
|
161
|
+
placeholder: p = "Pick a date range",
|
|
162
|
+
disabled: n,
|
|
163
|
+
dateFormat: d = "PP",
|
|
164
|
+
numberOfMonths: o = 2,
|
|
165
|
+
id: b,
|
|
166
|
+
...f
|
|
167
|
+
}, k) => {
|
|
168
|
+
const [x, g] = m.useState(!1), h = () => a?.from ? a.to ? `${w(a.from, d)} - ${w(a.to, d)}` : w(a.from, d) : null;
|
|
169
|
+
return /* @__PURE__ */ e(
|
|
170
|
+
"div",
|
|
171
|
+
{
|
|
172
|
+
ref: k,
|
|
173
|
+
className: c("flex w-full flex-col gap-2", t),
|
|
174
|
+
"data-hook": r,
|
|
175
|
+
"data-slot": "date-picker-range",
|
|
176
|
+
"data-tracking-el": s || "date-picker-range",
|
|
177
|
+
"data-tracking-label": D,
|
|
178
|
+
...f,
|
|
179
|
+
children: /* @__PURE__ */ i(y, { open: x, onOpenChange: g, children: [
|
|
180
|
+
/* @__PURE__ */ e(C, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "relative flex w-full items-center", children: [
|
|
181
|
+
/* @__PURE__ */ e(
|
|
182
|
+
N,
|
|
183
|
+
{
|
|
184
|
+
className: c(
|
|
185
|
+
"text-muted-foreground pointer-events-none absolute left-3 flex size-4 items-center",
|
|
186
|
+
n && "opacity-50"
|
|
187
|
+
),
|
|
188
|
+
"data-slot": "calendar-icon"
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ e(
|
|
192
|
+
"button",
|
|
75
193
|
{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
194
|
+
"aria-label": f["aria-label"] ?? "Select date range",
|
|
195
|
+
className: c(
|
|
196
|
+
v({ hasIcon: !0 }),
|
|
197
|
+
"cursor-pointer justify-start text-left",
|
|
198
|
+
!a?.from && "text-muted-foreground"
|
|
199
|
+
),
|
|
200
|
+
"data-hook": `${r}-trigger`,
|
|
201
|
+
"data-slot": "date-picker-trigger",
|
|
202
|
+
disabled: n,
|
|
203
|
+
id: b,
|
|
204
|
+
type: "button",
|
|
205
|
+
children: h() || /* @__PURE__ */ e("span", { children: p })
|
|
84
206
|
}
|
|
85
|
-
)
|
|
86
|
-
] })
|
|
87
|
-
|
|
207
|
+
)
|
|
208
|
+
] }) }),
|
|
209
|
+
/* @__PURE__ */ e($, { align: "start", className: "w-auto rounded-lg p-0", children: /* @__PURE__ */ e(
|
|
210
|
+
S,
|
|
211
|
+
{
|
|
212
|
+
captionLayout: "dropdown",
|
|
213
|
+
className: "border-0 shadow-none",
|
|
214
|
+
dataHook: `${r}-calendar`,
|
|
215
|
+
disabled: n,
|
|
216
|
+
endMonth: new Date(2100, 11, 31),
|
|
217
|
+
mode: "range",
|
|
218
|
+
numberOfMonths: o,
|
|
219
|
+
selected: a,
|
|
220
|
+
startMonth: new Date(1900, 0, 1),
|
|
221
|
+
onSelect: u
|
|
222
|
+
}
|
|
223
|
+
) })
|
|
224
|
+
] })
|
|
88
225
|
}
|
|
89
226
|
);
|
|
90
227
|
}
|
|
91
228
|
);
|
|
92
|
-
|
|
229
|
+
R.displayName = "DatePickerRange";
|
|
93
230
|
export {
|
|
94
|
-
|
|
231
|
+
T as DatePicker,
|
|
232
|
+
z as DatePickerPreset,
|
|
233
|
+
R as DatePickerRange
|
|
95
234
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),s=require("react"),u=require("@brightlocal/ui-components/lib/utils");function l(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const d=l(s),a=d.forwardRef(({className:e,dataHook:r,trackingEl:t,trackingLabel:n,...o},i)=>c.jsx("p",{ref:i,className:u.cn("text-muted-foreground text-left text-sm","[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",e),"data-hook":r,"data-slot":"description","data-tracking-el":t||"description","data-tracking-label":n,...o}));a.displayName="Description";exports.Description=a;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Props for the Description component
|
|
4
|
+
*/
|
|
5
|
+
interface DescriptionProps extends React.ComponentProps<"p"> {
|
|
6
|
+
/**
|
|
7
|
+
* Data hook for automated testing
|
|
8
|
+
* Used to identify component in tests and E2E automation
|
|
9
|
+
*/
|
|
10
|
+
dataHook?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Tracking element identifier for analytics
|
|
13
|
+
* Defaults to "description" if not provided
|
|
14
|
+
*/
|
|
15
|
+
trackingEl?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Tracking label for analytics context
|
|
18
|
+
* Additional context for tracking events
|
|
19
|
+
*/
|
|
20
|
+
trackingLabel?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Base description component for displaying helper text
|
|
24
|
+
*
|
|
25
|
+
* Use this for simple descriptive text. For form fields,
|
|
26
|
+
* use FieldDescription which adds form-specific styles.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <Description dataHook="help-text">
|
|
31
|
+
* This is a helpful description
|
|
32
|
+
* </Description>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare const Description: React.ForwardRefExoticComponent<Omit<DescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
36
|
+
export { Description, type DescriptionProps };
|
|
37
|
+
//# sourceMappingURL=description.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.d.ts","sourceRoot":"","sources":["../../src/components/description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;GAEG;AACH,UAAU,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC;IAC1D;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,WAAW,4GAkBhB,CAAC;AAIF,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { cn as d } from "@brightlocal/ui-components/lib/utils";
|
|
4
|
+
const m = s.forwardRef(
|
|
5
|
+
({ className: t, dataHook: e, trackingEl: r, trackingLabel: a, ...o }, i) => /* @__PURE__ */ n(
|
|
6
|
+
"p",
|
|
7
|
+
{
|
|
8
|
+
ref: i,
|
|
9
|
+
className: d(
|
|
10
|
+
"text-muted-foreground text-left text-sm",
|
|
11
|
+
"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
|
|
12
|
+
t
|
|
13
|
+
),
|
|
14
|
+
"data-hook": e,
|
|
15
|
+
"data-slot": "description",
|
|
16
|
+
"data-tracking-el": r || "description",
|
|
17
|
+
"data-tracking-label": a,
|
|
18
|
+
...o
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
m.displayName = "Description";
|
|
23
|
+
export {
|
|
24
|
+
m as Description
|
|
25
|
+
};
|
package/dist/dialog.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"),v=require("react"),w=require("@radix-ui/react-dialog"),h=require("@brightlocal/icons"),l=require("@brightlocal/ui-components/lib/utils");function c(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 i=c(v),s=c(w),g=s.Root;g.displayName="Dialog";const f=i.forwardRef(({dataHook:e,...a},t)=>o.jsx(s.Trigger,{ref:t,"data-hook":e,"data-slot":"dialog-trigger",...a}));f.displayName="DialogTrigger";function n({...e}){return o.jsx(s.Portal,{...e})}n.displayName="DialogPortal";const u=i.forwardRef(({...e},a)=>o.jsx(s.Close,{ref:a,"data-slot":"dialog-close",...e}));u.displayName="DialogClose";const d=i.forwardRef(({className:e,...a},t)=>o.jsx(s.Overlay,{ref:t,className:l.cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),"data-slot":"dialog-overlay",...a}));d.displayName="DialogOverlay";const m=i.forwardRef(({className:e,children:a,dataHook:t,trackingEl:r,trackingLabel:b,...j},N)=>o.jsxs(n,{children:[o.jsx(d,{}),o.jsxs(s.Content,{ref:N,className:l.cn("bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-card-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border p-8 shadow-lg duration-200 sm:max-w-lg",e),"data-hook":t,"data-slot":"dialog-content","data-tracking-el":r,"data-tracking-label":b,...j,children:[a,o.jsxs(s.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-8 right-8 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o.jsx(h.XIcon,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));m.displayName="DialogContent";const p=i.forwardRef(({className:e,...a},t)=>o.jsx("div",{ref:t,className:l.cn("flex flex-col gap-2 text-center sm:text-left",e),"data-slot":"dialog-header",...a}));p.displayName="DialogHeader";const D=i.forwardRef(({className:e,...a},t)=>o.jsx("div",{ref:t,className:l.cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),"data-slot":"dialog-footer",...a}));D.displayName="DialogFooter";const x=i.forwardRef(({className:e,...a},t)=>o.jsx(s.Title,{ref:t,className:l.cn("text-lg leading-none font-semibold",e),"data-slot":"dialog-title",...a}));x.displayName="DialogTitle";const y=i.forwardRef(({className:e,...a},t)=>o.jsx(s.Description,{ref:t,className:l.cn("text-muted-foreground text-sm",e),"data-slot":"dialog-description",...a}));y.displayName="DialogDescription";exports.Dialog=g;exports.DialogClose=u;exports.DialogContent=m;exports.DialogDescription=y;exports.DialogFooter=D;exports.DialogHeader=p;exports.DialogOverlay=d;exports.DialogPortal=n;exports.DialogTitle=x;exports.DialogTrigger=f;
|
package/dist/dialog.d.ts
CHANGED
|
@@ -1,20 +1,84 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Dialog - Root component for modal dialogs
|
|
5
|
+
* @description Wraps content in a modal dialog that overlays the main content
|
|
6
|
+
*/
|
|
7
|
+
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
|
8
|
+
/**
|
|
9
|
+
* Props for DialogTrigger component
|
|
10
|
+
*/
|
|
11
|
+
interface DialogTriggerProps extends React.ComponentProps<typeof DialogPrimitive.Trigger> {
|
|
12
|
+
/**
|
|
13
|
+
* Data hook for automated testing
|
|
14
|
+
*/
|
|
15
|
+
dataHook?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* DialogTrigger - Button or element that opens the dialog
|
|
19
|
+
* @description Wraps an interactive element that toggles the dialog open state
|
|
20
|
+
*/
|
|
21
|
+
declare const DialogTrigger: React.ForwardRefExoticComponent<Omit<DialogTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
/**
|
|
23
|
+
* DialogPortal - Portal for rendering dialog outside of DOM hierarchy
|
|
24
|
+
* @description Renders dialog content in a React portal
|
|
25
|
+
*/
|
|
5
26
|
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
declare
|
|
7
|
-
|
|
27
|
+
declare namespace DialogPortal {
|
|
28
|
+
var displayName: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* DialogClose - Button or element that closes the dialog
|
|
32
|
+
* @description Wraps an element that closes the dialog when clicked
|
|
33
|
+
*/
|
|
34
|
+
declare const DialogClose: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
35
|
+
/**
|
|
36
|
+
* DialogOverlay - Semi-transparent backdrop behind the dialog
|
|
37
|
+
* @description Renders a backdrop that dims the page content
|
|
38
|
+
*/
|
|
39
|
+
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
/**
|
|
41
|
+
* Props for DialogContent component
|
|
42
|
+
*/
|
|
8
43
|
interface DialogContentProps extends React.ComponentProps<typeof DialogPrimitive.Content> {
|
|
44
|
+
/**
|
|
45
|
+
* Data hook for automated testing (required)
|
|
46
|
+
*/
|
|
9
47
|
dataHook?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Tracking element identifier for analytics
|
|
50
|
+
*/
|
|
10
51
|
trackingEl?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Tracking label for analytics context
|
|
54
|
+
*/
|
|
11
55
|
trackingLabel?: string;
|
|
12
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* DialogContent - The main dialog content container
|
|
59
|
+
* @description Contains the dialog's content including header, body, and footer
|
|
60
|
+
*/
|
|
13
61
|
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
62
|
+
/**
|
|
63
|
+
* DialogHeader - Container for dialog title and description
|
|
64
|
+
* @description Groups the title and description at the top of the dialog
|
|
65
|
+
*/
|
|
66
|
+
declare const DialogHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
/**
|
|
68
|
+
* DialogFooter - Container for dialog action buttons
|
|
69
|
+
* @description Groups action buttons at the bottom of the dialog
|
|
70
|
+
*/
|
|
71
|
+
declare const DialogFooter: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
72
|
+
/**
|
|
73
|
+
* DialogTitle - The title of the dialog
|
|
74
|
+
* @description Renders an accessible title for the dialog
|
|
75
|
+
*/
|
|
76
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
77
|
+
/**
|
|
78
|
+
* DialogDescription - The description of the dialog
|
|
79
|
+
* @description Renders an accessible description for the dialog
|
|
80
|
+
*/
|
|
81
|
+
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
18
82
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
19
|
-
export type { DialogContentProps };
|
|
83
|
+
export type { DialogContentProps, DialogTriggerProps };
|
|
20
84
|
//# sourceMappingURL=dialog.d.ts.map
|
package/dist/dialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAK1D,
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAK1D;;;GAGG;AACH,QAAA,MAAM,MAAM,uCAAuB,CAAC;AAGpC;;GAEG;AACH,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CACvD,OAAO,eAAe,CAAC,OAAO,CAC/B;IACC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,QAAA,MAAM,aAAa,2GAUjB,CAAC;AAGH;;;GAGG;AACH,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,2CAErD;kBAJQ,YAAY;;;AAOrB;;;GAGG;AACH,QAAA,MAAM,WAAW,kKAKf,CAAC;AAGH;;;GAGG;AACH,QAAA,MAAM,aAAa,8JAajB,CAAC;AAGH;;GAEG;AACH,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CACvD,OAAO,eAAe,CAAC,OAAO,CAC/B;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;;;GAGG;AACH,QAAA,MAAM,aAAa,wGA6BlB,CAAC;AAGF;;;GAGG;AACH,QAAA,MAAM,YAAY,mKAUhB,CAAC;AAGH;;;GAGG;AACH,QAAA,MAAM,YAAY,mKAahB,CAAC;AAGH;;;GAGG;AACH,QAAA,MAAM,WAAW,oKAUf,CAAC;AAGH;;;GAGG;AACH,QAAA,MAAM,iBAAiB,8KAUrB,CAAC;AAGH,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC;AAEF,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC"}
|