@akinon/ui-layout 0.6.0 → 1.0.1

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.
Files changed (91) hide show
  1. package/dist/cjs/Flex/index.d.ts +12 -1
  2. package/dist/cjs/Flex/index.d.ts.map +1 -1
  3. package/dist/cjs/Flex/index.js +11 -0
  4. package/dist/cjs/Flex/types.d.ts +12 -3
  5. package/dist/cjs/Grid/index.d.ts +23 -0
  6. package/dist/cjs/Grid/index.d.ts.map +1 -1
  7. package/dist/cjs/Grid/index.js +23 -0
  8. package/dist/cjs/Grid/types.d.ts +14 -2
  9. package/dist/cjs/Layout/Content/index.d.ts +8 -0
  10. package/dist/cjs/Layout/Content/index.d.ts.map +1 -1
  11. package/dist/cjs/Layout/Content/index.js +8 -0
  12. package/dist/cjs/Layout/Content/types.d.ts +15 -0
  13. package/dist/cjs/Layout/Footer/index.d.ts +5 -0
  14. package/dist/cjs/Layout/Footer/index.d.ts.map +1 -1
  15. package/dist/cjs/Layout/Footer/index.js +5 -0
  16. package/dist/cjs/Layout/Footer/types.d.ts +28 -0
  17. package/dist/cjs/Layout/Header/index.d.ts +7 -0
  18. package/dist/cjs/Layout/Header/index.d.ts.map +1 -1
  19. package/dist/cjs/Layout/Header/index.js +7 -0
  20. package/dist/cjs/Layout/Header/types.d.ts +23 -0
  21. package/dist/cjs/Layout/Sider/index.css +8 -2
  22. package/dist/cjs/Layout/Sider/index.d.ts +24 -1
  23. package/dist/cjs/Layout/Sider/index.d.ts.map +1 -1
  24. package/dist/cjs/Layout/Sider/index.js +36 -6
  25. package/dist/cjs/Layout/Sider/types.d.ts +61 -1
  26. package/dist/cjs/Layout/index.d.ts +6 -0
  27. package/dist/cjs/Layout/index.d.ts.map +1 -1
  28. package/dist/cjs/Layout/index.js +6 -0
  29. package/dist/cjs/Layout/types.d.ts +14 -4
  30. package/dist/cjs/NavCard/__tests__/navcard.test.d.ts +2 -0
  31. package/dist/cjs/NavCard/__tests__/navcard.test.d.ts.map +1 -0
  32. package/dist/cjs/NavCard/__tests__/navcard.test.js +40 -0
  33. package/dist/cjs/NavCard/__tests__/navcard.test.tsx +92 -0
  34. package/dist/cjs/NavCard/index.d.ts +20 -3
  35. package/dist/cjs/NavCard/index.d.ts.map +1 -1
  36. package/dist/cjs/NavCard/index.js +79 -8
  37. package/dist/cjs/NavCard/types.d.ts +19 -11
  38. package/dist/cjs/PageContent/index.d.ts +4 -2
  39. package/dist/cjs/PageContent/index.d.ts.map +1 -1
  40. package/dist/cjs/PageContent/index.js +5 -4
  41. package/dist/cjs/PageContent/types.d.ts +9 -1
  42. package/dist/cjs/PageHeading/index.d.ts +5 -2
  43. package/dist/cjs/PageHeading/index.d.ts.map +1 -1
  44. package/dist/cjs/PageHeading/index.js +13 -7
  45. package/dist/cjs/PageHeading/types.d.ts +4 -1
  46. package/dist/esm/Flex/index.d.ts +12 -1
  47. package/dist/esm/Flex/index.d.ts.map +1 -1
  48. package/dist/esm/Flex/index.js +11 -0
  49. package/dist/esm/Flex/types.d.ts +12 -3
  50. package/dist/esm/Grid/index.d.ts +23 -0
  51. package/dist/esm/Grid/index.d.ts.map +1 -1
  52. package/dist/esm/Grid/index.js +23 -0
  53. package/dist/esm/Grid/types.d.ts +14 -2
  54. package/dist/esm/Layout/Content/index.d.ts +8 -0
  55. package/dist/esm/Layout/Content/index.d.ts.map +1 -1
  56. package/dist/esm/Layout/Content/index.js +8 -0
  57. package/dist/esm/Layout/Content/types.d.ts +15 -0
  58. package/dist/esm/Layout/Footer/index.d.ts +5 -0
  59. package/dist/esm/Layout/Footer/index.d.ts.map +1 -1
  60. package/dist/esm/Layout/Footer/index.js +5 -0
  61. package/dist/esm/Layout/Footer/types.d.ts +28 -0
  62. package/dist/esm/Layout/Header/index.d.ts +7 -0
  63. package/dist/esm/Layout/Header/index.d.ts.map +1 -1
  64. package/dist/esm/Layout/Header/index.js +7 -0
  65. package/dist/esm/Layout/Header/types.d.ts +23 -0
  66. package/dist/esm/Layout/Sider/index.css +8 -2
  67. package/dist/esm/Layout/Sider/index.d.ts +24 -1
  68. package/dist/esm/Layout/Sider/index.d.ts.map +1 -1
  69. package/dist/esm/Layout/Sider/index.js +36 -6
  70. package/dist/esm/Layout/Sider/types.d.ts +61 -1
  71. package/dist/esm/Layout/index.d.ts +6 -0
  72. package/dist/esm/Layout/index.d.ts.map +1 -1
  73. package/dist/esm/Layout/index.js +6 -0
  74. package/dist/esm/Layout/types.d.ts +14 -4
  75. package/dist/esm/NavCard/__tests__/navcard.test.d.ts +2 -0
  76. package/dist/esm/NavCard/__tests__/navcard.test.d.ts.map +1 -0
  77. package/dist/esm/NavCard/__tests__/navcard.test.js +38 -0
  78. package/dist/esm/NavCard/__tests__/navcard.test.tsx +92 -0
  79. package/dist/esm/NavCard/index.d.ts +20 -3
  80. package/dist/esm/NavCard/index.d.ts.map +1 -1
  81. package/dist/esm/NavCard/index.js +79 -8
  82. package/dist/esm/NavCard/types.d.ts +19 -11
  83. package/dist/esm/PageContent/index.d.ts +4 -2
  84. package/dist/esm/PageContent/index.d.ts.map +1 -1
  85. package/dist/esm/PageContent/index.js +5 -4
  86. package/dist/esm/PageContent/types.d.ts +9 -1
  87. package/dist/esm/PageHeading/index.d.ts +5 -2
  88. package/dist/esm/PageHeading/index.d.ts.map +1 -1
  89. package/dist/esm/PageHeading/index.js +13 -7
  90. package/dist/esm/PageHeading/types.d.ts +4 -1
  91. package/package.json +8 -5
