braid-design-system 32.14.4 → 32.15.1

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,25 @@
1
1
  # braid-design-system
2
2
 
3
+ ## 32.15.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Update `react-focus-lock` to avoid build warnings in Rollup and Vite ([#1433](https://github.com/seek-oss/braid-design-system/pull/1433))
8
+
9
+ ## 32.15.0
10
+
11
+ ### Minor Changes
12
+
13
+ - **Rating:** Add `weight` support ([#1430](https://github.com/seek-oss/braid-design-system/pull/1430))
14
+
15
+ Provide a `weight` prop to customise the weight of the text rating alongside the stars.
16
+
17
+ **EXAMPLE USAGE:**
18
+
19
+ ```jsx
20
+ <Rating rating={3} weight="strong" />
21
+ ```
22
+
3
23
  ## 32.14.4
4
24
 
5
25
  ### Patch Changes
@@ -59,6 +59,7 @@ const ratingArr = [...Array(5)];
59
59
  const Rating = ({
60
60
  rating,
61
61
  size = "standard",
62
+ weight,
62
63
  showTextRating,
63
64
  variant: variantProp,
64
65
  "aria-label": ariaLabel,
@@ -68,6 +69,8 @@ const Rating = ({
68
69
  !rating || rating >= 0 && rating <= 5,
69
70
  "Rating must be between 0 and 5"
70
71
  );
72
+ const variant = variantProp || "full";
73
+ const resolvedVariant = showTextRating === false && !variantProp ? "starsOnly" : variant;
71
74
  if (process.env.NODE_ENV !== "production") {
72
75
  if (typeof showTextRating !== "undefined") {
73
76
  console.warn(
@@ -83,10 +86,21 @@ const Rating = ({
83
86
  "color: inherit"
84
87
  );
85
88
  }
89
+ if (typeof weight !== "undefined" && resolvedVariant === "starsOnly") {
90
+ console.warn(
91
+ dedent__default.default`
92
+ The "weight" prop is not valid with the "starsOnly" variant as there is no visible text. Either remove the \`weight\` prop or choose an alternative \`variant\`.
93
+ <Rating
94
+ %c- weight="strong"
95
+ %c variant="starsOnly"
96
+ />
97
+ `,
98
+ "color: red",
99
+ "color: inherit"
100
+ );
101
+ }
86
102
  }
87
- const variant = variantProp || "full";
88
- const resolvedVariant = showTextRating === false && !variantProp ? "starsOnly" : variant;
89
- return /* @__PURE__ */ jsxRuntime.jsxs(styles_lib_components_Accordion_AccordionItem_cjs.Text, { size, data, children: [
103
+ return /* @__PURE__ */ jsxRuntime.jsxs(styles_lib_components_Accordion_AccordionItem_cjs.Text, { size, data, weight, children: [
90
104
  /* @__PURE__ */ jsxRuntime.jsx(
91
105
  styles_lib_components_Box_Box_cjs.Box,
92
106
  {
@@ -55,6 +55,7 @@ const ratingArr = [...Array(5)];
55
55
  const Rating = ({
56
56
  rating,
57
57
  size = "standard",
58
+ weight,
58
59
  showTextRating,
59
60
  variant: variantProp,
60
61
  "aria-label": ariaLabel,
@@ -64,6 +65,8 @@ const Rating = ({
64
65
  !rating || rating >= 0 && rating <= 5,
65
66
  "Rating must be between 0 and 5"
66
67
  );
68
+ const variant = variantProp || "full";
69
+ const resolvedVariant = showTextRating === false && !variantProp ? "starsOnly" : variant;
67
70
  if (process.env.NODE_ENV !== "production") {
68
71
  if (typeof showTextRating !== "undefined") {
69
72
  console.warn(
@@ -79,10 +82,21 @@ const Rating = ({
79
82
  "color: inherit"
80
83
  );
81
84
  }
85
+ if (typeof weight !== "undefined" && resolvedVariant === "starsOnly") {
86
+ console.warn(
87
+ dedent`
88
+ The "weight" prop is not valid with the "starsOnly" variant as there is no visible text. Either remove the \`weight\` prop or choose an alternative \`variant\`.
89
+ <Rating
90
+ %c- weight="strong"
91
+ %c variant="starsOnly"
92
+ />
93
+ `,
94
+ "color: red",
95
+ "color: inherit"
96
+ );
97
+ }
82
98
  }
83
- const variant = variantProp || "full";
84
- const resolvedVariant = showTextRating === false && !variantProp ? "starsOnly" : variant;
85
- return /* @__PURE__ */ jsxs(Text, { size, data, children: [
99
+ return /* @__PURE__ */ jsxs(Text, { size, data, weight, children: [
86
100
  /* @__PURE__ */ jsx(
87
101
  Box,
88
102
  {
@@ -3574,16 +3574,23 @@ declare const RadioGroup$1: {
3574
3574
  displayName: string;
3575
3575
  };
3576
3576
 
3577
- interface RatingProps {
3577
+ interface RatingBaseProps {
3578
3578
  rating: number;
3579
3579
  size?: TextProps['size'];
3580
3580
  /** @deprecated Use `variant="starsOnly"` instead */
3581
3581
  showTextRating?: boolean;
3582
- variant?: 'full' | 'starsOnly' | 'minimal';
3583
3582
  'aria-label'?: string;
3584
3583
  data?: TextProps['data'];
3585
3584
  }
3586
- declare const Rating$1: ({ rating, size, showTextRating, variant: variantProp, "aria-label": ariaLabel, data, }: RatingProps) => JSX.Element;
3585
+ type RatingVariants = 'full' | 'starsOnly' | 'minimal';
3586
+ type RatingProps = RatingBaseProps & ({
3587
+ weight?: never;
3588
+ variant?: RatingVariants;
3589
+ } | {
3590
+ weight: TextProps['weight'];
3591
+ variant?: Exclude<RatingVariants, 'starsOnly'>;
3592
+ });
3593
+ declare const Rating$1: ({ rating, size, weight, showTextRating, variant: variantProp, "aria-label": ariaLabel, data, }: RatingProps) => JSX.Element;
3587
3594
 
3588
3595
  interface SecondaryProps {
3589
3596
  children: ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braid-design-system",
3
- "version": "32.14.4",
3
+ "version": "32.15.1",
4
4
  "description": "Themeable design system for the SEEK Group",
5
5
  "homepage": "https://seek-oss.github.io/braid-design-system/",
6
6
  "bugs": {
@@ -183,7 +183,7 @@
183
183
  "is-mobile": "^2.2.2",
184
184
  "lodash": "^4.17.21",
185
185
  "polished": "^4.1.0",
186
- "react-focus-lock": "^2.9.1",
186
+ "react-focus-lock": "^2.9.7",
187
187
  "react-is": "^18.2.0",
188
188
  "react-popper-tooltip": "^4.3.1",
189
189
  "react-remove-scroll": "^2.5.3",
@@ -226,7 +226,7 @@
226
226
  "react-dom": "^18.2.0",
227
227
  "react-router-dom": "^6.3.0",
228
228
  "sanitize-html": "^2.7.0",
229
- "sku": "12.4.7",
229
+ "sku": "12.4.9",
230
230
  "svgo": "^2.8.0",
231
231
  "title-case": "^3.0.3"
232
232
  },