@akinon/ui-layout 0.5.0 → 0.6.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.
@@ -0,0 +1,47 @@
1
+ export type FlexProps = Omit<AntFlexProps, 'prefixCls' | 'style' | 'styles'>;
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ export interface AntFlexProps<P = Record<PropertyKey, any>>
5
+ extends React.HTMLAttributes<HTMLElement> {
6
+ prefixCls?: string;
7
+ /**
8
+ * ClassName on the root element
9
+ */
10
+ rootClassName?: string;
11
+ /**
12
+ * Is direction of the flex vertical, use <code>flex-direction: column</code>
13
+ */
14
+ vertical?: boolean;
15
+ /**
16
+ * Set whether the element is displayed in a single line or in multiple lines
17
+ */
18
+ wrap?: boolean | React.CSSProperties['flexWrap'];
19
+ /**
20
+ * Sets the alignment of elements in the direction of the main axis
21
+ */
22
+ justify?: React.CSSProperties['justifyContent'];
23
+ /**
24
+ * Sets the alignment of elements in the direction of the cross axis
25
+ */
26
+ align?: React.CSSProperties['alignItems'];
27
+ /**
28
+ * Flex CSS shorthand properties
29
+ */
30
+ flex?: React.CSSProperties['flex'];
31
+ /**
32
+ * Sets the gap between grids
33
+ */
34
+ gap?: React.CSSProperties['gap'] | SizeType;
35
+ children: React.ReactNode;
36
+ /**
37
+ * Custom element type
38
+ */
39
+ component?: CustomComponent<P>;
40
+ }
41
+
42
+ type SizeType = 'small' | 'middle' | 'large' | undefined;
43
+
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+ type CustomComponent<P = Record<PropertyKey, any>> =
46
+ | React.ComponentType<P>
47
+ | string;
@@ -0,0 +1,123 @@
1
+ export type RowProps = Omit<AntRowProps, 'prefixCls' | 'style' | 'styles'>;
2
+
3
+ export type ColProps = Omit<AntColProps, 'prefixCls' | 'style' | 'styles'>;
4
+
5
+ type ColSpanType = number | string;
6
+
7
+ type FlexType = number | LiteralUnion<'none' | 'auto'>;
8
+
9
+ type LiteralUnion<T extends string> = T | (string & {});
10
+
11
+ export interface ColSize {
12
+ flex?: FlexType;
13
+ span?: number | string;
14
+ order?: number | string;
15
+ offset?: number | string;
16
+ push?: number | string;
17
+ pull?: number | string;
18
+ }
19
+
20
+ export interface AntColProps extends React.HTMLAttributes<HTMLDivElement> {
21
+ /**
22
+ * Flex layout style
23
+ */
24
+ flex?: FlexType;
25
+ /**
26
+ * Raster number of cells to occupy, 0 corresponds to display: none
27
+ */
28
+ span?: number | string;
29
+ /**
30
+ * Raster order
31
+ */
32
+ order?: number | string;
33
+ /**
34
+ * The number of cells to offset Col from the left
35
+ */
36
+ offset?: number | string;
37
+ /**
38
+ * The number of cells that raster is moved to the right
39
+ */
40
+ push?: number | string;
41
+ /**
42
+ * The number of cells that raster is moved to the left
43
+ */
44
+ pull?: number | string;
45
+ /**
46
+ * screen < 576px and also default setting, could be a span value or an object containing above props
47
+ */
48
+ xs?: number | string | ColSize;
49
+ /**
50
+ * screen ≥ 576px, could be a span value or an object containing above props
51
+ */
52
+ sm?: number | string | ColSize;
53
+ /**
54
+ * screen ≥ 768px, could be a span value or an object containing above props
55
+ */
56
+ md?: number | string | ColSize;
57
+ /**
58
+ * screen ≥ 992px, could be a span value or an object containing above props
59
+ */
60
+ lg?: number | string | ColSize;
61
+ /**
62
+ * screen ≥ 1200px, could be a span value or an object containing above props
63
+ */
64
+ xl?: number | string | ColSize;
65
+ /**
66
+ * screen ≥ 1600px, could be a span value or an object containing above props
67
+ */
68
+ xxl?: number | string | ColSize;
69
+ prefixCls?: string;
70
+ }
71
+
72
+ export declare const Col: React.ForwardRefExoticComponent<
73
+ ColProps & React.RefAttributes<HTMLDivElement>
74
+ >;
75
+
76
+ type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
77
+
78
+ declare const RowAligns: readonly ['top', 'middle', 'bottom', 'stretch'];
79
+
80
+ declare const RowJustify: readonly [
81
+ 'start',
82
+ 'end',
83
+ 'center',
84
+ 'space-around',
85
+ 'space-between',
86
+ 'space-evenly'
87
+ ];
88
+
89
+ type Responsive = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
90
+
91
+ type ResponsiveLike<T> = {
92
+ [key in Responsive]?: T;
93
+ };
94
+
95
+ export type Gutter = number | undefined | Partial<Record<Breakpoint, number>>;
96
+
97
+ type ResponsiveAligns = ResponsiveLike<(typeof RowAligns)[number]>;
98
+
99
+ type ResponsiveJustify = ResponsiveLike<(typeof RowJustify)[number]>;
100
+
101
+ export interface AntRowProps extends React.HTMLAttributes<HTMLDivElement> {
102
+ /**
103
+ * Spacing between grids, could be a number or a object like { xs: 8, sm: 16, md: 24}. Or you can use array to make horizontal and vertical spacing work at the same time <code>[horizontal, vertical]</code>
104
+ */
105
+ gutter?: Gutter | [Gutter, Gutter];
106
+ /**
107
+ * Vertical alignment
108
+ */
109
+ align?: 'top' | 'middle' | 'bottom' | 'stretch' | ResponsiveAligns;
110
+ /**
111
+ * Horizontal arrangement
112
+ */
113
+ justify?: (typeof RowJustify)[number] | ResponsiveJustify;
114
+ prefixCls?: string;
115
+ /**
116
+ * Auto wrap line
117
+ */
118
+ wrap?: boolean;
119
+ }
120
+
121
+ export declare const Row: React.ForwardRefExoticComponent<
122
+ RowProps & React.RefAttributes<HTMLDivElement>
123
+ >;
@@ -0,0 +1,14 @@
1
+ export type ContentProps = Omit<
2
+ AntContentProps,
3
+ 'prefixCls' | 'suffixCls' | 'style' | 'styles'
4
+ >;
5
+
6
+ export type AntContentProps = AntContentBasicProps &
7
+ React.RefAttributes<HTMLElement>;
8
+
9
+ interface AntContentBasicProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ prefixCls?: string;
11
+ suffixCls?: string;
12
+ rootClassName?: string;
13
+ hasSider?: boolean;
14
+ }
@@ -0,0 +1,3 @@
1
+ .akinon-layout-footer {
2
+ text-align: center;
3
+ }
@@ -0,0 +1,15 @@
1
+ export type FooterProps = Omit<
2
+ AntFooterProps,
3
+ 'prefixCls' | 'suffixCls' | 'style' | 'styles'
4
+ >;
5
+
6
+ export type AntFooterProps = AntFooterBasicProps &
7
+ React.RefAttributes<HTMLElement>;
8
+
9
+ interface AntFooterBasicProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ prefixCls?: string;
11
+ suffixCls?: string;
12
+ rootClassName?: string;
13
+ hasSider?: boolean;
14
+ children: React.ReactNode;
15
+ }
@@ -0,0 +1,12 @@
1
+ .akinon-layout-header {
2
+ padding-inline: 1rem;
3
+ height: 3.5rem;
4
+ border-bottom: 1px solid var(--color-gray-900);
5
+ display: flex;
6
+ align-items: center;
7
+ justify-content: space-between;
8
+ line-height: unset;
9
+ position: sticky;
10
+ top: 0;
11
+ z-index: 999;
12
+ }
@@ -0,0 +1,15 @@
1
+ export type HeaderProps = Omit<
2
+ AntHeaderProps,
3
+ 'prefixCls' | 'suffixCls' | 'style' | 'styles'
4
+ >;
5
+
6
+ export type AntHeaderProps = AntHeaderBasicProps &
7
+ React.RefAttributes<HTMLElement>;
8
+
9
+ interface AntHeaderBasicProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ prefixCls?: string;
11
+ suffixCls?: string;
12
+ rootClassName?: string;
13
+ hasSider?: boolean;
14
+ children: React.ReactNode;
15
+ }
@@ -0,0 +1,28 @@
1
+ .akinon-layout-sider {
2
+ position: sticky;
3
+ top: 0;
4
+ height: 100vh;
5
+ overflow-y: auto;
6
+ }
7
+
8
+ .akinon-layout-sider.left {
9
+ inset-inline-start: 0;
10
+ }
11
+
12
+ .akinon-layout-sider.right {
13
+ inset-inline-end: 0;
14
+ }
15
+
16
+ .akinon-layout-sider .logo-container {
17
+ display: flex;
18
+ flex-direction: row;
19
+ justify-content: center;
20
+ align-items: center;
21
+ height: 3.5rem;
22
+ gap: 0.8rem;
23
+ /* border-bottom: 1px solid var(--color-gray-900); */
24
+ }
25
+
26
+ .akinon-layout-sider .logo-container.collapsed .brand-image {
27
+ display: none;
28
+ }
@@ -0,0 +1,74 @@
1
+ // TODO integrate with antd menu types
2
+ export type LeftSiderItem = {
3
+ key: string;
4
+ label: string;
5
+ icon?: React.ReactNode;
6
+ className?: string;
7
+ onClick?: () => void;
8
+ children?: LeftSiderItem[];
9
+ disabled?: boolean;
10
+ };
11
+
12
+ export type SiderProps = Omit<AntSiderProps, 'prefixCls' | 'style' | 'styles'>;
13
+
14
+ export interface AntSiderProps extends React.HTMLAttributes<HTMLDivElement> {
15
+ prefixCls?: string;
16
+ /**
17
+ * Whether can be collapsed
18
+ */
19
+ collapsible?: boolean;
20
+ /**
21
+ * To set the current status
22
+ */
23
+ collapsed?: boolean;
24
+ /**
25
+ * To set the initial status
26
+ */
27
+ defaultCollapsed?: boolean;
28
+ /**
29
+ * Reverse direction of arrow, for a sider that expands from the right
30
+ */
31
+ reverseArrow?: boolean;
32
+ /**
33
+ * The callback function, executed by clicking the trigger or activating the responsive layout
34
+ */
35
+ onCollapse?: (collapsed: boolean, type: CollapseType) => void;
36
+ /**
37
+ * To customize the styles of the special trigger that appears when <code>collapsedWidth</code> is 0
38
+ */
39
+ zeroWidthTriggerStyle?: React.CSSProperties;
40
+ /**
41
+ * Specify the customized trigger, set to null to hide the trigger
42
+ */
43
+ trigger?: React.ReactNode;
44
+ /**
45
+ * Width of the sidebar
46
+ */
47
+ width?: number | string;
48
+ /**
49
+ * Width of the collapsed sidebar, by setting to 0 a special trigger will appear
50
+ */
51
+ collapsedWidth?: number | string;
52
+ /**
53
+ * Breakpoints of the responsive layout
54
+ */
55
+ breakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
56
+ /**
57
+ * Color theme of the sidebar
58
+ */
59
+ theme?: SiderTheme;
60
+ /**
61
+ * The callback function, executed when breakpoints changed
62
+ */
63
+ onBreakpoint?: (broken: boolean) => void;
64
+ iconUrl?: string;
65
+ brandImageUrl?: string;
66
+ /**
67
+ * The additional css class
68
+ */
69
+ className?: string;
70
+ }
71
+
72
+ type SiderTheme = 'light' | 'dark';
73
+
74
+ type CollapseType = 'clickTrigger' | 'responsive';
@@ -0,0 +1,22 @@
1
+ export type LayoutProps = Omit<
2
+ AntLayoutProps,
3
+ 'prefixCls' | 'suffixCls' | 'style' | 'styles'
4
+ >;
5
+
6
+ export interface AntLayoutProps extends React.HTMLAttributes<HTMLDivElement> {
7
+ prefixCls?: string;
8
+ suffixCls?: string;
9
+ /**
10
+ * ClassName on the root element
11
+ */
12
+ rootClassName?: string;
13
+ /**
14
+ * Whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
15
+ */
16
+ hasSider?: boolean;
17
+ children: React.ReactNode;
18
+ /**
19
+ * The additional css class
20
+ */
21
+ className?: string;
22
+ }
@@ -13,45 +13,45 @@
13
13
  align-items: center;
