react-align 2.0.1 → 2.0.2
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/react-align.cjs.development.js +2 -0
- 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 +2 -0
- package/dist/react-align.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/GridItem.tsx +7 -1
|
@@ -600,6 +600,8 @@ function GridItem(_ref) {
|
|
|
600
600
|
}
|
|
601
601
|
}), React__default.createElement("div", {
|
|
602
602
|
style: {
|
|
603
|
+
width: '100%',
|
|
604
|
+
height: '100%',
|
|
603
605
|
pointerEvents: editing ? 'none' : undefined
|
|
604
606
|
}
|
|
605
607
|
}, typeof children === 'function' ? children(ctx) : children), React__default.createElement("div", {
|
|
@@ -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 style={{ pointerEvents: editing ? 'none' : undefined }}>\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"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AD,CAAzC,GAAiDvH,QADpD,CAbF,EAgBEkB,4BAAA,MAAA;AACEvB,MAAAA,SAAS,EAAC;AACVG,MAAAA,KAAK,EAAE;AACLgI,QAAAA,OAAO,EACL,CAAC5D,QAAD,IACA5E,OADA,IAEA4H,SAFA,KAGCpB,QAAQ,CAACvG,UAAT,IAAuB,CAACA,UAHzB,IAII,OAJJ,GAKI;AAPD;KAFT,EAYE2B,4BAAA,MAAA;AAAKvB,MAAAA,SAAS,EAAC;AAAkBG,MAAAA,KAAK,EAAEuH;KAAxC,EACEnG,4BAAA,MAAA,oBAAS2E,QAAQ,CAACkC,gBAAlB,EACE7G,4BAAA,CAACuC,IAAD;AACEC,MAAAA,IAAI,EAAC;AACLJ,MAAAA,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,CAhBF,CADD;AAAA,GADH,CADF;AAyDD;;;;;;;;"}
|
|
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;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAA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AAAA,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,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:{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,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;
|
|
2
2
|
//# sourceMappingURL=react-align.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-align.cjs.production.min.js","sources":["../src/context.tsx","../node_modules/style-inject/dist/style-inject.es.js","../src/Icon/icons.ts","../src/Icon/index.tsx","../src/GridArea.tsx","../src/GridItem.tsx","../src/GridSection.tsx","../src/GridWrapper.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 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 style={{ pointerEvents: editing ? 'none' : undefined }}>\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","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 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"],"names":["Context","createContext","editing","isDragging","useAlignContext","useContext","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","horizontalExtend","horizontalNormal","verticalExtend","verticalNormal","moveArrows","alignStart","alignCenter","alignEnd","alignStartV","alignCenterV","alignEndV","Icon","size","onClick","React","Icons","name","className","cursor","width","height","alignments","id","vertical","stretch","end","disabled","align","onAlignmentChange","children","editorStyle","iconColor","enabled","onAlignChange2","onAlignChange","handleAlignChange","useCallback","a","indexOf","length","buttonStyle","useMemo","position","left","undefined","right","bottom","top","opacity","pointerEvents","transition","childrenWithParentProps","Children","map","child","cloneElement","Droppable","droppableId","direction","isDropDisabled","provided","snapshot","innerRef","droppableProps","filter","Boolean","join","flexDirection","minHeight","count","minWidth","isDraggingOver","placeholder","color","index","extendable","extended","onExtend","iconSize","props","onExtend2","useState","isHovered","setHovered","handleExtend","buttonStyles","alignItems","ctx","Draggable","draggableId","isDragDisabled","draggableProps","flex","onMouseEnter","onMouseLeave","display","dragHandleProps","marginLeft","horizontal","fixedWidth","fixedHeight","onMove","setDragging","handleDragStart","handleDragEnd","result","_provided","destination","reason","source","DragDropContext","onDragStart","onDragEnd","Provider","value"],"mappings":"+OAGaA,EAAUC,gBAKpB,CAAEC,SAAS,EAAOC,YAAY,IACpBC,EAAkB,kBAAMC,aAAWL,y7ECThD,SAAqBM,EAAKC,QACX,IAARA,IAAiBA,EAAM,IAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,+7BCX9C,MAAe,CACbe,wUACAC,4ZACAC,oUACAC,6bACAC,4aACAC,ucACAC,4cACAC,ycACAC,yeACAC,0eACAC,yeCGIC,EAA4B,gBAXdC,EAelBrB,IAAAA,MACAsB,IAAAA,eAIEC,gBAFyBC,IAL3BC,qBAQIC,YATJA,WAXAhC,MAAI,CACFiC,OAAQ,UACRC,OAHgBP,IAclBA,OAXiB,OACfQ,OAAQR,GAAQ,cACR,CACNQ,OAAQR,GAAQ,OAChBO,MAAOP,GAAQ,WAgBfrB,MAAOA,EACPsB,QAASA,MCVTQ,EAAa,CAAC,QAAS,WAAY,wCAGvCC,IAAAA,GACAL,IAAAA,UACAM,IAAAA,SACAC,IAAAA,QACAC,IAAAA,IACAC,IAA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OAAYwH,OAEbC,EAAkBnE,eAAY,WAClCkE,GAAY,KACX,IAEGE,EAAgBpE,eACpB,SAACqE,EAAoBC,GACnBJ,GAAY,IAETG,EAAOE,aACU,SAAlBF,EAAOG,QACNH,EAAOE,YAAYlD,cAAgBgD,EAAOI,OAAOpD,aAChDgD,EAAOE,YAAYjC,QAAU+B,EAAOI,OAAOnC,aAG/C2B,GAAAA,EACEI,EAAOhB,YACPgB,EAAOE,YAAYlD,YACnBgD,EAAOE,YAAYjC,MACnB+B,EAAOI,OAAOpD,YACdgD,EAAOI,OAAOnC,SAGlB,CAAC2B,WAIDvF,uBACEG,qBAAsBA,OAAaM,GAAY,iBAAcC,GAC3D,WACFjC,MAAOV,EAAUiD,EAAcvC,GAE/BuB,gBAACgG,mBAAgBC,YAAaR,EAAiBS,UAAWR,GACxD1F,gBAACnC,EAAQsI,UACPC,MAAO,CAAErI,UAAWA,EAASqD,cAAAA,EAAe2C,SAAAA,EAAU/F,WAAAA,IAErD+C"}
|
|
1
|
+
{"version":3,"file":"react-align.cjs.production.min.js","sources":["../src/context.tsx","../node_modules/style-inject/dist/style-inject.es.js","../src/Icon/icons.ts","../src/Icon/index.tsx","../src/GridArea.tsx","../src/GridItem.tsx","../src/GridSection.tsx","../src/GridWrapper.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 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","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 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"],"names":["Context","createContext","editing","isDragging","useAlignContext","useContext","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","horizontalExtend","horizontalNormal","verticalExtend","verticalNormal","moveArrows","alignStart","alignCenter","alignEnd","alignStartV","alignCenterV","alignEndV","Icon","size","onClick","React","Icons","name","className","cursor","width","height","alignments","id","vertical","stretch","end","disabled","align","onAlignmentChange","children","editorStyle","iconColor","enabled","onAlignChange2","onAlignChange","handleAlignChange","useCallback","a","indexOf","length","buttonStyle","useMemo","position","left","undefined","right","bottom","top","opacity","pointerEvents","transition","childrenWithParentProps","Children","map","child","cloneElement","Droppable","droppableId","direction","isDropDisabled","provided","snapshot","innerRef","droppableProps","filter","Boolean","join","flexDirection","minHeight","count","minWidth","isDraggingOver","placeholder","color","index","extendable","extended","onExtend","iconSize","props","onExtend2","useState","isHovered","setHovered","handleExtend","buttonStyles","alignItems","ctx","Draggable","draggableId","isDragDisabled","draggableProps","flex","onMouseEnter","onMouseLeave","display","dragHandleProps","marginLeft","horizontal","fixedWidth","fixedHeight","onMove","setDragging","handleDragStart","handleDragEnd","result","_provided","destination","reason","source","DragDropContext","onDragStart","onDragEnd","Provider","value"],"mappings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EAAOE,YAAYjC,MACnB+B,EAAOI,OAAOpD,YACdgD,EAAOI,OAAOnC,SAGlB,CAAC2B,WAIDvF,uBACEG,qBAAsBA,OAAaM,GAAY,iBAAcC,GAC3D,WACFjC,MAAOV,EAAUiD,EAAcvC,GAE/BuB,gBAACgG,mBAAgBC,YAAaR,EAAiBS,UAAWR,GACxD1F,gBAACnC,EAAQsI,UACPC,MAAO,CAAErI,UAAWA,EAASqD,cAAAA,EAAe2C,SAAAA,EAAU/F,WAAAA,IAErD+C"}
|
package/dist/react-align.esm.js
CHANGED
|
@@ -593,6 +593,8 @@ function GridItem(_ref) {
|
|
|
593
593
|
}
|
|
594
594
|
}), React__default.createElement("div", {
|
|
595
595
|
style: {
|
|
596
|
+
width: '100%',
|
|
597
|
+
height: '100%',
|
|
596
598
|
pointerEvents: editing ? 'none' : undefined
|
|
597
599
|
}
|
|
598
600
|
}, typeof children === 'function' ? children(ctx) : children), React__default.createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-align.esm.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 style={{ pointerEvents: editing ? 'none' : undefined }}>\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","onMouseE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Q,CAACuH,GAAD,CAAzC,GAAiDvH,QADpD,CAbF,EAgBEkB,4BAAA,MAAA;AACEvB,MAAAA,SAAS,EAAC;AACVG,MAAAA,KAAK,EAAE;AACLgI,QAAAA,OAAO,EACL,CAAC5D,QAAD,IACA5E,OADA,IAEA4H,SAFA,KAGCpB,QAAQ,CAACvG,UAAT,IAAuB,CAACA,UAHzB,IAII,OAJJ,GAKI;AAPD;KAFT,EAYE2B,4BAAA,MAAA;AAAKvB,MAAAA,SAAS,EAAC;AAAkBG,MAAAA,KAAK,EAAEuH;KAAxC,EACEnG,4BAAA,MAAA,oBAAS2E,QAAQ,CAACkC,gBAAlB,EACE7G,4BAAA,CAACuC,IAAD;AACEC,MAAAA,IAAI,EAAC;AACLJ,MAAAA,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,CAhBF,CADD;AAAA,GADH,CADF;AAyDD;;;;"}
|
|
1
|
+
{"version":3,"file":"react-align.esm.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,aAAa,CAKjC;AAAEC,EAAAA,OAAO,EAAE,KAAX;AAAkBC,EAAAA,UAAU,EAAE;AAA9B,CALiC,CAA7B;AAMA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB;AAAA,SAAMC,UAAU,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;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAA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AE9D,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;;;;"}
|
package/package.json
CHANGED
package/src/GridItem.tsx
CHANGED
|
@@ -105,7 +105,13 @@ export default function GridItem({
|
|
|
105
105
|
onMouseEnter={() => setHovered(true)}
|
|
106
106
|
onMouseLeave={() => setHovered(false)}
|
|
107
107
|
>
|
|
108
|
-
<div
|
|
108
|
+
<div
|
|
109
|
+
style={{
|
|
110
|
+
width: '100%',
|
|
111
|
+
height: '100%',
|
|
112
|
+
pointerEvents: editing ? 'none' : undefined,
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
109
115
|
{typeof children === 'function' ? children(ctx) : children}
|
|
110
116
|
</div>
|
|
111
117
|
<div
|