@mediaradar/design-components 0.32.1 → 0.34.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/index.cjs +266 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +122 -6
- package/dist/index.d.ts +122 -6
- package/dist/index.js +278 -76
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -608,7 +608,7 @@ function CheckBoxBox({ checked, indeterminate, disabled, className }) {
|
|
|
608
608
|
}
|
|
609
609
|
|
|
610
610
|
// src/DateRangeFilter.tsx
|
|
611
|
-
import { useEffect as useEffect3, useLayoutEffect, useMemo as useMemo2, useRef as useRef3, useState as useState3 } from "react";
|
|
611
|
+
import { useEffect as useEffect3, useId as useId2, useLayoutEffect, useMemo as useMemo2, useRef as useRef3, useState as useState3 } from "react";
|
|
612
612
|
import { ChevronDown as ChevronDown2, ChevronLeft, ChevronRight } from "lucide-react";
|
|
613
613
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
614
614
|
var DEFAULT_SHORTCUTS = [
|
|
@@ -636,6 +636,7 @@ var CREATIVE_INTEL_SHORTCUTS = [
|
|
|
636
636
|
"All available history",
|
|
637
637
|
"Custom"
|
|
638
638
|
];
|
|
639
|
+
var HIDDEN_SHORTCUTS = ["Last 30 days"];
|
|
639
640
|
var WEEKDAYS = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"];
|
|
640
641
|
var MONTHS = [
|
|
641
642
|
"January",
|
|
@@ -666,6 +667,20 @@ var fmt = (d) => `${MONTHS[d.getMonth()].slice(0, 3)} ${d.getDate()}, ${d.getFul
|
|
|
666
667
|
var fmtFull = (d) => `${MONTHS[d.getMonth()]} ${d.getDate()}, ${d.getFullYear()}`;
|
|
667
668
|
var fullRangeLabel = (s, e) => `${fmtFull(s)} - ${fmtFull(e)}`;
|
|
668
669
|
var presetLabel = (sc) => sc === "Custom" ? "Custom range" : sc;
|
|
670
|
+
var MON = (d) => MONTHS[d.getMonth()].slice(0, 3);
|
|
671
|
+
function spanLabel(s, e) {
|
|
672
|
+
if (s.getFullYear() !== e.getFullYear()) return `${fmt(s)} \u2013 ${fmt(e)}`;
|
|
673
|
+
if (s.getMonth() !== e.getMonth()) return `${MON(s)} ${s.getDate()} \u2013 ${MON(e)} ${e.getDate()}, ${e.getFullYear()}`;
|
|
674
|
+
return s.getDate() === e.getDate() ? fmt(s) : `${MON(s)} ${s.getDate()} \u2013 ${e.getDate()}, ${e.getFullYear()}`;
|
|
675
|
+
}
|
|
676
|
+
function compareSpan(s, e, mode) {
|
|
677
|
+
if (mode === "year") {
|
|
678
|
+
const back = (d) => new Date(d.getFullYear() - 1, d.getMonth(), d.getDate());
|
|
679
|
+
return [back(s), back(e)];
|
|
680
|
+
}
|
|
681
|
+
const days = Math.round((startOfDay(e).getTime() - startOfDay(s).getTime()) / 864e5) + 1;
|
|
682
|
+
return [addDays(s, -days), addDays(s, -1)];
|
|
683
|
+
}
|
|
669
684
|
function presetRange(key, today) {
|
|
670
685
|
const t = startOfDay(today);
|
|
671
686
|
const qMonth = Math.floor(t.getMonth() / 3) * 3;
|
|
@@ -702,6 +717,8 @@ function presetRange(key, today) {
|
|
|
702
717
|
return [addDays(t, -6), t];
|
|
703
718
|
case "Last 14 days":
|
|
704
719
|
return [addDays(t, -13), t];
|
|
720
|
+
case "Last 30 days":
|
|
721
|
+
return [addDays(t, -29), t];
|
|
705
722
|
case "Last month": {
|
|
706
723
|
const s = new Date(t.getFullYear(), t.getMonth() - 1, 1);
|
|
707
724
|
const e = new Date(t.getFullYear(), t.getMonth(), 0);
|
|
@@ -723,7 +740,7 @@ function monthGrid(year, month) {
|
|
|
723
740
|
}
|
|
724
741
|
function matchShortcut(shortcuts, label) {
|
|
725
742
|
if (!label) return "Rolling 12 months";
|
|
726
|
-
const hit = shortcuts.find((s) => s.toLowerCase() === label.toLowerCase());
|
|
743
|
+
const hit = [...shortcuts, ...HIDDEN_SHORTCUTS].find((s) => s.toLowerCase() === label.toLowerCase());
|
|
727
744
|
return hit || "Custom";
|
|
728
745
|
}
|
|
729
746
|
function slug2(value) {
|
|
@@ -742,23 +759,43 @@ function DateRangeFilter({
|
|
|
742
759
|
shortDates = false,
|
|
743
760
|
icon,
|
|
744
761
|
presetSet = "default",
|
|
762
|
+
excludePresets = [],
|
|
763
|
+
emptyLabel,
|
|
764
|
+
today: todayProp,
|
|
765
|
+
initialRange,
|
|
766
|
+
compare,
|
|
767
|
+
onApply,
|
|
745
768
|
testIdPrefix,
|
|
746
769
|
granularity = "day"
|
|
747
770
|
}) {
|
|
748
771
|
const monthly = granularity === "month";
|
|
749
772
|
const snap = (s, e) => monthly ? [firstOfMonth(s), lastOfMonth(e)] : [s, e];
|
|
750
773
|
const controlled = controlledValue !== void 0 && controlledRange !== void 0;
|
|
751
|
-
const
|
|
752
|
-
const
|
|
774
|
+
const startsEmpty = !controlled && !!emptyLabel;
|
|
775
|
+
const SHORTCUTS = (presetSet === "creativeIntel" ? CREATIVE_INTEL_SHORTCUTS : DEFAULT_SHORTCUTS).filter(
|
|
776
|
+
(s) => !excludePresets.includes(s)
|
|
777
|
+
);
|
|
778
|
+
const today = useMemo2(() => todayProp ?? /* @__PURE__ */ new Date(), []);
|
|
753
779
|
const initShortcut = matchShortcut(SHORTCUTS, controlled ? controlledValue : defaultValue);
|
|
754
|
-
const initRange = controlled ? controlledRange : snap(...presetRange(initShortcut === "Custom" ? "Rolling 12 months" : initShortcut, today));
|
|
780
|
+
const initRange = controlled ? controlledRange : initShortcut === "Custom" && initialRange ? snap(...initialRange) : snap(...presetRange(initShortcut === "Custom" ? "Rolling 12 months" : initShortcut, today));
|
|
781
|
+
const compareLabel = (id) => compare?.options.find((o) => o.id === id)?.label;
|
|
755
782
|
const dateLine = (s, e) => monthly ? `${fmtMonth(s)} \u2013 ${fmtMonth(e)}` : shortDates ? `${fmt(s)} \u2013 ${fmt(e)}` : fullRangeLabel(s, e);
|
|
756
783
|
const [open, setOpen] = useState3(false);
|
|
757
784
|
const [uncontrolledValue, setUncontrolledValue] = useState3(
|
|
758
|
-
showDates ? presetLabel(initShortcut) : defaultValue || "Last 7 days"
|
|
785
|
+
startsEmpty ? emptyLabel : showDates ? presetLabel(initShortcut) : defaultValue || "Last 7 days"
|
|
786
|
+
);
|
|
787
|
+
const [uncontrolledDatesLine, setUncontrolledDatesLine] = useState3(
|
|
788
|
+
startsEmpty ? null : dateLine(initRange[0], initRange[1])
|
|
759
789
|
);
|
|
760
|
-
const
|
|
761
|
-
const
|
|
790
|
+
const committed = useRef3({ shortcut: initShortcut, start: initRange[0], end: initRange[1], set: !startsEmpty });
|
|
791
|
+
const [cmp, setCmp] = useState3(compare?.value);
|
|
792
|
+
const committedCmp = useRef3(compare?.value);
|
|
793
|
+
const [appliedCmp, setAppliedCmp] = useState3(compare?.value);
|
|
794
|
+
useEffect3(() => {
|
|
795
|
+
committedCmp.current = compare?.value;
|
|
796
|
+
setAppliedCmp(compare?.value);
|
|
797
|
+
}, [compare?.value]);
|
|
798
|
+
const compareName = `${useId2()}-compare`;
|
|
762
799
|
const displayValue = controlled ? showDates ? presetLabel(initShortcut) : controlledValue : uncontrolledValue;
|
|
763
800
|
const displayDatesLine = controlled ? dateLine(initRange[0], initRange[1]) : uncontrolledDatesLine;
|
|
764
801
|
const [shortcut, setShortcut] = useState3(initShortcut);
|
|
@@ -767,7 +804,7 @@ function DateRangeFilter({
|
|
|
767
804
|
const [leftMonth, setLeftMonth] = useState3(new Date(initRange[0].getFullYear(), initRange[0].getMonth(), 1));
|
|
768
805
|
const ref = useRef3(null);
|
|
769
806
|
useEffect3(() => {
|
|
770
|
-
if (controlled) return;
|
|
807
|
+
if (controlled || startsEmpty) return;
|
|
771
808
|
onRangeChange?.(committed.current.start, committed.current.end);
|
|
772
809
|
}, []);
|
|
773
810
|
useEffect3(() => {
|
|
@@ -775,10 +812,12 @@ function DateRangeFilter({
|
|
|
775
812
|
const committedShortcut = controlled ? initShortcut : committed.current.shortcut;
|
|
776
813
|
const committedStart = controlled ? initRange[0] : committed.current.start;
|
|
777
814
|
const committedEnd = controlled ? initRange[1] : committed.current.end;
|
|
815
|
+
const hasRange = controlled || committed.current.set;
|
|
778
816
|
setShortcut(committedShortcut);
|
|
779
|
-
setStart(committedStart);
|
|
780
|
-
setEnd(committedEnd);
|
|
781
|
-
setLeftMonth(new Date(committedStart.getFullYear(), committedStart.getMonth(), 1));
|
|
817
|
+
setStart(hasRange ? committedStart : null);
|
|
818
|
+
setEnd(hasRange ? committedEnd : null);
|
|
819
|
+
setLeftMonth(hasRange ? new Date(committedStart.getFullYear(), committedStart.getMonth(), 1) : addMonths(today, -1));
|
|
820
|
+
setCmp(committedCmp.current);
|
|
782
821
|
const onKey = (e) => e.key === "Escape" && setOpen(false);
|
|
783
822
|
const onClick = (e) => {
|
|
784
823
|
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
@@ -812,17 +851,22 @@ function DateRangeFilter({
|
|
|
812
851
|
setEnd(e);
|
|
813
852
|
} else setEnd(monthly ? lastOfMonth(d) : d);
|
|
814
853
|
};
|
|
854
|
+
const canApply = !!start || controlled || committed.current.set;
|
|
815
855
|
const apply = () => {
|
|
856
|
+
if (!canApply) return;
|
|
816
857
|
const [s, e] = snap(start || initRange[0], end || start || initRange[0]);
|
|
817
858
|
const custom = monthly ? `${fmtMonth(s)} \u2014 ${fmtMonth(e)}` : `${fmt(s)} \u2014 ${fmt(e)}`;
|
|
818
859
|
const v = showDates ? presetLabel(shortcut) : shortcut === "Custom" ? custom : shortcut;
|
|
819
860
|
if (!controlled) {
|
|
820
|
-
committed.current = { shortcut, start: s, end: e };
|
|
861
|
+
committed.current = { shortcut, start: s, end: e, set: true };
|
|
821
862
|
setUncontrolledValue(v);
|
|
822
863
|
setUncontrolledDatesLine(dateLine(s, e));
|
|
823
864
|
}
|
|
865
|
+
committedCmp.current = cmp;
|
|
866
|
+
setAppliedCmp(cmp);
|
|
824
867
|
onChange?.(v);
|
|
825
868
|
onRangeChange?.(s, e);
|
|
869
|
+
onApply?.(shortcut === "Custom" ? `${fmt(s)} \u2013 ${fmt(e)}` : shortcut, s, e, cmp);
|
|
826
870
|
setOpen(false);
|
|
827
871
|
};
|
|
828
872
|
const popRef = useRef3(null);
|
|
@@ -844,8 +888,14 @@ function DateRangeFilter({
|
|
|
844
888
|
children: [
|
|
845
889
|
icon && /* @__PURE__ */ jsx8("span", { className: "shrink-0 text-text-tertiary", children: icon }),
|
|
846
890
|
/* @__PURE__ */ jsxs7("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
|
|
847
|
-
/* @__PURE__ */ jsx8("span", { className: showDates ? "text-[11px] text-text-tertiary" : "text-control-caption uppercase tracking-wide text-text-tertiary", children: showDates ? displayDatesLine : caption }),
|
|
848
|
-
/* @__PURE__ */
|
|
891
|
+
/* @__PURE__ */ jsx8("span", { className: showDates && displayDatesLine ? "text-[11px] text-text-tertiary" : "text-control-caption uppercase tracking-wide text-text-tertiary", children: showDates && displayDatesLine ? displayDatesLine : caption }),
|
|
892
|
+
/* @__PURE__ */ jsxs7("span", { className: "text-[12px] font-medium text-text-primary", children: [
|
|
893
|
+
displayValue,
|
|
894
|
+
compareLabel(appliedCmp) && /* @__PURE__ */ jsxs7("span", { className: "font-normal text-text-secondary", children: [
|
|
895
|
+
" \xB7 vs ",
|
|
896
|
+
compareLabel(appliedCmp).toLowerCase()
|
|
897
|
+
] })
|
|
898
|
+
] })
|
|
849
899
|
] }),
|
|
850
900
|
/* @__PURE__ */ jsx8(ChevronDown2, { size: 14, "aria-hidden": "true", className: `shrink-0 text-text-secondary transition-transform ${open ? "rotate-180" : ""}` })
|
|
851
901
|
]
|
|
@@ -921,10 +971,39 @@ function DateRangeFilter({
|
|
|
921
971
|
] })
|
|
922
972
|
] }, offset);
|
|
923
973
|
}) }),
|
|
974
|
+
compare && /* @__PURE__ */ jsxs7("fieldset", { className: "mt-4 border-t border-border-default pt-4", children: [
|
|
975
|
+
/* @__PURE__ */ jsx8("legend", { className: "float-left mb-2 w-full text-xs font-medium text-text-secondary", children: "Compare to" }),
|
|
976
|
+
/* @__PURE__ */ jsx8("div", { className: "clear-left flex flex-col gap-1", children: compare.options.map((o) => {
|
|
977
|
+
const on = (cmp ?? compare.value) === o.id;
|
|
978
|
+
return /* @__PURE__ */ jsxs7(
|
|
979
|
+
"label",
|
|
980
|
+
{
|
|
981
|
+
className: `flex cursor-pointer items-center gap-2.5 rounded-control px-2 py-1.5 text-dense transition-colors ${on ? "bg-subtle" : "hover:bg-subtle"}`,
|
|
982
|
+
children: [
|
|
983
|
+
/* @__PURE__ */ jsx8(
|
|
984
|
+
"input",
|
|
985
|
+
{
|
|
986
|
+
type: "radio",
|
|
987
|
+
name: compareName,
|
|
988
|
+
value: o.id,
|
|
989
|
+
checked: on,
|
|
990
|
+
onChange: () => setCmp(o.id),
|
|
991
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-compare-${slug2(o.id)}`,
|
|
992
|
+
className: "h-4 w-4 accent-brand-primaryAction"
|
|
993
|
+
}
|
|
994
|
+
),
|
|
995
|
+
/* @__PURE__ */ jsx8("span", { className: `w-44 shrink-0 ${on ? "font-semibold text-text-primary" : "text-text-secondary"}`, children: o.label }),
|
|
996
|
+
start && /* @__PURE__ */ jsx8("span", { className: "tabular-nums text-text-tertiary", children: spanLabel(...compareSpan(start, end ?? start, o.id)) })
|
|
997
|
+
]
|
|
998
|
+
},
|
|
999
|
+
o.id
|
|
1000
|
+
);
|
|
1001
|
+
}) })
|
|
1002
|
+
] }),
|
|
924
1003
|
/* @__PURE__ */ jsxs7("div", { className: "mt-4 flex items-center justify-end gap-2", children: [
|
|
925
1004
|
monthly && /* @__PURE__ */ jsx8("span", { className: "mr-auto text-xs text-text-tertiary", children: "Data is monthly, so ranges cover whole months." }),
|
|
926
1005
|
/* @__PURE__ */ jsx8("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-cancel`, onClick: () => setOpen(false), className: "rounded-control border border-border-default bg-surface px-5 py-2 text-[13px] font-semibold text-text-primary transition-colors hover:bg-subtle", children: "Cancel" }),
|
|
927
|
-
/* @__PURE__ */ jsx8("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-apply`, onClick: apply, className: "rounded-control bg-brand-primaryAction px-5 py-2 text-[13px] font-semibold text-brand-onprimary transition-[filter] hover:brightness-110", children: "Apply" })
|
|
1006
|
+
/* @__PURE__ */ jsx8("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-apply`, onClick: apply, disabled: !canApply, className: "rounded-control bg-brand-primaryAction px-5 py-2 text-[13px] font-semibold text-brand-onprimary transition-[filter] hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-50", children: "Apply" })
|
|
928
1007
|
] })
|
|
929
1008
|
] })
|
|
930
1009
|
]
|
|
@@ -943,7 +1022,7 @@ function NavBtn({ children, onClick, ...rest }) {
|
|
|
943
1022
|
}
|
|
944
1023
|
|
|
945
1024
|
// src/SearchBar.tsx
|
|
946
|
-
import { useEffect as useEffect4, useId as
|
|
1025
|
+
import { useEffect as useEffect4, useId as useId3, useRef as useRef4, useState as useState4 } from "react";
|
|
947
1026
|
import { AlertCircle, Check as Check3, ChevronDown as ChevronDown3, Search as Search3, X as X2 } from "lucide-react";
|
|
948
1027
|
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
949
1028
|
var HEIGHT = { sm: "h-8", md: "h-10", lg: "h-11" };
|
|
@@ -1223,7 +1302,7 @@ function RadioOption({
|
|
|
1223
1302
|
}
|
|
1224
1303
|
function RowInfoTip({ text }) {
|
|
1225
1304
|
const [open, setOpen] = useState4(false);
|
|
1226
|
-
const id =
|
|
1305
|
+
const id = useId3();
|
|
1227
1306
|
const ref = useRef4(null);
|
|
1228
1307
|
useEffect4(() => {
|
|
1229
1308
|
if (!open) return;
|
|
@@ -1982,7 +2061,7 @@ function StackedColumnPlaceholder({
|
|
|
1982
2061
|
}
|
|
1983
2062
|
|
|
1984
2063
|
// src/Tooltip.tsx
|
|
1985
|
-
import { useEffect as useEffect8, useId as
|
|
2064
|
+
import { useEffect as useEffect8, useId as useId4, useLayoutEffect as useLayoutEffect3, useRef as useRef9, useState as useState8 } from "react";
|
|
1986
2065
|
import { createPortal as createPortal3 } from "react-dom";
|
|
1987
2066
|
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1988
2067
|
function cx6(...parts) {
|
|
@@ -2033,7 +2112,7 @@ function Tooltip({
|
|
|
2033
2112
|
const [shown, setShown] = useState8(false);
|
|
2034
2113
|
const openRef = useRef9(false);
|
|
2035
2114
|
const mountedRef = useRef9(false);
|
|
2036
|
-
const id =
|
|
2115
|
+
const id = useId4();
|
|
2037
2116
|
const describedRef = useRef9(null);
|
|
2038
2117
|
const clearHideTimer = () => {
|
|
2039
2118
|
if (hideTimer.current) {
|
|
@@ -3012,7 +3091,7 @@ function FilterDropdownFooter({
|
|
|
3012
3091
|
}
|
|
3013
3092
|
|
|
3014
3093
|
// src/NameListModal.tsx
|
|
3015
|
-
import { useEffect as useEffect10, useId as
|
|
3094
|
+
import { useEffect as useEffect10, useId as useId5, useRef as useRef11, useState as useState11 } from "react";
|
|
3016
3095
|
import { createPortal as createPortal5 } from "react-dom";
|
|
3017
3096
|
import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3018
3097
|
function NameListModal({
|
|
@@ -3031,8 +3110,8 @@ function NameListModal({
|
|
|
3031
3110
|
);
|
|
3032
3111
|
const toggle = (key) => setChecked((c) => ({ ...c, [key]: !c[key] }));
|
|
3033
3112
|
const dialogRef = useRef11(null);
|
|
3034
|
-
const titleId =
|
|
3035
|
-
const fieldId =
|
|
3113
|
+
const titleId = useId5();
|
|
3114
|
+
const fieldId = useId5();
|
|
3036
3115
|
useEffect10(() => {
|
|
3037
3116
|
const onKey = (e) => e.key === "Escape" && onCancel();
|
|
3038
3117
|
window.addEventListener("keydown", onKey);
|
|
@@ -3585,7 +3664,7 @@ function resolveRange(label, today = startOfToday()) {
|
|
|
3585
3664
|
}
|
|
3586
3665
|
return [new Date(end.getFullYear(), end.getMonth() - 6, 1), end];
|
|
3587
3666
|
}
|
|
3588
|
-
function
|
|
3667
|
+
function spanLabel2(label, today) {
|
|
3589
3668
|
const [s, e] = resolveRange(label, today);
|
|
3590
3669
|
return `${fmtDate(s)} \u2013 ${fmtDate(e)}`;
|
|
3591
3670
|
}
|
|
@@ -3671,7 +3750,7 @@ function DateRangePicker({
|
|
|
3671
3750
|
className: chipTriggerClass(),
|
|
3672
3751
|
children: [
|
|
3673
3752
|
/* @__PURE__ */ jsxs34("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
|
|
3674
|
-
/* @__PURE__ */ jsx38("span", { className: "text-control-caption text-text-tertiary", children:
|
|
3753
|
+
/* @__PURE__ */ jsx38("span", { className: "text-control-caption text-text-tertiary", children: spanLabel2(value, end) }),
|
|
3675
3754
|
/* @__PURE__ */ jsx38("span", { className: "text-[12px] font-medium text-text-primary", children: value })
|
|
3676
3755
|
] }),
|
|
3677
3756
|
/* @__PURE__ */ jsx38(ChevronDown9, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-text-secondary transition-transform", open && "rotate-180") })
|
|
@@ -4014,11 +4093,11 @@ function Toggle({ checked, onChange, label, size = "md", disabled, className, te
|
|
|
4014
4093
|
}
|
|
4015
4094
|
|
|
4016
4095
|
// src/AISpark.tsx
|
|
4017
|
-
import { useId as
|
|
4096
|
+
import { useId as useId6 } from "react";
|
|
4018
4097
|
import { Sparkles } from "lucide-react";
|
|
4019
4098
|
import { Fragment as Fragment6, jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4020
4099
|
function AISpark({ size = 16, className }) {
|
|
4021
|
-
const id =
|
|
4100
|
+
const id = useId6();
|
|
4022
4101
|
return /* @__PURE__ */ jsxs36(Fragment6, { children: [
|
|
4023
4102
|
/* @__PURE__ */ jsx41("svg", { width: "0", height: "0", "aria-hidden": "true", style: { position: "absolute" }, children: /* @__PURE__ */ jsx41("defs", { children: /* @__PURE__ */ jsxs36("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "1", children: [
|
|
4024
4103
|
/* @__PURE__ */ jsx41("stop", { offset: "0%", stopColor: "var(--mr-color-brand-primary)" }),
|
|
@@ -4089,7 +4168,7 @@ function PageHeader({ title, description, actions, back, className }) {
|
|
|
4089
4168
|
}
|
|
4090
4169
|
|
|
4091
4170
|
// src/Modal.tsx
|
|
4092
|
-
import { useEffect as useEffect14, useId as
|
|
4171
|
+
import { useEffect as useEffect14, useId as useId7, useRef as useRef15 } from "react";
|
|
4093
4172
|
import { createPortal as createPortal7 } from "react-dom";
|
|
4094
4173
|
import { X as X6 } from "lucide-react";
|
|
4095
4174
|
import { jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
@@ -4103,8 +4182,8 @@ var WIDTH = {
|
|
|
4103
4182
|
};
|
|
4104
4183
|
var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
4105
4184
|
function Modal({ open, onClose, title, description, size = "md", footer, children, className }) {
|
|
4106
|
-
const titleId =
|
|
4107
|
-
const descId =
|
|
4185
|
+
const titleId = useId7();
|
|
4186
|
+
const descId = useId7();
|
|
4108
4187
|
const panel = useRef15(null);
|
|
4109
4188
|
const close = useRef15(onClose);
|
|
4110
4189
|
close.current = onClose;
|
|
@@ -4314,12 +4393,12 @@ function SegmentedControl({
|
|
|
4314
4393
|
}
|
|
4315
4394
|
|
|
4316
4395
|
// src/TextField.tsx
|
|
4317
|
-
import { forwardRef as forwardRef3, useId as
|
|
4396
|
+
import { forwardRef as forwardRef3, useId as useId8 } from "react";
|
|
4318
4397
|
import { jsx as jsx48, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
4319
4398
|
var HEIGHT2 = { sm: "h-8", md: "h-10", lg: "h-11" };
|
|
4320
4399
|
var TextField = forwardRef3(
|
|
4321
4400
|
({ label, hint, error, size = "md", icon, className, id, disabled, ...props }, ref) => {
|
|
4322
|
-
const auto =
|
|
4401
|
+
const auto = useId8();
|
|
4323
4402
|
const fieldId = id ?? auto;
|
|
4324
4403
|
const noteId = `${fieldId}-note`;
|
|
4325
4404
|
const note = error ?? hint;
|
|
@@ -4357,10 +4436,132 @@ var TextField = forwardRef3(
|
|
|
4357
4436
|
);
|
|
4358
4437
|
TextField.displayName = "TextField";
|
|
4359
4438
|
|
|
4360
|
-
// src/
|
|
4361
|
-
import { useId as
|
|
4439
|
+
// src/Drawer.tsx
|
|
4440
|
+
import { useEffect as useEffect15, useId as useId9, useRef as useRef17, useState as useState15 } from "react";
|
|
4441
|
+
import { createPortal as createPortal8 } from "react-dom";
|
|
4442
|
+
import { X as X7 } from "lucide-react";
|
|
4362
4443
|
import { jsx as jsx49, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4363
|
-
var WIDTH2 = {
|
|
4444
|
+
var WIDTH2 = {
|
|
4445
|
+
sm: "max-w-110",
|
|
4446
|
+
md: "max-w-160",
|
|
4447
|
+
lg: "max-w-230"
|
|
4448
|
+
};
|
|
4449
|
+
var EXIT_MS = 200;
|
|
4450
|
+
var FOCUSABLE2 = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
4451
|
+
function Drawer({ open, onClose, title, description, size = "sm", footer, children, className }) {
|
|
4452
|
+
const titleId = useId9();
|
|
4453
|
+
const descId = useId9();
|
|
4454
|
+
const panel = useRef17(null);
|
|
4455
|
+
const close = useRef17(onClose);
|
|
4456
|
+
close.current = onClose;
|
|
4457
|
+
const [mounted, setMounted] = useState15(open);
|
|
4458
|
+
const [shown, setShown] = useState15(false);
|
|
4459
|
+
useEffect15(() => {
|
|
4460
|
+
if (open) {
|
|
4461
|
+
setMounted(true);
|
|
4462
|
+
const raf = requestAnimationFrame(() => requestAnimationFrame(() => setShown(true)));
|
|
4463
|
+
return () => cancelAnimationFrame(raf);
|
|
4464
|
+
}
|
|
4465
|
+
setShown(false);
|
|
4466
|
+
const t = setTimeout(() => setMounted(false), EXIT_MS);
|
|
4467
|
+
return () => clearTimeout(t);
|
|
4468
|
+
}, [open]);
|
|
4469
|
+
useEffect15(() => {
|
|
4470
|
+
if (!open || !mounted) return;
|
|
4471
|
+
const opener = document.activeElement;
|
|
4472
|
+
const firstIn = (region) => panel.current?.querySelector(region)?.querySelector(FOCUSABLE2) ?? null;
|
|
4473
|
+
const first = firstIn("[data-drawer-body]") ?? firstIn("[data-drawer-footer]");
|
|
4474
|
+
(first ?? panel.current)?.focus({ preventScroll: true });
|
|
4475
|
+
const overflow = document.body.style.overflow;
|
|
4476
|
+
document.body.style.overflow = "hidden";
|
|
4477
|
+
const onKey = (e) => {
|
|
4478
|
+
if (e.key === "Escape") {
|
|
4479
|
+
e.stopPropagation();
|
|
4480
|
+
close.current();
|
|
4481
|
+
return;
|
|
4482
|
+
}
|
|
4483
|
+
if (e.key !== "Tab" || !panel.current) return;
|
|
4484
|
+
const items = Array.from(panel.current.querySelectorAll(FOCUSABLE2));
|
|
4485
|
+
if (items.length === 0) return;
|
|
4486
|
+
const [head, tail] = [items[0], items[items.length - 1]];
|
|
4487
|
+
if (e.shiftKey && document.activeElement === head) {
|
|
4488
|
+
e.preventDefault();
|
|
4489
|
+
tail.focus();
|
|
4490
|
+
} else if (!e.shiftKey && document.activeElement === tail) {
|
|
4491
|
+
e.preventDefault();
|
|
4492
|
+
head.focus();
|
|
4493
|
+
}
|
|
4494
|
+
};
|
|
4495
|
+
document.addEventListener("keydown", onKey);
|
|
4496
|
+
return () => {
|
|
4497
|
+
document.removeEventListener("keydown", onKey);
|
|
4498
|
+
document.body.style.overflow = overflow;
|
|
4499
|
+
opener?.focus?.();
|
|
4500
|
+
};
|
|
4501
|
+
}, [open, mounted]);
|
|
4502
|
+
if (!mounted || typeof document === "undefined") return null;
|
|
4503
|
+
return createPortal8(
|
|
4504
|
+
/* @__PURE__ */ jsxs43("div", { className: "fixed inset-0 z-modal", children: [
|
|
4505
|
+
/* @__PURE__ */ jsx49(
|
|
4506
|
+
"div",
|
|
4507
|
+
{
|
|
4508
|
+
"aria-hidden": "true",
|
|
4509
|
+
onMouseDown: (e) => {
|
|
4510
|
+
e.preventDefault();
|
|
4511
|
+
onClose();
|
|
4512
|
+
},
|
|
4513
|
+
className: cn(
|
|
4514
|
+
"absolute inset-0 bg-scrim transition-opacity duration-(--mr-motion-duration-interactive) ease-interactive motion-reduce:transition-none",
|
|
4515
|
+
shown ? "opacity-100" : "opacity-0"
|
|
4516
|
+
)
|
|
4517
|
+
}
|
|
4518
|
+
),
|
|
4519
|
+
/* @__PURE__ */ jsxs43(
|
|
4520
|
+
"div",
|
|
4521
|
+
{
|
|
4522
|
+
ref: panel,
|
|
4523
|
+
role: "dialog",
|
|
4524
|
+
"aria-modal": "true",
|
|
4525
|
+
"aria-labelledby": titleId,
|
|
4526
|
+
"aria-describedby": description ? descId : void 0,
|
|
4527
|
+
tabIndex: -1,
|
|
4528
|
+
className: cn(
|
|
4529
|
+
"absolute inset-y-0 right-0 flex w-full flex-col border-l border-border-default bg-surface shadow-overlay outline-hidden transition-transform duration-(--mr-motion-duration-interactive) ease-interactive motion-reduce:transition-none",
|
|
4530
|
+
shown ? "translate-x-0" : "translate-x-full",
|
|
4531
|
+
WIDTH2[size],
|
|
4532
|
+
className
|
|
4533
|
+
),
|
|
4534
|
+
children: [
|
|
4535
|
+
/* @__PURE__ */ jsxs43("div", { className: "flex items-start gap-3 px-5 pt-5 pb-3", children: [
|
|
4536
|
+
/* @__PURE__ */ jsxs43("div", { className: "min-w-0 flex-1", children: [
|
|
4537
|
+
/* @__PURE__ */ jsx49("h2", { id: titleId, className: "text-base font-semibold text-text-primary", children: title }),
|
|
4538
|
+
description && /* @__PURE__ */ jsx49("p", { id: descId, className: "mt-0.5 text-sm text-text-secondary", children: description })
|
|
4539
|
+
] }),
|
|
4540
|
+
/* @__PURE__ */ jsx49(
|
|
4541
|
+
"button",
|
|
4542
|
+
{
|
|
4543
|
+
type: "button",
|
|
4544
|
+
onClick: onClose,
|
|
4545
|
+
"aria-label": "Close",
|
|
4546
|
+
className: "-mr-1.5 -mt-1 flex size-8 shrink-0 items-center justify-center rounded-control text-text-tertiary hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
4547
|
+
children: /* @__PURE__ */ jsx49(X7, { size: 16, "aria-hidden": "true" })
|
|
4548
|
+
}
|
|
4549
|
+
)
|
|
4550
|
+
] }),
|
|
4551
|
+
/* @__PURE__ */ jsx49("div", { "data-drawer-body": true, className: "min-h-0 flex-1 overflow-y-auto px-5 pb-5 text-sm text-text-primary", children }),
|
|
4552
|
+
footer && /* @__PURE__ */ jsx49("div", { "data-drawer-footer": true, className: "flex items-center justify-end gap-2 border-t border-border-default px-5 py-3", children: footer })
|
|
4553
|
+
]
|
|
4554
|
+
}
|
|
4555
|
+
)
|
|
4556
|
+
] }),
|
|
4557
|
+
document.body
|
|
4558
|
+
);
|
|
4559
|
+
}
|
|
4560
|
+
|
|
4561
|
+
// src/DataTable.tsx
|
|
4562
|
+
import { useId as useId10 } from "react";
|
|
4563
|
+
import { jsx as jsx50, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
4564
|
+
var WIDTH3 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
|
|
4364
4565
|
var MAX_H = { sm: "max-h-80", md: "max-h-120", lg: "max-h-160" };
|
|
4365
4566
|
var HEAD_PAD = { default: "px-4 py-3", compact: "px-3 py-2" };
|
|
4366
4567
|
var CELL_PAD = { default: "px-4 py-3.5", compact: "px-3 py-2" };
|
|
@@ -4382,24 +4583,24 @@ function DataTable({
|
|
|
4382
4583
|
className,
|
|
4383
4584
|
...rest
|
|
4384
4585
|
}) {
|
|
4385
|
-
const titleId =
|
|
4586
|
+
const titleId = useId10();
|
|
4386
4587
|
const head = HEAD_PAD[density];
|
|
4387
4588
|
const pad = CELL_PAD[density];
|
|
4388
4589
|
const align = (c) => c.numeric ? "text-right" : "text-left";
|
|
4389
|
-
const width = (c) =>
|
|
4590
|
+
const width = (c) => WIDTH3[c.width ?? (c.numeric ? "md" : "fill")];
|
|
4390
4591
|
const onSort = (key) => {
|
|
4391
4592
|
const col = columns.find((c) => c.key === key);
|
|
4392
4593
|
onSortChange?.(cycleSort(sort, key, col?.firstDir ?? (col?.numeric ? "desc" : "asc")));
|
|
4393
4594
|
};
|
|
4394
|
-
return /* @__PURE__ */
|
|
4395
|
-
title && /* @__PURE__ */
|
|
4396
|
-
/* @__PURE__ */
|
|
4397
|
-
/* @__PURE__ */
|
|
4398
|
-
subtitle && /* @__PURE__ */
|
|
4595
|
+
return /* @__PURE__ */ jsxs44("div", { className: cn("flex w-full flex-col overflow-hidden rounded-card border border-border-default bg-surface", className), children: [
|
|
4596
|
+
title && /* @__PURE__ */ jsxs44("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
|
|
4597
|
+
/* @__PURE__ */ jsxs44("div", { className: "min-w-0", children: [
|
|
4598
|
+
/* @__PURE__ */ jsx50("h3", { id: titleId, className: "text-style-card-title", children: title }),
|
|
4599
|
+
subtitle && /* @__PURE__ */ jsx50("p", { className: "mt-0.5 text-xs text-text-tertiary", children: subtitle })
|
|
4399
4600
|
] }),
|
|
4400
|
-
action && /* @__PURE__ */
|
|
4601
|
+
action && /* @__PURE__ */ jsx50("div", { className: "shrink-0", children: action })
|
|
4401
4602
|
] }),
|
|
4402
|
-
/* @__PURE__ */
|
|
4603
|
+
/* @__PURE__ */ jsx50("div", { className: cn("overflow-x-auto", maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])), children: /* @__PURE__ */ jsxs44(
|
|
4403
4604
|
"table",
|
|
4404
4605
|
{
|
|
4405
4606
|
"aria-labelledby": title ? titleId : void 0,
|
|
@@ -4407,13 +4608,13 @@ function DataTable({
|
|
|
4407
4608
|
"aria-busy": loading || void 0,
|
|
4408
4609
|
className: "w-full border-collapse text-left",
|
|
4409
4610
|
children: [
|
|
4410
|
-
/* @__PURE__ */
|
|
4611
|
+
/* @__PURE__ */ jsx50("thead", { className: cn(maxHeight && "sticky top-0 z-10"), children: /* @__PURE__ */ jsx50("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: columns.map((c) => /* @__PURE__ */ jsx50(
|
|
4411
4612
|
"th",
|
|
4412
4613
|
{
|
|
4413
4614
|
scope: "col",
|
|
4414
4615
|
"aria-sort": c.sortable ? ariaSortFor(sort, c.key) : void 0,
|
|
4415
4616
|
className: cn("border-b border-border-default font-semibold", head, align(c), width(c)),
|
|
4416
|
-
children: c.sortable && onSortChange ? /* @__PURE__ */
|
|
4617
|
+
children: c.sortable && onSortChange ? /* @__PURE__ */ jsx50(
|
|
4417
4618
|
SortButton,
|
|
4418
4619
|
{
|
|
4419
4620
|
label: c.label,
|
|
@@ -4426,7 +4627,7 @@ function DataTable({
|
|
|
4426
4627
|
},
|
|
4427
4628
|
c.key
|
|
4428
4629
|
)) }) }),
|
|
4429
|
-
/* @__PURE__ */
|
|
4630
|
+
/* @__PURE__ */ jsx50("tbody", { className: "text-dense text-text-primary", children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsx50("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ jsx50("td", { className: cn("border-b border-border-default", pad, align(c)), children: /* @__PURE__ */ jsx50(
|
|
4430
4631
|
"span",
|
|
4431
4632
|
{
|
|
4432
4633
|
className: cn(
|
|
@@ -4434,7 +4635,7 @@ function DataTable({
|
|
|
4434
4635
|
c.numeric ? "w-12" : "w-2/3"
|
|
4435
4636
|
)
|
|
4436
4637
|
}
|
|
4437
|
-
) }, c.key)) }, i)) : rows.length === 0 ? /* @__PURE__ */
|
|
4638
|
+
) }, c.key)) }, i)) : rows.length === 0 ? /* @__PURE__ */ jsx50("tr", { children: /* @__PURE__ */ jsx50("td", { colSpan: columns.length, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ jsx50(NoResultsEmptyState, {}) }) }) : rows.map((row) => /* @__PURE__ */ jsx50("tr", { className: "hover:bg-subtle [&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ jsx50(
|
|
4438
4639
|
"td",
|
|
4439
4640
|
{
|
|
4440
4641
|
className: cn("border-b border-border-default", pad, align(c), c.numeric && "tabular-nums"),
|
|
@@ -4445,12 +4646,12 @@ function DataTable({
|
|
|
4445
4646
|
]
|
|
4446
4647
|
}
|
|
4447
4648
|
) }),
|
|
4448
|
-
footer && /* @__PURE__ */
|
|
4649
|
+
footer && /* @__PURE__ */ jsx50("div", { className: "border-t border-border-default px-4 py-3", children: footer })
|
|
4449
4650
|
] });
|
|
4450
4651
|
}
|
|
4451
4652
|
|
|
4452
4653
|
// src/MediaLabel.tsx
|
|
4453
|
-
import { jsx as
|
|
4654
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
4454
4655
|
var FILL = {
|
|
4455
4656
|
TV: "bg-media-tv",
|
|
4456
4657
|
CTV: "bg-media-ctv",
|
|
@@ -4461,7 +4662,7 @@ var FILL = {
|
|
|
4461
4662
|
Magazine: "bg-media-magazine"
|
|
4462
4663
|
};
|
|
4463
4664
|
function MediaLabel({ type, className }) {
|
|
4464
|
-
return /* @__PURE__ */
|
|
4665
|
+
return /* @__PURE__ */ jsx51(
|
|
4465
4666
|
"span",
|
|
4466
4667
|
{
|
|
4467
4668
|
className: cn(
|
|
@@ -4475,9 +4676,9 @@ function MediaLabel({ type, className }) {
|
|
|
4475
4676
|
}
|
|
4476
4677
|
|
|
4477
4678
|
// src/SuggestionChip.tsx
|
|
4478
|
-
import { jsx as
|
|
4679
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
4479
4680
|
function SuggestionChip({ children, className, type = "button", ...props }) {
|
|
4480
|
-
return /* @__PURE__ */
|
|
4681
|
+
return /* @__PURE__ */ jsx52(
|
|
4481
4682
|
"button",
|
|
4482
4683
|
{
|
|
4483
4684
|
type,
|
|
@@ -4486,16 +4687,16 @@ function SuggestionChip({ children, className, type = "button", ...props }) {
|
|
|
4486
4687
|
"inline-flex h-8 max-w-full items-center rounded-full border border-border-default bg-surface px-3 text-sm text-text-primary transition-colors duration-(--mr-motion-duration-interactive) ease-interactive hover:border-border-strong hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
4487
4688
|
className
|
|
4488
4689
|
),
|
|
4489
|
-
children: /* @__PURE__ */
|
|
4690
|
+
children: /* @__PURE__ */ jsx52("span", { className: "truncate", children })
|
|
4490
4691
|
}
|
|
4491
4692
|
);
|
|
4492
4693
|
}
|
|
4493
4694
|
|
|
4494
4695
|
// src/ToggleChip.tsx
|
|
4495
4696
|
import { Check as Check9 } from "lucide-react";
|
|
4496
|
-
import { jsx as
|
|
4697
|
+
import { jsx as jsx53, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4497
4698
|
function ToggleChip({ selected, onChange, children, className, type = "button", onClick, ...props }) {
|
|
4498
|
-
return /* @__PURE__ */
|
|
4699
|
+
return /* @__PURE__ */ jsxs45(
|
|
4499
4700
|
"button",
|
|
4500
4701
|
{
|
|
4501
4702
|
type,
|
|
@@ -4511,7 +4712,7 @@ function ToggleChip({ selected, onChange, children, className, type = "button",
|
|
|
4511
4712
|
className
|
|
4512
4713
|
),
|
|
4513
4714
|
children: [
|
|
4514
|
-
selected && /* @__PURE__ */
|
|
4715
|
+
selected && /* @__PURE__ */ jsx53(Check9, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
|
|
4515
4716
|
children
|
|
4516
4717
|
]
|
|
4517
4718
|
}
|
|
@@ -4519,14 +4720,14 @@ function ToggleChip({ selected, onChange, children, className, type = "button",
|
|
|
4519
4720
|
}
|
|
4520
4721
|
|
|
4521
4722
|
// src/CopyButton.tsx
|
|
4522
|
-
import { useEffect as
|
|
4723
|
+
import { useEffect as useEffect16, useRef as useRef18, useState as useState16 } from "react";
|
|
4523
4724
|
import { Check as Check10, Copy } from "lucide-react";
|
|
4524
|
-
import { jsx as
|
|
4725
|
+
import { jsx as jsx54, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4525
4726
|
var CONFIRM_MS = 2e3;
|
|
4526
4727
|
function CopyButton({ value, label, "aria-label": ariaLabel, size = "xs", className }) {
|
|
4527
|
-
const [copied, setCopied] =
|
|
4528
|
-
const timer =
|
|
4529
|
-
|
|
4728
|
+
const [copied, setCopied] = useState16(false);
|
|
4729
|
+
const timer = useRef18(void 0);
|
|
4730
|
+
useEffect16(() => () => clearTimeout(timer.current), []);
|
|
4530
4731
|
const copy = async () => {
|
|
4531
4732
|
try {
|
|
4532
4733
|
await navigator.clipboard.writeText(typeof value === "function" ? value() : value);
|
|
@@ -4538,8 +4739,8 @@ function CopyButton({ value, label, "aria-label": ariaLabel, size = "xs", classN
|
|
|
4538
4739
|
timer.current = setTimeout(() => setCopied(false), CONFIRM_MS);
|
|
4539
4740
|
};
|
|
4540
4741
|
const iconSize = size === "xs" ? 13 : 15;
|
|
4541
|
-
const icon = copied ? /* @__PURE__ */
|
|
4542
|
-
return /* @__PURE__ */
|
|
4742
|
+
const icon = copied ? /* @__PURE__ */ jsx54(Check10, { size: iconSize, "aria-hidden": "true", className: "shrink-0 text-text-success" }) : /* @__PURE__ */ jsx54(Copy, { size: iconSize, "aria-hidden": "true", className: "shrink-0" });
|
|
4743
|
+
return /* @__PURE__ */ jsxs46(
|
|
4543
4744
|
Button,
|
|
4544
4745
|
{
|
|
4545
4746
|
type: "button",
|
|
@@ -4551,16 +4752,16 @@ function CopyButton({ value, label, "aria-label": ariaLabel, size = "xs", classN
|
|
|
4551
4752
|
className: cn(!copied && "text-text-secondary", className),
|
|
4552
4753
|
children: [
|
|
4553
4754
|
icon,
|
|
4554
|
-
label && /* @__PURE__ */
|
|
4555
|
-
/* @__PURE__ */
|
|
4755
|
+
label && /* @__PURE__ */ jsx54("span", { children: copied ? "Copied" : label }),
|
|
4756
|
+
/* @__PURE__ */ jsx54("span", { role: "status", className: "sr-only", children: copied ? "Copied" : "" })
|
|
4556
4757
|
]
|
|
4557
4758
|
}
|
|
4558
4759
|
);
|
|
4559
4760
|
}
|
|
4560
4761
|
|
|
4561
4762
|
// src/InlineMessage.tsx
|
|
4562
|
-
import { AlertTriangle as AlertTriangle2, CheckCircle2, Info as Info3, X as
|
|
4563
|
-
import { jsx as
|
|
4763
|
+
import { AlertTriangle as AlertTriangle2, CheckCircle2, Info as Info3, X as X8, XCircle } from "lucide-react";
|
|
4764
|
+
import { jsx as jsx55, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
4564
4765
|
var BOX = {
|
|
4565
4766
|
info: "border-brand-primaryAction/30 bg-brand-primaryAction/10",
|
|
4566
4767
|
success: "border-status-success/40 bg-status-success/10",
|
|
@@ -4577,26 +4778,26 @@ var ICON_INK = {
|
|
|
4577
4778
|
var ICON2 = { info: Info3, success: CheckCircle2, warning: AlertTriangle2, danger: XCircle };
|
|
4578
4779
|
function InlineMessage({ tone = "info", title, children, actions, onDismiss, className }) {
|
|
4579
4780
|
const Icon = ICON2[tone];
|
|
4580
|
-
return /* @__PURE__ */
|
|
4781
|
+
return /* @__PURE__ */ jsxs47(
|
|
4581
4782
|
"div",
|
|
4582
4783
|
{
|
|
4583
4784
|
role: tone === "warning" || tone === "danger" ? "alert" : "status",
|
|
4584
4785
|
className: cn("flex items-start gap-2.5 rounded-control border px-3 py-2.5 text-sm", BOX[tone], className),
|
|
4585
4786
|
children: [
|
|
4586
|
-
/* @__PURE__ */
|
|
4587
|
-
/* @__PURE__ */
|
|
4588
|
-
/* @__PURE__ */
|
|
4589
|
-
children && /* @__PURE__ */
|
|
4590
|
-
actions && /* @__PURE__ */
|
|
4787
|
+
/* @__PURE__ */ jsx55(Icon, { size: 16, "aria-hidden": "true", className: cn("mt-0.5 shrink-0", ICON_INK[tone]) }),
|
|
4788
|
+
/* @__PURE__ */ jsxs47("div", { className: "min-w-0 flex-1", children: [
|
|
4789
|
+
/* @__PURE__ */ jsx55("p", { className: "font-semibold text-text-primary", children: title }),
|
|
4790
|
+
children && /* @__PURE__ */ jsx55("div", { className: "mt-0.5 text-text-secondary", children }),
|
|
4791
|
+
actions && /* @__PURE__ */ jsx55("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: actions })
|
|
4591
4792
|
] }),
|
|
4592
|
-
onDismiss && /* @__PURE__ */
|
|
4793
|
+
onDismiss && /* @__PURE__ */ jsx55(
|
|
4593
4794
|
"button",
|
|
4594
4795
|
{
|
|
4595
4796
|
type: "button",
|
|
4596
4797
|
onClick: onDismiss,
|
|
4597
4798
|
"aria-label": "Dismiss",
|
|
4598
4799
|
className: "-mr-1 -mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-control text-text-tertiary hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
4599
|
-
children: /* @__PURE__ */
|
|
4800
|
+
children: /* @__PURE__ */ jsx55(X8, { size: 14, "aria-hidden": "true" })
|
|
4600
4801
|
}
|
|
4601
4802
|
)
|
|
4602
4803
|
]
|
|
@@ -4622,6 +4823,7 @@ export {
|
|
|
4622
4823
|
DateRangeFilter,
|
|
4623
4824
|
DateRangePicker,
|
|
4624
4825
|
Delta,
|
|
4826
|
+
Drawer,
|
|
4625
4827
|
EmptyState,
|
|
4626
4828
|
FilterChipBar,
|
|
4627
4829
|
FilterDropdownFooter,
|