@catiarodrigues/goldfinch 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +119 -0
  3. package/dist/alert-Iba34Kfr.js +72 -0
  4. package/dist/badge-dMKK_Gm2.js +147 -0
  5. package/dist/breadcrumbs-CHev-E0K.js +148 -0
  6. package/dist/button-DDhP5P56.js +40 -0
  7. package/dist/card-CVUWZOar.js +42 -0
  8. package/dist/checkbox-BubMDtGW.js +149 -0
  9. package/dist/collapsible-Bk5IP_KI.js +55 -0
  10. package/dist/components/alert.mjs +2 -0
  11. package/dist/components/badge.mjs +2 -0
  12. package/dist/components/breadcrumbs.mjs +2 -0
  13. package/dist/components/button.mjs +2 -0
  14. package/dist/components/card.mjs +2 -0
  15. package/dist/components/checkbox.mjs +2 -0
  16. package/dist/components/collapsible.mjs +2 -0
  17. package/dist/components/copy-to-clipboard.mjs +2 -0
  18. package/dist/components/dropdown.mjs +2 -0
  19. package/dist/components/empty-state.mjs +2 -0
  20. package/dist/components/field.mjs +2 -0
  21. package/dist/components/grid.mjs +2 -0
  22. package/dist/components/input-group.mjs +2 -0
  23. package/dist/components/input.mjs +4 -0
  24. package/dist/components/label.mjs +2 -0
  25. package/dist/components/link.mjs +58 -0
  26. package/dist/components/menubar.mjs +2 -0
  27. package/dist/components/modal.mjs +2 -0
  28. package/dist/components/page.mjs +2 -0
  29. package/dist/components/pagination.mjs +2 -0
  30. package/dist/components/popover.mjs +2 -0
  31. package/dist/components/progress.mjs +2 -0
  32. package/dist/components/radio.mjs +2 -0
  33. package/dist/components/select.mjs +2 -0
  34. package/dist/components/sensitive-input.mjs +2 -0
  35. package/dist/components/sidebar.mjs +2 -0
  36. package/dist/components/spinner.mjs +3 -0
  37. package/dist/components/table-of-contents.mjs +2 -0
  38. package/dist/components/table.mjs +2 -0
  39. package/dist/components/tabs.mjs +2 -0
  40. package/dist/components/text.mjs +2 -0
  41. package/dist/components/toast.mjs +2 -0
  42. package/dist/components/toggle.mjs +2 -0
  43. package/dist/components/toolbar.mjs +2 -0
  44. package/dist/components/tooltip.mjs +2 -0
  45. package/dist/components/top-navigation.mjs +2 -0
  46. package/dist/copy-to-clipboard-KXU8jo6k.js +139 -0
  47. package/dist/dropdown-A5hLlUjr.js +172 -0
  48. package/dist/empty-state-DuugAIN_.js +76 -0
  49. package/dist/field-CZb7PLTY.js +47 -0
  50. package/dist/grid-BFkQ5cmR.js +101 -0
  51. package/dist/index.mjs +47 -0
  52. package/dist/input-6C_-SelY.js +48 -0
  53. package/dist/input-Bo8XL6_f.js +43 -0
  54. package/dist/input-group-Dm4hKEhq.js +302 -0
  55. package/dist/input-variants-CZevxTd8.js +41 -0
  56. package/dist/label-7oCakbyx.js +43 -0
  57. package/dist/link-provider-H0J4aZPH.js +21 -0
  58. package/dist/menubar-DyXmaeKZ.js +59 -0
  59. package/dist/modal-BYQ8MRMy.js +132 -0
  60. package/dist/page-DOevDFqd.js +60 -0
  61. package/dist/pagination-C3f16UOC.js +239 -0
  62. package/dist/popover-3kcRy9HX.js +120 -0
  63. package/dist/portal-provider-CWX8j9O1.js +15 -0
  64. package/dist/progress-Ac96hU_C.js +26 -0
  65. package/dist/radio-C8rcmsbS.js +144 -0
  66. package/dist/resolve-variant-DWiDeQhX.js +7 -0
  67. package/dist/select-DaJRanrs.js +178 -0
  68. package/dist/sensitive-input-BEAOu1A6.js +181 -0
  69. package/dist/sidebar-CkZxFt33.js +703 -0
  70. package/dist/skeleton-line-Dh4TDbeq.js +32 -0
  71. package/dist/spinner-DKzSES7b.js +79 -0
  72. package/dist/src/components/alert/alert.d.ts +105 -0
  73. package/dist/src/components/alert/index.d.ts +1 -0
  74. package/dist/src/components/badge/badge.d.ts +204 -0
  75. package/dist/src/components/badge/index.d.ts +1 -0
  76. package/dist/src/components/breadcrumbs/breadcrumbs.d.ts +94 -0
  77. package/dist/src/components/breadcrumbs/index.d.ts +1 -0
  78. package/dist/src/components/button/button.d.ts +37 -0
  79. package/dist/src/components/button/index.d.ts +2 -0
  80. package/dist/src/components/card/card.d.ts +31 -0
  81. package/dist/src/components/card/index.d.ts +1 -0
  82. package/dist/src/components/checkbox/checkbox.d.ts +196 -0
  83. package/dist/src/components/checkbox/index.d.ts +1 -0
  84. package/dist/src/components/collapsible/collapsible.d.ts +108 -0
  85. package/dist/src/components/collapsible/index.d.ts +1 -0
  86. package/dist/src/components/copy-to-clipboard/copy-to-clipboard.d.ts +86 -0
  87. package/dist/src/components/copy-to-clipboard/index.d.ts +1 -0
  88. package/dist/src/components/dropdown/dropdown.d.ts +115 -0
  89. package/dist/src/components/dropdown/index.d.ts +1 -0
  90. package/dist/src/components/empty-state/empty-state.d.ts +68 -0
  91. package/dist/src/components/empty-state/index.d.ts +1 -0
  92. package/dist/src/components/field/field.d.ts +88 -0
  93. package/dist/src/components/field/index.d.ts +1 -0
  94. package/dist/src/components/grid/grid.d.ts +134 -0
  95. package/dist/src/components/grid/index.d.ts +1 -0
  96. package/dist/src/components/input/index.d.ts +30 -0
  97. package/dist/src/components/input/input-area.d.ts +64 -0
  98. package/dist/src/components/input/input-variants.d.ts +58 -0
  99. package/dist/src/components/input/input.d.ts +67 -0
  100. package/dist/src/components/input-group/context.d.ts +95 -0
  101. package/dist/src/components/input-group/index.d.ts +1 -0
  102. package/dist/src/components/input-group/input-group-addon.d.ts +14 -0
  103. package/dist/src/components/input-group/input-group-button.d.ts +35 -0
  104. package/dist/src/components/input-group/input-group-input.d.ts +8 -0
  105. package/dist/src/components/input-group/input-group-suffix.d.ts +12 -0
  106. package/dist/src/components/input-group/input-group.d.ts +42 -0
  107. package/dist/src/components/label/index.d.ts +1 -0
  108. package/dist/src/components/label/label.d.ts +66 -0
  109. package/dist/src/components/link/index.d.ts +1 -0
  110. package/dist/src/components/link/link.d.ts +65 -0
  111. package/dist/src/components/menubar/index.d.ts +2 -0
  112. package/dist/src/components/menubar/menubar.d.ts +65 -0
  113. package/dist/src/components/menubar/use-menu-navigation.d.ts +7 -0
  114. package/dist/src/components/modal/index.d.ts +1 -0
  115. package/dist/src/components/modal/modal.d.ts +204 -0
  116. package/dist/src/components/page/index.d.ts +1 -0
  117. package/dist/src/components/page/page.d.ts +65 -0
  118. package/dist/src/components/pagination/index.d.ts +1 -0
  119. package/dist/src/components/pagination/pagination.d.ts +240 -0
  120. package/dist/src/components/popover/index.d.ts +2 -0
  121. package/dist/src/components/popover/popover.d.ts +177 -0
  122. package/dist/src/components/progress/index.d.ts +1 -0
  123. package/dist/src/components/progress/progress.d.ts +43 -0
  124. package/dist/src/components/radio/index.d.ts +1 -0
  125. package/dist/src/components/radio/radio.d.ts +276 -0
  126. package/dist/src/components/select/index.d.ts +1 -0
  127. package/dist/src/components/select/select.d.ts +283 -0
  128. package/dist/src/components/sensitive-input/index.d.ts +1 -0
  129. package/dist/src/components/sensitive-input/sensitive-input.d.ts +93 -0
  130. package/dist/src/components/sidebar/index.d.ts +1 -0
  131. package/dist/src/components/sidebar/sidebar.d.ts +579 -0
  132. package/dist/src/components/spinner/index.d.ts +2 -0
  133. package/dist/src/components/spinner/skeleton-line.d.ts +11 -0
  134. package/dist/src/components/spinner/spinner.d.ts +69 -0
  135. package/dist/src/components/table/index.d.ts +1 -0
  136. package/dist/src/components/table/table.d.ts +137 -0
  137. package/dist/src/components/table-of-contents/index.d.ts +1 -0
  138. package/dist/src/components/table-of-contents/table-of-contents.d.ts +71 -0
  139. package/dist/src/components/tabs/index.d.ts +2 -0
  140. package/dist/src/components/tabs/tabs.d.ts +115 -0
  141. package/dist/src/components/text/index.d.ts +1 -0
  142. package/dist/src/components/text/text.d.ts +213 -0
  143. package/dist/src/components/toast/index.d.ts +4 -0
  144. package/dist/src/components/toast/toast.d.ts +196 -0
  145. package/dist/src/components/toggle/index.d.ts +1 -0
  146. package/dist/src/components/toggle/toggle.d.ts +101 -0
  147. package/dist/src/components/toolbar/index.d.ts +1 -0
  148. package/dist/src/components/toolbar/toolbar.d.ts +49 -0
  149. package/dist/src/components/tooltip/index.d.ts +1 -0
  150. package/dist/src/components/tooltip/tooltip.d.ts +107 -0
  151. package/dist/src/components/top-navigation/index.d.ts +1 -0
  152. package/dist/src/components/top-navigation/top-navigation.d.ts +47 -0
  153. package/dist/src/index.d.ts +67 -0
  154. package/dist/src/utils/cn.d.ts +3 -0
  155. package/dist/src/utils/index.d.ts +4 -0
  156. package/dist/src/utils/link-provider.d.ts +11 -0
  157. package/dist/src/utils/portal-provider.d.ts +7 -0
  158. package/dist/src/utils/resolve-variant.d.ts +1 -0
  159. package/dist/styles/index.css +294 -0
  160. package/dist/table-CKmEd0O5.js +135 -0
  161. package/dist/table-of-contents-CuE1aDKE.js +91 -0
  162. package/dist/tabs-JX7xyFcA.js +101 -0
  163. package/dist/text-B0EvLge5.js +88 -0
  164. package/dist/toast-pSr7cFVU.js +274 -0
  165. package/dist/toggle-C72Skv4q.js +179 -0
  166. package/dist/toolbar-DtT4MUHB.js +109 -0
  167. package/dist/tooltip-QfSb4wnI.js +59 -0
  168. package/dist/top-navigation-DoTeFaXD.js +45 -0
  169. package/dist/utils.mjs +11 -0
  170. package/package.json +228 -0
