@ramme-io/ui 1.1.5 → 1.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.
@@ -1,11 +1,29 @@
1
1
  import { default as React } from 'react';
2
2
 
3
+ export interface LoaderProps {
4
+ /** The visual style of the loader. */
5
+ variant?: 'bubble' | 'sparkle' | 'bar';
6
+ /** Optional text to display next to the animation (e.g., "Thinking...") */
7
+ label?: string;
8
+ className?: string;
9
+ }
3
10
  /**
4
11
  * @wizard
5
12
  * @name Loader
6
- * @description A visual indicator used within an AI Message to show that a response is being generated.
7
- * @tags ui, ai, feedback, loading
13
+ * @description A compact, theme-aware animation for indicating AI processing states. Optimized for chat interfaces.
14
+ * @tags ui, ai, feedback, loading, chat
15
+ * @props
16
+ * - name: variant
17
+ * type: "'bubble' | 'sparkle' | 'bar'"
18
+ * description: The visual style. 'bubble' is standard for chat. 'sparkle' is for creative generation.
19
+ * default: 'bubble'
20
+ * - name: label
21
+ * type: string
22
+ * description: Optional text displayed next to the animation.
23
+ * - name: className
24
+ * type: string
25
+ * description: Custom classes for the container.
8
26
  * @category ai
9
27
  * @id loader
10
28
  */
11
- export declare const Loader: React.FC;
29
+ export declare const Loader: React.FC<LoaderProps>;
@@ -2,52 +2,23 @@ import { default as React } from 'react';
2
2
 
3
3
  export interface DatePickerProps {
4
4
  label?: string;
5
- onChange: (date: Date | null) => void;
6
5
  selected: Date | null;
6
+ onChange: (date: Date | null) => void;
7
7
  className?: string;
8
8
  placeholderText?: string;
9
9
  dateFormat?: string;
10
- isClearable?: boolean;
11
10
  minDate?: Date;
12
11
  maxDate?: Date;
12
+ error?: boolean;
13
+ helperText?: string;
13
14
  showTimeSelect?: boolean;
15
+ isClearable?: boolean;
14
16
  }
15
17
  /**
16
18
  * @wizard
17
19
  * @name DatePicker
18
- * @description A calendar-based input component for selecting single dates, with theme integration.
20
+ * @description A theme-aware calendar input for selecting dates. Wraps react-datepicker to ensure consistent styling and "Zero Jank" layout stability.
19
21
  * @tags form, input, date, calendar, ui
20
- * @props
21
- * - name: label
22
- * type: string
23
- * description: An optional label displayed above the date picker input field.
24
- * - name: selected
25
- * type: Date | null
26
- * description: The currently selected date object, or `null` if no date is selected.
27
- * - name: onChange
28
- * type: (date: Date | null) => void
29
- * description: Callback function triggered when a new date is selected.
30
- * - name: className
31
- * type: string
32
- * description: Optional additional CSS classes for the date picker's wrapper container.
33
- * - name: dateFormat
34
- * type: string
35
- * description: The format string for displaying the date (e.g., 'MM/dd/yyyy', 'yyyy-MM-dd').
36
- * - name: showTimeSelect
37
- * type: boolean
38
- * description: If true, also allows time selection in addition to date selection.
39
- * - name: isClearable
40
- * type: boolean
41
- * description: If true, displays a clear button to deselect the date.
42
- * - name: placeholderText
43
- * type: string
44
- * description: Text displayed when no date is selected.
45
- * - name: minDate
46
- * type: Date
47
- * description: The earliest selectable date.
48
- * - name: maxDate
49
- * type: Date
50
- * description: The latest selectable date.
51
22
  * @category form
52
23
  * @id date-picker
53
24
  */
@@ -6,29 +6,13 @@ interface FileUploadProps {
6
6
  acceptedFileTypes?: string;
7
7
  label?: string;
8
8
  className?: string;
9
+ helperText?: string;
9
10
  }
