An open source design system that's fully customizable and agent ready
TypeScript
fix(Field): export FieldStatusPlacement from the package entry (#9368)
Cindy Zhanga8356288ef91
diff --git a/.changeset/export-field-status-placement.md b/.changeset/export-field-status-placement.mdnew file mode 100644index 0000000000..3c906ab109--- /dev/null+++ b/.changeset/export-field-status-placement.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] Field: `FieldStatusPlacement`, the type of every field control's `statusVariant` (`'attached' | 'detached' | 'tooltip'`), is exported from `@astryxdesign/core` and `@astryxdesign/core/Field`, so a wrapper component can type a `statusVariant` prop it forwards.++@cixzhangdiff --git a/packages/core/api-report.md b/packages/core/api-report.mdindex ff6d4fa9c4..16e7e80f24 100644--- a/packages/core/api-report.md+++ b/packages/core/api-report.md@@ -4257,6 +4257,7 @@ interface FieldStatusInputmessage?: stringmessageID?: stringtype: FieldStatusType+type FieldStatusPlacement = keyof FieldStatusVariantMap | 'tooltip'interface FieldStatusProps extends BaseProps<HTMLDivElement>message: stringref?: React.Ref<HTMLDivElement>@@ -6956,6 +6957,7 @@ FieldPartStyleProps (.)FieldProps (.)FieldStatus (.)FieldStatusInput (.)+FieldStatusPlacement (.)FieldStatusProps (.)FieldStatusType (.)FieldStatusVariant (.)diff --git a/packages/core/src/Field/fieldStatusPlacement.public.test.ts b/packages/core/src/Field/fieldStatusPlacement.public.test.tsnew file mode 100644index 0000000000..25e1448c87--- /dev/null+++ b/packages/core/src/Field/fieldStatusPlacement.public.test.ts@@ -0,0 +1,25 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file fieldStatusPlacement.public.test.ts+ * @input The package entry and the Field barrel+ * @output Guards that callers can name the type of every field control's+ * `statusVariant` from the package entry+ * @position Public API test guarding @astryxdesign/core+ */++import {describe, expectTypeOf, it} from 'vitest';+import type {FieldStatusPlacement, TextInputProps} from '../index';+import type {FieldStatusPlacement as FieldBarrelPlacement} from './index';++describe('FieldStatusPlacement public type', () => {+ it('is importable from the package entry and types statusVariant', () => {+ expectTypeOf<FieldStatusPlacement>().toEqualTypeOf<+ 'attached' | 'detached' | 'tooltip'+ >();+ expectTypeOf<FieldBarrelPlacement>().toEqualTypeOf<FieldStatusPlacement>();+ expectTypeOf<+ NonNullable<TextInputProps['statusVariant']>+ >().toEqualTypeOf<FieldStatusPlacement>();+ });+});diff --git a/packages/core/src/Field/index.ts b/packages/core/src/Field/index.tsindex 96957b3695..0ad45113a6 100644--- a/packages/core/src/Field/index.ts+++ b/packages/core/src/Field/index.ts@@ -21,6 +21,7 @@ export type {FieldStatusVariant,FieldStatusVariantMap,} from '../FieldStatus';+export type {FieldStatusPlacement} from './fieldStatusPlacement';// Shared input typesexport type {InputStatus, InputStatusType, InputSize} from './types';