playbook_ui 14.16.0 → 14.17.0.pre.alpha.PBNTR766tablenestedcollapsiblerowsborderdoubling7192

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 (135) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Utilities/types.ts +1 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +104 -2
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +168 -85
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
  6. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +10 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +20 -7
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +90 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +3 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -1
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.html.erb +39 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.html.erb +33 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md +1 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.md +6 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
  17. data/app/pb_kits/playbook/pb_advanced_table/index.js +1 -1
  18. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -2
  19. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +19 -9
  20. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +38 -1
  21. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +49 -37
  22. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +39 -0
  23. data/app/pb_kits/playbook/pb_button/_button.scss +5 -5
  24. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +14 -7
  25. data/app/pb_kits/playbook/pb_contact/contact.test.js +7 -7
  26. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +34 -34
  27. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -2
  28. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -0
  29. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -11
  30. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -7
  31. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss +28 -24
  32. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +2 -2
  33. data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.test.js +1 -1
  34. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +43 -20
  35. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +58 -17
  36. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +102 -105
  37. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +3 -3
  38. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +50 -48
  39. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -1
  40. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +110 -0
  41. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +5 -0
  42. data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_react.jsx → _draggable_with_table.jsx} +1 -1
  43. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +3 -1
  44. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +9 -6
  45. data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
  46. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +71 -3
  47. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -3
  48. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +6 -6
  49. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +6 -6
  50. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -6
  51. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +8 -8
  52. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +3 -3
  53. data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +3 -4
  54. data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +2 -3
  55. data/app/pb_kits/playbook/pb_form/pb_form_validation.js +1 -1
  56. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +22 -0
  57. data/app/pb_kits/playbook/pb_icon/icon.test.js +9 -9
  58. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.test.js +1 -1
  59. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +1 -1
  60. data/app/pb_kits/playbook/pb_icon_value/icon_value.test.js +1 -1
  61. data/app/pb_kits/playbook/pb_label_value/label_value.test.js +1 -1
  62. data/app/pb_kits/playbook/pb_layout/_layout.scss +58 -0
  63. data/app/pb_kits/playbook/pb_layout/_layout.tsx +20 -7
  64. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +190 -0
  65. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +5 -0
  66. data/app/pb_kits/playbook/pb_layout/docs/example.yml +1 -0
  67. data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
  68. data/app/pb_kits/playbook/pb_layout/layout.test.js +4 -0
  69. data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +90 -0
  70. data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +57 -0
  71. data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +1 -1
  72. data/app/pb_kits/playbook/pb_link/link.test.jsx +2 -2
  73. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +2 -1
  74. data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +5 -3
  75. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +29 -11
  76. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
  77. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +4 -4
  78. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +2 -0
  79. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical.md +1 -0
  80. data/app/pb_kits/playbook/pb_stat_change/stat_change.test.js +8 -4
  81. data/app/pb_kits/playbook/pb_table/_table.tsx +4 -0
  82. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.jsx +50 -0
  83. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_react.md +1 -0
  84. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.jsx +59 -0
  85. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -0
  86. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  87. data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
  88. data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +24 -0
  89. data/app/pb_kits/playbook/pb_table/styles/_headers.scss +76 -0
  90. data/app/pb_kits/playbook/pb_table/styles/_striped.scss +3 -3
  91. data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +11 -1
  92. data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +11 -1
  93. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +5 -0
  94. data/app/pb_kits/playbook/pb_table/table.test.js +17 -0
  95. data/app/pb_kits/playbook/pb_tooltip/index.js +183 -56
  96. data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +2 -5
  97. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
  98. data/app/pb_kits/playbook/pb_typeahead/index.ts +2 -2
  99. data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
  100. data/app/pb_kits/playbook/pb_user/user.html.erb +1 -6
  101. data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +1 -6
  102. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
  103. data/app/pb_kits/playbook/utilities/object.test.js +149 -1
  104. data/app/pb_kits/playbook/utilities/object.ts +124 -42
  105. data/dist/chunks/_typeahead-HqfDnjRe.js +22 -0
  106. data/dist/chunks/_weekday_stacked-DVQITtQ9.js +45 -0
  107. data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
  108. data/dist/chunks/lib-BGzBzFZX.js +29 -0
  109. data/dist/chunks/{pb_form_validation-DMajaRt3.js → pb_form_validation-BvNy9Bd6.js} +1 -1
  110. data/dist/chunks/vendor.js +1 -1
  111. data/dist/playbook-doc.js +1 -1
  112. data/dist/playbook-rails-react-bindings.js +1 -1
  113. data/dist/playbook-rails.js +1 -1
  114. data/dist/playbook.css +1 -1
  115. data/lib/playbook/kit_base.rb +4 -4
  116. data/lib/playbook/version.rb +2 -2
  117. metadata +38 -22
  118. data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
  119. data/dist/chunks/_typeahead-BuTZG1Jn.js +0 -22
  120. data/dist/chunks/_weekday_stacked-oT22q75-.js +0 -45
  121. data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
  122. data/dist/chunks/lib-Co5y3V4K.js +0 -29
  123. /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows.md → _advanced_table_selectable_rows_no_subrows_react.md} +0 -0
  124. /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows.md → _advanced_table_selectable_rows_react.md} +0 -0
  125. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_rails.html.erb → _draggable_default.html.erb} +0 -0
  126. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.md → _draggable_default_react.md} +0 -0
  127. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_rails.html.erb → _draggable_multiple_containers.html.erb} +0 -0
  128. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.md → _draggable_multiple_containers_react.md} +0 -0
  129. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_rails.html.erb → _draggable_with_cards.html.erb} +0 -0
  130. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.md → _draggable_with_cards_react.md} +0 -0
  131. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_rails.html.erb → _draggable_with_list.html.erb} +0 -0
  132. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.md → _draggable_with_list_react.md} +0 -0
  133. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_rails.html.erb → _draggable_with_selectable_list.html.erb} +0 -0
  134. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.md → _draggable_with_selectable_list_react.md} +0 -0
  135. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.md → _draggable_with_table_rails.md} +0 -0