10
11
  /**
11
12
  * @wizard
12
13
  * @name FileUpload
13
- * @description A component allowing users to upload files via drag-and-drop or a file browser, with support for multiple files and accepted types.
14
+ * @description A modern drag-and-drop file upload area with visual feedback and file listing.
14
15
  * @tags form, input, upload, files, ui
15
- * @props
16
- * - name: onFileUpload
17
- * type: (files: File[]) => void
18
- * description: Callback function triggered when files are selected or dropped, providing an array of File objects.
19
- * - name: multiple
20
- * type: boolean
21
- * description: If true, allows the user to select and upload multiple files.
22
- * default: false
23
- * - name: acceptedFileTypes
24
- * type: string
25
- * description: A string specifying acceptable file types (e.g., ".pdf,.txt,.xml", "image/*").
26
- * - name: label
27
- * type: string
28
- * description: An optional label displayed above the file upload area.
29
- * - name: className
30
- * type: string
31
- * description: Optional additional CSS classes for custom styling of the file upload container.
32
16
  * @category form
33
17
  * @id file-upload
34
18
  */
@@ -1,5 +1,7 @@
1
1
  import { default as React } from 'react';
2
+ import { SelectOption } from '../forms/Select';
2
3
  import { MultiSelectOption } from '../forms/MultiSelect';
4
+ import { SegmentedControlOption } from '../forms/SegmentedControl';
3
5
 
