@tmllak-erp/ui 0.1.0 → 0.2.0
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/navigation/index.d.ts +2 -1
- package/dist/navigation/index.js +2 -1
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/portal/ApprovalRequests.d.ts +26 -0
- package/dist/navigation/portal/ApprovalRequests.js +22 -0
- package/dist/navigation/portal/ApprovalRequests.js.map +1 -0
- package/dist/navigation/portal/ModuleTile.d.ts +26 -2
- package/dist/navigation/portal/ModuleTile.js +17 -4
- package/dist/navigation/portal/ModuleTile.js.map +1 -1
- package/dist/navigation/portal/portal.css +75 -0
- package/package.json +4 -4
|
@@ -4,4 +4,5 @@ export { AppShell, useAppShell, type AppShellProps, type AppShellState } from '.
|
|
|
4
4
|
export { Sidebar, type SidebarLinkProps, type SidebarProps } from './sidebar/Sidebar.js';
|
|
5
5
|
export { GlobalSearch, TopBar, type GlobalSearchProps, type TopBarProps } from './top-bar/TopBar.js';
|
|
6
6
|
export { PageHeader, type PageHeaderProps } from './page-header/PageHeader.js';
|
|
7
|
-
export { ModuleTile, QuickActions, type ModuleTileProps, type QuickAction, type QuickActionsProps } from './portal/ModuleTile.js';
|
|
7
|
+
export { ModuleTile, ModuleTileGrid, PortalTile, QuickActions, type ModuleTileGridProps, type ModuleTileProps, type PortalTileProps, type QuickAction, type QuickActionsProps, } from './portal/ModuleTile.js';
|
|
8
|
+
export { ApprovalRequestList, ApprovalRequestRow, type ApprovalRequestListProps, type ApprovalRequestRowProps, } from './portal/ApprovalRequests.js';
|
package/dist/navigation/index.js
CHANGED
|
@@ -4,5 +4,6 @@ export { AppShell, useAppShell } from './app-shell/AppShell.js';
|
|
|
4
4
|
export { Sidebar } from './sidebar/Sidebar.js';
|
|
5
5
|
export { GlobalSearch, TopBar } from './top-bar/TopBar.js';
|
|
6
6
|
export { PageHeader } from './page-header/PageHeader.js';
|
|
7
|
-
export { ModuleTile, QuickActions } from './portal/ModuleTile.js';
|
|
7
|
+
export { ModuleTile, ModuleTileGrid, PortalTile, QuickActions, } from './portal/ModuleTile.js';
|
|
8
|
+
export { ApprovalRequestList, ApprovalRequestRow, } from './portal/ApprovalRequests.js';
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA6C,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAmE,MAAM,SAAS,CAAC;AAChI,OAAO,EAAE,QAAQ,EAAE,WAAW,EAA0C,MAAM,sBAAsB,CAAC;AACrG,OAAO,EAAE,OAAO,EAA4C,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,EAA4C,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAE,UAAU,EAAwB,MAAM,0BAA0B,CAAC;AAC5E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA6C,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAmE,MAAM,SAAS,CAAC;AAChI,OAAO,EAAE,QAAQ,EAAE,WAAW,EAA0C,MAAM,sBAAsB,CAAC;AACrG,OAAO,EAAE,OAAO,EAA4C,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,EAA4C,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAE,UAAU,EAAwB,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EACL,UAAU,EACV,cAAc,EACd,UAAU,EACV,YAAY,GAMb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GAGnB,MAAM,2BAA2B,CAAC","sourcesContent":["export { Breadcrumb, type BreadcrumbItem, type BreadcrumbProps } from './breadcrumb/Breadcrumb';\r\nexport { filterNavByRoles, localizeNavigation, type NavItem, type NavLeaf, type NavSection, type ProductModule } from './types';\r\nexport { AppShell, useAppShell, type AppShellProps, type AppShellState } from './app-shell/AppShell';\r\nexport { Sidebar, type SidebarLinkProps, type SidebarProps } from './sidebar/Sidebar';\r\nexport { GlobalSearch, TopBar, type GlobalSearchProps, type TopBarProps } from './top-bar/TopBar';\r\nexport { PageHeader, type PageHeaderProps } from './page-header/PageHeader';\r\nexport {\r\n ModuleTile,\r\n ModuleTileGrid,\r\n PortalTile,\r\n QuickActions,\r\n type ModuleTileGridProps,\r\n type ModuleTileProps,\r\n type PortalTileProps,\r\n type QuickAction,\r\n type QuickActionsProps,\r\n} from './portal/ModuleTile';\r\nexport {\r\n ApprovalRequestList,\r\n ApprovalRequestRow,\r\n type ApprovalRequestListProps,\r\n type ApprovalRequestRowProps,\r\n} from './portal/ApprovalRequests';\r\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import './portal.css';
|
|
3
|
+
export interface ApprovalRequestRowProps {
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
/** Requester, department, or supporting line under the title. */
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** Trailing secondary text, e.g. a date. */
|
|
8
|
+
meta?: ReactNode;
|
|
9
|
+
/** Usually a `StatusBadge` (e.g. «قيد المراجعة»). */
|
|
10
|
+
status?: ReactNode;
|
|
11
|
+
onReview?: () => void;
|
|
12
|
+
/** Overrides the default «مراجعة» label. */
|
|
13
|
+
reviewLabel?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/** One pending-approval row for home/portal panels (Figma «بانتظار موافقتك»). */
|
|
17
|
+
export declare function ApprovalRequestRow({ title, description, meta, status, onReview, reviewLabel, className, }: ApprovalRequestRowProps): import("react").JSX.Element;
|
|
18
|
+
export interface ApprovalRequestListProps {
|
|
19
|
+
/** Accessible name of the list (panel title stays on `Card`). */
|
|
20
|
+
label?: string;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
empty?: ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Presentational list of approval rows; data and panel chrome belong to the app. */
|
|
26
|
+
export declare function ApprovalRequestList({ label, children, empty, className, }: ApprovalRequestListProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { UI_COPY } from '@tmllak-erp/messages';
|
|
4
|
+
import { Eye } from 'lucide-react';
|
|
5
|
+
import { Children } from 'react';
|
|
6
|
+
import { cx } from '../../internal/cx.js';
|
|
7
|
+
import { Button } from '../../primitives/button/Button.js';
|
|
8
|
+
import { EmptyState } from '../../primitives/empty-state/EmptyState.js';
|
|
9
|
+
import './portal.css';
|
|
10
|
+
/** One pending-approval row for home/portal panels (Figma «بانتظار موافقتك»). */
|
|
11
|
+
export function ApprovalRequestRow({ title, description, meta, status, onReview, reviewLabel = UI_COPY.portal.review, className, }) {
|
|
12
|
+
return (_jsxs("li", { className: cx('erp-approval-row', className), children: [_jsxs("div", { className: "erp-approval-row__body", children: [_jsx("p", { className: "erp-approval-row__title", children: title }), (description || meta) && (_jsxs("p", { className: "erp-approval-row__meta", children: [description, description && meta ? _jsx("span", { "aria-hidden": "true", children: " \u00B7 " }) : null, meta ? _jsx("span", { className: "erp-approval-row__date", children: meta }) : null] }))] }), status ? _jsx("div", { className: "erp-approval-row__status", children: status }) : null, onReview ? (_jsx(Button, { type: "button", size: "sm", variant: "ghost", startIcon: Eye, className: "erp-approval-row__review", onClick: onReview, children: reviewLabel })) : null] }));
|
|
13
|
+
}
|
|
14
|
+
/** Presentational list of approval rows; data and panel chrome belong to the app. */
|
|
15
|
+
export function ApprovalRequestList({ label = UI_COPY.portal.approvals, children, empty, className, }) {
|
|
16
|
+
const rows = Children.toArray(children);
|
|
17
|
+
if (rows.length === 0) {
|
|
18
|
+
return _jsx(_Fragment, { children: empty ?? _jsx(EmptyState, { size: "compact", title: UI_COPY.portal.approvalsEmpty }) });
|
|
19
|
+
}
|
|
20
|
+
return (_jsx("ul", { "aria-label": label, className: cx('erp-approval-list', className), children: rows }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ApprovalRequests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApprovalRequests.js","sourceRoot":"","sources":["../../../src/navigation/portal/ApprovalRequests.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AACrE,OAAO,cAAc,CAAC;AAgBtB,iFAAiF;AACjF,MAAM,UAAU,kBAAkB,CAAC,EACjC,KAAK,EACL,WAAW,EACX,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EACnC,SAAS,GACe;IACxB,OAAO,CACL,cAAI,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,aAC9C,eAAK,SAAS,EAAC,wBAAwB,aACrC,YAAG,SAAS,EAAC,yBAAyB,YAAE,KAAK,GAAK,EACjD,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,CACxB,aAAG,SAAS,EAAC,wBAAwB,aAClC,WAAW,EACX,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,8BAAkB,MAAM,yBAAW,CAAC,CAAC,CAAC,IAAI,EAChE,IAAI,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,wBAAwB,YAAE,IAAI,GAAQ,CAAC,CAAC,CAAC,IAAI,IACnE,CACL,IACG,EACL,MAAM,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,0BAA0B,YAAE,MAAM,GAAO,CAAC,CAAC,CAAC,IAAI,EACxE,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,SAAS,EAAE,GAAG,EAAE,SAAS,EAAC,0BAA0B,EAAC,OAAO,EAAE,QAAQ,YACnH,WAAW,GACL,CACV,CAAC,CAAC,CAAC,IAAI,IACL,CACN,CAAC;AACJ,CAAC;AAUD,qFAAqF;AACrF,MAAM,UAAU,mBAAmB,CAAC,EAClC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAChC,QAAQ,EACR,KAAK,EACL,SAAS,GACgB;IACzB,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,4BAAG,KAAK,IAAI,KAAC,UAAU,IAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,GAAI,GAAI,CAAC;IAC7F,CAAC;IACD,OAAO,CACL,2BAAgB,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC,YACjE,IAAI,GACF,CACN,CAAC;AACJ,CAAC","sourcesContent":["'use client';\r\n\r\nimport { UI_COPY } from '@tmllak-erp/messages';\r\nimport { Eye } from 'lucide-react';\r\nimport { Children, type ReactNode } from 'react';\r\nimport { cx } from '../../internal/cx';\r\nimport { Button } from '../../primitives/button/Button';\r\nimport { EmptyState } from '../../primitives/empty-state/EmptyState';\r\nimport './portal.css';\r\n\r\nexport interface ApprovalRequestRowProps {\r\n title: ReactNode;\r\n /** Requester, department, or supporting line under the title. */\r\n description?: ReactNode;\r\n /** Trailing secondary text, e.g. a date. */\r\n meta?: ReactNode;\r\n /** Usually a `StatusBadge` (e.g. «قيد المراجعة»). */\r\n status?: ReactNode;\r\n onReview?: () => void;\r\n /** Overrides the default «مراجعة» label. */\r\n reviewLabel?: string;\r\n className?: string;\r\n}\r\n\r\n/** One pending-approval row for home/portal panels (Figma «بانتظار موافقتك»). */\r\nexport function ApprovalRequestRow({\r\n title,\r\n description,\r\n meta,\r\n status,\r\n onReview,\r\n reviewLabel = UI_COPY.portal.review,\r\n className,\r\n}: ApprovalRequestRowProps) {\r\n return (\r\n <li className={cx('erp-approval-row', className)}>\r\n <div className=\"erp-approval-row__body\">\r\n <p className=\"erp-approval-row__title\">{title}</p>\r\n {(description || meta) && (\r\n <p className=\"erp-approval-row__meta\">\r\n {description}\r\n {description && meta ? <span aria-hidden=\"true\"> · </span> : null}\r\n {meta ? <span className=\"erp-approval-row__date\">{meta}</span> : null}\r\n </p>\r\n )}\r\n </div>\r\n {status ? <div className=\"erp-approval-row__status\">{status}</div> : null}\r\n {onReview ? (\r\n <Button type=\"button\" size=\"sm\" variant=\"ghost\" startIcon={Eye} className=\"erp-approval-row__review\" onClick={onReview}>\r\n {reviewLabel}\r\n </Button>\r\n ) : null}\r\n </li>\r\n );\r\n}\r\n\r\nexport interface ApprovalRequestListProps {\r\n /** Accessible name of the list (panel title stays on `Card`). */\r\n label?: string;\r\n children?: ReactNode;\r\n empty?: ReactNode;\r\n className?: string;\r\n}\r\n\r\n/** Presentational list of approval rows; data and panel chrome belong to the app. */\r\nexport function ApprovalRequestList({\r\n label = UI_COPY.portal.approvals,\r\n children,\r\n empty,\r\n className,\r\n}: ApprovalRequestListProps) {\r\n const rows = Children.toArray(children);\r\n if (rows.length === 0) {\r\n return <>{empty ?? <EmptyState size=\"compact\" title={UI_COPY.portal.approvalsEmpty} />}</>;\r\n }\r\n return (\r\n <ul aria-label={label} className={cx('erp-approval-list', className)}>\r\n {rows}\r\n </ul>\r\n );\r\n}\r\n"]}
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import type { LucideIcon } from 'lucide-react';
|
|
2
|
-
import type
|
|
2
|
+
import { type MouseEvent, type ReactNode } from 'react';
|
|
3
3
|
import type { ProductModule } from '../types.js';
|
|
4
4
|
import './portal.css';
|
|
5
|
+
export interface PortalTileProps {
|
|
6
|
+
/** Visible label — any wording the app supplies (not fixed to a product module). */
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
icon: LucideIcon;
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
href?: string;
|
|
11
|
+
onSelect?: (event: MouseEvent) => void;
|
|
12
|
+
/** Optional count or marker in the corner. */
|
|
13
|
+
badge?: ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generic home-portal tile (Figma «بلاطة»): same look for modules, shortcuts, or any entry.
|
|
18
|
+
* Pass `label` / `icon` from the app — nothing is hard-coded.
|
|
19
|
+
*/
|
|
20
|
+
export declare function PortalTile({ label, icon, description, href, onSelect, badge, className }: PortalTileProps): import("react").JSX.Element;
|
|
5
21
|
export interface ModuleTileProps {
|
|
6
22
|
module: ProductModule;
|
|
7
23
|
onSelect?: (module: ProductModule, event: MouseEvent) => void;
|
|
@@ -9,7 +25,7 @@ export interface ModuleTileProps {
|
|
|
9
25
|
badge?: ReactNode;
|
|
10
26
|
className?: string;
|
|
11
27
|
}
|
|
12
|
-
/**
|
|
28
|
+
/** Module-descriptor wrapper around `PortalTile` for apps that already use `ProductModule`. */
|
|
13
29
|
export declare function ModuleTile({ module, onSelect, badge, className }: ModuleTileProps): import("react").JSX.Element;
|
|
14
30
|
export interface QuickAction {
|
|
15
31
|
id: string;
|
|
@@ -29,3 +45,11 @@ export interface QuickActionsProps {
|
|
|
29
45
|
}
|
|
30
46
|
/** Grid of shortcut tiles on dashboards (Figma «إجراءات سريعة»). */
|
|
31
47
|
export declare function QuickActions({ actions, label, columns, className }: QuickActionsProps): import("react").JSX.Element;
|
|
48
|
+
export interface ModuleTileGridProps {
|
|
49
|
+
/** Accessible name of the module picker group. */
|
|
50
|
+
label?: string;
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
className?: string;
|
|
53
|
+
}
|
|
54
|
+
/** Layout-only row/grid of `PortalTile` / `ModuleTile` children. */
|
|
55
|
+
export declare function ModuleTileGrid({ label, children, className }: ModuleTileGridProps): import("react").JSX.Element;
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { UI_COPY } from '@tmllak-erp/messages';
|
|
4
|
+
import { Children } from 'react';
|
|
3
5
|
import { cx } from '../../internal/cx.js';
|
|
4
6
|
import { Icon } from '../../primitives/icon/Icon.js';
|
|
5
7
|
import './portal.css';
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Generic home-portal tile (Figma «بلاطة»): same look for modules, shortcuts, or any entry.
|
|
10
|
+
* Pass `label` / `icon` from the app — nothing is hard-coded.
|
|
11
|
+
*/
|
|
12
|
+
export function PortalTile({ label, icon, description, href, onSelect, badge, className }) {
|
|
13
|
+
const content = (_jsxs(_Fragment, { children: [_jsx("span", { className: "erp-module-tile__icon", children: _jsx(Icon, { icon: icon, size: "lg" }) }), _jsx("span", { className: "erp-module-tile__name", children: label }), description ? _jsx("span", { className: "erp-module-tile__description", children: description }) : null, badge !== undefined && _jsx("span", { className: "erp-module-tile__badge", children: badge })] }));
|
|
9
14
|
const classes = cx('erp-module-tile', className);
|
|
10
|
-
return
|
|
15
|
+
return href ? (_jsx("a", { href: href, className: classes, onClick: onSelect, children: content })) : (_jsx("button", { type: "button", className: classes, onClick: onSelect, children: content }));
|
|
16
|
+
}
|
|
17
|
+
/** Module-descriptor wrapper around `PortalTile` for apps that already use `ProductModule`. */
|
|
18
|
+
export function ModuleTile({ module, onSelect, badge, className }) {
|
|
19
|
+
return (_jsx(PortalTile, { label: module.name, icon: module.icon, description: module.description, href: module.href, badge: badge, className: className, onSelect: onSelect ? (event) => onSelect(module, event) : undefined }));
|
|
11
20
|
}
|
|
12
21
|
/** Grid of shortcut tiles on dashboards (Figma «إجراءات سريعة»). */
|
|
13
22
|
export function QuickActions({ actions, label, columns = 2, className }) {
|
|
@@ -17,4 +26,8 @@ export function QuickActions({ actions, label, columns = 2, className }) {
|
|
|
17
26
|
return (_jsx("li", { children: action.href ? (_jsx("a", { href: action.href, className: classes, onClick: action.onSelect, children: content })) : (_jsx("button", { type: "button", className: classes, onClick: action.onSelect, children: content })) }, action.id));
|
|
18
27
|
}) }));
|
|
19
28
|
}
|
|
29
|
+
/** Layout-only row/grid of `PortalTile` / `ModuleTile` children. */
|
|
30
|
+
export function ModuleTileGrid({ label = UI_COPY.portal.modules, children, className }) {
|
|
31
|
+
return (_jsx("ul", { "aria-label": label, className: cx('erp-module-tile-grid', className), children: Children.map(children, (child, index) => child == null ? null : (_jsx("li", { className: "erp-module-tile-grid__item", children: child }, index))) }));
|
|
32
|
+
}
|
|
20
33
|
//# sourceMappingURL=ModuleTile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleTile.js","sourceRoot":"","sources":["../../../src/navigation/portal/ModuleTile.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"ModuleTile.js","sourceRoot":"","sources":["../../../src/navigation/portal/ModuleTile.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAmC,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAA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O,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAuB;IACzG,OAAO,CACL,2BAAgB,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,YACpE,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CACvC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACrB,aAAgB,SAAS,EAAC,4BAA4B,YACnD,KAAK,IADC,KAAK,CAET,CACN,CACF,GACE,CACN,CAAC;AACJ,CAAC","sourcesContent":["'use client';\r\n\r\nimport { UI_COPY } from '@tmllak-erp/messages';\r\nimport type { LucideIcon } from 'lucide-react';\r\nimport { Children, type MouseEvent, type ReactNode } from 'react';\r\nimport { cx } from '../../internal/cx';\r\nimport { Icon } from '../../primitives/icon/Icon';\r\nimport type { ProductModule } from '../types';\r\nimport './portal.css';\r\n\r\nexport interface PortalTileProps {\r\n /** Visible label — any wording the app supplies (not fixed to a product module). */\r\n label: ReactNode;\r\n icon: LucideIcon;\r\n description?: ReactNode;\r\n href?: string;\r\n onSelect?: (event: MouseEvent) => void;\r\n /** Optional count or marker in the corner. */\r\n badge?: ReactNode;\r\n className?: string;\r\n}\r\n\r\n/**\r\n * Generic home-portal tile (Figma «بلاطة»): same look for modules, shortcuts, or any entry.\r\n * Pass `label` / `icon` from the app — nothing is hard-coded.\r\n */\r\nexport function PortalTile({ label, icon, description, href, onSelect, badge, className }: PortalTileProps) {\r\n const content = (\r\n <>\r\n <span className=\"erp-module-tile__icon\">\r\n <Icon icon={icon} size=\"lg\" />\r\n </span>\r\n <span className=\"erp-module-tile__name\">{label}</span>\r\n {description ? <span className=\"erp-module-tile__description\">{description}</span> : null}\r\n {badge !== undefined && <span className=\"erp-module-tile__badge\">{badge}</span>}\r\n </>\r\n );\r\n const classes = cx('erp-module-tile', className);\r\n return href ? (\r\n <a href={href} className={classes} onClick={onSelect}>\r\n {content}\r\n </a>\r\n ) : (\r\n <button type=\"button\" className={classes} onClick={onSelect}>\r\n {content}\r\n </button>\r\n );\r\n}\r\n\r\nexport interface ModuleTileProps {\r\n module: ProductModule;\r\n onSelect?: (module: ProductModule, event: MouseEvent) => void;\r\n /** Optional count, e.g. pending approvals in that module. */\r\n badge?: ReactNode;\r\n className?: string;\r\n}\r\n\r\n/** Module-descriptor wrapper around `PortalTile` for apps that already use `ProductModule`. */\r\nexport function ModuleTile({ module, onSelect, badge, className }: ModuleTileProps) {\r\n return (\r\n <PortalTile\r\n label={module.name}\r\n icon={module.icon}\r\n description={module.description}\r\n href={module.href}\r\n badge={badge}\r\n className={className}\r\n onSelect={onSelect ? (event) => onSelect(module, event) : undefined}\r\n />\r\n );\r\n}\r\n\r\nexport interface QuickAction {\r\n id: string;\r\n label: string;\r\n icon: LucideIcon;\r\n onSelect?: () => void;\r\n href?: string;\r\n /** The main action uses the theme surface (Figma «مهمة جديدة»). */\r\n primary?: boolean;\r\n}\r\n\r\nexport interface QuickActionsProps {\r\n actions: readonly QuickAction[];\r\n /** Accessible name of the group, e.g. «إجراءات سريعة». */\r\n label: string;\r\n columns?: 2 | 3;\r\n className?: string;\r\n}\r\n\r\n/** Grid of shortcut tiles on dashboards (Figma «إجراءات سريعة»). */\r\nexport function QuickActions({ actions, label, columns = 2, className }: QuickActionsProps) {\r\n return (\r\n <ul aria-label={label} className={cx('erp-quick-actions', `erp-quick-actions--${columns}`, className)}>\r\n {actions.map((action) => {\r\n const classes = cx('erp-quick-action', action.primary && 'erp-quick-action--primary');\r\n const content = (\r\n <>\r\n <span className=\"erp-quick-action__icon\">\r\n <Icon icon={action.icon} size=\"md\" />\r\n </span>\r\n <span>{action.label}</span>\r\n </>\r\n );\r\n return (\r\n <li key={action.id}>\r\n {action.href ? (\r\n <a href={action.href} className={classes} onClick={action.onSelect}>\r\n {content}\r\n </a>\r\n ) : (\r\n <button type=\"button\" className={classes} onClick={action.onSelect}>\r\n {content}\r\n </button>\r\n )}\r\n </li>\r\n );\r\n })}\r\n </ul>\r\n );\r\n}\r\n\r\nexport interface ModuleTileGridProps {\r\n /** Accessible name of the module picker group. */\r\n label?: string;\r\n children: ReactNode;\r\n className?: string;\r\n}\r\n\r\n/** Layout-only row/grid of `PortalTile` / `ModuleTile` children. */\r\nexport function ModuleTileGrid({ label = UI_COPY.portal.modules, children, className }: ModuleTileGridProps) {\r\n return (\r\n <ul aria-label={label} className={cx('erp-module-tile-grid', className)}>\r\n {Children.map(children, (child, index) =>\r\n child == null ? null : (\r\n <li key={index} className=\"erp-module-tile-grid__item\">\r\n {child}\r\n </li>\r\n ),\r\n )}\r\n </ul>\r\n );\r\n}\r\n"]}
|
|
@@ -119,3 +119,78 @@
|
|
|
119
119
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
.erp-module-tile-grid {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-wrap: wrap;
|
|
126
|
+
justify-content: center;
|
|
127
|
+
gap: var(--erp-space-4);
|
|
128
|
+
margin: 0;
|
|
129
|
+
padding: 0;
|
|
130
|
+
list-style: none;
|
|
131
|
+
}
|
|
132
|
+
.erp-module-tile-grid__item {
|
|
133
|
+
display: flex;
|
|
134
|
+
}
|
|
135
|
+
.erp-module-tile-grid__item > .erp-module-tile {
|
|
136
|
+
inline-size: 100%;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.erp-approval-list {
|
|
140
|
+
display: grid;
|
|
141
|
+
gap: var(--erp-space-2);
|
|
142
|
+
margin: 0;
|
|
143
|
+
padding: 0;
|
|
144
|
+
list-style: none;
|
|
145
|
+
}
|
|
146
|
+
.erp-approval-row {
|
|
147
|
+
display: grid;
|
|
148
|
+
grid-template-columns: minmax(0, 1fr) auto auto;
|
|
149
|
+
align-items: center;
|
|
150
|
+
gap: var(--erp-space-3);
|
|
151
|
+
padding: var(--erp-space-3) var(--erp-space-2);
|
|
152
|
+
border-radius: var(--erp-radius-md);
|
|
153
|
+
background: var(--erp-color-bg-subtle);
|
|
154
|
+
}
|
|
155
|
+
.erp-approval-row__body {
|
|
156
|
+
min-inline-size: 0;
|
|
157
|
+
}
|
|
158
|
+
.erp-approval-row__title {
|
|
159
|
+
margin: 0;
|
|
160
|
+
font-size: var(--erp-font-size-body);
|
|
161
|
+
line-height: var(--erp-line-height-body);
|
|
162
|
+
font-weight: var(--erp-font-weight-semibold);
|
|
163
|
+
color: var(--erp-color-text-primary);
|
|
164
|
+
}
|
|
165
|
+
.erp-approval-row__meta {
|
|
166
|
+
margin: var(--erp-space-1) 0 0;
|
|
167
|
+
font-size: var(--erp-font-size-caption);
|
|
168
|
+
line-height: var(--erp-line-height-caption);
|
|
169
|
+
color: var(--erp-color-text-secondary);
|
|
170
|
+
}
|
|
171
|
+
.erp-approval-row__date {
|
|
172
|
+
white-space: nowrap;
|
|
173
|
+
}
|
|
174
|
+
.erp-approval-row__status {
|
|
175
|
+
justify-self: end;
|
|
176
|
+
}
|
|
177
|
+
.erp-approval-row__review {
|
|
178
|
+
justify-self: end;
|
|
179
|
+
}
|
|
180
|
+
@media (max-width: 599px) {
|
|
181
|
+
.erp-approval-row {
|
|
182
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
183
|
+
grid-template-areas:
|
|
184
|
+
'body status'
|
|
185
|
+
'body review';
|
|
186
|
+
}
|
|
187
|
+
.erp-approval-row__body {
|
|
188
|
+
grid-area: body;
|
|
189
|
+
}
|
|
190
|
+
.erp-approval-row__status {
|
|
191
|
+
grid-area: status;
|
|
192
|
+
}
|
|
193
|
+
.erp-approval-row__review {
|
|
194
|
+
grid-area: review;
|
|
195
|
+
}
|
|
196
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmllak-erp/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"@dnd-kit/core": "^6.3.1",
|
|
19
19
|
"@dnd-kit/sortable": "^10.0.0",
|
|
20
20
|
"@dnd-kit/utilities": "^3.2.2",
|
|
21
|
-
"@tmllak-erp/formatters": "0.
|
|
22
|
-
"@tmllak-erp/messages": "0.
|
|
23
|
-
"@tmllak-erp/tokens": "0.
|
|
21
|
+
"@tmllak-erp/formatters": "0.2.0",
|
|
22
|
+
"@tmllak-erp/messages": "0.2.0",
|
|
23
|
+
"@tmllak-erp/tokens": "0.2.0",
|
|
24
24
|
"@floating-ui/react-dom": "^2.1.9",
|
|
25
25
|
"lucide-react": "^1.70.0"
|
|
26
26
|
},
|