@@ -1,68 +1,128 @@
1
1
  // TODO integrate with antd menu types
2
+ /**
3
+ * Interface for items within the left sider.
4
+ */
2
5
  export type LeftSiderItem = {
6
+ /**
7
+ * Unique key for the menu item.
8
+ */
3
9
  key: string;
10
+
11
+ /**
12
+ * Display label for the menu item.
13
+ */
4
14
  label: string;
15
+
16
+ /**
17
+ * Optional icon for the menu item.
18
+ */
5
19
  icon?: React.ReactNode;
20
+
21
+ /**
22
+ * Additional CSS class for the menu item.
23
+ */
6
24
  className?: string;
25
+
26
+ /**
27
+ * Callback function triggered when the menu item is clicked.
28
+ */
7
29
  onClick?: () => void;
30
+
31
+ /**
32
+ * Nested children items for creating submenus.
33
+ */
8
34
  children?: LeftSiderItem[];
35
+
36
+ /**
37
+ * Whether the menu item is disabled.
38
+ */
9
39
  disabled?: boolean;
10
40
  };
11
41
 
12
42
  export type SiderProps = Omit<AntSiderProps, 'prefixCls' | 'style' | 'styles'>;
13
43
 
14
44
  export interface AntSiderProps extends React.HTMLAttributes<HTMLDivElement> {
15
- prefixCls?: string;
45
+ /**
46
+ * Sider position for border position.
47
+ * If it is left, the border will be on the right side.
48
+ * Other is other side.
49
+ *
50
+ * @default left
51
+ */
52
+ position?: 'left' | 'right';
53
+
16
54
  /**
17
55
  * Whether can be collapsed
18
56
  */
19
57
  collapsible?: boolean;
58
+
20
59
  /**
21
60
  * To set the current status
22
61
  */
23
62
  collapsed?: boolean;
63
+
24
64
  /**
25
65
  * To set the initial status
26
66
  */
27
67
  defaultCollapsed?: boolean;
68
+
28
69
  /**
29
70
  * Reverse direction of arrow, for a sider that expands from the right
30
71
  */
31
72
  reverseArrow?: boolean;
73
+
32
74
  /**
33
75
  * The callback function, executed by clicking the trigger or activating the responsive layout
34
76
  */
35
77
  onCollapse?: (collapsed: boolean, type: CollapseType) => void;
78
+
36
79
  /**
37
80
  * To customize the styles of the special trigger that appears when <code>collapsedWidth</code> is 0
38
81
  */
39
82
  zeroWidthTriggerStyle?: React.CSSProperties;
83
+
40
84
  /**
41
85
  * Specify the customized trigger, set to null to hide the trigger
42
86
  */
43
87
  trigger?: React.ReactNode;
88
+
44
89
  /**
45
90
  * Width of the sidebar
46
91
  */
47
92
  width?: number | string;
93
+
48
94
  /**
49
95
  * Width of the collapsed sidebar, by setting to 0 a special trigger will appear
50
96
  */
51
97
  collapsedWidth?: number | string;
98
+
52
99
  /**
53
100
  * Breakpoints of the responsive layout
54
101
  */
55
102
  breakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
103
+
56
104
  /**
57
105
  * Color theme of the sidebar
58
106
  */
59
107
  theme?: SiderTheme;
108
+
60
109
  /**
61
110
  * The callback function, executed when breakpoints changed
62
111
  */
63
112
  onBreakpoint?: (broken: boolean) => void;
113
+
114
+ /**
115
+ * URL for the sidebar's custom icon. This can be used for branding or visual enhancement.
116
+ * If provided, the icon will be displayed in the sidebar header or a designated area.
117
+ */
64
118
  iconUrl?: string;
119
+
120
+ /**
121
+ * URL for the sidebar's brand image. Typically used to display a logo or branding element in the sidebar.
122
+ * This can enhance the sidebar's appearance and provide a visual identity for the application.
123
+ */
65
124
  brandImageUrl?: string;
125
+
66
126
  /**
67
127
  * The additional css class
68
128
  */
@@ -1,5 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import type { LayoutProps } from './types';
3
3
  export type { LayoutProps } from './types';
4
+ /**
5
+ * Layout component, which acts as the container for building structured page layouts.
6
+ * It provides a framework to integrate Sider, Header, Footer, and Content components cohesively.
7
+ *
8
+ * This component is commonly used in applications to establish a consistent and flexible layout structure.
9
+ */
4
10
  export declare const Layout: ({ children, ...restLayoutProps }: LayoutProps) => React.JSX.Element;
5
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Layout/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,MAAM,qCAAsC,WAAW,sBA4BnE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Layout/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;GAKG;AAEH,eAAO,MAAM,MAAM,qCAAsC,WAAW,sBA4BnE,CAAC"}
@@ -13,6 +13,12 @@ import { useToken } from '@akinon/ui-theme';
13
13
  import { useStyleRegister } from '@ant-design/cssinjs';
14
14
  import { ConfigProvider, Layout as AntLayout } from 'antd';
15
15
  import * as React from 'react';
16
+ /**
17
+ * Layout component, which acts as the container for building structured page layouts.
18
+ * It provides a framework to integrate Sider, Header, Footer, and Content components cohesively.
19
+ *
20
+ * This component is commonly used in applications to establish a consistent and flexible layout structure.
21
+ */
16
22
  export const Layout = (_a) => {
17
23
  var { children } = _a, restLayoutProps = __rest(_a, ["children"]);
18
24
  const { getPrefixCls, theme } = React.useContext(ConfigProvider.ConfigContext);
@@ -4,19 +4,29 @@ export type LayoutProps = Omit<
4
4
  >;
5
5
 
6
6
  export interface AntLayoutProps extends React.HTMLAttributes<HTMLDivElement> {
7
- prefixCls?: string;
7
+ /**
8
+ * Suffix class for custom styling.
9
+ */
8
10
  suffixCls?: string;
11
+
9
12
  /**
10
- * ClassName on the root element
13
+ * ClassName on the root element.
11
14
  */
12
15
  rootClassName?: string;
16
+
13
17
  /**
14
- * Whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
18
+ * Indicates whether the layout contains a Sider component.
19
+ * This property is usually inferred automatically but can be explicitly set to avoid style flickering in SSR scenarios.
15
20
  */
16
21
  hasSider?: boolean;
22
+
23
+ /**
24
+ * The children elements to render within the layout.
25
+ */
17
26
  children: React.ReactNode;
27
+
18
28
  /**
19
- * The additional css class
29
+ * The additional CSS class for styling.
20
30
  */
21
31
  className?: string;
22
32
  }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=navcard.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navcard.test.d.ts","sourceRoot":"","sources":["../../../../src/NavCard/__tests__/navcard.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ import { render, screen } from '@akinon/utils';
2
+ import * as React from 'react';
3
+ import { describe, expect, it } from 'vitest';
4
+ import { NavCard } from '..';
5
+ describe('NavCard', () => {
6
+ it('renders with required props', () => {
7
+ render(React.createElement(NavCard, { title: "Test Title", description: "Test Description", icon: "search" }));
8
+ expect(screen.getByText('Test Title')).toBeInTheDocument();
9
+ expect(screen.getByText('Test Description')).toBeInTheDocument();
10
+ });
11
+ it('renders with default variant', () => {
12
+ render(React.createElement(NavCard, { title: "Test Title", description: "Test Description", icon: "search", variant: "default" }));
13
+ const iconContainer = screen.getByTestId('icon-container');
14
+ expect(iconContainer).toHaveClass('akinon-navcard-icon-default');
15
+ });
16
+ it('renders with akinon variant', () => {
17
+ render(React.createElement(NavCard, { title: "Test Title", description: "Test Description", icon: "search", variant: "akinon" }));
18
+ const iconContainer = screen.getByTestId('icon-container');
19
+ expect(iconContainer).toHaveClass('akinon-navcard-icon-akinon');
20
+ });
21
+ it('applies custom background color', () => {
22
+ const customBackground = '#ff0000';
23
+ render(React.createElement(NavCard, { title: "Test Title", description: "Test Description", icon: "search", background: customBackground }));
24
+ const iconContainer = screen.getByTestId('icon-container');
25
+ expect(iconContainer).toHaveStyle({ background: customBackground });
26
+ });
27
+ it('applies custom icon color', () => {
28
+ render(React.createElement(NavCard, { title: "Test Title", description: "Test Description", icon: "search", iconColor: "red" }));
29
+ const icon = screen.getByTestId('icon');
30
+ expect(icon).toHaveStyle({ fill: 'red' });
31
+ });
32
+ it('applies custom className', () => {
33
+ const customClass = 'custom-nav-card';
34
+ render(React.createElement(NavCard, { title: "Test Title", description: "Test Description", icon: "search", className: customClass }));
35
+ const navCard = screen.getByTestId('nav-card');
36
+ expect(navCard).toHaveClass(customClass);
37
+ });
38
+ });
@@ -0,0 +1,92 @@
1
+ import { render, screen } from '@akinon/utils';
2
+ import * as React from 'react';
3
+ import { describe, expect, it } from 'vitest';
4
+
5
+ import { NavCard } from '..';
6
+
7
+ describe('NavCard', () => {
8
+ it('renders with required props', () => {
9
+ render(
10
+ <NavCard
11
+ title="Test Title"
12
+ description="Test Description"
13
+ icon="search"
14
+ />
15
+ );
16
+
17
+ expect(screen.getByText('Test Title')).toBeInTheDocument();
18
+ expect(screen.getByText('Test Description')).toBeInTheDocument();
19
+ });
20
+
21
+ it('renders with default variant', () => {
22
+ render(
23
+ <NavCard
24
+ title="Test Title"
25
+ description="Test Description"
26
+ icon="search"
27
+ variant="default"
28
+ />
29
+ );
30
+
31
+ const iconContainer = screen.getByTestId('icon-container');
32
+ expect(iconContainer).toHaveClass('akinon-navcard-icon-default');
33
+ });
34
+
35
+ it('renders with akinon variant', () => {
36
+ render(
37
+ <NavCard
38
+ title="Test Title"
39
+ description="Test Description"
40
+ icon="search"
41
+ variant="akinon"
42
+ />
43
+ );
44
+
45
+ const iconContainer = screen.getByTestId('icon-container');
46
+ expect(iconContainer).toHaveClass('akinon-navcard-icon-akinon');
47
+ });
48
+
49
+ it('applies custom background color', () => {
50
+ const customBackground = '#ff0000';
51
+ render(
52
+ <NavCard
53
+ title="Test Title"
54
+ description="Test Description"
55
+ icon="search"
56
+ background={customBackground}
57
+ />
58
+ );
59
+
60
+ const iconContainer = screen.getByTestId('icon-container');
61
+ expect(iconContainer).toHaveStyle({ background: customBackground });
62
+ });
63
+
64
+ it('applies custom icon color', () => {
65
+ render(
66
+ <NavCard
67
+ title="Test Title"
68
+ description="Test Description"
69
+ icon="search"
70
+ iconColor="red"
71
+ />
72
+ );
73
+
74
+ const icon = screen.getByTestId('icon');
75
+ expect(icon).toHaveStyle({ fill: 'red' });
76
+ });
77
+
78
+ it('applies custom className', () => {
79
+ const customClass = 'custom-nav-card';
80
+ render(
81
+ <NavCard
82
+ title="Test Title"
83
+ description="Test Description"
84
+ icon="search"
85
+ className={customClass}
86
+ />
87
+ );
88
+
89
+ const navCard = screen.getByTestId('nav-card');
90
+ expect(navCard).toHaveClass(customClass);
91
+ });
92
+ });
@@ -1,6 +1,23 @@
1
- import './index.css';
2
1
  import * as React from 'react';
3
2
  import type { NavCardProps } from './types';
4
- export type { NavCardProps } from './types';
5
- export declare const NavCard: ({ title, description, icon, variant, className }: NavCardProps) => React.JSX.Element;
3
+ export type * from './types';
4
+ /**
5
+ * NavCard component for navigation or highlighting sections in the interface.
6
+ *
7
+ * The NavCard component is designed to provide a visually engaging and functional card
8
+ * that serves as a navigation element or as a callout section in a user interface.
9
+ *
10
+ * Features:
11
+ * - **Title**: A required title to provide the primary context for the NavCard.
12
+ * - **Description**: A short description to elaborate on the title or purpose of the card.
13
+ * - **Icon**: Optionally display an icon to visually represent the NavCard's content or functionality.
14
+ * - **Color Variants**: Offers a range of predefined color options for theming, including:
15
+ * - `default`
16
+ * - `akinon`
17
+ * - **Custom Styling**: Allows additional customizations via the `className` prop.
18
+ *
19
+ * Ideal for use in dashboards, navigation menus, or any scenario where visually distinct
20
+ * and thematically consistent navigation elements are required.
21
+ */
22
+ export declare const NavCard: ({ title, description, icon, variant, className, background, iconColor }: NavCardProps) => React.JSX.Element;
6
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/NavCard/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,OAAO,qDAMjB,YAAY,sBAad,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/NavCard/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,mBAAmB,SAAS,CAAC;AAE7B;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,OAAO,4EAQjB,YAAY,sBAwFd,CAAC"}
@@ -1,11 +1,82 @@
1
- import './index.css';
1
+ import { Icon } from '@akinon/icons';
2
+ import { useToken } from '@akinon/ui-theme';
3
+ import { Title } from '@akinon/ui-typography';
4
+ import { useStyleRegister } from '@ant-design/cssinjs';
5
+ import { ConfigProvider } from 'antd';
2
6
  import clsx from 'clsx';
3
7
  import * as React from 'react';
4
- export const NavCard = ({ title, description, icon, variant, className }) => {
5
- const variantClass = variant ? `nav-card-${variant}` : '';
6
- return (React.createElement("div", { className: clsx('nav-card', variantClass, className) },
7
- icon && React.createElement("div", { className: "nav-card__icon" }, icon),
8
- React.createElement("div", { className: "nav-card__content" },
9
- React.createElement("h2", { className: "nav-card__title" }, title),
10
- React.createElement("div", { className: "nav-card__description" }, description))));
8
+ import { Flex } from '../Flex';
9
+ /**
10
+ * NavCard component for navigation or highlighting sections in the interface.
11
+ *
12
+ * The NavCard component is designed to provide a visually engaging and functional card
13
+ * that serves as a navigation element or as a callout section in a user interface.
14
+ *
15
+ * Features:
16
+ * - **Title**: A required title to provide the primary context for the NavCard.
17
+ * - **Description**: A short description to elaborate on the title or purpose of the card.
18
+ * - **Icon**: Optionally display an icon to visually represent the NavCard's content or functionality.
19
+ * - **Color Variants**: Offers a range of predefined color options for theming, including:
20
+ * - `default`
21
+ * - `akinon`
22
+ * - **Custom Styling**: Allows additional customizations via the `className` prop.
23
+ *
24
+ * Ideal for use in dashboards, navigation menus, or any scenario where visually distinct
25
+ * and thematically consistent navigation elements are required.
26
+ */
27
+ export const NavCard = ({ title, description, icon, variant = 'default', className, background, iconColor = 'white' }) => {
28
+ const { getPrefixCls, theme } = React.useContext(ConfigProvider.ConfigContext);
29
+ const { token, hashId } = useToken();
30
+ const navCardToken = theme.NavCardTokens;
31
+ const customTokens = theme.CustomTokens || {};
32
+ const prefixClsWithoutHash = `.${getPrefixCls()}-navcard`;
33
+ const prefixCls = `:where(.${hashId})${prefixClsWithoutHash}`;
34
+ useStyleRegister({
35
+ token: token,
36
+ path: ['NavCard'],
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ theme: theme
39
+ }, () => {
40
+ return {
41
+ [prefixCls]: {
42
+ overflow: customTokens.overflow.overflowHidden,
43
+ borderRadius: customTokens.border.borderRadiusSm,
44
+ boxShadow: navCardToken.shadow,
45
+ background: 'white',
46
+ [`${prefixClsWithoutHash}-icon`]: {
47
+ padding: '1.5rem',
48
+ display: customTokens.layout.displayFlex,
49
+ justifyContent: customTokens.layout.flexCenter,
50
+ alignItems: customTokens.layout.flexCenter,
51
+ [`&${prefixClsWithoutHash}-icon-default`]: {
52
+ background: 'var(--color-gray-500)'
53
+ },
54
+ [`&${prefixClsWithoutHash}-icon-akinon`]: {
55
+ background: 'var(--color-akinon-500)'
56
+ }
57
+ },
58
+ [`${prefixClsWithoutHash}-content`]: {
59
+ padding: '1.5rem'
60
+ },
61
+ [`${prefixClsWithoutHash}-title`]: {
62
+ color: 'var(--color-blue-955)',
63
+ margin: 0
64
+ },
65
+ [`${prefixClsWithoutHash}-description`]: {
66
+ color: 'var(--color-blue-955)'
67
+ }
68
+ }
69
+ };
70
+ });
71
+ return (React.createElement(React.Fragment, null,
72
+ React.createElement(Flex, { className: clsx(`${getPrefixCls()}-navcard`, className), "data-testid": "nav-card" },
73
+ React.createElement("div", { className: clsx(`${getPrefixCls()}-navcard-icon`, {
74
+ [`${getPrefixCls()}-navcard-icon-${variant}`]: variant
75
+ }), style: {
76
+ background
77
+ }, "data-testid": "icon-container" },
78
+ React.createElement(Icon, { icon: icon, size: "28", color: iconColor, "data-testid": "icon" })),
79
+ React.createElement("div", { className: clsx(`${getPrefixCls()}-navcard-content`) },
80
+ React.createElement(Title, { level: 3, className: `${getPrefixCls()}-navcard-title` }, title),
81
+ React.createElement("div", { className: `${getPrefixCls()}-navcard-description` }, description)))));
11
82
  };
@@ -1,30 +1,38 @@
1
- export type NavCardColorVariant =
2
- | 'akinon'
3
- | 'azure'
4
- | 'blue'
5
- | 'orange'
6
- | 'red'
7
- | 'green'
8
- | 'pink'
9
- | 'purple';
1
+ import { IconName } from '@akinon/icons';
2
+
3
+ export type NavCardColorVariant = 'akinon' | 'default';
10
4
 
11
5
  export interface NavCardProps {
12
6
  /**
13
7
  * The title of the NavCard.
14
8
  */
15
9
  title: string;
10
+
16
11
  /**
17
12
  * The description of the NavCard.
18
13
  */
19
- description: string;
14
+ description: React.ReactNode;
15
+
20
16
  /**
21
17
  * The icon of the NavCard.
22
18
  */
23
- icon?: React.ReactNode;
19
+ icon: IconName;
20
+
24
21
  /**
25
22
  * The color variant of the NavCard.
26
23
  */
27
24
  variant?: NavCardColorVariant;
25
+
26
+ /**
27
+ * Custom background for the NavCard.
28
+ */
29
+ background?: React.CSSProperties['background'];
30
+
31
+ /**
32
+ * Custom icon color for the NavCard.
33
+ */
34
+ iconColor?: React.CSSProperties['color'];
35
+
28
36
  /**
29
37
  * The additional css class
30
38
  */
@@ -1,6 +1,8 @@
1
- import './index.css';
2
1
  import * as React from 'react';
3
2
  import type { PageContentProps } from './types';
4
- export type { PageContentProps } from './types';
3
+ /**
4
+ * It is used to generate content for a standard page.
5
+ */
5
6
  export declare const PageContent: ({ children, className, ...restProps }: PageContentProps) => React.JSX.Element;
7
+ export type * from './types';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PageContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,WAAW,0CAIrB,gBAAgB,sBAIlB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PageContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;GAEG;AAEH,eAAO,MAAM,WAAW,0CAIrB,gBAAgB,sBAMlB,CAAC;AAEF,mBAAmB,SAAS,CAAC"}
@@ -9,10 +9,11 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import './index.css';
13
- import clsx from 'clsx';
14
12
  import * as React from 'react';
13
+ /**
14
+ * It is used to generate content for a standard page.
15
+ */
15
16
  export const PageContent = (_a) => {
16
- var { children, className } = _a, restProps = __rest(_a, ["children", "className"]);
17
- return (React.createElement("div", Object.assign({ className: clsx('akinon-page-content', className) }, restProps), children));
17
+ var { children, className = '' } = _a, restProps = __rest(_a, ["children", "className"]);
18
+ return (React.createElement("div", Object.assign({ className: className, style: { padding: '30px' } }, restProps), children));
18
19
  };
@@ -1,3 +1,11 @@
1
1
  export interface PageContentProps extends React.HTMLAttributes<HTMLDivElement> {
2
- children: ReactNode;
2
+ /**
3
+ * The content of the page.
4
+ */
5
+ children: React.ReactNode;
6
+
7
+ /**
8
+ * The additional css class.
9
+ */
10
+ className?: string;
3
11
  }
@@ -1,6 +1,9 @@
1
- import './index.css';
2
1
  import * as React from 'react';
3
2
  import type { PageHeadingProps } from './types';
4
- export type { PageHeadingProps } from './types';
3
+ /**
4
+ * It is used to generate title, description and actions for a standard page.
5
+ * See the [PageContent](/docs/layout-pagecontent--docs) component for more information.
6
+ */
5
7
  export declare const PageHeading: ({ title, description, actions, className }: PageHeadingProps) => React.JSX.Element;
8
+ export type * from './types';
6
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PageHeading/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,WAAW,+CAKrB,gBAAgB,sBAalB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PageHeading/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;GAGG;AAEH,eAAO,MAAM,WAAW,+CAKrB,gBAAgB,sBA4BlB,CAAC;AAEF,mBAAmB,SAAS,CAAC"}
@@ -1,10 +1,16 @@
1
- import './index.css';
2
- import clsx from 'clsx';
1
+ import { Flex, Space, Typography } from 'antd';
3
2
  import * as React from 'react';
3
+ /**
4
+ * It is used to generate title, description and actions for a standard page.
5
+ * See the [PageContent](/docs/layout-pagecontent--docs) component for more information.
6
+ */
4
7
  export const PageHeading = ({ title, description, actions, className }) => {
5
- return (React.createElement("div", { className: clsx('akinon-page-heading', className) },
6
- React.createElement("div", { className: "akinon-page-heading__content" },
7
- React.createElement("h1", { className: "akinon-page-heading__title" }, title),
8
- description && (React.createElement("p", { className: "akinon-page-heading__description" }, description))),
9
- actions && React.createElement("div", { className: "akinon-page-heading__actions" }, actions)));
8
+ return (React.createElement(Flex, { justify: "space-between", align: "flex-start", className: className, style: {
9
+ padding: '18px 30px',
10
+ borderBlockEnd: 'solid 1px var(--color-gray-900)'
11
+ } },
12
+ React.createElement(Space, { direction: "vertical", size: 4 },
13
+ React.createElement(Typography.Title, { level: 4, style: { margin: 0 } }, title),
14
+ description && (React.createElement(Typography.Paragraph, { type: "secondary", style: { margin: 0, fontSize: 10 } }, description))),
15
+ actions && React.createElement(Space, null, actions)));
10
16
  };
@@ -3,14 +3,17 @@ export interface PageHeadingProps {
3
3
  * The title of the PageHeading.
4
4
  */
5
5
  title: string;
6
+
6
7
  /**
7
8
  * The description of the PageHeading.
8
9
  */
9
10
  description?: string;
11
+
10
12
  /**
11
13
  * The action items of the PageHeading.
12
14
  */
13
- actions?: ReactNode;
15
+ actions?: React.ReactNode;
16
+
14
17
  /**
15
18
  * The additional css class
16
19
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/ui-layout",
3
- "version": "0.6.0",
3
+ "version": "1.0.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/esm/index.js",
@@ -9,16 +9,19 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "antd": "5.17.0",
12
+ "antd": "5.22.6",
13
13
  "clsx": "^2.0.0"
14
14
  },
15
15
  "devDependencies": {
16
16
  "clean-package": "2.2.0",
17
17
  "copyfiles": "^2.4.1",
18
18
  "rimraf": "^5.0.5",
19
- "typescript": "^5.2.2",
20
- "@akinon/typescript-config": "0.4.0",
21
- "@akinon/ui-theme": "0.7.0"
19
+ "typescript": "*",
20
+ "@akinon/ui-theme": "1.0.1",
21
+ "@akinon/icons": "1.0.1",
22
+ "@akinon/ui-typography": "1.0.1",
23
+ "@akinon/typescript-config": "1.0.1",
24
+ "@akinon/utils": "1.0.1"
22
25
  },
23
26
  "peerDependencies": {
24
27
  "react": ">=18",