@itwin/components-react 4.3.0 → 4.4.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.
Files changed (125) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +23 -9
  3. package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
  4. package/lib/cjs/components-react/filter-builder/FilterBuilder.js +19 -8
  5. package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -1
  6. package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts +8 -5
  7. package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -1
  8. package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js +40 -18
  9. package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js.map +1 -1
  10. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
  11. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +7 -4
  12. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
  13. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +8 -1
  14. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
  15. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +3 -2
  16. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
  17. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +1 -1
  18. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  19. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts +11 -2
  20. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
  21. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +2 -3
  22. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  23. package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +49 -10
  24. package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
  25. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +106 -13
  26. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  27. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts +144 -0
  28. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -0
  29. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +550 -0
  30. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -0
  31. package/lib/cjs/components-react/toolbar/ItemWrapper.js +3 -3
  32. package/lib/cjs/components-react/toolbar/ItemWrapper.js.map +1 -1
  33. package/lib/cjs/components-react/toolbar/Items.js +5 -5
  34. package/lib/cjs/components-react/toolbar/Items.js.map +1 -1
  35. package/lib/cjs/components-react/toolbar/Overflow.js +3 -3
  36. package/lib/cjs/components-react/toolbar/Overflow.js.map +1 -1
  37. package/lib/cjs/components-react/toolbar/OverflowPanel.js +5 -5
  38. package/lib/cjs/components-react/toolbar/OverflowPanel.js.map +1 -1
  39. package/lib/cjs/components-react/toolbar/PopupItem.js +4 -4
  40. package/lib/cjs/components-react/toolbar/PopupItem.js.map +1 -1
  41. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts +1 -1
  42. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
  43. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +4 -4
  44. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  45. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js +2 -2
  46. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  47. package/lib/cjs/components-react/toolbar/Toolbar.d.ts +2 -2
  48. package/lib/cjs/components-react/toolbar/Toolbar.d.ts.map +1 -1
  49. package/lib/cjs/components-react/toolbar/Toolbar.js +2 -69
  50. package/lib/cjs/components-react/toolbar/Toolbar.js.map +1 -1
  51. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts +5 -105
  52. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
  53. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js +6 -481
  54. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  55. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.d.ts +14 -0
  56. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.d.ts.map +1 -0
  57. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js +119 -0
  58. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -0
  59. package/lib/cjs/components-react.d.ts +6 -2
  60. package/lib/cjs/components-react.d.ts.map +1 -1
  61. package/lib/cjs/components-react.js +6 -2
  62. package/lib/cjs/components-react.js.map +1 -1
  63. package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +23 -9
  64. package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
  65. package/lib/esm/components-react/filter-builder/FilterBuilder.js +17 -7
  66. package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -1
  67. package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts +8 -5
  68. package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -1
  69. package/lib/esm/components-react/filter-builder/FilterBuilderContext.js +40 -18
  70. package/lib/esm/components-react/filter-builder/FilterBuilderContext.js.map +1 -1
  71. package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
  72. package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +8 -5
  73. package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
  74. package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +8 -1
  75. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
  76. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +3 -2
  77. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
  78. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +1 -1
  79. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  80. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts +11 -2
  81. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
  82. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +2 -3
  83. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  84. package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +49 -10
  85. package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
  86. package/lib/esm/components-react/filter-builder/FilterBuilderState.js +99 -7
  87. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  88. package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts +144 -0
  89. package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -0
  90. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +514 -0
  91. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -0
  92. package/lib/esm/components-react/toolbar/ItemWrapper.js +1 -1
  93. package/lib/esm/components-react/toolbar/ItemWrapper.js.map +1 -1
  94. package/lib/esm/components-react/toolbar/Items.js +1 -1
  95. package/lib/esm/components-react/toolbar/Items.js.map +1 -1
  96. package/lib/esm/components-react/toolbar/Overflow.js +1 -1
  97. package/lib/esm/components-react/toolbar/Overflow.js.map +1 -1
  98. package/lib/esm/components-react/toolbar/OverflowPanel.js +1 -1
  99. package/lib/esm/components-react/toolbar/OverflowPanel.js.map +1 -1
  100. package/lib/esm/components-react/toolbar/PopupItem.js +1 -1
  101. package/lib/esm/components-react/toolbar/PopupItem.js.map +1 -1
  102. package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts +1 -1
  103. package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
  104. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +1 -1
  105. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  106. package/lib/esm/components-react/toolbar/PopupItemsPanel.js +1 -1
  107. package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  108. package/lib/esm/components-react/toolbar/Toolbar.d.ts +2 -2
  109. package/lib/esm/components-react/toolbar/Toolbar.d.ts.map +1 -1
  110. package/lib/esm/components-react/toolbar/Toolbar.js +2 -66
  111. package/lib/esm/components-react/toolbar/Toolbar.js.map +1 -1
  112. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts +5 -105
  113. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
  114. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js +5 -471
  115. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  116. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.d.ts +14 -0
  117. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.d.ts.map +1 -0
  118. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js +92 -0
  119. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -0
  120. package/lib/esm/components-react.d.ts +6 -2
  121. package/lib/esm/components-react.d.ts.map +1 -1
  122. package/lib/esm/components-react.js +6 -2
  123. package/lib/esm/components-react.js.map +1 -1
  124. package/lib/public/locales/en/UiComponents.json +4 -1
  125. package/package.json +8 -9
@@ -29,495 +29,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
29
29
  __setModuleDefault(result, mod);
30
30
  return result;
31
31
  };
32
- var __importDefault = (this && this.__importDefault) || function (mod) {
33
- return (mod && mod.__esModule) ? mod : { "default": mod };
34
- };
35
32
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.useToolItemEntryContext = exports.ToolbarItemContext = exports.ToolbarWithOverflow = exports.useToolbarWithOverflowDirectionContext = exports.ToolbarItemComponent = exports.ToolbarWithOverflowDirectionContext = exports.ToolbarPanelAlignmentHelpers = exports.ToolbarOpacitySetting = exports.ToolbarPanelAlignment = exports.getToolbarDirection = exports.isCustomToolbarItem = exports.useToolbarPopupAutoHideContext = exports.ToolbarPopupAutoHideContext = void 0;
33
+ exports.ToolbarWithOverflow = void 0;
37
34
  require("./Toolbar.scss");
38
- const classnames_1 = __importDefault(require("classnames"));
39
35
  const React = __importStar(require("react"));
