An open source design system that's fully customizable and agent ready
TypeScript
docs(core): reconcile API contract props for Field (#4163) (#4320)
Ojas Mutreja4fdc2c659e5d
diff --git a/.changeset/field-contract-docs-tjsk.md b/.changeset/field-contract-docs-tjsk.mdnew file mode 100644index 0000000000..46e0ace4ef--- /dev/null+++ b/.changeset/field-contract-docs-tjsk.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[docs] document labelID and isGroupLabel props in Field (#4163)++@HelloOjasMutrejadiff --git a/packages/core/src/Field/Field.doc.mjs b/packages/core/src/Field/Field.doc.mjsindex 9bce008401..e6bb0f04c6 100644--- a/packages/core/src/Field/Field.doc.mjs+++ b/packages/core/src/Field/Field.doc.mjs@@ -60,6 +60,17 @@ export const docs = {description: 'ID for the input element (used for the label htmlFor attribute).',required: true,},+ {+ name: 'labelID',+ type: 'string',+ description: 'ID applied to the label element itself for group accessibility.',+ },+ {+ name: 'isGroupLabel',+ type: 'boolean',+ description: 'Renders the label as a span for control groups (radiogroup, checkbox list).',+ default: 'false',+ },{name: 'children',type: 'ReactNode',diff --git a/packages/core/src/__tests__/fieldContract.test.tsx b/packages/core/src/__tests__/fieldContract.test.tsxnew file mode 100644index 0000000000..947ef0f900--- /dev/null+++ b/packages/core/src/__tests__/fieldContract.test.tsx@@ -0,0 +1,24 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++import {describe, it, expect} from 'vitest';++import {docs as FieldDocs} from '../Field/Field.doc.mjs';++// `docs` is the ComponentDoc union (single vs multi component); narrow it+// for structural access to either the top-level props or the first+// sub-component's props.+function getProps(docs: unknown): {name: string}[] {+ const doc = docs as {+ props?: {name: string}[];+ components?: {props?: {name: string}[]}[];+ };+ return doc.props || doc.components?.[0]?.props || [];+}++describe('Field Component API Contract Drift (#4163)', () => {+ it('documents Field labelID and isGroupLabel props', () => {+ const props = getProps(FieldDocs).map(p => p.name);+ expect(props).toContain('labelID');+ expect(props).toContain('isGroupLabel');+ });+});