@nordicsemiconductor/pc-nrfconnect-shared 234.0.0 → 236.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.
package/Changelog.md CHANGED
@@ -7,6 +7,19 @@ This project does _not_ adhere to
7
7
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html) but contrary to it
8
8
  every new version is a new major version.
9
9
 
10
+ ## 236.0.0 - 2025-11-07
11
+
12
+ ### Changed
13
+
14
+ - In a `ConfirmationDialog` a cancel button is only displayed if `onCancel` is
15
+ defined (before it was mandatory to define it).
16
+
17
+ ## 235.0.0 - 2025-11-06
18
+
19
+ ### Fixed
20
+
21
+ - A text sizing problem with Dropdown's chevron.
22
+
10
23
  ## 234.0.0 - 2025-10-21
11
24
 
12
25
  ### Changed
package/README.md CHANGED
@@ -32,17 +32,3 @@ updated to the right version and today‘s date.
32
32
 
33
33
  When those conditions are met, a new release of shared will automatically be
34
34
  created when the according PR is merged into main.
35
-
36
- ## Unpublishing a version
37
-
38
- If you need to unpublish a specific version from npm (e.g., due to a critical
39
- bug), you can use the "Unpublish npm version" GitHub Action:
40
-
41
- 1. Go to the
42
- [Unpublish npm version GitHub Action](https://github.com/NordicSemiconductor/pc-nrfconnect-shared/actions/workflows/unpublish-npm-version.yml)
43
- and run the workflow.
44
- 1. Enter the version to unpublish (e.g., `221.0.0`)
45
-
46
- **Warning:** Unpublishing a version from npm is irreversible and should only be
47
- done in exceptional circumstances (e.g., security vulnerabilities, critical
48
- bugs).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordicsemiconductor/pc-nrfconnect-shared",
3
- "version": "234.0.0",
3
+ "version": "236.0.0",
4
4
  "description": "Shared commodities for developing pc-nrfconnect-* packages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,6 +21,7 @@
21
21
  "check:lint": "eslint --color .",
22
22
  "check:types": "tsc --noEmit",
23
23
  "check:license": "tsx scripts/nrfconnect-license.ts check",
24
+ "create-source": "tsx scripts/create-source.ts",
24
25
  "generate-types": "tsc --emitDeclarationOnly --declaration --declarationMap --outDir ./typings/generated --rootDir .",
25
26
  "prepare": "tsx scripts/installHusky.ts",
26
27
  "prepare-shared-release": "tsx scripts/prepare-shared-release.ts",
package/release_notes.md CHANGED
@@ -1,3 +1,4 @@
1
1
  ### Changed
2
2
 
3
- - In Telemetry disabled sending dependency events.
3
+ - In a `ConfirmationDialog` a cancel button is only displayed if `onCancel` is
4
+ defined (before it was mandatory to define it).
@@ -48,8 +48,8 @@ describe('Dialog', () => {
48
48
  });
49
49
 
50
50
  describe('InfoDialog creator', () => {
51
- const dialog = (isVisible = true) => (
52
- <InfoDialog isVisible={isVisible} onHide={noop}>
51
+ const dialog = () => (
52
+ <InfoDialog isVisible onHide={noop}>
53
53
  Test Body
54
54
  </InfoDialog>
55
55
  );
@@ -73,8 +73,8 @@ describe('InfoDialog creator', () => {
73
73
  });
74
74
 
75
75
  describe('ErrorDialog creator', () => {
76
- const dialog = (isVisible = true) => (
77
- <ErrorDialog isVisible={isVisible} onHide={noop}>
76
+ const dialog = () => (
77
+ <ErrorDialog isVisible onHide={noop}>
78
78
  Test Body
79
79
  </ErrorDialog>
80
80
  );
@@ -97,19 +97,27 @@ describe('ErrorDialog creator', () => {
97
97
  });
98
98
  });
99
99
  describe('ConfirmationDialog creator', () => {
100
- const dialog = (isVisible = true) => (
100
+ const mockedConfirm = jest.fn();
101
+ const mockedCancel = jest.fn();
102
+ const mockedOptional = jest.fn();
103
+
104
+ const dialog = () => (
101
105
  <ConfirmationDialog
102
- isVisible={isVisible}
106
+ isVisible
103
107
  confirmLabel="ConfButton"
104
- onConfirm={() => noop(true)}
105
- onCancel={() => noop(false)}
108
+ onConfirm={mockedConfirm}
109
+ onCancel={mockedCancel}
106
110
  optionalLabel="Optional"
107
- onOptional={() => noop()}
111
+ onOptional={mockedOptional}
108
112
  >
109
113
  Test Body
110
114
  </ConfirmationDialog>
111
115
  );
112
116
 
117
+ beforeEach(() => {
118
+ jest.clearAllMocks();
119
+ });
120
+
113
121
  it('shows the expected content', () => {
114
122
  render(dialog());
115
123
 
@@ -123,11 +131,29 @@ describe('ConfirmationDialog creator', () => {
123
131
  it('invokes the expected action', () => {
124
132
  render(dialog());
125
133
 
134
+ jest.resetAllMocks();
126
135
  fireEvent.click(screen.getByText('Optional'));
127
- expect(noop).toHaveBeenCalled();
136
+ expect(mockedOptional).toHaveBeenCalled();
128
137
  fireEvent.click(screen.getByText('ConfButton'));
129
- expect(noop).toHaveBeenCalledWith(true);
138
+ expect(mockedConfirm).toHaveBeenCalled();
130
139
  fireEvent.click(screen.getByText('Cancel'));
131
- expect(noop).toHaveBeenCalledWith(false);
140
+ expect(mockedCancel).toHaveBeenCalled();
141
+ });
142
+
143
+ it('invokes onCancel on pressing ESC', () => {
144
+ render(dialog());
145
+
146
+ fireEvent.keyDown(document, { key: 'Escape', keyCode: 27 });
147
+ expect(mockedCancel).toHaveBeenCalled();
148
+ });
149
+
150
+ it('hides the Cancel button if onCancel is not provided', () => {
151
+ render(
152
+ <ConfirmationDialog isVisible onConfirm={() => {}}>
153
+ Test Body
154
+ </ConfirmationDialog>,
155
+ );
156
+
157
+ expect(screen.queryByText('Cancel')).not.toBeInTheDocument();
132
158
  });
133
159
  });
@@ -207,7 +207,7 @@ interface ConfirmationDialogProps extends Omit<CoreProps, 'onHide'> {
207
207
  confirmLabel?: string;
208
208
  onConfirm: () => void;
209
209
  cancelLabel?: string;
210
- onCancel: () => void;
210
+ onCancel?: () => void;
211
211
  optionalLabel?: string;
212
212
  onOptional?: () => void;
213
213
  }
@@ -223,12 +223,12 @@ export const ConfirmationDialog = ({
223
223
  cancelLabel = 'Cancel',
224
224
  onCancel,
225
225
  optionalLabel,
226
- onOptional = () => {},
226
+ onOptional,
227
227
  size,
228
228
  }: ConfirmationDialogProps) => (
229
229
  <GenericDialog
230
230
  onHide={onCancel}
231
- closeOnEsc
231
+ closeOnEsc={onCancel != null}
232
232
  isVisible={isVisible}
233
233
  headerIcon={headerIcon}
234
234
  title={title}
@@ -239,12 +239,16 @@ export const ConfirmationDialog = ({
239
239
  <DialogButton variant="primary" onClick={onConfirm}>
240
240
  {confirmLabel}
241
241
  </DialogButton>
242
- {optionalLabel && (
242
+ {onOptional && optionalLabel && (
243
243
  <DialogButton onClick={onOptional}>
244
244
  {optionalLabel}
245
245
  </DialogButton>
246
246
  )}
247
- <DialogButton onClick={onCancel}>{cancelLabel}</DialogButton>
247
+ {onCancel && (
248
+ <DialogButton onClick={onCancel}>
249
+ {cancelLabel}
250
+ </DialogButton>
251
+ )}
248
252
  </>
249
253
  }
250
254
  >
@@ -94,7 +94,7 @@ export default <T,>({
94
94
  <span
95
95
  className={`mdi mdi-chevron-down ${classNames(
96
96
  isActive && 'tw-rotate-180',
97
- size === 'sm' ? 'tw-text-base' : 'tw-text-lg',
97
+ size === 'sm' ? 'tw-text-base' : 'tw-text-lg/none',
98
98
  )}`}
99
99
  />
100
100
  </button>
@@ -60,7 +60,7 @@ interface ConfirmationDialogProps extends Omit<CoreProps, 'onHide'> {
60
60
  confirmLabel?: string;
61
61
  onConfirm: () => void;
62
62
  cancelLabel?: string;
63
- onCancel: () => void;
63
+ onCancel?: () => void;
64
64
  optionalLabel?: string;
65
65
  onOptional?: () => void;
66
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAMA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,eAAe,CAAC;AAEvB,KAAK,SAAS,GAAG;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,IA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