@cimpress/react-components
Version:
React components to support the MCP styleguide
107 lines • 4.52 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const react_components_1 = require("@cimpress/react-components");
const TabbedComponentDoc_1 = __importDefault(require("../../shared/TabbedComponentDoc"));
const draganddrop_jsx_1 = __importDefault(require("!raw-loader!./draganddrop.jsx"));
const draganddrop_jsx_2 = __importDefault(require("./draganddrop.jsx"));
const DragAndDropDocs = () => {
/* DragAndDrop props */
const dragAndDropPropInfos = [
{
name: 'onDragEnd',
type: 'function (required)',
default: '',
description: 'The function triggered when dragging a Draggable completes',
},
{
name: 'additionalProps',
default: '',
type: '',
description: (react_1.default.createElement("span", null,
"See the",
react_1.default.createElement("a", { href: "https://github.com/atlassian/react-beautiful-dnd/blob/master/docs/api/drag-drop-context.md#props" }, "react-beautiful-dnd DragDropContext documentation"),
"for more available props")),
},
];
/* Droppable props */
const droppablePropInfos = [
{
name: 'droppableId',
type: 'string (required)',
default: '',
description: 'The unique id for the droppable area',
},
{
name: 'isEmpty',
type: 'boolean',
default: 'false',
description: `Indicates that the droppable does not have any draggable elements inside.
If provided, this will render the 'emptyPlaceholder' when the droppable is empty`,
},
{
name: 'emptyPlaceholder',
type: 'node',
default: '',
description: 'The React element rendered when the droppable is empty',
},
{
name: 'children',
type: 'node',
default: '',
description: (react_1.default.createElement("span", null,
"The inner contents of the component. Children should be draggable via ",
react_1.default.createElement("code", null, "withDraggable"))),
},
];
/* withDraggable props */
const withDraggablePropInfos = [
{
name: 'draggableId',
type: 'string (required)',
default: '',
description: 'A unique id for the draggable element',
},
{
name: 'index',
type: 'number (required)',
default: '',
description: 'A unique number generated sequentially, usually from Array.prototype.map',
},
{
name: 'icon',
type: 'node (required)',
default: '',
description: 'The draggable grip icon, usually IconDragDrop',
},
{
name: 'isDragDisabled',
type: 'boolean',
default: 'false',
description: 'Controls whether or not the Draggable is permitted to drag',
},
{
name: 'showPlaceholderWhileDragging',
type: 'boolean',
default: 'false',
description: 'Controls whether or not a placeholder element is left behind while the dragging the Draggable',
},
{
name: 'style',
type: 'object',
default: '',
description: 'Additional style properties that can be used to override default react-beautiful-dnd styles',
},
];
return (react_1.default.createElement(react_1.default.Fragment, null,
react_1.default.createElement(TabbedComponentDoc_1.default, { name: "DragAndDrop", propInfos: dragAndDropPropInfos }),
react_1.default.createElement(TabbedComponentDoc_1.default, { name: "Droppable", includeTabs: false, propInfos: droppablePropInfos }),
react_1.default.createElement(TabbedComponentDoc_1.default, { name: "withDraggable", includeTabs: false, propInfos: withDraggablePropInfos },
react_1.default.createElement(draganddrop_jsx_2.default, null),
react_1.default.createElement(react_components_1.CodeExample, { code: draganddrop_jsx_1.default }))));
};
exports.default = DragAndDropDocs;
//# sourceMappingURL=index.js.map