@itwin/components-react 3.0.0-dev.72 → 3.0.0-dev.78

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 (163) hide show
  1. package/lib/components-react/UiComponents.d.ts +10 -10
  2. package/lib/components-react/UiComponents.d.ts.map +1 -1
  3. package/lib/components-react/UiComponents.js +18 -18
  4. package/lib/components-react/UiComponents.js.map +1 -1
  5. package/lib/components-react/common/HighlightedText.d.ts +2 -2
  6. package/lib/components-react/common/HighlightedText.js +1 -1
  7. package/lib/components-react/common/HighlightedText.js.map +1 -1
  8. package/lib/components-react/common/HighlightingComponentProps.d.ts +2 -2
  9. package/lib/components-react/common/HighlightingComponentProps.js.map +1 -1
  10. package/lib/components-react/common/UseAsyncValue.d.ts +1 -1
  11. package/lib/components-react/common/UseAsyncValue.js +1 -1
  12. package/lib/components-react/common/UseAsyncValue.js.map +1 -1
  13. package/lib/components-react/datepicker/DatePicker.js +28 -28
  14. package/lib/components-react/datepicker/DatePicker.js.map +1 -1
  15. package/lib/components-react/editors/BooleanEditor.d.ts +2 -2
  16. package/lib/components-react/editors/BooleanEditor.js +2 -2
  17. package/lib/components-react/editors/BooleanEditor.js.map +1 -1
  18. package/lib/components-react/editors/EnumButtonGroupEditor.d.ts +2 -2
  19. package/lib/components-react/editors/EnumButtonGroupEditor.js +2 -2
  20. package/lib/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  21. package/lib/components-react/editors/EnumEditor.d.ts +2 -2
  22. package/lib/components-react/editors/EnumEditor.js +2 -2
  23. package/lib/components-react/editors/EnumEditor.js.map +1 -1
  24. package/lib/components-react/editors/ImageCheckBoxEditor.d.ts +2 -2
  25. package/lib/components-react/editors/ImageCheckBoxEditor.js +2 -2
  26. package/lib/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  27. package/lib/components-react/editors/NumericInputEditor.d.ts +2 -2
  28. package/lib/components-react/editors/NumericInputEditor.js +2 -2
  29. package/lib/components-react/editors/NumericInputEditor.js.map +1 -1
  30. package/lib/components-react/editors/PropertyEditorManager.d.ts +7 -7
  31. package/lib/components-react/editors/PropertyEditorManager.js +4 -4
  32. package/lib/components-react/editors/PropertyEditorManager.js.map +1 -1
  33. package/lib/components-react/editors/SliderEditor.d.ts +2 -2
  34. package/lib/components-react/editors/SliderEditor.js +2 -2
  35. package/lib/components-react/editors/SliderEditor.js.map +1 -1
  36. package/lib/components-react/editors/TextEditor.d.ts +1 -1
  37. package/lib/components-react/editors/TextEditor.js +1 -1
  38. package/lib/components-react/editors/TextEditor.js.map +1 -1
  39. package/lib/components-react/editors/TextareaEditor.d.ts +2 -2
  40. package/lib/components-react/editors/TextareaEditor.js +2 -2
  41. package/lib/components-react/editors/TextareaEditor.js.map +1 -1
  42. package/lib/components-react/editors/ThemedEnumEditor.d.ts +3 -3
  43. package/lib/components-react/editors/ThemedEnumEditor.d.ts.map +1 -1
  44. package/lib/components-react/editors/ThemedEnumEditor.js +3 -2
  45. package/lib/components-react/editors/ThemedEnumEditor.js.map +1 -1
  46. package/lib/components-react/editors/ToggleEditor.d.ts +2 -2
  47. package/lib/components-react/editors/ToggleEditor.js +2 -2
  48. package/lib/components-react/editors/ToggleEditor.js.map +1 -1
  49. package/lib/components-react/favorite/FavoritePropertiesRenderer.d.ts +1 -1
  50. package/lib/components-react/favorite/FavoritePropertiesRenderer.js +1 -1
  51. package/lib/components-react/favorite/FavoritePropertiesRenderer.js.map +1 -1
  52. package/lib/components-react/filtering/FilteringInput.d.ts +1 -2
  53. package/lib/components-react/filtering/FilteringInput.d.ts.map +1 -1
  54. package/lib/components-react/filtering/FilteringInput.js +1 -1
  55. package/lib/components-react/filtering/FilteringInput.js.map +1 -1
  56. package/lib/components-react/inputs/ParsedInput.d.ts +2 -2
  57. package/lib/components-react/inputs/ParsedInput.js +1 -1
  58. package/lib/components-react/inputs/ParsedInput.js.map +1 -1
  59. package/lib/components-react/properties/renderers/ActionButtonList.d.ts +2 -2
  60. package/lib/components-react/properties/renderers/ActionButtonList.js +1 -1
  61. package/lib/components-react/properties/renderers/ActionButtonList.js.map +1 -1
  62. package/lib/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +0 -1
  63. package/lib/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts.map +1 -1
  64. package/lib/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  65. package/lib/components-react/properties/renderers/PropertyRenderer.d.ts +5 -10
  66. package/lib/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  67. package/lib/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  68. package/lib/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts +1 -3
  69. package/lib/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts.map +1 -1
  70. package/lib/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  71. package/lib/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts +1 -1
  72. package/lib/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +1 -1
  73. package/lib/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  74. package/lib/components-react/propertygrid/PropertyCategoryRendererManager.d.ts +1 -1
  75. package/lib/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  76. package/lib/components-react/propertygrid/PropertyDataProvider.d.ts +1 -3
  77. package/lib/components-react/propertygrid/PropertyDataProvider.d.ts.map +1 -1
  78. package/lib/components-react/propertygrid/PropertyDataProvider.js.map +1 -1
  79. package/lib/components-react/propertygrid/component/PropertyCategoryBlock.d.ts +1 -3
  80. package/lib/components-react/propertygrid/component/PropertyCategoryBlock.d.ts.map +1 -1
  81. package/lib/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  82. package/lib/components-react/propertygrid/component/PropertyGridCommons.d.ts +0 -2
  83. package/lib/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
  84. package/lib/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  85. package/lib/components-react/propertygrid/dataproviders/FilteringDataProvider.d.ts +13 -4
  86. package/lib/components-react/propertygrid/dataproviders/FilteringDataProvider.d.ts.map +1 -1
  87. package/lib/components-react/propertygrid/dataproviders/FilteringDataProvider.js +9 -2
  88. package/lib/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  89. package/lib/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.d.ts +2 -2
  90. package/lib/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  91. package/lib/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  92. package/lib/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.d.ts +1 -1
  93. package/lib/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -1
  94. package/lib/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  95. package/lib/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.d.ts +1 -1
  96. package/lib/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js +1 -1
  97. package/lib/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js.map +1 -1
  98. package/lib/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.d.ts +1 -1
  99. package/lib/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.js +1 -1
  100. package/lib/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.js.map +1 -1
  101. package/lib/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.d.ts +17 -14
  102. package/lib/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.d.ts.map +1 -1
  103. package/lib/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js +10 -8
  104. package/lib/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js.map +1 -1
  105. package/lib/components-react/propertygrid/internal/PropertyGridHooks.d.ts +4 -4
  106. package/lib/components-react/propertygrid/internal/PropertyGridHooks.js +5 -5
  107. package/lib/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
  108. package/lib/components-react/selectable-content/SelectableContent.d.ts +5 -5
  109. package/lib/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
  110. package/lib/components-react/selectable-content/SelectableContent.js +3 -2
  111. package/lib/components-react/selectable-content/SelectableContent.js.map +1 -1
  112. package/lib/components-react/table/SimpleTableDataProvider.d.ts +2 -2
  113. package/lib/components-react/table/SimpleTableDataProvider.js +2 -2
  114. package/lib/components-react/table/SimpleTableDataProvider.js.map +1 -1
  115. package/lib/components-react/table/columnfiltering/data-grid-addons/AutoCompleteFilter.d.ts.map +1 -1
  116. package/lib/components-react/table/columnfiltering/data-grid-addons/AutoCompleteFilter.js +1 -0
  117. package/lib/components-react/table/columnfiltering/data-grid-addons/AutoCompleteFilter.js.map +1 -1
  118. package/lib/components-react/table/component/Table.d.ts +4 -7
  119. package/lib/components-react/table/component/Table.d.ts.map +1 -1
  120. package/lib/components-react/table/component/Table.js.map +1 -1
  121. package/lib/components-react/toolbar/Item.d.ts +2 -2
  122. package/lib/components-react/toolbar/Item.js +1 -1
  123. package/lib/components-react/toolbar/Item.js.map +1 -1
  124. package/lib/components-react/toolbar/PopupItem.d.ts +2 -2
  125. package/lib/components-react/toolbar/PopupItem.js +1 -1
  126. package/lib/components-react/toolbar/PopupItem.js.map +1 -1
  127. package/lib/components-react/toolbar/PopupItemWithDrag.d.ts +2 -2
  128. package/lib/components-react/toolbar/PopupItemWithDrag.js +1 -1
  129. package/lib/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  130. package/lib/components-react/toolbar/Toolbar.d.ts +2 -2
  131. package/lib/components-react/toolbar/Toolbar.js +1 -1
  132. package/lib/components-react/toolbar/Toolbar.js.map +1 -1
  133. package/lib/components-react/toolbar/ToolbarWithOverflow.d.ts +6 -6
  134. package/lib/components-react/toolbar/ToolbarWithOverflow.js +3 -3
  135. package/lib/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  136. package/lib/components-react/toolbar/utilities/Direction.d.ts +1 -1
  137. package/lib/components-react/toolbar/utilities/Direction.js +1 -1
  138. package/lib/components-react/toolbar/utilities/Direction.js.map +1 -1
  139. package/lib/components-react/tree/HighlightingEngine.d.ts +1 -1
  140. package/lib/components-react/tree/HighlightingEngine.js +1 -1
  141. package/lib/components-react/tree/HighlightingEngine.js.map +1 -1
  142. package/lib/components-react/tree/TreeDataProvider.d.ts +1 -1
  143. package/lib/components-react/tree/TreeDataProvider.js.map +1 -1
  144. package/lib/components-react/tree/controlled/TreeHooks.d.ts +3 -4
  145. package/lib/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
  146. package/lib/components-react/tree/controlled/TreeHooks.js +3 -4
  147. package/lib/components-react/tree/controlled/TreeHooks.js.map +1 -1
  148. package/lib/components-react/tree/controlled/component/ControlledTree.d.ts +1 -1
  149. package/lib/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  150. package/lib/components-react/tree/controlled/component/TreeNodeEditor.d.ts +9 -6
  151. package/lib/components-react/tree/controlled/component/TreeNodeEditor.d.ts.map +1 -1
  152. package/lib/components-react/tree/controlled/component/TreeNodeEditor.js +3 -2
  153. package/lib/components-react/tree/controlled/component/TreeNodeEditor.js.map +1 -1
  154. package/lib/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +12 -16
  155. package/lib/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
  156. package/lib/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -1
  157. package/lib/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
  158. package/lib/components-react/tree/controlled/component/TreeRenderer.d.ts +5 -54
  159. package/lib/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
  160. package/lib/components-react/tree/controlled/component/TreeRenderer.js +13 -28
  161. package/lib/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
  162. package/lib/public/locales/en/UiComponents.json +1 -8
  163. package/package.json +16 -15
