@dev-dga/react 0.1.1 → 0.2.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 +19 -0
- package/README.md +1 -1
- package/dist/index.cjs +12 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @dev-dga/react
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add `useDir()` hook and wire Radix's `Direction.Provider` into `DgaProvider`.
|
|
8
|
+
- **`useDir(): 'ltr' | 'rtl'`** — public hook returning direction from the nearest `<DgaProvider>`. Throws when used outside a provider. Use this in custom components instead of `useDga().dir` when only direction is needed.
|
|
9
|
+
- **Auto-propagation to Radix portals** — `DgaProvider` now wraps its children in `<Direction.Provider value={dir}>`. Radix primitives that render in portals (Tooltip, Select, Toast, Modal, …) inherit direction from the provider tree instead of falling back to `document.body`'s dir. Future portal-based components will respect the configured direction with no per-component plumbing. **No effect on the four components shipped in this release** (`Button`, `Input`, `Textarea`, `Checkbox`) — none render portals — so this is forward-looking infrastructure, not a behavior change for current consumers. The one edge case: code rendering `radix-ui` portal primitives directly inside a `DgaProvider` will now see them pick up the provider direction (a fix, not a regression).
|
|
10
|
+
|
|
11
|
+
For LTR-locked content inside an RTL page (Saudi phone numbers, IBANs, National IDs), use the native `dir="ltr"` attribute plus the appropriate `inputMode` on `<Input>` directly — no new component required. See the `Foundations/RTL` Storybook page for examples.
|
|
12
|
+
|
|
13
|
+
## 0.1.1
|
|
14
|
+
|
|
15
|
+
- Per-package README and metadata polish.
|
|
16
|
+
|
|
17
|
+
## 0.1.0
|
|
18
|
+
|
|
19
|
+
- Initial release: `Button`, `Input`, `Textarea`, `Checkbox`, `DgaProvider`, `useDga`, `cn`. React 19, ref-as-prop, `cva` variants, BEM `ddga-*` classes resolving `var(--ddga-*)`.
|
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ For RTL or dark mode, configure the provider:
|
|
|
38
38
|
|
|
39
39
|
## Components
|
|
40
40
|
|
|
41
|
-
`Button` · `Input` · `Textarea` · `Checkbox` · `DgaProvider` , plus `cn` (clsx) and `
|
|
41
|
+
`Button` · `Input` · `Textarea` · `Checkbox` · `DgaProvider` , plus `cn` (clsx), `useDga`, and `useDir`.
|
|
42
42
|
|
|
43
43
|
## Docs
|
|
44
44
|
|
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,8 @@ __export(src_exports, {
|
|
|
30
30
|
cn: () => cn,
|
|
31
31
|
inputVariants: () => inputVariants,
|
|
32
32
|
textareaVariants: () => textareaVariants,
|
|
33
|
-
useDga: () => useDga
|
|
33
|
+
useDga: () => useDga,
|
|
34
|
+
useDir: () => useDir
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(src_exports);
|
|
36
37
|
|
|
@@ -328,7 +329,7 @@ var textareaVariants = (0, import_class_variance_authority3.cva)("ddga-textarea"
|
|
|
328
329
|
true: "ddga-textarea--error"
|
|
329
330
|
},
|
|
330
331
|
// Horizontal/both resize breaks form layout (same reason it's not the
|
|
331
|
-
// default)
|
|
332
|
+
// default) , only vertical or locked are offered.
|
|
332
333
|
resize: {
|
|
333
334
|
vertical: "ddga-textarea--resize-vertical",
|
|
334
335
|
none: "ddga-textarea--resize-none"
|
|
@@ -489,6 +490,7 @@ function DgaProvider({
|
|
|
489
490
|
() => ({ dir, locale: resolvedLocale, mode, rootRef }),
|
|
490
491
|
[dir, resolvedLocale, mode]
|
|
491
492
|
);
|
|
493
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui2.Direction.Provider, { dir, children });
|
|
492
494
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
493
495
|
Component,
|
|
494
496
|
{
|
|
@@ -499,10 +501,15 @@ function DgaProvider({
|
|
|
499
501
|
"data-theme": mode,
|
|
500
502
|
className,
|
|
501
503
|
style: { colorScheme: mode, ...consumerStyle },
|
|
502
|
-
children: isNested ?
|
|
504
|
+
children: isNested ? inner : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui2.Tooltip.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
|
|
503
505
|
}
|
|
504
506
|
) });
|
|
505
507
|
}
|
|
508
|
+
|
|
509
|
+
// src/hooks/useDir.ts
|
|
510
|
+
function useDir() {
|
|
511
|
+
return useDga().dir;
|
|
512
|
+
}
|
|
506
513
|
// Annotate the CommonJS export names for ESM import in node:
|
|
507
514
|
0 && (module.exports = {
|
|
508
515
|
Button,
|
|
@@ -515,6 +522,7 @@ function DgaProvider({
|
|
|
515
522
|
cn,
|
|
516
523
|
inputVariants,
|
|
517
524
|
textareaVariants,
|
|
518
|
-
useDga
|
|
525
|
+
useDga,
|
|
526
|
+
useDir
|
|
519
527
|
});
|
|
520
528
|
//# sourceMappingURL=index.cjs.map
|
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"],"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 { 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 { 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":";;;;;;;;;;;;;;;;;;;;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,MACP,aAAY;A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U;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;AAEA,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,WAEA,6CAAC,iBAAAC,QAAiB,UAAjB,EAA0B,eAAe,KAAK,mBAAmB,KAC/D,UACH;AAAA;AAAA,EAEJ,GACF;AAEJ;","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","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/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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4C;AAC5C,IAAAC,mBAA6E;;;ACD7E,IAAAC,gBAA0C;AASnC,IAAM,iBAAa,6BAAsC,IAAI;AAE7D,SAAS,SAA0B;AACxC,QAAM,UAAM,0BAAW,UAAU;AACjC,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AACA,SAAO;AACT;;;AD8BgB,IAAAC,sBAAA;AAvBT,SAAS,YAAY;AAAA,EAC1B,MAAM;AAAA,EACN;AAAA,EACA,OAAO;AAAA,EACP,IAAI,YAAY;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,EACP;AACF,GAAqB;AACnB,QAAM,gBAAY,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"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -34,14 +34,14 @@ interface InputProps extends Omit<React.ComponentProps<'input'>, 'size'>, Varian
|
|
|
34
34
|
error?: boolean;
|
|
35
35
|
/**
|
|
36
36
|
* Content rendered inside the field, before the input (icon or short text,
|
|
37
|
-
* e.g. a search glyph or `https://`). May be interactive
|
|
37
|
+
* e.g. a search glyph or `https://`). May be interactive , it is NOT
|
|
38
38
|
* `aria-hidden`. Mark purely-decorative icons `aria-hidden` yourself.
|
|
39
39
|
*/
|
|
40
40
|
startAdornment?: ReactNode;
|
|
41
41
|
/**
|
|
42
42
|
* Content rendered inside the field, after the input. Compose a clear
|
|
43
43
|
* button or password-reveal toggle here with `<Button size="icon-sm">`
|
|
44
|
-
*
|
|
44
|
+
* , the 28px in-field icon size that fits the field without overflow.
|
|
45
45
|
*/
|
|
46
46
|
endAdornment?: ReactNode;
|
|
47
47
|
}
|
|
@@ -100,6 +100,16 @@ interface DgaContextValue {
|
|
|
100
100
|
}
|
|
101
101
|
declare function useDga(): DgaContextValue;
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Returns the current writing direction from the nearest `<DgaProvider>`.
|
|
105
|
+
*
|
|
106
|
+
* Prefer this over `useDga().dir` when a component only needs direction
|
|
107
|
+
* (clearer intent, smaller dependency footprint at the call site).
|
|
108
|
+
*
|
|
109
|
+
* Throws if called outside a `<DgaProvider>` (matches `useDga`).
|
|
110
|
+
*/
|
|
111
|
+
declare function useDir(): 'ltr' | 'rtl';
|
|
112
|
+
|
|
103
113
|
declare function cn(...inputs: ClassValue[]): string;
|
|
104
114
|
|
|
105
|
-
export { Button, type ButtonProps, Checkbox, type CheckboxProps, DgaProvider, type DgaProviderProps, Input, type InputProps, Textarea, type TextareaProps, buttonVariants, checkboxVariants, cn, inputVariants, textareaVariants, useDga };
|
|
115
|
+
export { Button, type ButtonProps, Checkbox, type CheckboxProps, DgaProvider, type DgaProviderProps, Input, type InputProps, Textarea, type TextareaProps, buttonVariants, checkboxVariants, cn, inputVariants, textareaVariants, useDga, useDir };
|
package/dist/index.d.ts
CHANGED
|
@@ -34,14 +34,14 @@ interface InputProps extends Omit<React.ComponentProps<'input'>, 'size'>, Varian
|
|
|
34
34
|
error?: boolean;
|
|
35
35
|
/**
|
|
36
36
|
* Content rendered inside the field, before the input (icon or short text,
|
|
37
|
-
* e.g. a search glyph or `https://`). May be interactive
|
|
37
|
+
* e.g. a search glyph or `https://`). May be interactive , it is NOT
|
|
38
38
|
* `aria-hidden`. Mark purely-decorative icons `aria-hidden` yourself.
|
|
39
39
|
*/
|
|
40
40
|
startAdornment?: ReactNode;
|
|
41
41
|
/**
|
|
42
42
|
* Content rendered inside the field, after the input. Compose a clear
|
|
43
43
|
* button or password-reveal toggle here with `<Button size="icon-sm">`
|
|
44
|
-
*
|
|
44
|
+
* , the 28px in-field icon size that fits the field without overflow.
|
|
45
45
|
*/
|
|
46
46
|
endAdornment?: ReactNode;
|
|
47
47
|
}
|
|
@@ -100,6 +100,16 @@ interface DgaContextValue {
|
|
|
100
100
|
}
|
|
101
101
|
declare function useDga(): DgaContextValue;
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Returns the current writing direction from the nearest `<DgaProvider>`.
|
|
105
|
+
*
|
|
106
|
+
* Prefer this over `useDga().dir` when a component only needs direction
|
|
107
|
+
* (clearer intent, smaller dependency footprint at the call site).
|
|
108
|
+
*
|
|
109
|
+
* Throws if called outside a `<DgaProvider>` (matches `useDga`).
|
|
110
|
+
*/
|
|
111
|
+
declare function useDir(): 'ltr' | 'rtl';
|
|
112
|
+
|
|
103
113
|
declare function cn(...inputs: ClassValue[]): string;
|
|
104
114
|
|
|
105
|
-
export { Button, type ButtonProps, Checkbox, type CheckboxProps, DgaProvider, type DgaProviderProps, Input, type InputProps, Textarea, type TextareaProps, buttonVariants, checkboxVariants, cn, inputVariants, textareaVariants, useDga };
|
|
115
|
+
export { Button, type ButtonProps, Checkbox, type CheckboxProps, DgaProvider, type DgaProviderProps, Input, type InputProps, Textarea, type TextareaProps, buttonVariants, checkboxVariants, cn, inputVariants, textareaVariants, useDga, useDir };
|
package/dist/index.js
CHANGED
|
@@ -292,7 +292,7 @@ var textareaVariants = cva3("ddga-textarea", {
|
|
|
292
292
|
true: "ddga-textarea--error"
|
|
293
293
|
},
|
|
294
294
|
// Horizontal/both resize breaks form layout (same reason it's not the
|
|
295
|
-
// default)
|
|
295
|
+
// default) , only vertical or locked are offered.
|
|
296
296
|
resize: {
|
|
297
297
|
vertical: "ddga-textarea--resize-vertical",
|
|
298
298
|
none: "ddga-textarea--resize-none"
|
|
@@ -421,7 +421,7 @@ function Checkbox({
|
|
|
421
421
|
|
|
422
422
|
// src/providers/DgaProvider.tsx
|
|
423
423
|
import { useRef, useMemo, useContext as useContext2 } from "react";
|
|
424
|
-
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
424
|
+
import { Direction as DirectionPrimitive, Tooltip as TooltipPrimitive } from "radix-ui";
|
|
425
425
|
|
|
426
426
|
// src/providers/DgaContext.ts
|
|
427
427
|
import { createContext, useContext } from "react";
|
|
@@ -453,6 +453,7 @@ function DgaProvider({
|
|
|
453
453
|
() => ({ dir, locale: resolvedLocale, mode, rootRef }),
|
|
454
454
|
[dir, resolvedLocale, mode]
|
|
455
455
|
);
|
|
456
|
+
const inner = /* @__PURE__ */ jsx7(DirectionPrimitive.Provider, { dir, children });
|
|
456
457
|
return /* @__PURE__ */ jsx7(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsx7(
|
|
457
458
|
Component,
|
|
458
459
|
{
|
|
@@ -463,10 +464,15 @@ function DgaProvider({
|
|
|
463
464
|
"data-theme": mode,
|
|
464
465
|
className,
|
|
465
466
|
style: { colorScheme: mode, ...consumerStyle },
|
|
466
|
-
children: isNested ?
|
|
467
|
+
children: isNested ? inner : /* @__PURE__ */ jsx7(TooltipPrimitive.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
|
|
467
468
|
}
|
|
468
469
|
) });
|
|
469
470
|
}
|
|
471
|
+
|
|
472
|
+
// src/hooks/useDir.ts
|
|
473
|
+
function useDir() {
|
|
474
|
+
return useDga().dir;
|
|
475
|
+
}
|
|
470
476
|
export {
|
|
471
477
|
Button,
|
|
472
478
|
Checkbox,
|
|
@@ -478,6 +484,7 @@ export {
|
|
|
478
484
|
cn,
|
|
479
485
|
inputVariants,
|
|
480
486
|
textareaVariants,
|
|
481
|
-
useDga
|
|
487
|
+
useDga,
|
|
488
|
+
useDir
|
|
482
489
|
};
|
|
483
490
|
//# sourceMappingURL=index.js.map
|
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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;AAAA,MACZ;AAAA,MACA,OAAO,EAAE,aAAa,MAAM,GAAG,cAAc;AAAA,MAE5C,qBACC,WAEA,gBAAAA,KAAC,iBAAiB,UAAjB,EAA0B,eAAe,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/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":["'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":";AAEA,OAA+B;AAC/B,SAAS,WAA8B;;;ACHvC,SAAS,YAA6B;AAE/B,SAAS,MAAM,QAAsB;AAC1C,SAAO,KAAK,MAA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,OAAO;AAEzD,QAAM,WAAW;AAAA,IACf,OAAO,EAAE,KAAK,QAAQ,gBAAgB,MAAM,QAAQ;AAAA,IACpD,CAAC,KAAK,gBAAgB,IAAI;AAAA,EAC5B;AAMA,QAAM,QAAQ,gBAAAD,KAAC,mBAAmB,UAAnB,EAA4B,KAAW,UAAS;AAE/D,SACE,gBAAAA,KAAC,WAAW,UAAX,EAAoB,OAAO,UAC1B,0BAAAA;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,gBAAAA,KAAC,iBAAiB,UAAjB,EAA0B,eAAe,KAAK,mBAAmB,KAC/D,iBACH;AAAA;AAAA,EAEJ,GACF;AAEJ;;;AE5DO,SAAS,SAAwB;AACtC,SAAO,OAAO,EAAE;AAClB;","names":["jsx","cva","jsx","jsx","jsxs","cva","cva","jsx","jsxs","cva","cva","jsx","jsxs","cva","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.2.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",
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"peerDependencies": {
|
|
57
58
|
"react": "^19.0.0",
|
|
58
59
|
"react-dom": "^19.0.0",
|
|
59
|
-
"@dev-dga/css": "0.
|
|
60
|
+
"@dev-dga/css": "0.2.0"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
63
|
"@storybook/react-vite": "^10.2.15",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"typescript": "^5.7.0",
|
|
74
75
|
"vitest": "^2.0.0",
|
|
75
76
|
"vitest-axe": "^0.1.0",
|
|
76
|
-
"@dev-dga/tokens": "0.
|
|
77
|
+
"@dev-dga/tokens": "0.2.0"
|
|
77
78
|
},
|
|
78
79
|
"scripts": {
|
|
79
80
|
"build": "tsup",
|