@panneau/form-auth 1.0.0-alpha.236 → 1.0.0-alpha.237

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.
Files changed (3) hide show
  1. package/es/index.js +76 -28
  2. package/lib/index.js +76 -28
  3. package/package.json +4 -4
package/es/index.js CHANGED
@@ -5,12 +5,16 @@ import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
6
  import { FormattedMessage } from 'react-intl';
7
7
 
8
- var _excluded$2 = ["action", "fields", "emailLabel", "size"];
8
+ var _excluded$2 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
9
9
  var propTypes$2 = {
10
10
  action: PropTypes.string.isRequired,
11
11
  fields: PropTypes$1.fields,
12
12
  size: PropTypes.string,
13
- emailLabel: PropTypes$1.message
13
+ emailLabel: PropTypes$1.message,
14
+ submitButtonLabel: PropTypes$1.message,
15
+ withLoginLink: PropTypes.bool,
16
+ loginLink: PropTypes.string,
17
+ loginLabel: PropTypes$1.message
14
18
  };
15
19
  var defaultProps$2 = {
16
20
  fields: null,
@@ -21,6 +25,22 @@ var defaultProps$2 = {
21
25
  "type": 0,
22
26
  "value": "Email"
23
27
  }]
28
+ }),
29
+ submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
30
+ id: "12Px0g",
31
+ defaultMessage: [{
32
+ "type": 0,
33
+ "value": "Send reset link"
34
+ }]
35
+ }),
36
+ withLoginLink: true,
37
+ loginLink: '/login',
38
+ loginLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
39
+ id: "X4fQOn",
40
+ defaultMessage: [{
41
+ "type": 0,
42
+ "value": "Go back to login"
43
+ }]
24
44
  })
25
45
  };
26
46
 
@@ -28,7 +48,11 @@ var ForgotPassword = function ForgotPassword(_ref) {
28
48
  var action = _ref.action,
29
49
  fields = _ref.fields,
30
50
  emailLabel = _ref.emailLabel,
51
+ submitButtonLabel = _ref.submitButtonLabel,
31
52
  size = _ref.size,
53
+ withLoginLink = _ref.withLoginLink,
54
+ loginLink = _ref.loginLink,
55
+ loginLabel = _ref.loginLabel,
32
56
  props = _objectWithoutProperties(_ref, _excluded$2);
33
57
 
34
58
  return /*#__PURE__*/React.createElement(Form, Object.assign({
@@ -39,28 +63,31 @@ var ForgotPassword = function ForgotPassword(_ref) {
39
63
  size: size,
40
64
  label: emailLabel
41
65
  }],
42
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
43
- id: "12Px0g",
44
- defaultMessage: [{
45
- "type": 0,
46
- "value": "Send reset link"
47
- }]
48
- })
66
+ submitButtonLabel: submitButtonLabel,
67
+ actions: withLoginLink ? /*#__PURE__*/React.createElement("a", {
68
+ className: "py-2 px-5",
69
+ href: loginLink
70
+ }, loginLabel) : null
49
71
  }, props));
50
72
  };
51
73
 
52
74
  ForgotPassword.propTypes = propTypes$2;
53
75
  ForgotPassword.defaultProps = defaultProps$2;
54
76
 
55
- var _excluded$1 = ["action", "fields", "size", "emailLabel", "passwordLabel"];
77
+ var _excluded$1 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
56
78
  var propTypes$1 = {
57
- action: PropTypes.string.isRequired,
79
+ action: PropTypes.string,
58
80
  fields: PropTypes$1.fields,
59
81
  size: PropTypes.string,
60
82
  emailLabel: PropTypes$1.message,
61
- passwordLabel: PropTypes$1.message
83
+ passwordLabel: PropTypes$1.message,
84
+ submitButtonLabel: PropTypes$1.message,
85
+ withForgotPassword: PropTypes.bool,
86
+ forgotPasswordLink: PropTypes.string,
87
+ forgotPasswordLabel: PropTypes$1.message
62
88
  };
63
89
  var defaultProps$1 = {
90
+ action: '/login',
64
91
  fields: null,
65
92
  size: 'lg',
66
93
  emailLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
@@ -76,6 +103,22 @@ var defaultProps$1 = {
76
103
  "type": 0,
77
104
  "value": "Password"
78
105
  }]
