@eqtylab/equality 3.9.1 → 4.1.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.d.cts CHANGED
@@ -34,6 +34,19 @@ interface AlertProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProp
34
34
  title: string;
35
35
  description?: string | React$1.ReactNode;
36
36
  icon?: React$1.ReactElement | string | null;
37
+ /**
38
+ * Body content, as an alternative to `description`. Rendered in a `div` rather
39
+ * than a `p`, so block-level content (paragraphs, lists, code blocks) is valid.
40
+ * Use this instead of `description` when the body is more than a sentence.
41
+ */
42
+ children?: React$1.ReactNode;
43
+ /**
44
+ * Element to render. Defaults to `div` with `role="alert"`, which is an
45
+ * assertive live region -- correct for a message that appears in response to
46
+ * something the user did, wrong for static page content. Use `aside` for a
47
+ * standing callout; it drops the live region unless you set `role` yourself.
48
+ */
49
+ as?: 'div' | 'aside' | 'section';
37
50
  }
38
51
  declare const Alert: React$1.ForwardRefExoticComponent<AlertProps & React$1.RefAttributes<HTMLDivElement>>;
39
52
 
@@ -827,18 +840,21 @@ interface TabsProps {
827
840
  icon?: React.ReactElement | string;
828
841
  suffix?: React.ReactNode;
829
842
  content: React.ReactNode;
830
- triggerProps?: Omit<ComponentPropsWithoutRef<typeof TabsTrigger>, 'value'>;
843
+ triggerProps?: Omit<ComponentPropsWithoutRef<typeof TabsTrigger>, 'value'> & {
844
+ [key: `data-${string}`]: string | number | boolean | undefined;
845
+ };
831
846
  }[];
832
847
  className?: string;
833
848
  tabsListBackground?: 'transparent' | 'filled';
834
849
  defaultValue?: string;
835
850
  onValueChange?: (value: string) => void;
851
+ staticRender?: boolean;
836
852
  }
837
- declare const Tabs: ({ id, items, className, tabsListBackground, defaultValue, onValueChange, }: TabsProps) => react_jsx_runtime.JSX.Element;
853
+ declare const Tabs: ({ id, items, className, tabsListBackground, defaultValue, onValueChange, staticRender, }: TabsProps) => react_jsx_runtime.JSX.Element;
838
854
 
839
855
  declare const Textarea: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React$1.RefAttributes<HTMLTextAreaElement>>;
840
856
 
841
- type FormatDateDisplayMode = 'relative' | 'absolute' | 'until' | 'since';
857
+ type FormatDateDisplayMode = 'relative' | 'absolute' | 'countdown';
842
858
  interface FormatDateProps extends Omit<React$1.TimeHTMLAttributes<HTMLTimeElement>, 'dateTime' | 'children'> {
843
859
  /** The date to display. Accepts an ISO 8601 string, epoch milliseconds, or a Date. A missing value (null, undefined, or empty string) renders a placeholder. */
844
860
  date: string | number | Date | null | undefined;
@@ -846,8 +862,7 @@ interface FormatDateProps extends Omit<React$1.TimeHTMLAttributes<HTMLTimeElemen
846
862
  * How to render the date:
847
863
  * - `absolute` — the full date and time ("Jun 09 2026, 18:42:03 UTC")
848
864
  * - `relative` — idiomatic distance from now, in either direction ("2 weeks ago", "next week")
849
- * - `until` — exact countdown to a future date ("10 days"), a placeholder once it has passed
850
- * - `since` — exact time elapsed since a past date ("10 days ago"), a placeholder until it arrives
865
+ * - `countdown` — exact time left until a future date ("10 days"), a placeholder once it passes
851
866
  */
852
867
  displayAs?: FormatDateDisplayMode;
853
868
  /** Time zone used for absolute formatting. Defaults to "UTC". */
package/dist/index.d.ts CHANGED
@@ -34,6 +34,19 @@ interface AlertProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProp
34
34
  title: string;
35
35
  description?: string | React$1.ReactNode;
36
36
  icon?: React$1.ReactElement | string | null;
37
+ /**
38
+ * Body content, as an alternative to `description`. Rendered in a `div` rather
39
+ * than a `p`, so block-level content (paragraphs, lists, code blocks) is valid.
40
+ * Use this instead of `description` when the body is more than a sentence.
41
+ */
42
+ children?: React$1.ReactNode;
43
+ /**
44
+ * Element to render. Defaults to `div` with `role="alert"`, which is an
45
+ * assertive live region -- correct for a message that appears in response to
46
+ * something the user did, wrong for static page content. Use `aside` for a
47
+ * standing callout; it drops the live region unless you set `role` yourself.
48
+ */
49
+ as?: 'div' | 'aside' | 'section';
37
50
  }
