playbook_ui_docs 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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +5 -11
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +1 -7
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +163 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +190 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -4
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -3
  8. data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +1 -1
  9. data/app/pb_kits/playbook/pb_background/docs/_background_light.jsx +1 -0
  10. data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -2
  11. data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
  12. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
  13. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +1 -0
  14. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +3 -0
  15. data/app/pb_kits/playbook/pb_contact/docs/example.yml +0 -2
  16. data/app/pb_kits/playbook/pb_contact/docs/index.js +0 -1
  17. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +14 -23
  18. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +1 -1
  19. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +0 -31
  20. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -4
  21. data/app/pb_kits/playbook/pb_dialog/docs/index.js +1 -3
  22. data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.md +1 -1
  23. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +2 -3
  24. data/app/pb_kits/playbook/pb_draggable/docs/index.js +1 -2
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +5 -7
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +1 -3
  27. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -5
  28. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +1 -1
  29. data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +0 -1
  30. data/app/pb_kits/playbook/pb_multiple_users/docs/index.js +0 -1
  31. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +4 -34
  32. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +7 -16
  33. data/app/pb_kits/playbook/pb_radio/docs/_radio_error.md +1 -1
  34. data/app/pb_kits/playbook/pb_select/docs/_select_error.md +1 -1
  35. data/app/pb_kits/playbook/pb_select/docs/example.yml +0 -2
  36. data/app/pb_kits/playbook/pb_select/docs/index.js +0 -1
  37. data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -4
  38. data/app/pb_kits/playbook/pb_table/docs/index.js +0 -2
  39. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.md +1 -1
  40. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.md +1 -1
  41. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md +1 -1
  42. data/app/pb_kits/playbook/pb_timeline/docs/example.yml +0 -2
  43. data/app/pb_kits/playbook/pb_timeline/docs/index.js +0 -1
  44. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
  45. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -2
  46. metadata +2 -50
  47. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.html.erb +0 -43
  48. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.md +0 -1
  49. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.jsx +0 -54
  50. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.md +0 -9
  51. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.jsx +0 -80
  52. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.md +0 -3
  53. data/app/pb_kits/playbook/pb_background/docs/_background_light.md +0 -1
  54. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.html.erb +0 -33
  55. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.jsx +0 -46
  56. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_rails.md +0 -2
  57. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_react.md +0 -2
  58. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.html.erb +0 -24
  59. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.jsx +0 -60
  60. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.md +0 -3
  61. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.html.erb +0 -71
  62. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.jsx +0 -57
  63. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_rails.md +0 -1
  64. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_react.md +0 -1
  65. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.jsx +0 -180
  66. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.md +0 -22
  67. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.html.erb +0 -19
  68. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.html.erb +0 -12
  69. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.md +0 -26
  70. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.html.erb +0 -19
  71. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.md +0 -1
  72. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.html.erb +0 -30
  73. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.md +0 -3
  74. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.html.erb +0 -29
  75. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.md +0 -13
  76. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.jsx +0 -42
  77. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.md +0 -1
  78. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.html.erb +0 -16
  79. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.jsx +0 -30
  80. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.md +0 -1
  81. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.jsx +0 -134
  82. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.md +0 -34
  83. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.html.erb +0 -101
  84. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +0 -33
  85. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.jsx +0 -180
  86. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.md +0 -3
  87. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.html.erb +0 -122
  88. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.md +0 -3
  89. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.html.erb +0 -60
  90. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.jsx +0 -118
  91. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.md +0 -1
  92. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.html.erb +0 -30
  93. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.jsx +0 -37
  94. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.md +0 -3
