@dev-dga/react 0.2.0 → 0.4.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.
- package/CHANGELOG.md +48 -0
- package/README.md +54 -6
- package/dist/index.cjs +906 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +152 -5
- package/dist/index.d.ts +152 -5
- package/dist/index.js +878 -36
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/components/Button/Button.tsx","../src/utils/cn.ts","../src/internal/icons/index.tsx","../src/components/Input/Input.tsx","../src/internal/field/use-field-a11y.ts","../src/internal/field/FieldMessage.tsx","../src/components/Textarea/Textarea.tsx","../src/components/Checkbox/Checkbox.tsx","../src/providers/DgaProvider.tsx","../src/providers/DgaContext.ts","../src/hooks/useDir.ts"],"sourcesContent":["export { Button, buttonVariants, type ButtonProps } from './components/Button';\nexport { Input, inputVariants, type InputProps } from './components/Input';\nexport { Textarea, textareaVariants, type TextareaProps } from './components/Textarea';\nexport { Checkbox, checkboxVariants, type CheckboxProps } from './components/Checkbox';\nexport { DgaProvider, type DgaProviderProps } from './providers/DgaProvider';\nexport { useDga } from './providers/DgaContext';\nexport { useDir } from './hooks/useDir';\nexport { cn } from './utils/cn';\n","'use client';\n\nimport { type ReactNode } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { Spinner } from '../../internal/icons';\n\n// ─── 1. Variants (cva) ─── //\n\nconst buttonVariants = cva('ddga-button', {\n variants: {\n variant: {\n primary: 'ddga-button--primary',\n secondary: 'ddga-button--secondary',\n outline: 'ddga-button--outline',\n ghost: 'ddga-button--ghost',\n destructive: 'ddga-button--destructive',\n },\n size: {\n sm: 'ddga-button--sm',\n md: 'ddga-button--md',\n lg: 'ddga-button--lg',\n icon: 'ddga-button--icon',\n 'icon-sm': 'ddga-button--icon-sm',\n },\n fullWidth: {\n true: 'ddga-button--full-width',\n },\n },\n compoundVariants: [],\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n});\n\n// ─── 2. Types ─── //\n\ninterface ButtonProps extends React.ComponentProps<'button'>, VariantProps<typeof buttonVariants> {\n loading?: boolean;\n startIcon?: ReactNode;\n endIcon?: ReactNode;\n /** Flip start/end icons horizontally in RTL (for chevrons, arrows, etc.) */\n iconFlip?: boolean;\n}\n\n// ─── 3. Component ─── //\n\nfunction Button({\n variant,\n size,\n fullWidth,\n loading,\n disabled,\n startIcon,\n endIcon,\n iconFlip,\n className,\n children,\n type = 'button',\n ...props\n}: ButtonProps) {\n // Dev-only: warn if icon-only button has no accessible name\n if (process.env.NODE_ENV === 'development' && (size === 'icon' || size === 'icon-sm')) {\n if (!props['aria-label'] && !props['aria-labelledby']) {\n console.warn(\n '[@dev-dga/react] Button with an icon-only size (size=\"icon\" or ' +\n '\"icon-sm\") requires an aria-label or aria-labelledby attribute ' +\n 'for screen reader accessibility.',\n );\n }\n }\n\n const isDisabled = disabled || loading;\n\n return (\n <button\n type={type}\n disabled={isDisabled}\n // Both disabled and aria-disabled are set intentionally:\n // - disabled: removes from tab order and prevents interaction\n // - aria-disabled: explicit signal for ARIA consumers that don't read native disabled\n aria-disabled={isDisabled || undefined}\n aria-busy={loading || undefined}\n data-slot=\"button\"\n className={cn(\n buttonVariants({ variant, size, fullWidth }),\n loading && 'ddga-button--loading',\n className,\n )}\n {...props}\n >\n {loading && <Spinner aria-hidden=\"true\" />}\n {!loading && startIcon && (\n <span className={cn('ddga-button__icon', iconFlip && 'ddga-icon-flip')} aria-hidden=\"true\">\n {startIcon}\n </span>\n )}\n {children != null && children !== '' && <span className=\"ddga-button__text\">{children}</span>}\n {!loading && endIcon && (\n <span className={cn('ddga-button__icon', iconFlip && 'ddga-icon-flip')} aria-hidden=\"true\">\n {endIcon}\n </span>\n )}\n </button>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Button, buttonVariants };\nexport type { ButtonProps };\n","import { clsx, type ClassValue } from 'clsx';\n\nexport function cn(...inputs: ClassValue[]) {\n return clsx(inputs);\n}\n","'use client';\n\n/**\n * Internal loading spinner icon.\n * Not exported from the public API , used only by Button and similar components.\n */\nexport function Spinner(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"ddga-spinner\"\n {...props}\n >\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n );\n}\n\n/**\n * Internal checkmark icon , used by Checkbox (checked state).\n * Not exported from the public API.\n */\nexport function Check(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n );\n}\n\n/**\n * Internal minus/dash icon , used by Checkbox (indeterminate state).\n * Not exported from the public API.\n */\nexport function Minus(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M5 12h14\" />\n </svg>\n );\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { useFieldA11y, FieldMessage } from '../../internal/field';\n\n// ─── 1. Variants (cva) ─── //\n\n// Applied to the *control* (the bordered box), not the raw <input>. The\n// control owns the border, sizing, focus ring and disabled/error styling\n// so leading/trailing adornments sit inside the field.\nconst inputVariants = cva('ddga-input', {\n variants: {\n size: {\n sm: 'ddga-input--sm',\n md: 'ddga-input--md',\n lg: 'ddga-input--lg',\n },\n error: {\n true: 'ddga-input--error',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\n// ─── 2. Types ─── //\n\n// `Omit<…, 'size'>`: the native HTML `size` attribute (visible character\n// width, a number) collides with our design-system `size` variant. The\n// variant is far more useful; drop the rarely-used native attribute.\ninterface InputProps\n extends Omit<React.ComponentProps<'input'>, 'size'>, VariantProps<typeof inputVariants> {\n /** Visible field label, auto-associated to the input via `htmlFor`/`id`. */\n label?: ReactNode;\n /** Hint shown below the field. Hidden while an error message is showing. */\n helperText?: ReactNode;\n /** Message shown below the field when `error` is true. */\n errorMessage?: ReactNode;\n /** Marks the field invalid: sets `aria-invalid` and error styling. */\n error?: boolean;\n /**\n * Content rendered inside the field, before the input (icon or short text,\n * e.g. a search glyph or `https://`). May be interactive , it is NOT\n * `aria-hidden`. Mark purely-decorative icons `aria-hidden` yourself.\n */\n startAdornment?: ReactNode;\n /**\n * Content rendered inside the field, after the input. Compose a clear\n * button or password-reveal toggle here with `<Button size=\"icon-sm\">`\n * , the 28px in-field icon size that fits the field without overflow.\n */\n endAdornment?: ReactNode;\n}\n\n// ─── 3. Component ─── //\n\nfunction Input({\n id: externalId,\n label,\n helperText,\n errorMessage,\n error,\n size,\n required,\n startAdornment,\n endAdornment,\n className,\n ...props\n}: InputProps) {\n const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } =\n useFieldA11y({\n name: 'Input',\n id: externalId,\n label,\n error,\n errorMessage,\n helperText,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n });\n\n return (\n <div data-slot=\"input-field\" className=\"ddga-field\">\n {label && (\n <label htmlFor={fieldId} className=\"ddga-input__label\">\n {label}\n {required && (\n <span aria-hidden=\"true\" className=\"ddga-input__required\">\n *\n </span>\n )}\n </label>\n )}\n <div\n data-slot=\"input-control\"\n className={cn(inputVariants({ size, error: hasError }), className)}\n >\n {startAdornment != null && startAdornment !== '' && (\n <span\n data-slot=\"input-adornment\"\n className=\"ddga-input__adornment ddga-input__adornment--start\"\n >\n {startAdornment}\n </span>\n )}\n <input\n // Spread props first, then the a11y contract (controlProps) so a\n // consumer cannot accidentally clobber the wiring.\n {...props}\n {...controlProps}\n data-slot=\"input\"\n required={required}\n className=\"ddga-input__field\"\n />\n {endAdornment != null && endAdornment !== '' && (\n <span\n data-slot=\"input-adornment\"\n className=\"ddga-input__adornment ddga-input__adornment--end\"\n >\n {endAdornment}\n </span>\n )}\n </div>\n {hasErrorMessage && (\n <FieldMessage id={errorId} variant=\"error\">\n {errorMessage}\n </FieldMessage>\n )}\n {hasHelper && (\n <FieldMessage id={helperId} variant=\"helper\">\n {helperText}\n </FieldMessage>\n )}\n </div>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Input, inputVariants };\nexport type { InputProps };\n","import { useId, type ReactNode } from 'react';\n\n// Internal , not part of the public API. Shared by Input / Textarea /\n// Checkbox (and future form controls) so the id generation, error/helper\n// precedence, control ARIA wiring, and dev-time a11y warning live in\n// exactly one place instead of being hand-rolled per component.\n\ninterface UseFieldA11yOptions {\n /** Component name used in the dev warning, e.g. `'Input'`. */\n name: string;\n /** Caller-supplied id; falls back to a stable generated one. */\n id?: string;\n label?: ReactNode;\n error?: boolean;\n errorMessage?: ReactNode;\n helperText?: ReactNode;\n /** From the consumer's props , used to suppress the no-label warning. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\ninterface FieldA11y {\n fieldId: string;\n helperId: string;\n errorId: string;\n hasError: boolean;\n hasErrorMessage: boolean;\n hasHelper: boolean;\n /** Spread onto the control element (input / textarea / Radix root). */\n controlProps: {\n id: string;\n 'aria-invalid': true | undefined;\n 'aria-describedby': string | undefined;\n };\n}\n\nfunction isPresent(value: ReactNode): boolean {\n return value != null && value !== '';\n}\n\nexport function useFieldA11y(options: UseFieldA11yOptions): FieldA11y {\n // useId() is SSR-safe , stable across server/client, no hydration mismatch.\n const generatedId = useId();\n const fieldId = options.id ?? generatedId;\n const helperId = `${fieldId}-helper`;\n const errorId = `${fieldId}-error`;\n\n const hasError = !!options.error;\n const hasErrorMessage = hasError && isPresent(options.errorMessage);\n // An error message replaces helper text (one description at a time).\n const hasHelper = !hasErrorMessage && isPresent(options.helperText);\n\n // Dev-only: warn if the field has no accessible name. This library makes\n // the accessible path the default across every form control.\n if (process.env.NODE_ENV === 'development' && !options.label) {\n if (!options['aria-label'] && !options['aria-labelledby']) {\n console.warn(\n `[@dev-dga/react] ${options.name} requires a \\`label\\`, or an ` +\n 'aria-label / aria-labelledby attribute, for screen reader accessibility.',\n );\n }\n }\n\n return {\n fieldId,\n helperId,\n errorId,\n hasError,\n hasErrorMessage,\n hasHelper,\n controlProps: {\n id: fieldId,\n 'aria-invalid': hasError || undefined,\n 'aria-describedby': hasErrorMessage ? errorId : hasHelper ? helperId : undefined,\n },\n };\n}\n","import type { ReactNode } from 'react';\n\n// Internal , not public API. The helper / error line below a form control.\n// Identical markup and styling across Input / Textarea / Checkbox, so it\n// lives here once. No 'use client': pure markup, no hooks or client APIs.\n\ninterface FieldMessageProps {\n id: string;\n /** `error` announces politely; `helper` is static. */\n variant: 'error' | 'helper';\n children: ReactNode;\n}\n\nexport function FieldMessage({ id, variant, children }: FieldMessageProps) {\n return (\n <p\n id={id}\n data-slot={`field-${variant}`}\n className={`ddga-field__message ddga-field__message--${variant}`}\n // Polite (not assertive): an assertive error interrupts the user\n // mid-interaction, the wrong UX for field-level validation.\n aria-live={variant === 'error' ? 'polite' : undefined}\n >\n {children}\n </p>\n );\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { useFieldA11y, FieldMessage } from '../../internal/field';\n\n// ─── 1. Variants (cva) ─── //\n\n// Applied to the <textarea> directly: unlike Input there are no adornments,\n// so the field owns its own border / focus ring / state styling , no\n// control wrapper needed.\nconst textareaVariants = cva('ddga-textarea', {\n variants: {\n size: {\n sm: 'ddga-textarea--sm',\n md: 'ddga-textarea--md',\n lg: 'ddga-textarea--lg',\n },\n error: {\n true: 'ddga-textarea--error',\n },\n // Horizontal/both resize breaks form layout (same reason it's not the\n // default) , only vertical or locked are offered.\n resize: {\n vertical: 'ddga-textarea--resize-vertical',\n none: 'ddga-textarea--resize-none',\n },\n },\n defaultVariants: {\n size: 'md',\n resize: 'vertical',\n },\n});\n\n// ─── 2. Types ─── //\n\n// `<textarea>` has no native `size` attribute (unlike `<input>`), so the\n// cva `size` variant doesn't collide , no `Omit` needed.\ninterface TextareaProps\n extends React.ComponentProps<'textarea'>, VariantProps<typeof textareaVariants> {\n /** Visible field label, auto-associated to the textarea via `htmlFor`/`id`. */\n label?: ReactNode;\n /** Hint shown below the field. Hidden while an error message is showing. */\n helperText?: ReactNode;\n /** Message shown below the field when `error` is true. */\n errorMessage?: ReactNode;\n /** Marks the field invalid: sets `aria-invalid` and error styling. */\n error?: boolean;\n}\n\n// ─── 3. Component ─── //\n\nfunction Textarea({\n id: externalId,\n label,\n helperText,\n errorMessage,\n error,\n size,\n resize,\n required,\n rows = 3,\n className,\n ...props\n}: TextareaProps) {\n const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } =\n useFieldA11y({\n name: 'Textarea',\n id: externalId,\n label,\n error,\n errorMessage,\n helperText,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n });\n\n return (\n <div data-slot=\"textarea-field\" className=\"ddga-field\">\n {label && (\n <label htmlFor={fieldId} className=\"ddga-textarea__label\">\n {label}\n {required && (\n <span aria-hidden=\"true\" className=\"ddga-textarea__required\">\n *\n </span>\n )}\n </label>\n )}\n <textarea\n // Spread props first, then the a11y contract (controlProps) so a\n // consumer cannot accidentally clobber the wiring.\n {...props}\n {...controlProps}\n data-slot=\"textarea\"\n rows={rows}\n required={required}\n className={cn(textareaVariants({ size, error: hasError, resize }), className)}\n />\n {hasErrorMessage && (\n <FieldMessage id={errorId} variant=\"error\">\n {errorMessage}\n </FieldMessage>\n )}\n {hasHelper && (\n <FieldMessage id={helperId} variant=\"helper\">\n {helperText}\n </FieldMessage>\n )}\n </div>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Textarea, textareaVariants };\nexport type { TextareaProps };\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport { Checkbox as CheckboxPrimitive } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { Check, Minus } from '../../internal/icons';\nimport { useFieldA11y, FieldMessage } from '../../internal/field';\n\n// ─── 1. Variants (cva) ─── //\n\n// Applied to the Radix Root (the role=checkbox button). Two sizes only ,\n// a \"lg\" checkbox is unusual; keep the surface honest.\nconst checkboxVariants = cva('ddga-checkbox', {\n variants: {\n size: {\n sm: 'ddga-checkbox--sm',\n md: 'ddga-checkbox--md',\n },\n error: {\n true: 'ddga-checkbox--error',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\n// ─── 2. Types ─── //\n\n// Radix owns the state model (checked / defaultChecked / onCheckedChange /\n// indeterminate via checked=\"indeterminate\" / disabled / required / name /\n// value). We add the composed label + helper/error + a11y wiring. `children`\n// is omitted , the indicator is rendered internally.\ninterface CheckboxProps\n extends\n Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'children'>,\n VariantProps<typeof checkboxVariants> {\n /** Visible label, sits beside the box, associated via `htmlFor`/`id`. */\n label?: ReactNode;\n /** Hint shown below the row. Hidden while an error message is showing. */\n helperText?: ReactNode;\n /** Message shown below the row when `error` is true. */\n errorMessage?: ReactNode;\n /** Marks the field invalid: sets `aria-invalid` and error styling. */\n error?: boolean;\n}\n\n// ─── 3. Component ─── //\n\nfunction Checkbox({\n id: externalId,\n label,\n helperText,\n errorMessage,\n error,\n size,\n required,\n className,\n ...props\n}: CheckboxProps) {\n const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } =\n useFieldA11y({\n name: 'Checkbox',\n id: externalId,\n label,\n error,\n errorMessage,\n helperText,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n });\n\n return (\n <div data-slot=\"checkbox-field\" className=\"ddga-field\">\n <div className=\"ddga-checkbox-row\">\n <CheckboxPrimitive.Root\n // Spread props first, then the a11y contract (controlProps) so a\n // consumer cannot accidentally clobber the wiring.\n {...props}\n {...controlProps}\n data-slot=\"checkbox\"\n required={required}\n className={cn(checkboxVariants({ size, error: hasError }), className)}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"ddga-checkbox__indicator\"\n >\n {/* Both render inside the indicator (which only mounts when\n checked or indeterminate); CSS picks one via Root data-state. */}\n <Check className=\"ddga-checkbox__check\" aria-hidden=\"true\" />\n <Minus className=\"ddga-checkbox__minus\" aria-hidden=\"true\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n {label && (\n <label htmlFor={fieldId} className=\"ddga-checkbox__label\">\n {label}\n {required && (\n <span aria-hidden=\"true\" className=\"ddga-checkbox__required\">\n *\n </span>\n )}\n </label>\n )}\n </div>\n {hasErrorMessage && (\n <FieldMessage id={errorId} variant=\"error\">\n {errorMessage}\n </FieldMessage>\n )}\n {hasHelper && (\n <FieldMessage id={helperId} variant=\"helper\">\n {helperText}\n </FieldMessage>\n )}\n </div>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Checkbox, checkboxVariants };\nexport type { CheckboxProps };\n","'use client';\n\nimport { useRef, useMemo, useContext } from 'react';\nimport { Direction as DirectionPrimitive, Tooltip as TooltipPrimitive } from 'radix-ui';\nimport { DgaContext, type DgaContextValue } from './DgaContext';\n\ntype DgaRootElement =\n | 'div'\n | 'main'\n | 'nav'\n | 'section'\n | 'article'\n | 'aside'\n | 'header'\n | 'footer';\n\nexport interface DgaProviderProps {\n dir?: 'ltr' | 'rtl';\n locale?: string;\n mode?: 'light' | 'dark';\n as?: DgaRootElement;\n className?: string;\n style?: React.CSSProperties;\n children: React.ReactNode;\n}\n\nexport function DgaProvider({\n dir = 'ltr',\n locale,\n mode = 'light',\n as: Component = 'div',\n className,\n style: consumerStyle,\n children,\n}: DgaProviderProps) {\n const parentCtx = useContext(DgaContext);\n const isNested = parentCtx !== null;\n const rootRef = useRef<HTMLDivElement>(null);\n const resolvedLocale = locale ?? (dir === 'rtl' ? 'ar' : 'en');\n\n const ctxValue = useMemo<DgaContextValue>(\n () => ({ dir, locale: resolvedLocale, mode, rootRef }),\n [dir, resolvedLocale, mode],\n );\n\n // Radix's Direction.Provider propagates `dir` to portal-rendered content\n // (Tooltip/Select/Toast/Modal) that would otherwise inherit body dir,\n // not the dir on this wrapper element. Nested providers reuse the parent\n // direction via their own Direction.Provider, so this is safe to repeat.\n const inner = <DirectionPrimitive.Provider dir={dir}>{children}</DirectionPrimitive.Provider>;\n\n return (\n <DgaContext.Provider value={ctxValue}>\n <Component\n ref={rootRef as React.RefObject<never>}\n dir={dir}\n lang={resolvedLocale}\n data-slot=\"dga-root\"\n data-theme={mode}\n className={className}\n style={{ colorScheme: mode, ...consumerStyle }}\n >\n {isNested ? (\n inner\n ) : (\n <TooltipPrimitive.Provider delayDuration={300} skipDelayDuration={100}>\n {inner}\n </TooltipPrimitive.Provider>\n )}\n </Component>\n </DgaContext.Provider>\n );\n}\n","'use client';\n\nimport { createContext, useContext } from 'react';\n\nexport interface DgaContextValue {\n dir: 'ltr' | 'rtl';\n locale: string;\n mode: 'light' | 'dark';\n rootRef: React.RefObject<HTMLElement | null>;\n}\n\nexport const DgaContext = createContext<DgaContextValue | null>(null);\n\nexport function useDga(): DgaContextValue {\n const ctx = useContext(DgaContext);\n if (!ctx) {\n throw new Error('useDga must be used within a <DgaProvider>');\n }\n return ctx;\n}\n","'use client';\n\nimport { useDga } from '../providers/DgaContext';\n\n/**\n * Returns the current writing direction from the nearest `<DgaProvider>`.\n *\n * Prefer this over `useDga().dir` when a component only needs direction\n * (clearer intent, smaller dependency footprint at the call site).\n *\n * Throws if called outside a `<DgaProvider>` (matches `useDga`).\n */\nexport function useDir(): 'ltr' | 'rtl' {\n return useDga().dir;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAA+B;AAC/B,sCAAuC;;;ACHvC,kBAAsC;AAE/B,SAAS,MAAM,QAAsB;AAC1C,aAAO,kBAAK,MAAM;AACpB;;;ACiBM;AAfC,SAAS,QAAQ,OAAsC;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,WAAU;AAAA,MACT,GAAG;AAAA,MAEJ,sDAAC,UAAK,GAAE,+BAA8B;AAAA;AAAA,EACxC;AAEJ;AAMO,SAAS,MAAM,OAAsC;AAC1D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACd,GAAG;AAAA,MAEJ,sDAAC,UAAK,GAAE,mBAAkB;AAAA;AAAA,EAC5B;AAEJ;AAMO,SAAS,MAAM,OAAsC;AAC1D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;AAAA,MAC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0BAAW,UAAU;AACvC,QAAM,WAAW,cAAc;AAC/B,QAAM,cAAU,sBAAuB,IAAI;AAC3C,QAAM,iBAAiB,WAAW,QAAQ,QAAQ,OAAO;AAEzD,QAAM,eAAW;AAAA,IACf,OAAO,EAAE,KAAK,QAAQ,gBAAgB,MAAM,QAAQ;AAAA,IACpD,CAAC,KAAK,gBAAgB,IAAI;AAAA,EAC5B;AAMA,QAAM,QAAQ,6CAAC,iBAAAC,UAAmB,UAAnB,EAA4B,KAAW,UAAS;AAE/D,SACE,6CAAC,WAAW,UAAX,EAAoB,OAAO,UAC1B;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,MAAM;AAAA,MACN,aAAU;AAAA,MACV,cAAY;AAAA,MACZ;AAAA,MACA,OAAO,EAAE,aAAa,MAAM,GAAG,cAAc;AAAA,MAE5C,qBACC,QAEA,6CAAC,iBAAAC,QAAiB,UAAjB,EAA0B,eAAe,KAAK,mBAAmB,KAC/D,iBACH;AAAA;AAAA,EAEJ,GACF;AAEJ;;;AE5DO,SAAS,SAAwB;AACtC,SAAO,OAAO,EAAE;AAClB;","names":["import_jsx_runtime","import_class_variance_authority","import_react","import_jsx_runtime","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","CheckboxPrimitive","import_react","import_radix_ui","import_react","import_jsx_runtime","DirectionPrimitive","TooltipPrimitive"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/components/Button/Button.tsx","../src/utils/cn.ts","../src/internal/icons/index.tsx","../src/components/Input/Input.tsx","../src/field/use-field-a11y.ts","../src/field/FieldMessage.tsx","../src/components/Textarea/Textarea.tsx","../src/components/Checkbox/Checkbox.tsx","../src/components/Radio/Radio.tsx","../src/components/Switch/Switch.tsx","../src/components/Select/Select.tsx","../src/providers/DgaContext.ts","../src/components/Tooltip/Tooltip.tsx","../src/components/Alert/Alert.tsx","../src/components/Modal/Modal.tsx","../src/components/Toast/Toast.tsx","../src/components/Toast/toast-store.ts","../src/providers/DgaProvider.tsx","../src/hooks/useDir.ts"],"sourcesContent":["export { Button, buttonVariants, type ButtonProps } from './components/Button';\nexport { Input, inputVariants, type InputProps } from './components/Input';\nexport { Textarea, textareaVariants, type TextareaProps } from './components/Textarea';\nexport { Checkbox, checkboxVariants, type CheckboxProps } from './components/Checkbox';\nexport {\n RadioGroup,\n Radio,\n radioGroupVariants,\n radioVariants,\n type RadioGroupProps,\n type RadioProps,\n} from './components/Radio';\nexport { Switch, switchVariants, type SwitchProps } from './components/Switch';\nexport {\n Select,\n SelectItem,\n selectTriggerVariants,\n type SelectProps,\n type SelectItemProps,\n} from './components/Select';\nexport {\n Tooltip,\n TooltipTrigger,\n TooltipContent,\n tooltipContentVariants,\n type TooltipProps,\n type TooltipTriggerProps,\n type TooltipContentProps,\n} from './components/Tooltip';\nexport {\n Alert,\n AlertTitle,\n AlertDescription,\n alertVariants,\n type AlertProps,\n type AlertTitleProps,\n type AlertDescriptionProps,\n type AlertSectionProps,\n} from './components/Alert';\nexport {\n Modal,\n ModalTrigger,\n ModalContent,\n ModalHeader,\n ModalTitle,\n ModalDescription,\n ModalFooter,\n ModalClose,\n modalContentVariants,\n type ModalProps,\n type ModalTriggerProps,\n type ModalContentProps,\n type ModalSectionProps,\n type ModalTitleProps,\n type ModalDescriptionProps,\n type ModalCloseProps,\n} from './components/Modal';\nexport {\n Toaster,\n toast,\n toastStore,\n createToast,\n createToastStore,\n toastVariants,\n toastViewportVariants,\n type ToasterProps,\n type ToastPosition,\n type ToastVariant,\n type ToastData,\n type ToastOptions,\n type ToastAction,\n type ToastStore,\n} from './components/Toast';\nexport { DgaProvider, type DgaProviderProps } from './providers/DgaProvider';\nexport { useDga } from './providers/DgaContext';\nexport { useDir } from './hooks/useDir';\nexport type { DgaTheme, PaletteName, ThemeColor } from '@dev-dga/tokens';\nexport {\n useFieldA11y,\n FieldMessage,\n type UseFieldA11yOptions,\n type FieldA11y,\n type FieldMessageProps,\n} from './field';\nexport { cn } from './utils/cn';\n","'use client';\n\nimport { type ReactNode } from 'react';\nimport { Slot as SlotPrimitive } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { Spinner } from '../../internal/icons';\n\n// ─── 1. Variants (cva) ─── //\n\nconst buttonVariants = cva('ddga-button', {\n variants: {\n variant: {\n primary: 'ddga-button--primary',\n secondary: 'ddga-button--secondary',\n outline: 'ddga-button--outline',\n ghost: 'ddga-button--ghost',\n destructive: 'ddga-button--destructive',\n },\n size: {\n sm: 'ddga-button--sm',\n md: 'ddga-button--md',\n lg: 'ddga-button--lg',\n icon: 'ddga-button--icon',\n 'icon-sm': 'ddga-button--icon-sm',\n },\n fullWidth: {\n true: 'ddga-button--full-width',\n },\n },\n compoundVariants: [],\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n});\n\n// ─── 2. Types ─── //\n\ninterface ButtonProps extends React.ComponentProps<'button'>, VariantProps<typeof buttonVariants> {\n loading?: boolean;\n startIcon?: ReactNode;\n endIcon?: ReactNode;\n /** Flip start/end icons horizontally in RTL (for chevrons, arrows, etc.) */\n iconFlip?: boolean;\n /**\n * Render as the single child element instead of a `<button>`. Lets consumers\n * compose Button with router links (`<Button asChild><Link href=\"…\">…</Link></Button>`)\n * without `<button><a>` invalid nesting.\n *\n * The `type` and native `disabled` attributes are dropped in this mode\n * (they're meaningless on non-button elements) , the disabled visual + a11y\n * state still works via `aria-disabled` + `tabIndex={-1}`. button.css\n * matches on `[aria-disabled='true']` alongside `:disabled` so the styling\n * applies on any element.\n *\n * Consumer remains responsible for preventing the underlying action when\n * disabled (e.g., calling `e.preventDefault()` in the Link's onClick),\n * since native `disabled` doesn't gate clicks on non-form-controls.\n */\n asChild?: boolean;\n}\n\n// ─── 3. Component ─── //\n\nfunction Button({\n variant,\n size,\n fullWidth,\n loading,\n disabled,\n startIcon,\n endIcon,\n iconFlip,\n asChild,\n className,\n children,\n type = 'button',\n ...props\n}: ButtonProps) {\n // Dev-only: warn if icon-only button has no accessible name\n if (process.env.NODE_ENV === 'development' && (size === 'icon' || size === 'icon-sm')) {\n if (!props['aria-label'] && !props['aria-labelledby']) {\n console.warn(\n '[@dev-dga/react] Button with an icon-only size (size=\"icon\" or ' +\n '\"icon-sm\") requires an aria-label or aria-labelledby attribute ' +\n 'for screen reader accessibility.',\n );\n }\n }\n\n const isDisabled = disabled || loading;\n const Comp = asChild ? SlotPrimitive.Slot : 'button';\n\n return (\n <Comp\n // `type` and native `disabled` only apply to <button>. In asChild mode\n // the Slot's child could be <a>, <Link>, etc. , skip both attrs there\n // and lean on aria-disabled + tabIndex for the disabled state.\n {...(asChild ? {} : { type, disabled: isDisabled })}\n {...(asChild && isDisabled ? { tabIndex: -1 } : {})}\n // Both `disabled` and `aria-disabled` are set in button mode (native +\n // explicit ARIA signal). In asChild mode, `aria-disabled` is the only\n // disabled signal a11y consumers can read on a non-form-control.\n aria-disabled={isDisabled || undefined}\n aria-busy={loading || undefined}\n data-slot=\"button\"\n className={cn(\n buttonVariants({ variant, size, fullWidth }),\n loading && 'ddga-button--loading',\n className,\n )}\n {...props}\n >\n {loading && <Spinner aria-hidden=\"true\" />}\n {!loading && startIcon && (\n <span className={cn('ddga-button__icon', iconFlip && 'ddga-icon-flip')} aria-hidden=\"true\">\n {startIcon}\n </span>\n )}\n {asChild ? (\n // children IS the consumer's single element (e.g. <Link>). Slottable\n // marks where THAT element's original children should land , without\n // it the icons would replace the link text entirely.\n <SlotPrimitive.Slottable>{children}</SlotPrimitive.Slottable>\n ) : (\n children != null && children !== '' && <span className=\"ddga-button__text\">{children}</span>\n )}\n {!loading && endIcon && (\n <span className={cn('ddga-button__icon', iconFlip && 'ddga-icon-flip')} aria-hidden=\"true\">\n {endIcon}\n </span>\n )}\n </Comp>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Button, buttonVariants };\nexport type { ButtonProps };\n","import { clsx, type ClassValue } from 'clsx';\n\nexport function cn(...inputs: ClassValue[]) {\n return clsx(inputs);\n}\n","'use client';\n\n/**\n * Internal loading spinner icon.\n * Not exported from the public API , used only by Button and similar components.\n */\nexport function Spinner(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"ddga-spinner\"\n {...props}\n >\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n );\n}\n\n/**\n * Internal checkmark icon , used by Checkbox (checked state).\n * Not exported from the public API.\n */\nexport function Check(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n );\n}\n\n/**\n * Internal minus/dash icon , used by Checkbox (indeterminate state).\n * Not exported from the public API.\n */\nexport function Minus(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M5 12h14\" />\n </svg>\n );\n}\n\n/**\n * Internal info circle icon — used by Alert (info/default variant).\n * Not exported from the public API.\n */\nexport function Info(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n );\n}\n\n/**\n * Internal warning triangle icon — used by Alert (warning variant).\n * Not exported from the public API.\n */\nexport function AlertTriangle(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </svg>\n );\n}\n\n/**\n * Internal alert circle icon — used by Alert (destructive variant).\n * Not exported from the public API.\n */\nexport function AlertCircle(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />\n </svg>\n );\n}\n\n/**\n * Internal close (X) icon — used by Alert (dismissible).\n * Not exported from the public API.\n */\nexport function Close(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n );\n}\n\n/**\n * Internal chevron-down icon , used by Select (trigger affordance).\n * Not exported from the public API.\n */\nexport function ChevronDown(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n );\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { useFieldA11y, FieldMessage } from '../../field';\n\n// ─── 1. Variants (cva) ─── //\n\n// Applied to the *control* (the bordered box), not the raw <input>. The\n// control owns the border, sizing, focus ring and disabled/error styling\n// so leading/trailing adornments sit inside the field.\nconst inputVariants = cva('ddga-input', {\n variants: {\n size: {\n sm: 'ddga-input--sm',\n md: 'ddga-input--md',\n lg: 'ddga-input--lg',\n },\n error: {\n true: 'ddga-input--error',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\n// ─── 2. Types ─── //\n\n// `Omit<…, 'size'>`: the native HTML `size` attribute (visible character\n// width, a number) collides with our design-system `size` variant. The\n// variant is far more useful; drop the rarely-used native attribute.\ninterface InputProps\n extends Omit<React.ComponentProps<'input'>, 'size'>, VariantProps<typeof inputVariants> {\n /** Visible field label, auto-associated to the input via `htmlFor`/`id`. */\n label?: ReactNode;\n /** Hint shown below the field. Hidden while an error message is showing. */\n helperText?: ReactNode;\n /** Message shown below the field when `error` is true. */\n errorMessage?: ReactNode;\n /** Marks the field invalid: sets `aria-invalid` and error styling. */\n error?: boolean;\n /**\n * Content rendered inside the field, before the input (icon or short text,\n * e.g. a search glyph or `https://`). May be interactive , it is NOT\n * `aria-hidden`. Mark purely-decorative icons `aria-hidden` yourself.\n */\n startAdornment?: ReactNode;\n /**\n * Content rendered inside the field, after the input. Compose a clear\n * button or password-reveal toggle here with `<Button size=\"icon-sm\">`\n * , the 28px in-field icon size that fits the field without overflow.\n */\n endAdornment?: ReactNode;\n}\n\n// ─── 3. Component ─── //\n\nfunction Input({\n id: externalId,\n label,\n helperText,\n errorMessage,\n error,\n size,\n required,\n startAdornment,\n endAdornment,\n className,\n ...props\n}: InputProps) {\n const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } =\n useFieldA11y({\n name: 'Input',\n id: externalId,\n label,\n error,\n errorMessage,\n helperText,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n });\n\n return (\n <div data-slot=\"input-field\" className=\"ddga-field\">\n {label && (\n <label htmlFor={fieldId} className=\"ddga-input__label\">\n {label}\n {required && (\n <span aria-hidden=\"true\" className=\"ddga-input__required\">\n *\n </span>\n )}\n </label>\n )}\n <div\n data-slot=\"input-control\"\n className={cn(inputVariants({ size, error: hasError }), className)}\n >\n {startAdornment != null && startAdornment !== '' && (\n <span\n data-slot=\"input-adornment\"\n className=\"ddga-input__adornment ddga-input__adornment--start\"\n >\n {startAdornment}\n </span>\n )}\n <input\n // Spread props first, then the a11y contract (controlProps) so a\n // consumer cannot accidentally clobber the wiring.\n {...props}\n {...controlProps}\n data-slot=\"input\"\n required={required}\n className=\"ddga-input__field\"\n />\n {endAdornment != null && endAdornment !== '' && (\n <span\n data-slot=\"input-adornment\"\n className=\"ddga-input__adornment ddga-input__adornment--end\"\n >\n {endAdornment}\n </span>\n )}\n </div>\n {hasErrorMessage && (\n <FieldMessage id={errorId} variant=\"error\">\n {errorMessage}\n </FieldMessage>\n )}\n {hasHelper && (\n <FieldMessage id={helperId} variant=\"helper\">\n {helperText}\n </FieldMessage>\n )}\n </div>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Input, inputVariants };\nexport type { InputProps };\n","import { useId, type ReactNode } from 'react';\n\n// Public field-primitive hook. Owns id generation, error/helper precedence,\n// control ARIA wiring, and the dev-time a11y warning so library form\n// controls (Input / Textarea / Checkbox / future Radio / Switch / Select)\n// and consumer-built custom fields share one source of truth.\n\nexport interface UseFieldA11yOptions {\n /** Component name used in the dev warning, e.g. `'Input'`. */\n name: string;\n /** Caller-supplied id; falls back to a stable generated one. */\n id?: string;\n label?: ReactNode;\n error?: boolean;\n errorMessage?: ReactNode;\n helperText?: ReactNode;\n /** From the consumer's props , used to suppress the no-label warning. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nexport interface FieldA11y {\n fieldId: string;\n helperId: string;\n errorId: string;\n hasError: boolean;\n hasErrorMessage: boolean;\n hasHelper: boolean;\n /** Spread onto the control element (input / textarea / Radix root). */\n controlProps: {\n id: string;\n 'aria-invalid': true | undefined;\n 'aria-describedby': string | undefined;\n };\n}\n\nfunction isPresent(value: ReactNode): boolean {\n return value != null && value !== '';\n}\n\nexport function useFieldA11y(options: UseFieldA11yOptions): FieldA11y {\n // useId() is SSR-safe , stable across server/client, no hydration mismatch.\n const generatedId = useId();\n const fieldId = options.id ?? generatedId;\n const helperId = `${fieldId}-helper`;\n const errorId = `${fieldId}-error`;\n\n // A present errorMessage implies an invalid field. Gating on `error: true`\n // alone made `errorMessage=\"…\"` a silent no-op , a footgun. `error` is\n // still useful for the message-less invalid case (form-level validation\n // marking the field invalid without per-field copy).\n const hasError = !!options.error || isPresent(options.errorMessage);\n const hasErrorMessage = hasError && isPresent(options.errorMessage);\n // An error message replaces helper text (one description at a time).\n const hasHelper = !hasErrorMessage && isPresent(options.helperText);\n\n // Dev-only: warn if the field has no accessible name. This library makes\n // the accessible path the default across every form control.\n if (process.env.NODE_ENV === 'development' && !options.label) {\n if (!options['aria-label'] && !options['aria-labelledby']) {\n console.warn(\n `[@dev-dga/react] ${options.name} requires a \\`label\\`, or an ` +\n 'aria-label / aria-labelledby attribute, for screen reader accessibility.',\n );\n }\n }\n\n return {\n fieldId,\n helperId,\n errorId,\n hasError,\n hasErrorMessage,\n hasHelper,\n controlProps: {\n id: fieldId,\n 'aria-invalid': hasError || undefined,\n 'aria-describedby': hasErrorMessage ? errorId : hasHelper ? helperId : undefined,\n },\n };\n}\n","import type { ReactNode } from 'react';\n\n// Public field-primitive component. The helper / error line below a form\n// control. Identical markup and styling across Input / Textarea / Checkbox,\n// and available to consumers composing custom fields on top of useFieldA11y.\n// No 'use client': pure markup, no hooks or client APIs.\n\nexport interface FieldMessageProps {\n id: string;\n /** `error` announces politely; `helper` is static. */\n variant: 'error' | 'helper';\n children: ReactNode;\n}\n\nexport function FieldMessage({ id, variant, children }: FieldMessageProps) {\n return (\n <p\n id={id}\n data-slot={`field-${variant}`}\n className={`ddga-field__message ddga-field__message--${variant}`}\n // Polite (not assertive): an assertive error interrupts the user\n // mid-interaction, the wrong UX for field-level validation.\n aria-live={variant === 'error' ? 'polite' : undefined}\n >\n {children}\n </p>\n );\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { useFieldA11y, FieldMessage } from '../../field';\n\n// ─── 1. Variants (cva) ─── //\n\n// Applied to the <textarea> directly: unlike Input there are no adornments,\n// so the field owns its own border / focus ring / state styling , no\n// control wrapper needed.\nconst textareaVariants = cva('ddga-textarea', {\n variants: {\n size: {\n sm: 'ddga-textarea--sm',\n md: 'ddga-textarea--md',\n lg: 'ddga-textarea--lg',\n },\n error: {\n true: 'ddga-textarea--error',\n },\n // Horizontal/both resize breaks form layout (same reason it's not the\n // default) , only vertical or locked are offered.\n resize: {\n vertical: 'ddga-textarea--resize-vertical',\n none: 'ddga-textarea--resize-none',\n },\n },\n defaultVariants: {\n size: 'md',\n resize: 'vertical',\n },\n});\n\n// ─── 2. Types ─── //\n\n// `<textarea>` has no native `size` attribute (unlike `<input>`), so the\n// cva `size` variant doesn't collide , no `Omit` needed.\ninterface TextareaProps\n extends React.ComponentProps<'textarea'>, VariantProps<typeof textareaVariants> {\n /** Visible field label, auto-associated to the textarea via `htmlFor`/`id`. */\n label?: ReactNode;\n /** Hint shown below the field. Hidden while an error message is showing. */\n helperText?: ReactNode;\n /** Message shown below the field when `error` is true. */\n errorMessage?: ReactNode;\n /** Marks the field invalid: sets `aria-invalid` and error styling. */\n error?: boolean;\n}\n\n// ─── 3. Component ─── //\n\nfunction Textarea({\n id: externalId,\n label,\n helperText,\n errorMessage,\n error,\n size,\n resize,\n required,\n rows = 3,\n className,\n ...props\n}: TextareaProps) {\n const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } =\n useFieldA11y({\n name: 'Textarea',\n id: externalId,\n label,\n error,\n errorMessage,\n helperText,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n });\n\n return (\n <div data-slot=\"textarea-field\" className=\"ddga-field\">\n {label && (\n <label htmlFor={fieldId} className=\"ddga-textarea__label\">\n {label}\n {required && (\n <span aria-hidden=\"true\" className=\"ddga-textarea__required\">\n *\n </span>\n )}\n </label>\n )}\n <textarea\n // Spread props first, then the a11y contract (controlProps) so a\n // consumer cannot accidentally clobber the wiring.\n {...props}\n {...controlProps}\n data-slot=\"textarea\"\n rows={rows}\n required={required}\n className={cn(textareaVariants({ size, error: hasError, resize }), className)}\n />\n {hasErrorMessage && (\n <FieldMessage id={errorId} variant=\"error\">\n {errorMessage}\n </FieldMessage>\n )}\n {hasHelper && (\n <FieldMessage id={helperId} variant=\"helper\">\n {helperText}\n </FieldMessage>\n )}\n </div>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Textarea, textareaVariants };\nexport type { TextareaProps };\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport { Checkbox as CheckboxPrimitive } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { Check, Minus } from '../../internal/icons';\nimport { useFieldA11y, FieldMessage } from '../../field';\n\n// ─── 1. Variants (cva) ─── //\n\n// Applied to the Radix Root (the role=checkbox button). Two sizes only ,\n// a \"lg\" checkbox is unusual; keep the surface honest.\nconst checkboxVariants = cva('ddga-checkbox', {\n variants: {\n size: {\n sm: 'ddga-checkbox--sm',\n md: 'ddga-checkbox--md',\n },\n error: {\n true: 'ddga-checkbox--error',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\n// ─── 2. Types ─── //\n\n// Radix owns the state model (checked / defaultChecked / onCheckedChange /\n// indeterminate via checked=\"indeterminate\" / disabled / required / name /\n// value). We add the composed label + helper/error + a11y wiring. `children`\n// is omitted , the indicator is rendered internally.\ninterface CheckboxProps\n extends\n Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'children'>,\n VariantProps<typeof checkboxVariants> {\n /** Visible label, sits beside the box, associated via `htmlFor`/`id`. */\n label?: ReactNode;\n /** Hint shown below the row. Hidden while an error message is showing. */\n helperText?: ReactNode;\n /** Message shown below the row when `error` is true. */\n errorMessage?: ReactNode;\n /** Marks the field invalid: sets `aria-invalid` and error styling. */\n error?: boolean;\n}\n\n// ─── 3. Component ─── //\n\nfunction Checkbox({\n id: externalId,\n label,\n helperText,\n errorMessage,\n error,\n size,\n required,\n className,\n ...props\n}: CheckboxProps) {\n const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } =\n useFieldA11y({\n name: 'Checkbox',\n id: externalId,\n label,\n error,\n errorMessage,\n helperText,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n });\n\n return (\n <div data-slot=\"checkbox-field\" className=\"ddga-field\">\n <div className=\"ddga-checkbox-row\">\n <CheckboxPrimitive.Root\n // Spread props first, then the a11y contract (controlProps) so a\n // consumer cannot accidentally clobber the wiring.\n {...props}\n {...controlProps}\n data-slot=\"checkbox\"\n required={required}\n className={cn(checkboxVariants({ size, error: hasError }), className)}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"ddga-checkbox__indicator\"\n >\n {/* Both render inside the indicator (which only mounts when\n checked or indeterminate); CSS picks one via Root data-state. */}\n <Check className=\"ddga-checkbox__check\" aria-hidden=\"true\" />\n <Minus className=\"ddga-checkbox__minus\" aria-hidden=\"true\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n {label && (\n <label htmlFor={fieldId} className=\"ddga-checkbox__label\">\n {label}\n {required && (\n <span aria-hidden=\"true\" className=\"ddga-checkbox__required\">\n *\n </span>\n )}\n </label>\n )}\n </div>\n {hasErrorMessage && (\n <FieldMessage id={errorId} variant=\"error\">\n {errorMessage}\n </FieldMessage>\n )}\n {hasHelper && (\n <FieldMessage id={helperId} variant=\"helper\">\n {helperText}\n </FieldMessage>\n )}\n </div>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Checkbox, checkboxVariants };\nexport type { CheckboxProps };\n","'use client';\n\nimport { useId, type ReactNode } from 'react';\nimport { RadioGroup as RadioGroupPrimitive } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { useFieldA11y, FieldMessage } from '../../field';\n\n// ─── 1. Variants (cva) ─── //\n\n// Applied to the Radix RadioGroup.Root (role=radiogroup). Owns size,\n// orientation, and the error class , child <Radio>s pick up size + error\n// via CSS cascade from `.ddga-radio-group--sm` / `.ddga-radio-group--error`\n// (one source of truth on the group, not threaded through items).\nconst radioGroupVariants = cva('ddga-radio-group', {\n variants: {\n size: {\n sm: 'ddga-radio-group--sm',\n md: 'ddga-radio-group--md',\n },\n orientation: {\n vertical: 'ddga-radio-group--vertical',\n horizontal: 'ddga-radio-group--horizontal',\n },\n error: {\n true: 'ddga-radio-group--error',\n },\n },\n defaultVariants: {\n size: 'md',\n orientation: 'vertical',\n },\n});\n\n// Applied to the Radix RadioGroup.Item (role=radio). No variants here ,\n// size / error cascade from the group; per-item disabled is native.\nconst radioVariants = cva('ddga-radio');\n\n// ─── 2. Types ─── //\n\n// Group: omit Radix's `orientation` so we can re-narrow it to our two\n// supported values (Radix accepts a wider set we don't need exposed).\ninterface RadioGroupProps\n extends\n Omit<React.ComponentProps<typeof RadioGroupPrimitive.Root>, 'children' | 'orientation'>,\n Pick<VariantProps<typeof radioGroupVariants>, 'size' | 'orientation'> {\n /** Group label, sits above the rows. Associated to the group via aria-labelledby. */\n label?: ReactNode;\n /** Hint shown below the group. Hidden while an error message is showing. */\n helperText?: ReactNode;\n /** Message shown below the group when `error` is true (or when only `errorMessage` is set). */\n errorMessage?: ReactNode;\n /** Marks the group invalid: sets aria-invalid and applies error styling. */\n error?: boolean;\n /** `<Radio>` children. */\n children: ReactNode;\n}\n\n// Item: omit children (the indicator is internal).\ninterface RadioProps extends Omit<\n React.ComponentProps<typeof RadioGroupPrimitive.Item>,\n 'children'\n> {\n /** Visible label for this radio, sits beside the circle, associated via htmlFor/id. */\n label?: ReactNode;\n}\n\n// ─── 3. Components ─── //\n\nfunction RadioGroup({\n id: externalId,\n label,\n helperText,\n errorMessage,\n error,\n size,\n orientation,\n required,\n className,\n children,\n ...props\n}: RadioGroupProps) {\n const { errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps, fieldId } =\n useFieldA11y({\n name: 'RadioGroup',\n id: externalId,\n label,\n error,\n errorMessage,\n helperText,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n });\n // The group itself isn't a focusable form control , consumers don't need\n // `id` on the role=radiogroup, and `htmlFor`/`<label>` doesn't apply.\n // Associate the visible label via aria-labelledby instead.\n const labelId = `${fieldId}-label`;\n\n return (\n <div data-slot=\"radio-group-field\" className=\"ddga-field\">\n {label && (\n <span id={labelId} className=\"ddga-radio-group__label\">\n {label}\n {required && (\n <span aria-hidden=\"true\" className=\"ddga-radio-group__required\">\n *\n </span>\n )}\n </span>\n )}\n <RadioGroupPrimitive.Root\n {...props}\n aria-invalid={controlProps['aria-invalid']}\n aria-describedby={controlProps['aria-describedby']}\n aria-labelledby={label ? labelId : props['aria-labelledby']}\n orientation={orientation === 'horizontal' ? 'horizontal' : 'vertical'}\n required={required}\n data-slot=\"radio-group\"\n className={cn(radioGroupVariants({ size, orientation, error: hasError }), className)}\n >\n {children}\n </RadioGroupPrimitive.Root>\n {hasErrorMessage && (\n <FieldMessage id={errorId} variant=\"error\">\n {errorMessage}\n </FieldMessage>\n )}\n {hasHelper && (\n <FieldMessage id={helperId} variant=\"helper\">\n {helperText}\n </FieldMessage>\n )}\n </div>\n );\n}\n\nfunction Radio({ id: externalId, label, className, ...props }: RadioProps) {\n // useId() is SSR-safe; pair the Item id with its <label htmlFor>.\n const generatedId = useId();\n const itemId = externalId ?? generatedId;\n return (\n <div className=\"ddga-radio-row\">\n <RadioGroupPrimitive.Item\n // Spread props first, then our id last so a consumer can't clobber\n // the label/control association by accident.\n {...props}\n id={itemId}\n data-slot=\"radio\"\n className={cn(radioVariants(), className)}\n >\n <RadioGroupPrimitive.Indicator\n data-slot=\"radio-indicator\"\n className=\"ddga-radio__indicator\"\n >\n <span className=\"ddga-radio__dot\" aria-hidden=\"true\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n {label && (\n <label htmlFor={itemId} className=\"ddga-radio__label\">\n {label}\n </label>\n )}\n </div>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { RadioGroup, Radio, radioGroupVariants, radioVariants };\nexport type { RadioGroupProps, RadioProps };\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport { Switch as SwitchPrimitive } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { useFieldA11y, FieldMessage } from '../../field';\n\n// ─── 1. Variants (cva) ─── //\n\n// Applied to the Radix Switch.Root (role=switch). Two sizes only , a \"lg\"\n// switch is unusual; keep the surface honest. Matches Checkbox / Radio.\nconst switchVariants = cva('ddga-switch', {\n variants: {\n size: {\n sm: 'ddga-switch--sm',\n md: 'ddga-switch--md',\n },\n error: {\n true: 'ddga-switch--error',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\n// ─── 2. Types ─── //\n\n// Radix owns the state model (checked / defaultChecked / onCheckedChange /\n// disabled / required / name / value). We add the composed label +\n// helper/error + a11y wiring. `children` is omitted , the thumb is rendered\n// internally.\ninterface SwitchProps\n extends\n Omit<React.ComponentProps<typeof SwitchPrimitive.Root>, 'children'>,\n VariantProps<typeof switchVariants> {\n /** Visible label, sits beside the track, associated via `htmlFor`/`id`. */\n label?: ReactNode;\n /** Hint shown below the row. Hidden while an error message is showing. */\n helperText?: ReactNode;\n /** Message shown below the row when `error` is true. */\n errorMessage?: ReactNode;\n /** Marks the field invalid: sets `aria-invalid` and error styling. */\n error?: boolean;\n}\n\n// ─── 3. Component ─── //\n\nfunction Switch({\n id: externalId,\n label,\n helperText,\n errorMessage,\n error,\n size,\n required,\n className,\n ...props\n}: SwitchProps) {\n const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } =\n useFieldA11y({\n name: 'Switch',\n id: externalId,\n label,\n error,\n errorMessage,\n helperText,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n });\n\n return (\n <div data-slot=\"switch-field\" className=\"ddga-field\">\n <div className=\"ddga-switch-row\">\n <SwitchPrimitive.Root\n // Spread props first, then the a11y contract (controlProps) so a\n // consumer cannot accidentally clobber the wiring.\n {...props}\n {...controlProps}\n data-slot=\"switch\"\n required={required}\n className={cn(switchVariants({ size, error: hasError }), className)}\n >\n <SwitchPrimitive.Thumb data-slot=\"switch-thumb\" className=\"ddga-switch__thumb\" />\n </SwitchPrimitive.Root>\n {label && (\n <label htmlFor={fieldId} className=\"ddga-switch__label\">\n {label}\n {required && (\n <span aria-hidden=\"true\" className=\"ddga-switch__required\">\n *\n </span>\n )}\n </label>\n )}\n </div>\n {hasErrorMessage && (\n <FieldMessage id={errorId} variant=\"error\">\n {errorMessage}\n </FieldMessage>\n )}\n {hasHelper && (\n <FieldMessage id={helperId} variant=\"helper\">\n {helperText}\n </FieldMessage>\n )}\n </div>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Switch, switchVariants };\nexport type { SwitchProps };\n","'use client';\n\nimport { useContext, type ReactNode } from 'react';\nimport { Select as SelectPrimitive } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { Check, ChevronDown } from '../../internal/icons';\nimport { useFieldA11y, FieldMessage } from '../../field';\nimport { DgaContext } from '../../providers/DgaContext';\n\n// ─── 1. Variants (cva) ─── //\n\n// Applied to the Radix Select.Trigger (the focusable button). Heights match\n// Input (32/36) so triggers and text inputs line up in a form row.\nconst selectTriggerVariants = cva('ddga-select-trigger', {\n variants: {\n size: {\n sm: 'ddga-select-trigger--sm',\n md: 'ddga-select-trigger--md',\n },\n error: {\n true: 'ddga-select-trigger--error',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\n// ─── 2. Types ─── //\n\n// We expose a closed shape (Trigger + Portal + Content + Viewport are\n// rendered internally) , consumers compose with `<SelectItem>` children.\n// Power-user use cases (custom trigger, grouped options, separators) get\n// added when there's a real need; YAGNI for v1.\n//\n// Radix owns the state model (`value` / `defaultValue` / `onValueChange` /\n// `open` / `onOpenChange` / `name` / `disabled` / `required` / `form`)\n// via SelectPrimitive.Root. `dir` is intentionally omitted , the wrapping\n// `Direction.Provider` in <DgaProvider> propagates direction to the portal.\ninterface SelectProps\n extends\n Omit<React.ComponentProps<typeof SelectPrimitive.Root>, 'children' | 'dir'>,\n VariantProps<typeof selectTriggerVariants> {\n /** Visible label above the trigger, associated via `htmlFor`/`id`. */\n label?: ReactNode;\n /** Hint shown below the trigger. Hidden while an error message is showing. */\n helperText?: ReactNode;\n /** Message shown below the trigger when `error` is true. */\n errorMessage?: ReactNode;\n /** Marks the field invalid: sets `aria-invalid` and error styling. */\n error?: boolean;\n /** Placeholder shown in the trigger when no value is selected. */\n placeholder?: ReactNode;\n /** `<SelectItem>` children, rendered inside the dropdown panel. */\n children: ReactNode;\n /** Caller-supplied id for the trigger; falls back to a generated one. */\n id?: string;\n /** Forwarded to the trigger (the focusable control). */\n className?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\ninterface SelectItemProps extends React.ComponentProps<typeof SelectPrimitive.Item> {\n /** The visible label for this item. */\n children: ReactNode;\n}\n\n// ─── 3. Components ─── //\n\nfunction Select({\n id: externalId,\n label,\n helperText,\n errorMessage,\n error,\n size,\n required,\n placeholder,\n className,\n children,\n ...rootProps\n}: SelectProps) {\n const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } =\n useFieldA11y({\n name: 'Select',\n id: externalId,\n label,\n error,\n errorMessage,\n helperText,\n 'aria-label': rootProps['aria-label'],\n 'aria-labelledby': rootProps['aria-labelledby'],\n });\n\n // Portal escape hatch: Radix mounts Select.Content under <body> by default,\n // which lives ABOVE DgaProvider's root in the DOM tree , so `data-theme`,\n // custom theme vars, and `.ddga-theme-*` classes set on that root never\n // reach the dropdown. Re-anchor the portal inside the root so CSS variable\n // inheritance just works (dark mode, theming, consumer overrides).\n // Falls back to <body> when used standalone (no provider).\n const ctx = useContext(DgaContext);\n const portalContainer = ctx?.rootEl ?? undefined;\n\n return (\n <div data-slot=\"select-field\" className=\"ddga-field\">\n {label && (\n <label htmlFor={fieldId} className=\"ddga-select__label\">\n {label}\n {required && (\n <span aria-hidden=\"true\" className=\"ddga-select__required\">\n *\n </span>\n )}\n </label>\n )}\n <SelectPrimitive.Root required={required} {...rootProps}>\n <SelectPrimitive.Trigger\n // Spread Trigger-only ARIA after the field a11y contract so the\n // describedby/invalid wiring isn't clobbered.\n {...controlProps}\n data-slot=\"select-trigger\"\n className={cn(selectTriggerVariants({ size, error: hasError }), className)}\n >\n <SelectPrimitive.Value placeholder={placeholder} />\n <SelectPrimitive.Icon asChild className=\"ddga-select__icon\">\n <ChevronDown aria-hidden=\"true\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n <SelectPrimitive.Portal container={portalContainer}>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className=\"ddga-select-content\"\n // popper positioning keeps the panel next to the trigger and\n // exposes --radix-select-trigger-width for size matching in CSS.\n position=\"popper\"\n sideOffset={4}\n >\n <SelectPrimitive.Viewport className=\"ddga-select-viewport\">\n {children}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n </SelectPrimitive.Root>\n {hasErrorMessage && (\n <FieldMessage id={errorId} variant=\"error\">\n {errorMessage}\n </FieldMessage>\n )}\n {hasHelper && (\n <FieldMessage id={helperId} variant=\"helper\">\n {helperText}\n </FieldMessage>\n )}\n </div>\n );\n}\n\nfunction SelectItem({ className, children, ...props }: SelectItemProps) {\n return (\n <SelectPrimitive.Item\n {...props}\n data-slot=\"select-item\"\n className={cn('ddga-select-item', className)}\n >\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator className=\"ddga-select-item__indicator\">\n <Check className=\"ddga-select-item__check\" aria-hidden=\"true\" />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Select, SelectItem, selectTriggerVariants };\nexport type { SelectProps, SelectItemProps };\n","'use client';\n\nimport { createContext, useContext } from 'react';\n\nexport interface DgaContextValue {\n dir: 'ltr' | 'rtl';\n locale: string;\n mode: 'light' | 'dark';\n /**\n * The DgaProvider root element. Portal-rendering components (Select, and\n * future Tooltip / Modal / Toast / Popover / DropdownMenu) MUST pass this\n * as their Radix `Portal container={…}` so that `data-theme`, custom\n * theme vars, and `.ddga-theme-*` classes set on the root inherit into\n * the portaled content. Without it, portals mount under <body> and\n * silently miss dark mode + custom themes.\n *\n * Exposed as state (not a ref) so consumers re-render once the element\n * mounts , a useRef wouldn't fire that update and the portal would\n * race to <body> on the first commit.\n */\n rootEl: HTMLElement | null;\n}\n\nexport const DgaContext = createContext<DgaContextValue | null>(null);\n\nexport function useDga(): DgaContextValue {\n const ctx = useContext(DgaContext);\n if (!ctx) {\n throw new Error('useDga must be used within a <DgaProvider>');\n }\n return ctx;\n}\n","'use client';\n\nimport { useContext } from 'react';\nimport { Tooltip as TooltipPrimitive } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { DgaContext } from '../../providers/DgaContext';\n\n// ─── 1. Variants (cva) ─── //\n\nconst tooltipContentVariants = cva('ddga-tooltip', {\n variants: {\n size: {\n sm: 'ddga-tooltip--sm',\n md: 'ddga-tooltip--md',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\n// ─── 2. Types ─── //\n//\n// We expose a closed compound shape that hides Radix's Provider/Portal/Arrow\n// details. `TooltipProvider` is already nested in `DgaProvider`, so consumers\n// don't need to add their own. The Portal container is wired from\n// `DgaContext.rootEl` (see DgaContext.ts) so the tooltip inherits `data-theme`\n// + custom theme classes set on the provider — without it, the tooltip would\n// silently mount under <body> and miss dark mode.\n\ntype TooltipProps = React.ComponentProps<typeof TooltipPrimitive.Root>;\n\ntype TooltipTriggerProps = React.ComponentProps<typeof TooltipPrimitive.Trigger>;\n\ninterface TooltipContentProps\n extends\n Omit<React.ComponentProps<typeof TooltipPrimitive.Content>, 'asChild'>,\n VariantProps<typeof tooltipContentVariants> {\n /** Show a small arrow pointing at the trigger. Defaults to true. */\n arrow?: boolean;\n}\n\n// ─── 3. Components ─── //\n\nfunction Tooltip(props: TooltipProps) {\n return <TooltipPrimitive.Root {...props} />;\n}\n\nfunction TooltipTrigger({ className, ...props }: TooltipTriggerProps) {\n // Radix Trigger already supports asChild natively — pass through.\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" className={className} {...props} />;\n}\n\nfunction TooltipContent({\n size,\n arrow = true,\n sideOffset = 6,\n className,\n children,\n ...props\n}: TooltipContentProps) {\n // Anchor the Portal to the DgaProvider root so theme + dark mode inherit.\n // Pattern documented in DgaContext.ts; regression test in Tooltip.test.tsx\n // (\"mounts the tooltip inside the DgaProvider root\"). Falls back to <body>\n // (Radix's default) if the Tooltip is used outside a DgaProvider.\n const ctx = useContext(DgaContext);\n const portalContainer = ctx?.rootEl ?? undefined;\n\n return (\n <TooltipPrimitive.Portal container={portalContainer}>\n <TooltipPrimitive.Content\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(tooltipContentVariants({ size }), className)}\n {...props}\n >\n {children}\n {arrow ? <TooltipPrimitive.Arrow className=\"ddga-tooltip__arrow\" /> : null}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Tooltip, TooltipTrigger, TooltipContent, tooltipContentVariants };\nexport type { TooltipProps, TooltipTriggerProps, TooltipContentProps };\n","'use client';\n\nimport { useState, type ReactNode } from 'react';\nimport { Slot as SlotPrimitive } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { Info, Check, AlertTriangle, AlertCircle, Close } from '../../internal/icons';\n\n// ─── 1. Variants (cva) ─── //\n\nconst alertVariants = cva('ddga-alert', {\n variants: {\n variant: {\n info: 'ddga-alert--info',\n success: 'ddga-alert--success',\n warning: 'ddga-alert--warning',\n destructive: 'ddga-alert--destructive',\n },\n },\n defaultVariants: {\n variant: 'info',\n },\n});\n\nconst DEFAULT_ICONS: Record<\n NonNullable<VariantProps<typeof alertVariants>['variant']>,\n ReactNode\n> = {\n info: <Info aria-hidden=\"true\" />,\n success: <Check aria-hidden=\"true\" />,\n warning: <AlertTriangle aria-hidden=\"true\" />,\n destructive: <AlertCircle aria-hidden=\"true\" />,\n};\n\n// ─── 2. Types ─── //\n\ninterface AlertProps\n extends Omit<React.ComponentProps<'div'>, 'role'>, VariantProps<typeof alertVariants> {\n /** Render as the single child element instead of a `<div>`. */\n asChild?: boolean;\n /**\n * Custom leading icon. Pass `false` to hide the icon entirely. Defaults to\n * a variant-appropriate icon (Info / Check / AlertTriangle / AlertCircle).\n */\n icon?: ReactNode | false;\n /**\n * Show a trailing close button. The alert manages its own visibility — pass\n * `onDismiss` to be notified, or set `open` to control visibility yourself.\n */\n dismissible?: boolean;\n /** Controlled visibility. Pair with `onDismiss` to react. */\n open?: boolean;\n /** Fires when the user clicks the close button. */\n onDismiss?: () => void;\n /**\n * Wire the alert into the a11y tree as a live region. `polite` announces on\n * the next graceful opportunity (use for success/info banners). `assertive`\n * interrupts the user (reserve for destructive/error states that block the\n * task). Omit for static / decorative banners.\n */\n live?: 'polite' | 'assertive';\n /** Localized label for the close button. Defaults to `\"Dismiss\"`. */\n closeLabel?: string;\n}\n\ntype AlertSectionProps = React.ComponentProps<'div'> & { asChild?: boolean };\n\ninterface AlertTitleProps extends React.ComponentProps<'h5'> {\n /** Override the heading element (e.g. render an `<h3>`). */\n asChild?: boolean;\n}\n\ntype AlertDescriptionProps = React.ComponentProps<'p'> & { asChild?: boolean };\n\n// ─── 3. Components ─── //\n\nfunction Alert({\n variant,\n asChild,\n icon,\n dismissible,\n open: controlledOpen,\n onDismiss,\n live,\n closeLabel = 'Dismiss',\n className,\n children,\n ...props\n}: AlertProps) {\n const [internalOpen, setInternalOpen] = useState(true);\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : internalOpen;\n\n if (!open) return null;\n\n const Comp = asChild ? SlotPrimitive.Slot : 'div';\n\n const resolvedIcon =\n icon === false ? null : icon !== undefined ? icon : DEFAULT_ICONS[variant ?? 'info'];\n\n // Live-region semantics. `role=\"alert\"` is implicit when aria-live=assertive,\n // but Radix-style explicitness reads better in tests + DOM inspection.\n const liveProps =\n live === 'assertive'\n ? { role: 'alert' as const, 'aria-live': 'assertive' as const }\n : live === 'polite'\n ? { role: 'status' as const, 'aria-live': 'polite' as const }\n : {};\n\n function handleDismiss() {\n if (!isControlled) setInternalOpen(false);\n onDismiss?.();\n }\n\n return (\n <Comp\n data-slot=\"alert\"\n data-variant={variant ?? 'info'}\n className={cn(alertVariants({ variant }), className)}\n {...liveProps}\n {...props}\n >\n {resolvedIcon ? <span className=\"ddga-alert__icon\">{resolvedIcon}</span> : null}\n {asChild ? (\n // Slot mode: the consumer's element receives the children body.\n // Title/description are nested by the consumer.\n <SlotPrimitive.Slottable>{children}</SlotPrimitive.Slottable>\n ) : (\n <div className=\"ddga-alert__body\">{children}</div>\n )}\n {dismissible ? (\n <button\n type=\"button\"\n className=\"ddga-alert__close\"\n aria-label={closeLabel}\n onClick={handleDismiss}\n >\n <Close aria-hidden=\"true\" />\n </button>\n ) : null}\n </Comp>\n );\n}\n\nfunction AlertTitle({ asChild, className, ...props }: AlertTitleProps) {\n const Comp = asChild ? SlotPrimitive.Slot : 'h5';\n return <Comp data-slot=\"alert-title\" className={cn('ddga-alert__title', className)} {...props} />;\n}\n\nfunction AlertDescription({ asChild, className, ...props }: AlertDescriptionProps) {\n const Comp = asChild ? SlotPrimitive.Slot : 'p';\n return (\n <Comp\n data-slot=\"alert-description\"\n className={cn('ddga-alert__description', className)}\n {...props}\n />\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Alert, AlertTitle, AlertDescription, alertVariants };\nexport type { AlertProps, AlertTitleProps, AlertDescriptionProps, AlertSectionProps };\n","'use client';\n\nimport { useContext } from 'react';\nimport { Dialog as DialogPrimitive, Slot as SlotPrimitive } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { DgaContext } from '../../providers/DgaContext';\nimport { Close } from '../../internal/icons';\n\n// ─── 1. Variants (cva) ─── //\n\nconst modalContentVariants = cva('ddga-modal', {\n variants: {\n size: {\n sm: 'ddga-modal--sm',\n md: 'ddga-modal--md',\n lg: 'ddga-modal--lg',\n xl: 'ddga-modal--xl',\n full: 'ddga-modal--full',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\n// ─── 2. Types ─── //\n//\n// Closed compound shape that hides Radix's Portal/Overlay plumbing. The Portal\n// is anchored to `DgaContext.rootEl` so `data-theme` + custom theme classes\n// set on the provider inherit into the modal — without it, the modal would\n// silently mount under <body> and miss dark mode / palette switches.\n\ntype ModalProps = React.ComponentProps<typeof DialogPrimitive.Root>;\ntype ModalTriggerProps = React.ComponentProps<typeof DialogPrimitive.Trigger>;\ntype ModalCloseProps = React.ComponentProps<typeof DialogPrimitive.Close>;\n\ninterface ModalContentProps\n extends\n React.ComponentProps<typeof DialogPrimitive.Content>,\n VariantProps<typeof modalContentVariants> {\n /**\n * Render a corner X close button. Defaults to `true`. Set `false` for\n * action-forcing dialogs (e.g. \"Are you sure?\") where the user must pick\n * one of the explicit footer buttons.\n */\n showCloseButton?: boolean;\n /** Localized label for the close button. Defaults to `\"Close\"`. */\n closeLabel?: string;\n}\n\ntype ModalSectionProps = React.ComponentProps<'div'> & { asChild?: boolean };\n\ninterface ModalTitleProps extends React.ComponentProps<typeof DialogPrimitive.Title> {\n /** Override the heading element (e.g. render an `<h3>` instead of the default `<h2>`). */\n asChild?: boolean;\n}\n\ninterface ModalDescriptionProps extends React.ComponentProps<typeof DialogPrimitive.Description> {\n /** Override the element (e.g. render a `<div>` for richer markup). */\n asChild?: boolean;\n}\n\n// ─── 3. Components ─── //\n\nfunction Modal(props: ModalProps) {\n return <DialogPrimitive.Root {...props} />;\n}\n\nfunction ModalTrigger({ className, ...props }: ModalTriggerProps) {\n // Radix Trigger supports asChild natively — pass through.\n return <DialogPrimitive.Trigger data-slot=\"modal-trigger\" className={className} {...props} />;\n}\n\nfunction ModalContent({\n size,\n showCloseButton = true,\n closeLabel = 'Close',\n className,\n children,\n ...props\n}: ModalContentProps) {\n // Anchor the Portal to the DgaProvider root. Pattern documented in\n // DgaContext.ts; regression test in Modal.test.tsx mirrors Select/Tooltip.\n const ctx = useContext(DgaContext);\n const portalContainer = ctx?.rootEl ?? undefined;\n\n return (\n <DialogPrimitive.Portal container={portalContainer}>\n <DialogPrimitive.Overlay className=\"ddga-modal__overlay\" data-slot=\"modal-overlay\" />\n <DialogPrimitive.Content\n data-slot=\"modal-content\"\n className={cn(modalContentVariants({ size }), className)}\n {...props}\n >\n {children}\n {showCloseButton ? (\n <DialogPrimitive.Close\n className=\"ddga-modal__close\"\n aria-label={closeLabel}\n data-slot=\"modal-close-x\"\n >\n <Close aria-hidden=\"true\" />\n </DialogPrimitive.Close>\n ) : null}\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n );\n}\n\nfunction ModalHeader({ asChild, className, ...props }: ModalSectionProps) {\n const Comp = asChild ? SlotPrimitive.Slot : 'div';\n return (\n <Comp data-slot=\"modal-header\" className={cn('ddga-modal__header', className)} {...props} />\n );\n}\n\nfunction ModalTitle({ asChild, className, ...props }: ModalTitleProps) {\n // Dialog.Title wires aria-labelledby on the parent Content. We pass asChild\n // through so consumers can swap heading level (h2 → h1/h3) without losing\n // the labelling link.\n return (\n <DialogPrimitive.Title\n asChild={asChild}\n data-slot=\"modal-title\"\n className={cn('ddga-modal__title', className)}\n {...props}\n />\n );\n}\n\nfunction ModalDescription({ asChild, className, ...props }: ModalDescriptionProps) {\n // Dialog.Description wires aria-describedby on the parent Content. asChild\n // lets consumers swap the element if they need richer markup.\n return (\n <DialogPrimitive.Description\n asChild={asChild}\n data-slot=\"modal-description\"\n className={cn('ddga-modal__description', className)}\n {...props}\n />\n );\n}\n\nfunction ModalFooter({ asChild, className, ...props }: ModalSectionProps) {\n const Comp = asChild ? SlotPrimitive.Slot : 'div';\n return (\n <Comp data-slot=\"modal-footer\" className={cn('ddga-modal__footer', className)} {...props} />\n );\n}\n\nfunction ModalClose({ className, ...props }: ModalCloseProps) {\n // Consumer-level close trigger for footer buttons etc. Radix Close supports\n // asChild natively — pass through so consumers can wrap a <Button>.\n return <DialogPrimitive.Close data-slot=\"modal-close\" className={className} {...props} />;\n}\n\n// ─── 4. Exports ─── //\n\nexport {\n Modal,\n ModalTrigger,\n ModalContent,\n ModalHeader,\n ModalTitle,\n ModalDescription,\n ModalFooter,\n ModalClose,\n modalContentVariants,\n};\nexport type {\n ModalProps,\n ModalTriggerProps,\n ModalContentProps,\n ModalSectionProps,\n ModalTitleProps,\n ModalDescriptionProps,\n ModalCloseProps,\n};\n","'use client';\n\nimport { useSyncExternalStore, type ReactNode } from 'react';\nimport { Toast as ToastPrimitive } from 'radix-ui';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { Info, Check, AlertTriangle, AlertCircle, Close } from '../../internal/icons';\nimport {\n toastStore as defaultStore,\n type ToastData,\n type ToastStore,\n type ToastVariant,\n} from './toast-store';\n\n// ─── 1. Variants (cva) ─── //\n\nconst toastVariants = cva('ddga-toast', {\n variants: {\n variant: {\n default: 'ddga-toast--default',\n info: 'ddga-toast--info',\n success: 'ddga-toast--success',\n warning: 'ddga-toast--warning',\n destructive: 'ddga-toast--destructive',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\nconst toastViewportVariants = cva('ddga-toast-viewport', {\n variants: {\n position: {\n 'top-start': 'ddga-toast-viewport--top-start',\n 'top-center': 'ddga-toast-viewport--top-center',\n 'top-end': 'ddga-toast-viewport--top-end',\n 'bottom-start': 'ddga-toast-viewport--bottom-start',\n 'bottom-center': 'ddga-toast-viewport--bottom-center',\n 'bottom-end': 'ddga-toast-viewport--bottom-end',\n },\n containerized: {\n true: 'ddga-toast-viewport--containerized',\n },\n },\n defaultVariants: {\n position: 'bottom-end',\n },\n});\n\nconst DEFAULT_ICONS: Record<ToastVariant, ReactNode> = {\n default: null,\n info: <Info aria-hidden=\"true\" />,\n success: <Check aria-hidden=\"true\" />,\n warning: <AlertTriangle aria-hidden=\"true\" />,\n destructive: <AlertCircle aria-hidden=\"true\" />,\n};\n\n// ─── 2. Types ─── //\n\ntype ToastPosition = NonNullable<VariantProps<typeof toastViewportVariants>['position']>;\n\ninterface ToasterProps {\n /** Where toasts stack. Logical: start/end flip in RTL. Default `bottom-end`. */\n position?: ToastPosition;\n /**\n * Pin the viewport to a positioned ancestor (via `position: absolute`)\n * instead of the browser viewport (`position: fixed`). Set this for\n * Storybook stories, embedded widgets, and any layout where the Toaster\n * should stay within a parent box. Caller is responsible for placing the\n * Toaster inside an element with `position: relative` (or other positioned\n * containing block).\n */\n containerized?: boolean;\n /** ms; default 4000. Set 0 (or Infinity) to disable auto-dismiss globally. */\n duration?: number;\n /** Show a close (X) button on each toast. Defaults to true. */\n closeButton?: boolean;\n /** Localized label for the close button. Default `\"Dismiss\"`. */\n closeLabel?: string;\n /** Hide the default leading icon per variant. */\n hideIcon?: boolean;\n /** Extra class on the Radix Viewport. */\n className?: string;\n /** Override swipe direction. Defaults based on `position`. */\n swipeDirection?: 'up' | 'down' | 'left' | 'right';\n /**\n * The toast store this Toaster subscribes to. Defaults to the module-level\n * singleton so the bare `toast()` API works without setup. Pass an isolated\n * store (created via `createToastStore()` + `createToast(store)`) when you\n * need multiple independent Toasters on the same page — common in\n * Storybook, docs sites, and embedded widgets.\n */\n store?: ToastStore;\n}\n\n// ─── 3. Components ─── //\n\nfunction Toaster({\n position = 'bottom-end',\n containerized = false,\n duration = 4000,\n closeButton = true,\n closeLabel = 'Dismiss',\n hideIcon = false,\n className,\n swipeDirection,\n store = defaultStore,\n}: ToasterProps) {\n // Subscribe to the store. Using getSnapshot for both client + server is\n // fine — toasts always start empty on hydration and adding only happens\n // after client mount.\n const toasts = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);\n\n // Map position → swipe direction. Top toasts swipe up; bottom toasts\n // swipe down. Caller can override.\n const resolvedSwipe: 'up' | 'down' | 'left' | 'right' =\n swipeDirection ?? (position.startsWith('top') ? 'up' : 'down');\n\n return (\n <ToastPrimitive.Provider duration={duration} swipeDirection={resolvedSwipe}>\n {toasts.map((t) => (\n <ToastItem\n key={t.id}\n toast={t}\n store={store}\n closeButton={closeButton}\n closeLabel={closeLabel}\n hideIcon={hideIcon}\n />\n ))}\n <ToastPrimitive.Viewport\n data-slot=\"toast-viewport\"\n data-position={position}\n className={cn(toastViewportVariants({ position, containerized }), className)}\n />\n </ToastPrimitive.Provider>\n );\n}\n\ninterface ToastItemProps {\n toast: ToastData;\n store: ToastStore;\n closeButton: boolean;\n closeLabel: string;\n hideIcon: boolean;\n}\n\nfunction ToastItem({ toast: t, store, closeButton, closeLabel, hideIcon }: ToastItemProps) {\n // For destructive variant, mark as `foreground` so assistive tech announces\n // it more urgently (Radix routes foreground toasts through a hidden\n // assertive live region; background goes through a polite one).\n const radixType: 'foreground' | 'background' =\n t.variant === 'destructive' ? 'foreground' : 'background';\n\n const icon = hideIcon ? null : DEFAULT_ICONS[t.variant];\n\n return (\n <ToastPrimitive.Root\n data-slot=\"toast\"\n data-variant={t.variant}\n className={toastVariants({ variant: t.variant })}\n open={t.open}\n type={radixType}\n duration={t.duration}\n onOpenChange={(open) => {\n if (!open) {\n // Route close-button / swipe / auto-duration dismissal through the\n // store. The store schedules the hard-remove after the exit anim,\n // so programmatic + UI dismissal land on the same path.\n store.dismiss(t.id);\n }\n }}\n >\n {icon ? <span className=\"ddga-toast__icon\">{icon}</span> : null}\n {/*\n Body owns the title + description + action stack so multi-line content\n and a trailing action button compose cleanly. Action lives INSIDE the\n body (not as a sibling of body) so it doesn't fight body's height when\n a description is present — sonner/shadcn pattern.\n */}\n <div className=\"ddga-toast__body\">\n {t.title ? (\n <ToastPrimitive.Title className=\"ddga-toast__title\">{t.title}</ToastPrimitive.Title>\n ) : null}\n {t.description ? (\n <ToastPrimitive.Description className=\"ddga-toast__description\">\n {t.description}\n </ToastPrimitive.Description>\n ) : null}\n {t.action ? (\n <ToastPrimitive.Action\n className=\"ddga-toast__action\"\n altText={\n t.action.altText ?? (typeof t.action.label === 'string' ? t.action.label : 'Action')\n }\n onClick={() => {\n t.action?.onClick();\n // Auto-dismiss after the action — store handles exit-anim timing.\n store.dismiss(t.id);\n }}\n >\n {t.action.label}\n </ToastPrimitive.Action>\n ) : null}\n </div>\n {closeButton ? (\n <ToastPrimitive.Close className=\"ddga-toast__close\" aria-label={closeLabel}>\n <Close aria-hidden=\"true\" />\n </ToastPrimitive.Close>\n ) : null}\n </ToastPrimitive.Root>\n );\n}\n\n// ─── 4. Exports ─── //\n\nexport { Toaster, toastVariants, toastViewportVariants };\nexport { toast, toastStore, createToast, createToastStore } from './toast-store';\nexport type { ToasterProps, ToastPosition };\nexport type { ToastVariant, ToastData, ToastOptions, ToastAction, ToastStore } from './toast-store';\n","'use client';\n\nimport { type ReactNode } from 'react';\n\n// ─── Types ─── //\n\nexport type ToastVariant = 'default' | 'info' | 'success' | 'warning' | 'destructive';\n\nexport interface ToastAction {\n /** Visible label on the action button. */\n label: ReactNode;\n /** Required by Radix Toast for screen-reader announcement when the action\n * isn't a simple string label. Falls back to `label` when it's a string. */\n altText?: string;\n /** Fired when the action button is pressed. Toast auto-dismisses after. */\n onClick: () => void;\n}\n\nexport interface ToastData {\n /** Auto-generated unless caller provides one (useful for de-dup / updates). */\n id: string;\n title?: ReactNode;\n description?: ReactNode;\n variant: ToastVariant;\n /** ms; `0` (or `Infinity`) means no auto-dismiss. Defaults handled by Toaster. */\n duration?: number;\n action?: ToastAction;\n /** Controlled by Radix Toast (true while visible; false plays exit anim). */\n open: boolean;\n /** Fires when the toast leaves the DOM (after exit anim). */\n onDismiss?: () => void;\n}\n\nexport interface ToastOptions {\n id?: string;\n title?: ReactNode;\n description?: ReactNode;\n duration?: number;\n action?: ToastAction;\n onDismiss?: () => void;\n}\n\ntype Listener = () => void;\n\n/** Public store shape. `<Toaster store={…} />` accepts this, and\n * `createToast(store)` returns a scoped `toast()` bound to it. */\nexport interface ToastStore {\n subscribe(listener: Listener): () => void;\n getSnapshot(): ToastData[];\n add(variant: ToastVariant, message: ReactNode, options?: ToastOptions): string;\n dismiss(id?: string): void;\n remove(id: string): void;\n /** Test-only / story-only: hard reset. */\n __reset(): void;\n}\n\n/** Approximate Radix Toast exit-animation duration (ms). After this we hard-\n * remove the entry from the store so the DOM unmounts cleanly. */\nconst EXIT_ANIM_MS = 200;\n\n// ─── Factory ─── //\n//\n// Each call returns an isolated store. The default module-level instance\n// powers the singleton `toast()` API (Sonner pattern: one Toaster at app\n// root). Advanced consumers — including the Storybook stories below this\n// component — call `createToastStore()` to get an independent store so\n// multiple Toasters on one page don't share state.\n\nexport function createToastStore(): ToastStore {\n let toasts: ToastData[] = [];\n const listeners = new Set<Listener>();\n let counter = 0;\n\n function emit() {\n for (const l of listeners) l();\n }\n\n function subscribe(listener: Listener): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n }\n\n function getSnapshot(): ToastData[] {\n return toasts;\n }\n\n function nextId(): string {\n counter += 1;\n return `t${counter}`;\n }\n\n function add(variant: ToastVariant, message: ReactNode, options: ToastOptions = {}): string {\n const id = options.id ?? nextId();\n const existing = toasts.findIndex((t) => t.id === id);\n const data: ToastData = {\n id,\n variant,\n open: true,\n title: message,\n description: options.description,\n duration: options.duration,\n action: options.action,\n onDismiss: options.onDismiss,\n };\n if (existing >= 0) {\n // Update in place (caller passed the same id — useful for \"loading → success\"\n // patterns or de-duped error messages).\n toasts = toasts.map((t, i) => (i === existing ? data : t));\n } else {\n toasts = [...toasts, data];\n }\n emit();\n return id;\n }\n\n /** Flip `open` to false → Radix plays exit anim → `remove` after.\n * Routes both programmatic dismiss + UI dismiss through the same path. */\n function dismiss(id?: string): void {\n if (id === undefined) {\n const ids = toasts.map((t) => t.id);\n toasts = toasts.map((t) => ({ ...t, open: false }));\n emit();\n setTimeout(() => {\n ids.forEach((id) => remove(id));\n }, EXIT_ANIM_MS);\n } else {\n toasts = toasts.map((t) => (t.id === id ? { ...t, open: false } : t));\n emit();\n setTimeout(() => remove(id), EXIT_ANIM_MS);\n }\n }\n\n function remove(id: string): void {\n const target = toasts.find((t) => t.id === id);\n toasts = toasts.filter((t) => t.id !== id);\n emit();\n target?.onDismiss?.();\n }\n\n function __reset(): void {\n toasts = [];\n counter = 0;\n emit();\n }\n\n return { subscribe, getSnapshot, add, dismiss, remove, __reset };\n}\n\n// ─── Default singleton ─── //\n// 90%-case API: one Toaster at app root, call `toast()` anywhere.\n\nexport const toastStore: ToastStore = createToastStore();\n\n// ─── createToast(store) ─── //\n\ninterface ToastFn {\n (message: ReactNode, options?: ToastOptions): string;\n default: (message: ReactNode, options?: ToastOptions) => string;\n info: (message: ReactNode, options?: ToastOptions) => string;\n success: (message: ReactNode, options?: ToastOptions) => string;\n warning: (message: ReactNode, options?: ToastOptions) => string;\n error: (message: ReactNode, options?: ToastOptions) => string;\n /** Alias for `error` — matches the variant name used everywhere else in the library. */\n destructive: (message: ReactNode, options?: ToastOptions) => string;\n /** Dismiss a specific toast by id, or all when called with no args. */\n dismiss: (id?: string) => void;\n}\n\n/** Bind an imperative `toast()` callable to a specific store. */\nexport function createToast(store: ToastStore): ToastFn {\n const fn: ToastFn = ((message, options) => store.add('default', message, options)) as ToastFn;\n fn.default = (message, options) => store.add('default', message, options);\n fn.info = (message, options) => store.add('info', message, options);\n fn.success = (message, options) => store.add('success', message, options);\n fn.warning = (message, options) => store.add('warning', message, options);\n fn.error = (message, options) => store.add('destructive', message, options);\n fn.destructive = fn.error;\n fn.dismiss = (id) => store.dismiss(id);\n return fn;\n}\n\n/** Default singleton `toast()` — bound to the module-level `toastStore`. */\nexport const toast: ToastFn = createToast(toastStore);\n","'use client';\n\nimport { useState, useMemo, useContext } from 'react';\nimport { Direction as DirectionPrimitive, Tooltip as TooltipPrimitive } from 'radix-ui';\nimport { buildTheme, type DgaTheme } from '@dev-dga/tokens';\nimport { DgaContext, type DgaContextValue } from './DgaContext';\n\ntype DgaRootElement =\n | 'div'\n | 'main'\n | 'nav'\n | 'section'\n | 'article'\n | 'aside'\n | 'header'\n | 'footer';\n\nexport interface DgaProviderProps {\n dir?: 'ltr' | 'rtl';\n locale?: string;\n mode?: 'light' | 'dark';\n /**\n * Brand theme. `theme.primary` accepts a palette name (`'lavender'`),\n * any CSS color string (`'#7C3AED'` , hover/active auto-derived via\n * `color-mix()`), or an explicit `{ base, hover, active, foreground? }`\n * triplet. The override-object pattern (`style={{ '--ddga-color-primary':\n * '...' }}`) still works , `style` wins over `theme`.\n */\n theme?: DgaTheme;\n as?: DgaRootElement;\n className?: string;\n style?: React.CSSProperties;\n children: React.ReactNode;\n}\n\nexport function DgaProvider({\n dir = 'ltr',\n locale,\n mode = 'light',\n theme,\n as: Component = 'div',\n className,\n style: consumerStyle,\n children,\n}: DgaProviderProps) {\n const parentCtx = useContext(DgaContext);\n const isNested = parentCtx !== null;\n // Callback ref + state so context subscribers (e.g. Select's portal\n // container) re-render when the element actually mounts. With useRef\n // the .current update wouldn't trigger a render and a defaultOpen\n // portal would race to <body> before the ref populated.\n const [rootEl, setRootEl] = useState<HTMLElement | null>(null);\n const resolvedLocale = locale ?? (dir === 'rtl' ? 'ar' : 'en');\n\n const ctxValue = useMemo<DgaContextValue>(\n () => ({ dir, locale: resolvedLocale, mode, rootEl }),\n [dir, resolvedLocale, mode, rootEl],\n );\n\n // Memoize by reference. Stable palette-name themes (`{ primary: 'lavender' }`\n // declared at module scope) never recompute; consumers passing an inline\n // object accept a per-render `buildTheme` call (cheap , small switch\n // statement over a single string).\n const themeVars = useMemo(() => (theme ? buildTheme(theme) : null), [theme]);\n\n // Radix's Direction.Provider propagates `dir` to portal-rendered content\n // (Tooltip/Select/Toast/Modal) that would otherwise inherit body dir,\n // not the dir on this wrapper element. Nested providers reuse the parent\n // direction via their own Direction.Provider, so this is safe to repeat.\n const inner = <DirectionPrimitive.Provider dir={dir}>{children}</DirectionPrimitive.Provider>;\n\n return (\n <DgaContext.Provider value={ctxValue}>\n <Component\n ref={setRootEl}\n dir={dir}\n lang={resolvedLocale}\n data-slot=\"dga-root\"\n data-theme={mode}\n className={className}\n // Order: colorScheme → theme vars → consumer style. A manually-\n // supplied `style` overrides `theme` (escape hatch preserved per\n // THEMING-PLAN.md: every `--ddga-*` remains plain-CSS overridable).\n style={{ colorScheme: mode, ...(themeVars ?? {}), ...consumerStyle }}\n >\n {isNested ? (\n inner\n ) : (\n <TooltipPrimitive.Provider delayDuration={300} skipDelayDuration={100}>\n {inner}\n </TooltipPrimitive.Provider>\n )}\n </Component>\n </DgaContext.Provider>\n );\n}\n","'use client';\n\nimport { useDga } from '../providers/DgaContext';\n\n/**\n * Returns the current writing direction from the nearest `<DgaProvider>`.\n *\n * Prefer this over `useDga().dir` when a component only needs direction\n * (clearer intent, smaller dependency footprint at the call site).\n *\n * Throws if called outside a `<DgaProvider>` (matches `useDga`).\n */\nexport function useDir(): 'ltr' | 'rtl' {\n return useDga().dir;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAA+B;AAC/B,sBAAsC;AACtC,sCAAuC;;;ACJvC,kBAAsC;AAE/B,SAAS,MAAM,QAAsB;AAC1C,aAAO,kBAAK,MAAM;AACpB;;;ACiBM;AAfC,SAAS,QAAQ,OAAsC;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,WAAU;AAAA,MACT,GAAG;AAAA,MAEJ,sDAAC,UAAK,GAAE,+BAA8B;AAAA;AAAA,EACxC;AAEJ;AAMO,SAAS,MAAM,OAAsC;AAC1D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;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;AAAA,EACP;AACF,GAAqB;AACnB,QAAM,gBAAY,2BAAW,UAAU;AACvC,QAAM,WAAW,cAAc;AAK/B,QAAM,CAAC,QAAQ,SAAS,QAAI,yBAA6B,IAAI;AAC7D,QAAM,iBAAiB,WAAW,QAAQ,QAAQ,OAAO;AAEzD,QAAM,eAAW;AAAA,IACf,OAAO,EAAE,KAAK,QAAQ,gBAAgB,MAAM,OAAO;AAAA,IACnD,CAAC,KAAK,gBAAgB,MAAM,MAAM;AAAA,EACpC;AAMA,QAAM,gBAAY,wBAAQ,MAAO,YAAQ,0BAAW,KAAK,IAAI,MAAO,CAAC,KAAK,CAAC;AAM3E,QAAM,QAAQ,8CAAC,kBAAAC,UAAmB,UAAnB,EAA4B,KAAW,UAAS;AAE/D,SACE,8CAAC,WAAW,UAAX,EAAoB,OAAO,UAC1B;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,MAAM;AAAA,MACN,aAAU;AAAA,MACV,cAAY;AAAA,MACZ;AAAA,MAIA,OAAO,EAAE,aAAa,MAAM,GAAI,aAAa,CAAC,GAAI,GAAG,cAAc;AAAA,MAElE,qBACC,QAEA,8CAAC,kBAAAC,QAAiB,UAAjB,EAA0B,eAAe,KAAK,mBAAmB,KAC/D,iBACH;AAAA;AAAA,EAEJ,GACF;AAEJ;;;ACnFO,SAAS,SAAwB;AACtC,SAAO,OAAO,EAAE;AAClB;","names":["import_jsx_runtime","SlotPrimitive","import_class_variance_authority","import_react","import_jsx_runtime","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","import_radix_ui","import_class_variance_authority","import_jsx_runtime","CheckboxPrimitive","import_react","import_radix_ui","import_class_variance_authority","import_jsx_runtime","RadioGroupPrimitive","import_radix_ui","import_class_variance_authority","import_jsx_runtime","SwitchPrimitive","import_react","import_radix_ui","import_class_variance_authority","import_react","import_jsx_runtime","SelectPrimitive","import_react","import_radix_ui","import_class_variance_authority","import_jsx_runtime","TooltipPrimitive","import_react","import_radix_ui","import_class_variance_authority","import_jsx_runtime","SlotPrimitive","import_react","import_radix_ui","import_class_variance_authority","import_jsx_runtime","DialogPrimitive","SlotPrimitive","import_react","import_radix_ui","import_class_variance_authority","import_react","id","import_jsx_runtime","DEFAULT_ICONS","ToastPrimitive","import_react","import_radix_ui","import_jsx_runtime","DirectionPrimitive","TooltipPrimitive"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,9 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
|
-
import { Checkbox as Checkbox$1 } from 'radix-ui';
|
|
5
|
+
import { Checkbox as Checkbox$1, RadioGroup as RadioGroup$1, Switch as Switch$1, Select as Select$1 } from 'radix-ui';
|
|
6
|
+
import { DgaTheme } from '@dev-dga/tokens';
|
|
7
|
+
export { DgaTheme, PaletteName, ThemeColor } from '@dev-dga/tokens';
|
|
6
8
|
import { ClassValue } from 'clsx';
|
|
7
9
|
|
|
8
10
|
declare const buttonVariants: (props?: ({
|
|
@@ -16,8 +18,24 @@ interface ButtonProps extends React.ComponentProps<'button'>, VariantProps<typeo
|
|
|
16
18
|
endIcon?: ReactNode;
|
|
17
19
|
/** Flip start/end icons horizontally in RTL (for chevrons, arrows, etc.) */
|
|
18
20
|
iconFlip?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Render as the single child element instead of a `<button>`. Lets consumers
|
|
23
|
+
* compose Button with router links (`<Button asChild><Link href="…">…</Link></Button>`)
|
|
24
|
+
* without `<button><a>` invalid nesting.
|
|
25
|
+
*
|
|
26
|
+
* The `type` and native `disabled` attributes are dropped in this mode
|
|
27
|
+
* (they're meaningless on non-button elements) , the disabled visual + a11y
|
|
28
|
+
* state still works via `aria-disabled` + `tabIndex={-1}`. button.css
|
|
29
|
+
* matches on `[aria-disabled='true']` alongside `:disabled` so the styling
|
|
30
|
+
* applies on any element.
|
|
31
|
+
*
|
|
32
|
+
* Consumer remains responsible for preventing the underlying action when
|
|
33
|
+
* disabled (e.g., calling `e.preventDefault()` in the Link's onClick),
|
|
34
|
+
* since native `disabled` doesn't gate clicks on non-form-controls.
|
|
35
|
+
*/
|
|
36
|
+
asChild?: boolean;
|
|
19
37
|
}
|
|
20
|
-
declare function Button({ variant, size, fullWidth, loading, disabled, startIcon, endIcon, iconFlip, className, children, type, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
38
|
+
declare function Button({ variant, size, fullWidth, loading, disabled, startIcon, endIcon, iconFlip, asChild, className, children, type, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
21
39
|
|
|
22
40
|
declare const inputVariants: (props?: ({
|
|
23
41
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
@@ -80,23 +98,115 @@ interface CheckboxProps extends Omit<React.ComponentProps<typeof Checkbox$1.Root
|
|
|
80
98
|
}
|
|
81
99
|
declare function Checkbox({ id: externalId, label, helperText, errorMessage, error, size, required, className, ...props }: CheckboxProps): react_jsx_runtime.JSX.Element;
|
|
82
100
|
|
|
101
|
+
declare const radioGroupVariants: (props?: ({
|
|
102
|
+
size?: "sm" | "md" | null | undefined;
|
|
103
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
104
|
+
error?: boolean | null | undefined;
|
|
105
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
106
|
+
declare const radioVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
107
|
+
interface RadioGroupProps extends Omit<React.ComponentProps<typeof RadioGroup$1.Root>, 'children' | 'orientation'>, Pick<VariantProps<typeof radioGroupVariants>, 'size' | 'orientation'> {
|
|
108
|
+
/** Group label, sits above the rows. Associated to the group via aria-labelledby. */
|
|
109
|
+
label?: ReactNode;
|
|
110
|
+
/** Hint shown below the group. Hidden while an error message is showing. */
|
|
111
|
+
helperText?: ReactNode;
|
|
112
|
+
/** Message shown below the group when `error` is true (or when only `errorMessage` is set). */
|
|
113
|
+
errorMessage?: ReactNode;
|
|
114
|
+
/** Marks the group invalid: sets aria-invalid and applies error styling. */
|
|
115
|
+
error?: boolean;
|
|
116
|
+
/** `<Radio>` children. */
|
|
117
|
+
children: ReactNode;
|
|
118
|
+
}
|
|
119
|
+
interface RadioProps extends Omit<React.ComponentProps<typeof RadioGroup$1.Item>, 'children'> {
|
|
120
|
+
/** Visible label for this radio, sits beside the circle, associated via htmlFor/id. */
|
|
121
|
+
label?: ReactNode;
|
|
122
|
+
}
|
|
123
|
+
declare function RadioGroup({ id: externalId, label, helperText, errorMessage, error, size, orientation, required, className, children, ...props }: RadioGroupProps): react_jsx_runtime.JSX.Element;
|
|
124
|
+
declare function Radio({ id: externalId, label, className, ...props }: RadioProps): react_jsx_runtime.JSX.Element;
|
|
125
|
+
|
|
126
|
+
declare const switchVariants: (props?: ({
|
|
127
|
+
size?: "sm" | "md" | null | undefined;
|
|
128
|
+
error?: boolean | null | undefined;
|
|
129
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
130
|
+
interface SwitchProps extends Omit<React.ComponentProps<typeof Switch$1.Root>, 'children'>, VariantProps<typeof switchVariants> {
|
|
131
|
+
/** Visible label, sits beside the track, associated via `htmlFor`/`id`. */
|
|
132
|
+
label?: ReactNode;
|
|
133
|
+
/** Hint shown below the row. Hidden while an error message is showing. */
|
|
134
|
+
helperText?: ReactNode;
|
|
135
|
+
/** Message shown below the row when `error` is true. */
|
|
136
|
+
errorMessage?: ReactNode;
|
|
137
|
+
/** Marks the field invalid: sets `aria-invalid` and error styling. */
|
|
138
|
+
error?: boolean;
|
|
139
|
+
}
|
|
140
|
+
declare function Switch({ id: externalId, label, helperText, errorMessage, error, size, required, className, ...props }: SwitchProps): react_jsx_runtime.JSX.Element;
|
|
141
|
+
|
|
142
|
+
declare const selectTriggerVariants: (props?: ({
|
|
143
|
+
size?: "sm" | "md" | null | undefined;
|
|
144
|
+
error?: boolean | null | undefined;
|
|
145
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
146
|
+
interface SelectProps extends Omit<React.ComponentProps<typeof Select$1.Root>, 'children' | 'dir'>, VariantProps<typeof selectTriggerVariants> {
|
|
147
|
+
/** Visible label above the trigger, associated via `htmlFor`/`id`. */
|
|
148
|
+
label?: ReactNode;
|
|
149
|
+
/** Hint shown below the trigger. Hidden while an error message is showing. */
|
|
150
|
+
helperText?: ReactNode;
|
|
151
|
+
/** Message shown below the trigger when `error` is true. */
|
|
152
|
+
errorMessage?: ReactNode;
|
|
153
|
+
/** Marks the field invalid: sets `aria-invalid` and error styling. */
|
|
154
|
+
error?: boolean;
|
|
155
|
+
/** Placeholder shown in the trigger when no value is selected. */
|
|
156
|
+
placeholder?: ReactNode;
|
|
157
|
+
/** `<SelectItem>` children, rendered inside the dropdown panel. */
|
|
158
|
+
children: ReactNode;
|
|
159
|
+
/** Caller-supplied id for the trigger; falls back to a generated one. */
|
|
160
|
+
id?: string;
|
|
161
|
+
/** Forwarded to the trigger (the focusable control). */
|
|
162
|
+
className?: string;
|
|
163
|
+
'aria-label'?: string;
|
|
164
|
+
'aria-labelledby'?: string;
|
|
165
|
+
}
|
|
166
|
+
interface SelectItemProps extends React.ComponentProps<typeof Select$1.Item> {
|
|
167
|
+
/** The visible label for this item. */
|
|
168
|
+
children: ReactNode;
|
|
169
|
+
}
|
|
170
|
+
declare function Select({ id: externalId, label, helperText, errorMessage, error, size, required, placeholder, className, children, ...rootProps }: SelectProps): react_jsx_runtime.JSX.Element;
|
|
171
|
+
declare function SelectItem({ className, children, ...props }: SelectItemProps): react_jsx_runtime.JSX.Element;
|
|
172
|
+
|
|
83
173
|
type DgaRootElement = 'div' | 'main' | 'nav' | 'section' | 'article' | 'aside' | 'header' | 'footer';
|
|
84
174
|
interface DgaProviderProps {
|
|
85
175
|
dir?: 'ltr' | 'rtl';
|
|
86
176
|
locale?: string;
|
|
87
177
|
mode?: 'light' | 'dark';
|
|
178
|
+
/**
|
|
179
|
+
* Brand theme. `theme.primary` accepts a palette name (`'lavender'`),
|
|
180
|
+
* any CSS color string (`'#7C3AED'` , hover/active auto-derived via
|
|
181
|
+
* `color-mix()`), or an explicit `{ base, hover, active, foreground? }`
|
|
182
|
+
* triplet. The override-object pattern (`style={{ '--ddga-color-primary':
|
|
183
|
+
* '...' }}`) still works , `style` wins over `theme`.
|
|
184
|
+
*/
|
|
185
|
+
theme?: DgaTheme;
|
|
88
186
|
as?: DgaRootElement;
|
|
89
187
|
className?: string;
|
|
90
188
|
style?: React.CSSProperties;
|
|
91
189
|
children: React.ReactNode;
|
|
92
190
|
}
|
|
93
|
-
declare function DgaProvider({ dir, locale, mode, as: Component, className, style: consumerStyle, children, }: DgaProviderProps): react_jsx_runtime.JSX.Element;
|
|
191
|
+
declare function DgaProvider({ dir, locale, mode, theme, as: Component, className, style: consumerStyle, children, }: DgaProviderProps): react_jsx_runtime.JSX.Element;
|
|
94
192
|
|
|
95
193
|
interface DgaContextValue {
|
|
96
194
|
dir: 'ltr' | 'rtl';
|
|
97
195
|
locale: string;
|
|
98
196
|
mode: 'light' | 'dark';
|
|
99
|
-
|
|
197
|
+
/**
|
|
198
|
+
* The DgaProvider root element. Portal-rendering components (Select, and
|
|
199
|
+
* future Tooltip / Modal / Toast / Popover / DropdownMenu) MUST pass this
|
|
200
|
+
* as their Radix `Portal container={…}` so that `data-theme`, custom
|
|
201
|
+
* theme vars, and `.ddga-theme-*` classes set on the root inherit into
|
|
202
|
+
* the portaled content. Without it, portals mount under <body> and
|
|
203
|
+
* silently miss dark mode + custom themes.
|
|
204
|
+
*
|
|
205
|
+
* Exposed as state (not a ref) so consumers re-render once the element
|
|
206
|
+
* mounts , a useRef wouldn't fire that update and the portal would
|
|
207
|
+
* race to <body> on the first commit.
|
|
208
|
+
*/
|
|
209
|
+
rootEl: HTMLElement | null;
|
|
100
210
|
}
|
|
101
211
|
declare function useDga(): DgaContextValue;
|
|
102
212
|
|
|
@@ -110,6 +220,43 @@ declare function useDga(): DgaContextValue;
|
|
|
110
220
|
*/
|
|
111
221
|
declare function useDir(): 'ltr' | 'rtl';
|
|
112
222
|
|
|
223
|
+
interface UseFieldA11yOptions {
|
|
224
|
+
/** Component name used in the dev warning, e.g. `'Input'`. */
|
|
225
|
+
name: string;
|
|
226
|
+
/** Caller-supplied id; falls back to a stable generated one. */
|
|
227
|
+
id?: string;
|
|
228
|
+
label?: ReactNode;
|
|
229
|
+
error?: boolean;
|
|
230
|
+
errorMessage?: ReactNode;
|
|
231
|
+
helperText?: ReactNode;
|
|
232
|
+
/** From the consumer's props , used to suppress the no-label warning. */
|
|
233
|
+
'aria-label'?: string;
|
|
234
|
+
'aria-labelledby'?: string;
|
|
235
|
+
}
|
|
236
|
+
interface FieldA11y {
|
|
237
|
+
fieldId: string;
|
|
238
|
+
helperId: string;
|
|
239
|
+
errorId: string;
|
|
240
|
+
hasError: boolean;
|
|
241
|
+
hasErrorMessage: boolean;
|
|
242
|
+
hasHelper: boolean;
|
|
243
|
+
/** Spread onto the control element (input / textarea / Radix root). */
|
|
244
|
+
controlProps: {
|
|
245
|
+
id: string;
|
|
246
|
+
'aria-invalid': true | undefined;
|
|
247
|
+
'aria-describedby': string | undefined;
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
declare function useFieldA11y(options: UseFieldA11yOptions): FieldA11y;
|
|
251
|
+
|
|
252
|
+
interface FieldMessageProps {
|
|
253
|
+
id: string;
|
|
254
|
+
/** `error` announces politely; `helper` is static. */
|
|
255
|
+
variant: 'error' | 'helper';
|
|
256
|
+
children: ReactNode;
|
|
257
|
+
}
|
|
258
|
+
declare function FieldMessage({ id, variant, children }: FieldMessageProps): react_jsx_runtime.JSX.Element;
|
|
259
|
+
|
|
113
260
|
declare function cn(...inputs: ClassValue[]): string;
|
|
114
261
|
|
|
115
|
-
export { Button, type ButtonProps, Checkbox, type CheckboxProps, DgaProvider, type DgaProviderProps, Input, type InputProps, Textarea, type TextareaProps, buttonVariants, checkboxVariants, cn, inputVariants, textareaVariants, useDga, useDir };
|
|
262
|
+
export { Button, type ButtonProps, Checkbox, type CheckboxProps, DgaProvider, type DgaProviderProps, type FieldA11y, FieldMessage, type FieldMessageProps, Input, type InputProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, SelectItem, type SelectItemProps, type SelectProps, Switch, type SwitchProps, Textarea, type TextareaProps, type UseFieldA11yOptions, buttonVariants, checkboxVariants, cn, inputVariants, radioGroupVariants, radioVariants, selectTriggerVariants, switchVariants, textareaVariants, useDga, useDir, useFieldA11y };
|