38
51
  declare const Alert: React$1.ForwardRefExoticComponent<AlertProps & React$1.RefAttributes<HTMLDivElement>>;
39
52
 
@@ -827,18 +840,21 @@ interface TabsProps {
827
840
  icon?: React.ReactElement | string;
828
841
  suffix?: React.ReactNode;
829
842
  content: React.ReactNode;
830
- triggerProps?: Omit<ComponentPropsWithoutRef<typeof TabsTrigger>, 'value'>;
843
+ triggerProps?: Omit<ComponentPropsWithoutRef<typeof TabsTrigger>, 'value'> & {
844
+ [key: `data-${string}`]: string | number | boolean | undefined;
845
+ };
831
846
  }[];
832
847
  className?: string;
833
848
  tabsListBackground?: 'transparent' | 'filled';
834
849
  defaultValue?: string;
835
850
  onValueChange?: (value: string) => void;
851
+ staticRender?: boolean;
836
852
  }
837
- declare const Tabs: ({ id, items, className, tabsListBackground, defaultValue, onValueChange, }: TabsProps) => react_jsx_runtime.JSX.Element;
853
+ declare const Tabs: ({ id, items, className, tabsListBackground, defaultValue, onValueChange, staticRender, }: TabsProps) => react_jsx_runtime.JSX.Element;
838
854
 
839
855
  declare const Textarea: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React$1.RefAttributes<HTMLTextAreaElement>>;
840
856
 
