@itwin/imodel-components-react 4.0.0 → 4.0.1

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 (169) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/imodel-components-react/UiIModelComponents.js +2 -4
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +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 +1 -1
  7. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  8. package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +90 -90
  9. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  10. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  11. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +62 -62
  12. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  13. package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
  14. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  15. package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
  16. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  17. package/lib/cjs/imodel-components-react/color/Swatch.scss +22 -22
  18. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  19. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  20. package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +18 -18
  21. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  22. package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +16 -16
  23. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  24. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +1 -1
  25. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  26. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +106 -106
  27. package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
  28. package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +48 -48
  29. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  30. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +51 -51
  31. package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
  32. package/lib/cjs/imodel-components-react/navigationaids/Cube.scss +19 -19
  33. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +5 -10
  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 +1 -1
  39. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  40. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +59 -59
  41. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +2 -3
  42. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  43. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +2 -2
  44. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  45. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +1 -2
  46. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  47. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +1 -2
  48. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  49. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +5 -9
  50. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  51. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +3 -4
  52. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  53. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  54. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  55. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  56. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  57. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  58. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  59. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  60. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  61. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  62. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +1 -2
  63. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  64. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  65. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  66. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  67. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  68. package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
  69. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  70. package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +28 -28
  71. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  72. package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +105 -105
  73. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  74. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +359 -359
  75. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  76. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  77. package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
  78. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  79. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +177 -177
  80. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  81. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +7 -9
  82. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  83. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  84. package/lib/cjs/imodel-components-react.js.map +1 -1
  85. package/lib/esm/imodel-components-react/UiIModelComponents.js +2 -4
  86. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  87. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  88. package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
  89. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +1 -1
  90. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  91. package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +90 -90
  92. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  93. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  94. package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +62 -62
  95. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  96. package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
  97. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  98. package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
  99. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  100. package/lib/esm/imodel-components-react/color/Swatch.scss +22 -22
  101. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  102. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  103. package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -18
  104. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  105. package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -16
  106. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  107. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +1 -1
  108. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  109. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +106 -106
  110. package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
  111. package/lib/esm/imodel-components-react/lineweight/Swatch.scss +48 -48
  112. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  113. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +51 -51
  114. package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
  115. package/lib/esm/imodel-components-react/navigationaids/Cube.scss +19 -19
  116. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +5 -10
  117. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  118. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -178
  119. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  120. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -135
  121. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +1 -1
  122. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  123. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +59 -59
  124. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +2 -3
  125. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  126. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +2 -2
  127. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  128. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +1 -2
  129. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  130. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +1 -2
  131. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  132. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +5 -9
  133. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  134. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +3 -4
  135. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  136. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  137. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  138. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  139. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  140. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  141. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  142. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  143. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  144. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  145. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +1 -2
  146. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  147. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  148. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  149. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  150. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  151. package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
  152. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  153. package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +28 -28
  154. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  155. package/lib/esm/imodel-components-react/timeline/Scrubber.scss +105 -105
  156. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  157. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +359 -359
  158. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  159. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  160. package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
  161. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  162. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +177 -177
  163. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  164. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +7 -9
  165. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  166. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  167. package/lib/esm/imodel-components-react.js.map +1 -1
  168. package/lib/public/locales/en/UiIModelComponents.json +139 -139
  169. package/package.json +11 -11
