praxis-kit 6.2.3 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { U as UnknownProps, E as ElementType, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-DQTX4YS_.js';
2
- export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, m as composeRefs, l as defineContractComponent, m as mergeRefs } from '../react-options-DQTX4YS_.js';
1
+ import { U as UnknownProps, E as ElementType, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-BUBVohU6.js';
2
+ export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, m as composeRefs, l as defineContractComponent, m as mergeRefs } from '../react-options-BUBVohU6.js';
3
3
  import * as react from 'react';
4
4
  import { ReactElement, Ref } from 'react';
5
5
  import 'type-fest';
@@ -12,7 +12,7 @@ import {
12
12
  makeCloneSlotChild,
13
13
  mergeRefs,
14
14
  render
15
- } from "../chunk-H3D2JA3J.js";
15
+ } from "../chunk-OCG5VM4H.js";
16
16
 
17
17
  // ../../adapters/react/src/current/slot/composeRefs.ts
18
18
  function getChildRef(element) {
@@ -1,5 +1,5 @@
1
- import { E as ElementType, U as UnknownProps, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-DQTX4YS_.js';
2
- export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, l as defineContractComponent, m as mergeRefs } from '../react-options-DQTX4YS_.js';
1
+ import { E as ElementType, U as UnknownProps, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-BUBVohU6.js';
2
+ export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, l as defineContractComponent, m as mergeRefs } from '../react-options-BUBVohU6.js';
3
3
  import * as react from 'react';
4
4
  import 'type-fest';
5
5
  import '../_shared/diagnostics.js';
@@ -13,7 +13,7 @@ import {
13
13
  makeCloneSlotChild,
14
14
  mergeRefs,
15
15
  render
16
- } from "../chunk-H3D2JA3J.js";
16
+ } from "../chunk-OCG5VM4H.js";
17
17
 
18
18
  // ../../adapters/react/src/legacy/create-contract-component.ts
19
19
  import { forwardRef as forwardRef2 } from "react";
@@ -237,6 +237,7 @@ type AriaResult = ValidResult | AriaInvalidResult;
237
237
 
238
238
  type AriaRule<C extends AriaContext = AriaContext> = ((context: C) => readonly AriaResult[]) & {
239
239
  readonly readsProps?: readonly string[];
240
+ readonly tags?: readonly string[];
240
241
  };
241
242
 
242
243
  type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
@@ -249,6 +250,16 @@ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
249
250
  */
250
251
  readonly diagnostics?: Diagnostics | DiagnosticsMode;
251
252
  readonly aria?: readonly AriaRule[];
253
+ /**
254
+ * Rules that need `AriaPolicyEngine`'s fix-application/caching machinery
255
+ * (`AriaRule`'s `readsProps`, fixable `AriaFix` results) but have no
256
+ * relationship to ARIA semantics — an HTML fact or a security check like a
257
+ * dangerous-URL-scheme guard, for example. Evaluated together with `aria`
258
+ * (both run through the same engine, merged into one rule set) — this is a
259
+ * separate bucket purely so a non-ARIA rule doesn't have to sit under the
260
+ * misleading `aria` name to get the machinery it needs.
261
+ */
262
+ readonly rules?: readonly AriaRule[];
252
263
  readonly children?: readonly ChildRuleInput[];
253
264
  /**
254
265
  * When true, only children matching a `children` rule (or text, per `allowText`)
@@ -338,25 +349,27 @@ type SlotComponent = ComponentType<UnknownProps>;
338
349
  type RenderCallbackProps = Readonly<AnyRecord>;
339
350
 
340
351
  /**
341
- * Maps a polymorphic element type to the instance type exposed through `ref`.
352
+ * Resolves the instance type exposed through `ref` for a polymorphic
353
+ * element.
342
354
  *
343
- * Intrinsic HTML elements resolve to their corresponding DOM element type;
344
- * custom React components currently fall back to `unknown`.
355
+ * Intrinsic HTML elements map to their corresponding DOM element type;
356
+ * custom React components currently resolve to `unknown`.
345
357
  */
346
358
  type ElementRef<T extends ElementType> = T extends IntrinsicTag ? HTMLElementTagNameMap[T] : unknown;
