@vector-im/compound-web 8.3.0 → 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,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const avatar = "_avatar_1jp1e_8";
4
- const image = "_image_1jp1e_43";
3
+ const avatar = "_avatar_zysgz_8";
4
+ const image = "_image_zysgz_43";
5
5
  const styles = {
6
6
  avatar,
7
7
  image,
8
- "avatar-imageless": "_avatar-imageless_1jp1e_54",
9
- "stacked-avatars": "_stacked-avatars_1jp1e_107",
10
- "clip-path": "_clip-path_1jp1e_126"
8
+ "avatar-imageless": "_avatar-imageless_zysgz_55",
9
+ "stacked-avatars": "_stacked-avatars_zysgz_109",
10
+ "clip-path": "_clip-path_zysgz_128"
11
11
  };
12
12
  exports.avatar = avatar;
13
13
  exports.default = styles;
@@ -1,11 +1,11 @@
1
- const avatar = "_avatar_1jp1e_8";
2
- const image = "_image_1jp1e_43";
1
+ const avatar = "_avatar_zysgz_8";
2
+ const image = "_image_zysgz_43";
3
3
  const styles = {
4
4
  avatar,
5
5
  image,
6
- "avatar-imageless": "_avatar-imageless_1jp1e_54",
7
- "stacked-avatars": "_stacked-avatars_1jp1e_107",
8
- "clip-path": "_clip-path_1jp1e_126"
6
+ "avatar-imageless": "_avatar-imageless_zysgz_55",
7
+ "stacked-avatars": "_stacked-avatars_zysgz_109",
8
+ "clip-path": "_clip-path_zysgz_128"
9
9
  };
