@itwin/imodel-components-react 4.0.0-dev.15 → 4.0.0-dev.16

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 (172) hide show
  1. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  2. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +2 -2
  3. package/lib/cjs/imodel-components-react/color/AlphaSlider.js +1 -1
  4. package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
  5. package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +63 -63
  6. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  7. package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +90 -90
  8. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  9. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  10. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +62 -62
  11. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  12. package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
  13. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  14. package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
  15. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  16. package/lib/cjs/imodel-components-react/color/Swatch.scss +22 -22
  17. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  18. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  19. package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +18 -18
  20. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  21. package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +16 -16
  22. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  23. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  24. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +106 -106
  25. package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
  26. package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +48 -48
  27. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  28. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +51 -51
  29. package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
  30. package/lib/cjs/imodel-components-react/navigationaids/Cube.scss +19 -19
  31. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +0 -21
  32. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  33. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +1 -25
  34. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  35. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -178
  36. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  37. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -135
  38. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  39. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +59 -59
  40. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  41. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  42. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  43. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  44. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  45. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  46. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  47. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  48. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  49. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  50. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  51. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  52. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  53. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  54. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  55. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  56. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  57. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  58. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  59. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  60. package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
  61. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  62. package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +28 -28
  63. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  64. package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +105 -105
  65. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  66. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +359 -359
  67. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  68. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  69. package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
  70. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  71. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +177 -177
  72. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +0 -29
  73. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  74. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  75. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  76. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  77. package/lib/cjs/imodel-components-react.d.ts +0 -1
  78. package/lib/cjs/imodel-components-react.d.ts.map +1 -1
  79. package/lib/cjs/imodel-components-react.js +0 -1
  80. package/lib/cjs/imodel-components-react.js.map +1 -1
  81. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  82. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +2 -2
  83. package/lib/esm/imodel-components-react/color/AlphaSlider.js +1 -1
  84. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  85. package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
  86. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  87. package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +90 -90
  88. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  89. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  90. package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +62 -62
  91. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  92. package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
  93. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  94. package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
  95. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  96. package/lib/esm/imodel-components-react/color/Swatch.scss +22 -22
  97. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  98. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  99. package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -18
  100. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  101. package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -16
  102. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  103. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  104. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +106 -106
  105. package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
  106. package/lib/esm/imodel-components-react/lineweight/Swatch.scss +48 -48
  107. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  108. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +51 -51
  109. package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
  110. package/lib/esm/imodel-components-react/navigationaids/Cube.scss +19 -19
  111. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +0 -21
  112. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  113. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +0 -24
  114. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  115. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -178
  116. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  117. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -135
  118. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  119. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +59 -59
  120. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  121. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  122. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  123. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  124. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  125. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  126. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  127. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  128. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  129. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  130. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  131. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  132. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  133. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  134. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  135. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  136. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  137. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  138. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  139. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  140. package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
  141. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  142. package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +28 -28
  143. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  144. package/lib/esm/imodel-components-react/timeline/Scrubber.scss +105 -105
  145. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  146. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +359 -359
  147. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  148. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  149. package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
  150. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  151. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +177 -177
  152. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +0 -29
  153. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  154. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  155. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  156. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  157. package/lib/esm/imodel-components-react.d.ts +0 -1
  158. package/lib/esm/imodel-components-react.d.ts.map +1 -1
  159. package/lib/esm/imodel-components-react.js +0 -1
  160. package/lib/esm/imodel-components-react.js.map +1 -1
  161. package/lib/public/locales/en/UiIModelComponents.json +139 -139
  162. package/package.json +5 -5
  163. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts +0 -22
  164. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts.map +0 -1
  165. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js +0 -150
  166. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js.map +0 -1
  167. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.scss +0 -94
  168. package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +0 -22
  169. package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts.map +0 -1
  170. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +0 -123
  171. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +0 -1
  172. package/lib/esm/imodel-components-react/color/ColorPickerPanel.scss +0 -94
