playbook_ui_docs 14.17.0.pre.rc.0 → 14.18.0.pre.alpha.PLAY2107phonenumberlabeljumpbug7435

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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.jsx +66 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.md +10 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +90 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +3 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.jsx +58 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.md +6 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.jsx +64 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md +8 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +55 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +3 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +33 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +3 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +1 -2
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +2 -2
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -1
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +6 -2
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +6 -2
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +9 -3
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +6 -1
  22. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +35 -0
  23. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +1 -0
  24. data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
  25. data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
  26. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.html.erb +2 -2
  27. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +1 -1
  28. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.html.erb +1 -1
  29. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +1 -1
  30. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.html.erb +1 -1
  31. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +1 -1
  32. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.html.erb +1 -1
  33. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +1 -1
  34. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.html.erb +1 -1
  35. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +1 -1
  36. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +2 -2
  37. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +38 -0
  38. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +1 -0
  39. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.html.erb +1 -1
  40. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +1 -1
  41. data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +2 -3
  42. data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +2 -1
  43. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.html.erb +28 -0
  44. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.jsx +42 -0
  45. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.md +1 -0
  46. data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +2 -0
  47. data/app/pb_kits/playbook/pb_circle_icon_button/docs/index.js +1 -0
  48. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx +54 -0
  49. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md +3 -0
  50. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.html.erb +14 -0
  51. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.md +3 -0
  52. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +2 -0
  53. data/app/pb_kits/playbook/pb_copy_button/docs/index.js +2 -1
  54. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.jsx +4 -1
  55. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -11
  56. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -7
  57. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_rails.md +4 -0
  58. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.md +1 -1
  59. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.md +5 -1
  60. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.jsx +34 -0
  61. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.md +14 -0
  62. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +20 -0
  63. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +14 -0
  64. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
  65. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +1 -0
  66. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames.html.erb +117 -0
  67. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames_rails.md +9 -0
  68. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
  69. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +102 -105
  70. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +3 -3
  71. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +50 -48
  72. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -1
  73. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +110 -0
  74. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +5 -0
  75. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.html.erb +42 -0
  76. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.md +1 -0
  77. data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_react.jsx → _draggable_with_table.jsx} +1 -1
  78. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +3 -1
  79. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +10 -6
  80. data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
  81. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +4 -1
  82. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +6 -6
  83. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +6 -6
  84. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -6
  85. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +8 -8
  86. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb +15 -5
  87. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +39 -6
  88. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +30 -0
  89. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +1 -0
  90. data/app/pb_kits/playbook/pb_gauge/docs/example.yml +1 -0
  91. data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
  92. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +394 -0
  93. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +5 -0
  94. data/app/pb_kits/playbook/pb_layout/docs/example.yml +1 -0
  95. data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
  96. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.jsx +63 -0
  97. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.md +3 -0
  98. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +1 -7
  99. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.jsx +49 -0
  100. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.md +1 -0
  101. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.jsx +81 -0
  102. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.md +1 -0
  103. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.jsx +39 -0
  104. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.md +1 -0
  105. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.jsx +40 -0
  106. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +5 -0
  107. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +5 -0
  108. data/app/pb_kits/playbook/pb_overlay/docs/index.js +5 -0
  109. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +8 -1
  110. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical.md +1 -0
  111. data/app/pb_kits/playbook/pb_select/docs/_select_error.jsx +7 -2
  112. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +3 -1
  113. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +3 -1
  114. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +3 -1
  115. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +3 -1
  116. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +34 -0
  117. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +1 -0
  118. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +36 -0
  119. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +1 -0
  120. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
  121. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  122. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.jsx +9 -1
  123. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.jsx +94 -0
  124. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.md +1 -0
  125. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -0
  126. data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
  127. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.jsx +7 -1
  128. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_error_state.jsx +6 -2
  129. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
  130. data/dist/playbook-doc.js +19 -1
  131. metadata +68 -14
  132. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_rails.html.erb → _draggable_default.html.erb} +0 -0
  133. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.md → _draggable_default_react.md} +0 -0
  134. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_rails.html.erb → _draggable_multiple_containers.html.erb} +0 -0
  135. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.md → _draggable_multiple_containers_react.md} +0 -0
  136. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_rails.html.erb → _draggable_with_cards.html.erb} +0 -0
  137. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.md → _draggable_with_cards_react.md} +0 -0
  138. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_rails.html.erb → _draggable_with_list.html.erb} +0 -0
  139. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.md → _draggable_with_list_react.md} +0 -0
  140. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_rails.html.erb → _draggable_with_selectable_list.html.erb} +0 -0
  141. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.md → _draggable_with_selectable_list_react.md} +0 -0
  142. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.md → _draggable_with_table_rails.md} +0 -0