841
- type FormatDateDisplayMode = 'relative' | 'absolute' | 'until' | 'since';
857
+ type FormatDateDisplayMode = 'relative' | 'absolute' | 'countdown';
842
858
  interface FormatDateProps extends Omit<React$1.TimeHTMLAttributes<HTMLTimeElement>, 'dateTime' | 'children'> {
843
859
  /** The date to display. Accepts an ISO 8601 string, epoch milliseconds, or a Date. A missing value (null, undefined, or empty string) renders a placeholder. */
844
860
  date: string | number | Date | null | undefined;
@@ -846,8 +862,7 @@ interface FormatDateProps extends Omit<React$1.TimeHTMLAttributes<HTMLTimeElemen
846
862
  * How to render the date:
847
863
  * - `absolute` — the full date and time ("Jun 09 2026, 18:42:03 UTC")
848
864
  * - `relative` — idiomatic distance from now, in either direction ("2 weeks ago", "next week")
849
- * - `until` — exact countdown to a future date ("10 days"), a placeholder once it has passed
850
- * - `since` — exact time elapsed since a past date ("10 days ago"), a placeholder until it arrives
865
+ * - `countdown` — exact time left until a future date ("10 days"), a placeholder once it passes
851
866
  */
852
867
  displayAs?: FormatDateDisplayMode;
853
868
  /** Time zone used for absolute formatting. Defaults to "UTC". */
package/dist/index.js CHANGED
@@ -215,13 +215,14 @@ var defaultVariantIcons = {
215
215
  danger: "TriangleAlert"
216
216
  };
217
217
  var Alert = React15.forwardRef(
218
- ({ className, variant, title, description, icon, ...props }, ref) => {
218
+ ({ className, variant, title, description, icon, children, as: Component = "div", ...props }, ref) => {
219
219
  const effectiveIcon = icon === void 0 ? variant ? defaultVariantIcons[variant] : void 0 : icon;
220
+ const role = Component === "div" ? "alert" : void 0;
220
221
  return /* @__PURE__ */ jsxs(
221
- "div",
222
+ Component,
222
223
  {
223
224
  ref,
224
- role: "alert",
225
+ role,
225
226
  className: cn(
226
227
  alertVariants({ variant }),
227
228
  effectiveIcon ? styles2["alert--with-icon"] : "",
@@ -239,7 +240,8 @@ var Alert = React15.forwardRef(
239
240
  }
240
241
  ) : null,
241
242
  /* @__PURE__ */ jsx("h4", { className: styles2["alert-title"], children: title }),
242
- description ? /* @__PURE__ */ jsx("p", { className: styles2["alert-description"], children: description }) : null
243
+ description ? /* @__PURE__ */ jsx("p", { className: styles2["alert-description"], children: description }) : null,
244
+ children ? /* @__PURE__ */ jsx("div", { className: styles2["alert-body"], children }) : null
243
245
  ]
244
246
  }
245
247
  );
@@ -1888,7 +1890,7 @@ var DropdownMenuSubTrigger = React15.forwardRef(({ className, inset, children, .
1888
1890
  ...props,
1889
1891
  children: [
1890
1892
  children,
1891
- /* @__PURE__ */ jsx(ChevronRightIcon2, { className: "ml-auto" })
1893
+ /* @__PURE__ */ jsx(ChevronRightIcon2, { className: styles22["dropdown-menu-subtrigger-chevron"] })
1892
1894
  ]
1893
1895
  }
1894
1896
  );
@@ -1966,7 +1968,7 @@ var DropdownMenuContent = React15.forwardRef(({ className, sideOffset = 4, onKey
1966
1968
  },
1967
1969
  ...props,
1968
1970
  children: [
1969
- ctx?.enabled ? /* @__PURE__ */ jsx("div", { className: "sr-only", role: "status", "aria-live": "polite", children: searching && resultCount > 0 ? `${resultCount} result${resultCount === 1 ? "" : "s"} available` : null }) : null,
1971
+ ctx?.enabled ? /* @__PURE__ */ jsx("div", { className: styles22["dropdown-menu-sr-status"], role: "status", "aria-live": "polite", children: searching && resultCount > 0 ? `${resultCount} result${resultCount === 1 ? "" : "s"} available` : null }) : null,
1970
1972
  children
1971
1973
  ]
1972
1974
  }
@@ -2014,7 +2016,7 @@ var DropdownMenuSearch = React15.forwardRef(
2014
2016
  }, [alwaysVisible, visible, reveal]);
2015
2017
  if (!alwaysVisible && !visible) return null;
2016
2018
  return /* @__PURE__ */ jsxs("div", { className: styles22["dropdown-menu-search"], children: [
2017
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "flex shrink-0", children: icon ?? /* @__PURE__ */ jsx(SearchIcon2, { className: styles22["icon-size"] }) }),
2019
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: styles22["dropdown-menu-item-icon"], children: icon ?? /* @__PURE__ */ jsx(SearchIcon2, { className: styles22["icon-size"] }) }),
2018
2020
  /* @__PURE__ */ jsx(
2019
2021
  "input",
2020
2022
  {
@@ -3548,7 +3550,7 @@ var TableRow = React15.forwardRef(
3548
3550
  onClick: onClick ? handleClick : void 0,
3549
3551
  ...props,
3550
3552
  children: [
3551
- href && /* @__PURE__ */ jsx("a", { href, className: styles53["table-row-link"], "data-table-row-link": true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: hrefLabel }) }),
3553
+ href && /* @__PURE__ */ jsx("a", { href, className: styles53["table-row-link"], "data-table-row-link": true, children: /* @__PURE__ */ jsx("span", { className: styles53["table-row-link-label"], children: hrefLabel }) }),
3552
3554
  children
3553
3555
  ]
3554
3556
  }
@@ -3575,7 +3577,8 @@ var Tabs = ({
3575
3577
  className,
3576
3578
  tabsListBackground = "transparent",
3577
3579
  defaultValue,
3578
- onValueChange
3580
+ onValueChange,
3581
+ staticRender = false
3579
3582
  }) => {
3580
3583
  const [activeTab, setActiveTab] = useState(defaultValue ?? items[0].value);
3581
3584
  const isFilled = tabsListBackground === "filled";
@@ -3589,15 +3592,19 @@ var Tabs = ({
3589
3592
  }
3590
3593
  return null;
3591
3594
  };
3595
+ const indicatorClass = cn(
3596
+ styles55["active-tab-indicator"],
3597
+ isFilled ? styles55["active-tab-indicator--filled"] : styles55["active-tab-indicator--transparent"]
3598
+ );
3592
3599
  const renderActiveStyle = (isActive) => {
3600
+ if (staticRender) {
3601
+ return /* @__PURE__ */ jsx("span", { className: cn(indicatorClass, styles55["active-tab-indicator--static"]) });
3602
+ }
3593
3603
  if (isActive) {
3594
3604
  return /* @__PURE__ */ jsx(
3595
3605
  motion.span,
3596
3606
  {
3597
- className: cn(
3598
- styles55["active-tab-indicator"],
3599
- isFilled ? styles55["active-tab-indicator--filled"] : styles55["active-tab-indicator--transparent"]
3600
- ),
3607
+ className: indicatorClass,
3601
3608
  initial: false,
3602
3609
  layoutId: `${id}-active-tab-indicator`
3603
3610
  }
@@ -3641,7 +3648,16 @@ var Tabs = ({
3641
3648
  })
3642
3649
  }
3643
3650
  ),
3644
- items.map(({ value, content }) => /* @__PURE__ */ jsx(TabsContent, { value, className: styles55["content"], children: content }, value))
3651
+ items.map(({ value, content }) => /* @__PURE__ */ jsx(
3652
+ TabsContent,
3653
+ {
3654
+ value,
3655
+ className: styles55["content"],
3656
+ forceMount: staticRender || void 0,
3657
+ children: content
3658
+ },
3659
+ value
3660
+ ))
3645
3661
  ]
3646
3662
  }
3647
3663
  );
@@ -3724,17 +3740,21 @@ function measureSpan(spanMs) {
3724
3740
  }
3725
3741
  return { value, unit };
3726
3742
  }
3727
- function formatDirected(date, now, mode, locale) {
3728
- const spanMs = mode === "until" ? date.getTime() - now.getTime() : now.getTime() - date.getTime();
3743
+ function formatCountdown(date, now, locale) {
3744
+ const spanMs = date.getTime() - now.getTime();
3729
3745
  if (spanMs <= 0) return null;
3730
- if (mode === "since" && spanMs < JUST_NOW_MS) return "Just now";
3731
3746
  const { value, unit } = measureSpan(spanMs);
3732
- if (mode === "until") {
3733
- return new Intl.NumberFormat(locale, { style: "unit", unit, unitDisplay: "long" }).format(
3734
- value
3735
- );
3736
- }
3737
- return new Intl.RelativeTimeFormat(locale, { numeric: "always" }).format(-value, unit);
3747
+ return new Intl.NumberFormat(locale, { style: "unit", unit, unitDisplay: "long" }).format(value);
3748
+ }
3749
+ function DatePlaceholder({
3750
+ label,
3751
+ className,
3752
+ ...props
3753
+ }) {
3754
+ return /* @__PURE__ */ jsxs("span", { className: cn(styles57["format-date"], className), ...props, children: [
3755
+ /* @__PURE__ */ jsx("span", { className: styles57["visually-hidden"], children: label }),
3756
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: NO_DATE_PLACEHOLDER })
3757
+ ] });
3738
3758
  }
