@datum-cloud/datum-ui 3.7.0 → 3.8.0
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/{action-row-DTvs91_3.mjs → action-row-BEzE9x37.mjs} +2 -3
- package/dist/{adapter-context-h0jCVqGO.mjs → adapter-context-XT749tyT.mjs} +1 -2
- package/dist/alert/index.mjs +1 -2
- package/dist/{alert-SAPwee1h.mjs → alert-CVckvox4.mjs} +2 -3
- package/dist/app-navigation/index.mjs +2 -2
- package/dist/{app-navigation-BB_NLEWv.mjs → app-navigation-DyNZwlSG.mjs} +14 -20
- package/dist/assistant/index.mjs +57 -63
- package/dist/autocomplete/index.mjs +1 -2
- package/dist/{autocomplete-BxtzndxZ.mjs → autocomplete-D0zAcT78.mjs} +6 -8
- package/dist/autosearch/index.mjs +8 -10
- package/dist/avatar/index.mjs +2 -3
- package/dist/avatar-stack/index.mjs +1 -2
- package/dist/{avatar-stack-BUcsjhA6.mjs → avatar-stack-2ow672bR.mjs} +3 -4
- package/dist/badge/index.mjs +181 -1
- package/dist/breadcrumb/index.mjs +1 -2
- package/dist/{breadcrumb-DmdhC8bE.mjs → breadcrumb-D97jAZ2N.mjs} +2 -3
- package/dist/button/index.mjs +2 -2
- package/dist/{button-CsdF61EI.mjs → button-C57mkFkS.mjs} +2 -3
- package/dist/{button-DoMqfQLu.mjs → button-Cn4KagBO.mjs} +4 -6
- package/dist/{button-CDPui_Ov.mjs → button-IK-Lnu_9.mjs} +3 -4
- package/dist/button-group/index.mjs +1 -2
- package/dist/{button-group-DFrTH4L8.mjs → button-group-C3GKo-0p.mjs} +3 -4
- package/dist/calendar/index.mjs +4 -5
- package/dist/{calendar-date-picker-DPvVAW2I.mjs → calendar-date-picker-CknZM6a2.mjs} +3 -4
- package/dist/card/index.mjs +1 -2
- package/dist/{card-save-bar-BZzNnKYj.mjs → card-save-bar-Te8jf-ie.mjs} +5 -8
- package/dist/chart/index.mjs +1 -2
- package/dist/{chart-EgzTS28l.mjs → chart-BsGsx2jb.mjs} +2 -3
- package/dist/checkbox/index.mjs +1 -2
- package/dist/checkbox-BAo5sbHk.mjs +84 -0
- package/dist/{close.icon-DdXKQ4m0.mjs → close.icon-BCPmH4nN.mjs} +2 -3
- package/dist/code-editor/index.mjs +1 -2
- package/dist/{col-BYGWTB4j.mjs → col-CYHIfPJq.mjs} +5 -9
- package/dist/collapsible/index.mjs +1 -7
- package/dist/collapsible-B-KP3JZ-.mjs +104 -0
- package/dist/command/index.mjs +1 -2
- package/dist/{command-C0aGIYnQ.mjs → command-B0be-zU5.mjs} +3 -4
- package/dist/components/base/checkbox/checkbox.d.ts +11 -3
- package/dist/components/base/collapsible/collapsible.d.ts +28 -0
- package/dist/components/base/collapsible/index.d.ts +1 -1
- package/dist/components/base/radio-group/radio-group.d.ts +11 -5
- package/dist/components/base/spinner/index.d.ts +1 -1
- package/dist/components/base/spinner/spinner.d.ts +11 -0
- package/dist/components/base/switch/switch.d.ts +6 -1
- package/dist/components/base/typography/typography.d.ts +1 -1
- package/dist/components/features/_shared/copy-state-icon.d.ts +12 -0
- package/dist/components/features/_shared/index.d.ts +2 -0
- package/dist/components/features/_shared/motion-chip.d.ts +293 -0
- package/dist/components/features/assistant/components/message/plan-card.d.ts +1 -1
- package/dist/components/icons/spinner.icon.d.ts +17 -3
- package/dist/copy-state-icon-DMvXXsZm.mjs +61 -0
- package/dist/data-table/index.mjs +1 -2
- package/dist/{data-table-CJiQQ6TM.mjs → data-table-CpBwO8Ea.mjs} +39 -66
- package/dist/date-picker/index.mjs +3 -3
- package/dist/date-time/index.mjs +1 -2
- package/dist/{date-time-lZdefM4H.mjs → date-time-BBRVM9qb.mjs} +4 -6
- package/dist/date-time-picker/index.mjs +1 -2
- package/dist/{date-time-picker-CricsXgF.mjs → date-time-picker-Bc41Ixrs.mjs} +3 -4
- package/dist/{date-time-range-picker-DM4AIvQ1.mjs → date-time-range-picker-yy1Acntn.mjs} +36 -59
- package/dist/dialog/index.mjs +1 -2
- package/dist/{dialog-Gu70fban.mjs → dialog-C8RXIQYm.mjs} +4 -5
- package/dist/{dialog-CmkrpaYy.mjs → dialog-D6sDXaH6.mjs} +2 -3
- package/dist/dropdown/index.mjs +1 -2
- package/dist/{dropdown-Xvduih96.mjs → dropdown-DR9j3Ni_.mjs} +3 -4
- package/dist/{dropdown-menu-b8zY5Cs6.mjs → dropdown-menu-CjgTr8Ab.mjs} +2 -3
- package/dist/dropzone/index.mjs +1 -2
- package/dist/{dropzone-ihksfjN2.mjs → dropzone-qKYfSe7o.mjs} +6 -8
- package/dist/empty-content/index.mjs +1 -2
- package/dist/{empty-content-CmuVcU0P.mjs → empty-content-CTMHak36.mjs} +8 -13
- package/dist/form/adapters/conform/index.mjs +4 -6
- package/dist/form/adapters/rhf/index.mjs +6 -9
- package/dist/form/index.mjs +2 -2
- package/dist/form/stepper/index.mjs +11 -16
- package/dist/{form-D4R6C609.mjs → form-DTaVgDSV.mjs} +64 -89
- package/dist/{form-context-DzB2a-dw.mjs → form-context-BRzt53M5.mjs} +1 -2
- package/dist/grid/index.mjs +1 -2
- package/dist/grouped-table/index.mjs +1 -2
- package/dist/{grouped-table-fHguJz9W.mjs → grouped-table-Dl6DclbV.mjs} +17 -25
- package/dist/hooks/index.mjs +4 -4
- package/dist/{hooks-CwZ6hyI1.mjs → hooks-WVJbyhCz.mjs} +1 -2
- package/dist/hover-card/index.mjs +1 -2
- package/dist/{hover-card-BNOE5vT5.mjs → hover-card-DSt1lZGg.mjs} +3 -5
- package/dist/{icon-wrapper-DKfJlJd0.mjs → icon-wrapper-CIk2th6R.mjs} +1 -2
- package/dist/icons/index.mjs +3 -3
- package/dist/index.mjs +80 -80
- package/dist/input/index.mjs +1 -2
- package/dist/{input-j4tbmYYz.mjs → input-DsT5qkJn.mjs} +3 -4
- package/dist/{input-DR-XbgpD.mjs → input-Wl1K48ca.mjs} +2 -3
- package/dist/input-group/index.mjs +1 -2
- package/dist/{input-group-DieA8aBt.mjs → input-group-CCzvJIZM.mjs} +5 -6
- package/dist/input-number/index.mjs +1 -2
- package/dist/{input-number-TXmW-X9o.mjs → input-number-DF-bfIo8.mjs} +5 -6
- package/dist/input-with-addons/index.mjs +2 -3
- package/dist/label/index.mjs +1 -2
- package/dist/{label-Bk6FXsju.mjs → label-BR1V3Imy.mjs} +3 -5
- package/dist/{layers-DWYdrGmC.mjs → layers-DLUbkJtt.mjs} +26 -27
- package/dist/loader-overlay/index.mjs +1 -2
- package/dist/{loader-overlay-DD94azZX.mjs → loader-overlay-DP0pvHuG.mjs} +3 -4
- package/dist/logo/index.mjs +2 -2
- package/dist/logo/themed/index.mjs +3 -4
- package/dist/{logo-C3FxD7jb.mjs → logo-CkzKra6H.mjs} +2 -3
- package/dist/{logo-text-Dpm5O6Kg.mjs → logo-text-B54YiEte.mjs} +6 -11
- package/dist/logs/fixtures/index.mjs +2 -4
- package/dist/logs/index.mjs +68 -87
- package/dist/map/index.mjs +1 -2
- package/dist/{map-leaflet-imports-S3kx8Q-S.mjs → map-leaflet-imports-Xdz9Xiaf.mjs} +1 -2
- package/dist/mobile-sheet/index.mjs +1 -2
- package/dist/{mobile-sheet-9TootJGg.mjs → mobile-sheet-1995HYY_.mjs} +6 -9
- package/dist/more-actions/index.mjs +2 -2
- package/dist/{more-actions-C3DYWO0a.mjs → more-actions-BlSOVwa8.mjs} +6 -7
- package/dist/{motion-DvGRWdsm.mjs → motion-DOrRbLmy.mjs} +1 -2
- package/dist/motion-chip-BczV7spP.mjs +52 -0
- package/dist/multi-select/index.mjs +1 -2
- package/dist/{multi-select-CF0Yq5yf.mjs → multi-select-C2cBrqXl.mjs} +61 -57
- package/dist/nprogress/index.mjs +1 -2
- package/dist/page-title/index.mjs +1 -2
- package/dist/{page-title-ipRWEOeM.mjs → page-title-Djl3LvPT.mjs} +2 -3
- package/dist/picker/index.mjs +2 -2
- package/dist/{picker-BoKXW6_s.mjs → picker-DC3GErYg.mjs} +14 -25
- package/dist/popover/index.mjs +1 -2
- package/dist/{popover-X82NwhX9.mjs → popover-7YxyP_W0.mjs} +3 -5
- package/dist/radio-group/index.mjs +1 -2
- package/dist/radio-group-Boxi2hm0.mjs +83 -0
- package/dist/responsive-dropdown/index.mjs +1 -2
- package/dist/{responsive-dropdown-C_KKgLbH.mjs → responsive-dropdown-DsWgpE_i.mjs} +5 -6
- package/dist/responsive-popover/index.mjs +1 -2
- package/dist/{responsive-popover-8VcjBM2d.mjs → responsive-popover-DJYd8lOK.mjs} +5 -6
- package/dist/rich-text-content/index.mjs +1 -2
- package/dist/{rich-text-content-DNonBD39.mjs → rich-text-content-BiIIowBU.mjs} +2 -3
- package/dist/rich-text-editor/index.mjs +2 -2
- package/dist/{rich-text-editor-CP1YyxMR.mjs → rich-text-editor-BUz06s-b.mjs} +14 -22
- package/dist/select/index.mjs +1 -2
- package/dist/{select-D4pk9e2d.mjs → select-DemYhwnG.mjs} +3 -4
- package/dist/{select-daE2Nn0Z.mjs → select-jgK6wyXj.mjs} +2 -3
- package/dist/separator/index.mjs +1 -2
- package/dist/{separator-vbPD_WFQ.mjs → separator-DNiiN2BN.mjs} +2 -3
- package/dist/settings-nav/index.mjs +1 -2
- package/dist/{settings-nav-Hf3GrCGv.mjs → settings-nav-CCZdPD-x.mjs} +2 -3
- package/dist/sheet/index.mjs +2 -2
- package/dist/{sheet-DHn6C_rs.mjs → sheet-DEpEJ_Rk.mjs} +4 -5
- package/dist/{sheet-DXCZyMHI.mjs → sheet-DYPtVIb2.mjs} +2 -3
- package/dist/sidebar/index.mjs +1 -2
- package/dist/{sidebar-sbqOOFii.mjs → sidebar-DWnxQWQ8.mjs} +13 -18
- package/dist/skeleton/index.mjs +3 -4
- package/dist/{skeleton-DFExK4GX.mjs → skeleton-CDPoo7-M.mjs} +2 -3
- package/dist/spinner/index.mjs +1 -2
- package/dist/spinner-DSlDJdWl.mjs +23 -0
- package/dist/spinner.icon-BiUnMAxw.mjs +104 -0
- package/dist/stepper/index.mjs +1 -2
- package/dist/{stepper-dNvkipop.mjs → stepper-ZipxpzWY.mjs} +10 -11
- package/dist/switch/index.mjs +1 -2
- package/dist/switch-IduVwiPZ.mjs +114 -0
- package/dist/table/index.mjs +2 -3
- package/dist/tabs/index.mjs +3 -4
- package/dist/tag-input/index.mjs +1 -2
- package/dist/{tag-input-c9OvWTSe.mjs → tag-input-a3ktkGrH.mjs} +46 -43
- package/dist/task-queue/index.mjs +1 -2
- package/dist/{task-queue-dropdown-CHPP5WIm.mjs → task-queue-dropdown-DuCAAybs.mjs} +39 -59
- package/dist/textarea/index.mjs +1 -2
- package/dist/{textarea-DiSGxCBO.mjs → textarea-CvhdK6JY.mjs} +3 -4
- package/dist/{textarea-CCxpXJdh.mjs → textarea-D36SE4ki.mjs} +2 -3
- package/dist/theme/index.mjs +1 -2
- package/dist/{themes-Ba2bajuF.mjs → themes-BoxnQbbu.mjs} +8 -10
- package/dist/time-picker/index.mjs +1 -2
- package/dist/{time-picker-DQlc2gKW.mjs → time-picker-B_am4eAK.mjs} +3 -4
- package/dist/{to-api-format-QuJ81vQ9.mjs → to-api-format-DyImCzCn.mjs} +15 -23
- package/dist/toast/index.mjs +2 -2
- package/dist/{toast-BUPlDkN3.mjs → toast-CizxCEcK.mjs} +4 -6
- package/dist/tooltip/index.mjs +1 -2
- package/dist/{tooltip-DhbN1BDK.mjs → tooltip-OIySjJWW.mjs} +3 -5
- package/dist/transfer/index.mjs +1 -2
- package/dist/{transfer-DsshYgIk.mjs → transfer-DGUeAQUL.mjs} +8 -14
- package/dist/{types-agDpVXBG.mjs → types-ChINrR8H.mjs} +7 -11
- package/dist/typography/index.mjs +1 -2
- package/dist/{typography-B1bpHKmV.mjs → typography-XFfN6PGD.mjs} +2 -3
- package/dist/{use-breakpoint-CwiUJSmk.mjs → use-breakpoint-zY_JYINK.mjs} +1 -2
- package/dist/{use-controllable-state-Dna7u3r9.mjs → use-controllable-state-DLeVgbAb.mjs} +1 -2
- package/dist/{use-copy-to-clipboard-DZDq_85T.mjs → use-copy-to-clipboard-CWKWHLxI.mjs} +1 -2
- package/dist/{use-debounced-search-input-yu_F0QBt.mjs → use-debounced-search-input-B4u28iLx.mjs} +1 -2
- package/dist/{use-deprecation-warning-DXrGc0jX.mjs → use-deprecation-warning-BS1V4IS5.mjs} +1 -2
- package/dist/{use-display-touched-CMEEv7aT.mjs → use-display-touched-BSq0Ninl.mjs} +3 -5
- package/dist/{use-option-picker-s2bUYwXC.mjs → use-option-picker-DXY2SNnT.mjs} +6 -9
- package/dist/{use-toast-Bpq0yJIT.mjs → use-toast-CZAZeS95.mjs} +3 -5
- package/dist/utils/index.mjs +3 -3
- package/dist/{utils-CA4QEIJ8.mjs → utils-CPJ5MCfd.mjs} +1 -2
- package/dist/{utils-Bu32wN-x.mjs → utils-CTIuhCOs.mjs} +1 -2
- package/dist/visually-hidden/index.mjs +1 -2
- package/dist/{visuallyhidden-D7L_qs8b.mjs → visuallyhidden-Mg4OsZ-l.mjs} +1 -2
- package/dist/{zod-helpers-YEhVo2S-.mjs → zod-helpers-JcfFVJJd.mjs} +1 -2
- package/package.json +20 -23
- package/dist/badge-DOZUr5DV.mjs +0 -183
- package/dist/checkbox-C6P12fio.mjs +0 -30
- package/dist/radio-group-LduBVTnh.mjs +0 -45
- package/dist/spinner-C5Xv-i2C.mjs +0 -14
- package/dist/spinner.icon-BYUMQ8H-.mjs +0 -48
- package/dist/switch-BaR-Vna4.mjs +0 -34
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/features/logs/fixtures/alb_query_range.json
|
|
2
2
|
var alb_query_range_default = {
|
|
3
3
|
status: "success",
|
|
4
4
|
data: {
|
|
@@ -763,8 +763,7 @@ var alb_query_range_default = {
|
|
|
763
763
|
]
|
|
764
764
|
}
|
|
765
765
|
};
|
|
766
|
-
|
|
767
|
-
//#region src/components/features/logs/fixtures/index.ts
|
|
766
|
+
// src/components/features/logs/fixtures/index.ts
|
|
768
767
|
const queryRangeFixture = {
|
|
769
768
|
status: "success",
|
|
770
769
|
data: {
|
|
@@ -994,5 +993,4 @@ const queryRangeFixture = {
|
|
|
994
993
|
};
|
|
995
994
|
/** Staging Envoy OTEL access logs: empty Body, HTTP fields on stream labels. */
|
|
996
995
|
const albQueryRangeFixture = alb_query_range_default;
|
|
997
|
-
//#endregion
|
|
998
996
|
export { albQueryRangeFixture, queryRangeFixture };
|
package/dist/logs/index.mjs
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { t as cn } from "../utils-
|
|
2
|
-
import { t as Badge } from "../badge-DOZUr5DV.mjs";
|
|
3
|
-
import { t as Button } from "../button-DoMqfQLu.mjs";
|
|
4
|
-
import { t as Icon } from "../icon-wrapper-DKfJlJd0.mjs";
|
|
5
|
-
import { t as Checkbox } from "../checkbox-C6P12fio.mjs";
|
|
6
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../collapsible/index.mjs";
|
|
7
|
-
import { t as Input } from "../input-j4tbmYYz.mjs";
|
|
8
|
-
import { t as Sheet } from "../sheet-DHn6C_rs.mjs";
|
|
9
|
-
import { t as useBreakpoint } from "../use-breakpoint-CwiUJSmk.mjs";
|
|
1
|
+
import { t as cn } from "../utils-CTIuhCOs.mjs";
|
|
10
2
|
import { Skeleton } from "../skeleton/index.mjs";
|
|
3
|
+
import { Badge } from "../badge/index.mjs";
|
|
4
|
+
import { t as useBreakpoint } from "../use-breakpoint-zY_JYINK.mjs";
|
|
5
|
+
import { t as useCopyToClipboard } from "../use-copy-to-clipboard-CWKWHLxI.mjs";
|
|
6
|
+
import { t as Button } from "../button-Cn4KagBO.mjs";
|
|
7
|
+
import { t as Sheet } from "../sheet-DEpEJ_Rk.mjs";
|
|
8
|
+
import { t as Icon } from "../icon-wrapper-CIk2th6R.mjs";
|
|
9
|
+
import { t as CopyStateIcon } from "../copy-state-icon-DMvXXsZm.mjs";
|
|
10
|
+
import { c as getBrowserTimezone, t as DateTime, u as getTimezoneAbbreviation } from "../date-time-BBRVM9qb.mjs";
|
|
11
|
+
import { t as Checkbox } from "../checkbox-BAo5sbHk.mjs";
|
|
12
|
+
import { n as CollapsibleContent, r as CollapsibleTrigger, t as Collapsible } from "../collapsible-B-KP3JZ-.mjs";
|
|
13
|
+
import { t as DateTimeRangePicker } from "../date-time-range-picker-yy1Acntn.mjs";
|
|
11
14
|
import { TableBody, TableCell, TableHead, TableHeader, TableRow } from "../table/index.mjs";
|
|
12
|
-
import { t as
|
|
13
|
-
import {
|
|
14
|
-
import { t as useCopyToClipboard } from "../use-copy-to-clipboard-DZDq_85T.mjs";
|
|
15
|
-
import { Bot, ChevronDown, ChevronUp, Clock, Copy, Download, HelpCircle, Inbox, Monitor, RefreshCw, Search, SlidersHorizontal, Smartphone, Tablet, TriangleAlert, X } from "lucide-react";
|
|
15
|
+
import { t as Input } from "../input-DsT5qkJn.mjs";
|
|
16
|
+
import { Bot, ChevronDown, ChevronUp, Clock, Download, HelpCircle, Inbox, Monitor, RefreshCw, Search, SlidersHorizontal, Smartphone, Tablet, TriangleAlert, X } from "lucide-react";
|
|
16
17
|
import { createContext, memo, use, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
17
18
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
18
19
|
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
19
20
|
import { format, isSameDay } from "date-fns";
|
|
20
|
-
|
|
21
|
+
// src/components/features/logs/utils/format-timestamp.ts
|
|
21
22
|
function formatLogTimestampParts(date) {
|
|
22
23
|
return {
|
|
23
24
|
date: format(date, "MMM dd").toUpperCase(),
|
|
@@ -28,8 +29,7 @@ function formatLogTimestamp(date) {
|
|
|
28
29
|
const { date: day, time } = formatLogTimestampParts(date);
|
|
29
30
|
return `${day} ${time}`;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
//#region src/components/features/logs/utils/host.ts
|
|
32
|
+
// src/components/features/logs/utils/host.ts
|
|
33
33
|
/**
|
|
34
34
|
* Host shown for an HTTP access log. An explicit `host` label (set by the
|
|
35
35
|
* host app) wins; otherwise prefer the name the client asked for
|
|
@@ -39,8 +39,7 @@ function formatLogTimestamp(date) {
|
|
|
39
39
|
function logRequestHost(labels) {
|
|
40
40
|
return labels.host?.trim() || labels.requested_server_name?.trim() || labels.x_forwarded_host?.trim() || labels.authority?.trim() || labels.resource_name?.trim() || void 0;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
//#region src/components/features/logs/utils/severity.ts
|
|
42
|
+
// src/components/features/logs/utils/severity.ts
|
|
44
43
|
const SEVERITY_BADGE = {
|
|
45
44
|
ERROR: "danger",
|
|
46
45
|
FATAL: "danger",
|
|
@@ -71,8 +70,7 @@ function httpStatusTextClass(status) {
|
|
|
71
70
|
default: return "text-muted-foreground";
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
|
-
|
|
75
|
-
//#region src/components/features/logs/components/status-badge.tsx
|
|
73
|
+
// src/components/features/logs/components/status-badge.tsx
|
|
76
74
|
function LogsSeverityBadge({ severity }) {
|
|
77
75
|
const unlabeled = !severity;
|
|
78
76
|
return /* @__PURE__ */ jsx(Badge, {
|
|
@@ -108,8 +106,7 @@ function LogsStatusBadge({ parsed }) {
|
|
|
108
106
|
})]
|
|
109
107
|
});
|
|
110
108
|
}
|
|
111
|
-
|
|
112
|
-
//#region src/components/features/logs/components/columns.tsx
|
|
109
|
+
// src/components/features/logs/components/columns.tsx
|
|
113
110
|
const DEFAULT_FIXED_WIDTH = 160;
|
|
114
111
|
/** `MMM dd HH:mm:ss.SS` — e.g. `SEP 10 12:03:37.79`. */
|
|
115
112
|
const TIME_CHS = 18;
|
|
@@ -316,8 +313,7 @@ function columnSkeleton(column, row) {
|
|
|
316
313
|
function columnHeader(column) {
|
|
317
314
|
return column.header;
|
|
318
315
|
}
|
|
319
|
-
|
|
320
|
-
//#region src/components/features/logs/hooks/use-logs.ts
|
|
316
|
+
// src/components/features/logs/hooks/use-logs.ts
|
|
321
317
|
const LogsContext = createContext(null);
|
|
322
318
|
function useLogs() {
|
|
323
319
|
const context = use(LogsContext);
|
|
@@ -332,8 +328,7 @@ function logsDetailMaxWidth(node) {
|
|
|
332
328
|
if (parentWidth > 400) return parentWidth;
|
|
333
329
|
return typeof window === "undefined" ? 400 : window.innerWidth;
|
|
334
330
|
}
|
|
335
|
-
|
|
336
|
-
//#region src/components/features/logs/utils/parse-log-line.ts
|
|
331
|
+
// src/components/features/logs/utils/parse-log-line.ts
|
|
337
332
|
const ACCESS_LOG_RE = /^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)\s+(\S+)\s+(\d{3})\s+(\d+)ms\b/i;
|
|
338
333
|
const PATH_TOKEN_RE = /(?:^|\s)(\/\S+)/;
|
|
339
334
|
/**
|
|
@@ -437,8 +432,7 @@ function stripOnce(line, token) {
|
|
|
437
432
|
if (index === -1) return line;
|
|
438
433
|
return `${line.slice(0, index)}${line.slice(index + token.length)}`.replace(/\s+/g, " ").trim();
|
|
439
434
|
}
|
|
440
|
-
|
|
441
|
-
//#region src/components/features/logs/utils/user-agent.ts
|
|
435
|
+
// src/components/features/logs/utils/user-agent.ts
|
|
442
436
|
/** Label keys, in order, that may carry the client's User-Agent header. */
|
|
443
437
|
const USER_AGENT_LABEL_KEYS = [
|
|
444
438
|
"user_agent",
|
|
@@ -661,8 +655,7 @@ function parseUserAgent(raw) {
|
|
|
661
655
|
raw: ua
|
|
662
656
|
};
|
|
663
657
|
}
|
|
664
|
-
|
|
665
|
-
//#region src/components/features/logs/components/detail.tsx
|
|
658
|
+
// src/components/features/logs/components/detail.tsx
|
|
666
659
|
const DEVICE_ICONS = {
|
|
667
660
|
desktop: Monitor,
|
|
668
661
|
mobile: Smartphone,
|
|
@@ -696,9 +689,29 @@ function keyedParams(params) {
|
|
|
696
689
|
};
|
|
697
690
|
});
|
|
698
691
|
}
|
|
692
|
+
/**
|
|
693
|
+
* Icon button that copies `text` and shows a check until the copied state
|
|
694
|
+
* resets. Each button owns its hook so only the one clicked flips.
|
|
695
|
+
*/
|
|
696
|
+
function LogsCopyButton({ text, label, small = false }) {
|
|
697
|
+
const [copied, copy] = useCopyToClipboard();
|
|
698
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
699
|
+
type: "secondary",
|
|
700
|
+
theme: "borderless",
|
|
701
|
+
size: "icon",
|
|
702
|
+
className: small ? "-my-1 size-6" : void 0,
|
|
703
|
+
"aria-label": label,
|
|
704
|
+
onClick: () => copy(text, { withToast: true }),
|
|
705
|
+
children: /* @__PURE__ */ jsx(CopyStateIcon, {
|
|
706
|
+
copied,
|
|
707
|
+
size: small ? 14 : 16,
|
|
708
|
+
strokeWidth: 1,
|
|
709
|
+
absoluteStrokeWidth: true
|
|
710
|
+
})
|
|
711
|
+
});
|
|
712
|
+
}
|
|
699
713
|
const DetailBody = memo(({ showClose = true }) => {
|
|
700
714
|
const { selectedEntry, selectPrevious, selectNext, setSelectedId } = useLogs();
|
|
701
|
-
const [, copy] = useCopyToClipboard();
|
|
702
715
|
if (!selectedEntry) return null;
|
|
703
716
|
const parsed = parseLogLine(selectedEntry.line, selectedEntry.labels);
|
|
704
717
|
const displayLine = parsed.kind === "http" && !selectedEntry.line.trim() ? formatHttpLogLine(parsed) : selectedEntry.line;
|
|
@@ -737,13 +750,9 @@ const DetailBody = memo(({ showClose = true }) => {
|
|
|
737
750
|
onClick: selectNext,
|
|
738
751
|
children: /* @__PURE__ */ jsx(Icon, { icon: ChevronDown })
|
|
739
752
|
}),
|
|
740
|
-
/* @__PURE__ */ jsx(
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
size: "icon",
|
|
744
|
-
"aria-label": "Copy log line",
|
|
745
|
-
onClick: () => copy(displayLine, { withToast: true }),
|
|
746
|
-
children: /* @__PURE__ */ jsx(Icon, { icon: Copy })
|
|
753
|
+
/* @__PURE__ */ jsx(LogsCopyButton, {
|
|
754
|
+
text: displayLine,
|
|
755
|
+
label: "Copy log line"
|
|
747
756
|
}),
|
|
748
757
|
showClose && /* @__PURE__ */ jsx(Button, {
|
|
749
758
|
type: "secondary",
|
|
@@ -835,17 +844,10 @@ const DetailBody = memo(({ showClose = true }) => {
|
|
|
835
844
|
children: [/* @__PURE__ */ jsx("span", {
|
|
836
845
|
className: "text-muted-foreground text-3xs font-medium",
|
|
837
846
|
children: "Client"
|
|
838
|
-
}), /* @__PURE__ */ jsx(
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
className: "-my-1 size-6",
|
|
843
|
-
"aria-label": "Copy user agent",
|
|
844
|
-
onClick: () => copy(client.raw, { withToast: true }),
|
|
845
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
846
|
-
icon: Copy,
|
|
847
|
-
size: 14
|
|
848
|
-
})
|
|
847
|
+
}), /* @__PURE__ */ jsx(LogsCopyButton, {
|
|
848
|
+
text: client.raw,
|
|
849
|
+
label: "Copy user agent",
|
|
850
|
+
small: true
|
|
849
851
|
})]
|
|
850
852
|
}),
|
|
851
853
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -881,17 +883,10 @@ const DetailBody = memo(({ showClose = true }) => {
|
|
|
881
883
|
children: [/* @__PURE__ */ jsx("span", {
|
|
882
884
|
className: "text-muted-foreground text-3xs font-medium",
|
|
883
885
|
children: "Search params"
|
|
884
|
-
}), /* @__PURE__ */ jsx(
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
className: "-my-1 size-6",
|
|
889
|
-
"aria-label": "Copy search params",
|
|
890
|
-
onClick: () => copy(`?${request.search}`, { withToast: true }),
|
|
891
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
892
|
-
icon: Copy,
|
|
893
|
-
size: 14
|
|
894
|
-
})
|
|
886
|
+
}), /* @__PURE__ */ jsx(LogsCopyButton, {
|
|
887
|
+
text: `?${request.search}`,
|
|
888
|
+
label: "Copy search params",
|
|
889
|
+
small: true
|
|
895
890
|
})]
|
|
896
891
|
}), /* @__PURE__ */ jsx("dl", {
|
|
897
892
|
className: "flex flex-wrap gap-1.5",
|
|
@@ -1035,8 +1030,7 @@ function LogsDetail({ className }) {
|
|
|
1035
1030
|
}), /* @__PURE__ */ jsx(DetailBody, {})]
|
|
1036
1031
|
}) });
|
|
1037
1032
|
}
|
|
1038
|
-
|
|
1039
|
-
//#region src/components/features/logs/utils/time-range.ts
|
|
1033
|
+
// src/components/features/logs/utils/time-range.ts
|
|
1040
1034
|
const MINUTE_MS$1 = 6e4;
|
|
1041
1035
|
const HOUR_MS = 60 * MINUTE_MS$1;
|
|
1042
1036
|
const DAY_MS$1 = 24 * HOUR_MS;
|
|
@@ -1110,8 +1104,7 @@ function logTimeRangeLabel(range) {
|
|
|
1110
1104
|
function filtersAreActive(filters) {
|
|
1111
1105
|
return Object.values(filters).some((values) => values.length > 0);
|
|
1112
1106
|
}
|
|
1113
|
-
|
|
1114
|
-
//#region src/components/features/logs/components/filters.tsx
|
|
1107
|
+
// src/components/features/logs/components/filters.tsx
|
|
1115
1108
|
function LogsFilterGroup({ facet, defaultOpen }) {
|
|
1116
1109
|
const { filters, toggleFilterValue } = useLogs();
|
|
1117
1110
|
const selected = filters[facet.name] ?? [];
|
|
@@ -1261,8 +1254,7 @@ function LogsFilters({ className }) {
|
|
|
1261
1254
|
})]
|
|
1262
1255
|
});
|
|
1263
1256
|
}
|
|
1264
|
-
|
|
1265
|
-
//#region src/components/features/logs/components/table.tsx
|
|
1257
|
+
// src/components/features/logs/components/table.tsx
|
|
1266
1258
|
const SKELETON_ROWS = 12;
|
|
1267
1259
|
/** Centred message shared by the empty and error states. */
|
|
1268
1260
|
function LogsTableState({ icon, title, description, action, slot, role, tone = "muted" }) {
|
|
@@ -1503,8 +1495,7 @@ function formatBucketSummary(bucket, spanMs) {
|
|
|
1503
1495
|
const noun = bucket.count === 1 ? "log" : "logs";
|
|
1504
1496
|
return `${bucket.count} ${noun} · ${formatTimelineTick(start, tickSpan)} – ${formatTimelineTick(end, tickSpan)}`;
|
|
1505
1497
|
}
|
|
1506
|
-
|
|
1507
|
-
//#region src/components/features/logs/components/timeline.tsx
|
|
1498
|
+
// src/components/features/logs/components/timeline.tsx
|
|
1508
1499
|
const SKELETON_HEIGHTS = [
|
|
1509
1500
|
18,
|
|
1510
1501
|
34,
|
|
@@ -1573,8 +1564,7 @@ function LogsTimeline({ className }) {
|
|
|
1573
1564
|
})]
|
|
1574
1565
|
});
|
|
1575
1566
|
}
|
|
1576
|
-
|
|
1577
|
-
//#region src/components/features/logs/components/toolbar.tsx
|
|
1567
|
+
// src/components/features/logs/components/toolbar.tsx
|
|
1578
1568
|
function LogsSearch({ placeholder = "Search logs...", className }) {
|
|
1579
1569
|
const { search, setSearch } = useLogs();
|
|
1580
1570
|
const [value, setValue] = useState(search);
|
|
@@ -1652,8 +1642,7 @@ function LogsToolbar({ children, className }) {
|
|
|
1652
1642
|
]
|
|
1653
1643
|
});
|
|
1654
1644
|
}
|
|
1655
|
-
|
|
1656
|
-
//#region src/components/features/logs/components/explorer.tsx
|
|
1645
|
+
// src/components/features/logs/components/explorer.tsx
|
|
1657
1646
|
function LogsExplorer({ className }) {
|
|
1658
1647
|
const isDesktop = useBreakpoint() === "desktop";
|
|
1659
1648
|
const [filtersOpen, setFiltersOpen] = useState(false);
|
|
@@ -1701,8 +1690,7 @@ function LogsExplorer({ className }) {
|
|
|
1701
1690
|
]
|
|
1702
1691
|
});
|
|
1703
1692
|
}
|
|
1704
|
-
|
|
1705
|
-
//#region src/components/features/logs/hooks/use-controllable-state.ts
|
|
1693
|
+
// src/components/features/logs/hooks/use-controllable-state.ts
|
|
1706
1694
|
function useControllableState({ value, defaultValue, onChange }) {
|
|
1707
1695
|
const [internal, setInternal] = useState(defaultValue);
|
|
1708
1696
|
const isControlled = value !== void 0;
|
|
@@ -1711,8 +1699,7 @@ function useControllableState({ value, defaultValue, onChange }) {
|
|
|
1711
1699
|
onChange?.(next);
|
|
1712
1700
|
}, [isControlled, onChange])];
|
|
1713
1701
|
}
|
|
1714
|
-
|
|
1715
|
-
//#region src/components/features/logs/utils/constants.ts
|
|
1702
|
+
// src/components/features/logs/utils/constants.ts
|
|
1716
1703
|
const DEFAULT_LOG_COLUMNS = [
|
|
1717
1704
|
"time",
|
|
1718
1705
|
"severity",
|
|
@@ -1742,8 +1729,7 @@ const SEVERITY_ORDER = [
|
|
|
1742
1729
|
"TRACE"
|
|
1743
1730
|
];
|
|
1744
1731
|
const DEFAULT_LOGQL_MATCHER = "{service_name=~\".+\"}";
|
|
1745
|
-
|
|
1746
|
-
//#region src/components/features/logs/utils/facets.ts
|
|
1732
|
+
// src/components/features/logs/utils/facets.ts
|
|
1747
1733
|
function facetLabel(name) {
|
|
1748
1734
|
const mapped = FACET_LABELS[name];
|
|
1749
1735
|
if (mapped) return mapped;
|
|
@@ -1821,8 +1807,7 @@ function searchableLogText(entry) {
|
|
|
1821
1807
|
function entryMatchesSearch(entry, query) {
|
|
1822
1808
|
return searchableLogText(entry).includes(query);
|
|
1823
1809
|
}
|
|
1824
|
-
|
|
1825
|
-
//#region src/components/features/logs/components/root.tsx
|
|
1810
|
+
// src/components/features/logs/components/root.tsx
|
|
1826
1811
|
/** Return the previous array while its items are shallow-equal to the new one. */
|
|
1827
1812
|
function useShallowArray(next) {
|
|
1828
1813
|
const ref = useRef(next);
|
|
@@ -1957,8 +1942,7 @@ function LogsRoot({ entries, facets, histogram, timeRange, defaultTimeRange, fil
|
|
|
1957
1942
|
})
|
|
1958
1943
|
});
|
|
1959
1944
|
}
|
|
1960
|
-
|
|
1961
|
-
//#region src/components/features/logs/logs.tsx
|
|
1945
|
+
// src/components/features/logs/logs.tsx
|
|
1962
1946
|
const Logs = {
|
|
1963
1947
|
Root: LogsRoot,
|
|
1964
1948
|
Explorer: LogsExplorer,
|
|
@@ -1972,8 +1956,7 @@ const Logs = {
|
|
|
1972
1956
|
Table: LogsTable,
|
|
1973
1957
|
Detail: LogsDetail
|
|
1974
1958
|
};
|
|
1975
|
-
|
|
1976
|
-
//#region src/components/features/logs/utils/build-logql.ts
|
|
1959
|
+
// src/components/features/logs/utils/build-logql.ts
|
|
1977
1960
|
/** Loki/Prometheus label names. Anything else is dropped, not interpolated. */
|
|
1978
1961
|
const LOKI_LABEL_NAME = /^[a-z_]\w*$/i;
|
|
1979
1962
|
function escapeQuoted(value) {
|
|
@@ -2001,8 +1984,7 @@ function buildLogQL({ matchers, lineContains } = {}) {
|
|
|
2001
1984
|
if (!text) return selector;
|
|
2002
1985
|
return `${selector} |= "${escapeQuoted(text)}"`;
|
|
2003
1986
|
}
|
|
2004
|
-
|
|
2005
|
-
//#region src/components/features/logs/utils/flatten-loki.ts
|
|
1987
|
+
// src/components/features/logs/utils/flatten-loki.ts
|
|
2006
1988
|
function nsToDate(timestampNs) {
|
|
2007
1989
|
try {
|
|
2008
1990
|
const ms = BigInt(timestampNs) / 1000000n;
|
|
@@ -2045,5 +2027,4 @@ function flattenLokiStreams(response) {
|
|
|
2045
2027
|
});
|
|
2046
2028
|
return entries;
|
|
2047
2029
|
}
|
|
2048
|
-
//#endregion
|
|
2049
2030
|
export { LOG_TIME_PRESETS, Logs, buildLogQL, facetsFromEntries, filterEntries, flattenLokiStreams, formatHttpLogLine, histogramFromEntries, httpStatusBadgeType, httpStatusTextClass, lastThirtyMinutes, logLineDisplay, logRequestHost, logTimeRangeLabel, logUserAgent, nsToDate, parseLogLine, parseUserAgent, resolveLogColumns, resolveLogTimeRange, searchableLogText, severityBadgeType, splitPathQuery, useLogs };
|
package/dist/map/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Map, MapCircle, MapCircleMarker, MapControlContainer, MapDrawCircle, MapDrawControl, MapDrawDelete, MapDrawEdit, MapDrawMarker, MapDrawPolygon, MapDrawPolyline, MapDrawRectangle, MapDrawUndo, MapFeatureGroup, MapFullscreenControl, MapLayerGroup, MapLayers, MapLayersControl, MapLocateControl, MapMarker, MapMarkerClusterGroup, MapPolygon, MapPolyline, MapPopup, MapRectangle, MapSearchControl, MapTileLayer, MapTooltip, MapZoomControl, PlaceAutocomplete, useLeaflet };
|
|
1
|
+
export { k as Map, b as MapCircle, x as MapCircleMarker, h as MapControlContainer, o as MapDrawCircle, s as MapDrawControl, c as MapDrawDelete, l as MapDrawEdit, u as MapDrawMarker, d as MapDrawPolygon, f as MapDrawPolyline, p as MapDrawRectangle, m as MapDrawUndo, t as MapFeatureGroup, g as MapFullscreenControl, n as MapLayerGroup, r as MapLayers, i as MapLayersControl, _ as MapLocateControl, S as MapMarker, C as MapMarkerClusterGroup, w as MapPolygon, T as MapPolyline, E as MapPopup, D as MapRectangle, v as MapSearchControl, a as MapTileLayer, O as MapTooltip, y as MapZoomControl, j as PlaceAutocomplete, A as useLeaflet } from "../layers-DLUbkJtt.mjs";
|
|
@@ -3,5 +3,4 @@ import "leaflet-draw/dist/leaflet.draw.css";
|
|
|
3
3
|
import "leaflet.fullscreen/dist/Control.FullScreen.css";
|
|
4
4
|
import "leaflet.markercluster/dist/MarkerCluster.Default.css";
|
|
5
5
|
import "leaflet.markercluster/dist/MarkerCluster.css";
|
|
6
|
-
|
|
7
|
-
export { useMap, useMapEvents };
|
|
6
|
+
export { useMap, useMapEvents } from "react-leaflet";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { InSheetContext, MobileSheet, ResponsiveSheetTrigger, useInSheet };
|
|
1
|
+
export { r as InSheetContext, n as MobileSheet, t as ResponsiveSheetTrigger, i as useInSheet } from "../mobile-sheet-1995HYY_.mjs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as cn } from "./utils-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as cn } from "./utils-CTIuhCOs.mjs";
|
|
2
|
+
import { r as SheetContent, t as Sheet } from "./sheet-DEpEJ_Rk.mjs";
|
|
3
|
+
import { a as SheetHeader, o as SheetTitle, r as SheetDescription } from "./sheet-DYPtVIb2.mjs";
|
|
4
4
|
import { createContext, use } from "react";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Slot } from "@radix-ui/react-slot";
|
|
7
|
-
|
|
7
|
+
// src/components/base/mobile-sheet/context.ts
|
|
8
8
|
/**
|
|
9
9
|
* Signals that children are rendered inside a MobileSheet. Responsive
|
|
10
10
|
* primitives (ResponsivePopover, ResponsiveDropdown) read this context
|
|
@@ -19,8 +19,7 @@ const InSheetContext = createContext(false);
|
|
|
19
19
|
function useInSheet() {
|
|
20
20
|
return use(InSheetContext);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
//#region src/components/base/mobile-sheet/mobile-sheet.tsx
|
|
22
|
+
// src/components/base/mobile-sheet/mobile-sheet.tsx
|
|
24
23
|
function MobileSheet({ open, onOpenChange, title, description, children, footer, className }) {
|
|
25
24
|
return /* @__PURE__ */ jsx(Sheet, {
|
|
26
25
|
open,
|
|
@@ -58,8 +57,7 @@ function MobileSheet({ open, onOpenChange, title, description, children, footer,
|
|
|
58
57
|
})
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
|
-
|
|
62
|
-
//#region src/components/base/mobile-sheet/responsive-sheet-trigger.tsx
|
|
60
|
+
// src/components/base/mobile-sheet/responsive-sheet-trigger.tsx
|
|
63
61
|
/**
|
|
64
62
|
* Shared mobile branch for ResponsivePopover and ResponsiveDropdown: renders the
|
|
65
63
|
* trigger via Radix Slot and opens a MobileSheet.
|
|
@@ -92,5 +90,4 @@ function ResponsiveSheetTrigger({ open, onOpenChange, trigger, children, sheetTi
|
|
|
92
90
|
children
|
|
93
91
|
})] });
|
|
94
92
|
}
|
|
95
|
-
//#endregion
|
|
96
93
|
export { useInSheet as i, MobileSheet as n, InSheetContext as r, ResponsiveSheetTrigger as t };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as ActionRow } from "../action-row-
|
|
2
|
-
import { t as MoreActions } from "../more-actions-
|
|
1
|
+
import { t as ActionRow } from "../action-row-BEzE9x37.mjs";
|
|
2
|
+
import { t as MoreActions } from "../more-actions-BlSOVwa8.mjs";
|
|
3
3
|
export { ActionRow, MoreActions };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as ActionRow } from "./action-row-
|
|
1
|
+
import { t as Button } from "./button-Cn4KagBO.mjs";
|
|
2
|
+
import { t as Tooltip } from "./tooltip-OIySjJWW.mjs";
|
|
3
|
+
import { t as cn } from "./utils-CTIuhCOs.mjs";
|
|
4
|
+
import { t as ResponsiveDropdown } from "./responsive-dropdown-DsWgpE_i.mjs";
|
|
5
|
+
import { t as ActionRow } from "./action-row-BEzE9x37.mjs";
|
|
6
6
|
import { Ellipsis } from "lucide-react";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
|
|
9
|
+
// src/components/features/more-actions/more-actions.tsx
|
|
10
10
|
function MoreActions(props) {
|
|
11
11
|
const { row, actions, className, disabled = false, iconClassName, responsive = true, sheetTitle = "Actions" } = props;
|
|
12
12
|
const [open, setOpen] = useState(false);
|
|
@@ -49,5 +49,4 @@ function MoreActions(props) {
|
|
|
49
49
|
})
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
//#endregion
|
|
53
52
|
export { MoreActions as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/motion.ts
|
|
2
2
|
/**
|
|
3
3
|
* Motion tokens — the single source of truth for JS-driven animation
|
|
4
4
|
* (Motion / `motion/react`). Mirrors the CSS motion tokens defined in
|
|
@@ -42,5 +42,4 @@ const DURATION = {
|
|
|
42
42
|
/** 200ms — drawer/sheet exit (faster than enter). */
|
|
43
43
|
drawerOut: .2
|
|
44
44
|
};
|
|
45
|
-
//#endregion
|
|
46
45
|
export { EASE as n, DURATION as t };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { n as EASE, t as DURATION } from "./motion-DOrRbLmy.mjs";
|
|
2
|
+
import { Badge } from "./badge/index.mjs";
|
|
3
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
4
|
+
// src/components/features/_shared/motion-chip.tsx
|
|
5
|
+
/** `Badge` as a Motion component, so chips can enter, exit and reflow. */
|
|
6
|
+
const MotionBadge = motion.create(Badge);
|
|
7
|
+
const ENTER = {
|
|
8
|
+
duration: DURATION.fast,
|
|
9
|
+
ease: EASE.out
|
|
10
|
+
};
|
|
11
|
+
const EXIT = {
|
|
12
|
+
duration: .1,
|
|
13
|
+
ease: EASE.out
|
|
14
|
+
};
|
|
15
|
+
/** Neighbours slide into a removed chip's gap a touch slower than it fades. */
|
|
16
|
+
const REFLOW = {
|
|
17
|
+
duration: .2,
|
|
18
|
+
ease: EASE.out
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Motion props for a chip in a wrapping list, for use with `MotionBadge`
|
|
22
|
+
* inside `<AnimatePresence initial={false} mode="popLayout">`.
|
|
23
|
+
*
|
|
24
|
+
* A chip scales up slightly as it fades in, and fades out a little faster
|
|
25
|
+
* when removed. `popLayout` takes the leaving chip out of flow straight away,
|
|
26
|
+
* and `layout="position"` slides the chips after it into the gap rather than
|
|
27
|
+
* snapping. The list needs `position: relative` for `popLayout` to place the
|
|
28
|
+
* leaving chip. Under reduced motion chips only fade and nothing slides.
|
|
29
|
+
*/
|
|
30
|
+
function useChipMotion() {
|
|
31
|
+
const reduceMotion = Boolean(useReducedMotion());
|
|
32
|
+
const scale = reduceMotion ? 1 : .85;
|
|
33
|
+
return {
|
|
34
|
+
initial: {
|
|
35
|
+
opacity: 0,
|
|
36
|
+
scale
|
|
37
|
+
},
|
|
38
|
+
animate: {
|
|
39
|
+
opacity: 1,
|
|
40
|
+
scale: 1,
|
|
41
|
+
transition: ENTER
|
|
42
|
+
},
|
|
43
|
+
exit: {
|
|
44
|
+
opacity: 0,
|
|
45
|
+
scale,
|
|
46
|
+
transition: EXIT
|
|
47
|
+
},
|
|
48
|
+
transition: { layout: REFLOW },
|
|
49
|
+
layout: reduceMotion ? false : "position"
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export { useChipMotion as n, MotionBadge as t };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { MultiSelect };
|
|
1
|
+
export { t as MultiSelect } from "../multi-select-C2cBrqXl.mjs";
|