@mediaradar/design-components 0.18.7 → 0.19.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 CHANGED
@@ -48,11 +48,13 @@ __export(index_exports, {
48
48
  NameListModal: () => NameListModal,
49
49
  NoResultsEmptyState: () => NoResultsEmptyState,
50
50
  PRIMARY_ACTION_CLASS: () => PRIMARY_ACTION_CLASS,
51
+ PageHeader: () => PageHeader,
51
52
  Pager: () => Pager,
52
53
  PieChartPlaceholder: () => PieChartPlaceholder,
53
54
  PublisherBreakdownList: () => PublisherBreakdownList,
54
55
  QUIET_ACTION_CLASS: () => QUIET_ACTION_CLASS,
55
56
  SearchBar: () => SearchBar,
57
+ SectionHeading: () => SectionHeading,
56
58
  SectionRail: () => SectionRail,
57
59
  SelectAllVisible: () => SelectAllVisible,
58
60
  SelectFilter: () => SelectFilter,
@@ -783,6 +785,7 @@ function DateRangeFilter({
783
785
  value: controlledValue,
784
786
  range: controlledRange,
785
787
  align = "left",
788
+ placement = "below",
786
789
  onChange,
787
790
  onRangeChange,
788
791
  showDates = false,
@@ -867,6 +870,13 @@ function DateRangeFilter({
867
870
  onRangeChange?.(s, e);
868
871
  setOpen(false);
869
872
  };
873
+ const popRef = (0, import_react3.useRef)(null);
874
+ const [flipBelow, setFlipBelow] = (0, import_react3.useState)(false);
875
+ (0, import_react3.useLayoutEffect)(() => {
876
+ if (!open || placement !== "above" || !ref.current || !popRef.current) return;
877
+ setFlipBelow(ref.current.getBoundingClientRect().top < popRef.current.offsetHeight + 16);
878
+ }, [open, placement]);
879
+ const above = placement === "above" && !flipBelow;
870
880
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative", ref, children: [
871
881
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
872
882
  "button",
@@ -890,7 +900,8 @@ function DateRangeFilter({
890
900
  "div",
891
901
  {
892
902
  "data-testid": testIdPrefix && `${testIdPrefix}-popover`,
893
- className: `absolute top-[calc(100%+8px)] z-30 flex overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay ${align === "right" ? "right-0" : "left-0"}`,
903
+ ref: popRef,
904
+ className: `absolute z-30 flex overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay ${placement === "right" ? "bottom-0 left-full ml-2" : `${above ? "bottom-full mb-2" : "top-[calc(100%+8px)]"} ${align === "right" ? "right-0" : "left-0"}`}`,
894
905
  role: "dialog",
895
906
  "aria-label": "Select date range",
896
907
  children: [
@@ -3909,6 +3920,7 @@ var SIZES2 = {
3909
3920
  sm: { track: "h-5 w-9", knob: "h-4 w-4", on: "translate-x-[18px]" },
3910
3921
  md: { track: "h-6 w-11", knob: "h-5 w-5", on: "translate-x-[22px]" }
3911
3922
  };
3923
+ var OFF_TRACK = "color-mix(in srgb, var(--mr-color-border-interactive) 70%, var(--mr-color-text-secondary))";
3912
3924
  function Toggle({ checked, onChange, label, size = "md", disabled, className, testIdPrefix }) {
3913
3925
  const s = SIZES2[size];
3914
3926
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
@@ -3921,10 +3933,11 @@ function Toggle({ checked, onChange, label, size = "md", disabled, className, te
3921
3933
  disabled,
3922
3934
  "data-testid": testIdPrefix && `${testIdPrefix}-toggle`,
3923
3935
  onClick: () => onChange(!checked),
3936
+ style: checked ? void 0 : { backgroundColor: OFF_TRACK },
3924
3937
  className: cn(
3925
3938
  "relative inline-flex shrink-0 items-center rounded-full transition-colors focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
3926
3939
  s.track,
3927
- checked ? "bg-brand-primaryAction" : "bg-border-interactive",
3940
+ checked && "bg-brand-primaryAction",
3928
3941
  disabled && "cursor-not-allowed opacity-50",
3929
3942
  className
3930
3943
  ),
@@ -3979,6 +3992,30 @@ function Freshness({ level }) {
3979
3992
  }
3980
3993
  );
3981
3994
  }
3995
+
3996
+ // src/SectionHeading.tsx
3997
+ var import_jsx_runtime41 = require("react/jsx-runtime");
3998
+ function SectionHeading({ title, description, actions, as: Tag2 = "h2", id, className }) {
3999
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: cn("flex flex-wrap items-end justify-between gap-x-4 gap-y-2", className), children: [
4000
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "min-w-0", children: [
4001
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Tag2, { id, className: "text-base font-semibold text-text-primary", children: title }),
4002
+ description && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "mt-0.5 text-dense text-text-secondary", children: description })
4003
+ ] }),
4004
+ actions && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex shrink-0 items-center gap-2", children: actions })
4005
+ ] });
4006
+ }
4007
+
4008
+ // src/PageHeader.tsx
4009
+ var import_jsx_runtime42 = require("react/jsx-runtime");
4010
+ function PageHeader({ title, description, actions, className }) {
4011
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("header", { className: cn("flex flex-wrap items-center justify-between gap-x-6 gap-y-3", className), children: [
4012
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "min-w-0", children: [
4013
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h1", { className: "text-xl font-semibold tracking-tight text-text-primary", children: title }),
4014
+ description && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "mt-0.5 max-w-2xl text-sm text-text-secondary", children: description })
4015
+ ] }),
4016
+ actions && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex shrink-0 items-center gap-2", children: actions })
4017
+ ] });
4018
+ }
3982
4019
  // Annotate the CommonJS export names for ESM import in node:
3983
4020
  0 && (module.exports = {
3984
4021
  AISpark,
@@ -4008,11 +4045,13 @@ function Freshness({ level }) {
4008
4045
  NameListModal,
4009
4046
  NoResultsEmptyState,
4010
4047
  PRIMARY_ACTION_CLASS,
4048
+ PageHeader,
4011
4049
  Pager,
4012
4050
  PieChartPlaceholder,
4013
4051
  PublisherBreakdownList,
4014
4052
  QUIET_ACTION_CLASS,
4015
4053
  SearchBar,
4054
+ SectionHeading,
4016
4055
  SectionRail,
4017
4056
  SelectAllVisible,
4018
4057
  SelectFilter,