@semcore/dropdown-menu 4.48.2-prerelease.0 → 4.49.0-prerelease.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 +6 -0
- package/lib/cjs/DropdownMenu.js +257 -236
- package/lib/cjs/DropdownMenu.js.map +1 -1
- package/lib/cjs/components/Context.js +16 -0
- package/lib/cjs/components/Context.js.map +1 -0
- package/lib/cjs/components/VirtualList.js +148 -0
- package/lib/cjs/components/VirtualList.js.map +1 -0
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/dropdown-menu.shadow.css +28 -85
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +4 -5
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/translations/de.json +1 -3
- package/lib/cjs/translations/es.json +1 -3
- package/lib/cjs/translations/fr.json +1 -3
- package/lib/cjs/translations/it.json +1 -3
- package/lib/cjs/translations/ja.json +1 -3
- package/lib/cjs/translations/ko.json +1 -3
- package/lib/cjs/translations/nl.json +1 -3
- package/lib/cjs/translations/pl.json +1 -3
- package/lib/cjs/translations/pt.json +1 -3
- package/lib/cjs/translations/sv.json +1 -3
- package/lib/cjs/translations/tr.json +1 -3
- package/lib/cjs/translations/vi.json +1 -3
- package/lib/cjs/translations/zh.json +1 -3
- package/lib/es6/DropdownMenu.js +248 -228
- package/lib/es6/DropdownMenu.js.map +1 -1
- package/lib/es6/components/Context.js +9 -0
- package/lib/es6/components/Context.js.map +1 -0
- package/lib/es6/components/VirtualList.js +143 -0
- package/lib/es6/components/VirtualList.js.map +1 -0
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/dropdown-menu.shadow.css +28 -85
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/translations/de.json +1 -3
- package/lib/es6/translations/es.json +1 -3
- package/lib/es6/translations/fr.json +1 -3
- package/lib/es6/translations/it.json +1 -3
- package/lib/es6/translations/ja.json +1 -3
- package/lib/es6/translations/ko.json +1 -3
- package/lib/es6/translations/nl.json +1 -3
- package/lib/es6/translations/pl.json +1 -3
- package/lib/es6/translations/pt.json +1 -3
- package/lib/es6/translations/sv.json +1 -3
- package/lib/es6/translations/tr.json +1 -3
- package/lib/es6/translations/vi.json +1 -3
- package/lib/es6/translations/zh.json +1 -3
- package/lib/esm/DropdownMenu.mjs +215 -188
- package/lib/esm/components/Context.mjs +11 -0
- package/lib/esm/components/VirtualList.mjs +135 -0
- package/lib/esm/style/dropdown-menu.shadow.css +28 -85
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/esm/translations/de.json.mjs +2 -6
- package/lib/esm/translations/es.json.mjs +2 -6
- package/lib/esm/translations/fr.json.mjs +2 -6
- package/lib/esm/translations/it.json.mjs +2 -6
- package/lib/esm/translations/ja.json.mjs +2 -6
- package/lib/esm/translations/ko.json.mjs +2 -6
- package/lib/esm/translations/nl.json.mjs +2 -6
- package/lib/esm/translations/pl.json.mjs +2 -6
- package/lib/esm/translations/pt.json.mjs +2 -6
- package/lib/esm/translations/sv.json.mjs +2 -6
- package/lib/esm/translations/tr.json.mjs +2 -6
- package/lib/esm/translations/vi.json.mjs +2 -6
- package/lib/esm/translations/zh.json.mjs +2 -6
- package/lib/types/components/Context.d.ts +2 -0
- package/lib/types/components/VirtualList.d.ts +28 -0
- package/lib/types/index.d.ts +30 -79
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +16 -0
- package/package.json +12 -12
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
+
import { sstyled, assignProps, Component, createComponent } from "@semcore/core";
|
|
8
|
+
import { ScrollArea, Box } from "@semcore/base-components";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { ListBoxContextProvider } from "./Context.mjs";
|
|
11
|
+
/*!__reshadow-styles__:"../style/dropdown-menu.shadow.css"*/
|
|
12
|
+
var style = (
|
|
13
|
+
/*__reshadow_css_start__*/
|
|
14
|
+
(sstyled.insert(
|
|
15
|
+
/*__inner_css_start__*/
|
|
16
|
+
'.___SDropdownMenuList_1d74h_gg_{max-height:240px;padding:var(--intergalactic-spacing-1x, 4px)0;position:relative;min-height:26px;min-width:32px;box-sizing:content-box;z-index:0;color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___SDropdownMenuList_1d74h_gg_ .___SBar_1d74h_gg_{z-index:3}.___SDropdownMenuList_1d74h_gg_:not(.___SDropdownMenuList_1d74h_gg_:has([data-ui-name="DropdownMenu.Group"][data-sticky=true])) .___SShadowHorizontal_1d74h_gg_:after,.___SDropdownMenuList_1d74h_gg_:not(.___SDropdownMenuList_1d74h_gg_:has([data-ui-name="DropdownMenu.Group"][data-sticky=true])) .___SShadowHorizontal_1d74h_gg_:before,.___SDropdownMenuList_1d74h_gg_:not(.___SDropdownMenuList_1d74h_gg_:has([data-ui-name="DropdownMenu.Group"][data-sticky=true])) .___SShadowVertical_1d74h_gg_:after,.___SDropdownMenuList_1d74h_gg_:not(.___SDropdownMenuList_1d74h_gg_:has([data-ui-name="DropdownMenu.Group"][data-sticky=true])) .___SShadowVertical_1d74h_gg_:before{border-radius:var(--intergalactic-control-rounded, 6px)}.___SDropdownMenuItemContainer_1d74h_gg_ .___SItemContent_1d74h_gg_:focus-visible{outline:0}.___SDropdownMenuItemContainer_1d74h_gg_.__nesting-trigger_1d74h_gg_{justify-content:space-between}.___SDropdownMenuItemAddon_1d74h_gg_,.___SItemContentText_1d74h_gg_{display:inline-flex;margin-left:var(--intergalactic-spacing-1x, 4px);margin-right:var(--intergalactic-spacing-1x, 4px)}.___SDropdownMenuItemAddon_1d74h_gg_:first-child,.___SItemContentText_1d74h_gg_:first-child{margin-left:0}.___SDropdownMenuItemAddon_1d74h_gg_:last-child,.___SItemContentText_1d74h_gg_:last-child{margin-right:0}.___SDropdownMenuNesting_1d74h_gg_,.___SDropdownMenuNesting_1d74h_gg_._size_l_1d74h_gg_,.___SDropdownMenuNesting_1d74h_gg_._size_m_1d74h_gg_{padding:0}.___SDropdownMenuNesting_1d74h_gg_.__highlighted_1d74h_gg_{z-index:1;outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:-2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}.___SDropdownNestingItem_1d74h_gg_._size_l_1d74h_gg_,.___SDropdownNestingItem_1d74h_gg_._size_m_1d74h_gg_{padding-right:0}.___SDropdownNestingItem_1d74h_gg_ .___SDropdownMenuItemContainer_1d74h_gg_{width:auto;padding-top:0;padding-bottom:0;padding-left:0;min-height:auto}.___SItemHint_1d74h_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@supports (color:color(display-p3 0 0 0%)){.___SItemHint_1d74h_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SItemHint_1d74h_gg_{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SScrollContainer_1d74h_gg_:has([data-ui-name="DropdownMenu.Group"][data-sticky=true]){overscroll-behavior:none}',
|
|
17
|
+
/*__inner_css_end__*/
|
|
18
|
+
"1d74h_gg_"
|
|
19
|
+
), /*__reshadow_css_end__*/
|
|
20
|
+
{
|
|
21
|
+
"__SDropdownMenuItemContainer": "___SDropdownMenuItemContainer_1d74h_gg_",
|
|
22
|
+
"_nesting-trigger": "__nesting-trigger_1d74h_gg_",
|
|
23
|
+
"__SDropdownMenuNesting": "___SDropdownMenuNesting_1d74h_gg_",
|
|
24
|
+
"_size_l": "_size_l_1d74h_gg_",
|
|
25
|
+
"_size_m": "_size_m_1d74h_gg_",
|
|
26
|
+
"_highlighted": "__highlighted_1d74h_gg_",
|
|
27
|
+
"__SDropdownNestingItem": "___SDropdownNestingItem_1d74h_gg_",
|
|
28
|
+
"__SItemHint": "___SItemHint_1d74h_gg_",
|
|
29
|
+
"__SDropdownMenuList": "___SDropdownMenuList_1d74h_gg_",
|
|
30
|
+
"__SBar": "___SBar_1d74h_gg_",
|
|
31
|
+
"__SShadowHorizontal": "___SShadowHorizontal_1d74h_gg_",
|
|
32
|
+
"__SShadowVertical": "___SShadowVertical_1d74h_gg_",
|
|
33
|
+
"__SItemContent": "___SItemContent_1d74h_gg_",
|
|
34
|
+
"__SDropdownMenuItemAddon": "___SDropdownMenuItemAddon_1d74h_gg_",
|
|
35
|
+
"__SItemContentText": "___SItemContentText_1d74h_gg_",
|
|
36
|
+
"__SScrollContainer": "___SScrollContainer_1d74h_gg_"
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
var VirtualListRoot = /* @__PURE__ */ (function(_Component) {
|
|
40
|
+
function VirtualListRoot2() {
|
|
41
|
+
var _this;
|
|
42
|
+
_classCallCheck(this, VirtualListRoot2);
|
|
43
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
44
|
+
args[_key] = arguments[_key];
|
|
45
|
+
}
|
|
46
|
+
_this = _callSuper(this, VirtualListRoot2, [].concat(args));
|
|
47
|
+
_defineProperty(_this, "containerRef", /* @__PURE__ */ React.createRef());
|
|
48
|
+
_defineProperty(_this, "listRef", /* @__PURE__ */ React.createRef());
|
|
49
|
+
_defineProperty(_this, "state", {
|
|
50
|
+
scrollTop: 0,
|
|
51
|
+
scrollDirection: "down"
|
|
52
|
+
});
|
|
53
|
+
_defineProperty(_this, "handleScroll", function(e) {
|
|
54
|
+
if (e.target instanceof HTMLElement) {
|
|
55
|
+
var scrollDirection = e.target.scrollTop > _this.state.scrollTop ? "down" : "up";
|
|
56
|
+
_this.setState({
|
|
57
|
+
scrollDirection,
|
|
58
|
+
scrollTop: e.target.scrollTop
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
_inherits(VirtualListRoot2, _Component);
|
|
65
|
+
return _createClass(VirtualListRoot2, [{
|
|
66
|
+
key: "componentDidMount",
|
|
67
|
+
value: function componentDidMount() {
|
|
68
|
+
var _this2 = this;
|
|
69
|
+
var _this$asProps = this.asProps, index = _this$asProps.index, rowHeight = _this$asProps.rowHeight, rowsBuffer = _this$asProps.rowsBuffer;
|
|
70
|
+
setTimeout(function() {
|
|
71
|
+
var _this2$listRef$curren, _this2$listRef$curren2, _this2$containerRef$c;
|
|
72
|
+
var listHeight = ((_this2$listRef$curren = (_this2$listRef$curren2 = _this2.listRef.current) === null || _this2$listRef$curren2 === void 0 ? void 0 : _this2$listRef$curren2.getBoundingClientRect().height) !== null && _this2$listRef$curren !== void 0 ? _this2$listRef$curren : 0) / 2;
|
|
73
|
+
(_this2$containerRef$c = _this2.containerRef.current) === null || _this2$containerRef$c === void 0 || _this2$containerRef$c.scrollTo({
|
|
74
|
+
top: index * rowHeight - listHeight + rowHeight / 2
|
|
75
|
+
});
|
|
76
|
+
if (index <= rowsBuffer) {
|
|
77
|
+
_this2.forceUpdate();
|
|
78
|
+
}
|
|
79
|
+
}, 10);
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "render",
|
|
83
|
+
value: function render() {
|
|
84
|
+
var _ref = this.asProps, _ref2, _this$listRef$current, _this$listRef$current2;
|
|
85
|
+
var SDropdownMenuList = ScrollArea;
|
|
86
|
+
var SBar = ScrollArea.Bar;
|
|
87
|
+
var _this$state = this.state, scrollDirection = _this$state.scrollDirection, scrollTop = _this$state.scrollTop;
|
|
88
|
+
var _this$asProps2 = this.asProps, rows = _this$asProps2.rows, rowHeight = _this$asProps2.rowHeight, rowsBuffer = _this$asProps2.rowsBuffer, styles = _this$asProps2.styles, RenderRow = _this$asProps2.renderRow, customData = _this$asProps2.customData;
|
|
89
|
+
var offsetHeight = (_this$listRef$current = (_this$listRef$current2 = this.listRef.current) === null || _this$listRef$current2 === void 0 ? void 0 : _this$listRef$current2.offsetHeight) !== null && _this$listRef$current !== void 0 ? _this$listRef$current : 0;
|
|
90
|
+
var prevPrepared = scrollDirection === "down" ? rowsBuffer / 2 : rowsBuffer;
|
|
91
|
+
var nextPrepared = scrollDirection === "up" ? rowsBuffer / 2 : rowsBuffer;
|
|
92
|
+
var startIndex = Math.max(Math.floor(scrollTop / rowHeight) - prevPrepared, 0);
|
|
93
|
+
var lastIndex = Math.min(Math.ceil((scrollTop + offsetHeight) / rowHeight) + nextPrepared, rows.length);
|
|
94
|
+
var rowsToRender = rows.slice(startIndex, lastIndex);
|
|
95
|
+
var rowMarginTop = rowHeight * startIndex;
|
|
96
|
+
var rowMarginBottom = rowHeight * (rows.length - lastIndex);
|
|
97
|
+
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(ListBoxContextProvider, _ref2.cn("ListBoxContextProvider", {}), /* @__PURE__ */ React.createElement(SDropdownMenuList, _ref2.cn("SDropdownMenuList", _objectSpread({}, assignProps({
|
|
98
|
+
"shadow": true,
|
|
99
|
+
"shadowSize": 16,
|
|
100
|
+
"shadowTheme": "light",
|
|
101
|
+
"onScroll": this.handleScroll,
|
|
102
|
+
"data-is-virtual": "true",
|
|
103
|
+
"ref": this.listRef
|
|
104
|
+
}, _ref))), /* @__PURE__ */ React.createElement(ScrollArea.Container, {
|
|
105
|
+
ref: this.containerRef,
|
|
106
|
+
tabIndex: void 0,
|
|
107
|
+
h: rows.length * rowHeight
|
|
108
|
+
}, /* @__PURE__ */ React.createElement(Box, _ref2.cn("Box", {
|
|
109
|
+
"h": rowMarginTop
|
|
110
|
+
})), rowsToRender.map(function(item, index) {
|
|
111
|
+
return /* @__PURE__ */ React.createElement(RenderRow, {
|
|
112
|
+
key: startIndex + index,
|
|
113
|
+
row: item,
|
|
114
|
+
index: startIndex + index,
|
|
115
|
+
data: customData
|
|
116
|
+
});
|
|
117
|
+
}), /* @__PURE__ */ React.createElement(Box, _ref2.cn("Box", {
|
|
118
|
+
"h": rowMarginBottom
|
|
119
|
+
}))), /* @__PURE__ */ React.createElement(SBar, _ref2.cn("SBar", {
|
|
120
|
+
"orientation": "horizontal"
|
|
121
|
+
})), /* @__PURE__ */ React.createElement(SBar, _ref2.cn("SBar", {
|
|
122
|
+
"orientation": "vertical"
|
|
123
|
+
}))));
|
|
124
|
+
}
|
|
125
|
+
}]);
|
|
126
|
+
})(Component);
|
|
127
|
+
_defineProperty(VirtualListRoot, "displayName", "VirtualList");
|
|
128
|
+
_defineProperty(VirtualListRoot, "style", style);
|
|
129
|
+
_defineProperty(VirtualListRoot, "defaultProps", {
|
|
130
|
+
rowsBuffer: 6
|
|
131
|
+
});
|
|
132
|
+
var VirtualList = createComponent(VirtualListRoot);
|
|
133
|
+
export {
|
|
134
|
+
VirtualList
|
|
135
|
+
};
|
|
@@ -6,92 +6,32 @@ SDropdownMenuList {
|
|
|
6
6
|
min-width: 32px;
|
|
7
7
|
box-sizing: content-box;
|
|
8
8
|
z-index: 0;
|
|
9
|
-
color: var(--intergalactic-text-primary,
|
|
9
|
+
color: var(--intergalactic-text-primary, oklch(0.1 0.03 137 / 0.899));
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
&:after {
|
|
14
|
-
width: 16px;
|
|
15
|
-
height: 100%;
|
|
16
|
-
border-radius: var(--intergalactic-control-rounded, 6px);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
SShadowHorizontal[position='median'] {
|
|
21
|
-
&:before {
|
|
22
|
-
background: var(
|
|
23
|
-
--intergalactic-scroll-area-dropdown-menu-left,
|
|
24
|
-
linear-gradient(to right, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&:after {
|
|
29
|
-
background: var(
|
|
30
|
-
--intergalactic-scroll-area-dropdown-menu-right,
|
|
31
|
-
linear-gradient(to left, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
|
|
32
|
-
);
|
|
33
|
-
}
|
|
11
|
+
SBar {
|
|
12
|
+
z-index: 3;
|
|
34
13
|
}
|
|
35
14
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
15
|
+
&:not(&:has([data-ui-name="DropdownMenu.Group"][data-sticky="true"])) {
|
|
16
|
+
SShadowHorizontal {
|
|
17
|
+
&:before,
|
|
18
|
+
&:after {
|
|
19
|
+
border-radius: var(--intergalactic-control-rounded, 6px);
|
|
20
|
+
}
|
|
42
21
|
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
SShadowHorizontal[position='end'] {
|
|
46
|
-
&:after {
|
|
47
|
-
background: var(
|
|
48
|
-
--intergalactic-scroll-area-dropdown-menu-right,
|
|
49
|
-
linear-gradient(to left, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
22
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
border-radius: var(--intergalactic-control-rounded, 6px);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
SShadowVertical[position='median'] {
|
|
64
|
-
&:before {
|
|
65
|
-
background: var(
|
|
66
|
-
--intergalactic-scroll-area-dropdown-menu-top,
|
|
67
|
-
linear-gradient(to bottom, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&:after {
|
|
72
|
-
background: var(
|
|
73
|
-
--intergalactic-scroll-area-dropdown-menu-bottom,
|
|
74
|
-
linear-gradient(to top, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
SShadowVertical[position='start'] {
|
|
80
|
-
&:before {
|
|
81
|
-
background: var(
|
|
82
|
-
--intergalactic-scroll-area-dropdown-menu-top,
|
|
83
|
-
linear-gradient(to bottom, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
|
|
84
|
-
);
|
|
23
|
+
SShadowVertical {
|
|
24
|
+
&:before,
|
|
25
|
+
&:after {
|
|
26
|
+
border-radius: var(--intergalactic-control-rounded, 6px);
|
|
27
|
+
}
|
|
85
28
|
}
|
|
86
29
|
}
|
|
30
|
+
}
|
|
87
31
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
--intergalactic-scroll-area-dropdown-menu-bottom,
|
|
92
|
-
linear-gradient(to top, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
|
|
93
|
-
);
|
|
94
|
-
}
|
|
32
|
+
SDropdownMenuItemContainer {
|
|
33
|
+
SItemContent:focus-visible {
|
|
34
|
+
outline: none;
|
|
95
35
|
}
|
|
96
36
|
}
|
|
97
37
|
|
|
@@ -99,8 +39,9 @@ SDropdownMenuItemContainer[nesting-trigger] {
|
|
|
99
39
|
justify-content: space-between;
|
|
100
40
|
}
|
|
101
41
|
|
|
102
|
-
SDropdownMenuItemAddon,
|
|
103
|
-
|
|
42
|
+
SDropdownMenuItemAddon,
|
|
43
|
+
SItemContentText {
|
|
44
|
+
display: inline-flex; /* todo: Brauer Ilia - why? should be changed to inline/inline-block for SItemContentText */
|
|
104
45
|
margin-left: var(--intergalactic-spacing-1x, 4px);
|
|
105
46
|
margin-right: var(--intergalactic-spacing-1x, 4px);
|
|
106
47
|
|
|
@@ -121,7 +62,7 @@ SDropdownMenuNesting[size='m'] {
|
|
|
121
62
|
|
|
122
63
|
SDropdownMenuNesting[highlighted] {
|
|
123
64
|
z-index: 1;
|
|
124
|
-
|
|
65
|
+
@mixin focus-outline-mixin -2px;
|
|
125
66
|
}
|
|
126
67
|
|
|
127
68
|
SDropdownNestingItem[size='l'],
|
|
@@ -137,10 +78,12 @@ SDropdownNestingItem SDropdownMenuItemContainer {
|
|
|
137
78
|
min-height: auto;
|
|
138
79
|
}
|
|
139
80
|
|
|
140
|
-
|
|
141
|
-
|
|
81
|
+
SItemHint {
|
|
82
|
+
color: var(--intergalactic-text-secondary, oklch(0.088 0.026 147.7 / 0.583));
|
|
142
83
|
}
|
|
143
84
|
|
|
144
|
-
|
|
145
|
-
|
|
85
|
+
SScrollContainer {
|
|
86
|
+
&:has([data-ui-name="DropdownMenu.Group"][data-sticky="true"]) {
|
|
87
|
+
overscroll-behavior: none;
|
|
88
|
+
}
|
|
146
89
|
}
|
|
@@ -6,12 +6,12 @@ import it from "./it.json.mjs";
|
|
|
6
6
|
import ja from "./ja.json.mjs";
|
|
7
7
|
import ko from "./ko.json.mjs";
|
|
8
8
|
import nl from "./nl.json.mjs";
|
|
9
|
+
import pl from "./pl.json.mjs";
|
|
9
10
|
import pt from "./pt.json.mjs";
|
|
11
|
+
import sv from "./sv.json.mjs";
|
|
10
12
|
import tr from "./tr.json.mjs";
|
|
11
13
|
import vi from "./vi.json.mjs";
|
|
12
14
|
import zh from "./zh.json.mjs";
|
|
13
|
-
import pl from "./pl.json.mjs";
|
|
14
|
-
import sv from "./sv.json.mjs";
|
|
15
15
|
var localizedMessages = {
|
|
16
16
|
de,
|
|
17
17
|
en,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Box } from '@semcore/base-components';
|
|
2
|
+
import type { Intergalactic } from '@semcore/core';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export type RenderRowProps<T, D = never> = {
|
|
5
|
+
index: number;
|
|
6
|
+
row: T;
|
|
7
|
+
data: [D] extends [never] ? undefined : D;
|
|
8
|
+
};
|
|
9
|
+
type VirtualListProps<T, D extends object = never> = {
|
|
10
|
+
/** List of all rows in ddMenu */
|
|
11
|
+
rows: T[];
|
|
12
|
+
/** Method for render row, it's better to wrap it via React.memo */
|
|
13
|
+
renderRow: (props: RenderRowProps<T, D>) => React.ReactNode;
|
|
14
|
+
/** The height of row. For now, you should calculate it on your side. */
|
|
15
|
+
rowHeight: number;
|
|
16
|
+
/** The buffer of rows out of visible rows
|
|
17
|
+
* @default 10
|
|
18
|
+
*/
|
|
19
|
+
rowsBuffer?: number;
|
|
20
|
+
} & ([D] extends [never] ? {
|
|
21
|
+
customData?: undefined;
|
|
22
|
+
} : {
|
|
23
|
+
/** Some custom data for each renderRow function */
|
|
24
|
+
customData: D;
|
|
25
|
+
});
|
|
26
|
+
export type VirtualListComponent = (<T = string, D extends object = never>(props: Intergalactic.InternalTypings.EfficientOmit<Intergalactic.InternalTypings.ComponentProps<typeof Box, 'div', VirtualListProps<T, D>>, 'tag' | 'children'>) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<typeof Box, 'div', VirtualListProps<any, any>>;
|
|
27
|
+
export declare const VirtualList: VirtualListComponent;
|
|
28
|
+
export {};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { Box, BoxProps, FlexProps, Flex, eventInteraction, ScrollAreaProps } from '@semcore/base-components';
|
|
2
|
+
import type { PropGetterFn, Intergalactic } from '@semcore/core';
|
|
3
|
+
import type {
|
|
3
4
|
DropdownContext,
|
|
4
5
|
DropdownProps,
|
|
5
6
|
DropdownHandlers,
|
|
6
7
|
DropdownTriggerProps,
|
|
7
8
|
DropdownPopperAriaProps,
|
|
8
9
|
} from '@semcore/dropdown';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import {
|
|
10
|
+
import type Dropdown from '@semcore/dropdown';
|
|
11
|
+
import type { Text } from '@semcore/typography';
|
|
12
|
+
|
|
13
|
+
import type { VirtualList, RenderRowProps } from './components/VirtualList';
|
|
13
14
|
|
|
14
15
|
export type DropdownMenuSize = 'm' | 'l';
|
|
15
16
|
|
|
16
|
-
/** @deprecated */
|
|
17
|
-
export interface IDropdownMenuProps extends DropdownMenuProps, UnknownProperties {}
|
|
18
17
|
export type DropdownMenuProps = DropdownProps & {
|
|
19
18
|
/**
|
|
20
19
|
* Set role `menuitemradio` (or `menuitemcheckbox` if `multiselect`) for Dropdown.Item
|
|
@@ -42,6 +41,7 @@ export type DropdownMenuProps = DropdownProps & {
|
|
|
42
41
|
* highlightedIndex - Index of the selected item
|
|
43
42
|
*/
|
|
44
43
|
onHighlightedIndexChange?: (highlightedIndex: number | null) => void;
|
|
44
|
+
/** Specifies the locale for i18n support */
|
|
45
45
|
locale?: string;
|
|
46
46
|
/**
|
|
47
47
|
* Flag for menu that using as actions on DropdownMenu.Item
|
|
@@ -54,8 +54,6 @@ export type DropdownMenuProps = DropdownProps & {
|
|
|
54
54
|
itemsCount?: number;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
/** @deprecated */
|
|
58
|
-
export interface IDropdownMenuListProps extends DropdownMenuListProps, UnknownProperties {}
|
|
59
57
|
export type DropdownMenuListProps = BoxProps &
|
|
60
58
|
ScrollAreaProps & {
|
|
61
59
|
/**
|
|
@@ -65,12 +63,8 @@ export type DropdownMenuListProps = BoxProps &
|
|
|
65
63
|
size?: DropdownMenuSize;
|
|
66
64
|
};
|
|
67
65
|
|
|
68
|
-
/** @deprecated */
|
|
69
|
-
export interface IDropdownMenuMenuProps extends DropdownMenuMenuProps, UnknownProperties {}
|
|
70
66
|
export type DropdownMenuMenuProps = DropdownMenuListProps & {};
|
|
71
67
|
|
|
72
|
-
/** @deprecated */
|
|
73
|
-
export interface IDropdownMenuItemProps extends DropdownMenuItemProps, UnknownProperties {}
|
|
74
68
|
export type DropdownMenuItemProps = FlexProps & {
|
|
75
69
|
/**
|
|
76
70
|
* Enables selected state. For selectable dropdowns only.
|
|
@@ -80,15 +74,6 @@ export type DropdownMenuItemProps = FlexProps & {
|
|
|
80
74
|
* Disables item
|
|
81
75
|
*/
|
|
82
76
|
disabled?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Adds focus styles around
|
|
85
|
-
*/
|
|
86
|
-
highlighted?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Disables hover state
|
|
89
|
-
* @deprecated use `disabled` instead
|
|
90
|
-
*/
|
|
91
|
-
notInteractive?: boolean;
|
|
92
77
|
/**
|
|
93
78
|
* Size of the component
|
|
94
79
|
* @default m
|
|
@@ -100,40 +85,29 @@ export type DropdownMenuItemProps = FlexProps & {
|
|
|
100
85
|
index?: number;
|
|
101
86
|
};
|
|
102
87
|
|
|
103
|
-
/** @deprecated */
|
|
104
|
-
export interface IDropdownMenuItemHintProps extends DropdownMenuItemHintProps, UnknownProperties {}
|
|
105
|
-
export type DropdownMenuItemHintProps = FlexProps & {
|
|
106
|
-
/**
|
|
107
|
-
* Size of the component
|
|
108
|
-
* @default m
|
|
109
|
-
*/
|
|
110
|
-
size?: DropdownMenuSize;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
/** @deprecated */
|
|
114
|
-
export interface IDropdownMenuItemTitleProps
|
|
115
|
-
extends DropdownMenuItemTitleProps,
|
|
116
|
-
UnknownProperties {}
|
|
117
|
-
export type DropdownMenuItemTitleProps = FlexProps & {
|
|
118
|
-
/**
|
|
119
|
-
* Size of the component
|
|
120
|
-
* @default m
|
|
121
|
-
*/
|
|
122
|
-
size?: DropdownMenuSize;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
/** @deprecated */
|
|
126
|
-
export interface IDropdownMenuContext extends DropdownMenuContext, UnknownProperties {}
|
|
127
88
|
export type DropdownMenuContext = DropdownContext & {
|
|
89
|
+
/**
|
|
90
|
+
* Tracks which menu item is currently highlighted/focused for keyboard navigation
|
|
91
|
+
**/
|
|
128
92
|
highlightedIndex?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Returns props for the menu list container
|
|
95
|
+
**/
|
|
129
96
|
getListProps: PropGetterFn;
|
|
97
|
+
/**
|
|
98
|
+
* Returns props for individual menu items
|
|
99
|
+
**/
|
|
130
100
|
getItemProps: PropGetterFn;
|
|
101
|
+
/**
|
|
102
|
+
* Returns props for item hint/description elements
|
|
103
|
+
**/
|
|
131
104
|
getItemHintProps: PropGetterFn;
|
|
105
|
+
/**
|
|
106
|
+
* Returns props for item title elements
|
|
107
|
+
**/
|
|
132
108
|
getItemTitleProps: PropGetterFn;
|
|
133
109
|
};
|
|
134
110
|
|
|
135
|
-
/** @deprecated */
|
|
136
|
-
export interface IDropdownMenuHandlers extends DropdownMenuHandlers, UnknownProperties {}
|
|
137
111
|
export type DropdownMenuHandlers = DropdownHandlers & {
|
|
138
112
|
highlightedIndex: (index: number) => void;
|
|
139
113
|
};
|
|
@@ -177,40 +151,17 @@ declare const DropdownMenu: Intergalactic.Component<
|
|
|
177
151
|
Text: typeof Text;
|
|
178
152
|
Hint: typeof Flex;
|
|
179
153
|
};
|
|
180
|
-
|
|
181
|
-
* @deprecated Use Group with title prop
|
|
182
|
-
*/
|
|
183
|
-
ItemTitle: Intergalactic.Component<'div', DropdownMenuItemTitleProps>;
|
|
184
|
-
/**
|
|
185
|
-
* @deprecated Use prop subTitle on Group or Item component
|
|
186
|
-
*/
|
|
187
|
-
ItemHint: Intergalactic.Component<'div', DropdownMenuItemHintProps>;
|
|
154
|
+
|
|
188
155
|
Group: typeof Dropdown.Group;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
*/
|
|
192
|
-
Nesting: Intergalactic.Component<
|
|
193
|
-
'div',
|
|
194
|
-
DropdownMenuItemProps,
|
|
195
|
-
DropdownMenuContext,
|
|
196
|
-
[handlers: DropdownMenuHandlers]
|
|
197
|
-
> & {
|
|
198
|
-
/**
|
|
199
|
-
* @deprecated Use Item instead of Nesting
|
|
200
|
-
*/
|
|
201
|
-
Trigger: Intergalactic.Component<'div', DropdownMenuItemProps>;
|
|
202
|
-
/**
|
|
203
|
-
* @deprecated Use Item instead of Nesting
|
|
204
|
-
*/
|
|
205
|
-
Item: Intergalactic.Component<'div', DropdownMenuItemProps>;
|
|
206
|
-
/**
|
|
207
|
-
* @deprecated Use Item instead of Nesting
|
|
208
|
-
*/
|
|
209
|
-
Addon: typeof Box;
|
|
210
|
-
};
|
|
156
|
+
|
|
157
|
+
VirtualList: typeof VirtualList;
|
|
211
158
|
|
|
212
159
|
selectedIndexContext: React.Context<number>;
|
|
213
160
|
nestedMenuInteraction: eventInteraction;
|
|
214
161
|
};
|
|
215
162
|
|
|
216
163
|
export default DropdownMenu;
|
|
164
|
+
|
|
165
|
+
export {
|
|
166
|
+
RenderRowProps,
|
|
167
|
+
};
|