From 982b0fac06e20dbefa285e0413241d1fbbd28244 Mon Sep 17 00:00:00 2001 From: Tim Nguyen <54393192+timngyn@users.noreply.github.com> Date: Mon, 17 Jun 2024 15:42:28 -0700 Subject: [PATCH 01/10] Add resolution for ws (#5323) --- package.json | 3 ++- yarn.lock | 66 ++++++---------------------------------------------- 2 files changed, 9 insertions(+), 60 deletions(-) diff --git a/package.json b/package.json index 70eb46e534b..462a232db5f 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,8 @@ "tough-cookie": "4.1.3", "trim-newlines": "3.0.1", "webpack-dev-middleware": "^5.3.4", - "yaml": "2.2.2" + "yaml": "2.2.2", + "ws": "^8.17.1" }, "devDependencies": { "@aws-amplify/eslint-config-amplify-ui": "0.0.0", diff --git a/yarn.lock b/yarn.lock index 1d1ca964b18..afee4f59a28 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10032,11 +10032,6 @@ astring@^1.8.0: resolved "https://registry.npmjs.org/astring/-/astring-1.8.4.tgz#6d4c5d8de7be2ead9e4a3cc0e2efb8d759378904" integrity sha512-97a+l2LBU3Op3bBQEff79i/E4jMD2ZLFD8rHx9B6mXyB2uQwhJQYfiDqUwtfjF4QA1F2qs//N6Cw8LetMbQjcw== -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - async@^3.2.0, async@^3.2.2: version "3.2.4" resolved "https://registry.npmjs.org/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c" @@ -22846,16 +22841,7 @@ string-natural-compare@^3.0.1: resolved "https://registry.npmjs.org/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -22980,14 +22966,7 @@ stringify-entities@^4.0.0: character-entities-html4 "^2.0.0" character-entities-legacy "^3.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -24900,7 +24879,7 @@ workerpool@6.2.1: resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -24918,15 +24897,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" @@ -24958,32 +24928,10 @@ write-file-atomic@^4.0.2: imurmurhash "^0.1.4" signal-exit "^3.0.7" -ws@8.13.0, ws@^8.11.0, ws@^8.4.2: - version "8.13.0" - resolved "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" - integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== - -ws@8.5.0: - version "8.5.0" - resolved "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" - integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== - -ws@^6.2.2: - version "6.2.2" - resolved "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e" - integrity sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw== - dependencies: - async-limiter "~1.0.0" - -ws@^7, ws@^7.0.0, ws@^7.5.1: - version "7.5.9" - resolved "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" - integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== - -ws@~8.11.0: - version "8.11.0" - resolved "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143" - integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg== +ws@8.13.0, ws@8.5.0, ws@^6.2.2, ws@^7, ws@^7.0.0, ws@^7.5.1, ws@^8.11.0, ws@^8.17.1, ws@^8.4.2, ws@~8.11.0: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== xml-name-validator@^4.0.0: version "4.0.0" From 62f2a4b8065055529b3118db0e594b8f8267eb87 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 13:02:57 -0700 Subject: [PATCH 02/10] Version Packages (#5314) Co-authored-by: github-actions[bot] --- .changeset/chilled-rice-listen.md | 5 ----- examples/next/package.json | 2 +- packages/react-liveness/CHANGELOG.md | 6 ++++++ packages/react-liveness/package.json | 2 +- packages/react-liveness/src/version.ts | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 .changeset/chilled-rice-listen.md diff --git a/.changeset/chilled-rice-listen.md b/.changeset/chilled-rice-listen.md deleted file mode 100644 index d8d3bada649..00000000000 --- a/.changeset/chilled-rice-listen.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@aws-amplify/ui-react-liveness": patch ---- - -fix(liveness): Fix photosensitivity text customization diff --git a/examples/next/package.json b/examples/next/package.json index 9ca9d50a8c7..600a487e2f4 100644 --- a/examples/next/package.json +++ b/examples/next/package.json @@ -13,7 +13,7 @@ "@aws-amplify/geo": "3.0.31", "@aws-amplify/ui-react": "^6.1.12", "@aws-amplify/ui-react-geo": "^2.0.16", - "@aws-amplify/ui-react-liveness": "^3.0.23", + "@aws-amplify/ui-react-liveness": "^3.0.24", "@aws-amplify/ui-react-notifications": "^2.0.20", "@aws-amplify/ui-react-storage": "^3.1.3", "@aws-sdk/credential-providers": "^3.370.0", diff --git a/packages/react-liveness/CHANGELOG.md b/packages/react-liveness/CHANGELOG.md index 7dbecda7d3a..a25bcb1e51a 100644 --- a/packages/react-liveness/CHANGELOG.md +++ b/packages/react-liveness/CHANGELOG.md @@ -1,5 +1,11 @@ # @aws-amplify/ui-react-liveness +## 3.0.24 + +### Patch Changes + +- [#5303](https://github.com/aws-amplify/amplify-ui/pull/5303) [`47fb5ef77`](https://github.com/aws-amplify/amplify-ui/commit/47fb5ef778847c11310e4200bbfed17e9edf250a) Thanks [@esauerbo](https://github.com/esauerbo)! - fix(liveness): Fix photosensitivity text customization + ## 3.0.23 ### Patch Changes diff --git a/packages/react-liveness/package.json b/packages/react-liveness/package.json index 9bc61bc0e32..76348f24b11 100644 --- a/packages/react-liveness/package.json +++ b/packages/react-liveness/package.json @@ -1,6 +1,6 @@ { "name": "@aws-amplify/ui-react-liveness", - "version": "3.0.23", + "version": "3.0.24", "main": "dist/index.js", "module": "dist/esm/index.mjs", "exports": { diff --git a/packages/react-liveness/src/version.ts b/packages/react-liveness/src/version.ts index cf372b58362..14c17101309 100644 --- a/packages/react-liveness/src/version.ts +++ b/packages/react-liveness/src/version.ts @@ -1 +1 @@ -export const VERSION = '3.0.23'; +export const VERSION = '3.0.24'; From 5d075ce800f070b7cfa0bfecd05793b112c16faa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jun 2024 21:29:29 +0000 Subject: [PATCH 03/10] chore(deps): bump socket.io from 4.6.1 to 4.7.5 (#5330) Bumps [socket.io](https://github.com/socketio/socket.io) from 4.6.1 to 4.7.5. - [Release notes](https://github.com/socketio/socket.io/releases) - [Changelog](https://github.com/socketio/socket.io/blob/main/CHANGELOG.md) - [Commits](https://github.com/socketio/socket.io/compare/4.6.1...4.7.5) --- updated-dependencies: - dependency-name: socket.io dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 72 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/yarn.lock b/yarn.lock index afee4f59a28..bbc0a6f0797 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12602,15 +12602,15 @@ end-of-stream@^1.1.0, end-of-stream@^1.4.1: dependencies: once "^1.4.0" -engine.io-parser@~5.0.3: - version "5.0.6" - resolved "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.6.tgz#7811244af173e157295dec9b2718dfe42a64ef45" - integrity sha512-tjuoZDMAdEhVnSFleYPCtdL2GXwVTGtNjoeJd9IhIG3C1xs9uwxqRNEu5WpnDZCaozwVlK/nuQhpodhXSIMaxw== +engine.io-parser@~5.2.1: + version "5.2.2" + resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.2.2.tgz#37b48e2d23116919a3453738c5720455e64e1c49" + integrity sha512-RcyUFKA93/CXH20l4SoVvzZfrSDMOTUS3bWVpTt2FuFP+XYrL8i8oonHP7WInRyVHXh0n/ORtoeiE1os+8qkSw== -engine.io@~6.4.1: - version "6.4.2" - resolved "https://registry.npmjs.org/engine.io/-/engine.io-6.4.2.tgz#ffeaf68f69b1364b0286badddf15ff633476473f" - integrity sha512-FKn/3oMiJjrOEOeUub2WCox6JhxBXq/Zn3fZOMCBxKnNYtsdKjxhl7yR3fZhM9PV+rdE75SU5SYMc+2PGzo+Tg== +engine.io@~6.5.2: + version "6.5.5" + resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.5.5.tgz#430b80d8840caab91a50e9e23cb551455195fc93" + integrity sha512-C5Pn8Wk+1vKBoHghJODM63yk8MvrO9EWZUfkAt5HAqIgPE4/8FF0PEGHXtEd40l223+cE5ABWuPzm38PHFXfMA== dependencies: "@types/cookie" "^0.4.1" "@types/cors" "^2.8.12" @@ -12620,8 +12620,8 @@ engine.io@~6.4.1: cookie "~0.4.1" cors "~2.8.5" debug "~4.3.1" - engine.io-parser "~5.0.3" - ws "~8.11.0" + engine.io-parser "~5.2.1" + ws "~8.17.1" enhanced-resolve@^5.10.0: version "5.12.0" @@ -22524,25 +22524,26 @@ socket.io-adapter@~2.5.2: dependencies: ws "~8.11.0" -socket.io-parser@~4.2.1: - version "4.2.3" - resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.3.tgz#926bcc6658e2ae0883dc9dee69acbdc76e4e3667" - integrity sha512-JMafRntWVO2DCJimKsRTh/wnqVvO4hrfwOqtO7f+uzwsQMuxO6VwImtYxaQ+ieoyshWOTJyV0fA21lccEXRPpQ== +socket.io-parser@~4.2.4: + version "4.2.4" + resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.4.tgz#c806966cf7270601e47469ddeec30fbdfda44c83" + integrity sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew== dependencies: "@socket.io/component-emitter" "~3.1.0" debug "~4.3.1" socket.io@^4.4.1: - version "4.6.1" - resolved "https://registry.npmjs.org/socket.io/-/socket.io-4.6.1.tgz#62ec117e5fce0692fa50498da9347cfb52c3bc70" - integrity sha512-KMcaAi4l/8+xEjkRICl6ak8ySoxsYG+gG6/XfRCPJPQ/haCRIJBTL4wIl8YCsmtaBovcAXGLOShyVWQ/FG8GZA== + version "4.7.5" + resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.7.5.tgz#56eb2d976aef9d1445f373a62d781a41c7add8f8" + integrity sha512-DmeAkF6cwM9jSfmp6Dr/5/mfMwb5Z5qRrSXLpo3Fq5SqyU8CMF15jIN4ZhfSwu35ksM1qmHZDQ/DK5XTccSTvA== dependencies: accepts "~1.3.4" base64id "~2.0.0" + cors "~2.8.5" debug "~4.3.2" - engine.io "~6.4.1" + engine.io "~6.5.2" socket.io-adapter "~2.5.2" - socket.io-parser "~4.2.1" + socket.io-parser "~4.2.4" sockjs@^0.3.24: version "0.3.24" @@ -22841,7 +22842,16 @@ string-natural-compare@^3.0.1: resolved "https://registry.npmjs.org/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -22966,7 +22976,14 @@ stringify-entities@^4.0.0: character-entities-html4 "^2.0.0" character-entities-legacy "^3.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -24879,7 +24896,7 @@ workerpool@6.2.1: resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -24897,6 +24914,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" @@ -24928,7 +24954,7 @@ write-file-atomic@^4.0.2: imurmurhash "^0.1.4" signal-exit "^3.0.7" -ws@8.13.0, ws@8.5.0, ws@^6.2.2, ws@^7, ws@^7.0.0, ws@^7.5.1, ws@^8.11.0, ws@^8.17.1, ws@^8.4.2, ws@~8.11.0: +ws@8.13.0, ws@8.5.0, ws@^6.2.2, ws@^7, ws@^7.0.0, ws@^7.5.1, ws@^8.11.0, ws@^8.17.1, ws@^8.4.2, ws@~8.11.0, ws@~8.17.1: version "8.17.1" resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== From 2f2503f807824b71d4d78ed05741d34670bb06c7 Mon Sep 17 00:00:00 2001 From: Emma Sauerborn <70536670+esauerbo@users.noreply.github.com> Date: Thu, 20 Jun 2024 13:48:00 -0400 Subject: [PATCH 04/10] chore: update PR template and contributing guide (#5315) --- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- CONTRIBUTING.md | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 366924fe6b2..0658cda8422 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -22,8 +22,8 @@ the requirements below. - [ ] Have read the [Pull Request Guidelines](https://github.com/aws-amplify/amplify-ui/blob/main/CONTRIBUTING.md) - [ ] PR description included -- [ ] Relevant documentation is changed or added (and PR referenced) - [ ] `yarn test` passes and tests are updated/added -- [ ] No side effects or [`sideEffects`](https://github.com/aws-amplify/amplify-ui/blob/main/packages/react/CONTRIBUTING.md#code-standards) field updated +- [ ] PR title and commit messages follow [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) syntax +- [ ] _If this change should result in a version bump_, [changeset added](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) (This can be done after creating the PR.) This does not apply to changes made to `docs`, `e2e`, `examples`, or other private packages. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b47982f0534..5224fdd2228 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,8 +44,10 @@ You should open an issue to discuss your pull request, unless it's a trivial cha 1. [`nvm install`](https://github.com/nvm-sh/nvm) 1. [`nvm use`](https://github.com/nvm-sh/nvm) 1. `yarn setup` -1. Within your fork, create a new branch based on the issue you're addressing -- `git checkout -b angular/remove-browser-module` +1. Within your fork, create a new branch based on the issue you're addressing, e.g. `git checkout -b angular/remove-browser-module` +1. Commit your code using [conventional commit messages](https://www.conventionalcommits.org/en/v1.0.0/#summary), e.g. `git commit -m "chore: remove browser module"`. 1. Once your work is committed, validate your changes according to [local development guides](#local-development-guides). +1. If this is a change to any customer-facing aspect of a component, for example a new prop, feature, or a breaking change, update or add relevant documentation. If this is a large change, documentation updates can be made in a separate PR, but should be noted as a followup in the PR description. See the specific contributing guide for documentation [here](docs/README.md#contributing) 1. Push your branch with `git push origin -u` 1. Open a PR against this repo from your newly published branch. 1. Add a [changeset](https://github.com/changesets/changesets) that describes your changes. More info [here](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md). Please make sure that your changeset only bumps `@aws-amplify/*` packages and does not bump any of private packages like `docs`, `e2e`, `examples`, etc. If you only updated a private package like `docs`, `e2e`, or `examples`, skip this step. From 758d1511fce390e424c4667926075ac2e961b075 Mon Sep 17 00:00:00 2001 From: Caleb Pollman Date: Thu, 20 Jun 2024 18:51:07 -0700 Subject: [PATCH 05/10] feat(react): add createPrimitivesContext and types (#5331) --- .../createPrimitivesContext.spec.tsx | 50 ++++++++++ .../primitives/createPrimitivesContext.tsx | 27 ++++++ .../context/primitives/defaultPrimitives.tsx | 14 +++ .../react/src/context/primitives/index.ts | 3 + .../react/src/context/primitives/types.ts | 91 +++++++++++++++++++ 5 files changed, 185 insertions(+) create mode 100644 packages/react/src/context/primitives/__tests__/createPrimitivesContext.spec.tsx create mode 100644 packages/react/src/context/primitives/createPrimitivesContext.tsx create mode 100644 packages/react/src/context/primitives/defaultPrimitives.tsx create mode 100644 packages/react/src/context/primitives/index.ts create mode 100644 packages/react/src/context/primitives/types.ts diff --git a/packages/react/src/context/primitives/__tests__/createPrimitivesContext.spec.tsx b/packages/react/src/context/primitives/__tests__/createPrimitivesContext.spec.tsx new file mode 100644 index 00000000000..ca2df92859b --- /dev/null +++ b/packages/react/src/context/primitives/__tests__/createPrimitivesContext.spec.tsx @@ -0,0 +1,50 @@ +import React from 'react'; +import { renderHook } from '@testing-library/react-hooks'; + +import createPrimitivesContext from '../createPrimitivesContext'; +import { PrimitiveButton, PrimitiveView } from '../defaultPrimitives'; + +const primitives = { Button: PrimitiveButton, View: PrimitiveView }; + +describe('createPrimitivesContext', () => { + it('usePrimitive exposes the expected primitives', () => { + const { usePrimitive } = createPrimitivesContext(primitives); + + const { + result: { current: Button }, + } = renderHook(() => usePrimitive('Button')); + const { + result: { current: View }, + } = renderHook(() => usePrimitive('View')); + + expect(Button).toBe(PrimitiveButton); + expect(View).toBe(View); + }); + + it('Passing `primitives` PrimitivesProvider overrides the default `primitives`', () => { + const { PrimitivesProvider, usePrimitive } = + createPrimitivesContext(primitives); + + const OtherButton = () => <>Hi; + const OtherView = () => <>Hi; + const wrapper = (props: { children?: React.ReactNode }) => ( + + ); + + const { + result: { current: Button }, + } = renderHook(() => usePrimitive('Button'), { wrapper }); + const { + result: { current: View }, + } = renderHook(() => usePrimitive('View'), { wrapper }); + + expect(Button).not.toBe(PrimitiveButton); + expect(Button).toBe(OtherButton); + + expect(View).not.toBe(PrimitiveView); + expect(View).toBe(OtherView); + }); +}); diff --git a/packages/react/src/context/primitives/createPrimitivesContext.tsx b/packages/react/src/context/primitives/createPrimitivesContext.tsx new file mode 100644 index 00000000000..7a7bb416097 --- /dev/null +++ b/packages/react/src/context/primitives/createPrimitivesContext.tsx @@ -0,0 +1,27 @@ +import React from 'react'; + +import { RenderNothing } from '@aws-amplify/ui-react-core'; +import { Primitives, PrimitivesProviderProps } from './types'; + +interface CreatePrimitivesContextResult { + PrimitivesProvider: (props: PrimitivesProviderProps) => JSX.Element; + usePrimitive: (name: K) => T[K]; +} + +const createPrimitivesContext = ( + defaultValue: T +): CreatePrimitivesContextResult => { + const PrimitivesContext = React.createContext(defaultValue); + return { + PrimitivesProvider: ({ children, primitives }): JSX.Element => ( + + {children} + + ), + usePrimitive: (name) => + // fallback to `RenderNothing` on lookup fail + React.useContext(PrimitivesContext)?.[name] ?? RenderNothing, + }; +}; + +export default createPrimitivesContext; diff --git a/packages/react/src/context/primitives/defaultPrimitives.tsx b/packages/react/src/context/primitives/defaultPrimitives.tsx new file mode 100644 index 00000000000..fdfdef9effb --- /dev/null +++ b/packages/react/src/context/primitives/defaultPrimitives.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { DefaultPrimitives } from './types'; + +export const PrimitiveButton: DefaultPrimitives['Button'] = React.forwardRef( + ({ isDisabled, ...rest }, ref) => ( +