@vector-im/compound-web 8.3.1 → 8.3.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.
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const button = "_button_187yx_8";
4
- const destructive = "_destructive_187yx_107";
3
+ const button = "_button_13vu4_8";
4
+ const destructive = "_destructive_13vu4_110";
5
5
  const styles = {
6
6
  button,
7
- "icon-only": "_icon-only_187yx_50",
8
- "has-icon": "_has-icon_187yx_57",
7
+ "icon-only": "_icon-only_13vu4_53",
8
+ "has-icon": "_has-icon_13vu4_60",
9
9
  destructive
10
10
  };
11
11
  exports.button = button;
@@ -1,9 +1,9 @@
1
- const button = "_button_187yx_8";
2
- const destructive = "_destructive_187yx_107";
1
+ const button = "_button_13vu4_8";
2
+ const destructive = "_destructive_13vu4_110";
3
3
  const styles = {
4
4
  button,
5
- "icon-only": "_icon-only_187yx_50",
6
- "has-icon": "_has-icon_187yx_57",
5
+ "icon-only": "_icon-only_13vu4_53",
6
+ "has-icon": "_has-icon_13vu4_60",
7
7
  destructive
8
8
  };
9
9
  export {
@@ -2,15 +2,16 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
+ const classNames = require("classnames");
5
6
  const InlineSpinner_module = require("./InlineSpinner.module.css.cjs");
6
7
  const SpinnerIcon = require("@vector-im/compound-design-tokens/assets/web/icons/spinner");
7
8
  const InlineSpinner = React.forwardRef(
8
- function InlineSpinner2({ size = 20, ...props }, ref) {
9
+ function InlineSpinner2({ size = 20, className, ...props }, ref) {
9
10
  return /* @__PURE__ */ jsxRuntime.jsx(
10
11
  SpinnerIcon,
11
12
  {
12
13
  ref,
13
- className: InlineSpinner_module.default.icon,
14
+ className: classNames(InlineSpinner_module.default.icon, className),
14
15
  style: { width: size, height: size },
15
16
  ...props
16
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InlineSpinner.cjs","sources":["../../../src/components/InlineSpinner/InlineSpinner.tsx"],"sourcesContent":["/*\nCopyright 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 React, { type SVGAttributes, forwardRef } from \"react\";\nimport styles from \"./InlineSpinner.module.css\";\nimport SpinnerIcon from \"@vector-im/compound-design-tokens/assets/web/icons/spinner\";\n\ntype InlineSpinnerProps = {\n size?: number;\n} & SVGAttributes<SVGElement>;\n\nexport const InlineSpinner = forwardRef<SVGSVGElement, InlineSpinnerProps>(\n function InlineSpinner({ size = 20, ...props }, ref) {\n return (\n <SpinnerIcon\n ref={ref}\n className={styles.icon}\n style={{ width: size, height: size }}\n {...props}\n />\n );\n },\n);\n"],"names":["forwardRef","InlineSpinner","jsx","styles"],"mappings":";;;;;;AAeO,MAAM,gBAAgBA,MAAAA;AAAAA,EAC3B,SAASC,eAAc,EAAE,OAAO,IAAI,GAAG,MAAA,GAAS,KAAK;AACnD,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAWC,qBAAAA,QAAO;AAAA,QAClB,OAAO,EAAE,OAAO,MAAM,QAAQ,KAAA;AAAA,QAC7B,GAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;;"}
1
+ {"version":3,"file":"InlineSpinner.cjs","sources":["../../../src/components/InlineSpinner/InlineSpinner.tsx"],"sourcesContent":["/*\nCopyright 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 React, { type SVGAttributes, forwardRef } from \"react\";\nimport classNames from \"classnames\";\nimport styles from \"./InlineSpinner.module.css\";\nimport SpinnerIcon from \"@vector-im/compound-design-tokens/assets/web/icons/spinner\";\n\ntype InlineSpinnerProps = {\n size?: number;\n} & SVGAttributes<SVGElement>;\n\nexport const InlineSpinner = forwardRef<SVGSVGElement, InlineSpinnerProps>(\n function InlineSpinner({ size = 20, className, ...props }, ref) {\n return (\n <SpinnerIcon\n ref={ref}\n className={classNames(styles.icon, className)}\n style={{ width: size, height: size }}\n {...props}\n />\n );\n },\n);\n"],"names":["forwardRef","InlineSpinner","jsx","styles"],"mappings":";;;;;;;AAgBO,MAAM,gBAAgBA,MAAAA;AAAAA,EAC3B,SAASC,eAAc,EAAE,OAAO,IAAI,WAAW,GAAG,MAAA,GAAS,KAAK;AAC9D,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,WAAWC,6BAAO,MAAM,SAAS;AAAA,QAC5C,OAAO,EAAE,OAAO,MAAM,QAAQ,KAAA;AAAA,QAC7B,GAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineSpinner.d.ts","sourceRoot":"","sources":["../../../src/components/InlineSpinner/InlineSpinner.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAQ9D,eAAO,MAAM,aAAa;WAHjB,MAAM;yEAcd,CAAC"}
1
+ {"version":3,"file":"InlineSpinner.d.ts","sourceRoot":"","sources":["../../../src/components/InlineSpinner/InlineSpinner.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAS9D,eAAO,MAAM,aAAa;WAHjB,MAAM;yEAcd,CAAC"}
@@ -1,14 +1,15 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
+ import classNames from "classnames";
3
4
  import styles from "./InlineSpinner.module.css.js";
4
5
  import SpinnerIcon from "@vector-im/compound-design-tokens/assets/web/icons/spinner";
5
6
  const InlineSpinner = forwardRef(
6
- function InlineSpinner2({ size = 20, ...props }, ref) {
7
+ function InlineSpinner2({ size = 20, className, ...props }, ref) {
7
8
  return /* @__PURE__ */ jsx(
8
9
  SpinnerIcon,
9
10
  {
10
11
  ref,
11
- className: styles.icon,
12
+ className: classNames(styles.icon, className),
12
13
  style: { width: size, height: size },
13
14
  ...props
14
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InlineSpinner.js","sources":["../../../src/components/InlineSpinner/InlineSpinner.tsx"],"sourcesContent":["/*\nCopyright 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 React, { type SVGAttributes, forwardRef } from \"react\";\nimport styles from \"./InlineSpinner.module.css\";\nimport SpinnerIcon from \"@vector-im/compound-design-tokens/assets/web/icons/spinner\";\n\ntype InlineSpinnerProps = {\n size?: number;\n} & SVGAttributes<SVGElement>;\n\nexport const InlineSpinner = forwardRef<SVGSVGElement, InlineSpinnerProps>(\n function InlineSpinner({ size = 20, ...props }, ref) {\n return (\n <SpinnerIcon\n ref={ref}\n className={styles.icon}\n style={{ width: size, height: size }}\n {...props}\n />\n );\n },\n);\n"],"names":["InlineSpinner"],"mappings":";;;;AAeO,MAAM,gBAAgB;AAAA,EAC3B,SAASA,eAAc,EAAE,OAAO,IAAI,GAAG,MAAA,GAAS,KAAK;AACnD,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,OAAO;AAAA,QAClB,OAAO,EAAE,OAAO,MAAM,QAAQ,KAAA;AAAA,QAC7B,GAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
1
+ {"version":3,"file":"InlineSpinner.js","sources":["../../../src/components/InlineSpinner/InlineSpinner.tsx"],"sourcesContent":["/*\nCopyright 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 React, { type SVGAttributes, forwardRef } from \"react\";\nimport classNames from \"classnames\";\nimport styles from \"./InlineSpinner.module.css\";\nimport SpinnerIcon from \"@vector-im/compound-design-tokens/assets/web/icons/spinner\";\n\ntype InlineSpinnerProps = {\n size?: number;\n} & SVGAttributes<SVGElement>;\n\nexport const InlineSpinner = forwardRef<SVGSVGElement, InlineSpinnerProps>(\n function InlineSpinner({ size = 20, className, ...props }, ref) {\n return (\n <SpinnerIcon\n ref={ref}\n className={classNames(styles.icon, className)}\n style={{ width: size, height: size }}\n {...props}\n />\n );\n },\n);\n"],"names":["InlineSpinner"],"mappings":";;;;;AAgBO,MAAM,gBAAgB;AAAA,EAC3B,SAASA,eAAc,EAAE,OAAO,IAAI,WAAW,GAAG,MAAA,GAAS,KAAK;AAC9D,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,WAAW,OAAO,MAAM,SAAS;AAAA,QAC5C,OAAO,EAAE,OAAO,MAAM,QAAQ,KAAA;AAAA,QAC7B,GAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const item = "_item_dyt4i_8";
4
- const interactive = "_interactive_dyt4i_26";
5
- const label = "_label_dyt4i_34";
6
- const icon = "_icon_dyt4i_50";
7
- const disabled = "_disabled_dyt4i_118";
3
+ const item = "_item_lqfwq_8";
4
+ const interactive = "_interactive_lqfwq_26";
5
+ const label = "_label_lqfwq_34";
6
+ const icon = "_icon_lqfwq_50";
7
+ const disabled = "_disabled_lqfwq_118";
8
8
  const styles = {
9
9
  item,
10
10
  interactive,
11
- "no-label": "_no-label_dyt4i_30",
11
+ "no-label": "_no-label_lqfwq_30",
12
12
  label,
13
- "no-icon": "_no-icon_dyt4i_41",
13
+ "no-icon": "_no-icon_lqfwq_41",
14
14
  icon,
15
- "nav-hint": "_nav-hint_dyt4i_59",
15
+ "nav-hint": "_nav-hint_lqfwq_59",
16
16
  disabled
17
17
  };
18
18
  exports.default = styles;
@@ -1,16 +1,16 @@
1
- const item = "_item_dyt4i_8";
2
- const interactive = "_interactive_dyt4i_26";
3
- const label = "_label_dyt4i_34";
4
- const icon = "_icon_dyt4i_50";
5
- const disabled = "_disabled_dyt4i_118";
1
+ const item = "_item_lqfwq_8";
2
+ const interactive = "_interactive_lqfwq_26";
3
+ const label = "_label_lqfwq_34";
4
+ const icon = "_icon_lqfwq_50";
5
+ const disabled = "_disabled_lqfwq_118";
6
6
  const styles = {
7
7
  item,
8
8
  interactive,
9
- "no-label": "_no-label_dyt4i_30",
9
+ "no-label": "_no-label_lqfwq_30",
10
10
  label,
11
- "no-icon": "_no-icon_dyt4i_41",
11
+ "no-icon": "_no-icon_lqfwq_41",
12
12
  icon,
13
- "nav-hint": "_nav-hint_dyt4i_59",
13
+ "nav-hint": "_nav-hint_lqfwq_59",
14
14
  disabled
15
15
  };
16
16
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"ReleaseAnnouncement.cjs","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 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 React, {\n cloneElement,\n isValidElement,\n type JSX,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\nimport {\n FloatingPortal,\n FloatingFocusManager,\n type Placement,\n useMergeRefs,\n FloatingArrow,\n} from \"@floating-ui/react\";\nimport { Text } from \"../Typography/Text\";\nimport { Button } from \"../Button\";\nimport styles from \"./ReleaseAnnouncement.module.css\";\nimport {\n useReleaseAnnouncementContext,\n ReleaseAnnouncementContext,\n} from \"./ReleaseAnnouncementContext\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype UseReleaseAnnouncementParam = Parameters<typeof useReleaseAnnouncement>[0];\n\ninterface ReleaseAnnouncementProps\n extends Omit<UseReleaseAnnouncementParam, \"placement\" | \"displayArrow\"> {\n /**\n * The placement of the component\n * @default \"right\"\n */\n placement?: Placement;\n /**\n * Whether to display an arrow.\n * @default true\n */\n displayArrow?: boolean;\n}\n\n/**\n * The ReleaseAnnouncement component purpose is to inform the user of a new available feature.\n * This component is a floating component that will appear next to an anchor.\n * @param children - Act as an anchor, the component will be displayed alongside of it.\n * @param placement - The placement of the component\n */\nexport function ReleaseAnnouncement({\n /**\n * The children anchor should be a single valid React element.\n */\n children,\n placement = \"right\",\n displayArrow = true,\n ...props\n}: PropsWithChildren<ReleaseAnnouncementProps>): JSX.Element {\n const context = useReleaseAnnouncement({ placement, displayArrow, ...props });\n\n return (\n <ReleaseAnnouncementContext.Provider value={context}>\n <ReleaseAnnouncementAnchor>{children}</ReleaseAnnouncementAnchor>\n <ReleaseAnnouncementContainer>\n <ReleaseAnnouncementContent />\n </ReleaseAnnouncementContainer>\n </ReleaseAnnouncementContext.Provider>\n );\n}\n\n/**\n * The anchor for the ReleaseAnnouncement components.\n * The Release Announcement will appear next to this element.\n * @param children - should be a single valid React element\n * @constructor\n */\nfunction ReleaseAnnouncementAnchor({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element {\n const context = useReleaseAnnouncementContext();\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 if (!isValidElement(children)) {\n throw new Error(\n \"ReleaseAnnouncement anchor must be a single valid React element\",\n );\n }\n\n const referenceProps = context.getReferenceProps({\n ref,\n // If the ReleaseAnnouncement is open, we need manually aria-describedby.\n // The RA has the dialog role and it's not adding automatically the aria-describedby.\n ...(context.open && {\n \"aria-describedby\": context.getFloatingProps().id as string,\n }),\n });\n\n // getReferenceProps includes aria-expanded (being true when the popup is shown)\n // but axe only allows this on certain elements and we use release anncounements on\n // all sorts of elements. Semantically, I don't think it makes sense because the point\n // of aria-expanded is a hint to the user that there is something that can be expanded.\n // The user can't cause a release announcement to be shown, it just appears when it thinks\n // it's time, so I think adding it here is misleading.\n delete referenceProps[\"aria-expanded\"];\n\n return cloneElement(children, referenceProps);\n}\n\n/**\n * The container for the ReleaseAnnouncement components.\n * Manage focus and positioning of the children.\n * @param children\n */\nfunction ReleaseAnnouncementContainer({\n children,\n}: PropsWithChildren): JSX.Element | null {\n const {\n context: floatingContext,\n arrowRef,\n displayArrow,\n ...rest\n } = useReleaseAnnouncementContext();\n\n if (!floatingContext.open) return null;\n\n return (\n <FloatingPortal>\n <FloatingFocusManager context={floatingContext} modal={false}>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n aria-labelledby={rest.labelId}\n aria-describedby={rest.descriptionId}\n {...rest.getFloatingProps()}\n className={styles.content}\n >\n {displayArrow && (\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={20}\n height={12}\n className={styles.arrow}\n />\n )}\n {children}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n );\n}\n\n/**\n * The content of the ReleaseAnnouncement component.\n * ---------------------------------------------------------------\n * - The header in a bold text ------------- -\n * - A description in a regular text | Close button | -\n * - Description can be on multiple lines ------------- -\n * ---------------------------------------------------------------\n */\nfunction ReleaseAnnouncementContent(): JSX.Element {\n const { labelId, descriptionId, header, description, closeLabel, onClick } =\n useReleaseAnnouncementContext();\n\n return (\n <>\n <Text\n as=\"h3\"\n id={labelId}\n className={styles.header}\n size=\"lg\"\n weight=\"semibold\"\n >\n {header}\n </Text>\n <Text\n as=\"span\"\n id={descriptionId}\n className={styles.description}\n size=\"sm\"\n weight=\"regular\"\n >\n {description}\n </Text>\n <Button\n size=\"sm\"\n kind=\"secondary\"\n className={styles.button}\n onClick={onClick}\n >\n {closeLabel}\n </Button>\n </>\n );\n}\n"],"names":["useReleaseAnnouncement","jsxs","ReleaseAnnouncementContext","jsx","useReleaseAnnouncementContext","useMergeRefs","isValidElement","cloneElement","FloatingPortal","FloatingFoc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F;AAEJ;;"}
1
+ {"version":3,"file":"ReleaseAnnouncement.cjs","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 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 React, {\n cloneElement,\n isValidElement,\n type JSX,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\nimport {\n FloatingPortal,\n FloatingFocusManager,\n type Placement,\n useMergeRefs,\n FloatingArrow,\n} from \"@floating-ui/react\";\nimport { Text } from \"../Typography/Text\";\nimport { Button } from \"../Button\";\nimport styles from \"./ReleaseAnnouncement.module.css\";\nimport {\n useReleaseAnnouncementContext,\n ReleaseAnnouncementContext,\n} from \"./ReleaseAnnouncementContext\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype UseReleaseAnnouncementParam = Parameters<typeof useReleaseAnnouncement>[0];\n\ninterface ReleaseAnnouncementProps extends Omit<\n UseReleaseAnnouncementParam,\n \"placement\" | \"displayArrow\"\n> {\n /**\n * The placement of the component\n * @default \"right\"\n */\n placement?: Placement;\n /**\n * Whether to display an arrow.\n * @default true\n */\n displayArrow?: boolean;\n}\n\n/**\n * The ReleaseAnnouncement component purpose is to inform the user of a new available feature.\n * This component is a floating component that will appear next to an anchor.\n * @param children - Act as an anchor, the component will be displayed alongside of it.\n * @param placement - The placement of the component\n */\nexport function ReleaseAnnouncement({\n /**\n * The children anchor should be a single valid React element.\n */\n children,\n placement = \"right\",\n displayArrow = true,\n ...props\n}: PropsWithChildren<ReleaseAnnouncementProps>): JSX.Element {\n const context = useReleaseAnnouncement({ placement, displayArrow, ...props });\n\n return (\n <ReleaseAnnouncementContext.Provider value={context}>\n <ReleaseAnnouncementAnchor>{children}</ReleaseAnnouncementAnchor>\n <ReleaseAnnouncementContainer>\n <ReleaseAnnouncementContent />\n </ReleaseAnnouncementContainer>\n </ReleaseAnnouncementContext.Provider>\n );\n}\n\n/**\n * The anchor for the ReleaseAnnouncement components.\n * The Release Announcement will appear next to this element.\n * @param children - should be a single valid React element\n * @constructor\n */\nfunction ReleaseAnnouncementAnchor({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element {\n const context = useReleaseAnnouncementContext();\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 if (!isValidElement(children)) {\n throw new Error(\n \"ReleaseAnnouncement anchor must be a single valid React element\",\n );\n }\n\n const referenceProps = context.getReferenceProps({\n ref,\n // If the ReleaseAnnouncement is open, we need manually aria-describedby.\n // The RA has the dialog role and it's not adding automatically the aria-describedby.\n ...(context.open && {\n \"aria-describedby\": context.getFloatingProps().id as string,\n }),\n });\n\n // getReferenceProps includes aria-expanded (being true when the popup is shown)\n // but axe only allows this on certain elements and we use release anncounements on\n // all sorts of elements. Semantically, I don't think it makes sense because the point\n // of aria-expanded is a hint to the user that there is something that can be expanded.\n // The user can't cause a release announcement to be shown, it just appears when it thinks\n // it's time, so I think adding it here is misleading.\n delete referenceProps[\"aria-expanded\"];\n\n return cloneElement(children, referenceProps);\n}\n\n/**\n * The container for the ReleaseAnnouncement components.\n * Manage focus and positioning of the children.\n * @param children\n */\nfunction ReleaseAnnouncementContainer({\n children,\n}: PropsWithChildren): JSX.Element | null {\n const {\n context: floatingContext,\n arrowRef,\n displayArrow,\n ...rest\n } = useReleaseAnnouncementContext();\n\n if (!floatingContext.open) return null;\n\n return (\n <FloatingPortal>\n <FloatingFocusManager context={floatingContext} modal={false}>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n aria-labelledby={rest.labelId}\n aria-describedby={rest.descriptionId}\n {...rest.getFloatingProps()}\n className={styles.content}\n >\n {displayArrow && (\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={20}\n height={12}\n className={styles.arrow}\n />\n )}\n {children}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n );\n}\n\n/**\n * The content of the ReleaseAnnouncement component.\n * ---------------------------------------------------------------\n * - The header in a bold text ------------- -\n * - A description in a regular text | Close button | -\n * - Description can be on multiple lines ------------- -\n * ---------------------------------------------------------------\n */\nfunction ReleaseAnnouncementContent(): JSX.Element {\n const { labelId, descriptionId, header, description, closeLabel, onClick } =\n useReleaseAnnouncementContext();\n\n return (\n <>\n <Text\n as=\"h3\"\n id={labelId}\n className={styles.header}\n size=\"lg\"\n weight=\"semibold\"\n >\n {header}\n </Text>\n <Text\n as=\"span\"\n id={descriptionId}\n className={styles.description}\n size=\"sm\"\n weight=\"regular\"\n >\n {description}\n </Text>\n <Button\n size=\"sm\"\n kind=\"secondary\"\n className={styles.button}\n onClick={onClick}\n >\n {closeLabel}\n </Button>\n </>\n );\n}\n"],"names":["useReleaseAnnouncement","jsxs","ReleaseAnnouncementContext","jsx","useReleaseAnnouncementContext","useMergeRefs","isValidElement","cloneElement","FloatingPortal","FloatingFocusManager","styles","FloatingArrow","Fragment","Text","Button"],"mappings":";;;;;;;;;;AAsDO,SAAS,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,GAAG;AACL,GAA6D;AAC3D,QAAM,UAAUA,uBAAAA,uBAAuB,EAAE,WAAW,cAAc,GAAG,OAAO;AAE5E,SACEC,2BAAAA,KAACC,2BAAAA,2BAA2B,UAA3B,EAAoC,OAAO,SAC1C,UAAA;AAAA,IAAAC,+BAAC,6BAA2B,UAAS;AAAA,IACrCA,2BAAAA,IAAC,8BAAA,EACC,UAAAA,2BAAAA,IAAC,4BAAA,CAAA,CAA2B,EAAA,CAC9B;AAAA,EAAA,GACF;AAEJ;AAQA,SAAS,0BAA0B;AAAA,EACjC;AACF,GAA6C;AAC3C,QAAM,UAAUC,2BAAAA,8BAAA;AAIhB,QAAM,cAAe,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a,YAAY,QAAA,IAC/DN,yDAAA;AAEF,SACEH,2BAAAA,KAAAW,qBAAA,EACE,UAAA;AAAA,IAAAT,2BAAAA;AAAAA,MAACU,KAAAA;AAAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,IAAI;AAAA,QACJ,WAAWH,2BAAAA,QAAO;AAAA,QAClB,MAAK;AAAA,QACL,QAAO;AAAA,QAEN,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEHP,2BAAAA;AAAAA,MAACU,KAAAA;AAAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,IAAI;AAAA,QACJ,WAAWH,2BAAAA,QAAO;AAAA,QAClB,MAAK;AAAA,QACL,QAAO;AAAA,QAEN,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEHP,2BAAAA;AAAAA,MAACW,OAAAA;AAAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,WAAWJ,2BAAAA,QAAO;AAAA,QAClB;AAAA,QAEC,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReleaseAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"names":[],"mappings":"AAOA,OAAc,EAGZ,KAAK,GAAG,EACR,KAAK,iBAAiB,EAEvB,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,SAAS,EAGf,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,KAAK,2BAA2B,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhF,UAAU,wBACR,SAAQ,IAAI,CAAC,2BAA2B,EAAE,WAAW,GAAG,cAAc,CAAC;IACvE;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC;AAClC;;GAEG;AACH,QAAQ,EACR,SAAmB,EACnB,YAAmB,EACnB,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,wBAAwB,CAAC,GAAG,GAAG,CAAC,OAAO,CAW3D"}
1
+ {"version":3,"file":"ReleaseAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"names":[],"mappings":"AAOA,OAAc,EAGZ,KAAK,GAAG,EACR,KAAK,iBAAiB,EAEvB,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,SAAS,EAGf,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,KAAK,2BAA2B,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhF,UAAU,wBAAyB,SAAQ,IAAI,CAC7C,2BAA2B,EAC3B,WAAW,GAAG,cAAc,CAC7B;IACC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC;AAClC;;GAEG;AACH,QAAQ,EACR,SAAmB,EACnB,YAAmB,EACnB,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,wBAAwB,CAAC,GAAG,GAAG,CAAC,OAAO,CAW3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReleaseAnnouncement.js","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 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 React, {\n cloneElement,\n isValidElement,\n type JSX,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\nimport {\n FloatingPortal,\n FloatingFocusManager,\n type Placement,\n useMergeRefs,\n FloatingArrow,\n} from \"@floating-ui/react\";\nimport { Text } from \"../Typography/Text\";\nimport { Button } from \"../Button\";\nimport styles from \"./ReleaseAnnouncement.module.css\";\nimport {\n useReleaseAnnouncementContext,\n ReleaseAnnouncementContext,\n} from \"./ReleaseAnnouncementContext\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype UseReleaseAnnouncementParam = Parameters<typeof useReleaseAnnouncement>[0];\n\ninterface ReleaseAnnouncementProps\n extends Omit<UseReleaseAnnouncementParam, \"placement\" | \"displayArrow\"> {\n /**\n * The placement of the component\n * @default \"right\"\n */\n placement?: Placement;\n /**\n * Whether to display an arrow.\n * @default true\n */\n displayArrow?: boolean;\n}\n\n/**\n * The ReleaseAnnouncement component purpose is to inform the user of a new available feature.\n * This component is a floating component that will appear next to an anchor.\n * @param children - Act as an anchor, the component will be displayed alongside of it.\n * @param placement - The placement of the component\n */\nexport function ReleaseAnnouncement({\n /**\n * The children anchor should be a single valid React element.\n */\n children,\n placement = \"right\",\n displayArrow = true,\n ...props\n}: PropsWithChildren<ReleaseAnnouncementProps>): JSX.Element {\n const context = useReleaseAnnouncement({ placement, displayArrow, ...props });\n\n return (\n <ReleaseAnnouncementContext.Provider value={context}>\n <ReleaseAnnouncementAnchor>{children}</ReleaseAnnouncementAnchor>\n <ReleaseAnnouncementContainer>\n <ReleaseAnnouncementContent />\n </ReleaseAnnouncementContainer>\n </ReleaseAnnouncementContext.Provider>\n );\n}\n\n/**\n * The anchor for the ReleaseAnnouncement components.\n * The Release Announcement will appear next to this element.\n * @param children - should be a single valid React element\n * @constructor\n */\nfunction ReleaseAnnouncementAnchor({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element {\n const context = useReleaseAnnouncementContext();\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 if (!isValidElement(children)) {\n throw new Error(\n \"ReleaseAnnouncement anchor must be a single valid React element\",\n );\n }\n\n const referenceProps = context.getReferenceProps({\n ref,\n // If the ReleaseAnnouncement is open, we need manually aria-describedby.\n // The RA has the dialog role and it's not adding automatically the aria-describedby.\n ...(context.open && {\n \"aria-describedby\": context.getFloatingProps().id as string,\n }),\n });\n\n // getReferenceProps includes aria-expanded (being true when the popup is shown)\n // but axe only allows this on certain elements and we use release anncounements on\n // all sorts of elements. Semantically, I don't think it makes sense because the point\n // of aria-expanded is a hint to the user that there is something that can be expanded.\n // The user can't cause a release announcement to be shown, it just appears when it thinks\n // it's time, so I think adding it here is misleading.\n delete referenceProps[\"aria-expanded\"];\n\n return cloneElement(children, referenceProps);\n}\n\n/**\n * The container for the ReleaseAnnouncement components.\n * Manage focus and positioning of the children.\n * @param children\n */\nfunction ReleaseAnnouncementContainer({\n children,\n}: PropsWithChildren): JSX.Element | null {\n const {\n context: floatingContext,\n arrowRef,\n displayArrow,\n ...rest\n } = useReleaseAnnouncementContext();\n\n if (!floatingContext.open) return null;\n\n return (\n <FloatingPortal>\n <FloatingFocusManager context={floatingContext} modal={false}>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n aria-labelledby={rest.labelId}\n aria-describedby={rest.descriptionId}\n {...rest.getFloatingProps()}\n className={styles.content}\n >\n {displayArrow && (\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={20}\n height={12}\n className={styles.arrow}\n />\n )}\n {children}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n );\n}\n\n/**\n * The content of the ReleaseAnnouncement component.\n * ---------------------------------------------------------------\n * - The header in a bold text ------------- -\n * - A description in a regular text | Close button | -\n * - Description can be on multiple lines ------------- -\n * ---------------------------------------------------------------\n */\nfunction ReleaseAnnouncementContent(): JSX.Element {\n const { labelId, descriptionId, header, description, closeLabel, onClick } =\n useReleaseAnnouncementContext();\n\n return (\n <>\n <Text\n as=\"h3\"\n id={labelId}\n className={styles.header}\n size=\"lg\"\n weight=\"semibold\"\n >\n {header}\n </Text>\n <Text\n as=\"span\"\n id={descriptionId}\n className={styles.description}\n size=\"sm\"\n weight=\"regular\"\n >\n {description}\n </Text>\n <Button\n size=\"sm\"\n kind=\"secondary\"\n className={styles.button}\n onClick={onClick}\n >\n {closeLabel}\n </Button>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAoDO,SAAS,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,GAAG;AACL,GAA6D;AAC3D,QAAM,UAAU,uBAAuB,EAAE,WAAW,cAAc,GAAG,OAAO;AAE5E,SACE,qBAAC,2BAA2B,UAA3B,EAAoC,OAAO,SAC1C,UAAA;AAAA,IAAA,oBAAC,6BAA2B,UAAS;AAAA,IACrC,oBAAC,8BAAA,EACC,UAAA,oBAAC,4BAAA,CAAA,CAA2B,EAAA,CAC9B;AAAA,EAAA,GACF;AAEJ;AAQA,SAAS,0BAA0B;AAAA,EACjC;AACF,GAA6C;AAC3C,QAAM,UAAU,8BAAA;AAIhB,QAAM,cAAe,UAAoD;AACzE,QAAM,MAAM,aAAa,CAAC,QAAQ,KAAK,cAAc,WAAW,CAAC;AAEjE,MAAI,CAAC,eAAe,QAAQ,GAAG;AAC7B,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAEA,QAAM,iBAAiB,QAAQ,kBAAkB;AAAA,IAC/C;AAAA;AAAA;AAAA,IAGA,GAAI,QAAQ,QAAQ;AAAA,MAClB,oBAAoB,QAAQ,mBAAmB;AAAA,IAAA;AAAA,EACjD,CACD;AAQD,SAAO,eAAe,eAAe;AAErC,SAAO,aAAa,UAAU,cAAc;AAC9C;AAOA,SAAS,6BAA6B;AAAA,EACpC;AACF,GAA0C;AACxC,QAAM;AAAA,IACJ,SAAS;AAAA,IACT;AA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EJ;"}
1
+ {"version":3,"file":"ReleaseAnnouncement.js","sources":["../../../src/components/ReleaseAnnouncement/ReleaseAnnouncement.tsx"],"sourcesContent":["/*\nCopyright 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 React, {\n cloneElement,\n isValidElement,\n type JSX,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\nimport {\n FloatingPortal,\n FloatingFocusManager,\n type Placement,\n useMergeRefs,\n FloatingArrow,\n} from \"@floating-ui/react\";\nimport { Text } from \"../Typography/Text\";\nimport { Button } from \"../Button\";\nimport styles from \"./ReleaseAnnouncement.module.css\";\nimport {\n useReleaseAnnouncementContext,\n ReleaseAnnouncementContext,\n} from \"./ReleaseAnnouncementContext\";\nimport { useReleaseAnnouncement } from \"./useReleaseAnnouncement\";\n\ntype UseReleaseAnnouncementParam = Parameters<typeof useReleaseAnnouncement>[0];\n\ninterface ReleaseAnnouncementProps extends Omit<\n UseReleaseAnnouncementParam,\n \"placement\" | \"displayArrow\"\n> {\n /**\n * The placement of the component\n * @default \"right\"\n */\n placement?: Placement;\n /**\n * Whether to display an arrow.\n * @default true\n */\n displayArrow?: boolean;\n}\n\n/**\n * The ReleaseAnnouncement component purpose is to inform the user of a new available feature.\n * This component is a floating component that will appear next to an anchor.\n * @param children - Act as an anchor, the component will be displayed alongside of it.\n * @param placement - The placement of the component\n */\nexport function ReleaseAnnouncement({\n /**\n * The children anchor should be a single valid React element.\n */\n children,\n placement = \"right\",\n displayArrow = true,\n ...props\n}: PropsWithChildren<ReleaseAnnouncementProps>): JSX.Element {\n const context = useReleaseAnnouncement({ placement, displayArrow, ...props });\n\n return (\n <ReleaseAnnouncementContext.Provider value={context}>\n <ReleaseAnnouncementAnchor>{children}</ReleaseAnnouncementAnchor>\n <ReleaseAnnouncementContainer>\n <ReleaseAnnouncementContent />\n </ReleaseAnnouncementContainer>\n </ReleaseAnnouncementContext.Provider>\n );\n}\n\n/**\n * The anchor for the ReleaseAnnouncement components.\n * The Release Announcement will appear next to this element.\n * @param children - should be a single valid React element\n * @constructor\n */\nfunction ReleaseAnnouncementAnchor({\n children,\n}: Readonly<PropsWithChildren>): JSX.Element {\n const context = useReleaseAnnouncementContext();\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 if (!isValidElement(children)) {\n throw new Error(\n \"ReleaseAnnouncement anchor must be a single valid React element\",\n );\n }\n\n const referenceProps = context.getReferenceProps({\n ref,\n // If the ReleaseAnnouncement is open, we need manually aria-describedby.\n // The RA has the dialog role and it's not adding automatically the aria-describedby.\n ...(context.open && {\n \"aria-describedby\": context.getFloatingProps().id as string,\n }),\n });\n\n // getReferenceProps includes aria-expanded (being true when the popup is shown)\n // but axe only allows this on certain elements and we use release anncounements on\n // all sorts of elements. Semantically, I don't think it makes sense because the point\n // of aria-expanded is a hint to the user that there is something that can be expanded.\n // The user can't cause a release announcement to be shown, it just appears when it thinks\n // it's time, so I think adding it here is misleading.\n delete referenceProps[\"aria-expanded\"];\n\n return cloneElement(children, referenceProps);\n}\n\n/**\n * The container for the ReleaseAnnouncement components.\n * Manage focus and positioning of the children.\n * @param children\n */\nfunction ReleaseAnnouncementContainer({\n children,\n}: PropsWithChildren): JSX.Element | null {\n const {\n context: floatingContext,\n arrowRef,\n displayArrow,\n ...rest\n } = useReleaseAnnouncementContext();\n\n if (!floatingContext.open) return null;\n\n return (\n <FloatingPortal>\n <FloatingFocusManager context={floatingContext} modal={false}>\n <div\n ref={rest.refs.setFloating}\n style={rest.floatingStyles}\n aria-labelledby={rest.labelId}\n aria-describedby={rest.descriptionId}\n {...rest.getFloatingProps()}\n className={styles.content}\n >\n {displayArrow && (\n <FloatingArrow\n ref={arrowRef}\n context={floatingContext}\n // design absolute value\n width={20}\n height={12}\n className={styles.arrow}\n />\n )}\n {children}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n );\n}\n\n/**\n * The content of the ReleaseAnnouncement component.\n * ---------------------------------------------------------------\n * - The header in a bold text ------------- -\n * - A description in a regular text | Close button | -\n * - Description can be on multiple lines ------------- -\n * ---------------------------------------------------------------\n */\nfunction ReleaseAnnouncementContent(): JSX.Element {\n const { labelId, descriptionId, header, description, closeLabel, onClick } =\n useReleaseAnnouncementContext();\n\n return (\n <>\n <Text\n as=\"h3\"\n id={labelId}\n className={styles.header}\n size=\"lg\"\n weight=\"semibold\"\n >\n {header}\n </Text>\n <Text\n as=\"span\"\n id={descriptionId}\n className={styles.description}\n size=\"sm\"\n weight=\"regular\"\n >\n {description}\n </Text>\n <Button\n size=\"sm\"\n kind=\"secondary\"\n className={styles.button}\n onClick={onClick}\n >\n {closeLabel}\n </Button>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAsDO,SAAS,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,GAAG;AACL,GAA6D;AAC3D,QAAM,UAAU,uBAAuB,EAAE,WAAW,cAAc,GAAG,OAAO;AAE5E,SACE,qBAAC,2BAA2B,UAA3B,EAAoC,OAAO,SAC1C,UAAA;AAAA,IAAA,oBAAC,6BAA2B,UAAS;AAAA,IACrC,oBAAC,8BAAA,EACC,UAAA,oBAAC,4BAAA,CAAA,CAA2B,EAAA,CAC9B;AAAA,EAAA,GACF;AAEJ;AAQA,SAAS,0BAA0B;AAAA,EACjC;AACF,GAA6C;AAC3C,QAAM,UAAU,8BAAA;AAIhB,QAAM,cAAe,UAAoD;AACzE,QAAM,MAAM,aAAa,CAAC,QAAQ,KAAK,cAAc,WAAW,CAAC;AAEjE,MAAI,CAAC,eAAe,QAAQ,GAAG;AAC7B,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAEA,QAAM,iBAAiB,QAAQ,kBAAk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H,IAAI;AAAA,QACJ,WAAW,OAAO;AAAA,QAClB,MAAK;AAAA,QACL,QAAO;AAAA,QAEN,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEH;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,WAAW,OAAO;AAAA,QAClB;AAAA,QAEC,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ;"}
package/dist/style.css CHANGED
@@ -899,12 +899,12 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
899
899
  Please see LICENSE files in the repository root for full details.
900
900
  */
901
901
 
902
- ._item_dyt4i_8 {
902
+ ._item_lqfwq_8 {
903
903
  display: grid;
904
904
  grid-template: "icon label ." auto "empty1 label empty2" auto / auto auto minmax(
905
905
  /* Reserve space for the chevron so that the layout doesn't shift on
906
906
  hover */
907
- var(--cpd-space-2x),
907
+ var(--cpd-space-2x),
908
908
  1fr
909
909
  );
910
910
  place-items: center end;
@@ -917,105 +917,105 @@ Please see LICENSE files in the repository root for full details.
917
917
  background: var(--cpd-color-bg-action-secondary-rest);
918
918
  }
919
919
 
920
- ._item_dyt4i_8._interactive_dyt4i_26 {
920
+ ._item_lqfwq_8._interactive_lqfwq_26 {
921
921
  cursor: pointer;
922
922
  }
923
923
 
924
- ._item_dyt4i_8._no-label_dyt4i_30 {
924
+ ._item_lqfwq_8._no-label_lqfwq_30 {
925
925
  grid-template: "icon ." auto / auto 1fr;
926
926
  }
927
927
 
928
- ._label_dyt4i_34 {
928
+ ._label_lqfwq_34 {
929
929
  grid-area: label;
930
930
  margin-inline-end: var(--cpd-space-4x);
931
931
  text-align: start;
932
932
  word-break: break-word; /* stylelint-disable-line declaration-property-value-keyword-no-deprecated */
933
933
  }
934
934
 
935
- ._item_dyt4i_8._no-icon_dyt4i_41 {
935
+ ._item_lqfwq_8._no-icon_lqfwq_41 {
936
936
  grid-template: "label ." auto / auto 1fr;
937
937
 
938
- ._label_dyt4i_34 {
938
+ ._label_lqfwq_34 {
939
939
  /* Without icon, the height changes when hovered */
940
940
  min-block-size: 24px;
941
941
  }
942
942
  }
943
943
 
944
- ._icon_dyt4i_50 {
944
+ ._icon_lqfwq_50 {
945
945
  grid-area: icon;
946
946
  margin-inline-end: var(--cpd-space-3x);
947
947
  }
948
948
 
949
- ._item_dyt4i_8._no-label_dyt4i_30 ._icon_dyt4i_50 {
949
+ ._item_lqfwq_8._no-label_lqfwq_30 ._icon_lqfwq_50 {
950
950
  margin-inline-end: var(--cpd-space-4x);
951
951
  }
952
952
 
953
- ._nav-hint_dyt4i_59 {
953
+ ._nav-hint_lqfwq_59 {
954
954
  /* Hidden until the item is hovered over */
955
955
  display: none;
956
956
  flex-shrink: 0;
957
957
  }
958
958
 
959
- button._item_dyt4i_8 {
959
+ button._item_lqfwq_8 {
960
960
  appearance: none;
961
961
  border: none;
962
962
  }
963
963
 
964
- ._item_dyt4i_8[data-kind="primary"] > ._label_dyt4i_34 {
964
+ ._item_lqfwq_8[data-kind="primary"] > ._label_lqfwq_34 {
965
965
  color: var(--cpd-color-text-primary);
966
966
  }
967
967
 
968
- ._item_dyt4i_8[data-kind="primary"] > ._icon_dyt4i_50 {
968
+ ._item_lqfwq_8[data-kind="primary"] > ._icon_lqfwq_50 {
969
969
  color: var(--cpd-color-icon-primary);
970
970
  }
971
971
 
972
- ._item_dyt4i_8[data-kind="primary"] > ._nav-hint_dyt4i_59 {
972
+ ._item_lqfwq_8[data-kind="primary"] > ._nav-hint_lqfwq_59 {
973
973
  color: var(--cpd-color-icon-tertiary);
974
974
  }
975
975
 
976
- ._item_dyt4i_8[data-kind="critical"] > ._label_dyt4i_34 {
976
+ ._item_lqfwq_8[data-kind="critical"] > ._label_lqfwq_34 {
977
977
  color: var(--cpd-color-text-critical-primary);
978
978
  }
979
979
 
980
- ._item_dyt4i_8[data-kind="critical"] > ._icon_dyt4i_50,
981
- ._item_dyt4i_8[data-kind="critical"] > ._nav-hint_dyt4i_59 {
980
+ ._item_lqfwq_8[data-kind="critical"] > ._icon_lqfwq_50,
981
+ ._item_lqfwq_8[data-kind="critical"] > ._nav-hint_lqfwq_59 {
982
982
  color: var(--cpd-color-icon-critical-primary);
983
983
  }
984
984
 
985
985
  @media (hover) {
986
- ._item_dyt4i_8._interactive_dyt4i_26[data-kind="primary"]:hover {
986
+ ._item_lqfwq_8._interactive_lqfwq_26[data-kind="primary"]:hover {
987
987
  background: var(--cpd-color-bg-action-secondary-hovered);
988
988
  }
989
989
 
990
- ._item_dyt4i_8._interactive_dyt4i_26[data-kind="critical"]:hover {
990
+ ._item_lqfwq_8._interactive_lqfwq_26[data-kind="critical"]:hover {
991
991
  background: var(--cpd-color-bg-critical-subtle);
992
992
  }
993
993
 
994
994
  /* Replace the children with the navigation hint on hover */
995
- ._item_dyt4i_8._interactive_dyt4i_26:hover > ._nav-hint_dyt4i_59 {
995
+ ._item_lqfwq_8._interactive_lqfwq_26:hover > ._nav-hint_lqfwq_59 {
996
996
  display: initial;
997
997
  }
998
998
 
999
- ._item_dyt4i_8._interactive_dyt4i_26:hover > ._nav-hint_dyt4i_59 ~ * {
999
+ ._item_lqfwq_8._interactive_lqfwq_26:hover > ._nav-hint_lqfwq_59 ~ * {
1000
1000
  display: none;
1001
1001
  }
1002
1002
  }
1003
1003
 
1004
- ._item_dyt4i_8._interactive_dyt4i_26[data-kind="primary"]:active {
1004
+ ._item_lqfwq_8._interactive_lqfwq_26[data-kind="primary"]:active {
1005
1005
  background: var(--cpd-color-bg-action-secondary-pressed);
1006
1006
  }
1007
1007
 
1008
- ._item_dyt4i_8._interactive_dyt4i_26[data-kind="critical"]:active {
1008
+ ._item_lqfwq_8._interactive_lqfwq_26[data-kind="critical"]:active {
1009
1009
  background: var(--cpd-color-bg-critical-subtle-hovered);
1010
1010
  }
1011
1011
 
1012
- ._item_dyt4i_8[data-kind]._disabled_dyt4i_118 {
1012
+ ._item_lqfwq_8[data-kind]._disabled_lqfwq_118 {
1013
1013
  pointer-events: none;
1014
1014
  }
1015
1015
 
1016
- ._item_dyt4i_8[data-kind]._disabled_dyt4i_118 > ._label_dyt4i_34,
1017
- ._item_dyt4i_8[data-kind]._disabled_dyt4i_118 > ._icon_dyt4i_50,
1018
- ._item_dyt4i_8[data-kind]._disabled_dyt4i_118 > ._nav-hint_dyt4i_59 {
1016
+ ._item_lqfwq_8[data-kind]._disabled_lqfwq_118 > ._label_lqfwq_34,
1017
+ ._item_lqfwq_8[data-kind]._disabled_lqfwq_118 > ._icon_lqfwq_50,
1018
+ ._item_lqfwq_8[data-kind]._disabled_lqfwq_118 > ._nav-hint_lqfwq_59 {
1019
1019
  color: var(--cpd-color-text-disabled);
1020
1020
  }
1021
1021
  /*
@@ -1780,7 +1780,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
1780
1780
  Please see LICENSE files in the repository root for full details.
1781
1781
  */
1782
1782
 
1783
- ._button_187yx_8 {
1783
+ ._button_13vu4_8 {
1784
1784
  border-radius: var(--cpd-radius-pill-effect);
1785
1785
  cursor: pointer;
1786
1786
  appearance: none;
@@ -1794,22 +1794,25 @@ Please see LICENSE files in the repository root for full details.
1794
1794
  transition-property: color, background-color, border-color;
1795
1795
  }
1796
1796
 
1797
- a._button_187yx_8 {
1797
+ a._button_13vu4_8 {
1798
1798
  /* Make the width match that of a real button */
1799
1799
  inline-size: max-content;
1800
+
1801
+ /* Buttons should not be underlined */
1802
+ text-decoration: none;
1800
1803
  }
1801
1804
 
1802
- ._button_187yx_8 > svg {
1805
+ ._button_13vu4_8 > svg {
1803
1806
  transition: color 0.1s;
1804
1807
  }
1805
1808
 
1806
- ._button_187yx_8[aria-disabled="true"] {
1809
+ ._button_13vu4_8[aria-disabled="true"] {
1807
1810
  cursor: not-allowed;
1808
1811
  pointer-events: all !important;
1809
1812
  color: var(--cpd-color-text-disabled) !important;
1810
1813
  }
1811
1814
 
1812
- ._button_187yx_8[aria-disabled="true"] > svg {
1815
+ ._button_13vu4_8[aria-disabled="true"] > svg {
1813
1816
  color: var(--cpd-color-icon-disabled) !important;
1814
1817
  }
1815
1818
 
@@ -1817,35 +1820,35 @@ a._button_187yx_8 {
1817
1820
  * SIZES
1818
1821
  */
1819
1822
 
1820
- ._button_187yx_8[data-size="lg"] {
1823
+ ._button_13vu4_8[data-size="lg"] {
1821
1824
  padding-block: var(--cpd-space-2x);
1822
1825
  padding-inline: var(--cpd-space-8x);
1823
1826
  min-block-size: var(--cpd-space-12x);
1824
1827
 
1825
- &._icon-only_187yx_50 {
1828
+ &._icon-only_13vu4_53 {
1826
1829
  padding-inline: var(--cpd-space-2x);
1827
1830
  block-size: var(--cpd-space-12x);
1828
1831
  inline-size: var(--cpd-space-12x);
1829
1832
  }
1830
1833
  }
1831
1834
 
1832
- ._button_187yx_8[data-size="lg"]._has-icon_187yx_57:not(._icon-only_187yx_50) {
1835
+ ._button_13vu4_8[data-size="lg"]._has-icon_13vu4_60:not(._icon-only_13vu4_53) {
1833
1836
  padding-inline-start: var(--cpd-space-7x);
1834
1837
  }
1835
1838
 
1836
- ._button_187yx_8[data-size="sm"] {
1839
+ ._button_13vu4_8[data-size="sm"] {
1837
1840
  padding-block: var(--cpd-space-1x);
1838
1841
  padding-inline: var(--cpd-space-5x);
1839
1842
  min-block-size: var(--cpd-space-9x);
1840
1843
 
1841
- &._icon-only_187yx_50 {
1844
+ &._icon-only_13vu4_53 {
1842
1845
  padding-inline: var(--cpd-space-1x);
1843
1846
  block-size: var(--cpd-space-9x);
1844
1847
  inline-size: var(--cpd-space-9x);
1845
1848
  }
1846
1849
  }
1847
1850
 
1848
- ._button_187yx_8[data-size="sm"]._has-icon_187yx_57:not(._icon-only_187yx_50) {
1851
+ ._button_13vu4_8[data-size="sm"]._has-icon_13vu4_60:not(._icon-only_13vu4_53) {
1849
1852
  padding-inline-start: var(--cpd-space-4x);
1850
1853
  }
1851
1854
 
@@ -1853,100 +1856,100 @@ a._button_187yx_8 {
1853
1856
  * KINDS
1854
1857
  */
1855
1858
 
1856
- ._button_187yx_8[data-kind="primary"] {
1859
+ ._button_13vu4_8[data-kind="primary"] {
1857
1860
  color: var(--cpd-color-text-on-solid-primary);
1858
1861
  background: var(--cpd-color-bg-action-primary-rest);
1859
1862
  border-width: 0;
1860
1863
  }
1861
1864
 
1862
- ._button_187yx_8[data-kind="primary"] > svg {
1865
+ ._button_13vu4_8[data-kind="primary"] > svg {
1863
1866
  color: var(--cpd-color-icon-on-solid-primary);
1864
1867
  }
1865
1868
 
1866
1869
  @media (hover) {
1867
- ._button_187yx_8[data-kind="primary"]:hover {
1870
+ ._button_13vu4_8[data-kind="primary"]:hover {
1868
1871
  background: var(--cpd-color-bg-action-primary-hovered);
1869
1872
  }
1870
1873
  }
1871
1874
 
1872
- ._button_187yx_8[data-kind="primary"]:active,
1873
- ._button_187yx_8[data-kind="primary"][aria-expanded="true"] {
1875
+ ._button_13vu4_8[data-kind="primary"]:active,
1876
+ ._button_13vu4_8[data-kind="primary"][aria-expanded="true"] {
1874
1877
  background: var(--cpd-color-bg-action-primary-pressed);
1875
1878
  }
1876
1879
 
1877
- ._button_187yx_8[data-kind="primary"][aria-disabled="true"] {
1880
+ ._button_13vu4_8[data-kind="primary"][aria-disabled="true"] {
1878
1881
  /* !important to override destructive background */
1879
1882
  background: var(--cpd-color-bg-subtle-primary) !important;
1880
1883
  }
1881
1884
 
1882
- ._button_187yx_8[data-kind="primary"]._destructive_187yx_107 {
1885
+ ._button_13vu4_8[data-kind="primary"]._destructive_13vu4_110 {
1883
1886
  background: var(--cpd-color-bg-critical-primary);
1884
1887
  }
1885
1888
 
1886
1889
  @media (hover) {
1887
- ._button_187yx_8[data-kind="primary"]._destructive_187yx_107:hover {
1890
+ ._button_13vu4_8[data-kind="primary"]._destructive_13vu4_110:hover {
1888
1891
  background: var(--cpd-color-bg-critical-hovered);
1889
1892
  }
1890
1893
  }
1891
1894
 
1892
- ._button_187yx_8[data-kind="primary"]._destructive_187yx_107:active,
1893
- ._button_187yx_8[data-kind="primary"]._destructive_187yx_107[aria-expanded="true"] {
1895
+ ._button_13vu4_8[data-kind="primary"]._destructive_13vu4_110:active,
1896
+ ._button_13vu4_8[data-kind="primary"]._destructive_13vu4_110[aria-expanded="true"] {
1894
1897
  /* TODO: We're waiting for this value to be formalized as a semantic token */
1895
1898
  background: var(--cpd-color-red-1100);
1896
1899
  }
1897
1900
 
1898
- ._button_187yx_8[data-kind="secondary"] {
1901
+ ._button_13vu4_8[data-kind="secondary"] {
1899
1902
  border: 1px solid var(--cpd-color-border-interactive-secondary);
1900
1903
  color: var(--cpd-color-text-primary);
1901
1904
  background: var(--cpd-color-bg-canvas-default);
1902
1905
  }
1903
1906
 
1904
- ._button_187yx_8[data-kind="secondary"] > svg {
1907
+ ._button_13vu4_8[data-kind="secondary"] > svg {
1905
1908
  color: var(--cpd-color-icon-primary);
1906
1909
  }
1907
1910
 
1908
1911
  @media (hover) {
1909
- ._button_187yx_8[data-kind="secondary"]:hover {
1912
+ ._button_13vu4_8[data-kind="secondary"]:hover {
1910
1913
  border-color: var(--cpd-color-border-interactive-hovered);
1911
1914
  background: var(--cpd-color-bg-subtle-secondary);
1912
1915
  }
1913
1916
  }
1914
1917
 
1915
- ._button_187yx_8[data-kind="secondary"]:active,
1916
- ._button_187yx_8[data-kind="secondary"][aria-expanded="true"] {
1918
+ ._button_13vu4_8[data-kind="secondary"]:active,
1919
+ ._button_13vu4_8[data-kind="secondary"][aria-expanded="true"] {
1917
1920
  border-color: var(--cpd-color-border-interactive-hovered);
1918
1921
  background: var(--cpd-color-bg-subtle-primary);
1919
1922
  }
1920
1923
 
1921
- ._button_187yx_8[data-kind="secondary"][aria-disabled="true"] {
1924
+ ._button_13vu4_8[data-kind="secondary"][aria-disabled="true"] {
1922
1925
  /* !important to override destructive values */
1923
1926
  border-color: var(--cpd-color-border-interactive-secondary) !important;
1924
1927
  background: var(--cpd-color-bg-subtle-secondary) !important;
1925
1928
  }
1926
1929
 
1927
- ._button_187yx_8[data-kind="secondary"]._destructive_187yx_107 {
1930
+ ._button_13vu4_8[data-kind="secondary"]._destructive_13vu4_110 {
1928
1931
  border-color: var(--cpd-color-border-critical-subtle);
1929
1932
  color: var(--cpd-color-text-critical-primary);
1930
1933
  }
1931
1934
 
1932
- ._button_187yx_8[data-kind="secondary"]._destructive_187yx_107 > svg {
1935
+ ._button_13vu4_8[data-kind="secondary"]._destructive_13vu4_110 > svg {
1933
1936
  color: var(--cpd-color-icon-critical-primary);
1934
1937
  }
1935
1938
 
1936
1939
  @media (hover) {
1937
- ._button_187yx_8[data-kind="secondary"]._destructive_187yx_107:hover {
1940
+ ._button_13vu4_8[data-kind="secondary"]._destructive_13vu4_110:hover {
1938
1941
  border-color: var(--cpd-color-border-critical-hovered);
1939
1942
  background: var(--cpd-color-bg-critical-subtle);
1940
1943
  }
1941
1944
  }
1942
1945
 
1943
- ._button_187yx_8[data-kind="secondary"]._destructive_187yx_107:active,
1944
- ._button_187yx_8[data-kind="secondary"]._destructive_187yx_107[aria-expanded="true"] {
1946
+ ._button_13vu4_8[data-kind="secondary"]._destructive_13vu4_110:active,
1947
+ ._button_13vu4_8[data-kind="secondary"]._destructive_13vu4_110[aria-expanded="true"] {
1945
1948
  border-color: var(--cpd-color-border-critical-hovered);
1946
1949
  background: var(--cpd-color-bg-critical-subtle-hovered);
1947
1950
  }
1948
1951
 
1949
- ._button_187yx_8[data-kind="tertiary"] {
1952
+ ._button_13vu4_8[data-kind="tertiary"] {
1950
1953
  border: none;
1951
1954
  color: var(--cpd-color-text-primary);
1952
1955
  text-decoration: underline;
@@ -1954,40 +1957,40 @@ a._button_187yx_8 {
1954
1957
  }
1955
1958
 
1956
1959
  @media (hover) {
1957
- ._button_187yx_8[data-kind="tertiary"]:hover {
1960
+ ._button_13vu4_8[data-kind="tertiary"]:hover {
1958
1961
  background: var(--cpd-color-bg-subtle-secondary);
1959
1962
  }
1960
1963
  }
1961
1964
 
1962
- ._button_187yx_8[data-kind="tertiary"]:active,
1963
- ._button_187yx_8[data-kind="tertiary"][aria-expanded="true"] {
1965
+ ._button_13vu4_8[data-kind="tertiary"]:active,
1966
+ ._button_13vu4_8[data-kind="tertiary"][aria-expanded="true"] {
1964
1967
  background: var(--cpd-color-bg-subtle-primary);
1965
1968
  }
1966
1969
 
1967
- ._button_187yx_8[data-kind="tertiary"][aria-disabled="true"] {
1970
+ ._button_13vu4_8[data-kind="tertiary"][aria-disabled="true"] {
1968
1971
  color: var(--cpd-color-text-disabled);
1969
1972
 
1970
1973
  /* !important to override destructive background */
1971
1974
  background: transparent !important;
1972
1975
  }
1973
1976
 
1974
- ._button_187yx_8[data-kind="tertiary"]._destructive_187yx_107 {
1977
+ ._button_13vu4_8[data-kind="tertiary"]._destructive_13vu4_110 {
1975
1978
  color: var(--cpd-color-text-critical-primary);
1976
1979
  }
1977
1980
 
1978
1981
  @media (hover) {
1979
- ._button_187yx_8[data-kind="tertiary"]._destructive_187yx_107:hover {
1982
+ ._button_13vu4_8[data-kind="tertiary"]._destructive_13vu4_110:hover {
1980
1983
  background: var(--cpd-color-bg-critical-subtle);
1981
1984
  }
1982
1985
  }
1983
1986
 
1984
- ._button_187yx_8[data-kind="tertiary"]._destructive_187yx_107:active,
1985
- ._button_187yx_8[data-kind="tertiary"]._destructive_187yx_107[aria-expanded="true"] {
1987
+ ._button_13vu4_8[data-kind="tertiary"]._destructive_13vu4_110:active,
1988
+ ._button_13vu4_8[data-kind="tertiary"]._destructive_13vu4_110[aria-expanded="true"] {
1986
1989
  background: var(--cpd-color-bg-critical-subtle-hovered);
1987
1990
  }
1988
1991
 
1989
1992
  @media (forced-colors: active) {
1990
- ._button_187yx_8[data-kind="primary"] {
1993
+ ._button_13vu4_8[data-kind="primary"] {
1991
1994
  outline: 1px solid transparent;
1992
1995
  }
1993
1996
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vector-im/compound-web",
3
- "version": "8.3.1",
3
+ "version": "8.3.4",
4
4
  "description": "Compound components for the Web",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "repository": {
38
38
  "type": "git",
39
- "url": "git+https://github.com/vector-im/compound-web.git"
39
+ "url": "git+https://github.com/element-hq/compound-web.git"
40
40
  },
41
41
  "keywords": [
42
42
  "compound",
@@ -56,7 +56,7 @@
56
56
  "@fontsource/inter": "^5.0.8",
57
57
  "@playwright/test": "^1.41.1",
58
58
  "@storybook/addon-a11y": "^10.0.0",
59
- "@storybook/addon-designs": "11.0.1",
59
+ "@storybook/addon-designs": "11.1.0",
60
60
  "@storybook/addon-docs": "^10.0.0",
61
61
  "@storybook/addon-links": "^10.0.0",
62
62
  "@storybook/addon-themes": "^10.0.0",
@@ -83,7 +83,7 @@
83
83
  "eslint-plugin-react": "^7.33.2",
84
84
  "eslint-plugin-storybook": "^10.0.0",
85
85
  "jsdom": "^27.0.0",
86
- "prettier": "3.6.2",
86
+ "prettier": "3.7.4",
87
87
  "react": "^19.1.0",
88
88
  "react-dom": "^19.1.0",
89
89
  "resize-observer-polyfill": "^1.5.1",
@@ -22,6 +22,9 @@ Please see LICENSE files in the repository root for full details.
22
22
  a.button {
23
23
  /* Make the width match that of a real button */
24
24
  inline-size: max-content;
25
+
26
+ /* Buttons should not be underlined */
27
+ text-decoration: none;
25
28
  }
26
29
 
27
30
  .button > svg {
@@ -6,6 +6,7 @@ Please see LICENSE files in the repository root for full details.
6
6
  */
7
7
 
8
8
  import React, { type SVGAttributes, forwardRef } from "react";
9
+ import classNames from "classnames";
9
10
  import styles from "./InlineSpinner.module.css";
10
11
  import SpinnerIcon from "@vector-im/compound-design-tokens/assets/web/icons/spinner";
11
12
 
@@ -14,11 +15,11 @@ type InlineSpinnerProps = {
14
15
  } & SVGAttributes<SVGElement>;
15
16
 
16
17
  export const InlineSpinner = forwardRef<SVGSVGElement, InlineSpinnerProps>(
17
- function InlineSpinner({ size = 20, ...props }, ref) {
18
+ function InlineSpinner({ size = 20, className, ...props }, ref) {
18
19
  return (
19
20
  <SpinnerIcon
20
21
  ref={ref}
21
- className={styles.icon}
22
+ className={classNames(styles.icon, className)}
22
23
  style={{ width: size, height: size }}
23
24
  {...props}
24
25
  />
@@ -10,7 +10,7 @@ Please see LICENSE files in the repository root for full details.
10
10
  grid-template: "icon label ." auto "empty1 label empty2" auto / auto auto minmax(
11
11
  /* Reserve space for the chevron so that the layout doesn't shift on
12
12
  hover */
13
- var(--cpd-space-2x),
13
+ var(--cpd-space-2x),
14
14
  1fr
15
15
  );
16
16
  place-items: center end;
@@ -30,8 +30,10 @@ import { useReleaseAnnouncement } from "./useReleaseAnnouncement";
30
30
 
31
31
  type UseReleaseAnnouncementParam = Parameters<typeof useReleaseAnnouncement>[0];
32
32
 
33
- interface ReleaseAnnouncementProps
34
- extends Omit<UseReleaseAnnouncementParam, "placement" | "displayArrow"> {
33
+ interface ReleaseAnnouncementProps extends Omit<
34
+ UseReleaseAnnouncementParam,
35
+ "placement" | "displayArrow"
36
+ > {
35
37
  /**
36
38
  * The placement of the component
37
39
  * @default "right"