@databricks/appkit-ui 0.12.1 → 0.12.2

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 (80) hide show
  1. package/CLAUDE.md +3 -3
  2. package/dist/react/charts/options.d.ts.map +1 -1
  3. package/dist/react/table/data-table.d.ts +2 -2
  4. package/dist/react/table/data-table.d.ts.map +1 -1
  5. package/dist/react/ui/accordion.d.ts +5 -5
  6. package/dist/react/ui/alert-dialog.d.ts +12 -12
  7. package/dist/react/ui/alert.d.ts +4 -4
  8. package/dist/react/ui/aspect-ratio.d.ts +2 -2
  9. package/dist/react/ui/avatar.d.ts +4 -4
  10. package/dist/react/ui/badge.d.ts +4 -4
  11. package/dist/react/ui/breadcrumb.d.ts +8 -8
  12. package/dist/react/ui/button-group.d.ts +6 -6
  13. package/dist/react/ui/button.d.ts +4 -4
  14. package/dist/react/ui/calendar.d.ts +3 -3
  15. package/dist/react/ui/card.d.ts +8 -8
  16. package/dist/react/ui/carousel.d.ts +6 -6
  17. package/dist/react/ui/chart.d.ts +19 -19
  18. package/dist/react/ui/chart.d.ts.map +1 -1
  19. package/dist/react/ui/checkbox.d.ts +2 -2
  20. package/dist/react/ui/collapsible.d.ts +4 -4
  21. package/dist/react/ui/command.d.ts +10 -10
  22. package/dist/react/ui/context-menu.d.ts +16 -16
  23. package/dist/react/ui/dialog.d.ts +11 -11
  24. package/dist/react/ui/dialog.d.ts.map +1 -1
  25. package/dist/react/ui/drawer.d.ts +11 -11
  26. package/dist/react/ui/drawer.d.ts.map +1 -1
  27. package/dist/react/ui/dropdown-menu.d.ts +16 -16
  28. package/dist/react/ui/empty.d.ts +7 -7
  29. package/dist/react/ui/field.d.ts +11 -11
  30. package/dist/react/ui/form.d.ts +9 -9
  31. package/dist/react/ui/form.d.ts.map +1 -1
  32. package/dist/react/ui/hover-card.d.ts +4 -4
  33. package/dist/react/ui/input-group.d.ts +7 -7
  34. package/dist/react/ui/input-otp.d.ts +5 -5
  35. package/dist/react/ui/input.d.ts +2 -2
  36. package/dist/react/ui/item.d.ts +11 -11
  37. package/dist/react/ui/kbd.d.ts +3 -3
  38. package/dist/react/ui/label.d.ts +2 -2
  39. package/dist/react/ui/menubar.d.ts +17 -17
  40. package/dist/react/ui/navigation-menu.d.ts +9 -9
  41. package/dist/react/ui/pagination.d.ts +8 -8
  42. package/dist/react/ui/popover.d.ts +5 -5
  43. package/dist/react/ui/progress.d.ts +2 -2
  44. package/dist/react/ui/radio-group.d.ts +3 -3
  45. package/dist/react/ui/resizable.d.ts +4 -4
  46. package/dist/react/ui/scroll-area.d.ts +3 -3
  47. package/dist/react/ui/select.d.ts +11 -11
  48. package/dist/react/ui/separator.d.ts +2 -2
  49. package/dist/react/ui/sheet.d.ts +9 -9
  50. package/dist/react/ui/sidebar.d.ts +41 -24
  51. package/dist/react/ui/sidebar.d.ts.map +1 -1
  52. package/dist/react/ui/sidebar.js.map +1 -1
  53. package/dist/react/ui/skeleton.d.ts +2 -2
  54. package/dist/react/ui/slider.d.ts +2 -2
  55. package/dist/react/ui/sonner.d.ts +2 -2
  56. package/dist/react/ui/spinner.d.ts +2 -2
  57. package/dist/react/ui/switch.d.ts +2 -2
  58. package/dist/react/ui/table.d.ts +9 -9
  59. package/dist/react/ui/tabs.d.ts +5 -5
  60. package/dist/react/ui/textarea.d.ts +2 -2
  61. package/dist/react/ui/toggle-group.d.ts +3 -3
  62. package/dist/react/ui/toggle.d.ts +2 -2
  63. package/dist/react/ui/tooltip.d.ts +5 -5
  64. package/dist/react/ui/tooltip.d.ts.map +1 -1
  65. package/docs/api/appkit/Class.Plugin.md +20 -0
  66. package/docs/api/appkit/Function.createApp.md +29 -0
  67. package/docs/api/appkit-ui/ui/Sidebar.md +304 -37
  68. package/docs/app-management.md +1 -1
  69. package/docs/development/ai-assisted-development.md +63 -3
  70. package/docs/development/llm-guide.md +1 -1
  71. package/docs/development/local-development.md +2 -2
  72. package/docs/development/project-setup.md +8 -8
  73. package/docs/development/remote-bridge.md +1 -1
  74. package/docs/development/type-generation.md +1 -1
  75. package/docs/development.md +3 -3
  76. package/docs/plugins/analytics.md +104 -1
  77. package/docs/plugins/server.md +1 -1
  78. package/docs.md +32 -1
  79. package/llms.txt +3 -3
  80. package/package.json +1 -1
