@itwin/core-react 4.10.0-dev.1 → 4.10.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 (62) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/lib/cjs/core-react/autosuggest/AutoSuggest.js +3 -3
  3. package/lib/cjs/core-react/autosuggest/AutoSuggest.js.map +1 -1
  4. package/lib/cjs/core-react/button/UnderlinedButton.js +1 -1
  5. package/lib/cjs/core-react/button/UnderlinedButton.js.map +1 -1
  6. package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
  7. package/lib/cjs/core-react/contextmenu/ContextMenu.js +9 -7
  8. package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
  9. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js +1 -1
  10. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  11. package/lib/cjs/core-react/dialog/Dialog.d.ts.map +1 -1
  12. package/lib/cjs/core-react/dialog/Dialog.js +3 -1
  13. package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
  14. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
  15. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.js +22 -21
  16. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
  17. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js +4 -4
  18. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  19. package/lib/cjs/core-react/listbox/Listbox.js +4 -4
  20. package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
  21. package/lib/cjs/core-react/popup/Popup.d.ts.map +1 -1
  22. package/lib/cjs/core-react/popup/Popup.js +3 -2
  23. package/lib/cjs/core-react/popup/Popup.js.map +1 -1
  24. package/lib/cjs/core-react/radialmenu/RadialMenu.d.ts.map +1 -1
  25. package/lib/cjs/core-react/radialmenu/RadialMenu.js +1 -1
  26. package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
  27. package/lib/cjs/core-react/searchbox/SearchBox.js +2 -2
  28. package/lib/cjs/core-react/searchbox/SearchBox.js.map +1 -1
  29. package/lib/cjs/core-react/utils/hooks/useResizeObserver.d.ts.map +1 -1
  30. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js +10 -8
  31. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  32. package/lib/esm/core-react/autosuggest/AutoSuggest.js +3 -3
  33. package/lib/esm/core-react/autosuggest/AutoSuggest.js.map +1 -1
  34. package/lib/esm/core-react/button/UnderlinedButton.js +1 -1
  35. package/lib/esm/core-react/button/UnderlinedButton.js.map +1 -1
  36. package/lib/esm/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
  37. package/lib/esm/core-react/contextmenu/ContextMenu.js +9 -7
  38. package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
  39. package/lib/esm/core-react/contextmenu/ContextMenuItem.js +1 -1
  40. package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  41. package/lib/esm/core-react/dialog/Dialog.d.ts.map +1 -1
  42. package/lib/esm/core-react/dialog/Dialog.js +3 -1
  43. package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
  44. package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
  45. package/lib/esm/core-react/focus/ItemKeyboardNavigator.js +22 -21
  46. package/lib/esm/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
  47. package/lib/esm/core-react/inputs/numberinput/NumberInput.js +4 -4
  48. package/lib/esm/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  49. package/lib/esm/core-react/listbox/Listbox.js +4 -4
  50. package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
  51. package/lib/esm/core-react/popup/Popup.d.ts.map +1 -1
  52. package/lib/esm/core-react/popup/Popup.js +3 -2
  53. package/lib/esm/core-react/popup/Popup.js.map +1 -1
  54. package/lib/esm/core-react/radialmenu/RadialMenu.d.ts.map +1 -1
  55. package/lib/esm/core-react/radialmenu/RadialMenu.js +1 -1
  56. package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
  57. package/lib/esm/core-react/searchbox/SearchBox.js +2 -2
  58. package/lib/esm/core-react/searchbox/SearchBox.js.map +1 -1
  59. package/lib/esm/core-react/utils/hooks/useResizeObserver.d.ts.map +1 -1
  60. package/lib/esm/core-react/utils/hooks/useResizeObserver.js +10 -8
  61. package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  62. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Change Log - @itwin/core-react
2
2
 
3
- This log was last generated on Tue, 06 Feb 2024 08:56:40 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 26 Feb 2024 15:50:45 GMT and should not be manually modified.
4
+
5
+ ## 4.10.0
6
+ Mon, 26 Feb 2024 15:50:45 GMT
7
+
8
+ ### Updates
9
+
10
+ - Use iTwinUI 3.x.
11
+ - Fix a potential maximum update depth error caused by useResizeObserver.
4
12
 
5
13
  ## 4.9.0
6
14
  Tue, 06 Feb 2024 08:56:40 GMT
