@mirror-physics/fractal-ui 0.2.0-next.75 → 0.2.0-next.76

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
@@ -2,13 +2,18 @@ import * as React from 'react';
2
2
  import { HTMLAttributes, ReactNode, CSSProperties } from 'react';
3
3
  import { ClassValue } from 'clsx';
4
4
 
5
+ /** Shared density scale for single-line controls and their labels. */
6
+ type ControlSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
7
+
5
8
  type ButtonType = 'primary' | 'secondary' | 'ghost' | 'danger';
6
- type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
9
+ type ButtonSize = ControlSize;
7
10
  type ButtonColor = 'blue' | 'pink' | 'orange' | 'green';
8
11
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
9
12
  /** Visual hierarchy. Primary = strongest action, Secondary = neutral bordered, Ghost = minimal, Danger = destructive. */
10
13
  buttonType?: ButtonType;
11
- /** Size preset matching the component height scale. */
14
+ /** Shared visual density; takes precedence over the buttonSize alias. */
15
+ controlSize?: ControlSize;
16
+ /** Backward-compatible alias for controlSize. */
12
17
  buttonSize?: ButtonSize;
13
18
  /** Color theme — maps to the design system's color scales. */
14
19
  color?: ButtonColor;
@@ -99,6 +104,8 @@ interface PromptGridProps extends React.HTMLAttributes<HTMLDivElement> {
99
104
  declare const PromptGrid: React.ForwardRefExoticComponent<PromptGridProps & React.RefAttributes<HTMLDivElement>>;
100
105
 
101
106
  interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
107
+ /** Visual density; native `size` still controls the character-width hint. */
108
+ controlSize?: ControlSize;
102
109
  }
103
110
  declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
104
111
 
@@ -113,7 +120,7 @@ declare const TableSearch: React.ForwardRefExoticComponent<TableSearchProps & Re
113
120
  interface NumberInputProps extends Omit<InputProps, 'type'> {
114
121
  unit?: string;
115
122
  }
116
- declare function NumberInput({ unit, className, value, defaultValue, disabled, readOnly, min, max, ...props }: NumberInputProps): React.JSX.Element;
123
+ declare function NumberInput({ unit, controlSize, className, value, defaultValue, disabled, readOnly, min, max, ...props }: NumberInputProps): React.JSX.Element;
117
124
 
