@itwin/core-react 4.6.4 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -4
- package/lib/cjs/core-react/UiCore.d.ts.map +1 -1
- package/lib/cjs/core-react/UiCore.js +2 -1
- package/lib/cjs/core-react/UiCore.js.map +1 -1
- package/lib/cjs/core-react/autosuggest/AutoSuggest.js +4 -4
- package/lib/cjs/core-react/autosuggest/AutoSuggest.js.map +1 -1
- package/lib/cjs/core-react/badge/Badge.d.ts.map +1 -1
- package/lib/cjs/core-react/badge/Badge.js +1 -3
- package/lib/cjs/core-react/badge/Badge.js.map +1 -1
- package/lib/cjs/core-react/button/UnderlinedButton.js +3 -3
- package/lib/cjs/core-react/button/UnderlinedButton.js.map +1 -1
- package/lib/cjs/core-react/colorthemes.scss +0 -41
- package/lib/cjs/core-react/colorvariables.scss +8 -0
- package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenu.js +8 -8
- package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuItem.js +2 -1
- package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
- package/lib/cjs/core-react/dialog/Dialog.d.ts.map +1 -1
- package/lib/cjs/core-react/dialog/Dialog.js +2 -3
- package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
- package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
- package/lib/cjs/core-react/focus/ItemKeyboardNavigator.js +31 -26
- package/lib/cjs/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
- package/lib/cjs/core-react/icons/IconComponent.d.ts +5 -0
- package/lib/cjs/core-react/icons/IconComponent.d.ts.map +1 -1
- package/lib/cjs/core-react/icons/IconComponent.js +16 -4
- package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.js +5 -5
- package/lib/cjs/core-react/inputs/numberinput/NumberInput.js.map +1 -1
- package/lib/cjs/core-react/listbox/Listbox.d.ts.map +1 -1
- package/lib/cjs/core-react/listbox/Listbox.js +6 -6
- package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
- package/lib/cjs/core-react/popup/Popup.d.ts.map +1 -1
- package/lib/cjs/core-react/popup/Popup.js +3 -2
- package/lib/cjs/core-react/popup/Popup.js.map +1 -1
- package/lib/cjs/core-react/radialmenu/RadialMenu.d.ts.map +1 -1
- package/lib/cjs/core-react/radialmenu/RadialMenu.js +2 -2
- package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
- package/lib/cjs/core-react/searchbox/SearchBox.d.ts.map +1 -1
- package/lib/cjs/core-react/searchbox/SearchBox.js +3 -3
- package/lib/cjs/core-react/searchbox/SearchBox.js.map +1 -1
- package/lib/cjs/core-react/text/FilteredText.d.ts +1 -1
- package/lib/cjs/core-react/text/FilteredText.d.ts.map +1 -1
- package/lib/cjs/core-react/text/FilteredText.js.map +1 -1
- package/lib/cjs/core-react/uistate/UiStateEntry.d.ts +1 -1
- package/lib/cjs/core-react/uistate/UiStateEntry.js +1 -1
- package/lib/cjs/core-react/uistate/UiStateEntry.js.map +1 -1
- package/lib/cjs/core-react/utils/getObjectClassName.d.ts +9 -0
- package/lib/cjs/core-react/utils/getObjectClassName.d.ts.map +1 -0
- package/lib/cjs/core-react/utils/getObjectClassName.js +23 -0
- package/lib/cjs/core-react/utils/getObjectClassName.js.map +1 -0
- package/lib/cjs/core-react/utils/hooks/useDisposable.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/hooks/useDisposable.js +13 -7
- package/lib/cjs/core-react/utils/hooks/useDisposable.js.map +1 -1
- package/lib/cjs/core-react/utils/matches.d.ts +11 -0
- package/lib/cjs/core-react/utils/matches.d.ts.map +1 -0
- package/lib/cjs/core-react/utils/matches.js +7 -0
- package/lib/cjs/core-react/utils/matches.js.map +1 -0
- package/lib/cjs/core-react.d.ts +1 -0
- package/lib/cjs/core-react.d.ts.map +1 -1
- package/lib/cjs/core-react.js +1 -0
- package/lib/cjs/core-react.js.map +1 -1
- package/lib/esm/core-react/UiCore.d.ts.map +1 -1
- package/lib/esm/core-react/UiCore.js +3 -2
- package/lib/esm/core-react/UiCore.js.map +1 -1
- package/lib/esm/core-react/autosuggest/AutoSuggest.js +4 -4
- package/lib/esm/core-react/autosuggest/AutoSuggest.js.map +1 -1
- package/lib/esm/core-react/badge/Badge.d.ts.map +1 -1
- package/lib/esm/core-react/badge/Badge.js +1 -3
- package/lib/esm/core-react/badge/Badge.js.map +1 -1
- package/lib/esm/core-react/button/UnderlinedButton.js +3 -3
- package/lib/esm/core-react/button/UnderlinedButton.js.map +1 -1
- package/lib/esm/core-react/colorthemes.scss +0 -41
- package/lib/esm/core-react/colorvariables.scss +8 -0
- package/lib/esm/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenu.js +9 -9
- package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
- package/lib/esm/core-react/contextmenu/ContextMenuItem.js +3 -2
- package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
- package/lib/esm/core-react/dialog/Dialog.d.ts.map +1 -1
- package/lib/esm/core-react/dialog/Dialog.js +3 -4
- package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
- package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
- package/lib/esm/core-react/focus/ItemKeyboardNavigator.js +30 -25
- package/lib/esm/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
- package/lib/esm/core-react/icons/IconComponent.d.ts +5 -0
- package/lib/esm/core-react/icons/IconComponent.d.ts.map +1 -1
- package/lib/esm/core-react/icons/IconComponent.js +17 -5
- package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
- package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
- package/lib/esm/core-react/inputs/numberinput/NumberInput.js +5 -5
- package/lib/esm/core-react/inputs/numberinput/NumberInput.js.map +1 -1
- package/lib/esm/core-react/listbox/Listbox.d.ts.map +1 -1
- package/lib/esm/core-react/listbox/Listbox.js +6 -6
- package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
- package/lib/esm/core-react/popup/Popup.d.ts.map +1 -1
- package/lib/esm/core-react/popup/Popup.js +4 -3
- package/lib/esm/core-react/popup/Popup.js.map +1 -1
- package/lib/esm/core-react/radialmenu/RadialMenu.d.ts.map +1 -1
- package/lib/esm/core-react/radialmenu/RadialMenu.js +2 -2
- package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
- package/lib/esm/core-react/searchbox/SearchBox.d.ts.map +1 -1
- package/lib/esm/core-react/searchbox/SearchBox.js +3 -3
- package/lib/esm/core-react/searchbox/SearchBox.js.map +1 -1
- package/lib/esm/core-react/text/FilteredText.d.ts +1 -1
- package/lib/esm/core-react/text/FilteredText.d.ts.map +1 -1
- package/lib/esm/core-react/text/FilteredText.js.map +1 -1
- package/lib/esm/core-react/uistate/UiStateEntry.d.ts +1 -1
- package/lib/esm/core-react/uistate/UiStateEntry.js +1 -1
- package/lib/esm/core-react/uistate/UiStateEntry.js.map +1 -1
- package/lib/esm/core-react/utils/getObjectClassName.d.ts +9 -0
- package/lib/esm/core-react/utils/getObjectClassName.d.ts.map +1 -0
- package/lib/esm/core-react/utils/getObjectClassName.js +19 -0
- package/lib/esm/core-react/utils/getObjectClassName.js.map +1 -0
- package/lib/esm/core-react/utils/hooks/useDisposable.d.ts.map +1 -1
- package/lib/esm/core-react/utils/hooks/useDisposable.js +14 -8
- package/lib/esm/core-react/utils/hooks/useDisposable.js.map +1 -1
- package/lib/esm/core-react/utils/matches.d.ts +11 -0
- package/lib/esm/core-react/utils/matches.d.ts.map +1 -0
- package/lib/esm/core-react/utils/matches.js +6 -0
- package/lib/esm/core-react/utils/matches.js.map +1 -0
- package/lib/esm/core-react.d.ts +1 -0
- package/lib/esm/core-react.d.ts.map +1 -1
- package/lib/esm/core-react.js +1 -0
- package/lib/esm/core-react.js.map +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBox.d.ts","sourceRoot":"","sources":["../../../../src/core-react/searchbox/SearchBox.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchBox.d.ts","sourceRoot":"","sources":["../../../../src/core-react/searchbox/SearchBox.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMlD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gBAAgB;AAChB,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;IAC5E,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,UAAU,CAAa;IAE/B,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,CAEtD;gBAEU,KAAK,EAAE,cAAc;IAIjC,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;IA+CzC,6HAA6H;IAC7H,OAAO,CAAC,eAAe,CAcrB;IACF,OAAO,CAAC,YAAY,CAelB;IAEF,OAAO,CAAC,cAAc,CAWpB;IAEF,OAAO,CAAC,gBAAgB,CAUtB;IAEF,OAAO,CAAC,aAAa,CAKnB;IAEc,oBAAoB;IAI7B,KAAK;CAIb"}
|
|
@@ -11,8 +11,8 @@ exports.SearchBox = void 0;
|
|
|
11
11
|
require("./SearchBox.scss");
|
|
12
12
|
const classnames_1 = require("classnames");
|
|
13
13
|
const React = require("react");
|
|
14
|
+
const ts_key_enum_1 = require("ts-key-enum");
|
|
14
15
|
const UiCore_1 = require("../UiCore");
|
|
15
|
-
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
16
16
|
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
17
17
|
const IconComponent_1 = require("../icons/IconComponent");
|
|
18
18
|
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
@@ -61,12 +61,12 @@ class SearchBox extends React.Component {
|
|
|
61
61
|
};
|
|
62
62
|
this._handleKeyDown = (e) => {
|
|
63
63
|
switch (e.key) {
|
|
64
|
-
case
|
|
64
|
+
case ts_key_enum_1.Key.Escape:
|
|
65
65
|
// istanbul ignore else
|
|
66
66
|
if (this.props.onEscPressed)
|
|
67
67
|
this.props.onEscPressed();
|
|
68
68
|
break;
|
|
69
|
-
case
|
|
69
|
+
case ts_key_enum_1.Key.Enter:
|
|
70
70
|
// istanbul ignore else
|
|
71
71
|
if (this.props.onEnterPressed)
|
|
72
72
|
this.props.onEnterPressed();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBox.js","sourceRoot":"","sources":["../../../../src/core-react/searchbox/SearchBox.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,4BAA0B;AAC1B,2CAAoC;AACpC,+BAA+B;AAC/B,sCAAmC;AAEnC,
|
|
1
|
+
{"version":3,"file":"SearchBox.js","sourceRoot":"","sources":["../../../../src/core-react/searchbox/SearchBox.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,4BAA0B;AAC1B,2CAAoC;AACpC,+BAA+B;AAC/B,6CAAkC;AAClC,sCAAmC;AAEnC,wDAA6C;AAE7C,0DAA8C;AAC9C,oEAAiE;AA2BjE;;;;GAIG;AACH,MAAa,SAAU,SAAQ,KAAK,CAAC,SAAyC;IAS5E,YAAY,KAAqB;QAC/B,KAAK,CAAC,KAAK,CAAC,CAAC;QATP,kBAAa,GAA4B,IAAI,CAAC;QAC9C,eAAU,GAAW,CAAC,CAAC;QAE/B,gBAAgB;QACS,UAAK,GAA6B;YACzD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE;SACrC,CAAC;QAsDF,6HAA6H;QACrH,oBAAe,GAAG,CAAC,KAAa,EAAE,aAAqB,EAAE,EAAE;YACjE,uBAAuB;YACvB,IAAI,KAAK,KAAK,aAAa;gBAAE,OAAO;YAEpC,IAAI,CAAC,QAAQ,CACX,CAAC,UAAU,EAAE,EAAE;gBACb,OAAO;oBACL,KAAK;iBACN,CAAC;YACJ,CAAC,EACD,GAAG,EAAE;gBACH,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC9C,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;QACM,iBAAY,GAAG,CAAC,MAAY,EAAQ,EAAE;YAC5C,IAAI,KAAK,GAAG,EAAE,CAAC;YACf,MAAM,aAAa,GAAG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AAI,CAAC,YAAY,EAC1B,KAAK,EAAE,IAAI,CAAC,YAAY,EACxB,WAAW,EACT,IAAI,CAAC,KAAK,CAAC,WAAW;oBACpB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW;oBACxB,CAAC,CAAC,eAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAExC,IAAI,EAAC,WAAW,iBACJ,sBAAsB,GAClC;YAEF,6BACE,SAAS,EAAC,uBAAuB,EACjC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAE,WAAW;gBAElB,8BAAM,SAAS,EAAE,aAAa;oBAC5B,oBAAC,oBAAI,IAAC,QAAQ,EAAE,QAAQ,GAAI,CACvB,CACH,CACF,CACP,CAAC;IACJ,CAAC;IAmEe,oBAAoB;QAClC,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAEM,KAAK;QACV,uBAAuB;QACvB,IAAI,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IACrD,CAAC;CACF;AAtID,8BAsIC","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 SearchBox\n */\n\nimport \"./SearchBox.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { UiCore } from \"../UiCore\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { IconSpec } from \"../icons/IconComponent\";\nimport { Icon } from \"../icons/IconComponent\";\nimport { SvgClose, SvgSearch } from \"@itwin/itwinui-icons-react\";\n\n/** Properties for [[SearchBox]] component\n * @public\n */\nexport interface SearchBoxProps extends CommonProps {\n /** Value to set SearchBox to initially */\n initialValue?: string;\n /** Placeholder value to show in gray before anything is entered in */\n placeholder?: string;\n /** Triggered when the content of SearchBox is changed */\n onValueChanged: (value: string) => void;\n /** Frequency to poll for changes in value, in milliseconds */\n valueChangedDelay?: number;\n /** Listens for <Enter> keypress */\n onEnterPressed?: () => void;\n /** Listens for <Esc> keypress */\n onEscPressed?: () => void;\n /** Listens for onClick event for Clear (x) icon */\n onClear?: () => void;\n}\n\n/** @internal */\ninterface SearchBoxState {\n value: string;\n}\n\n/**\n * Input box for entering text to search for.\n * The SearchBox has an icon right-justified and bounded by the box and shows a Search or Clear icon.\n * @public\n */\nexport class SearchBox extends React.Component<SearchBoxProps, SearchBoxState> {\n private _inputElement: HTMLInputElement | null = null;\n private _timeoutId: number = 0;\n\n /** @internal */\n public override readonly state: Readonly<SearchBoxState> = {\n value: this.props.initialValue || \"\",\n };\n\n constructor(props: SearchBoxProps) {\n super(props);\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const searchClassName = classnames(\"core-searchbox\", this.props.className);\n const emptyString = this.state.value === \"\";\n const iconClassName = classnames(\"core-searchbox-icon\", \"icon\");\n const iconSpec: IconSpec = emptyString ? <SvgSearch /> : <SvgClose />;\n const buttonTitle = UiCore.translate(\n emptyString ? \"general.search\" : \"general.clear\"\n );\n return (\n <div\n className={searchClassName}\n style={this.props.style}\n data-testid=\"core-searchbox-instance\"\n >\n <Input\n defaultValue={this.props.initialValue}\n ref={(el) => {\n this._inputElement = el;\n }}\n onChange={this._trackChange}\n onKeyDown={this._handleKeyDown}\n onPaste={this._trackChange}\n onCut={this._trackChange}\n placeholder={\n this.props.placeholder\n ? this.props.placeholder\n : UiCore.translate(\"general.search\")\n }\n role=\"searchbox\"\n data-testid=\"core-searchbox-input\"\n />\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div\n className=\"core-searchbox-button\"\n onClick={this._handleIconClick}\n role=\"button\"\n tabIndex={-1}\n title={buttonTitle}\n >\n <span className={iconClassName}>\n <Icon iconSpec={iconSpec} />\n </span>\n </div>\n </div>\n );\n }\n\n /** Wrapper for onValueChanged to make sure we don't call search unless the new value is different from the previous value */\n private _onValueChanged = (value: string, previousValue: string) => {\n // istanbul ignore else\n if (value === previousValue) return;\n\n this.setState(\n (_prevState) => {\n return {\n value,\n };\n },\n () => {\n this.props.onValueChanged(this.state.value);\n }\n );\n };\n private _trackChange = (_event?: any): void => {\n let value = \"\";\n const previousValue = this.state.value;\n\n // istanbul ignore else\n if (this._inputElement) value = this._inputElement.value;\n\n if (this.props.valueChangedDelay) {\n this._unsetTimeout();\n this._timeoutId = window.setTimeout(() => {\n this._onValueChanged(value, previousValue);\n }, this.props.valueChangedDelay);\n } else {\n this._onValueChanged(value, previousValue);\n }\n };\n\n private _handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case Key.Escape:\n // istanbul ignore else\n if (this.props.onEscPressed) this.props.onEscPressed();\n break;\n case Key.Enter:\n // istanbul ignore else\n if (this.props.onEnterPressed) this.props.onEnterPressed();\n break;\n }\n };\n\n private _handleIconClick = (_event: React.MouseEvent<HTMLElement>): void => {\n // istanbul ignore else\n if (this._inputElement) {\n const clear = this.state.value !== \"\";\n this._inputElement.value = \"\";\n // istanbul ignore else\n if (clear && this.props.onClear) this.props.onClear();\n this._inputElement.focus();\n }\n this._trackChange();\n };\n\n private _unsetTimeout = (): void => {\n if (this._timeoutId) {\n window.clearTimeout(this._timeoutId);\n this._timeoutId = 0;\n }\n };\n\n public override componentWillUnmount() {\n this._unsetTimeout();\n }\n\n public focus() {\n // istanbul ignore else\n if (this._inputElement) this._inputElement.focus();\n }\n}\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @module Text
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import type { IMatch } from "@itwin/appui-abstract";
|
|
6
5
|
import type { CommonProps } from "../utils/Props";
|
|
6
|
+
import type { IMatch } from "../utils/matches";
|
|
7
7
|
import "./FilteredText.scss";
|
|
8
8
|
/** Props supported by [FilteredText] component
|
|
9
9
|
* @alpha
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteredText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/FilteredText.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"FilteredText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/FilteredText.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,qBAAqB,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAClC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eA8DpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteredText.js","sourceRoot":"","sources":["../../../../src/core-react/text/FilteredText.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,2BAA2B;AAE3B,+BAA+B;AAC/B,2CAAoC;AAGpC,+BAA6B;AAgB7B;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAwB;IACnD,MAAM,EACJ,KAAK,EACL,SAAS,EACT,OAAO,EACP,cAAc,EACd,UAAU,EACV,GAAG,UAAU,EACd,GAAG,KAAK,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AE,KAAK,IAEX,KAAK,CACD,CACR,CAAC;AACJ,CAAC;AA9DD,oCA8DC","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 Text\n */\n\n// cSpell:ignore focusvalue\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport type {
|
|
1
|
+
{"version":3,"file":"FilteredText.js","sourceRoot":"","sources":["../../../../src/core-react/text/FilteredText.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,2BAA2B;AAE3B,+BAA+B;AAC/B,2CAAoC;AAGpC,+BAA6B;AAgB7B;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAwB;IACnD,MAAM,EACJ,KAAK,EACL,SAAS,EACT,OAAO,EACP,cAAc,EACd,UAAU,EACV,GAAG,UAAU,EACd,GAAG,KAAK,CAAC;IACV,uBAAuB;IACvB,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACjC,MAAM,KAAK,GAAsB,EAAE,CAAC;QAEpC,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE;YAC1B,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,KAAK,QAAQ;gBACzB,KAAK,CAAC,IAAI,CACR,8BAAM,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,8BAA8B,IAC1D,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CACjC,CACR,CAAC;YACJ,KAAK,CAAC,IAAI,CACR,8BACE,GAAG,EAAE,IAAI,CAAC,KAAK,EACf,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,IAAA,oBAAU,EAAC,4BAA4B,EAAE,cAAc,CAAC,IAElE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CACjC,CACR,CAAC;YACF,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC;SACrB;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,uBAAuB;QACvB,IAAI,QAAQ,GAAG,MAAM,EAAE;YACrB,KAAK,CAAC,IAAI,CACR,8BAAM,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,8BAA8B,IAC1D,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAC7B,CACR,CAAC;SACH;QACD,OAAO,CACL,gCACM,UAAU,EACd,SAAS,EAAE,IAAA,oBAAU,EAAC,sBAAsB,EAAE,SAAS,CAAC,EACxD,KAAK,EAAE,KAAK,IAEX,KAAK,CACF,CACP,CAAC;KACH;IAED,OAAO,CACL,iCACM,UAAU,EACd,SAAS,EAAE,IAAA,oBAAU,EAAC,sBAAsB,EAAE,SAAS,CAAC,EACxD,KAAK,EAAE,KAAK,IAEX,KAAK,CACD,CACR,CAAC;AACJ,CAAC;AA9DD,oCA8DC","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 Text\n */\n\n// cSpell:ignore focusvalue\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { IMatch } from \"../utils/matches\";\nimport \"./FilteredText.scss\";\n\n/** Props supported by [FilteredText] component\n * @alpha\n */\nexport interface FilteredTextProps extends CommonProps {\n /** string that matched a filter string */\n value: string;\n /** define array of start and end positions of filter matches. */\n matches?: IMatch[];\n /** holds class name for matching span text. */\n matchClassName?: string;\n /** holds style for matching span text. */\n matchStyle?: React.CSSProperties;\n}\n\n/** Component used to highlight filter matches within a text string.\n * @alpha\n */\nexport function FilteredText(props: FilteredTextProps) {\n const {\n value,\n className,\n matches,\n matchClassName,\n matchStyle,\n ...otherProps\n } = props;\n // istanbul ignore else\n if (matches && matches.length > 0) {\n const spans: React.ReactNode[] = [];\n\n let startPos = 0;\n for (const span of matches) {\n // istanbul ignore else\n if (span.start !== startPos)\n spans.push(\n <span key={startPos} className=\"uicore-partial-filtered-text\">\n {value.substring(startPos, span.start)}\n </span>\n );\n spans.push(\n <span\n key={span.start}\n style={matchStyle}\n className={classnames(\"uicore-filtered-text-match\", matchClassName)}\n >\n {value.substring(span.start, span.end)}\n </span>\n );\n startPos = span.end;\n }\n const endPos = value.length;\n // istanbul ignore else\n if (startPos < endPos) {\n spans.push(\n <span key={startPos} className=\"uicore-partial-filtered-text\">\n {value.substring(startPos, endPos)}\n </span>\n );\n }\n return (\n <div\n {...otherProps}\n className={classnames(\"uicore-filtered-text\", className)}\n title={value}\n >\n {spans}\n </div>\n );\n }\n\n return (\n <span\n {...otherProps}\n className={classnames(\"uicore-filtered-text\", className)}\n title={value}\n >\n {value}\n </span>\n );\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module UiStateStorage
|
|
3
3
|
*/
|
|
4
4
|
import type { UiStateStorage, UiStateStorageResult } from "./UiStateStorage";
|
|
5
|
-
/** A single UI State
|
|
5
|
+
/** A single UI State entry that is identified by namespace and setting name.
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export declare class UiStateEntry<T> {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.UiStateEntry = void 0;
|
|
11
11
|
const UiStateStorage_1 = require("./UiStateStorage");
|
|
12
|
-
/** A single UI State
|
|
12
|
+
/** A single UI State entry that is identified by namespace and setting name.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
15
|
class UiStateEntry {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiStateEntry.js","sourceRoot":"","sources":["../../../../src/core-react/uist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,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACnC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC;gBACnC,MAAM,CAAC,MAAM,GAAG,qCAAoB,CAAC,OAAO,CAAC;aAC9C;YACD,OAAO,MAAM,CAAC;SACf;QACD,OAAO,EAAE,MAAM,EAAE,qCAAoB,CAAC,aAAa,EAAE,CAAC;IACxD,CAAC;CACF;AA1DD,oCA0DC","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 UiStateStorage\n */\n\nimport type { UiStateStorage, UiStateStorageResult } from \"./UiStateStorage\";\nimport { UiStateStorageStatus } from \"./UiStateStorage\";\n\n/** A single UI State
|
|
1
|
+
{"version":3,"file":"UiStateEntry.js","sourceRoot":"","sources":["../../../../src/core-react/uistate/UiStateEntry.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,qDAAwD;AAExD;;GAEG;AACH,MAAa,YAAY;IACvB;;;;;;OAMG;IACH,YACS,gBAAwB,EACxB,WAAmB,EACnB,QAAiB,EACjB,UAA2B,EAC3B,YAAgB;QAJhB,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,gBAAW,GAAX,WAAW,CAAQ;QACnB,aAAQ,GAAR,QAAQ,CAAS;QACjB,eAAU,GAAV,UAAU,CAAiB;QAC3B,iBAAY,GAAZ,YAAY,CAAI;IACtB,CAAC;IAEJ,+CAA+C;IACxC,KAAK,CAAC,UAAU,CACrB,OAAuB;QAEvB,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACrE,CAAC;IAED,6EAA6E;IACtE,KAAK,CAAC,WAAW,CACtB,OAAuB;QAEvB,OAAO,OAAO,CAAC,WAAW,CACxB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,QAAQ,EAAE,CAChB,CAAC;IACJ,CAAC;IAED,8CAA8C;IACvC,KAAK,CAAC,aAAa,CACxB,OAAuB;QAEvB,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACxE,CAAC;IAED,iGAAiG;IAC1F,KAAK,CAAC,uBAAuB,CAClC,OAAuB;QAEvB,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAC9C,IAAI,MAAM,CAAC,MAAM,KAAK,qCAAoB,CAAC,OAAO,EAAE;gBAClD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;aACjC;iBAAM,IAAI,SAAS,KAAK,IAAI,CAAC,YAAY,EAAE;gBAC1C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACnC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC;gBACnC,MAAM,CAAC,MAAM,GAAG,qCAAoB,CAAC,OAAO,CAAC;aAC9C;YACD,OAAO,MAAM,CAAC;SACf;QACD,OAAO,EAAE,MAAM,EAAE,qCAAoB,CAAC,aAAa,EAAE,CAAC;IACxD,CAAC;CACF;AA1DD,oCA0DC","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 UiStateStorage\n */\n\nimport type { UiStateStorage, UiStateStorageResult } from \"./UiStateStorage\";\nimport { UiStateStorageStatus } from \"./UiStateStorage\";\n\n/** A single UI State entry that is identified by namespace and setting name.\n * @public\n */\nexport class UiStateEntry<T> {\n /** Constructor\n * @param settingNamespace Namespace for the setting, passed to UiStateStorage.\n * @param settingName Name for the setting, passed to UiStateStorage.\n * @param getValue Function for getting the value from the application.\n * @param applyValue Function for applying the setting value to the application.\n * @param defaultValue Optional default value if not already stored.\n */\n public constructor(\n public settingNamespace: string,\n public settingName: string,\n public getValue: () => T,\n public applyValue?: (v: T) => void,\n public defaultValue?: T\n ) {}\n\n /** Gets the setting from [[UiStateStorage]] */\n public async getSetting(\n storage: UiStateStorage\n ): Promise<UiStateStorageResult> {\n return storage.getSetting(this.settingNamespace, this.settingName);\n }\n\n /** Saves the setting value from the `getValue` function to UiStateStorage */\n public async saveSetting(\n storage: UiStateStorage\n ): Promise<UiStateStorageResult> {\n return storage.saveSetting(\n this.settingNamespace,\n this.settingName,\n this.getValue()\n );\n }\n\n /** Deletes the setting from UiStateStorage */\n public async deleteSetting(\n storage: UiStateStorage\n ): Promise<UiStateStorageResult> {\n return storage.deleteSetting(this.settingNamespace, this.settingName);\n }\n\n /** Gets the setting from UiStateStorage and applies the value using the `applyValue` function */\n public async getSettingAndApplyValue(\n storage: UiStateStorage\n ): Promise<UiStateStorageResult> {\n if (this.applyValue) {\n const result = await this.getSetting(storage);\n if (result.status === UiStateStorageStatus.Success) {\n this.applyValue(result.setting);\n } else if (undefined !== this.defaultValue) {\n this.applyValue(this.defaultValue);\n result.setting = this.defaultValue;\n result.status = UiStateStorageStatus.Success;\n }\n return result;\n }\n return { status: UiStateStorageStatus.Uninitialized };\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getObjectClassName.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/getObjectClassName.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAS,GAAG,KAAG,MAM7C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Utilities
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getObjectClassName = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the name of a class from a static or instance object.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
const getObjectClassName = (obj) => {
|
|
16
|
+
return obj?.name
|
|
17
|
+
? obj.name
|
|
18
|
+
: obj?.constructor?.name
|
|
19
|
+
? obj.constructor.name
|
|
20
|
+
: "";
|
|
21
|
+
};
|
|
22
|
+
exports.getObjectClassName = getObjectClassName;
|
|
23
|
+
//# sourceMappingURL=getObjectClassName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getObjectClassName.js","sourceRoot":"","sources":["../../../../src/core-react/utils/getObjectClassName.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,GAAQ,EAAU,EAAE;IACrD,OAAO,GAAG,EAAE,IAAI;QACd,CAAC,CAAC,GAAG,CAAC,IAAI;QACV,CAAC,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI;YACxB,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI;YACtB,CAAC,CAAC,EAAE,CAAC;AACT,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B","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 Utilities\n */\n\n/**\n * Returns the name of a class from a static or instance object.\n * @internal\n */\nexport const getObjectClassName = (obj: any): string => {\n return obj?.name\n ? obj.name\n : obj?.constructor?.name\n ? obj.constructor.name\n : \"\";\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDisposable.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useDisposable.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,WAAW,SAAS,WAAW,EAC3D,gBAAgB,EAAE,MAAM,WAAW,GAClC,WAAW,CAEb;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,SAAS,WAAW,EACnE,gBAAgB,EAAE,MAAM,WAAW,GAAG,SAAS,GAC9C,WAAW,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"useDisposable.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useDisposable.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,WAAW,SAAS,WAAW,EAC3D,gBAAgB,EAAE,MAAM,WAAW,GAClC,WAAW,CAEb;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,SAAS,WAAW,EACnE,gBAAgB,EAAE,MAAM,WAAW,GAAG,SAAS,GAC9C,WAAW,GAAG,SAAS,CAmBzB"}
|
|
@@ -25,14 +25,20 @@ exports.useDisposable = useDisposable;
|
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
27
|
function useOptionalDisposable(createDisposable) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
const [value, setValue] = (0, react_1.useState)(() => createDisposable());
|
|
29
|
+
const initialValue = (0, react_1.useRef)(true);
|
|
30
|
+
(0, react_1.useEffect)(() => {
|
|
31
|
+
if (!initialValue.current) {
|
|
32
|
+
setValue(createDisposable());
|
|
33
|
+
}
|
|
34
|
+
initialValue.current = false;
|
|
35
|
+
return () => {
|
|
36
|
+
setValue((prev) => {
|
|
37
|
+
prev && prev.dispose();
|
|
38
|
+
return prev;
|
|
39
|
+
});
|
|
40
|
+
};
|
|
34
41
|
}, [createDisposable]);
|
|
35
|
-
(0, react_1.useEffect)(() => () => previous.current && previous.current.dispose(), []);
|
|
36
42
|
return value;
|
|
37
43
|
}
|
|
38
44
|
exports.useOptionalDisposable = useOptionalDisposable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDisposable.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useDisposable.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"useDisposable.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useDisposable.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,iCAAoD;AAGpD;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,gBAAmC;IAEnC,OAAO,qBAAqB,CAAC,gBAAgB,CAAE,CAAC;AAClD,CAAC;AAJD,sCAIC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,gBAA+C;IAE/C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,IAAA,cAAM,EAAC,IAAI,CAAC,CAAC;IAElC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YACzB,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;SAC9B;QAED,YAAY,CAAC,OAAO,GAAG,KAAK,CAAC;QAC7B,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE;gBAChB,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACvB,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,OAAO,KAAK,CAAC;AACf,CAAC;AArBD,sDAqBC","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 Utilities\n */\n\nimport { useEffect, useRef, useState } from \"react\";\nimport type { IDisposable } from \"@itwin/core-bentley\";\n\n/**\n * A custom hook which creates a disposable object and manages its disposal on unmount\n * or factory method change.\n * @public\n */\nexport function useDisposable<TDisposable extends IDisposable>(\n createDisposable: () => TDisposable\n): TDisposable {\n return useOptionalDisposable(createDisposable)!;\n}\n\n/**\n * A custom hook which calls the factory method to create a disposable object\n * which might as well be undefined. If the result was a disposable object, the\n * hook takes care of disposing it when necessary.\n * @public\n */\nexport function useOptionalDisposable<TDisposable extends IDisposable>(\n createDisposable: () => TDisposable | undefined\n): TDisposable | undefined {\n const [value, setValue] = useState(() => createDisposable());\n const initialValue = useRef(true);\n\n useEffect(() => {\n if (!initialValue.current) {\n setValue(createDisposable());\n }\n\n initialValue.current = false;\n return () => {\n setValue((prev) => {\n prev && prev.dispose();\n return prev;\n });\n };\n }, [createDisposable]);\n\n return value;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matches.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/matches.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
//# sourceMappingURL=matches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matches.js","sourceRoot":"","sources":["../../../../src/core-react/utils/matches.ts"],"names":[],"mappings":";AAAA;;;gGAGgG","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\n/** @packageDocumentation\n * @module Utilities\n */\n\n/** Interface that returns indices of matches\n * @internal\n */\nexport interface IMatch {\n start: number;\n end: number;\n}\n"]}
|
package/lib/cjs/core-react.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ export * from "./core-react/utils/shallowDiffers";
|
|
|
92
92
|
export * from "./core-react/utils/typeUtils";
|
|
93
93
|
export * from "./core-react/utils/isPromiseLike";
|
|
94
94
|
export * from "./core-react/utils/ScrollPositionMaintainer";
|
|
95
|
+
export * from "./core-react/utils/getObjectClassName";
|
|
95
96
|
export * from "./core-react/utils/hooks/useDisposable";
|
|
96
97
|
export * from "./core-react/utils/hooks/useEffectSkipFirst";
|
|
97
98
|
export * from "./core-react/utils/hooks/useEventListener";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-react.d.ts","sourceRoot":"","sources":["../../src/core-react.ts"],"names":[],"mappings":"AAOA,cAAc,qBAAqB,CAAC;AAEpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,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GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
|
package/lib/cjs/core-react.js
CHANGED
|
@@ -119,6 +119,7 @@ __exportStar(require("./core-react/utils/shallowDiffers"), exports);
|
|
|
119
119
|
__exportStar(require("./core-react/utils/typeUtils"), exports);
|
|
120
120
|
__exportStar(require("./core-react/utils/isPromiseLike"), exports);
|
|
121
121
|
__exportStar(require("./core-react/utils/ScrollPositionMaintainer"), exports);
|
|
122
|
+
__exportStar(require("./core-react/utils/getObjectClassName"), exports);
|
|
122
123
|
__exportStar(require("./core-react/utils/hooks/useDisposable"), exports);
|
|
123
124
|
__exportStar(require("./core-react/utils/hooks/useEffectSkipFirst"), exports);
|
|
124
125
|
__exportStar(require("./core-react/utils/hooks/useEventListener"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-react.js","sourceRoot":"","sources":["../../src/core-react.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;AAEhG,gFAAgF;AAEhF,sDAAoC;AAEpC,2DAAyC;AACzC,oEAAkD;AAClD,+DAA6C;AAC7C,8DAA4C;AAE5C,wDAAsC;AACtC,wEAAsD;AACtD,6DAA2C;AAC3C,iEAA+C;AAC/C,sEAAoD;AACpD,wDAAsC;AACtC,kEAAgD;AAChD,+DAA6C;AAE7C,uEAAqD;AAErD,yEAAuD;AAEvD,uEAAqD;AACrD,gFAA8D;AAC9D,8EAA4D;AAC5D,2EAAyD;AACzD,0EAAwD;AACxD,6EAA2D;AAC3D,4EAA0D;AAE1D,6DAA2C;AAC3C,mEAAiD;AAEjD,iFAA+D;AAE/D,+DAA6C;AAC7C,mEAAiD;AACjD,iEAA+C;AAC/C,mEAAiD;AACjD,gEAA8C;AAE9C,yEAAuD;AAEvD,2EAAyD;AACzD,mEAAiD;AAEjD,kEAAgD;AAChD,uEAAqD;AACrD,gEAA8C;AAE9C,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;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","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\n// cSpell:ignore focustrap imagecheckbox iconinput hocs numberinput numericinput\n\nexport * from \"./core-react/UiCore\";\n\nexport * from \"./core-react/badge/Badge\";\nexport * from \"./core-react/badge/BadgeUtilities\";\nexport * from \"./core-react/badge/BetaBadge\";\nexport * from \"./core-react/badge/NewBadge\";\n\nexport * from \"./core-react/base/Div\";\nexport * from \"./core-react/base/DivWithOutsideClick\";\nexport * from \"./core-react/base/Centered\";\nexport * from \"./core-react/base/FillCentered\";\nexport * from \"./core-react/base/FlexWrapContainer\";\nexport * from \"./core-react/base/Gap\";\nexport * from \"./core-react/base/PointerEvents\";\nexport * from \"./core-react/base/ScrollView\";\n\nexport * from \"./core-react/button/UnderlinedButton\";\n\nexport * from \"./core-react/checklistbox/CheckListBox\";\n\nexport * from \"./core-react/contextmenu/ContextMenu\";\nexport * from \"./core-react/contextmenu/ContextMenuDirection\";\nexport * from \"./core-react/contextmenu/ContextMenuDivider\";\nexport * from \"./core-react/contextmenu/ContextMenuItem\";\nexport * from \"./core-react/contextmenu/ContextSubMenu\";\nexport * from \"./core-react/contextmenu/GlobalContextMenu\";\nexport * from \"./core-react/contextmenu/PopupContextMenu\";\n\nexport * from \"./core-react/dialog/Dialog\";\nexport * from \"./core-react/dialog/GlobalDialog\";\n\nexport * from \"./core-react/elementseparator/ElementSeparator\";\n\nexport * from \"./core-react/enums/Alignment\";\nexport * from \"./core-react/enums/CheckBoxState\";\nexport * from \"./core-react/enums/Orientation\";\nexport * from \"./core-react/enums/SortDirection\";\nexport * from \"./core-react/enums/TimeFormat\";\n\nexport * from \"./core-react/expandable/ExpandableList\";\n\nexport * from \"./core-react/focus/ItemKeyboardNavigator\";\nexport * from \"./core-react/focustrap/FocusTrap\";\n\nexport * from \"./core-react/hocs/withIsPressed\";\nexport * from \"./core-react/hocs/withOnOutsideClick\";\nexport * from \"./core-react/hocs/withTimeout\";\n\nexport * from \"./core-react/icons/ConditionalIconItem\";\nexport * from \"./core-react/icons/IconComponent\";\nexport * from \"./core-react/icons/SvgPath\";\nexport * from \"./core-react/icons/WebFontIcon\";\n\nexport * from \"./core-react/autosuggest/AutoSuggest\";\n\nexport * from \"./core-react/imagecheckbox/ImageCheckBox\";\n\nexport * from \"./core-react/inputs/InputLabel\";\nexport * from \"./core-react/inputs/InputStatus\";\nexport * from \"./core-react/inputs/iconinput/IconInput\";\nexport * from \"./core-react/inputs/LabeledComponentProps\";\nexport * from \"./core-react/inputs/numberinput/NumberInput\";\n\nexport * from \"./core-react/listbox/Listbox\";\n\nexport * from \"./core-react/loading/LoadingBar\";\nexport * from \"./core-react/loading/LoadingPrompt\";\nexport * from \"./core-react/loading/LoadingSpinner\";\nexport * from \"./core-react/loading/LoadingStatus\";\n\nexport * from \"./core-react/messagebox/MessageBox\";\n\nexport * from \"./core-react/notification/MessageRenderer\";\nexport * from \"./core-react/notification/MessageType\";\n\nexport * from \"./core-react/popup/Popup\";\n\nexport * from \"./core-react/radialmenu/RadialMenu\";\nexport * from \"./core-react/radialmenu/Annulus\";\n\nexport * from \"./core-react/searchbox/SearchBox\";\n\nexport * from \"./core-react/settings/SettingsManager\";\nexport * from \"./core-react/settings/SettingsContainer\";\n\nexport * from \"./core-react/tabs/VerticalTabs\";\nexport * from \"./core-react/tabs/Tabs\";\n\nexport * from \"./core-react/text/BodyText\";\nexport * from \"./core-react/text/BlockText\";\nexport * from \"./core-react/text/DisabledText\";\nexport * from \"./core-react/text/FilteredText\";\nexport * from \"./core-react/text/MutedText\";\nexport * from \"./core-react/text/StyledText\";\nexport * from \"./core-react/text/TextProps\";\n\nexport {\n ExpansionToggle,\n ExpansionToggleProps,\n} from \"./core-react/tree/ExpansionToggle\";\nexport { TreeBranch, TreeBranchProps } from \"./core-react/tree/Branch\";\nexport {\n TreeNode,\n TreeNodeProps,\n NodeCheckboxProps,\n NodeCheckboxRenderer,\n NodeCheckboxRenderProps,\n} from \"./core-react/tree/Node\";\nexport { Tree, TreeProps } from \"./core-react/tree/Tree\";\nexport {\n TreeNodePlaceholder,\n TreeNodePlaceholderProps,\n} from \"./core-react/tree/Placeholder\";\n\nexport * from \"./core-react/uistate/UiStateEntry\";\nexport * from \"./core-react/uistate/UiStateStorage\";\nexport * from \"./core-react/uistate/LocalStateStorage\";\n\nexport * from \"./core-react/utils/IconHelper\";\nexport * from \"./core-react/utils/Point\";\nexport * from \"./core-react/utils/Props\";\nexport * from \"./core-react/utils/Rectangle\";\nexport * from \"./core-react/utils/Size\";\nexport * from \"./core-react/utils/Timer\";\nexport * from \"./core-react/utils/UiGeometry\";\nexport * from \"./core-react/utils/flattenChildren\";\nexport * from \"./core-react/utils/getBestBWContrastColor\";\nexport * from \"./core-react/utils/getCssVariable\";\nexport * from \"./core-react/utils/getDisplayName\";\nexport * from \"./core-react/utils/getUserColor\";\nexport * from \"./core-react/utils/shallowDiffers\";\nexport * from \"./core-react/utils/typeUtils\";\nexport * from \"./core-react/utils/isPromiseLike\";\nexport * from \"./core-react/utils/ScrollPositionMaintainer\";\n\nexport * from \"./core-react/utils/hooks/useDisposable\";\nexport * from \"./core-react/utils/hooks/useEffectSkipFirst\";\nexport * from \"./core-react/utils/hooks/useEventListener\";\nexport * from \"./core-react/utils/hooks/ResizeObserverPolyfill\";\nexport * from \"./core-react/utils/hooks/useOnOutsideClick\";\nexport * from \"./core-react/utils/hooks/useProximityToMouse\";\nexport * from \"./core-react/utils/hooks/useRefEffect\";\nexport * from \"./core-react/utils/hooks/useRefs\";\nexport * from \"./core-react/utils/hooks/useRefState\";\nexport * from \"./core-react/utils/hooks/useResizeObserver\";\nexport * from \"./core-react/utils/hooks/useTargeted\";\nexport * from \"./core-react/utils/hooks/useWidgetOpacityContext\";\nexport * from \"./core-react/utils/hooks/useInterval\";\nexport * from \"./core-react/utils/hooks/useCrossOriginPopup\";\n\n/** @docs-package-description\n * The core-react package contains general purpose React components, such as Dialog, MessageBox, SearchBox, RadialMenu and SplitButton.\n * For more information, see [learning about core-react]($docs/learning/ui/core/index.md).\n */\n/**\n * @docs-group-description AutoSuggest\n * Component for input with an auto-suggestion dropdown.\n */\n/**\n * @docs-group-description Base\n * Low-level classes and components for building application UI.\n */\n/**\n * @docs-group-description Button\n * Components for working with various Buttons.\n */\n/**\n * @docs-group-description Checkbox\n * Component is a wrapper for the `<input type=\"checkbox\">` HTML element.\n */\n/**\n * @docs-group-description CheckListBox\n * Components for working with a Check listbox.\n */\n/**\n * @docs-group-description Common\n * Common classes and enums used across various UI components.\n */\n/**\n * @docs-group-description ContextMenu\n * Components for working with a Context Menu.\n */\n/**\n * @docs-group-description Dialog\n * Components for working with a Dialog or MessageBox.\n */\n/**\n * @docs-group-description ElementSeparator\n * Components for working with a ElementSeparator.\n */\n/**\n * @docs-group-description Expandable\n * Components for working with a ExpandableBlock or ExpandableList.\n */\n/**\n * @docs-group-description Form\n * Components used to create a Form using supplied properties to specify fields.\n */\n/**\n * @docs-group-description Icon\n * Component that renders core-react icon when given an icon name or SVG source.\n */\n/**\n * @docs-group-description Inputs\n * Components for working with input controls, such as Input, IconInput and NumberInput.\n */\n/**\n * @docs-group-description Loading\n * Components for working with Loading spinners and progress indicators and bars.\n */\n/**\n * @docs-group-description Notification\n * Components for working with messages and tooltips.\n */\n/**\n * @docs-group-description Popup\n * Components for working with a Popup.\n */\n/**\n * @docs-group-description RadialMenu\n * Components for working with a RadialMenu.\n */\n/**\n * @docs-group-description Radio\n * Component is a wrapper for the `<input type=\"radio\">` HTML element.\n */\n/**\n * @docs-group-description SearchBox\n * Components for working with a SearchBox.\n */\n/**\n * @docs-group-description Select\n * Component is a wrapper for the `<select>` HTML element.\n */\n/**\n * @docs-group-description Settings\n * Manager and UI Components that allow users to modify settings for different packages and extensions.\n */\n/**\n * @docs-group-description Slider\n * Component displays a range slider with thumbs for changing the value.\n */\n/**\n * @docs-group-description SplitButton\n * Components for working with a SplitButton.\n */\n/**\n * @docs-group-description Tabs\n * Components for working with horizontal or vertical tabs.\n */\n/**\n * @docs-group-description Text\n * Components for working with styled text.\n */\n/**\n * @docs-group-description Tiles\n * Components for a container rendering elements that can be grouped together.\n */\n/**\n * @docs-group-description Toggle\n * Components for working with a Toggle switch.\n */\n/**\n * @docs-group-description Tooltip\n * Components for working with a Tooltip.\n */\n/**\n * @docs-group-description Tree\n * Presentation React components for working with a Tree.\n */\n/**\n * @docs-group-description UiStateStorage\n * Interfaces and classes for working with persistent UI settings.\n */\n/**\n * @docs-group-description Utilities\n * Various utility classes, functions and React hooks for working with a UI.\n */\n"]}
|
|
1
|
+
{"version":3,"file":"core-react.js","sourceRoot":"","sources":["../../src/core-react.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;AAEhG,gFAAgF;AAEhF,sDAAoC;AAEpC,2DAAyC;AACzC,oEAAkD;AAClD,+DAA6C;AAC7C,8DAA4C;AAE5C,wDAAsC;AACtC,wEAAsD;AACtD,6DAA2C;AAC3C,iEAA+C;AAC/C,sEAAoD;AACpD,wDAAsC;AACtC,kEAAgD;AAChD,+DAA6C;AAE7C,uEAAqD;AAErD,yEAAuD;AAEvD,uEAAqD;AACrD,gFAA8D;AAC9D,8EAA4D;AAC5D,2EAAyD;AACzD,0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AC7C,mEAAiD;AACjD,8EAA4D;AAC5D,wEAAsD;AAEtD,yEAAuD;AACvD,8EAA4D;AAC5D,4EAA0D;AAC1D,kFAAgE;AAChE,6EAA2D;AAC3D,+EAA6D;AAC7D,wEAAsD;AACtD,mEAAiD;AACjD,uEAAqD;AACrD,6EAA2D;AAC3D,uEAAqD;AACrD,mFAAiE;AACjE,uEAAqD;AACrD,+EAA6D;AAE7D;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","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\n// cSpell:ignore focustrap imagecheckbox iconinput hocs numberinput numericinput\n\nexport * from \"./core-react/UiCore\";\n\nexport * from \"./core-react/badge/Badge\";\nexport * from \"./core-react/badge/BadgeUtilities\";\nexport * from \"./core-react/badge/BetaBadge\";\nexport * from \"./core-react/badge/NewBadge\";\n\nexport * from \"./core-react/base/Div\";\nexport * from \"./core-react/base/DivWithOutsideClick\";\nexport * from \"./core-react/base/Centered\";\nexport * from \"./core-react/base/FillCentered\";\nexport * from \"./core-react/base/FlexWrapContainer\";\nexport * from \"./core-react/base/Gap\";\nexport * from \"./core-react/base/PointerEvents\";\nexport * from \"./core-react/base/ScrollView\";\n\nexport * from \"./core-react/button/UnderlinedButton\";\n\nexport * from \"./core-react/checklistbox/CheckListBox\";\n\nexport * from \"./core-react/contextmenu/ContextMenu\";\nexport * from \"./core-react/contextmenu/ContextMenuDirection\";\nexport * from \"./core-react/contextmenu/ContextMenuDivider\";\nexport * from \"./core-react/contextmenu/ContextMenuItem\";\nexport * from \"./core-react/contextmenu/ContextSubMenu\";\nexport * from \"./core-react/contextmenu/GlobalContextMenu\";\nexport * from \"./core-react/contextmenu/PopupContextMenu\";\n\nexport * from \"./core-react/dialog/Dialog\";\nexport * from \"./core-react/dialog/GlobalDialog\";\n\nexport * from \"./core-react/elementseparator/ElementSeparator\";\n\nexport * from \"./core-react/enums/Alignment\";\nexport * from \"./core-react/enums/CheckBoxState\";\nexport * from \"./core-react/enums/Orientation\";\nexport * from \"./core-react/enums/SortDirection\";\nexport * from \"./core-react/enums/TimeFormat\";\n\nexport * from \"./core-react/expandable/ExpandableList\";\n\nexport * from \"./core-react/focus/ItemKeyboardNavigator\";\nexport * from \"./core-react/focustrap/FocusTrap\";\n\nexport * from \"./core-react/hocs/withIsPressed\";\nexport * from \"./core-react/hocs/withOnOutsideClick\";\nexport * from \"./core-react/hocs/withTimeout\";\n\nexport * from \"./core-react/icons/ConditionalIconItem\";\nexport * from \"./core-react/icons/IconComponent\";\nexport * from \"./core-react/icons/SvgPath\";\nexport * from \"./core-react/icons/WebFontIcon\";\n\nexport * from \"./core-react/autosuggest/AutoSuggest\";\n\nexport * from \"./core-react/imagecheckbox/ImageCheckBox\";\n\nexport * from \"./core-react/inputs/InputLabel\";\nexport * from \"./core-react/inputs/InputStatus\";\nexport * from \"./core-react/inputs/iconinput/IconInput\";\nexport * from \"./core-react/inputs/LabeledComponentProps\";\nexport * from \"./core-react/inputs/numberinput/NumberInput\";\n\nexport * from \"./core-react/listbox/Listbox\";\n\nexport * from \"./core-react/loading/LoadingBar\";\nexport * from \"./core-react/loading/LoadingPrompt\";\nexport * from \"./core-react/loading/LoadingSpinner\";\nexport * from \"./core-react/loading/LoadingStatus\";\n\nexport * from \"./core-react/messagebox/MessageBox\";\n\nexport * from \"./core-react/notification/MessageRenderer\";\nexport * from \"./core-react/notification/MessageType\";\n\nexport * from \"./core-react/popup/Popup\";\n\nexport * from \"./core-react/radialmenu/RadialMenu\";\nexport * from \"./core-react/radialmenu/Annulus\";\n\nexport * from \"./core-react/searchbox/SearchBox\";\n\nexport * from \"./core-react/settings/SettingsManager\";\nexport * from \"./core-react/settings/SettingsContainer\";\n\nexport * from \"./core-react/tabs/VerticalTabs\";\nexport * from \"./core-react/tabs/Tabs\";\n\nexport * from \"./core-react/text/BodyText\";\nexport * from \"./core-react/text/BlockText\";\nexport * from \"./core-react/text/DisabledText\";\nexport * from \"./core-react/text/FilteredText\";\nexport * from \"./core-react/text/MutedText\";\nexport * from \"./core-react/text/StyledText\";\nexport * from \"./core-react/text/TextProps\";\n\nexport {\n ExpansionToggle,\n ExpansionToggleProps,\n} from \"./core-react/tree/ExpansionToggle\";\nexport { TreeBranch, TreeBranchProps } from \"./core-react/tree/Branch\";\nexport {\n TreeNode,\n TreeNodeProps,\n NodeCheckboxProps,\n NodeCheckboxRenderer,\n NodeCheckboxRenderProps,\n} from \"./core-react/tree/Node\";\nexport { Tree, TreeProps } from \"./core-react/tree/Tree\";\nexport {\n TreeNodePlaceholder,\n TreeNodePlaceholderProps,\n} from \"./core-react/tree/Placeholder\";\n\nexport * from \"./core-react/uistate/UiStateEntry\";\nexport * from \"./core-react/uistate/UiStateStorage\";\nexport * from \"./core-react/uistate/LocalStateStorage\";\n\nexport * from \"./core-react/utils/IconHelper\";\nexport * from \"./core-react/utils/Point\";\nexport * from \"./core-react/utils/Props\";\nexport * from \"./core-react/utils/Rectangle\";\nexport * from \"./core-react/utils/Size\";\nexport * from \"./core-react/utils/Timer\";\nexport * from \"./core-react/utils/UiGeometry\";\nexport * from \"./core-react/utils/flattenChildren\";\nexport * from \"./core-react/utils/getBestBWContrastColor\";\nexport * from \"./core-react/utils/getCssVariable\";\nexport * from \"./core-react/utils/getDisplayName\";\nexport * from \"./core-react/utils/getUserColor\";\nexport * from \"./core-react/utils/shallowDiffers\";\nexport * from \"./core-react/utils/typeUtils\";\nexport * from \"./core-react/utils/isPromiseLike\";\nexport * from \"./core-react/utils/ScrollPositionMaintainer\";\nexport * from \"./core-react/utils/getObjectClassName\";\n\nexport * from \"./core-react/utils/hooks/useDisposable\";\nexport * from \"./core-react/utils/hooks/useEffectSkipFirst\";\nexport * from \"./core-react/utils/hooks/useEventListener\";\nexport * from \"./core-react/utils/hooks/ResizeObserverPolyfill\";\nexport * from \"./core-react/utils/hooks/useOnOutsideClick\";\nexport * from \"./core-react/utils/hooks/useProximityToMouse\";\nexport * from \"./core-react/utils/hooks/useRefEffect\";\nexport * from \"./core-react/utils/hooks/useRefs\";\nexport * from \"./core-react/utils/hooks/useRefState\";\nexport * from \"./core-react/utils/hooks/useResizeObserver\";\nexport * from \"./core-react/utils/hooks/useTargeted\";\nexport * from \"./core-react/utils/hooks/useWidgetOpacityContext\";\nexport * from \"./core-react/utils/hooks/useInterval\";\nexport * from \"./core-react/utils/hooks/useCrossOriginPopup\";\n\n/** @docs-package-description\n * The core-react package contains general purpose React components, such as Dialog, MessageBox, SearchBox, RadialMenu and SplitButton.\n * For more information, see [learning about core-react]($docs/learning/ui/core/index.md).\n */\n/**\n * @docs-group-description AutoSuggest\n * Component for input with an auto-suggestion dropdown.\n */\n/**\n * @docs-group-description Base\n * Low-level classes and components for building application UI.\n */\n/**\n * @docs-group-description Button\n * Components for working with various Buttons.\n */\n/**\n * @docs-group-description Checkbox\n * Component is a wrapper for the `<input type=\"checkbox\">` HTML element.\n */\n/**\n * @docs-group-description CheckListBox\n * Components for working with a Check listbox.\n */\n/**\n * @docs-group-description Common\n * Common classes and enums used across various UI components.\n */\n/**\n * @docs-group-description ContextMenu\n * Components for working with a Context Menu.\n */\n/**\n * @docs-group-description Dialog\n * Components for working with a Dialog or MessageBox.\n */\n/**\n * @docs-group-description ElementSeparator\n * Components for working with a ElementSeparator.\n */\n/**\n * @docs-group-description Expandable\n * Components for working with a ExpandableBlock or ExpandableList.\n */\n/**\n * @docs-group-description Form\n * Components used to create a Form using supplied properties to specify fields.\n */\n/**\n * @docs-group-description Icon\n * Component that renders core-react icon when given an icon name or SVG source.\n */\n/**\n * @docs-group-description Inputs\n * Components for working with input controls, such as Input, IconInput and NumberInput.\n */\n/**\n * @docs-group-description Loading\n * Components for working with Loading spinners and progress indicators and bars.\n */\n/**\n * @docs-group-description Notification\n * Components for working with messages and tooltips.\n */\n/**\n * @docs-group-description Popup\n * Components for working with a Popup.\n */\n/**\n * @docs-group-description RadialMenu\n * Components for working with a RadialMenu.\n */\n/**\n * @docs-group-description Radio\n * Component is a wrapper for the `<input type=\"radio\">` HTML element.\n */\n/**\n * @docs-group-description SearchBox\n * Components for working with a SearchBox.\n */\n/**\n * @docs-group-description Select\n * Component is a wrapper for the `<select>` HTML element.\n */\n/**\n * @docs-group-description Settings\n * Manager and UI Components that allow users to modify settings for different packages and extensions.\n */\n/**\n * @docs-group-description Slider\n * Component displays a range slider with thumbs for changing the value.\n */\n/**\n * @docs-group-description SplitButton\n * Components for working with a SplitButton.\n */\n/**\n * @docs-group-description Tabs\n * Components for working with horizontal or vertical tabs.\n */\n/**\n * @docs-group-description Text\n * Components for working with styled text.\n */\n/**\n * @docs-group-description Tiles\n * Components for a container rendering elements that can be grouped together.\n */\n/**\n * @docs-group-description Toggle\n * Components for working with a Toggle switch.\n */\n/**\n * @docs-group-description Tooltip\n * Components for working with a Tooltip.\n */\n/**\n * @docs-group-description Tree\n * Presentation React components for working with a Tree.\n */\n/**\n * @docs-group-description UiStateStorage\n * Interfaces and classes for working with persistent UI settings.\n */\n/**\n * @docs-group-description Utilities\n * Various utility classes, functions and React hooks for working with a UI.\n */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiCore.d.ts","sourceRoot":"","sources":["../../../src/core-react/UiCore.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,4EAA4E;AAC5E,OAAO,oBAAoB,CAAC;AAC5B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,OAAO,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"UiCore.d.ts","sourceRoot":"","sources":["../../../src/core-react/UiCore.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,4EAA4E;AAC5E,OAAO,oBAAoB,CAAC;AAC5B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,OAAO,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMvD;;;GAGG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAS;IACpC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAe;IAE5C;;;OAGG;WACiB,UAAU,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBzE,oDAAoD;WACtC,SAAS;IAQvB,gDAAgD;IAChD,WAAkB,WAAW,IAAI,OAAO,CAEvC;IAED;;OAEG;IACH,WAAkB,YAAY,IAAI,YAAY,CAS7C;IAED,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;IAED;;OAEG;WACW,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM;IAavD,gBAAgB;IAChB,WAAkB,WAAW,IAAI,MAAM,CAEtC;IAED,gBAAgB;WACF,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM;CAK/C"}
|
|
@@ -11,8 +11,9 @@ import "./colorvariables.scss";
|
|
|
11
11
|
import "./layout-variables.scss";
|
|
12
12
|
import "./classes.scss";
|
|
13
13
|
import { Logger } from "@itwin/core-bentley";
|
|
14
|
-
import {
|
|
14
|
+
import { UiError } from "@itwin/appui-abstract";
|
|
15
15
|
import { IconWebComponent } from "./utils/IconWebComponent";
|
|
16
|
+
import { getObjectClassName } from "./utils/getObjectClassName";
|
|
16
17
|
// cSpell:ignore colorthemes colorvariables
|
|
17
18
|
/**
|
|
18
19
|
* Manages the Localization service for the core-react package.
|
|
@@ -77,7 +78,7 @@ class UiCore {
|
|
|
77
78
|
}
|
|
78
79
|
/** @internal */
|
|
79
80
|
static loggerCategory(obj) {
|
|
80
|
-
const className =
|
|
81
|
+
const className = getObjectClassName(obj);
|
|
81
82
|
const category = UiCore.packageName + (className ? `.${className}` : "");
|
|
82
83
|
return category;
|
|
83
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiCore.js","sourceRoot":"","sources":["../../../src/core-react/UiCore.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,4EAA4E;AAC5E,OAAO,oBAAoB,CAAC;AAC5B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"UiCore.js","sourceRoot":"","sources":["../../../src/core-react/UiCore.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,4EAA4E;AAC5E,OAAO,oBAAoB,CAAC;AAC5B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,2CAA2C;AAE3C;;;GAGG;AACH,MAAa,MAAM;IAIjB;;;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AC5C,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE;YACzB,MAAM,CAAC,QAAQ,CACb,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAC3B,4FAA4F,CAC7F,CAAC;YACF,OAAO,EAAE,CAAC;SACX;QACD,OAAO,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAAC,GAAG,EAAE;YAClD,EAAE,EAAE,MAAM,CAAC,qBAAqB;SACjC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IACT,MAAM,KAAK,WAAW;QAC3B,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACzE,OAAO,QAAQ,CAAC;IAClB,CAAC;;AAnFc,mBAAY,GAAG,KAAK,CAAC;SADzB,MAAM","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 Utilities\n */\n\n/** Import color variables, layout variables and Sass classes barrel file */\nimport \"./colorthemes.scss\";\nimport \"./colorvariables.scss\";\nimport \"./layout-variables.scss\";\nimport \"./classes.scss\";\n\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { Localization } from \"@itwin/core-common\";\nimport { UiError } from \"@itwin/appui-abstract\";\nimport { IconWebComponent } from \"./utils/IconWebComponent\";\nimport { getObjectClassName } from \"./utils/getObjectClassName\";\n// cSpell:ignore colorthemes colorvariables\n\n/**\n * Manages the Localization service for the core-react package.\n * @public\n */\nexport class UiCore {\n private static _initialized = false;\n private static _localization?: Localization;\n\n /**\n * Registers the Localization service namespace for UiCore.\n * @param localization The internationalization service created by the host application.\n */\n public static async initialize(localization: Localization): Promise<void> {\n if (UiCore._initialized) {\n Logger.logInfo(\n UiCore.loggerCategory(UiCore),\n `UiCore.initialize already called`\n );\n return;\n }\n\n UiCore._localization = localization;\n await UiCore._localization.registerNamespace(UiCore.localizationNamespace);\n if (window.customElements.get(\"svg-loader\") === undefined)\n window.customElements.define(\"svg-loader\", IconWebComponent);\n\n UiCore._initialized = true;\n }\n\n /** Unregisters the UiCore localization namespace */\n public static terminate() {\n if (UiCore._localization)\n UiCore._localization.unregisterNamespace(UiCore.localizationNamespace);\n UiCore._localization = undefined;\n\n UiCore._initialized = false;\n }\n\n /** Determines if UiCore has been initialized */\n public static get initialized(): boolean {\n return UiCore._initialized;\n }\n\n /** The internationalization service created by the host application.\n * @internal\n */\n public static get localization(): Localization {\n // istanbul ignore else\n if (!UiCore._localization)\n throw new UiError(\n UiCore.loggerCategory(this),\n \"localization: UiCore.initialize has not been called. Unable to return Localization object.\"\n );\n // istanbul ignore next\n return UiCore._localization;\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return \"UiCore\";\n }\n\n /** Calls localization.getLocalizedStringWithNamespace with the \"UiCore\" namespace. Do NOT include the namespace in the key.\n * @internal\n */\n public static translate(key: string | string[]): string {\n if (!UiCore._localization) {\n Logger.logError(\n UiCore.loggerCategory(this),\n `translate: UiCore must be initialize with a localization provider. Returning blank string.`\n );\n return \"\";\n }\n return UiCore._localization.getLocalizedString(key, {\n ns: UiCore.localizationNamespace,\n });\n }\n\n /** @internal */\n public static get packageName(): string {\n return \"core-react\";\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getObjectClassName(obj);\n const category = UiCore.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n}\n"]}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import "./AutoSuggest.scss";
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import * as ReactAutosuggest from "react-autosuggest";
|
|
11
|
+
import { Key } from "ts-key-enum";
|
|
11
12
|
import { Logger } from "@itwin/core-bentley";
|
|
12
|
-
import { SpecialKey } from "@itwin/appui-abstract";
|
|
13
13
|
import { UiCore } from "../UiCore";
|
|
14
14
|
/** Auto Suggest React component. Uses the react-autosuggest component internally.
|
|
15
15
|
* @public
|
|
@@ -74,17 +74,17 @@ export class AutoSuggest extends React.PureComponent {
|
|
|
74
74
|
this._renderSuggestion = (suggestion) => (React.createElement("span", null, suggestion.label));
|
|
75
75
|
this._handleKeyDown = (e) => {
|
|
76
76
|
switch (e.key) {
|
|
77
|
-
case
|
|
77
|
+
case Key.Enter:
|
|
78
78
|
// istanbul ignore else
|
|
79
79
|
if (this.props.onPressEnter)
|
|
80
80
|
this.props.onPressEnter(e);
|
|
81
81
|
break;
|
|
82
|
-
case
|
|
82
|
+
case Key.Escape:
|
|
83
83
|
// istanbul ignore else
|
|
84
84
|
if (this.props.onPressEscape)
|
|
85
85
|
this.props.onPressEscape(e);
|
|
86
86
|
break;
|
|
87
|
-
case
|
|
87
|
+
case Key.Tab:
|
|
88
88
|
// istanbul ignore else
|
|
89
89
|
if (this.props.onPressTab)
|
|
90
90
|
this.props.onPressTab(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoSuggest.js","sourceRoot":"","sources":["../../../../src/core-react/autosuggest/AutoSuggest.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAwEnC;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK,CAA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IAAI,CAAC,qBAAqB,EAChD,uBAAuB,EAAE,uBAAuB,EAChD,oBAAoB,EAAE,oBAAoB,EAC1C,0BAA0B,EAAE,0BAA0B,GACtD,CACE,CACP,CAAC;IACJ,CAAC;CACF","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 * as ReactAutosuggest from \"react-autosuggest\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\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 SpecialKey.Enter:\n // istanbul ignore else\n if (this.props.onPressEnter) this.props.onPressEnter(e);\n break;\n case SpecialKey.Escape:\n // istanbul ignore else\n if (this.props.onPressEscape) this.props.onPressEscape(e);\n break;\n case SpecialKey.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: \"iui-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 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={renderInputComponent}\n renderSuggestionsContainer={renderSuggestionsContainer}\n />\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AutoSuggest.js","sourceRoot":"","sources":["../../../../src/core-react/autosuggest/AutoSuggest.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAwEnC;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,aAGtC;IAGC,YAAY,KAAuB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHP,eAAU,GAAG,KAAK,CAAC;QAqCnB,cAAS,GAAG,CAAC,CAAsC,EAAE,EAAE;YAC7D,IAAI,QAAQ,GAAG,EAAE,CAAC;YAElB,IAAI,CAAC,CAAC,MA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J,KAAK,EACL,QAAQ,EACR,WAAW,EACX,OAAO,EACP,oBAAoB,EACpB,QAAQ,EACR,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,EAC3B,GAAG,KAAK,EACT,GAAG,IAAI,CAAC,KAAK,CAAC;QACf,MAAM,gBAAgB,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;QAE/D,MAAM,UAAU,GAAiD;YAC/D,GAAG,KAAK;YACR,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,WAAW,EAAE,gBAAgB;YAC7B,SAAS,EAAE,QAAQ;SACpB,CAAC;QAEF,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,EAAE,oBAAoB,EAC1C,0BAA0B,EAAE,0BAA0B,GACtD,CACE,CACP,CAAC;IACJ,CAAC;CACF","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 * as ReactAutosuggest from \"react-autosuggest\";\nimport { Key } from \"ts-key-enum\";\nimport { Logger } from \"@itwin/core-bentley\";\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: \"iui-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 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={renderInputComponent}\n renderSuggestionsContainer={renderSuggestionsContainer}\n />\n </div>\n );\n }\n}\n"]}
|