diff --git a/packages/code-du-travail-frontend/__tests__/__snapshots__/a-propos.test.tsx.snap b/packages/code-du-travail-frontend/__tests__/__snapshots__/a-propos.test.tsx.snap index f7db31a5d6..4ef62e527d 100644 --- a/packages/code-du-travail-frontend/__tests__/__snapshots__/a-propos.test.tsx.snap +++ b/packages/code-du-travail-frontend/__tests__/__snapshots__/a-propos.test.tsx.snap @@ -62,7 +62,7 @@ exports[` should render 1`] = ` > -`; - -exports[` should render suggestions 1`] = ` -
- -
-`; diff --git a/packages/code-du-travail-frontend/src/search/__tests__/__snapshots__/SearchHero.test.js.snap b/packages/code-du-travail-frontend/src/search/__tests__/__snapshots__/SearchHero.test.js.snap deleted file mode 100644 index 993a0e3526..0000000000 --- a/packages/code-du-travail-frontend/src/search/__tests__/__snapshots__/SearchHero.test.js.snap +++ /dev/null @@ -1,786 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render 1`] = ` -
-
-
-
-

- Bienvenue sur -
- - le Code du travail numérique - -

-

- Obtenez les réponses à vos questions sur le droit du travail. -

-
- -
- -
- -
-
-
-
-`; diff --git a/packages/react-ui/package.json b/packages/react-ui/package.json index 828fa1d3c1..ab3abb76a9 100644 --- a/packages/react-ui/package.json +++ b/packages/react-ui/package.json @@ -8,8 +8,10 @@ "description": "Composants ReactJS", "main": "lib/index.js", "files": [ - "lib" + "lib", + "types.d.ts" ], + "types": "./types.d.ts", "scripts": { "build": "tsc", "build:dev": "swc ./src -d lib --strip-leading-paths", diff --git a/packages/react-ui/src/ScreenReaderOnly/index.js b/packages/react-ui/src/ScreenReaderOnly/index.js index 1915bbea58..8cf0108956 100644 --- a/packages/react-ui/src/ScreenReaderOnly/index.js +++ b/packages/react-ui/src/ScreenReaderOnly/index.js @@ -2,17 +2,24 @@ import PropTypes from "prop-types"; import React from "react"; import styled from "styled-components"; -export const ScreenReaderOnly = React.forwardRef(({ type, ...props }, ref) => { - return type === "inline" ? ( - - ) : ( - - ); -}); +export const ScreenReaderOnly = React.forwardRef( + ({ type, children, ...props }, ref) => { + return type === "inline" ? ( + + {children} + + ) : ( + + {children} + + ); + } +); ScreenReaderOnly.displayName = "ScreenReaderOnly"; ScreenReaderOnly.propTypes = { + children: PropTypes.node, type: PropTypes.oneOf(["block", "inline"]), }; diff --git a/packages/react-ui/types.d.ts b/packages/react-ui/types.d.ts new file mode 100644 index 0000000000..2bb011bbc8 --- /dev/null +++ b/packages/react-ui/types.d.ts @@ -0,0 +1 @@ +declare module "@socialgouv/cdtn-ui"; diff --git a/yarn.lock b/yarn.lock index 8cd08bab22..41877ef8c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2164,6 +2164,15 @@ __metadata: languageName: node linkType: hard +"@babel/runtime@npm:^7.24.5": + version: 7.24.7 + resolution: "@babel/runtime@npm:7.24.7" + dependencies: + regenerator-runtime: ^0.14.0 + checksum: d17f29eed6f848ac15cdf4202a910b741facfb0419a9d79e5c7fa37df6362fc3227f1cc2e248cc6db5e53ddffb4caa6686c488e6e80ce3d29c36a4e74c8734ea + languageName: node + linkType: hard + "@babel/template@npm:^7.18.10, @babel/template@npm:^7.20.7, @babel/template@npm:^7.21.9, @babel/template@npm:^7.3.3": version: 7.21.9 resolution: "@babel/template@npm:7.21.9" @@ -2356,7 +2365,6 @@ __metadata: "@types/cors": ^2.8.13 "@types/debounce-promise": ^3.1.4 "@types/jest": ^29.5.12 - "@types/react-autosuggest": ^10.1.6 "@ungap/url-search-params": ^0.2.2 cors: ^2.8.5 cypress: ^13.9.0 @@ -2364,6 +2372,7 @@ __metadata: cypress-iframe: ^1.0.1 date-fns: ^2.22.1 debounce-promise: ^3.1.2 + downshift: ^9.0.6 eslint: 8.57.0 eslint-config-next: 14.1.0 eslint-plugin-cypress: ^2.12.1 @@ -2390,7 +2399,6 @@ __metadata: prop-types: ^15.8.1 publicodes: 1.0.0-beta.60 react: ^18.2.0 - react-autosuggest: 10.1.0 react-dom: ^18.2.0 react-final-form: ^6.5.3 react-final-form-arrays: ^3.1.3 @@ -8372,15 +8380,6 @@ __metadata: languageName: node linkType: hard -"@types/react-autosuggest@npm:^10.1.6": - version: 10.1.6 - resolution: "@types/react-autosuggest@npm:10.1.6" - dependencies: - "@types/react": "*" - checksum: 61a3dc9548607d4abef1463a35e7409540e5893ad7400e0a0fb3617f1a97967822f7ad0f7146824aa188648efe8db377549599db80d5d86c5b79cd0b19792227 - languageName: node - linkType: hard - "@types/react-dom@npm:<18.0.0": version: 17.0.20 resolution: "@types/react-dom@npm:17.0.20" @@ -11038,6 +11037,13 @@ __metadata: languageName: node linkType: hard +"compute-scroll-into-view@npm:^3.1.0": + version: 3.1.0 + resolution: "compute-scroll-into-view@npm:3.1.0" + checksum: 224549d6dd1d40342230de5c6d69cac5c3ed5c2f6a4437310f959aadc8db1d20b03da44a6e0de14d9419c6f9130ce51ec99a91b11bde55d4640f10551c89c213 + languageName: node + linkType: hard + "concat-map@npm:0.0.1": version: 0.0.1 resolution: "concat-map@npm:0.0.1" @@ -12210,6 +12216,21 @@ __metadata: languageName: node linkType: hard +"downshift@npm:^9.0.6": + version: 9.0.6 + resolution: "downshift@npm:9.0.6" + dependencies: + "@babel/runtime": ^7.24.5 + compute-scroll-into-view: ^3.1.0 + prop-types: ^15.8.1 + react-is: 18.2.0 + tslib: ^2.6.2 + peerDependencies: + react: ">=16.12.0" + checksum: 3b080426ffed5598df568ebace5d728dc92968bda5f9b8e2182f623c57ce16b4b7baebd7ea602530b40af18e72a7bf56c439606944a0dd1cd8eaadb8004d52fa + languageName: node + linkType: hard + "duplexer@npm:^0.1.1, duplexer@npm:^0.1.2": version: 0.1.2 resolution: "duplexer@npm:0.1.2" @@ -12554,13 +12575,6 @@ __metadata: languageName: node linkType: hard -"es6-promise@npm:^4.2.8": - version: 4.2.8 - resolution: "es6-promise@npm:4.2.8" - checksum: 95614a88873611cb9165a85d36afa7268af5c03a378b35ca7bda9508e1d4f1f6f19a788d4bc755b3fd37c8ebba40782018e02034564ff24c9d6fa37e959ad57d - languageName: node - linkType: hard - "es6-symbol@npm:^3.1.1, es6-symbol@npm:^3.1.3": version: 3.1.3 resolution: "es6-symbol@npm:3.1.3" @@ -19575,13 +19589,6 @@ __metadata: languageName: node linkType: hard -"object-assign@npm:^3.0.0": - version: 3.0.0 - resolution: "object-assign@npm:3.0.0" - checksum: 56c66a77318aea95b11bd16a65c313e98786cea1db673a7fdd3bc92aced671b35f62a9819ad9cf7846921c773818329636cda5cd1b7c4fa0ce9908440e091dac - languageName: node - linkType: hard - "object-assign@npm:^4, object-assign@npm:^4.0.1, object-assign@npm:^4.1.1": version: 4.1.1 resolution: "object-assign@npm:4.1.1" @@ -21268,21 +21275,6 @@ __metadata: languageName: node linkType: hard -"react-autosuggest@npm:10.1.0": - version: 10.1.0 - resolution: "react-autosuggest@npm:10.1.0" - dependencies: - es6-promise: ^4.2.8 - prop-types: ^15.7.2 - react-themeable: ^1.1.0 - section-iterator: ^2.0.0 - shallow-equal: ^1.2.1 - peerDependencies: - react: ">=16.3.0" - checksum: 3526b02bb1938374c2a0d108a03666eae24cddd8bef7686e7f6271bb4c25ad34f8b09e84d1cc2e9206aff577a742c1f8481964e75442a9e080326676ad71f8ae - languageName: node - linkType: hard - "react-clientside-effect@npm:^1.2.6": version: 1.2.6 resolution: "react-clientside-effect@npm:1.2.6" @@ -21470,6 +21462,13 @@ __metadata: languageName: node linkType: hard +"react-is@npm:18.2.0, react-is@npm:^18.0.0": + version: 18.2.0 + resolution: "react-is@npm:18.2.0" + checksum: e72d0ba81b5922759e4aff17e0252bd29988f9642ed817f56b25a3e217e13eea8a7f2322af99a06edb779da12d5d636e9fda473d620df9a3da0df2a74141d53e + languageName: node + linkType: hard + "react-is@npm:^16.13.1, react-is@npm:^16.7.0": version: 16.13.1 resolution: "react-is@npm:16.13.1" @@ -21484,13 +21483,6 @@ __metadata: languageName: node linkType: hard -"react-is@npm:^18.0.0": - version: 18.2.0 - resolution: "react-is@npm:18.2.0" - checksum: e72d0ba81b5922759e4aff17e0252bd29988f9642ed817f56b25a3e217e13eea8a7f2322af99a06edb779da12d5d636e9fda473d620df9a3da0df2a74141d53e - languageName: node - linkType: hard - "react-lifecycles-compat@npm:^3.0.0": version: 3.0.4 resolution: "react-lifecycles-compat@npm:3.0.4" @@ -21628,15 +21620,6 @@ __metadata: languageName: node linkType: hard -"react-themeable@npm:^1.1.0": - version: 1.1.0 - resolution: "react-themeable@npm:1.1.0" - dependencies: - object-assign: ^3.0.0 - checksum: 80d8fa67d15f3136ae8054bfbecc2f1a396b7cda4f10380e13e8f344b07543a55adfb5aca0cf741071e406d8115ff3ea8e361476a086ba5ad55a1feb9cb9ae7a - languageName: node - linkType: hard - "react-uid@npm:^2.3.1": version: 2.3.3 resolution: "react-uid@npm:2.3.3" @@ -22453,13 +22436,6 @@ __metadata: languageName: node linkType: hard -"section-iterator@npm:^2.0.0": - version: 2.0.0 - resolution: "section-iterator@npm:2.0.0" - checksum: d11ae54205baf1ccea5f847b3b5cd9394128ac1051b4ac236d145c9b386e5dd274371a63991e575e20373bacd1c287bfe6159ddf366cb21f30b123e185e6bc7d - languageName: node - linkType: hard - "secure-json-parse@npm:^2.4.0": version: 2.7.0 resolution: "secure-json-parse@npm:2.7.0" @@ -22652,13 +22628,6 @@ __metadata: languageName: node linkType: hard -"shallow-equal@npm:^1.2.1": - version: 1.2.1 - resolution: "shallow-equal@npm:1.2.1" - checksum: 4f1645cc516e7754c4438db687e1da439a5f29a7dba2ba90c5f88e5708aeb17bc4355ba45cad805b0e95dc898e37d8bf6d77d854919c7512f89939986cff8cd1 - languageName: node - linkType: hard - "shallowequal@npm:^1.1.0": version: 1.1.0 resolution: "shallowequal@npm:1.1.0" @@ -24472,6 +24441,13 @@ __metadata: languageName: node linkType: hard +"tslib@npm:^2.6.2": + version: 2.6.3 + resolution: "tslib@npm:2.6.3" + checksum: 74fce0e100f1ebd95b8995fbbd0e6c91bdd8f4c35c00d4da62e285a3363aaa534de40a80db30ecfd388ed7c313c42d930ee0eaf108e8114214b180eec3dbe6f5 + languageName: node + linkType: hard + "tsutils@npm:^3.21.0": version: 3.21.0 resolution: "tsutils@npm:3.21.0"