@primer/react 38.8.0-rc.d3b27e56d → 38.8.0-rc.e1ad889fa

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.

Potentially problematic release.


This version of @primer/react might be problematic. Click here for more details.

package/CHANGELOG.md CHANGED
@@ -6,13 +6,17 @@
6
6
 
7
7
  - [#7455](https://github.com/primer/react/pull/7455) [`a86c183`](https://github.com/primer/react/commit/a86c183f5ea7add7584f895cff3027a7db35675e) Thanks [@HiroAgustin](https://github.com/HiroAgustin)! - Remove ConfirmationDialog custom renders to ensure visual parity with Dialog
8
8
 
9
+ - [#7438](https://github.com/primer/react/pull/7438) [`160c1c4`](https://github.com/primer/react/commit/160c1c4cf1c5111dd46b68471d49733f47f524cc) Thanks [@francinelucca](https://github.com/francinelucca)! - feat: make Spinner's delay customizable
10
+
9
11
  - [#7436](https://github.com/primer/react/pull/7436) [`9a4e46c`](https://github.com/primer/react/commit/9a4e46cf902a5c2e046ca7771211536ae0bd08ed) Thanks [@TylerJDev](https://github.com/TylerJDev)! - FilteredActionList: Adds new prop `scrollBehavior` to allow customization of scroll behavior
10
12
 
13
+ - [#7448](https://github.com/primer/react/pull/7448) [`838859d`](https://github.com/primer/react/commit/838859d8ee2afc2afca71a28114020a14a68b297) Thanks [@francinelucca](https://github.com/francinelucca)! - feat(SkeletonBox): add customizable delay
14
+
11
15
  ### Patch Changes
12
16
 
13
17
  - [#7427](https://github.com/primer/react/pull/7427) [`4bb6620`](https://github.com/primer/react/commit/4bb66203f0e6cd5d717b27d591ec5df169c1ad1a) Thanks [@barmo](https://github.com/barmo)! - Change actionlist item inline description styling from flex to block to fix overflow
14
18
 
15
- - [#7451](https://github.com/primer/react/pull/7451) [`0fc4523`](https://github.com/primer/react/commit/0fc45237ef3f912c86663817eb8983875b4c8d7e) Thanks [@daantosaurus](https://github.com/daantosaurus)! - UnderlineNav.Item: Fix layout issues when children contain React elements by extracting only direct text content for the `data-content` attribute.
19
+ - [#7462](https://github.com/primer/react/pull/7462) [`5579c9b`](https://github.com/primer/react/commit/5579c9b0298091ba83c3ea1957ff5878651cc9a8) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - UnderlineNav.Item: Fix layout issues when children contain React elements by extracting only direct text content for the `data-content` attribute [#7451](https://github.com/primer/react/pull/7451)
16
20
 
17
21
  ## 38.7.1
18
22
 
@@ -7,6 +7,8 @@ export type SkeletonBoxProps = {
7
7
  width?: CSSProperties['width'];
8
8
  /** The className of the skeleton box */
9
9
  className?: string;
10
+ /** Controls whether and how long to delay rendering the SkeletonBox. Set to 'short' to delay by 300ms, 'long' to delay by 1000ms, or provide a custom number of milliseconds.*/
11
+ delay?: 'short' | 'long' | number;
10
12
  } & HTMLProps<HTMLElement>;
11
13
  export declare const SkeletonBox: React.ForwardRefExoticComponent<Omit<SkeletonBoxProps, "ref"> & React.RefAttributes<HTMLElement>>;
12
14
  //# sourceMappingURL=SkeletonBox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SkeletonBox.d.ts","sourceRoot":"","sources":["../../src/Skeleton/SkeletonBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,KAAK,aAAa,EAAE,KAAK,SAAS,EAAC,MAAM,OAAO,CAAA;AAIxD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;IAChC,wEAAwE;IACxE,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IAC9B,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,SAAS,CAAC,WAAW,CAAC,CAAA;AAE1B,eAAO,MAAM,WAAW,mGAYtB,CAAA"}
1
+ {"version":3,"file":"SkeletonBox.d.ts","sourceRoot":"","sources":["../../src/Skeleton/SkeletonBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,EAAC,KAAK,aAAa,EAAE,KAAK,SAAS,EAAC,MAAM,OAAO,CAAA;AAIxD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;IAChC,wEAAwE;IACxE,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IAC9B,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gLAAgL;IAChL,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;CAClC,GAAG,SAAS,CAAC,WAAW,CAAC,CAAA;AAE1B,eAAO,MAAM,WAAW,mGA+BtB,CAAA"}
@@ -1,12 +1,13 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import React from 'react';
2
+ import React, { useState, useEffect } from 'react';
3
3
  import { clsx } from 'clsx';
4
4
  import classes from './SkeletonBox.module.css.js';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
7
  const SkeletonBox = /*#__PURE__*/React.forwardRef(function SkeletonBox(t0, ref) {
8
- const $ = c(19);
8
+ const $ = c(23);
9
9
  let className;
10
+ let delay;
10
11
  let height;
11
12
  let props;
12
13
  let style;
@@ -17,69 +18,96 @@ const SkeletonBox = /*#__PURE__*/React.forwardRef(function SkeletonBox(t0, ref)
17
18
  width,
18
19
  className,
19
20
  style,
21
+ delay,
20
22
  ...props
21
23
  } = t0);
22
24
  $[0] = t0;
23
25
  $[1] = className;
24
- $[2] = height;
25
- $[3] = props;
26
- $[4] = style;
27
- $[5] = width;
26
+ $[2] = delay;
27
+ $[3] = height;
28
+ $[4] = props;
29
+ $[5] = style;
30
+ $[6] = width;
28
31
  } else {
29
32
  className = $[1];
30
- height = $[2];
31
- props = $[3];
32
- style = $[4];
33
- width = $[5];
33
+ delay = $[2];
34
+ height = $[3];
35
+ props = $[4];
36
+ style = $[5];
37
+ width = $[6];
34
38
  }
35
- const t1 = ref;
39
+ const [isVisible, setIsVisible] = useState(!delay);
40
+ let t1;
36
41
  let t2;
37
- if ($[6] !== className) {
38
- t2 = clsx(className, classes.SkeletonBox);
39
- $[6] = className;
40
- $[7] = t2;
42
+ if ($[7] !== delay) {
43
+ t1 = () => {
44
+ if (delay) {
45
+ const timeoutId = setTimeout(() => {
46
+ setIsVisible(true);
47
+ }, typeof delay === "number" ? delay : delay === "short" ? 300 : 1000);
48
+ return () => clearTimeout(timeoutId);
49
+ }
50
+ };
51
+ t2 = [delay];
52
+ $[7] = delay;
53
+ $[8] = t1;
54
+ $[9] = t2;
41
55
  } else {
42
- t2 = $[7];
56
+ t1 = $[8];
57
+ t2 = $[9];
43
58
  }
44
- let t3;
45
- if ($[8] !== style) {
46
- t3 = style || {};
47
- $[8] = style;
48
- $[9] = t3;
49
- } else {
50
- t3 = $[9];
59
+ useEffect(t1, t2);
60
+ if (!isVisible) {
61
+ return null;
51
62
  }
63
+ const t3 = ref;
52
64
  let t4;
53
- if ($[10] !== height || $[11] !== t3 || $[12] !== width) {
54
- t4 = {
65
+ if ($[10] !== className) {
66
+ t4 = clsx(className, classes.SkeletonBox);
67
+ $[10] = className;
68
+ $[11] = t4;
69
+ } else {
70
+ t4 = $[11];
71
+ }
72
+ let t5;
73
+ if ($[12] !== style) {
74
+ t5 = style || {};
75
+ $[12] = style;
76
+ $[13] = t5;
77
+ } else {
78
+ t5 = $[13];
79
+ }
80
+ let t6;
81
+ if ($[14] !== height || $[15] !== t5 || $[16] !== width) {
82
+ t6 = {
55
83
  height,
56
84
  width,
57
- ...t3
85
+ ...t5
58
86
  };
59
- $[10] = height;
60
- $[11] = t3;
61
- $[12] = width;
62
- $[13] = t4;
87
+ $[14] = height;
88
+ $[15] = t5;
89
+ $[16] = width;
90
+ $[17] = t6;
63
91
  } else {
64
- t4 = $[13];
92
+ t6 = $[17];
65
93
  }
66
- let t5;
67
- if ($[14] !== props || $[15] !== t1 || $[16] !== t2 || $[17] !== t4) {
68
- t5 = /*#__PURE__*/jsx("div", {
69
- ref: t1,
70
- className: t2,
71
- style: t4,
94
+ let t7;
95
+ if ($[18] !== props || $[19] !== t3 || $[20] !== t4 || $[21] !== t6) {
96
+ t7 = /*#__PURE__*/jsx("div", {
97
+ ref: t3,
98
+ className: t4,
99
+ style: t6,
72
100
  ...props
73
101
  });
74
- $[14] = props;
75
- $[15] = t1;
76
- $[16] = t2;
77
- $[17] = t4;
78
- $[18] = t5;
102
+ $[18] = props;
103
+ $[19] = t3;
104
+ $[20] = t4;
105
+ $[21] = t6;
106
+ $[22] = t7;
79
107
  } else {
80
- t5 = $[18];
108
+ t7 = $[22];
81
109
  }
82
- return t5;
110
+ return t7;
83
111
  });
84
112
 
85
113
  export { SkeletonBox };
@@ -14,8 +14,8 @@ export type SpinnerProps = {
14
14
  'aria-label'?: string;
15
15
  className?: string;
16
16
  style?: React.CSSProperties;
17
- /** Whether to delay the spinner before rendering by the defined 1000ms. */
18
- delay?: boolean;
17
+ /** Controls whether and how long to delay rendering the spinner. Set to `true` to delay by 1000ms, `'short'` to delay by 300ms, `'long'` to delay by 1000ms, or provide a custom number of milliseconds. */
18
+ delay?: boolean | 'short' | 'long' | number;
19
19
  } & HTMLDataAttributes;
20
20
  declare function Spinner({ size: sizeKey, srText, 'aria-label': ariaLabel, className, style, delay, ...props }: SpinnerProps): React.JSX.Element | null;
21
21
  declare namespace Spinner {
@@ -1 +1 @@
1
- {"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/Spinner/Spinner.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAA;AAMlE,QAAA,MAAM,OAAO;;;;CAIZ,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,OAAO,OAAO,CAAA;IAC3B,0KAA0K;IAC1K,MAAM,CA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T,EAAE,YAAY,4BA4Dd;kBApEQ,OAAO;;;AAmMhB,eAAe,OAAO,CAAA"}
@@ -64,9 +64,10 @@ function Spinner(t0) {
64
64
  if ($[8] !== delay) {
65
65
  t4 = () => {
66
66
  if (delay) {
67
+ const delayDuration = typeof delay === "number" ? delay : delay === "short" ? 300 : 1000;
67
68
  const timeoutId = setTimeout(() => {
68
69
  setIsVisible(true);
69
- }, 1000);
70
+ }, delayDuration);
70
71
  return () => clearTimeout(timeoutId);
71
72
  }
72
73
  };
@@ -6307,6 +6307,12 @@
6307
6307
  ],
6308
6308
  "importPath": "@primer/react",
6309
6309
  "props": [
6310
+ {
6311
+ "name": "delay",
6312
+ "type": "'short' | 'long' | number",
6313
+ "description": "Controls whether and how long to delay rendering the SkeletonBox. Set to 'short' to delay by 300ms, 'long' to delay by 1000ms, or provide a custom number of milliseconds.",
6314
+ "defaultValue": "false"
6315
+ },
6310
6316
  {
6311
6317
  "name": "width",
6312
6318
  "type": "string",
@@ -6492,9 +6498,9 @@
6492
6498
  },
6493
6499
  {
6494
6500
  "defaultValue": "false",
6495
- "description": "Whether to delay the spinner before rendering by the defined 1000ms.",
6501
+ "description": "Controls whether and how long to delay rendering the spinner. Set to `true` to delay by 1000ms, `'short'` to delay by 300ms, `'long'` to delay by 1000ms, or provide a custom number of milliseconds.",
6496
6502
  "name": "delay",
6497
- "type": "boolean"
6503
+ "type": "boolean | 'short' | 'long' | number"
6498
6504
  }
6499
6505
  ],
6500
6506
  "status": "alpha",
@@ -6517,7 +6523,7 @@
6517
6523
  },
6518
6524
  {
6519
6525
  "id": "components-spinner-features--with-delay",
6520
- "code": "() => <Spinner delay />"
6526
+ "code": "() => <Spinner delay=\"long\" />"
6521
6527
  }
6522
6528
  ],
6523
6529
  "subcomponents": []
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.8.0-rc.d3b27e56d",
4
+ "version": "38.8.0-rc.e1ad889fa",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",