@itwin/components-react 3.2.0-dev.9 → 3.3.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -1
- package/lib/cjs/components-react/common/ImageRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/common/ImageRenderer.js +2 -1
- package/lib/cjs/components-react/common/ImageRenderer.js.map +1 -1
- package/lib/cjs/components-react/common/showhide/ShowHideDialog.d.ts +4 -4
- package/lib/cjs/components-react/common/showhide/ShowHideDialog.d.ts.map +1 -1
- package/lib/cjs/components-react/common/showhide/ShowHideDialog.js +3 -2
- package/lib/cjs/components-react/common/showhide/ShowHideDialog.js.map +1 -1
- package/lib/cjs/components-react/common/showhide/ShowHideItem.d.ts +3 -3
- package/lib/cjs/components-react/common/showhide/ShowHideItem.d.ts.map +1 -1
- package/lib/cjs/components-react/common/showhide/ShowHideItem.js.map +1 -1
- package/lib/cjs/components-react/common/showhide/ShowHideMenu.d.ts +2 -2
- package/lib/cjs/components-react/common/showhide/ShowHideMenu.d.ts.map +1 -1
- package/lib/cjs/components-react/common/showhide/ShowHideMenu.js +2 -1
- package/lib/cjs/components-react/common/showhide/ShowHideMenu.js.map +1 -1
- package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js +1 -1
- package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +1 -3
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/table/component/Table.js +1 -1
- package/lib/cjs/components-react/table/component/Table.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Item.js +1 -1
- package/lib/cjs/components-react/toolbar/Item.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItem.js +1 -1
- package/lib/cjs/components-react/toolbar/PopupItem.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Toolbar.js +2 -2
- package/lib/cjs/components-react/toolbar/Toolbar.js.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js +2 -2
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
- package/lib/esm/components-react/common/ImageRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/common/ImageRenderer.js +4 -3
- package/lib/esm/components-react/common/ImageRenderer.js.map +1 -1
- package/lib/esm/components-react/common/showhide/ShowHideDialog.d.ts +4 -4
- package/lib/esm/components-react/common/showhide/ShowHideDialog.d.ts.map +1 -1
- package/lib/esm/components-react/common/showhide/ShowHideDialog.js +3 -2
- package/lib/esm/components-react/common/showhide/ShowHideDialog.js.map +1 -1
- package/lib/esm/components-react/common/showhide/ShowHideItem.d.ts +3 -3
- package/lib/esm/components-react/common/showhide/ShowHideItem.d.ts.map +1 -1
- package/lib/esm/components-react/common/showhide/ShowHideItem.js.map +1 -1
- package/lib/esm/components-react/common/showhide/ShowHideMenu.d.ts +2 -2
- package/lib/esm/components-react/common/showhide/ShowHideMenu.d.ts.map +1 -1
- package/lib/esm/components-react/common/showhide/ShowHideMenu.js +2 -1
- package/lib/esm/components-react/common/showhide/ShowHideMenu.js.map +1 -1
- package/lib/esm/components-react/editors/EnumButtonGroupEditor.js +1 -1
- package/lib/esm/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +2 -2
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +1 -3
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +2 -2
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js +1 -1
- package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/table/component/Table.js +1 -1
- package/lib/esm/components-react/table/component/Table.js.map +1 -1
- package/lib/esm/components-react/toolbar/Item.js +1 -1
- package/lib/esm/components-react/toolbar/Item.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.js +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/esm/components-react/toolbar/Toolbar.js +2 -2
- package/lib/esm/components-react/toolbar/Toolbar.js.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js +2 -2
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
- package/package.json +16 -14
|
@@ -14,7 +14,7 @@ import * as React from "react";
|
|
|
14
14
|
// eslint-disable-next-line react/display-name
|
|
15
15
|
export const ToolbarButtonItem = React.memo((props) => {
|
|
16
16
|
const className = classnames("components-toolbar-button-item", props.isActive && "components-active", props.isDisabled && "components-disabled", props.className);
|
|
17
|
-
return (React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "action-tool-button", "data-item-group-priority": props.groupPriority, "data-item-priority": props.itemPriority, "data-item-
|
|
17
|
+
return (React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "action-tool-button", "data-item-group-priority": props.groupPriority, "data-item-priority": props.itemPriority, "data-item-provider-id": props.providerId, disabled: props.isDisabled, onClick: props.onClick, onKeyDown: props.onKeyDown, className: className, style: props.style, title: props.title },
|
|
18
18
|
React.createElement("div", { className: "components-icon" }, props.icon),
|
|
19
19
|
props.badge &&
|
|
20
20
|
React.createElement("div", { className: "components-badge" }, props.badge)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Item.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,aAAa,CAAC;AACrB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA+B/B;;GAEG;AACH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI,CACzC,CAAC,KAA6B,EAAE,EAAE;IAChC,MAAM,SAAS,GAAG,UAA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CACV,CAAC;AACJ,CAAC,CAAC,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 \"./Item.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\n\r\n/** Properties of [[ToolbarButtonItem]] component.\r\n * @public\r\n */\r\nexport interface ToolbarButtonItemProps extends CommonProps {\r\n /** button icon. */\r\n icon?: React.ReactNode;\r\n /** Describes if item is active. */\r\n isActive?: boolean;\r\n /** Describes if the item is disabled. */\r\n isDisabled?: boolean;\r\n /** Function called when the item is clicked. */\r\n onClick?: () => void;\r\n /** Function called when a key is pressed. */\r\n onKeyDown?: (e: React.KeyboardEvent) => void;\r\n /** Title for the item. */\r\n title: string;\r\n /** A badge to draw. */\r\n badge?: React.ReactNode;\r\n /** If true add a gap before button. Default to false. */\r\n addGroupSeparator?: boolean;\r\n /** value added to DOM element as a data attribute to hold name of items provider. If specified in `FrontstageProvider` then this will be undefined */\r\n providerId?: string;\r\n /** value added to DOM element as a data attribute, shows 0 is undefined */\r\n itemPriority?: number;\r\n /** value added to DOM element as a data attribute */\r\n groupPriority?: number;\r\n}\r\n\r\n/** Toolbar item component. Used in [[Toolbar]] component.\r\n * @public\r\n */\r\n// eslint-disable-next-line react/display-name\r\nexport const ToolbarButtonItem = React.memo<React.FC<ToolbarButtonItemProps>>(\r\n (props: ToolbarButtonItemProps) => {\r\n const className = classnames(\r\n \"components-toolbar-button-item\",\r\n props.isActive && \"components-active\",\r\n props.isDisabled && \"components-disabled\",\r\n props.className);\r\n\r\n return (\r\n <button\r\n data-item-id={props.itemId}\r\n data-item-type=\"action-tool-button\"\r\n data-item-group-priority={props.groupPriority}\r\n data-item-priority={props.itemPriority}\r\n data-item-provider-id={props.providerId}\r\n disabled={props.isDisabled} // this is needed to prevent focusing/keyboard access to disabled buttons\r\n onClick={props.onClick}\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 </button>\r\n );\r\n });\r\n"]}
|
|
@@ -62,7 +62,7 @@ export function PopupItem(props) {
|
|
|
62
62
|
return (React.createElement(ToolbarPopupContext.Provider, { value: {
|
|
63
63
|
closePanel: () => processPanelOpenClose(false),
|
|
64
64
|
} },
|
|
65
|
-
React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "tool-button-popup", "data-item-group-priority": props.groupPriority, "data-item-priority": props.itemPriority, "data-item-
|
|
65
|
+
React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "tool-button-popup", "data-item-group-priority": props.groupPriority, "data-item-priority": props.itemPriority, "data-item-provider-id": props.providerId, ref: targetRef, disabled: props.isDisabled, onClick: onButtonClick, onKeyDown: props.onKeyDown, className: className, style: props.style, title: props.title },
|
|
66
66
|
React.createElement("div", { className: "components-icon" }, props.icon),
|
|
67
67
|
props.badge &&
|
|
68
68
|
React.createElement("div", { className: "components-badge" }, props.badge),
|
|
@@ -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,OAAO,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,8BAA8B,EAAE,sCAAsC,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACxI,OAAO,EAAE,8B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AAC,CAAC,CAAC,6BAAK,SAAS,EAAC,qBAAqB,GAAG,CACxF;QACT,oBAAC,cAAc,IACb,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,8BAA8B,CAAC,kBAAkB,EAAE,cAAc,CAAC,EAC5E,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,IAE7C,KAAK,CACS,CACY,CAChC,CAAC;AACJ,CAAC;AAYD,gBAAgB;AAChB,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,QAAQ,GAAG,8BAA8B,EAAE,CAAC;IAClD,MAAM,SAAS,GAAG,UAAU,CAC1B,6CAA6C,EAC7C,QAAQ,IAAI,WAAW,CAAC,CAAC;IAE3B,OAAO,oBAAC,KAAK,IACX,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,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-provider-id={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"]}
|
|
@@ -117,7 +117,7 @@ export function PopupItemWithDrag(props) {
|
|
|
117
117
|
closePanel: /* istanbul ignore next */ () => processPanelOpenClose(false),
|
|
118
118
|
setSelectedItem: /* istanbul ignore next */ (buttonItem) => setActiveAction(buttonItem),
|
|
119
119
|
} },
|
|
120
|
-
React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "action-tool-button", "data-item-group-priority": props.groupPriority, "data-item-priority": props.itemPriority, "data-item-
|
|
120
|
+
React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "action-tool-button", "data-item-group-priority": props.groupPriority, "data-item-priority": props.itemPriority, "data-item-provider-id": props.providerId, ref: targetRef, onPointerDown: handlePointerDown, onClick: handleButtonClick, onKeyDown: props.onKeyDown, className: className, style: props.style, title: title },
|
|
121
121
|
React.createElement("div", { className: "components-icon" }, icon),
|
|
122
122
|
props.badge &&
|
|
123
123
|
React.createElement("div", { className: "components-badge" }, badge),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupItemWithDrag.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAgB,uBAAuB,EAAE,sBAAsB,EAAe,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3J,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,sCAAsC,EAAE,u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C,kBAAkB,IAC9B,KAAK,CACF;YAER,6BAAK,SAAS,EAAC,qBAAqB,GAAG,CAChC;QACT,oBAAC,cAAc,IACb,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,8BAA8B,CAAC,kBAAkB,EAAE,cAAc,CAAC,EAC5E,MAAM,EAAE,MAAM;YAEd,oBAAC,eAAe,IAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,mBAAmB,EAAE,IAAI,GAAI,CAC3D,CACY,CAChC,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,8BAA8B,CAAC,SAAoB,EAAE,SAAgC;IACnG,uBAAuB;IACvB,QAAQ,SAAS,EAAE;QACjB,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC;YACrB,IAAI,SAAS,KAAK,qBAAqB,CAAC,GAAG;gBACzC,OAAO,gBAAgB,CAAC,WAAW,CAAC;YACtC,OAAO,gBAAgB,CAAC,UAAU,CAAC;SACpC;QACD,KAAK,SAAS,CAAC,IAAI;YACjB,OAAO,gBAAgB,CAAC,OAAO,CAAC;QAClC,KAAK,SAAS,CAAC,KAAK;YAClB,OAAO,gBAAgB,CAAC,QAAQ,CAAC;QACnC,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 Toolbar\r\n */\r\n\r\nimport \"./PopupItem.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ActionButton, ConditionalBooleanValue, ConditionalStringValue, GroupButton, RelativePosition, ToolbarItemUtilities } from \"@itwin/appui-abstract\";\r\nimport { BadgeUtilities, IconHelper, useRefState } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItemProps } from \"./Item\";\r\nimport { PopupItemPopup, ToolbarPopupContext } from \"./PopupItem\";\r\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\r\nimport { ToolbarPanelAlignment, useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { useDragInteraction } from \"./useDragInteraction\";\r\nimport { Direction } from \"./utilities/Direction\";\r\n\r\n/** Properties of [[PopupItem]] component.\r\n * @public\r\n */\r\nexport interface PopupItemWithDragProps extends ToolbarButtonItemProps {\r\n /** Panel of the toolbar. */\r\n groupItem: GroupButton;\r\n}\r\n\r\nfunction tryFindActiveAction(item: GroupButton): ActionButton | undefined {\r\n for (const childItem of item.items) {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n if (childItem.isActive)\r\n return childItem;\r\n } else if (ToolbarItemUtilities.isGroupButton(childItem)) {\r\n const nestedChild = tryFindActiveAction(childItem);\r\n if (nestedChild)\r\n return nestedChild;\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getFirstAvailableChildActionItem(item: GroupButton): ActionButton | undefined {\r\n for (const childItem of item.items) {\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n return childItem;\r\n } else {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isGroupButton(childItem)) {\r\n const nestedChild = getFirstAvailableChildActionItem(childItem);\r\n // istanbul ignore else\r\n if (nestedChild)\r\n return nestedChild;\r\n }\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getActiveAction(item: GroupButton): ActionButton | undefined {\r\n const activeItem = tryFindActiveAction(item);\r\n if (activeItem)\r\n return activeItem;\r\n\r\n // initially look only in root items\r\n for (const childItem of item.items) {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n return childItem;\r\n }\r\n }\r\n\r\n // if not found look inside groups\r\n return getFirstAvailableChildActionItem(item);\r\n}\r\n\r\n/** Expandable Group button Item\r\n * @public\r\n */\r\nexport function PopupItemWithDrag(props: PopupItemWithDragProps) {\r\n const [isPanelShown, setPanelShown] = React.useState(false);\r\n const [activeAction, setActiveAction] = React.useState(getActiveAction(props.groupItem));\r\n const { expandsTo, overflowExpandsTo, panelAlignment, onPopupPanelOpenClose } = useToolbarWithOverflowDirectionContext();\r\n\r\n React.useEffect(() => {\r\n const newActiveAction = getActiveAction(props.groupItem);\r\n // istanbul ignore else\r\n if (newActiveAction) {\r\n // istanbul ignore next\r\n if (newActiveAction.isActive) {\r\n setActiveAction(newActiveAction);\r\n } else {\r\n if (activeAction && activeAction.isActive) {\r\n setActiveAction({ ...activeAction, isActive: false });\r\n }\r\n }\r\n }\r\n }, [props.groupItem, activeAction]);\r\n\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 popup panel\r\n const onOpenPanel = React.useCallback(() => {\r\n processPanelOpenClose(!isPanelShown);\r\n }, [isPanelShown, processPanelOpenClose]);\r\n\r\n // handle open and closing popup panel\r\n const onGroupButtonClick = React.useCallback(() => {\r\n // only execute action if not disabled\r\n activeAction && !ConditionalBooleanValue.getValue(activeAction.isDisabled) && activeAction.execute();\r\n }, [activeAction]);\r\n\r\n const badge = activeAction ? BadgeUtilities.getComponentForBadgeType(activeAction.badgeType) : props.badge;\r\n const icon = activeAction ? IconHelper.getIconReactNode(activeAction.icon, activeAction.internalData) : props.icon;\r\n const title = activeAction ? ConditionalStringValue.getValue(activeAction.label) : props.title;\r\n const isActive = activeAction ? activeAction.isActive : props.isActive;\r\n const isDisabled = ConditionalBooleanValue.getValue(activeAction ? activeAction.isDisabled : props.isDisabled);\r\n\r\n const { handlePointerDown, handleButtonClick } = useDragInteraction(onGroupButtonClick, onOpenPanel);\r\n\r\n const className = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-toolbar-expandable-button\",\r\n isActive && \"components-active\",\r\n isDisabled && \"components-disabled-drag\",\r\n props.className);\r\n\r\n const [targetRef, target] = useRefState<HTMLButtonElement>();\r\n const handleClose = React.useCallback(() => {\r\n processPanelOpenClose(false);\r\n }, [processPanelOpenClose]);\r\n const { hasOverflow } = useToolItemEntryContext();\r\n const expandsToDirection = hasOverflow ? /* istanbul ignore next */ overflowExpandsTo : expandsTo;\r\n\r\n return (\r\n <ToolbarPopupContext.Provider value={{\r\n closePanel: /* istanbul ignore next */ () => processPanelOpenClose(false),\r\n setSelectedItem: /* istanbul ignore next */ (buttonItem: ActionButton) => setActiveAction(buttonItem),\r\n }\r\n }>\r\n <button\r\n data-item-id={props.itemId}\r\n data-item-type=\"action-tool-button\"\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 onPointerDown={handlePointerDown}\r\n onClick={handleButtonClick}\r\n onKeyDown={props.onKeyDown}\r\n className={className}\r\n style={props.style}\r\n title={title}\r\n >\r\n <div className=\"components-icon\">\r\n {icon}\r\n </div>\r\n {props.badge &&\r\n <div className=\"components-badge\">\r\n {badge}\r\n </div>\r\n }\r\n <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 >\r\n <PopupItemsPanel groupItem={props.groupItem} activateOnPointerUp={true} />\r\n </PopupItemPopup>\r\n </ToolbarPopupContext.Provider>\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport function toToolbarPopupRelativePosition(expandsTo: Direction, alignment: ToolbarPanelAlignment): RelativePosition {\r\n // istanbul ignore next\r\n switch (expandsTo) {\r\n case Direction.Bottom: {\r\n if (alignment === ToolbarPanelAlignment.End)\r\n return RelativePosition.BottomRight;\r\n return RelativePosition.BottomLeft;\r\n }\r\n case Direction.Left:\r\n return RelativePosition.LeftTop;\r\n case Direction.Right:\r\n return RelativePosition.RightTop;\r\n case Direction.Top:\r\n return RelativePosition.Top;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PopupItemWithDrag.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAgB,uBAAuB,EAAE,sBAAsB,EAAe,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3J,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,sCAAsC,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAC/H,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAUlD,SAAS,mBAAmB,CAAC,IAAiB;IAC5C,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,KAAK,EAAE;QAClC,uBAAuB;QACvB,IAAI,oBAAoB,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE;YAClD,IAAI,SAAS,CAAC,QAAQ;gBACpB,OAAO,SAAS,CAAC;SACpB;aAAM,IAAI,oBAAoB,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YACxD,MAAM,WAAW,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;YACnD,IAAI,WAAW;gBACb,OAAO,WAAW,CAAC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,qBAAqB,CAAC,GAAG;gBACzC,OAAO,gBAAgB,CAAC,WAAW,CAAC;YACtC,OAAO,gBAAgB,CAAC,UAAU,CAAC;SACpC;QACD,KAAK,SAAS,CAAC,IAAI;YACjB,OAAO,gBAAgB,CAAC,OAAO,CAAC;QAClC,KAAK,SAAS,CAAC,KAAK;YAClB,OAAO,gBAAgB,CAAC,QAAQ,CAAC;QACnC,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 Toolbar\r\n */\r\n\r\nimport \"./PopupItem.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ActionButton, ConditionalBooleanValue, ConditionalStringValue, GroupButton, RelativePosition, ToolbarItemUtilities } from \"@itwin/appui-abstract\";\r\nimport { BadgeUtilities, IconHelper, useRefState } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItemProps } from \"./Item\";\r\nimport { PopupItemPopup, ToolbarPopupContext } from \"./PopupItem\";\r\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\r\nimport { ToolbarPanelAlignment, useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { useDragInteraction } from \"./useDragInteraction\";\r\nimport { Direction } from \"./utilities/Direction\";\r\n\r\n/** Properties of [[PopupItem]] component.\r\n * @public\r\n */\r\nexport interface PopupItemWithDragProps extends ToolbarButtonItemProps {\r\n /** Panel of the toolbar. */\r\n groupItem: GroupButton;\r\n}\r\n\r\nfunction tryFindActiveAction(item: GroupButton): ActionButton | undefined {\r\n for (const childItem of item.items) {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n if (childItem.isActive)\r\n return childItem;\r\n } else if (ToolbarItemUtilities.isGroupButton(childItem)) {\r\n const nestedChild = tryFindActiveAction(childItem);\r\n if (nestedChild)\r\n return nestedChild;\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getFirstAvailableChildActionItem(item: GroupButton): ActionButton | undefined {\r\n for (const childItem of item.items) {\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n return childItem;\r\n } else {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isGroupButton(childItem)) {\r\n const nestedChild = getFirstAvailableChildActionItem(childItem);\r\n // istanbul ignore else\r\n if (nestedChild)\r\n return nestedChild;\r\n }\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getActiveAction(item: GroupButton): ActionButton | undefined {\r\n const activeItem = tryFindActiveAction(item);\r\n if (activeItem)\r\n return activeItem;\r\n\r\n // initially look only in root items\r\n for (const childItem of item.items) {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n return childItem;\r\n }\r\n }\r\n\r\n // if not found look inside groups\r\n return getFirstAvailableChildActionItem(item);\r\n}\r\n\r\n/** Expandable Group button Item\r\n * @public\r\n */\r\nexport function PopupItemWithDrag(props: PopupItemWithDragProps) {\r\n const [isPanelShown, setPanelShown] = React.useState(false);\r\n const [activeAction, setActiveAction] = React.useState(getActiveAction(props.groupItem));\r\n const { expandsTo, overflowExpandsTo, panelAlignment, onPopupPanelOpenClose } = useToolbarWithOverflowDirectionContext();\r\n\r\n React.useEffect(() => {\r\n const newActiveAction = getActiveAction(props.groupItem);\r\n // istanbul ignore else\r\n if (newActiveAction) {\r\n // istanbul ignore next\r\n if (newActiveAction.isActive) {\r\n setActiveAction(newActiveAction);\r\n } else {\r\n if (activeAction && activeAction.isActive) {\r\n setActiveAction({ ...activeAction, isActive: false });\r\n }\r\n }\r\n }\r\n }, [props.groupItem, activeAction]);\r\n\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 popup panel\r\n const onOpenPanel = React.useCallback(() => {\r\n processPanelOpenClose(!isPanelShown);\r\n }, [isPanelShown, processPanelOpenClose]);\r\n\r\n // handle open and closing popup panel\r\n const onGroupButtonClick = React.useCallback(() => {\r\n // only execute action if not disabled\r\n activeAction && !ConditionalBooleanValue.getValue(activeAction.isDisabled) && activeAction.execute();\r\n }, [activeAction]);\r\n\r\n const badge = activeAction ? BadgeUtilities.getComponentForBadgeType(activeAction.badgeType) : props.badge;\r\n const icon = activeAction ? IconHelper.getIconReactNode(activeAction.icon, activeAction.internalData) : props.icon;\r\n const title = activeAction ? ConditionalStringValue.getValue(activeAction.label) : props.title;\r\n const isActive = activeAction ? activeAction.isActive : props.isActive;\r\n const isDisabled = ConditionalBooleanValue.getValue(activeAction ? activeAction.isDisabled : props.isDisabled);\r\n\r\n const { handlePointerDown, handleButtonClick } = useDragInteraction(onGroupButtonClick, onOpenPanel);\r\n\r\n const className = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-toolbar-expandable-button\",\r\n isActive && \"components-active\",\r\n isDisabled && \"components-disabled-drag\",\r\n props.className);\r\n\r\n const [targetRef, target] = useRefState<HTMLButtonElement>();\r\n const handleClose = React.useCallback(() => {\r\n processPanelOpenClose(false);\r\n }, [processPanelOpenClose]);\r\n const { hasOverflow } = useToolItemEntryContext();\r\n const expandsToDirection = hasOverflow ? /* istanbul ignore next */ overflowExpandsTo : expandsTo;\r\n\r\n return (\r\n <ToolbarPopupContext.Provider value={{\r\n closePanel: /* istanbul ignore next */ () => processPanelOpenClose(false),\r\n setSelectedItem: /* istanbul ignore next */ (buttonItem: ActionButton) => setActiveAction(buttonItem),\r\n }\r\n }>\r\n <button\r\n data-item-id={props.itemId}\r\n data-item-type=\"action-tool-button\"\r\n data-item-group-priority={props.groupPriority}\r\n data-item-priority={props.itemPriority}\r\n data-item-provider-id={props.providerId}\r\n ref={targetRef}\r\n onPointerDown={handlePointerDown}\r\n onClick={handleButtonClick}\r\n onKeyDown={props.onKeyDown}\r\n className={className}\r\n style={props.style}\r\n title={title}\r\n >\r\n <div className=\"components-icon\">\r\n {icon}\r\n </div>\r\n {props.badge &&\r\n <div className=\"components-badge\">\r\n {badge}\r\n </div>\r\n }\r\n <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 >\r\n <PopupItemsPanel groupItem={props.groupItem} activateOnPointerUp={true} />\r\n </PopupItemPopup>\r\n </ToolbarPopupContext.Provider>\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport function toToolbarPopupRelativePosition(expandsTo: Direction, alignment: ToolbarPanelAlignment): RelativePosition {\r\n // istanbul ignore next\r\n switch (expandsTo) {\r\n case Direction.Bottom: {\r\n if (alignment === ToolbarPanelAlignment.End)\r\n return RelativePosition.BottomRight;\r\n return RelativePosition.BottomLeft;\r\n }\r\n case Direction.Left:\r\n return RelativePosition.LeftTop;\r\n case Direction.Right:\r\n return RelativePosition.RightTop;\r\n case Direction.Top:\r\n return RelativePosition.Top;\r\n }\r\n}\r\n"]}
|
|
@@ -28,8 +28,8 @@ export function Toolbar(props) {
|
|
|
28
28
|
const panelAlignment = props.panelAlignment ? props.panelAlignment : ToolbarPanelAlignment.Start;
|
|
29
29
|
const [popupPanelCount, setPopupPanelCount] = React.useState(0);
|
|
30
30
|
const handlePopupPanelOpenClose = React.useCallback((isOpening) => {
|
|
31
|
-
// use
|
|
32
|
-
|
|
31
|
+
// use setTimeout to avoid warning about setting state in Toolbar from render method of PopupItem/PopupItemWithDrag
|
|
32
|
+
setTimeout(() => {
|
|
33
33
|
setPopupPanelCount((prev) => {
|
|
34
34
|
const nextCount = isOpening ? (prev + 1) : (prev - 1);
|
|
35
35
|
// eslint-disable-next-line no-console
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AACxB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAsBzL,SAAS,mBAAmB,CAAC,KAAsB;IACjD,uBAAuB;IACvB,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;QAC/B,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,iBAAiB;YAC9C,OAAO,0CAA0C,CAAC;KACrD;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,KAAmB;IACzC,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;IACvE,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;IACtD,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC;IACjG,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAA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,kBAAkB,EAC5B,SAAS,EAAE,SAAS,IAEnB,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,6BAAK,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,gBAAgB,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,IAAG,KAAK,CAAO,CAAC,CACxH,CACX,CAEoB,CACgB,CACjD,CAAC;AACJ,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 CommonToolbarItem, OnItemExecutedFunc,\r\n} from \"@itwin/appui-abstract\";\r\nimport { CommonProps, NoChildrenProps } from \"@itwin/core-react\";\r\nimport { ToolbarItems } from \"./Items\";\r\nimport { Direction, OrthogonalDirection, OrthogonalDirectionHelpers } from \"./utilities/Direction\";\r\nimport { getToolbarDirection, ToolbarItemComponent, ToolbarItemContext, ToolbarOpacitySetting, ToolbarPanelAlignment, ToolbarWithOverflowDirectionContext } from \"./ToolbarWithOverflow\";\r\n\r\n/** Properties of [[Toolbar]] component.\r\n * @public\r\n */\r\nexport interface ToolbarProps extends CommonProps, NoChildrenProps {\r\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\r\n expandsTo?: 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\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 \"\";\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 Toolbar(props: ToolbarProps) {\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 [popupPanelCount, setPopupPanelCount] = React.useState(0);\r\n\r\n const handlePopupPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n // use setTimeout to avoid warning about setting state in Toolbar from render method of PopupItem/PopupItemWithDrag\r\n setTimeout(() => {\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 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\r\n const direction = getToolbarDirection(expandsTo);\r\n const className = classnames(\r\n \"components-toolbar-overflow-sizer\",\r\n OrthogonalDirectionHelpers.getCssClassName(direction),\r\n props.className);\r\n\r\n // needed to construct DOM structure identical to ToolbarWithOverflow so same css can be applied.\r\n const wrapperClassName = classnames(\r\n \"components-toolbar-item-container\",\r\n OrthogonalDirectionHelpers.getCssClassName(direction),\r\n );\r\n\r\n return (\r\n <ToolbarWithOverflowDirectionContext.Provider value={\r\n {\r\n expandsTo, direction, overflowExpandsTo: Direction.Right, panelAlignment, useDragInteraction,\r\n toolbarOpacitySetting: props.toolbarOpacitySetting ? props.toolbarOpacitySetting : ToolbarOpacitySetting.Proximity,\r\n overflowDirection: OrthogonalDirection.Horizontal,\r\n openPopupCount: popupPanelCount, onPopupPanelOpenClose: handlePopupPanelOpenClose, overflowDisplayActive: false,\r\n onItemExecuted: props.onItemExecuted ? props.onItemExecuted : /* istanbul ignore next */ () => { },\r\n onKeyDown: props.onKeyDown ? props.onKeyDown : /* istanbul ignore next */ (_e: React.KeyboardEvent) => { },\r\n }\r\n }>\r\n <ToolbarItemContext.Provider\r\n value={{\r\n hasOverflow: false,\r\n useHeight: false,\r\n onResize: /* istanbul ignore next */ () => { },\r\n }}\r\n >\r\n {(availableNodes.length > 0) &&\r\n <div\r\n className={className}\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 {availableNodes.map((child, index) => <div key={index} className={`${wrapperClassName} ${getItemWrapperClass(child)}`}>{child}</div>)}\r\n </ToolbarItems>\r\n </div>\r\n }\r\n </ToolbarItemContext.Provider>\r\n </ToolbarWithOverflowDirectionContext.Provider >\r\n );\r\n}\r\n"]}
|
|
@@ -192,8 +192,8 @@ export function ToolbarWithOverflow(props) {
|
|
|
192
192
|
};
|
|
193
193
|
});
|
|
194
194
|
const handlePopupPanelOpenClose = React.useCallback((isOpening) => {
|
|
195
|
-
// use
|
|
196
|
-
|
|
195
|
+
// use setTimeout to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag
|
|
196
|
+
setTimeout(() => {
|
|
197
197
|
// istanbul ignore next
|
|
198
198
|
if (!isMounted.current)
|
|
199
199
|
return;
|
|
@@ -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,OAAO,gBAAgB,CAAC;AACxB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAC4B,uBAAuB,EAAE,sBAAsB,EAC/C,oBAAoB,GACtD,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAe,UAAU,EAAmB,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAe/C;;;GAGG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC,aAAa,CAAU,KAAK,CAAC,CAAC;AAE/E;;;GAGG;AACH,MAAM,UAAU,8BAA8B;IAC5C,OAAO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C,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
|
+
{"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,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAC4B,uBAAuB,EAAE,sBAAsB,EAC/C,oBAAoB,GACtD,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAe,UAAU,EAAmB,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,E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;AAWD;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAyB,IAAK,CAAC,CAAC;AAErF,gBAAgB;AAChB,MAAM,UAAU,uBAAuB;IACrC,OAAO,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAC9C,CAAC;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 setTimeout to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag\r\n setTimeout(() => {\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"]}
|
|
@@ -26,7 +26,7 @@ export function GroupTool(props) {
|
|
|
26
26
|
if (!props.isDisabled && props.onPointerUp)
|
|
27
27
|
props.onPointerUp(props.item);
|
|
28
28
|
}, [props]);
|
|
29
|
-
return (React.createElement("div", { className: itemClassName, onClick: handleClick, onKeyDown: props.onKeyDown, onPointerUp: handlePointerUp, "data-item-id": props.item.id, "data-item-type": "popup-tool-panel-item", "data-item-priority": props.item.itemPriority, "data-item-
|
|
29
|
+
return (React.createElement("div", { className: itemClassName, onClick: handleClick, onKeyDown: props.onKeyDown, onPointerUp: handlePointerUp, "data-item-id": props.item.id, "data-item-type": "popup-tool-panel-item", "data-item-priority": props.item.itemPriority, "data-item-provider-id": props.item.providerId, ref: ref, style: props.style, role: "button", tabIndex: 0 },
|
|
30
30
|
React.createElement("div", { className: "components-icon" },
|
|
31
31
|
props.icon,
|
|
32
32
|
props.bad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G,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC7C,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,WAAW;YACxC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,6BACE,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,WAAW,EAAE,eAAe,kBACd,KAAK,CAAC,IAAI,CAAC,EAAE,oBACZ,uBAAuB,wBAClB,KAAK,CAAC,IAAI,CAAC,YAAY,2BACpB,KAAK,CAAC,IAAI,CAAC,UAAU,EAC5C,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC;QAEX,6BAAK,SAAS,EAAC,iBAAiB;YAC7B,KAAK,CAAC,IAAI;YACV,KAAK,CAAC,KAAK;gBACV,6BAAK,SAAS,EAAC,kBAAkB,IAC9B,KAAK,CAAC,KAAK,CACR,CAEJ;QACN,6BAAK,SAAS,EAAC,kBAAkB,IAC9B,KAAK,CAAC,KAAK,CACR;QACL,KAAK,CAAC,QAAQ,CACX,CACP,CAAC;AACJ,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 \"./Tool.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ActionButton, GroupButton } from \"@itwin/appui-abstract\";\r\nimport { CommonProps, useTargeted } from \"@itwin/core-react\";\r\n\r\n/** Properties of [[GroupTool]] component.\r\n * @internal\r\n */\r\nexport interface GroupToolProps extends CommonProps {\r\n /** Additional content, besides icon and label. */\r\n children?: React.ReactNode;\r\n /** Tool icon. */\r\n icon?: React.ReactNode;\r\n /** Describes if the item is active. */\r\n isActive?: boolean;\r\n /** Describes if the item is disabled. */\r\n isDisabled?: boolean;\r\n /** Describes if the item is focused. */\r\n isFocused?: boolean;\r\n /** Tool label. */\r\n label?: string;\r\n /** Function called when the item is clicked. */\r\n onClick?: (item: GroupButton | ActionButton) => void;\r\n /** Function called when pointer up event is received. */\r\n onPointerUp?: (item: GroupButton | ActionButton) => void;\r\n /** A badge to draw. */\r\n badge?: React.ReactNode;\r\n /** GroupButton item */\r\n item: GroupButton | ActionButton;\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/** Tool entry of tool group panel. Used in [[GroupColumn]].\r\n * @internal\r\n */\r\nexport function GroupTool(props: GroupToolProps) {\r\n const ref = React.useRef<HTMLDivElement>(null);\r\n const targeted = useTargeted(ref);\r\n const itemClassName = classnames(\r\n \"components-toolbar-item-expandable-group-tool-item\",\r\n props.isActive && \"components-active\",\r\n props.isFocused && \"components-focused\",\r\n props.isDisabled && \"components-disabled\",\r\n props.onPointerUp && \"components-pointer-up\",\r\n targeted && \"components-targeted\",\r\n props.className);\r\n\r\n const handleClick = React.useCallback(() => {\r\n // istanbul ignore else\r\n if (!props.isDisabled && props.onClick)\r\n props.onClick(props.item);\r\n }, [props]);\r\n\r\n const handlePointerUp = React.useCallback(() => {\r\n // istanbul ignore else\r\n if (!props.isDisabled && props.onPointerUp)\r\n props.onPointerUp(props.item);\r\n }, [props]);\r\n\r\n return (\r\n <div\r\n className={itemClassName}\r\n onClick={handleClick}\r\n onKeyDown={props.onKeyDown}\r\n onPointerUp={handlePointerUp}\r\n data-item-id={props.item.id}\r\n data-item-type=\"popup-tool-panel-item\"\r\n data-item-priority={props.item.itemPriority}\r\n data-item-provider-id={props.item.providerId}\r\n ref={ref}\r\n style={props.style}\r\n role=\"button\"\r\n tabIndex={0}\r\n >\r\n <div className=\"components-icon\">\r\n {props.icon}\r\n {props.badge &&\r\n <div className=\"components-badge\">\r\n {props.badge}\r\n </div>\r\n }\r\n </div>\r\n <div className=\"components-label\">\r\n {props.label}\r\n </div>\r\n {props.children}\r\n </div>\r\n );\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/components-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0-dev.0",
|
|
4
4
|
"description": "iTwin.js UI complex components",
|
|
5
5
|
"main": "lib/cjs/components-react.js",
|
|
6
6
|
"module": "lib/esm/components-react.js",
|
|
7
7
|
"typings": "lib/cjs/components-react",
|
|
8
|
-
"imodeljsSharedLibrary": true,
|
|
9
8
|
"license": "MIT",
|
|
10
9
|
"repository": {
|
|
11
10
|
"type": "git",
|
|
@@ -21,9 +20,9 @@
|
|
|
21
20
|
"url": "http://www.bentley.com"
|
|
22
21
|
},
|
|
23
22
|
"peerDependencies": {
|
|
24
|
-
"@itwin/appui-abstract": "^3.
|
|
25
|
-
"@itwin/core-bentley": "^3.
|
|
26
|
-
"@itwin/core-react": "^3.
|
|
23
|
+
"@itwin/appui-abstract": "^3.3.0-dev.0",
|
|
24
|
+
"@itwin/core-bentley": "^3.3.0-dev.0",
|
|
25
|
+
"@itwin/core-react": "^3.3.0-dev.0",
|
|
27
26
|
"react": "^17.0.0",
|
|
28
27
|
"react-dom": "^17.0.0"
|
|
29
28
|
},
|
|
@@ -32,13 +31,14 @@
|
|
|
32
31
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
33
32
|
],
|
|
34
33
|
"devDependencies": {
|
|
35
|
-
"@itwin/appui-abstract": "3.
|
|
36
|
-
"@itwin/build-tools": "3.
|
|
37
|
-
"@itwin/core-bentley": "3.
|
|
38
|
-
"@itwin/core-common": "3.
|
|
39
|
-
"@itwin/core-i18n": "3.
|
|
40
|
-
"@itwin/core-react": "3.
|
|
41
|
-
"@itwin/eslint-plugin": "3.
|
|
34
|
+
"@itwin/appui-abstract": "3.3.0-dev.0",
|
|
35
|
+
"@itwin/build-tools": "3.3.0-dev.0",
|
|
36
|
+
"@itwin/core-bentley": "3.3.0-dev.0",
|
|
37
|
+
"@itwin/core-common": "3.3.0-dev.0",
|
|
38
|
+
"@itwin/core-i18n": "3.3.0-dev.0",
|
|
39
|
+
"@itwin/core-react": "3.3.0-dev.0",
|
|
40
|
+
"@itwin/eslint-plugin": "3.3.0-dev.0",
|
|
41
|
+
"@testing-library/dom": "^8.11.2",
|
|
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",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"@types/linkify-it": "~2.1.0",
|
|
53
53
|
"@types/lodash": "^4.14.0",
|
|
54
54
|
"@types/mocha": "^8.2.2",
|
|
55
|
+
"@types/node": "16.11.7",
|
|
55
56
|
"@types/react": "^17.0.37",
|
|
56
57
|
"@types/react-data-grid": "4.0.2",
|
|
57
58
|
"@types/react-dom": "^17.0.0",
|
|
@@ -72,6 +73,7 @@
|
|
|
72
73
|
"eslint": "^7.11.0",
|
|
73
74
|
"faker": "^4.1.0",
|
|
74
75
|
"ignore-styles": "^5.0.1",
|
|
76
|
+
"jsdom": "^19.0.0",
|
|
75
77
|
"jsdom-global": "3.0.2",
|
|
76
78
|
"mocha": "^8.3.2",
|
|
77
79
|
"nyc": "^15.1.0",
|
|
@@ -84,7 +86,7 @@
|
|
|
84
86
|
"rimraf": "^3.0.2",
|
|
85
87
|
"sinon": "^9.0.2",
|
|
86
88
|
"sinon-chai": "^3.2.0",
|
|
87
|
-
"ts-node": "^
|
|
89
|
+
"ts-node": "^10.4.0",
|
|
88
90
|
"typemoq": "^2.1.0",
|
|
89
91
|
"typescript": "~4.4.0",
|
|
90
92
|
"xmlhttprequest": "^1.8.0"
|
|
@@ -95,7 +97,7 @@
|
|
|
95
97
|
],
|
|
96
98
|
"dependencies": {
|
|
97
99
|
"@bentley/icons-generic-webfont": "^1.0.15",
|
|
98
|
-
"@itwin/itwinui-css": "0.
|
|
100
|
+
"@itwin/itwinui-css": "0.x",
|
|
99
101
|
"@itwin/itwinui-react": "^1.32.0",
|
|
100
102
|
"@types/shortid": "~0.0.29",
|
|
101
103
|
"callable-instance2": "1.0.0",
|