@mtes-mct/monitor-ui 17.0.0 → 17.1.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 +21 -0
- package/cypress/global.d.ts +1 -0
- package/cypress/index.js +13 -8
- package/fields/CheckPicker.d.ts.map +1 -1
- package/index.js +2 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [17.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v16.5.0...v17.0.0) (2024-05-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### ⚠ BREAKING CHANGES
|
|
5
|
+
|
|
6
|
+
* **elements:** `<IconButton />` is now a span instead of a div.
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **elements:** switch IconBox wrapper element from a div to a span ([4a17f10](https://github.com/MTES-MCT/monitor-ui/commit/4a17f10699bfe59c6484641e0759741a89dbcc88))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Buid System & Dependencies
|
|
14
|
+
|
|
15
|
+
* **deps:** bump @babel/runtime from 7.24.4 to 7.24.5 ([0c6b0a6](https://github.com/MTES-MCT/monitor-ui/commit/0c6b0a609e79c6870ae70c36cd52ed2ec5cb1084))
|
|
16
|
+
* **deps:** bump ejs from 3.1.9 to 3.1.10 ([5a3e05a](https://github.com/MTES-MCT/monitor-ui/commit/5a3e05a4139084163cdbed69929af0056031fbc9))
|
|
17
|
+
* **dev-deps:** bump @babel/preset-react from 7.22.15 to 7.24.1 ([a78b5b3](https://github.com/MTES-MCT/monitor-ui/commit/a78b5b37108683db184a416259ee04a0551ef44a))
|
|
18
|
+
* **dev-deps:** bump react-is from 18.2.0 to 18.3.1 ([258a53d](https://github.com/MTES-MCT/monitor-ui/commit/258a53d57d981fd2c92a167627fd5620e48682d0))
|
|
19
|
+
* **dev-deps:** bump rollup-plugin-sizes from 1.0.5 to 1.0.6 ([8a19fe6](https://github.com/MTES-MCT/monitor-ui/commit/8a19fe605c9f6e10612e2b37f1b561ec1cb3e375))
|
|
20
|
+
* **dev-deps:** bump semantic-release from 23.0.0 to 23.0.8 ([47e7c23](https://github.com/MTES-MCT/monitor-ui/commit/47e7c23ab207cbc950503bed03909ccdf70fb717))
|
|
21
|
+
|
|
1
22
|
## [16.5.0](https://github.com/MTES-MCT/monitor-ui/compare/v16.4.0...v16.5.0) (2024-05-01)
|
|
2
23
|
|
|
3
24
|
|
package/cypress/global.d.ts
CHANGED
package/cypress/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// I have no idea why I have to add this dirty hack of setting an external variable
|
|
2
2
|
// instead of using a cleaner FP `.filter()`
|
|
3
3
|
// but real experience made me think it greatly improves results stability.
|
|
4
|
-
function
|
|
4
|
+
function findElementByText(selector, text, { fallbackSelector, index = 0, inElement } = {}) {
|
|
5
5
|
const trimmedText = text.trim();
|
|
6
6
|
if (inElement) {
|
|
7
7
|
let foundElement;
|
|
@@ -47,7 +47,7 @@ function findElementBytext(selector, text, { fallbackSelector, index = 0, inElem
|
|
|
47
47
|
|
|
48
48
|
const RETRIES = 5;
|
|
49
49
|
function findButton(label, preSelector, { index, prevSubjectElement }) {
|
|
50
|
-
const buttonElement =
|
|
50
|
+
const buttonElement = findElementByText(`${preSelector}button`, label, {
|
|
51
51
|
index,
|
|
52
52
|
inElement: prevSubjectElement
|
|
53
53
|
});
|
|
@@ -62,7 +62,7 @@ function findButton(label, preSelector, { index, prevSubjectElement }) {
|
|
|
62
62
|
if (buttonElementByTitle) {
|
|
63
63
|
return buttonElementByTitle;
|
|
64
64
|
}
|
|
65
|
-
const menuItemElement =
|
|
65
|
+
const menuItemElement = findElementByText(`${preSelector}[role="menuitem"]`, label, {
|
|
66
66
|
index,
|
|
67
67
|
inElement: prevSubjectElement
|
|
68
68
|
});
|
|
@@ -206,6 +206,7 @@ function checkMultiRadioOption(fieldsetElement, value, _label, force) {
|
|
|
206
206
|
const DEFAULT_OPTIONS = {
|
|
207
207
|
delay: 10,
|
|
208
208
|
force: true,
|
|
209
|
+
index: 0,
|
|
209
210
|
retries: 5
|
|
210
211
|
};
|
|
211
212
|
|
|
@@ -809,11 +810,13 @@ function fill(label, value, options = {}) {
|
|
|
809
810
|
try {
|
|
810
811
|
// =========================================================================
|
|
811
812
|
// If it's a field labelled by a `<label />` element
|
|
812
|
-
const labelElement =
|
|
813
|
+
const labelElement = findElementByText('label', label, {
|
|
814
|
+
index: controlledOptions.index
|
|
815
|
+
});
|
|
813
816
|
if (labelElement) {
|
|
814
817
|
const fieldElement = findElementParentBySelector(labelElement, '.Element-Field');
|
|
815
818
|
if (!fieldElement) {
|
|
816
|
-
throwError(`Could not find '.Element-Field' in field with label "${label}".`);
|
|
819
|
+
throwError(`Could not find '.Element-Field' in field with label "${label}" at index "${controlledOptions.index}".`);
|
|
817
820
|
}
|
|
818
821
|
switch(true){
|
|
819
822
|
// ---------------------------------------------------------------------
|
|
@@ -876,11 +879,13 @@ function fill(label, value, options = {}) {
|
|
|
876
879
|
}
|
|
877
880
|
// =========================================================================
|
|
878
881
|
// If it's a field labelled by a `<legend />` element
|
|
879
|
-
const legendElement =
|
|
882
|
+
const legendElement = findElementByText('legend', label, {
|
|
883
|
+
index: controlledOptions.index
|
|
884
|
+
});
|
|
880
885
|
if (legendElement) {
|
|
881
886
|
const fieldsetElement = findElementParentBySelector(legendElement, '.Element-Fieldset');
|
|
882
887
|
if (!fieldsetElement) {
|
|
883
|
-
throwError(`Could not find '.Element-Fieldset' in field with \`<legend />\` "${label}".`);
|
|
888
|
+
throwError(`Could not find '.Element-Fieldset' in field with \`<legend />\` "${label}" at index "${controlledOptions.index}".`);
|
|
884
889
|
}
|
|
885
890
|
switch(true){
|
|
886
891
|
// ---------------------------------------------------------------------
|
|
@@ -935,7 +940,7 @@ function fill(label, value, options = {}) {
|
|
|
935
940
|
name: 'fill'
|
|
936
941
|
}).error(normalizedError);
|
|
937
942
|
throwError([
|
|
938
|
-
`Could not find or fill field with label or legend "${label}" after ${TOTAL_RETRIES} attempts.`,
|
|
943
|
+
`Could not find or fill field with label or legend "${label}" at index "${controlledOptions.index}" after ${TOTAL_RETRIES} attempts.`,
|
|
939
944
|
`This error was thrown: “${normalizedError.message}”`,
|
|
940
945
|
`Please check the Cypress "- ERROR" log above for more details.`
|
|
941
946
|
].join('\n'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckPicker.d.ts","sourceRoot":"","sources":["../../src/fields/CheckPicker.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAoC,KAAK,gBAAgB,IAAI,sBAAsB,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"CheckPicker.d.ts","sourceRoot":"","sources":["../../src/fields/CheckPicker.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAoC,KAAK,gBAAgB,IAAI,sBAAsB,EAAE,MAAM,QAAQ,CAAA;AAQ1G,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAKxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,MAAM,gBAAgB,CAAC,WAAW,SAAS,eAAe,GAAG,MAAM,IAAI,IAAI,CAC/E,sBAAsB,CAAC,MAAM,CAAC,EAC9B,IAAI,GAAG,WAAW,GAAG,MAAM,GAAG,cAAc,GAAG,IAAI,GAAG,UAAU,GAAG,gBAAgB,GAAG,OAAO,GAAG,UAAU,CAC3G,GAAG;IACF,YAAY,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAA;IAChD,+EAA+E;IAC/E,0BAA0B,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/C,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC1C,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAChC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,SAAS,KAAK,UAAU,CAAC,IAAI,CAAC,CAAA;IACrE,cAAc,CAAC,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IAC9C,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAA;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,KAAK,CAAC,EAAE,WAAW,EAAE,GAAG,SAAS,CAAA;CAClC,CAAA;AACD,wBAAgB,WAAW,CAAC,WAAW,SAAS,eAAe,GAAG,MAAM,EAAE,EACxE,SAAS,EACT,YAAY,EACZ,0BAA8B,EAC9B,QAAgB,EAChB,KAAK,EACL,oBAA4B,EAC5B,aAAqB,EACrB,OAAe,EACf,UAAkB,EAClB,aAAqB,EACrB,uBAA+B,EAC/B,KAAK,EACL,QAAQ,EACR,OAAO,EACP,cAAc,EACd,UAAU,EACV,QAAgB,EAChB,UAAkB,EAClB,KAAK,EACL,KAAK,EACL,GAAG,aAAa,EACjB,EAAE,gBAAgB,CAAC,WAAW,CAAC,2CAwG/B"}
|
package/index.js
CHANGED
|
@@ -54894,13 +54894,7 @@ function CheckPicker({ className, customSearch, customSearchMinQueryLength = 1,
|
|
|
54894
54894
|
const controlledError = useMemo(()=>normalizeString(error), [
|
|
54895
54895
|
error
|
|
54896
54896
|
]);
|
|
54897
|
-
const hasError =
|
|
54898
|
-
controlledError
|
|
54899
|
-
]);
|
|
54900
|
-
const key = useKey([
|
|
54901
|
-
disabled,
|
|
54902
|
-
originalProps.name
|
|
54903
|
-
]);
|
|
54897
|
+
const hasError = Boolean(controlledError);
|
|
54904
54898
|
const selectedRsuiteValue = useMemo(()=>getRsuiteDataItemValuesFromOptionValues(value, optionValueKey), [
|
|
54905
54899
|
optionValueKey,
|
|
54906
54900
|
value
|
|
@@ -54983,7 +54977,7 @@ function CheckPicker({ className, customSearch, customSearchMinQueryLength = 1,
|
|
|
54983
54977
|
size: originalProps.size ?? 'sm',
|
|
54984
54978
|
value: selectedRsuiteValue,
|
|
54985
54979
|
...originalProps
|
|
54986
|
-
}
|
|
54980
|
+
})
|
|
54987
54981
|
}),
|
|
54988
54982
|
!isErrorMessageHidden && hasError && /*#__PURE__*/ jsx(FieldError, {
|
|
54989
54983
|
children: controlledError
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtes-mct/monitor-ui",
|
|
3
3
|
"description": "Common React components, hooks, utilities and CSS stylesheets for MonitorFish, MonitorEnv and RapportNav.",
|
|
4
|
-
"version": "17.
|
|
4
|
+
"version": "17.1.0",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|