playbook_ui 15.6.0.pre.alpha.play266913088 → 15.6.0.pre.rc.0

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 (169) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +2 -3
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +0 -4
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -95
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +5 -11
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +1 -7
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +163 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +190 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -4
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -3
  11. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +2 -2
  12. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +0 -57
  13. data/app/pb_kits/playbook/pb_background/_background.tsx +6 -6
  14. data/app/pb_kits/playbook/pb_background/background.test.js +1 -5
  15. data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +1 -1
  16. data/app/pb_kits/playbook/pb_background/docs/_background_light.jsx +1 -0
  17. data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -2
  18. data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
  19. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
  20. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +2 -2
  21. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleIcon.tsx +8 -10
  22. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +1 -0
  23. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +3 -0
  24. data/app/pb_kits/playbook/pb_contact/_contact.tsx +24 -51
  25. data/app/pb_kits/playbook/pb_contact/contact.html.erb +19 -53
  26. data/app/pb_kits/playbook/pb_contact/contact.rb +1 -11
  27. data/app/pb_kits/playbook/pb_contact/contact.test.js +0 -76
  28. data/app/pb_kits/playbook/pb_contact/docs/example.yml +0 -2
  29. data/app/pb_kits/playbook/pb_contact/docs/index.js +0 -1
  30. data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +0 -24
  31. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +7 -197
  32. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +14 -23
  33. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +1 -1
  34. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -2
  35. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -1
  36. data/app/pb_kits/playbook/pb_dialog/dialog.rb +0 -1
  37. data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +0 -14
  38. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +4 -5
  39. data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +0 -2
  40. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +0 -31
  41. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -4
  42. data/app/pb_kits/playbook/pb_dialog/docs/index.js +1 -3
  43. data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.md +1 -1
  44. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +7 -458
  45. data/app/pb_kits/playbook/pb_draggable/context/types.ts +3 -8
  46. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +2 -3
  47. data/app/pb_kits/playbook/pb_draggable/docs/index.js +1 -2
  48. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +1 -77
  49. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +5 -7
  50. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +1 -3
  51. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -5
  52. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +0 -4
  53. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +5 -39
  54. data/app/pb_kits/playbook/pb_dropdown/index.js +3 -171
  55. data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +4 -4
  56. data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.tsx +3 -3
  57. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +22 -34
  58. data/app/pb_kits/playbook/pb_home_address_street/city_emphasis.html.erb +12 -16
  59. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +1 -1
  60. data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.html.erb +12 -16
  61. data/app/pb_kits/playbook/pb_home_address_street/street_emphasis.html.erb +12 -16
  62. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +0 -10
  63. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +15 -66
  64. data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +0 -1
  65. data/app/pb_kits/playbook/pb_multiple_users/docs/index.js +0 -1
  66. data/app/pb_kits/playbook/pb_multiple_users/multiple_users.test.js +0 -25
  67. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +10 -44
  68. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +4 -34
  69. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +7 -16
  70. data/app/pb_kits/playbook/pb_radio/docs/_radio_error.md +1 -1
  71. data/app/pb_kits/playbook/pb_select/_select.tsx +3 -8
  72. data/app/pb_kits/playbook/pb_select/docs/_select_error.md +1 -1
  73. data/app/pb_kits/playbook/pb_select/docs/example.yml +0 -2
  74. data/app/pb_kits/playbook/pb_select/docs/index.js +0 -1
  75. data/app/pb_kits/playbook/pb_select/select.html.erb +2 -2
  76. data/app/pb_kits/playbook/pb_select/select.rb +1 -3
  77. data/app/pb_kits/playbook/pb_select/select.test.js +0 -23
  78. data/app/pb_kits/playbook/pb_table/_table.tsx +33 -187
  79. data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -4
  80. data/app/pb_kits/playbook/pb_table/docs/index.js +0 -2
  81. data/app/pb_kits/playbook/pb_table/table.html.erb +12 -68
  82. data/app/pb_kits/playbook/pb_table/table.rb +3 -22
  83. data/app/pb_kits/playbook/pb_table/table.test.js +0 -143
  84. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.md +1 -1
  85. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.md +1 -1
  86. data/app/pb_kits/playbook/pb_timeline/_item.tsx +0 -3
  87. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md +1 -1
  88. data/app/pb_kits/playbook/pb_timeline/docs/example.yml +0 -2
  89. data/app/pb_kits/playbook/pb_timeline/docs/index.js +0 -1
  90. data/app/pb_kits/playbook/pb_timeline/item.html.erb +1 -1
  91. data/app/pb_kits/playbook/pb_timeline/item.rb +0 -2
  92. data/app/pb_kits/playbook/pb_timeline/label.html.erb +1 -2
  93. data/app/pb_kits/playbook/pb_timeline/label.rb +0 -2
  94. data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +0 -3
  95. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +0 -51
  96. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +0 -15
  97. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +0 -3
  98. data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +2 -13
  99. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -6
  100. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -34
  101. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
  102. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -2
  103. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -6
  104. data/app/pb_kits/playbook/tokens/_colors.scss +1 -2
  105. data/dist/chunks/_typeahead-kRdz5zPn.js +6 -0
  106. data/dist/chunks/lib-CgpqUb6l.js +29 -0
  107. data/dist/chunks/vendor.js +3 -3
  108. data/dist/menu.yml +1 -1
  109. data/dist/playbook-rails-react-bindings.js +1 -1
  110. data/dist/playbook-rails.js +1 -1
  111. data/dist/playbook.css +1 -1
  112. data/lib/playbook/forms/builder/collection_select_field.rb +1 -9
  113. data/lib/playbook/forms/builder/select_field.rb +1 -9
  114. data/lib/playbook/forms/builder/time_zone_select_field.rb +1 -9
  115. data/lib/playbook/pb_kit_helper.rb +0 -35
  116. data/lib/playbook/version.rb +2 -2
  117. metadata +4 -54
  118. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.html.erb +0 -43
  119. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.md +0 -1
  120. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.jsx +0 -54
  121. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.md +0 -9
  122. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.jsx +0 -80
  123. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.md +0 -3
  124. data/app/pb_kits/playbook/pb_background/docs/_background_light.md +0 -1
  125. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.html.erb +0 -33
  126. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.jsx +0 -46
  127. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_rails.md +0 -2
  128. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_react.md +0 -2
  129. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.html.erb +0 -24
  130. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.jsx +0 -60
  131. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.md +0 -3
  132. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.html.erb +0 -71
  133. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.jsx +0 -57
  134. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_rails.md +0 -1
  135. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_react.md +0 -1
  136. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.jsx +0 -180
  137. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.md +0 -22
  138. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.html.erb +0 -19
  139. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.html.erb +0 -12
  140. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.md +0 -26
  141. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.html.erb +0 -19
  142. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.md +0 -1
  143. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.html.erb +0 -30
  144. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.md +0 -3
  145. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.html.erb +0 -29
  146. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.md +0 -13
  147. data/app/pb_kits/playbook/pb_dropdown/quickpick_helper.rb +0 -75
  148. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.jsx +0 -42
  149. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.md +0 -1
  150. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.html.erb +0 -16
  151. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.jsx +0 -30
  152. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.md +0 -1
  153. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.jsx +0 -134
  154. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.md +0 -34
  155. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.html.erb +0 -101
  156. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +0 -33
  157. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.jsx +0 -180
  158. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.md +0 -3
  159. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.html.erb +0 -122
  160. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.md +0 -3
  161. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.html.erb +0 -60
  162. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.jsx +0 -118
  163. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.md +0 -1
  164. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.html.erb +0 -30
  165. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.jsx +0 -37
  166. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.md +0 -3
  167. data/app/pb_kits/playbook/utilities/deprecated.ts +0 -73
  168. data/dist/chunks/_typeahead-CbjBmIDu.js +0 -6
  169. data/dist/chunks/lib-DxDBrGZX.js +0 -29
