@diabolic/hangover 0.1.2 → 0.1.4
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/README.md +1 -0
- package/dist/hangover.css +5 -1
- package/dist/index.cjs.js +9 -5
- package/dist/index.esm.js +9 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -970,6 +970,7 @@ All visual properties are configurable via CSS custom properties:
|
|
|
970
970
|
/* Layout */
|
|
971
971
|
--hangover-nav-width: 172px;
|
|
972
972
|
--hangover-content-max-width: 240px;
|
|
973
|
+
--hangover-panel-nonav-width: 240px;
|
|
973
974
|
--hangover-list-max-height: 280px;
|
|
974
975
|
|
|
975
976
|
--hangover-transition: 330ms ease;
|
package/dist/hangover.css
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
0 2px 4px 0 rgba(37, 45, 91, 0.04);
|
|
28
28
|
--hangover-nav-width: 172px;
|
|
29
29
|
--hangover-content-max-width: 240px;
|
|
30
|
+
--hangover-panel-nonav-width: 240px;
|
|
30
31
|
--hangover-list-max-height: 280px;
|
|
31
32
|
--hangover-transition: 330ms ease;
|
|
32
33
|
}
|
|
@@ -96,7 +97,10 @@
|
|
|
96
97
|
}
|
|
97
98
|
.hangoverDropdown-panel.hasNoNav {
|
|
98
99
|
min-width: unset;
|
|
99
|
-
width:
|
|
100
|
+
width: var(--hangover-panel-nonav-width);
|
|
101
|
+
}
|
|
102
|
+
.hangoverDropdown-panel.hasNoNav .hangoverDropdown-column.forItems {
|
|
103
|
+
max-width: none;
|
|
100
104
|
}
|
|
101
105
|
.hangoverDropdown-panel-inner {
|
|
102
106
|
display: flex;
|
package/dist/index.cjs.js
CHANGED
|
@@ -34,7 +34,8 @@ function DropdownTrigger({
|
|
|
34
34
|
const {
|
|
35
35
|
triggerRef,
|
|
36
36
|
isOpen,
|
|
37
|
-
fireEvent
|
|
37
|
+
fireEvent,
|
|
38
|
+
t
|
|
38
39
|
} = useDropdownContext();
|
|
39
40
|
const child = react.Children.only(children);
|
|
40
41
|
function handleClick(e) {
|
|
@@ -49,12 +50,14 @@ function DropdownTrigger({
|
|
|
49
50
|
}
|
|
50
51
|
child.props.onClick?.(e);
|
|
51
52
|
}
|
|
53
|
+
const childChildren = child.props.children;
|
|
54
|
+
const translatedChildren = typeof childChildren === 'string' ? t(childChildren) : childChildren;
|
|
52
55
|
return /*#__PURE__*/react.cloneElement(child, {
|
|
53
56
|
ref: triggerRef,
|
|
54
57
|
onClick: handleClick,
|
|
55
58
|
'aria-expanded': isOpen,
|
|
56
59
|
'aria-haspopup': 'dialog'
|
|
57
|
-
});
|
|
60
|
+
}, translatedChildren);
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
/**
|
|
@@ -393,6 +396,7 @@ function DropdownPanel({
|
|
|
393
396
|
placement: actualPlacement,
|
|
394
397
|
style: style,
|
|
395
398
|
className: classNames,
|
|
399
|
+
title: t(title),
|
|
396
400
|
...rest,
|
|
397
401
|
children: children
|
|
398
402
|
}) : /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -401,7 +405,7 @@ function DropdownPanel({
|
|
|
401
405
|
style: style,
|
|
402
406
|
role: "dialog",
|
|
403
407
|
"aria-modal": "true",
|
|
404
|
-
"aria-label":
|
|
408
|
+
"aria-label": t('Dropdown'),
|
|
405
409
|
...rest,
|
|
406
410
|
children: [title && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
407
411
|
className: "hangoverDropdown-panel-title",
|
|
@@ -3368,10 +3372,10 @@ function DropdownGroup({
|
|
|
3368
3372
|
const visibleItemIds = react.useMemo(() => {
|
|
3369
3373
|
const searchableItems = react.Children.toArray(children).map(child => ({
|
|
3370
3374
|
id: child?.props?.id,
|
|
3371
|
-
label: typeof child?.props?.children === 'string' ? child.props.children : ''
|
|
3375
|
+
label: typeof child?.props?.children === 'string' ? t(child.props.children) : ''
|
|
3372
3376
|
}));
|
|
3373
3377
|
return getMatchingItemIds(searchableItems, searchQuery);
|
|
3374
|
-
}, [children, searchQuery]);
|
|
3378
|
+
}, [children, searchQuery, t]);
|
|
3375
3379
|
const groupContextValue = {
|
|
3376
3380
|
groupLabel: label,
|
|
3377
3381
|
groupId,
|
package/dist/index.esm.js
CHANGED
|
@@ -30,7 +30,8 @@ function DropdownTrigger({
|
|
|
30
30
|
const {
|
|
31
31
|
triggerRef,
|
|
32
32
|
isOpen,
|
|
33
|
-
fireEvent
|
|
33
|
+
fireEvent,
|
|
34
|
+
t
|
|
34
35
|
} = useDropdownContext();
|
|
35
36
|
const child = Children.only(children);
|
|
36
37
|
function handleClick(e) {
|
|
@@ -45,12 +46,14 @@ function DropdownTrigger({
|
|
|
45
46
|
}
|
|
46
47
|
child.props.onClick?.(e);
|
|
47
48
|
}
|
|
49
|
+
const childChildren = child.props.children;
|
|
50
|
+
const translatedChildren = typeof childChildren === 'string' ? t(childChildren) : childChildren;
|
|
48
51
|
return /*#__PURE__*/cloneElement(child, {
|
|
49
52
|
ref: triggerRef,
|
|
50
53
|
onClick: handleClick,
|
|
51
54
|
'aria-expanded': isOpen,
|
|
52
55
|
'aria-haspopup': 'dialog'
|
|
53
|
-
});
|
|
56
|
+
}, translatedChildren);
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
/**
|
|
@@ -389,6 +392,7 @@ function DropdownPanel({
|
|
|
389
392
|
placement: actualPlacement,
|
|
390
393
|
style: style,
|
|
391
394
|
className: classNames,
|
|
395
|
+
title: t(title),
|
|
392
396
|
...rest,
|
|
393
397
|
children: children
|
|
394
398
|
}) : /*#__PURE__*/jsxs("div", {
|
|
@@ -397,7 +401,7 @@ function DropdownPanel({
|
|
|
397
401
|
style: style,
|
|
398
402
|
role: "dialog",
|
|
399
403
|
"aria-modal": "true",
|
|
400
|
-
"aria-label":
|
|
404
|
+
"aria-label": t('Dropdown'),
|
|
401
405
|
...rest,
|
|
402
406
|
children: [title && /*#__PURE__*/jsx("div", {
|
|
403
407
|
className: "hangoverDropdown-panel-title",
|
|
@@ -3364,10 +3368,10 @@ function DropdownGroup({
|
|
|
3364
3368
|
const visibleItemIds = useMemo(() => {
|
|
3365
3369
|
const searchableItems = Children.toArray(children).map(child => ({
|
|
3366
3370
|
id: child?.props?.id,
|
|
3367
|
-
label: typeof child?.props?.children === 'string' ? child.props.children : ''
|
|
3371
|
+
label: typeof child?.props?.children === 'string' ? t(child.props.children) : ''
|
|
3368
3372
|
}));
|
|
3369
3373
|
return getMatchingItemIds(searchableItems, searchQuery);
|
|
3370
|
-
}, [children, searchQuery]);
|
|
3374
|
+
}, [children, searchQuery, t]);
|
|
3371
3375
|
const groupContextValue = {
|
|
3372
3376
|
groupLabel: label,
|
|
3373
3377
|
groupId,
|