@itwin/core-react 4.8.3 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/ContributeGuidelines.md +2 -3
  3. package/lib/cjs/core-react/UiCore.d.ts.map +1 -1
  4. package/lib/cjs/core-react/UiCore.js +1 -0
  5. package/lib/cjs/core-react/UiCore.js.map +1 -1
  6. package/lib/cjs/core-react/badge/BetaBadge.d.ts +2 -2
  7. package/lib/cjs/core-react/badge/BetaBadge.d.ts.map +1 -1
  8. package/lib/cjs/core-react/badge/NewBadge.d.ts +2 -2
  9. package/lib/cjs/core-react/badge/NewBadge.d.ts.map +1 -1
  10. package/lib/cjs/core-react/base/Centered.d.ts +2 -2
  11. package/lib/cjs/core-react/base/Centered.d.ts.map +1 -1
  12. package/lib/cjs/core-react/base/Div.d.ts +2 -2
  13. package/lib/cjs/core-react/base/Div.d.ts.map +1 -1
  14. package/lib/cjs/core-react/base/DivWithOutsideClick.d.ts +2 -2
  15. package/lib/cjs/core-react/base/FillCentered.d.ts +2 -2
  16. package/lib/cjs/core-react/base/FillCentered.d.ts.map +1 -1
  17. package/lib/cjs/core-react/base/FlexWrapContainer.d.ts +2 -2
  18. package/lib/cjs/core-react/base/FlexWrapContainer.d.ts.map +1 -1
  19. package/lib/cjs/core-react/base/Gap.d.ts +2 -2
  20. package/lib/cjs/core-react/base/Gap.d.ts.map +1 -1
  21. package/lib/cjs/core-react/base/ScrollView.d.ts +2 -2
  22. package/lib/cjs/core-react/base/ScrollView.d.ts.map +1 -1
  23. package/lib/cjs/core-react/button/UnderlinedButton.d.ts +1 -1
  24. package/lib/cjs/core-react/button/UnderlinedButton.d.ts.map +1 -1
  25. package/lib/cjs/core-react/checklistbox/CheckListBox.d.ts +3 -3
  26. package/lib/cjs/core-react/checklistbox/CheckListBox.d.ts.map +1 -1
  27. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js +3 -3
  28. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  29. package/lib/cjs/core-react/contextmenu/PopupContextMenu.d.ts +1 -1
  30. package/lib/cjs/core-react/contextmenu/PopupContextMenu.d.ts.map +1 -1
  31. package/lib/cjs/core-react/elementseparator/ElementSeparator.d.ts +2 -2
  32. package/lib/cjs/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
  33. package/lib/cjs/core-react/focustrap/FocusTrap.d.ts +1 -1
  34. package/lib/cjs/core-react/focustrap/FocusTrap.d.ts.map +1 -1
  35. package/lib/cjs/core-react/hocs/withIsPressed.d.ts +2 -2
  36. package/lib/cjs/core-react/hocs/withOnOutsideClick.d.ts +2 -2
  37. package/lib/cjs/core-react/hocs/withTimeout.d.ts +2 -2
  38. package/lib/cjs/core-react/icons/IconComponent.d.ts +1 -1
  39. package/lib/cjs/core-react/icons/IconComponent.d.ts.map +1 -1
  40. package/lib/cjs/core-react/icons/SvgPath.d.ts +1 -1
  41. package/lib/cjs/core-react/icons/WebFontIcon.d.ts +1 -1
  42. package/lib/cjs/core-react/icons/WebFontIcon.d.ts.map +1 -1
  43. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.d.ts +1 -1
  44. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.d.ts.map +1 -1
  45. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js +1 -2
  46. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
  47. package/lib/cjs/core-react/listbox/Listbox.d.ts +2 -2
  48. package/lib/cjs/core-react/listbox/Listbox.d.ts.map +1 -1
  49. package/lib/cjs/core-react/loading/LoadingBar.d.ts +1 -1
  50. package/lib/cjs/core-react/loading/LoadingPrompt.d.ts +1 -1
  51. package/lib/cjs/core-react/loading/LoadingSpinner.d.ts +1 -1
  52. package/lib/cjs/core-react/loading/LoadingStatus.d.ts +1 -1
  53. package/lib/cjs/core-react/notification/MessageRenderer.d.ts +2 -2
  54. package/lib/cjs/core-react/notification/MessageRenderer.d.ts.map +1 -1
  55. package/lib/cjs/core-react/settings/SettingsContainer.d.ts +2 -2
  56. package/lib/cjs/core-react/settings/SettingsContainer.d.ts.map +1 -1
  57. package/lib/cjs/core-react/tabs/VerticalTabs.d.ts +2 -2
  58. package/lib/cjs/core-react/tabs/VerticalTabs.d.ts.map +1 -1
  59. package/lib/cjs/core-react/text/BlockText.d.ts +2 -2
  60. package/lib/cjs/core-react/text/BlockText.d.ts.map +1 -1
  61. package/lib/cjs/core-react/text/BodyText.d.ts +2 -2
  62. package/lib/cjs/core-react/text/BodyText.d.ts.map +1 -1
  63. package/lib/cjs/core-react/text/DisabledText.d.ts +5 -2
  64. package/lib/cjs/core-react/text/DisabledText.d.ts.map +1 -1
  65. package/lib/cjs/core-react/text/FilteredText.d.ts +1 -1
  66. package/lib/cjs/core-react/text/FilteredText.d.ts.map +1 -1
  67. package/lib/cjs/core-react/text/MutedText.d.ts +2 -2
  68. package/lib/cjs/core-react/text/MutedText.d.ts.map +1 -1
  69. package/lib/cjs/core-react/text/StyledText.d.ts +2 -2
  70. package/lib/cjs/core-react/text/StyledText.d.ts.map +1 -1
  71. package/lib/cjs/core-react/tree/Branch.d.ts +1 -1
  72. package/lib/cjs/core-react/tree/ExpansionToggle.d.ts +1 -1
  73. package/lib/cjs/core-react/tree/Node.d.ts +1 -1
  74. package/lib/cjs/core-react/tree/Placeholder.d.ts +1 -1
  75. package/lib/cjs/core-react/tree/Tree.d.ts +1 -1
  76. package/lib/cjs/core-react/utils/IconWebComponent.d.ts.map +1 -1
  77. package/lib/cjs/core-react/utils/IconWebComponent.js +3 -0
  78. package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
  79. package/lib/cjs/core-react/utils/hooks/useDisposable.d.ts +2 -0
  80. package/lib/cjs/core-react/utils/hooks/useDisposable.d.ts.map +1 -1
  81. package/lib/cjs/core-react/utils/hooks/useDisposable.js +22 -11
  82. package/lib/cjs/core-react/utils/hooks/useDisposable.js.map +1 -1
  83. package/lib/cjs/core-react/utils/hooks/useResizeObserver.d.ts +1 -1
  84. package/lib/cjs/core-react/utils/hooks/useResizeObserver.d.ts.map +1 -1
  85. package/lib/esm/core-react/UiCore.d.ts.map +1 -1
  86. package/lib/esm/core-react/UiCore.js +1 -0
  87. package/lib/esm/core-react/UiCore.js.map +1 -1
  88. package/lib/esm/core-react/badge/BetaBadge.d.ts +2 -2
  89. package/lib/esm/core-react/badge/BetaBadge.d.ts.map +1 -1
  90. package/lib/esm/core-react/badge/NewBadge.d.ts +2 -2
  91. package/lib/esm/core-react/badge/NewBadge.d.ts.map +1 -1
  92. package/lib/esm/core-react/base/Centered.d.ts +2 -2
  93. package/lib/esm/core-react/base/Centered.d.ts.map +1 -1
  94. package/lib/esm/core-react/base/Div.d.ts +2 -2
  95. package/lib/esm/core-react/base/Div.d.ts.map +1 -1
  96. package/lib/esm/core-react/base/DivWithOutsideClick.d.ts +2 -2
  97. package/lib/esm/core-react/base/FillCentered.d.ts +2 -2
  98. package/lib/esm/core-react/base/FillCentered.d.ts.map +1 -1
  99. package/lib/esm/core-react/base/FlexWrapContainer.d.ts +2 -2
  100. package/lib/esm/core-react/base/FlexWrapContainer.d.ts.map +1 -1
  101. package/lib/esm/core-react/base/Gap.d.ts +2 -2
  102. package/lib/esm/core-react/base/Gap.d.ts.map +1 -1
  103. package/lib/esm/core-react/base/ScrollView.d.ts +2 -2
  104. package/lib/esm/core-react/base/ScrollView.d.ts.map +1 -1
  105. package/lib/esm/core-react/button/UnderlinedButton.d.ts +1 -1
  106. package/lib/esm/core-react/button/UnderlinedButton.d.ts.map +1 -1
  107. package/lib/esm/core-react/checklistbox/CheckListBox.d.ts +3 -3
  108. package/lib/esm/core-react/checklistbox/CheckListBox.d.ts.map +1 -1
  109. package/lib/esm/core-react/contextmenu/ContextSubMenu.js +3 -3
  110. package/lib/esm/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  111. package/lib/esm/core-react/contextmenu/PopupContextMenu.d.ts +1 -1
  112. package/lib/esm/core-react/contextmenu/PopupContextMenu.d.ts.map +1 -1
  113. package/lib/esm/core-react/elementseparator/ElementSeparator.d.ts +2 -2
  114. package/lib/esm/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
  115. package/lib/esm/core-react/focustrap/FocusTrap.d.ts +1 -1
  116. package/lib/esm/core-react/focustrap/FocusTrap.d.ts.map +1 -1
  117. package/lib/esm/core-react/hocs/withIsPressed.d.ts +2 -2
  118. package/lib/esm/core-react/hocs/withOnOutsideClick.d.ts +2 -2
  119. package/lib/esm/core-react/hocs/withTimeout.d.ts +2 -2
  120. package/lib/esm/core-react/icons/IconComponent.d.ts +1 -1
  121. package/lib/esm/core-react/icons/IconComponent.d.ts.map +1 -1
  122. package/lib/esm/core-react/icons/SvgPath.d.ts +1 -1
  123. package/lib/esm/core-react/icons/WebFontIcon.d.ts +1 -1
  124. package/lib/esm/core-react/icons/WebFontIcon.d.ts.map +1 -1
  125. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.d.ts +1 -1
  126. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.d.ts.map +1 -1
  127. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js +1 -2
  128. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
  129. package/lib/esm/core-react/listbox/Listbox.d.ts +2 -2
  130. package/lib/esm/core-react/listbox/Listbox.d.ts.map +1 -1
  131. package/lib/esm/core-react/loading/LoadingBar.d.ts +1 -1
  132. package/lib/esm/core-react/loading/LoadingPrompt.d.ts +1 -1
  133. package/lib/esm/core-react/loading/LoadingSpinner.d.ts +1 -1
  134. package/lib/esm/core-react/loading/LoadingStatus.d.ts +1 -1
  135. package/lib/esm/core-react/notification/MessageRenderer.d.ts +2 -2
  136. package/lib/esm/core-react/notification/MessageRenderer.d.ts.map +1 -1
  137. package/lib/esm/core-react/settings/SettingsContainer.d.ts +2 -2
  138. package/lib/esm/core-react/settings/SettingsContainer.d.ts.map +1 -1
  139. package/lib/esm/core-react/tabs/VerticalTabs.d.ts +2 -2
  140. package/lib/esm/core-react/tabs/VerticalTabs.d.ts.map +1 -1
  141. package/lib/esm/core-react/text/BlockText.d.ts +2 -2
  142. package/lib/esm/core-react/text/BlockText.d.ts.map +1 -1
  143. package/lib/esm/core-react/text/BodyText.d.ts +2 -2
  144. package/lib/esm/core-react/text/BodyText.d.ts.map +1 -1
  145. package/lib/esm/core-react/text/DisabledText.d.ts +5 -2
  146. package/lib/esm/core-react/text/DisabledText.d.ts.map +1 -1
  147. package/lib/esm/core-react/text/FilteredText.d.ts +1 -1
  148. package/lib/esm/core-react/text/FilteredText.d.ts.map +1 -1
  149. package/lib/esm/core-react/text/MutedText.d.ts +2 -2
  150. package/lib/esm/core-react/text/MutedText.d.ts.map +1 -1
  151. package/lib/esm/core-react/text/StyledText.d.ts +2 -2
  152. package/lib/esm/core-react/text/StyledText.d.ts.map +1 -1
  153. package/lib/esm/core-react/tree/Branch.d.ts +1 -1
  154. package/lib/esm/core-react/tree/ExpansionToggle.d.ts +1 -1
  155. package/lib/esm/core-react/tree/Node.d.ts +1 -1
  156. package/lib/esm/core-react/tree/Placeholder.d.ts +1 -1
  157. package/lib/esm/core-react/tree/Tree.d.ts +1 -1
  158. package/lib/esm/core-react/utils/IconWebComponent.d.ts.map +1 -1
  159. package/lib/esm/core-react/utils/IconWebComponent.js +3 -0
  160. package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
  161. package/lib/esm/core-react/utils/hooks/useDisposable.d.ts +2 -0
  162. package/lib/esm/core-react/utils/hooks/useDisposable.d.ts.map +1 -1
  163. package/lib/esm/core-react/utils/hooks/useDisposable.js +22 -11
  164. package/lib/esm/core-react/utils/hooks/useDisposable.js.map +1 -1
  165. package/lib/esm/core-react/utils/hooks/useResizeObserver.d.ts +1 -1
  166. package/lib/esm/core-react/utils/hooks/useResizeObserver.d.ts.map +1 -1
  167. package/package.json +4 -5
