@devxcrew/react-ui 0.0.0-stage → 0.1.7
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/README.md +85 -2
- package/package.json +105 -4
- package/src/blocks/agent-chat-workspace/agent-chat-workspace.tsx +162 -0
- package/src/blocks/agent-chat-workspace/index.ts +2 -0
- package/src/blocks/agent-provider-settings/agent-provider-settings.tsx +183 -0
- package/src/blocks/agent-provider-settings/index.ts +2 -0
- package/src/blocks/agent-task-workspace/agent-task-workspace.tsx +48 -0
- package/src/blocks/agent-task-workspace/index.ts +2 -0
- package/src/blocks/analysis-context/analysis-context.tsx +6 -0
- package/src/blocks/analysis-context/index.ts +1 -0
- package/src/blocks/app-header/app-header.tsx +159 -0
- package/src/blocks/app-header/index.ts +2 -0
- package/src/blocks/archived-chat-workspace/archived-chat-workspace.tsx +29 -0
- package/src/blocks/archived-chat-workspace/index.ts +2 -0
- package/src/blocks/auth/README.md +32 -0
- package/src/blocks/auth/admin-login-page.tsx +15 -0
- package/src/blocks/auth/admin-password-forgot-page.tsx +5 -0
- package/src/blocks/auth/auth-page-layout.tsx +90 -0
- package/src/blocks/auth/client-login-page.tsx +20 -0
- package/src/blocks/auth/client-password-forgot-page.tsx +5 -0
- package/src/blocks/auth/identity-management-desk.tsx +530 -0
- package/src/blocks/auth/index.ts +12 -0
- package/src/blocks/auth/login-page.tsx +206 -0
- package/src/blocks/auth/password-forgot-page.tsx +60 -0
- package/src/blocks/auth/portal-pages.tsx +32 -0
- package/src/blocks/auth/privileged-desk.tsx +55 -0
- package/src/blocks/auth/register-page.tsx +117 -0
- package/src/blocks/auth/session-boundary.tsx +296 -0
- package/src/blocks/auth/super-admin-login-page.tsx +15 -0
- package/src/blocks/auth/super-admin-password-forgot-page.tsx +5 -0
- package/src/blocks/blog/blog-card.tsx +156 -0
- package/src/blocks/blog/blog-reader.tsx +175 -0
- package/src/blocks/blog/blog-types.ts +47 -0
- package/src/blocks/blog/index.ts +3 -0
- package/src/blocks/chat-composer/chat-composer.tsx +140 -0
- package/src/blocks/chat-composer/index.ts +1 -0
- package/src/blocks/chat-history/chat-history.tsx +59 -0
- package/src/blocks/chat-history/index.ts +1 -0
- package/src/blocks/chat-response-progress/chat-response-progress.tsx +34 -0
- package/src/blocks/chat-response-progress/index.ts +2 -0
- package/src/blocks/chat-runtime-controls/chat-runtime-controls.tsx +56 -0
- package/src/blocks/chat-runtime-controls/index.ts +2 -0
- package/src/blocks/chat-runtime-trace/chat-runtime-trace.tsx +71 -0
- package/src/blocks/chat-runtime-trace/index.ts +2 -0
- package/src/blocks/codex-connection-settings/codex-connection-settings.tsx +42 -0
- package/src/blocks/codex-connection-settings/index.ts +1 -0
- package/src/blocks/dropzone/dropzone-file-item.tsx +113 -0
- package/src/blocks/dropzone/dropzone-types.ts +32 -0
- package/src/blocks/dropzone/dropzone.tsx +216 -0
- package/src/blocks/dropzone/index.ts +3 -0
- package/src/blocks/ecommerce/cart/cart-drawer.tsx +228 -0
- package/src/blocks/ecommerce/cart/cart-types.ts +27 -0
- package/src/blocks/ecommerce/cart/index.ts +2 -0
- package/src/blocks/ecommerce/categories/categories-types.ts +23 -0
- package/src/blocks/ecommerce/categories/category-showcase.tsx +125 -0
- package/src/blocks/ecommerce/categories/index.ts +2 -0
- package/src/blocks/ecommerce/checkout/checkout-types.ts +48 -0
- package/src/blocks/ecommerce/checkout/checkout-wizard.tsx +468 -0
- package/src/blocks/ecommerce/checkout/index.ts +2 -0
- package/src/blocks/ecommerce/comparison/comparison-types.ts +28 -0
- package/src/blocks/ecommerce/comparison/index.ts +2 -0
- package/src/blocks/ecommerce/comparison/product-comparison.tsx +174 -0
- package/src/blocks/ecommerce/coupon-wallet/coupon-wallet-types.ts +21 -0
- package/src/blocks/ecommerce/coupon-wallet/coupon-wallet.tsx +154 -0
- package/src/blocks/ecommerce/coupon-wallet/index.ts +2 -0
- package/src/blocks/ecommerce/delivery-tracker/delivery-tracker-types.ts +20 -0
- package/src/blocks/ecommerce/delivery-tracker/delivery-tracker.tsx +169 -0
- package/src/blocks/ecommerce/delivery-tracker/index.ts +2 -0
- package/src/blocks/ecommerce/index.ts +12 -0
- package/src/blocks/ecommerce/payment-methods/index.ts +2 -0
- package/src/blocks/ecommerce/payment-methods/payment-method-selector.tsx +224 -0
- package/src/blocks/ecommerce/payment-methods/payment-methods-types.ts +21 -0
- package/src/blocks/ecommerce/price-history/index.ts +2 -0
- package/src/blocks/ecommerce/price-history/price-history-chart.tsx +217 -0
- package/src/blocks/ecommerce/price-history/price-history-types.ts +16 -0
- package/src/blocks/ecommerce/reviews/index.ts +2 -0
- package/src/blocks/ecommerce/reviews/reviews-section.tsx +309 -0
- package/src/blocks/ecommerce/reviews/reviews-types.ts +26 -0
- package/src/blocks/ecommerce/wishlist/index.ts +2 -0
- package/src/blocks/ecommerce/wishlist/wishlist-grid.tsx +149 -0
- package/src/blocks/ecommerce/wishlist/wishlist-types.ts +19 -0
- package/src/blocks/execution-status/README.md +25 -0
- package/src/blocks/execution-status/execution-status.tsx +135 -0
- package/src/blocks/execution-status/index.ts +2 -0
- package/src/blocks/file-tree/file-icons.tsx +84 -0
- package/src/blocks/file-tree/file-tree-node.tsx +158 -0
- package/src/blocks/file-tree/file-tree-types.ts +33 -0
- package/src/blocks/file-tree/file-tree.tsx +163 -0
- package/src/blocks/file-tree/index.ts +5 -0
- package/src/blocks/filter-builder/filter-builder.tsx +169 -0
- package/src/blocks/filter-builder/filter-row.tsx +164 -0
- package/src/blocks/filter-builder/filter-types.ts +61 -0
- package/src/blocks/filter-builder/index.ts +12 -0
- package/src/blocks/footer/footer-types.ts +35 -0
- package/src/blocks/footer/index.ts +2 -0
- package/src/blocks/footer/site-footer.tsx +212 -0
- package/src/blocks/form/form-block.tsx +113 -0
- package/src/blocks/form/form-lookup-field.tsx +60 -0
- package/src/blocks/form/index.ts +4 -0
- package/src/blocks/handover-stack/handover-stack.tsx +41 -0
- package/src/blocks/handover-stack/index.ts +1 -0
- package/src/blocks/idea-handover/idea-handover-readiness.ts +41 -0
- package/src/blocks/idea-handover/idea-handover-workspace.tsx +150 -0
- package/src/blocks/idea-handover/index.ts +4 -0
- package/src/blocks/kanban/index.ts +11 -0
- package/src/blocks/kanban/kanban-board.tsx +146 -0
- package/src/blocks/kanban/kanban-card.tsx +149 -0
- package/src/blocks/kanban/kanban-column.tsx +102 -0
- package/src/blocks/kanban/kanban-types.ts +38 -0
- package/src/blocks/loader/global-loader.tsx +90 -0
- package/src/blocks/loader/index.ts +1 -0
- package/src/blocks/mascot/README.md +21 -0
- package/src/blocks/mascot/index.ts +2 -0
- package/src/blocks/mascot/mascot.tsx +202 -0
- package/src/blocks/master-list/README.md +21 -0
- package/src/blocks/master-list/index.ts +12 -0
- package/src/blocks/master-list/master-form.tsx +157 -0
- package/src/blocks/master-list/master-list-desk.tsx +370 -0
- package/src/blocks/master-list/master-list.tsx +189 -0
- package/src/blocks/master-list/types.ts +18 -0
- package/src/blocks/mermaid-preview/index.ts +1 -0
- package/src/blocks/mermaid-preview/mermaid-preview.tsx +164 -0
- package/src/blocks/notifications/README.md +7 -0
- package/src/blocks/notifications/index.ts +1 -0
- package/src/blocks/notifications/notification-center-page.tsx +73 -0
- package/src/blocks/pricing/index.ts +7 -0
- package/src/blocks/pricing/pricing-table.tsx +173 -0
- package/src/blocks/pricing/pricing-types.ts +34 -0
- package/src/blocks/product-card/index.ts +2 -0
- package/src/blocks/product-card/product-card-types.ts +35 -0
- package/src/blocks/product-card/product-card.tsx +183 -0
- package/src/blocks/table/data-table-block.tsx +313 -0
- package/src/blocks/table/data-table-filter-menu.tsx +48 -0
- package/src/blocks/table/data-table-icon-menu-trigger.tsx +44 -0
- package/src/blocks/table/data-table-menu-content.tsx +32 -0
- package/src/blocks/table/data-table-pagination.tsx +149 -0
- package/src/blocks/table/data-table-row-actions.tsx +53 -0
- package/src/blocks/table/data-table-status.tsx +42 -0
- package/src/blocks/table/data-table-toolbar.tsx +124 -0
- package/src/blocks/table/data-table-totals.tsx +31 -0
- package/src/blocks/table/index.ts +13 -0
- package/src/blocks/workspace/index.ts +19 -0
- package/src/blocks/workspace/workspace-action-card.tsx +73 -0
- package/src/blocks/workspace/workspace-application-header.tsx +67 -0
- package/src/blocks/workspace/workspace-entity-card.tsx +48 -0
- package/src/blocks/workspace/workspace-health-summary.tsx +15 -0
- package/src/blocks/workspace/workspace-metric-card.tsx +97 -0
- package/src/blocks/workspace/workspace-page-header.tsx +43 -0
- package/src/blocks/workspace/workspace-publish-status.tsx +15 -0
- package/src/blocks/workspace/workspace-route-checklist.tsx +28 -0
- package/src/blocks/workspace/workspace-runtime-status.tsx +48 -0
- package/src/blocks/workspace/workspace-section-card.tsx +42 -0
- package/src/components/accordion.tsx +65 -0
- package/src/components/alert-dialog.tsx +160 -0
- package/src/components/alert.tsx +68 -0
- package/src/components/aspect-ratio.tsx +22 -0
- package/src/components/attachment.tsx +195 -0
- package/src/components/avatar.tsx +90 -0
- package/src/components/badge.tsx +55 -0
- package/src/components/breadcrumb.tsx +100 -0
- package/src/components/bubble.tsx +123 -0
- package/src/components/button-group.tsx +79 -0
- package/src/components/button.tsx +71 -0
- package/src/components/calendar.tsx +185 -0
- package/src/components/card.tsx +100 -0
- package/src/components/carousel.tsx +229 -0
- package/src/components/chart.tsx +338 -0
- package/src/components/checkbox.tsx +27 -0
- package/src/components/collapsible.tsx +15 -0
- package/src/components/combobox.tsx +269 -0
- package/src/components/command.tsx +181 -0
- package/src/components/compact-model-switcher.tsx +128 -0
- package/src/components/context-menu.tsx +244 -0
- package/src/components/dialog.tsx +138 -0
- package/src/components/direction.tsx +1 -0
- package/src/components/drawer.tsx +208 -0
- package/src/components/dropdown-menu.tsx +257 -0
- package/src/components/empty.tsx +93 -0
- package/src/components/field.tsx +232 -0
- package/src/components/hover-card.tsx +45 -0
- package/src/components/input-group.tsx +146 -0
- package/src/components/input-otp.tsx +83 -0
- package/src/components/input.tsx +19 -0
- package/src/components/item.tsx +188 -0
- package/src/components/kbd.tsx +26 -0
- package/src/components/label.tsx +17 -0
- package/src/components/markdown-content.tsx +113 -0
- package/src/components/marker.tsx +67 -0
- package/src/components/menubar.tsx +267 -0
- package/src/components/message-scroller.tsx +91 -0
- package/src/components/message.tsx +84 -0
- package/src/components/native-select.tsx +54 -0
- package/src/components/navigation-menu.tsx +160 -0
- package/src/components/pagination.tsx +118 -0
- package/src/components/popover.tsx +74 -0
- package/src/components/progress.tsx +82 -0
- package/src/components/questionnaire.tsx +150 -0
- package/src/components/radio-group.tsx +35 -0
- package/src/components/resizable.tsx +41 -0
- package/src/components/rich-text-editor.tsx +604 -0
- package/src/components/scroll-area.tsx +47 -0
- package/src/components/select.tsx +189 -0
- package/src/components/separator.tsx +18 -0
- package/src/components/sheet.tsx +125 -0
- package/src/components/sidebar.tsx +693 -0
- package/src/components/skeleton.tsx +13 -0
- package/src/components/slider.tsx +51 -0
- package/src/components/sonner.tsx +45 -0
- package/src/components/sparkline.tsx +231 -0
- package/src/components/spinner.tsx +20 -0
- package/src/components/status-badge.tsx +114 -0
- package/src/components/switch.tsx +31 -0
- package/src/components/table.tsx +91 -0
- package/src/components/tabs.tsx +72 -0
- package/src/components/textarea.tsx +17 -0
- package/src/components/toast.tsx +222 -0
- package/src/components/toggle-group.tsx +85 -0
- package/src/components/toggle.tsx +42 -0
- package/src/components/tooltip.tsx +53 -0
- package/src/design-system/README.md +55 -0
- package/src/design-system/action-intents.ts +21 -0
- package/src/design-system/agent-manifest.ts +83 -0
- package/src/design-system/block-registry.ts +272 -0
- package/src/design-system/component-registry.ts +142 -0
- package/src/design-system/contracts.ts +69 -0
- package/src/design-system/defaults.ts +3 -0
- package/src/design-system/index.ts +29 -0
- package/src/design-system/mcp-server.ts +156 -0
- package/src/design-system/page-registry.ts +74 -0
- package/src/design-system/selection.ts +67 -0
- package/src/design-system/template-registry.ts +33 -0
- package/src/features/interface-topology/index.ts +14 -0
- package/src/features/interface-topology/interface-topology.types.ts +40 -0
- package/src/features/interface-topology/topology-control.tsx +18 -0
- package/src/features/interface-topology/topology-inspector.tsx +228 -0
- package/src/features/interface-topology/topology-marker.tsx +47 -0
- package/src/features/interface-topology/topology-region.tsx +44 -0
- package/src/features/interface-topology/use-interface-topology.ts +178 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/hooks/use-scroll-follow.ts +22 -0
- package/src/index.ts +11 -0
- package/src/layouts/README.md +65 -0
- package/src/layouts/agent-workspace/agent-activity-rail.tsx +101 -0
- package/src/layouts/agent-workspace/agent-workspace.tsx +27 -0
- package/src/layouts/agent-workspace/agent-workspace.types.ts +28 -0
- package/src/layouts/agent-workspace/index.ts +7 -0
- package/src/layouts/blog-header/blog-header-types.ts +25 -0
- package/src/layouts/blog-header/blog-header.tsx +172 -0
- package/src/layouts/blog-header/index.ts +2 -0
- package/src/layouts/documentation-workspace/README.md +8 -0
- package/src/layouts/documentation-workspace/documentation-workspace.tsx +34 -0
- package/src/layouts/documentation-workspace/index.ts +1 -0
- package/src/layouts/ecommerce-header/ecommerce-actions.tsx +89 -0
- package/src/layouts/ecommerce-header/ecommerce-announcement.tsx +43 -0
- package/src/layouts/ecommerce-header/ecommerce-drawer.tsx +97 -0
- package/src/layouts/ecommerce-header/ecommerce-header-types.ts +59 -0
- package/src/layouts/ecommerce-header/ecommerce-header.tsx +47 -0
- package/src/layouts/ecommerce-header/ecommerce-navigation.tsx +98 -0
- package/src/layouts/ecommerce-header/ecommerce-search.tsx +86 -0
- package/src/layouts/ecommerce-header/index.ts +2 -0
- package/src/layouts/main-workspace/index.ts +28 -0
- package/src/layouts/mdi/index.ts +1 -0
- package/src/layouts/mdi/mdi.tsx +20 -0
- package/src/layouts/mdi-main/index.ts +27 -0
- package/src/layouts/mdi-main/mdi-app-catalog.generated.ts +159 -0
- package/src/layouts/mdi-main/mdi-app-catalog.ts +76 -0
- package/src/layouts/mdi-main/mdi-app-switcher.tsx +107 -0
- package/src/layouts/mdi-main/mdi-feature-settings.tsx +135 -0
- package/src/layouts/mdi-main/mdi-global-search.tsx +192 -0
- package/src/layouts/mdi-main/mdi-main.tsx +241 -0
- package/src/layouts/mdi-main/mdi-notifications-menu.tsx +197 -0
- package/src/layouts/mdi-main/mdi-profile-menu.tsx +79 -0
- package/src/layouts/mdi-main/mdi-sidebar-navigation.tsx +226 -0
- package/src/layouts/mdi-main/mdi-sidebar.tsx +110 -0
- package/src/layouts/mdi-main/mdi-status-bar.tsx +26 -0
- package/src/layouts/mdi-main/mdi-top-menu-control.ts +4 -0
- package/src/layouts/mdi-main/mdi-top-menu.tsx +117 -0
- package/src/layouts/mdi-main/mdi-topology.tsx +297 -0
- package/src/layouts/mdi-main/mdi-tweak-panel.tsx +104 -0
- package/src/layouts/mdi-main/mdi-types.ts +131 -0
- package/src/layouts/mdi-main/use-mdi-features.ts +36 -0
- package/src/layouts/mdi-main/use-mdi-sidebar-state.ts +59 -0
- package/src/layouts/site-header/announcement-bar.tsx +55 -0
- package/src/layouts/site-header/category-strip.tsx +41 -0
- package/src/layouts/site-header/index.ts +16 -0
- package/src/layouts/site-header/main-navbar.tsx +179 -0
- package/src/layouts/site-header/mobile-drawer.tsx +140 -0
- package/src/layouts/site-header/site-header-types.ts +63 -0
- package/src/layouts/site-header/site-header.tsx +58 -0
- package/src/lib/random-id.ts +19 -0
- package/src/lib/utils.ts +6 -0
- package/src/providers/pdf-provider.ts +137 -0
- package/src/styles/globals.css +374 -0
- package/src/templates/README.md +12 -0
- package/src/templates/dashboard-01/components/app-sidebar.tsx +177 -0
- package/src/templates/dashboard-01/components/chart-area-interactive.tsx +276 -0
- package/src/templates/dashboard-01/components/data-table-cell-viewer.tsx +213 -0
- package/src/templates/dashboard-01/components/data-table.tsx +577 -0
- package/src/templates/dashboard-01/components/nav-documents.tsx +79 -0
- package/src/templates/dashboard-01/components/nav-main.tsx +55 -0
- package/src/templates/dashboard-01/components/nav-secondary.tsx +39 -0
- package/src/templates/dashboard-01/components/nav-user.tsx +97 -0
- package/src/templates/dashboard-01/components/section-cards.tsx +99 -0
- package/src/templates/dashboard-01/components/site-header.tsx +14 -0
- package/src/templates/dashboard-01/data.json +614 -0
- package/src/templates/dashboard-01/index.ts +7 -0
- package/src/templates/documentation-sidebar/app-sidebar.tsx +95 -0
- package/src/templates/documentation-sidebar/index.ts +2 -0
- package/src/templates/sidebar-07/components/app-sidebar.tsx +175 -0
- package/src/templates/sidebar-07/components/nav-main.tsx +64 -0
- package/src/templates/sidebar-07/components/nav-projects.tsx +79 -0
- package/src/templates/sidebar-07/components/nav-user.tsx +105 -0
- package/src/templates/sidebar-07/components/team-switcher.tsx +94 -0
- package/src/templates/sidebar-07/index.ts +1 -0
- package/src/templates/ui-page/index.ts +7 -0
- package/src/templates/ui-page/ui-browser-frame.tsx +27 -0
- package/src/templates/ui-page/ui-template-code.tsx +48 -0
- package/src/templates/ui-page/ui-template-header.tsx +87 -0
- package/src/templates/ui-page/ui-template-navigation.tsx +60 -0
- package/src/templates/ui-page/ui-template-page.tsx +97 -0
- package/src/theme/index.ts +12 -0
- package/src/theme/theme-config.ts +30 -0
- package/src/theme/theme-provider.tsx +142 -0
- package/src/theme/theme-selector.tsx +75 -0
- package/src/tokens/index.ts +15 -0
- package/src/vite-env.d.ts +3 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
3
|
+
|
|
4
|
+
const DIRECTIONS = ["up-left", "up", "up-right", "left", "center", "right", "down-left", "down", "down-right"] as const;
|
|
5
|
+
|
|
6
|
+
const REACTIONS = [
|
|
7
|
+
"blink",
|
|
8
|
+
"heart",
|
|
9
|
+
"sparkle",
|
|
10
|
+
"surprised",
|
|
11
|
+
"wink",
|
|
12
|
+
"bashful",
|
|
13
|
+
"sleepy",
|
|
14
|
+
"dizzy",
|
|
15
|
+
"delighted",
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
type Direction = (typeof DIRECTIONS)[number];
|
|
19
|
+
type Reaction = (typeof REACTIONS)[number];
|
|
20
|
+
|
|
21
|
+
const CLOCKWISE: Direction[] = ["right", "down-right", "down", "down-left", "left", "up-left", "up", "up-right"];
|
|
22
|
+
const SECTOR = (Math.PI * 2) / CLOCKWISE.length;
|
|
23
|
+
const HYSTERESIS = 0.12;
|
|
24
|
+
const DEAD_ZONE = 70;
|
|
25
|
+
const PAYOFFS: Reaction[] = ["heart", "sparkle", "delighted"];
|
|
26
|
+
const BOOP_PAYOFF = 120;
|
|
27
|
+
const BOOP_END = 560;
|
|
28
|
+
const SQUASH_MS = 420;
|
|
29
|
+
const DIZZY_AFTER = 4;
|
|
30
|
+
const DIZZY_WINDOW = 1600;
|
|
31
|
+
const DIZZY_END = 1100;
|
|
32
|
+
|
|
33
|
+
const SQUASH: Keyframe[] = [
|
|
34
|
+
{ transform: "scale(1, 1)", easing: "ease-in" },
|
|
35
|
+
{ transform: "scale(1.10, 0.86)", offset: 0.18, easing: "ease-out" },
|
|
36
|
+
{ transform: "scale(0.95, 1.08)", offset: 0.45, easing: "ease-in-out" },
|
|
37
|
+
{ transform: "scale(1.03, 0.97)", offset: 0.72, easing: "ease-in-out" },
|
|
38
|
+
{ transform: "scale(1, 1)" },
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
function cell(index: number): CSSProperties {
|
|
42
|
+
return { backgroundPosition: `${(index % 3) * 50}% ${Math.floor(index / 3) * 50}%` };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function wrap(angle: number) {
|
|
46
|
+
return Math.atan2(Math.sin(angle), Math.cos(angle));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const layer: CSSProperties = {
|
|
50
|
+
position: "absolute",
|
|
51
|
+
inset: 0,
|
|
52
|
+
backgroundSize: "300% 300%",
|
|
53
|
+
backgroundRepeat: "no-repeat",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type MascotProps = {
|
|
57
|
+
/** Served or imported 3x3 sprite sheet containing the nine head directions. */
|
|
58
|
+
directions: string;
|
|
59
|
+
/** Served or imported 3x3 sprite sheet containing the nine reactions. */
|
|
60
|
+
reactions: string;
|
|
61
|
+
/** Square size in CSS pixels. */
|
|
62
|
+
size?: number;
|
|
63
|
+
/** Disable global pointer tracking when rendering a static catalog of variants. */
|
|
64
|
+
trackPointer?: boolean;
|
|
65
|
+
className?: string;
|
|
66
|
+
/** Accessible name announced by the boop button. */
|
|
67
|
+
label?: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** A pointer-aware, clickable mascot backed by two aligned 3x3 sprite sheets. */
|
|
71
|
+
export function Mascot({
|
|
72
|
+
directions,
|
|
73
|
+
reactions,
|
|
74
|
+
size = 140,
|
|
75
|
+
trackPointer = true,
|
|
76
|
+
className,
|
|
77
|
+
label = "mascot",
|
|
78
|
+
}: MascotProps) {
|
|
79
|
+
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
80
|
+
const squashRef = useRef<HTMLSpanElement>(null);
|
|
81
|
+
const timersRef = useRef<number[]>([]);
|
|
82
|
+
const boopsRef = useRef({ count: 0, at: 0 });
|
|
83
|
+
const [direction, setDirection] = useState<Direction>("center");
|
|
84
|
+
const [reaction, setReaction] = useState<Reaction | null>(null);
|
|
85
|
+
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!trackPointer || !window.matchMedia("(hover: hover) and (pointer: fine)").matches) return;
|
|
88
|
+
|
|
89
|
+
let sector = -1;
|
|
90
|
+
let pointer: { x: number; y: number } | null = null;
|
|
91
|
+
|
|
92
|
+
const aim = () => {
|
|
93
|
+
const button = buttonRef.current;
|
|
94
|
+
if (!button || !pointer) return;
|
|
95
|
+
|
|
96
|
+
const box = button.getBoundingClientRect();
|
|
97
|
+
const dx = pointer.x - (box.left + box.width / 2);
|
|
98
|
+
const dy = pointer.y - (box.top + box.height / 2);
|
|
99
|
+
|
|
100
|
+
if (Math.hypot(dx, dy) < DEAD_ZONE) {
|
|
101
|
+
sector = -1;
|
|
102
|
+
setDirection("center");
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const angle = Math.atan2(dy, dx);
|
|
107
|
+
if (sector !== -1 && Math.abs(wrap(angle - sector * SECTOR)) < SECTOR / 2 + HYSTERESIS) return;
|
|
108
|
+
|
|
109
|
+
sector = (Math.round(angle / SECTOR) + CLOCKWISE.length) % CLOCKWISE.length;
|
|
110
|
+
setDirection(CLOCKWISE[sector]);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const onPointerMove = (event: PointerEvent) => {
|
|
114
|
+
pointer = { x: event.clientX, y: event.clientY };
|
|
115
|
+
aim();
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
window.addEventListener("pointermove", onPointerMove, { passive: true });
|
|
119
|
+
window.addEventListener("scroll", aim, { passive: true });
|
|
120
|
+
return () => {
|
|
121
|
+
window.removeEventListener("pointermove", onPointerMove);
|
|
122
|
+
window.removeEventListener("scroll", aim);
|
|
123
|
+
};
|
|
124
|
+
}, [trackPointer]);
|
|
125
|
+
|
|
126
|
+
useEffect(() => () => timersRef.current.forEach(window.clearTimeout), []);
|
|
127
|
+
|
|
128
|
+
const boop = () => {
|
|
129
|
+
timersRef.current.forEach(window.clearTimeout);
|
|
130
|
+
timersRef.current = [];
|
|
131
|
+
|
|
132
|
+
const later = (ms: number, next: Reaction | null) => {
|
|
133
|
+
timersRef.current.push(window.setTimeout(() => setReaction(next), ms));
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const now = Date.now();
|
|
137
|
+
const boops = boopsRef.current;
|
|
138
|
+
boops.count = now - boops.at < DIZZY_WINDOW ? boops.count + 1 : 1;
|
|
139
|
+
boops.at = now;
|
|
140
|
+
|
|
141
|
+
if (boops.count >= DIZZY_AFTER) {
|
|
142
|
+
boops.count = 0;
|
|
143
|
+
setReaction("dizzy");
|
|
144
|
+
later(DIZZY_END, null);
|
|
145
|
+
} else {
|
|
146
|
+
setReaction("blink");
|
|
147
|
+
later(BOOP_PAYOFF, PAYOFFS[(boops.count - 1) % PAYOFFS.length]);
|
|
148
|
+
later(BOOP_END, null);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (!window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
152
|
+
squashRef.current?.animate(SQUASH, { duration: SQUASH_MS, easing: "linear" });
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<button
|
|
158
|
+
ref={buttonRef}
|
|
159
|
+
type="button"
|
|
160
|
+
onClick={boop}
|
|
161
|
+
aria-label={`Boop the ${label}`}
|
|
162
|
+
className={className}
|
|
163
|
+
style={{
|
|
164
|
+
position: "relative",
|
|
165
|
+
display: "block",
|
|
166
|
+
flexShrink: 0,
|
|
167
|
+
width: size,
|
|
168
|
+
height: size,
|
|
169
|
+
padding: 0,
|
|
170
|
+
border: 0,
|
|
171
|
+
background: "transparent",
|
|
172
|
+
appearance: "none",
|
|
173
|
+
cursor: "pointer",
|
|
174
|
+
userSelect: "none",
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
<span
|
|
178
|
+
ref={squashRef}
|
|
179
|
+
style={{ position: "relative", display: "block", width: "100%", height: "100%", transformOrigin: "50% 78%" }}
|
|
180
|
+
>
|
|
181
|
+
<span
|
|
182
|
+
aria-hidden="true"
|
|
183
|
+
style={{
|
|
184
|
+
...layer,
|
|
185
|
+
backgroundImage: `url(${directions})`,
|
|
186
|
+
...cell(DIRECTIONS.indexOf(direction)),
|
|
187
|
+
opacity: reaction ? 0 : 1,
|
|
188
|
+
}}
|
|
189
|
+
/>
|
|
190
|
+
<span
|
|
191
|
+
aria-hidden="true"
|
|
192
|
+
style={{
|
|
193
|
+
...layer,
|
|
194
|
+
backgroundImage: `url(${reactions})`,
|
|
195
|
+
...cell(REACTIONS.indexOf(reaction ?? "blink")),
|
|
196
|
+
opacity: reaction ? 1 : 0,
|
|
197
|
+
}}
|
|
198
|
+
/>
|
|
199
|
+
</span>
|
|
200
|
+
</button>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Master List
|
|
2
|
+
|
|
3
|
+
`@devxcrew/react-ui/blocks/master-list` exports `MasterList`, `MasterForm`, and their types.
|
|
4
|
+
|
|
5
|
+
Define one `MasterField[]` for both the list and the form. Each record has a string `id`; other
|
|
6
|
+
field values can be strings, numbers, booleans, or empty values. Set `showInList: false` for
|
|
7
|
+
form-only fields. Use `format` when a list value needs custom display. Select fields provide their
|
|
8
|
+
own `options`.
|
|
9
|
+
|
|
10
|
+
`MasterList` supports `table` and `cards` variants. Both show configured fields and optional view,
|
|
11
|
+
edit, suspend, and delete actions. The table uses the shared Data Table block for search, sorting,
|
|
12
|
+
and pagination. `MasterForm` supports `page` and `panel` layouts, controlled string values, and
|
|
13
|
+
required-field checks.
|
|
14
|
+
|
|
15
|
+
`MasterListDesk` supports dense operational lists. It provides a compact toolbar, quick field
|
|
16
|
+
filters, selectable rows, row menus for edit, suspend, and delete actions, page-size controls, and a
|
|
17
|
+
load-more action.
|
|
18
|
+
|
|
19
|
+
The owning application supplies records, draft values, persistence, permissions, domain validation,
|
|
20
|
+
and delete confirmation. Neither block stores records or calls an API. The UIUX gallery provides
|
|
21
|
+
four separate in-memory pages at `/?template=master-list&variant=v1`, `v2`, `v3`, and `v4`.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { MasterForm } from './master-form';
|
|
2
|
+
export type { MasterFormProps } from './master-form';
|
|
3
|
+
export { MasterList } from './master-list';
|
|
4
|
+
export type { MasterListProps } from './master-list';
|
|
5
|
+
export { MasterListDesk } from './master-list-desk';
|
|
6
|
+
export type {
|
|
7
|
+
MasterListDeskColumn,
|
|
8
|
+
MasterListDeskFilter,
|
|
9
|
+
MasterListDeskProps,
|
|
10
|
+
MasterListDeskRecord,
|
|
11
|
+
} from './master-list-desk';
|
|
12
|
+
export type { MasterField, MasterFormValues, MasterRecord, MasterValue } from './types';
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { useId, useState, type FormEvent } from 'react';
|
|
2
|
+
import { Button } from '@devxcrew/react-ui/components/button';
|
|
3
|
+
import { Field, FieldDescription, FieldError, FieldLabel } from '@devxcrew/react-ui/components/field';
|
|
4
|
+
import { Input } from '@devxcrew/react-ui/components/input';
|
|
5
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@devxcrew/react-ui/components/select';
|
|
6
|
+
import { Textarea } from '@devxcrew/react-ui/components/textarea';
|
|
7
|
+
import { cn } from '@devxcrew/react-ui/lib/utils';
|
|
8
|
+
import type { MasterField, MasterFormValues } from './types';
|
|
9
|
+
|
|
10
|
+
export type MasterFormProps = {
|
|
11
|
+
fields: readonly MasterField[];
|
|
12
|
+
values: MasterFormValues;
|
|
13
|
+
onValueChange: (fieldId: string, value: string) => void;
|
|
14
|
+
onSubmit: (values: MasterFormValues) => void | Promise<void>;
|
|
15
|
+
onCancel: () => void;
|
|
16
|
+
title: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
submitLabel?: string;
|
|
19
|
+
variant?: 'page' | 'panel';
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function fieldControl(
|
|
23
|
+
field: MasterField,
|
|
24
|
+
id: string,
|
|
25
|
+
value: string,
|
|
26
|
+
onChange: (value: string) => void,
|
|
27
|
+
invalid: boolean,
|
|
28
|
+
) {
|
|
29
|
+
if (field.type === 'textarea') {
|
|
30
|
+
return (
|
|
31
|
+
<Textarea
|
|
32
|
+
aria-invalid={invalid}
|
|
33
|
+
aria-required={field.required}
|
|
34
|
+
id={id}
|
|
35
|
+
onChange={(event) => onChange(event.target.value)}
|
|
36
|
+
placeholder={field.placeholder}
|
|
37
|
+
value={value}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
if (field.type === 'select') {
|
|
42
|
+
return (
|
|
43
|
+
<Select onValueChange={(next) => onChange(next ?? '')} value={value || null}>
|
|
44
|
+
<SelectTrigger aria-invalid={invalid} aria-required={field.required} className="w-full" id={id}>
|
|
45
|
+
<SelectValue placeholder={field.placeholder ?? `Select ${field.label.toLowerCase()}`} />
|
|
46
|
+
</SelectTrigger>
|
|
47
|
+
<SelectContent>
|
|
48
|
+
{field.options?.map((option) => (
|
|
49
|
+
<SelectItem key={option.value} value={option.value}>
|
|
50
|
+
{option.label}
|
|
51
|
+
</SelectItem>
|
|
52
|
+
))}
|
|
53
|
+
</SelectContent>
|
|
54
|
+
</Select>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
return (
|
|
58
|
+
<Input
|
|
59
|
+
aria-invalid={invalid}
|
|
60
|
+
aria-required={field.required}
|
|
61
|
+
id={id}
|
|
62
|
+
onChange={(event) => onChange(event.target.value)}
|
|
63
|
+
placeholder={field.placeholder}
|
|
64
|
+
type={field.type ?? 'text'}
|
|
65
|
+
value={value}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function MasterForm({
|
|
71
|
+
fields,
|
|
72
|
+
values,
|
|
73
|
+
onValueChange,
|
|
74
|
+
onSubmit,
|
|
75
|
+
onCancel,
|
|
76
|
+
title,
|
|
77
|
+
description,
|
|
78
|
+
submitLabel = 'Save',
|
|
79
|
+
variant = 'page',
|
|
80
|
+
}: MasterFormProps) {
|
|
81
|
+
const formId = useId();
|
|
82
|
+
const [errors, setErrors] = useState<Record<string, string>>({});
|
|
83
|
+
const [submitting, setSubmitting] = useState(false);
|
|
84
|
+
|
|
85
|
+
async function handleSubmit(event: FormEvent<HTMLFormElement>) {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
const nextErrors = Object.fromEntries(
|
|
88
|
+
fields
|
|
89
|
+
.filter((field) => field.required && !values[field.id]?.trim())
|
|
90
|
+
.map((field) => [field.id, `${field.label} is required.`]),
|
|
91
|
+
);
|
|
92
|
+
setErrors(nextErrors);
|
|
93
|
+
if (Object.keys(nextErrors).length) return;
|
|
94
|
+
setSubmitting(true);
|
|
95
|
+
try {
|
|
96
|
+
await onSubmit(values);
|
|
97
|
+
} finally {
|
|
98
|
+
setSubmitting(false);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<form
|
|
104
|
+
className={cn('w-full space-y-6', variant === 'panel' && 'rounded-lg border bg-card p-6')}
|
|
105
|
+
noValidate
|
|
106
|
+
onSubmit={handleSubmit}
|
|
107
|
+
>
|
|
108
|
+
<header className="border-b pb-4">
|
|
109
|
+
<h2 className="text-xl font-semibold tracking-tight">{title}</h2>
|
|
110
|
+
{description ? <p className="mt-1 text-sm text-muted-foreground">{description}</p> : null}
|
|
111
|
+
</header>
|
|
112
|
+
<div className="grid gap-5 sm:grid-cols-2">
|
|
113
|
+
{fields.map((field) => {
|
|
114
|
+
const id = `${formId}-${field.id}`;
|
|
115
|
+
const error = errors[field.id];
|
|
116
|
+
return (
|
|
117
|
+
<Field
|
|
118
|
+
className={field.type === 'textarea' ? 'sm:col-span-2' : undefined}
|
|
119
|
+
data-invalid={Boolean(error)}
|
|
120
|
+
key={field.id}
|
|
121
|
+
>
|
|
122
|
+
<FieldLabel htmlFor={id}>
|
|
123
|
+
{field.label}
|
|
124
|
+
{field.required ? (
|
|
125
|
+
<span aria-hidden="true" className="text-destructive">
|
|
126
|
+
{' '}
|
|
127
|
+
*
|
|
128
|
+
</span>
|
|
129
|
+
) : null}
|
|
130
|
+
</FieldLabel>
|
|
131
|
+
{fieldControl(
|
|
132
|
+
field,
|
|
133
|
+
id,
|
|
134
|
+
values[field.id] ?? '',
|
|
135
|
+
(value) => {
|
|
136
|
+
onValueChange(field.id, value);
|
|
137
|
+
if (error) setErrors((current) => ({ ...current, [field.id]: '' }));
|
|
138
|
+
},
|
|
139
|
+
Boolean(error),
|
|
140
|
+
)}
|
|
141
|
+
{field.placeholder ? <FieldDescription>{field.placeholder}</FieldDescription> : null}
|
|
142
|
+
{error ? <FieldError>{error}</FieldError> : null}
|
|
143
|
+
</Field>
|
|
144
|
+
);
|
|
145
|
+
})}
|
|
146
|
+
</div>
|
|
147
|
+
<footer className="flex justify-end gap-2 border-t pt-4">
|
|
148
|
+
<Button onClick={onCancel} type="button" variant="outline">
|
|
149
|
+
Cancel
|
|
150
|
+
</Button>
|
|
151
|
+
<Button disabled={submitting} type="submit">
|
|
152
|
+
{submitting ? 'Saving…' : submitLabel}
|
|
153
|
+
</Button>
|
|
154
|
+
</footer>
|
|
155
|
+
</form>
|
|
156
|
+
);
|
|
157
|
+
}
|