@work-rjkashyap/unified-ui 0.1.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +152 -0
  2. package/README.md +365 -0
  3. package/dist/chunk-2JFREULQ.cjs +29 -0
  4. package/dist/chunk-2RGLRX6K.cjs +279 -0
  5. package/dist/chunk-3HHJAYQI.cjs +469 -0
  6. package/dist/chunk-5S5DMH5G.cjs +5983 -0
  7. package/dist/chunk-BIW2RPDU.cjs +73 -0
  8. package/dist/chunk-CWETOWRM.mjs +456 -0
  9. package/dist/chunk-ECIGDEAH.cjs +140 -0
  10. package/dist/chunk-EO4WROWH.mjs +432 -0
  11. package/dist/chunk-EZ2L3XPS.mjs +83 -0
  12. package/dist/chunk-I74E52C5.mjs +271 -0
  13. package/dist/chunk-ITBG42M5.mjs +133 -0
  14. package/dist/chunk-IWJ5VMZ7.mjs +323 -0
  15. package/dist/chunk-KHON2AEM.cjs +342 -0
  16. package/dist/chunk-LSNKPQP7.cjs +58 -0
  17. package/dist/chunk-M2LNQWOB.mjs +63 -0
  18. package/dist/chunk-NMPHV6ZD.mjs +27 -0
  19. package/dist/chunk-QXR4VY7Q.cjs +268 -0
  20. package/dist/chunk-SSGN5QDC.mjs +248 -0
  21. package/dist/chunk-X2WCY4VB.mjs +5836 -0
  22. package/dist/chunk-XCKK6P46.cjs +91 -0
  23. package/dist/chunk-ZBN26FLO.mjs +46 -0
  24. package/dist/chunk-ZPIPKY2J.cjs +478 -0
  25. package/dist/components.cjs +477 -0
  26. package/dist/components.d.cts +3077 -0
  27. package/dist/components.d.ts +3077 -0
  28. package/dist/components.mjs +4 -0
  29. package/dist/index.cjs +1027 -0
  30. package/dist/index.d.cts +30 -0
  31. package/dist/index.d.ts +30 -0
  32. package/dist/index.mjs +17 -0
  33. package/dist/motion-D9wQbcKL.d.cts +80 -0
  34. package/dist/motion-D9wQbcKL.d.ts +80 -0
  35. package/dist/motion.cjs +216 -0
  36. package/dist/motion.d.cts +104 -0
  37. package/dist/motion.d.ts +104 -0
  38. package/dist/motion.mjs +3 -0
  39. package/dist/primitives.cjs +57 -0
  40. package/dist/primitives.d.cts +390 -0
  41. package/dist/primitives.d.ts +390 -0
  42. package/dist/primitives.mjs +4 -0
  43. package/dist/theme.cjs +38 -0
  44. package/dist/theme.d.cts +117 -0
  45. package/dist/theme.d.ts +117 -0
  46. package/dist/theme.mjs +5 -0
  47. package/dist/tokens.cjs +137 -0
  48. package/dist/tokens.d.cts +30 -0
  49. package/dist/tokens.d.ts +30 -0
  50. package/dist/tokens.mjs +4 -0
  51. package/dist/typography-DlvVjEdE.d.cts +146 -0
  52. package/dist/typography-DlvVjEdE.d.ts +146 -0
  53. package/dist/utils.cjs +164 -0
  54. package/dist/utils.d.cts +521 -0
  55. package/dist/utils.d.ts +521 -0
  56. package/dist/utils.mjs +3 -0
  57. package/dist/z-index-B_nTQ3qo.d.cts +422 -0
  58. package/dist/z-index-B_nTQ3qo.d.ts +422 -0
  59. package/package.json +183 -0
  60. package/styles.css +500 -0
