@fldr/ui 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +66 -448
  2. package/ai/component-registry.json +25 -13
  3. package/ai/component-registry.md +2 -2
  4. package/dist/.build-complete +1 -1
  5. package/dist/blocks-source/auth-card/auth-card.test.tsx +20 -14
  6. package/dist/blocks-source/auth-card/auth-card.tsx +73 -55
  7. package/dist/blocks-source/file-table/file-table.tsx +197 -150
  8. package/dist/blocks-source/share-dialog/share-dialog.test.tsx +9 -3
  9. package/dist/blocks-source/share-dialog/share-dialog.tsx +50 -35
  10. package/dist/blocks.d.ts +21 -4
  11. package/dist/blocks.js +246 -195
  12. package/dist/{button-DzavLWXm.d.ts → button-CS82eT0x.d.ts} +1 -1
  13. package/dist/chunks/{checkbox-eifiwbw34xwsikvf.js → checkbox-d5epe4dl78bzy4f8.js} +8 -8
  14. package/dist/chunks/highlighter-kb7huz24pcziin6d.js +57 -0
  15. package/dist/chunks/{layer-dialog-m8qb0wzfg3k7406a.js → layer-dialog-mnaw06pxom8q771w.js} +3 -2
  16. package/dist/chunks/{table-ngl1b5yc8mcur662.js → table-bdye068ekayq3u1n.js} +1 -1
  17. package/dist/chunks/table-f8vl74hdx3bzqqbf.js +448 -0
  18. package/dist/code/server.js +1 -1
  19. package/dist/code.js +4 -131
  20. package/dist/components/banner.d.ts +1 -1
  21. package/dist/components/button.d.ts +2 -2
  22. package/dist/components/checkbox.d.ts +1 -1
  23. package/dist/components/checkbox.js +1 -1
  24. package/dist/components/input-group.d.ts +2 -1
  25. package/dist/components/input.d.ts +2 -2
  26. package/dist/components/layer-dialog.js +1 -1
  27. package/dist/components/link.d.ts +2 -67
  28. package/dist/components/sidebar.d.ts +2 -1
  29. package/dist/components/table.d.ts +1 -1
  30. package/dist/components/table.js +1 -1
  31. package/dist/components/toast.d.ts +1 -1
  32. package/dist/components/toolbar.d.ts +1 -1
  33. package/dist/form.d.ts +207 -0
  34. package/dist/form.js +317 -0
  35. package/dist/hotkeys.d.ts +135 -0
  36. package/dist/hotkeys.js +206 -0
  37. package/dist/index-9LwQy84o.d.ts +1 -0
  38. package/dist/index-B7iG0qDU.d.ts +1 -0
  39. package/dist/{index-B6JNUfG9.d.ts → index-BMXHK-3k.d.ts} +2 -2
  40. package/dist/{index-B6Wo_iiN.d.ts → index-B_ug9XY7.d.ts} +1 -1
  41. package/dist/{index-RP_rt8vB.d.ts → index-Bh9kuAvN.d.ts} +1 -1
  42. package/dist/{index-DjSGDESy.d.ts → index-CAUjUp2G.d.ts} +1 -1
  43. package/dist/{index-NnHba-T1.d.ts → index-DK28YxxP.d.ts} +2 -2
  44. package/dist/{index-aahL-0Zw.d.ts → index-DOVlARA6.d.ts} +2 -2
  45. package/dist/index-DTj6M6kA.d.ts +1 -0
  46. package/dist/index.d.ts +14 -12
  47. package/dist/index.js +3 -4
  48. package/dist/{input-group-8gEtPiKw.d.ts → input-group-Swzit45o.d.ts} +1 -1
  49. package/dist/link-CoVXE5W2.d.ts +68 -0
  50. package/dist/query.d.ts +156 -0
  51. package/dist/query.js +204 -0
  52. package/dist/router.d.ts +95 -0
  53. package/dist/router.js +146 -0
  54. package/dist/skeleton.d.ts +3 -0
  55. package/dist/skeleton.js +4 -0
  56. package/dist/styles/kumo-binding.css +10 -0
  57. package/dist/styles/kumo-standalone.css +1 -1
  58. package/dist/styles/theme-fldr.css +18 -18
  59. package/dist/table.d.ts +245 -0
  60. package/dist/table.js +3 -0
  61. package/dist/theming.d.ts +4 -4
  62. package/dist/theming.js +2 -2
  63. package/package.json +41 -1
  64. package/dist/chunks/highlighter-mouttug0tu8xg1i8.js +0 -1364
  65. package/dist/index-DL1-uSuH.d.ts +0 -1
  66. /package/dist/{index-BkTAB4wj.d.ts → sidebar-BkTAB4wj.d.ts} +0 -0
