achery-ui 0.11.1 → 0.12.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
@@ -2192,8 +2192,17 @@ function NavGroup({ label: label4, items, activeId, onItemClick, renderLink, col
2192
2192
  ] });
2193
2193
  }
2194
2194
  function NavItem({ item: item2, active, onClick, renderLink, collapsed }) {
2195
+ const leading = item2.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", style: { display: "inline-flex" }, children: item2.icon }) : item2.glyph ? /* @__PURE__ */ jsxRuntime.jsx(
2196
+ Glyph,
2197
+ {
2198
+ name: item2.glyph,
2199
+ size: 14,
2200
+ "aria-hidden": "true",
2201
+ ...item2.iconColor ? { style: { color: item2.iconColor } } : {}
2202
+ }
2203
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", {});
2195
2204
  const content3 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2196
- item2.glyph ? /* @__PURE__ */ jsxRuntime.jsx(Glyph, { name: item2.glyph, size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
2205
+ leading,
2197
2206
  !collapsed && /* @__PURE__ */ jsxRuntime.jsx("span", { children: item2.label }),
2198
2207
  !collapsed && item2.count !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: item2.countTone === "accent" ? countAccent : navItemCount, children: item2.count })
2199
2208
  ] });
@@ -3441,7 +3450,7 @@ var SegmentedControl = ({
3441
3450
  role: "radio",
3442
3451
  "aria-checked": opt.value === value2,
3443
3452
  disabled,
3444
- onClick: () => onChange(opt.value),
3453
+ onClick: () => onChange(opt.value === value2 ? null : opt.value),
3445
3454
  className: [
3446
3455
  segment,
3447
3456
  sizeClass,
@@ -3452,6 +3461,20 @@ var SegmentedControl = ({
3452
3461
  opt.value
3453
3462
  )) });
3454
3463
  };
3464
+ var useMediaQuery = (query) => {
3465
+ const [matches, setMatches] = react.useState(
3466
+ () => typeof window !== "undefined" ? window.matchMedia(query).matches : false
3467
+ );
3468
+ react.useEffect(() => {
3469
+ const mq = window.matchMedia(query);
3470
+ setMatches(mq.matches);
3471
+ const handler = (e) => setMatches(e.matches);
3472
+ mq.addEventListener("change", handler);
3473
+ return () => mq.removeEventListener("change", handler);
3474
+ }, [query]);
3475
+ return matches;
3476
+ };
3477
+ var useIsDesktop = (breakpoint = 768) => useMediaQuery(`(min-width: ${breakpoint}px)`);
3455
3478
 
3456
3479
  exports.AcheryProvider = AcheryProvider;
3457
3480
  exports.AppBar = AppBar;
@@ -3503,6 +3526,8 @@ exports.glyphCategory = glyphCategory;
3503
3526
  exports.glyphLabel = glyphLabel;
3504
3527
  exports.searchGlyphs = searchGlyphs;
3505
3528
  exports.useConfirm = useConfirm;
3529
+ exports.useIsDesktop = useIsDesktop;
3530
+ exports.useMediaQuery = useMediaQuery;
3506
3531
  exports.useTheme = useTheme;
3507
3532
  exports.useToast = useToast;
3508
3533
  exports.vars = vars;