playbook_ui 13.29.0.pre.alpha.testingcollapsibleissue3052 → 13.30.0.pre.alpha.PLAY1328fixtimelinekitglobalpropsreact3096

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/index.js +1 -0
  4. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.html.erb +58 -0
  5. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.jsx +68 -0
  6. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +2 -0
  7. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
  8. data/app/pb_kits/playbook/pb_card/_card.scss +5 -0
  9. data/app/pb_kits/playbook/pb_card/_card.tsx +56 -9
  10. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +9 -5
  11. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +2 -3
  12. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +2 -2
  13. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +1 -1
  14. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +1 -1
  15. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx +8 -7
  16. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.md +1 -0
  17. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx +13 -32
  18. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.md +3 -0
  19. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx +5 -5
  20. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +1 -1
  21. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx +5 -5
  22. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +1 -3
  23. data/app/pb_kits/playbook/pb_overlay/_overlay.scss +72 -0
  24. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +78 -0
  25. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.jsx +40 -0
  26. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +7 -0
  27. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_multi_directional.jsx +36 -0
  28. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_multi_directional.md +5 -0
  29. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +4 -0
  30. data/app/pb_kits/playbook/pb_overlay/docs/index.js +2 -0
  31. data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +66 -0
  32. data/app/pb_kits/playbook/pb_overlay/subcomponents/_overlay_percentage.tsx +57 -0
  33. data/app/pb_kits/playbook/pb_overlay/subcomponents/_overlay_token.tsx +48 -0
  34. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +43 -25
  35. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column_rails.html.erb +32 -33
  36. data/app/pb_kits/playbook/pb_table/table_header.html.erb +0 -2
  37. data/app/pb_kits/playbook/pb_timeline/_item.tsx +11 -10
  38. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +8 -6
  39. data/app/pb_kits/playbook/playbook-doc.js +2 -0
  40. data/dist/menu.yml +5 -1
  41. data/dist/playbook-rails.js +6 -6
  42. data/lib/playbook/kit_base.rb +19 -0
  43. data/lib/playbook/version.rb +2 -2
  44. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4dfe0653d86e536e79e7cd2537477204d815b54a27255442ac5ba1d6df6ac6d
4
- data.tar.gz: 8da9b6c0fb744f9a37347fdf3bec56a8c435a3aeeab1933d3441ef5cb6f846fb
3
+ metadata.gz: 9bec2adcbbd24c7d8dedcfd434368fd206154d30a3f22011db8fd8c17bd2002b
4
+ data.tar.gz: a5afc1f25e3609873b5bb0ba02d8c796ae9060cdd6aff33fcf103ec9fe88b7de
5
5
  SHA512:
6
- metadata.gz: 478df642a3c3079adf7eb546dc8f3a938717d5bb0f50d32e8dd70ebac1f6c16909fa21e613a262e2c94dcafbd5649acb2a2d3daa682ddc5a3f7961986d5aac37
7
- data.tar.gz: 0ed83b2e971d7bbf15df28168199a3a9d063abc043df74ea6ac1db4c95cbcfec79883f6c5cba1be43fe9fe9375d26f252ee07ed7f91781035837c8903314a766
6
+ metadata.gz: d754acdd73fd036d57ec1fcf6cd21891a5a872268448021ba01d407cdb7c60f990b1a1cfd3680cbd6801e367eb33d919a6725f2747b8f0ba10cbf6657803720f
7
+ data.tar.gz: 9bc1f39ec7aa9bcdf8fb27aa9ac0bb50919a4e94b1db0cae50233701639a78b9963c60b2e3c8c39363e2b9548b3909e167c7bcbd486163283f7d9fcf82b1fe18
@@ -62,6 +62,7 @@
62
62
  @import 'pb_multiple_users_stacked/multiple_users_stacked';
63
63
  @import 'pb_nav/nav';
64
64
  @import 'pb_online_status/online_status';
65
+ @import 'pb_overlay/overlay';
65
66
  @import 'pb_pagination/pagination';
66
67
  @import 'pb_passphrase/passphrase';
67
68
  @import 'pb_person/person';
@@ -72,6 +72,7 @@ export { default as MultipleUsersStacked } from './pb_multiple_users_stacked/_mu
72
72
  export { default as Nav } from './pb_nav/_nav'
