diff --git a/common/changes/@itwin/components-react/add-missing-peer_2024-12-09-19-16.json b/common/changes/@itwin/components-react/add-missing-peer_2024-12-09-19-16.json new file mode 100644 index 00000000000..b7e7de56d76 --- /dev/null +++ b/common/changes/@itwin/components-react/add-missing-peer_2024-12-09-19-16.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/components-react", + "comment": "Remove `@itwin/core-geometry` usage from `@itwin/components-react`", + "type": "none" + } + ], + "packageName": "@itwin/components-react" +} diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index cf90e163c99..b81338459f6 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -756,9 +756,6 @@ importers: '@itwin/core-common': specifier: ^4.0.0 version: 4.4.0(@itwin/core-bentley@4.4.0)(@itwin/core-geometry@4.4.0) - '@itwin/core-geometry': - specifier: ^4.0.0 - version: 4.4.0 '@itwin/core-i18n': specifier: ^4.0.0 version: 4.4.0(@itwin/core-bentley@4.4.0) diff --git a/ui/components-react/package.json b/ui/components-react/package.json index 91e9a070f36..1f0058cc00a 100644 --- a/ui/components-react/package.json +++ b/ui/components-react/package.json @@ -66,7 +66,6 @@ "@itwin/build-tools": "4.10.0-dev.31", "@itwin/core-bentley": "^4.0.0", "@itwin/core-common": "^4.0.0", - "@itwin/core-geometry": "^4.0.0", "@itwin/core-i18n": "^4.0.0", "@itwin/core-react": "workspace:*", "@itwin/eslint-plugin": "^4.1.1", diff --git a/ui/components-react/src/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.tsx b/ui/components-react/src/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.tsx index 659b4f19b78..c360ee44505 100644 --- a/ui/components-react/src/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.tsx +++ b/ui/components-react/src/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.tsx @@ -3,7 +3,6 @@ * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ import * as React from "react"; -import { Geometry } from "@itwin/core-geometry"; import type { PropertyListProps } from "./PropertyList.js"; import { Orientation } from "../../common/Orientation.js"; @@ -79,7 +78,7 @@ export class ColumnResizingPropertyListPropsSupplier extends React.Component< }; private _onColumnRatioChanged = (ratio: number) => { - ratio = Geometry.clamp(ratio, this._minRatio, this._maxRatio); + ratio = clamp(ratio, this._minRatio, this._maxRatio); if (this.state.columnRatio === ratio) return { ratio }; this.setState({ columnRatio: ratio }); @@ -140,11 +139,7 @@ export class ColumnResizingPropertyListPropsSupplier extends React.Component< } private getValidColumnRatio(): number { - return Geometry.clamp( - this.state.columnRatio, - this._minRatio, - this._maxRatio - ); + return clamp(this.state.columnRatio, this._minRatio, this._maxRatio); } public override render() { @@ -167,3 +162,7 @@ export class ColumnResizingPropertyListPropsSupplier extends React.Component< return this.props.children(listProps); } } + +function clamp(value: number, min: number, max: number) { + return Math.max(min, Math.min(max, value)); +}