@@ -1,60 +0,0 @@
1
- import React, { useState } from 'react'
2
- import Button from '../../pb_button/_button'
3
- import Dialog from '../../pb_dialog/_dialog'
4
-
5
-
6
- const DialogCloseable = () => {
7
- // Simple example
8
- const [isOpenSimple, setIsOpenSimple] = useState(false)
9
- const closeSimple = () => setIsOpenSimple(false)
10
- const openSimple = () => setIsOpenSimple(true)
11
-
12
- // Complex example
13
- const [isOpenComplex, setIsOpenComplex] = useState(false)
14
- const closeComplex = () => setIsOpenComplex(false)
15
- const openComplex = () => setIsOpenComplex(true)
16
-
17
- return (
18
- <>
19
- <Button
20
- marginRight='md'
21
- onClick={openSimple}
22
- >
23
- {'Open Simple Dialog'}
24
- </Button>
25
- <Button onClick={openComplex}>{'Open Complex Dialog'}</Button>
26
-
27
- <Dialog
28
- cancelButton="Cancel Button"
29
- closeable={false}
30
- confirmButton="Okay"
31
- onCancel={closeSimple}
32
- onClose={closeSimple}
33
- onConfirm={closeSimple}
34
- opened={isOpenSimple}
35
- size="sm"
36
- text="Hello Body Text, Nice to meet ya."
37
- title="Header Title is the Title Prop"
38
- />
39
- <Dialog
40
- onClose={closeComplex}
41
- opened={isOpenComplex}
42
- size="sm"
43
- >
44
- <Dialog.Header closeable={false}>{'Header Title inside Dialog.Header'}</Dialog.Header>
45
- <Dialog.Body>{'Hello Body Text, Nice to meet ya.'}</Dialog.Body>
46
- <Dialog.Footer>
47
- <Button onClick={closeComplex}>{'Okay'}</Button>
48
- <Button
49
- onClick={closeComplex}
50
- variant="link"
51
- >
52
- {'Cancel Button'}
53
- </Button>
54
- </Dialog.Footer>
55
- </Dialog>
56
- </>
57
- )
58
- }
59
-
60
- export default DialogCloseable
@@ -1,3 +0,0 @@
1
- The `closeable` prop can be set to false to optionally render the Dialog header without the close “X” button. `closeable` is set to true by default.
2
-
3
- This prop can be used with the simple as well as the complex version of the Dialog as can be seen here.
@@ -1,71 +0,0 @@
1
- <%
2
- typeahead_options = [
3
- {
4
- label: "United States",
5
- value: "unitedStates",
6
- id: "us"
7
- },
8
- {
9
- label: "United Kingdom",
10
- value: "unitedKingdom",
11
- id: "gb"
12
- },
13
- {
14
- label: "Canada",
15
- value: "canada",
16
- id: "ca"
17
- },
18
- {
19
- label: "Australia",
20
- value: "australia",
21
- id: "au"
22
- },
23
- {
24
- label: "Germany",
25
- value: "germany",
26
- id: "de"
27
- },
28
- {
29
- label: "France",
30
- value: "france",
31
- id: "fr"
32
- },
33
- {
34
- label: "Japan",
35
- value: "japan",
36
- id: "jp"
37
- },
38
- {
39
- label: "Brazil",
40
- value: "brazil",
41
- id: "br"
42
- }
43
- ]
44
- %>
45
-
46
- <%= pb_rails("button", props: { text: "Open Dialog with Overflow Visible", data: {"open-dialog": "dialog-overflow-visible"} }) %>
47
-
48
- <%= pb_rails("dialog", props: {
49
- id: "dialog-overflow-visible",
50
- size: "md",
51
- overflow: "visible"
52
- }) do %>
53
- <%= pb_rails("dialog/dialog_header", props: { id: "dialog-overflow-visible" } ) do %>
54
- <%= pb_rails("body", props: { text: "Select Location" }) %>
55
- <% end %>
56
- <%= pb_rails("dialog/dialog_body") do %>
57
- <%= pb_rails("typeahead", props: {
58
- options: typeahead_options,
59
- placeholder: "Select a location...",
60
- id: "location-typeahead",
61
- is_multi: false,
62
- }) %>
63
- <% end %>
64
- <%= pb_rails("dialog/dialog_footer", props: {
65
- cancel_button: "Cancel",
66
- confirm_button: "Save",
67
- confirm_button_id: "confirm-overflow-visible",
68
- id: "dialog-overflow-visible"
69
- }) %>
70
- <% end %>
71
-
@@ -1,57 +0,0 @@
1
- import React, { useState } from 'react'
2
-
3
- import Body from '../../pb_body/_body'
4
- import Button from '../../pb_button/_button'
5
- import Dialog from '../../pb_dialog/_dialog'
6
- import Typeahead from '../../pb_typeahead/_typeahead'
7
-
8
- const DialogOverflowVisible = () => {
9
- const [isOpen, setIsOpen] = useState(false)
10
- const close = () => setIsOpen(false)
11
- const open = () => setIsOpen(true)
12
-
13
- const typeaheadOptions = [
14
- { label: "United States", value: "unitedStates", id: "us" },
15
- { label: "United Kingdom", value: "unitedKingdom", id: "gb" },
16
- { label: "Canada", value: "canada", id: "ca" },
17
- { label: "Australia", value: "australia", id: "au" },
18
- { label: "Germany", value: "germany", id: "de" },
19
- { label: "France", value: "france", id: "fr" },
20
- { label: "Japan", value: "japan", id: "jp" },
21
- { label: "Brazil", value: "brazil", id: "br" },
22
- ]
23
-
24
- return (
25
- <>
26
- <Button onClick={open}>{'Open Dialog with Overflow Visible'}</Button>
27
- <Dialog
28
- onClose={close}
29
- opened={isOpen}
30
- overflow="visible"
31
- size="md"
32
- >
33
- <Dialog.Header>
34
- <Body>{'Select Location'}</Body>
35
- </Dialog.Header>
36
- <Dialog.Body>
37
- <Typeahead
38
- options={typeaheadOptions}
39
- placeholder="Select a location..."
40
- />
41
- </Dialog.Body>
42
- <Dialog.Footer>
43
- <Button onClick={close}>{'Save'}</Button>
44
- <Button
45
- onClick={close}
46
- variant="link"
47
- >
48
- {'Cancel'}
49
- </Button>
50
- </Dialog.Footer>
51
- </Dialog>
52
- </>
53
- )
54
- }
55
-
56
- export default DialogOverflowVisible
57
-
@@ -1 +0,0 @@
1
- Use the `overflow: "visible"` global prop to allow Typeahead dropdown menus to appear outside the dialog boundaries. By default, dialogs clip content that extends beyond their edges, but this prop enables pop-up elements to render above the dialog overlay.
@@ -1 +0,0 @@
1
- Use the `overflow="visible"` global prop to allow Date Picker and Typeahead dropdown menus to appear outside the dialog boundaries. By default, dialogs clip content that extends beyond their edges, but this prop enables pop-up elements to render above the dialog overlay.
@@ -1,180 +0,0 @@
1
- import React, { useState } from "react";
2
-
3
- import Flex from '../../pb_flex/_flex'
4
- import Draggable from '../../pb_draggable/_draggable'
5
- import { DraggableProvider } from '../../pb_draggable/context'
6
- import Badge from '../../pb_badge/_badge'
7
- import Title from '../../pb_title/_title'
8
- import Caption from '../../pb_caption/_caption'
9
- import Card from '../../pb_card/_card'
10
- import FlexItem from '../../pb_flex/_flex_item'
11
- import Avatar from '../../pb_avatar/_avatar'
12
- import Body from '../../pb_body/_body'
13
-
14
- // Initial groups to drag between
15
- const containers = ["To Do", "In Progress", "Done"];
16
-
17
- // Initial items to be dragged
18
- const data = [
19
- {
20
- id: "11",
21
- container: "To Do",
22
- title: "Task 1",
23
- description: "Bug fixes",
24
- assignee_name: "Terry Miles",
25
- assignee_img: "https://randomuser.me/api/portraits/men/44.jpg",
26
- },
27
- {
28
- id: "12",
29
- container: "To Do",
30
- title: "Task 2",
31
- description: "Documentation",
32
- assignee_name: "Sophia Miles",
33
- assignee_img: "https://randomuser.me/api/portraits/women/8.jpg",
34
- },
35
- {
36
- id: "13",
37
- container: "In Progress",
38
- title: "Task 3",
39
- description: "Add a variant",
40
- assignee_name: "Alice Jones",
41
- assignee_img: "https://randomuser.me/api/portraits/women/10.jpg",
42
- },
43
- {
44
- id: "14",
45
- container: "To Do",
46
- title: "Task 4",
47
- description: "Add jest tests",
48
- assignee_name: "Mike James",
49
- assignee_img: "https://randomuser.me/api/portraits/men/8.jpg",
50
- },
51
- {
52
- id: "15",
53
- container: "Done",
54
- title: "Task 5",
55
- description: "Alpha testing",
56
- assignee_name: "James Guy",
57
- assignee_img: "https://randomuser.me/api/portraits/men/18.jpg",
58
- },
59
- {
60
- id: "16",
61
- container: "In Progress",
62
- title: "Task 6",
63
- description: "Release",
64
- assignee_name: "Sally Jones",
65
- assignee_img: "https://randomuser.me/api/portraits/women/28.jpg",
66
- },
67
- ];
68
-
69
- const DraggableMultipleContainersDropzone = (props) => {
70
- const [initialState, setInitialState] = useState(data);
71
-
72
- const badgeProperties = (container) => {
73
- switch (container) {
74
- case "To Do":
75
- return { text: "queue", color: "warning" };
76
- case "In Progress":
77
- return { text: "progress", color: "primary" };
78
- default:
79
- return { text: "done", color: "success" };
80
- }
81
- };
82
-
83
- return (
84
- <DraggableProvider
85
- dropZone={{type: "outline"}}
86
- enableCrossContainerPreview
87
- initialItems={data}
88
- onDragEnd={(draggedItemId, finalContainer, originalContainer, itemAbove, itemBelow) => {
89
- console.log(`Dragged Item ID: ${draggedItemId}`);
90
- console.log(`Final Container: ${finalContainer}`);
91
- console.log(`Original Container: ${originalContainer}`);
92
- console.log('Item Above:', itemAbove);
93
- console.log('Item Below:', itemBelow);
94
- }}
95
- onDrop={(draggedItemId, droppedContainer, originalContainer, item, itemAbove, itemBelow) => {
96
- console.log(`Dragged Item ID: ${draggedItemId}`);
97
- console.log(`Dropped Container: ${droppedContainer}`);
98
- console.log(`Original Container: ${originalContainer}`);
99
- console.log('Dropped Item:', item);
100
- console.log('Item Above:', itemAbove);
101
- console.log('Item Below:', itemBelow);
102
- }}
103
- onReorder={(items) => setInitialState(items)}
104
- >
105
- <Flex
106
- justifyContent="center"
107
- {...props}
108
- >
109
- {containers?.map((container) => (
110
- <Draggable.Container
111
- container={container}
112
- htmlOptions={{style:{ width: "200px", height: "70vh"}}}
113
- key={container}
114
- padding="sm"
115
- >
116
- <Caption textAlign="center">{container}</Caption>
117
- <Flex
118
- alignItems="stretch"
119
- gap="sm"
120
- orientation="column"
121
- >
122
- {initialState
123
- .filter((item) => item.container === container)
124
- .map(
125
- ({
126
- assignee_img,
127
- assignee_name,
128
- description,
129
- id,
130
- title,
131
- }) => (
132
- <Draggable.Item
133
- container={container}
134
- dragId={id}
135
- key={id}
136
- >
137
- <Card
138
- padding="sm"
139
- {...props}
140
- >
141
- <Flex justify="between">
142
- <FlexItem>
143
- <Flex>
144
- <Avatar
145
- imageUrl={assignee_img}
146
- name={assignee_name}
147
- size="xxs"
148
- />
149
- <Title paddingLeft="xs"
150
- size={4}
151
- text={title}
152
- {...props}
153
- />
154
- </Flex>
155
- </FlexItem>
156
- <Badge
157
- marginLeft="sm"
158
- rounded
159
- text={badgeProperties(container).text}
160
- variant={badgeProperties(container).color}
161
- {...props}
162
- />
163
- </Flex>
164
- <Body paddingTop="xs"
165
- text={description}
166
- {...props}
167
- />
168
- </Card>
169
- </Draggable.Item>
170
- )
171
- )}
172
- </Flex>
173
- </Draggable.Container>
174
- ))}
175
- </Flex>
176
- </DraggableProvider>
177
- );
178
- };
179
-
180
- export default DraggableMultipleContainersDropzone;
@@ -1,22 +0,0 @@
1
- The multiple container functionality also supports customized dropzone styling as shown here.
2
-
3
- In addition to this, the `enableCrossContainerPreview` prop can be used on the `DraggableProvider` as shown here to enable dropzone preview for cross-container dragging.
4
-
5
- With `enableCrossContainerPreview`, the `onDrop` and `onDragEnd` event listeners will also provide several arguments to allow developers more context from the drag event.
6
-
7
- The `onDrop` callback is triggered when an item is successfully dropped into a container. It provides the following arguments:
8
-
9
- - `draggedItemId` - The ID of the item that was dragged
10
- - `droppedContainer` - The container where the item was dropped
11
- - `originalContainer` - The container where the drag started
12
- - `item` - The complete item object with all properties (including the updated container)
13
- - `itemAbove` - The item directly above the dropped item in the final position (null if at the top)
14
- - `itemBelow` - The item directly below the dropped item in the final position (null if at the bottom)
15
-
16
- The `onDragEnd` callback is triggered when a drag operation ends, whether it was dropped or cancelled. It provides the following arguments:
17
-
18
- - `draggedItemId` - The ID of the item that was dragged
19
- - `finalContainer` - The container where the item ended up (could be same as original if drag was cancelled)
20
- - `originalContainer` - The container where the drag started
21
- - `itemAbove` - The item directly above the dragged item in the final position (null if at the top)
22
- - `itemBelow` - The item directly below the dragged item in the final position (null if at the bottom)
@@ -1,19 +0,0 @@
1
-
2
- <%= pb_rails("dropdown", props: {
3
- id: "date-range-with-default",
4
- label: "Date Range",
5
- variant: "quickpick",
6
- default_value: "This Year"
7
- }) %>
8
-
9
- <script>
10
- document.addEventListener("DOMContentLoaded", () => {
11
- const dropdown = document.getElementById("date-range-with-default");
12
- if (dropdown) {
13
- dropdown.addEventListener("pb:dropdown:selected", (e) => {
14
- const option = e.detail;
15
- console.log("Selected option:", option);
16
- });
17
- }
18
- });
19
- </script>
@@ -1,12 +0,0 @@
1
- <%= pb_rails("dropdown", props: {id: "date-range-quickpick-1", label: "Date Range", variant: "quickpick"}) %>
2
-
3
-
4
- <script>
5
- const dropdown = document.getElementById("date-range-quickpick-1");
6
- if (dropdown) {
7
- dropdown.addEventListener("pb:dropdown:selected", (e) => {
8
- const option = e.detail;
9
- console.log("Selected option:", option);
10
- });
11
- }
12
- </script>
@@ -1,26 +0,0 @@
1
- The `quickpick` variant provides predefined date based options when `variant:"quickpick"` is used.
2
-
3
- Open the Dropdown above to see the default options.
4
-
5
- The quickpick variant automatically generates hidden inputs for `start_date` and `end_date` which are populated when a date range is selected. These inputs are ready for form submission.
6
-
7
- You can customize the input names and IDs using the following props:
8
- - `start_date_name` - The name attribute for the start date input (default: `"start_date_name"`)
9
- - `start_date_id` - The ID attribute for the start date input (default: `"start_date_id"`)
10
- - `end_date_name` - The name attribute for the end date input (default: `"end_date_name"`)
11
- - `end_date_id` - The ID attribute for the end date input (default: `"end_date_id"`)
12
-
13
- Example with custom names:
14
- ```ruby
15
- pb_rails("dropdown", props: {
16
- variant: "quickpick",
17
- start_date_name: "filter[start_date]",
18
- start_date_id: "filter_start_date",
19
- end_date_name: "filter[end_date]",
20
- end_date_id: "filter_end_date"
21
- })
22
- ```
23
-
24
- The Dropdown kit also comes with a custom event called "pb:dropdown:selected" which updates dynamically with the selection as it changes. See code snippet to see this in action.
25
-
26
- In addition, a data attribute called data-option-selected with the selection is also rendered on the parent dropdown div.
@@ -1,19 +0,0 @@
1
-
2
- <%= pb_rails("dropdown", props: {
3
- id: "date-range-quickpick-end-today",
4
- label: "Date Range",
5
- variant: "quickpick",
6
- range_ends_today: true
7
- }) %>
8
-
9
- <script>
10
- document.addEventListener("DOMContentLoaded", () => {
11
- const dropdown = document.getElementById("date-range-quickpick-end-today");
12
- if (dropdown) {
13
- dropdown.addEventListener("pb:dropdown:selected", (e) => {
14
- const option = e.detail;
15
- console.log("Selected option:", option);
16
- });
17
- }
18
- });
19
- </script>
@@ -1 +0,0 @@
1
- The optional `range_ends_today` prop can be used with the `quickpick` variant to set end date on all ranges that start with 'this' to today's date. For instance, by default 'This Year' will set end day to 12/31/(current year), but if `range_ends_today` prop is used, end date on that range will be today's date.
@@ -1,30 +0,0 @@
1
- <%= pb_rails("dropdown", props: {
2
- id: "dropdown-quickpick-with-date-pickers-default",
3
- label: "Date Range",
4
- name: "date_range",
5
- margin_bottom: "sm",
6
- variant: "quickpick",
7
- default_value: "This Month",
8
- controls_start_id: "start-date-picker-default",
9
- controls_end_id: "end-date-picker-default",
10
- start_date_id: "quickpick_start_date_default",
11
- start_date_name: "start_date",
12
- end_date_id: "quickpick_end_date_default",
13
- end_date_name: "end_date"
14
- }) %>
15
-
16
- <%= pb_rails("date_picker", props: {
17
- picker_id: "start-date-picker-default",
18
- label: "Start Date",
19
- name: "start_date_picker",
20
- placeholder: "Select Start Date",
21
- sync_start_with: "dropdown-quickpick-with-date-pickers-default"
22
- }) %>
23
-
24
- <%= pb_rails("date_picker", props: {
25
- picker_id: "end-date-picker-default",
26
- label: "End Date",
27
- name: "end_date_picker",
28
- placeholder: "Select End Date",
29
- sync_end_with: "dropdown-quickpick-with-date-pickers-default"
30
- }) %>
@@ -1,3 +0,0 @@
1
- This example demonstrates the 3-input pattern with a default value. The dropdown is initialized with "This Month" selected, and both DatePickers are automatically populated with the corresponding start and end dates.
2
-
3
- The default value can be set using the `default_value` prop with any of the quickpick option labels.
@@ -1,29 +0,0 @@
1
- <%= pb_rails("dropdown", props: {
2
- id: "dropdown-quickpick-with-date-pickers",
3
- label: "Date Range",
4
- name: "date_range",
5
- margin_bottom: "sm",
6
- variant: "quickpick",
7
- controls_start_id: "start-date-picker",
8
- controls_end_id: "end-date-picker",
9
- start_date_id: "quickpick_start_date",
10
- start_date_name: "start_date",
11
- end_date_id: "quickpick_end_date",
12
- end_date_name: "end_date"
13
- }) %>
14
-
15
- <%= pb_rails("date_picker", props: {
16
- picker_id: "start-date-picker",
17
- label: "Start Date",
18
- name: "start_date_picker",
19
- placeholder: "Select Start Date",
20
- sync_start_with: "dropdown-quickpick-with-date-pickers"
21
- }) %>
22
-
23
- <%= pb_rails("date_picker", props: {
24
- picker_id: "end-date-picker",
25
- label: "End Date",
26
- name: "end_date_picker",
27
- placeholder: "Select End Date",
28
- sync_end_with: "dropdown-quickpick-with-date-pickers"
29
- }) %>
@@ -1,13 +0,0 @@
1
- The quickpick variant can be synced with two DatePickers for a 3-input pattern. When a quickpick option is selected from the dropdown, both DatePickers are automatically populated. When either DatePicker is manually changed, the dropdown is cleared.
2
-
3
- #### Props for 3-Input Pattern:
4
-
5
- - `controls_start_id` - ID of the start DatePicker to sync with
6
- - `controls_end_id` - ID of the end DatePicker to sync with
7
-
8
- #### DatePicker Props:
9
-
10
- - `sync_start_with` - ID of the dropdown to clear when start date changes
11
- - `sync_end_with` - ID of the dropdown to clear when end date changes
12
-
13
- This pattern allows users to quickly select common date ranges or manually pick specific dates.
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Playbook
4
- module PbDropdown
5
- module QuickpickHelper
6
- class << self
7
- def get_quickpick_options(range_ends_today: false)
8
- today = Date.today
9
- yesterday = today - 1.day
10
-
11
- this_week_start_date = first_day_of_week(today)
12
- this_week_end_date = range_ends_today ? today : last_day_of_week(today)
13
- last_week_start_date = previous_week_start_date(today)
14
- last_week_end_date = previous_week_end_date(today)
15
-
16
- this_month_start_date = today.beginning_of_month
17
- this_month_end_date = range_ends_today ? today : today.end_of_month
18
- last_month_start_date = (today - 1.month).beginning_of_month
19
- last_month_end_date = (today - 1.month).end_of_month
20
-
21
- this_quarter_start_date = today.beginning_of_quarter
22
- this_quarter_end_date = range_ends_today ? today : today.end_of_quarter
23
- last_quarter_start_date = (today - 3.months).beginning_of_quarter
24
- last_quarter_end_date = (today - 3.months).end_of_quarter
25
-
26
- this_year_start_date = today.beginning_of_year
27
- this_year_end_date = range_ends_today ? today : today.end_of_year
28
- last_year_start_date = (today - 1.year).beginning_of_year
29
- last_year_end_date = (today - 1.year).end_of_year
30
-
31
- [
32
- { id: "quickpick-today", label: "Today", value: [today.to_s, today.to_s], formatted_start_date: format_date(today), formatted_end_date: format_date(today) },
33
- { id: "quickpick-yesterday", label: "Yesterday", value: [yesterday.to_s, yesterday.to_s], formatted_start_date: format_date(yesterday), formatted_end_date: format_date(yesterday) },
34
- { id: "quickpick-this-week", label: "This Week", value: [this_week_start_date.to_s, this_week_end_date.to_s], formatted_start_date: format_date(this_week_start_date), formatted_end_date: format_date(this_week_end_date) },
35
- { id: "quickpick-this-month", label: "This Month", value: [this_month_start_date.to_s, this_month_end_date.to_s], formatted_start_date: format_date(this_month_start_date), formatted_end_date: format_date(this_month_end_date) },
36
- { id: "quickpick-this-quarter", label: "This Quarter", value: [this_quarter_start_date.to_s, this_quarter_end_date.to_s], formatted_start_date: format_date(this_quarter_start_date), formatted_end_date: format_date(this_quarter_end_date) },
37
- { id: "quickpick-this-year", label: "This Year", value: [this_year_start_date.to_s, this_year_end_date.to_s], formatted_start_date: format_date(this_year_start_date), formatted_end_date: format_date(this_year_end_date) },
38
- { id: "quickpick-last-week", label: "Last Week", value: [last_week_start_date.to_s, last_week_end_date.to_s], formatted_start_date: format_date(last_week_start_date), formatted_end_date: format_date(last_week_end_date) },
39
- { id: "quickpick-last-month", label: "Last Month", value: [last_month_start_date.to_s, last_month_end_date.to_s], formatted_start_date: format_date(last_month_start_date), formatted_end_date: format_date(last_month_end_date) },
40
- { id: "quickpick-last-quarter", label: "Last Quarter", value: [last_quarter_start_date.to_s, last_quarter_end_date.to_s], formatted_start_date: format_date(last_quarter_start_date), formatted_end_date: format_date(last_quarter_end_date) },
41
- { id: "quickpick-last-year", label: "Last Year", value: [last_year_start_date.to_s, last_year_end_date.to_s], formatted_start_date: format_date(last_year_start_date), formatted_end_date: format_date(last_year_end_date) },
42
- ]
43
- end
44
-
45
- private
46
-
47
- def format_date(date)
48
- date.strftime("%m/%d/%Y")
49
- end
50
-
51
- def format_date_range(start_date, end_date)
52
- "#{format_date(start_date)} - #{format_date(end_date)}"
53
- end
54
-
55
- def first_day_of_week(date)
56
- # Monday as first day of week
57
- date.beginning_of_week(:monday)
58
- end
59
-
60
- def last_day_of_week(date)
61
- # Sunday as last day of week
62
- date.end_of_week(:monday)
63
- end
64
-
65
- def previous_week_start_date(date)
66
- first_day_of_week(date) - 1.week
67
- end
68
-
69
- def previous_week_end_date(date)
70
- last_day_of_week(date) - 1.week
71
- end
72
- end
73
- end
74
- end
75
- end