73
73
  export { default as NavItem } from './pb_nav/_item'
74
74
  export { default as OnlineStatus } from './pb_online_status/_online_status'
75
+ export { default as Overlay} from './pb_overlay/_overlay'
75
76
  export { default as Passphrase } from './pb_passphrase/_passphrase'
76
77
  export { default as PbReactPopover } from './pb_popover/_popover'
77
78
  export { default as Person } from './pb_person/_person'
@@ -0,0 +1,58 @@
1
+ <% bar_graph_options = {
2
+ customOptions: {
3
+ chart: {
4
+ type: 'bar'
5
+ },
6
+ title: {
7
+ text: 'Historic World Population by Region',
8
+ align: 'left'
9
+ },
10
+ subtitle: {
11
+ text: 'Source: <a ' +
12
+ 'href="https://en.wikipedia.org/wiki/List_of_continents_and_continental_subregions_by_population"' +
13
+ 'target="_blank">Wikipedia.org</a>',
14
+ align: 'left'
15
+ },
16
+ xAxis: {
17
+ categories: ['Africa', 'America', 'Asia', 'Europe'],
18
+ lineWidth: 0
19
+ },
20
+ yAxis: {
21
+ min: 0,
22
+ title: {
23
+ text: 'Population (millions)',
24
+ align: 'high'
25
+ },
26
+ labels: {
27
+ overflow: 'justify'
28
+ },
29
+ },
30
+ tooltip: {
31
+ valueSuffix: ' millions'
32
+ },
33
+ plotOptions: {
34
+ bar: {
35
+ dataLabels: {
36
+ enabled: true
37
+ },
38
+ groupPadding: 0.1
39
+ }
40
+ },
41
+ series: [{
42
+ name: 'Year 1990',
43
+ data: [631, 727, 3202, 721]
44
+ }, {
45
+ name: 'Year 2000',
46
+ data: [814, 841, 3714, 726]
47
+ }, {
48
+ name: 'Year 2018',
49
+ data: [1276, 1007, 4561, 746]
50
+ }]
51
+ }
52
+ } %>
53
+
54
+ <%= pb_rails("bar_graph", props: {
55
+ id: "bar-horizontal",
56
+ y_axis_min: 0,
57
+ custom_options: bar_graph_options,
58
+ }) %>
@@ -0,0 +1,68 @@
1
+ import React from 'react'
2
+
3
+ import BarGraph from '../_bar_graph'
4
+
5
+
6
+ const barGraphOptions = {
7
+ chart: {
8
+ type: 'bar'
9
+ },
10
+ title: {
11
+ text: 'Historic World Population by Region',
12
+ align: 'left'
13
+ },
14
+ subtitle: {
15
+ text: 'Source: <a ' +
16
+ 'href="https://en.wikipedia.org/wiki/List_of_continents_and_continental_subregions_by_population"' +
17
+ 'target="_blank">Wikipedia.org</a>',
18
+ align: 'left'
19
+ },
20
+ xAxis: {
21
+ categories: ['Africa', 'America', 'Asia', 'Europe'],
22
+ lineWidth: 0
23
+ },
24
+ yAxis: {
25
+ min: 0,
26
+ title: {
27
+ text: 'Population (millions)',
28
+ align: 'high'
29
+ },
30
+ labels: {
31
+ overflow: 'justify'
32
+ },
33
+ },
34
+ tooltip: {
35
+ valueSuffix: ' millions'
36
+ },
37
+ plotOptions: {
38
+ bar: {
39
+ dataLabels: {
40
+ enabled: true
41
+ },
42
+ groupPadding: 0.1
43
+ }
44
+ },
45
+ series: [{
46
+ name: 'Year 1990',
47
+ data: [631, 727, 3202, 721]
48
+ }, {
49
+ name: 'Year 2000',
50
+ data: [814, 841, 3714, 726]
51
+ }, {
52
+ name: 'Year 2018',
53
+ data: [1276, 1007, 4561, 746]
54
+ }]
55
+ }
56
+
57
+ const BarGraphHorizontal = (props) => (
58
+ <div>
59
+ <BarGraph
60
+ customOptions={barGraphOptions}
61
+ id="bar-horizontal"
62
+ yAxisMin={0}
63
+ {...props}
64
+ />
65
+ </div>
66
+ )
67
+
68
+ export default BarGraphHorizontal
@@ -12,6 +12,7 @@ examples:
12
12
  - bar_graph_stacked: Stacked
