braid-design-system 32.3.1 → 32.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # braid-design-system
2
2
 
3
+ ## 32.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - **Text, Heading:** Add `maxLines` support ([#1286](https://github.com/seek-oss/braid-design-system/pull/1286))
8
+
9
+ Provide support for limiting the number of lines shown by a `Text` or `Heading` component.
10
+
11
+ **EXAMPLE USAGE:**
12
+
13
+ ```jsx
14
+ <Text maxLines={3}>...</Text>
15
+ ```
16
+
17
+ **MIGRATION:**
18
+
19
+ With the addition of this feature, the `truncate` prop is now deprecated and will be removed in a future release.
20
+ Existing consumers should start migrating as below:
21
+
22
+ ```diff
23
+ <Text
24
+ - truncate
25
+ + maxLines={1}
26
+ />
27
+ ```
28
+
29
+ - **Card:** Add full height support ([#1285](https://github.com/seek-oss/braid-design-system/pull/1285))
30
+
31
+ Provide support for making a `Card` use all available vertical space.
32
+ This is useful when laying out rows of `Card` elements and having them all be equal height.
33
+
34
+ **EXAMPLE USAGE:**
35
+
36
+ ```jsx
37
+ <Card height="full">...</Card>
38
+ ```
39
+
40
+ ### Patch Changes
41
+
42
+ - **TextLink, TextLinkButton:** Update underline design ([#1288](https://github.com/seek-oss/braid-design-system/pull/1288))
43
+
44
+ Uplift the design of the the text underline used on `TextLink` and `TextLinkButton` components.
45
+
46
+ - **Column:** Support full height content ([#1285](https://github.com/seek-oss/braid-design-system/pull/1285))
47
+
48
+ Provide support for full height content by growing all `Column` elements to be uniform in height.
49
+
50
+ This will have no effect on the content itself, but enables consumers to create designs of uniform content, such as rows of `Card` elements.
51
+
3
52
  ## 32.3.1
4
53
 
5
54
  ### Patch Changes
@@ -17,7 +17,8 @@ const styles_lib_components_Hidden_Hidden_css_cjs = require("./styles/lib/compon
17
17
  const styles_lib_css_negativeMargin_negativeMargin_css_cjs = require("./styles/lib/css/negativeMargin/negativeMargin.css.cjs");
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
- const styles_lib_components_private_Truncate_Truncate_css_cjs = require("./styles/lib/components/private/Truncate/Truncate.css.cjs");
20
+ const dynamic = require("@vanilla-extract/dynamic");
21
+ const styles_lib_components_private_MaxLines_MaxLines_css_cjs = require("./styles/lib/components/private/MaxLines/MaxLines.css.cjs");
21
22
  const styles_lib_components_private_AvoidWidowIcon_AvoidWidowIcon_css_cjs = require("./styles/lib/components/private/AvoidWidowIcon/AvoidWidowIcon.css.cjs");
22
23
  const styles_lib_components_private_touchable_virtualTouchable_css_cjs = require("./styles/lib/components/private/touchable/virtualTouchable.css.cjs");
23
24
  const styles_lib_components_TextLink_TextLink_css_cjs = require("./styles/lib/components/TextLink/TextLink.css.cjs");
@@ -647,19 +648,48 @@ function textStyles({
647
648
  (baseline ? styles_lib_css_typography_css_cjs.textSizeTrimmed : styles_lib_css_typography_css_cjs.textSizeUntrimmed)[size]
648
649
  ];
649
650
  }
650
- const Truncate = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", className: styles_lib_components_private_Truncate_Truncate_css_cjs.truncate, children });
651
+ const MaxLines = ({
652
+ children,
653
+ lines
654
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
655
+ Box,
656
+ {
657
+ component: "span",
658
+ className: [styles_lib_components_private_MaxLines_MaxLines_css_cjs.base, lines > 1 ? styles_lib_components_private_MaxLines_MaxLines_css_cjs.multiLine : void 0],
659
+ style: lines > 1 ? dynamic.assignInlineVars({ [styles_lib_components_private_MaxLines_MaxLines_css_cjs.lineLimit]: String(lines) }) : void 0,
660
+ children
661
+ }
662
+ );
651
663
  const Typography = ({
652
664
  id,
653
665
  component = "span",
654
666
  className,
655
667
  align,
656
668
  truncate = false,
669
+ maxLines,
657
670
  icon,
658
671
  data,
659
672
  children,
660
673
  ...restProps
661
674
  }) => {
662
- const contents = truncate ? /* @__PURE__ */ jsxRuntime.jsx(Truncate, { children }) : children;
675
+ const lines = truncate ? 1 : maxLines;
676
+ const contents = typeof lines === "number" ? /* @__PURE__ */ jsxRuntime.jsx(MaxLines, { lines, children }) : children;
677
+ if (process.env.NODE_ENV !== "production") {
678
+ if (typeof truncate !== "undefined") {
679
+ console.warn(
680
+ dedent__default.default`
681
+ The "truncate" prop has been deprecated and will be removed in a future version. Use "maxLines" instead.
682
+ <Text
683
+ %c- truncate
684
+ %c+ maxLines={1}
685
+ %c/>
686
+ `,
687
+ "color: red",
688
+ "color: green",
689
+ "color: inherit"
690
+ );
691
+ }
692
+ }
663
693
  return /* @__PURE__ */ jsxRuntime.jsx(
664
694
  Box,
665
695
  {
@@ -910,6 +940,7 @@ const Column = ({
910
940
  minWidth: 0,
911
941
  width: width !== "content" ? "full" : void 0,
912
942
  flexShrink: width === "content" ? 0 : void 0,
943
+ flexGrow: 1,
913
944
  className: [
914
945
  styles_lib_components_Column_Column_css_cjs.column,
915
946
  width !== "content" ? styles_lib_components_Column_Column_css_cjs.width[width] : null
@@ -16,10 +16,11 @@ import { hiddenOnPrint } from "./styles/lib/components/Hidden/Hidden.css.mjs";
16
16
  import { preventCollapsePseudo, top, right, bottom, left } from "./styles/lib/css/negativeMargin/negativeMargin.css.mjs";
17
17
  import { column, width, columnContent } from "./styles/lib/components/Column/Column.css.mjs";
18
18
  import { marginAuto } from "./styles/lib/components/ContentBlock/ContentBlock.css.mjs";
19
- import { truncate } from "./styles/lib/components/private/Truncate/Truncate.css.mjs";
19
+ import { assignInlineVars } from "@vanilla-extract/dynamic";
20
+ import { base as base$2, multiLine, lineLimit } from "./styles/lib/components/private/MaxLines/MaxLines.css.mjs";
20
21
  import { nowrap } from "./styles/lib/components/private/AvoidWidowIcon/AvoidWidowIcon.css.mjs";
21
22
  import { virtualTouchable as virtualTouchable$1, yAxisOnly } from "./styles/lib/components/private/touchable/virtualTouchable.css.mjs";
22
- import { weakLink, regularLinkLightMode, regularLinkDarkMode, base as base$2, visitedLightMode, visitedDarkMode } from "./styles/lib/components/TextLink/TextLink.css.mjs";
23
+ import { weakLink, regularLinkLightMode, regularLinkDarkMode, base as base$3, visitedLightMode, visitedDarkMode } from "./styles/lib/components/TextLink/TextLink.css.mjs";
23
24
  import { lineHeightContainer } from "./styles/lib/css/lineHeightContainer.css.mjs";
24
25
  import { size, inlineCrop, inline, alignY, cropToTextSize, blockWidths } from "./styles/lib/hooks/useIcon/icon.css.mjs";
25
26
  import { hideFocusRingsClassName } from "./styles/lib/components/private/hideFocusRings/hideFocusRings.css.mjs";
@@ -640,19 +641,48 @@ function textStyles({
640
641
  (baseline ? textSizeTrimmed : textSizeUntrimmed)[size2]
641
642
  ];
642
643
  }
643
- const Truncate = ({ children }) => /* @__PURE__ */ jsx(Box, { component: "span", className: truncate, children });
644
+ const MaxLines = ({
645
+ children,
646
+ lines
647
+ }) => /* @__PURE__ */ jsx(
648
+ Box,
649
+ {
650
+ component: "span",
651
+ className: [base$2, lines > 1 ? multiLine : void 0],
652
+ style: lines > 1 ? assignInlineVars({ [lineLimit]: String(lines) }) : void 0,
653
+ children
654
+ }
655
+ );
644
656
  const Typography = ({
645
657
  id,
646
658
  component = "span",
647
659
  className,
648
660
  align,
649
- truncate: truncate2 = false,
661
+ truncate = false,
662
+ maxLines,
650
663
  icon,
651
664
  data,
652
665
  children,
653
666
  ...restProps
654
667
  }) => {
655
- const contents = truncate2 ? /* @__PURE__ */ jsx(Truncate, { children }) : children;
668
+ const lines = truncate ? 1 : maxLines;
669
+ const contents = typeof lines === "number" ? /* @__PURE__ */ jsx(MaxLines, { lines, children }) : children;
670
+ if (process.env.NODE_ENV !== "production") {
671
+ if (typeof truncate !== "undefined") {
672
+ console.warn(
673
+ dedent`
674
+ The "truncate" prop has been deprecated and will be removed in a future version. Use "maxLines" instead.
675
+ <Text
676
+ %c- truncate
677
+ %c+ maxLines={1}
678
+ %c/>
679
+ `,
680
+ "color: red",
681
+ "color: green",
682
+ "color: inherit"
683
+ );
684
+ }
685
+ }
656
686
  return /* @__PURE__ */ jsx(
657
687
  Box,
658
688
  {
@@ -903,6 +933,7 @@ const Column = ({
903
933
  minWidth: 0,
904
934
  width: width$1 !== "content" ? "full" : void 0,
905
935
  flexShrink: width$1 === "content" ? 0 : void 0,
936
+ flexGrow: 1,
906
937
  className: [
907
938
  column,
908
939
  width$1 !== "content" ? width[width$1] : null
@@ -1975,7 +2006,7 @@ const useLinkStyles = ({
1975
2006
  isPlainBackground(backgroundContext2.darkMode, "dark") || weight === "regular" ? regularLinkDarkMode[backgroundLightness.darkMode] : weakLink
1976
2007
  ];
1977
2008
  return clsx(
1978
- base$2,
2009
+ base$3,
1979
2010
  linkStyles,
1980
2011
  fontWeight.medium,
1981
2012
  showVisited ? [
@@ -3644,7 +3644,7 @@ const Badge = React.forwardRef(
3644
3644
  paddingX: "xsmall",
3645
3645
  borderRadius: "standard",
3646
3646
  overflow: "hidden",
3647
- children: /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Text, { size: "xsmall", weight: "medium", truncate: true, children })
3647
+ children: /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Text, { size: "xsmall", weight: "medium", maxLines: 1, children })
3648
3648
  }
3649
3649
  )
3650
3650
  }
@@ -3796,6 +3796,7 @@ const Card = ({
3796
3796
  component = "div",
3797
3797
  tone,
3798
3798
  data,
3799
+ height,
3799
3800
  ...restProps
3800
3801
  }) => {
3801
3802
  assert__default.default(
@@ -3822,6 +3823,7 @@ const Card = ({
3822
3823
  background: "surface",
3823
3824
  padding: "gutter",
3824
3825
  borderRadius: resolvedRounding,
3826
+ height: height === "full" ? height : void 0,
3825
3827
  ...ToastContext.buildDataAttributes({ data, validateRestProps: restProps }),
3826
3828
  children: [
3827
3829
  tone ? /* @__PURE__ */ jsxRuntime.jsx(Keyline, { tone, borderRadius: resolvedRounding }) : null,
@@ -5439,7 +5441,7 @@ function MenuItemChildren({
5439
5441
  size: menuItemChildrenSize,
5440
5442
  baseline: false,
5441
5443
  tone: tone === "critical" ? tone : void 0,
5442
- truncate: true,
5444
+ maxLines: 1,
5443
5445
  children
5444
5446
  }
5445
5447
  ) }),
@@ -7530,7 +7532,7 @@ const Tag = ({
7530
7532
  paddingRight: onClear ? void 0 : "small",
7531
7533
  borderRadius: "full",
7532
7534
  children: [
7533
- /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Box, { minWidth: 0, title: children, children: /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Text, { baseline: false, truncate: true, icon: icon2, children }) }),
7535
+ /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Box, { minWidth: 0, title: children, children: /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Text, { baseline: false, maxLines: 1, icon: icon2, children }) }),
7534
7536
  onClear ? /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Box, { flexShrink: 0, display: "flex", className: styles_lib_components_Tag_Tag_css_cjs.clearGutter, children: /* @__PURE__ */ jsxRuntime.jsx(
7535
7537
  ToastContext.ButtonIcon,
7536
7538
  {
@@ -3636,7 +3636,7 @@ const Badge = forwardRef(
3636
3636
  paddingX: "xsmall",
3637
3637
  borderRadius: "standard",
3638
3638
  overflow: "hidden",
3639
- children: /* @__PURE__ */ jsx(Text, { size: "xsmall", weight: "medium", truncate: true, children: children2 })
3639
+ children: /* @__PURE__ */ jsx(Text, { size: "xsmall", weight: "medium", maxLines: 1, children: children2 })
3640
3640
  }
3641
3641
  )
3642
3642
  }
@@ -3788,6 +3788,7 @@ const Card = ({
3788
3788
  component = "div",
3789
3789
  tone: tone2,
3790
3790
  data,
3791
+ height,
3791
3792
  ...restProps
3792
3793
  }) => {
3793
3794
  assert(
@@ -3814,6 +3815,7 @@ const Card = ({
3814
3815
  background: "surface",
3815
3816
  padding: "gutter",
3816
3817
  borderRadius: resolvedRounding,
3818
+ height: height === "full" ? height : void 0,
3817
3819
  ...buildDataAttributes({ data, validateRestProps: restProps }),
3818
3820
  children: [
3819
3821
  tone2 ? /* @__PURE__ */ jsx(Keyline, { tone: tone2, borderRadius: resolvedRounding }) : null,
@@ -5431,7 +5433,7 @@ function MenuItemChildren({
5431
5433
  size: menuItemChildrenSize,
5432
5434
  baseline: false,
5433
5435
  tone: tone2 === "critical" ? tone2 : void 0,
5434
- truncate: true,
5436
+ maxLines: 1,
5435
5437
  children: children2
5436
5438
  }
5437
5439
  ) }),
@@ -7522,7 +7524,7 @@ const Tag = ({
7522
7524
  paddingRight: onClear ? void 0 : "small",
7523
7525
  borderRadius: "full",
7524
7526
  children: [
7525
- /* @__PURE__ */ jsx(Box, { minWidth: 0, title: children2, children: /* @__PURE__ */ jsx(Text, { baseline: false, truncate: true, icon: icon2, children: children2 }) }),
7527
+ /* @__PURE__ */ jsx(Box, { minWidth: 0, title: children2, children: /* @__PURE__ */ jsx(Text, { baseline: false, maxLines: 1, icon: icon2, children: children2 }) }),
7526
7528
  onClear ? /* @__PURE__ */ jsx(Box, { flexShrink: 0, display: "flex", className: clearGutter, children: /* @__PURE__ */ jsx(
7527
7529
  ButtonIcon,
7528
7530
  {
package/dist/reset.d.ts CHANGED
@@ -2724,7 +2724,9 @@ interface TypographyProps extends Pick<BoxProps, 'id' | 'component'> {
2724
2724
  children?: ReactNode;
2725
2725
  icon?: ReactElement<UseIconProps>;
2726
2726
  align?: BoxProps['textAlign'];
2727
+ /** @deprecated Use `maxLines={1}` instead. */
2727
2728
  truncate?: boolean;
2729
+ maxLines?: number;
2728
2730
  data?: DataAttributeMap;
2729
2731
  }
2730
2732
 
@@ -3061,9 +3063,10 @@ type CardProps = {
3061
3063
  children: ReactNode;
3062
3064
  tone?: 'promote' | 'formAccent';
3063
3065
  component?: (typeof validCardComponents)[number];
3066
+ height?: Extract<BoxProps['height'], 'full'> | 'content';
3064
3067
  data?: DataAttributeMap;
3065
3068
  } & (SimpleCardRounding | ResponsiveCardRounding);
3066
- declare const Card$1: ({ children, component, tone, data, ...restProps }: CardProps) => JSX.Element;
3069
+ declare const Card$1: ({ children, component, tone, data, height, ...restProps }: CardProps) => JSX.Element;
3067
3070
 
3068
3071
  declare const sizes$1: {
3069
3072
  readonly standard: "standard";
@@ -31,9 +31,21 @@ const weakLinkVars = css.assignVars(textLinkVars, {
31
31
  const base = css.style({
32
32
  color: textLinkVars.color,
33
33
  textDecoration: textLinkVars.textDecoration,
34
+ textDecorationThickness: "0.1em",
35
+ textUnderlineOffset: "0.32em",
34
36
  ":hover": {
35
37
  color: textLinkVars.colorHover,
36
- textDecoration: textLinkVars.textDecorationHover
38
+ textDecoration: textLinkVars.textDecorationHover,
39
+ /*
40
+ Duplicating the thickness rule due to inconsistent support
41
+ for shorthand properties of `text-decoration`. Without this,
42
+ applying the above decoration rule resets the thickness in
43
+ browsers that do support shorthands.
44
+
45
+ We also cannot use the long-form `text-decoration-line` due
46
+ to browser support policy of Edge 16+.
47
+ */
48
+ textDecorationThickness: "0.1em"
37
49
  },
38
50
  ":focus": {
39
51
  color: textLinkVars.colorHover
@@ -30,9 +30,21 @@ const weakLinkVars = assignVars(textLinkVars, {
30
30
  const base = style({
31
31
  color: textLinkVars.color,
32
32
  textDecoration: textLinkVars.textDecoration,
33
+ textDecorationThickness: "0.1em",
34
+ textUnderlineOffset: "0.32em",
33
35
  ":hover": {
34
36
  color: textLinkVars.colorHover,
35
- textDecoration: textLinkVars.textDecorationHover
37
+ textDecoration: textLinkVars.textDecorationHover,
38
+ /*
39
+ Duplicating the thickness rule due to inconsistent support
40
+ for shorthand properties of `text-decoration`. Without this,
41
+ applying the above decoration rule resets the thickness in
42
+ browsers that do support shorthands.
43
+
44
+ We also cannot use the long-form `text-decoration-line` due
45
+ to browser support policy of Edge 16+.
46
+ */
47
+ textDecorationThickness: "0.1em"
36
48
  },
37
49
  ":focus": {
38
50
  color: textLinkVars.colorHover
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ const fileScope = require("@vanilla-extract/css/fileScope");
3
+ const css = require("@vanilla-extract/css");
4
+ const styles_entries_css_cjs = require("../../../../../css.cjs");
5
+ fileScope.setFileScope("src/lib/components/private/MaxLines/MaxLines.css.ts?used", "braid-design-system");
6
+ const base = css.style([styles_entries_css_cjs.atoms({
7
+ display: "block",
8
+ overflow: "hidden",
9
+ minWidth: 0
10
+ }), {
11
+ textOverflow: "ellipsis",
12
+ whiteSpace: "nowrap"
13
+ }], "base");
14
+ const lineLimit = css.createVar("lineLimit");
15
+ const lineClampSupportsQuery = "(display: -webkit-box) and (-webkit-line-clamp: 1)";
16
+ const multiLine = css.style({
17
+ // Can drop supports query when Edge 16 is removed from browser support policy
18
+ "@supports": {
19
+ [lineClampSupportsQuery]: {
20
+ whiteSpace: "initial",
21
+ display: "-webkit-box",
22
+ WebkitLineClamp: lineLimit,
23
+ WebkitBoxOrient: "vertical"
24
+ }
25
+ }
26
+ }, "multiLine");
27
+ fileScope.endFileScope();
28
+ exports.base = base;
29
+ exports.lineLimit = lineLimit;
30
+ exports.multiLine = multiLine;
@@ -0,0 +1,31 @@
1
+ import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
+ import { style, createVar } from "@vanilla-extract/css";
3
+ import { atoms } from "../../../../../css.mjs";
4
+ setFileScope("src/lib/components/private/MaxLines/MaxLines.css.ts?used", "braid-design-system");
5
+ const base = style([atoms({
6
+ display: "block",
7
+ overflow: "hidden",
8
+ minWidth: 0
9
+ }), {
10
+ textOverflow: "ellipsis",
11
+ whiteSpace: "nowrap"
12
+ }], "base");
13
+ const lineLimit = createVar("lineLimit");
14
+ const lineClampSupportsQuery = "(display: -webkit-box) and (-webkit-line-clamp: 1)";
15
+ const multiLine = style({
16
+ // Can drop supports query when Edge 16 is removed from browser support policy
17
+ "@supports": {
18
+ [lineClampSupportsQuery]: {
19
+ whiteSpace: "initial",
20
+ display: "-webkit-box",
21
+ WebkitLineClamp: lineLimit,
22
+ WebkitBoxOrient: "vertical"
23
+ }
24
+ }
25
+ }, "multiLine");
26
+ endFileScope();
27
+ export {
28
+ base,
29
+ lineLimit,
30
+ multiLine
31
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braid-design-system",
3
- "version": "32.3.1",
3
+ "version": "32.4.0",
4
4
  "description": "Themeable design system for the SEEK Group",
5
5
  "homepage": "https://seek-oss.github.io/braid-design-system/",
6
6
  "bugs": {
@@ -1,15 +0,0 @@
1
- "use strict";
2
- const fileScope = require("@vanilla-extract/css/fileScope");
3
- const css = require("@vanilla-extract/css");
4
- const styles_entries_css_cjs = require("../../../../../css.cjs");
5
- fileScope.setFileScope("src/lib/components/private/Truncate/Truncate.css.ts?used", "braid-design-system");
6
- const truncate = css.style([styles_entries_css_cjs.atoms({
7
- display: "block",
8
- overflow: "hidden",
9
- minWidth: 0
10
- }), {
11
- whiteSpace: "nowrap",
12
- textOverflow: "ellipsis"
13
- }], "truncate");
14
- fileScope.endFileScope();
15
- exports.truncate = truncate;
@@ -1,16 +0,0 @@
1
- import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
- import { style } from "@vanilla-extract/css";
3
- import { atoms } from "../../../../../css.mjs";
4
- setFileScope("src/lib/components/private/Truncate/Truncate.css.ts?used", "braid-design-system");
5
- const truncate = style([atoms({
6
- display: "block",
7
- overflow: "hidden",
8
- minWidth: 0
9
- }), {
10
- whiteSpace: "nowrap",
11
- textOverflow: "ellipsis"
12
- }], "truncate");
13
- endFileScope();
14
- export {
15
- truncate
16
- };