@cognite/aura 0.3.2 → 0.3.3
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/DESIGN.md +134 -5
- package/README.md +24 -3
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +58 -327
- package/dist/components/ui/core/accordion/accordion.js +79 -114
- package/dist/components/ui/core/action-toolbar/action-toolbar.js +108 -176
- package/dist/components/ui/core/alert/alert.js +158 -206
- package/dist/components/ui/core/avatar/avatar.js +64 -90
- package/dist/components/ui/core/badge/badge.js +73 -108
- package/dist/components/ui/core/banner/banner.js +146 -215
- package/dist/components/ui/core/breadcrumb/breadcrumb.js +105 -200
- package/dist/components/ui/core/button/button.js +47 -52
- package/dist/components/ui/core/button-group/button-group.js +40 -79
- package/dist/components/ui/core/card/card.js +102 -185
- package/dist/components/ui/core/chart/chart.js +116 -206
- package/dist/components/ui/core/chart/index.js +2 -8
- package/dist/components/ui/core/checkbox/checkbox.js +67 -132
- package/dist/components/ui/core/checkbox/checkbox.metadata.js +7 -7
- package/dist/components/ui/core/code-block/code-block.d.ts +1 -1
- package/dist/components/ui/core/code-block/code-block.js +179 -267
- package/dist/components/ui/core/collapsible/collapsible.js +29 -49
- package/dist/components/ui/core/combobox/combobox.js +41 -0
- package/dist/components/ui/core/command/command.js +85 -150
- package/dist/components/ui/core/count/count.js +21 -32
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +60 -72
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +36 -51
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +63 -87
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +60 -68
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +118 -174
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +104 -145
- package/dist/components/ui/core/date-time-pickers/index.js +5 -10
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +42 -56
- package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +66 -117
- package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.js +63 -93
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +64 -98
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +38 -67
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +23 -23
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +52 -62
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +18 -18
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +24 -31
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +24 -33
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +4 -7
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +17 -31
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +40 -40
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +33 -50
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +78 -99
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +41 -63
- package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +39 -52
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +7 -15
- package/dist/components/ui/core/dialog/dialog.js +82 -155
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +2 -2
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +150 -248
- package/dist/components/ui/core/empty-state/empty-state.context.js +5 -8
- package/dist/components/ui/core/empty-state/empty-state.js +86 -138
- package/dist/components/ui/core/helper-text/helper-text.js +37 -65
- package/dist/components/ui/core/hover-card/hover-card.js +54 -80
- package/dist/components/ui/core/inline-citation/inline-citation.js +98 -181
- package/dist/components/ui/core/input/input.js +12 -27
- package/dist/components/ui/core/input-group/input-group.js +76 -173
- package/dist/components/ui/core/kbd/kbd.js +20 -36
- package/dist/components/ui/core/label/label.js +26 -43
- package/dist/components/ui/core/loader/loader.js +80 -117
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +12 -12
- package/dist/components/ui/core/message/message.d.ts +2 -2
- package/dist/components/ui/core/message/message.js +316 -542
- package/dist/components/ui/core/pagination/pagination-size-context.js +5 -6
- package/dist/components/ui/core/pagination/pagination-teleport.js +86 -106
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
- package/dist/components/ui/core/pagination/pagination.js +231 -334
- package/dist/components/ui/core/popover/popover.js +90 -157
- package/dist/components/ui/core/progress/progress.js +36 -61
- package/dist/components/ui/core/prompt-input/prompt-input.js +274 -413
- package/dist/components/ui/core/radio-group/radio-group.js +58 -113
- package/dist/components/ui/core/reasoning/reasoning.js +55 -86
- package/dist/components/ui/core/scroll-area/scroll-area.js +41 -71
- package/dist/components/ui/core/search/search.js +77 -99
- package/dist/components/ui/core/segmented-control/segmented-control.js +110 -167
- package/dist/components/ui/core/select/select.js +168 -293
- package/dist/components/ui/core/separator/separator.js +13 -23
- package/dist/components/ui/core/shimmer/shimmer.d.ts +2 -4
- package/dist/components/ui/core/shimmer/shimmer.js +40 -107
- package/dist/components/ui/core/skeleton/skeleton.js +13 -18
- package/dist/components/ui/core/sonner-toast/sonner-toast.js +54 -47
- package/dist/components/ui/core/sources/sources.d.ts +5 -1
- package/dist/components/ui/core/sources/sources.js +58 -79
- package/dist/components/ui/core/switch/switch.js +62 -0
- package/dist/components/ui/core/tabs/tabs.js +149 -223
- package/dist/components/ui/core/tabs/tabs.utils.js +6 -8
- package/dist/components/ui/core/textarea/textarea.js +13 -27
- package/dist/components/ui/core/toggle/toggle.js +55 -74
- package/dist/components/ui/core/tool/tool.js +127 -163
- package/dist/components/ui/core/tooltip/tooltip.js +47 -86
- package/dist/components/ui/core/topbar/topbar.js +106 -190
- package/dist/eslint/index.js +5 -10
- package/dist/eslint/no-overriding-styles.js +178 -237
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/lib/highlight-code.d.ts +9 -0
- package/dist/lib/highlight-code.js +42 -0
- package/dist/lib/portal-container-context.js +8 -9
- package/dist/lib/style-scope.js +6 -6
- package/dist/lib/use-controllable-state.js +21 -30
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.js +32 -112
- package/dist/styles.css +1 -1
- package/dist/styles.source.css +23 -0
- package/package.json +23 -7
- package/dist/components/ui/core/date-time-pickers/shared/constants.js +0 -14
|
@@ -1,93 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import i from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}) => /* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
items: M.map((o, f) => ({ value: f, label: o })),
|
|
65
|
-
onSelect: (o) => n(r.date(1).month(o))
|
|
66
|
-
}
|
|
67
|
-
),
|
|
68
|
-
/* @__PURE__ */ e(
|
|
69
|
-
d,
|
|
70
|
-
{
|
|
71
|
-
label: r.format("YYYY"),
|
|
72
|
-
items: z.map((o) => ({ value: o, label: String(o) })),
|
|
73
|
-
onSelect: (o) => n(r.date(1).year(o))
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
] }),
|
|
77
|
-
/* @__PURE__ */ e(
|
|
78
|
-
l,
|
|
79
|
-
{
|
|
80
|
-
variant: "ghost",
|
|
81
|
-
size: "icon-sm",
|
|
82
|
-
className: "size-7 rounded-md text-secondary-foreground",
|
|
83
|
-
onClick: s,
|
|
84
|
-
"aria-label": "Next month",
|
|
85
|
-
children: /* @__PURE__ */ e(u, { className: "size-4" })
|
|
86
|
-
}
|
|
87
|
-
)
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
export {
|
|
92
|
-
E as CalendarHeader
|
|
93
|
-
};
|
|
1
|
+
import { cn as e } from "../../../../../../lib/utils.js";
|
|
2
|
+
import { Button as t } from "../../../button/button.js";
|
|
3
|
+
import { DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuTrigger as a } from "../../../dropdown-menu/dropdown-menu.js";
|
|
4
|
+
import { IconChevronDown as o, IconChevronLeft as s, IconChevronRight as c } from "@tabler/icons-react";
|
|
5
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
|
+
import d from "dayjs";
|
|
7
|
+
//#region libs/aura/src/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.tsx
|
|
8
|
+
var f = Array.from({ length: 12 }, (e, t) => d().month(t).format("MMMM")), p = d().year() - 50, m = d().year() + 10, h = Array.from({ length: m - p + 1 }, (e, t) => p + t), g = ({ label: e, items: s, onSelect: c }) => /* @__PURE__ */ u(n, {
|
|
9
|
+
modal: !1,
|
|
10
|
+
children: [/* @__PURE__ */ l(a, { render: /* @__PURE__ */ u(t, {
|
|
11
|
+
variant: "ghost",
|
|
12
|
+
size: "sm",
|
|
13
|
+
className: "h-7 px-2 gap-1 text-sm font-medium text-secondary-foreground",
|
|
14
|
+
children: [e, /* @__PURE__ */ l(o, { className: "size-4" })]
|
|
15
|
+
}) }), /* @__PURE__ */ l(r, {
|
|
16
|
+
className: "max-h-60 overflow-y-auto",
|
|
17
|
+
children: s.map(({ value: e, label: t }) => /* @__PURE__ */ l(i, {
|
|
18
|
+
onClick: () => c(e),
|
|
19
|
+
children: t
|
|
20
|
+
}, e))
|
|
21
|
+
})]
|
|
22
|
+
}), _ = ({ displayedMonth: n, onPrevMonth: r, onNextMonth: i, onMonthChange: a, className: o }) => /* @__PURE__ */ u("div", {
|
|
23
|
+
"data-slot": "calendar-header",
|
|
24
|
+
className: e("flex items-center justify-between pt-1 w-full", o),
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ l(t, {
|
|
27
|
+
variant: "ghost",
|
|
28
|
+
size: "icon-sm",
|
|
29
|
+
className: "size-7 rounded-md text-secondary-foreground",
|
|
30
|
+
onClick: r,
|
|
31
|
+
"aria-label": "Previous month",
|
|
32
|
+
children: /* @__PURE__ */ l(s, { className: "size-4" })
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ u("div", {
|
|
35
|
+
className: "flex items-center gap-0.5",
|
|
36
|
+
children: [/* @__PURE__ */ l(g, {
|
|
37
|
+
label: n.format("MMMM"),
|
|
38
|
+
items: f.map((e, t) => ({
|
|
39
|
+
value: t,
|
|
40
|
+
label: e
|
|
41
|
+
})),
|
|
42
|
+
onSelect: (e) => a(n.date(1).month(e))
|
|
43
|
+
}), /* @__PURE__ */ l(g, {
|
|
44
|
+
label: n.format("YYYY"),
|
|
45
|
+
items: h.map((e) => ({
|
|
46
|
+
value: e,
|
|
47
|
+
label: String(e)
|
|
48
|
+
})),
|
|
49
|
+
onSelect: (e) => a(n.date(1).year(e))
|
|
50
|
+
})]
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ l(t, {
|
|
53
|
+
variant: "ghost",
|
|
54
|
+
size: "icon-sm",
|
|
55
|
+
className: "size-7 rounded-md text-secondary-foreground",
|
|
56
|
+
onClick: i,
|
|
57
|
+
"aria-label": "Next month",
|
|
58
|
+
children: /* @__PURE__ */ l(c, { className: "size-4" })
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
//#endregion
|
|
63
|
+
export { _ as CalendarHeader };
|
|
@@ -1,99 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return /* @__PURE__ */ u(
|
|
64
|
-
"div",
|
|
65
|
-
{
|
|
66
|
-
"data-slot": "date-time-input",
|
|
67
|
-
className: a(
|
|
68
|
-
"relative flex items-center cursor-pointer w-full group",
|
|
69
|
-
i
|
|
70
|
-
),
|
|
71
|
-
onClick: n,
|
|
72
|
-
children: [
|
|
73
|
-
/* @__PURE__ */ r(
|
|
74
|
-
D,
|
|
75
|
-
{
|
|
76
|
-
value: d,
|
|
77
|
-
placeholder: h,
|
|
78
|
-
onChange: C,
|
|
79
|
-
"aria-label": l,
|
|
80
|
-
"aria-expanded": t,
|
|
81
|
-
"aria-controls": c,
|
|
82
|
-
role: "combobox",
|
|
83
|
-
className: a(
|
|
84
|
-
"border-transparent bg-muted-background cursor-pointer caret-transparent pr-9",
|
|
85
|
-
m ? "text-foreground" : "text-muted-foreground",
|
|
86
|
-
"hover:border-border-emphasized",
|
|
87
|
-
t && "!bg-background !text-foreground !border-border"
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
),
|
|
91
|
-
/* @__PURE__ */ r("div", { className: g(t, m), children: p[s] })
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
);
|
|
95
|
-
};
|
|
96
|
-
export {
|
|
97
|
-
v as DEFAULT_ARIA_LABEL,
|
|
98
|
-
_ as DateTimeInput
|
|
1
|
+
import { cn as e } from "../../../../../../lib/utils.js";
|
|
2
|
+
import { Input as t } from "../../../input/input.js";
|
|
3
|
+
import { RangeInputDisplay as n } from "./range-input-display.js";
|
|
4
|
+
import { IconCalendar as r, IconCalendarClock as i, IconClock as a } from "@tabler/icons-react";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
//#region libs/aura/src/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.tsx
|
|
7
|
+
var c = "Date picker", l = () => void 0, u = {
|
|
8
|
+
date: /* @__PURE__ */ o(r, {
|
|
9
|
+
"aria-label": "date-icon",
|
|
10
|
+
className: "size-4"
|
|
11
|
+
}),
|
|
12
|
+
time: /* @__PURE__ */ o(a, {
|
|
13
|
+
"aria-label": "time-icon",
|
|
14
|
+
className: "size-4"
|
|
15
|
+
}),
|
|
16
|
+
datetime: /* @__PURE__ */ o(i, {
|
|
17
|
+
"aria-label": "datetime-icon",
|
|
18
|
+
className: "size-4"
|
|
19
|
+
})
|
|
20
|
+
}, d = (t, n) => e("absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none", "flex items-center justify-center", "transition-colors duration-150", n || t ? "text-foreground" : "text-muted-foreground", "group-hover:text-foreground"), f = ({ value: r, format: i, placeholder: a, onClick: f, isOpen: p, className: m, ariaLabel: h = c, variant: g = "date", activeRangePart: _, onRangePartClick: v, popoverId: y }) => {
|
|
21
|
+
if (Array.isArray(r)) {
|
|
22
|
+
let t = r[0] !== null || r[1] !== null;
|
|
23
|
+
return /* @__PURE__ */ s("div", {
|
|
24
|
+
"data-slot": "date-time-input",
|
|
25
|
+
className: e("relative flex items-center cursor-pointer w-full group", m),
|
|
26
|
+
role: "combobox",
|
|
27
|
+
"aria-label": h,
|
|
28
|
+
"aria-expanded": p,
|
|
29
|
+
"aria-controls": y,
|
|
30
|
+
onClick: f,
|
|
31
|
+
children: [/* @__PURE__ */ o(n, {
|
|
32
|
+
startDate: r[0],
|
|
33
|
+
endDate: r[1],
|
|
34
|
+
format: i,
|
|
35
|
+
activeRangePart: _,
|
|
36
|
+
onRangePartClick: v,
|
|
37
|
+
isOpen: p
|
|
38
|
+
}), /* @__PURE__ */ o("div", {
|
|
39
|
+
className: d(p, t),
|
|
40
|
+
children: u[g]
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
let b = r?.format(i) ?? "", x = b.length > 0, S = a ?? i;
|
|
45
|
+
return /* @__PURE__ */ s("div", {
|
|
46
|
+
"data-slot": "date-time-input",
|
|
47
|
+
className: e("relative flex items-center cursor-pointer w-full group", m),
|
|
48
|
+
onClick: f,
|
|
49
|
+
children: [/* @__PURE__ */ o(t, {
|
|
50
|
+
value: b,
|
|
51
|
+
placeholder: S,
|
|
52
|
+
onChange: l,
|
|
53
|
+
"aria-label": h,
|
|
54
|
+
"aria-expanded": p,
|
|
55
|
+
"aria-controls": y,
|
|
56
|
+
role: "combobox",
|
|
57
|
+
className: e("border-transparent bg-muted-background cursor-pointer caret-transparent pr-9", x ? "text-foreground" : "text-muted-foreground", "hover:border-border-emphasized", p && "!bg-background !text-foreground !border-border")
|
|
58
|
+
}), /* @__PURE__ */ o("div", {
|
|
59
|
+
className: d(p, x),
|
|
60
|
+
children: u[g]
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
99
63
|
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { c as DEFAULT_ARIA_LABEL, f as DateTimeInput };
|
package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js
CHANGED
|
@@ -1,68 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
-
children: d ? d.format(e) : /* @__PURE__ */ o("span", { className: i, children: e })
|
|
38
|
-
}
|
|
39
|
-
),
|
|
40
|
-
/* @__PURE__ */ o(
|
|
41
|
-
"span",
|
|
42
|
-
{
|
|
43
|
-
className: n(
|
|
44
|
-
"select-none transition-colors duration-150",
|
|
45
|
-
u ? "text-foreground" : "text-muted-foreground group-hover:text-foreground"
|
|
46
|
-
),
|
|
47
|
-
children: " – "
|
|
48
|
-
}
|
|
49
|
-
),
|
|
50
|
-
/* @__PURE__ */ o(
|
|
51
|
-
"span",
|
|
52
|
-
{
|
|
53
|
-
className: n(
|
|
54
|
-
a,
|
|
55
|
-
r ? "cursor-pointer" : "cursor-default",
|
|
56
|
-
s === "end" ? "bg-active-muted-background" : r && "hover:bg-active-muted-background-hover"
|
|
57
|
-
),
|
|
58
|
-
onClick: c("end"),
|
|
59
|
-
children: t ? t.format(e) : /* @__PURE__ */ o("span", { className: i, children: e })
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
export {
|
|
67
|
-
x as RangeInputDisplay
|
|
1
|
+
import { cn as e } from "../../../../../../lib/utils.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region libs/aura/src/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.tsx
|
|
4
|
+
var r = "px-1 py-0.5 rounded-sm transition-colors duration-150", i = "text-muted-foreground group-hover:text-foreground transition-colors duration-150", a = ({ startDate: a, endDate: o, format: s, activeRangePart: c, onRangePartClick: l, isOpen: u }) => {
|
|
5
|
+
let d = a !== null || o !== null, f = (e) => (t) => {
|
|
6
|
+
l && (t.stopPropagation(), l(e));
|
|
7
|
+
};
|
|
8
|
+
return /* @__PURE__ */ n("div", {
|
|
9
|
+
className: e("flex items-center w-full py-1 px-3 pr-9 border rounded-lg", "text-sm leading-5 h-9 box-border whitespace-nowrap overflow-hidden", "transition-[background,border-color,color,box-shadow] duration-150", u ? "bg-background text-foreground border-border shadow-focus-ring" : [
|
|
10
|
+
"bg-muted-background border-transparent",
|
|
11
|
+
"hover:bg-accent-background hover:text-foreground hover:border-border-emphasized",
|
|
12
|
+
d ? "text-foreground" : "text-muted-foreground"
|
|
13
|
+
]),
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ t("span", {
|
|
16
|
+
className: e(r, l ? "cursor-pointer" : "cursor-default", c === "start" ? "bg-active-muted-background" : l && "hover:bg-active-muted-background-hover"),
|
|
17
|
+
onClick: f("start"),
|
|
18
|
+
children: a ? a.format(s) : /* @__PURE__ */ t("span", {
|
|
19
|
+
className: i,
|
|
20
|
+
children: s
|
|
21
|
+
})
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ t("span", {
|
|
24
|
+
className: e("select-none transition-colors duration-150", d ? "text-foreground" : "text-muted-foreground group-hover:text-foreground"),
|
|
25
|
+
children: " – "
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ t("span", {
|
|
28
|
+
className: e(r, l ? "cursor-pointer" : "cursor-default", c === "end" ? "bg-active-muted-background" : l && "hover:bg-active-muted-background-hover"),
|
|
29
|
+
onClick: f("end"),
|
|
30
|
+
children: o ? o.format(s) : /* @__PURE__ */ t("span", {
|
|
31
|
+
className: i,
|
|
32
|
+
children: s
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
});
|
|
68
37
|
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { a as RangeInputDisplay };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
m as usePopoverState
|
|
1
|
+
import { useEffect as e, useRef as t, useState as n } from "react";
|
|
2
|
+
//#region libs/aura/src/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.ts
|
|
3
|
+
var r = (r = {}) => {
|
|
4
|
+
let { onBackspace: i } = r, [a, o] = n(!1), s = t(null), c = t(null);
|
|
5
|
+
return e(() => {
|
|
6
|
+
if (!a) return;
|
|
7
|
+
let e = (e) => {
|
|
8
|
+
if (e.key === "Backspace" && i) {
|
|
9
|
+
let { target: t } = e;
|
|
10
|
+
t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLElement && t.isContentEditable || (e.preventDefault(), i());
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
return document.addEventListener("keydown", e), () => {
|
|
14
|
+
document.removeEventListener("keydown", e);
|
|
15
|
+
};
|
|
16
|
+
}, [a, i]), {
|
|
17
|
+
isOpen: a,
|
|
18
|
+
setIsOpen: o,
|
|
19
|
+
popoverRef: s,
|
|
20
|
+
inputRef: c
|
|
21
|
+
};
|
|
24
22
|
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { r as usePopoverState };
|
|
@@ -1,63 +1,53 @@
|
|
|
1
|
-
import { useCallback as e,
|
|
2
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
displayedMonth: g,
|
|
52
|
-
hoverDate: C,
|
|
53
|
-
stateRef: n,
|
|
54
|
-
handleDateClick: R,
|
|
55
|
-
handleDateHover: k,
|
|
56
|
-
handleMonthChange: D,
|
|
57
|
-
clearActiveSegment: H,
|
|
58
|
-
resetDates: T
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
export {
|
|
62
|
-
A as useRangeDateState
|
|
1
|
+
import { useCallback as e, useRef as t, useState as n } from "react";
|
|
2
|
+
//#region libs/aura/src/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.ts
|
|
3
|
+
var r = ({ value: r, defaultDate: i, mapDate: a, onEndDateSelected: o }) => {
|
|
4
|
+
let s = e((e, t) => a ? a(e, t) : e, [a]), [c, l] = n(r[0]), [u, d] = n(r[1]), [f, p] = n(() => r[0] ?? i), [m, h] = n(null), g = t({
|
|
5
|
+
tempStart: r[0],
|
|
6
|
+
tempEnd: r[1]
|
|
7
|
+
}), _ = e((e) => {
|
|
8
|
+
g.current.tempStart = e, l(e);
|
|
9
|
+
}, []), v = e((e) => {
|
|
10
|
+
g.current.tempEnd = e, d(e);
|
|
11
|
+
}, []);
|
|
12
|
+
return {
|
|
13
|
+
tempStart: c,
|
|
14
|
+
tempEnd: u,
|
|
15
|
+
displayedMonth: f,
|
|
16
|
+
hoverDate: m,
|
|
17
|
+
stateRef: g,
|
|
18
|
+
handleDateClick: e((e, t) => {
|
|
19
|
+
if (t === "start") {
|
|
20
|
+
_(s(e, "start")), v(null), h(null);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
let n = g.current.tempStart;
|
|
24
|
+
if (n && e.isBefore(n, "day")) {
|
|
25
|
+
_(s(e, "start")), v(null), h(null);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let r = s(e, "end");
|
|
29
|
+
v(r), h(null), o?.(g.current.tempStart, r);
|
|
30
|
+
}, [
|
|
31
|
+
s,
|
|
32
|
+
_,
|
|
33
|
+
v,
|
|
34
|
+
o
|
|
35
|
+
]),
|
|
36
|
+
handleDateHover: e((e) => {
|
|
37
|
+
h(e);
|
|
38
|
+
}, []),
|
|
39
|
+
handleMonthChange: e((e) => {
|
|
40
|
+
p(e);
|
|
41
|
+
}, []),
|
|
42
|
+
clearActiveSegment: e((e) => e === "start" ? (_(null), [null, g.current.tempEnd]) : g.current.tempEnd === null ? null : (v(null), [g.current.tempStart, null]), [_, v]),
|
|
43
|
+
resetDates: e((e) => {
|
|
44
|
+
_(e[0]), v(e[1]), h(null), p(e[0] ?? i);
|
|
45
|
+
}, [
|
|
46
|
+
_,
|
|
47
|
+
v,
|
|
48
|
+
i
|
|
49
|
+
])
|
|
50
|
+
};
|
|
63
51
|
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { r as useRangeDateState };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
p as useRangeStepManager
|
|
1
|
+
import { useCallback as e, useState as t } from "react";
|
|
2
|
+
//#region libs/aura/src/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.ts
|
|
3
|
+
var n = () => {
|
|
4
|
+
let [n, r] = t("start");
|
|
5
|
+
return {
|
|
6
|
+
step: n,
|
|
7
|
+
handleNext: e(() => {
|
|
8
|
+
r("end");
|
|
9
|
+
}, []),
|
|
10
|
+
handleBack: e(() => {
|
|
11
|
+
r("start");
|
|
12
|
+
}, []),
|
|
13
|
+
resetStep: e(() => {
|
|
14
|
+
r("start");
|
|
15
|
+
}, [])
|
|
16
|
+
};
|
|
19
17
|
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { n as useRangeStepManager };
|