@vector-im/compound-web 7.6.3 → 7.6.4
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/components/ChatFilter/ChatFilter.cjs +22 -0
- package/dist/components/ChatFilter/ChatFilter.cjs.map +1 -0
- package/dist/components/ChatFilter/ChatFilter.d.ts +14 -0
- package/dist/components/ChatFilter/ChatFilter.d.ts.map +1 -0
- package/dist/components/ChatFilter/ChatFilter.js +22 -0
- package/dist/components/ChatFilter/ChatFilter.js.map +1 -0
- package/dist/components/ChatFilter/ChatFilter.module.css.cjs +7 -0
- package/dist/components/ChatFilter/ChatFilter.module.css.cjs.map +1 -0
- package/dist/components/ChatFilter/ChatFilter.module.css.js +7 -0
- package/dist/components/ChatFilter/ChatFilter.module.css.js.map +1 -0
- package/dist/components/ChatFilter/index.d.ts +2 -0
- package/dist/components/ChatFilter/index.d.ts.map +1 -0
- package/dist/components/Menu/FloatingMenu.cjs +2 -3
- package/dist/components/Menu/FloatingMenu.cjs.map +1 -1
- package/dist/components/Menu/FloatingMenu.d.ts.map +1 -1
- package/dist/components/Menu/FloatingMenu.js +2 -3
- package/dist/components/Menu/FloatingMenu.js.map +1 -1
- package/dist/components/Menu/FloatingMenu.module.css.cjs +2 -2
- package/dist/components/Menu/FloatingMenu.module.css.js +2 -2
- package/dist/components/Menu/MenuTitle.cjs +16 -0
- package/dist/components/Menu/MenuTitle.cjs.map +1 -0
- package/dist/components/Menu/MenuTitle.d.ts +18 -0
- package/dist/components/Menu/MenuTitle.d.ts.map +1 -0
- package/dist/components/Menu/MenuTitle.js +16 -0
- package/dist/components/Menu/MenuTitle.js.map +1 -0
- package/dist/components/Menu/MenuTitle.module.css.cjs +7 -0
- package/dist/components/Menu/MenuTitle.module.css.cjs.map +1 -0
- package/dist/components/Menu/MenuTitle.module.css.js +7 -0
- package/dist/components/Menu/MenuTitle.module.css.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.cjs +6 -1
- package/dist/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +6 -1
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/style.css +59 -15
- package/package.json +1 -1
- package/src/components/ChatFilter/ChatFilter.module.css +33 -0
- package/src/components/ChatFilter/ChatFilter.tsx +41 -0
- package/src/components/ChatFilter/index.ts +8 -0
- package/src/components/Menu/FloatingMenu.module.css +2 -5
- package/src/components/Menu/FloatingMenu.tsx +4 -13
- package/src/components/Menu/MenuTitle.module.css +14 -0
- package/src/components/Menu/MenuTitle.tsx +40 -0
- package/src/components/Tooltip/Tooltip.tsx +6 -1
- package/src/index.ts +1 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const UnstyledButton = require("../Button/UnstyledButton.cjs");
|
|
6
|
+
const ChatFilter_module = require("./ChatFilter.module.css.cjs");
|
|
7
|
+
const ChatFilter = React.forwardRef(function ChatFilter2({ children, selected, ...props }, ref) {
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9
|
+
UnstyledButton.UnstyledButton,
|
|
10
|
+
{
|
|
11
|
+
...props,
|
|
12
|
+
className: ChatFilter_module.default["chat-filter"],
|
|
13
|
+
"aria-selected": selected,
|
|
14
|
+
as: "button",
|
|
15
|
+
ref,
|
|
16
|
+
tabIndex: 0,
|
|
17
|
+
children
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
exports.ChatFilter = ChatFilter;
|
|
22
|
+
//# sourceMappingURL=ChatFilter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatFilter.cjs","sources":["../../../src/components/ChatFilter/ChatFilter.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, { ForwardedRef, forwardRef } from \"react\";\nimport {\n UnstyledButton,\n UnstyledButtonPropsFor,\n} from \"../Button/UnstyledButton\";\nimport styles from \"./ChatFilter.module.css\";\n\ntype ChatFilterProps = Omit<UnstyledButtonPropsFor<\"button\">, \"disabled\"> & {\n /**\n * Whether the filter is selected.\n */\n selected?: boolean;\n};\n\n/**\n * A chat filter button.\n */\nexport const ChatFilter = forwardRef(function ChatFilter(\n { children, selected, ...props }: ChatFilterProps,\n ref: ForwardedRef<HTMLButtonElement>,\n): React.ReactElement {\n return (\n <UnstyledButton\n {...props}\n className={styles[\"chat-filter\"]}\n aria-selected={selected}\n as=\"button\"\n ref={ref}\n tabIndex={0}\n >\n {children}\n </UnstyledButton>\n );\n});\n"],"names":["forwardRef","ChatFilter","jsx","UnstyledButton","styles"],"mappings":";;;;;;AAwBa,MAAA,aAAaA,MAAAA,WAAW,SAASC,YAC5C,EAAE,UAAU,UAAU,GAAG,MAAM,GAC/B,KACoB;AAElB,SAAAC,2BAAA;AAAA,IAACC,eAAA;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAWC,0BAAO,aAAa;AAAA,MAC/B,iBAAe;AAAA,MACf,IAAG;AAAA,MACH;AAAA,MACA,UAAU;AAAA,MAET;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { UnstyledButtonPropsFor } from '../Button/UnstyledButton';
|
|
3
|
+
type ChatFilterProps = Omit<UnstyledButtonPropsFor<"button">, "disabled"> & {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the filter is selected.
|
|
6
|
+
*/
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A chat filter button.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ChatFilter: React.ForwardRefExoticComponent<Omit<ChatFilterProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=ChatFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatFilter.d.ts","sourceRoot":"","sources":["../../../src/components/ChatFilter/ChatFilter.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAmC,MAAM,OAAO,CAAC;AACxD,OAAO,EAEL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAGlC,KAAK,eAAe,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IAC1E;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,wGAgBrB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { UnstyledButton } from "../Button/UnstyledButton.js";
|
|
4
|
+
import styles from "./ChatFilter.module.css.js";
|
|
5
|
+
const ChatFilter = forwardRef(function ChatFilter2({ children, selected, ...props }, ref) {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
UnstyledButton,
|
|
8
|
+
{
|
|
9
|
+
...props,
|
|
10
|
+
className: styles["chat-filter"],
|
|
11
|
+
"aria-selected": selected,
|
|
12
|
+
as: "button",
|
|
13
|
+
ref,
|
|
14
|
+
tabIndex: 0,
|
|
15
|
+
children
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
ChatFilter
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=ChatFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatFilter.js","sources":["../../../src/components/ChatFilter/ChatFilter.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, { ForwardedRef, forwardRef } from \"react\";\nimport {\n UnstyledButton,\n UnstyledButtonPropsFor,\n} from \"../Button/UnstyledButton\";\nimport styles from \"./ChatFilter.module.css\";\n\ntype ChatFilterProps = Omit<UnstyledButtonPropsFor<\"button\">, \"disabled\"> & {\n /**\n * Whether the filter is selected.\n */\n selected?: boolean;\n};\n\n/**\n * A chat filter button.\n */\nexport const ChatFilter = forwardRef(function ChatFilter(\n { children, selected, ...props }: ChatFilterProps,\n ref: ForwardedRef<HTMLButtonElement>,\n): React.ReactElement {\n return (\n <UnstyledButton\n {...props}\n className={styles[\"chat-filter\"]}\n aria-selected={selected}\n as=\"button\"\n ref={ref}\n tabIndex={0}\n >\n {children}\n </UnstyledButton>\n );\n});\n"],"names":["ChatFilter"],"mappings":";;;;AAwBa,MAAA,aAAa,WAAW,SAASA,YAC5C,EAAE,UAAU,UAAU,GAAG,MAAM,GAC/B,KACoB;AAElB,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,OAAO,aAAa;AAAA,MAC/B,iBAAe;AAAA,MACf,IAAG;AAAA,MACH;AAAA,MACA,UAAU;AAAA,MAET;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const styles = {
|
|
4
|
+
"chat-filter": "_chat-filter_5qdp0_8"
|
|
5
|
+
};
|
|
6
|
+
exports.default = styles;
|
|
7
|
+
//# sourceMappingURL=ChatFilter.module.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatFilter.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatFilter.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ChatFilter/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -4,8 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const classNames = require("classnames");
|
|
5
5
|
const React = require("react");
|
|
6
6
|
const FloatingMenu_module = require("./FloatingMenu.module.css.cjs");
|
|
7
|
-
const
|
|
8
|
-
const MenuTitle = ({ title, id }) => /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { as: "h3", id, className: FloatingMenu_module.default.title, size: "sm", weight: "semibold", children: title });
|
|
7
|
+
const MenuTitle = require("./MenuTitle.cjs");
|
|
9
8
|
const FloatingMenu = React.forwardRef(
|
|
10
9
|
({ title, showTitle = true, className, children, ...props }, ref) => {
|
|
11
10
|
const titleId = React.useId();
|
|
@@ -19,7 +18,7 @@ const FloatingMenu = React.forwardRef(
|
|
|
19
18
|
className: classNames(className, FloatingMenu_module.default.menu),
|
|
20
19
|
...props,
|
|
21
20
|
children: [
|
|
22
|
-
showTitle && /* @__PURE__ */ jsxRuntime.jsx(MenuTitle, { title, id: titleId }),
|
|
21
|
+
showTitle && /* @__PURE__ */ jsxRuntime.jsx(MenuTitle.MenuTitle, { className: FloatingMenu_module.default.title, title, id: titleId }),
|
|
23
22
|
children
|
|
24
23
|
]
|
|
25
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingMenu.cjs","sources":["../../../src/components/Menu/FloatingMenu.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 ReactNode,\n forwardRef,\n useId,\n} from \"react\";\nimport styles from \"./FloatingMenu.module.css\";\nimport {
|
|
1
|
+
{"version":3,"file":"FloatingMenu.cjs","sources":["../../../src/components/Menu/FloatingMenu.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 ReactNode,\n forwardRef,\n useId,\n} from \"react\";\nimport styles from \"./FloatingMenu.module.css\";\nimport { MenuTitle } from \"./MenuTitle.tsx\";\n\ninterface Props extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The menu title.\n */\n title: string;\n /**\n * Whether to show the title. If false, the title will be hidden but still used as a label for screen readers.\n */\n showTitle?: boolean;\n /**\n * The CSS class.\n */\n className?: string;\n /**\n * The menu contents.\n */\n children: ReactNode;\n}\n\n/**\n * A menu in a floating box, as commonly seen on desktop.\n */\n// This an internal component not intended for export! Consumers should use it\n// via the Menu or ContextMenu components.\nexport const FloatingMenu = forwardRef<HTMLDivElement, Props>(\n ({ title, showTitle = true, className, children, ...props }, ref) => {\n const titleId = useId();\n return (\n <div\n role=\"menu\"\n ref={ref}\n aria-label={showTitle ? undefined : title}\n aria-labelledby={showTitle ? titleId : undefined}\n className={classnames(className, styles.menu)}\n {...props}\n >\n {showTitle && (\n <MenuTitle className={styles.title} title={title} id={titleId} />\n )}\n {children}\n </div>\n );\n },\n);\n\nFloatingMenu.displayName = \"FloatingMenu\";\n"],"names":["forwardRef","useId","jsxs","classnames","styles","MenuTitle"],"mappings":";;;;;;;AAyCO,MAAM,eAAeA,MAAA;AAAA,EAC1B,CAAC,EAAE,OAAO,YAAY,MAAM,WAAW,UAAU,GAAG,MAAM,GAAG,QAAQ;AACnE,UAAM,UAAUC,MAAAA,MAAM;AAEpB,WAAAC,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL;AAAA,QACA,cAAY,YAAY,SAAY;AAAA,QACpC,mBAAiB,YAAY,UAAU;AAAA,QACvC,WAAWC,WAAW,WAAWC,oBAAAA,QAAO,IAAI;AAAA,QAC3C,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,4CACEC,UAAU,WAAA,EAAA,WAAWD,4BAAO,OAAO,OAAc,IAAI,SAAS;AAAA,UAEhE;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;AAEA,aAAa,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingMenu.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/FloatingMenu.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EACZ,wBAAwB,EACxB,SAAS,EAGV,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FloatingMenu.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/FloatingMenu.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EACZ,wBAAwB,EACxB,SAAS,EAGV,MAAM,OAAO,CAAC;AAIf,UAAU,KAAM,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACrD;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;GAEG;AAGH,eAAO,MAAM,YAAY,8EAmBxB,CAAC"}
|
|
@@ -2,8 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { forwardRef, useId } from "react";
|
|
4
4
|
import styles from "./FloatingMenu.module.css.js";
|
|
5
|
-
import {
|
|
6
|
-
const MenuTitle = ({ title, id }) => /* @__PURE__ */ jsx(Text, { as: "h3", id, className: styles.title, size: "sm", weight: "semibold", children: title });
|
|
5
|
+
import { MenuTitle } from "./MenuTitle.js";
|
|
7
6
|
const FloatingMenu = forwardRef(
|
|
8
7
|
({ title, showTitle = true, className, children, ...props }, ref) => {
|
|
9
8
|
const titleId = useId();
|
|
@@ -17,7 +16,7 @@ const FloatingMenu = forwardRef(
|
|
|
17
16
|
className: classNames(className, styles.menu),
|
|
18
17
|
...props,
|
|
19
18
|
children: [
|
|
20
|
-
showTitle && /* @__PURE__ */ jsx(MenuTitle, { title, id: titleId }),
|
|
19
|
+
showTitle && /* @__PURE__ */ jsx(MenuTitle, { className: styles.title, title, id: titleId }),
|
|
21
20
|
children
|
|
22
21
|
]
|
|
23
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingMenu.js","sources":["../../../src/components/Menu/FloatingMenu.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 ReactNode,\n forwardRef,\n useId,\n} from \"react\";\nimport styles from \"./FloatingMenu.module.css\";\nimport {
|
|
1
|
+
{"version":3,"file":"FloatingMenu.js","sources":["../../../src/components/Menu/FloatingMenu.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 ReactNode,\n forwardRef,\n useId,\n} from \"react\";\nimport styles from \"./FloatingMenu.module.css\";\nimport { MenuTitle } from \"./MenuTitle.tsx\";\n\ninterface Props extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The menu title.\n */\n title: string;\n /**\n * Whether to show the title. If false, the title will be hidden but still used as a label for screen readers.\n */\n showTitle?: boolean;\n /**\n * The CSS class.\n */\n className?: string;\n /**\n * The menu contents.\n */\n children: ReactNode;\n}\n\n/**\n * A menu in a floating box, as commonly seen on desktop.\n */\n// This an internal component not intended for export! Consumers should use it\n// via the Menu or ContextMenu components.\nexport const FloatingMenu = forwardRef<HTMLDivElement, Props>(\n ({ title, showTitle = true, className, children, ...props }, ref) => {\n const titleId = useId();\n return (\n <div\n role=\"menu\"\n ref={ref}\n aria-label={showTitle ? undefined : title}\n aria-labelledby={showTitle ? titleId : undefined}\n className={classnames(className, styles.menu)}\n {...props}\n >\n {showTitle && (\n <MenuTitle className={styles.title} title={title} id={titleId} />\n )}\n {children}\n </div>\n );\n },\n);\n\nFloatingMenu.displayName = \"FloatingMenu\";\n"],"names":["classnames"],"mappings":";;;;;AAyCO,MAAM,eAAe;AAAA,EAC1B,CAAC,EAAE,OAAO,YAAY,MAAM,WAAW,UAAU,GAAG,MAAM,GAAG,QAAQ;AACnE,UAAM,UAAU,MAAM;AAEpB,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL;AAAA,QACA,cAAY,YAAY,SAAY;AAAA,QACpC,mBAAiB,YAAY,UAAU;AAAA,QACvC,WAAWA,WAAW,WAAW,OAAO,IAAI;AAAA,QAC3C,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,iCACE,WAAU,EAAA,WAAW,OAAO,OAAO,OAAc,IAAI,SAAS;AAAA,UAEhE;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;AAEA,aAAa,cAAc;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const menu = "
|
|
4
|
-
const title = "
|
|
3
|
+
const menu = "_menu_19sse_8";
|
|
4
|
+
const title = "_title_19sse_74";
|
|
5
5
|
const styles = {
|
|
6
6
|
menu,
|
|
7
7
|
title
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const Text = require("../Typography/Text.cjs");
|
|
5
|
+
const MenuTitle_module = require("./MenuTitle.module.css.cjs");
|
|
6
|
+
const classNames = require("classnames");
|
|
7
|
+
const MenuTitle = ({
|
|
8
|
+
title,
|
|
9
|
+
id,
|
|
10
|
+
className
|
|
11
|
+
}) => {
|
|
12
|
+
const classes = classNames(MenuTitle_module.default["menu-title"], className);
|
|
13
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { as: "h3", id, className: classes, size: "sm", weight: "semibold", children: title });
|
|
14
|
+
};
|
|
15
|
+
exports.MenuTitle = MenuTitle;
|
|
16
|
+
//# sourceMappingURL=MenuTitle.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuTitle.cjs","sources":["../../../src/components/Menu/MenuTitle.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 from \"react\";\nimport { Text } from \"../Typography/Text.tsx\";\nimport styles from \"./MenuTitle.module.css\";\nimport classnames from \"classnames\";\n\ninterface MenuTitleProps {\n /**\n * The title of the menu.\n */\n title: string;\n /**\n * The id of the menu title.\n */\n id?: string;\n /**\n * The CSS class.\n */\n className?: string;\n}\n\nexport const MenuTitle: React.FC<MenuTitleProps> = ({\n title,\n id,\n className,\n}) => {\n const classes = classnames(styles[\"menu-title\"], className);\n\n return (\n <Text as=\"h3\" id={id} className={classes} size=\"sm\" weight=\"semibold\">\n {title}\n </Text>\n );\n};\n"],"names":["classnames","styles","jsx","Text"],"mappings":";;;;;;AA2BO,MAAM,YAAsC,CAAC;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,UAAUA,WAAWC,iBAAO,QAAA,YAAY,GAAG,SAAS;AAGxD,SAAAC,2BAAAA,IAACC,KAAAA,MAAK,EAAA,IAAG,MAAK,IAAQ,WAAW,SAAS,MAAK,MAAK,QAAO,YACxD,UACH,MAAA,CAAA;AAEJ;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface MenuTitleProps {
|
|
3
|
+
/**
|
|
4
|
+
* The title of the menu.
|
|
5
|
+
*/
|
|
6
|
+
title: string;
|
|
7
|
+
/**
|
|
8
|
+
* The id of the menu title.
|
|
9
|
+
*/
|
|
10
|
+
id?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The CSS class.
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const MenuTitle: React.FC<MenuTitleProps>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=MenuTitle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuTitle.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuTitle.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,cAAc;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAY9C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from "../Typography/Text.js";
|
|
3
|
+
import styles from "./MenuTitle.module.css.js";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
const MenuTitle = ({
|
|
6
|
+
title,
|
|
7
|
+
id,
|
|
8
|
+
className
|
|
9
|
+
}) => {
|
|
10
|
+
const classes = classNames(styles["menu-title"], className);
|
|
11
|
+
return /* @__PURE__ */ jsx(Text, { as: "h3", id, className: classes, size: "sm", weight: "semibold", children: title });
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
MenuTitle
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=MenuTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuTitle.js","sources":["../../../src/components/Menu/MenuTitle.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 from \"react\";\nimport { Text } from \"../Typography/Text.tsx\";\nimport styles from \"./MenuTitle.module.css\";\nimport classnames from \"classnames\";\n\ninterface MenuTitleProps {\n /**\n * The title of the menu.\n */\n title: string;\n /**\n * The id of the menu title.\n */\n id?: string;\n /**\n * The CSS class.\n */\n className?: string;\n}\n\nexport const MenuTitle: React.FC<MenuTitleProps> = ({\n title,\n id,\n className,\n}) => {\n const classes = classnames(styles[\"menu-title\"], className);\n\n return (\n <Text as=\"h3\" id={id} className={classes} size=\"sm\" weight=\"semibold\">\n {title}\n </Text>\n );\n};\n"],"names":["classnames"],"mappings":";;;;AA2BO,MAAM,YAAsC,CAAC;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,UAAUA,WAAW,OAAO,YAAY,GAAG,SAAS;AAGxD,SAAA,oBAAC,MAAK,EAAA,IAAG,MAAK,IAAQ,WAAW,SAAS,MAAK,MAAK,QAAO,YACxD,UACH,MAAA,CAAA;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuTitle.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuTitle.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -92,7 +92,12 @@ const TooltipAnchor = ({
|
|
|
92
92
|
const element = React.useMemo(() => {
|
|
93
93
|
if (!React.isValidElement(children)) return;
|
|
94
94
|
if (isTriggerInteractive) {
|
|
95
|
-
const props = context.getReferenceProps({
|
|
95
|
+
const props = context.getReferenceProps({
|
|
96
|
+
// To support React 18, we need to explicitly pass the children's props. See https://github.com/element-hq/compound/issues/333
|
|
97
|
+
// In React 19, this is not necessary. `getReferenceProps` is able to get the props directly from the ref.
|
|
98
|
+
...typeof children.props === "object" ? children.props : {},
|
|
99
|
+
ref
|
|
100
|
+
});
|
|
96
101
|
return React.cloneElement(children, props);
|
|
97
102
|
} else {
|
|
98
103
|
const props = context.getReferenceProps({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.cjs","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 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 { TooltipContext, useTooltipContext } from \"./TooltipContext\";\nimport {\n FloatingArrow,\n FloatingPortal,\n useMergeRefs,\n} from \"@floating-ui/react\";\nimport React, {\n PropsWithChildren,\n Ref,\n JSX,\n isValidElement,\n cloneElement,\n useMemo,\n ReactNode,\n FC,\n ReactElement,\n} from \"react\";\n\nimport classNames from \"classnames\";\nimport styles from \"./Tooltip.module.css\";\nimport {\n CommonUseTooltipProps,\n TooltipDescription,\n TooltipLabel,\n useTooltip,\n} from \"./useTooltip\";\n\n// Unfortunately Omit doesn't distribute nicely over sum types, so we have to\n// piece together the useTooltip options type by hand\ntype TooltipProps = Omit<CommonUseTooltipProps, \"isTriggerInteractive\"> &\n (TooltipLabel | TooltipDescription) & {\n /**\n * Whether the trigger element is interactive.\n * When trigger is interactive:\n * - tooltip will be shown after a 300ms delay.\n * When trigger is not interactive:\n * - tooltip will be shown instantly when pointer enters trigger.\n * - trigger will be wrapped in a span with a tab index from prop nonInteractiveTriggerTabIndex\n * @default true\n */\n isTriggerInteractive?: boolean;\n /**\n * The tab index for the non interactive trigger.\n * @default 0\n */\n nonInteractiveTriggerTabIndex?: number;\n };\n\nconst hasLabel = (\n props: TooltipLabel | TooltipDescription,\n): props is TooltipLabel => \"label\" in props && !!props.label;\n\n/**\n * A tooltip component\n */\nexport function Tooltip({\n children,\n isTriggerInteractive = true,\n nonInteractiveTriggerTabIndex = 0,\n ...props\n}: PropsWithChildren<TooltipProps>): JSX.Element {\n const context = useTooltip({ isTriggerInteractive, ...props });\n\n return (\n <TooltipContext.Provider value={context}>\n <TooltipAnchor\n isTriggerInteractive={isTriggerInteractive}\n nonInteractiveTriggerTabIndex={nonInteractiveTriggerTabIndex}\n >\n {children}\n </TooltipAnchor>\n <TooltipContent>\n <span id={context.labelId}>\n {hasLabel(props) ? props.label : props.description}\n </span>\n <Caption />\n </TooltipContent>\n </TooltipContext.Provider>\n );\n}\n\nfunction Caption() {\n const { caption, captionId } = useTooltipContext();\n if (!caption) return null;\n\n const isCaptionString = typeof caption === \"string\";\n const Container = isCaptionString ? \"span\" : \"div\";\n\n /**\n * Forcing dark theme, so that we have the correct contrast when\n * using the text color secondary on a solid dark background.\n * This is temporary and should only remain until we figure out\n * the approach to on-solid tokens\n **/\n return (\n <Container\n id={captionId}\n className={classNames(styles.caption, \"cpd-theme-dark\")}\n >\n {caption}\n </Container>\n );\n}\n\n/**\n * The content of the tooltip\n * @param children\n */\nfunction TooltipContent({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element | null {\n const {\n context: floatingContext,\n open,\n arrowRef,\n purpose,\n ...rest\n } = useTooltipContext();\n\n // Label tooltips are kept in the DOM even when not visually open\n if (!open && purpose !== \"label\") return null;\n\n return (\n <FloatingPortal>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n {...rest.tooltipProps}\n {...rest.getFloatingProps()}\n className={classNames(styles.tooltip, {\n [styles.invisible]: purpose === \"label\" && !open,\n })}\n >\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={10}\n height={6}\n className={styles.arrow}\n />\n {children}\n </div>\n </FloatingPortal>\n );\n}\n\ninterface TooltipAnchorProps {\n children: ReactNode;\n isTriggerInteractive: boolean;\n nonInteractiveTriggerTabIndex?: number;\n}\n\n/**\n * The anchor of the tooltip\n * @param children\n */\nconst TooltipAnchor: FC<TooltipAnchorProps> = ({\n children,\n isTriggerInteractive,\n nonInteractiveTriggerTabIndex,\n}) => {\n const context = useTooltipContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n const element = useMemo(() => {\n if (!isValidElement(children)) return;\n\n if (isTriggerInteractive) {\n const props = context.getReferenceProps({ ref });\n return cloneElement(children, props);\n } else {\n // For a non-interactive trigger, we want most of the props to go on the\n // span element that we provide, since that's what receives focus, but it\n // should still be the trigger that receives the label/description. It\n // would be wrong to label the span element, as it lacks a role.\n const props = context.getReferenceProps({\n ref,\n tabIndex: nonInteractiveTriggerTabIndex,\n });\n const {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n ...spanProps\n } = props;\n return (\n <span tabIndex={nonInteractiveTriggerTabIndex} {...spanProps}>\n {cloneElement(children as ReactElement<Record<string, unknown>>, {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n })}\n </span>\n );\n }\n }, [context, ref, children]);\n\n if (!element) {\n throw new Error(\"Tooltip anchor must be a single valid React element\");\n }\n\n return element;\n};\n"],"names":["useTooltip","jsxs","TooltipContext","jsx","useTooltipContext","styles","FloatingPortal","FloatingArrow","useMergeRefs","useMemo","isValidElement","cloneElement"],"mappings":";;;;;;;;;AAuDA,MAAM,WAAW,CACf,UAC0B,WAAW,SAAS,CAAC,CAAC,MAAM;AAKjD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA,uBAAuB;AAAA,EACvB,gCAAgC;AAAA,EAChC,GAAG;AACL,GAAiD;AAC/C,QAAM,UAAUA,WAAW,WAAA,EAAE,sBAAsB,GAAG,OAAO;AAE7D,SACGC,2BAAAA,KAAAC,eAAAA,eAAe,UAAf,EAAwB,OAAO,SAC9B,UAAA;AAAA,IAAAC,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QAEC;AAAA,MAAA;AAAA,IACH;AAAA,oCACC,gBACC,EAAA,UAAA;AAAA,MAACA,2BAAAA,IAAA,QAAA,EAAK,IAAI,QAAQ,SACf,UAAA,SAAS,KAAK,IAAI,MAAM,QAAQ,MAAM,YACzC,CAAA;AAAA,qCACC,SAAQ,CAAA,CAAA;AAAA,IAAA,EACX,CAAA;AAAA,EAAA,GACF;AAEJ;AAEA,SAAS,UAAU;AACjB,QAAM,EAAE,SAAS,UAAU,IAAIC,iCAAkB;AAC7C,MAAA,CAAC,QAAgB,QAAA;AAEf,QAAA,kBAAkB,OAAO,YAAY;AACrC,QAAA,YAAY,kBAAkB,SAAS;AAS3C,SAAAD,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAI;AAAA,MACJ,WAAW,WAAWE,uBAAO,SAAS,gBAAgB;AAAA,MAErD,UAAA;AAAA,IAAA;AAAA,EACH;AAEJ;AAMA,SAAS,eAAe;AAAA,EACtB;AACF,GAAoD;AAC5C,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,MACDD,iCAAkB;AAGtB,MAAI,CAAC,QAAQ,YAAY,QAAgB,QAAA;AAEzC,wCACGE,MAAAA,gBACC,EAAA,UAAAL,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK,KAAK,KAAK;AAAA,MACf,OAAO,KAAK;AAAA,MACX,GAAG,KAAK;AAAA,MACR,GAAG,KAAK,iBAAiB;AAAA,MAC1B,WAAW,WAAWI,eAAA,QAAO,SAAS;AAAA,QACpC,CAACA,uBAAO,SAAS,GAAG,YAAY,WAAW,CAAC;AAAA,MAAA,CAC7C;AAAA,MAED,UAAA;AAAA,QAAAF,2BAAA;AAAA,UAACI,MAAA;AAAA,UAAA;AAAA,YACC,KAAK;AAAA,YACL,SAAS;AAAA,YAET,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,WAAWF,eAAAA,QAAO;AAAA,UAAA;AAAA,QACpB;AAAA,QACC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;AAYA,MAAM,gBAAwC,CAAC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,UAAUD,eAAAA,kBAAkB;AAIlC,QAAM,cAAe,UAAoD;AACzE,QAAM,MAAMI,MAAAA,aAAa,CAAC,QAAQ,KAAK,cAAc,WAAW,CAAC;AAE3D,QAAA,UAAUC,MAAAA,QAAQ,MAAM;AACxB,QAAA,CAACC,MAAAA,eAAe,QAAQ,EAAG;AAE/B,QAAI,sBAAsB;
|
|
1
|
+
{"version":3,"file":"Tooltip.cjs","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 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 { TooltipContext, useTooltipContext } from \"./TooltipContext\";\nimport {\n FloatingArrow,\n FloatingPortal,\n useMergeRefs,\n} from \"@floating-ui/react\";\nimport React, {\n PropsWithChildren,\n Ref,\n JSX,\n isValidElement,\n cloneElement,\n useMemo,\n ReactNode,\n FC,\n ReactElement,\n} from \"react\";\n\nimport classNames from \"classnames\";\nimport styles from \"./Tooltip.module.css\";\nimport {\n CommonUseTooltipProps,\n TooltipDescription,\n TooltipLabel,\n useTooltip,\n} from \"./useTooltip\";\n\n// Unfortunately Omit doesn't distribute nicely over sum types, so we have to\n// piece together the useTooltip options type by hand\ntype TooltipProps = Omit<CommonUseTooltipProps, \"isTriggerInteractive\"> &\n (TooltipLabel | TooltipDescription) & {\n /**\n * Whether the trigger element is interactive.\n * When trigger is interactive:\n * - tooltip will be shown after a 300ms delay.\n * When trigger is not interactive:\n * - tooltip will be shown instantly when pointer enters trigger.\n * - trigger will be wrapped in a span with a tab index from prop nonInteractiveTriggerTabIndex\n * @default true\n */\n isTriggerInteractive?: boolean;\n /**\n * The tab index for the non interactive trigger.\n * @default 0\n */\n nonInteractiveTriggerTabIndex?: number;\n };\n\nconst hasLabel = (\n props: TooltipLabel | TooltipDescription,\n): props is TooltipLabel => \"label\" in props && !!props.label;\n\n/**\n * A tooltip component\n */\nexport function Tooltip({\n children,\n isTriggerInteractive = true,\n nonInteractiveTriggerTabIndex = 0,\n ...props\n}: PropsWithChildren<TooltipProps>): JSX.Element {\n const context = useTooltip({ isTriggerInteractive, ...props });\n\n return (\n <TooltipContext.Provider value={context}>\n <TooltipAnchor\n isTriggerInteractive={isTriggerInteractive}\n nonInteractiveTriggerTabIndex={nonInteractiveTriggerTabIndex}\n >\n {children}\n </TooltipAnchor>\n <TooltipContent>\n <span id={context.labelId}>\n {hasLabel(props) ? props.label : props.description}\n </span>\n <Caption />\n </TooltipContent>\n </TooltipContext.Provider>\n );\n}\n\nfunction Caption() {\n const { caption, captionId } = useTooltipContext();\n if (!caption) return null;\n\n const isCaptionString = typeof caption === \"string\";\n const Container = isCaptionString ? \"span\" : \"div\";\n\n /**\n * Forcing dark theme, so that we have the correct contrast when\n * using the text color secondary on a solid dark background.\n * This is temporary and should only remain until we figure out\n * the approach to on-solid tokens\n **/\n return (\n <Container\n id={captionId}\n className={classNames(styles.caption, \"cpd-theme-dark\")}\n >\n {caption}\n </Container>\n );\n}\n\n/**\n * The content of the tooltip\n * @param children\n */\nfunction TooltipContent({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element | null {\n const {\n context: floatingContext,\n open,\n arrowRef,\n purpose,\n ...rest\n } = useTooltipContext();\n\n // Label tooltips are kept in the DOM even when not visually open\n if (!open && purpose !== \"label\") return null;\n\n return (\n <FloatingPortal>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n {...rest.tooltipProps}\n {...rest.getFloatingProps()}\n className={classNames(styles.tooltip, {\n [styles.invisible]: purpose === \"label\" && !open,\n })}\n >\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={10}\n height={6}\n className={styles.arrow}\n />\n {children}\n </div>\n </FloatingPortal>\n );\n}\n\ninterface TooltipAnchorProps {\n children: ReactNode;\n isTriggerInteractive: boolean;\n nonInteractiveTriggerTabIndex?: number;\n}\n\n/**\n * The anchor of the tooltip\n * @param children\n */\nconst TooltipAnchor: FC<TooltipAnchorProps> = ({\n children,\n isTriggerInteractive,\n nonInteractiveTriggerTabIndex,\n}) => {\n const context = useTooltipContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n const element = useMemo(() => {\n if (!isValidElement(children)) return;\n\n if (isTriggerInteractive) {\n const props = context.getReferenceProps({\n // To support React 18, we need to explicitly pass the children's props. See https://github.com/element-hq/compound/issues/333\n // In React 19, this is not necessary. `getReferenceProps` is able to get the props directly from the ref.\n ...(typeof children.props === \"object\" ? children.props : {}),\n ref,\n });\n return cloneElement(children, props);\n } else {\n // For a non-interactive trigger, we want most of the props to go on the\n // span element that we provide, since that's what receives focus, but it\n // should still be the trigger that receives the label/description. It\n // would be wrong to label the span element, as it lacks a role.\n const props = context.getReferenceProps({\n ref,\n tabIndex: nonInteractiveTriggerTabIndex,\n });\n const {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n ...spanProps\n } = props;\n return (\n <span tabIndex={nonInteractiveTriggerTabIndex} {...spanProps}>\n {cloneElement(children as ReactElement<Record<string, unknown>>, {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n })}\n </span>\n );\n }\n }, [context, ref, children]);\n\n if (!element) {\n throw new Error(\"Tooltip anchor must be a single valid React element\");\n }\n\n return element;\n};\n"],"names":["useTooltip","jsxs","TooltipContext","jsx","useTooltipContext","styles","FloatingPortal","FloatingArrow","useMergeRefs","useMemo","isValidElement","cloneElement"],"mappings":";;;;;;;;;AAuDA,MAAM,WAAW,CACf,UAC0B,WAAW,SAAS,CAAC,CAAC,MAAM;AAKjD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA,uBAAuB;AAAA,EACvB,gCAAgC;AAAA,EAChC,GAAG;AACL,GAAiD;AAC/C,QAAM,UAAUA,WAAW,WAAA,EAAE,sBAAsB,GAAG,OAAO;AAE7D,SACGC,2BAAAA,KAAAC,eAAAA,eAAe,UAAf,EAAwB,OAAO,SAC9B,UAAA;AAAA,IAAAC,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QAEC;AAAA,MAAA;AAAA,IACH;AAAA,oCACC,gBACC,EAAA,UAAA;AAAA,MAACA,2BAAAA,IAAA,QAAA,EAAK,IAAI,QAAQ,SACf,UAAA,SAAS,KAAK,IAAI,MAAM,QAAQ,MAAM,YACzC,CAAA;AAAA,qCACC,SAAQ,CAAA,CAAA;AAAA,IAAA,EACX,CAAA;AAAA,EAAA,GACF;AAEJ;AAEA,SAAS,UAAU;AACjB,QAAM,EAAE,SAAS,UAAU,IAAIC,iCAAkB;AAC7C,MAAA,CAAC,QAAgB,QAAA;AAEf,QAAA,kBAAkB,OAAO,YAAY;AACrC,QAAA,YAAY,kBAAkB,SAAS;AAS3C,SAA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AA;AAAA;AAAA,QAGtC,GAAI,OAAO,SAAS,UAAU,WAAW,SAAS,QAAQ,CAAC;AAAA,QAC3D;AAAA,MAAA,CACD;AACM,aAAAC,MAAA,aAAa,UAAU,KAAK;AAAA,IAAA,OAC9B;AAKC,YAAA,QAAQ,QAAQ,kBAAkB;AAAA,QACtC;AAAA,QACA,UAAU;AAAA,MAAA,CACX;AACK,YAAA;AAAA,QACJ,mBAAmB;AAAA,QACnB,oBAAoB;AAAA,QACpB,GAAG;AAAA,MAAA,IACD;AACJ,4CACG,QAAK,EAAA,UAAU,+BAAgC,GAAG,WAChD,6BAAa,UAAmD;AAAA,QAC/D,mBAAmB;AAAA,QACnB,oBAAoB;AAAA,MACrB,CAAA,GACH;AAAA,IAAA;AAAA,EAGH,GAAA,CAAC,SAAS,KAAK,QAAQ,CAAC;AAE3B,MAAI,CAAC,SAAS;AACN,UAAA,IAAI,MAAM,qDAAqD;AAAA,EAAA;AAGhE,SAAA;AACT;;"}
|
|
@@ -90,7 +90,12 @@ const TooltipAnchor = ({
|
|
|
90
90
|
const element = useMemo(() => {
|
|
91
91
|
if (!isValidElement(children)) return;
|
|
92
92
|
if (isTriggerInteractive) {
|
|
93
|
-
const props = context.getReferenceProps({
|
|
93
|
+
const props = context.getReferenceProps({
|
|
94
|
+
// To support React 18, we need to explicitly pass the children's props. See https://github.com/element-hq/compound/issues/333
|
|
95
|
+
// In React 19, this is not necessary. `getReferenceProps` is able to get the props directly from the ref.
|
|
96
|
+
...typeof children.props === "object" ? children.props : {},
|
|
97
|
+
ref
|
|
98
|
+
});
|
|
94
99
|
return cloneElement(children, props);
|
|
95
100
|
} else {
|
|
96
101
|
const props = context.getReferenceProps({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 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 { TooltipContext, useTooltipContext } from \"./TooltipContext\";\nimport {\n FloatingArrow,\n FloatingPortal,\n useMergeRefs,\n} from \"@floating-ui/react\";\nimport React, {\n PropsWithChildren,\n Ref,\n JSX,\n isValidElement,\n cloneElement,\n useMemo,\n ReactNode,\n FC,\n ReactElement,\n} from \"react\";\n\nimport classNames from \"classnames\";\nimport styles from \"./Tooltip.module.css\";\nimport {\n CommonUseTooltipProps,\n TooltipDescription,\n TooltipLabel,\n useTooltip,\n} from \"./useTooltip\";\n\n// Unfortunately Omit doesn't distribute nicely over sum types, so we have to\n// piece together the useTooltip options type by hand\ntype TooltipProps = Omit<CommonUseTooltipProps, \"isTriggerInteractive\"> &\n (TooltipLabel | TooltipDescription) & {\n /**\n * Whether the trigger element is interactive.\n * When trigger is interactive:\n * - tooltip will be shown after a 300ms delay.\n * When trigger is not interactive:\n * - tooltip will be shown instantly when pointer enters trigger.\n * - trigger will be wrapped in a span with a tab index from prop nonInteractiveTriggerTabIndex\n * @default true\n */\n isTriggerInteractive?: boolean;\n /**\n * The tab index for the non interactive trigger.\n * @default 0\n */\n nonInteractiveTriggerTabIndex?: number;\n };\n\nconst hasLabel = (\n props: TooltipLabel | TooltipDescription,\n): props is TooltipLabel => \"label\" in props && !!props.label;\n\n/**\n * A tooltip component\n */\nexport function Tooltip({\n children,\n isTriggerInteractive = true,\n nonInteractiveTriggerTabIndex = 0,\n ...props\n}: PropsWithChildren<TooltipProps>): JSX.Element {\n const context = useTooltip({ isTriggerInteractive, ...props });\n\n return (\n <TooltipContext.Provider value={context}>\n <TooltipAnchor\n isTriggerInteractive={isTriggerInteractive}\n nonInteractiveTriggerTabIndex={nonInteractiveTriggerTabIndex}\n >\n {children}\n </TooltipAnchor>\n <TooltipContent>\n <span id={context.labelId}>\n {hasLabel(props) ? props.label : props.description}\n </span>\n <Caption />\n </TooltipContent>\n </TooltipContext.Provider>\n );\n}\n\nfunction Caption() {\n const { caption, captionId } = useTooltipContext();\n if (!caption) return null;\n\n const isCaptionString = typeof caption === \"string\";\n const Container = isCaptionString ? \"span\" : \"div\";\n\n /**\n * Forcing dark theme, so that we have the correct contrast when\n * using the text color secondary on a solid dark background.\n * This is temporary and should only remain until we figure out\n * the approach to on-solid tokens\n **/\n return (\n <Container\n id={captionId}\n className={classNames(styles.caption, \"cpd-theme-dark\")}\n >\n {caption}\n </Container>\n );\n}\n\n/**\n * The content of the tooltip\n * @param children\n */\nfunction TooltipContent({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element | null {\n const {\n context: floatingContext,\n open,\n arrowRef,\n purpose,\n ...rest\n } = useTooltipContext();\n\n // Label tooltips are kept in the DOM even when not visually open\n if (!open && purpose !== \"label\") return null;\n\n return (\n <FloatingPortal>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n {...rest.tooltipProps}\n {...rest.getFloatingProps()}\n className={classNames(styles.tooltip, {\n [styles.invisible]: purpose === \"label\" && !open,\n })}\n >\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={10}\n height={6}\n className={styles.arrow}\n />\n {children}\n </div>\n </FloatingPortal>\n );\n}\n\ninterface TooltipAnchorProps {\n children: ReactNode;\n isTriggerInteractive: boolean;\n nonInteractiveTriggerTabIndex?: number;\n}\n\n/**\n * The anchor of the tooltip\n * @param children\n */\nconst TooltipAnchor: FC<TooltipAnchorProps> = ({\n children,\n isTriggerInteractive,\n nonInteractiveTriggerTabIndex,\n}) => {\n const context = useTooltipContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n const element = useMemo(() => {\n if (!isValidElement(children)) return;\n\n if (isTriggerInteractive) {\n const props = context.getReferenceProps({ ref });\n return cloneElement(children, props);\n } else {\n // For a non-interactive trigger, we want most of the props to go on the\n // span element that we provide, since that's what receives focus, but it\n // should still be the trigger that receives the label/description. It\n // would be wrong to label the span element, as it lacks a role.\n const props = context.getReferenceProps({\n ref,\n tabIndex: nonInteractiveTriggerTabIndex,\n });\n const {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n ...spanProps\n } = props;\n return (\n <span tabIndex={nonInteractiveTriggerTabIndex} {...spanProps}>\n {cloneElement(children as ReactElement<Record<string, unknown>>, {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n })}\n </span>\n );\n }\n }, [context, ref, children]);\n\n if (!element) {\n throw new Error(\"Tooltip anchor must be a single valid React element\");\n }\n\n return element;\n};\n"],"names":[],"mappings":";;;;;;;AAuDA,MAAM,WAAW,CACf,UAC0B,WAAW,SAAS,CAAC,CAAC,MAAM;AAKjD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA,uBAAuB;AAAA,EACvB,gCAAgC;AAAA,EAChC,GAAG;AACL,GAAiD;AAC/C,QAAM,UAAU,WAAW,EAAE,sBAAsB,GAAG,OAAO;AAE7D,SACG,qBAAA,eAAe,UAAf,EAAwB,OAAO,SAC9B,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QAEC;AAAA,MAAA;AAAA,IACH;AAAA,yBACC,gBACC,EAAA,UAAA;AAAA,MAAC,oBAAA,QAAA,EAAK,IAAI,QAAQ,SACf,UAAA,SAAS,KAAK,IAAI,MAAM,QAAQ,MAAM,YACzC,CAAA;AAAA,0BACC,SAAQ,CAAA,CAAA;AAAA,IAAA,EACX,CAAA;AAAA,EAAA,GACF;AAEJ;AAEA,SAAS,UAAU;AACjB,QAAM,EAAE,SAAS,UAAU,IAAI,kBAAkB;AAC7C,MAAA,CAAC,QAAgB,QAAA;AAEf,QAAA,kBAAkB,OAAO,YAAY;AACrC,QAAA,YAAY,kBAAkB,SAAS;AAS3C,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAI;AAAA,MACJ,WAAW,WAAW,OAAO,SAAS,gBAAgB;AAAA,MAErD,UAAA;AAAA,IAAA;AAAA,EACH;AAEJ;AAMA,SAAS,eAAe;AAAA,EACtB;AACF,GAAoD;AAC5C,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,MACD,kBAAkB;AAGtB,MAAI,CAAC,QAAQ,YAAY,QAAgB,QAAA;AAEzC,6BACG,gBACC,EAAA,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK,KAAK,KAAK;AAAA,MACf,OAAO,KAAK;AAAA,MACX,GAAG,KAAK;AAAA,MACR,GAAG,KAAK,iBAAiB;AAAA,MAC1B,WAAW,WAAW,OAAO,SAAS;AAAA,QACpC,CAAC,OAAO,SAAS,GAAG,YAAY,WAAW,CAAC;AAAA,MAAA,CAC7C;AAAA,MAED,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAK;AAAA,YACL,SAAS;AAAA,YAET,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,WAAW,OAAO;AAAA,UAAA;AAAA,QACpB;AAAA,QACC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;AAYA,MAAM,gBAAwC,CAAC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,UAAU,kBAAkB;AAIlC,QAAM,cAAe,UAAoD;AACzE,QAAM,MAAM,aAAa,CAAC,QAAQ,KAAK,cAAc,WAAW,CAAC;AAE3D,QAAA,UAAU,QAAQ,MAAM;AACxB,QAAA,CAAC,eAAe,QAAQ,EAAG;AAE/B,QAAI,sBAAsB;
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/*\nCopyright 2023, 2024 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 { TooltipContext, useTooltipContext } from \"./TooltipContext\";\nimport {\n FloatingArrow,\n FloatingPortal,\n useMergeRefs,\n} from \"@floating-ui/react\";\nimport React, {\n PropsWithChildren,\n Ref,\n JSX,\n isValidElement,\n cloneElement,\n useMemo,\n ReactNode,\n FC,\n ReactElement,\n} from \"react\";\n\nimport classNames from \"classnames\";\nimport styles from \"./Tooltip.module.css\";\nimport {\n CommonUseTooltipProps,\n TooltipDescription,\n TooltipLabel,\n useTooltip,\n} from \"./useTooltip\";\n\n// Unfortunately Omit doesn't distribute nicely over sum types, so we have to\n// piece together the useTooltip options type by hand\ntype TooltipProps = Omit<CommonUseTooltipProps, \"isTriggerInteractive\"> &\n (TooltipLabel | TooltipDescription) & {\n /**\n * Whether the trigger element is interactive.\n * When trigger is interactive:\n * - tooltip will be shown after a 300ms delay.\n * When trigger is not interactive:\n * - tooltip will be shown instantly when pointer enters trigger.\n * - trigger will be wrapped in a span with a tab index from prop nonInteractiveTriggerTabIndex\n * @default true\n */\n isTriggerInteractive?: boolean;\n /**\n * The tab index for the non interactive trigger.\n * @default 0\n */\n nonInteractiveTriggerTabIndex?: number;\n };\n\nconst hasLabel = (\n props: TooltipLabel | TooltipDescription,\n): props is TooltipLabel => \"label\" in props && !!props.label;\n\n/**\n * A tooltip component\n */\nexport function Tooltip({\n children,\n isTriggerInteractive = true,\n nonInteractiveTriggerTabIndex = 0,\n ...props\n}: PropsWithChildren<TooltipProps>): JSX.Element {\n const context = useTooltip({ isTriggerInteractive, ...props });\n\n return (\n <TooltipContext.Provider value={context}>\n <TooltipAnchor\n isTriggerInteractive={isTriggerInteractive}\n nonInteractiveTriggerTabIndex={nonInteractiveTriggerTabIndex}\n >\n {children}\n </TooltipAnchor>\n <TooltipContent>\n <span id={context.labelId}>\n {hasLabel(props) ? props.label : props.description}\n </span>\n <Caption />\n </TooltipContent>\n </TooltipContext.Provider>\n );\n}\n\nfunction Caption() {\n const { caption, captionId } = useTooltipContext();\n if (!caption) return null;\n\n const isCaptionString = typeof caption === \"string\";\n const Container = isCaptionString ? \"span\" : \"div\";\n\n /**\n * Forcing dark theme, so that we have the correct contrast when\n * using the text color secondary on a solid dark background.\n * This is temporary and should only remain until we figure out\n * the approach to on-solid tokens\n **/\n return (\n <Container\n id={captionId}\n className={classNames(styles.caption, \"cpd-theme-dark\")}\n >\n {caption}\n </Container>\n );\n}\n\n/**\n * The content of the tooltip\n * @param children\n */\nfunction TooltipContent({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element | null {\n const {\n context: floatingContext,\n open,\n arrowRef,\n purpose,\n ...rest\n } = useTooltipContext();\n\n // Label tooltips are kept in the DOM even when not visually open\n if (!open && purpose !== \"label\") return null;\n\n return (\n <FloatingPortal>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n {...rest.tooltipProps}\n {...rest.getFloatingProps()}\n className={classNames(styles.tooltip, {\n [styles.invisible]: purpose === \"label\" && !open,\n })}\n >\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={10}\n height={6}\n className={styles.arrow}\n />\n {children}\n </div>\n </FloatingPortal>\n );\n}\n\ninterface TooltipAnchorProps {\n children: ReactNode;\n isTriggerInteractive: boolean;\n nonInteractiveTriggerTabIndex?: number;\n}\n\n/**\n * The anchor of the tooltip\n * @param children\n */\nconst TooltipAnchor: FC<TooltipAnchorProps> = ({\n children,\n isTriggerInteractive,\n nonInteractiveTriggerTabIndex,\n}) => {\n const context = useTooltipContext();\n\n // The children can have a ref and we don't want to discard it\n // Doing a dirty cast to get the optional ref\n const childrenRef = (children as unknown as { ref?: Ref<HTMLElement> })?.ref;\n const ref = useMergeRefs([context.refs.setReference, childrenRef]);\n\n const element = useMemo(() => {\n if (!isValidElement(children)) return;\n\n if (isTriggerInteractive) {\n const props = context.getReferenceProps({\n // To support React 18, we need to explicitly pass the children's props. See https://github.com/element-hq/compound/issues/333\n // In React 19, this is not necessary. `getReferenceProps` is able to get the props directly from the ref.\n ...(typeof children.props === \"object\" ? children.props : {}),\n ref,\n });\n return cloneElement(children, props);\n } else {\n // For a non-interactive trigger, we want most of the props to go on the\n // span element that we provide, since that's what receives focus, but it\n // should still be the trigger that receives the label/description. It\n // would be wrong to label the span element, as it lacks a role.\n const props = context.getReferenceProps({\n ref,\n tabIndex: nonInteractiveTriggerTabIndex,\n });\n const {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n ...spanProps\n } = props;\n return (\n <span tabIndex={nonInteractiveTriggerTabIndex} {...spanProps}>\n {cloneElement(children as ReactElement<Record<string, unknown>>, {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": descriptionId,\n })}\n </span>\n );\n }\n }, [context, ref, children]);\n\n if (!element) {\n throw new Error(\"Tooltip anchor must be a single valid React element\");\n }\n\n return element;\n};\n"],"names":[],"mappings":";;;;;;;AAuDA,MAAM,WAAW,CACf,UAC0B,WAAW,SAAS,CAAC,CAAC,MAAM;AAKjD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA,uBAAuB;AAAA,EACvB,gCAAgC;AAAA,EAChC,GAAG;AACL,GAAiD;AAC/C,QAAM,UAAU,WAAW,EAAE,sBAAsB,GAAG,OAAO;AAE7D,SACG,qBAAA,eAAe,UAAf,EAAwB,OAAO,SAC9B,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QAEC;AAAA,MAAA;AAAA,IACH;AAAA,yBACC,gBACC,EAAA,UAAA;AAAA,MAAC,oBAAA,QAAA,EAAK,IAAI,QAAQ,SACf,UAAA,SAAS,KAAK,IAAI,MAAM,QAAQ,MAAM,YACzC,CAAA;AAAA,0BACC,SAAQ,CAAA,CAAA;AAAA,IAAA,EACX,CAAA;AAAA,EAAA,GACF;AAEJ;AAEA,SAAS,UAAU;AACjB,QAAM,EAAE,SAAS,UAAU,IAAI,kBAAkB;AAC7C,MAAA,CAAC,QAAgB,QAAA;AAEf,QAAA,kBAAkB,OAAO,YAAY;AACrC,QAAA,YAA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,CAAC;AAAA,QAC3D;AAAA,MAAA,CACD;AACM,aAAA,aAAa,UAAU,KAAK;AAAA,IAAA,OAC9B;AAKC,YAAA,QAAQ,QAAQ,kBAAkB;AAAA,QACtC;AAAA,QACA,UAAU;AAAA,MAAA,CACX;AACK,YAAA;AAAA,QACJ,mBAAmB;AAAA,QACnB,oBAAoB;AAAA,QACpB,GAAG;AAAA,MAAA,IACD;AACJ,iCACG,QAAK,EAAA,UAAU,+BAAgC,GAAG,WAChD,uBAAa,UAAmD;AAAA,QAC/D,mBAAmB;AAAA,QACnB,oBAAoB;AAAA,MACrB,CAAA,GACH;AAAA,IAAA;AAAA,EAGH,GAAA,CAAC,SAAS,KAAK,QAAQ,CAAC;AAE3B,MAAI,CAAC,SAAS;AACN,UAAA,IAAI,MAAM,qDAAqD;AAAA,EAAA;AAGhE,SAAA;AACT;"}
|
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,7 @@ const InlineSpinner = require("./components/InlineSpinner/InlineSpinner.cjs");
|
|
|
35
35
|
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
|
+
const ChatFilter = require("./components/ChatFilter/ChatFilter.cjs");
|
|
38
39
|
const Text$1 = require("./components/Form/Controls/Text/Text.cjs");
|
|
39
40
|
const Action = require("./components/Form/Controls/Action/Action.cjs");
|
|
40
41
|
const Password = require("./components/Form/Controls/Password/Password.cjs");
|
|
@@ -90,6 +91,7 @@ exports.InlineSpinner = InlineSpinner.InlineSpinner;
|
|
|
90
91
|
exports.Breadcrumb = Breadcrumb.Breadcrumb;
|
|
91
92
|
exports.VisualList = VisualList.VisualList;
|
|
92
93
|
exports.VisualListItem = VisualListItem.VisualListItem;
|
|
94
|
+
exports.ChatFilter = ChatFilter.ChatFilter;
|
|
93
95
|
exports.Control = Text$1.TextControl;
|
|
94
96
|
exports.TextControl = Text$1.TextControl;
|
|
95
97
|
exports.TextInput = Text$1.TextInput;
|
package/dist/index.cjs.map
CHANGED
|
@@ -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
|
@@ -29,6 +29,7 @@ export { Dropdown } from './components/Dropdown';
|
|
|
29
29
|
export { InlineSpinner } from './components/InlineSpinner';
|
|
30
30
|
export { Breadcrumb } from './components/Breadcrumb';
|
|
31
31
|
export { VisualList, VisualListItem } from './components/VisualList';
|
|
32
|
+
export { ChatFilter } from './components/ChatFilter';
|
|
32
33
|
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';
|
|
33
34
|
export * as Form from './components/Form';
|
|
34
35
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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;A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b } from "./components/Breadcrumb/Breadcrumb.js";
|
|
34
34
|
import { VisualList } from "./components/VisualList/VisualList.js";
|
|
35
35
|
import { VisualListItem } from "./components/VisualList/VisualListItem.js";
|
|
36
|
+
import { ChatFilter } from "./components/ChatFilter/ChatFilter.js";
|
|
36
37
|
import { TextControl, TextControl as TextControl2, TextInput } from "./components/Form/Controls/Text/Text.js";
|
|
37
38
|
import { ActionControl, ActionInput } from "./components/Form/Controls/Action/Action.js";
|
|
38
39
|
import { PasswordControl, PasswordInput } from "./components/Form/Controls/Password/Password.js";
|
|
@@ -59,6 +60,7 @@ export {
|
|
|
59
60
|
Body,
|
|
60
61
|
Breadcrumb,
|
|
61
62
|
Button,
|
|
63
|
+
ChatFilter,
|
|
62
64
|
CheckboxInput as Checkbox,
|
|
63
65
|
CheckboxControl,
|
|
64
66
|
CheckboxInput2 as CheckboxInput,
|
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
|
@@ -594,7 +594,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
|
594
594
|
Please see LICENSE files in the repository root for full details.
|
|
595
595
|
*/
|
|
596
596
|
|
|
597
|
-
.
|
|
597
|
+
._menu_19sse_8 {
|
|
598
598
|
border-radius: var(--cpd-space-3x);
|
|
599
599
|
background: var(--cpd-color-bg-canvas-default);
|
|
600
600
|
|
|
@@ -616,56 +616,67 @@ Please see LICENSE files in the repository root for full details.
|
|
|
616
616
|
--cpd-separator-inset: var(--cpd-space-4x);
|
|
617
617
|
}
|
|
618
618
|
|
|
619
|
-
@keyframes _slide-
|
|
619
|
+
@keyframes _slide-in_19sse_1 {
|
|
620
620
|
from {
|
|
621
621
|
opacity: 0;
|
|
622
622
|
transform: translate(0, var(--cpd-space-3x));
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
|
|
626
|
-
@keyframes _slide-
|
|
626
|
+
@keyframes _slide-out_19sse_1 {
|
|
627
627
|
to {
|
|
628
628
|
opacity: 0;
|
|
629
629
|
transform: translate(0, var(--cpd-space-2x));
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
632
|
|
|
633
|
-
.
|
|
634
|
-
animation: _slide-
|
|
633
|
+
._menu_19sse_8[data-state="open"] {
|
|
634
|
+
animation: _slide-in_19sse_1 180ms;
|
|
635
635
|
}
|
|
636
636
|
|
|
637
|
-
.
|
|
638
|
-
animation: _slide-
|
|
637
|
+
._menu_19sse_8[data-state="closed"] {
|
|
638
|
+
animation: _slide-out_19sse_1 110ms;
|
|
639
639
|
}
|
|
640
640
|
|
|
641
|
-
@keyframes _fade-
|
|
641
|
+
@keyframes _fade-in_19sse_1 {
|
|
642
642
|
from {
|
|
643
643
|
opacity: 0;
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
|
|
647
|
-
@keyframes _fade-
|
|
647
|
+
@keyframes _fade-out_19sse_1 {
|
|
648
648
|
to {
|
|
649
649
|
opacity: 0;
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
@media (prefers-reduced-motion) {
|
|
654
|
-
.
|
|
655
|
-
animation-name: _fade-
|
|
654
|
+
._menu_19sse_8[data-state="open"] {
|
|
655
|
+
animation-name: _fade-in_19sse_1;
|
|
656
656
|
}
|
|
657
657
|
|
|
658
|
-
.
|
|
659
|
-
animation-name: _fade-
|
|
658
|
+
._menu_19sse_8[data-state="closed"] {
|
|
659
|
+
animation-name: _fade-out_19sse_1;
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
662
|
|
|
663
|
-
.
|
|
663
|
+
._title_19sse_74 {
|
|
664
|
+
/** Override MenuTitle margin top **/
|
|
665
|
+
margin-block-start: 0 !important;
|
|
666
|
+
}
|
|
667
|
+
/*
|
|
668
|
+
* Copyright 2025 New Vector Ltd
|
|
669
|
+
*
|
|
670
|
+
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
671
|
+
* Please see LICENSE files in the repository root for full details.
|
|
672
|
+
*/
|
|
673
|
+
|
|
674
|
+
._menu-title_1sgvx_8 {
|
|
664
675
|
color: var(--cpd-color-text-secondary);
|
|
665
676
|
padding-inline: var(--cpd-space-4x);
|
|
666
677
|
padding-block-end: calc(var(--cpd-space-2x) - var(--cpd-border-width-1));
|
|
667
678
|
border-block-end: var(--cpd-border-width-1) solid var(--cpd-color-gray-400);
|
|
668
|
-
margin-block:
|
|
679
|
+
margin-block: var(--cpd-space-2x);
|
|
669
680
|
}
|
|
670
681
|
/*
|
|
671
682
|
Copyright 2023 New Vector Ltd.
|
|
@@ -2582,3 +2593,36 @@ Please see LICENSE files in the repository root for full details.
|
|
|
2582
2593
|
._visual-list-item-icon-destructive_1ma3e_26 {
|
|
2583
2594
|
color: var(--cpd-color-icon-critical-primary);
|
|
2584
2595
|
}
|
|
2596
|
+
/*
|
|
2597
|
+
* Copyright 2025 New Vector Ltd
|
|
2598
|
+
*
|
|
2599
|
+
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
2600
|
+
* Please see LICENSE files in the repository root for full details.
|
|
2601
|
+
*/
|
|
2602
|
+
|
|
2603
|
+
._chat-filter_5qdp0_8 {
|
|
2604
|
+
font: var(--cpd-font-body-sm-medium);
|
|
2605
|
+
color: var(--cpd-color-text-primary);
|
|
2606
|
+
background-color: transparent;
|
|
2607
|
+
border: var(--cpd-border-width-1) solid
|
|
2608
|
+
var(--cpd-color-border-interactive-secondary);
|
|
2609
|
+
border-radius: 99px;
|
|
2610
|
+
cursor: pointer;
|
|
2611
|
+
display: flex;
|
|
2612
|
+
align-items: center;
|
|
2613
|
+
justify-content: center;
|
|
2614
|
+
padding: var(--cpd-space-1x) var(--cpd-space-2x);
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
@media (hover) {
|
|
2618
|
+
._chat-filter_5qdp0_8:hover {
|
|
2619
|
+
border-color: var(--cpd-color-border-interactive-primary);
|
|
2620
|
+
background: var(--cpd-color-bg-subtle-primary);
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
._chat-filter_5qdp0_8[aria-selected="true"] {
|
|
2625
|
+
border-color: var(--cpd-color-bg-action-primary-rest);
|
|
2626
|
+
background: var(--cpd-color-bg-action-primary-rest);
|
|
2627
|
+
color: var(--cpd-color-text-on-solid-primary);
|
|
2628
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
.chat-filter {
|
|
9
|
+
font: var(--cpd-font-body-sm-medium);
|
|
10
|
+
color: var(--cpd-color-text-primary);
|
|
11
|
+
background-color: transparent;
|
|
12
|
+
border: var(--cpd-border-width-1) solid
|
|
13
|
+
var(--cpd-color-border-interactive-secondary);
|
|
14
|
+
border-radius: 99px;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
padding: var(--cpd-space-1x) var(--cpd-space-2x);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media (hover) {
|
|
23
|
+
.chat-filter:hover {
|
|
24
|
+
border-color: var(--cpd-color-border-interactive-primary);
|
|
25
|
+
background: var(--cpd-color-bg-subtle-primary);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.chat-filter[aria-selected="true"] {
|
|
30
|
+
border-color: var(--cpd-color-bg-action-primary-rest);
|
|
31
|
+
background: var(--cpd-color-bg-action-primary-rest);
|
|
32
|
+
color: var(--cpd-color-text-on-solid-primary);
|
|
33
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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, { ForwardedRef, forwardRef } from "react";
|
|
9
|
+
import {
|
|
10
|
+
UnstyledButton,
|
|
11
|
+
UnstyledButtonPropsFor,
|
|
12
|
+
} from "../Button/UnstyledButton";
|
|
13
|
+
import styles from "./ChatFilter.module.css";
|
|
14
|
+
|
|
15
|
+
type ChatFilterProps = Omit<UnstyledButtonPropsFor<"button">, "disabled"> & {
|
|
16
|
+
/**
|
|
17
|
+
* Whether the filter is selected.
|
|
18
|
+
*/
|
|
19
|
+
selected?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A chat filter button.
|
|
24
|
+
*/
|
|
25
|
+
export const ChatFilter = forwardRef(function ChatFilter(
|
|
26
|
+
{ children, selected, ...props }: ChatFilterProps,
|
|
27
|
+
ref: ForwardedRef<HTMLButtonElement>,
|
|
28
|
+
): React.ReactElement {
|
|
29
|
+
return (
|
|
30
|
+
<UnstyledButton
|
|
31
|
+
{...props}
|
|
32
|
+
className={styles["chat-filter"]}
|
|
33
|
+
aria-selected={selected}
|
|
34
|
+
as="button"
|
|
35
|
+
ref={ref}
|
|
36
|
+
tabIndex={0}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</UnstyledButton>
|
|
40
|
+
);
|
|
41
|
+
});
|
|
@@ -72,9 +72,6 @@ Please see LICENSE files in the repository root for full details.
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.title {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
padding-block-end: calc(var(--cpd-space-2x) - var(--cpd-border-width-1));
|
|
78
|
-
border-block-end: var(--cpd-border-width-1) solid var(--cpd-color-gray-400);
|
|
79
|
-
margin-block: 0 var(--cpd-space-2x);
|
|
75
|
+
/** Override MenuTitle margin top **/
|
|
76
|
+
margin-block-start: 0 !important;
|
|
80
77
|
}
|
|
@@ -13,18 +13,7 @@ import React, {
|
|
|
13
13
|
useId,
|
|
14
14
|
} from "react";
|
|
15
15
|
import styles from "./FloatingMenu.module.css";
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
interface TitleProps {
|
|
19
|
-
title: string;
|
|
20
|
-
id: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const MenuTitle: React.FC<TitleProps> = ({ title, id }) => (
|
|
24
|
-
<Text as="h3" id={id} className={styles.title} size="sm" weight="semibold">
|
|
25
|
-
{title}
|
|
26
|
-
</Text>
|
|
27
|
-
);
|
|
16
|
+
import { MenuTitle } from "./MenuTitle.tsx";
|
|
28
17
|
|
|
29
18
|
interface Props extends ComponentPropsWithoutRef<"div"> {
|
|
30
19
|
/**
|
|
@@ -62,7 +51,9 @@ export const FloatingMenu = forwardRef<HTMLDivElement, Props>(
|
|
|
62
51
|
className={classnames(className, styles.menu)}
|
|
63
52
|
{...props}
|
|
64
53
|
>
|
|
65
|
-
{showTitle &&
|
|
54
|
+
{showTitle && (
|
|
55
|
+
<MenuTitle className={styles.title} title={title} id={titleId} />
|
|
56
|
+
)}
|
|
66
57
|
{children}
|
|
67
58
|
</div>
|
|
68
59
|
);
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
.menu-title {
|
|
9
|
+
color: var(--cpd-color-text-secondary);
|
|
10
|
+
padding-inline: var(--cpd-space-4x);
|
|
11
|
+
padding-block-end: calc(var(--cpd-space-2x) - var(--cpd-border-width-1));
|
|
12
|
+
border-block-end: var(--cpd-border-width-1) solid var(--cpd-color-gray-400);
|
|
13
|
+
margin-block: var(--cpd-space-2x);
|
|
14
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 from "react";
|
|
9
|
+
import { Text } from "../Typography/Text.tsx";
|
|
10
|
+
import styles from "./MenuTitle.module.css";
|
|
11
|
+
import classnames from "classnames";
|
|
12
|
+
|
|
13
|
+
interface MenuTitleProps {
|
|
14
|
+
/**
|
|
15
|
+
* The title of the menu.
|
|
16
|
+
*/
|
|
17
|
+
title: string;
|
|
18
|
+
/**
|
|
19
|
+
* The id of the menu title.
|
|
20
|
+
*/
|
|
21
|
+
id?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The CSS class.
|
|
24
|
+
*/
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const MenuTitle: React.FC<MenuTitleProps> = ({
|
|
29
|
+
title,
|
|
30
|
+
id,
|
|
31
|
+
className,
|
|
32
|
+
}) => {
|
|
33
|
+
const classes = classnames(styles["menu-title"], className);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Text as="h3" id={id} className={classes} size="sm" weight="semibold">
|
|
37
|
+
{title}
|
|
38
|
+
</Text>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
@@ -178,7 +178,12 @@ const TooltipAnchor: FC<TooltipAnchorProps> = ({
|
|
|
178
178
|
if (!isValidElement(children)) return;
|
|
179
179
|
|
|
180
180
|
if (isTriggerInteractive) {
|
|
181
|
-
const props = context.getReferenceProps({
|
|
181
|
+
const props = context.getReferenceProps({
|
|
182
|
+
// To support React 18, we need to explicitly pass the children's props. See https://github.com/element-hq/compound/issues/333
|
|
183
|
+
// In React 19, this is not necessary. `getReferenceProps` is able to get the props directly from the ref.
|
|
184
|
+
...(typeof children.props === "object" ? children.props : {}),
|
|
185
|
+
ref,
|
|
186
|
+
});
|
|
182
187
|
return cloneElement(children, props);
|
|
183
188
|
} else {
|
|
184
189
|
// For a non-interactive trigger, we want most of the props to go on the
|
package/src/index.ts
CHANGED
|
@@ -46,6 +46,7 @@ export { Dropdown } from "./components/Dropdown";
|
|
|
46
46
|
export { InlineSpinner } from "./components/InlineSpinner";
|
|
47
47
|
export { Breadcrumb } from "./components/Breadcrumb";
|
|
48
48
|
export { VisualList, VisualListItem } from "./components/VisualList";
|
|
49
|
+
export { ChatFilter } from "./components/ChatFilter";
|
|
49
50
|
|
|
50
51
|
export {
|
|
51
52
|
TextControl,
|