@@ -0,0 +1,9 @@
1
+ The `custom_event_type` prop allows you to specify custom events that will trigger the dialog's initialization or control its behavior. This is especially useful when working with Turbo Frame updates where standard DOM events might not suffice.
2
+
3
+ The examples demonstrate two use cases:
4
+ 1) Opening a dialog via custom event dispatch: The first example shows how to configure a dialog to listen for a specific custom event (dialogOpen). When this event is dispatched, the dialog will automatically open, making it easy to trigger the dialog from JavaScript or after Turbo Frame operations.
5
+ 2) Controlling dialog button actions with custom events: The second example demonstrates how to set up a dialog that can have its confirm button triggered through external events (turboResponse). This pattern is useful when you need to programmatically confirm a dialog after some background operation completes.
6
+ 3) Multiple custom events: The third example combines the first two to show how `custom_event_type` prop can support multiple event types separated by a comma.
7
+
8
+ For Turbo integration, you can use standard Turbo events like turbo:frame-load or turbo:submit-end as your `custom_event_type` to ensure the dialog responds properly after Turbo navigation or form submissions. The dialog component will listen for these events automatically.
9
+ The implementation handles various actions including 'open', 'close', 'clickConfirm', and 'clickCancel', making it flexible for different interaction patterns in your Turbo-enhanced application.
@@ -11,6 +11,7 @@ examples:
11
11
  - dialog_full_height: Full Height
12
12
  - dialog_full_height_placement: Full Height Placement
13
13
  - dialog_loading: Loading
14
+ - dialog_turbo_frames: Within Turbo Frames
14
15
 
15
16
 
16
17
  react:
@@ -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.
@@ -0,0 +1,42 @@
1
+ <% initial_items = [
2
+ {
3
+ id: "100",
4
+ url: "https://unsplash.it/500/400/?image=638",
5
+ },
6
+ {
7
+ id: "200",
8
+ url: "https://unsplash.it/500/400/?image=639",
9
+ },
10
+ {
11
+ id: "300",
12
+ url: "https://unsplash.it/500/400/?image=640",
13
+ },
14
+ ] %>
15
+
16
+ <%= pb_rails("draggable", props: {initial_items: initial_items}) do %>
17
+ <%= pb_rails("draggable/draggable_container") do %>
18
+ <%= pb_rails("flex") do %>
19
+ <% initial_items.each do |item| %>
20
+ <%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %>
21
+ <%= pb_rails("image", props: { alt: item[:id], size: "md", url: item[:url], margin: "xs" }) %>
22
+ <% end %>
23
+ <% end %>
24
+ <% end %>
25
+ <% end %>
26
+ <% end %>
27
+
28
+ <script>
29
+ const itemIds = ["item_100", "item_200", "item_300"];
30
+
31
+ itemIds.forEach((id) => {
32
+ const element = document.getElementById(id);
33
+ if (element) {
34
+ element.addEventListener("dragstart", (event) => {
35
+ console.log(`${id} drag start!`);
36
+ });
37
+ element.addEventListener("dragend", (event) => {
38
+ console.log(`${id} drag end!`);
39
+ });
40
+ }
41
+ });
42
+ </script>
@@ -0,0 +1 @@
1
+ You can add drag event listeners for `drag`, `dragend`, `dragenter`, `dragleave`, `dragover`, `dragstart`, and `drop`.
@@ -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,18 @@ 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
20
+ - draggable_event_listeners: Draggable Event Listeners
17
21
 
@@ -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'
@@ -1,9 +1,12 @@
1
1
  import React, { useState } from 'react'
2
2
  import Dropdown from '../../pb_dropdown/_dropdown'
3
+ import Icon from '../../pb_icon/_icon'
3
4
 
4
5
  const DropdownError = (props) => {
5
6
  const [selectedOption, setSelectedOption] = useState()
6
- const error = selectedOption?.value ? null : "Please make a valid selection"
7
+ const error = selectedOption?.value ? null : (<>
8
+ <Icon icon="warning" /> Please make a valid selection
9
+ </>)
7
10
  const options = [
8
11
  {
9
12
  label: "United States",
@@ -12,7 +12,7 @@ const DropdownWithAutocomplete = (props) => {
12
12
  label: "Jasper Furniss",
13
13
  value: "Jasper Furniss",
14
14
  territory: "PHL",
15
- title: "Senior UX Engineer",
15
+ title: "Lead UX Engineer",
16
16
  id: "jasper-furniss",
17
17
  status: "Offline"
18
18
  },
@@ -25,18 +25,18 @@ const DropdownWithAutocomplete = (props) => {
25
25
  status: "Away"
26
26
  },
27
27
  {
28
- label: "Jason Cypret",
29
- value: "Jason Cypret",
28
+ label: "Carlos Lima",
29
+ value: "Carlos Lima",
30
30
  territory: "PHL",
31
- title: "VP of User Experience",
32
- id: "jason-cypret",
31
+ title: "Nitro Developer",
32
+ id: "carlos-lima",
33
33
  status: "Online"
34
34
  },
35
35
  {
36
36
  label: "Courtney Long",
37
37
  value: "Courtney Long",
38
38
  territory: "PHL",
39
- title: "UX Design Mentor",
39
+ title: "Lead UX Designer",
40
40
  id: "courtney-long",
41
41
  status: "Online"
42
42
  }