@kala-ui/react-app 0.1.0-beta.0 → 0.1.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -0
- package/README.md +9 -4
- package/dist/components/app-shell/app-shell.d.ts +8 -46
- package/dist/components/app-shell/app-shell.js +41 -42
- package/dist/components/app-shell/app-shell.types.d.ts +45 -0
- package/dist/components/app-shell/app-shell.types.js +2 -0
- package/dist/components/app-shell/index.d.ts +1 -0
- package/dist/components/charts/area-chart.d.ts +1 -1
- package/dist/components/charts/area-chart.js +4 -3
- package/dist/components/charts/bar-chart.d.ts +1 -1
- package/dist/components/charts/bar-chart.js +4 -3
- package/dist/components/charts/chart-skeleton.d.ts +0 -21
- package/dist/components/charts/chart-skeleton.js +2 -1
- package/dist/components/charts/chart-utils.d.ts +56 -0
- package/dist/components/charts/chart-utils.js +135 -0
- package/dist/components/charts/chart.d.ts +3 -1
- package/dist/components/charts/chart.js +14 -4
- package/dist/components/charts/chart.types.d.ts +3 -0
- package/dist/components/charts/donut-chart.d.ts +1 -1
- package/dist/components/charts/donut-chart.js +5 -4
- package/dist/components/charts/index.d.ts +1 -1
- package/dist/components/charts/index.js +1 -1
- package/dist/components/charts/line-chart.d.ts +1 -1
- package/dist/components/charts/line-chart.js +4 -3
- package/dist/components/charts/radial-bar-chart.d.ts +1 -1
- package/dist/components/charts/radial-bar-chart.js +4 -3
- package/dist/components/data-table/column-filters.js +1 -1
- package/dist/components/data-table/column-header-filter.js +1 -1
- package/dist/components/data-table/data-table-body-rows.js +1 -1
- package/dist/components/data-table/data-table-filter-chips.js +1 -1
- package/dist/components/data-table/data-table-header-row.js +1 -1
- package/dist/components/data-table/data-table-skeleton.js +1 -1
- package/dist/components/data-table/data-table-toolbar.js +1 -1
- package/dist/components/data-table/data-table.js +6 -4
- package/dist/components/data-table/data-table.types.d.ts +2 -0
- package/dist/components/data-table/index.d.ts +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/data-table/pagination-nav.js +1 -1
- package/dist/components/data-table/use-table-state.d.ts +29 -0
- package/dist/components/data-table/use-table-state.js +312 -0
- package/dist/components/dnd/dnd.d.ts +16 -98
- package/dist/components/dnd/dnd.js +36 -8
- package/dist/components/dnd/dnd.types.d.ts +92 -0
- package/dist/components/dnd/dnd.types.js +7 -0
- package/dist/components/dnd/index.d.ts +2 -1
- package/dist/components/dnd/index.js +1 -1
- package/dist/components/footer/footer.d.ts +2 -37
- package/dist/components/footer/footer.js +18 -2
- package/dist/components/footer/footer.types.d.ts +25 -0
- package/dist/components/footer/footer.types.js +2 -0
- package/dist/components/footer/index.d.ts +1 -1
- package/dist/components/header/header-skeleton.js +1 -1
- package/dist/components/header/header.js +6 -12
- package/dist/components/metric-card/index.d.ts +2 -1
- package/dist/components/metric-card/metric-card-skeleton.js +2 -1
- package/dist/components/metric-card/metric-card.d.ts +2 -14
- package/dist/components/metric-card/metric-card.js +33 -29
- package/dist/components/metric-card/metric-card.types.d.ts +3 -0
- package/dist/components/nav-link/index.d.ts +2 -1
- package/dist/components/nav-link/index.js +1 -1
- package/dist/components/nav-link/nav-link.d.ts +2 -25
- package/dist/components/nav-link/nav-link.js +43 -5
- package/dist/components/nav-link/nav-link.types.d.ts +23 -0
- package/dist/components/nav-link/nav-link.types.js +2 -0
- package/dist/components/navigation/index.d.ts +1 -1
- package/dist/components/navigation/navigation-skeleton.js +1 -1
- package/dist/components/navigation/navigation.d.ts +1 -24
- package/dist/components/navigation/navigation.js +9 -19
- package/dist/components/navigation/navigation.types.d.ts +15 -0
- package/dist/components/navigation/navigation.types.js +2 -0
- package/dist/components/session-card/index.d.ts +2 -1
- package/dist/components/session-card/index.js +1 -1
- package/dist/components/session-card/session-card-skeleton.d.ts +3 -1
- package/dist/components/session-card/session-card-skeleton.js +3 -2
- package/dist/components/session-card/session-card.d.ts +3 -26
- package/dist/components/session-card/session-card.js +23 -8
- package/dist/components/session-card/session-card.types.d.ts +26 -0
- package/dist/components/session-card/session-card.types.js +2 -0
- package/dist/components/sidebar/sidebar-skeleton.js +1 -1
- package/dist/components/sidebar/sidebar.js +6 -12
- package/dist/components/social-login-button/index.d.ts +3 -1
- package/dist/components/social-login-button/index.js +2 -1
- package/dist/components/social-login-button/social-login-button.d.ts +2 -20
- package/dist/components/social-login-button/social-login-button.js +9 -11
- package/dist/components/social-login-button/social-login-button.types.d.ts +28 -0
- package/dist/components/social-login-button/social-login-button.types.js +2 -0
- package/dist/components/social-login-button/social-login-buttons.d.ts +4 -0
- package/dist/components/social-login-button/social-login-buttons.js +18 -0
- package/dist/components/social-login-buttons/social-login-buttons.js +1 -1
- package/dist/components/sparkline-chart/sparkline-chart.js +1 -1
- package/dist/components/user-menu-dropdown/index.d.ts +2 -1
- package/dist/components/user-menu-dropdown/index.js +1 -1
- package/dist/components/user-menu-dropdown/user-menu-dropdown.d.ts +2 -31
- package/dist/components/user-menu-dropdown/user-menu-dropdown.js +14 -2
- package/dist/components/user-menu-dropdown/user-menu-dropdown.types.d.ts +16 -0
- package/dist/components/user-menu-dropdown/user-menu-dropdown.types.js +2 -0
- package/dist/config/app-shell.d.ts +13 -0
- package/dist/config/app-shell.js +20 -0
- package/dist/config/charts.d.ts +23 -0
- package/dist/config/charts.js +23 -0
- package/dist/config/footer.d.ts +16 -0
- package/dist/config/footer.js +16 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.js +7 -0
- package/dist/config/metric-card.d.ts +36 -0
- package/dist/config/metric-card.js +44 -0
- package/dist/config/session-card.d.ts +32 -0
- package/dist/config/session-card.js +32 -0
- package/dist/config/social-login-button.d.ts +15 -0
- package/dist/config/social-login-button.js +15 -0
- package/dist/config/user-menu-dropdown.d.ts +10 -0
- package/dist/config/user-menu-dropdown.js +10 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/styles/app.css +18 -53
- package/package.json +24 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,88 @@
|
|
|
1
1
|
# @kala-ui/react-app
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixes
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @kala-ui/react@0.1.0-beta.9
|
|
10
|
+
|
|
11
|
+
## 0.1.0-beta.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @kala-ui/react@0.1.0-beta.8
|
|
17
|
+
|
|
18
|
+
## 0.1.0-beta.8
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @kala-ui/react@0.1.0-beta.7
|
|
24
|
+
|
|
25
|
+
## 0.1.0-beta.7
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [8382731]
|
|
30
|
+
- @kala-ui/react@0.1.0-beta.6
|
|
31
|
+
|
|
32
|
+
## 0.1.0-beta.6
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- new changes
|
|
37
|
+
- Updated dependencies
|
|
38
|
+
- @kala-ui/react@0.1.0-beta.5
|
|
39
|
+
- @kala-ui/react-hooks@0.1.0-beta.1
|
|
40
|
+
|
|
41
|
+
## 0.1.0-beta.5
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Updated dependencies [5ecd609]
|
|
46
|
+
- Updated dependencies [ed367cc]
|
|
47
|
+
- @kala-ui/react@0.1.0-beta.4
|
|
48
|
+
|
|
49
|
+
## 0.1.0-beta.4
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Updated dependencies
|
|
54
|
+
- @kala-ui/react@0.1.0-beta.3
|
|
55
|
+
|
|
56
|
+
## 0.1.0-beta.3
|
|
57
|
+
|
|
58
|
+
### Minor Changes
|
|
59
|
+
|
|
60
|
+
- NavLink: optional anchor mode. Passing `href` renders a real `<a>` (default button behavior unchanged otherwise) so top-level navigation targets keep native middle-click/clone-tab semantics. In anchor mode: `active` sets `aria-current="page"`; button-only props (`type`, `disabled`) are never spread onto the anchor (`disabled` degrades to `aria-disabled` + pointer-events styling); a plain left-click is preventDefaulted for client-side routing while modifier/middle clicks stay native. Nested-collapse (chevron toggle) remains button-mode-only.
|
|
61
|
+
|
|
62
|
+
## 0.1.0-beta.2
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies
|
|
67
|
+
- @kala-ui/react@0.1.0-beta.2
|
|
68
|
+
|
|
69
|
+
## 0.1.0-beta.1
|
|
70
|
+
|
|
71
|
+
### Minor Changes
|
|
72
|
+
|
|
73
|
+
- b5cd997: Add stable `data-kala-component` identification attributes to every component root.
|
|
74
|
+
|
|
75
|
+
Every component (and each compound part, e.g. `dialog-content`, `card-header`, `data-table-toolbar`) now renders `data-kala-component="<kebab-name>"` on its root element. This is a guaranteed-stable public API for DevTools debugging, e2e selectors, and targeted consumer CSS overrides.
|
|
76
|
+
|
|
77
|
+
- No styling or behavior changes — the attribute is identification only.
|
|
78
|
+
- The ad-hoc `data-comp` markers previously used by a few components were migrated to `data-kala-component` (update any selectors that queried `[data-comp='...']`).
|
|
79
|
+
- shadcn-compatible `data-slot` attributes are unchanged.
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Updated dependencies [b5cd997]
|
|
84
|
+
- @kala-ui/react@0.1.0-beta.1
|
|
85
|
+
|
|
3
86
|
## 0.1.0-beta.0
|
|
4
87
|
|
|
5
88
|
### Added
|
package/README.md
CHANGED
|
@@ -4,18 +4,18 @@ App-level composite components for [Kala UI](https://github.com/krr2020/kala-ui)
|
|
|
4
4
|
|
|
5
5
|
## What's inside
|
|
6
6
|
|
|
7
|
-
- **Application chrome** — `AppShell`, `Header`, `Sidebar`, `Footer`, `Navigation`, `NavLink`
|
|
7
|
+
- **Application chrome** — `AppShell`, `Header`, `Sidebar`, `Footer`, `Navigation`, `NavLink` (plus the `isActivePath` routing helper from `@kala-ui/react-app/lib/active-path`)
|
|
8
8
|
- **Data-heavy composites** — `DataTable` (sorting / filtering / pagination / selection / server-side), `Dnd` (dnd-kit sortable lists and boards)
|
|
9
|
-
- **Charts** — `AreaChart`, `BarChart`, `LineChart`, `DonutChart`, `RadialBarChart`, `SparklineChart` (ApexCharts wrappers, theme-aware)
|
|
9
|
+
- **Charts** — `AreaChart`, `BarChart`, `LineChart`, `DonutChart`, `RadialBarChart`, `SparklineChart` (ApexCharts wrappers, theme-aware, lazy-loaded)
|
|
10
10
|
- **Dashboard & domain widgets** — `MetricCard`, `SessionCard`, `UserMenuDropdown`, `SocialLoginButton(s)`
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
pnpm add @kala-ui/react-app @kala-ui/react
|
|
15
|
+
pnpm add @kala-ui/react-app@beta @kala-ui/react@beta
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Import the core stylesheet first, then this package's utilities:
|
|
18
|
+
Requires React 19.2+. Import the core stylesheet first, then this package's utilities (theme, tokens, preflight and `kala-*` helpers ship once via the core):
|
|
19
19
|
|
|
20
20
|
```css
|
|
21
21
|
@import "@kala-ui/react/styles";
|
|
@@ -29,6 +29,11 @@ import { Button, ThemeProvider } from "@kala-ui/react";
|
|
|
29
29
|
import { AppShell, DataTable } from "@kala-ui/react-app";
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
Every component has a subpath export (`@kala-ui/react-app/<component>`) plus
|
|
33
|
+
the barrel. All component modules ship a `"use client"` banner, so they import
|
|
34
|
+
cleanly into React Server Component apps — charts lazy-load ApexCharts on the
|
|
35
|
+
client only.
|
|
36
|
+
|
|
32
37
|
See the repository README and [THEMING.md](https://github.com/krr2020/kala-ui/blob/main/THEMING.md) for theming, dark mode and framework integration.
|
|
33
38
|
|
|
34
39
|
## License
|
|
@@ -1,30 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* and reserves Main's left padding from it upward.
|
|
10
|
-
*/
|
|
11
|
-
navbar?: {
|
|
12
|
-
width: number | string;
|
|
13
|
-
breakpoint?: "sm" | "md" | "lg" | "xl";
|
|
14
|
-
};
|
|
15
|
-
/** Aside configuration. Mirrors the navbar on the right edge. */
|
|
16
|
-
aside?: {
|
|
17
|
-
width: number | string;
|
|
18
|
-
breakpoint?: "sm" | "md" | "lg" | "xl";
|
|
19
|
-
};
|
|
20
|
-
/** Footer configuration */
|
|
21
|
-
footer?: {
|
|
22
|
-
height: number | string;
|
|
23
|
-
};
|
|
24
|
-
/** Padding for the main content */
|
|
25
|
-
padding?: "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
26
|
-
}
|
|
27
|
-
declare function AppShellBase({ children, className, header, navbar, aside, footer, padding, ref, ...props }: AppShellProps): React.JSX.Element;
|
|
2
|
+
import type { AppShellAsideProps, AppShellFooterProps, AppShellHeaderProps, AppShellMainProps, AppShellNavbarProps, AppShellProps } from "./app-shell.types";
|
|
3
|
+
declare function AppShellBase({ children, className, style, slotStyles: slotStylesRaw, header, navbar, aside, footer, padding, ref, ...props }: AppShellProps): React.JSX.Element;
|
|
4
|
+
declare function AppShellHeader({ ref, className, withBorder, slotStyles: slotStylesRaw, ...props }: AppShellHeaderProps): React.JSX.Element | null;
|
|
5
|
+
declare function AppShellNavbar({ ref, className, withBorder, slotStyles: slotStylesRaw, ...props }: AppShellNavbarProps): React.JSX.Element | null;
|
|
6
|
+
declare function AppShellAside({ ref, className, withBorder, slotStyles: slotStylesRaw, ...props }: AppShellAsideProps): React.JSX.Element | null;
|
|
7
|
+
declare function AppShellMain({ ref, className, slotStyles: slotStylesRaw, ...props }: AppShellMainProps): React.JSX.Element;
|
|
8
|
+
declare function AppShellFooter({ ref, className, withBorder, slotStyles: slotStylesRaw, ...props }: AppShellFooterProps): React.JSX.Element | null;
|
|
28
9
|
export declare const AppShell: typeof AppShellBase & {
|
|
29
10
|
Header: typeof AppShellHeader;
|
|
30
11
|
Navbar: typeof AppShellNavbar;
|
|
@@ -32,23 +13,4 @@ export declare const AppShell: typeof AppShellBase & {
|
|
|
32
13
|
Aside: typeof AppShellAside;
|
|
33
14
|
Footer: typeof AppShellFooter;
|
|
34
15
|
};
|
|
35
|
-
export
|
|
36
|
-
withBorder?: boolean;
|
|
37
|
-
}
|
|
38
|
-
declare function AppShellHeader({ ref, className, withBorder, ...props }: AppShellHeaderProps): React.JSX.Element | null;
|
|
39
|
-
export interface AppShellNavbarProps extends React.HTMLAttributes<HTMLElement>, React.RefAttributes<HTMLElement> {
|
|
40
|
-
withBorder?: boolean;
|
|
41
|
-
}
|
|
42
|
-
declare function AppShellNavbar({ ref, className, withBorder, ...props }: AppShellNavbarProps): React.JSX.Element | null;
|
|
43
|
-
export interface AppShellAsideProps extends React.HTMLAttributes<HTMLElement>, React.RefAttributes<HTMLElement> {
|
|
44
|
-
withBorder?: boolean;
|
|
45
|
-
}
|
|
46
|
-
declare function AppShellAside({ ref, className, withBorder, ...props }: AppShellAsideProps): React.JSX.Element | null;
|
|
47
|
-
export interface AppShellMainProps extends React.HTMLAttributes<HTMLElement>, React.RefAttributes<HTMLElement> {
|
|
48
|
-
}
|
|
49
|
-
declare function AppShellMain({ ref, className, ...props }: AppShellMainProps): React.JSX.Element;
|
|
50
|
-
export interface AppShellFooterProps extends React.HTMLAttributes<HTMLElement>, React.RefAttributes<HTMLElement> {
|
|
51
|
-
withBorder?: boolean;
|
|
52
|
-
}
|
|
53
|
-
declare function AppShellFooter({ ref, className, withBorder, ...props }: AppShellFooterProps): React.JSX.Element | null;
|
|
54
|
-
export {};
|
|
16
|
+
export type { AppShellAsideProps, AppShellFooterProps, AppShellHeaderProps, AppShellMainProps, AppShellNavbarProps, AppShellProps, } from "./app-shell.types";
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Box } from "@kala-ui/react/box";
|
|
4
|
+
import { useSlotStyles } from "@kala-ui/react/kala-provider";
|
|
5
|
+
import { applySlot } from "@kala-ui/react/lib/slot-styles";
|
|
4
6
|
import { cn } from "@kala-ui/react/lib/utils";
|
|
5
7
|
import * as React from "react";
|
|
8
|
+
import { appShellStyles } from "../../config/app-shell.js";
|
|
6
9
|
const AppShellContext = React.createContext({});
|
|
7
|
-
function AppShellBase({ children, className, header, navbar, aside, footer, padding = "md", ref, ...props }) {
|
|
8
|
-
|
|
9
|
-
const _paddingClasses = {
|
|
10
|
-
none: "p-0",
|
|
11
|
-
xs: "p-2",
|
|
12
|
-
sm: "p-3",
|
|
13
|
-
md: "p-4",
|
|
14
|
-
lg: "p-6",
|
|
15
|
-
xl: "p-8",
|
|
16
|
-
};
|
|
10
|
+
function AppShellBase({ children, className, style, slotStyles: slotStylesRaw, header, navbar, aside, footer, padding = "md", ref, ...props }) {
|
|
11
|
+
const slotStyles = useSlotStyles("app-shell", slotStylesRaw);
|
|
17
12
|
const cssVars = {
|
|
18
13
|
"--app-shell-header-height": typeof header?.height === "number"
|
|
19
14
|
? `${header.height}px`
|
|
@@ -28,64 +23,68 @@ function AppShellBase({ children, className, header, navbar, aside, footer, padd
|
|
|
28
23
|
? `${aside.width}px`
|
|
29
24
|
: (aside?.width ?? "0px"),
|
|
30
25
|
};
|
|
31
|
-
|
|
26
|
+
const root = applySlot(cn(appShellStyles.base, className), slotStyles?.root);
|
|
27
|
+
return (_jsx(AppShellContext.Provider, { "data-kala-component": "app-shell-base", value: { header, navbar, aside, footer, padding }, children: _jsx(Box, { "data-kala-component": "app-shell", ref: ref, className: root.className, style: { ...cssVars, ...root.style }, ...props, children: children }) }));
|
|
32
28
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Navbar: AppShellNavbar,
|
|
36
|
-
Main: AppShellMain,
|
|
37
|
-
Aside: AppShellAside,
|
|
38
|
-
Footer: AppShellFooter,
|
|
39
|
-
});
|
|
40
|
-
function AppShellHeader({ ref, className, withBorder = true, ...props }) {
|
|
29
|
+
// --- Subcomponents ---
|
|
30
|
+
function AppShellHeader({ ref, className, withBorder = true, slotStyles: slotStylesRaw, ...props }) {
|
|
41
31
|
const { header } = React.useContext(AppShellContext);
|
|
32
|
+
const slotStyles = useSlotStyles("app-shell", slotStylesRaw);
|
|
42
33
|
if (!header)
|
|
43
34
|
return null;
|
|
44
|
-
|
|
35
|
+
const part = applySlot(cn(appShellStyles.header, withBorder && appShellStyles.headerBorder, className), slotStyles?.header);
|
|
36
|
+
return (_jsx(Box, { "data-kala-component": "app-shell-header", as: "header", ref: ref, className: part.className, style: { height: "var(--app-shell-header-height)", ...part.style }, ...props }));
|
|
45
37
|
}
|
|
46
|
-
function AppShellNavbar({ ref, className, withBorder = true, ...props }) {
|
|
38
|
+
function AppShellNavbar({ ref, className, withBorder = true, slotStyles: slotStylesRaw, ...props }) {
|
|
47
39
|
const { navbar } = React.useContext(AppShellContext);
|
|
40
|
+
const slotStyles = useSlotStyles("app-shell", slotStylesRaw);
|
|
48
41
|
if (!navbar)
|
|
49
42
|
return null;
|
|
50
|
-
// Off-canvas below the configured breakpoint, docked from it upward.
|
|
51
43
|
const variant = `${navbar.breakpoint ?? "md"}:`;
|
|
52
|
-
|
|
44
|
+
const part = applySlot(cn(appShellStyles.navbar, withBorder && appShellStyles.navbarBorder, "-translate-x-full", `${variant}translate-x-0`, className), slotStyles?.navbar);
|
|
45
|
+
return (_jsx(Box, { "data-kala-component": "app-shell-navbar", as: "nav", ref: ref, className: part.className, style: {
|
|
53
46
|
width: "var(--app-shell-navbar-width)",
|
|
54
47
|
top: "var(--app-shell-header-height)",
|
|
55
48
|
height: "calc(100vh - var(--app-shell-header-height))",
|
|
49
|
+
...part.style,
|
|
56
50
|
}, ...props }));
|
|
57
51
|
}
|
|
58
|
-
function AppShellAside({ ref, className, withBorder = true, ...props }) {
|
|
52
|
+
function AppShellAside({ ref, className, withBorder = true, slotStyles: slotStylesRaw, ...props }) {
|
|
59
53
|
const { aside } = React.useContext(AppShellContext);
|
|
54
|
+
const slotStyles = useSlotStyles("app-shell", slotStylesRaw);
|
|
60
55
|
if (!aside)
|
|
61
56
|
return null;
|
|
62
57
|
const variant = `${aside.breakpoint ?? "md"}:`;
|
|
63
|
-
|
|
58
|
+
const part = applySlot(cn(appShellStyles.aside, withBorder && appShellStyles.asideBorder, "translate-x-full", `${variant}translate-x-0`, className), slotStyles?.aside);
|
|
59
|
+
return (_jsx(Box, { "data-kala-component": "app-shell-aside", as: "aside", ref: ref, className: part.className, style: {
|
|
64
60
|
width: "var(--app-shell-aside-width)",
|
|
65
61
|
top: "var(--app-shell-header-height)",
|
|
66
62
|
height: "calc(100vh - var(--app-shell-header-height))",
|
|
63
|
+
...part.style,
|
|
67
64
|
}, ...props }));
|
|
68
65
|
}
|
|
69
|
-
function AppShellMain({ ref, className, ...props }) {
|
|
66
|
+
function AppShellMain({ ref, className, slotStyles: slotStylesRaw, ...props }) {
|
|
70
67
|
const { header, navbar, aside, footer, padding } = React.useContext(AppShellContext);
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
return (_jsx(Box, { as: "main", ref: ref, className: cn("flex-1 transition-all duration-300 ease-in-out", padding && paddingClasses[padding], header && "pt-[var(--app-shell-header-height)]", footer && "pb-[var(--app-shell-footer-height)]",
|
|
80
|
-
// Side offsets only reserve space while the fixed panels are
|
|
81
|
-
// actually docked (breakpoint and up).
|
|
82
|
-
navbar &&
|
|
83
|
-
`${navbar.breakpoint ?? "md"}:pl-[var(--app-shell-navbar-width)]`, aside &&
|
|
84
|
-
`${aside.breakpoint ?? "md"}:pr-[var(--app-shell-aside-width)]`, className), ...props }));
|
|
68
|
+
const slotStyles = useSlotStyles("app-shell", slotStylesRaw);
|
|
69
|
+
const part = applySlot(cn(appShellStyles.main, padding && appShellStyles.padding[padding], header && "pt-[var(--app-shell-header-height)]", footer && "pb-[var(--app-shell-footer-height)]",
|
|
70
|
+
// Side offsets only reserve space while the fixed panels are
|
|
71
|
+
// actually docked (breakpoint and up).
|
|
72
|
+
navbar &&
|
|
73
|
+
`${navbar.breakpoint ?? "md"}:pl-[var(--app-shell-navbar-width)]`, aside && `${aside.breakpoint ?? "md"}:pr-[var(--app-shell-aside-width)]`, className), slotStyles?.main);
|
|
74
|
+
return (_jsx(Box, { "data-kala-component": "app-shell-main", as: "main", ref: ref, className: part.className, style: part.style, ...props }));
|
|
85
75
|
}
|
|
86
|
-
function AppShellFooter({ ref, className, withBorder = true, ...props }) {
|
|
76
|
+
function AppShellFooter({ ref, className, withBorder = true, slotStyles: slotStylesRaw, ...props }) {
|
|
87
77
|
const { footer } = React.useContext(AppShellContext);
|
|
78
|
+
const slotStyles = useSlotStyles("app-shell", slotStylesRaw);
|
|
88
79
|
if (!footer)
|
|
89
80
|
return null;
|
|
90
|
-
|
|
81
|
+
const part = applySlot(cn(appShellStyles.footer, withBorder && appShellStyles.footerBorder, className), slotStyles?.footer);
|
|
82
|
+
return (_jsx(Box, { "data-kala-component": "app-shell-footer", as: "footer", ref: ref, className: part.className, style: { height: "var(--app-shell-footer-height)", ...part.style }, ...props }));
|
|
91
83
|
}
|
|
84
|
+
export const AppShell = Object.assign(AppShellBase, {
|
|
85
|
+
Header: AppShellHeader,
|
|
86
|
+
Navbar: AppShellNavbar,
|
|
87
|
+
Main: AppShellMain,
|
|
88
|
+
Aside: AppShellAside,
|
|
89
|
+
Footer: AppShellFooter,
|
|
90
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { SlotStyles } from "@kala-ui/react/lib/slot-styles";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
export interface AppShellProps extends React.ComponentProps<"div"> {
|
|
4
|
+
header?: {
|
|
5
|
+
height: number | string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Navbar configuration. The navbar sits off-canvas below `breakpoint`
|
|
9
|
+
* and reserves Main's left padding from it upward.
|
|
10
|
+
*/
|
|
11
|
+
navbar?: {
|
|
12
|
+
width: number | string;
|
|
13
|
+
breakpoint?: "sm" | "md" | "lg" | "xl";
|
|
14
|
+
};
|
|
15
|
+
/** Aside configuration. Mirrors the navbar on the right edge. */
|
|
16
|
+
aside?: {
|
|
17
|
+
width: number | string;
|
|
18
|
+
breakpoint?: "sm" | "md" | "lg" | "xl";
|
|
19
|
+
};
|
|
20
|
+
footer?: {
|
|
21
|
+
height: number | string;
|
|
22
|
+
};
|
|
23
|
+
padding?: "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
24
|
+
/** Per-part overrides: root, header, navbar, aside, main, footer. */
|
|
25
|
+
slotStyles?: SlotStyles;
|
|
26
|
+
}
|
|
27
|
+
export interface AppShellHeaderProps extends React.HTMLAttributes<HTMLElement>, React.RefAttributes<HTMLElement> {
|
|
28
|
+
withBorder?: boolean;
|
|
29
|
+
slotStyles?: SlotStyles;
|
|
30
|
+
}
|
|
31
|
+
export interface AppShellNavbarProps extends React.HTMLAttributes<HTMLElement>, React.RefAttributes<HTMLElement> {
|
|
32
|
+
withBorder?: boolean;
|
|
33
|
+
slotStyles?: SlotStyles;
|
|
34
|
+
}
|
|
35
|
+
export interface AppShellAsideProps extends React.HTMLAttributes<HTMLElement>, React.RefAttributes<HTMLElement> {
|
|
36
|
+
withBorder?: boolean;
|
|
37
|
+
slotStyles?: SlotStyles;
|
|
38
|
+
}
|
|
39
|
+
export interface AppShellMainProps extends React.HTMLAttributes<HTMLElement>, React.RefAttributes<HTMLElement> {
|
|
40
|
+
slotStyles?: SlotStyles;
|
|
41
|
+
}
|
|
42
|
+
export interface AppShellFooterProps extends React.HTMLAttributes<HTMLElement>, React.RefAttributes<HTMLElement> {
|
|
43
|
+
withBorder?: boolean;
|
|
44
|
+
slotStyles?: SlotStyles;
|
|
45
|
+
}
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Beautiful area charts with gradient fills, perfect for time series and trends
|
|
4
4
|
*/
|
|
5
5
|
import type { AreaChartProps } from "./chart.types";
|
|
6
|
-
export declare function AreaChart({ series, categories, colors, height, width, className, title, subtitle, toolbar, animations, curve, stacked, dataLabels, yAxisLabel, referenceLines, isLoading, emptyMessage, options: customOptions, }: AreaChartProps): import("react").JSX.Element;
|
|
6
|
+
export declare function AreaChart({ series, categories, colors, height, width, className, title, subtitle, toolbar, animations, curve, stacked, dataLabels, yAxisLabel, referenceLines, slotStyles, isLoading, emptyMessage, options: customOptions, }: AreaChartProps): import("react").JSX.Element;
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { cn } from "@kala-ui/react/lib/utils";
|
|
9
9
|
import { useMemo } from "react";
|
|
10
|
+
import { chartStyles } from "../../config/charts.js";
|
|
10
11
|
import { Chart, getTooltipTheme } from "./chart.js";
|
|
11
12
|
import { useThemeAwareChart } from "./use-theme-aware-chart.js";
|
|
12
|
-
import { getDefaultChartOptions } from "./utils.js";
|
|
13
|
+
import { getDefaultChartOptions } from "./chart-utils.js";
|
|
13
14
|
/**
|
|
14
15
|
* Check if series data is empty (no series or all series have empty data arrays)
|
|
15
16
|
*/
|
|
@@ -18,7 +19,7 @@ function isSeriesEmpty(series) {
|
|
|
18
19
|
return true;
|
|
19
20
|
return series.every((s) => !s.data || (Array.isArray(s.data) && s.data.length === 0));
|
|
20
21
|
}
|
|
21
|
-
export function AreaChart({ series, categories, colors, height = 350, width = "100%", className, title, subtitle, toolbar = false, animations = true, curve = "smooth", stacked = false, dataLabels = false, yAxisLabel, referenceLines = [], isLoading, emptyMessage, options: customOptions, }) {
|
|
22
|
+
export function AreaChart({ series, categories, colors, height = 350, width = "100%", className, title, subtitle, toolbar = false, animations = true, curve = "smooth", stacked = false, dataLabels = false, yAxisLabel, referenceLines = [], slotStyles, isLoading, emptyMessage, options: customOptions, }) {
|
|
22
23
|
const { colors: themeColors } = useThemeAwareChart();
|
|
23
24
|
const isEmpty = !isLoading && isSeriesEmpty(series);
|
|
24
25
|
const chartOptions = useMemo(() => {
|
|
@@ -168,5 +169,5 @@ export function AreaChart({ series, categories, colors, height = 350, width = "1
|
|
|
168
169
|
referenceLines,
|
|
169
170
|
customOptions,
|
|
170
171
|
]);
|
|
171
|
-
return (_jsx(Chart, {
|
|
172
|
+
return (_jsx(Chart, { "data-kala-component": "charts-area-chart", className: cn(chartStyles.root, className), slotStyles: slotStyles, options: chartOptions, series: series, type: "area", height: height, width: width, isLoading: isLoading, isEmpty: isEmpty, emptyMessage: emptyMessage }));
|
|
172
173
|
}
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Vertical and horizontal bar charts for comparing values across categories
|
|
4
4
|
*/
|
|
5
5
|
import type { BarChartProps } from "./chart.types";
|
|
6
|
-
export declare function BarChart({ series, categories, colors, height, width, className, title, subtitle, toolbar, animations, horizontal, stacked, dataLabels, barWidth, isLoading, emptyMessage, options: customOptions, }: BarChartProps): import("react").JSX.Element;
|
|
6
|
+
export declare function BarChart({ series, categories, colors, height, width, className, title, subtitle, toolbar, animations, horizontal, stacked, dataLabels, barWidth, slotStyles, isLoading, emptyMessage, options: customOptions, }: BarChartProps): import("react").JSX.Element;
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { cn } from "@kala-ui/react/lib/utils";
|
|
9
9
|
import { useMemo } from "react";
|
|
10
|
+
import { chartStyles } from "../../config/charts.js";
|
|
10
11
|
import { Chart, getTooltipTheme } from "./chart.js";
|
|
11
12
|
import { useThemeAwareChart } from "./use-theme-aware-chart.js";
|
|
12
|
-
import { getDefaultChartOptions } from "./utils.js";
|
|
13
|
+
import { getDefaultChartOptions } from "./chart-utils.js";
|
|
13
14
|
/**
|
|
14
15
|
* Check if series data is empty (no series or all series have empty data arrays)
|
|
15
16
|
*/
|
|
@@ -18,7 +19,7 @@ function isSeriesEmpty(series) {
|
|
|
18
19
|
return true;
|
|
19
20
|
return series.every((s) => !s.data || (Array.isArray(s.data) && s.data.length === 0));
|
|
20
21
|
}
|
|
21
|
-
export function BarChart({ series, categories, colors, height = 350, width = "100%", className, title, subtitle, toolbar = false, animations = true, horizontal = false, stacked = false, dataLabels = false, barWidth = 70, isLoading, emptyMessage, options: customOptions, }) {
|
|
22
|
+
export function BarChart({ series, categories, colors, height = 350, width = "100%", className, title, subtitle, toolbar = false, animations = true, horizontal = false, stacked = false, dataLabels = false, barWidth = 70, slotStyles, isLoading, emptyMessage, options: customOptions, }) {
|
|
22
23
|
const { colors: themeColors } = useThemeAwareChart();
|
|
23
24
|
const isEmpty = !isLoading && isSeriesEmpty(series);
|
|
24
25
|
const chartOptions = useMemo(() => {
|
|
@@ -149,5 +150,5 @@ export function BarChart({ series, categories, colors, height = 350, width = "10
|
|
|
149
150
|
subtitle,
|
|
150
151
|
customOptions,
|
|
151
152
|
]);
|
|
152
|
-
return (_jsx(Chart, {
|
|
153
|
+
return (_jsx(Chart, { "data-kala-component": "charts-bar-chart", className: cn(chartStyles.root, className), slotStyles: slotStyles, options: chartOptions, series: series, type: "bar", height: height, width: width, isLoading: isLoading, isEmpty: isEmpty, emptyMessage: emptyMessage }));
|
|
153
154
|
}
|
|
@@ -4,33 +4,12 @@
|
|
|
4
4
|
* including chart area, legend, and optional table below
|
|
5
5
|
*/
|
|
6
6
|
export interface ChartSkeletonProps {
|
|
7
|
-
/**
|
|
8
|
-
* Height of the chart area (default: 350)
|
|
9
|
-
*/
|
|
10
7
|
height?: number;
|
|
11
|
-
/**
|
|
12
|
-
* Show legend skeleton (default: true)
|
|
13
|
-
*/
|
|
14
8
|
showLegend?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Number of legend items to show (default: 4)
|
|
17
|
-
*/
|
|
18
9
|
legendCount?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Show table skeleton below chart
|
|
21
|
-
*/
|
|
22
10
|
showTable?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Number of table rows to show (default: 5)
|
|
25
|
-
*/
|
|
26
11
|
tableRows?: number;
|
|
27
|
-
/**
|
|
28
|
-
* Number of table columns to show (default: 3)
|
|
29
|
-
*/
|
|
30
12
|
tableColumns?: number;
|
|
31
|
-
/**
|
|
32
|
-
* Custom CSS class
|
|
33
|
-
*/
|
|
34
13
|
className?: string;
|
|
35
14
|
}
|
|
36
15
|
export declare function ChartSkeleton({ height, showLegend, legendCount, showTable, tableRows, tableColumns, className, }: ChartSkeletonProps): import("react").JSX.Element;
|
|
@@ -8,6 +8,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
import { cn } from "@kala-ui/react/lib/utils";
|
|
9
9
|
import { Skeleton } from "@kala-ui/react/skeleton";
|
|
10
10
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@kala-ui/react/table";
|
|
11
|
+
import { chartSkeletonStyles } from "../../config/charts.js";
|
|
11
12
|
export function ChartSkeleton({ height = 350, showLegend = true, legendCount = 4, showTable = false, tableRows = 5, tableColumns = 3, className, }) {
|
|
12
|
-
return (_jsxs("div", {
|
|
13
|
+
return (_jsxs("div", { "data-kala-component": "charts-chart-skeleton", className: cn(chartSkeletonStyles.root, className), children: [_jsx("div", { className: chartSkeletonStyles.frame, style: { height: `${height}px` }, children: _jsx("div", { className: chartSkeletonStyles.frameInner, children: _jsx(Skeleton, { className: chartSkeletonStyles.frameFill }) }) }), showLegend && (_jsx("div", { className: chartSkeletonStyles.legendRow, children: Array.from({ length: legendCount }).map((_, i) => (_jsxs("div", { className: chartSkeletonStyles.legendItem, children: [_jsx(Skeleton, { className: chartSkeletonStyles.legendDot }), _jsx(Skeleton, { className: chartSkeletonStyles.legendLabel })] }, `legend-${i}`))) })), showTable && (_jsx("div", { className: chartSkeletonStyles.tableWrap, children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsx(TableRow, { children: Array.from({ length: tableColumns }).map((_, index) => (_jsx(TableHead, { children: _jsx(Skeleton, { className: chartSkeletonStyles.tableHead }) }, `header-${index}`))) }) }), _jsx(TableBody, { children: Array.from({ length: tableRows }).map((_, rowIndex) => (_jsx(TableRow, { className: chartSkeletonStyles.tableRow, children: Array.from({ length: tableColumns }).map((_, colIndex) => (_jsx(TableCell, { children: _jsx(Skeleton, { className: chartSkeletonStyles.tableCell }) }, `cell-${rowIndex}-${colIndex}`))) }, `row-${rowIndex}`))) })] }) }))] }));
|
|
13
14
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart Utilities
|
|
3
|
+
* Helper functions and default configurations for charts
|
|
4
|
+
*/
|
|
5
|
+
import type { ApexOptions } from "apexcharts";
|
|
6
|
+
/**
|
|
7
|
+
* Get default chart options that match our design system
|
|
8
|
+
* @param theme - Optional theme override, otherwise detects from DOM
|
|
9
|
+
*/
|
|
10
|
+
export declare function getDefaultChartOptions(theme?: "light" | "dark" | "neutral" | "accent"): ApexOptions;
|
|
11
|
+
/**
|
|
12
|
+
* Default color palette matching design tokens
|
|
13
|
+
* @param theme - Optional theme override, otherwise detects from DOM
|
|
14
|
+
* @deprecated Use getChartColors() instead for theme-aware colors
|
|
15
|
+
*/
|
|
16
|
+
export declare function defaultColors(theme?: "light" | "dark" | "neutral" | "accent"): {
|
|
17
|
+
primary: import("./theme-utils").ColorPalette;
|
|
18
|
+
success: import("./theme-utils").ColorPalette;
|
|
19
|
+
warning: import("./theme-utils").ColorPalette;
|
|
20
|
+
destructive: import("./theme-utils").ColorPalette;
|
|
21
|
+
info: import("./theme-utils").ColorPalette;
|
|
22
|
+
mixed: import("./theme-utils").ColorPalette;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Format number with appropriate units
|
|
26
|
+
*/
|
|
27
|
+
export declare function formatNumber(value: number): string;
|
|
28
|
+
/**
|
|
29
|
+
* Format currency values
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatCurrency(value: number, currency?: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Format percentage values
|
|
34
|
+
*/
|
|
35
|
+
export declare function formatPercentage(value: number, decimals?: number): string;
|
|
36
|
+
/**
|
|
37
|
+
* Generate gradient colors for area charts
|
|
38
|
+
*/
|
|
39
|
+
export declare function createGradient(_color: string, opacity?: number): {
|
|
40
|
+
type: "gradient";
|
|
41
|
+
gradient: {
|
|
42
|
+
shadeIntensity: number;
|
|
43
|
+
opacityFrom: number;
|
|
44
|
+
opacityTo: number;
|
|
45
|
+
stops: number[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Get responsive breakpoints for charts
|
|
50
|
+
*/
|
|
51
|
+
export declare function getResponsiveOptions(): ApexResponsive[];
|
|
52
|
+
interface ApexResponsive {
|
|
53
|
+
breakpoint: number;
|
|
54
|
+
options: ApexOptions;
|
|
55
|
+
}
|
|
56
|
+
export {};
|