@linagora/twake-mui 14.2.0 → 14.3.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/CHANGELOG.md +7 -0
- package/dist/components/PasswordField/PasswordField.stories.d.ts +7 -0
- package/dist/components/PasswordField/PasswordField.stories.js +43 -0
- package/dist/components/PasswordField/index.d.ts +6 -0
- package/dist/components/PasswordField/index.js +28 -0
- package/dist/components/PasswordField/locales/de.json +6 -0
- package/dist/components/PasswordField/locales/en.json +6 -0
- package/dist/components/PasswordField/locales/es.json +6 -0
- package/dist/components/PasswordField/locales/fr.json +6 -0
- package/dist/components/PasswordField/locales/it.json +6 -0
- package/dist/components/PasswordField/locales/ru.json +6 -0
- package/dist/components/PasswordField/locales/vi.json +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# @linagora/twake-mui [14.3.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@14.2.0...@linagora/twake-mui@14.3.0) (2026-10-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **twake-mui:** Migrate PasswordField from cozy-ui ([5d39ddd](https://github.com/linagora/twake-ui/commit/5d39ddd8c7616e82c9f6c89cabe1a53b6b553864))
|
|
7
|
+
|
|
1
8
|
# @linagora/twake-mui [14.2.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@14.1.0...@linagora/twake-mui@14.2.0) (2026-10-15)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TextField } from '@mui/material';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
+
declare const meta: Meta<typeof TextField>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Screenshot: Story;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Stack } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PasswordField from './index';
|
|
4
|
+
// TextFieldProps is a union, which Storybook cannot infer args from
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'PasswordField',
|
|
7
|
+
component: PasswordField,
|
|
8
|
+
parameters: { layout: 'centered' },
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
label: { control: 'text' },
|
|
12
|
+
placeholder: { control: 'text' },
|
|
13
|
+
helperText: { control: 'text' },
|
|
14
|
+
size: { control: 'select', options: ['small', 'medium'] },
|
|
15
|
+
disabled: { control: 'boolean' },
|
|
16
|
+
error: { control: 'boolean' },
|
|
17
|
+
fullWidth: { control: 'boolean' }
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
export const Default = {
|
|
22
|
+
args: {
|
|
23
|
+
defaultValue: 'Cl4ude€st1Nu@ge'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const Row = ({ title, children }) => (React.createElement("section", null,
|
|
27
|
+
React.createElement("h3", { style: { marginBottom: '12px' } }, title),
|
|
28
|
+
React.createElement(Stack, { direction: "row", spacing: 2, useFlexGap: true, sx: { flexWrap: 'wrap' } }, children)));
|
|
29
|
+
// Visual Regression - Combined view for Argos testing
|
|
30
|
+
export const Screenshot = {
|
|
31
|
+
tags: ['argos'],
|
|
32
|
+
render: () => (React.createElement(Stack, { spacing: 4 },
|
|
33
|
+
React.createElement(Row, { title: "Default" },
|
|
34
|
+
React.createElement(PasswordField, { defaultValue: "Cl4ude\u20ACst1Nu@ge" }),
|
|
35
|
+
React.createElement(PasswordField, { label: "Password", defaultValue: "Cl4ude\u20ACst1Nu@ge" }),
|
|
36
|
+
React.createElement(PasswordField, { label: "Password" })),
|
|
37
|
+
React.createElement(Row, { title: "Sizes" },
|
|
38
|
+
React.createElement(PasswordField, { size: "small", defaultValue: "Cl4ude\u20ACst1Nu@ge" }),
|
|
39
|
+
React.createElement(PasswordField, { size: "medium", defaultValue: "Cl4ude\u20ACst1Nu@ge" })),
|
|
40
|
+
React.createElement(Row, { title: "States" },
|
|
41
|
+
React.createElement(PasswordField, { label: "Disabled", disabled: true, defaultValue: "Cl4ude\u20ACst1Nu@ge" }),
|
|
42
|
+
React.createElement(PasswordField, { label: "Error", error: true, helperText: "Wrong password", defaultValue: "Cl4ude\u20ACst1Nu@ge" }))))
|
|
43
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TextFieldProps } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type PasswordFieldProps = TextFieldProps;
|
|
4
|
+
/** Password field with a button to show or hide its value */
|
|
5
|
+
declare const PasswordField: ({ slotProps, ...props }: PasswordFieldProps) => React.ReactElement;
|
|
6
|
+
export default PasswordField;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Eye, EyeClosed, Icon } from '@linagora/twake-icons';
|
|
2
|
+
import { IconButton, InputAdornment, TextField } from '@mui/material';
|
|
3
|
+
import { mergeSlotProps } from '@mui/material/utils';
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { useExtendI18n, useI18n } from 'twake-i18n';
|
|
6
|
+
import de from './locales/de.json';
|
|
7
|
+
import en from './locales/en.json';
|
|
8
|
+
import es from './locales/es.json';
|
|
9
|
+
import fr from './locales/fr.json';
|
|
10
|
+
import it from './locales/it.json';
|
|
11
|
+
import ru from './locales/ru.json';
|
|
12
|
+
import vi from './locales/vi.json';
|
|
13
|
+
const locales = { de, en, es, fr, it, ru, vi };
|
|
14
|
+
/** Password field with a button to show or hide its value */
|
|
15
|
+
const PasswordField = ({ slotProps, ...props }) => {
|
|
16
|
+
useExtendI18n(locales);
|
|
17
|
+
const { t } = useI18n();
|
|
18
|
+
const [hidden, setHidden] = useState(true);
|
|
19
|
+
return (React.createElement(TextField, { type: hidden ? 'password' : 'text', ...props, slotProps: {
|
|
20
|
+
...slotProps,
|
|
21
|
+
input: mergeSlotProps(slotProps?.input, {
|
|
22
|
+
endAdornment: (React.createElement(InputAdornment, { position: "end" },
|
|
23
|
+
React.createElement(IconButton, { "aria-label": hidden ? t('PasswordField.show') : t('PasswordField.hide'), disabled: props.disabled, onClick: () => setHidden(current => !current), edge: "end" },
|
|
24
|
+
React.createElement(Icon, { icon: hidden ? Eye : EyeClosed }))))
|
|
25
|
+
})
|
|
26
|
+
} }));
|
|
27
|
+
};
|
|
28
|
+
export default PasswordField;
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ export { NavIcon } from './components/NavIcon';
|
|
|
72
72
|
export { default as NavText } from './components/NavText';
|
|
73
73
|
export { NavDesktopLimiter } from './components/NavDesktopLimiter';
|
|
74
74
|
export { NavDesktopDropdown } from './components/NavDesktopDropdown';
|
|
75
|
+
export { default as PasswordField } from './components/PasswordField';
|
|
75
76
|
export { nameToColor, supportedColors, getInitials } from './components/Avatar/helpers';
|
|
76
77
|
export { COLORS } from './components/ColorList/helpers';
|
|
77
78
|
export { default as AccordionExpandIcon } from './components/AccordionExpandIcon';
|
|
@@ -149,6 +150,7 @@ export type { NavDropdownProps } from './components/NavLink/NavDropdown';
|
|
|
149
150
|
export type { NavIconProps } from './components/NavIcon';
|
|
150
151
|
export type { NavTextProps } from './components/NavText';
|
|
151
152
|
export type { NavDesktopLimiterProps } from './components/NavDesktopLimiter';
|
|
153
|
+
export type { PasswordFieldProps } from './components/PasswordField';
|
|
152
154
|
export type { NavDesktopDropdownProps } from './components/NavDesktopDropdown';
|
|
153
155
|
export type { VirtualizedTableProps, VirtualizedTableColumn, VirtualizedTableRow } from './components/VirtualizedTable';
|
|
154
156
|
export type { Breakpoints } from './hooks/useBreakpoints';
|
package/dist/index.js
CHANGED
|
@@ -75,6 +75,7 @@ export { NavIcon } from './components/NavIcon';
|
|
|
75
75
|
export { default as NavText } from './components/NavText';
|
|
76
76
|
export { NavDesktopLimiter } from './components/NavDesktopLimiter';
|
|
77
77
|
export { NavDesktopDropdown } from './components/NavDesktopDropdown';
|
|
78
|
+
export { default as PasswordField } from './components/PasswordField';
|
|
78
79
|
export { nameToColor, supportedColors, getInitials } from './components/Avatar/helpers';
|
|
79
80
|
export { COLORS } from './components/ColorList/helpers';
|
|
80
81
|
export { default as AccordionExpandIcon } from './components/AccordionExpandIcon';
|