@pixel-point/toolcraft 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +98 -0
- package/README.md +41 -0
- package/bin/create-toolcraft-app.mjs +8 -0
- package/bin/toolcraft.mjs +8 -0
- package/package.json +24 -0
- package/scripts/prepare-pack.mjs +29 -0
- package/src/cli.mjs +392 -0
- package/src/cli.test.mjs +284 -0
- package/src/copy-recursive.mjs +86 -0
- package/src/generate.mjs +212 -0
- package/src/generate.test.mjs +322 -0
- package/src/import-map.mjs +14 -0
- package/src/package-json.mjs +80 -0
- package/src/package-json.test.mjs +67 -0
- package/src/rewrite-imports.mjs +85 -0
- package/src/rewrite-imports.test.mjs +58 -0
- package/templates/runtime/contracts/component-contracts.test.ts +1165 -0
- package/templates/runtime/contracts/component-contracts.ts +1340 -0
- package/templates/runtime/contracts/decision-contracts.test.ts +206 -0
- package/templates/runtime/contracts/decision-contracts.ts +283 -0
- package/templates/runtime/contracts/index.test.ts +14 -0
- package/templates/runtime/contracts/index.ts +3 -0
- package/templates/runtime/contracts/types.ts +56 -0
- package/templates/runtime/export/export.test.ts +203 -0
- package/templates/runtime/export/export.ts +132 -0
- package/templates/runtime/export/index.ts +1 -0
- package/templates/runtime/index.ts +14 -0
- package/templates/runtime/react/canvas-shell.test.tsx +424 -0
- package/templates/runtime/react/canvas-shell.tsx +408 -0
- package/templates/runtime/react/control-renderers.ts +31 -0
- package/templates/runtime/react/controls-panel.test.tsx +3736 -0
- package/templates/runtime/react/controls-panel.tsx +2327 -0
- package/templates/runtime/react/curve-geometry.test.ts +70 -0
- package/templates/runtime/react/index.ts +15 -0
- package/templates/runtime/react/layer-tree.ts +96 -0
- package/templates/runtime/react/layers-panel.test.tsx +487 -0
- package/templates/runtime/react/layers-panel.tsx +1348 -0
- package/templates/runtime/react/media-file.ts +82 -0
- package/templates/runtime/react/panel-host-config.ts +80 -0
- package/templates/runtime/react/panel-host-geometry.test.ts +66 -0
- package/templates/runtime/react/panel-host-geometry.ts +109 -0
- package/templates/runtime/react/panel-host-types.ts +74 -0
- package/templates/runtime/react/panel-host.test.tsx +102 -0
- package/templates/runtime/react/panel-host.tsx +353 -0
- package/templates/runtime/react/runtime-public-api.test.tsx +132 -0
- package/templates/runtime/react/settings-transfer.test.ts +150 -0
- package/templates/runtime/react/settings-transfer.ts +279 -0
- package/templates/runtime/react/storage-key-migration.ts +48 -0
- package/templates/runtime/react/theme-runtime.tsx +177 -0
- package/templates/runtime/react/timeline-panel.test.tsx +668 -0
- package/templates/runtime/react/timeline-panel.tsx +2953 -0
- package/templates/runtime/react/toolbar-panel.test.tsx +212 -0
- package/templates/runtime/react/toolbar-panel.tsx +205 -0
- package/templates/runtime/react/toolcraft-app.integration.test.tsx +350 -0
- package/templates/runtime/react/toolcraft-app.test.tsx +339 -0
- package/templates/runtime/react/toolcraft-app.tsx +81 -0
- package/templates/runtime/react/toolcraft-root.test.tsx +347 -0
- package/templates/runtime/react/toolcraft-root.tsx +203 -0
- package/templates/runtime/react/use-toolcraft.ts +41 -0
- package/templates/runtime/schema/define-toolcraft.test.ts +1524 -0
- package/templates/runtime/schema/define-toolcraft.ts +1442 -0
- package/templates/runtime/schema/keyframe-capability.test.ts +90 -0
- package/templates/runtime/schema/keyframe-capability.ts +51 -0
- package/templates/runtime/schema/runtime-targets.ts +40 -0
- package/templates/runtime/schema/types.ts +370 -0
- package/templates/runtime/state/canvas-zoom.ts +8 -0
- package/templates/runtime/state/create-template-state.test.ts +242 -0
- package/templates/runtime/state/create-template-state.ts +95 -0
- package/templates/runtime/state/keyframe-evaluation.test.ts +141 -0
- package/templates/runtime/state/keyframe-evaluation.ts +203 -0
- package/templates/runtime/state/persistence.test.ts +217 -0
- package/templates/runtime/state/persistence.ts +511 -0
- package/templates/runtime/state/reducer.test.ts +937 -0
- package/templates/runtime/state/reducer.ts +1212 -0
- package/templates/runtime/state/timeline-readiness.ts +43 -0
- package/templates/runtime/state/types.ts +242 -0
- package/templates/runtime/styles.css +125 -0
- package/templates/runtime/testing/performance.test.ts +1058 -0
- package/templates/runtime/testing/performance.ts +1078 -0
- package/templates/starter/AGENTS.md +186 -0
- package/templates/starter/LICENSE.md +98 -0
- package/templates/starter/NOTICE.md +8 -0
- package/templates/starter/docs/toolcraft/README.md +41 -0
- package/templates/starter/docs/toolcraft/acceptance-testing.md +205 -0
- package/templates/starter/docs/toolcraft/agent-worklog.md +81 -0
- package/templates/starter/docs/toolcraft/assembly-workflow.md +206 -0
- package/templates/starter/docs/toolcraft/component-rules.md +299 -0
- package/templates/starter/docs/toolcraft/custom-controls.md +71 -0
- package/templates/starter/docs/toolcraft/decision-contract.md +71 -0
- package/templates/starter/docs/toolcraft/performance.md +112 -0
- package/templates/starter/docs/toolcraft/renderer-technique.md +48 -0
- package/templates/starter/docs/toolcraft/schema-reference.md +265 -0
- package/templates/starter/docs/toolcraft/workflow.md +87 -0
- package/templates/starter/e2e/app-browser-acceptance.spec.ts +785 -0
- package/templates/starter/e2e/app-controls.spec.ts +41 -0
- package/templates/starter/e2e/app-performance.spec.ts +326 -0
- package/templates/starter/e2e/canvas-handle-helpers.ts +244 -0
- package/templates/starter/e2e/performance-helpers.ts +612 -0
- package/templates/starter/e2e/product-observable-helpers.ts +170 -0
- package/templates/starter/index.html +12 -0
- package/templates/starter/package.json +52 -0
- package/templates/starter/playwright.config.ts +43 -0
- package/templates/starter/scripts/check-ai-skills.mjs +95 -0
- package/templates/starter/scripts/check-toolcraft-docs.mjs +159 -0
- package/templates/starter/scripts/check-toolcraft-integrity.mjs +232 -0
- package/templates/starter/scripts/run-vite-on-free-port.mjs +48 -0
- package/templates/starter/scripts/toolcraft-port.mjs +54 -0
- package/templates/starter/scripts/toolcraft-port.test.mjs +73 -0
- package/templates/starter/src/app/starter-acceptance.test.ts +5959 -0
- package/templates/starter/src/app/starter-acceptance.ts +2646 -0
- package/templates/starter/src/app/starter-performance.test.ts +1390 -0
- package/templates/starter/src/app/starter-performance.ts +12 -0
- package/templates/starter/src/app/starter-schema.test.ts +70 -0
- package/templates/starter/src/app/starter-schema.ts +15 -0
- package/templates/starter/src/main.tsx +18 -0
- package/templates/starter/src/router.tsx +16 -0
- package/templates/starter/src/routes/index.tsx +7 -0
- package/templates/starter/src/routes/root.tsx +19 -0
- package/templates/starter/src/styles.css +120 -0
- package/templates/starter/tsconfig.json +11 -0
- package/templates/starter/vite.config.ts +13 -0
- package/templates/ui/components/composites/accordion.tsx +73 -0
- package/templates/ui/components/composites/alert-dialog.tsx +190 -0
- package/templates/ui/components/composites/alert.tsx +74 -0
- package/templates/ui/components/composites/aspect-ratio.tsx +22 -0
- package/templates/ui/components/composites/avatar.tsx +98 -0
- package/templates/ui/components/composites/badge.tsx +69 -0
- package/templates/ui/components/composites/breadcrumb.tsx +106 -0
- package/templates/ui/components/composites/card.tsx +91 -0
- package/templates/ui/components/composites/combobox.tsx +486 -0
- package/templates/ui/components/composites/command.tsx +296 -0
- package/templates/ui/components/composites/context-menu.tsx +247 -0
- package/templates/ui/components/composites/dialog.tsx +282 -0
- package/templates/ui/components/composites/dropdown-menu.tsx +299 -0
- package/templates/ui/components/composites/empty.tsx +110 -0
- package/templates/ui/components/composites/hover-card.tsx +44 -0
- package/templates/ui/components/composites/index.ts +30 -0
- package/templates/ui/components/composites/menubar.tsx +214 -0
- package/templates/ui/components/composites/navigation-menu.tsx +167 -0
- package/templates/ui/components/composites/pagination.tsx +131 -0
- package/templates/ui/components/composites/progress.tsx +72 -0
- package/templates/ui/components/composites/radio-group.tsx +84 -0
- package/templates/ui/components/composites/resizable.tsx +42 -0
- package/templates/ui/components/composites/sheet.tsx +153 -0
- package/templates/ui/components/composites/sidebar-structural.tsx +310 -0
- package/templates/ui/components/composites/sidebar.tsx +431 -0
- package/templates/ui/components/composites/sonner.tsx +35 -0
- package/templates/ui/components/composites/spinner.tsx +43 -0
- package/templates/ui/components/composites/table.tsx +108 -0
- package/templates/ui/components/composites/tabs.tsx +83 -0
- package/templates/ui/components/control-layout/index.tsx +437 -0
- package/templates/ui/components/controls/actions/actions-control.tsx +139 -0
- package/templates/ui/components/controls/actions/index.ts +9 -0
- package/templates/ui/components/controls/anchor-grid/anchor-grid-control.tsx +107 -0
- package/templates/ui/components/controls/anchor-grid/index.ts +4 -0
- package/templates/ui/components/controls/boolean/boolean-controls.tsx +79 -0
- package/templates/ui/components/controls/boolean/index.ts +4 -0
- package/templates/ui/components/controls/channel-mixer/channel-mixer-control.tsx +95 -0
- package/templates/ui/components/controls/channel-mixer/index.ts +4 -0
- package/templates/ui/components/controls/channel-tabs/channel-tabs.tsx +42 -0
- package/templates/ui/components/controls/channel-tabs/index.ts +6 -0
- package/templates/ui/components/controls/code-textarea/code-textarea-control.tsx +90 -0
- package/templates/ui/components/controls/code-textarea/index.ts +4 -0
- package/templates/ui/components/controls/color/color-control.tsx +571 -0
- package/templates/ui/components/controls/color/color-picker-popover.tsx +104 -0
- package/templates/ui/components/controls/color/index.ts +41 -0
- package/templates/ui/components/controls/color/palette-control-data.ts +436 -0
- package/templates/ui/components/controls/color/palette-control.tsx +535 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-channel-utils.ts +162 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-interactions.ts +190 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-logic.ts +485 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-parts.tsx +710 -0
- package/templates/ui/components/controls/color/style-guide-color-picker.tsx +503 -0
- package/templates/ui/components/controls/control-types.ts +43 -0
- package/templates/ui/components/controls/curves/curve-geometry.ts +355 -0
- package/templates/ui/components/controls/curves/curve-graph.tsx +390 -0
- package/templates/ui/components/controls/curves/curves-control.tsx +445 -0
- package/templates/ui/components/controls/curves/index.ts +6 -0
- package/templates/ui/components/controls/file-drop/file-drop-control.tsx +191 -0
- package/templates/ui/components/controls/file-drop/index.ts +5 -0
- package/templates/ui/components/controls/font-picker/font-catalog.json +15360 -0
- package/templates/ui/components/controls/font-picker/font-catalog.ts +116 -0
- package/templates/ui/components/controls/font-picker/font-picker-control.tsx +1202 -0
- package/templates/ui/components/controls/font-picker/font-preview-loader.ts +336 -0
- package/templates/ui/components/controls/font-picker/index.ts +24 -0
- package/templates/ui/components/controls/font-picker/use-hover-intent.ts +46 -0
- package/templates/ui/components/controls/gradient/gradient-control-utils.ts +190 -0
- package/templates/ui/components/controls/gradient/gradient-control.tsx +612 -0
- package/templates/ui/components/controls/gradient/gradient-stop-list.tsx +400 -0
- package/templates/ui/components/controls/gradient/gradient-toolbar.tsx +152 -0
- package/templates/ui/components/controls/gradient/index.ts +4 -0
- package/templates/ui/components/controls/image-picker/image-picker-control.tsx +139 -0
- package/templates/ui/components/controls/image-picker/index.ts +7 -0
- package/templates/ui/components/controls/index.ts +192 -0
- package/templates/ui/components/controls/range-input/index.ts +4 -0
- package/templates/ui/components/controls/range-input/range-input-control.tsx +173 -0
- package/templates/ui/components/controls/range-slider/index.ts +4 -0
- package/templates/ui/components/controls/range-slider/range-slider-control.tsx +122 -0
- package/templates/ui/components/controls/range-slider/range-slider-value.ts +61 -0
- package/templates/ui/components/controls/segmented/index.ts +8 -0
- package/templates/ui/components/controls/segmented/segmented-control.tsx +94 -0
- package/templates/ui/components/controls/select/index.ts +4 -0
- package/templates/ui/components/controls/select/select-control.tsx +223 -0
- package/templates/ui/components/controls/slider/index.ts +4 -0
- package/templates/ui/components/controls/slider/slider-control.tsx +150 -0
- package/templates/ui/components/controls/slider/slider-value.ts +56 -0
- package/templates/ui/components/controls/text-input/index.ts +4 -0
- package/templates/ui/components/controls/text-input/text-input-control.tsx +158 -0
- package/templates/ui/components/controls/use-measured-element-width.ts +42 -0
- package/templates/ui/components/controls/vector/index.ts +8 -0
- package/templates/ui/components/controls/vector/vector-control.tsx +401 -0
- package/templates/ui/components/panel/index.ts +19 -0
- package/templates/ui/components/panel/panel-actions.tsx +165 -0
- package/templates/ui/components/panel/panel-header.tsx +61 -0
- package/templates/ui/components/panel/panel-icon-button.tsx +96 -0
- package/templates/ui/components/panel/panel-section.tsx +168 -0
- package/templates/ui/components/panel/panel-surface.tsx +206 -0
- package/templates/ui/components/panel/panel.tsx +210 -0
- package/templates/ui/components/primitives/animated-loader.tsx +61 -0
- package/templates/ui/components/primitives/button-group.tsx +134 -0
- package/templates/ui/components/primitives/button.tsx +429 -0
- package/templates/ui/components/primitives/checkbox.tsx +62 -0
- package/templates/ui/components/primitives/editable-slider-value-label.tsx +337 -0
- package/templates/ui/components/primitives/field.tsx +225 -0
- package/templates/ui/components/primitives/index.ts +82 -0
- package/templates/ui/components/primitives/input-group.tsx +298 -0
- package/templates/ui/components/primitives/input.tsx +61 -0
- package/templates/ui/components/primitives/internal/button-loading.tsx +178 -0
- package/templates/ui/components/primitives/label.tsx +16 -0
- package/templates/ui/components/primitives/popover.tsx +126 -0
- package/templates/ui/components/primitives/portal-layer-context.tsx +33 -0
- package/templates/ui/components/primitives/primitive-arrow-icon.tsx +38 -0
- package/templates/ui/components/primitives/scroll-fade-logic.ts +441 -0
- package/templates/ui/components/primitives/scroll-fade-render.tsx +75 -0
- package/templates/ui/components/primitives/scroll-fade-types.ts +41 -0
- package/templates/ui/components/primitives/scroll-fade.tsx +72 -0
- package/templates/ui/components/primitives/select.tsx +408 -0
- package/templates/ui/components/primitives/selection-state.ts +31 -0
- package/templates/ui/components/primitives/separator.tsx +21 -0
- package/templates/ui/components/primitives/slider/index.ts +4 -0
- package/templates/ui/components/primitives/slider/slider-interaction.tsx +96 -0
- package/templates/ui/components/primitives/slider/slider-parts.tsx +303 -0
- package/templates/ui/components/primitives/slider/slider-reset.ts +152 -0
- package/templates/ui/components/primitives/slider/slider-value.ts +114 -0
- package/templates/ui/components/primitives/slider/slider.tsx +511 -0
- package/templates/ui/components/primitives/switch.tsx +35 -0
- package/templates/ui/components/primitives/textarea.tsx +49 -0
- package/templates/ui/components/primitives/toggle-group.tsx +114 -0
- package/templates/ui/components/primitives/toggle.tsx +46 -0
- package/templates/ui/components/primitives/tooltip.tsx +100 -0
- package/templates/ui/hooks/use-mobile.ts +21 -0
- package/templates/ui/index.ts +31 -0
- package/templates/ui/lib/control-outline.ts +3 -0
- package/templates/ui/lib/input-control-style.ts +131 -0
- package/templates/ui/lib/style-guide-color-utils.ts +111 -0
- package/templates/ui/lib/utils.ts +6 -0
- package/templates/ui/styles.css +291 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { PreviewCard as PreviewCardPrimitive } from "@base-ui/react/preview-card";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
|
|
5
|
+
function HoverCard({ ...props }: PreviewCardPrimitive.Root.Props) {
|
|
6
|
+
return <PreviewCardPrimitive.Root data-slot="hover-card" {...props} />;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function HoverCardTrigger({ ...props }: PreviewCardPrimitive.Trigger.Props) {
|
|
10
|
+
return <PreviewCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function HoverCardContent({
|
|
14
|
+
className,
|
|
15
|
+
side = "bottom",
|
|
16
|
+
sideOffset = 4,
|
|
17
|
+
align = "center",
|
|
18
|
+
alignOffset = 4,
|
|
19
|
+
...props
|
|
20
|
+
}: PreviewCardPrimitive.Popup.Props &
|
|
21
|
+
Pick<PreviewCardPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">) {
|
|
22
|
+
return (
|
|
23
|
+
<PreviewCardPrimitive.Portal data-slot="hover-card-portal">
|
|
24
|
+
<PreviewCardPrimitive.Positioner
|
|
25
|
+
align={align}
|
|
26
|
+
alignOffset={alignOffset}
|
|
27
|
+
side={side}
|
|
28
|
+
sideOffset={sideOffset}
|
|
29
|
+
className="isolate z-50"
|
|
30
|
+
>
|
|
31
|
+
<PreviewCardPrimitive.Popup
|
|
32
|
+
data-slot="hover-card-content"
|
|
33
|
+
className={cn(
|
|
34
|
+
"floating-popup-surface z-50 w-72 origin-(--transform-origin) rounded-lg border p-2.5 popup-text-xs-plus leading-relaxed text-[color:var(--popover-foreground)] outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
35
|
+
className,
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
</PreviewCardPrimitive.Positioner>
|
|
40
|
+
</PreviewCardPrimitive.Portal>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
export * from "./accordion";
|
|
4
|
+
export * from "./alert";
|
|
5
|
+
export * from "./alert-dialog";
|
|
6
|
+
export * from "./aspect-ratio";
|
|
7
|
+
export * from "./avatar";
|
|
8
|
+
export * from "./badge";
|
|
9
|
+
export * from "./breadcrumb";
|
|
10
|
+
export * from "./card";
|
|
11
|
+
export * from "./combobox";
|
|
12
|
+
export * from "./command";
|
|
13
|
+
export * from "./context-menu";
|
|
14
|
+
export * from "./dialog";
|
|
15
|
+
export * from "./dropdown-menu";
|
|
16
|
+
export * from "./empty";
|
|
17
|
+
export * from "./hover-card";
|
|
18
|
+
export * from "./menubar";
|
|
19
|
+
export * from "./navigation-menu";
|
|
20
|
+
export * from "./pagination";
|
|
21
|
+
export * from "./progress";
|
|
22
|
+
export * from "./radio-group";
|
|
23
|
+
export * from "./resizable";
|
|
24
|
+
export * from "./sheet";
|
|
25
|
+
export * from "./sidebar";
|
|
26
|
+
export * from "./sidebar-structural";
|
|
27
|
+
export * from "./sonner";
|
|
28
|
+
export * from "./spinner";
|
|
29
|
+
export * from "./table";
|
|
30
|
+
export * from "./tabs";
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar";
|
|
5
|
+
|
|
6
|
+
import { PrimitiveArrowIcon } from "../primitives";
|
|
7
|
+
import { cn } from "../../lib/utils";
|
|
8
|
+
import {
|
|
9
|
+
DropdownMenu,
|
|
10
|
+
DropdownMenuCheckboxItem,
|
|
11
|
+
DropdownMenuContent,
|
|
12
|
+
DropdownMenuGroup,
|
|
13
|
+
DropdownMenuItem,
|
|
14
|
+
DropdownMenuLabel,
|
|
15
|
+
DropdownMenuPortal,
|
|
16
|
+
DropdownMenuRadioGroup,
|
|
17
|
+
DropdownMenuRadioItem,
|
|
18
|
+
DropdownMenuSeparator,
|
|
19
|
+
DropdownMenuShortcut,
|
|
20
|
+
DropdownMenuSub,
|
|
21
|
+
DropdownMenuSubContent,
|
|
22
|
+
DropdownMenuSubTrigger,
|
|
23
|
+
DropdownMenuTrigger,
|
|
24
|
+
} from "./dropdown-menu";
|
|
25
|
+
|
|
26
|
+
function Menubar({ className, ...props }: MenubarPrimitive.Props) {
|
|
27
|
+
return (
|
|
28
|
+
<MenubarPrimitive
|
|
29
|
+
data-slot="menubar"
|
|
30
|
+
className={cn("flex h-9 items-center py-1", className)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function MenubarMenu({ ...props }: React.ComponentProps<typeof DropdownMenu>) {
|
|
37
|
+
return <DropdownMenu data-slot="menubar-menu" {...props} />;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function MenubarGroup({ ...props }: React.ComponentProps<typeof DropdownMenuGroup>) {
|
|
41
|
+
return <DropdownMenuGroup data-slot="menubar-group" {...props} />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function MenubarPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPortal>) {
|
|
45
|
+
return <DropdownMenuPortal data-slot="menubar-portal" {...props} />;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function MenubarTrigger({
|
|
49
|
+
className,
|
|
50
|
+
children,
|
|
51
|
+
...props
|
|
52
|
+
}: React.ComponentProps<typeof DropdownMenuTrigger>) {
|
|
53
|
+
return (
|
|
54
|
+
<DropdownMenuTrigger
|
|
55
|
+
data-slot="menubar-trigger"
|
|
56
|
+
className={cn(
|
|
57
|
+
"group/button flex cursor-pointer items-center gap-1 rounded-[calc(var(--radius-md)-2px)] px-2 py-[calc(--spacing(0.85))] text-xs/relaxed font-medium outline-hidden select-none hover:bg-[color:var(--muted)] aria-expanded:bg-[color:var(--muted)]",
|
|
58
|
+
className,
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
{children}
|
|
63
|
+
<PrimitiveArrowIcon
|
|
64
|
+
className="size-3"
|
|
65
|
+
direction="down"
|
|
66
|
+
openClassName="group-aria-expanded/button:rotate-180"
|
|
67
|
+
/>
|
|
68
|
+
</DropdownMenuTrigger>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function MenubarContent({
|
|
73
|
+
className,
|
|
74
|
+
align = "start",
|
|
75
|
+
alignOffset = -4,
|
|
76
|
+
sideOffset = 8,
|
|
77
|
+
...props
|
|
78
|
+
}: React.ComponentProps<typeof DropdownMenuContent>) {
|
|
79
|
+
return (
|
|
80
|
+
<DropdownMenuContent
|
|
81
|
+
data-slot="menubar-content"
|
|
82
|
+
align={align}
|
|
83
|
+
alignOffset={alignOffset}
|
|
84
|
+
sideOffset={sideOffset}
|
|
85
|
+
className={cn("w-auto min-w-max", className)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function MenubarItem({
|
|
92
|
+
className,
|
|
93
|
+
inset,
|
|
94
|
+
variant = "default",
|
|
95
|
+
...props
|
|
96
|
+
}: React.ComponentProps<typeof DropdownMenuItem>) {
|
|
97
|
+
return (
|
|
98
|
+
<DropdownMenuItem
|
|
99
|
+
data-slot="menubar-item"
|
|
100
|
+
data-inset={inset}
|
|
101
|
+
data-variant={variant}
|
|
102
|
+
className={className}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function MenubarCheckboxItem({
|
|
109
|
+
inset,
|
|
110
|
+
...props
|
|
111
|
+
}: React.ComponentProps<typeof DropdownMenuCheckboxItem> & {
|
|
112
|
+
inset?: boolean;
|
|
113
|
+
}) {
|
|
114
|
+
return (
|
|
115
|
+
<DropdownMenuCheckboxItem data-slot="menubar-checkbox-item" data-inset={inset} {...props} />
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function MenubarRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuRadioGroup>) {
|
|
120
|
+
return <DropdownMenuRadioGroup data-slot="menubar-radio-group" {...props} />;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function MenubarRadioItem({
|
|
124
|
+
inset,
|
|
125
|
+
...props
|
|
126
|
+
}: React.ComponentProps<typeof DropdownMenuRadioItem> & {
|
|
127
|
+
inset?: boolean;
|
|
128
|
+
}) {
|
|
129
|
+
return <DropdownMenuRadioItem data-slot="menubar-radio-item" data-inset={inset} {...props} />;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function MenubarLabel({
|
|
133
|
+
className,
|
|
134
|
+
inset,
|
|
135
|
+
...props
|
|
136
|
+
}: React.ComponentProps<typeof DropdownMenuLabel> & {
|
|
137
|
+
inset?: boolean;
|
|
138
|
+
}) {
|
|
139
|
+
return (
|
|
140
|
+
<DropdownMenuLabel
|
|
141
|
+
data-slot="menubar-label"
|
|
142
|
+
data-inset={inset}
|
|
143
|
+
className={className}
|
|
144
|
+
{...props}
|
|
145
|
+
/>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function MenubarSeparator({
|
|
150
|
+
className,
|
|
151
|
+
...props
|
|
152
|
+
}: React.ComponentProps<typeof DropdownMenuSeparator>) {
|
|
153
|
+
return <DropdownMenuSeparator data-slot="menubar-separator" className={className} {...props} />;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function MenubarShortcut({
|
|
157
|
+
className,
|
|
158
|
+
...props
|
|
159
|
+
}: React.ComponentProps<typeof DropdownMenuShortcut>) {
|
|
160
|
+
return <DropdownMenuShortcut data-slot="menubar-shortcut" className={className} {...props} />;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function MenubarSub({ ...props }: React.ComponentProps<typeof DropdownMenuSub>) {
|
|
164
|
+
return <DropdownMenuSub data-slot="menubar-sub" {...props} />;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function MenubarSubTrigger({
|
|
168
|
+
className,
|
|
169
|
+
inset,
|
|
170
|
+
...props
|
|
171
|
+
}: React.ComponentProps<typeof DropdownMenuSubTrigger> & {
|
|
172
|
+
inset?: boolean;
|
|
173
|
+
}) {
|
|
174
|
+
return (
|
|
175
|
+
<DropdownMenuSubTrigger
|
|
176
|
+
data-slot="menubar-sub-trigger"
|
|
177
|
+
data-inset={inset}
|
|
178
|
+
className={className}
|
|
179
|
+
{...props}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function MenubarSubContent({
|
|
185
|
+
className,
|
|
186
|
+
...props
|
|
187
|
+
}: React.ComponentProps<typeof DropdownMenuSubContent>) {
|
|
188
|
+
return (
|
|
189
|
+
<DropdownMenuSubContent
|
|
190
|
+
data-slot="menubar-sub-content"
|
|
191
|
+
className={cn("w-auto min-w-max", className)}
|
|
192
|
+
{...props}
|
|
193
|
+
/>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export {
|
|
198
|
+
Menubar,
|
|
199
|
+
MenubarPortal,
|
|
200
|
+
MenubarMenu,
|
|
201
|
+
MenubarTrigger,
|
|
202
|
+
MenubarContent,
|
|
203
|
+
MenubarGroup,
|
|
204
|
+
MenubarSeparator,
|
|
205
|
+
MenubarLabel,
|
|
206
|
+
MenubarItem,
|
|
207
|
+
MenubarShortcut,
|
|
208
|
+
MenubarCheckboxItem,
|
|
209
|
+
MenubarRadioGroup,
|
|
210
|
+
MenubarRadioItem,
|
|
211
|
+
MenubarSub,
|
|
212
|
+
MenubarSubTrigger,
|
|
213
|
+
MenubarSubContent,
|
|
214
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { NavigationMenu as NavigationMenuPrimitive } from "@base-ui/react/navigation-menu";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
import { PrimitiveArrowIcon } from "../primitives";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
|
|
7
|
+
function NavigationMenu({
|
|
8
|
+
align = "start",
|
|
9
|
+
className,
|
|
10
|
+
children,
|
|
11
|
+
...props
|
|
12
|
+
}: NavigationMenuPrimitive.Root.Props & Pick<NavigationMenuPrimitive.Positioner.Props, "align">) {
|
|
13
|
+
return (
|
|
14
|
+
<NavigationMenuPrimitive.Root
|
|
15
|
+
data-slot="navigation-menu"
|
|
16
|
+
className={cn(
|
|
17
|
+
"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
|
|
18
|
+
className,
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
<NavigationMenuPositioner align={align} />
|
|
24
|
+
</NavigationMenuPrimitive.Root>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function NavigationMenuList({
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: React.ComponentPropsWithRef<typeof NavigationMenuPrimitive.List>) {
|
|
32
|
+
return (
|
|
33
|
+
<NavigationMenuPrimitive.List
|
|
34
|
+
data-slot="navigation-menu-list"
|
|
35
|
+
className={cn("group flex flex-1 list-none items-center justify-center gap-1", className)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function NavigationMenuItem({
|
|
42
|
+
className,
|
|
43
|
+
...props
|
|
44
|
+
}: React.ComponentPropsWithRef<typeof NavigationMenuPrimitive.Item>) {
|
|
45
|
+
return (
|
|
46
|
+
<NavigationMenuPrimitive.Item
|
|
47
|
+
data-slot="navigation-menu-item"
|
|
48
|
+
className={cn("relative", className)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const navigationMenuInteractiveItemStyle =
|
|
55
|
+
"cursor-pointer bg-transparent text-[color:var(--foreground)] transition-all outline-none hover:bg-[color:color-mix(in_oklab,var(--foreground)_10%,transparent)] hover:text-[color:var(--foreground)] focus:bg-[color:color-mix(in_oklab,var(--foreground)_10%,transparent)] focus:text-[color:var(--foreground)] focus-visible:ring-2 focus-visible:ring-[color:color-mix(in_oklab,var(--ring)_30%,transparent)] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50";
|
|
56
|
+
|
|
57
|
+
const navigationMenuTriggerStyle = cva(
|
|
58
|
+
`${navigationMenuInteractiveItemStyle} group/navigation-menu-trigger inline-flex h-8 w-max items-center justify-center rounded-md px-2.5 py-1.5 text-xs/relaxed font-medium data-popup-open:bg-[color:color-mix(in_oklab,var(--foreground)_10%,transparent)] data-popup-open:text-[color:var(--foreground)] data-open:bg-[color:color-mix(in_oklab,var(--foreground)_10%,transparent)] data-open:text-[color:var(--foreground)]`,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const navigationMenuLinkStyle = cva(
|
|
62
|
+
`${navigationMenuInteractiveItemStyle} flex items-center gap-1.5 rounded-lg p-2 popup-text-xs-plus leading-relaxed data-[active=true]:bg-[color:color-mix(in_oklab,var(--foreground)_10%,transparent)] data-[active=true]:hover:bg-[color:color-mix(in_oklab,var(--foreground)_10%,transparent)] data-[active=true]:focus:bg-[color:color-mix(in_oklab,var(--foreground)_10%,transparent)] [&_svg:not([class*='size-'])]:size-4`,
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
function NavigationMenuTrigger({
|
|
66
|
+
className,
|
|
67
|
+
children,
|
|
68
|
+
...props
|
|
69
|
+
}: NavigationMenuPrimitive.Trigger.Props) {
|
|
70
|
+
return (
|
|
71
|
+
<NavigationMenuPrimitive.Trigger
|
|
72
|
+
data-slot="navigation-menu-trigger"
|
|
73
|
+
className={cn(navigationMenuTriggerStyle(), "group/navigation-menu-trigger", className)}
|
|
74
|
+
{...props}
|
|
75
|
+
>
|
|
76
|
+
{children}{" "}
|
|
77
|
+
<PrimitiveArrowIcon
|
|
78
|
+
className="relative top-px ml-1"
|
|
79
|
+
openClassName="group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-open/navigation-menu-trigger:rotate-180"
|
|
80
|
+
/>
|
|
81
|
+
</NavigationMenuPrimitive.Trigger>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function NavigationMenuContent({ className, ...props }: NavigationMenuPrimitive.Content.Props) {
|
|
86
|
+
return (
|
|
87
|
+
<NavigationMenuPrimitive.Content
|
|
88
|
+
data-slot="navigation-menu-content"
|
|
89
|
+
className={cn(
|
|
90
|
+
"data-ending-style:data-activation-direction=left:translate-x-[50%] data-ending-style:data-activation-direction=right:translate-x-[-50%] data-starting-style:data-activation-direction=left:translate-x-[-50%] data-starting-style:data-activation-direction=right:translate-x-[50%] h-full w-auto p-1.5 transition-opacity duration-[0.35s] ease-[cubic-bezier(0.22,1,0.36,1)] group-data-[viewport=false]/navigation-menu:rounded-xl group-data-[viewport=false]/navigation-menu:bg-[color:var(--popover)] group-data-[viewport=false]/navigation-menu:text-[color:var(--popover-foreground)] group-data-[viewport=false]/navigation-menu:shadow-md group-data-[viewport=false]/navigation-menu:ring-1 group-data-[viewport=false]/navigation-menu:ring-[color:color-mix(in_oklab,var(--foreground)_10%,transparent)] group-data-[viewport=false]/navigation-menu:duration-300 data-ending-style:opacity-0 data-starting-style:opacity-0 data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95",
|
|
91
|
+
className,
|
|
92
|
+
)}
|
|
93
|
+
{...props}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function NavigationMenuPositioner({
|
|
99
|
+
className,
|
|
100
|
+
side = "bottom",
|
|
101
|
+
sideOffset = 8,
|
|
102
|
+
align = "start",
|
|
103
|
+
alignOffset = 0,
|
|
104
|
+
...props
|
|
105
|
+
}: NavigationMenuPrimitive.Positioner.Props) {
|
|
106
|
+
return (
|
|
107
|
+
<NavigationMenuPrimitive.Portal>
|
|
108
|
+
<NavigationMenuPrimitive.Positioner
|
|
109
|
+
side={side}
|
|
110
|
+
sideOffset={sideOffset}
|
|
111
|
+
align={align}
|
|
112
|
+
alignOffset={alignOffset}
|
|
113
|
+
className={cn(
|
|
114
|
+
"isolate z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) data-[side=bottom]:before:top-[-10px] data-[side=bottom]:before:right-0 data-[side=bottom]:before:left-0",
|
|
115
|
+
className,
|
|
116
|
+
)}
|
|
117
|
+
{...props}
|
|
118
|
+
>
|
|
119
|
+
<NavigationMenuPrimitive.Popup className="floating-popup-surface data-[ending-style]:easing-[ease] xs:w-(--popup-width) relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin) rounded-xl border popup-text-xs-plus text-[color:var(--popover-foreground)] transition-[opacity,scale] duration-[0.35s] ease-[cubic-bezier(0.22,1,0.36,1)] outline-none data-ending-style:scale-90 data-ending-style:opacity-0 data-ending-style:duration-150 data-starting-style:scale-90 data-starting-style:opacity-0">
|
|
120
|
+
<NavigationMenuPrimitive.Viewport className="relative size-full overflow-hidden" />
|
|
121
|
+
</NavigationMenuPrimitive.Popup>
|
|
122
|
+
</NavigationMenuPrimitive.Positioner>
|
|
123
|
+
</NavigationMenuPrimitive.Portal>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function NavigationMenuLink({ className, ...props }: NavigationMenuPrimitive.Link.Props) {
|
|
128
|
+
return (
|
|
129
|
+
<NavigationMenuPrimitive.Link
|
|
130
|
+
data-slot="navigation-menu-link"
|
|
131
|
+
className={cn(navigationMenuLinkStyle(), className)}
|
|
132
|
+
{...props}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function NavigationMenuIndicator({
|
|
138
|
+
className,
|
|
139
|
+
...props
|
|
140
|
+
}: React.ComponentPropsWithRef<typeof NavigationMenuPrimitive.Icon>) {
|
|
141
|
+
return (
|
|
142
|
+
<NavigationMenuPrimitive.Icon
|
|
143
|
+
data-slot="navigation-menu-indicator"
|
|
144
|
+
className={cn(
|
|
145
|
+
"top-full z-1 flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in",
|
|
146
|
+
className,
|
|
147
|
+
)}
|
|
148
|
+
{...props}
|
|
149
|
+
>
|
|
150
|
+
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-[color:color-mix(in_oklab,var(--border)_12%,transparent)] shadow-md" />
|
|
151
|
+
</NavigationMenuPrimitive.Icon>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export {
|
|
156
|
+
NavigationMenu,
|
|
157
|
+
NavigationMenuContent,
|
|
158
|
+
NavigationMenuIndicator,
|
|
159
|
+
NavigationMenuItem,
|
|
160
|
+
navigationMenuLinkStyle,
|
|
161
|
+
NavigationMenuLink,
|
|
162
|
+
NavigationMenuList,
|
|
163
|
+
NavigationMenuTrigger,
|
|
164
|
+
navigationMenuInteractiveItemStyle,
|
|
165
|
+
navigationMenuTriggerStyle,
|
|
166
|
+
NavigationMenuPositioner,
|
|
167
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { CaretLeftIcon, CaretRightIcon, DotsThreeIcon } from "@phosphor-icons/react";
|
|
4
|
+
import { Button } from "../primitives";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
|
|
7
|
+
function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
|
8
|
+
return (
|
|
9
|
+
<nav
|
|
10
|
+
aria-label="pagination"
|
|
11
|
+
data-slot="pagination"
|
|
12
|
+
className={cn("mx-auto flex w-full justify-center", className)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function PaginationContent({ className, ...props }: React.ComponentProps<"ul">) {
|
|
19
|
+
return (
|
|
20
|
+
<ul
|
|
21
|
+
data-slot="pagination-content"
|
|
22
|
+
className={cn("flex items-center gap-0.5", className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function PaginationItem({ ...props }: React.ComponentProps<"li">) {
|
|
29
|
+
return <li data-slot="pagination-item" {...props} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type PaginationLinkProps = {
|
|
33
|
+
isActive?: boolean;
|
|
34
|
+
} & {
|
|
35
|
+
size?: "default" | "icon";
|
|
36
|
+
} & React.ComponentProps<"a">;
|
|
37
|
+
|
|
38
|
+
function PaginationLink({
|
|
39
|
+
children,
|
|
40
|
+
className,
|
|
41
|
+
isActive,
|
|
42
|
+
size = "icon",
|
|
43
|
+
...props
|
|
44
|
+
}: PaginationLinkProps) {
|
|
45
|
+
return (
|
|
46
|
+
<Button
|
|
47
|
+
className={className}
|
|
48
|
+
radius="md"
|
|
49
|
+
size={size}
|
|
50
|
+
variant={isActive ? "outline" : "ghost-muted"}
|
|
51
|
+
render={(renderProps) => {
|
|
52
|
+
const { children: renderedChildren, ...renderedAnchorProps } =
|
|
53
|
+
renderProps as React.ComponentProps<"a">;
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<a
|
|
57
|
+
{...renderedAnchorProps}
|
|
58
|
+
{...props}
|
|
59
|
+
aria-current={isActive ? "page" : undefined}
|
|
60
|
+
data-active={isActive}
|
|
61
|
+
>
|
|
62
|
+
{renderedChildren}
|
|
63
|
+
</a>
|
|
64
|
+
);
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
{children}
|
|
68
|
+
</Button>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function PaginationPrevious({
|
|
73
|
+
className,
|
|
74
|
+
text = "Previous",
|
|
75
|
+
...props
|
|
76
|
+
}: React.ComponentProps<typeof PaginationLink> & {
|
|
77
|
+
text?: string;
|
|
78
|
+
}) {
|
|
79
|
+
return (
|
|
80
|
+
<PaginationLink
|
|
81
|
+
aria-label="Go to previous page"
|
|
82
|
+
className={className}
|
|
83
|
+
size="default"
|
|
84
|
+
{...props}
|
|
85
|
+
>
|
|
86
|
+
<CaretLeftIcon data-icon="inline-start" />
|
|
87
|
+
<span className="hidden sm:block">{text}</span>
|
|
88
|
+
</PaginationLink>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function PaginationNext({
|
|
93
|
+
className,
|
|
94
|
+
text = "Next",
|
|
95
|
+
...props
|
|
96
|
+
}: React.ComponentProps<typeof PaginationLink> & {
|
|
97
|
+
text?: string;
|
|
98
|
+
}) {
|
|
99
|
+
return (
|
|
100
|
+
<PaginationLink aria-label="Go to next page" className={className} size="default" {...props}>
|
|
101
|
+
<span className="hidden sm:block">{text}</span>
|
|
102
|
+
<CaretRightIcon data-icon="inline-end" />
|
|
103
|
+
</PaginationLink>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function PaginationEllipsis({ className, ...props }: React.ComponentProps<"span">) {
|
|
108
|
+
return (
|
|
109
|
+
<Button
|
|
110
|
+
aria-hidden
|
|
111
|
+
className={cn("pointer-events-none", className)}
|
|
112
|
+
radius="md"
|
|
113
|
+
render={<span data-slot="pagination-ellipsis" {...props} />}
|
|
114
|
+
size="icon"
|
|
115
|
+
variant="ghost-muted"
|
|
116
|
+
>
|
|
117
|
+
<DotsThreeIcon />
|
|
118
|
+
<span className="sr-only">More pages</span>
|
|
119
|
+
</Button>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
Pagination,
|
|
125
|
+
PaginationContent,
|
|
126
|
+
PaginationEllipsis,
|
|
127
|
+
PaginationItem,
|
|
128
|
+
PaginationLink,
|
|
129
|
+
PaginationNext,
|
|
130
|
+
PaginationPrevious,
|
|
131
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Progress as ProgressPrimitive } from "@base-ui/react/progress";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
|
|
4
|
+
function Progress({ className, children, value, ...props }: ProgressPrimitive.Root.Props) {
|
|
5
|
+
return (
|
|
6
|
+
<ProgressPrimitive.Root
|
|
7
|
+
value={value}
|
|
8
|
+
data-slot="progress"
|
|
9
|
+
className={cn("flex flex-wrap gap-3", className)}
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
{children}
|
|
13
|
+
<ProgressTrack>
|
|
14
|
+
<ProgressIndicator />
|
|
15
|
+
</ProgressTrack>
|
|
16
|
+
</ProgressPrimitive.Root>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function ProgressTrack({ className, ...props }: ProgressPrimitive.Track.Props) {
|
|
21
|
+
return (
|
|
22
|
+
<ProgressPrimitive.Track
|
|
23
|
+
className={cn(
|
|
24
|
+
"relative flex h-1 w-full items-center overflow-x-hidden rounded-md bg-[color:var(--muted)]",
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
data-slot="progress-track"
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function ProgressIndicator({ className, ...props }: ProgressPrimitive.Indicator.Props) {
|
|
34
|
+
return (
|
|
35
|
+
<ProgressPrimitive.Indicator
|
|
36
|
+
data-slot="progress-indicator"
|
|
37
|
+
className={cn("h-full bg-[color:var(--primary)] transition-all", className)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function ProgressLabel({ className, ...props }: ProgressPrimitive.Label.Props) {
|
|
44
|
+
return (
|
|
45
|
+
<ProgressPrimitive.Label
|
|
46
|
+
className={cn("text-xs/relaxed font-medium", className)}
|
|
47
|
+
data-slot="progress-label"
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function ProgressValue({ className, ...props }: ProgressPrimitive.Value.Props) {
|
|
54
|
+
return (
|
|
55
|
+
<ProgressPrimitive.Value
|
|
56
|
+
className={cn(
|
|
57
|
+
"ml-auto text-xs/relaxed text-[color:var(--muted-foreground)] tabular-nums",
|
|
58
|
+
className,
|
|
59
|
+
)}
|
|
60
|
+
data-slot="progress-value"
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
Progress,
|
|
68
|
+
ProgressTrack,
|
|
69
|
+
ProgressIndicator,
|
|
70
|
+
ProgressLabel,
|
|
71
|
+
ProgressValue,
|
|
72
|
+
};
|