@@ -0,0 +1,88 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Normalizes an error prop that may be a string or structured object
4
+ * into the `{ message, match }` shape expected by `<Field>`.
5
+ *
6
+ * Returns `undefined` when the input is falsy.
7
+ */
8
+ export declare function normalizeFieldError(error: string | {
9
+ message: ReactNode;
10
+ match: FieldErrorMatch;
11
+ } | undefined): {
12
+ message: ReactNode;
13
+ match: FieldErrorMatch;
14
+ } | undefined;
15
+ /** Field variant definitions (currently empty, reserved for future additions). */
16
+ export declare const GOLDFINCH_FIELD_VARIANTS: {};
17
+ export declare const GOLDFINCH_FIELD_DEFAULT_VARIANTS: {};
18
+ export interface GoldfinchFieldVariantsProps {
19
+ /**
20
+ * When true, places the control (checkbox/switch) before the label visually.
21
+ * When false (default), places the label before the control.
22
+ * Used to support different layout patterns (e.g., iOS-style toggles on the right).
23
+ */
24
+ controlFirst?: boolean;
25
+ }
26
+ export declare function fieldVariants({ controlFirst, }?: GoldfinchFieldVariantsProps): string;
27
+ /**
28
+ * Match type for field validation errors.
29
+ * Can be a boolean or a key from the browser's ValidityState interface.
30
+ * Source: BaseErrorProps["match"] (ComponentPropsWithoutRef<typeof FieldBase.Error>)
31
+ */
32
+ export type FieldErrorMatch = boolean | "badInput" | "customError" | "patternMismatch" | "rangeOverflow" | "rangeUnderflow" | "stepMismatch" | "tooLong" | "tooShort" | "typeMismatch" | "valid" | "valueMissing";
33
+ /**
34
+ * Field component props — wraps a form control with label, description, and error message.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * <Field label="Email" required>
39
+ * <Input placeholder="you@example.com" />
40
+ * </Field>
41
+ *
42
+ * <Field label="Phone" required={false} description="We'll only use this for account recovery.">
43
+ * <Input placeholder="+1 555-0000" />
44
+ * </Field>
45
+ * ```
46
+ */
47
+ export interface FieldProps extends GoldfinchFieldVariantsProps {
48
+ /** The form control element(s) to wrap (Input, Select, Checkbox, etc.). */
49
+ children: ReactNode;
50
+ /** The label content — can be a string or any React node. */
51
+ label: ReactNode;
52
+ /**
53
+ * When explicitly `false`, shows gray "(optional)" text after the label.
54
+ * When `true` or `undefined`, no indicator is shown.
55
+ */
56
+ required?: boolean;
57
+ /** Tooltip content displayed next to the label via an info icon. */
58
+ labelTooltip?: ReactNode;
59
+ /** Validation error with a message and a browser `ValidityState` match key. */
60
+ error?: {
61
+ message: ReactNode;
62
+ match: FieldErrorMatch;
63
+ };
64
+ /** Helper text displayed below the control (hidden when `error` is present). */
65
+ description?: ReactNode;
66
+ /** When `true`, places the control before the label (for checkbox/switch layouts). */
67
+ controlFirst?: boolean;
68
+ /**
69
+ * When `true`, Field renders layout, description, and error but skips
70
+ * the `<label>` element. Use when the child component provides its own
71
+ * accessible label (e.g. Select uses Base UI's `Select.Label` to avoid
72
+ * hover/focus coupling from native `<label>`).
73
+ * @default false
74
+ */
75
+ hideLabel?: boolean;
76
+ }
77
+ /**
78
+ * Form field wrapper that provides a label, optional description, and error display
79
+ * around any form control. Built on Base UI Field primitives.
80
+ *
81
+ * @example
82
+ * ```tsx
83
+ * <Field label="Username">
84
+ * <Input placeholder="Choose a username" />
85
+ * </Field>
86
+ * ```
87
+ */
88
+ export declare function Field({ children, label, required, labelTooltip, error, description, controlFirst, hideLabel, }: FieldProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export { Field, normalizeFieldError, type FieldProps, type FieldErrorMatch, fieldVariants, GOLDFINCH_FIELD_VARIANTS, GOLDFINCH_FIELD_DEFAULT_VARIANTS, } from './field';
@@ -0,0 +1,134 @@
1
+ import { default as React } from 'react';
2
+ /** Grid variant and gap definitions mapping layout names to their responsive Tailwind classes. */
3
+ export declare const GOLDFINCH_GRID_VARIANTS: {
4
+ readonly variant: {
5
+ readonly "2up": {
6
+ readonly classes: "grid-cols-1 md:grid-cols-2";
7
+ readonly description: "Grid items stack on small screens, display side-by-side on medium screens and up";
8
+ };
9
+ readonly "side-by-side": {
10
+ readonly classes: "grid-cols-2";
11
+ readonly description: "Grid items always displayed side-by-side";
12
+ };
13
+ readonly "2-1": {
14
+ readonly classes: "grid-cols-1 md:grid-cols-[2fr_1fr]";
15
+ readonly description: "Two-thirds / one-third split (66%/33%) on medium screens and up";
16
+ };
17
+ readonly "1-2": {
18
+ readonly classes: "grid-cols-1 md:grid-cols-[1fr_2fr]";
19
+ readonly description: "One-third / two-thirds split (33%/66%) on medium screens and up";
20
+ };
21
+ readonly "1-3up": {
22
+ readonly classes: "grid-cols-1 lg:grid-cols-3";
23
+ readonly description: "Grid items stack on small screens, expand to 3 across on large screens";
24
+ };
25
+ readonly "3up": {
26
+ readonly classes: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3";
27
+ readonly description: "Grid items stack on small screens, 2 across on medium, 3 across on large";
28
+ };
29
+ readonly "4up": {
30
+ readonly classes: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4";
31
+ readonly description: "Grid items stack on small screens, progressively increase columns at larger breakpoints";
32
+ };
33
+ readonly "6up": {
34
+ readonly classes: "grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6";
35
+ readonly description: "Grid items start at 2 across, expand to 6 across on XL";
36
+ };
37
+ readonly "1-2-4up": {
38
+ readonly classes: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4";
39
+ readonly description: "Grid items stack on small screens, 2 across on medium, 4 across on large";
40
+ };
41
+ };
42
+ readonly gap: {
43
+ readonly none: {
44
+ readonly classes: "gap-0";
45
+ readonly description: "No gap between grid items";
46
+ };
47
+ readonly sm: {
48
+ readonly classes: "gap-3";
49
+ readonly description: "Small gap between grid items";
50
+ };
51
+ readonly base: {
52
+ readonly classes: "gap-2 md:gap-6 lg:gap-8";
53
+ readonly description: "Default responsive gap between grid items";
54
+ };
55
+ readonly lg: {
56
+ readonly classes: "gap-8";
57
+ readonly description: "Large gap between grid items";
58
+ };
59
+ };
60
+ };
61
+ export declare const GOLDFINCH_GRID_DEFAULT_VARIANTS: {
62
+ readonly gap: "base";
63
+ };
64
+ export type GoldfinchGridVariant = keyof typeof GOLDFINCH_GRID_VARIANTS.variant;
65
+ export type GoldfinchGridGap = keyof typeof GOLDFINCH_GRID_VARIANTS.gap;
66
+ /**
67
+ * Grid component props.
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * <Grid variant="3up" gap="sm">
72
+ * <GridItem className="p-4">1</GridItem>
73
+ * <GridItem className="p-4">2</GridItem>
74
+ * <GridItem className="p-4">3</GridItem>
75
+ * </Grid>
76
+ * ```
77
+ */
78
+ export interface GridProps extends React.HTMLAttributes<HTMLDivElement> {
79
+ /** Grid items to render. */
80
+ children?: React.ReactNode;
81
+ /** Additional CSS classes merged via `cn()`. */
82
+ className?: string;
83
+ /** Show dividers between grid items on mobile (only works with `"4up"` variant). */
84
+ mobileDivider?: boolean;
85
+ /**
86
+ * Gap size between grid items.
87
+ * - `"none"` — No gap
88
+ * - `"sm"` — 12px gap
89
+ * - `"base"` — Responsive gap (8px → 24px → 32px)
90
+ * - `"lg"` — 32px gap
91
+ * @default "base"
92
+ */
93
+ gap?: GoldfinchGridGap;
94
+ /**
95
+ * Responsive column layout variant.
96
+ * - `"2up"` — 1 col → 2 cols at md
97
+ * - `"side-by-side"` — Always 2 cols
98
+ * - `"2-1"` — 66%/33% split at md
99
+ * - `"1-2"` — 33%/66% split at md
100
+ * - `"3up"` — 1 → 2 → 3 cols
101
+ * - `"4up"` — 1 → 2 → 3 → 4 cols
102
+ * - `"6up"` — 2 → 3 → 4 → 6 cols
103
+ * - `"1-2-4up"` — 1 → 2 → 4 cols
104
+ */
105
+ variant?: GoldfinchGridVariant;
106
+ }
107
+ /** GridItem component props — a single cell within a Grid. */
108
+ export interface GridItemProps extends React.HTMLAttributes<HTMLDivElement> {
109
+ /** Content for this grid cell. */
110
+ children?: React.ReactNode;
111
+ /** Additional CSS classes merged via `cn()`. */
112
+ className?: string;
113
+ }
114
+ export declare function gridVariants({ variant, gap, }?: {
115
+ variant?: GoldfinchGridVariant;
116
+ gap?: GoldfinchGridGap;
117
+ }): string;
118
+ export declare function gridItemVariants({ variant, mobileDivider, }?: {
119
+ variant?: GoldfinchGridVariant;
120
+ mobileDivider?: boolean;
121
+ }): string;
122
+ /**
123
+ * Responsive CSS grid layout container with preset column configurations.
124
+ *
125
+ * @example
126
+ * ```tsx
127
+ * <Grid variant="2up" gap="base">
128
+ * <GridItem>Left</GridItem>
129
+ * <GridItem>Right</GridItem>
130
+ * </Grid>
131
+ * ```
132
+ */
133
+ export declare const Grid: React.ForwardRefExoticComponent<GridProps & React.RefAttributes<HTMLDivElement>>;
134
+ export declare const GridItem: React.ForwardRefExoticComponent<GridItemProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ export { Grid, GridItem, gridVariants, gridItemVariants, GOLDFINCH_GRID_VARIANTS, GOLDFINCH_GRID_DEFAULT_VARIANTS, type GridProps, type GridItemProps, type GoldfinchGridVariant, type GoldfinchGridGap, } from './grid';
@@ -0,0 +1,30 @@
1
+ import { Input as InputBase } from './input';
2
+ import { InputGroup } from '../input-group';
3
+ import { SensitiveInput } from '../sensitive-input/sensitive-input';
4
+ export { inputVariants, type InputProps } from './input';
5
+ export { InputArea, Textarea, type InputAreaProps } from './input-area';
6
+ export { InputGroup, GOLDFINCH_INPUT_GROUP_VARIANTS, GOLDFINCH_INPUT_GROUP_DEFAULT_VARIANTS, } from '../input-group';
7
+ /**
8
+ * Assembled here rather than in input.tsx: InputGroup and SensitiveInput both
9
+ * import input.tsx's variant config, so input.tsx can't also import them at
10
+ * module scope without a circular import.
11
+ */
12
+ export declare const Input: typeof InputBase & {
13
+ Group: typeof InputGroup;
14
+ Sensitive: typeof SensitiveInput;
15
+ };
16
+ /**
17
+ * @deprecated `focusMode` is no longer a public prop — it is auto-detected by
18
+ * `InputGroup` based on its children. This type will be removed in a future
19
+ * major version.
20
+ */
21
+ export type GoldfinchInputGroupFocusMode = "container" | "individual";
22
+ /**
23
+ * @deprecated `focusMode` is no longer a public prop — it is auto-detected by
24
+ * `InputGroup` based on its children. Use `InputGroupRootProps` from
25
+ * `@catiarodrigues/goldfinch` instead. This type will be removed in a future major
26
+ * version.
27
+ */
28
+ export interface GoldfinchInputGroupVariantsProps {
29
+ focusMode?: GoldfinchInputGroupFocusMode;
30
+ }
@@ -0,0 +1,64 @@
1
+ import { ReactNode } from 'react';
2
+ import { FieldErrorMatch } from '../field/field';
3
+ import * as React from "react";
4
+ export declare const InputArea: React.ForwardRefExoticComponent<{
5
+ onValueChange?: (value: string) => void;
6
+ variant?: "default" | "error";
7
+ size?: "xs" | "sm" | "base" | "lg";
8
+ children?: React.ReactNode;
9
+ className?: string;
10
+ /** Label content for the textarea (enables Field wrapper) - can be a string or any React node */
11
+ label?: ReactNode;
12
+ /** Tooltip content to display next to the label via an info icon */
13
+ labelTooltip?: ReactNode;
14
+ /** Helper text displayed below the textarea */
15
+ description?: ReactNode;
16
+ /** Error message or validation error object */
17
+ error?: string | {
18
+ message: ReactNode;
19
+ match: FieldErrorMatch;
20
+ };
21
+ } & Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> & React.RefAttributes<HTMLTextAreaElement>>;
22
+ /** Alias for InputArea — provided for discoverability when migrating from other libraries */
23
+ export declare const Textarea: React.ForwardRefExoticComponent<{
24
+ onValueChange?: (value: string) => void;
25
+ variant?: "default" | "error";
26
+ size?: "xs" | "sm" | "base" | "lg";
27
+ children?: React.ReactNode;
28
+ className?: string;
29
+ /** Label content for the textarea (enables Field wrapper) - can be a string or any React node */
30
+ label?: ReactNode;
31
+ /** Tooltip content to display next to the label via an info icon */
32
+ labelTooltip?: ReactNode;
33
+ /** Helper text displayed below the textarea */
34
+ description?: ReactNode;
35
+ /** Error message or validation error object */
36
+ error?: string | {
37
+ message: ReactNode;
38
+ match: FieldErrorMatch;
39
+ };
40
+ } & Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> & React.RefAttributes<HTMLTextAreaElement>>;
41
+ /**
42
+ * InputArea component props
43
+ * @property {ReactNode} [label] - Label content for the textarea (enables Field wrapper)
44
+ * @property {ReactNode} [description] - Helper text displayed below the textarea
45
+ * @property {string | { message: ReactNode, match: FieldErrorMatch }} [error] - Error message or validation error object
46
+ */
47
+ export type InputAreaProps = {
48
+ onValueChange?: (value: string) => void;
49
+ variant?: "default" | "error";
50
+ size?: "xs" | "sm" | "base" | "lg";
51
+ children?: React.ReactNode;
52
+ className?: string;
53
+ /** Label content for the textarea (enables Field wrapper) - can be a string or any React node */
54
+ label?: ReactNode;
55
+ /** Tooltip content to display next to the label via an info icon */
56
+ labelTooltip?: ReactNode;
57
+ /** Helper text displayed below the textarea */
58
+ description?: ReactNode;
59
+ /** Error message or validation error object */
60
+ error?: string | {
61
+ message: ReactNode;
62
+ match: FieldErrorMatch;
63
+ };
64
+ } & Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size">;
@@ -0,0 +1,58 @@
1
+ /** Input size and variant definitions mapping names to their Tailwind classes. */
2
+ export declare const GOLDFINCH_INPUT_VARIANTS: {
3
+ readonly size: {
4
+ readonly xs: {
5
+ readonly classes: "h-5 gap-1 rounded-sm px-1.5 text-xs";
6
+ readonly description: "Extra small input for compact UIs";
7
+ };
8
+ readonly sm: {
9
+ readonly classes: "h-6.5 gap-1 rounded-md px-2 text-xs";
10
+ readonly description: "Small input for secondary fields";
11
+ };
12
+ readonly base: {
13
+ readonly classes: "h-9 gap-1.5 rounded-lg px-3 text-base";
14
+ readonly description: "Default input size";
15
+ };
16
+ readonly lg: {
17
+ readonly classes: "h-10 gap-2 rounded-lg px-4 text-base";
18
+ readonly description: "Large input for prominent fields";
19
+ };
20
+ };
21
+ readonly variant: {
22
+ readonly default: {
23
+ readonly classes: "focus:ring-goldfinch-focus/50 focus:ring-[1.5px]";
24
+ readonly description: "Default input appearance";
25
+ };
26
+ readonly error: {
27
+ readonly classes: "!ring-goldfinch-danger focus:ring-goldfinch-danger/50 focus:ring-[1.5px]";
28
+ readonly description: "Error state for validation failures";
29
+ };
30
+ };
31
+ };
32
+ export declare const GOLDFINCH_INPUT_DEFAULT_VARIANTS: {
33
+ readonly size: "base";
34
+ readonly variant: "default";
35
+ };
36
+ export type GoldfinchInputSize = keyof typeof GOLDFINCH_INPUT_VARIANTS.size;
37
+ export type GoldfinchInputVariant = keyof typeof GOLDFINCH_INPUT_VARIANTS.variant;
38
+ export interface GoldfinchInputVariantsProps {
39
+ /**
40
+ * Input size.
41
+ * - `"xs"` — Extra small for compact UIs
42
+ * - `"sm"` — Small for secondary fields
43
+ * - `"base"` — Default size
44
+ * - `"lg"` — Large for prominent fields
45
+ * @default "base"
46
+ */
47
+ size?: GoldfinchInputSize;
48
+ /**
49
+ * Visual variant.
50
+ * - `"default"` — Standard input
51
+ * - `"error"` — Error state for validation failures
52
+ * @default "default"
53
+ */
54
+ variant?: GoldfinchInputVariant;
55
+ parentFocusIndicator?: boolean;
56
+ focusIndicator?: boolean;
57
+ }
58
+ export declare function inputVariants({ variant, size, parentFocusIndicator, focusIndicator, }?: GoldfinchInputVariantsProps): string;
@@ -0,0 +1,67 @@
1
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import { Input as BaseInput } from '@base-ui/react/input';
3
+ import { FieldErrorMatch } from '../field/field';
4
+ import { GOLDFINCH_INPUT_VARIANTS, GOLDFINCH_INPUT_DEFAULT_VARIANTS, inputVariants, GoldfinchInputSize, GoldfinchInputVariant, GoldfinchInputVariantsProps } from './input-variants';
5
+ export { GOLDFINCH_INPUT_VARIANTS, GOLDFINCH_INPUT_DEFAULT_VARIANTS, inputVariants, type GoldfinchInputSize, type GoldfinchInputVariant, type GoldfinchInputVariantsProps, };
6
+ type BaseInputProps = Omit<ComponentPropsWithoutRef<typeof BaseInput>, "size">;
7
+ export declare const Input: import('react').ForwardRefExoticComponent<Pick<GoldfinchInputVariantsProps, "variant" | "size"> & BaseInputProps & {
8
+ /** Label content for the input (enables Field wrapper) - can be a string or any React node */
9
+ label?: ReactNode;
10
+ /** Tooltip content to display next to the label via an info icon */
11
+ labelTooltip?: ReactNode;
12
+ /** Helper text displayed below the input */
13
+ description?: ReactNode;
14
+ /** Error message or validation error object */
15
+ error?: string | {
16
+ message: ReactNode;
17
+ match: FieldErrorMatch;
18
+ };
19
+ /** Suppress browser extension password manager overlays on non-credential inputs. */
20
+ passwordManagerIgnore?: boolean;
21
+ } & import('react').RefAttributes<HTMLInputElement>>;
22
+ /**
23
+ * Input component props with accessibility guidance.
24
+ *
25
+ * **Accessible Name Required:** Input should have one of:
26
+ * 1. `label` prop (recommended) - enables Field wrapper with label/description/error
27
+ * 2. `placeholder` + `aria-label` - for bare inputs with visual placeholder
28
+ * 3. `aria-labelledby` - for custom label association
29
+ *
30
+ * Missing accessible names will trigger console warnings in development.
31
+ *
32
+ * @example
33
+ * // Recommended: Built-in Field wrapper
34
+ * <Input label="Email" placeholder="you@example.com" />
35
+ *
36
+ * @example
37
+ * // Bare input with placeholder and aria-label
38
+ * <Input placeholder="Search..." aria-label="Search products" />
39
+ *
40
+ * @example
41
+ * // Custom label association
42
+ * <label id="email-label">Email</label>
43
+ * <Input aria-labelledby="email-label" />
44
+ *
45
+ * @example
46
+ * // With description and error
47
+ * <Input
48
+ * label="Password"
49
+ * description="Must be at least 8 characters"
50
+ * error="Password is too short"
51
+ * />
52
+ */
53
+ export type InputProps = Pick<GoldfinchInputVariantsProps, "size" | "variant"> & BaseInputProps & {
54
+ /** Label content for the input (enables Field wrapper) - can be a string or any React node */
55
+ label?: ReactNode;
56
+ /** Tooltip content to display next to the label via an info icon */
57
+ labelTooltip?: ReactNode;
58
+ /** Helper text displayed below the input */
59
+ description?: ReactNode;
60
+ /** Error message or validation error object */
61
+ error?: string | {
62
+ message: ReactNode;
63
+ match: FieldErrorMatch;
64
+ };
65
+ /** Suppress browser extension password manager overlays on non-credential inputs. */
66
+ passwordManagerIgnore?: boolean;
67
+ };
@@ -0,0 +1,95 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ import { GoldfinchInputSize } from '../input/input';
3
+ import { FieldProps } from '../field/field';
4
+ export interface InputGroupSizeTokens {
5
+ /** Full outer padding — matches standalone Input (e.g. px-3). */
6
+ inputOuter: string;
7
+ /**
8
+ * Directional outer padding for Addon at the container edge.
9
+ *
10
+ * These MUST be static pl-/pr- strings (not derived at runtime via
11
+ * `"px-N".replace(…)`) so Tailwind JIT can detect them during its
12
+ * source-file scan. Dynamic string construction produces class names
13
+ * that never appear as literals, so Tailwind never generates the CSS.
14
+ */
15
+ addonOuterStart: string;
16
+ addonOuterEnd: string;
17
+ /**
18
+ * Reduced outer padding when the Addon contains a Button.
19
+ * Buttons have their own internal padding, so the Addon can use
20
+ * less outer padding to keep the visual gap balanced.
21
+ */
22
+ addonButtonOuterStart: string;
23
+ addonButtonOuterEnd: string;
24
+ /** pr- for suffix when no end addon. */
25
+ suffixPad: string;
26
+ fontSize: string;
27
+ /** Icon size in px. */
28
+ iconSize: number;
29
+ }
30
+ export declare const INPUT_GROUP_SIZE: Record<GoldfinchInputSize, InputGroupSizeTokens>;
31
+ export declare const INPUT_GROUP_HAS_CLASSES: Record<GoldfinchInputSize, string>;
32
+ /**
33
+ * Props for `InputGroup.Root`. Focus mode is auto-detected from children
34
+ * (see `detectFocusMode`), so it is not part of the public or internal API.
35
+ */
36
+ export interface InputGroupRootPropsInternal extends HTMLAttributes<HTMLElement>, Partial<Pick<FieldProps, "label" | "description" | "error" | "required" | "labelTooltip">> {
37
+ size?: GoldfinchInputSize | undefined;
38
+ disabled?: boolean;
39
+ }
40
+ /** Public InputGroup.Root props — identical to the internal type. */
41
+ export type InputGroupRootProps = InputGroupRootPropsInternal;
42
+ export interface InputGroupContextValue {
43
+ size?: GoldfinchInputSize;
44
+ focusMode: "container" | "individual" | "hybrid";
45
+ disabled: boolean;
46
+ error?: FieldProps["error"];
47
+ /** Auto-generated id for the input element; used by the invisible label overlay. */
48
+ inputId: string;
49
+ }
50
+ export declare const InputGroupContext: import('react').Context<InputGroupContextValue | null>;
51
+ /**
52
+ * Set to `true` by `InputGroup.Addon` so that `InputGroup.Button` can detect
53
+ * whether it's wrapped in an Addon. Ghost buttons should always live inside
54
+ * an Addon for correct spacing.
55
+ */
56
+ export declare const InputGroupAddonContext: import('react').Context<boolean>;
57
+ /**
58
+ * Reads InputGroupContext and warns in development when the context is null
59
+ * (i.e. when a sub-component is rendered outside of `<InputGroup>`).
60
+ */
61
+ export declare function useInputGroupContext(componentName: string): InputGroupContextValue | null;
62
+ /**
63
+ * Partitions InputGroup children for hybrid focus mode.
64
+ *
65
+ * Container zone: Addon, Input, Suffix, text nodes — everything that should
66
+ * share a single container-style border.
67
+ *
68
+ * Individual zone: Direct `InputGroup.Button` elements that manage their own
69
+ * border and focus ring.
70
+ *
71
+ * Uses `displayName` comparison to identify elements, avoiding circular
72
+ * imports between `context.ts` and the sub-component files.
73
+ */
74
+ export declare function partitionChildren(children: ReactNode): {
75
+ containerZone: ReactNode[];
76
+ individualZone: ReactNode[];
77
+ };
78
+ /**
79
+ * Analyzes the direct children of `InputGroup` to determine the focus mode.
80
+ *
81
+ * Returns `"hybrid"` when BOTH an `InputGroup.Addon` AND a non-ghost direct
82
+ * `InputGroup.Button` are present. In hybrid mode, Addon+Input share a
83
+ * container-style border while Buttons get individual borders.
84
+ *
85
+ * Returns `"individual"` when a non-ghost direct `InputGroup.Button` is
86
+ * present WITHOUT any `InputGroup.Addon`. This signals a toolbar/pagination
87
+ * layout where each element manages its own focus ring.
88
+ *
89
+ * Returns `"container"` (default) in all other cases — the container owns a
90
+ * single shared focus ring.
91
+ *
92
+ * Uses `displayName` comparison to identify elements, avoiding circular
93
+ * imports between `context.ts` and the sub-component files.
94
+ */
95
+ export declare function detectFocusMode(children: ReactNode): "container" | "individual" | "hybrid";
@@ -0,0 +1 @@
1
+ export { InputGroup, GOLDFINCH_INPUT_GROUP_VARIANTS, GOLDFINCH_INPUT_GROUP_DEFAULT_VARIANTS, type InputGroupRootProps, type InputGroupInputProps, type InputGroupButtonProps, type InputGroupAddonProps, type InputGroupSuffixProps, } from './input-group';
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ export interface InputGroupAddonProps {
3
+ /** Position relative to the input. @default "start" */
4
+ align?: "start" | "end";
5
+ /** Additional CSS classes. */
6
+ className?: string;
7
+ /** Addon content: icons, buttons, spinners, text. */
8
+ children?: ReactNode;
9
+ }
10
+ /**
11
+ * Container for icons, text, or compact buttons positioned at the start or end
12
+ * of the input. Automatically sizes icon children to match the input size.
13
+ */
14
+ export declare const Addon: import('react').ForwardRefExoticComponent<InputGroupAddonProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,35 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { ButtonProps } from '../button/button';
3
+ import { GoldfinchTooltipSide } from '../tooltip/tooltip';
4
+ export type InputGroupButtonProps = ButtonProps & {
5
+ /**
6
+ * When provided, wraps the button in a `Tooltip` showing this content on hover.
7
+ * Automatically sets `aria-label` from a string value when no `aria-label` is set.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * <InputGroup.Addon align="end">
12
+ * <InputGroup.Button tooltip="Query language help" aria-label="Query language help">
13
+ * <QuestionIcon size={16} />
14
+ * </InputGroup.Button>
15
+ * </InputGroup.Addon>
16
+ * ```
17
+ */
18
+ tooltip?: ReactNode;
19
+ /**
20
+ * Preferred side for the tooltip popup.
21
+ * @default "bottom"
22
+ */
23
+ tooltipSide?: GoldfinchTooltipSide;
24
+ };
25
+ /**
26
+ * Button for secondary actions rendered inside `InputGroup.Addon`
27
+ * (toggle, copy, help).
28
+ *
29
+ * In `focusMode="container"` (default), renders as a compact ghost button
30
+ * subordinate to the input. In `focusMode="individual"`, renders as a full
31
+ * standalone button with its own focus ring, matching toolbar/pagination usage.
32
+ *
33
+ * Pass a `tooltip` prop to show a tooltip on hover.
34
+ */
35
+ export declare const Button: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<InputGroupButtonProps>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,8 @@
1
+ import { InputProps } from '../input/input';
2
+ /** Props for InputGroup.Input — omits Field props since InputGroup handles them. */
3
+ export type InputGroupInputProps = Omit<InputProps, "label" | "labelTooltip" | "description" | "error" | "size" | "disabled">;
4
+ /**
5
+ * Text input that inherits size, disabled, and error state from InputGroup context.
6
+ * Automatically sets `aria-invalid` when parent has an error.
7
+ */
8
+ export declare const Input: import('react').ForwardRefExoticComponent<InputGroupInputProps & import('react').RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ export interface InputGroupSuffixProps {
3
+ /** Additional CSS classes. */
4
+ className?: string;
5
+ /** Suffix content (e.g., ".app"). */
6
+ children?: ReactNode;
7
+ }
8
+ /**
9
+ * Inline suffix that flows seamlessly next to the typed input value.
10
+ * Input width adjusts automatically via CSS `field-sizing: content`.
11
+ */
12
+ export declare const Suffix: import('react').ForwardRefExoticComponent<InputGroupSuffixProps & import('react').RefAttributes<HTMLDivElement>>;