@cascivo/react 0.8.0 → 0.9.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.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ErrorBoundary, FocusScope, LinkComponent, Portal, RovingOrientation, Signal, SuspenseBoundary, getLinkComponent, setLinkComponent } from "@cascivo/core";
1
+ import { ErrorBoundary, FocusScope, LinkComponent, LinkComponentProps, Portal, RovingOrientation, Signal, SuspenseBoundary, getLinkComponent, setLinkComponent } from "@cascivo/core";
2
2
  import { AnchorHTMLAttributes, ButtonHTMLAttributes, FormHTMLAttributes, HTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, MouseEvent, ReactElement, ReactNode, RefObject, SelectHTMLAttributes, TextareaHTMLAttributes, TimeHTMLAttributes } from "react";
3
3
 
4
4
  interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -335,6 +335,9 @@ declare function RadioGroup({
335
335
  interface ToggleProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {
336
336
  checked?: boolean;
337
337
  defaultChecked?: boolean;
338
+ /** Called with the new checked state when the switch is toggled. */
339
+ onValueChange?: (checked: boolean) => void;
340
+ /** @deprecated Use `onValueChange` — it receives the same `checked` boolean. */
338
341
  onChange?: (checked: boolean) => void;
339
342
  /**
340
343
  * Renders a **visible** text label beside the switch that also becomes its
@@ -348,6 +351,7 @@ interface ToggleProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onC
348
351
  declare function Toggle({
349
352
  checked,
350
353
  defaultChecked,
354
+ onValueChange,
351
355
  onChange,
352
356
  label,
353
357
  size,
@@ -652,7 +656,13 @@ interface SideNavLinkProps {
652
656
  'data-state'?: 'active' | undefined;
653
657
  'data-tone'?: Exclude<SideNavTone, 'default'> | undefined;
654
658
  tabIndex?: number | undefined;
655
- onClick: (e: MouseEvent<HTMLAnchorElement>) => void;
659
+ /**
660
+ * Always provided by cascivo when it builds the bag; only calls
661
+ * `preventDefault()` for a disabled item, otherwise inert. Optional on the type
662
+ * so it composes cleanly — spread it onto a router `<Link>`, which layers its own
663
+ * click handling on top.
664
+ */
665
+ onClick?: (e: MouseEvent<HTMLAnchorElement>) => void;
656
666
  }
657
667
  /** A selectable/navigable sub-item (link when `href` is set, action when `onSelect` is set). */
658
668
  interface SideNavLinkSubItem {
@@ -924,6 +934,9 @@ declare function OverflowMenu({
924
934
  interface SearchProps {
925
935
  value?: string;
926
936
  defaultValue?: string;
937
+ /** Called with the current text on every keystroke. */
938
+ onValueChange?: (value: string) => void;
939
+ /** @deprecated Use `onValueChange` — it receives the same string. */
927
940
  onChange?: (value: string) => void;
928
941
  onSearch?: (value: string) => void;
929
942
  debounceMs?: number;
@@ -938,6 +951,7 @@ interface SearchProps {
938
951
  declare function Search({
939
952
  value,
940
953
  defaultValue,
954
+ onValueChange,
941
955
  onChange,
942
956
  onSearch,
943
957
  debounceMs,
@@ -952,6 +966,9 @@ declare function Search({
952
966
  interface NumberInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max' | 'step'> {
953
967
  value?: number | null;
954
968
  defaultValue?: number;
969
+ /** Called with the new numeric value (or null when cleared). */
970
+ onValueChange?: (value: number | null) => void;
971
+ /** @deprecated Use `onValueChange` — it receives the same `number | null`. */
955
972
  onChange?: (value: number | null) => void;
956
973
  min?: number;
957
974
  max?: number;
@@ -968,6 +985,7 @@ interface NumberInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, '
968
985
  declare function NumberInput({
969
986
  value,
970
987
  defaultValue,
988
+ onValueChange,
971
989
  onChange,
972
990
  min,
973
991
  max,
@@ -1251,6 +1269,9 @@ interface ComboboxProps {
1251
1269
  options: ComboboxOption[];
1252
1270
  value?: string;
1253
1271
  defaultValue?: string;
1272
+ /** Called with the selected option value (or undefined when cleared). */
1273
+ onValueChange?: (value: string | undefined) => void;
1274
+ /** @deprecated Use `onValueChange` — it receives the same `string | undefined`. */
1254
1275
  onChange?: (value: string | undefined) => void;
1255
1276
  clearable?: boolean;
1256
1277
  searchable?: boolean;
@@ -1267,6 +1288,7 @@ declare function Combobox({
1267
1288
  options,
1268
1289
  value,
1269
1290
  defaultValue,
1291
+ onValueChange,
1270
1292
  onChange,
1271
1293
  clearable,
1272
1294
  searchable,
@@ -1288,6 +1310,9 @@ interface DatePickerLabels {
1288
1310
  interface DatePickerProps {
1289
1311
  value?: string;
1290
1312
  defaultValue?: string;
1313
+ /** Called with the selected ISO date string (or undefined when cleared). */
1314
+ onValueChange?: (value: string | undefined) => void;
1315
+ /** @deprecated Use `onValueChange` — it receives the same ISO `string | undefined`. */
1291
1316
  onChange?: (value: string | undefined) => void;
1292
1317
  min?: string;
1293
1318
  max?: string;
@@ -1304,6 +1329,7 @@ interface DatePickerProps {
1304
1329
  declare function DatePicker({
1305
1330
  value,
1306
1331
  defaultValue,
1332
+ onValueChange,
1307
1333
  onChange,
1308
1334
  min,
1309
1335
  max,
@@ -1363,6 +1389,9 @@ declare function FileUploader({
1363
1389
  interface TimePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max' | 'step'> {
1364
1390
  value?: string;
1365
1391
  defaultValue?: string;
1392
+ /** Called with the new `HH:MM` time string when the value changes. */
1393
+ onValueChange?: (value: string) => void;
1394
+ /** @deprecated Use `onValueChange` — it receives the same time string. */
1366
1395
  onChange?: (value: string) => void;
1367
1396
  min?: string;
1368
1397
  max?: string;
@@ -1375,6 +1404,7 @@ interface TimePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 's
1375
1404
  declare function TimePicker({
1376
1405
  value,
1377
1406
  defaultValue,
1407
+ onValueChange,
1378
1408
  onChange,
1379
1409
  min,
1380
1410
  max,
@@ -2315,6 +2345,9 @@ interface FilterProps {
2315
2345
  options: FilterOption[];
2316
2346
  value?: string[];
2317
2347
  defaultValue?: string[];
2348
+ /** Called with the selected values whenever the selection changes. */
2349
+ onValueChange?: (selected: string[]) => void;
2350
+ /** @deprecated Use `onValueChange` — it receives the same `string[]`. */
2318
2351
  onChange?: (selected: string[]) => void;
2319
2352
  multi?: boolean;
2320
2353
  variant?: FilterVariant;
@@ -2325,6 +2358,7 @@ declare function Filter({
2325
2358
  options,
2326
2359
  value,
2327
2360
  defaultValue,
2361
+ onValueChange,
2328
2362
  onChange,
2329
2363
  multi,
2330
2364
  variant,
@@ -3201,6 +3235,9 @@ interface SwapProps {
3201
3235
  on: React.ReactNode;
3202
3236
  off: React.ReactNode;
3203
3237
  checked?: boolean;
3238
+ /** Called with the new checked state when the swap is toggled. */
3239
+ onValueChange?: (checked: boolean) => void;
3240
+ /** @deprecated Use `onValueChange` — it receives the same `checked` boolean. */
3204
3241
  onChange?: (checked: boolean) => void;
3205
3242
  mode?: SwapMode;
3206
3243
  'aria-label'?: string;
@@ -3210,6 +3247,7 @@ declare function Swap({
3210
3247
  on,
3211
3248
  off,
3212
3249
  checked,
3250
+ onValueChange,
3213
3251
  onChange,
3214
3252
  mode,
3215
3253
  className,
@@ -3365,8 +3403,11 @@ declare function setTheme(next: string): void;
3365
3403
  declare function useTheme(): readonly [Signal<string>, (next: string) => void];
3366
3404
  interface ThemeProviderProps {
3367
3405
  /**
3368
- * Theme to use when nothing is persisted yet. Falls back to the visitor's OS
3369
- * `prefers-color-scheme` (light/dark), then to `'light'`.
3406
+ * Theme to use when nothing is persisted yet. When set, it **wins over** the
3407
+ * visitor's OS `prefers-color-scheme` — pass it for a "dark by default" or
3408
+ * custom-theme (`'midnight'`, …) app. Omit it to follow the OS (light/dark),
3409
+ * falling back to `'light'`. Precedence: persisted value > `defaultTheme` (if
3410
+ * set) > OS preference > `'light'`.
3370
3411
  */
3371
3412
  defaultTheme?: string;
3372
3413
  /**
@@ -3413,11 +3454,23 @@ declare function ThemeProvider({
3413
3454
  * SSR or a hard reload. Pass the same `storageKey`/`attribute`/`defaultTheme`
3414
3455
  * you give {@link ThemeProvider}.
3415
3456
  *
3457
+ * Precedence matches {@link ThemeProvider}: persisted value > `defaultTheme`
3458
+ * (if set) > OS `prefers-color-scheme` > `'light'`. Passing `defaultTheme`
3459
+ * suppresses the OS check, so a "dark by default" app stays dark on a light-OS
3460
+ * visitor.
3461
+ *
3462
+ * The script sets `data-theme` **before** React hydrates, so add
3463
+ * `suppressHydrationWarning` to the element that carries the attribute (usually
3464
+ * `<html>`) — the mutation is intentional, and without the flag React 19 logs a
3465
+ * hydration mismatch.
3466
+ *
3416
3467
  * ```tsx
3417
3468
  * // Next.js app/layout.tsx
3418
- * <head>
3419
- * <script dangerouslySetInnerHTML={{ __html: themePreloadScript() }} />
3420
- * </head>
3469
+ * <html suppressHydrationWarning>
3470
+ * <head>
3471
+ * <script dangerouslySetInnerHTML={{ __html: themePreloadScript({ defaultTheme: 'dark' }) }} />
3472
+ * </head>
3473
+ * </html>
3421
3474
  * ```
3422
3475
  */
3423
3476
  declare function themePreloadScript(options?: {
@@ -3425,4 +3478,4 @@ declare function themePreloadScript(options?: {
3425
3478
  attribute?: string;
3426
3479
  defaultTheme?: string;
3427
3480
  }): string;
3428
- export { Accordion, AccordionContent, AccordionItem, AccordionItemProps, AccordionProps, AccordionTrigger, ActionSheet, ActionSheetAction, ActionSheetProps, Alert, AlertDialog, AlertDialogLabels, AlertDialogProps, AlertProps, AppShell, AppShellProps, AspectRatio, AspectRatioProps, AutoGrid, AutoGridProps, Avatar, AvatarGroup, AvatarGroupLabels, AvatarGroupProps, AvatarProps, Badge, BadgeProps, Blockquote, BlockquoteProps, BottomSheet, BottomSheetProps, Breadcrumb, BreadcrumbItem, BreadcrumbProps, Button, ButtonGroup, ButtonGroupProps, ButtonProps, Calendar, CalendarLabels, CalendarProps, Card, CardContent, CardContentProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardTitle, CardTitleProps, Carousel, CarouselLabels, CarouselProps, Center, CenterProps, ChatBubble, ChatBubbleProps, ChatBubbleSide, Checkbox, CheckboxCard, CheckboxCardProps, CheckboxProps, Code, type CodeLang, CodeProps, CodeSnippet, CodeSnippetProps, Collapsible, CollapsibleProps, ColorPicker, ColorPickerLabels, ColorPickerProps, Column, Columns, ColumnsProps, Combobox, ComboboxLabels, ComboboxOption, ComboboxProps, CommandAction, CommandGroup, CommandItem, CommandMenu, CommandMenuProps, CommandPage, CommandScope, CommandStatus, Comparison, ComparisonProps, ContainedList, ContainedListItem, ContainedListItemProps, ContainedListProps, ContextMenu, ContextMenuItem, ContextMenuItemProps, ContextMenuProps, CopyButton, CopyButtonProps, DataList, DataListItem, DataListProps, DataTable, DataTableLabels, DataTableProps, DatePicker, DatePickerLabels, DatePickerProps, DateRange, DateRangePicker, DateRangePickerLabels, DateRangePickerProps, DateRangePreset, Dock, DockItem, DockProps, Drawer, DrawerProps, Dropdown, DropdownItem, DropdownProps, Editable, EditableProps, EmptyState, EmptyStateProps, ErrorBoundary, Fab, FabAction, FabProps, Field, FieldProps, FileUploader, FileUploaderLabels, FileUploaderProps, Filter, FilterOption, FilterProps, FilterVariant, Flex, FlexProps, FocusScope, Form, FormConfig, FormProps, FormStore, FuzzyMatch, Grid, GridAlign, GridItem, GridItemProps, GridProps, Header, HeaderLabels, HeaderLink, HeaderPanel, HeaderPanelLabels, HeaderPanelProps, HeaderProps, Heading, HeadingLevel, HeadingProps, HeadingSize, HoverCard, HoverCardContent, HoverCardContentProps, HoverCardProps, HoverCardTrigger, HoverCardTriggerProps, IconButton, IconButtonProps, Image, ImageProps, Indicator, IndicatorPlacement, IndicatorProps, InlineLoading, InlineLoadingProps, InlineLoadingStatus, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, type InputGroupProps, InputProps, Item, ItemActions, ItemActionsProps, ItemContent, ItemContentProps, ItemDescription, ItemDescriptionProps, ItemMedia, ItemMediaProps, ItemProps, ItemTitle, ItemTitleProps, Join, JoinOrientation, JoinProps, Kbd, KbdProps, Label, LabelProps, Link, type LinkComponent, LinkProps, List, ListItem, ListItemProps, ListProps, LogLevel, LogLine, LogViewer, LogViewerLabels, LogViewerProps, Menu, MenuButton, MenuButtonItem, MenuButtonProps, MenuItem, MenuItemProps, MenuProps, MenuSeparator, MenuTrigger, MenuTriggerProps, Menubar, MenubarItem, MenubarMenu, MenubarProps, Modal, ModalProps, MultiSelect, MultiSelectLabels, MultiSelectOption, MultiSelectProps, NativeSelect, NativeSelectOption, NativeSelectProps, NavigationMenu, NavigationMenuItem, NavigationMenuProps, Notification, NotificationProps, NotificationVariant, NumberInput, NumberInputProps, OtpInput, OtpInputProps, OverflowMenu, OverflowMenuItem, OverflowMenuProps, Pagination, PaginationLabels, PaginationProps, PasswordInput, PasswordInputLabels, PasswordInputProps, Popover, PopoverContent, PopoverContentProps, PopoverProps, PopoverTrigger, PopoverTriggerProps, Portal, Progress, ProgressBar, ProgressBarProps, ProgressCircle, ProgressCircleProps, ProgressIndicator, ProgressIndicatorProps, ProgressProps, ProgressSize, ProgressStep, ProgressVariant, Prose, ProseProps, PullToRefresh, PullToRefreshProps, QrCode, QrCodeProps, RadialProgress, RadialProgressProps, RadialProgressSize, RadialProgressVariant, Radio, RadioCard, RadioCardGroup, RadioCardGroupProps, RadioCardProps, RadioGroup, RadioGroupProps, RadioProps, RatingGroup, RatingGroupLabels, RatingGroupProps, RelativeTime, RelativeTimeProps, Resizable, ResizableProps, Responsive, ScrollArea, ScrollAreaProps, Search, SearchProps, SegmentedControl, SegmentedControlOption, SegmentedControlProps, Select, SelectOption, SelectProps, Separator, SeparatorProps, Sheet, SheetProps, ShellHeader, ShellHeaderAction, ShellHeaderBrand, ShellHeaderLabels, ShellHeaderNavItem, ShellHeaderNavLink, ShellHeaderNavMenu, ShellHeaderNavMenuItem, ShellHeaderProps, SideNav, SideNavGroup, SideNavItem, SideNavLinkProps, SideNavLinkSubItem, SideNavProps, SideNavSubItem, SideNavTone, Skeleton, SkeletonProps, SkipNavLink, SkipNavLinkProps, SkipNavTarget, SkipNavTargetProps, Slider, SliderProps, SortDirection, SortState, Spacer, SpacerProps, Spinner, SpinnerProps, Stack, StackProps, type StandardSchemaV1, Stat, StatProps, Status, StatusProps, Step, StepState, Steps, StepsProps, StructuredList, StructuredListItem, StructuredListProps, SuspenseBoundary, Swap, SwapMode, SwapProps, SwipeAction, SwipeItem, SwipeItemProps, Switcher, SwitcherEntry, SwitcherLink, SwitcherProps, Tabs, TabsContent, TabsContentProps, TabsList, TabsProps, TabsTrigger, TabsTriggerProps, Tag$1 as Tag, TagProps, TagsInput, TagsInputProps, Text, TextProps, Textarea, TextareaProps, ThemeProvider, type ThemeProviderProps, Tile, TileProps, TimePicker, TimePickerProps, Timeline, TimelineItem, TimelineProps, ToastOptions, ToastProvider, ToastVariant, Toc, TocItem, TocProps, Toggle, ToggleGroup, ToggleGroupItem, ToggleGroupProps, ToggleProps, Toggletip, ToggletipPlacement, ToggletipProps, Tooltip, TooltipProps, TreeNode, TreeView, TreeViewProps, UploaderFile, type UsePopoverOptions, type UsePopoverReturn, type UseTocFromRegionOptions, User, UserProps, VisuallyHidden, VisuallyHiddenProps, createForm, dismissAllToasts, fuzzyMatch, fuzzyScore, getLinkComponent, setLinkComponent, setTheme, themePreloadScript, treeViewMessages, useForm, usePopover, useTheme, useToast, useTocFromRegion };
3481
+ export { Accordion, AccordionContent, AccordionItem, AccordionItemProps, AccordionProps, AccordionTrigger, ActionSheet, ActionSheetAction, ActionSheetProps, Alert, AlertDialog, AlertDialogLabels, AlertDialogProps, AlertProps, AppShell, AppShellProps, AspectRatio, AspectRatioProps, AutoGrid, AutoGridProps, Avatar, AvatarGroup, AvatarGroupLabels, AvatarGroupProps, AvatarProps, Badge, BadgeProps, Blockquote, BlockquoteProps, BottomSheet, BottomSheetProps, Breadcrumb, BreadcrumbItem, BreadcrumbProps, Button, ButtonGroup, ButtonGroupProps, ButtonProps, Calendar, CalendarLabels, CalendarProps, Card, CardContent, CardContentProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardTitle, CardTitleProps, Carousel, CarouselLabels, CarouselProps, Center, CenterProps, ChatBubble, ChatBubbleProps, ChatBubbleSide, Checkbox, CheckboxCard, CheckboxCardProps, CheckboxProps, Code, type CodeLang, CodeProps, CodeSnippet, CodeSnippetProps, Collapsible, CollapsibleProps, ColorPicker, ColorPickerLabels, ColorPickerProps, Column, Columns, ColumnsProps, Combobox, ComboboxLabels, ComboboxOption, ComboboxProps, CommandAction, CommandGroup, CommandItem, CommandMenu, CommandMenuProps, CommandPage, CommandScope, CommandStatus, Comparison, ComparisonProps, ContainedList, ContainedListItem, ContainedListItemProps, ContainedListProps, ContextMenu, ContextMenuItem, ContextMenuItemProps, ContextMenuProps, CopyButton, CopyButtonProps, DataList, DataListItem, DataListProps, DataTable, DataTableLabels, DataTableProps, DatePicker, DatePickerLabels, DatePickerProps, DateRange, DateRangePicker, DateRangePickerLabels, DateRangePickerProps, DateRangePreset, Dock, DockItem, DockProps, Drawer, DrawerProps, Dropdown, DropdownItem, DropdownProps, Editable, EditableProps, EmptyState, EmptyStateProps, ErrorBoundary, Fab, FabAction, FabProps, Field, FieldProps, FileUploader, FileUploaderLabels, FileUploaderProps, Filter, FilterOption, FilterProps, FilterVariant, Flex, FlexProps, FocusScope, Form, FormConfig, FormProps, FormStore, FuzzyMatch, Grid, GridAlign, GridItem, GridItemProps, GridProps, Header, HeaderLabels, HeaderLink, HeaderPanel, HeaderPanelLabels, HeaderPanelProps, HeaderProps, Heading, HeadingLevel, HeadingProps, HeadingSize, HoverCard, HoverCardContent, HoverCardContentProps, HoverCardProps, HoverCardTrigger, HoverCardTriggerProps, IconButton, IconButtonProps, Image, ImageProps, Indicator, IndicatorPlacement, IndicatorProps, InlineLoading, InlineLoadingProps, InlineLoadingStatus, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, type InputGroupProps, InputProps, Item, ItemActions, ItemActionsProps, ItemContent, ItemContentProps, ItemDescription, ItemDescriptionProps, ItemMedia, ItemMediaProps, ItemProps, ItemTitle, ItemTitleProps, Join, JoinOrientation, JoinProps, Kbd, KbdProps, Label, LabelProps, Link, type LinkComponent, type LinkComponentProps, LinkProps, List, ListItem, ListItemProps, ListProps, LogLevel, LogLine, LogViewer, LogViewerLabels, LogViewerProps, Menu, MenuButton, MenuButtonItem, MenuButtonProps, MenuItem, MenuItemProps, MenuProps, MenuSeparator, MenuTrigger, MenuTriggerProps, Menubar, MenubarItem, MenubarMenu, MenubarProps, Modal, ModalProps, MultiSelect, MultiSelectLabels, MultiSelectOption, MultiSelectProps, NativeSelect, NativeSelectOption, NativeSelectProps, NavigationMenu, NavigationMenuItem, NavigationMenuProps, Notification, NotificationProps, NotificationVariant, NumberInput, NumberInputProps, OtpInput, OtpInputProps, OverflowMenu, OverflowMenuItem, OverflowMenuProps, Pagination, PaginationLabels, PaginationProps, PasswordInput, PasswordInputLabels, PasswordInputProps, Popover, PopoverContent, PopoverContentProps, PopoverProps, PopoverTrigger, PopoverTriggerProps, Portal, Progress, ProgressBar, ProgressBarProps, ProgressCircle, ProgressCircleProps, ProgressIndicator, ProgressIndicatorProps, ProgressProps, ProgressSize, ProgressStep, ProgressVariant, Prose, ProseProps, PullToRefresh, PullToRefreshProps, QrCode, QrCodeProps, RadialProgress, RadialProgressProps, RadialProgressSize, RadialProgressVariant, Radio, RadioCard, RadioCardGroup, RadioCardGroupProps, RadioCardProps, RadioGroup, RadioGroupProps, RadioProps, RatingGroup, RatingGroupLabels, RatingGroupProps, RelativeTime, RelativeTimeProps, Resizable, ResizableProps, Responsive, ScrollArea, ScrollAreaProps, Search, SearchProps, SegmentedControl, SegmentedControlOption, SegmentedControlProps, Select, SelectOption, SelectProps, Separator, SeparatorProps, Sheet, SheetProps, ShellHeader, ShellHeaderAction, ShellHeaderBrand, ShellHeaderLabels, ShellHeaderNavItem, ShellHeaderNavLink, ShellHeaderNavMenu, ShellHeaderNavMenuItem, ShellHeaderProps, SideNav, SideNavGroup, SideNavItem, SideNavLinkProps, SideNavLinkSubItem, SideNavProps, SideNavSubItem, SideNavTone, Skeleton, SkeletonProps, SkipNavLink, SkipNavLinkProps, SkipNavTarget, SkipNavTargetProps, Slider, SliderProps, SortDirection, SortState, Spacer, SpacerProps, Spinner, SpinnerProps, Stack, StackProps, type StandardSchemaV1, Stat, StatProps, Status, StatusProps, Step, StepState, Steps, StepsProps, StructuredList, StructuredListItem, StructuredListProps, SuspenseBoundary, Swap, SwapMode, SwapProps, SwipeAction, SwipeItem, SwipeItemProps, Switcher, SwitcherEntry, SwitcherLink, SwitcherProps, Tabs, TabsContent, TabsContentProps, TabsList, TabsProps, TabsTrigger, TabsTriggerProps, Tag$1 as Tag, TagProps, TagsInput, TagsInputProps, Text, TextProps, Textarea, TextareaProps, ThemeProvider, type ThemeProviderProps, Tile, TileProps, TimePicker, TimePickerProps, Timeline, TimelineItem, TimelineProps, ToastOptions, ToastProvider, ToastVariant, Toc, TocItem, TocProps, Toggle, ToggleGroup, ToggleGroupItem, ToggleGroupProps, ToggleProps, Toggletip, ToggletipPlacement, ToggletipProps, Tooltip, TooltipProps, TreeNode, TreeView, TreeViewProps, UploaderFile, type UsePopoverOptions, type UsePopoverReturn, type UseTocFromRegionOptions, User, UserProps, VisuallyHidden, VisuallyHiddenProps, createForm, dismissAllToasts, fuzzyMatch, fuzzyScore, getLinkComponent, setLinkComponent, setTheme, themePreloadScript, treeViewMessages, useForm, usePopover, useTheme, useToast, useTocFromRegion };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ export * from './react/src/index.js';
@@ -30,66 +30,66 @@ function m(e) {
30
30
  let n = Number(t);
31
31
  return Number.isFinite(n) ? n : null;
32
32
  }
33
- function h({ value: n, defaultValue: h, onChange: g, min: _, max: v, step: y = 1, precision: b, formatOptions: x, label: S, hint: C, error: w, size: T = "md", disabled: E, incrementLabel: D, decrementLabel: O, className: k, id: A, onFocus: j, onBlur: M, onKeyDown: N, ...P }) {
33
+ function h({ value: n, defaultValue: h, onValueChange: g, onChange: _, min: v, max: y, step: b = 1, precision: x, formatOptions: S, label: C, hint: w, error: T, size: E = "md", disabled: D, incrementLabel: O, decrementLabel: k, className: A, id: j, onFocus: M, onBlur: N, onKeyDown: P, ...F }) {
34
34
  a();
35
- let F = D ?? s(o.numberInput.increment), I = O ?? s(o.numberInput.decrement), [L, R] = r(u), z = n !== void 0, B = i(h ?? null), V = i(""), H = z ? n : B.value, U = A ?? (S ? `cascade-number-input-${S.toLowerCase().replace(/\s+/g, "-")}` : void 0), W = (e) => {
36
- z || (B.value = e), V.value = e == null ? "" : String(e), e !== H && g?.(e);
37
- }, G = () => {
38
- let e = m(V.value);
39
- e != null && (e = d(e, _, v), b !== void 0 && (e = p(e, b))), W(e);
40
- }, K = (e) => {
41
- let t = (L.value === "focused" ? m(V.value) : H) ?? 0, n = b ?? Math.max(f(y), f(t));
42
- W(d(p(t + e * y, n), _, v));
43
- }, q = L.value === "focused" ? V.value : ((e) => e == null ? "" : x ? new Intl.NumberFormat(void 0, x).format(e) : String(e))(H), J = H != null && v !== void 0 && H >= v, Y = H != null && _ !== void 0 && H <= _;
35
+ let I = O ?? s(o.numberInput.increment), L = k ?? s(o.numberInput.decrement), [R, z] = r(u), B = n !== void 0, V = i(h ?? null), H = i(""), U = B ? n : V.value, W = j ?? (C ? `cascade-number-input-${C.toLowerCase().replace(/\s+/g, "-")}` : void 0), G = (e) => {
36
+ B || (V.value = e), H.value = e == null ? "" : String(e), e !== U && (g ?? _)?.(e);
37
+ }, K = () => {
38
+ let e = m(H.value);
39
+ e != null && (e = d(e, v, y), x !== void 0 && (e = p(e, x))), G(e);
40
+ }, q = (e) => {
41
+ let t = (R.value === "focused" ? m(H.value) : U) ?? 0, n = x ?? Math.max(f(b), f(t));
42
+ G(d(p(t + e * b, n), v, y));
43
+ }, J = R.value === "focused" ? H.value : ((e) => e == null ? "" : S ? new Intl.NumberFormat(void 0, S).format(e) : String(e))(U), Y = U != null && y !== void 0 && U >= y, X = U != null && v !== void 0 && U <= v;
44
44
  return /* @__PURE__ */ l("div", {
45
- className: t(e.wrapper, k),
46
- "data-state": w ? "error" : L.value,
47
- "data-size": T,
45
+ className: t(e.wrapper, A),
46
+ "data-state": T ? "error" : R.value,
47
+ "data-size": E,
48
48
  children: [
49
- S && /* @__PURE__ */ c("label", {
49
+ C && /* @__PURE__ */ c("label", {
50
50
  className: e.label,
51
- htmlFor: U,
52
- children: S
51
+ htmlFor: W,
52
+ children: C
53
53
  }),
54
54
  /* @__PURE__ */ l("div", {
55
55
  className: e.field,
56
56
  children: [/* @__PURE__ */ c("input", {
57
- id: U,
57
+ id: W,
58
58
  type: "text",
59
59
  inputMode: "decimal",
60
60
  autoComplete: "off",
61
61
  role: "spinbutton",
62
62
  className: e.input,
63
- value: q,
64
- disabled: E,
65
- "aria-valuenow": H ?? void 0,
66
- "aria-valuemin": _,
67
- "aria-valuemax": v,
68
- "aria-invalid": w ? !0 : void 0,
69
- "aria-describedby": w ? `${U}-error` : C ? `${U}-hint` : void 0,
63
+ value: J,
64
+ disabled: D,
65
+ "aria-valuenow": U ?? void 0,
66
+ "aria-valuemin": v,
67
+ "aria-valuemax": y,
68
+ "aria-invalid": T ? !0 : void 0,
69
+ "aria-describedby": T ? `${W}-error` : w ? `${W}-hint` : void 0,
70
70
  onChange: (e) => {
71
- V.value = e.target.value;
71
+ H.value = e.target.value;
72
72
  },
73
73
  onFocus: (e) => {
74
- V.value = H == null ? "" : String(H), R("FOCUS"), j?.(e);
74
+ H.value = U == null ? "" : String(U), z("FOCUS"), M?.(e);
75
75
  },
76
76
  onBlur: (e) => {
77
- G(), R("BLUR"), M?.(e);
77
+ K(), z("BLUR"), N?.(e);
78
78
  },
79
79
  onKeyDown: (e) => {
80
- e.key === "ArrowUp" ? (e.preventDefault(), K(1)) : e.key === "ArrowDown" ? (e.preventDefault(), K(-1)) : e.key === "Enter" && G(), N?.(e);
80
+ e.key === "ArrowUp" ? (e.preventDefault(), q(1)) : e.key === "ArrowDown" ? (e.preventDefault(), q(-1)) : e.key === "Enter" && K(), P?.(e);
81
81
  },
82
- ...P
82
+ ...F
83
83
  }), /* @__PURE__ */ l("div", {
84
84
  className: e.steppers,
85
85
  children: [/* @__PURE__ */ c("button", {
86
86
  type: "button",
87
87
  className: e.stepper,
88
- "aria-label": F,
88
+ "aria-label": I,
89
89
  tabIndex: -1,
90
- disabled: E || J,
90
+ disabled: D || Y,
91
91
  onMouseDown: (e) => e.preventDefault(),
92
- onClick: () => K(1),
92
+ onClick: () => q(1),
93
93
  children: /* @__PURE__ */ c("svg", {
94
94
  viewBox: "0 0 10 10",
95
95
  "aria-hidden": "true",
@@ -106,11 +106,11 @@ function h({ value: n, defaultValue: h, onChange: g, min: _, max: v, step: y = 1
106
106
  }), /* @__PURE__ */ c("button", {
107
107
  type: "button",
108
108
  className: e.stepper,
109
- "aria-label": I,
109
+ "aria-label": L,
110
110
  tabIndex: -1,
111
- disabled: E || Y,
111
+ disabled: D || X,
112
112
  onMouseDown: (e) => e.preventDefault(),
113
- onClick: () => K(-1),
113
+ onClick: () => q(-1),
114
114
  children: /* @__PURE__ */ c("svg", {
115
115
  viewBox: "0 0 10 10",
116
116
  "aria-hidden": "true",
@@ -127,16 +127,16 @@ function h({ value: n, defaultValue: h, onChange: g, min: _, max: v, step: y = 1
127
127
  })]
128
128
  })]
129
129
  }),
130
- w && /* @__PURE__ */ c("span", {
131
- id: `${U}-error`,
130
+ T && /* @__PURE__ */ c("span", {
131
+ id: `${W}-error`,
132
132
  className: e.error,
133
133
  role: "alert",
134
- children: w
134
+ children: T
135
135
  }),
136
- !w && C && /* @__PURE__ */ c("span", {
137
- id: `${U}-hint`,
136
+ !T && w && /* @__PURE__ */ c("span", {
137
+ id: `${W}-hint`,
138
138
  className: e.hint,
139
- children: C
139
+ children: w
140
140
  })
141
141
  ]
142
142
  });
@@ -7,37 +7,42 @@ import { useRef as a } from "react";
7
7
  //#region src/theme.tsx
8
8
  var o = "cascivo-theme", s = "data-theme", c = null, l = {
9
9
  storageKey: o,
10
- defaultTheme: "light"
10
+ defaultTheme: "light",
11
+ explicit: !1
11
12
  };
12
13
  function u(e) {
13
14
  return typeof window > "u" || typeof window.matchMedia != "function" ? e : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : e;
14
15
  }
15
16
  function d() {
16
- return c ??= e(l.storageKey, u(l.defaultTheme)), c;
17
+ return l.explicit ? l.defaultTheme : u(l.defaultTheme);
17
18
  }
18
- function f(e) {
19
- d().value = e;
19
+ function f() {
20
+ return c ??= e(l.storageKey, d()), c;
20
21
  }
21
- function p() {
22
- return n(), [d(), f];
22
+ function p(e) {
23
+ f().value = e;
23
24
  }
24
- function m({ defaultTheme: e, value: n, storageKey: u = o, attribute: f = s, target: p, onChange: m, children: h }) {
25
+ function m() {
26
+ return n(), [f(), p];
27
+ }
28
+ function h({ defaultTheme: e, value: n, storageKey: u = o, attribute: d = s, target: p, onChange: m, children: h }) {
25
29
  let g = a(!1);
26
30
  g.current || (g.current = !0, (c === null || l.storageKey !== u) && (l = {
27
31
  storageKey: u,
28
- defaultTheme: e ?? "light"
32
+ defaultTheme: e ?? "light",
33
+ explicit: e !== void 0
29
34
  }, c = null));
30
- let _ = d();
35
+ let _ = f();
31
36
  n !== void 0 && (_.value = n);
32
37
  let v = a(m);
33
38
  return v.current = m, t(() => {
34
39
  let e = _.value;
35
- (p ? p.current : typeof document < "u" ? document.documentElement : null)?.setAttribute(f, e), v.current?.(e);
40
+ (p ? p.current : typeof document < "u" ? document.documentElement : null)?.setAttribute(d, e), v.current?.(e);
36
41
  }), /* @__PURE__ */ i(r, { children: h });
37
42
  }
38
- function h(e = {}) {
39
- let t = JSON.stringify(e.storageKey ?? o), n = JSON.stringify(e.attribute ?? s);
40
- return `(function(){try{var v=${JSON.stringify(e.defaultTheme ?? "light")};if(typeof matchMedia==='function'){if(matchMedia('(prefers-color-scheme: dark)').matches)v='dark';else if(matchMedia('(prefers-color-scheme: light)').matches)v='light';}var raw=localStorage.getItem(${t});if(raw){v=raw;try{var e=JSON.parse(raw);if(e&&typeof e==='object'&&'value'in e)v=e.value;}catch(_){}}document.documentElement.setAttribute(${n},v);}catch(_){}})();`;
43
+ function g(e = {}) {
44
+ let t = JSON.stringify(e.storageKey ?? o), n = JSON.stringify(e.attribute ?? s), r = JSON.stringify(e.defaultTheme ?? "light"), i = e.defaultTheme === void 0 ? "if(typeof matchMedia==='function'){if(matchMedia('(prefers-color-scheme: dark)').matches)v='dark';else if(matchMedia('(prefers-color-scheme: light)').matches)v='light';}" : "";
45
+ return `(function(){try{var v=${r};` + i + `var raw=localStorage.getItem(${t});if(raw){v=raw;try{var e=JSON.parse(raw);if(e&&typeof e==='object'&&'value'in e)v=e.value;}catch(_){}}document.documentElement.setAttribute(${n},v);}catch(_){}})();`;
41
46
  }
42
47
  //#endregion
43
- export { m as ThemeProvider, f as setTheme, h as themePreloadScript, p as useTheme };
48
+ export { h as ThemeProvider, p as setTheme, g as themePreloadScript, m as useTheme };
@@ -29,59 +29,59 @@ function d() {
29
29
  })]
30
30
  });
31
31
  }
32
- function f({ value: f, defaultValue: p = "", onChange: m, onSearch: h, debounceMs: g = 300, placeholder: _, size: v = "md", label: y, disabled: b = !1, clearLabel: x, id: S, className: C }) {
32
+ function f({ value: f, defaultValue: p = "", onValueChange: m, onChange: h, onSearch: g, debounceMs: _ = 300, placeholder: v, size: y = "md", label: b, disabled: x = !1, clearLabel: S, id: C, className: w }) {
33
33
  i();
34
- let w = _ ?? o(a.search.placeholder), T = y ?? o(a.search.label), E = x ?? o(a.search.clear), D = l(null), O = l("");
35
- O.current === "" && (u += 1, O.current = `cascade-search-${u}`);
36
- let k = S ?? O.current, A = f !== void 0, j = n(A ? f : p);
37
- A && (j.value = f);
38
- let M = l(h);
39
- M.current = h;
40
- let N = l(null), P = () => {
41
- N.current !== null && (clearTimeout(N.current), N.current = null);
34
+ let T = v ?? o(a.search.placeholder), E = b ?? o(a.search.label), D = S ?? o(a.search.clear), O = l(null), k = l("");
35
+ k.current === "" && (u += 1, k.current = `cascade-search-${u}`);
36
+ let A = C ?? k.current, j = f !== void 0, M = n(j ? f : p);
37
+ j && (M.value = f);
38
+ let N = l(g);
39
+ N.current = g;
40
+ let P = l(null), F = () => {
41
+ P.current !== null && (clearTimeout(P.current), P.current = null);
42
42
  };
43
- r(() => P);
44
- let F = (e) => {
43
+ r(() => F);
44
+ let I = (e) => {
45
45
  let t = e.target.value;
46
- A || (j.value = t), m?.(t), P(), N.current = setTimeout(() => {
47
- N.current = null, M.current?.(t);
48
- }, g);
49
- }, I = (e) => {
50
- e.key === "Enter" && (P(), h?.(j.value));
51
- }, L = () => {
52
- P(), A || (j.value = ""), m?.(""), h?.(""), D.current?.focus();
53
- }, R = j.value !== "";
46
+ j || (M.value = t), (m ?? h)?.(t), F(), P.current = setTimeout(() => {
47
+ P.current = null, N.current?.(t);
48
+ }, _);
49
+ }, L = (e) => {
50
+ e.key === "Enter" && (F(), g?.(M.value));
51
+ }, R = () => {
52
+ F(), j || (M.value = ""), (m ?? h)?.(""), g?.(""), O.current?.focus();
53
+ }, z = M.value !== "";
54
54
  return /* @__PURE__ */ c("div", {
55
- className: t(e.root, C),
56
- "data-size": v,
57
- "data-state": R ? "filled" : "empty",
55
+ className: t(e.root, w),
56
+ "data-size": y,
57
+ "data-state": z ? "filled" : "empty",
58
58
  children: [
59
59
  /* @__PURE__ */ s("label", {
60
60
  className: e.label,
61
- htmlFor: k,
62
- children: T
61
+ htmlFor: A,
62
+ children: E
63
63
  }),
64
64
  /* @__PURE__ */ s("span", {
65
65
  className: e.icon,
66
66
  children: /* @__PURE__ */ s(d, {})
67
67
  }),
68
68
  /* @__PURE__ */ s("input", {
69
- ref: D,
70
- id: k,
69
+ ref: O,
70
+ id: A,
71
71
  type: "search",
72
72
  className: e.input,
73
- value: j.value,
74
- placeholder: w,
75
- disabled: b,
76
- onChange: F,
77
- onKeyDown: I
73
+ value: M.value,
74
+ placeholder: T,
75
+ disabled: x,
76
+ onChange: I,
77
+ onKeyDown: L
78
78
  }),
79
- R && /* @__PURE__ */ s("button", {
79
+ z && /* @__PURE__ */ s("button", {
80
80
  type: "button",
81
81
  className: e.clear,
82
- "aria-label": E,
83
- disabled: b,
84
- onClick: L,
82
+ "aria-label": D,
83
+ disabled: x,
84
+ onClick: R,
85
85
  children: /* @__PURE__ */ s("span", {
86
86
  "aria-hidden": "true",
87
87
  children: "✕"
package/dist/swap/swap.js CHANGED
@@ -4,23 +4,23 @@ import e from "./swap.module.js";
4
4
  import { useSignal as t, useSignals as n } from "@cascivo/core";
5
5
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
6
  //#region ../components/src/swap/swap.tsx
7
- function a({ on: a, off: o, checked: s = !1, onChange: c, mode: l = "rotate", className: u, ...d }) {
7
+ function a({ on: a, off: o, checked: s = !1, onValueChange: c, onChange: l, mode: u = "rotate", className: d, ...f }) {
8
8
  n();
9
- let f = t(s);
10
- f.value = s;
11
- function p() {
12
- let e = !f.value;
13
- c?.(e);
9
+ let p = t(s);
10
+ p.value = s;
11
+ function m() {
12
+ let e = !p.value;
13
+ (c ?? l)?.(e);
14
14
  }
15
15
  return /* @__PURE__ */ i("button", {
16
16
  type: "button",
17
17
  role: "switch",
18
- "aria-checked": f.value,
19
- className: [e.swap, u].filter(Boolean).join(" "),
20
- "data-checked": f.value || void 0,
21
- "data-mode": l,
22
- onClick: p,
23
- ...d,
18
+ "aria-checked": p.value,
19
+ className: [e.swap, d].filter(Boolean).join(" "),
20
+ "data-checked": p.value || void 0,
21
+ "data-mode": u,
22
+ onClick: m,
23
+ ...f,
24
24
  children: [/* @__PURE__ */ r("span", {
25
25
  className: e.on,
26
26
  "aria-hidden": "true",
@@ -11,49 +11,49 @@ var s = n({
11
11
  focused: { on: { BLUR: "idle" } }
12
12
  }
13
13
  });
14
- function c({ value: n, defaultValue: c, onChange: l, min: u, max: d, step: f, label: p, hint: m, error: h, size: g = "md", className: _, id: v, onFocus: y, onBlur: b, ...x }) {
14
+ function c({ value: n, defaultValue: c, onValueChange: l, onChange: u, min: d, max: f, step: p, label: m, hint: h, error: g, size: _ = "md", className: v, id: y, onFocus: b, onBlur: x, ...S }) {
15
15
  i();
16
- let [S, C] = r(s), w = v ?? (p ? `cascade-time-picker-${p.toLowerCase().replace(/\s+/g, "-")}` : void 0);
16
+ let [C, w] = r(s), T = y ?? (m ? `cascade-time-picker-${m.toLowerCase().replace(/\s+/g, "-")}` : void 0);
17
17
  return /* @__PURE__ */ o("div", {
18
- className: t(e.wrapper, _),
19
- "data-state": h ? "error" : S.value,
20
- "data-size": g,
18
+ className: t(e.wrapper, v),
19
+ "data-state": g ? "error" : C.value,
20
+ "data-size": _,
21
21
  children: [
22
- p && /* @__PURE__ */ a("label", {
22
+ m && /* @__PURE__ */ a("label", {
23
23
  className: e.label,
24
- htmlFor: w,
25
- children: p
24
+ htmlFor: T,
25
+ children: m
26
26
  }),
27
27
  /* @__PURE__ */ a("input", {
28
- id: w,
28
+ id: T,
29
29
  type: "time",
30
30
  className: e.input,
31
31
  value: n,
32
32
  defaultValue: c,
33
- min: u,
34
- max: d,
35
- step: f,
36
- "aria-invalid": h ? !0 : void 0,
37
- "aria-describedby": h ? `${w}-error` : m ? `${w}-hint` : void 0,
38
- onChange: (e) => l?.(e.target.value),
33
+ min: d,
34
+ max: f,
35
+ step: p,
36
+ "aria-invalid": g ? !0 : void 0,
37
+ "aria-describedby": g ? `${T}-error` : h ? `${T}-hint` : void 0,
38
+ onChange: (e) => (l ?? u)?.(e.target.value),
39
39
  onFocus: (e) => {
40
- C("FOCUS"), y?.(e);
40
+ w("FOCUS"), b?.(e);
41
41
  },
42
42
  onBlur: (e) => {
43
- C("BLUR"), b?.(e);
43
+ w("BLUR"), x?.(e);
44
44
  },
45
- ...x
45
+ ...S
46
46
  }),
47
- h && /* @__PURE__ */ a("span", {
48
- id: `${w}-error`,
47
+ g && /* @__PURE__ */ a("span", {
48
+ id: `${T}-error`,
49
49
  className: e.error,
50
50
  role: "alert",
51
- children: h
51
+ children: g
52
52
  }),
53
- !h && m && /* @__PURE__ */ a("span", {
54
- id: `${w}-hint`,
53
+ !g && h && /* @__PURE__ */ a("span", {
54
+ id: `${T}-hint`,
55
55
  className: e.hint,
56
- children: m
56
+ children: h
57
57
  })
58
58
  ]
59
59
  });