An open source design system that's fully customizable and agent ready
TypeScript
fix(core): keep DateInput's pointer query internal, not a public export (#5316)
Xinzi Zhou0472ec1904b4
diff --git a/.changeset/date-input-touch-surface.md b/.changeset/date-input-touch-surface.mdindex 9549b1bc97..32f315ddd0 100644--- a/.changeset/date-input-touch-surface.md+++ b/.changeset/date-input-touch-surface.md@@ -38,20 +38,21 @@ typable field (its keyboard is right there), while a narrowed desktop window isstill a mouse. Adding a width test would only re-exclude tablets, which are theclearest case for a thumb picker.-The public surface barely moves. One new export — `TOUCH_POINTER_QUERY`, the-media query the switch uses, so an app can ask the same question the component-does and lay out to match — plus six `@astryx.dateInput.*` catalog keys for-the picker's header and footer.+The public surface barely moves: six `@astryx.dateInput.*` catalog keys for the+picker's header and footer, and nothing else. No new props, no new exports —+`DateInputProps` is byte-identical at 25.Nothing else is published, on purpose. There is no export that forces asurface: the touch picker is reachable by being on a touch device, which is-the only place it is worth looking at. The picker's two sizes (the 44px day-cell, the 28px wheel row) are compile-time constants rather than theme-variables — the day size is an accessibility floor, and a variable a theme can-quietly lower is not a floor. And the sheet's header button is addressed by a-`data-` attribute rather than a theme target, because nothing has asked to-restyle it. Each of those is additive later and awkward to withdraw once-shipped.+the only place it is worth looking at. The media query the switch runs on is+an internal constant, not an export — six other core components write+`@media (pointer: coarse)` inline rather than sharing one, and nothing has+asked to ask the same question. The picker's two sizes (the 44px day cell, the+28px wheel row) are compile-time constants rather than theme variables — the+day size is an accessibility floor, and a variable a theme can quietly lower+is not a floor. And the sheet's header button is addressed by a `data-`+attribute rather than a theme target, because nothing has asked to restyle it.+Each of those is additive later and awkward to withdraw once shipped.The wheels also answer a mouse now. A wheel is a scroll container, so a fingerpans it for free; a mouse got nothing, because browsers do not drag-scroll andiff --git a/packages/core/src/DateInput/DateInput.tsx b/packages/core/src/DateInput/DateInput.tsxindex 6868ea65f7..9ab1401313 100644--- a/packages/core/src/DateInput/DateInput.tsx+++ b/packages/core/src/DateInput/DateInput.tsx@@ -368,8 +368,15 @@ export interface DateInputProps extends Omit<* because its keyboard is there. A tablet reports `coarse` and gets the* picker, at any width. There is deliberately no width bound: it would only* re-exclude the tablets, since a narrowed desktop window is still a mouse.+ *+ * Deliberately NOT exported. It was, briefly, on the theory that an app might+ * want to ask the same question and lay out to match — but nothing asked, and+ * six other core components (CheckboxInput, ChatComposerInput, ...) just+ * write `@media (pointer: coarse)` inline rather than sharing a constant. An+ * export is additive later and awkward to withdraw, so it waits for a real+ * caller.*/-export const TOUCH_POINTER_QUERY = '(pointer: coarse)';+const TOUCH_POINTER_QUERY = '(pointer: coarse)';/*** The pointer-driven field: a text input you can type into, with a calendardiff --git a/packages/core/src/DateInput/DateInputTouch.test.tsx b/packages/core/src/DateInput/DateInputTouch.test.tsxindex e480d461ba..e8136135bd 100644--- a/packages/core/src/DateInput/DateInputTouch.test.tsx+++ b/packages/core/src/DateInput/DateInputTouch.test.tsx@@ -42,7 +42,7 @@ import {useState} from 'react';import type {ISODateString} from '../utils';import {InputGroup} from '../InputGroup';import {stableClassName} from '../naming';-import {DateInput, TOUCH_POINTER_QUERY} from './DateInput';+import {DateInput} from './DateInput';import {toMonthIndex,monthIndexOf,@@ -79,11 +79,6 @@ const SCROLLPORT_WIDTH = 360;/** Matches the repo-wide setup polyfill, so hover-gated behavior still works. */const HOVER_CAPABLE = /\(\s*hover\s*:\s*hover\s*\)/;-/**- * Point the surface switch at a phone or at a desktop. Only- * {@link TOUCH_POINTER_QUERY} is forced; every other query keeps the answer- * the shared test setup gives it.- *//*** Answer media queries the way a given device would.*@@ -286,8 +281,7 @@ describe('DateInput — surface selection', () => {// typable field, and a narrowed desktop window is still a mouse. A width// bound would only re-exclude tablets — the clearest case for a thumb// picker there is — so there deliberately is not one.- expect(TOUCH_POINTER_QUERY).toBe('(pointer: coarse)');-+ //// An 1194px tablet in landscape: coarse pointer, far wider than any// handset breakpoint. It answers width queries honestly, so a width bound// creeping back in would fail here rather than pass silently.diff --git a/packages/core/src/DateInput/index.ts b/packages/core/src/DateInput/index.tsindex e69fb6cdd0..eed5271fd2 100644--- a/packages/core/src/DateInput/index.ts+++ b/packages/core/src/DateInput/index.ts@@ -9,7 +9,7 @@* @position Package entry point for DateInput*/-export {DateInput, TOUCH_POINTER_QUERY} from './DateInput';+export {DateInput} from './DateInput';export type {DateInputProps,DateInputSize,