@@ -1,80 +0,0 @@
1
- import React from "react"
2
- import AdvancedTable from '../_advanced_table'
3
- import colors from '../../tokens/exports/_colors.module.scss'
4
- import MOCK_DATA from "./advanced_table_mock_data.json"
5
-
6
-
7
- const AdvancedTableColumnStylingBackgroundMulti = (props) => {
8
- const columnDefinitions = [
9
- {
10
- accessor: "year",
11
- label: "Year",
12
- cellAccessors: ["quarter", "month", "day"],
13
- },
14
- {
15
- label: "Enrollment Data",
16
- columns: [
17
- {
18
- label: "Enrollment Stats",
19
- columns: [
20
- {
21
- accessor: "newEnrollments",
22
- label: "New Enrollments",
23
- columnStyling:{cellBackgroundColor: colors.error_subtle, headerBackgroundColor: colors.error_subtle},
24
- },
25
- {
26
- accessor: "scheduledMeetings",
27
- label: "Scheduled Meetings",
28
- },
29
- ],
30
- },
31
- ],
32
- },
33
- {
34
- label: "Performance Data",
35
- columns: [
36
- {
37
- label: "Completion Metrics",
38
- columns: [
39
- {
40
- accessor: "completedClasses",
41
- label: "Completed Classes",
42
- columnStyling:{cellBackgroundColor: colors.info, headerBackgroundColor: colors.info, fontColor: colors.white, headerFontColor: colors.white},
43
- },
44
- {
45
- accessor: "classCompletionRate",
46
- label: "Class Completion Rate",
47
- },
48
- ],
49
- },
50
- {
51
- label: "Attendance",
52
- columns: [
53
- {
54
- accessor: "attendanceRate",
55
- label: "Attendance Rate",
56
- columnStyling:{cellBackgroundColor: colors.info_subtle},
57
- },
58
- {
59
- accessor: "scheduledMeetings",
60
- label: "Scheduled Meetings",
61
- },
62
- ],
63
- },
64
- ],
65
- },
66
- ];
67
-
68
-
69
- return (
70
- <div>
71
- <AdvancedTable
72
- columnDefinitions={columnDefinitions}
73
- tableData={MOCK_DATA}
74
- {...props}
75
- />
76
- </div>
77
- )
78
- }
79
-
80
- export default AdvancedTableColumnStylingBackgroundMulti
@@ -1,3 +0,0 @@
1
- The `columnStyling` prop can also be used to set background color for entire columns for the multi header variant as well.
2
-
3
- It should be noted that `headerFontColor` and `headerBackgroundColor` in the multi header variant will only apply to the immediate header for the given column as shown here.
@@ -1 +0,0 @@
1
- By default, the Background kit sets background color to 'light' as seen here.
@@ -1,33 +0,0 @@
1
- <%= pb_rails("body", props: { color: "default" }) do %>
2
- <%= pb_rails("contact", props: {
3
- contact_value: "2125551234",
4
- icon_enabled: false,
5
- unstyled: true
6
- }) %>
7
- <% end %>
8
-
9
- <%= pb_rails("body", props: { color: "light" }) do %>
10
- <%= pb_rails("contact", props: {
11
- contact_value: "12125551234",
12
- icon_enabled: false,
13
- unstyled: true
14
- }) %>
15
- <% end %>
16
-
17
- <%= pb_rails("body", props: { color: "lighter" }) do %>
18
- <%= pb_rails("contact", props: {
19
- contact_value: "4155551234",
20
- icon_enabled: false,
21
- unstyled: true
22
- }) %>
23
- <% end %>
24
-
25
- <%= pb_rails("body", props: { color: "default" }) do %>
26
- <%= pb_rails("contact", props: {
27
- contact_type: "extension",
28
- contact_value: "1234",
29
- icon_enabled: false,
30
- unstyled: true
31
- }) %>
32
- <% end %>
33
-
@@ -1,46 +0,0 @@
1
- import React from 'react'
2
- import Contact from "../../pb_contact/_contact"
3
- import Body from "../../pb_body/_body"
4
-
5
- const ContactUnstyled = (props) => {
6
- return (
7
- <div>
8
- <Body color="default">
9
- <Contact
10
- contactValue="2125551234"
11
- iconEnabled={false}
12
- unstyled
13
- {...props}
14
- />
15
- </Body>
16
- <Body color="light">
17
- <Contact
18
- contactValue="12125551234"
19
- iconEnabled={false}
20
- unstyled
21
- {...props}
22
- />
23
- </Body>
24
- <Body color="lighter">
25
- <Contact
26
- contactValue="4155551234"
27
- iconEnabled={false}
28
- unstyled
29
- {...props}
30
- />
31
- </Body>
32
- <Body color="default">
33
- <Contact
34
- contactType="extension"
35
- contactValue="1234"
36
- iconEnabled={false}
37
- unstyled
38
- {...props}
39
- />
40
- </Body>
41
- </div>
42
- )
43
- }
44
-
45
- export default ContactUnstyled
46
-
@@ -1,2 +0,0 @@
1
- Use the Contact kit with `icon_enabled: false` and `unstyled: true` to display phone numbers with full typography control. When `unstyled: true`, the Contact kit renders just the formatted text without a Body wrapper, allowing you to wrap it in your own Typography kit to control the color and styling.
2
-
@@ -1,2 +0,0 @@
1
- Use the Contact kit with `iconEnabled={false}` and `unstyled` to display phone numbers with full typography control. With `unstyled`, the Contact kit renders just the formatted text without a Body wrapper, allowing you to wrap it in your own Typography kit to control the color and styling.
2
-
@@ -1,24 +0,0 @@
1
- <%= pb_rails("flex", props:{wrap:true}) do %>
2
- <%= pb_rails("button", props: { text: "Open Simple Dialog", data: {"open-dialog": "dialog-simple"}, margin_right:"md" }) %>
3
- <%= pb_rails("button", props: { text: "Open Complex Dialog", data: {"open-dialog": "dialog-complex2"} }) %>
4
- <% end %>
5
-
6
- <%= pb_rails("dialog", props: {
7
- id:"dialog-simple",
8
- size: "sm",
9
- title: "Header Title is the Title Prop",
10
- text: "Hello Body Text, Nice to meet ya.",
11
- cancel_button: "Cancel Button",
12
- closeable: false,
13
- confirm_button: "Okay",
14
- confirm_button_id: "confirm-button-simple"
15
- }) %>
16
-
17
- <%= pb_rails("dialog", props: {
18
- id:"dialog-complex2",
19
- size: "sm"
20
- }) do %>
21
- <%= pb_rails("dialog/dialog_header", props: { id: "dialog-complex2", title:"Header Title inside Dialog Header", closeable: false } ) %>
22
- <%= pb_rails("dialog/dialog_body", props:{text: "Hello Body Text, Nice to meet ya."}) %>
23
- <%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Cancel Button", confirm_button: "Okay", confirm_button_id:"confirm-complex2", id: "dialog-complex2"}) %>
24
- <% end %>
@@ -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.