106
+ }),
107
+ submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
108
+ id: "g6qbbX",
109
+ defaultMessage: [{
110
+ "type": 0,
111
+ "value": "Log in"
112
+ }]
113
+ }),
114
+ withForgotPassword: true,
115
+ forgotPasswordLink: '/forgot-password',
116
+ forgotPasswordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
117
+ id: "oKZDBl",
118
+ defaultMessage: [{
119
+ "type": 0,
120
+ "value": "Forgot your password?"
121
+ }]
79
122
  })
80
123
  };
81
124
 
@@ -85,6 +128,10 @@ var LoginForm = function LoginForm(_ref) {
85
128
  size = _ref.size,
86
129
  emailLabel = _ref.emailLabel,
87
130
  passwordLabel = _ref.passwordLabel,
131
+ submitButtonLabel = _ref.submitButtonLabel,
132
+ withForgotPassword = _ref.withForgotPassword,
133
+ forgotPasswordLink = _ref.forgotPasswordLink,
134
+ forgotPasswordLabel = _ref.forgotPasswordLabel,
88
135
  props = _objectWithoutProperties(_ref, _excluded$1);
89
136
 
90
137
  return /*#__PURE__*/React.createElement(Form, Object.assign({
@@ -100,26 +147,25 @@ var LoginForm = function LoginForm(_ref) {
100
147
  size: size,
101
148
  label: passwordLabel
102
149
  }],
103
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
104
- id: "g6qbbX",
105
- defaultMessage: [{
106
- "type": 0,
107
- "value": "Log in"
108
- }]
109
- })
150
+ submitButtonLabel: submitButtonLabel,
151
+ actions: withForgotPassword ? /*#__PURE__*/React.createElement("a", {
152
+ className: "py-2 px-5",
153
+ href: forgotPasswordLink
154
+ }, forgotPasswordLabel) : null
110
155
  }, props));
111
156
  };
112
157
 
113
158
  LoginForm.propTypes = propTypes$1;
114
159
  LoginForm.defaultProps = defaultProps$1;
115
160
 
116
- var _excluded = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel"];
161
+ var _excluded = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
117
162
  var propTypes = {
118
163
  action: PropTypes.string.isRequired,
119
164
  fields: PropTypes$1.fields,
120
165
  size: PropTypes.string,
121
166
  passwordLabel: PropTypes$1.message,
122
- passwordConfirmationLabel: PropTypes$1.message
167
+ passwordConfirmationLabel: PropTypes$1.message,
168
+ submitButtonLabel: PropTypes$1.message
123
169
  };
124
170
  var defaultProps = {
125
171
  fields: null,
@@ -137,6 +183,13 @@ var defaultProps = {
137
183
  "type": 0,
138
184
  "value": "Password confirmation"
139
185
  }]
186
+ }),
187
+ submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
188
+ id: "zwks3g",
189
+ defaultMessage: [{
190
+ "type": 0,
191
+ "value": "Save new password"
192
+ }]
140
193
  })
141
194
  };
142
195
 
@@ -146,6 +199,7 @@ var ResetPassword = function ResetPassword(_ref) {
146
199
  size = _ref.size,
147
200
  passwordLabel = _ref.passwordLabel,
148
201
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
202
+ submitButtonLabel = _ref.submitButtonLabel,
149
203
  props = _objectWithoutProperties(_ref, _excluded);
150
204
 
151
205
  return /*#__PURE__*/React.createElement(Form, Object.assign({
@@ -161,13 +215,7 @@ var ResetPassword = function ResetPassword(_ref) {
161
215
  size: size,
162
216
  label: passwordConfirmationLabel
163
217
  }],
164
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
165
- id: "zwks3g",
166
- defaultMessage: [{
167
- "type": 0,
168
- "value": "Save new password"
169
- }]
170
- })
218
+ submitButtonLabel: submitButtonLabel
171
219
  }, props));
172
220
  };
173
221
 
package/lib/index.js CHANGED
@@ -16,12 +16,16 @@ var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
16
16
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
17
17
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
18
18
 
