react-align 2.0.3 → 2.1.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/index.d.ts +105 -6
- package/dist/react-align.mjs +1226 -0
- package/dist/react-align.umd.js +27 -0
- package/package.json +37 -50
- package/src/GridArea.tsx +57 -44
- package/src/GridItem.tsx +52 -51
- package/src/GridSection.tsx +11 -10
- package/src/GridWrapper.tsx +11 -9
- package/src/Icon/icons.ts +11 -11
- package/src/Icon/index.tsx +7 -34
- package/src/context.tsx +2 -2
- package/src/env.d.ts +2 -0
- package/src/grid.css +4 -7
- package/src/{index.tsx → index.ts} +0 -1
- package/dist/GridArea.d.ts +0 -18
- package/dist/GridItem.d.ts +0 -27
- package/dist/GridSection.d.ts +0 -14
- package/dist/GridWrapper.d.ts +0 -17
- package/dist/Icon/icons.d.ts +0 -14
- package/dist/Icon/index.d.ts +0 -12
- package/dist/context.d.ts +0 -14
- package/dist/index.js +0 -8
- package/dist/react-align.cjs.development.js +0 -640
- package/dist/react-align.cjs.development.js.map +0 -1
- package/dist/react-align.cjs.production.min.js +0 -2
- package/dist/react-align.cjs.production.min.js.map +0 -1
- package/dist/react-align.esm.js +0 -629
- package/dist/react-align.esm.js.map +0 -1
package/src/Icon/icons.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import HorizontalExtend from
|
|
2
|
-
import HorizontalNormal from
|
|
3
|
-
import VerticalExtend from
|
|
4
|
-
import VerticalNormal from
|
|
5
|
-
import MoveArrows from
|
|
6
|
-
import AlignStart from
|
|
7
|
-
import AlignCenter from
|
|
8
|
-
import AlignEnd from
|
|
9
|
-
import AlignStartV from
|
|
10
|
-
import AlignCenterV from
|
|
11
|
-
import AlignEndV from
|
|
1
|
+
import { ReactComponent as HorizontalExtend } from "./Icons/horizontalExtend.svg";
|
|
2
|
+
import { ReactComponent as HorizontalNormal } from "./Icons/horizontalNormal.svg";
|
|
3
|
+
import { ReactComponent as VerticalExtend } from "./Icons/verticalExtend.svg";
|
|
4
|
+
import { ReactComponent as VerticalNormal } from "./Icons/verticalNormal.svg";
|
|
5
|
+
import { ReactComponent as MoveArrows } from "./Icons/moveArrows.svg";
|
|
6
|
+
import { ReactComponent as AlignStart } from "./Icons/alignStart.svg";
|
|
7
|
+
import { ReactComponent as AlignCenter } from "./Icons/alignCenter.svg";
|
|
8
|
+
import { ReactComponent as AlignEnd } from "./Icons/alignEnd.svg";
|
|
9
|
+
import { ReactComponent as AlignStartV } from "./Icons/alignStartV.svg";
|
|
10
|
+
import { ReactComponent as AlignCenterV } from "./Icons/alignCenterV.svg";
|
|
11
|
+
import { ReactComponent as AlignEndV } from "./Icons/alignEndV.svg";
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
14
|
horizontalExtend: HorizontalExtend,
|
package/src/Icon/index.tsx
CHANGED
|
@@ -1,45 +1,18 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { css } from 'glamor';
|
|
1
|
+
import React from "react";
|
|
3
2
|
|
|
4
|
-
import Icons from
|
|
3
|
+
import Icons from "./icons";
|
|
5
4
|
|
|
6
|
-
export type
|
|
5
|
+
export type IconKeys = keyof typeof Icons;
|
|
7
6
|
|
|
8
7
|
export type IconProps = {
|
|
9
8
|
className?: string;
|
|
10
|
-
name: string |
|
|
11
|
-
size?: number;
|
|
12
|
-
style?: CSSProperties;
|
|
9
|
+
name: string | IconKeys;
|
|
13
10
|
onClick?: () => void;
|
|
14
11
|
};
|
|
15
12
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
width: size || 24 + 'px',
|
|
20
|
-
height: size || 24 + 'px',
|
|
21
|
-
' svg': {
|
|
22
|
-
height: size || 24 + 'px',
|
|
23
|
-
width: size || 24 + 'px',
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const Icon: React.FC<IconProps> = ({
|
|
28
|
-
className,
|
|
29
|
-
name,
|
|
30
|
-
size,
|
|
31
|
-
style,
|
|
32
|
-
onClick,
|
|
33
|
-
}) => {
|
|
34
|
-
const LocalIconComponent = Icons[name as Icons];
|
|
35
|
-
return (
|
|
36
|
-
<LocalIconComponent
|
|
37
|
-
className={className}
|
|
38
|
-
{...IconStyles(size)}
|
|
39
|
-
style={style}
|
|
40
|
-
onClick={onClick}
|
|
41
|
-
/>
|
|
42
|
-
);
|
|
13
|
+
const Icon: React.FC<IconProps> = ({ className, name, onClick }) => {
|
|
14
|
+
const LocalIconComponent = Icons[name as IconKeys];
|
|
15
|
+
return <LocalIconComponent className={className} onClick={onClick} />;
|
|
43
16
|
};
|
|
44
17
|
|
|
45
18
|
export default Icon;
|
package/src/context.tsx
CHANGED
package/src/env.d.ts
ADDED
package/src/grid.css
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
.area {
|
|
15
15
|
display: flex;
|
|
16
|
-
border:
|
|
16
|
+
border: 0 solid transparent;
|
|
17
17
|
box-sizing: border-box;
|
|
18
18
|
border-radius: 8px;
|
|
19
19
|
position: relative;
|
|
@@ -29,12 +29,9 @@
|
|
|
29
29
|
|
|
30
30
|
.item {
|
|
31
31
|
position: relative;
|
|
32
|
-
border:
|
|
33
|
-
box-sizing: border-box;
|
|
32
|
+
border: 0 solid transparent;
|
|
34
33
|
margin: 6px;
|
|
35
34
|
border-radius: 6px;
|
|
36
|
-
min-width: 70px;
|
|
37
|
-
min-height: 40px;
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
.stretch {
|
|
@@ -66,8 +63,8 @@
|
|
|
66
63
|
position: absolute;
|
|
67
64
|
top: 0;
|
|
68
65
|
left: 0;
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 100%;
|
|
71
68
|
box-sizing: border-box;
|
|
72
69
|
background: rgba(0,0,0,0.6);
|
|
73
70
|
}
|
package/dist/GridArea.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, PropsWithChildren } from 'react';
|
|
2
|
-
import './grid.css';
|
|
3
|
-
export declare type Alignment = 'start' | 'centered' | 'end';
|
|
4
|
-
export declare type AreaProps = {
|
|
5
|
-
id: string;
|
|
6
|
-
className?: string;
|
|
7
|
-
vertical?: boolean;
|
|
8
|
-
stretch?: boolean;
|
|
9
|
-
end?: boolean;
|
|
10
|
-
align?: Alignment;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
/** Extra customizable parts only for the really picky */
|
|
13
|
-
style?: CSSProperties;
|
|
14
|
-
editorStyle?: CSSProperties;
|
|
15
|
-
iconColor?: string;
|
|
16
|
-
onAlignChange?: (alignment: Alignment) => void;
|
|
17
|
-
};
|
|
18
|
-
export default function GridArea({ id, className, vertical, stretch, end, disabled, align, onAlignChange, children, style, editorStyle, iconColor, }: PropsWithChildren<AreaProps>): JSX.Element;
|
package/dist/GridItem.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import './grid.css';
|
|
3
|
-
export declare type ItemProps = {
|
|
4
|
-
className?: string;
|
|
5
|
-
id: string;
|
|
6
|
-
index: number;
|
|
7
|
-
extendable?: boolean;
|
|
8
|
-
extended?: boolean;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
onExtend?: (extended: boolean) => void;
|
|
11
|
-
children?: ReactNode | ((context: {
|
|
12
|
-
id: string;
|
|
13
|
-
editing: boolean;
|
|
14
|
-
isDragging: boolean;
|
|
15
|
-
isHovered: boolean;
|
|
16
|
-
extended: boolean;
|
|
17
|
-
extendable: boolean;
|
|
18
|
-
disabled: boolean;
|
|
19
|
-
index: number;
|
|
20
|
-
}) => ReactNode);
|
|
21
|
-
/** Extra customizable parts only for the really picky */
|
|
22
|
-
style?: CSSProperties;
|
|
23
|
-
editorStyle?: CSSProperties;
|
|
24
|
-
iconSize?: number;
|
|
25
|
-
iconColor?: string;
|
|
26
|
-
};
|
|
27
|
-
export default function GridItem({ className, children, id, index, extendable, extended, disabled, style, editorStyle, iconSize, iconColor, ...props }: ItemProps): JSX.Element;
|
package/dist/GridSection.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
2
|
-
import './grid.css';
|
|
3
|
-
export declare type GridSectionProps = {
|
|
4
|
-
className?: string;
|
|
5
|
-
horizontal?: boolean;
|
|
6
|
-
stretch?: boolean;
|
|
7
|
-
fixedWidth?: number;
|
|
8
|
-
fixedHeight?: number;
|
|
9
|
-
/** Extra customizable parts only for the really picky */
|
|
10
|
-
style?: CSSProperties;
|
|
11
|
-
editorStyle?: CSSProperties;
|
|
12
|
-
};
|
|
13
|
-
declare const GridSection: React.FC<GridSectionProps>;
|
|
14
|
-
export default GridSection;
|
package/dist/GridWrapper.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
2
|
-
import { Alignment } from './GridArea';
|
|
3
|
-
import './grid.css';
|
|
4
|
-
export declare type GridWrapperProps = {
|
|
5
|
-
className?: string;
|
|
6
|
-
editing?: boolean;
|
|
7
|
-
vertical?: boolean;
|
|
8
|
-
stretch?: boolean;
|
|
9
|
-
/** Extra customizable parts only for the really picky */
|
|
10
|
-
style?: CSSProperties;
|
|
11
|
-
editorStyle?: CSSProperties;
|
|
12
|
-
onMove?: (id: string, destAreaId: string, destIndex: number, prevAreaId: string, prevIndex: number) => void;
|
|
13
|
-
onAlignChange?: (areaId: string, align: Alignment) => void;
|
|
14
|
-
onExtend?: (id: string, extended: boolean) => void;
|
|
15
|
-
};
|
|
16
|
-
declare const GridWrapper: React.FC<GridWrapperProps>;
|
|
17
|
-
export default GridWrapper;
|
package/dist/Icon/icons.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
horizontalExtend: any;
|
|
3
|
-
horizontalNormal: any;
|
|
4
|
-
verticalExtend: any;
|
|
5
|
-
verticalNormal: any;
|
|
6
|
-
moveArrows: any;
|
|
7
|
-
alignStart: any;
|
|
8
|
-
alignCenter: any;
|
|
9
|
-
alignEnd: any;
|
|
10
|
-
alignStartV: any;
|
|
11
|
-
alignCenterV: any;
|
|
12
|
-
alignEndV: any;
|
|
13
|
-
};
|
|
14
|
-
export default _default;
|
package/dist/Icon/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
2
|
-
import Icons from './icons';
|
|
3
|
-
export declare type Icons = keyof typeof Icons;
|
|
4
|
-
export declare type IconProps = {
|
|
5
|
-
className?: string;
|
|
6
|
-
name: string | Icons;
|
|
7
|
-
size?: number;
|
|
8
|
-
style?: CSSProperties;
|
|
9
|
-
onClick?: () => void;
|
|
10
|
-
};
|
|
11
|
-
declare const Icon: React.FC<IconProps>;
|
|
12
|
-
export default Icon;
|
package/dist/context.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Alignment } from '.';
|
|
3
|
-
export declare const Context: import("react").Context<{
|
|
4
|
-
editing: boolean;
|
|
5
|
-
isDragging: boolean;
|
|
6
|
-
onAlignChange?: ((areaId: string, align: Alignment) => void) | undefined;
|
|
7
|
-
onExtend?: ((id: string, extended: boolean) => void) | undefined;
|
|
8
|
-
}>;
|
|
9
|
-
export declare const useAlignContext: () => {
|
|
10
|
-
editing: boolean;
|
|
11
|
-
isDragging: boolean;
|
|
12
|
-
onAlignChange?: ((areaId: string, align: Alignment) => void) | undefined;
|
|
13
|
-
onExtend?: ((id: string, extended: boolean) => void) | undefined;
|
|
14
|
-
};
|