Sha256: 868abdfa21079e81221389b49f0c8ba6efa45364901c6b74af6007c41b45a054

Contents?: true

Size: 1.07 KB

Versions: 62

Compression:

Stored size: 1.07 KB

Contents

import React, { useState } from "react";
import { SelectableList, DraggableProvider } from "../../";

// Initial items to be dragged
const data = [
  {
    id: "41",
    text: "Task 1",
  },
  {
    id: "42",
    text: "Task 2",
  },
  {
    id: "43",
    text: "Task 3",
  },
  {
    id: "44",
    text: "Task 4",
  },
];

const DraggableWithSelectableList = (props) => {
  const [initialState, setInitialState] = useState(data);

  return (
    <>
    <DraggableProvider initialItems={data}
        onReorder={(items) => setInitialState(items)}
    >
          <SelectableList enableDrag
              variant="radio"
              {...props}
              >
            {initialState.map(({ id, text }) => (
                <SelectableList.Item 
                    dragId={id}
                    key={id}
                    label={text} 
                    name="radio-test" 
                    value={id}
                    {...props}
                />
            ))}
          </SelectableList>
    </DraggableProvider>
    </>

  );
};

export default DraggableWithSelectableList

Version data entries

62 entries across 62 versions & 2 rubygems

Version Path
playbook_ui_docs-13.34.1.pre.alpha.play1407statvaluekitinconsistencies3388 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.34.1.pre.alpha.play1407statvaluekitinconsistencies3388 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui_docs-13.34.1.pre.alpha.PLAY14703378 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.34.1.pre.alpha.PLAY14703378 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui_docs-13.34.1 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.34.1 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3370 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3370 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3369 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3369 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3368 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui_docs-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3366 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3366 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.34.0 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui_docs-13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui_docs-13.33.1.pre.alpha.PLAY14063320 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.33.1.pre.alpha.PLAY14063320 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui-13.33.1 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx
playbook_ui_docs-13.33.0.pre.alpha.PBNTR405dropdownformfixesrails3311 app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx