@plesk/ui-library 3.43.2 → 3.44.0
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.
- package/cjs/components/Action/Action.js +10 -3
- package/cjs/components/Alert/Alert.js +1 -0
- package/cjs/components/AutoClosable/AutoClosable.js +47 -61
- package/cjs/components/AuxiliaryActions/AuxiliaryActions.js +13 -4
- package/cjs/components/Button/Button.js +1 -0
- package/cjs/components/Card/Card.js +10 -15
- package/cjs/components/CardList/CardList.js +6 -9
- package/cjs/components/CardList/CardListToolbar.js +12 -18
- package/cjs/components/ClosingConfirmation/useClosingConfirmation.js +7 -11
- package/cjs/components/CodeEditor/CodeEditor.js +1 -2
- package/cjs/components/Columns/Columns.js +1 -2
- package/cjs/components/ComboBox/ComboBox.js +1 -2
- package/cjs/components/ComboBoxDropdown/ComboBoxDropdown.js +4 -2
- package/cjs/components/ComboBoxDropdown/index.js +1 -2
- package/cjs/components/Cuttable/Cuttable.js +6 -8
- package/cjs/components/Dialog/Dialog.js +17 -13
- package/cjs/components/Drawer/Drawer.js +14 -7
- package/cjs/components/Drawer/DrawerProgress.js +4 -6
- package/cjs/components/Dropdown/Dropdown.js +12 -9
- package/cjs/components/Dropdown/index.js +1 -2
- package/cjs/components/ExtendedStatusMessage/ExtendedStatusMessage.js +1 -0
- package/cjs/components/Figure/index.js +1 -2
- package/cjs/components/Form/Form.js +19 -20
- package/cjs/components/Form/index.js +1 -2
- package/cjs/components/FormField/FormField.js +77 -51
- package/cjs/components/FormField/index.js +1 -2
- package/cjs/components/FormFieldCheckbox/FormFieldCheckbox.js +6 -2
- package/cjs/components/FormFieldPassword/FormFieldPassword.js +18 -21
- package/cjs/components/FormFieldPassword/PasswordMeter.js +9 -15
- package/cjs/components/FormFieldPassword/estimatePassword.js +21 -33
- package/cjs/components/FormFieldRadioButtons/FormFieldRadioButtons.js +50 -44
- package/cjs/components/FormFieldSelect/FormFieldSelect.js +1 -1
- package/cjs/components/FormFieldText/FormFieldText.js +7 -1
- package/cjs/components/Heading/Heading.js +1 -2
- package/cjs/components/Hint/Hint.js +2 -1
- package/cjs/components/Icon/Icon.js +6 -0
- package/cjs/components/Icon/index.js +1 -2
- package/cjs/components/Icon/utils.js +17 -8
- package/cjs/components/InPlaceEdit/Editor.js +5 -8
- package/cjs/components/InPlaceEdit/InPlaceEdit.js +3 -5
- package/cjs/components/InputFile/InputFile.js +7 -9
- package/cjs/components/Item/Item.js +1 -2
- package/cjs/components/ItemList/ItemList.js +1 -2
- package/cjs/components/Layer/index.js +1 -2
- package/cjs/components/Layout/Layout.js +2 -2
- package/cjs/components/Link/Link.js +2 -0
- package/cjs/components/List/List.js +38 -45
- package/cjs/components/List/ListAction.js +1 -0
- package/cjs/components/List/ListActions.js +1 -0
- package/cjs/components/List/ListEmptyView.js +7 -10
- package/cjs/components/List/ListOperation.js +3 -12
- package/cjs/components/LocaleProvider/LocaleProvider.js +20 -12
- package/cjs/components/LocaleProvider/index.js +1 -2
- package/cjs/components/Media/Media.js +1 -2
- package/cjs/components/Menu/Menu.js +10 -8
- package/cjs/components/Menu/MenuBaseItem.js +1 -2
- package/cjs/components/Menu/MenuItem.js +2 -1
- package/cjs/components/Overlay/Overlay.js +2 -0
- package/cjs/components/Pagination/Pagination.js +6 -10
- package/cjs/components/Pagination/index.js +1 -2
- package/cjs/components/Popover/Popover.js +1 -1
- package/cjs/components/Popper/index.js +1 -2
- package/cjs/components/ProgressDialog/ProgressDialog.js +5 -7
- package/cjs/components/ProgressStep/ProgressStep.js +1 -2
- package/cjs/components/ProgressStep/index.js +1 -2
- package/cjs/components/Section/Section.js +87 -225
- package/cjs/components/{Dropdown/locale/en-US.js → Section/SectionContext.js} +4 -3
- package/cjs/components/Section/index.js +1 -2
- package/cjs/components/Section/useCollapsed.js +19 -0
- package/cjs/components/Section/useVertical.js +38 -0
- package/cjs/components/SegmentedControl/DropdownControl.js +1 -2
- package/cjs/components/SegmentedControl/SegmentedControl.js +1 -0
- package/cjs/components/SegmentedControl/index.js +1 -2
- package/cjs/components/Select/Select.js +10 -7
- package/cjs/components/Select/SelectControl.js +13 -3
- package/cjs/components/SplitButton/index.js +1 -2
- package/cjs/components/Spot/SpotPopup.js +3 -4
- package/cjs/components/Status/Status.js +1 -0
- package/cjs/components/Subnav/index.js +1 -2
- package/cjs/components/Tabs/SearchBar.js +1 -2
- package/cjs/components/Tabs/TabIcon.js +1 -2
- package/cjs/components/Tabs/TabList.js +30 -14
- package/cjs/components/Tabs/TabListItem.js +5 -1
- package/cjs/components/Tabs/Tabs.js +16 -12
- package/cjs/components/Tabs/useWidths.js +5 -5
- package/cjs/components/Toast/Toast.js +1 -0
- package/cjs/components/Toast/index.js +1 -2
- package/cjs/components/Toaster/GroupLabel.js +5 -3
- package/cjs/components/Toolbar/Toolbar.js +1 -2
- package/cjs/components/Toolbar/ToolbarGroup.js +1 -2
- package/cjs/components/Toolbar/ToolbarMenu.js +1 -2
- package/cjs/components/Tooltip/Tooltip.js +11 -4
- package/cjs/components/Translate/Translate.js +13 -3
- package/cjs/components/Translate/index.js +28 -3
- package/cjs/components/Translate/locale.js +25 -0
- package/cjs/components/VerticalContext/index.js +1 -2
- package/cjs/components/index.js +16 -3
- package/cjs/hooks/useResizeObserver.js +8 -2
- package/cjs/index.js +1 -1
- package/cjs/locales/ar.js +124 -0
- package/cjs/locales/ca-ES.js +124 -0
- package/cjs/locales/cs-CZ.js +124 -0
- package/cjs/locales/da-DK.js +124 -0
- package/cjs/locales/de-DE.js +124 -0
- package/cjs/locales/el-GR.js +124 -0
- package/cjs/locales/en-US.js +124 -0
- package/cjs/locales/es-ES.js +124 -0
- package/cjs/locales/fi-FI.js +124 -0
- package/cjs/locales/fr-FR.js +124 -0
- package/cjs/locales/he-IL.js +124 -0
- package/cjs/locales/hu-HU.js +124 -0
- package/cjs/locales/id-ID.js +124 -0
- package/cjs/locales/index.js +172 -0
- package/cjs/locales/it-IT.js +124 -0
- package/cjs/locales/ja-JP.js +124 -0
- package/cjs/locales/ko-KR.js +124 -0
- package/cjs/locales/ms-MY.js +124 -0
- package/cjs/locales/nb-NO.js +124 -0
- package/cjs/locales/nl-NL.js +124 -0
- package/cjs/locales/pl-PL.js +124 -0
- package/cjs/locales/pt-BR.js +124 -0
- package/cjs/locales/pt-PT.js +124 -0
- package/cjs/locales/ro-RO.js +124 -0
- package/cjs/locales/ru-RU.js +124 -0
- package/cjs/locales/sv-SE.js +124 -0
- package/cjs/locales/th-TH.js +124 -0
- package/cjs/locales/tl-PH.js +124 -0
- package/cjs/locales/tr-TR.js +124 -0
- package/cjs/locales/uk-UA.js +124 -0
- package/cjs/locales/vi-VN.js +124 -0
- package/cjs/locales/zh-CN.js +124 -0
- package/cjs/locales/zh-TW.js +124 -0
- package/cjs/utils.js +17 -2
- package/dist/plesk-ui-library-rtl.css +1 -1
- package/dist/plesk-ui-library-rtl.css.map +1 -1
- package/dist/plesk-ui-library.css +1 -1
- package/dist/plesk-ui-library.css.map +1 -1
- package/dist/plesk-ui-library.js +5517 -1054
- package/dist/plesk-ui-library.js.map +1 -1
- package/dist/plesk-ui-library.min.js +6 -6
- package/dist/plesk-ui-library.min.js.map +1 -1
- package/esm/components/Action/Action.js +9 -1
- package/esm/components/Alert/Alert.js +1 -0
- package/esm/components/AutoClosable/AutoClosable.js +48 -62
- package/esm/components/AuxiliaryActions/AuxiliaryActions.js +13 -4
- package/esm/components/Button/Button.js +1 -0
- package/esm/components/Card/Card.js +9 -13
- package/esm/components/CardList/CardList.js +5 -7
- package/esm/components/CardList/CardListToolbar.js +11 -16
- package/esm/components/ClosingConfirmation/useClosingConfirmation.js +7 -11
- package/esm/components/ComboBoxDropdown/ComboBoxDropdown.js +3 -0
- package/esm/components/Cuttable/Cuttable.js +6 -8
- package/esm/components/Dialog/Dialog.js +18 -12
- package/esm/components/Drawer/Drawer.js +15 -8
- package/esm/components/Drawer/DrawerProgress.js +3 -4
- package/esm/components/Dropdown/Dropdown.js +11 -9
- package/esm/components/ExtendedStatusMessage/ExtendedStatusMessage.js +1 -0
- package/esm/components/Form/Form.js +18 -18
- package/esm/components/FormField/FormField.js +77 -51
- package/esm/components/FormFieldCheckbox/FormFieldCheckbox.js +6 -2
- package/esm/components/FormFieldPassword/FormFieldPassword.js +18 -21
- package/esm/components/FormFieldPassword/PasswordMeter.js +8 -13
- package/esm/components/FormFieldPassword/estimatePassword.js +21 -32
- package/esm/components/FormFieldRadioButtons/FormFieldRadioButtons.js +49 -42
- package/esm/components/FormFieldSelect/FormFieldSelect.js +1 -1
- package/esm/components/FormFieldText/FormFieldText.js +7 -1
- package/esm/components/Hint/Hint.js +2 -1
- package/esm/components/Icon/Icon.js +6 -0
- package/esm/components/Icon/utils.js +16 -6
- package/esm/components/InPlaceEdit/Editor.js +5 -8
- package/esm/components/InPlaceEdit/InPlaceEdit.js +3 -5
- package/esm/components/InputFile/InputFile.js +7 -9
- package/esm/components/Layout/Layout.js +2 -2
- package/esm/components/Link/Link.js +2 -0
- package/esm/components/List/List.js +37 -43
- package/esm/components/List/ListAction.js +1 -0
- package/esm/components/List/ListActions.js +1 -0
- package/esm/components/List/ListEmptyView.js +7 -10
- package/esm/components/List/ListOperation.js +3 -12
- package/esm/components/LocaleProvider/LocaleProvider.js +18 -11
- package/esm/components/Menu/Menu.js +10 -8
- package/esm/components/Menu/MenuItem.js +2 -1
- package/esm/components/Overlay/Overlay.js +2 -0
- package/esm/components/Pagination/Pagination.js +6 -10
- package/esm/components/Popover/Popover.js +1 -1
- package/esm/components/ProgressDialog/ProgressDialog.js +5 -7
- package/esm/components/Section/Section.js +88 -224
- package/esm/components/Section/SectionContext.js +5 -0
- package/esm/components/Section/useCollapsed.js +12 -0
- package/esm/components/Section/useVertical.js +30 -0
- package/esm/components/SegmentedControl/SegmentedControl.js +1 -0
- package/esm/components/Select/Select.js +10 -6
- package/esm/components/Select/SelectControl.js +14 -4
- package/esm/components/Spot/SpotPopup.js +3 -4
- package/esm/components/Status/Status.js +1 -0
- package/esm/components/Tabs/TabList.js +29 -12
- package/esm/components/Tabs/TabListItem.js +5 -1
- package/esm/components/Tabs/Tabs.js +17 -13
- package/esm/components/Tabs/useWidths.js +5 -5
- package/esm/components/Toast/Toast.js +1 -0
- package/esm/components/Toaster/GroupLabel.js +5 -3
- package/esm/components/Tooltip/Tooltip.js +11 -4
- package/esm/components/Translate/Translate.js +11 -2
- package/esm/components/Translate/index.js +3 -2
- package/esm/components/Translate/locale.js +15 -0
- package/esm/components/index.js +1 -1
- package/esm/hooks/useResizeObserver.js +8 -2
- package/esm/index.js +1 -1
- package/esm/locales/ar.js +119 -0
- package/esm/locales/ca-ES.js +119 -0
- package/esm/locales/cs-CZ.js +119 -0
- package/esm/locales/da-DK.js +119 -0
- package/esm/locales/de-DE.js +119 -0
- package/esm/locales/el-GR.js +119 -0
- package/esm/locales/en-US.js +119 -0
- package/esm/locales/es-ES.js +119 -0
- package/esm/locales/fi-FI.js +119 -0
- package/esm/locales/fr-FR.js +119 -0
- package/esm/locales/he-IL.js +119 -0
- package/esm/locales/hu-HU.js +119 -0
- package/esm/locales/id-ID.js +119 -0
- package/esm/locales/index.js +165 -0
- package/esm/locales/it-IT.js +119 -0
- package/esm/locales/ja-JP.js +119 -0
- package/esm/locales/ko-KR.js +119 -0
- package/esm/locales/ms-MY.js +119 -0
- package/esm/locales/nb-NO.js +119 -0
- package/esm/locales/nl-NL.js +119 -0
- package/esm/locales/pl-PL.js +119 -0
- package/esm/locales/pt-BR.js +119 -0
- package/esm/locales/pt-PT.js +119 -0
- package/esm/locales/ro-RO.js +119 -0
- package/esm/locales/ru-RU.js +119 -0
- package/esm/locales/sv-SE.js +119 -0
- package/esm/locales/th-TH.js +119 -0
- package/esm/locales/tl-PH.js +119 -0
- package/esm/locales/tr-TR.js +119 -0
- package/esm/locales/uk-UA.js +119 -0
- package/esm/locales/vi-VN.js +119 -0
- package/esm/locales/zh-CN.js +119 -0
- package/esm/locales/zh-TW.js +119 -0
- package/esm/utils.js +14 -0
- package/package.json +4 -4
- package/styleguide/build/bundle.cf3363eb.js +2 -0
- package/styleguide/index.html +2 -2
- package/types/components/AutoClosable/AutoClosable.d.ts +5 -37
- package/types/components/Button/Button.d.ts +2 -2
- package/types/components/ComboBoxDropdown/ComboBoxDropdown.d.ts +2 -1
- package/types/components/Form/types.d.ts +2 -0
- package/types/components/FormField/FormField.d.ts +6 -0
- package/types/components/FormFieldSelect/FormFieldSelect.d.ts +1 -1
- package/types/components/Hint/Hint.d.ts +11 -8
- package/types/components/Icon/Icon.d.ts +5 -0
- package/types/components/Input/Input.d.ts +2 -2
- package/types/components/LocaleProvider/LocaleProvider.d.ts +3 -2
- package/types/components/Menu/Menu.d.ts +5 -0
- package/types/components/Menu/MenuItem.d.ts +6 -1
- package/types/components/Overlay/Overlay.d.ts +4 -0
- package/types/components/Popover/Popover.d.ts +1 -1
- package/types/components/Section/Section.d.ts +3 -46
- package/types/components/Section/SectionContext.d.ts +5 -0
- package/types/components/Section/useCollapsed.d.ts +1 -0
- package/types/components/Section/useVertical.d.ts +2 -0
- package/types/components/Select/SelectControl.d.ts +2 -0
- package/types/components/Tabs/TabList.d.ts +3 -1
- package/types/components/Tabs/TabListItem.d.ts +4 -1
- package/types/components/Tabs/useWidths.d.ts +2 -2
- package/types/components/Tooltip/Tooltip.d.ts +1 -0
- package/types/components/Translate/Translate.d.ts +7 -1
- package/types/components/Translate/index.d.ts +2 -1
- package/types/components/Translate/locale.d.ts +4 -0
- package/types/components/index.d.ts +1 -1
- package/types/hooks/useResizeObserver.d.ts +2 -1
- package/types/locales/index.d.ts +10 -0
- package/types/utils.d.ts +3 -0
- package/cjs/components/ClosingConfirmation/locale/en-US.js +0 -12
- package/cjs/components/FormFieldPassword/locale/en-US.js +0 -33
- package/cjs/components/InPlaceEdit/locale/en-US.js +0 -12
- package/cjs/components/InputFile/locale/en-US.js +0 -10
- package/esm/components/ClosingConfirmation/locale/en-US.js +0 -7
- package/esm/components/Dropdown/locale/en-US.js +0 -5
- package/esm/components/FormFieldPassword/locale/en-US.js +0 -28
- package/esm/components/InPlaceEdit/locale/en-US.js +0 -7
- package/esm/components/InputFile/locale/en-US.js +0 -5
- package/styleguide/build/bundle.2360aa9e.js +0 -2
- package/types/components/InPlaceEdit/locale/en-US.d.ts +0 -6
- /package/styleguide/build/{bundle.2360aa9e.js.LICENSE.txt → bundle.cf3363eb.js.LICENSE.txt} +0 -0
|
@@ -10,7 +10,7 @@ import Button from '../Button';
|
|
|
10
10
|
import { ButtonContext, getButtonContextValue } from '../Button/ButtonContext';
|
|
11
11
|
import FormField from '../FormField';
|
|
12
12
|
import Section from '../Section';
|
|
13
|
-
import
|
|
13
|
+
import { InternalTranslate } from '../Translate';
|
|
14
14
|
import FormContext from './FormContext';
|
|
15
15
|
import VerticalContext, { VERTICAL_BREAKPOINT } from '../VerticalContext';
|
|
16
16
|
import DisabledContext from './DisabledContext';
|
|
@@ -248,19 +248,22 @@ class Form extends Component {
|
|
|
248
248
|
errors
|
|
249
249
|
} = this.props;
|
|
250
250
|
if (errors !== prevProps.errors) {
|
|
251
|
-
let
|
|
251
|
+
let fieldWithError;
|
|
252
252
|
let fieldErrors;
|
|
253
|
-
Object.keys(this.fields).
|
|
253
|
+
Object.keys(this.fields).forEach(name => {
|
|
254
254
|
const foundError = getIn(errors, name);
|
|
255
|
-
if (foundError
|
|
256
|
-
|
|
255
|
+
if (!foundError || typeof foundError !== 'object' || Object.keys(foundError).length === 0) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const field = this.fields[name];
|
|
259
|
+
field.sectionContext?.expand();
|
|
260
|
+
if (!fieldWithError) {
|
|
261
|
+
fieldWithError = field;
|
|
257
262
|
fieldErrors = foundError;
|
|
258
|
-
return false;
|
|
259
263
|
}
|
|
260
|
-
return true;
|
|
261
264
|
});
|
|
262
|
-
if (
|
|
263
|
-
|
|
265
|
+
if (fieldWithError) {
|
|
266
|
+
fieldWithError.focus(fieldErrors);
|
|
264
267
|
}
|
|
265
268
|
}
|
|
266
269
|
}
|
|
@@ -282,9 +285,8 @@ class Form extends Component {
|
|
|
282
285
|
onClick: this.handleSubmitClick
|
|
283
286
|
// eslint-disable-next-line react/no-children-prop
|
|
284
287
|
,
|
|
285
|
-
children: /*#__PURE__*/_jsx(
|
|
286
|
-
content: "Form.submitButton"
|
|
287
|
-
fallback: "Save"
|
|
288
|
+
children: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
289
|
+
content: "Form.submitButton"
|
|
288
290
|
}),
|
|
289
291
|
...(typeof submitButton === 'object' ? submitButton : {})
|
|
290
292
|
});
|
|
@@ -304,9 +306,8 @@ class Form extends Component {
|
|
|
304
306
|
onClick: this.handleApplyClick
|
|
305
307
|
// eslint-disable-next-line react/no-children-prop
|
|
306
308
|
,
|
|
307
|
-
children: /*#__PURE__*/_jsx(
|
|
308
|
-
content: "Form.applyButton"
|
|
309
|
-
fallback: "Apply"
|
|
309
|
+
children: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
310
|
+
content: "Form.applyButton"
|
|
310
311
|
}),
|
|
311
312
|
...(typeof applyButton === 'object' ? applyButton : {})
|
|
312
313
|
});
|
|
@@ -324,9 +325,8 @@ class Form extends Component {
|
|
|
324
325
|
disabled: !!state
|
|
325
326
|
// eslint-disable-next-line react/no-children-prop
|
|
326
327
|
,
|
|
327
|
-
children: /*#__PURE__*/_jsx(
|
|
328
|
-
content: "Form.cancelButton"
|
|
329
|
-
fallback: "Cancel"
|
|
328
|
+
children: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
329
|
+
content: "Form.cancelButton"
|
|
330
330
|
}),
|
|
331
331
|
...(typeof cancelButton === 'object' ? cancelButton : {})
|
|
332
332
|
});
|
|
@@ -12,9 +12,10 @@ import Link from '../Link';
|
|
|
12
12
|
import Icon from '../Icon';
|
|
13
13
|
import Popover from '../Popover';
|
|
14
14
|
import Action from '../Action';
|
|
15
|
-
import
|
|
15
|
+
import { InternalTranslate } from '../Translate';
|
|
16
16
|
import Focuser from '../Overlay/Focuser';
|
|
17
17
|
import FormContext from '../Form/FormContext';
|
|
18
|
+
import SectionContext from '../Section/SectionContext';
|
|
18
19
|
import VerticalContext from '../VerticalContext';
|
|
19
20
|
import ScrollableElementFormContext from '../Form/ScrollableElementFormContext';
|
|
20
21
|
import DisabledContext from '../Form/DisabledContext';
|
|
@@ -55,12 +56,26 @@ class FormField extends Component {
|
|
|
55
56
|
if (!this.props.multi) {
|
|
56
57
|
return this.fieldApi;
|
|
57
58
|
}
|
|
59
|
+
const getErrors = () => {
|
|
60
|
+
const errors = this.fieldApi.getErrors();
|
|
61
|
+
if (errors instanceof Array && errors[index]) {
|
|
62
|
+
return errors[index];
|
|
63
|
+
}
|
|
64
|
+
return {};
|
|
65
|
+
};
|
|
66
|
+
const getFullDescription = () => {
|
|
67
|
+
if (index === 0) {
|
|
68
|
+
return this.fieldApi.getFullDescription();
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
};
|
|
58
72
|
return {
|
|
59
73
|
getValues: () => this.fieldApi.getValues(),
|
|
60
74
|
getId: () => {
|
|
61
75
|
const id = this.fieldApi.getId();
|
|
62
76
|
return id ? `${id}-${index}` : id;
|
|
63
77
|
},
|
|
78
|
+
getDescriptionLabelId: () => this.fieldApi.getDescriptionLabelId(),
|
|
64
79
|
getName: () => {
|
|
65
80
|
const name = this.fieldApi.getName();
|
|
66
81
|
return name ? `${name}[${index}]` : name;
|
|
@@ -76,13 +91,7 @@ class FormField extends Component {
|
|
|
76
91
|
const values = getArrayHelper(this.fieldApi.getValue(), true);
|
|
77
92
|
return this.fieldApi.setValue(values.map((v, i) => i === index ? value : v));
|
|
78
93
|
},
|
|
79
|
-
getErrors
|
|
80
|
-
const errors = this.fieldApi.getErrors();
|
|
81
|
-
if (errors instanceof Array && errors[index]) {
|
|
82
|
-
return errors[index];
|
|
83
|
-
}
|
|
84
|
-
return {};
|
|
85
|
-
},
|
|
94
|
+
getErrors,
|
|
86
95
|
getRequiredMark: () => {
|
|
87
96
|
if (index === 0) {
|
|
88
97
|
return this.fieldApi.getRequiredMark();
|
|
@@ -93,12 +102,7 @@ class FormField extends Component {
|
|
|
93
102
|
className: `${this.props.baseClassName}__separator`
|
|
94
103
|
}),
|
|
95
104
|
isDisabled: () => !!this.props.disabled,
|
|
96
|
-
getFullDescription
|
|
97
|
-
if (index === 0) {
|
|
98
|
-
return this.fieldApi.getFullDescription();
|
|
99
|
-
}
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
105
|
+
getFullDescription
|
|
102
106
|
};
|
|
103
107
|
});
|
|
104
108
|
_defineProperty(this, "focus", errors => {
|
|
@@ -111,9 +115,11 @@ class FormField extends Component {
|
|
|
111
115
|
} = this.props;
|
|
112
116
|
const target = this.targetRefs[index];
|
|
113
117
|
if (target) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
scrollIntoView(target, {
|
|
120
|
+
boundary: scrollableElement
|
|
121
|
+
});
|
|
122
|
+
}, 0);
|
|
117
123
|
this.focusTimer = setTimeout(() => {
|
|
118
124
|
if (target) {
|
|
119
125
|
new Focuser().focusFirstDescendant(target);
|
|
@@ -168,10 +174,9 @@ class FormField extends Component {
|
|
|
168
174
|
return /*#__PURE__*/_jsx(Button, {
|
|
169
175
|
className: `${this.props.baseClassName}__remove`,
|
|
170
176
|
icon: isClearable ? 'clean' : 'cross-mark',
|
|
171
|
-
tooltip: /*#__PURE__*/_jsx(
|
|
177
|
+
tooltip: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
172
178
|
namespace: "FormField",
|
|
173
179
|
content: isClearable ? 'clear' : 'remove',
|
|
174
|
-
fallback: isClearable ? 'Clear' : 'Remove',
|
|
175
180
|
translators: locale
|
|
176
181
|
}),
|
|
177
182
|
onClick: () => this.handleRemove(index),
|
|
@@ -182,7 +187,7 @@ class FormField extends Component {
|
|
|
182
187
|
/**
|
|
183
188
|
* Renders description for last row.
|
|
184
189
|
*/
|
|
185
|
-
_defineProperty(this, "renderDescription", index => {
|
|
190
|
+
_defineProperty(this, "renderDescription", (index, id) => {
|
|
186
191
|
const {
|
|
187
192
|
baseClassName,
|
|
188
193
|
description,
|
|
@@ -192,6 +197,7 @@ class FormField extends Component {
|
|
|
192
197
|
return null;
|
|
193
198
|
}
|
|
194
199
|
return /*#__PURE__*/_jsx(Hint, {
|
|
200
|
+
id: id ? `${id}-description` : undefined,
|
|
195
201
|
component: "div",
|
|
196
202
|
className: `${baseClassName}__description`,
|
|
197
203
|
children: description
|
|
@@ -221,6 +227,7 @@ class FormField extends Component {
|
|
|
221
227
|
onRemoveRow,
|
|
222
228
|
locale,
|
|
223
229
|
form,
|
|
230
|
+
section,
|
|
224
231
|
vertical,
|
|
225
232
|
scrollableElement,
|
|
226
233
|
fullDescription,
|
|
@@ -240,6 +247,7 @@ class FormField extends Component {
|
|
|
240
247
|
children: [innerField, ` `, _this.renderRemoveButton(index)]
|
|
241
248
|
});
|
|
242
249
|
}
|
|
250
|
+
const fieldId = fieldApi.getId();
|
|
243
251
|
return /*#__PURE__*/_jsxs(SectionItem, {
|
|
244
252
|
className: classNames(baseClassName, {
|
|
245
253
|
[`${baseClassName}--error`]: hasErrors,
|
|
@@ -248,7 +256,7 @@ class FormField extends Component {
|
|
|
248
256
|
title: label === null ? null : /*#__PURE__*/_jsxs("div", {
|
|
249
257
|
className: `${baseClassName}__label`,
|
|
250
258
|
children: [/*#__PURE__*/_jsx("label", {
|
|
251
|
-
htmlFor:
|
|
259
|
+
htmlFor: fieldId,
|
|
252
260
|
children: label
|
|
253
261
|
}), fieldApi.getFullDescription(), required ? fieldApi.getRequiredMark() : null]
|
|
254
262
|
}),
|
|
@@ -258,21 +266,21 @@ class FormField extends Component {
|
|
|
258
266
|
ref: _this.setTargetRef(index),
|
|
259
267
|
children: innerField
|
|
260
268
|
}), hasErrors && Object.keys(fieldErrors).map(key => /*#__PURE__*/_jsxs("span", {
|
|
269
|
+
id: fieldId ? `${id}-${key}` : undefined,
|
|
261
270
|
className: `${baseClassName}__error`,
|
|
262
271
|
children: [/*#__PURE__*/_jsx(Icon, {
|
|
263
272
|
className: `${baseClassName}__error-icon`,
|
|
264
273
|
name: "exclamation-mark-circle-filled",
|
|
265
274
|
size: "12"
|
|
266
275
|
}), fieldErrors[key]]
|
|
267
|
-
}, key)), _this.renderDescription(index), renderAddMore && /*#__PURE__*/_jsx(Link, {
|
|
276
|
+
}, key)), _this.renderDescription(index, fieldId), renderAddMore && /*#__PURE__*/_jsx(Link, {
|
|
268
277
|
role: "button",
|
|
269
278
|
onClick: _this.handleAddMore,
|
|
270
279
|
className: `${baseClassName}__add-more`,
|
|
271
280
|
disabled: disabled,
|
|
272
|
-
children: /*#__PURE__*/_jsx(
|
|
281
|
+
children: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
273
282
|
namespace: "FormField",
|
|
274
283
|
content: "addMore",
|
|
275
|
-
fallback: "Add one more",
|
|
276
284
|
translators: locale
|
|
277
285
|
})
|
|
278
286
|
})]
|
|
@@ -292,6 +300,32 @@ class FormField extends Component {
|
|
|
292
300
|
value: valueInState,
|
|
293
301
|
errors: this.props.errors
|
|
294
302
|
};
|
|
303
|
+
const _getErrors = () => {
|
|
304
|
+
if (this.props.form && this.props.name) {
|
|
305
|
+
return this.props.form.getErrors(this.props.name);
|
|
306
|
+
}
|
|
307
|
+
return this.state.errors;
|
|
308
|
+
};
|
|
309
|
+
const _getFullDescription = () => {
|
|
310
|
+
if (!this.props.fullDescription) {
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
return /*#__PURE__*/_jsx(Popover, {
|
|
314
|
+
target: /*#__PURE__*/_jsx(Action, {
|
|
315
|
+
outerProps: {
|
|
316
|
+
className: `${this.props.baseClassName}__full-description`
|
|
317
|
+
},
|
|
318
|
+
icon: {
|
|
319
|
+
name: 'info-circle',
|
|
320
|
+
size: '12',
|
|
321
|
+
className: `${this.props.baseClassName}__full-description-icon`
|
|
322
|
+
}
|
|
323
|
+
}),
|
|
324
|
+
placement: "right",
|
|
325
|
+
intent: "info",
|
|
326
|
+
children: this.props.fullDescription
|
|
327
|
+
});
|
|
328
|
+
};
|
|
295
329
|
this.fieldApi = {
|
|
296
330
|
getId: () => {
|
|
297
331
|
if (this.props.id) {
|
|
@@ -302,6 +336,19 @@ class FormField extends Component {
|
|
|
302
336
|
}
|
|
303
337
|
return undefined;
|
|
304
338
|
},
|
|
339
|
+
getDescriptionLabelId: () => {
|
|
340
|
+
const errors = _getErrors();
|
|
341
|
+
const id = this.fieldApi.getId();
|
|
342
|
+
if (!id) {
|
|
343
|
+
return undefined;
|
|
344
|
+
}
|
|
345
|
+
if (errors && Object.keys(errors).length > 0) {
|
|
346
|
+
const [errorKey] = Object.keys(errors);
|
|
347
|
+
return `${id}-${errorKey}`;
|
|
348
|
+
}
|
|
349
|
+
const hasDescription = !!this.props.description;
|
|
350
|
+
return hasDescription ? `${id}-description` : undefined;
|
|
351
|
+
},
|
|
305
352
|
getName: () => this.props.name,
|
|
306
353
|
getValues: () => {
|
|
307
354
|
if (this.props.form) {
|
|
@@ -324,12 +371,7 @@ class FormField extends Component {
|
|
|
324
371
|
}
|
|
325
372
|
safeInvoke(this.props.onChange, value);
|
|
326
373
|
},
|
|
327
|
-
getErrors:
|
|
328
|
-
if (this.props.form && this.props.name) {
|
|
329
|
-
return this.props.form.getErrors(this.props.name);
|
|
330
|
-
}
|
|
331
|
-
return this.state.errors;
|
|
332
|
-
},
|
|
374
|
+
getErrors: _getErrors,
|
|
333
375
|
getRequiredMark: () => {
|
|
334
376
|
if (this.props.form) {
|
|
335
377
|
return this.props.form.getRequiredMark();
|
|
@@ -337,26 +379,7 @@ class FormField extends Component {
|
|
|
337
379
|
return null;
|
|
338
380
|
},
|
|
339
381
|
isDisabled: () => Boolean(this.props.disabled),
|
|
340
|
-
getFullDescription:
|
|
341
|
-
if (!this.props.fullDescription) {
|
|
342
|
-
return null;
|
|
343
|
-
}
|
|
344
|
-
return /*#__PURE__*/_jsx(Popover, {
|
|
345
|
-
target: /*#__PURE__*/_jsx(Action, {
|
|
346
|
-
outerProps: {
|
|
347
|
-
className: `${this.props.baseClassName}__full-description`
|
|
348
|
-
},
|
|
349
|
-
icon: {
|
|
350
|
-
name: 'info-circle',
|
|
351
|
-
size: '12',
|
|
352
|
-
className: `${this.props.baseClassName}__full-description-icon`
|
|
353
|
-
}
|
|
354
|
-
}),
|
|
355
|
-
placement: "right",
|
|
356
|
-
intent: "info",
|
|
357
|
-
children: this.props.fullDescription
|
|
358
|
-
});
|
|
359
|
-
}
|
|
382
|
+
getFullDescription: _getFullDescription
|
|
360
383
|
};
|
|
361
384
|
this.targetRefs = [];
|
|
362
385
|
}
|
|
@@ -389,7 +412,8 @@ class FormField extends Component {
|
|
|
389
412
|
if (this.props.form && this.props.name) {
|
|
390
413
|
this.props.form.setRequiredField(this.props.name, !!this.props.required);
|
|
391
414
|
this.props.form.registerField(this.props.name, {
|
|
392
|
-
focus: this.focus
|
|
415
|
+
focus: this.focus,
|
|
416
|
+
sectionContext: this.props.section
|
|
393
417
|
});
|
|
394
418
|
}
|
|
395
419
|
}
|
|
@@ -435,6 +459,7 @@ const FormFieldWrapper = _ref => {
|
|
|
435
459
|
...props
|
|
436
460
|
} = _ref;
|
|
437
461
|
const form = useContext(FormContext);
|
|
462
|
+
const section = useContext(SectionContext);
|
|
438
463
|
const verticalContext = useContext(VerticalContext);
|
|
439
464
|
const vertical = props.vertical === undefined ? verticalContext : props.vertical;
|
|
440
465
|
const scrollableElement = useContext(ScrollableElementFormContext);
|
|
@@ -442,6 +467,7 @@ const FormFieldWrapper = _ref => {
|
|
|
442
467
|
return /*#__PURE__*/_jsx(FormField, {
|
|
443
468
|
...props,
|
|
444
469
|
form: form,
|
|
470
|
+
section: section,
|
|
445
471
|
vertical: vertical,
|
|
446
472
|
scrollableElement: scrollableElement,
|
|
447
473
|
disabled: props.disabled || disabled,
|
|
@@ -35,7 +35,9 @@ const FormFieldCheckbox = _ref => {
|
|
|
35
35
|
setValue,
|
|
36
36
|
getRequiredMark,
|
|
37
37
|
getFullDescription,
|
|
38
|
-
isDisabled
|
|
38
|
+
isDisabled,
|
|
39
|
+
getErrors,
|
|
40
|
+
getDescriptionLabelId
|
|
39
41
|
} = _ref2;
|
|
40
42
|
return /*#__PURE__*/_jsxs(Fragment, {
|
|
41
43
|
children: [/*#__PURE__*/_jsx("input", {
|
|
@@ -49,7 +51,9 @@ const FormFieldCheckbox = _ref => {
|
|
|
49
51
|
id: getId(),
|
|
50
52
|
name: getName(),
|
|
51
53
|
value: checkedValue.toString(),
|
|
52
|
-
autoFocus
|
|
54
|
+
autoFocus,
|
|
55
|
+
'aria-invalid': !!Object.keys(getErrors() ?? {}).length,
|
|
56
|
+
'aria-describedby': getDescriptionLabelId()
|
|
53
57
|
},
|
|
54
58
|
disabled: isDisabled(),
|
|
55
59
|
rightAddon: /*#__PURE__*/_jsxs(_Fragment, {
|
|
@@ -8,10 +8,9 @@ import Button from '../Button';
|
|
|
8
8
|
import FormField from '../FormField';
|
|
9
9
|
import Input from '../Input';
|
|
10
10
|
import Toast from '../Toast';
|
|
11
|
-
import
|
|
11
|
+
import { InternalTranslate } from '../Translate';
|
|
12
12
|
import PasswordMeter from './PasswordMeter';
|
|
13
13
|
import generatePassword from './generatePassword';
|
|
14
|
-
import locale from './locale/en-US';
|
|
15
14
|
import { copyToClipboard } from '../../utils';
|
|
16
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
16
|
/**
|
|
@@ -64,9 +63,8 @@ class FormFieldPassword extends Component {
|
|
|
64
63
|
className: `${baseClassName}__button--copy`,
|
|
65
64
|
icon: 'copy',
|
|
66
65
|
onClick: () => this.handleCopyToClipboard(value),
|
|
67
|
-
tooltip: /*#__PURE__*/_jsx(
|
|
68
|
-
content: "FormFieldPassword.copyButtonHint"
|
|
69
|
-
fallback: locale.copyButtonHint
|
|
66
|
+
tooltip: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
67
|
+
content: "FormFieldPassword.copyButtonHint"
|
|
70
68
|
}),
|
|
71
69
|
disabled: isDisabled()
|
|
72
70
|
};
|
|
@@ -99,14 +97,12 @@ class FormFieldPassword extends Component {
|
|
|
99
97
|
passwordGenerated: true
|
|
100
98
|
});
|
|
101
99
|
},
|
|
102
|
-
tooltip: /*#__PURE__*/_jsx(
|
|
103
|
-
content: "FormFieldPassword.generateButtonHint"
|
|
104
|
-
fallback: locale.generateButtonHint
|
|
100
|
+
tooltip: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
101
|
+
content: "FormFieldPassword.generateButtonHint"
|
|
105
102
|
}),
|
|
106
103
|
disabled: isDisabled(),
|
|
107
|
-
children: /*#__PURE__*/_jsx(
|
|
108
|
-
content: "FormFieldPassword.generateButton"
|
|
109
|
-
fallback: locale.generateButton
|
|
104
|
+
children: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
105
|
+
content: "FormFieldPassword.generateButton"
|
|
110
106
|
})
|
|
111
107
|
};
|
|
112
108
|
let button;
|
|
@@ -150,7 +146,9 @@ class FormFieldPassword extends Component {
|
|
|
150
146
|
getName,
|
|
151
147
|
getValue,
|
|
152
148
|
setValue,
|
|
153
|
-
|
|
149
|
+
getErrors,
|
|
150
|
+
isDisabled,
|
|
151
|
+
getDescriptionLabelId
|
|
154
152
|
} = _ref4;
|
|
155
153
|
const value = getValue('');
|
|
156
154
|
const input = /*#__PURE__*/_jsx(Input, {
|
|
@@ -169,16 +167,16 @@ class FormFieldPassword extends Component {
|
|
|
169
167
|
autoComplete: autoComplete,
|
|
170
168
|
className: `${baseClassName}__input`,
|
|
171
169
|
size: size,
|
|
170
|
+
"aria-invalid": !!Object.keys(getErrors() ?? {}).length,
|
|
171
|
+
"aria-describedby": getDescriptionLabelId(),
|
|
172
172
|
suffix: hideShowButton ? null : /*#__PURE__*/_jsx(Button, {
|
|
173
173
|
className: `${baseClassName}__button--show`,
|
|
174
174
|
onClick: this.handleToggleClick,
|
|
175
175
|
icon: visible ? 'visible' : 'invisible',
|
|
176
|
-
tooltip: visible ? /*#__PURE__*/_jsx(
|
|
177
|
-
content: "FormFieldPassword.hidePassword"
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
content: "FormFieldPassword.showPassword",
|
|
181
|
-
fallback: locale.showPassword
|
|
176
|
+
tooltip: visible ? /*#__PURE__*/_jsx(InternalTranslate, {
|
|
177
|
+
content: "FormFieldPassword.hidePassword"
|
|
178
|
+
}) : /*#__PURE__*/_jsx(InternalTranslate, {
|
|
179
|
+
content: "FormFieldPassword.showPassword"
|
|
182
180
|
}),
|
|
183
181
|
ghost: true,
|
|
184
182
|
disabled: isDisabled()
|
|
@@ -199,9 +197,8 @@ class FormFieldPassword extends Component {
|
|
|
199
197
|
}),
|
|
200
198
|
icon: "check-mark-circle-filled",
|
|
201
199
|
intent: "success",
|
|
202
|
-
message: /*#__PURE__*/_jsx(
|
|
203
|
-
content: "FormFieldPassword.copySuccessToast"
|
|
204
|
-
fallback: locale.copySuccessToast
|
|
200
|
+
message: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
201
|
+
content: "FormFieldPassword.copySuccessToast"
|
|
205
202
|
})
|
|
206
203
|
})
|
|
207
204
|
}), /*#__PURE__*/_jsx("div", {
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import Popover from '../Popover';
|
|
5
|
-
import
|
|
5
|
+
import { InternalTranslate } from '../Translate';
|
|
6
6
|
import estimatePassword, { DEFAULT_RULES } from './estimatePassword';
|
|
7
|
-
import locale from './locale/en-US';
|
|
8
7
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
8
|
const strengthIntents = {
|
|
10
9
|
VeryWeak: 'danger',
|
|
@@ -38,22 +37,19 @@ const PasswordMeter = _ref => {
|
|
|
38
37
|
canCloseOnEscapePress: false,
|
|
39
38
|
...props,
|
|
40
39
|
target: children,
|
|
41
|
-
children: [result?.strength ? /*#__PURE__*/_jsx(
|
|
40
|
+
children: [result?.strength ? /*#__PURE__*/_jsx(InternalTranslate, {
|
|
42
41
|
component: "div",
|
|
43
42
|
content: "FormFieldPassword.passwordStrength",
|
|
44
|
-
fallback: locale.passwordStrength,
|
|
45
43
|
params: {
|
|
46
44
|
strength: /*#__PURE__*/_jsx("b", {
|
|
47
|
-
children: /*#__PURE__*/_jsx(
|
|
48
|
-
content: `FormFieldPassword.strength${result?.strength}
|
|
49
|
-
fallback: locale[`strength${result?.strength}`]
|
|
45
|
+
children: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
46
|
+
content: `FormFieldPassword.strength${result?.strength}`
|
|
50
47
|
})
|
|
51
48
|
})
|
|
52
49
|
}
|
|
53
50
|
}) : null, result?.suggestions.length ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
54
|
-
children: [/*#__PURE__*/_jsx(
|
|
55
|
-
content: "FormFieldPassword.improvePassword"
|
|
56
|
-
fallback: locale.improvePassword
|
|
51
|
+
children: [/*#__PURE__*/_jsx(InternalTranslate, {
|
|
52
|
+
content: "FormFieldPassword.improvePassword"
|
|
57
53
|
}), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx("ul", {
|
|
58
54
|
children: result.suggestions.slice(0, 3).map((suggestion, index) =>
|
|
59
55
|
/*#__PURE__*/
|
|
@@ -62,9 +58,8 @@ const PasswordMeter = _ref => {
|
|
|
62
58
|
children: suggestion
|
|
63
59
|
}, index.toString()))
|
|
64
60
|
})]
|
|
65
|
-
}) : /*#__PURE__*/_jsx(
|
|
66
|
-
content: "FormFieldPassword.yourPasswordIsStrong"
|
|
67
|
-
fallback: locale.yourPasswordIsStrong
|
|
61
|
+
}) : /*#__PURE__*/_jsx(InternalTranslate, {
|
|
62
|
+
content: "FormFieldPassword.yourPasswordIsStrong"
|
|
68
63
|
})]
|
|
69
64
|
});
|
|
70
65
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import locale from './locale/en-US';
|
|
3
|
+
import { InternalTranslate } from '../Translate';
|
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
5
|
const EXCLUSIONS = {
|
|
7
6
|
numbers1: 'numbers3',
|
|
@@ -11,9 +10,8 @@ const EXCLUSIONS = {
|
|
|
11
10
|
};
|
|
12
11
|
export const DEFAULT_RULES = [{
|
|
13
12
|
name: 'passwordTooShort',
|
|
14
|
-
suggestion: /*#__PURE__*/_jsx(
|
|
15
|
-
content: `FormFieldPassword.passwordTooShort
|
|
16
|
-
fallback: locale.passwordTooShort
|
|
13
|
+
suggestion: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
14
|
+
content: `FormFieldPassword.passwordTooShort`
|
|
17
15
|
}),
|
|
18
16
|
score(passwd) {
|
|
19
17
|
return passwd.length < 5 ? -1 : 0;
|
|
@@ -34,9 +32,8 @@ export const DEFAULT_RULES = [{
|
|
|
34
32
|
}
|
|
35
33
|
}, {
|
|
36
34
|
name: 'lettersLowerCase',
|
|
37
|
-
suggestion: /*#__PURE__*/_jsx(
|
|
38
|
-
content: `FormFieldPassword.lettersLowerCase
|
|
39
|
-
fallback: locale.lettersLowerCase
|
|
35
|
+
suggestion: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
36
|
+
content: `FormFieldPassword.lettersLowerCase`
|
|
40
37
|
}),
|
|
41
38
|
score(passwd) {
|
|
42
39
|
// [verified] at least one lower case letter
|
|
@@ -44,9 +41,8 @@ export const DEFAULT_RULES = [{
|
|
|
44
41
|
}
|
|
45
42
|
}, {
|
|
46
43
|
name: 'lettersUpperCase',
|
|
47
|
-
suggestion: /*#__PURE__*/_jsx(
|
|
48
|
-
content: `FormFieldPassword.lettersUpperCase
|
|
49
|
-
fallback: locale.lettersUpperCase
|
|
44
|
+
suggestion: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
45
|
+
content: `FormFieldPassword.lettersUpperCase`
|
|
50
46
|
}),
|
|
51
47
|
score(passwd) {
|
|
52
48
|
// [verified] at least one upper case letter
|
|
@@ -54,9 +50,8 @@ export const DEFAULT_RULES = [{
|
|
|
54
50
|
}
|
|
55
51
|
}, {
|
|
56
52
|
name: 'numbers1',
|
|
57
|
-
suggestion: /*#__PURE__*/_jsx(
|
|
58
|
-
content: `FormFieldPassword.numbers1
|
|
59
|
-
fallback: locale.numbers1
|
|
53
|
+
suggestion: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
54
|
+
content: `FormFieldPassword.numbers1`
|
|
60
55
|
}),
|
|
61
56
|
score(passwd) {
|
|
62
57
|
// [verified] at least one number
|
|
@@ -64,9 +59,8 @@ export const DEFAULT_RULES = [{
|
|
|
64
59
|
}
|
|
65
60
|
}, {
|
|
66
61
|
name: 'numbers3',
|
|
67
|
-
suggestion: /*#__PURE__*/_jsx(
|
|
68
|
-
content: `FormFieldPassword.numbers3
|
|
69
|
-
fallback: locale.numbers3
|
|
62
|
+
suggestion: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
63
|
+
content: `FormFieldPassword.numbers3`
|
|
70
64
|
}),
|
|
71
65
|
score(passwd) {
|
|
72
66
|
// [verified] at least three numbers
|
|
@@ -74,9 +68,8 @@ export const DEFAULT_RULES = [{
|
|
|
74
68
|
}
|
|
75
69
|
}, {
|
|
76
70
|
name: 'specialChar1',
|
|
77
|
-
suggestion: /*#__PURE__*/_jsx(
|
|
78
|
-
content: `FormFieldPassword.specialChar1
|
|
79
|
-
fallback: locale.specialChar1
|
|
71
|
+
suggestion: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
72
|
+
content: `FormFieldPassword.specialChar1`
|
|
80
73
|
}),
|
|
81
74
|
score(passwd) {
|
|
82
75
|
// [verified] at least one special character
|
|
@@ -84,9 +77,8 @@ export const DEFAULT_RULES = [{
|
|
|
84
77
|
}
|
|
85
78
|
}, {
|
|
86
79
|
name: 'specialChar2',
|
|
87
|
-
suggestion: /*#__PURE__*/_jsx(
|
|
88
|
-
content: `FormFieldPassword.specialChar2
|
|
89
|
-
fallback: locale.specialChar2
|
|
80
|
+
suggestion: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
81
|
+
content: `FormFieldPassword.specialChar2`
|
|
90
82
|
}),
|
|
91
83
|
score(passwd) {
|
|
92
84
|
// [verified] at least two special characters
|
|
@@ -94,9 +86,8 @@ export const DEFAULT_RULES = [{
|
|
|
94
86
|
}
|
|
95
87
|
}, {
|
|
96
88
|
name: 'comboUpperAndLower',
|
|
97
|
-
suggestion: /*#__PURE__*/_jsx(
|
|
98
|
-
content: `FormFieldPassword.comboUpperAndLower
|
|
99
|
-
fallback: locale.comboUpperAndLower
|
|
89
|
+
suggestion: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
90
|
+
content: `FormFieldPassword.comboUpperAndLower`
|
|
100
91
|
}),
|
|
101
92
|
score(passwd) {
|
|
102
93
|
// [verified] both upper and lower case
|
|
@@ -104,9 +95,8 @@ export const DEFAULT_RULES = [{
|
|
|
104
95
|
}
|
|
105
96
|
}, {
|
|
106
97
|
name: 'comboLettersAndNumbers',
|
|
107
|
-
suggestion: /*#__PURE__*/_jsx(
|
|
108
|
-
content: `FormFieldPassword.comboLettersAndNumbers
|
|
109
|
-
fallback: locale.comboLettersAndNumbers
|
|
98
|
+
suggestion: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
99
|
+
content: `FormFieldPassword.comboLettersAndNumbers`
|
|
110
100
|
}),
|
|
111
101
|
score(passwd) {
|
|
112
102
|
// [verified] both letters and numbers
|
|
@@ -114,9 +104,8 @@ export const DEFAULT_RULES = [{
|
|
|
114
104
|
}
|
|
115
105
|
}, {
|
|
116
106
|
name: 'comboLettersNumbersSpecial',
|
|
117
|
-
suggestion: /*#__PURE__*/_jsx(
|
|
118
|
-
content: `FormFieldPassword.comboLettersNumbersSpecial
|
|
119
|
-
fallback: locale.comboLettersNumbersSpecial
|
|
107
|
+
suggestion: /*#__PURE__*/_jsx(InternalTranslate, {
|
|
108
|
+
content: `FormFieldPassword.comboLettersNumbersSpecial`
|
|
120
109
|
}),
|
|
121
110
|
score(passwd) {
|
|
122
111
|
// [verified] letters, numbers, and special characters
|