From 2251e67327ddcbb8282f411db58797c2e66264df Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Wed, 30 Sep 2026 11:20:49 -0400 Subject: [PATCH 1/4] fix(bulma-ui): color the calendar from the color prop and read TimeInput's wheel variables The calendar put `is-` on its root whenever DateInput or DateTimeInput passed `color`, and `_dateinput.scss` had no rule for it: the selected date, today's date and the focus rings all read `primary`. So a DateTimeInput coloured its time wheels (#832) and left its calendar primary. Give the calendar the colour loop the wheels got in #832. Each `.dateinput.is-` points the selection fill (with its `-invert` for the selected value), today's tint and a new `--bulma-dateinput-focus-ring-color` at the colour. The rings on the cells, the month trigger and the nav arrows read that variable instead of `primary`, so they follow too. It is a variable of its own rather than the selection's, so a theme that recoloured only the selection keeps the rings it has. TimeInput registered wheel variables that nothing read. The wheel now paints `--bulma-timeinput-wheel-bg`, whose default becomes `transparent`: the wheel sits on the popover, the inline frame or DateTimeInput's time card, each with a background variable of its own, and the old `scheme-main` default would have painted over whichever of those a theme had changed. A non-selected item takes `--bulma-timeinput-wheel-hover-bg` as a fill on hover, at its existing default, the calendar's cell hover, so both halves of a DateTimeInput answer the pointer alike. `--bulma-timeinput-wheel-item-height` stays registered and unread: the wheels position items from a height the component passes them, and dropping the Sass variable would break a build that configures it. The API pages and the theming skill now say so. An uncoloured picker renders as before, and `color="primary"` renders the same as no colour. --- bestax-mcp/data/catalog.json | 5 +- bestax-mcp/data/components/DateInput.json | 12 +- bestax-mcp/data/components/DateTimeInput.json | 14 +- bestax-mcp/data/components/TimeInput.json | 2 +- bestax-mcp/data/skills.json | 2 +- bulma-ui/src/form/DateInput.stories.tsx | 33 ++++ bulma-ui/src/form/DateInputBase.tsx | 7 +- bulma-ui/src/form/DateTimeInput.stories.tsx | 27 +++ bulma-ui/src/form/DateTimeInputBase.tsx | 10 +- .../form/__tests__/DateInput.styles.test.tsx | 157 ++++++++++++++++++ .../form/__tests__/TimeInput.styles.test.tsx | 69 ++++++-- bulma-ui/src/scss/form/_dateinput.scss | 34 +++- bulma-ui/src/scss/form/_timeinput.scss | 22 ++- docs/docs/api/form/datetime/dateinput.md | 32 +++- docs/docs/api/form/datetime/datetimeinput.md | 147 ++++++++-------- docs/docs/api/form/datetime/timeinput.md | 4 +- scripts/color-tuple-css.test.mjs | 93 ++++++----- .../references/css-variables.md | 8 +- 18 files changed, 530 insertions(+), 148 deletions(-) create mode 100644 bulma-ui/src/form/__tests__/DateInput.styles.test.tsx diff --git a/bestax-mcp/data/catalog.json b/bestax-mcp/data/catalog.json index 33bb25059..dea54b6f8 100644 --- a/bestax-mcp/data/catalog.json +++ b/bestax-mcp/data/catalog.json @@ -371,7 +371,7 @@ "import": "import { DateInput } from '@allxsmith/bestax-bulma';", "compound": false, "propCount": 52, - "exampleCount": 37 + "exampleCount": 38 }, { "name": "DateTimeInput", @@ -382,7 +382,7 @@ "import": "import { DateTimeInput } from '@allxsmith/bestax-bulma';", "compound": false, "propCount": 62, - "exampleCount": 39 + "exampleCount": 40 }, { "name": "Delete", @@ -1297,6 +1297,7 @@ "--bulma-dateinput-cell-today-color": "DateTimeInput", "--bulma-dateinput-day-name-color": "DateTimeInput", "--bulma-dateinput-day-name-size": "DateTimeInput", + "--bulma-dateinput-focus-ring-color": "DateTimeInput", "--bulma-dateinput-header-padding": "DateTimeInput", "--bulma-dateinput-min-width": "DateTimeInput", "--bulma-dateinput-nav-button-size": "DateTimeInput", diff --git a/bestax-mcp/data/components/DateInput.json b/bestax-mcp/data/components/DateInput.json index 82fd249c3..9a95ef206 100644 --- a/bestax-mcp/data/components/DateInput.json +++ b/bestax-mcp/data/components/DateInput.json @@ -129,6 +129,10 @@ "title": "Colors", "code": "\n \n \n \n \n \n" }, + { + "title": "Colors", + "code": "function example() {\n // The 1st of this month (the 2nd when today is the 1st), so the selected\n // date and today's date both show.\n const picked = new Date();\n picked.setDate(picked.getDate() === 1 ? 2 : 1);\n return (\n \n \n \n \n \n \n \n \n \n \n \n );\n}" + }, { "title": "States", "code": "\n \n \n \n" @@ -522,7 +526,7 @@ "name": "color", "type": "'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'", "default": null, - "description": "Bulma color modifier.", + "description": "Bulma color modifier for the input, also carried by the calendar, where it colors the selected date, today's date and the keyboard focus ring. Unset, the calendar uses its `--bulma-dateinput-*` variables, which follow `primary` by default.", "required": false, "inherited": true, "deprecated": false @@ -736,6 +740,12 @@ "default": "var(--bulma-primary)", "scope": "element" }, + { + "css": "--bulma-dateinput-focus-ring-color", + "sass": "$dateinput-focus-ring-color", + "default": "var(--bulma-primary)", + "scope": "element" + }, { "css": "--bulma-dateinput-cell-disabled-color", "sass": "$dateinput-cell-disabled-color", diff --git a/bestax-mcp/data/components/DateTimeInput.json b/bestax-mcp/data/components/DateTimeInput.json index 377d6ff32..8a6e1303f 100644 --- a/bestax-mcp/data/components/DateTimeInput.json +++ b/bestax-mcp/data/components/DateTimeInput.json @@ -125,6 +125,10 @@ "title": "Colors", "code": "\n \n \n \n \n \n" }, + { + "title": "Colors", + "code": "" + }, { "title": "States", "code": "\n \n \n \n" @@ -530,7 +534,7 @@ "name": "color", "type": "'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'", "default": null, - "description": "Bulma color modifier for the input, also carried by the time wheels, where it colors the selection band and the keyboard focus ring. Unset, the wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`. The calendar does not take it.", + "description": "Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date, today's date, the selection band and the keyboard focus rings. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way.", "required": false, "inherited": true, "deprecated": false @@ -816,6 +820,12 @@ "default": "var(--bulma-primary)", "scope": "element" }, + { + "css": "--bulma-dateinput-focus-ring-color", + "sass": "$dateinput-focus-ring-color", + "default": "var(--bulma-primary)", + "scope": "element" + }, { "css": "--bulma-dateinput-cell-disabled-color", "sass": "$dateinput-cell-disabled-color", @@ -969,7 +979,7 @@ { "css": "--bulma-timeinput-wheel-bg", "sass": "$timeinput-wheel-bg", - "default": "var(--bulma-scheme-main)", + "default": "transparent", "scope": "element" }, { diff --git a/bestax-mcp/data/components/TimeInput.json b/bestax-mcp/data/components/TimeInput.json index e35bce244..abf35c8e4 100644 --- a/bestax-mcp/data/components/TimeInput.json +++ b/bestax-mcp/data/components/TimeInput.json @@ -795,7 +795,7 @@ { "css": "--bulma-timeinput-wheel-bg", "sass": "$timeinput-wheel-bg", - "default": "var(--bulma-scheme-main)", + "default": "transparent", "scope": "element" }, { diff --git a/bestax-mcp/data/skills.json b/bestax-mcp/data/skills.json index bef17fba8..404075045 100644 --- a/bestax-mcp/data/skills.json +++ b/bestax-mcp/data/skills.json @@ -176,7 +176,7 @@ { "id": "css-variables", "file": "references/css-variables.md", - "bytes": 26899 + "bytes": 27061 }, { "id": "themeable-components", diff --git a/bulma-ui/src/form/DateInput.stories.tsx b/bulma-ui/src/form/DateInput.stories.tsx index 818522c12..84a7de795 100644 --- a/bulma-ui/src/form/DateInput.stories.tsx +++ b/bulma-ui/src/form/DateInput.stories.tsx @@ -95,6 +95,39 @@ export const Colors: Story = { ), }; +export const InlineColors: Story = { + render: () => { + // The 1st of this month (the 2nd when today is the 1st), so the selected + // date and today's date both show. + const picked = new Date(); + picked.setDate(picked.getDate() === 1 ? 2 : 1); + return ( + + {( + ['primary', 'link', 'info', 'success', 'warning', 'danger'] as const + ).map(color => ( + + + + ))} + + ); + }, + parameters: { + docs: { + description: { + story: + "Rendered inline so the calendar is visible without opening the popover: `color` tints the selected date, today's date and, for keyboard users, the focus ring. Tab into the grid to see the ring.", + }, + }, + }, +}; + export const States: Story = { render: () => ( diff --git a/bulma-ui/src/form/DateInputBase.tsx b/bulma-ui/src/form/DateInputBase.tsx index 169ec0a94..c0476ed38 100644 --- a/bulma-ui/src/form/DateInputBase.tsx +++ b/bulma-ui/src/form/DateInputBase.tsx @@ -101,7 +101,12 @@ export interface DateInputBaseProps position?: PickerPosition; /** Render the popover into `document.body` via portal. */ appendToBody?: boolean; - /** Bulma color modifier. */ + /** + * Bulma color modifier for the input, also carried by the calendar, where it + * colors the selected date, today's date and the keyboard focus ring. Unset, + * the calendar uses its `--bulma-dateinput-*` variables, which follow + * `primary` by default. + */ color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'; /** Size variant. */ size?: 'small' | 'medium' | 'large'; diff --git a/bulma-ui/src/form/DateTimeInput.stories.tsx b/bulma-ui/src/form/DateTimeInput.stories.tsx index 377b21fe8..6ef2cc900 100644 --- a/bulma-ui/src/form/DateTimeInput.stories.tsx +++ b/bulma-ui/src/form/DateTimeInput.stories.tsx @@ -250,6 +250,33 @@ export const Colors: Story = { ), }; +export const InlineColors: Story = { + render: () => ( + + {( + ['primary', 'link', 'info', 'success', 'warning', 'danger'] as const + ).map(color => ( + + + + ))} + + ), + parameters: { + docs: { + description: { + story: + "Rendered inline so the panel is visible without opening the popover: `color` tints the calendar and, once the time row is opened, the wheels. The footer's time pill and Done button stay `primary`.", + }, + }, + }, +}; + export const States: Story = { render: () => ( diff --git a/bulma-ui/src/form/DateTimeInputBase.tsx b/bulma-ui/src/form/DateTimeInputBase.tsx index 195b9cbb4..f04e1d3c6 100644 --- a/bulma-ui/src/form/DateTimeInputBase.tsx +++ b/bulma-ui/src/form/DateTimeInputBase.tsx @@ -134,10 +134,12 @@ export interface DateTimeInputBaseProps /** Render the popover into `document.body` via portal. */ appendToBody?: boolean; /** - * Bulma color modifier for the input, also carried by the time wheels, where - * it colors the selection band and the keyboard focus ring. Unset, the - * wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to - * `primary`. The calendar does not take it. + * Bulma color modifier for the input, also carried by the calendar and the + * time wheels, where it colors the selected date, today's date, the + * selection band and the keyboard focus rings. Unset, they use their + * `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which + * follow `primary` by default. The footer's time pill and Done button stay + * `primary` either way. */ color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'; /** Size variant. */ diff --git a/bulma-ui/src/form/__tests__/DateInput.styles.test.tsx b/bulma-ui/src/form/__tests__/DateInput.styles.test.tsx new file mode 100644 index 000000000..3e10eb582 --- /dev/null +++ b/bulma-ui/src/form/__tests__/DateInput.styles.test.tsx @@ -0,0 +1,157 @@ +// The calendar put `is-` on its root for as long as DateInput and +// DateTimeInput passed `color` in, and no rule read it. A class reaching the +// DOM proves nothing about the stylesheet, so these compile the real SCSS and +// check what it does, the way TimeInput.styles.test.tsx does for the wheels. +import * as sass from 'sass'; +import path from 'path'; +import type { ReactElement } from 'react'; +import { render } from '@testing-library/react'; +import { DateInput } from '../DateInput'; +import { DateTimeInput } from '../DateTimeInput'; +import { ConfigProvider } from '../../helpers/Config'; + +const SCSS = path.resolve(__dirname, '../../scss'); +const NODE_MODULES = path.resolve(__dirname, '../../../../node_modules'); +const OPTIONS = { + loadPaths: [SCSS, NODE_MODULES], + quietDeps: true, + logger: sass.Logger.silent, +}; + +const compile = (file: string) => + sass.compile(path.resolve(SCSS, file), OPTIONS).css; + +const colors = [ + 'primary', + 'link', + 'info', + 'success', + 'warning', + 'danger', +] as const; +type Color = (typeof colors)[number]; + +/** The variables a colour re-points, and what each should read for it. */ +const accents = (color: string) => ({ + '--bulma-dateinput-cell-selected-bg': `var(--bulma-${color})`, + '--bulma-dateinput-cell-selected-color': `var(--bulma-${color}-invert)`, + '--bulma-dateinput-cell-today-color': `var(--bulma-${color})`, + '--bulma-dateinput-focus-ring-color': `var(--bulma-${color})`, +}); + +/** The accent variables as the calendar root computes them. */ +function computedAccents(root: HTMLElement) { + const style = getComputedStyle(root); + return Object.fromEntries( + Object.keys(accents('primary')).map(name => [ + name, + style.getPropertyValue(name).trim(), + ]) + ); +} + +/** The calendar root, which is where `is-` lands. */ +function calendarRoot(container: HTMLElement, prefix = '') { + const root = container.querySelector(`.${prefix}dateinput`); + if (!root) throw new Error(`no .${prefix}dateinput rendered`); + return root; +} + +const sheets: HTMLStyleElement[] = []; +const inject = (css: string) => { + const el = document.createElement('style'); + el.textContent = css; + document.head.appendChild(el); + sheets.push(el); + return el; +}; + +let sheet: CSSStyleSheet; + +beforeAll(() => { + sheet = inject(compile('form/_dateinput.scss')).sheet as CSSStyleSheet; +}); + +afterAll(() => { + for (const el of sheets) el.remove(); +}); + +const pickers: [string, (color?: Color) => ReactElement][] = [ + ['DateInput', color => ], + ['DateTimeInput', color => ], +]; + +describe.each(pickers)('%s calendar colour styles', (_name, picker) => { + it.each(colors)( + 'points the selection, today and the focus ring at %s', + color => { + const { container } = render(picker(color)); + expect(computedAccents(calendarRoot(container))).toEqual(accents(color)); + } + ); + + it('leaves an uncoloured calendar on the primary defaults', () => { + const { container } = render(picker()); + expect(computedAccents(calendarRoot(container))).toEqual( + accents('primary') + ); + }); +}); + +describe('calendar colour styles under a class prefix', () => { + it('matches the prefixed modifier the calendar emits', () => { + inject( + sass.compileString( + `@use 'bulma/sass/utilities/initial-variables' with ($class-prefix: 'bestax-'); + @use 'form/dateinput';`, + OPTIONS + ).css + ); + const { container } = render( + + + + ); + const root = calendarRoot(container, 'bestax-'); + expect(root).toHaveClass('bestax-is-danger'); + expect(computedAccents(root)).toEqual(accents('danger')); + }); +}); + +/** Every custom property a style rule in the sheet sets. */ +function setProperties(rules: CSSRuleList): string[] { + const names = new Set(); + for (const rule of Array.from(rules)) { + if (!(rule instanceof CSSStyleRule)) continue; + for (let i = 0; i < rule.style.length; i++) { + const name = rule.style[i]; + if (name.startsWith('--')) names.add(name); + } + } + return [...names]; +} + +describe('calendar variables', () => { + it('registers only variables that some rule reads', () => { + const set = setProperties(sheet.cssRules); + expect(set).toContain('--bulma-dateinput-focus-ring-color'); + + const shipped = compile('bestax.scss'); + const unread = set.filter( + name => !new RegExp(`var\\(\\s*${name}\\s*[,)]`).test(shipped) + ); + expect(unread).toEqual([]); + }); + + it('reads no Bulma colour directly outside a variable', () => { + // A declaration that names a colour itself stays that colour whatever + // `color` says, which is how the focus rings stayed primary. Custom + // properties are where the colours are meant to be named. + const direct = new RegExp(`var\\(--bulma-(?:${colors.join('|')})\\b`); + const offenders = compile('form/_dateinput.scss') + .split('\n') + .map(line => line.trim()) + .filter(line => !line.startsWith('--') && direct.test(line)); + expect(offenders).toEqual([]); + }); +}); diff --git a/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx b/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx index 6e32ce9d0..043ccf5e1 100644 --- a/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx +++ b/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx @@ -68,23 +68,71 @@ describe('TimeInput wheel colour styles', () => { }); }); +/** Every custom property the style rules in a list set, media blocks skipped. */ +function customProperties(rules: CSSRuleList): string[] { + const names = new Set(); + for (const rule of Array.from(rules)) { + if (!(rule instanceof CSSStyleRule)) continue; + for (let i = 0; i < rule.style.length; i++) { + const name = rule.style[i]; + if (name.startsWith('--')) names.add(name); + } + } + return [...names]; +} + /** Every custom property a `(max-width: …)` media block in the sheet sets. */ function mobileCustomProperties(sheet: CSSStyleSheet): string[] { const names = new Set(); for (const rule of Array.from(sheet.cssRules)) { if (!(rule instanceof CSSMediaRule)) continue; if (!/max-width/.test(rule.media.mediaText)) continue; - for (const inner of Array.from(rule.cssRules)) { - if (!(inner instanceof CSSStyleRule)) continue; - for (let i = 0; i < inner.style.length; i++) { - const name = inner.style[i]; - if (name.startsWith('--')) names.add(name); - } - } + for (const name of customProperties(rule.cssRules)) names.add(name); } return [...names]; } +/** The names no `var()` in the shipped stylesheet reads. */ +let shipped: string | undefined; +function unread(names: string[]): string[] { + shipped ??= compile('bestax.scss'); + const css = shipped; + return names.filter( + name => !new RegExp(`var\\(\\s*${name}\\s*[,)]`).test(css) + ); +} + +describe('TimeInput variables', () => { + // A registered variable nothing reads is a theming knob that turns nothing, + // which is where the wheel background and hover fill sat. The item height + // is left that way on purpose: the wheels position items from a height the + // component passes them, and dropping the Sass variable would break a theme + // that sets it. So it is named here, and has to stay unread to stay named. + const UNREAD = ['--bulma-timeinput-wheel-item-height']; + + it('registers only variables that some rule reads', () => { + const registered = customProperties( + (styleEl.sheet as CSSStyleSheet).cssRules + ); + expect(registered).toEqual(expect.arrayContaining(UNREAD)); + expect(unread(registered)).toEqual(UNREAD); + }); + + it('leaves the wheel background transparent by default', () => { + // The wheel sits on the popover, the inline frame or DateTimeInput's time + // card, each with a background variable of its own. Any other default + // would paint over whichever of those a theme had changed. + const { container } = render(); + const root = container.querySelector('.timeinput'); + expect(root).not.toBeNull(); + expect( + getComputedStyle(root as HTMLElement) + .getPropertyValue('--bulma-timeinput-wheel-bg') + .trim() + ).toBe('transparent'); + }); +}); + describe('TimeInput mobile overrides', () => { // The small-viewport block adjusts the wheels and the popover by setting // custom properties. Setting one that no rule reads changes nothing, so @@ -92,11 +140,6 @@ describe('TimeInput mobile overrides', () => { it('sets only custom properties that some rule reads', () => { const set = mobileCustomProperties(styleEl.sheet as CSSStyleSheet); expect(set.length).toBeGreaterThan(0); - - const shipped = compile('bestax.scss'); - const unread = set.filter( - name => !new RegExp(`var\\(\\s*${name}\\s*[,)]`).test(shipped) - ); - expect(unread).toEqual([]); + expect(unread(set)).toEqual([]); }); }); diff --git a/bulma-ui/src/scss/form/_dateinput.scss b/bulma-ui/src/scss/form/_dateinput.scss index a6cbb8a03..b780856de 100644 --- a/bulma-ui/src/scss/form/_dateinput.scss +++ b/bulma-ui/src/scss/form/_dateinput.scss @@ -9,6 +9,7 @@ $dateinput-cell-hover-bg: hsla(0, 0%, 50%, 0.13) !default; $dateinput-cell-selected-bg: cv.getVar('primary') !default; $dateinput-cell-selected-color: cv.getVar('primary-invert') !default; $dateinput-cell-today-color: cv.getVar('primary') !default; +$dateinput-focus-ring-color: cv.getVar('primary') !default; $dateinput-cell-disabled-color: cv.getVar('text-weak') !default; $dateinput-cell-other-month-color: cv.getVar('text-weak') !default; $dateinput-header-padding: 0.5rem 0 !default; @@ -27,6 +28,7 @@ $dateinput-nav-button-size: 1.75rem !default; 'dateinput-cell-selected-bg': #{$dateinput-cell-selected-bg}, 'dateinput-cell-selected-color': #{$dateinput-cell-selected-color}, 'dateinput-cell-today-color': #{$dateinput-cell-today-color}, + 'dateinput-focus-ring-color': #{$dateinput-focus-ring-color}, 'dateinput-cell-disabled-color': #{$dateinput-cell-disabled-color}, 'dateinput-cell-other-month-color': #{$dateinput-cell-other-month-color}, 'dateinput-header-padding': #{$dateinput-header-padding}, @@ -80,7 +82,7 @@ $dateinput-nav-button-size: 1.75rem !default; background-color: cv.getVar('dateinput-cell-hover-bg'); } &:focus-visible { - outline: 2px solid cv.getVar('primary'); + outline: 2px solid cv.getVar('dateinput-focus-ring-color'); outline-offset: 2px; } } @@ -121,7 +123,7 @@ $dateinput-nav-button-size: 1.75rem !default; background-color: cv.getVar('dateinput-cell-hover-bg'); } &:focus-visible { - outline: 2px solid cv.getVar('primary'); + outline: 2px solid cv.getVar('dateinput-focus-ring-color'); outline-offset: 1px; } &:disabled { @@ -172,7 +174,7 @@ $dateinput-nav-button-size: 1.75rem !default; &:hover:not(:disabled):not(.#{iv.$class-prefix}is-selected) { background-color: cv.getVar('dateinput-cell-hover-bg'); } - // Hover for the selected cell: darken the primary fill rather than + // Hover for the selected cell: darken the selection fill rather than // replacing it, so the selection stays visible under the cursor while // still giving interactive feedback. &.#{iv.$class-prefix}is-selected:hover:not(:disabled) { @@ -183,10 +185,10 @@ $dateinput-nav-button-size: 1.75rem !default; ); } // Inset focus ring so it can't bleed into an adjacent selected cell's - // primary fill (the grid gap is only 2px). Outline respects the cell's + // fill (the grid gap is only 2px). Outline respects the cell's // border-radius in modern browsers. &:focus-visible { - outline: 2px solid cv.getVar('primary'); + outline: 2px solid cv.getVar('dateinput-focus-ring-color'); outline-offset: -2px; } // Today: tinted bold text (no ring), so it doesn't collide visually with @@ -200,7 +202,7 @@ $dateinput-nav-button-size: 1.75rem !default; color: cv.getVar('dateinput-cell-selected-color'); } // When focus lands on the selected cell, swap the ring to scheme-main so - // it stays visible against the primary-colored fill. + // it stays visible against the selection fill. &.#{iv.$class-prefix}is-selected:focus-visible { outline-color: cv.getVar('scheme-main'); } @@ -250,7 +252,7 @@ $dateinput-nav-button-size: 1.75rem !default; ); } &:focus-visible { - outline: 2px solid cv.getVar('primary'); + outline: 2px solid cv.getVar('dateinput-focus-ring-color'); outline-offset: -2px; } &.#{iv.$class-prefix}is-today { @@ -271,6 +273,24 @@ $dateinput-nav-button-size: 1.75rem !default; } } +// Colour variants. `color` lands on the calendar root as `is-`, and +// the root re-points its accent variables at that colour: the selection fill +// paired with its `-invert` for the selected value, today's tint and the focus +// ring, the same pairings the `primary` defaults use. Every rule that paints +// an accent reads one of these, so they follow without rules of their own. +@each $name in 'primary', 'link', 'info', 'success', 'warning', 'danger' { + .#{iv.$class-prefix}dateinput.#{iv.$class-prefix}is-#{$name} { + @include cv.register-vars( + ( + 'dateinput-cell-selected-bg': #{cv.getVar($name)}, + 'dateinput-cell-selected-color': #{cv.getVar('#{$name}-invert')}, + 'dateinput-cell-today-color': #{cv.getVar($name)}, + 'dateinput-focus-ring-color': #{cv.getVar($name)}, + ) + ); + } +} + .#{iv.$class-prefix}dateinput.#{iv.$class-prefix}is-small .#{iv.$class-prefix}dateinput-cell { width: 1.75rem; diff --git a/bulma-ui/src/scss/form/_timeinput.scss b/bulma-ui/src/scss/form/_timeinput.scss index 27d018ea8..1c1365dde 100644 --- a/bulma-ui/src/scss/form/_timeinput.scss +++ b/bulma-ui/src/scss/form/_timeinput.scss @@ -2,11 +2,20 @@ @use 'bulma/sass/utilities/css-variables' as cv; $timeinput-wheel-width: 3rem !default; +// Registered, and read by nothing: the wheels position every item from its +// height in script, so the component passes the height to them itself (taller +// on small viewports) rather than reading a CSS length. Kept so a theme that +// sets it still compiles. $timeinput-wheel-item-height: 2rem !default; $timeinput-wheel-gap: 0.4rem !default; -$timeinput-wheel-bg: cv.getVar('scheme-main') !default; +// Transparent, so the drum shows the surface it sits on: the popover, the +// inline frame or DateTimeInput's time card, each of which has a background +// variable of its own that a painted default would cover. +$timeinput-wheel-bg: transparent !default; $timeinput-wheel-color: cv.getVar('text') !default; $timeinput-wheel-dim-color: cv.getVar('text-weak') !default; +// The calendar's cell hover, so both halves of a DateTimeInput answer the +// pointer alike, on light and dark schemes. $timeinput-wheel-hover-bg: hsla(0, 0%, 50%, 0.13) !default; $timeinput-wheel-selected-bg: cv.getVar('primary') !default; $timeinput-wheel-selected-color: cv.getVar('primary-invert') !default; @@ -80,6 +89,7 @@ $timeinput-footer-padding: 0.5rem 0 0 !default; .#{iv.$class-prefix}timeinput-wheel { position: relative; width: cv.getVar('timeinput-wheel-width'); + background-color: cv.getVar('timeinput-wheel-bg'); outline: none; overflow: hidden; touch-action: none; @@ -151,8 +161,12 @@ $timeinput-footer-padding: 0.5rem 0 0 !default; color 0.1s ease, font-weight 0.1s ease; + // The fill is left out of the transition above for the reason the calendar + // cells give in `_dateinput.scss`: Chrome can strand a button's background + // transition mid-flight. &:hover:not(:disabled):not(.#{iv.$class-prefix}is-selected) { color: cv.getVar('timeinput-wheel-color'); + background-color: cv.getVar('timeinput-wheel-hover-bg'); } // The selected item (whichever is currently centred over the band) is @@ -254,9 +268,9 @@ $timeinput-footer-padding: 0.5rem 0 0 !default; } // Mobile (small viewport): bigger touch targets, larger numbers, more iOS-native -// feel. Item *height* is set inline by JS and bumped from 40px to 48px on small -// viewports by TimeInputBase; the rules below adjust everything that's CSS-only -// (font size, wheel width, gap, separator, mask intensity). +// feel. Item *height* is set inline by JS, and made taller on small viewports by +// the component; the rules below adjust everything that's CSS-only (font size, +// wheel width, gap, separator, mask intensity). @media (max-width: 768px) { // Registered through `cv.register-vars` like the defaults above, so the // overrides land on the names the rules read. diff --git a/docs/docs/api/form/datetime/dateinput.md b/docs/docs/api/form/datetime/dateinput.md index c827dbcdc..cb72faa9f 100644 --- a/docs/docs/api/form/datetime/dateinput.md +++ b/docs/docs/api/form/datetime/dateinput.md @@ -629,6 +629,35 @@ If any of these matter, pass `mobileNative={false}` to force the custom calendar ``` +**Inline:** the calendar carries the color too, on the selected date, today's date and the keyboard focus ring, and rendered inline it shows without opening a popover. + +```tsx live +function example() { + // The 1st of this month (the 2nd when today is the 1st), so the selected + // date and today's date both show. + const picked = new Date(); + picked.setDate(picked.getDate() === 1 ? 2 : 1); + return ( + + + + + + + + + + + + ); +} +``` + --- ### States @@ -868,7 +897,7 @@ Use `inline` instead of the popover when you have vertical room to spare — boo | `closeOnSelect` | `boolean` | `true` | Close the popover after a date is selected. | | `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position relative to the input. | | `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | -| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier. | +| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar, where it colors the selected date, today's date and the keyboard focus ring. Unset, the calendar uses its `--bulma-dateinput-*` variables, which follow `primary` by default. | | `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | | `isRounded` | `boolean` | `false` | Render the input with rounded corners. | | `shouldDisableDate` | `(d: Date) => boolean` | — | Predicate to disable specific dates (e.g. weekends). Blocked dates are also rejected during manual typing. | @@ -908,6 +937,7 @@ Use `inline` instead of the popover when you have vertical room to spare — boo | `--bulma-dateinput-cell-selected-bg` ‡ | `$dateinput-cell-selected-bg` | `var(--bulma-primary)` | | `--bulma-dateinput-cell-selected-color` ‡ | `$dateinput-cell-selected-color` | `var(--bulma-primary-invert)` | | `--bulma-dateinput-cell-today-color` ‡ | `$dateinput-cell-today-color` | `var(--bulma-primary)` | +| `--bulma-dateinput-focus-ring-color` ‡ | `$dateinput-focus-ring-color` | `var(--bulma-primary)` | | `--bulma-dateinput-cell-disabled-color` ‡ | `$dateinput-cell-disabled-color` | `var(--bulma-text-weak)` | | `--bulma-dateinput-cell-other-month-color` ‡ | `$dateinput-cell-other-month-color` | `var(--bulma-text-weak)` | | `--bulma-dateinput-header-padding` ‡ | `$dateinput-header-padding` | `0.5rem 0` | diff --git a/docs/docs/api/form/datetime/datetimeinput.md b/docs/docs/api/form/datetime/datetimeinput.md index 12587a419..91fceb8d4 100644 --- a/docs/docs/api/form/datetime/datetimeinput.md +++ b/docs/docs/api/form/datetime/datetimeinput.md @@ -575,6 +575,12 @@ The OS-native pickers always use the device's system locale, so these examples s ``` +**Inline:** the popover carries the color as well. The calendar shows it on the selected date, today's date and its keyboard focus ring, and the time wheels on their selection band and focus ring. The footer's time pill and Done button stay `primary`. + +```tsx live + +``` + --- ### States @@ -831,74 +837,74 @@ The DateTimeInput prop set is the union of [DateInput](./dateinput.md) and [Time -| Prop | Type | Default | Description | -| ------------------- | -------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | -| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | -| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | -| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | -| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | -| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | -| `iconRightName` | `string` | — | Shortcut for the right icon name. | -| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | -| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | -| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | -| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | -| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | -| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | -| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | -| `message` | `React.ReactNode` | — | Help/validation text below the input. | -| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Message color. | -| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | -| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | -| `value` | `Date` \| `null` | — | Controlled selected date-time. | -| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | -| `onChange` | `(d: Date \| null) => void` | — | Fired when either the date or time portion changes. | -| `onOpen` | `() => void` | — | Fired when the popover opens. | -| `onClose` | `() => void` | — | Fired when the popover closes. | -| `min` | `Date` | — | Lower bound for the combined date-time. | -| `max` | `Date` | — | Upper bound for the combined date-time. | -| `disabled` | `boolean` | `false` | Disable the input. | -| `readOnly` | `boolean` | `false` | Read-only input. | -| `placeholder` | `string` | — | Placeholder text. | -| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD HH:mm'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD HH:mm'`. | -| `parse` | `(s: string) => Date \| null` | — | Custom parser. | -| `locale` | `string` | — | BCP-47 locale tag. | -| `inline` | `boolean` | `false` | Render the panel inline (no popover). | -| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer devices. | -| `editable` | `boolean` | `true` | Allow segmented keyboard typing (type the date-time directly across all segments). `false` makes the field picker-only. | -| `popover` | `boolean` | `true` | Whether the calendar + time popover exists. `false` makes the field input-only (segmented typing with no popover). Default `true`. | -| `openOnFocus` | `boolean` | `true` | Open the popover on focus. Default `true`. | -| `closeOnSelect` | `boolean` | `false` | Off by default — users typically tweak both halves before committing. | -| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position. | -| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | -| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the time wheels, where it colors the selection band and the keyboard focus ring. Unset, the wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`. The calendar does not take it. | -| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | -| `isRounded` | `boolean` | `false` | Rounded input corners. | -| `shouldDisableDate` | `(d: Date) => boolean` | — | Disable specific dates. Blocked dates are also rejected during manual typing (the predicate receives the full candidate date-time — prefer day-based checks). | -| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates, matched by calendar day; also rejected by manual typing. | -| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the calendar week starts on. | -| `dayNames` | `string[]` | — | Override the 7 day-name labels. | -| `monthNames` | `string[]` | — | Override the 12 month-name labels. | -| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months. | -| `hourFormat` | `'12'` \| `'24'` | `'24'` | Time format. | -| `enableSeconds` | `boolean` | `false` | Show seconds column. Note: iOS Safari's native datetime-local picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | -| `incrementHours` | `number` | `1` | Hour step. | -| `incrementMinutes` | `number` | `1` | Step between minute-wheel values (`1` = every minute, iOS-style). | -| `incrementSeconds` | `number` | `1` | Step between second-wheel values (only with `enableSeconds`). | -| `unselectableTimes` | `(d: Date) => boolean` | — | Block specific times. Blocked times are also rejected during manual typing. | -| `iconLeftName` | `string` | `'calendar-alt'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | -| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | -| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | -| `audioTick` | `boolean` | `false` | Play a short audible tick on each time-wheel crossing. Default `false`. | -| `haptics` | `boolean` | `false` | Auto-route tactile feedback per wheel tick (vibrate on Android, audio thunk on iOS). Default `false`. | -| `labels` | `PickerLabels` | — | Optional translatable string overrides. | -| `className` | `string` | — | Additional CSS classes. | -| `ref` | `React.Ref` | — | Forwarded to the underlying element. | -| `name` | `string` | — | Form field name. | -| `form` | `string` | — | Optional id of the form the input belongs to. | -| `required` | `boolean` | `false` | Marks the field as required for native HTML form validation. | -| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | +| Prop | Type | Default | Description | +| ------------------- | -------------------------------------------------------------------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | +| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | +| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | +| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | +| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | +| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | +| `iconRightName` | `string` | — | Shortcut for the right icon name. | +| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | +| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | +| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | +| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | +| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | +| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | +| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | +| `message` | `React.ReactNode` | — | Help/validation text below the input. | +| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Message color. | +| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | +| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | +| `value` | `Date` \| `null` | — | Controlled selected date-time. | +| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | +| `onChange` | `(d: Date \| null) => void` | — | Fired when either the date or time portion changes. | +| `onOpen` | `() => void` | — | Fired when the popover opens. | +| `onClose` | `() => void` | — | Fired when the popover closes. | +| `min` | `Date` | — | Lower bound for the combined date-time. | +| `max` | `Date` | — | Upper bound for the combined date-time. | +| `disabled` | `boolean` | `false` | Disable the input. | +| `readOnly` | `boolean` | `false` | Read-only input. | +| `placeholder` | `string` | — | Placeholder text. | +| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD HH:mm'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD HH:mm'`. | +| `parse` | `(s: string) => Date \| null` | — | Custom parser. | +| `locale` | `string` | — | BCP-47 locale tag. | +| `inline` | `boolean` | `false` | Render the panel inline (no popover). | +| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer devices. | +| `editable` | `boolean` | `true` | Allow segmented keyboard typing (type the date-time directly across all segments). `false` makes the field picker-only. | +| `popover` | `boolean` | `true` | Whether the calendar + time popover exists. `false` makes the field input-only (segmented typing with no popover). Default `true`. | +| `openOnFocus` | `boolean` | `true` | Open the popover on focus. Default `true`. | +| `closeOnSelect` | `boolean` | `false` | Off by default — users typically tweak both halves before committing. | +| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position. | +| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | +| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date, today's date, the selection band and the keyboard focus rings. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way. | +| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | +| `isRounded` | `boolean` | `false` | Rounded input corners. | +| `shouldDisableDate` | `(d: Date) => boolean` | — | Disable specific dates. Blocked dates are also rejected during manual typing (the predicate receives the full candidate date-time — prefer day-based checks). | +| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates, matched by calendar day; also rejected by manual typing. | +| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the calendar week starts on. | +| `dayNames` | `string[]` | — | Override the 7 day-name labels. | +| `monthNames` | `string[]` | — | Override the 12 month-name labels. | +| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months. | +| `hourFormat` | `'12'` \| `'24'` | `'24'` | Time format. | +| `enableSeconds` | `boolean` | `false` | Show seconds column. Note: iOS Safari's native datetime-local picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | +| `incrementHours` | `number` | `1` | Hour step. | +| `incrementMinutes` | `number` | `1` | Step between minute-wheel values (`1` = every minute, iOS-style). | +| `incrementSeconds` | `number` | `1` | Step between second-wheel values (only with `enableSeconds`). | +| `unselectableTimes` | `(d: Date) => boolean` | — | Block specific times. Blocked times are also rejected during manual typing. | +| `iconLeftName` | `string` | `'calendar-alt'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | +| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | +| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | +| `audioTick` | `boolean` | `false` | Play a short audible tick on each time-wheel crossing. Default `false`. | +| `haptics` | `boolean` | `false` | Auto-route tactile feedback per wheel tick (vibrate on Android, audio thunk on iOS). Default `false`. | +| `labels` | `PickerLabels` | — | Optional translatable string overrides. | +| `className` | `string` | — | Additional CSS classes. | +| `ref` | `React.Ref` | — | Forwarded to the underlying element. | +| `name` | `string` | — | Form field name. | +| `form` | `string` | — | Optional id of the form the input belongs to. | +| `required` | `boolean` | `false` | Marks the field as required for native HTML form validation. | +| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | @@ -922,6 +928,7 @@ When you pass an explicit token `format`, **that format is the source of truth f | `--bulma-dateinput-cell-selected-bg` ‡ | `$dateinput-cell-selected-bg` | `var(--bulma-primary)` | | `--bulma-dateinput-cell-selected-color` ‡ | `$dateinput-cell-selected-color` | `var(--bulma-primary-invert)` | | `--bulma-dateinput-cell-today-color` ‡ | `$dateinput-cell-today-color` | `var(--bulma-primary)` | +| `--bulma-dateinput-focus-ring-color` ‡ | `$dateinput-focus-ring-color` | `var(--bulma-primary)` | | `--bulma-dateinput-cell-disabled-color` ‡ | `$dateinput-cell-disabled-color` | `var(--bulma-text-weak)` | | `--bulma-dateinput-cell-other-month-color` ‡ | `$dateinput-cell-other-month-color` | `var(--bulma-text-weak)` | | `--bulma-dateinput-header-padding` ‡ | `$dateinput-header-padding` | `0.5rem 0` | @@ -947,7 +954,7 @@ When you pass an explicit token `format`, **that format is the source of truth f | `--bulma-timeinput-wheel-width` ‡ | `$timeinput-wheel-width` | `3rem` | | `--bulma-timeinput-wheel-item-height` ‡ | `$timeinput-wheel-item-height` | `2rem` | | `--bulma-timeinput-wheel-gap` ‡ | `$timeinput-wheel-gap` | `0.4rem` | -| `--bulma-timeinput-wheel-bg` ‡ | `$timeinput-wheel-bg` | `var(--bulma-scheme-main)` | +| `--bulma-timeinput-wheel-bg` ‡ | `$timeinput-wheel-bg` | `transparent` | | `--bulma-timeinput-wheel-color` ‡ | `$timeinput-wheel-color` | `var(--bulma-text)` | | `--bulma-timeinput-wheel-dim-color` ‡ | `$timeinput-wheel-dim-color` | `var(--bulma-text-weak)` | | `--bulma-timeinput-wheel-hover-bg` ‡ | `$timeinput-wheel-hover-bg` | `hsla(0, 0%, 50%, 0.13)` | @@ -992,3 +999,5 @@ When you pass an explicit token `format`, **that format is the source of truth f ‡ declared on a constituent element: values set via `className`, the `style` prop, or an ancestor are only inherited and lose — target the declaring element in your CSS. + +**Item height:** `--bulma-timeinput-wheel-item-height` (`$timeinput-wheel-item-height`) is registered, and nothing reads it. The component sets each wheel item's height inline, taller on small viewports, because the wheels position their items from that height in script. It stays registered so a Sass build that configures it keeps compiling. diff --git a/docs/docs/api/form/datetime/timeinput.md b/docs/docs/api/form/datetime/timeinput.md index 4e569fdab..77932d8a4 100644 --- a/docs/docs/api/form/datetime/timeinput.md +++ b/docs/docs/api/form/datetime/timeinput.md @@ -1074,7 +1074,7 @@ When you pass an explicit token `format`, **that format is the source of truth f | `--bulma-timeinput-wheel-width` ‡ | `$timeinput-wheel-width` | `3rem` | | `--bulma-timeinput-wheel-item-height` ‡ | `$timeinput-wheel-item-height` | `2rem` | | `--bulma-timeinput-wheel-gap` ‡ | `$timeinput-wheel-gap` | `0.4rem` | -| `--bulma-timeinput-wheel-bg` ‡ | `$timeinput-wheel-bg` | `var(--bulma-scheme-main)` | +| `--bulma-timeinput-wheel-bg` ‡ | `$timeinput-wheel-bg` | `transparent` | | `--bulma-timeinput-wheel-color` ‡ | `$timeinput-wheel-color` | `var(--bulma-text)` | | `--bulma-timeinput-wheel-dim-color` ‡ | `$timeinput-wheel-dim-color` | `var(--bulma-text-weak)` | | `--bulma-timeinput-wheel-hover-bg` ‡ | `$timeinput-wheel-hover-bg` | `hsla(0, 0%, 50%, 0.13)` | @@ -1119,3 +1119,5 @@ When you pass an explicit token `format`, **that format is the source of truth f ‡ declared on a constituent element: values set via `className`, the `style` prop, or an ancestor are only inherited and lose — target the declaring element in your CSS. + +**Item height:** `--bulma-timeinput-wheel-item-height` (`$timeinput-wheel-item-height`) is registered, and nothing reads it. The component sets each wheel item's height inline, taller on small viewports, because the wheels position their items from that height in script. It stays registered so a Sass build that configures it keeps compiling. diff --git a/scripts/color-tuple-css.test.mjs b/scripts/color-tuple-css.test.mjs index ef03f5dfb..d6910ea58 100644 --- a/scripts/color-tuple-css.test.mjs +++ b/scripts/color-tuple-css.test.mjs @@ -33,11 +33,11 @@ * the shape of the defect that started this. Several do emit it without * warning and are invisible here. Narrowing `color` to a CSS-backed union does * not make that safe, because the union says nothing about the element the - * class lands on: the time wheels put `is-` on an element with no - * colour rule until #701, and that element now has a case of its own below. - * Grep the emission rather than trusting a list here. Closing the gap wants - * the library to say which components warn, rather than a test guessing from - * source. + * class lands on: the time wheels until #701, and the calendar for longer, put + * `is-` on an element with no colour rule, and each of those elements + * now has a case of its own below. Grep the emission rather than trusting a + * list here. Closing the gap wants the library to say which components warn, + * rather than a test guessing from source. * * `codeOnly` is a textual strip, with the limit that implies: a comment * opener inside a string literal removes real code along with itself — `//` @@ -78,7 +78,7 @@ const DEPRECATIONS = join( 'helpers', 'colorDeprecations.ts' ); -const TIME_WHEELS = join(SRC, 'form', '_pickerInternals', 'TimeWheels.tsx'); +const PICKER_INTERNALS = join(SRC, 'form', '_pickerInternals'); /** * The stylesheet, or an actionable failure. @@ -2652,49 +2652,64 @@ describe('the colour tuples agree with the shipped stylesheet', () => { }); /** - * The colours the time wheels' own `color` prop accepts. + * The colours a picker internal's own `color` prop accepts. * - * Read from the wheel rather than from the components that feed it, because - * the wheel is where the class lands and every feeder has to pass a value - * this type admits, so one read covers `TimeInput`, `DateTimeInput` and any - * later caller without a list of them here. + * Read from the internal rather than from the components that feed it, + * because the internal is where the class lands and every feeder has to pass + * a value this type admits, so one read covers `TimeInput`, `DateInput`, + * `DateTimeInput` and any later caller without a list of them here. */ -function timeWheelColors() { - const source = codeOnly(readFileSync(TIME_WHEELS, 'utf8')); - const props = /export interface TimeWheelsProps\s*\{([\s\S]*?)\n\}/.exec( - source - ); - const color = props && /\bcolor\?:\s*([^;]+);/.exec(props[1]); +function acceptedColors(file, props) { + const source = codeOnly(readFileSync(file, 'utf8')); + const body = new RegExp( + `export interface ${props}\\s*\\{([\\s\\S]*?)\\n\\}` + ).exec(source); + const color = body && /\bcolor\?:\s*([^;]+);/.exec(body[1]); assert.ok( color, - `could not find \`TimeWheelsProps.color\` in ${TIME_WHEELS}, so the ` + - 'wheel colours cannot be read. Fix the pattern in the same change ' + - 'that moved it.' + `could not find \`${props}.color\` in ${file}, so its colours cannot ` + + 'be read. Fix the pattern in the same change that moved it.' ); const values = [...color[1].matchAll(QUOTED)].map(m => m[2]); assert.ok( values.length > 0, - '`TimeWheelsProps.color` named no literal colour, so the check below ' + - 'would pass on nothing. A union spelled through an alias hides its ' + - 'literals from this read.' + `\`${props}.color\` named no literal colour, so the check below would ` + + 'pass on nothing. A union spelled through an alias hides its literals ' + + 'from this read.' ); return values; } -describe('the time wheels style every colour they accept', () => { - // Nothing on the wheels calls `warnUnstyledColor`, so the comparison above - // never reaches them, and `is-` sat dead on every wheel until #701. - // The wheel rule is asked for directly instead. - it('ships a `.timeinput-wheel.is-` rule for each', () => { - const css = stylesheet(); - for (const color of timeWheelColors()) { - assert.ok( - shipsClass(css, `timeinput-wheel.is-${color}`), - `the time wheels accept \`color="${color}"\` and put ` + - `\`is-${color}\` on each wheel, and the stylesheet has no ` + - `\`.timeinput-wheel.is-${color}\` rule, so the value renders ` + - 'nothing. The colour loop in `_timeinput.scss` needs it.' - ); - } - }); +// Nothing on these calls `warnUnstyledColor`, so the comparison above never +// reaches them, and each put `is-` on an element no rule styled: the +// wheels until #701, the calendar for longer. The rule for the element the +// class lands on is asked for directly instead. +describe('the picker internals style every colour they accept', () => { + for (const { file, props, root, partial } of [ + { + file: join(PICKER_INTERNALS, 'TimeWheels.tsx'), + props: 'TimeWheelsProps', + root: 'timeinput-wheel', + partial: '_timeinput.scss', + }, + { + file: join(PICKER_INTERNALS, 'Calendar.tsx'), + props: 'CalendarProps', + root: 'dateinput', + partial: '_dateinput.scss', + }, + ]) { + it(`ships a \`.${root}.is-\` rule for each in \`${props}.color\``, () => { + const css = stylesheet(); + for (const color of acceptedColors(file, props)) { + assert.ok( + shipsClass(css, `${root}.is-${color}`), + `\`${props}.color\` admits "${color}", which lands as ` + + `\`is-${color}\` on \`.${root}\`, and the stylesheet has no ` + + `\`.${root}.is-${color}\` rule, so the value renders nothing. ` + + `The colour loop in \`${partial}\` needs it.` + ); + } + }); + } }); diff --git a/skills/bestax-theming/references/css-variables.md b/skills/bestax-theming/references/css-variables.md index b8c818877..0786d8916 100644 --- a/skills/bestax-theming/references/css-variables.md +++ b/skills/bestax-theming/references/css-variables.md @@ -232,8 +232,9 @@ own-selector override rule applies. `--bulma-dateinput-cell-radius`, `--bulma-dateinput-cell-selected-bg`, `--bulma-dateinput-cell-selected-color`, `--bulma-dateinput-cell-size`, `--bulma-dateinput-cell-today-color`, `--bulma-dateinput-day-name-color`, -`--bulma-dateinput-day-name-size`, `--bulma-dateinput-header-padding`, -`--bulma-dateinput-min-width`, `--bulma-dateinput-nav-button-size` +`--bulma-dateinput-day-name-size`, `--bulma-dateinput-focus-ring-color`, +`--bulma-dateinput-header-padding`, `--bulma-dateinput-min-width`, +`--bulma-dateinput-nav-button-size` ### DateTimeInput @@ -385,6 +386,9 @@ Declared on the compound `.button.link-button` — see the compound-selector exc `--bulma-timeinput-wheel-radius`, `--bulma-timeinput-wheel-selected-bg`, `--bulma-timeinput-wheel-selected-color`, `--bulma-timeinput-wheel-width` +`--bulma-timeinput-wheel-item-height` is registered but has no effect: the component sets each +wheel item's height inline. + ### Toast `--bulma-toast-action-hover-opacity`, `--bulma-toast-action-radius`, From 612aa09a8973e84b351df01fc1f01dc76b2155a7 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Wed, 30 Sep 2026 11:49:19 -0400 Subject: [PATCH 2/4] fix(bulma-ui): keep the picker focus rings visible in every color A focus ring that follows `color` is only as visible as the color. On a white surface plain `info`, `success`, `warning` and `danger` all fall below the 3:1 a focus indicator needs, `warning` at 1.75:1, and that held for the calendar ring added in this branch and for the wheel ring since #832. Under `is-` both rings now read the color's `-on-scheme` variant, which Bulma darkens or lightens until it contrasts with `scheme-main`. The wheels get a `--bulma-timeinput-wheel-focus-ring-color` of their own for it, defaulting to the band, so an uncolored wheel keeps the ring it had. Unset rings are unchanged on both. The cost is that `color="primary"` now puts a slightly different ring from no color at all, which the `color` TSDoc says. Also corrects two strings: the DateTimeInput inline example no longer says a popover carries the color, and the wheel hover comment gives the real reason the fill does not animate. --- bestax-mcp/data/catalog.json | 1 + bestax-mcp/data/components/DateInput.json | 2 +- bestax-mcp/data/components/DateTimeInput.json | 8 +- bestax-mcp/data/components/TimeInput.json | 8 +- bestax-mcp/data/skills.json | 2 +- bulma-ui/src/form/DateInputBase.tsx | 8 +- bulma-ui/src/form/DateTimeInputBase.tsx | 12 +- bulma-ui/src/form/TimeInputBase.tsx | 7 +- .../form/__tests__/DateInput.styles.test.tsx | 19 ++- .../form/__tests__/TimeInput.styles.test.tsx | 25 +++- bulma-ui/src/scss/form/_dateinput.scss | 11 +- bulma-ui/src/scss/form/_timeinput.scss | 20 ++- docs/docs/api/form/datetime/dateinput.md | 120 +++++++-------- docs/docs/api/form/datetime/datetimeinput.md | 139 +++++++++--------- docs/docs/api/form/datetime/timeinput.md | 125 ++++++++-------- .../references/css-variables.md | 9 +- 16 files changed, 287 insertions(+), 229 deletions(-) diff --git a/bestax-mcp/data/catalog.json b/bestax-mcp/data/catalog.json index dea54b6f8..2f991f830 100644 --- a/bestax-mcp/data/catalog.json +++ b/bestax-mcp/data/catalog.json @@ -1891,6 +1891,7 @@ "--bulma-timeinput-wheel-bg": "TimeInput", "--bulma-timeinput-wheel-color": "TimeInput", "--bulma-timeinput-wheel-dim-color": "TimeInput", + "--bulma-timeinput-wheel-focus-ring-color": "TimeInput", "--bulma-timeinput-wheel-gap": "TimeInput", "--bulma-timeinput-wheel-hover-bg": "TimeInput", "--bulma-timeinput-wheel-item-height": "TimeInput", diff --git a/bestax-mcp/data/components/DateInput.json b/bestax-mcp/data/components/DateInput.json index 9a95ef206..6a19d3483 100644 --- a/bestax-mcp/data/components/DateInput.json +++ b/bestax-mcp/data/components/DateInput.json @@ -526,7 +526,7 @@ "name": "color", "type": "'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'", "default": null, - "description": "Bulma color modifier for the input, also carried by the calendar, where it colors the selected date, today's date and the keyboard focus ring. Unset, the calendar uses its `--bulma-dateinput-*` variables, which follow `primary` by default.", + "description": "Bulma color modifier for the input, also carried by the calendar, where it colors the selected date and today's date. The keyboard focus ring takes the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset ring, which is plain `primary`. Unset, the calendar uses its `--bulma-dateinput-*` variables, which follow `primary` by default.", "required": false, "inherited": true, "deprecated": false diff --git a/bestax-mcp/data/components/DateTimeInput.json b/bestax-mcp/data/components/DateTimeInput.json index 8a6e1303f..9a66b9633 100644 --- a/bestax-mcp/data/components/DateTimeInput.json +++ b/bestax-mcp/data/components/DateTimeInput.json @@ -534,7 +534,7 @@ "name": "color", "type": "'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'", "default": null, - "description": "Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date, today's date, the selection band and the keyboard focus rings. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way.", + "description": "Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date, today's date and the selection band. The keyboard focus rings take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset rings, which are plain `primary`. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way.", "required": false, "inherited": true, "deprecated": false @@ -1018,6 +1018,12 @@ "default": "var(--bulma-radius)", "scope": "element" }, + { + "css": "--bulma-timeinput-wheel-focus-ring-color", + "sass": "$timeinput-wheel-focus-ring-color", + "default": "var(--bulma-timeinput-wheel-selected-bg)", + "scope": "element" + }, { "css": "--bulma-timeinput-wheel-mask", "sass": "$timeinput-wheel-mask", diff --git a/bestax-mcp/data/components/TimeInput.json b/bestax-mcp/data/components/TimeInput.json index abf35c8e4..b0605e647 100644 --- a/bestax-mcp/data/components/TimeInput.json +++ b/bestax-mcp/data/components/TimeInput.json @@ -542,7 +542,7 @@ "name": "color", "type": "'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'", "default": null, - "description": "Bulma color modifier for the input, also carried by the wheels, where it colors the selection band and the keyboard focus ring. Unset, the wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`.", + "description": "Bulma color modifier for the input, also carried by the wheels, where it colors the selection band. The keyboard focus ring takes the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset ring, which follows the band. Unset, the wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`.", "required": false, "inherited": true, "deprecated": false @@ -834,6 +834,12 @@ "default": "var(--bulma-radius)", "scope": "element" }, + { + "css": "--bulma-timeinput-wheel-focus-ring-color", + "sass": "$timeinput-wheel-focus-ring-color", + "default": "var(--bulma-timeinput-wheel-selected-bg)", + "scope": "element" + }, { "css": "--bulma-timeinput-wheel-mask", "sass": "$timeinput-wheel-mask", diff --git a/bestax-mcp/data/skills.json b/bestax-mcp/data/skills.json index 404075045..65c6820e8 100644 --- a/bestax-mcp/data/skills.json +++ b/bestax-mcp/data/skills.json @@ -176,7 +176,7 @@ { "id": "css-variables", "file": "references/css-variables.md", - "bytes": 27061 + "bytes": 27105 }, { "id": "themeable-components", diff --git a/bulma-ui/src/form/DateInputBase.tsx b/bulma-ui/src/form/DateInputBase.tsx index c0476ed38..29b5966b3 100644 --- a/bulma-ui/src/form/DateInputBase.tsx +++ b/bulma-ui/src/form/DateInputBase.tsx @@ -103,9 +103,11 @@ export interface DateInputBaseProps appendToBody?: boolean; /** * Bulma color modifier for the input, also carried by the calendar, where it - * colors the selected date, today's date and the keyboard focus ring. Unset, - * the calendar uses its `--bulma-dateinput-*` variables, which follow - * `primary` by default. + * colors the selected date and today's date. The keyboard focus ring takes + * the color's `-on-scheme` variant, which Bulma adjusts to contrast with the + * background, so pale colors stay visible; that makes `'primary'` a shade + * off the unset ring, which is plain `primary`. Unset, the calendar uses its + * `--bulma-dateinput-*` variables, which follow `primary` by default. */ color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'; /** Size variant. */ diff --git a/bulma-ui/src/form/DateTimeInputBase.tsx b/bulma-ui/src/form/DateTimeInputBase.tsx index f04e1d3c6..3924110cf 100644 --- a/bulma-ui/src/form/DateTimeInputBase.tsx +++ b/bulma-ui/src/form/DateTimeInputBase.tsx @@ -135,11 +135,13 @@ export interface DateTimeInputBaseProps appendToBody?: boolean; /** * Bulma color modifier for the input, also carried by the calendar and the - * time wheels, where it colors the selected date, today's date, the - * selection band and the keyboard focus rings. Unset, they use their - * `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which - * follow `primary` by default. The footer's time pill and Done button stay - * `primary` either way. + * time wheels, where it colors the selected date, today's date and the + * selection band. The keyboard focus rings take the color's `-on-scheme` + * variant, which Bulma adjusts to contrast with the background, so pale + * colors stay visible; that makes `'primary'` a shade off the unset rings, + * which are plain `primary`. Unset, they use their `--bulma-dateinput-*` and + * `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. + * The footer's time pill and Done button stay `primary` either way. */ color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'; /** Size variant. */ diff --git a/bulma-ui/src/form/TimeInputBase.tsx b/bulma-ui/src/form/TimeInputBase.tsx index 3d8726c9b..96413db54 100644 --- a/bulma-ui/src/form/TimeInputBase.tsx +++ b/bulma-ui/src/form/TimeInputBase.tsx @@ -125,8 +125,11 @@ export interface TimeInputBaseProps appendToBody?: boolean; /** * Bulma color modifier for the input, also carried by the wheels, where it - * colors the selection band and the keyboard focus ring. Unset, the wheels - * use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`. + * colors the selection band. The keyboard focus ring takes the color's + * `-on-scheme` variant, which Bulma adjusts to contrast with the background, + * so pale colors stay visible; that makes `'primary'` a shade off the unset + * ring, which follows the band. Unset, the wheels use + * `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`. */ color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'; /** Size variant. */ diff --git a/bulma-ui/src/form/__tests__/DateInput.styles.test.tsx b/bulma-ui/src/form/__tests__/DateInput.styles.test.tsx index 3e10eb582..d610f3c23 100644 --- a/bulma-ui/src/form/__tests__/DateInput.styles.test.tsx +++ b/bulma-ui/src/form/__tests__/DateInput.styles.test.tsx @@ -31,14 +31,25 @@ const colors = [ ] as const; type Color = (typeof colors)[number]; -/** The variables a colour re-points, and what each should read for it. */ +/** + * The variables a colour re-points, and what each should read for it. The + * ring takes the `-on-scheme` variant, which Bulma adjusts until it contrasts + * with `scheme-main`: plain `warning` or `success` is too faint for a focus + * indicator on a light surface. + */ const accents = (color: string) => ({ '--bulma-dateinput-cell-selected-bg': `var(--bulma-${color})`, '--bulma-dateinput-cell-selected-color': `var(--bulma-${color}-invert)`, '--bulma-dateinput-cell-today-color': `var(--bulma-${color})`, - '--bulma-dateinput-focus-ring-color': `var(--bulma-${color})`, + '--bulma-dateinput-focus-ring-color': `var(--bulma-${color}-on-scheme)`, }); +/** What an uncoloured calendar reads: `primary` throughout, ring included. */ +const defaults = { + ...accents('primary'), + '--bulma-dateinput-focus-ring-color': 'var(--bulma-primary)', +}; + /** The accent variables as the calendar root computes them. */ function computedAccents(root: HTMLElement) { const style = getComputedStyle(root); @@ -92,9 +103,7 @@ describe.each(pickers)('%s calendar colour styles', (_name, picker) => { it('leaves an uncoloured calendar on the primary defaults', () => { const { container } = render(picker()); - expect(computedAccents(calendarRoot(container))).toEqual( - accents('primary') - ); + expect(computedAccents(calendarRoot(container))).toEqual(defaults); }); }); diff --git a/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx b/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx index 043ccf5e1..160ac2cce 100644 --- a/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx +++ b/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx @@ -52,19 +52,38 @@ describe('TimeInput wheel colour styles', () => { .getPropertyValue('--bulma-timeinput-wheel-selected-color') .trim() ).toBe(`var(--bulma-${color}-invert)`); + // The ring takes the contrast-adjusted variant: plain `warning` or + // `success` is too faint for a focus indicator on a light surface. + expect( + style + .getPropertyValue('--bulma-timeinput-wheel-focus-ring-color') + .trim() + ).toBe(`var(--bulma-${color}-on-scheme)`); } } ); it('leaves an uncoloured wheel on the inherited default', () => { - const { getAllByRole } = render(); + const { container, getAllByRole } = render(); for (const wheel of getAllByRole('spinbutton')) { + const style = getComputedStyle(wheel); + expect( + style.getPropertyValue('--bulma-timeinput-wheel-selected-bg').trim() + ).toBe(''); expect( - getComputedStyle(wheel) - .getPropertyValue('--bulma-timeinput-wheel-selected-bg') + style + .getPropertyValue('--bulma-timeinput-wheel-focus-ring-color') .trim() ).toBe(''); } + // Where the default lives, the ring follows the band. + const root = container.querySelector('.timeinput'); + expect(root).not.toBeNull(); + expect( + getComputedStyle(root as HTMLElement) + .getPropertyValue('--bulma-timeinput-wheel-focus-ring-color') + .trim() + ).toBe('var(--bulma-timeinput-wheel-selected-bg)'); }); }); diff --git a/bulma-ui/src/scss/form/_dateinput.scss b/bulma-ui/src/scss/form/_dateinput.scss index b780856de..e4a6d86d6 100644 --- a/bulma-ui/src/scss/form/_dateinput.scss +++ b/bulma-ui/src/scss/form/_dateinput.scss @@ -275,9 +275,12 @@ $dateinput-nav-button-size: 1.75rem !default; // Colour variants. `color` lands on the calendar root as `is-`, and // the root re-points its accent variables at that colour: the selection fill -// paired with its `-invert` for the selected value, today's tint and the focus -// ring, the same pairings the `primary` defaults use. Every rule that paints -// an accent reads one of these, so they follow without rules of their own. +// paired with its `-invert` for the selected value, and today's tint. The +// focus ring takes the colour's `-on-scheme` variant instead, which Bulma +// darkens or lightens until it contrasts with `scheme-main`, since a ring in +// plain `warning` or `success` is too faint to see on a light surface. Every +// rule that paints an accent reads one of these, so they follow without rules +// of their own. @each $name in 'primary', 'link', 'info', 'success', 'warning', 'danger' { .#{iv.$class-prefix}dateinput.#{iv.$class-prefix}is-#{$name} { @include cv.register-vars( @@ -285,7 +288,7 @@ $dateinput-nav-button-size: 1.75rem !default; 'dateinput-cell-selected-bg': #{cv.getVar($name)}, 'dateinput-cell-selected-color': #{cv.getVar('#{$name}-invert')}, 'dateinput-cell-today-color': #{cv.getVar($name)}, - 'dateinput-focus-ring-color': #{cv.getVar($name)}, + 'dateinput-focus-ring-color': #{cv.getVar('#{$name}-on-scheme')}, ) ); } diff --git a/bulma-ui/src/scss/form/_timeinput.scss b/bulma-ui/src/scss/form/_timeinput.scss index 1c1365dde..49130b033 100644 --- a/bulma-ui/src/scss/form/_timeinput.scss +++ b/bulma-ui/src/scss/form/_timeinput.scss @@ -20,6 +20,8 @@ $timeinput-wheel-hover-bg: hsla(0, 0%, 50%, 0.13) !default; $timeinput-wheel-selected-bg: cv.getVar('primary') !default; $timeinput-wheel-selected-color: cv.getVar('primary-invert') !default; $timeinput-wheel-radius: cv.getVar('radius') !default; +// Follows the band unless a colour sets it (see the colour variants below). +$timeinput-wheel-focus-ring-color: cv.getVar('timeinput-wheel-selected-bg') !default; // The per-item depth fade applied inline in TimeWheels.tsx now does the heavy // lifting of dimming away-from-centre values. The mask just trims the very // edges so partial items at the top/bottom don't get a hard cut-off — keep @@ -49,6 +51,7 @@ $timeinput-footer-padding: 0.5rem 0 0 !default; 'timeinput-wheel-selected-bg': #{$timeinput-wheel-selected-bg}, 'timeinput-wheel-selected-color': #{$timeinput-wheel-selected-color}, 'timeinput-wheel-radius': #{$timeinput-wheel-radius}, + 'timeinput-wheel-focus-ring-color': #{$timeinput-wheel-focus-ring-color}, 'timeinput-wheel-mask': #{$timeinput-wheel-mask}, 'timeinput-separator-color': #{$timeinput-separator-color}, 'timeinput-separator-size': #{$timeinput-separator-size}, @@ -123,10 +126,8 @@ $timeinput-footer-padding: 0.5rem 0 0 !default; // that used to live here was removed when the band became the indicator — // pinning a ring to the selected item caused a broken-outline artefact // whenever position was mid-flight (item offset from band). - // - // The ring reads the band's colour, so a coloured wheel keeps one accent. &:focus-visible { - outline: 2px solid cv.getVar('timeinput-wheel-selected-bg'); + outline: 2px solid cv.getVar('timeinput-wheel-focus-ring-color'); outline-offset: 2px; border-radius: cv.getVar('timeinput-wheel-radius'); } @@ -161,9 +162,8 @@ $timeinput-footer-padding: 0.5rem 0 0 !default; color 0.1s ease, font-weight 0.1s ease; - // The fill is left out of the transition above for the reason the calendar - // cells give in `_dateinput.scss`: Chrome can strand a button's background - // transition mid-flight. + // The fill is not in the transition list above, so it snaps on and off the + // way the calendar cells' hover does. &:hover:not(:disabled):not(.#{iv.$class-prefix}is-selected) { color: cv.getVar('timeinput-wheel-color'); background-color: cv.getVar('timeinput-wheel-hover-bg'); @@ -237,14 +237,18 @@ $timeinput-footer-padding: 0.5rem 0 0 !default; // Colour variants. `color` lands on each wheel as `is-`, and the wheel // re-points its selection variables at that colour, pairing it with its // `-invert` for the selected value the way the `primary` default does. The -// band, the selected item and the focus ring all read these variables, so -// they follow without rules of their own. +// focus ring takes the colour's `-on-scheme` variant instead, which Bulma +// darkens or lightens until it contrasts with `scheme-main`, since a ring in +// plain `warning` or `success` is too faint to see on a light surface. The +// band, the selected item and the ring all read these variables, so they +// follow without rules of their own. @each $name in 'primary', 'link', 'info', 'success', 'warning', 'danger' { .#{iv.$class-prefix}timeinput-wheel.#{iv.$class-prefix}is-#{$name} { @include cv.register-vars( ( 'timeinput-wheel-selected-bg': #{cv.getVar($name)}, 'timeinput-wheel-selected-color': #{cv.getVar('#{$name}-invert')}, + 'timeinput-wheel-focus-ring-color': #{cv.getVar('#{$name}-on-scheme')}, ) ); } diff --git a/docs/docs/api/form/datetime/dateinput.md b/docs/docs/api/form/datetime/dateinput.md index cb72faa9f..b7e348a94 100644 --- a/docs/docs/api/form/datetime/dateinput.md +++ b/docs/docs/api/form/datetime/dateinput.md @@ -856,66 +856,66 @@ Use `inline` instead of the popover when you have vertical room to spare — boo -| Prop | Type | Default | Description | -| ------------------- | -------------------------------------------------------------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `label` | `React.ReactNode` | — | Field label (component auto-wraps in a `Field` if not already inside). Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | -| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | -| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | -| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | -| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | -| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | -| `iconRightName` | `string` | — | Shortcut for the right icon name. | -| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | -| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | -| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | -| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | -| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | -| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | -| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | -| `message` | `React.ReactNode` | — | Help/validation text below the input. | -| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Color modifier for the help message. | -| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | -| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | -| `value` | `Date` \| `null` | — | Controlled selected date. | -| `defaultValue` | `Date` \| `null` | — | Initial date for uncontrolled usage. | -| `onChange` | `(d: Date \| null) => void` | — | Fired when the value changes. | -| `onOpen` | `() => void` | — | Fired when the popover opens. | -| `onClose` | `() => void` | — | Fired when the popover closes. | -| `min` | `Date` | — | Earliest selectable date. | -| `max` | `Date` | — | Latest selectable date. | -| `disabled` | `boolean` | `false` | Disable the input. | -| `readOnly` | `boolean` | `false` | Make the input read-only. | -| `placeholder` | `string` | — | Placeholder text for the input. | -| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD'`. | -| `parse` | `(s: string) => Date \| null` | — | Custom parser (use when `format` is `Intl.DateTimeFormatOptions`). | -| `locale` | `string` | — | BCP-47 locale tag for day/month names and Intl formatting. | -| `inline` | `boolean` | `false` | Render the calendar inline (no popover). | -| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer + small-viewport devices. | -| `editable` | `boolean` | `true` | Allow segmented keyboard typing in the input (type the date directly, auto-advancing across segments). `false` makes the field picker-only. | -| `popover` | `boolean` | `true` | Whether the calendar popover exists. `false` makes the field input-only (segmented typing, no popover). | -| `openOnFocus` | `boolean` | `true` | Open the popover when the input is focused. | -| `closeOnSelect` | `boolean` | `true` | Close the popover after a date is selected. | -| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position relative to the input. | -| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | -| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar, where it colors the selected date, today's date and the keyboard focus ring. Unset, the calendar uses its `--bulma-dateinput-*` variables, which follow `primary` by default. | -| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | -| `isRounded` | `boolean` | `false` | Render the input with rounded corners. | -| `shouldDisableDate` | `(d: Date) => boolean` | — | Predicate to disable specific dates (e.g. weekends). Blocked dates are also rejected during manual typing. | -| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates; merged with `shouldDisableDate`. Matched by calendar day and also rejected during manual typing. | -| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the week starts on (0 = Sunday). | -| `dayNames` | `string[]` | — | Override the 7 day-name labels (in calendar order, post-rotation). | -| `monthNames` | `string[]` | — | Override the 12 month-name labels. | -| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months in the grid. | -| `iconLeftName` | `string` | `'calendar'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | -| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | -| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | -| `labels` | `PickerLabels` | — | Optional translatable string overrides (ARIA labels, button text). | -| `name` | `string` | — | Form field name. Forwarded to a hidden ISO-formatted input. | -| `form` | `string` | — | Form id the input belongs to. | -| `required` | `boolean` | `false` | Marks the input as required. | -| `className` | `string` | — | Additional CSS classes for the input. | -| `ref` | `React.Ref` | — | Forwarded to the underlying ``. | -| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | +| Prop | Type | Default | Description | +| ------------------- | -------------------------------------------------------------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `label` | `React.ReactNode` | — | Field label (component auto-wraps in a `Field` if not already inside). Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | +| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | +| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | +| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | +| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | +| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | +| `iconRightName` | `string` | — | Shortcut for the right icon name. | +| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | +| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | +| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | +| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | +| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | +| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | +| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | +| `message` | `React.ReactNode` | — | Help/validation text below the input. | +| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Color modifier for the help message. | +| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | +| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | +| `value` | `Date` \| `null` | — | Controlled selected date. | +| `defaultValue` | `Date` \| `null` | — | Initial date for uncontrolled usage. | +| `onChange` | `(d: Date \| null) => void` | — | Fired when the value changes. | +| `onOpen` | `() => void` | — | Fired when the popover opens. | +| `onClose` | `() => void` | — | Fired when the popover closes. | +| `min` | `Date` | — | Earliest selectable date. | +| `max` | `Date` | — | Latest selectable date. | +| `disabled` | `boolean` | `false` | Disable the input. | +| `readOnly` | `boolean` | `false` | Make the input read-only. | +| `placeholder` | `string` | — | Placeholder text for the input. | +| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD'`. | +| `parse` | `(s: string) => Date \| null` | — | Custom parser (use when `format` is `Intl.DateTimeFormatOptions`). | +| `locale` | `string` | — | BCP-47 locale tag for day/month names and Intl formatting. | +| `inline` | `boolean` | `false` | Render the calendar inline (no popover). | +| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer + small-viewport devices. | +| `editable` | `boolean` | `true` | Allow segmented keyboard typing in the input (type the date directly, auto-advancing across segments). `false` makes the field picker-only. | +| `popover` | `boolean` | `true` | Whether the calendar popover exists. `false` makes the field input-only (segmented typing, no popover). | +| `openOnFocus` | `boolean` | `true` | Open the popover when the input is focused. | +| `closeOnSelect` | `boolean` | `true` | Close the popover after a date is selected. | +| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position relative to the input. | +| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | +| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar, where it colors the selected date and today's date. The keyboard focus ring takes the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset ring, which is plain `primary`. Unset, the calendar uses its `--bulma-dateinput-*` variables, which follow `primary` by default. | +| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | +| `isRounded` | `boolean` | `false` | Render the input with rounded corners. | +| `shouldDisableDate` | `(d: Date) => boolean` | — | Predicate to disable specific dates (e.g. weekends). Blocked dates are also rejected during manual typing. | +| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates; merged with `shouldDisableDate`. Matched by calendar day and also rejected during manual typing. | +| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the week starts on (0 = Sunday). | +| `dayNames` | `string[]` | — | Override the 7 day-name labels (in calendar order, post-rotation). | +| `monthNames` | `string[]` | — | Override the 12 month-name labels. | +| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months in the grid. | +| `iconLeftName` | `string` | `'calendar'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | +| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | +| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | +| `labels` | `PickerLabels` | — | Optional translatable string overrides (ARIA labels, button text). | +| `name` | `string` | — | Form field name. Forwarded to a hidden ISO-formatted input. | +| `form` | `string` | — | Form id the input belongs to. | +| `required` | `boolean` | `false` | Marks the input as required. | +| `className` | `string` | — | Additional CSS classes for the input. | +| `ref` | `React.Ref` | — | Forwarded to the underlying ``. | +| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | diff --git a/docs/docs/api/form/datetime/datetimeinput.md b/docs/docs/api/form/datetime/datetimeinput.md index 91fceb8d4..7ac37599a 100644 --- a/docs/docs/api/form/datetime/datetimeinput.md +++ b/docs/docs/api/form/datetime/datetimeinput.md @@ -575,7 +575,7 @@ The OS-native pickers always use the device's system locale, so these examples s ``` -**Inline:** the popover carries the color as well. The calendar shows it on the selected date, today's date and its keyboard focus ring, and the time wheels on their selection band and focus ring. The footer's time pill and Done button stay `primary`. +**Inline:** rendered inline, the panel shows the color without opening a popover. The calendar takes it on the selected date, today's date and its keyboard focus ring; open the time row and the wheels take it on their selection band and focus ring. The footer's time pill and Done button stay `primary`. ```tsx live @@ -837,74 +837,74 @@ The DateTimeInput prop set is the union of [DateInput](./dateinput.md) and [Time -| Prop | Type | Default | Description | -| ------------------- | -------------------------------------------------------------------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | -| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | -| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | -| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | -| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | -| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | -| `iconRightName` | `string` | — | Shortcut for the right icon name. | -| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | -| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | -| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | -| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | -| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | -| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | -| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | -| `message` | `React.ReactNode` | — | Help/validation text below the input. | -| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Message color. | -| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | -| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | -| `value` | `Date` \| `null` | — | Controlled selected date-time. | -| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | -| `onChange` | `(d: Date \| null) => void` | — | Fired when either the date or time portion changes. | -| `onOpen` | `() => void` | — | Fired when the popover opens. | -| `onClose` | `() => void` | — | Fired when the popover closes. | -| `min` | `Date` | — | Lower bound for the combined date-time. | -| `max` | `Date` | — | Upper bound for the combined date-time. | -| `disabled` | `boolean` | `false` | Disable the input. | -| `readOnly` | `boolean` | `false` | Read-only input. | -| `placeholder` | `string` | — | Placeholder text. | -| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD HH:mm'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD HH:mm'`. | -| `parse` | `(s: string) => Date \| null` | — | Custom parser. | -| `locale` | `string` | — | BCP-47 locale tag. | -| `inline` | `boolean` | `false` | Render the panel inline (no popover). | -| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer devices. | -| `editable` | `boolean` | `true` | Allow segmented keyboard typing (type the date-time directly across all segments). `false` makes the field picker-only. | -| `popover` | `boolean` | `true` | Whether the calendar + time popover exists. `false` makes the field input-only (segmented typing with no popover). Default `true`. | -| `openOnFocus` | `boolean` | `true` | Open the popover on focus. Default `true`. | -| `closeOnSelect` | `boolean` | `false` | Off by default — users typically tweak both halves before committing. | -| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position. | -| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | -| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date, today's date, the selection band and the keyboard focus rings. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way. | -| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | -| `isRounded` | `boolean` | `false` | Rounded input corners. | -| `shouldDisableDate` | `(d: Date) => boolean` | — | Disable specific dates. Blocked dates are also rejected during manual typing (the predicate receives the full candidate date-time — prefer day-based checks). | -| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates, matched by calendar day; also rejected by manual typing. | -| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the calendar week starts on. | -| `dayNames` | `string[]` | — | Override the 7 day-name labels. | -| `monthNames` | `string[]` | — | Override the 12 month-name labels. | -| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months. | -| `hourFormat` | `'12'` \| `'24'` | `'24'` | Time format. | -| `enableSeconds` | `boolean` | `false` | Show seconds column. Note: iOS Safari's native datetime-local picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | -| `incrementHours` | `number` | `1` | Hour step. | -| `incrementMinutes` | `number` | `1` | Step between minute-wheel values (`1` = every minute, iOS-style). | -| `incrementSeconds` | `number` | `1` | Step between second-wheel values (only with `enableSeconds`). | -| `unselectableTimes` | `(d: Date) => boolean` | — | Block specific times. Blocked times are also rejected during manual typing. | -| `iconLeftName` | `string` | `'calendar-alt'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | -| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | -| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | -| `audioTick` | `boolean` | `false` | Play a short audible tick on each time-wheel crossing. Default `false`. | -| `haptics` | `boolean` | `false` | Auto-route tactile feedback per wheel tick (vibrate on Android, audio thunk on iOS). Default `false`. | -| `labels` | `PickerLabels` | — | Optional translatable string overrides. | -| `className` | `string` | — | Additional CSS classes. | -| `ref` | `React.Ref` | — | Forwarded to the underlying element. | -| `name` | `string` | — | Form field name. | -| `form` | `string` | — | Optional id of the form the input belongs to. | -| `required` | `boolean` | `false` | Marks the field as required for native HTML form validation. | -| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | +| Prop | Type | Default | Description | +| ------------------- | -------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | +| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | +| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | +| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | +| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | +| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | +| `iconRightName` | `string` | — | Shortcut for the right icon name. | +| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | +| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | +| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | +| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | +| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | +| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | +| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | +| `message` | `React.ReactNode` | — | Help/validation text below the input. | +| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Message color. | +| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | +| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | +| `value` | `Date` \| `null` | — | Controlled selected date-time. | +| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | +| `onChange` | `(d: Date \| null) => void` | — | Fired when either the date or time portion changes. | +| `onOpen` | `() => void` | — | Fired when the popover opens. | +| `onClose` | `() => void` | — | Fired when the popover closes. | +| `min` | `Date` | — | Lower bound for the combined date-time. | +| `max` | `Date` | — | Upper bound for the combined date-time. | +| `disabled` | `boolean` | `false` | Disable the input. | +| `readOnly` | `boolean` | `false` | Read-only input. | +| `placeholder` | `string` | — | Placeholder text. | +| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD HH:mm'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD HH:mm'`. | +| `parse` | `(s: string) => Date \| null` | — | Custom parser. | +| `locale` | `string` | — | BCP-47 locale tag. | +| `inline` | `boolean` | `false` | Render the panel inline (no popover). | +| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer devices. | +| `editable` | `boolean` | `true` | Allow segmented keyboard typing (type the date-time directly across all segments). `false` makes the field picker-only. | +| `popover` | `boolean` | `true` | Whether the calendar + time popover exists. `false` makes the field input-only (segmented typing with no popover). Default `true`. | +| `openOnFocus` | `boolean` | `true` | Open the popover on focus. Default `true`. | +| `closeOnSelect` | `boolean` | `false` | Off by default — users typically tweak both halves before committing. | +| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position. | +| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | +| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date, today's date and the selection band. The keyboard focus rings take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset rings, which are plain `primary`. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way. | +| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | +| `isRounded` | `boolean` | `false` | Rounded input corners. | +| `shouldDisableDate` | `(d: Date) => boolean` | — | Disable specific dates. Blocked dates are also rejected during manual typing (the predicate receives the full candidate date-time — prefer day-based checks). | +| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates, matched by calendar day; also rejected by manual typing. | +| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the calendar week starts on. | +| `dayNames` | `string[]` | — | Override the 7 day-name labels. | +| `monthNames` | `string[]` | — | Override the 12 month-name labels. | +| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months. | +| `hourFormat` | `'12'` \| `'24'` | `'24'` | Time format. | +| `enableSeconds` | `boolean` | `false` | Show seconds column. Note: iOS Safari's native datetime-local picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | +| `incrementHours` | `number` | `1` | Hour step. | +| `incrementMinutes` | `number` | `1` | Step between minute-wheel values (`1` = every minute, iOS-style). | +| `incrementSeconds` | `number` | `1` | Step between second-wheel values (only with `enableSeconds`). | +| `unselectableTimes` | `(d: Date) => boolean` | — | Block specific times. Blocked times are also rejected during manual typing. | +| `iconLeftName` | `string` | `'calendar-alt'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | +| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | +| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | +| `audioTick` | `boolean` | `false` | Play a short audible tick on each time-wheel crossing. Default `false`. | +| `haptics` | `boolean` | `false` | Auto-route tactile feedback per wheel tick (vibrate on Android, audio thunk on iOS). Default `false`. | +| `labels` | `PickerLabels` | — | Optional translatable string overrides. | +| `className` | `string` | — | Additional CSS classes. | +| `ref` | `React.Ref` | — | Forwarded to the underlying element. | +| `name` | `string` | — | Form field name. | +| `form` | `string` | — | Optional id of the form the input belongs to. | +| `required` | `boolean` | `false` | Marks the field as required for native HTML form validation. | +| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | @@ -961,6 +961,7 @@ When you pass an explicit token `format`, **that format is the source of truth f | `--bulma-timeinput-wheel-selected-bg` ‡ | `$timeinput-wheel-selected-bg` | `var(--bulma-primary)` | | `--bulma-timeinput-wheel-selected-color` ‡ | `$timeinput-wheel-selected-color` | `var(--bulma-primary-invert)` | | `--bulma-timeinput-wheel-radius` ‡ | `$timeinput-wheel-radius` | `var(--bulma-radius)` | +| `--bulma-timeinput-wheel-focus-ring-color` ‡ | `$timeinput-wheel-focus-ring-color` | `var(--bulma-timeinput-wheel-selected-bg)` | | `--bulma-timeinput-wheel-mask` ‡ | `$timeinput-wheel-mask` | `linear-gradient(180deg, transparent 0, black 18%, black 82%, transparent 100%)` | | `--bulma-timeinput-separator-color` ‡ | `$timeinput-separator-color` | `var(--bulma-text-weak)` | | `--bulma-timeinput-separator-size` ‡ | `$timeinput-separator-size` | `var(--bulma-size-5)` | diff --git a/docs/docs/api/form/datetime/timeinput.md b/docs/docs/api/form/datetime/timeinput.md index 77932d8a4..26faed3bd 100644 --- a/docs/docs/api/form/datetime/timeinput.md +++ b/docs/docs/api/form/datetime/timeinput.md @@ -984,68 +984,68 @@ Combine `incrementMinutes={5}` (or `15`/`30`) with `min` and `max` to build a ti -| Prop | Type | Default | Description | -| ------------------- | -------------------------------------------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | -| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | -| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | -| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | -| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | -| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | -| `iconRightName` | `string` | — | Shortcut for the right icon name. | -| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | -| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | -| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | -| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | -| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | -| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | -| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | -| `message` | `React.ReactNode` | — | Help/validation text below the input. | -| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Color modifier for the help message. | -| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | -| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | -| `value` | `Date` \| `null` | — | Controlled selected time (date portion is preserved). | -| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | -| `onChange` | `(d: Date \| null) => void` | — | Fired when the value changes. | -| `onOpen` | `() => void` | — | Fired when the popover opens. | -| `onClose` | `() => void` | — | Fired when the popover closes. | -| `min` | `Date` | — | Earliest selectable time. | -| `max` | `Date` | — | Latest selectable time. | -| `disabled` | `boolean` | `false` | Disable the input. | -| `readOnly` | `boolean` | `false` | Make the input read-only. | -| `placeholder` | `string` | — | Placeholder text for the input. | -| `format` | `Intl.DateTimeFormatOptions` \| `string` | `(see below)` | Token format string or `Intl.DateTimeFormat` options. | -| `parse` | `(s: string) => Date \| null` | — | Custom parser. | -| `locale` | `string` | — | BCP-47 locale tag for Intl formatting. | -| `inline` | `boolean` | `false` | Render the spinner inline (no popover). | -| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer + small-viewport devices. | -| `editable` | `boolean` | `true` | Allow segmented keyboard typing in the input (type the time directly, auto-advancing across segments). `false` makes the field picker-only. | -| `popover` | `boolean` | `true` | Whether the spinner popover exists. `false` makes the field input-only (segmented typing, no popover). | -| `openOnFocus` | `boolean` | `true` | Open the popover when the input is focused. | -| `closeOnSelect` | `boolean` | `false` | Close the popover after a time is selected (off by default). | -| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position relative to the input. | -| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | -| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the wheels, where it colors the selection band and the keyboard focus ring. Unset, the wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`. | -| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | -| `isRounded` | `boolean` | `false` | Render the input with rounded corners. | -| `hourFormat` | `'12'` \| `'24'` | `'24'` | Hour format. `'12'` shows an AM/PM toggle. | -| `enableSeconds` | `boolean` | `false` | Show a seconds column. Note: iOS Safari's native time picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | -| `incrementHours` | `number` | `1` | Hour step for the spinner. | -| `incrementMinutes` | `number` | `1` | Minute step. Combine with `min`/`max` for slot-style pickers. | -| `incrementSeconds` | `number` | `1` | Second step. Default `1`. | -| `unselectableTimes` | `(d: Date) => boolean` | — | Predicate returning `true` for times that should be skipped. Blocked times are also rejected during manual typing. | -| `iconLeftName` | `string` | `'clock'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | -| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | -| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | -| `labels` | `PickerLabels` | — | Optional translatable string overrides. | -| `audioTick` | `boolean` | `false` | Play a short audible click on each wheel-item crossing. Substitute for haptic feedback on iOS Safari (which has no web haptic API as of May 2026); on Android, `navigator.vibrate(5)` fires automatically regardless. | -| `haptics` | `boolean` | `false` | Auto-route platform-appropriate feedback: vibrate on Android (already happening), audio thunk on iOS (where vibrate is unavailable). One switch instead of platform-sniffing on the consumer side. `audioTick={true}` always wins. | -| `name` | `string` | — | Form field name. | -| `form` | `string` | — | Form id the input belongs to. | -| `required` | `boolean` | `false` | Marks the input as required. | -| `className` | `string` | — | Additional CSS classes for the input. | -| `ref` | `React.Ref` | — | Forwarded to the underlying ``. | -| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | +| Prop | Type | Default | Description | +| ------------------- | -------------------------------------------------------------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | +| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | +| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | +| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | +| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | +| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | +| `iconRightName` | `string` | — | Shortcut for the right icon name. | +| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | +| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | +| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | +| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | +| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | +| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | +| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | +| `message` | `React.ReactNode` | — | Help/validation text below the input. | +| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Color modifier for the help message. | +| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | +| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | +| `value` | `Date` \| `null` | — | Controlled selected time (date portion is preserved). | +| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | +| `onChange` | `(d: Date \| null) => void` | — | Fired when the value changes. | +| `onOpen` | `() => void` | — | Fired when the popover opens. | +| `onClose` | `() => void` | — | Fired when the popover closes. | +| `min` | `Date` | — | Earliest selectable time. | +| `max` | `Date` | — | Latest selectable time. | +| `disabled` | `boolean` | `false` | Disable the input. | +| `readOnly` | `boolean` | `false` | Make the input read-only. | +| `placeholder` | `string` | — | Placeholder text for the input. | +| `format` | `Intl.DateTimeFormatOptions` \| `string` | `(see below)` | Token format string or `Intl.DateTimeFormat` options. | +| `parse` | `(s: string) => Date \| null` | — | Custom parser. | +| `locale` | `string` | — | BCP-47 locale tag for Intl formatting. | +| `inline` | `boolean` | `false` | Render the spinner inline (no popover). | +| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer + small-viewport devices. | +| `editable` | `boolean` | `true` | Allow segmented keyboard typing in the input (type the time directly, auto-advancing across segments). `false` makes the field picker-only. | +| `popover` | `boolean` | `true` | Whether the spinner popover exists. `false` makes the field input-only (segmented typing, no popover). | +| `openOnFocus` | `boolean` | `true` | Open the popover when the input is focused. | +| `closeOnSelect` | `boolean` | `false` | Close the popover after a time is selected (off by default). | +| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position relative to the input. | +| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | +| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the wheels, where it colors the selection band. The keyboard focus ring takes the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset ring, which follows the band. Unset, the wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`. | +| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | +| `isRounded` | `boolean` | `false` | Render the input with rounded corners. | +| `hourFormat` | `'12'` \| `'24'` | `'24'` | Hour format. `'12'` shows an AM/PM toggle. | +| `enableSeconds` | `boolean` | `false` | Show a seconds column. Note: iOS Safari's native time picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | +| `incrementHours` | `number` | `1` | Hour step for the spinner. | +| `incrementMinutes` | `number` | `1` | Minute step. Combine with `min`/`max` for slot-style pickers. | +| `incrementSeconds` | `number` | `1` | Second step. Default `1`. | +| `unselectableTimes` | `(d: Date) => boolean` | — | Predicate returning `true` for times that should be skipped. Blocked times are also rejected during manual typing. | +| `iconLeftName` | `string` | `'clock'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | +| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | +| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | +| `labels` | `PickerLabels` | — | Optional translatable string overrides. | +| `audioTick` | `boolean` | `false` | Play a short audible click on each wheel-item crossing. Substitute for haptic feedback on iOS Safari (which has no web haptic API as of May 2026); on Android, `navigator.vibrate(5)` fires automatically regardless. | +| `haptics` | `boolean` | `false` | Auto-route platform-appropriate feedback: vibrate on Android (already happening), audio thunk on iOS (where vibrate is unavailable). One switch instead of platform-sniffing on the consumer side. `audioTick={true}` always wins. | +| `name` | `string` | — | Form field name. | +| `form` | `string` | — | Form id the input belongs to. | +| `required` | `boolean` | `false` | Marks the input as required. | +| `className` | `string` | — | Additional CSS classes for the input. | +| `ref` | `React.Ref` | — | Forwarded to the underlying ``. | +| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | @@ -1081,6 +1081,7 @@ When you pass an explicit token `format`, **that format is the source of truth f | `--bulma-timeinput-wheel-selected-bg` ‡ | `$timeinput-wheel-selected-bg` | `var(--bulma-primary)` | | `--bulma-timeinput-wheel-selected-color` ‡ | `$timeinput-wheel-selected-color` | `var(--bulma-primary-invert)` | | `--bulma-timeinput-wheel-radius` ‡ | `$timeinput-wheel-radius` | `var(--bulma-radius)` | +| `--bulma-timeinput-wheel-focus-ring-color` ‡ | `$timeinput-wheel-focus-ring-color` | `var(--bulma-timeinput-wheel-selected-bg)` | | `--bulma-timeinput-wheel-mask` ‡ | `$timeinput-wheel-mask` | `linear-gradient(180deg, transparent 0, black 18%, black 82%, transparent 100%)` | | `--bulma-timeinput-separator-color` ‡ | `$timeinput-separator-color` | `var(--bulma-text-weak)` | | `--bulma-timeinput-separator-size` ‡ | `$timeinput-separator-size` | `var(--bulma-size-5)` | diff --git a/skills/bestax-theming/references/css-variables.md b/skills/bestax-theming/references/css-variables.md index 0786d8916..c8e7af141 100644 --- a/skills/bestax-theming/references/css-variables.md +++ b/skills/bestax-theming/references/css-variables.md @@ -381,10 +381,11 @@ Declared on the compound `.button.link-button` — see the compound-selector exc `--bulma-timeinput-footer-padding`, `--bulma-timeinput-separator-color`, `--bulma-timeinput-separator-size`, `--bulma-timeinput-wheel-bg`, `--bulma-timeinput-wheel-color`, `--bulma-timeinput-wheel-dim-color`, -`--bulma-timeinput-wheel-gap`, `--bulma-timeinput-wheel-hover-bg`, -`--bulma-timeinput-wheel-item-height`, `--bulma-timeinput-wheel-mask`, -`--bulma-timeinput-wheel-radius`, `--bulma-timeinput-wheel-selected-bg`, -`--bulma-timeinput-wheel-selected-color`, `--bulma-timeinput-wheel-width` +`--bulma-timeinput-wheel-focus-ring-color`, `--bulma-timeinput-wheel-gap`, +`--bulma-timeinput-wheel-hover-bg`, `--bulma-timeinput-wheel-item-height`, +`--bulma-timeinput-wheel-mask`, `--bulma-timeinput-wheel-radius`, +`--bulma-timeinput-wheel-selected-bg`, `--bulma-timeinput-wheel-selected-color`, +`--bulma-timeinput-wheel-width` `--bulma-timeinput-wheel-item-height` is registered but has no effect: the component sets each wheel item's height inline. From b3eecc63ecb10a909684708c5643a0441196e4ef Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Wed, 30 Sep 2026 12:19:00 -0400 Subject: [PATCH 3/4] fix(bulma-ui): give the selected calendar cell a ring that shows on its fill The ring on a focused selected cell was `scheme-main`, which only contrasted with a `primary` fill. With the fill now following `color`, it fell to 1.73:1 on `info`, 1.75:1 on `warning`, 2.14:1 on `success` and 2.80:1 on `danger`. The year view is worse off, because the focused year is always the selected one, so its ring was always this one. Both selected rings now take `--bulma-dateinput-cell-selected-color`, the selected value's own colour, which Bulma picks to contrast with the fill: at least 4.79:1 for every colour, light and dark. On light this is the same white the default drew before. On dark the default changes from `scheme-main` to that white, which lifts it from 3.16:1 to 5.74:1. Today's date takes the colour's `-on-scheme` variant under `is-`, like the ring, so four of the six colours stop reading at under 3:1 on a light surface. The uncoloured calendar keeps plain `primary`. The wheel hover fill now sits behind `@media (hover: hover)`, so a touch browser that leaves `:hover` on the last item a finger lifted from cannot leave the fill on an item a drag moved off the band. --- bestax-mcp/data/components/DateInput.json | 2 +- bestax-mcp/data/components/DateTimeInput.json | 2 +- bulma-ui/src/form/DateInputBase.tsx | 9 +- bulma-ui/src/form/DateTimeInputBase.tsx | 13 +- .../form/__tests__/DateInput.styles.test.tsx | 58 +++++++- .../form/__tests__/TimeInput.styles.test.tsx | 33 +++++ bulma-ui/src/scss/form/_dateinput.scss | 25 ++-- bulma-ui/src/scss/form/_timeinput.scss | 11 +- docs/docs/api/form/datetime/dateinput.md | 120 ++++++++-------- docs/docs/api/form/datetime/datetimeinput.md | 136 +++++++++--------- 10 files changed, 249 insertions(+), 160 deletions(-) diff --git a/bestax-mcp/data/components/DateInput.json b/bestax-mcp/data/components/DateInput.json index 6a19d3483..4e4a3fd80 100644 --- a/bestax-mcp/data/components/DateInput.json +++ b/bestax-mcp/data/components/DateInput.json @@ -526,7 +526,7 @@ "name": "color", "type": "'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'", "default": null, - "description": "Bulma color modifier for the input, also carried by the calendar, where it colors the selected date and today's date. The keyboard focus ring takes the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset ring, which is plain `primary`. Unset, the calendar uses its `--bulma-dateinput-*` variables, which follow `primary` by default.", + "description": "Bulma color modifier for the input, also carried by the calendar, where it colors the selected date. Today's date and the keyboard focus ring take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay readable; that makes `'primary'` a shade off the unset calendar, which uses plain `primary` for both. Unset, the calendar uses its `--bulma-dateinput-*` variables, which follow `primary` by default.", "required": false, "inherited": true, "deprecated": false diff --git a/bestax-mcp/data/components/DateTimeInput.json b/bestax-mcp/data/components/DateTimeInput.json index 9a66b9633..7a4c79d1c 100644 --- a/bestax-mcp/data/components/DateTimeInput.json +++ b/bestax-mcp/data/components/DateTimeInput.json @@ -534,7 +534,7 @@ "name": "color", "type": "'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'", "default": null, - "description": "Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date, today's date and the selection band. The keyboard focus rings take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset rings, which are plain `primary`. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way.", + "description": "Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date and the selection band. Today's date and the keyboard focus rings take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay readable; that makes `'primary'` a shade off the unset picker, which uses plain `primary` for them. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way.", "required": false, "inherited": true, "deprecated": false diff --git a/bulma-ui/src/form/DateInputBase.tsx b/bulma-ui/src/form/DateInputBase.tsx index 29b5966b3..5a6a212f7 100644 --- a/bulma-ui/src/form/DateInputBase.tsx +++ b/bulma-ui/src/form/DateInputBase.tsx @@ -103,11 +103,12 @@ export interface DateInputBaseProps appendToBody?: boolean; /** * Bulma color modifier for the input, also carried by the calendar, where it - * colors the selected date and today's date. The keyboard focus ring takes + * colors the selected date. Today's date and the keyboard focus ring take * the color's `-on-scheme` variant, which Bulma adjusts to contrast with the - * background, so pale colors stay visible; that makes `'primary'` a shade - * off the unset ring, which is plain `primary`. Unset, the calendar uses its - * `--bulma-dateinput-*` variables, which follow `primary` by default. + * background, so pale colors stay readable; that makes `'primary'` a shade + * off the unset calendar, which uses plain `primary` for both. Unset, the + * calendar uses its `--bulma-dateinput-*` variables, which follow `primary` + * by default. */ color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'; /** Size variant. */ diff --git a/bulma-ui/src/form/DateTimeInputBase.tsx b/bulma-ui/src/form/DateTimeInputBase.tsx index 3924110cf..e5f066429 100644 --- a/bulma-ui/src/form/DateTimeInputBase.tsx +++ b/bulma-ui/src/form/DateTimeInputBase.tsx @@ -135,13 +135,14 @@ export interface DateTimeInputBaseProps appendToBody?: boolean; /** * Bulma color modifier for the input, also carried by the calendar and the - * time wheels, where it colors the selected date, today's date and the - * selection band. The keyboard focus rings take the color's `-on-scheme` + * time wheels, where it colors the selected date and the selection band. + * Today's date and the keyboard focus rings take the color's `-on-scheme` * variant, which Bulma adjusts to contrast with the background, so pale - * colors stay visible; that makes `'primary'` a shade off the unset rings, - * which are plain `primary`. Unset, they use their `--bulma-dateinput-*` and - * `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. - * The footer's time pill and Done button stay `primary` either way. + * colors stay readable; that makes `'primary'` a shade off the unset picker, + * which uses plain `primary` for them. Unset, they use their + * `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which + * follow `primary` by default. The footer's time pill and Done button stay + * `primary` either way. */ color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'; /** Size variant. */ diff --git a/bulma-ui/src/form/__tests__/DateInput.styles.test.tsx b/bulma-ui/src/form/__tests__/DateInput.styles.test.tsx index d610f3c23..20d1e8b67 100644 --- a/bulma-ui/src/form/__tests__/DateInput.styles.test.tsx +++ b/bulma-ui/src/form/__tests__/DateInput.styles.test.tsx @@ -32,21 +32,23 @@ const colors = [ type Color = (typeof colors)[number]; /** - * The variables a colour re-points, and what each should read for it. The - * ring takes the `-on-scheme` variant, which Bulma adjusts until it contrasts - * with `scheme-main`: plain `warning` or `success` is too faint for a focus - * indicator on a light surface. + * The variables a colour re-points, and what each should read for it. Today's + * tint and the ring sit on the calendar's surface, so they take the + * `-on-scheme` variant, which Bulma adjusts until it contrasts with + * `scheme-main`: plain `warning` or `info` is too faint there on a light + * surface. */ const accents = (color: string) => ({ '--bulma-dateinput-cell-selected-bg': `var(--bulma-${color})`, '--bulma-dateinput-cell-selected-color': `var(--bulma-${color}-invert)`, - '--bulma-dateinput-cell-today-color': `var(--bulma-${color})`, + '--bulma-dateinput-cell-today-color': `var(--bulma-${color}-on-scheme)`, '--bulma-dateinput-focus-ring-color': `var(--bulma-${color}-on-scheme)`, }); -/** What an uncoloured calendar reads: `primary` throughout, ring included. */ +/** What an uncoloured calendar reads: plain `primary` for today and the ring. */ const defaults = { ...accents('primary'), + '--bulma-dateinput-cell-today-color': 'var(--bulma-primary)', '--bulma-dateinput-focus-ring-color': 'var(--bulma-primary)', }; @@ -140,6 +142,50 @@ function setProperties(rules: CSSRuleList): string[] { return [...names]; } +/** Every top-level style rule whose selector is a keyboard focus state. */ +function focusRules(rules: CSSRuleList): CSSStyleRule[] { + return Array.from(rules).filter( + (rule): rule is CSSStyleRule => + rule instanceof CSSStyleRule && + rule.selectorText.includes(':focus-visible') + ); +} + +/** The colour a rule gives its outline, from the longhand or the shorthand. */ +const ringOf = (rule: CSSStyleRule) => + rule.style.getPropertyValue('outline-color') || + rule.style.getPropertyValue('outline'); + +describe('calendar focus rings', () => { + it('reads a calendar variable for every ring', () => { + // A ring that names a colour itself, `scheme-main` included, stays that + // colour whatever `color` does to the surface or the fill under it. + const rules = focusRules(sheet.cssRules); + expect(rules.length).toBeGreaterThan(0); + for (const rule of rules) { + expect([rule.selectorText, ringOf(rule)]).toEqual([ + rule.selectorText, + expect.stringMatching(/var\(--bulma-dateinput-/), + ]); + } + }); + + it.each(['dateinput-cell', 'dateinput-year-cell'])( + 'gives a selected %s the selected value colour for its ring', + cls => { + // That ring is inset into the selection fill, which follows `color`, + // and the selected value's colour is the one chosen to contrast with + // it. The focused year is always the selected one. + const rule = focusRules(sheet.cssRules).find( + r => r.selectorText === `.${cls}.is-selected:focus-visible` + ); + expect(rule && ringOf(rule)).toBe( + 'var(--bulma-dateinput-cell-selected-color)' + ); + } + ); +}); + describe('calendar variables', () => { it('registers only variables that some rule reads', () => { const set = setProperties(sheet.cssRules); diff --git a/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx b/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx index 160ac2cce..255a34500 100644 --- a/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx +++ b/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx @@ -152,6 +152,39 @@ describe('TimeInput variables', () => { }); }); +/** Where each rule that paints the hover fill sits: a media query, or none. */ +function hoverFillContexts(rules: CSSRuleList, media = ''): string[] { + const found: string[] = []; + for (const rule of Array.from(rules)) { + if (rule instanceof CSSMediaRule) { + found.push(...hoverFillContexts(rule.cssRules, rule.media.mediaText)); + } else if (rule instanceof CSSStyleRule) { + for (let i = 0; i < rule.style.length; i++) { + const name = rule.style[i]; + if (name.startsWith('--')) continue; + if ( + rule.style + .getPropertyValue(name) + .includes('var(--bulma-timeinput-wheel-hover-bg)') + ) { + found.push(media || '(top level)'); + } + } + } + } + return found; +} + +describe('TimeInput hover fill', () => { + // A touch browser can leave `:hover` on the last item a finger lifted from, + // and a drag leaves that item off the band, so an ungated fill sticks there. + it('fills a hovered item only where the pointer can hover', () => { + expect( + hoverFillContexts((styleEl.sheet as CSSStyleSheet).cssRules) + ).toEqual(['(hover: hover)']); + }); +}); + describe('TimeInput mobile overrides', () => { // The small-viewport block adjusts the wheels and the popover by setting // custom properties. Setting one that no rule reads changes nothing, so diff --git a/bulma-ui/src/scss/form/_dateinput.scss b/bulma-ui/src/scss/form/_dateinput.scss index e4a6d86d6..779afb763 100644 --- a/bulma-ui/src/scss/form/_dateinput.scss +++ b/bulma-ui/src/scss/form/_dateinput.scss @@ -201,10 +201,11 @@ $dateinput-nav-button-size: 1.75rem !default; background-color: cv.getVar('dateinput-cell-selected-bg'); color: cv.getVar('dateinput-cell-selected-color'); } - // When focus lands on the selected cell, swap the ring to scheme-main so - // it stays visible against the selection fill. + // On the selected cell the inset ring sits on the selection fill, so it + // takes the selected value's colour, which is chosen to contrast with that + // fill whatever colour it is. &.#{iv.$class-prefix}is-selected:focus-visible { - outline-color: cv.getVar('scheme-main'); + outline-color: cv.getVar('dateinput-cell-selected-color'); } &.#{iv.$class-prefix}is-other-month { color: cv.getVar('dateinput-cell-other-month-color'); @@ -263,8 +264,10 @@ $dateinput-nav-button-size: 1.75rem !default; background-color: cv.getVar('dateinput-cell-selected-bg'); color: cv.getVar('dateinput-cell-selected-color'); } + // The focused year is always the selected one, so this is the ring a + // keyboard user sees in the year view; it contrasts with the fill as above. &.#{iv.$class-prefix}is-selected:focus-visible { - outline-color: cv.getVar('scheme-main'); + outline-color: cv.getVar('dateinput-cell-selected-color'); } &:disabled { color: cv.getVar('dateinput-cell-disabled-color'); @@ -275,19 +278,19 @@ $dateinput-nav-button-size: 1.75rem !default; // Colour variants. `color` lands on the calendar root as `is-`, and // the root re-points its accent variables at that colour: the selection fill -// paired with its `-invert` for the selected value, and today's tint. The -// focus ring takes the colour's `-on-scheme` variant instead, which Bulma -// darkens or lightens until it contrasts with `scheme-main`, since a ring in -// plain `warning` or `success` is too faint to see on a light surface. Every -// rule that paints an accent reads one of these, so they follow without rules -// of their own. +// paired with its `-invert` for the selected value. Today's tint and the focus +// ring sit on the calendar's surface rather than on a fill, so they take the +// colour's `-on-scheme` variant, which Bulma darkens or lightens until it +// contrasts with `scheme-main`; plain `warning` or `info` text on a light +// surface is too faint to read. Every rule that paints an accent reads one of +// these, so they follow without rules of their own. @each $name in 'primary', 'link', 'info', 'success', 'warning', 'danger' { .#{iv.$class-prefix}dateinput.#{iv.$class-prefix}is-#{$name} { @include cv.register-vars( ( 'dateinput-cell-selected-bg': #{cv.getVar($name)}, 'dateinput-cell-selected-color': #{cv.getVar('#{$name}-invert')}, - 'dateinput-cell-today-color': #{cv.getVar($name)}, + 'dateinput-cell-today-color': #{cv.getVar('#{$name}-on-scheme')}, 'dateinput-focus-ring-color': #{cv.getVar('#{$name}-on-scheme')}, ) ); diff --git a/bulma-ui/src/scss/form/_timeinput.scss b/bulma-ui/src/scss/form/_timeinput.scss index 49130b033..d5b97cafe 100644 --- a/bulma-ui/src/scss/form/_timeinput.scss +++ b/bulma-ui/src/scss/form/_timeinput.scss @@ -162,11 +162,16 @@ $timeinput-footer-padding: 0.5rem 0 0 !default; color 0.1s ease, font-weight 0.1s ease; - // The fill is not in the transition list above, so it snaps on and off the - // way the calendar cells' hover does. &:hover:not(:disabled):not(.#{iv.$class-prefix}is-selected) { color: cv.getVar('timeinput-wheel-color'); - background-color: cv.getVar('timeinput-wheel-hover-bg'); + + // Only where the pointer can hover: a touch browser can leave `:hover` on + // the last item a finger lifted from, and a drag leaves that item off the + // band, where the fill would stick. The fill is not in the transition list + // above, so it snaps on and off the way the calendar cells' hover does. + @media (hover: hover) { + background-color: cv.getVar('timeinput-wheel-hover-bg'); + } } // The selected item (whichever is currently centred over the band) is diff --git a/docs/docs/api/form/datetime/dateinput.md b/docs/docs/api/form/datetime/dateinput.md index b7e348a94..e2d27f963 100644 --- a/docs/docs/api/form/datetime/dateinput.md +++ b/docs/docs/api/form/datetime/dateinput.md @@ -856,66 +856,66 @@ Use `inline` instead of the popover when you have vertical room to spare — boo -| Prop | Type | Default | Description | -| ------------------- | -------------------------------------------------------------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `label` | `React.ReactNode` | — | Field label (component auto-wraps in a `Field` if not already inside). Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | -| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | -| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | -| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | -| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | -| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | -| `iconRightName` | `string` | — | Shortcut for the right icon name. | -| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | -| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | -| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | -| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | -| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | -| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | -| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | -| `message` | `React.ReactNode` | — | Help/validation text below the input. | -| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Color modifier for the help message. | -| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | -| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | -| `value` | `Date` \| `null` | — | Controlled selected date. | -| `defaultValue` | `Date` \| `null` | — | Initial date for uncontrolled usage. | -| `onChange` | `(d: Date \| null) => void` | — | Fired when the value changes. | -| `onOpen` | `() => void` | — | Fired when the popover opens. | -| `onClose` | `() => void` | — | Fired when the popover closes. | -| `min` | `Date` | — | Earliest selectable date. | -| `max` | `Date` | — | Latest selectable date. | -| `disabled` | `boolean` | `false` | Disable the input. | -| `readOnly` | `boolean` | `false` | Make the input read-only. | -| `placeholder` | `string` | — | Placeholder text for the input. | -| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD'`. | -| `parse` | `(s: string) => Date \| null` | — | Custom parser (use when `format` is `Intl.DateTimeFormatOptions`). | -| `locale` | `string` | — | BCP-47 locale tag for day/month names and Intl formatting. | -| `inline` | `boolean` | `false` | Render the calendar inline (no popover). | -| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer + small-viewport devices. | -| `editable` | `boolean` | `true` | Allow segmented keyboard typing in the input (type the date directly, auto-advancing across segments). `false` makes the field picker-only. | -| `popover` | `boolean` | `true` | Whether the calendar popover exists. `false` makes the field input-only (segmented typing, no popover). | -| `openOnFocus` | `boolean` | `true` | Open the popover when the input is focused. | -| `closeOnSelect` | `boolean` | `true` | Close the popover after a date is selected. | -| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position relative to the input. | -| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | -| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar, where it colors the selected date and today's date. The keyboard focus ring takes the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset ring, which is plain `primary`. Unset, the calendar uses its `--bulma-dateinput-*` variables, which follow `primary` by default. | -| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | -| `isRounded` | `boolean` | `false` | Render the input with rounded corners. | -| `shouldDisableDate` | `(d: Date) => boolean` | — | Predicate to disable specific dates (e.g. weekends). Blocked dates are also rejected during manual typing. | -| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates; merged with `shouldDisableDate`. Matched by calendar day and also rejected during manual typing. | -| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the week starts on (0 = Sunday). | -| `dayNames` | `string[]` | — | Override the 7 day-name labels (in calendar order, post-rotation). | -| `monthNames` | `string[]` | — | Override the 12 month-name labels. | -| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months in the grid. | -| `iconLeftName` | `string` | `'calendar'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | -| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | -| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | -| `labels` | `PickerLabels` | — | Optional translatable string overrides (ARIA labels, button text). | -| `name` | `string` | — | Form field name. Forwarded to a hidden ISO-formatted input. | -| `form` | `string` | — | Form id the input belongs to. | -| `required` | `boolean` | `false` | Marks the input as required. | -| `className` | `string` | — | Additional CSS classes for the input. | -| `ref` | `React.Ref` | — | Forwarded to the underlying ``. | -| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | +| Prop | Type | Default | Description | +| ------------------- | -------------------------------------------------------------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `label` | `React.ReactNode` | — | Field label (component auto-wraps in a `Field` if not already inside). Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | +| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | +| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | +| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | +| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | +| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | +| `iconRightName` | `string` | — | Shortcut for the right icon name. | +| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | +| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | +| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | +| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | +| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | +| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | +| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | +| `message` | `React.ReactNode` | — | Help/validation text below the input. | +| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Color modifier for the help message. | +| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | +| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | +| `value` | `Date` \| `null` | — | Controlled selected date. | +| `defaultValue` | `Date` \| `null` | — | Initial date for uncontrolled usage. | +| `onChange` | `(d: Date \| null) => void` | — | Fired when the value changes. | +| `onOpen` | `() => void` | — | Fired when the popover opens. | +| `onClose` | `() => void` | — | Fired when the popover closes. | +| `min` | `Date` | — | Earliest selectable date. | +| `max` | `Date` | — | Latest selectable date. | +| `disabled` | `boolean` | `false` | Disable the input. | +| `readOnly` | `boolean` | `false` | Make the input read-only. | +| `placeholder` | `string` | — | Placeholder text for the input. | +| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD'`. | +| `parse` | `(s: string) => Date \| null` | — | Custom parser (use when `format` is `Intl.DateTimeFormatOptions`). | +| `locale` | `string` | — | BCP-47 locale tag for day/month names and Intl formatting. | +| `inline` | `boolean` | `false` | Render the calendar inline (no popover). | +| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer + small-viewport devices. | +| `editable` | `boolean` | `true` | Allow segmented keyboard typing in the input (type the date directly, auto-advancing across segments). `false` makes the field picker-only. | +| `popover` | `boolean` | `true` | Whether the calendar popover exists. `false` makes the field input-only (segmented typing, no popover). | +| `openOnFocus` | `boolean` | `true` | Open the popover when the input is focused. | +| `closeOnSelect` | `boolean` | `true` | Close the popover after a date is selected. | +| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position relative to the input. | +| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | +| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar, where it colors the selected date. Today's date and the keyboard focus ring take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay readable; that makes `'primary'` a shade off the unset calendar, which uses plain `primary` for both. Unset, the calendar uses its `--bulma-dateinput-*` variables, which follow `primary` by default. | +| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | +| `isRounded` | `boolean` | `false` | Render the input with rounded corners. | +| `shouldDisableDate` | `(d: Date) => boolean` | — | Predicate to disable specific dates (e.g. weekends). Blocked dates are also rejected during manual typing. | +| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates; merged with `shouldDisableDate`. Matched by calendar day and also rejected during manual typing. | +| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the week starts on (0 = Sunday). | +| `dayNames` | `string[]` | — | Override the 7 day-name labels (in calendar order, post-rotation). | +| `monthNames` | `string[]` | — | Override the 12 month-name labels. | +| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months in the grid. | +| `iconLeftName` | `string` | `'calendar'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | +| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | +| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | +| `labels` | `PickerLabels` | — | Optional translatable string overrides (ARIA labels, button text). | +| `name` | `string` | — | Form field name. Forwarded to a hidden ISO-formatted input. | +| `form` | `string` | — | Form id the input belongs to. | +| `required` | `boolean` | `false` | Marks the input as required. | +| `className` | `string` | — | Additional CSS classes for the input. | +| `ref` | `React.Ref` | — | Forwarded to the underlying ``. | +| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | diff --git a/docs/docs/api/form/datetime/datetimeinput.md b/docs/docs/api/form/datetime/datetimeinput.md index 7ac37599a..655934493 100644 --- a/docs/docs/api/form/datetime/datetimeinput.md +++ b/docs/docs/api/form/datetime/datetimeinput.md @@ -837,74 +837,74 @@ The DateTimeInput prop set is the union of [DateInput](./dateinput.md) and [Time -| Prop | Type | Default | Description | -| ------------------- | -------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | -| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | -| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | -| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | -| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | -| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | -| `iconRightName` | `string` | — | Shortcut for the right icon name. | -| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | -| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | -| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | -| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | -| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | -| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | -| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | -| `message` | `React.ReactNode` | — | Help/validation text below the input. | -| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Message color. | -| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | -| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | -| `value` | `Date` \| `null` | — | Controlled selected date-time. | -| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | -| `onChange` | `(d: Date \| null) => void` | — | Fired when either the date or time portion changes. | -| `onOpen` | `() => void` | — | Fired when the popover opens. | -| `onClose` | `() => void` | — | Fired when the popover closes. | -| `min` | `Date` | — | Lower bound for the combined date-time. | -| `max` | `Date` | — | Upper bound for the combined date-time. | -| `disabled` | `boolean` | `false` | Disable the input. | -| `readOnly` | `boolean` | `false` | Read-only input. | -| `placeholder` | `string` | — | Placeholder text. | -| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD HH:mm'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD HH:mm'`. | -| `parse` | `(s: string) => Date \| null` | — | Custom parser. | -| `locale` | `string` | — | BCP-47 locale tag. | -| `inline` | `boolean` | `false` | Render the panel inline (no popover). | -| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer devices. | -| `editable` | `boolean` | `true` | Allow segmented keyboard typing (type the date-time directly across all segments). `false` makes the field picker-only. | -| `popover` | `boolean` | `true` | Whether the calendar + time popover exists. `false` makes the field input-only (segmented typing with no popover). Default `true`. | -| `openOnFocus` | `boolean` | `true` | Open the popover on focus. Default `true`. | -| `closeOnSelect` | `boolean` | `false` | Off by default — users typically tweak both halves before committing. | -| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position. | -| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | -| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date, today's date and the selection band. The keyboard focus rings take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset rings, which are plain `primary`. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way. | -| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | -| `isRounded` | `boolean` | `false` | Rounded input corners. | -| `shouldDisableDate` | `(d: Date) => boolean` | — | Disable specific dates. Blocked dates are also rejected during manual typing (the predicate receives the full candidate date-time — prefer day-based checks). | -| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates, matched by calendar day; also rejected by manual typing. | -| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the calendar week starts on. | -| `dayNames` | `string[]` | — | Override the 7 day-name labels. | -| `monthNames` | `string[]` | — | Override the 12 month-name labels. | -| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months. | -| `hourFormat` | `'12'` \| `'24'` | `'24'` | Time format. | -| `enableSeconds` | `boolean` | `false` | Show seconds column. Note: iOS Safari's native datetime-local picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | -| `incrementHours` | `number` | `1` | Hour step. | -| `incrementMinutes` | `number` | `1` | Step between minute-wheel values (`1` = every minute, iOS-style). | -| `incrementSeconds` | `number` | `1` | Step between second-wheel values (only with `enableSeconds`). | -| `unselectableTimes` | `(d: Date) => boolean` | — | Block specific times. Blocked times are also rejected during manual typing. | -| `iconLeftName` | `string` | `'calendar-alt'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | -| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | -| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | -| `audioTick` | `boolean` | `false` | Play a short audible tick on each time-wheel crossing. Default `false`. | -| `haptics` | `boolean` | `false` | Auto-route tactile feedback per wheel tick (vibrate on Android, audio thunk on iOS). Default `false`. | -| `labels` | `PickerLabels` | — | Optional translatable string overrides. | -| `className` | `string` | — | Additional CSS classes. | -| `ref` | `React.Ref` | — | Forwarded to the underlying element. | -| `name` | `string` | — | Form field name. | -| `form` | `string` | — | Optional id of the form the input belongs to. | -| `required` | `boolean` | `false` | Marks the field as required for native HTML form validation. | -| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | +| Prop | Type | Default | Description | +| ------------------- | -------------------------------------------------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | +| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | +| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | +| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | +| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | +| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | +| `iconRightName` | `string` | — | Shortcut for the right icon name. | +| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | +| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | +| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | +| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | +| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | +| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | +| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | +| `message` | `React.ReactNode` | — | Help/validation text below the input. | +| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Message color. | +| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | +| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | +| `value` | `Date` \| `null` | — | Controlled selected date-time. | +| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | +| `onChange` | `(d: Date \| null) => void` | — | Fired when either the date or time portion changes. | +| `onOpen` | `() => void` | — | Fired when the popover opens. | +| `onClose` | `() => void` | — | Fired when the popover closes. | +| `min` | `Date` | — | Lower bound for the combined date-time. | +| `max` | `Date` | — | Upper bound for the combined date-time. | +| `disabled` | `boolean` | `false` | Disable the input. | +| `readOnly` | `boolean` | `false` | Read-only input. | +| `placeholder` | `string` | — | Placeholder text. | +| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD HH:mm'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD HH:mm'`. | +| `parse` | `(s: string) => Date \| null` | — | Custom parser. | +| `locale` | `string` | — | BCP-47 locale tag. | +| `inline` | `boolean` | `false` | Render the panel inline (no popover). | +| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer devices. | +| `editable` | `boolean` | `true` | Allow segmented keyboard typing (type the date-time directly across all segments). `false` makes the field picker-only. | +| `popover` | `boolean` | `true` | Whether the calendar + time popover exists. `false` makes the field input-only (segmented typing with no popover). Default `true`. | +| `openOnFocus` | `boolean` | `true` | Open the popover on focus. Default `true`. | +| `closeOnSelect` | `boolean` | `false` | Off by default — users typically tweak both halves before committing. | +| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position. | +| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | +| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date and the selection band. Today's date and the keyboard focus rings take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay readable; that makes `'primary'` a shade off the unset picker, which uses plain `primary` for them. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way. | +| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | +| `isRounded` | `boolean` | `false` | Rounded input corners. | +| `shouldDisableDate` | `(d: Date) => boolean` | — | Disable specific dates. Blocked dates are also rejected during manual typing (the predicate receives the full candidate date-time — prefer day-based checks). | +| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates, matched by calendar day; also rejected by manual typing. | +| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the calendar week starts on. | +| `dayNames` | `string[]` | — | Override the 7 day-name labels. | +| `monthNames` | `string[]` | — | Override the 12 month-name labels. | +| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months. | +| `hourFormat` | `'12'` \| `'24'` | `'24'` | Time format. | +| `enableSeconds` | `boolean` | `false` | Show seconds column. Note: iOS Safari's native datetime-local picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | +| `incrementHours` | `number` | `1` | Hour step. | +| `incrementMinutes` | `number` | `1` | Step between minute-wheel values (`1` = every minute, iOS-style). | +| `incrementSeconds` | `number` | `1` | Step between second-wheel values (only with `enableSeconds`). | +| `unselectableTimes` | `(d: Date) => boolean` | — | Block specific times. Blocked times are also rejected during manual typing. | +| `iconLeftName` | `string` | `'calendar-alt'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | +| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | +| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | +| `audioTick` | `boolean` | `false` | Play a short audible tick on each time-wheel crossing. Default `false`. | +| `haptics` | `boolean` | `false` | Auto-route tactile feedback per wheel tick (vibrate on Android, audio thunk on iOS). Default `false`. | +| `labels` | `PickerLabels` | — | Optional translatable string overrides. | +| `className` | `string` | — | Additional CSS classes. | +| `ref` | `React.Ref` | — | Forwarded to the underlying element. | +| `name` | `string` | — | Form field name. | +| `form` | `string` | — | Optional id of the form the input belongs to. | +| `required` | `boolean` | `false` | Marks the field as required for native HTML form validation. | +| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | From e1d8c9fdcb6397cb9b6c1ca0fe99223e87cf50f1 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Wed, 30 Sep 2026 12:22:17 -0400 Subject: [PATCH 4/4] fix(bulma-ui): draw the time wheel focus ring where the wheel's mask shows it The wheel's keyboard focus ring was an outline on the wheel itself, offset outside its border box. The wheel also carries a `mask-image` for its fade, and the mask clips everything outside the border box, so the ring never painted, in any color or none. It predates #832; the colour work only made the missing ring's colour correct. Keyboard users had the band alone to tell which wheel had focus, and every wheel has a band. Draw the ring inset on the band of the focused wheel instead, where the mask is fully opaque. It sits on the selection fill, so it takes the selected value's colour (`--bulma-timeinput-wheel-selected-color`, the fill's `-invert`), the way the calendar's selected cell now does: at least 4.79:1 against the band for every colour, light and dark. The band is stationary, so the ring does not slide with the values. This drops `--bulma-timeinput-wheel-focus-ring-color` from earlier in this branch, which no longer has anything to colour. It was never released. --- bestax-mcp/data/catalog.json | 1 - bestax-mcp/data/components/DateTimeInput.json | 8 +- bestax-mcp/data/components/TimeInput.json | 8 +- bestax-mcp/data/skills.json | 2 +- bulma-ui/src/form/DateTimeInputBase.tsx | 10 +- bulma-ui/src/form/TimeInput.stories.tsx | 2 +- bulma-ui/src/form/TimeInputBase.tsx | 7 +- .../form/__tests__/TimeInput.styles.test.tsx | 64 +++++--- bulma-ui/src/scss/form/_timeinput.scss | 24 ++- docs/docs/api/form/datetime/datetimeinput.md | 139 +++++++++--------- docs/docs/api/form/datetime/timeinput.md | 125 ++++++++-------- .../references/css-variables.md | 9 +- 12 files changed, 201 insertions(+), 198 deletions(-) diff --git a/bestax-mcp/data/catalog.json b/bestax-mcp/data/catalog.json index 2f991f830..dea54b6f8 100644 --- a/bestax-mcp/data/catalog.json +++ b/bestax-mcp/data/catalog.json @@ -1891,7 +1891,6 @@ "--bulma-timeinput-wheel-bg": "TimeInput", "--bulma-timeinput-wheel-color": "TimeInput", "--bulma-timeinput-wheel-dim-color": "TimeInput", - "--bulma-timeinput-wheel-focus-ring-color": "TimeInput", "--bulma-timeinput-wheel-gap": "TimeInput", "--bulma-timeinput-wheel-hover-bg": "TimeInput", "--bulma-timeinput-wheel-item-height": "TimeInput", diff --git a/bestax-mcp/data/components/DateTimeInput.json b/bestax-mcp/data/components/DateTimeInput.json index 7a4c79d1c..e1fce98eb 100644 --- a/bestax-mcp/data/components/DateTimeInput.json +++ b/bestax-mcp/data/components/DateTimeInput.json @@ -534,7 +534,7 @@ "name": "color", "type": "'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'", "default": null, - "description": "Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date and the selection band. Today's date and the keyboard focus rings take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay readable; that makes `'primary'` a shade off the unset picker, which uses plain `primary` for them. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way.", + "description": "Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date and the selection band. Today's date and the calendar's keyboard focus ring take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay readable; that makes `'primary'` a shade off the unset calendar, which uses plain `primary` for them. A focused wheel's ring is drawn inside the band in the color's `-invert`, like the selected value, so it shows on the fill. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way.", "required": false, "inherited": true, "deprecated": false @@ -1018,12 +1018,6 @@ "default": "var(--bulma-radius)", "scope": "element" }, - { - "css": "--bulma-timeinput-wheel-focus-ring-color", - "sass": "$timeinput-wheel-focus-ring-color", - "default": "var(--bulma-timeinput-wheel-selected-bg)", - "scope": "element" - }, { "css": "--bulma-timeinput-wheel-mask", "sass": "$timeinput-wheel-mask", diff --git a/bestax-mcp/data/components/TimeInput.json b/bestax-mcp/data/components/TimeInput.json index b0605e647..bd66626af 100644 --- a/bestax-mcp/data/components/TimeInput.json +++ b/bestax-mcp/data/components/TimeInput.json @@ -542,7 +542,7 @@ "name": "color", "type": "'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'", "default": null, - "description": "Bulma color modifier for the input, also carried by the wheels, where it colors the selection band. The keyboard focus ring takes the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset ring, which follows the band. Unset, the wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`.", + "description": "Bulma color modifier for the input, also carried by the wheels, where it colors the selection band. A focused wheel's keyboard focus ring is drawn inside the band in the color's `-invert`, like the selected value, so it shows on the fill. Unset, the wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`.", "required": false, "inherited": true, "deprecated": false @@ -834,12 +834,6 @@ "default": "var(--bulma-radius)", "scope": "element" }, - { - "css": "--bulma-timeinput-wheel-focus-ring-color", - "sass": "$timeinput-wheel-focus-ring-color", - "default": "var(--bulma-timeinput-wheel-selected-bg)", - "scope": "element" - }, { "css": "--bulma-timeinput-wheel-mask", "sass": "$timeinput-wheel-mask", diff --git a/bestax-mcp/data/skills.json b/bestax-mcp/data/skills.json index 65c6820e8..404075045 100644 --- a/bestax-mcp/data/skills.json +++ b/bestax-mcp/data/skills.json @@ -176,7 +176,7 @@ { "id": "css-variables", "file": "references/css-variables.md", - "bytes": 27105 + "bytes": 27061 }, { "id": "themeable-components", diff --git a/bulma-ui/src/form/DateTimeInputBase.tsx b/bulma-ui/src/form/DateTimeInputBase.tsx index e5f066429..f7b762914 100644 --- a/bulma-ui/src/form/DateTimeInputBase.tsx +++ b/bulma-ui/src/form/DateTimeInputBase.tsx @@ -136,10 +136,12 @@ export interface DateTimeInputBaseProps /** * Bulma color modifier for the input, also carried by the calendar and the * time wheels, where it colors the selected date and the selection band. - * Today's date and the keyboard focus rings take the color's `-on-scheme` - * variant, which Bulma adjusts to contrast with the background, so pale - * colors stay readable; that makes `'primary'` a shade off the unset picker, - * which uses plain `primary` for them. Unset, they use their + * Today's date and the calendar's keyboard focus ring take the color's + * `-on-scheme` variant, which Bulma adjusts to contrast with the background, + * so pale colors stay readable; that makes `'primary'` a shade off the unset + * calendar, which uses plain `primary` for them. A focused wheel's ring is + * drawn inside the band in the color's `-invert`, like the selected value, + * so it shows on the fill. Unset, they use their * `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which * follow `primary` by default. The footer's time pill and Done button stay * `primary` either way. diff --git a/bulma-ui/src/form/TimeInput.stories.tsx b/bulma-ui/src/form/TimeInput.stories.tsx index 9d6d91805..6051dc0b3 100644 --- a/bulma-ui/src/form/TimeInput.stories.tsx +++ b/bulma-ui/src/form/TimeInput.stories.tsx @@ -661,7 +661,7 @@ export const InlineColors: Story = { docs: { description: { story: - 'Rendered inline so the wheels are visible without opening the popover: `color` tints the selection band and, for keyboard users, the focus ring. Tab into a wheel to see the ring.', + 'Rendered inline so the wheels are visible without opening the popover: `color` tints the selection band. Tab into a wheel to see its focus ring, drawn inside the band.', }, }, }, diff --git a/bulma-ui/src/form/TimeInputBase.tsx b/bulma-ui/src/form/TimeInputBase.tsx index 96413db54..f44af2648 100644 --- a/bulma-ui/src/form/TimeInputBase.tsx +++ b/bulma-ui/src/form/TimeInputBase.tsx @@ -125,10 +125,9 @@ export interface TimeInputBaseProps appendToBody?: boolean; /** * Bulma color modifier for the input, also carried by the wheels, where it - * colors the selection band. The keyboard focus ring takes the color's - * `-on-scheme` variant, which Bulma adjusts to contrast with the background, - * so pale colors stay visible; that makes `'primary'` a shade off the unset - * ring, which follows the band. Unset, the wheels use + * colors the selection band. A focused wheel's keyboard focus ring is drawn + * inside the band in the color's `-invert`, like the selected value, so it + * shows on the fill. Unset, the wheels use * `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`. */ color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger'; diff --git a/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx b/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx index 255a34500..05f2a8a4c 100644 --- a/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx +++ b/bulma-ui/src/form/__tests__/TimeInput.styles.test.tsx @@ -52,38 +52,58 @@ describe('TimeInput wheel colour styles', () => { .getPropertyValue('--bulma-timeinput-wheel-selected-color') .trim() ).toBe(`var(--bulma-${color}-invert)`); - // The ring takes the contrast-adjusted variant: plain `warning` or - // `success` is too faint for a focus indicator on a light surface. - expect( - style - .getPropertyValue('--bulma-timeinput-wheel-focus-ring-color') - .trim() - ).toBe(`var(--bulma-${color}-on-scheme)`); } } ); it('leaves an uncoloured wheel on the inherited default', () => { - const { container, getAllByRole } = render(); + const { getAllByRole } = render(); for (const wheel of getAllByRole('spinbutton')) { - const style = getComputedStyle(wheel); expect( - style.getPropertyValue('--bulma-timeinput-wheel-selected-bg').trim() - ).toBe(''); - expect( - style - .getPropertyValue('--bulma-timeinput-wheel-focus-ring-color') + getComputedStyle(wheel) + .getPropertyValue('--bulma-timeinput-wheel-selected-bg') .trim() ).toBe(''); } - // Where the default lives, the ring follows the band. - const root = container.querySelector('.timeinput'); - expect(root).not.toBeNull(); - expect( - getComputedStyle(root as HTMLElement) - .getPropertyValue('--bulma-timeinput-wheel-focus-ring-color') - .trim() - ).toBe('var(--bulma-timeinput-wheel-selected-bg)'); + }); +}); + +/** Every top-level style rule whose selector is a keyboard focus state. */ +function focusRules(sheet: CSSStyleSheet): CSSStyleRule[] { + return Array.from(sheet.cssRules).filter( + (rule): rule is CSSStyleRule => + rule instanceof CSSStyleRule && + rule.selectorText.includes(':focus-visible') + ); +} + +describe('TimeInput focus ring', () => { + // The wheel carries a mask, and the mask clips everything outside the + // wheel's border box, so an outline on the wheel itself (which sits outside + // it) never paints. The ring goes inset on the band, which the mask leaves + // whole. + it('puts no ring on the masked wheel itself', () => { + const own = focusRules(styleEl.sheet as CSSStyleSheet).filter( + r => r.selectorText === '.timeinput-wheel:focus-visible' + ); + for (const rule of own) { + expect(rule.style.getPropertyValue('outline')).toBe(''); + expect(rule.style.getPropertyValue('outline-style')).toBe(''); + } + }); + + it('draws it inset on the band in the selected value colour', () => { + // It sits on the selection fill, which follows `color`, and the selected + // value's colour is the one chosen to contrast with that fill. + const band = focusRules(styleEl.sheet as CSSStyleSheet).find( + r => + r.selectorText === + '.timeinput-wheel:focus-visible .timeinput-wheel-band' + ); + expect(band?.style.getPropertyValue('outline')).toBe( + '2px solid var(--bulma-timeinput-wheel-selected-color)' + ); + expect(band?.style.getPropertyValue('outline-offset')).toBe('-2px'); }); }); diff --git a/bulma-ui/src/scss/form/_timeinput.scss b/bulma-ui/src/scss/form/_timeinput.scss index d5b97cafe..6ac838999 100644 --- a/bulma-ui/src/scss/form/_timeinput.scss +++ b/bulma-ui/src/scss/form/_timeinput.scss @@ -20,8 +20,6 @@ $timeinput-wheel-hover-bg: hsla(0, 0%, 50%, 0.13) !default; $timeinput-wheel-selected-bg: cv.getVar('primary') !default; $timeinput-wheel-selected-color: cv.getVar('primary-invert') !default; $timeinput-wheel-radius: cv.getVar('radius') !default; -// Follows the band unless a colour sets it (see the colour variants below). -$timeinput-wheel-focus-ring-color: cv.getVar('timeinput-wheel-selected-bg') !default; // The per-item depth fade applied inline in TimeWheels.tsx now does the heavy // lifting of dimming away-from-centre values. The mask just trims the very // edges so partial items at the top/bottom don't get a hard cut-off — keep @@ -51,7 +49,6 @@ $timeinput-footer-padding: 0.5rem 0 0 !default; 'timeinput-wheel-selected-bg': #{$timeinput-wheel-selected-bg}, 'timeinput-wheel-selected-color': #{$timeinput-wheel-selected-color}, 'timeinput-wheel-radius': #{$timeinput-wheel-radius}, - 'timeinput-wheel-focus-ring-color': #{$timeinput-wheel-focus-ring-color}, 'timeinput-wheel-mask': #{$timeinput-wheel-mask}, 'timeinput-separator-color': #{$timeinput-separator-color}, 'timeinput-separator-size': #{$timeinput-separator-size}, @@ -126,10 +123,15 @@ $timeinput-footer-padding: 0.5rem 0 0 !default; // that used to live here was removed when the band became the indicator — // pinning a ring to the selected item caused a broken-outline artefact // whenever position was mid-flight (item offset from band). - &:focus-visible { - outline: 2px solid cv.getVar('timeinput-wheel-focus-ring-color'); - outline-offset: 2px; - border-radius: cv.getVar('timeinput-wheel-radius'); + // + // The ring is drawn inset on the band. An outline on the wheel itself sits + // outside its border box, and the mask above clips everything there, so it + // never painted. On the band it sits on the selection fill, so it takes the + // selected value's colour, which contrasts with that fill whatever colour + // the band is. + &:focus-visible .#{iv.$class-prefix}timeinput-wheel-band { + outline: 2px solid cv.getVar('timeinput-wheel-selected-color'); + outline-offset: -2px; } &.#{iv.$class-prefix}is-dragging .#{iv.$class-prefix}timeinput-wheel-item { @@ -242,18 +244,14 @@ $timeinput-footer-padding: 0.5rem 0 0 !default; // Colour variants. `color` lands on each wheel as `is-`, and the wheel // re-points its selection variables at that colour, pairing it with its // `-invert` for the selected value the way the `primary` default does. The -// focus ring takes the colour's `-on-scheme` variant instead, which Bulma -// darkens or lightens until it contrasts with `scheme-main`, since a ring in -// plain `warning` or `success` is too faint to see on a light surface. The -// band, the selected item and the ring all read these variables, so they -// follow without rules of their own. +// band, the selected item and the focus ring all read these variables, so +// they follow without rules of their own. @each $name in 'primary', 'link', 'info', 'success', 'warning', 'danger' { .#{iv.$class-prefix}timeinput-wheel.#{iv.$class-prefix}is-#{$name} { @include cv.register-vars( ( 'timeinput-wheel-selected-bg': #{cv.getVar($name)}, 'timeinput-wheel-selected-color': #{cv.getVar('#{$name}-invert')}, - 'timeinput-wheel-focus-ring-color': #{cv.getVar('#{$name}-on-scheme')}, ) ); } diff --git a/docs/docs/api/form/datetime/datetimeinput.md b/docs/docs/api/form/datetime/datetimeinput.md index 655934493..c09f29df7 100644 --- a/docs/docs/api/form/datetime/datetimeinput.md +++ b/docs/docs/api/form/datetime/datetimeinput.md @@ -575,7 +575,7 @@ The OS-native pickers always use the device's system locale, so these examples s ``` -**Inline:** rendered inline, the panel shows the color without opening a popover. The calendar takes it on the selected date, today's date and its keyboard focus ring; open the time row and the wheels take it on their selection band and focus ring. The footer's time pill and Done button stay `primary`. +**Inline:** rendered inline, the panel shows the color without opening a popover. The calendar takes it on the selected date, today's date and its keyboard focus ring; open the time row and the wheels take it on their selection band. The footer's time pill and Done button stay `primary`. ```tsx live @@ -837,74 +837,74 @@ The DateTimeInput prop set is the union of [DateInput](./dateinput.md) and [Time -| Prop | Type | Default | Description | -| ------------------- | -------------------------------------------------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | -| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | -| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | -| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | -| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | -| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | -| `iconRightName` | `string` | — | Shortcut for the right icon name. | -| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | -| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | -| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | -| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | -| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | -| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | -| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | -| `message` | `React.ReactNode` | — | Help/validation text below the input. | -| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Message color. | -| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | -| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | -| `value` | `Date` \| `null` | — | Controlled selected date-time. | -| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | -| `onChange` | `(d: Date \| null) => void` | — | Fired when either the date or time portion changes. | -| `onOpen` | `() => void` | — | Fired when the popover opens. | -| `onClose` | `() => void` | — | Fired when the popover closes. | -| `min` | `Date` | — | Lower bound for the combined date-time. | -| `max` | `Date` | — | Upper bound for the combined date-time. | -| `disabled` | `boolean` | `false` | Disable the input. | -| `readOnly` | `boolean` | `false` | Read-only input. | -| `placeholder` | `string` | — | Placeholder text. | -| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD HH:mm'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD HH:mm'`. | -| `parse` | `(s: string) => Date \| null` | — | Custom parser. | -| `locale` | `string` | — | BCP-47 locale tag. | -| `inline` | `boolean` | `false` | Render the panel inline (no popover). | -| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer devices. | -| `editable` | `boolean` | `true` | Allow segmented keyboard typing (type the date-time directly across all segments). `false` makes the field picker-only. | -| `popover` | `boolean` | `true` | Whether the calendar + time popover exists. `false` makes the field input-only (segmented typing with no popover). Default `true`. | -| `openOnFocus` | `boolean` | `true` | Open the popover on focus. Default `true`. | -| `closeOnSelect` | `boolean` | `false` | Off by default — users typically tweak both halves before committing. | -| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position. | -| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | -| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date and the selection band. Today's date and the keyboard focus rings take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay readable; that makes `'primary'` a shade off the unset picker, which uses plain `primary` for them. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way. | -| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | -| `isRounded` | `boolean` | `false` | Rounded input corners. | -| `shouldDisableDate` | `(d: Date) => boolean` | — | Disable specific dates. Blocked dates are also rejected during manual typing (the predicate receives the full candidate date-time — prefer day-based checks). | -| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates, matched by calendar day; also rejected by manual typing. | -| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the calendar week starts on. | -| `dayNames` | `string[]` | — | Override the 7 day-name labels. | -| `monthNames` | `string[]` | — | Override the 12 month-name labels. | -| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months. | -| `hourFormat` | `'12'` \| `'24'` | `'24'` | Time format. | -| `enableSeconds` | `boolean` | `false` | Show seconds column. Note: iOS Safari's native datetime-local picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | -| `incrementHours` | `number` | `1` | Hour step. | -| `incrementMinutes` | `number` | `1` | Step between minute-wheel values (`1` = every minute, iOS-style). | -| `incrementSeconds` | `number` | `1` | Step between second-wheel values (only with `enableSeconds`). | -| `unselectableTimes` | `(d: Date) => boolean` | — | Block specific times. Blocked times are also rejected during manual typing. | -| `iconLeftName` | `string` | `'calendar-alt'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | -| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | -| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | -| `audioTick` | `boolean` | `false` | Play a short audible tick on each time-wheel crossing. Default `false`. | -| `haptics` | `boolean` | `false` | Auto-route tactile feedback per wheel tick (vibrate on Android, audio thunk on iOS). Default `false`. | -| `labels` | `PickerLabels` | — | Optional translatable string overrides. | -| `className` | `string` | — | Additional CSS classes. | -| `ref` | `React.Ref` | — | Forwarded to the underlying element. | -| `name` | `string` | — | Form field name. | -| `form` | `string` | — | Optional id of the form the input belongs to. | -| `required` | `boolean` | `false` | Marks the field as required for native HTML form validation. | -| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | +| Prop | Type | Default | Description | +| ------------------- | -------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | +| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | +| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | +| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | +| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | +| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | +| `iconRightName` | `string` | — | Shortcut for the right icon name. | +| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | +| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | +| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | +| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | +| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | +| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | +| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | +| `message` | `React.ReactNode` | — | Help/validation text below the input. | +| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Message color. | +| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | +| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | +| `value` | `Date` \| `null` | — | Controlled selected date-time. | +| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | +| `onChange` | `(d: Date \| null) => void` | — | Fired when either the date or time portion changes. | +| `onOpen` | `() => void` | — | Fired when the popover opens. | +| `onClose` | `() => void` | — | Fired when the popover closes. | +| `min` | `Date` | — | Lower bound for the combined date-time. | +| `max` | `Date` | — | Upper bound for the combined date-time. | +| `disabled` | `boolean` | `false` | Disable the input. | +| `readOnly` | `boolean` | `false` | Read-only input. | +| `placeholder` | `string` | — | Placeholder text. | +| `format` | `Intl.DateTimeFormatOptions` \| `string` | `'YYYY-MM-DD HH:mm'` | Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD HH:mm'`. | +| `parse` | `(s: string) => Date \| null` | — | Custom parser. | +| `locale` | `string` | — | BCP-47 locale tag. | +| `inline` | `boolean` | `false` | Render the panel inline (no popover). | +| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer devices. | +| `editable` | `boolean` | `true` | Allow segmented keyboard typing (type the date-time directly across all segments). `false` makes the field picker-only. | +| `popover` | `boolean` | `true` | Whether the calendar + time popover exists. `false` makes the field input-only (segmented typing with no popover). Default `true`. | +| `openOnFocus` | `boolean` | `true` | Open the popover on focus. Default `true`. | +| `closeOnSelect` | `boolean` | `false` | Off by default — users typically tweak both halves before committing. | +| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position. | +| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | +| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the calendar and the time wheels, where it colors the selected date and the selection band. Today's date and the calendar's keyboard focus ring take the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay readable; that makes `'primary'` a shade off the unset calendar, which uses plain `primary` for them. A focused wheel's ring is drawn inside the band in the color's `-invert`, like the selected value, so it shows on the fill. Unset, they use their `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which follow `primary` by default. The footer's time pill and Done button stay `primary` either way. | +| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | +| `isRounded` | `boolean` | `false` | Rounded input corners. | +| `shouldDisableDate` | `(d: Date) => boolean` | — | Disable specific dates. Blocked dates are also rejected during manual typing (the predicate receives the full candidate date-time — prefer day-based checks). | +| `unselectableDates` | `Date[]` | — | Convenience array of disabled dates, matched by calendar day; also rejected by manual typing. | +| `firstDayOfWeek` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `0` | Day the calendar week starts on. | +| `dayNames` | `string[]` | — | Override the 7 day-name labels. | +| `monthNames` | `string[]` | — | Override the 12 month-name labels. | +| `nearbyMonthDays` | `boolean` | `true` | Show dimmed dates from adjacent months. | +| `hourFormat` | `'12'` \| `'24'` | `'24'` | Time format. | +| `enableSeconds` | `boolean` | `false` | Show seconds column. Note: iOS Safari's native datetime-local picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | +| `incrementHours` | `number` | `1` | Hour step. | +| `incrementMinutes` | `number` | `1` | Step between minute-wheel values (`1` = every minute, iOS-style). | +| `incrementSeconds` | `number` | `1` | Step between second-wheel values (only with `enableSeconds`). | +| `unselectableTimes` | `(d: Date) => boolean` | — | Block specific times. Blocked times are also rejected during manual typing. | +| `iconLeftName` | `string` | `'calendar-alt'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | +| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | +| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | +| `audioTick` | `boolean` | `false` | Play a short audible tick on each time-wheel crossing. Default `false`. | +| `haptics` | `boolean` | `false` | Auto-route tactile feedback per wheel tick (vibrate on Android, audio thunk on iOS). Default `false`. | +| `labels` | `PickerLabels` | — | Optional translatable string overrides. | +| `className` | `string` | — | Additional CSS classes. | +| `ref` | `React.Ref` | — | Forwarded to the underlying element. | +| `name` | `string` | — | Form field name. | +| `form` | `string` | — | Optional id of the form the input belongs to. | +| `required` | `boolean` | `false` | Marks the field as required for native HTML form validation. | +| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | @@ -961,7 +961,6 @@ When you pass an explicit token `format`, **that format is the source of truth f | `--bulma-timeinput-wheel-selected-bg` ‡ | `$timeinput-wheel-selected-bg` | `var(--bulma-primary)` | | `--bulma-timeinput-wheel-selected-color` ‡ | `$timeinput-wheel-selected-color` | `var(--bulma-primary-invert)` | | `--bulma-timeinput-wheel-radius` ‡ | `$timeinput-wheel-radius` | `var(--bulma-radius)` | -| `--bulma-timeinput-wheel-focus-ring-color` ‡ | `$timeinput-wheel-focus-ring-color` | `var(--bulma-timeinput-wheel-selected-bg)` | | `--bulma-timeinput-wheel-mask` ‡ | `$timeinput-wheel-mask` | `linear-gradient(180deg, transparent 0, black 18%, black 82%, transparent 100%)` | | `--bulma-timeinput-separator-color` ‡ | `$timeinput-separator-color` | `var(--bulma-text-weak)` | | `--bulma-timeinput-separator-size` ‡ | `$timeinput-separator-size` | `var(--bulma-size-5)` | diff --git a/docs/docs/api/form/datetime/timeinput.md b/docs/docs/api/form/datetime/timeinput.md index 26faed3bd..c403feb95 100644 --- a/docs/docs/api/form/datetime/timeinput.md +++ b/docs/docs/api/form/datetime/timeinput.md @@ -984,68 +984,68 @@ Combine `incrementMinutes={5}` (or `15`/`30`) with `min` and `max` to build a ti -| Prop | Type | Default | Description | -| ------------------- | -------------------------------------------------------------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | -| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | -| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | -| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | -| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | -| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | -| `iconRightName` | `string` | — | Shortcut for the right icon name. | -| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | -| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | -| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | -| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | -| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | -| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | -| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | -| `message` | `React.ReactNode` | — | Help/validation text below the input. | -| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Color modifier for the help message. | -| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | -| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | -| `value` | `Date` \| `null` | — | Controlled selected time (date portion is preserved). | -| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | -| `onChange` | `(d: Date \| null) => void` | — | Fired when the value changes. | -| `onOpen` | `() => void` | — | Fired when the popover opens. | -| `onClose` | `() => void` | — | Fired when the popover closes. | -| `min` | `Date` | — | Earliest selectable time. | -| `max` | `Date` | — | Latest selectable time. | -| `disabled` | `boolean` | `false` | Disable the input. | -| `readOnly` | `boolean` | `false` | Make the input read-only. | -| `placeholder` | `string` | — | Placeholder text for the input. | -| `format` | `Intl.DateTimeFormatOptions` \| `string` | `(see below)` | Token format string or `Intl.DateTimeFormat` options. | -| `parse` | `(s: string) => Date \| null` | — | Custom parser. | -| `locale` | `string` | — | BCP-47 locale tag for Intl formatting. | -| `inline` | `boolean` | `false` | Render the spinner inline (no popover). | -| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer + small-viewport devices. | -| `editable` | `boolean` | `true` | Allow segmented keyboard typing in the input (type the time directly, auto-advancing across segments). `false` makes the field picker-only. | -| `popover` | `boolean` | `true` | Whether the spinner popover exists. `false` makes the field input-only (segmented typing, no popover). | -| `openOnFocus` | `boolean` | `true` | Open the popover when the input is focused. | -| `closeOnSelect` | `boolean` | `false` | Close the popover after a time is selected (off by default). | -| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position relative to the input. | -| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | -| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the wheels, where it colors the selection band. The keyboard focus ring takes the color's `-on-scheme` variant, which Bulma adjusts to contrast with the background, so pale colors stay visible; that makes `'primary'` a shade off the unset ring, which follows the band. Unset, the wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`. | -| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | -| `isRounded` | `boolean` | `false` | Render the input with rounded corners. | -| `hourFormat` | `'12'` \| `'24'` | `'24'` | Hour format. `'12'` shows an AM/PM toggle. | -| `enableSeconds` | `boolean` | `false` | Show a seconds column. Note: iOS Safari's native time picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | -| `incrementHours` | `number` | `1` | Hour step for the spinner. | -| `incrementMinutes` | `number` | `1` | Minute step. Combine with `min`/`max` for slot-style pickers. | -| `incrementSeconds` | `number` | `1` | Second step. Default `1`. | -| `unselectableTimes` | `(d: Date) => boolean` | — | Predicate returning `true` for times that should be skipped. Blocked times are also rejected during manual typing. | -| `iconLeftName` | `string` | `'clock'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | -| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | -| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | -| `labels` | `PickerLabels` | — | Optional translatable string overrides. | -| `audioTick` | `boolean` | `false` | Play a short audible click on each wheel-item crossing. Substitute for haptic feedback on iOS Safari (which has no web haptic API as of May 2026); on Android, `navigator.vibrate(5)` fires automatically regardless. | -| `haptics` | `boolean` | `false` | Auto-route platform-appropriate feedback: vibrate on Android (already happening), audio thunk on iOS (where vibrate is unavailable). One switch instead of platform-sniffing on the consumer side. `audioTick={true}` always wins. | -| `name` | `string` | — | Form field name. | -| `form` | `string` | — | Form id the input belongs to. | -| `required` | `boolean` | `false` | Marks the input as required. | -| `className` | `string` | — | Additional CSS classes for the input. | -| `ref` | `React.Ref` | — | Forwarded to the underlying ``. | -| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | +| Prop | Type | Default | Description | +| ------------------- | -------------------------------------------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `label` | `React.ReactNode` | — | Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label) and dropped inside an outer `Field`. | +| `labelSize` | `'small'` \| `'normal'` \| `'medium'` \| `'large'` | — | Size for the label. | +| `labelProps` | `React.LabelHTMLAttributes & { [key: string]: unknown; }` | — | Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). | +| `horizontal` | `boolean` | `false` | Render the field with horizontal layout. | +| `iconLeft` | `IconProps` \| `React.ReactNode` | — | Icon props for the left icon. | +| `iconRight` | `IconProps` \| `React.ReactNode` | — | Icon props for the right icon. | +| `iconRightName` | `string` | — | Shortcut for the right icon name. | +| `iconLeftSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for left icon size. | +| `iconRightSize` | `'small'` \| `'medium'` \| `'large'` | — | Shortcut for right icon size. | +| `hasIconsLeft` | `boolean` | `false` | Force the left icon container. | +| `hasIconsRight` | `boolean` | `false` | Force the right icon container. | +| `isLoading` | `boolean` | `false` | Show a loading indicator on the control. | +| `isExpanded` | `boolean` | `false` | Expand the control to fill its container. | +| `controlSize` | `'small'` \| `'medium'` \| `'large'` | — | Size of the wrapping Control. | +| `message` | `React.ReactNode` | — | Help/validation text below the input. | +| `messageColor` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Color modifier for the help message. | +| `fieldClassName` | `string` | — | Additional CSS classes for the Field wrapper. | +| `controlClassName` | `string` | — | Additional CSS classes for the Control wrapper. | +| `value` | `Date` \| `null` | — | Controlled selected time (date portion is preserved). | +| `defaultValue` | `Date` \| `null` | — | Initial value for uncontrolled usage. | +| `onChange` | `(d: Date \| null) => void` | — | Fired when the value changes. | +| `onOpen` | `() => void` | — | Fired when the popover opens. | +| `onClose` | `() => void` | — | Fired when the popover closes. | +| `min` | `Date` | — | Earliest selectable time. | +| `max` | `Date` | — | Latest selectable time. | +| `disabled` | `boolean` | `false` | Disable the input. | +| `readOnly` | `boolean` | `false` | Make the input read-only. | +| `placeholder` | `string` | — | Placeholder text for the input. | +| `format` | `Intl.DateTimeFormatOptions` \| `string` | `(see below)` | Token format string or `Intl.DateTimeFormat` options. | +| `parse` | `(s: string) => Date \| null` | — | Custom parser. | +| `locale` | `string` | — | BCP-47 locale tag for Intl formatting. | +| `inline` | `boolean` | `false` | Render the spinner inline (no popover). | +| `mobileNative` | `boolean` \| `'auto'` | `'auto'` | Use `` on coarse-pointer + small-viewport devices. | +| `editable` | `boolean` | `true` | Allow segmented keyboard typing in the input (type the time directly, auto-advancing across segments). `false` makes the field picker-only. | +| `popover` | `boolean` | `true` | Whether the spinner popover exists. `false` makes the field input-only (segmented typing, no popover). | +| `openOnFocus` | `boolean` | `true` | Open the popover when the input is focused. | +| `closeOnSelect` | `boolean` | `false` | Close the popover after a time is selected (off by default). | +| `position` | `'bottom-left'` \| `'bottom-right'` \| `'top-left'` \| `'top-right'` \| `'auto'` | `'bottom-left'` | Popover anchor position relative to the input. | +| `appendToBody` | `boolean` | `false` | Render the popover into `document.body` via portal. | +| `color` | `'primary'` \| `'link'` \| `'info'` \| `'success'` \| `'warning'` \| `'danger'` | — | Bulma color modifier for the input, also carried by the wheels, where it colors the selection band. A focused wheel's keyboard focus ring is drawn inside the band in the color's `-invert`, like the selected value, so it shows on the fill. Unset, the wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`. | +| `size` | `'small'` \| `'medium'` \| `'large'` | — | Size variant. | +| `isRounded` | `boolean` | `false` | Render the input with rounded corners. | +| `hourFormat` | `'12'` \| `'24'` | `'24'` | Hour format. `'12'` shows an AM/PM toggle. | +| `enableSeconds` | `boolean` | `false` | Show a seconds column. Note: iOS Safari's native time picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. | +| `incrementHours` | `number` | `1` | Hour step for the spinner. | +| `incrementMinutes` | `number` | `1` | Minute step. Combine with `min`/`max` for slot-style pickers. | +| `incrementSeconds` | `number` | `1` | Second step. Default `1`. | +| `unselectableTimes` | `(d: Date) => boolean` | — | Predicate returning `true` for times that should be skipped. Blocked times are also rejected during manual typing. | +| `iconLeftName` | `string` | `'clock'` | Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. | +| `triggerIcon` | `boolean` | `true` | Show a clickable launcher button on the right that toggles the popover. Default `true`. | +| `triggerIconName` | `string` | `'chevron-down'` | Glyph for the right launcher button. | +| `labels` | `PickerLabels` | — | Optional translatable string overrides. | +| `audioTick` | `boolean` | `false` | Play a short audible click on each wheel-item crossing. Substitute for haptic feedback on iOS Safari (which has no web haptic API as of May 2026); on Android, `navigator.vibrate(5)` fires automatically regardless. | +| `haptics` | `boolean` | `false` | Auto-route platform-appropriate feedback: vibrate on Android (already happening), audio thunk on iOS (where vibrate is unavailable). One switch instead of platform-sniffing on the consumer side. `audioTick={true}` always wins. | +| `name` | `string` | — | Form field name. | +| `form` | `string` | — | Form id the input belongs to. | +| `required` | `boolean` | `false` | Marks the input as required. | +| `className` | `string` | — | Additional CSS classes for the input. | +| `ref` | `React.Ref` | — | Forwarded to the underlying ``. | +| `...` | All standard `` attributes and Bulma helper props | — | See [Helper Props](../../helpers/usebulmaclasses.md) | @@ -1081,7 +1081,6 @@ When you pass an explicit token `format`, **that format is the source of truth f | `--bulma-timeinput-wheel-selected-bg` ‡ | `$timeinput-wheel-selected-bg` | `var(--bulma-primary)` | | `--bulma-timeinput-wheel-selected-color` ‡ | `$timeinput-wheel-selected-color` | `var(--bulma-primary-invert)` | | `--bulma-timeinput-wheel-radius` ‡ | `$timeinput-wheel-radius` | `var(--bulma-radius)` | -| `--bulma-timeinput-wheel-focus-ring-color` ‡ | `$timeinput-wheel-focus-ring-color` | `var(--bulma-timeinput-wheel-selected-bg)` | | `--bulma-timeinput-wheel-mask` ‡ | `$timeinput-wheel-mask` | `linear-gradient(180deg, transparent 0, black 18%, black 82%, transparent 100%)` | | `--bulma-timeinput-separator-color` ‡ | `$timeinput-separator-color` | `var(--bulma-text-weak)` | | `--bulma-timeinput-separator-size` ‡ | `$timeinput-separator-size` | `var(--bulma-size-5)` | diff --git a/skills/bestax-theming/references/css-variables.md b/skills/bestax-theming/references/css-variables.md index c8e7af141..0786d8916 100644 --- a/skills/bestax-theming/references/css-variables.md +++ b/skills/bestax-theming/references/css-variables.md @@ -381,11 +381,10 @@ Declared on the compound `.button.link-button` — see the compound-selector exc `--bulma-timeinput-footer-padding`, `--bulma-timeinput-separator-color`, `--bulma-timeinput-separator-size`, `--bulma-timeinput-wheel-bg`, `--bulma-timeinput-wheel-color`, `--bulma-timeinput-wheel-dim-color`, -`--bulma-timeinput-wheel-focus-ring-color`, `--bulma-timeinput-wheel-gap`, -`--bulma-timeinput-wheel-hover-bg`, `--bulma-timeinput-wheel-item-height`, -`--bulma-timeinput-wheel-mask`, `--bulma-timeinput-wheel-radius`, -`--bulma-timeinput-wheel-selected-bg`, `--bulma-timeinput-wheel-selected-color`, -`--bulma-timeinput-wheel-width` +`--bulma-timeinput-wheel-gap`, `--bulma-timeinput-wheel-hover-bg`, +`--bulma-timeinput-wheel-item-height`, `--bulma-timeinput-wheel-mask`, +`--bulma-timeinput-wheel-radius`, `--bulma-timeinput-wheel-selected-bg`, +`--bulma-timeinput-wheel-selected-color`, `--bulma-timeinput-wheel-width` `--bulma-timeinput-wheel-item-height` is registered but has no effect: the component sets each wheel item's height inline.