@homebound/beam 4.4.0 → 4.5.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
@@ -10686,6 +10686,7 @@ function MenuItemImpl(props) {
10686
10686
  },
10687
10687
  onClose
10688
10688
  }, state, ref);
10689
+ const itemTid = useTestIds(tid[defaultTestId(menuItem?.label ?? "item")]);
10689
10690
  if (!menuItem) {
10690
10691
  return null;
10691
10692
  }
@@ -10751,18 +10752,30 @@ function MenuItemImpl(props) {
10751
10752
  fontWeight: "fw5"
10752
10753
  } : {}
10753
10754
  }),
10754
- ...tid[defaultTestId(menuItem.label)],
10755
+ ...itemTid,
10755
10756
  children: maybeTooltip({
10756
10757
  title: resolveTooltip(disabled),
10757
10758
  placement: "right",
10758
- children: renderMenuItem(menuItem, isSelected, isDisabled)
10759
+ children: renderMenuItem(menuItem, isSelected, isDisabled, itemTid)
10759
10760
  })
10760
10761
  }
10761
10762
  );
10762
10763
  }
10763
- function renderMenuItem(menuItem, isSelected, isDisabled) {
10764
+ function renderMenuItem(menuItem, isSelected, isDisabled, itemTid) {
10765
+ const showDescription = menuItem.description != null;
10766
+ const body = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ...(0, import_runtime27.trussProps)(showDescription ? {
10767
+ display: "df",
10768
+ flexDirection: "fdc",
10769
+ width: "w100"
10770
+ } : {
10771
+ display: "df",
10772
+ alignItems: "aic"
10773
+ }), children: [
10774
+ menuItem.ai ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AiMenuItem, { label: menuItem.label, isDisabled }) : isIconMenuItem(menuItem) ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(IconMenuItem, { ...menuItem }) : isImageMenuItem(menuItem) ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageMenuItem, { ...menuItem }) : menuItem.label,
10775
+ showDescription && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "fw4 fz_10px lh_14px", ...itemTid.description, children: menuItem.description })
10776
+ ] });
10764
10777
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "df w100 aic jcsb gap2", children: [
10765
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "df aic", children: maybeWrapInLink(menuItem.onClick, menuItem.ai ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AiMenuItem, { label: menuItem.label, isDisabled }) : isIconMenuItem(menuItem) ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(IconMenuItem, { ...menuItem }) : isImageMenuItem(menuItem) ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageMenuItem, { ...menuItem }) : menuItem.label, isDisabled) }),
10778
+ maybeWrapInLink(menuItem.onClick, body, isDisabled),
10766
10779
  isSelected && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { icon: "check", color: isDisabled ? "--b-text-disabled" /* TextDisabled */ : "--b-selection-indicator" /* SelectionIndicator */ })
10767
10780
  ] });
10768
10781
  }
@@ -10817,7 +10830,8 @@ function maybeWrapInLink(onClick, content2, disabled) {
10817
10830
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "fs0 ml2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { icon: "linkExternal" }) })
10818
10831
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_router_dom3.Link, { ...(0, import_runtime27.mergeProps)("navLink", void 0, {
10819
10832
  display: "df",
10820
- alignItems: "aic"
10833
+ alignItems: "aic",
10834
+ width: "w100"
10821
10835
  }), to: onClick, children: content2 });
10822
10836
  }
10823
10837
  function wantsNewTab(e) {
@@ -11605,7 +11619,8 @@ function Menu(props) {
11605
11619
  onClose,
11606
11620
  searchable,
11607
11621
  selectedItem,
11608
- onChange
11622
+ onChange,
11623
+ header
11609
11624
  } = props;
11610
11625
  const tree = (0, import_react_stately3.useTreeData)({
11611
11626
  initialItems: [items, persistentItems ? persistentItems : []].map((i, idx) => ({
@@ -11694,6 +11709,18 @@ function Menu(props) {
11694
11709
  overflow: "h_oa"
11695
11710
  }),
11696
11711
  children: [
11712
+ header && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { ...(0, import_runtime32.trussProps)({
11713
+ paddingLeft: "pl2",
11714
+ paddingRight: "pr2",
11715
+ paddingTop: "pt_12px",
11716
+ paddingBottom: "pb_12px",
11717
+ borderBottomStyle: "bbs_solid",
11718
+ borderBottomWidth: "bbw_1px",
11719
+ borderColor: ["bc_var", {
11720
+ "--borderColor": "var(--b-surface-separator)"
11721
+ }],
11722
+ minWidth: "mw_240px"
11723
+ }), ...tid.header, children: header }),
11697
11724
  searchable && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MenuSearchField, { label: "", value: search, placeholder: "Search...", labelStyle: "inline", onChange: setSearch, ...tid }),
11698
11725
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("ul", { className: "p_0 m_0 lis_none outline0", ...menuProps, ref: menuRef, ...tid.menu, children: [...state.collection].map((item) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MenuSectionImpl, { section: item, state, onClose, ...tid }, item.key)) })
11699
11726
  ]
@@ -11824,6 +11851,7 @@ function Button(props) {
11824
11851
  forceFocusStyles = false,
11825
11852
  active = false,
11826
11853
  labelInFlight,
11854
+ colorScheme,
11827
11855
  ...otherProps
11828
11856
  } = props;
11829
11857
  const asLink = typeof onPress === "string";
@@ -11875,7 +11903,7 @@ function Button(props) {
11875
11903
  disabledStyles: disabledStyles3,
11876
11904
  pressedStyles: pressedStyles2,
11877
11905
  focusStyles: focusStyles2
11878
- } = (0, import_react41.useMemo)(() => getButtonStyles(variant, size), [variant, size]);
11906
+ } = (0, import_react41.useMemo)(() => getButtonStyles(variant, size, colorScheme), [variant, size, colorScheme]);
11879
11907
  const buttonContent = /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
11880
11908
  icon && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { xss: iconStyles[size], icon }),