13
13
  - bar_graph_negative_numbers: Negative Numbers
14
14
  - bar_graph_secondary_y_axis: Secondary Y-Axis
15
+ - bar_graph_horizontal: Custom Options From Highcharts
15
16
 
16
17
 
17
18
  react:
@@ -26,3 +27,4 @@ examples:
26
27
  - bar_graph_stacked: Stacked
27
28
  - bar_graph_negative_numbers: Negative Numbers
28
29
  - bar_graph_secondary_y_axis: Secondary Y-Axis
30
+ - bar_graph_horizontal: Custom Options From Highcharts
@@ -9,3 +9,4 @@ export { default as BarGraphCustom } from './_bar_graph_custom.jsx'
9
9
  export { default as BarGraphStacked } from './_bar_graph_stacked.jsx'
10
10
  export { default as BarGraphNegativeNumbers } from './_bar_graph_negative_numbers.jsx'
11
11
  export { default as BarGraphSecondaryYAxis } from './_bar_graph_secondary_y_axis.jsx'
12
+ export { default as BarGraphHorizontal } from './_bar_graph_horizontal.jsx'
@@ -81,4 +81,9 @@
81
81
  }
82
82
  }
83
83
  }
84
+
85
+ .card_draggable_handle {
86
+ align-self: center;
87
+ color: $text_lt_light;
88
+ }
84
89
  }
@@ -8,6 +8,10 @@ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../uti
8
8
  import { GlobalProps, globalProps } from '../utilities/globalProps'
9
9
  import type { ProductColors, CategoryColors, BackgroundColors } from '../types/colors'
10
10
 