14
14
  justify-content: center;
15
15
  width: 180px;
16
+ }
16
17
 
17
- /* Overriding SVG so you will not have to pass size prop to Icon component. */
18
- svg {
19
- width: 28px !important;
20
- height: 28px !important;
21
- }
18
+ /* Overriding SVG so you will not have to pass size prop to Icon component. */
19
+ .nav-card__icon svg {
20
+ width: 28px !important;
21
+ height: 28px !important;
22
+ }
22
23
 
23
- /* Change bg color based on the class set on .nav-card */
24
- &:is(.nav-card-akinon *) {
25
- background-color: var(--color-akinon-500);
26
- }
24
+ /* Change bg color based on the class set on .nav-card */
25
+ .nav-card-akinon .nav-card__icon {
26
+ background-color: var(--color-akinon-500);
27
+ }
27
28
 
28
- &:is(.nav-card-azure *) {
29
- background-color: var(--color-azure-500);
30
- }
29
+ .nav-card-azure .nav-card__icon {
30
+ background-color: var(--color-azure-500);
31
+ }
31
32
 
32
- &:is(.nav-card-blue *) {
33
- background-color: var(--color-blue-500);
34
- }
33
+ .nav-card-blue .nav-card__icon {
34
+ background-color: var(--color-blue-500);
35
+ }
35
36
 