11881
11909
  labelInFlight && asyncInProgress ? labelInFlight : label,
@@ -11918,8 +11946,8 @@ function Button(props) {
11918
11946
  children: getButtonOrLink(buttonContent, onPress, buttonAttrs, openInNew, download)
11919
11947
  });
11920
11948
  }
11921
- function getButtonStyles(variant, size) {
11922
- const styles = variantStyles2[variant];
11949
+ function getButtonStyles(variant, size, colorScheme) {
11950
+ const styles = variant === "secondary" && colorScheme ? colorSchemeStyles[colorScheme] : variantStyles2[variant];
11923
11951
  if (variant === "text") {
11924
11952
  return styles;
11925
11953
  }
@@ -12275,6 +12303,95 @@ var variantStyles2 = {
12275
12303
  }
12276
12304
  }
12277
12305
  };
12306
+ var colorSchemeStyles = {
12307
+ neutral: {
12308
+ baseStyles: {
12309
+ backgroundColor: "bgGray100",
12310
+ borderColor: "bcGray600",
12311
+ borderWidth: "bw1",
12312
+ borderStyle: "bss",
12313
+ color: ["color_var", {
12314
+ "--color": "var(--b-on-surface)"
12315
+ }]
12316
+ },
12317
+ hoverStyles: {
12318
+ backgroundColor: "bgGray200",
12319
+ borderColor: "bcGray700"
12320
+ },
12321
+ pressedStyles: {
12322
+ backgroundColor: "bgGray300",
12323
+ borderColor: "bcGray800"
12324
+ },
12325
+ disabledStyles: {
12326
+ backgroundColor: "bgGray100",
12327
+ borderColor: "bcGray400",
12328
+ color: ["color_var", {
12329
+ "--color": "var(--b-text-link-disabled)"
12330
+ }]
12331
+ },
12332
+ focusStyles: {
12333
+ boxShadow: "bshFocus"
12334
+ }
12335
+ },
12336
+ info: {
12337
+ baseStyles: {
12338
+ backgroundColor: "bgBlue50",
12339
+ borderColor: "bcBlue600",
12340
+ borderWidth: "bw1",
12341
+ borderStyle: "bss",
12342
+ color: ["color_var", {
12343
+ "--color": "var(--b-on-surface)"
12344
+ }]
12345
+ },
12346
+ hoverStyles: {
12347
+ backgroundColor: "bgBlue100",
12348
+ borderColor: "bcBlue700"
12349
+ },
12350
+ pressedStyles: {
12351
+ backgroundColor: "bgBlue200",
12352
+ borderColor: "bcBlue800"
12353
+ },
12354
+ disabledStyles: {
12355
+ backgroundColor: "bgBlue50",
12356
+ borderColor: "bcBlue300",
12357
+ color: ["color_var", {
12358
+ "--color": "var(--b-text-link-disabled)"
12359
+ }]
12360
+ },
12361
+ focusStyles: {
12362
+ boxShadow: "bshFocus"
12363
+ }
12364
+ },
12365
+ success: {
12366
+ baseStyles: {
12367
+ backgroundColor: "bgGreen50",
12368
+ borderColor: "bcGreen600",
12369
+ borderWidth: "bw1",
12370
+ borderStyle: "bss",
12371
+ color: ["color_var", {
12372
+ "--color": "var(--b-on-surface)"
12373
+ }]
12374
+ },
12375
+ hoverStyles: {
12376
+ backgroundColor: "bgGreen100",
12377
+ borderColor: "bcGreen700"
12378
+ },
12379
+ pressedStyles: {
12380
+ backgroundColor: "bgGreen200",
12381
+ borderColor: "bcGreen800"
12382
+ },
12383
+ disabledStyles: {
12384
+ backgroundColor: "bgGreen50",
12385
+ borderColor: "bcGreen300",
12386
+ color: ["color_var", {
12387
+ "--color": "var(--b-text-link-disabled)"
12388
+ }]
12389
+ },
12390
+ focusStyles: {
12391
+ boxShadow: "bshFocus"
12392
+ }
12393
+ }
12394
+ };
12278
12395
  var sizeStyles = {
12279
12396
  sm: {
12280
12397
  height: "h_32px",
@@ -12634,7 +12751,7 @@ function labelOr(trigger, fallback) {
12634
12751
  // src/components/ButtonMenu.tsx
12635
12752
  var import_jsx_runtime44 = require("react/jsx-runtime");
12636
12753
  function ButtonMenu(props) {
12637
- const { defaultOpen, disabled, items, persistentItems, trigger, searchable } = props;
12754
+ const { defaultOpen, disabled, items, persistentItems, trigger, searchable, header } = props;
12638
12755
  let selectedItem, onChange;
12639
12756
  if (isSelectionButtonMenuProps(props)) {
12640
12757
  selectedItem = props.selectedItem;
@@ -12657,6 +12774,7 @@ function ButtonMenu(props) {
12657
12774
  searchable,
12658
12775
  selectedItem,
12659
12776
  onChange,
12777
+ header,
12660
12778
  ...tid
12661
12779
  }
12662
12780
  ) });