3739
3759
  function FormatDate({
3740
3760
  date,
@@ -3759,7 +3779,7 @@ function FormatDate({
3759
3779
  return () => clearInterval(id);
3760
3780
  }, [isAbsolute, live]);
3761
3781
  if (missing) {
3762
- return /* @__PURE__ */ jsx("span", { className: cn(styles57["format-date"], className), "aria-label": "No date", ...props, children: NO_DATE_PLACEHOLDER });
3782
+ return /* @__PURE__ */ jsx(DatePlaceholder, { label: "No date", className, ...props });
3763
3783
  }
3764
3784
  if (!parsed) {
3765
3785
  return /* @__PURE__ */ jsx("span", { className: cn(styles57["format-date"], className), ...props, children: "Invalid date" });
@@ -3774,17 +3794,9 @@ function FormatDate({
3774
3794
  if (isAbsolute) {
3775
3795
  return /* @__PURE__ */ jsx("time", { dateTime: machineValue, className: cn(styles57["format-date"], className), ...props, children: absolute });
3776
3796
  }
3777
- const measured = !mounted ? absolute : displayAs === "relative" ? formatRelative(parsed, now, locale) : formatDirected(parsed, now, displayAs, locale);
3797
+ const measured = !mounted ? absolute : displayAs === "relative" ? formatRelative(parsed, now, locale) : formatCountdown(parsed, now, locale);
3778
3798
  if (measured === null) {
3779
- return /* @__PURE__ */ jsx(
3780
- "span",
3781
- {
3782
- className: cn(styles57["format-date"], className),
3783
- "aria-label": displayAs === "until" ? "Date has passed" : "Date not yet reached",
3784
- ...props,
3785
- children: NO_DATE_PLACEHOLDER
3786
- }
3787
- );
3799
+ return /* @__PURE__ */ jsx(DatePlaceholder, { label: "Date has passed", className, ...props });
3788
3800
  }
3789
3801
  if (!tooltip) {
3790
3802
  return /* @__PURE__ */ jsx("time", { dateTime: machineValue, className: cn(styles57["format-date"], className), ...props, children: measured });