@karni/ui 0.0.0-stage → 0.4.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.
Files changed (142) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +928 -2
  3. package/dist/index.cjs +9 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.js +8699 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/manifest.json +102 -0
  8. package/dist/mockServiceWorker.js +361 -0
  9. package/dist/script-BVJ9BbPm.cjs +2 -0
  10. package/dist/script-BVJ9BbPm.cjs.map +1 -0
  11. package/dist/script-D1fn4Dm4.js +6 -0
  12. package/dist/script-D1fn4Dm4.js.map +1 -0
  13. package/dist/src/auth/AuthGuard.d.ts +77 -0
  14. package/dist/src/auth/LoginForm.d.ts +63 -0
  15. package/dist/src/auth/engine.d.ts +101 -0
  16. package/dist/src/auth/provider.d.ts +43 -0
  17. package/dist/src/auth/storage.d.ts +26 -0
  18. package/dist/src/auth/types.d.ts +32 -0
  19. package/dist/src/auth/usePermission.d.ts +7 -0
  20. package/dist/src/components/brand/karni-mark.d.ts +21 -0
  21. package/dist/src/components/brand/mark-paths.d.ts +8 -0
  22. package/dist/src/components/chart/data-chart.d.ts +129 -0
  23. package/dist/src/components/empty-state/empty-state.d.ts +40 -0
  24. package/dist/src/components/file-upload/FileUpload.d.ts +108 -0
  25. package/dist/src/components/layout/layout.d.ts +150 -0
  26. package/dist/src/components/layout/route-focus.d.ts +43 -0
  27. package/dist/src/components/modal/modal.d.ts +86 -0
  28. package/dist/src/components/page/page.d.ts +60 -0
  29. package/dist/src/components/primitives/button.d.ts +45 -0
  30. package/dist/src/components/primitives/checkbox.d.ts +8 -0
  31. package/dist/src/components/primitives/dropdown-menu.d.ts +24 -0
  32. package/dist/src/components/primitives/icons.d.ts +19 -0
  33. package/dist/src/components/primitives/input.d.ts +7 -0
  34. package/dist/src/components/primitives/label.d.ts +8 -0
  35. package/dist/src/components/primitives/select.d.ts +94 -0
  36. package/dist/src/components/primitives/skeleton.d.ts +7 -0
  37. package/dist/src/components/primitives/switch.d.ts +8 -0
  38. package/dist/src/components/primitives/tabs.d.ts +10 -0
  39. package/dist/src/components/primitives/textarea.d.ts +7 -0
  40. package/dist/src/components/resource/ResourceDetail.d.ts +7 -0
  41. package/dist/src/components/resource/ResourceForm.d.ts +8 -0
  42. package/dist/src/components/resource/ResourceSelect.d.ts +9 -0
  43. package/dist/src/components/resource/ResourceTable.d.ts +17 -0
  44. package/dist/src/components/resource/audit-fields.d.ts +17 -0
  45. package/dist/src/components/resource/detail/ResourceDetail.d.ts +128 -0
  46. package/dist/src/components/resource/displayLabel.d.ts +12 -0
  47. package/dist/src/components/resource/empty-value.d.ts +17 -0
  48. package/dist/src/components/resource/form/ResourceForm.d.ts +109 -0
  49. package/dist/src/components/resource/form/field-inputs.d.ts +34 -0
  50. package/dist/src/components/resource/form/fixtures.d.ts +24 -0
  51. package/dist/src/components/resource/form/form-states.d.ts +87 -0
  52. package/dist/src/components/resource/form/prepare.d.ts +54 -0
  53. package/dist/src/components/resource/form/server-errors.d.ts +14 -0
  54. package/dist/src/components/resource/history/ChangeHistory.d.ts +60 -0
  55. package/dist/src/components/resource/import/ResourceImport.d.ts +84 -0
  56. package/dist/src/components/resource/nouns.d.ts +12 -0
  57. package/dist/src/components/resource/query-state.d.ts +20 -0
  58. package/dist/src/components/resource/resource-names.d.ts +23 -0
  59. package/dist/src/components/resource/select/ResourceSelect.d.ts +67 -0
  60. package/dist/src/components/resource/select/select-states.d.ts +68 -0
  61. package/dist/src/components/resource/select/use-debounced-value.d.ts +2 -0
  62. package/dist/src/components/resource/select/use-option-pages.d.ts +37 -0
  63. package/dist/src/components/resource/select/venue-backend.d.ts +144 -0
  64. package/dist/src/components/resource/table/BulkActionsBar.d.ts +77 -0
  65. package/dist/src/components/resource/table/CardList.d.ts +31 -0
  66. package/dist/src/components/resource/table/ConfirmDialog.d.ts +28 -0
  67. package/dist/src/components/resource/table/ExportButtons.d.ts +17 -0
  68. package/dist/src/components/resource/table/FilterBar.d.ts +29 -0
  69. package/dist/src/components/resource/table/PaginationControls.d.ts +31 -0
  70. package/dist/src/components/resource/table/ResourceTable.d.ts +137 -0
  71. package/dist/src/components/resource/table/RowCard.d.ts +31 -0
  72. package/dist/src/components/resource/table/TableView.d.ts +29 -0
  73. package/dist/src/components/resource/table/ViewOptions.d.ts +19 -0
  74. package/dist/src/components/resource/table/access.d.ts +12 -0
  75. package/dist/src/components/resource/table/demo-fixtures.d.ts +25 -0
  76. package/dist/src/components/resource/table/derive-columns.d.ts +33 -0
  77. package/dist/src/components/resource/table/grid-navigation.d.ts +23 -0
  78. package/dist/src/components/resource/table/layout.d.ts +37 -0
  79. package/dist/src/components/resource/table/preferences.d.ts +12 -0
  80. package/dist/src/components/resource/table/slots.d.ts +41 -0
  81. package/dist/src/components/resource/table/states.d.ts +91 -0
  82. package/dist/src/components/resource/table/story-fixtures.d.ts +25 -0
  83. package/dist/src/components/resource/table/structural-columns.d.ts +25 -0
  84. package/dist/src/components/resource/table/table-icons.d.ts +16 -0
  85. package/dist/src/components/resource/table/table-utils.d.ts +48 -0
  86. package/dist/src/components/resource/table/url-state.d.ts +67 -0
  87. package/dist/src/components/resource/table/use-container-width.d.ts +10 -0
  88. package/dist/src/components/resource/table/use-debounced-value.d.ts +1 -0
  89. package/dist/src/components/resource/testapp-fixtures.d.ts +78 -0
  90. package/dist/src/components/stat/stat.d.ts +54 -0
  91. package/dist/src/components/toast/toast-store.d.ts +36 -0
  92. package/dist/src/components/toast/toaster.d.ts +66 -0
  93. package/dist/src/components/toast/use-toast.d.ts +24 -0
  94. package/dist/src/hooks/keys.d.ts +24 -0
  95. package/dist/src/hooks/multipart.d.ts +44 -0
  96. package/dist/src/hooks/params.d.ts +25 -0
  97. package/dist/src/hooks/types.d.ts +41 -0
  98. package/dist/src/hooks/useChangeHistory.d.ts +30 -0
  99. package/dist/src/hooks/useResourceImport.d.ts +107 -0
  100. package/dist/src/hooks/useResourceItem.d.ts +4 -0
  101. package/dist/src/hooks/useResourceList.d.ts +4 -0
  102. package/dist/src/hooks/useResourceMutations.d.ts +13 -0
  103. package/dist/src/hooks/useUnsavedChangesGuard.d.ts +31 -0
  104. package/dist/src/index.d.ts +113 -0
  105. package/dist/src/lib/cn.d.ts +8 -0
  106. package/dist/src/lib/roles.d.ts +45 -0
  107. package/dist/src/lib/variants.d.ts +33 -0
  108. package/dist/src/primitives/registry.d.ts +81 -0
  109. package/dist/src/schema/client.d.ts +90 -0
  110. package/dist/src/schema/parse.d.ts +101 -0
  111. package/dist/src/schema/provider.d.ts +20 -0
  112. package/dist/src/schema/types.d.ts +93 -0
  113. package/dist/src/schema/useSchema.d.ts +21 -0
  114. package/dist/src/schema/zod.d.ts +4 -0
  115. package/dist/src/states/ErrorState.d.ts +43 -0
  116. package/dist/src/states/PendingButton.d.ts +16 -0
  117. package/dist/src/states/describe-error.d.ts +25 -0
  118. package/dist/src/states/hooks.d.ts +10 -0
  119. package/dist/src/theme/script.d.ts +12 -0
  120. package/dist/src/theme/theme.d.ts +45 -0
  121. package/dist/styles.css +248 -0
  122. package/dist/tailwind-preset.cjs +2 -0
  123. package/dist/tailwind-preset.cjs.map +1 -0
  124. package/dist/tailwind-preset.d.ts +140 -0
  125. package/dist/tailwind-preset.js +183 -0
  126. package/dist/tailwind-preset.js.map +1 -0
  127. package/dist/tailwind-v4.css +31 -0
  128. package/dist/vite-plugin.cjs +2 -0
  129. package/dist/vite-plugin.cjs.map +1 -0
  130. package/dist/vite-plugin.d.ts +19 -0
  131. package/dist/vite-plugin.js +16 -0
  132. package/dist/vite-plugin.js.map +1 -0
  133. package/eslint-plugin/index.js +76 -0
  134. package/eslint-plugin/lib/docs.js +11 -0
  135. package/eslint-plugin/lib/glob.js +51 -0
  136. package/eslint-plugin/rules/max-page-lines.js +65 -0
  137. package/eslint-plugin/rules/no-deep-imports.js +61 -0
  138. package/eslint-plugin/rules/no-direct-http.js +128 -0
  139. package/eslint-plugin/rules/no-raw-elements.js +65 -0
  140. package/eslint-plugin/rules/no-style-literals.js +222 -0
  141. package/eslint-plugin/rules.json +32 -0
  142. package/package.json +156 -4
