@efolusi/meridian 1.15.0 → 1.17.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/components.css +6 -0
- package/feedback/Dialog.d.ts +3 -0
- package/feedback/Dialog.js +2 -1
- package/forms/Input.d.ts +6 -0
- package/forms/Input.js +21 -2
- package/overlay/Drawer.d.ts +3 -0
- package/overlay/Drawer.js +2 -1
- package/package.json +1 -1
package/components.css
CHANGED
|
@@ -1019,6 +1019,12 @@ button.ef-listitem:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
|
1019
1019
|
.ef-input--icon.ef-input--md .ef-input__el{padding-left:36px}
|
|
1020
1020
|
.ef-input--icon.ef-input--lg .ef-input__el{padding-left:40px}
|
|
1021
1021
|
.ef-input__icon{position:absolute;left:11px;color:var(--text-muted);display:inline-flex;pointer-events:none}
|
|
1022
|
+
.ef-input__reveal{position:absolute;right:6px;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:var(--radius-sm);background:none;color:var(--text-muted);cursor:pointer}
|
|
1023
|
+
.ef-input__reveal:hover{color:var(--text-primary)}
|
|
1024
|
+
.ef-input__reveal:focus-visible{outline:none;box-shadow:var(--focus-ring)}
|
|
1025
|
+
.ef-input--reveal.ef-input--sm .ef-input__el{padding-right:34px}
|
|
1026
|
+
.ef-input--reveal.ef-input--md .ef-input__el{padding-right:38px}
|
|
1027
|
+
.ef-input--reveal.ef-input--lg .ef-input__el{padding-right:42px}
|
|
1022
1028
|
.ef-input--invalid .ef-input__el{border-color:var(--danger-600)}
|
|
1023
1029
|
.ef-input--invalid .ef-input__el:focus{box-shadow:var(--focus-ring-danger)}
|
|
1024
1030
|
/* components/forms/InputGroup.jsx */
|
package/feedback/Dialog.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ export interface DialogProps {
|
|
|
2
2
|
open: boolean;
|
|
3
3
|
/** Called on ✕, ESC, or overlay click; omit to hide ✕ */
|
|
4
4
|
onClose?: () => void;
|
|
5
|
+
/** Accessible name of the ✕ button. Pass a translated string in a
|
|
6
|
+
* non-English UI. @default 'Close' */
|
|
7
|
+
closeLabel?: string;
|
|
5
8
|
title: React.ReactNode;
|
|
6
9
|
description?: React.ReactNode;
|
|
7
10
|
/** Right-aligned action row on sunken strip */
|
package/feedback/Dialog.js
CHANGED
|
@@ -7,6 +7,7 @@ const FOCUSABLE = 'button,[href],input,select,textarea,[tabindex]:not([tabindex=
|
|
|
7
7
|
export const Dialog = /*#__PURE__*/React.forwardRef(function Dialog({
|
|
8
8
|
open,
|
|
9
9
|
onClose,
|
|
10
|
+
closeLabel = 'Close',
|
|
10
11
|
title,
|
|
11
12
|
description,
|
|
12
13
|
footer,
|
|
@@ -86,7 +87,7 @@ export const Dialog = /*#__PURE__*/React.forwardRef(function Dialog({
|
|
|
86
87
|
id: descId
|
|
87
88
|
}, description) : null), onClose ? /*#__PURE__*/React.createElement(IconButton, {
|
|
88
89
|
icon: "x",
|
|
89
|
-
label:
|
|
90
|
+
label: closeLabel,
|
|
90
91
|
size: "sm",
|
|
91
92
|
onClick: onClose
|
|
92
93
|
}) : null), /*#__PURE__*/React.createElement("div", {
|
package/forms/Input.d.ts
CHANGED
|
@@ -10,5 +10,11 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
10
10
|
/** @default 'md' */
|
|
11
11
|
size?: 'sm' | 'md' | 'lg';
|
|
12
12
|
invalid?: boolean;
|
|
13
|
+
/** Adds a show/hide button to a `type="password"` field */
|
|
14
|
+
revealable?: boolean;
|
|
15
|
+
/** @default 'Show password' */
|
|
16
|
+
revealLabel?: string;
|
|
17
|
+
/** @default 'Hide password' */
|
|
18
|
+
hideLabel?: string;
|
|
13
19
|
}
|
|
14
20
|
export declare function Input(props: InputProps): React.JSX.Element;
|
package/forms/Input.js
CHANGED
|
@@ -10,10 +10,18 @@ export function Input({
|
|
|
10
10
|
iconLeft,
|
|
11
11
|
size = 'md',
|
|
12
12
|
invalid,
|
|
13
|
+
revealable,
|
|
14
|
+
revealLabel = 'Show password',
|
|
15
|
+
hideLabel = 'Hide password',
|
|
13
16
|
style,
|
|
14
17
|
className,
|
|
15
18
|
...rest
|
|
16
19
|
}) {
|
|
20
|
+
// A password field people cannot read back is a password field people mistype.
|
|
21
|
+
// The toggle is a real button so it is reachable by keyboard, and it is left
|
|
22
|
+
// out of the tab order only when there is nothing to reveal.
|
|
23
|
+
const [revealed, setRevealed] = React.useState(false);
|
|
24
|
+
const showToggle = revealable && rest.type === 'password';
|
|
17
25
|
// Picks up id / aria wiring when nested in a FormField; standalone this is a no-op.
|
|
18
26
|
const field = useFieldProps({
|
|
19
27
|
invalid,
|
|
@@ -23,7 +31,7 @@ export function Input({
|
|
|
23
31
|
});
|
|
24
32
|
const bad = field.invalid;
|
|
25
33
|
const control = /*#__PURE__*/React.createElement("span", {
|
|
26
|
-
className: `ef-input ef-input--${size}${iconLeft ? ' ef-input--icon' : ''}${bad ? ' ef-input--invalid' : ''}`
|
|
34
|
+
className: `ef-input ef-input--${size}${iconLeft ? ' ef-input--icon' : ''}${showToggle ? ' ef-input--reveal' : ''}${bad ? ' ef-input--invalid' : ''}`
|
|
27
35
|
}, iconLeft ? /*#__PURE__*/React.createElement("span", {
|
|
28
36
|
className: "ef-input__icon"
|
|
29
37
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -32,7 +40,18 @@ export function Input({
|
|
|
32
40
|
})) : null, /*#__PURE__*/React.createElement("input", _extends({
|
|
33
41
|
className: "ef-input__el",
|
|
34
42
|
"aria-invalid": bad || undefined
|
|
35
|
-
}, rest, field.controlProps
|
|
43
|
+
}, rest, field.controlProps, {
|
|
44
|
+
type: showToggle && revealed ? 'text' : rest.type
|
|
45
|
+
})), showToggle ? /*#__PURE__*/React.createElement("button", {
|
|
46
|
+
type: "button",
|
|
47
|
+
className: "ef-input__reveal",
|
|
48
|
+
"aria-label": revealed ? hideLabel : revealLabel,
|
|
49
|
+
"aria-pressed": revealed,
|
|
50
|
+
onClick: () => setRevealed(v => !v)
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
52
|
+
name: revealed ? 'eye-off' : 'eye',
|
|
53
|
+
size: 16
|
|
54
|
+
})) : null);
|
|
36
55
|
if (!label && !hint && !error) return /*#__PURE__*/React.cloneElement(control, {
|
|
37
56
|
style,
|
|
38
57
|
className: control.props.className + (className ? ' ' + className : '')
|
package/overlay/Drawer.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ export interface DrawerProps {
|
|
|
2
2
|
open: boolean;
|
|
3
3
|
/** Called on ✕, ESC, or overlay click */
|
|
4
4
|
onClose?: () => void;
|
|
5
|
+
/** Accessible name of the ✕ button. Pass a translated string in a
|
|
6
|
+
* non-English UI. @default 'Close' */
|
|
7
|
+
closeLabel?: string;
|
|
5
8
|
title: React.ReactNode;
|
|
6
9
|
/** Right-aligned action row on sunken strip */
|
|
7
10
|
footer?: React.ReactNode;
|
package/overlay/Drawer.js
CHANGED
|
@@ -7,6 +7,7 @@ const FOCUSABLE = 'button,[href],input,select,textarea,[tabindex]:not([tabindex=
|
|
|
7
7
|
export const Drawer = /*#__PURE__*/React.forwardRef(function Drawer({
|
|
8
8
|
open,
|
|
9
9
|
onClose,
|
|
10
|
+
closeLabel = 'Close',
|
|
10
11
|
title,
|
|
11
12
|
footer,
|
|
12
13
|
width = 400,
|
|
@@ -77,7 +78,7 @@ export const Drawer = /*#__PURE__*/React.forwardRef(function Drawer({
|
|
|
77
78
|
id: titleId
|
|
78
79
|
}, title), onClose ? /*#__PURE__*/React.createElement(IconButton, {
|
|
79
80
|
icon: "x",
|
|
80
|
-
label:
|
|
81
|
+
label: closeLabel,
|
|
81
82
|
size: "sm",
|
|
82
83
|
onClick: onClose
|
|
83
84
|
}) : null), /*#__PURE__*/React.createElement("div", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@efolusi/meridian",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "A general-purpose open-source design system by Efolusi: accessible React components, design tokens, blocks and example apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://meridian.efolusi.com",
|