braid-design-system 32.0.0 → 32.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,7 @@ const styles_lib_css_negativeMargin_negativeMargin_css_cjs = require("./styles/l
18
18
  const styles_lib_components_Column_Column_css_cjs = require("./styles/lib/components/Column/Column.css.cjs");
19
19
  const styles_lib_components_ContentBlock_ContentBlock_css_cjs = require("./styles/lib/components/ContentBlock/ContentBlock.css.cjs");
20
20
  const styles_lib_components_private_Truncate_Truncate_css_cjs = require("./styles/lib/components/private/Truncate/Truncate.css.cjs");
21
+ const styles_lib_components_private_AvoidWidowIcon_AvoidWidowIcon_css_cjs = require("./styles/lib/components/private/AvoidWidowIcon/AvoidWidowIcon.css.cjs");
21
22
  const styles_lib_components_private_touchable_virtualTouchable_css_cjs = require("./styles/lib/components/private/touchable/virtualTouchable.css.cjs");
22
23
  const styles_lib_components_TextLink_TextLink_css_cjs = require("./styles/lib/components/TextLink/TextLink.css.cjs");
23
24
  const styles_lib_css_lineHeightContainer_css_cjs = require("./styles/lib/css/lineHeightContainer.css.cjs");
@@ -1222,6 +1223,26 @@ const FieldOverlay = ({ variant, ...restProps }) => /* @__PURE__ */ jsxRuntime.j
1222
1223
  ...restProps
1223
1224
  }
1224
1225
  );
1226
+ const AvoidWidowIcon = ({
1227
+ children,
1228
+ iconPosition,
1229
+ space = "xxsmall",
1230
+ className
1231
+ }) => /* @__PURE__ */ jsxRuntime.jsxs(
1232
+ Box,
1233
+ {
1234
+ component: "span",
1235
+ paddingRight: iconPosition === "leading" ? space : void 0,
1236
+ paddingLeft: iconPosition === "trailing" ? space : void 0,
1237
+ className: [styles_lib_components_private_AvoidWidowIcon_AvoidWidowIcon_css_cjs.nowrap, className],
1238
+ "aria-hidden": true,
1239
+ children: [
1240
+ iconPosition === "leading" ? children : void 0,
1241
+ "⁠",
1242
+ iconPosition === "trailing" ? children : void 0
1243
+ ]
1244
+ }
1245
+ );
1225
1246
  const validBleedComponents = ["div", "span"];
