@balena/ui-shared-components 1.1.1 → 1.1.2-build-RJSForm-passwordwidget-lazyload-6fbdd147b34efa39395de6c9eab67e3265199a14-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.
@@ -29,7 +29,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
29
  import { Box, FormControl, IconButton, InputAdornment, TextField, Typography, } from '@mui/material';
30
30
  import * as React from 'react';
31
31
  import { Visibility, VisibilityOff } from '@mui/icons-material';
32
- import zxcvbn from 'zxcvbn';
33
32
  var STRENGTH_TITLES = ['Very weak', 'Weak', 'Good', 'Strong', 'Very strong'];
34
33
  var STRENGTH_STYLES = [
35
34
  { width: 0 },
@@ -42,7 +41,9 @@ var PasswordStrength = function (_a) {
42
41
  var password = _a.password;
43
42
  var _b = __read(React.useState(), 2), strengthScore = _b[0], setStrengthScore = _b[1];
44
43
  React.useEffect(function () {
45
- if (password) {
44
+ // @ts-expect-error If you wish to show a stength meter, you need to load and set `zxcvbn` to a window variable by yourself.
45
+ var zxcvbn = window.zxcvbn;
46
+ if (zxcvbn && password) {
46
47
  try {
47
48
  var score = zxcvbn(password).score;
48
49
  setStrengthScore(score);
@@ -3,7 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Box, FormControl, IconButton, InputAdornment, TextField, Typography, } from '@mui/material';
4
4
  import * as React from 'react';
5
5
  import { Visibility, VisibilityOff } from '@mui/icons-material';
6
- import zxcvbn from 'zxcvbn';
7
6
  var STRENGTH_TITLES = ['Very weak', 'Weak', 'Good', 'Strong', 'Very strong'];
8
7
  var STRENGTH_STYLES = [
9
8
  { width: 0 },
@@ -16,7 +15,9 @@ var PasswordStrength = function (_a) {
16
15
  var password = _a.password;
17
16
  var _b = __read(React.useState(), 2), strengthScore = _b[0], setStrengthScore = _b[1];
18
17
  React.useEffect(function () {
19
- if (password) {
18
+ // @ts-expect-error If you wish to show a stength meter, you need to load and set `zxcvbn` to a window variable by yourself.
19
+ var zxcvbn = window.zxcvbn;
20
+ if (zxcvbn && password) {
20
21
  try {
21
22
  var score = zxcvbn(password).score;
22
23
  setStrengthScore(score);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balena/ui-shared-components",
3
- "version": "1.1.1",
3
+ "version": "1.1.2-build-RJSForm-passwordwidget-lazyload-6fbdd147b34efa39395de6c9eab67e3265199a14-1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist_esm5/index.js",
6
6
  "sideEffects": false,
@@ -112,6 +112,6 @@
112
112
  },
113
113
  "homepage": "https://github.com/balena-io/ui-shared-components#readme",
114
114
  "versionist": {
115
- "publishedAt": "2024-01-10T13:18:14.929Z"
115
+ "publishedAt": "2024-01-10T14:57:32.542Z"
116
116
  }
117
117
  }