@@ -78,17 +78,17 @@ class AutoSuggest extends React.PureComponent {
78
78
  this._renderSuggestion = (suggestion) => (React.createElement("span", null, suggestion.label));
79
79
  this._handleKeyDown = (e) => {
80
80
  switch (e.key) {
81
- case ts_key_enum_1.Key.Enter:
81
+ case ts_key_enum_1.Key.Enter.valueOf():
82
82
  // istanbul ignore else
83
83
  if (this.props.onPressEnter)
84
84
  this.props.onPressEnter(e);
85
85
  break;
86
- case ts_key_enum_1.Key.Escape:
86
+ case ts_key_enum_1.Key.Escape.valueOf():
87
87
  // istanbul ignore else
88
88
  if (this.props.onPressEscape)
89
89
  this.props.onPressEscape(e);
90
90
  break;
91
- case ts_key_enum_1.Key.Tab:
91
+ case ts_key_enum_1.Key.Tab.valueOf():
92
92
  // istanbul ignore else
93
93
  if (this.props.onPressTab)
94
94
  this.props.onP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AAC;QAC9B,CAAC,CAAC;QACF,OAAO;QACL,2EAA2E;QAC3E,mEAAmE;QACnE,6BACE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,SAAS,EAAE,IAAI,CAAC,cAAc;YAE9B,oBAAC,gBAAgB,IACf,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,WAAW,EAAE,WAAW,EACxB,2BAA2B,EAAE,IAAI,CAAC,4BAA4B,EAC9D,2BAA2B,EAAE,IAAI,CAAC,4BAA4B,EAC9D,kBAAkB,EAAE,IAAI,CAAC,mBAAmB,EAC5C,gBAAgB,EAAE,IAAI,CAAC,iBAAiB,EACxC,UAAU,EAAE,UAAU,EACtB,oBAAoB,EAAE,IAAI,CAAC,qBAAqB,EAChD,uBAAuB,EAAE,uBAAuB,EAChD,oBAAoB,EAClB,oBAAoB,IAAI,2BAA2B,EAErD,0BAA0B,EAAE,0BAA0B,GACtD,CACE,CACP,CAAC;IACJ,CAAC;CACF;AAjPD,kCAiPC","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 AutoSuggest\n */\n\nimport \"./AutoSuggest.scss\";\nimport * as React from \"react\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport * as ReactAutosuggest from \"react-autosuggest\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { UiCore } from \"../UiCore\";\n\n/** Data for the [[AutoSuggest]] options\n * @public\n */\nexport interface AutoSuggestData {\n /** Value of [[AutoSuggest]] option. */\n value: string;\n /** Label of [[AutoSuggest]] option. This is shown in the dropdown. */\n label: string;\n}\n\n/** Prototype for function returning AutoSuggestData\n * @public\n */\nexport type GetAutoSuggestDataFunc = (value: string) => AutoSuggestData[];\n\n/** Prototype for async function returning AutoSuggestData\n * @public\n */\nexport type AsyncGetAutoSuggestDataFunc = (\n value: string\n) => Promise<AutoSuggestData[]>;\n\n/** Properties for the [[AutoSuggest]] component.\n * @public\n */\nexport interface AutoSuggestProps\n extends React.InputHTMLAttributes<HTMLInputElement>,\n CommonProps {\n /** Optional input value override. */\n value?: string;\n /** Options for dropdown. */\n options?: AutoSuggestData[] | GetAutoSuggestDataFunc;\n /** Asynchronously calculate suggestions for any given input value. */\n getSuggestions?: AsyncGetAutoSuggestDataFunc;\n /** Gets a label associated with a given value */\n getLabel?: (value: string | undefined) => string;\n /** Handler for when suggested selected. */\n onSuggestionSelected: (selected: AutoSuggestData) => void;\n /** Handler for Enter key. */\n onPressEnter?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Handler for Escape key. */\n onPressEscape?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Handler for Tab key. */\n onPressTab?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Handler for input receiving focus. */\n onInputFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;\n /** Called every time you need to clear suggestions. */\n onSuggestionsClearRequested?: () => void;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n\n /** Use it only if you need to customize the rendering of the input.\n * @internal\n */\n renderInputComponent?: any; // ReactAutosuggest.RenderInputComponent<AutoSuggestData>; NOTE: changed to \"any\" because build was failing with RenderInputComponent is not generic?\n /** Use it if you want to customize things inside the suggestions container beyond rendering the suggestions themselves.\n * @internal\n */\n renderSuggestionsContainer?: ReactAutosuggest.RenderSuggestionsContainer;\n\n /** @internal */\n alwaysRenderSuggestions?: boolean;\n}\n\n/** @internal */\ninterface AutoSuggestState {\n inputValue: string;\n suggestions: AutoSuggestData[];\n}\n\n/** Auto Suggest React component. Uses the react-autosuggest component internally.\n * @public\n */\nexport class AutoSuggest extends React.PureComponent<\n AutoSuggestProps,\n AutoSuggestState\n> {\n private _isMounted = false;\n\n constructor(props: AutoSuggestProps) {\n super(props);\n\n // Autosuggest is a controlled component.\n // This means that you need to provide an input value\n // and an onChange handler that updates this value (see below).\n // Suggestions also need to be provided to the Autosuggest,\n // and they are initially empty because the Autosuggest is closed.\n this.state = {\n inputValue: this.getLabel(props.value),\n suggestions: [],\n };\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: AutoSuggestProps) {\n if (\n this.props.value !== prevProps.value ||\n this.props.options !== prevProps.options\n ) {\n this.setState((_prevState, props) => ({\n inputValue: this.getLabel(props.value),\n }));\n }\n }\n\n private _onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n let newValue = \"\";\n\n if (e.target.tagName === \"LI\" && e.target.textContent)\n newValue = e.target.textContent;\n else if (e.target.value) newValue = e.target.value;\n\n this.setState({\n inputValue: newValue,\n });\n };\n\n private _onFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this.props.onInputFocus) this.props.onInputFocus(e);\n };\n\n /** Autosuggest will call this function every time you need to update suggestions. */\n private _onSuggestionsFetchRequested = async (\n request: ReactAutosuggest.SuggestionsFetchRequestedParams\n ): Promise<void> => {\n const value = request.value;\n const suggestions = await this._getSuggestions(value);\n\n if (this._isMounted) this.setState({ suggestions });\n };\n\n /** Autosuggest will call this function every time you need to clear suggestions. */\n private _onSuggestionsClearRequested = () => {\n this.setState({ suggestions: [] });\n this.props.onSuggestionsClearRequested &&\n this.props.onSuggestionsClearRequested();\n };\n\n private _onSuggestionSelected = (\n _event: React.FormEvent<any>,\n data: ReactAutosuggest.SuggestionSelectedEventData<AutoSuggestData>\n ): void => {\n this.props.onSuggestionSelected(data.suggestion);\n };\n\n /** Teach Autosuggest how to calculate suggestions for any given input value. */\n private _getSuggestions = async (\n value: string\n ): Promise<AutoSuggestData[]> => {\n if (typeof this.props.options === \"function\")\n return Promise.resolve(this.props.options(value));\n\n if (this.props.getSuggestions) return this.props.getSuggestions(value);\n\n if (this.props.options === undefined) {\n Logger.logError(\n UiCore.loggerCategory(this),\n `props.options or props.getSuggestions should be provided`\n );\n return Promise.resolve([]);\n }\n\n const inputValue = value.trim().toLowerCase();\n const inputLength = inputValue.length;\n\n return Promise.resolve(\n inputLength === 0\n ? /* istanbul ignore next */ []\n : this.props.options.filter((data: AutoSuggestData) => {\n return (\n data.label.toLowerCase().includes(inputValue) ||\n data.value.toLowerCase().includes(inputValue)\n );\n })\n );\n };\n\n /** When suggestion is clicked, Autosuggest needs to populate the input based on the clicked suggestion. */\n private _getSuggestionValue = (suggestion: AutoSuggestData) =>\n suggestion.label;\n\n /** Render each suggestion. */\n private _renderSuggestion = (suggestion: AutoSuggestData) => (\n <span>{suggestion.label}</span>\n );\n\n private getLabel(value: string | undefined): string {\n let label = \"\";\n\n if (this.props.getLabel) {\n label = this.props.getLabel(value);\n } else if (this.props.options instanceof Array) {\n const entry = this.props.options.find(\n (data: AutoSuggestData) => data.value === value\n );\n if (entry) label = entry.label;\n } else {\n Logger.logError(\n UiCore.loggerCategory(this),\n `props.getLabel should be provided when props.options is a function`\n );\n }\n\n return label;\n }\n\n private _handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n switch (e.key) {\n case Key.Enter:\n // istanbul ignore else\n if (this.props.onPressEnter) this.props.onPressEnter(e);\n break;\n case Key.Escape:\n // istanbul ignore else\n if (this.props.onPressEscape) this.props.onPressEscape(e);\n break;\n case Key.Tab:\n // istanbul ignore else\n if (this.props.onPressTab) this.props.onPressTab(e);\n break;\n }\n };\n\n private _theme = {\n container: \"uicore-autosuggest__container\",\n containerOpen: \"uicore-autosuggest__container--open\",\n input: \"uicore-autosuggest__input\",\n inputOpen: \"uicore-autosuggest__input--open\",\n inputFocused: \"uicore-autosuggest__input--focused\",\n suggestionsContainer: \"uicore-autosuggest__suggestions-container\",\n suggestionsContainerOpen: \"uicore-autosuggest__suggestions-container--open\",\n suggestionsList: \"uicore-autosuggest__suggestions-list\",\n suggestion: \"uicore-autosuggest__suggestion\",\n suggestionFirst: \"uicore-autosuggest__suggestion--first\",\n suggestionHighlighted: \"uicore-autosuggest__suggestion--highlighted\",\n sectionContainer: \"uicore-autosuggest__section-container\",\n sectionContainerFirst: \"uicore-autosuggest__section-container--first\",\n sectionTitle: \"uicore-autosuggest__section-title\",\n };\n\n public override render(): React.ReactElement {\n const { inputValue, suggestions } = this.state;\n const {\n value,\n onChange,\n placeholder,\n options,\n onSuggestionSelected,\n setFocus,\n alwaysRenderSuggestions,\n onPressEnter,\n onPressEscape,\n onPressTab,\n onInputFocus,\n getLabel,\n getSuggestions,\n renderInputComponent,\n renderSuggestionsContainer,\n onSuggestionsClearRequested,\n ...props\n } = this.props;\n const inputPlaceholder = !inputValue ? placeholder : undefined;\n\n const inputProps: ReactAutosuggest.InputProps<AutoSuggestData> = {\n ...props,\n value: inputValue,\n onChange: this._onChange,\n onFocus: this._onFocus,\n placeholder: inputPlaceholder,\n autoFocus: setFocus,\n };\n\n const defaultRenderInputComponent: React.ComponentProps<\n typeof ReactAutosuggest\n >[\"renderInputComponent\"] = (renderInputProps) => {\n const { size, ...other } = renderInputProps;\n return <Input {...other} />;\n };\n return (\n // The onKeyDown event handler is only being used to capture bubbled events\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className={this.props.className}\n style={this.props.style}\n onKeyDown={this._handleKeyDown}\n >\n <ReactAutosuggest\n theme={this._theme}\n suggestions={suggestions}\n onSuggestionsFetchRequested={this._onSuggestionsFetchRequested}\n onSuggestionsClearRequested={this._onSuggestionsClearRequested}\n getSuggestionValue={this._getSuggestionValue}\n renderSuggestion={this._renderSuggestion}\n inputProps={inputProps}\n onSuggestionSelected={this._onSuggestionSelected}\n alwaysRenderSuggestions={alwaysRenderSuggestions}\n renderInputComponent={\n renderInputComponent || defaultRenderInputComponent\n }\n renderSuggestionsContainer={renderSuggestionsContainer}\n />\n </div>\n );\n }\n}\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,OAAO,oBAAC,qBAAK,OAAK,KAAK,GAAI,CAAC;QAC9B,CAAC,CAAC;QACF,OAAO;QACL,2EAA2E;QAC3E,mEAAmE;QACnE,6BACE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,SAAS,EAAE,IAAI,CAAC,cAAc;YAE9B,oBAAC,gBAAgB,IACf,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,WAAW,EAAE,WAAW,EACxB,2BAA2B,EAAE,IAAI,CAAC,4BAA4B,EAC9D,2BAA2B,EAAE,IAAI,CAAC,4BAA4B,EAC9D,kBAAkB,EAAE,IAAI,CAAC,mBAAmB,EAC5C,gBAAgB,EAAE,IAAI,CAAC,iBAAiB,EACxC,UAAU,EAAE,UAAU,EACtB,oBAAoB,EAAE,IAAI,CAAC,qBAAqB,EAChD,uBAAuB,EAAE,uBAAuB,EAChD,oBAAoB,EAClB,oBAAoB,IAAI,2BAA2B,EAErD,0BAA0B,EAAE,0BAA0B,GACtD,CACE,CACP,CAAC;IACJ,CAAC;CACF;AAjPD,kCAiPC","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 AutoSuggest\n */\n\nimport \"./AutoSuggest.scss\";\nimport * as React from \"react\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport * as ReactAutosuggest from \"react-autosuggest\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { UiCore } from \"../UiCore\";\n\n/** Data for the [[AutoSuggest]] options\n * @public\n */\nexport interface AutoSuggestData {\n /** Value of [[AutoSuggest]] option. */\n value: string;\n /** Label of [[AutoSuggest]] option. This is shown in the dropdown. */\n label: string;\n}\n\n/** Prototype for function returning AutoSuggestData\n * @public\n */\nexport type GetAutoSuggestDataFunc = (value: string) => AutoSuggestData[];\n\n/** Prototype for async function returning AutoSuggestData\n * @public\n */\nexport type AsyncGetAutoSuggestDataFunc = (\n value: string\n) => Promise<AutoSuggestData[]>;\n\n/** Properties for the [[AutoSuggest]] component.\n * @public\n */\nexport interface AutoSuggestProps\n extends React.InputHTMLAttributes<HTMLInputElement>,\n CommonProps {\n /** Optional input value override. */\n value?: string;\n /** Options for dropdown. */\n options?: AutoSuggestData[] | GetAutoSuggestDataFunc;\n /** Asynchronously calculate suggestions for any given input value. */\n getSuggestions?: AsyncGetAutoSuggestDataFunc;\n /** Gets a label associated with a given value */\n getLabel?: (value: string | undefined) => string;\n /** Handler for when suggested selected. */\n onSuggestionSelected: (selected: AutoSuggestData) => void;\n /** Handler for Enter key. */\n onPressEnter?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Handler for Escape key. */\n onPressEscape?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Handler for Tab key. */\n onPressTab?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n /** Handler for input receiving focus. */\n onInputFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;\n /** Called every time you need to clear suggestions. */\n onSuggestionsClearRequested?: () => void;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n\n /** Use it only if you need to customize the rendering of the input.\n * @internal\n */\n renderInputComponent?: any; // ReactAutosuggest.RenderInputComponent<AutoSuggestData>; NOTE: changed to \"any\" because build was failing with RenderInputComponent is not generic?\n /** Use it if you want to customize things inside the suggestions container beyond rendering the suggestions themselves.\n * @internal\n */\n renderSuggestionsContainer?: ReactAutosuggest.RenderSuggestionsContainer;\n\n /** @internal */\n alwaysRenderSuggestions?: boolean;\n}\n\n/** @internal */\ninterface AutoSuggestState {\n inputValue: string;\n suggestions: AutoSuggestData[];\n}\n\n/** Auto Suggest React component. Uses the react-autosuggest component internally.\n * @public\n */\nexport class AutoSuggest extends React.PureComponent<\n AutoSuggestProps,\n AutoSuggestState\n> {\n private _isMounted = false;\n\n constructor(props: AutoSuggestProps) {\n super(props);\n\n // Autosuggest is a controlled component.\n // This means that you need to provide an input value\n // and an onChange handler that updates this value (see below).\n // Suggestions also need to be provided to the Autosuggest,\n // and they are initially empty because the Autosuggest is closed.\n this.state = {\n inputValue: this.getLabel(props.value),\n suggestions: [],\n };\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: AutoSuggestProps) {\n if (\n this.props.value !== prevProps.value ||\n this.props.options !== prevProps.options\n ) {\n this.setState((_prevState, props) => ({\n inputValue: this.getLabel(props.value),\n }));\n }\n }\n\n private _onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n let newValue = \"\";\n\n if (e.target.tagName === \"LI\" && e.target.textContent)\n newValue = e.target.textContent;\n else if (e.target.value) newValue = e.target.value;\n\n this.setState({\n inputValue: newValue,\n });\n };\n\n private _onFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this.props.onInputFocus) this.props.onInputFocus(e);\n };\n\n /** Autosuggest will call this function every time you need to update suggestions. */\n private _onSuggestionsFetchRequested = async (\n request: ReactAutosuggest.SuggestionsFetchRequestedParams\n ): Promise<void> => {\n const value = request.value;\n const suggestions = await this._getSuggestions(value);\n\n if (this._isMounted) this.setState({ suggestions });\n };\n\n /** Autosuggest will call this function every time you need to clear suggestions. */\n private _onSuggestionsClearRequested = () => {\n this.setState({ suggestions: [] });\n this.props.onSuggestionsClearRequested &&\n this.props.onSuggestionsClearRequested();\n };\n\n private _onSuggestionSelected = (\n _event: React.FormEvent<any>,\n data: ReactAutosuggest.SuggestionSelectedEventData<AutoSuggestData>\n ): void => {\n this.props.onSuggestionSelected(data.suggestion);\n };\n\n /** Teach Autosuggest how to calculate suggestions for any given input value. */\n private _getSuggestions = async (\n value: string\n ): Promise<AutoSuggestData[]> => {\n if (typeof this.props.options === \"function\")\n return Promise.resolve(this.props.options(value));\n\n if (this.props.getSuggestions) return this.props.getSuggestions(value);\n\n if (this.props.options === undefined) {\n Logger.logError(\n UiCore.loggerCategory(this),\n `props.options or props.getSuggestions should be provided`\n );\n return Promise.resolve([]);\n }\n\n const inputValue = value.trim().toLowerCase();\n const inputLength = inputValue.length;\n\n return Promise.resolve(\n inputLength === 0\n ? /* istanbul ignore next */ []\n : this.props.options.filter((data: AutoSuggestData) => {\n return (\n data.label.toLowerCase().includes(inputValue) ||\n data.value.toLowerCase().includes(inputValue)\n );\n })\n );\n };\n\n /** When suggestion is clicked, Autosuggest needs to populate the input based on the clicked suggestion. */\n private _getSuggestionValue = (suggestion: AutoSuggestData) =>\n suggestion.label;\n\n /** Render each suggestion. */\n private _renderSuggestion = (suggestion: AutoSuggestData) => (\n <span>{suggestion.label}</span>\n );\n\n private getLabel(value: string | undefined): string {\n let label = \"\";\n\n if (this.props.getLabel) {\n label = this.props.getLabel(value);\n } else if (this.props.options instanceof Array) {\n const entry = this.props.options.find(\n (data: AutoSuggestData) => data.value === value\n );\n if (entry) label = entry.label;\n } else {\n Logger.logError(\n UiCore.loggerCategory(this),\n `props.getLabel should be provided when props.options is a function`\n );\n }\n\n return label;\n }\n\n private _handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n switch (e.key) {\n case Key.Enter.valueOf():\n // istanbul ignore else\n if (this.props.onPressEnter) this.props.onPressEnter(e);\n break;\n case Key.Escape.valueOf():\n // istanbul ignore else\n if (this.props.onPressEscape) this.props.onPressEscape(e);\n break;\n case Key.Tab.valueOf():\n // istanbul ignore else\n if (this.props.onPressTab) this.props.onPressTab(e);\n break;\n }\n };\n\n private _theme = {\n container: \"uicore-autosuggest__container\",\n containerOpen: \"uicore-autosuggest__container--open\",\n input: \"uicore-autosuggest__input\",\n inputOpen: \"uicore-autosuggest__input--open\",\n inputFocused: \"uicore-autosuggest__input--focused\",\n suggestionsContainer: \"uicore-autosuggest__suggestions-container\",\n suggestionsContainerOpen: \"uicore-autosuggest__suggestions-container--open\",\n suggestionsList: \"uicore-autosuggest__suggestions-list\",\n suggestion: \"uicore-autosuggest__suggestion\",\n suggestionFirst: \"uicore-autosuggest__suggestion--first\",\n suggestionHighlighted: \"uicore-autosuggest__suggestion--highlighted\",\n sectionContainer: \"uicore-autosuggest__section-container\",\n sectionContainerFirst: \"uicore-autosuggest__section-container--first\",\n sectionTitle: \"uicore-autosuggest__section-title\",\n };\n\n public override render(): React.ReactElement {\n const { inputValue, suggestions } = this.state;\n const {\n value,\n onChange,\n placeholder,\n options,\n onSuggestionSelected,\n setFocus,\n alwaysRenderSuggestions,\n onPressEnter,\n onPressEscape,\n onPressTab,\n onInputFocus,\n getLabel,\n getSuggestions,\n renderInputComponent,\n renderSuggestionsContainer,\n onSuggestionsClearRequested,\n ...props\n } = this.props;\n const inputPlaceholder = !inputValue ? placeholder : undefined;\n\n const inputProps: ReactAutosuggest.InputProps<AutoSuggestData> = {\n ...props,\n value: inputValue,\n onChange: this._onChange,\n onFocus: this._onFocus,\n placeholder: inputPlaceholder,\n autoFocus: setFocus,\n };\n\n const defaultRenderInputComponent: React.ComponentProps<\n typeof ReactAutosuggest\n >[\"renderInputComponent\"] = (renderInputProps) => {\n const { size, ...other } = renderInputProps;\n return <Input {...other} />;\n };\n return (\n // The onKeyDown event handler is only being used to capture bubbled events\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className={this.props.className}\n style={this.props.style}\n onKeyDown={this._handleKeyDown}\n >\n <ReactAutosuggest\n theme={this._theme}\n suggestions={suggestions}\n onSuggestionsFetchRequested={this._onSuggestionsFetchRequested}\n onSuggestionsClearRequested={this._onSuggestionsClearRequested}\n getSuggestionValue={this._getSuggestionValue}\n renderSuggestion={this._renderSuggestion}\n inputProps={inputProps}\n onSuggestionSelected={this._onSuggestionSelected}\n alwaysRenderSuggestions={alwaysRenderSuggestions}\n renderInputComponent={\n renderInputComponent || defaultRenderInputComponent\n }\n renderSuggestionsContainer={renderSuggestionsContainer}\n />\n </div>\n );\n }\n}\n"]}
@@ -19,7 +19,7 @@ function UnderlinedButton(props) {
19
19
  const handleKeyUp = React.useCallback((event) => {
20
20
  const key = event.key;
21
21
  switch (key) {
22
- case ts_key_enum_1.Key.Enter:
22
+ case ts_key_enum_1.Key.Enter.valueOf():
23
23
  case " ":
24
24
  props.onActivate && props.onActivate();
25
25
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"UnderlinedButton.js","sourceRoot":"","sources":["../../../../src/core-react/button/UnderlinedButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,mCAAiC;AACjC,2CAAoC;AACpC,+BAA+B;AAC/B,6CAAkC;AAkBlC;;GAEG;AACH,SAAgB,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,CAAC,KAA0B,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QAEtB,QAAQ,GAAG,EAAE;YACX,KAAK,iBAAG,CAAC,KAAK,CAAC;YACf,KAAK,GAAG;gBACN,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;gBACvC,MAAM;SACT;IACH,CAAC,EACD,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,CAAC,CAAmB,EAAE,EAAE;QACtB,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAClC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;IACzC,CAAC,EACD,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,MAAM,SAAS,GAAG,IAAA,oBAAU,EAC1B,wBAAwB,EACxB,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAC9C,CAAC;IAEF,OAAO,CACL,8BACE,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,CAAC,EACX,IAAI,EAAC,MAAM,IAEV,KAAK,CAAC,QAAQ,CACV,CACR,CAAC;AACJ,CAAC;AAxCD,4CAwCC","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 Button\n */\n\nimport \"./UnderlinedButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\n\n/** Properties for the [[UnderlinedButton]] React component\n * @public\n */\nexport interface UnderlinedButtonProps {\n /** String that will be rendered by the button */\n children: string | React.ReactNode;\n /** Additional className */\n className?: string;\n /** Title of the button */\n title?: string;\n /** Callback to onClick event */\n onClick?: (e: React.MouseEvent) => void;\n /** Callback to activate */\n onActivate?: () => void;\n}\n\n/** A React component that makes text clickable and underlined\n * @public\n */\nexport function UnderlinedButton(props: UnderlinedButtonProps) {\n const handleKeyUp = React.useCallback(\n (event: React.KeyboardEvent) => {\n const key = event.key;\n\n switch (key) {\n case Key.Enter:\n case \" \":\n props.onActivate && props.onActivate();\n break;\n }\n },\n [props]\n );\n\n const handleClick = React.useCallback(\n (e: React.MouseEvent) => {\n props.onClick && props.onClick(e);\n props.onActivate && props.onActivate();\n },\n [props]\n );\n\n const className = classnames(\n \"core-underlined-button\",\n props.className ? props.className : undefined\n );\n\n return (\n <span\n className={className}\n title={props.title}\n onClick={handleClick}\n onKeyUp={handleKeyUp}\n tabIndex={0}\n role=\"link\"\n >\n {props.children}\n </span>\n );\n}\n"]}
1
+ {"version":3,"file":"UnderlinedButton.js","sourceRoot":"","sources":["../../../../src/core-react/button/UnderlinedButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,mCAAiC;AACjC,2CAAoC;AACpC,+BAA+B;AAC/B,6CAAkC;AAkBlC;;GAEG;AACH,SAAgB,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,CAAC,KAA0B,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QAEtB,QAAQ,GAAG,EAAE;YACX,KAAK,iBAAG,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACzB,KAAK,GAAG;gBACN,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;gBACvC,MAAM;SACT;IACH,CAAC,EACD,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,CAAC,CAAmB,EAAE,EAAE;QACtB,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAClC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;IACzC,CAAC,EACD,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,MAAM,SAAS,GAAG,IAAA,oBAAU,EAC1B,wBAAwB,EACxB,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAC9C,CAAC;IAEF,OAAO,CACL,8BACE,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,CAAC,EACX,IAAI,EAAC,MAAM,IAEV,KAAK,CAAC,QAAQ,CACV,CACR,CAAC;AACJ,CAAC;AAxCD,4CAwCC","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 Button\n */\n\nimport \"./UnderlinedButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\n\n/** Properties for the [[UnderlinedButton]] React component\n * @public\n */\nexport interface UnderlinedButtonProps {\n /** String that will be rendered by the button */\n children: string | React.ReactNode;\n /** Additional className */\n className?: string;\n /** Title of the button */\n title?: string;\n /** Callback to onClick event */\n onClick?: (e: React.MouseEvent) => void;\n /** Callback to activate */\n onActivate?: () => void;\n}\n\n/** A React component that makes text clickable and underlined\n * @public\n */\nexport function UnderlinedButton(props: UnderlinedButtonProps) {\n const handleKeyUp = React.useCallback(\n (event: React.KeyboardEvent) => {\n const key = event.key;\n\n switch (key) {\n case Key.Enter.valueOf():\n case \" \":\n props.onActivate && props.onActivate();\n break;\n }\n },\n [props]\n );\n\n const handleClick = React.useCallback(\n (e: React.MouseEvent) => {\n props.onClick && props.onClick(e);\n props.onActivate && props.onActivate();\n },\n [props]\n );\n\n const className = classnames(\n \"core-underlined-button\",\n props.className ? props.className : undefined\n );\n\n return (\n <span\n className={className}\n title={props.title}\n onClick={handleClick}\n onKeyUp={handleKeyUp}\n tabIndex={0}\n role=\"link\"\n >\n {props.children}\n </span>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenu.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAI9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,+CAA+C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 @@ class ContextMenu extends React.PureComponent {
150
150
  }
151
151
  }
152
152
  }
153
- if (event.key === ts_key_enum_1.Key.ArrowLeft) {
153
+ if (event.key === ts_key_enum_1.Key.ArrowLeft.valueOf()) {
154
154
  event.stopPropagation();
155
155
  if (this.props.parentMenu && this.props.parentSubmenu) {
156
156
  this.props.parentSubmenu.close();
@@ -159,16 +159,17 @@ class ContextMenu extends React.PureComponent {
159
159
  if (this.props.onEsc)
160
160
  this.props.onEsc(event);
161
161
  }
162
- if (event.key === ts_key_enum_1.Key.Escape) {
162
+ if (event.key === ts_key_enum_1.Key.Escape.valueOf()) {
163
163
  // istanbul ignore else
164
164
  if (this.props.onEsc)
165
165
  this.props.onEsc(event);
166
166
  }
167
- if ((event.key === ts_key_enum_1.Key.Enter || event.key === ts_key_enum_1.Key.ArrowRight) &&
167
+ if ((event.key === ts_key_enum_1.Key.Enter.valueOf() ||
168
+ event.key === ts_key_enum_1.Key.ArrowRight.valueOf()) &&
168
169
  this._selectedElement) {
169
170
  event.stopPropagation();
170
171
  // istanbul ignore else
171
- if (event.key === ts_key_enum_1.Key.Enter ||
172
+ if (event.key === ts_key_enum_1.Key.Enter.valueOf() ||
172
173
  /* istanbul ignore next */ this._selectedElement instanceof
173
174
  ContextSubMenu_1.ContextSubMenu) {
174
175
  // istanbul ignore else
@@ -177,19 +178,20 @@ class ContextMenu extends React.PureComponent {
177
178
  }
178
179
  }
179
180
  let { selectedIndex } = this.state;
180
- if (event.key === ts_key_enum_1.Key.ArrowUp || event.key === ts_key_enum_1.Key.ArrowDown) {
181
+ if (event.key === ts_key_enum_1.Key.ArrowUp.valueOf() ||
182
+ event.key === ts_key_enum_1.Key.ArrowDown.valueOf()) {
181
183
  event.stopPropagation();
182
184
  if (selectedIndex === -1) {
183
185
  selectedIndex = 0;
184
186
  }
185
187
  else {
186
- if (event.key === ts_key_enum_1.Key.ArrowUp) {
188
+ if (event.key === ts_key_enum_1.Key.ArrowUp.valueOf()) {
187
189
  if (this.state.selectedIndex === 0)
188
190
  selectedIndex = this._length - 1;
189
191
  else
190
192
  selectedIndex--;
191
193
  }
192
- if (event.key === ts_key_enum_1.Key.ArrowDown) {
194
+ if (event.key === ts_key_enum_1.Key.ArrowDown.valueOf()) {
193
195
  if (this.state.selectedIndex === this._length - 1)
194
196
  selectedIndex = 0;
195
197
  else
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenu.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,8BAA4B;AAC5B,2CAAoC;AACpC,+BAA+B;AAC/B,6CAAkC;AAClC,0DAAgE;AAEhE,qEAAkE;AAClE,iEAA8D;AAE9D,uDAAoD;AAEpD,qDAAkD;AA2ClD;;;;GAIG;AACH,MAAa,WAAY,SAAQ,KAAK,CAAC,aAGtC;IA0BC,YAAY,KAAuB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QA1BP,iBAAY,GAAuB,IAAI,CAAC;QACxC,iBAAY,GAAuB,IAAI,CAAC;QACxC,qBAAgB,GAA4C,IAAI,CAAC;QACjE,YAAO,GAAW,CAAC,CAAC;QACpB,eAAU,GAAwB,IAAI,GAAG,EAAE,CAAC;QAG5C,mBAAc,GACpB,2CAAoB,CAAC,WAAW,CAAC;QAC3B,uBAAkB,GAAW,CAAC,CAAC;QAE/B,wBAAmB,GAAW,CAAC,CAAC;QAChC,uBAAkB,GAAW,CAAC,CAAC;QAoF/B,wBAAmB,GAAG,CAAC,KAAa,EAAE,MAAc,EAAE,EAAE;YAC9D,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrC,CAAC,CAAC;QAEF,uBAAuB;QACf,0BAAqB,GAAG,CAAC,KAAiB,EAAQ,EAAE;YAC1D,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc;gBAChD,IAAI,CAAC,KA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+C,CAAC;YAC5D,MAAM;QACR,KAAK,2CAAoB,CAAC,IAAI;YAC5B,SAAS,GAAG,wBAAwB,CAAC;YACrC,MAAM;QACR,KAAK,2CAAoB,CAAC,MAAM;YAC9B,SAAS,GAAG,0BAA0B,CAAC;YACvC,MAAM;QACR,KAAK,2CAAoB,CAAC,KAAK;YAC7B,SAAS,GAAG,yBAAyB,CAAC;YACtC,MAAM;QACR,KAAK,2CAAoB,CAAC,UAAU;YAClC,SAAS,GAAG,iDAAiD,CAAC;YAC9D,MAAM;QACR,KAAK,2CAAoB,CAAC,MAAM;YAC9B,SAAS,GAAG,0BAA0B,CAAC;YACvC,MAAM;QACR,KAAK,2CAAoB,CAAC,WAAW;YACnC,SAAS,GAAG,kDAAkD,CAAC;YAC/D,MAAM;KACT;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,AAzCyC,CAyCxC;AA7NS,kCAAW","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 ContextMenu\n */\n\nimport \"./ContextMenu.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport { ContextMenuDirection } from \"./ContextMenuDirection\";\nimport type { ContextMenuItemProps } from \"./ContextMenuItem\";\nimport { ContextMenuItem } from \"./ContextMenuItem\";\nimport type { ContextSubMenuProps } from \"./ContextSubMenu\";\nimport { ContextSubMenu } from \"./ContextSubMenu\";\n\n/** Properties for the [[ContextMenu]] component\n * @public\n */\nexport interface ContextMenuProps extends CommonProps {\n /** Whether ContextMenu is currently opened. */\n opened: boolean;\n /** Which direction the menu opens. Default: ContextMenuDirection.BottomRight */\n direction?: ContextMenuDirection;\n /** When click is registered outside of ContextMenu. */\n onOutsideClick?: (event: MouseEvent) => any;\n /** When list item or submenu is selected */\n onSelect?: (event: any) => any;\n /** when Escape button is pressed */\n onEsc?: (data: any) => any;\n /** Whether menu flips directions based on screen edge. Default: true */\n autoflip?: boolean;\n /** Whether menu hugs screen edge when autoflip is off. Default: true */\n edgeLimit?: boolean;\n /** Whether Hotkey press selects item, or just highlights item. Default: true */\n hotkeySelect?: boolean;\n /** starting menu item selected index Default: -1 */\n selectedIndex?: number;\n /** whether menu floats on the viewport, or the page. When false, container elements can clip menu with overflow: hidden; Default: true */\n floating?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n /** @internal */\n parentSubmenu?: ContextSubMenu;\n /** @internal */\n ignoreNextKeyUp?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\n/** @internal */\ninterface ContextMenuState {\n selectedIndex: number;\n direction: ContextMenuDirection;\n ignoreNextKeyUp: boolean;\n}\n\n/**\n * A context menu populated with [[ContextMenuItem]] components.\n * Can be nested using [[ContextSubMenu]] component.\n * @public\n */\nexport class ContextMenu extends React.PureComponent<\n ContextMenuProps,\n ContextMenuState\n> {\n private _rootElement: HTMLElement | null = null;\n private _menuElement: HTMLElement | null = null;\n private _selectedElement: ContextMenuItem | ContextSubMenu | null = null;\n private _length: number = 0;\n private _hotKeyMap: Map<number, string> = new Map();\n\n private _lastChildren: React.ReactNode;\n private _lastDirection: ContextMenuDirection | undefined =\n ContextMenuDirection.BottomRight;\n private _lastSelectedIndex: number = 0;\n private _injectedChildren: React.ReactNode;\n private _parentWindowHeight: number = 0;\n private _parentWindowWidth: number = 0;\n\n public static defaultProps: Partial<ContextMenuProps> = {\n direction: ContextMenuDirection.BottomRight,\n autoflip: true,\n edgeLimit: true,\n hotkeySelect: true,\n selectedIndex: -1,\n floating: true,\n };\n\n /** @internal */\n public override readonly state: Readonly<ContextMenuState>;\n constructor(props: ContextMenuProps) {\n super(props);\n this.state = {\n selectedIndex: this.props.selectedIndex!,\n direction: props.direction!,\n ignoreNextKeyUp: props.ignoreNextKeyUp!,\n };\n }\n\n /** @internal */\n public static autoFlip = (\n dir: ContextMenuDirection,\n rect: DOMRectReadOnly,\n windowWidth: number,\n windowHeight: number\n ): ContextMenuDirection => {\n if (rect.right > windowWidth) {\n switch (dir) {\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Right:\n dir = ContextMenuDirection.Left;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.BottomLeft;\n break;\n }\n }\n if (rect.left < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.TopRight;\n break;\n case ContextMenuDirection.Left:\n dir = ContextMenuDirection.Right;\n break;\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n if (rect.bottom > windowHeight) {\n switch (dir) {\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Bottom:\n dir = ContextMenuDirection.Top;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.TopRight;\n break;\n }\n }\n if (rect.top < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.BottomLeft;\n break;\n case ContextMenuDirection.Top:\n dir = ContextMenuDirection.Bottom;\n break;\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n return dir;\n };\n\n private _handleHotKeyParsed = (index: number, hotKey: string) => {\n this._hotKeyMap.set(index, hotKey);\n };\n\n // istanbul ignore next\n private _handleOnOutsideClick = (event: MouseEvent): void => {\n if (this.props.opened && this.props.onOutsideClick)\n this.props.onOutsideClick(event);\n };\n\n public override render(): React.ReactElement {\n const {\n opened,\n direction,\n onOutsideClick,\n onSelect,\n onEsc,\n autoflip,\n edgeLimit,\n hotkeySelect,\n selectedIndex,\n floating,\n parentMenu,\n parentSubmenu,\n children,\n className,\n ignoreNextKeyUp,\n ...props\n } = this.props;\n const renderDirection =\n parentMenu === undefined ? this.state.direction : direction;\n\n if (\n this._lastChildren !== children ||\n this._lastDirection !== renderDirection ||\n this._lastSelectedIndex !== this.state.selectedIndex\n ) {\n this._injectedChildren = this._injectMenuItemProps(\n children,\n renderDirection,\n this.state.selectedIndex\n );\n this._lastChildren = children;\n this._lastDirection = renderDirection;\n this._lastSelectedIndex = this.state.selectedIndex;\n }\n\n const classNames = classnames(\"core-context-menu\", className);\n\n return (\n <div\n role=\"presentation\"\n className={classNames}\n onKeyUp={this._handleKeyUp}\n onClick={this._handleClick}\n data-testid=\"core-context-menu-root\"\n {...props}\n ref={this._rootRef}\n >\n <DivWithOutsideClick onOutsideClick={this._handleOnOutsideClick}>\n <div\n ref={this._menuRef}\n role=\"menu\"\n tabIndex={0}\n data-testid=\"core-context-menu-container\"\n className={classnames(\n \"core-context-menu-container\",\n opened && \"core-context-menu-opened\",\n floating && \"core-context-menu-floating\",\n ContextMenu.getCSSClassNameFromDirection(renderDirection)\n )}\n >\n {this._injectedChildren}\n </div>\n </DivWithOutsideClick>\n </div>\n );\n }\n\n /** @internal */\n public static getCSSClassNameFromDirection = (\n direction?: ContextMenuDirection\n ): string => {\n let className = \"\";\n\n // istanbul ignore next\n if (direction === undefined) direction = ContextMenuDirection.BottomRight;\n\n if (direction === ContextMenuDirection.None) return \"\";\n\n switch (direction) {\n case ContextMenuDirection.TopLeft:\n className = \"core-context-menu-top core-context-menu-left\";\n break;\n case ContextMenuDirection.Top:\n className = \"core-context-menu-top\";\n break;\n case ContextMenuDirection.TopRight:\n className = \"core-context-menu-top core-context-menu-right\";\n break;\n case ContextMenuDirection.Left:\n className = \"core-context-menu-left\";\n break;\n case ContextMenuDirection.Center:\n className = \"core-context-menu-center\";\n break;\n case ContextMenuDirection.Right:\n className = \"core-context-menu-right\";\n break;\n case ContextMenuDirection.BottomLeft:\n className = \"core-context-menu-bottom core-context-menu-left\";\n break;\n case ContextMenuDirection.Bottom:\n className = \"core-context-menu-bottom\";\n break;\n case ContextMenuDirection.BottomRight:\n className = \"core-context-menu-bottom core-context-menu-right\";\n break;\n }\n\n return className;\n };\n\n private _injectMenuItemProps = (\n children: React.ReactNode,\n direction: ContextMenuDirection | undefined,\n selectedIndex: number\n ) => {\n let index = 0;\n // add inheritance data to submenu children\n const ch = React.Children.map(children, (child: React.ReactNode) => {\n // Capture only ContextSubMenus and ContextMenuItems.\n if (\n child &&\n typeof child === \"object\" &&\n \"props\" in child &&\n (child.type === ContextSubMenu || child.type === ContextMenuItem) &&\n !ConditionalBooleanValue.getValue(child.props.disabled) &&\n !ConditionalBooleanValue.getValue(child.props.hidden)\n ) {\n const id = index; // get separate id variable so value stays the same when onHover is called later.\n const onHover = () => {\n this.setState({ selectedIndex: id });\n this.focus();\n };\n const ref = (el: ContextSubMenu | ContextMenuItem | null) => {\n if (selectedIndex === id)\n // only save to this._selectedElement if previously captured bool is true\n this._selectedElement = el;\n };\n const boundHandleHotKeyParse = this._handleHotKeyParsed.bind(this, id); // bind local callback for specific index\n const childProps: Partial<\n ContextSubMenuProps & ContextMenuItemProps & { ref: typeof ref }\n > = {\n parentMenu: this,\n ref,\n onHover,\n isSelected: selectedIndex === id,\n onHotKeyParsed: boundHandleHotKeyParse,\n };\n if (child.type === ContextSubMenu) {\n // add direction only to sub-menus\n childProps.direction =\n child.props.direction || /* istanbul ignore next */ direction;\n }\n index++;\n return React.cloneElement(child, childProps);\n } else return child; // Else, pass through unmodified\n });\n this._length = index;\n return ch;\n };\n\n private _rootRef = (el: HTMLDivElement | null) => {\n this._rootElement = el;\n };\n\n private _menuRef = (el: HTMLDivElement | null) => {\n this._menuElement = el;\n };\n\n private getWindow() {\n const el = this._rootElement\n ? this._rootElement\n : /* istanbul ignore next */ this._menuElement;\n const parentDocument = el!.ownerDocument;\n // istanbul ignore next\n return parentDocument.defaultView ?? window;\n }\n\n /** @internal */\n public override componentDidMount() {\n const parentWindow = this.getWindow();\n parentWindow.addEventListener(\"focus\", this._handleFocusChange);\n parentWindow.addEventListener(\"mouseup\", this._handleFocusChange);\n\n this.checkRenderDirection();\n\n if (this.props.opened) this.focus();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n const parentWindow = this.getWindow();\n parentWindow.removeEventListener(\"focus\", this._handleFocusChange);\n parentWindow.removeEventListener(\"mouseup\", this._handleFocusChange);\n }\n\n private checkRenderDirection() {\n const { direction, autoflip, parentMenu } = this.props;\n const parentWindow = this.getWindow();\n\n let renderDirection =\n parentMenu === undefined ? this.state.direction : direction;\n\n if (\n parentWindow.innerHeight === this._parentWindowHeight &&\n parentWindow.innerWidth === this._parentWindowWidth\n )\n return;\n this._parentWindowHeight = parentWindow.innerHeight;\n this._parentWindowWidth = parentWindow.innerWidth;\n\n // check if menu should flip\n if (parentWindow && autoflip && parentMenu === undefined) {\n const menuRect = this.getRect();\n renderDirection = ContextMenu.autoFlip(\n renderDirection!,\n menuRect,\n parentWindow.innerWidth,\n parentWindow.innerHeight\n );\n // istanbul ignore next\n if (renderDirection !== this.state.direction)\n this.setState({ direction: renderDirection });\n }\n }\n\n public focus = () => {\n // istanbul ignore else\n if (this._menuElement) this._menuElement.focus();\n };\n\n public blur = () => {\n // istanbul ignore else\n if (this._menuElement) this._menuElement.blur();\n };\n\n public getRect = (): DOMRect => {\n let clientRect = DOMRect.fromRect({ x: 0, y: 0, width: 0, height: 0 });\n\n // istanbul ignore else\n if (this._menuElement) {\n clientRect = this._menuElement.getBoundingClientRect();\n }\n return clientRect;\n };\n\n private _handleFocusChange = (event: any): void => {\n // istanbul ignore else\n if (\n this._rootElement &&\n this.props.opened &&\n event.target instanceof Node &&\n this.props.onOutsideClick &&\n !this._rootElement.contains(event.target)\n )\n this.props.onOutsideClick(event);\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n if (this.props.onSelect) this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (this.state.ignoreNextKeyUp) {\n this.setState({ ignoreNextKeyUp: false });\n return;\n }\n\n // istanbul ignore else\n if (event.key) {\n for (const [key, value] of this._hotKeyMap) {\n if (!this.props.hotkeySelect! && key > this.state.selectedIndex) {\n // Start search at current index.\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key });\n return;\n }\n }\n }\n for (const [key, value] of this._hotKeyMap) {\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key }, () => {\n if (this.props.hotkeySelect && this._selectedElement) {\n this._selectedElement.select();\n }\n });\n event.stopPropagation();\n return;\n }\n }\n }\n\n if (event.key === Key.ArrowLeft) {\n event.stopPropagation();\n if (this.props.parentMenu && this.props.parentSubmenu) {\n this.props.parentSubmenu.close();\n this.props.parentMenu.focus();\n }\n if (this.props.onEsc) this.props.onEsc(event);\n }\n\n if (event.key === Key.Escape) {\n // istanbul ignore else\n if (this.props.onEsc) this.props.onEsc(event);\n }\n\n if (\n (event.key === Key.Enter || event.key === Key.ArrowRight) &&\n this._selectedElement\n ) {\n event.stopPropagation();\n\n // istanbul ignore else\n if (\n event.key === Key.Enter ||\n /* istanbul ignore next */ this._selectedElement instanceof\n ContextSubMenu\n ) {\n // istanbul ignore else\n if (this._selectedElement.select) this._selectedElement.select();\n }\n }\n\n let { selectedIndex } = this.state;\n if (event.key === Key.ArrowUp || event.key === Key.ArrowDown) {\n event.stopPropagation();\n if (selectedIndex === -1) {\n selectedIndex = 0;\n } else {\n if (event.key === Key.ArrowUp) {\n if (this.state.selectedIndex === 0) selectedIndex = this._length - 1;\n else selectedIndex--;\n }\n if (event.key === Key.ArrowDown) {\n if (this.state.selectedIndex === this._length - 1) selectedIndex = 0;\n else selectedIndex++;\n }\n }\n }\n this.setState({ selectedIndex });\n };\n\n public override componentDidUpdate(prevProps: ContextMenuProps) {\n if (prevProps.selectedIndex !== this.props.selectedIndex) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!prevProps.opened && this.props.opened) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!this.props.parentMenu) {\n // const direction = this.props.direction!;\n // if ((!this.props.opened && prevProps.opened && direction !== this.state.direction) || prevProps.direction !== direction)\n this.checkRenderDirection();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenu.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,8BAA4B;AAC5B,2CAAoC;AACpC,+BAA+B;AAC/B,6CAAkC;AAClC,0DAAgE;AAEhE,qEAAkE;AAClE,iEAA8D;AAE9D,uDAAoD;AAEpD,qDAAkD;AA2ClD;;;;GAIG;AACH,MAAa,WAAY,SAAQ,KAAK,CAAC,aAGtC;IA0BC,YAAY,KAAuB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QA1BP,iBAAY,GAAuB,IAAI,CAAC;QACxC,iBAAY,GAAuB,IAAI,CAAC;QACxC,qBAAgB,GAA4C,IAAI,CAAC;QACjE,YAAO,GAAW,CAAC,CAAC;QACpB,eAAU,GAAwB,IAAI,GAAG,EAAE,CAAC;QAG5C,mBAAc,GACpB,2CAAoB,CAAC,WAAW,CAAC;QAC3B,uBAAkB,GAAW,CAAC,CAAC;QAE/B,wBAAmB,GAAW,CAAC,CAAC;QAChC,uBAAkB,GAAW,CAAC,CAAC;QAoF/B,wBAAmB,GAAG,CAAC,KAAa,EAAE,MAAc,EAAE,EAAE;YAC9D,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrC,CAAC,CAAC;QAEF,uBAAuB;QACf,0BAAqB,GAAG,CAAC,KAAiB,EAAQ,EAAE;YAC1D,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc;gBAChD,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC,CAAC;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3B,SAAS,GAAG,uBAAuB,CAAC;YACpC,MAAM;QACR,KAAK,2CAAoB,CAAC,QAAQ;YAChC,SAAS,GAAG,+CAA+C,CAAC;YAC5D,MAAM;QACR,KAAK,2CAAoB,CAAC,IAAI;YAC5B,SAAS,GAAG,wBAAwB,CAAC;YACrC,MAAM;QACR,KAAK,2CAAoB,CAAC,MAAM;YAC9B,SAAS,GAAG,0BAA0B,CAAC;YACvC,MAAM;QACR,KAAK,2CAAoB,CAAC,KAAK;YAC7B,SAAS,GAAG,yBAAyB,CAAC;YACtC,MAAM;QACR,KAAK,2CAAoB,CAAC,UAAU;YAClC,SAAS,GAAG,iDAAiD,CAAC;YAC9D,MAAM;QACR,KAAK,2CAAoB,CAAC,MAAM;YAC9B,SAAS,GAAG,0BAA0B,CAAC;YACvC,MAAM;QACR,KAAK,2CAAoB,CAAC,WAAW;YACnC,SAAS,GAAG,kDAAkD,CAAC;YAC/D,MAAM;KACT;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,AAzCyC,CAyCxC;AA7NS,kCAAW","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 ContextMenu\n */\n\nimport \"./ContextMenu.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport { ContextMenuDirection } from \"./ContextMenuDirection\";\nimport type { ContextMenuItemProps } from \"./ContextMenuItem\";\nimport { ContextMenuItem } from \"./ContextMenuItem\";\nimport type { ContextSubMenuProps } from \"./ContextSubMenu\";\nimport { ContextSubMenu } from \"./ContextSubMenu\";\n\n/** Properties for the [[ContextMenu]] component\n * @public\n */\nexport interface ContextMenuProps extends CommonProps {\n /** Whether ContextMenu is currently opened. */\n opened: boolean;\n /** Which direction the menu opens. Default: ContextMenuDirection.BottomRight */\n direction?: ContextMenuDirection;\n /** When click is registered outside of ContextMenu. */\n onOutsideClick?: (event: MouseEvent) => any;\n /** When list item or submenu is selected */\n onSelect?: (event: any) => any;\n /** when Escape button is pressed */\n onEsc?: (data: any) => any;\n /** Whether menu flips directions based on screen edge. Default: true */\n autoflip?: boolean;\n /** Whether menu hugs screen edge when autoflip is off. Default: true */\n edgeLimit?: boolean;\n /** Whether Hotkey press selects item, or just highlights item. Default: true */\n hotkeySelect?: boolean;\n /** starting menu item selected index Default: -1 */\n selectedIndex?: number;\n /** whether menu floats on the viewport, or the page. When false, container elements can clip menu with overflow: hidden; Default: true */\n floating?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n /** @internal */\n parentSubmenu?: ContextSubMenu;\n /** @internal */\n ignoreNextKeyUp?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\n/** @internal */\ninterface ContextMenuState {\n selectedIndex: number;\n direction: ContextMenuDirection;\n ignoreNextKeyUp: boolean;\n}\n\n/**\n * A context menu populated with [[ContextMenuItem]] components.\n * Can be nested using [[ContextSubMenu]] component.\n * @public\n */\nexport class ContextMenu extends React.PureComponent<\n ContextMenuProps,\n ContextMenuState\n> {\n private _rootElement: HTMLElement | null = null;\n private _menuElement: HTMLElement | null = null;\n private _selectedElement: ContextMenuItem | ContextSubMenu | null = null;\n private _length: number = 0;\n private _hotKeyMap: Map<number, string> = new Map();\n\n private _lastChildren: React.ReactNode;\n private _lastDirection: ContextMenuDirection | undefined =\n ContextMenuDirection.BottomRight;\n private _lastSelectedIndex: number = 0;\n private _injectedChildren: React.ReactNode;\n private _parentWindowHeight: number = 0;\n private _parentWindowWidth: number = 0;\n\n public static defaultProps: Partial<ContextMenuProps> = {\n direction: ContextMenuDirection.BottomRight,\n autoflip: true,\n edgeLimit: true,\n hotkeySelect: true,\n selectedIndex: -1,\n floating: true,\n };\n\n /** @internal */\n public override readonly state: Readonly<ContextMenuState>;\n constructor(props: ContextMenuProps) {\n super(props);\n this.state = {\n selectedIndex: this.props.selectedIndex!,\n direction: props.direction!,\n ignoreNextKeyUp: props.ignoreNextKeyUp!,\n };\n }\n\n /** @internal */\n public static autoFlip = (\n dir: ContextMenuDirection,\n rect: DOMRectReadOnly,\n windowWidth: number,\n windowHeight: number\n ): ContextMenuDirection => {\n if (rect.right > windowWidth) {\n switch (dir) {\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Right:\n dir = ContextMenuDirection.Left;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.BottomLeft;\n break;\n }\n }\n if (rect.left < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.TopRight;\n break;\n case ContextMenuDirection.Left:\n dir = ContextMenuDirection.Right;\n break;\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n if (rect.bottom > windowHeight) {\n switch (dir) {\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Bottom:\n dir = ContextMenuDirection.Top;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.TopRight;\n break;\n }\n }\n if (rect.top < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.BottomLeft;\n break;\n case ContextMenuDirection.Top:\n dir = ContextMenuDirection.Bottom;\n break;\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n return dir;\n };\n\n private _handleHotKeyParsed = (index: number, hotKey: string) => {\n this._hotKeyMap.set(index, hotKey);\n };\n\n // istanbul ignore next\n private _handleOnOutsideClick = (event: MouseEvent): void => {\n if (this.props.opened && this.props.onOutsideClick)\n this.props.onOutsideClick(event);\n };\n\n public override render(): React.ReactElement {\n const {\n opened,\n direction,\n onOutsideClick,\n onSelect,\n onEsc,\n autoflip,\n edgeLimit,\n hotkeySelect,\n selectedIndex,\n floating,\n parentMenu,\n parentSubmenu,\n children,\n className,\n ignoreNextKeyUp,\n ...props\n } = this.props;\n const renderDirection =\n parentMenu === undefined ? this.state.direction : direction;\n\n if (\n this._lastChildren !== children ||\n this._lastDirection !== renderDirection ||\n this._lastSelectedIndex !== this.state.selectedIndex\n ) {\n this._injectedChildren = this._injectMenuItemProps(\n children,\n renderDirection,\n this.state.selectedIndex\n );\n this._lastChildren = children;\n this._lastDirection = renderDirection;\n this._lastSelectedIndex = this.state.selectedIndex;\n }\n\n const classNames = classnames(\"core-context-menu\", className);\n\n return (\n <div\n role=\"presentation\"\n className={classNames}\n onKeyUp={this._handleKeyUp}\n onClick={this._handleClick}\n data-testid=\"core-context-menu-root\"\n {...props}\n ref={this._rootRef}\n >\n <DivWithOutsideClick onOutsideClick={this._handleOnOutsideClick}>\n <div\n ref={this._menuRef}\n role=\"menu\"\n tabIndex={0}\n data-testid=\"core-context-menu-container\"\n className={classnames(\n \"core-context-menu-container\",\n opened && \"core-context-menu-opened\",\n floating && \"core-context-menu-floating\",\n ContextMenu.getCSSClassNameFromDirection(renderDirection)\n )}\n >\n {this._injectedChildren}\n </div>\n </DivWithOutsideClick>\n </div>\n );\n }\n\n /** @internal */\n public static getCSSClassNameFromDirection = (\n direction?: ContextMenuDirection\n ): string => {\n let className = \"\";\n\n // istanbul ignore next\n if (direction === undefined) direction = ContextMenuDirection.BottomRight;\n\n if (direction === ContextMenuDirection.None) return \"\";\n\n switch (direction) {\n case ContextMenuDirection.TopLeft:\n className = \"core-context-menu-top core-context-menu-left\";\n break;\n case ContextMenuDirection.Top:\n className = \"core-context-menu-top\";\n break;\n case ContextMenuDirection.TopRight:\n className = \"core-context-menu-top core-context-menu-right\";\n break;\n case ContextMenuDirection.Left:\n className = \"core-context-menu-left\";\n break;\n case ContextMenuDirection.Center:\n className = \"core-context-menu-center\";\n break;\n case ContextMenuDirection.Right:\n className = \"core-context-menu-right\";\n break;\n case ContextMenuDirection.BottomLeft:\n className = \"core-context-menu-bottom core-context-menu-left\";\n break;\n case ContextMenuDirection.Bottom:\n className = \"core-context-menu-bottom\";\n break;\n case ContextMenuDirection.BottomRight:\n className = \"core-context-menu-bottom core-context-menu-right\";\n break;\n }\n\n return className;\n };\n\n private _injectMenuItemProps = (\n children: React.ReactNode,\n direction: ContextMenuDirection | undefined,\n selectedIndex: number\n ) => {\n let index = 0;\n // add inheritance data to submenu children\n const ch = React.Children.map(children, (child: React.ReactNode) => {\n // Capture only ContextSubMenus and ContextMenuItems.\n if (\n child &&\n typeof child === \"object\" &&\n \"props\" in child &&\n (child.type === ContextSubMenu || child.type === ContextMenuItem) &&\n !ConditionalBooleanValue.getValue(child.props.disabled) &&\n !ConditionalBooleanValue.getValue(child.props.hidden)\n ) {\n const id = index; // get separate id variable so value stays the same when onHover is called later.\n const onHover = () => {\n this.setState({ selectedIndex: id });\n this.focus();\n };\n const ref = (el: ContextSubMenu | ContextMenuItem | null) => {\n if (selectedIndex === id)\n // only save to this._selectedElement if previously captured bool is true\n this._selectedElement = el;\n };\n const boundHandleHotKeyParse = this._handleHotKeyParsed.bind(this, id); // bind local callback for specific index\n const childProps: Partial<\n ContextSubMenuProps & ContextMenuItemProps & { ref: typeof ref }\n > = {\n parentMenu: this,\n ref,\n onHover,\n isSelected: selectedIndex === id,\n onHotKeyParsed: boundHandleHotKeyParse,\n };\n if (child.type === ContextSubMenu) {\n // add direction only to sub-menus\n childProps.direction =\n child.props.direction || /* istanbul ignore next */ direction;\n }\n index++;\n return React.cloneElement(child, childProps);\n } else return child; // Else, pass through unmodified\n });\n this._length = index;\n return ch;\n };\n\n private _rootRef = (el: HTMLDivElement | null) => {\n this._rootElement = el;\n };\n\n private _menuRef = (el: HTMLDivElement | null) => {\n this._menuElement = el;\n };\n\n private getWindow() {\n const el = this._rootElement\n ? this._rootElement\n : /* istanbul ignore next */ this._menuElement;\n const parentDocument = el!.ownerDocument;\n // istanbul ignore next\n return parentDocument.defaultView ?? window;\n }\n\n /** @internal */\n public override componentDidMount() {\n const parentWindow = this.getWindow();\n parentWindow.addEventListener(\"focus\", this._handleFocusChange);\n parentWindow.addEventListener(\"mouseup\", this._handleFocusChange);\n\n this.checkRenderDirection();\n\n if (this.props.opened) this.focus();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n const parentWindow = this.getWindow();\n parentWindow.removeEventListener(\"focus\", this._handleFocusChange);\n parentWindow.removeEventListener(\"mouseup\", this._handleFocusChange);\n }\n\n private checkRenderDirection() {\n const { direction, autoflip, parentMenu } = this.props;\n const parentWindow = this.getWindow();\n\n let renderDirection =\n parentMenu === undefined ? this.state.direction : direction;\n\n if (\n parentWindow.innerHeight === this._parentWindowHeight &&\n parentWindow.innerWidth === this._parentWindowWidth\n )\n return;\n this._parentWindowHeight = parentWindow.innerHeight;\n this._parentWindowWidth = parentWindow.innerWidth;\n\n // check if menu should flip\n if (parentWindow && autoflip && parentMenu === undefined) {\n const menuRect = this.getRect();\n renderDirection = ContextMenu.autoFlip(\n renderDirection!,\n menuRect,\n parentWindow.innerWidth,\n parentWindow.innerHeight\n );\n // istanbul ignore next\n if (renderDirection !== this.state.direction)\n this.setState({ direction: renderDirection });\n }\n }\n\n public focus = () => {\n // istanbul ignore else\n if (this._menuElement) this._menuElement.focus();\n };\n\n public blur = () => {\n // istanbul ignore else\n if (this._menuElement) this._menuElement.blur();\n };\n\n public getRect = (): DOMRect => {\n let clientRect = DOMRect.fromRect({ x: 0, y: 0, width: 0, height: 0 });\n\n // istanbul ignore else\n if (this._menuElement) {\n clientRect = this._menuElement.getBoundingClientRect();\n }\n return clientRect;\n };\n\n private _handleFocusChange = (event: any): void => {\n // istanbul ignore else\n if (\n this._rootElement &&\n this.props.opened &&\n event.target instanceof Node &&\n this.props.onOutsideClick &&\n !this._rootElement.contains(event.target)\n )\n this.props.onOutsideClick(event);\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n if (this.props.onSelect) this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (this.state.ignoreNextKeyUp) {\n this.setState({ ignoreNextKeyUp: false });\n return;\n }\n\n // istanbul ignore else\n if (event.key) {\n for (const [key, value] of this._hotKeyMap) {\n if (!this.props.hotkeySelect! && key > this.state.selectedIndex) {\n // Start search at current index.\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key });\n return;\n }\n }\n }\n for (const [key, value] of this._hotKeyMap) {\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key }, () => {\n if (this.props.hotkeySelect && this._selectedElement) {\n this._selectedElement.select();\n }\n });\n event.stopPropagation();\n return;\n }\n }\n }\n\n if (event.key === Key.ArrowLeft.valueOf()) {\n event.stopPropagation();\n if (this.props.parentMenu && this.props.parentSubmenu) {\n this.props.parentSubmenu.close();\n this.props.parentMenu.focus();\n }\n if (this.props.onEsc) this.props.onEsc(event);\n }\n\n if (event.key === Key.Escape.valueOf()) {\n // istanbul ignore else\n if (this.props.onEsc) this.props.onEsc(event);\n }\n\n if (\n (event.key === Key.Enter.valueOf() ||\n event.key === Key.ArrowRight.valueOf()) &&\n this._selectedElement\n ) {\n event.stopPropagation();\n\n // istanbul ignore else\n if (\n event.key === Key.Enter.valueOf() ||\n /* istanbul ignore next */ this._selectedElement instanceof\n ContextSubMenu\n ) {\n // istanbul ignore else\n if (this._selectedElement.select) this._selectedElement.select();\n }\n }\n\n let { selectedIndex } = this.state;\n if (\n event.key === Key.ArrowUp.valueOf() ||\n event.key === Key.ArrowDown.valueOf()\n ) {\n event.stopPropagation();\n if (selectedIndex === -1) {\n selectedIndex = 0;\n } else {\n if (event.key === Key.ArrowUp.valueOf()) {\n if (this.state.selectedIndex === 0) selectedIndex = this._length - 1;\n else selectedIndex--;\n }\n if (event.key === Key.ArrowDown.valueOf()) {\n if (this.state.selectedIndex === this._length - 1) selectedIndex = 0;\n else selectedIndex++;\n }\n }\n }\n this.setState({ selectedIndex });\n };\n\n public override componentDidUpdate(prevProps: ContextMenuProps) {\n if (prevProps.selectedIndex !== this.props.selectedIndex) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!prevProps.opened && this.props.opened) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!this.props.parentMenu) {\n // const direction = this.props.direction!;\n // if ((!this.props.opened && prevProps.opened && direction !== this.state.direction) || prevProps.direction !== direction)\n this.checkRenderDirection();\n }\n }\n}\n"]}
@@ -69,7 +69,7 @@ class ContextMenuItem extends React.PureComponent {
69
69
  };
70
70
  this._handleKeyUp = (event) => {
71
71
  const isDisabled = appui_abstract_1.ConditionalBooleanValue.getValue(this.props.disabled);
72
- if (event.key === ts_key_enum_1.Key.Enter &&
72
+ if (event.key === ts_key_enum_1.Key.Enter.valueOf() &&
73
73
  this.props.onSelect !== undefined &&
74
74
  !isDisabled) {
75
75
  this.props.onSelect(event);
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuItem.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenuItem.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,2CAAoC;AACpC,6CAAkC;AAElC,0DAAgE;AAGhE,4DAAyD;AACzD,+CAA4C;AAE5C,0DAA8C;AAoC9C;;;GAGG;AACH,MAAa,eAAgB,SAAQ,KAAK,CAAC,aAG1C;IAUC,YAAY,KAA2B;QACrC,KAAK,CAAC,KAAK,CAAC,CAAC;QAVP,UAAK,GAAuB,IAAI,CAAC;QAYzC,gBAAgB;QACS,UAAK,GAAmC,EAAE,CAAC;QAwF5D,kBAAa,GAAG,CAAC,IAAqB,EAAE,EAAE;YAChD,IAAI,MAA0B,CAAC;YAC/B,MAAM,UAAU,GAAG,wCAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACzE,MAAM,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AyB,IAAE,KAAK,CAAO,CAC5D,CACP,CAAC;IACJ,CAAC;IAEe,iBAAiB;QAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAEe,kBAAkB,CAAC,SAA+B;QAChE,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,EAAE;YAC9C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;SACzC;IACH,CAAC;;AAhGD,gBAAgB;AACF,4BAAY,GAAkC;IAC1D,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,KAAK;CAClB,AAJyB,CAIxB;AAZS,0CAAe","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 ContextMenu\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport type { BadgeType } from \"@itwin/appui-abstract\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { ContextMenu } from \"./ContextMenu\";\nimport { BadgeUtilities } from \"../badge/BadgeUtilities\";\nimport { TildeFinder } from \"./TildeFinder\";\nimport type { IconSpec } from \"../icons/IconComponent\";\nimport { Icon } from \"../icons/IconComponent\";\n\n/** Properties for the [[ContextMenuItem]] component\n * @public\n */\nexport interface ContextMenuItemProps\n extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"disabled\" | \"hidden\">,\n CommonProps {\n onSelect?: (event: any) => any;\n /** @internal */\n onHotKeyParsed?: (hotKey: string) => void;\n /** Icon to display in the left margin. */\n icon?: IconSpec;\n /** Disables any onSelect calls, hover/keyboard highlighting, and grays item. */\n disabled?: boolean | ConditionalBooleanValue;\n /** Indicates whether the item is visible or hidden. The default is for the item to be visible. */\n hidden?: boolean | ConditionalBooleanValue;\n /** Badge to be overlaid on the item. */\n badgeType?: BadgeType;\n /** Icon to display in the right margin. */\n iconRight?: IconSpec;\n /** Hide the icon container. This can be used to eliminate space used to display an icon at the left of the menu item. */\n hideIconContainer?: boolean;\n /** @internal */\n onHover?: () => any;\n /* @internal */\n isSelected?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n}\n\n/** @internal */\ninterface ContextMenuItemState {\n hotKey?: string;\n}\n\n/**\n * Menu Item class for use within a [[ContextMenu]] component.\n * @public\n */\nexport class ContextMenuItem extends React.PureComponent<\n ContextMenuItemProps,\n ContextMenuItemState\n> {\n private _root: HTMLElement | null = null;\n private _lastChildren: React.ReactNode;\n private _parsedChildren: React.ReactNode;\n /** @internal */\n public static defaultProps: Partial<ContextMenuItemProps> = {\n disabled: false,\n hidden: false,\n isSelected: false,\n };\n constructor(props: ContextMenuItemProps) {\n super(props);\n }\n /** @internal */\n public override readonly state: Readonly<ContextMenuItemState> = {};\n public override render(): React.ReactElement {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n onClick,\n className,\n style,\n onSelect,\n icon,\n disabled,\n hidden,\n onHover,\n isSelected,\n parentMenu,\n onHotKeyParsed,\n badgeType,\n iconRight,\n hideIconContainer,\n ...props\n } = this.props;\n const badge = BadgeUtilities.getComponentForBadgeType(badgeType);\n const isDisabled = ConditionalBooleanValue.getValue(disabled);\n const isHidden = ConditionalBooleanValue.getValue(hidden);\n\n if (this._lastChildren !== this.props.children) {\n this._parsedChildren = TildeFinder.findAfterTilde(\n this.props.children\n ).node;\n this._lastChildren = this.props.children;\n }\n\n return (\n <div\n {...props}\n ref={(el) => {\n this._root = el;\n }}\n onClick={this._handleClick}\n style={style}\n onFocus={this._handleFocus}\n onKeyUp={this._handleKeyUp}\n onMouseOver={this._handleMouseOver}\n data-testid={\"core-context-menu-item\"}\n className={classnames(\n \"core-context-menu-item\",\n className,\n isDisabled && \"core-context-menu-disabled\",\n isHidden && \"core-context-menu-hidden\",\n isSelected && \"core-context-menu-is-selected\"\n )}\n role=\"menuitem\"\n tabIndex={isSelected ? 0 : -1}\n aria-disabled={isDisabled}\n aria-hidden={isHidden}\n >\n {!hideIconContainer && (\n <div className=\"core-context-menu-icon\">\n {icon !== undefined && <Icon iconSpec={icon} />}\n </div>\n )}\n <div className={\"core-context-menu-content\"}>\n {this._parsedChildren}\n </div>\n {iconRight && (\n <div\n className={classnames(\n \"core-context-menu-icon\",\n \"core-context-menu-icon-right\"\n )}\n >\n <Icon iconSpec={iconRight} />\n </div>\n )}\n {badge && <div className=\"core-context-menu-badge\">{badge}</div>}\n </div>\n );\n }\n\n public override componentDidMount() {\n this._updateHotkey(this.props.children);\n }\n\n public override componentDidUpdate(prevProps: ContextMenuItemProps) {\n if (this.props.children !== prevProps.children) {\n this._updateHotkey(this.props.children);\n }\n }\n\n private _updateHotkey = (node: React.ReactNode) => {\n let hotKey: string | undefined;\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n const isHidden = ConditionalBooleanValue.getValue(this.props.hidden);\n if (!isDisabled && !isHidden)\n hotKey = TildeFinder.findAfterTilde(node).character;\n else hotKey = undefined;\n if (hotKey && hotKey !== this.state.hotKey) {\n this.setState({ hotKey });\n if (this.props.onHotKeyParsed) this.props.onHotKeyParsed(hotKey);\n }\n };\n\n private _handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n event.stopPropagation();\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (\n this._root &&\n this._root.style.visibility !== \"hidden\" &&\n this.props.onHover\n ) {\n this.props.onHover();\n }\n };\n\n public select = () => {\n // istanbul ignore else\n if (this._root) {\n this._root.click();\n if (this.props.parentMenu && this.props.parentMenu.props.parentSubmenu)\n this.props.parentMenu.props.parentSubmenu.close(true);\n }\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (isDisabled) return;\n\n if (this.props.onClick) this.props.onClick(event);\n if (this.props.onSelect) this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (\n event.key === Key.Enter &&\n this.props.onSelect !== undefined &&\n !isDisabled\n ) {\n this.props.onSelect(event);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"ContextMenuItem.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenuItem.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,2CAAoC;AACpC,6CAAkC;AAElC,0DAAgE;AAGhE,4DAAyD;AACzD,+CAA4C;AAE5C,0DAA8C;AAoC9C;;;GAGG;AACH,MAAa,eAAgB,SAAQ,KAAK,CAAC,aAG1C;IAUC,YAAY,KAA2B;QACrC,KAAK,CAAC,KAAK,CAAC,CAAC;QAVP,UAAK,GAAuB,IAAI,CAAC;QAYzC,gBAAgB;QACS,UAAK,GAAmC,EAAE,CAAC;QAwF5D,kBAAa,GAAG,CAAC,IAAqB,EAAE,EAAE;YAChD,IAAI,MAA0B,CAAC;YAC/B,MAAM,UAAU,GAAG,wCAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACzE,MAAM,QAAQ,GAAG,wCAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACrE,IAAI,CAAC,UAAU,IAAI,CAAC,QAAQ;gBAC1B,MAAM,GAAG,yBAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;;gBACjD,MAAM,GAAG,SAAS,CAAC;YACxB,IAAI,MAAM,IAAI,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBAC1C,IAAI,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AK,CAAC,QAAQ,CAAC,CAAC;SACzC;IACH,CAAC;;AAhGD,gBAAgB;AACF,4BAAY,GAAkC;IAC1D,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,KAAK;CAClB,AAJyB,CAIxB;AAZS,0CAAe","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 ContextMenu\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport type { BadgeType } from \"@itwin/appui-abstract\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { ContextMenu } from \"./ContextMenu\";\nimport { BadgeUtilities } from \"../badge/BadgeUtilities\";\nimport { TildeFinder } from \"./TildeFinder\";\nimport type { IconSpec } from \"../icons/IconComponent\";\nimport { Icon } from \"../icons/IconComponent\";\n\n/** Properties for the [[ContextMenuItem]] component\n * @public\n */\nexport interface ContextMenuItemProps\n extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"disabled\" | \"hidden\">,\n CommonProps {\n onSelect?: (event: any) => any;\n /** @internal */\n onHotKeyParsed?: (hotKey: string) => void;\n /** Icon to display in the left margin. */\n icon?: IconSpec;\n /** Disables any onSelect calls, hover/keyboard highlighting, and grays item. */\n disabled?: boolean | ConditionalBooleanValue;\n /** Indicates whether the item is visible or hidden. The default is for the item to be visible. */\n hidden?: boolean | ConditionalBooleanValue;\n /** Badge to be overlaid on the item. */\n badgeType?: BadgeType;\n /** Icon to display in the right margin. */\n iconRight?: IconSpec;\n /** Hide the icon container. This can be used to eliminate space used to display an icon at the left of the menu item. */\n hideIconContainer?: boolean;\n /** @internal */\n onHover?: () => any;\n /* @internal */\n isSelected?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n}\n\n/** @internal */\ninterface ContextMenuItemState {\n hotKey?: string;\n}\n\n/**\n * Menu Item class for use within a [[ContextMenu]] component.\n * @public\n */\nexport class ContextMenuItem extends React.PureComponent<\n ContextMenuItemProps,\n ContextMenuItemState\n> {\n private _root: HTMLElement | null = null;\n private _lastChildren: React.ReactNode;\n private _parsedChildren: React.ReactNode;\n /** @internal */\n public static defaultProps: Partial<ContextMenuItemProps> = {\n disabled: false,\n hidden: false,\n isSelected: false,\n };\n constructor(props: ContextMenuItemProps) {\n super(props);\n }\n /** @internal */\n public override readonly state: Readonly<ContextMenuItemState> = {};\n public override render(): React.ReactElement {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n onClick,\n className,\n style,\n onSelect,\n icon,\n disabled,\n hidden,\n onHover,\n isSelected,\n parentMenu,\n onHotKeyParsed,\n badgeType,\n iconRight,\n hideIconContainer,\n ...props\n } = this.props;\n const badge = BadgeUtilities.getComponentForBadgeType(badgeType);\n const isDisabled = ConditionalBooleanValue.getValue(disabled);\n const isHidden = ConditionalBooleanValue.getValue(hidden);\n\n if (this._lastChildren !== this.props.children) {\n this._parsedChildren = TildeFinder.findAfterTilde(\n this.props.children\n ).node;\n this._lastChildren = this.props.children;\n }\n\n return (\n <div\n {...props}\n ref={(el) => {\n this._root = el;\n }}\n onClick={this._handleClick}\n style={style}\n onFocus={this._handleFocus}\n onKeyUp={this._handleKeyUp}\n onMouseOver={this._handleMouseOver}\n data-testid={\"core-context-menu-item\"}\n className={classnames(\n \"core-context-menu-item\",\n className,\n isDisabled && \"core-context-menu-disabled\",\n isHidden && \"core-context-menu-hidden\",\n isSelected && \"core-context-menu-is-selected\"\n )}\n role=\"menuitem\"\n tabIndex={isSelected ? 0 : -1}\n aria-disabled={isDisabled}\n aria-hidden={isHidden}\n >\n {!hideIconContainer && (\n <div className=\"core-context-menu-icon\">\n {icon !== undefined && <Icon iconSpec={icon} />}\n </div>\n )}\n <div className={\"core-context-menu-content\"}>\n {this._parsedChildren}\n </div>\n {iconRight && (\n <div\n className={classnames(\n \"core-context-menu-icon\",\n \"core-context-menu-icon-right\"\n )}\n >\n <Icon iconSpec={iconRight} />\n </div>\n )}\n {badge && <div className=\"core-context-menu-badge\">{badge}</div>}\n </div>\n );\n }\n\n public override componentDidMount() {\n this._updateHotkey(this.props.children);\n }\n\n public override componentDidUpdate(prevProps: ContextMenuItemProps) {\n if (this.props.children !== prevProps.children) {\n this._updateHotkey(this.props.children);\n }\n }\n\n private _updateHotkey = (node: React.ReactNode) => {\n let hotKey: string | undefined;\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n const isHidden = ConditionalBooleanValue.getValue(this.props.hidden);\n if (!isDisabled && !isHidden)\n hotKey = TildeFinder.findAfterTilde(node).character;\n else hotKey = undefined;\n if (hotKey && hotKey !== this.state.hotKey) {\n this.setState({ hotKey });\n if (this.props.onHotKeyParsed) this.props.onHotKeyParsed(hotKey);\n }\n };\n\n private _handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n event.stopPropagation();\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (\n this._root &&\n this._root.style.visibility !== \"hidden\" &&\n this.props.onHover\n ) {\n this.props.onHover();\n }\n };\n\n public select = () => {\n // istanbul ignore else\n if (this._root) {\n this._root.click();\n if (this.props.parentMenu && this.props.parentMenu.props.parentSubmenu)\n this.props.parentMenu.props.parentSubmenu.close(true);\n }\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (isDisabled) return;\n\n if (this.props.onClick) this.props.onClick(event);\n if (this.props.onSelect) this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (\n event.key === Key.Enter.valueOf() &&\n this.props.onSelect !== undefined &&\n !isDisabled\n ) {\n this.props.onSelect(event);\n }\n };\n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,iBAAiB,IAAI,IAAI;IAKlC,YAAY,iBAAkB,cAAc,GAAG,IAAI,UAExD;IAEc,MAAM,IAAI,KAAK,CAAC,YAAY;IA2H5C,OAAO,CAAC,4BAA4B;IAuBpC,SAAS,CAAC,gBAAgB,CACxB,aAAa,EAAE,eAAe,EAAE,GAAG,SAAS,EACjB,gBAAgB,GAAE,WAAW,CAAC,WAAW,CAAS,EAClD,mBAAmB,GAAE,OAAe,GAC9D,KAAK,CAAC,SAAS,EAAE,GAAG,SAAS;IAuEhC,OAAO,CAAC,YAAY,CAQlB;IAEF,SAAS,CAAC,2BAA2B,UAAW,kBAAkB,KAAG,IAAI,CAMvE;CACH"}
@@ -45,7 +45,9 @@ class Dialog extends React.Component {
45
45
  this._parentDocument = containerDiv.ownerDocument;
46
46
  };
47
47
  this._handleKeyUp = (event) => {
48
- if (event.key === ts_key_enum_1.Key.Escape && this.props.opened && this.props.onEscape) {
48
+ if (event.key === ts_key_enum_1.Key.Escape.valueOf() &&
49
+ this.props.opened &&
50
+ this.props.onEscape) {
49
51
  this.props.onEscape();
50
52
  }
51
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/core-react/dialog/Dialog.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,2CAAoC;AACpC,+BAA+B;AAC/B,6CAAkC;AAElC,0DAAyD;AACzD,wDAAoE;AACpE,qEAAkE;AAClE,sCAAmC;AAGnC,yBAAuB;AAIvB,0BAA0B;AAE1B;;GAEG;AACH,IAAY,eAUX;AAVD,WAAY,eAAe;IACzB,uCAAoB,CAAA;IACpB,8BAAW,CAAA;IACX,yCAAsB,CAAA;IACtB,gCAAa,CAAA;IACb,oCAAiB,CAAA;IACjB,kCAAe,CAAA;IACf,6CAA0B,CAAA;IAC1B,oCAAiB,CAAA;IACjB,+CAA4B,CAAA;AAC9B,CAAC,EAVW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAU1B;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AC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;oBAC1D,mBAAmB,GAAG,IAAI,CAAC;oBAC3B,MAAM;aACT;YAED,IAAI,MAAM,CAAC,KAAK;gBAAE,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;YAE5C,OAAO,CAAC,IAAI,CACV,oBAAC,sBAAM,IACL,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,EAC7D,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,EACrB,OAAO,EAAE,MAAM,CAAC,OAAO,IAEtB,UAAU,CACJ,CACV,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;;AAvPa,mBAAY,GAAyB;IACjD,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,KAAK;CACjB,AATyB,CASxB;AAXS,wBAAM","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 Dialog\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { DialogButtonDef } from \"@itwin/appui-abstract\";\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\nimport { Dialog as BaseDialog, Button } from \"@itwin/itwinui-react\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport { UiCore } from \"../UiCore\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { Omit } from \"../utils/typeUtils\";\nimport \"./Dialog.scss\";\n\ntype ButtonProps = React.ComponentPropsWithoutRef<typeof Button>;\n\n// cspell:ignore focustrap\n\n/** Enum for dialog alignment\n * @public\n */\nexport enum DialogAlignment {\n TopLeft = \"top-left\",\n Top = \"top\",\n TopRight = \"top-right\",\n Left = \"left\",\n Center = \"center\",\n Right = \"right\",\n BottomLeft = \"bottom-left\",\n Bottom = \"bottom\",\n BottomRight = \"bottom-right\",\n}\n\n/** Properties for the [[Dialog]] component\n * @public\n */\nexport interface DialogProps\n extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"title\">,\n CommonProps {\n /** Indicates whether to show dialog or not */\n opened: boolean;\n\n /** Indicates whether the user can resize dialog with cursor. Default: false */\n resizable?: boolean;\n /** Indicates whether the user can move dialog with cursor. Default: false */\n movable?: boolean;\n /** Indicates whether the content should be inset. Default: true */\n inset?: boolean;\n /** Indicates whether the focus should be trapped within the dialog. Default: false */\n trapFocus?: boolean;\n\n /** Whether the hide the header. Default: false */\n hideHeader?: boolean;\n /** Override for the header */\n header?: React.ReactNode;\n /** Title to show in title bar of dialog */\n title?: string | React.ReactElement;\n /** Footer to show at bottom of dialog. Note: will override buttonCluster */\n footer?: string | React.ReactElement;\n /** List of DialogButtonDef objects specifying buttons and associated onClick events */\n buttonCluster?: DialogButtonDef[];\n\n /** Default alignment of dialog. */\n alignment?: DialogAlignment;\n /** Initial x/left position of dialog in px. */\n x?: number;\n /** Initial y/top position of dialog in px. */\n y?: number;\n\n /** onClick event for X button for dialog */\n onClose?: () => void;\n /** 'keyup' event for Esc key */\n onEscape?: () => void;\n /** Triggered when a click is triggered outside of this dialog. */\n onOutsideClick?: (event: MouseEvent) => any;\n\n /** Initial width of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: \"50%\" */\n width?: string | number;\n /** Initial height of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n height?: string | number;\n /** Minimum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 300px */\n minWidth?: string | number;\n /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 135px */\n minHeight?: string | number;\n /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100% */\n maxWidth?: string | number;\n /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxHeight?: string | number;\n\n /** Whether to show background overlay. Default: true.\n * @note Modeless dialogs require an id and an implementation of onModelessPointerDown.\n */\n modal?: boolean;\n /** An id for a modeless dialog */\n modelessId?: string;\n /** Pointer Down event handler when modeless (modal = false) */\n onModelessPointerDown?: (event: React.PointerEvent, id: string) => void;\n\n /** Custom CSS Style for overlay */\n backgroundStyle?: React.CSSProperties;\n /** Custom CSS Style for title */\n titleStyle?: React.CSSProperties;\n /** Custom CSS Style for footer */\n footerStyle?: React.CSSProperties;\n /** Custom CSS class name for the content */\n contentClassName?: string;\n /** Custom CSS Style for the content */\n contentStyle?: React.CSSProperties;\n}\n\n/** Dialog React component with optional resizing and dragging functionality\n * @public\n */\nexport class Dialog extends React.Component<DialogProps> {\n private _parentDocument = document;\n public static defaultProps: Partial<DialogProps> = {\n maxWidth: \"100%\",\n width: \"50%\",\n hideHeader: false,\n resizable: false,\n movable: false,\n modal: true,\n inset: true,\n trapFocus: false,\n };\n\n constructor(props: DialogProps) {\n super(props);\n }\n\n public override componentWillUnmount(): void {\n this._parentDocument.removeEventListener(\"keyup\", this._handleKeyUp, true);\n }\n\n public override componentDidMount(): void {\n this._parentDocument.addEventListener(\"keyup\", this._handleKeyUp, true);\n }\n\n // istanbul ignore next\n public handleRefSet = (containerDiv: HTMLDivElement | null) => {\n if (containerDiv) this._parentDocument = containerDiv.ownerDocument;\n };\n\n public override render(): React.ReactElement {\n const {\n opened,\n title,\n footer,\n buttonCluster,\n onClose,\n onEscape,\n onOutsideClick,\n minWidth,\n minHeight,\n x,\n y,\n width,\n height,\n maxHeight,\n maxWidth,\n backgroundStyle,\n titleStyle,\n footerStyle,\n style,\n contentStyle,\n contentClassName,\n modal,\n resizable,\n movable,\n className,\n alignment,\n inset,\n trapFocus,\n modelessId,\n onModelessPointerDown,\n hideHeader,\n header,\n as,\n ...props\n } = this.props;\n\n let initialOffset: React.CSSProperties = {};\n if (x || y) {\n initialOffset = {\n left: x ?? 0,\n top: y ?? 0,\n transform: \"none\",\n };\n }\n\n const containerStyle: React.CSSProperties = {\n ...initialOffset,\n margin: \"\",\n width,\n height,\n };\n\n const minMaxStyle: React.CSSProperties = {\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n };\n const dialogBaseContainerStyle: React.CSSProperties = {\n ...containerStyle,\n ...minMaxStyle,\n };\n\n const buttons = this.getFooterButtons(\n buttonCluster,\n \"high-visibility\",\n true\n );\n\n return (\n <BaseDialog\n isOpen={opened}\n onClose={onClose}\n closeOnExternalClick={false}\n closeOnEsc={false}\n style={style}\n className={classnames(\"core-dialog\", className)}\n isDraggable={movable}\n isResizable={resizable}\n trapFocus={trapFocus && /* istanbul ignore next */ modal}\n preventDocumentScroll={true}\n data-testid=\"core-dialog-root\"\n {...props}\n >\n {modal && <BaseDialog.Backdrop style={backgroundStyle} />}\n <DivWithOutsideClick onOutsideClick={onOutsideClick}>\n <BaseDialog.Main\n className={classnames(\n \"core-dialog-main\",\n alignment && this.getCSSClassNameFromAlignment(alignment)\n )}\n data-testid=\"core-dialog-container\"\n style={dialogBaseContainerStyle}\n onPointerDown={this._handleContainerPointerDown}\n >\n {!hideHeader &&\n (header || (\n <BaseDialog.TitleBar\n titleText={title}\n style={titleStyle}\n data-testid=\"core-dialog-head\"\n />\n ))}\n <BaseDialog.Content\n className={contentClassName}\n style={{ padding: inset ? undefined : 0, ...contentStyle }}\n >\n {this.props.children}\n </BaseDialog.Content>\n {footer ||\n (buttons && (\n <BaseDialog.ButtonBar style={footerStyle}>\n {buttons}\n </BaseDialog.ButtonBar>\n ))}\n </BaseDialog.Main>\n </DivWithOutsideClick>\n </BaseDialog>\n );\n }\n\n private getCSSClassNameFromAlignment(alignment: DialogAlignment): string {\n switch (alignment) {\n case DialogAlignment.TopLeft:\n return \"core-align-top-left\";\n case DialogAlignment.Top:\n return \"core-align-top\";\n case DialogAlignment.TopRight:\n return \"core-align-top-right\";\n case DialogAlignment.Left:\n return \"core-align-left\";\n case DialogAlignment.Center:\n return \"core-align-center\";\n case DialogAlignment.Right:\n return \"core-align-right\";\n case DialogAlignment.BottomLeft:\n return \"core-align-bottom-left\";\n case DialogAlignment.Bottom:\n return \"core-align-bottom\";\n case DialogAlignment.BottomRight:\n return \"core-align-bottom-right\";\n }\n }\n\n protected getFooterButtons(\n buttonCluster: DialogButtonDef[] | undefined,\n /* istanbul ignore next */ primaryStyleType: ButtonProps[\"styleType\"] = \"cta\",\n /* istanbul ignore next */ noCoreButtonClasses: boolean = false\n ): React.ReactNode[] | undefined {\n if (buttonCluster === undefined) return undefined;\n\n const buttons: React.ReactNode[] = [];\n buttonCluster.forEach((button: DialogButtonDef, index: number) => {\n let buttonText = \"\";\n // istanbul ignore next\n let buttonClass = classnames(\n !noCoreButtonClasses && \"core-dialog-button\",\n !noCoreButtonClasses && `dialog-button-${button.type}`,\n button.className\n );\n let usePrimaryStyleType = false;\n\n switch (button.type) {\n case DialogButtonType.OK:\n buttonText = UiCore.translate(\"dialog.ok\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Retry:\n buttonText = UiCore.translate(\"dialog.retry\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Yes:\n buttonText = UiCore.translate(\"dialog.yes\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.No:\n buttonText = UiCore.translate(\"dialog.no\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Cancel:\n buttonText = UiCore.translate(\"dialog.cancel\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Close:\n buttonText = UiCore.translate(\"dialog.close\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Next:\n buttonText = UiCore.translate(\"dialog.next\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Previous:\n buttonText = UiCore.translate(\"dialog.previous\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n }\n\n if (button.label) buttonText = button.label;\n\n buttons.push(\n <Button\n className={buttonClass}\n disabled={button.disabled}\n styleType={usePrimaryStyleType ? primaryStyleType : undefined}\n key={index.toString()}\n onClick={button.onClick}\n >\n {buttonText}\n </Button>\n );\n });\n return buttons;\n }\n\n private _handleKeyUp = (event: KeyboardEvent) => {\n if (event.key === Key.Escape && this.props.opened && this.props.onEscape) {\n this.props.onEscape();\n }\n };\n\n protected _handleContainerPointerDown = (event: React.PointerEvent): void => {\n // istanbul ignore next\n if (!this.props.modal) {\n if (this.props.onModelessPointerDown && this.props.modelessId)\n this.props.onModelessPointerDown(event, this.props.modelessId);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/core-react/dialog/Dialog.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,2CAAoC;AACpC,+BAA+B;AAC/B,6CAAkC;AAElC,0DAAyD;AACzD,wDAAoE;AACpE,qEAAkE;AAClE,sCAAmC;AAGnC,yBAAuB;AAIvB,0BAA0B;AAE1B;;GAEG;AACH,IAAY,eAUX;AAVD,WAAY,eAAe;IACzB,uCAAoB,CAAA;IACpB,8BAAW,CAAA;IACX,yCAAsB,CAAA;IACtB,gCAAa,CAAA;IACb,oCAAiB,CAAA;IACjB,kCAAe,CAAA;IACf,6CAA0B,CAAA;IAC1B,oCAAiB,CAAA;IACjB,+CAA4B,CAAA;AAC9B,CAAC,E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,CAAC,iBAAiB,CAAC,CAAC;oBACjD,WAAW,GAAG,IAAA,oBAAU,EAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;oBAC1D,mBAAmB,GAAG,IAAI,CAAC;oBAC3B,MAAM;aACT;YAED,IAAI,MAAM,CAAC,KAAK;gBAAE,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;YAE5C,OAAO,CAAC,IAAI,CACV,oBAAC,sBAAM,IACL,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,EAC7D,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,EACrB,OAAO,EAAE,MAAM,CAAC,OAAO,IAEtB,UAAU,CACJ,CACV,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;;AAvPa,mBAAY,GAAyB;IACjD,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,KAAK;CACjB,AATyB,CASxB;AAXS,wBAAM","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 Dialog\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { DialogButtonDef } from \"@itwin/appui-abstract\";\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\nimport { Dialog as BaseDialog, Button } from \"@itwin/itwinui-react\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport { UiCore } from \"../UiCore\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { Omit } from \"../utils/typeUtils\";\nimport \"./Dialog.scss\";\n\ntype ButtonProps = React.ComponentPropsWithoutRef<typeof Button>;\n\n// cspell:ignore focustrap\n\n/** Enum for dialog alignment\n * @public\n */\nexport enum DialogAlignment {\n TopLeft = \"top-left\",\n Top = \"top\",\n TopRight = \"top-right\",\n Left = \"left\",\n Center = \"center\",\n Right = \"right\",\n BottomLeft = \"bottom-left\",\n Bottom = \"bottom\",\n BottomRight = \"bottom-right\",\n}\n\n/** Properties for the [[Dialog]] component\n * @public\n */\nexport interface DialogProps\n extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"title\">,\n CommonProps {\n /** Indicates whether to show dialog or not */\n opened: boolean;\n\n /** Indicates whether the user can resize dialog with cursor. Default: false */\n resizable?: boolean;\n /** Indicates whether the user can move dialog with cursor. Default: false */\n movable?: boolean;\n /** Indicates whether the content should be inset. Default: true */\n inset?: boolean;\n /** Indicates whether the focus should be trapped within the dialog. Default: false */\n trapFocus?: boolean;\n\n /** Whether the hide the header. Default: false */\n hideHeader?: boolean;\n /** Override for the header */\n header?: React.ReactNode;\n /** Title to show in title bar of dialog */\n title?: string | React.ReactElement;\n /** Footer to show at bottom of dialog. Note: will override buttonCluster */\n footer?: string | React.ReactElement;\n /** List of DialogButtonDef objects specifying buttons and associated onClick events */\n buttonCluster?: DialogButtonDef[];\n\n /** Default alignment of dialog. */\n alignment?: DialogAlignment;\n /** Initial x/left position of dialog in px. */\n x?: number;\n /** Initial y/top position of dialog in px. */\n y?: number;\n\n /** onClick event for X button for dialog */\n onClose?: () => void;\n /** 'keyup' event for Esc key */\n onEscape?: () => void;\n /** Triggered when a click is triggered outside of this dialog. */\n onOutsideClick?: (event: MouseEvent) => any;\n\n /** Initial width of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: \"50%\" */\n width?: string | number;\n /** Initial height of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n height?: string | number;\n /** Minimum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 300px */\n minWidth?: string | number;\n /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 135px */\n minHeight?: string | number;\n /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100% */\n maxWidth?: string | number;\n /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxHeight?: string | number;\n\n /** Whether to show background overlay. Default: true.\n * @note Modeless dialogs require an id and an implementation of onModelessPointerDown.\n */\n modal?: boolean;\n /** An id for a modeless dialog */\n modelessId?: string;\n /** Pointer Down event handler when modeless (modal = false) */\n onModelessPointerDown?: (event: React.PointerEvent, id: string) => void;\n\n /** Custom CSS Style for overlay */\n backgroundStyle?: React.CSSProperties;\n /** Custom CSS Style for title */\n titleStyle?: React.CSSProperties;\n /** Custom CSS Style for footer */\n footerStyle?: React.CSSProperties;\n /** Custom CSS class name for the content */\n contentClassName?: string;\n /** Custom CSS Style for the content */\n contentStyle?: React.CSSProperties;\n}\n\n/** Dialog React component with optional resizing and dragging functionality\n * @public\n */\nexport class Dialog extends React.Component<DialogProps> {\n private _parentDocument = document;\n public static defaultProps: Partial<DialogProps> = {\n maxWidth: \"100%\",\n width: \"50%\",\n hideHeader: false,\n resizable: false,\n movable: false,\n modal: true,\n inset: true,\n trapFocus: false,\n };\n\n constructor(props: DialogProps) {\n super(props);\n }\n\n public override componentWillUnmount(): void {\n this._parentDocument.removeEventListener(\"keyup\", this._handleKeyUp, true);\n }\n\n public override componentDidMount(): void {\n this._parentDocument.addEventListener(\"keyup\", this._handleKeyUp, true);\n }\n\n // istanbul ignore next\n public handleRefSet = (containerDiv: HTMLDivElement | null) => {\n if (containerDiv) this._parentDocument = containerDiv.ownerDocument;\n };\n\n public override render(): React.ReactElement {\n const {\n opened,\n title,\n footer,\n buttonCluster,\n onClose,\n onEscape,\n onOutsideClick,\n minWidth,\n minHeight,\n x,\n y,\n width,\n height,\n maxHeight,\n maxWidth,\n backgroundStyle,\n titleStyle,\n footerStyle,\n style,\n contentStyle,\n contentClassName,\n modal,\n resizable,\n movable,\n className,\n alignment,\n inset,\n trapFocus,\n modelessId,\n onModelessPointerDown,\n hideHeader,\n header,\n as,\n ...props\n } = this.props;\n\n let initialOffset: React.CSSProperties = {};\n if (x || y) {\n initialOffset = {\n left: x ?? 0,\n top: y ?? 0,\n transform: \"none\",\n };\n }\n\n const containerStyle: React.CSSProperties = {\n ...initialOffset,\n margin: \"\",\n width,\n height,\n };\n\n const minMaxStyle: React.CSSProperties = {\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n };\n const dialogBaseContainerStyle: React.CSSProperties = {\n ...containerStyle,\n ...minMaxStyle,\n };\n\n const buttons = this.getFooterButtons(\n buttonCluster,\n \"high-visibility\",\n true\n );\n\n return (\n <BaseDialog\n isOpen={opened}\n onClose={onClose}\n closeOnExternalClick={false}\n closeOnEsc={false}\n style={style}\n className={classnames(\"core-dialog\", className)}\n isDraggable={movable}\n isResizable={resizable}\n trapFocus={trapFocus && /* istanbul ignore next */ modal}\n preventDocumentScroll={true}\n data-testid=\"core-dialog-root\"\n {...props}\n >\n {modal && <BaseDialog.Backdrop style={backgroundStyle} />}\n <DivWithOutsideClick onOutsideClick={onOutsideClick}>\n <BaseDialog.Main\n className={classnames(\n \"core-dialog-main\",\n alignment && this.getCSSClassNameFromAlignment(alignment)\n )}\n data-testid=\"core-dialog-container\"\n style={dialogBaseContainerStyle}\n onPointerDown={this._handleContainerPointerDown}\n >\n {!hideHeader &&\n (header || (\n <BaseDialog.TitleBar\n titleText={title}\n style={titleStyle}\n data-testid=\"core-dialog-head\"\n />\n ))}\n <BaseDialog.Content\n className={contentClassName}\n style={{ padding: inset ? undefined : 0, ...contentStyle }}\n >\n {this.props.children}\n </BaseDialog.Content>\n {footer ||\n (buttons && (\n <BaseDialog.ButtonBar style={footerStyle}>\n {buttons}\n </BaseDialog.ButtonBar>\n ))}\n </BaseDialog.Main>\n </DivWithOutsideClick>\n </BaseDialog>\n );\n }\n\n private getCSSClassNameFromAlignment(alignment: DialogAlignment): string {\n switch (alignment) {\n case DialogAlignment.TopLeft:\n return \"core-align-top-left\";\n case DialogAlignment.Top:\n return \"core-align-top\";\n case DialogAlignment.TopRight:\n return \"core-align-top-right\";\n case DialogAlignment.Left:\n return \"core-align-left\";\n case DialogAlignment.Center:\n return \"core-align-center\";\n case DialogAlignment.Right:\n return \"core-align-right\";\n case DialogAlignment.BottomLeft:\n return \"core-align-bottom-left\";\n case DialogAlignment.Bottom:\n return \"core-align-bottom\";\n case DialogAlignment.BottomRight:\n return \"core-align-bottom-right\";\n }\n }\n\n protected getFooterButtons(\n buttonCluster: DialogButtonDef[] | undefined,\n /* istanbul ignore next */ primaryStyleType: ButtonProps[\"styleType\"] = \"cta\",\n /* istanbul ignore next */ noCoreButtonClasses: boolean = false\n ): React.ReactNode[] | undefined {\n if (buttonCluster === undefined) return undefined;\n\n const buttons: React.ReactNode[] = [];\n buttonCluster.forEach((button: DialogButtonDef, index: number) => {\n let buttonText = \"\";\n // istanbul ignore next\n let buttonClass = classnames(\n !noCoreButtonClasses && \"core-dialog-button\",\n !noCoreButtonClasses && `dialog-button-${button.type}`,\n button.className\n );\n let usePrimaryStyleType = false;\n\n switch (button.type) {\n case DialogButtonType.OK:\n buttonText = UiCore.translate(\"dialog.ok\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Retry:\n buttonText = UiCore.translate(\"dialog.retry\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Yes:\n buttonText = UiCore.translate(\"dialog.yes\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.No:\n buttonText = UiCore.translate(\"dialog.no\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Cancel:\n buttonText = UiCore.translate(\"dialog.cancel\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Close:\n buttonText = UiCore.translate(\"dialog.close\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Next:\n buttonText = UiCore.translate(\"dialog.next\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Previous:\n buttonText = UiCore.translate(\"dialog.previous\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n }\n\n if (button.label) buttonText = button.label;\n\n buttons.push(\n <Button\n className={buttonClass}\n disabled={button.disabled}\n styleType={usePrimaryStyleType ? primaryStyleType : undefined}\n key={index.toString()}\n onClick={button.onClick}\n >\n {buttonText}\n </Button>\n );\n });\n return buttons;\n }\n\n private _handleKeyUp = (event: KeyboardEvent) => {\n if (\n event.key === Key.Escape.valueOf() &&\n this.props.opened &&\n this.props.onEscape\n ) {\n this.props.onEscape();\n }\n };\n\n protected _handleContainerPointerDown = (event: React.PointerEvent): void => {\n // istanbul ignore next\n if (!this.props.modal) {\n if (this.props.onModelessPointerDown && this.props.modelessId)\n this.props.onModelessPointerDown(event, this.props.modelessId);\n }\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ItemKeyboardNavigator.d.ts","sourceRoot":"","sources":["../../../../src/core-react/focus/ItemKeyboardNavigator.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAE/D;;GAEG;AACH,qBAAa,qBAAqB;IAQvB,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;IACpC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,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