36
- &:is(.nav-card-orange *) {
37
- background-color: var(--color-orange-500);
38
- }
37
+ .nav-card-orange .nav-card__icon {
38
+ background-color: var(--color-orange-500);
39
+ }
39
40
 
40
- &:is(.nav-card-red *) {
41
- background-color: var(--color-red-500);
42
- }
41
+ .nav-card-red .nav-card__icon {
42
+ background-color: var(--color-red-500);
43
+ }
43
44
 
44
- &:is(.nav-card-green *) {
45
- background-color: var(--color-green-500);
46
- }
45
+ .nav-card-green .nav-card__icon {
46
+ background-color: var(--color-green-500);
47
+ }
47
48
 
48
- &:is(.nav-card-pink *) {
49
- background-color: var(--color-pink-500);
50
- }
49
+ .nav-card-pink .nav-card__icon {
50
+ background-color: var(--color-pink-500);
51
+ }
51
52
 
52
- &:is(.nav-card-purple *) {
53
- background-color: var(--color-purple-500);
54
- }
53
+ .nav-card-purple .nav-card__icon {
54
+ background-color: var(--color-purple-500);
55
55
  }
56
56
 
57
57
  .nav-card__content {
@@ -0,0 +1,32 @@
1
+ export type NavCardColorVariant =
2
+ | 'akinon'
3
+ | 'azure'
4
+ | 'blue'
5
+ | 'orange'
6
+ | 'red'
7
+ | 'green'
8
+ | 'pink'
9
+ | 'purple';
10
+
11
+ export interface NavCardProps {
12
+ /**
13
+ * The title of the NavCard.
14
+ */
15
+ title: string;
16
+ /**
17
+ * The description of the NavCard.
18
+ */
19
+ description: string;
20
+ /**
21
+ * The icon of the NavCard.
22
+ */
23
+ icon?: React.ReactNode;
24
+ /**
25
+ * The color variant of the NavCard.
26
+ */
27
+ variant?: NavCardColorVariant;
28
+ /**
29
+ * The additional css class
30
+ */
31
+ className?: string;
32
+ }
@@ -0,0 +1,3 @@
1
+ export interface PageContentProps extends React.HTMLAttributes<HTMLDivElement> {
2
+ children: ReactNode;
3
+ }
@@ -0,0 +1,18 @@
1
+ export interface PageHeadingProps {
2
+ /**
3
+ * The title of the PageHeading.
4
+ */
5
+ title: string;
6
+ /**
7
+ * The description of the PageHeading.
8
+ */
9
+ description?: string;
10
+ /**
11
+ * The action items of the PageHeading.
12
+ */
13
+ actions?: ReactNode;
14
+ /**
15
+ * The additional css class
16
+ */
17
+ className?: string;
18
+ }
@@ -0,0 +1,12 @@
1
+ import { Layout } from './Layout';
2
+ import { Content } from './Layout/Content';
3
+ import { Footer } from './Layout/Footer';
4
+ import { Header } from './Layout/Header';
5
+ import { Sider } from './Layout/Sider';
6
+
7
+ export type LayoutType = typeof Layout & {
8
+ Header: typeof Header;
9
+ Footer: typeof Footer;
10
+ Content: typeof Content;
11
+ Sider: typeof Sider;
12
+ };
@@ -0,0 +1,47 @@
1
+ export type FlexProps = Omit<AntFlexProps, 'prefixCls' | 'style' | 'styles'>;
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ export interface AntFlexProps<P = Record<PropertyKey, any>>
5
+ extends React.HTMLAttributes<HTMLElement> {
6
+ prefixCls?: string;
7
+ /**
8
+ * ClassName on the root element
9
+ */
10
+ rootClassName?: string;
11
+ /**
12
+ * Is direction of the flex vertical, use <code>flex-direction: column</code>
13
+ */
14
+ vertical?: boolean;
15
+ /**
16
+ * Set whether the element is displayed in a single line or in multiple lines
17
+ */
18
+ wrap?: boolean | React.CSSProperties['flexWrap'];
19
+ /**
20
+ * Sets the alignment of elements in the direction of the main axis
21
+ */
22
+ justify?: React.CSSProperties['justifyContent'];
23
+ /**
24
+ * Sets the alignment of elements in the direction of the cross axis
25
+ */
26
+ align?: React.CSSProperties['alignItems'];
27
+ /**
28
+ * Flex CSS shorthand properties
29
+ */
30
+ flex?: React.CSSProperties['flex'];
31
+ /**
32
+ * Sets the gap between grids
33
+ */
34
+ gap?: React.CSSProperties['gap'] | SizeType;
35
+ children: React.ReactNode;
36
+ /**
37
+ * Custom element type
38
+ */
39
+ component?: CustomComponent<P>;
40
+ }
41
+
42
+ type SizeType = 'small' | 'middle' | 'large' | undefined;
43
+
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+ type CustomComponent<P = Record<PropertyKey, any>> =
46
+ | React.ComponentType<P>
47
+ | string;
@@ -0,0 +1,123 @@
1
+ export type RowProps = Omit<AntRowProps, 'prefixCls' | 'style' | 'styles'>;
2
+
3
+ export type ColProps = Omit<AntColProps, 'prefixCls' | 'style' | 'styles'>;
4
+
5
+ type ColSpanType = number | string;
6
+
7
+ type FlexType = number | LiteralUnion<'none' | 'auto'>;
8
+
9
+ type LiteralUnion<T extends string> = T | (string & {});
10
+
11
+ export interface ColSize {
12
+ flex?: FlexType;
13
+ span?: number | string;
14
+ order?: number | string;
15
+ offset?: number | string;
16
+ push?: number | string;
17
+ pull?: number | string;
18
+ }
19
+
20
+ export interface AntColProps extends React.HTMLAttributes<HTMLDivElement> {
21
+ /**
22
+ * Flex layout style
23
+ */
24
+ flex?: FlexType;
25
+ /**
26
+ * Raster number of cells to occupy, 0 corresponds to display: none
27
+ */
28
+ span?: number | string;
29
+ /**
30
+ * Raster order
31
+ */
32
+ order?: number | string;
33
+ /**
34
+ * The number of cells to offset Col from the left
35
+ */
36
+ offset?: number | string;
37
+ /**
38
+ * The number of cells that raster is moved to the right
39
+ */
40
+ push?: number | string;
41
+ /**
42
+ * The number of cells that raster is moved to the left
43
+ */
44
+ pull?: number | string;
45
+ /**
46
+ * screen < 576px and also default setting, could be a span value or an object containing above props
47
+ */
48
+ xs?: number | string | ColSize;
49
+ /**
50
+ * screen ≥ 576px, could be a span value or an object containing above props
51
+ */
52
+ sm?: number | string | ColSize;
53
+ /**
54
+ * screen ≥ 768px, could be a span value or an object containing above props
55
+ */
56
+ md?: number | string | ColSize;
57
+ /**
58
+ * screen ≥ 992px, could be a span value or an object containing above props
59
+ */
60
+ lg?: number | string | ColSize;
61
+ /**
62
+ * screen ≥ 1200px, could be a span value or an object containing above props
63
+ */
64
+ xl?: number | string | ColSize;
65
+ /**
66
+ * screen ≥ 1600px, could be a span value or an object containing above props
67
+ */
68
+ xxl?: number | string | ColSize;
69
+ prefixCls?: string;
70
+ }
71
+
72
+ export declare const Col: React.ForwardRefExoticComponent<
73
+ ColProps & React.RefAttributes<HTMLDivElement>
74
+ >;
75
+
76
+ type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
77
+
78
+ declare const RowAligns: readonly ['top', 'middle', 'bottom', 'stretch'];
79
+
80
+ declare const RowJustify: readonly [
81
+ 'start',
82
+ 'end',
83
+ 'center',
84
+ 'space-around',
85
+ 'space-between',
86
+ 'space-evenly'
87
+ ];
88
+
89
+ type Responsive = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
90
+
91
+ type ResponsiveLike<T> = {
92
+ [key in Responsive]?: T;
93
+ };
94
+
95
+ export type Gutter = number | undefined | Partial<Record<Breakpoint, number>>;
96
+
97
+ type ResponsiveAligns = ResponsiveLike<(typeof RowAligns)[number]>;
98
+
99
+ type ResponsiveJustify = ResponsiveLike<(typeof RowJustify)[number]>;
100
+
101
+ export interface AntRowProps extends React.HTMLAttributes<HTMLDivElement> {
102
+ /**
103
+ * Spacing between grids, could be a number or a object like { xs: 8, sm: 16, md: 24}. Or you can use array to make horizontal and vertical spacing work at the same time <code>[horizontal, vertical]</code>
104
+ */
105
+ gutter?: Gutter | [Gutter, Gutter];
106
+ /**
107
+ * Vertical alignment
108
+ */
109
+ align?: 'top' | 'middle' | 'bottom' | 'stretch' | ResponsiveAligns;
110
+ /**
111
+ * Horizontal arrangement
112
+ */
113
+ justify?: (typeof RowJustify)[number] | ResponsiveJustify;
114
+ prefixCls?: string;
115
+ /**
116
+ * Auto wrap line
117
+ */
118
+ wrap?: boolean;
119
+ }
120
+
121
+ export declare const Row: React.ForwardRefExoticComponent<
122
+ RowProps & React.RefAttributes<HTMLDivElement>
123
+ >;
@@ -0,0 +1,14 @@
1
+ export type ContentProps = Omit<
2
+ AntContentProps,
3
+ 'prefixCls' | 'suffixCls' | 'style' | 'styles'
4
+ >;
5
+
6
+ export type AntContentProps = AntContentBasicProps &
7
+ React.RefAttributes<HTMLElement>;
8
+
9
+ interface AntContentBasicProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ prefixCls?: string;
11
+ suffixCls?: string;
12
+ rootClassName?: string;
13
+ hasSider?: boolean;
14
+ }
@@ -0,0 +1,3 @@
1
+ .akinon-layout-footer {
2
+ text-align: center;
3
+ }
@@ -0,0 +1,15 @@
1
+ export type FooterProps = Omit<
2
+ AntFooterProps,
3
+ 'prefixCls' | 'suffixCls' | 'style' | 'styles'
4
+ >;
5
+
6
+ export type AntFooterProps = AntFooterBasicProps &
7
+ React.RefAttributes<HTMLElement>;
8
+
9
+ interface AntFooterBasicProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ prefixCls?: string;
11
+ suffixCls?: string;
12
+ rootClassName?: string;
13
+ hasSider?: boolean;
14
+ children: React.ReactNode;
15
+ }
@@ -0,0 +1,12 @@
1
+ .akinon-layout-header {
2
+ padding-inline: 1rem;
3
+ height: 3.5rem;
4
+ border-bottom: 1px solid var(--color-gray-900);
5
+ display: flex;
6
+ align-items: center;
7
+ justify-content: space-between;
8
+ line-height: unset;
9
+ position: sticky;
10
+ top: 0;
11
+ z-index: 999;
12
+ }
@@ -0,0 +1,15 @@
1
+ export type HeaderProps = Omit<
2
+ AntHeaderProps,
3
+ 'prefixCls' | 'suffixCls' | 'style' | 'styles'
4
+ >;
5
+
6
+ export type AntHeaderProps = AntHeaderBasicProps &
7
+ React.RefAttributes<HTMLElement>;
8
+
9
+ interface AntHeaderBasicProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ prefixCls?: string;
11
+ suffixCls?: string;
12
+ rootClassName?: string;
13
+ hasSider?: boolean;
14
+ children: React.ReactNode;
15
+ }
@@ -0,0 +1,28 @@
1
+ .akinon-layout-sider {
2
+ position: sticky;
3
+ top: 0;
4
+ height: 100vh;
5
+ overflow-y: auto;
6
+ }
7
+
8
+ .akinon-layout-sider.left {
9
+ inset-inline-start: 0;
10
+ }
11
+
12
+ .akinon-layout-sider.right {
13
+ inset-inline-end: 0;
14
+ }
15
+
16
+ .akinon-layout-sider .logo-container {
17
+ display: flex;
18
+ flex-direction: row;
19
+ justify-content: center;
20
+ align-items: center;
21
+ height: 3.5rem;
22
+ gap: 0.8rem;
23
+ /* border-bottom: 1px solid var(--color-gray-900); */
24
+ }
25
+
26
+ .akinon-layout-sider .logo-container.collapsed .brand-image {
27
+ display: none;
28
+ }
@@ -0,0 +1,74 @@
1
+ // TODO integrate with antd menu types
2
+ export type LeftSiderItem = {
3
+ key: string;
4
+ label: string;
5
+ icon?: React.ReactNode;
6
+ className?: string;
7
+ onClick?: () => void;
8
+ children?: LeftSiderItem[];
9
+ disabled?: boolean;
10
+ };
11
+
12
+ export type SiderProps = Omit<AntSiderProps, 'prefixCls' | 'style' | 'styles'>;
13
+
14
+ export interface AntSiderProps extends React.HTMLAttributes<HTMLDivElement> {
15
+ prefixCls?: string;
16
+ /**
17
+ * Whether can be collapsed
18
+ */
19
+ collapsible?: boolean;
20
+ /**
21
+ * To set the current status
22
+ */
23
+ collapsed?: boolean;
24
+ /**
25
+ * To set the initial status
26
+ */
27
+ defaultCollapsed?: boolean;
28
+ /**
29
+ * Reverse direction of arrow, for a sider that expands from the right
30
+ */
31
+ reverseArrow?: boolean;
32
+ /**
33
+ * The callback function, executed by clicking the trigger or activating the responsive layout
34
+ */
35
+ onCollapse?: (collapsed: boolean, type: CollapseType) => void;
36
+ /**
37
+ * To customize the styles of the special trigger that appears when <code>collapsedWidth</code> is 0
38
+ */
39
+ zeroWidthTriggerStyle?: React.CSSProperties;
40
+ /**
41
+ * Specify the customized trigger, set to null to hide the trigger
42
+ */
43
+ trigger?: React.ReactNode;
44
+ /**
45
+ * Width of the sidebar
46
+ */
47
+ width?: number | string;
48
+ /**
49
+ * Width of the collapsed sidebar, by setting to 0 a special trigger will appear
50
+ */
51
+ collapsedWidth?: number | string;
52
+ /**
53
+ * Breakpoints of the responsive layout
54
+ */
55
+ breakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
56
+ /**
57
+ * Color theme of the sidebar
58
+ */
59
+ theme?: SiderTheme;
60
+ /**
61
+ * The callback function, executed when breakpoints changed
62
+ */
63
+ onBreakpoint?: (broken: boolean) => void;
64
+ iconUrl?: string;
65
+ brandImageUrl?: string;
66
+ /**
67
+ * The additional css class
68
+ */
69
+ className?: string;
70
+ }
71
+
72
+ type SiderTheme = 'light' | 'dark';
73
+
74
+ type CollapseType = 'clickTrigger' | 'responsive';
@@ -0,0 +1,22 @@
1
+ export type LayoutProps = Omit<
2
+ AntLayoutProps,
3
+ 'prefixCls' | 'suffixCls' | 'style' | 'styles'
4
+ >;
5
+
6
+ export interface AntLayoutProps extends React.HTMLAttributes<HTMLDivElement> {
7
+ prefixCls?: string;
8
+ suffixCls?: string;
9
+ /**
10
+ * ClassName on the root element
11
+ */
12
+ rootClassName?: string;
13
+ /**
14
+ * Whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
15
+ */
16
+ hasSider?: boolean;
17
+ children: React.ReactNode;
18
+ /**
19
+ * The additional css class
20
+ */
21
+ className?: string;
22
+ }
@@ -13,45 +13,45 @@
13
13
  align-items: center;