10
10
  export {
11
11
  avatar,
@@ -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","FloatingFocusManager","styles","FloatingArrow","Fragment","Text","Button"],"mappings":";;;;;;;;;;AAoDO,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;AAA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OAAO;AAAA,YACP,QAAQ;AAAA,YACR,WAAWD,2BAAAA,QAAO;AAAA,UAAA;AAAA,QAAA;AAAA,QAGrB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEL,EAAA,CACF;AAEJ;AAUA,SAAS,6BAA0C;AACjD,QAAM,EAAE,SAAS,eAAe,QAAQ,aAAa,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
+ {"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,UAAoD;AACzE,QAAM,MAAMC,MAAAA,aAAa,CAAC,QAAQ,KAAK,cAAc,WAAW,CAAC;AAEjE,MAAI,CAACC,MAAAA,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,eA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A,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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AAA,MAEjB,UAAA;AAAA,QAAA,gBACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAK;AAAA,YACL,SAAS;AAAA,YAET,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,WAAW,OAAO;AAAA,UAAA;AAAA,QAAA;AAAA,QAGrB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEL,EAAA,CACF;AAEJ;AAUA,SAAS,6BAA0C;AACjD,QAAM,EAAE,SAAS,eAAe,QAAQ,aAAa,YAAY,QAAA,IAC/D,8BAAA;AAEF,SACE,qBAAA,UAAA,EACE,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,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,IAAG;AAAA,QACH,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;"}
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,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;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,8BAAA;AAEJ,MAAI,CAAC,gBAAgB,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seRef-Element-Commercial
463
463
  Please see LICENSE files in the repository root for full details.
464
464
  */
465
465
 
466
- ._avatar_1jp1e_8 {
466
+ ._avatar_zysgz_8 {
467
467
  display: inline-block;
468
468
  box-sizing: border-box;
469
469
 
@@ -483,7 +483,7 @@ Please see LICENSE files in the repository root for full details.
483
483
  background: var(--cpd-color-bg-canvas-default);
484
484
  }
485
485
 
486
- button._avatar_1jp1e_8 {
486
+ button._avatar_zysgz_8 {
487
487
  /**
488
488
  * The avatar can be a button element, we need to reset its style
489
489
  */
@@ -493,23 +493,25 @@ button._avatar_1jp1e_8 {
493
493
  cursor: pointer;
494
494
  }
495
495
 
496
- button._avatar_1jp1e_8:disabled {
496
+ button._avatar_zysgz_8:disabled {
497
497
  cursor: not-allowed;
498
498
  }
499
499
 
500
- ._avatar_1jp1e_8,
501
- ._image_1jp1e_43 {
500
+ ._avatar_zysgz_8,
501
+ ._image_zysgz_43 {
502
502
  aspect-ratio: 1 / 1;
503
503
  inline-size: var(--cpd-avatar-size);
504
504
  border-radius: var(--cpd-avatar-radius);
505
505
  }
506
506
 
507
- ._image_1jp1e_43 {
507
+ ._image_zysgz_43 {
508
508
  object-fit: cover;
509
509
  overflow: hidden;
510
510
  }
511
511
 
512
- ._avatar-imageless_1jp1e_54 {
512
+ /* Additional selector for button to raise selector above button.avatar */
513
+ button._avatar-imageless_zysgz_55,
514
+ ._avatar-imageless_zysgz_55 {
513
515
  /* In the future we'd prefer to pass the HEX code as the data attr
514
516
  and use `attr(data-color)` to avoid the style declaration from below
515
517
  but this is currently not supported in all browsers */
@@ -520,41 +522,41 @@ button._avatar_1jp1e_8:disabled {
520
522
  border: 1px solid var(--cpd-avatar-bg);
521
523
  }
522
524
 
523
- ._avatar_1jp1e_8[data-color] {
525
+ ._avatar_zysgz_8[data-color] {
524
526
  --cpd-avatar-bg: var(--cpd-color-bg-decorative-1);
525
527
  --cpd-avatar-color: var(--cpd-color-text-decorative-1);
526
528
  }
527
529
 
528
- ._avatar_1jp1e_8[data-color="2"] {
530
+ ._avatar_zysgz_8[data-color="2"] {
529
531
  --cpd-avatar-bg: var(--cpd-color-bg-decorative-2);
530
532
  --cpd-avatar-color: var(--cpd-color-text-decorative-2);
531
533
  }
532
534
 
533
- ._avatar_1jp1e_8[data-color="3"] {
535
+ ._avatar_zysgz_8[data-color="3"] {
534
536
  --cpd-avatar-bg: var(--cpd-color-bg-decorative-3);
535
537
  --cpd-avatar-color: var(--cpd-color-text-decorative-3);
536
538
  }
537
539
 
538
- ._avatar_1jp1e_8[data-color="4"] {
540
+ ._avatar_zysgz_8[data-color="4"] {
539
541
  --cpd-avatar-bg: var(--cpd-color-bg-decorative-4);
540
542
  --cpd-avatar-color: var(--cpd-color-text-decorative-4);
541
543
  }
542
544
 
543
- ._avatar_1jp1e_8[data-color="5"] {
545
+ ._avatar_zysgz_8[data-color="5"] {
544
546
  --cpd-avatar-bg: var(--cpd-color-bg-decorative-5);
545
547
  --cpd-avatar-color: var(--cpd-color-text-decorative-5);
546
548
  }
547
549
 
548
- ._avatar_1jp1e_8[data-color="6"] {
550
+ ._avatar_zysgz_8[data-color="6"] {
549
551
  --cpd-avatar-bg: var(--cpd-color-bg-decorative-6);
550
552
  --cpd-avatar-color: var(--cpd-color-text-decorative-6);
551
553
  }
552
554
 
553
- ._avatar_1jp1e_8[data-type="round"] {
555
+ ._avatar_zysgz_8[data-type="round"] {
554
556
  --cpd-avatar-radius: 50%;
555
557
  }
556
558
 
557
- ._avatar_1jp1e_8[data-type="square"] {
559
+ ._avatar_zysgz_8[data-type="square"] {
558
560
  --cpd-avatar-radius: 25%;
559
561
  }
560
562
 
@@ -562,26 +564,26 @@ button._avatar_1jp1e_8:disabled {
562
564
  * Stacked avatars
563
565
  */
564
566
 
565
- ._stacked-avatars_1jp1e_107::after {
567
+ ._stacked-avatars_zysgz_109::after {
566
568
  content: "";
567
569
  display: table;
568
570
  clear: both;
569
571
  }
570
572
 
571
- ._stacked-avatars_1jp1e_107 ._avatar_1jp1e_8 {
573
+ ._stacked-avatars_zysgz_109 ._avatar_zysgz_8 {
572
574
  float: inline-start;
573
575
  }
574
576
 
575
- ._stacked-avatars_1jp1e_107 ._avatar_1jp1e_8:not(:last-child) {
577
+ ._stacked-avatars_zysgz_109 ._avatar_zysgz_8:not(:last-child) {
576
578
  /* injected in the document from AvatarStack.tsx */
577
579
  clip-path: url("#cpdAvatarClip");
578
580
  }
579
581
 
580
- ._stacked-avatars_1jp1e_107 > *:not(:first-child) {
582
+ ._stacked-avatars_zysgz_109 > *:not(:first-child) {
581
583
  margin-inline-start: calc(var(--cpd-avatar-size) * -0.2);
582
584
  }
583
585
 
584
- ._clip-path_1jp1e_126 {
586
+ ._clip-path_zysgz_128 {
585
587
  /* In theory the SVG is invisible, but we still need to ensure it doesn't
586
588
  affect the page's layout or otherwise make an appearance */
587
589
  position: fixed;
@@ -897,12 +899,12 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
897
899
  Please see LICENSE files in the repository root for full details.
898
900
  */
899
901
 
900
- ._item_dyt4i_8 {
902
+ ._item_lqfwq_8 {
901
903
  display: grid;
902
904
  grid-template: "icon label ." auto "empty1 label empty2" auto / auto auto minmax(
903
905
  /* Reserve space for the chevron so that the layout doesn't shift on
904
906
  hover */
905
- var(--cpd-space-2x),
907
+ var(--cpd-space-2x),
906
908
  1fr
907
909
  );
908
910
  place-items: center end;
@@ -915,105 +917,105 @@ Please see LICENSE files in the repository root for full details.
915
917
  background: var(--cpd-color-bg-action-secondary-rest);
916
918
  }
917
919
 
918
- ._item_dyt4i_8._interactive_dyt4i_26 {
920
+ ._item_lqfwq_8._interactive_lqfwq_26 {
919
921
  cursor: pointer;
920
922
  }
921
923
 
922
- ._item_dyt4i_8._no-label_dyt4i_30 {
924
+ ._item_lqfwq_8._no-label_lqfwq_30 {
923
925
  grid-template: "icon ." auto / auto 1fr;
924
926
  }
925
927
 
926
- ._label_dyt4i_34 {
928
+ ._label_lqfwq_34 {
927
929
  grid-area: label;
928
930
  margin-inline-end: var(--cpd-space-4x);
929
931
  text-align: start;
930
932
  word-break: break-word; /* stylelint-disable-line declaration-property-value-keyword-no-deprecated */
931
933
  }
932
934
 
933
- ._item_dyt4i_8._no-icon_dyt4i_41 {
935
+ ._item_lqfwq_8._no-icon_lqfwq_41 {
934
936
  grid-template: "label ." auto / auto 1fr;
935
937
 
936
- ._label_dyt4i_34 {
938
+ ._label_lqfwq_34 {
937
939
  /* Without icon, the height changes when hovered */
938
940
  min-block-size: 24px;
939
941
  }
940
942
  }
941
943
 
942
- ._icon_dyt4i_50 {
944
+ ._icon_lqfwq_50 {
943
945
  grid-area: icon;
944
946
  margin-inline-end: var(--cpd-space-3x);
945
947
  }
946
948
 
947
- ._item_dyt4i_8._no-label_dyt4i_30 ._icon_dyt4i_50 {
949
+ ._item_lqfwq_8._no-label_lqfwq_30 ._icon_lqfwq_50 {
948
950
  margin-inline-end: var(--cpd-space-4x);
949
951
  }
950
952
 
951
- ._nav-hint_dyt4i_59 {
953
+ ._nav-hint_lqfwq_59 {
952
954
  /* Hidden until the item is hovered over */
953
955
  display: none;
954
956
  flex-shrink: 0;
955
957
  }
956
958
 
957
- button._item_dyt4i_8 {
959
+ button._item_lqfwq_8 {
958
960
  appearance: none;
959
961
  border: none;
960
962
  }
961
963
 
962
- ._item_dyt4i_8[data-kind="primary"] > ._label_dyt4i_34 {
964
+ ._item_lqfwq_8[data-kind="primary"] > ._label_lqfwq_34 {
963
965
  color: var(--cpd-color-text-primary);
964
966
  }
965
967
 
966
- ._item_dyt4i_8[data-kind="primary"] > ._icon_dyt4i_50 {
968
+ ._item_lqfwq_8[data-kind="primary"] > ._icon_lqfwq_50 {
967
969
  color: var(--cpd-color-icon-primary);
968
970
  }
969
971
 
970
- ._item_dyt4i_8[data-kind="primary"] > ._nav-hint_dyt4i_59 {
972
+ ._item_lqfwq_8[data-kind="primary"] > ._nav-hint_lqfwq_59 {
971
973
  color: var(--cpd-color-icon-tertiary);
972
974
  }
973
975
 
974
- ._item_dyt4i_8[data-kind="critical"] > ._label_dyt4i_34 {
976
+ ._item_lqfwq_8[data-kind="critical"] > ._label_lqfwq_34 {
975
977
  color: var(--cpd-color-text-critical-primary);
976
978
  }
977
979
 
978
- ._item_dyt4i_8[data-kind="critical"] > ._icon_dyt4i_50,
979
- ._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 {
980
982
  color: var(--cpd-color-icon-critical-primary);
981
983
  }
982
984
 
983
985
  @media (hover) {
984
- ._item_dyt4i_8._interactive_dyt4i_26[data-kind="primary"]:hover {
986
+ ._item_lqfwq_8._interactive_lqfwq_26[data-kind="primary"]:hover {
985
987
  background: var(--cpd-color-bg-action-secondary-hovered);
986
988
  }
987
989
 
988
- ._item_dyt4i_8._interactive_dyt4i_26[data-kind="critical"]:hover {
990
+ ._item_lqfwq_8._interactive_lqfwq_26[data-kind="critical"]:hover {
989
991
  background: var(--cpd-color-bg-critical-subtle);
990
992
  }
991
993
 
992
994
  /* Replace the children with the navigation hint on hover */
993
- ._item_dyt4i_8._interactive_dyt4i_26:hover > ._nav-hint_dyt4i_59 {
995
+ ._item_lqfwq_8._interactive_lqfwq_26:hover > ._nav-hint_lqfwq_59 {
994
996
  display: initial;
995
997
  }
996
998
 
997
- ._item_dyt4i_8._interactive_dyt4i_26:hover > ._nav-hint_dyt4i_59 ~ * {
999
+ ._item_lqfwq_8._interactive_lqfwq_26:hover > ._nav-hint_lqfwq_59 ~ * {
998
1000
  display: none;
999
1001
  }
1000
1002
  }
1001
1003
 
1002
- ._item_dyt4i_8._interactive_dyt4i_26[data-kind="primary"]:active {
1004
+ ._item_lqfwq_8._interactive_lqfwq_26[data-kind="primary"]:active {
1003
1005
  background: var(--cpd-color-bg-action-secondary-pressed);
1004
1006
  }
1005
1007
 
1006
- ._item_dyt4i_8._interactive_dyt4i_26[data-kind="critical"]:active {
1008
+ ._item_lqfwq_8._interactive_lqfwq_26[data-kind="critical"]:active {
1007
1009
  background: var(--cpd-color-bg-critical-subtle-hovered);
1008
1010
  }
1009
1011
 
1010
- ._item_dyt4i_8[data-kind]._disabled_dyt4i_118 {
1012
+ ._item_lqfwq_8[data-kind]._disabled_lqfwq_118 {
1011
1013
  pointer-events: none;
1012
1014
  }
1013
1015
 
1014
- ._item_dyt4i_8[data-kind]._disabled_dyt4i_118 > ._label_dyt4i_34,
1015
- ._item_dyt4i_8[data-kind]._disabled_dyt4i_118 > ._icon_dyt4i_50,
1016
- ._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 {
1017
1019
  color: var(--cpd-color-text-disabled);
1018
1020
  }
1019
1021
  /*
@@ -1778,7 +1780,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
1778
1780
  Please see LICENSE files in the repository root for full details.
1779
1781
  */
1780
1782
 
1781
- ._button_187yx_8 {
1783
+ ._button_13vu4_8 {
1782
1784
  border-radius: var(--cpd-radius-pill-effect);
1783
1785
  cursor: pointer;
1784
1786
  appearance: none;
@@ -1792,22 +1794,25 @@ Please see LICENSE files in the repository root for full details.
1792
1794
  transition-property: color, background-color, border-color;
1793
1795
  }
1794
1796
 
1795
- a._button_187yx_8 {
1797
+ a._button_13vu4_8 {
1796
1798
  /* Make the width match that of a real button */
1797
1799
  inline-size: max-content;
1800
+
1801
+ /* Buttons should not be underlined */
1802
+ text-decoration: none;
1798
1803
  }
1799
1804
 
1800
- ._button_187yx_8 > svg {
1805
+ ._button_13vu4_8 > svg {
1801
1806
  transition: color 0.1s;
1802
1807
  }
1803
1808
 
1804
- ._button_187yx_8[aria-disabled="true"] {
1809
+ ._button_13vu4_8[aria-disabled="true"] {
1805
1810
  cursor: not-allowed;
1806
1811
  pointer-events: all !important;
1807
1812
  color: var(--cpd-color-text-disabled) !important;
1808
1813
  }
1809
1814
 
1810
- ._button_187yx_8[aria-disabled="true"] > svg {
1815
+ ._button_13vu4_8[aria-disabled="true"] > svg {
1811
1816
  color: var(--cpd-color-icon-disabled) !important;
1812
1817
  }
1813
1818
 
@@ -1815,35 +1820,35 @@ a._button_187yx_8 {
1815
1820
  * SIZES
1816
1821
  */
1817
1822
 
1818
- ._button_187yx_8[data-size="lg"] {
1823
+ ._button_13vu4_8[data-size="lg"] {
1819
1824
  padding-block: var(--cpd-space-2x);
1820
1825
  padding-inline: var(--cpd-space-8x);
1821
1826
  min-block-size: var(--cpd-space-12x);
1822
1827
 
1823
- &._icon-only_187yx_50 {
1828
+ &._icon-only_13vu4_53 {
1824
1829
  padding-inline: var(--cpd-space-2x);
1825
1830
  block-size: var(--cpd-space-12x);
1826
1831
  inline-size: var(--cpd-space-12x);
1827
1832
  }
1828
1833
  }
1829
1834
 
1830
- ._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) {
1831
1836
  padding-inline-start: var(--cpd-space-7x);
1832
1837
  }
1833
1838
 
1834
- ._button_187yx_8[data-size="sm"] {
1839
+ ._button_13vu4_8[data-size="sm"] {
1835
1840
  padding-block: var(--cpd-space-1x);
1836
1841
  padding-inline: var(--cpd-space-5x);
1837
1842
  min-block-size: var(--cpd-space-9x);
1838
1843
 
1839
- &._icon-only_187yx_50 {
1844
+ &._icon-only_13vu4_53 {
1840
1845
  padding-inline: var(--cpd-space-1x);
1841
1846
  block-size: var(--cpd-space-9x);
1842
1847
  inline-size: var(--cpd-space-9x);
1843
1848
  }
1844
1849
  }
1845
1850
 
1846
- ._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) {
1847
1852
  padding-inline-start: var(--cpd-space-4x);
1848
1853
  }
1849
1854
 
@@ -1851,100 +1856,100 @@ a._button_187yx_8 {
1851
1856
  * KINDS
1852
1857
  */
1853
1858
 
1854
- ._button_187yx_8[data-kind="primary"] {
1859
+ ._button_13vu4_8[data-kind="primary"] {
1855
1860
  color: var(--cpd-color-text-on-solid-primary);
1856
1861
  background: var(--cpd-color-bg-action-primary-rest);
1857
1862
  border-width: 0;
1858
1863
  }
1859
1864
 
1860
- ._button_187yx_8[data-kind="primary"] > svg {
1865
+ ._button_13vu4_8[data-kind="primary"] > svg {
1861
1866
  color: var(--cpd-color-icon-on-solid-primary);
1862
1867
  }
1863
1868
 
1864
1869
  @media (hover) {
1865
- ._button_187yx_8[data-kind="primary"]:hover {
1870
+ ._button_13vu4_8[data-kind="primary"]:hover {
1866
1871
  background: var(--cpd-color-bg-action-primary-hovered);
1867
1872
  }
1868
1873
  }
1869
1874
 
1870
- ._button_187yx_8[data-kind="primary"]:active,
1871
- ._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"] {
1872
1877
  background: var(--cpd-color-bg-action-primary-pressed);
1873
1878
  }
1874
1879
 
1875
- ._button_187yx_8[data-kind="primary"][aria-disabled="true"] {
1880
+ ._button_13vu4_8[data-kind="primary"][aria-disabled="true"] {
1876
1881
  /* !important to override destructive background */
1877
1882
  background: var(--cpd-color-bg-subtle-primary) !important;
1878
1883
  }
1879
1884
 
1880
- ._button_187yx_8[data-kind="primary"]._destructive_187yx_107 {
1885
+ ._button_13vu4_8[data-kind="primary"]._destructive_13vu4_110 {
1881
1886
  background: var(--cpd-color-bg-critical-primary);
1882
1887
  }
1883
1888
 
1884
1889
  @media (hover) {
1885
- ._button_187yx_8[data-kind="primary"]._destructive_187yx_107:hover {
1890
+ ._button_13vu4_8[data-kind="primary"]._destructive_13vu4_110:hover {
1886
1891
  background: var(--cpd-color-bg-critical-hovered);
1887
1892
  }
1888
1893
  }
1889
1894
 
1890
- ._button_187yx_8[data-kind="primary"]._destructive_187yx_107:active,
1891
- ._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"] {
1892
1897
  /* TODO: We're waiting for this value to be formalized as a semantic token */
1893
1898
  background: var(--cpd-color-red-1100);
1894
1899
  }
1895
1900
 
1896
- ._button_187yx_8[data-kind="secondary"] {
1901
+ ._button_13vu4_8[data-kind="secondary"] {
1897
1902
  border: 1px solid var(--cpd-color-border-interactive-secondary);
1898
1903
  color: var(--cpd-color-text-primary);
1899
1904
  background: var(--cpd-color-bg-canvas-default);
1900
1905
  }
1901
1906
 
1902
- ._button_187yx_8[data-kind="secondary"] > svg {
1907
+ ._button_13vu4_8[data-kind="secondary"] > svg {
1903
1908
  color: var(--cpd-color-icon-primary);
1904
1909
  }
1905
1910
 
1906
1911
  @media (hover) {
1907
- ._button_187yx_8[data-kind="secondary"]:hover {
1912
+ ._button_13vu4_8[data-kind="secondary"]:hover {
1908
1913
  border-color: var(--cpd-color-border-interactive-hovered);
1909
1914
  background: var(--cpd-color-bg-subtle-secondary);
1910
1915
  }
1911
1916
  }
1912
1917
 
1913
- ._button_187yx_8[data-kind="secondary"]:active,
1914
- ._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"] {
1915
1920
  border-color: var(--cpd-color-border-interactive-hovered);
1916
1921
  background: var(--cpd-color-bg-subtle-primary);
1917
1922
  }
1918
1923
 
1919
- ._button_187yx_8[data-kind="secondary"][aria-disabled="true"] {
1924
+ ._button_13vu4_8[data-kind="secondary"][aria-disabled="true"] {
1920
1925
  /* !important to override destructive values */
1921
1926
  border-color: var(--cpd-color-border-interactive-secondary) !important;
1922
1927
  background: var(--cpd-color-bg-subtle-secondary) !important;
1923
1928
  }
1924
1929
 
1925
- ._button_187yx_8[data-kind="secondary"]._destructive_187yx_107 {
1930
+ ._button_13vu4_8[data-kind="secondary"]._destructive_13vu4_110 {
1926
1931
  border-color: var(--cpd-color-border-critical-subtle);
1927
1932
  color: var(--cpd-color-text-critical-primary);
1928
1933
  }
1929
1934
 
1930
- ._button_187yx_8[data-kind="secondary"]._destructive_187yx_107 > svg {
1935
+ ._button_13vu4_8[data-kind="secondary"]._destructive_13vu4_110 > svg {
1931
1936
  color: var(--cpd-color-icon-critical-primary);
1932
1937
  }
1933
1938
 
1934
1939
  @media (hover) {
1935
- ._button_187yx_8[data-kind="secondary"]._destructive_187yx_107:hover {
1940
+ ._button_13vu4_8[data-kind="secondary"]._destructive_13vu4_110:hover {
1936
1941
  border-color: var(--cpd-color-border-critical-hovered);
1937
1942
  background: var(--cpd-color-bg-critical-subtle);
1938
1943
  }
1939
1944
  }
1940
1945
 
1941
- ._button_187yx_8[data-kind="secondary"]._destructive_187yx_107:active,
1942
- ._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"] {
1943
1948
  border-color: var(--cpd-color-border-critical-hovered);
1944
1949
  background: var(--cpd-color-bg-critical-subtle-hovered);
1945
1950
  }
1946
1951
 
1947
- ._button_187yx_8[data-kind="tertiary"] {
1952
+ ._button_13vu4_8[data-kind="tertiary"] {
1948
1953
  border: none;
1949
1954
  color: var(--cpd-color-text-primary);
1950
1955
  text-decoration: underline;
@@ -1952,40 +1957,40 @@ a._button_187yx_8 {
1952
1957
  }
1953
1958
 
1954
1959
  @media (hover) {
1955
- ._button_187yx_8[data-kind="tertiary"]:hover {
1960
+ ._button_13vu4_8[data-kind="tertiary"]:hover {
1956
1961
  background: var(--cpd-color-bg-subtle-secondary);
1957
1962
  }
1958
1963
  }
1959
1964
 
1960
- ._button_187yx_8[data-kind="tertiary"]:active,
1961
- ._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"] {
1962
1967
  background: var(--cpd-color-bg-subtle-primary);
1963
1968
  }
1964
1969
 
1965
- ._button_187yx_8[data-kind="tertiary"][aria-disabled="true"] {
1970
+ ._button_13vu4_8[data-kind="tertiary"][aria-disabled="true"] {
1966
1971
  color: var(--cpd-color-text-disabled);
1967
1972
 
1968
1973
  /* !important to override destructive background */
1969
1974
  background: transparent !important;
1970
1975
  }
1971
1976
 
1972
- ._button_187yx_8[data-kind="tertiary"]._destructive_187yx_107 {
1977
+ ._button_13vu4_8[data-kind="tertiary"]._destructive_13vu4_110 {
1973
1978
  color: var(--cpd-color-text-critical-primary);
1974
1979
  }
1975
1980
 
1976
1981
  @media (hover) {
1977
- ._button_187yx_8[data-kind="tertiary"]._destructive_187yx_107:hover {
1982
+ ._button_13vu4_8[data-kind="tertiary"]._destructive_13vu4_110:hover {
1978
1983
  background: var(--cpd-color-bg-critical-subtle);
1979
1984
  }
1980
1985
  }
1981
1986
 
1982
- ._button_187yx_8[data-kind="tertiary"]._destructive_187yx_107:active,
1983
- ._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"] {
1984
1989
  background: var(--cpd-color-bg-critical-subtle-hovered);
1985
1990
  }
1986
1991
 
1987
1992
  @media (forced-colors: active) {
1988
- ._button_187yx_8[data-kind="primary"] {
1993
+ ._button_13vu4_8[data-kind="primary"] {
1989
1994
  outline: 1px solid transparent;
1990
1995
  }
1991
1996
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vector-im/compound-web",
3
- "version": "8.3.0",
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",
@@ -74,7 +74,7 @@
74
74
  "@typescript-eslint/parser": "^8.0.0",
75
75
  "@vector-im/compound-design-tokens": "^6.0.0",
76
76
  "@vitejs/plugin-react": "^5.0.0",
77
- "@vitest/coverage-v8": "^3.2.4",
77
+ "@vitest/coverage-v8": "^4.0.0",
78
78
  "browserslist-to-esbuild": "^2.0.0",
79
79
  "eslint": "^8.49.0",
80
80
  "eslint-config-prettier": "^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",
@@ -98,7 +98,7 @@
98
98
  "typescript": "^5.2.2",
99
99
  "vite": "^7.0.3",
100
100
  "vite-plugin-dts": "^4.5.4",
101
- "vitest": "^3.2.4"
101
+ "vitest": "^4.0.0"
102
102
  },
103
103
  "dependencies": {
104
104
  "@floating-ui/react": "^0.27.0",
@@ -51,6 +51,8 @@ button.avatar:disabled {
51
51
  overflow: hidden;
52
52
  }
53
53
 
54
+ /* Additional selector for button to raise selector above button.avatar */
55
+ button.avatar-imageless,
54
56
  .avatar-imageless {
55
57
  /* In the future we'd prefer to pass the HEX code as the data attr
56
58
  and use `attr(data-color)` to avoid the style declaration from below
@@ -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"