chore(turbo): update coldwired and fix focus in turbo

This commit is contained in:
Paul Chavard 2023-04-27 09:39:12 +02:00
parent a59f44bcbc
commit 5343c229a2
4 changed files with 54 additions and 23 deletions

View file

@ -34,7 +34,13 @@ export class TurboController extends ApplicationController {
connect() {
this.#actions = new Actions({
element: document.body,
schema: { forceAttribute: 'data-turbo-force', hiddenClassName: 'hidden' },
schema: {
forceAttribute: 'data-turbo-force',
permanentAttribute: 'data-turbo-permanent',
focusGroupAttribute: 'data-turbo-focus-group',
focusDirectionAttribute: 'data-turbo-focus-direction',
hiddenClassName: 'hidden'
},
debug: false
});

View file

@ -1,7 +1,8 @@
{
"dependencies": {
"@coldwired/actions": "^0.8.1",
"@coldwired/turbo-stream": "^0.8.1",
"@coldwired/actions": "^0.10.0",
"@coldwired/turbo-stream": "^0.10.0",
"@coldwired/utils": "^0.10.0",
"@gouvfr/dsfr": "^1.7.2",
"@graphiql/plugin-explorer": "^0.1.15",
"@graphiql/toolkit": "^0.8.3",

View file

@ -0,0 +1,24 @@
diff --git a/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js b/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js
index cfe4084..fd54933 100644
--- a/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js
+++ b/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js
@@ -802,6 +802,7 @@ class FormSubmission {
var _a;
this.state = FormSubmissionState.stopped;
(_a = this.submitter) === null || _a === void 0 ? void 0 : _a.removeAttribute("disabled");
+ (_a = this.submitter) === null || _a === void 0 ? void 0 : _a.focus();
this.resetSubmitterText();
dispatch("turbo:submit-end", {
target: this.formElement,
diff --git a/node_modules/@hotwired/turbo/dist/turbo.es2017-umd.js b/node_modules/@hotwired/turbo/dist/turbo.es2017-umd.js
index 303ecf2..08dd969 100644
--- a/node_modules/@hotwired/turbo/dist/turbo.es2017-umd.js
+++ b/node_modules/@hotwired/turbo/dist/turbo.es2017-umd.js
@@ -808,6 +808,7 @@ Copyright © 2023 37signals LLC
var _a;
this.state = FormSubmissionState.stopped;
(_a = this.submitter) === null || _a === void 0 ? void 0 : _a.removeAttribute("disabled");
+ (_a = this.submitter) === null || _a === void 0 ? void 0 : _a.focus();
this.resetSubmitterText();
dispatch("turbo:submit-end", {
target: this.formElement,

View file

@ -1287,28 +1287,28 @@
"@babel/helper-validator-identifier" "^7.19.1"
to-fast-properties "^2.0.0"
"@coldwired/actions@^0.8.1":
version "0.8.1"
resolved "https://registry.yarnpkg.com/@coldwired/actions/-/actions-0.8.1.tgz#c309a2a38f5a0af11c03c4cf8e16c6496c7f9894"
integrity sha512-d+rgz+FHeKRcqPS8c8mPRuwYsbfDwIExJIOdpexAmhhW67c1V3xo4+oAwNSE395/qU5/JXmOnHPeqA6t6Fx9ew==
"@coldwired/actions@^0.10.0":
version "0.10.0"
resolved "https://registry.yarnpkg.com/@coldwired/actions/-/actions-0.10.0.tgz#8ce75a132e6ba7917337b4cc366ff59d725b4c75"
integrity sha512-EFXUnYRL2uWJe9LrBW5F6L874VX1aKrvKQ3uLTa7rmGmd91PksXzIY0ZDrBJ9pWAdQQywfiGxUkyerIDR4e4jg==
dependencies:
"@coldwired/utils" "^0.8.1"
morphdom "^2.6.1"
"@coldwired/utils" "^0.10.0"
morphdom "^2.7.0"
tiny-invariant "^1.3.1"
"@coldwired/turbo-stream@^0.8.1":
version "0.8.1"
resolved "https://registry.yarnpkg.com/@coldwired/turbo-stream/-/turbo-stream-0.8.1.tgz#3f2f52b8cd59906c2387b78949c66fad79cb0eae"
integrity sha512-rxDzEObIZ4MQQzM2joXV2yjOLcveHBDkghDu6EiiCAMl95wV/O6dMTM1KW3+l6tjd0a5hTTKrhoNJKuWLTV5GA==
"@coldwired/turbo-stream@^0.10.0":
version "0.10.0"
resolved "https://registry.yarnpkg.com/@coldwired/turbo-stream/-/turbo-stream-0.10.0.tgz#1e8fa6512691ec65c9f5152f62d5a1daef9b08c9"
integrity sha512-6WZ9DB2L/E8vBSWVbr//VMawQFU15cj1DBO8YY+ktcnUmRR90D6yy7yfq65g7xSd6qIOJo4sQ3vvCVr9U4enRw==
dependencies:
"@coldwired/actions" "^0.8.1"
"@coldwired/utils" "^0.8.1"
"@coldwired/actions" "^0.10.0"
"@coldwired/utils" "^0.10.0"
tiny-invariant "^1.3.1"
"@coldwired/utils@^0.8.1":
version "0.8.1"
resolved "https://registry.yarnpkg.com/@coldwired/utils/-/utils-0.8.1.tgz#bd20e69d12d938b43ac03d4020416188e8c8107b"
integrity sha512-pT3vLSNFKXAZUi3IgomLXNiDB/l4Qer3/uHP6I6XzLY/q7xIBarhSmcuYUsgxs4jlH8sIsgAjU+PP0qGXc3QAg==
"@coldwired/utils@^0.10.0":
version "0.10.0"
resolved "https://registry.yarnpkg.com/@coldwired/utils/-/utils-0.10.0.tgz#9d7fd3b3abc437db39abf714b263b55afa2fcc43"
integrity sha512-5rbSe+k60GgXb55uVvqloest7JWSdSIwRCSirs/u7JWWv6UP+UuYEYQjCpgQVTqBNwYMXiaB843VnWApxsf8oQ==
"@esbuild/android-arm64@0.16.14":
version "0.16.14"
@ -4860,10 +4860,10 @@ mlly@^1.1.1, mlly@^1.2.0:
pkg-types "^1.0.2"
ufo "^1.1.1"
morphdom@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/morphdom/-/morphdom-2.6.1.tgz#e868e24f989fa3183004b159aed643e628b4306e"
integrity sha512-Y8YRbAEP3eKykroIBWrjcfMw7mmwJfjhqdpSvoqinu8Y702nAwikpXcNFDiIkyvfCLxLM9Wu95RZqo4a9jFBaA==
morphdom@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/morphdom/-/morphdom-2.7.0.tgz#9ef0c4bc15ac8725df398d127c6984f62e7f89e8"
integrity sha512-8L8DwbdjjWwM/aNqj7BSoSn4G7SQLNiDcxCnMWbf506jojR6lNQ5YOmQqXEIE8u3C492UlkN4d0hQwz97+M1oQ==
ms@2.1.2:
version "2.1.2"