@semcore/dropdown-menu 16.3.0-prerelease.1 → 16.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/lib/cjs/DropdownMenu.js +87 -132
- package/lib/cjs/DropdownMenu.js.map +1 -1
- package/lib/cjs/components/Context.js +2 -2
- package/lib/cjs/components/Context.js.map +1 -1
- package/lib/cjs/components/VirtualList.js +20 -20
- package/lib/cjs/components/VirtualList.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/style/dropdown-menu.shadow.css +18 -12
- package/lib/es6/DropdownMenu.js +74 -123
- package/lib/es6/DropdownMenu.js.map +1 -1
- package/lib/es6/components/Context.js +1 -1
- package/lib/es6/components/Context.js.map +1 -1
- package/lib/es6/components/VirtualList.js +18 -18
- package/lib/es6/components/VirtualList.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/style/dropdown-menu.shadow.css +18 -12
- package/lib/esm/DropdownMenu.mjs +68 -98
- package/lib/esm/components/Context.mjs +1 -1
- package/lib/esm/components/VirtualList.mjs +23 -23
- package/lib/esm/style/dropdown-menu.shadow.css +18 -12
- package/lib/types/index.d.ts +3 -79
- package/package.json +13 -13
|
@@ -13,28 +13,28 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _core = require("@semcore/core");
|
|
15
15
|
var _baseComponents = require("@semcore/base-components");
|
|
16
|
-
var _scrollArea = _interopRequireDefault(require("@semcore/scroll-area"));
|
|
17
16
|
var _react = _interopRequireDefault(require("react"));
|
|
18
17
|
var _Context = require("./Context");
|
|
19
18
|
/*!__reshadow-styles__:"../style/dropdown-menu.shadow.css"*/
|
|
20
|
-
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
19
|
+
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___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, rgba(0, 32, 221, 0.469));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}@supports (color:color(display-p3 0 0 0%)){.___SDropdownMenuNesting_1d74h_gg_.__highlighted_1d74h_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469))}@media (color-gamut:p3){.___SDropdownMenuNesting_1d74h_gg_.__highlighted_1d74h_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___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}", /*__inner_css_end__*/"1d74h_gg_"),
|
|
21
20
|
/*__reshadow_css_end__*/
|
|
22
21
|
{
|
|
23
|
-
"__SDropdownMenuItemContainer": "
|
|
24
|
-
"_nesting-trigger": "__nesting-
|
|
25
|
-
"__SDropdownMenuNesting": "
|
|
26
|
-
"_size_l": "
|
|
27
|
-
"_size_m": "
|
|
28
|
-
"_highlighted": "
|
|
29
|
-
"__SDropdownNestingItem": "
|
|
30
|
-
"__SItemHint": "
|
|
31
|
-
"__SDropdownMenuList": "
|
|
32
|
-
"__SBar": "
|
|
33
|
-
"__SShadowHorizontal": "
|
|
34
|
-
"__SShadowVertical": "
|
|
35
|
-
"__SItemContent": "
|
|
36
|
-
"__SDropdownMenuItemAddon": "
|
|
37
|
-
"__SItemContentText": "
|
|
22
|
+
"__SDropdownMenuItemContainer": "___SDropdownMenuItemContainer_1d74h_gg_",
|
|
23
|
+
"_nesting-trigger": "__nesting-trigger_1d74h_gg_",
|
|
24
|
+
"__SDropdownMenuNesting": "___SDropdownMenuNesting_1d74h_gg_",
|
|
25
|
+
"_size_l": "_size_l_1d74h_gg_",
|
|
26
|
+
"_size_m": "_size_m_1d74h_gg_",
|
|
27
|
+
"_highlighted": "__highlighted_1d74h_gg_",
|
|
28
|
+
"__SDropdownNestingItem": "___SDropdownNestingItem_1d74h_gg_",
|
|
29
|
+
"__SItemHint": "___SItemHint_1d74h_gg_",
|
|
30
|
+
"__SDropdownMenuList": "___SDropdownMenuList_1d74h_gg_",
|
|
31
|
+
"__SBar": "___SBar_1d74h_gg_",
|
|
32
|
+
"__SShadowHorizontal": "___SShadowHorizontal_1d74h_gg_",
|
|
33
|
+
"__SShadowVertical": "___SShadowVertical_1d74h_gg_",
|
|
34
|
+
"__SItemContent": "___SItemContent_1d74h_gg_",
|
|
35
|
+
"__SDropdownMenuItemAddon": "___SDropdownMenuItemAddon_1d74h_gg_",
|
|
36
|
+
"__SItemContentText": "___SItemContentText_1d74h_gg_",
|
|
37
|
+
"__SScrollContainer": "___SScrollContainer_1d74h_gg_"
|
|
38
38
|
});
|
|
39
39
|
var VirtualListRoot = /*#__PURE__*/function (_Component) {
|
|
40
40
|
function VirtualListRoot() {
|
|
@@ -88,8 +88,8 @@ var VirtualListRoot = /*#__PURE__*/function (_Component) {
|
|
|
88
88
|
_ref2,
|
|
89
89
|
_this$listRef$current,
|
|
90
90
|
_this$listRef$current2;
|
|
91
|
-
var SDropdownMenuList =
|
|
92
|
-
var SBar =
|
|
91
|
+
var SDropdownMenuList = _baseComponents.ScrollArea;
|
|
92
|
+
var SBar = _baseComponents.ScrollArea.Bar;
|
|
93
93
|
var _this$state = this.state,
|
|
94
94
|
scrollDirection = _this$state.scrollDirection,
|
|
95
95
|
scrollTop = _this$state.scrollTop;
|
|
@@ -115,7 +115,7 @@ var VirtualListRoot = /*#__PURE__*/function (_Component) {
|
|
|
115
115
|
"onScroll": this.handleScroll,
|
|
116
116
|
"data-is-virtual": 'true',
|
|
117
117
|
"ref": this.listRef
|
|
118
|
-
}, _ref))), /*#__PURE__*/_react["default"].createElement(
|
|
118
|
+
}, _ref))), /*#__PURE__*/_react["default"].createElement(_baseComponents.ScrollArea.Container, {
|
|
119
119
|
ref: this.containerRef,
|
|
120
120
|
tabIndex: undefined,
|
|
121
121
|
h: rows.length * rowHeight
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualList.js","names":["_core","require","_baseComponents","_scrollArea","_interopRequireDefault","_react","_Context","style","sstyled","insert","VirtualListRoot","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","React","createRef","scrollTop","scrollDirection","e","target","HTMLElement","state","setState","_inherits2","_createClass2","key","value","componentDidMount","_this2","_this$asProps","asProps","index","rowHeight","rowsBuffer","setTimeout","_this2$listRef$curren","_this2$listRef$curren2","_this2$containerRef$c","listHeight","listRef","current","getBoundingClientRect","height","containerRef","scrollTo","top","forceUpdate","render","_ref","_ref2","_this$listRef$current","_this$listRef$current2","SDropdownMenuList","ScrollAreaComponent","SBar","Bar","_this$state","_this$asProps2","rows","styles","RenderRow","renderRow","customData","offsetHeight","prevPrepared","nextPrepared","startIndex","Math","max","floor","lastIndex","min","ceil","rowsToRender","slice","rowMarginTop","rowMarginBottom","createElement","ListBoxContextProvider","cn","_objectSpread2","assignProps","handleScroll","Container","ref","tabIndex","undefined","h","Box","map","item","row","data","Component","VirtualList","exports","createComponent"],"sources":["../../../src/components/VirtualList.tsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { Root, Component, createComponent, sstyled } from '@semcore/core';\nimport ScrollAreaComponent from '@semcore/scroll-area';\nimport React from 'react';\n\nimport { ListBoxContextProvider } from './Context';\nimport style from '../style/dropdown-menu.shadow.css';\n\nexport type RenderRowProps<T, D = never> = {\n index: number;\n row: T;\n data: [D] extends [never] ? undefined : D;\n};\n\ntype VirtualListProps<T, D extends object = never> = {\n /** List of all rows in ddMenu */\n rows: T[];\n /** Method for render row, it's better to wrap it via React.memo */\n renderRow: (props: RenderRowProps<T, D>) => React.ReactNode;\n /** The height of row. For now, you should calculate it on your side. */\n rowHeight: number;\n /** The buffer of rows out of visible rows\n * @default 10\n */\n rowsBuffer?: number;\n} & ([D] extends [never] ? { customData?: undefined } : {\n /** Some custom data for each renderRow function */\n customData: D;\n});\n\ntype State = {\n scrollTop: number;\n scrollDirection: 'up' | 'down';\n};\n\nclass VirtualListRoot<T = string, D extends object = never> extends Component<VirtualListProps<T, D>, {}, State, [], { rowsBuffer: number; index: number }> {\n static displayName = 'VirtualList';\n static style = style;\n\n static defaultProps = {\n rowsBuffer: 6,\n };\n\n containerRef = React.createRef<HTMLDivElement>();\n listRef = React.createRef<HTMLDivElement>();\n\n state: State = {\n scrollTop: 0,\n scrollDirection: 'down',\n };\n\n componentDidMount() {\n const { index, rowHeight, rowsBuffer } = this.asProps;\n\n setTimeout(() => {\n const listHeight = (this.listRef.current?.getBoundingClientRect().height ?? 0) / 2;\n this.containerRef.current?.scrollTo({ top: index * rowHeight - listHeight + rowHeight / 2 });\n\n if (index <= rowsBuffer) {\n this.forceUpdate(); // we need this for correct render all items with calculated container height\n }\n }, 10); // 10 for correct work in safari\n }\n\n handleScroll = (e: React.SyntheticEvent<HTMLDivElement>) => {\n if (e.target instanceof HTMLElement) {\n const scrollDirection = e.target.scrollTop > this.state.scrollTop ? 'down' : 'up';\n\n this.setState({\n scrollDirection,\n scrollTop: e.target.scrollTop,\n });\n }\n };\n\n render() {\n const SDropdownMenuList = Root;\n const SBar = ScrollAreaComponent.Bar;\n\n const { scrollDirection, scrollTop } = this.state;\n const { rows, rowHeight, rowsBuffer, styles, renderRow: RenderRow, customData } = this.asProps;\n\n const offsetHeight = this.listRef.current?.offsetHeight ?? 0;\n const prevPrepared = scrollDirection === 'down' ? rowsBuffer / 2 : rowsBuffer;\n const nextPrepared = scrollDirection === 'up' ? rowsBuffer / 2 : rowsBuffer;\n\n const startIndex = Math.max(Math.floor(scrollTop / rowHeight) - prevPrepared, 0);\n\n const lastIndex = Math.min(\n Math.ceil((scrollTop + offsetHeight) / rowHeight) + nextPrepared,\n rows.length,\n );\n\n const rowsToRender = rows.slice(startIndex, lastIndex);\n const rowMarginTop = rowHeight * startIndex;\n const rowMarginBottom = rowHeight * (rows.length - lastIndex);\n\n return sstyled(styles)(\n <ListBoxContextProvider>\n <SDropdownMenuList\n render={ScrollAreaComponent}\n shadow={true}\n shadowSize={16}\n shadowTheme='light'\n onScroll={this.handleScroll}\n data-is-virtual='true'\n ref={this.listRef}\n >\n <ScrollAreaComponent.Container ref={this.containerRef} tabIndex={undefined} h={rows.length * rowHeight}>\n <Box h={rowMarginTop} />\n {rowsToRender.map((item, index) => {\n // @ts-ignore\n return <RenderRow key={startIndex + index} row={item} index={startIndex + index} data={customData} />;\n })}\n <Box h={rowMarginBottom} />\n </ScrollAreaComponent.Container>\n <SBar orientation='horizontal' />\n <SBar orientation='vertical' />\n </SDropdownMenuList>\n </ListBoxContextProvider>,\n );\n }\n}\n\nexport type VirtualListComponent = (<\n T = string,\n D extends object = never,\n>(\n props: Intergalactic.InternalTypings.EfficientOmit<Intergalactic.InternalTypings.ComponentProps<typeof Box, 'div', VirtualListProps<T, D>>, 'tag' | 'children'>\n) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<typeof Box, 'div', VirtualListProps<any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;MACvG,CAAC,CAAC,eACFlE,MAAA,YAAAiF,aAAA,CAACpF,eAAA,CAAA+F,GAAG,EAAAvC,KAAA,CAAA8B,EAAA;QAAA,KAAIH;MAAe,EAAG,CACG,CAAC,eAChChF,MAAA,YAAAiF,aAAA,CAACvB,IAAI,EAAAL,KAAA,CAAA8B,EAAA;QAAA,eAAa;MAAY,EAAE,CAAC,eACjCnF,MAAA,YAAAiF,aAAA,CAACvB,IAAI,EAAAL,KAAA,CAAA8B,EAAA;QAAA,eAAa;MAAU,EAAE,CACb,CACG,CAAC;IAE7B;EAAC;AAAA,EAtFiEc,eAAS;AAAA,IAAAhF,gBAAA,aAAvEZ,eAAe,iBACE,aAAa;AAAA,IAAAY,gBAAA,aAD9BZ,eAAe,WAEJH,KAAK;AAAA,IAAAe,gBAAA,aAFhBZ,eAAe,kBAIG;EACpBgC,UAAU,EAAE;AACd,CAAC;AA0FI,IAAM6D,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,IAAAE,qBAAe,EAAC/F,eAAe,CAAyB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"VirtualList.js","names":["_core","require","_baseComponents","_react","_interopRequireDefault","_Context","style","sstyled","insert","VirtualListRoot","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","React","createRef","scrollTop","scrollDirection","e","target","HTMLElement","state","setState","_inherits2","_createClass2","key","value","componentDidMount","_this2","_this$asProps","asProps","index","rowHeight","rowsBuffer","setTimeout","_this2$listRef$curren","_this2$listRef$curren2","_this2$containerRef$c","listHeight","listRef","current","getBoundingClientRect","height","containerRef","scrollTo","top","forceUpdate","render","_ref","_ref2","_this$listRef$current","_this$listRef$current2","SDropdownMenuList","ScrollAreaComponent","SBar","Bar","_this$state","_this$asProps2","rows","styles","RenderRow","renderRow","customData","offsetHeight","prevPrepared","nextPrepared","startIndex","Math","max","floor","lastIndex","min","ceil","rowsToRender","slice","rowMarginTop","rowMarginBottom","createElement","ListBoxContextProvider","cn","_objectSpread2","assignProps","handleScroll","ScrollArea","Container","ref","tabIndex","undefined","h","Box","map","item","row","data","Component","VirtualList","exports","createComponent"],"sources":["../../../src/components/VirtualList.tsx"],"sourcesContent":["import { ScrollArea as ScrollAreaComponent, Box } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { Root, Component, createComponent, sstyled } from '@semcore/core';\nimport React from 'react';\n\nimport { ListBoxContextProvider } from './Context';\nimport style from '../style/dropdown-menu.shadow.css';\n\nexport type RenderRowProps<T, D = never> = {\n index: number;\n row: T;\n data: [D] extends [never] ? undefined : D;\n};\n\ntype VirtualListProps<T, D extends object = never> = {\n /** List of all rows in ddMenu */\n rows: T[];\n /** Method for render row, it's better to wrap it via React.memo */\n renderRow: (props: RenderRowProps<T, D>) => React.ReactNode;\n /** The height of row. For now, you should calculate it on your side. */\n rowHeight: number;\n /** The buffer of rows out of visible rows\n * @default 10\n */\n rowsBuffer?: number;\n} & ([D] extends [never] ? { customData?: undefined } : {\n /** Some custom data for each renderRow function */\n customData: D;\n});\n\ntype State = {\n scrollTop: number;\n scrollDirection: 'up' | 'down';\n};\n\nclass VirtualListRoot<T = string, D extends object = never> extends Component<VirtualListProps<T, D>, [], Readonly<{}>, { rowsBuffer: number; index: number }, State> {\n static displayName = 'VirtualList';\n static style = style;\n\n static defaultProps = {\n rowsBuffer: 6,\n };\n\n containerRef = React.createRef<HTMLDivElement>();\n listRef = React.createRef<HTMLDivElement>();\n\n state: State = {\n scrollTop: 0,\n scrollDirection: 'down',\n };\n\n componentDidMount() {\n const { index, rowHeight, rowsBuffer } = this.asProps;\n\n setTimeout(() => {\n const listHeight = (this.listRef.current?.getBoundingClientRect().height ?? 0) / 2;\n this.containerRef.current?.scrollTo({ top: index * rowHeight - listHeight + rowHeight / 2 });\n\n if (index <= rowsBuffer) {\n this.forceUpdate(); // we need this for correct render all items with calculated container height\n }\n }, 10); // 10 for correct work in safari\n }\n\n handleScroll = (e: React.SyntheticEvent<HTMLDivElement>) => {\n if (e.target instanceof HTMLElement) {\n const scrollDirection = e.target.scrollTop > this.state.scrollTop ? 'down' : 'up';\n\n this.setState({\n scrollDirection,\n scrollTop: e.target.scrollTop,\n });\n }\n };\n\n render() {\n const SDropdownMenuList = Root;\n const SBar = ScrollAreaComponent.Bar;\n\n const { scrollDirection, scrollTop } = this.state;\n const { rows, rowHeight, rowsBuffer, styles, renderRow: RenderRow, customData } = this.asProps;\n\n const offsetHeight = this.listRef.current?.offsetHeight ?? 0;\n const prevPrepared = scrollDirection === 'down' ? rowsBuffer / 2 : rowsBuffer;\n const nextPrepared = scrollDirection === 'up' ? rowsBuffer / 2 : rowsBuffer;\n\n const startIndex = Math.max(Math.floor(scrollTop / rowHeight) - prevPrepared, 0);\n\n const lastIndex = Math.min(\n Math.ceil((scrollTop + offsetHeight) / rowHeight) + nextPrepared,\n rows.length,\n );\n\n const rowsToRender = rows.slice(startIndex, lastIndex);\n const rowMarginTop = rowHeight * startIndex;\n const rowMarginBottom = rowHeight * (rows.length - lastIndex);\n\n return sstyled(styles)(\n <ListBoxContextProvider>\n <SDropdownMenuList\n render={ScrollAreaComponent}\n shadow={true}\n shadowSize={16}\n shadowTheme='light'\n onScroll={this.handleScroll}\n data-is-virtual='true'\n ref={this.listRef}\n >\n <ScrollAreaComponent.Container ref={this.containerRef} tabIndex={undefined} h={rows.length * rowHeight}>\n <Box h={rowMarginTop} />\n {rowsToRender.map((item, index) => {\n // @ts-ignore\n return <RenderRow key={startIndex + index} row={item} index={startIndex + index} data={customData} />;\n })}\n <Box h={rowMarginBottom} />\n </ScrollAreaComponent.Container>\n <SBar orientation='horizontal' />\n <SBar orientation='vertical' />\n </SDropdownMenuList>\n </ListBoxContextProvider>,\n );\n }\n}\n\nexport type VirtualListComponent = (<\n T = string,\n D extends object = never,\n>(\n props: Intergalactic.InternalTypings.EfficientOmit<Intergalactic.InternalTypings.ComponentProps<typeof Box, 'div', VirtualListProps<T, D>>, 'tag' | 'children'>\n) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<typeof Box, 'div', VirtualListProps<any, any>>;\n\nexport const VirtualList = createComponent(VirtualListRoot) as VirtualListComponent;\n"],"mappings":";;;;;;;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AAAmD;AAAA,IAAAK,KAAA,8BAAAN,KAAA,CAAAO,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IA8B7CC,eAAe,0BAAAC,UAAA;EAAA,SAAAD,gBAAA;IAAA,IAAAE,KAAA;IAAA,IAAAC,gBAAA,mBAAAH,eAAA;IAAA,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,OAAAQ,WAAA,mBAAAV,eAAA,KAAAW,MAAA,CAAAJ,IAAA;IAAA,IAAAK,gBAAA,aAAAV,KAAA,+BAQJW,iBAAK,CAACC,SAAS,CAAiB,CAAC;IAAA,IAAAF,gBAAA,aAAAV,KAAA,0BACtCW,iBAAK,CAACC,SAAS,CAAiB,CAAC;IAAA,IAAAF,gBAAA,aAAAV,KAAA,WAE5B;MACba,SAAS,EAAE,CAAC;MACZC,eAAe,EAAE;IACnB,CAAC;IAAA,IAAAJ,gBAAA,aAAAV,KAAA,kBAec,UAACe,CAAuC,EAAK;MAC1D,IAAIA,CAAC,CAACC,MAAM,YAAYC,WAAW,EAAE;QACnC,IAAMH,eA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KAAM;UAAC8D,IAAI,EAAE/B;QAAW,CAAE,CAAC;MACvG,CAAC,CAAC,eACFnE,MAAA,YAAAkF,aAAA,CAACnF,eAAA,CAAA+F,GAAG,EAAAxC,KAAA,CAAA8B,EAAA;QAAA,KAAIH;MAAe,EAAG,CACG,CAAC,eAChCjF,MAAA,YAAAkF,aAAA,CAACvB,IAAI,EAAAL,KAAA,CAAA8B,EAAA;QAAA,eAAa;MAAY,EAAE,CAAC,eACjCpF,MAAA,YAAAkF,aAAA,CAACvB,IAAI,EAAAL,KAAA,CAAA8B,EAAA;QAAA,eAAa;MAAU,EAAE,CACb,CACG,CAAC;IAE7B;EAAC;AAAA,EAtFiEe,eAAS;AAAA,IAAAjF,gBAAA,aAAvEZ,eAAe,iBACE,aAAa;AAAA,IAAAY,gBAAA,aAD9BZ,eAAe,WAEJH,KAAK;AAAA,IAAAe,gBAAA,aAFhBZ,eAAe,kBAIG;EACpBgC,UAAU,EAAE;AACd,CAAC;AA0FI,IAAM8D,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,IAAAE,qBAAe,EAAChG,eAAe,CAAyB","ignoreList":[]}
|
package/lib/cjs/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { Box, BoxProps, FlexProps, Flex, eventInteraction, ScrollAreaProps } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type {\n DropdownContext,\n DropdownProps,\n DropdownHandlers,\n DropdownTriggerProps,\n DropdownPopperAriaProps,\n} from '@semcore/dropdown';\nimport type Dropdown from '@semcore/dropdown';\nimport type { Text } from '@semcore/typography';\n\nimport type { VirtualList, RenderRowProps } from './components/VirtualList';\n\nexport type DropdownMenuSize = 'm' | 'l';\n\nexport type DropdownMenuProps = DropdownProps & {\n /**\n * Set role `menuitemradio` (or `menuitemcheckbox` if `multiselect`) for Dropdown.Item\n */\n selectable?: boolean;\n /**\n * Multiple select\n */\n multiselect?: boolean;\n /**\n * Size of the menu\n * @default m\n */\n size?: DropdownMenuSize;\n /**\n * Index of the element selected by default\n */\n defaultHighlightedIndex?: number | null;\n /**\n * Index of the selected item\n */\n highlightedIndex?: number | null;\n /**\n * Callback for highlightedIndex change\n * highlightedIndex - Index of the selected item\n */\n onHighlightedIndexChange?: (highlightedIndex: number | null) => void;\n /** Specifies the locale for i18n support */\n locale?: string;\n /**\n * Flag for menu that using as actions on DropdownMenu.Item\n */\n inlineActions?: boolean;\n\n /**\n * Count of menu items (for virtual lists only)\n */\n itemsCount?: number;\n};\n\nexport type DropdownMenuListProps = BoxProps &\n ScrollAreaProps & {\n /**\n * Size of the menu\n * @default m\n */\n size?: DropdownMenuSize;\n };\n\nexport type DropdownMenuMenuProps = DropdownMenuListProps & {};\n\nexport type DropdownMenuItemProps = FlexProps & {\n /**\n * Enables selected state. For selectable dropdowns only.\n */\n selected?: boolean;\n /**\n * Disables item\n */\n disabled?: boolean;\n /**\n * Size of the component\n * @default m\n */\n size?: DropdownMenuSize;\n /**\n * Index of item (used in virtualized lists)\n */\n index?: number;\n};\n\nexport type DropdownMenuContext = DropdownContext & {\n /**\n * Tracks which menu item is currently highlighted/focused for keyboard navigation\n **/\n highlightedIndex?: number;\n /**\n * Returns props for the menu list container\n **/\n getListProps: PropGetterFn;\n /**\n * Returns props for individual menu items\n **/\n getItemProps: PropGetterFn;\n /**\n * Returns props for item hint/description elements\n **/\n getItemHintProps: PropGetterFn;\n /**\n * Returns props for item title elements\n **/\n getItemTitleProps: PropGetterFn;\n};\n\nexport type DropdownMenuHandlers = DropdownHandlers & {\n highlightedIndex: (index: number) => void;\n};\n\nexport type DropdownMenuTriggerProps = DropdownTriggerProps;\n\ndeclare const DropdownMenu: Intergalactic.Component<\n 'div',\n DropdownMenuProps,\n DropdownMenuContext,\n [handlers: DropdownMenuHandlers]\n> & {\n Trigger: typeof Dropdown.Trigger;\n Popper: Intergalactic.Component<'div', DropdownMenuProps & DropdownPopperAriaProps>;\n List: Intergalactic.Component<\n 'div',\n DropdownMenuListProps,\n DropdownMenuContext,\n [handlers: DropdownMenuHandlers]\n >;\n Actions: Intergalactic.Component<\n typeof Flex,\n DropdownMenuListProps,\n DropdownMenuContext,\n [handlers: DropdownMenuHandlers]\n >;\n Menu: Intergalactic.Component<\n 'div',\n DropdownMenuMenuProps,\n DropdownMenuContext,\n [handlers: DropdownMenuHandlers]\n >;\n Item: Intergalactic.Component<\n typeof Dropdown.Item,\n DropdownMenuItemProps,\n DropdownMenuContext,\n [handlers: DropdownMenuHandlers]\n > & {\n Addon: typeof Box;\n Content: typeof Flex;\n Text: typeof Text;\n Hint: typeof Flex;\n };\n\n Group: typeof Dropdown.Group;\n\n VirtualList: typeof VirtualList;\n\n selectedIndexContext: React.Context<number>;\n nestedMenuInteraction: eventInteraction;\n};\n\nexport default DropdownMenu;\n\nexport {\n RenderRowProps,\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -12,19 +12,19 @@ SDropdownMenuList {
|
|
|
12
12
|
z-index: 3;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
}
|
|
20
21
|
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
SShadowVertical {
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
SShadowVertical {
|
|
24
|
+
&:before,
|
|
25
|
+
&:after {
|
|
26
|
+
border-radius: var(--intergalactic-control-rounded, 6px);
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -41,7 +41,7 @@ SDropdownMenuItemContainer[nesting-trigger] {
|
|
|
41
41
|
|
|
42
42
|
SDropdownMenuItemAddon,
|
|
43
43
|
SItemContentText {
|
|
44
|
-
display: inline-flex;
|
|
44
|
+
display: inline-flex; /* todo: Brauer Ilia - why? should be changed to inline/inline-block for SItemContentText */
|
|
45
45
|
margin-left: var(--intergalactic-spacing-1x, 4px);
|
|
46
46
|
margin-right: var(--intergalactic-spacing-1x, 4px);
|
|
47
47
|
|
|
@@ -81,3 +81,9 @@ SDropdownNestingItem SDropdownMenuItemContainer {
|
|
|
81
81
|
SItemHint {
|
|
82
82
|
color: var(--intergalactic-text-secondary, oklch(0.088 0.026 147.7 / 0.583));
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
SScrollContainer {
|
|
86
|
+
&:has([data-ui-name="DropdownMenu.Group"][data-sticky="true"]) {
|
|
87
|
+
overscroll-behavior: none;
|
|
88
|
+
}
|
|
89
|
+
}
|
package/lib/es6/DropdownMenu.js
CHANGED
|
@@ -9,10 +9,6 @@ import _superPropGet from "@babel/runtime/helpers/superPropGet";
|
|
|
9
9
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
10
10
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
11
11
|
import { sstyled as _sstyled } from "@semcore/core";
|
|
12
|
-
import { assignProps as _assignProps12 } from "@semcore/core";
|
|
13
|
-
import { assignProps as _assignProps11 } from "@semcore/core";
|
|
14
|
-
import { assignProps as _assignProps10 } from "@semcore/core";
|
|
15
|
-
import { assignProps as _assignProps1 } from "@semcore/core";
|
|
16
12
|
import { assignProps as _assignProps0 } from "@semcore/core";
|
|
17
13
|
import { assignProps as _assignProps9 } from "@semcore/core";
|
|
18
14
|
import { assignProps as _assignProps8 } from "@semcore/core";
|
|
@@ -23,6 +19,7 @@ import { assignProps as _assignProps4 } from "@semcore/core";
|
|
|
23
19
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
24
20
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
25
21
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
22
|
+
import { Flex, ScrollArea as ScrollAreaComponent, Box } from '@semcore/base-components';
|
|
26
23
|
import ButtonComponent from '@semcore/button';
|
|
27
24
|
import { createComponent, sstyled, Root, lastInteraction } from '@semcore/core';
|
|
28
25
|
import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';
|
|
@@ -32,31 +29,30 @@ import { setFocus } from '@semcore/core/lib/utils/focus-lock/setFocus';
|
|
|
32
29
|
import { forkRef } from '@semcore/core/lib/utils/ref';
|
|
33
30
|
import { useUID } from '@semcore/core/lib/utils/uniqueID';
|
|
34
31
|
import Dropdown, { AbstractDropdown, selectedIndexContext, enhance } from '@semcore/dropdown';
|
|
35
|
-
import { Flex, Box } from '@semcore/flex-box';
|
|
36
|
-
import ScrollAreaComponent from '@semcore/scroll-area';
|
|
37
32
|
import { Text } from '@semcore/typography';
|
|
38
33
|
import React from 'react';
|
|
39
34
|
import { ListBoxContextProvider } from './components/Context';
|
|
40
35
|
import { VirtualList } from './components/VirtualList';
|
|
41
36
|
/*!__reshadow-styles__:"./style/dropdown-menu.shadow.css"*/
|
|
42
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
37
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___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, rgba(0, 32, 221, 0.469));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}@supports (color:color(display-p3 0 0 0%)){.___SDropdownMenuNesting_1d74h_gg_.__highlighted_1d74h_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 32, 221, 0.469))}@media (color-gamut:p3){.___SDropdownMenuNesting_1d74h_gg_.__highlighted_1d74h_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___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}", /*__inner_css_end__*/"1d74h_gg_"),
|
|
43
38
|
/*__reshadow_css_end__*/
|
|
44
39
|
{
|
|
45
|
-
"__SDropdownMenuItemContainer": "
|
|
46
|
-
"_nesting-trigger": "__nesting-
|
|
47
|
-
"__SDropdownMenuNesting": "
|
|
48
|
-
"_size_l": "
|
|
49
|
-
"_size_m": "
|
|
50
|
-
"_highlighted": "
|
|
51
|
-
"__SDropdownNestingItem": "
|
|
52
|
-
"__SItemHint": "
|
|
53
|
-
"__SDropdownMenuList": "
|
|
54
|
-
"__SBar": "
|
|
55
|
-
"__SShadowHorizontal": "
|
|
56
|
-
"__SShadowVertical": "
|
|
57
|
-
"__SItemContent": "
|
|
58
|
-
"__SDropdownMenuItemAddon": "
|
|
59
|
-
"__SItemContentText": "
|
|
40
|
+
"__SDropdownMenuItemContainer": "___SDropdownMenuItemContainer_1d74h_gg_",
|
|
41
|
+
"_nesting-trigger": "__nesting-trigger_1d74h_gg_",
|
|
42
|
+
"__SDropdownMenuNesting": "___SDropdownMenuNesting_1d74h_gg_",
|
|
43
|
+
"_size_l": "_size_l_1d74h_gg_",
|
|
44
|
+
"_size_m": "_size_m_1d74h_gg_",
|
|
45
|
+
"_highlighted": "__highlighted_1d74h_gg_",
|
|
46
|
+
"__SDropdownNestingItem": "___SDropdownNestingItem_1d74h_gg_",
|
|
47
|
+
"__SItemHint": "___SItemHint_1d74h_gg_",
|
|
48
|
+
"__SDropdownMenuList": "___SDropdownMenuList_1d74h_gg_",
|
|
49
|
+
"__SBar": "___SBar_1d74h_gg_",
|
|
50
|
+
"__SShadowHorizontal": "___SShadowHorizontal_1d74h_gg_",
|
|
51
|
+
"__SShadowVertical": "___SShadowVertical_1d74h_gg_",
|
|
52
|
+
"__SItemContent": "___SItemContent_1d74h_gg_",
|
|
53
|
+
"__SDropdownMenuItemAddon": "___SDropdownMenuItemAddon_1d74h_gg_",
|
|
54
|
+
"__SItemContentText": "___SItemContentText_1d74h_gg_",
|
|
55
|
+
"__SScrollContainer": "___SScrollContainer_1d74h_gg_"
|
|
60
56
|
});
|
|
61
57
|
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
62
58
|
var menuItemContext = /*#__PURE__*/React.createContext({});
|
|
@@ -144,6 +140,8 @@ var DropdownMenuRoot = /*#__PURE__*/function (_AbstractDropdown) {
|
|
|
144
140
|
var _this$menuElements2 = this.menuElements,
|
|
145
141
|
selected = _this$menuElements2.selected,
|
|
146
142
|
options = _this$menuElements2.options;
|
|
143
|
+
var isFocusAlreadyInPopper = isFocusInside(this.popperRef.current);
|
|
144
|
+
if (isFocusAlreadyInPopper) return;
|
|
147
145
|
if (selected && options && !((_this$menuRef$current2 = this.menuRef.current) !== null && _this$menuRef$current2 !== void 0 && _this$menuRef$current2.dataset.isVirtual)) return;
|
|
148
146
|
_superPropGet(DropdownMenuRoot, "afterOpenPopper", this, 3)([]);
|
|
149
147
|
}
|
|
@@ -348,31 +346,32 @@ _defineProperty(DropdownMenuRoot, "nestedMenuInteraction", {
|
|
|
348
346
|
trigger: [['onClick', 'onMouseEnter'], ['onClick', 'onMouseLeave']],
|
|
349
347
|
popper: [['onMouseEnter'], ['onMouseLeave']]
|
|
350
348
|
});
|
|
351
|
-
function List(
|
|
349
|
+
function List(_ref16) {
|
|
352
350
|
var _ref2 = arguments[0],
|
|
353
|
-
|
|
354
|
-
var styles =
|
|
355
|
-
Children =
|
|
351
|
+
_ref1;
|
|
352
|
+
var styles = _ref16.styles,
|
|
353
|
+
Children = _ref16.Children;
|
|
356
354
|
var SDropdownMenuList = ScrollAreaComponent;
|
|
357
355
|
var SBar = ScrollAreaComponent.Bar;
|
|
358
|
-
|
|
356
|
+
var SScrollContainer = ScrollAreaComponent.Container;
|
|
357
|
+
return _ref1 = sstyled(styles), /*#__PURE__*/React.createElement(ListBoxContextProvider, _ref1.cn("ListBoxContextProvider", {}), /*#__PURE__*/React.createElement(SDropdownMenuList, _ref1.cn("SDropdownMenuList", _objectSpread({}, _assignProps2({
|
|
359
358
|
"shadow": true,
|
|
360
359
|
"shadowSize": 16,
|
|
361
360
|
"shadowTheme": 'light'
|
|
362
|
-
}, _ref2))), /*#__PURE__*/React.createElement(
|
|
363
|
-
tabIndex: undefined
|
|
364
|
-
}, /*#__PURE__*/React.createElement(Children,
|
|
361
|
+
}, _ref2))), /*#__PURE__*/React.createElement(SScrollContainer, _ref1.cn("SScrollContainer", {
|
|
362
|
+
"tabIndex": undefined
|
|
363
|
+
}), /*#__PURE__*/React.createElement(Children, _ref1.cn("Children", {}))), /*#__PURE__*/React.createElement(SBar, _ref1.cn("SBar", {
|
|
365
364
|
"orientation": 'horizontal'
|
|
366
|
-
})), /*#__PURE__*/React.createElement(SBar,
|
|
365
|
+
})), /*#__PURE__*/React.createElement(SBar, _ref1.cn("SBar", {
|
|
367
366
|
"orientation": 'vertical'
|
|
368
367
|
}))));
|
|
369
368
|
}
|
|
370
|
-
function Actions(
|
|
369
|
+
function Actions(_ref17) {
|
|
371
370
|
var _ref3 = arguments[0],
|
|
372
|
-
|
|
373
|
-
var styles =
|
|
371
|
+
_ref10;
|
|
372
|
+
var styles = _ref17.styles;
|
|
374
373
|
var SDropdownMenuActions = Flex;
|
|
375
|
-
return
|
|
374
|
+
return _ref10 = sstyled(styles), /*#__PURE__*/React.createElement(SDropdownMenuActions, _ref10.cn("SDropdownMenuActions", _objectSpread({}, _assignProps3({}, _ref3))));
|
|
376
375
|
}
|
|
377
376
|
function Menu(props) {
|
|
378
377
|
var _ref4 = arguments[0];
|
|
@@ -396,18 +395,18 @@ function Menu(props) {
|
|
|
396
395
|
role: null
|
|
397
396
|
}), /*#__PURE__*/React.createElement(DropdownMenu.List, _assignProps4({}, _ref4))));
|
|
398
397
|
}
|
|
399
|
-
function Item(
|
|
398
|
+
function Item(_ref18) {
|
|
400
399
|
var _ref5 = arguments[0],
|
|
401
|
-
|
|
402
|
-
var id =
|
|
403
|
-
styles =
|
|
404
|
-
disabled =
|
|
405
|
-
Children =
|
|
406
|
-
forwardRef =
|
|
407
|
-
role =
|
|
408
|
-
tabIndex =
|
|
409
|
-
actionsRef =
|
|
410
|
-
ariaChecked =
|
|
400
|
+
_ref11;
|
|
401
|
+
var id = _ref18.id,
|
|
402
|
+
styles = _ref18.styles,
|
|
403
|
+
disabled = _ref18.disabled,
|
|
404
|
+
Children = _ref18.Children,
|
|
405
|
+
forwardRef = _ref18.forwardRef,
|
|
406
|
+
role = _ref18.role,
|
|
407
|
+
tabIndex = _ref18.tabIndex,
|
|
408
|
+
actionsRef = _ref18.actionsRef,
|
|
409
|
+
ariaChecked = _ref18['aria-checked'];
|
|
411
410
|
var SDropdownMenuItemContainer = Dropdown.Item;
|
|
412
411
|
var itemRef = React.useRef();
|
|
413
412
|
var _React$useState = React.useState(false),
|
|
@@ -416,7 +415,8 @@ function Item(_ref24) {
|
|
|
416
415
|
setHighlighted = _React$useState2[1];
|
|
417
416
|
var menuItemContextValue = {
|
|
418
417
|
contentId: id,
|
|
419
|
-
ref:
|
|
418
|
+
ref: itemRef,
|
|
419
|
+
forwardRef: forwardRef,
|
|
420
420
|
role: role,
|
|
421
421
|
tabIndex: tabIndex,
|
|
422
422
|
ariaChecked: ariaChecked,
|
|
@@ -466,32 +466,32 @@ function Item(_ref24) {
|
|
|
466
466
|
capture: true
|
|
467
467
|
});
|
|
468
468
|
};
|
|
469
|
-
}
|
|
470
|
-
return
|
|
469
|
+
});
|
|
470
|
+
return _ref11 = sstyled(styles), /*#__PURE__*/React.createElement(menuItemContext.Provider, {
|
|
471
471
|
value: menuItemContextValue
|
|
472
|
-
}, /*#__PURE__*/React.createElement(SDropdownMenuItemContainer,
|
|
473
|
-
"ref": advancedMode ? undefined :
|
|
472
|
+
}, /*#__PURE__*/React.createElement(SDropdownMenuItemContainer, _ref11.cn("SDropdownMenuItemContainer", _objectSpread({}, _assignProps5({
|
|
473
|
+
"ref": advancedMode ? undefined : forkRef(itemRef, forwardRef),
|
|
474
474
|
"use:highlighted": !disabled && highlighted && lastInteraction.isKeyboard(),
|
|
475
475
|
"use:role": advancedMode ? undefined : role,
|
|
476
476
|
"use:id": advancedMode ? undefined : id,
|
|
477
477
|
"use:tabIndex": advancedMode ? undefined : tabIndex,
|
|
478
478
|
"use:aria-checked": advancedMode ? undefined : ariaChecked
|
|
479
|
-
}, _ref5))), /*#__PURE__*/React.createElement(Children,
|
|
479
|
+
}, _ref5))), /*#__PURE__*/React.createElement(Children, _ref11.cn("Children", {}))));
|
|
480
480
|
}
|
|
481
481
|
function Addon(props) {
|
|
482
482
|
var _ref6 = arguments[0],
|
|
483
|
-
|
|
483
|
+
_ref12;
|
|
484
484
|
var SDropdownMenuItemAddon = Box;
|
|
485
|
-
return
|
|
485
|
+
return _ref12 = sstyled(props.styles), /*#__PURE__*/React.createElement(SDropdownMenuItemAddon, _ref12.cn("SDropdownMenuItemAddon", _objectSpread({}, _assignProps6({}, _ref6))));
|
|
486
486
|
}
|
|
487
487
|
function Trigger() {
|
|
488
488
|
var _ref7 = arguments[0];
|
|
489
489
|
return /*#__PURE__*/React.createElement(Dropdown.Trigger, _assignProps7({}, _ref7));
|
|
490
490
|
}
|
|
491
|
-
function ItemContent(
|
|
491
|
+
function ItemContent(_ref19) {
|
|
492
492
|
var _ref8 = arguments[0],
|
|
493
|
-
|
|
494
|
-
var styles =
|
|
493
|
+
_ref13;
|
|
494
|
+
var styles = _ref19.styles;
|
|
495
495
|
var SItemContent = Flex;
|
|
496
496
|
var ref = React.useRef();
|
|
497
497
|
var menuItemCtxValue = React.useContext(menuItemContext);
|
|
@@ -513,11 +513,11 @@ function ItemContent(_ref25) {
|
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
515
|
}, [menuItemCtxValue.ariaDescribes]);
|
|
516
|
-
return
|
|
516
|
+
return _ref13 = sstyled(styles), /*#__PURE__*/React.createElement(SItemContent, _ref13.cn("SItemContent", _objectSpread({}, _assignProps8({
|
|
517
517
|
"role": menuItemCtxValue.role,
|
|
518
518
|
"id": menuItemCtxValue.contentId,
|
|
519
519
|
"tabIndex": menuItemCtxValue.tabIndex,
|
|
520
|
-
"ref": forkRef(menuItemCtxValue.ref, ref),
|
|
520
|
+
"ref": forkRef(menuItemCtxValue.ref, menuItemCtxValue.forwardRef, ref),
|
|
521
521
|
"use:aria-describedby": _toConsumableArray(describedby).join(' '),
|
|
522
522
|
"aria-haspopup": menuItemCtxValue.hasSubMenu ? 'true' : undefined,
|
|
523
523
|
"aria-expanded": subMenu,
|
|
@@ -527,72 +527,32 @@ function ItemContent(_ref25) {
|
|
|
527
527
|
"disabled": menuItemCtxValue.disabled
|
|
528
528
|
}, _ref8))));
|
|
529
529
|
}
|
|
530
|
-
function ItemContentText(
|
|
530
|
+
function ItemContentText(_ref20) {
|
|
531
531
|
var _ref9 = arguments[0],
|
|
532
|
-
|
|
533
|
-
var styles =
|
|
532
|
+
_ref14;
|
|
533
|
+
var styles = _ref20.styles,
|
|
534
|
+
_ref20$ellipsis = _ref20.ellipsis,
|
|
535
|
+
ellipsis = _ref20$ellipsis === void 0 ? false : _ref20$ellipsis;
|
|
534
536
|
var SItemContentText = Text;
|
|
535
|
-
|
|
537
|
+
var menuItemCtxValue = React.useContext(menuItemContext);
|
|
538
|
+
return _ref14 = sstyled(styles), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SItemContentText, _ref14.cn("SItemContentText", _objectSpread({}, _assignProps9({
|
|
539
|
+
"ellipsis": ellipsis,
|
|
540
|
+
"hint:triggerRef": menuItemCtxValue.ref,
|
|
541
|
+
"hint:placement": 'right'
|
|
542
|
+
}, _ref9)))));
|
|
536
543
|
}
|
|
537
|
-
function ItemHint(
|
|
544
|
+
function ItemHint(_ref21) {
|
|
538
545
|
var _ref0 = arguments[0],
|
|
539
|
-
|
|
540
|
-
var styles =
|
|
546
|
+
_ref15;
|
|
547
|
+
var styles = _ref21.styles;
|
|
541
548
|
var SItemHint = Flex;
|
|
542
549
|
var _React$useContext = React.useContext(menuItemContext),
|
|
543
550
|
hintId = _React$useContext.hintId;
|
|
544
|
-
return
|
|
551
|
+
return _ref15 = sstyled(styles), /*#__PURE__*/React.createElement(SItemHint, _ref15.cn("SItemHint", _objectSpread({}, _assignProps0({
|
|
545
552
|
"id": hintId,
|
|
546
553
|
"aria-hidden": 'true'
|
|
547
554
|
}, _ref0))));
|
|
548
555
|
}
|
|
549
|
-
|
|
550
|
-
/**
|
|
551
|
-
* @deprecated Use Item hint
|
|
552
|
-
*/
|
|
553
|
-
function Hint(props) {
|
|
554
|
-
var _ref1 = arguments[0],
|
|
555
|
-
_ref20;
|
|
556
|
-
var SDropdownMenuItemContainer = Dropdown.Item;
|
|
557
|
-
return _ref20 = sstyled(props.styles), /*#__PURE__*/React.createElement(SDropdownMenuItemContainer, _ref20.cn("SDropdownMenuItemContainer", _objectSpread({}, _assignProps1({
|
|
558
|
-
"variant": 'hint'
|
|
559
|
-
}, _ref1))));
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* @deprecated Use Group with title prop
|
|
563
|
-
*/
|
|
564
|
-
function Title(props) {
|
|
565
|
-
var _ref10 = arguments[0],
|
|
566
|
-
_ref21;
|
|
567
|
-
var SDropdownMenuItemContainer = Dropdown.Item;
|
|
568
|
-
return _ref21 = sstyled(props.styles), /*#__PURE__*/React.createElement(SDropdownMenuItemContainer, _ref21.cn("SDropdownMenuItemContainer", _objectSpread({}, _assignProps10({
|
|
569
|
-
"variant": 'title'
|
|
570
|
-
}, _ref10))));
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* @deprecated
|
|
575
|
-
*/
|
|
576
|
-
function Nesting(_ref28) {
|
|
577
|
-
var _ref11 = arguments[0];
|
|
578
|
-
var forwardRef = _ref28.forwardRef;
|
|
579
|
-
return /*#__PURE__*/React.createElement(DropdownMenu.Item, _assignProps11({
|
|
580
|
-
"ref": forwardRef
|
|
581
|
-
}, _ref11));
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* @deprecated
|
|
586
|
-
*/
|
|
587
|
-
function NestingTrigger(_ref29) {
|
|
588
|
-
var _ref12 = arguments[0];
|
|
589
|
-
var forwardRef = _ref29.forwardRef;
|
|
590
|
-
return /*#__PURE__*/React.createElement(DropdownMenu.Item.Content, _assignProps12({
|
|
591
|
-
"tag": DropdownMenu.Trigger,
|
|
592
|
-
"ref": forwardRef,
|
|
593
|
-
"use:role": 'menuitem'
|
|
594
|
-
}, _ref12));
|
|
595
|
-
}
|
|
596
556
|
var DropdownMenu = createComponent(DropdownMenuRoot, {
|
|
597
557
|
Trigger: Trigger,
|
|
598
558
|
Popper: Dropdown.Popper,
|
|
@@ -606,15 +566,6 @@ var DropdownMenu = createComponent(DropdownMenuRoot, {
|
|
|
606
566
|
Text: ItemContentText,
|
|
607
567
|
Hint: ItemHint
|
|
608
568
|
}],
|
|
609
|
-
/**
|
|
610
|
-
* @deprecated. Use just Item. See examples on
|
|
611
|
-
*/
|
|
612
|
-
Nesting: [Nesting, {
|
|
613
|
-
Trigger: NestingTrigger,
|
|
614
|
-
Addon: Addon
|
|
615
|
-
}],
|
|
616
|
-
ItemTitle: Title,
|
|
617
|
-
ItemHint: Hint,
|
|
618
569
|
Group: Dropdown.Group
|
|
619
570
|
}, {
|
|
620
571
|
parent: [Dropdown]
|