@jobber/components 8.23.1 → 8.24.1

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.
@@ -41,6 +41,7 @@ function deconstructCssCustomProperty(color) {
41
41
  .trim();
42
42
  }
43
43
 
44
+ const MAX_VISIBLE_INITIALS = 3;
44
45
  function Avatar({ imageUrl, name, initials, size = "base", color, UNSAFE_className = {}, UNSAFE_style = {}, }) {
45
46
  const style = Object.assign({ backgroundColor: color, borderColor: color }, UNSAFE_style.container);
46
47
  if (imageUrl) {
@@ -72,9 +73,9 @@ function Initials({ initials, iconColor = "textReverse", iconSize = "base", UNSA
72
73
  return (React.createElement(Icon.Icon, { name: "person", color: iconColor, size: iconSize, UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.fallbackIcon, UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.fallbackIcon }));
73
74
  }
74
75
  const className = classnames(styles.initials, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.initials, {
75
- [styles.smallInitials]: initials.length > 2,
76
+ [styles.smallInitials]: initials.length >= MAX_VISIBLE_INITIALS,
76
77
  });
77
- return (React.createElement("span", { className: className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.initials }, initials.substr(0, 3)));
78
+ return (React.createElement("span", { className: className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.initials }, initials.slice(0, MAX_VISIBLE_INITIALS)));
78
79
  }
79
80
 
80
81
  exports.Avatar = Avatar;
package/dist/Avatar-es.js CHANGED
@@ -39,6 +39,7 @@ function deconstructCssCustomProperty(color) {
39
39
  .trim();
40
40
  }
41
41
 
42
+ const MAX_VISIBLE_INITIALS = 3;
42
43
  function Avatar({ imageUrl, name, initials, size = "base", color, UNSAFE_className = {}, UNSAFE_style = {}, }) {
43
44
  const style = Object.assign({ backgroundColor: color, borderColor: color }, UNSAFE_style.container);
44
45
  if (imageUrl) {
@@ -70,9 +71,9 @@ function Initials({ initials, iconColor = "textReverse", iconSize = "base", UNSA
70
71
  return (React__default.createElement(Icon, { name: "person", color: iconColor, size: iconSize, UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.fallbackIcon, UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.fallbackIcon }));
71
72
  }
72
73
  const className = classnames(styles.initials, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.initials, {
73
- [styles.smallInitials]: initials.length > 2,
74
+ [styles.smallInitials]: initials.length >= MAX_VISIBLE_INITIALS,
74
75
  });
75
- return (React__default.createElement("span", { className: className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.initials }, initials.substr(0, 3)));
76
+ return (React__default.createElement("span", { className: className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.initials }, initials.slice(0, MAX_VISIBLE_INITIALS)));
76
77
  }
77
78
 
78
79
  export { Avatar as A };
@@ -1,7 +1,10 @@
1
1
  import type React from "react";
2
2
  import type { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
- import type { Placement } from "@react-types/overlays";
3
+ import type { MenuPositionerProps } from "@base-ui/react/menu";
4
4
  import type { IconProps } from "../Icon";
5
+ export type MenuSide = NonNullable<MenuPositionerProps["side"]>;
6
+ export type MenuAlign = NonNullable<MenuPositionerProps["align"]>;
7
+ export type MenuPlacement = MenuSide | `${MenuSide} ${MenuAlign}`;
5
8
  export interface BaseProps {
6
9
  /**
7
10
  * @deprecated Use `style` instead.
@@ -49,7 +52,7 @@ export interface ComposableMenuItemIconProps extends IconProps {
49
52
  }
50
53
  export interface ComposableMenuContentProps extends BaseProps {
51
54
  readonly children: ReactNode;
52
- readonly preferredPlacement?: Placement;
55
+ readonly preferredPlacement?: MenuPlacement;
53
56
  }
54
57
  export interface ComposableMenuSubmenuContentProps extends BaseProps {
55
58
  readonly children: ReactNode;
package/dist/Menu-cjs.js CHANGED
@@ -740,7 +740,8 @@ function MenuDropdownContent({ children, style, className, preferredPlacement, U
740
740
  UNSAFE_className,
741
741
  UNSAFE_style,
742
742
  });
743
- const [side = "bottom", align = "start"] = (_a = preferredPlacement === null || preferredPlacement === void 0 ? void 0 : preferredPlacement.split(" ")) !== null && _a !== void 0 ? _a : [];
743
+ // Safe assertion: MenuPlacement is a bare side or a "side align" pair.
744
+ const [side = "bottom", align = "start"] = ((_a = preferredPlacement === null || preferredPlacement === void 0 ? void 0 : preferredPlacement.split(" ")) !== null && _a !== void 0 ? _a : []);
744
745
  const floatingLayerStyle = getFloatingLayerStyle(resolvedBaseProps.style);
745
746
  const popupStyle = getMenuPopupStyle(resolvedBaseProps.style);
746
747
  return (React.createElement(MenuSubmenuTrigger$1.MenuPortal, null,
package/dist/Menu-es.js CHANGED
@@ -738,7 +738,8 @@ function MenuDropdownContent({ children, style, className, preferredPlacement, U
738
738
  UNSAFE_className,
739
739
  UNSAFE_style,
740
740
  });
741
- const [side = "bottom", align = "start"] = (_a = preferredPlacement === null || preferredPlacement === void 0 ? void 0 : preferredPlacement.split(" ")) !== null && _a !== void 0 ? _a : [];
741
+ // Safe assertion: MenuPlacement is a bare side or a "side align" pair.
742
+ const [side = "bottom", align = "start"] = ((_a = preferredPlacement === null || preferredPlacement === void 0 ? void 0 : preferredPlacement.split(" ")) !== null && _a !== void 0 ? _a : []);
742
743
  const floatingLayerStyle = getFloatingLayerStyle(resolvedBaseProps.style);
743
744
  const popupStyle = getMenuPopupStyle(resolvedBaseProps.style);
744
745
  return (React__default.createElement(MenuPortal$1, null,
@@ -266,6 +266,10 @@ A structural container for menu content. It typically contains one or more
266
266
  `Menu.GroupLabel`, and `Menu.Separator`.
267
267
 
268
268
  Use `preferredPlacement` to influence desktop dropdown placement when needed.
269
+ Values follow Base UI's positioner vocabulary: a side (`top`, `bottom`, `left`,
270
+ `right`, `inline-start`, `inline-end`), optionally followed by an alignment
271
+ (`start`, `center`, `end`) — for example `"bottom"`, `"bottom end"`, or
272
+ `"right start"`. When omitted, the menu opens at `"bottom start"`.
269
273
 
270
274
  ***Menu.Item (Strongly recommended)***
271
275
 
@@ -464,7 +468,7 @@ and should not be used for new implementations.
464
468
  | Prop | Type | Required | Default | Description |
465
469
  |------|------|----------|---------|-------------|
466
470
  | `className` | `string` | No | — | |
467
- | `preferredPlacement` | `Placement` | No | — | |
471
+ | `preferredPlacement` | `MenuPlacement` | No | — | |
468
472
  | `style` | `CSSProperties` | No | — | |
469
473
  | `UNSAFE_className` | `string` | No | — | @deprecated Use `className` instead. This is kept for backward compatibility on the composable Menu pieces. |
470
474
  | `UNSAFE_style` | `CSSProperties` | No | — | @deprecated Use `style` instead. This is kept for backward compatibility on the composable Menu pieces. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "8.23.1",
3
+ "version": "8.24.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -463,7 +463,6 @@
463
463
  "@floating-ui/react": "^0.27.5",
464
464
  "@floating-ui/utils": "0.2.11",
465
465
  "@jobber/formatters": "^0.5.0",
466
- "@react-types/overlays": "^3.9.4",
467
466
  "@tanstack/react-table": "8.5.13",
468
467
  "@types/color": "^3.0.1",
469
468
  "@types/lodash": "^4.14.136",
@@ -541,5 +540,5 @@
541
540
  "> 1%",
542
541
  "IE 10"
543
542
  ],
544
- "gitHead": "4ff53473f675f2194aaa2834e83a86b160c3ee16"
543
+ "gitHead": "b17211eb3d332daef1d38c66b5677c30598331f3"
545
544
  }