11
+ import Icon from '../pb_icon/_icon'
12
+ import Flex from '../pb_flex/_flex'
13
+ import Draggable from '../pb_draggable/_draggable'
14
+
11
15
  type CardPropTypes = {
12
16
  aria?: {[key: string]: string},
13
17
  background?: BackgroundColors | ProductColors | "none",
@@ -16,11 +20,14 @@ type CardPropTypes = {
16
20
  children: React.ReactChild[] | React.ReactChild | number,
17
21
  className?: string,
18
22
  data?: {[key: string]: string},
23
+ draggableItem?: boolean,
24
+ dragHandle?: boolean,
19
25
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
20
26
  highlight?: {
21
27
  position?: "side" | "top",
22
28
  color?: string,
23
29
  },
30
+ id?: string,
24
31
  length?: number,
25
32
  padding?: string,
26
33
  selected?: boolean,
@@ -78,8 +85,11 @@ const Card = (props: CardPropTypes): React.ReactElement => {
78
85
  children,
79
86
  className,
80
87
  data = {},
88
+ dragHandle = true,
89
+ draggableItem = false,
81
90
  highlight = {},
82
91
  htmlOptions = {},
92
+ id,
83
93
  selected = false,
84
94
  tag = 'div',
85
95
  } = props
@@ -113,15 +123,52 @@ const Card = (props: CardPropTypes): React.ReactElement => {
113
123
  const Tag = tagOptions.includes(tag) ? tag : 'div'
114
124
 
115
125
  return (
116
- <Tag
117
- {...ariaProps}
118
- {...dataProps}
119
- {...htmlProps}
120
- className={classnames(cardCss, globalProps(props), className)}
121
- >
122
- {subComponentTags('Header')}
123
- {nonHeaderChildren}
124
- </Tag>
126
+ <>
127
+ {
128
+ draggableItem ? (
129
+ <Draggable.Item id={id}
130
+ key={id}
131
+ >
132
+ <Tag
133
+ {...ariaProps}
134
+ {...dataProps}
135
+ {...htmlProps}
136
+ className={classnames(cardCss, globalProps(props), className)}
137
+ >
138
+ {subComponentTags('Header')}
139
+ {
140
+ dragHandle ? (
141
+ <Flex>
142
+ <span className="card_draggable_handle">
143
+ <Icon
144
+ icon="grip-dots-vertical"
145
+ paddingRight="xs"
146
+ verticalAlign="middle"
147
+ />
148
+ </span>
149
+ <div style={{width: '100%'}}>
150
+ {nonHeaderChildren}
151
+ </div>
152
+ </Flex>
153
+ ) : (
154
+ nonHeaderChildren
155
+ )
156
+ }
157
+ </Tag>
158
+ </Draggable.Item>
159
+ ) : (
160
+ <Tag
161
+ {...ariaProps}
162
+ {...dataProps}
163
+ {...htmlProps}
164
+ className={classnames(cardCss, globalProps(props), className)}
165
+ >
166
+ {subComponentTags('Header')}
167
+ {nonHeaderChildren}
168
+ </Tag>
169
+ )
170
+ }
171
+ </>
125
172
  )
126
173
  }
127
174
 
@@ -46,16 +46,20 @@ type CircleChartProps = {
46
46
  borderWidth?: number;
47
47
  };
48
48
 
49
- // Adjust Circle Chart Block Kit Dimensions to Match the Chart for Centering
49
+
50
+
50
51
  const alignBlockElement = (event: any) => {
51
- const itemToMove = document.querySelector(
52
+ const itemToMove = document.querySelector<HTMLElement>(
52
53
  `#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`
53
- ) as HTMLElement;
54
+ );
54
55
  const chartContainer = document.querySelector(`#${event.target.renderTo.id}`);
55
- if (itemToMove !== null) {
56
+
57
+ if (itemToMove !== null && chartContainer !== null) {
56
58
  itemToMove.style.height = `${event.target.chartHeight}px`;
57
59
  itemToMove.style.width = `${event.target.chartWidth}px`;
58
- chartContainer.firstChild.before(itemToMove);
60
+ if (chartContainer.firstChild !== null) {
61
+ chartContainer.firstChild.before(itemToMove);
62
+ }
59
63
  }
60
64
  };
61
65
 
@@ -37,7 +37,6 @@
37
37
  </div>
38
38
 
39
39
  <%= javascript_tag do %>
40
- window.addEventListener("DOMContentLoaded", () => {
41
- dialogHelper()
42
- })
40
+ window.addEventListener("DOMContentLoaded", () => dialogHelper())
41
+ window.addEventListener("turbo:frame-load", () => dialogHelper())
43
42
  <% end %>
@@ -6,7 +6,7 @@ export const DraggableContext = () => {
6
6
  return useContext(DragContext);
7
7
  };
8
8
 
9
- export const DraggableProvider = ({ children, initialItems, onChange }: any) => {
9
+ export const DraggableProvider = ({ children, initialItems, onReorder }: any) => {
10
10
  const [items, setItems] = useState([]);
11
11
  const [dragData, setDragData] = useState<{ [key: string]: any }>({});
12
12
  const [isDragging, setIsDragging] = useState("");
@@ -17,7 +17,7 @@ export const DraggableProvider = ({ children, initialItems, onChange }: any) =>
17
17
  }, [initialItems]);
18
18
 
19
19
  useEffect(() => {
20
- onChange(items);
20
+ onReorder(items);
21
21
  }, [items]);
22
22
 
23
23
  const handleDragStart = (id: string, container: string) => {
@@ -27,7 +27,7 @@ const DraggableDefault = (props) => {
27
27
  return (
28
28
  <>
29
29
  <DraggableProvider initialItems={data}
30
- onChange={(items) => setInitialState(items)}
30
+ onReorder={(items) => setInitialState(items)}
31
31
  >
32
32
  <Draggable.Container {...props}>
33
33
  <SelectableList variant="checkbox">
@@ -1,4 +1,4 @@
1
- To use the Draggable kit, you must use the DraggableProvider and pass in `initialItems`. The `onChange` is a function that returns the data as it changes as items are reordered. Use this to manage state as shown.
1
+ To use the Draggable kit, you must use the DraggableProvider and pass in `initialItems`. The `onReorder` is a function that returns the data as it changes as items are reordered. Use this to manage state as shown.
2
2
 
3
3
  The `Draggable.Container` specifies the container within which items can be dropped.
4
4
  The `Draggable.Item` specifies the items that can be dragged and dropped. `Draggable.Item` requires `id` to be passed in as shown.
@@ -18,7 +18,7 @@ const containers = ["To Do", "In Progress", "Done"];
18
18
  // Initial items to be dragged
19
19
  const data = [
20
20
  {
21
- id: "1",
21
+ id: "11",
22
22
  container: "To Do",
23
23
  title: "Task 1",
24
24
  description: "Bug fixes",
@@ -26,7 +26,7 @@ const data = [
26
26
  assignee_img: "https://randomuser.me/api/portraits/men/44.jpg",
27
27
  },
28
28
  {
29
- id: "2",
29
+ id: "12",
30
30
  container: "To Do",
31
31
  title: "Task 2",
32
32
  description: "Documentation",
@@ -34,7 +34,7 @@ const data = [
34
34
  assignee_img: "https://randomuser.me/api/portraits/women/8.jpg",
35
35
  },
36
36
  {
37
- id: "3",
37
+ id: "13",
38
38
  container: "In Progress",
39
39
  title: "Task 3",
40
40
  description: "Add a variant",
@@ -42,7 +42,7 @@ const data = [
42
42
  assignee_img: "https://randomuser.me/api/portraits/women/10.jpg",
43
43
  },
44
44
  {
45
- id: "4",
45
+ id: "14",
46
46
  container: "To Do",
47
47
  title: "Task 4",
48
48
  description: "Add jest tests",
@@ -50,7 +50,7 @@ const data = [
50
50
  assignee_img: "https://randomuser.me/api/portraits/men/8.jpg",
51
51
  },
52
52
  {
53
- id: "5",
53
+ id: "15",
54
54
  container: "Done",
55
55
  title: "Task 5",
56
56
  description: "Alpha testing",
@@ -58,7 +58,7 @@ const data = [
58
58
  assignee_img: "https://randomuser.me/api/portraits/men/18.jpg",
59
59
  },
60
60
  {
61
- id: "6",
61
+ id: "16",
62
62
  container: "In Progress",
63
63
  title: "Task 6",
64
64
  description: "Release",
@@ -83,7 +83,7 @@ const DraggableMultipleContainer = (props) => {
83
83
 
84
84
  return (
85
85
  <DraggableProvider initialItems={data}
86
- onChange={(items) => setInitialState(items)}
86
+ onReorder={(items) => setInitialState(items)}
87
87
  >
88
88
  <Flex
89
89
  justifyContent="center"
@@ -92,6 +92,7 @@ const DraggableMultipleContainer = (props) => {
92
92
  {containers?.map((container) => (
93
93
  <Draggable.Container
94
94
  container={container}
95
+ htmlOptions={{style:{ width: "200px", height: "70vh"}}}
95
96
  key={container}
96
97
  padding="sm"
97
98
  >
@@ -0,0 +1 @@
1
+ The Draggable kit can also be used to achieve more complex, multiple container functionality as shown here. This complex usage requires the full subcomponent structure.
@@ -13,15 +13,15 @@ import {
13
13
  // Initial items to be dragged
14
14
  const data = [
15
15
  {
16
- id: "1",
16
+ id: "21",
17
17
  text: "Joe Black",
18
18
  },
19
19
  {
20
- id: "2",
20
+ id: "22",
21
21
  text: "Nancy White",
22
22
  },
23
23
  {
24
- id: "3",
24
+ id: "23",
25
25
  text: "Bill Green",
26
26
  },
27
27
  ];
@@ -32,52 +32,34 @@ const DraggableWithCards = (props) => {
32
32
  return (
33
33
  <DraggableProvider
34
34
  initialItems={data}
35
- onChange={(items) => setInitialState(items)}
35
+ onReorder={(items) => setInitialState(items)}
36
36
  >
37
37
  <Draggable.Container {...props}>
38
38
  {initialState.map(({ id, text }) => (
39
- <Draggable.Item id={id}
40
- key={id}
41
- >
42
39
  <Card
43
- highlight={{ position: "side", color: "primary" }}
40
+ draggableItem
41
+ highlight={{ color: "primary", position: "side" }}
42
+ id={id}
43
+ key={id}
44
44
  marginBottom="xs"
45
+ padding="xs"
45
46
  >
46
47
  <Flex alignItems="stretch"
47
48
  flexDirection="column"
48
- >
49
+ >
49
50
  <Flex gap="xs">
50
51
  <Title size={4}
51
52
  text={text}
52
- />
53
+ />
53
54
  <Badge
54
55
  text="35-12345"
55
56
  variant="primary"
56
- />
57
+ />
57
58
  </Flex>
58
-
59
- <Flex
60
- gap="sm"
61
- spacing="between"
62
- >
63
- <Caption
64
- size="xs"
65
- text="8:00A"
66
- />
67
- <Flex gap="xxs">
68
59
  <Caption
69
60
  size="xs"
70
- text="Township Name"
71
- />
72
- <Caption size="xs"
73
- text="•"
61
+ text="8:00A • Township Name • 90210"
74
62
  />
75
- <Caption size="xs"
76
- text="90210"
77
- />
78
- </Flex>
79
- </Flex>
80
-
81
63
  <Flex gap="xxs"
82
64
  spacing="between"
83
65
  >
@@ -109,7 +91,6 @@ const DraggableWithCards = (props) => {
109
91
  </Flex>
110
92
  </Flex>
111
93
  </Card>
112
- </Draggable.Item>
113
94
  ))}
114
95
  </Draggable.Container>
115
96
  </DraggableProvider>
@@ -0,0 +1,3 @@
1
+ For a simplified version of the Draggable API for the Card kit, You can use the the Card kit as the Draggable Item by using the `draggableItem` prop on Card. The dragHandle is added by default but this can be opted out off by setting `dragHandle` to false on the Card kit.
2
+
3
+ The dev must manage state as shown and pass in id to the Card for dragging to work.
@@ -4,19 +4,19 @@ import { DraggableProvider, List, ListItem } from "../../";
4
4
  // Initial items to be dragged
5
5
  const data = [
6
6
  {
7
- id: "1",
7
+ id: "31",
8
8
  text: "Philadelphia",
9
9
  },
10
10
  {
11
- id: "2",
11
+ id: "32",
12
12
  text: "New Jersey",
13
13
  },
14
14
  {
15
- id: "3",
15
+ id: "33",
16
16
  text: "Maryland",
17
17
  },
18
18
  {
19
- id: "4",
19
+ id: "34",
20
20
  text: "Connecticut",
21
21
  },
22
22
  ];
@@ -28,7 +28,7 @@ const DraggableWithList = (props) => {
28
28
  return (
29
29
  <>
30
30
  <DraggableProvider initialItems={data}
31
- onChange={(items) => setInitialState(items)}
31
+ onReorder={(items) => setInitialState(items)}
32
32
  >
33
33
  <List draggable
34
34
  {...props}
@@ -1 +1 @@
1
- For a simplified version of the Draggable API fro the List kit, use the DraggableProvider to wrap the List use the `draggable` prop on List. The dev must manage state as shown and pass in id to the ListItem.
1
+ For a simplified version of the Draggable API for the List kit, use the DraggableProvider to wrap the List kit and use the `draggable` prop on List. The dev must manage state as shown and pass in id to the ListItem for dragging to work.
@@ -4,19 +4,19 @@ import { SelectableList, DraggableProvider } from "../../";
4
4
  // Initial items to be dragged
5
5
  const data = [
6
6
  {
7
- id: "1",
7
+ id: "41",
8
8
  text: "Task 1",
9
9
  },
10
10
  {
11
- id: "2",
11
+ id: "42",
12
12
  text: "Task 2",
13
13
  },
14
14
  {
15
- id: "3",
15
+ id: "43",
16
16
  text: "Task 3",
17
17
  },
18
18
  {
19
- id: "4",
19
+ id: "44",
20
20
  text: "Task 4",
21
21
  },
22
22
  ];
@@ -27,7 +27,7 @@ const DraggableWithSelectableList = (props) => {
27
27
  return (
28
28
  <>
29
29
  <DraggableProvider initialItems={data}
30
- onChange={(items) => setInitialState(items)}
30
+ onReorder={(items) => setInitialState(items)}
31
31
  >
32
32
  <SelectableList draggable
33
33
  variant="checkbox"
@@ -31,12 +31,10 @@ const DefaultDraggableKit = () => {
31
31
  return (
32
32
  <DraggableProvider
33
33
  initialItems={data}
34
- onChange={(items) => setInitialState(items)}
34
+ onReorder={(items) => setInitialState(items)}
35
35
  >
36
36
  <Draggable
37
37
  data={{ testid: testId }}
38
- draggableItems={data}
39
- onDragChange={(items) => setInitialItems(items)}
40
38
  >
41
39
  <Draggable.Container>
42
40
  <SelectableList variant="checkbox">