@vector-im/compound-web 7.7.1 → 7.8.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.
Files changed (55) hide show
  1. package/dist/components/ActivityMarker/Pill.cjs +12 -0
  2. package/dist/components/ActivityMarker/Pill.cjs.map +1 -0
  3. package/dist/components/ActivityMarker/Pill.d.ts +3 -0
  4. package/dist/components/ActivityMarker/Pill.d.ts.map +1 -0
  5. package/dist/components/ActivityMarker/Pill.js +12 -0
  6. package/dist/components/ActivityMarker/Pill.js.map +1 -0
  7. package/dist/components/ActivityMarker/Pill.module.css.cjs +9 -0
  8. package/dist/components/ActivityMarker/Pill.module.css.cjs.map +1 -0
  9. package/dist/components/ActivityMarker/Pill.module.css.js +9 -0
  10. package/dist/components/ActivityMarker/Pill.module.css.js.map +1 -0
  11. package/dist/components/ActivityMarker/Unread.cjs +9 -0
  12. package/dist/components/ActivityMarker/Unread.cjs.map +1 -0
  13. package/dist/components/ActivityMarker/Unread.d.ts +3 -0
  14. package/dist/components/ActivityMarker/Unread.d.ts.map +1 -0
  15. package/dist/components/ActivityMarker/Unread.js +9 -0
  16. package/dist/components/ActivityMarker/Unread.js.map +1 -0
  17. package/dist/components/ActivityMarker/Unread.module.css.cjs +9 -0
  18. package/dist/components/ActivityMarker/Unread.module.css.cjs.map +1 -0
  19. package/dist/components/ActivityMarker/Unread.module.css.js +9 -0
  20. package/dist/components/ActivityMarker/Unread.module.css.js.map +1 -0
  21. package/dist/components/ActivityMarker/UnreadCounter.cjs +9 -0
  22. package/dist/components/ActivityMarker/UnreadCounter.cjs.map +1 -0
  23. package/dist/components/ActivityMarker/UnreadCounter.d.ts +7 -0
  24. package/dist/components/ActivityMarker/UnreadCounter.d.ts.map +1 -0
  25. package/dist/components/ActivityMarker/UnreadCounter.js +9 -0
  26. package/dist/components/ActivityMarker/UnreadCounter.js.map +1 -0
  27. package/dist/components/ActivityMarker/UnreadCounter.module.css.cjs +7 -0
  28. package/dist/components/ActivityMarker/UnreadCounter.module.css.cjs.map +1 -0
  29. package/dist/components/ActivityMarker/UnreadCounter.module.css.js +7 -0
  30. package/dist/components/ActivityMarker/UnreadCounter.module.css.js.map +1 -0
  31. package/dist/components/ActivityMarker/index.d.ts +4 -0
  32. package/dist/components/ActivityMarker/index.d.ts.map +1 -0
  33. package/dist/components/Menu/CheckboxMenuItem.d.ts +1 -1
  34. package/dist/components/Menu/MenuItem.cjs.map +1 -1
  35. package/dist/components/Menu/MenuItem.d.ts +1 -1
  36. package/dist/components/Menu/MenuItem.d.ts.map +1 -1
  37. package/dist/components/Menu/MenuItem.js.map +1 -1
  38. package/dist/components/Menu/ToggleMenuItem.d.ts +1 -1
  39. package/dist/index.cjs +6 -0
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +6 -0
  44. package/dist/index.js.map +1 -1
  45. package/dist/style.css +56 -0
  46. package/package.json +1 -1
  47. package/src/components/ActivityMarker/Pill.module.css +17 -0
  48. package/src/components/ActivityMarker/Pill.tsx +20 -0
  49. package/src/components/ActivityMarker/Unread.module.css +19 -0
  50. package/src/components/ActivityMarker/Unread.tsx +17 -0
  51. package/src/components/ActivityMarker/UnreadCounter.module.css +20 -0
  52. package/src/components/ActivityMarker/UnreadCounter.tsx +21 -0
  53. package/src/components/ActivityMarker/index.ts +10 -0
  54. package/src/components/Menu/MenuItem.tsx +1 -1
  55. package/src/index.ts +1 -0
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const Pill_module = require("./Pill.module.css.cjs");
5
+ function Pill({
6
+ children,
7
+ ...props
8
+ }) {
9
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { ...props, className: Pill_module.default.pill, children });
10
+ }
11
+ exports.Pill = Pill;
12
+ //# sourceMappingURL=Pill.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pill.cjs","sources":["../../../src/components/ActivityMarker/Pill.tsx"],"sourcesContent":["/*\n * Copyright 2025 New Vector Ltd\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport React, { HTMLProps, JSX } from \"react\";\nimport styles from \"./Pill.module.css\";\n\nexport function Pill({\n children,\n ...props\n}: HTMLProps<HTMLSpanElement>): JSX.Element {\n return (\n <span {...props} className={styles.pill}>\n {children}\n </span>\n );\n}\n"],"names":["styles"],"mappings":";;;;AAUO,SAAS,KAAK;AAAA,EACnB;AAAA,EACA,GAAG;AACL,GAA4C;AAC1C,wCACG,QAAM,EAAA,GAAG,OAAO,WAAWA,YAAA,QAAO,MAChC,UACH;AAEJ;;"}
@@ -0,0 +1,3 @@
1
+ import { HTMLProps, JSX } from 'react';
2
+ export declare function Pill({ children, ...props }: HTMLProps<HTMLSpanElement>): JSX.Element;
3
+ //# sourceMappingURL=Pill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pill.d.ts","sourceRoot":"","sources":["../../../src/components/ActivityMarker/Pill.tsx"],"names":[],"mappings":"AAOA,OAAc,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG9C,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,SAAS,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC,OAAO,CAM1C"}
@@ -0,0 +1,12 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styles from "./Pill.module.css.js";
3
+ function Pill({
4
+ children,
5
+ ...props
6
+ }) {
7
+ return /* @__PURE__ */ jsx("span", { ...props, className: styles.pill, children });
8
+ }
9
+ export {
10
+ Pill
11
+ };
12
+ //# sourceMappingURL=Pill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pill.js","sources":["../../../src/components/ActivityMarker/Pill.tsx"],"sourcesContent":["/*\n * Copyright 2025 New Vector Ltd\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport React, { HTMLProps, JSX } from \"react\";\nimport styles from \"./Pill.module.css\";\n\nexport function Pill({\n children,\n ...props\n}: HTMLProps<HTMLSpanElement>): JSX.Element {\n return (\n <span {...props} className={styles.pill}>\n {children}\n </span>\n );\n}\n"],"names":[],"mappings":";;AAUO,SAAS,KAAK;AAAA,EACnB;AAAA,EACA,GAAG;AACL,GAA4C;AAC1C,6BACG,QAAM,EAAA,GAAG,OAAO,WAAW,OAAO,MAChC,UACH;AAEJ;"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const pill = "_pill_1pem8_8";
4
+ const styles = {
5
+ pill
6
+ };
7
+ exports.default = styles;
8
+ exports.pill = pill;
9
+ //# sourceMappingURL=Pill.module.css.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pill.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -0,0 +1,9 @@
1
+ const pill = "_pill_1pem8_8";
2
+ const styles = {
3
+ pill
4
+ };
5
+ export {
6
+ styles as default,
7
+ pill
8
+ };
9
+ //# sourceMappingURL=Pill.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pill.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const Unread_module = require("./Unread.module.css.cjs");
5
+ function Unread(props) {
6
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, className: Unread_module.default.unread, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) });
7
+ }
8
+ exports.Unread = Unread;
9
+ //# sourceMappingURL=Unread.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Unread.cjs","sources":["../../../src/components/ActivityMarker/Unread.tsx"],"sourcesContent":["/*\n * Copyright 2025 New Vector Ltd\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport React, { HTMLProps } from \"react\";\nimport styles from \"./Unread.module.css\";\n\nexport function Unread(props: HTMLProps<HTMLDivElement>) {\n return (\n <div {...props} className={styles.unread}>\n <div />\n </div>\n );\n}\n"],"names":["jsx","styles"],"mappings":";;;;AAUO,SAAS,OAAO,OAAkC;AAErD,SAAAA,2BAAA,IAAC,SAAK,GAAG,OAAO,WAAWC,cAAAA,QAAO,QAChC,UAACD,2BAAA,IAAA,OAAA,CAAA,CAAI,EACP,CAAA;AAEJ;;"}
@@ -0,0 +1,3 @@
1
+ import { HTMLProps } from 'react';
2
+ export declare function Unread(props: HTMLProps<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=Unread.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Unread.d.ts","sourceRoot":"","sources":["../../../src/components/ActivityMarker/Unread.tsx"],"names":[],"mappings":"AAOA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,cAAc,CAAC,2CAMtD"}
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styles from "./Unread.module.css.js";
3
+ function Unread(props) {
4
+ return /* @__PURE__ */ jsx("div", { ...props, className: styles.unread, children: /* @__PURE__ */ jsx("div", {}) });
5
+ }
6
+ export {
7
+ Unread
8
+ };
9
+ //# sourceMappingURL=Unread.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Unread.js","sources":["../../../src/components/ActivityMarker/Unread.tsx"],"sourcesContent":["/*\n * Copyright 2025 New Vector Ltd\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport React, { HTMLProps } from \"react\";\nimport styles from \"./Unread.module.css\";\n\nexport function Unread(props: HTMLProps<HTMLDivElement>) {\n return (\n <div {...props} className={styles.unread}>\n <div />\n </div>\n );\n}\n"],"names":[],"mappings":";;AAUO,SAAS,OAAO,OAAkC;AAErD,SAAA,oBAAC,SAAK,GAAG,OAAO,WAAW,OAAO,QAChC,UAAC,oBAAA,OAAA,CAAA,CAAI,EACP,CAAA;AAEJ;"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const unread = "_unread_1k06b_8";
4
+ const styles = {
5
+ unread
6
+ };
7
+ exports.default = styles;
8
+ exports.unread = unread;
9
+ //# sourceMappingURL=Unread.module.css.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Unread.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -0,0 +1,9 @@
1
+ const unread = "_unread_1k06b_8";
2
+ const styles = {
3
+ unread
4
+ };
5
+ export {
6
+ styles as default,
7
+ unread
8
+ };
9
+ //# sourceMappingURL=Unread.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Unread.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const UnreadCounter_module = require("./UnreadCounter.module.css.cjs");
5
+ function UnreadCounter({ count, ...props }) {
6
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { ...props, className: UnreadCounter_module.default["unread-counter"], children: count });
7
+ }
8
+ exports.UnreadCounter = UnreadCounter;
9
+ //# sourceMappingURL=UnreadCounter.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnreadCounter.cjs","sources":["../../../src/components/ActivityMarker/UnreadCounter.tsx"],"sourcesContent":["/*\n * Copyright 2025 New Vector Ltd\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport React, { HTMLProps } from \"react\";\nimport styles from \"./UnreadCounter.module.css\";\n\ninterface UnreadCounterProps extends HTMLProps<HTMLSpanElement> {\n count: string | number;\n}\n\nexport function UnreadCounter({ count, ...props }: UnreadCounterProps) {\n return (\n <span {...props} className={styles[\"unread-counter\"]}>\n {count}\n </span>\n );\n}\n"],"names":["jsx","styles"],"mappings":";;;;AAcO,SAAS,cAAc,EAAE,OAAO,GAAG,SAA6B;AAEnE,SAAAA,+BAAC,UAAM,GAAG,OAAO,WAAWC,qBAAO,QAAA,gBAAgB,GAChD,UACH,OAAA;AAEJ;;"}
@@ -0,0 +1,7 @@
1
+ import { HTMLProps } from 'react';
2
+ interface UnreadCounterProps extends HTMLProps<HTMLSpanElement> {
3
+ count: string | number;
4
+ }
5
+ export declare function UnreadCounter({ count, ...props }: UnreadCounterProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=UnreadCounter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnreadCounter.d.ts","sourceRoot":"","sources":["../../../src/components/ActivityMarker/UnreadCounter.tsx"],"names":[],"mappings":"AAOA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,UAAU,kBAAmB,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC7D,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,2CAMpE"}
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import styles from "./UnreadCounter.module.css.js";
3
+ function UnreadCounter({ count, ...props }) {
4
+ return /* @__PURE__ */ jsx("span", { ...props, className: styles["unread-counter"], children: count });
5
+ }
6
+ export {
7
+ UnreadCounter
8
+ };
9
+ //# sourceMappingURL=UnreadCounter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnreadCounter.js","sources":["../../../src/components/ActivityMarker/UnreadCounter.tsx"],"sourcesContent":["/*\n * Copyright 2025 New Vector Ltd\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport React, { HTMLProps } from \"react\";\nimport styles from \"./UnreadCounter.module.css\";\n\ninterface UnreadCounterProps extends HTMLProps<HTMLSpanElement> {\n count: string | number;\n}\n\nexport function UnreadCounter({ count, ...props }: UnreadCounterProps) {\n return (\n <span {...props} className={styles[\"unread-counter\"]}>\n {count}\n </span>\n );\n}\n"],"names":[],"mappings":";;AAcO,SAAS,cAAc,EAAE,OAAO,GAAG,SAA6B;AAEnE,SAAA,oBAAC,UAAM,GAAG,OAAO,WAAW,OAAO,gBAAgB,GAChD,UACH,OAAA;AAEJ;"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const styles = {
4
+ "unread-counter": "_unread-counter_1ibqq_8"
5
+ };
6
+ exports.default = styles;
7
+ //# sourceMappingURL=UnreadCounter.module.css.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnreadCounter.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,7 @@
1
+ const styles = {
2
+ "unread-counter": "_unread-counter_1ibqq_8"
3
+ };
4
+ export {
5
+ styles as default
6
+ };
7
+ //# sourceMappingURL=UnreadCounter.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnreadCounter.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,4 @@
1
+ export { UnreadCounter } from './UnreadCounter.tsx';
2
+ export { Pill } from './Pill';
3
+ export { Unread } from './Unread';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ActivityMarker/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -10,7 +10,7 @@ export declare const CheckboxMenuItem: React.ForwardRefExoticComponent<Pick<{
10
10
  label: string | null;
11
11
  labelProps?: React.ComponentPropsWithoutRef<typeof import('../..').Text>;
12
12
  onSelect: ((e: Event) => void) | null;
13
- onClick?: React.MouseEventHandler<"a" | "button" | "div"> | undefined;
13
+ onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement> | undefined;
14
14
  kind?: "primary" | "critical";
15
15
  disabled?: boolean;
16
16
  hideChevron?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.cjs","sources":["../../../src/components/Menu/MenuItem.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, {\n ComponentPropsWithoutRef,\n ComponentType,\n ElementType,\n isValidElement,\n ReactElement,\n SVGAttributes,\n useCallback,\n useContext,\n MouseEventHandler,\n} from \"react\";\nimport styles from \"./MenuItem.module.css\";\nimport { Text } from \"../Typography/Text\";\nimport ChevronRightIcon from \"@vector-im/compound-design-tokens/assets/web/icons/chevron-right\";\nimport { MenuContext } from \"./MenuContext\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\ntype MenuItemElement = \"button\" | \"a\" | \"div\";\n\ntype Props<C extends MenuItemElement> = {\n /**\n * The element type of this menu item.\n * @default button\n */\n as?: C;\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The icon to show on this menu item.\n * When `Icon` is a ReactElement, it should spread the props\n */\n Icon: ComponentType<SVGAttributes<SVGElement>> | ReactElement;\n /**\n * The label to show on this menu item.\n */\n // This prop is required because it's rare to not want a label\n label: string | null;\n /**\n * Additional properties to pass to the Text label component.\n */\n labelProps?: ComponentPropsWithoutRef<typeof Text>;\n /**\n * Event callback for when the item is selected via mouse, touch, or keyboard.\n * Calling event.preventDefault in this handler will prevent the menu from\n * being dismissed.\n */\n // This prop is required because it's rare to not want a selection handler\n onSelect: ((e: Event) => void) | null;\n /**\n * Event callback for when the item is clicked.\n * @param e\n */\n onClick?: MouseEventHandler<C>;\n /**\n * The color variant of the menu item.\n * @default primary\n */\n kind?: \"primary\" | \"critical\";\n disabled?: boolean;\n /**\n * Whether to hide the chevron navigation hint.\n */\n hideChevron?: boolean;\n} & Omit<ComponentPropsWithoutRef<C>, \"onSelect\" | \"onClick\">;\n\n/**\n * An item within a menu, acting either as a navigation button, or simply a\n * container for other interactive elements.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const MenuItem = <C extends MenuItemElement = \"button\">({\n as,\n className,\n Icon,\n label,\n labelProps,\n onSelect,\n kind = \"primary\",\n children,\n onClick: onClickProp,\n disabled,\n hideChevron,\n ...props\n}: Props<C>): React.ReactElement => {\n const Component = as ?? (\"button\" as ElementType);\n const context = useContext(MenuContext);\n\n const onClick = useCallback(\n (e: Parameters<Exclude<typeof onClickProp, undefined>>[0]) => {\n (onClickProp as ((e_: typeof e) => void) | undefined)?.(e);\n // If there is no wrapper component to automatically handle onSelect, we\n // need to handle it manually, dismissing the menu as the default action\n if (onSelect !== null && context?.MenuItemWrapper == null) {\n const selectEvent = new CustomEvent(\"menu.itemSelect\", {\n bubbles: true,\n cancelable: true,\n });\n onSelect(selectEvent);\n if (!selectEvent.defaultPrevented) context?.onOpenChange(false);\n }\n },\n [context, onSelect],\n );\n\n const iconIsReactElement = isValidElement(Icon);\n const componentIcon = Icon as ReactElement;\n const SvgIcon = Icon as ComponentType<SVGAttributes<SVGElement>>;\n\n const content = (\n <Component\n role=\"menuitem\"\n {...props}\n className={classnames(className, styles.item, {\n [styles.interactive]: onSelect !== null,\n [styles[\"no-label\"]]: label === null,\n [styles[\"disabled\"]]: disabled,\n })}\n data-kind={kind}\n onClick={onClick}\n disabled={Component === \"button\" ? disabled : undefined}\n aria-disabled={Component === \"button\" ? undefined : disabled}\n >\n {iconIsReactElement ? (\n <Slot className={styles.icon}>{componentIcon}</Slot>\n ) : (\n <SvgIcon\n width={24}\n height={24}\n className={styles.icon}\n aria-hidden={true}\n />\n )}\n\n {label !== null && (\n <Text\n className={styles.label}\n size=\"md\"\n weight=\"medium\"\n as=\"span\"\n {...labelProps}\n >\n {label}\n </Text>\n )}\n {/* We use CSS to swap between this navigation hint and the provided\n children on hover - see the styles module. */}\n {!hideChevron && (Component === \"button\" || Component === \"a\") && (\n <ChevronRightIcon\n width={8}\n height={24}\n className={styles[\"nav-hint\"]}\n aria-hidden={true}\n /* The SVG is a small icon in a large canvas. It probably ought to be\n cropped, but we can adjust the viewBox here to chop off the horizontal\n space to get it closer to the right hand edge.\n */\n viewBox=\"8 0 8 24\"\n />\n )}\n {children}\n </Component>\n );\n\n return context?.MenuItemWrapper == null || onSelect === null ? (\n content\n ) : (\n <context.MenuItemWrapper onSelect={onSelect}>\n {content}\n </context.MenuItemWrapper>\n );\n};\n"],"names":["useContext","MenuContext","useCallback","isValidElement","jsxs","classnames","styles","Slot","jsx","Text"],"mappings":";;;;;;;;;;AAgFO,MAAM,WAAW,CAAuC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAoC;AAClC,QAAM,YAAY,MAAO;AACnB,QAAA,UAAUA,i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,GAAG;AAAA,YAEH,UAAA;AAAA,UAAA;AAAA,QACH;AAAA,QAID,CAAC,gBAAgB,cAAc,YAAY,cAAc,QACxDE,2BAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,WAAWF,wBAAO,UAAU;AAAA,YAC5B,eAAa;AAAA,YAKb,SAAQ;AAAA,UAAA;AAAA,QACV;AAAA,QAED;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AAGK,SAAA,SAAS,mBAAmB,QAAQ,aAAa,OACtD,UAEAE,+BAAC,QAAQ,iBAAR,EAAwB,UACtB,UACH,QAAA,CAAA;AAEJ;;"}
