Highlights
- A smaller DatePicker. A page with a DatePicker ships 4.2 kB less minified JS (947 B gzipped), and the calendar engine is 2.1 kB smaller minified. The calendar's CSS uses lighter selectors, and
all.cssis 762 B smaller minified. - Smaller builds with carbon-preprocess-svelte. With
optimizeComponents, a page with a Modal ships 25% less CSS, and Dropdown, MultiSelect and DataTable pages up to 2% less JS (see Builds). - Four DatePicker fixes, including forced colors (Windows contrast themes) and reduced motion.
Bug Fixes
- date-picker: keep a selected month, quarter or year filled on hover by @metonym in #5722
- date-picker: skip the open animation under reduced motion by @metonym in #5722
- date-picker: keep the calendar open when the field's label is clicked by @metonym in #5728
- date-picker: box only a picked week's ends in forced colors by @metonym in #5738
- file-uploader: size a FileUploaderItem from its Form by @metonym in #5718
- ui-shell: keep a header menu arrow full size beside a long title by @metonym in #5716
Performance
- button: let builds drop the in-place tooltip a modal never shows by @metonym in #5714
- composed-modal: let builds drop the close button's in-place tooltip by @metonym in #5714
- let builds follow the loading indicator when there's no delay by @metonym in #5715
DatePicker
Smaller and lighter
The calendar engine sheds what was left of flatpickr's shape (#5723–#5733): its internals no longer hang off the object it returns, events take one callback each instead of an array, and it reports why it closed and handles outside dismissal itself, so DatePicker drops about 160 lines of workarounds and an open calendar adds one fewer window listener. The calendar's styles moved into their own partial with lighter selectors, so app CSS can override a calendar state with one class.
carbon-preprocess-svelte's vite@svelte-5 datepicker example (a single DatePicker), v0.114.3 and v0.114.4:
| v0.114.3 | v0.114.4 | |
|---|---|---|
| JS, minified | 135,165 B | 130,963 B (−3.1%) |
| JS, gzipped | 45,685 B | 44,738 B (−2.1%) |
JS, gzipped, with optimizeComponents
| 42,015 B | 41,075 B (−2.2%) |
| CSS, gzipped | 6,822 B | 6,824 B |
The bundled engine alone (calendar.js) goes from 42,871 to 40,799 B minified (14,109 to 13,758 B gzipped), and all.css from 847,425 to 846,663 B minified.
bind:calendar and every documented prop and event are unchanged. Code that imported src/DatePicker/calendar.js directly and read undocumented internals (_flatpickr, rContainer, yearElements, flatpickr-style hook arrays) needs updating.
Fixes
A hovered selected month, quarter or year no longer turns white on gray. animate no longer slides the calendar in when the system asks for reduced motion. Clicking a field's own label while the calendar is open no longer closes and reopens it. In forced colors (Windows contrast themes), a picked week reads like a range: its first and last days are boxed and the days between read Highlight.
FileUploader
With no size of its own, a standalone FileUploaderItem now matches a sized Form: xs is 24px, sm 32px, md 40px and xl 48px.
Builds
With carbon-preprocess-svelte's optimizeComponents, builds can now drop the in-place tooltip that Modal, SidePanel and ComposedModal close buttons never show, and the loading indicators of Button, ComboBox, Dropdown, MultiSelect, Search and SearchMenu in apps that never set loading (with no loadingDelay). Rendering doesn't change.
// vite.config.js
import { svelte, vitePreprocess } from "@sveltejs/vite-plugin-svelte";
import {
optimizeComponents,
optimizeCss,
optimizeImports,
} from "carbon-preprocess-svelte";
export default {
plugins: [
optimizeComponents(), // before svelte(): it hands svelte() the rewritten source
svelte({ preprocess: [vitePreprocess(), optimizeImports()] }),
optimizeCss(),
],
};carbon-preprocess-svelte's vite@svelte-5 examples, built with optimizeComponents, optimizeImports and optimizeCss, v0.114.3 and v0.114.4:
| Example | JS, gzipped | CSS, gzipped |
|---|---|---|
| Button + Modal | 30,626 → 30,125 B (−1.6%) | 5,952 → 4,452 B (−25.2%) |
| ComposedModal | 31,088 → 30,610 B (−1.5%) | 5,982 → 4,491 B (−24.9%) |
| Dropdown | 37,174 → 36,445 B (−2.0%) | 4,845 → 4,385 B (−9.5%) |
| MultiSelect | 40,459 → 39,727 B (−1.8%) | 6,295 → 5,842 B (−7.2%) |
| DataTable toolbar | 33,224 → 32,733 B (−1.5%) | 5,447 → 5,061 B (−7.1%) |
| TextInput (control) | 19,892 B (no change) | 3,015 B (no change) |
With optimizeCss alone (prop-aware, no optimizeComponents), only the MultiSelect example shrinks, by dropping Button's loading and tooltip rules: CSS 15,245 → 14,422 B gzipped. The others stay within 40 B.
Full Changelog: v0.114.3...v0.114.4