40
- const appui_abstract_1 = require("@itwin/appui-abstract");
41
- const core_react_1 = require("@itwin/core-react");
42
- const Item_1 = require("./Item");
43
- const Items_1 = require("./Items");
44
- const ItemWrapper_1 = require("./ItemWrapper");
45
- const Overflow_1 = require("./Overflow");
46
- const OverflowPanel_1 = require("./OverflowPanel");
47
- const PopupItem_1 = require("./PopupItem");
48
- const PopupItemsPanel_1 = require("./PopupItemsPanel");
49
- const PopupItemWithDrag_1 = require("./PopupItemWithDrag");
50
- const Direction_1 = require("./utilities/Direction");
51
- const UiComponents_1 = require("../UiComponents");
52
- const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
53
- /**
54
- * Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.
55
- * @public
56
- */
57
- exports.ToolbarPopupAutoHideContext = React.createContext(false);
58
- /**
59
- * React hook used to retrieve the ToolbarPopupAutoHideContext.
60
- * @public
61
- */
62
- function useToolbarPopupAutoHideContext() {
63
- return React.useContext(exports.ToolbarPopupAutoHideContext);
64
- }
65
- exports.useToolbarPopupAutoHideContext = useToolbarPopupAutoHideContext;
66
- /** CustomToolbarItem type guard.
67
- * @internal
68
- */
69
- function isCustomToolbarItem(
70
- // eslint-disable-next-line deprecation/deprecation
71
- item
72
- // eslint-disable-next-line deprecation/deprecation
73
- ) {
74
- return !!item.isCustom && "panelContentNode" in item; // eslint-disable-line deprecation/deprecation
75
- }
76
- exports.isCustomToolbarItem = isCustomToolbarItem;
77
- /** @internal */
78
- const getToolbarDirection = (expandsTo) => {
79
- const orthogonalDirection = Direction_1.DirectionHelpers.getOrthogonalDirection(expandsTo);
80
- return Direction_1.OrthogonalDirectionHelpers.inverse(orthogonalDirection);
81
- };
82
- exports.getToolbarDirection = getToolbarDirection;
83
- /** Available alignment modes of [[Toolbar]] panels.
84
- * @public
85
- */
86
- var ToolbarPanelAlignment;
87
- (function (ToolbarPanelAlignment) {
88
- ToolbarPanelAlignment[ToolbarPanelAlignment["Start"] = 0] = "Start";
89
- ToolbarPanelAlignment[ToolbarPanelAlignment["End"] = 1] = "End";
90
- })(ToolbarPanelAlignment = exports.ToolbarPanelAlignment || (exports.ToolbarPanelAlignment = {}));
91
- /** Enumeration of Toolbar Opacity setting.
92
- * @public
93
- */
94
- var ToolbarOpacitySetting;
95
- (function (ToolbarOpacitySetting) {
96
- /** Use the default background, box-shadow opacity and backdrop-filter blur */
97
- ToolbarOpacitySetting[ToolbarOpacitySetting["Defaults"] = 0] = "Defaults";
98
- /** Alter the opacity from transparent to the defaults based on mouse proximity */
99
- ToolbarOpacitySetting[ToolbarOpacitySetting["Proximity"] = 1] = "Proximity";
100
- /** Use a transparent background, box-shadow opacity and backdrop-filter blur */
101
- ToolbarOpacitySetting[ToolbarOpacitySetting["Transparent"] = 2] = "Transparent";
102
- })(ToolbarOpacitySetting = exports.ToolbarOpacitySetting || (exports.ToolbarOpacitySetting = {}));
103
- /** Helpers for [[ToolbarPanelAlignment]].
104
- * @internal
105
- */
106
- class ToolbarPanelAlignmentHelpers {
107
- /** @returns Class name of specified [[ToolbarPanelAlignment]] */
108
- static getCssClassName(panelAlignment) {
109
- switch (panelAlignment) {
110
- case ToolbarPanelAlignment.Start:
111
- return ToolbarPanelAlignmentHelpers.START_CLASS_NAME;
112
- case ToolbarPanelAlignment.End:
113
- return ToolbarPanelAlignmentHelpers.END_CLASS_NAME;
114
- }
115
- }
116
- }
117
- /** Class name of [[ToolbarPanelAlignment.Start]] */
118
- ToolbarPanelAlignmentHelpers.START_CLASS_NAME = "components-panel-alignment-start";
119
- /** Class name of [[ToolbarPanelAlignment.End]] */
120
- ToolbarPanelAlignmentHelpers.END_CLASS_NAME = "components-panel-alignment-end";
121
- exports.ToolbarPanelAlignmentHelpers = ToolbarPanelAlignmentHelpers;
122
- /**
123
- * Context used by Toolbar component to provide Direction to child components.
124
- * @internal
125
- */
126
- exports.ToolbarWithOverflowDirectionContext = React.createContext({
127
- expandsTo: Direction_1.Direction.Bottom,
128
- direction: Direction_1.OrthogonalDirection.Horizontal,
129
- overflowExpandsTo: Direction_1.Direction.Right,
130
- overflowDirection: Direction_1.OrthogonalDirection.Vertical,
131
- panelAlignment: ToolbarPanelAlignment.Start,
132
- useDragInteraction: false,
133
- toolbarOpacitySetting: ToolbarOpacitySetting.Proximity,
134
- openPopupCount: 0,
135
- onPopupPanelOpenClose: /* istanbul ignore next */ (_isOpening) => { },
136
- overflowDisplayActive: false,
137
- onItemExecuted: /* istanbul ignore next */ (_item) => void {},
138
- onKeyDown: /* istanbul ignore next */ (_e) => void {},
139
- });
140
- /** @internal */
141
- function CustomItem({ item, addGroupSeparator, }) {
142
- const { useDragInteraction } = useToolbarWithOverflowDirectionContext();
143
- const icon = React.useMemo(() => (item.icon &&
144
- core_react_1.IconHelper.getIconReactNode(item.icon, item.internalData)) || (
145
- // istanbul ignore next
146
- React.createElement(core_react_1.Icon, { className: "icon", iconSpec: React.createElement(itwinui_icons_react_1.SvgPlaceholder, null) })), [item.icon, item.internalData]);
147
- const isDisabled = React.useMemo(() => appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled), [item.isDisabled]);
148
- const title = React.useMemo(() => {
149
- var _a;
150
- /* istanbul ignore next */ return (_a = appui_abstract_1.ConditionalStringValue.getValue(item.label)) !== null && _a !== void 0 ? _a : item.id;
151
- }, [item.id, item.label]);
152
- const badge = React.useMemo(() => core_react_1.BadgeUtilities.getComponentForBadgeType(item.badgeType), [item.badgeType]);
153
- return (React.createElement(PopupItem_1.PopupItem, { key: item.id, itemId: item.id, icon: icon, isDisabled: isDisabled, title: title, panel: item.panelContentNode, hideIndicator: useDragInteraction, badge: badge, addGroupSeparator: addGroupSeparator, keepContentsMounted: item.keepContentsLoaded }));
154
- }
155
- /** @internal */
156
- function GroupPopupItem({ item, addGroupSeparator, }) {
157
- const { useDragInteraction } = useToolbarWithOverflowDirectionContext();
158
- const title = appui_abstract_1.ConditionalStringValue.getValue(item.label);
159
- const badge = core_react_1.BadgeUtilities.getComponentForBadgeType(item.badgeType);
160
- const panel = React.useMemo(() => React.createElement(PopupItemsPanel_1.PopupItemsPanel, { groupItem: item, activateOnPointerUp: false }), [item]);
161
- // istanbul ignore next
162
- const providerId = "providerId" in item ? item.providerId : undefined;
163
- if (useDragInteraction) {
164
- return (React.createElement(PopupItemWithDrag_1.PopupItemWithDrag, { key: item.id, itemId: item.id, providerId: providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, icon: core_react_1.IconHelper.getIconReactNode(item.icon, item.internalData), isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled), title: title, groupItem: item, badge: badge, addGroupSeparator: addGroupSeparator }));
165
- }
166
- return (React.createElement(PopupItem_1.PopupItem, { key: item.id, itemId: item.id, providerId: providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, icon: core_react_1.IconHelper.getIconReactNode(item.icon, item.internalData), isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled), title: title, panel: panel, badge: badge, hideIndicator: useDragInteraction, addGroupSeparator: addGroupSeparator }));
167
- }
168
- /** @internal */
169
- function ActionItem({ item, addGroupSeparator, }) {
170
- const title = appui_abstract_1.ConditionalStringValue.getValue(item.label);
171
- const badge = core_react_1.BadgeUtilities.getComponentForBadgeType(item.badgeType);
172
- const { onItemExecuted } = useToolbarWithOverflowDirectionContext();
173
- const onExecute = React.useCallback(() => {
174
- item.execute();
175
- onItemExecuted(item);
176
- }, [item, onItemExecuted]);
177
- // istanbul ignore next
178
- const providerId = "providerId" in item ? item.providerId : undefined;
179
- return (React.createElement(Item_1.ToolbarButtonItem, { itemId: item.id, providerId: providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, key: item.id, isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled), title: title, icon: core_react_1.IconHelper.getIconReactNode(item.icon, item.internalData), isActive: item.isActive, onClick: onExecute, badge: badge, addGroupSeparator: addGroupSeparator }));
180
- }
181
- /** @internal */
182
- function ToolbarItemComponent({ item, addGroupSeparator, }) {
183
- if (appui_abstract_1.ToolbarItemUtilities.isGroupButton(item)) {
184
- return React.createElement(GroupPopupItem, { item: item, addGroupSeparator: addGroupSeparator });
185
- }
186
- else if (isCustomToolbarItem(item)) {
187
- return React.createElement(CustomItem, { item: item, addGroupSeparator: addGroupSeparator });
188
- }
189
- else {
190
- // istanbul ignore else
191
- if (appui_abstract_1.ToolbarItemUtilities.isActionButton(item)) {
192
- return React.createElement(ActionItem, { item: item, addGroupSeparator: addGroupSeparator });
193
- }
194
- }
195
- // istanbul ignore next
196
- return null;
197
- }
198
- exports.ToolbarItemComponent = ToolbarItemComponent;
199
- /** @internal */
200
- function useToolbarWithOverflowDirectionContext() {
201
- return React.useContext(exports.ToolbarWithOverflowDirectionContext);
202
- }
203
- exports.useToolbarWithOverflowDirectionContext = useToolbarWithOverflowDirectionContext;
204
- function OverflowItemsContainer(p) {
205
- return React.createElement(React.Fragment, null, p.children);
206
- }
207
- function getItemWrapperClass(child) {
208
- // istanbul ignore else
209
- if (React.isValidElement(child)) {
210
- if (child.props && child.props.addGroupSeparator)
211
- return "components-toolbar-button-add-gap-before";
212
- }
213
- return undefined;
214
- }
215
- /** Component that displays tool settings as a bar across the top of the content view.
36
+ const InternalToolbarComponent_1 = require("./InternalToolbarComponent");
37
+ /** Component that displays toolbar items, displaying only the elements that can fit in the available space,
38
+ * and put the other items into a single panel.
216
39
  * @public
217
40
  * @deprecated in 4.0. Use [ToolbarWithOverflow]($appui-react) instead.
218
41
  */