@@ -7,7 +7,7 @@ type CheckboxChangeEventDetails = Parameters<NonNullable<Checkbox.Root.Props["on
7
7
  declare const KUMO_CHECKBOX_VARIANTS: {
8
8
  readonly variant: {
9
9
  readonly default: {
10
- readonly classes: "[&:focus-within>span]:ring-kumo-focus [&:hover>span]:ring-kumo-hairline";
10
+ readonly classes: "[&:focus-within>span]:ring-kumo-focus [&:hover>span]:ring-kumo-interact";
11
11
  readonly description: "Default checkbox appearance";
12
12
  };
13
13
  readonly error: {
@@ -1,4 +1,4 @@
1
- import { a as LinkButtonProps, n as ButtonProps, r as KumoButtonVariant } from "./button-DzavLWXm.js";
1
+ import { n as ButtonProps, o as LinkButtonProps, r as KumoButtonVariant } from "./button-CS82eT0x.js";
2
2
  import { HTMLAttributes, ReactNode } from "react";
3
3
  //#region src/components/banner/banner-action.d.ts
4
4
  /**
@@ -130,7 +130,7 @@ interface BannerProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" |
130
130
  * (`variant="primary" | "secondary" | "ghost"`).
131
131
  */
132
132
  declare const Banner: import("react").ForwardRefExoticComponent<BannerProps & import("react").RefAttributes<HTMLDivElement>> & {
133
- Action: import("react").ForwardRefExoticComponent<BannerActionProps & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
133
+ Action: import("react").ForwardRefExoticComponent<BannerActionProps & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
134
134
  };
135
135
  //#endregion
136
136
  export { BannerVariant as n, Banner as t };
@@ -1,6 +1,6 @@
1
- import { a as LinkButtonProps, n as ButtonProps } from "./button-DzavLWXm.js";
1
+ import { n as ButtonProps, o as LinkButtonProps } from "./button-CS82eT0x.js";
2
2
  import { n as InputProps } from "./input-BeWEb-jD.js";
3
- import { t as InputGroup } from "./input-group-8gEtPiKw.js";
3
+ import { t as InputGroup } from "./input-group-Swzit45o.js";
4
4
  import React from "react";
5
5
  import { Toolbar } from "@base-ui/react/toolbar";
6
6
  //#region src/components/toolbar/toolbar.d.ts
@@ -0,0 +1 @@
1
+ import "./sidebar-BkTAB4wj.js";
package/dist/index.d.ts CHANGED
@@ -1,17 +1,18 @@
1
- import { A as SidebarProviderProps, C as SidebarMenuItem, D as SidebarMenuSubButtonProps, E as SidebarMenuSubButton, F as SidebarScrollAlign, G as SidebarVariant, I as SidebarScrollToItemOptions, K as useSidebar, L as SidebarSeparator, M as SidebarResizeHandle, N as SidebarRoot, O as SidebarMenuSubItem, P as SidebarRootProps, R as SidebarSide, S as SidebarMenuChevron, T as SidebarMenuSub, U as SidebarState, V as SidebarSlidingViews, W as SidebarTrigger, _ as SidebarMenu, a as SidebarCollapsible, b as SidebarMenuButtonProps, c as SidebarCollapsibleTrigger, d as SidebarContextValue, f as SidebarFooter, g as SidebarLoading, h as SidebarHeader, i as Sidebar, j as SidebarRail, k as SidebarProvider, m as SidebarGroupLabel, n as KUMO_SIDEBAR_STYLING, o as SidebarCollapsibleContent, p as SidebarGroup, r as KUMO_SIDEBAR_VARIANTS, t as KUMO_SIDEBAR_DEFAULT_VARIANTS, u as SidebarContent, v as SidebarMenuBadge, w as SidebarMenuItemProps, x as SidebarMenuButtonSize, y as SidebarMenuButton, z as SidebarSlidingView } from "./index-BkTAB4wj.js";
1
+ import { A as SidebarProviderProps, C as SidebarMenuItem, D as SidebarMenuSubButtonProps, E as SidebarMenuSubButton, F as SidebarScrollAlign, G as SidebarVariant, I as SidebarScrollToItemOptions, K as useSidebar, L as SidebarSeparator, M as SidebarResizeHandle, N as SidebarRoot, O as SidebarMenuSubItem, P as SidebarRootProps, R as SidebarSide, S as SidebarMenuChevron, T as SidebarMenuSub, U as SidebarState, V as SidebarSlidingViews, W as SidebarTrigger, _ as SidebarMenu, a as SidebarCollapsible, b as SidebarMenuButtonProps, c as SidebarCollapsibleTrigger, d as SidebarContextValue, f as SidebarFooter, g as SidebarLoading, h as SidebarHeader, i as Sidebar, j as SidebarRail, k as SidebarProvider, m as SidebarGroupLabel, n as KUMO_SIDEBAR_STYLING, o as SidebarCollapsibleContent, p as SidebarGroup, r as KUMO_SIDEBAR_VARIANTS, t as KUMO_SIDEBAR_DEFAULT_VARIANTS, u as SidebarContent, v as SidebarMenuBadge, w as SidebarMenuItemProps, x as SidebarMenuButtonSize, y as SidebarMenuButton, z as SidebarSlidingView } from "./sidebar-BkTAB4wj.js";
2
+ import "./index-DTj6M6kA.js";
2
3
  import { i as KUMO_DELETE_RESOURCE_VARIANTS, n as DeleteResourceProps, r as KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS, t as DeleteResource } from "./delete-resource-DY-GFy2s.js";
3
4
  import { n as TabsItem, r as TabsProps, t as Tabs } from "./index-gYC6cQVO.js";
4
5
  import { a as PropSchema, i as ComponentType, n as ComponentSchema, o as SubComponentSchema, r as ComponentStyling, t as ComponentRegistry } from "./types-CBwdSmf-.js";
5
6
  import { a as KUMO_FIELD_VARIANTS, i as KUMO_FIELD_DEFAULT_VARIANTS, n as FieldErrorMatch, o as fieldVariants, r as FieldProps, t as Field } from "./field-DIjlHM8W.js";
6
7
  import { a as KUMO_AUTOCOMPLETE_VARIANTS, i as KUMO_AUTOCOMPLETE_DEFAULT_VARIANTS, n as Autocomplete, o as KumoAutocompleteSize, r as AutocompleteProps, s as autocompleteVariants } from "./index-T1sSoiWG.js";
7
8
  import { n as BadgeVariant, t as Badge } from "./index-Bwhwpw_j.js";
8
- import { a as LinkButtonProps, i as LinkButton, n as ButtonProps, o as RefreshButton, s as buttonVariants, t as Button } from "./button-DzavLWXm.js";
9
- import { n as BannerVariant, t as Banner } from "./index-NnHba-T1.js";
9
+ import { a as LinkButton, c as buttonVariants, n as ButtonProps, o as LinkButtonProps, s as RefreshButton, t as Button } from "./button-CS82eT0x.js";
10
+ import { n as BannerVariant, t as Banner } from "./index-DK28YxxP.js";
10
11
  import { n as BreadcrumbsProps, t as Breadcrumb } from "./index-5PpauI_2.js";
11
12
  import { a as KUMO_BUTTON_GROUP_VARIANTS, i as KUMO_BUTTON_GROUP_STYLING, n as ButtonGroupProps, r as KUMO_BUTTON_GROUP_DEFAULT_VARIANTS, t as ButtonGroup } from "./index-C7RoG_CH.js";
12
- import "./index-DL1-uSuH.js";
13
+ import "./index-9LwQy84o.js";
13
14
  import { C as TimeseriesChart, S as KumoChartOption, _ as SankeyTooltipParams, a as BubbleMap, c as ChoroplethMapProps, d as MapProjection, f as MapStyle, g as SankeyNodeData, h as SankeyLinkData, i as GlobeMapProps, l as MapAccessor, m as SankeyChartProps, n as GlobeMap, o as BubbleMapProps, p as SankeyChart, r as GlobeMapMarker, s as ChoroplethMap, t as ChartPalette, u as MapGeoJson, v as ChartLegend, y as Chart } from "./index-g-eFm1Bq.js";
14
- import { a as CheckboxLegendProps, n as CheckboxChangeEventDetails, o as CheckboxProps, t as Checkbox } from "./index-DjSGDESy.js";
15
+ import { a as CheckboxLegendProps, n as CheckboxChangeEventDetails, o as CheckboxProps, t as Checkbox } from "./index-CAUjUp2G.js";
15
16
  import { t as ClipboardText } from "./index-DHj_enN9.js";
16
17
  import { a as CloudflareLogoSvgVariant, c as KUMO_CLOUDFLARE_LOGO_DEFAULT_VARIANTS, d as PoweredByCloudflareProps, f as generateCloudflareLogoSvg, i as CloudflareLogoSvgColor, l as KUMO_CLOUDFLARE_LOGO_VARIANTS, n as CloudflareLogoColor, o as CloudflareLogoVariant, r as CloudflareLogoProps, s as GenerateCloudflareLogoSvgOptions, t as CloudflareLogo, u as PoweredByCloudflare } from "./index-CYoiniZ4.js";
17
18
  import { n as Code, r as CodeBlock } from "./index-Dsbm8Gcm.js";
@@ -30,16 +31,17 @@ import { a as KUMO_GRID_DEFAULT_VARIANTS, c as KumoGridVariant, i as GridProps,
30
31
  import { r as Text } from "./text-CRRU2g-u.js";
31
32
  import { a as KUMO_INLINE_COPY_TEXT_STYLING, i as KUMO_INLINE_COPY_TEXT_DEFAULT_VARIANTS, n as InlineCopyTextLabels, o as KUMO_INLINE_COPY_TEXT_VARIANTS, r as InlineCopyTextProps, t as InlineCopyText } from "./index-B9-RdY6D.js";
32
33
  import { a as inputVariants, n as InputProps, t as Input } from "./input-BeWEb-jD.js";
33
- import { a as InputGroupSuffixProps, c as InputGroupInputProps, i as InputGroupRootProps, o as InputGroupAddonProps, s as InputGroupButtonProps, t as InputGroup } from "./input-group-8gEtPiKw.js";
34
+ import { a as InputGroupSuffixProps, c as InputGroupInputProps, i as InputGroupRootProps, o as InputGroupAddonProps, s as InputGroupButtonProps, t as InputGroup } from "./input-group-Swzit45o.js";
34
35
  import { n as Tooltip, r as TooltipProvider } from "./tooltip-D_vhi1PN.js";
35
- import "./components/input-group.js";
36
- import { a as Textarea, i as InputAreaProps, r as InputArea } from "./index-B6Wo_iiN.js";
36
+ import "./index-B7iG0qDU.js";
37
+ import { a as Textarea, i as InputAreaProps, r as InputArea } from "./index-B_ug9XY7.js";
37
38
  import { a as labelContentVariants, i as LabelProps, n as KUMO_LABEL_VARIANTS, o as labelVariants, r as Label, t as KUMO_LABEL_DEFAULT_VARIANTS } from "./index-CE09bLNb.js";
38
39
  import { t as LayerCard } from "./layer-card-BNIn9pqy.js";
39
40
  import "./components/layer-card.js";
40
41
  import { a as LayerDialogActionProps, c as LayerDialogContentProps, d as LayerDialogProps, f as LayerDialogRootProps, i as LayerDialog, l as LayerDialogDescriptionProps, n as KumoLayerDialogSize, o as LayerDialogActionsProps, p as LayerDialogTitleProps, r as KumoLayerDialogVerticalAlign, s as LayerDialogBodyProps, t as KumoLayerDialogPrimaryVariant, u as LayerDialogPrimaryProps } from "./index-CNoz2NNg.js";
41
42
  import { n as LinkProvider, r as useLinkComponent, t as LinkComponentProps } from "./link-provider-tz-NJp9x.js";
42
- import { KUMO_LINK_DEFAULT_VARIANTS, KUMO_LINK_VARIANTS, KumoLinkVariant, KumoLinkVariantsProps, Link, LinkProps, linkVariants } from "./components/link.js";
43
+ import { a as Link, i as KumoLinkVariantsProps, n as KUMO_LINK_VARIANTS, o as LinkProps, r as KumoLinkVariant, s as linkVariants, t as KUMO_LINK_DEFAULT_VARIANTS } from "./link-CoVXE5W2.js";
44
+ import "./components/link.js";
43
45
  import { n as Loader, t as SkeletonLine } from "./index-Dx7hOWUc.js";
44
46
  import { n as MenuBar, t as useMenuNavigation } from "./index-B7epkoHc.js";
45
47
  import { t as Meter } from "./index-yK3Hayg_.js";
@@ -52,11 +54,11 @@ import { a as Slider, i as KumoSliderVariantsProps, n as KUMO_SLIDER_VARIANTS, o
52
54
  import { t as Surface } from "./index-CzIWigmH.js";
53
55
  import { a as Switch, c as SwitchLegendProps } from "./index-AMEc1MEg.js";
54
56
  import { a as KUMO_TABLE_OF_CONTENTS_VARIANTS, c as TableOfContentsGroupProps, d as TableOfContentsProps, f as TableOfContentsTitleProps, i as KUMO_TABLE_OF_CONTENTS_DEFAULT_VARIANTS, l as TableOfContentsItemProps, n as UseTableOfContentsActiveIdResult, o as KumoTableOfContentsState, r as useTableOfContentsActiveId, s as TableOfContents, t as UseTableOfContentsActiveIdOptions, u as TableOfContentsListProps } from "./index-DIV3riUd.js";
55
- import { a as Table } from "./index-RP_rt8vB.js";
57
+ import { a as Table } from "./index-Bh9kuAvN.js";
56
58
  import { n as TagInputLabels, r as TagInputProps, t as TagInput } from "./index-2jvVmJ8P.js";
57
59
  import "./components/text.js";
58
- import { a as Toasty, i as ToastProvider, o as createKumoToastManager, s as useKumoToastManager, t as Toast } from "./index-B6JNUfG9.js";
59
- import { a as ToolbarInputGroupProps, c as ToolbarProps, i as ToolbarButtonProps, l as ToolbarSize, n as KUMO_TOOLBAR_VARIANTS, o as ToolbarInputProps, r as Toolbar, s as ToolbarLinkProps, t as KUMO_TOOLBAR_DEFAULT_VARIANTS } from "./index-aahL-0Zw.js";
60
+ import { a as Toasty, i as ToastProvider, o as createKumoToastManager, s as useKumoToastManager, t as Toast } from "./index-BMXHK-3k.js";
61
+ import { a as ToolbarInputGroupProps, c as ToolbarProps, i as ToolbarButtonProps, l as ToolbarSize, n as KUMO_TOOLBAR_VARIANTS, o as ToolbarInputProps, r as Toolbar, s as ToolbarLinkProps, t as KUMO_TOOLBAR_DEFAULT_VARIANTS } from "./index-DOVlARA6.js";
60
62
  import "./components/tooltip.js";
61
63
  import { a as cn, i as KumoTranslationsPartial, n as KumoLocaleProviderProps, o as safeRandomId, r as KumoTranslations, t as KumoLocaleProvider } from "./locale-provider-CHMCQ0-J.js";
62
64
  export { Autocomplete, type AutocompleteProps, Badge, type BadgeVariant, Banner, BannerVariant, Breadcrumb as Breadcrumbs, type BreadcrumbsProps, BubbleMap, type BubbleMapProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, Chart, ChartLegend, ChartPalette, Checkbox, type CheckboxChangeEventDetails, type CheckboxLegendProps, type CheckboxProps, ChoroplethMap, type ChoroplethMapProps, ClipboardText, CloudflareLogo, type CloudflareLogoColor, type CloudflareLogoProps, type CloudflareLogoSvgColor, type CloudflareLogoSvgVariant, type CloudflareLogoVariant, Code, CodeBlock, Collapsible, type CollapsibleDefaultPanelProps, type CollapsibleDefaultTriggerProps, type CollapsiblePanelProps, type CollapsibleProps, type CollapsibleRootProps, type CollapsibleTriggerProps, Combobox, CommandPalette, type CommandPaletteEmptyProps, type CommandPaletteFooterProps, type CommandPaletteGroupLabelProps, type CommandPaletteGroupProps, type CommandPaletteInputProps, type CommandPaletteItemProps, type CommandPaletteListProps, type CommandPaletteLoadingProps, type CommandPaletteResultItemProps, type CommandPaletteRootProps, type ComponentRegistry, type ComponentSchema, type ComponentStyling, type ComponentType, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DayPickerProps, DeleteResource, type DeleteResourceProps, Dialog, DialogClose, type DialogCloseProps, DialogDescription, type DialogDescriptionProps, type DialogProps, DialogRoot, type DialogRootProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, DropdownMenu, Empty, type EmptyProps, Field, type FieldErrorMatch, type FieldProps, Flow, type GenerateCloudflareLogoSvgOptions, GlobeMap, type GlobeMapMarker, type GlobeMapProps, Grid, GridItem, type GridItemProps, type GridProps, type HighlightRange, InlineCopyText, type InlineCopyTextLabels, type InlineCopyTextProps, Input, InputArea, type InputAreaProps, InputGroup, type InputGroupAddonProps, type InputGroupButtonProps, type InputGroupInputProps, type InputGroupRootProps, type InputGroupSuffixProps, type InputProps, KUMO_AUTOCOMPLETE_DEFAULT_VARIANTS, KUMO_AUTOCOMPLETE_VARIANTS, KUMO_BUTTON_GROUP_DEFAULT_VARIANTS, KUMO_BUTTON_GROUP_STYLING, KUMO_BUTTON_GROUP_VARIANTS, KUMO_CLOUDFLARE_LOGO_DEFAULT_VARIANTS, KUMO_CLOUDFLARE_LOGO_VARIANTS, KUMO_COMMAND_PALETTE_DEFAULT_VARIANTS, KUMO_COMMAND_PALETTE_VARIANTS, KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS, KUMO_DELETE_RESOURCE_VARIANTS, KUMO_FIELD_DEFAULT_VARIANTS, KUMO_FIELD_VARIANTS, KUMO_GRID_DEFAULT_VARIANTS, KUMO_GRID_VARIANTS, KUMO_INLINE_COPY_TEXT_DEFAULT_VARIANTS, KUMO_INLINE_COPY_TEXT_STYLING, KUMO_INLINE_COPY_TEXT_VARIANTS, KUMO_LABEL_DEFAULT_VARIANTS, KUMO_LABEL_VARIANTS, KUMO_LINK_DEFAULT_VARIANTS, KUMO_LINK_VARIANTS, KUMO_POPOVER_DEFAULT_VARIANTS, KUMO_POPOVER_VARIANTS, KUMO_RADIO_DEFAULT_VARIANTS, KUMO_RADIO_VARIANTS, KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS, KUMO_SENSITIVE_INPUT_VARIANTS, KUMO_SIDEBAR_DEFAULT_VARIANTS, KUMO_SIDEBAR_STYLING, KUMO_SIDEBAR_VARIANTS, KUMO_SLIDER_DEFAULT_VARIANTS, KUMO_SLIDER_VARIANTS, KUMO_TABLE_OF_CONTENTS_DEFAULT_VARIANTS, KUMO_TABLE_OF_CONTENTS_VARIANTS, KUMO_TOOLBAR_DEFAULT_VARIANTS, KUMO_TOOLBAR_VARIANTS, type KumoAutocompleteSize, type KumoChartOption, type KumoGridGap, type KumoGridVariant, type KumoLayerDialogPrimaryVariant, type KumoLayerDialogSize, type KumoLayerDialogVerticalAlign, type KumoLinkVariant, type KumoLinkVariantsProps, KumoLocaleProvider, type KumoLocaleProviderProps, KumoPortalProvider, type KumoRadioAppearance, type KumoRadioVariant, type KumoRadioVariantsProps, type KumoSliderSize, type KumoSliderVariantsProps, type KumoTableOfContentsState, type KumoTranslations, type KumoTranslationsPartial, Label, type LabelProps, LayerCard, LayerDialog, type LayerDialogActionProps, type LayerDialogActionsProps, type LayerDialogBodyProps, type LayerDialogContentProps, type LayerDialogDescriptionProps, type LayerDialogPrimaryProps, type LayerDialogProps, type LayerDialogRootProps, type LayerDialogTitleProps, Link, LinkButton, type LinkButtonProps, type LinkComponentProps, type LinkProps, LinkProvider, Loader, type MapAccessor, type MapGeoJson, type MapProjection, type MapStyle, MenuBar, Meter, Pagination, Popover, type PopoverCloseProps, type PopoverContentProps, type PopoverDescriptionProps, type PopoverRootProps, type PopoverTitleProps, type PopoverTriggerProps, type PortalContainer, PoweredByCloudflare, type PoweredByCloudflareProps, type PropSchema, Radio, type RadioControlPosition, RadioGroup, type RadioGroupChangeEventDetails, type RadioGroupProps, type RadioItemProps, type RadioLegendProps, type RadioVariant, RefreshButton, SankeyChart, type SankeyChartProps, type SankeyLinkData, type SankeyNodeData, type SankeyTooltipParams, Select, SensitiveInput, type SensitiveInputProps, Sidebar, SidebarCollapsible, type SidebarCollapsible as SidebarCollapsibleType, SidebarCollapsibleContent, SidebarCollapsibleTrigger, SidebarContent, type SidebarContextValue, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarLoading, SidebarMenu, SidebarMenuBadge, SidebarMenuButton, type SidebarMenuButtonProps, type SidebarMenuButtonSize, SidebarMenuChevron, SidebarMenuItem, type SidebarMenuItemProps, SidebarMenuSub, SidebarMenuSubButton, type SidebarMenuSubButtonProps, SidebarMenuSubItem, SidebarProvider, type SidebarProviderProps, SidebarRail, SidebarResizeHandle, SidebarRoot, type SidebarRootProps, type SidebarScrollAlign, type SidebarScrollToItemOptions, SidebarSeparator, type SidebarSide, SidebarSlidingView, SidebarSlidingViews, type SidebarState, SidebarTrigger, type SidebarVariant, SkeletonLine, Slider, type SliderProps, type SubComponentSchema, Surface, Switch, type SwitchLegendProps, Table, TableOfContents, type TableOfContentsGroupProps, type TableOfContentsItemProps, type TableOfContentsListProps, type TableOfContentsProps, type TableOfContentsTitleProps, Tabs, type TabsItem, type TabsProps, TagInput, type TagInputLabels, type TagInputProps, Text, Textarea, TimeseriesChart, Toast, ToastProvider, Toasty, Toolbar, type ToolbarButtonProps, type ToolbarInputGroupProps, type ToolbarInputProps, type ToolbarLinkProps, type ToolbarProps, type ToolbarSize, Tooltip, TooltipProvider, type UseTableOfContentsActiveIdOptions, type UseTableOfContentsActiveIdResult, autocompleteVariants, buttonVariants, cn, createKumoToastManager, fieldVariants, generateCloudflareLogoSvg, gridItemVariants, gridVariants, inputVariants, labelContentVariants, labelVariants, linkVariants, radioVariants, safeRandomId, sliderVariants, useKumoToastManager, useLinkComponent, useMenuNavigation, useSidebar, useTableOfContentsActiveId };
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import { n as BannerVariant, t as Banner } from "./chunks/banner-mo1xl9ww734kgsq
12
12
  import { t as DateRangePicker } from "./chunks/date-range-picker-oivlshld01jbel29.js";
13
13
  import { t as KumoLocaleProvider } from "./chunks/locale-provider-j4ii538ntyok36r6.js";
14
14
  import { a as labelVariants, i as labelContentVariants, n as KUMO_LABEL_VARIANTS, r as Label, t as KUMO_LABEL_DEFAULT_VARIANTS } from "./chunks/label-f18fnpbv85jddo4q.js";
15
- import { t as Checkbox } from "./chunks/checkbox-eifiwbw34xwsikvf.js";
15
+ import { t as Checkbox } from "./chunks/checkbox-d5epe4dl78bzy4f8.js";
16
16
  import { t as index_parts_exports } from "./chunks/index.parts-db9pzsm9rrs9tp0t.js";
17
17
  import { i as fieldVariants, n as KUMO_FIELD_DEFAULT_VARIANTS, r as KUMO_FIELD_VARIANTS, t as Field } from "./chunks/field-fowmq5smvp17pnqe.js";
18
18
  import { r as inputVariants, t as Input } from "./chunks/input-kfi46426y22ocoo4.js";
@@ -28,7 +28,6 @@ import { t as LayerCard } from "./chunks/layer-card-lsmeuqic9i1isv2b.js";
28
28
  import { a as DialogTitle, i as DialogRoot, n as DialogClose, o as DialogTrigger, r as DialogDescription, t as Dialog } from "./chunks/dialog-g7wavhkdv2gplwq9.js";
29
29
  import { t as DropdownMenu } from "./chunks/dropdown-e5zk0ez21busnt0b.js";
30
30
  import { t as Collapsible } from "./chunks/collapsible-ic6813hc4yv5s5hv.js";
31
- import "./components/field.js";
32
31
  import { n as KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS, r as KUMO_DELETE_RESOURCE_VARIANTS, t as DeleteResource } from "./chunks/delete-resource-cmlptb61ih8s84r3.js";
33
32
  import { t as SkeletonLine } from "./chunks/skeleton-line-kmhnp0lx3rxhioxa.js";
34
33
  import { n as useMenuNavigation, t as MenuBar } from "./chunks/menubar-gzlyhmmc4i24prn1.js";
@@ -38,7 +37,7 @@ import { t as Pagination } from "./chunks/pagination-n96r3xdok9nc3pu5.js";
38
37
  import { t as Surface } from "./chunks/surface-jr8x5hy0gucjk5ig.js";
39
38
  import { r as Switch } from "./chunks/switch-nc8thi7ogd51m3gi.js";
40
39
  import { t as Tabs } from "./chunks/tabs-cja62qojznpj99et.js";
41
- import { r as Table } from "./chunks/table-ngl1b5yc8mcur662.js";
40
+ import { r as Table } from "./chunks/table-bdye068ekayq3u1n.js";
42
41
  import { i as useKumoToastManager, n as Toasty, r as createKumoToastManager, t as ToastProvider } from "./chunks/toast-ljpenshot856xqq4.js";
43
42
  import { n as KUMO_POPOVER_VARIANTS, r as Popover, t as KUMO_POPOVER_DEFAULT_VARIANTS } from "./chunks/popover-nqrt3ykqv6sic8pz.js";
44
43
  import { n as KUMO_SENSITIVE_INPUT_VARIANTS, r as SensitiveInput, t as KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS } from "./chunks/sensitive-input-dvwlnntm7rdudwp0.js";
@@ -57,6 +56,6 @@ import { i as TableOfContents, n as KUMO_TABLE_OF_CONTENTS_DEFAULT_VARIANTS, r a
57
56
  import { i as KUMO_BUTTON_GROUP_VARIANTS, n as KUMO_BUTTON_GROUP_DEFAULT_VARIANTS, r as KUMO_BUTTON_GROUP_STYLING, t as ButtonGroup } from "./chunks/button-group-biv43ksvaipc3p5n.js";
58
57
  import "./components/button-group.js";
59
58
  import { t as TagInput } from "./chunks/tag-input-lbx9yzt33d4wu07o.js";
60
- import { t as LayerDialog } from "./chunks/layer-dialog-m8qb0wzfg3k7406a.js";
59
+ import { t as LayerDialog } from "./chunks/layer-dialog-mnaw06pxom8q771w.js";
61
60
  import { i as sliderVariants, n as KUMO_SLIDER_VARIANTS, r as Slider, t as KUMO_SLIDER_DEFAULT_VARIANTS } from "./chunks/slider-e395gihi5cjd62ss.js";
62
61
  export { Autocomplete, Badge, Banner, BannerVariant, Breadcrumb as Breadcrumbs, BubbleMap, Button, ButtonGroup, Chart, ChartLegend, ChartPalette, Checkbox, ChoroplethMap, ClipboardText, CloudflareLogo, Code, CodeBlock, Collapsible, Combobox, CommandPalette, DatePicker, DateRangePicker, DeleteResource, Dialog, DialogClose, DialogDescription, DialogRoot, DialogTitle, DialogTrigger, DropdownMenu, Empty, Field, Flow, GlobeMap, Grid, GridItem, InlineCopyText, Input, InputArea, InputGroup, KUMO_AUTOCOMPLETE_DEFAULT_VARIANTS, KUMO_AUTOCOMPLETE_VARIANTS, KUMO_BUTTON_GROUP_DEFAULT_VARIANTS, KUMO_BUTTON_GROUP_STYLING, KUMO_BUTTON_GROUP_VARIANTS, KUMO_CLOUDFLARE_LOGO_DEFAULT_VARIANTS, KUMO_CLOUDFLARE_LOGO_VARIANTS, KUMO_COMMAND_PALETTE_DEFAULT_VARIANTS, KUMO_COMMAND_PALETTE_VARIANTS, KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS, KUMO_DELETE_RESOURCE_VARIANTS, KUMO_FIELD_DEFAULT_VARIANTS, KUMO_FIELD_VARIANTS, KUMO_GRID_DEFAULT_VARIANTS, KUMO_GRID_VARIANTS, KUMO_INLINE_COPY_TEXT_DEFAULT_VARIANTS, KUMO_INLINE_COPY_TEXT_STYLING, KUMO_INLINE_COPY_TEXT_VARIANTS, KUMO_LABEL_DEFAULT_VARIANTS, KUMO_LABEL_VARIANTS, KUMO_LINK_DEFAULT_VARIANTS, KUMO_LINK_VARIANTS, KUMO_POPOVER_DEFAULT_VARIANTS, KUMO_POPOVER_VARIANTS, KUMO_RADIO_DEFAULT_VARIANTS, KUMO_RADIO_VARIANTS, KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS, KUMO_SENSITIVE_INPUT_VARIANTS, KUMO_SIDEBAR_DEFAULT_VARIANTS, KUMO_SIDEBAR_STYLING, KUMO_SIDEBAR_VARIANTS, KUMO_SLIDER_DEFAULT_VARIANTS, KUMO_SLIDER_VARIANTS, KUMO_TABLE_OF_CONTENTS_DEFAULT_VARIANTS, KUMO_TABLE_OF_CONTENTS_VARIANTS, KUMO_TOOLBAR_DEFAULT_VARIANTS, KUMO_TOOLBAR_VARIANTS, KumoLocaleProvider, KumoPortalProvider, Label, LayerCard, LayerDialog, Link, LinkButton, LinkProvider, Loader, MenuBar, Meter, Pagination, Popover, PoweredByCloudflare, Radio, RadioGroup, RefreshButton, SankeyChart, Select, SensitiveInput, Sidebar, SidebarCollapsible, SidebarCollapsibleContent, SidebarCollapsibleTrigger, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarLoading, SidebarMenu, SidebarMenuBadge, SidebarMenuButton, SidebarMenuChevron, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarResizeHandle, SidebarRoot, SidebarSeparator, SidebarSlidingView, SidebarSlidingViews, SidebarTrigger, SkeletonLine, Slider, Surface, Switch, Table, TableOfContents, Tabs, TagInput, Text, Textarea, TimeseriesChart, index_parts_exports as Toast, ToastProvider, Toasty, Toolbar, Tooltip, TooltipProvider, autocompleteVariants, buttonVariants, cn, createKumoToastManager, fieldVariants, generateCloudflareLogoSvg, gridItemVariants, gridVariants, inputVariants, labelContentVariants, labelVariants, linkVariants, radioVariants, safeRandomId, sliderVariants, useKumoToastManager, useLinkComponent, useMenuNavigation, useSidebar, useTableOfContentsActiveId };
@@ -1,5 +1,5 @@
1
1
  import { r as FieldProps } from "./field-DIjlHM8W.js";
2
- import { n as ButtonProps } from "./button-DzavLWXm.js";
2
+ import { n as ButtonProps } from "./button-CS82eT0x.js";
3
3
  import { n as InputProps, r as KumoInputSize } from "./input-BeWEb-jD.js";
4
4
  import { t as KumoTooltipSide } from "./tooltip-D_vhi1PN.js";
5
5
  import React, { HTMLAttributes, PropsWithChildren, ReactNode } from "react";
@@ -0,0 +1,68 @@
1
+ import { t as LinkComponentProps } from "./link-provider-tz-NJp9x.js";
2
+ import { SVGProps } from "react";
3
+ import { useRender } from "@base-ui/react/use-render";
4
+ //#region src/components/link/link.d.ts
5
+ /** Link variant definitions mapping variant names to their Tailwind classes. */
6
+ declare const KUMO_LINK_VARIANTS: {
7
+ readonly variant: {
8
+ readonly inline: {
9
+ readonly classes: "text-kumo-link underline underline-offset-[0.15em] decoration-[0.0625em] link-current transition-colors";
10
+ readonly description: "Inline text link that flows with content";
11
+ };
12
+ readonly current: {
13
+ readonly classes: "text-current underline underline-offset-[0.15em] decoration-[0.0625em] link-current transition-colors";
14
+ readonly description: "Link that inherits color from parent text";
15
+ };
16
+ readonly plain: {
17
+ readonly classes: "text-kumo-link hover:text-kumo-link/70 transition-colors";
18
+ readonly description: "Link without underline decoration";
19
+ };
20
+ };
21
+ };
22
+ declare const KUMO_LINK_DEFAULT_VARIANTS: {
23
+ readonly variant: "inline";
24
+ };
25
+ type KumoLinkVariant = keyof typeof KUMO_LINK_VARIANTS.variant;
26
+ interface KumoLinkVariantsProps {
27
+ /**
28
+ * Visual style of the link.
29
+ * - `"inline"` — Inline text link that flows with content
30
+ * - `"current"` — Link that inherits color from parent text
31
+ * - `"plain"` — Link without underline decoration
32
+ * @default "inline"
33
+ */
34
+ variant?: KumoLinkVariant;
35
+ }
36
+ declare function linkVariants({ variant }?: KumoLinkVariantsProps): string;
37
+ /**
38
+ * Link component props.
39
+ *
40
+ * Use `href` for the link destination. For framework-specific routing, use the
41
+ * `render` prop or configure a `LinkProvider` at the app root.
42
+ *
43
+ * @example Internal link
44
+ * ```tsx
45
+ * <Link href="/docs">Learn more</Link>
46
+ * ```
47
+ *
48
+ * @example External link
49
+ * ```tsx
50
+ * <Link href="https://cloudflare.com" target="_blank" rel="noopener noreferrer">
51
+ * Visit Cloudflare <Link.ExternalIcon />
52
+ * </Link>
53
+ * ```
54
+ *
55
+ * @example Composition with render prop
56
+ * ```tsx
57
+ * <Link render={<RouterLink to="/dashboard" />}>Dashboard</Link>
58
+ * ```
59
+ */
60
+ type LinkProps = useRender.ComponentProps<"a"> & LinkComponentProps & KumoLinkVariantsProps;
61
+ declare const Link: import("react").ForwardRefExoticComponent<Omit<LinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>> & {
62
+ ExternalIcon: {
63
+ (props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
64
+ displayName: string;
65
+ };
66
+ };
67
+ //#endregion
68
+ export { Link as a, KumoLinkVariantsProps as i, KUMO_LINK_VARIANTS as n, LinkProps as o, KumoLinkVariant as r, linkVariants as s, KUMO_LINK_DEFAULT_VARIANTS as t };
@@ -0,0 +1,156 @@
1
+ import { n as KumoToastManagerAddOptions } from "./index-BMXHK-3k.js";
2
+ import { ReactNode } from "react";
3
+ import { DefaultError, QueryClient, QueryClient as QueryClient$1, QueryClientConfig, QueryClientProvider, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
4
+ //#region src/query/query-state.d.ts
5
+ /**
6
+ * The subset of a query result `QueryState` reads. Any `UseQueryResult`
7
+ * (or `UseSuspenseQueryResult`, `UseInfiniteQueryResult`) satisfies it.
8
+ */
9
+ interface QueryLike<TData, TError = Error> {
10
+ status: "pending" | "error" | "success";
11
+ data: TData | undefined;
12
+ error: TError | null;
13
+ isFetching?: boolean;
14
+ refetch?: () => unknown;
15
+ }
16
+ /** Overridable copy for i18n. */
17
+ interface QueryStateLabels {
18
+ /** Accessible label for the loading skeleton. @default "Loading" */
19
+ loading: string;
20
+ /** Error banner title. @default "Something went wrong" */
21
+ errorTitle: string;
22
+ /** Retry button label. @default "Retry" */
23
+ retry: string;
24
+ /** Default empty state title. @default "Nothing here yet" */
25
+ emptyTitle: string;
26
+ /** Accessible label for the refreshing indicator. @default "Refreshing" */
27
+ refreshing: string;
28
+ }
29
+ interface QueryStateBaseProps<TData, TError> {
30
+ /** Renders the loaded data. `data` is never `undefined` here. */
31
+ children: (data: TData) => ReactNode;
32
+ /**
33
+ * Sample data rendered through `children` and measured by skullet, so the
34
+ * loading skeleton matches the real content.
35
+ */
36
+ sample?: TData;
37
+ /** Remembers the skeleton's shape across visits under this key (skullet `id`). */
38
+ skeletonId?: string;
39
+ /** Loading fallback, replacing the measured skeleton. @default SkeletonBox rows when there's no `sample` or `skeletonId` */
40
+ loading?: ReactNode;
41
+ /** Number of rows in the default SkeletonBox fallback. @default 3 */
42
+ skeletonRows?: number;
43
+ /** Error fallback; a function receives the error and a retry callback. */
44
+ error?: ReactNode | ((error: TError, retry: () => void) => ReactNode);
45
+ /** Treat loaded data as empty. @default empty arrays are empty */
46
+ isEmpty?: (data: TData) => boolean;
47
+ /** Empty fallback. @default `<Empty size="sm" title={labels.emptyTitle} />` */
48
+ empty?: ReactNode;
49
+ /** Show a small Loader above the content while refetching existing data. @default false */
50
+ showRefreshing?: boolean;
51
+ /** Overridable copy for i18n. */
52
+ labels?: Partial<QueryStateLabels>;
53
+ /** Classes for the loading / error / empty wrappers. */
54
+ className?: string;
55
+ }
56
+ /** Props for {@link QueryState}. */
57
+ interface QueryStateProps<TData, TError = Error> extends QueryStateBaseProps<Exclude<TData, undefined>, TError> {
58
+ /** A query result, e.g. the return value of `useQuery`. */
59
+ query: QueryLike<TData, TError>;
60
+ }
61
+ type QueriesData<Q extends readonly QueryLike<unknown, unknown>[]> = { -readonly [K in keyof Q]: Q[K] extends QueryLike<infer D, unknown> ? Exclude<D, undefined> : never; };
62
+ type QueriesError<Q extends readonly QueryLike<unknown, unknown>[]> = Q[number] extends QueryLike<unknown, infer E> ? E : never;
63
+ /** Props for {@link QueryStates}. */
64
+ interface QueryStatesProps<Q extends readonly QueryLike<unknown, unknown>[]> extends QueryStateBaseProps<QueriesData<Q>, QueriesError<Q>> {
65
+ /** Query results; children render once all have succeeded. */
66
+ queries: Q;
67
+ }
68
+ /**
69
+ * Renders the loading, error, empty or success state of a TanStack Query
70
+ * result with fldr UI defaults. Each fallback is overridable.
71
+ *
72
+ * @example
73
+ * ```tsx
74
+ * const files = useQuery({ queryKey: ["files", id], queryFn: fetchFiles });
75
+ *
76
+ * <QueryState query={files} sample={SAMPLE_FILES} empty={<Empty title="No files" />}>
77
+ * {(files) => <FileTable files={files} />}
78
+ * </QueryState>
79
+ * ```
80
+ */
81
+ export declare function QueryState<TData, TError = Error>({ query, ...props }: QueryStateProps<TData, TError>): ReactNode;
82
+ /**
83
+ * Like {@link QueryState} for several queries: shows the first error (Retry
84
+ * refetches every failed query), loading while any is pending, then renders
85
+ * children with a tuple of all data.
86
+ *
87
+ * @example
88
+ * ```tsx
89
+ * <QueryStates queries={[folder, files] as const}>
90
+ * {([folder, files]) => <FolderView folder={folder} files={files} />}
91
+ * </QueryStates>
92
+ * ```
93
+ */
94
+ export declare function QueryStates<const Q extends readonly QueryLike<unknown, unknown>[]>({ queries, ...props }: QueryStatesProps<Q>): ReactNode;
95
+ //#endregion
96
+ //#region src/query/use-toast-mutation.d.ts
97
+ /** A toast title, full toast options, or a function producing either. `false` disables the toast. */
98
+ type MutationToast<TArgs extends unknown[]> = false | string | KumoToastManagerAddOptions<object> | ((...args: TArgs) => string | KumoToastManagerAddOptions<object> | false);
99
+ /** Toast options for {@link useToastMutation}. */
100
+ interface MutationToasts<TData, TError, TVariables> {
101
+ /** Toast shown on success. @default `{ title: "Saved" }` */
102
+ success?: MutationToast<[data: TData, variables: TVariables]>;
103
+ /** Toast shown on error. @default `{ title: "Something went wrong", description: error.message }` */
104
+ error?: MutationToast<[error: TError, variables: TVariables]>;
105
+ }
106
+ /** Options for {@link useToastMutation}: `useMutation` options plus `toasts`. */
107
+ interface UseToastMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> extends UseMutationOptions<TData, TError, TVariables, TOnMutateResult> {
108
+ toasts?: MutationToasts<TData, TError, TVariables>;
109
+ }
110
+ /**
111
+ * `useMutation` that shows a Kumo toast on success and error. Requires a
112
+ * `<Toasty>` ancestor. Your own `onSuccess` / `onError` still run.
113
+ *
114
+ * @example
115
+ * ```tsx
116
+ * const rename = useToastMutation({
117
+ * mutationFn: renameFile,
118
+ * toasts: {
119
+ * success: (file) => `Renamed to ${file.name}`,
120
+ * error: (error) => ({ title: "Rename failed", description: error.message }),
121
+ * },
122
+ * });
123
+ * ```
124
+ */
125
+ export declare function useToastMutation<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>({ toasts, ...options }: UseToastMutationOptions<TData, TError, TVariables, TOnMutateResult>, queryClient?: QueryClient$1): UseMutationResult<TData, TError, TVariables, TOnMutateResult>;
126
+ //#endregion
127
+ //#region src/query/query-client.d.ts
128
+ /** Default options applied by {@link createFldrQueryClient}. */
129
+ export declare const fldrQueryDefaults: {
130
+ queries: {
131
+ staleTime: number;
132
+ retry: number;
133
+ refetchOnWindowFocus: false;
134
+ };
135
+ mutations: {
136
+ retry: number;
137
+ };
138
+ };
139
+ /**
140
+ * Creates a `QueryClient` with fldr defaults (30s `staleTime`, one retry, no
141
+ * refetch on window focus). Your `defaultOptions` are merged over them.
142
+ *
143
+ * @example
144
+ * ```tsx
145
+ * const queryClient = createFldrQueryClient({
146
+ * defaultOptions: { queries: { staleTime: 60_000 } },
147
+ * });
148
+ *
149
+ * <QueryClientProvider client={queryClient}>
150
+ * <App />
151
+ * </QueryClientProvider>
152
+ * ```
153
+ */
154
+ export declare function createFldrQueryClient(config?: QueryClientConfig): QueryClient$1;
155
+ //#endregion
156
+ export { type MutationToast, type MutationToasts, QueryClient, QueryClientProvider, type QueryLike, type QueryStateLabels, type QueryStateProps, type QueryStatesProps, type UseToastMutationOptions };
package/dist/query.js ADDED
@@ -0,0 +1,204 @@
1
+ "use client";
2
+ import { t as Loader } from "./chunks/loader-kv5nk8j8tsuesxqo.js";
3
+ import { t as Banner } from "./chunks/banner-mo1xl9ww734kgsqh.js";
4
+ import { i as useKumoToastManager } from "./chunks/toast-ljpenshot856xqq4.js";
5
+ import { t as Empty } from "./chunks/empty-ijs6kgnd72lv3u94.js";
6
+ import { Skeleton, SkeletonBox } from "./skeleton.js";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { QueryClient, QueryClient as QueryClient$1, QueryClientProvider, useMutation } from "@tanstack/react-query";
9
+ //#region src/query/query-state.tsx
10
+ const DEFAULT_LABELS = {
11
+ loading: "Loading",
12
+ errorTitle: "Something went wrong",
13
+ retry: "Retry",
14
+ emptyTitle: "Nothing here yet",
15
+ refreshing: "Refreshing"
16
+ };
17
+ function errorMessage(error) {
18
+ if (error instanceof Error) return error.message;
19
+ if (typeof error === "string") return error;
20
+ }
21
+ const defaultIsEmpty = (data) => Array.isArray(data) && data.length === 0;
22
+ function renderState(queries, data, props) {
23
+ const labels = {
24
+ ...DEFAULT_LABELS,
25
+ ...props.labels
26
+ };
27
+ const failed = queries.filter((q) => q.status === "error");
28
+ if (failed.length > 0) {
29
+ const retry = () => failed.forEach((q) => q.refetch?.());
30
+ const error = failed[0].error;
31
+ if (typeof props.error === "function") return props.error(error, retry);
32
+ if (props.error !== void 0) return props.error;
33
+ return /* @__PURE__ */ jsx(Banner, {
34
+ variant: "error",
35
+ size: "sm",
36
+ className: props.className,
37
+ title: labels.errorTitle,
38
+ description: errorMessage(error),
39
+ action: /* @__PURE__ */ jsx(Banner.Action, {
40
+ onClick: retry,
41
+ children: labels.retry
42
+ })
43
+ });
44
+ }
45
+ const pending = queries.some((q) => q.status === "pending");
46
+ const value = pending ? null : data();
47
+ if (value !== null && (props.isEmpty ?? defaultIsEmpty)(value)) return props.empty ?? /* @__PURE__ */ jsx(Empty, {
48
+ size: "sm",
49
+ className: props.className,
50
+ title: labels.emptyTitle
51
+ });
52
+ const measured = props.sample !== void 0 || props.skeletonId !== void 0;
53
+ const fallback = props.loading ?? (measured ? void 0 : /* @__PURE__ */ jsx("div", {
54
+ className: "flex flex-col gap-2 py-2",
55
+ children: Array.from({ length: props.skeletonRows ?? 3 }, (_, i) => /* @__PURE__ */ jsx(SkeletonBox, {
56
+ height: "0.75rem",
57
+ width: i % 2 ? "60%" : "100%"
58
+ }, i))
59
+ }));
60
+ const refreshing = props.showRefreshing && !pending && queries.some((q) => q.isFetching === true);
61
+ return /* @__PURE__ */ jsxs(Fragment, { children: [refreshing && /* @__PURE__ */ jsx("div", {
62
+ className: "flex justify-end",
63
+ children: /* @__PURE__ */ jsx(Loader, {
64
+ size: "sm",
65
+ "aria-label": labels.refreshing
66
+ })
67
+ }), /* @__PURE__ */ jsx(Skeleton, {
68
+ data: value,
69
+ sample: props.sample,
70
+ id: props.skeletonId,
71
+ label: labels.loading,
72
+ skeleton: fallback,
73
+ className: pending ? props.className : void 0,
74
+ children: props.children
75
+ })] });
76
+ }
77
+ /**
78
+ * Renders the loading, error, empty or success state of a TanStack Query
79
+ * result with fldr UI defaults. Each fallback is overridable.
80
+ *
81
+ * @example
82
+ * ```tsx
83
+ * const files = useQuery({ queryKey: ["files", id], queryFn: fetchFiles });
84
+ *
85
+ * <QueryState query={files} sample={SAMPLE_FILES} empty={<Empty title="No files" />}>
86
+ * {(files) => <FileTable files={files} />}
87
+ * </QueryState>
88
+ * ```
89
+ */
90
+ function QueryState({ query, ...props }) {
91
+ return renderState([query], () => query.data, props);
92
+ }
93
+ /**
94
+ * Like {@link QueryState} for several queries: shows the first error (Retry
95
+ * refetches every failed query), loading while any is pending, then renders
96
+ * children with a tuple of all data.
97
+ *
98
+ * @example
99
+ * ```tsx
100
+ * <QueryStates queries={[folder, files] as const}>
101
+ * {([folder, files]) => <FolderView folder={folder} files={files} />}
102
+ * </QueryStates>
103
+ * ```
104
+ */
105
+ function QueryStates({ queries, ...props }) {
106
+ return renderState(queries, () => queries.map((q) => q.data), props);
107
+ }
108
+ //#endregion
109
+ //#region src/query/use-toast-mutation.ts
110
+ function resolve(toast, fallback, args) {
111
+ const value = typeof toast === "function" ? toast(...args) : toast;
112
+ if (value === void 0) return fallback;
113
+ if (typeof value === "string") return {
114
+ ...fallback,
115
+ title: value
116
+ };
117
+ return value && {
118
+ variant: fallback.variant,
119
+ ...value
120
+ };
121
+ }
122
+ /**
123
+ * `useMutation` that shows a Kumo toast on success and error. Requires a
124
+ * `<Toasty>` ancestor. Your own `onSuccess` / `onError` still run.
125
+ *
126
+ * @example
127
+ * ```tsx
128
+ * const rename = useToastMutation({
129
+ * mutationFn: renameFile,
130
+ * toasts: {
131
+ * success: (file) => `Renamed to ${file.name}`,
132
+ * error: (error) => ({ title: "Rename failed", description: error.message }),
133
+ * },
134
+ * });
135
+ * ```
136
+ */
137
+ function useToastMutation({ toasts, ...options }, queryClient) {
138
+ const toastManager = useKumoToastManager();
139
+ return useMutation({
140
+ ...options,
141
+ onSuccess: (data, variables, ...rest) => {
142
+ const toast = resolve(toasts?.success, {
143
+ variant: "success",
144
+ title: "Saved"
145
+ }, [data, variables]);
146
+ if (toast) toastManager.add(toast);
147
+ return options.onSuccess?.(data, variables, ...rest);
148
+ },
149
+ onError: (error, variables, ...rest) => {
150
+ const toast = resolve(toasts?.error, {
151
+ variant: "error",
152
+ title: "Something went wrong",
153
+ description: error instanceof Error ? error.message : void 0
154
+ }, [error, variables]);
155
+ if (toast) toastManager.add(toast);
156
+ return options.onError?.(error, variables, ...rest);
157
+ }
158
+ }, queryClient);
159
+ }
160
+ //#endregion
161
+ //#region src/query/query-client.ts
162
+ /** Default options applied by {@link createFldrQueryClient}. */
163
+ const fldrQueryDefaults = {
164
+ queries: {
165
+ staleTime: 3e4,
166
+ retry: 1,
167
+ refetchOnWindowFocus: false
168
+ },
169
+ mutations: { retry: 0 }
170
+ };
171
+ /**
172
+ * Creates a `QueryClient` with fldr defaults (30s `staleTime`, one retry, no
173
+ * refetch on window focus). Your `defaultOptions` are merged over them.
174
+ *
175
+ * @example
176
+ * ```tsx
177
+ * const queryClient = createFldrQueryClient({
178
+ * defaultOptions: { queries: { staleTime: 60_000 } },
179
+ * });
180
+ *
181
+ * <QueryClientProvider client={queryClient}>
182
+ * <App />
183
+ * </QueryClientProvider>
184
+ * ```
185
+ */
186
+ function createFldrQueryClient(config = {}) {
187
+ const { defaultOptions, ...rest } = config;
188
+ return new QueryClient$1({
189
+ ...rest,
190
+ defaultOptions: {
191
+ ...defaultOptions,
192
+ queries: {
193
+ ...fldrQueryDefaults.queries,
194
+ ...defaultOptions?.queries
195
+ },
196
+ mutations: {
197
+ ...fldrQueryDefaults.mutations,
198
+ ...defaultOptions?.mutations
199
+ }
200
+ }
201
+ });
202
+ }
203
+ //#endregion
204
+ export { QueryClient, QueryClientProvider, QueryState, QueryStates, createFldrQueryClient, fldrQueryDefaults, useToastMutation };