1
+ {"version":3,"file":"MenuItem.cjs","sources":["../../../src/components/Menu/MenuItem.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, {\n ComponentPropsWithoutRef,\n ComponentType,\n ElementType,\n isValidElement,\n ReactElement,\n SVGAttributes,\n useCallback,\n useContext,\n MouseEventHandler,\n} from \"react\";\nimport styles from \"./MenuItem.module.css\";\nimport { Text } from \"../Typography/Text\";\nimport ChevronRightIcon from \"@vector-im/compound-design-tokens/assets/web/icons/chevron-right\";\nimport { MenuContext } from \"./MenuContext\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\ntype MenuItemElement = \"button\" | \"a\" | \"div\";\n\ntype Props<C extends MenuItemElement> = {\n /**\n * The element type of this menu item.\n * @default button\n */\n as?: C;\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The icon to show on this menu item.\n * When `Icon` is a ReactElement, it should spread the props\n */\n Icon: ComponentType<SVGAttributes<SVGElement>> | ReactElement;\n /**\n * The label to show on this menu item.\n */\n // This prop is required because it's rare to not want a label\n label: string | null;\n /**\n * Additional properties to pass to the Text label component.\n */\n labelProps?: ComponentPropsWithoutRef<typeof Text>;\n /**\n * Event callback for when the item is selected via mouse, touch, or keyboard.\n * Calling event.preventDefault in this handler will prevent the menu from\n * being dismissed.\n */\n // This prop is required because it's rare to not want a selection handler\n onSelect: ((e: Event) => void) | null;\n /**\n * Event callback for when the item is clicked.\n * @param e\n */\n onClick?: MouseEventHandler<HTMLElementTagNameMap[C]>;\n /**\n * The color variant of the menu item.\n * @default primary\n */\n kind?: \"primary\" | \"critical\";\n disabled?: boolean;\n /**\n * Whether to hide the chevron navigation hint.\n */\n hideChevron?: boolean;\n} & Omit<ComponentPropsWithoutRef<C>, \"onSelect\" | \"onClick\">;\n\n/**\n * An item within a menu, acting either as a navigation button, or simply a\n * container for other interactive elements.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const MenuItem = <C extends MenuItemElement = \"button\">({\n as,\n className,\n Icon,\n label,\n labelProps,\n onSelect,\n kind = \"primary\",\n children,\n onClick: onClickProp,\n disabled,\n hideChevron,\n ...props\n}: Props<C>): React.ReactElement => {\n const Component = as ?? (\"button\" as ElementType);\n const context = useContext(MenuContext);\n\n const onClick = useCallback(\n (e: Parameters<Exclude<typeof onClickProp, undefined>>[0]) => {\n (onClickProp as ((e_: typeof e) => void) | undefined)?.(e);\n // If there is no wrapper component to automatically handle onSelect, we\n // need to handle it manually, dismissing the menu as the default action\n if (onSelect !== null && context?.MenuItemWrapper == null) {\n const selectEvent = new CustomEvent(\"menu.itemSelect\", {\n bubbles: true,\n cancelable: true,\n });\n onSelect(selectEvent);\n if (!selectEvent.defaultPrevented) context?.onOpenChange(false);\n }\n },\n [context, onSelect],\n );\n\n const iconIsReactElement = isValidElement(Icon);\n const componentIcon = Icon as ReactElement;\n const SvgIcon = Icon as ComponentType<SVGAttributes<SVGElement>>;\n\n const content = (\n <Component\n role=\"menuitem\"\n {...props}\n className={classnames(className, styles.item, {\n [styles.interactive]: onSelect !== null,\n [styles[\"no-label\"]]: label === null,\n [styles[\"disabled\"]]: disabled,\n })}\n data-kind={kind}\n onClick={onClick}\n disabled={Component === \"button\" ? disabled : undefined}\n aria-disabled={Component === \"button\" ? undefined : disabled}\n >\n {iconIsReactElement ? (\n <Slot className={styles.icon}>{componentIcon}</Slot>\n ) : (\n <SvgIcon\n width={24}\n height={24}\n className={styles.icon}\n aria-hidden={true}\n />\n )}\n\n {label !== null && (\n <Text\n className={styles.label}\n size=\"md\"\n weight=\"medium\"\n as=\"span\"\n {...labelProps}\n >\n {label}\n </Text>\n )}\n {/* We use CSS to swap between this navigation hint and the provided\n children on hover - see the styles module. */}\n {!hideChevron && (Component === \"button\" || Component === \"a\") && (\n <ChevronRightIcon\n width={8}\n height={24}\n className={styles[\"nav-hint\"]}\n aria-hidden={true}\n /* The SVG is a small icon in a large canvas. It probably ought to be\n cropped, but we can adjust the viewBox here to chop off the horizontal\n space to get it closer to the right hand edge.\n */\n viewBox=\"8 0 8 24\"\n />\n )}\n {children}\n </Component>\n );\n\n return context?.MenuItemWrapper == null || onSelect === null ? (\n content\n ) : (\n <context.MenuItemWrapper onSelect={onSelect}>\n {content}\n </context.MenuItemWrapper>\n );\n};\n"],"names":["useContext","MenuContext","useCallback","isValidElement","jsxs","classnames","styles","Slot","jsx","Text"],"mappings":";;;;;;;;;;AAgFO,MAAM,WAAW,CAAuC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAoC;AAClC,QAAM,YAAY,MAAO;AACnB,QAAA,UAAUA,iBAAWC,uBAAW;AAEtC,QAAM,UAAUC,MAAA;AAAA,IACd,CAAC,MAA6D;AAC3D,oBAAuD,CAAC;AAGzD,UAAI,aAAa,QAAQ,SAAS,mBAAmB,MAAM;AACnD,cAAA,cAAc,IAAI,YAAY,mBAAmB;AAAA,UACrD,SAAS;AAAA,UACT,YAAY;AAAA,QAAA,CACb;AACD,iBAAS,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AAA,UAAA;AAAA,QACV;AAAA,QAED;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AAGK,SAAA,SAAS,mBAAmB,QAAQ,aAAa,OACtD,UAEAE,+BAAC,QAAQ,iBAAR,EAAwB,UACtB,UACH,QAAA,CAAA;AAEJ;;"}
@@ -34,7 +34,7 @@ type Props<C extends MenuItemElement> = {
34
34
  * Event callback for when the item is clicked.
35
35
  * @param e
36
36
  */
37
- onClick?: MouseEventHandler<C>;
37
+ onClick?: MouseEventHandler<HTMLElementTagNameMap[C]>;
38
38
  /**
39
39
  * The color variant of the menu item.
40
40
  * @default primary
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuItem.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EACZ,wBAAwB,EACxB,aAAa,EAGb,YAAY,EACZ,aAAa,EAGb,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAK1C,KAAK,eAAe,GAAG,QAAQ,GAAG,GAAG,GAAG,KAAK,CAAC;AAE9C,KAAK,KAAK,CAAC,CAAC,SAAS,eAAe,IAAI;IACtC;;;OAGG;IACH,EAAE,CAAC,EAAE,CAAC,CAAC;IACP;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC;IAC9D;;OAEG;IAEH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,wBAAwB,CAAC,OAAO,IAAI,CAAC,CAAC;IACnD;;;;OAIG;IAEH,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,CAAC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C,CAAC,CAAC,CAAC;IACtD;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,eAAe,0IAa/C,KAAK,CAAC,CAAC,CAAC,KAAG,KAAK,CAAC,YAuFnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.js","sources":["../../../src/components/Menu/MenuItem.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, {\n ComponentPropsWithoutRef,\n ComponentType,\n ElementType,\n isValidElement,\n ReactElement,\n SVGAttributes,\n useCallback,\n useContext,\n MouseEventHandler,\n} from \"react\";\nimport styles from \"./MenuItem.module.css\";\nimport { Text } from \"../Typography/Text\";\nimport ChevronRightIcon from \"@vector-im/compound-design-tokens/assets/web/icons/chevron-right\";\nimport { MenuContext } from \"./MenuContext\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\ntype MenuItemElement = \"button\" | \"a\" | \"div\";\n\ntype Props<C extends MenuItemElement> = {\n /**\n * The element type of this menu item.\n * @default button\n */\n as?: C;\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The icon to show on this menu item.\n * When `Icon` is a ReactElement, it should spread the props\n */\n Icon: ComponentType<SVGAttributes<SVGElement>> | ReactElement;\n /**\n * The label to show on this menu item.\n */\n // This prop is required because it's rare to not want a label\n label: string | null;\n /**\n * Additional properties to pass to the Text label component.\n */\n labelProps?: ComponentPropsWithoutRef<typeof Text>;\n /**\n * Event callback for when the item is selected via mouse, touch, or keyboard.\n * Calling event.preventDefault in this handler will prevent the menu from\n * being dismissed.\n */\n // This prop is required because it's rare to not want a selection handler\n onSelect: ((e: Event) => void) | null;\n /**\n * Event callback for when the item is clicked.\n * @param e\n */\n onClick?: MouseEventHandler<C>;\n /**\n * The color variant of the menu item.\n * @default primary\n */\n kind?: \"primary\" | \"critical\";\n disabled?: boolean;\n /**\n * Whether to hide the chevron navigation hint.\n */\n hideChevron?: boolean;\n} & Omit<ComponentPropsWithoutRef<C>, \"onSelect\" | \"onClick\">;\n\n/**\n * An item within a menu, acting either as a navigation button, or simply a\n * container for other interactive elements.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const MenuItem = <C extends MenuItemElement = \"button\">({\n as,\n className,\n Icon,\n label,\n labelProps,\n onSelect,\n kind = \"primary\",\n children,\n onClick: onClickProp,\n disabled,\n hideChevron,\n ...props\n}: Props<C>): React.ReactElement => {\n const Component = as ?? (\"button\" as ElementType);\n const context = useContext(MenuContext);\n\n const onClick = useCallback(\n (e: Parameters<Exclude<typeof onClickProp, undefined>>[0]) => {\n (onClickProp as ((e_: typeof e) => void) | undefined)?.(e);\n // If there is no wrapper component to automatically handle onSelect, we\n // need to handle it manually, dismissing the menu as the default action\n if (onSelect !== null && context?.MenuItemWrapper == null) {\n const selectEvent = new CustomEvent(\"menu.itemSelect\", {\n bubbles: true,\n cancelable: true,\n });\n onSelect(selectEvent);\n if (!selectEvent.defaultPrevented) context?.onOpenChange(false);\n }\n },\n [context, onSelect],\n );\n\n const iconIsReactElement = isValidElement(Icon);\n const componentIcon = Icon as ReactElement;\n const SvgIcon = Icon as ComponentType<SVGAttributes<SVGElement>>;\n\n const content = (\n <Component\n role=\"menuitem\"\n {...props}\n className={classnames(className, styles.item, {\n [styles.interactive]: onSelect !== null,\n [styles[\"no-label\"]]: label === null,\n [styles[\"disabled\"]]: disabled,\n })}\n data-kind={kind}\n onClick={onClick}\n disabled={Component === \"button\" ? disabled : undefined}\n aria-disabled={Component === \"button\" ? undefined : disabled}\n >\n {iconIsReactElement ? (\n <Slot className={styles.icon}>{componentIcon}</Slot>\n ) : (\n <SvgIcon\n width={24}\n height={24}\n className={styles.icon}\n aria-hidden={true}\n />\n )}\n\n {label !== null && (\n <Text\n className={styles.label}\n size=\"md\"\n weight=\"medium\"\n as=\"span\"\n {...labelProps}\n >\n {label}\n </Text>\n )}\n {/* We use CSS to swap between this navigation hint and the provided\n children on hover - see the styles module. */}\n {!hideChevron && (Component === \"button\" || Component === \"a\") && (\n <ChevronRightIcon\n width={8}\n height={24}\n className={styles[\"nav-hint\"]}\n aria-hidden={true}\n /* The SVG is a small icon in a large canvas. It probably ought to be\n cropped, but we can adjust the viewBox here to chop off the horizontal\n space to get it closer to the right hand edge.\n */\n viewBox=\"8 0 8 24\"\n />\n )}\n {children}\n </Component>\n );\n\n return context?.MenuItemWrapper == null || onSelect === null ? (\n content\n ) : (\n <context.MenuItemWrapper onSelect={onSelect}>\n {content}\n </context.MenuItemWrapper>\n );\n};\n"],"names":["classnames"],"mappings":";;;;;;;;AAgFO,MAAM,WAAW,CAAuC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAoC;AAClC,QAAM,YAAY,MAAO;AACnB,QAAA,UAAU,WAAW,WAAW;AAEtC,QAAM,UAAU;AAAA,IACd,CAAC,MAA6D;AAC3D,oBAAuD,CAAC;AAGzD,UAAI,aAAa,QAAQ,SAAS,mBAAmB,MAAM;AACnD,cAAA,cAAc,IAAI,YAAY,mBAAmB;AAAA,UACrD,SAAS;AAAA,UACT,YAAY;AAAA,QAAA,CACb;AACD,iBAAS,WAAW;AACpB,YAAI,CAAC,YAAY,iBAAkB,UAAS,aAAa,KAAK;AAAA,MAAA;AAAA,IAElE;AAAA,IACA,CAAC,SAA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"MenuItem.js","sources":["../../../src/components/Menu/MenuItem.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, {\n ComponentPropsWithoutRef,\n ComponentType,\n ElementType,\n isValidElement,\n ReactElement,\n SVGAttributes,\n useCallback,\n useContext,\n MouseEventHandler,\n} from \"react\";\nimport styles from \"./MenuItem.module.css\";\nimport { Text } from \"../Typography/Text\";\nimport ChevronRightIcon from \"@vector-im/compound-design-tokens/assets/web/icons/chevron-right\";\nimport { MenuContext } from \"./MenuContext\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\ntype MenuItemElement = \"button\" | \"a\" | \"div\";\n\ntype Props<C extends MenuItemElement> = {\n /**\n * The element type of this menu item.\n * @default button\n */\n as?: C;\n /**\n * The CSS class name.\n */\n className?: string;\n /**\n * The icon to show on this menu item.\n * When `Icon` is a ReactElement, it should spread the props\n */\n Icon: ComponentType<SVGAttributes<SVGElement>> | ReactElement;\n /**\n * The label to show on this menu item.\n */\n // This prop is required because it's rare to not want a label\n label: string | null;\n /**\n * Additional properties to pass to the Text label component.\n */\n labelProps?: ComponentPropsWithoutRef<typeof Text>;\n /**\n * Event callback for when the item is selected via mouse, touch, or keyboard.\n * Calling event.preventDefault in this handler will prevent the menu from\n * being dismissed.\n */\n // This prop is required because it's rare to not want a selection handler\n onSelect: ((e: Event) => void) | null;\n /**\n * Event callback for when the item is clicked.\n * @param e\n */\n onClick?: MouseEventHandler<HTMLElementTagNameMap[C]>;\n /**\n * The color variant of the menu item.\n * @default primary\n */\n kind?: \"primary\" | \"critical\";\n disabled?: boolean;\n /**\n * Whether to hide the chevron navigation hint.\n */\n hideChevron?: boolean;\n} & Omit<ComponentPropsWithoutRef<C>, \"onSelect\" | \"onClick\">;\n\n/**\n * An item within a menu, acting either as a navigation button, or simply a\n * container for other interactive elements.\n * Must be used within a compound Menu or other `menu` or `menubar` aria role subtree.\n */\nexport const MenuItem = <C extends MenuItemElement = \"button\">({\n as,\n className,\n Icon,\n label,\n labelProps,\n onSelect,\n kind = \"primary\",\n children,\n onClick: onClickProp,\n disabled,\n hideChevron,\n ...props\n}: Props<C>): React.ReactElement => {\n const Component = as ?? (\"button\" as ElementType);\n const context = useContext(MenuContext);\n\n const onClick = useCallback(\n (e: Parameters<Exclude<typeof onClickProp, undefined>>[0]) => {\n (onClickProp as ((e_: typeof e) => void) | undefined)?.(e);\n // If there is no wrapper component to automatically handle onSelect, we\n // need to handle it manually, dismissing the menu as the default action\n if (onSelect !== null && context?.MenuItemWrapper == null) {\n const selectEvent = new CustomEvent(\"menu.itemSelect\", {\n bubbles: true,\n cancelable: true,\n });\n onSelect(selectEvent);\n if (!selectEvent.defaultPrevented) context?.onOpenChange(false);\n }\n },\n [context, onSelect],\n );\n\n const iconIsReactElement = isValidElement(Icon);\n const componentIcon = Icon as ReactElement;\n const SvgIcon = Icon as ComponentType<SVGAttributes<SVGElement>>;\n\n const content = (\n <Component\n role=\"menuitem\"\n {...props}\n className={classnames(className, styles.item, {\n [styles.interactive]: onSelect !== null,\n [styles[\"no-label\"]]: label === null,\n [styles[\"disabled\"]]: disabled,\n })}\n data-kind={kind}\n onClick={onClick}\n disabled={Component === \"button\" ? disabled : undefined}\n aria-disabled={Component === \"button\" ? undefined : disabled}\n >\n {iconIsReactElement ? (\n <Slot className={styles.icon}>{componentIcon}</Slot>\n ) : (\n <SvgIcon\n width={24}\n height={24}\n className={styles.icon}\n aria-hidden={true}\n />\n )}\n\n {label !== null && (\n <Text\n className={styles.label}\n size=\"md\"\n weight=\"medium\"\n as=\"span\"\n {...labelProps}\n >\n {label}\n </Text>\n )}\n {/* We use CSS to swap between this navigation hint and the provided\n children on hover - see the styles module. */}\n {!hideChevron && (Component === \"button\" || Component === \"a\") && (\n <ChevronRightIcon\n width={8}\n height={24}\n className={styles[\"nav-hint\"]}\n aria-hidden={true}\n /* The SVG is a small icon in a large canvas. It probably ought to be\n cropped, but we can adjust the viewBox here to chop off the horizontal\n space to get it closer to the right hand edge.\n */\n viewBox=\"8 0 8 24\"\n />\n )}\n {children}\n </Component>\n );\n\n return context?.MenuItemWrapper == null || onSelect === null ? (\n content\n ) : (\n <context.MenuItemWrapper onSelect={onSelect}>\n {content}\n </context.MenuItemWrapper>\n );\n};\n"],"names":["classnames"],"mappings":";;;;;;;;AAgFO,MAAM,WAAW,CAAuC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAoC;AAClC,QAAM,YAAY,MAAO;AACnB,QAAA,UAAU,WAAW,WAAW;AAEtC,QAAM,UAAU;AAAA,IACd,CAAC,MAA6D;AAC3D,oBAAuD,CAAC;AAGzD,UAAI,aAAa,QAAQ,SAAS,mBAAmB,MAAM;AACnD,cAAA,cAAc,IAAI,YAAY,mBAAmB;AAAA,UACrD,SAAS;AAAA,UACT,YAAY;AAAA,QAAA,CACb;AACD,iBAAS,WAAW;AACpB,YAAI,CAAC,YAAY,iBAAkB,UAAS,aAAa,KAAK;AAAA,MAAA;AAAA,IAElE;AAAA,IACA,CAAC,SAAS,QAAQ;AAAA,EACpB;AAEM,QAAA,qBAAqB,eAAe,IAAI;AAC9C,QAAM,gBAAgB;AACtB,QAAM,UAAU;AAEhB,QAAM,UACJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACJ,GAAG;AAAA,MACJ,WAAWA,WAAW,WAAW,OAAO,MAAM;AAAA,QAC5C,CAAC,OAAO,WAAW,GAAG,aAAa;AAAA,QACnC,CAAC,OAAO,UAAU,CAAC,GAAG,UAAU;AAAA,QAChC,CAAC,OAAO,UAAU,CAAC,GAAG;AAAA,MAAA,CACvB;AAAA,MACD,aAAW;AAAA,MACX;AAAA,MACA,UAAU,cAAc,WAAW,WAAW;AAAA,MAC9C,iBAAe,cAAc,WAAW,SAAY;AAAA,MAEnD,UAAA;AAAA,QAAA,yCACE,MAAK,EAAA,WAAW,OAAO,MAAO,wBAAc,CAAA,IAE7C;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,WAAW,OAAO;AAAA,YAClB,eAAa;AAAA,UAAA;AAAA,QACf;AAAA,QAGD,UAAU,QACT;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW,OAAO;AAAA,YAClB,MAAK;AAAA,YACL,QAAO;AAAA,YACP,IAAG;AAAA,YACF,GAAG;AAAA,YAEH,UAAA;AAAA,UAAA;AAAA,QACH;AAAA,QAID,CAAC,gBAAgB,cAAc,YAAY,cAAc,QACxD;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,WAAW,OAAO,UAAU;AAAA,YAC5B,eAAa;AAAA,YAKb,SAAQ;AAAA,UAAA;AAAA,QACV;AAAA,QAED;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AAGK,SAAA,SAAS,mBAAmB,QAAQ,aAAa,OACtD,UAEA,oBAAC,QAAQ,iBAAR,EAAwB,UACtB,UACH,QAAA,CAAA;AAEJ;"}
@@ -10,7 +10,7 @@ export declare const ToggleMenuItem: React.ForwardRefExoticComponent<Pick<{
10
10
  label: string | null;
11
11
  labelProps?: React.ComponentPropsWithoutRef<typeof import('../..').Text>;
12
12
  onSelect: ((e: Event) => void) | null;
13
- onClick?: React.MouseEventHandler<"a" | "button" | "div"> | undefined;
13
+ onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement> | undefined;
14
14
  kind?: "primary" | "critical";
15
15
  disabled?: boolean;
16
16
  hideChevron?: boolean;
package/dist/index.cjs CHANGED
@@ -36,6 +36,9 @@ const Breadcrumb = require("./components/Breadcrumb/Breadcrumb.cjs");
36
36
  const VisualList = require("./components/VisualList/VisualList.cjs");
37
37
  const VisualListItem = require("./components/VisualList/VisualListItem.cjs");
38
38
  const ChatFilter = require("./components/ChatFilter/ChatFilter.cjs");
39
+ const UnreadCounter = require("./components/ActivityMarker/UnreadCounter.cjs");
40
+ const Pill = require("./components/ActivityMarker/Pill.cjs");
41
+ const Unread = require("./components/ActivityMarker/Unread.cjs");
39
42
  const Text$1 = require("./components/Form/Controls/Text/Text.cjs");
40
43
  const Action = require("./components/Form/Controls/Action/Action.cjs");
41
44
  const Password = require("./components/Form/Controls/Password/Password.cjs");
@@ -92,6 +95,9 @@ exports.Breadcrumb = Breadcrumb.Breadcrumb;
92
95
  exports.VisualList = VisualList.VisualList;
93
96
  exports.VisualListItem = VisualListItem.VisualListItem;
94
97
  exports.ChatFilter = ChatFilter.ChatFilter;
98
+ exports.UnreadCounter = UnreadCounter.UnreadCounter;
99
+ exports.Pill = Pill.Pill;
100
+ exports.Unread = Unread.Unread;
95
101
  exports.Control = Text$1.TextControl;
96
102
  exports.TextControl = Text$1.TextControl;
97
103
  exports.TextInput = Text$1.TextInput;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -30,6 +30,7 @@ export { InlineSpinner } from './components/InlineSpinner';
30
30
  export { Breadcrumb } from './components/Breadcrumb';
31
31
  export { VisualList, VisualListItem } from './components/VisualList';
32
32
  export { ChatFilter } from './components/ChatFilter';
33
+ export { UnreadCounter, Pill, Unread } from './components/ActivityMarker';
33
34
  export { TextControl, TextControl as Control, TextInput, ActionControl, ActionInput, PasswordControl, PasswordInput, MFAControl, MFAInput, CheckboxControl, CheckboxInput, CheckboxInput as Checkbox, RadioControl, RadioInput, RadioInput as Radio, ToggleControl, ToggleInput, ToggleInput as Toggle, Root, Submit, Message, ErrorMessage, HelpMessage, ValidityState, Field, InlineField, Label, EditInPlace, } from './components/Form';
34
35
  export * as Form from './components/Form';
35
36
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EACL,OAAO,EACP,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,GACH,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,O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M,gBAAgB,CAAC;AAElD,OAAO,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -34,6 +34,9 @@ import { Breadcrumb } from "./components/Breadcrumb/Breadcrumb.js";
34
34
  import { VisualList } from "./components/VisualList/VisualList.js";
35
35
  import { VisualListItem } from "./components/VisualList/VisualListItem.js";
36
36
  import { ChatFilter } from "./components/ChatFilter/ChatFilter.js";
37
+ import { UnreadCounter } from "./components/ActivityMarker/UnreadCounter.js";
38
+ import { Pill } from "./components/ActivityMarker/Pill.js";
39
+ import { Unread } from "./components/ActivityMarker/Unread.js";
37
40
  import { TextControl, TextControl as TextControl2, TextInput } from "./components/Form/Controls/Text/Text.js";
38
41
  import { ActionControl, ActionInput } from "./components/Form/Controls/Action/Action.js";
39
42
  import { PasswordControl, PasswordInput } from "./components/Form/Controls/Password/Password.js";
@@ -95,6 +98,7 @@ export {
95
98
  NavItem,
96
99
  PasswordControl,
97
100
  PasswordInput,
101
+ Pill,
98
102
  Progress,
99
103
  RadioInput as Radio,
100
104
  RadioControl,
@@ -114,6 +118,8 @@ export {
114
118
  ToggleMenuItem,
115
119
  Tooltip,
116
120
  TooltipProvider,
121
+ Unread,
122
+ UnreadCounter,
117
123
  ValidityState,
118
124
  VisualList,
119
125
  VisualListItem,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/style.css CHANGED
@@ -2626,3 +2626,59 @@ Please see LICENSE files in the repository root for full details.
2626
2626
  background: var(--cpd-color-bg-action-primary-rest);
2627
2627
  color: var(--cpd-color-text-on-solid-primary);
2628
2628
  }
2629
+ /*
2630
+ * Copyright 2025 New Vector Ltd
2631
+ *
2632
+ * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
2633
+ * Please see LICENSE files in the repository root for full details.
2634
+ */
2635
+
2636
+ ._unread-counter_1ibqq_8 {
2637
+ border-radius: 100%;
2638
+ font: var(--cpd-font-body-xs-semibold);
2639
+ color: var(--cpd-color-text-on-solid-primary);
2640
+ background-color: var(--cpd-color-icon-success-primary);
2641
+ block-size: 20px;
2642
+ min-inline-size: 20px;
2643
+ padding: 0 var(--cpd-space-1-5x);
2644
+ display: inline-flex;
2645
+ align-items: center;
2646
+ justify-content: center;
2647
+ box-sizing: border-box;
2648
+ }
2649
+ /*
2650
+ * Copyright 2025 New Vector Ltd
2651
+ *
2652
+ * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
2653
+ * Please see LICENSE files in the repository root for full details.
2654
+ */
2655
+
2656
+ ._pill_1pem8_8 {
2657
+ border-radius: 38px;
2658
+ font: var(--cpd-font-body-xs-semibold);
2659
+ color: var(--cpd-color-text-on-solid-primary);
2660
+ background-color: var(--cpd-color-icon-success-primary);
2661
+ padding: 0 var(--cpd-space-2x);
2662
+ block-size: 20px;
2663
+ display: inline-flex;
2664
+ align-items: center;
2665
+ }
2666
+ /*
2667
+ * Copyright 2025 New Vector Ltd
2668
+ *
2669
+ * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
2670
+ * Please see LICENSE files in the repository root for full details.
2671
+ */
2672
+
2673
+ ._unread_1k06b_8 {
2674
+ inline-size: 20px;
2675
+ display: flex;
2676
+ justify-content: center;
2677
+
2678
+ div {
2679
+ block-size: 8px;
2680
+ inline-size: 8px;
2681
+ background-color: var(--cpd-color-icon-secondary);
2682
+ border-radius: 100%;
2683
+ }
2684
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vector-im/compound-web",
3
- "version": "7.7.1",
3
+ "version": "7.8.0",
4
4
  "description": "Compound components for the Web",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright 2025 New Vector Ltd
3
+ *
4
+ * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5
+ * Please see LICENSE files in the repository root for full details.
6
+ */
7
+
8
+ .pill {
9
+ border-radius: 38px;
10
+ font: var(--cpd-font-body-xs-semibold);
11
+ color: var(--cpd-color-text-on-solid-primary);
12
+ background-color: var(--cpd-color-icon-success-primary);
13
+ padding: 0 var(--cpd-space-2x);
14
+ block-size: 20px;
15
+ display: inline-flex;
16
+ align-items: center;
17
+ }
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright 2025 New Vector Ltd
3
+ *
4
+ * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5
+ * Please see LICENSE files in the repository root for full details.
6
+ */
7
+
8
+ import React, { HTMLProps, JSX } from "react";
9
+ import styles from "./Pill.module.css";
10
+
11
+ export function Pill({
12
+ children,
13
+ ...props
14
+ }: HTMLProps<HTMLSpanElement>): JSX.Element {
15
+ return (
16
+ <span {...props} className={styles.pill}>
17
+ {children}
18
+ </span>
19
+ );
20
+ }
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright 2025 New Vector Ltd
3
+ *
4
+ * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5
+ * Please see LICENSE files in the repository root for full details.
6
+ */
7
+
8
+ .unread {
9
+ inline-size: 20px;
10
+ display: flex;
11
+ justify-content: center;
12
+
13
+ div {
14
+ block-size: 8px;
15
+ inline-size: 8px;
16
+ background-color: var(--cpd-color-icon-secondary);
17
+ border-radius: 100%;
18
+ }
19
+ }
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright 2025 New Vector Ltd
3
+ *
4
+ * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5
+ * Please see LICENSE files in the repository root for full details.
6
+ */
7
+
8
+ import React, { HTMLProps } from "react";
9
+ import styles from "./Unread.module.css";
10
+
11
+ export function Unread(props: HTMLProps<HTMLDivElement>) {
12
+ return (
13
+ <div {...props} className={styles.unread}>
14
+ <div />
15
+ </div>
16
+ );
17
+ }
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright 2025 New Vector Ltd
3
+ *
4
+ * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5
+ * Please see LICENSE files in the repository root for full details.
6
+ */
7
+
8
+ .unread-counter {
9
+ border-radius: 100%;
10
+ font: var(--cpd-font-body-xs-semibold);
11
+ color: var(--cpd-color-text-on-solid-primary);
12
+ background-color: var(--cpd-color-icon-success-primary);
13
+ block-size: 20px;
14
+ min-inline-size: 20px;
15
+ padding: 0 var(--cpd-space-1-5x);
16
+ display: inline-flex;
17
+ align-items: center;
18
+ justify-content: center;
19
+ box-sizing: border-box;
20
+ }
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Copyright 2025 New Vector Ltd
3
+ *
4
+ * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5
+ * Please see LICENSE files in the repository root for full details.
6
+ */
7
+
8
+ import React, { HTMLProps } from "react";
9
+ import styles from "./UnreadCounter.module.css";
10
+
11
+ interface UnreadCounterProps extends HTMLProps<HTMLSpanElement> {
12
+ count: string | number;
13
+ }
14
+
15
+ export function UnreadCounter({ count, ...props }: UnreadCounterProps) {
16
+ return (
17
+ <span {...props} className={styles["unread-counter"]}>
18
+ {count}
19
+ </span>
20
+ );
21
+ }
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright 2025 New Vector Ltd
3
+ *
4
+ * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5
+ * Please see LICENSE files in the repository root for full details.
6
+ */
7
+
8
+ export { UnreadCounter } from "./UnreadCounter.tsx";
9
+ export { Pill } from "./Pill";
10
+ export { Unread } from "./Unread";
@@ -60,7 +60,7 @@ type Props<C extends MenuItemElement> = {
60
60
  * Event callback for when the item is clicked.
61
61
  * @param e
62
62
  */
63
- onClick?: MouseEventHandler<C>;
63
+ onClick?: MouseEventHandler<HTMLElementTagNameMap[C]>;
64
64
  /**
65
65
  * The color variant of the menu item.
66
66
  * @default primary
package/src/index.ts CHANGED
@@ -47,6 +47,7 @@ export { InlineSpinner } from "./components/InlineSpinner";
47
47
  export { Breadcrumb } from "./components/Breadcrumb";
48
48
  export { VisualList, VisualListItem } from "./components/VisualList";
49
49
  export { ChatFilter } from "./components/ChatFilter";
50
+ export { UnreadCounter, Pill, Unread } from "./components/ActivityMarker";
50
51
 
51
52
  export {
52
53
  TextControl,