@@ -1,30 +1,30 @@
1
1
  /** @packageDocumentation
2
2
  * @module Common
3
3
  */
4
- import { I18N } from "@itwin/core-i18n";
4
+ import { Localization } from "@itwin/core-common";
5
5
  /**
6
- * Manages the I18N service for the components-react package.
6
+ * Manages the localization service for the components-react package.
7
7
  * @public
8
8
  */
9
9
  export declare class UiComponents {
10
10
  private static _initialized;
11
- private static _i18n?;
11
+ private static _localization?;
12
12
  /**
13
- * Registers the I18N service namespace for UiComponents. Also initializes UiCore.
14
- * @param i18n The internationalization service created by the application.
13
+ * Registers the localization service namespace for UiComponents. Also initializes UiCore.
14
+ * @param localization The internationalization service created by the application.
15
15
  */
16
- static initialize(i18n: I18N): Promise<void>;
17
- /** Unregisters the UiComponents I18N namespace */
16
+ static initialize(localization: Localization): Promise<void>;
17
+ /** Unregisters the UiComponents localization namespace */
18
18
  static terminate(): void;
19
19
  /** Determines if UiComponents has been initialized */
20
20
  static get initialized(): boolean;
21
21
  /** The internationalization service created by the application. */
22
- static get i18n(): I18N;
22
+ static get localization(): Localization;
23
23
  /** The internationalization service namespace. */
24
- static get i18nNamespace(): string;
24
+ static get localizationNamespace(): string;
25
25
  /** @internal */
26
26
  static get packageName(): string;
27
- /** Calls i18n.translateWithNamespace with the "UiComponents" namespace. Do NOT include the namespace in the key.
27
+ /** Calls localization.getLocalizedStringWithNamespace with the "UiComponents" namespace. Do NOT include the namespace in the key.
28
28
  * @internal
29
29
  */
30
30
  static translate(key: string | string[]): string;
@@ -1 +1 @@
1
- {"version":3,"file":"UiComponents.d.ts","sourceRoot":"","sources":["../../src/components-react/UiComponents.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIxC;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAS;IACpC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAO;IAE5B;;;OAGG;WACiB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAczD,kDAAkD;WACpC,SAAS;IASvB,sDAAsD;IACtD,WAAkB,WAAW,IAAI,OAAO,CAAsC;IAE9E,mEAAmE;IACnE,WAAkB,IAAI,IAAI,IAAI,CAI7B;IAED,kDAAkD;IAClD,WAAkB,aAAa,IAAI,MAAM,CAExC;IAED,gBAAgB;IAChB,WAAkB,WAAW,IAAI,MAAM,CAEtC;IAED;;OAEG;WACW,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM;IAQvD,gBAAgB;WACF,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM;CAM/C"}
1
+ {"version":3,"file":"UiComponents.d.ts","sourceRoot":"","sources":["../../src/components-react/UiComponents.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD;;;GAGG;AACH,qBAAa,YAAY;IACvB,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;IAczE,0DAA0D;WAC5C,SAAS;IASvB,sDAAsD;IACtD,WAAkB,WAAW,IAAI,OAAO,CAAsC;IAE9E,mEAAmE;IACnE,WAAkB,YAAY,IAAI,YAAY,CAI7C;IAED,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;IAED,gBAAgB;IAChB,WAAkB,WAAW,IAAI,MAAM,CAEtC;IAED;;OAEG;WACW,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM;IAQvD,gBAAgB;WACF,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM;CAM/C"}
@@ -13,50 +13,50 @@ const core_bentley_1 = require("@itwin/core-bentley");
13
13
  const appui_abstract_1 = require("@itwin/appui-abstract");
14
14
  const core_react_1 = require("@itwin/core-react");
15
15
  /**
16
- * Manages the I18N service for the components-react package.
16
+ * Manages the localization service for the components-react package.
17
17
  * @public
18
18
  */
19
19
  class UiComponents {
20
20
  /**
21
- * Registers the I18N service namespace for UiComponents. Also initializes UiCore.
22
- * @param i18n The internationalization service created by the application.
21
+ * Registers the localization service namespace for UiComponents. Also initializes UiCore.
22
+ * @param localization The internationalization service created by the application.
23
23
  */
24
- static async initialize(i18n) {
24
+ static async initialize(localization) {
25
25
  if (UiComponents._initialized) {
26
26
  core_bentley_1.Logger.logInfo(UiComponents.loggerCategory(UiComponents), `UiComponents.initialize already called`);
27
27
  return;
28
28
  }
29
29
  (0, immer_1.enablePatches)();
30
- UiComponents._i18n = i18n;
31
- await UiComponents._i18n.registerNamespace(UiComponents.i18nNamespace).readFinished;
32
- await core_react_1.UiCore.initialize(UiComponents._i18n);
30
+ UiComponents._localization = localization;
31
+ await UiComponents._localization.registerNamespace(UiComponents.localizationNamespace);
32
+ await core_react_1.UiCore.initialize(UiComponents._localization);
33
33
  UiComponents._initialized = true;
34
34
  }
35
- /** Unregisters the UiComponents I18N namespace */
35
+ /** Unregisters the UiComponents localization namespace */
36
36
  static terminate() {
37
- if (UiComponents._i18n)
38
- UiComponents._i18n.unregisterNamespace(UiComponents.i18nNamespace);
39
- UiComponents._i18n = undefined;
37
+ if (UiComponents._localization)
38
+ UiComponents._localization.unregisterNamespace(UiComponents.localizationNamespace);
39
+ UiComponents._localization = undefined;
40
40
  core_react_1.UiCore.terminate();
41
41
  UiComponents._initialized = false;
42
42
  }
43
43
  /** Determines if UiComponents has been initialized */
44
44
  static get initialized() { return UiComponents._initialized; }
45
45
  /** The internationalization service created by the application. */
46
- static get i18n() {
47
- if (!UiComponents._i18n)
48
- throw new appui_abstract_1.UiError(UiComponents.loggerCategory(this), "i18n: UiComponents.initialize has not been called. Unable to return I18N object.");
49
- return UiComponents._i18n;
46
+ static get localization() {
47
+ if (!UiComponents._localization)
48
+ throw new appui_abstract_1.UiError(UiComponents.loggerCategory(this), "_localization: UiComponents.initialize has not been called. Unable to return Localization object.");
49
+ return UiComponents._localization;
50
50
  }
51
51
  /** The internationalization service namespace. */
52
- static get i18nNamespace() {
52
+ static get localizationNamespace() {
53
53
  return "UiComponents";
54
54
  }
55
55
  /** @internal */
56
56
  static get packageName() {
57
57
  return "components-react";
58
58
  }
59
- /** Calls i18n.translateWithNamespace with the "UiComponents" namespace. Do NOT include the namespace in the key.
59
+ /** Calls localization.getLocalizedStringWithNamespace with the "UiComponents" namespace. Do NOT include the namespace in the key.
60
60
  * @internal
61
61
  */
62
62
  static translate(key) {
@@ -64,7 +64,7 @@ class UiComponents {
64
64
  core_bentley_1.Logger.logError(UiComponents.loggerCategory(this), `translate: UiComponents.initialize has not been called. Returning blank string.`);
65
65
  return "";
66
66
  }
67
- return UiComponents.i18n.translateWithNamespace(UiComponents.i18nNamespace, key);
67
+ return UiComponents.localization.getLocalizedStringWithNamespace(UiComponents.localizationNamespace, key);
68
68
  }
69
69
  /** @internal */
70
70
  static loggerCategory(obj) {
@@ -1 +1 @@
1
- {"version":3,"file":"UiComponents.js","sourceRoot":"","sources":["../../src/components-react/UiComponents.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,iCAAsC;AACtC,sDAA6C;AAE7C,0DAA8D;AAC9D,kDAA2C;AAE3C;;;GAGG;AACH,MAAa,YAAY;IAIvB;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAU;QACvC,IAAI,YAAY,CAAC,YAAY,EAAE;YAC7B,qBAAM,CAAC,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,wCAAwC,CAAC,CAAC;YACpG,OAAO;SACR;QAED,IAAA,qBAAa,GAAE,CAAC;QAChB,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC;QAC1B,MAAM,YAAY,CAAC,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,CAAC;IACnF,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,IAAA,6BAAY,EAAC,GAAG,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,YAAY,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC/E,OAAO,QAAQ,CAAC;IAClB,CAAC;;AApEH,oCAsEC;AArEgB,yBAAY,GAAG,KAAK,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 Common\n */\n\nimport { enablePatches } from \"immer\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { I18N } from \"@itwin/core-i18n\";\nimport { getClassName, UiError } from \"@itwin/appui-abstract\";\nimport { UiCore } from \"@itwin/core-react\";\n\n/**\n * Manages the I18N service for the components-react package.\n * @public\n */\nexport class UiComponents {\n private static _initialized = false;\n private static _i18n?: I18N;\n\n /**\n * Registers the I18N service namespace for UiComponents. Also initializes UiCore.\n * @param i18n The internationalization service created by the application.\n */\n public static async initialize(i18n: I18N): Promise<void> {\n if (UiComponents._initialized) {\n Logger.logInfo(UiComponents.loggerCategory(UiComponents), `UiComponents.initialize already called`);\n return;\n }\n\n enablePatches();\n UiComponents._i18n = i18n;\n await UiComponents._i18n.registerNamespace(UiComponents.i18nNamespace).readFinished;\n\n await UiCore.initialize(UiComponents._i18n);\n UiComponents._initialized = true;\n }\n\n /** Unregisters the UiComponents I18N namespace */\n public static terminate() {\n if (UiComponents._i18n)\n UiComponents._i18n.unregisterNamespace(UiComponents.i18nNamespace);\n UiComponents._i18n = undefined;\n\n UiCore.terminate();\n UiComponents._initialized = false;\n }\n\n /** Determines if UiComponents has been initialized */\n public static get initialized(): boolean { return UiComponents._initialized; }\n\n /** The internationalization service created by the application. */\n public static get i18n(): I18N {\n if (!UiComponents._i18n)\n throw new UiError(UiComponents.loggerCategory(this), \"i18n: UiComponents.initialize has not been called. Unable to return I18N object.\");\n return UiComponents._i18n;\n }\n\n /** The internationalization service namespace. */\n public static get i18nNamespace(): string {\n return \"UiComponents\";\n }\n\n /** @internal */\n public static get packageName(): string {\n return \"components-react\";\n }\n\n /** Calls i18n.translateWithNamespace with the \"UiComponents\" namespace. Do NOT include the namespace in the key.\n * @internal\n */\n public static translate(key: string | string[]): string {\n if (!UiComponents.initialized) {\n Logger.logError(UiComponents.loggerCategory(this), `translate: UiComponents.initialize has not been called. Returning blank string.`);\n return \"\";\n }\n return UiComponents.i18n.translateWithNamespace(UiComponents.i18nNamespace, key);\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getClassName(obj);\n const category = UiComponents.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n\n}\n"]}
1
+ {"version":3,"file":"UiComponents.js","sourceRoot":"","sources":["../../src/components-react/UiComponents.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,iCAAsC;AACtC,sDAA6C;AAE7C,0DAA8D;AAC9D,kDAA2C;AAE3C;;;GAGG;AACH,MAAa,YAAY;IAIvB;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,YAA0B;QACvD,IAAI,YAAY,CAAC,YAAY,EAAE;YAC7B,qBAAM,CAAC,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,wCAAwC,CAAC,CAAC;YACpG,OAAO;SACR;QAED,IAAA,qBAAa,GAAE,CAAC;QAChB,YAAY,CAAC,aAAa,GAAG,YAAY,CAAC;QAC1C,MAAM,YAAY,CAAC,aAAa,CAAC,iBAAiB,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;QAEvF,MAAM,mBAAM,CAAC,UAAU,CAAC,YAAY,CAAC,aAAa,CAA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C,CAAC;QACpC,MAAM,QAAQ,GAAG,YAAY,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC/E,OAAO,QAAQ,CAAC;IAClB,CAAC;;AApEH,oCAsEC;AArEgB,yBAAY,GAAG,KAAK,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 Common\n */\n\nimport { enablePatches } from \"immer\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { Localization } from \"@itwin/core-common\";\nimport { getClassName, UiError } from \"@itwin/appui-abstract\";\nimport { UiCore } from \"@itwin/core-react\";\n\n/**\n * Manages the localization service for the components-react package.\n * @public\n */\nexport class UiComponents {\n private static _initialized = false;\n private static _localization?: Localization;\n\n /**\n * Registers the localization service namespace for UiComponents. Also initializes UiCore.\n * @param localization The internationalization service created by the application.\n */\n public static async initialize(localization: Localization): Promise<void> {\n if (UiComponents._initialized) {\n Logger.logInfo(UiComponents.loggerCategory(UiComponents), `UiComponents.initialize already called`);\n return;\n }\n\n enablePatches();\n UiComponents._localization = localization;\n await UiComponents._localization.registerNamespace(UiComponents.localizationNamespace);\n\n await UiCore.initialize(UiComponents._localization);\n UiComponents._initialized = true;\n }\n\n /** Unregisters the UiComponents localization namespace */\n public static terminate() {\n if (UiComponents._localization)\n UiComponents._localization.unregisterNamespace(UiComponents.localizationNamespace);\n UiComponents._localization = undefined;\n\n UiCore.terminate();\n UiComponents._initialized = false;\n }\n\n /** Determines if UiComponents has been initialized */\n public static get initialized(): boolean { return UiComponents._initialized; }\n\n /** The internationalization service created by the application. */\n public static get localization(): Localization {\n if (!UiComponents._localization)\n throw new UiError(UiComponents.loggerCategory(this), \"_localization: UiComponents.initialize has not been called. Unable to return Localization object.\");\n return UiComponents._localization;\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return \"UiComponents\";\n }\n\n /** @internal */\n public static get packageName(): string {\n return \"components-react\";\n }\n\n /** Calls localization.getLocalizedStringWithNamespace with the \"UiComponents\" namespace. Do NOT include the namespace in the key.\n * @internal\n */\n public static translate(key: string | string[]): string {\n if (!UiComponents.initialized) {\n Logger.logError(UiComponents.loggerCategory(this), `translate: UiComponents.initialize has not been called. Returning blank string.`);\n return \"\";\n }\n return UiComponents.localization.getLocalizedStringWithNamespace(UiComponents.localizationNamespace, key);\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getClassName(obj);\n const category = UiComponents.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  /// <reference types="react" />
5
5
  /**
6
6
  * Properties of [[HighlightedText]]
7
- * @beta
7
+ * @public
8
8
  */
9
9
  export interface HighlightedTextProps {
10
10
  searchText: string;
@@ -17,7 +17,7 @@ export interface HighlightedTextProps {
17
17
  * Highlighted text
18
18
  * Used for highlighting parts in the 'text' which match with 'searchText'
19
19
  * Also actively highlights one matched part which is selected with 'activeMatchIndex'
20
- * @beta
20
+ * @public
21
21
  */
22
22
  export declare function HighlightedText(props: HighlightedTextProps): JSX.Element;
23
23
  //# sourceMappingURL=HighlightedText.d.ts.map
@@ -18,7 +18,7 @@ const HighlightingEngine_1 = require("../tree/HighlightingEngine");
18
18
  * Highlighted text
19
19
  * Used for highlighting parts in the 'text' which match with 'searchText'
20
20
  * Also actively highlights one matched part which is selected with 'activeMatchIndex'
21
- * @beta
21
+ * @public
22
22
  */
23
23
  function HighlightedText(props) {
24
24
  const { searchText, activeMatchIndex, text, caseSensitive } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"HighlightedText.js","sourceRoot":"","sources":["../../../src/components-react/common/HighlightedText.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;AAEH,kDAA0B;AAC1B,k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":["/*---------------------------------------------------------------------------------------------\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 Common\n */\n\nimport React from \"react\";\nimport Highlighter from \"react-highlight-words\";\nimport { HighlightingEngine } from \"../tree/HighlightingEngine\";\n\n/**\n * Properties of [[HighlightedText]]\n * @beta\n */\nexport interface HighlightedTextProps {\n /* Filter text which we want to highlight */\n searchText: string;\n /* Index of actively highlighted part in a text */\n activeMatchIndex?: number;\n /* Full text */\n text: string;\n /** Should search be case sensitive */\n caseSensitive?: boolean;\n}\n\n/**\n * Highlighted text\n * Used for highlighting parts in the 'text' which match with 'searchText'\n * Also actively highlights one matched part which is selected with 'activeMatchIndex'\n * @beta\n */\nexport function HighlightedText(props: HighlightedTextProps) {\n const { searchText, activeMatchIndex, text, caseSensitive } = props;\n return (\n <Highlighter\n searchWords={[searchText]}\n findChunks={findChunksNoRegex as any} // .d.ts declaration wrong\n activeIndex={activeMatchIndex as any} // .d.ts file seems to be wrong, doesn't work if it's a string\n activeClassName={HighlightingEngine.ACTIVE_CLASS_NAME}\n autoEscape={true}\n textToHighlight={text}\n caseSensitive={caseSensitive}\n />\n );\n}\n\ninterface HighlighterChunk {\n highlight: boolean;\n start: number;\n end: number;\n}\ninterface FindChunksArgs {\n autoEscape?: boolean;\n caseSensitive?: boolean;\n searchWords: string[];\n textToHighlight: string;\n}\nconst findChunksNoRegex = (args: FindChunksArgs): HighlighterChunk[] => {\n const text = args.caseSensitive ? args.textToHighlight : args.textToHighlight.toUpperCase();\n const term = args.caseSensitive ? args.searchWords[0] : args.searchWords[0].toUpperCase();\n const chunks: HighlighterChunk[] = [];\n let index = text.indexOf(term);\n while (index !== -1) {\n chunks.push({ start: index, end: index + term.length, highlight: true });\n index = text.indexOf(term, index + 1);\n }\n return chunks;\n};\n"]}
1
+ {"version":3,"file":"HighlightedText.js","sourceRoot":"","sources":["../../../src/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AAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;KACvC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,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 Common\n */\n\nimport React from \"react\";\nimport Highlighter from \"react-highlight-words\";\nimport { HighlightingEngine } from \"../tree/HighlightingEngine\";\n\n/**\n * Properties of [[HighlightedText]]\n * @public\n */\nexport interface HighlightedTextProps {\n /* Filter text which we want to highlight */\n searchText: string;\n /* Index of actively highlighted part in a text */\n activeMatchIndex?: number;\n /* Full text */\n text: string;\n /** Should search be case sensitive */\n caseSensitive?: boolean;\n}\n\n/**\n * Highlighted text\n * Used for highlighting parts in the 'text' which match with 'searchText'\n * Also actively highlights one matched part which is selected with 'activeMatchIndex'\n * @public\n */\nexport function HighlightedText(props: HighlightedTextProps) {\n const { searchText, activeMatchIndex, text, caseSensitive } = props;\n return (\n <Highlighter\n searchWords={[searchText]}\n findChunks={findChunksNoRegex as any} // .d.ts declaration wrong\n activeIndex={activeMatchIndex as any} // .d.ts file seems to be wrong, doesn't work if it's a string\n activeClassName={HighlightingEngine.ACTIVE_CLASS_NAME}\n autoEscape={true}\n textToHighlight={text}\n caseSensitive={caseSensitive}\n />\n );\n}\n\ninterface HighlighterChunk {\n highlight: boolean;\n start: number;\n end: number;\n}\ninterface FindChunksArgs {\n autoEscape?: boolean;\n caseSensitive?: boolean;\n searchWords: string[];\n textToHighlight: string;\n}\nconst findChunksNoRegex = (args: FindChunksArgs): HighlighterChunk[] => {\n const text = args.caseSensitive ? args.textToHighlight : args.textToHighlight.toUpperCase();\n const term = args.caseSensitive ? args.searchWords[0] : args.searchWords[0].toUpperCase();\n const chunks: HighlighterChunk[] = [];\n let index = text.indexOf(term);\n while (index !== -1) {\n chunks.push({ start: index, end: index + term.length, highlight: true });\n index = text.indexOf(term, index + 1);\n }\n return chunks;\n};\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  /**
5
5
  * Item highlight info used for identification of a specific highlight in an item
6
- * @beta
6
+ * @public
7
7
  */
8
8
  export interface HighlightInfo {
9
9
  highlightedItemIdentifier: string;
@@ -11,7 +11,7 @@ export interface HighlightInfo {
11
11
  }
12
12
  /**
13
13
  * Properties used for highlighting parts in item by given text and actively highlighting one highlight in a distinct item specified in `activeHighlight`
14
- * @beta
14
+ * @public
15
15
  */
16
16
  export interface HighlightingComponentProps {
17
17
  highlightedText: string;
@@ -1 +1 @@
1
- {"version":3,"file":"HighlightingComponentProps.js","sourceRoot":"","sources":["../../../src/components-react/common/HighlightingComponentProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","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 Common\n */\n\n/**\n * Item highlight info used for identification of a specific highlight in an item\n * @beta\n */\nexport interface HighlightInfo {\n /* item's identifier, used for its identification */\n highlightedItemIdentifier: string;\n /* Index of highlighted part in an item */\n highlightIndex: number;\n}\n\n/**\n * Properties used for highlighting parts in item by given text and actively highlighting one highlight in a distinct item specified in `activeHighlight`\n * @beta\n */\nexport interface HighlightingComponentProps {\n /* Filter text which we want to highlight */\n highlightedText: string;\n /* Information about the highlight which we want to actively highlight */\n activeHighlight?: HighlightInfo;\n}\n"]}
1
+ {"version":3,"file":"HighlightingComponentProps.js","sourceRoot":"","sources":["../../../src/components-react/common/HighlightingComponentProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","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 Common\n */\n\n/**\n * Item highlight info used for identification of a specific highlight in an item\n * @public\n */\nexport interface HighlightInfo {\n /* item's identifier, used for its identification */\n highlightedItemIdentifier: string;\n /* Index of highlighted part in an item */\n highlightIndex: number;\n}\n\n/**\n * Properties used for highlighting parts in item by given text and actively highlighting one highlight in a distinct item specified in `activeHighlight`\n * @public\n */\nexport interface HighlightingComponentProps {\n /* Filter text which we want to highlight */\n highlightedText: string;\n /* Information about the highlight which we want to actively highlight */\n activeHighlight?: HighlightInfo;\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  /**
5
5
  * Custom hook for working with possibly async values.
6
- * @beta
6
+ * @public
7
7
  */
8
8
  export declare const useAsyncValue: <T extends unknown>(value: T | PromiseLike<T>) => T | undefined;
9
9
  //# sourceMappingURL=UseAsyncValue.d.ts.map
@@ -34,7 +34,7 @@ const Subject_1 = require("rxjs/internal/Subject");
34
34
  const core_react_1 = require("@itwin/core-react");
35
35
  /**
36
36
  * Custom hook for working with possibly async values.
37
- * @beta
37
+ * @public
38
38
  */
39
39
  const useAsyncValue = (value) => {
40
40
  const cancelled = React.useMemo(() => new Subject_1.Subject(), []);
@@ -1 +1 @@
1
- {"version":3,"file":"UseAsyncValue.js","sourceRoot":"","sources":["../../../src/components-react/common/UseAsyncValue.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,wDAAqD;AACrD,iEAA8D;AAC9D,mDAAgD;AAChD,kDAAsE;AAEtE;;;GAGG;AACI,MAAM,aAAa,GAAG,CAAgB,KAAyB,EAAiB,EAAE;IACvF,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,iBAAO,EAAQ,EAAE,EAAE,CAAC,CAAC;IAC/D,yCAAyC;IACzC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAE3D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE;QAC9C,IAAI,IAAA,0BAAa,EAAC,KAAK,CAAC,EAAE;YACxB,IAAA,WAAI,EAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAA,qBAAS,EAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YACxG,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,IAAA,+BAAkB,EAAC,GAAG,EAAE;QACtB,MAAM,WAAW,GAAG,CAAC,QAAW,EAAE,EAAE;YAClC,SAAS,CAAC,IAAI,EAAE,CAAC;YACjB,SAAS,CAAC,QAAQ,CAAC,CAAC;QACtB,CAAC,CAAC;QAEF,IAAI,IAAA,0BAAa,EAAC,KAAK,CAAC,EAAE;YACxB,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAA,qBAAS,EAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAC/H,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;SACzC;QAED,WAAW,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAEvB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA7BW,QAAA,aAAa,iBA6BxB","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 Common\n */\n\nimport * as React from \"react\";\nimport { from } from \"rxjs/internal/observable/from\";\nimport { takeUntil } from \"rxjs/internal/operators/takeUntil\";\nimport { Subject } from \"rxjs/internal/Subject\";\nimport { isPromiseLike, useEffectSkipFirst } from \"@itwin/core-react\";\n\n/**\n * Custom hook for working with possibly async values.\n * @beta\n */\nexport const useAsyncValue = <T extends any>(value: T | PromiseLike<T>): T | undefined => {\n const cancelled = React.useMemo(() => new Subject<void>(), []);\n // cancel any pending promises on unmount\n React.useEffect(() => () => cancelled.next(), [cancelled]);\n\n const [result, setResult] = React.useState(() => {\n if (isPromiseLike(value)) {\n from(value).pipe(takeUntil(cancelled)).subscribe({ next: (resolvedValue) => setResult(resolvedValue) });\n return undefined;\n }\n return value;\n });\n\n useEffectSkipFirst(() => {\n const updateValue = (newValue: T) => {\n cancelled.next();\n setResult(newValue);\n };\n\n if (isPromiseLike(value)) {\n const subscription = from(value).pipe(takeUntil(cancelled)).subscribe({ next: (resolvedValue) => updateValue(resolvedValue) });\n return () => subscription.unsubscribe();\n }\n\n updateValue(value);\n return undefined;\n }, [value, cancelled]);\n\n return result;\n};\n"]}
1
+ {"version":3,"file":"UseAsyncValue.js","sourceRoot":"","sources":["../../../src/components-react/common/UseAsyncValue.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,wDAAqD;AACrD,iEAA8D;AAC9D,mDAAgD;AAChD,kDAAsE;AAEtE;;;GAGG;AACI,MAAM,aAAa,GAAG,CAAgB,KAAyB,EAAiB,EAAE;IACvF,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,iBAAO,EAAQ,EAAE,EAAE,CAAC,CAAC;IAC/D,yCAAyC;IACzC,KAAK,CAAC,SAAS,CAAC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------------------------------------------------------------------\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 Common\n */\n\nimport * as React from \"react\";\nimport { from } from \"rxjs/internal/observable/from\";\nimport { takeUntil } from \"rxjs/internal/operators/takeUntil\";\nimport { Subject } from \"rxjs/internal/Subject\";\nimport { isPromiseLike, useEffectSkipFirst } from \"@itwin/core-react\";\n\n/**\n * Custom hook for working with possibly async values.\n * @public\n */\nexport const useAsyncValue = <T extends any>(value: T | PromiseLike<T>): T | undefined => {\n const cancelled = React.useMemo(() => new Subject<void>(), []);\n // cancel any pending promises on unmount\n React.useEffect(() => () => cancelled.next(), [cancelled]);\n\n const [result, setResult] = React.useState(() => {\n if (isPromiseLike(value)) {\n from(value).pipe(takeUntil(cancelled)).subscribe({ next: (resolvedValue) => setResult(resolvedValue) });\n return undefined;\n }\n return value;\n });\n\n useEffectSkipFirst(() => {\n const updateValue = (newValue: T) => {\n cancelled.next();\n setResult(newValue);\n };\n\n if (isPromiseLike(value)) {\n const subscription = from(value).pipe(takeUntil(cancelled)).subscribe({ next: (resolvedValue) => updateValue(resolvedValue) });\n return () => subscription.unsubscribe();\n }\n\n updateValue(value);\n return undefined;\n }, [value, cancelled]);\n\n return result;\n};\n"]}
@@ -47,39 +47,39 @@ function isSameDay(a, b) {
47
47
  * @alpha
48
48
  */
49
49
  function DatePicker(props) {
50
- const previousMonthLabel = React.useRef(UiComponents_1.UiComponents.i18n.translate("UiComponents:datepicker.previousMonth"));
51
- const nextMonthLabel = React.useRef(UiComponents_1.UiComponents.i18n.translate("UiComponents:datepicker.nextMonth"));
50
+ const previousMonthLabel = React.useRef(UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:datepicker.previousMonth"));
51
+ const nextMonthLabel = React.useRef(UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:datepicker.nextMonth"));
52
52
  const monthsLong = React.useRef([
53
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.january"),
54
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.february"),
55
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.march"),
56
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.april"),
57
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.may"),
58
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.june"),
59
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.july"),
60
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.august"),
61
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.september"),
62
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.october"),
63
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.november"),
64
- UiComponents_1.UiComponents.i18n.translate("UiComponents:month.long.december"),
53
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.january"),
54
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.february"),
55
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.march"),
56
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.april"),
57
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.may"),
58
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.june"),
59
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.july"),
60
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.august"),
61
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.september"),
62
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.october"),
63
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.november"),
64
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:month.long.december"),
65
65
  ]);
66
66
  const daysLong = React.useRef([
67
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.long.sunday"),
68
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.long.monday"),
69
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.long.tuesday"),
70
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.long.wednesday"),
71
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.long.thursday"),
72
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.long.friday"),
73
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.long.saturday"),
67
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.sunday"),
68
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.monday"),
69
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.tuesday"),
70
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.wednesday"),
71
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.thursday"),
72
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.friday"),
73
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.long.saturday"),
74
74
  ]);
75
75
  const daysShort = React.useRef([
76
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.short.sunday"),
77
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.short.monday"),
78
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.short.tuesday"),
79
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.short.wednesday"),
80
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.short.thursday"),
81
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.short.friday"),
82
- UiComponents_1.UiComponents.i18n.translate("UiComponents:days.short.saturday"),
76
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.sunday"),
77
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.monday"),
78
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.tuesday"),
79
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.wednesday"),
80
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.thursday"),
81
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.friday"),
82
+ UiComponents_1.UiComponents.localization.getLocalizedString("UiComponents:days.short.saturday"),
83
83
  ]);
84
84
  const [selectedDay, setSelectedDay] = React.useState(new Date(props.selected.getTime()));
85
85
  const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(selectedDay.getMonth());
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,4DAAoC;AACpC,0DAAmD;AACnD,kDAAgD;AAChD,kDAA+C;AAE/C,6BAA2B;AAE3B,SAAS,SAAS,CAAC,CAAO,EAAE,CAAO;IACjC,OAAO,CACL,CAAC;QACD,CAAC;QACD,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE;QACnC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC7B,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAC5B,CAAC;AACJ,CAAC;AAeD;;GAEG;AACH,SAAgB,UAAU,CAAC,KAAsB;IAC/C,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAAC,2BAAY,CAAC,IAAI,CAAC,SAAS,CAAC,uCAAuC,CAAC,CAAC,CAAC;IAC9G,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,2BAAY,CAAC,IAAI,CAAC,SAAS,CAAC,mCAAmC,CAAC,CAAC,CAAC;IACtG,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;QAC9B,2BAAY,CAAC,IAAI,CAAC,SAAS,CAAC,iCAAiC,CAAC;QA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M,SAAS,GAAG,UAAU,IAAI,GAAG,IAAI,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC;YAC5F,MAAM,cAAc,GAAG,GAAG,CAAC,QAAQ,EAAE,KAAK,mBAAmB,CAAC;YAC9D,MAAM,UAAU,GAAG,IAAA,oBAAU,EAAC,qCAAqC,EAAE,QAAQ,IAAI,UAAU,EAAE,CAAC,cAAc,IAAI,iBAAiB,EAAE,SAAS,IAAI,SAAS,CAAC,CAAC;YAC3J,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;YAChC,OAAO;YACL,oEAAoE;YACpE,4BAAI,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,aAAa,IAAI,mBAAmB,QAAQ,QAAQ,EAAE,EACvF,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC,QAAQ,mBAAgB,QAAQ,gBAAc,GAAG,CAAC,OAAO,EAAE;gBACjG,kCAAO,SAAS,CAAQ,CACrB,CACN,CAAC;QACJ,CAAC,CAAC,CACa,CAAC,CACnB,CACE,CACD,CACP,CAAC;AACJ,CAAC;AAhLD,gCAgLC","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 Date\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\nimport { WebFontIcon } from \"@itwin/core-react\";\nimport { UiComponents } from \"../UiComponents\";\n\nimport \"./DatePicker.scss\";\n\nfunction isSameDay(a: Date, b: Date) {\n return (\n a &&\n b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\n/**\n * Props for [[DatePicker]] component.\n * @alpha\n */\nexport interface DatePickerProps {\n /** defines both date and time */\n selected: Date;\n /** function to call when date or time has changed */\n onDateChange?: (day: Date) => void;\n /** show focus outlines, useful for keyboard navigation */\n showFocusOutline?: boolean;\n}\n\n/** DatePicker component. Show a month selector and a day calendar to select a specific date.\n * @alpha\n */\nexport function DatePicker(props: DatePickerProps) {\n const previousMonthLabel = React.useRef(UiComponents.i18n.translate(\"UiComponents:datepicker.previousMonth\"));\n const nextMonthLabel = React.useRef(UiComponents.i18n.translate(\"UiComponents:datepicker.nextMonth\"));\n const monthsLong = React.useRef([\n UiComponents.i18n.translate(\"UiComponents:month.long.january\"),\n UiComponents.i18n.translate(\"UiComponents:month.long.february\"),\n UiComponents.i18n.translate(\"UiComponents:month.long.march\"),\n UiComponents.i18n.translate(\"UiComponents:month.long.april\"),\n UiComponents.i18n.translate(\"UiComponents:month.long.may\"),\n UiComponents.i18n.translate(\"UiComponents:month.long.june\"),\n UiComponents.i18n.translate(\"UiComponents:month.long.july\"),\n UiComponents.i18n.translate(\"UiComponents:month.long.august\"),\n UiComponents.i18n.translate(\"UiComponents:month.long.september\"),\n UiComponents.i18n.translate(\"UiComponents:month.long.october\"),\n UiComponents.i18n.translate(\"UiComponents:month.long.november\"),\n UiComponents.i18n.translate(\"UiComponents:month.long.december\"),\n ]);\n\n const daysLong = React.useRef([\n UiComponents.i18n.translate(\"UiComponents:days.long.sunday\"),\n UiComponents.i18n.translate(\"UiComponents:days.long.monday\"),\n UiComponents.i18n.translate(\"UiComponents:days.long.tuesday\"),\n UiComponents.i18n.translate(\"UiComponents:days.long.wednesday\"),\n UiComponents.i18n.translate(\"UiComponents:days.long.thursday\"),\n UiComponents.i18n.translate(\"UiComponents:days.long.friday\"),\n UiComponents.i18n.translate(\"UiComponents:days.long.saturday\"),\n ]);\n\n const daysShort = React.useRef([\n UiComponents.i18n.translate(\"UiComponents:days.short.sunday\"),\n UiComponents.i18n.translate(\"UiComponents:days.short.monday\"),\n UiComponents.i18n.translate(\"UiComponents:days.short.tuesday\"),\n UiComponents.i18n.translate(\"UiComponents:days.short.wednesday\"),\n UiComponents.i18n.translate(\"UiComponents:days.short.thursday\"),\n UiComponents.i18n.translate(\"UiComponents:days.short.friday\"),\n UiComponents.i18n.translate(\"UiComponents:days.short.saturday\"),\n ]);\n\n const [selectedDay, setSelectedDay] = React.useState(new Date(props.selected.getTime()));\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(selectedDay.getMonth());\n const [displayedYear, setDisplayedYear] = React.useState(selectedDay.getFullYear());\n const [focusedDay, setFocusedDay] = React.useState(selectedDay);\n const days = React.useMemo(() => {\n const msFirstDayOfMonth = new Date(displayedYear, displayedMonthIndex, 1).getTime();\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\n if (0 === offsetToFirst)\n offsetToFirst = 7;\n\n const daysInMonth: Date[] = [];\n // generate 6 weeks of dates\n for (let i = 0; i < 42; i++) {\n const adjustedDay = 1 + i - offsetToFirst;\n daysInMonth.push(new Date(displayedYear, displayedMonthIndex, adjustedDay));\n }\n return daysInMonth;\n }, [displayedMonthIndex, displayedYear]);\n\n const weeks = React.useMemo(() => {\n const weeksInMonth = [];\n const weekCount = Math.ceil(days.length / 7);\n for (let i = 0; i < weekCount; i++) {\n weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));\n }\n return weeksInMonth;\n }, [days]);\n\n const setMonthAndYear = React.useCallback((newMonth: number, newYear: number) => {\n setDisplayedMonthIndex(newMonth);\n setDisplayedYear(newYear);\n if (selectedDay.getFullYear() === newYear && selectedDay.getMonth() === newMonth) {\n setFocusedDay(new Date(selectedDay.getTime()));\n } else {\n const newFocusDay = new Date(focusedDay.getTime());\n newFocusDay.setFullYear(newYear, newMonth, 1);\n setFocusedDay(newFocusDay);\n }\n }, [focusedDay, selectedDay]);\n\n const handleMoveToPreviousMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\n const newYear = displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n const handleMoveToNextMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;\n const newYear = displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n // when invoked, it will return another function which can be used for the onClick React listener.\n const handleOnDayChange = React.useCallback((day: Date) => () => {\n setSelectedDay(day);\n setFocusedDay(day);\n props.onDateChange && props.onDateChange(day);\n }, [props]);\n\n const handleCalendarKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\n if (event.key === SpecialKey.ArrowDown) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n if ((focusedDayIndex + 7) > 41)\n setFocusedDay(days[focusedDayIndex % 7]);\n else\n setFocusedDay(days[focusedDayIndex + 7]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.ArrowUp) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n if ((focusedDayIndex - 7) < 0)\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\n else\n setFocusedDay(days[focusedDayIndex - 7]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.ArrowLeft) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n // istanbul ignore else\n if ((focusedDayIndex - 1) >= 0)\n setFocusedDay(days[focusedDayIndex - 1]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.ArrowRight) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n // istanbul ignore else\n if ((focusedDayIndex + 1) <= 41)\n setFocusedDay(days[focusedDayIndex + 1]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.Enter || event.key === SpecialKey.Space) {\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\n event.preventDefault();\n }\n }, [days, focusedDay, handleOnDayChange]);\n\n const previousButtonClass = classnames(\"components-previous-month\", props.showFocusOutline && \"showFocusOutline\");\n const nextButtonClass = classnames(\"components-next-month\", props.showFocusOutline && \"showFocusOutline\");\n const calendarClass = classnames(\"components-date-picker-calendar-month\", props.showFocusOutline && \"showFocusOutline\");\n\n return (\n <div className=\"components-date-picker-calendar\">\n <div className=\"components-date-picker-calendar-header-months\">\n <button className={previousButtonClass} title={previousMonthLabel.current} onClick={handleMoveToPreviousMonth}>\n <WebFontIcon iconName={\"icon-chevron-left\"} />\n </button>\n <span className=\"components-month-year\">{monthsLong.current[displayedMonthIndex]} {displayedYear}</span>\n <button className={nextButtonClass} title={nextMonthLabel.current} onClick={handleMoveToNextMonth}>\n <WebFontIcon iconName={\"icon-chevron-right\"} />\n </button>\n </div>\n <div className=\"components-date-picker-calendar-header-weekdays\">\n {[0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) =>\n <div key={`day-${dayOfWeek}`} className=\"components-date-picker-calendar-header-day-short\"\n title={daysLong.current[dayOfWeek]}><span>{daysShort.current[dayOfWeek]}</span></div>)}\n </div>\n <ul tabIndex={0} onKeyDown={handleCalendarKeyDown} data-testid=\"components-date-picker-calendar-list\" className={calendarClass} role=\"listbox\">\n {weeks.map((weekdays, weekIndex) => (\n <React.Fragment key={`week-${weekIndex}`}>\n {weekdays.map((day: Date, dayIndex: number) => {\n const isActive = selectedDay && day && isSameDay(selectedDay, day);\n const isFocused = focusedDay && day && isSameDay(focusedDay, day) && props.showFocusOutline;\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\n const classNames = classnames(\"components-date-picker-calendar-day\", isActive && \"selected\", !isCurrentMonth && \"notCurrentMonth\", isFocused && \"focused\");\n const dateValue = day.getDate();\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\n <li className={classNames} key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\n onClick={handleOnDayChange(day)} role=\"option\" aria-selected={isActive} data-value={day.getTime()}>\n <span>{dateValue}</span>\n </li>\n );\n })}\n </React.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C,EAAE,QAAQ,IAAI,UAAU,EAAE,CAAC,cAAc,IAAI,iBAAiB,EAAE,SAAS,IAAI,SAAS,CAAC,CAAC;YAC3J,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;YAChC,OAAO;YACL,oEAAoE;YACpE,4BAAI,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,aAAa,IAAI,mBAAmB,QAAQ,QAAQ,EAAE,EACvF,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC,QAAQ,mBAAgB,QAAQ,gBAAc,GAAG,CAAC,OAAO,EAAE;gBACjG,kCAAO,SAAS,CAAQ,CACrB,CACN,CAAC;QACJ,CAAC,CAAC,CACa,CAAC,CACnB,CACE,CACD,CACP,CAAC;AACJ,CAAC;AAhLD,gCAgLC","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 Date\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\nimport { WebFontIcon } from \"@itwin/core-react\";\nimport { UiComponents } from \"../UiComponents\";\n\nimport \"./DatePicker.scss\";\n\nfunction isSameDay(a: Date, b: Date) {\n return (\n a &&\n b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\n/**\n * Props for [[DatePicker]] component.\n * @alpha\n */\nexport interface DatePickerProps {\n /** defines both date and time */\n selected: Date;\n /** function to call when date or time has changed */\n onDateChange?: (day: Date) => void;\n /** show focus outlines, useful for keyboard navigation */\n showFocusOutline?: boolean;\n}\n\n/** DatePicker component. Show a month selector and a day calendar to select a specific date.\n * @alpha\n */\nexport function DatePicker(props: DatePickerProps) {\n const previousMonthLabel = React.useRef(UiComponents.localization.getLocalizedString(\"UiComponents:datepicker.previousMonth\"));\n const nextMonthLabel = React.useRef(UiComponents.localization.getLocalizedString(\"UiComponents:datepicker.nextMonth\"));\n const monthsLong = React.useRef([\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.january\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.february\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.march\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.april\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.may\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.june\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.july\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.august\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.september\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.october\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.november\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.december\"),\n ]);\n\n const daysLong = React.useRef([\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.sunday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.monday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.tuesday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.wednesday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.thursday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.friday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.saturday\"),\n ]);\n\n const daysShort = React.useRef([\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.sunday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.monday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.tuesday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.wednesday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.thursday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.friday\"),\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.saturday\"),\n ]);\n\n const [selectedDay, setSelectedDay] = React.useState(new Date(props.selected.getTime()));\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(selectedDay.getMonth());\n const [displayedYear, setDisplayedYear] = React.useState(selectedDay.getFullYear());\n const [focusedDay, setFocusedDay] = React.useState(selectedDay);\n const days = React.useMemo(() => {\n const msFirstDayOfMonth = new Date(displayedYear, displayedMonthIndex, 1).getTime();\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\n if (0 === offsetToFirst)\n offsetToFirst = 7;\n\n const daysInMonth: Date[] = [];\n // generate 6 weeks of dates\n for (let i = 0; i < 42; i++) {\n const adjustedDay = 1 + i - offsetToFirst;\n daysInMonth.push(new Date(displayedYear, displayedMonthIndex, adjustedDay));\n }\n return daysInMonth;\n }, [displayedMonthIndex, displayedYear]);\n\n const weeks = React.useMemo(() => {\n const weeksInMonth = [];\n const weekCount = Math.ceil(days.length / 7);\n for (let i = 0; i < weekCount; i++) {\n weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));\n }\n return weeksInMonth;\n }, [days]);\n\n const setMonthAndYear = React.useCallback((newMonth: number, newYear: number) => {\n setDisplayedMonthIndex(newMonth);\n setDisplayedYear(newYear);\n if (selectedDay.getFullYear() === newYear && selectedDay.getMonth() === newMonth) {\n setFocusedDay(new Date(selectedDay.getTime()));\n } else {\n const newFocusDay = new Date(focusedDay.getTime());\n newFocusDay.setFullYear(newYear, newMonth, 1);\n setFocusedDay(newFocusDay);\n }\n }, [focusedDay, selectedDay]);\n\n const handleMoveToPreviousMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\n const newYear = displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n const handleMoveToNextMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;\n const newYear = displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n // when invoked, it will return another function which can be used for the onClick React listener.\n const handleOnDayChange = React.useCallback((day: Date) => () => {\n setSelectedDay(day);\n setFocusedDay(day);\n props.onDateChange && props.onDateChange(day);\n }, [props]);\n\n const handleCalendarKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\n if (event.key === SpecialKey.ArrowDown) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n if ((focusedDayIndex + 7) > 41)\n setFocusedDay(days[focusedDayIndex % 7]);\n else\n setFocusedDay(days[focusedDayIndex + 7]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.ArrowUp) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n if ((focusedDayIndex - 7) < 0)\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\n else\n setFocusedDay(days[focusedDayIndex - 7]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.ArrowLeft) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n // istanbul ignore else\n if ((focusedDayIndex - 1) >= 0)\n setFocusedDay(days[focusedDayIndex - 1]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.ArrowRight) {\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\n // istanbul ignore else\n if ((focusedDayIndex + 1) <= 41)\n setFocusedDay(days[focusedDayIndex + 1]);\n event.preventDefault();\n }\n if (event.key === SpecialKey.Enter || event.key === SpecialKey.Space) {\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\n event.preventDefault();\n }\n }, [days, focusedDay, handleOnDayChange]);\n\n const previousButtonClass = classnames(\"components-previous-month\", props.showFocusOutline && \"showFocusOutline\");\n const nextButtonClass = classnames(\"components-next-month\", props.showFocusOutline && \"showFocusOutline\");\n const calendarClass = classnames(\"components-date-picker-calendar-month\", props.showFocusOutline && \"showFocusOutline\");\n\n return (\n <div className=\"components-date-picker-calendar\">\n <div className=\"components-date-picker-calendar-header-months\">\n <button className={previousButtonClass} title={previousMonthLabel.current} onClick={handleMoveToPreviousMonth}>\n <WebFontIcon iconName={\"icon-chevron-left\"} />\n </button>\n <span className=\"components-month-year\">{monthsLong.current[displayedMonthIndex]} {displayedYear}</span>\n <button className={nextButtonClass} title={nextMonthLabel.current} onClick={handleMoveToNextMonth}>\n <WebFontIcon iconName={\"icon-chevron-right\"} />\n </button>\n </div>\n <div className=\"components-date-picker-calendar-header-weekdays\">\n {[0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) =>\n <div key={`day-${dayOfWeek}`} className=\"components-date-picker-calendar-header-day-short\"\n title={daysLong.current[dayOfWeek]}><span>{daysShort.current[dayOfWeek]}</span></div>)}\n </div>\n <ul tabIndex={0} onKeyDown={handleCalendarKeyDown} data-testid=\"components-date-picker-calendar-list\" className={calendarClass} role=\"listbox\">\n {weeks.map((weekdays, weekIndex) => (\n <React.Fragment key={`week-${weekIndex}`}>\n {weekdays.map((day: Date, dayIndex: number) => {\n const isActive = selectedDay && day && isSameDay(selectedDay, day);\n const isFocused = focusedDay && day && isSameDay(focusedDay, day) && props.showFocusOutline;\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\n const classNames = classnames(\"components-date-picker-calendar-day\", isActive && \"selected\", !isCurrentMonth && \"notCurrentMonth\", isFocused && \"focused\");\n const dateValue = day.getDate();\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\n <li className={classNames} key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\n onClick={handleOnDayChange(day)} role=\"option\" aria-selected={isActive} data-value={day.getTime()}>\n <span>{dateValue}</span>\n </li>\n );\n })}\n </React.Fragment>)\n )}\n </ul>\n </div>\n );\n}\n"]}
@@ -12,7 +12,7 @@ interface BooleanEditorState {
12
12
  isDisabled?: boolean;
13
13
  }
14
14
  /** BooleanEditor React component that is a property editor with checkbox input
15
- * @beta
15
+ * @public
16
16
  */
17
17
  export declare class BooleanEditor extends React.PureComponent<PropertyEditorProps, BooleanEditorState> implements TypeEditor {
18
18
  private _isMounted;
@@ -35,7 +35,7 @@ export declare class BooleanEditor extends React.PureComponent<PropertyEditorPro
35
35
  }
36
36
  /** Boolean Property Editor registered for the "bool" and "boolean" type names.
37
37
  * It uses the [[BooleanEditor]] React component.
38
- * @beta
38
+ * @public
39
39
  */
40
40
  export declare class BooleanPropertyEditor extends PropertyEditorBase {
41
41
  get containerHandlesBlur(): boolean;
@@ -37,7 +37,7 @@ const appui_abstract_1 = require("@itwin/appui-abstract");
37
37
  const itwinui_react_1 = require("@itwin/itwinui-react");
38
38
  const PropertyEditorManager_1 = require("./PropertyEditorManager");
39
39
  /** BooleanEditor React component that is a property editor with checkbox input
40
- * @beta
40
+ * @public
41
41
  */
42
42
  class BooleanEditor extends React.PureComponent {
43
43
  constructor() {
@@ -137,7 +137,7 @@ class BooleanEditor extends React.PureComponent {
137
137
  exports.BooleanEditor = BooleanEditor;
138
138
  /** Boolean Property Editor registered for the "bool" and "boolean" type names.
139
139
  * It uses the [[BooleanEditor]] React component.
140
- * @beta
140
+ * @public
141
141
  */
142
142
  class BooleanPropertyEditor extends PropertyEditorManager_1.PropertyEditorBase {
143
143
  // istanbul ignore next
@@ -1 +1 @@
1
- {"version":3,"file":"BooleanEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/BooleanEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gCAA8B;AAC9B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAA8F;AAC9F,wDAAgD;AAEhD,mEAAoF;AAQpF;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK,CAAC,aAAsD;IAA/F;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAG,KAAK,CAAC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,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 PropertyEditors\n */\n\nimport \"./BooleanEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { PropertyValue, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface BooleanEditorState {\n checkboxValue: boolean;\n isDisabled?: boolean;\n}\n\n/** BooleanEditor React component that is a property editor with checkbox input\n * @beta\n */\nexport class BooleanEditor extends React.PureComponent<PropertyEditorProps, BooleanEditorState> implements TypeEditor {\n private _isMounted = false;\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<BooleanEditorState> = {\n checkboxValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.checkboxValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private _updateCheckboxValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted) {\n let checkboxValue: boolean = false;\n\n // istanbul ignore if\n if (e.target.checked !== undefined) // Needed for unit test environment\n checkboxValue = e.target.checked;\n else {\n // istanbul ignore else\n if (e.target.value !== undefined && typeof e.target.value === \"boolean\")\n checkboxValue = e.target.value;\n }\n\n this.setState({\n checkboxValue,\n }, async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\n }\n }\n });\n }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n let checkboxValue = false;\n let isDisabled = false;\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ checkboxValue, isDisabled });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\"components-cell-editor\", \"components-boolean-editor\", this.props.className);\n const checked = this.state.checkboxValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n <Checkbox\n ref={this._inputElement}\n onBlur={this.props.onBlur}\n className={className}\n style={this.props.style}\n checked={checked}\n onChange={this._updateCheckboxValue}\n setFocus={this.props.setFocus}\n disabled={isDisabled}\n data-testid=\"components-checkbox-editor\">\n </Checkbox>\n );\n }\n}\n\n/** Boolean Property Editor registered for the \"bool\" and \"boolean\" type names.\n * It uses the [[BooleanEditor]] React component.\n * @beta\n */\nexport class BooleanPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <BooleanEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Bool, BooleanPropertyEditor);\nPropertyEditorManager.registerEditor(StandardTypeNames.Boolean, BooleanPropertyEditor);\n"]}
1
+ {"version":3,"file":"BooleanEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/BooleanEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gCAA8B;AAC9B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAA8F;AAC9F,wDAAgD;AAEhD,mEAAoF;AAQpF;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK,CAAC,aAAsD;IAA/F;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAE5D,gBAAgB;QACS,UAAK,GAAiC;YAC7D,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,KAAK;SAClB,CAAC;QA0BM,yBAAoB,GAAG,CAAC,CAAsC,EAAE,EAAE;YACxE,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,IAAI,aAAa,GAAY,KAAK,CAAC;gBAEnC,qBAAqB;gBACrB,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,EAAI,mCAAmC;oBACvE,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;qBAC9B;oBACH,uBAAuB;oBACvB,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS;wBACrE,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBAClC;gBAED,IAAI,CAAC,QAAQ,CAAC;oBACZ,aAAa;iBACd,EAAE,KAAK,IAAI,EAAE;oBACZ,uBAAuB;oBACvB,IAAI,IAAI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EAChB,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EACnC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,QAAQ,EAAE,UAAU,iBACR,4BAA4B,GAC/B,CACZ,CAAC;IACJ,CAAC;CACF;AAzHD,sCAyHC;AAED;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,0CAAkB;IAC3D,uBAAuB;IACvB,IAAoB,oBAAoB;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,aAAa,OAAG,CAAC;IAC3B,CAAC;CACF;AATD,sDASC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;AACpF,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,OAAO,EAAE,qBAAqB,CAAC,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 PropertyEditors\n */\n\nimport \"./BooleanEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { PropertyValue, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface BooleanEditorState {\n checkboxValue: boolean;\n isDisabled?: boolean;\n}\n\n/** BooleanEditor React component that is a property editor with checkbox input\n * @public\n */\nexport class BooleanEditor extends React.PureComponent<PropertyEditorProps, BooleanEditorState> implements TypeEditor {\n private _isMounted = false;\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<BooleanEditorState> = {\n checkboxValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.checkboxValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private _updateCheckboxValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted) {\n let checkboxValue: boolean = false;\n\n // istanbul ignore if\n if (e.target.checked !== undefined) // Needed for unit test environment\n checkboxValue = e.target.checked;\n else {\n // istanbul ignore else\n if (e.target.value !== undefined && typeof e.target.value === \"boolean\")\n checkboxValue = e.target.value;\n }\n\n this.setState({\n checkboxValue,\n }, async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\n }\n }\n });\n }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n let checkboxValue = false;\n let isDisabled = false;\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ checkboxValue, isDisabled });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\"components-cell-editor\", \"components-boolean-editor\", this.props.className);\n const checked = this.state.checkboxValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n <Checkbox\n ref={this._inputElement}\n onBlur={this.props.onBlur}\n className={className}\n style={this.props.style}\n checked={checked}\n onChange={this._updateCheckboxValue}\n setFocus={this.props.setFocus}\n disabled={isDisabled}\n data-testid=\"components-checkbox-editor\">\n </Checkbox>\n );\n }\n}\n\n/** Boolean Property Editor registered for the \"bool\" and \"boolean\" type names.\n * It uses the [[BooleanEditor]] React component.\n * @public\n */\nexport class BooleanPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <BooleanEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Bool, BooleanPropertyEditor);\nPropertyEditorManager.registerEditor(StandardTypeNames.Boolean, BooleanPropertyEditor);\n"]}
@@ -13,7 +13,7 @@ interface EnumButtonGroupEditorState {
13
13
  choices: EnumerationChoice[];
14
14
  }
15
15
  /** EnumButtonGroupEditor React component that is a property editor with select input
16
- * @beta
16
+ * @public
17
17
  */
18
18
  export declare class EnumButtonGroupEditor extends React.Component<PropertyEditorProps, EnumButtonGroupEditorState> implements TypeEditor {
19
19
  private _btnRefs;
@@ -35,7 +35,7 @@ export declare class EnumButtonGroupEditor extends React.Component<PropertyEdito
35
35
  }
36
36
  /** Enum Property Button Group Editor registered for the "enum" type name and the "enum-buttongroup" editor name.
37
37
  * It uses the [[EnumButtonGroupEditor]] React component.
38
- * @beta
38
+ * @public
39
39
  */
40
40
  export declare class EnumPropertyButtonGroupEditor extends PropertyEditorBase {
41
41
  get reactNode(): React.ReactNode;
@@ -37,7 +37,7 @@ const appui_abstract_1 = require("@itwin/appui-abstract");
37
37
  const core_react_1 = require("@itwin/core-react");
38
38
  const PropertyEditorManager_1 = require("./PropertyEditorManager");
39
39
  /** EnumButtonGroupEditor React component that is a property editor with select input
40
- * @beta
40
+ * @public
41
41
  */
42
42
  class EnumButtonGroupEditor extends React.Component {
43
43
  constructor() {
@@ -168,7 +168,7 @@ class EnumButtonGroupEditor extends React.Component {
168
168
  exports.EnumButtonGroupEditor = EnumButtonGroupEditor;
169
169
  /** Enum Property Button Group Editor registered for the "enum" type name and the "enum-buttongroup" editor name.
170
170
  * It uses the [[EnumButtonGroupEditor]] React component.
171
- * @beta
171
+ * @public
172
172
  */
173
173
  class EnumPropertyButtonGroupEditor extends PropertyEditorManager_1.PropertyEditorBase {
174
174
  get reactNode() {