@@ -1 +1 @@
1
- {"version":3,"file":"DecimalSeparator.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/DecimalSeparator.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAA4D;AAW5D;;GAEG;AACH,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAyB;QACnD,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;KAC9F,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC;AAdD,4DAcC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[DecimalSeparatorSelector]] component.\r\n * @internal\r\n */\r\nexport interface DecimalSeparatorSelectorProps extends CommonProps {\r\n separator: string;\r\n disabled?: boolean;\r\n onChange: (value: string) => void;\r\n}\r\n\r\n/** Component use to set Decimal Separator\r\n * @internal\r\n */\r\nexport function DecimalSeparatorSelector(props: DecimalSeparatorSelectorProps) {\r\n const { separator, onChange, ...otherProps } = props;\r\n const options = React.useRef<SelectOption<string>[]>([\r\n { value: \".\", label: UiIModelComponents.translate(\"QuantityFormat.decimal_separator.point\") },\r\n { value: \",\", label: UiIModelComponents.translate(\"QuantityFormat.decimal_separator.comma\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: string) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={options.current} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"DecimalSeparator.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/DecimalSeparator.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAA4D;AAW5D;;GAEG;AACH,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAyB;QACnD,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;KAC9F,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC;AAdD,4DAcC","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 QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[DecimalSeparatorSelector]] component.\n * @internal\n */\nexport interface DecimalSeparatorSelectorProps extends CommonProps {\n separator: string;\n disabled?: boolean;\n onChange: (value: string) => void;\n}\n\n/** Component use to set Decimal Separator\n * @internal\n */\nexport function DecimalSeparatorSelector(props: DecimalSeparatorSelectorProps) {\n const { separator, onChange, ...otherProps } = props;\n const options = React.useRef<SelectOption<string>[]>([\n { value: \".\", label: UiIModelComponents.translate(\"QuantityFormat.decimal_separator.point\") },\n { value: \",\", label: UiIModelComponents.translate(\"QuantityFormat.decimal_separator.comma\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: string) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={options.current} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FractionPrecision.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/FractionPrecision.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAA4D;AAU5D;;GAEG;AACH,SAAgB,yBAAyB,CAAC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OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC;AArBD,8DAqBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[FractionPrecisionSelector]] component.\r\n * @internal\r\n */\r\nexport interface FractionPrecisionSelectorProps extends CommonProps {\r\n precision: number;\r\n onChange: (value: number) => void;\r\n}\r\n\r\n/** Component use to set Fraction precision\r\n * @internal\r\n */\r\nexport function FractionPrecisionSelector(props: FractionPrecisionSelectorProps) {\r\n const { precision, onChange, ...otherProps } = props;\r\n const options = React.useRef<SelectOption<number>[]>([\r\n { value: 1, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.whole\") },\r\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.half\") },\r\n { value: 4, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.quarter\") },\r\n { value: 8, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.eighth\") },\r\n { value: 16, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.sixteenth\") },\r\n { value: 32, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over32\") },\r\n { value: 64, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over64\") },\r\n { value: 128, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over128\") },\r\n { value: 256, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over256\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: number) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={options.current} value={precision} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"FractionPrecision.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/FractionPrecision.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAA4D;AAU5D;;GAEG;AACH,SAAgB,yBAAyB,CAAC,KAAqC;IAC7E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAyB;QACnD,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;QAC5F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC3F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;QAC9F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,0CAA0C,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,6CAA6C,CAAC,EAAE;QACjG,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,0CAA0C,CAAC,EAAE;QAC9F,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,0CAA0C,CAAC,EAAE;QAC9F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;QAChG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;KACjG,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC;AArBD,8DAqBC","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 QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[FractionPrecisionSelector]] component.\n * @internal\n */\nexport interface FractionPrecisionSelectorProps extends CommonProps {\n precision: number;\n onChange: (value: number) => void;\n}\n\n/** Component use to set Fraction precision\n * @internal\n */\nexport function FractionPrecisionSelector(props: FractionPrecisionSelectorProps) {\n const { precision, onChange, ...otherProps } = props;\n const options = React.useRef<SelectOption<number>[]>([\n { value: 1, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.whole\") },\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.half\") },\n { value: 4, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.quarter\") },\n { value: 8, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.eighth\") },\n { value: 16, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.sixteenth\") },\n { value: 32, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over32\") },\n { value: 64, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over64\") },\n { value: 128, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over128\") },\n { value: 256, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over256\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: number) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={options.current} value={precision} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ScientificType.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ScientificType.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAAsD;AACtD,wDAA4D;AAW5D;;GAEG;AACH,SAAgB,sBAAsB,CAAC,KAAkC;IACvE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAiC;QACjE,EAAE,KAAK,EAAE,8BAAc,CAAC,UAAU,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;QACtH,EAAE,KAAK,EAAE,8BAAc,CAAC,cAAc,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,gDAAgD,CAAC,EAAE;KAChI,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAwB,EAAE,EAAE;QACpE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC/G,CAAC;AACJ,CAAC;AAdD,wDAcC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { ScientificType } from \"@itwin/core-quantity\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[ScientificTypeSelector]] component.\r\n * @internal\r\n */\r\nexport interface ScientificTypeSelectorProps extends CommonProps {\r\n type: ScientificType;\r\n onChange: (value: ScientificType) => void;\r\n disabled?: boolean;\r\n}\r\n\r\n/** Component use to set Scientific type.\r\n * @internal\r\n */\r\nexport function ScientificTypeSelector(props: ScientificTypeSelectorProps) {\r\n const { type, onChange, ...otherProps } = props;\r\n const formatOptions = React.useRef<SelectOption<ScientificType>[]>([\r\n { value: ScientificType.Normalized, label: UiIModelComponents.translate(\"QuantityFormat.scientific-type.normalized\") },\r\n { value: ScientificType.ZeroNormalized, label: UiIModelComponents.translate(\"QuantityFormat.scientific-type.zero-normalized\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: ScientificType) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={formatOptions.current} value={type} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"ScientificType.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ScientificType.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAAsD;AACtD,wDAA4D;AAW5D;;GAEG;AACH,SAAgB,sBAAsB,CAAC,KAAkC;IACvE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAiC;QACjE,EAAE,KAAK,EAAE,8BAAc,CAAC,UAAU,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;QACtH,EAAE,KAAK,EAAE,8BAAc,CAAC,cAAc,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,gDAAgD,CAAC,EAAE;KAChI,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAwB,EAAE,EAAE;QACpE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC/G,CAAC;AACJ,CAAC;AAdD,wDAcC","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 QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { ScientificType } from \"@itwin/core-quantity\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[ScientificTypeSelector]] component.\n * @internal\n */\nexport interface ScientificTypeSelectorProps extends CommonProps {\n type: ScientificType;\n onChange: (value: ScientificType) => void;\n disabled?: boolean;\n}\n\n/** Component use to set Scientific type.\n * @internal\n */\nexport function ScientificTypeSelector(props: ScientificTypeSelectorProps) {\n const { type, onChange, ...otherProps } = props;\n const formatOptions = React.useRef<SelectOption<ScientificType>[]>([\n { value: ScientificType.Normalized, label: UiIModelComponents.translate(\"QuantityFormat.scientific-type.normalized\") },\n { value: ScientificType.ZeroNormalized, label: UiIModelComponents.translate(\"QuantityFormat.scientific-type.zero-normalized\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: ScientificType) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={formatOptions.current} value={type} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SignOption.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/SignOption.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAAsD;AACtD,wDAA4D;AAU5D;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAA8B;IAC/D,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAiC;QAC3D,EAAE,KAAK,EAAE,8BAAc,CAAC,MAAM,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,mCAAmC,CAAC,EAAE;QAC1G,EAAE,KAAK,EAAE,8BAAc,CAAC,YAAY,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;QACtH,EAAE,KAAK,EAAE,8BAAc,CAAC,UAAU,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAClH,EAAE,KAAK,EAAE,8BAAc,CAAC,mBAAmB,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,gDAAgD,CAAC,EAAE;KACrI,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAwB,EAAE,EAAE;QACpE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC/G,CAAC;AACJ,CAAC;AAhBD,gDAgBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { ShowSignOption } from \"@itwin/core-quantity\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[SignOptionSelector]] component.\r\n * @internal\r\n */\r\nexport interface SignOptionSelectorProps extends CommonProps {\r\n signOption: ShowSignOption;\r\n onChange: (value: ShowSignOption) => void;\r\n}\r\n\r\n/** Component use to set Sign option.\r\n * @internal\r\n */\r\nexport function SignOptionSelector(props: SignOptionSelectorProps) {\r\n const { signOption, onChange, ...otherProps } = props;\r\n const options = React.useRef<SelectOption<ShowSignOption>[]>([\r\n { value: ShowSignOption.NoSign, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.noSign\") },\r\n { value: ShowSignOption.OnlyNegative, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.onlyNegative\") },\r\n { value: ShowSignOption.SignAlways, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.signAlways\") },\r\n { value: ShowSignOption.NegativeParentheses, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.negativeParentheses\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: ShowSignOption) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={options.current} value={signOption} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"SignOption.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/SignOption.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAAsD;AACtD,wDAA4D;AAU5D;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAA8B;IAC/D,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAiC;QAC3D,EAAE,KAAK,EAAE,8BAAc,CAAC,MAAM,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,mCAAmC,CAAC,EAAE;QAC1G,EAAE,KAAK,EAAE,8BAAc,CAAC,YAAY,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;QACtH,EAAE,KAAK,EAAE,8BAAc,CAAC,UAAU,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAClH,EAAE,KAAK,EAAE,8BAAc,CAAC,mBAAmB,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,gDAAgD,CAAC,EAAE;KACrI,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAwB,EAAE,EAAE;QACpE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC/G,CAAC;AACJ,CAAC;AAhBD,gDAgBC","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 QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { ShowSignOption } from \"@itwin/core-quantity\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[SignOptionSelector]] component.\n * @internal\n */\nexport interface SignOptionSelectorProps extends CommonProps {\n signOption: ShowSignOption;\n onChange: (value: ShowSignOption) => void;\n}\n\n/** Component use to set Sign option.\n * @internal\n */\nexport function SignOptionSelector(props: SignOptionSelectorProps) {\n const { signOption, onChange, ...otherProps } = props;\n const options = React.useRef<SelectOption<ShowSignOption>[]>([\n { value: ShowSignOption.NoSign, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.noSign\") },\n { value: ShowSignOption.OnlyNegative, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.onlyNegative\") },\n { value: ShowSignOption.SignAlways, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.signAlways\") },\n { value: ShowSignOption.NegativeParentheses, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.negativeParentheses\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: ShowSignOption) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={options.current} value={signOption} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"StationSeparatorSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/StationSeparatorSelector.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAA4D;AAW5D;;GAEG;AACH,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAyB;QAC7D,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAC5F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;KAC9F,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC1C,MAAM,qBAAqB,GAA2B,EAAE,CAAC;QACzD,0GAA0G;QAC1G,IAAI,SAAS,KAAK,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;YACxF,qBAAqB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;SACpE;QACD,qBAAqB,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACzD,OAAO,qBAAqB,CAAC;IAC/B,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACnI,CAAC;AACJ,CAAC;AA1BD,4DA0BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[StationSeparatorSelector]] component.\r\n * @internal\r\n */\r\nexport interface StationSeparatorSelectorProps extends CommonProps {\r\n separator: string;\r\n disabled: boolean;\r\n onChange: (value: string) => void;\r\n}\r\n\r\n/** Component use to setStation separator.\r\n * @internal\r\n */\r\nexport function StationSeparatorSelector(props: StationSeparatorSelectorProps) {\r\n const { separator, disabled, onChange, ...otherProps } = props;\r\n const uomDefaultEntries = React.useRef<SelectOption<string>[]>([\r\n { value: \"+\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.plus\") },\r\n { value: \"-\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.minus\") },\r\n { value: \" \", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.blank\") },\r\n { value: \"^\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.caret\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: string) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n const separatorOptions = React.useMemo(() => {\r\n const completeListOfEntries: SelectOption<string>[] = [];\r\n // istanbul ignore next (only used if format already has a character that does not match standard options)\r\n if (undefined === uomDefaultEntries.current.find((option) => option.value === separator)) {\r\n completeListOfEntries.push({ value: separator, label: separator });\r\n }\r\n completeListOfEntries.push(...uomDefaultEntries.current);\r\n return completeListOfEntries;\r\n }, [separator]);\r\n\r\n return (\r\n <Select options={separatorOptions} disabled={disabled} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"StationSeparatorSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/StationSeparatorSelector.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAA4D;AAW5D;;GAEG;AACH,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAyB;QAC7D,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAC5F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;KAC9F,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC1C,MAAM,qBAAqB,GAA2B,EAAE,CAAC;QACzD,0GAA0G;QAC1G,IAAI,SAAS,KAAK,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;YACxF,qBAAqB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;SACpE;QACD,qBAAqB,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACzD,OAAO,qBAAqB,CAAC;IAC/B,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACnI,CAAC;AACJ,CAAC;AA1BD,4DA0BC","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 QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[StationSeparatorSelector]] component.\n * @internal\n */\nexport interface StationSeparatorSelectorProps extends CommonProps {\n separator: string;\n disabled: boolean;\n onChange: (value: string) => void;\n}\n\n/** Component use to setStation separator.\n * @internal\n */\nexport function StationSeparatorSelector(props: StationSeparatorSelectorProps) {\n const { separator, disabled, onChange, ...otherProps } = props;\n const uomDefaultEntries = React.useRef<SelectOption<string>[]>([\n { value: \"+\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.plus\") },\n { value: \"-\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.minus\") },\n { value: \" \", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.blank\") },\n { value: \"^\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.caret\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: string) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n const separatorOptions = React.useMemo(() => {\n const completeListOfEntries: SelectOption<string>[] = [];\n // istanbul ignore next (only used if format already has a character that does not match standard options)\n if (undefined === uomDefaultEntries.current.find((option) => option.value === separator)) {\n completeListOfEntries.push({ value: separator, label: separator });\n }\n completeListOfEntries.push(...uomDefaultEntries.current);\n return completeListOfEntries;\n }, [separator]);\n\n return (\n <Select options={separatorOptions} disabled={disabled} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"StationSizeSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/StationSizeSelector.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAA4D;AAW5D;;GAEG;AACH,SAAgB,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAC3D,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAyB;QAC5D,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,iCAAiC,CAAC,EAAE;QACpF,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,mCAAmC,CAAC,EAAE;KACvF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACvI,CAAC;AACJ,CAAC;AAdD,kDAcC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[StationSizeSelector]] component.\r\n * @internal\r\n */\r\nexport interface StationSizeSelectorProps extends CommonProps {\r\n value: number;\r\n disabled: boolean;\r\n onChange: (value: number) => void;\r\n}\r\n\r\n/** Component use to set Station size (number of digits from right until '+').\r\n * @internal\r\n */\r\nexport function StationSizeSelector(props: StationSizeSelectorProps) {\r\n const { value, disabled, onChange, ...otherProps } = props;\r\n const separatorOptions = React.useRef<SelectOption<number>[]>([\r\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.station_size.two\") },\r\n { value: 3, label: UiIModelComponents.translate(\"QuantityFormat.station_size.three\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: number) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={separatorOptions.current} disabled={disabled} value={value} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"StationSizeSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/StationSizeSelector.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAA4D;AAW5D;;GAEG;AACH,SAAgB,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAC3D,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAyB;QAC5D,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,iCAAiC,CAAC,EAAE;QACpF,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,mCAAmC,CAAC,EAAE;KACvF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACvI,CAAC;AACJ,CAAC;AAdD,kDAcC","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 QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[StationSizeSelector]] component.\n * @internal\n */\nexport interface StationSizeSelectorProps extends CommonProps {\n value: number;\n disabled: boolean;\n onChange: (value: number) => void;\n}\n\n/** Component use to set Station size (number of digits from right until '+').\n * @internal\n */\nexport function StationSizeSelector(props: StationSizeSelectorProps) {\n const { value, disabled, onChange, ...otherProps } = props;\n const separatorOptions = React.useRef<SelectOption<number>[]>([\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.station_size.two\") },\n { value: 3, label: UiIModelComponents.translate(\"QuantityFormat.station_size.three\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: number) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={separatorOptions.current} disabled={disabled} value={value} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ThousandsSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSelector.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iE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AAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACnI,CAAC;AACJ,CAAC;AAxBD,8CAwBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[ThousandsSelector]] component.\r\n * @internal\r\n */\r\nexport interface ThousandsSelectorProps extends CommonProps {\r\n separator: string;\r\n disabled: boolean;\r\n onChange: (value: string) => void;\r\n}\r\n\r\n/** Component use to set Quantity Format thousand group separator.\r\n * @internal\r\n */\r\nexport function ThousandsSelector(props: ThousandsSelectorProps) {\r\n const { separator, disabled, onChange, ...otherProps } = props;\r\n const uomDefaultEntries = React.useRef<SelectOption<string>[]>([\r\n { value: \",\", label: UiIModelComponents.translate(\"QuantityFormat.thousand_separator.comma\") },\r\n { value: \".\", label: UiIModelComponents.translate(\"QuantityFormat.thousand_separator.point\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: string) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n const separatorOptions = React.useMemo(() => {\r\n const completeListOfEntries: SelectOption<string>[] = [];\r\n // istanbul ignore next (only used if format already has a character that does not match standard options)\r\n if (undefined === uomDefaultEntries.current.find((option) => option.value === separator)) {\r\n completeListOfEntries.push({ value: separator, label: separator });\r\n }\r\n completeListOfEntries.push(...uomDefaultEntries.current);\r\n return completeListOfEntries;\r\n }, [separator]);\r\n\r\n return (\r\n <Select options={separatorOptions} disabled={disabled} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
1
+ {"version":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,CAAC;IAC/B,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACnI,CAAC;AACJ,CAAC;AAxBD,8CAwBC","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 QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[ThousandsSelector]] component.\n * @internal\n */\nexport interface ThousandsSelectorProps extends CommonProps {\n separator: string;\n disabled: boolean;\n onChange: (value: string) => void;\n}\n\n/** Component use to set Quantity Format thousand group separator.\n * @internal\n */\nexport function ThousandsSelector(props: ThousandsSelectorProps) {\n const { separator, disabled, onChange, ...otherProps } = props;\n const uomDefaultEntries = React.useRef<SelectOption<string>[]>([\n { value: \",\", label: UiIModelComponents.translate(\"QuantityFormat.thousand_separator.comma\") },\n { value: \".\", label: UiIModelComponents.translate(\"QuantityFormat.thousand_separator.point\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: string) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n const separatorOptions = React.useMemo(() => {\n const completeListOfEntries: SelectOption<string>[] = [];\n // istanbul ignore next (only used if format already has a character that does not match standard options)\n if (undefined === uomDefaultEntries.current.find((option) => option.value === separator)) {\n completeListOfEntries.push({ value: separator, label: separator });\n }\n completeListOfEntries.push(...uomDefaultEntries.current);\n return completeListOfEntries;\n }, [separator]);\n\n return (\n <Select options={separatorOptions} disabled={disabled} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ThousandsSeparator.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSeparator.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4DAAoC;AACpC,6CAA+B;AAE/B,wDAAyF;AACzF,wDAAgD;AAChD,2DAAwD;AACxD,iEAA8D;AAU9D;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAA8B;IAC/D,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAExC,MAAM,oBAAoB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAqB,EAAE,EAAE;QACvE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAmB,EAAE,SAAkB,EAAE,EAAE;QACnF,MAAM,QAAQ,GAAG,IAAA,8BAAc,EAAC,KAAK,CAAC,CAAC;QACvC,IAAI,YAAY,GAAa,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,SAAS,EAAE,EAAC,gBAAgB;YAC9B,uBAAuB;YACvB,IAAI,WAAW,CAAC,YAAY,EAAE;gBAC5B,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,0BAA0B,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBACxJ,YAAY,GAAG,CAAC,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC;aACtC;SACF;aAAM,EAAE,iBAAiB;YACxB,uBAAuB;YACvB,IAAI,WAAW,CAAC,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AAC;SAC1B;QACD,MAAM,cAAc,GAAG,EAAE,GAAG,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;QAC/E,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAE1D,MAAM,yBAAyB,GAAG,KAAK,CAAC,MAAM,CAAC,uCAAkB,CAAC,SAAS,CAAC,iDAAiD,CAAC,CAAC,CAAC;IAChI,MAAM,sBAAsB,GAAG,KAAK,CAAC,MAAM,CAAC,uCAAkB,CAAC,SAAS,CAAC,8CAA8C,CAAC,CAAC,CAAC;IAE1H,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,cAAc,IAAG,yBAAyB,CAAC,OAAO,CAAQ;QAC3E,oBAAC,wBAAQ,mBAAa,yBAAyB,EAAC,OAAO,EAAE,gBAAgB,CAAC,4BAAY,CAAC,gBAAgB,CAAC,EAAE,QAAQ,EAAE,iCAAiC,GAAI;QACzJ,8BAAM,SAAS,EAAE,IAAA,oBAAU,EAAC,cAAc,EAAE,CAAC,CAAC,gBAAgB,CAAC,4BAAY,CAAC,gBAAgB,CAAC,CAAC,IAAI,iBAAiB,CAAC,IAAG,sBAAsB,CAAC,OAAO,CAAQ;QAC7J,oBAAC,qCAAiB,mBAAa,8BAA8B,EAAC,SAAS,EAAE,WAAW,CAAC,iBAAiB,IAAI,GAAG,EAAE,QAAQ,EAAE,CAAC,gBAAgB,CAAC,4BAAY,CAAC,gBAAgB,CAAC,EAAE,QAAQ,EAAE,6BAA6B,GAAI,CACrN,CACJ,CAAC;AACJ,CAAC;AA5DD,gDA4DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { Format, FormatProps, FormatTraits, getTraitString } from \"@itwin/core-quantity\";\r\nimport { Checkbox } from \"@itwin/itwinui-react\";\r\nimport { ThousandsSelector } from \"./ThousandsSelector\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\n\r\n/** Properties of [[ThousandsSeparator]] component.\r\n * @internal\r\n */\r\nexport interface ThousandsSeparatorProps extends CommonProps {\r\n formatProps: FormatProps;\r\n onChange?: (format: FormatProps) => void;\r\n}\r\n\r\n/** Component use to set Quantity Format thousand group separator.\r\n * @internal\r\n */\r\nexport function ThousandsSeparator(props: ThousandsSeparatorProps) {\r\n const { formatProps, onChange } = props;\r\n\r\n const handleSetFormatProps = React.useCallback((newProps: FormatProps) => {\r\n onChange && onChange(newProps);\r\n }, [onChange]);\r\n\r\n const setFormatTrait = React.useCallback((trait: FormatTraits, setActive: boolean) => {\r\n const traitStr = getTraitString(trait);\r\n let formatTraits: string[] = [traitStr];\r\n if (setActive) {// setting trait\r\n // istanbul ignore else\r\n if (formatProps.formatTraits) {\r\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\r\n formatTraits = [...traits, traitStr];\r\n }\r\n } else { // clearing trait\r\n // istanbul ignore else\r\n if (formatProps.formatTraits) {\r\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\r\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\r\n }\r\n }\r\n const newFormatProps = { ...formatProps, formatTraits };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleUseThousandsSeparatorChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.Use1000Separator, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const isFormatTraitSet = React.useCallback((trait: FormatTraits) => {\r\n return Format.isFormatTraitSetInProps(formatProps, trait);\r\n }, [formatProps]);\r\n\r\n const handleThousandSeparatorChange = React.useCallback((thousandSeparator: string) => {\r\n let decimalSeparator = formatProps.decimalSeparator;\r\n // make sure 1000 and decimal separator do not match\r\n // istanbul ignore else\r\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\r\n if (thousandSeparator === \".\")\r\n decimalSeparator = \",\";\r\n else // thousandSeparator === \",\"\r\n decimalSeparator = \".\";\r\n }\r\n const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, isFormatTraitSet, handleSetFormatProps]);\r\n\r\n const useThousandSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.useThousandSeparatorLabel\"));\r\n const thousandSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.thousandSeparatorLabel\"));\r\n\r\n return (\r\n <>\r\n <span className={\"uicore-label\"}>{useThousandSeparatorLabel.current}</span>\r\n <Checkbox data-testid=\"use-thousands-separator\" checked={isFormatTraitSet(FormatTraits.Use1000Separator)} onChange={handleUseThousandsSeparatorChange} />\r\n <span className={classnames(\"uicore-label\", !(isFormatTraitSet(FormatTraits.Use1000Separator)) && \"uicore-disabled\")}>{thousandSeparatorLabel.current}</span>\r\n <ThousandsSelector data-testid=\"thousands-separator-selector\" separator={formatProps.thousandSeparator ?? \",\"} disabled={!isFormatTraitSet(FormatTraits.Use1000Separator)} onChange={handleThousandSeparatorChange} />\r\n </>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"ThousandsSeparator.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSeparator.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4DAAoC;AACpC,6CAA+B;AAE/B,wDAAyF;AACz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AAC,iDAAiD,CAAC,CAAC,CAAC;IAChI,MAAM,sBAAsB,GAAG,KAAK,CAAC,MAAM,CAAC,uCAAkB,CAAC,SAAS,CAAC,8CAA8C,CAAC,CAAC,CAAC;IAE1H,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,cAAc,IAAG,yBAAyB,CAAC,OAAO,CAAQ;QAC3E,oBAAC,wBAAQ,mBAAa,yBAAyB,EAAC,OAAO,EAAE,gBAAgB,CAAC,4BAAY,CAAC,gBAAgB,CAAC,EAAE,QAAQ,EAAE,iCAAiC,GAAI;QACzJ,8BAAM,SAAS,EAAE,IAAA,oBAAU,EAAC,cAAc,EAAE,CAAC,CAAC,gBAAgB,CAAC,4BAAY,CAAC,gBAAgB,CAAC,CAAC,IAAI,iBAAiB,CAAC,IAAG,sBAAsB,CAAC,OAAO,CAAQ;QAC7J,oBAAC,qCAAiB,mBAAa,8BAA8B,EAAC,SAAS,EAAE,WAAW,CAAC,iBAAiB,IAAI,GAAG,EAAE,QAAQ,EAAE,CAAC,gBAAgB,CAAC,4BAAY,CAAC,gBAAgB,CAAC,EAAE,QAAQ,EAAE,6BAA6B,GAAI,CACrN,CACJ,CAAC;AACJ,CAAC;AA5DD,gDA4DC","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 QuantityFormat\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { Format, FormatProps, FormatTraits, getTraitString } from \"@itwin/core-quantity\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { ThousandsSelector } from \"./ThousandsSelector\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\n\n/** Properties of [[ThousandsSeparator]] component.\n * @internal\n */\nexport interface ThousandsSeparatorProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n}\n\n/** Component use to set Quantity Format thousand group separator.\n * @internal\n */\nexport function ThousandsSeparator(props: ThousandsSeparatorProps) {\n const { formatProps, onChange } = props;\n\n const handleSetFormatProps = React.useCallback((newProps: FormatProps) => {\n onChange && onChange(newProps);\n }, [onChange]);\n\n const setFormatTrait = React.useCallback((trait: FormatTraits, setActive: boolean) => {\n const traitStr = getTraitString(trait);\n let formatTraits: string[] = [traitStr];\n if (setActive) {// setting trait\n // istanbul ignore else\n if (formatProps.formatTraits) {\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\n formatTraits = [...traits, traitStr];\n }\n } else { // clearing trait\n // istanbul ignore else\n if (formatProps.formatTraits) {\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\n }\n }\n const newFormatProps = { ...formatProps, formatTraits };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const handleUseThousandsSeparatorChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.Use1000Separator, e.target.checked);\n }, [setFormatTrait]);\n\n const isFormatTraitSet = React.useCallback((trait: FormatTraits) => {\n return Format.isFormatTraitSetInProps(formatProps, trait);\n }, [formatProps]);\n\n const handleThousandSeparatorChange = React.useCallback((thousandSeparator: string) => {\n let decimalSeparator = formatProps.decimalSeparator;\n // make sure 1000 and decimal separator do not match\n // istanbul ignore else\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\n if (thousandSeparator === \".\")\n decimalSeparator = \",\";\n else // thousandSeparator === \",\"\n decimalSeparator = \".\";\n }\n const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, isFormatTraitSet, handleSetFormatProps]);\n\n const useThousandSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.useThousandSeparatorLabel\"));\n const thousandSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.thousandSeparatorLabel\"));\n\n return (\n <>\n <span className={\"uicore-label\"}>{useThousandSeparatorLabel.current}</span>\n <Checkbox data-testid=\"use-thousands-separator\" checked={isFormatTraitSet(FormatTraits.Use1000Separator)} onChange={handleUseThousandsSeparatorChange} />\n <span className={classnames(\"uicore-label\", !(isFormatTraitSet(FormatTraits.Use1000Separator)) && \"uicore-disabled\")}>{thousandSeparatorLabel.current}</span>\n <ThousandsSelector data-testid=\"thousands-separator-selector\" separator={formatProps.thousandSeparator ?? \",\"} disabled={!isFormatTraitSet(FormatTraits.Use1000Separator)} onChange={handleThousandSeparatorChange} />\n </>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"UnitDescr.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/UnitDescr.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAG/B,wDAAmE;AAgBnE,KAAK,UAAU,qBAAqB,CAAC,aAA0B,EAAE,MAAiB,EAAE,aAA4B;IAC9G,MAAM,qBAAqB,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC7D,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACnE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,UAAqB,EAAE,aAA4B,EAAE,yBAAkC;IACrH,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;IACzC,MAAM,aAAa,GAAG,MAAM,aAAa,CA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,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAChE,YAAY,IAAI,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;IAE1B,MAAM,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAsC,EAAE,EAAE;QACvF,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,aAAa,IAAI,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;IAE3B,OAAO,CACL;QACE,oBAAC,sBAAM,IAAC,OAAO,EAAE,WAAW,iBAAe,QAAQ,WAAW,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,KAAK,EAAE,EACtH,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAC,OAAO,GAAG;QACnE,oBAAC,qBAAK,mBAAc,cAAc,WAAW,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAC,OAAO,GAAG,CACjH,CACJ,CAAC;AACJ,CAAC;AArED,8BAqEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { Input, Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[UnitDescr]] component.\r\n * @internal\r\n */\r\nexport interface UnitDescrProps extends CommonProps {\r\n name: string;\r\n parentUnitName?: string;\r\n label: string;\r\n index: number;\r\n unitsProvider: UnitsProvider;\r\n readonly?: boolean;\r\n onUnitChange: (value: string, index: number) => void;\r\n onLabelChange: (value: string, index: number) => void;\r\n}\r\n\r\nasync function getUnitConversionData(possibleUnits: UnitProps[], toUnit: UnitProps, unitsProvider: UnitsProvider) {\r\n const unitConversionEntries = possibleUnits.map(async (unit) => {\r\n const conversion = await unitsProvider.getConversion(unit, toUnit);\r\n return { conversion, unitProps: unit };\r\n });\r\n return unitConversionEntries;\r\n}\r\n\r\nasync function getPossibleUnits(parentUnit: UnitProps, unitsProvider: UnitsProvider, ensureCompatibleComposite: boolean) {\r\n const phenomenon = parentUnit.phenomenon;\r\n const possibleUnits = await unitsProvider.getUnitsByFamily(phenomenon);\r\n if (!ensureCompatibleComposite)\r\n return possibleUnits;\r\n\r\n const conversionPromises = await getUnitConversionData(possibleUnits, parentUnit, unitsProvider);\r\n const conversionEntries = await Promise.all(conversionPromises);\r\n // sort the entries so the best potential sub unit will be the first one in the array\r\n return conversionEntries.filter((entry) => ((entry.unitProps.system === parentUnit.system) && (entry.conversion.factor < 1)))\r\n .sort((a, b) => b.conversion.factor - a.conversion.factor)\r\n .map((value) => value.unitProps);\r\n}\r\n\r\nfunction getUnitName(fullUnitName: string) {\r\n const nameParts = fullUnitName.split(/[.:]/);\r\n // istanbul ignore else\r\n if (nameParts.length > 0)\r\n return nameParts[nameParts.length - 1];\r\n // istanbul ignore next\r\n throw Error(\"Bad unit name encountered\");\r\n}\r\n\r\n/** Component use to display dropdown list of possible units.\r\n * @internal\r\n */\r\nexport function UnitDescr(props: UnitDescrProps) {\r\n const { name, label, parentUnitName, index, onUnitChange, onLabelChange, readonly, unitsProvider } = props;\r\n const [unitOptions, setUnitOptions] = React.useState<SelectOption<string>[]>([{ value: name, label: getUnitName(name) }]);\r\n const [currentUnit, setCurrentUnit] = React.useState({ name, label });\r\n const isMounted = React.useRef(false);\r\n\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n });\r\n\r\n React.useEffect(() => {\r\n async function fetchAllowableUnitSelections() {\r\n const currentUnitProps = await unitsProvider.findUnitByName(name);\r\n const parentUnit = await unitsProvider.findUnitByName(parentUnitName ? parentUnitName : name);\r\n // istanbul ignore else\r\n if (parentUnit && currentUnitProps) {\r\n let potentialSubUnit: UnitProps | undefined;\r\n const potentialUnits = await getPossibleUnits(parentUnit, unitsProvider, index !== 0);\r\n // istanbul ignore else\r\n if (index < 3) {\r\n const potentialSubUnits = await getPossibleUnits(currentUnitProps, unitsProvider, true);\r\n if (potentialSubUnits.length)\r\n potentialSubUnit = potentialSubUnits[0];\r\n }\r\n\r\n const options = (potentialUnits.length > 0) ?\r\n potentialUnits.map((unitValue) => {\r\n return { value: `${unitValue.name}:${unitValue.label}`, label: getUnitName(unitValue.name) };\r\n }).sort((a, b) => a.label.localeCompare(b.label))\r\n : /* istanbul ignore next */\r\n [{ value: `${currentUnitProps.name}:${currentUnitProps.label}`, label: getUnitName(name) }];\r\n\r\n if (potentialSubUnit) {\r\n // construct an entry that will provide the name and label of the unit to add\r\n options.push({ value: `ADDSUBUNIT:${potentialSubUnit.name}:${potentialSubUnit.label}`, label: \"Add sub-unit\" }); // NEEDSWORK - i18n\r\n }\r\n\r\n if (index !== 0)\r\n options.push({ value: \"REMOVEUNIT\", label: \"Remove\" }); // NEEDSWORK - i18n\r\n\r\n // istanbul ignore else\r\n if (isMounted.current) {\r\n setUnitOptions(options);\r\n setCurrentUnit(currentUnitProps);\r\n }\r\n }\r\n }\r\n fetchAllowableUnitSelections(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }, [index, label, name, parentUnitName, unitsProvider]);\r\n\r\n const handleOnUnitChange = React.useCallback((newValue: string) => {\r\n onUnitChange && onUnitChange(newValue, index);\r\n }, [index, onUnitChange]);\r\n\r\n const handleOnLabelChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n e.preventDefault();\r\n onLabelChange && onLabelChange(e.target.value, index);\r\n }, [index, onLabelChange]);\r\n\r\n return (\r\n <>\r\n <Select options={unitOptions} data-testid={`unit-${currentUnit.name}`} value={`${currentUnit.name}:${currentUnit.label}`}\r\n onChange={handleOnUnitChange} disabled={readonly} size=\"small\" />\r\n <Input data-testid={`unit-label-${currentUnit.name}`} value={label} onChange={handleOnLabelChange} size=\"small\" />\r\n </>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"UnitDescr.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/UnitDescr.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAG/B,wDAAmE;AAgBnE,KAAK,UAAU,qBAAqB,CAAC,aAA0B,EAAE,MAAiB,EAAE,aAA4B;IAC9G,MAAM,qBAAqB,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC7D,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACnE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,UAAqB,EAAE,aAA4B,EAAE,yBAAkC;IACrH,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;IACzC,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACvE,IAAI,CAAC,yBAAyB;QAC5B,OAAO,aAAa,CAAC;IAEvB,MAAM,kBAAkB,GAAG,MAAM,qBAAqB,CAAC,aAAa,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IACjG,MAAM,iBAAiB,GAAG,MAAM,OAAO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C,WAAW,CAAC,CAAC,CAAsC,EAAE,EAAE;QACvF,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,aAAa,IAAI,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;IAE3B,OAAO,CACL;QACE,oBAAC,sBAAM,IAAC,OAAO,EAAE,WAAW,iBAAe,QAAQ,WAAW,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,KAAK,EAAE,EACtH,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAC,OAAO,GAAG;QACnE,oBAAC,qBAAK,mBAAc,cAAc,WAAW,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAC,OAAO,GAAG,CACjH,CACJ,CAAC;AACJ,CAAC;AArED,8BAqEC","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 QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { Input, Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[UnitDescr]] component.\n * @internal\n */\nexport interface UnitDescrProps extends CommonProps {\n name: string;\n parentUnitName?: string;\n label: string;\n index: number;\n unitsProvider: UnitsProvider;\n readonly?: boolean;\n onUnitChange: (value: string, index: number) => void;\n onLabelChange: (value: string, index: number) => void;\n}\n\nasync function getUnitConversionData(possibleUnits: UnitProps[], toUnit: UnitProps, unitsProvider: UnitsProvider) {\n const unitConversionEntries = possibleUnits.map(async (unit) => {\n const conversion = await unitsProvider.getConversion(unit, toUnit);\n return { conversion, unitProps: unit };\n });\n return unitConversionEntries;\n}\n\nasync function getPossibleUnits(parentUnit: UnitProps, unitsProvider: UnitsProvider, ensureCompatibleComposite: boolean) {\n const phenomenon = parentUnit.phenomenon;\n const possibleUnits = await unitsProvider.getUnitsByFamily(phenomenon);\n if (!ensureCompatibleComposite)\n return possibleUnits;\n\n const conversionPromises = await getUnitConversionData(possibleUnits, parentUnit, unitsProvider);\n const conversionEntries = await Promise.all(conversionPromises);\n // sort the entries so the best potential sub unit will be the first one in the array\n return conversionEntries.filter((entry) => ((entry.unitProps.system === parentUnit.system) && (entry.conversion.factor < 1)))\n .sort((a, b) => b.conversion.factor - a.conversion.factor)\n .map((value) => value.unitProps);\n}\n\nfunction getUnitName(fullUnitName: string) {\n const nameParts = fullUnitName.split(/[.:]/);\n // istanbul ignore else\n if (nameParts.length > 0)\n return nameParts[nameParts.length - 1];\n // istanbul ignore next\n throw Error(\"Bad unit name encountered\");\n}\n\n/** Component use to display dropdown list of possible units.\n * @internal\n */\nexport function UnitDescr(props: UnitDescrProps) {\n const { name, label, parentUnitName, index, onUnitChange, onLabelChange, readonly, unitsProvider } = props;\n const [unitOptions, setUnitOptions] = React.useState<SelectOption<string>[]>([{ value: name, label: getUnitName(name) }]);\n const [currentUnit, setCurrentUnit] = React.useState({ name, label });\n const isMounted = React.useRef(false);\n\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n });\n\n React.useEffect(() => {\n async function fetchAllowableUnitSelections() {\n const currentUnitProps = await unitsProvider.findUnitByName(name);\n const parentUnit = await unitsProvider.findUnitByName(parentUnitName ? parentUnitName : name);\n // istanbul ignore else\n if (parentUnit && currentUnitProps) {\n let potentialSubUnit: UnitProps | undefined;\n const potentialUnits = await getPossibleUnits(parentUnit, unitsProvider, index !== 0);\n // istanbul ignore else\n if (index < 3) {\n const potentialSubUnits = await getPossibleUnits(currentUnitProps, unitsProvider, true);\n if (potentialSubUnits.length)\n potentialSubUnit = potentialSubUnits[0];\n }\n\n const options = (potentialUnits.length > 0) ?\n potentialUnits.map((unitValue) => {\n return { value: `${unitValue.name}:${unitValue.label}`, label: getUnitName(unitValue.name) };\n }).sort((a, b) => a.label.localeCompare(b.label))\n : /* istanbul ignore next */\n [{ value: `${currentUnitProps.name}:${currentUnitProps.label}`, label: getUnitName(name) }];\n\n if (potentialSubUnit) {\n // construct an entry that will provide the name and label of the unit to add\n options.push({ value: `ADDSUBUNIT:${potentialSubUnit.name}:${potentialSubUnit.label}`, label: \"Add sub-unit\" }); // NEEDSWORK - i18n\n }\n\n if (index !== 0)\n options.push({ value: \"REMOVEUNIT\", label: \"Remove\" }); // NEEDSWORK - i18n\n\n // istanbul ignore else\n if (isMounted.current) {\n setUnitOptions(options);\n setCurrentUnit(currentUnitProps);\n }\n }\n }\n fetchAllowableUnitSelections(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }, [index, label, name, parentUnitName, unitsProvider]);\n\n const handleOnUnitChange = React.useCallback((newValue: string) => {\n onUnitChange && onUnitChange(newValue, index);\n }, [index, onUnitChange]);\n\n const handleOnLabelChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n e.preventDefault();\n onLabelChange && onLabelChange(e.target.value, index);\n }, [index, onLabelChange]);\n\n return (\n <>\n <Select options={unitOptions} data-testid={`unit-${currentUnit.name}`} value={`${currentUnit.name}:${currentUnit.label}`}\n onChange={handleOnUnitChange} disabled={readonly} size=\"small\" />\n <Input data-testid={`unit-label-${currentUnit.name}`} value={label} onChange={handleOnLabelChange} size=\"small\" />\n </>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BaseSolarDataProvider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/BaseSolarDataProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAA+C;AAC/C,oDAAmG;AAInG,MAAM,iBAAiB,GAAG,IAAI,GAA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ACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CAKF;AAxJD,sDAwJC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Timeline\r\n */\r\n\r\nimport { Point3d } from \"@itwin/core-geometry\";\r\nimport { calculateSunriseOrSunset, Cartographic, ColorByName, ColorDef } from \"@itwin/core-common\";\r\nimport { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\r\nimport { SolarDataProvider } from \"./interfaces\";\r\n\r\nconst millisecPerMinute = 1000 * 60;\r\nconst millisecPerHour = millisecPerMinute * 60;\r\n\r\n// the interface and class are in alpha state - it may change after usability testing - test coverage not complete\r\n/* istanbul ignore file */\r\n\r\n/** Base class that provides solar data for animation control\r\n * @alpha\r\n */\r\nexport class BaseSolarDataProvider implements SolarDataProvider {\r\n protected _projectTimeZoneOffset: number; // used to convert between project time and local time\r\n protected _viewport: ScreenViewport | undefined;\r\n protected _cartographicCenter: Cartographic;\r\n protected _shadowColor = ColorDef.create(ColorByName.gray);\r\n\r\n public longitude: number = -75.17035; // long/lat of Philadelphia\r\n public latitude: number = 39.954927;\r\n public viewId = \"\"; // View Id used to determine sunrise and sunset\r\n public supportsTimelineAnimation = false; // set to true when provider determines animation data is available.\r\n public animationFraction: number = 0; // value from 0.0 to 1.0 that specifies the percentage complete for the animation.\r\n\r\n private _projectDayStartMS = 0;\r\n private _projectSunriseMs = 0;\r\n private _projectSunsetMs = 0;\r\n private _zoneOffsetMs = 0;\r\n private _projectSunrise = new Date();\r\n private _projectSunset = new Date();\r\n private _projectDateTime = new Date();\r\n private _projectDay = new Date();\r\n\r\n // projectTimeZoneOffset = zone offset in hours\r\n protected initializeData(projectTimeZoneOffset: number, initialTime?: Date) {\r\n if (!initialTime)\r\n initialTime = new Date(Date.now()); // users local time\r\n\r\n this._zoneOffsetMs = projectTimeZoneOffset * millisecPerHour;\r\n const year=initialTime.getFullYear();\r\n const month=initialTime.getMonth();\r\n const date=initialTime.getDate();\r\n const hours=initialTime.getHours();\r\n const minutes=initialTime.getMinutes();\r\n const initialUtcMs = Date.UTC(year, month, date, hours, minutes, 0, 0);\r\n const initialProjectMs = initialUtcMs - this._zoneOffsetMs;\r\n this._projectDateTime = new Date (initialProjectMs);\r\n\r\n const utcDayMs = Date.UTC(year, month, date, 0, 0, 0, 0);\r\n const utcDay = new Date(utcDayMs);\r\n this._projectDayStartMS = utcDayMs - this._zoneOffsetMs;\r\n this._projectDay = new Date (this._projectDayStartMS);\r\n this._projectSunrise = calculateSunriseOrSunset(utcDay, this._cartographicCenter, true);\r\n this._projectSunset = calculateSunriseOrSunset(utcDay, this._cartographicCenter, false);\r\n this._projectSunriseMs = this._projectSunrise.getTime();\r\n this._projectSunsetMs = this._projectSunset.getTime();\r\n }\r\n\r\n constructor(viewport?: ScreenViewport, longitude?: number, latitude?: number) {\r\n this._viewport = viewport;\r\n if (longitude)\r\n this.longitude = longitude;\r\n if (latitude)\r\n this.latitude = latitude;\r\n\r\n if (viewport)\r\n this.viewId = viewport.view.id;\r\n\r\n // project location\r\n this._cartographicCenter = Cartographic.fromDegrees({longitude: this.longitude, latitude: this.latitude, height: 0.0});\r\n this._projectTimeZoneOffset = this.getZone(this._cartographicCenter);\r\n\r\n this.initializeData(this._projectTimeZoneOffset);\r\n }\r\n\r\n public get timeZoneOffset(): number {\r\n return this._projectTimeZoneOffset;\r\n }\r\n\r\n public get shadowColor(): ColorDef {\r\n return this._shadowColor;\r\n }\r\n\r\n public set shadowColor(color: ColorDef) {\r\n this._shadowColor = color;\r\n }\r\n\r\n public get shouldShowTimeline() {\r\n return false;\r\n }\r\n\r\n /** Get time at project location */\r\n public get timeOfDay(): Date {\r\n return this._projectDateTime;\r\n }\r\n\r\n /** The date can be in project time or if isProjectDate is false, it is assumed to be users current local time\r\n * which will be adjusted to the same time at project location. */\r\n public setDateAndTime(date: Date, isProjectDate?: boolean) {\r\n let userDay = date;\r\n\r\n // convert date from user date to project location\r\n if (isProjectDate) {\r\n const userOffset = date.getTimezoneOffset() * millisecPerMinute;\r\n userDay = new Date(date.getTime() - userOffset - this._zoneOffsetMs);\r\n }\r\n\r\n this.initializeData(this._projectTimeZoneOffset, userDay);\r\n }\r\n\r\n /** Project Day Start */\r\n public get day(): Date {\r\n return this._projectDay;\r\n }\r\n\r\n /** Project Day Start in milliseconds */\r\n public get dayStartMs(): number {\r\n return this._projectDayStartMS;\r\n }\r\n\r\n public getCartographicCenter(iModel: IModelConnection): Cartographic {\r\n if (iModel.isGeoLocated) {\r\n const projectExtents = iModel.projectExtents;\r\n const projectCenter = Point3d.createAdd2Scaled(projectExtents.low, .5, projectExtents.high, .5);\r\n return iModel.spatialToCartographicFromEcef(projectCenter);\r\n }\r\n return Cartographic.fromDegrees({longitude: this.longitude, latitude: this.latitude, height: 0.0});\r\n }\r\n\r\n public set viewport(viewport: ScreenViewport | undefined) {\r\n this._viewport = viewport;\r\n if (viewport)\r\n this.viewId = viewport.view.id;\r\n else\r\n this.viewId = \"\";\r\n }\r\n\r\n public get viewport(): ScreenViewport | undefined {\r\n return this._viewport;\r\n }\r\n\r\n protected getZone(location: Cartographic) {\r\n return Math.floor(.5 + location.longitudeDegrees / 15.0);\r\n }\r\n\r\n public get sunrise(): Date {\r\n return this._projectSunrise;\r\n }\r\n\r\n public get sunriseMs(): number {\r\n return this._projectSunriseMs;\r\n }\r\n\r\n public get sunset(): Date {\r\n return this._projectSunset;\r\n }\r\n\r\n public get sunsetMs(): number {\r\n return this._projectSunsetMs;\r\n }\r\n\r\n public onTimeChanged = (_time: Date) => {\r\n // to be implemented by derived class\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"BaseSolarDataProvider.js","sourceRoot":"","sources":["../../../../src/im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AAW,OAAO;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CAKF;AAxJD,sDAwJC","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 Timeline\n */\n\nimport { Point3d } from \"@itwin/core-geometry\";\nimport { calculateSunriseOrSunset, Cartographic, ColorByName, ColorDef } from \"@itwin/core-common\";\nimport { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport { SolarDataProvider } from \"./interfaces\";\n\nconst millisecPerMinute = 1000 * 60;\nconst millisecPerHour = millisecPerMinute * 60;\n\n// the interface and class are in alpha state - it may change after usability testing - test coverage not complete\n/* istanbul ignore file */\n\n/** Base class that provides solar data for animation control\n * @alpha\n */\nexport class BaseSolarDataProvider implements SolarDataProvider {\n protected _projectTimeZoneOffset: number; // used to convert between project time and local time\n protected _viewport: ScreenViewport | undefined;\n protected _cartographicCenter: Cartographic;\n protected _shadowColor = ColorDef.create(ColorByName.gray);\n\n public longitude: number = -75.17035; // long/lat of Philadelphia\n public latitude: number = 39.954927;\n public viewId = \"\"; // View Id used to determine sunrise and sunset\n public supportsTimelineAnimation = false; // set to true when provider determines animation data is available.\n public animationFraction: number = 0; // value from 0.0 to 1.0 that specifies the percentage complete for the animation.\n\n private _projectDayStartMS = 0;\n private _projectSunriseMs = 0;\n private _projectSunsetMs = 0;\n private _zoneOffsetMs = 0;\n private _projectSunrise = new Date();\n private _projectSunset = new Date();\n private _projectDateTime = new Date();\n private _projectDay = new Date();\n\n // projectTimeZoneOffset = zone offset in hours\n protected initializeData(projectTimeZoneOffset: number, initialTime?: Date) {\n if (!initialTime)\n initialTime = new Date(Date.now()); // users local time\n\n this._zoneOffsetMs = projectTimeZoneOffset * millisecPerHour;\n const year=initialTime.getFullYear();\n const month=initialTime.getMonth();\n const date=initialTime.getDate();\n const hours=initialTime.getHours();\n const minutes=initialTime.getMinutes();\n const initialUtcMs = Date.UTC(year, month, date, hours, minutes, 0, 0);\n const initialProjectMs = initialUtcMs - this._zoneOffsetMs;\n this._projectDateTime = new Date (initialProjectMs);\n\n const utcDayMs = Date.UTC(year, month, date, 0, 0, 0, 0);\n const utcDay = new Date(utcDayMs);\n this._projectDayStartMS = utcDayMs - this._zoneOffsetMs;\n this._projectDay = new Date (this._projectDayStartMS);\n this._projectSunrise = calculateSunriseOrSunset(utcDay, this._cartographicCenter, true);\n this._projectSunset = calculateSunriseOrSunset(utcDay, this._cartographicCenter, false);\n this._projectSunriseMs = this._projectSunrise.getTime();\n this._projectSunsetMs = this._projectSunset.getTime();\n }\n\n constructor(viewport?: ScreenViewport, longitude?: number, latitude?: number) {\n this._viewport = viewport;\n if (longitude)\n this.longitude = longitude;\n if (latitude)\n this.latitude = latitude;\n\n if (viewport)\n this.viewId = viewport.view.id;\n\n // project location\n this._cartographicCenter = Cartographic.fromDegrees({longitude: this.longitude, latitude: this.latitude, height: 0.0});\n this._projectTimeZoneOffset = this.getZone(this._cartographicCenter);\n\n this.initializeData(this._projectTimeZoneOffset);\n }\n\n public get timeZoneOffset(): number {\n return this._projectTimeZoneOffset;\n }\n\n public get shadowColor(): ColorDef {\n return this._shadowColor;\n }\n\n public set shadowColor(color: ColorDef) {\n this._shadowColor = color;\n }\n\n public get shouldShowTimeline() {\n return false;\n }\n\n /** Get time at project location */\n public get timeOfDay(): Date {\n return this._projectDateTime;\n }\n\n /** The date can be in project time or if isProjectDate is false, it is assumed to be users current local time\n * which will be adjusted to the same time at project location. */\n public setDateAndTime(date: Date, isProjectDate?: boolean) {\n let userDay = date;\n\n // convert date from user date to project location\n if (isProjectDate) {\n const userOffset = date.getTimezoneOffset() * millisecPerMinute;\n userDay = new Date(date.getTime() - userOffset - this._zoneOffsetMs);\n }\n\n this.initializeData(this._projectTimeZoneOffset, userDay);\n }\n\n /** Project Day Start */\n public get day(): Date {\n return this._projectDay;\n }\n\n /** Project Day Start in milliseconds */\n public get dayStartMs(): number {\n return this._projectDayStartMS;\n }\n\n public getCartographicCenter(iModel: IModelConnection): Cartographic {\n if (iModel.isGeoLocated) {\n const projectExtents = iModel.projectExtents;\n const projectCenter = Point3d.createAdd2Scaled(projectExtents.low, .5, projectExtents.high, .5);\n return iModel.spatialToCartographicFromEcef(projectCenter);\n }\n return Cartographic.fromDegrees({longitude: this.longitude, latitude: this.latitude, height: 0.0});\n }\n\n public set viewport(viewport: ScreenViewport | undefined) {\n this._viewport = viewport;\n if (viewport)\n this.viewId = viewport.view.id;\n else\n this.viewId = \"\";\n }\n\n public get viewport(): ScreenViewport | undefined {\n return this._viewport;\n }\n\n protected getZone(location: Cartographic) {\n return Math.floor(.5 + location.longitudeDegrees / 15.0);\n }\n\n public get sunrise(): Date {\n return this._projectSunrise;\n }\n\n public get sunriseMs(): number {\n return this._projectSunriseMs;\n }\n\n public get sunset(): Date {\n return this._projectSunset;\n }\n\n public get sunsetMs(): number {\n return this._projectSunsetMs;\n }\n\n public onTimeChanged = (_time: Date) => {\n // to be implemented by derived class\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BaseTimelineDataProvider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/BaseTimelineDataProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH;;GAEG;AACH,MAAa,wBAAwB;IAUnC,YAAY,QAAyB;QATrB,OAAE,GAAG,0BAA0B,CAAC;QAGzC,WAAM,GAAG,EAAE,CAAC;QAEZ,8BAAyB,GAAG,KAAK,CAAC,CAAC,oEAAoE;QACvG,sBAAiB,G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,CAAC,CAAC,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAK,CAAC;IAC/G,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,cAAc,CAAC,QAA0B;QAC9C,IAAI,CAAC,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,QAAQ,EAAE,CAAC;IACtD,CAAC;CASF;AAtED,4DAsEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Timeline\r\n */\r\n\r\nimport { ScreenViewport } from \"@itwin/core-frontend\";\r\nimport { PlaybackSettings, TimelineDataProvider } from \"./interfaces\";\r\n\r\n/** Base Timeline Data Provider\r\n * @alpha\r\n */\r\nexport class BaseTimelineDataProvider implements TimelineDataProvider {\r\n public readonly id = \"TestTimelineDataProvider\";\r\n public start: Date | undefined;\r\n public end: Date | undefined;\r\n public viewId = \"\";\r\n\r\n public supportsTimelineAnimation = false; // set to true when provider determines animation data is available.\r\n public animationFraction: number = 0; // value from 0.0 to 1.0 that specifies the percentage complete for the animation.\r\n protected _viewport: ScreenViewport | undefined;\r\n\r\n constructor(viewport?: ScreenViewport) {\r\n this._viewport = viewport;\r\n // istanbul ignore if - WIP\r\n if (viewport)\r\n this.viewId = viewport.view.id;\r\n }\r\n\r\n protected _settings: PlaybackSettings = {\r\n duration: 20 * 1000,\r\n loop: true,\r\n };\r\n\r\n // istanbul ignore next\r\n public async loadTimelineData(): Promise<boolean> {\r\n return false;\r\n }\r\n\r\n /** Called to get the initial scrubber location */\r\n public get initialDuration(): number {\r\n return this.duration * this.animationFraction;\r\n }\r\n\r\n /** Called to get playback duration */\r\n public get duration(): number {\r\n return (this.getSettings().duration) ? this.getSettings().duration! : /* istanbul ignore next */ 20000;\r\n }\r\n\r\n // istanbul ignore next - WIP\r\n public set viewport(viewport: ScreenViewport | undefined) {\r\n this._viewport = viewport;\r\n if (viewport)\r\n this.viewId = viewport.view.id;\r\n else\r\n this.viewId = \"\";\r\n }\r\n\r\n // istanbul ignore next - WIP\r\n public get viewport(): ScreenViewport | undefined {\r\n return this._viewport;\r\n }\r\n\r\n public get loop(): boolean {\r\n return (undefined === this.getSettings().loop) ? /* istanbul ignore next */ false : this.getSettings().loop!;\r\n }\r\n\r\n public getSettings(): PlaybackSettings {\r\n return this._settings;\r\n }\r\n\r\n public updateSettings(settings: PlaybackSettings) {\r\n this._settings = { ...this._settings, ...settings };\r\n }\r\n\r\n // istanbul ignore next\r\n public onPlaybackSettingChanged = (_settings: PlaybackSettings) => {\r\n };\r\n\r\n // istanbul ignore next\r\n public onAnimationFractionChanged = (_animationFraction: number) => {\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"BaseTimelineDataProvider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/BaseTimelineDataProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH;;GAEG;AACH,MAAa,wBAAwB;IAUnC,YAAY,QAAyB;QATrB,OAAE,GAAG,0BAA0B,CAAC;QAGzC,WAAM,GAAG,EAAE,CAAC;QAEZ,8BAAyB,GAAG,KAAK,CAAC,CAAC,oEAAoE;QACvG,sBAAiB,GAAW,CAAC,CAAC,CAAC,kFAAkF;QAU9G,cAAS,GAAqB;YACtC,QAAQ,EAAE,EAAE,GAAG,IAAI;YACnB,IAAI,EAAE,IAAI;SACX,CAAC;QA2CF,uBAAuB;QAChB,6BAAwB,GAAG,CAAC,SAA2B,EAAE,EAAE;QAClE,CAAC,CAAC;QAEF,uBAAuB;QAChB,+BAA0B,GAAG,CAAC,kBAA0B,EAAE,EAAE;QACnE,CAAC,CAAC;QA1DA,IAAI,CAAC,SAAS,GAAG,QAAQ,CA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ourcesContent":["/*---------------------------------------------------------------------------------------------\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 Timeline\n */\n\nimport { ScreenViewport } from \"@itwin/core-frontend\";\nimport { PlaybackSettings, TimelineDataProvider } from \"./interfaces\";\n\n/** Base Timeline Data Provider\n * @alpha\n */\nexport class BaseTimelineDataProvider implements TimelineDataProvider {\n public readonly id = \"TestTimelineDataProvider\";\n public start: Date | undefined;\n public end: Date | undefined;\n public viewId = \"\";\n\n public supportsTimelineAnimation = false; // set to true when provider determines animation data is available.\n public animationFraction: number = 0; // value from 0.0 to 1.0 that specifies the percentage complete for the animation.\n protected _viewport: ScreenViewport | undefined;\n\n constructor(viewport?: ScreenViewport) {\n this._viewport = viewport;\n // istanbul ignore if - WIP\n if (viewport)\n this.viewId = viewport.view.id;\n }\n\n protected _settings: PlaybackSettings = {\n duration: 20 * 1000,\n loop: true,\n };\n\n // istanbul ignore next\n public async loadTimelineData(): Promise<boolean> {\n return false;\n }\n\n /** Called to get the initial scrubber location */\n public get initialDuration(): number {\n return this.duration * this.animationFraction;\n }\n\n /** Called to get playback duration */\n public get duration(): number {\n return (this.getSettings().duration) ? this.getSettings().duration! : /* istanbul ignore next */ 20000;\n }\n\n // istanbul ignore next - WIP\n public set viewport(viewport: ScreenViewport | undefined) {\n this._viewport = viewport;\n if (viewport)\n this.viewId = viewport.view.id;\n else\n this.viewId = \"\";\n }\n\n // istanbul ignore next - WIP\n public get viewport(): ScreenViewport | undefined {\n return this._viewport;\n }\n\n public get loop(): boolean {\n return (undefined === this.getSettings().loop) ? /* istanbul ignore next */ false : this.getSettings().loop!;\n }\n\n public getSettings(): PlaybackSettings {\n return this._settings;\n }\n\n public updateSettings(settings: PlaybackSettings) {\n this._settings = { ...this._settings, ...settings };\n }\n\n // istanbul ignore next\n public onPlaybackSettingChanged = (_settings: PlaybackSettings) => {\n };\n\n // istanbul ignore next\n public onAnimationFractionChanged = (_animationFraction: number) => {\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineEdit.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/InlineEdit.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAAmD;AAEnD,wDAA6C;AAY7C;;GAEG;AACH,MAAa,UAAW,SAAQ,KAAK,CAAC,SAA2C;IAG/E,YAAY,KAAsB;QAChC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHP,cAAS,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAiBxD,uBAAuB;QACf,YAAO,GAAG,CAAC,KAA0C,EAAE,EAAE;YAC/D,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC,CAAC;QAEM,aAAQ,GAAG,CAAC,KAA0C,EAAE,EAAE;YAChE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC,CAAC;QAEM,eAAU,GAAG,CAAC,KAA4C,EAAE,EAAE;YACpE,QAAQ,KAAK,CAAC,GAAG,EAAE;gBACjB,KAAK,2BAAU,CAAC,MAAM;oBACpB,IAAI,CAAC,QAAQ,CACX,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,aAAa,EAAE,CAAC,EACnD,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;oBAC1C,MAAM;gBACR,KAAK,2BAAU,CAAC,KAAK;oBACnB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACnC,MAAM;aACT;QACH,CAAC,CAAC;QAEM,cAAS,GAAG,CAAC,KAA0C,EAAE,EAAE;YAC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GAAI,CAC/B,CAAC;IACJ,CAAC;CACF;AAlED,gCAkEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport \"./InlineEdit.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { Input } from \"@itwin/itwinui-react\";\r\n\r\ninterface InlineEditProps extends CommonProps {\r\n defaultValue: string;\r\n onChange?: (value: string) => void;\r\n}\r\n\r\ninterface InlineEditState {\r\n value: string;\r\n originalValue: string;\r\n}\r\n\r\n/** Duration Inline Editor\r\n * @internal\r\n */\r\nexport class InlineEdit extends React.Component<InlineEditProps, InlineEditState> {\r\n private _inputRef = React.createRef<HTMLInputElement>();\r\n\r\n constructor(props: InlineEditProps) {\r\n super(props);\r\n\r\n this.state = { value: this.props.defaultValue, originalValue: this.props.defaultValue };\r\n }\r\n\r\n /** @internal */\r\n public override componentDidUpdate(prevProps: InlineEditProps, _prevState: InlineEditState) { // eslint-disable-line @typescript-eslint/naming-convention\r\n if (prevProps.defaultValue !== this.props.defaultValue) {\r\n this.setState((_, props) => {\r\n return { value: props.defaultValue, originalValue: props.defaultValue };\r\n });\r\n }\r\n }\r\n\r\n // istanbul ignore next\r\n private _onBlur = (event: React.ChangeEvent<HTMLInputElement>) => {\r\n this._sendChange(event.target.value);\r\n };\r\n\r\n private _onFocus = (event: React.ChangeEvent<HTMLInputElement>) => {\r\n event.target.select();\r\n };\r\n\r\n private _onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\r\n switch (event.key) {\r\n case SpecialKey.Escape:\r\n this.setState(\r\n (prevState) => ({ value: prevState.originalValue }),\r\n () => this._inputRef.current!.select());\r\n break;\r\n case SpecialKey.Enter:\r\n this._sendChange(this.state.value);\r\n break;\r\n }\r\n };\r\n\r\n private _onChange = (event: React.ChangeEvent<HTMLInputElement>) => {\r\n this.setState({ value: event.target.value });\r\n };\r\n\r\n private _sendChange(value: string) {\r\n // istanbul ignore else\r\n if (this.props.onChange)\r\n this.props.onChange(value);\r\n }\r\n\r\n public override render() {\r\n return (\r\n <Input\r\n data-testid=\"timeline-duration-edit-input\"\r\n className={classnames(\"inline-edit-input\", this.props.className)}\r\n style={this.props.style}\r\n ref={this._inputRef}\r\n type=\"text\"\r\n value={this.state.value}\r\n size=\"small\"\r\n onFocus={this._onFocus}\r\n onBlur={this._onBlur}\r\n onKeyDown={this._onKeyDown}\r\n onChange={this._onChange} />\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"InlineEdit.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/InlineEdit.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAAmD;AAEnD,wDAA6C;AAY7C;;GAEG;AACH,MAAa,UAAW,SAAQ,KAAK,CAAC,SAA2C;IAG/E,YAAY,KAAsB;QAChC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHP,cAAS,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAiBxD,uBAAuB;QACf,YAAO,GAAG,CAAC,KAA0C,EAAE,EAAE;YAC/D,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC,CAAC;QAEM,aAAQ,GAAG,CAAC,KAA0C,EAAE,EAAE;YAChE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC,CAAC;QAEM,eAAU,GAAG,CAAC,KAA4C,EAAE,EAAE;YACpE,QAAQ,KAAK,CAAC,GAAG,EAAE;gBACjB,KAAK,2BAAU,CAAC,MAAM;oBACpB,IAAI,CAAC,QAAQ,CACX,CA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AE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAChE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,GAAG,EAAE,IAAI,CAAC,SAAS,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,MAAM,EAAE,IAAI,CAAC,OAAO,EACpB,SAAS,EAAE,IAAI,CAAC,UAAU,EAC1B,QAAQ,EAAE,IAAI,CAAC,SAAS,GAAI,CAC/B,CAAC;IACJ,CAAC;CACF;AAlED,gCAkEC","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*--------------------------------------------------------------------------------------------*/\nimport \"./InlineEdit.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\n\ninterface InlineEditProps extends CommonProps {\n defaultValue: string;\n onChange?: (value: string) => void;\n}\n\ninterface InlineEditState {\n value: string;\n originalValue: string;\n}\n\n/** Duration Inline Editor\n * @internal\n */\nexport class InlineEdit extends React.Component<InlineEditProps, InlineEditState> {\n private _inputRef = React.createRef<HTMLInputElement>();\n\n constructor(props: InlineEditProps) {\n super(props);\n\n this.state = { value: this.props.defaultValue, originalValue: this.props.defaultValue };\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: InlineEditProps, _prevState: InlineEditState) { // eslint-disable-line @typescript-eslint/naming-convention\n if (prevProps.defaultValue !== this.props.defaultValue) {\n this.setState((_, props) => {\n return { value: props.defaultValue, originalValue: props.defaultValue };\n });\n }\n }\n\n // istanbul ignore next\n private _onBlur = (event: React.ChangeEvent<HTMLInputElement>) => {\n this._sendChange(event.target.value);\n };\n\n private _onFocus = (event: React.ChangeEvent<HTMLInputElement>) => {\n event.target.select();\n };\n\n private _onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n switch (event.key) {\n case SpecialKey.Escape:\n this.setState(\n (prevState) => ({ value: prevState.originalValue }),\n () => this._inputRef.current!.select());\n break;\n case SpecialKey.Enter:\n this._sendChange(this.state.value);\n break;\n }\n };\n\n private _onChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n this.setState({ value: event.target.value });\n };\n\n private _sendChange(value: string) {\n // istanbul ignore else\n if (this.props.onChange)\n this.props.onChange(value);\n }\n\n public override render() {\n return (\n <Input\n data-testid=\"timeline-duration-edit-input\"\n className={classnames(\"inline-edit-input\", this.props.className)}\n style={this.props.style}\n ref={this._inputRef}\n type=\"text\"\n value={this.state.value}\n size=\"small\"\n onFocus={this._onFocus}\n onBlur={this._onBlur}\n onKeyDown={this._onKeyDown}\n onChange={this._onChange} />\n );\n }\n}\n"]}
@@ -1,27 +1,27 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
-
7
- .inline-edit-input {
8
- color: var(--iui-color-text);
9
- background: inherit;
10
- border: 1px solid transparent;
11
- box-sizing: border-box;
12
-
13
- &.iui-input {
14
- padding: 0px;
15
- }
16
-
17
- &:hover {
18
- border: 1px solid $buic-background-5;
19
- }
20
-
21
- &:focus {
22
- background: $buic-background-1;
23
- border: 1px solid $buic-background-5;
24
- outline: none;
25
- color: var(--iui-color-text-hover);
26
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
+
7
+ .inline-edit-input {
8
+ color: var(--iui-color-text);
9
+ background: inherit;
10
+ border: 1px solid transparent;
11
+ box-sizing: border-box;
12
+
13
+ &.iui-input {
14
+ padding: 0px;
15
+ }
16
+
17
+ &:hover {
18
+ border: 1px solid $buic-background-5;
19
+ }
20
+
21
+ &:focus {
22
+ background: $buic-background-1;
23
+ border: 1px solid $buic-background-5;
24
+ outline: none;
25
+ color: var(--iui-color-text-hover);
26
+ }
27
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PlayerButton.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/PlayerButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,+BAA6B;AAC7B,4DAAoC;AACpC,6CAA+B;AAC/B,kDAAsD;AACtD,8DAA2D;AAC3D,oEAA+D;AAE/D;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK,CAAC,aAAkB;IAA1D;;QACU,aAAQ,GAAG,GAAG,EAAE;YACtB,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO;gBACpB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC,CAAC;IAUJ,CAAC;IARiB,MAAM;QACpB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACnC,OAAO,CACL,+CAAqB,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,IAAA,oBAAU,EAAC,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK;YAC3I,8BAAM,SAAS,EAAC,MAAM;gBAAC,oBAAC,iBAAI,IAAC,QAAQ,EAAE,IAAI,GAAI,CAAO,CAC/C,CACV,CAAC;IACJ,CAAC;CACF;AAfD,oCAeC;AAgBD;;GAEG;AACH,MAAa,UAAW,SAAQ,KAAK,C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IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QAElG,OAAO,CACL,+CAAqB,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAA,oBAAU,EAAC,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ;YAC3I,8BAAM,SAAS,EAAC,MAAM,iBAAc,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;gBAAG,oBAAC,iBAAI,IAAC,QAAQ,EAAE,QAAQ,iBAAe,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,GAAI,CAAO,CAChK,CACV,CAAC;IACJ,CAAC;CACF;AA7CD,gCA6CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport \"./PlayerButton.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps, Icon } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\nimport { SvgPause, SvgPlay } from \"@itwin/itwinui-icons-react\";\r\n\r\n/** Player button used by buttons on timeline control\r\n * @internal\r\n */\r\nexport class PlayerButton extends React.PureComponent<any> {\r\n private _onClick = () => {\r\n // istanbul ignore else\r\n if (this.props.onClick)\r\n this.props.onClick();\r\n };\r\n\r\n public override render() {\r\n const { icon, title } = this.props;\r\n return (\r\n <button data-testid={this.props.className} className={classnames(\"player-button\", this.props.className)} onClick={this._onClick} title={title}>\r\n <span className=\"icon\"><Icon iconSpec={icon} /></span>\r\n </button>\r\n );\r\n }\r\n}\r\n\r\n/** Properties for Play/Pause button used on timeline control\r\n * @internal\r\n */\r\nexport interface PlayerButtonProps extends CommonProps {\r\n isPlaying: boolean;\r\n onPlay?: () => void;\r\n onPause?: () => void;\r\n tooltip?: string;\r\n}\r\n\r\ninterface PlayButtonState {\r\n isPlaying: boolean;\r\n}\r\n\r\n/** Play/Pause button used on timeline control\r\n * @internal\r\n */\r\nexport class PlayButton extends React.Component<PlayerButtonProps, PlayButtonState> {\r\n\r\n constructor(props: PlayerButtonProps, context?: any) {\r\n super(props, context);\r\n\r\n this.state = { isPlaying: this.props.isPlaying };\r\n }\r\n\r\n /** @internal */\r\n public override componentDidUpdate() {\r\n if (this.props.isPlaying !== this.state.isPlaying) {\r\n this.setState((_, props) => ({ isPlaying: props.isPlaying }));\r\n }\r\n }\r\n\r\n private _onClick = () => {\r\n const _isPlaying = !this.state.isPlaying;\r\n\r\n this.setState({ isPlaying: _isPlaying });\r\n\r\n if (_isPlaying) {\r\n // istanbul ignore else\r\n if (this.props.onPlay)\r\n this.props.onPlay();\r\n } else {\r\n // istanbul ignore else\r\n if (this.props.onPause)\r\n this.props.onPause();\r\n }\r\n };\r\n\r\n public override render() {\r\n const { tooltip } = this.props;\r\n const iconSpec = this.state.isPlaying ? <SvgPause /> : <SvgPlay />;\r\n let title = tooltip;\r\n\r\n if (!title)\r\n title = UiIModelComponents.translate(this.state.isPlaying ? \"timeline.pause\" : \"timeline.play\");\r\n\r\n return (\r\n <button data-testid={this.props.className} title={title} className={classnames(\"player-button\", this.props.className)} onClick={this._onClick}>\r\n <span className=\"icon\" data-testid={this.state.isPlaying ? \"pause\" : \"play\"} ><Icon iconSpec={iconSpec} data-testid={this.state.isPlaying ? \"pause\" : \"play\"} /></span>\r\n </button>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PlayerButton.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/PlayerButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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AG,oBAAC,iBAAI,IAAC,QAAQ,EAAE,QAAQ,iBAAe,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,GAAI,CAAO,CAChK,CACV,CAAC;IACJ,CAAC;CACF;AA7CD,gCA6CC","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*--------------------------------------------------------------------------------------------*/\nimport \"./PlayerButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { CommonProps, Icon } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport { SvgPause, SvgPlay } from \"@itwin/itwinui-icons-react\";\n\n/** Player button used by buttons on timeline control\n * @internal\n */\nexport class PlayerButton extends React.PureComponent<any> {\n private _onClick = () => {\n // istanbul ignore else\n if (this.props.onClick)\n this.props.onClick();\n };\n\n public override render() {\n const { icon, title } = this.props;\n return (\n <button data-testid={this.props.className} className={classnames(\"player-button\", this.props.className)} onClick={this._onClick} title={title}>\n <span className=\"icon\"><Icon iconSpec={icon} /></span>\n </button>\n );\n }\n}\n\n/** Properties for Play/Pause button used on timeline control\n * @internal\n */\nexport interface PlayerButtonProps extends CommonProps {\n isPlaying: boolean;\n onPlay?: () => void;\n onPause?: () => void;\n tooltip?: string;\n}\n\ninterface PlayButtonState {\n isPlaying: boolean;\n}\n\n/** Play/Pause button used on timeline control\n * @internal\n */\nexport class PlayButton extends React.Component<PlayerButtonProps, PlayButtonState> {\n\n constructor(props: PlayerButtonProps, context?: any) {\n super(props, context);\n\n this.state = { isPlaying: this.props.isPlaying };\n }\n\n /** @internal */\n public override componentDidUpdate() {\n if (this.props.isPlaying !== this.state.isPlaying) {\n this.setState((_, props) => ({ isPlaying: props.isPlaying }));\n }\n }\n\n private _onClick = () => {\n const _isPlaying = !this.state.isPlaying;\n\n this.setState({ isPlaying: _isPlaying });\n\n if (_isPlaying) {\n // istanbul ignore else\n if (this.props.onPlay)\n this.props.onPlay();\n } else {\n // istanbul ignore else\n if (this.props.onPause)\n this.props.onPause();\n }\n };\n\n public override render() {\n const { tooltip } = this.props;\n const iconSpec = this.state.isPlaying ? <SvgPause /> : <SvgPlay />;\n let title = tooltip;\n\n if (!title)\n title = UiIModelComponents.translate(this.state.isPlaying ? \"timeline.pause\" : \"timeline.play\");\n\n return (\n <button data-testid={this.props.className} title={title} className={classnames(\"player-button\", this.props.className)} onClick={this._onClick}>\n <span className=\"icon\" data-testid={this.state.isPlaying ? \"pause\" : \"play\"} ><Icon iconSpec={iconSpec} data-testid={this.state.isPlaying ? \"pause\" : \"play\"} /></span>\n </button>\n );\n }\n}\n"]}
@@ -1,28 +1,28 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
-
6
- .player-button {
7
- width: 38px;
8
- height: 38px;
9
- display: flex;
10
- align-items: center;
11
- justify-content: center;
12
- font-size: 16px;
13
- outline: none;
14
- border-radius: var(--iui-border-radius-1);
15
- border: solid 1px var(--iui-color-border-foreground);
16
- background-color: var(--iui-color-background);
17
- color: var(--iui-color-icon);
18
- cursor: pointer;
19
-
20
- &:hover {
21
- color: var(--iui-color-icon-hover);
22
- }
23
-
24
- &:focus-visible {
25
- outline: 1px solid var(--iui-color-border-accent);
26
- outline-offset: -1px;
27
- }
28
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ .player-button {
7
+ width: 38px;
8
+ height: 38px;
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: center;
12
+ font-size: 16px;
13
+ outline: none;
14
+ border-radius: var(--iui-border-radius-1);
15
+ border: solid 1px var(--iui-color-border-foreground);
16
+ background-color: var(--iui-color-background);
17
+ color: var(--iui-color-icon);
18
+ cursor: pointer;
19
+
20
+ &:hover {
21
+ color: var(--iui-color-icon-hover);
22
+ }
23
+
24
+ &:focus-visible {
25
+ outline: 1px solid var(--iui-color-border-accent);
26
+ outline-offset: -1px;
27
+ }
28
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"Scrubber.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/Scrubber.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,2BAAyB;AACzB,6CAA+B;AAC/B,wDAA8C;AAC9C,kDAAkE;AAClE,8DAAqE;AAGrE;;GAEG;AACH,SAAgB,wBAAwB,CAAC,IAAa,EAAE,OAAe;IACrE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;AAC7C,CAAC;AAHD,4DAGC;AAED,6BAA6B;AAC7B,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE;IACvC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,EAAE;QAC5B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,CAAC;IAEF,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;IACrC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,OAAO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UAAU,EAAE,SAAS,EACrB,kBAAkB,EAAE;YAClB,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,iBAAiB;YAChC,cAAc,EAAE,kBAAkB;SACnC,GACD,CACH,CAAC;AACJ,CAAC;AA9ED,4BA8EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport \"./Scrubber.scss\";\r\nimport * as React from \"react\";\r\nimport { Slider } from \"@itwin/itwinui-react\";\r\nimport { CommonProps, useEventListener } from \"@itwin/core-react\";\r\nimport { toDateString, toTimeString } from \"@itwin/components-react\";\r\nimport { TimelineDateMarkerProps } from \"./TimelineComponent\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function getPercentageOfRectangle(rect: DOMRect, pointer: number) {\r\n const position = Math.min(rect.right, Math.max(rect.left, pointer));\r\n return (position - rect.left) / rect.width;\r\n}\r\n\r\n// istanbul ignore next - WIP\r\nconst formatDuration = (value: number) => {\r\n const addZero = (i: number) => {\r\n return (i < 10) ? `0${i}` : i;\r\n };\r\n\r\n const date = new Date(value);\r\n const minutes = date.getUTCMinutes();\r\n const seconds = date.getUTCSeconds();\r\n return `${addZero(minutes)}:${addZero(seconds)}`;\r\n};\r\n\r\nconst formatDate = (startDate: Date, endDate: Date, fraction: number, timeZoneOffset?: number) => {\r\n const delta = (endDate.getTime() - startDate.getTime()) * fraction;\r\n const date = new Date(startDate.getTime() + delta);\r\n return toDateString(date, timeZoneOffset);\r\n};\r\n\r\n// istanbul ignore next - WIP\r\nconst formatTime = (startDate: Date, endDate: Date, fraction: number, timeZoneOffset?: number) => {\r\n const delta = (endDate.getTime() - startDate.getTime()) * fraction;\r\n const date = new Date(startDate.getTime() + delta);\r\n return ` ${toTimeString(date, timeZoneOffset)}`;\r\n};\r\n\r\nfunction generateToolTipText(showTime: boolean, percent: number, min: number, max: number, startDate?: Date, endDate?: Date, timeZoneOffset = 0) {\r\n if (startDate && endDate)\r\n return `${formatDate(startDate, endDate, percent, timeZoneOffset)}${showTime ? formatTime(startDate, endDate, percent, timeZoneOffset) : \"\"} `;\r\n\r\n const val = Math.round(min + ((max - min) * percent));\r\n return formatDuration(val);\r\n}\r\n\r\nfunction getPercentageFromDate(startDate: Date, endDate: Date, date?: Date) {\r\n const newDate = date ? date : new Date();\r\n const startTime = startDate.getTime();\r\n const totalDuration = endDate.getTime() - startTime;\r\n return (newDate.getTime() - startTime) / totalDuration;\r\n}\r\n\r\nfunction getDateMarker(dateMarkerPropsIn: TimelineDateMarkerProps, startDate: Date, endDate: Date): DateMarkerProps {\r\n const percentage = getPercentageFromDate(startDate, endDate, dateMarkerPropsIn.date);\r\n const marker = dateMarkerPropsIn.dateMarker ? dateMarkerPropsIn.dateMarker : <span className=\"date-marker-default\"></span>;\r\n return { datePercentage: percentage, dateMarker: marker };\r\n}\r\n\r\nfunction markDateInTimelineRange(dateMarkerProps?: TimelineDateMarkerProps, startDate?: Date, endDate?: Date): boolean {\r\n // istanbul ignore else\r\n if (dateMarkerProps && startDate && endDate) {\r\n const inDate = dateMarkerProps.date ? dateMarkerProps.date : new Date();\r\n // istanbul ignore else\r\n if (inDate.getTime() >= startDate.getTime() && inDate.getTime() <= endDate.getTime())\r\n return true;\r\n }\r\n return false;\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport function RailMarkers({ showToolTip, percent, tooltipText, markDate }: {\r\n showToolTip: boolean;\r\n percent: number;\r\n tooltipText: string;\r\n markDate?: DateMarkerProps;\r\n}) {\r\n\r\n return (\r\n <div className=\"components-timeline-rail-marker-container\">\r\n {showToolTip &&\r\n <div className=\"components-timeline-tooltip\" style={{ left: `${Math.round(percent * 100)}% ` }}>\r\n <span className=\"tooltip-text\">{tooltipText}</span>\r\n </div>}\r\n {markDate &&\r\n <div className=\"components-timeline-date-marker\" data-testid=\"test-date-marker\" style={{ left: `${Math.round(markDate.datePercentage * 100)}% ` }}>\r\n {markDate.dateMarker}\r\n </div>}\r\n </div>\r\n );\r\n}\r\n\r\n/**\r\n * Custom Timeline Thumb\r\n * @internal\r\n */\r\nexport function CustomThumb() {\r\n return (\r\n <div className=\"scrubber-handle\">\r\n <div /><div /><div />\r\n </div>\r\n );\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function useFocusedThumb(sliderContainer: HTMLDivElement | undefined) {\r\n const [thumbElement, setThumbElement] = React.useState<HTMLDivElement>();\r\n\r\n React.useLayoutEffect(() => {\r\n // istanbul ignore else\r\n if (sliderContainer) {\r\n const element = sliderContainer.querySelector(\".iui-slider-thumb\");\r\n if (element && thumbElement !== element) {\r\n setThumbElement(element as HTMLDivElement);\r\n }\r\n }\r\n }, [sliderContainer, thumbElement]);\r\n\r\n const [thumbHasFocus, setThumbHasFocus] = React.useState(false);\r\n\r\n const handleThumbFocus = React.useCallback(() => {\r\n setThumbHasFocus(true);\r\n }, []);\r\n\r\n const handleThumbBlur = React.useCallback(() => {\r\n setThumbHasFocus(false);\r\n }, []);\r\n\r\n useEventListener(\"focus\", handleThumbFocus, thumbElement);\r\n useEventListener(\"blur\", handleThumbBlur, thumbElement);\r\n return thumbHasFocus;\r\n}\r\n\r\n/** Properties for Scrubber/Slider used on timeline control\r\n * @internal\r\n */\r\nexport interface ScrubberProps extends CommonProps {\r\n currentDuration: number;\r\n totalDuration: number;\r\n isPlaying: boolean;\r\n inMiniMode: boolean;\r\n startDate?: Date;\r\n endDate?: Date;\r\n showTime?: boolean;\r\n onChange?: (values: ReadonlyArray<number>) => void;\r\n onUpdate?: (values: ReadonlyArray<number>) => void;\r\n timeZoneOffset?: number;\r\n markDate?: TimelineDateMarkerProps;\r\n}\r\n\r\n/** Properties for marking current date in RailMarkers\r\n * @internal\r\n */\r\ninterface DateMarkerProps {\r\n datePercentage: number;\r\n dateMarker?: React.ReactNode;\r\n}\r\n/** Scrubber/Slider for timeline control\r\n * @internal\r\n */\r\nexport function Scrubber(props: ScrubberProps) {\r\n const { startDate, endDate, showTime, isPlaying, totalDuration, timeZoneOffset,\r\n currentDuration, className, onChange, onUpdate } = props;\r\n\r\n const thumbProps = () => {\r\n return {\r\n className: \"components-timeline-thumb\",\r\n children: <CustomThumb />,\r\n };\r\n };\r\n\r\n const sliderRef = React.useRef<HTMLDivElement>(null);\r\n const [sliderContainer, setSliderContainer] = React.useState<HTMLDivElement>();\r\n const [pointerPercent, setPointerPercent] = React.useState(0);\r\n\r\n React.useLayoutEffect(() => {\r\n // istanbul ignore else\r\n if (sliderRef.current) {\r\n const container = sliderRef.current.querySelector(\".iui-slider-container\");\r\n if (container && sliderContainer !== container) {\r\n setSliderContainer(container as HTMLDivElement);\r\n }\r\n }\r\n }, [sliderContainer]);\r\n\r\n const tooltipProps = React.useCallback(() => {\r\n return { visible: false };\r\n }, []);\r\n\r\n const [showRailTooltip, setShowRailTooltip] = React.useState(false);\r\n\r\n // istanbul ignore next\r\n const handlePointerEnter = React.useCallback(() => {\r\n setShowRailTooltip(true);\r\n }, []);\r\n\r\n // istanbul ignore next\r\n const handlePointerLeave = React.useCallback(() => {\r\n setShowRailTooltip(false);\r\n }, []);\r\n\r\n const handlePointerMove = React.useCallback((event: React.PointerEvent) => {\r\n sliderContainer &&\r\n setPointerPercent(getPercentageOfRectangle(sliderContainer.getBoundingClientRect(), event.clientX));\r\n }, [sliderContainer]);\r\n\r\n const thumbHasFocus = useFocusedThumb(sliderContainer);\r\n\r\n const tickLabel = React.useMemo(() => {\r\n const showTip = isPlaying || showRailTooltip || thumbHasFocus;\r\n const percent = (isPlaying || thumbHasFocus) ? currentDuration / totalDuration : pointerPercent;\r\n const markDateInRange = markDateInTimelineRange(props.markDate, startDate, endDate);\r\n const currentDateMarker = props.markDate && markDateInRange && startDate && endDate ? getDateMarker(props.markDate, startDate, endDate) : undefined;\r\n const tooltipText = generateToolTipText(!!showTime, percent, 0, totalDuration, startDate, endDate, timeZoneOffset);\r\n return (<RailMarkers showToolTip={showTip} percent={percent} tooltipText={tooltipText} markDate={currentDateMarker} />);\r\n }, [isPlaying, showRailTooltip, currentDuration, totalDuration, pointerPercent, startDate, endDate, timeZoneOffset, showTime, thumbHasFocus, props.markDate]);\r\n\r\n return (\r\n <Slider ref={sliderRef}\r\n className={className}\r\n step={1}\r\n min={0}\r\n max={totalDuration}\r\n minLabel=\"\"\r\n maxLabel=\"\"\r\n onUpdate={onUpdate}\r\n onChange={onChange}\r\n values={[currentDuration]}\r\n tooltipProps={tooltipProps}\r\n thumbProps={thumbProps}\r\n tickLabels={tickLabel}\r\n railContainerProps={{\r\n onPointerEnter: handlePointerEnter,\r\n onPointerMove: handlePointerMove,\r\n onPointerLeave: handlePointerLeave,\r\n }}\r\n />\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"Scrubber.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/Scrubber.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,2BAAyB;AACzB,6CAA+B;AAC/B,wDAA8C;AAC9C,kDAAkE;AAClE,8DAAqE;AAGrE;;GAEG;AACH,SAAgB,wBAAwB,CAAC,IAAa,EAAE,OAAe;IACrE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;AAC7C,CAAC;AAHD,4DAGC;AAED,6BAA6B;AAC7B,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE;IACvC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,EAAE;QAC5B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,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C,EACP,GAAG,EAAE,CAAC,EACN,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAC,EAAE,EACX,QAAQ,EAAC,EAAE,EACX,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,CAAC,eAAe,CAAC,EACzB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,SAAS,EACrB,kBAAkB,EAAE;YAClB,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,iBAAiB;YAChC,cAAc,EAAE,kBAAkB;SACnC,GACD,CACH,CAAC;AACJ,CAAC;AA9ED,4BA8EC","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*--------------------------------------------------------------------------------------------*/\nimport \"./Scrubber.scss\";\nimport * as React from \"react\";\nimport { Slider } from \"@itwin/itwinui-react\";\nimport { CommonProps, useEventListener } from \"@itwin/core-react\";\nimport { toDateString, toTimeString } from \"@itwin/components-react\";\nimport { TimelineDateMarkerProps } from \"./TimelineComponent\";\n\n/**\n * @internal\n */\nexport function getPercentageOfRectangle(rect: DOMRect, pointer: number) {\n const position = Math.min(rect.right, Math.max(rect.left, pointer));\n return (position - rect.left) / rect.width;\n}\n\n// istanbul ignore next - WIP\nconst formatDuration = (value: number) => {\n const addZero = (i: number) => {\n return (i < 10) ? `0${i}` : i;\n };\n\n const date = new Date(value);\n const minutes = date.getUTCMinutes();\n const seconds = date.getUTCSeconds();\n return `${addZero(minutes)}:${addZero(seconds)}`;\n};\n\nconst formatDate = (startDate: Date, endDate: Date, fraction: number, timeZoneOffset?: number) => {\n const delta = (endDate.getTime() - startDate.getTime()) * fraction;\n const date = new Date(startDate.getTime() + delta);\n return toDateString(date, timeZoneOffset);\n};\n\n// istanbul ignore next - WIP\nconst formatTime = (startDate: Date, endDate: Date, fraction: number, timeZoneOffset?: number) => {\n const delta = (endDate.getTime() - startDate.getTime()) * fraction;\n const date = new Date(startDate.getTime() + delta);\n return ` ${toTimeString(date, timeZoneOffset)}`;\n};\n\nfunction generateToolTipText(showTime: boolean, percent: number, min: number, max: number, startDate?: Date, endDate?: Date, timeZoneOffset = 0) {\n if (startDate && endDate)\n return `${formatDate(startDate, endDate, percent, timeZoneOffset)}${showTime ? formatTime(startDate, endDate, percent, timeZoneOffset) : \"\"} `;\n\n const val = Math.round(min + ((max - min) * percent));\n return formatDuration(val);\n}\n\nfunction getPercentageFromDate(startDate: Date, endDate: Date, date?: Date) {\n const newDate = date ? date : new Date();\n const startTime = startDate.getTime();\n const totalDuration = endDate.getTime() - startTime;\n return (newDate.getTime() - startTime) / totalDuration;\n}\n\nfunction getDateMarker(dateMarkerPropsIn: TimelineDateMarkerProps, startDate: Date, endDate: Date): DateMarkerProps {\n const percentage = getPercentageFromDate(startDate, endDate, dateMarkerPropsIn.date);\n const marker = dateMarkerPropsIn.dateMarker ? dateMarkerPropsIn.dateMarker : <span className=\"date-marker-default\"></span>;\n return { datePercentage: percentage, dateMarker: marker };\n}\n\nfunction markDateInTimelineRange(dateMarkerProps?: TimelineDateMarkerProps, startDate?: Date, endDate?: Date): boolean {\n // istanbul ignore else\n if (dateMarkerProps && startDate && endDate) {\n const inDate = dateMarkerProps.date ? dateMarkerProps.date : new Date();\n // istanbul ignore else\n if (inDate.getTime() >= startDate.getTime() && inDate.getTime() <= endDate.getTime())\n return true;\n }\n return false;\n}\n/**\n * @internal\n */\nexport function RailMarkers({ showToolTip, percent, tooltipText, markDate }: {\n showToolTip: boolean;\n percent: number;\n tooltipText: string;\n markDate?: DateMarkerProps;\n}) {\n\n return (\n <div className=\"components-timeline-rail-marker-container\">\n {showToolTip &&\n <div className=\"components-timeline-tooltip\" style={{ left: `${Math.round(percent * 100)}% ` }}>\n <span className=\"tooltip-text\">{tooltipText}</span>\n </div>}\n {markDate &&\n <div className=\"components-timeline-date-marker\" data-testid=\"test-date-marker\" style={{ left: `${Math.round(markDate.datePercentage * 100)}% ` }}>\n {markDate.dateMarker}\n </div>}\n </div>\n );\n}\n\n/**\n * Custom Timeline Thumb\n * @internal\n */\nexport function CustomThumb() {\n return (\n <div className=\"scrubber-handle\">\n <div /><div /><div />\n </div>\n );\n}\n\n/**\n * @internal\n */\nexport function useFocusedThumb(sliderContainer: HTMLDivElement | undefined) {\n const [thumbElement, setThumbElement] = React.useState<HTMLDivElement>();\n\n React.useLayoutEffect(() => {\n // istanbul ignore else\n if (sliderContainer) {\n const element = sliderContainer.querySelector(\".iui-slider-thumb\");\n if (element && thumbElement !== element) {\n setThumbElement(element as HTMLDivElement);\n }\n }\n }, [sliderContainer, thumbElement]);\n\n const [thumbHasFocus, setThumbHasFocus] = React.useState(false);\n\n const handleThumbFocus = React.useCallback(() => {\n setThumbHasFocus(true);\n }, []);\n\n const handleThumbBlur = React.useCallback(() => {\n setThumbHasFocus(false);\n }, []);\n\n useEventListener(\"focus\", handleThumbFocus, thumbElement);\n useEventListener(\"blur\", handleThumbBlur, thumbElement);\n return thumbHasFocus;\n}\n\n/** Properties for Scrubber/Slider used on timeline control\n * @internal\n */\nexport interface ScrubberProps extends CommonProps {\n currentDuration: number;\n totalDuration: number;\n isPlaying: boolean;\n inMiniMode: boolean;\n startDate?: Date;\n endDate?: Date;\n showTime?: boolean;\n onChange?: (values: ReadonlyArray<number>) => void;\n onUpdate?: (values: ReadonlyArray<number>) => void;\n timeZoneOffset?: number;\n markDate?: TimelineDateMarkerProps;\n}\n\n/** Properties for marking current date in RailMarkers\n * @internal\n */\ninterface DateMarkerProps {\n datePercentage: number;\n dateMarker?: React.ReactNode;\n}\n/** Scrubber/Slider for timeline control\n * @internal\n */\nexport function Scrubber(props: ScrubberProps) {\n const { startDate, endDate, showTime, isPlaying, totalDuration, timeZoneOffset,\n currentDuration, className, onChange, onUpdate } = props;\n\n const thumbProps = () => {\n return {\n className: \"components-timeline-thumb\",\n children: <CustomThumb />,\n };\n };\n\n const sliderRef = React.useRef<HTMLDivElement>(null);\n const [sliderContainer, setSliderContainer] = React.useState<HTMLDivElement>();\n const [pointerPercent, setPointerPercent] = React.useState(0);\n\n React.useLayoutEffect(() => {\n // istanbul ignore else\n if (sliderRef.current) {\n const container = sliderRef.current.querySelector(\".iui-slider-container\");\n if (container && sliderContainer !== container) {\n setSliderContainer(container as HTMLDivElement);\n }\n }\n }, [sliderContainer]);\n\n const tooltipProps = React.useCallback(() => {\n return { visible: false };\n }, []);\n\n const [showRailTooltip, setShowRailTooltip] = React.useState(false);\n\n // istanbul ignore next\n const handlePointerEnter = React.useCallback(() => {\n setShowRailTooltip(true);\n }, []);\n\n // istanbul ignore next\n const handlePointerLeave = React.useCallback(() => {\n setShowRailTooltip(false);\n }, []);\n\n const handlePointerMove = React.useCallback((event: React.PointerEvent) => {\n sliderContainer &&\n setPointerPercent(getPercentageOfRectangle(sliderContainer.getBoundingClientRect(), event.clientX));\n }, [sliderContainer]);\n\n const thumbHasFocus = useFocusedThumb(sliderContainer);\n\n const tickLabel = React.useMemo(() => {\n const showTip = isPlaying || showRailTooltip || thumbHasFocus;\n const percent = (isPlaying || thumbHasFocus) ? currentDuration / totalDuration : pointerPercent;\n const markDateInRange = markDateInTimelineRange(props.markDate, startDate, endDate);\n const currentDateMarker = props.markDate && markDateInRange && startDate && endDate ? getDateMarker(props.markDate, startDate, endDate) : undefined;\n const tooltipText = generateToolTipText(!!showTime, percent, 0, totalDuration, startDate, endDate, timeZoneOffset);\n return (<RailMarkers showToolTip={showTip} percent={percent} tooltipText={tooltipText} markDate={currentDateMarker} />);\n }, [isPlaying, showRailTooltip, currentDuration, totalDuration, pointerPercent, startDate, endDate, timeZoneOffset, showTime, thumbHasFocus, props.markDate]);\n\n return (\n <Slider ref={sliderRef}\n className={className}\n step={1}\n min={0}\n max={totalDuration}\n minLabel=\"\"\n maxLabel=\"\"\n onUpdate={onUpdate}\n onChange={onChange}\n values={[currentDuration]}\n tooltipProps={tooltipProps}\n thumbProps={thumbProps}\n tickLabels={tickLabel}\n railContainerProps={{\n onPointerEnter: handlePointerEnter,\n onPointerMove: handlePointerMove,\n onPointerLeave: handlePointerLeave,\n }}\n />\n );\n}\n"]}