@dev-dga/react 0.1.1 → 0.3.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 +67 -0
- package/README.md +54 -6
- package/dist/index.cjs +323 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -7
- package/dist/index.d.ts +164 -7
- package/dist/index.js +307 -17
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../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"],"sourcesContent":["'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 { 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 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 children\n ) : (\n <TooltipPrimitive.Provider delayDuration={300} skipDelayDuration={100}>\n {children}\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"],"mappings":";AAEA,OAA+B;AAC/B,SAAS,WAA8B;;;ACHvC,SAAS,YAA6B;AAE/B,SAAS,MAAM,QAAsB;AAC1C,SAAO,KAAK,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,8BAAC,UAAK,GAAE,+BAA8B;AAAA;AAAA,EACxC;AAEJ;AAMO,SAAS,MAAM,OAAsC;AAC1D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,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Ae,KAAK,mBAAmB,KAC/D,UACH;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":["jsx","cva","jsx","jsx","jsxs","cva","cva","jsx","jsxs","cva","cva","jsx","jsxs","cva","useContext","jsx","useContext"]}
|
|
1
|
+
{"version":3,"sources":["../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/providers/DgaProvider.tsx","../src/hooks/useDir.ts"],"sourcesContent":["'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\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 { 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":";AAEA,OAA+B;AAC/B,SAAS,WAA8B;;;ACHvC,SAAS,YAA6B;AAE/B,SAAS,MAAM,QAAsB;AAC1C,SAAO,KAAK,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,8BAAC,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,8BAAC,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,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACd,GAAG;AAAA,MAEJ,8BAAC,UAAK,GAAE,YAAW;AAAA;AAAA,EACrB;AAEJ;A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va","jsx","jsxs","cva","useContext","useContext","jsx","useContext"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev-dga/react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "React 19 components for the DGA (Digital Government Authority) design system
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "React 19 components for the DGA (Digital Government Authority) design system , accessible, RTL-native, dark-mode ready.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
7
7
|
"react-19",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"type": "module",
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"files": [
|
|
31
|
-
"dist"
|
|
31
|
+
"dist",
|
|
32
|
+
"CHANGELOG.md"
|
|
32
33
|
],
|
|
33
34
|
"main": "./dist/index.cjs",
|
|
34
35
|
"module": "./dist/index.js",
|
|
@@ -51,12 +52,13 @@
|
|
|
51
52
|
"dependencies": {
|
|
52
53
|
"class-variance-authority": "^0.7.0",
|
|
53
54
|
"clsx": "^2.1.0",
|
|
54
|
-
"radix-ui": "^1.0.0"
|
|
55
|
+
"radix-ui": "^1.0.0",
|
|
56
|
+
"@dev-dga/tokens": "0.3.0"
|
|
55
57
|
},
|
|
56
58
|
"peerDependencies": {
|
|
57
59
|
"react": "^19.0.0",
|
|
58
60
|
"react-dom": "^19.0.0",
|
|
59
|
-
"@dev-dga/css": "0.
|
|
61
|
+
"@dev-dga/css": "0.3.0"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@storybook/react-vite": "^10.2.15",
|
|
@@ -72,8 +74,7 @@
|
|
|
72
74
|
"tsup": "^8.0.0",
|
|
73
75
|
"typescript": "^5.7.0",
|
|
74
76
|
"vitest": "^2.0.0",
|
|
75
|
-
"vitest-axe": "^0.1.0"
|
|
76
|
-
"@dev-dga/tokens": "0.1.1"
|
|
77
|
+
"vitest-axe": "^0.1.0"
|
|
77
78
|
},
|
|
78
79
|
"scripts": {
|
|
79
80
|
"build": "tsup",
|