1226
1247
  const Bleed = ({
1227
1248
  space,
@@ -1456,6 +1477,7 @@ const ButtonText = ({
1456
1477
  loading,
1457
1478
  size: sizeProp,
1458
1479
  icon,
1480
+ iconPosition = "leading",
1459
1481
  variant = "solid",
1460
1482
  tone,
1461
1483
  labelSpacing = true,
@@ -1496,17 +1518,26 @@ const ButtonText = ({
1496
1518
  size,
1497
1519
  baseline: false,
1498
1520
  children: [
1499
- icon ? /* @__PURE__ */ jsxRuntime.jsx(
1500
- Box,
1521
+ icon && iconPosition === "leading" ? /* @__PURE__ */ jsxRuntime.jsx(
1522
+ AvoidWidowIcon,
1501
1523
  {
1502
- component: "span",
1503
- paddingRight: "xsmall",
1524
+ iconPosition,
1525
+ space: "xsmall",
1504
1526
  className: shouldReducePaddingX || bleed ? null : negativeMargin("left", "xxsmall"),
1505
1527
  children: icon
1506
1528
  }
1507
1529
  ) : null,
1508
1530
  children,
1509
- loading ? /* @__PURE__ */ jsxRuntime.jsx(ButtonLoader, {}) : null
1531
+ loading ? /* @__PURE__ */ jsxRuntime.jsx(ButtonLoader, {}) : null,
1532
+ !loading && icon && iconPosition === "trailing" ? /* @__PURE__ */ jsxRuntime.jsx(
1533
+ AvoidWidowIcon,
1534
+ {
1535
+ iconPosition,
1536
+ space: "xsmall",
1537
+ className: shouldReducePaddingX || bleed ? null : negativeMargin("right", "xxsmall"),
1538
+ children: icon
1539
+ }
1540
+ ) : null
1510
1541
  ]
1511
1542
  }
1512
1543
  )
@@ -1560,6 +1591,7 @@ const Button = React.forwardRef(
1560
1591
  size,
1561
1592
  tone,
1562
1593
  icon,
1594
+ iconPosition,
1563
1595
  bleedY,
1564
1596
  bleed,
1565
1597
  variant,
@@ -1626,6 +1658,7 @@ const Button = React.forwardRef(
1626
1658
  size,
1627
1659
  loading,
1628
1660
  icon,
1661
+ iconPosition,
1629
1662
  bleed,
1630
1663
  children
1631
1664
  }
@@ -1980,6 +2013,7 @@ const useLinkStyles = ({
1980
2013
  return clsx__default.default(
1981
2014
  styles_lib_components_TextLink_TextLink_css_cjs.base,
1982
2015
  linkStyles,
2016
+ styles_lib_css_typography_css_cjs.fontWeight.medium,
1983
2017
  showVisited ? [
1984
2018
  styles_lib_components_TextLink_TextLink_css_cjs.visitedLightMode[backgroundLightness.lightMode],
1985
2019
  styles_lib_components_TextLink_TextLink_css_cjs.visitedDarkMode[backgroundLightness.darkMode]
@@ -1993,25 +2027,40 @@ const useLinkStyles = ({
1993
2027
  hitArea === "large" && virtualTouchable()
1994
2028
  );
1995
2029
  };
2030
+ const TextLinkContent = ({
2031
+ icon,
2032
+ iconPosition = "leading",
2033
+ children
2034
+ }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2035
+ icon && iconPosition === "leading" ? /* @__PURE__ */ jsxRuntime.jsx(AvoidWidowIcon, { iconPosition, children: icon }) : null,
2036
+ children,
2037
+ icon && iconPosition === "trailing" ? /* @__PURE__ */ jsxRuntime.jsx(AvoidWidowIcon, { iconPosition, children: icon }) : null
2038
+ ] });
1996
2039
  const TextLink = React.forwardRef(
1997
- ({ weight, showVisited, hitArea, data, icon, children, ...restProps }, ref) => {
2040
+ ({
2041
+ weight,
2042
+ showVisited,
2043
+ hitArea,
2044
+ data,
2045
+ icon,
2046
+ children,
2047
+ iconPosition,
2048
+ ...restProps
2049
+ }, ref) => {
1998
2050
  const LinkComponent = sideEffects_lib_components_BraidProvider_BraidProvider_cjs.useLinkComponent(ref);
1999
2051
  const classes = useLinkStyles({
2000
2052
  weight,
2001
2053
  showVisited,
2002
2054
  hitArea
2003
2055
  });
2004
- return /* @__PURE__ */ jsxRuntime.jsxs(
2056
+ return /* @__PURE__ */ jsxRuntime.jsx(
2005
2057
  LinkComponent,
2006
2058
  {
2007
2059
  ref,
2008
2060
  ...restProps,
2009
2061
  className: classes,
2010
2062
  ...buildDataAttributes({ data, validateRestProps: false }),
2011
- children: [
2012
- icon ? /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", paddingRight: "xxsmall", children: icon }) : null,
2013
- children
2014
- ]
2063
+ children: /* @__PURE__ */ jsxRuntime.jsx(TextLinkContent, { icon, iconPosition, children })
2015
2064
  }
2016
2065
  );
2017
2066
  }
@@ -2031,6 +2080,7 @@ const TextLinkButton = ({
2031
2080
  "aria-describedby": ariaDescribedBy,
2032
2081
  tabIndex,
2033
2082
  icon,
2083
+ iconPosition,
2034
2084
  ...restProps
2035
2085
  }) => {
2036
2086
  const buttonRef = React.useRef(null);
@@ -2049,7 +2099,7 @@ const TextLinkButton = ({
2049
2099
  },
2050
2100
  [buttonRef]
2051
2101
  );
2052
- return /* @__PURE__ */ jsxRuntime.jsxs(
2102
+ return /* @__PURE__ */ jsxRuntime.jsx(
2053
2103
  Box,
2054
2104
  {
2055
2105
  ref: buttonRef,
@@ -2064,10 +2114,7 @@ const TextLinkButton = ({
2064
2114
  id,
2065
2115
  className: classes,
2066
2116
  ...buildDataAttributes({ data, validateRestProps: restProps }),
2067
- children: [
2068
- icon ? /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", paddingRight: "xxsmall", children: icon }) : null,
2069
- children
2070
- ]
2117
+ children: /* @__PURE__ */ jsxRuntime.jsx(TextLinkContent, { icon, iconPosition, children })
2071
2118
  }
2072
2119
  );
2073
2120
  };
@@ -2477,6 +2524,7 @@ const useToast = () => {
2477
2524
  );
2478
2525
  };
2479
2526
  exports.ActionsContext = ActionsContext;
2527
+ exports.AvoidWidowIcon = AvoidWidowIcon;
2480
2528
  exports.BackgroundProvider = BackgroundProvider;
2481
2529
  exports.Bleed = Bleed;
2482
2530
  exports.Box = Box;
@@ -17,6 +17,7 @@ import { p as preventCollapsePseudo, s as styles } from "./styles/lib/css/negati
17
17
  import { c as column, w as width, a as columnContent } from "./styles/lib/components/Column/Column.css.mjs";
18
18
  import { m as marginAuto } from "./styles/lib/components/ContentBlock/ContentBlock.css.mjs";
19
19
  import { t as truncate } from "./styles/lib/components/private/Truncate/Truncate.css.mjs";
20
+ import { n as nowrap } from "./styles/lib/components/private/AvoidWidowIcon/AvoidWidowIcon.css.mjs";
20
21
  import { v as virtualTouchable$1, y as yAxisOnly } from "./styles/lib/components/private/touchable/virtualTouchable.css.mjs";
21
22
  import { w as weakLink, r as regularLinkLightMode, a as regularLinkDarkMode, b as base$2, v as visitedLightMode, c as visitedDarkMode } from "./styles/lib/components/TextLink/TextLink.css.mjs";
22
23
  import { l as lineHeightContainer } from "./styles/lib/css/lineHeightContainer.css.mjs";
@@ -1215,6 +1216,26 @@ const FieldOverlay = ({ variant, ...restProps }) => /* @__PURE__ */ jsx(
1215
1216
  ...restProps
1216
1217
  }
1217
1218
  );
1219
+ const AvoidWidowIcon = ({
1220
+ children,
1221
+ iconPosition,
1222
+ space = "xxsmall",
1223
+ className
1224
+ }) => /* @__PURE__ */ jsxs(
1225
+ Box,
1226
+ {
1227
+ component: "span",
1228
+ paddingRight: iconPosition === "leading" ? space : void 0,
1229
+ paddingLeft: iconPosition === "trailing" ? space : void 0,
1230
+ className: [nowrap, className],
1231
+ "aria-hidden": true,
1232
+ children: [
1233
+ iconPosition === "leading" ? children : void 0,
1234
+ "⁠",
1235
+ iconPosition === "trailing" ? children : void 0
1236
+ ]
1237
+ }
1238
+ );
1218
1239
  const validBleedComponents = ["div", "span"];
1219
1240
  const Bleed = ({
1220
1241
  space,
@@ -1449,6 +1470,7 @@ const ButtonText = ({
1449
1470
  loading,
1450
1471
  size: sizeProp,
1451
1472
  icon,
1473
+ iconPosition = "leading",
1452
1474
  variant = "solid",
1453
1475
  tone: tone2,
1454
1476
  labelSpacing = true,
@@ -1489,17 +1511,26 @@ const ButtonText = ({
1489
1511
  size: size2,
1490
1512
  baseline: false,
1491
1513
  children: [
1492
- icon ? /* @__PURE__ */ jsx(
1493
- Box,
1514
+ icon && iconPosition === "leading" ? /* @__PURE__ */ jsx(
1515
+ AvoidWidowIcon,
1494
1516
  {
1495
- component: "span",
1496
- paddingRight: "xsmall",
1517
+ iconPosition,
1518
+ space: "xsmall",
1497
1519
  className: shouldReducePaddingX || bleed ? null : negativeMargin("left", "xxsmall"),
1498
1520
  children: icon
1499
1521
  }
1500
1522
  ) : null,
1501
1523
  children,
1502
- loading ? /* @__PURE__ */ jsx(ButtonLoader, {}) : null
1524
+ loading ? /* @__PURE__ */ jsx(ButtonLoader, {}) : null,
1525
+ !loading && icon && iconPosition === "trailing" ? /* @__PURE__ */ jsx(
1526
+ AvoidWidowIcon,
1527
+ {
1528
+ iconPosition,
1529
+ space: "xsmall",
1530
+ className: shouldReducePaddingX || bleed ? null : negativeMargin("right", "xxsmall"),
1531
+ children: icon
1532
+ }
1533
+ ) : null
1503
1534
  ]
1504
1535
  }
1505
1536
  )
@@ -1553,6 +1584,7 @@ const Button = forwardRef(
1553
1584
  size: size2,
1554
1585
  tone: tone2,
1555
1586
  icon,
1587
+ iconPosition,
1556
1588
  bleedY,
1557
1589
  bleed,
1558
1590
  variant,
@@ -1619,6 +1651,7 @@ const Button = forwardRef(
1619
1651
  size: size2,
1620
1652
  loading,
1621
1653
  icon,
1654
+ iconPosition,
1622
1655
  bleed,
1623
1656
  children
1624
1657
  }
@@ -1973,6 +2006,7 @@ const useLinkStyles = ({
1973
2006
  return clsx(
1974
2007
  base$2,
1975
2008
  linkStyles,
2009
+ fontWeight.medium,
1976
2010
  showVisited ? [
1977
2011
  visitedLightMode[backgroundLightness.lightMode],
1978
2012
  visitedDarkMode[backgroundLightness.darkMode]
@@ -1986,25 +2020,40 @@ const useLinkStyles = ({
1986
2020
  hitArea === "large" && virtualTouchable()
1987
2021
  );
1988
2022
  };
2023
+ const TextLinkContent = ({
2024
+ icon,
2025
+ iconPosition = "leading",
2026
+ children
2027
+ }) => /* @__PURE__ */ jsxs(Fragment, { children: [
2028
+ icon && iconPosition === "leading" ? /* @__PURE__ */ jsx(AvoidWidowIcon, { iconPosition, children: icon }) : null,
2029
+ children,
2030
+ icon && iconPosition === "trailing" ? /* @__PURE__ */ jsx(AvoidWidowIcon, { iconPosition, children: icon }) : null
2031
+ ] });
1989
2032
  const TextLink = forwardRef(
1990
- ({ weight, showVisited, hitArea, data, icon, children, ...restProps }, ref) => {
2033
+ ({
2034
+ weight,
2035
+ showVisited,
2036
+ hitArea,
2037
+ data,
2038
+ icon,
2039
+ children,
2040
+ iconPosition,
2041
+ ...restProps
2042
+ }, ref) => {
1991
2043
  const LinkComponent = useLinkComponent(ref);
1992
2044
  const classes = useLinkStyles({
1993
2045
  weight,
1994
2046
  showVisited,
1995
2047
  hitArea
1996
2048
  });
1997
- return /* @__PURE__ */ jsxs(
2049
+ return /* @__PURE__ */ jsx(
1998
2050
  LinkComponent,
1999
2051
  {
2000
2052
  ref,
2001
2053
  ...restProps,
2002
2054
  className: classes,
2003
2055
  ...buildDataAttributes({ data, validateRestProps: false }),
2004
- children: [
2005
- icon ? /* @__PURE__ */ jsx(Box, { component: "span", paddingRight: "xxsmall", children: icon }) : null,
2006
- children
2007
- ]
2056
+ children: /* @__PURE__ */ jsx(TextLinkContent, { icon, iconPosition, children })
2008
2057
  }
2009
2058
  );
2010
2059
  }
@@ -2024,6 +2073,7 @@ const TextLinkButton = ({
2024
2073
  "aria-describedby": ariaDescribedBy,
2025
2074
  tabIndex,
2026
2075
  icon,
2076
+ iconPosition,
2027
2077
  ...restProps
2028
2078
  }) => {
2029
2079
  const buttonRef = useRef(null);
@@ -2042,7 +2092,7 @@ const TextLinkButton = ({
2042
2092
  },
2043
2093
  [buttonRef]
2044
2094
  );
2045
- return /* @__PURE__ */ jsxs(
2095
+ return /* @__PURE__ */ jsx(
2046
2096
  Box,
2047
2097
  {
2048
2098
  ref: buttonRef,
@@ -2057,10 +2107,7 @@ const TextLinkButton = ({
2057
2107
  id,
2058
2108
  className: classes,
2059
2109
  ...buildDataAttributes({ data, validateRestProps: restProps }),
2060
- children: [
2061
- icon ? /* @__PURE__ */ jsx(Box, { component: "span", paddingRight: "xxsmall", children: icon }) : null,
2062
- children
2063
- ]
2110
+ children: /* @__PURE__ */ jsx(TextLinkContent, { icon, iconPosition, children })
2064
2111
  }
2065
2112
  );
2066
2113
  };
@@ -2470,7 +2517,7 @@ const useToast = () => {
2470
2517
  );
2471
2518
  };
2472
2519
  export {
2473
- useBackgroundLightness as $,
2520
+ resolveResponsiveProp as $,
2474
2521
  ActionsContext as A,
2475
2522
  BraidPortal as B,
2476
2523
  Column as C,
@@ -2492,19 +2539,20 @@ export {
2492
2539
  Stack as S,
2493
2540
  Text as T,
2494
2541
  Typography as U,
2495
- useDefaultTextProps as V,
2496
- flattenChildren as W,
2497
- DefaultTextPropsProvider as X,
2498
- iconSize as Y,
2499
- negativeMargin as Z,
2500
- resolveResponsiveProp as _,
2542
+ AvoidWidowIcon as V,
2543
+ useDefaultTextProps as W,
2544
+ flattenChildren as X,
2545
+ DefaultTextPropsProvider as Y,
2546
+ iconSize as Z,
2547
+ negativeMargin as _,
2501
2548
  useSpace as a,
2502
- validBleedComponents as a0,
2503
- buttonVariants as a1,
2504
- buttonIconVariants as a2,
2505
- validColumnsComponents as a3,
2506
- validInlineComponents as a4,
2507
- validStackComponents as a5,
2549
+ useBackgroundLightness as a0,
2550
+ validBleedComponents as a1,
2551
+ buttonVariants as a2,
2552
+ buttonIconVariants as a3,
2553
+ validColumnsComponents as a4,
2554
+ validInlineComponents as a5,
2555
+ validStackComponents as a6,
2508
2556
  useResponsiveValue as b,
2509
2557
  Bleed as c,
2510
2558
  Button as d,
@@ -2435,7 +2435,7 @@ const FieldLabel = ({
2435
2435
  descriptionId,
2436
2436
  data
2437
2437
  }) => {
2438
- if (!label) {
2438
+ if (!label && !description) {
2439
2439
  return null;
2440
2440
  }
2441
2441
  const labelEl = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Text, { tone: disabled ? "secondary" : void 0, children: [
@@ -2447,14 +2447,14 @@ const FieldLabel = ({
2447
2447
  ] }) : null
2448
2448
  ] });
2449
2449
  return /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Stack, { space: "xsmall", data, children: [
2450
- /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Box, { component: "span", display: "flex", justifyContent: "spaceBetween", children: [
2450
+ label ? /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Box, { component: "span", display: "flex", justifyContent: "spaceBetween", children: [
2451
2451
  htmlFor === false ? labelEl : /* @__PURE__ */ jsxRuntime.jsx("label", { id, htmlFor, children: labelEl }),
2452
2452
  tertiaryLabel ? /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Text, { children: [
2453
2453
  " ",
2454
2454
  tertiaryLabel
2455
2455
  ] }) : null
2456
- ] }),
2457
- description ? /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Box, { paddingY: "xxsmall", children: /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Text, { tone: "secondary", id: descriptionId, children: description }) }) : null
2456
+ ] }) : null,
2457
+ description ? /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Box, { paddingTop: label ? "xxsmall" : void 0, paddingBottom: "xxsmall", children: /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Text, { tone: "secondary", id: descriptionId, children: description }) }) : null
2458
2458
  ] });
2459
2459
  };
2460
2460
  const tones$1 = ["neutral", "critical", "positive"];
@@ -2516,6 +2516,7 @@ const Field = ({
2516
2516
  disabled,
2517
2517
  autoComplete,
2518
2518
  children,
2519
+ description,
2519
2520
  message,
2520
2521
  secondaryMessage,
2521
2522
  reserveMessageSpace = false,
@@ -2535,10 +2536,10 @@ const Field = ({
2535
2536
  "Prefix must be a string"
2536
2537
  );
2537
2538
  const messageId = `${id}-message`;
2538
- const descriptionId = "description" in restProps && restProps.description ? `${id}-description` : void 0;
2539
+ const descriptionId = description ? `${id}-description` : void 0;
2539
2540
  const fieldBackground = disabled ? { lightMode: "neutralSoft", darkMode: "neutral" } : { lightMode: "surface" };
2540
2541
  const hasValue = typeof value === "string" ? value.length > 0 : value != null;
2541
- const hasVisualLabel = "label" in restProps;
2542
+ const hasVisualLabelOrDescription = "label" in restProps || description;
2542
2543
  const showSecondaryIcon = alwaysShowSecondaryIcon || secondaryIcon && hasValue;
2543
2544
  const overlays = /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
2544
2545
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2560,7 +2561,7 @@ const Field = ({
2560
2561
  ] });
2561
2562
  const fieldPadding = "small";
2562
2563
  return /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Stack, { space: "xsmall", children: [
2563
- hasVisualLabel ? /* @__PURE__ */ jsxRuntime.jsx(
2564
+ hasVisualLabelOrDescription ? /* @__PURE__ */ jsxRuntime.jsx(
2564
2565
  FieldLabel,
2565
2566
  {
2566
2567
  id: labelId,
@@ -2569,7 +2570,7 @@ const Field = ({
2569
2570
  disabled,
2570
2571
  secondaryLabel: "secondaryLabel" in restProps ? restProps.secondaryLabel : void 0,
2571
2572
  tertiaryLabel: "tertiaryLabel" in restProps ? restProps.tertiaryLabel : void 0,
2572
- description: "description" in restProps ? restProps.description : void 0,
2573
+ description,
2573
2574
  descriptionId
2574
2575
  }
2575
2576
  ) : null,
@@ -3703,6 +3704,7 @@ const ButtonLink = React.forwardRef(
3703
3704
  bleedY,
3704
3705
  bleed,
3705
3706
  icon: icon2,
3707
+ iconPosition,
3706
3708
  loading,
3707
3709
  data,
3708
3710
  ...restProps
@@ -3748,6 +3750,7 @@ const ButtonLink = React.forwardRef(
3748
3750
  size,
3749
3751
  loading,
3750
3752
  icon: icon2,
3753
+ iconPosition,
3751
3754
  bleed,
3752
3755
  children
3753
3756
  }
@@ -4610,6 +4613,7 @@ const Disclosure = ({
4610
4613
  space = "medium",
4611
4614
  children,
4612
4615
  data,
4616
+ weight,
4613
4617
  ...restProps
4614
4618
  }) => {
4615
4619
  assert__default.default(
@@ -4620,6 +4624,9 @@ const Disclosure = ({
4620
4624
  typeof collapseLabel === "undefined" || typeof collapseLabel === "string",
4621
4625
  "'collapseLabel' must be a string"
4622
4626
  );
4627
+ const textContext = React.useContext(ToastContext.TextContext);
4628
+ const headingContext = React.useContext(ToastContext.HeadingContext);
4629
+ const isInline = Boolean(textContext || headingContext);
4623
4630
  const { expanded, buttonProps, contentProps } = useDisclosure({
4624
4631
  id,
4625
4632
  ...restProps.expanded !== void 0 ? {
@@ -4629,27 +4636,43 @@ const Disclosure = ({
4629
4636
  onToggle: restProps.onToggle
4630
4637
  }
4631
4638
  });
4632
- return /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Box, { ...ToastContext.buildDataAttributes({ data, validateRestProps: restProps }), children: [
4633
- /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Box, { userSelect: "none", children: /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Text, { children: /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.TextLinkButton, { hitArea: "large", ...buttonProps, children: [
4634
- expanded ? collapseLabel : expandLabel,
4635
- /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Box, { component: "span", paddingLeft: "xxsmall", children: /* @__PURE__ */ jsxRuntime.jsx(
4636
- IconChevron,
4637
- {
4638
- direction: expanded ? "up" : "down",
4639
- alignY: "lowercase"
4640
- }
4641
- ) })
4642
- ] }) }) }),
4643
- /* @__PURE__ */ jsxRuntime.jsx(
4644
- ToastContext.Box,
4645
- {
4646
- paddingTop: space,
4647
- display: expanded ? "block" : "none",
4648
- ...contentProps,
4649
- children
4650
- }
4651
- )
4639
+ const trigger = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.TextLinkButton, { hitArea: "large", weight, ...buttonProps, children: [
4640
+ expanded ? collapseLabel : expandLabel,
4641
+ /* @__PURE__ */ jsxRuntime.jsx(ToastContext.AvoidWidowIcon, { iconPosition: "trailing", children: /* @__PURE__ */ jsxRuntime.jsx(IconChevron, { direction: expanded ? "up" : "down", alignY: "lowercase" }) })
4652
4642
  ] });
4643
+ const component = isInline ? "span" : "div";
4644
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4645
+ ToastContext.Box,
4646
+ {
4647
+ component,
4648
+ display: isInline ? "inline" : void 0,
4649
+ ...ToastContext.buildDataAttributes({ data, validateRestProps: restProps }),
4650
+ children: [
4651
+ /* @__PURE__ */ jsxRuntime.jsx(
4652
+ ToastContext.Box,
4653
+ {
4654
+ component,
4655
+ display: isInline ? "inline" : void 0,
4656
+ userSelect: "none",
4657
+ children: isInline ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4658
+ " ",
4659
+ trigger
4660
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Text, { children: trigger })
4661
+ }
4662
+ ),
4663
+ /* @__PURE__ */ jsxRuntime.jsx(
4664
+ ToastContext.Box,
4665
+ {
4666
+ component,
4667
+ paddingTop: space,
4668
+ display: expanded ? "block" : "none",
4669
+ ...contentProps,
4670
+ children
4671
+ }
4672
+ )
4673
+ ]
4674
+ }
4675
+ );
4653
4676
  };
4654
4677
  const validWidths = ["small", "medium", "large"];
4655
4678
  const validPositions = ["left", "right"];
@@ -5589,11 +5612,11 @@ const FieldGroup = ({
5589
5612
  "aria-required": required,
5590
5613
  ...ToastContext.buildDataAttributes({ data, validateRestProps: restProps }),
5591
5614
  children: /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Stack, { space, children: [
5592
- "label" in restProps && restProps.label ? /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Box, { component: "legend", id: labelId, children: /* @__PURE__ */ jsxRuntime.jsx(
5615
+ "label" in restProps && restProps.label || description ? /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Box, { component: "legend", id: labelId, children: /* @__PURE__ */ jsxRuntime.jsx(
5593
5616
  FieldLabel,
5594
5617
  {
5595
5618
  htmlFor: false,
5596
- label: restProps.label,
5619
+ label: "label" in restProps ? restProps.label : void 0,
5597
5620
  secondaryLabel,
5598
5621
  tertiaryLabel,
5599
5622
  disabled,