@nordicsemiconductor/pc-nrfconnect-shared 243.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 (42) hide show
  1. package/Changelog.md +60 -10
  2. package/README.md +10 -0
  3. package/dist/bootstrap.css +250 -233
  4. package/dist/scripts/nordic-publish.js +4 -4
  5. package/dist/typings/ipc/device.d.ts +1 -1
  6. package/dist/typings/ipc/device.d.ts.map +1 -1
  7. package/dist/typings/ipc/schema/packageJson.d.ts +9 -9
  8. package/dist/typings/scripts/esbuild-renderer.d.ts +4 -3
  9. package/dist/typings/scripts/esbuild-renderer.d.ts.map +1 -1
  10. package/dist/typings/src/About/About.d.ts +1 -2
  11. package/dist/typings/src/About/About.d.ts.map +1 -1
  12. package/dist/typings/src/About/ApplicationCard.d.ts +4 -1
  13. package/dist/typings/src/About/ApplicationCard.d.ts.map +1 -1
  14. package/dist/typings/src/About/DeviceCard.d.ts +4 -1
  15. package/dist/typings/src/About/DeviceCard.d.ts.map +1 -1
  16. package/dist/typings/src/About/DocumentationCard.d.ts +5 -3
  17. package/dist/typings/src/About/DocumentationCard.d.ts.map +1 -1
  18. package/dist/typings/src/About/SupportCard.d.ts +5 -3
  19. package/dist/typings/src/About/SupportCard.d.ts.map +1 -1
  20. package/dist/typings/src/Button/Button.d.ts +5 -9
  21. package/dist/typings/src/Button/Button.d.ts.map +1 -1
  22. package/dist/typings/src/Card/Card.d.ts +24 -6
  23. package/dist/typings/src/Card/Card.d.ts.map +1 -1
  24. package/dist/typings/src/Device/deviceInfo/deviceInfo.d.ts.map +1 -1
  25. package/dist/typings/src/utils/packageJson.d.ts +2 -2
  26. package/ipc/device.ts +1 -0
  27. package/package.json +5 -5
  28. package/release_notes.md +32 -7
  29. package/scripts/esbuild-renderer.ts +5 -3
  30. package/scripts/nordic-publish.ts +1 -1
  31. package/src/About/About.tsx +15 -13
  32. package/src/About/ApplicationCard.tsx +11 -4
  33. package/src/About/DeviceCard.tsx +18 -6
  34. package/src/About/DocumentationCard.tsx +12 -7
  35. package/src/About/SupportCard.tsx +12 -4
  36. package/src/Button/Button.tsx +17 -16
  37. package/src/Card/Card.tsx +101 -14
  38. package/src/Device/deviceInfo/deviceInfo.ts +11 -0
  39. package/src/utils/useStopwatch.test.tsx +4 -4
  40. package/src/variables.scss +20 -18
  41. package/src/About/about.scss +0 -40
  42. package/src/Card/card.module.scss +0 -28
@@ -23,7 +23,12 @@ import AboutButton from './AboutButton';
23
23
  import Feedback from './Feedback';
24
24
  import Section from './Section';
25
25
 