219
42
  // eslint-disable-next-line deprecation/deprecation
220
43
  function ToolbarWithOverflow(props) {
221
- const expandsTo = props.expandsTo ? props.expandsTo : Direction_1.Direction.Bottom;
222
- const useDragInteraction = !!props.useDragInteraction;
223
- const panelAlignment = props.panelAlignment
224
- ? props.panelAlignment
225
- : ToolbarPanelAlignment.Start;
226
- const useHeight = expandsTo === Direction_1.Direction.Right || expandsTo === Direction_1.Direction.Left;
227
- const [isOverflowPanelOpen, setIsOverflowPanelOpen] = React.useState(false);
228
- const [popupPanelCount, setPopupPanelCount] = React.useState(0);
229
- const overflowTitle = React.useRef(UiComponents_1.UiComponents.translate("toolbar.overflow"));
230
- const isMounted = React.useRef(false);
231
- React.useEffect(() => {
232
- isMounted.current = true;
233
- return () => {
234
- isMounted.current = false;
235
- };
236
- });
237
- const handlePopupPanelOpenClose = React.useCallback((isOpening) => {
238
- // use setTimeout to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag
239
- setTimeout(() => {
240
- // istanbul ignore next
241
- if (!isMounted.current)
242
- return;
243
- setPopupPanelCount((prev) => {
244
- /* istanbul ignore next */
245
- const nextCount = isOpening ? prev + 1 : prev - 1;
246
- return nextCount < 0 ? /* istanbul ignore next */ 0 : nextCount;
247
- });
248
- });
249
- }, []);
250
- const ref = React.useRef(null);
251
- const width = React.useRef(undefined);
252
- const availableNodes = React.useMemo(() => {
253
- return props.items.map((item, index) => {
254
- let addGroupSeparator = false;
255
- if (index > 0)
256
- addGroupSeparator =
257
- item.groupPriority !== props.items[index - 1].groupPriority;
258
- return (React.createElement(ToolbarItemComponent, { key: item.id, item: item, addGroupSeparator: !!addGroupSeparator }));
259
- });
260
- }, [props.items]);
261
- /* overflowItemKeys - keys of items to show in overflow panel
262
- * handleContainerResize - handler called when container <div> is resized.
263
- * handleOverflowResize - handler called when determining size of overflow indicator/button.
264
- * handleEntryResize - handler called when determining size of each item/button. */
265
- const [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize,] = useOverflow(availableNodes, panelAlignment === ToolbarPanelAlignment.End);
266
- // handler called by ResizeObserver
267
- const handleResize = React.useCallback((w) => {
268
- width.current = w;
269
- width.current !== undefined && handleContainerResize(width.current);
270
- }, [handleContainerResize]);
271
- const resizeObserverRef = (0, ItemWrapper_1.useResizeObserverSingleDimension)(handleResize, useHeight);
272
- const handleClick = React.useCallback(() => {
273
- setIsOverflowPanelOpen((prev) => !prev);
274
- }, []);
275
- // istanbul ignore next - NEEDSWORK add complete tests
276
- const handleClose = React.useCallback(() => {
277
- setIsOverflowPanelOpen(false);
278
- }, []);
279
- const refs = (0, core_react_1.useRefs)(ref, resizeObserverRef);
280
- const availableItems = React.Children.toArray(availableNodes);
281
- const displayedItems = availableItems.reduce((acc, child, index) => {
282
- const key = getChildKey(child, index);
283
- if (!overflowItemKeys || overflowItemKeys.indexOf(key) < 0) {
284
- acc.push([key, child]);
285
- }
286
- return acc;
287
- }, []);
288
- // eslint-disable-next-line react-hooks/exhaustive-deps
289
- const overflowPanelItems = overflowItemKeys
290
- ? availableItems.reduce((acc, child, index) => {
291
- const key = getChildKey(child, index);
292
- if (overflowItemKeys.indexOf(key) >= 0) {
293
- acc.push([key, child]);
294
- }
295
- return acc;
296
- }, [])
297
- : [];
298
- const direction = (0, exports.getToolbarDirection)(expandsTo);
299
- const overflowExpandsTo = undefined !== props.overflowExpandsTo
300
- ? props.overflowExpandsTo
301
- : Direction_1.Direction.Right;
302
- const addOverflowButton = React.useCallback((atStart) => {
303
- const overflowItems = !!atStart
304
- ? overflowPanelItems.reverse()
305
- : overflowPanelItems;
306
- return (React.createElement(exports.ToolbarItemContext.Provider, { value: {
307
- hasOverflow: false,
308
- useHeight,
309
- onResize: handleOverflowResize,
310
- } },
311
- React.createElement(Overflow_1.ToolbarOverflowButton, { expandsTo: expandsTo, onClick: handleClick, onClose: handleClose, open: overflowItems.length > 0 && isOverflowPanelOpen, panelNode: React.createElement(OverflowPanel_1.ToolbarOverflowPanel, null,
312
- React.createElement(OverflowItemsContainer, null, overflowItems.map(([key, child]) => {
313
- return (React.createElement(exports.ToolbarItemContext.Provider, { key: key, value: {
314
- hasOverflow: true,
315
- useHeight,
316
- onResize: () => { },
317
- } }, React.createElement(ItemWrapper_1.ItemWrapper, { className: getItemWrapperClass(child) }, child)));
318
- }))), title: overflowTitle.current })));
319
- }, [
320
- handleClick,
321
- handleClose,
322
- handleOverflowResize,
323
- isOverflowPanelOpen,
324
- expandsTo,
325
- overflowPanelItems,
326
- useHeight,
327
- ]);
328
- const className = (0, classnames_1.default)("components-toolbar-overflow-sizer", Direction_1.OrthogonalDirectionHelpers.getCssClassName(direction), props.className);
329
- const showOverflowAtStart = direction === Direction_1.OrthogonalDirection.Horizontal &&
330
- panelAlignment === ToolbarPanelAlignment.End;
331
- /* The ItemWrapper is used to wrap the <Item> <ExpandableItem> with a <div> that specifies a ref that the sizing logic uses to determine the
332
- size of the item. */
333
- return (React.createElement(exports.ToolbarWithOverflowDirectionContext.Provider, { value: {
334
- expandsTo,
335
- direction,
336
- overflowExpandsTo,
337
- panelAlignment,
338
- useDragInteraction,
339
- toolbarOpacitySetting: undefined !== props.toolbarOpacitySetting
340
- ? props.toolbarOpacitySetting
341
- : ToolbarOpacitySetting.Proximity,
342
- overflowDirection: direction === Direction_1.OrthogonalDirection.Horizontal
343
- ? Direction_1.OrthogonalDirection.Vertical
344
- : Direction_1.OrthogonalDirection.Horizontal,
345
- openPopupCount: popupPanelCount,
346
- onPopupPanelOpenClose: handlePopupPanelOpenClose,
347
- overflowDisplayActive: overflowPanelItems.length > 0 && isOverflowPanelOpen,
348
- onItemExecuted: props.onItemExecuted ? props.onItemExecuted : () => { },
349
- onKeyDown: props.onKeyDown
350
- ? props.onKeyDown
351
- : /* istanbul ignore next */ (_e) => { },
352
- } }, availableItems.length > 0 && (React.createElement("div", { className: className, ref: refs, style: props.style, onKeyDown: props.onKeyDown, role: "presentation" },
353
- React.createElement(Items_1.ToolbarItems, { className: "components-items", direction: direction },
354
- (!overflowItemKeys || overflowItemKeys.length > 0) &&
355
- showOverflowAtStart &&
356
- addOverflowButton(true),
357
- displayedItems.map(([key, child]) => {
358
- const onEntryResize = handleEntryResize(key);
359
- return (React.createElement(exports.ToolbarItemContext.Provider, { key: key, value: {
360
- hasOverflow: false,
361
- useHeight,
362
- onResize: onEntryResize,
363
- } }, React.createElement(ItemWrapper_1.ItemWrapper, { className: getItemWrapperClass(child) }, child)));
364
- }),
365
- (!overflowItemKeys || overflowItemKeys.length > 0) &&
366
- !showOverflowAtStart &&
367
- addOverflowButton(false))))));
44
+ const { overflowExpandsTo, ...internalProps } = props;
45
+ return (React.createElement(InternalToolbarComponent_1.InternalToolbarComponent, { enableOverflow: { overflowExpandsTo }, ...internalProps }));
368
46
  }