14
14
  justify-content: center;
15
15
  width: 180px;
16
+ }
16
17
 
17
- /* Overriding SVG so you will not have to pass size prop to Icon component. */
18
- svg {
19
- width: 28px !important;
20
- height: 28px !important;
21
- }
18
+ /* Overriding SVG so you will not have to pass size prop to Icon component. */
19
+ .nav-card__icon svg {
20
+ width: 28px !important;
21
+ height: 28px !important;
22
+ }
22
23
 
23
- /* Change bg color based on the class set on .nav-card */
24
- &:is(.nav-card-akinon *) {
25
- background-color: var(--color-akinon-500);
26
- }
24
+ /* Change bg color based on the class set on .nav-card */
25
+ .nav-card-akinon .nav-card__icon {
26
+ background-color: var(--color-akinon-500);
27
+ }
27
28
 
28
- &:is(.nav-card-azure *) {
29
- background-color: var(--color-azure-500);
30
- }
29
+ .nav-card-azure .nav-card__icon {
30
+ background-color: var(--color-azure-500);
31
+ }
31
32
 
32
- &:is(.nav-card-blue *) {
33
- background-color: var(--color-blue-500);
34
- }
33
+ .nav-card-blue .nav-card__icon {
34
+ background-color: var(--color-blue-500);
35
+ }
35
36
 
