@mediaradar/design-components 0.18.8 → 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: [
@@ -3981,6 +3992,30 @@ function Freshness({ level }) {
3981
3992
  }
3982
3993
  );
3983
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
+ }
3984
4019
  // Annotate the CommonJS export names for ESM import in node:
3985
4020
  0 && (module.exports = {
3986
4021
  AISpark,
@@ -4010,11 +4045,13 @@ function Freshness({ level }) {
4010
4045
  NameListModal,
4011
4046
  NoResultsEmptyState,
4012
4047
  PRIMARY_ACTION_CLASS,
4048
+ PageHeader,
4013
4049
  Pager,
4014
4050
  PieChartPlaceholder,
4015
4051
  PublisherBreakdownList,
4016
4052
  QUIET_ACTION_CLASS,
4017
4053
  SearchBar,
4054
+ SectionHeading,
4018
4055
  SectionRail,
4019
4056
  SelectAllVisible,
4020
4057
  SelectFilter,