@kala-ui/react 0.0.1-beta.7 → 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/dist/components/accordion/accordion-skeleton.js +1 -1
- package/dist/components/accordion/accordion.js +2 -1
- package/dist/components/action-icon/action-icon.d.ts +12 -0
- package/dist/components/action-icon/action-icon.js +35 -0
- package/dist/components/action-icon/action-icon.stories.d.ts +9 -0
- package/dist/components/action-icon/action-icon.stories.js +42 -0
- package/dist/components/action-icon/index.d.ts +1 -0
- package/dist/components/action-icon/index.js +1 -0
- package/dist/components/alert/alert-skeleton.js +4 -3
- package/dist/components/alert/alert.d.ts +2 -2
- package/dist/components/alert/alert.js +8 -6
- package/dist/components/alert/alert.stories.js +13 -9
- package/dist/components/alert/index.d.ts +1 -1
- package/dist/components/alert-dialog/alert-dialog.js +8 -5
- package/dist/components/app-shell/app-shell.d.ts +58 -0
- package/dist/components/app-shell/app-shell.js +111 -0
- package/dist/components/app-shell/app-shell.stories.d.ts +8 -0
- package/dist/components/app-shell/app-shell.stories.js +35 -0
- package/dist/components/app-shell/index.d.ts +1 -0
- package/dist/components/app-shell/index.js +1 -0
- package/dist/components/avatar/avatar.d.ts +2 -2
- package/dist/components/avatar/avatar.stories.js +1 -1
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/badge/badge.js +1 -1
- package/dist/components/badge/badge.stories.js +1 -1
- package/dist/components/banner/banner-skeleton.js +1 -1
- package/dist/components/banner/banner.d.ts +1 -1
- package/dist/components/banner/banner.stories.js +1 -1
- package/dist/components/box/box.d.ts +8 -0
- package/dist/components/box/box.js +10 -0
- package/dist/components/box/box.stories.d.ts +8 -0
- package/dist/components/box/box.stories.js +32 -0
- package/dist/components/box/index.d.ts +1 -0
- package/dist/components/box/index.js +1 -0
- package/dist/components/breadcrumbs/breadcrumbs-skeleton.js +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.stories.js +1 -1
- package/dist/components/burger/burger.d.ts +8 -0
- package/dist/components/burger/burger.js +21 -0
- package/dist/components/burger/burger.stories.d.ts +8 -0
- package/dist/components/burger/burger.stories.js +31 -0
- package/dist/components/burger/index.d.ts +1 -0
- package/dist/components/burger/index.js +1 -0
- package/dist/components/button/button.d.ts +2 -2
- package/dist/components/button/button.stories.js +10 -7
- package/dist/components/button-group/button-group.stories.js +1 -1
- package/dist/components/calendar/calendar-skeleton.js +1 -1
- package/dist/components/calendar/calendar.d.ts +1 -1
- package/dist/components/calendar/calendar.js +1 -1
- package/dist/components/calendar/calendar.types.d.ts +3 -3
- package/dist/components/card/card-skeleton.js +2 -2
- package/dist/components/card/card.js +17 -14
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/center/center.d.ts +7 -0
- package/dist/components/center/center.js +10 -0
- package/dist/components/center/center.stories.d.ts +7 -0
- package/dist/components/center/center.stories.js +25 -0
- package/dist/components/center/index.d.ts +1 -0
- package/dist/components/center/index.js +1 -0
- package/dist/components/charts/area-chart.js +1 -1
- package/dist/components/charts/bar-chart.js +1 -1
- package/dist/components/charts/donut-chart.js +1 -1
- package/dist/components/charts/index.d.ts +2 -2
- package/dist/components/charts/index.js +2 -2
- package/dist/components/charts/line-chart.js +1 -1
- package/dist/components/charts/radial-bar-chart.js +1 -1
- package/dist/components/charts/theme-utils.d.ts +1 -1
- package/dist/components/charts/use-theme-aware-chart.d.ts +1 -1
- package/dist/components/charts/use-theme-aware-chart.js +2 -1
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/checkbox/checkbox.stories.js +12 -8
- package/dist/components/close-button/close-button.d.ts +7 -0
- package/dist/components/close-button/close-button.js +9 -0
- package/dist/components/close-button/close-button.stories.d.ts +7 -0
- package/dist/components/close-button/close-button.stories.js +18 -0
- package/dist/components/close-button/index.d.ts +1 -0
- package/dist/components/close-button/index.js +1 -0
- package/dist/components/code/code.d.ts +8 -0
- package/dist/components/code/code.js +14 -0
- package/dist/components/code/code.stories.d.ts +8 -0
- package/dist/components/code/code.stories.js +31 -0
- package/dist/components/code/index.d.ts +1 -0
- package/dist/components/code/index.js +1 -0
- package/dist/components/collapse/collapse.d.ts +17 -0
- package/dist/components/collapse/collapse.js +34 -0
- package/dist/components/collapse/index.d.ts +1 -0
- package/dist/components/collapse/index.js +1 -0
- package/dist/components/color-input/color-input.d.ts +28 -0
- package/dist/components/color-input/color-input.js +35 -0
- package/dist/components/color-input/color-input.stories.d.ts +10 -0
- package/dist/components/color-input/color-input.stories.js +41 -0
- package/dist/components/color-input/index.d.ts +1 -0
- package/dist/components/color-input/index.js +1 -0
- package/dist/components/combobox/combobox-skeleton.js +1 -1
- package/dist/components/combobox/combobox.d.ts +1 -1
- package/dist/components/combobox/combobox.js +17 -8
- package/dist/components/combobox/combobox.stories.js +1 -1
- package/dist/components/command/command.d.ts +2 -2
- package/dist/components/command/command.stories.js +14 -19
- package/dist/components/container/container.d.ts +1 -1
- package/dist/components/container/index.d.ts +1 -1
- package/dist/components/container/index.js +1 -1
- package/dist/components/data-table/column-header-filter.js +11 -6
- package/dist/components/data-table/data-table-skeleton.js +5 -15
- package/dist/components/data-table/data-table.js +18 -15
- package/dist/components/data-table/data-table.stories.js +3 -5
- package/dist/components/date-picker/date-picker.d.ts +1 -1
- package/dist/components/date-picker/date-picker.js +3 -3
- package/dist/components/date-picker/date-picker.types.d.ts +1 -1
- package/dist/components/dialog/dialog-skeleton.js +1 -1
- package/dist/components/dialog/dialog.js +6 -4
- package/dist/components/dialog/dialog.stories.js +2 -2
- package/dist/components/dnd/dnd.d.ts +4 -5
- package/dist/components/dnd/dnd.js +5 -5
- package/dist/components/dnd/dnd.stories.js +48 -40
- package/dist/components/drawer/drawer.stories.js +2 -2
- package/dist/components/empty-state/empty-state-skeleton.js +2 -3
- package/dist/components/empty-state/empty-state.d.ts +1 -1
- package/dist/components/field/field-skeleton.js +1 -1
- package/dist/components/field/field.stories.js +1 -1
- package/dist/components/file-upload/file-upload-skeleton.js +1 -1
- package/dist/components/flex/flex.d.ts +7 -5
- package/dist/components/flex/flex.js +2 -2
- package/dist/components/flex/index.d.ts +1 -1
- package/dist/components/flex/index.js +1 -1
- package/dist/components/grid/grid.d.ts +24 -0
- package/dist/components/grid/grid.js +136 -0
- package/dist/components/grid/grid.stories.d.ts +8 -0
- package/dist/components/grid/grid.stories.js +31 -0
- package/dist/components/grid/index.d.ts +1 -0
- package/dist/components/grid/index.js +1 -0
- package/dist/components/group/group.d.ts +2 -2
- package/dist/components/group/group.js +1 -1
- package/dist/components/group/index.d.ts +1 -1
- package/dist/components/group/index.js +1 -1
- package/dist/components/header/header-skeleton.js +1 -1
- package/dist/components/header/header.d.ts +3 -3
- package/dist/components/header/header.js +17 -31
- package/dist/components/header/index.d.ts +1 -1
- package/dist/components/heading/heading.d.ts +4 -2
- package/dist/components/heading/heading.js +3 -7
- package/dist/components/heading/index.d.ts +1 -1
- package/dist/components/heading/index.js +1 -1
- package/dist/components/indicator/index.d.ts +1 -0
- package/dist/components/indicator/index.js +1 -0
- package/dist/components/indicator/indicator.d.ts +30 -0
- package/dist/components/indicator/indicator.js +89 -0
- package/dist/components/indicator/indicator.stories.d.ts +10 -0
- package/dist/components/indicator/indicator.stories.js +75 -0
- package/dist/components/input/input.js +1 -1
- package/dist/components/input/input.stories.js +1 -1
- package/dist/components/input-group/input-group.stories.js +1 -1
- package/dist/components/kbd/index.d.ts +1 -0
- package/dist/components/kbd/index.js +1 -0
- package/dist/components/kbd/kbd.d.ts +6 -0
- package/dist/components/kbd/kbd.js +13 -0
- package/dist/components/kbd/kbd.stories.d.ts +9 -0
- package/dist/components/kbd/kbd.stories.js +28 -0
- package/dist/components/label/label.stories.js +1 -1
- package/dist/components/list/list-skeleton.js +2 -2
- package/dist/components/list/list.js +1 -1
- package/dist/components/list/list.stories.js +1 -1
- package/dist/components/list/list.types.d.ts +2 -2
- package/dist/components/loading-overlay/index.d.ts +1 -0
- package/dist/components/loading-overlay/index.js +1 -0
- package/dist/components/loading-overlay/loading-overlay.d.ts +19 -0
- package/dist/components/loading-overlay/loading-overlay.js +19 -0
- package/dist/components/loading-overlay/loading-overlay.stories.d.ts +8 -0
- package/dist/components/loading-overlay/loading-overlay.stories.js +46 -0
- package/dist/components/metric-card/metric-card-skeleton.js +2 -2
- package/dist/components/metric-card/metric-card.js +1 -1
- package/dist/components/multi-select/multi-select-skeleton.js +1 -1
- package/dist/components/multi-select/multi-select.stories.js +1 -1
- package/dist/components/nav-link/index.d.ts +1 -0
- package/dist/components/nav-link/index.js +1 -0
- package/dist/components/nav-link/nav-link.d.ts +26 -0
- package/dist/components/nav-link/nav-link.js +26 -0
- package/dist/components/nav-link/nav-link.stories.d.ts +9 -0
- package/dist/components/nav-link/nav-link.stories.js +37 -0
- package/dist/components/navigation/navigation-skeleton.js +1 -1
- package/dist/components/number-input/index.d.ts +1 -0
- package/dist/components/number-input/index.js +1 -0
- package/dist/components/number-input/number-input.d.ts +40 -0
- package/dist/components/number-input/number-input.js +69 -0
- package/dist/components/number-input/number-input.stories.d.ts +11 -0
- package/dist/components/number-input/number-input.stories.js +54 -0
- package/dist/components/overlay/index.d.ts +1 -0
- package/dist/components/overlay/index.js +1 -0
- package/dist/components/overlay/overlay.d.ts +22 -0
- package/dist/components/overlay/overlay.js +45 -0
- package/dist/components/overlay/overlay.stories.d.ts +9 -0
- package/dist/components/overlay/overlay.stories.js +47 -0
- package/dist/components/page-transition/page-transition.stories.js +1 -1
- package/dist/components/pagination/index.d.ts +1 -1
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/pagination/pagination-skeleton.js +1 -1
- package/dist/components/pagination/pagination.d.ts +44 -28
- package/dist/components/pagination/pagination.js +53 -79
- package/dist/components/pagination/pagination.stories.d.ts +1 -0
- package/dist/components/pagination/pagination.stories.js +31 -5
- package/dist/components/paper/index.d.ts +1 -0
- package/dist/components/paper/index.js +1 -0
- package/dist/components/paper/paper.d.ts +12 -0
- package/dist/components/paper/paper.js +39 -0
- package/dist/components/paper/paper.stories.d.ts +7 -0
- package/dist/components/paper/paper.stories.js +30 -0
- package/dist/components/password-strength-indicator/password-strength-indicator.stories.js +1 -1
- package/dist/components/popover/popover-skeleton.js +1 -1
- package/dist/components/popover/popover.stories.js +2 -2
- package/dist/components/progress/index.d.ts +1 -1
- package/dist/components/progress/progress.d.ts +1 -1
- package/dist/components/progress/progress.stories.js +1 -1
- package/dist/components/radio-group/radio-group-skeleton.js +1 -1
- package/dist/components/radio-group/radio-group.stories.js +1 -1
- package/dist/components/resizable/resizable.stories.js +8 -8
- package/dist/components/ring-progress/index.d.ts +1 -0
- package/dist/components/ring-progress/index.js +1 -0
- package/dist/components/ring-progress/ring-progress.d.ts +24 -0
- package/dist/components/ring-progress/ring-progress.js +20 -0
- package/dist/components/ring-progress/ring-progress.stories.d.ts +9 -0
- package/dist/components/ring-progress/ring-progress.stories.js +46 -0
- package/dist/components/scroll-area/scroll-area.stories.js +26 -26
- package/dist/components/segmented-control/index.d.ts +1 -0
- package/dist/components/segmented-control/index.js +1 -0
- package/dist/components/segmented-control/segmented-control.d.ts +19 -0
- package/dist/components/segmented-control/segmented-control.js +46 -0
- package/dist/components/segmented-control/segmented-control.stories.d.ts +10 -0
- package/dist/components/segmented-control/segmented-control.stories.js +53 -0
- package/dist/components/select/select.js +1 -1
- package/dist/components/select/select.stories.js +1 -1
- package/dist/components/separator/separator.stories.js +1 -1
- package/dist/components/session-card/session-card-skeleton.js +2 -2
- package/dist/components/session-card/session-card.js +1 -1
- package/dist/components/sidebar/sidebar-skeleton.js +2 -2
- package/dist/components/skeleton/index.d.ts +3 -3
- package/dist/components/skeleton/index.js +1 -1
- package/dist/components/skeleton/skeleton.types.d.ts +0 -249
- package/dist/components/slider/index.d.ts +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/slider/slider.stories.js +1 -1
- package/dist/components/social-login-button/social-login-button.js +6 -6
- package/dist/components/sparkline-chart/sparkline-chart.js +6 -3
- package/dist/components/sparkline-chart/sparkline-chart.stories.js +1 -1
- package/dist/components/spinner/spinner.d.ts +1 -1
- package/dist/components/spoiler/index.d.ts +1 -0
- package/dist/components/spoiler/index.js +1 -0
- package/dist/components/spoiler/spoiler.d.ts +14 -0
- package/dist/components/spoiler/spoiler.js +20 -0
- package/dist/components/spoiler/spoiler.stories.d.ts +8 -0
- package/dist/components/spoiler/spoiler.stories.js +35 -0
- package/dist/components/stack/index.d.ts +1 -1
- package/dist/components/stack/index.js +1 -1
- package/dist/components/stack/stack.d.ts +2 -2
- package/dist/components/stack/stack.js +1 -1
- package/dist/components/steps/steps-skeleton.js +1 -1
- package/dist/components/steps/steps.js +7 -5
- package/dist/components/steps/steps.stories.js +6 -2
- package/dist/components/switch/index.d.ts +1 -1
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/switch/switch.stories.js +1 -1
- package/dist/components/table/table-skeleton.js +2 -2
- package/dist/components/table/table.js +4 -3
- package/dist/components/table/table.stories.js +10 -7
- package/dist/components/tabs/tabs-skeleton.js +1 -1
- package/dist/components/tabs/tabs.d.ts +3 -3
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/tabs/tabs.stories.js +5 -5
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.js +1 -1
- package/dist/components/text/text.d.ts +7 -5
- package/dist/components/text/text.js +2 -2
- package/dist/components/text/text.stories.js +34 -3
- package/dist/components/textarea/textarea.js +1 -1
- package/dist/components/textarea/textarea.stories.js +1 -1
- package/dist/components/timeline/index.d.ts +1 -0
- package/dist/components/timeline/index.js +1 -0
- package/dist/components/timeline/timeline.d.ts +35 -0
- package/dist/components/timeline/timeline.js +36 -0
- package/dist/components/timeline/timeline.stories.d.ts +7 -0
- package/dist/components/timeline/timeline.stories.js +21 -0
- package/dist/components/toast/toast.js +6 -6
- package/dist/components/toggle/toggle.stories.js +1 -1
- package/dist/components/tooltip/tooltip.stories.js +1 -1
- package/dist/components/user-menu-dropdown/user-menu-dropdown.js +1 -1
- package/dist/config/tailwind-base.d.ts +10 -0
- package/dist/config/tailwind-base.js +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +25 -10
- package/dist/lib/animations.js +94 -94
- package/dist/primitives/command/Command.js +2 -1
- package/dist/styles/globals.css +415 -82
- package/package.json +101 -24
|
@@ -6,7 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
* Supports multiple items with expanded state.
|
|
7
7
|
*/
|
|
8
8
|
import { cn } from "../../lib/utils";
|
|
9
|
-
import { Skeleton } from "../skeleton
|
|
9
|
+
import { Skeleton } from "../skeleton";
|
|
10
10
|
/**
|
|
11
11
|
* Accordion skeleton component
|
|
12
12
|
*
|
|
@@ -5,6 +5,7 @@ import { cva } from "class-variance-authority";
|
|
|
5
5
|
import { ChevronDown } from "lucide-react";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { cn } from "../../lib/utils";
|
|
8
|
+
import { Box } from "../box";
|
|
8
9
|
const accordionVariants = cva("w-full", {
|
|
9
10
|
variants: {
|
|
10
11
|
variant: {
|
|
@@ -37,6 +38,6 @@ function AccordionTrigger({ className, children, ...props }) {
|
|
|
37
38
|
}
|
|
38
39
|
function AccordionContent({ className, children, ...props }) {
|
|
39
40
|
const { variant } = React.useContext(AccordionContext);
|
|
40
|
-
return (_jsx(AccordionPrimitive.Content, { "data-slot": "accordion-content", className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden", ...props, children: _jsx(
|
|
41
|
+
return (_jsx(AccordionPrimitive.Content, { "data-slot": "accordion-content", className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden", ...props, children: _jsx(Box, { className: cn("text-sm text-foreground leading-relaxed", variant === "default" && "pb-4 pt-1", variant === "bordered" && "px-4 pb-4 pt-2", variant === "filled" && "px-4 pb-4 pt-2 bg-muted/50", className), children: children }) }));
|
|
41
42
|
}
|
|
42
43
|
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const actionIconVariants: (props?: ({
|
|
4
|
+
variant?: "filled" | "light" | "outline" | "subtle" | "transparent" | "ghost" | null | undefined;
|
|
5
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export interface ActionIconProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof actionIconVariants> {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const ActionIcon: React.ForwardRefExoticComponent<ActionIconProps & React.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
export { ActionIcon, actionIconVariants };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { Loader2 } from "lucide-react";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const actionIconVariants = cva("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
filled: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
11
|
+
light: "bg-primary/10 text-primary hover:bg-primary/20",
|
|
12
|
+
outline: "border border-input hover:bg-accent hover:text-accent-foreground",
|
|
13
|
+
subtle: "hover:bg-accent hover:text-accent-foreground",
|
|
14
|
+
transparent: "bg-transparent hover:bg-transparent text-foreground",
|
|
15
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
xs: "h-6 w-6",
|
|
19
|
+
sm: "h-8 w-8",
|
|
20
|
+
md: "h-10 w-10",
|
|
21
|
+
lg: "h-12 w-12",
|
|
22
|
+
xl: "h-14 w-14",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: "subtle",
|
|
27
|
+
size: "md",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const ActionIcon = React.forwardRef(({ className, variant, size, asChild = false, loading = false, children, disabled, ...props }, ref) => {
|
|
31
|
+
const Comp = asChild ? Slot : "button";
|
|
32
|
+
return (_jsx(Comp, { className: cn(actionIconVariants({ variant, size, className })), ref: ref, disabled: disabled || loading, ...props, children: loading ? _jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : children }));
|
|
33
|
+
});
|
|
34
|
+
ActionIcon.displayName = "ActionIcon";
|
|
35
|
+
export { ActionIcon, actionIconVariants };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ActionIcon } from "./action-icon";
|
|
3
|
+
declare const meta: Meta<typeof ActionIcon>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ActionIcon>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Variants: Story;
|
|
8
|
+
export declare const Sizes: Story;
|
|
9
|
+
export declare const Loading: Story;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Heart, Settings, Trash } from "lucide-react";
|
|
3
|
+
import { ActionIcon } from "./action-icon";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Components/ActionIcon",
|
|
6
|
+
component: ActionIcon,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
argTypes: {
|
|
9
|
+
variant: {
|
|
10
|
+
control: "select",
|
|
11
|
+
options: ["filled", "light", "outline", "subtle", "transparent", "ghost"],
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
control: "select",
|
|
15
|
+
options: ["xs", "sm", "md", "lg", "xl"],
|
|
16
|
+
},
|
|
17
|
+
loading: {
|
|
18
|
+
control: "boolean",
|
|
19
|
+
},
|
|
20
|
+
disabled: {
|
|
21
|
+
control: "boolean",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export default meta;
|
|
26
|
+
export const Default = {
|
|
27
|
+
args: {
|
|
28
|
+
children: _jsx(Settings, { className: "h-4 w-4" }),
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export const Variants = {
|
|
32
|
+
render: () => (_jsxs("div", { className: "flex gap-4 items-center", children: [_jsx(ActionIcon, { variant: "filled", children: _jsx(Heart, { className: "h-4 w-4" }) }), _jsx(ActionIcon, { variant: "light", children: _jsx(Heart, { className: "h-4 w-4" }) }), _jsx(ActionIcon, { variant: "outline", children: _jsx(Heart, { className: "h-4 w-4" }) }), _jsx(ActionIcon, { variant: "subtle", children: _jsx(Heart, { className: "h-4 w-4" }) }), _jsx(ActionIcon, { variant: "ghost", children: _jsx(Heart, { className: "h-4 w-4" }) })] })),
|
|
33
|
+
};
|
|
34
|
+
export const Sizes = {
|
|
35
|
+
render: () => (_jsxs("div", { className: "flex gap-4 items-end", children: [_jsx(ActionIcon, { size: "xs", variant: "outline", children: _jsx(Trash, { className: "h-3 w-3" }) }), _jsx(ActionIcon, { size: "sm", variant: "outline", children: _jsx(Trash, { className: "h-4 w-4" }) }), _jsx(ActionIcon, { size: "md", variant: "outline", children: _jsx(Trash, { className: "h-5 w-5" }) }), _jsx(ActionIcon, { size: "lg", variant: "outline", children: _jsx(Trash, { className: "h-6 w-6" }) }), _jsx(ActionIcon, { size: "xl", variant: "outline", children: _jsx(Trash, { className: "h-8 w-8" }) })] })),
|
|
36
|
+
};
|
|
37
|
+
export const Loading = {
|
|
38
|
+
args: {
|
|
39
|
+
loading: true,
|
|
40
|
+
variant: "outline",
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./action-icon";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./action-icon";
|
|
@@ -5,10 +5,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
* Loading placeholder for the Alert component.
|
|
6
6
|
* Provides zero-CLS skeleton state that matches actual alert layout.
|
|
7
7
|
*/
|
|
8
|
+
import { alertStyles } from "../../config/alert";
|
|
8
9
|
import { cn } from "../../lib/utils";
|
|
9
|
-
import { Skeleton } from "../skeleton
|
|
10
|
+
import { Skeleton } from "../skeleton";
|
|
10
11
|
import { SkeletonCircle } from "../skeleton/skeleton-patterns";
|
|
11
|
-
import { alertStyles } from "../../config/alert";
|
|
12
12
|
/**
|
|
13
13
|
* Alert skeleton component
|
|
14
14
|
*
|
|
@@ -20,7 +20,8 @@ import { alertStyles } from "../../config/alert";
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
export function AlertSkeleton({ variant = "primary", showIcon = true, className, "data-testid": dataTestId, }) {
|
|
23
|
-
return (_jsxs("div", { "data-testid": dataTestId || "alert-skeleton", role: "alert", className: cn(alertStyles.base, variant &&
|
|
23
|
+
return (_jsxs("div", { "data-testid": dataTestId || "alert-skeleton", role: "alert", className: cn(alertStyles.base, variant &&
|
|
24
|
+
alertStyles.compoundVariants?.find((v) => v.variant === variant && v.style === "default")?.className, className), children: [showIcon && _jsx(SkeletonCircle, { size: "1rem", className: "rounded-md" }), _jsxs("div", { className: "flex-1", children: [_jsx(Skeleton, { className: "h-5 w-48 mb-2" }), _jsx(Skeleton, { className: "h-4 w-64" })] })] }));
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* Compound component: Alert.Skeleton
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { AlertProps } from "./alert.types";
|
|
3
3
|
declare const alertVariants: (props?: ({
|
|
4
|
-
readonly variant?: "
|
|
5
|
-
readonly style?: "default" | "
|
|
4
|
+
readonly variant?: "primary" | "secondary" | "success" | "danger" | "destructive" | "warning" | "info" | null | undefined;
|
|
5
|
+
readonly style?: "default" | "outline" | "solid" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Alert({ className, variant, style: alertStyle, dismissable, onDismiss, showIcon, children, isLoading, skeletonConfig, skeleton, ...props }: AlertProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
8
|
declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useDisclosure } from "@kala-ui/react-hooks";
|
|
2
3
|
import { cva } from "class-variance-authority";
|
|
3
4
|
import { AlertCircle, AlertTriangle, CheckCircle2, Info, X, } from "lucide-react";
|
|
4
5
|
import * as React from "react";
|
|
5
6
|
import { alertStyles } from "../../config/alert";
|
|
6
7
|
import { cn } from "../../lib/utils";
|
|
8
|
+
import { Box } from "../box";
|
|
7
9
|
import { AlertSkeleton } from "./alert-skeleton";
|
|
8
10
|
const alertVariants = cva(alertStyles.base, {
|
|
9
11
|
variants: alertStyles.variants,
|
|
@@ -20,15 +22,15 @@ const variantIcons = {
|
|
|
20
22
|
info: Info,
|
|
21
23
|
};
|
|
22
24
|
function Alert({ className, variant = "primary", style: alertStyle, dismissable = false, onDismiss, showIcon = true, children, isLoading = false, skeletonConfig, skeleton, ...props }) {
|
|
23
|
-
const [isVisible,
|
|
25
|
+
const [isVisible, { close }] = useDisclosure(true);
|
|
24
26
|
if (isLoading) {
|
|
25
27
|
if (skeleton) {
|
|
26
|
-
return (_jsx(
|
|
28
|
+
return (_jsx(Box, { "data-slot": "alert", className: cn(alertVariants({ variant, style: alertStyle }), className), ...props, children: skeleton }));
|
|
27
29
|
}
|
|
28
30
|
return (_jsx(AlertSkeleton, { variant: variant || "default", showIcon: showIcon, className: className, ...props }));
|
|
29
31
|
}
|
|
30
32
|
const handleDismiss = () => {
|
|
31
|
-
|
|
33
|
+
close();
|
|
32
34
|
onDismiss?.();
|
|
33
35
|
};
|
|
34
36
|
if (!isVisible)
|
|
@@ -53,12 +55,12 @@ function Alert({ className, variant = "primary", style: alertStyle, dismissable
|
|
|
53
55
|
name.includes("X") ||
|
|
54
56
|
props.className?.includes("lucide"));
|
|
55
57
|
});
|
|
56
|
-
return (_jsxs(
|
|
58
|
+
return (_jsxs(Box, { "data-slot": "alert", role: "alert", className: cn(alertVariants({ variant, style: alertStyle }), dismissable && "pr-10", className), ...props, children: [showIcon && !hasCustomIcon && (_jsx(Icon, { className: "size-4 translate-y-0.5", "aria-hidden": "true" })), children, dismissable && (_jsx(Box, { as: "button", type: "button", onClick: handleDismiss, className: "cursor-pointer absolute right-2 top-2 rounded-md p-1 hover:bg-accent transition-colors", "aria-label": "Dismiss alert", children: _jsx(X, { className: "h-4 w-4" }) }))] }));
|
|
57
59
|
}
|
|
58
60
|
function AlertTitle({ className, ...props }) {
|
|
59
|
-
return (_jsx(
|
|
61
|
+
return (_jsx(Box, { "data-slot": "alert-title", className: cn("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight", className), ...props }));
|
|
60
62
|
}
|
|
61
63
|
function AlertDescription({ className, ...props }) {
|
|
62
|
-
return (_jsx(
|
|
64
|
+
return (_jsx(Box, { "data-slot": "alert-description", className: cn("col-start-2 text-sm [&_p]:leading-relaxed", className), ...props }));
|
|
63
65
|
}
|
|
64
66
|
export { Alert, AlertTitle, AlertDescription, alertVariants };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { AlertCircle, AlertTriangle, CheckCircle2, Info as InfoIcon, } from "lucide-react";
|
|
3
|
-
import {
|
|
3
|
+
import { Box } from "../box";
|
|
4
|
+
import { Flex } from "../flex";
|
|
5
|
+
import { Stack } from "../stack";
|
|
6
|
+
import { Text } from "../text";
|
|
7
|
+
import { Skeleton } from "../skeleton";
|
|
4
8
|
import { Alert, AlertDescription, AlertTitle } from "./alert";
|
|
5
9
|
const meta = {
|
|
6
10
|
title: "Feedback/Alert",
|
|
@@ -13,19 +17,19 @@ const meta = {
|
|
|
13
17
|
export default meta;
|
|
14
18
|
// Default Style (light background)
|
|
15
19
|
export const DefaultStyle = {
|
|
16
|
-
render: () => (_jsxs(
|
|
20
|
+
render: () => (_jsxs(Flex, { direction: "column", gap: 4, className: "w-[600px]", children: [_jsx(Alert, { variant: "primary", children: _jsx(AlertDescription, { children: "A simple primary alert\u2014check it out!" }) }), _jsx(Alert, { variant: "secondary", children: _jsx(AlertDescription, { children: "A simple secondary alert\u2014check it out!" }) }), _jsx(Alert, { variant: "success", children: _jsx(AlertDescription, { children: "A simple success alert\u2014check it out!" }) }), _jsx(Alert, { variant: "danger", children: _jsx(AlertDescription, { children: "A simple danger alert\u2014check it out!" }) }), _jsx(Alert, { variant: "warning", children: _jsx(AlertDescription, { children: "A simple warning alert\u2014check it out!" }) }), _jsx(Alert, { variant: "info", children: _jsx(AlertDescription, { children: "A simple info alert\u2014check it out!" }) })] })),
|
|
17
21
|
};
|
|
18
22
|
// Outline Style
|
|
19
23
|
export const OutlineStyle = {
|
|
20
|
-
render: () => (_jsxs(
|
|
24
|
+
render: () => (_jsxs(Flex, { direction: "column", gap: 4, className: "w-[600px]", children: [_jsx(Alert, { variant: "primary", style: "outline", children: _jsx(AlertDescription, { children: "An outline primary alert\u2014check it out!" }) }), _jsx(Alert, { variant: "secondary", style: "outline", children: _jsx(AlertDescription, { children: "An outline secondary alert\u2014check it out!" }) }), _jsx(Alert, { variant: "success", style: "outline", children: _jsx(AlertDescription, { children: "An outline success alert\u2014check it out!" }) }), _jsx(Alert, { variant: "danger", style: "outline", children: _jsx(AlertDescription, { children: "An outline danger alert\u2014check it out!" }) }), _jsx(Alert, { variant: "warning", style: "outline", children: _jsx(AlertDescription, { children: "An outline warning alert\u2014check it out!" }) }), _jsx(Alert, { variant: "info", style: "outline", children: _jsx(AlertDescription, { children: "An outline info alert\u2014check it out!" }) })] })),
|
|
21
25
|
};
|
|
22
26
|
// Solid Style
|
|
23
27
|
export const SolidStyle = {
|
|
24
|
-
render: () => (_jsxs(
|
|
28
|
+
render: () => (_jsxs(Flex, { direction: "column", gap: 4, className: "w-[600px]", children: [_jsx(Alert, { variant: "primary", style: "solid", children: _jsx(AlertDescription, { children: "A solid primary alert\u2014check it out!" }) }), _jsx(Alert, { variant: "secondary", style: "solid", children: _jsx(AlertDescription, { children: "A solid secondary alert\u2014check it out!" }) }), _jsx(Alert, { variant: "success", style: "solid", children: _jsx(AlertDescription, { children: "A solid success alert\u2014check it out!" }) }), _jsx(Alert, { variant: "danger", style: "solid", children: _jsx(AlertDescription, { children: "A solid danger alert\u2014check it out!" }) }), _jsx(Alert, { variant: "warning", style: "solid", children: _jsx(AlertDescription, { children: "A solid warning alert\u2014check it out!" }) }), _jsx(Alert, { variant: "info", style: "solid", children: _jsx(AlertDescription, { children: "A solid info alert\u2014check it out!" }) })] })),
|
|
25
29
|
};
|
|
26
30
|
// With Icons
|
|
27
31
|
export const WithIcons = {
|
|
28
|
-
render: () => (_jsxs(
|
|
32
|
+
render: () => (_jsxs(Flex, { direction: "column", gap: 4, className: "w-[600px]", children: [_jsxs(Alert, { variant: "primary", children: [_jsx(InfoIcon, {}), _jsx(AlertDescription, { children: "A primary alert with icon\u2014check it out!" })] }), _jsxs(Alert, { variant: "success", children: [_jsx(CheckCircle2, {}), _jsx(AlertDescription, { children: "A success alert with icon\u2014check it out!" })] }), _jsxs(Alert, { variant: "warning", children: [_jsx(AlertTriangle, {}), _jsx(AlertDescription, { children: "A warning alert with icon\u2014check it out!" })] }), _jsxs(Alert, { variant: "danger", children: [_jsx(AlertCircle, {}), _jsx(AlertDescription, { children: "A danger alert with icon\u2014check it out!" })] })] })),
|
|
29
33
|
};
|
|
30
34
|
// With Title and Description
|
|
31
35
|
export const WithTitleAndDescription = {
|
|
@@ -33,18 +37,18 @@ export const WithTitleAndDescription = {
|
|
|
33
37
|
};
|
|
34
38
|
// With Link
|
|
35
39
|
export const WithLink = {
|
|
36
|
-
render: () => (_jsx(Alert, { variant: "primary", className: "w-[600px]", children: _jsxs(AlertDescription, { children: ["A simple primary alert with", " ", _jsx("a",
|
|
40
|
+
render: () => (_jsx(Alert, { variant: "primary", className: "w-[600px]", children: _jsxs(AlertDescription, { children: ["A simple primary alert with", " ", _jsx(Box, { as: "a", href: "/", className: "font-semibold underline hover:no-underline", children: "an example link" }), ". Give it a click if you like."] }) })),
|
|
37
41
|
};
|
|
38
42
|
// Dismissable Alerts
|
|
39
43
|
export const Dismissable = {
|
|
40
|
-
render: () => (_jsxs(
|
|
44
|
+
render: () => (_jsxs(Flex, { direction: "column", gap: 4, className: "w-[600px]", children: [_jsxs(Alert, { variant: "success", dismissable: true, children: [_jsx(CheckCircle2, {}), _jsx(AlertTitle, { children: "Success" }), _jsx(AlertDescription, { children: "Your changes have been saved successfully." })] }), _jsxs(Alert, { variant: "info", dismissable: true, children: [_jsx(InfoIcon, {}), _jsx(AlertTitle, { children: "Information" }), _jsx(AlertDescription, { children: "This alert can be dismissed by clicking the X button." })] }), _jsxs(Alert, { variant: "warning", dismissable: true, onDismiss: () => console.log("Warning dismissed"), children: [_jsx(AlertTriangle, {}), _jsx(AlertTitle, { children: "Warning" }), _jsx(AlertDescription, { children: "Please review your settings before continuing. This will trigger a callback when dismissed." })] }), _jsxs(Alert, { variant: "danger", dismissable: true, children: [_jsx(AlertCircle, {}), _jsx(AlertTitle, { children: "Error" }), _jsx(AlertDescription, { children: "There was a problem processing your request." })] })] })),
|
|
41
45
|
};
|
|
42
46
|
// Complex with Paragraphs
|
|
43
47
|
export const ComplexAlert = {
|
|
44
|
-
render: () => (_jsxs(Alert, { variant: "info", className: "w-[600px]", children: [_jsx(InfoIcon, {}), _jsx(AlertTitle, { children: "Information" }),
|
|
48
|
+
render: () => (_jsxs(Alert, { variant: "info", className: "w-[600px]", children: [_jsx(InfoIcon, {}), _jsx(AlertTitle, { children: "Information" }), _jsx(AlertDescription, { children: _jsxs(Stack, { gap: 2, children: [_jsx(Text, { children: "This is an informational message with multiple paragraphs. The first paragraph provides the main context." }), _jsx(Text, { children: "Whenever you need to, be sure to properly structure your content to keep things nice and tidy." })] }) })] })),
|
|
45
49
|
};
|
|
46
50
|
export const LoadingSkeleton = {
|
|
47
|
-
render: () => (_jsx(
|
|
51
|
+
render: () => (_jsx(Stack, { gap: 4, className: "w-full max-w-md", children: _jsxs(Flex, { gap: 3, className: "p-4 border rounded-lg", children: [_jsx(Skeleton, { className: "h-5 w-5 rounded-full flex-shrink-0" }), _jsxs(Stack, { gap: 2, className: "flex-1", children: [_jsx(Skeleton, { className: "h-5 w-32" }), _jsx(Skeleton, { className: "h-4 w-full" }), _jsx(Skeleton, { className: "h-4 w-3/4" })] })] }) })),
|
|
48
52
|
parameters: {
|
|
49
53
|
docs: {
|
|
50
54
|
description: {
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
4
4
|
import { cn } from "../../lib/utils";
|
|
5
|
+
import { Box } from "../box";
|
|
5
6
|
import { buttonVariants } from "../button";
|
|
7
|
+
import { Heading } from "../heading";
|
|
8
|
+
import { Text } from "../text";
|
|
6
9
|
function AlertDialog({ ...props }) {
|
|
7
10
|
return _jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
|
|
8
11
|
}
|
|
@@ -19,19 +22,19 @@ function AlertDialogContent({ className, ...props }) {
|
|
|
19
22
|
return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Content, { "data-slot": "alert-dialog-content", className: cn("bg-card data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-30 flex flex-col translate-x-[-50%] translate-y-[-50%] rounded-lg border duration-200 w-[90vw] max-w-lg theme-card", className), ...props })] }));
|
|
20
23
|
}
|
|
21
24
|
function AlertDialogHeader({ className, ...props }) {
|
|
22
|
-
return (_jsx(
|
|
25
|
+
return (_jsx(Box, { "data-slot": "alert-dialog-header", className: cn("flex flex-col gap-1.5 px-6 py-4 border-b", className), ...props }));
|
|
23
26
|
}
|
|
24
27
|
function AlertDialogFooter({ className, ...props }) {
|
|
25
|
-
return (_jsx(
|
|
28
|
+
return (_jsx(Box, { "data-slot": "alert-dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end px-6 py-4 border-t bg-muted/50 rounded-b-lg", className), ...props }));
|
|
26
29
|
}
|
|
27
30
|
function AlertDialogTitle({ className, ...props }) {
|
|
28
|
-
return (_jsx(AlertDialogPrimitive.Title, { "data-slot": "alert-dialog-title", className: cn("text-lg font-semibold leading-none tracking-tight text-foreground", className), ...props }));
|
|
31
|
+
return (_jsx(AlertDialogPrimitive.Title, { asChild: true, "data-slot": "alert-dialog-title", children: _jsx(Heading, { level: 3, className: cn("text-lg font-semibold leading-none tracking-tight text-foreground", className), ...props }) }));
|
|
29
32
|
}
|
|
30
33
|
function AlertDialogDescription({ className, ...props }) {
|
|
31
|
-
return (_jsx(AlertDialogPrimitive.Description, { "data-slot": "alert-dialog-description", className: cn("text-sm leading-relaxed text-muted-foreground", className), ...props }));
|
|
34
|
+
return (_jsx(AlertDialogPrimitive.Description, { asChild: true, "data-slot": "alert-dialog-description", children: _jsx(Text, { className: cn("text-sm leading-relaxed text-muted-foreground", className), ...props }) }));
|
|
32
35
|
}
|
|
33
36
|
function AlertDialogBody({ className, ...props }) {
|
|
34
|
-
return (_jsx(
|
|
37
|
+
return (_jsx(Box, { "data-slot": "alert-dialog-body", className: cn("flex-1 overflow-y-auto px-6 py-4 min-h-0", className), ...props }));
|
|
35
38
|
}
|
|
36
39
|
function AlertDialogAction({ className, variant, size, ...props }) {
|
|
37
40
|
return (_jsx(AlertDialogPrimitive.Action, { className: cn(buttonVariants({ variant, size }), className), ...props }));
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface AppShellProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Header configuration */
|
|
4
|
+
header?: {
|
|
5
|
+
height: number | string;
|
|
6
|
+
};
|
|
7
|
+
/** Navbar configuration */
|
|
8
|
+
navbar?: {
|
|
9
|
+
width: number | string;
|
|
10
|
+
breakpoint?: "sm" | "md" | "lg" | "xl";
|
|
11
|
+
collapsed?: {
|
|
12
|
+
mobile?: boolean;
|
|
13
|
+
desktop?: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
/** Aside configuration */
|
|
17
|
+
aside?: {
|
|
18
|
+
width: number | string;
|
|
19
|
+
breakpoint?: "sm" | "md" | "lg" | "xl";
|
|
20
|
+
collapsed?: {
|
|
21
|
+
mobile?: boolean;
|
|
22
|
+
desktop?: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/** Footer configuration */
|
|
26
|
+
footer?: {
|
|
27
|
+
height: number | string;
|
|
28
|
+
};
|
|
29
|
+
/** Padding for the main content */
|
|
30
|
+
padding?: "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
31
|
+
}
|
|
32
|
+
export declare const AppShell: React.ForwardRefExoticComponent<AppShellProps & React.RefAttributes<HTMLDivElement>> & {
|
|
33
|
+
Header: typeof AppShellHeader;
|
|
34
|
+
Navbar: typeof AppShellNavbar;
|
|
35
|
+
Main: typeof AppShellMain;
|
|
36
|
+
Aside: typeof AppShellAside;
|
|
37
|
+
Footer: typeof AppShellFooter;
|
|
38
|
+
};
|
|
39
|
+
export interface AppShellHeaderProps extends React.HTMLAttributes<HTMLElement> {
|
|
40
|
+
withBorder?: boolean;
|
|
41
|
+
}
|
|
42
|
+
declare const AppShellHeader: React.ForwardRefExoticComponent<AppShellHeaderProps & React.RefAttributes<HTMLElement>>;
|
|
43
|
+
export interface AppShellNavbarProps extends React.HTMLAttributes<HTMLElement> {
|
|
44
|
+
withBorder?: boolean;
|
|
45
|
+
}
|
|
46
|
+
declare const AppShellNavbar: React.ForwardRefExoticComponent<AppShellNavbarProps & React.RefAttributes<HTMLElement>>;
|
|
47
|
+
export interface AppShellAsideProps extends React.HTMLAttributes<HTMLElement> {
|
|
48
|
+
withBorder?: boolean;
|
|
49
|
+
}
|
|
50
|
+
declare const AppShellAside: React.ForwardRefExoticComponent<AppShellAsideProps & React.RefAttributes<HTMLElement>>;
|
|
51
|
+
export interface AppShellMainProps extends React.HTMLAttributes<HTMLElement> {
|
|
52
|
+
}
|
|
53
|
+
declare const AppShellMain: React.ForwardRefExoticComponent<AppShellMainProps & React.RefAttributes<HTMLElement>>;
|
|
54
|
+
export interface AppShellFooterProps extends React.HTMLAttributes<HTMLElement> {
|
|
55
|
+
withBorder?: boolean;
|
|
56
|
+
}
|
|
57
|
+
declare const AppShellFooter: React.ForwardRefExoticComponent<AppShellFooterProps & React.RefAttributes<HTMLElement>>;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
import { Box } from "../box";
|
|
5
|
+
const AppShellContext = React.createContext({});
|
|
6
|
+
export const AppShell = React.forwardRef(({ children, className, header, navbar, aside, footer, padding = "md", ...props }, ref) => {
|
|
7
|
+
// Convert padding to Tailwind class or CSS value
|
|
8
|
+
const _paddingClasses = {
|
|
9
|
+
none: "p-0",
|
|
10
|
+
xs: "p-2",
|
|
11
|
+
sm: "p-3",
|
|
12
|
+
md: "p-4",
|
|
13
|
+
lg: "p-6",
|
|
14
|
+
xl: "p-8",
|
|
15
|
+
};
|
|
16
|
+
const cssVars = {
|
|
17
|
+
"--app-shell-header-height": typeof header?.height === "number"
|
|
18
|
+
? `${header.height}px`
|
|
19
|
+
: (header?.height ?? "0px"),
|
|
20
|
+
"--app-shell-footer-height": typeof footer?.height === "number"
|
|
21
|
+
? `${footer.height}px`
|
|
22
|
+
: (footer?.height ?? "0px"),
|
|
23
|
+
"--app-shell-navbar-width": typeof navbar?.width === "number"
|
|
24
|
+
? `${navbar.width}px`
|
|
25
|
+
: (navbar?.width ?? "0px"),
|
|
26
|
+
"--app-shell-aside-width": typeof aside?.width === "number"
|
|
27
|
+
? `${aside.width}px`
|
|
28
|
+
: (aside?.width ?? "0px"),
|
|
29
|
+
};
|
|
30
|
+
return (_jsx(AppShellContext.Provider, { value: { header, navbar, aside, footer, padding }, children: _jsx(Box, { ref: ref, className: cn("flex min-h-screen flex-col bg-background text-foreground", className), style: cssVars, ...props, children: children }) }));
|
|
31
|
+
});
|
|
32
|
+
const AppShellHeader = React.forwardRef(({ className, withBorder = true, ...props }, ref) => {
|
|
33
|
+
const { header } = React.useContext(AppShellContext);
|
|
34
|
+
if (!header)
|
|
35
|
+
return null;
|
|
36
|
+
return (_jsx(Box, { as: "header", ref: ref, className: cn("fixed top-0 left-0 right-0 z-50 flex items-center bg-background px-4", withBorder && "border-b", className), style: { height: "var(--app-shell-header-height)" }, ...props }));
|
|
37
|
+
});
|
|
38
|
+
AppShellHeader.displayName = "AppShell.Header";
|
|
39
|
+
const AppShellNavbar = React.forwardRef(({ className, withBorder = true, ...props }, ref) => {
|
|
40
|
+
const { navbar } = React.useContext(AppShellContext);
|
|
41
|
+
if (!navbar)
|
|
42
|
+
return null;
|
|
43
|
+
const collapsedMobile = navbar.collapsed?.mobile;
|
|
44
|
+
const collapsedDesktop = navbar.collapsed?.desktop;
|
|
45
|
+
return (_jsx(Box, { as: "nav", ref: ref, className: cn("fixed left-0 z-40 flex flex-col bg-background transition-transform duration-300 ease-in-out", withBorder && "border-r",
|
|
46
|
+
// Mobile handling
|
|
47
|
+
collapsedMobile ? "-translate-x-full" : "translate-x-0",
|
|
48
|
+
// Desktop handling (simplified for now, ideally needs media query check or CSS media query)
|
|
49
|
+
// For now we assume desktop is usually visible unless collapsedDesktop is true
|
|
50
|
+
collapsedDesktop && "lg:-translate-x-full", className), style: {
|
|
51
|
+
width: "var(--app-shell-navbar-width)",
|
|
52
|
+
top: "var(--app-shell-header-height)",
|
|
53
|
+
height: "calc(100vh - var(--app-shell-header-height))",
|
|
54
|
+
}, ...props }));
|
|
55
|
+
});
|
|
56
|
+
AppShellNavbar.displayName = "AppShell.Navbar";
|
|
57
|
+
const AppShellAside = React.forwardRef(({ className, withBorder = true, ...props }, ref) => {
|
|
58
|
+
const { aside } = React.useContext(AppShellContext);
|
|
59
|
+
if (!aside)
|
|
60
|
+
return null;
|
|
61
|
+
const collapsedMobile = aside.collapsed?.mobile;
|
|
62
|
+
const collapsedDesktop = aside.collapsed?.desktop;
|
|
63
|
+
return (_jsx(Box, { as: "aside", ref: ref, className: cn("fixed right-0 z-40 flex flex-col bg-background transition-transform duration-300 ease-in-out", withBorder && "border-l", collapsedMobile ? "translate-x-full" : "translate-x-0", collapsedDesktop && "lg:translate-x-full", className), style: {
|
|
64
|
+
width: "var(--app-shell-aside-width)",
|
|
65
|
+
top: "var(--app-shell-header-height)",
|
|
66
|
+
height: "calc(100vh - var(--app-shell-header-height))",
|
|
67
|
+
}, ...props }));
|
|
68
|
+
});
|
|
69
|
+
AppShellAside.displayName = "AppShell.Aside";
|
|
70
|
+
const AppShellMain = React.forwardRef(({ className, ...props }, ref) => {
|
|
71
|
+
const { header, navbar, aside, footer, padding } = React.useContext(AppShellContext);
|
|
72
|
+
const paddingClasses = {
|
|
73
|
+
none: "p-0",
|
|
74
|
+
xs: "p-2",
|
|
75
|
+
sm: "p-3",
|
|
76
|
+
md: "p-4",
|
|
77
|
+
lg: "p-6",
|
|
78
|
+
xl: "p-8",
|
|
79
|
+
};
|
|
80
|
+
return (_jsx(Box, { as: "main", ref: ref, className: cn("flex-1 transition-all duration-300 ease-in-out", padding && paddingClasses[padding], className), style: {
|
|
81
|
+
paddingTop: header
|
|
82
|
+
? "calc(var(--app-shell-header-height) + var(--padding-top, 0px))"
|
|
83
|
+
: undefined,
|
|
84
|
+
paddingBottom: footer
|
|
85
|
+
? "calc(var(--app-shell-footer-height) + var(--padding-bottom, 0px))"
|
|
86
|
+
: undefined,
|
|
87
|
+
paddingLeft: navbar
|
|
88
|
+
? "calc(var(--app-shell-navbar-width) + var(--padding-left, 0px))"
|
|
89
|
+
: undefined,
|
|
90
|
+
paddingRight: aside
|
|
91
|
+
? "calc(var(--app-shell-aside-width) + var(--padding-right, 0px))"
|
|
92
|
+
: undefined,
|
|
93
|
+
// Note: Real responsive margin adjustment requires media queries matching the navbar breakpoint
|
|
94
|
+
// For this basic implementation, we assume the navbar takes space.
|
|
95
|
+
// Users can override margins with Tailwind classes if needed for responsive behavior.
|
|
96
|
+
}, ...props }));
|
|
97
|
+
});
|
|
98
|
+
AppShellMain.displayName = "AppShell.Main";
|
|
99
|
+
const AppShellFooter = React.forwardRef(({ className, withBorder = true, ...props }, ref) => {
|
|
100
|
+
const { footer } = React.useContext(AppShellContext);
|
|
101
|
+
if (!footer)
|
|
102
|
+
return null;
|
|
103
|
+
return (_jsx(Box, { as: "footer", ref: ref, className: cn("fixed bottom-0 left-0 right-0 z-50 flex items-center bg-background px-4", withBorder && "border-t", className), style: { height: "var(--app-shell-footer-height)" }, ...props }));
|
|
104
|
+
});
|
|
105
|
+
AppShellFooter.displayName = "AppShell.Footer";
|
|
106
|
+
// Attach subcomponents
|
|
107
|
+
AppShell.Header = AppShellHeader;
|
|
108
|
+
AppShell.Navbar = AppShellNavbar;
|
|
109
|
+
AppShell.Main = AppShellMain;
|
|
110
|
+
AppShell.Aside = AppShellAside;
|
|
111
|
+
AppShell.Footer = AppShellFooter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { AppShell } from "./app-shell";
|
|
3
|
+
declare const meta: Meta<typeof AppShell>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AppShell>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const WithToggle: Story;
|
|
8
|
+
export declare const FullLayout: Story;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useDisclosure } from "@kala-ui/react-hooks";
|
|
3
|
+
import { Box } from "../box";
|
|
4
|
+
import { Burger } from "../burger";
|
|
5
|
+
import { Button } from "../button";
|
|
6
|
+
import { Flex } from "../flex";
|
|
7
|
+
import { Heading } from "../heading";
|
|
8
|
+
import { Stack } from "../stack";
|
|
9
|
+
import { Text } from "../text";
|
|
10
|
+
import { AppShell } from "./app-shell";
|
|
11
|
+
const meta = {
|
|
12
|
+
title: "Components/AppShell",
|
|
13
|
+
component: AppShell,
|
|
14
|
+
tags: ["autodocs"],
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: "fullscreen",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
export const Basic = {
|
|
21
|
+
render: () => (_jsxs(AppShell, { header: { height: 60 }, navbar: { width: 300, breakpoint: "sm" }, padding: "md", children: [_jsx(AppShell.Header, { children: _jsx(Box, { className: "p-4", children: _jsx(Heading, { size: "h4", children: "My App" }) }) }), _jsx(AppShell.Navbar, { children: _jsx(Box, { className: "p-4", children: _jsx(Text, { children: "Navbar content" }) }) }), _jsx(AppShell.Main, { children: _jsx(Box, { className: "h-[200vh] bg-muted/20 p-4 border border-dashed", children: _jsx(Text, { children: "Main content (scrollable)" }) }) })] })),
|
|
22
|
+
};
|
|
23
|
+
export const WithToggle = {
|
|
24
|
+
render: () => {
|
|
25
|
+
const [opened, { toggle }] = useDisclosure(false);
|
|
26
|
+
return (_jsxs(AppShell, { header: { height: 60 }, navbar: {
|
|
27
|
+
width: 300,
|
|
28
|
+
breakpoint: "sm",
|
|
29
|
+
collapsed: { mobile: !opened },
|
|
30
|
+
}, padding: "md", children: [_jsx(AppShell.Header, { children: _jsxs(Flex, { align: "center", gap: 4, className: "h-full px-4", children: [_jsx(Burger, { opened: opened, onClick: toggle, className: "lg:hidden" }), _jsx(Heading, { size: "h4", children: "My App" })] }) }), _jsx(AppShell.Navbar, { children: _jsxs(Stack, { gap: 2, className: "p-4", children: [_jsx(Button, { variant: "ghost", className: "justify-start", children: "Home" }), _jsx(Button, { variant: "ghost", className: "justify-start", children: "Profile" }), _jsx(Button, { variant: "ghost", className: "justify-start", children: "Settings" })] }) }), _jsx(AppShell.Main, { children: _jsxs(Box, { className: "p-4", children: [_jsx(Heading, { size: "h2", className: "mb-4", children: "Dashboard" }), _jsx(Text, { children: "Resize window to see mobile collapse behavior." })] }) })] }));
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const FullLayout = {
|
|
34
|
+
render: () => (_jsxs(AppShell, { header: { height: 60 }, footer: { height: 60 }, navbar: { width: 250, breakpoint: "sm" }, aside: { width: 250, breakpoint: "md" }, padding: "md", children: [_jsx(AppShell.Header, { children: _jsx(Box, { className: "font-bold px-4 py-2", children: "Header" }) }), _jsx(AppShell.Navbar, { children: _jsx(Box, { className: "p-4", children: "Navbar" }) }), _jsx(AppShell.Main, { children: _jsx(Box, { className: "p-4 border border-dashed h-full", children: "Main Content" }) }), _jsx(AppShell.Aside, { children: _jsx(Box, { className: "p-4", children: "Aside" }) }), _jsx(AppShell.Footer, { children: _jsx(Box, { className: "font-bold px-4 py-2", children: "Footer" }) })] })),
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./app-shell";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./app-shell";
|
|
@@ -2,7 +2,7 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
declare const avatarVariants: (props?: ({
|
|
5
|
-
size?: "default" | "
|
|
5
|
+
size?: "default" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | null | undefined;
|
|
6
6
|
shape?: "circle" | "square" | "rounded" | null | undefined;
|
|
7
7
|
status?: "none" | "online" | "offline" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -19,7 +19,7 @@ interface AvatarImageProps extends React.ComponentProps<typeof AvatarPrimitive.I
|
|
|
19
19
|
declare function AvatarImage({ className, shape: shapeProp, ...props }: AvatarImageProps): import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
declare const avatarFallbackVariants: (props?: ({
|
|
21
21
|
shape?: "circle" | "square" | "rounded" | null | undefined;
|
|
22
|
-
variant?: "default" | "
|
|
22
|
+
variant?: "default" | "primary" | "secondary" | "success" | "danger" | "destructive" | "warning" | "info" | "muted" | null | undefined;
|
|
23
23
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
24
24
|
interface AvatarFallbackProps extends React.ComponentProps<typeof AvatarPrimitive.Fallback>, VariantProps<typeof avatarFallbackVariants> {
|
|
25
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Skeleton } from "../skeleton
|
|
2
|
+
import { Skeleton } from "../skeleton";
|
|
3
3
|
import { Avatar, AvatarFallback, AvatarImage } from "./avatar";
|
|
4
4
|
const meta = {
|
|
5
5
|
title: "Data Display/Avatar",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import type * as React from "react";
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "primary" | "success" | "warning" | "info" | "destructive" | "secondary" | "default" | "error" | "outline" | "danger" | "dark" | "light" | "muted" | null | undefined;
|
|
5
5
|
shape?: "default" | "pill" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Badge({ className, variant, shape, asChild, isLoading, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
|