4
6
  interface FormFieldBase {
5
7
  name: string;
@@ -7,6 +9,8 @@ interface FormFieldBase {
7
9
  className?: string;
8
10
  disabled?: boolean;
9
11
  colSpan?: number;
12
+ helperText?: string;
13
+ required?: boolean;
10
14
  }
11
15
  interface FormInput extends FormFieldBase {
12
16
  type: 'text' | 'email' | 'password' | 'number';
@@ -19,10 +23,6 @@ interface FormTextarea extends FormFieldBase {
19
23
  value?: string;
20
24
  rows?: number;
21
25
  }
22
- interface SelectOption {
23
- value: string | number;
24
- label: string;
25
- }
26
26
  interface FormSelect extends FormFieldBase {
27
27
  type: 'select';
28
28
  options: SelectOption[];
@@ -52,13 +52,24 @@ interface FormMultiSelect extends FormFieldBase {
52
52
  type: 'multiselect';
53
53
  options: MultiSelectOption[];
54
54
  value?: MultiSelectOption[] | null;
55
+ placeholder?: string;
55
56
  }
56
57
  interface FormDatePicker extends FormFieldBase {
57
58
  type: 'datepicker';
58
59
  value?: Date | null;
59
60
  placeholder?: string;
60
61
  }
61
- export type FormField = FormInput | FormTextarea | FormSelect | FormCheckbox | FormToggle | FormRadio | FormComboBox | FormMultiSelect | FormDatePicker;
62
+ interface FormFileUpload extends FormFieldBase {
63
+ type: 'file';
64
+ multiple?: boolean;
65
+ acceptedFileTypes?: string;
66
+ }
67
+ interface FormSegmentedControl extends FormFieldBase {
68
+ type: 'segment';
69
+ options: SegmentedControlOption[];
70
+ value?: string | number;
71
+ }
72
+ export type FormField = FormInput | FormTextarea | FormSelect | FormCheckbox | FormToggle | FormRadio | FormComboBox | FormMultiSelect | FormDatePicker | FormFileUpload | FormSegmentedControl;
62
73
  export interface FormTemplateProps {
63
74
  fields: FormField[];
64
75
  onSubmit: (formData: Record<string, any>) => void;
@@ -68,22 +79,19 @@ export interface FormTemplateProps {
68
79
  /**
69
80
  * @wizard
70
81
  * @name FormTemplate
71
- * @description A data-driven form builder that renders a grid of input fields from a configuration array, handling internal state and submission.
82
+ * @description A data-driven form builder that renders a grid of input fields from a configuration array. Now supports File Uploads and Segmented Controls.
72
83
  * @category form
73
84
  * @tags form, template, builder, input, layout
74
85
  * @props
75
86
  * - name: fields
76
87
  * type: FormField[]
77
- * description: An array of field definition objects (name, label, type, etc.) that determine the form structure.
88
+ * description: An array of field definition objects.
78
89
  * - name: onSubmit
79
90
  * type: (formData: Record<string, any>) => void
80
- * description: Callback function triggered when the form is submitted, receiving the collected data.
91
+ * description: Callback function triggered when the form is submitted.
81
92
  * - name: className
82
93
  * type: string
83
94
  * description: Optional additional CSS classes for the form container.
84
- * - name: children
85
- * type: React.ReactNode
86
- * description: Content to render at the bottom of the form, typically used for action buttons like "Save" or "Cancel".
87
95
  * @id form-template
88
96
  */
89
97
  export declare const FormTemplate: React.FC<FormTemplateProps>;
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
 
3
3
  export interface MultiSelectOption {
4
- value: string;
4
+ value: string | number;
5
5
  label: string;
6
6
  }
7
7
  export interface MultiSelectProps {
@@ -14,13 +14,8 @@ export interface MultiSelectProps {
14
14
  isDisabled?: boolean;
15
15
  isLoading?: boolean;
16
16
  isSearchable?: boolean;
17
+ className?: string;
18
+ error?: boolean;
19
+ helperText?: string;
17
20
  }
18
- /**
19
- * @wizard
20
- * @name MultiSelect
21
- * @description An enhanced dropdown that allows users to select multiple options from a searchable list.
22
- * @tags form, input, select, dropdown
23
- * @category form
24
- * @id multi-select
25
- */
26
21
  export declare const MultiSelect: React.FC<MultiSelectProps>;
@@ -6,35 +6,23 @@ export interface SegmentedControlOption {
6
6
  disabled?: boolean;
7
7
  }
8
8
  export interface SegmentedControlProps {
9
+ /** The list of segments to display. */
9
10
  options: SegmentedControlOption[];
11
+ /** The currently selected value. */
10
12
  value: string | number;
13
+ /** Callback fired when a segment is selected. */
11
14
  onChange: (value: any) => void;
15
+ /** The size of the control. */
12
16
  size?: 'sm' | 'md';
17
+ /** Additional CSS classes. */
13
18
  className?: string;
14
19
  }
15
20
  /**
16
21
  * @wizard
17
22
  * @name SegmentedControl
18
- * @description A linear toggle component that functions like a radio group. Ideal for switching between discrete modes (e.g., "Off / Auto / On").
23
+ * @description A theme-aware linear toggle component. Ideal for switching between discrete modes (e.g., "Map / List").
19
24
  * @tags input, toggle, switch, radio, control
20
- * @category input
21
- * @props
22
- * - name: options
23
- * type: Array<{ label: string, value: string | number }>
24
- * description: The list of segments to display.
25
- * - name: value
26
- * type: string | number
27
- * description: The currently selected value.
28
- * - name: onChange
29
- * type: function
30
- * description: Callback fired when a segment is selected.
31
- * - name: size
32
- * type: 'sm' | 'md'
33
- * description: The size of the control.
34
- * default: 'md'
35
- * - name: className
36
- * type: string
37
- * description: Additional CSS classes.
25
+ * @category form
38
26
  * @id segmented-control
39
27
  */
40
28
  export declare const SegmentedControl: React.FC<SegmentedControlProps>;
@@ -4,38 +4,18 @@ export interface SelectOption {
4
4
  value: string | number;
5
5
  label: string;
6
6
  }
7
- export interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
7
+ export interface SelectProps {
8
8
  options: SelectOption[];
9
+ value?: SelectOption | null;
10
+ onChange: (option: SelectOption | null) => void;
9
11
  label?: string;
12
+ placeholder?: string;
13
+ isDisabled?: boolean;
14
+ isLoading?: boolean;
15
+ isClearable?: boolean;
16
+ isSearchable?: boolean;
17
+ className?: string;
18
+ error?: boolean;
19
+ helperText?: string;
10
20
  }
11
- /**
12
- * @wizard
13
- * @name Select
14
- * @description A standard HTML select dropdown component for choosing a single option from a list.
15
- * @tags form, input, dropdown, ui
16
- * @props
17
- * - name: options
18
- * type: { value: string | number; label: string; }[]
19
- * description: An array of objects defining the selectable options, each with a `value` and `label`.
20
- * - name: label
21
- * type: string
22
- * description: An optional label displayed above the select dropdown.
23
- * - name: id
24
- * type: string
25
- * description: A unique HTML `id` for the select element. Automatically generated if not provided.
26
- * - name: className
27
- * type: string
28
- * description: Optional additional CSS classes for the select element.
29
- * - name: value
30
- * type: string | number | readonly string[]
31
- * description: The currently selected option's value.
32
- * - name: onChange
33
- * type: (event: React.ChangeEvent<HTMLSelectElement>) => void
34
- * description: Callback function triggered when the selected value changes.
35
- * - name: disabled
36
- * type: boolean
37
- * description: If true, the select dropdown will be unclickable.
38
- * @category form
39
- * @id select
40
- */
41
21
  export declare const Select: React.FC<SelectProps>;
@@ -1,5 +1,7 @@
1
- import { HTMLAttributes, FC } from 'react';
1
+ import { default as React } from 'react';
2
2
 
3
+ export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ }
3
5
  /**
4
6
  * @wizard
5
7
  * @name Card
@@ -15,4 +17,4 @@ import { HTMLAttributes, FC } from 'react';
15
17
  * @category layout
16
18
  * @id card
17
19
  */
18
- export declare const Card: FC<HTMLAttributes<HTMLDivElement>>;
20
+ export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,37 +1,45 @@
1
- import { default as React, ReactNode } from 'react';
1
+ import { default as React } from 'react';
2
+ import { IconName } from '../ui/Icon';
2
3
 
3
- interface SidebarContextProps {
4
- isOpen: boolean;
5
- setIsOpen: (isOpen: boolean) => void;
6
- toggle: () => void;
4
+ export interface SidebarItem {
5
+ id: string;
6
+ label: string;
7
+ icon: IconName;
8
+ href?: string;
9
+ onClick?: () => void;
10
+ subItems?: Omit<SidebarItem, 'icon'>[];
11
+ badge?: string | number;
12
+ }
13
+ export interface SidebarUser {
14
+ name: string;
15
+ email: string;
16
+ avatarUrl?: string;
17
+ }
18
+ export interface SidebarProps {
19
+ items: SidebarItem[];
20
+ user?: SidebarUser;
21
+ className?: string;
22
+ logo?: React.ReactNode;
23
+ activeItemId?: string;
24
+ onNavigate?: (item: SidebarItem) => void;
25
+ footerSlot?: React.ReactNode;
7
26
  }
8
- export declare const useSidebar: () => SidebarContextProps;
9
- export declare const SidebarProvider: ({ children }: {
10
- children: ReactNode;
11
- }) => import("react/jsx-runtime").JSX.Element;
12
27
  /**
13
28
  * @wizard
14
29
  * @name Sidebar
15
- * @description A collapsible, responsive sidebar component.
30
+ * @description A collapsible sidebar navigation component with support for branding, navigation items, and user profile.
31
+ * @tags layout, navigation, sidebar
16
32
  * @props
17
- * @prop {React.ReactNode} children - The content of the sidebar.
33
+ * - name: items
34
+ * type: SidebarItem[]
35
+ * description: Array of navigation items.
36
+ * - name: user
37
+ * type: SidebarUser
38
+ * description: User profile information for the footer.
39
+ * - name: activeItemId
40
+ * type: string
41
+ * description: ID of the currently active navigation item.
42
+ * @category layout
18
43
  * @id sidebar
19
44
  */
20
- export declare const Sidebar: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
21
- export declare const SidebarHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
22
- export declare const SidebarContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
23
- export declare const SidebarGroup: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
24
- export declare const SidebarFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
25
- export declare const SidebarMenu: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
26
- interface SidebarMenuItemProps extends React.HTMLAttributes<HTMLDivElement> {
27
- icon?: React.ReactNode;
28
- badge?: React.ReactNode;
29
- tooltip?: string;
30
- href?: string;
31
- isActive?: boolean;
32
- as?: React.ElementType;
33
- end?: boolean;
34
- }
35
- export declare const SidebarMenuItem: React.ForwardRefExoticComponent<SidebarMenuItemProps & React.RefAttributes<HTMLDivElement>>;
36
- export declare const SidebarTrigger: () => import("react/jsx-runtime").JSX.Element;
37
- export {};
45
+ export declare const Sidebar: React.FC<SidebarProps>;
@@ -1 +1,8 @@
1
- export declare const StorySidebarContent: () => import("react/jsx-runtime").JSX.Element;
1
+ import { SidebarItem } from './Sidebar';
2
+
3
+ export declare const mockItems: SidebarItem[];
4
+ export declare const mockUser: {
5
+ name: string;
6
+ email: string;
7
+ avatarUrl: string;
8
+ };
@@ -10,10 +10,6 @@ interface AvatarProps {
10
10
  /** Optional additional CSS classes. */
11
11
  className?: string;
12
12
  }
13
- /**
14
- * A component for displaying a user's avatar. It shows an image if a `src`
15
- * is provided, otherwise it falls back to the user's initials.
16
- */
17
13
  /**
18
14
  * @wizard
19
15
  * @name Avatar
@@ -2,7 +2,7 @@ import { default as React } from 'react';
2
2
  import { VariantProps } from 'class-variance-authority';
3
3
 
4
4
  declare const badgeVariants: (props?: ({
5
- variant?: "primary" | "secondary" | "danger" | "success" | "outline" | null | undefined;
5
+ variant?: "outline" | "primary" | "secondary" | "danger" | "success" | "warning" | null | undefined;
6
6
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
7
  export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
8
8
  }
@@ -13,13 +13,16 @@ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, Varian
13
13
  * @tags ui, label, indicator
14
14
  * @props
15
15
  * - name: variant
16
- * type: "'primary' | 'secondary' | 'danger' | 'success' | 'outline'"
16
+ * type: "'primary' | 'secondary' | 'danger' | 'success' | 'warning' | 'outline'"
17
17
  * description: The visual style of the badge.
18
18
  * - name: children
19
19
  * type: React.ReactNode
20
20
  * description: The content to display inside the badge.
21
+ * - name: className
22
+ * type: string
23
+ * description: Optional additional CSS classes.
21
24
  * @category ui
22
25
  * @id badge
23
26
  */
24
- declare function Badge({ className, variant, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
25
- export { Badge, badgeVariants };
27
+ export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLDivElement>>;
28
+ export { badgeVariants };
@@ -31,7 +31,7 @@ import { IconName } from './Icon';
31
31
  * @id button
32
32
  */
33
33
  declare const buttonVariants: (props?: ({
34
- variant?: "link" | "ghost" | "primary" | "secondary" | "danger" | "outline" | "accent" | null | undefined;
34
+ variant?: "link" | "ghost" | "outline" | "primary" | "secondary" | "danger" | "accent" | null | undefined;
35
35
  size?: "sm" | "md" | "lg" | "icon" | null | undefined;
36
36
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
37
37
  export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {