@mieweb/ui 0.7.2-dev.1 → 0.7.2-dev.2

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
@@ -3722,6 +3722,8 @@ interface CountBadgeProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonEl
3722
3722
  deleteLabel?: string;
3723
3723
  /** Independent variant for the count chip. When set, overrides `variant` for just the number. */
3724
3724
  countVariant?: VariantProps<typeof countChipVariants>['variant'];
3725
+ /** Render the badge even when `count` is 0. By default zero-count badges are hidden. */
3726
+ showZero?: boolean;
3725
3727
  }
3726
3728
  /**
3727
3729
  * A pill-shaped badge with a label and count chip, ideal for navigation
@@ -7452,6 +7454,8 @@ interface PatientHeaderProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
7452
7454
  maxVisibleMeds?: number;
7453
7455
  /** Show the patient-level overflow menu to the right of count badges (default: false) */
7454
7456
  showOverflowMenu?: boolean;
7457
+ /** Whether to show the count badges in the actions slot (default: true). Zero-count badges are hidden by default (see CountBadge `showZero`). */
7458
+ showCountBadges?: boolean;
7455
7459
  /** Called when a patient overflow menu action is selected */
7456
7460
  onOverflowAction?: (action: PatientOverflowAction) => void;
7457
7461
  /** Called when an 'Add' modal is submitted from the overflow menu */
package/dist/index.d.ts CHANGED
@@ -3722,6 +3722,8 @@ interface CountBadgeProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonEl
3722
3722
  deleteLabel?: string;
3723
3723
  /** Independent variant for the count chip. When set, overrides `variant` for just the number. */
3724
3724
  countVariant?: VariantProps<typeof countChipVariants>['variant'];
3725
+ /** Render the badge even when `count` is 0. By default zero-count badges are hidden. */
3726
+ showZero?: boolean;
3725
3727
  }
3726
3728
  /**
3727
3729
  * A pill-shaped badge with a label and count chip, ideal for navigation
@@ -7452,6 +7454,8 @@ interface PatientHeaderProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
7452
7454
  maxVisibleMeds?: number;
7453
7455
  /** Show the patient-level overflow menu to the right of count badges (default: false) */
7454
7456
  showOverflowMenu?: boolean;
7457
+ /** Whether to show the count badges in the actions slot (default: true). Zero-count badges are hidden by default (see CountBadge `showZero`). */
7458
+ showCountBadges?: boolean;
7455
7459
  /** Called when a patient overflow menu action is selected */
7456
7460
  onOverflowAction?: (action: PatientOverflowAction) => void;
7457
7461
  /** Called when an 'Add' modal is submitted from the overflow menu */
package/dist/index.js CHANGED
@@ -127,7 +127,7 @@ import { cn } from './chunk-TQONQSJO.js';
127
127
  export { cn, miewebUITwMergeConflicts } from './chunk-TQONQSJO.js';
128
128
  import { isStorybookDocsMode } from './chunk-VSQF22GL.js';
129
129
  export { isStorybookDocsMode } from './chunk-VSQF22GL.js';
130
- export { miewebUIPreset, miewebUISafelist } from './chunk-DWIF6VXZ.js';
130
+ export { miewebUIPreset, miewebUISafelist } from './chunk-TK4I5UHV.js';
131
131
  import * as React10 from 'react';
132
132
  import React10__default, { createContext, useState, useEffect, useCallback, useMemo, useContext, useRef } from 'react';
133
133
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -13885,6 +13885,7 @@ var CountBadge = React10.forwardRef(
13885
13885
  onDelete,
13886
13886
  deleteLabel,
13887
13887
  countVariant,
13888
+ showZero = false,
13888
13889
  ...props
13889
13890
  }, ref) => {
13890
13891
  const [open, setOpen] = React10.useState(false);
@@ -13898,6 +13899,10 @@ var CountBadge = React10.forwardRef(
13898
13899
  null
13899
13900
  );
13900
13901
  const showMenu = items && items.length > 0;
13902
+ const hidden = count === 0 && !showZero;
13903
+ React10.useEffect(() => {
13904
+ if (hidden) setOpen(false);
13905
+ }, [hidden]);
13901
13906
  const {
13902
13907
  anchorRef,
13903
13908
  floatingRef,
@@ -13943,6 +13948,7 @@ var CountBadge = React10.forwardRef(
13943
13948
  onDelete ? handleDeleteRequest : void 0
13944
13949
  );
13945
13950
  const entityLabel = deleteLabel ?? "item";
13951
+ if (hidden) return null;
13946
13952
  return /* @__PURE__ */ jsxs(Fragment, { children: [
13947
13953
  /* @__PURE__ */ jsxs(
13948
13954
  "div",
@@ -13951,6 +13957,7 @@ var CountBadge = React10.forwardRef(
13951
13957
  containerRef.current = node;
13952
13958
  anchorRef.current = node;
13953
13959
  },
13960
+ "data-slot": "count-badge-root",
13954
13961
  className: "relative inline-flex",
13955
13962
  children: [
13956
13963
  /* @__PURE__ */ jsxs(
@@ -28059,6 +28066,7 @@ var PatientHeader = React10.forwardRef(
28059
28066
  showProviderBanner = false,
28060
28067
  showFlagBanner = false,
28061
28068
  showOverflowMenu = false,
28069
+ showCountBadges = true,
28062
28070
  onOverflowAction,
28063
28071
  onAddItem,
28064
28072
  onEditPatient,
@@ -28162,7 +28170,9 @@ var PatientHeader = React10.forwardRef(
28162
28170
  "order-4 w-full md:order-2 md:w-auto md:shrink-0",
28163
28171
  "mt-1 md:mt-0",
28164
28172
  "[&_button[data-count-badge]]:gap-1.5 [&_button[data-count-badge]]:px-2 [&_button[data-count-badge]]:py-0.5 [&_button[data-count-badge]]:text-xs",
28165
- "md:[&_button[data-count-badge]]:gap-2 md:[&_button[data-count-badge]]:px-3 md:[&_button[data-count-badge]]:py-1 md:[&_button[data-count-badge]]:text-sm"
28173
+ "md:[&_button[data-count-badge]]:gap-2 md:[&_button[data-count-badge]]:px-3 md:[&_button[data-count-badge]]:py-1 md:[&_button[data-count-badge]]:text-sm",
28174
+ // Hide count badges (but not other custom actions) when disabled
28175
+ !showCountBadges && "[&_[data-slot=count-badge-root]]:hidden"
28166
28176
  ),
28167
28177
  children: actions
28168
28178
  }