19
- var _excluded$2 = ["action", "fields", "emailLabel", "size"];
19
+ var _excluded$2 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
20
20
  var propTypes$2 = {
21
21
  action: PropTypes__default["default"].string.isRequired,
22
22
  fields: core.PropTypes.fields,
23
23
  size: PropTypes__default["default"].string,
24
- emailLabel: core.PropTypes.message
24
+ emailLabel: core.PropTypes.message,
25
+ submitButtonLabel: core.PropTypes.message,
26
+ withLoginLink: PropTypes__default["default"].bool,
27
+ loginLink: PropTypes__default["default"].string,
28
+ loginLabel: core.PropTypes.message
25
29
  };
26
30
  var defaultProps$2 = {
27
31
  fields: null,
@@ -32,6 +36,22 @@ var defaultProps$2 = {
32
36
  "type": 0,
33
37
  "value": "Email"
34
38
  }]
39
+ }),
40
+ submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
41
+ id: "12Px0g",
42
+ defaultMessage: [{
43
+ "type": 0,
44
+ "value": "Send reset link"
45
+ }]
46
+ }),
47
+ withLoginLink: true,
48
+ loginLink: '/login',
49
+ loginLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
50
+ id: "X4fQOn",
51
+ defaultMessage: [{
52
+ "type": 0,
53
+ "value": "Go back to login"
54
+ }]
35
55
  })
36
56
  };
37
57
 
@@ -39,7 +59,11 @@ var ForgotPassword = function ForgotPassword(_ref) {
39
59
  var action = _ref.action,
40
60
  fields = _ref.fields,
41
61
  emailLabel = _ref.emailLabel,
62
+ submitButtonLabel = _ref.submitButtonLabel,
42
63
  size = _ref.size,
64
+ withLoginLink = _ref.withLoginLink,
65
+ loginLink = _ref.loginLink,
66
+ loginLabel = _ref.loginLabel,
43
67
  props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
44
68
 
45
69
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
@@ -50,28 +74,31 @@ var ForgotPassword = function ForgotPassword(_ref) {
50
74
  size: size,
51
75
  label: emailLabel
52
76
  }],
53
- submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
54
- id: "12Px0g",
55
- defaultMessage: [{
56
- "type": 0,
57
- "value": "Send reset link"
58
- }]
59
- })
77
+ submitButtonLabel: submitButtonLabel,
78
+ actions: withLoginLink ? /*#__PURE__*/React__default["default"].createElement("a", {
79
+ className: "py-2 px-5",
80
+ href: loginLink
81
+ }, loginLabel) : null
60
82
  }, props));
61
83
  };
62
84
 
63
85
  ForgotPassword.propTypes = propTypes$2;
64
86
  ForgotPassword.defaultProps = defaultProps$2;
65
87
 
66
- var _excluded$1 = ["action", "fields", "size", "emailLabel", "passwordLabel"];
88
+ var _excluded$1 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
67
89
  var propTypes$1 = {
68
- action: PropTypes__default["default"].string.isRequired,
90
+ action: PropTypes__default["default"].string,
69
91
  fields: core.PropTypes.fields,
70
92
  size: PropTypes__default["default"].string,
71
93
  emailLabel: core.PropTypes.message,
72
- passwordLabel: core.PropTypes.message
94
+ passwordLabel: core.PropTypes.message,
95
+ submitButtonLabel: core.PropTypes.message,
96
+ withForgotPassword: PropTypes__default["default"].bool,
97
+ forgotPasswordLink: PropTypes__default["default"].string,
98
+ forgotPasswordLabel: core.PropTypes.message
73
99
  };
74
100
  var defaultProps$1 = {
101
+ action: '/login',
75
102
  fields: null,
76
103
  size: 'lg',
77
104
  emailLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
@@ -87,6 +114,22 @@ var defaultProps$1 = {
87
114
  "type": 0,
88
115
  "value": "Password"
89
116
  }]
117
+ }),
118
+ submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
119
+ id: "g6qbbX",
120
+ defaultMessage: [{
121
+ "type": 0,
122
+ "value": "Log in"
123
+ }]
124
+ }),
125
+ withForgotPassword: true,
126
+ forgotPasswordLink: '/forgot-password',
127
+ forgotPasswordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
128
+ id: "oKZDBl",
129
+ defaultMessage: [{
130
+ "type": 0,
131
+ "value": "Forgot your password?"
132
+ }]
90
133
  })
