@madecki/ui 1.5.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { ReactNode, HTMLInputTypeAttribute } from 'react';
3
+ import { ReactNode, AriaRole, HTMLInputTypeAttribute } from 'react';
4
4
 
5
5
  type ColorVariants = "primary" | "success" | "warning" | "danger" | "info" | "white" | "gray" | "lightGray" | "darkGray" | "neutral" | "blue";
6
6
  type ThemeMode = "light" | "dark";
@@ -17,8 +17,11 @@ interface ButtonProps {
17
17
  disabled?: boolean;
18
18
  className?: string;
19
19
  type?: "button" | "submit" | "reset";
20
+ /** e.g. `radio` when used inside a `radiogroup` */
21
+ role?: AriaRole;
22
+ ariaChecked?: boolean | "mixed";
20
23
  }
21
- declare const Button: ({ variant, size, children, onClick, isActive, id, label, disabled, className, type, }: ButtonProps) => react_jsx_runtime.JSX.Element;
24
+ declare const Button: ({ variant, size, children, onClick, isActive, id, label, disabled, className, type, role, ariaChecked, }: ButtonProps) => react_jsx_runtime.JSX.Element;
22
25
 
23
26
  interface ButtonTransparentProps {
24
27
  variant: Exclude<ColorVariants, "primary">;
@@ -40,13 +43,18 @@ interface GradientButtonProps {
40
43
  }
41
44
  declare const GradientButton: ({ children, onClick, size, disabled, className, type, }: GradientButtonProps) => react_jsx_runtime.JSX.Element;
42
45
 
46
+ type LabelVisibility = "visible" | "sr-only";
47
+
43
48
  interface RadioButtonsProps {
44
- items: Omit<ButtonProps, "size" | "onClick" | "isActive">[];
49
+ label: string;
50
+ /** Default `visible`. Use `sr-only` to hide the group label visually while keeping it for assistive tech. */
51
+ labelVisibility?: LabelVisibility;
52
+ items: Omit<ButtonProps, "size" | "onClick" | "isActive" | "role" | "ariaChecked">[];
45
53
  onChange: (value: string) => void;
46
54
  size?: ButtonProps["size"];
47
55
  className?: string;
48
56
  }
49
- declare const RadioButtons: ({ items, onChange, size, className, }: RadioButtonsProps) => react_jsx_runtime.JSX.Element;
57
+ declare const RadioButtons: ({ label, labelVisibility, items, onChange, size, className, }: RadioButtonsProps) => react_jsx_runtime.JSX.Element;
50
58
 
51
59
  interface TagProps {
52
60
  variant: ColorVariants;
@@ -70,6 +78,8 @@ interface InputProps {
70
78
  defaultValue?: string;
71
79
  placeholder?: string;
72
80
  label: string;
81
+ /** Default `visible`. Use `sr-only` to hide the label visually while keeping it for assistive tech. */
82
+ labelVisibility?: LabelVisibility;
73
83
  variant?: "primary" | "secondary" | "tertiary";
74
84
  /** Any standard HTML `input` type (e.g. `date`, `time`, `email`). */
75
85
  type?: HTMLInputTypeAttribute;
@@ -85,7 +95,31 @@ interface InputProps {
85
95
  /** Sets `data-testid` on the native `<input>` for e2e (e.g. Playwright). */
86
96
  testId?: string;
87
97
  }
88
- declare const Input: ({ name, onChange, value: valueProp, defaultValue, placeholder, label, variant, type, maxLength, required, pattern, title, ariaLabel, spellCheck, disabled, className, icon, testId, }: InputProps) => react_jsx_runtime.JSX.Element;
98
+ declare const Input: ({ name, onChange, value: valueProp, defaultValue, placeholder, label, labelVisibility, variant, type, maxLength, required, pattern, title, ariaLabel, spellCheck, disabled, className, icon, testId, }: InputProps) => react_jsx_runtime.JSX.Element;
99
+
100
+ interface TextareaProps {
101
+ name: string;
102
+ onChange?: (value: string) => void;
103
+ /** When set, the textarea is controlled; the parent must update this from `onChange`. */
104
+ value?: string;
105
+ /** Initial value when uncontrolled (`value` omitted). Does not update after mount if `defaultValue` prop changes. */
106
+ defaultValue?: string;
107
+ placeholder?: string;
108
+ label: string;
109
+ /** Default `visible`. Use `sr-only` to hide the label visually while keeping it for assistive tech. */
110
+ labelVisibility?: LabelVisibility;
111
+ variant?: "primary" | "secondary" | "tertiary";
112
+ rows?: number;
113
+ maxLength?: number;
114
+ required?: boolean;
115
+ ariaLabel?: string;
116
+ spellCheck?: boolean;
117
+ disabled?: boolean;
118
+ className?: string;
119
+ /** Sets `data-testid` on the native `<textarea>` for e2e (e.g. Playwright). */
120
+ testId?: string;
121
+ }
122
+ declare const Textarea: ({ name, onChange, value: valueProp, defaultValue, placeholder, label, labelVisibility, variant, rows, maxLength, required, ariaLabel, spellCheck, disabled, className, testId, }: TextareaProps) => react_jsx_runtime.JSX.Element;
89
123
 
90
124
  type SelectOption = {
91
125
  value: string;
@@ -94,6 +128,8 @@ type SelectOption = {
94
128
  type BaseSelectProps = {
95
129
  name: string;
96
130
  label: string;
131
+ /** Default `visible`. Use `sr-only` to hide the label visually while keeping it for assistive tech. */
132
+ labelVisibility?: LabelVisibility;
97
133
  options: SelectOption[];
98
134
  placeholder?: string;
99
135
  variant?: "primary" | "secondary" | "tertiary";
@@ -143,6 +179,23 @@ interface SpinnerOverlayProps extends SpinnerProps {
143
179
  }
144
180
  declare const SpinnerOverlay: ({ isVisible, size, className, }: SpinnerOverlayProps) => react_jsx_runtime.JSX.Element | null;
145
181
 
182
+ type ToastVariant = "danger" | "success" | "info";
183
+ type ToastPlacement = "top-left" | "top-right" | "bottom-left" | "bottom-right";
184
+ interface ToastProps {
185
+ children: ReactNode;
186
+ variant?: ToastVariant;
187
+ placement?: ToastPlacement;
188
+ /**
189
+ * Time in milliseconds before the toast dismisses itself.
190
+ * Pass `0` to disable auto-close. Default: `5000`.
191
+ */
192
+ autoCloseMs?: number;
193
+ /** Called after the user closes the toast or auto-close fires. */
194
+ onClose?: () => void;
195
+ className?: string;
196
+ }
197
+ declare const Toast: ({ children, variant, placement, autoCloseMs, onClose, className, }: ToastProps) => react_jsx_runtime.JSX.Element | null;
198
+
146
199
  interface BlockQuoteProps {
147
200
  children: ReactNode;
148
201
  className?: string;
@@ -154,14 +207,31 @@ interface HrProps {
154
207
  }
155
208
  declare const Hr: ({ className }: HrProps) => react_jsx_runtime.JSX.Element;
156
209
 
210
+ type ContentBoxVariant = "info" | "warning" | "success" | "danger";
211
+
157
212
  interface ContentBoxProps {
158
213
  children: ReactNode;
159
- variant?: "info" | "warning" | "success" | "danger";
214
+ variant?: ContentBoxVariant;
160
215
  icon?: ReactNode;
161
216
  className?: string;
162
217
  }
163
218
  declare const ContentBox: ({ children, variant, icon, className, }: ContentBoxProps) => react_jsx_runtime.JSX.Element;
164
219
 
220
+ interface DetailsPanelProps {
221
+ /** Label / title row for the native `<summary>` element. */
222
+ summary: ReactNode;
223
+ /** Shown when the panel is expanded (native `<details>` body). */
224
+ children: ReactNode;
225
+ variant?: ContentBoxVariant;
226
+ /** Optional icon before the summary text (ContentBox-style affordance, inline). */
227
+ icon?: ReactNode;
228
+ /** Initial open state; panel remains toggleable (state synced via `onToggle`). */
229
+ defaultOpen?: boolean;
230
+ className?: string;
231
+ id?: string;
232
+ }
233
+ declare const DetailsPanel: ({ summary, children, variant, icon, defaultOpen, className, id, }: DetailsPanelProps) => react_jsx_runtime.JSX.Element;
234
+
165
235
  interface ContainerProps {
166
236
  children: ReactNode;
167
237
  size?: "sm" | "md" | "lg" | "xl" | "full";
@@ -209,13 +279,14 @@ declare const Heading: ({ children, level, size, weight, color, className, }: He
209
279
 
210
280
  interface TextProps {
211
281
  children: ReactNode;
282
+ id?: string;
212
283
  size?: "xs" | "sm" | "md" | "lg";
213
284
  weight?: "normal" | "medium" | "semibold" | "bold";
214
285
  color?: "default" | "muted" | "primary" | "success" | "warning" | "danger";
215
286
  as?: "p" | "span" | "div" | "label";
216
287
  className?: string;
217
288
  }
218
- declare const Text: ({ children, size, weight, color, as: Tag, className, }: TextProps) => react_jsx_runtime.JSX.Element;
289
+ declare const Text: ({ children, id, size, weight, color, as: Tag, className, }: TextProps) => react_jsx_runtime.JSX.Element;
219
290
 
220
291
  interface HeartProps {
221
292
  variant?: "outline" | "filled" | "gradient";
@@ -258,4 +329,4 @@ declare const TwitterIcon: ({ className, size, withWrapper, }: SocialIconProps)
258
329
  declare const LinkedInIcon: ({ className, size, withWrapper, }: SocialIconProps) => react_jsx_runtime.JSX.Element;
259
330
  declare const InstagramIcon: ({ className, size, withWrapper, }: SocialIconProps) => react_jsx_runtime.JSX.Element;
260
331
 
261
- export { BlockQuote, type BlockQuoteProps, Button, type ButtonProps, ButtonTransparent, type ButtonTransparentProps, type ColorVariants, Container, type ContainerProps, ContentBox, type ContentBoxProps, GradientButton, type GradientButtonProps, Grid, GridItem, type GridItemProps, type GridProps, Heading, type HeadingProps, Heart, type HeartProps, Hr, type HrProps, Info, type InfoProps, Input, type InputProps, InstagramIcon, LinkedInIcon, type MultiSelectProps, RadioButtons, type RadioButtonsProps, Search, type SearchProps, Select, type SelectOption, type SelectProps, Share, type ShareProps, type SingleSelectProps, type Size, type SocialIconProps, Spinner, SpinnerOverlay, type SpinnerOverlayProps, type SpinnerProps, Stack, type StackProps, type Tab, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, type ThemeMode, TwitterIcon, Warning, type WarningProps };
332
+ export { BlockQuote, type BlockQuoteProps, Button, type ButtonProps, ButtonTransparent, type ButtonTransparentProps, type ColorVariants, Container, type ContainerProps, ContentBox, type ContentBoxProps, DetailsPanel, type DetailsPanelProps, GradientButton, type GradientButtonProps, Grid, GridItem, type GridItemProps, type GridProps, Heading, type HeadingProps, Heart, type HeartProps, Hr, type HrProps, Info, type InfoProps, Input, type InputProps, InstagramIcon, type LabelVisibility, LinkedInIcon, type MultiSelectProps, RadioButtons, type RadioButtonsProps, Search, type SearchProps, Select, type SelectOption, type SelectProps, Share, type ShareProps, type SingleSelectProps, type Size, type SocialIconProps, Spinner, SpinnerOverlay, type SpinnerOverlayProps, type SpinnerProps, Stack, type StackProps, type Tab, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, Textarea, type TextareaProps, type ThemeMode, Toast, type ToastPlacement, type ToastProps, type ToastVariant, TwitterIcon, Warning, type WarningProps };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { ReactNode, HTMLInputTypeAttribute } from 'react';
3
+ import { ReactNode, AriaRole, HTMLInputTypeAttribute } from 'react';
4
4
 
5
5
  type ColorVariants = "primary" | "success" | "warning" | "danger" | "info" | "white" | "gray" | "lightGray" | "darkGray" | "neutral" | "blue";
6
6
  type ThemeMode = "light" | "dark";
@@ -17,8 +17,11 @@ interface ButtonProps {
17
17
  disabled?: boolean;
18
18
  className?: string;
19
19
  type?: "button" | "submit" | "reset";
20
+ /** e.g. `radio` when used inside a `radiogroup` */
21
+ role?: AriaRole;
22
+ ariaChecked?: boolean | "mixed";
20
23
  }
21
- declare const Button: ({ variant, size, children, onClick, isActive, id, label, disabled, className, type, }: ButtonProps) => react_jsx_runtime.JSX.Element;
24
+ declare const Button: ({ variant, size, children, onClick, isActive, id, label, disabled, className, type, role, ariaChecked, }: ButtonProps) => react_jsx_runtime.JSX.Element;
22
25
 
23
26
  interface ButtonTransparentProps {
24
27
  variant: Exclude<ColorVariants, "primary">;
@@ -40,13 +43,18 @@ interface GradientButtonProps {
40
43
  }
41
44
  declare const GradientButton: ({ children, onClick, size, disabled, className, type, }: GradientButtonProps) => react_jsx_runtime.JSX.Element;
42
45
 
46
+ type LabelVisibility = "visible" | "sr-only";
47
+
43
48
  interface RadioButtonsProps {
44
- items: Omit<ButtonProps, "size" | "onClick" | "isActive">[];
49
+ label: string;
50
+ /** Default `visible`. Use `sr-only` to hide the group label visually while keeping it for assistive tech. */
51
+ labelVisibility?: LabelVisibility;
52
+ items: Omit<ButtonProps, "size" | "onClick" | "isActive" | "role" | "ariaChecked">[];
45
53
  onChange: (value: string) => void;
46
54
  size?: ButtonProps["size"];
47
55
  className?: string;
48
56
  }
49
- declare const RadioButtons: ({ items, onChange, size, className, }: RadioButtonsProps) => react_jsx_runtime.JSX.Element;
57
+ declare const RadioButtons: ({ label, labelVisibility, items, onChange, size, className, }: RadioButtonsProps) => react_jsx_runtime.JSX.Element;
50
58
 
51
59
  interface TagProps {
52
60
  variant: ColorVariants;
@@ -70,6 +78,8 @@ interface InputProps {
70
78
  defaultValue?: string;
71
79
  placeholder?: string;
72
80
  label: string;
81
+ /** Default `visible`. Use `sr-only` to hide the label visually while keeping it for assistive tech. */
82
+ labelVisibility?: LabelVisibility;
73
83
  variant?: "primary" | "secondary" | "tertiary";
74
84
  /** Any standard HTML `input` type (e.g. `date`, `time`, `email`). */
75
85
  type?: HTMLInputTypeAttribute;
@@ -85,7 +95,31 @@ interface InputProps {
85
95
  /** Sets `data-testid` on the native `<input>` for e2e (e.g. Playwright). */
86
96
  testId?: string;
87
97
  }
88
- declare const Input: ({ name, onChange, value: valueProp, defaultValue, placeholder, label, variant, type, maxLength, required, pattern, title, ariaLabel, spellCheck, disabled, className, icon, testId, }: InputProps) => react_jsx_runtime.JSX.Element;
98
+ declare const Input: ({ name, onChange, value: valueProp, defaultValue, placeholder, label, labelVisibility, variant, type, maxLength, required, pattern, title, ariaLabel, spellCheck, disabled, className, icon, testId, }: InputProps) => react_jsx_runtime.JSX.Element;
99
+
100
+ interface TextareaProps {
101
+ name: string;
102
+ onChange?: (value: string) => void;
103
+ /** When set, the textarea is controlled; the parent must update this from `onChange`. */
104
+ value?: string;
105
+ /** Initial value when uncontrolled (`value` omitted). Does not update after mount if `defaultValue` prop changes. */
106
+ defaultValue?: string;
107
+ placeholder?: string;
108
+ label: string;
109
+ /** Default `visible`. Use `sr-only` to hide the label visually while keeping it for assistive tech. */
110
+ labelVisibility?: LabelVisibility;
111
+ variant?: "primary" | "secondary" | "tertiary";
112
+ rows?: number;
113
+ maxLength?: number;
114
+ required?: boolean;
115
+ ariaLabel?: string;
116
+ spellCheck?: boolean;
117
+ disabled?: boolean;
118
+ className?: string;
119
+ /** Sets `data-testid` on the native `<textarea>` for e2e (e.g. Playwright). */
120
+ testId?: string;
121
+ }
122
+ declare const Textarea: ({ name, onChange, value: valueProp, defaultValue, placeholder, label, labelVisibility, variant, rows, maxLength, required, ariaLabel, spellCheck, disabled, className, testId, }: TextareaProps) => react_jsx_runtime.JSX.Element;
89
123
 
90
124
  type SelectOption = {
91
125
  value: string;
@@ -94,6 +128,8 @@ type SelectOption = {
94
128
  type BaseSelectProps = {
95
129
  name: string;
96
130
  label: string;
131
+ /** Default `visible`. Use `sr-only` to hide the label visually while keeping it for assistive tech. */
132
+ labelVisibility?: LabelVisibility;
97
133
  options: SelectOption[];
98
134
  placeholder?: string;
99
135
  variant?: "primary" | "secondary" | "tertiary";
@@ -143,6 +179,23 @@ interface SpinnerOverlayProps extends SpinnerProps {
143
179
  }
144
180
  declare const SpinnerOverlay: ({ isVisible, size, className, }: SpinnerOverlayProps) => react_jsx_runtime.JSX.Element | null;
145
181
 
182
+ type ToastVariant = "danger" | "success" | "info";
183
+ type ToastPlacement = "top-left" | "top-right" | "bottom-left" | "bottom-right";
184
+ interface ToastProps {
185
+ children: ReactNode;
186
+ variant?: ToastVariant;
187
+ placement?: ToastPlacement;
188
+ /**
189
+ * Time in milliseconds before the toast dismisses itself.
190
+ * Pass `0` to disable auto-close. Default: `5000`.
191
+ */
192
+ autoCloseMs?: number;
193
+ /** Called after the user closes the toast or auto-close fires. */
194
+ onClose?: () => void;
195
+ className?: string;
196
+ }
197
+ declare const Toast: ({ children, variant, placement, autoCloseMs, onClose, className, }: ToastProps) => react_jsx_runtime.JSX.Element | null;
198
+
146
199
  interface BlockQuoteProps {
147
200
  children: ReactNode;
148
201
  className?: string;
@@ -154,14 +207,31 @@ interface HrProps {
154
207
  }
155
208
  declare const Hr: ({ className }: HrProps) => react_jsx_runtime.JSX.Element;
156
209
 
210
+ type ContentBoxVariant = "info" | "warning" | "success" | "danger";
211
+
157
212
  interface ContentBoxProps {
158
213
  children: ReactNode;
159
- variant?: "info" | "warning" | "success" | "danger";
214
+ variant?: ContentBoxVariant;
160
215
  icon?: ReactNode;
161
216
  className?: string;
162
217
  }
163
218
  declare const ContentBox: ({ children, variant, icon, className, }: ContentBoxProps) => react_jsx_runtime.JSX.Element;
164
219
 
220
+ interface DetailsPanelProps {
221
+ /** Label / title row for the native `<summary>` element. */
222
+ summary: ReactNode;
223
+ /** Shown when the panel is expanded (native `<details>` body). */
224
+ children: ReactNode;
225
+ variant?: ContentBoxVariant;
226
+ /** Optional icon before the summary text (ContentBox-style affordance, inline). */
227
+ icon?: ReactNode;
228
+ /** Initial open state; panel remains toggleable (state synced via `onToggle`). */
229
+ defaultOpen?: boolean;
230
+ className?: string;
231
+ id?: string;
232
+ }
233
+ declare const DetailsPanel: ({ summary, children, variant, icon, defaultOpen, className, id, }: DetailsPanelProps) => react_jsx_runtime.JSX.Element;
234
+
165
235
  interface ContainerProps {
166
236
  children: ReactNode;
167
237
  size?: "sm" | "md" | "lg" | "xl" | "full";
@@ -209,13 +279,14 @@ declare const Heading: ({ children, level, size, weight, color, className, }: He
209
279
 
210
280
  interface TextProps {
211
281
  children: ReactNode;
282
+ id?: string;
212
283
  size?: "xs" | "sm" | "md" | "lg";
213
284
  weight?: "normal" | "medium" | "semibold" | "bold";
214
285
  color?: "default" | "muted" | "primary" | "success" | "warning" | "danger";
215
286
  as?: "p" | "span" | "div" | "label";
216
287
  className?: string;
217
288
  }
218
- declare const Text: ({ children, size, weight, color, as: Tag, className, }: TextProps) => react_jsx_runtime.JSX.Element;
289
+ declare const Text: ({ children, id, size, weight, color, as: Tag, className, }: TextProps) => react_jsx_runtime.JSX.Element;
219
290
 
220
291
  interface HeartProps {
221
292
  variant?: "outline" | "filled" | "gradient";
@@ -258,4 +329,4 @@ declare const TwitterIcon: ({ className, size, withWrapper, }: SocialIconProps)
258
329
  declare const LinkedInIcon: ({ className, size, withWrapper, }: SocialIconProps) => react_jsx_runtime.JSX.Element;
259
330
  declare const InstagramIcon: ({ className, size, withWrapper, }: SocialIconProps) => react_jsx_runtime.JSX.Element;
260
331
 
261
- export { BlockQuote, type BlockQuoteProps, Button, type ButtonProps, ButtonTransparent, type ButtonTransparentProps, type ColorVariants, Container, type ContainerProps, ContentBox, type ContentBoxProps, GradientButton, type GradientButtonProps, Grid, GridItem, type GridItemProps, type GridProps, Heading, type HeadingProps, Heart, type HeartProps, Hr, type HrProps, Info, type InfoProps, Input, type InputProps, InstagramIcon, LinkedInIcon, type MultiSelectProps, RadioButtons, type RadioButtonsProps, Search, type SearchProps, Select, type SelectOption, type SelectProps, Share, type ShareProps, type SingleSelectProps, type Size, type SocialIconProps, Spinner, SpinnerOverlay, type SpinnerOverlayProps, type SpinnerProps, Stack, type StackProps, type Tab, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, type ThemeMode, TwitterIcon, Warning, type WarningProps };
332
+ export { BlockQuote, type BlockQuoteProps, Button, type ButtonProps, ButtonTransparent, type ButtonTransparentProps, type ColorVariants, Container, type ContainerProps, ContentBox, type ContentBoxProps, DetailsPanel, type DetailsPanelProps, GradientButton, type GradientButtonProps, Grid, GridItem, type GridItemProps, type GridProps, Heading, type HeadingProps, Heart, type HeartProps, Hr, type HrProps, Info, type InfoProps, Input, type InputProps, InstagramIcon, type LabelVisibility, LinkedInIcon, type MultiSelectProps, RadioButtons, type RadioButtonsProps, Search, type SearchProps, Select, type SelectOption, type SelectProps, Share, type ShareProps, type SingleSelectProps, type Size, type SocialIconProps, Spinner, SpinnerOverlay, type SpinnerOverlayProps, type SpinnerProps, Stack, type StackProps, type Tab, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, Textarea, type TextareaProps, type ThemeMode, Toast, type ToastPlacement, type ToastProps, type ToastVariant, TwitterIcon, Warning, type WarningProps };