draft-components 2.0.1 → 2.2.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.
|
@@ -18,6 +18,22 @@
|
|
|
18
18
|
border: 0 !important;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
.border-top-0 {
|
|
22
|
+
border-top: 0 !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.border-right-0 {
|
|
26
|
+
border-right: 0 !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.border-bottom-0 {
|
|
30
|
+
border-bottom: 0 !important;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.border-left-0 {
|
|
34
|
+
border-left: 0 !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
21
37
|
.border-transparent-1 {
|
|
22
38
|
border: 1px solid var(--dc-border-color-transparent-1) !important;
|
|
23
39
|
}
|
package/css/draft-components.css
CHANGED
|
@@ -1528,8 +1528,8 @@
|
|
|
1528
1528
|
background: var(--dc-password-input-toggle-bg);
|
|
1529
1529
|
}
|
|
1530
1530
|
|
|
1531
|
-
.dc-password-input__toggle-button:focus,
|
|
1532
|
-
.dc-password-input__toggle-button:hover {
|
|
1531
|
+
.dc-password-input__toggle-button:not(:disabled):focus,
|
|
1532
|
+
.dc-password-input__toggle-button:not(:disabled):hover {
|
|
1533
1533
|
color: var(--dc-password-input-toggle-color-hover);
|
|
1534
1534
|
cursor: pointer;
|
|
1535
1535
|
outline: none;
|
|
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { TextInputProps } from '../text-input/index.js';
|
|
3
3
|
export type PasswordInputBaseProps = Omit<TextInputProps, 'type' | 'slotRight'>;
|
|
4
4
|
export type PasswordInputProps = {
|
|
5
|
+
loading?: boolean;
|
|
5
6
|
defaultVisible?: boolean;
|
|
6
7
|
getTooltipText?: (visible: boolean) => ReactNode;
|
|
7
8
|
renderToggleButtonIcon?: (visible: boolean) => ReactNode;
|
|
@@ -5,13 +5,16 @@ import { TextInput } from '../text-input/index.js';
|
|
|
5
5
|
import { Tooltip } from '../tooltip/index.js';
|
|
6
6
|
import { EyeIcon } from '../hero-icons/24/outline/eye-icon.js';
|
|
7
7
|
import { EyeSlashIcon } from '../hero-icons/24/outline/eye-slash-icon.js';
|
|
8
|
+
import { Spinner } from '../spinner/index.js';
|
|
8
9
|
const getDefaultTooltipText = (visible) => (visible
|
|
9
10
|
? 'Hide password'
|
|
10
11
|
: 'Show password');
|
|
11
12
|
const renderToggleButtonDefaultIcon = (visible) => (visible
|
|
12
13
|
? _jsx(EyeIcon, { width: "1.25em", height: "1.25em" })
|
|
13
14
|
: _jsx(EyeSlashIcon, { width: "1.25em", height: "1.25em" }));
|
|
14
|
-
export const PasswordInput = forwardRef(function PasswordInput({ className, defaultVisible = false, getTooltipText = getDefaultTooltipText, renderToggleButtonIcon = renderToggleButtonDefaultIcon, ...props }, ref) {
|
|
15
|
+
export const PasswordInput = forwardRef(function PasswordInput({ className, loading = false, defaultVisible = false, getTooltipText = getDefaultTooltipText, renderToggleButtonIcon = renderToggleButtonDefaultIcon, ...props }, ref) {
|
|
15
16
|
const [visible, setVisible] = useState(defaultVisible);
|
|
16
|
-
return (_jsx(TextInput, { ...props, ref: ref, className: classNames('dc-password-input', className), type: visible ? 'text' : 'password', slotRight: () => (_jsx(Tooltip, { content: getTooltipText(visible), children: _jsx("button", { className: "dc-password-input__toggle-button", type: "button", onClick: () => setVisible(!visible), children:
|
|
17
|
+
return (_jsx(TextInput, { ...props, ref: ref, className: classNames('dc-password-input', className), type: visible ? 'text' : 'password', readOnly: loading ?? props.readOnly, slotRight: () => (_jsx(Tooltip, { content: getTooltipText(visible), children: _jsx("button", { className: "dc-password-input__toggle-button", type: "button", disabled: loading, onClick: () => setVisible(!visible), children: loading
|
|
18
|
+
? _jsx(Spinner, { width: "1.15em" })
|
|
19
|
+
: renderToggleButtonIcon(visible) }) })) }));
|
|
17
20
|
});
|