118
125
  type SliderBaseProps = {
119
126
  min?: number;
@@ -147,6 +154,7 @@ interface PasswordInputProps extends Omit<InputProps, 'type'> {
147
154
  declare const PasswordInput: React.ForwardRefExoticComponent<PasswordInputProps & React.RefAttributes<HTMLInputElement>>;
148
155
 
149
156
  interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
157
+ controlSize?: ControlSize;
150
158
  }
151
159
  declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
152
160
 
@@ -256,7 +264,12 @@ interface DropdownProps {
256
264
  /** Renders the trigger as a square icon button. Requires an accessible triggerLabel. */
257
265
  iconOnly?: boolean;
258
266
  noChevron?: boolean;
259
- size?: 'sm' | 'md';
267
+ /** Shared visual density; takes precedence over size. */
268
+ controlSize?: ControlSize;
269
+ /** Backward-compatible size alias. */
270
+ size?: ControlSize;
271
+ /** Connect a persistent Label with htmlFor to the trigger. */
272
+ triggerId?: string;
260
273
  triggerVariant?: 'outline' | 'tertiary';
261
274
  className?: string;
262
275
  triggerClassName?: string;
@@ -264,7 +277,7 @@ interface DropdownProps {
264
277
  closeOnSelect?: boolean;
265
278
  disabled?: boolean;
266
279
  }
267
- declare function Dropdown({ items, selectedValue, onSelect, triggerLabel, direction, align, triggerOrientation, triggerContent, label, iconOnly, noChevron, size, triggerVariant, className, triggerClassName, panelClassName, closeOnSelect, disabled, }: DropdownProps): React.JSX.Element | null;
280
+ declare function Dropdown({ items, selectedValue, onSelect, triggerLabel, direction, align, triggerOrientation, triggerContent, label, iconOnly, noChevron, size: sizeAlias, controlSize, triggerId, triggerVariant, className, triggerClassName, panelClassName, closeOnSelect, disabled, }: DropdownProps): React.JSX.Element | null;
268
281
 
269
282
  type LinkTheme = 'default' | 'muted' | 'accent';
270
283
  type LinkSize = 'sm' | 'md' | 'lg';
@@ -460,10 +473,11 @@ interface GhostLineProps extends Omit<GhostProps, 'height'> {
460
473
  declare function Ghost({ className, width, height, radius, style, ...props }: GhostProps): React.JSX.Element;
461
474
  declare function GhostLine({ className, size, width, ...props }: GhostLineProps): React.JSX.Element;
462
475
  interface ButtonGhostProps extends Omit<GhostProps, 'height'> {
463
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
476
+ size?: ControlSize;
477
+ controlSize?: ControlSize;
464
478
  iconOnly?: boolean;
465
479
  }
466
- declare function ButtonGhost({ className, size, iconOnly, width, ...props }: ButtonGhostProps): React.JSX.Element;
480
+ declare function ButtonGhost({ className, size, controlSize, iconOnly, width, ...props }: ButtonGhostProps): React.JSX.Element;
467
481
  interface CardGhostProps extends HTMLAttributes<HTMLDivElement> {
468
482
  lines?: number;
469
483
  showHeader?: boolean;
@@ -485,6 +499,7 @@ interface DataTableGhostProps extends HTMLAttributes<HTMLDivElement> {
485
499
  declare function DataTableGhost({ className, showHeader, headers, columns, rows, columnWidths, size, ...props }: DataTableGhostProps): React.JSX.Element;
486
500
  interface FormFieldGhostProps extends HTMLAttributes<HTMLDivElement> {
487
501
  labelWidth?: GhostLength;
502
+ controlSize?: ControlSize;
488
503
  multiline?: boolean;
489
504
  }
490
505
  declare function InputGhost({ className, labelWidth, ...props }: FormFieldGhostProps): React.JSX.Element;
@@ -496,7 +511,9 @@ declare const ToggleGhost: typeof CheckboxGhost;
496
511
  declare function ChipGhost({ className, width, ...props }: Omit<GhostProps, 'height'>): React.JSX.Element;
497
512
  declare function LinkGhost({ className, width, ...props }: Omit<GhostLineProps, 'size'>): React.JSX.Element;
498
513
  declare const TextButtonGhost: typeof LinkGhost;
499
- declare function DropdownGhost({ className, ...props }: HTMLAttributes<HTMLDivElement>): React.JSX.Element;
514
+ declare function DropdownGhost({ className, controlSize, ...props }: HTMLAttributes<HTMLDivElement> & {
515
+ controlSize?: ControlSize;
516
+ }): React.JSX.Element;
500
517
  declare function ContentSwitcherGhost({ className, options, ...props }: HTMLAttributes<HTMLDivElement> & {
501
518
  options?: number;
502
519
  }): React.JSX.Element;
@@ -625,4 +642,4 @@ declare function useEscapeDismiss(priority: number, handler: () => void, enabled
625
642
 
626
643
  declare function cn(...inputs: ClassValue[]): string;
627
644
 
628
- export { Alert, AlertDescription, AlertGhost, AlertTitle, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonColor, ButtonGhost, type ButtonGhostProps, type ButtonProps, type ButtonSize, type ButtonType, Card, CardContent, CardDescription, CardFooter, CardGhost, type CardGhostProps, CardHeader, CardTitle, Checkbox, CheckboxGhost, type CheckboxProps, Chip, ChipGhost, type ChipProps, type ChipTone, CodeBlock, type CodeBlockProps, ContentSwitcher, ContentSwitcherGhost, type ContentSwitcherItem, type ContentSwitcherProps, ConversationGhost, type ConversationGhostProps, DataTable, type DataTableColumn, DataTableGhost, type DataTableGhostProps, type DataTableProps, Disclosure, DisclosureGhost, type DisclosureProps, Dropdown, DropdownGhost, type DropdownItem, type DropdownProps, FeatureCard, type FeatureCardProps, FileDropzone, FileDropzoneGhost, type FileDropzoneProps, FolderCard, type FolderCardProps, type FormFieldGhostProps, Ghost, GhostLine, type GhostLineProps, type GhostProps, Input, InputGhost, type InputProps, Label, LabelGhost, type LabelProps, LatticeLoader, type LatticeLoaderProps, Link, LinkGhost, type LinkProps, type LinkSize, type LinkTheme, Modal, ModalGhost, type ModalProps, NumberInput, type NumberInputProps, Pagination, PaginationGhost, type PaginationProps, PasswordInput, type PasswordInputProps, PromptCard, PromptCardGhost, type PromptCardProps, type PromptCardTone, PromptGrid, type PromptGridProps, Radio, type RadioProps, type RangeSliderProps, SidePanel, SidePanelGhost, type SidePanelProps, Sidebar, SidebarAccountMenu, type SidebarAccountMenuProps, SidebarBrand, SidebarFooter, SidebarGhost, type SidebarGhostProps, SidebarHeader, SidebarNav, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarSection, type SingleSliderProps, Slider, type SliderProps, type SortDirection, SortableTable, type SortableTableColumn, type SortableTableDefaultSort, SortableTableGhost, type SortableTablePagination, type SortableTableProps, type SortableTableRowAction, type SortableTableSelection, type SurfaceGhostProps, type TabItem, TableSearch, type TableSearchProps, type TableSearchType, Tabs, TabsGhost, type TabsProps, type TabsVariant, TextButton, TextButtonGhost, type TextButtonIconPosition, type TextButtonProps, type TextButtonSize, type TextButtonTone, Textarea, TextareaGhost, type TextareaProps, Toast, type ToastPosition, type ToastProps, type ToastVariant, ToastViewport, type ToastViewportProps, Toggle, ToggleGhost, type ToggleProps, UILoader, type UILoaderProps, type UILoaderTone, cn, useEscapeDismiss };
645
+ export { Alert, AlertDescription, AlertGhost, AlertTitle, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonColor, ButtonGhost, type ButtonGhostProps, type ButtonProps, type ButtonSize, type ButtonType, Card, CardContent, CardDescription, CardFooter, CardGhost, type CardGhostProps, CardHeader, CardTitle, Checkbox, CheckboxGhost, type CheckboxProps, Chip, ChipGhost, type ChipProps, type ChipTone, CodeBlock, type CodeBlockProps, ContentSwitcher, ContentSwitcherGhost, type ContentSwitcherItem, type ContentSwitcherProps, type ControlSize, ConversationGhost, type ConversationGhostProps, DataTable, type DataTableColumn, DataTableGhost, type DataTableGhostProps, type DataTableProps, Disclosure, DisclosureGhost, type DisclosureProps, Dropdown, DropdownGhost, type DropdownItem, type DropdownProps, FeatureCard, type FeatureCardProps, FileDropzone, FileDropzoneGhost, type FileDropzoneProps, FolderCard, type FolderCardProps, type FormFieldGhostProps, Ghost, GhostLine, type GhostLineProps, type GhostProps, Input, InputGhost, type InputProps, Label, LabelGhost, type LabelProps, LatticeLoader, type LatticeLoaderProps, Link, LinkGhost, type LinkProps, type LinkSize, type LinkTheme, Modal, ModalGhost, type ModalProps, NumberInput, type NumberInputProps, Pagination, PaginationGhost, type PaginationProps, PasswordInput, type PasswordInputProps, PromptCard, PromptCardGhost, type PromptCardProps, type PromptCardTone, PromptGrid, type PromptGridProps, Radio, type RadioProps, type RangeSliderProps, SidePanel, SidePanelGhost, type SidePanelProps, Sidebar, SidebarAccountMenu, type SidebarAccountMenuProps, SidebarBrand, SidebarFooter, SidebarGhost, type SidebarGhostProps, SidebarHeader, SidebarNav, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarSection, type SingleSliderProps, Slider, type SliderProps, type SortDirection, SortableTable, type SortableTableColumn, type SortableTableDefaultSort, SortableTableGhost, type SortableTablePagination, type SortableTableProps, type SortableTableRowAction, type SortableTableSelection, type SurfaceGhostProps, type TabItem, TableSearch, type TableSearchProps, type TableSearchType, Tabs, TabsGhost, type TabsProps, type TabsVariant, TextButton, TextButtonGhost, type TextButtonIconPosition, type TextButtonProps, type TextButtonSize, type TextButtonTone, Textarea, TextareaGhost, type TextareaProps, Toast, type ToastPosition, type ToastProps, type ToastVariant, ToastViewport, type ToastViewportProps, Toggle, ToggleGhost, type ToggleProps, UILoader, type UILoaderProps, type UILoaderTone, cn, useEscapeDismiss };
package/dist/index.d.ts CHANGED
@@ -2,13 +2,18 @@ import * as React from 'react';
2
2
  import { HTMLAttributes, ReactNode, CSSProperties } from 'react';
3
3
  import { ClassValue } from 'clsx';
4
4
 
5
+ /** Shared density scale for single-line controls and their labels. */
6
+ type ControlSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
7
+
5
8
  type ButtonType = 'primary' | 'secondary' | 'ghost' | 'danger';
6
- type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
9
+ type ButtonSize = ControlSize;
7
10
  type ButtonColor = 'blue' | 'pink' | 'orange' | 'green';
8
11
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
9
12
  /** Visual hierarchy. Primary = strongest action, Secondary = neutral bordered, Ghost = minimal, Danger = destructive. */
10
13
  buttonType?: ButtonType;
11
- /** Size preset matching the component height scale. */
14
+ /** Shared visual density; takes precedence over the buttonSize alias. */
15
+ controlSize?: ControlSize;
16
+ /** Backward-compatible alias for controlSize. */
12
17
  buttonSize?: ButtonSize;
13
18
  /** Color theme — maps to the design system's color scales. */
14
19
  color?: ButtonColor;
@@ -99,6 +104,8 @@ interface PromptGridProps extends React.HTMLAttributes<HTMLDivElement> {
99
104
  declare const PromptGrid: React.ForwardRefExoticComponent<PromptGridProps & React.RefAttributes<HTMLDivElement>>;
100
105
 
101
106
  interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
107
+ /** Visual density; native `size` still controls the character-width hint. */
108
+ controlSize?: ControlSize;
102
109
  }
103
110
  declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
104
111
 
@@ -113,7 +120,7 @@ declare const TableSearch: React.ForwardRefExoticComponent<TableSearchProps & Re
113
120
  interface NumberInputProps extends Omit<InputProps, 'type'> {
114
121
  unit?: string;
115
122
  }
116
- declare function NumberInput({ unit, className, value, defaultValue, disabled, readOnly, min, max, ...props }: NumberInputProps): React.JSX.Element;
123
+ declare function NumberInput({ unit, controlSize, className, value, defaultValue, disabled, readOnly, min, max, ...props }: NumberInputProps): React.JSX.Element;
117
124
 
118
125
  type SliderBaseProps = {
119
126
  min?: number;
@@ -147,6 +154,7 @@ interface PasswordInputProps extends Omit<InputProps, 'type'> {
147
154
  declare const PasswordInput: React.ForwardRefExoticComponent<PasswordInputProps & React.RefAttributes<HTMLInputElement>>;
148
155
 
149
156
  interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
157
+ controlSize?: ControlSize;
150
158
  }
151
159
  declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
152
160
 
@@ -256,7 +264,12 @@ interface DropdownProps {
256
264
  /** Renders the trigger as a square icon button. Requires an accessible triggerLabel. */
257
265
  iconOnly?: boolean;
258
266
  noChevron?: boolean;
259
- size?: 'sm' | 'md';
267
+ /** Shared visual density; takes precedence over size. */
268
+ controlSize?: ControlSize;
269
+ /** Backward-compatible size alias. */
270
+ size?: ControlSize;
271
+ /** Connect a persistent Label with htmlFor to the trigger. */
272
+ triggerId?: string;
260
273
  triggerVariant?: 'outline' | 'tertiary';
261
274
  className?: string;
262
275
  triggerClassName?: string;
@@ -264,7 +277,7 @@ interface DropdownProps {
264
277
  closeOnSelect?: boolean;
265
278
  disabled?: boolean;
266
279
  }
267
- declare function Dropdown({ items, selectedValue, onSelect, triggerLabel, direction, align, triggerOrientation, triggerContent, label, iconOnly, noChevron, size, triggerVariant, className, triggerClassName, panelClassName, closeOnSelect, disabled, }: DropdownProps): React.JSX.Element | null;
280
+ declare function Dropdown({ items, selectedValue, onSelect, triggerLabel, direction, align, triggerOrientation, triggerContent, label, iconOnly, noChevron, size: sizeAlias, controlSize, triggerId, triggerVariant, className, triggerClassName, panelClassName, closeOnSelect, disabled, }: DropdownProps): React.JSX.Element | null;
268
281
 
269
282
  type LinkTheme = 'default' | 'muted' | 'accent';
270
283
  type LinkSize = 'sm' | 'md' | 'lg';
@@ -460,10 +473,11 @@ interface GhostLineProps extends Omit<GhostProps, 'height'> {
460
473
  declare function Ghost({ className, width, height, radius, style, ...props }: GhostProps): React.JSX.Element;
461
474
  declare function GhostLine({ className, size, width, ...props }: GhostLineProps): React.JSX.Element;
462
475
  interface ButtonGhostProps extends Omit<GhostProps, 'height'> {
463
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
476
+ size?: ControlSize;
477
+ controlSize?: ControlSize;
464
478
  iconOnly?: boolean;
465
479
  }
466
- declare function ButtonGhost({ className, size, iconOnly, width, ...props }: ButtonGhostProps): React.JSX.Element;
480
+ declare function ButtonGhost({ className, size, controlSize, iconOnly, width, ...props }: ButtonGhostProps): React.JSX.Element;
467
481
  interface CardGhostProps extends HTMLAttributes<HTMLDivElement> {
468
482
  lines?: number;
469
483
  showHeader?: boolean;
@@ -485,6 +499,7 @@ interface DataTableGhostProps extends HTMLAttributes<HTMLDivElement> {
485
499
  declare function DataTableGhost({ className, showHeader, headers, columns, rows, columnWidths, size, ...props }: DataTableGhostProps): React.JSX.Element;
486
500
  interface FormFieldGhostProps extends HTMLAttributes<HTMLDivElement> {
487
501
  labelWidth?: GhostLength;
502
+ controlSize?: ControlSize;
488
503
  multiline?: boolean;
489
504
  }
490
505
  declare function InputGhost({ className, labelWidth, ...props }: FormFieldGhostProps): React.JSX.Element;
@@ -496,7 +511,9 @@ declare const ToggleGhost: typeof CheckboxGhost;
496
511
  declare function ChipGhost({ className, width, ...props }: Omit<GhostProps, 'height'>): React.JSX.Element;
497
512
  declare function LinkGhost({ className, width, ...props }: Omit<GhostLineProps, 'size'>): React.JSX.Element;
498
513
  declare const TextButtonGhost: typeof LinkGhost;
499
- declare function DropdownGhost({ className, ...props }: HTMLAttributes<HTMLDivElement>): React.JSX.Element;
514
+ declare function DropdownGhost({ className, controlSize, ...props }: HTMLAttributes<HTMLDivElement> & {
515
+ controlSize?: ControlSize;
516
+ }): React.JSX.Element;
500
517
  declare function ContentSwitcherGhost({ className, options, ...props }: HTMLAttributes<HTMLDivElement> & {
501
518
  options?: number;
502
519
  }): React.JSX.Element;
@@ -625,4 +642,4 @@ declare function useEscapeDismiss(priority: number, handler: () => void, enabled
625
642
 
626
643
  declare function cn(...inputs: ClassValue[]): string;
627
644
 
628
- export { Alert, AlertDescription, AlertGhost, AlertTitle, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonColor, ButtonGhost, type ButtonGhostProps, type ButtonProps, type ButtonSize, type ButtonType, Card, CardContent, CardDescription, CardFooter, CardGhost, type CardGhostProps, CardHeader, CardTitle, Checkbox, CheckboxGhost, type CheckboxProps, Chip, ChipGhost, type ChipProps, type ChipTone, CodeBlock, type CodeBlockProps, ContentSwitcher, ContentSwitcherGhost, type ContentSwitcherItem, type ContentSwitcherProps, ConversationGhost, type ConversationGhostProps, DataTable, type DataTableColumn, DataTableGhost, type DataTableGhostProps, type DataTableProps, Disclosure, DisclosureGhost, type DisclosureProps, Dropdown, DropdownGhost, type DropdownItem, type DropdownProps, FeatureCard, type FeatureCardProps, FileDropzone, FileDropzoneGhost, type FileDropzoneProps, FolderCard, type FolderCardProps, type FormFieldGhostProps, Ghost, GhostLine, type GhostLineProps, type GhostProps, Input, InputGhost, type InputProps, Label, LabelGhost, type LabelProps, LatticeLoader, type LatticeLoaderProps, Link, LinkGhost, type LinkProps, type LinkSize, type LinkTheme, Modal, ModalGhost, type ModalProps, NumberInput, type NumberInputProps, Pagination, PaginationGhost, type PaginationProps, PasswordInput, type PasswordInputProps, PromptCard, PromptCardGhost, type PromptCardProps, type PromptCardTone, PromptGrid, type PromptGridProps, Radio, type RadioProps, type RangeSliderProps, SidePanel, SidePanelGhost, type SidePanelProps, Sidebar, SidebarAccountMenu, type SidebarAccountMenuProps, SidebarBrand, SidebarFooter, SidebarGhost, type SidebarGhostProps, SidebarHeader, SidebarNav, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarSection, type SingleSliderProps, Slider, type SliderProps, type SortDirection, SortableTable, type SortableTableColumn, type SortableTableDefaultSort, SortableTableGhost, type SortableTablePagination, type SortableTableProps, type SortableTableRowAction, type SortableTableSelection, type SurfaceGhostProps, type TabItem, TableSearch, type TableSearchProps, type TableSearchType, Tabs, TabsGhost, type TabsProps, type TabsVariant, TextButton, TextButtonGhost, type TextButtonIconPosition, type TextButtonProps, type TextButtonSize, type TextButtonTone, Textarea, TextareaGhost, type TextareaProps, Toast, type ToastPosition, type ToastProps, type ToastVariant, ToastViewport, type ToastViewportProps, Toggle, ToggleGhost, type ToggleProps, UILoader, type UILoaderProps, type UILoaderTone, cn, useEscapeDismiss };
645
+ export { Alert, AlertDescription, AlertGhost, AlertTitle, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonColor, ButtonGhost, type ButtonGhostProps, type ButtonProps, type ButtonSize, type ButtonType, Card, CardContent, CardDescription, CardFooter, CardGhost, type CardGhostProps, CardHeader, CardTitle, Checkbox, CheckboxGhost, type CheckboxProps, Chip, ChipGhost, type ChipProps, type ChipTone, CodeBlock, type CodeBlockProps, ContentSwitcher, ContentSwitcherGhost, type ContentSwitcherItem, type ContentSwitcherProps, type ControlSize, ConversationGhost, type ConversationGhostProps, DataTable, type DataTableColumn, DataTableGhost, type DataTableGhostProps, type DataTableProps, Disclosure, DisclosureGhost, type DisclosureProps, Dropdown, DropdownGhost, type DropdownItem, type DropdownProps, FeatureCard, type FeatureCardProps, FileDropzone, FileDropzoneGhost, type FileDropzoneProps, FolderCard, type FolderCardProps, type FormFieldGhostProps, Ghost, GhostLine, type GhostLineProps, type GhostProps, Input, InputGhost, type InputProps, Label, LabelGhost, type LabelProps, LatticeLoader, type LatticeLoaderProps, Link, LinkGhost, type LinkProps, type LinkSize, type LinkTheme, Modal, ModalGhost, type ModalProps, NumberInput, type NumberInputProps, Pagination, PaginationGhost, type PaginationProps, PasswordInput, type PasswordInputProps, PromptCard, PromptCardGhost, type PromptCardProps, type PromptCardTone, PromptGrid, type PromptGridProps, Radio, type RadioProps, type RangeSliderProps, SidePanel, SidePanelGhost, type SidePanelProps, Sidebar, SidebarAccountMenu, type SidebarAccountMenuProps, SidebarBrand, SidebarFooter, SidebarGhost, type SidebarGhostProps, SidebarHeader, SidebarNav, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarSection, type SingleSliderProps, Slider, type SliderProps, type SortDirection, SortableTable, type SortableTableColumn, type SortableTableDefaultSort, SortableTableGhost, type SortableTablePagination, type SortableTableProps, type SortableTableRowAction, type SortableTableSelection, type SurfaceGhostProps, type TabItem, TableSearch, type TableSearchProps, type TableSearchType, Tabs, TabsGhost, type TabsProps, type TabsVariant, TextButton, TextButtonGhost, type TextButtonIconPosition, type TextButtonProps, type TextButtonSize, type TextButtonTone, Textarea, TextareaGhost, type TextareaProps, Toast, type ToastPosition, type ToastProps, type ToastVariant, ToastViewport, type ToastViewportProps, Toggle, ToggleGhost, type ToggleProps, UILoader, type UILoaderProps, type UILoaderTone, cn, useEscapeDismiss };
package/dist/index.js CHANGED
@@ -47,31 +47,19 @@ var colorPalette = {
47
47
  700: "var(--green-700)"
48
48
  }
49
49
  };
50
- var sizeConfig = {
51
- xs: { height: "28px", padding: "4px 8px", iconOnly: "28px", fontSize: "0.75rem" },
52
- sm: { height: "32px", padding: "6px 12px", iconOnly: "32px", fontSize: "0.75rem" },
53
- md: { height: "40px", padding: "8px 16px", iconOnly: "40px", fontSize: "0.875rem" },
54
- lg: { height: "44px", padding: "10px 20px", iconOnly: "44px", fontSize: "1rem" },
55
- xl: { height: "56px", padding: "14px 28px", iconOnly: "56px", fontSize: "1rem" }
56
- };
57
- function getButtonStyles(buttonType, isHovered, isActive, buttonSize, disabled, color, hasIconOnly) {
50
+ function getButtonStyles(buttonType, isHovered, isActive, disabled, color, hasIconOnly) {
58
51
  const palette = colorPalette[color];
59
- const size = sizeConfig[buttonSize];
60
52
  const base = {
61
- height: size.height,
62
- padding: hasIconOnly ? "0" : size.padding,
63
53
  borderRadius: hasIconOnly ? "var(--radius-lg, 8px)" : "var(--radius-full, 9999px)",
64
54
  cursor: disabled ? "not-allowed" : "pointer",
65
- fontSize: size.fontSize,
66
55
  transition: "background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease"
67
56
  };
68
57
  if (hasIconOnly) {
69
- base.width = size.iconOnly;
70
58
  base.justifyContent = "center";
71
59
  }
72
60
  if (disabled) {
73
61
  if (buttonType === "ghost") {
74
- return { ...base, backgroundColor: "transparent", border: "none", color: "var(--fg-disabled)" };
62
+ return { ...base, backgroundColor: "transparent", border: "1px solid transparent", color: "var(--fg-disabled)" };
75
63
  }
76
64
  return { ...base, backgroundColor: "transparent", border: "1px solid var(--fg-disabled)", color: "var(--fg-disabled)" };
77
65
  }
@@ -82,7 +70,7 @@ function getButtonStyles(buttonType, isHovered, isActive, buttonSize, disabled,
82
70
  return {
83
71
  ...base,
84
72
  backgroundColor: isActive ? palette[700] : isHovered ? palette[500] : palette[600],
85
- border: "none",
73
+ border: "1px solid transparent",
86
74
  color: "var(--fg-inverse)"
87
75
  };
88
76
  }
@@ -106,7 +94,7 @@ function getButtonStyles(buttonType, isHovered, isActive, buttonSize, disabled,
106
94
  return {
107
95
  ...base,
108
96
  backgroundColor: isHovered || isActive ? "var(--bg-surface-1)" : "transparent",
109
- border: "none",
97
+ border: "1px solid transparent",
110
98
  color: "var(--fg-primary)"
111
99
  };
112
100
  // Danger: low-intensity destructive action. Text stays steady; hover deepens the light red surface.
@@ -114,7 +102,7 @@ function getButtonStyles(buttonType, isHovered, isActive, buttonSize, disabled,
114
102
  return {
115
103
  ...base,
116
104
  backgroundColor: isHovered || isActive ? "var(--danger-button-surface-hover)" : "var(--danger-button-surface)",
117
- border: "none",
105
+ border: "1px solid transparent",
118
106
  color: "var(--danger-button-fg)"
119
107
  };
120
108
  default:
@@ -122,10 +110,10 @@ function getButtonStyles(buttonType, isHovered, isActive, buttonSize, disabled,
122
110
  }
123
111
  }
124
112
  var Button = React.forwardRef(
125
- ({ className, buttonType = "primary", buttonSize = "md", color = "blue", icon, hasIconOnly, iconPosition = "left", style, disabled, children, ...props }, ref) => {
113
+ ({ className, buttonType = "primary", buttonSize = "md", controlSize, color = "blue", icon, hasIconOnly, iconPosition = "left", style, disabled, children, ...props }, ref) => {
126
114
  const [isHovered, setIsHovered] = React.useState(false);
127
115
  const [isActive, setIsActive] = React.useState(false);
128
- const typeStyles = getButtonStyles(buttonType, isHovered, isActive, buttonSize, !!disabled, color, hasIconOnly);
116
+ const typeStyles = getButtonStyles(buttonType, isHovered, isActive, !!disabled, color, hasIconOnly);
129
117
  const hasIconAndText = icon && children && !hasIconOnly;
130
118
  const finalStyles = hasIconAndText ? { ...typeStyles, gap: "var(--space-2, 8px)", ...style } : { ...typeStyles, ...style };
131
119
  return /* @__PURE__ */ jsxs(
@@ -133,7 +121,9 @@ var Button = React.forwardRef(
133
121
  {
134
122
  ref,
135
123
  type: "button",
136
- className: cn("fractal-button", `fractal-button--${buttonType}`, className),
124
+ "data-control-size": controlSize ?? buttonSize,
125
+ "data-icon-only": hasIconOnly || void 0,
126
+ className: cn("fractal-control", "fractal-button", `fractal-button--${buttonType}`, className),
137
127
  style: finalStyles,
138
128
  disabled,
139
129
  onMouseEnter: (e) => {
@@ -541,7 +531,7 @@ import * as React2 from "react";
541
531
  import { Folder as FolderIcon } from "@mirror-physics/fractal-icons";
542
532
  import { jsx as jsx3, jsxs as jsxs4 } from "react/jsx-runtime";
543
533
  var Card = React2.forwardRef(
544
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx3("div", { ref, className: cn("fractal-card", className), ...props })
534
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx3("div", { ref, "data-fractal-border-surface": "surface-1", className: cn("fractal-card", className), ...props })
545
535
  );
546
536
  Card.displayName = "Card";
547
537
  var CardHeader = React2.forwardRef(
@@ -671,12 +661,13 @@ PromptGrid.displayName = "PromptGrid";
671
661
  import * as React4 from "react";
672
662
  import { jsx as jsx5 } from "react/jsx-runtime";
673
663
  var Input = React4.forwardRef(
674
- ({ className, type, ...props }, ref) => /* @__PURE__ */ jsx5(
664
+ ({ className, type, controlSize = "md", ...props }, ref) => /* @__PURE__ */ jsx5(
675
665
  "input",
676
666
  {
677
667
  type,
678
668
  ref,
679
- className: cn("fractal-input", className),
669
+ "data-control-size": controlSize,
670
+ className: cn("fractal-control", "fractal-input", className),
680
671
  ...props
681
672
  }
682
673
  )
@@ -690,6 +681,7 @@ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
690
681
  var TableSearch = React5.forwardRef(
691
682
  ({
692
683
  searchType = "text",
684
+ controlSize = "md",
693
685
  className,
694
686
  inputClassName,
695
687
  placeholder,
@@ -703,12 +695,14 @@ var TableSearch = React5.forwardRef(
703
695
  {
704
696
  className: cn("fractal-table-search", className),
705
697
  "data-search-type": searchType,
698
+ "data-control-size": controlSize,
706
699
  children: [
707
700
  /* @__PURE__ */ jsx6(SearchIcon, { className: "fractal-table-search__icon", size: 17, "aria-hidden": "true" }),
708
701
  /* @__PURE__ */ jsx6(
709
702
  Input,
710
703
  {
711
704
  ...props,
705
+ controlSize,
712
706
  ref,
713
707
  type: "search",
714
708
  className: cn("fractal-table-search__input", inputClassName),
@@ -729,6 +723,7 @@ import { Minus, Plus } from "@mirror-physics/fractal-icons";
729
723
  import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
730
724
  function NumberInput({
731
725
  unit,
726
+ controlSize = "md",
732
727
  className,
733
728
  value,
734
729
  defaultValue,
@@ -752,11 +747,12 @@ function NumberInput({
752
747
  input.dispatchEvent(new Event("input", { bubbles: true }));
753
748
  input.focus();
754
749
  };
755
- return /* @__PURE__ */ jsxs7("div", { className: cn("fractal-number-input", unit && "fractal-number-input--with-unit", className), children: [
750
+ return /* @__PURE__ */ jsxs7("div", { "data-control-size": controlSize, className: cn("fractal-number-input", unit && "fractal-number-input--with-unit", className), children: [
756
751
  /* @__PURE__ */ jsx7(
757
752
  Input,
758
753
  {
759
754
  ref: inputRef,
755
+ controlSize,
760
756
  type: "number",
761
757
  value,
762
758
  defaultValue,
@@ -771,7 +767,7 @@ function NumberInput({
771
767
  "span",
772
768
  {
773
769
  className: "fractal-number-input-unit",
774
- style: { left: `calc(var(--space-3, 12px) + ${characterCount}ch)` },
770
+ style: { left: `calc(var(--control-padding-inline) + ${characterCount}ch)` },
775
771
  "aria-hidden": "true",
776
772
  children: unit
777
773
  }
@@ -936,6 +932,7 @@ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
936
932
  var PasswordInput = React7.forwardRef(
937
933
  ({
938
934
  className,
935
+ controlSize = "md",
939
936
  disabled,
940
937
  showPasswordLabel = "Show password",
941
938
  hidePasswordLabel = "Hide password",
@@ -947,12 +944,14 @@ var PasswordInput = React7.forwardRef(
947
944
  "div",
948
945
  {
949
946
  className: cn("fractal-password-input", className),
947
+ "data-control-size": controlSize,
950
948
  "data-password-visible": passwordVisible ? "" : void 0,
951
949
  children: [
952
950
  /* @__PURE__ */ jsx9(
953
951
  Input,
954
952
  {
955
953
  ...props,
954
+ controlSize,
956
955
  ref,
957
956
  className: "fractal-password-input-field",
958
957
  disabled,
@@ -983,10 +982,11 @@ PasswordInput.displayName = "PasswordInput";
983
982
  import * as React8 from "react";
984
983
  import { jsx as jsx10 } from "react/jsx-runtime";
985
984
  var Label = React8.forwardRef(
986
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
985
+ ({ className, controlSize = "md", ...props }, ref) => /* @__PURE__ */ jsx10(
987
986
  "label",
988
987
  {
989
988
  ref,
989
+ "data-control-size": controlSize,
990
990
  className: cn("fractal-label", className),
991
991
  ...props
992
992
  }
@@ -1341,7 +1341,9 @@ function Dropdown({
1341
1341
  label,
1342
1342
  iconOnly = false,
1343
1343
  noChevron = false,
1344
- size = "md",
1344
+ size: sizeAlias = "md",
1345
+ controlSize,
1346
+ triggerId,
1345
1347
  triggerVariant = "outline",
1346
1348
  className,
1347
1349
  triggerClassName,
@@ -1349,6 +1351,7 @@ function Dropdown({
1349
1351
  closeOnSelect = true,
1350
1352
  disabled = false
1351
1353
  }) {
1354
+ const size = controlSize ?? sizeAlias;
1352
1355
  const [open, setOpen] = React12.useState(false);
1353
1356
  const triggerRef = React12.useRef(null);
1354
1357
  const panelRef = React12.useRef(null);
@@ -1423,11 +1426,13 @@ function Dropdown({
1423
1426
  document.addEventListener("mousedown", handleClickOutside);
1424
1427
  return () => document.removeEventListener("mousedown", handleClickOutside);
1425
1428
  }, [open]);
1426
- return /* @__PURE__ */ jsxs16("div", { className: cn("fractal-dropdown", className), children: [
1429
+ return /* @__PURE__ */ jsxs16("div", { "data-control-size": size, className: cn("fractal-dropdown", className), children: [
1427
1430
  /* @__PURE__ */ jsxs16(
1428
1431
  "button",
1429
1432
  {
1430
1433
  ref: triggerRef,
1434
+ id: triggerId,
1435
+ "data-control-size": size,
1431
1436
  type: "button",
1432
1437
  disabled,
1433
1438
  "aria-haspopup": "listbox",
@@ -1435,6 +1440,7 @@ function Dropdown({
1435
1440
  "aria-label": triggerLabel,
1436
1441
  onClick: () => setOpen((o) => !o),
1437
1442
  className: cn(
1443
+ "fractal-control",
1438
1444
  "fractal-dropdown-trigger",
1439
1445
  `fractal-dropdown-trigger--${size}`,
1440
1446
  `fractal-dropdown-trigger--${triggerVariant}`,
@@ -1524,6 +1530,7 @@ var Chip = React14.forwardRef(
1524
1530
  "span",
1525
1531
  {
1526
1532
  ref,
1533
+ "data-fractal-border-surface": tone === "neutral" ? "surface-2" : void 0,
1527
1534
  className: cn("fractal-chip", `fractal-chip--${tone}`, className),
1528
1535
  ...props
1529
1536
  }
@@ -2203,8 +2210,8 @@ function Ghost({ className, width, height, radius, style, ...props }) {
2203
2210
  function GhostLine({ className, size = "md", width = "100%", ...props }) {
2204
2211
  return /* @__PURE__ */ jsx27(Ghost, { className: cn("fractal-ghost-line", `fractal-ghost-line--${size}`, className), width, ...props });
2205
2212
  }
2206
- function ButtonGhost({ className, size = "md", iconOnly = false, width, ...props }) {
2207
- return /* @__PURE__ */ jsx27(Ghost, { className: cn("fractal-ghost-button", `fractal-ghost-button--${size}`, iconOnly && "fractal-ghost-button--icon-only", className), width, ...props });
2213
+ function ButtonGhost({ className, size = "md", controlSize, iconOnly = false, width, ...props }) {
2214
+ return /* @__PURE__ */ jsx27(Ghost, { "data-control-size": controlSize ?? size, className: cn("fractal-ghost-button", `fractal-ghost-button--${size}`, iconOnly && "fractal-ghost-button--icon-only", className), width, ...props });
2208
2215
  }
2209
2216
  function CardGhost({ className, lines = 3, showHeader = true, ...props }) {
2210
2217
  return /* @__PURE__ */ jsxs23("div", { "aria-hidden": "true", className: cn("fractal-ghost-card", className), ...props, children: [
@@ -2237,8 +2244,8 @@ function TextareaGhost({ className, labelWidth = "26%", ...props }) {
2237
2244
  function LabelGhost({ className, width = "26%", ...props }) {
2238
2245
  return /* @__PURE__ */ jsx27(GhostLine, { className: cn("fractal-ghost-label", className), size: "sm", width, ...props });
2239
2246
  }
2240
- function FormFieldGhost({ className, labelWidth = "26%", multiline = false, ...props }) {
2241
- return /* @__PURE__ */ jsxs23("div", { "aria-hidden": "true", className: cn("fractal-ghost-field", className), ...props, children: [
2247
+ function FormFieldGhost({ className, labelWidth = "26%", multiline = false, controlSize = "md", ...props }) {
2248
+ return /* @__PURE__ */ jsxs23("div", { "aria-hidden": "true", "data-control-size": controlSize, className: cn("fractal-ghost-field", className), ...props, children: [
2242
2249
  /* @__PURE__ */ jsx27(LabelGhost, { width: labelWidth }),
2243
2250
  /* @__PURE__ */ jsx27(Ghost, { className: cn("fractal-ghost-field__control", multiline && "fractal-ghost-field__control--multiline") })
2244
2251
  ] });
@@ -2263,8 +2270,8 @@ function LinkGhost({ className, width = 96, ...props }) {
2263
2270
  return /* @__PURE__ */ jsx27(GhostLine, { className: cn("fractal-ghost-link", className), size: "sm", width, ...props });
2264
2271
  }
2265
2272
  var TextButtonGhost = LinkGhost;
2266
- function DropdownGhost({ className, ...props }) {
2267
- return /* @__PURE__ */ jsxs23("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropdown", className), ...props, children: [
2273
+ function DropdownGhost({ className, controlSize = "md", ...props }) {
2274
+ return /* @__PURE__ */ jsxs23("div", { "aria-hidden": "true", "data-control-size": controlSize, className: cn("fractal-ghost-dropdown", className), ...props, children: [
2268
2275
  /* @__PURE__ */ jsx27(GhostLine, { width: "38%" }),
2269
2276
  /* @__PURE__ */ jsx27(Ghost, { className: "fractal-ghost-dropdown__chevron" })
2270
2277
  ] });