@@ -60,123 +60,120 @@ const DraggableDropZones = (props) => {
60
60
 
61
61
  return (
62
62
  <>
63
- <Flex justify="between"
64
- {...props}
65
- >
66
- <FlexItem marginRight="xl">
67
- <DraggableProvider
68
- dropZone={{type: "shadow"}}
69
- initialItems={dataShadow}
70
- onReorder={(items) => setInitialShadowState(items)}
71
- >
72
- <Caption
73
- marginBottom="xs"
74
- textAlign="center"
75
- >
76
- {"Shadow"}
77
- </Caption>
78
- <Draggable.Container
79
- htmlOptions={{style:{ width: "200px"}}}
80
- {...props}
81
- >
82
- {initialShadowState.map(({ id, text }) => (
83
- <Card dragId={id}
84
- draggableItem
85
- key={id}
63
+ <Flex justify="between"
64
+ {...props}
65
+ >
66
+ <FlexItem marginRight="xl">
67
+ <DraggableProvider
68
+ dropZone={{type: "shadow"}}
69
+ initialItems={dataShadow}
70
+ onReorder={(items) => setInitialShadowState(items)}
71
+ >
72
+ <Caption
86
73
  marginBottom="xs"
87
- padding="xs"
74
+ text="Shadow"
75
+ textAlign="center"
76
+ />
77
+ <Draggable.Container
78
+ htmlOptions={{style:{ width: "200px"}}}
88
79
  {...props}
89
80
  >
90
- <Flex alignItems="stretch"
91
- flexDirection="column"
81
+ {initialShadowState.map(({ id, text }) => (
82
+ <Card dragId={id}
83
+ draggableItem
84
+ key={id}
85
+ marginBottom="xs"
86
+ padding="xs"
87
+ {...props}
92
88
  >
93
- <Body
94
- text={text}
95
- {...props}
96
- />
97
- </Flex>
98
- </Card>
99
- ))}
100
- </Draggable.Container>
101
- </DraggableProvider>
102
- </FlexItem>
103
- <FlexItem marginRight="xl">
104
- <DraggableProvider
105
- dropZone={{type: "outline"}}
106
- initialItems={dataOutline}
107
- onReorder={(items) => setInitialOutlineState(items)}
108
- >
109
- <Caption
110
- marginBottom="xs"
111
- textAlign="center"
112
- >
113
- {"Outline"}
114
- </Caption>
115
- <Draggable.Container
116
- htmlOptions={{style:{ width: "200px"}}}
117
- {...props}
118
- >
119
- {initialOutlineState.map(({ id, text }) => (
120
- <Card
121
- dragId={id}
122
- draggableItem
123
- key={id}
89
+ <Flex alignItems="stretch"
90
+ flexDirection="column"
91
+ >
92
+ <Body
93
+ text={text}
94
+ {...props}
95
+ />
96
+ </Flex>
97
+ </Card>
98
+ ))}
99
+ </Draggable.Container>
100
+ </DraggableProvider>
101
+ </FlexItem>
102
+ <FlexItem marginRight="xl">
103
+ <DraggableProvider
104
+ dropZone={{type: "outline"}}
105
+ initialItems={dataOutline}
106
+ onReorder={(items) => setInitialOutlineState(items)}
107
+ >
108
+ <Caption
124
109
  marginBottom="xs"
125
- padding="xs"
110
+ text="Outline"
111
+ textAlign="center"
112
+ />
113
+ <Draggable.Container
114
+ htmlOptions={{style:{ width: "200px"}}}
126
115
  {...props}
127
116
  >
128
- <Flex
129
- alignItems="stretch"
130
- flexDirection="column"
117
+ {initialOutlineState.map(({ id, text }) => (
118
+ <Card
119
+ dragId={id}
120
+ draggableItem
121
+ key={id}
122
+ marginBottom="xs"
123
+ padding="xs"
124
+ {...props}
131
125
  >
132
- <Body
133
- text={text}
134
- {...props}
135
- />
136
- </Flex>
137
- </Card>
138
- ))}
139
- </Draggable.Container>
140
- </DraggableProvider>
141
- </FlexItem>
142
- <FlexItem>
143
- <DraggableProvider
144
- dropZone={{type: "line"}}
145
- initialItems={dataLine}
146
- onReorder={(items) => setInitialLineState(items)}
147
- >
148
- <Caption
149
- marginBottom="xs"
150
- textAlign="center"
151
- >
152
- {"Line"}
153
- </Caption>
154
- <Draggable.Container
155
- htmlOptions={{style:{ width: "200px"}}}
156
- {...props}
157
- >
158
- {initialLineState.map(({ id, text }) => (
159
- <Card dragId={id}
160
- draggableItem
161
- key={id}
126
+ <Flex
127
+ alignItems="stretch"
128
+ flexDirection="column"
129
+ >
130
+ <Body
131
+ text={text}
132
+ {...props}
133
+ />
134
+ </Flex>
135
+ </Card>
136
+ ))}
137
+ </Draggable.Container>
138
+ </DraggableProvider>
139
+ </FlexItem>
140
+ <FlexItem>
141
+ <DraggableProvider
142
+ dropZone={{type: "line"}}
143
+ initialItems={dataLine}
144
+ onReorder={(items) => setInitialLineState(items)}
145
+ >
146
+ <Caption
162
147
  marginBottom="xs"
163
- padding="xs"
148
+ text="Line"
149
+ textAlign="center"
150
+ />
151
+ <Draggable.Container
152
+ htmlOptions={{style:{ width: "200px"}}}
164
153
  {...props}
165
154
  >
166
- <Flex alignItems="stretch"
167
- flexDirection="column"
155
+ {initialLineState.map(({ id, text }) => (
156
+ <Card dragId={id}
157
+ draggableItem
158
+ key={id}
159
+ marginBottom="xs"
160
+ padding="xs"
161
+ {...props}
168
162
  >
169
- <Body
170
- text={text}
171
- {...props}
172
- />
173
- </Flex>
174
- </Card>
175
- ))}
176
- </Draggable.Container>
177
- </DraggableProvider>
178
- </FlexItem>
179
- </Flex>
163
+ <Flex alignItems="stretch"
164
+ flexDirection="column"
165
+ >
166
+ <Body
167
+ text={text}
168
+ {...props}
169
+ />
170
+ </Flex>
171
+ </Card>
172
+ ))}
173
+ </Draggable.Container>
174
+ </DraggableProvider>
175
+ </FlexItem>
176
+ </Flex>
180
177
  </>
181
178
  );
182
179
  };
