diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b03512cdec..8b4c285371e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,25 @@ All notable changes for each version of this project will be documented in this ## 22.3.1 +### General + +- `IgxSplitterComponent` + - An app that sets `--ig-size` to medium or large on the splitter or on an ancestor gets a thicker bar. Previously the splitter had one size (#18013). + - The 48px gap around the drag handle is measured from the icon box of the design, so each expander is 5px further from the handle at the default size, 3px in the Indigo theme. The area of an expander that takes the pointer is that icon box, centered on the arrow: 18px, 20px or 24px square, 14px, 16px or 24px in the Indigo theme. Previously it was 16px by 12px at the default size in every theme. + - In the Indigo theme, the idle bar is 1px thick at the default size also with an overridden `--ig-splitter-size`. Previously it was thicker, 2px for `--ig-splitter-size: 10px`. + +### New Functionality + +- `IgxSplitterComponent` + - The splitter follows `--ig-size`. The bar is 6px, 12px or 18px thick, the drag handle 4px, 6px or 8px with a 2px, 8px or 8px radius, and the expanders grow with them. The default is small, which is the size from before, so a splitter without `--ig-size` looks the same. `--size` and `--ig-splitter-size` still set the small size, and the medium and large steps add to it. A `--border-radius` or `--ig-splitter-border-radius` that you set applies at every size. In the Indigo theme the idle bar is 1px, 4px or 8px thick by size, and the area around the bar that takes the pointer grows with the bar (#18013). + ```html + ... + ``` + ### Bug Fixes +- `IgxSplitterComponent` + - On a bar too short for the drag handle, the two expanders and the 48px gaps between them, the drag handle keeps 25% of the bar length and the gaps get narrower. Previously the gaps stayed 48px, so the handle shrank and the expanders touched the ends of the bar (#18013). - `IgxGridComponent`, `IgxTreeGridComponent`, `IgxHierarchicalGridComponent` - In the filtering row of a date column, `Alt + Arrow Down` in the date input keeps the focus in the opened calendar. Previously the focus moved to the conditions button (#17936). - In the filtering row, `Alt + Arrow Down` on the conditions button opens the conditions, and not the date or time picker. With a unary condition, such as Today, the date and time inputs are read-only and `Alt + Arrow Down` in them opens the conditions. `Tab` on the conditions button closes the conditions. Previously they opened again. diff --git a/package-lock.json b/package-lock.json index b660d19f6f8..51a6e3799f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -80,7 +80,7 @@ "igniteui-grid-lite": "~0.12.0", "igniteui-i18n-resources": "^2.0.0", "igniteui-sassdoc-theme": "^3.0.0", - "igniteui-theming": "^30.2.0", + "igniteui-theming": "^30.3.0", "igniteui-webcomponents": "^7.5.0", "lit-html": "^3.2.1", "ng-packagr": "^22.0.0", @@ -9609,13 +9609,6 @@ "ieee754": "^1.1.13" } }, - "node_modules/buffer-builder": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/buffer-builder/-/buffer-builder-0.2.0.tgz", - "integrity": "sha512-7VPMEPuYznPSoR21NE1zvd2Xna6c/CloiZCfcMXR1Jny6PjX0N4Nsa38zcBFo/FMK+BlA+FLKbJCQ0i2yxp+Xg==", - "dev": true, - "license": "MIT/X11" - }, "node_modules/buffer-equal": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.1.tgz", @@ -14892,429 +14885,27 @@ } }, "node_modules/igniteui-theming": { - "version": "30.2.0", - "resolved": "https://registry.npmjs.org/igniteui-theming/-/igniteui-theming-30.2.0.tgz", - "integrity": "sha512-nYdHKYG1FjuzB3rpz6sLlc2sYTR4HOABB3wuWokQwZj8i/cfvoBbJrsH9JESXGwcyYuq++3ZaaFG4yWBWEZG7Q==", + "version": "30.3.0", + "resolved": "https://registry.npmjs.org/igniteui-theming/-/igniteui-theming-30.3.0.tgz", + "integrity": "sha512-wBA819JhqdDYkCUF6Y/EE1n93rfflJuYEZhd1U28zvQlRBBaM702BLoNb1pno1tziQ63BaXqHv1QMjPpn0i8iQ==", "dev": true, "license": "MIT", "dependencies": { "@modelcontextprotocol/sdk": "^1.32.1", - "sass-embedded": "~1.92.1", + "sass-embedded": "^1.97.1", "zod": "^4.6.7" }, "bin": { "igniteui-theming": "dist/mcp/index.js", "igniteui-theming-mcp": "dist/mcp/index.js" - } - }, - "node_modules/igniteui-theming/node_modules/chokidar": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", - "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "readdirp": "^4.0.1" - }, - "engines": { - "node": ">= 14.16.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/igniteui-theming/node_modules/colorjs.io": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/colorjs.io/-/colorjs.io-0.5.2.tgz", - "integrity": "sha512-twmVoizEW7ylZSN32OgKdXRmo1qg+wT5/6C3xu5b9QsWzSFAhHLn2xd8ro0diCsKfCj1RdaTP/nrcW+vAoQPIw==", - "dev": true, - "license": "MIT" - }, - "node_modules/igniteui-theming/node_modules/readdirp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", - "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", - "dev": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">= 14.18.0" }, - "funding": { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/igniteui-theming/node_modules/sass": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.92.1.tgz", - "integrity": "sha512-ffmsdbwqb3XeyR8jJR6KelIXARM9bFQe8A6Q3W4Klmwy5Ckd5gz7jgUNHo4UOqutU5Sk1DtKLbpDP0nLCg1xqQ==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "chokidar": "^4.0.0", - "immutable": "^5.0.2", - "source-map-js": ">=0.6.2 <2.0.0" - }, - "bin": { - "sass": "sass.js" - }, - "engines": { - "node": ">=14.0.0" - }, - "optionalDependencies": { - "@parcel/watcher": "^2.4.1" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded/-/sass-embedded-1.92.1.tgz", - "integrity": "sha512-28YwLnF5atAhogt3E4hXzz/NB9dwKffyw08a7DEasLh94P7+aELkG3ENSHYCWB9QFN14hYNLfwr9ozUsPDhcDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@bufbuild/protobuf": "^2.5.0", - "buffer-builder": "^0.2.0", - "colorjs.io": "^0.5.0", - "immutable": "^5.0.2", - "rxjs": "^7.4.0", - "supports-color": "^8.1.1", - "sync-child-process": "^1.0.2", - "varint": "^6.0.0" - }, - "bin": { - "sass": "dist/bin/sass.js" - }, - "engines": { - "node": ">=16.0.0" + "peerDependencies": { + "sass": ">=1.97.1" }, - "optionalDependencies": { - "sass-embedded-all-unknown": "1.92.1", - "sass-embedded-android-arm": "1.92.1", - "sass-embedded-android-arm64": "1.92.1", - "sass-embedded-android-riscv64": "1.92.1", - "sass-embedded-android-x64": "1.92.1", - "sass-embedded-darwin-arm64": "1.92.1", - "sass-embedded-darwin-x64": "1.92.1", - "sass-embedded-linux-arm": "1.92.1", - "sass-embedded-linux-arm64": "1.92.1", - "sass-embedded-linux-musl-arm": "1.92.1", - "sass-embedded-linux-musl-arm64": "1.92.1", - "sass-embedded-linux-musl-riscv64": "1.92.1", - "sass-embedded-linux-musl-x64": "1.92.1", - "sass-embedded-linux-riscv64": "1.92.1", - "sass-embedded-linux-x64": "1.92.1", - "sass-embedded-unknown-all": "1.92.1", - "sass-embedded-win32-arm64": "1.92.1", - "sass-embedded-win32-x64": "1.92.1" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-all-unknown": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-all-unknown/-/sass-embedded-all-unknown-1.92.1.tgz", - "integrity": "sha512-5t6/YZf+vhO3OY/49h8RCL6Cwo78luva0M+TnTM9gu9ASffRXAuOVLNKciSXa3loptyemDDS6IU5/dVH5w0KmA==", - "cpu": [ - "!arm", - "!arm64", - "!riscv64", - "!x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "sass": "1.92.1" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-android-arm": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-android-arm/-/sass-embedded-android-arm-1.92.1.tgz", - "integrity": "sha512-4EjpVVzuksERdgAd4BqeSXFnWtWN3DSRyEIUPJ7BhcS9sfDh2Gf6miI2kNTvIQLJ2XIJynDDcEQ8a1U9KwKUTQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-android-arm64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-android-arm64/-/sass-embedded-android-arm64-1.92.1.tgz", - "integrity": "sha512-Q+UruGb7yKawHagVmVDRRKsnc4mJZvWMBnuRCu2coJo2FofyqBmXohVGXbxko97sYceA9TJTrUEx3WVKQUNCbQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-android-riscv64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-android-riscv64/-/sass-embedded-android-riscv64-1.92.1.tgz", - "integrity": "sha512-nCY5btLlX7W7Jc6cCL6D2Yklpiu540EJ2G08YVGu12DrAMCBzqM347CSRf2ojp1H8jyhvmLkaFwnrJWzh+6S+w==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-android-x64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-android-x64/-/sass-embedded-android-x64-1.92.1.tgz", - "integrity": "sha512-qYWR3bftJ77aLYwYDFuzDI4dcwVVixxqQxlIQWNGkHRCexj614qGSSHemr18C2eVj3mjXAQxTQxU68U7pkGPAA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-darwin-arm64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-darwin-arm64/-/sass-embedded-darwin-arm64-1.92.1.tgz", - "integrity": "sha512-g2yQ3txjMYLKMjL2cW1xRO9nnV3ijf95NbX/QShtV6tiVUETZNWDsRMDEwBNGYY6PTE/UZerjJL1R/2xpQg6WA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-darwin-x64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-darwin-x64/-/sass-embedded-darwin-x64-1.92.1.tgz", - "integrity": "sha512-eH+fgxLQhTEPjZPCgPAVuX5e514Qp/4DMAUMtlNShv4cr4TD5qOp1XlsPYR/b7uE7p2cKFkUpUn/bHNqJ2ay4A==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-linux-arm": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm/-/sass-embedded-linux-arm-1.92.1.tgz", - "integrity": "sha512-cT3w8yoQTqrtZvWLJeutEGmawITDTY4J6oSVQjeDcPnnoPt0gOFxem8YMznraACXvahw/2+KJDH33BTNgiPo0A==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-linux-arm64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm64/-/sass-embedded-linux-arm64-1.92.1.tgz", - "integrity": "sha512-dNmlpGeZkry1BofhAdGFBXrpM69y9LlYuNnncf+HfsOOUtj8j0q1RwS+zb5asknhKFUOAG8GCGRY1df7Rwu35g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-linux-musl-arm": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm/-/sass-embedded-linux-musl-arm-1.92.1.tgz", - "integrity": "sha512-nPBos6lI31ef2zQhqTZhFOU7ar4impJbLIax0XsqS269YsiCwjhk11VmUloJTpFlJuKMiVXNo7dPx+katxhD/Q==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-linux-musl-arm64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm64/-/sass-embedded-linux-musl-arm64-1.92.1.tgz", - "integrity": "sha512-TfiEBkCyNzVoOhjHXUT+vZ6+p0ueDbvRw6f4jHdkvljZzXdXMby4wh7BU1odl69rgRTkSvYKhgbErRLDR/F7pQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-linux-musl-riscv64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-riscv64/-/sass-embedded-linux-musl-riscv64-1.92.1.tgz", - "integrity": "sha512-R+RcJA4EYpJDE9JM1GgPYgZo7x94FlxZ6jPodOQkEaZ1S9kvXVCuP5X/0PXRPhu08KJOfeMsAElzfdAjUf7KJg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-linux-musl-x64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-x64/-/sass-embedded-linux-musl-x64-1.92.1.tgz", - "integrity": "sha512-/HolYRGXJjx8nLw6oj5ZrkR7PFM7X/5kE4MYZaFMpDIPIcw3bqB2fUXLo/MYlRLsw7gBAT6hJAMBrNdKuTphfw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-linux-riscv64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-riscv64/-/sass-embedded-linux-riscv64-1.92.1.tgz", - "integrity": "sha512-b9bxe0CMsbSsLx3nrR0cq8xpIkoAC6X36o4DGMITF3m2v3KsojC7ru9X0Gz+zUFr6rwpq/0lTNzFLNu6sPNo3w==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-linux-x64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-x64/-/sass-embedded-linux-x64-1.92.1.tgz", - "integrity": "sha512-xuiK5Jp5NldW4bvlC7AuX1Wf7o0gLZ3md/hNg+bkTvxtCDgnUHtfdo8Q+xWP11bD9QX31xXFWpmUB8UDLi6XQQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-unknown-all": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-unknown-all/-/sass-embedded-unknown-all-1.92.1.tgz", - "integrity": "sha512-AT9oXvtNY4N+Nd0wvoWqq9A5HjdH/X3aUH4boQUtXyaJ/9DUwnQmBpP5Gtn028ZS8exOGBdobmmWAuigv0k/OA==", - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "!android", - "!darwin", - "!linux", - "!win32" - ], - "dependencies": { - "sass": "1.92.1" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-win32-arm64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-win32-arm64/-/sass-embedded-win32-arm64-1.92.1.tgz", - "integrity": "sha512-KvmpQjY9yTBMtTYz4WBqetlv9bGaDW1aStcu7MSTbH7YiSybX/9fnxlCAEQv1WlIidQhcJAiyk0Eae+LGK7cIQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/igniteui-theming/node_modules/sass-embedded-win32-x64": { - "version": "1.92.1", - "resolved": "https://registry.npmjs.org/sass-embedded-win32-x64/-/sass-embedded-win32-x64-1.92.1.tgz", - "integrity": "sha512-B6Nz/GbH7Vkpb2TkQHsGcczWM5t+70VWopWF1x5V5yxLpA8ZzVQ7NTKKi+jDoVY2Efu6ZyzgT9n5KgG2kWliXA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=14.0.0" + "peerDependenciesMeta": { + "sass": { + "optional": true + } } }, "node_modules/igniteui-theming/node_modules/zod": { diff --git a/package.json b/package.json index 78aa64625dd..00c896e3252 100644 --- a/package.json +++ b/package.json @@ -136,7 +136,7 @@ "igniteui-grid-lite": "~0.12.0", "igniteui-i18n-resources": "^2.0.0", "igniteui-sassdoc-theme": "^3.0.0", - "igniteui-theming": "^30.2.0", + "igniteui-theming": "^30.3.0", "igniteui-webcomponents": "^7.5.0", "lit-html": "^3.2.1", "ng-packagr": "^22.0.0", diff --git a/projects/igniteui-angular/package.json b/projects/igniteui-angular/package.json index dc07f364428..4f23407bf59 100644 --- a/projects/igniteui-angular/package.json +++ b/projects/igniteui-angular/package.json @@ -75,7 +75,7 @@ "igniteui-trial-watermark": "^3.1.0", "jspdf": "^4.2.1", "lodash-es": "^4.17.21", - "igniteui-theming": "^30.2.0", + "igniteui-theming": "^30.3.0", "igniteui-i18n-core": "^2.0.0", "@igniteui/material-icons-extended": "^3.1.0" }, diff --git a/projects/igniteui-angular/splitter/README.md b/projects/igniteui-angular/splitter/README.md index e95970aaee3..b8b49477a72 100644 --- a/projects/igniteui-angular/splitter/README.md +++ b/projects/igniteui-angular/splitter/README.md @@ -59,6 +59,21 @@ export class SplitLayoutComponent { - **Non-collapsible bars** – set `nonCollapsible` on the splitter to hide the expanders and disable collapsing with `Ctrl` + arrow keys when panes must stay visible. - **Keyboard support** – users can resize with the arrow keys (by 10px per key press, emitting the same resize events as a drag); combine with `Ctrl` to collapse or expand panes. A splitter bar stays in the tab order unless it can neither resize nor collapse its panes. - **Drag constraints** – `minSize` and `maxSize` (px or % of the splitter size) enforce boundaries while resizing, ensuring important content stays visible. +- **Sizing** – the splitter has no size input. It follows `--ig-size`, set on the splitter or on an ancestor, and defaults to small. + + ```html + ... + ``` + + | Size | Bar thickness | Drag handle thickness | Drag handle radius | Expander height | + | --- | --- | --- | --- | --- | + | small | 6px | 4px | 2px | 4px | + | medium | 12px | 6px | 8px | 5px | + | large | 18px | 8px | 8px | 6px | + + The steps add to the `size` theme token (4px), so `--ig-splitter-size: 10px` makes the bar 12px, 18px and 24px and the drag handle 10px, 12px and 14px. + + The drag handle is 48px from the icon box of each expander: the 18px, 20px and 24px icon of the design, 14px, 16px and 24px in the Indigo theme. That box, centered on the arrow, is also the area of the expander that takes the pointer. In the Indigo theme the idle bar is 1px, 4px and 8px thick by size. ## API Reference diff --git a/projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts b/projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts index faead79f9b9..f6b3651bf44 100644 --- a/projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts +++ b/projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts @@ -1,5 +1,5 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { Component, ViewChild, DebugElement, ChangeDetectionStrategy, provideZonelessChangeDetection } from '@angular/core'; +import { Component, ViewChild, DebugElement, ChangeDetectionStrategy, ViewEncapsulation, provideZonelessChangeDetection } from '@angular/core'; import { SplitterType, IgxSplitterComponent, ISplitterBarResizeEventArgs } from './splitter.component'; import { By } from '@angular/platform-browser'; import { UIInteractions, wait } from '../../../test-utils/ui-interactions.spec'; @@ -925,6 +925,187 @@ describe('IgxSplitter resizing with minSize and browser window is shrinked', () }); }); +describe('IgxSplitter sizing', () => { + const steps = [ + { size: 'small', value: '1', bar: 6, handle: 4, expander: 4, radius: 2, space: 5 }, + { size: 'medium', value: '2', bar: 12, handle: 6, expander: 5, radius: 8, space: 5 }, + { size: 'large', value: '3', bar: 18, handle: 8, expander: 6, radius: 8, space: 6 } + ]; + let fixture: ComponentFixture; + + const measure = () => { + const host: HTMLElement = fixture.nativeElement; + // Finishes a bar transition that is still running. + document.getAnimations().forEach(animation => animation.finish()); + // The bar of a horizontal splitter is a vertical line, so its thickness is its width. + const extent = fixture.componentInstance.type === SplitterType.Horizontal ? 'width' : 'height'; + const length = extent === 'width' ? 'height' : 'width'; + const rect = (selector: string) => host.querySelector(selector).getBoundingClientRect(); + const bar = rect(SPLITTERBAR_DIV_CLASS); + const handle = rect('.igx-splitter-bar__handle'); + const expander = rect('.igx-splitter-bar__expander--start'); + + return { + bar: bar[extent], + barLength: bar[length], + handle: handle[extent], + handleLength: handle[length], + handleRadius: getComputedStyle(host.querySelector('.igx-splitter-bar__handle')).borderRadius, + expander: expander[extent], + expanderBase: expander[length] + }; + }; + + beforeEach(async () => { + await TestBed.configureTestingModule({ imports: [SplitterSizingComponent] }).compileComponents(); + fixture = TestBed.createComponent(SplitterSizingComponent); + fixture.detectChanges(); + }); + + it('should render the small size without --ig-size', () => { + const { bar, handle, handleRadius, expander, expanderBase } = measure(); + + expect(bar).toBe(6); + expect(handle).toBe(4); + expect(handleRadius).toBe('2px'); + expect(expander).toBe(4); + expect(expanderBase).toBe(8); + }); + + it('should size the bar, the handle and the expanders at medium and large', () => { + for (const step of steps.slice(1)) { + fixture.componentInstance.size = step.value; + fixture.detectChanges(); + + const { bar, handle, handleRadius, expander, expanderBase } = measure(); + + expect(bar, step.size).toBe(step.bar); + expect(handle, step.size).toBe(step.handle); + expect(handleRadius, step.size).toBe(`${step.radius}px`); + expect(expander, step.size).toBe(step.expander); + expect(expanderBase, step.size).toBe(step.expander * 2); + } + }); + + it('should add each step to an overridden --ig-splitter-size', () => { + fixture.componentInstance.baseSize = '10px'; + + for (const step of steps) { + fixture.componentInstance.size = step.value; + fixture.detectChanges(); + + const { bar, handle, expander } = measure(); + + // 6px more than the default 4px size at every step. + expect(bar, step.size).toBe(step.bar + 6); + expect(handle, step.size).toBe(step.handle + 6); + expect(expander, step.size).toBe(step.expander + 6); + } + }); + + const gaps = () => { + const host: HTMLElement = fixture.nativeElement; + document.getAnimations().forEach(animation => animation.finish()); + const rect = (selector: string) => host.querySelector(selector).getBoundingClientRect(); + const bar = rect(SPLITTERBAR_DIV_CLASS); + const handle = rect('.igx-splitter-bar__handle'); + const start = rect('.igx-splitter-bar__expander--start'); + const end = rect('.igx-splitter-bar__expander--end'); + + return { + handleGaps: [handle.top - start.bottom, end.top - handle.bottom], + inside: start.top >= bar.top && end.bottom <= bar.bottom + }; + }; + + it('should keep 48px between the handle and the icon box of each expander at every size', () => { + for (const step of steps) { + fixture.componentInstance.size = step.value; + fixture.detectChanges(); + document.getAnimations().forEach(animation => animation.finish()); + + const gap = 48 + step.space; + expect(gaps().handleGaps, step.size).toEqual([gap, gap]); + } + }); + + const hitboxes = () => { + const host: HTMLElement = fixture.nativeElement; + document.getAnimations().forEach(animation => animation.finish()); + + return ['start', 'end'].map(side => { + const expander = host.querySelector(`.igx-splitter-bar__expander--${side}`); + const border = getComputedStyle(expander); + const box = getComputedStyle(expander, '::before'); + const px = (value: string) => parseFloat(value); + const width = px(box.width); + const height = px(box.height); + + return { + width, + height, + // The offset of the center of the hitbox from the center of the triangle. + offsetX: px(box.left) + width / 2 - (px(border.borderRightWidth) - px(border.borderLeftWidth)) / 2, + offsetY: px(box.top) + height / 2 - (px(border.borderBottomWidth) - px(border.borderTopWidth)) / 2 + }; + }); + }; + + it('should size the hitbox of each expander to the icon box and center it on the triangle', () => { + for (const type of [SplitterType.Horizontal, SplitterType.Vertical]) { + fixture.componentInstance.type = type; + + for (const step of steps) { + fixture.componentInstance.size = step.value; + fixture.detectChanges(); + + const box = 2 * step.expander + 2 * step.space; + const centered = { width: box, height: box, offsetX: 0, offsetY: 0 }; + expect(hitboxes(), `${step.size} ${type}`).toEqual([centered, centered]); + } + } + }); + + it('should keep the 48px margins around the handle with a collapsed pane', () => { + const panes = fixture.componentInstance.splitter.panes.toArray(); + const handleTop = () => { + const host: HTMLElement = fixture.nativeElement; + document.getAnimations().forEach(animation => animation.finish()); + return host.querySelector('.igx-splitter-bar__handle').getBoundingClientRect().top + - host.querySelector(SPLITTERBAR_DIV_CLASS).getBoundingClientRect().top; + }; + // The handle, its two 48px margins and the 18px box of the one expander that is left, centered in the 400px bar. + const groupStart = (400 - (100 + 96 + 18)) / 2; + + panes[0].toggle(); + fixture.detectChanges(); + expect(handleTop()).toBe(groupStart + 48); + + panes[0].toggle(); + panes[1].toggle(); + fixture.detectChanges(); + expect(handleTop()).toBe(groupStart + 18 + 48); + }); + + it('should keep the handle at 25% of a short bar and narrow the gaps at every size', () => { + fixture.componentInstance.height = '128px'; + + for (const step of steps) { + fixture.componentInstance.size = step.value; + fixture.detectChanges(); + + const { handleLength } = measure(); + const { handleGaps, inside } = gaps(); + // Half of what the bar leaves after the handle, less the triangle and the space on its far side. + const gap = (128 - 32) / 2 - step.expander * 2 - step.space; + + expect(handleLength, step.size).toBe(32); + expect(handleGaps, step.size).toEqual([gap, gap]); + expect(inside, step.size).toBe(true); + } + }); +}); + describe('Zoneless IgxSplitter', () => { let fixture: ComponentFixture; let splitter: IgxSplitterComponent; @@ -1075,3 +1256,35 @@ export class SplitterCollapsedPaneComponent extends SplitterTestComponent { export class SplitterForOfPanesComponent extends SplitterTestComponent { public numbers = [1, 2, 3]; } + +@Component({ + template: ` +
+ + Pane 1 + Pane 2 + +
+ `, + // Mirrors the splitter tokens of igniteui-theming that the styles read, which a global theme emits on igx-splitter. + styles: [` + igx-splitter { + --default-size: 1; + --size: var(--ig-splitter-size, 4px); + --border-radius: var(--ig-splitter-border-radius, max(calc(var(--is-large, 1) * 8px), calc(var(--is-medium, 1) * 8px), calc(var(--is-small, 1) * 2px))); + --expander-color: gray; + } + `], + encapsulation: ViewEncapsulation.None, + changeDetection: ChangeDetectionStrategy.Eager, + imports: [IgxSplitterComponent, IgxSplitterPaneComponent] +}) +export class SplitterSizingComponent { + public type = SplitterType.Horizontal; + public size: string = null; + public baseSize: string = null; + + @ViewChild(IgxSplitterComponent, { static: true }) + public splitter: IgxSplitterComponent; + public height = '400px'; +} diff --git a/projects/igniteui-angular/splitter/src/splitter/themes/_base.scss b/projects/igniteui-angular/splitter/src/splitter/themes/_base.scss index d69664278b4..c42c3a86385 100644 --- a/projects/igniteui-angular/splitter/src/splitter/themes/_base.scss +++ b/projects/igniteui-angular/splitter/src/splitter/themes/_base.scss @@ -1,5 +1,4 @@ /* stylelint-disable max-nesting-depth */ -@use 'sass:map'; @use 'sass:string'; @use 'igniteui-theming/sass/animations' as *; @use 'igniteui-theming/sass/bem' as *; @@ -13,14 +12,31 @@ $theme: digest-schema($light-splitter); @include layer(base) { $splitter-color: var-get($theme, 'bar-color'); - $splitter-size: var-get($theme, 'size'); + $size: var-get($theme, 'size'); + $bar-size: var(--_bar-size); + $handle-size: var(--_handle-size); + $expander-size: var(--_expander-size); + $expander-space: var(--_expander-space); + + // The length an expander takes of the bar: the triangle and the space on its two sides. + $expander-box: calc(2 * #{$expander-size} + 2 * #{$expander-space}); $hitbox-size: rem(4px); $debug-hitbox: false; $hitbox-debug-color: rgba(coral, 0.24); @include b(igx-splitter) { - //splitter-size (convert rem to px) + padding - --splitter-size: calc(#{unitless(map.get($theme, 'size'))} * (var(--ig-base-font-size, 16px) / 1px) + 2); + @include sizable(); + + --component-size: var(--ig-size, #{var-get($theme, 'default-size')}); + + // The steps are not theme tokens, so the handle can't be set thicker than the bar. + // Mirrored by the :host block of igc-splitter in igniteui-webcomponents. + --_bar-size: #{sizable(calc(#{$size} + #{rem(2px)}), calc(#{$size} + #{rem(8px)}), calc(#{$size} + #{rem(14px)}))}; + --_handle-size: #{sizable($size, calc(#{$size} + #{rem(2px)}), calc(#{$size} + #{rem(4px)}))}; + --_expander-size: #{sizable($size, calc(#{$size} + #{rem(1px)}), calc(#{$size} + #{rem(2px)}))}; + + // The space from a triangle to the edge of the 18px, 20px and 24px icon box of the design. + --_expander-space: #{sizable(rem(5px), rem(5px), rem(6px))}; &[aria-orientation='horizontal'] { [dir='rtl'] & { @@ -46,7 +62,10 @@ $theme: digest-schema($light-splitter); justify-content: center; align-items: center; background: $splitter-color; - padding-block: rem(1px); + height: $bar-size; + + // Gives the drag handle the bar length, as container query units. + container-type: size; z-index: 99; opacity: 0.68; transition: opacity 0.15s $ease-out-quad !important; @@ -100,56 +119,59 @@ $theme: digest-schema($light-splitter); @include e(handle, $m: horizontal) { width: 25%; - height: $splitter-size; - margin: 0 rem(48px); + height: $handle-size; + + // The room for one margin when the bar is too short for 48px: half of what the 25% handle + // leaves, less one expander. 1cqw is 1% of the bar length, with the bar as the size container. + margin: 0 clamp(0px, calc((100cqw - 25cqw) / 2 - #{$expander-box}), #{rem(48px)}); } @include e(handle, $m: vertical) { - width: $splitter-size; + width: $handle-size; height: 25%; - margin: rem(48px) 0; + margin: clamp(0px, calc((100cqh - 25cqh) / 2 - #{$expander-box}), #{rem(48px)}) 0; } @include e(expander) { position: relative; width: 0; height: 0; - border-inline-end: $splitter-size solid transparent; - border-inline-start: $splitter-size solid transparent; + border-inline-end: $expander-size solid transparent; + border-inline-start: $expander-size solid transparent; + margin: 0 $expander-space; cursor: pointer; opacity: 0; transition: opacity 0.25s 0.5s ease; pointer-events: none; z-index: 1; + // The hitbox is the icon box of the design, centered on the triangle. &::before { position: absolute; content: ''; + width: $expander-box; + height: $expander-box; background: if($debug-hitbox, $hitbox-debug-color, transparent); } } @include e(expander, $m: 'start') { - border-block-end: $splitter-size solid + border-block-end: $expander-size solid var-get($theme, 'expander-color'); &::before { - top: calc(100% - #{map.get($theme, 'size')}); - left: calc(100% - (#{map.get($theme, 'size')} * 2)); - width: calc(#{map.get($theme, 'size')} * 4); - height: calc(#{map.get($theme, 'size')} * 3); + top: calc((#{$expander-size} - #{$expander-box}) / 2); + inset-inline-start: calc(#{$expander-box} / -2); } } @include e(expander, $m: 'end') { - border-block-start: $splitter-size solid + border-block-start: $expander-size solid var-get($theme, 'expander-color'); &::before { - top: calc(100% - (#{map.get($theme, 'size')} * 2)); - left: calc(100% - (#{map.get($theme, 'size')} * 2)); - width: calc(#{map.get($theme, 'size')} * 4); - height: calc(#{map.get($theme, 'size')} * 3); + top: calc((#{$expander-size} + #{$expander-box}) / -2); + inset-inline-start: calc(#{$expander-box} / -2); } } @@ -172,8 +194,8 @@ $theme: digest-schema($light-splitter); @include m(vertical) { flex-direction: column; + width: $bar-size; height: 100%; - padding: 0 rem(1px); &::before, &::after { @@ -190,33 +212,33 @@ $theme: digest-schema($light-splitter); left: 100%; } + @include e(expander) { + margin: $expander-space 0; + } + @include e(expander, $m: 'start') { - border-block-start: $splitter-size solid transparent; - border-inline-end: $splitter-size solid + border-block-start: $expander-size solid transparent; + border-inline-end: $expander-size solid var-get($theme, 'expander-color'); - border-block-end: $splitter-size solid transparent; + border-block-end: $expander-size solid transparent; border-inline-start: unset; &::before { - top: calc(100% - (#{map.get($theme, 'size')} * 2)); - left: calc(100% - (#{map.get($theme, 'size')})); - width: calc(#{map.get($theme, 'size')} * 3); - height: calc(#{map.get($theme, 'size')} * 4); + top: calc(#{$expander-box} / -2); + inset-inline-start: calc((#{$expander-size} - #{$expander-box}) / 2); } } @include e(expander, $m: 'end') { - border-block-start: $splitter-size solid transparent; + border-block-start: $expander-size solid transparent; border-inline-end: unset; - border-block-end: $splitter-size solid transparent; - border-inline-start: $splitter-size solid + border-block-end: $expander-size solid transparent; + border-inline-start: $expander-size solid var-get($theme, 'expander-color'); &::before { - top: calc(100% - (#{map.get($theme, 'size')} * 2)); - left: calc(100% - (#{map.get($theme, 'size')} * 2)); - height: calc(#{map.get($theme, 'size')} * 4); - width: calc(#{map.get($theme, 'size')} * 3); + top: calc(#{$expander-box} / -2); + inset-inline-start: calc((#{$expander-size} + #{$expander-box}) / -2); } } diff --git a/projects/igniteui-angular/splitter/src/splitter/themes/shared/indigo.scss b/projects/igniteui-angular/splitter/src/splitter/themes/shared/indigo.scss index 365f9b2567e..7d5b144592e 100644 --- a/projects/igniteui-angular/splitter/src/splitter/themes/shared/indigo.scss +++ b/projects/igniteui-angular/splitter/src/splitter/themes/shared/indigo.scss @@ -1,13 +1,27 @@ /* stylelint-disable max-nesting-depth */ @use 'igniteui-theming/sass/animations' as *; @use 'igniteui-theming/sass/bem' as *; +@use 'igniteui-theming/sass/themes' as *; +@use 'igniteui-theming/sass/typography' as *; @use '../../../../../core/src/core/styles/themes/scoping' as *; @use 'igniteui-theming/sass/themes/schemas/components/light/splitter' as *; $theme: digest-schema($indigo-splitter); -$slim-splitter: calc(1 / var(--splitter-size)); +$bar-size: var(--_bar-size); + +// The scale that leaves the idle thickness of the bar: idle / bar thickness, as a number. +// CSS can't divide two lengths, and tan(atan2(a, b)) equals a / b. +$slim-splitter: tan(atan2(var(--_idle-size), #{$bar-size})); @include themed-block(igx-splitter, indigo) { + @include b(igx-splitter) { + // Mirrored by the :host block of the indigo igc-splitter theme in igniteui-webcomponents. + --_idle-size: #{sizable(rem(1px), rem(4px), rem(8px))}; + + // The icon box of the design is 14px, 16px and 24px in this theme. + --_expander-space: #{sizable(rem(3px), rem(3px), rem(6px))}; + } + @include b(igx-splitter-bar-host) { transition: box-shadow 0.25s 0.1s ease-in; @@ -97,14 +111,14 @@ $slim-splitter: calc(1 / var(--splitter-size)); @include m(horizontal) { &::before, &::after { - height: calc(var(--splitter-size) * 4px); + height: calc(#{$bar-size} * 4); } } @include m(vertical) { &::before, &::after { - width: calc(var(--splitter-size) * 4px); + width: calc(#{$bar-size} * 4); } } }