369
47
  exports.ToolbarWithOverflow = ToolbarWithOverflow;
370
- /** Returns key of a child. Must be used along with React.Children.toArray to preserve the semantics of availableItems.
371
- * @internal
372
- */
373
- function getChildKey(child, index) {
374
- // istanbul ignore else
375
- if (React.isValidElement(child) && child.key !== null) {
376
- return child.key.toString();
377
- }
378
- // istanbul ignore next
379
- return index.toString();
380
- }
381
- /** Returns a subset of toolbar item entry keys that exceed given width and should be overflowItemKeys.
382
- * @internal
383
- */
384
- function determineOverflowItems(size, entries, overflowButtonSize, overflowButtonAtStart) {
385
- let toolbarSize = 0;
386
- const buttonPadding = 2;
387
- if (overflowButtonAtStart && entries.length > 0) {
388
- let i = entries.length - 1;
389
- for (; i >= 0; i--) {
390
- const w = entries[i][1] + buttonPadding;
391
- const newSettingsWidth = toolbarSize + w;
392
- if (newSettingsWidth > size) {
393
- toolbarSize += overflowButtonSize + buttonPadding;
394
- break;
395
- }
396
- toolbarSize = newSettingsWidth;
397
- }
398
- if (i >= 0) {
399
- let j = i + 1;
400
- for (; j < entries.length; j++) {
401
- if (toolbarSize <= size)
402
- break;
403
- const w = entries[j][1] + buttonPadding;
404
- toolbarSize -= w;
405
- }
406
- return entries.slice(0, j).map((e) => e[0]);
407
- }
408
- else {
409
- return [];
410
- }
411
- }
412
- else {
413
- let i = 0;
414
- for (; i < entries.length; i++) {
415
- const w = entries[i][1] + buttonPadding;
416
- const newSettingsWidth = toolbarSize + w;
417
- if (newSettingsWidth > size) {
418
- toolbarSize += overflowButtonSize + buttonPadding;
419
- break;
420
- }
421
- toolbarSize = newSettingsWidth;
422
- }
423
- let j = i;
424
- for (; j > 0; j--) {
425
- if (toolbarSize <= size)
426
- break;
427
- const w = entries[j][1] + buttonPadding;
428
- toolbarSize -= w;
429
- }
430
- return entries.slice(j).map((e) => e[0]);
431
- }
432
- }
433
- /** Hook that returns a list of overflowItemKeys availableItems.
434
- * @internal
435
- */
436
- function useOverflow(availableItems, overflowButtonAtStart) {
437
- const [overflowItemKeys, setOverflown] = React.useState();
438
- const itemSizes = React.useRef(new Map());
439
- const size = React.useRef(undefined);
440
- const overflowButtonSize = React.useRef(undefined);
441
- const calculateOverflow = React.useCallback(() => {
442
- const sizes = verifiedMapEntries(itemSizes.current);
443
- if (size.current === undefined ||
444
- sizes === undefined ||
445
- overflowButtonSize.current === undefined) {
446
- setOverflown(undefined);
447
- return;
448
- }
449
- // Calculate overflow.
450
- const newOverflown = determineOverflowItems(size.current, [...sizes.entries()], overflowButtonSize.current, overflowButtonAtStart);
451
- setOverflown((prevOverflown) => {
452
- return eql(prevOverflown, newOverflown) ? prevOverflown : newOverflown;
453
- });
454
- }, [overflowButtonAtStart]);
455
- React.useLayoutEffect(() => {
456
- const newEntryWidths = new Map();
457
- const array = React.Children.toArray(availableItems);
458
- for (let i = 0; i < array.length; i++) {
459
- const child = array[i];
460
- const key = getChildKey(child, i);
461
- const lastW = itemSizes.current.get(key);
462
- newEntryWidths.set(key, lastW);
463
- }
464
- itemSizes.current = newEntryWidths;
465
- calculateOverflow();
466
- }, [availableItems, calculateOverflow]);
467
- const handleContainerResize = React.useCallback((w) => {
468
- const calculate = size.current !== w;
469
- size.current = w;
470
- calculate && calculateOverflow();
471
- }, [calculateOverflow]);
472
- const handleOverflowResize = React.useCallback((w) => {
473
- const calculate = overflowButtonSize.current !== w;
474
- overflowButtonSize.current = w;
475
- calculate && calculateOverflow();
476
- }, [calculateOverflow]);
477
- const handleEntryResize = React.useCallback((key) => (w) => {
478
- const oldW = itemSizes.current.get(key);
479
- if (oldW !== w) {
480
- itemSizes.current.set(key, w);
481
- calculateOverflow();
482
- }
483
- }, [calculateOverflow]);
484
- return [
485
- overflowItemKeys,
486
- handleContainerResize,
487
- handleOverflowResize,
488
- handleEntryResize,
489
- ];
490
- }
491
- /** Interface toolbars use to define context for its items.
492
- * @internal
493
- */
494
- exports.ToolbarItemContext = React.createContext(null);
495
- /** @internal */
496
- function useToolItemEntryContext() {
497
- return React.useContext(exports.ToolbarItemContext);
498
- }
499
- exports.useToolItemEntryContext = useToolItemEntryContext;
500
- function verifiedMapEntries(map) {
501
- for (const [, val] of map) {
502
- // istanbul ignore next during unit testing
503
- if (val === undefined)
504
- return undefined;
505
- }
506
- return map;
507
- }
508
- function eql(prev, value) {
509
- if (!prev)
510
- return false;
511
- // istanbul ignore next
512
- if (prev.length !== value.length)
513
- return false;
514
- for (let i = 0; i < prev.length; i++) {
515
- const p = prev[i];
516
- const v = value[i];
517
- // istanbul ignore next
518
- if (p !== v)
519
- return false;
520
- }
521
- return true;
522
- }
523
48
  //# sourceMappingURL=ToolbarWithOverflow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0BAAwB;AACxB,4DAAoC;AACpC,6CAA+B;AAQ/B,0DAI+B;AAE/B,kDAA8E;AAC9E,iCAA2C;AAC3C,mCAAuC;AACvC,+CAA8E;AAC9E,yCAAmD;AACnD,mDAAuD;AACvD,2CAAwC;AACxC,uDAAoD;AACpD,2DAAwD;AACxD,qDAK+B;AAC/B,kDAA+C;AAC/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B;AAChB,SAAgB,uBAAuB;IACrC,OAAO,KAAK,CAAC,UAAU,CAAC,0BAAkB,CAAC,CAAC;AAC9C,CAAC;AAFD,0DAEC;AAED,SAAS,kBAAkB,CAAI,GAA+B;IAC5D,KAAK,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,EAAE;QACzB,4CAA4C;QAC5C,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;KACzC;IACD,OAAO,GAAqB,CAAC;AAC/B,CAAC;AAED,SAAS,GAAG,CAAC,IAAmC,EAAE,KAAwB;IACxE,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,uBAAuB;IACvB,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC/C,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;YAAE,OAAO,KAAK,CAAC;KAC3B;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport \"./Toolbar.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n ActionButton,\n CommonToolbarItem,\n CustomButtonDefinition,\n GroupButton,\n OnItemExecutedFunc,\n} from \"@itwin/appui-abstract\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n ToolbarItemUtilities,\n} from \"@itwin/appui-abstract\";\nimport type { CommonProps, NoChildrenProps } from \"@itwin/core-react\";\nimport { BadgeUtilities, Icon, IconHelper, useRefs } from \"@itwin/core-react\";\nimport { ToolbarButtonItem } from \"./Item\";\nimport { ToolbarItems } from \"./Items\";\nimport { ItemWrapper, useResizeObserverSingleDimension } from \"./ItemWrapper\";\nimport { ToolbarOverflowButton } from \"./Overflow\";\nimport { ToolbarOverflowPanel } from \"./OverflowPanel\";\nimport { PopupItem } from \"./PopupItem\";\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\nimport { PopupItemWithDrag } from \"./PopupItemWithDrag\";\nimport {\n Direction,\n DirectionHelpers,\n OrthogonalDirection,\n OrthogonalDirectionHelpers,\n} from \"./utilities/Direction\";\nimport { UiComponents } from \"../UiComponents\";\nimport { SvgPlaceholder } from \"@itwin/itwinui-icons-react\";\n\n/** Describes the data needed to insert a custom `React` button into an ToolbarWithOverflow.\n * @public\n * @deprecated in 4.0. Use [ToolbarCustomItem]($appui-react) instead.\n */\nexport interface CustomToolbarItem extends CustomButtonDefinition {\n /** defines the content to display in popup panel */\n panelContentNode?: React.ReactNode;\n /** If true the popup panel is mounted once and unmounted when button is unmounted. If false the\n * content node is unmounted each time the popup is closed. */\n keepContentsLoaded?: boolean;\n}\n\n/**\n * Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.\n * @public\n */\nexport const ToolbarPopupAutoHideContext = React.createContext<boolean>(false);\n\n/**\n * React hook used to retrieve the ToolbarPopupAutoHideContext.\n * @public\n */\nexport function useToolbarPopupAutoHideContext() {\n return React.useContext(ToolbarPopupAutoHideContext);\n}\n\n/** Describes toolbar item.\n * @public\n * @deprecated in 4.0. Use [ToolbarItem]($appui-react) instead.\n */\nexport type ToolbarItem = ActionButton | GroupButton | CustomToolbarItem; // eslint-disable-line deprecation/deprecation\n\n/** CustomToolbarItem type guard.\n * @internal\n */\nexport function isCustomToolbarItem(\n // eslint-disable-next-line deprecation/deprecation\n item: ToolbarItem\n // eslint-disable-next-line deprecation/deprecation\n): item is CustomToolbarItem {\n return !!(item as CustomToolbarItem).isCustom && \"panelContentNode\" in item; // eslint-disable-line deprecation/deprecation\n}\n\n/** @internal */\nexport const getToolbarDirection = (\n expandsTo: Direction\n): OrthogonalDirection => {\n const orthogonalDirection =\n DirectionHelpers.getOrthogonalDirection(expandsTo);\n return OrthogonalDirectionHelpers.inverse(orthogonalDirection);\n};\n\n/** Available alignment modes of [[Toolbar]] panels.\n * @public\n */\nexport enum ToolbarPanelAlignment {\n Start,\n End,\n}\n\n/** Enumeration of Toolbar Opacity setting.\n * @public\n */\nexport enum ToolbarOpacitySetting {\n /** Use the default background, box-shadow opacity and backdrop-filter blur */\n Defaults,\n /** Alter the opacity from transparent to the defaults based on mouse proximity */\n Proximity,\n /** Use a transparent background, box-shadow opacity and backdrop-filter blur */\n Transparent,\n}\n\n/** Helpers for [[ToolbarPanelAlignment]].\n * @internal\n */\nexport class ToolbarPanelAlignmentHelpers {\n /** Class name of [[ToolbarPanelAlignment.Start]] */\n public static readonly START_CLASS_NAME = \"components-panel-alignment-start\";\n /** Class name of [[ToolbarPanelAlignment.End]] */\n public static readonly END_CLASS_NAME = \"components-panel-alignment-end\";\n\n /** @returns Class name of specified [[ToolbarPanelAlignment]] */\n public static getCssClassName(panelAlignment: ToolbarPanelAlignment): string {\n switch (panelAlignment) {\n case ToolbarPanelAlignment.Start:\n return ToolbarPanelAlignmentHelpers.START_CLASS_NAME;\n case ToolbarPanelAlignment.End:\n return ToolbarPanelAlignmentHelpers.END_CLASS_NAME;\n }\n }\n}\n\n/** @internal */\nexport interface ToolbarOverflowContextProps {\n readonly expandsTo: Direction;\n readonly direction: OrthogonalDirection;\n readonly overflowExpandsTo: Direction;\n readonly overflowDirection: OrthogonalDirection;\n readonly panelAlignment: ToolbarPanelAlignment;\n readonly useDragInteraction: boolean;\n readonly toolbarOpacitySetting: ToolbarOpacitySetting;\n readonly openPopupCount: number;\n readonly onPopupPanelOpenClose: (isOpening: boolean) => void;\n readonly overflowDisplayActive: boolean;\n readonly onItemExecuted: OnItemExecutedFunc;\n readonly onKeyDown: (e: React.KeyboardEvent) => void;\n}\n\n/**\n * Context used by Toolbar component to provide Direction to child components.\n * @internal\n */\nexport const ToolbarWithOverflowDirectionContext =\n React.createContext<ToolbarOverflowContextProps>({\n expandsTo: Direction.Bottom,\n direction: OrthogonalDirection.Horizontal,\n overflowExpandsTo: Direction.Right,\n overflowDirection: OrthogonalDirection.Vertical,\n panelAlignment: ToolbarPanelAlignment.Start,\n useDragInteraction: false,\n toolbarOpacitySetting: ToolbarOpacitySetting.Proximity,\n openPopupCount: 0,\n onPopupPanelOpenClose: /* istanbul ignore next */ (\n _isOpening: boolean\n ) => {},\n overflowDisplayActive: false,\n onItemExecuted: /* istanbul ignore next */ (_item: any) => void {},\n onKeyDown: /* istanbul ignore next */ (_e: React.KeyboardEvent) => void {},\n });\n\n/** @internal */\nfunction CustomItem({\n item,\n addGroupSeparator,\n}: {\n // eslint-disable-next-line deprecation/deprecation\n item: CustomToolbarItem;\n addGroupSeparator: boolean;\n}) {\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\n const icon = React.useMemo(\n () =>\n (item.icon &&\n IconHelper.getIconReactNode(item.icon, item.internalData)) || (\n // istanbul ignore next\n <Icon className=\"icon\" iconSpec={<SvgPlaceholder />} />\n ),\n [item.icon, item.internalData]\n );\n const isDisabled = React.useMemo(\n () => ConditionalBooleanValue.getValue(item.isDisabled),\n [item.isDisabled]\n );\n const title = React.useMemo(\n () =>\n /* istanbul ignore next */ ConditionalStringValue.getValue(item.label) ??\n item.id,\n [item.id, item.label]\n );\n const badge = React.useMemo(\n () => BadgeUtilities.getComponentForBadgeType(item.badgeType),\n [item.badgeType]\n );\n\n return (\n <PopupItem\n key={item.id}\n itemId={item.id}\n icon={icon}\n isDisabled={isDisabled}\n title={title}\n panel={item.panelContentNode}\n hideIndicator={useDragInteraction}\n badge={badge}\n addGroupSeparator={addGroupSeparator}\n keepContentsMounted={item.keepContentsLoaded}\n />\n );\n}\n\n/** @internal */\nfunction GroupPopupItem({\n item,\n addGroupSeparator,\n}: {\n item: GroupButton;\n addGroupSeparator: boolean;\n}) {\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\n const title = ConditionalStringValue.getValue(item.label)!;\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\n const panel = React.useMemo(\n () => <PopupItemsPanel groupItem={item} activateOnPointerUp={false} />,\n [item]\n );\n // istanbul ignore next\n const providerId =\n \"providerId\" in item ? (item.providerId as string) : undefined;\n if (useDragInteraction) {\n return (\n <PopupItemWithDrag\n key={item.id}\n itemId={item.id}\n providerId={providerId}\n itemPriority={item.itemPriority}\n groupPriority={item.groupPriority}\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\n title={title}\n groupItem={item}\n badge={badge}\n addGroupSeparator={addGroupSeparator}\n />\n );\n }\n return (\n <PopupItem\n key={item.id}\n itemId={item.id}\n providerId={providerId}\n itemPriority={item.itemPriority}\n groupPriority={item.groupPriority}\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\n title={title}\n panel={panel}\n badge={badge}\n hideIndicator={useDragInteraction}\n addGroupSeparator={addGroupSeparator}\n />\n );\n}\n\n/** @internal */\nfunction ActionItem({\n item,\n addGroupSeparator,\n}: {\n item: ActionButton;\n addGroupSeparator: boolean;\n}) {\n const title = ConditionalStringValue.getValue(item.label)!;\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\n const { onItemExecuted } = useToolbarWithOverflowDirectionContext();\n const onExecute = React.useCallback(() => {\n item.execute();\n onItemExecuted(item);\n }, [item, onItemExecuted]);\n\n // istanbul ignore next\n const providerId =\n \"providerId\" in item ? (item.providerId as string) : undefined;\n return (\n <ToolbarButtonItem\n itemId={item.id}\n providerId={providerId}\n itemPriority={item.itemPriority}\n groupPriority={item.groupPriority}\n key={item.id}\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\n title={title}\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\n isActive={item.isActive}\n onClick={onExecute}\n badge={badge}\n addGroupSeparator={addGroupSeparator}\n />\n );\n}\n\n/** @internal */\nexport function ToolbarItemComponent({\n item,\n addGroupSeparator,\n}: {\n // eslint-disable-next-line deprecation/deprecation\n item: ToolbarItem;\n addGroupSeparator: boolean;\n}) {\n if (ToolbarItemUtilities.isGroupButton(item)) {\n return <GroupPopupItem item={item} addGroupSeparator={addGroupSeparator} />;\n } else if (isCustomToolbarItem(item)) {\n return <CustomItem item={item} addGroupSeparator={addGroupSeparator} />;\n } else {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(item)) {\n return <ActionItem item={item} addGroupSeparator={addGroupSeparator} />;\n }\n }\n // istanbul ignore next\n return null;\n}\n\n/** @internal */\nexport function useToolbarWithOverflowDirectionContext() {\n return React.useContext(ToolbarWithOverflowDirectionContext);\n}\n\nfunction OverflowItemsContainer(p: { children: React.ReactNode }) {\n return <>{p.children}</>;\n}\n\nfunction getItemWrapperClass(child: React.ReactNode) {\n // istanbul ignore else\n if (React.isValidElement(child)) {\n if (child.props && child.props.addGroupSeparator)\n return \"components-toolbar-button-add-gap-before\";\n }\n return undefined;\n}\n\n/** Properties of [[ToolbarWithOverflow]] component.\n * @public\n * @deprecated in 4.0. Use [ToolbarWithOverflowProps]($appui-react) instead.\n */\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\n expandsTo?: Direction;\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\n overflowExpandsTo?: Direction;\n /** Definitions for items of the toolbar. Items are expected to be already sorted by group and item. */\n items: CommonToolbarItem[];\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\n panelAlignment?: ToolbarPanelAlignment;\n /** Use Drag Interaction to open popups with nest action buttons */\n useDragInteraction?: boolean;\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\n toolbarOpacitySetting?: ToolbarOpacitySetting;\n /** Optional function to call on any item execution */\n onItemExecuted?: OnItemExecutedFunc;\n /** Optional function to call on any KeyDown events processed by toolbar */\n onKeyDown?: (e: React.KeyboardEvent) => void;\n}\n\n/** Component that displays tool settings as a bar across the top of the content view.\n * @public\n * @deprecated in 4.0. Use [ToolbarWithOverflow]($appui-react) instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\n const expandsTo = props.expandsTo ? props.expandsTo : Direction.Bottom;\n const useDragInteraction = !!props.useDragInteraction;\n const panelAlignment = props.panelAlignment\n ? props.panelAlignment\n : ToolbarPanelAlignment.Start;\n const useHeight =\n expandsTo === Direction.Right || expandsTo === Direction.Left;\n const [isOverflowPanelOpen, setIsOverflowPanelOpen] = React.useState(false);\n const [popupPanelCount, setPopupPanelCount] = React.useState(0);\n const overflowTitle = React.useRef(\n UiComponents.translate(\"toolbar.overflow\")\n );\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n });\n const handlePopupPanelOpenClose = React.useCallback((isOpening: boolean) => {\n // use setTimeout to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag\n setTimeout(() => {\n // istanbul ignore next\n if (!isMounted.current) return;\n setPopupPanelCount((prev) => {\n /* istanbul ignore next */\n const nextCount = isOpening ? prev + 1 : prev - 1;\n return nextCount < 0 ? /* istanbul ignore next */ 0 : nextCount;\n });\n });\n }, []);\n\n const ref = React.useRef<HTMLDivElement>(null);\n const width = React.useRef<number | undefined>(undefined);\n const availableNodes = React.useMemo<React.ReactNode>(() => {\n return props.items.map((item, index) => {\n let addGroupSeparator = false;\n if (index > 0)\n addGroupSeparator =\n item.groupPriority !== props.items[index - 1].groupPriority;\n return (\n <ToolbarItemComponent\n key={item.id}\n item={item}\n addGroupSeparator={!!addGroupSeparator}\n />\n );\n });\n }, [props.items]);\n /* overflowItemKeys - keys of items to show in overflow panel\n * handleContainerResize - handler called when container <div> is resized.\n * handleOverflowResize - handler called when determining size of overflow indicator/button.\n * handleEntryResize - handler called when determining size of each item/button. */\n const [\n overflowItemKeys,\n handleContainerResize,\n handleOverflowResize,\n handleEntryResize,\n ] = useOverflow(availableNodes, panelAlignment === ToolbarPanelAlignment.End);\n // handler called by ResizeObserver\n const handleResize = React.useCallback(\n (w: number) => {\n width.current = w;\n width.current !== undefined && handleContainerResize(width.current);\n },\n [handleContainerResize]\n );\n const resizeObserverRef = useResizeObserverSingleDimension(\n handleResize,\n useHeight\n );\n const handleClick = React.useCallback(() => {\n setIsOverflowPanelOpen((prev) => !prev);\n }, []);\n // istanbul ignore next - NEEDSWORK add complete tests\n const handleClose = React.useCallback(() => {\n setIsOverflowPanelOpen(false);\n }, []);\n\n const refs = useRefs(ref, resizeObserverRef);\n const availableItems = React.Children.toArray(availableNodes);\n const displayedItems = availableItems.reduce<\n Array<[string, React.ReactNode]>\n >((acc, child, index) => {\n const key = getChildKey(child, index);\n if (!overflowItemKeys || overflowItemKeys.indexOf(key) < 0) {\n acc.push([key, child]);\n }\n return acc;\n }, []);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const overflowPanelItems = overflowItemKeys\n ? availableItems.reduce<Array<[string, React.ReactNode]>>(\n (acc, child, index) => {\n const key = getChildKey(child, index);\n if (overflowItemKeys.indexOf(key) >= 0) {\n acc.push([key, child]);\n }\n return acc;\n },\n []\n )\n : [];\n\n const direction = getToolbarDirection(expandsTo);\n const overflowExpandsTo =\n undefined !== props.overflowExpandsTo\n ? props.overflowExpandsTo\n : Direction.Right;\n const addOverflowButton = React.useCallback(\n (atStart: boolean) => {\n const overflowItems = !!atStart\n ? overflowPanelItems.reverse()\n : overflowPanelItems;\n return (\n <ToolbarItemContext.Provider\n value={{\n hasOverflow: false,\n useHeight,\n onResize: handleOverflowResize,\n }}\n >\n <ToolbarOverflowButton\n expandsTo={expandsTo}\n onClick={handleClick}\n onClose={handleClose}\n open={overflowItems.length > 0 && isOverflowPanelOpen}\n panelNode={\n <ToolbarOverflowPanel>\n <OverflowItemsContainer>\n {overflowItems.map(([key, child]) => {\n return (\n <ToolbarItemContext.Provider\n key={key}\n value={{\n hasOverflow: true,\n useHeight,\n onResize: () => {},\n }}\n >\n {\n <ItemWrapper className={getItemWrapperClass(child)}>\n {child}\n </ItemWrapper>\n }\n </ToolbarItemContext.Provider>\n );\n })}\n </OverflowItemsContainer>\n </ToolbarOverflowPanel>\n }\n title={overflowTitle.current}\n />\n </ToolbarItemContext.Provider>\n );\n },\n [\n handleClick,\n handleClose,\n handleOverflowResize,\n isOverflowPanelOpen,\n expandsTo,\n overflowPanelItems,\n useHeight,\n ]\n );\n\n const className = classnames(\n \"components-toolbar-overflow-sizer\",\n OrthogonalDirectionHelpers.getCssClassName(direction),\n props.className\n );\n\n const showOverflowAtStart =\n direction === OrthogonalDirection.Horizontal &&\n panelAlignment === ToolbarPanelAlignment.End;\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\n size of the item. */\n return (\n <ToolbarWithOverflowDirectionContext.Provider\n value={{\n expandsTo,\n direction,\n overflowExpandsTo,\n panelAlignment,\n useDragInteraction,\n toolbarOpacitySetting:\n undefined !== props.toolbarOpacitySetting\n ? props.toolbarOpacitySetting\n : ToolbarOpacitySetting.Proximity,\n overflowDirection:\n direction === OrthogonalDirection.Horizontal\n ? OrthogonalDirection.Vertical\n : OrthogonalDirection.Horizontal,\n openPopupCount: popupPanelCount,\n onPopupPanelOpenClose: handlePopupPanelOpenClose,\n overflowDisplayActive:\n overflowPanelItems.length > 0 && isOverflowPanelOpen,\n onItemExecuted: props.onItemExecuted ? props.onItemExecuted : () => {},\n onKeyDown: props.onKeyDown\n ? props.onKeyDown\n : /* istanbul ignore next */ (_e: React.KeyboardEvent) => {},\n }}\n >\n {availableItems.length > 0 && (\n <div\n className={className}\n ref={refs}\n style={props.style}\n onKeyDown={props.onKeyDown}\n role=\"presentation\"\n >\n <ToolbarItems className=\"components-items\" direction={direction}>\n {(!overflowItemKeys || overflowItemKeys.length > 0) &&\n showOverflowAtStart &&\n addOverflowButton(true)}\n {displayedItems.map(([key, child]) => {\n const onEntryResize = handleEntryResize(key);\n return (\n <ToolbarItemContext.Provider\n key={key}\n value={{\n hasOverflow: false,\n useHeight,\n onResize: onEntryResize,\n }}\n >\n {\n <ItemWrapper className={getItemWrapperClass(child)}>\n {child}\n </ItemWrapper>\n }\n </ToolbarItemContext.Provider>\n );\n })}\n {(!overflowItemKeys || overflowItemKeys.length > 0) &&\n !showOverflowAtStart &&\n addOverflowButton(false)}\n </ToolbarItems>\n </div>\n )}\n </ToolbarWithOverflowDirectionContext.Provider>\n );\n}\n\n/** Returns key of a child. Must be used along with React.Children.toArray to preserve the semantics of availableItems.\n * @internal\n */\nfunction getChildKey(child: React.ReactNode, index: number) {\n // istanbul ignore else\n if (React.isValidElement(child) && child.key !== null) {\n return child.key.toString();\n }\n // istanbul ignore next\n return index.toString();\n}\n\n/** Returns a subset of toolbar item entry keys that exceed given width and should be overflowItemKeys.\n * @internal\n */\nfunction determineOverflowItems(\n size: number,\n entries: ReadonlyArray<readonly [string, number]>,\n overflowButtonSize: number,\n overflowButtonAtStart: boolean\n): string[] {\n let toolbarSize = 0;\n const buttonPadding = 2;\n if (overflowButtonAtStart && entries.length > 0) {\n let i = entries.length - 1;\n for (; i >= 0; i--) {\n const w = entries[i][1] + buttonPadding;\n const newSettingsWidth = toolbarSize + w;\n if (newSettingsWidth > size) {\n toolbarSize += overflowButtonSize + buttonPadding;\n break;\n }\n toolbarSize = newSettingsWidth;\n }\n if (i >= 0) {\n let j = i + 1;\n for (; j < entries.length; j++) {\n if (toolbarSize <= size) break;\n const w = entries[j][1] + buttonPadding;\n toolbarSize -= w;\n }\n\n return entries.slice(0, j).map((e) => e[0]);\n } else {\n return [];\n }\n } else {\n let i = 0;\n for (; i < entries.length; i++) {\n const w = entries[i][1] + buttonPadding;\n const newSettingsWidth = toolbarSize + w;\n if (newSettingsWidth > size) {\n toolbarSize += overflowButtonSize + buttonPadding;\n break;\n }\n toolbarSize = newSettingsWidth;\n }\n let j = i;\n for (; j > 0; j--) {\n if (toolbarSize <= size) break;\n const w = entries[j][1] + buttonPadding;\n toolbarSize -= w;\n }\n\n return entries.slice(j).map((e) => e[0]);\n }\n}\n\n/** Hook that returns a list of overflowItemKeys availableItems.\n * @internal\n */\nfunction useOverflow(\n availableItems: React.ReactNode,\n overflowButtonAtStart: boolean\n): [\n ReadonlyArray<string> | undefined,\n (size: number) => void,\n (size: number) => void,\n (key: string) => (size: number) => void\n] {\n const [overflowItemKeys, setOverflown] =\n React.useState<ReadonlyArray<string>>();\n const itemSizes = React.useRef(new Map<string, number | undefined>());\n const size = React.useRef<number | undefined>(undefined);\n const overflowButtonSize = React.useRef<number | undefined>(undefined);\n\n const calculateOverflow = React.useCallback(() => {\n const sizes = verifiedMapEntries(itemSizes.current);\n if (\n size.current === undefined ||\n sizes === undefined ||\n overflowButtonSize.current === undefined\n ) {\n setOverflown(undefined);\n return;\n }\n\n // Calculate overflow.\n const newOverflown = determineOverflowItems(\n size.current,\n [...sizes.entries()],\n overflowButtonSize.current,\n overflowButtonAtStart\n );\n setOverflown((prevOverflown) => {\n return eql(prevOverflown, newOverflown) ? prevOverflown : newOverflown;\n });\n }, [overflowButtonAtStart]);\n\n React.useLayoutEffect(() => {\n const newEntryWidths = new Map<string, number | undefined>();\n const array = React.Children.toArray(availableItems);\n for (let i = 0; i < array.length; i++) {\n const child = array[i];\n const key = getChildKey(child, i);\n const lastW = itemSizes.current.get(key);\n newEntryWidths.set(key, lastW);\n }\n itemSizes.current = newEntryWidths;\n calculateOverflow();\n }, [availableItems, calculateOverflow]);\n\n const handleContainerResize = React.useCallback(\n (w: number) => {\n const calculate = size.current !== w;\n size.current = w;\n calculate && calculateOverflow();\n },\n [calculateOverflow]\n );\n\n const handleOverflowResize = React.useCallback(\n (w: number) => {\n const calculate = overflowButtonSize.current !== w;\n overflowButtonSize.current = w;\n calculate && calculateOverflow();\n },\n [calculateOverflow]\n );\n\n const handleEntryResize = React.useCallback(\n (key: string) => (w: number) => {\n const oldW = itemSizes.current.get(key);\n if (oldW !== w) {\n itemSizes.current.set(key, w);\n calculateOverflow();\n }\n },\n [calculateOverflow]\n );\n\n return [\n overflowItemKeys,\n handleContainerResize,\n handleOverflowResize,\n handleEntryResize,\n ];\n}\n\n/** Interface toolbars use to define context for its items.\n * @internal\n */\nexport interface ToolbarItemContextArgs {\n readonly hasOverflow: boolean;\n readonly useHeight: boolean;\n readonly onResize: (w: number) => void;\n}\n\n/** Interface toolbars use to define context for its items.\n * @internal\n */\nexport const ToolbarItemContext = React.createContext<ToolbarItemContextArgs>(\n null!\n);\n\n/** @internal */\nexport function useToolItemEntryContext() {\n return React.useContext(ToolbarItemContext);\n}\n\nfunction verifiedMapEntries<T>(map: Map<string, T | undefined>) {\n for (const [, val] of map) {\n // istanbul ignore next during unit testing\n if (val === undefined) return undefined;\n }\n return map as Map<string, T>;\n}\n\nfunction eql(prev: readonly string[] | undefined, value: readonly string[]) {\n if (!prev) return false;\n // istanbul ignore next\n if (prev.length !== value.length) return false;\n for (let i = 0; i < prev.length; i++) {\n const p = prev[i];\n const v = value[i];\n // istanbul ignore next\n if (p !== v) return false;\n }\n return true;\n}\n"]}