36
- &:is(.nav-card-orange *) {
37
- background-color: var(--color-orange-500);
38
- }
37
+ .nav-card-orange .nav-card__icon {
38
+ background-color: var(--color-orange-500);
39
+ }
39
40
 
40
- &:is(.nav-card-red *) {
41
- background-color: var(--color-red-500);
42
- }
41
+ .nav-card-red .nav-card__icon {
42
+ background-color: var(--color-red-500);
43
+ }
43
44
 
44
- &:is(.nav-card-green *) {
45
- background-color: var(--color-green-500);
46
- }
45
+ .nav-card-green .nav-card__icon {
46
+ background-color: var(--color-green-500);
47
+ }
47
48
 
48
- &:is(.nav-card-pink *) {
49
- background-color: var(--color-pink-500);
50
- }
49
+ .nav-card-pink .nav-card__icon {
50
+ background-color: var(--color-pink-500);
51
+ }
51
52
 
52
- &:is(.nav-card-purple *) {
53
- background-color: var(--color-purple-500);
54
- }
53
+ .nav-card-purple .nav-card__icon {
54
+ background-color: var(--color-purple-500);
55
55
  }
56
56
 
57
57
  .nav-card__content {
@@ -0,0 +1,32 @@
1
+ export type NavCardColorVariant =
2
+ | 'akinon'
3
+ | 'azure'
4
+ | 'blue'
5
+ | 'orange'
6
+ | 'red'
7
+ | 'green'
8
+ | 'pink'
9
+ | 'purple';
10
+
11
+ export interface NavCardProps {
12
+ /**
13
+ * The title of the NavCard.
14
+ */
15
+ title: string;
16
+ /**
17
+ * The description of the NavCard.
18
+ */
19
+ description: string;
20
+ /**
21
+ * The icon of the NavCard.
22
+ */
23
+ icon?: React.ReactNode;
24
+ /**
25
+ * The color variant of the NavCard.
26
+ */
27
+ variant?: NavCardColorVariant;
28
+ /**
29
+ * The additional css class
30
+ */
31
+ className?: string;
32
+ }
@@ -0,0 +1,3 @@
1
+ export interface PageContentProps extends React.HTMLAttributes<HTMLDivElement> {
2
+ children: ReactNode;
3
+ }
@@ -0,0 +1,18 @@
1
+ export interface PageHeadingProps {
2
+ /**
3
+ * The title of the PageHeading.
4
+ */
5
+ title: string;
6
+ /**
7
+ * The description of the PageHeading.
8
+ */
9
+ description?: string;
10
+ /**
11
+ * The action items of the PageHeading.
12
+ */
13
+ actions?: ReactNode;
14
+ /**
15
+ * The additional css class
16
+ */
17
+ className?: string;
18
+ }
@@ -0,0 +1,12 @@
1
+ import { Layout } from './Layout';
2
+ import { Content } from './Layout/Content';
3
+ import { Footer } from './Layout/Footer';
4
+ import { Header } from './Layout/Header';
5
+ import { Sider } from './Layout/Sider';
6
+
7
+ export type LayoutType = typeof Layout & {
8
+ Header: typeof Header;
9
+ Footer: typeof Footer;
10
+ Content: typeof Content;
11
+ Sider: typeof Sider;
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/ui-layout",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/esm/index.js",
@@ -17,8 +17,8 @@
17
17
  "copyfiles": "^2.4.1",
18
18
  "rimraf": "^5.0.5",
19
19
  "typescript": "^5.2.2",
20
- "@akinon/typescript-config": "0.3.0",
21
- "@akinon/ui-theme": "0.6.0"
20
+ "@akinon/typescript-config": "0.4.0",
21
+ "@akinon/ui-theme": "0.7.0"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=18",
@@ -38,7 +38,7 @@
38
38
  "build": "pnpm run build:esm && pnpm run build:commonjs && pnpm run copy:files",
39
39
  "build:esm": "tsc --outDir dist/esm",
40
40
  "build:commonjs": "tsc --module commonjs --outDir dist/cjs",
41
- "copy:files": "copyfiles -u 1 src/**/*.css dist/esm && copyfiles -u 1 src/**/*.css dist/cjs",
41
+ "copy:files": "copyfiles -u 1 \"src/**/*.!(ts|tsx)\" dist/esm && copyfiles -u 1 \"src/**/*.!(ts|tsx)\" dist/cjs",
42
42
  "clean": "rimraf dist/",
43
43
  "typecheck": "tsc --noEmit"
44
44
  }