@@ -1 +1 @@
1
- {"version":3,"file":"InlineEdit.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/InlineEdit.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,KAAK,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C;IAED,gBAAgB;IACA,kBAAkB,CAAC,SAA0B,EAAE,UAA2B;QACxF,IAAI,SAAS,CAAC,YAAY,KAAK,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;YACtD,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;gBACzB,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,aAAa,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;YAC1E,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IA4BO,WAAW,CAAC,KAAa;QAC/B,uBAAuB;QACvB,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ;YACrB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAEe,MAAM;QACpB,OAAO,CACL,oBAAC,KAAK,mBACQ,8BAA8B,EAC1C,SAAS,EAAE,UAAU,CAAC,mBAAmB,EAAE,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","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,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAY7C;;GAEG;AACH,MAAM,OAAO,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,UAAU,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;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AK,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","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,OAAO,qBAAqB,CAAC;AAC7B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE/D;;GAEG;AACH,MAAM,OAAO,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,UAAU,CAAC,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,IAAI,IAAC,QAAQ,EAAE,IAAI,GAAI,CAAO,CAC/C,CACV,CAAC;IACJ,CAAC;CACF;AAgBD;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,SAA6C;IAEjF,YAAY,KAAwB,EAAE,OAAa;QACjD,KAAK,CAAC,K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C,CAAC,eAAe,CAAC,CAAC;QAElG,OAAO,CACL,+CAAqB,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,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,IAAI,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","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":"AAAA;;;+FAG+F;AAC/F,OAAO,qBAAqB,CAAC;AAC7B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAA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C,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;gBAAG,oBAAC,IAAI,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","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,OAAO,iBAAiB,CAAC;AACzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAe,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGrE;;GAEG;AACH,MAAM,UAAU,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;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,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AAQ,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","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,OAAO,iBAAiB,CAAC;AACzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAe,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGrE;;GAEG;AACH,MAAM,UAAU,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;AAED,6BAA6B;AAC7B,MAAM,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AE,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE9J,OAAO,CACL,oBAAC,MAAM,IAAC,GAAG,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,CAAC,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","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"]}
@@ -1,105 +1,105 @@
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/z-index";
6
- // the following overrides default iui-slider-thumb settings from iTwinUI
7
- div.components-timeline-thumb.iui-slider-thumb {
8
- display: flex;
9
- justify-content: center;
10
- align-items: center;
11
- background-color: var(--iui-color-background);
12
- box-sizing: border-box;
13
- width: 38px;
14
- height: 20px;
15
- border-radius: var(--iui-border-radius-1);
16
- border: 1px solid var(--iui-color-border);
17
- transform: translateX(-19.2px);
18
- top: 4px;
19
- }
20
-
21
- .components-timeline-rail-marker-container {
22
- width: 100%;
23
- position: absolute;
24
-
25
- div.components-timeline-tooltip {
26
- @include uicore-z-index(tooltip);
27
- position: absolute;
28
- top: -8px;
29
- display: inline-block;
30
- transform: translateX(-50px);
31
- border-bottom: 1px dotted rgba(0, 0, 0, var(--iui-opacity-3));
32
- font-size: 14px;
33
-
34
- .tooltip-text {
35
- width: 100px;
36
- background-color: rgba(0, 0, 0, var(--iui-opacity-3));
37
- color: #fff;
38
- // opacity: 0.8;
39
- text-align: center;
40
- border-radius: 6px;
41
- padding: 8px 0;
42
- position: absolute;
43
- z-index: 1;
44
- bottom: 150%;
45
-
46
- &:after {
47
- content: "";
48
- position: absolute;
49
- top: 100%;
50
- left: 50%;
51
- margin-left: -5px;
52
- border-width: 5px;
53
- border-style: solid;
54
- border-color: rgba(0, 0, 0, var(--iui-opacity-3)) transparent
55
- transparent transparent;
56
- }
57
- }
58
- }
59
- }
60
-
61
- .scrubber-handle {
62
- pointer-events: none;
63
- position: absolute;
64
- width: 38px;
65
- height: 20px;
66
- border-radius: var(--iui-border-radius-1);
67
- display: flex;
68
- align-items: center;
69
- justify-content: center;
70
- box-sizing: border-box;
71
- cursor: pointer;
72
-
73
- > div {
74
- width: 1px;
75
- height: 10px;
76
- margin: 0 1px;
77
- background-color: var(--iui-color-border-subtle);
78
- }
79
- }
80
-
81
- .scrubber-track {
82
- position: absolute;
83
- top: 50%;
84
- transform: translateY(-50%);
85
- height: 4px;
86
- z-index: 1;
87
- cursor: pointer;
88
- }
89
-
90
- .components-timeline-date-marker {
91
- pointer-events: none;
92
- position: absolute;
93
- display: flex;
94
- align-items: center;
95
- justify-content: center;
96
- transform: translateY(50%);
97
- }
98
-
99
- .date-marker-default {
100
- height: 12px;
101
- width: 3px;
102
- border-radius: var(--iui-border-radius-1);
103
- transform: translateY(1px);
104
- background-color: var(--iui-color-border);
105
- }
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/z-index";
6
+ // the following overrides default iui-slider-thumb settings from iTwinUI
7
+ div.components-timeline-thumb.iui-slider-thumb {
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ background-color: var(--iui-color-background);
12
+ box-sizing: border-box;
13
+ width: 38px;
14
+ height: 20px;
15
+ border-radius: var(--iui-border-radius-1);
16
+ border: 1px solid var(--iui-color-border);
17
+ transform: translateX(-19.2px);
18
+ top: 4px;
19
+ }
20
+
21
+ .components-timeline-rail-marker-container {
22
+ width: 100%;
23
+ position: absolute;
24
+
25
+ div.components-timeline-tooltip {
26
+ @include uicore-z-index(tooltip);
27
+ position: absolute;
28
+ top: -8px;
29
+ display: inline-block;
30
+ transform: translateX(-50px);
31
+ border-bottom: 1px dotted rgba(0, 0, 0, var(--iui-opacity-3));
32
+ font-size: 14px;
33
+
34
+ .tooltip-text {
35
+ width: 100px;
36
+ background-color: rgba(0, 0, 0, var(--iui-opacity-3));
37
+ color: #fff;
38
+ // opacity: 0.8;
39
+ text-align: center;
40
+ border-radius: 6px;
41
+ padding: 8px 0;
42
+ position: absolute;
43
+ z-index: 1;
44
+ bottom: 150%;
45
+
46
+ &:after {
47
+ content: "";
48
+ position: absolute;
49
+ top: 100%;
50
+ left: 50%;
51
+ margin-left: -5px;
52
+ border-width: 5px;
53
+ border-style: solid;
54
+ border-color: rgba(0, 0, 0, var(--iui-opacity-3)) transparent
55
+ transparent transparent;
56
+ }
57
+ }
58
+ }
59
+ }
60
+
61
+ .scrubber-handle {
62
+ pointer-events: none;
63
+ position: absolute;
64
+ width: 38px;
65
+ height: 20px;
66
+ border-radius: var(--iui-border-radius-1);
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ box-sizing: border-box;
71
+ cursor: pointer;
72
+
73
+ > div {
74
+ width: 1px;
75
+ height: 10px;
76
+ margin: 0 1px;
77
+ background-color: var(--iui-color-border-subtle);
78
+ }
79
+ }
80
+
81
+ .scrubber-track {
82
+ position: absolute;
83
+ top: 50%;
84
+ transform: translateY(-50%);
85
+ height: 4px;
86
+ z-index: 1;
87
+ cursor: pointer;
88
+ }
89
+
90
+ .components-timeline-date-marker {
91
+ pointer-events: none;
92
+ position: absolute;
93
+ display: flex;
94
+ align-items: center;
95
+ justify-content: center;
96
+ transform: translateY(50%);
97
+ }
98
+
99
+ .date-marker-default {
100
+ height: 12px;
101
+ width: 3px;
102
+ border-radius: var(--iui-border-radius-1);
103
+ transform: translateY(1px);
104
+ background-color: var(--iui-color-border);
105
+ }