@@ -0,0 +1,150 @@
1
+ import { LayoutRouteFocusOptions } from './route-focus';
2
+ import * as React from "react";
3
+ export type { LayoutRouteFocusOptions } from './route-focus';
4
+ export interface LayoutNavItem {
5
+ /** Visible label of the nav entry. */
6
+ label: React.ReactNode;
7
+ /** Target URL (rendered as a plain <a> by default). */
8
+ href: string;
9
+ /** Optional icon rendered before the label. */
10
+ icon?: React.ReactNode;
11
+ /** Marks the current page (aria-current="page" + active styling). */
12
+ active?: boolean;
13
+ /** React key override when `href` is not unique. */
14
+ key?: string;
15
+ }
16
+ /** What the `NavLink` slot receives: the props of the <a> it replaces, plus the item. */
17
+ export interface LayoutNavLinkProps {
18
+ item: LayoutNavItem;
19
+ href: string;
20
+ /** The styled class, focus indicator and active state included. */
21
+ className: string;
22
+ "aria-current"?: "page";
23
+ /** Closes the mobile drawer. Call it when the link navigates. */
24
+ onClick: () => void;
25
+ /** The icon and the label. */
26
+ children: React.ReactNode;
27
+ }
28
+ /** What the `Sidebar` slot (the static sidebar, md and up) receives. */
29
+ export interface LayoutSidebarProps {
30
+ /** The `sidebarHeader` (the Karni mark by default), or null. */
31
+ header: React.ReactNode;
32
+ /** The derived nav, or the `sidebar` prop. */
33
+ nav: React.ReactNode;
34
+ /** The `sidebarFooter`, or null. */
35
+ footer: React.ReactNode;
36
+ /** `sidebarClassName`. */
37
+ className?: string;
38
+ }
39
+ /** What the `MobileDrawer` slot (the sidebar below md) receives. */
40
+ export interface LayoutMobileDrawerProps extends LayoutSidebarProps {
41
+ open: boolean;
42
+ onOpenChange: (open: boolean) => void;
43
+ /** The id the menu button's aria-controls names while the drawer is open. */
44
+ id: string;
45
+ /** The menu button: where focus returns when the drawer closes. */
46
+ returnFocusRef: React.RefObject<HTMLButtonElement | null>;
47
+ }
48
+ /** What the `Header` slot (the top bar) receives. */
49
+ export interface LayoutHeaderProps {
50
+ /** The button that opens the drawer below md. Render it, or the drawer cannot open. */
51
+ menuButton: React.ReactNode;
52
+ /** The `header` prop's content. */
53
+ children?: React.ReactNode;
54
+ /** `headerClassName`. */
55
+ className?: string;
56
+ }
57
+ /** What the `SkipLink` slot receives: the first focusable element of the page. */
58
+ export interface LayoutSkipLinkProps {
59
+ /** `#` + the id of <main>. */
60
+ href: string;
61
+ /** Moves focus to <main> without changing the URL (hash routers keep their route). */
62
+ onClick: (event: React.MouseEvent<HTMLAnchorElement>) => void;
63
+ children: React.ReactNode;
64
+ }
65
+ /** The parts of the shell a project can replace (`slots={{ NavLink: RouterLink }}`). */
66
+ export interface LayoutSlots {
67
+ /** The top bar with the menu button and the `header` content. */
68
+ Header: React.ComponentType<LayoutHeaderProps>;
69
+ /** The static sidebar (md and up). The default hides itself below md. */
70
+ Sidebar: React.ComponentType<LayoutSidebarProps>;
71
+ /** Each derived nav link. Replace it with your router's link. */
72
+ NavLink: React.ComponentType<LayoutNavLinkProps>;
73
+ /** The sidebar below md: a modal drawer (focus trapped, Escape closes). */
74
+ MobileDrawer: React.ComponentType<LayoutMobileDrawerProps>;
75
+ /** "Skip to content", visible only while focused. `() => null` removes it. */
76
+ SkipLink: React.ComponentType<LayoutSkipLinkProps>;
77
+ }
78
+ export interface LayoutProps extends React.HTMLAttributes<HTMLDivElement> {
79
+ /** Items of the derived sidebar nav. */
80
+ navItems?: readonly LayoutNavItem[];
81
+ /**
82
+ * Wraps or replaces the default link of one item. `defaultNode` is the
83
+ * link the layout would render. Return it, or your own node (e.g. a
84
+ * TanStack Router <Link> with `className={defaultClassName}`).
85
+ * Prefer the `NavLink` slot, which also closes the mobile drawer.
86
+ */
87
+ renderNavItem?: (item: LayoutNavItem, defaults: {
88
+ defaultNode: React.ReactNode;
89
+ defaultClassName: string;
90
+ }) => React.ReactNode;
91
+ /** Escape hatch: replaces the entire derived nav inside the sidebar. */
92
+ sidebar?: React.ReactNode;
93
+ /**
94
+ * Brand/logo slot pinned to the top of the sidebar. Defaults to the Karni
95
+ * mark (`<KarniMark />`). Pass your own brand, or `null` for no header.
96
+ */
97
+ sidebarHeader?: React.ReactNode;
98
+ /** Slot pinned to the bottom of the sidebar (user menu, logout, …). */
99
+ sidebarFooter?: React.ReactNode;
100
+ /** Header slot, rendered in the top bar next to the mobile menu button. */
101
+ header?: React.ReactNode;
102
+ /** Accessible name of the sidebar navigation (default "Main"). */
103
+ navLabel?: string;
104
+ /** Controlled open state of the mobile drawer (pair with onMobileNavOpenChange). */
105
+ mobileNavOpen?: boolean;
106
+ /** Initial open state of the mobile drawer when uncontrolled. */
107
+ defaultMobileNavOpen?: boolean;
108
+ /** Called when the drawer opens or closes (menu button, Escape, backdrop, a link). */
109
+ onMobileNavOpenChange?: (open: boolean) => void;
110
+ /** Replaces internal pieces of the shell. See LayoutSlots. */
111
+ slots?: Partial<LayoutSlots>;
112
+ /**
113
+ * Focus after a client-side navigation. Default `true`: once the new page
114
+ * is in, focus moves to its `<h1>` (else `<main>`) and a polite live region
115
+ * says the page title. Nothing moves on the first load (a redirect before
116
+ * the user acts included), when only search params change (filters,
117
+ * pagination, sorting), or when something took focus for the page itself
118
+ * (an autofocused field, a control inside `<main>`, a dialog). `false`
119
+ * turns it off. An object keeps it on and sets the route key, the target
120
+ * or the announcement (see LayoutRouteFocusOptions).
121
+ */
122
+ routeFocus?: boolean | LayoutRouteFocusOptions;
123
+ sidebarClassName?: string;
124
+ headerClassName?: string;
125
+ contentClassName?: string;
126
+ children?: React.ReactNode;
127
+ }
128
+ /** The default pieces of the shell, which you spread to wrap one (`{ ...defaultLayoutSlots }`). */
129
+ export declare const defaultLayoutSlots: LayoutSlots;
130
+ /**
131
+ * App shell: sidebar navigation + header slot + content area.
132
+ *
133
+ * Responsive: under the `md` breakpoint the sidebar collapses behind a menu
134
+ * button and opens as a modal drawer: focus moves into it and stays there,
135
+ * Escape, the backdrop, the close button or a link close it, and focus
136
+ * returns to the menu button. A "Skip to content" link is the first stop of
137
+ * the keyboard.
138
+ *
139
+ * After a client-side navigation, focus moves to the new page's `<h1>` and
140
+ * a live region says its title (`routeFocus`). Render the Layout once,
141
+ * around your router's outlet, so it sees the route change.
142
+ *
143
+ * Escape hatches: `slots` replaces the Header, Sidebar, NavLink,
144
+ * MobileDrawer or SkipLink. `renderNavItem` wraps each derived link.
145
+ * `sidebar` replaces the derived nav wholesale. `sidebarHeader`,
146
+ * `sidebarFooter` and `header` are free slots. `mobileNavOpen` controls
147
+ * the drawer. `routeFocus={false}` turns the focus move off, and an object
148
+ * sets its route key, target or announcement.
149
+ */
150
+ export declare const Layout: React.ForwardRefExoticComponent<LayoutProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Layout's focus management after a client-side navigation, the way
3
+ * accessible SPA routers do it: once the new page is in, focus moves to its
4
+ * main heading (else <main>) and a polite live region says its title.
5
+ *
6
+ * It needs no router. The route is the URL's path (a hash route such as
7
+ * `#/events` included, search params left out), or the `routeKey` option. A
8
+ * change is noticed when the Layout renders and when anything in <main>
9
+ * changes, so a router that re-renders only its outlet is covered too.
10
+ * Internal to @karni/ui. Layout's `routeFocus` prop is the public surface.
11
+ */
12
+ import * as React from "react";
13
+ /** What Layout's `routeFocus` prop takes when it is an object. */
14
+ export interface LayoutRouteFocusOptions {
15
+ /**
16
+ * The current route: focus moves when it changes. Default: the URL's path
17
+ * (`location.pathname`, plus a hash route such as `#/events`), so a change
18
+ * of search params only (filters, pagination, sorting) never moves focus.
19
+ * Pass your router's pathname or route id when the URL does not say which
20
+ * page is showing (a memory router).
21
+ */
22
+ routeKey?: string;
23
+ /**
24
+ * The element that takes focus after a navigation. Default: the first
25
+ * `<h1>` in `<main>`, else `<main>` itself. An element that cannot take
26
+ * focus gets `tabindex="-1"`.
27
+ */
28
+ getTarget?: (main: HTMLElement) => HTMLElement | null;
29
+ /**
30
+ * What the live region says after a navigation. Default: the document
31
+ * title when the new page changed it, else the heading's text. Return ""
32
+ * to say nothing.
33
+ */
34
+ getAnnouncement?: (target: HTMLElement) => string;
35
+ }
36
+ export interface RouteFocusOptions extends LayoutRouteFocusOptions {
37
+ enabled: boolean;
38
+ }
39
+ /**
40
+ * Watches the route and, after a navigation, moves focus into the new page.
41
+ * Returns the live region's text.
42
+ */
43
+ export declare function useRouteFocus(mainRef: React.RefObject<HTMLElement | null>, options: RouteFocusOptions): string;
@@ -0,0 +1,86 @@
1
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
2
+ import * as React from "react";
3
+ /**
4
+ * Escape hatch for footer buttons: any element wrapped in
5
+ * `<ModalClose asChild>` closes the modal on click (re-exported Radix
6
+ * Dialog.Close).
7
+ */
8
+ export declare const ModalClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
9
+ /**
10
+ * The modal's title: names the dialog (aria-labelledby). A custom `Header`
11
+ * slot renders it so the dialog stays labelled.
12
+ */
13
+ export declare const ModalTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
14
+ /** The modal's description: describes the dialog (aria-describedby). */
15
+ export declare const ModalDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
16
+ /** What the `Header` slot receives. Render ModalTitle (and ModalDescription) inside it. */
17
+ export interface ModalHeaderProps {
18
+ title: React.ReactNode;
19
+ /** The `description` prop, or undefined. */
20
+ description?: React.ReactNode;
21
+ }
22
+ /** What the `Footer` slot receives: the `footer` prop. */
23
+ export interface ModalFooterProps {
24
+ children: React.ReactNode;
25
+ }
26
+ /** What the `CloseButton` slot receives. Wrap your button in <ModalClose asChild>. */
27
+ export interface ModalCloseButtonProps {
28
+ /** Its accessible name ("Close"). */
29
+ label: string;
30
+ }
31
+ /** The parts of the dialog a project can replace (`slots={{ Footer: StickyFooter }}`). */
32
+ export interface ModalSlots {
33
+ /** Title and description. It must render ModalTitle. */
34
+ Header: React.ComponentType<ModalHeaderProps>;
35
+ /** The actions row. */
36
+ Footer: React.ComponentType<ModalFooterProps>;
37
+ /** The top-right close button. It must close through ModalClose. */
38
+ CloseButton: React.ComponentType<ModalCloseButtonProps>;
39
+ }
40
+ /** The default pieces of the dialog, for wrapping one. */
41
+ export declare const defaultModalSlots: ModalSlots;
42
+ export interface ModalProps {
43
+ /** Dialog title, always rendered (Radix requires it for accessibility). */
44
+ title: React.ReactNode;
45
+ /** Optional description under the title, linked via aria-describedby. */
46
+ description?: React.ReactNode;
47
+ /** Body content. */
48
+ children?: React.ReactNode;
49
+ /** Footer slot (actions row). Use <ModalClose asChild> for cancel buttons. */
50
+ footer?: React.ReactNode;
51
+ /**
52
+ * Uncontrolled usage: a node (usually a Button) that opens the modal,
53
+ * rendered through Radix `asChild`.
54
+ */
55
+ trigger?: React.ReactNode;
56
+ /** Controlled open state (pair with onOpenChange). */
57
+ open?: boolean;
58
+ /** Initial state for uncontrolled usage. */
59
+ defaultOpen?: boolean;
60
+ onOpenChange?: (open: boolean) => void;
61
+ /** Hides the top-right X button. */
62
+ hideCloseButton?: boolean;
63
+ /** Replaces the Header, Footer or CloseButton. See ModalSlots. */
64
+ slots?: Partial<ModalSlots>;
65
+ /** Extra classes for the content panel. */
66
+ className?: string;
67
+ /**
68
+ * Escape hatch: props spread onto Radix Dialog.Content
69
+ * (onEscapeKeyDown, onInteractOutside, …).
70
+ */
71
+ contentProps?: Omit<React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, "children" | "className">;
72
+ }
73
+ /**
74
+ * Themed Radix Dialog. Works controlled (`open` + `onOpenChange`) or
75
+ * uncontrolled via the `trigger` slot, and `footer` is the actions row.
76
+ *
77
+ * Keyboard and screen readers: the dialog is named by its title and
78
+ * described by its description. Focus moves into it on open, Tab stays
79
+ * inside, Escape closes, and focus returns to what opened it.
80
+ *
81
+ * Escape hatches: `slots` replaces the Header, Footer or CloseButton,
82
+ * `contentProps` reaches the Radix content part, `className` restyles the
83
+ * panel, `hideCloseButton` drops the X, and `ModalClose` lets any footer
84
+ * element close the dialog.
85
+ */
86
+ export declare function Modal({ title, description, children, footer, trigger, open, defaultOpen, onOpenChange, hideCloseButton, slots, className, contentProps, }: ModalProps): React.ReactElement;
@@ -0,0 +1,60 @@
1
+ import * as React from "react";
2
+ /** What the `Header` slot receives: the title row's pieces, already rendered by their slots. */
3
+ export interface PageHeaderProps {
4
+ /** The Title slot holding `title`. */
5
+ title: React.ReactNode;
6
+ /** The Description slot holding `description`, or null. */
7
+ description: React.ReactNode;
8
+ /** The Actions slot holding `actions`, or null. */
9
+ actions: React.ReactNode;
10
+ /** `headerClassName`. */
11
+ className?: string;
12
+ }
13
+ /** What the `Title`, `Description` and `Actions` slots receive. */
14
+ export interface PageSlotContentProps {
15
+ children: React.ReactNode;
16
+ }
17
+ /** The parts of the page chrome a project can replace (`slots={{ Title: MyHeading }}`). */
18
+ export interface PageSlots {
19
+ /** The row holding the title, description and actions. */
20
+ Header: React.ComponentType<PageHeaderProps>;
21
+ /** The page heading. The default is the page's <h1>. */
22
+ Title: React.ComponentType<PageSlotContentProps>;
23
+ /** The line under the title. */
24
+ Description: React.ComponentType<PageSlotContentProps>;
25
+ /** The container of the actions, right of the title. */
26
+ Actions: React.ComponentType<PageSlotContentProps>;
27
+ }
28
+ export interface PageProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
29
+ /** Page heading, rendered as an <h1>. */
30
+ title: React.ReactNode;
31
+ /** Optional sub-heading under the title. */
32
+ description?: React.ReactNode;
33
+ /** Slot rendered to the right of the title (buttons, menus, …). */
34
+ actions?: React.ReactNode;
35
+ /**
36
+ * Replaces the entire derived header (title/description/actions are
37
+ * ignored when given). Prefer the `Header` slot, which still receives them.
38
+ */
39
+ header?: React.ReactNode;
40
+ /** Replaces pieces of the chrome. See PageSlots. */
41
+ slots?: Partial<PageSlots>;
42
+ /** Extra classes for the derived header row. */
43
+ headerClassName?: string;
44
+ /** Extra classes for the content area under the header. */
45
+ contentClassName?: string;
46
+ children?: React.ReactNode;
47
+ }
48
+ /** The default pieces of the page chrome, for wrapping one. */
49
+ export declare const defaultPageSlots: PageSlots;
50
+ /**
51
+ * Standard page chrome: an `<h1>` title row with an actions slot, then the
52
+ * content. The target usage `<Page title="Events"><ResourceTable … /></Page>`
53
+ * is a complete screen.
54
+ *
55
+ * Escape hatches: `slots` replaces the Header, Title, Description or
56
+ * Actions. `header` replaces the whole derived header. `className`,
57
+ * `headerClassName` and `contentClassName` merge through cn(). Every other
58
+ * prop passes through to the root <section>.
59
+ */
60
+ export declare const Page: React.ForwardRefExoticComponent<PageProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,45 @@
1
+ import { VariantProps } from '../../lib/variants';
2
+ import * as React from "react";
3
+ /**
4
+ * Exported for composition (escape hatch): render any element as a button
5
+ * lookalike with `className={buttonVariants({ variant: "outline" })}`.
6
+ */
7
+ export declare const buttonVariants: import('../..').VariantFn<{
8
+ variant: {
9
+ default: string;
10
+ destructive: string;
11
+ outline: string;
12
+ secondary: string;
13
+ ghost: string;
14
+ link: string;
15
+ };
16
+ size: {
17
+ default: string;
18
+ sm: string;
19
+ lg: string;
20
+ icon: string;
21
+ };
22
+ }>;
23
+ export type ButtonVariantProps = VariantProps<typeof buttonVariants>;
24
+ export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & ButtonVariantProps;
25
+ /**
26
+ * Themed button. `type` defaults to "button" (pass type="submit" in forms).
27
+ * `className` is merged via cn(), so consumer classes win.
28
+ * A project replaces it with its own through `primitives={{ button: ... }}` on KarniProvider.
29
+ */
30
+ export declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & import('../..').VariantSelection<{
31
+ variant: {
32
+ default: string;
33
+ destructive: string;
34
+ outline: string;
35
+ secondary: string;
36
+ ghost: string;
37
+ link: string;
38
+ };
39
+ size: {
40
+ default: string;
41
+ sm: string;
42
+ lg: string;
43
+ icon: string;
44
+ };
45
+ }> & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,8 @@
1
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
2
+ import * as React from "react";
3
+ export type CheckboxProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>;
4
+ /** Themed checkbox (Radix Checkbox) with a check mark indicator.
5
+ *
6
+ * A project replaces it with its own through `primitives={{ checkbox: ... }}` on KarniProvider.
7
+ */
8
+ export declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,24 @@
1
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
2
+ import * as React from "react";
3
+ /** Dropdown menu root (Radix DropdownMenu). */
4
+ export declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
5
+ /** The element that opens the menu. */
6
+ export declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
7
+ /** Groups related menu items. */
8
+ export declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
9
+ /** Renders the menu into `document.body`. */
10
+ export declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
11
+ /** The styled menu panel. */
12
+ export declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
13
+ /** One menu item, whose `onSelect` runs the action. */
14
+ export declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
15
+ inset?: boolean;
16
+ } & React.RefAttributes<HTMLDivElement>>;
17
+ /** A menu item with a check mark that toggles `checked`. */
18
+ export declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
19
+ /** A non-interactive heading inside the menu. */
20
+ export declare const DropdownMenuLabel: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
21
+ inset?: boolean;
22
+ } & React.RefAttributes<HTMLDivElement>>;
23
+ /** A divider line between menu items. */
24
+ export declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ /**
3
+ * Minimal inline SVG icons used by the primitives (no icon dependency).
4
+ * All strokes use `currentColor`, so they follow the text color tokens.
5
+ * Internal to @karni/ui, not part of the public barrel.
6
+ */
7
+ type IconProps = React.SVGAttributes<SVGSVGElement>;
8
+ export declare function CheckIcon(props: IconProps): React.ReactElement;
9
+ export declare function ChevronDownIcon(props: IconProps): React.ReactElement;
10
+ export declare function ChevronUpIcon(props: IconProps): React.ReactElement;
11
+ export declare function AlertIcon(props: IconProps): React.ReactElement;
12
+ export declare function LockIcon(props: IconProps): React.ReactElement;
13
+ export declare function OfflineIcon(props: IconProps): React.ReactElement;
14
+ export declare function SearchIcon(props: IconProps): React.ReactElement;
15
+ export declare function SpinnerIcon(props: IconProps): React.ReactElement;
16
+ export declare function SunIcon(props: IconProps): React.ReactElement;
17
+ export declare function MoonIcon(props: IconProps): React.ReactElement;
18
+ export declare function MonitorIcon(props: IconProps): React.ReactElement;
19
+ export {};
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
3
+ /** Themed text input that passes every native `<input>` prop through.
4
+ *
5
+ * A project replaces it with its own through `primitives={{ input: ... }}` on KarniProvider.
6
+ */
7
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,8 @@
1
+ import * as LabelPrimitive from "@radix-ui/react-label";
2
+ import * as React from "react";
3
+ export type LabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>;
4
+ /** Themed form label (Radix Label) that dims when its field is disabled.
5
+ *
6
+ * A project replaces it with its own through `primitives={{ label: ... }}` on KarniProvider.
7
+ */
8
+ export declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
@@ -0,0 +1,94 @@
1
+ import * as SelectPrimitive from "@radix-ui/react-select";
2
+ import * as React from "react";
3
+ /**
4
+ * The value that stands for "nothing selected" inside Radix Select, which reserves the empty string.
5
+ *
6
+ * This package maps the empty state through this sentinel at the component boundary (contract D8). Consumers of
7
+ * the composed <Select> never see it: `value`/`onValueChange` use `null`.
8
+ */
9
+ export declare const KARNI_SELECT_EMPTY = "__karni_empty__";
10
+ /** Radix Select root, for composing a custom select from the styled parts. */
11
+ export declare const SelectRoot: React.FC<SelectPrimitive.SelectProps>;
12
+ /** Groups related options inside `SelectContent`. */
13
+ export declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
14
+ /** Shows the selected option's label inside `SelectTrigger`. */
15
+ export declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
16
+ /** The styled button that opens the select.
17
+ *
18
+ * Part of the `select` family a project can replace (`primitives={{ select: ... }}` on KarniProvider).
19
+ */
20
+ export declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
21
+ /** The styled dropdown panel that lists the options.
22
+ *
23
+ * Part of the `select` family a project can replace (`primitives={{ select: ... }}` on KarniProvider).
24
+ */
25
+ export declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
26
+ /** A heading inside a `SelectGroup`.
27
+ *
28
+ * Part of the `select` family a project can replace (`primitives={{ select: ... }}` on KarniProvider).
29
+ */
30
+ export declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
31
+ /** One selectable option, whose `value` is what the select reports.
32
+ *
33
+ * Part of the `select` family a project can replace (`primitives={{ select: ... }}` on KarniProvider).
34
+ */
35
+ export declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
36
+ /** A divider line between option groups.
37
+ *
38
+ * Part of the `select` family a project can replace (`primitives={{ select: ... }}` on KarniProvider).
39
+ */
40
+ export declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
41
+ export interface SelectOption {
42
+ /** Must be non-empty and not the reserved sentinel. */
43
+ value: string;
44
+ label: React.ReactNode;
45
+ disabled?: boolean;
46
+ }
47
+ export interface SelectProps {
48
+ /** `null`/`""`/`undefined` all mean "no selection". */
49
+ value: string | null | undefined;
50
+ /** Receives `null` when the clear item is chosen, else the option value. */
51
+ onValueChange?: (value: string | null) => void;
52
+ options: readonly SelectOption[];
53
+ placeholder?: React.ReactNode;
54
+ /**
55
+ * Renders a clear item at the top of the list (contract D8): pass it for
56
+ * nullable fields (labelled with `EmptyValue` by default, a dash read as
57
+ * "empty") and filter contexts (e.g. "All").
58
+ * Choosing it emits `null`.
59
+ */
60
+ clearable?: boolean;
61
+ clearLabel?: React.ReactNode;
62
+ disabled?: boolean;
63
+ /** Forwarded to the hidden native select for HTML form submission. */
64
+ name?: string;
65
+ id?: string;
66
+ /** Merged onto the trigger. */
67
+ className?: string;
68
+ contentClassName?: string;
69
+ "aria-label"?: string;
70
+ /** Forwarded to the trigger, like the other `aria-*` props below. */
71
+ "aria-labelledby"?: string;
72
+ /** Ids of the help text and error message that describe the field. */
73
+ "aria-describedby"?: string;
74
+ /** Marks the field invalid: the trigger reads it and draws its destructive border. */
75
+ "aria-invalid"?: React.AriaAttributes["aria-invalid"];
76
+ "aria-required"?: boolean | "true" | "false";
77
+ /**
78
+ * Called when focus leaves the select, never when it moves into the open
79
+ * list, so react-hook-form's onBlur validation does not run while the user
80
+ * is still choosing.
81
+ */
82
+ onBlur?: React.FocusEventHandler<HTMLButtonElement>;
83
+ /** Called when the list opens or closes. */
84
+ onOpenChange?: (open: boolean) => void;
85
+ /** Extra <SelectItem>/<SelectGroup> nodes appended after `options` (escape hatch). */
86
+ children?: React.ReactNode;
87
+ }
88
+ /**
89
+ * Styled select for a list of `options`, with `null` for no selection. Maps the
90
+ * empty state through the KARNI_SELECT_EMPTY sentinel so `""` never reaches
91
+ * Radix (D8). For fully custom composition use SelectRoot/SelectTrigger/
92
+ * SelectContent/SelectItem directly.
93
+ */
94
+ export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ export type SkeletonProps = React.HTMLAttributes<HTMLDivElement>;
3
+ /** Loading placeholder block that you size with width/height utility classes.
4
+ *
5
+ * A project replaces it with its own through `primitives={{ skeleton: ... }}` on KarniProvider.
6
+ */
7
+ export declare const Skeleton: React.ForwardRefExoticComponent<SkeletonProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ import * as SwitchPrimitive from "@radix-ui/react-switch";
2
+ import * as React from "react";
3
+ export type SwitchProps = React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>;
4
+ /** Themed on/off toggle (Radix Switch).
5
+ *
6
+ * A project replaces it with its own through `primitives={{ switch: ... }}` on KarniProvider.
7
+ */
8
+ export declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitive.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,10 @@
1
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
2
+ import * as React from "react";
3
+ /** Tab set root (Radix Tabs) that holds the selected value. */
4
+ export declare const Tabs: React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>>;
5
+ /** The row of tab buttons. */
6
+ export declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ /** One tab button, whose `value` names the panel it opens. */
8
+ export declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
9
+ /** The panel shown while its `value` is the selected tab. */
10
+ export declare const TabsContent: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
3
+ /** Themed multi-line text input that passes every native `<textarea>` prop through.
4
+ *
5
+ * A project replaces it with its own through `primitives={{ textarea: ... }}` on KarniProvider.
6
+ */
7
+ export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Barrel-facing path for <ResourceDetail>. The implementation lives in
3
+ * ./detail/ (resource form builder). Every contract-pinned export name is
4
+ * re-exported here so src/index.ts keeps resolving this module.
5
+ */
6
+ export { ResourceDetail, defaultResourceDetailSlots } from './detail/ResourceDetail';
7
+ export type { ResourceDetailProps, ResourceDetailFieldOverride, ResourceDetailSlots, ResourceDetailLoadingProps, ResourceDetailErrorProps, ResourceDetailNotFoundProps, ResourceDetailDeletedProps, ResourceDetailEmptyValueProps, ResourceDetailDeleteDialogProps, } from './detail/ResourceDetail';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Barrel-facing path for <ResourceForm>. The implementation lives in
3
+ * ./form/ (resource form builder). Every contract-pinned export name is
4
+ * re-exported here so src/index.ts keeps resolving this module.
5
+ */
6
+ export { ResourceForm, defaultResourceFormSlots } from './form/ResourceForm';
7
+ export type { ResourceFormProps, ResourceFormSlots, FieldOverride, KarniFieldProps, } from './form/ResourceForm';
8
+ export type { ResourceFormErrorSummaryProps, ResourceFormFieldError, ResourceFormForbiddenProps, ResourceFormLoadingProps, ResourceFormSubmitErrorProps, } from './form/form-states';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Barrel-facing path for <ResourceSelect>. The implementation lives in
3
+ * ./select/ (resource form builder). Every contract-pinned export name is
4
+ * re-exported here so src/index.ts keeps resolving this module.
5
+ */
6
+ export { ResourceSelect } from './select/ResourceSelect';
7
+ export type { ResourceSelectProps } from './select/ResourceSelect';
8
+ export { defaultResourceSelectSlots } from './select/select-states';
9
+ export type { ResourceSelectChipProps, ResourceSelectEmptyProps, ResourceSelectLoadingProps, ResourceSelectOptionProps, ResourceSelectSlots, } from './select/select-states';
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Public entry for ResourceTable (owner: resource table builder).
3
+ *
4
+ * The implementation lives in ./table/ (ResourceTable + filter bar +
5
+ * pagination controls + bulk select, contract "ResourceTable" + D5). This
6
+ * module keeps the barrel's import path and exported names stable.
7
+ */
8
+ export { ResourceTable } from './table/ResourceTable';
9
+ export type { BulkResult, ResourceTableDensity, ResourceTableKeyboardNavigation, ResourceTableProps, } from './table/ResourceTable';
10
+ export type { ResourceColumn } from './table/derive-columns';
11
+ export type { BulkAction, BulkActionReturn, BulkOutcome } from './table/BulkActionsBar';
12
+ export { defaultResourceTableSlots } from './table/slots';
13
+ export type { ResourceTableBulkActionsProps, ResourceTableForbiddenProps, ResourceTableLoadingProps, ResourceTableNoRecordsProps, ResourceTableNoResultsProps, ResourceTableOfflineProps, ResourceTablePaginationProps, ResourceTableRowCardProps, ResourceTableSlots, } from './table/slots';
14
+ export type { ResourceTableActiveFilter } from './table/states';
15
+ export type { ResourceTableCardField } from './table/RowCard';
16
+ export { createHistoryStateStore } from './table/url-state';
17
+ export type { ResourceTableStateStore } from './table/url-state';