react-align 2.0.2 → 2.0.5
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/README.md +8 -18
- package/dist/GridArea.d.ts +3 -3
- package/dist/GridItem.d.ts +5 -6
- package/dist/GridSection.d.ts +2 -1
- package/dist/GridWrapper.d.ts +5 -4
- package/dist/Icon/index.d.ts +1 -3
- package/dist/context.d.ts +4 -4
- package/dist/react-align.cjs.development.js +37 -64
- package/dist/react-align.cjs.development.js.map +1 -1
- package/dist/react-align.cjs.production.min.js +1 -1
- package/dist/react-align.cjs.production.min.js.map +1 -1
- package/dist/react-align.esm.js +37 -64
- package/dist/react-align.esm.js.map +1 -1
- package/package.json +13 -13
- package/src/GridArea.tsx +6 -8
- package/src/GridItem.tsx +51 -52
- package/src/GridSection.tsx +3 -2
- package/src/GridWrapper.tsx +10 -9
- package/src/Icon/index.tsx +3 -30
- package/src/context.tsx +2 -2
- package/src/grid.css +4 -7
package/README.md
CHANGED
|
@@ -28,11 +28,11 @@ yarn add react-align
|
|
|
28
28
|
<div style={{ width: "100vw", height: "100vh" }}>
|
|
29
29
|
{/* element containing GridWrapper needs to set the width and height */}
|
|
30
30
|
<GridWrapper
|
|
31
|
-
onMove={(id: string, destAreaId: string,
|
|
32
|
-
onExtend={(id: string,
|
|
31
|
+
onMove={(id: string, destAreaId: string, destIndex: number, prevAreaId: string, prevIndex: number) => { /* ... */ }}
|
|
32
|
+
onExtend={(id: string, extended: boolean) => { /* ... */ }}
|
|
33
33
|
onAlignmentChange={(areaId: string, alignment: Alignment) => { /* ... */ }>
|
|
34
34
|
<GridSection>
|
|
35
|
-
<GridArea
|
|
35
|
+
<GridArea id="area1">
|
|
36
36
|
<GridItem id="1234" index={1}>
|
|
37
37
|
...your component
|
|
38
38
|
</GridItem>
|
|
@@ -42,29 +42,19 @@ yarn add react-align
|
|
|
42
42
|
</div>
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
All props used in the example above are **mandatory
|
|
45
|
+
All props used in the example above are **mandatory** for full functionality.
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
To make sure the drag 'n drop works correctly all GridArea ids **inside a GridWrapper** must be unique. The drag n drop will recognize the GridAreas based on your own desired naming convention that makes sense with your layout.
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
```tsx
|
|
52
|
-
type Props = {
|
|
53
|
-
onMove: (id: string, destAreaId: string, index: number, prevAreaId: string, prevIndex: number) => { /* ... */ }
|
|
54
|
-
onExtend: (id: string, extebded: boolean) => { /* ... */ }
|
|
55
|
-
onAlignmentChange: (areaId: string, alignment: Alignment) => { /* ... */ }
|
|
56
|
-
};
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Finally, the min/max for width and height is expected to set the GridItem container that will dynamically shrink when space is limited or if you choose to allow your GridItems to extend.
|
|
49
|
+
There are many other fields for each component, so please take a look at the source code to better customize react-align to your needs and look at the example for a simple example.
|
|
60
50
|
|
|
61
51
|
## Editor mode
|
|
62
52
|
|
|
63
|
-
Re:Align's editor mode is easily toggleable by passing an *
|
|
53
|
+
Re:Align's editor mode is easily toggleable by passing an *editing* prop to the GridWrapper.
|
|
64
54
|
|
|
65
55
|
<img width="854" alt="Screen Shot 2021-06-24 at 18 15 51" src="https://user-images.githubusercontent.com/34051327/123240889-ad1b1a80-d51b-11eb-9a7d-8f9e75a9b9e0.png">
|
|
66
56
|
|
|
67
|
-
|
|
57
|
+
If you find any bugs or would like to suggest any changes feel free to open an issue!
|
|
68
58
|
|
|
69
59
|
Enjoy!
|
|
70
60
|
|
package/dist/GridArea.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, PropsWithChildren } from 'react';
|
|
2
2
|
import './grid.css';
|
|
3
|
-
export declare type Alignment = 'start' | '
|
|
3
|
+
export declare type Alignment = 'start' | 'centered' | 'end';
|
|
4
4
|
export declare type AreaProps = {
|
|
5
5
|
id: string;
|
|
6
6
|
className?: string;
|
|
@@ -13,6 +13,6 @@ export declare type AreaProps = {
|
|
|
13
13
|
style?: CSSProperties;
|
|
14
14
|
editorStyle?: CSSProperties;
|
|
15
15
|
iconColor?: string;
|
|
16
|
-
|
|
16
|
+
onAlignChange?: (alignment: Alignment) => void;
|
|
17
17
|
};
|
|
18
|
-
export default function GridArea({ id, className, vertical, stretch, end, disabled, align,
|
|
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
CHANGED
|
@@ -7,11 +7,6 @@ export declare type ItemProps = {
|
|
|
7
7
|
extendable?: boolean;
|
|
8
8
|
extended?: boolean;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
-
/** Extra customizable parts only for the really picky */
|
|
11
|
-
style?: CSSProperties;
|
|
12
|
-
editorStyle?: CSSProperties;
|
|
13
|
-
iconSize?: number;
|
|
14
|
-
iconColor?: string;
|
|
15
10
|
onExtend?: (extended: boolean) => void;
|
|
16
11
|
children?: ReactNode | ((context: {
|
|
17
12
|
id: string;
|
|
@@ -23,5 +18,9 @@ export declare type ItemProps = {
|
|
|
23
18
|
disabled: boolean;
|
|
24
19
|
index: number;
|
|
25
20
|
}) => ReactNode);
|
|
21
|
+
/** Extra customizable parts only for the really picky */
|
|
22
|
+
style?: CSSProperties;
|
|
23
|
+
editorStyle?: CSSProperties;
|
|
24
|
+
iconColor?: string;
|
|
26
25
|
};
|
|
27
|
-
export default function GridItem({ className, children, id, index, extendable, extended, disabled,
|
|
26
|
+
export default function GridItem({ className, children, id, index, extendable, extended, disabled, style, editorStyle, iconColor, ...props }: ItemProps): JSX.Element;
|
package/dist/GridSection.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import './grid.css';
|
|
3
3
|
export declare type GridSectionProps = {
|
|
4
4
|
className?: string;
|
|
5
|
+
children?: ReactNode;
|
|
5
6
|
horizontal?: boolean;
|
|
6
7
|
stretch?: boolean;
|
|
7
8
|
fixedWidth?: number;
|
package/dist/GridWrapper.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { Alignment } from './GridArea';
|
|
3
3
|
import './grid.css';
|
|
4
4
|
export declare type GridWrapperProps = {
|
|
5
5
|
className?: string;
|
|
6
|
+
children?: ReactNode;
|
|
6
7
|
editing?: boolean;
|
|
7
8
|
vertical?: boolean;
|
|
8
9
|
stretch?: boolean;
|
|
9
10
|
/** Extra customizable parts only for the really picky */
|
|
10
11
|
style?: CSSProperties;
|
|
11
12
|
editorStyle?: CSSProperties;
|
|
12
|
-
onMove?: (id: string,
|
|
13
|
-
|
|
14
|
-
onExtend?: (
|
|
13
|
+
onMove?: (id: string, destAreaId: string, destIndex: number, prevAreaId: string, prevIndex: number) => void;
|
|
14
|
+
onAlignChange?: (areaId: string, align: Alignment) => void;
|
|
15
|
+
onExtend?: (id: string, extended: boolean) => void;
|
|
15
16
|
};
|
|
16
17
|
declare const GridWrapper: React.FC<GridWrapperProps>;
|
|
17
18
|
export default GridWrapper;
|
package/dist/Icon/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import Icons from './icons';
|
|
3
3
|
export declare type Icons = keyof typeof Icons;
|
|
4
4
|
export declare type IconProps = {
|
|
5
5
|
className?: string;
|
|
6
6
|
name: string | Icons;
|
|
7
|
-
size?: number;
|
|
8
|
-
style?: CSSProperties;
|
|
9
7
|
onClick?: () => void;
|
|
10
8
|
};
|
|
11
9
|
declare const Icon: React.FC<IconProps>;
|
package/dist/context.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import { Alignment } from '.';
|
|
|
3
3
|
export declare const Context: import("react").Context<{
|
|
4
4
|
editing: boolean;
|
|
5
5
|
isDragging: boolean;
|
|
6
|
-
onAlignChange?: ((
|
|
7
|
-
onExtend?: ((
|
|
6
|
+
onAlignChange?: ((areaId: string, align: Alignment) => void) | undefined;
|
|
7
|
+
onExtend?: ((id: string, extended: boolean) => void) | undefined;
|
|
8
8
|
}>;
|
|
9
9
|
export declare const useAlignContext: () => {
|
|
10
10
|
editing: boolean;
|
|
11
11
|
isDragging: boolean;
|
|
12
|
-
onAlignChange?: ((
|
|
13
|
-
onExtend?: ((
|
|
12
|
+
onAlignChange?: ((areaId: string, align: Alignment) => void) | undefined;
|
|
13
|
+
onExtend?: ((id: string, extended: boolean) => void) | undefined;
|
|
14
14
|
};
|
|
@@ -7,7 +7,6 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var React__default = _interopDefault(React);
|
|
9
9
|
var reactBeautifulDnd = require('react-beautiful-dnd');
|
|
10
|
-
var glamor = require('glamor');
|
|
11
10
|
|
|
12
11
|
var Context = /*#__PURE__*/React.createContext({
|
|
13
12
|
editing: false,
|
|
@@ -44,19 +43,19 @@ function styleInject(css, ref) {
|
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
var css_248z = ".wrapper{height:100%}.section,.wrapper{display:flex;justify-content:space-between}.section{flex-direction:column}.area{border:
|
|
46
|
+
var css_248z = ".wrapper{height:100%}.section,.wrapper{display:flex;justify-content:space-between}.section{flex-direction:column}.area{border:0 solid transparent;border-radius:8px;box-sizing:border-box;display:flex;position:relative}.area-transition-in{transition:all .3s ease-in-out,min-height .5s ease-in-out .2s,min-width .5s ease-in-out .2s}.area-transition-out{transition:all .3s ease-in-out .4s,min-height .5s ease-in-out .2s,min-width .5s ease-in-out .2s}.item{border:0 solid transparent;border-radius:6px;margin:6px;position:relative}.stretch{flex:auto}.middle{flex-grow:0;flex:auto}.just-centered{justify-content:center}.just-end{justify-content:flex-end}.end{align-items:flex-end}.hide{display:none}.overlay{background:rgba(0,0,0,.6);box-sizing:border-box;height:100%;left:0;position:absolute;top:0;width:100%}.overlay-buttons{box-sizing:border-box;display:flex;justify-content:space-between;padding:6px}";
|
|
48
47
|
styleInject(css_248z);
|
|
49
48
|
|
|
50
49
|
var GridWrapper = function GridWrapper(_ref) {
|
|
51
50
|
var className = _ref.className,
|
|
51
|
+
children = _ref.children,
|
|
52
52
|
editing = _ref.editing,
|
|
53
53
|
vertical = _ref.vertical,
|
|
54
54
|
stretch = _ref.stretch,
|
|
55
55
|
style = _ref.style,
|
|
56
56
|
editorStyle = _ref.editorStyle,
|
|
57
|
-
children = _ref.children,
|
|
58
57
|
onMove = _ref.onMove,
|
|
59
|
-
onAlignChange = _ref.
|
|
58
|
+
onAlignChange = _ref.onAlignChange,
|
|
60
59
|
onExtend = _ref.onExtend;
|
|
61
60
|
|
|
62
61
|
var _useState = React.useState(false),
|
|
@@ -122,13 +121,13 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
122
121
|
|
|
123
122
|
var GridSection = function GridSection(_ref) {
|
|
124
123
|
var className = _ref.className,
|
|
124
|
+
children = _ref.children,
|
|
125
125
|
horizontal = _ref.horizontal,
|
|
126
126
|
stretch = _ref.stretch,
|
|
127
127
|
fixedWidth = _ref.fixedWidth,
|
|
128
128
|
fixedHeight = _ref.fixedHeight,
|
|
129
129
|
style = _ref.style,
|
|
130
|
-
editorStyle = _ref.editorStyle
|
|
131
|
-
children = _ref.children;
|
|
130
|
+
editorStyle = _ref.editorStyle;
|
|
132
131
|
|
|
133
132
|
var _useAlignContext = useAlignContext(),
|
|
134
133
|
enabled = _useAlignContext.editing;
|
|
@@ -419,31 +418,15 @@ var Icons = {
|
|
|
419
418
|
alignEndV: SvgAlignEndV
|
|
420
419
|
};
|
|
421
420
|
|
|
422
|
-
var IconStyles = function IconStyles(size) {
|
|
423
|
-
return glamor.css({
|
|
424
|
-
cursor: 'pointer',
|
|
425
|
-
width: size || 24 + 'px',
|
|
426
|
-
height: size || 24 + 'px',
|
|
427
|
-
' svg': {
|
|
428
|
-
height: size || 24 + 'px',
|
|
429
|
-
width: size || 24 + 'px'
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
};
|
|
433
|
-
|
|
434
421
|
var Icon = function Icon(_ref) {
|
|
435
422
|
var className = _ref.className,
|
|
436
423
|
name = _ref.name,
|
|
437
|
-
size = _ref.size,
|
|
438
|
-
style = _ref.style,
|
|
439
424
|
onClick = _ref.onClick;
|
|
440
425
|
var LocalIconComponent = Icons[name];
|
|
441
|
-
return React__default.createElement(LocalIconComponent,
|
|
442
|
-
className: className
|
|
443
|
-
}, IconStyles(size), {
|
|
444
|
-
style: style,
|
|
426
|
+
return React__default.createElement(LocalIconComponent, {
|
|
427
|
+
className: className,
|
|
445
428
|
onClick: onClick
|
|
446
|
-
})
|
|
429
|
+
});
|
|
447
430
|
};
|
|
448
431
|
|
|
449
432
|
var alignments = ['start', 'centered', 'end'];
|
|
@@ -455,7 +438,7 @@ function GridArea(_ref) {
|
|
|
455
438
|
end = _ref.end,
|
|
456
439
|
disabled = _ref.disabled,
|
|
457
440
|
align = _ref.align,
|
|
458
|
-
|
|
441
|
+
onAlignChange = _ref.onAlignChange,
|
|
459
442
|
children = _ref.children,
|
|
460
443
|
style = _ref.style,
|
|
461
444
|
editorStyle = _ref.editorStyle,
|
|
@@ -468,9 +451,9 @@ function GridArea(_ref) {
|
|
|
468
451
|
|
|
469
452
|
var handleAlignChange = React.useCallback(function () {
|
|
470
453
|
var a = alignments[(align ? alignments.indexOf(align) + 1 : 0) % alignments.length];
|
|
471
|
-
|
|
454
|
+
onAlignChange == null ? void 0 : onAlignChange(a);
|
|
472
455
|
onAlignChange2 == null ? void 0 : onAlignChange2(id, a);
|
|
473
|
-
}, [align,
|
|
456
|
+
}, [align, onAlignChange, onAlignChange2, id]);
|
|
474
457
|
var buttonStyle = React.useMemo(function () {
|
|
475
458
|
return {
|
|
476
459
|
position: 'absolute',
|
|
@@ -513,13 +496,11 @@ function GridArea(_ref) {
|
|
|
513
496
|
}, React__default.createElement("div", {
|
|
514
497
|
onClick: handleAlignChange,
|
|
515
498
|
style: {
|
|
516
|
-
cursor: 'pointer'
|
|
517
|
-
}
|
|
518
|
-
}, React__default.createElement(Icon, {
|
|
519
|
-
name: align === 'centered' ? vertical ? 'alignCenterV' : 'alignCenter' : align === 'end' ? vertical ? 'alignEndV' : 'alignEnd' : vertical ? 'alignStartV' : 'alignStart',
|
|
520
|
-
style: {
|
|
499
|
+
cursor: 'pointer',
|
|
521
500
|
color: iconColor
|
|
522
501
|
}
|
|
502
|
+
}, React__default.createElement(Icon, {
|
|
503
|
+
name: align === 'centered' ? vertical ? 'alignCenterV' : 'alignCenter' : align === 'end' ? vertical ? 'alignEndV' : 'alignEnd' : vertical ? 'alignStartV' : 'alignStart'
|
|
523
504
|
}))));
|
|
524
505
|
});
|
|
525
506
|
}
|
|
@@ -535,21 +516,18 @@ function GridItem(_ref) {
|
|
|
535
516
|
extended = _ref$extended === void 0 ? false : _ref$extended,
|
|
536
517
|
_ref$disabled = _ref.disabled,
|
|
537
518
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
538
|
-
onExtend = _ref.onExtend,
|
|
539
519
|
style = _ref.style,
|
|
540
520
|
editorStyle = _ref.editorStyle,
|
|
541
|
-
iconSize = _ref.iconSize,
|
|
542
521
|
_ref$iconColor = _ref.iconColor,
|
|
543
522
|
iconColor = _ref$iconColor === void 0 ? 'rgb(255, 255, 255)' : _ref$iconColor,
|
|
544
|
-
props = _objectWithoutPropertiesLoose(_ref, ["className", "children", "id", "index", "extendable", "extended", "disabled", "
|
|
523
|
+
props = _objectWithoutPropertiesLoose(_ref, ["className", "children", "id", "index", "extendable", "extended", "disabled", "style", "editorStyle", "iconColor"]);
|
|
545
524
|
|
|
546
|
-
var
|
|
547
|
-
vertical = props.vertical;
|
|
525
|
+
var vertical = props.vertical;
|
|
548
526
|
|
|
549
527
|
var _useAlignContext = useAlignContext(),
|
|
550
528
|
editing = _useAlignContext.editing,
|
|
551
529
|
isDragging = _useAlignContext.isDragging,
|
|
552
|
-
|
|
530
|
+
onExtend = _useAlignContext.onExtend;
|
|
553
531
|
|
|
554
532
|
var _useState = React.useState(false),
|
|
555
533
|
isHovered = _useState[0],
|
|
@@ -558,15 +536,15 @@ function GridItem(_ref) {
|
|
|
558
536
|
var handleExtend = React.useCallback(function () {
|
|
559
537
|
if (!extendable) return;
|
|
560
538
|
setHovered(false);
|
|
561
|
-
onExtend == null ? void 0 : onExtend(!extended);
|
|
562
|
-
|
|
563
|
-
}, [extendable, onExtend, extended, onExtend2, id]);
|
|
539
|
+
onExtend == null ? void 0 : onExtend(id, !extended);
|
|
540
|
+
}, [extendable, onExtend, extended, id]);
|
|
564
541
|
var buttonStyles = React.useMemo(function () {
|
|
565
542
|
return {
|
|
566
|
-
alignItems:
|
|
567
|
-
"float":
|
|
543
|
+
alignItems: 'start',
|
|
544
|
+
"float": 'left',
|
|
545
|
+
color: iconColor
|
|
568
546
|
};
|
|
569
|
-
}, [
|
|
547
|
+
}, [iconColor]);
|
|
570
548
|
var ctx = React.useMemo(function () {
|
|
571
549
|
return {
|
|
572
550
|
id: id,
|
|
@@ -591,20 +569,23 @@ function GridItem(_ref) {
|
|
|
591
569
|
style: _extends({
|
|
592
570
|
flex: extended && !snapshot.isDragging ? 'auto' : undefined,
|
|
593
571
|
opacity: snapshot.isDragging ? 0.5 : 1
|
|
594
|
-
}, editing ? editorStyle : style, provided.draggableProps.style)
|
|
572
|
+
}, editing ? editorStyle : style, provided.draggableProps.style)
|
|
573
|
+
}), React__default.createElement("div", {
|
|
574
|
+
style: {
|
|
575
|
+
display: 'inline-block',
|
|
576
|
+
position: 'relative',
|
|
577
|
+
minHeight: isHovered && !disabled ? '35px' : undefined,
|
|
578
|
+
width: !vertical && extended ? '100%' : undefined,
|
|
579
|
+
minWidth: isHovered && !disabled ? extendable ? '70px' : '35px' : undefined,
|
|
580
|
+
height: vertical && extended ? '100%' : undefined
|
|
581
|
+
},
|
|
595
582
|
onMouseEnter: function onMouseEnter() {
|
|
596
583
|
return setHovered(true);
|
|
597
584
|
},
|
|
598
585
|
onMouseLeave: function onMouseLeave() {
|
|
599
586
|
return setHovered(false);
|
|
600
587
|
}
|
|
601
|
-
}), React__default.createElement("div", {
|
|
602
|
-
style: {
|
|
603
|
-
width: '100%',
|
|
604
|
-
height: '100%',
|
|
605
|
-
pointerEvents: editing ? 'none' : undefined
|
|
606
|
-
}
|
|
607
|
-
}, typeof children === 'function' ? children(ctx) : children), React__default.createElement("div", {
|
|
588
|
+
}, typeof children === 'function' ? children(ctx) : children, React__default.createElement("div", {
|
|
608
589
|
className: "overlay",
|
|
609
590
|
style: {
|
|
610
591
|
display: !disabled && editing && isHovered && (snapshot.isDragging || !isDragging) ? 'block' : 'none'
|
|
@@ -613,11 +594,7 @@ function GridItem(_ref) {
|
|
|
613
594
|
className: "overlay-buttons",
|
|
614
595
|
style: buttonStyles
|
|
615
596
|
}, React__default.createElement("div", Object.assign({}, provided.dragHandleProps), React__default.createElement(Icon, {
|
|
616
|
-
name: "moveArrows"
|
|
617
|
-
size: iconSize,
|
|
618
|
-
style: {
|
|
619
|
-
color: iconColor
|
|
620
|
-
}
|
|
597
|
+
name: "moveArrows"
|
|
621
598
|
})), extendable && React__default.createElement("div", {
|
|
622
599
|
style: {
|
|
623
600
|
cursor: 'pointer',
|
|
@@ -625,12 +602,8 @@ function GridItem(_ref) {
|
|
|
625
602
|
},
|
|
626
603
|
onClick: handleExtend
|
|
627
604
|
}, React__default.createElement(Icon, {
|
|
628
|
-
name: vertical ? 'verticalExtend' : 'horizontalExtend'
|
|
629
|
-
|
|
630
|
-
style: {
|
|
631
|
-
color: iconColor
|
|
632
|
-
}
|
|
633
|
-
})))));
|
|
605
|
+
name: vertical ? 'verticalExtend' : 'horizontalExtend'
|
|
606
|
+
}))))));
|
|
634
607
|
});
|
|
635
608
|
}
|
|
636
609
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-align.cjs.development.js","sources":["../src/context.tsx","../node_modules/style-inject/dist/style-inject.es.js","../src/GridWrapper.tsx","../src/GridSection.tsx","../src/Icon/icons.ts","../src/Icon/index.tsx","../src/GridArea.tsx","../src/GridItem.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport { Alignment } from '.';\n\nexport const Context = createContext<{\n editing: boolean;\n isDragging: boolean;\n onAlignChange?: (location: string, align: Alignment) => void;\n onExtend?: (location: string, extended: boolean) => void;\n}>({ editing: false, isDragging: false });\nexport const useAlignContext = () => useContext(Context);\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React, { CSSProperties, useCallback, useState } from 'react';\nimport {\n DragDropContext,\n DropResult,\n ResponderProvided,\n} from 'react-beautiful-dnd';\n\nimport { Context } from './context';\nimport { Alignment } from './GridArea';\nimport './grid.css';\n\nexport type GridWrapperProps = {\n className?: string;\n editing?: boolean;\n vertical?: boolean;\n stretch?: boolean;\n /** Extra customizable parts only for the really picky */\n style?: CSSProperties;\n editorStyle?: CSSProperties;\n onMove?: (\n id: string,\n destLocation: string,\n destIndedx: number,\n originalLocation: string,\n originalIndex: number\n ) => void;\n onAlignmentChange?: (location: string, align: Alignment) => void;\n onExtend?: (location: string, extended: boolean) => void;\n};\n\nconst GridWrapper: React.FC<GridWrapperProps> = ({\n className,\n editing,\n vertical,\n stretch,\n style,\n editorStyle,\n children,\n onMove,\n onAlignmentChange: onAlignChange,\n onExtend,\n}) => {\n const [isDragging, setDragging] = useState(false);\n\n const handleDragStart = useCallback(() => {\n setDragging(true);\n }, []);\n\n const handleDragEnd = useCallback(\n (result: DropResult, _provided: ResponderProvided) => {\n setDragging(false);\n if (\n !result.destination ||\n result.reason !== 'DROP' ||\n (result.destination.droppableId === result.source.droppableId &&\n result.destination.index === result.source.index)\n )\n return;\n onMove?.(\n result.draggableId,\n result.destination.droppableId,\n result.destination.index,\n result.source.droppableId,\n result.source.index\n );\n },\n [onMove]\n );\n\n return (\n <div\n className={`wrapper ${className} ${vertical && 'vertical'} ${stretch &&\n 'stretch'}`}\n style={editing ? editorStyle : style}\n >\n <DragDropContext onDragStart={handleDragStart} onDragEnd={handleDragEnd}>\n <Context.Provider\n value={{ editing: !!editing, onAlignChange, onExtend, isDragging }}\n >\n {children}\n </Context.Provider>\n </DragDropContext>\n </div>\n );\n};\n\nexport default GridWrapper;\n","import React, { CSSProperties } from 'react';\n\nimport { useAlignContext } from './context';\nimport './grid.css';\n\nexport type GridSectionProps = {\n className?: string;\n horizontal?: boolean;\n stretch?: boolean;\n fixedWidth?: number;\n fixedHeight?: number;\n /** Extra customizable parts only for the really picky */\n style?: CSSProperties;\n editorStyle?: CSSProperties;\n};\n\nconst GridSection: React.FC<GridSectionProps> = ({\n className,\n horizontal,\n stretch,\n fixedWidth,\n fixedHeight,\n style,\n editorStyle,\n children,\n}) => {\n const { editing: enabled } = useAlignContext();\n\n return (\n <div\n className={`section ${className} ${horizontal ? 'horizontal' : ''} ${\n stretch ? 'stretch' : ''\n }`}\n style={{\n ...(enabled ? editorStyle : style),\n ...(typeof fixedHeight === 'number'\n ? {\n height: fixedHeight + 'px',\n }\n : {}),\n ...(typeof fixedWidth === 'number'\n ? {\n width: fixedWidth + 'px',\n }\n : {}),\n }}\n >\n {children}\n </div>\n );\n};\n\nexport default GridSection;\n","import HorizontalExtend from './Icons/horizontalExtend.svg';\nimport HorizontalNormal from './Icons/horizontalNormal.svg';\nimport VerticalExtend from './Icons/verticalExtend.svg';\nimport VerticalNormal from './Icons/verticalNormal.svg';\nimport MoveArrows from './Icons/moveArrows.svg';\nimport AlignStart from './Icons/alignStart.svg';\nimport AlignCenter from './Icons/alignCenter.svg';\nimport AlignEnd from './Icons/alignEnd.svg';\nimport AlignStartV from './Icons/alignStartV.svg';\nimport AlignCenterV from './Icons/alignCenterV.svg';\nimport AlignEndV from './Icons/alignEndV.svg';\n\nexport default {\n horizontalExtend: HorizontalExtend,\n horizontalNormal: HorizontalNormal,\n verticalExtend: VerticalExtend,\n verticalNormal: VerticalNormal,\n moveArrows: MoveArrows,\n alignStart: AlignStart,\n alignCenter: AlignCenter,\n alignEnd: AlignEnd,\n alignStartV: AlignStartV,\n alignCenterV: AlignCenterV,\n alignEndV: AlignEndV,\n};\n","import React, { CSSProperties } from 'react';\nimport { css } from 'glamor';\n\nimport Icons from './icons';\n\nexport type Icons = keyof typeof Icons;\n\nexport type IconProps = {\n className?: string;\n name: string | Icons;\n size?: number;\n style?: CSSProperties;\n onClick?: () => void;\n};\n\nconst IconStyles = (size?: number) =>\n css({\n cursor: 'pointer',\n width: size || 24 + 'px',\n height: size || 24 + 'px',\n ' svg': {\n height: size || 24 + 'px',\n width: size || 24 + 'px',\n },\n });\n\nconst Icon: React.FC<IconProps> = ({\n className,\n name,\n size,\n style,\n onClick,\n}) => {\n const LocalIconComponent = Icons[name as Icons];\n return (\n <LocalIconComponent\n className={className}\n {...IconStyles(size)}\n style={style}\n onClick={onClick}\n />\n );\n};\n\nexport default Icon;\n","import React, {\n CSSProperties,\n PropsWithChildren,\n useCallback,\n useMemo,\n} from 'react';\nimport { Droppable } from 'react-beautiful-dnd';\n\nimport { useAlignContext } from './context';\nimport Icon from './Icon';\nimport './grid.css';\n\nexport type Alignment = 'start' | 'end' | 'centered';\n\nexport type AreaProps = {\n id: string;\n className?: string;\n vertical?: boolean;\n stretch?: boolean;\n end?: boolean;\n align?: Alignment;\n disabled?: boolean;\n /** Extra customizable parts only for the really picky */\n style?: CSSProperties;\n editorStyle?: CSSProperties;\n iconColor?: string;\n onAlignmentChange?: (alignment: Alignment) => void;\n};\n\nconst alignments = ['start', 'centered', 'end'] as const;\n\nexport default function GridArea({\n id,\n className,\n vertical,\n stretch,\n end,\n disabled,\n align,\n onAlignmentChange,\n children,\n // Picky stuff\n style,\n editorStyle,\n iconColor = '#FFFFFF',\n}: PropsWithChildren<AreaProps>) {\n const { editing: enabled, onAlignChange: onAlignChange2 } = useAlignContext();\n\n const handleAlignChange = useCallback(() => {\n const a =\n alignments[\n (align ? alignments.indexOf(align) + 1 : 0) % alignments.length\n ];\n onAlignmentChange?.(a);\n onAlignChange2?.(id, a);\n }, [align, onAlignmentChange, onAlignChange2, id]);\n\n const buttonStyle: CSSProperties = useMemo(\n () => ({\n position: 'absolute',\n left: vertical ? (end ? 0 : undefined) : '50%',\n right: vertical ? (!end ? 0 : undefined) : '50%',\n bottom: !vertical && !end ? 0 : vertical ? '50%' : undefined,\n top: vertical ? '50%' : end ? 0 : undefined,\n opacity: !disabled && enabled && align ? 1 : 0,\n pointerEvents: !disabled && enabled && align ? 'auto' : 'none',\n transition: 'all 0.5s ease-in-out',\n }),\n [vertical, end, disabled, enabled, align]\n );\n\n // Rebuilds the GridItem children to receive their parent GridArea's 'end' and 'vertical' values.\n // Used to know where to align the overlay buttons (end) and how to extend the GridItems (vertical).\n const childrenWithParentProps = useMemo(\n () =>\n React.Children.map(children, child =>\n React.cloneElement(child as React.ReactElement<any>, {\n end,\n vertical,\n })\n ),\n [children, end, vertical]\n );\n\n return (\n <Droppable\n droppableId={id}\n direction={vertical ? 'vertical' : 'horizontal'}\n isDropDisabled={disabled}\n >\n {(provided, snapshot) => (\n <div\n ref={provided.innerRef}\n {...provided.droppableProps}\n className={[\n className,\n 'area',\n stretch && 'stretch',\n end && 'end',\n align === 'centered'\n ? 'just-centered'\n : align === 'end'\n ? 'just-end'\n : 'start',\n enabled ? 'area-transition-in' : 'area-transition-out',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n flexDirection: vertical ? 'column' : 'row',\n minHeight:\n !React.Children.count(children) && !enabled ? '0px' : '26px',\n minWidth:\n !React.Children.count(children) && !enabled ? '0px' : '46px',\n opacity: snapshot.isDraggingOver ? 0.8 : 1,\n ...(enabled ? editorStyle : style),\n }}\n >\n {childrenWithParentProps}\n {provided.placeholder}\n <div style={buttonStyle}>\n <div\n onClick={handleAlignChange}\n style={{\n cursor: 'pointer',\n }}\n >\n <Icon\n name={\n align === 'centered'\n ? vertical\n ? 'alignCenterV'\n : 'alignCenter'\n : align === 'end'\n ? vertical\n ? 'alignEndV'\n : 'alignEnd'\n : vertical\n ? 'alignStartV'\n : 'alignStart'\n }\n style={{\n color: iconColor,\n }}\n />\n </div>\n </div>\n </div>\n )}\n </Droppable>\n );\n}\n","import React, {\n useMemo,\n CSSProperties,\n useState,\n useCallback,\n ReactNode,\n} from 'react';\nimport { Draggable } from 'react-beautiful-dnd';\n\nimport { useAlignContext } from './context';\nimport Icon from './Icon';\nimport './grid.css';\n\nexport type ItemProps = {\n className?: string;\n id: string;\n index: number;\n extendable?: boolean;\n extended?: boolean;\n disabled?: boolean;\n /** Extra customizable parts only for the really picky */\n style?: CSSProperties;\n editorStyle?: CSSProperties;\n iconSize?: number;\n iconColor?: string;\n onExtend?: (extended: boolean) => void;\n children?:\n | ReactNode\n | ((context: {\n id: string;\n editing: boolean;\n isDragging: boolean;\n isHovered: boolean;\n extended: boolean;\n extendable: boolean;\n disabled: boolean;\n index: number;\n }) => ReactNode);\n};\n\nexport default function GridItem({\n className,\n children,\n id,\n index,\n extendable = false,\n extended = false,\n disabled = false,\n onExtend,\n // Picky stuff.\n style,\n editorStyle,\n iconSize,\n iconColor = 'rgb(255, 255, 255)',\n ...props\n}: ItemProps) {\n const { end, vertical } = props as {\n end?: boolean;\n vertical?: boolean;\n };\n const { editing, isDragging, onExtend: onExtend2 } = useAlignContext();\n const [isHovered, setHovered] = useState(false);\n const handleExtend = useCallback(() => {\n if (!extendable) return;\n setHovered(false);\n onExtend?.(!extended);\n onExtend2?.(id, !extended);\n }, [extendable, onExtend, extended, onExtend2, id]);\n\n const buttonStyles: CSSProperties = useMemo(\n () => ({\n alignItems: end ? 'end' : 'start',\n float: end ? 'right' : 'left',\n }),\n [end]\n );\n\n const ctx = useMemo(\n () => ({\n id,\n editing,\n isDragging,\n isHovered,\n extended,\n extendable,\n disabled,\n index,\n }),\n [disabled, editing, extendable, extended, id, index, isDragging, isHovered]\n );\n\n return (\n <Draggable draggableId={id} index={index} isDragDisabled={disabled}>\n {(provided, snapshot) => (\n <div\n ref={provided.innerRef}\n {...provided.draggableProps}\n className={`${className} item`}\n style={{\n flex: extended && !snapshot.isDragging ? 'auto' : undefined,\n opacity: snapshot.isDragging ? 0.5 : 1,\n ...(editing ? editorStyle : style),\n ...provided.draggableProps.style,\n }}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n >\n <div\n style={{\n width: '100%',\n height: '100%',\n pointerEvents: editing ? 'none' : undefined,\n }}\n >\n {typeof children === 'function' ? children(ctx) : children}\n </div>\n <div\n className=\"overlay\"\n style={{\n display:\n !disabled &&\n editing &&\n isHovered &&\n (snapshot.isDragging || !isDragging)\n ? 'block'\n : 'none',\n }}\n >\n <div className=\"overlay-buttons\" style={buttonStyles}>\n <div {...provided.dragHandleProps}>\n <Icon\n name=\"moveArrows\"\n size={iconSize}\n style={{ color: iconColor }}\n />\n </div>\n {extendable && (\n <div\n style={{ cursor: 'pointer', marginLeft: '8px' }}\n onClick={handleExtend}\n >\n <Icon\n name={vertical ? 'verticalExtend' : 'horizontalExtend'}\n size={iconSize}\n style={{ color: iconColor }}\n />\n </div>\n )}\n </div>\n </div>\n </div>\n )}\n </Draggable>\n );\n}\n"],"names":["Context","createContext","editing","isDragging","useAlignContext","useContext","GridWrapper","className","vertical","stretch","style","editorStyle","children","onMove","onAlignChange","onAlignmentChange","onExtend","useState","setDragging","handleDragStart","useCallback","handleDragEnd","result","_provided","destination","reason","droppableId","source","index","draggableId","React","DragDropContext","onDragStart","onDragEnd","Provider","value","GridSection","horizontal","fixedWidth","fixedHeight","enabled","height","width","horizontalExtend","HorizontalExtend","horizontalNormal","HorizontalNormal","verticalExtend","VerticalExtend","verticalNormal","VerticalNormal","moveArrows","MoveArrows","alignStart","AlignStart","alignCenter","AlignCenter","alignEnd","AlignEnd","alignStartV","AlignStartV","alignCenterV","AlignCenterV","alignEndV","AlignEndV","IconStyles","size","css","cursor","Icon","name","onClick","LocalIconComponent","Icons","alignments","GridArea","id","end","disabled","align","iconColor","onAlignChange2","handleAlignChange","a","indexOf","length","buttonStyle","useMemo","position","left","undefined","right","bottom","top","opacity","pointerEvents","transition","childrenWithParentProps","Children","map","child","cloneElement","Droppable","direction","isDropDisabled","provided","snapshot","ref","innerRef","droppableProps","filter","Boolean","join","flexDirection","minHeight","count","minWidth","isDraggingOver","placeholder","color","GridItem","extendable","extended","iconSize","props","onExtend2","isHovered","setHovered","handleExtend","buttonStyles","alignItems","ctx","Draggable","isDragDisabled","draggableProps","flex","onMouseEnter","onMouseLeave","display","dragHandleProps","marginLeft"],"mappings":";;;;;;;;;;;AAGO,IAAMA,OAAO,gBAAGC,mBAAa,CAKjC;AAAEC,EAAAA,OAAO,EAAE,KAAX;AAAkBC,EAAAA,UAAU,EAAE;AAA9B,CALiC,CAA7B;AAMA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB;AAAA,SAAMC,gBAAU,CAACL,OAAD,CAAhB;AAAA,CAAxB;;ACTP,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;A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AAAA,IAAI,EAAEyD;AACNjH,MAAAA,KAAK,EAAE;AAAE6G,QAAAA,KAAK,EAAEvC;AAAT;KAHT,CADF,CADF,EAQGyC,UAAU,IACT3F,4BAAA,MAAA;AACEpB,MAAAA,KAAK,EAAE;AAAE0D,QAAAA,MAAM,EAAE,SAAV;AAAqBwE,QAAAA,UAAU,EAAE;AAAjC;AACPrE,MAAAA,OAAO,EAAEyD;KAFX,EAIElG,4BAAA,CAACuC,IAAD;AACEC,MAAAA,IAAI,EAAE9D,QAAQ,GAAG,gBAAH,GAAsB;AACpC0D,MAAAA,IAAI,EAAEyD;AACNjH,MAAAA,KAAK,EAAE;AAAE6G,QAAAA,KAAK,EAAEvC;AAAT;KAHT,CAJF,CATJ,CAZF,CAtBF,CADD;AAAA,GADH,CADF;AA+DD;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"react-align.cjs.development.js","sources":["../src/context.tsx","../node_modules/style-inject/dist/style-inject.es.js","../src/GridWrapper.tsx","../src/GridSection.tsx","../src/Icon/icons.ts","../src/Icon/index.tsx","../src/GridArea.tsx","../src/GridItem.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport { Alignment } from '.';\n\nexport const Context = createContext<{\n editing: boolean;\n isDragging: boolean;\n onAlignChange?: (areaId: string, align: Alignment) => void;\n onExtend?: (id: string, extended: boolean) => void;\n}>({ editing: false, isDragging: false });\nexport const useAlignContext = () => useContext(Context);\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React, { CSSProperties, ReactNode, useCallback, useState } from 'react';\nimport {\n DragDropContext,\n DropResult,\n ResponderProvided,\n} from 'react-beautiful-dnd';\n\nimport { Context } from './context';\nimport { Alignment } from './GridArea';\nimport './grid.css';\n\nexport type GridWrapperProps = {\n className?: string;\n children?: ReactNode;\n editing?: boolean;\n vertical?: boolean;\n stretch?: boolean;\n /** Extra customizable parts only for the really picky */\n style?: CSSProperties;\n editorStyle?: CSSProperties;\n onMove?: (\n id: string,\n destAreaId: string,\n destIndex: number,\n prevAreaId: string,\n prevIndex: number\n ) => void;\n onAlignChange?: (areaId: string, align: Alignment) => void;\n onExtend?: (id: string, extended: boolean) => void;\n};\n\nconst GridWrapper: React.FC<GridWrapperProps> = ({\n className,\n children,\n editing,\n vertical,\n stretch,\n style,\n editorStyle,\n onMove,\n onAlignChange,\n onExtend,\n}) => {\n const [isDragging, setDragging] = useState(false);\n\n const handleDragStart = useCallback(() => {\n setDragging(true);\n }, []);\n\n const handleDragEnd = useCallback(\n (result: DropResult, _provided: ResponderProvided) => {\n setDragging(false);\n if (\n !result.destination ||\n result.reason !== 'DROP' ||\n (result.destination.droppableId === result.source.droppableId &&\n result.destination.index === result.source.index)\n )\n return;\n onMove?.(\n result.draggableId,\n result.destination.droppableId,\n result.destination.index,\n result.source.droppableId,\n result.source.index\n );\n },\n [onMove]\n );\n\n return (\n <div\n className={`wrapper ${className} ${vertical && 'vertical'} ${stretch &&\n 'stretch'}`}\n style={editing ? editorStyle : style}\n >\n <DragDropContext onDragStart={handleDragStart} onDragEnd={handleDragEnd}>\n <Context.Provider\n value={{ editing: !!editing, onAlignChange, onExtend, isDragging }}\n >\n {children}\n </Context.Provider>\n </DragDropContext>\n </div>\n );\n};\n\nexport default GridWrapper;\n","import React, { CSSProperties, ReactNode } from 'react';\n\nimport { useAlignContext } from './context';\nimport './grid.css';\n\nexport type GridSectionProps = {\n className?: string;\n children?: ReactNode;\n horizontal?: boolean;\n stretch?: boolean;\n fixedWidth?: number;\n fixedHeight?: number;\n /** Extra customizable parts only for the really picky */\n style?: CSSProperties;\n editorStyle?: CSSProperties;\n};\n\nconst GridSection: React.FC<GridSectionProps> = ({\n className,\n children,\n horizontal,\n stretch,\n fixedWidth,\n fixedHeight,\n style,\n editorStyle,\n}) => {\n const { editing: enabled } = useAlignContext();\n\n return (\n <div\n className={`section ${className} ${horizontal ? 'horizontal' : ''} ${\n stretch ? 'stretch' : ''\n }`}\n style={{\n ...(enabled ? editorStyle : style),\n ...(typeof fixedHeight === 'number'\n ? {\n height: fixedHeight + 'px',\n }\n : {}),\n ...(typeof fixedWidth === 'number'\n ? {\n width: fixedWidth + 'px',\n }\n : {}),\n }}\n >\n {children}\n </div>\n );\n};\n\nexport default GridSection;\n","import HorizontalExtend from './Icons/horizontalExtend.svg';\nimport HorizontalNormal from './Icons/horizontalNormal.svg';\nimport VerticalExtend from './Icons/verticalExtend.svg';\nimport VerticalNormal from './Icons/verticalNormal.svg';\nimport MoveArrows from './Icons/moveArrows.svg';\nimport AlignStart from './Icons/alignStart.svg';\nimport AlignCenter from './Icons/alignCenter.svg';\nimport AlignEnd from './Icons/alignEnd.svg';\nimport AlignStartV from './Icons/alignStartV.svg';\nimport AlignCenterV from './Icons/alignCenterV.svg';\nimport AlignEndV from './Icons/alignEndV.svg';\n\nexport default {\n horizontalExtend: HorizontalExtend,\n horizontalNormal: HorizontalNormal,\n verticalExtend: VerticalExtend,\n verticalNormal: VerticalNormal,\n moveArrows: MoveArrows,\n alignStart: AlignStart,\n alignCenter: AlignCenter,\n alignEnd: AlignEnd,\n alignStartV: AlignStartV,\n alignCenterV: AlignCenterV,\n alignEndV: AlignEndV,\n};\n","import React from 'react';\n\nimport Icons from './icons';\n\nexport type Icons = keyof typeof Icons;\n\nexport type IconProps = {\n className?: string;\n name: string | Icons;\n onClick?: () => void;\n};\n\nconst Icon: React.FC<IconProps> = ({ className, name, onClick }) => {\n const LocalIconComponent = Icons[name as Icons];\n return <LocalIconComponent className={className} onClick={onClick} />;\n};\n\nexport default Icon;\n","import React, {\n CSSProperties,\n PropsWithChildren,\n useCallback,\n useMemo,\n} from 'react';\nimport { Droppable } from 'react-beautiful-dnd';\n\nimport { useAlignContext } from './context';\nimport Icon from './Icon';\nimport './grid.css';\n\nexport type Alignment = 'start' | 'centered' | 'end';\n\nexport type AreaProps = {\n id: string;\n className?: string;\n vertical?: boolean;\n stretch?: boolean;\n end?: boolean;\n align?: Alignment;\n disabled?: boolean;\n /** Extra customizable parts only for the really picky */\n style?: CSSProperties;\n editorStyle?: CSSProperties;\n iconColor?: string;\n onAlignChange?: (alignment: Alignment) => void;\n};\n\nconst alignments = ['start', 'centered', 'end'] as const;\n\nexport default function GridArea({\n id,\n className,\n vertical,\n stretch,\n end,\n disabled,\n align,\n onAlignChange,\n children,\n // Picky stuff\n style,\n editorStyle,\n iconColor = '#FFFFFF',\n}: PropsWithChildren<AreaProps>) {\n const { editing: enabled, onAlignChange: onAlignChange2 } = useAlignContext();\n\n const handleAlignChange = useCallback(() => {\n const a =\n alignments[\n (align ? alignments.indexOf(align) + 1 : 0) % alignments.length\n ];\n onAlignChange?.(a);\n onAlignChange2?.(id, a);\n }, [align, onAlignChange, onAlignChange2, id]);\n\n const buttonStyle: CSSProperties = useMemo(\n () => ({\n position: 'absolute',\n left: vertical ? (end ? 0 : undefined) : '50%',\n right: vertical ? (!end ? 0 : undefined) : '50%',\n bottom: !vertical && !end ? 0 : vertical ? '50%' : undefined,\n top: vertical ? '50%' : end ? 0 : undefined,\n opacity: !disabled && enabled && align ? 1 : 0,\n pointerEvents: !disabled && enabled && align ? 'auto' : 'none',\n transition: 'all 0.5s ease-in-out',\n }),\n [vertical, end, disabled, enabled, align]\n );\n\n // Rebuilds the GridItem children to receive their parent GridArea's 'end' and 'vertical' values.\n // Used to know where to align the overlay buttons (end) and how to extend the GridItems (vertical).\n const childrenWithParentProps = useMemo(\n () =>\n React.Children.map(children, child =>\n React.cloneElement(child as React.ReactElement<any>, {\n end,\n vertical,\n })\n ),\n [children, end, vertical]\n );\n\n return (\n <Droppable\n droppableId={id}\n direction={vertical ? 'vertical' : 'horizontal'}\n isDropDisabled={disabled}\n >\n {(provided, snapshot) => (\n <div\n ref={provided.innerRef}\n {...provided.droppableProps}\n className={[\n className,\n 'area',\n stretch && 'stretch',\n end && 'end',\n align === 'centered'\n ? 'just-centered'\n : align === 'end'\n ? 'just-end'\n : 'start',\n enabled ? 'area-transition-in' : 'area-transition-out',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n flexDirection: vertical ? 'column' : 'row',\n minHeight:\n !React.Children.count(children) && !enabled ? '0px' : '26px',\n minWidth:\n !React.Children.count(children) && !enabled ? '0px' : '46px',\n opacity: snapshot.isDraggingOver ? 0.8 : 1,\n ...(enabled ? editorStyle : style),\n }}\n >\n {childrenWithParentProps}\n {provided.placeholder}\n <div style={buttonStyle}>\n <div\n onClick={handleAlignChange}\n style={{\n cursor: 'pointer',\n color: iconColor,\n }}\n >\n <Icon\n name={\n align === 'centered'\n ? vertical\n ? 'alignCenterV'\n : 'alignCenter'\n : align === 'end'\n ? vertical\n ? 'alignEndV'\n : 'alignEnd'\n : vertical\n ? 'alignStartV'\n : 'alignStart'\n }\n />\n </div>\n </div>\n </div>\n )}\n </Droppable>\n );\n}\n","import React, {\n useMemo,\n CSSProperties,\n useState,\n useCallback,\n ReactNode,\n} from 'react';\nimport { Draggable } from 'react-beautiful-dnd';\n\nimport { useAlignContext } from './context';\nimport Icon from './Icon';\nimport './grid.css';\n\nexport type ItemProps = {\n className?: string;\n id: string;\n index: number;\n extendable?: boolean;\n extended?: boolean;\n disabled?: boolean;\n onExtend?: (extended: boolean) => void;\n children?:\n | ReactNode\n | ((context: {\n id: string;\n editing: boolean;\n isDragging: boolean;\n isHovered: boolean;\n extended: boolean;\n extendable: boolean;\n disabled: boolean;\n index: number;\n }) => ReactNode);\n /** Extra customizable parts only for the really picky */\n style?: CSSProperties;\n editorStyle?: CSSProperties;\n iconColor?: string;\n};\n\nexport default function GridItem({\n className,\n children,\n id,\n index,\n extendable = false,\n extended = false,\n disabled = false,\n // Picky stuff.\n style,\n editorStyle,\n iconColor = 'rgb(255, 255, 255)',\n ...props\n}: ItemProps) {\n const { vertical } = props as {\n end?: boolean;\n vertical?: boolean;\n };\n const { editing, isDragging, onExtend } = useAlignContext();\n const [isHovered, setHovered] = useState(false);\n const handleExtend = useCallback(() => {\n if (!extendable) return;\n setHovered(false);\n onExtend?.(id, !extended);\n }, [extendable, onExtend, extended, id]);\n\n const buttonStyles: CSSProperties = useMemo(\n () => ({\n alignItems: 'start',\n float: 'left',\n color: iconColor,\n }),\n [iconColor]\n );\n\n const ctx = useMemo(\n () => ({\n id,\n editing,\n isDragging,\n isHovered,\n extended,\n extendable,\n disabled,\n index,\n }),\n [disabled, editing, extendable, extended, id, index, isDragging, isHovered]\n );\n\n return (\n <Draggable draggableId={id} index={index} isDragDisabled={disabled}>\n {(provided, snapshot) => (\n <div\n ref={provided.innerRef}\n {...provided.draggableProps}\n className={`${className} item`}\n style={{\n flex: extended && !snapshot.isDragging ? 'auto' : undefined,\n opacity: snapshot.isDragging ? 0.5 : 1,\n ...(editing ? editorStyle : style),\n ...provided.draggableProps.style,\n }}\n >\n <div\n style={{\n display: 'inline-block',\n position: 'relative',\n minHeight: isHovered && !disabled ? '35px' : undefined,\n width: !vertical && extended ? '100%' : undefined,\n minWidth:\n isHovered && !disabled\n ? extendable\n ? '70px'\n : '35px'\n : undefined,\n height: vertical && extended ? '100%' : undefined,\n }}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n >\n {typeof children === 'function' ? children(ctx) : children}\n <div\n className=\"overlay\"\n style={{\n display:\n !disabled &&\n editing &&\n isHovered &&\n (snapshot.isDragging || !isDragging)\n ? 'block'\n : 'none',\n }}\n >\n <div className=\"overlay-buttons\" style={buttonStyles}>\n <div {...provided.dragHandleProps}>\n <Icon name=\"moveArrows\" />\n </div>\n {extendable && (\n <div\n style={{ cursor: 'pointer', marginLeft: '8px' }}\n onClick={handleExtend}\n >\n <Icon\n name={vertical ? 'verticalExtend' : 'horizontalExtend'}\n />\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n )}\n </Draggable>\n );\n}\n"],"names":["Context","createContext","editing","isDragging","useAlignContext","useContext","GridWrapper","className","children","vertical","stretch","style","editorStyle","onMove","onAlignChange","onExtend","useState","setDragging","handleDragStart","useCallback","handleDragEnd","result","_provided","destination","reason","droppableId","source","index","draggableId","React","DragDropContext","onDragStart","onDragEnd","Provider","value","GridSection","horizontal","fixedWidth","fixedHeight","enabled","height","width","horizontalExtend","HorizontalExtend","horizontalNormal","HorizontalNormal","verticalExtend","VerticalExtend","verticalNormal","VerticalNormal","moveArrows","MoveArrows","alignStart","AlignStart","alignCenter","AlignCenter","alignEnd","AlignEnd","alignStartV","AlignStartV","alignCenterV","AlignCenterV","alignEndV","AlignEndV","Icon","name","onClick","LocalIconComponent","Icons","alignments","GridArea","id","end","disabled","align","iconColor","onAlignChange2","handleAlignChange","a","indexOf","length","buttonStyle","useMemo","position","left","undefined","right","bottom","top","opacity","pointerEvents","transition","childrenWithParentProps","Children","map","child","cloneElement","Droppable","direction","isDropDisabled","provided","snapshot","ref","innerRef","droppableProps","filter","Boolean","join","flexDirection","minHeight","count","minWidth","isDraggingOver","placeholder","cursor","color","GridItem","extendable","extended","props","isHovered","setHovered","handleExtend","buttonStyles","alignItems","ctx","Draggable","isDragDisabled","draggableProps","flex","display","onMouseEnter","onMouseLeave","dragHandleProps","marginLeft"],"mappings":";;;;;;;;;;AAGO,IAAMA,OAAO,gBAAGC,mBAAa,CAKjC;AAAEC,EAAAA,OAAO,EAAE,KAAX;AAAkBC,EAAAA,UAAU,EAAE;AAA9B,CALiC,CAA7B;AAMA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB;AAAA,SAAMC,gBAAU,CAACL,OAAD,CAAhB;AAAA,CAAxB;;ACTP,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK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MAAAA,OAAO,EAAEwD;KAFX,EAIE7F,4BAAA,CAACmC,IAAD;AACEC,MAAAA,IAAI,EAAExD,QAAQ,GAAG,gBAAH,GAAsB;KADtC,CAJF,CALJ,CAZF,CAlBF,CAXF,CADD;AAAA,GADH,CADF;AAiED;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n,r,i,o,a,l,s,c,d,h,u,p,g,f,v,m,y,x,w=require("react"),b=(e=w)&&"object"==typeof e&&"default"in e?e.default:e,E=require("react-beautiful-dnd"),O=require("glamor"),j=w.createContext({editing:!1,isDragging:!1}),z=function(){return w.useContext(j)};function M(){return(M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function C(){return(C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function k(){return(k=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function V(){return(V=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function D(){return(D=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function P(){return(P=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function H(){return(H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function N(){return(N=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function S(){return(S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function L(){return(L=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function R(){return(R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function I(){return(I=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".wrapper{height:100%}.section,.wrapper{display:flex;justify-content:space-between}.section{flex-direction:column}.area{border:1px solid transparent;border-radius:8px;box-sizing:border-box;display:flex;position:relative}.area-transition-in{transition:all .3s ease-in-out,min-height .5s ease-in-out .2s,min-width .5s ease-in-out .2s}.area-transition-out{transition:all .3s ease-in-out .4s,min-height .5s ease-in-out .2s,min-width .5s ease-in-out .2s}.item{border:1px solid transparent;border-radius:6px;box-sizing:border-box;margin:6px;min-height:40px;min-width:70px;position:relative}.stretch{flex:auto}.middle{flex-grow:0;flex:auto}.just-centered{justify-content:center}.just-end{justify-content:flex-end}.end{align-items:flex-end}.hide{display:none}.overlay{background:rgba(0,0,0,.6);bottom:0;box-sizing:border-box;left:0;position:absolute;right:0;top:0}.overlay-buttons{box-sizing:border-box;display:flex;justify-content:space-between;padding:6px}");var W={horizontalExtend:function(e){return w.createElement("svg",C({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),t||(t=w.createElement("path",{d:"M1 20.25V3.75M23 20.25V3.75M12 12h8.5M17.5 9l3 3-3 3M12 12H4M7 15l-3-3 3-3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},horizontalNormal:function(e){return w.createElement("svg",k({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n||(n=w.createElement("path",{d:"M1 12h5M3 9l3 3-3 3M23 12h-5M21 15l-3-3 3-3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),r||(r=w.createElement("rect",{x:8.75,y:2.75,width:6.5,height:18.5,rx:1.25,stroke:"currentColor",strokeWidth:1.5})))},verticalExtend:function(e){return w.createElement("svg",V({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),i||(i=w.createElement("path",{d:"M3.75 1h16.5M3.75 23h16.5M12 12v8.5M15 17.5l-3 3-3-3M12 12V4M9 7l3-3 3 3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},verticalNormal:function(e){return w.createElement("svg",D({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),o||(o=w.createElement("path",{d:"M12 1v5M15 3l-3 3-3-3M12 23v-5M9 21l3-3 3 3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),a||(a=w.createElement("rect",{x:21.25,y:8.75,width:6.5,height:18.5,rx:1.25,transform:"rotate(90 21.25 8.75)",stroke:"currentColor",strokeWidth:1.5})))},moveArrows:function(e){return w.createElement("svg",P({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),l||(l=w.createElement("path",{d:"M14.651 19.098L12 21.749l-2.652-2.651M12 15v6.75M9.348 4.902L12 2.25l2.651 2.652M12 9V2.25M4.902 14.65L2.25 12l2.652-2.652M9 12H2.25M19.098 9.348l2.652 2.651-2.652 2.652M15 12h6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},alignStart:function(e){return w.createElement("svg",H({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),s||(s=w.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),c||(c=w.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 5h14v14H5V5zM4 4h16v16H4V4zm2 6a1 1 0 012 0v4a1 1 0 11-2 0v-4zm3 0a1 1 0 012 0v4a1 1 0 11-2 0v-4zm4-1a1 1 0 00-1 1v4a1 1 0 102 0v-4a1 1 0 00-1-1z",fill:"currentColor"})))},alignCenter:function(e){return w.createElement("svg",N({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),d||(d=w.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),h||(h=w.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 19H5V5h14v14zm1 1H4V4h16v16zm-4-6a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-3 0a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-4 1a1 1 0 001-1v-4a1 1 0 10-2 0v4a1 1 0 001 1z",fill:"currentColor"})))},alignEnd:function(e){return w.createElement("svg",S({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),u||(u=w.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),p||(p=w.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 19H5V5h14v14zm1 1H4V4h16v16zm-2-6a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-3 0a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-4 1a1 1 0 001-1v-4a1 1 0 10-2 0v4a1 1 0 001 1z",fill:"currentColor"})))},alignStartV:function(e){return w.createElement("svg",L({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),g||(g=w.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),f||(f=w.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 5v14H5V5h14zm1-1v16H4V4h16zm-6 2a1 1 0 110 2h-4a1 1 0 110-2h4zm0 3a1 1 0 110 2h-4a1 1 0 110-2h4zm1 4a1 1 0 00-1-1h-4a1 1 0 100 2h4a1 1 0 001-1z",fill:"currentColor"})))},alignCenterV:function(e){return w.createElement("svg",R({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),v||(v=w.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),m||(m=w.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 5v14H5V5h14zm1-1v16H4V4h16zm-6 4a1 1 0 110 2h-4a1 1 0 110-2h4zm0 3a1 1 0 110 2h-4a1 1 0 110-2h4zm1 4a1 1 0 00-1-1h-4a1 1 0 100 2h4a1 1 0 001-1z",fill:"currentColor"})))},alignEndV:function(e){return w.createElement("svg",I({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),y||(y=w.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),x||(x=w.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 19V5h14v14H5zm-1 1V4h16v16H4zm6-2a1 1 0 110-2h4a1 1 0 110 2h-4zm0-3a1 1 0 110-2h4a1 1 0 110 2h-4zm-1-4a1 1 0 001 1h4a1 1 0 100-2h-4a1 1 0 00-1 1z",fill:"currentColor"})))}},A=function(e){var t,n=e.style,r=e.onClick;return b.createElement(W[e.name],Object.assign({className:e.className},O.css({cursor:"pointer",width:(t=e.size)||"24px",height:t||"24px"," svg":{height:t||"24px",width:t||"24px"}}),{style:n,onClick:r}))},F=["start","centered","end"];exports.GridArea=function(e){var t=e.id,n=e.className,r=e.vertical,i=e.stretch,o=e.end,a=e.disabled,l=e.align,s=e.onAlignmentChange,c=e.children,d=e.style,h=e.editorStyle,u=e.iconColor,p=void 0===u?"#FFFFFF":u,g=z(),f=g.editing,v=g.onAlignChange,m=w.useCallback((function(){var e=F[(l?F.indexOf(l)+1:0)%F.length];null==s||s(e),null==v||v(t,e)}),[l,s,v,t]),y=w.useMemo((function(){return{position:"absolute",left:r?o?0:void 0:"50%",right:r?o?void 0:0:"50%",bottom:r||o?r?"50%":void 0:0,top:r?"50%":o?0:void 0,opacity:!a&&f&&l?1:0,pointerEvents:!a&&f&&l?"auto":"none",transition:"all 0.5s ease-in-out"}}),[r,o,a,f,l]),x=w.useMemo((function(){return b.Children.map(c,(function(e){return b.cloneElement(e,{end:o,vertical:r})}))}),[c,o,r]);return b.createElement(E.Droppable,{droppableId:t,direction:r?"vertical":"horizontal",isDropDisabled:a},(function(e,t){return b.createElement("div",Object.assign({ref:e.innerRef},e.droppableProps,{className:[n,"area",i&&"stretch",o&&"end","centered"===l?"just-centered":"end"===l?"just-end":"start",f?"area-transition-in":"area-transition-out"].filter(Boolean).join(" "),style:M({flexDirection:r?"column":"row",minHeight:b.Children.count(c)||f?"26px":"0px",minWidth:b.Children.count(c)||f?"46px":"0px",opacity:t.isDraggingOver?.8:1},f?h:d)}),x,e.placeholder,b.createElement("div",{style:y},b.createElement("div",{onClick:m,style:{cursor:"pointer"}},b.createElement(A,{name:"centered"===l?r?"alignCenterV":"alignCenter":"end"===l?r?"alignEndV":"alignEnd":r?"alignStartV":"alignStart",style:{color:p}}))))}))},exports.GridItem=function(e){var t=e.className,n=e.children,r=e.id,i=e.index,o=e.extendable,a=void 0!==o&&o,l=e.extended,s=void 0!==l&&l,c=e.disabled,d=void 0!==c&&c,h=e.onExtend,u=e.style,p=e.editorStyle,g=e.iconSize,f=e.iconColor,v=void 0===f?"rgb(255, 255, 255)":f,m=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}(e,["className","children","id","index","extendable","extended","disabled","onExtend","style","editorStyle","iconSize","iconColor"]),y=m.end,x=m.vertical,O=z(),j=O.editing,C=O.isDragging,k=O.onExtend,V=w.useState(!1),D=V[0],P=V[1],H=w.useCallback((function(){a&&(P(!1),null==h||h(!s),null==k||k(r,!s))}),[a,h,s,k,r]),N=w.useMemo((function(){return{alignItems:y?"end":"start",float:y?"right":"left"}}),[y]),S=w.useMemo((function(){return{id:r,editing:j,isDragging:C,isHovered:D,extended:s,extendable:a,disabled:d,index:i}}),[d,j,a,s,r,i,C,D]);return b.createElement(E.Draggable,{draggableId:r,index:i,isDragDisabled:d},(function(e,r){return b.createElement("div",Object.assign({ref:e.innerRef},e.draggableProps,{className:t+" item",style:M({flex:s&&!r.isDragging?"auto":void 0,opacity:r.isDragging?.5:1},j?p:u,e.draggableProps.style),onMouseEnter:function(){return P(!0)},onMouseLeave:function(){return P(!1)}}),b.createElement("div",{style:{width:"100%",height:"100%",pointerEvents:j?"none":void 0}},"function"==typeof n?n(S):n),b.createElement("div",{className:"overlay",style:{display:d||!j||!D||!r.isDragging&&C?"none":"block"}},b.createElement("div",{className:"overlay-buttons",style:N},b.createElement("div",Object.assign({},e.dragHandleProps),b.createElement(A,{name:"moveArrows",size:g,style:{color:v}})),a&&b.createElement("div",{style:{cursor:"pointer",marginLeft:"8px"},onClick:H},b.createElement(A,{name:x?"verticalExtend":"horizontalExtend",size:g,style:{color:v}})))))}))},exports.GridSection=function(e){var t=e.className,n=e.horizontal,r=e.stretch,i=e.fixedWidth,o=e.fixedHeight,a=e.style,l=e.editorStyle,s=e.children,c=z();return b.createElement("div",{className:"section "+t+" "+(n?"horizontal":"")+" "+(r?"stretch":""),style:M({},c.editing?l:a,"number"==typeof o?{height:o+"px"}:{},"number"==typeof i?{width:i+"px"}:{})},s)},exports.GridWrapper=function(e){var t=e.className,n=e.editing,r=e.vertical,i=e.stretch,o=e.style,a=e.editorStyle,l=e.children,s=e.onMove,c=e.onAlignmentChange,d=e.onExtend,h=w.useState(!1),u=h[0],p=h[1],g=w.useCallback((function(){p(!0)}),[]),f=w.useCallback((function(e,t){p(!1),!e.destination||"DROP"!==e.reason||e.destination.droppableId===e.source.droppableId&&e.destination.index===e.source.index||null==s||s(e.draggableId,e.destination.droppableId,e.destination.index,e.source.droppableId,e.source.index)}),[s]);return b.createElement("div",{className:"wrapper "+t+" "+(r&&"vertical")+" "+(i&&"stretch"),style:n?a:o},b.createElement(E.DragDropContext,{onDragStart:g,onDragEnd:f},b.createElement(j.Provider,{value:{editing:!!n,onAlignChange:c,onExtend:d,isDragging:u}},l)))},exports.Icon=A;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n,r,i,o,a,l,s,c,d,h,u,p,g,v,f,m,y,w,x=require("react"),b=(e=x)&&"object"==typeof e&&"default"in e?e.default:e,E=require("react-beautiful-dnd"),O=x.createContext({editing:!1,isDragging:!1}),j=function(){return x.useContext(O)};function M(){return(M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function C(){return(C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function z(){return(z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function k(){return(k=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function V(){return(V=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function D(){return(D=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function H(){return(H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function P(){return(P=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function N(){return(N=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function L(){return(L=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function R(){return(R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function S(){return(S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".wrapper{height:100%}.section,.wrapper{display:flex;justify-content:space-between}.section{flex-direction:column}.area{border:0 solid transparent;border-radius:8px;box-sizing:border-box;display:flex;position:relative}.area-transition-in{transition:all .3s ease-in-out,min-height .5s ease-in-out .2s,min-width .5s ease-in-out .2s}.area-transition-out{transition:all .3s ease-in-out .4s,min-height .5s ease-in-out .2s,min-width .5s ease-in-out .2s}.item{border:0 solid transparent;border-radius:6px;margin:6px;position:relative}.stretch{flex:auto}.middle{flex-grow:0;flex:auto}.just-centered{justify-content:center}.just-end{justify-content:flex-end}.end{align-items:flex-end}.hide{display:none}.overlay{background:rgba(0,0,0,.6);box-sizing:border-box;height:100%;left:0;position:absolute;top:0;width:100%}.overlay-buttons{box-sizing:border-box;display:flex;justify-content:space-between;padding:6px}");var W={horizontalExtend:function(e){return x.createElement("svg",C({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),t||(t=x.createElement("path",{d:"M1 20.25V3.75M23 20.25V3.75M12 12h8.5M17.5 9l3 3-3 3M12 12H4M7 15l-3-3 3-3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},horizontalNormal:function(e){return x.createElement("svg",z({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n||(n=x.createElement("path",{d:"M1 12h5M3 9l3 3-3 3M23 12h-5M21 15l-3-3 3-3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),r||(r=x.createElement("rect",{x:8.75,y:2.75,width:6.5,height:18.5,rx:1.25,stroke:"currentColor",strokeWidth:1.5})))},verticalExtend:function(e){return x.createElement("svg",k({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),i||(i=x.createElement("path",{d:"M3.75 1h16.5M3.75 23h16.5M12 12v8.5M15 17.5l-3 3-3-3M12 12V4M9 7l3-3 3 3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},verticalNormal:function(e){return x.createElement("svg",V({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),o||(o=x.createElement("path",{d:"M12 1v5M15 3l-3 3-3-3M12 23v-5M9 21l3-3 3 3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),a||(a=x.createElement("rect",{x:21.25,y:8.75,width:6.5,height:18.5,rx:1.25,transform:"rotate(90 21.25 8.75)",stroke:"currentColor",strokeWidth:1.5})))},moveArrows:function(e){return x.createElement("svg",D({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),l||(l=x.createElement("path",{d:"M14.651 19.098L12 21.749l-2.652-2.651M12 15v6.75M9.348 4.902L12 2.25l2.651 2.652M12 9V2.25M4.902 14.65L2.25 12l2.652-2.652M9 12H2.25M19.098 9.348l2.652 2.651-2.652 2.652M15 12h6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},alignStart:function(e){return x.createElement("svg",H({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),s||(s=x.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),c||(c=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 5h14v14H5V5zM4 4h16v16H4V4zm2 6a1 1 0 012 0v4a1 1 0 11-2 0v-4zm3 0a1 1 0 012 0v4a1 1 0 11-2 0v-4zm4-1a1 1 0 00-1 1v4a1 1 0 102 0v-4a1 1 0 00-1-1z",fill:"currentColor"})))},alignCenter:function(e){return x.createElement("svg",P({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),d||(d=x.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),h||(h=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 19H5V5h14v14zm1 1H4V4h16v16zm-4-6a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-3 0a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-4 1a1 1 0 001-1v-4a1 1 0 10-2 0v4a1 1 0 001 1z",fill:"currentColor"})))},alignEnd:function(e){return x.createElement("svg",N({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),u||(u=x.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),p||(p=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 19H5V5h14v14zm1 1H4V4h16v16zm-2-6a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-3 0a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-4 1a1 1 0 001-1v-4a1 1 0 10-2 0v4a1 1 0 001 1z",fill:"currentColor"})))},alignStartV:function(e){return x.createElement("svg",L({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),g||(g=x.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),v||(v=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 5v14H5V5h14zm1-1v16H4V4h16zm-6 2a1 1 0 110 2h-4a1 1 0 110-2h4zm0 3a1 1 0 110 2h-4a1 1 0 110-2h4zm1 4a1 1 0 00-1-1h-4a1 1 0 100 2h4a1 1 0 001-1z",fill:"currentColor"})))},alignCenterV:function(e){return x.createElement("svg",R({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),f||(f=x.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),m||(m=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 5v14H5V5h14zm1-1v16H4V4h16zm-6 4a1 1 0 110 2h-4a1 1 0 110-2h4zm0 3a1 1 0 110 2h-4a1 1 0 110-2h4zm1 4a1 1 0 00-1-1h-4a1 1 0 100 2h4a1 1 0 001-1z",fill:"currentColor"})))},alignEndV:function(e){return x.createElement("svg",S({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),y||(y=x.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),w||(w=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 19V5h14v14H5zm-1 1V4h16v16H4zm6-2a1 1 0 110-2h4a1 1 0 110 2h-4zm0-3a1 1 0 110-2h4a1 1 0 110 2h-4zm-1-4a1 1 0 001 1h4a1 1 0 100-2h-4a1 1 0 00-1 1z",fill:"currentColor"})))}},I=function(e){return b.createElement(W[e.name],{className:e.className,onClick:e.onClick})},A=["start","centered","end"];exports.GridArea=function(e){var t=e.id,n=e.className,r=e.vertical,i=e.stretch,o=e.end,a=e.disabled,l=e.align,s=e.onAlignChange,c=e.children,d=e.style,h=e.editorStyle,u=e.iconColor,p=void 0===u?"#FFFFFF":u,g=j(),v=g.editing,f=g.onAlignChange,m=x.useCallback((function(){var e=A[(l?A.indexOf(l)+1:0)%A.length];null==s||s(e),null==f||f(t,e)}),[l,s,f,t]),y=x.useMemo((function(){return{position:"absolute",left:r?o?0:void 0:"50%",right:r?o?void 0:0:"50%",bottom:r||o?r?"50%":void 0:0,top:r?"50%":o?0:void 0,opacity:!a&&v&&l?1:0,pointerEvents:!a&&v&&l?"auto":"none",transition:"all 0.5s ease-in-out"}}),[r,o,a,v,l]),w=x.useMemo((function(){return b.Children.map(c,(function(e){return b.cloneElement(e,{end:o,vertical:r})}))}),[c,o,r]);return b.createElement(E.Droppable,{droppableId:t,direction:r?"vertical":"horizontal",isDropDisabled:a},(function(e,t){return b.createElement("div",Object.assign({ref:e.innerRef},e.droppableProps,{className:[n,"area",i&&"stretch",o&&"end","centered"===l?"just-centered":"end"===l?"just-end":"start",v?"area-transition-in":"area-transition-out"].filter(Boolean).join(" "),style:M({flexDirection:r?"column":"row",minHeight:b.Children.count(c)||v?"26px":"0px",minWidth:b.Children.count(c)||v?"46px":"0px",opacity:t.isDraggingOver?.8:1},v?h:d)}),w,e.placeholder,b.createElement("div",{style:y},b.createElement("div",{onClick:m,style:{cursor:"pointer",color:p}},b.createElement(I,{name:"centered"===l?r?"alignCenterV":"alignCenter":"end"===l?r?"alignEndV":"alignEnd":r?"alignStartV":"alignStart"}))))}))},exports.GridItem=function(e){var t=e.className,n=e.children,r=e.id,i=e.index,o=e.extendable,a=void 0!==o&&o,l=e.extended,s=void 0!==l&&l,c=e.disabled,d=void 0!==c&&c,h=e.style,u=e.editorStyle,p=e.iconColor,g=void 0===p?"rgb(255, 255, 255)":p,v=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}(e,["className","children","id","index","extendable","extended","disabled","style","editorStyle","iconColor"]).vertical,f=j(),m=f.editing,y=f.isDragging,w=f.onExtend,O=x.useState(!1),C=O[0],z=O[1],k=x.useCallback((function(){a&&(z(!1),null==w||w(r,!s))}),[a,w,s,r]),V=x.useMemo((function(){return{alignItems:"start",float:"left",color:g}}),[g]),D=x.useMemo((function(){return{id:r,editing:m,isDragging:y,isHovered:C,extended:s,extendable:a,disabled:d,index:i}}),[d,m,a,s,r,i,y,C]);return b.createElement(E.Draggable,{draggableId:r,index:i,isDragDisabled:d},(function(e,r){return b.createElement("div",Object.assign({ref:e.innerRef},e.draggableProps,{className:t+" item",style:M({flex:s&&!r.isDragging?"auto":void 0,opacity:r.isDragging?.5:1},m?u:h,e.draggableProps.style)}),b.createElement("div",{style:{display:"inline-block",position:"relative",minHeight:C&&!d?"35px":void 0,width:!v&&s?"100%":void 0,minWidth:C&&!d?a?"70px":"35px":void 0,height:v&&s?"100%":void 0},onMouseEnter:function(){return z(!0)},onMouseLeave:function(){return z(!1)}},"function"==typeof n?n(D):n,b.createElement("div",{className:"overlay",style:{display:d||!m||!C||!r.isDragging&&y?"none":"block"}},b.createElement("div",{className:"overlay-buttons",style:V},b.createElement("div",Object.assign({},e.dragHandleProps),b.createElement(I,{name:"moveArrows"})),a&&b.createElement("div",{style:{cursor:"pointer",marginLeft:"8px"},onClick:k},b.createElement(I,{name:v?"verticalExtend":"horizontalExtend"}))))))}))},exports.GridSection=function(e){var t=e.className,n=e.children,r=e.horizontal,i=e.stretch,o=e.fixedWidth,a=e.fixedHeight,l=e.style,s=e.editorStyle,c=j();return b.createElement("div",{className:"section "+t+" "+(r?"horizontal":"")+" "+(i?"stretch":""),style:M({},c.editing?s:l,"number"==typeof a?{height:a+"px"}:{},"number"==typeof o?{width:o+"px"}:{})},n)},exports.GridWrapper=function(e){var t=e.className,n=e.children,r=e.editing,i=e.vertical,o=e.stretch,a=e.style,l=e.editorStyle,s=e.onMove,c=e.onAlignChange,d=e.onExtend,h=x.useState(!1),u=h[0],p=h[1],g=x.useCallback((function(){p(!0)}),[]),v=x.useCallback((function(e,t){p(!1),!e.destination||"DROP"!==e.reason||e.destination.droppableId===e.source.droppableId&&e.destination.index===e.source.index||null==s||s(e.draggableId,e.destination.droppableId,e.destination.index,e.source.droppableId,e.source.index)}),[s]);return b.createElement("div",{className:"wrapper "+t+" "+(i&&"vertical")+" "+(o&&"stretch"),style:r?l:a},b.createElement(E.DragDropContext,{onDragStart:g,onDragEnd:v},b.createElement(O.Provider,{value:{editing:!!r,onAlignChange:c,onExtend:d,isDragging:u}},n)))},exports.Icon=I;
|
|
2
2
|
//# sourceMappingURL=react-align.cjs.production.min.js.map
|