diff --git a/src/uix/soma/components/date-field/components/date-field.svelte b/src/uix/soma/components/date-field/components/date-field.svelte index 48569c27d..3c4da0d73 100644 --- a/src/uix/soma/components/date-field/components/date-field.svelte +++ b/src/uix/soma/components/date-field/components/date-field.svelte @@ -33,7 +33,7 @@ disabled = false, readonly = false, readonlySegments = [], - kind = 'date', + kind = 'day', granularity, hideTimeZone = false, required = false, diff --git a/src/uix/soma/components/date-field/date-field-provider.svelte.test.ts b/src/uix/soma/components/date-field/date-field-provider.svelte.test.ts index f02834f33..124243c6e 100644 --- a/src/uix/soma/components/date-field/date-field-provider.svelte.test.ts +++ b/src/uix/soma/components/date-field/date-field-provider.svelte.test.ts @@ -94,7 +94,7 @@ function createDateFieldOpts() { value: state(undefined), placeholder: state(new CalendarDate(2026, 1, 1)), readonlySegments: state([]), - kind: state<'date' | 'month' | 'year'>('date'), + kind: state<'day' | 'month' | 'year'>('day'), validate: state(undefined), onInvalid: state(undefined), minValue: state(undefined), diff --git a/src/uix/soma/components/date-field/date-field-provider.svelte.ts b/src/uix/soma/components/date-field/date-field-provider.svelte.ts index 0100ecc0c..5422a5455 100644 --- a/src/uix/soma/components/date-field/date-field-provider.svelte.ts +++ b/src/uix/soma/components/date-field/date-field-provider.svelte.ts @@ -158,17 +158,18 @@ export interface DateFieldOpts /** * Chakra-style picker kind. Drives which date segments are * emitted in `segmentContents` (and therefore which segment - * elements the consumer's snippet renders): + * elements the consumer's snippet renders). Named after the + * grid cell granularity for trio consistency: * - * - `'date'` (default): day + month + year segments - * - `'month'`: month + year segments - * - `'year'`: year segment only + * - `'day'` (default): day + month + year segments + * - `'month'`: month + year segments + * - `'year'`: year segment only * * `granularity` (time precision: day/hour/minute/second) is * orthogonal — `kind='year'` + `granularity='hour'` is invalid * by construction (year-only pickers don't have hours). */ - kind: 'date' | 'month' | 'year'; + kind: 'day' | 'month' | 'year'; validate: DateValidator | undefined; onInvalid: DateOnInvalid | undefined; minValue: DateValue | undefined; @@ -597,7 +598,7 @@ export class DateFieldProvider { /** * Visible segment parts derived from `kind` (Chakra-style picker). - * `'date'` keeps the full day+month+year triplet; `'month'` drops + * `'day'` keeps the full day+month+year triplet; `'month'` drops * day; `'year'` drops day AND month. Time segments (hour/minute/ * second/dayPeriod) are governed by `granularity`, not `kind`, so * we leave them untouched. diff --git a/src/uix/soma/components/date-field/types.ts b/src/uix/soma/components/date-field/types.ts index 233b64510..883f12068 100644 --- a/src/uix/soma/components/date-field/types.ts +++ b/src/uix/soma/components/date-field/types.ts @@ -80,11 +80,12 @@ export type DateFieldProviderProps = WithChild<{ * - `'year'`: year segment only * * Orthogonal to `granularity` (which governs time precision — - * hour/minute/second). + * hour/minute/second). Named after the grid cell granularity for + * trio consistency. * - * @default 'date' + * @default 'day' */ - kind?: 'date' | 'month' | 'year'; + kind?: 'day' | 'month' | 'year'; /** * Visual granularity override. By default CalendarDate → 'day', * CalendarDateTime / ZonedDateTime → 'minute'. Granularity only affects diff --git a/src/uix/soma/components/date-picker/components/date-picker.svelte b/src/uix/soma/components/date-picker/components/date-picker.svelte index 032eee46e..147b6ef5f 100644 --- a/src/uix/soma/components/date-picker/components/date-picker.svelte +++ b/src/uix/soma/components/date-picker/components/date-picker.svelte @@ -24,7 +24,7 @@ onOpenChangeComplete = () => {}, closeOnDateSelect = true, mode = 'inline', - kind = 'date', + kind = 'day', validate, onInvalid, minValue, diff --git a/src/uix/soma/components/date-picker/date-picker-provider.svelte.test.ts b/src/uix/soma/components/date-picker/date-picker-provider.svelte.test.ts index 016e1ef60..e1123b8b9 100644 --- a/src/uix/soma/components/date-picker/date-picker-provider.svelte.test.ts +++ b/src/uix/soma/components/date-picker/date-picker-provider.svelte.test.ts @@ -82,7 +82,7 @@ function createDatePickerOpts() { required: state(false), closeOnDateSelect: state(true), mode: state('inline'), - kind: state('date'), + kind: state('day'), granularity: state(undefined), hideTimeZone: state(false), hourCycle: state(undefined), diff --git a/src/uix/soma/components/date-picker/date-picker-provider.svelte.ts b/src/uix/soma/components/date-picker/date-picker-provider.svelte.ts index d5dcea3ed..63c3b6da9 100644 --- a/src/uix/soma/components/date-picker/date-picker-provider.svelte.ts +++ b/src/uix/soma/components/date-picker/date-picker-provider.svelte.ts @@ -34,16 +34,21 @@ export type DatePickerMode = 'inline' | 'modal'; * Picker granularity / type of date (Chakra-style). Drives both the * visible segments in the input AND the calendar view in the popover: * - * - `'date'` (default): MM/DD/YYYY input + day grid in popover - * - `'month'`: MM/YYYY input + month grid in popover - * - `'year'`: YYYY input + year grid (decade) in popover + * - `'day'` (default): MM/DD/YYYY input + day grid in popover + * - `'month'`: MM/YYYY input + month grid in popover + * - `'year'`: YYYY input + year grid (decade) in popover * * The contract is consumer-driven for now — the picker exposes `kind`, * the consumer's segment snippet filters what to render, and the * calendar honours `data-kind` for view switching (forthcoming * commits B + C wire the grid renderers). + * + * Named after the grid cell granularity (`day` / `month` / `year`) for + * trio consistency. The legacy `'date'` value used until 2026-05-27 + * was awkward — `month` and `year` pickers also pick "dates", and the + * morfo `data-kind` enum already canonized `'day'`. */ -export type DatePickerKind = 'date' | 'month' | 'year'; +export type DatePickerKind = 'day' | 'month' | 'year'; // ── Contract ───────────────────────────────────────────────────────────────── diff --git a/src/uix/soma/components/date-picker/types.ts b/src/uix/soma/components/date-picker/types.ts index 41c39fcdf..4e0db54a8 100644 --- a/src/uix/soma/components/date-picker/types.ts +++ b/src/uix/soma/components/date-picker/types.ts @@ -78,13 +78,14 @@ export type DatePickerProviderProps = WithChild([]), endReadonlySegments: state([]), required: state(false), - kind: state<'date' | 'month' | 'year'>('date'), + kind: state<'day' | 'month' | 'year'>('day'), granularity: state(undefined), hideTimeZone: state(false), hourCycle: state(undefined), diff --git a/src/uix/soma/components/date-range-field/date-range-field-provider.svelte.ts b/src/uix/soma/components/date-range-field/date-range-field-provider.svelte.ts index 64c2acb76..dfc7d31fb 100644 --- a/src/uix/soma/components/date-range-field/date-range-field-provider.svelte.ts +++ b/src/uix/soma/components/date-range-field/date-range-field-provider.svelte.ts @@ -52,11 +52,12 @@ interface DateRangeFieldOpts * providers so the start and end inputs filter their segments * uniformly (range pickers always show the same kind on both * sides — there's no use case for kind='year' on start and - * kind='month' on end). + * kind='month' on end). Named after the grid cell granularity + * for trio consistency. * - * @default 'date' + * @default 'day' */ - kind: 'date' | 'month' | 'year'; + kind: 'day' | 'month' | 'year'; granularity: Granularity | undefined; hideTimeZone: boolean; hourCycle: HourCycle | undefined; diff --git a/src/uix/soma/components/date-range-field/types.ts b/src/uix/soma/components/date-range-field/types.ts index 72f253c6f..b1df1be07 100644 --- a/src/uix/soma/components/date-range-field/types.ts +++ b/src/uix/soma/components/date-range-field/types.ts @@ -68,9 +68,9 @@ export type DateRangeFieldProviderProps = WithChild<{ * - `'month'`: month + year segments * - `'year'`: year segment only * - * @default 'date' + * @default 'day' */ - kind?: 'date' | 'month' | 'year'; + kind?: 'day' | 'month' | 'year'; /** Visual granularity (auto from placeholder when omitted). */ granularity?: Granularity; /** Hide the timezone segment on ZonedDateTime. @default false */ diff --git a/src/uix/soma/components/date-range-picker/components/date-range-picker.svelte b/src/uix/soma/components/date-range-picker/components/date-range-picker.svelte index 7ec2fb06d..3344d3dcd 100644 --- a/src/uix/soma/components/date-range-picker/components/date-range-picker.svelte +++ b/src/uix/soma/components/date-range-picker/components/date-range-picker.svelte @@ -32,7 +32,7 @@ onOpenChangeComplete = () => {}, closeOnRangeSelect = true, mode = 'inline', - kind = 'date', + kind = 'day', validate, onInvalid, minValue, diff --git a/src/uix/soma/components/date-range-picker/date-range-picker-provider.svelte.test.ts b/src/uix/soma/components/date-range-picker/date-range-picker-provider.svelte.test.ts index cf9a8f8b7..f8281483d 100644 --- a/src/uix/soma/components/date-range-picker/date-range-picker-provider.svelte.test.ts +++ b/src/uix/soma/components/date-range-picker/date-range-picker-provider.svelte.test.ts @@ -86,7 +86,7 @@ function createDateRangePickerOpts() { required: state(false), closeOnRangeSelect: state(true), mode: state<'inline' | 'modal'>('inline'), - kind: state<'date' | 'month' | 'year'>('date'), + kind: state<'day' | 'month' | 'year'>('day'), granularity: state(undefined), hideTimeZone: state(false), hourCycle: state(undefined), diff --git a/src/uix/soma/components/date-range-picker/date-range-picker-provider.svelte.ts b/src/uix/soma/components/date-range-picker/date-range-picker-provider.svelte.ts index c178e4871..b02027fd1 100644 --- a/src/uix/soma/components/date-range-picker/date-range-picker-provider.svelte.ts +++ b/src/uix/soma/components/date-range-picker/date-range-picker-provider.svelte.ts @@ -25,11 +25,13 @@ export type DateRangePickerMode = 'inline' | 'modal'; * segments in the start/end inputs AND the calendar view in the * popover: * - * - `'date'` (default): MM/DD/YYYY inputs + day calendar + * - `'day'` (default): MM/DD/YYYY inputs + day calendar * - `'month'`: MM/YYYY inputs + month grid * - `'year'`: YYYY inputs + year grid (decade) + * + * Named after the grid cell granularity for trio consistency. */ -export type DateRangePickerKind = 'date' | 'month' | 'year'; +export type DateRangePickerKind = 'day' | 'month' | 'year'; import type { DateValue, DateRange, diff --git a/web/routes/uix/components/date-picker/+page.svelte b/web/routes/uix/components/date-picker/+page.svelte index 7290bbf71..9a197cc5e 100644 --- a/web/routes/uix/components/date-picker/+page.svelte +++ b/web/routes/uix/components/date-picker/+page.svelte @@ -56,7 +56,7 @@ let readonly = $state(false); let closeOnDateSelect = $state(false); let mode = $state<'inline' | 'modal'>('inline'); - let kind = $state<'date' | 'month' | 'year'>('date'); + let kind = $state<'day' | 'month' | 'year'>('day'); // Footer composition demo toggles. Visibility is purely structural: // the switches decide whether each part is INCLUDED in the markup, @@ -281,7 +281,7 @@ maxValue && ' {maxValue}', !closeOnDateSelect && ' closeOnDateSelect={false}', mode === 'modal' && ` mode="${mode}"`, - kind !== 'date' && ` kind="${kind}"`, + kind !== 'day' && ` kind="${kind}"`, fixedWeeks && ' fixedWeeks', pagedNavigation && ' pagedNavigation', preventDeselect && ' preventDeselect', @@ -362,7 +362,7 @@ maxValue && ' {maxValue}', !closeOnDateSelect && ' closeOnDateSelect={false}', mode === 'modal' && ` mode="${mode}"`, - kind !== 'date' && ` kind="${kind}"`, + kind !== 'day' && ` kind="${kind}"`, fixedWeeks && ' fixedWeeks', pagedNavigation && ' pagedNavigation', preventDeselect && ' preventDeselect', @@ -662,11 +662,11 @@ >kind {kind === 'year' ? 'YYYY' : kind === 'month' ? 'MM/YYYY' : 'MM/DD/YYYY'} - {#each ['date', 'month', 'year'] as value (value)} + {#each ['day', 'month', 'year'] as value (value)} diff --git a/web/routes/uix/components/date-range-field/+page.svelte b/web/routes/uix/components/date-range-field/+page.svelte index cdbec6dee..ba8f07285 100644 --- a/web/routes/uix/components/date-range-field/+page.svelte +++ b/web/routes/uix/components/date-range-field/+page.svelte @@ -25,7 +25,7 @@ type TraceEntry = { event: string; family: string; intent?: string; at: number }; type Direction = 'ltr' | 'rtl'; type ValueProfile = 'date' | 'datetime' | 'zoned'; - type Kind = 'date' | 'month' | 'year'; + type Kind = 'day' | 'month' | 'year'; // ── Sample anchors (one per value profile) ─────────────────────────── const startDate = new CalendarDate(2026, 5, 19); @@ -44,7 +44,7 @@ // ── Live state — every public prop wired ───────────────────────────── let valueProfile = $state('date'); - let kind = $state('date'); + let kind = $state('day'); let granularity = $state('day'); let value = $state({ start: startDate, end: endDate }); let placeholder = $state(startDate); @@ -71,7 +71,7 @@ const sizes: DateRangeFieldSize[] = ['xs', 'sm', 'md', 'lg', 'xl']; const variants: DateRangeFieldVariant[] = ['surface', 'outline', 'ghost']; const colors: DateRangeFieldColor[] = ['primary', 'secondary', 'neutral', 'affirm', 'risk', 'threat']; - const kinds: Kind[] = ['date', 'month', 'year']; + const kinds: Kind[] = ['day', 'month', 'year']; const granularities: Granularity[] = ['day', 'hour', 'minute', 'second']; const hourCycles: HourCycle[] = [12, 24]; const directions: Direction[] = ['ltr', 'rtl']; @@ -229,7 +229,7 @@ '', ' start · day - + {readonlyStartDay ? 'locked' : 'editable'} @@ -611,7 +611,7 @@ @@ -691,7 +691,7 @@ onInvalid somaDateOnInvalid—Called when validation fails. minValue somaDateValue—Earliest acceptable date for both endpoints. maxValue somaDateValue—Latest acceptable date for both endpoints. - kind soma'date' | 'month' | 'year''date'Segment filter (Chakra-style). Both endpoints share the same kind. + kind soma'day' | 'month' | 'year''day'Segment filter (Chakra-style). Both endpoints share the same kind. granularity soma'day' | 'hour' | 'minute' | 'second'auto (from placeholder)Visual granularity. Adds time segments for hour+. hourCycle soma12 | 24locale-derived12-hour or 24-hour clock. hideTimeZone somabooleanfalseHide the timezone segment on ZonedDateTime. diff --git a/web/routes/uix/components/date-range-picker/+page.svelte b/web/routes/uix/components/date-range-picker/+page.svelte index 61794bd8b..360dcba1a 100644 --- a/web/routes/uix/components/date-range-picker/+page.svelte +++ b/web/routes/uix/components/date-range-picker/+page.svelte @@ -59,7 +59,7 @@ let allowSingleDay = $state(false); let closeOnRangeSelect = $state(false); let mode = $state<'inline' | 'modal'>('inline'); - let kind = $state<'date' | 'month' | 'year'>('date'); + let kind = $state<'day' | 'month' | 'year'>('day'); // Footer composition demo toggles. Visibility = whether the part is // INCLUDED in the markup (the parts themselves render unconditionally). @@ -734,11 +734,11 @@ >kind {kind === 'year' ? 'YYYY' : kind === 'month' ? 'MM/YYYY' : 'MM/DD/YYYY'} - {#each ['date', 'month', 'year'] as value (value)} + {#each ['day', 'month', 'year'] as value (value)}