@@ -0,0 +1,521 @@
1
+ import { ClassValue } from 'clsx';
2
+ import { ReactNode, ReactElement, ElementType, ComponentPropsWithoutRef, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
3
+
4
+ declare function cn(...inputs: ClassValue[]): string;
5
+ type SlotClasses<S extends string = string> = Partial<Record<S, string>>;
6
+ /**
7
+ * Merge default slot classes with user-provided overrides.
8
+ * Each slot is merged independently using `cn()`.
9
+ */
10
+ declare function mergeSlots<S extends string>(defaults: SlotClasses<S>, overrides?: SlotClasses<S>): Record<S, string>;
11
+ /**
12
+ * The `as` prop type — constrains to valid React element types.
13
+ */
14
+ type AsProp$1<C extends React.ElementType = React.ElementType> = {
15
+ as?: C;
16
+ };
17
+ /**
18
+ * Extracts the props of the given element type, omitting keys that
19
+ * the component itself defines (to prevent collisions).
20
+ */
21
+ type PolymorphicProps$1<C extends React.ElementType, OwnProps = object> = OwnProps & AsProp$1<C> & Omit<React.ComponentPropsWithoutRef<C>, keyof OwnProps | "as">;
22
+ /**
23
+ * Ref type for a polymorphic component.
24
+ */
25
+ type PolymorphicRef<C extends React.ElementType> = React.ComponentPropsWithRef<C>["ref"];
26
+ /**
27
+ * Full polymorphic component props including the ref.
28
+ */
29
+ type PolymorphicPropsWithRef<C extends React.ElementType, OwnProps = object> = PolymorphicProps$1<C, OwnProps> & {
30
+ ref?: PolymorphicRef<C>;
31
+ };
32
+ /**
33
+ * Returns the data attribute object for a design system component.
34
+ *
35
+ * @example
36
+ * dsAttr("button") → { "data-ds": "", "data-ds-component": "button" }
37
+ */
38
+ declare function dsAttr(componentName: string): Record<string, string>;
39
+ /**
40
+ * Returns a data attribute object for a specific component state.
41
+ *
42
+ * @example
43
+ * dsStateAttr("loading", true) → { "data-ds-loading": "" }
44
+ * dsStateAttr("loading", false) → {}
45
+ */
46
+ declare function dsStateAttr(state: string, active: boolean): Record<string, string>;
47
+ /**
48
+ * Returns a CSS `var()` reference to a design system custom property.
49
+ *
50
+ * @param category - The token category (e.g. "color", "radius", "z")
51
+ * @param name - The token name within that category
52
+ * @param fallback - Optional CSS fallback value
53
+ */
54
+ declare function dsVar(category: string, name: string, fallback?: string): string;
55
+ /**
56
+ * Returns an `rgb(var(...))` reference for color tokens, supporting
57
+ * optional alpha values.
58
+ *
59
+ * @example
60
+ * dsColorVar("primary") → "rgb(var(--ds-color-primary))"
61
+ * dsColorVar("primary", 0.5) → "rgb(var(--ds-color-primary) / 0.5)"
62
+ */
63
+ declare function dsColorVar(name: string, alpha?: number): string;
64
+ type PossibleRef<T> = React.Ref<T> | undefined;
65
+ /**
66
+ * Compose multiple refs into a single ref callback.
67
+ *
68
+ * @example
69
+ * const Component = forwardRef<HTMLDivElement, Props>((props, ref) => {
70
+ * const internalRef = useRef<HTMLDivElement>(null);
71
+ * return <div ref={composeRefs(ref, internalRef)} />;
72
+ * });
73
+ */
74
+ declare function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T | null) => void;
75
+ /**
76
+ * Type-safe Object.keys that preserves key literal types.
77
+ */
78
+ declare function typedKeys<T extends Record<string, unknown>>(obj: T): (keyof T)[];
79
+ /** A no-operation function. Useful as a default callback. */
80
+ declare const noop: () => void;
81
+
82
+ /** An RGB color represented as a tuple of [red, green, blue] (0–255 each). */
83
+ type RGB = readonly [number, number, number];
84
+ /** Text size category for WCAG contrast thresholds. */
85
+ type TextSize = "normal" | "large";
86
+ /** Full result of a contrast check between two colors. */
87
+ interface ContrastResult {
88
+ /** The computed contrast ratio (e.g. 4.56). Always ≥ 1. */
89
+ ratio: number;
90
+ /** Meets WCAG AA for normal text (≥ 4.5:1). */
91
+ aa: boolean;
92
+ /** Meets WCAG AA for large text (≥ 3:1). */
93
+ aaLarge: boolean;
94
+ /** Meets WCAG AAA for normal text (≥ 7:1). */
95
+ aaa: boolean;
96
+ /** Meets WCAG AAA for large text (≥ 4.5:1). */
97
+ aaaLarge: boolean;
98
+ /** Meets WCAG AA for non-text UI components (≥ 3:1). */
99
+ nonTextAA: boolean;
100
+ }
101
+ /** Minimum contrast ratio for WCAG AA normal text. */
102
+ declare const WCAG_AA_NORMAL = 4.5;
103
+ /** Minimum contrast ratio for WCAG AA large text. */
104
+ declare const WCAG_AA_LARGE = 3;
105
+ /** Minimum contrast ratio for WCAG AAA normal text. */
106
+ declare const WCAG_AAA_NORMAL = 7;
107
+ /** Minimum contrast ratio for WCAG AAA large text. */
108
+ declare const WCAG_AAA_LARGE = 4.5;
109
+ /** Minimum contrast ratio for WCAG AA non-text UI components (SC 1.4.11). */
110
+ declare const WCAG_NON_TEXT_AA = 3;
111
+ /**
112
+ * Calculate the relative luminance of an sRGB color.
113
+ *
114
+ * @param color - RGB tuple [r, g, b] with values in 0–255 range
115
+ * @returns Relative luminance in 0–1 range (0 = black, 1 = white)
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * relativeLuminance([255, 255, 255]) // → 1.0 (white)
120
+ * relativeLuminance([0, 0, 0]) // → 0.0 (black)
121
+ * relativeLuminance([79, 70, 229]) // → ~0.067 (indigo)
122
+ * ```
123
+ */
124
+ declare function relativeLuminance(color: RGB): number;
125
+ /**
126
+ * Calculate the WCAG contrast ratio between two colors.
127
+ *
128
+ * @param foreground - RGB tuple [r, g, b] for the foreground (text) color
129
+ * @param background - RGB tuple [r, g, b] for the background color
130
+ * @returns Contrast ratio ≥ 1.0 (e.g. 4.5 means "4.5:1")
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * contrastRatio([0, 0, 0], [255, 255, 255]) // → 21.0 (max)
135
+ * contrastRatio([255, 255, 255], [0, 0, 0]) // → 21.0 (order doesn't matter)
136
+ * contrastRatio([79, 70, 229], [255, 255, 255]) // → ~4.56
137
+ * ```
138
+ */
139
+ declare function contrastRatio(foreground: RGB, background: RGB): number;
140
+ /**
141
+ * Check if a contrast ratio meets WCAG AA requirements.
142
+ *
143
+ * @param ratio - The contrast ratio to check
144
+ * @param textSize - "normal" (default, ≥ 4.5:1) or "large" (≥ 3:1)
145
+ * @returns `true` if the ratio meets the AA threshold
146
+ */
147
+ declare function meetsAA(ratio: number, textSize?: TextSize): boolean;
148
+ /**
149
+ * Check if a contrast ratio meets WCAG AAA requirements.
150
+ *
151
+ * @param ratio - The contrast ratio to check
152
+ * @param textSize - "normal" (default, ≥ 7:1) or "large" (≥ 4.5:1)
153
+ * @returns `true` if the ratio meets the AAA threshold
154
+ */
155
+ declare function meetsAAA(ratio: number, textSize?: TextSize): boolean;
156
+ /**
157
+ * Check if a contrast ratio meets WCAG AA for non-text elements (SC 1.4.11).
158
+ * This applies to UI component boundaries, focus indicators, and graphical objects.
159
+ *
160
+ * @param ratio - The contrast ratio to check
161
+ * @returns `true` if the ratio meets ≥ 3:1
162
+ */
163
+ declare function meetsNonTextAA(ratio: number): boolean;
164
+ /**
165
+ * Parse a space-separated RGB string (as used in `design-system.css`) into
166
+ * an RGB tuple.
167
+ *
168
+ * @param rgbString - Space-separated RGB channels, e.g. "79 70 229"
169
+ * @returns RGB tuple [r, g, b]
170
+ * @throws {Error} If the string is not a valid 3-channel RGB value
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * parseRGBString("79 70 229") // → [79, 70, 229]
175
+ * parseRGBString("255 255 255") // → [255, 255, 255]
176
+ * ```
177
+ */
178
+ declare function parseRGBString(rgbString: string): RGB;
179
+ /**
180
+ * Convert an RGB tuple back to a space-separated string.
181
+ *
182
+ * @param color - RGB tuple [r, g, b]
183
+ * @returns Space-separated string, e.g. "79 70 229"
184
+ */
185
+ declare function toRGBString(color: RGB): string;
186
+ /**
187
+ * Parse a hex color string into an RGB tuple.
188
+ *
189
+ * @param hex - Hex color string (with or without #), supports 3 or 6 digits
190
+ * @returns RGB tuple [r, g, b]
191
+ * @throws {Error} If the string is not a valid hex color
192
+ *
193
+ * @example
194
+ * ```ts
195
+ * parseHex("#4F46E5") // → [79, 70, 229]
196
+ * parseHex("4F46E5") // → [79, 70, 229]
197
+ * parseHex("#fff") // → [255, 255, 255]
198
+ * ```
199
+ */
200
+ declare function parseHex(hex: string): RGB;
201
+ /**
202
+ * Perform a comprehensive WCAG contrast check between two colors.
203
+ * Accepts the space-separated RGB strings used in `design-system.css`.
204
+ *
205
+ * @param fgRGBString - Foreground color as "R G B" string (e.g. "255 255 255")
206
+ * @param bgRGBString - Background color as "R G B" string (e.g. "79 70 229")
207
+ * @returns Full contrast result with ratio and pass/fail for each WCAG level
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * const result = checkDSContrast("255 255 255", "79 70 229");
212
+ * // → {
213
+ * // ratio: 4.56,
214
+ * // aa: true,
215
+ * // aaLarge: true,
216
+ * // aaa: false,
217
+ * // aaaLarge: true,
218
+ * // nonTextAA: true,
219
+ * // }
220
+ * ```
221
+ */
222
+ declare function checkDSContrast(fgRGBString: string, bgRGBString: string): ContrastResult;
223
+ /**
224
+ * Perform a comprehensive WCAG contrast check between two hex colors.
225
+ *
226
+ * @param fgHex - Foreground hex color (e.g. "#FFFFFF")
227
+ * @param bgHex - Background hex color (e.g. "#4F46E5")
228
+ * @returns Full contrast result with ratio and pass/fail for each WCAG level
229
+ */
230
+ declare function checkHexContrast(fgHex: string, bgHex: string): ContrastResult;
231
+ /** A named color pair for batch auditing. */
232
+ interface ColorPair {
233
+ /** Human-readable label for the pair (e.g. "primary on background"). */
234
+ label: string;
235
+ /** Foreground color as space-separated RGB string. */
236
+ fg: string;
237
+ /** Background color as space-separated RGB string. */
238
+ bg: string;
239
+ }
240
+ /** Result of a single pair in a batch audit. */
241
+ interface AuditResult extends ContrastResult {
242
+ /** The label from the input pair. */
243
+ label: string;
244
+ /** The foreground RGB string. */
245
+ fg: string;
246
+ /** The background RGB string. */
247
+ bg: string;
248
+ }
249
+ /**
250
+ * Audit multiple color pairs against WCAG contrast requirements.
251
+ * Returns results for each pair, making it easy to identify failing
252
+ * combinations during design system QA.
253
+ *
254
+ * @param pairs - Array of labeled color pairs to check
255
+ * @returns Array of audit results, one per input pair
256
+ *
257
+ * @example
258
+ * ```ts
259
+ * const results = auditContrast([
260
+ * { label: "primary text on bg", fg: "79 70 229", bg: "255 255 255" },
261
+ * { label: "muted text on bg", fg: "113 113 122", bg: "255 255 255" },
262
+ * { label: "danger on white", fg: "220 38 38", bg: "255 255 255" },
263
+ * ]);
264
+ *
265
+ * // Filter to just the failures:
266
+ * const failures = results.filter((r) => !r.aa);
267
+ * ```
268
+ */
269
+ declare function auditContrast(pairs: ColorPair[]): AuditResult[];
270
+ /**
271
+ * Critical color pairs from the Unified UI light theme that must meet
272
+ * WCAG AA contrast. Use with `auditContrast()` for automated checks.
273
+ *
274
+ * @example
275
+ * ```ts
276
+ * const results = auditContrast(DS_LIGHT_CRITICAL_PAIRS);
277
+ * const failures = results.filter((r) => !r.aa);
278
+ * if (failures.length > 0) {
279
+ * console.error("WCAG AA failures:", failures);
280
+ * }
281
+ * ```
282
+ */
283
+ declare const DS_LIGHT_CRITICAL_PAIRS: ColorPair[];
284
+ /**
285
+ * Critical color pairs from the Unified UI dark theme that must meet
286
+ * WCAG AA contrast. Use with `auditContrast()` for automated checks.
287
+ */
288
+ declare const DS_DARK_CRITICAL_PAIRS: ColorPair[];
289
+
290
+ /**
291
+ * Standard focus ring classes for interactive elements.
292
+ * Uses `focus-visible` for keyboard-only visibility.
293
+ * Includes a 2px offset to separate the ring from the element.
294
+ */
295
+ declare const focusRingClasses: "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ds-focus-ring focus-visible:ring-offset-2 focus-visible:ring-offset-ds-background";
296
+ /**
297
+ * Array variant of the standard focus ring classes.
298
+ * Useful when building CVA base class arrays.
299
+ *
300
+ * @example
301
+ * ```ts
302
+ * const buttonVariants = cva([...focusRingClassList, "inline-flex"], { ... });
303
+ * ```
304
+ */
305
+ declare const focusRingClassList: readonly ["focus-visible:outline-none", "focus-visible:ring-2", "focus-visible:ring-ds-focus-ring", "focus-visible:ring-offset-2", "focus-visible:ring-offset-ds-background"];
306
+ /**
307
+ * Focus ring classes without ring-offset, for elements inside containers.
308
+ * Avoids the offset gap that can look odd when the element is flush
309
+ * against a parent boundary.
310
+ */
311
+ declare const focusRingInsetClasses: "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ds-focus-ring";
312
+ /**
313
+ * Array variant of the inset focus ring classes.
314
+ */
315
+ declare const focusRingInsetClassList: readonly ["focus-visible:outline-none", "focus-visible:ring-2", "focus-visible:ring-ds-focus-ring"];
316
+ /**
317
+ * Compact focus ring with a 1px offset. For small interactive elements.
318
+ */
319
+ declare const focusRingCompactClasses: "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ds-focus-ring focus-visible:ring-offset-1";
320
+ /**
321
+ * Array variant of the compact focus ring classes.
322
+ */
323
+ declare const focusRingCompactClassList: readonly ["focus-visible:outline-none", "focus-visible:ring-2", "focus-visible:ring-ds-focus-ring", "focus-visible:ring-offset-1"];
324
+ /**
325
+ * Focus ring variant strings for use with error/success/warning states.
326
+ * Replace the ring color with the appropriate semantic color.
327
+ *
328
+ * @example
329
+ * ```ts
330
+ * cn(
331
+ * focusRingClasses,
332
+ * hasError && focusRingVariantOverrides.danger,
333
+ * )
334
+ * ```
335
+ */
336
+ declare const focusRingVariantOverrides: {
337
+ /** Override ring color to danger red */
338
+ readonly danger: "focus-visible:ring-ds-danger";
339
+ /** Override ring color to success green */
340
+ readonly success: "focus-visible:ring-ds-success";
341
+ /** Override ring color to warning amber */
342
+ readonly warning: "focus-visible:ring-ds-warning";
343
+ /** Override ring color to info blue */
344
+ readonly info: "focus-visible:ring-ds-info";
345
+ /** Override ring color to current text color */
346
+ readonly current: "focus-visible:ring-current";
347
+ };
348
+ type FocusRingVariant = keyof typeof focusRingVariantOverrides;
349
+ /**
350
+ * Classes to apply on the focusable child element (add `group` to parent).
351
+ */
352
+ declare const focusRingGroupTriggerClasses: "focus-visible:outline-none";
353
+ /**
354
+ * Classes to apply on the parent element that shows the ring.
355
+ * The parent must have the `group` class.
356
+ */
357
+ declare const focusRingGroupRingClasses: "group-focus-visible:ring-2 group-focus-visible:ring-ds-focus-ring group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-ds-background";
358
+ /**
359
+ * Focus ring that activates when any descendant receives focus.
360
+ * Apply to the wrapper element (e.g., an input wrapper with icons).
361
+ */
362
+ declare const focusWithinRingClasses: "focus-within:outline-none focus-within:ring-2 focus-within:ring-ds-focus-ring focus-within:ring-offset-2 focus-within:ring-offset-ds-background";
363
+ /**
364
+ * Array variant of the focus-within ring classes.
365
+ */
366
+ declare const focusWithinRingClassList: readonly ["focus-within:outline-none", "focus-within:ring-2", "focus-within:ring-ds-focus-ring", "focus-within:ring-offset-2", "focus-within:ring-offset-ds-background"];
367
+
368
+ /**
369
+ * Extracts the `as` prop from a set of props.
370
+ *
371
+ * @template Default - The default element type when `as` is not specified.
372
+ */
373
+ type AsProp<Default extends ElementType = "div"> = {
374
+ /**
375
+ * The HTML element or React component to render as.
376
+ * @default Default (varies per component)
377
+ */
378
+ as?: ElementType;
379
+ };
380
+ /**
381
+ * Merges a component's own props with the intrinsic props of the target
382
+ * element type specified by `as`, omitting any keys that the component
383
+ * already defines (component props take precedence).
384
+ *
385
+ * @template OwnProps - The component's own prop interface.
386
+ * @template E - The element type (from `as` prop or default).
387
+ */
388
+ type MergedProps<OwnProps, E extends ElementType> = OwnProps & Omit<ComponentPropsWithoutRef<E>, keyof OwnProps>;
389
+ /**
390
+ * The complete prop type for a polymorphic component, including `as`,
391
+ * the component's own props, and the target element's intrinsic props.
392
+ *
393
+ * @template OwnProps - The component's own prop interface.
394
+ * @template Default - The default element type when `as` is not specified.
395
+ *
396
+ * @example
397
+ * ```tsx
398
+ * type TextProps = PolymorphicProps<{ variant: "body" | "caption" }, "p">;
399
+ * ```
400
+ */
401
+ type PolymorphicProps<OwnProps = Record<string, never>, Default extends ElementType = "div"> = AsProp<Default> & MergedProps<OwnProps, Default>;
402
+ /**
403
+ * Represents a polymorphic forward-ref component. Use this as the return
404
+ * type when defining polymorphic components with `React.forwardRef`.
405
+ *
406
+ * @template OwnProps - The component's own prop interface.
407
+ * @template Default - The default element type.
408
+ */
409
+ type PolymorphicComponent<OwnProps = Record<string, never>, Default extends ElementType = "div"> = ForwardRefExoticComponent<PropsWithoutRef<PolymorphicProps<OwnProps, Default>> & RefAttributes<Element>>;
410
+ /**
411
+ * Configuration for a single slot within a composite component.
412
+ * Each slot can be customized with className, style, or replaced entirely.
413
+ */
414
+ interface SlotConfig {
415
+ /** Additional CSS classes to merge with the slot's default classes */
416
+ className?: string;
417
+ /** Inline style overrides for the slot element */
418
+ style?: React.CSSProperties;
419
+ }
420
+ /**
421
+ * A render function slot — replaces the default slot rendering entirely.
422
+ * Receives the default children and props so the consumer can wrap or
423
+ * augment the default behavior.
424
+ */
425
+ type SlotRenderFn<P = Record<string, never>> = (props: P & {
426
+ children?: ReactNode;
427
+ className?: string;
428
+ }) => ReactElement;
429
+ /**
430
+ * A slot definition that accepts either a static config or a render function.
431
+ */
432
+ type SlotDefinition<P = Record<string, never>> = SlotConfig | SlotRenderFn<P>;
433
+ /**
434
+ * Creates a typed slots interface for a composite component.
435
+ *
436
+ * @template SlotNames - A union of string literal slot names.
437
+ *
438
+ * @example
439
+ * ```tsx
440
+ * type CardSlots = Slots<"header" | "body" | "footer">;
441
+ *
442
+ * interface CardProps {
443
+ * slots?: CardSlots;
444
+ * }
445
+ * ```
446
+ */
447
+ type Slots<SlotNames extends string> = Partial<Record<SlotNames, SlotDefinition>>;
448
+ /**
449
+ * Extracts the variant keys from a variant configuration object.
450
+ *
451
+ * @example
452
+ * ```tsx
453
+ * const variants = { primary: "...", secondary: "...", ghost: "..." } as const;
454
+ * type ButtonVariant = VariantKey<typeof variants>;
455
+ * // → "primary" | "secondary" | "ghost"
456
+ * ```
457
+ */
458
+ type VariantKey<T extends Record<string, unknown>> = keyof T & string;
459
+ /**
460
+ * Standard size scale used across interactive components.
461
+ * Components should support at minimum `sm`, `md`, and `lg`.
462
+ */
463
+ type ComponentSize = "sm" | "md" | "lg";
464
+ /**
465
+ * Standard intent/purpose variants used across interactive components.
466
+ */
467
+ type ComponentIntent = "primary" | "secondary" | "danger" | "ghost";
468
+ /**
469
+ * A component that accepts `children` as its only required prop.
470
+ * Useful for layout primitives (Stack, Container, Grid).
471
+ */
472
+ interface ChildrenProps {
473
+ children: ReactNode;
474
+ }
475
+ /**
476
+ * A component that accepts optional `children`.
477
+ */
478
+ interface OptionalChildrenProps {
479
+ children?: ReactNode;
480
+ }
481
+ /**
482
+ * A render-prop pattern where children is a function.
483
+ *
484
+ * @template T - The argument type passed to the render function.
485
+ */
486
+ interface RenderChildrenProps<T = undefined> {
487
+ children: T extends undefined ? () => ReactNode : (value: T) => ReactNode;
488
+ }
489
+ /**
490
+ * Generates a data attribute object for a design system component.
491
+ * All DS components should include `data-ds` for scoping and
492
+ * `data-ds-component` for identification.
493
+ *
494
+ * @param name - The component name (e.g. "button", "input", "card").
495
+ * @returns An object with the data attributes to spread onto the element.
496
+ *
497
+ * @example
498
+ * ```tsx
499
+ * <div {...dsDataAttrs("card")} className={...}>
500
+ * {children}
501
+ * </div>
502
+ * // Renders: <div data-ds data-ds-component="card">
503
+ * ```
504
+ */
505
+ declare function dsDataAttrs(name: string): Record<string, string | boolean>;
506
+ /**
507
+ * Makes specific keys of T required while keeping the rest unchanged.
508
+ */
509
+ type RequireKeys<T, K extends keyof T> = T & Required<Pick<T, K>>;
510
+ /**
511
+ * Makes all properties of T optional except for the specified keys.
512
+ */
513
+ type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>;
514
+ /**
515
+ * Removes `undefined` from the value type of each property in T.
516
+ */
517
+ type Defined<T> = {
518
+ [K in keyof T]-?: Exclude<T[K], undefined>;
519
+ };
520
+
521
+ export { type AsProp$1 as AsProp, type AuditResult, type ChildrenProps, type ColorPair, type ComponentIntent, type ComponentSize, type ContrastResult, DS_DARK_CRITICAL_PAIRS, DS_LIGHT_CRITICAL_PAIRS, type Defined, type FocusRingVariant, type MergedProps, type OptionalChildrenProps, type PartialExcept, type PolymorphicComponent, type PolymorphicProps$1 as PolymorphicProps, type PolymorphicPropsWithRef, type PolymorphicRef, type RGB, type RenderChildrenProps, type RequireKeys, type SlotClasses, type SlotConfig, type SlotDefinition, type SlotRenderFn, type Slots, type TextSize, type VariantKey, WCAG_AAA_LARGE, WCAG_AAA_NORMAL, WCAG_AA_LARGE, WCAG_AA_NORMAL, WCAG_NON_TEXT_AA, auditContrast, checkDSContrast, checkHexContrast, cn, composeRefs, contrastRatio, dsAttr, dsColorVar, dsDataAttrs, dsStateAttr, dsVar, focusRingClassList, focusRingClasses, focusRingCompactClassList, focusRingCompactClasses, focusRingGroupRingClasses, focusRingGroupTriggerClasses, focusRingInsetClassList, focusRingInsetClasses, focusRingVariantOverrides, focusWithinRingClassList, focusWithinRingClasses, meetsAA, meetsAAA, meetsNonTextAA, mergeSlots, noop, parseHex, parseRGBString, relativeLuminance, toRGBString, typedKeys };
package/dist/utils.mjs ADDED
@@ -0,0 +1,3 @@
1
+ export { DS_DARK_CRITICAL_PAIRS, DS_LIGHT_CRITICAL_PAIRS, WCAG_AAA_LARGE, WCAG_AAA_NORMAL, WCAG_AA_LARGE, WCAG_AA_NORMAL, WCAG_NON_TEXT_AA, auditContrast, checkDSContrast, checkHexContrast, contrastRatio, dsDataAttrs, meetsAA, meetsAAA, meetsNonTextAA, parseHex, parseRGBString, relativeLuminance, toRGBString } from './chunk-SSGN5QDC.mjs';
2
+ export { focusRingClassList, focusRingClasses, focusRingCompactClassList, focusRingCompactClasses, focusRingGroupRingClasses, focusRingGroupTriggerClasses, focusRingInsetClassList, focusRingInsetClasses, focusRingVariantOverrides, focusWithinRingClassList, focusWithinRingClasses } from './chunk-ZBN26FLO.mjs';
3
+ export { cn, composeRefs, dsAttr, dsColorVar, dsStateAttr, dsVar, mergeSlots, noop, typedKeys } from './chunk-M2LNQWOB.mjs';