26
- export default ({ feedbackCategories }: { feedbackCategories?: string[] }) => {
26
+ export interface SupportCardProps {
27
+ feedbackCategories?: Array<string>;
28
+ className?: string;
29
+ }
30
+
31
+ export default ({ feedbackCategories, className }: SupportCardProps) => {
27
32
  const dispatch = useDispatch();
28
33
  const devices = useSelector(getDevices);
29
34
  const currentSerialNumber = useSelector(selectedSerialNumber);
@@ -31,8 +36,11 @@ export default ({ feedbackCategories }: { feedbackCategories?: string[] }) => {
31
36
  const currentDevice = useSelector(selectedDevice);
32
37
 
33
38
  return (
34
- <Card title="Support">
35
- <div className="tw-preflight tw-flex tw-flex-col tw-flex-wrap tw-gap-4">
39
+ <Card className={className}>
40
+ <Card.Header className="tw-text-center tw-text-base">
41
+ <Card.Header.Title cardTitle="Support" />
42
+ </Card.Header>
43
+ <Card.Body className="tw-gap-4">
36
44
  <Section title="DevZone">
37
45
  <p>
38
46
  You can ask for help or open a support request on
@@ -98,7 +106,7 @@ export default ({ feedbackCategories }: { feedbackCategories?: string[] }) => {
98
106
  </Button>
99
107
  </Section>
100
108
  </Section>
101
- </div>
109
+ </Card.Body>
102
110
  </Card>
103
111
  );
104
112
  };
@@ -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);
@@ -4,6 +4,9 @@
4
4
  * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
5
  */
6
6
 
7
+ @use "sass:color";
8
+ @use "sass:math";
9
+
7
10
  @import '../styles.scss';
8
11
 
9
12
  //
@@ -49,7 +52,7 @@ $h6-font-size: ($font-size-base * 0.85); // ~12px
49
52
  //** Unit-less `line-height` for use in components like buttons.
50
53
  $line-height-base: 1.428571429; // 20/14
51
54
  //** Computed "line-height" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.
52
- $line-height-computed: floor(($font-size-base * $line-height-base)); // ~20px
55
+ $line-height-computed: math.floor(($font-size-base * $line-height-base)); // ~20px
53
56
 
54
57
  //** By default, this inherits from the `<body>`.
55
58
  $headings-font-family: inherit;
@@ -335,20 +338,20 @@ $navbar-collapse-max-height: 340px;
335
338
 
336
339
  $navbar-default-color: #777;
337
340
  $navbar-default-bg: #f8f8f8;
338
- $navbar-default-border: darken($navbar-default-bg, 6.5%);
341
+ $navbar-default-border: color.adjust($navbar-default-bg, $lightness: -6.5%);
339
342
 
340
343
  // Navbar links
341
344
  $navbar-default-link-color: #777;
342
345
  $navbar-default-link-hover-color: #333;
343
346
  $navbar-default-link-hover-bg: transparent;
344
347
  $navbar-default-link-active-color: #555;
345
- $navbar-default-link-active-bg: darken($navbar-default-bg, 6.5%);
348
+ $navbar-default-link-active-bg: color.adjust($navbar-default-bg, $lightness: -6.5%);
346
349
  $navbar-default-link-disabled-color: #ccc;
347
350
  $navbar-default-link-disabled-bg: transparent;
348
351
 
349
352
  // Navbar brand label
350
353
  $navbar-default-brand-color: $navbar-default-link-color;
351
- $navbar-default-brand-hover-color: darken($navbar-default-brand-color, 10%);
354
+ $navbar-default-brand-hover-color: color.adjust($navbar-default-brand-color, $lightness: -10%);
352
355
  $navbar-default-brand-hover-bg: transparent;
353
356
 
354
357
  // Navbar toggle
@@ -360,14 +363,14 @@ $navbar-default-toggle-border-color: #ddd;
360
363
  // Reset inverted navbar basics
361
364
  $navbar-inverse-color: $gray-200;
362
365
  $navbar-inverse-bg: #222;
363
- $navbar-inverse-border: darken($navbar-inverse-bg, 10%);
366
+ $navbar-inverse-border: color.adjust($navbar-inverse-bg, $lightness: -10%);
364
367
 
365
368
  // Inverted navbar links
366
369
  $navbar-inverse-link-color: $gray-200;
367
370
  $navbar-inverse-link-hover-color: #fff;
368
371
  $navbar-inverse-link-hover-bg: transparent;
369
372
  $navbar-inverse-link-active-color: $navbar-inverse-link-hover-color;
370
- $navbar-inverse-link-active-bg: darken($navbar-inverse-bg, 10%);
373
+ $navbar-inverse-link-active-bg: color.adjust($navbar-inverse-bg, $lightness: -10%);
371
374
  $navbar-inverse-link-disabled-color: #444;
372
375
  $navbar-inverse-link-disabled-bg: transparent;
373
376
 
@@ -452,8 +455,8 @@ $jumbotron-padding: 30px;
452
455
  $jumbotron-color: inherit;
453
456
  $jumbotron-bg: $gray-50;
454
457
  $jumbotron-heading-color: inherit;
455
- $jumbotron-font-size: ceil(($font-size-base * 1.5));
456
- $jumbotron-heading-font-size: ceil(($font-size-base * 4.5));
458
+ $jumbotron-font-size: math.ceil(($font-size-base * 1.5));
459
+ $jumbotron-heading-font-size: math.ceil(($font-size-base * 4.5));
457
460
 
458
461
  //== Form states and alerts
459
462
  //
@@ -461,19 +464,18 @@ $jumbotron-heading-font-size: ceil(($font-size-base * 4.5));
461
464
 
462
465
  $state-success-text: #3c763d;
463
466
  $state-success-bg: #dff0d8;
464
- $state-success-border: darken(adjust-hue($state-success-bg, -10), 5%);
467
+ $state-success-border: color.adjust($state-success-bg, $hue: -10deg, $lightness: -5%);
465
468
 
466
469
  $state-info-text: #31708f;
467
470
  $state-info-bg: #d9edf7;
468
- $state-info-border: darken(adjust-hue($state-info-bg, -10), 7%);
469
-
471
+ $state-info-border: color.adjust($state-info-bg, $hue: -10deg, $lightness: -7%);
470
472
  $state-warning-text: #8a6d3b;
471
473
  $state-warning-bg: #fcf8e3;
472
- $state-warning-border: darken(adjust-hue($state-warning-bg, -10), 5%);
474
+ $state-warning-border: color.adjust($state-warning-bg, $hue: -10deg, $lightness: -5%);
473
475
 
474
476
  $state-danger-text: #a94442;
475
477
  $state-danger-bg: #f2dede;
476
- $state-danger-border: darken(adjust-hue($state-danger-bg, -10), 5%);
478
+ $state-danger-border: color.adjust($state-danger-bg, $hue: -10deg, $lightness: -5%);
477
479
 
478
480
  //== Tooltips
479
481
  //
@@ -506,7 +508,7 @@ $popover-border-color: rgba(0, 0, 0, 0.2);
506
508
  $popover-fallback-border-color: #ccc;
507
509
 
508
510
  //** Popover title background color
509
- $popover-title-bg: darken($popover-bg, 3%);
511
+ $popover-title-bg: color.adjust($popover-bg, $lightness: -3%);
510
512
 
511
513
  //** Popover arrow width
512
514
  $popover-arrow-width: 10px;
@@ -518,9 +520,9 @@ $popover-arrow-outer-width: ($popover-arrow-width + 1);
518
520
  //** Popover outer arrow color
519
521
  $popover-arrow-outer-color: fadein($popover-border-color, 5%);
520
522
  //** Popover outer arrow fallback color
521
- $popover-arrow-outer-fallback-color: darken(
523
+ $popover-arrow-outer-fallback-color: color.adjust(
522
524
  $popover-fallback-border-color,
523
- 20%
525
+ $lightness: -20%
524
526
  );
525
527
 
526
528
  //== Labels
@@ -644,7 +646,7 @@ $list-group-active-bg: $component-active-bg;
644
646
  //** Border color of active list elements
645
647
  $list-group-active-border: $list-group-active-bg;
646
648
  //** Text color for content within active list items
647
- $list-group-active-text-color: lighten($list-group-active-bg, 40%);
649
+ $list-group-active-text-color: color.adjust($list-group-active-bg, $lightness: 40%);
648
650
 
649
651
  //** Text color of disabled list items
650
652
  $list-group-disabled-color: $gray-400;
@@ -718,7 +720,7 @@ $thumbnail-caption-padding: 9px;
718
720
  //##
719
721
 
720
722
  $well-bg: #f5f5f5;
721
- $well-border: darken($well-bg, 7%);
723
+ $well-border: color.adjust($well-bg, $lightness: -7%);
722
724
 
723
725
  //== Badges
724
726
  //
@@ -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
- }