347
359
  /**
348
- * React's intrinsic JSX props for a given element.
360
+ * React's intrinsic JSX props for an element type.
349
361
  *
350
- * Custom components intentionally fall back to `UnknownProps`; the component's
351
- * own prop model defines their accepted props instead.
362
+ * Custom components intentionally resolve to `UnknownProps`; their own
363
+ * prop definitions determine the accepted props.
352
364
  */
353
365
  type IntrinsicJSXProps<T extends ElementType> = T extends IntrinsicTag ? JSX.IntrinsicElements[T] : UnknownProps;
354
366
  /**
355
- * Removes index signatures while preserving explicitly named properties.
367
+ * Removes index signatures while preserving explicitly declared
368
+ * properties.
356
369
  *
357
- * This prevents generic fallback constraints such as `Record<string, unknown>`
358
- * from collapsing `keyof T` to `string`, which would cause
359
- * `Omit<IntrinsicJSXProps<T>, keyof ...>` to remove every intrinsic prop.
370
+ * Prevents broad index signatures (for example `Record<string, unknown>`)
371
+ * from causing `keyof T` to become `string`, which would otherwise erase
372
+ * every intrinsic prop during `Omit`.
360
373
  */
361
374
  type StripIndexSignature<T> = {
362
375
  [K in keyof T as string extends K ? never : K]: T[K];
@@ -366,18 +379,16 @@ type ComponentProps<G extends PolymorphicGenerics> = StripIndexSignature<PropsOf
366
379
  /** Variant props generated from the component's variant definitions. */
367
380
  type ComponentVariants<G extends PolymorphicGenerics> = StripIndexSignature<VariantProps<VariantsOf<G>>>;
368
381
  /**
369
- * Props owned by the component itself.
382
+ * Props defined by the component itself.
370
383
  *
371
- * These take precedence over intrinsic HTML props when names overlap.
384
+ * These override intrinsic JSX props with the same name.
372
385
  */
373
386
  type OwnedProps<G extends PolymorphicGenerics> = ComponentProps<G> & ComponentVariants<G>;
374
387
  /**
375
- * Polymorphic rendering controls.
388
+ * Props that control how the component renders.
376
389
  *
377
- * These describe *how* the component renders rather than the data it owns.
378
- *
379
- * `children` and `asChild` are intentionally omitted so each render mode
380
- * can provide its own stricter contract.
390
+ * `children` and `asChild` are intentionally omitted so each render
391
+ * strategy can define its own contract.
381
392
  */
382
393
  type PolymorphicControlProps<G extends PolymorphicGenerics, TAs extends ElementType> = {
383
394
  /**
@@ -397,22 +408,21 @@ type PolymorphicControlProps<G extends PolymorphicGenerics, TAs extends ElementT
397
408
  ref?: Ref<ElementRef<TAs>>;
398
409
  };
399
410
  /**
400
- * Complete set of props owned by the component.
411
+ * All props reserved by the polymorphic component.
401
412
  *
402
- * Used primarily as the exclusion list when inheriting intrinsic JSX props.
413
+ * Used primarily to exclude conflicting intrinsic JSX props.
403
414
  */
404
415
  type ControlProps<G extends PolymorphicGenerics, TAs extends ElementType> = OwnedProps<G> & PolymorphicControlProps<G, TAs>;
405
416
  /**
406
- * Intrinsic JSX props after removing every prop owned by the component.
417
+ * Intrinsic JSX props after removing every reserved component prop.
407
418
  *
408
- * Component props always win over intrinsic props with the same name.
419
+ * Component-defined props always take precedence.
409
420
  */
410
421
  type IntrinsicPropsWithoutOwned<G extends PolymorphicGenerics, TAs extends ElementType> = Omit<IntrinsicJSXProps<TAs>, keyof ControlProps<G, TAs> | 'children'>;
411
422
  /**
412
- * Base props shared by every render mode.
423
+ * Props shared by every rendering strategy.
413
424
  *
414
- * Render modes contribute only their discriminants (`asChild`, `render`,
415
- * `children`, etc.).
425
+ * Each render mode contributes only its discriminating props.
416
426
  */
417
427
  type BaseProps<G extends PolymorphicGenerics, TAs extends ElementType> = IntrinsicPropsWithoutOwned<G, TAs> & ControlProps<G, TAs>;
418
428
  /** Standard rendering (`asChild` absent or false). */
@@ -432,12 +442,9 @@ type SlotRenderMode = {
432
442
  children: ReactElement | NonEmptyTuple<ReactElement>;
433
443
  };
434
444
  /**
435
- * Render callback.
436
- *
437
- * The callback receives fully resolved props (classes, refs, filtered props)
438
- * and is responsible for rendering the target element.
445
+ * Render callback mode.
439
446
  *
440
- * This provides the flexibility of `asChild` without `cloneElement`.
447
+ * Receives the fully resolved props and returns the rendered element.
441
448
  */
442
449
  type CallbackRenderMode = {
443
450
  render: (props: RenderCallbackProps) => ReactElement;
@@ -463,16 +470,26 @@ type PolymorphicWithRender<G extends PolymorphicGenerics, TAs extends ElementTyp
463
470
  /**
464
471
  * A polymorphic React component.
465
472
  *
466
- * Overloads form a discriminated union:
473
+ * Overloads provide three rendering strategies:
467
474
  *
468
- * `render` render callback
469
- * `asChild` Slot rendering
470
- * otherwise → normal rendering
475
+ * - `render` render callback
476
+ * - `asChild` slot rendering
477
+ * - default — standard polymorphic rendering
471
478
  */
472
479
  type PolymorphicComponent<G extends PolymorphicGenerics> = {
473
480
  <TAs extends ElementType = DefaultOf<G>>(props: PolymorphicWithRender<G, TAs>): ReactElement;
474
481
  <TAs extends ElementType = DefaultOf<G>>(props: PolymorphicWithAsChild<G, TAs>): ReactElement;
475
482
  <TAs extends ElementType = DefaultOf<G>>(props: PolymorphicProps<G, TAs>): ReactElement;
483
+ /**
484
+ * Non-generic fallback overload used for type extraction.
485
+ *
486
+ * TypeScript resolves conditional types such as
487
+ * `React.ComponentProps<typeof Component>` against only the final
488
+ * overload. Anchoring that overload to the default element preserves
489
+ * correct prop inference for tools such as Storybook and
490
+ * `React.ComponentProps`.
491
+ */
492
+ (props: PolymorphicProps<G, DefaultOf<G>>): ReactElement;
476
493
  displayName?: string;
477
494
  };
478
495
 
@@ -236,6 +236,7 @@ type AriaResult = ValidResult | AriaInvalidResult;
236
236
 
237
237
  type AriaRule<C extends AriaContext = AriaContext> = ((context: C) => readonly AriaResult[]) & {
238
238
  readonly readsProps?: readonly string[];
239
+ readonly tags?: readonly string[];
239
240
  };
240
241
 
241
242
  type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
@@ -248,6 +249,16 @@ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
248
249
  */
249
250
  readonly diagnostics?: Diagnostics | DiagnosticsMode;
250
251
  readonly aria?: readonly AriaRule[];
252
+ /**
253
+ * Rules that need `AriaPolicyEngine`'s fix-application/caching machinery
254
+ * (`AriaRule`'s `readsProps`, fixable `AriaFix` results) but have no
255
+ * relationship to ARIA semantics — an HTML fact or a security check like a
256
+ * dangerous-URL-scheme guard, for example. Evaluated together with `aria`
257
+ * (both run through the same engine, merged into one rule set) — this is a
258
+ * separate bucket purely so a non-ARIA rule doesn't have to sit under the
259
+ * misleading `aria` name to get the machinery it needs.
260
+ */
261
+ readonly rules?: readonly AriaRule[];
251
262
  readonly children?: readonly ChildRuleInput[];
252
263
  /**
253
264
  * When true, only children matching a `children` rule (or text, per `allowText`)
@@ -331,6 +342,15 @@ type PolymorphicProps<G extends PolymorphicGenerics, TAs extends ElementType = D
331
342
  }) | AsChildProps<G>>;
332
343
  type PolymorphicComponent<G extends PolymorphicGenerics> = {
333
344
  <TAs extends ElementType = DefaultOf<G>>(props: PolymorphicProps<G, TAs>): JSX.Element;
345
+ /**
346
+ * Non-generic fallback overload used for type extraction.
347
+ *
348
+ * TypeScript resolves conditional types such as
349
+ * `ComponentProps<typeof Component>` against only the final overload.
350
+ * Anchoring that overload to the default element preserves correct prop
351
+ * inference for tools such as Storybook and `ComponentProps`.
352
+ */
353
+ (props: PolymorphicProps<G, DefaultOf<G>>): JSX.Element;
334
354
  displayName?: string;
335
355
  };
336
356