91
134
  };
92
135
 
@@ -96,6 +139,10 @@ var LoginForm = function LoginForm(_ref) {
96
139
  size = _ref.size,
97
140
  emailLabel = _ref.emailLabel,
98
141
  passwordLabel = _ref.passwordLabel,
142
+ submitButtonLabel = _ref.submitButtonLabel,
143
+ withForgotPassword = _ref.withForgotPassword,
144
+ forgotPasswordLink = _ref.forgotPasswordLink,
145
+ forgotPasswordLabel = _ref.forgotPasswordLabel,
99
146
  props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
100
147
 
101
148
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
@@ -111,26 +158,25 @@ var LoginForm = function LoginForm(_ref) {
111
158
  size: size,
112
159
  label: passwordLabel
113
160
  }],
114
- submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
115
- id: "g6qbbX",
116
- defaultMessage: [{
117
- "type": 0,
118
- "value": "Log in"
119
- }]
120
- })
161
+ submitButtonLabel: submitButtonLabel,
162
+ actions: withForgotPassword ? /*#__PURE__*/React__default["default"].createElement("a", {
163
+ className: "py-2 px-5",
164
+ href: forgotPasswordLink
165
+ }, forgotPasswordLabel) : null
121
166
  }, props));
122
167
  };
123
168
 
124
169
  LoginForm.propTypes = propTypes$1;
125
170
  LoginForm.defaultProps = defaultProps$1;
126
171
 
127
- var _excluded = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel"];
172
+ var _excluded = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
128
173
  var propTypes = {
129
174
  action: PropTypes__default["default"].string.isRequired,
130
175
  fields: core.PropTypes.fields,
131
176
  size: PropTypes__default["default"].string,
132
177
  passwordLabel: core.PropTypes.message,
133
- passwordConfirmationLabel: core.PropTypes.message
178
+ passwordConfirmationLabel: core.PropTypes.message,
179
+ submitButtonLabel: core.PropTypes.message
134
180
  };
135
181
  var defaultProps = {
136
182
  fields: null,
@@ -148,6 +194,13 @@ var defaultProps = {
148
194
  "type": 0,
149
195
  "value": "Password confirmation"
150
196
  }]
197
+ }),
198
+ submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
199
+ id: "zwks3g",
200
+ defaultMessage: [{
201
+ "type": 0,
202
+ "value": "Save new password"
203
+ }]
151
204
  })
152
205
  };
153
206
 
@@ -157,6 +210,7 @@ var ResetPassword = function ResetPassword(_ref) {
157
210
  size = _ref.size,
158
211
  passwordLabel = _ref.passwordLabel,
159
212
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
213
+ submitButtonLabel = _ref.submitButtonLabel,
160
214
  props = _objectWithoutProperties__default["default"](_ref, _excluded);
161
215
 
162
216
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
@@ -172,13 +226,7 @@ var ResetPassword = function ResetPassword(_ref) {
172
226
  size: size,
173
227
  label: passwordConfirmationLabel
174
228
  }],
175
- submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
176
- id: "zwks3g",
177
- defaultMessage: [{
178
- "type": 0,
179
- "value": "Save new password"
180
- }]
181
- })
229
+ submitButtonLabel: submitButtonLabel
182
230
  }, props));
183
231
  };
184
232
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/form-auth",
3
- "version": "1.0.0-alpha.236",
3
+ "version": "1.0.0-alpha.237",
4
4
  "description": "Basic forgot password form",
5
5
  "keywords": [
6
6
  "javascript"
@@ -45,8 +45,8 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@babel/runtime": "^7.12.5",
48
- "@panneau/core": "^1.0.0-alpha.236",
49
- "@panneau/form": "^1.0.0-alpha.236",
48
+ "@panneau/core": "^1.0.0-alpha.237",
49
+ "@panneau/form": "^1.0.0-alpha.237",
50
50
  "classnames": "^2.2.6",
51
51
  "lodash": "^4.17.21",
52
52
  "prop-types": "^15.7.2",
@@ -55,5 +55,5 @@
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  },
58
- "gitHead": "ac8add5d37f0c2439d9b3726d052f2698ee1ea3b"
58
+ "gitHead": "04ba18e9dc24997f869503808313cfab7f5065b2"
59
59
  }