@@ -21,11 +21,18 @@ await createApp({
21
21
 
22
22
  ```
23
23
 
24
- ## Where queries live[​](#where-queries-live "Direct link to Where queries live")
24
+ ## Query files[​](#query-files "Direct link to Query files")
25
25
 
26
26
  * Put `.sql` files in `config/queries/`
27
27
  * Query key is the filename without `.sql` (e.g. `spend_summary.sql` → `"spend_summary"`)
28
28
 
29
+ ### Execution context[​](#execution-context "Direct link to Execution context")
30
+
31
+ * `queryKey.sql` executes as **service principal** (shared cache)
32
+ * `queryKey.obo.sql` executes as **user** (OBO = on-behalf-of, per-user cache)
33
+
34
+ The execution context is determined by the SQL file name, not by the hook call.
35
+
29
36
  ## SQL parameters[​](#sql-parameters "Direct link to SQL parameters")
30
37
 
31
38
  Use `:paramName` placeholders and optionally annotate parameter types using SQL comments:
@@ -64,3 +71,99 @@ The analytics plugin exposes these endpoints (mounted under `/api/analytics`):
64
71
 
65
72
  * `format: "JSON"` (default) returns JSON rows
66
73
  * `format: "ARROW"` returns an Arrow "statement\_id" payload over SSE, then the client fetches binary Arrow from `/api/analytics/arrow-result/:jobId`
74
+
75
+ ## Frontend usage[​](#frontend-usage "Direct link to Frontend usage")
76
+
77
+ ### useAnalyticsQuery[​](#useanalyticsquery "Direct link to useAnalyticsQuery")
78
+
79
+ React hook that subscribes to an analytics query over SSE and returns its latest result.
80
+
81
+ ```ts
82
+ import { useAnalyticsQuery } from "@databricks/appkit-ui/react";
83
+
84
+ const { data, loading, error } = useAnalyticsQuery(queryKey, parameters, options);
85
+
86
+ ```
87
+
88
+ **Return type:**
89
+
90
+ ```ts
91
+ {
92
+ data: T | null; // query result (typed array for JSON, TypedArrowTable for ARROW)
93
+ loading: boolean; // true while the query is executing
94
+ error: string | null; // error message, or null on success
95
+ }
96
+
97
+ ```
98
+
99
+ **Options:**
100
+
101
+ | Option | Type | Default | Description |
102
+ | ------------------- | ------------------- | -------- | --------------------------------------- |
103
+ | `format` | `"JSON" \| "ARROW"` | `"JSON"` | Response format |
104
+ | `maxParametersSize` | `number` | `102400` | Max serialized parameters size in bytes |
105
+ | `autoStart` | `boolean` | `true` | Start query on mount |
106
+
107
+ **Example with loading/error/empty handling:**
108
+
109
+ ```tsx
110
+ import { useAnalyticsQuery } from "@databricks/appkit-ui/react";
111
+ import { sql } from "@databricks/appkit-ui/js";
112
+ import { Skeleton } from "@databricks/appkit-ui";
113
+
114
+ function SpendTable() {
115
+ const params = useMemo(() => ({
116
+ startDate: sql.date("2025-01-01"),
117
+ endDate: sql.date("2025-12-31"),
118
+ }), []);
119
+
120
+ const { data, loading, error } = useAnalyticsQuery("spend_summary", params);
121
+
122
+ if (loading) return <Skeleton className="h-32 w-full" />;
123
+ if (error) return <div className="text-destructive">{error}</div>;
124
+ if (!data?.length) return <div className="text-muted-foreground">No results</div>;
125
+
126
+ return (
127
+ <ul>
128
+ {data.map((row) => (
129
+ <li key={row.id}>{row.name}: ${row.cost_usd}</li>
130
+ ))}
131
+ </ul>
132
+ );
133
+ }
134
+
135
+ ```
136
+
137
+ ### Type-safe queries[​](#type-safe-queries "Direct link to Type-safe queries")
138
+
139
+ Augment the `QueryRegistry` interface to get full type inference on parameters and results:
140
+
141
+ ```ts
142
+ // config/appKitTypes.d.ts
143
+ declare module "@databricks/appkit-ui/react" {
144
+ interface QueryRegistry {
145
+ spend_summary: {
146
+ name: "spend_summary";
147
+ parameters: { startDate: string; endDate: string };
148
+ result: Array<{ id: string; name: string; cost_usd: number }>;
149
+ };
150
+ }
151
+ }
152
+
153
+ ```
154
+
155
+ See [Type generation](./docs/development/type-generation.md) for automatic generation from SQL files.
156
+
157
+ ### Memoization[​](#memoization "Direct link to Memoization")
158
+
159
+ **Always wrap parameters in `useMemo`** to avoid refetch loops. The hook re-executes whenever the parameters reference changes:
160
+
161
+ ```ts
162
+ // Good
163
+ const params = useMemo(() => ({ status: sql.string("active") }), []);
164
+ const { data } = useAnalyticsQuery("users", params);
165
+
166
+ // Bad - creates a new object every render, causing infinite refetches
167
+ const { data } = useAnalyticsQuery("users", { status: sql.string("active") });
168
+
169
+ ```
@@ -31,7 +31,7 @@ The Server plugin uses the deferred initialization phase to access routes from o
31
31
  The smallest valid AppKit server:
32
32
 
33
33
  ```ts
34
- // server/index.ts
34
+ // server/server.ts
35
35
  import { createApp, server } from "@databricks/appkit";
36
36
 
37
37
  await createApp({
package/docs.md CHANGED
@@ -21,7 +21,38 @@ AppKit simplifies building data applications on Databricks by providing:
21
21
  * [Node.js](https://nodejs.org) v22+ environment with `npm`
22
22
  * Databricks CLI (v0.287.0 or higher): install and configure it according to the [official tutorial](https://docs.databricks.com/aws/en/dev-tools/cli/tutorial).
23
23
 
24
- ## Quick start[​](#quick-start "Direct link to Quick start")
24
+ ## Quick start options[​](#quick-start-options "Direct link to Quick start options")
25
+
26
+ There are two ways to get started with AppKit:
27
+
28
+ * **AI-assisted** (recommended): Use an AI coding assistant with Agent Skills to explore data, run CLI commands, and scaffold your app interactively.
29
+ * **Manual**: Use the Databricks CLI directly to create, bootstrap, and deploy your app.
30
+
31
+ Choose the path that best fits your workflow; both approaches produce the same kind of AppKit-based Databricks application.
32
+
33
+ ## AI-first quick start[​](#ai-first-quick-start "Direct link to AI-first quick start")
34
+
35
+ Databricks AppKit is designed to work with AI coding assistants through Agent Skills.
36
+
37
+ Install Agent Skills and configure it for use with your preferred AI assistant:
38
+
39
+ ```bash
40
+ databricks experimental aitools skills install
41
+
42
+ ```
43
+
44
+ Once configured for your development environment, you can use your AI assistant to create and deploy new Databricks applications, as well as to iteratively evolve your app's codebase.
45
+
46
+ Just prompt your AI assistant to create a new Databricks app, such as:
47
+
48
+ ```text
49
+ Create a new Databricks app that displays a dashboard of the nyc taxi trips dataset.
50
+
51
+ ```
52
+
53
+ To learn more about the Agent Skills, see the [AI-assisted development](./docs/development/ai-assisted-development.md) documentation.
54
+
55
+ ## Manual quick start[​](#manual-quick-start "Direct link to Manual quick start")
25
56
 
26
57
  Learn how to create and deploy a sample Databricks application that uses AppKit with the Databricks CLI.
27
58
 
package/llms.txt CHANGED
@@ -26,14 +26,14 @@ npx @databricks/appkit docs <query>
26
26
  - [Architecture](./docs/architecture.md): AppKit follows a plugin-based architecture designed for building production-ready Databricks applications. This document provides a high-level overview of the system components and their interactions.
27
27
  - [Configuration](./docs/configuration.md): This guide covers environment variables and configuration options for AppKit applications.
28
28
  - [Core principles](./docs/core-principles.md): Learn about the fundamental concepts and principles behind AppKit.
29
- - [Development](./docs/development.md): AppKit provides multiple development workflows to suit different needs: local development with hot reload, AI-assisted development with MCP, and remote tunneling to deployed backends.
29
+ - [Development](./docs/development.md): AppKit provides multiple development workflows to suit different needs: local development with hot reload, AI-assisted development with Agent Skills, and remote tunneling to deployed backends.
30
30
  - [Plugins](./docs/plugins.md): Plugins are modular extensions that add capabilities to your AppKit application. They follow a defined lifecycle and have access to shared services like caching, telemetry, and streaming.
31
31
 
32
32
  ## Development
33
33
 
34
- - [AI-Assisted development](./docs/development/ai-assisted-development.md): AppKit-specific agent skills for AI coding assistants are coming soon. This documentation will be updated with instructions when available.
34
+ - [AI-Assisted development](./docs/development/ai-assisted-development.md): AppKit integrates with AI coding assistants through the Agent Skills.
35
35
  - [LLM Guide](./docs/development/llm-guide.md): This document provides prescriptive guidance for AI coding assistants generating code with Databricks AppKit. It is intentionally opinionated to ensure consistent, production-ready code generation.
36
- - [Local development](./docs/development/local-development.md): Once your app is bootstrapped according to the Quick start guide, you can start the development server with hot reload for both UI and backend code.
36
+ - [Local development](./docs/development/local-development.md): Once your app is bootstrapped according to the Manual quick start guide, you can start the development server with hot reload for both UI and backend code.
37
37
  - [Project setup](./docs/development/project-setup.md): This guide covers the recommended project structure and scaffolding for AppKit applications.
38
38
  - [Remote Bridge](./docs/development/remote-bridge.md): Remote bridge allows you to develop against a deployed backend while keeping your UI and queries local. This is useful for testing against production data or debugging deployed backend code without redeploying your app.
39
39
  - [Type generation](./docs/development/type-generation.md): AppKit can automatically generate TypeScript types for your SQL queries, providing end-to-end type safety from database to UI.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@databricks/appkit-ui",
3
3
  "type": "module",
4
- "version": "0.12.1",
4
+ "version": "0.12.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/databricks/appkit.git"