diff --git a/docs/compatibility.md b/docs/compatibility.md index 88d69a6..c16c621 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -86,7 +86,7 @@ platform and architecture in `test-results/browser-matrix.json`. It exercises na Spanish navigation, real drag and keyboard activation in both directions, native form reset and submission, typed selects, projected dialog/card/row actions, responsive grids and feedback focus. It also compares the shared input's implicit Enter behavior directly -with native inputs in the same engine. The card action follows the engine's native Tab +with native inputs in the same engine. Card and row actions follow the engine's native Tab policy; Enter must work once the command has focus. The full accessibility and pixel comparison matrix uses the Chromium pins listed in the diff --git a/docs/field-contract.md b/docs/field-contract.md index 6ef87e9..0b23b7c 100644 --- a/docs/field-contract.md +++ b/docs/field-contract.md @@ -25,6 +25,13 @@ The shared renderer applies the native `inputmode` hint to its text input. The c value and submitted form entry preserve the original string, including its decimal separator. Applications parse and validate the amount. Omitting the state key keeps the default text keyboard. +Set `inputMode: 'numeric'` for an integer identifier such as a printed barcode number. +The field retains `type="text"`, exact strings and leading zeroes through controlled +requests, form submission, reset and hint changes. Applications own identifier +validation and canonicalization. The catalog includes English and Spanish numeric +examples. This behavior covers `numeric-field-C01` through `numeric-field-C05` in +[the numeric field specification](../specs/numeric-text-field.md). + The default input begins 16px after the painted control's left edge. A real click at (4,4) therefore tests the padding itself. The Chromium source test asserts that measured boundary before checking the exact control target. Scoped installed-core checks retain the native diff --git a/packages/angular/package.json b/packages/angular/package.json index d540c9e..827b79a 100644 --- a/packages/angular/package.json +++ b/packages/angular/package.json @@ -1,6 +1,6 @@ { "name": "@vypdev/ha-ui-angular", - "version": "0.1.0-next.2", + "version": "0.1.0-next.3", "description": "Angular bindings for the shared Home Assistant UI components", "type": "module", "license": "MIT", @@ -17,7 +17,7 @@ ], "sideEffects": false, "dependencies": { - "@vypdev/ha-ui": "0.1.0-next.2", + "@vypdev/ha-ui": "0.1.0-next.3", "tslib": "2.8.1" }, "peerDependencies": { diff --git a/packages/core/package.json b/packages/core/package.json index 3eb5ff3..b6fc64c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@vypdev/ha-ui", - "version": "0.1.0-next.2", + "version": "0.1.0-next.3", "description": "Shared presentation contracts and components for Home Assistant applications", "type": "module", "license": "(MIT AND Apache-2.0 AND CC-BY-4.0)", diff --git a/packages/core/src/field-contracts.ts b/packages/core/src/field-contracts.ts index 4b8e6ef..603d5b6 100644 --- a/packages/core/src/field-contracts.ts +++ b/packages/core/src/field-contracts.ts @@ -1,7 +1,7 @@ import {presentationText} from './presentation-text.js'; export interface TextFieldState { readonly label:string; readonly description:string; readonly placeholder:string; - readonly inputMode?:'decimal'; + readonly inputMode?:'decimal'|'numeric'; readonly required:boolean; readonly readOnly:boolean; readonly minLength:number; readonly maxLength:number; readonly error:string; readonly requiredMessage:string; readonly tooShortMessage:string; readonly tooLongMessage:string; } @@ -30,7 +30,7 @@ export function textFieldState(raw:unknown):TextFieldState { const minLength=length(source.minLength,0),maxLength=length(source.maxLength,16384); if(minLength>maxLength)invalid(); const inputMode=source.inputMode; - if(inputMode!==undefined&&inputMode!=='decimal')invalid(); + if(inputMode!==undefined&&inputMode!=='decimal'&&inputMode!=='numeric')invalid(); return Object.freeze({ label:text('label',256,false,''), description:text('description',512,true,''), diff --git a/packages/react/package.json b/packages/react/package.json index 112e865..c626054 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@vypdev/ha-ui-react", - "version": "0.1.0-next.2", + "version": "0.1.0-next.3", "description": "React bindings for the shared Home Assistant UI components", "type": "module", "license": "MIT", diff --git a/packages/svelte/package.json b/packages/svelte/package.json index 2c06abe..69c3f5e 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -1,6 +1,6 @@ { "name": "@vypdev/ha-ui-svelte", - "version": "0.1.0-next.2", + "version": "0.1.0-next.3", "description": "Svelte bindings for the shared Home Assistant UI components", "type": "module", "license": "MIT", diff --git a/packages/vue/package.json b/packages/vue/package.json index c26efc5..6f8144e 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@vypdev/ha-ui-vue", - "version": "0.1.0-next.2", + "version": "0.1.0-next.3", "description": "Vue bindings for the shared Home Assistant UI components", "type": "module", "license": "MIT", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5460f7b..9e6c93f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -134,7 +134,7 @@ importers: packages/angular: dependencies: '@vypdev/ha-ui': - specifier: 0.1.0-next.2 + specifier: 0.1.0-next.3 version: link:../core tslib: specifier: 2.8.1 diff --git a/specs/CATALOG.md b/specs/CATALOG.md index 4245aa7..6883cf3 100644 --- a/specs/CATALOG.md +++ b/specs/CATALOG.md @@ -10,7 +10,7 @@ debt or convert unknown historic intent into a design decision. | Capability ID | Status | Scope | Primary SDD | Evidence | |---|---|---|---|---| -| `shared-ui-foundation` | Proposed | One DOM component implementation with React, Vue, Angular and Svelte adapters, direct Lit/DOM use, shared Storybook and verified Gateway/Domus adoption. Partial source; no complete capability or release accepted. | [Shared Home Assistant presentation components and framework adapters](./shared-ui-foundation.md) + 1 companion | 337 paths · 2026-11-05 | +| `shared-ui-foundation` | Proposed | One DOM component implementation with React, Vue, Angular and Svelte adapters, direct Lit/DOM use, shared Storybook and verified Gateway/Domus adoption. Partial source; no complete capability or release accepted. | [Shared Home Assistant presentation components and framework adapters](./shared-ui-foundation.md) + 2 companion | 337 paths · 2026-11-05 | ## Evidence map @@ -18,7 +18,7 @@ debt or convert unknown historic intent into a design decision. - Owner: vypdev maintainers; Efrain Espada (accountable product/publication owner) - Last verified: 2026-11-05 -- Specifications: [`specs/shared-ui-foundation.md`](./shared-ui-foundation.md) · [`specs/shared-ui-framework-delivery.md`](./shared-ui-framework-delivery.md) +- Specifications: [`specs/shared-ui-foundation.md`](./shared-ui-foundation.md) · [`specs/shared-ui-framework-delivery.md`](./shared-ui-framework-delivery.md) · [`specs/numeric-text-field.md`](./numeric-text-field.md) - Workflows: [`.github/workflows/copilot_issue.yml`](../.github/workflows/copilot_issue.yml) · [`.github/workflows/ci_check.yml`](../.github/workflows/ci_check.yml) · [`.github/workflows/npm_release.yml`](../.github/workflows/npm_release.yml) · [`.github/workflows/storybook_pages.yml`](../.github/workflows/storybook_pages.yml) - Entrypoints: [`packages/core/src/index.ts`](../packages/core/src/index.ts) · [`packages/core/src/components/tabs.ts`](../packages/core/src/components/tabs.ts) · [`packages/react/src/index.ts`](../packages/react/src/index.ts) · [`packages/vue/src/index.ts`](../packages/vue/src/index.ts) · [`packages/angular/src/index.ts`](../packages/angular/src/index.ts) · [`packages/svelte/src/index.ts`](../packages/svelte/src/index.ts) · [`packages/core/src/components/field.ts`](../packages/core/src/components/field.ts) · [`packages/core/src/field-contracts.ts`](../packages/core/src/field-contracts.ts) · [`.storybook/main.ts`](../.storybook/main.ts) · [`packages/core/src/button-contracts.ts`](../packages/core/src/button-contracts.ts) · [`packages/core/src/components/button.ts`](../packages/core/src/components/button.ts) · [`packages/core/src/select-contracts.ts`](../packages/core/src/select-contracts.ts) · [`packages/core/src/components/select.ts`](../packages/core/src/components/select.ts) · [`packages/core/src/checkbox-contracts.ts`](../packages/core/src/checkbox-contracts.ts) · [`packages/core/src/components/checkbox.ts`](../packages/core/src/components/checkbox.ts) · [`packages/core/src/components/dialog.ts`](../packages/core/src/components/dialog.ts) · [`packages/core/src/dialog-contracts.ts`](../packages/core/src/dialog-contracts.ts) · [`packages/core/src/components/card.ts`](../packages/core/src/components/card.ts) · [`packages/core/src/card-contracts.ts`](../packages/core/src/card-contracts.ts) · [`packages/core/src/layout-contracts.ts`](../packages/core/src/layout-contracts.ts) · [`packages/core/src/components/layout.ts`](../packages/core/src/components/layout.ts) · [`packages/core/src/components/feedback.ts`](../packages/core/src/components/feedback.ts) · [`packages/core/src/feedback-contracts.ts`](../packages/core/src/feedback-contracts.ts) - Core code: [`packages/core/src/contracts.ts`](../packages/core/src/contracts.ts) · [`tooling/coverage.mjs`](../tooling/coverage.mjs) · [`packages/core/src/components/tabs.ts`](../packages/core/src/components/tabs.ts) · [`packages/react/src/index.ts`](../packages/react/src/index.ts) · [`packages/vue/src/index.ts`](../packages/vue/src/index.ts) · [`packages/angular/src/index.ts`](../packages/angular/src/index.ts) · [`packages/svelte/src/index.ts`](../packages/svelte/src/index.ts) · [`packages/svelte/src/Tabs.svelte`](../packages/svelte/src/Tabs.svelte) · [`packages/svelte/src/types.ts`](../packages/svelte/src/types.ts) · [`packages/core/src/components/field.ts`](../packages/core/src/components/field.ts) · [`packages/core/src/field-contracts.ts`](../packages/core/src/field-contracts.ts) · [`packages/core/src/presentation-text.ts`](../packages/core/src/presentation-text.ts) · [`packages/react/src/text-field.ts`](../packages/react/src/text-field.ts) · [`packages/vue/src/text-field.ts`](../packages/vue/src/text-field.ts) · [`packages/angular/src/text-field.ts`](../packages/angular/src/text-field.ts) · [`packages/svelte/src/Field.svelte`](../packages/svelte/src/Field.svelte) · [`stories/catalog-state.ts`](../stories/catalog-state.ts) · [`stories/catalog-frame.ts`](../stories/catalog-frame.ts) · [`stories/catalog-example.ts`](../stories/catalog-example.ts) · [`stories/foundation.example.ts`](../stories/foundation.example.ts) · [`stories/panels.example.ts`](../stories/panels.example.ts) · [`stories/field.example.ts`](../stories/field.example.ts) · [`.storybook/preview.ts`](../.storybook/preview.ts) · [`packages/core/src/button-contracts.ts`](../packages/core/src/button-contracts.ts) · [`packages/core/src/components/button.ts`](../packages/core/src/components/button.ts) · [`stories/button.example.ts`](../stories/button.example.ts) · [`packages/react/src/button.ts`](../packages/react/src/button.ts) · [`packages/vue/src/button.ts`](../packages/vue/src/button.ts) · [`packages/angular/src/button.ts`](../packages/angular/src/button.ts) · [`packages/svelte/src/Button.svelte`](../packages/svelte/src/Button.svelte) · [`packages/core/src/select-contracts.ts`](../packages/core/src/select-contracts.ts) · [`packages/core/src/components/select.ts`](../packages/core/src/components/select.ts) · [`packages/react/src/select.ts`](../packages/react/src/select.ts) · [`packages/vue/src/select.ts`](../packages/vue/src/select.ts) · [`packages/angular/src/select.ts`](../packages/angular/src/select.ts) · [`packages/svelte/src/Select.svelte`](../packages/svelte/src/Select.svelte) · [`stories/select.example.ts`](../stories/select.example.ts) · [`packages/core/src/checkbox-contracts.ts`](../packages/core/src/checkbox-contracts.ts) · [`packages/core/src/components/checkbox.ts`](../packages/core/src/components/checkbox.ts) · [`packages/core/src/components/implicit-submit.ts`](../packages/core/src/components/implicit-submit.ts) · [`packages/react/src/checkbox.ts`](../packages/react/src/checkbox.ts) · [`packages/vue/src/checkbox.ts`](../packages/vue/src/checkbox.ts) · [`packages/angular/src/checkbox.ts`](../packages/angular/src/checkbox.ts) · [`packages/svelte/src/Checkbox.svelte`](../packages/svelte/src/Checkbox.svelte) · [`stories/checkbox.example.ts`](../stories/checkbox.example.ts) · [`stories/catalog-completion.ts`](../stories/catalog-completion.ts) · [`stories/navigation-icons.ts`](../stories/navigation-icons.ts) · [`packages/core/src/navigation-scroll.ts`](../packages/core/src/navigation-scroll.ts) · [`packages/core/src/components/navigation-overflow.ts`](../packages/core/src/components/navigation-overflow.ts) · [`packages/vue/src/native-host-attributes.ts`](../packages/vue/src/native-host-attributes.ts) · [`packages/core/src/components/dialog.ts`](../packages/core/src/components/dialog.ts) · [`packages/core/src/dialog-contracts.ts`](../packages/core/src/dialog-contracts.ts) · [`packages/core/src/components/card.ts`](../packages/core/src/components/card.ts) · [`packages/core/src/card-contracts.ts`](../packages/core/src/card-contracts.ts) · [`packages/react/src/dialog.ts`](../packages/react/src/dialog.ts) · [`packages/react/src/card.ts`](../packages/react/src/card.ts) · [`packages/vue/src/dialog.ts`](../packages/vue/src/dialog.ts) · [`packages/vue/src/card.ts`](../packages/vue/src/card.ts) · [`packages/angular/src/dialog.ts`](../packages/angular/src/dialog.ts) · [`packages/angular/src/card.ts`](../packages/angular/src/card.ts) · [`packages/svelte/src/Dialog.svelte`](../packages/svelte/src/Dialog.svelte) · [`packages/svelte/src/Card.svelte`](../packages/svelte/src/Card.svelte) · [`stories/dialog.example.ts`](../stories/dialog.example.ts) · [`stories/card.example.ts`](../stories/card.example.ts) · [`tooling/raster-archive.mjs`](../tooling/raster-archive.mjs) · [`packages/core/src/layout-contracts.ts`](../packages/core/src/layout-contracts.ts) · [`packages/core/src/components/layout.ts`](../packages/core/src/components/layout.ts) · [`packages/react/src/layout.ts`](../packages/react/src/layout.ts) · [`packages/vue/src/layout.ts`](../packages/vue/src/layout.ts) · [`packages/angular/src/layout.ts`](../packages/angular/src/layout.ts) · [`packages/svelte/src/Row.svelte`](../packages/svelte/src/Row.svelte) · [`packages/svelte/src/Grid.svelte`](../packages/svelte/src/Grid.svelte) · [`stories/row.example.ts`](../stories/row.example.ts) · [`stories/grid.example.ts`](../stories/grid.example.ts) · [`packages/angular/src/feedback.ts`](../packages/angular/src/feedback.ts) · [`packages/core/src/components/feedback.ts`](../packages/core/src/components/feedback.ts) · [`packages/core/src/feedback-contracts.ts`](../packages/core/src/feedback-contracts.ts) · [`packages/react/src/feedback.ts`](../packages/react/src/feedback.ts) · [`packages/svelte/src/Feedback.svelte`](../packages/svelte/src/Feedback.svelte) · [`packages/vue/src/feedback.ts`](../packages/vue/src/feedback.ts) · [`stories/feedback.example.ts`](../stories/feedback.example.ts) · [`tooling/compatibility.mjs`](../tooling/compatibility.mjs) · [`tooling/packaging.mjs`](../tooling/packaging.mjs) · [`tooling/npm-prerelease.mjs`](../tooling/npm-prerelease.mjs) diff --git a/specs/catalog.json b/specs/catalog.json index 90bdef0..b4fe221 100644 --- a/specs/catalog.json +++ b/specs/catalog.json @@ -10,7 +10,8 @@ "lastVerified": "2026-11-05", "specs": [ "specs/shared-ui-foundation.md", - "specs/shared-ui-framework-delivery.md" + "specs/shared-ui-framework-delivery.md", + "specs/numeric-text-field.md" ], "workflows": [ ".github/workflows/copilot_issue.yml", diff --git a/specs/numeric-text-field.md b/specs/numeric-text-field.md new file mode 100644 index 0000000..e9e1460 --- /dev/null +++ b/specs/numeric-text-field.md @@ -0,0 +1,163 @@ +# Numeric keyboard hints for the controlled text field + +- Status: Draft +- Owners: vypdev maintainers and shared UI consumers +- Scope: The optional numeric hint in the shared text-field state +- Open decisions blocking readiness: none + +## 1. Executive summary + +An application opts into a numeric keyboard hint for an integer identifier. +The existing shared text input retains exact controlled strings. All framework +adapters consume the same validated state and renderer. + +## 2. Problem, current behavior, and evidence + +The current public field state admits the optional decimal hint. Its contract +validator and tests reject numeric. Domus #91 enters GTIN strings with leading +zeroes and needs the numeric hint through the released component API. + +## 3. Actors, surfaces, and terminology + +An application supplies field state and accepts controlled value requests. +The member edits the rendered text field with keyboard or touch. Numeric and +decimal are native input-mode hints. Application code owns domain parsing, +normalization and validation. + +## 4. Goals, non-goals, and fixed invariants + +| Requirement | Behavior | +|---|---| +| numeric-field-R01 | Accept optional inputMode numeric through the validated public field state, alongside decimal and omission. Reject other unsupported values through the existing field error contract. | +| numeric-field-R02 | Apply the chosen native hint to the text input and preserve exact strings, leading zeroes, controlled requests, form values, focus, selection, reset and existing validation and disabled/readonly semantics. | +| numeric-field-R03 | Verify the shared behavior through direct and framework consumers, packed packages and SSR, and document it with an accessible catalog example for the Domus integer-identifier use case. | + +The renderer uses the existing native text-input type. Applications select the +mode and supply their own label, help and validation. The new hint adds one +admitted state value to the established contract. + +## 5. Current versus proposed product journey + +The application creates field state with the numeric mode and an accessible +barcode-number label. The member enters a string such as 00036000291452. +The application receives that exact string and applies its barcode rules. +Switching the hint preserves the field's current controlled value and focus. + +## 6. Functional behavior and state model + +Extend the optional typed inputMode union to decimal and numeric. The shared +validator accepts those values and omits an absent hint. The renderer reflects +the selected value on its native text input. Controlled value and validity +ownership follow the existing field contract. + +## 7. User-facing configuration + +Applications select the hint through TextFieldState. Existing labels, help, +validation messages, name, defaultValue, readOnly and disabled configuration +continue through their established entry points. + +## 8. Clean Architecture design + +The framework-neutral core contract validates field state. One DOM component +renders it. React, Vue, Angular and Svelte adapters forward state and controlled +value requests. Domain-specific GTIN parsing belongs to Domus. + +## 9. Data, persistence, and wire contracts + +The public state type admits the numeric literal. The input remains text. +Controlled request payloads and form entries use exact strings. The shared +component keeps its existing form ownership, reset and restoration contracts. + +## 10. Errors, retries, and partial failure + +Unsupported state values raise the established FieldInputError. Invalid state +assignment preserves the prior accepted configuration atomically. Existing +canceled edits and deferred acknowledgments retain their controlled behavior. + +## 11. Security and privacy + +Labels and help remain inert bounded presentation text. Values use the existing +single-line value validator. The public input-mode hint retains the field's +existing validation and form-association boundaries. + +## 12. Observability and operational UX + +The catalog exposes a labeled numeric-identifier example and its exact string +value. Required/help/error associations and keyboard focus use the existing +component behavior. Verify English and Spanish narrow interaction. + +## 13. Compatibility, migration, rollout, and rollback + +The additive state value keeps decimal and omitted-mode consumers usable. +Verify all five package coordinates as one compatible prerelease cohort through +the documented publication flow. Qualify the published component in Domus #91. + +## 14. Testing strategy and numeric budget + +Minimum five distinct cases. + +| Area | Minimum distinct cases | Behaviors/risks covered | +|---|---:|---| +| Typed contract | 1 | Observable scenarios in the case inventory. | +| Browser form behavior | 1 | Observable scenarios in the case inventory. | +| Framework behavior | 1 | Observable scenarios in the case inventory. | +| Packed and server consumers | 1 | Observable scenarios in the case inventory. | +| Catalog and accessibility | 1 | Observable scenarios in the case inventory. | +| Total | 5 | Distinct inventory cases; repeated executions do not add cases. | + +| Case ID | Area | Requirements | Scenario | +|---|---|---|---| +| numeric-field-C01 | Typed contract | numeric-field-R01 | Accept numeric, decimal and omitted modes. Reject unsupported literals and malformed values with the existing error. Verify the public type through normal consumers. | +| numeric-field-C02 | Browser form behavior | numeric-field-R01, numeric-field-R02 | Edit an exact leading-zero identifier, verify the native numeric hint and text type, and change hints while preserving controlled value, selection, focus and successful form data. Exercise reset and existing validation/disabled/readonly behavior. | +| numeric-field-C03 | Framework behavior | numeric-field-R02, numeric-field-R03 | Use the shared numeric state in direct DOM/Lit, React, Vue, Angular and Svelte entry points. Accept controlled requests and preserve the exact leading-zero string and form entry. | +| numeric-field-C04 | Packed and server consumers | numeric-field-R01, numeric-field-R02, numeric-field-R03 | Install the verified packed cohort and compile/render the normal consumers with numeric state. Verify exact strings and server imports through the established package and SSR harnesses. | +| numeric-field-C05 | Catalog and accessibility | numeric-field-R02, numeric-field-R03 | Exercise the labeled numeric example with English keyboard and narrow Spanish touch. Verify help, focus, exact entered text and the reflected hint in the rebuilt catalog. | + +## 15. Documentation and discoverability + +[specs/numeric-text-field.md](numeric-text-field.md) · [packages/core/src/field-contracts.ts](../packages/core/src/field-contracts.ts) · [tests/contracts/field.test.ts](../tests/contracts/field.test.ts) · [tests/browser/field.test.ts](../tests/browser/field.test.ts) · [tests/consumers/fields.ts](../tests/consumers/fields.ts) · [tests/consumers/packed.test.ts](../tests/consumers/packed.test.ts) · [stories/field.example.ts](../stories/field.example.ts) · [stories/field.stories.ts](../stories/field.stories.ts) · [docs/field-contract.md](../docs/field-contract.md) + +| Path | Change | +|---|---| +| specs/numeric-text-field.md | create | +| packages/core/src/field-contracts.ts | update | +| tests/contracts/field.test.ts | update | +| tests/browser/field.test.ts | update | +| tests/consumers/fields.ts | update | +| tests/consumers/packed.test.ts | update | +| stories/field.example.ts | update | +| stories/field.stories.ts | update | +| docs/field-contract.md | update | + +## 16. Acceptance scenarios + +Exercise the five case definitions through their normal entry points. Enter a +leading-zero identifier and observe its exact controlled value and form data. +Use the packaged component with the same state through each supported adapter. + +## 17. Requirements traceability + +| Requirement | Cases | +|---|---| +| numeric-field-R01 | numeric-field-C01, numeric-field-C02, numeric-field-C04 | +| numeric-field-R02 | numeric-field-C02, numeric-field-C03, numeric-field-C04, numeric-field-C05 | +| numeric-field-R03 | numeric-field-C03, numeric-field-C04, numeric-field-C05 | + +## 18. Implementation sequence + +Extend the public core union and validation. Add the focused contract and browser +regressions, verify normal and packed framework consumers, then update the +catalog and documentation. Follow the documented prerelease flow for adoption. + +## 19. Definition of Done + +Verify all five cases and the repository's required coverage, typing, browser, +package, SSR and catalog gates. Merge the reviewed head through the normal path +and verify destination CI and Branch Sync. Follow publication and Domus adoption +under the authorized cross-repository workflow. + +## 20. References and decisions + +The shared UI foundation and framework-delivery specifications retain their +owning definitions. The decimal field increment establishes controlled values +and the optional native hint. Domus #91 motivates the numeric addition. diff --git a/stories/field.example.ts b/stories/field.example.ts index 0648237..12b23d1 100644 --- a/stories/field.example.ts +++ b/stories/field.example.ts @@ -3,13 +3,36 @@ import type {Meta} from '@storybook/web-components-vite'; import {catalogExample} from './catalog-example.js'; import {buttonState} from '@vypdev/ha-ui/button-contracts'; import {textFieldState,textFieldValue,fieldValueDetail} from '@vypdev/ha-ui/field-contracts'; +import type {TextFieldState} from '@vypdev/ha-ui/field-contracts'; import type {FieldValueEvent} from '@vypdev/ha-ui/field'; import {catalogSettings,catalogCopy} from './catalog-state.js'; -export interface Args {value:string;defaultValue:string;disabled:boolean;readOnly:boolean;required:boolean;error:boolean;submitted:string|null;placeholder?:string;description?:string;} +export interface Args { + value: string; + defaultValue: string; + disabled: boolean; + readOnly: boolean; + required: boolean; + error: boolean; + submitted: string | null; + placeholder?: string; + description?: string; + label?: string; + requiredMessage?: string; + inputMode?: TextFieldState['inputMode']; +} export const renderExample:NonNullable['render']>=(controls,context)=>{ const copy=catalogCopy[catalogSettings(context.globals).locale]; return catalogExample(controls,(args,setArgs)=>{ - const state=textFieldState({label:copy.fieldLabel,description:args.description===undefined?copy.description:args.description,placeholder:args.placeholder===undefined?copy.placeholder:args.placeholder,required:args.required,readOnly:args.readOnly,error:args.error?copy.error:'',requiredMessage:copy.required}); + const state = textFieldState({ + label: args.label ?? copy.fieldLabel, + inputMode: args.inputMode, + description: args.description === undefined ? copy.description : args.description, + placeholder: args.placeholder === undefined ? copy.placeholder : args.placeholder, + required: args.required, + readOnly: args.readOnly, + error: args.error ? copy.error : '', + requiredMessage: args.requiredMessage ?? copy.required, + }); return html`