@designcrowd/fe-shared-lib 1.2.5 → 1.2.6-ml-291-1

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.
@@ -19,9 +19,10 @@
19
19
  role="graphics-symbol"
20
20
  aria-labelledby="title"
21
21
  aria-describedby="desc"
22
+ :data-id="`${name}-${id}-title`"
22
23
  >
23
- <title :id="`${name}-${id}-title`" lang="en">{{ title }}</title>
24
- <desc :id="`${name}-${id}-desc`" lang="en">{{ description }}</desc>
24
+ <title v-if="title" :id="`${name}-${id}-title`" lang="en">{{ title }}</title>
25
+ <desc v-if="description" :id="`${name}-${id}-desc`" lang="en">{{ description }}</desc>
25
26
  <component :is="`icon-${iconName}`"></component>
26
27
  </svg>
27
28
  </div>
@@ -799,7 +800,7 @@ export default {
799
800
  return css || null;
800
801
  },
801
802
  title() {
802
- return this.altText || `${this.titleCase(this.name)}`;
803
+ return this.altText;
803
804
  },
804
805
  description() {
805
806
  return `${this.title} Icon`;
@@ -38,6 +38,7 @@
38
38
  <p class="tw-mb-8 tw-text-grayscale-600">{{ modalDescription }}</p>
39
39
  <form id="forgotPassword" ref="forgotPasswordForm" method="post" @submit="validate">
40
40
  <input type="hidden" name="__RequestVerificationToken" :value="antiForgeryToken" />
41
+ <input type="hidden" name="locale" :value="currentLocale" />
41
42
  <label for="email" class="tw-sr-only"> {{ emailLabel }} </label>
42
43
  <input
43
44
  v-model="aEmail"
@@ -72,6 +73,7 @@
72
73
  </div>
73
74
  </template>
74
75
  <script>
76
+ import i18next from 'i18next';
75
77
  import HelloBar from '../../../../src/atoms/components/HelloBar/HelloBar.vue';
76
78
  import SubmissionButton from './SubmissionButton.vue';
77
79
 
@@ -141,6 +143,9 @@ export default {
141
143
  };
142
144
  },
