@itwin/components-react 3.1.0-dev.27 → 3.1.0-dev.28
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 +61 -5
- package/lib/cjs/components-react/toolbar/Overflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Overflow.js +3 -1
- package/lib/cjs/components-react/toolbar/Overflow.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Overflow.scss +7 -0
- package/lib/cjs/components-react/toolbar/PopupItem.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItem.js +3 -1
- package/lib/cjs/components-react/toolbar/PopupItem.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItem.scss +13 -2
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts +10 -0
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js +15 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/esm/components-react/toolbar/Overflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Overflow.js +4 -2
- package/lib/esm/components-react/toolbar/Overflow.js.map +1 -1
- package/lib/esm/components-react/toolbar/Overflow.scss +7 -0
- package/lib/esm/components-react/toolbar/PopupItem.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.js +4 -2
- package/lib/esm/components-react/toolbar/PopupItem.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.scss +13 -2
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts +10 -0
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js +13 -0
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
# Change Log - @itwin/components-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 24 Jan 2022 14:00:52 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 3.0.0
|
|
6
|
+
Mon, 24 Jan 2022 14:00:52 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Upgrade target to ES2019 and deliver both a CommonJs and ESModule version of package
|
|
11
|
+
- Update CustomNumberEditor to use size='small' itwinUi style.
|
|
12
|
+
- rename to @itwin/components-react
|
|
13
|
+
- remove ClientRequestContext and its subclasses
|
|
14
|
+
- Removed SignIn component
|
|
15
|
+
- Replace usage of I18N with generic Localization interface.
|
|
16
|
+
- Update snapshots
|
|
17
|
+
- Renamed an iModel's parent container to iTwin
|
|
18
|
+
- Support for TypeDoc v0.22.7. Fix various broken docs links.
|
|
19
|
+
- Refactored part of AccuDraw UI & Providing AccuDraw UI documentation
|
|
20
|
+
- Create empty frontstage and UiItemsProviders to populate it and update how ContentGroups are defined.
|
|
21
|
+
- Add missing public/beta types to the barrel file.
|
|
22
|
+
- Updated recommendation for using Breadcrumbs from itwinui-react instead of deprecated Breadcrumb
|
|
23
|
+
- Change `ControlledTree` to take `TreeModel` instead of `VisibleTreeNodes`.
|
|
24
|
+
- Replace `useVisibleTreeNodes` with `useTreeModel` since consumers don't need to create `VisibleTreeNodes` anymore.
|
|
25
|
+
- Rename `ControlledTreeProps.treeEvents` to `eventsHandler`.
|
|
26
|
+
- Make `width` and `height` required props for `ControlledTree` and `TreeRenderer`.
|
|
27
|
+
- Clean up deprecated Tree and Drag & Drop related APIs
|
|
28
|
+
- Clean up deprecated FilteringInput and PropertyGrid props
|
|
29
|
+
- Make `width` and `height` props required for `VirtualizedPropertyGrid` and `VirtualizedPropertyGridWithDataProvider`
|
|
30
|
+
- Update CustomNumberEditor resetting of bad values.
|
|
31
|
+
- update immer to fix security warning
|
|
32
|
+
- Deprecated Breadcrumb component
|
|
33
|
+
- Deprecate and promote apis
|
|
34
|
+
- Deprecate Table component.
|
|
35
|
+
- Deprecate obsolete APIs. Publish beta APIs from last release.
|
|
36
|
+
- Export BeDragDropContext
|
|
37
|
+
- Upgraded itwinui-react to 1.16.2. Fixed editor sizes.
|
|
38
|
+
- Remove files generated by bad merge
|
|
39
|
+
- Make ToolbarPopupContext public so user can call closePanel from their popup panels.
|
|
40
|
+
- Update props on iTwinUi-react Select so it works properly in auto-sized floating widgets.
|
|
41
|
+
- Deprecated HorizontalTabs in ui-core. Removed older deprecated items. Updated NextVersion.md.
|
|
42
|
+
- Update to latest itwinui-react
|
|
43
|
+
- Clean up css for status bar entries to avoid unwanted text wrapping.
|
|
44
|
+
- Incorporating iTwinUI-CSS and iTwinUI-React into iModel.js
|
|
45
|
+
- iTwinUI-react Table demo
|
|
46
|
+
- Moved iTwinUI style overrides to ui-core from ui-framework
|
|
47
|
+
- Rename ui directories to match new package names.
|
|
48
|
+
- Remove native key handling in React editor components because it's not longer needed with React 17.
|
|
49
|
+
- Add prop that prevents popup button panel from unmounting when closed.
|
|
50
|
+
- Promote property grid related APIs
|
|
51
|
+
- Update to React 17.
|
|
52
|
+
- Created imodel-components folder & package and moved color, lineweight, navigationaids, quantity, timeline & viewport. Deprecated MessageSeverity in ui-core & added it ui-abstract. Added MessagePresenter interface to ui-abstract.
|
|
53
|
+
- Remove react 16 peer dependency.
|
|
54
|
+
- Remove itwinUi css overrides.
|
|
55
|
+
- UiFramework and UiIModelComponent initialize method no longer take localization argument, uses IModelApp.localization internally.
|
|
56
|
+
- Replaced ui-core Slider with one from iTwinUi-react.
|
|
57
|
+
- Update to latest types/react package
|
|
58
|
+
- Skip test causing CI job failures
|
|
59
|
+
- Lock down and update version numbers so docs will build.
|
|
4
60
|
|
|
5
61
|
## 2.19.28
|
|
6
62
|
Wed, 12 Jan 2022 14:52:38 GMT
|
|
@@ -295,7 +351,7 @@ Mon, 24 May 2021 15:58:39 GMT
|
|
|
295
351
|
- Improved Multi-Value column filtering in the Table component
|
|
296
352
|
- Move `VirtualizedPropertyGrid` related types from @alpha to @beta.
|
|
297
353
|
- Fixed getting distinct values when Table rows are updated
|
|
298
|
-
- Update to latest classnames package
|
|
354
|
+
- Update to latest classnames package
|
|
299
355
|
|
|
300
356
|
## 2.15.6
|
|
301
357
|
Wed, 26 May 2021 15:55:19 GMT
|
|
@@ -761,7 +817,7 @@ Thu, 28 May 2020 22:48:59 GMT
|
|
|
761
817
|
### Updates
|
|
762
818
|
|
|
763
819
|
- Fix toolbar overflow panel display.
|
|
764
|
-
- Update to only show group separators if toolbar is not transparent.
|
|
820
|
+
- Update to only show group separators if toolbar is not transparent.
|
|
765
821
|
- Fix toolbar error when scaling up UI.
|
|
766
822
|
- Property grid horizontal layout updated according to UX requirements.
|
|
767
823
|
- Fixed Table filter renderers after react-select version upgrade
|
|
@@ -1233,7 +1289,7 @@ Wed, 19 Dec 2018 18:26:14 GMT
|
|
|
1233
1289
|
- Added DragDrop tests, added component withDragDrop HOC tests
|
|
1234
1290
|
- Synchronizing navigation aids with view definition changes
|
|
1235
1291
|
- Simplified property pane tooltips and improved Property Pane performance.
|
|
1236
|
-
- Simplified struct and array tooltips in Table component.
|
|
1292
|
+
- Simplified struct and array tooltips in Table component.
|
|
1237
1293
|
- Fix BeInspireTree's event listening functions to handle array inputs
|
|
1238
1294
|
- Fix BeInspireTree's muting events with allowed number of triggers
|
|
1239
1295
|
- Cache BeInspireTree.visible() result for better performance
|
|
@@ -1363,7 +1419,7 @@ Thu, 08 Nov 2018 17:59:21 GMT
|
|
|
1363
1419
|
|
|
1364
1420
|
### Updates
|
|
1365
1421
|
|
|
1366
|
-
- Deprecated dev-cors-proxy-server and use of it.
|
|
1422
|
+
- Deprecated dev-cors-proxy-server and use of it.
|
|
1367
1423
|
- Fix: Do not start search if input field is empty
|
|
1368
1424
|
- Use strongly typed enums for identifying keyboard keys
|
|
1369
1425
|
- PropertyGrid property editing and unit tests
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overflow.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Overflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,iBAAiB,CAAC;AAEzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAsB,MAAM,mBAAmB,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,WAAW,EAAE,eAAe;IAC9E,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sCAAsC;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8BAA8B;IAC9B,SAAS,EAAE,SAAS,CAAC;IACrB,qDAAqD;IACrD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"Overflow.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Overflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,iBAAiB,CAAC;AAEzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAsB,MAAM,mBAAmB,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,WAAW,EAAE,eAAe;IAC9E,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sCAAsC;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8BAA8B;IAC9B,SAAS,EAAE,SAAS,CAAC;IACrB,qDAAqD;IACrD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,eA+CtE;AAED,gBAAgB;AAChB,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAWxF"}
|
|
@@ -45,13 +45,15 @@ function ToolbarOverflowButton(props) {
|
|
|
45
45
|
const { onResize, useHeight } = (0, ToolbarWithOverflow_1.useToolItemEntryContext)();
|
|
46
46
|
const [targetRef, target] = (0, core_react_1.useRefState)();
|
|
47
47
|
const ref = (0, ItemWrapper_1.useResizeObserverSingleDimension)(onResize, useHeight);
|
|
48
|
+
const isHidden = (0, ToolbarWithOverflow_1.useToolbarPopupAutoHideContext)();
|
|
49
|
+
const popupClassName = (0, classnames_1.default)("components-toolbar-overflow_popup", isHidden && "nz-hidden");
|
|
48
50
|
const className = (0, classnames_1.default)("components-toolbar-item-container", "components-toolbar-overflow-button", props.className);
|
|
49
51
|
const buttonClassName = (0, classnames_1.default)("components-toolbar-button-item", "components-ellipsis-icon");
|
|
50
52
|
return (React.createElement("div", { className: className, ref: targetRef },
|
|
51
53
|
React.createElement("button", { ref: ref, onClick: props.onClick, className: buttonClassName, style: props.style, title: props.title },
|
|
52
54
|
React.createElement("div", { className: "components-icon" },
|
|
53
55
|
React.createElement("div", { className: "components-ellipsis" }))),
|
|
54
|
-
React.createElement(core_react_1.Popup, { className:
|
|
56
|
+
React.createElement(core_react_1.Popup, { className: popupClassName, offset: 0, showShadow: false, isOpen: props.open, onClose: props.onClose, position: toToolbarOverflowRelativePosition(props.expandsTo), target: target }, props.panelNode)));
|
|
55
57
|
}
|
|
56
58
|
exports.ToolbarOverflowButton = ToolbarOverflowButton;
|
|
57
59
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Overflow.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2BAAyB;AACzB,4DAAoC;AACpC,6CAA+B;AAC/B,kDAAqF;AACrF,+
|
|
1
|
+
{"version":3,"file":"Overflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Overflow.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2BAAyB;AACzB,4DAAoC;AACpC,6CAA+B;AAC/B,kDAAqF;AACrF,+DAAgG;AAChG,+CAAiE;AACjE,qDAAkD;AAClD,0DAAyD;AAoBzD;;GAEG;AACH,SAAgB,qBAAqB,CAAC,KAAiC;IACrE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAA,6CAAuB,GAAE,CAAC;IAC1D,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,IAAA,wBAAW,GAAkB,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAA,8CAAgC,EAAoB,QAAQ,EAAE,SAAS,CAAC,CAAC;IACrF,MAAM,QAAQ,GAAG,IAAA,oDAA8B,GAAE,CAAC;IAClD,MAAM,cAAc,GAAG,IAAA,oBAAU,EAC/B,mCAAmC,EACnC,QAAQ,IAAI,WAAW,CAAC,CAAC;IAE3B,MAAM,SAAS,GAAG,IAAA,oBAAU,EAC1B,mCAAmC,EACnC,oCAAoC,EACpC,KAAK,CAAC,SAAS,CAChB,CAAC;IACF,MAAM,eAAe,GAAG,IAAA,oBAAU,EAChC,gCAAgC,EAChC,0BAA0B,CAC3B,CAAC;IACF,OAAO,CACL,6BACE,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,SAAS;QAEd,gCACE,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,KAAK;YAElB,6BAAK,SAAS,EAAC,iBAAiB;gBAC9B,6BAAK,SAAS,EAAC,qBAAqB,GAAG,CACnC,CACC;QACT,oBAAC,kBAAK,IACJ,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,KAAK,EACjB,MAAM,EAAE,KAAK,CAAC,IAAI,EAClB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,iCAAiC,CAAC,KAAK,CAAC,SAAS,CAAC,EAC5D,MAAM,EAAE,MAAM,IAEb,KAAK,CAAC,SAAS,CACV,CACJ,CACP,CAAC;AACJ,CAAC;AA/CD,sDA+CC;AAED,gBAAgB;AAChB,SAAgB,iCAAiC,CAAC,SAAoB;IACpE,QAAQ,SAAS,EAAE;QACjB,KAAK,qBAAS,CAAC,MAAM;YACnB,OAAO,iCAAgB,CAAC,MAAM,CAAC;QACjC,KAAK,qBAAS,CAAC,IAAI;YACjB,OAAO,iCAAgB,CAAC,IAAI,CAAC;QAC/B,KAAK,qBAAS,CAAC,KAAK;YAClB,OAAO,iCAAgB,CAAC,KAAK,CAAC;QAChC,KAAK,qBAAS,CAAC,GAAG;YAChB,OAAO,iCAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,CAAC;AAXD,8EAWC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ToolSettings\r\n */\r\n\r\nimport \"./Overflow.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps, NoChildrenProps, Popup, useRefState } from \"@itwin/core-react\";\r\nimport { useToolbarPopupAutoHideContext, useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { useResizeObserverSingleDimension } from \"./ItemWrapper\";\r\nimport { Direction } from \"./utilities/Direction\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\n\r\n/** Properties of [[ToolbarOverflowButton]] component.\r\n * @internal\r\n */\r\nexport interface ToolbarOverflowButtonProps extends CommonProps, NoChildrenProps {\r\n /** Function called when button is clicked. */\r\n onClick?: () => void;\r\n /** Function called when panel is closed. */\r\n onClose?: () => void;\r\n /** Describes if the panel is open. */\r\n open?: boolean;\r\n /** Panel expand direction. */\r\n expandsTo: Direction;\r\n /** Panel element containing the overflown buttons */\r\n panelNode?: React.ReactNode;\r\n /** Title for the item. */\r\n title?: string;\r\n}\r\n\r\n/** Button to toggle display of overflown tools.\r\n * @internal\r\n */\r\nexport function ToolbarOverflowButton(props: ToolbarOverflowButtonProps) {\r\n const { onResize, useHeight } = useToolItemEntryContext();\r\n const [targetRef, target] = useRefState<HTMLDivElement>();\r\n const ref = useResizeObserverSingleDimension<HTMLButtonElement>(onResize, useHeight);\r\n const isHidden = useToolbarPopupAutoHideContext();\r\n const popupClassName = classnames(\r\n \"components-toolbar-overflow_popup\",\r\n isHidden && \"nz-hidden\");\r\n\r\n const className = classnames(\r\n \"components-toolbar-item-container\",\r\n \"components-toolbar-overflow-button\",\r\n props.className,\r\n );\r\n const buttonClassName = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-ellipsis-icon\",\r\n );\r\n return (\r\n <div\r\n className={className}\r\n ref={targetRef}\r\n >\r\n <button\r\n ref={ref}\r\n onClick={props.onClick}\r\n className={buttonClassName}\r\n style={props.style}\r\n title={props.title}\r\n >\r\n <div className=\"components-icon\">\r\n <div className=\"components-ellipsis\" />\r\n </div>\r\n </button>\r\n <Popup\r\n className={popupClassName}\r\n offset={0}\r\n showShadow={false}\r\n isOpen={props.open}\r\n onClose={props.onClose}\r\n position={toToolbarOverflowRelativePosition(props.expandsTo)}\r\n target={target}\r\n >\r\n {props.panelNode}\r\n </Popup>\r\n </div>\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport function toToolbarOverflowRelativePosition(expandsTo: Direction): RelativePosition {\r\n switch (expandsTo) {\r\n case Direction.Bottom:\r\n return RelativePosition.Bottom;\r\n case Direction.Left:\r\n return RelativePosition.Left;\r\n case Direction.Right:\r\n return RelativePosition.Right;\r\n case Direction.Top:\r\n return RelativePosition.Top;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupItem.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItem.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAIhD,cAAc;AACd,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;IAChC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,YAAY,KAAK,IAAI,CAAC;CAC/D;AAED;;;GAGG;AAEH,eAAO,MAAM,mBAAmB,yCAK9B,CAAC;AAEH;;;GAGG;AACH,wBAAgB,sBAAsB,6BAErC;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,sBAAsB;IAC5D,wEAAwE;IACxE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;kEAC8D;IAC9D,mBAAmB,CAAC,EAAE,OAAO,CAAC;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AAC,KAAK,EAAE,cAAc,eAyE9C;AAED,gBAAgB;AAChB,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,gBAAgB;AAChB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAYxD"}
|
|
@@ -98,7 +98,9 @@ function PopupItem(props) {
|
|
|
98
98
|
exports.PopupItem = PopupItem;
|
|
99
99
|
/** @internal */
|
|
100
100
|
function PopupItemPopup(props) {
|
|
101
|
-
|
|
101
|
+
const isHidden = (0, ToolbarWithOverflow_1.useToolbarPopupAutoHideContext)();
|
|
102
|
+
const className = (0, classnames_1.default)("components-toolbar-popupItem_popupItemPopup", isHidden && "nz-hidden");
|
|
103
|
+
return React.createElement(core_react_1.Popup, { className: className, offset: 0, showShadow: false, ...props });
|
|
102
104
|
}
|
|
103
105
|
exports.PopupItemPopup = PopupItemPopup;
|
|
104
106
|
//# sourceMappingURL=PopupItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupItem.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItem.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4BAA0B;AAC1B,4DAAoC;AACpC,6CAA+B;AAE/B,kDAAuD;AAEvD,+
|
|
1
|
+
{"version":3,"file":"PopupItem.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItem.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4BAA0B;AAC1B,4DAAoC;AACpC,6CAA+B;AAE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YAEP,aAAa,CAAC,CAAC,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAC,qBAAqB,GAAG,CACxF;QACT,oBAAC,cAAc,IACb,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,IAAA,kDAA8B,EAAC,kBAAkB,EAAE,cAAc,CAAC,EAC5E,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,IAE7C,KAAK,CACS,CACY,CAChC,CAAC;AACJ,CAAC;AAzED,8BAyEC;AAYD,gBAAgB;AAChB,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,QAAQ,GAAG,IAAA,oDAA8B,GAAE,CAAC;IAClD,MAAM,SAAS,GAAG,IAAA,oBAAU,EAC1B,6CAA6C,EAC7C,QAAQ,IAAI,WAAW,CAAC,CAAC;IAE3B,OAAO,oBAAC,kBAAK,IACX,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,KAAK,KACb,KAAK,GACT,CAAC;AACL,CAAC;AAZD,wCAYC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Toolbar\r\n */\r\n\r\nimport \"./PopupItem.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ActionButton, RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { Popup, useRefState } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItemProps } from \"./Item\";\r\nimport { useToolbarPopupAutoHideContext, useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { toToolbarPopupRelativePosition } from \"./PopupItemWithDrag\";\r\n\r\n/** @public */\r\nexport interface ToolbarPopupContextProps {\r\n readonly closePanel: () => void;\r\n readonly setSelectedItem?: (buttonItem: ActionButton) => void;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar items in popups to close the popup panel.\r\n * @public\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarPopupContext = React.createContext<ToolbarPopupContextProps>({\r\n /** function used to close popup panel */\r\n closePanel: /* istanbul ignore next */ () => { },\r\n /** if popup panel is a GroupButton then this is call to set the selected action item within the panel */\r\n setSelectedItem: /* istanbul ignore next */ (_buttonItem: ActionButton) => { },\r\n});\r\n\r\n/**\r\n * React hook used to retrieve the ToolbarPopupContext.\r\n * @public\r\n */\r\nexport function useToolbarPopupContext() {\r\n return React.useContext(ToolbarPopupContext);\r\n}\r\n\r\n/** Properties of [[PopupItem]] component.\r\n * @public\r\n */\r\nexport interface PopupItemProps extends ToolbarButtonItemProps {\r\n /** Describes if expandable item triangle indicator should be hidden. */\r\n hideIndicator?: boolean;\r\n /** Panel of the toolbar. */\r\n panel?: React.ReactNode;\r\n /** If true the popup panel is mounted once and unmounted when button is unmounted. If false the\r\n * content node is unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** Popup toolbar item that displays a panel\r\n * @public\r\n */\r\nexport function PopupItem(props: PopupItemProps) {\r\n const [isPanelShown, setPanelShown] = React.useState(false);\r\n const { expandsTo, overflowExpandsTo, panelAlignment, onPopupPanelOpenClose } = useToolbarWithOverflowDirectionContext();\r\n const processPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n setPanelShown((prev) => {\r\n // istanbul ignore else\r\n if (prev !== isOpening)\r\n onPopupPanelOpenClose(isOpening);\r\n return isOpening;\r\n });\r\n }, [setPanelShown, onPopupPanelOpenClose]);\r\n\r\n // handle open and closing overflow panel\r\n const onButtonClick = React.useCallback(() => {\r\n processPanelOpenClose(!isPanelShown);\r\n // istanbul ignore next\r\n if (props.onClick)\r\n props.onClick();\r\n }, [props, isPanelShown, processPanelOpenClose]);\r\n const className = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-toolbar-expandable-button\",\r\n props.isDisabled && \"components-disabled\",\r\n props.className);\r\n\r\n const [targetRef, target] = useRefState<HTMLButtonElement>();\r\n // istanbul ignore next\r\n const handleClose = React.useCallback(() => {\r\n processPanelOpenClose(false);\r\n }, [processPanelOpenClose]);\r\n const { hasOverflow } = useToolItemEntryContext();\r\n const expandsToDirection = hasOverflow ? overflowExpandsTo : expandsTo;\r\n\r\n const { hideIndicator, panel } = props;\r\n return (\r\n <ToolbarPopupContext.Provider value={{\r\n closePanel: () => processPanelOpenClose(false),\r\n }}>\r\n <button\r\n data-item-id={props.itemId}\r\n data-item-type=\"tool-button-popup\"\r\n data-item-group-priority={props.groupPriority}\r\n data-item-priority={props.itemPriority}\r\n data-item-providerid={props.providerId}\r\n ref={targetRef}\r\n disabled={props.isDisabled} // this is needed to prevent focusing/keyboard access to disabled buttons\r\n onClick={onButtonClick}\r\n onKeyDown={props.onKeyDown}\r\n className={className}\r\n style={props.style}\r\n title={props.title}\r\n >\r\n <div className=\"components-icon\">\r\n {props.icon}\r\n </div>\r\n {props.badge &&\r\n <div className=\"components-badge\">\r\n {props.badge}\r\n </div>\r\n }\r\n {hideIndicator ? /* istanbul ignore next */ undefined : <div className=\"components-triangle\" />}\r\n </button>\r\n <PopupItemPopup\r\n isOpen={isPanelShown}\r\n onClose={handleClose}\r\n position={toToolbarPopupRelativePosition(expandsToDirection, panelAlignment)}\r\n target={target}\r\n keepContentsMounted={props.keepContentsMounted}\r\n >\r\n {panel}\r\n </PopupItemPopup>\r\n </ToolbarPopupContext.Provider>\r\n );\r\n}\r\n\r\n/** @internal */\r\ninterface PopupItemPopupProps {\r\n children?: React.ReactNode;\r\n isOpen?: boolean;\r\n onClose(): void;\r\n position: RelativePosition;\r\n target?: HTMLElement;\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport function PopupItemPopup(props: PopupItemPopupProps) {\r\n const isHidden = useToolbarPopupAutoHideContext();\r\n const className = classnames(\r\n \"components-toolbar-popupItem_popupItemPopup\",\r\n isHidden && \"nz-hidden\");\r\n\r\n return <Popup\r\n className={className}\r\n offset={0}\r\n showShadow={false}\r\n {...props}\r\n />;\r\n}\r\n"]}
|
|
@@ -29,7 +29,11 @@
|
|
|
29
29
|
filter: $arrow-shadow;
|
|
30
30
|
pointer-events: none;
|
|
31
31
|
|
|
32
|
-
@include triangle-bottom-right(
|
|
32
|
+
@include triangle-bottom-right(
|
|
33
|
+
$width: $triangle-width,
|
|
34
|
+
$height: $triangle-height,
|
|
35
|
+
$color: $buic-icon-color
|
|
36
|
+
);
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
&:active>.components-triangle {
|
|
@@ -73,4 +77,11 @@
|
|
|
73
77
|
border-width: 1px;
|
|
74
78
|
border-style: solid;
|
|
75
79
|
border-radius: 3px;
|
|
76
|
-
|
|
80
|
+
|
|
81
|
+
transition: visibility 0.5s ease, opacity 0.5s ease;
|
|
82
|
+
|
|
83
|
+
&.nz-hidden {
|
|
84
|
+
opacity: 0;
|
|
85
|
+
visibility: hidden;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -18,6 +18,16 @@ export interface CustomToolbarItem extends CustomButtonDefinition {
|
|
|
18
18
|
* content node is unmounted each time the popup is closed. */
|
|
19
19
|
keepContentsLoaded?: boolean;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export declare const ToolbarPopupAutoHideContext: React.Context<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* React hook used to retrieve the ToolbarPopupAutoHideContext.
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export declare function useToolbarPopupAutoHideContext(): boolean;
|
|
21
31
|
/** Describes toolbar item.
|
|
22
32
|
* @public
|
|
23
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.useToolItemEntryContext = exports.ToolbarItemContext = exports.ToolbarWithOverflow = exports.useToolbarWithOverflowDirectionContext = exports.ToolbarItemComponent = exports.ActionItem = exports.GroupPopupItem = exports.CustomItem = exports.ToolbarWithOverflowDirectionContext = exports.ToolbarPanelAlignmentHelpers = exports.ToolbarOpacitySetting = exports.ToolbarPanelAlignment = exports.getToolbarDirection = exports.isCustomToolbarItem = void 0;
|
|
32
|
+
exports.useToolItemEntryContext = exports.ToolbarItemContext = exports.ToolbarWithOverflow = exports.useToolbarWithOverflowDirectionContext = exports.ToolbarItemComponent = exports.ActionItem = exports.GroupPopupItem = exports.CustomItem = exports.ToolbarWithOverflowDirectionContext = exports.ToolbarPanelAlignmentHelpers = exports.ToolbarOpacitySetting = exports.ToolbarPanelAlignment = exports.getToolbarDirection = exports.isCustomToolbarItem = exports.useToolbarPopupAutoHideContext = exports.ToolbarPopupAutoHideContext = void 0;
|
|
33
33
|
require("./Toolbar.scss");
|
|
34
34
|
const classnames_1 = __importDefault(require("classnames"));
|
|
35
35
|
const React = __importStar(require("react"));
|
|
@@ -45,6 +45,20 @@ const PopupItemsPanel_1 = require("./PopupItemsPanel");
|
|
|
45
45
|
const PopupItemWithDrag_1 = require("./PopupItemWithDrag");
|
|
46
46
|
const Direction_1 = require("./utilities/Direction");
|
|
47
47
|
const UiComponents_1 = require("../UiComponents");
|
|
48
|
+
/**
|
|
49
|
+
* Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
53
|
+
exports.ToolbarPopupAutoHideContext = React.createContext(false);
|
|
54
|
+
/**
|
|
55
|
+
* React hook used to retrieve the ToolbarPopupAutoHideContext.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
function useToolbarPopupAutoHideContext() {
|
|
59
|
+
return React.useContext(exports.ToolbarPopupAutoHideContext);
|
|
60
|
+
}
|
|
61
|
+
exports.useToolbarPopupAutoHideContext = useToolbarPopupAutoHideContext;
|
|
48
62
|
/** CustomToolbarItem type guard.
|
|
49
63
|
* @internal
|
|
50
64
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0BAAwB;AACxB,4DAAoC;AACpC,6CAA+B;AAC/B,0DAG+B;AAC/B,kDAAsG;AACtG,iCAA2C;AAC3C,mCAAuC;AACvC,+CAA8E;AAC9E,yCAAmD;AACnD,mDAAuD;AACvD,2CAAwC;AACxC,uDAAoD;AACpD,2DAAwD;AACxD,qDAAqH;AACrH,kDAA+C;AAoB/C;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAiB;IACnD,OAAO,CAAC,CAAE,IAA0B,CAAC,QAAQ,IAAI,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,CAAC,CAAC;AAC5G,CAAC;AAFD,kDAEC;AAED,gBAAgB;AACT,MAAM,mBAAmB,GAAG,CAAC,SAAoB,EAAuB,EAAE;IAC/E,MAAM,mBAAmB,GAAG,4BAAgB,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC/E,OAAO,sCAA0B,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACjE,CAAC,CAAC;AAHW,QAAA,mBAAmB,uBAG9B;AAEF;;GAEG;AACH,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,mEAAK,CAAA;IACL,+DAAG,CAAA;AACL,CAAC,E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G,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC;YACT,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Toolbar\r\n */\r\n\r\nimport \"./Toolbar.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport {\r\n ActionButton, CommonToolbarItem, ConditionalBooleanValue, ConditionalStringValue, CustomButtonDefinition,\r\n GroupButton, OnItemExecutedFunc, ToolbarItemUtilities,\r\n} from \"@itwin/appui-abstract\";\r\nimport { BadgeUtilities, CommonProps, IconHelper, NoChildrenProps, useRefs } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItem } from \"./Item\";\r\nimport { ToolbarItems } from \"./Items\";\r\nimport { ItemWrapper, useResizeObserverSingleDimension } from \"./ItemWrapper\";\r\nimport { ToolbarOverflowButton } from \"./Overflow\";\r\nimport { ToolbarOverflowPanel } from \"./OverflowPanel\";\r\nimport { PopupItem } from \"./PopupItem\";\r\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\r\nimport { PopupItemWithDrag } from \"./PopupItemWithDrag\";\r\nimport { Direction, DirectionHelpers, OrthogonalDirection, OrthogonalDirectionHelpers } from \"./utilities/Direction\";\r\nimport { UiComponents } from \"../UiComponents\";\r\n\r\n/** Describes the data needed to insert a custom `React` button into an ToolbarWithOverflow.\r\n * @public\r\n */\r\nexport interface CustomToolbarItem extends CustomButtonDefinition {\r\n /** React node that must result in providing a PopupItem @deprecated use panelContentNode */\r\n buttonNode?: React.ReactNode;\r\n /** defines the content to display in popup panel */\r\n panelContentNode?: React.ReactNode;\r\n /** If true the popup panel is mounted once and unmounted when button is unmounted. If false the\r\n * content node is unmounted each time the popup is closed. */\r\n keepContentsLoaded?: boolean;\r\n}\r\n\r\n/** Describes toolbar item.\r\n * @public\r\n */\r\nexport type ToolbarItem = ActionButton | GroupButton | CustomToolbarItem;\r\n\r\n/** CustomToolbarItem type guard.\r\n * @internal\r\n */\r\nexport function isCustomToolbarItem(item: ToolbarItem): item is CustomToolbarItem {\r\n return !!(item as CustomToolbarItem).isCustom && ((\"buttonNode\" in item) || (\"panelContentNode\" in item));\r\n}\r\n\r\n/** @internal */\r\nexport const getToolbarDirection = (expandsTo: Direction): OrthogonalDirection => {\r\n const orthogonalDirection = DirectionHelpers.getOrthogonalDirection(expandsTo);\r\n return OrthogonalDirectionHelpers.inverse(orthogonalDirection);\r\n};\r\n\r\n/** Available alignment modes of [[ToolbarWithOverflow]] panels.\r\n * @public\r\n */\r\nexport enum ToolbarPanelAlignment {\r\n Start,\r\n End,\r\n}\r\n\r\n/** Enumeration of Toolbar Opacity setting.\r\n * @public\r\n */\r\nexport enum ToolbarOpacitySetting {\r\n /** Use the default background, box-shadow opacity and backdrop-filter blur */\r\n Defaults,\r\n /** Alter the opacity from transparent to the defaults based on mouse proximity */\r\n Proximity,\r\n /** Use a transparent background, box-shadow opacity and backdrop-filter blur */\r\n Transparent,\r\n}\r\n\r\n/** Helpers for [[ToolbarPanelAlignment]].\r\n * @internal\r\n */\r\nexport class ToolbarPanelAlignmentHelpers {\r\n /** Class name of [[ToolbarPanelAlignment.Start]] */\r\n public static readonly START_CLASS_NAME = \"components-panel-alignment-start\";\r\n /** Class name of [[ToolbarPanelAlignment.End]] */\r\n public static readonly END_CLASS_NAME = \"components-panel-alignment-end\";\r\n\r\n /** @returns Class name of specified [[ToolbarPanelAlignment]] */\r\n public static getCssClassName(panelAlignment: ToolbarPanelAlignment): string {\r\n switch (panelAlignment) {\r\n case ToolbarPanelAlignment.Start:\r\n return ToolbarPanelAlignmentHelpers.START_CLASS_NAME;\r\n case ToolbarPanelAlignment.End:\r\n return ToolbarPanelAlignmentHelpers.END_CLASS_NAME;\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface ToolbarOverflowContextProps {\r\n readonly expandsTo: Direction;\r\n readonly direction: OrthogonalDirection;\r\n readonly overflowExpandsTo: Direction;\r\n readonly overflowDirection: OrthogonalDirection;\r\n readonly panelAlignment: ToolbarPanelAlignment;\r\n readonly useDragInteraction: boolean;\r\n readonly toolbarOpacitySetting: ToolbarOpacitySetting;\r\n readonly openPopupCount: number;\r\n readonly onPopupPanelOpenClose: (isOpening: boolean) => void;\r\n readonly overflowDisplayActive: boolean;\r\n readonly onItemExecuted: OnItemExecutedFunc;\r\n readonly onKeyDown: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar component to provide Direction to child components.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarWithOverflowDirectionContext = React.createContext<ToolbarOverflowContextProps>({\r\n expandsTo: Direction.Bottom,\r\n direction: OrthogonalDirection.Horizontal,\r\n overflowExpandsTo: Direction.Right,\r\n overflowDirection: OrthogonalDirection.Vertical,\r\n panelAlignment: ToolbarPanelAlignment.Start,\r\n useDragInteraction: false,\r\n toolbarOpacitySetting: ToolbarOpacitySetting.Proximity,\r\n openPopupCount: 0,\r\n onPopupPanelOpenClose: /* istanbul ignore next */ (_isOpening: boolean) => { },\r\n overflowDisplayActive: false,\r\n onItemExecuted: /* istanbul ignore next */ (_item: any) => void {},\r\n onKeyDown: /* istanbul ignore next */ (_e: React.KeyboardEvent) => void {},\r\n});\r\n\r\n/** @internal */\r\nexport function CustomItem({ item, addGroupSeparator }: { item: CustomToolbarItem, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const icon = React.useMemo(() => (item.icon &&\r\n IconHelper.getIconReactNode(item.icon, item.internalData)) || /* istanbul ignore next */\r\n <i className=\"icon icon-placeholder\" />, [item.icon, item.internalData]);\r\n const isDisabled = React.useMemo(() => ConditionalBooleanValue.getValue(item.isDisabled), [item.isDisabled]);\r\n const title = React.useMemo(() => /* istanbul ignore next */ ConditionalStringValue.getValue(item.label) ?? item.id, [item.id, item.label]);\r\n const badge = React.useMemo(() => BadgeUtilities.getComponentForBadgeType(item.badgeType), [item.badgeType]);\r\n\r\n if (item.panelContentNode) {\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n icon={icon}\r\n isDisabled={isDisabled}\r\n title={title}\r\n panel={item.panelContentNode}\r\n hideIndicator={useDragInteraction}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n keepContentsMounted={item.keepContentsLoaded}\r\n />;\r\n }\r\n\r\n // istanbul ignore else\r\n if (item.buttonNode)\r\n return <>{item.buttonNode}</>;\r\n\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function GroupPopupItem({ item, addGroupSeparator }: { item: GroupButton, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const panel = React.useMemo(() => <PopupItemsPanel groupItem={item} activateOnPointerUp={false} />, [item]);\r\n if (useDragInteraction) {\r\n return <PopupItemWithDrag\r\n key={item.id}\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n groupItem={item}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n }\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n panel={panel}\r\n badge={badge}\r\n hideIndicator={useDragInteraction}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ActionItem({ item, addGroupSeparator }: { item: ActionButton, addGroupSeparator: boolean }) {\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const { onItemExecuted } = useToolbarWithOverflowDirectionContext();\r\n const onExecute = React.useCallback(() => {\r\n item.execute();\r\n onItemExecuted(item);\r\n }, [item, onItemExecuted]);\r\n\r\n return <ToolbarButtonItem\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n key={item.id}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isActive={item.isActive}\r\n onClick={onExecute}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ToolbarItemComponent({ item, addGroupSeparator }: { item: ToolbarItem, addGroupSeparator: boolean }) {\r\n if (ToolbarItemUtilities.isGroupButton(item)) {\r\n return <GroupPopupItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else if (isCustomToolbarItem(item)) {\r\n return <CustomItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(item)) {\r\n return <ActionItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n }\r\n }\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function useToolbarWithOverflowDirectionContext() {\r\n return React.useContext(ToolbarWithOverflowDirectionContext);\r\n}\r\n\r\nfunction OverflowItemsContainer(p: { children: React.ReactNode }) {\r\n return <>{p.children}</>;\r\n}\r\n\r\nfunction getItemWrapperClass(child: React.ReactNode) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child)) {\r\n if (child.props && child.props.addGroupSeparator)\r\n return \"components-toolbar-button-add-gap-before\";\r\n }\r\n return undefined;\r\n}\r\n\r\n/** Properties of [[ToolbarWithOverflow]] component.\r\n * @public\r\n */\r\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\r\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\r\n expandsTo?: Direction;\r\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\r\n overflowExpandsTo?: Direction;\r\n /** definitions for items of the toolbar. i.e. [[CommonToolbarItem]]. Items are expected to be already sorted by group and item. */\r\n items: CommonToolbarItem[];\r\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\r\n panelAlignment?: ToolbarPanelAlignment;\r\n /** Use Drag Interaction to open popups with nest action buttons */\r\n useDragInteraction?: boolean;\r\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\r\n toolbarOpacitySetting?: ToolbarOpacitySetting;\r\n /** Optional function to call on any item execution */\r\n onItemExecuted?: OnItemExecutedFunc;\r\n /** Optional function to call on any KeyDown events processed by toolbar */\r\n onKeyDown?: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/** Component that displays tool settings as a bar across the top of the content view.\r\n * @public\r\n */\r\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\r\n const expandsTo = props.expandsTo ? props.expandsTo : Direction.Bottom;\r\n const useDragInteraction = !!props.useDragInteraction;\r\n const panelAlignment = props.panelAlignment ? props.panelAlignment : ToolbarPanelAlignment.Start;\r\n const useHeight = (expandsTo === Direction.Right || expandsTo === Direction.Left);\r\n const [isOverflowPanelOpen, setIsOverflowPanelOpen] = React.useState(false);\r\n const [popupPanelCount, setPopupPanelCount] = React.useState(0);\r\n const overflowTitle = React.useRef(UiComponents.translate(\"toolbar.overflow\"));\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n });\r\n const handlePopupPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n // use setImmediate to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag\r\n setImmediate(() => {\r\n // istanbul ignore next\r\n if (!isMounted.current)\r\n return;\r\n setPopupPanelCount((prev) => {\r\n const nextCount = isOpening ? (prev + 1) : (prev - 1);\r\n // eslint-disable-next-line no-console\r\n // console.log(`new popup count = ${nextCount}`);\r\n return nextCount < 0 ? /* istanbul ignore next */ 0 : nextCount;\r\n });\r\n });\r\n }, []);\r\n\r\n const ref = React.useRef<HTMLDivElement>(null);\r\n const width = React.useRef<number | undefined>(undefined);\r\n const availableNodes = React.useMemo<React.ReactNode>(() => {\r\n return props.items.map((item, index) => {\r\n let addGroupSeparator = false;\r\n if (index > 0)\r\n addGroupSeparator = item.groupPriority !== props.items[index - 1].groupPriority;\r\n return (\r\n <ToolbarItemComponent\r\n key={item.id}\r\n item={item}\r\n addGroupSeparator={!!addGroupSeparator}\r\n />\r\n );\r\n });\r\n }, [props.items]);\r\n /* overflowItemKeys - keys of items to show in overflow panel\r\n * handleContainerResize - handler called when container <div> is resized.\r\n * handleOverflowResize - handler called when determining size of overflow indicator/button.\r\n * handleEntryResize - handler called when determining size of each item/button. */\r\n const [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize] = useOverflow(availableNodes, panelAlignment === ToolbarPanelAlignment.End);\r\n // handler called by ResizeObserver\r\n const handleResize = React.useCallback((w: number) => {\r\n width.current = w;\r\n width.current !== undefined && handleContainerResize(width.current);\r\n }, [handleContainerResize]);\r\n const resizeObserverRef = useResizeObserverSingleDimension(handleResize, useHeight);\r\n const handleClick = React.useCallback(() => {\r\n setIsOverflowPanelOpen((prev) => !prev);\r\n }, []);\r\n // istanbul ignore next - NEEDSWORK add complete tests\r\n const handleClose = React.useCallback(() => {\r\n setIsOverflowPanelOpen(false);\r\n }, []);\r\n\r\n const refs = useRefs(ref, resizeObserverRef);\r\n const availableItems = React.Children.toArray(availableNodes);\r\n const displayedItems = availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (!overflowItemKeys || overflowItemKeys.indexOf(key) < 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []);\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n const overflowPanelItems = overflowItemKeys ? availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (overflowItemKeys.indexOf(key) >= 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []) : [];\r\n\r\n const direction = getToolbarDirection(expandsTo);\r\n const overflowExpandsTo = undefined !== props.overflowExpandsTo ? props.overflowExpandsTo : Direction.Right;\r\n const addOverflowButton = React.useCallback((atStart: boolean) => {\r\n const overflowItems = !!atStart ? overflowPanelItems.reverse() : overflowPanelItems;\r\n return (<ToolbarItemContext.Provider\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: handleOverflowResize,\r\n }}\r\n >\r\n <ToolbarOverflowButton\r\n expandsTo={expandsTo}\r\n onClick={handleClick}\r\n onClose={handleClose}\r\n open={overflowItems.length > 0 && isOverflowPanelOpen}\r\n panelNode={\r\n <ToolbarOverflowPanel>\r\n <OverflowItemsContainer>\r\n {overflowItems.map(([key, child]) => {\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: true,\r\n useHeight,\r\n onResize: () => { },\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n </OverflowItemsContainer>\r\n </ToolbarOverflowPanel>\r\n }\r\n title={overflowTitle.current}\r\n />\r\n </ToolbarItemContext.Provider>);\r\n }, [handleClick, handleClose, handleOverflowResize, isOverflowPanelOpen, expandsTo, overflowPanelItems, useHeight]);\r\n\r\n const className = classnames(\r\n \"components-toolbar-overflow-sizer\",\r\n OrthogonalDirectionHelpers.getCssClassName(direction),\r\n props.className);\r\n\r\n const showOverflowAtStart = (direction === OrthogonalDirection.Horizontal) && (panelAlignment === ToolbarPanelAlignment.End);\r\n /* The ItemWrapper is used to wrap the <Item> <ExpandableItem> with a <div> that specifies a ref that the sizing logic uses to determine the\r\n size of the item. */\r\n return (\r\n <ToolbarWithOverflowDirectionContext.Provider value={\r\n {\r\n expandsTo, direction, overflowExpandsTo, panelAlignment, useDragInteraction,\r\n toolbarOpacitySetting: undefined !== props.toolbarOpacitySetting ? props.toolbarOpacitySetting : ToolbarOpacitySetting.Proximity,\r\n overflowDirection: direction === OrthogonalDirection.Horizontal ? OrthogonalDirection.Vertical : OrthogonalDirection.Horizontal,\r\n openPopupCount: popupPanelCount,\r\n onPopupPanelOpenClose: handlePopupPanelOpenClose,\r\n overflowDisplayActive: overflowPanelItems.length > 0 && isOverflowPanelOpen,\r\n onItemExecuted: props.onItemExecuted ? props.onItemExecuted : () => { },\r\n onKeyDown: props.onKeyDown ? props.onKeyDown : /* istanbul ignore next */ (_e: React.KeyboardEvent) => { },\r\n }\r\n }>\r\n {(availableItems.length > 0) &&\r\n <div\r\n className={className}\r\n ref={refs}\r\n style={props.style}\r\n onKeyDown={props.onKeyDown}\r\n role=\"presentation\"\r\n >\r\n <ToolbarItems\r\n className=\"components-items\"\r\n direction={direction}\r\n >\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && showOverflowAtStart && addOverflowButton(true)}\r\n {displayedItems.map(([key, child]) => {\r\n const onEntryResize = handleEntryResize(key);\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: onEntryResize,\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && !showOverflowAtStart && addOverflowButton(false)}\r\n\r\n </ToolbarItems>\r\n </div>\r\n }\r\n </ToolbarWithOverflowDirectionContext.Provider >\r\n );\r\n}\r\n\r\n/** Returns key of a child. Must be used along with React.Children.toArray to preserve the semantics of availableItems.\r\n * @internal\r\n */\r\nfunction getChildKey(child: React.ReactNode, index: number) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child) && child.key !== null) {\r\n return child.key.toString();\r\n }\r\n // istanbul ignore next\r\n return index.toString();\r\n}\r\n\r\n/** Returns a subset of toolbar item entry keys that exceed given width and should be overflowItemKeys.\r\n * @internal\r\n */\r\nfunction determineOverflowItems(size: number, entries: ReadonlyArray<readonly [string, number]>, overflowButtonSize: number, overflowButtonAtStart: boolean): string[] {\r\n let toolbarSize = 0;\r\n const buttonPadding = 2;\r\n if (overflowButtonAtStart && entries.length > 0) {\r\n let i = entries.length - 1;\r\n for (; i >= 0; i--) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n if (i >= 0) {\r\n let j = i + 1;\r\n for (; j < entries.length; j++) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(0, j).map((e) => e[0]);\r\n } else {\r\n return [];\r\n }\r\n } else {\r\n let i = 0;\r\n for (; i < entries.length; i++) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n let j = i;\r\n for (; j > 0; j--) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(j).map((e) => e[0]);\r\n }\r\n}\r\n\r\n/** Hook that returns a list of overflowItemKeys availableItems.\r\n * @internal\r\n */\r\nfunction useOverflow(availableItems: React.ReactNode, overflowButtonAtStart: boolean): [\r\n ReadonlyArray<string> | undefined,\r\n (size: number) => void,\r\n (size: number) => void,\r\n (key: string) => (size: number) => void,\r\n] {\r\n const [overflowItemKeys, setOverflown] = React.useState<ReadonlyArray<string>>();\r\n const itemSizes = React.useRef(new Map<string, number | undefined>());\r\n const size = React.useRef<number | undefined>(undefined);\r\n const overflowButtonSize = React.useRef<number | undefined>(undefined);\r\n\r\n const calculateOverflow = React.useCallback(() => {\r\n const sizes = verifiedMapEntries(itemSizes.current);\r\n if (size.current === undefined ||\r\n sizes === undefined ||\r\n overflowButtonSize.current === undefined) {\r\n setOverflown(undefined);\r\n return;\r\n }\r\n\r\n // Calculate overflow.\r\n const newOverflown = determineOverflowItems(size.current, [...sizes.entries()], overflowButtonSize.current, overflowButtonAtStart);\r\n setOverflown((prevOverflown) => {\r\n return eql(prevOverflown, newOverflown) ? prevOverflown : newOverflown;\r\n });\r\n }, [overflowButtonAtStart]);\r\n\r\n React.useLayoutEffect(() => {\r\n const newEntryWidths = new Map<string, number | undefined>();\r\n const array = React.Children.toArray(availableItems);\r\n for (let i = 0; i < array.length; i++) {\r\n const child = array[i];\r\n const key = getChildKey(child, i);\r\n const lastW = itemSizes.current.get(key);\r\n newEntryWidths.set(key, lastW);\r\n }\r\n itemSizes.current = newEntryWidths;\r\n calculateOverflow();\r\n }, [availableItems, calculateOverflow]);\r\n\r\n const handleContainerResize = React.useCallback((w: number) => {\r\n const calculate = size.current !== w;\r\n size.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleOverflowResize = React.useCallback((w: number) => {\r\n const calculate = overflowButtonSize.current !== w;\r\n overflowButtonSize.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleEntryResize = React.useCallback((key: string) => (w: number) => {\r\n const oldW = itemSizes.current.get(key);\r\n if (oldW !== w) {\r\n itemSizes.current.set(key, w);\r\n calculateOverflow();\r\n }\r\n }, [calculateOverflow]);\r\n\r\n return [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize];\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\nexport interface ToolbarItemContextArgs {\r\n readonly hasOverflow: boolean;\r\n readonly useHeight: boolean;\r\n readonly onResize: (w: number) => void;\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarItemContext = React.createContext<ToolbarItemContextArgs>(null!);\r\n\r\n/** @internal */\r\nexport function useToolItemEntryContext() {\r\n return React.useContext(ToolbarItemContext);\r\n}\r\n\r\nfunction verifiedMapEntries<T>(map: Map<string, T | undefined>) {\r\n for (const [, val] of map) {\r\n // istanbul ignore next during unit testing\r\n if (val === undefined)\r\n return undefined;\r\n }\r\n return map as Map<string, T>;\r\n}\r\n\r\nfunction eql(prev: readonly string[] | undefined, value: readonly string[]) {\r\n if (!prev)\r\n return false;\r\n // istanbul ignore next\r\n if (prev.length !== value.length)\r\n return false;\r\n for (let i = 0; i < prev.length; i++) {\r\n const p = prev[i];\r\n const v = value[i];\r\n // istanbul ignore next\r\n if (p !== v)\r\n return false;\r\n }\r\n return true;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0BAAwB;AACxB,4DAAoC;AACpC,6CAA+B;AAC/B,0DAG+B;AAC/B,kDAAsG;AACtG,iCAA2C;AAC3C,mCAAuC;AACvC,+CAA8E;AAC9E,yCAAmD;AACnD,mDAAuD;AACvD,2CAAwC;AACxC,uDAAoD;AACpD,2DAAwD;AACxD,qDAAq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AC;AAC5F,CAAC;AAWD;;GAEG;AACH,gEAAgE;AACnD,QAAA,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAyB,IAAK,CAAC,CAAC;AAErF,gBAAgB;AAChB,SAAgB,uBAAuB;IACrC,OAAO,KAAK,CAAC,UAAU,CAAC,0BAAkB,CAAC,CAAC;AAC9C,CAAC;AAFD,0DAEC;AAED,SAAS,kBAAkB,CAAI,GAA+B;IAC5D,KAAK,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,EAAE;QACzB,4CAA4C;QAC5C,IAAI,GAAG,KAAK,SAAS;YACnB,OAAO,SAAS,CAAC;KACpB;IACD,OAAO,GAAqB,CAAC;AAC/B,CAAC;AAED,SAAS,GAAG,CAAC,IAAmC,EAAE,KAAwB;IACxE,IAAI,CAAC,IAAI;QACP,OAAO,KAAK,CAAC;IACf,uBAAuB;IACvB,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QAC9B,OAAO,KAAK,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC;YACT,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Toolbar\r\n */\r\n\r\nimport \"./Toolbar.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport {\r\n ActionButton, CommonToolbarItem, ConditionalBooleanValue, ConditionalStringValue, CustomButtonDefinition,\r\n GroupButton, OnItemExecutedFunc, ToolbarItemUtilities,\r\n} from \"@itwin/appui-abstract\";\r\nimport { BadgeUtilities, CommonProps, IconHelper, NoChildrenProps, useRefs } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItem } from \"./Item\";\r\nimport { ToolbarItems } from \"./Items\";\r\nimport { ItemWrapper, useResizeObserverSingleDimension } from \"./ItemWrapper\";\r\nimport { ToolbarOverflowButton } from \"./Overflow\";\r\nimport { ToolbarOverflowPanel } from \"./OverflowPanel\";\r\nimport { PopupItem } from \"./PopupItem\";\r\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\r\nimport { PopupItemWithDrag } from \"./PopupItemWithDrag\";\r\nimport { Direction, DirectionHelpers, OrthogonalDirection, OrthogonalDirectionHelpers } from \"./utilities/Direction\";\r\nimport { UiComponents } from \"../UiComponents\";\r\n\r\n/** Describes the data needed to insert a custom `React` button into an ToolbarWithOverflow.\r\n * @public\r\n */\r\nexport interface CustomToolbarItem extends CustomButtonDefinition {\r\n /** React node that must result in providing a PopupItem @deprecated use panelContentNode */\r\n buttonNode?: React.ReactNode;\r\n /** defines the content to display in popup panel */\r\n panelContentNode?: React.ReactNode;\r\n /** If true the popup panel is mounted once and unmounted when button is unmounted. If false the\r\n * content node is unmounted each time the popup is closed. */\r\n keepContentsLoaded?: boolean;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.\r\n * @public\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarPopupAutoHideContext = React.createContext<boolean>(false);\r\n\r\n/**\r\n * React hook used to retrieve the ToolbarPopupAutoHideContext.\r\n * @public\r\n */\r\nexport function useToolbarPopupAutoHideContext() {\r\n return React.useContext(ToolbarPopupAutoHideContext);\r\n}\r\n\r\n/** Describes toolbar item.\r\n * @public\r\n */\r\nexport type ToolbarItem = ActionButton | GroupButton | CustomToolbarItem;\r\n\r\n/** CustomToolbarItem type guard.\r\n * @internal\r\n */\r\nexport function isCustomToolbarItem(item: ToolbarItem): item is CustomToolbarItem {\r\n return !!(item as CustomToolbarItem).isCustom && ((\"buttonNode\" in item) || (\"panelContentNode\" in item));\r\n}\r\n\r\n/** @internal */\r\nexport const getToolbarDirection = (expandsTo: Direction): OrthogonalDirection => {\r\n const orthogonalDirection = DirectionHelpers.getOrthogonalDirection(expandsTo);\r\n return OrthogonalDirectionHelpers.inverse(orthogonalDirection);\r\n};\r\n\r\n/** Available alignment modes of [[ToolbarWithOverflow]] panels.\r\n * @public\r\n */\r\nexport enum ToolbarPanelAlignment {\r\n Start,\r\n End,\r\n}\r\n\r\n/** Enumeration of Toolbar Opacity setting.\r\n * @public\r\n */\r\nexport enum ToolbarOpacitySetting {\r\n /** Use the default background, box-shadow opacity and backdrop-filter blur */\r\n Defaults,\r\n /** Alter the opacity from transparent to the defaults based on mouse proximity */\r\n Proximity,\r\n /** Use a transparent background, box-shadow opacity and backdrop-filter blur */\r\n Transparent,\r\n}\r\n\r\n/** Helpers for [[ToolbarPanelAlignment]].\r\n * @internal\r\n */\r\nexport class ToolbarPanelAlignmentHelpers {\r\n /** Class name of [[ToolbarPanelAlignment.Start]] */\r\n public static readonly START_CLASS_NAME = \"components-panel-alignment-start\";\r\n /** Class name of [[ToolbarPanelAlignment.End]] */\r\n public static readonly END_CLASS_NAME = \"components-panel-alignment-end\";\r\n\r\n /** @returns Class name of specified [[ToolbarPanelAlignment]] */\r\n public static getCssClassName(panelAlignment: ToolbarPanelAlignment): string {\r\n switch (panelAlignment) {\r\n case ToolbarPanelAlignment.Start:\r\n return ToolbarPanelAlignmentHelpers.START_CLASS_NAME;\r\n case ToolbarPanelAlignment.End:\r\n return ToolbarPanelAlignmentHelpers.END_CLASS_NAME;\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface ToolbarOverflowContextProps {\r\n readonly expandsTo: Direction;\r\n readonly direction: OrthogonalDirection;\r\n readonly overflowExpandsTo: Direction;\r\n readonly overflowDirection: OrthogonalDirection;\r\n readonly panelAlignment: ToolbarPanelAlignment;\r\n readonly useDragInteraction: boolean;\r\n readonly toolbarOpacitySetting: ToolbarOpacitySetting;\r\n readonly openPopupCount: number;\r\n readonly onPopupPanelOpenClose: (isOpening: boolean) => void;\r\n readonly overflowDisplayActive: boolean;\r\n readonly onItemExecuted: OnItemExecutedFunc;\r\n readonly onKeyDown: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar component to provide Direction to child components.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarWithOverflowDirectionContext = React.createContext<ToolbarOverflowContextProps>({\r\n expandsTo: Direction.Bottom,\r\n direction: OrthogonalDirection.Horizontal,\r\n overflowExpandsTo: Direction.Right,\r\n overflowDirection: OrthogonalDirection.Vertical,\r\n panelAlignment: ToolbarPanelAlignment.Start,\r\n useDragInteraction: false,\r\n toolbarOpacitySetting: ToolbarOpacitySetting.Proximity,\r\n openPopupCount: 0,\r\n onPopupPanelOpenClose: /* istanbul ignore next */ (_isOpening: boolean) => { },\r\n overflowDisplayActive: false,\r\n onItemExecuted: /* istanbul ignore next */ (_item: any) => void {},\r\n onKeyDown: /* istanbul ignore next */ (_e: React.KeyboardEvent) => void {},\r\n});\r\n\r\n/** @internal */\r\nexport function CustomItem({ item, addGroupSeparator }: { item: CustomToolbarItem, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const icon = React.useMemo(() => (item.icon &&\r\n IconHelper.getIconReactNode(item.icon, item.internalData)) || /* istanbul ignore next */\r\n <i className=\"icon icon-placeholder\" />, [item.icon, item.internalData]);\r\n const isDisabled = React.useMemo(() => ConditionalBooleanValue.getValue(item.isDisabled), [item.isDisabled]);\r\n const title = React.useMemo(() => /* istanbul ignore next */ ConditionalStringValue.getValue(item.label) ?? item.id, [item.id, item.label]);\r\n const badge = React.useMemo(() => BadgeUtilities.getComponentForBadgeType(item.badgeType), [item.badgeType]);\r\n\r\n if (item.panelContentNode) {\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n icon={icon}\r\n isDisabled={isDisabled}\r\n title={title}\r\n panel={item.panelContentNode}\r\n hideIndicator={useDragInteraction}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n keepContentsMounted={item.keepContentsLoaded}\r\n />;\r\n }\r\n\r\n // istanbul ignore else\r\n if (item.buttonNode)\r\n return <>{item.buttonNode}</>;\r\n\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function GroupPopupItem({ item, addGroupSeparator }: { item: GroupButton, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const panel = React.useMemo(() => <PopupItemsPanel groupItem={item} activateOnPointerUp={false} />, [item]);\r\n if (useDragInteraction) {\r\n return <PopupItemWithDrag\r\n key={item.id}\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n groupItem={item}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n }\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n panel={panel}\r\n badge={badge}\r\n hideIndicator={useDragInteraction}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ActionItem({ item, addGroupSeparator }: { item: ActionButton, addGroupSeparator: boolean }) {\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const { onItemExecuted } = useToolbarWithOverflowDirectionContext();\r\n const onExecute = React.useCallback(() => {\r\n item.execute();\r\n onItemExecuted(item);\r\n }, [item, onItemExecuted]);\r\n\r\n return <ToolbarButtonItem\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n key={item.id}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isActive={item.isActive}\r\n onClick={onExecute}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ToolbarItemComponent({ item, addGroupSeparator }: { item: ToolbarItem, addGroupSeparator: boolean }) {\r\n if (ToolbarItemUtilities.isGroupButton(item)) {\r\n return <GroupPopupItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else if (isCustomToolbarItem(item)) {\r\n return <CustomItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(item)) {\r\n return <ActionItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n }\r\n }\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function useToolbarWithOverflowDirectionContext() {\r\n return React.useContext(ToolbarWithOverflowDirectionContext);\r\n}\r\n\r\nfunction OverflowItemsContainer(p: { children: React.ReactNode }) {\r\n return <>{p.children}</>;\r\n}\r\n\r\nfunction getItemWrapperClass(child: React.ReactNode) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child)) {\r\n if (child.props && child.props.addGroupSeparator)\r\n return \"components-toolbar-button-add-gap-before\";\r\n }\r\n return undefined;\r\n}\r\n\r\n/** Properties of [[ToolbarWithOverflow]] component.\r\n * @public\r\n */\r\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\r\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\r\n expandsTo?: Direction;\r\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\r\n overflowExpandsTo?: Direction;\r\n /** definitions for items of the toolbar. i.e. [[CommonToolbarItem]]. Items are expected to be already sorted by group and item. */\r\n items: CommonToolbarItem[];\r\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\r\n panelAlignment?: ToolbarPanelAlignment;\r\n /** Use Drag Interaction to open popups with nest action buttons */\r\n useDragInteraction?: boolean;\r\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\r\n toolbarOpacitySetting?: ToolbarOpacitySetting;\r\n /** Optional function to call on any item execution */\r\n onItemExecuted?: OnItemExecutedFunc;\r\n /** Optional function to call on any KeyDown events processed by toolbar */\r\n onKeyDown?: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/** Component that displays tool settings as a bar across the top of the content view.\r\n * @public\r\n */\r\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\r\n const expandsTo = props.expandsTo ? props.expandsTo : Direction.Bottom;\r\n const useDragInteraction = !!props.useDragInteraction;\r\n const panelAlignment = props.panelAlignment ? props.panelAlignment : ToolbarPanelAlignment.Start;\r\n const useHeight = (expandsTo === Direction.Right || expandsTo === Direction.Left);\r\n const [isOverflowPanelOpen, setIsOverflowPanelOpen] = React.useState(false);\r\n const [popupPanelCount, setPopupPanelCount] = React.useState(0);\r\n const overflowTitle = React.useRef(UiComponents.translate(\"toolbar.overflow\"));\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n });\r\n const handlePopupPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n // use setImmediate to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag\r\n setImmediate(() => {\r\n // istanbul ignore next\r\n if (!isMounted.current)\r\n return;\r\n setPopupPanelCount((prev) => {\r\n const nextCount = isOpening ? (prev + 1) : (prev - 1);\r\n // eslint-disable-next-line no-console\r\n // console.log(`new popup count = ${nextCount}`);\r\n return nextCount < 0 ? /* istanbul ignore next */ 0 : nextCount;\r\n });\r\n });\r\n }, []);\r\n\r\n const ref = React.useRef<HTMLDivElement>(null);\r\n const width = React.useRef<number | undefined>(undefined);\r\n const availableNodes = React.useMemo<React.ReactNode>(() => {\r\n return props.items.map((item, index) => {\r\n let addGroupSeparator = false;\r\n if (index > 0)\r\n addGroupSeparator = item.groupPriority !== props.items[index - 1].groupPriority;\r\n return (\r\n <ToolbarItemComponent\r\n key={item.id}\r\n item={item}\r\n addGroupSeparator={!!addGroupSeparator}\r\n />\r\n );\r\n });\r\n }, [props.items]);\r\n /* overflowItemKeys - keys of items to show in overflow panel\r\n * handleContainerResize - handler called when container <div> is resized.\r\n * handleOverflowResize - handler called when determining size of overflow indicator/button.\r\n * handleEntryResize - handler called when determining size of each item/button. */\r\n const [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize] = useOverflow(availableNodes, panelAlignment === ToolbarPanelAlignment.End);\r\n // handler called by ResizeObserver\r\n const handleResize = React.useCallback((w: number) => {\r\n width.current = w;\r\n width.current !== undefined && handleContainerResize(width.current);\r\n }, [handleContainerResize]);\r\n const resizeObserverRef = useResizeObserverSingleDimension(handleResize, useHeight);\r\n const handleClick = React.useCallback(() => {\r\n setIsOverflowPanelOpen((prev) => !prev);\r\n }, []);\r\n // istanbul ignore next - NEEDSWORK add complete tests\r\n const handleClose = React.useCallback(() => {\r\n setIsOverflowPanelOpen(false);\r\n }, []);\r\n\r\n const refs = useRefs(ref, resizeObserverRef);\r\n const availableItems = React.Children.toArray(availableNodes);\r\n const displayedItems = availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (!overflowItemKeys || overflowItemKeys.indexOf(key) < 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []);\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n const overflowPanelItems = overflowItemKeys ? availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (overflowItemKeys.indexOf(key) >= 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []) : [];\r\n\r\n const direction = getToolbarDirection(expandsTo);\r\n const overflowExpandsTo = undefined !== props.overflowExpandsTo ? props.overflowExpandsTo : Direction.Right;\r\n const addOverflowButton = React.useCallback((atStart: boolean) => {\r\n const overflowItems = !!atStart ? overflowPanelItems.reverse() : overflowPanelItems;\r\n return (<ToolbarItemContext.Provider\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: handleOverflowResize,\r\n }}\r\n >\r\n <ToolbarOverflowButton\r\n expandsTo={expandsTo}\r\n onClick={handleClick}\r\n onClose={handleClose}\r\n open={overflowItems.length > 0 && isOverflowPanelOpen}\r\n panelNode={\r\n <ToolbarOverflowPanel>\r\n <OverflowItemsContainer>\r\n {overflowItems.map(([key, child]) => {\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: true,\r\n useHeight,\r\n onResize: () => { },\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n </OverflowItemsContainer>\r\n </ToolbarOverflowPanel>\r\n }\r\n title={overflowTitle.current}\r\n />\r\n </ToolbarItemContext.Provider>);\r\n }, [handleClick, handleClose, handleOverflowResize, isOverflowPanelOpen, expandsTo, overflowPanelItems, useHeight]);\r\n\r\n const className = classnames(\r\n \"components-toolbar-overflow-sizer\",\r\n OrthogonalDirectionHelpers.getCssClassName(direction),\r\n props.className);\r\n\r\n const showOverflowAtStart = (direction === OrthogonalDirection.Horizontal) && (panelAlignment === ToolbarPanelAlignment.End);\r\n /* The ItemWrapper is used to wrap the <Item> <ExpandableItem> with a <div> that specifies a ref that the sizing logic uses to determine the\r\n size of the item. */\r\n return (\r\n <ToolbarWithOverflowDirectionContext.Provider value={\r\n {\r\n expandsTo, direction, overflowExpandsTo, panelAlignment, useDragInteraction,\r\n toolbarOpacitySetting: undefined !== props.toolbarOpacitySetting ? props.toolbarOpacitySetting : ToolbarOpacitySetting.Proximity,\r\n overflowDirection: direction === OrthogonalDirection.Horizontal ? OrthogonalDirection.Vertical : OrthogonalDirection.Horizontal,\r\n openPopupCount: popupPanelCount,\r\n onPopupPanelOpenClose: handlePopupPanelOpenClose,\r\n overflowDisplayActive: overflowPanelItems.length > 0 && isOverflowPanelOpen,\r\n onItemExecuted: props.onItemExecuted ? props.onItemExecuted : () => { },\r\n onKeyDown: props.onKeyDown ? props.onKeyDown : /* istanbul ignore next */ (_e: React.KeyboardEvent) => { },\r\n }\r\n }>\r\n {(availableItems.length > 0) &&\r\n <div\r\n className={className}\r\n ref={refs}\r\n style={props.style}\r\n onKeyDown={props.onKeyDown}\r\n role=\"presentation\"\r\n >\r\n <ToolbarItems\r\n className=\"components-items\"\r\n direction={direction}\r\n >\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && showOverflowAtStart && addOverflowButton(true)}\r\n {displayedItems.map(([key, child]) => {\r\n const onEntryResize = handleEntryResize(key);\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: onEntryResize,\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && !showOverflowAtStart && addOverflowButton(false)}\r\n\r\n </ToolbarItems>\r\n </div>\r\n }\r\n </ToolbarWithOverflowDirectionContext.Provider >\r\n );\r\n}\r\n\r\n/** Returns key of a child. Must be used along with React.Children.toArray to preserve the semantics of availableItems.\r\n * @internal\r\n */\r\nfunction getChildKey(child: React.ReactNode, index: number) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child) && child.key !== null) {\r\n return child.key.toString();\r\n }\r\n // istanbul ignore next\r\n return index.toString();\r\n}\r\n\r\n/** Returns a subset of toolbar item entry keys that exceed given width and should be overflowItemKeys.\r\n * @internal\r\n */\r\nfunction determineOverflowItems(size: number, entries: ReadonlyArray<readonly [string, number]>, overflowButtonSize: number, overflowButtonAtStart: boolean): string[] {\r\n let toolbarSize = 0;\r\n const buttonPadding = 2;\r\n if (overflowButtonAtStart && entries.length > 0) {\r\n let i = entries.length - 1;\r\n for (; i >= 0; i--) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n if (i >= 0) {\r\n let j = i + 1;\r\n for (; j < entries.length; j++) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(0, j).map((e) => e[0]);\r\n } else {\r\n return [];\r\n }\r\n } else {\r\n let i = 0;\r\n for (; i < entries.length; i++) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n let j = i;\r\n for (; j > 0; j--) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(j).map((e) => e[0]);\r\n }\r\n}\r\n\r\n/** Hook that returns a list of overflowItemKeys availableItems.\r\n * @internal\r\n */\r\nfunction useOverflow(availableItems: React.ReactNode, overflowButtonAtStart: boolean): [\r\n ReadonlyArray<string> | undefined,\r\n (size: number) => void,\r\n (size: number) => void,\r\n (key: string) => (size: number) => void,\r\n] {\r\n const [overflowItemKeys, setOverflown] = React.useState<ReadonlyArray<string>>();\r\n const itemSizes = React.useRef(new Map<string, number | undefined>());\r\n const size = React.useRef<number | undefined>(undefined);\r\n const overflowButtonSize = React.useRef<number | undefined>(undefined);\r\n\r\n const calculateOverflow = React.useCallback(() => {\r\n const sizes = verifiedMapEntries(itemSizes.current);\r\n if (size.current === undefined ||\r\n sizes === undefined ||\r\n overflowButtonSize.current === undefined) {\r\n setOverflown(undefined);\r\n return;\r\n }\r\n\r\n // Calculate overflow.\r\n const newOverflown = determineOverflowItems(size.current, [...sizes.entries()], overflowButtonSize.current, overflowButtonAtStart);\r\n setOverflown((prevOverflown) => {\r\n return eql(prevOverflown, newOverflown) ? prevOverflown : newOverflown;\r\n });\r\n }, [overflowButtonAtStart]);\r\n\r\n React.useLayoutEffect(() => {\r\n const newEntryWidths = new Map<string, number | undefined>();\r\n const array = React.Children.toArray(availableItems);\r\n for (let i = 0; i < array.length; i++) {\r\n const child = array[i];\r\n const key = getChildKey(child, i);\r\n const lastW = itemSizes.current.get(key);\r\n newEntryWidths.set(key, lastW);\r\n }\r\n itemSizes.current = newEntryWidths;\r\n calculateOverflow();\r\n }, [availableItems, calculateOverflow]);\r\n\r\n const handleContainerResize = React.useCallback((w: number) => {\r\n const calculate = size.current !== w;\r\n size.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleOverflowResize = React.useCallback((w: number) => {\r\n const calculate = overflowButtonSize.current !== w;\r\n overflowButtonSize.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleEntryResize = React.useCallback((key: string) => (w: number) => {\r\n const oldW = itemSizes.current.get(key);\r\n if (oldW !== w) {\r\n itemSizes.current.set(key, w);\r\n calculateOverflow();\r\n }\r\n }, [calculateOverflow]);\r\n\r\n return [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize];\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\nexport interface ToolbarItemContextArgs {\r\n readonly hasOverflow: boolean;\r\n readonly useHeight: boolean;\r\n readonly onResize: (w: number) => void;\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarItemContext = React.createContext<ToolbarItemContextArgs>(null!);\r\n\r\n/** @internal */\r\nexport function useToolItemEntryContext() {\r\n return React.useContext(ToolbarItemContext);\r\n}\r\n\r\nfunction verifiedMapEntries<T>(map: Map<string, T | undefined>) {\r\n for (const [, val] of map) {\r\n // istanbul ignore next during unit testing\r\n if (val === undefined)\r\n return undefined;\r\n }\r\n return map as Map<string, T>;\r\n}\r\n\r\nfunction eql(prev: readonly string[] | undefined, value: readonly string[]) {\r\n if (!prev)\r\n return false;\r\n // istanbul ignore next\r\n if (prev.length !== value.length)\r\n return false;\r\n for (let i = 0; i < prev.length; i++) {\r\n const p = prev[i];\r\n const v = value[i];\r\n // istanbul ignore next\r\n if (p !== v)\r\n return false;\r\n }\r\n return true;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overflow.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Overflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,iBAAiB,CAAC;AAEzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAsB,MAAM,mBAAmB,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,WAAW,EAAE,eAAe;IAC9E,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sCAAsC;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8BAA8B;IAC9B,SAAS,EAAE,SAAS,CAAC;IACrB,qDAAqD;IACrD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"Overflow.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Overflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,iBAAiB,CAAC;AAEzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAsB,MAAM,mBAAmB,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,WAAW,EAAE,eAAe;IAC9E,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sCAAsC;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8BAA8B;IAC9B,SAAS,EAAE,SAAS,CAAC;IACrB,qDAAqD;IACrD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,eA+CtE;AAED,gBAAgB;AAChB,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAWxF"}
|
|
@@ -9,7 +9,7 @@ import "./Overflow.scss";
|
|
|
9
9
|
import classnames from "classnames";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { Popup, useRefState } from "@itwin/core-react";
|
|
12
|
-
import { useToolItemEntryContext } from "./ToolbarWithOverflow";
|
|
12
|
+
import { useToolbarPopupAutoHideContext, useToolItemEntryContext } from "./ToolbarWithOverflow";
|
|
13
13
|
import { useResizeObserverSingleDimension } from "./ItemWrapper";
|
|
14
14
|
import { Direction } from "./utilities/Direction";
|
|
15
15
|
import { RelativePosition } from "@itwin/appui-abstract";
|
|
@@ -20,13 +20,15 @@ export function ToolbarOverflowButton(props) {
|
|
|
20
20
|
const { onResize, useHeight } = useToolItemEntryContext();
|
|
21
21
|
const [targetRef, target] = useRefState();
|
|
22
22
|
const ref = useResizeObserverSingleDimension(onResize, useHeight);
|
|
23
|
+
const isHidden = useToolbarPopupAutoHideContext();
|
|
24
|
+
const popupClassName = classnames("components-toolbar-overflow_popup", isHidden && "nz-hidden");
|
|
23
25
|
const className = classnames("components-toolbar-item-container", "components-toolbar-overflow-button", props.className);
|
|
24
26
|
const buttonClassName = classnames("components-toolbar-button-item", "components-ellipsis-icon");
|
|
25
27
|
return (React.createElement("div", { className: className, ref: targetRef },
|
|
26
28
|
React.createElement("button", { ref: ref, onClick: props.onClick, className: buttonClassName, style: props.style, title: props.title },
|
|
27
29
|
React.createElement("div", { className: "components-icon" },
|
|
28
30
|
React.createElement("div", { className: "components-ellipsis" }))),
|
|
29
|
-
React.createElement(Popup, { className:
|
|
31
|
+
React.createElement(Popup, { className: popupClassName, offset: 0, showShadow: false, isOpen: props.open, onClose: props.onClose, position: toToolbarOverflowRelativePosition(props.expandsTo), target: target }, props.panelNode)));
|
|
30
32
|
}
|
|
31
33
|
/** @internal */
|
|
32
34
|
export function toToolbarOverflowRelativePosition(expandsTo) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Overflow.tsx"],"names":[],"mappings":"AAAA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AAC,SAAS,CAChB,CAAC;IACF,MAAM,eAAe,GAAG,UAAU,CAChC,gCAAgC,EAChC,0BAA0B,CAC3B,CAAC;IACF,OAAO,CACL,6BACE,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,SAAS;QAEd,gCACE,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,KAAK;YAElB,6BAAK,SAAS,EAAC,iBAAiB;gBAC9B,6BAAK,SAAS,EAAC,qBAAqB,GAAG,CACnC,CACC;QACT,oBAAC,KAAK,IACJ,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,KAAK,EACjB,MAAM,EAAE,KAAK,CAAC,IAAI,EAClB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,iCAAiC,CAAC,KAAK,CAAC,SAAS,CAAC,EAC5D,MAAM,EAAE,MAAM,IAEb,KAAK,CAAC,SAAS,CACV,CACJ,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,iCAAiC,CAAC,SAAoB;IACpE,QAAQ,SAAS,EAAE;QACjB,KAAK,SAAS,CAAC,MAAM;YACnB,OAAO,gBAAgB,CAAC,MAAM,CAAC;QACjC,KAAK,SAAS,CAAC,IAAI;YACjB,OAAO,gBAAgB,CAAC,IAAI,CAAC;QAC/B,KAAK,SAAS,CAAC,KAAK;YAClB,OAAO,gBAAgB,CAAC,KAAK,CAAC;QAChC,KAAK,SAAS,CAAC,GAAG;YAChB,OAAO,gBAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ToolSettings\r\n */\r\n\r\nimport \"./Overflow.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps, NoChildrenProps, Popup, useRefState } from \"@itwin/core-react\";\r\nimport { useToolbarPopupAutoHideContext, useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { useResizeObserverSingleDimension } from \"./ItemWrapper\";\r\nimport { Direction } from \"./utilities/Direction\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\n\r\n/** Properties of [[ToolbarOverflowButton]] component.\r\n * @internal\r\n */\r\nexport interface ToolbarOverflowButtonProps extends CommonProps, NoChildrenProps {\r\n /** Function called when button is clicked. */\r\n onClick?: () => void;\r\n /** Function called when panel is closed. */\r\n onClose?: () => void;\r\n /** Describes if the panel is open. */\r\n open?: boolean;\r\n /** Panel expand direction. */\r\n expandsTo: Direction;\r\n /** Panel element containing the overflown buttons */\r\n panelNode?: React.ReactNode;\r\n /** Title for the item. */\r\n title?: string;\r\n}\r\n\r\n/** Button to toggle display of overflown tools.\r\n * @internal\r\n */\r\nexport function ToolbarOverflowButton(props: ToolbarOverflowButtonProps) {\r\n const { onResize, useHeight } = useToolItemEntryContext();\r\n const [targetRef, target] = useRefState<HTMLDivElement>();\r\n const ref = useResizeObserverSingleDimension<HTMLButtonElement>(onResize, useHeight);\r\n const isHidden = useToolbarPopupAutoHideContext();\r\n const popupClassName = classnames(\r\n \"components-toolbar-overflow_popup\",\r\n isHidden && \"nz-hidden\");\r\n\r\n const className = classnames(\r\n \"components-toolbar-item-container\",\r\n \"components-toolbar-overflow-button\",\r\n props.className,\r\n );\r\n const buttonClassName = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-ellipsis-icon\",\r\n );\r\n return (\r\n <div\r\n className={className}\r\n ref={targetRef}\r\n >\r\n <button\r\n ref={ref}\r\n onClick={props.onClick}\r\n className={buttonClassName}\r\n style={props.style}\r\n title={props.title}\r\n >\r\n <div className=\"components-icon\">\r\n <div className=\"components-ellipsis\" />\r\n </div>\r\n </button>\r\n <Popup\r\n className={popupClassName}\r\n offset={0}\r\n showShadow={false}\r\n isOpen={props.open}\r\n onClose={props.onClose}\r\n position={toToolbarOverflowRelativePosition(props.expandsTo)}\r\n target={target}\r\n >\r\n {props.panelNode}\r\n </Popup>\r\n </div>\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport function toToolbarOverflowRelativePosition(expandsTo: Direction): RelativePosition {\r\n switch (expandsTo) {\r\n case Direction.Bottom:\r\n return RelativePosition.Bottom;\r\n case Direction.Left:\r\n return RelativePosition.Left;\r\n case Direction.Right:\r\n return RelativePosition.Right;\r\n case Direction.Top:\r\n return RelativePosition.Top;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupItem.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItem.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAIhD,cAAc;AACd,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;IAChC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,YAAY,KAAK,IAAI,CAAC;CAC/D;AAED;;;GAGG;AAEH,eAAO,MAAM,mBAAmB,yCAK9B,CAAC;AAEH;;;GAGG;AACH,wBAAgB,sBAAsB,6BAErC;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,sBAAsB;IAC5D,wEAAwE;IACxE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;kEAC8D;IAC9D,mB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ED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,eAyE9C;AAED,gBAAgB;AAChB,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,gBAAgB;AAChB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAYxD"}
|
|
@@ -9,7 +9,7 @@ import "./PopupItem.scss";
|
|
|
9
9
|
import classnames from "classnames";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { Popup, useRefState } from "@itwin/core-react";
|
|
12
|
-
import { useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from "./ToolbarWithOverflow";
|
|
12
|
+
import { useToolbarPopupAutoHideContext, useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from "./ToolbarWithOverflow";
|
|
13
13
|
import { toToolbarPopupRelativePosition } from "./PopupItemWithDrag";
|
|
14
14
|
/**
|
|
15
15
|
* Context used by Toolbar items in popups to close the popup panel.
|
|
@@ -71,6 +71,8 @@ export function PopupItem(props) {
|
|
|
71
71
|
}
|
|
72
72
|
/** @internal */
|
|
73
73
|
export function PopupItemPopup(props) {
|
|
74
|
-
|
|
74
|
+
const isHidden = useToolbarPopupAutoHideContext();
|
|
75
|
+
const className = classnames("components-toolbar-popupItem_popupItemPopup", isHidden && "nz-hidden");
|
|
76
|
+
return React.createElement(Popup, { className: className, offset: 0, showShadow: false, ...props });
|
|
75
77
|
}
|
|
76
78
|
//# sourceMappingURL=PopupItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupItem.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItem.tsx"],"names":[],"mappings":"A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E,CAAC,EACT,UAAU,EAAE,KAAK,KACb,KAAK,GACT,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Toolbar\r\n */\r\n\r\nimport \"./PopupItem.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ActionButton, RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { Popup, useRefState } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItemProps } from \"./Item\";\r\nimport { useToolbarPopupAutoHideContext, useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { toToolbarPopupRelativePosition } from \"./PopupItemWithDrag\";\r\n\r\n/** @public */\r\nexport interface ToolbarPopupContextProps {\r\n readonly closePanel: () => void;\r\n readonly setSelectedItem?: (buttonItem: ActionButton) => void;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar items in popups to close the popup panel.\r\n * @public\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarPopupContext = React.createContext<ToolbarPopupContextProps>({\r\n /** function used to close popup panel */\r\n closePanel: /* istanbul ignore next */ () => { },\r\n /** if popup panel is a GroupButton then this is call to set the selected action item within the panel */\r\n setSelectedItem: /* istanbul ignore next */ (_buttonItem: ActionButton) => { },\r\n});\r\n\r\n/**\r\n * React hook used to retrieve the ToolbarPopupContext.\r\n * @public\r\n */\r\nexport function useToolbarPopupContext() {\r\n return React.useContext(ToolbarPopupContext);\r\n}\r\n\r\n/** Properties of [[PopupItem]] component.\r\n * @public\r\n */\r\nexport interface PopupItemProps extends ToolbarButtonItemProps {\r\n /** Describes if expandable item triangle indicator should be hidden. */\r\n hideIndicator?: boolean;\r\n /** Panel of the toolbar. */\r\n panel?: React.ReactNode;\r\n /** If true the popup panel is mounted once and unmounted when button is unmounted. If false the\r\n * content node is unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** Popup toolbar item that displays a panel\r\n * @public\r\n */\r\nexport function PopupItem(props: PopupItemProps) {\r\n const [isPanelShown, setPanelShown] = React.useState(false);\r\n const { expandsTo, overflowExpandsTo, panelAlignment, onPopupPanelOpenClose } = useToolbarWithOverflowDirectionContext();\r\n const processPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n setPanelShown((prev) => {\r\n // istanbul ignore else\r\n if (prev !== isOpening)\r\n onPopupPanelOpenClose(isOpening);\r\n return isOpening;\r\n });\r\n }, [setPanelShown, onPopupPanelOpenClose]);\r\n\r\n // handle open and closing overflow panel\r\n const onButtonClick = React.useCallback(() => {\r\n processPanelOpenClose(!isPanelShown);\r\n // istanbul ignore next\r\n if (props.onClick)\r\n props.onClick();\r\n }, [props, isPanelShown, processPanelOpenClose]);\r\n const className = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-toolbar-expandable-button\",\r\n props.isDisabled && \"components-disabled\",\r\n props.className);\r\n\r\n const [targetRef, target] = useRefState<HTMLButtonElement>();\r\n // istanbul ignore next\r\n const handleClose = React.useCallback(() => {\r\n processPanelOpenClose(false);\r\n }, [processPanelOpenClose]);\r\n const { hasOverflow } = useToolItemEntryContext();\r\n const expandsToDirection = hasOverflow ? overflowExpandsTo : expandsTo;\r\n\r\n const { hideIndicator, panel } = props;\r\n return (\r\n <ToolbarPopupContext.Provider value={{\r\n closePanel: () => processPanelOpenClose(false),\r\n }}>\r\n <button\r\n data-item-id={props.itemId}\r\n data-item-type=\"tool-button-popup\"\r\n data-item-group-priority={props.groupPriority}\r\n data-item-priority={props.itemPriority}\r\n data-item-providerid={props.providerId}\r\n ref={targetRef}\r\n disabled={props.isDisabled} // this is needed to prevent focusing/keyboard access to disabled buttons\r\n onClick={onButtonClick}\r\n onKeyDown={props.onKeyDown}\r\n className={className}\r\n style={props.style}\r\n title={props.title}\r\n >\r\n <div className=\"components-icon\">\r\n {props.icon}\r\n </div>\r\n {props.badge &&\r\n <div className=\"components-badge\">\r\n {props.badge}\r\n </div>\r\n }\r\n {hideIndicator ? /* istanbul ignore next */ undefined : <div className=\"components-triangle\" />}\r\n </button>\r\n <PopupItemPopup\r\n isOpen={isPanelShown}\r\n onClose={handleClose}\r\n position={toToolbarPopupRelativePosition(expandsToDirection, panelAlignment)}\r\n target={target}\r\n keepContentsMounted={props.keepContentsMounted}\r\n >\r\n {panel}\r\n </PopupItemPopup>\r\n </ToolbarPopupContext.Provider>\r\n );\r\n}\r\n\r\n/** @internal */\r\ninterface PopupItemPopupProps {\r\n children?: React.ReactNode;\r\n isOpen?: boolean;\r\n onClose(): void;\r\n position: RelativePosition;\r\n target?: HTMLElement;\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport function PopupItemPopup(props: PopupItemPopupProps) {\r\n const isHidden = useToolbarPopupAutoHideContext();\r\n const className = classnames(\r\n \"components-toolbar-popupItem_popupItemPopup\",\r\n isHidden && \"nz-hidden\");\r\n\r\n return <Popup\r\n className={className}\r\n offset={0}\r\n showShadow={false}\r\n {...props}\r\n />;\r\n}\r\n"]}
|
|
@@ -29,7 +29,11 @@
|
|
|
29
29
|
filter: $arrow-shadow;
|
|
30
30
|
pointer-events: none;
|
|
31
31
|
|
|
32
|
-
@include triangle-bottom-right(
|
|
32
|
+
@include triangle-bottom-right(
|
|
33
|
+
$width: $triangle-width,
|
|
34
|
+
$height: $triangle-height,
|
|
35
|
+
$color: $buic-icon-color
|
|
36
|
+
);
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
&:active>.components-triangle {
|
|
@@ -73,4 +77,11 @@
|
|
|
73
77
|
border-width: 1px;
|
|
74
78
|
border-style: solid;
|
|
75
79
|
border-radius: 3px;
|
|
76
|
-
|
|
80
|
+
|
|
81
|
+
transition: visibility 0.5s ease, opacity 0.5s ease;
|
|
82
|
+
|
|
83
|
+
&.nz-hidden {
|
|
84
|
+
opacity: 0;
|
|
85
|
+
visibility: hidden;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -18,6 +18,16 @@ export interface CustomToolbarItem extends CustomButtonDefinition {
|
|
|
18
18
|
* content node is unmounted each time the popup is closed. */
|
|
19
19
|
keepContentsLoaded?: boolean;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export declare const ToolbarPopupAutoHideContext: React.Context<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* React hook used to retrieve the ToolbarPopupAutoHideContext.
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export declare function useToolbarPopupAutoHideContext(): boolean;
|
|
21
31
|
/** Describes toolbar item.
|
|
22
32
|
* @public
|
|
23
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarWithOverflow.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AAExB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,YAAY,EAAE,iBAAiB,EAAmD,sBAAsB,EACxG,WAAW,EAAE,kBAAkB,EAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAkB,WAAW,EAAc,eAAe,EAAW,MAAM,mBAAmB,CAAC;AAStG,OAAO,EAAE,SAAS,EAAoB,mBAAmB,EAA8B,MAAM,uBAAuB,CAAC;AAGrH;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,sBAAsB;IAC/D,4FAA4F;IAC5F,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,oDAAoD;IACpD,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC;kEAC8D;IAC9D,kBAAkB,CAAC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AAoF;IACpF,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,sDAAsD;IACtD,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,2EAA2E;IAC3E,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;CAC9C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,eAoLlE;AAqID;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;GAEG;AAEH,eAAO,MAAM,kBAAkB,uCAAqD,CAAC;AAErF,gBAAgB;AAChB,wBAAgB,uBAAuB,2BAEtC"}
|
|
@@ -20,6 +20,19 @@ import { PopupItemsPanel } from "./PopupItemsPanel";
|
|
|
20
20
|
import { PopupItemWithDrag } from "./PopupItemWithDrag";
|
|
21
21
|
import { Direction, DirectionHelpers, OrthogonalDirection, OrthogonalDirectionHelpers } from "./utilities/Direction";
|
|
22
22
|
import { UiComponents } from "../UiComponents";
|
|
23
|
+
/**
|
|
24
|
+
* Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
28
|
+
export const ToolbarPopupAutoHideContext = React.createContext(false);
|
|
29
|
+
/**
|
|
30
|
+
* React hook used to retrieve the ToolbarPopupAutoHideContext.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export function useToolbarPopupAutoHideContext() {
|
|
34
|
+
return React.useContext(ToolbarPopupAutoHideContext);
|
|
35
|
+
}
|
|
23
36
|
/** CustomToolbarItem type guard.
|
|
24
37
|
* @internal
|
|
25
38
|
*/
|
|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OAAO,KAAK,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC;YACT,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Toolbar\r\n */\r\n\r\nimport \"./Toolbar.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport {\r\n ActionButton, CommonToolbarItem, ConditionalBooleanValue, ConditionalStringValue, CustomButtonDefinition,\r\n GroupButton, OnItemExecutedFunc, ToolbarItemUtilities,\r\n} from \"@itwin/appui-abstract\";\r\nimport { BadgeUtilities, CommonProps, IconHelper, NoChildrenProps, useRefs } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItem } from \"./Item\";\r\nimport { ToolbarItems } from \"./Items\";\r\nimport { ItemWrapper, useResizeObserverSingleDimension } from \"./ItemWrapper\";\r\nimport { ToolbarOverflowButton } from \"./Overflow\";\r\nimport { ToolbarOverflowPanel } from \"./OverflowPanel\";\r\nimport { PopupItem } from \"./PopupItem\";\r\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\r\nimport { PopupItemWithDrag } from \"./PopupItemWithDrag\";\r\nimport { Direction, DirectionHelpers, OrthogonalDirection, OrthogonalDirectionHelpers } from \"./utilities/Direction\";\r\nimport { UiComponents } from \"../UiComponents\";\r\n\r\n/** Describes the data needed to insert a custom `React` button into an ToolbarWithOverflow.\r\n * @public\r\n */\r\nexport interface CustomToolbarItem extends CustomButtonDefinition {\r\n /** React node that must result in providing a PopupItem @deprecated use panelContentNode */\r\n buttonNode?: React.ReactNode;\r\n /** defines the content to display in popup panel */\r\n panelContentNode?: React.ReactNode;\r\n /** If true the popup panel is mounted once and unmounted when button is unmounted. If false the\r\n * content node is unmounted each time the popup is closed. */\r\n keepContentsLoaded?: boolean;\r\n}\r\n\r\n/** Describes toolbar item.\r\n * @public\r\n */\r\nexport type ToolbarItem = ActionButton | GroupButton | CustomToolbarItem;\r\n\r\n/** CustomToolbarItem type guard.\r\n * @internal\r\n */\r\nexport function isCustomToolbarItem(item: ToolbarItem): item is CustomToolbarItem {\r\n return !!(item as CustomToolbarItem).isCustom && ((\"buttonNode\" in item) || (\"panelContentNode\" in item));\r\n}\r\n\r\n/** @internal */\r\nexport const getToolbarDirection = (expandsTo: Direction): OrthogonalDirection => {\r\n const orthogonalDirection = DirectionHelpers.getOrthogonalDirection(expandsTo);\r\n return OrthogonalDirectionHelpers.inverse(orthogonalDirection);\r\n};\r\n\r\n/** Available alignment modes of [[ToolbarWithOverflow]] panels.\r\n * @public\r\n */\r\nexport enum ToolbarPanelAlignment {\r\n Start,\r\n End,\r\n}\r\n\r\n/** Enumeration of Toolbar Opacity setting.\r\n * @public\r\n */\r\nexport enum ToolbarOpacitySetting {\r\n /** Use the default background, box-shadow opacity and backdrop-filter blur */\r\n Defaults,\r\n /** Alter the opacity from transparent to the defaults based on mouse proximity */\r\n Proximity,\r\n /** Use a transparent background, box-shadow opacity and backdrop-filter blur */\r\n Transparent,\r\n}\r\n\r\n/** Helpers for [[ToolbarPanelAlignment]].\r\n * @internal\r\n */\r\nexport class ToolbarPanelAlignmentHelpers {\r\n /** Class name of [[ToolbarPanelAlignment.Start]] */\r\n public static readonly START_CLASS_NAME = \"components-panel-alignment-start\";\r\n /** Class name of [[ToolbarPanelAlignment.End]] */\r\n public static readonly END_CLASS_NAME = \"components-panel-alignment-end\";\r\n\r\n /** @returns Class name of specified [[ToolbarPanelAlignment]] */\r\n public static getCssClassName(panelAlignment: ToolbarPanelAlignment): string {\r\n switch (panelAlignment) {\r\n case ToolbarPanelAlignment.Start:\r\n return ToolbarPanelAlignmentHelpers.START_CLASS_NAME;\r\n case ToolbarPanelAlignment.End:\r\n return ToolbarPanelAlignmentHelpers.END_CLASS_NAME;\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface ToolbarOverflowContextProps {\r\n readonly expandsTo: Direction;\r\n readonly direction: OrthogonalDirection;\r\n readonly overflowExpandsTo: Direction;\r\n readonly overflowDirection: OrthogonalDirection;\r\n readonly panelAlignment: ToolbarPanelAlignment;\r\n readonly useDragInteraction: boolean;\r\n readonly toolbarOpacitySetting: ToolbarOpacitySetting;\r\n readonly openPopupCount: number;\r\n readonly onPopupPanelOpenClose: (isOpening: boolean) => void;\r\n readonly overflowDisplayActive: boolean;\r\n readonly onItemExecuted: OnItemExecutedFunc;\r\n readonly onKeyDown: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar component to provide Direction to child components.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarWithOverflowDirectionContext = React.createContext<ToolbarOverflowContextProps>({\r\n expandsTo: Direction.Bottom,\r\n direction: OrthogonalDirection.Horizontal,\r\n overflowExpandsTo: Direction.Right,\r\n overflowDirection: OrthogonalDirection.Vertical,\r\n panelAlignment: ToolbarPanelAlignment.Start,\r\n useDragInteraction: false,\r\n toolbarOpacitySetting: ToolbarOpacitySetting.Proximity,\r\n openPopupCount: 0,\r\n onPopupPanelOpenClose: /* istanbul ignore next */ (_isOpening: boolean) => { },\r\n overflowDisplayActive: false,\r\n onItemExecuted: /* istanbul ignore next */ (_item: any) => void {},\r\n onKeyDown: /* istanbul ignore next */ (_e: React.KeyboardEvent) => void {},\r\n});\r\n\r\n/** @internal */\r\nexport function CustomItem({ item, addGroupSeparator }: { item: CustomToolbarItem, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const icon = React.useMemo(() => (item.icon &&\r\n IconHelper.getIconReactNode(item.icon, item.internalData)) || /* istanbul ignore next */\r\n <i className=\"icon icon-placeholder\" />, [item.icon, item.internalData]);\r\n const isDisabled = React.useMemo(() => ConditionalBooleanValue.getValue(item.isDisabled), [item.isDisabled]);\r\n const title = React.useMemo(() => /* istanbul ignore next */ ConditionalStringValue.getValue(item.label) ?? item.id, [item.id, item.label]);\r\n const badge = React.useMemo(() => BadgeUtilities.getComponentForBadgeType(item.badgeType), [item.badgeType]);\r\n\r\n if (item.panelContentNode) {\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n icon={icon}\r\n isDisabled={isDisabled}\r\n title={title}\r\n panel={item.panelContentNode}\r\n hideIndicator={useDragInteraction}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n keepContentsMounted={item.keepContentsLoaded}\r\n />;\r\n }\r\n\r\n // istanbul ignore else\r\n if (item.buttonNode)\r\n return <>{item.buttonNode}</>;\r\n\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function GroupPopupItem({ item, addGroupSeparator }: { item: GroupButton, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const panel = React.useMemo(() => <PopupItemsPanel groupItem={item} activateOnPointerUp={false} />, [item]);\r\n if (useDragInteraction) {\r\n return <PopupItemWithDrag\r\n key={item.id}\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n groupItem={item}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n }\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n panel={panel}\r\n badge={badge}\r\n hideIndicator={useDragInteraction}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ActionItem({ item, addGroupSeparator }: { item: ActionButton, addGroupSeparator: boolean }) {\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const { onItemExecuted } = useToolbarWithOverflowDirectionContext();\r\n const onExecute = React.useCallback(() => {\r\n item.execute();\r\n onItemExecuted(item);\r\n }, [item, onItemExecuted]);\r\n\r\n return <ToolbarButtonItem\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n key={item.id}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isActive={item.isActive}\r\n onClick={onExecute}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ToolbarItemComponent({ item, addGroupSeparator }: { item: ToolbarItem, addGroupSeparator: boolean }) {\r\n if (ToolbarItemUtilities.isGroupButton(item)) {\r\n return <GroupPopupItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else if (isCustomToolbarItem(item)) {\r\n return <CustomItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(item)) {\r\n return <ActionItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n }\r\n }\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function useToolbarWithOverflowDirectionContext() {\r\n return React.useContext(ToolbarWithOverflowDirectionContext);\r\n}\r\n\r\nfunction OverflowItemsContainer(p: { children: React.ReactNode }) {\r\n return <>{p.children}</>;\r\n}\r\n\r\nfunction getItemWrapperClass(child: React.ReactNode) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child)) {\r\n if (child.props && child.props.addGroupSeparator)\r\n return \"components-toolbar-button-add-gap-before\";\r\n }\r\n return undefined;\r\n}\r\n\r\n/** Properties of [[ToolbarWithOverflow]] component.\r\n * @public\r\n */\r\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\r\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\r\n expandsTo?: Direction;\r\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\r\n overflowExpandsTo?: Direction;\r\n /** definitions for items of the toolbar. i.e. [[CommonToolbarItem]]. Items are expected to be already sorted by group and item. */\r\n items: CommonToolbarItem[];\r\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\r\n panelAlignment?: ToolbarPanelAlignment;\r\n /** Use Drag Interaction to open popups with nest action buttons */\r\n useDragInteraction?: boolean;\r\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\r\n toolbarOpacitySetting?: ToolbarOpacitySetting;\r\n /** Optional function to call on any item execution */\r\n onItemExecuted?: OnItemExecutedFunc;\r\n /** Optional function to call on any KeyDown events processed by toolbar */\r\n onKeyDown?: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/** Component that displays tool settings as a bar across the top of the content view.\r\n * @public\r\n */\r\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\r\n const expandsTo = props.expandsTo ? props.expandsTo : Direction.Bottom;\r\n const useDragInteraction = !!props.useDragInteraction;\r\n const panelAlignment = props.panelAlignment ? props.panelAlignment : ToolbarPanelAlignment.Start;\r\n const useHeight = (expandsTo === Direction.Right || expandsTo === Direction.Left);\r\n const [isOverflowPanelOpen, setIsOverflowPanelOpen] = React.useState(false);\r\n const [popupPanelCount, setPopupPanelCount] = React.useState(0);\r\n const overflowTitle = React.useRef(UiComponents.translate(\"toolbar.overflow\"));\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n });\r\n const handlePopupPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n // use setImmediate to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag\r\n setImmediate(() => {\r\n // istanbul ignore next\r\n if (!isMounted.current)\r\n return;\r\n setPopupPanelCount((prev) => {\r\n const nextCount = isOpening ? (prev + 1) : (prev - 1);\r\n // eslint-disable-next-line no-console\r\n // console.log(`new popup count = ${nextCount}`);\r\n return nextCount < 0 ? /* istanbul ignore next */ 0 : nextCount;\r\n });\r\n });\r\n }, []);\r\n\r\n const ref = React.useRef<HTMLDivElement>(null);\r\n const width = React.useRef<number | undefined>(undefined);\r\n const availableNodes = React.useMemo<React.ReactNode>(() => {\r\n return props.items.map((item, index) => {\r\n let addGroupSeparator = false;\r\n if (index > 0)\r\n addGroupSeparator = item.groupPriority !== props.items[index - 1].groupPriority;\r\n return (\r\n <ToolbarItemComponent\r\n key={item.id}\r\n item={item}\r\n addGroupSeparator={!!addGroupSeparator}\r\n />\r\n );\r\n });\r\n }, [props.items]);\r\n /* overflowItemKeys - keys of items to show in overflow panel\r\n * handleContainerResize - handler called when container <div> is resized.\r\n * handleOverflowResize - handler called when determining size of overflow indicator/button.\r\n * handleEntryResize - handler called when determining size of each item/button. */\r\n const [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize] = useOverflow(availableNodes, panelAlignment === ToolbarPanelAlignment.End);\r\n // handler called by ResizeObserver\r\n const handleResize = React.useCallback((w: number) => {\r\n width.current = w;\r\n width.current !== undefined && handleContainerResize(width.current);\r\n }, [handleContainerResize]);\r\n const resizeObserverRef = useResizeObserverSingleDimension(handleResize, useHeight);\r\n const handleClick = React.useCallback(() => {\r\n setIsOverflowPanelOpen((prev) => !prev);\r\n }, []);\r\n // istanbul ignore next - NEEDSWORK add complete tests\r\n const handleClose = React.useCallback(() => {\r\n setIsOverflowPanelOpen(false);\r\n }, []);\r\n\r\n const refs = useRefs(ref, resizeObserverRef);\r\n const availableItems = React.Children.toArray(availableNodes);\r\n const displayedItems = availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (!overflowItemKeys || overflowItemKeys.indexOf(key) < 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []);\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n const overflowPanelItems = overflowItemKeys ? availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (overflowItemKeys.indexOf(key) >= 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []) : [];\r\n\r\n const direction = getToolbarDirection(expandsTo);\r\n const overflowExpandsTo = undefined !== props.overflowExpandsTo ? props.overflowExpandsTo : Direction.Right;\r\n const addOverflowButton = React.useCallback((atStart: boolean) => {\r\n const overflowItems = !!atStart ? overflowPanelItems.reverse() : overflowPanelItems;\r\n return (<ToolbarItemContext.Provider\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: handleOverflowResize,\r\n }}\r\n >\r\n <ToolbarOverflowButton\r\n expandsTo={expandsTo}\r\n onClick={handleClick}\r\n onClose={handleClose}\r\n open={overflowItems.length > 0 && isOverflowPanelOpen}\r\n panelNode={\r\n <ToolbarOverflowPanel>\r\n <OverflowItemsContainer>\r\n {overflowItems.map(([key, child]) => {\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: true,\r\n useHeight,\r\n onResize: () => { },\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n </OverflowItemsContainer>\r\n </ToolbarOverflowPanel>\r\n }\r\n title={overflowTitle.current}\r\n />\r\n </ToolbarItemContext.Provider>);\r\n }, [handleClick, handleClose, handleOverflowResize, isOverflowPanelOpen, expandsTo, overflowPanelItems, useHeight]);\r\n\r\n const className = classnames(\r\n \"components-toolbar-overflow-sizer\",\r\n OrthogonalDirectionHelpers.getCssClassName(direction),\r\n props.className);\r\n\r\n const showOverflowAtStart = (direction === OrthogonalDirection.Horizontal) && (panelAlignment === ToolbarPanelAlignment.End);\r\n /* The ItemWrapper is used to wrap the <Item> <ExpandableItem> with a <div> that specifies a ref that the sizing logic uses to determine the\r\n size of the item. */\r\n return (\r\n <ToolbarWithOverflowDirectionContext.Provider value={\r\n {\r\n expandsTo, direction, overflowExpandsTo, panelAlignment, useDragInteraction,\r\n toolbarOpacitySetting: undefined !== props.toolbarOpacitySetting ? props.toolbarOpacitySetting : ToolbarOpacitySetting.Proximity,\r\n overflowDirection: direction === OrthogonalDirection.Horizontal ? OrthogonalDirection.Vertical : OrthogonalDirection.Horizontal,\r\n openPopupCount: popupPanelCount,\r\n onPopupPanelOpenClose: handlePopupPanelOpenClose,\r\n overflowDisplayActive: overflowPanelItems.length > 0 && isOverflowPanelOpen,\r\n onItemExecuted: props.onItemExecuted ? props.onItemExecuted : () => { },\r\n onKeyDown: props.onKeyDown ? props.onKeyDown : /* istanbul ignore next */ (_e: React.KeyboardEvent) => { },\r\n }\r\n }>\r\n {(availableItems.length > 0) &&\r\n <div\r\n className={className}\r\n ref={refs}\r\n style={props.style}\r\n onKeyDown={props.onKeyDown}\r\n role=\"presentation\"\r\n >\r\n <ToolbarItems\r\n className=\"components-items\"\r\n direction={direction}\r\n >\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && showOverflowAtStart && addOverflowButton(true)}\r\n {displayedItems.map(([key, child]) => {\r\n const onEntryResize = handleEntryResize(key);\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: onEntryResize,\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && !showOverflowAtStart && addOverflowButton(false)}\r\n\r\n </ToolbarItems>\r\n </div>\r\n }\r\n </ToolbarWithOverflowDirectionContext.Provider >\r\n );\r\n}\r\n\r\n/** Returns key of a child. Must be used along with React.Children.toArray to preserve the semantics of availableItems.\r\n * @internal\r\n */\r\nfunction getChildKey(child: React.ReactNode, index: number) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child) && child.key !== null) {\r\n return child.key.toString();\r\n }\r\n // istanbul ignore next\r\n return index.toString();\r\n}\r\n\r\n/** Returns a subset of toolbar item entry keys that exceed given width and should be overflowItemKeys.\r\n * @internal\r\n */\r\nfunction determineOverflowItems(size: number, entries: ReadonlyArray<readonly [string, number]>, overflowButtonSize: number, overflowButtonAtStart: boolean): string[] {\r\n let toolbarSize = 0;\r\n const buttonPadding = 2;\r\n if (overflowButtonAtStart && entries.length > 0) {\r\n let i = entries.length - 1;\r\n for (; i >= 0; i--) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n if (i >= 0) {\r\n let j = i + 1;\r\n for (; j < entries.length; j++) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(0, j).map((e) => e[0]);\r\n } else {\r\n return [];\r\n }\r\n } else {\r\n let i = 0;\r\n for (; i < entries.length; i++) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n let j = i;\r\n for (; j > 0; j--) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(j).map((e) => e[0]);\r\n }\r\n}\r\n\r\n/** Hook that returns a list of overflowItemKeys availableItems.\r\n * @internal\r\n */\r\nfunction useOverflow(availableItems: React.ReactNode, overflowButtonAtStart: boolean): [\r\n ReadonlyArray<string> | undefined,\r\n (size: number) => void,\r\n (size: number) => void,\r\n (key: string) => (size: number) => void,\r\n] {\r\n const [overflowItemKeys, setOverflown] = React.useState<ReadonlyArray<string>>();\r\n const itemSizes = React.useRef(new Map<string, number | undefined>());\r\n const size = React.useRef<number | undefined>(undefined);\r\n const overflowButtonSize = React.useRef<number | undefined>(undefined);\r\n\r\n const calculateOverflow = React.useCallback(() => {\r\n const sizes = verifiedMapEntries(itemSizes.current);\r\n if (size.current === undefined ||\r\n sizes === undefined ||\r\n overflowButtonSize.current === undefined) {\r\n setOverflown(undefined);\r\n return;\r\n }\r\n\r\n // Calculate overflow.\r\n const newOverflown = determineOverflowItems(size.current, [...sizes.entries()], overflowButtonSize.current, overflowButtonAtStart);\r\n setOverflown((prevOverflown) => {\r\n return eql(prevOverflown, newOverflown) ? prevOverflown : newOverflown;\r\n });\r\n }, [overflowButtonAtStart]);\r\n\r\n React.useLayoutEffect(() => {\r\n const newEntryWidths = new Map<string, number | undefined>();\r\n const array = React.Children.toArray(availableItems);\r\n for (let i = 0; i < array.length; i++) {\r\n const child = array[i];\r\n const key = getChildKey(child, i);\r\n const lastW = itemSizes.current.get(key);\r\n newEntryWidths.set(key, lastW);\r\n }\r\n itemSizes.current = newEntryWidths;\r\n calculateOverflow();\r\n }, [availableItems, calculateOverflow]);\r\n\r\n const handleContainerResize = React.useCallback((w: number) => {\r\n const calculate = size.current !== w;\r\n size.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleOverflowResize = React.useCallback((w: number) => {\r\n const calculate = overflowButtonSize.current !== w;\r\n overflowButtonSize.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleEntryResize = React.useCallback((key: string) => (w: number) => {\r\n const oldW = itemSizes.current.get(key);\r\n if (oldW !== w) {\r\n itemSizes.current.set(key, w);\r\n calculateOverflow();\r\n }\r\n }, [calculateOverflow]);\r\n\r\n return [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize];\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\nexport interface ToolbarItemContextArgs {\r\n readonly hasOverflow: boolean;\r\n readonly useHeight: boolean;\r\n readonly onResize: (w: number) => void;\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarItemContext = React.createContext<ToolbarItemContextArgs>(null!);\r\n\r\n/** @internal */\r\nexport function useToolItemEntryContext() {\r\n return React.useContext(ToolbarItemContext);\r\n}\r\n\r\nfunction verifiedMapEntries<T>(map: Map<string, T | undefined>) {\r\n for (const [, val] of map) {\r\n // istanbul ignore next during unit testing\r\n if (val === undefined)\r\n return undefined;\r\n }\r\n return map as Map<string, T>;\r\n}\r\n\r\nfunction eql(prev: readonly string[] | undefined, value: readonly string[]) {\r\n if (!prev)\r\n return false;\r\n // istanbul ignore next\r\n if (prev.length !== value.length)\r\n return false;\r\n for (let i = 0; i < prev.length; i++) {\r\n const p = prev[i];\r\n const v = value[i];\r\n // istanbul ignore next\r\n if (p !== v)\r\n return false;\r\n }\r\n return true;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AACxB,OAAO,UAAU,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C,MAAM;QAC9B,OAAO,KAAK,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC;YACT,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Toolbar\r\n */\r\n\r\nimport \"./Toolbar.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport {\r\n ActionButton, CommonToolbarItem, ConditionalBooleanValue, ConditionalStringValue, CustomButtonDefinition,\r\n GroupButton, OnItemExecutedFunc, ToolbarItemUtilities,\r\n} from \"@itwin/appui-abstract\";\r\nimport { BadgeUtilities, CommonProps, IconHelper, NoChildrenProps, useRefs } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItem } from \"./Item\";\r\nimport { ToolbarItems } from \"./Items\";\r\nimport { ItemWrapper, useResizeObserverSingleDimension } from \"./ItemWrapper\";\r\nimport { ToolbarOverflowButton } from \"./Overflow\";\r\nimport { ToolbarOverflowPanel } from \"./OverflowPanel\";\r\nimport { PopupItem } from \"./PopupItem\";\r\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\r\nimport { PopupItemWithDrag } from \"./PopupItemWithDrag\";\r\nimport { Direction, DirectionHelpers, OrthogonalDirection, OrthogonalDirectionHelpers } from \"./utilities/Direction\";\r\nimport { UiComponents } from \"../UiComponents\";\r\n\r\n/** Describes the data needed to insert a custom `React` button into an ToolbarWithOverflow.\r\n * @public\r\n */\r\nexport interface CustomToolbarItem extends CustomButtonDefinition {\r\n /** React node that must result in providing a PopupItem @deprecated use panelContentNode */\r\n buttonNode?: React.ReactNode;\r\n /** defines the content to display in popup panel */\r\n panelContentNode?: React.ReactNode;\r\n /** If true the popup panel is mounted once and unmounted when button is unmounted. If false the\r\n * content node is unmounted each time the popup is closed. */\r\n keepContentsLoaded?: boolean;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.\r\n * @public\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarPopupAutoHideContext = React.createContext<boolean>(false);\r\n\r\n/**\r\n * React hook used to retrieve the ToolbarPopupAutoHideContext.\r\n * @public\r\n */\r\nexport function useToolbarPopupAutoHideContext() {\r\n return React.useContext(ToolbarPopupAutoHideContext);\r\n}\r\n\r\n/** Describes toolbar item.\r\n * @public\r\n */\r\nexport type ToolbarItem = ActionButton | GroupButton | CustomToolbarItem;\r\n\r\n/** CustomToolbarItem type guard.\r\n * @internal\r\n */\r\nexport function isCustomToolbarItem(item: ToolbarItem): item is CustomToolbarItem {\r\n return !!(item as CustomToolbarItem).isCustom && ((\"buttonNode\" in item) || (\"panelContentNode\" in item));\r\n}\r\n\r\n/** @internal */\r\nexport const getToolbarDirection = (expandsTo: Direction): OrthogonalDirection => {\r\n const orthogonalDirection = DirectionHelpers.getOrthogonalDirection(expandsTo);\r\n return OrthogonalDirectionHelpers.inverse(orthogonalDirection);\r\n};\r\n\r\n/** Available alignment modes of [[ToolbarWithOverflow]] panels.\r\n * @public\r\n */\r\nexport enum ToolbarPanelAlignment {\r\n Start,\r\n End,\r\n}\r\n\r\n/** Enumeration of Toolbar Opacity setting.\r\n * @public\r\n */\r\nexport enum ToolbarOpacitySetting {\r\n /** Use the default background, box-shadow opacity and backdrop-filter blur */\r\n Defaults,\r\n /** Alter the opacity from transparent to the defaults based on mouse proximity */\r\n Proximity,\r\n /** Use a transparent background, box-shadow opacity and backdrop-filter blur */\r\n Transparent,\r\n}\r\n\r\n/** Helpers for [[ToolbarPanelAlignment]].\r\n * @internal\r\n */\r\nexport class ToolbarPanelAlignmentHelpers {\r\n /** Class name of [[ToolbarPanelAlignment.Start]] */\r\n public static readonly START_CLASS_NAME = \"components-panel-alignment-start\";\r\n /** Class name of [[ToolbarPanelAlignment.End]] */\r\n public static readonly END_CLASS_NAME = \"components-panel-alignment-end\";\r\n\r\n /** @returns Class name of specified [[ToolbarPanelAlignment]] */\r\n public static getCssClassName(panelAlignment: ToolbarPanelAlignment): string {\r\n switch (panelAlignment) {\r\n case ToolbarPanelAlignment.Start:\r\n return ToolbarPanelAlignmentHelpers.START_CLASS_NAME;\r\n case ToolbarPanelAlignment.End:\r\n return ToolbarPanelAlignmentHelpers.END_CLASS_NAME;\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface ToolbarOverflowContextProps {\r\n readonly expandsTo: Direction;\r\n readonly direction: OrthogonalDirection;\r\n readonly overflowExpandsTo: Direction;\r\n readonly overflowDirection: OrthogonalDirection;\r\n readonly panelAlignment: ToolbarPanelAlignment;\r\n readonly useDragInteraction: boolean;\r\n readonly toolbarOpacitySetting: ToolbarOpacitySetting;\r\n readonly openPopupCount: number;\r\n readonly onPopupPanelOpenClose: (isOpening: boolean) => void;\r\n readonly overflowDisplayActive: boolean;\r\n readonly onItemExecuted: OnItemExecutedFunc;\r\n readonly onKeyDown: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar component to provide Direction to child components.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarWithOverflowDirectionContext = React.createContext<ToolbarOverflowContextProps>({\r\n expandsTo: Direction.Bottom,\r\n direction: OrthogonalDirection.Horizontal,\r\n overflowExpandsTo: Direction.Right,\r\n overflowDirection: OrthogonalDirection.Vertical,\r\n panelAlignment: ToolbarPanelAlignment.Start,\r\n useDragInteraction: false,\r\n toolbarOpacitySetting: ToolbarOpacitySetting.Proximity,\r\n openPopupCount: 0,\r\n onPopupPanelOpenClose: /* istanbul ignore next */ (_isOpening: boolean) => { },\r\n overflowDisplayActive: false,\r\n onItemExecuted: /* istanbul ignore next */ (_item: any) => void {},\r\n onKeyDown: /* istanbul ignore next */ (_e: React.KeyboardEvent) => void {},\r\n});\r\n\r\n/** @internal */\r\nexport function CustomItem({ item, addGroupSeparator }: { item: CustomToolbarItem, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const icon = React.useMemo(() => (item.icon &&\r\n IconHelper.getIconReactNode(item.icon, item.internalData)) || /* istanbul ignore next */\r\n <i className=\"icon icon-placeholder\" />, [item.icon, item.internalData]);\r\n const isDisabled = React.useMemo(() => ConditionalBooleanValue.getValue(item.isDisabled), [item.isDisabled]);\r\n const title = React.useMemo(() => /* istanbul ignore next */ ConditionalStringValue.getValue(item.label) ?? item.id, [item.id, item.label]);\r\n const badge = React.useMemo(() => BadgeUtilities.getComponentForBadgeType(item.badgeType), [item.badgeType]);\r\n\r\n if (item.panelContentNode) {\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n icon={icon}\r\n isDisabled={isDisabled}\r\n title={title}\r\n panel={item.panelContentNode}\r\n hideIndicator={useDragInteraction}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n keepContentsMounted={item.keepContentsLoaded}\r\n />;\r\n }\r\n\r\n // istanbul ignore else\r\n if (item.buttonNode)\r\n return <>{item.buttonNode}</>;\r\n\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function GroupPopupItem({ item, addGroupSeparator }: { item: GroupButton, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const panel = React.useMemo(() => <PopupItemsPanel groupItem={item} activateOnPointerUp={false} />, [item]);\r\n if (useDragInteraction) {\r\n return <PopupItemWithDrag\r\n key={item.id}\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n groupItem={item}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n }\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n panel={panel}\r\n badge={badge}\r\n hideIndicator={useDragInteraction}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ActionItem({ item, addGroupSeparator }: { item: ActionButton, addGroupSeparator: boolean }) {\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const { onItemExecuted } = useToolbarWithOverflowDirectionContext();\r\n const onExecute = React.useCallback(() => {\r\n item.execute();\r\n onItemExecuted(item);\r\n }, [item, onItemExecuted]);\r\n\r\n return <ToolbarButtonItem\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n key={item.id}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isActive={item.isActive}\r\n onClick={onExecute}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ToolbarItemComponent({ item, addGroupSeparator }: { item: ToolbarItem, addGroupSeparator: boolean }) {\r\n if (ToolbarItemUtilities.isGroupButton(item)) {\r\n return <GroupPopupItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else if (isCustomToolbarItem(item)) {\r\n return <CustomItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(item)) {\r\n return <ActionItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n }\r\n }\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function useToolbarWithOverflowDirectionContext() {\r\n return React.useContext(ToolbarWithOverflowDirectionContext);\r\n}\r\n\r\nfunction OverflowItemsContainer(p: { children: React.ReactNode }) {\r\n return <>{p.children}</>;\r\n}\r\n\r\nfunction getItemWrapperClass(child: React.ReactNode) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child)) {\r\n if (child.props && child.props.addGroupSeparator)\r\n return \"components-toolbar-button-add-gap-before\";\r\n }\r\n return undefined;\r\n}\r\n\r\n/** Properties of [[ToolbarWithOverflow]] component.\r\n * @public\r\n */\r\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\r\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\r\n expandsTo?: Direction;\r\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\r\n overflowExpandsTo?: Direction;\r\n /** definitions for items of the toolbar. i.e. [[CommonToolbarItem]]. Items are expected to be already sorted by group and item. */\r\n items: CommonToolbarItem[];\r\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\r\n panelAlignment?: ToolbarPanelAlignment;\r\n /** Use Drag Interaction to open popups with nest action buttons */\r\n useDragInteraction?: boolean;\r\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\r\n toolbarOpacitySetting?: ToolbarOpacitySetting;\r\n /** Optional function to call on any item execution */\r\n onItemExecuted?: OnItemExecutedFunc;\r\n /** Optional function to call on any KeyDown events processed by toolbar */\r\n onKeyDown?: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/** Component that displays tool settings as a bar across the top of the content view.\r\n * @public\r\n */\r\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\r\n const expandsTo = props.expandsTo ? props.expandsTo : Direction.Bottom;\r\n const useDragInteraction = !!props.useDragInteraction;\r\n const panelAlignment = props.panelAlignment ? props.panelAlignment : ToolbarPanelAlignment.Start;\r\n const useHeight = (expandsTo === Direction.Right || expandsTo === Direction.Left);\r\n const [isOverflowPanelOpen, setIsOverflowPanelOpen] = React.useState(false);\r\n const [popupPanelCount, setPopupPanelCount] = React.useState(0);\r\n const overflowTitle = React.useRef(UiComponents.translate(\"toolbar.overflow\"));\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n });\r\n const handlePopupPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n // use setImmediate to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag\r\n setImmediate(() => {\r\n // istanbul ignore next\r\n if (!isMounted.current)\r\n return;\r\n setPopupPanelCount((prev) => {\r\n const nextCount = isOpening ? (prev + 1) : (prev - 1);\r\n // eslint-disable-next-line no-console\r\n // console.log(`new popup count = ${nextCount}`);\r\n return nextCount < 0 ? /* istanbul ignore next */ 0 : nextCount;\r\n });\r\n });\r\n }, []);\r\n\r\n const ref = React.useRef<HTMLDivElement>(null);\r\n const width = React.useRef<number | undefined>(undefined);\r\n const availableNodes = React.useMemo<React.ReactNode>(() => {\r\n return props.items.map((item, index) => {\r\n let addGroupSeparator = false;\r\n if (index > 0)\r\n addGroupSeparator = item.groupPriority !== props.items[index - 1].groupPriority;\r\n return (\r\n <ToolbarItemComponent\r\n key={item.id}\r\n item={item}\r\n addGroupSeparator={!!addGroupSeparator}\r\n />\r\n );\r\n });\r\n }, [props.items]);\r\n /* overflowItemKeys - keys of items to show in overflow panel\r\n * handleContainerResize - handler called when container <div> is resized.\r\n * handleOverflowResize - handler called when determining size of overflow indicator/button.\r\n * handleEntryResize - handler called when determining size of each item/button. */\r\n const [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize] = useOverflow(availableNodes, panelAlignment === ToolbarPanelAlignment.End);\r\n // handler called by ResizeObserver\r\n const handleResize = React.useCallback((w: number) => {\r\n width.current = w;\r\n width.current !== undefined && handleContainerResize(width.current);\r\n }, [handleContainerResize]);\r\n const resizeObserverRef = useResizeObserverSingleDimension(handleResize, useHeight);\r\n const handleClick = React.useCallback(() => {\r\n setIsOverflowPanelOpen((prev) => !prev);\r\n }, []);\r\n // istanbul ignore next - NEEDSWORK add complete tests\r\n const handleClose = React.useCallback(() => {\r\n setIsOverflowPanelOpen(false);\r\n }, []);\r\n\r\n const refs = useRefs(ref, resizeObserverRef);\r\n const availableItems = React.Children.toArray(availableNodes);\r\n const displayedItems = availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (!overflowItemKeys || overflowItemKeys.indexOf(key) < 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []);\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n const overflowPanelItems = overflowItemKeys ? availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (overflowItemKeys.indexOf(key) >= 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []) : [];\r\n\r\n const direction = getToolbarDirection(expandsTo);\r\n const overflowExpandsTo = undefined !== props.overflowExpandsTo ? props.overflowExpandsTo : Direction.Right;\r\n const addOverflowButton = React.useCallback((atStart: boolean) => {\r\n const overflowItems = !!atStart ? overflowPanelItems.reverse() : overflowPanelItems;\r\n return (<ToolbarItemContext.Provider\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: handleOverflowResize,\r\n }}\r\n >\r\n <ToolbarOverflowButton\r\n expandsTo={expandsTo}\r\n onClick={handleClick}\r\n onClose={handleClose}\r\n open={overflowItems.length > 0 && isOverflowPanelOpen}\r\n panelNode={\r\n <ToolbarOverflowPanel>\r\n <OverflowItemsContainer>\r\n {overflowItems.map(([key, child]) => {\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: true,\r\n useHeight,\r\n onResize: () => { },\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n </OverflowItemsContainer>\r\n </ToolbarOverflowPanel>\r\n }\r\n title={overflowTitle.current}\r\n />\r\n </ToolbarItemContext.Provider>);\r\n }, [handleClick, handleClose, handleOverflowResize, isOverflowPanelOpen, expandsTo, overflowPanelItems, useHeight]);\r\n\r\n const className = classnames(\r\n \"components-toolbar-overflow-sizer\",\r\n OrthogonalDirectionHelpers.getCssClassName(direction),\r\n props.className);\r\n\r\n const showOverflowAtStart = (direction === OrthogonalDirection.Horizontal) && (panelAlignment === ToolbarPanelAlignment.End);\r\n /* The ItemWrapper is used to wrap the <Item> <ExpandableItem> with a <div> that specifies a ref that the sizing logic uses to determine the\r\n size of the item. */\r\n return (\r\n <ToolbarWithOverflowDirectionContext.Provider value={\r\n {\r\n expandsTo, direction, overflowExpandsTo, panelAlignment, useDragInteraction,\r\n toolbarOpacitySetting: undefined !== props.toolbarOpacitySetting ? props.toolbarOpacitySetting : ToolbarOpacitySetting.Proximity,\r\n overflowDirection: direction === OrthogonalDirection.Horizontal ? OrthogonalDirection.Vertical : OrthogonalDirection.Horizontal,\r\n openPopupCount: popupPanelCount,\r\n onPopupPanelOpenClose: handlePopupPanelOpenClose,\r\n overflowDisplayActive: overflowPanelItems.length > 0 && isOverflowPanelOpen,\r\n onItemExecuted: props.onItemExecuted ? props.onItemExecuted : () => { },\r\n onKeyDown: props.onKeyDown ? props.onKeyDown : /* istanbul ignore next */ (_e: React.KeyboardEvent) => { },\r\n }\r\n }>\r\n {(availableItems.length > 0) &&\r\n <div\r\n className={className}\r\n ref={refs}\r\n style={props.style}\r\n onKeyDown={props.onKeyDown}\r\n role=\"presentation\"\r\n >\r\n <ToolbarItems\r\n className=\"components-items\"\r\n direction={direction}\r\n >\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && showOverflowAtStart && addOverflowButton(true)}\r\n {displayedItems.map(([key, child]) => {\r\n const onEntryResize = handleEntryResize(key);\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: onEntryResize,\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && !showOverflowAtStart && addOverflowButton(false)}\r\n\r\n </ToolbarItems>\r\n </div>\r\n }\r\n </ToolbarWithOverflowDirectionContext.Provider >\r\n );\r\n}\r\n\r\n/** Returns key of a child. Must be used along with React.Children.toArray to preserve the semantics of availableItems.\r\n * @internal\r\n */\r\nfunction getChildKey(child: React.ReactNode, index: number) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child) && child.key !== null) {\r\n return child.key.toString();\r\n }\r\n // istanbul ignore next\r\n return index.toString();\r\n}\r\n\r\n/** Returns a subset of toolbar item entry keys that exceed given width and should be overflowItemKeys.\r\n * @internal\r\n */\r\nfunction determineOverflowItems(size: number, entries: ReadonlyArray<readonly [string, number]>, overflowButtonSize: number, overflowButtonAtStart: boolean): string[] {\r\n let toolbarSize = 0;\r\n const buttonPadding = 2;\r\n if (overflowButtonAtStart && entries.length > 0) {\r\n let i = entries.length - 1;\r\n for (; i >= 0; i--) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n if (i >= 0) {\r\n let j = i + 1;\r\n for (; j < entries.length; j++) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(0, j).map((e) => e[0]);\r\n } else {\r\n return [];\r\n }\r\n } else {\r\n let i = 0;\r\n for (; i < entries.length; i++) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n let j = i;\r\n for (; j > 0; j--) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(j).map((e) => e[0]);\r\n }\r\n}\r\n\r\n/** Hook that returns a list of overflowItemKeys availableItems.\r\n * @internal\r\n */\r\nfunction useOverflow(availableItems: React.ReactNode, overflowButtonAtStart: boolean): [\r\n ReadonlyArray<string> | undefined,\r\n (size: number) => void,\r\n (size: number) => void,\r\n (key: string) => (size: number) => void,\r\n] {\r\n const [overflowItemKeys, setOverflown] = React.useState<ReadonlyArray<string>>();\r\n const itemSizes = React.useRef(new Map<string, number | undefined>());\r\n const size = React.useRef<number | undefined>(undefined);\r\n const overflowButtonSize = React.useRef<number | undefined>(undefined);\r\n\r\n const calculateOverflow = React.useCallback(() => {\r\n const sizes = verifiedMapEntries(itemSizes.current);\r\n if (size.current === undefined ||\r\n sizes === undefined ||\r\n overflowButtonSize.current === undefined) {\r\n setOverflown(undefined);\r\n return;\r\n }\r\n\r\n // Calculate overflow.\r\n const newOverflown = determineOverflowItems(size.current, [...sizes.entries()], overflowButtonSize.current, overflowButtonAtStart);\r\n setOverflown((prevOverflown) => {\r\n return eql(prevOverflown, newOverflown) ? prevOverflown : newOverflown;\r\n });\r\n }, [overflowButtonAtStart]);\r\n\r\n React.useLayoutEffect(() => {\r\n const newEntryWidths = new Map<string, number | undefined>();\r\n const array = React.Children.toArray(availableItems);\r\n for (let i = 0; i < array.length; i++) {\r\n const child = array[i];\r\n const key = getChildKey(child, i);\r\n const lastW = itemSizes.current.get(key);\r\n newEntryWidths.set(key, lastW);\r\n }\r\n itemSizes.current = newEntryWidths;\r\n calculateOverflow();\r\n }, [availableItems, calculateOverflow]);\r\n\r\n const handleContainerResize = React.useCallback((w: number) => {\r\n const calculate = size.current !== w;\r\n size.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleOverflowResize = React.useCallback((w: number) => {\r\n const calculate = overflowButtonSize.current !== w;\r\n overflowButtonSize.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleEntryResize = React.useCallback((key: string) => (w: number) => {\r\n const oldW = itemSizes.current.get(key);\r\n if (oldW !== w) {\r\n itemSizes.current.set(key, w);\r\n calculateOverflow();\r\n }\r\n }, [calculateOverflow]);\r\n\r\n return [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize];\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\nexport interface ToolbarItemContextArgs {\r\n readonly hasOverflow: boolean;\r\n readonly useHeight: boolean;\r\n readonly onResize: (w: number) => void;\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarItemContext = React.createContext<ToolbarItemContextArgs>(null!);\r\n\r\n/** @internal */\r\nexport function useToolItemEntryContext() {\r\n return React.useContext(ToolbarItemContext);\r\n}\r\n\r\nfunction verifiedMapEntries<T>(map: Map<string, T | undefined>) {\r\n for (const [, val] of map) {\r\n // istanbul ignore next during unit testing\r\n if (val === undefined)\r\n return undefined;\r\n }\r\n return map as Map<string, T>;\r\n}\r\n\r\nfunction eql(prev: readonly string[] | undefined, value: readonly string[]) {\r\n if (!prev)\r\n return false;\r\n // istanbul ignore next\r\n if (prev.length !== value.length)\r\n return false;\r\n for (let i = 0; i < prev.length; i++) {\r\n const p = prev[i];\r\n const v = value[i];\r\n // istanbul ignore next\r\n if (p !== v)\r\n return false;\r\n }\r\n return true;\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/components-react",
|
|
3
|
-
"version": "3.1.0-dev.
|
|
3
|
+
"version": "3.1.0-dev.28",
|
|
4
4
|
"description": "iTwin.js UI complex components",
|
|
5
5
|
"main": "lib/cjs/components-react.js",
|
|
6
6
|
"module": "lib/esm/components-react.js",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"url": "http://www.bentley.com"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@itwin/appui-abstract": "^3.1.0-dev.
|
|
25
|
-
"@itwin/core-bentley": "^3.1.0-dev.
|
|
26
|
-
"@itwin/core-react": "^3.1.0-dev.
|
|
24
|
+
"@itwin/appui-abstract": "^3.1.0-dev.28",
|
|
25
|
+
"@itwin/core-bentley": "^3.1.0-dev.28",
|
|
26
|
+
"@itwin/core-react": "^3.1.0-dev.28",
|
|
27
27
|
"react": "^17.0.0",
|
|
28
28
|
"react-dom": "^17.0.0"
|
|
29
29
|
},
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@itwin/appui-abstract": "3.1.0-dev.
|
|
36
|
-
"@itwin/build-tools": "3.1.0-dev.
|
|
37
|
-
"@itwin/core-bentley": "3.1.0-dev.
|
|
38
|
-
"@itwin/core-common": "3.1.0-dev.
|
|
39
|
-
"@itwin/core-i18n": "3.1.0-dev.
|
|
40
|
-
"@itwin/core-react": "3.1.0-dev.
|
|
41
|
-
"@itwin/eslint-plugin": "3.1.0-dev.
|
|
35
|
+
"@itwin/appui-abstract": "3.1.0-dev.28",
|
|
36
|
+
"@itwin/build-tools": "3.1.0-dev.28",
|
|
37
|
+
"@itwin/core-bentley": "3.1.0-dev.28",
|
|
38
|
+
"@itwin/core-common": "3.1.0-dev.28",
|
|
39
|
+
"@itwin/core-i18n": "3.1.0-dev.28",
|
|
40
|
+
"@itwin/core-react": "3.1.0-dev.28",
|
|
41
|
+
"@itwin/eslint-plugin": "3.1.0-dev.28",
|
|
42
42
|
"@testing-library/react": "^12.0.0",
|
|
43
43
|
"@testing-library/react-hooks": "^7.0.2",
|
|
44
44
|
"@testing-library/user-event": "^13.2.1",
|