@jini-ai/agent-plugins 0.6.16 → 0.6.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/NOTICE +14 -0
- package/README.md +35 -14
- package/charts-echarts/plugin.json +39 -0
- package/charts-echarts/skills/charts-echarts/SKILL.md +110 -0
- package/charts-recharts/plugin.json +32 -0
- package/charts-recharts/skills/charts-recharts/SKILL.md +108 -0
- package/cloudflare/NOTES.md +16 -0
- package/cloudflare/form-destinations/cloudflare-d1.mjs +9 -0
- package/cloudflare/lib/api.mjs +96 -0
- package/cloudflare/lib/assets.mjs +65 -0
- package/cloudflare/lib/dns.mjs +32 -0
- package/cloudflare/lib/domain-inventory.mjs +61 -0
- package/cloudflare/lib/domain-status.mjs +48 -0
- package/cloudflare/lib/domains.mjs +95 -0
- package/cloudflare/lib/forms.mjs +254 -0
- package/cloudflare/lib/pages-upload.mjs +51 -0
- package/cloudflare/lib/target.mjs +165 -0
- package/cloudflare/lib/workers-upload.mjs +48 -0
- package/cloudflare/lib/zones.mjs +25 -0
- package/cloudflare/mcp.json +4 -0
- package/cloudflare/plugin.json +96 -0
- package/cloudflare/skills/cloudflare/SKILL.md +57 -0
- package/cloudflare/skills/cloudflare/references/domains.md +31 -0
- package/cloudflare/skills/cloudflare/references/pages.md +18 -0
- package/cloudflare/skills/cloudflare/references/permissions.md +29 -0
- package/cloudflare/skills/cloudflare/references/troubleshooting.md +20 -0
- package/cloudflare/skills/cloudflare/references/workers.md +42 -0
- package/cloudflare/targets/cloudflare-pages.mjs +12 -0
- package/cloudflare/targets/cloudflare-workers.mjs +17 -0
- package/cloudflare/tovu-consent.json +6 -0
- package/cloudflare/tovu-deploy-targets.json +630 -0
- package/cloudflare/tovu-form-destinations.json +12 -0
- package/cloudflare/worker/forms-receiver.mjs +249 -0
- package/composio/mcp.json +10 -0
- package/composio/plugin.json +68 -0
- package/composio/skills/composio/SKILL.md +85 -0
- package/dist/core/identity-namespace.d.ts +12 -0
- package/dist/core/identity-namespace.js +20 -0
- package/dist/folder-zip-node.js +29 -7
- package/dist/lifecycle/bundled-digests.js +4 -3
- package/dist/lifecycle/install.d.ts +7 -0
- package/dist/lifecycle/install.js +45 -3
- package/dist/lifecycle/manifest.d.ts +2 -2
- package/dist/lifecycle/manifest.js +5 -3
- package/dist/lifecycle/node.js +2 -0
- package/dist/lifecycle/persistent-state.js +1 -1
- package/dist/lifecycle/ports.d.ts +8 -0
- package/dist/lifecycle/seed-bundled.js +4 -1
- package/dist/manifest.d.ts +1 -1
- package/dist/manifest.js +3 -2
- package/fly/deploy-configs/fly.mjs +115 -0
- package/fly/deploy-ops/fly.mjs +102 -0
- package/fly/mcp.json +4 -0
- package/fly/plugin.json +81 -0
- package/fly/scripts/render-deploy-workflow.mjs +150 -0
- package/fly/skills/fly/SKILL.md +43 -0
- package/fly/skills/fly/references/fly-deploy.template.yml +117 -0
- package/fly/skills/fly/references/fly.template.toml +81 -0
- package/fly/tovu-credential-schemes.json +11 -0
- package/fly/tovu-deploy-configs.json +21 -0
- package/fly/tovu-deploy-ops.json +14 -0
- package/github/deploy-ops/github-actions.mjs +164 -0
- package/github/deployments/github.mjs +415 -0
- package/github/mcp.json +4 -0
- package/github/plugin.json +105 -0
- package/github/skills/github/SKILL.md +249 -0
- package/github/skills/github/references/actions.md +224 -0
- package/github/skills/github/references/auth-and-tokens.md +140 -0
- package/github/skills/github/references/repo-files.md +135 -0
- package/github/skills/github/references/site-backup.md +159 -0
- package/github/skills/github/references/source-control.md +123 -0
- package/github/source-control/backup-push.mjs +242 -0
- package/github/source-control/commit-site.mjs +459 -0
- package/github/source-control/github.mjs +93 -0
- package/github/source-control/write-files.mjs +468 -0
- package/github/tovu-deploy-ops.json +13 -0
- package/github/tovu-source-control.json +117 -0
- package/github-pages/NOTES.md +19 -0
- package/github-pages/mcp.json +4 -0
- package/github-pages/plugin.json +48 -0
- package/github-pages/skills/github-pages/SKILL.md +44 -0
- package/github-pages/targets/github-pages.mjs +543 -0
- package/github-pages/tovu-deploy-targets.json +327 -0
- package/google-login/exports/google-g.svg +1 -0
- package/google-login/exports/sign-in-button.css +68 -0
- package/google-login/exports/sign-in-button.html +4 -0
- package/google-login/mcp.json +4 -0
- package/google-login/plugin.json +59 -0
- package/google-login/skills/google-login/SKILL.md +96 -0
- package/google-login/tovu-login-providers.json +21 -0
- package/google-workspace/README.md +132 -0
- package/google-workspace/form-destinations/README.md +87 -0
- package/google-workspace/form-destinations/dedupe.mjs +43 -0
- package/google-workspace/form-destinations/delivery-result.mjs +69 -0
- package/google-workspace/form-destinations/mapping.mjs +152 -0
- package/google-workspace/form-destinations/sheets.mjs +202 -0
- package/google-workspace/lib/auth.mjs +81 -0
- package/google-workspace/lib/drive-files.mjs +54 -0
- package/google-workspace/lib/form-destination-settings.mjs +72 -0
- package/google-workspace/lib/http.mjs +168 -0
- package/google-workspace/lib/picker-flow.mjs +171 -0
- package/google-workspace/lib/picker-selection.mjs +107 -0
- package/google-workspace/lib/product-state.mjs +93 -0
- package/google-workspace/lib/request-policy.mjs +163 -0
- package/google-workspace/lib/sheets-a1.mjs +79 -0
- package/google-workspace/lib/sheets-admin-csv.mjs +82 -0
- package/google-workspace/lib/sheets-admin-request-kinds.mjs +183 -0
- package/google-workspace/lib/sheets-client.mjs +286 -0
- package/google-workspace/lib/surface-actions.mjs +107 -0
- package/google-workspace/mcp.json +4 -0
- package/google-workspace/plugin.json +77 -0
- package/google-workspace/products.json +12 -0
- package/google-workspace/skills/google-workspace/SKILL.md +82 -0
- package/google-workspace/skills/google-workspace/references/connection.md +102 -0
- package/google-workspace/skills/google-workspace/references/form-delivery.md +50 -0
- package/google-workspace/skills/google-workspace/references/sheets.md +149 -0
- package/google-workspace/skills/google-workspace/references/troubleshooting.md +31 -0
- package/google-workspace/tools/account-info.mjs +18 -0
- package/google-workspace/tools/sheets/README.md +54 -0
- package/google-workspace/tools/sheets/copy-tab.mjs +23 -0
- package/google-workspace/tools/sheets/copy.mjs +23 -0
- package/google-workspace/tools/sheets/create.mjs +35 -0
- package/google-workspace/tools/sheets/find-replace.mjs +38 -0
- package/google-workspace/tools/sheets/find.mjs +52 -0
- package/google-workspace/tools/sheets/get-by-data-filter.mjs +23 -0
- package/google-workspace/tools/sheets/get.mjs +22 -0
- package/google-workspace/tools/sheets/values-append.mjs +27 -0
- package/google-workspace/tools/sheets/values-batch-clear.mjs +20 -0
- package/google-workspace/tools/sheets/values-batch-get.mjs +20 -0
- package/google-workspace/tools/sheets/values-batch-update.mjs +29 -0
- package/google-workspace/tools/sheets/values-by-data-filter.mjs +62 -0
- package/google-workspace/tools/sheets/values-clear.mjs +20 -0
- package/google-workspace/tools/sheets/values-get.mjs +21 -0
- package/google-workspace/tools/sheets/values-update.mjs +26 -0
- package/google-workspace/tools/sheets-admin/README.md +45 -0
- package/google-workspace/tools/sheets-admin/basic-filter.mjs +32 -0
- package/google-workspace/tools/sheets-admin/batch-update.mjs +25 -0
- package/google-workspace/tools/sheets-admin/developer-metadata.mjs +28 -0
- package/google-workspace/tools/sheets-admin/export-csv.mjs +67 -0
- package/google-workspace/tools/sheets-admin/filter-views.mjs +38 -0
- package/google-workspace/tools/sheets-admin/format.mjs +70 -0
- package/google-workspace/tools/sheets-admin/named-ranges.mjs +42 -0
- package/google-workspace/tools/sheets-admin/open-existing.mjs +34 -0
- package/google-workspace/tools/sheets-admin/protected-ranges-get.mjs +18 -0
- package/google-workspace/tools/sheets-admin/sort.mjs +18 -0
- package/google-workspace/tools/sheets-admin/tab-modify.mjs +36 -0
- package/google-workspace/tovu-admin-surfaces.json +63 -0
- package/google-workspace/tovu-agent-tools.json +1178 -0
- package/google-workspace/tovu-connections.json +35 -0
- package/google-workspace/tovu-form-destinations.json +10 -0
- package/google-workspace/ui/README.md +73 -0
- package/google-workspace/ui/connection-panel.handler.mjs +167 -0
- package/google-workspace/ui/connection-panel.html +17 -0
- package/google-workspace/ui/connection-panel.mjs +189 -0
- package/google-workspace/ui/connection-view.mjs +120 -0
- package/google-workspace/ui/destination-panel.handler.mjs +106 -0
- package/google-workspace/ui/destination-panel.html +17 -0
- package/google-workspace/ui/destination-panel.mjs +150 -0
- package/google-workspace/ui/dom.mjs +140 -0
- package/google-workspace/ui/panel.css +170 -0
- package/google-workspace/ui/picker-flow.mjs +87 -0
- package/google-workspace/ui/picker-view.mjs +44 -0
- package/google-workspace/ui/picker.handler.mjs +56 -0
- package/google-workspace/ui/picker.html +17 -0
- package/google-workspace/ui/picker.mjs +88 -0
- package/google-workspace/ui/surface-client.mjs +227 -0
- package/higgsfield-media/mcp.json +9 -0
- package/higgsfield-media/plugin.json +109 -0
- package/higgsfield-media/skills/higgsfield-media/SKILL.md +325 -0
- package/higgsfield-media/skills/higgsfield-media/references/failure-modes.md +116 -0
- package/higgsfield-media/skills/higgsfield-media/references/models-and-plan-gates.md +142 -0
- package/jev/mcp.json +4 -0
- package/jev/plugin.json +44 -0
- package/jev/skills/jev/SKILL.md +308 -0
- package/jev/skills/jev/references/cookbooks.md +197 -0
- package/jev/skills/jev/references/jaggedness.md +135 -0
- package/jev/skills/jev/references/javascript-sdk.md +146 -0
- package/jev/skills/jev/references/patterns.md +123 -0
- package/jev/skills/jev/references/primitives-reference.md +187 -0
- package/langfuse/plugin.json +22 -0
- package/meilisearch/mcp.json +4 -0
- package/meilisearch/plugin.json +54 -0
- package/meilisearch/providers/meilisearch.mjs +651 -0
- package/meilisearch/skills/meilisearch/SKILL.md +43 -0
- package/meilisearch/tovu-search-providers.json +10 -0
- package/netlify/NOTES.md +13 -0
- package/netlify/mcp.json +4 -0
- package/netlify/plugin.json +47 -0
- package/netlify/skills/netlify/SKILL.md +39 -0
- package/netlify/targets/netlify.mjs +384 -0
- package/netlify/tovu-consent.json +6 -0
- package/netlify/tovu-deploy-targets.json +163 -0
- package/opentelemetry/mcp.json +4 -0
- package/opentelemetry/plugin.json +52 -0
- package/opentelemetry/skills/opentelemetry/SKILL.md +39 -0
- package/package.json +161 -6
- package/posthog/mcp.json +4 -0
- package/posthog/plugin.json +46 -0
- package/posthog/skills/posthog/SKILL.md +36 -0
- package/railway/deploy-configs/railway.mjs +135 -0
- package/railway/deploy-ops/railway.mjs +167 -0
- package/railway/mcp.json +4 -0
- package/railway/plugin.json +45 -0
- package/railway/skills/railway/SKILL.md +66 -0
- package/railway/tovu-deploy-configs.json +16 -0
- package/railway/tovu-deploy-ops.json +11 -0
- package/render/deploy-configs/render.mjs +141 -0
- package/render/deploy-ops/render.mjs +152 -0
- package/render/mcp.json +4 -0
- package/render/plugin.json +47 -0
- package/render/skills/render/SKILL.md +63 -0
- package/render/tovu-deploy-configs.json +16 -0
- package/render/tovu-deploy-ops.json +11 -0
- package/resend/NOTES.md +52 -0
- package/resend/adapters/resend.mjs +161 -0
- package/resend/lib/domains.mjs +137 -0
- package/resend/lib/errors.mjs +25 -0
- package/resend/lib/feedback.mjs +118 -0
- package/resend/mcp.json +13 -0
- package/resend/plugin.json +192 -0
- package/resend/skills/resend/SKILL.md +107 -0
- package/resend/tovu-mail-adapters.json +22 -0
- package/s3-compatible/NOTES.md +11 -0
- package/s3-compatible/mcp.json +4 -0
- package/s3-compatible/object-stores/s3-compatible.mjs +287 -0
- package/s3-compatible/plugin.json +56 -0
- package/s3-compatible/skills/s3-compatible/SKILL.md +39 -0
- package/s3-compatible/targets/s3-compatible.mjs +1054 -0
- package/s3-compatible/tovu-deploy-targets.json +432 -0
- package/s3-compatible/tovu-object-stores.json +29 -0
- package/sentry/mcp.json +4 -0
- package/sentry/plugin.json +49 -0
- package/sentry/skills/sentry/SKILL.md +34 -0
- package/shopify/mcp.json +4 -0
- package/shopify/plugin.json +22 -0
- package/shopify/skills/shopify/SKILL.md +103 -0
- package/shopify/skills/shopify/references/catalog-sync.md +74 -0
- package/shopify/skills/shopify/references/domains.md +26 -0
- package/shopify/skills/shopify/references/live-storefront.md +34 -0
- package/shopify/skills/shopify/references/storefront-snippets.md +21 -0
- package/site-compliance/mcp.json +4 -0
- package/site-compliance/plugin.json +34 -0
- package/site-compliance/skills/site-compliance/SKILL.md +220 -0
- package/site-compliance/skills/site-compliance/references/ccpa-cpra.md +115 -0
- package/site-compliance/skills/site-compliance/references/gdpr-eu-uk.md +143 -0
- package/site-compliance/skills/site-compliance/references/wcag-2-2.md +129 -0
- package/site-import/mcp.json +4 -0
- package/site-import/plugin.json +41 -0
- package/site-import/skills/site-import/SKILL.md +232 -0
- package/site-import/skills/site-import/references/content-mapping.md +166 -0
- package/site-import/skills/site-import/references/discovery-and-classification.md +117 -0
- package/site-import/skills/site-import/references/theme-extraction.md +34 -0
- package/slide-design/com.anthropic.claude-code/hooks/hooks.json +4 -0
- package/slide-design/mcp.json +4 -0
- package/slide-design/plugin.json +26 -0
- package/slide-design/skills/slide-design/SKILL.md +103 -0
- package/slide-design/skills/slide-design/references/charts-and-exhibits.md +100 -0
- package/slide-design/skills/slide-design/references/html-deck.md +175 -0
- package/slide-design/skills/slide-design/references/layout-and-style.md +131 -0
- package/slide-design/skills/slide-design/references/review.md +93 -0
- package/slide-design/skills/slide-design/references/storyline.md +118 -0
- package/stripe/plugin.json +22 -0
- package/supabase/mcp.json +26 -0
- package/supabase/plugin.json +78 -0
- package/supabase/skills/supabase/SKILL.md +169 -0
- package/supabase/skills/supabase/references/failure-modes.md +101 -0
- package/ui-ux-design/CHANGELOG.md +28 -0
- package/ui-ux-design/LICENSE +201 -0
- package/ui-ux-design/NOTICE +14 -0
- package/ui-ux-design/README.md +62 -0
- package/ui-ux-design/com.anthropic.claude-code/hooks/hooks.json +4 -0
- package/ui-ux-design/mcp.json +4 -0
- package/ui-ux-design/plugin.json +26 -0
- package/ui-ux-design/skills/frontend-accessibility/SKILL.md +60 -0
- package/ui-ux-design/skills/gstack-design/SKILL.md +53 -0
- package/ui-ux-design/skills/gstack-design/references/consultation.md +30 -0
- package/ui-ux-design/skills/gstack-design/references/html.md +29 -0
- package/ui-ux-design/skills/gstack-design/references/review.md +28 -0
- package/ui-ux-design/skills/gstack-design/references/shotgun.md +33 -0
- package/ui-ux-design/skills/gstack-design/references/upstream-notes.md +23 -0
- package/ui-ux-design/skills/interface-design/ORIGINAL.md +16 -0
- package/ui-ux-design/skills/interface-design/SKILL.md +41 -0
- package/ui-ux-design/skills/interface-design/references/commands/audit.md +40 -0
- package/ui-ux-design/skills/interface-design/references/commands/critique.md +21 -0
- package/ui-ux-design/skills/interface-design/references/commands/extract.md +34 -0
- package/ui-ux-design/skills/interface-design/references/commands/init.md +31 -0
- package/ui-ux-design/skills/interface-design/references/commands/status.md +22 -0
- package/ui-ux-design/skills/interface-design/references/examples/system-precision.md +29 -0
- package/ui-ux-design/skills/interface-design/references/examples/system-warmth.md +29 -0
- package/ui-ux-design/skills/interface-design/references/system-template.md +57 -0
- package/ui-ux-design/skills/shadcn-ui/README.md +244 -0
- package/ui-ux-design/skills/shadcn-ui/SKILL.md +333 -0
- package/ui-ux-design/skills/shadcn-ui/examples/auth-layout.tsx +177 -0
- package/ui-ux-design/skills/shadcn-ui/examples/data-table.tsx +313 -0
- package/ui-ux-design/skills/shadcn-ui/examples/form-pattern.tsx +177 -0
- package/ui-ux-design/skills/shadcn-ui/resources/component-catalog.md +481 -0
- package/ui-ux-design/skills/shadcn-ui/resources/customization-guide.md +516 -0
- package/ui-ux-design/skills/shadcn-ui/resources/migration-guide.md +463 -0
- package/ui-ux-design/skills/shadcn-ui/resources/setup-guide.md +412 -0
- package/ui-ux-design/skills/shadcn-ui/scripts/verify-setup.sh +134 -0
- package/ui-ux-design/skills/ui-ux-design/SKILL.md +171 -0
- package/ui-ux-design/skills/ui-ux-design/references/brand-and-voice.md +78 -0
- package/ui-ux-design/skills/ui-ux-design/references/chrome-mobile-test-matrix.md +137 -0
- package/ui-ux-design/skills/ui-ux-design/references/components-and-states.md +112 -0
- package/ui-ux-design/skills/ui-ux-design/references/delight-and-motion.md +54 -0
- package/ui-ux-design/skills/ui-ux-design/references/foundations.md +145 -0
- package/ui-ux-design/skills/ui-ux-design/references/inclusive-ai-imagery.md +57 -0
- package/ui-ux-design/skills/ui-ux-design/references/kole-jain-uiux-concepts.md +104 -0
- package/ui-ux-design/skills/ui-ux-design/references/kuinetic-reference.md +184 -0
- package/ui-ux-design/skills/ui-ux-design/references/openai-frontend-skill.md +139 -0
- package/ui-ux-design/skills/ui-ux-design/references/premium-ui.md +55 -0
- package/ui-ux-design/skills/ui-ux-design/references/research-and-validation.md +88 -0
- package/ui-ux-design/skills/ui-ux-design/references/sam-crawford-premium-websites.md +103 -0
- package/ui-ux-design/skills/ui-ux-design/references/self-made-web-designer-core-skills.md +119 -0
- package/ui-ux-design/skills/ui-ux-design/references/ui-animation.md +173 -0
- package/ui-ux-design/skills/ui-ux-design/references/ui-loop.md +234 -0
- package/ui-ux-design/skills/ui-ux-design/references/visual-storytelling.md +54 -0
- package/ui-ux-design/skills/vercel-web-design-guidelines/SKILL.md +39 -0
- package/ui-ux-design/skills/web-compliance/SKILL.md +134 -0
- package/ui-ux-design/skills/web-compliance/references/audit-evidence.md +59 -0
- package/vercel/NOTES.md +23 -0
- package/vercel/mcp.json +4 -0
- package/vercel/object-stores/vercel-blob.mjs +147 -0
- package/vercel/plugin.json +47 -0
- package/vercel/skills/vercel/SKILL.md +48 -0
- package/vercel/targets/vercel.mjs +586 -0
- package/vercel/tovu-consent.json +6 -0
- package/vercel/tovu-deploy-targets.json +219 -0
- package/vercel/tovu-object-stores.json +10 -0
- package/wordpress/NOTES.md +33 -0
- package/wordpress/plugin.json +30 -0
- package/wordpress/skills/wordpress/SKILL.md +43 -0
- package/wordpress/skills/wordpress/references/free-site-redirect.md +46 -0
- package/wordpress/skills/wordpress/references/subdomain.md +66 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
// Example: Data Table with Sorting and Filtering
|
|
2
|
+
// Demonstrates: Table composition, TanStack Table integration, responsive design
|
|
3
|
+
|
|
4
|
+
"use client"
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ColumnDef,
|
|
8
|
+
ColumnFiltersState,
|
|
9
|
+
flexRender,
|
|
10
|
+
getCoreRowModel,
|
|
11
|
+
getFilteredRowModel,
|
|
12
|
+
getPaginationRowModel,
|
|
13
|
+
getSortedRowModel,
|
|
14
|
+
SortingState,
|
|
15
|
+
useReactTable,
|
|
16
|
+
} from "@tanstack/react-table"
|
|
17
|
+
import { ArrowUpDown, ChevronDown, MoreHorizontal } from "lucide-react"
|
|
18
|
+
import * as React from "react"
|
|
19
|
+
|
|
20
|
+
import { Button } from "@/components/ui/button"
|
|
21
|
+
import {
|
|
22
|
+
DropdownMenu,
|
|
23
|
+
DropdownMenuCheckboxItem,
|
|
24
|
+
DropdownMenuContent,
|
|
25
|
+
DropdownMenuItem,
|
|
26
|
+
DropdownMenuLabel,
|
|
27
|
+
DropdownMenuSeparator,
|
|
28
|
+
DropdownMenuTrigger,
|
|
29
|
+
} from "@/components/ui/dropdown-menu"
|
|
30
|
+
import { Input } from "@/components/ui/input"
|
|
31
|
+
import {
|
|
32
|
+
Table,
|
|
33
|
+
TableBody,
|
|
34
|
+
TableCell,
|
|
35
|
+
TableHead,
|
|
36
|
+
TableHeader,
|
|
37
|
+
TableRow,
|
|
38
|
+
} from "@/components/ui/table"
|
|
39
|
+
|
|
40
|
+
// Define data type
|
|
41
|
+
export type User = {
|
|
42
|
+
id: string
|
|
43
|
+
name: string
|
|
44
|
+
email: string
|
|
45
|
+
role: "admin" | "user" | "viewer"
|
|
46
|
+
status: "active" | "inactive"
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Sample data
|
|
50
|
+
const data: User[] = [
|
|
51
|
+
{
|
|
52
|
+
id: "1",
|
|
53
|
+
name: "Alice Johnson",
|
|
54
|
+
email: "alice@example.com",
|
|
55
|
+
role: "admin",
|
|
56
|
+
status: "active",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "2",
|
|
60
|
+
name: "Bob Smith",
|
|
61
|
+
email: "bob@example.com",
|
|
62
|
+
role: "user",
|
|
63
|
+
status: "active",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "3",
|
|
67
|
+
name: "Carol White",
|
|
68
|
+
email: "carol@example.com",
|
|
69
|
+
role: "viewer",
|
|
70
|
+
status: "inactive",
|
|
71
|
+
},
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
// Define columns
|
|
75
|
+
export const columns: ColumnDef<User>[] = [
|
|
76
|
+
{
|
|
77
|
+
accessorKey: "name",
|
|
78
|
+
header: ({ column }) => {
|
|
79
|
+
return (
|
|
80
|
+
<Button
|
|
81
|
+
variant="ghost"
|
|
82
|
+
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
|
|
83
|
+
>
|
|
84
|
+
Name
|
|
85
|
+
<ArrowUpDown className="ml-2 h-4 w-4" />
|
|
86
|
+
</Button>
|
|
87
|
+
)
|
|
88
|
+
},
|
|
89
|
+
cell: ({ row }) => <div className="capitalize">{row.getValue("name")}</div>,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
accessorKey: "email",
|
|
93
|
+
header: ({ column }) => {
|
|
94
|
+
return (
|
|
95
|
+
<Button
|
|
96
|
+
variant="ghost"
|
|
97
|
+
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
|
|
98
|
+
>
|
|
99
|
+
Email
|
|
100
|
+
<ArrowUpDown className="ml-2 h-4 w-4" />
|
|
101
|
+
</Button>
|
|
102
|
+
)
|
|
103
|
+
},
|
|
104
|
+
cell: ({ row }) => <div className="lowercase">{row.getValue("email")}</div>,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
accessorKey: "role",
|
|
108
|
+
header: "Role",
|
|
109
|
+
cell: ({ row }) => (
|
|
110
|
+
<div className="capitalize">{row.getValue("role")}</div>
|
|
111
|
+
),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
accessorKey: "status",
|
|
115
|
+
header: "Status",
|
|
116
|
+
cell: ({ row }) => (
|
|
117
|
+
<div className="capitalize">{row.getValue("status")}</div>
|
|
118
|
+
),
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: "actions",
|
|
122
|
+
enableHiding: false,
|
|
123
|
+
cell: ({ row }) => {
|
|
124
|
+
const user = row.original
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<DropdownMenu>
|
|
128
|
+
<DropdownMenuTrigger asChild>
|
|
129
|
+
<Button variant="ghost" className="h-8 w-8 p-0">
|
|
130
|
+
<span className="sr-only">Open menu</span>
|
|
131
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
132
|
+
</Button>
|
|
133
|
+
</DropdownMenuTrigger>
|
|
134
|
+
<DropdownMenuContent align="end">
|
|
135
|
+
<DropdownMenuLabel>Actions</DropdownMenuLabel>
|
|
136
|
+
<DropdownMenuItem
|
|
137
|
+
onClick={() => navigator.clipboard.writeText(user.id)}
|
|
138
|
+
>
|
|
139
|
+
Copy user ID
|
|
140
|
+
</DropdownMenuItem>
|
|
141
|
+
<DropdownMenuSeparator />
|
|
142
|
+
<DropdownMenuItem>View user</DropdownMenuItem>
|
|
143
|
+
<DropdownMenuItem>Edit user</DropdownMenuItem>
|
|
144
|
+
</DropdownMenuContent>
|
|
145
|
+
</DropdownMenu>
|
|
146
|
+
)
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
export function DataTableExample() {
|
|
152
|
+
const [sorting, setSorting] = React.useState<SortingState>([])
|
|
153
|
+
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>([])
|
|
154
|
+
const [columnVisibility, setColumnVisibility] = React.useState({})
|
|
155
|
+
const [rowSelection, setRowSelection] = React.useState({})
|
|
156
|
+
|
|
157
|
+
const table = useReactTable({
|
|
158
|
+
data,
|
|
159
|
+
columns,
|
|
160
|
+
onSortingChange: setSorting,
|
|
161
|
+
onColumnFiltersChange: setColumnFilters,
|
|
162
|
+
getCoreRowModel: getCoreRowModel(),
|
|
163
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
164
|
+
getSortedRowModel: getSortedRowModel(),
|
|
165
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
166
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
167
|
+
onRowSelectionChange: setRowSelection,
|
|
168
|
+
state: {
|
|
169
|
+
sorting,
|
|
170
|
+
columnFilters,
|
|
171
|
+
columnVisibility,
|
|
172
|
+
rowSelection,
|
|
173
|
+
},
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<div className="w-full">
|
|
178
|
+
<div className="flex items-center py-4">
|
|
179
|
+
<Input
|
|
180
|
+
placeholder="Filter names..."
|
|
181
|
+
value={(table.getColumn("name")?.getFilterValue() as string) ?? ""}
|
|
182
|
+
onChange={(event) =>
|
|
183
|
+
table.getColumn("name")?.setFilterValue(event.target.value)
|
|
184
|
+
}
|
|
185
|
+
className="max-w-sm"
|
|
186
|
+
/>
|
|
187
|
+
<DropdownMenu>
|
|
188
|
+
<DropdownMenuTrigger asChild>
|
|
189
|
+
<Button variant="outline" className="ml-auto">
|
|
190
|
+
Columns <ChevronDown className="ml-2 h-4 w-4" />
|
|
191
|
+
</Button>
|
|
192
|
+
</DropdownMenuTrigger>
|
|
193
|
+
<DropdownMenuContent align="end">
|
|
194
|
+
{table
|
|
195
|
+
.getAllColumns()
|
|
196
|
+
.filter((column) => column.getCanHide())
|
|
197
|
+
.map((column) => {
|
|
198
|
+
return (
|
|
199
|
+
<DropdownMenuCheckboxItem
|
|
200
|
+
key={column.id}
|
|
201
|
+
className="capitalize"
|
|
202
|
+
checked={column.getIsVisible()}
|
|
203
|
+
onCheckedChange={(value) =>
|
|
204
|
+
column.toggleVisibility(!!value)
|
|
205
|
+
}
|
|
206
|
+
>
|
|
207
|
+
{column.id}
|
|
208
|
+
</DropdownMenuCheckboxItem>
|
|
209
|
+
)
|
|
210
|
+
})}
|
|
211
|
+
</DropdownMenuContent>
|
|
212
|
+
</DropdownMenu>
|
|
213
|
+
</div>
|
|
214
|
+
<div className="rounded-md border">
|
|
215
|
+
<Table>
|
|
216
|
+
<TableHeader>
|
|
217
|
+
{table.getHeaderGroups().map((headerGroup) => (
|
|
218
|
+
<TableRow key={headerGroup.id}>
|
|
219
|
+
{headerGroup.headers.map((header) => {
|
|
220
|
+
return (
|
|
221
|
+
<TableHead key={header.id}>
|
|
222
|
+
{header.isPlaceholder
|
|
223
|
+
? null
|
|
224
|
+
: flexRender(
|
|
225
|
+
header.column.columnDef.header,
|
|
226
|
+
header.getContext()
|
|
227
|
+
)}
|
|
228
|
+
</TableHead>
|
|
229
|
+
)
|
|
230
|
+
})}
|
|
231
|
+
</TableRow>
|
|
232
|
+
))}
|
|
233
|
+
</TableHeader>
|
|
234
|
+
<TableBody>
|
|
235
|
+
{table.getRowModel().rows?.length ? (
|
|
236
|
+
table.getRowModel().rows.map((row) => (
|
|
237
|
+
<TableRow
|
|
238
|
+
key={row.id}
|
|
239
|
+
data-state={row.getIsSelected() && "selected"}
|
|
240
|
+
>
|
|
241
|
+
{row.getVisibleCells().map((cell) => (
|
|
242
|
+
<TableCell key={cell.id}>
|
|
243
|
+
{flexRender(
|
|
244
|
+
cell.column.columnDef.cell,
|
|
245
|
+
cell.getContext()
|
|
246
|
+
)}
|
|
247
|
+
</TableCell>
|
|
248
|
+
))}
|
|
249
|
+
</TableRow>
|
|
250
|
+
))
|
|
251
|
+
) : (
|
|
252
|
+
<TableRow>
|
|
253
|
+
<TableCell
|
|
254
|
+
colSpan={columns.length}
|
|
255
|
+
className="h-24 text-center"
|
|
256
|
+
>
|
|
257
|
+
No results.
|
|
258
|
+
</TableCell>
|
|
259
|
+
</TableRow>
|
|
260
|
+
)}
|
|
261
|
+
</TableBody>
|
|
262
|
+
</Table>
|
|
263
|
+
</div>
|
|
264
|
+
<div className="flex items-center justify-end space-x-2 py-4">
|
|
265
|
+
<div className="flex-1 text-sm text-muted-foreground">
|
|
266
|
+
{table.getFilteredSelectedRowModel().rows.length} of{" "}
|
|
267
|
+
{table.getFilteredRowModel().rows.length} row(s) selected.
|
|
268
|
+
</div>
|
|
269
|
+
<div className="space-x-2">
|
|
270
|
+
<Button
|
|
271
|
+
variant="outline"
|
|
272
|
+
size="sm"
|
|
273
|
+
onClick={() => table.previousPage()}
|
|
274
|
+
disabled={!table.getCanPreviousPage()}
|
|
275
|
+
>
|
|
276
|
+
Previous
|
|
277
|
+
</Button>
|
|
278
|
+
<Button
|
|
279
|
+
variant="outline"
|
|
280
|
+
size="sm"
|
|
281
|
+
onClick={() => table.nextPage()}
|
|
282
|
+
disabled={!table.getCanNextPage()}
|
|
283
|
+
>
|
|
284
|
+
Next
|
|
285
|
+
</Button>
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
</div>
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Key Patterns Demonstrated:
|
|
294
|
+
*
|
|
295
|
+
* 1. TanStack Table Integration: Using @tanstack/react-table with shadcn/ui
|
|
296
|
+
* 2. Sorting: Click headers to sort ascending/descending
|
|
297
|
+
* 3. Filtering: Text input to filter table data
|
|
298
|
+
* 4. Column Visibility: Toggle columns via dropdown menu
|
|
299
|
+
* 5. Pagination: Built-in pagination controls
|
|
300
|
+
* 6. Row Actions: Dropdown menu per row for context actions
|
|
301
|
+
* 7. Responsive Design: Table adapts to different screen sizes
|
|
302
|
+
*
|
|
303
|
+
* Required Dependencies:
|
|
304
|
+
* - @tanstack/react-table
|
|
305
|
+
* - lucide-react
|
|
306
|
+
*
|
|
307
|
+
* Installation:
|
|
308
|
+
* npx shadcn@latest add table
|
|
309
|
+
* npx shadcn@latest add button
|
|
310
|
+
* npx shadcn@latest add input
|
|
311
|
+
* npx shadcn@latest add dropdown-menu
|
|
312
|
+
* npm install @tanstack/react-table lucide-react
|
|
313
|
+
*/
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// Example: Form Pattern with shadcn/ui components
|
|
2
|
+
// Demonstrates: Form building, validation, and composition
|
|
3
|
+
|
|
4
|
+
"use client"
|
|
5
|
+
|
|
6
|
+
import { Button } from "@/components/ui/button"
|
|
7
|
+
import {
|
|
8
|
+
Form,
|
|
9
|
+
FormControl,
|
|
10
|
+
FormDescription,
|
|
11
|
+
FormField,
|
|
12
|
+
FormItem,
|
|
13
|
+
FormLabel,
|
|
14
|
+
FormMessage,
|
|
15
|
+
} from "@/components/ui/form"
|
|
16
|
+
import { Input } from "@/components/ui/input"
|
|
17
|
+
import {
|
|
18
|
+
Select,
|
|
19
|
+
SelectContent,
|
|
20
|
+
SelectItem,
|
|
21
|
+
SelectTrigger,
|
|
22
|
+
SelectValue,
|
|
23
|
+
} from "@/components/ui/select"
|
|
24
|
+
import { Textarea } from "@/components/ui/textarea"
|
|
25
|
+
import { toast } from "@/components/ui/use-toast"
|
|
26
|
+
import { zodResolver } from "@hookform/resolvers/zod"
|
|
27
|
+
import { useForm } from "react-hook-form"
|
|
28
|
+
import * as z from "zod"
|
|
29
|
+
|
|
30
|
+
// Define form schema with zod
|
|
31
|
+
const formSchema = z.object({
|
|
32
|
+
username: z.string().min(2, {
|
|
33
|
+
message: "Username must be at least 2 characters.",
|
|
34
|
+
}),
|
|
35
|
+
email: z.string().email({
|
|
36
|
+
message: "Please enter a valid email address.",
|
|
37
|
+
}),
|
|
38
|
+
role: z.enum(["admin", "user", "viewer"], {
|
|
39
|
+
required_error: "Please select a role.",
|
|
40
|
+
}),
|
|
41
|
+
bio: z.string().max(160, {
|
|
42
|
+
message: "Bio must not be longer than 160 characters.",
|
|
43
|
+
}).optional(),
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
type FormValues = z.infer<typeof formSchema>
|
|
47
|
+
|
|
48
|
+
export function UserProfileForm() {
|
|
49
|
+
// Initialize form with react-hook-form and zod validation
|
|
50
|
+
const form = useForm<FormValues>({
|
|
51
|
+
resolver: zodResolver(formSchema),
|
|
52
|
+
defaultValues: {
|
|
53
|
+
username: "",
|
|
54
|
+
email: "",
|
|
55
|
+
bio: "",
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
// Handle form submission
|
|
60
|
+
function onSubmit(values: FormValues) {
|
|
61
|
+
// In a real app, send to API
|
|
62
|
+
console.log(values)
|
|
63
|
+
|
|
64
|
+
toast({
|
|
65
|
+
title: "Profile updated",
|
|
66
|
+
description: "Your profile has been successfully updated.",
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<Form {...form}>
|
|
72
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
|
73
|
+
<FormField
|
|
74
|
+
control={form.control}
|
|
75
|
+
name="username"
|
|
76
|
+
render={({ field }) => (
|
|
77
|
+
<FormItem>
|
|
78
|
+
<FormLabel>Username</FormLabel>
|
|
79
|
+
<FormControl>
|
|
80
|
+
<Input placeholder="johndoe" {...field} />
|
|
81
|
+
</FormControl>
|
|
82
|
+
<FormDescription>
|
|
83
|
+
This is your public display name.
|
|
84
|
+
</FormDescription>
|
|
85
|
+
<FormMessage />
|
|
86
|
+
</FormItem>
|
|
87
|
+
)}
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
<FormField
|
|
91
|
+
control={form.control}
|
|
92
|
+
name="email"
|
|
93
|
+
render={({ field }) => (
|
|
94
|
+
<FormItem>
|
|
95
|
+
<FormLabel>Email</FormLabel>
|
|
96
|
+
<FormControl>
|
|
97
|
+
<Input type="email" placeholder="john@example.com" {...field} />
|
|
98
|
+
</FormControl>
|
|
99
|
+
<FormMessage />
|
|
100
|
+
</FormItem>
|
|
101
|
+
)}
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
<FormField
|
|
105
|
+
control={form.control}
|
|
106
|
+
name="role"
|
|
107
|
+
render={({ field }) => (
|
|
108
|
+
<FormItem>
|
|
109
|
+
<FormLabel>Role</FormLabel>
|
|
110
|
+
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
|
111
|
+
<FormControl>
|
|
112
|
+
<SelectTrigger>
|
|
113
|
+
<SelectValue placeholder="Select a role" />
|
|
114
|
+
</SelectTrigger>
|
|
115
|
+
</FormControl>
|
|
116
|
+
<SelectContent>
|
|
117
|
+
<SelectItem value="admin">Admin</SelectItem>
|
|
118
|
+
<SelectItem value="user">User</SelectItem>
|
|
119
|
+
<SelectItem value="viewer">Viewer</SelectItem>
|
|
120
|
+
</SelectContent>
|
|
121
|
+
</Select>
|
|
122
|
+
<FormDescription>
|
|
123
|
+
Your role determines your access level.
|
|
124
|
+
</FormDescription>
|
|
125
|
+
<FormMessage />
|
|
126
|
+
</FormItem>
|
|
127
|
+
)}
|
|
128
|
+
/>
|
|
129
|
+
|
|
130
|
+
<FormField
|
|
131
|
+
control={form.control}
|
|
132
|
+
name="bio"
|
|
133
|
+
render={({ field }) => (
|
|
134
|
+
<FormItem>
|
|
135
|
+
<FormLabel>Bio</FormLabel>
|
|
136
|
+
<FormControl>
|
|
137
|
+
<Textarea
|
|
138
|
+
placeholder="Tell us about yourself"
|
|
139
|
+
className="resize-none"
|
|
140
|
+
{...field}
|
|
141
|
+
/>
|
|
142
|
+
</FormControl>
|
|
143
|
+
<FormDescription>
|
|
144
|
+
Optional. Maximum 160 characters.
|
|
145
|
+
</FormDescription>
|
|
146
|
+
<FormMessage />
|
|
147
|
+
</FormItem>
|
|
148
|
+
)}
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<Button type="submit">Update profile</Button>
|
|
152
|
+
</form>
|
|
153
|
+
</Form>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Key Patterns Demonstrated:
|
|
159
|
+
*
|
|
160
|
+
* 1. Form Composition: Using shadcn/ui's Form components with react-hook-form
|
|
161
|
+
* 2. Validation: Zod schema for type-safe validation
|
|
162
|
+
* 3. Error Handling: Automatic error messages via FormMessage
|
|
163
|
+
* 4. Accessibility: All fields properly labeled with descriptions
|
|
164
|
+
* 5. Type Safety: TypeScript types inferred from Zod schema
|
|
165
|
+
*
|
|
166
|
+
* Required Dependencies:
|
|
167
|
+
* - react-hook-form
|
|
168
|
+
* - @hookform/resolvers
|
|
169
|
+
* - zod
|
|
170
|
+
*
|
|
171
|
+
* Installation:
|
|
172
|
+
* npx shadcn@latest add form
|
|
173
|
+
* npx shadcn@latest add input
|
|
174
|
+
* npx shadcn@latest add select
|
|
175
|
+
* npx shadcn@latest add textarea
|
|
176
|
+
* npx shadcn@latest add button
|
|
177
|
+
*/
|