143
145
  computed: {
146
+ currentLocale() {
147
+ return i18next.language || 'en-US';
148
+ },
144
149
  getRedirectToSignInUrl() {
145
150
  const url = new URL(`https://${window.location.host}${this.signInUrl}`);
146
151
  if (this.aEmail) {
@@ -13,10 +13,11 @@
13
13
  {{ title }}
14
14
  </h2>
15
15
  <p class="tw-mb-8 tw-text-grayscale-600">{{ description }}</p>
16
- <form id="resetPassword" method="post" @submit="validate">
16
+ <form id="resetPassword" ref="resetPasswordForm" method="post" @submit="validate">
17
17
  <input name="__RequestVerificationToken" type="hidden" :value="antiForgeryToken" />
18
18
  <input name="userName" type="hidden" :value="userName" />
19
19
  <input name="resetPasswordToken" type="hidden" :value="resetPasswordToken" />
20
+ <input name="locale" type="hidden" :value="currentLocale" />
20
21
  <label for="password" class="tw-sr-only">New Password</label>
21
22
  <input
22
23
  v-model="password"
@@ -25,14 +26,14 @@
25
26
  aria-required="true"
26
27
  :aria-invalid="!!passwordError"
27
28
  autocomplete="new-password"
28
- placeholder="New password"
29
+ :placeholder="newPasswordPlaceholder"
29
30
  class="password-input tw-mb-3 tw-h-12 tw-bg-no-repeat tw-w-full tw-rounded tw-shadow-inner tw-outline-none tw-py-4 tw-pl-10-important tw-pr-2 tw-text-grayscale-600 tw-border tw-border-grayscale-500 focus:tw-border-grayscale-700"
30
31
  :class="{ 'tw-border-error-500': !!passwordError }"
31
32
  />
32
33
  <p v-if="!!passwordError" class="tw-text-error-500 tw-text-sm tw-text-left tw-mb-4">
33
34
  {{ passwordError }}
34
35
  </p>
35
- <label for="confirmPassword" class="tw-sr-only"> Confirm Password </label>
36
+ <label for="confirmPassword" class="tw-sr-only">{{ confirmPasswordLabel }}</label>
36
37
  <input
37
38
  v-model="confirmPassword"
38
39
  name="confirmPassword"
@@ -40,7 +41,7 @@
40
41
  aria-required="true"
41
42
  :aria-invalid="!!confirmPasswordError"
42
43
  autocomplete="off"
43
- placeholder="Confirm new password"
44
+ :placeholder="confirmPasswordPlaceholder"
44
45
  class="password-input tw-mb-3 tw-h-12 tw-bg-no-repeat tw-w-full tw-rounded tw-shadow-inner tw-outline-none tw-py-4 tw-pl-10-important tw-pr-2 tw-text-grayscale-600 tw-border tw-border-grayscale-500 focus:tw-border-grayscale-700"
45
46
  :class="{ 'tw-border-error-500': !!confirmPasswordError }"
46
47
  />
@@ -50,7 +51,7 @@
50
51
  <SubmissionButton
51
52
  variant="primary"
52
53
  size="medium"
53
- label="UPDATE PASSWORD"
54
+ :label="updatePasswordLabel"
54
55
  label-size="larger"
55
56
  :is-loading="isLoading"
56
57
  :disabled="isLoading"
@@ -63,6 +64,7 @@
63
64
  </div>
64
65
  </template>
65
66
  <script>
67
+ import i18next from 'i18next';
66
68
  import HelloBar from '../../../../src/atoms/components/HelloBar/HelloBar.vue';
67
69
  import SubmissionButton from './SubmissionButton.vue';
68
70
 
@@ -80,7 +82,7 @@ export default {
80
82
  description: {
81
83
  type: String,
82
84
  required: false,
83
- default: 'Enter and confirm your new password',
85
+ default: undefined,
84
86
  },
85
87
  userName: {
86
88
  type: String,
@@ -104,6 +106,16 @@ export default {
104
106
  required: false,
105
107
  default: undefined,
106
108
  },
109
+ submitAction: {
110
+ type: String,
111
+ required: false,
112
+ default: undefined,
113
+ },
114
+ resetPasswordContent: {
115
+ type: Object,
116
+ required: false,
117
+ default: () => {},
118
+ },
107
119
  },
108
120
  data() {
109
121
  return {
@@ -112,10 +124,28 @@ export default {
112
124
  confirmPassword: undefined,
113
125
  passwordError: undefined,
114
126
  confirmPasswordError: undefined,
127
+
128
+ title: this.resetPasswordContent?.title,
129
+ newPasswordLabel: this.resetPasswordContent?.newPasswordLabel ?? 'New Password',
130
+ newPasswordPlaceholder: this.resetPasswordContent?.newPasswordPlaceholder ?? 'New password',
131
+ confirmPasswordLabel: this.resetPasswordContent?.confirmPasswordLabel ?? 'Confirm Password',
132
+ confirmPasswordPlaceholder: this.resetPasswordContent?.confirmPasswordPlaceholder ?? 'Confirm new password',
133
+ updatePasswordLabel: this.resetPasswordContent?.updatePasswordLabel ?? 'UPDATE PASSWORD',
134
+ passwordRequiredError: this.resetPasswordContent?.passwordRequiredError ?? 'Please enter a password',
135
+ passwordsDoNotMatchError: this.resetPasswordContent?.passwordsDoNotMatchError ?? 'Passwords do not match',
136
+ description: this.resetPasswordContent?.description ?? 'Enter and confirm your new password',
115
137
  };
116
138
  },
139
+ computed: {
140
+ currentLocale() {
141
+ return i18next.language || 'en-US';
142
+ },
143
+ },
117
144
  methods: {
118
145
  validate(e) {
146
+ if (this.submitAction) {
147
+ this.$refs.resetPasswordForm.action = this.submitAction;
148
+ }
119
149
  if (this.password && this.password === this.confirmPassword) {
120
150
  this.isLoading = true;
121
151
  return true;
@@ -127,9 +157,9 @@ export default {
127
157
  this.confirmPasswordError = undefined;
128
158
 
129
159
  if (!this.password) {
130
- this.passwordError = 'Please enter a password';
160
+ this.passwordError = this.passwordRequiredError;
131
161
  } else if (!this.confirmPassword || this.password !== this.confirmPassword) {
132
- this.confirmPasswordError = 'Passwords do not match';
162
+ this.confirmPasswordError = this.passwordsDoNotMatchError;
133
163
  }
134
164
 
135
165
  e.preventDefault();
@@ -11,8 +11,8 @@ const relativePathsToTranslationFiles = {
11
11
  'pt-PT': () => import('./bundles/bundled-translations.pt-PT.json'),
12
12
  };
13
13
 
14
- const setLocaleAsync = async (locale = 'en-US') => {
15
- const localeToUse = locale;
14
+ const setSharedLibLocaleAsync = async (locale = 'en-US') => {
15
+ const localeToUse = locale || 'en-US';
16
16
 
17
17
  if (!i18next.isInitialized) {
18
18
  await i18next.init({
@@ -35,4 +35,4 @@ const tr = (key, valuesToInterpolate = {}) => {
35
35
  return translated;
36
36
  };
37
37
 
38
- export { setLocaleAsync, tr };
38
+ export { setSharedLibLocaleAsync, tr };