1
+ {"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0BAAwB;AACxB,6CAA+B;AAW/B,yEAAsE;AAyBtE;;;;GAIG;AACH,mDAAmD;AACnD,SAAgB,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,iBAAiB,EAAE,GAAG,aAAa,EAAE,GAAG,KAAK,CAAC;IACtD,OAAO,CACL,oBAAC,mDAAwB,IACvB,cAAc,EAAE,EAAE,iBAAiB,EAAE,KACjC,aAAa,GACjB,CACH,CAAC;AACJ,CAAC;AARD,kDAQC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport \"./Toolbar.scss\";\nimport * as React from \"react\";\nimport type {\n CommonToolbarItem,\n OnItemExecutedFunc,\n} from \"@itwin/appui-abstract\";\nimport type { CommonProps, NoChildrenProps } from \"@itwin/core-react\";\nimport type { Direction } from \"./utilities/Direction\";\nimport type {\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"./InternalToolbarComponent\";\nimport { InternalToolbarComponent } from \"./InternalToolbarComponent\";\n\n/** Properties of [[ToolbarWithOverflow]] component.\n * @public\n * @deprecated in 4.0. Use [ToolbarWithOverflowProps]($appui-react) instead.\n */\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\n expandsTo?: Direction;\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\n overflowExpandsTo?: Direction;\n /** Definitions for items of the toolbar. Items are expected to be already sorted by group and item. */\n items: CommonToolbarItem[];\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\n panelAlignment?: ToolbarPanelAlignment;\n /** Use Drag Interaction to open popups with nest action buttons */\n useDragInteraction?: boolean;\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\n toolbarOpacitySetting?: ToolbarOpacitySetting;\n /** Optional function to call on any item execution */\n onItemExecuted?: OnItemExecutedFunc;\n /** Optional function to call on any KeyDown events processed by toolbar */\n onKeyDown?: (e: React.KeyboardEvent) => void;\n}\n\n/** Component that displays toolbar items, displaying only the elements that can fit in the available space,\n * and put the other items into a single panel.\n * @public\n * @deprecated in 4.0. Use [ToolbarWithOverflow]($appui-react) instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\n const { overflowExpandsTo, ...internalProps } = props;\n return (\n <InternalToolbarComponent\n enableOverflow={{ overflowExpandsTo }}\n {...internalProps}\n />\n );\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import type { BeEvent } from "@itwin/core-bentley";
2
+ /**
3
+ * Register a listener on the syncUiEVent and updates all conditionals within the provided items.
4
+ * @param items Items to keep up to date
5
+ * @param syncUiEvent Event to attach to (because we don't depend on appui-react);
6
+ * @returns Synched items
7
+ * @internal
8
+ */
9
+ export declare function useConditionalSynchedItems<T extends {} | {
10
+ items: T[];
11
+ }>(items: readonly T[], syncUiEvent: undefined | BeEvent<(args: {
12
+ eventIds: Set<string>;
13
+ }) => void>): readonly T[];
14
+ //# sourceMappingURL=useConditionalSynchedItems.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConditionalSynchedItems.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/useConditionalSynchedItems.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AA8EnD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,EAAE,GAAG;IAAE,KAAK,EAAE,CAAC,EAAE,CAAA;CAAE,EACtE,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,KAAK,IAAI,CAAC,gBAyB5E"}