diff --git a/biome.json b/biome.json index cdde150..67c39c2 100644 --- a/biome.json +++ b/biome.json @@ -17,6 +17,8 @@ "!packages/appkit-ui/src/react/ui", "!**/routeTree.gen.ts", "!docs/.docusaurus", + "!**/*.gen.css", + "!**/*.gen.ts", "!**/typedoc-sidebar.ts" ] }, diff --git a/docs/docs/api/appkit-ui/components/Accordion.mdx b/docs/docs/api/appkit-ui/components/Accordion.mdx index b448bba..9783ddb 100644 --- a/docs/docs/api/appkit-ui/components/Accordion.mdx +++ b/docs/docs/api/appkit-ui/components/Accordion.mdx @@ -4,6 +4,13 @@ title: Accordion # Accordion +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Accordion diff --git a/docs/docs/api/appkit-ui/components/Alert.mdx b/docs/docs/api/appkit-ui/components/Alert.mdx index 3800921..4e5d511 100644 --- a/docs/docs/api/appkit-ui/components/Alert.mdx +++ b/docs/docs/api/appkit-ui/components/Alert.mdx @@ -4,6 +4,13 @@ title: Alert # Alert +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Alert diff --git a/docs/docs/api/appkit-ui/components/AlertDialog.mdx b/docs/docs/api/appkit-ui/components/AlertDialog.mdx index 8b57e03..7da88b4 100644 --- a/docs/docs/api/appkit-ui/components/AlertDialog.mdx +++ b/docs/docs/api/appkit-ui/components/AlertDialog.mdx @@ -4,6 +4,13 @@ title: AlertDialog # AlertDialog +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## AlertDialog diff --git a/docs/docs/api/appkit-ui/components/AspectRatio.mdx b/docs/docs/api/appkit-ui/components/AspectRatio.mdx index d4cf729..52c6102 100644 --- a/docs/docs/api/appkit-ui/components/AspectRatio.mdx +++ b/docs/docs/api/appkit-ui/components/AspectRatio.mdx @@ -4,6 +4,13 @@ title: AspectRatio # AspectRatio +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## AspectRatio diff --git a/docs/docs/api/appkit-ui/components/Avatar.mdx b/docs/docs/api/appkit-ui/components/Avatar.mdx index 660fc2e..1b16497 100644 --- a/docs/docs/api/appkit-ui/components/Avatar.mdx +++ b/docs/docs/api/appkit-ui/components/Avatar.mdx @@ -4,6 +4,13 @@ title: Avatar # Avatar +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Avatar diff --git a/docs/docs/api/appkit-ui/components/Badge.mdx b/docs/docs/api/appkit-ui/components/Badge.mdx index af8984c..dcca1f4 100644 --- a/docs/docs/api/appkit-ui/components/Badge.mdx +++ b/docs/docs/api/appkit-ui/components/Badge.mdx @@ -4,6 +4,13 @@ title: Badge # Badge +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Badge diff --git a/docs/docs/api/appkit-ui/components/Breadcrumb.mdx b/docs/docs/api/appkit-ui/components/Breadcrumb.mdx index c271166..ad7f425 100644 --- a/docs/docs/api/appkit-ui/components/Breadcrumb.mdx +++ b/docs/docs/api/appkit-ui/components/Breadcrumb.mdx @@ -4,6 +4,13 @@ title: Breadcrumb # Breadcrumb +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Breadcrumb diff --git a/docs/docs/api/appkit-ui/components/Button.mdx b/docs/docs/api/appkit-ui/components/Button.mdx index a8245b5..e2610f8 100644 --- a/docs/docs/api/appkit-ui/components/Button.mdx +++ b/docs/docs/api/appkit-ui/components/Button.mdx @@ -4,6 +4,13 @@ title: Button # Button +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Button diff --git a/docs/docs/api/appkit-ui/components/Calendar.mdx b/docs/docs/api/appkit-ui/components/Calendar.mdx index 87b7bc0..f4d03dc 100644 --- a/docs/docs/api/appkit-ui/components/Calendar.mdx +++ b/docs/docs/api/appkit-ui/components/Calendar.mdx @@ -4,6 +4,13 @@ title: Calendar # Calendar +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Calendar diff --git a/docs/docs/api/appkit-ui/components/Card.mdx b/docs/docs/api/appkit-ui/components/Card.mdx index 3c7f038..f7b4a71 100644 --- a/docs/docs/api/appkit-ui/components/Card.mdx +++ b/docs/docs/api/appkit-ui/components/Card.mdx @@ -4,6 +4,13 @@ title: Card # Card +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Card diff --git a/docs/docs/api/appkit-ui/components/Carousel.mdx b/docs/docs/api/appkit-ui/components/Carousel.mdx index 551a49b..4552786 100644 --- a/docs/docs/api/appkit-ui/components/Carousel.mdx +++ b/docs/docs/api/appkit-ui/components/Carousel.mdx @@ -4,6 +4,13 @@ title: Carousel # Carousel +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Carousel diff --git a/docs/docs/api/appkit-ui/components/Checkbox.mdx b/docs/docs/api/appkit-ui/components/Checkbox.mdx index 3f31446..7edcdbd 100644 --- a/docs/docs/api/appkit-ui/components/Checkbox.mdx +++ b/docs/docs/api/appkit-ui/components/Checkbox.mdx @@ -4,6 +4,13 @@ title: Checkbox # Checkbox +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Checkbox diff --git a/docs/docs/api/appkit-ui/components/Collapsible.mdx b/docs/docs/api/appkit-ui/components/Collapsible.mdx index 6271959..78391f5 100644 --- a/docs/docs/api/appkit-ui/components/Collapsible.mdx +++ b/docs/docs/api/appkit-ui/components/Collapsible.mdx @@ -4,6 +4,13 @@ title: Collapsible # Collapsible +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Collapsible diff --git a/docs/docs/api/appkit-ui/components/Command.mdx b/docs/docs/api/appkit-ui/components/Command.mdx index b567b09..6cca078 100644 --- a/docs/docs/api/appkit-ui/components/Command.mdx +++ b/docs/docs/api/appkit-ui/components/Command.mdx @@ -4,6 +4,13 @@ title: Command # Command +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Command diff --git a/docs/docs/api/appkit-ui/components/ContextMenu.mdx b/docs/docs/api/appkit-ui/components/ContextMenu.mdx index 0f157d6..453d0c1 100644 --- a/docs/docs/api/appkit-ui/components/ContextMenu.mdx +++ b/docs/docs/api/appkit-ui/components/ContextMenu.mdx @@ -4,6 +4,13 @@ title: ContextMenu # ContextMenu +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## ContextMenu diff --git a/docs/docs/api/appkit-ui/components/Dialog.mdx b/docs/docs/api/appkit-ui/components/Dialog.mdx index cfb4d8f..3d7438f 100644 --- a/docs/docs/api/appkit-ui/components/Dialog.mdx +++ b/docs/docs/api/appkit-ui/components/Dialog.mdx @@ -4,6 +4,13 @@ title: Dialog # Dialog +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Dialog diff --git a/docs/docs/api/appkit-ui/components/Drawer.mdx b/docs/docs/api/appkit-ui/components/Drawer.mdx index b8a9d46..00de824 100644 --- a/docs/docs/api/appkit-ui/components/Drawer.mdx +++ b/docs/docs/api/appkit-ui/components/Drawer.mdx @@ -4,6 +4,13 @@ title: Drawer # Drawer +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Drawer diff --git a/docs/docs/api/appkit-ui/components/DropdownMenu.mdx b/docs/docs/api/appkit-ui/components/DropdownMenu.mdx index fdd0608..ff27f6b 100644 --- a/docs/docs/api/appkit-ui/components/DropdownMenu.mdx +++ b/docs/docs/api/appkit-ui/components/DropdownMenu.mdx @@ -4,6 +4,13 @@ title: DropdownMenu # DropdownMenu +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## DropdownMenu diff --git a/docs/docs/api/appkit-ui/components/HoverCard.mdx b/docs/docs/api/appkit-ui/components/HoverCard.mdx index 5b69499..eacd69d 100644 --- a/docs/docs/api/appkit-ui/components/HoverCard.mdx +++ b/docs/docs/api/appkit-ui/components/HoverCard.mdx @@ -4,6 +4,13 @@ title: HoverCard # HoverCard +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## HoverCard diff --git a/docs/docs/api/appkit-ui/components/Input.mdx b/docs/docs/api/appkit-ui/components/Input.mdx index 961ef1b..ec8daa2 100644 --- a/docs/docs/api/appkit-ui/components/Input.mdx +++ b/docs/docs/api/appkit-ui/components/Input.mdx @@ -4,6 +4,13 @@ title: Input # Input +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Input diff --git a/docs/docs/api/appkit-ui/components/InputOtp.mdx b/docs/docs/api/appkit-ui/components/InputOtp.mdx index c928a70..9808aa8 100644 --- a/docs/docs/api/appkit-ui/components/InputOtp.mdx +++ b/docs/docs/api/appkit-ui/components/InputOtp.mdx @@ -4,6 +4,13 @@ title: InputOtp # InputOtp +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## InputOTP diff --git a/docs/docs/api/appkit-ui/components/Label.mdx b/docs/docs/api/appkit-ui/components/Label.mdx index eee09ea..42676dd 100644 --- a/docs/docs/api/appkit-ui/components/Label.mdx +++ b/docs/docs/api/appkit-ui/components/Label.mdx @@ -4,6 +4,13 @@ title: Label # Label +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Label diff --git a/docs/docs/api/appkit-ui/components/Menubar.mdx b/docs/docs/api/appkit-ui/components/Menubar.mdx index 982d4ed..3ae25d7 100644 --- a/docs/docs/api/appkit-ui/components/Menubar.mdx +++ b/docs/docs/api/appkit-ui/components/Menubar.mdx @@ -4,6 +4,13 @@ title: Menubar # Menubar +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Menubar diff --git a/docs/docs/api/appkit-ui/components/NavigationMenu.mdx b/docs/docs/api/appkit-ui/components/NavigationMenu.mdx index ee4058c..fcd596f 100644 --- a/docs/docs/api/appkit-ui/components/NavigationMenu.mdx +++ b/docs/docs/api/appkit-ui/components/NavigationMenu.mdx @@ -4,6 +4,13 @@ title: NavigationMenu # NavigationMenu +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## NavigationMenu diff --git a/docs/docs/api/appkit-ui/components/Pagination.mdx b/docs/docs/api/appkit-ui/components/Pagination.mdx index ca0cc0f..1fb0e0a 100644 --- a/docs/docs/api/appkit-ui/components/Pagination.mdx +++ b/docs/docs/api/appkit-ui/components/Pagination.mdx @@ -4,6 +4,13 @@ title: Pagination # Pagination +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Pagination diff --git a/docs/docs/api/appkit-ui/components/Popover.mdx b/docs/docs/api/appkit-ui/components/Popover.mdx index e94c590..a90b894 100644 --- a/docs/docs/api/appkit-ui/components/Popover.mdx +++ b/docs/docs/api/appkit-ui/components/Popover.mdx @@ -4,6 +4,13 @@ title: Popover # Popover +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Popover diff --git a/docs/docs/api/appkit-ui/components/Progress.mdx b/docs/docs/api/appkit-ui/components/Progress.mdx index a1942dc..b0398be 100644 --- a/docs/docs/api/appkit-ui/components/Progress.mdx +++ b/docs/docs/api/appkit-ui/components/Progress.mdx @@ -4,6 +4,13 @@ title: Progress # Progress +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Progress diff --git a/docs/docs/api/appkit-ui/components/RadioGroup.mdx b/docs/docs/api/appkit-ui/components/RadioGroup.mdx index e3aca4c..84dceb2 100644 --- a/docs/docs/api/appkit-ui/components/RadioGroup.mdx +++ b/docs/docs/api/appkit-ui/components/RadioGroup.mdx @@ -4,6 +4,13 @@ title: RadioGroup # RadioGroup +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## RadioGroup diff --git a/docs/docs/api/appkit-ui/components/Resizable.mdx b/docs/docs/api/appkit-ui/components/Resizable.mdx index a770858..acd595c 100644 --- a/docs/docs/api/appkit-ui/components/Resizable.mdx +++ b/docs/docs/api/appkit-ui/components/Resizable.mdx @@ -4,6 +4,13 @@ title: Resizable # Resizable +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## ResizableHandle diff --git a/docs/docs/api/appkit-ui/components/ScrollArea.mdx b/docs/docs/api/appkit-ui/components/ScrollArea.mdx index dfe3489..c00a421 100644 --- a/docs/docs/api/appkit-ui/components/ScrollArea.mdx +++ b/docs/docs/api/appkit-ui/components/ScrollArea.mdx @@ -4,6 +4,13 @@ title: ScrollArea # ScrollArea +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## ScrollArea diff --git a/docs/docs/api/appkit-ui/components/Select.mdx b/docs/docs/api/appkit-ui/components/Select.mdx index 4d8aa1a..4bb187c 100644 --- a/docs/docs/api/appkit-ui/components/Select.mdx +++ b/docs/docs/api/appkit-ui/components/Select.mdx @@ -4,6 +4,13 @@ title: Select # Select +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Select diff --git a/docs/docs/api/appkit-ui/components/Separator.mdx b/docs/docs/api/appkit-ui/components/Separator.mdx index 3ce7cc5..24a2f19 100644 --- a/docs/docs/api/appkit-ui/components/Separator.mdx +++ b/docs/docs/api/appkit-ui/components/Separator.mdx @@ -4,6 +4,13 @@ title: Separator # Separator +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Separator diff --git a/docs/docs/api/appkit-ui/components/Sheet.mdx b/docs/docs/api/appkit-ui/components/Sheet.mdx index 839cab6..28ca2a0 100644 --- a/docs/docs/api/appkit-ui/components/Sheet.mdx +++ b/docs/docs/api/appkit-ui/components/Sheet.mdx @@ -4,6 +4,13 @@ title: Sheet # Sheet +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Sheet diff --git a/docs/docs/api/appkit-ui/components/Skeleton.mdx b/docs/docs/api/appkit-ui/components/Skeleton.mdx index 77b0825..9c396cf 100644 --- a/docs/docs/api/appkit-ui/components/Skeleton.mdx +++ b/docs/docs/api/appkit-ui/components/Skeleton.mdx @@ -4,6 +4,13 @@ title: Skeleton # Skeleton +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Skeleton diff --git a/docs/docs/api/appkit-ui/components/Slider.mdx b/docs/docs/api/appkit-ui/components/Slider.mdx index b6951d5..19d72a6 100644 --- a/docs/docs/api/appkit-ui/components/Slider.mdx +++ b/docs/docs/api/appkit-ui/components/Slider.mdx @@ -4,6 +4,13 @@ title: Slider # Slider +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Slider diff --git a/docs/docs/api/appkit-ui/components/Sonner.mdx b/docs/docs/api/appkit-ui/components/Sonner.mdx index 5b63a07..6649d00 100644 --- a/docs/docs/api/appkit-ui/components/Sonner.mdx +++ b/docs/docs/api/appkit-ui/components/Sonner.mdx @@ -4,6 +4,13 @@ title: Sonner # Sonner +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Toaster diff --git a/docs/docs/api/appkit-ui/components/Switch.mdx b/docs/docs/api/appkit-ui/components/Switch.mdx index 13b9886..d9d63e0 100644 --- a/docs/docs/api/appkit-ui/components/Switch.mdx +++ b/docs/docs/api/appkit-ui/components/Switch.mdx @@ -4,6 +4,13 @@ title: Switch # Switch +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Switch diff --git a/docs/docs/api/appkit-ui/components/Table.mdx b/docs/docs/api/appkit-ui/components/Table.mdx index 792c67c..51341dc 100644 --- a/docs/docs/api/appkit-ui/components/Table.mdx +++ b/docs/docs/api/appkit-ui/components/Table.mdx @@ -4,6 +4,13 @@ title: Table # Table +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Table diff --git a/docs/docs/api/appkit-ui/components/Tabs.mdx b/docs/docs/api/appkit-ui/components/Tabs.mdx index 790ef89..f0c1e87 100644 --- a/docs/docs/api/appkit-ui/components/Tabs.mdx +++ b/docs/docs/api/appkit-ui/components/Tabs.mdx @@ -4,6 +4,13 @@ title: Tabs # Tabs +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Tabs diff --git a/docs/docs/api/appkit-ui/components/Textarea.mdx b/docs/docs/api/appkit-ui/components/Textarea.mdx index 9d6c00e..b4a7004 100644 --- a/docs/docs/api/appkit-ui/components/Textarea.mdx +++ b/docs/docs/api/appkit-ui/components/Textarea.mdx @@ -4,6 +4,13 @@ title: Textarea # Textarea +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Textarea diff --git a/docs/docs/api/appkit-ui/components/Toggle.mdx b/docs/docs/api/appkit-ui/components/Toggle.mdx index 8649508..8215c4d 100644 --- a/docs/docs/api/appkit-ui/components/Toggle.mdx +++ b/docs/docs/api/appkit-ui/components/Toggle.mdx @@ -4,6 +4,13 @@ title: Toggle # Toggle +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Toggle diff --git a/docs/docs/api/appkit-ui/components/ToggleGroup.mdx b/docs/docs/api/appkit-ui/components/ToggleGroup.mdx index d9d9e41..e7a26ea 100644 --- a/docs/docs/api/appkit-ui/components/ToggleGroup.mdx +++ b/docs/docs/api/appkit-ui/components/ToggleGroup.mdx @@ -4,6 +4,13 @@ title: ToggleGroup # ToggleGroup +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## ToggleGroup diff --git a/docs/docs/api/appkit-ui/components/Tooltip.mdx b/docs/docs/api/appkit-ui/components/Tooltip.mdx index 456a18b..fddd8e3 100644 --- a/docs/docs/api/appkit-ui/components/Tooltip.mdx +++ b/docs/docs/api/appkit-ui/components/Tooltip.mdx @@ -4,6 +4,13 @@ title: Tooltip # Tooltip +## Example + +import { DocExample } from "@site/src/components/DocExample"; + + + + ## Tooltip diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index 0db3196..3eba122 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -1,6 +1,43 @@ import { themes as prismThemes } from "prism-react-renderer"; +import path from "node:path"; import type { Config } from "@docusaurus/types"; import type * as Preset from "@docusaurus/preset-classic"; +import webpack from "webpack"; + +function appKitAliasPlugin() { + return { + name: "appkit-aliases", + configureWebpack() { + return { + resolve: { + alias: { + "@": path.resolve(__dirname, "../packages/appkit-ui/src"), + shared: path.resolve(__dirname, "../packages/shared/src"), + "@/lib/utils": path.resolve( + __dirname, + "../packages/appkit-ui/src/lib/utils", + ), + "@/js": path.resolve(__dirname, "../packages/appkit-ui/src/js"), + "@databricks/appkit-ui/react": path.resolve( + __dirname, + "../packages/appkit-ui/src/react", + ), + }, + }, + // Replace import.meta references at build time to prevent SSR errors. + // The appkit-ui source code uses import.meta for Vite HMR, which causes + // "Cannot use 'import.meta' outside a module" errors when Docusaurus + // evaluates the server bundle in Node.js CommonJS context during SSG. + plugins: [ + new webpack.DefinePlugin({ + "import.meta.env.DEV": JSON.stringify(false), + "import.meta.hot": JSON.stringify(undefined), + }), + ], + }; + }, + }; +} // This runs in Node.js - Don't use client-side code here (browser APIs, JSX...) @@ -93,6 +130,7 @@ const config: Config = { }, }, ], + appKitAliasPlugin, ], themeConfig: { diff --git a/docs/package.json b/docs/package.json index deb03cf..c87f4de 100644 --- a/docs/package.json +++ b/docs/package.json @@ -3,9 +3,10 @@ "version": "0.1.0", "private": true, "scripts": { + "build-appkit-ui-styles": "tsx scripts/build-appkit-ui-styles.ts", "docusaurus": "docusaurus", "dev": "pnpm run generate-component-docs && docusaurus start --no-open", - "build": "pnpm run generate-component-docs && docusaurus build", + "build": "pnpm run build-appkit-ui-styles && pnpm run generate-component-docs && docusaurus build", "generate-component-docs": "tsx ../tools/generate-component-mdx.ts", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", @@ -17,11 +18,14 @@ "typecheck": "tsc" }, "dependencies": { + "@databricks/appkit-ui": "workspace:*", "@docusaurus/core": "3.9.2", "@docusaurus/preset-classic": "3.9.2", "@mdx-js/react": "^3.0.0", + "@tailwindcss/postcss": "^4.1.18", "clsx": "^2.0.0", "docusaurus-lunr-search": "^3.6.0", + "postcss": "^8.5.6", "prism-react-renderer": "^2.3.0", "react": "^19.0.0", "react-dom": "^19.0.0" @@ -32,6 +36,8 @@ "@docusaurus/types": "3.9.2", "docusaurus-plugin-typedoc": "^1.4.2", "react-docgen-typescript": "^2.4.0", + "tailwindcss": "^4.0.14", + "tailwindcss-animate": "^1.0.7", "typedoc": "^0.28.15", "typedoc-plugin-markdown": "^4.9.0", "typescript": "~5.6.2" diff --git a/docs/postcss.config.mjs b/docs/postcss.config.mjs new file mode 100644 index 0000000..c2ddf74 --- /dev/null +++ b/docs/postcss.config.mjs @@ -0,0 +1,5 @@ +export default { + plugins: { + "@tailwindcss/postcss": {}, + }, +}; diff --git a/docs/scripts/build-appkit-ui-styles.ts b/docs/scripts/build-appkit-ui-styles.ts new file mode 100644 index 0000000..d575e3e --- /dev/null +++ b/docs/scripts/build-appkit-ui-styles.ts @@ -0,0 +1,50 @@ +import { readFile, writeFile, mkdir } from "node:fs/promises"; +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +import postcss from "postcss"; +import tailwindcss from "@tailwindcss/postcss"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +async function buildStyles(): Promise { + try { + const sourceCSS = resolve( + __dirname, + "../../packages/appkit-ui/src/react/styles/globals.css", + ); + const outputDir = resolve(__dirname, "../static/appkit-ui"); + const outputCSS = resolve(outputDir, "styles.gen.css"); + + let css = await readFile(sourceCSS, "utf-8"); + + // Rewrite @source path for docs build + // The original @source "./react" is correct for the package, but during docs build + // we need @source "../" because the CSS file path context is different during PostCSS + // processing. This allows Tailwind to find and scan the React component files in + // packages/appkit-ui/src/react to generate all the utility classes they use. + css = css.replace('@source "./react"', '@source "../"'); + + const result = await postcss([tailwindcss()]).process(css, { + from: sourceCSS, + to: outputCSS, + }); + + await mkdir(outputDir, { recursive: true }); + + // Add comment after PostCSS processing so it doesn't get stripped out + const finalCSS = `/* Auto-generated by docs/scripts/build-appkit-ui-styles.ts */\n${result.css}`; + + await writeFile(outputCSS, finalCSS, "utf-8"); + + console.log( + "[build-appkit-ui-styles] ✓ appkit-ui CSS build complete! Output size:", + (result.css.length / 1024).toFixed(2), + "KB", + ); + } catch (error) { + console.error("[build-styles] ✗ Error building styles:", error); + process.exit(1); + } +} + +buildStyles(); diff --git a/docs/src/components/DocExample/IframePreview.tsx b/docs/src/components/DocExample/IframePreview.tsx new file mode 100644 index 0000000..73067f9 --- /dev/null +++ b/docs/src/components/DocExample/IframePreview.tsx @@ -0,0 +1,262 @@ +import type React from "react"; +import { useEffect, useRef, useState, type RefObject } from "react"; +import { createPortal } from "react-dom"; +import useBaseUrl from "@docusaurus/useBaseUrl"; +import { Toaster } from "sonner"; +import { PortalContainerProvider } from "../../../../packages/appkit-ui/src/react/portal-container-context"; + +// Timing constants for delays and retries +const TIMING = { + INITIAL_HEIGHT_DELAY: 100, + SONNER_STYLE_RETRY: 100, + SONNER_INITIAL_DELAY: 100, +} as const; + +// Dimension constants for iframe sizing +const DIMENSIONS = { + MIN_HEIGHT: 200, + MAX_HEIGHT: 800, + DEFAULT_HEIGHT: 400, + CONTENT_PADDING: 16, + HEIGHT_BUFFER: 20, +} as const; + +// Maximum retry attempts for style synchronization +const MAX_STYLE_SYNC_RETRIES = 10; + +interface IframePreviewProps { + children: React.ReactNode; + customHeight?: number; + componentName?: string; +} + +/** + * Generates the HTML template for the iframe document + */ +function getIframeHTML(stylesHref: string): string { + return ` + + + + + + + + + +
+ + + `; +} + +/** + * Sync dark mode between parent document and iframe + */ +function useDarkModeSync(iframeRef: RefObject) { + useEffect(() => { + if (!iframeRef.current?.contentDocument) return; + + const iframeDoc = iframeRef.current.contentDocument; + const parentHtml = document.documentElement; + + const syncTheme = () => { + const isDark = parentHtml.getAttribute("data-theme") === "dark"; + iframeDoc.documentElement.classList.toggle("dark", isDark); + }; + + syncTheme(); + + const observer = new MutationObserver(syncTheme); + observer.observe(parentHtml, { + attributes: true, + attributeFilter: ["data-theme", "class"], + }); + + return () => observer.disconnect(); + }, [iframeRef]); +} + +/** + * Automatically adjust iframe height based on content + */ +function useIframeAutoHeight( + iframeRef: RefObject, + customHeight?: number, +) { + const [iframeHeight, setIframeHeight] = useState( + customHeight || DIMENSIONS.DEFAULT_HEIGHT, + ); + + useEffect(() => { + if (!iframeRef.current?.contentDocument?.body) return; + + // If custom height is provided, use it and skip auto-sizing + if (customHeight) { + setIframeHeight(customHeight); + return; + } + + const iframeDoc = iframeRef.current.contentDocument; + + const updateHeight = () => { + const contentHeight = iframeDoc.body.scrollHeight; + const newHeight = Math.min( + Math.max( + contentHeight + DIMENSIONS.HEIGHT_BUFFER, + DIMENSIONS.MIN_HEIGHT, + ), + DIMENSIONS.MAX_HEIGHT, + ); + setIframeHeight(newHeight); + }; + + const initialTimeout = setTimeout( + updateHeight, + TIMING.INITIAL_HEIGHT_DELAY, + ); + + const resizeObserver = new ResizeObserver(updateHeight); + resizeObserver.observe(iframeDoc.body); + + return () => { + clearTimeout(initialTimeout); + resizeObserver.disconnect(); + }; + }, [customHeight, iframeRef]); + + return iframeHeight; +} + +/** + * Sync Sonner toast styles from parent to iframe. + * Only active when componentName is "sonner". + * This is necessary because Sonner styles are injected into the parent document, + * so we need to sync them to the iframe. + */ +function useSonnerStyleSync( + iframeRef: RefObject, + componentName?: string, +) { + useEffect(() => { + if (componentName !== "sonner" || !iframeRef.current?.contentDocument) { + return; + } + + const iframeDoc = iframeRef.current.contentDocument; + let retryCount = 0; + + const syncSonnerStyles = () => { + const sonnerStyles = Array.from( + document.querySelectorAll("style"), + ).filter( + (style) => + style.textContent?.includes("[data-sonner-toaster]") || + style.textContent?.includes("[data-sonner-toast]"), + ); + + if (sonnerStyles.length > 0) { + sonnerStyles.forEach((style) => { + const cloned = style.cloneNode(true) as HTMLStyleElement; + iframeDoc.head.appendChild(cloned); + }); + } else if (retryCount < MAX_STYLE_SYNC_RETRIES) { + // Retry if Sonner hasn't injected styles yet + retryCount++; + setTimeout(syncSonnerStyles, TIMING.SONNER_STYLE_RETRY); + } + }; + + // Wait for Sonner to inject its styles + setTimeout(syncSonnerStyles, TIMING.SONNER_INITIAL_DELAY); + }, [componentName, iframeRef]); +} + +export function IframePreview({ + children, + customHeight, + componentName, +}: IframePreviewProps) { + const iframeRef = useRef(null); + const [iframeBody, setIframeBody] = useState(null); + const stylesHref = useBaseUrl("/appkit-ui/styles.gen.css"); + + const iframeHeight = useIframeAutoHeight(iframeRef, customHeight); + useDarkModeSync(iframeRef); + useSonnerStyleSync(iframeRef, componentName); + + useEffect(() => { + const iframe = iframeRef.current; + if (!iframe) return; + + const iframeDoc = iframe.contentDocument; + if (!iframeDoc) return; + + iframeDoc.open(); + iframeDoc.write(getIframeHTML(stylesHref)); + iframeDoc.close(); + + const link = iframeDoc.querySelector('link[rel="stylesheet"]'); + if (link) { + link.addEventListener("load", () => { + const root = iframeDoc.getElementById("preview-root"); + setIframeBody(root); + }); + + link.addEventListener("error", () => { + // Still try to show content even if styles fail + const root = iframeDoc.getElementById("preview-root"); + setIframeBody(root); + }); + } else { + // Fallback if link not found + const root = iframeDoc.getElementById("preview-root"); + setIframeBody(root); + } + }, [stylesHref]); + + return ( + + ); +} diff --git a/docs/src/components/DocExample/examples.gen.ts b/docs/src/components/DocExample/examples.gen.ts new file mode 100644 index 0000000..3f36321 --- /dev/null +++ b/docs/src/components/DocExample/examples.gen.ts @@ -0,0 +1,1941 @@ +/* Auto-generated by tools/generate-component-mdx.ts */ +import type { ComponentType } from "react"; +import AccordionExample from "../../../../packages/appkit-ui/src/react/ui/examples/accordion.example"; +import AlertDialogExample from "../../../../packages/appkit-ui/src/react/ui/examples/alert-dialog.example"; +import AlertExample from "../../../../packages/appkit-ui/src/react/ui/examples/alert.example"; +import AspectRatioExample from "../../../../packages/appkit-ui/src/react/ui/examples/aspect-ratio.example"; +import AvatarExample from "../../../../packages/appkit-ui/src/react/ui/examples/avatar.example"; +import BadgeExample from "../../../../packages/appkit-ui/src/react/ui/examples/badge.example"; +import BreadcrumbExample from "../../../../packages/appkit-ui/src/react/ui/examples/breadcrumb.example"; +import ButtonExample from "../../../../packages/appkit-ui/src/react/ui/examples/button.example"; +import CalendarExample from "../../../../packages/appkit-ui/src/react/ui/examples/calendar.example"; +import CardExample from "../../../../packages/appkit-ui/src/react/ui/examples/card.example"; +import CarouselExample from "../../../../packages/appkit-ui/src/react/ui/examples/carousel.example"; +import CheckboxExample from "../../../../packages/appkit-ui/src/react/ui/examples/checkbox.example"; +import CollapsibleExample from "../../../../packages/appkit-ui/src/react/ui/examples/collapsible.example"; +import CommandExample from "../../../../packages/appkit-ui/src/react/ui/examples/command.example"; +import ContextMenuExample from "../../../../packages/appkit-ui/src/react/ui/examples/context-menu.example"; +import DialogExample from "../../../../packages/appkit-ui/src/react/ui/examples/dialog.example"; +import DrawerExample from "../../../../packages/appkit-ui/src/react/ui/examples/drawer.example"; +import DropdownMenuExample from "../../../../packages/appkit-ui/src/react/ui/examples/dropdown-menu.example"; +import HoverCardExample from "../../../../packages/appkit-ui/src/react/ui/examples/hover-card.example"; +import InputOtpExample from "../../../../packages/appkit-ui/src/react/ui/examples/input-otp.example"; +import InputExample from "../../../../packages/appkit-ui/src/react/ui/examples/input.example"; +import LabelExample from "../../../../packages/appkit-ui/src/react/ui/examples/label.example"; +import MenubarExample from "../../../../packages/appkit-ui/src/react/ui/examples/menubar.example"; +import NavigationMenuExample from "../../../../packages/appkit-ui/src/react/ui/examples/navigation-menu.example"; +import PaginationExample from "../../../../packages/appkit-ui/src/react/ui/examples/pagination.example"; +import PopoverExample from "../../../../packages/appkit-ui/src/react/ui/examples/popover.example"; +import ProgressExample from "../../../../packages/appkit-ui/src/react/ui/examples/progress.example"; +import RadioGroupExample from "../../../../packages/appkit-ui/src/react/ui/examples/radio-group.example"; +import ResizableExample from "../../../../packages/appkit-ui/src/react/ui/examples/resizable.example"; +import ScrollAreaExample from "../../../../packages/appkit-ui/src/react/ui/examples/scroll-area.example"; +import SelectExample from "../../../../packages/appkit-ui/src/react/ui/examples/select.example"; +import SeparatorExample from "../../../../packages/appkit-ui/src/react/ui/examples/separator.example"; +import SheetExample from "../../../../packages/appkit-ui/src/react/ui/examples/sheet.example"; +import SkeletonExample from "../../../../packages/appkit-ui/src/react/ui/examples/skeleton.example"; +import SliderExample from "../../../../packages/appkit-ui/src/react/ui/examples/slider.example"; +import SonnerExample from "../../../../packages/appkit-ui/src/react/ui/examples/sonner.example"; +import SwitchExample from "../../../../packages/appkit-ui/src/react/ui/examples/switch.example"; +import TableExample from "../../../../packages/appkit-ui/src/react/ui/examples/table.example"; +import TabsExample from "../../../../packages/appkit-ui/src/react/ui/examples/tabs.example"; +import TextareaExample from "../../../../packages/appkit-ui/src/react/ui/examples/textarea.example"; +import ToggleGroupExample from "../../../../packages/appkit-ui/src/react/ui/examples/toggle-group.example"; +import ToggleExample from "../../../../packages/appkit-ui/src/react/ui/examples/toggle.example"; +import TooltipExample from "../../../../packages/appkit-ui/src/react/ui/examples/tooltip.example"; + +export type AppKitExampleEntry = { + Component: ComponentType; + source: string; +}; + +export const examples: Record = { + "accordion": { + Component: AccordionExample, + source: `import { + Accordion, + AccordionContent, + AccordionItem, + AccordionTrigger, +} from "@databricks/appkit-ui/react" + +export default function AccordionExample() { + return ( + + + Is it accessible? + + Yes. It adheres to the WAI-ARIA design pattern. + + + + Is it styled? + + Yes. It comes with default styles that matches the other + components' aesthetic. + + + + Is it animated? + + Yes. It's animated by default, but you can disable it if you + prefer. + + + + ) +} +`, + }, + "alert-dialog": { + Component: AlertDialogExample, + source: `import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, + Button, +} from "@databricks/appkit-ui/react" + +export default function AlertDialogExample() { + return ( + + + + + + + Are you absolutely sure? + + This action cannot be undone. This will permanently delete your + account and remove your data from our servers. + + + + Cancel + Continue + + + + ) +} +`, + }, + "alert": { + Component: AlertExample, + source: `import { Terminal } from "lucide-react" + +import { + Alert, + AlertDescription, + AlertTitle, +} from "@databricks/appkit-ui/react" + +export default function AlertExample() { + return ( + + + Example + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + + + ) +} +`, + }, + "aspect-ratio": { + Component: AspectRatioExample, + source: `import { AspectRatio } from "@databricks/appkit-ui/react" + +export default function AspectRatioExample() { + return ( + + Photo by Drew Beamer + + ) +} +`, + }, + "avatar": { + Component: AvatarExample, + source: `import { + Avatar, + AvatarFallback, + AvatarImage, +} from "@databricks/appkit-ui/react" + +export default function AvatarExample() { + return ( + + + CN + + ) +} +`, + }, + "badge": { + Component: BadgeExample, + source: `import { Badge } from "@databricks/appkit-ui/react" + +export default function BadgeExample() { + return Badge +} +`, + }, + "breadcrumb": { + Component: BreadcrumbExample, + source: `import { + Breadcrumb, + BreadcrumbEllipsis, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbPage, + BreadcrumbSeparator, + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@databricks/appkit-ui/react" + +export default function BreadcrumbExample() { + return ( + + + + Home + + + + + + + Toggle menu + + + Documentation + Themes + GitHub + + + + + + Components + + + + Breadcrumb + + + + ) +} +`, + }, + "button": { + Component: ButtonExample, + source: `import { Button } from "@databricks/appkit-ui/react" + +export default function ButtonExample() { + return +} +`, + }, + "calendar": { + Component: CalendarExample, + source: `"use client" + +import * as React from "react" + +import { Calendar } from "@databricks/appkit-ui/react" + +export default function CalendarExample() { + const [date, setDate] = React.useState(new Date()) + + return ( + + ) +} +`, + }, + "card": { + Component: CardExample, + source: `import { BellRing, Check } from "lucide-react" + +import { + cn, + Button, + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, + Switch, +} from "@databricks/appkit-ui/react" + +const notifications = [ + { + title: "Your call has been confirmed.", + description: "1 hour ago", + }, + { + title: "You have a new message!", + description: "1 hour ago", + }, + { + title: "Your subscription is expiring soon!", + description: "2 hours ago", + }, +] + +type CardProps = React.ComponentProps + +export default function CardExample({ className, ...props }: CardProps) { + return ( + + + Notifications + You have 3 unread messages. + + +
+ +
+

+ Push Notifications +

+

+ Send notifications to device. +

+
+ +
+
+ {notifications.map((notification, index) => ( +
+ +
+

+ {notification.title} +

+

+ {notification.description} +

+
+
+ ))} +
+
+ + + +
+ ) +} +`, + }, + "carousel": { + Component: CarouselExample, + source: `import * as React from "react" + +import { + Card, + CardContent, + Carousel, + CarouselContent, + CarouselItem, + CarouselNext, + CarouselPrevious, +} from "@databricks/appkit-ui/react" + +export default function CarouselExample() { + return ( + + + {Array.from({ length: 5 }).map((_, index) => ( + +
+ + + {index + 1} + + +
+
+ ))} +
+ + +
+ ) +} +`, + }, + "checkbox": { + Component: CheckboxExample, + source: `"use client" + +import { Checkbox } from "@databricks/appkit-ui/react" + +export default function CheckboxExample() { + return ( +
+ + +
+ ) +} +`, + }, + "collapsible": { + Component: CollapsibleExample, + source: `"use client" + +import * as React from "react" +import { ChevronsUpDown } from "lucide-react" + +import { + Button, + Collapsible, + CollapsibleContent, + CollapsibleTrigger, +} from "@databricks/appkit-ui/react" + +export default function CollapsibleExample() { + const [isOpen, setIsOpen] = React.useState(false) + + return ( + +
+

+ Example Collapsible +

+ + + +
+
+ First item +
+ +
+ Second item +
+
+ Third item +
+
+
+ ) +} +`, + }, + "command": { + Component: CommandExample, + source: `import { + Calculator, + Calendar, + CreditCard, + Settings, + Smile, + User, +} from "lucide-react" + +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, + CommandSeparator, + CommandShortcut, +} from "@databricks/appkit-ui/react" + +export default function CommandExample() { + return ( + + + + No results found. + + + + Calendar + + + + Search Emoji + + + + Calculator + + + + + + + Profile + ⌘P + + + + Billing + ⌘B + + + + Settings + ⌘S + + + + + ) +} +`, + }, + "context-menu": { + Component: ContextMenuExample, + source: `import { + ContextMenu, + ContextMenuCheckboxItem, + ContextMenuContent, + ContextMenuItem, + ContextMenuLabel, + ContextMenuRadioGroup, + ContextMenuRadioItem, + ContextMenuSeparator, + ContextMenuShortcut, + ContextMenuSub, + ContextMenuSubContent, + ContextMenuSubTrigger, + ContextMenuTrigger, +} from "@databricks/appkit-ui/react" + +export default function ContextMenuExample() { + return ( + + + Right click here + + + + Back + ⌘[ + + + Forward + ⌘] + + + Reload + ⌘R + + + More Tools + + + Save Page As... + ⇧⌘S + + Create Shortcut... + Name Window... + + Developer Tools + + + + + Show Bookmarks Bar + ⌘⇧B + + Show Full URLs + + + People + + + Pedro Duarte + + Colm Tuite + + + + ) +} +`, + }, + "dialog": { + Component: DialogExample, + source: `import { + Button, + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, + Input, + Label, +} from "@databricks/appkit-ui/react" + +export default function DialogExample() { + return ( + + + + + + + Edit profile + + Make changes to your profile here. Click save when you're done. + + +
+
+ + +
+
+ + +
+
+ + + +
+
+ ) +} +`, + }, + "drawer": { + Component: DrawerExample, + source: `"use client" + +import * as React from "react" +import { Minus, Plus } from "lucide-react" +import { Bar, BarChart, ResponsiveContainer } from "recharts" + +import { + Button, + Drawer, + DrawerClose, + DrawerContent, + DrawerDescription, + DrawerFooter, + DrawerHeader, + DrawerTitle, + DrawerTrigger, +} from "@databricks/appkit-ui/react" + +const data = [ + { + goal: 400, + }, + { + goal: 300, + }, + { + goal: 200, + }, + { + goal: 300, + }, + { + goal: 200, + }, + { + goal: 278, + }, + { + goal: 189, + }, + { + goal: 239, + }, + { + goal: 300, + }, + { + goal: 200, + }, + { + goal: 278, + }, + { + goal: 189, + }, + { + goal: 349, + }, +] + +export default function DrawerExample() { + const [goal, setGoal] = React.useState(350) + + function onClick(adjustment: number) { + setGoal(Math.max(200, Math.min(400, goal + adjustment))) + } + + return ( + + + + + +
+ + Move Goal + Set your daily activity goal. + +
+
+ +
+
+ {goal} +
+
+ Calories/day +
+
+ +
+
+ + + + + +
+
+ + + + + + +
+
+
+ ) +} +`, + }, + "dropdown-menu": { + Component: DropdownMenuExample, + source: `import { + Cloud, + CreditCard, + Github, + Keyboard, + LifeBuoy, + LogOut, + Mail, + MessageSquare, + Plus, + PlusCircle, + Settings, + User, + UserPlus, + Users, +} from "lucide-react" + +import { + Button, + DropdownMenu, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuPortal, + DropdownMenuSeparator, + DropdownMenuShortcut, + DropdownMenuSub, + DropdownMenuSubContent, + DropdownMenuSubTrigger, + DropdownMenuTrigger, +} from "@databricks/appkit-ui/react" + +export default function DropdownMenuExample() { + return ( + + + + + + My Account + + + + + Profile + ⇧⌘P + + + + Billing + ⌘B + + + + Settings + ⌘S + + + + Keyboard shortcuts + ⌘K + + + + + + + Team + + + + + Invite users + + + + + + Email + + + + Message + + + + + More... + + + + + + + New Team + ⌘+T + + + + + + GitHub + + + + Support + + + + API + + + + + Log out + ⇧⌘Q + + + + ) +} +`, + }, + "hover-card": { + Component: HoverCardExample, + source: `import { CalendarDays } from "lucide-react" + +import { + Avatar, + AvatarFallback, + AvatarImage, + Button, + HoverCard, + HoverCardContent, + HoverCardTrigger, +} from "@databricks/appkit-ui/react" + +export default function HoverCardExample() { + return ( + + + + + +
+ + + VC + +
+

@nextjs

+

+ The React Framework – created and maintained by @vercel. +

+
+ {" "} + + Joined December 2021 + +
+
+
+
+
+ ) +} +`, + }, + "input-otp": { + Component: InputOtpExample, + source: `import { + InputOTP, + InputOTPGroup, + InputOTPSeparator, + InputOTPSlot, +} from "@databricks/appkit-ui/react" + +export default function InputOtpExample() { + return ( + + + + + + + + + + + + + + ) +} +`, + }, + "input": { + Component: InputExample, + source: `import { Input } from "@databricks/appkit-ui/react" + +export default function InputExample() { + return +} +`, + }, + "label": { + Component: LabelExample, + source: `import { Checkbox, Label } from "@databricks/appkit-ui/react" + +export default function LabelExample() { + return ( +
+
+ + +
+
+ ) +} +`, + }, + "menubar": { + Component: MenubarExample, + source: `import { + Menubar, + MenubarCheckboxItem, + MenubarContent, + MenubarItem, + MenubarMenu, + MenubarRadioGroup, + MenubarRadioItem, + MenubarSeparator, + MenubarShortcut, + MenubarSub, + MenubarSubContent, + MenubarSubTrigger, + MenubarTrigger, +} from "@databricks/appkit-ui/react" + +export default function MenubarExample() { + return ( + + + File + + + New Tab ⌘T + + + New Window ⌘N + + New Incognito Window + + + Share + + Email link + Messages + Notes + + + + + Print... ⌘P + + + + + Edit + + + Undo ⌘Z + + + Redo ⇧⌘Z + + + + Find + + Search the web + + Find... + Find Next + Find Previous + + + + Cut + Copy + Paste + + + + View + + Always Show Bookmarks Bar + + Always Show Full URLs + + + + Reload ⌘R + + + Force Reload ⇧⌘R + + + Toggle Fullscreen + + Hide Sidebar + + + + Profiles + + + Andy + Benoit + Luis + + + Edit... + + Add Profile... + + + + ) +} +`, + }, + "navigation-menu": { + Component: NavigationMenuExample, + source: `"use client" + +import * as React from "react" + +import { + cn, + NavigationMenu, + NavigationMenuContent, + NavigationMenuItem, + NavigationMenuLink, + NavigationMenuList, + NavigationMenuTrigger, + navigationMenuTriggerStyle, +} from "@databricks/appkit-ui/react" + +const components: { title: string; href: string; description: string }[] = [ + { + title: "Alert Dialog", + href: "/docs/primitives/alert-dialog", + description: + "A modal dialog that interrupts the user with important content and expects a response.", + }, + { + title: "Hover Card", + href: "/docs/primitives/hover-card", + description: + "For sighted users to preview content available behind a link.", + }, + { + title: "Progress", + href: "/docs/primitives/progress", + description: + "Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.", + }, + { + title: "Scroll-area", + href: "/docs/primitives/scroll-area", + description: "Visually or semantically separates content.", + }, + { + title: "Tabs", + href: "/docs/primitives/tabs", + description: + "A set of layered sections of content—known as tab panels—that are displayed one at a time.", + }, + { + title: "Tooltip", + href: "/docs/primitives/tooltip", + description: + "A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.", + }, +] + +export default function NavigationMenuExample() { + return ( + + + + About + + + + + + Components + +
    + {components.map((component) => ( + + {component.description} + + ))} +
+
+
+ + + + Documentation + + + +
+
+ ) +} + +const ListItem = React.forwardRef< + React.ElementRef<"a">, + React.ComponentPropsWithoutRef<"a"> +>(({ className, title, children, ...props }, ref) => { + return ( +
  • + + +
    {title}
    +

    + {children} +

    +
    +
    +
  • + ) +}) +ListItem.displayName = "ListItem" +`, + }, + "pagination": { + Component: PaginationExample, + source: `import { + Pagination, + PaginationContent, + PaginationEllipsis, + PaginationItem, + PaginationLink, + PaginationNext, + PaginationPrevious, +} from "@databricks/appkit-ui/react" + +export default function PaginationExample() { + return ( + + + + + + + 1 + + + + 2 + + + + 3 + + + + + + + + + + ) +} +`, + }, + "popover": { + Component: PopoverExample, + source: `import { + Button, + Input, + Label, + Popover, + PopoverContent, + PopoverTrigger, +} from "@databricks/appkit-ui/react" + +export default function PopoverExample() { + return ( + + + + + +
    +
    +

    Dimensions

    +

    + Set the dimensions for the layer. +

    +
    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    + ) +} +`, + }, + "progress": { + Component: ProgressExample, + source: `"use client" + +import * as React from "react" + +import { Progress } from "@databricks/appkit-ui/react" + +export default function ProgressExample() { + const [progress, setProgress] = React.useState(13) + + React.useEffect(() => { + const timer = setTimeout(() => setProgress(66), 500) + return () => clearTimeout(timer) + }, []) + + return +} +`, + }, + "radio-group": { + Component: RadioGroupExample, + source: `import { Label, RadioGroup, RadioGroupItem } from "@databricks/appkit-ui/react" + +export default function RadioGroupExample() { + return ( + +
    + + +
    +
    + + +
    +
    + + +
    +
    + ) +} +`, + }, + "resizable": { + Component: ResizableExample, + source: `import { + ResizableHandle, + ResizablePanel, + ResizablePanelGroup, +} from "@databricks/appkit-ui/react" + +export default function ResizableExample() { + return ( + + +
    + One +
    +
    + + + + +
    + Two +
    +
    + + +
    + Three +
    +
    +
    +
    +
    + ) +} +`, + }, + "scroll-area": { + Component: ScrollAreaExample, + source: `import * as React from "react" + +import { ScrollArea, Separator } from "@databricks/appkit-ui/react" + +const tags = Array.from({ length: 50 }).map( + (_, i, a) => \`v1.2.0-beta.\${a.length - i}\` +) + +export default function ScrollAreaExample() { + return ( + +
    +

    Tags

    + {tags.map((tag) => ( + <> +
    + {tag} +
    + + + ))} +
    +
    + ) +} +`, + }, + "select": { + Component: SelectExample, + source: `import * as React from "react" + +import { + Select, + SelectContent, + SelectGroup, + SelectItem, + SelectLabel, + SelectTrigger, + SelectValue, +} from "@databricks/appkit-ui/react" + +export default function SelectExample() { + return ( + + ) +} +`, + }, + "separator": { + Component: SeparatorExample, + source: `import { Separator } from "@databricks/appkit-ui/react" + +export default function SeparatorExample() { + return ( +
    +
    +

    Radix Primitives

    +

    + An open-source UI component library. +

    +
    + +
    +
    Blog
    + +
    Docs
    + +
    Source
    +
    +
    + ) +} +`, + }, + "sheet": { + Component: SheetExample, + source: `import { + Button, + Input, + Label, + Sheet, + SheetClose, + SheetContent, + SheetDescription, + SheetFooter, + SheetHeader, + SheetTitle, + SheetTrigger, +} from "@databricks/appkit-ui/react" + +export default function SheetExample() { + return ( + + + + + + + Edit profile + + Make changes to your profile here. Click save when you're done. + + +
    +
    + + +
    +
    + + +
    +
    + + + + + +
    +
    + ) +} +`, + }, + "skeleton": { + Component: SkeletonExample, + source: `import { Skeleton } from "@databricks/appkit-ui/react" + +export default function SkeletonExample() { + return ( +
    + +
    + + +
    +
    + ) +} +`, + }, + "slider": { + Component: SliderExample, + source: `import { cn, Slider } from "@databricks/appkit-ui/react" + +type SliderProps = React.ComponentProps + +export default function SliderExample({ className, ...props }: SliderProps) { + return ( + + ) +} +`, + }, + "sonner": { + Component: SonnerExample, + source: `"use client" + +import { toast } from "sonner" + +import { Button } from "@databricks/appkit-ui/react" + +export default function SonnerExample() { + return ( + + ) +} +`, + }, + "switch": { + Component: SwitchExample, + source: `import { Label, Switch } from "@databricks/appkit-ui/react" + +export default function SwitchExample() { + return ( +
    + + +
    + ) +} +`, + }, + "table": { + Component: TableExample, + source: `import { + Table, + TableBody, + TableCaption, + TableCell, + TableFooter, + TableHead, + TableHeader, + TableRow, +} from "@databricks/appkit-ui/react" + +const invoices = [ + { + invoice: "INV001", + paymentStatus: "Paid", + totalAmount: "\$250.00", + paymentMethod: "Credit Card", + }, + { + invoice: "INV002", + paymentStatus: "Pending", + totalAmount: "\$150.00", + paymentMethod: "PayPal", + }, + { + invoice: "INV003", + paymentStatus: "Unpaid", + totalAmount: "\$350.00", + paymentMethod: "Bank Transfer", + }, + { + invoice: "INV004", + paymentStatus: "Paid", + totalAmount: "\$450.00", + paymentMethod: "Credit Card", + }, + { + invoice: "INV005", + paymentStatus: "Paid", + totalAmount: "\$550.00", + paymentMethod: "PayPal", + }, + { + invoice: "INV006", + paymentStatus: "Pending", + totalAmount: "\$200.00", + paymentMethod: "Bank Transfer", + }, + { + invoice: "INV007", + paymentStatus: "Unpaid", + totalAmount: "\$300.00", + paymentMethod: "Credit Card", + }, +] + +export default function TableExample() { + return ( + + A list of your recent invoices. + + + Invoice + Status + Method + Amount + + + + {invoices.map((invoice) => ( + + {invoice.invoice} + {invoice.paymentStatus} + {invoice.paymentMethod} + {invoice.totalAmount} + + ))} + + + + Total + \$2,500.00 + + +
    + ) +} +`, + }, + "tabs": { + Component: TabsExample, + source: `import { + Button, + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, + Input, + Label, + Tabs, + TabsContent, + TabsList, + TabsTrigger, +} from "@databricks/appkit-ui/react" + +export default function TabsExample() { + return ( + + + Account + Password + + + + + Account + + Make changes to your account here. Click save when you're done. + + + +
    + + +
    +
    + + +
    +
    + + + +
    +
    + + + + Password + + Change your password here. After saving, you'll be logged out. + + + +
    + + +
    +
    + + +
    +
    + + + +
    +
    +
    + ) +} +`, + }, + "textarea": { + Component: TextareaExample, + source: `import { Textarea } from "@databricks/appkit-ui/react" + +export default function TextareaExample() { + return