@@ -1,5 +1,5 @@
1
- The Draggable kit allows you to choose the style of drop zones that appear when dragging an item.
1
+ The Draggable kit lets you customize the style of drop zones that appear when dragging an item.
2
2
 
3
- By default, the Draggable kit utilizes the "ghost" style for drop zones, but you can also choose between "shadow", "outline", and "line".
3
+ By default, drop zones are in the "ghost" style, but you can also choose from "shadow," "outline," and "line."
4
4
 
5
- Additionally, when using the "line" style, be sure to set the proper `direction` attribute within the `dropZone` prop depending on the orentation of your draggable view. By default, this attribute is set to "vertical", but can also be used with a "horizontal" direction. The `direction` attribute only applies to the "line" style and will not affect other drop zone styles.
5
+ When using the "line" type, make sure to set the appropriate `direction` attribute within the `dropZone` prop based on the orientation of your draggable view. By default, this is set to "vertical," but it can also be adjusted to "horizontal." Note that the direction attribute only applies to the "line" type and does not affect other drop zone styles. For more on the "line" style in particular, check out the [Draggable Drop Zones Line doc example](https://playbook.powerapp.cloud/kits/draggable/react#draggable-drop-zones-line).
@@ -6,6 +6,8 @@ import Caption from '../../pb_caption/_caption'
6
6
  import Draggable from '../../pb_draggable/_draggable'
7
7
  import { DraggableProvider } from '../../pb_draggable/context'
8
8
 
9
+
10
+
9
11
  // Initial items to be dragged
10
12
  const dataPrimary = [
11
13
  {
@@ -42,54 +44,54 @@ const DraggableDropZonesColors = (props) => {
42
44
 
43
45
  return (
44
46
  <>
45
- <Caption marginBottom="xs">
46
- Primary
47
- </Caption>
48
- <DraggableProvider
49
- dropZone={{type: "shadow", color: "primary"}}
50
- initialItems={dataPrimary}
51
- onReorder={(items) => setInitialPrimaryState(items)}
52
- >
53
- <Draggable.Container {...props}>
54
- <Flex>
55
- {initialPrimaryState.map(({ id, url }) => (
56
- <Draggable.Item dragId={id}
57
- key={id}
58
- marginRight="sm"
59
- >
60
- <Image alt={id}
61
- size="md"
62
- url={url}
63
- />
64
- </Draggable.Item>
65
- ))}
66
- </Flex>
67
- </Draggable.Container>
68
- </DraggableProvider>
69
- <Caption marginBottom="xs">
70
- Purple
71
- </Caption>
72
- <DraggableProvider
73
- dropZone={{type: "outline", color: "purple"}}
74
- initialItems={dataPurple}
75
- onReorder={(items) => setInitialPurpleState(items)}
76
- >
77
- <Draggable.Container {...props}>
78
- <Flex>
79
- {initialPurpleState.map(({ id, url }) => (
80
- <Draggable.Item dragId={id}
81
- key={id}
82
- marginRight="sm"
83
- >
84
- <Image alt={id}
85
- size="md"
86
- url={url}
87
- />
88
- </Draggable.Item>
89
- ))}
90
- </Flex>
91
- </Draggable.Container>
92
- </DraggableProvider>
47
+ <Caption marginBottom="xs"
48
+ text="Primary"
49
+ />
50
+ <DraggableProvider
51
+ dropZone={{type: "shadow", color: "primary"}}
52
+ initialItems={dataPrimary}
53
+ onReorder={(items) => setInitialPrimaryState(items)}
54
+ >
55
+ <Draggable.Container {...props}>
56
+ <Flex>
57
+ {initialPrimaryState.map(({ id, url }) => (
58
+ <Draggable.Item dragId={id}
59
+ key={id}
60
+ marginRight="sm"
61
+ >
62
+ <Image alt={id}
63
+ size="md"
64
+ url={url}
65
+ />
66
+ </Draggable.Item>
67
+ ))}
68
+ </Flex>
69
+ </Draggable.Container>
70
+ </DraggableProvider>
71
+ <Caption marginBottom="xs"
72
+ text="Purple"
73
+ />
74
+ <DraggableProvider
75
+ dropZone={{type: "outline", color: "purple"}}
76
+ initialItems={dataPurple}
77
+ onReorder={(items) => setInitialPurpleState(items)}
78
+ >
79
+ <Draggable.Container {...props}>
80
+ <Flex>
81
+ {initialPurpleState.map(({ id, url }) => (
82
+ <Draggable.Item dragId={id}
83
+ key={id}
84
+ marginRight="sm"
85
+ >
86
+ <Image alt={id}
87
+ size="md"
88
+ url={url}
89
+ />
90
+ </Draggable.Item>
91
+ ))}
92
+ </Flex>
93
+ </Draggable.Container>
94
+ </DraggableProvider>
93
95
  </>
94
96
  );
95
97
  };
@@ -1 +1 @@
1
- By default, the Draggable kit sets the default color of drop zones to "neutral" (or "primary" if using the "line" style.)
1
+ The default `color` for Draggable kit drop zones is "neutral", with "primary" or "purple" as additional options. When `type` is set to "line", the default color is "primary" and "purple" is the only other option.
@@ -0,0 +1,110 @@
1
+ import React, { useState } from "react";
2
+ import Flex from '../../pb_flex/_flex'
3
+ import Caption from '../../pb_caption/_caption'
4
+ import Draggable from '../_draggable'
5
+ import { DraggableProvider } from '../context'
6
+ import Image from '../../pb_image/_image'
7
+
8
+
9
+
10
+ const dataLineVertical = [
11
+ {
12
+ id: "211",
13
+ url: "https://unsplash.it/500/400/?image=633",
14
+ },
15
+ {
16
+ id: "212",
17
+ url: "https://unsplash.it/500/400/?image=634",
18
+ },
19
+ {
20
+ id: "213",
21
+ url: "https://unsplash.it/500/400/?image=637",
22
+ },
23
+ ];
24
+
25
+ const dataLineHorizontal = [
26
+ {
27
+ id: "2111",
28
+ url: "https://unsplash.it/500/400/?image=633",
29
+ },
30
+ {
31
+ id: "2122",
32
+ url: "https://unsplash.it/500/400/?image=634",
33
+ },
34
+ {
35
+ id: "2133",
36
+ url: "https://unsplash.it/500/400/?image=637",
37
+ },
38
+ ];
39
+
40
+ const DraggableDropZones = (props) => {
41
+ const [initialLineVerticalState, setInitialLineVerticalState] = useState(dataLineVertical);
42
+ const [initialLineHorizontalState, setInitialLineHorizontalState] = useState(dataLineHorizontal);
43
+
44
+ return (
45
+ <>
46
+ <Caption marginBottom="xs"
47
+ marginTop="xl"
48
+ text="Vertical"
49
+ />
50
+ <DraggableProvider
51
+ dropZone={{ type: "line", color: "purple" }}
52
+ initialItems={dataLineVertical}
53
+ onReorder={(items) => setInitialLineVerticalState(items)}
54
+ >
55
+ <Draggable.Container {...props}>
56
+ <Flex flexDirection="column"
57
+ height="367px"
58
+ >
59
+ {initialLineVerticalState.map(({ id, url }) => (
60
+ <Draggable.Item dragId={id}
61
+ key={id}
62
+ marginBottom="sm"
63
+ >
64
+ <Image alt={id}
65
+ size="md"
66
+ url={url}
67
+ />
68
+ </Draggable.Item>
69
+ ))}
70
+ </Flex>
71
+ </Draggable.Container>
72
+ </DraggableProvider>
73
+ <Caption marginBottom="xs"
74
+ marginTop="xl"
75
+ text="Horizontal"
76
+ />
77
+ <Flex>
78
+ <DraggableProvider
79
+ dropZone={{ type: "line", direction: "horizontal" }}
80
+ initialItems={dataLineHorizontal}
81
+ onReorder={(items) => setInitialLineHorizontalState(items)}
82
+ >
83
+ <Draggable.Container
84
+ htmlOptions={{style:{ width: "285px"}}}
85
+ {...props}
86
+ >
87
+ <Flex alignItems="stretch"
88
+ flexDirection="row"
89
+ height="110px"
90
+ >
91
+ {initialLineHorizontalState.map(({ id, url }) => (
92
+ <Draggable.Item dragId={id}
93
+ key={id}
94
+ marginRight="sm"
95
+ >
96
+ <Image alt={id}
97
+ size="md"
98
+ url={url}
99
+ />
100
+ </Draggable.Item>
101
+ ))}
102
+ </Flex>
103
+ </Draggable.Container>
104
+ </DraggableProvider>
105
+ </Flex>
106
+ </>
107
+ );
108
+ };
109
+
110
+ export default DraggableDropZones;
@@ -0,0 +1,5 @@
1
+ When using the "line" style, make sure to set the appropriate `direction` attribute within the `dropZone` prop based on the orientation of your draggable view. By default, this is set to "vertical," but it can also be adjusted to "horizontal." Note that the direction attribute only applies to the "line" style and does not affect other drop zone styles. The default `color` for "line" is "primary" and "purple" is the only alternative color option.
2
+
3
+ The length of the line is calculated based off of the width (for "vertical") or height (for "horizontal") of the parent container holding the draggable items.
4
+
5
+ Additionally, if the parent container of the `DraggableProvider`/`DraggableContainer` (or a subcontainer within) does not have a set height (for "vertical") or width (for "horizontal"), like the [Draggable Drop Zones doc example](https://playbook.powerapp.cloud/kits/draggable/react#draggable-drop-zones) does, elements on the page may jump up (for "vertical") or to the left (for "horizontal") when an item is actively being dragged. To prevent this, give a parent element a fixed height (for "vertical") or width (for "horizontal") as demonstrated in this doc example.
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from "react";
2
2
 
3
3
  import Flex from '../../pb_flex/_flex'
4
- import { DraggableProvider } from '../../pb_draggable/context'
4
+ import { DraggableProvider } from '../context'
5
5
  import Avatar from '../../pb_avatar/_avatar'
6
6
  import Body from '../../pb_body/_body'
7
7
  import Table from '../../pb_table/_table'
@@ -2,4 +2,6 @@ The draggable kit can also be used in conjunction with the table kit to create d
2
2
 
3
3
  - Wrap the Table with the `DraggableProvider` and manage state as shown.
4
4
  - use the `draggableContainer` prop on the Table.Body to designate it as the Draggable Container
5
- - use the `draggableItem` prop on the Table.Row to designate it as the Draggable Item. Make sure to also pass id to the `dragId` prop here.
5
+ - use the `draggableItem` prop on the Table.Row to designate it as the Draggable Item. Make sure to also pass id to the `dragId` prop here.
6
+
7
+ We recommending using the default `dropZone type` with the Table kit.
@@ -4,14 +4,17 @@ examples:
4
4
  - draggable_with_list: Draggable with List Kit
5
5
  - draggable_with_selectable_list: Draggable with SelectableList Kit
6
6
  - draggable_with_cards: Draggable with Cards
7
- - draggable_with_table_react: Draggable with Table
7
+ - draggable_with_table: Draggable with Table
8
8
  - draggable_multiple_containers: Dragging Across Multiple Containers
9
+ - draggable_drop_zones: Draggable Drop Zones
10
+ - draggable_drop_zones_colors: Draggable Drop Zones Colors
11
+ - draggable_drop_zones_line: Draggable Drop Zones Line
9
12
 
10
13
  rails:
11
- - draggable_default_rails: Default
12
- - draggable_with_list_rails: Draggable with List Kit
13
- - draggable_with_selectable_list_rails: Draggable with SelectableList Kit
14
- - draggable_with_cards_rails: Draggable with Cards
14
+ - draggable_default: Default
15
+ - draggable_with_list: Draggable with List Kit
16
+ - draggable_with_selectable_list: Draggable with SelectableList Kit
17
+ - draggable_with_cards: Draggable with Cards
15
18
  - draggable_with_table: Draggable with Table
16
- - draggable_multiple_containers_rails: Dragging Across Multiple Containers
19
+ - draggable_multiple_containers: Dragging Across Multiple Containers
17
20
 
@@ -3,4 +3,7 @@ export { default as DraggableWithCards } from './_draggable_with_cards.jsx'
3
3
  export { default as DraggableWithList } from './_draggable_with_list.jsx'
4
4
  export { default as DraggableWithSelectableList } from './_draggable_with_selectable_list.jsx'
5
5
  export { default as DraggableMultipleContainers } from './_draggable_multiple_containers.jsx'
6
- export { default as DraggableWithTableReact } from './_draggable_with_table_react.jsx'
6
+ export { default as DraggableWithTable } from './_draggable_with_table.jsx'
7
+ export { default as DraggableDropZones } from './_draggable_drop_zones.jsx'
8
+ export { default as DraggableDropZonesColors } from './_draggable_drop_zones_colors.jsx'
9
+ export { default as DraggableDropZonesLine } from './_draggable_drop_zones_line.jsx'
@@ -128,6 +128,58 @@ const DraggableKitWithCard = () => {
128
128
  );
129
129
  };
130
130
 
131
+ const DraggableWithLineVertical = () => {
132
+ const [initialState, setInitialState] = useState(data);
133
+ return (
134
+ <div data-testid={testId}>
135
+ <DraggableProvider
136
+ dropZone={{ type: "line" }}
137
+ initialItems={data}
138
+ onReorder={(items) => setInitialState(items)}
139
+ >
140
+ <Draggable>
141
+ <Draggable.Container>
142
+ {initialState.map(({ id, text }) => (
143
+ <Draggable.Item
144
+ dragId={id}
145
+ key={id}
146
+ >
147
+ {text}
148
+ </Draggable.Item>
149
+ ))}
150
+ </Draggable.Container>
151
+ </Draggable>
152
+ </DraggableProvider>
153
+ </div>
154
+ );
155
+ };
156
+
157
+ const DraggableWithLineHorizontal = () => {
158
+ const [initialState, setInitialState] = useState(data);
159
+ return (
160
+ <div data-testid={testId}>
161
+ <DraggableProvider
162
+ dropZone={{ type: "line", direction: "horizontal" }}
163
+ initialItems={data}
164
+ onReorder={(items) => setInitialState(items)}
165
+ >
166
+ <Draggable>
167
+ <Draggable.Container>
168
+ {initialState.map(({ id, text }) => (
169
+ <Draggable.Item
170
+ dragId={id}
171
+ key={id}
172
+ >
173
+ {text}
174
+ </Draggable.Item>
175
+ ))}
176
+ </Draggable.Container>
177
+ </Draggable>
178
+ </DraggableProvider>
179
+ </div>
180
+ );
181
+ };
182
+
131
183
  test("generated default kit and classname", () => {
132
184
  render(<DefaultDraggableKit />);
133
185
  const kit = screen.getByTestId(testId);
@@ -165,7 +217,7 @@ test("generated dragHandle with List", () => {
165
217
 
166
218
  const list = kit.querySelector(".pb_list_kit");
167
219
  expect(list).toBeInTheDocument();
168
- const dragHandle = list.querySelector(".fa-grip-dots-vertical");
220
+ const dragHandle = list.querySelector(".pb_custom_icon");
169
221
  expect(dragHandle).toBeInTheDocument();
170
222
  });
171
223
 
@@ -175,7 +227,7 @@ test("generated dragHandle with SelectableList", () => {
175
227
 
176
228
  const selectabellist = kit.querySelector(".pb_selectable_list_kit");
177
229
  expect(selectabellist).toBeInTheDocument();
178
- const dragHandle = selectabellist.querySelector(".fa-grip-dots-vertical");
230
+ const dragHandle = selectabellist.querySelector(".pb_custom_icon");
179
231
  expect(dragHandle).toBeInTheDocument();
180
232
  });
181
233
 
@@ -185,6 +237,22 @@ test("generated dragHandle with Card", () => {
185
237
 
186
238
  const card = kit.querySelector(".pb_card_kit_deselected_border_radius_md");
187
239
  expect(card).toBeInTheDocument();
188
- const dragHandle = card.querySelector(".fa-grip-dots-vertical");
240
+ const dragHandle = card.querySelector(".pb_custom_icon");
189
241
  expect(dragHandle).toBeInTheDocument();
190
242
  });
243
+
244
+ test("line dropZone with default direction applies 'line_vertical' class to container", () => {
245
+ render(<DraggableWithLineVertical />);
246
+ const kit = screen.getByTestId(testId);
247
+ const container = kit.querySelector(".pb_draggable_container");
248
+
249
+ expect(container).toHaveClass("line_vertical");
250
+ });
251
+
252
+ test("line dropZone with horizontal direction applies 'line_horizontal' class to container", () => {
253
+ render(<DraggableWithLineHorizontal />);
254
+ const kit = screen.getByTestId(testId);
255
+ const container = kit.querySelector(".pb_draggable_container");
256
+
257
+ expect(container).toHaveClass("line_horizontal");
258
+ });
@@ -31,7 +31,7 @@ const DraggableContainer = (props: DraggableContainerProps) => {
31
31
  } = contextValues;
32
32
 
33
33
  // Only get direction if dropZone is 'line'
34
- const direction = dropZone === 'line' ? (contextValues.direction || 'vertical') : 'vertical';
34
+ const direction = dropZone === 'line' ? (contextValues.direction || 'vertical') : null;
35
35
 
36
36
  const ariaProps = buildAriaProps(aria);
37
37
  const dataProps = buildDataProps(data);
@@ -41,8 +41,9 @@ const DraggableContainer = (props: DraggableContainerProps) => {
41
41
  const classes = classnames(
42
42
  buildCss("pb_draggable_container"),
43
43
  `${activeContainer === container ? "active" : ""}`,
44
- // Only add vertical class if dropZone is 'line' and direction is 'vertical'
45
- (dropZone === 'line' && direction === 'vertical') ? 'vertical' : '',
44
+ // Line variant gets line_{direction} classname on container no matter what
45
+ dropZone === 'line' && direction === 'vertical' ? 'line_vertical' : '',
46
+ dropZone === 'line' && direction === 'horizontal' ? 'line_horizontal' : '',
46
47
  globalProps(props),
47
48
  className
48
49
  );