@@ -1,7 +1,7 @@
1
1
  /** @packageDocumentation
2
2
  * @module Notification
3
3
  */
4
- /// <reference types="react" />
4
+ import * as React from "react";
5
5
  import type { MessageType } from "./MessageType";
6
6
  import type { ClassNameProps } from "../utils/Props";
7
7
  /** Properties for the [[MessageRenderer]] component
@@ -16,5 +16,5 @@ export interface MessageRendererProps extends ClassNameProps {
16
16
  /** React component renders a string, HTMLElement or React node in a `div` or `span`
17
17
  * @public
18
18
  */
19
- export declare function MessageRenderer(props: MessageRendererProps): JSX.Element | null;
19
+ export declare function MessageRenderer(props: MessageRendererProps): React.JSX.Element | null;
20
20
  //# sourceMappingURL=MessageRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessageRenderer.d.ts","sourceRoot":"","sources":["../../../../src/core-react/notification/MessageRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIrD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,wBAAwB;IACxB,OAAO,EAAE,WAAW,CAAC;IACrB,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,sBAyF1D"}
1
+ {"version":3,"file":"MessageRenderer.d.ts","sourceRoot":"","sources":["../../../../src/core-react/notification/MessageRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIrD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,wBAAwB;IACxB,OAAO,EAAE,WAAW,CAAC;IACrB,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,4BAyF1D"}
@@ -1,8 +1,8 @@
1
1
  /** @packageDocumentation
2
2
  * @module Settings
3
3
  */
4
- /// <reference types="react" />
5
4
  import "./SettingsContainer.scss";
5
+ import * as React from "react";
6
6
  import type { SettingsManager, SettingsTabEntry } from "./SettingsManager";
7
7
  /** Hook to use within Settings Page component to allow saving the current page's data before the Setting Container is closed.
8
8
  * @public
@@ -27,5 +27,5 @@ export interface SettingsContainerProps {
27
27
  * Note: that SettingsContainer is not rendered if tabs array is empty
28
28
  * @public
29
29
  */
30
- export declare const SettingsContainer: ({ tabs, onSettingsTabSelected, currentSettingsTab, settingsManager, showHeader, }: SettingsContainerProps) => JSX.Element;
30
+ export declare const SettingsContainer: ({ tabs, onSettingsTabSelected, currentSettingsTab, settingsManager, showHeader, }: SettingsContainerProps) => React.JSX.Element;
31
31
  //# sourceMappingURL=SettingsContainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsContainer.d.ts","sourceRoot":"","sources":["../../../../src/core-react/settings/SettingsContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAEH,OAAO,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAIV,eAAe,EACf,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAiB3B;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE,aAAa,CAAC,EAAE,GAAG,KAAK,IAAI,QAa5E;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,CACZ,gBAAgB,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,EACrC,sBAAsB,CAAC,EAAE,MAAM,KAC5B,IAAI,QAaV;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,gBAAgB,EAAE,CAAC;IAEzB,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IAEtC,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAExD,eAAe,EAAE,eAAe,CAAC;IAEjC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,sFAM3B,sBAAsB,gBAkJxB,CAAC"}
1
+ {"version":3,"file":"SettingsContainer.d.ts","sourceRoot":"","sources":["../../../../src/core-react/settings/SettingsContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAIV,eAAe,EACf,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAiB3B;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE,aAAa,CAAC,EAAE,GAAG,KAAK,IAAI,QAa5E;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,CACZ,gBAAgB,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,EACrC,sBAAsB,CAAC,EAAE,MAAM,KAC5B,IAAI,QAaV;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,gBAAgB,EAAE,CAAC;IAEzB,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IAEtC,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAExD,eAAe,EAAE,eAAe,CAAC;IAEjC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,sFAM3B,sBAAsB,sBAkJxB,CAAC"}
@@ -1,10 +1,10 @@
1
1
  /** @packageDocumentation
2
2
  * @module Tabs
3
3
  */
4
- /// <reference types="react" />
4
+ import * as React from "react";
5
5
  import type { TabsProps } from "./Tabs";
6
6
  /** Vertical tabs meant to represent the current position in a page/section
7
7
  * @public
8
8
  */
9
- export declare function VerticalTabs(props: TabsProps): JSX.Element;
9
+ export declare function VerticalTabs(props: TabsProps): React.JSX.Element;
10
10
  //# sourceMappingURL=VerticalTabs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VerticalTabs.d.ts","sourceRoot":"","sources":["../../../../src/core-react/tabs/VerticalTabs.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAIxC;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,eAQ5C"}
1
+ {"version":3,"file":"VerticalTabs.d.ts","sourceRoot":"","sources":["../../../../src/core-react/tabs/VerticalTabs.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAIxC;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,qBAQ5C"}
@@ -1,10 +1,10 @@
1
1
  /** @packageDocumentation
2
2
  * @module Text
3
3
  */
4
- /// <reference types="react" />
4
+ import * as React from "react";
5
5
  import type { TextProps } from "./TextProps";
6
6
  /** Styled block text React functional component
7
7
  * @public
8
8
  */
9
- export declare function BlockText(props: TextProps): JSX.Element;
9
+ export declare function BlockText(props: TextProps): React.JSX.Element;
10
10
  //# sourceMappingURL=BlockText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BlockText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/BlockText.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,eAGzC"}
1
+ {"version":3,"file":"BlockText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/BlockText.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,qBAGzC"}
@@ -1,11 +1,11 @@
1
1
  /** @packageDocumentation
2
2
  * @module Text
3
3
  */
4
- /// <reference types="react" />
4
+ import * as React from "react";
5
5
  import type { TextProps } from "./TextProps";
6
6
  /** Styled body text React functional component
7
7
  * @public
8
8
  * @deprecated in 4.0 Use \<Text variant='body' /\> from iTwinUI-react package.
9
9
  */
10
- export declare function BodyText(props: TextProps): JSX.Element;
10
+ export declare function BodyText(props: TextProps): React.JSX.Element;
11
11
  //# sourceMappingURL=BodyText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BodyText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/BodyText.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,eAGxC"}
1
+ {"version":3,"file":"BodyText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/BodyText.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,qBAGxC"}
@@ -1,7 +1,10 @@
1
- /// <reference types="react" />
1
+ /** @packageDocumentation
2
+ * @module Text
3
+ */
4
+ import * as React from "react";
2
5
  import type { TextProps } from "./TextProps";
3
6
  /** Styled disabled text React functional component
4
7
  * @public
5
8
  */
6
- export declare function DisabledText(props: TextProps): JSX.Element;
9
+ export declare function DisabledText(props: TextProps): React.JSX.Element;
7
10
  //# sourceMappingURL=DisabledText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DisabledText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/DisabledText.tsx"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,eAG5C"}
1
+ {"version":3,"file":"DisabledText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/DisabledText.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,qBAG5C"}
@@ -21,5 +21,5 @@ export interface FilteredTextProps extends CommonProps {
21
21
  /** Component used to highlight filter matches within a text string.
22
22
  * @alpha
23
23
  */
24
- export declare function FilteredText(props: FilteredTextProps): JSX.Element;
24
+ export declare function FilteredText(props: FilteredTextProps): React.JSX.Element;
25
25
  //# sourceMappingURL=FilteredText.d.ts.map
@@ -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,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
+ {"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,qBA8DpD"}
@@ -1,11 +1,11 @@
1
1
  /** @packageDocumentation
2
2
  * @module Text
3
3
  */
4
- /// <reference types="react" />
4
+ import * as React from "react";
5
5
  import type { TextProps } from "./TextProps";
6
6
  /** Styled muted/gray text React functional component
7
7
  * @public
8
8
  * @deprecated in 4.0 Use \<Text isMuted /\> from iTwinUI-react package.
9
9
  */
10
- export declare function MutedText(props: TextProps): JSX.Element;
10
+ export declare function MutedText(props: TextProps): React.JSX.Element;
11
11
  //# sourceMappingURL=MutedText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MutedText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/MutedText.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,eAGzC"}
1
+ {"version":3,"file":"MutedText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/MutedText.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,qBAGzC"}
@@ -1,7 +1,7 @@
1
1
  /** @packageDocumentation
2
2
  * @module Text
3
3
  */
4
- /// <reference types="react" />
4
+ import * as React from "react";
5
5
  import type { TextProps } from "./TextProps";
6
6
  /** Properties for [[StyledText]] component
7
7
  * @public
@@ -14,5 +14,5 @@ export interface StyledTextProps extends TextProps {
14
14
  * @public
15
15
  * @deprecated in 4.0 Use \<Text /\> component from iTwinUI-react library.
16
16
  */
17
- export declare function StyledText(props: StyledTextProps): JSX.Element;
17
+ export declare function StyledText(props: StyledTextProps): React.JSX.Element;
18
18
  //# sourceMappingURL=StyledText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StyledText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/StyledText.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,0BAA0B;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAYhD"}
1
+ {"version":3,"file":"StyledText.d.ts","sourceRoot":"","sources":["../../../../src/core-react/text/StyledText.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,0BAA0B;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,qBAYhD"}
@@ -15,6 +15,6 @@ export interface TreeBranchProps extends CommonProps {
15
15
  * @public
16
16
  */
17
17
  export declare class TreeBranch extends React.PureComponent<TreeBranchProps> {
18
- render(): JSX.Element;
18
+ render(): React.JSX.Element;
19
19
  }
20
20
  //# sourceMappingURL=Branch.d.ts.map
@@ -16,6 +16,6 @@ export interface ExpansionToggleProps extends CommonProps {
16
16
  * @public
17
17
  */
18
18
  export declare class ExpansionToggle extends React.PureComponent<ExpansionToggleProps> {
19
- render(): JSX.Element;
19
+ render(): React.JSX.Element;
20
20
  }
21
21
  //# sourceMappingURL=ExpansionToggle.d.ts.map
@@ -70,7 +70,7 @@ export interface TreeNodeProps extends CommonProps {
70
70
  */
71
71
  export declare class TreeNode extends React.Component<TreeNodeProps> {
72
72
  constructor(props: TreeNodeProps);
73
- render(): JSX.Element;
73
+ render(): React.JSX.Element;
74
74
  private createSubComponentTestId;
75
75
  private _onCheckboxChange;
76
76
  private _onCheckboxClick;
@@ -18,6 +18,6 @@ export interface TreeNodePlaceholderProps extends CommonProps {
18
18
  * @public
19
19
  */
20
20
  export declare class TreeNodePlaceholder extends React.PureComponent<TreeNodePlaceholderProps> {
21
- render(): JSX.Element;
21
+ render(): React.JSX.Element;
22
22
  }
23
23
  //# sourceMappingURL=Placeholder.d.ts.map
@@ -24,6 +24,6 @@ export declare class Tree extends React.PureComponent<TreeProps> {
24
24
  scrollToElement(element: Element): void;
25
25
  getElementsByClassName(className: string): Element[];
26
26
  setFocusByClassName(selector: string): boolean;
27
- render(): JSX.Element;
27
+ render(): React.JSX.Element;
28
28
  }
29
29
  //# sourceMappingURL=Tree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IconWebComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/IconWebComponent.ts"],"names":[],"mappings":"AAMA;;GAEG;AA8FH;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;YACjC,iBAAiB;YAKjB,OAAO;CAetB"}
1
+ {"version":3,"file":"IconWebComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/IconWebComponent.ts"],"names":[],"mappings":"AAMA;;GAEG;AAiGH;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;YACjC,iBAAiB;YAKjB,OAAO;CAetB"}
@@ -49,6 +49,7 @@ function parseSvgFromDataUri(src, element) {
49
49
  const parsedSvg = new window.DOMParser().parseFromString(sanitizedSvg, "text/xml");
50
50
  const errorNode = parsedSvg.querySelector("parsererror");
51
51
  if (errorNode || "svg" !== parsedSvg.documentElement.nodeName.toLowerCase()) {
52
+ // eslint-disable-next-line deprecation/deprecation
52
53
  throw new UiError(UiCore.loggerCategory(element), "Unable to load icon.");
53
54
  }
54
55
  return parsedSvg.documentElement;
@@ -64,10 +65,12 @@ async function fetchSvg(src, element) {
64
65
  Logger.logError(UiCore.loggerCategory(element), "Unable to load icon.");
65
66
  });
66
67
  if (!response || !response.ok) {
68
+ // eslint-disable-next-line deprecation/deprecation
67
69
  throw new UiError(UiCore.loggerCategory(element), "Unable to load icon.");
68
70
  }
69
71
  const str = await response.text();
70
72
  if (str === undefined) {
73
+ // eslint-disable-next-line deprecation/deprecation
71
74
  throw new UiError(UiCore.loggerCategory(element), "Unable to load icon.");
72
75
  }
73
76
  const data = new window.DOMParser().parseFromString(str, "text/xml");
@@ -1 +1 @@
1
- {"version":3,"file":"IconWebComponent.js","sourceRoot":"","sources":["../../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,CAAC,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACrE,OAAO,IAAI,CAAC,eAAe,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,MAAM,CAAC,GAAW,EAAE,OAAY;IAC7C,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KAC1C;IACD,OAAO,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IACvC,KAAK,CAAC,iBAAiB;QAC7B,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;IAEO,KAAK,CAAC,OAAO;QACnB,qDAAqD;QACrD,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM;YAAE,OAAO;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAC3C,IAAI,CAAC,GAAG;YAAE,OAAO;QAEjB,MAAM,GAAG,GAAG,MAAM,oBAAoB,CACpC,GAAG,EACH,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,EAC7B,KAAK,CACN,CAAC;QACF,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YAClC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;SAClC;IACH,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// istanbul ignore file\n// IconWebComponent requires in-browser testing\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport { UiError } from \"@itwin/appui-abstract\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { UiCore } from \"../UiCore\";\nimport DOMPurify, * as DOMPurifyNS from \"dompurify\";\nimport { reuseOrCreatePromise } from \"./reuseOrCreatePromise\";\n\n/**\n * \"getSvg\" list\n * (if multiple icon require the same thing,\n * only do the fetch once, and have all icon use the same result)\n */\nconst cache = new Map<string, Promise<any>>();\n\n/**\n * Parse 'data:' uri to retrieve the Svg component within it.\n * @param src data:image/svg+xml;base64 or data:image/svg+xml\n * @param element Element for logging purpose.\n * @returns HTMLElement (svg)\n */\nfunction parseSvgFromDataUri(src: string, element: any) {\n const dataUriParts = src.split(\",\");\n\n if (\n (dataUriParts.length !== 2 &&\n \"data:image/svg+xml;base64\" === dataUriParts[0]) ||\n (\"data:image/svg+xml;base64\" !== dataUriParts[0] &&\n \"data:image/svg+xml\" !== dataUriParts[0])\n ) {\n Logger.logError(UiCore.loggerCategory(element), \"Unable to load icon.\");\n return;\n }\n\n let rawSvg = \"\";\n if (\"data:image/svg+xml;base64\" === dataUriParts[0]) {\n rawSvg = window.atob(dataUriParts[1]);\n } else {\n // `,` is valid character in data when not in base64, rebuild the data correctly\n rawSvg = decodeURIComponent(dataUriParts.slice(1).join(\",\"));\n }\n\n // the esm build of dompurify has a default import but the cjs build does not\n // if there is a default export, use it (likely esm), otherwise use the namespace\n // istanbul ignore next\n const sanitizer = DOMPurify ?? DOMPurifyNS;\n const sanitizedSvg = sanitizer.sanitize(rawSvg);\n\n const parsedSvg = new window.DOMParser().parseFromString(\n sanitizedSvg,\n \"text/xml\"\n );\n const errorNode = parsedSvg.querySelector(\"parsererror\");\n if (errorNode || \"svg\" !== parsedSvg.documentElement.nodeName.toLowerCase()) {\n throw new UiError(UiCore.loggerCategory(element), \"Unable to load icon.\");\n }\n\n return parsedSvg.documentElement;\n}\n\n/**\n * Fetch the src from the network and return the SVG element.\n * @param src URL representing a .svg file\n * @param element Element for logging purpose\n * @returns HTMLElement (svg)\n */\nasync function fetchSvg(src: string, element: any) {\n const response = await fetch(src).catch((_error) => {\n Logger.logError(UiCore.loggerCategory(element), \"Unable to load icon.\");\n });\n if (!response || !response.ok) {\n throw new UiError(UiCore.loggerCategory(element), \"Unable to load icon.\");\n }\n const str = await response.text();\n if (str === undefined) {\n throw new UiError(UiCore.loggerCategory(element), \"Unable to load icon.\");\n }\n const data = new window.DOMParser().parseFromString(str, \"text/xml\");\n return data.documentElement;\n}\n\n/**\n * Get the svg (fetch and parse for url, or decode and parse for data: url)\n * @param src URL of the content to download/parse\n * @param element Element for logging purpose.\n * @returns HTMLElement (svg)\n */\nasync function getSvg(src: string, element: any) {\n if (src.startsWith(\"data:\")) {\n return parseSvgFromDataUri(src, element);\n }\n return fetchSvg(src, element);\n}\n\n/**\n * IconWebComponent loads icon from an svg path\n */\nexport class IconWebComponent extends HTMLElement {\n private async connectedCallback() {\n await this.loadSvg();\n this.dispatchEvent(new CustomEvent(\"load\"));\n }\n\n private async loadSvg() {\n // if svg was already appended don't request it again\n if (this.childNodes.length) return;\n const src = this.getAttribute(\"src\") || \"\";\n if (!src) return;\n\n const svg = await reuseOrCreatePromise(\n src,\n async () => getSvg(src, this),\n cache\n );\n if (svg && !this.childNodes.length) {\n this.append(svg.cloneNode(true));\n }\n }\n}\n"]}
1
+ {"version":3,"file":"IconWebComponent.js","sourceRoot":"","sources":["../../../../src/core-react/utils/IconWebComponent.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,uBAAuB;AACvB,+CAA+C;AAC/C;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,SAAS,EAAE,KAAK,WAAW,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAw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AAG,EAAE,OAAO,CAAC,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IACvC,KAAK,CAAC,iBAAiB;QAC7B,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;IAEO,KAAK,CAAC,OAAO;QACnB,qDAAqD;QACrD,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM;YAAE,OAAO;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAC3C,IAAI,CAAC,GAAG;YAAE,OAAO;QAEjB,MAAM,GAAG,GAAG,MAAM,oBAAoB,CACpC,GAAG,EACH,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,EAC7B,KAAK,CACN,CAAC;QACF,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YAClC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;SAClC;IACH,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// istanbul ignore file\n// IconWebComponent requires in-browser testing\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport { UiError } from \"@itwin/appui-abstract\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { UiCore } from \"../UiCore\";\nimport DOMPurify, * as DOMPurifyNS from \"dompurify\";\nimport { reuseOrCreatePromise } from \"./reuseOrCreatePromise\";\n\n/**\n * \"getSvg\" list\n * (if multiple icon require the same thing,\n * only do the fetch once, and have all icon use the same result)\n */\nconst cache = new Map<string, Promise<any>>();\n\n/**\n * Parse 'data:' uri to retrieve the Svg component within it.\n * @param src data:image/svg+xml;base64 or data:image/svg+xml\n * @param element Element for logging purpose.\n * @returns HTMLElement (svg)\n */\nfunction parseSvgFromDataUri(src: string, element: any) {\n const dataUriParts = src.split(\",\");\n\n if (\n (dataUriParts.length !== 2 &&\n \"data:image/svg+xml;base64\" === dataUriParts[0]) ||\n (\"data:image/svg+xml;base64\" !== dataUriParts[0] &&\n \"data:image/svg+xml\" !== dataUriParts[0])\n ) {\n Logger.logError(UiCore.loggerCategory(element), \"Unable to load icon.\");\n return;\n }\n\n let rawSvg = \"\";\n if (\"data:image/svg+xml;base64\" === dataUriParts[0]) {\n rawSvg = window.atob(dataUriParts[1]);\n } else {\n // `,` is valid character in data when not in base64, rebuild the data correctly\n rawSvg = decodeURIComponent(dataUriParts.slice(1).join(\",\"));\n }\n\n // the esm build of dompurify has a default import but the cjs build does not\n // if there is a default export, use it (likely esm), otherwise use the namespace\n // istanbul ignore next\n const sanitizer = DOMPurify ?? DOMPurifyNS;\n const sanitizedSvg = sanitizer.sanitize(rawSvg);\n\n const parsedSvg = new window.DOMParser().parseFromString(\n sanitizedSvg,\n \"text/xml\"\n );\n const errorNode = parsedSvg.querySelector(\"parsererror\");\n if (errorNode || \"svg\" !== parsedSvg.documentElement.nodeName.toLowerCase()) {\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(UiCore.loggerCategory(element), \"Unable to load icon.\");\n }\n\n return parsedSvg.documentElement;\n}\n\n/**\n * Fetch the src from the network and return the SVG element.\n * @param src URL representing a .svg file\n * @param element Element for logging purpose\n * @returns HTMLElement (svg)\n */\nasync function fetchSvg(src: string, element: any) {\n const response = await fetch(src).catch((_error) => {\n Logger.logError(UiCore.loggerCategory(element), \"Unable to load icon.\");\n });\n if (!response || !response.ok) {\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(UiCore.loggerCategory(element), \"Unable to load icon.\");\n }\n const str = await response.text();\n if (str === undefined) {\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(UiCore.loggerCategory(element), \"Unable to load icon.\");\n }\n const data = new window.DOMParser().parseFromString(str, \"text/xml\");\n return data.documentElement;\n}\n\n/**\n * Get the svg (fetch and parse for url, or decode and parse for data: url)\n * @param src URL of the content to download/parse\n * @param element Element for logging purpose.\n * @returns HTMLElement (svg)\n */\nasync function getSvg(src: string, element: any) {\n if (src.startsWith(\"data:\")) {\n return parseSvgFromDataUri(src, element);\n }\n return fetchSvg(src, element);\n}\n\n/**\n * IconWebComponent loads icon from an svg path\n */\nexport class IconWebComponent extends HTMLElement {\n private async connectedCallback() {\n await this.loadSvg();\n this.dispatchEvent(new CustomEvent(\"load\"));\n }\n\n private async loadSvg() {\n // if svg was already appended don't request it again\n if (this.childNodes.length) return;\n const src = this.getAttribute(\"src\") || \"\";\n if (!src) return;\n\n const svg = await reuseOrCreatePromise(\n src,\n async () => getSvg(src, this),\n cache\n );\n if (svg && !this.childNodes.length) {\n this.append(svg.cloneNode(true));\n }\n }\n}\n"]}
@@ -6,6 +6,8 @@ import type { IDisposable } from "@itwin/core-bentley";
6
6
  * A custom hook which creates a disposable object and manages its disposal on unmount
7
7
  * or factory method change.
8
8
  * @public
9
+ * @deprecated in 4.9.0. This hook is not compatible with React 18 Strict mode. Use [[useOptionalDisposable]] or `useState` + `useEffect` for
10
+ * creating and disposing disposable resources.
9
11
  */
10
12
  export declare function useDisposable<TDisposable extends IDisposable>(createDisposable: () => TDisposable): TDisposable;
11
13
  /**
@@ -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,CAmBzB"}
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;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,WAAW,SAAS,WAAW,EAC3D,gBAAgB,EAAE,MAAM,WAAW,GAClC,WAAW,CAoBb;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,SAAS,WAAW,EACnE,gBAAgB,EAAE,MAAM,WAAW,GAAG,SAAS,GAC9C,WAAW,GAAG,SAAS,CAYzB"}
@@ -10,9 +10,26 @@ import { useEffect, useRef, useState } from "react";
10
10
  * A custom hook which creates a disposable object and manages its disposal on unmount
11
11
  * or factory method change.
12
12
  * @public
13
+ * @deprecated in 4.9.0. This hook is not compatible with React 18 Strict mode. Use [[useOptionalDisposable]] or `useState` + `useEffect` for
14
+ * creating and disposing disposable resources.
13
15
  */
14
16
  export function useDisposable(createDisposable) {
15
- return useOptionalDisposable(createDisposable);
17
+ const [value, setValue] = useState(() => createDisposable());
18
+ // need to capture initial disposable created during render loop in order to dispose later
19
+ const prevValue = useRef(value);
20
+ const useInitialValue = useRef(true);
21
+ useEffect(() => {
22
+ // do not create new disposable on initial render. It was created during render loop.
23
+ if (!useInitialValue.current) {
24
+ prevValue.current = createDisposable();
25
+ setValue(prevValue.current);
26
+ }
27
+ useInitialValue.current = false;
28
+ return () => {
29
+ prevValue.current.dispose();
30
+ };
31
+ }, [createDisposable]);
32
+ return value;
16
33
  }
17
34
  /**
18
35
  * A custom hook which calls the factory method to create a disposable object
@@ -21,18 +38,12 @@ export function useDisposable(createDisposable) {
21
38
  * @public
22
39
  */
23
40
  export function useOptionalDisposable(createDisposable) {
24
- const [value, setValue] = useState(() => createDisposable());
25
- const initialValue = useRef(true);
41
+ const [value, setValue] = useState();
26
42
  useEffect(() => {
27
- if (!initialValue.current) {
28
- setValue(createDisposable());
29
- }
30
- initialValue.current = false;
43
+ const disposable = createDisposable();
44
+ setValue(disposable);
31
45
  return () => {
32
- setValue((prev) => {
33
- prev && prev.dispose();
34
- return prev;
35
- });
46
+ disposable && disposable.dispose();
36
47
  };
37
48
  }, [createDisposable]);
38
49
  return value;
@@ -1 +1 @@
1
- {"version":3,"file":"useDisposable.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useDisposable.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGpD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,gBAAmC;IAEnC,OAAO,qBAAqB,CAAC,gBAAgB,CAAE,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,gBAA+C;IAE/C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAElC,SAAS,CAAC,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","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"]}
1
+ {"version":3,"file":"useDisposable.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useDisposable.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGpD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,gBAAmC;IAEnC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC7D,0FAA0F;IAC1F,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAErC,SAAS,CAAC,GAAG,EAAE;QACb,qFAAqF;QACrF,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE;YAC5B,SAAS,CAAC,OAAO,GAAG,gBAAgB,EAAE,CAAC;YACvC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;SAC7B;QAED,eAAe,CAAC,OAAO,GAAG,KAAK,CAAC;QAChC,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,gBAA+C;IAE/C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAA2B,CAAC;IAE9D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;QACtC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACrB,OAAO,GAAG,EAAE;YACV,UAAU,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACrC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module 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 * @deprecated in 4.9.0. This hook is not compatible with React 18 Strict mode. Use [[useOptionalDisposable]] or `useState` + `useEffect` for\n * creating and disposing disposable resources.\n */\nexport function useDisposable<TDisposable extends IDisposable>(\n createDisposable: () => TDisposable\n): TDisposable {\n const [value, setValue] = useState(() => createDisposable());\n // need to capture initial disposable created during render loop in order to dispose later\n const prevValue = useRef(value);\n const useInitialValue = useRef(true);\n\n useEffect(() => {\n // do not create new disposable on initial render. It was created during render loop.\n if (!useInitialValue.current) {\n prevValue.current = createDisposable();\n setValue(prevValue.current);\n }\n\n useInitialValue.current = false;\n return () => {\n prevValue.current.dispose();\n };\n }, [createDisposable]);\n\n return value;\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<TDisposable | undefined>();\n\n useEffect(() => {\n const disposable = createDisposable();\n setValue(disposable);\n return () => {\n disposable && disposable.dispose();\n };\n }, [createDisposable]);\n\n return value;\n}\n"]}
@@ -36,5 +36,5 @@ export declare function ElementResizeObserver({ watchedElement, render, }: {
36
36
  export declare function ResizableContainerObserver({ onResize, children, }: {
37
37
  onResize: (width: number, height: number) => void;
38
38
  children?: React.ReactNode;
39
- }): JSX.Element;
39
+ }): React.JSX.Element;
40
40
  //# sourceMappingURL=useResizeObserver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useResizeObserver.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useResizeObserver.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,EACjD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,sCAuHnD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,WAAW,GAAG,IAAI,EAC7B,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,0BA+GrD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,cAAc,EACd,MAAM,GACP,EAAE;IACD,cAAc,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,YAAY,CAAC;CACxD,sEAGA;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,eA2CA"}
1
+ {"version":3,"file":"useResizeObserver.d.ts","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useResizeObserver.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,EACjD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,sCAuHnD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,WAAW,GAAG,IAAI,EAC7B,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,0BA+GrD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,cAAc,EACd,MAAM,GACP,EAAE;IACD,cAAc,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,YAAY,CAAC;CACxD,sEAGA;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,qBA2CA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-react",
3
- "version": "4.8.3",
3
+ "version": "4.9.0",
4
4
  "description": "iTwin.js UI core components",
5
5
  "main": "lib/cjs/core-react.js",
6
6
  "module": "lib/esm/core-react.js",
@@ -53,7 +53,7 @@
53
53
  "@types/react": "^17.0.37",
54
54
  "@types/react-autosuggest": "10.1.2",
55
55
  "@types/react-dom": "^17.0.0",
56
- "@types/sinon": "^10.0.15",
56
+ "@types/sinon": "^17.0.3",
57
57
  "@types/sinon-chai": "^3.2.0",
58
58
  "chai": "^4.3.10",
59
59
  "chai-as-promised": "^7",
@@ -70,7 +70,7 @@
70
70
  "react-dom": "^17.0.0",
71
71
  "react-test-renderer": "^17.0.0",
72
72
  "rimraf": "^3.0.2",
73
- "sinon": "^15.2.0",
73
+ "sinon": "^17.0.1",
74
74
  "sinon-chai": "^3.2.0",
75
75
  "ts-node": "^10.8.2",
76
76
  "typemoq": "^2.1.0",
@@ -126,6 +126,5 @@
126
126
  "docs": "npm run -s docs:reference && npm run -s docs:changelog",
127
127
  "docs:changelog": "cpx ./CHANGELOG.md ../../generated-docs/reference/core-react",
128
128
  "docs:reference": "betools docs --includes=../../generated-docs/extract --json=../../generated-docs/reference/core-react/file.json --excludeGlob=**/declarations.d.ts --tsIndexFile=./core-react.ts --onlyJson"
129
- },
130
- "readme": "# @itwin/core-react\n\nCopyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.\n\n## Description\n\nThe **@itwin/core-react** package contains general purpose React components, such as Dialog, MessageBox, SearchBox, RadialMenu.\n\n## Documentation\n\nSee the [iTwin.js](https://www.itwinjs.org/learning/ui/core/) documentation for more information.\n"
129
+ }
131
130
  }