@nordicsemiconductor/pc-nrfconnect-shared 244.0.0 → 245.0.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.
Files changed (36) hide show
  1. package/Changelog.md +53 -10
  2. package/dist/scripts/nordic-publish.js +2 -2
  3. package/dist/typings/ipc/device.d.ts +1 -1
  4. package/dist/typings/ipc/device.d.ts.map +1 -1
  5. package/dist/typings/ipc/schema/packageJson.d.ts +9 -9
  6. package/dist/typings/src/About/About.d.ts +1 -2
  7. package/dist/typings/src/About/About.d.ts.map +1 -1
  8. package/dist/typings/src/About/ApplicationCard.d.ts +4 -1
  9. package/dist/typings/src/About/ApplicationCard.d.ts.map +1 -1
  10. package/dist/typings/src/About/DeviceCard.d.ts +4 -1
  11. package/dist/typings/src/About/DeviceCard.d.ts.map +1 -1
  12. package/dist/typings/src/About/DocumentationCard.d.ts +5 -3
  13. package/dist/typings/src/About/DocumentationCard.d.ts.map +1 -1
  14. package/dist/typings/src/About/SupportCard.d.ts +5 -3
  15. package/dist/typings/src/About/SupportCard.d.ts.map +1 -1
  16. package/dist/typings/src/Button/Button.d.ts +5 -9
  17. package/dist/typings/src/Button/Button.d.ts.map +1 -1
  18. package/dist/typings/src/Card/Card.d.ts +24 -6
  19. package/dist/typings/src/Card/Card.d.ts.map +1 -1
  20. package/dist/typings/src/Device/deviceInfo/deviceInfo.d.ts.map +1 -1
  21. package/dist/typings/src/utils/packageJson.d.ts +2 -2
  22. package/ipc/device.ts +1 -0
  23. package/package.json +3 -3
  24. package/release_notes.md +34 -2
  25. package/scripts/nordic-publish.ts +1 -1
  26. package/src/About/About.tsx +15 -13
  27. package/src/About/ApplicationCard.tsx +11 -4
  28. package/src/About/DeviceCard.tsx +18 -6
  29. package/src/About/DocumentationCard.tsx +12 -7
  30. package/src/About/SupportCard.tsx +12 -4
  31. package/src/Button/Button.tsx +17 -16
  32. package/src/Card/Card.tsx +101 -14
  33. package/src/Device/deviceInfo/deviceInfo.ts +11 -0
  34. package/src/utils/useStopwatch.test.tsx +4 -4
  35. package/src/About/about.scss +0 -40
  36. package/src/Card/card.module.scss +0 -28
@@ -10,6 +10,7 @@ import classNames from '../utils/classNames';
10
10
 
11
11
  export type ButtonVariants =
12
12
  | 'primary'
13
+ | 'primary-outline'
13
14
  | 'secondary'
14
15
  | 'success'
15
16
  | 'info'
@@ -17,31 +18,31 @@ export type ButtonVariants =
17
18
  | 'danger'
18
19
  | 'link-button';
19
20
 
20
- export type ButtonSize = 'sm' | 'lg' | 'xl';
21
+ type ButtonSize = 'sm' | 'lg' | 'xl';
21
22
 
22
- type ButtonProps = {
23
- id?: string;
23
+ type PickedButtonProps =
24
+ | 'ref'
25
+ | 'key'
26
+ | 'className'
27
+ | 'disabled'
28
+ | 'onClick'
29
+ | 'title';
30
+
31
+ interface ButtonProps
32
+ extends Pick<React.ComponentPropsWithRef<'button'>, PickedButtonProps> {
24
33
  variant: ButtonVariants;
25
- className?: string;
26
- onClick: React.MouseEventHandler<HTMLButtonElement>;
27
- disabled?: boolean;
28
- title?: string;
29
34
  size?: ButtonSize;
30
- };
35
+ }
31
36
 
32
37
  const Button: React.FC<ButtonProps> = ({
33
38
  children,
34
- id,
35
39
  className,
36
40
  variant,
37
- onClick,
38
- disabled = false,
39
- title,
40
41
  size = 'sm',
42
+ ...attrs
41
43
  }) => (
42
44
  <button
43
45
  type="button"
44
- id={id}
45
46
  className={`${classNames(
46
47
  'tw-preflight',
47
48
  size === 'sm' && 'tw-h-6 tw-px-2 tw-text-xs',
@@ -49,6 +50,8 @@ const Button: React.FC<ButtonProps> = ({
49
50
  size === 'xl' && 'tw-h-8 tw-px-4 tw-text-base',
50
51
  variant === 'primary' &&
51
52
  'tw-border tw-border-transparent tw-bg-nordicBlue tw-text-white active:enabled:tw-bg-nordicBlue-700',
53
+ variant === 'primary-outline' &&
54
+ 'tw-border tw-border-nordicBlue tw-bg-white tw-text-nordicBlue active:enabled:tw-bg-nordicBlue-50',
52
55
  variant === 'secondary' &&
53
56
  'tw-border tw-border-gray-700 tw-bg-white tw-text-gray-700 active:enabled:tw-bg-gray-50',
54
57
  variant === 'success' &&
@@ -63,9 +66,7 @@ const Button: React.FC<ButtonProps> = ({
63
66
  'tw-border tw-border-nordicBlue tw-bg-white tw-text-nordicBlue active:enabled:tw-bg-gray-50',
64
67
  className,
65
68
  )}`}
66
- disabled={disabled}
67
- onClick={onClick}
68
- title={title}
69
+ {...attrs}
69
70
  >
70
71
  {children}
71
72
  </button>
package/src/Card/Card.tsx CHANGED
@@ -5,22 +5,109 @@
5
5
  */
6
6
 
7
7
  import React from 'react';
8
- import Card from 'react-bootstrap/Card';
9
8
 
10
- import styles from './card.module.scss';
9
+ import classNames from '../utils/classNames';
11
10
 
12
- type NrfCardProps = {
13
- children: React.ReactNode;
14
- title: React.ReactNode;
11
+ type PickedCardTitleProps = 'ref' | 'className';
12
+
13
+ interface CardTitleProps
14
+ extends Pick<React.ComponentPropsWithRef<'div'>, PickedCardTitleProps> {
15
+ cardTitle: React.ReactNode;
16
+ cardSubtitle?: React.ReactNode;
17
+ cardTitleClassName?: string;
18
+ cardSubtitleClassName?: string;
19
+ }
20
+
21
+ type CardTitleComponent = React.FC<CardTitleProps>;
22
+
23
+ const CardTitle: CardTitleComponent = ({
24
+ className,
25
+ cardTitle,
26
+ cardSubtitle,
27
+ ...attrs
28
+ }) => {
29
+ if (cardSubtitle) {
30
+ return (
31
+ <hgroup className={className} {...attrs}>
32
+ <h3 className="tw-font-medium">{cardTitle}</h3>
33
+ <p>{cardSubtitle}</p>
34
+ </hgroup>
35
+ );
36
+ }
37
+
38
+ return (
39
+ <h3 className={classNames('tw-font-medium', className)} {...attrs}>
40
+ {cardTitle}
41
+ </h3>
42
+ );
15
43
  };
16
44
 
17
- export default ({ children, title }: NrfCardProps) => (
18
- <Card className={styles.card}>
19
- <Card.Header className={styles.header}>
20
- <Card.Title>
21
- <span className={styles.title}>{title}</span>
22
- </Card.Title>
23
- </Card.Header>
24
- <Card.Body className={styles.body}>{children}</Card.Body>
25
- </Card>
45
+ type PickedCardHeaderProps =
46
+ | 'ref'
47
+ | 'className'
48
+ | 'onPointerEnter'
49
+ | 'onPointerLeave';
50
+
51
+ type CardHeaderProps = Pick<
52
+ React.ComponentPropsWithRef<'header'>,
53
+ PickedCardHeaderProps
54
+ >;
55
+
56
+ interface CardHeaderComponent extends React.FC<CardHeaderProps> {
57
+ Title: CardTitleComponent;
58
+ }
59
+
60
+ const CardHeader: CardHeaderComponent = ({ children, className, ...attrs }) => (
61
+ <header
62
+ className={classNames(
63
+ `tw-border-b tw-border-solid tw-border-b-black tw-border-opacity-10 tw-py-4`,
64
+ className,
65
+ )}
66
+ {...attrs}
67
+ >
68
+ {children}
69
+ </header>
70
+ );
71
+
72
+ CardHeader.Title = CardTitle;
73
+
74
+ type PickedCardBodyProps = 'ref' | 'className';
75
+
76
+ type CardBodyProps = Pick<
77
+ React.ComponentPropsWithRef<'div'>,
78
+ PickedCardBodyProps
79
+ >;
80
+
81
+ type CardBodyComponent = React.FC<CardBodyProps>;
82
+
83
+ const CardBody: CardBodyComponent = ({ className, children, ...attrs }) => (
84
+ <div className={classNames('tw-flex tw-flex-col', className)} {...attrs}>
85
+ {children}
86
+ </div>
87
+ );
88
+
89
+ type PickedCardProps = 'ref' | 'className';
90
+
91
+ type CardProps = Pick<React.ComponentPropsWithRef<'article'>, PickedCardProps>;
92
+
93
+ interface CardComponent extends React.FC<CardProps> {
94
+ Header: CardHeaderComponent;
95
+ Body: CardBodyComponent;
96
+ }
97
+
98
+ const Card: CardComponent = ({ children, className, ...attrs }) => (
99
+ <article
100
+ className={classNames(
101
+ `tw-preflight tw-relative tw-flex tw-flex-col tw-gap-4 tw-break-words tw-border tw-border-solid tw-border-black tw-border-opacity-10 tw-bg-white tw-px-4 tw-pb-4`,
102
+ className,
103
+ )}
104
+ {...attrs}
105
+ >
106
+ {children}
107
+ </article>
26
108
  );
109
+
110
+ Card.Header = CardHeader;
111
+ Card.Body = CardBody;
112
+
113
+ export default Card;
@@ -293,6 +293,17 @@ const devicesByPca: { [P in KnownDevicePCA]: DeviceInfo } = {
293
293
  'https://www.nordicsemi.com/About-us/BuyOnline?search_token=nRF54LV10%20DK',
294
294
  },
295
295
  },
296
+ PCA10214: {
297
+ name: 'nRF54LS05 DK',
298
+ cores: 1,
299
+ icon: nrf54logo,
300
+ website: {
301
+ productPage:
302
+ 'https://www.nordicsemi.com/Products/Development-hardware/nRF54LS05-DK',
303
+ buyOnline:
304
+ 'https://www.nordicsemi.com/About-us/BuyOnline?search_token=nRF54LS05%20DK',
305
+ },
306
+ },
296
307
  PCA10201: {
297
308
  name: 'nRF9151 SMA DK',
298
309
  cores: 1,
@@ -7,18 +7,18 @@
7
7
  import React from 'react';
8
8
  import { act, render } from '@testing-library/react';
9
9
 
10
- import useStopWatch, { type ITimer, type Stopwatch } from './useStopwatch';
10
+ import useStopwatch, { type ITimer, type Stopwatch } from './useStopwatch';
11
11
 
12
12
  let appCallback = () => {};
13
13
 
14
14
  const setup = (stopwatch: Stopwatch) => {
15
15
  const returnVal = {};
16
16
  const TestComponent = () => {
17
- Object.assign(returnVal, useStopWatch(stopwatch));
17
+ Object.assign(returnVal, useStopwatch(stopwatch));
18
18
  return null;
19
19
  };
20
20
  render(<TestComponent />);
21
- return returnVal as ReturnType<typeof useStopWatch>;
21
+ return returnVal as ReturnType<typeof useStopwatch>;
22
22
  };
23
23
 
24
24
  describe('Stop Watch', () => {
@@ -34,7 +34,7 @@ describe('Stop Watch', () => {
34
34
  };
35
35
 
36
36
  const expectZeroElapsedTime = (
37
- stopwatch: ReturnType<typeof useStopWatch>,
37
+ stopwatch: ReturnType<typeof useStopwatch>,
38
38
  ) => {
39
39
  expect(stopwatch.time).toBe(0);
40
40
  expect(stopwatch.seconds).toBe(0);
@@ -1,40 +0,0 @@
1
- /*
2
- * Copyright (c) 2021 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- @import '../variables';
8
-
9
- .about {
10
- display: flex;
11
- align-items: center;
12
- height: 100%;
13
-
14
- .about-inner {
15
- display: flex;
16
- flex-direction: row;
17
- justify-content: center;
18
- flex-wrap: wrap;
19
- width: 100%;
20
- margin: auto;
21
- padding-bottom: 16px;
22
- padding-right: 16px;
23
- .card {
24
- min-width: 230px;
25
- max-width: 20em;
26
- margin-left: 8px;
27
- margin-bottom: 8px;
28
- }
29
- .card-body {
30
- margin-bottom: 1em;
31
- }
32
- .factory-reset-button {
33
- height: 24px;
34
- padding: 0;
35
- }
36
- }
37
- button {
38
- width: 100%;
39
- }
40
- }
@@ -1,28 +0,0 @@
1
- /*
2
- * Copyright (c) 2021 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- @import '../variables.scss';
8
-
9
- .card {
10
- flex: 1;
11
- flex-shrink: 0;
12
- padding: 16px;
13
- }
14
-
15
- .header {
16
- background-color: transparent !important;
17
- text-align: center !important;
18
- padding: 0.5em 0em 0em 0em !important;
19
- }
20
-
21
- .title {
22
- float: inherit !important;
23
- margin-bottom: 0px !important;
24
- }
25
-
26
- .body {
27
- padding: 1em 0em 0em 0em !important;
28
- }