playbook_ui_docs 16.10.0 → 16.11.0.pre.alpha.PLAY3001vcupdate17723

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 (120) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_both.jsx +57 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_both_react.md +1 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_bottom.jsx +57 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_bottom_react.md +1 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_react.md +2 -2
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -2
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
  9. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_display_disabled_option.html.erb +93 -0
  10. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_display_disabled_option.jsx +127 -0
  11. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_display_disabled_option.md +1 -0
  12. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_disabled.html.erb +10 -0
  13. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_disabled.jsx +37 -0
  14. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_disabled_option.html.erb +10 -0
  15. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_disabled_option.jsx +37 -0
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_disabled_option.md +1 -0
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.json +149 -237
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.overrides.json +58 -74
  19. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +6 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +3 -0
  21. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_remove_replace.html.erb +66 -0
  22. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_remove_replace.jsx +53 -0
  23. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_remove_replace.md +5 -0
  24. data/app/pb_kits/playbook/pb_file_upload/docs/example.yml +3 -1
  25. data/app/pb_kits/playbook/pb_file_upload/docs/index.js +1 -0
  26. data/app/pb_kits/playbook/pb_form_group/docs/_playground.json +100 -1
  27. data/app/pb_kits/playbook/pb_form_group/docs/_playground.overrides.json +91 -0
  28. data/app/pb_kits/playbook/pb_full_screen/docs/_description.md +1 -0
  29. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_content_padding.jsx +68 -0
  30. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_content_padding.md +1 -0
  31. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_custom_trigger.jsx +71 -0
  32. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_custom_trigger.md +1 -0
  33. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_default.html.erb +3 -0
  34. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_default.jsx +63 -0
  35. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_default.md +1 -0
  36. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_header_text_styling.jsx +68 -0
  37. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_header_text_styling.md +1 -0
  38. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_sticky_header.jsx +68 -0
  39. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_sticky_header.md +1 -0
  40. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_table_and_filter.jsx +149 -0
  41. data/app/pb_kits/playbook/pb_full_screen/docs/_full_screen_table_and_filter.md +1 -0
  42. data/app/pb_kits/playbook/pb_full_screen/docs/_playground.json +155 -0
  43. data/app/pb_kits/playbook/pb_full_screen/docs/_playground.overrides.json +137 -0
  44. data/app/pb_kits/playbook/pb_full_screen/docs/example.yml +14 -0
  45. data/app/pb_kits/playbook/pb_full_screen/docs/index.js +6 -0
  46. data/app/pb_kits/playbook/pb_icon/docs/_playground.json +2 -16
  47. data/app/pb_kits/playbook/pb_icon/docs/_playground.overrides.json +2 -13
  48. data/app/pb_kits/playbook/pb_layout/docs/_playground.json +246 -1
  49. data/app/pb_kits/playbook/pb_layout/docs/_playground.overrides.json +188 -0
  50. data/app/pb_kits/playbook/pb_nav/docs/_playground.json +117 -213
  51. data/app/pb_kits/playbook/pb_nav/docs/_playground.overrides.json +127 -319
  52. data/app/pb_kits/playbook/pb_popover/docs/_popover_list.html.erb +2 -2
  53. data/app/pb_kits/playbook/pb_progress_pills/docs/_playground.json +26 -13
  54. data/app/pb_kits/playbook/pb_progress_pills/docs/_playground.overrides.json +24 -6
  55. data/app/pb_kits/playbook/pb_progress_simple/docs/_playground.json +50 -17
  56. data/app/pb_kits/playbook/pb_progress_simple/docs/_playground.overrides.json +41 -7
  57. data/app/pb_kits/playbook/pb_progress_step/docs/_playground.json +218 -1
  58. data/app/pb_kits/playbook/pb_progress_step/docs/_playground.overrides.json +189 -0
  59. data/app/pb_kits/playbook/pb_radio/docs/_playground.json +80 -6
  60. data/app/pb_kits/playbook/pb_radio/docs/_playground.overrides.json +82 -3
  61. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_playground.json +171 -1
  62. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_playground.overrides.json +153 -0
  63. data/app/pb_kits/playbook/pb_select/docs/_playground.json +65 -19
  64. data/app/pb_kits/playbook/pb_select/docs/_playground.overrides.json +54 -14
  65. data/app/pb_kits/playbook/pb_selectable_card/docs/_playground.json +75 -82
  66. data/app/pb_kits/playbook/pb_selectable_card/docs/_playground.overrides.json +76 -76
  67. data/app/pb_kits/playbook/pb_selectable_card_icon/docs/_playground.json +128 -1
  68. data/app/pb_kits/playbook/pb_selectable_card_icon/docs/_playground.overrides.json +106 -0
  69. data/app/pb_kits/playbook/pb_selectable_icon/docs/_playground.json +37 -21
  70. data/app/pb_kits/playbook/pb_selectable_icon/docs/_playground.overrides.json +35 -18
  71. data/app/pb_kits/playbook/pb_selectable_list/docs/_playground.json +174 -12
  72. data/app/pb_kits/playbook/pb_selectable_list/docs/_playground.overrides.json +162 -10
  73. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_playground.json +92 -1
  74. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_playground.overrides.json +80 -0
  75. data/app/pb_kits/playbook/pb_source/docs/_playground.json +88 -1
  76. data/app/pb_kits/playbook/pb_source/docs/_playground.overrides.json +80 -0
  77. data/app/pb_kits/playbook/pb_star_rating/docs/_playground.json +28 -53
  78. data/app/pb_kits/playbook/pb_star_rating/docs/_playground.overrides.json +33 -32
  79. data/app/pb_kits/playbook/pb_stat_change/docs/_playground.json +15 -9
  80. data/app/pb_kits/playbook/pb_stat_change/docs/_playground.overrides.json +15 -5
  81. data/app/pb_kits/playbook/pb_stat_value/docs/_playground.json +19 -9
  82. data/app/pb_kits/playbook/pb_stat_value/docs/_playground.overrides.json +18 -7
  83. data/app/pb_kits/playbook/pb_table/docs/_playground.json +259 -1
  84. data/app/pb_kits/playbook/pb_table/docs/_playground.overrides.json +176 -0
  85. data/app/pb_kits/playbook/pb_text_input/docs/_playground.json +44 -5
  86. data/app/pb_kits/playbook/pb_text_input/docs/_playground.overrides.json +39 -3
  87. data/app/pb_kits/playbook/pb_textarea/docs/_playground.json +35 -3
  88. data/app/pb_kits/playbook/pb_textarea/docs/_playground.overrides.json +28 -3
  89. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.html.erb +1 -1
  90. data/app/pb_kits/playbook/pb_time/docs/_playground.json +28 -14
  91. data/app/pb_kits/playbook/pb_time/docs/_playground.overrides.json +26 -13
  92. data/app/pb_kits/playbook/pb_time_picker/docs/_playground.json +36 -30
  93. data/app/pb_kits/playbook/pb_time_picker/docs/_playground.overrides.json +31 -26
  94. data/app/pb_kits/playbook/pb_time_range_inline/docs/_playground.json +86 -1
  95. data/app/pb_kits/playbook/pb_time_range_inline/docs/_playground.overrides.json +69 -0
  96. data/app/pb_kits/playbook/pb_time_stacked/docs/_playground.json +30 -9
  97. data/app/pb_kits/playbook/pb_time_stacked/docs/_playground.overrides.json +30 -9
  98. data/app/pb_kits/playbook/pb_timeline/docs/_playground.json +199 -1
  99. data/app/pb_kits/playbook/pb_timeline/docs/_playground.overrides.json +165 -0
  100. data/app/pb_kits/playbook/pb_timestamp/docs/_playground.json +36 -21
  101. data/app/pb_kits/playbook/pb_timestamp/docs/_playground.overrides.json +35 -20
  102. data/app/pb_kits/playbook/pb_toggle/docs/_playground.json +24 -13
  103. data/app/pb_kits/playbook/pb_toggle/docs/_playground.overrides.json +20 -12
  104. data/app/pb_kits/playbook/pb_tooltip/docs/_playground.json +42 -23
  105. data/app/pb_kits/playbook/pb_tooltip/docs/_playground.overrides.json +35 -15
  106. data/app/pb_kits/playbook/pb_typeahead/docs/_playground.json +172 -46
  107. data/app/pb_kits/playbook/pb_typeahead/docs/_playground.overrides.json +122 -33
  108. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.html.erb +39 -0
  109. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.jsx +63 -0
  110. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.md +7 -0
  111. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills_rails.md +7 -0
  112. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  113. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  114. data/app/pb_kits/playbook/pb_user/docs/_playground.json +33 -15
  115. data/app/pb_kits/playbook/pb_user/docs/_playground.overrides.json +32 -15
  116. data/app/pb_kits/playbook/pb_user_badge/docs/_playground.json +26 -12
  117. data/app/pb_kits/playbook/pb_user_badge/docs/_playground.overrides.json +26 -9
  118. data/app/pb_kits/playbook/pb_weekday_stacked/docs/_playground.json +32 -5
  119. data/app/pb_kits/playbook/pb_weekday_stacked/docs/_playground.overrides.json +30 -4
  120. metadata +49 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81474679fa1e673e010a53e74c370621d241f8e9d9f79e031accd2d5dda84e7e
4
- data.tar.gz: 4c977e961d67b8bf78eea7160f643edeaa94c40f8198a941e0753052f4f1c9cc
3
+ metadata.gz: 60e9d4b2ae3d05849b0beb42f7c0db8c1fc3a7321f9997bfff28b63227f2fcb0
4
+ data.tar.gz: cbe9e3413a40ad6c50f73b5cfd4a620ff1ee2e0ab230aa02d76c16b8aaf4bfe6
5
5
  SHA512:
6
- metadata.gz: 77bc037bdc66f1df564020b0e2ec2904ca13e3cbd0c4568fa2777e09fe3e6c2c7ff3422ab4e0a2057da03599083b584e39598e4f60a6793d9473b0506048d9e2
7
- data.tar.gz: 3a92c8be8e162d0d8ef9cb50853ed111022cb573b6b52a2561d6fa488addabcff087e548029314f55b649b6437be7339612f19ac7e54e48d19abba231ef0d9d1
6
+ metadata.gz: 2f1f70b73a8899d5d9b2ef423cd6522a5a856ce59c60da505cd63622cea120c6e0318e18cbef3c7b24f262a43540fe2523ba420514675518148d56d29f71df96
7
+ data.tar.gz: 7505c2e17bb32ef53ff3cec037f158b54ea3900217f03bd9c71cfbfa53245055fa535bcdc2bb71886f53931c3c233fe4485390f912b6262c8b6e218053249cca
@@ -0,0 +1,57 @@
1
+ import React, { useState } from "react"
2
+ import AdvancedTable from '../_advanced_table'
3
+ import MOCK_DATA_WITH_ID from "./advanced_table_mock_data_with_id.json"
4
+
5
+ const AdvancedTableRowPinningBoth = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ },
12
+ {
13
+ accessor: "newEnrollments",
14
+ label: "New Enrollments",
15
+ },
16
+ {
17
+ accessor: "scheduledMeetings",
18
+ label: "Scheduled Meetings",
19
+ },
20
+ {
21
+ accessor: "attendanceRate",
22
+ label: "Attendance Rate",
23
+ },
24
+ {
25
+ accessor: "completedClasses",
26
+ label: "Completed Classes",
27
+ },
28
+ {
29
+ accessor: "classCompletionRate",
30
+ label: "Class Completion Rate",
31
+ },
32
+ {
33
+ accessor: "graduatedStudents",
34
+ label: "Graduated Students",
35
+ },
36
+ ]
37
+
38
+ const [pinnedRows, setPinnedRows] = useState({top: ["8"], bottom: ["1"]})
39
+
40
+ return (
41
+ <div>
42
+ <AdvancedTable
43
+ columnDefinitions={columnDefinitions}
44
+ maxHeight="xs"
45
+ pinnedRows={{value: pinnedRows, onChange: setPinnedRows}}
46
+ tableData={MOCK_DATA_WITH_ID}
47
+ tableProps={{sticky: true}}
48
+ {...props}
49
+ >
50
+ <AdvancedTable.Header enableSorting />
51
+ <AdvancedTable.Body />
52
+ </AdvancedTable>
53
+ </div>
54
+ )
55
+ }
56
+
57
+ export default AdvancedTableRowPinningBoth
@@ -0,0 +1 @@
1
+ This code snippet demonstrates `pinnedRows` taking an array of row ids to both the `top` and `bottom` properties.
@@ -0,0 +1,57 @@
1
+ import React, { useState } from "react"
2
+ import AdvancedTable from '../_advanced_table'
3
+ import MOCK_DATA_WITH_ID from "./advanced_table_mock_data_with_id.json"
4
+
5
+ const AdvancedTableRowPinningBottom = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ },
12
+ {
13
+ accessor: "newEnrollments",
14
+ label: "New Enrollments",
15
+ },
16
+ {
17
+ accessor: "scheduledMeetings",
18
+ label: "Scheduled Meetings",
19
+ },
20
+ {
21
+ accessor: "attendanceRate",
22
+ label: "Attendance Rate",
23
+ },
24
+ {
25
+ accessor: "completedClasses",
26
+ label: "Completed Classes",
27
+ },
28
+ {
29
+ accessor: "classCompletionRate",
30
+ label: "Class Completion Rate",
31
+ },
32
+ {
33
+ accessor: "graduatedStudents",
34
+ label: "Graduated Students",
35
+ },
36
+ ]
37
+
38
+ const [pinnedRows, setPinnedRows] = useState({bottom: ["8"]})
39
+
40
+ return (
41
+ <div>
42
+ <AdvancedTable
43
+ columnDefinitions={columnDefinitions}
44
+ maxHeight="xs"
45
+ pinnedRows={{value: pinnedRows, onChange: setPinnedRows}}
46
+ tableData={MOCK_DATA_WITH_ID}
47
+ tableProps={{sticky: true}}
48
+ {...props}
49
+ >
50
+ <AdvancedTable.Header enableSorting />
51
+ <AdvancedTable.Body />
52
+ </AdvancedTable>
53
+ </div>
54
+ )
55
+ }
56
+
57
+ export default AdvancedTableRowPinningBottom
@@ -0,0 +1 @@
1
+ This code snippet demonstrates `pinnedRows` taking an array of row ids to the `bottom` property.
@@ -1,7 +1,7 @@
1
- Use the `pinnedRows` prop to pin specific rows to the top of an Advanced Table. Pinned rows will remain at the top when scrolling through table data and will not change position if sorting is used.
1
+ Use the `pinnedRows` prop to pin specific rows to the top or bottom of an Advanced Table. Pinned rows will remain at the top or bottom when scrolling through table data and will not change position if sorting is used.
2
2
 
3
3
  **NOTE:**
4
4
  - Sticky header required: Pinned rows must be used with `sticky: true` via `tableProps` (works with both responsive and non-responsive tables)
5
5
  - Row ids required: Each object within the `tableData` Array must contain a unique id in order to attach an id to all Rows for this to function.
6
- - `pinnedRows` takes an array of row ids to the `top` property as shown in the code snippet below.
6
+ - `pinnedRows` takes an array of row ids to the `top` or `bottom` property, or both. `top` is shown in the code snippet below.
7
7
  - For expandable rows, use the parent id in `pinnedRows`, all its children will automatically be pinned with it. If id for a child is passed in without parent being pinned, nothing will be pinned.
@@ -67,7 +67,9 @@ examples:
67
67
  - advanced_table_column_headers_custom_cell: Multi-Header Columns with Custom Cells
68
68
  - advanced_table_column_headers_vertical_border: Multi-Header Columns with Vertical Borders
69
69
  - advanced_table_no_subrows: Table with No Subrows or Expansion
70
- - advanced_table_pinned_rows: Pinned Rows
70
+ - advanced_table_pinned_rows: Pinned Rows (Top)
71
+ - advanced_table_pinned_rows_bottom: Pinned Rows (Bottom)
72
+ - advanced_table_pinned_rows_both: Pinned Rows (Both)
71
73
  - advanced_table_selectable_rows: Selectable Rows
72
74
  - advanced_table_selectable_rows_no_subrows_react: Selectable Rows (No Subrows)
73
75
  - advanced_table_selectable_rows_actions: Selectable Rows (With Actions)
@@ -89,5 +91,4 @@ examples:
89
91
  - advanced_table_column_styling_background_multi: Column Styling Background Color with Multiple Headers
90
92
  - advanced_table_padding_control: Padding Control using Column Styling
91
93
  - advanced_table_column_border_color: Column Group Border Color
92
- - advanced_table_fullscreen: Fullscreen
93
94
  - advanced_table_infinite_scroll: Infinite Scroll
@@ -52,4 +52,6 @@ export { default as AdvancedTableColumnStylingBackground } from './_advanced_tab
52
52
  export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advanced_table_column_styling_background_multi.jsx'
53
53
  export { default as AdvancedTableColumnStylingBackgroundCustom } from './_advanced_table_column_styling_background_custom.jsx'
54
54
  export { default as AdvancedTableCascadeCollapse } from './_advanced_table_cascade_collapse.jsx'
55
- export { default as AdvancedTableSortParentOnly } from './_advanced_table_sort_parent_only.jsx'
55
+ export { default as AdvancedTableSortParentOnly } from './_advanced_table_sort_parent_only.jsx'
56
+ export { default as AdvancedTablePinnedRowsBottom } from './_advanced_table_pinned_rows_bottom.jsx'
57
+ export { default as AdvancedTablePinnedRowsBoth } from './_advanced_table_pinned_rows_both.jsx'
@@ -0,0 +1,93 @@
1
+ <%
2
+ options = [
3
+ {
4
+ label: "Jasper Furniss",
5
+ value: "jasperFurniss",
6
+ territory: "PHL",
7
+ title: "Lead UX Engineer",
8
+ id: "jasper-furniss",
9
+ status: "Offline"
10
+ },
11
+ {
12
+ label: "Ramon Ruiz",
13
+ value: "ramonRuiz",
14
+ territory: "PHL",
15
+ title: "Senior UX Designer",
16
+ id: "ramon-ruiz",
17
+ status: "Unavailable",
18
+ disabled: true
19
+ },
20
+ {
21
+ label: "Carlos Lima",
22
+ value: "carlosLima",
23
+ territory: "PHL",
24
+ title: "Nitro Developer",
25
+ id: "carlos-lima",
26
+ status: "Online"
27
+ },
28
+ {
29
+ label: "Courtney Long",
30
+ value: "courtneyLong",
31
+ territory: "PHL",
32
+ title: "Lead UX Designer",
33
+ id: "courtney-long",
34
+ status: "Online"
35
+ }
36
+ ]
37
+ %>
38
+
39
+ <%
40
+ custom_display = capture do
41
+ pb_rails("flex", props: { align: "center" }) do
42
+ concat(pb_rails("avatar", props: { name: "", size: "xs", id: "dropdown-avatar" }))
43
+ concat(pb_rails("body", props: { text: "", size: "xs", margin_x: "xs", id: "dropdown-avatar-name" }))
44
+ concat(pb_rails("badge", props: { text: "", id: "dropdown-avatar-status" }))
45
+ end
46
+ end
47
+ %>
48
+
49
+ <%= pb_rails("dropdown", props: { id: "user-dropdown-disabled-options", options: options }) do %>
50
+ <%= pb_rails("dropdown/dropdown_trigger", props: { placeholder: "Select a User", custom_display: custom_display }) %>
51
+ <%= pb_rails("dropdown/dropdown_container") do %>
52
+ <% options.each do |option| %>
53
+ <%= pb_rails("dropdown/dropdown_option", props: { option: option }) do %>
54
+ <%= pb_rails("flex", props: { align: "center", justify: "between" }) do %>
55
+ <%= pb_rails("flex/flex_item") do %>
56
+ <%= pb_rails("user", props: { name: option[:label], align: "left", avatar: true, orientation: "horizontal", territory: option[:territory], title: option[:title] }) %>
57
+ <% end %>
58
+ <%= pb_rails("flex/flex_item") do %>
59
+ <%= pb_rails("badge", props: { rounded: true, dark: true, text: option[:status], variant: option[:status] == "Offline" ? "neutral" : option[:status] == "Online" ? "success" : "warning" }) %>
60
+ <% end %>
61
+ <% end %>
62
+ <% end %>
63
+ <% end %>
64
+ <% end %>
65
+ <% end %>
66
+
67
+ <script>
68
+ document.addEventListener("pb:dropdown:selected", (e) => {
69
+ if (e.target.id !== "user-dropdown-disabled-options") return;
70
+
71
+ const option = e.detail;
72
+ const dropdown = e.target;
73
+ const display = dropdown.querySelector("[data-dropdown-trigger-custom-display]");
74
+ if (!display) return;
75
+
76
+ const nameEl = display.querySelector("#dropdown-avatar-name");
77
+ if (nameEl) nameEl.textContent = option.label;
78
+
79
+ const avatarWrapper = display.querySelector("#dropdown-avatar .avatar_wrapper");
80
+ if (avatarWrapper) {
81
+ const initials = (option.label[0] + option.label.split(" ").pop()[0]).toUpperCase();
82
+ avatarWrapper.dataset.name = option.label;
83
+ avatarWrapper.setAttribute("data-initials", initials);
84
+ }
85
+
86
+ const badgeEl = display.querySelector("#dropdown-avatar-status");
87
+ const variant = option.status === "Online" ? "success" : option.status === "Offline" ? "neutral" : "warning";
88
+ if (badgeEl) {
89
+ badgeEl.querySelector("span").textContent = option.status;
90
+ badgeEl.className = `pb_badge_kit_${variant}`;
91
+ }
92
+ });
93
+ </script>
@@ -0,0 +1,127 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import Dropdown from '../../pb_dropdown/_dropdown'
4
+ import Badge from '../../pb_badge/_badge'
5
+ import Flex from '../../pb_flex/_flex'
6
+ import FlexItem from '../../pb_flex/_flex_item'
7
+ import Avatar from '../../pb_avatar/_avatar'
8
+ import User from '../../pb_user/_user'
9
+ import Body from '../../pb_body/_body'
10
+
11
+ const DropdownCustomDisplayDisabledOption = (props) => {
12
+ const [selectedOption, setSelectedOption] = useState();
13
+
14
+ const options = [
15
+ {
16
+ label: "Jasper Furniss",
17
+ value: "jasperFurniss",
18
+ territory: "PHL",
19
+ title: "Lead UX Engineer",
20
+ id: "jasper-furniss",
21
+ status: "Offline"
22
+ },
23
+ {
24
+ label: "Ramon Ruiz",
25
+ value: "ramonRuiz",
26
+ territory: "PHL",
27
+ title: "Senior UX Designer",
28
+ id: "ramon-ruiz",
29
+ status: "Unavailable",
30
+ disabled: true
31
+ },
32
+ {
33
+ label: "Carlos Lima",
34
+ value: "carlosLima",
35
+ territory: "PHL",
36
+ title: "Nitro Developer",
37
+ id: "carlos-lima",
38
+ status: "Online"
39
+ },
40
+ {
41
+ label: "Courtney Long",
42
+ value: "courtneyLong",
43
+ territory: "PHL",
44
+ title: "Lead UX Designer",
45
+ id: "courtney-long",
46
+ status: "Online"
47
+ }
48
+ ];
49
+
50
+ const CustomDisplay = () => {
51
+ return (
52
+ <>
53
+ {
54
+ selectedOption && (
55
+ <Flex align="center">
56
+ <Avatar
57
+ name={selectedOption.label}
58
+ size="xs"
59
+ />
60
+ <Body
61
+ marginX="xs"
62
+ text={selectedOption.label}
63
+ />
64
+ <Badge
65
+ text={selectedOption.status}
66
+ variant={selectedOption.status == "Offline" ? "neutral" : selectedOption.status == "Online" ? "success" : "warning"}
67
+ />
68
+ </Flex>
69
+ )
70
+ }
71
+ </>
72
+ )
73
+ };
74
+
75
+
76
+ return (
77
+ <div>
78
+ <Dropdown
79
+ onSelect={(selectedItem) => setSelectedOption(selectedItem)}
80
+ options={options}
81
+ {...props}
82
+ >
83
+ <Dropdown.Trigger customDisplay={<CustomDisplay/>}
84
+ placeholder="Select a User"
85
+ />
86
+ {options.map((option) => (
87
+ <Dropdown.Option key={option.id}
88
+ option={option}
89
+ >
90
+ <Flex
91
+ align="center"
92
+ justify="between"
93
+ >
94
+ <FlexItem>
95
+ <User
96
+ align="left"
97
+ avatar
98
+ name={option.label}
99
+ orientation="horizontal"
100
+ territory={option.territory}
101
+ title={option.title}
102
+ />
103
+ </FlexItem>
104
+ <FlexItem>
105
+ <Badge dark
106
+ rounded
107
+ text={option.status}
108
+ variant={`${
109
+ option.status === "Offline"
110
+ ? "neutral"
111
+ : option.status === "Unavailable"
112
+ ? "warning"
113
+ : option.status === "Online"
114
+ ? "success"
115
+ : "warning"
116
+ }`}
117
+ />
118
+ </FlexItem>
119
+ </Flex>
120
+ </Dropdown.Option>
121
+ ))}
122
+ </Dropdown>
123
+ </div>
124
+ )
125
+ }
126
+
127
+ export default DropdownCustomDisplayDisabledOption
@@ -0,0 +1 @@
1
+ To disable individual items in the `options`, include `disabled: true` within the object on the option that you want disabled. See the code snippet below for an example of how to do this.
@@ -0,0 +1,10 @@
1
+ <%
2
+ options = [
3
+ { label: 'United States', value: 'unitedStates', id: 'us' },
4
+ { label: 'Canada', value: 'canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'pakistan', id: 'pk' },
6
+ ]
7
+
8
+ %>
9
+
10
+ <%= pb_rails("dropdown", props: {id: "dropdown-disabled", disabled: true,label: "Default Dropdown", options: options}) %>
@@ -0,0 +1,37 @@
1
+ import React from 'react'
2
+ import Dropdown from '../_dropdown'
3
+
4
+ const DropdownDisabled = (props) => {
5
+
6
+ const options = [
7
+ {
8
+ label: "United States",
9
+ value: "unitedStates",
10
+ id: "us"
11
+ },
12
+ {
13
+ label: "Canada",
14
+ value: "canada",
15
+ id: "ca"
16
+ },
17
+ {
18
+ label: "Pakistan",
19
+ value: "pakistan",
20
+ id: "pk"
21
+ }
22
+ ];
23
+
24
+
25
+ return (
26
+ <div>
27
+ <Dropdown
28
+ disabled
29
+ label="Default Dropdown"
30
+ options={options}
31
+ {...props}
32
+ />
33
+ </div>
34
+ )
35
+ }
36
+
37
+ export default DropdownDisabled
@@ -0,0 +1,10 @@
1
+ <%
2
+ options = [
3
+ { label: "Available Option", value: "available", id: "available-option" },
4
+ { label: "Coming Soon", value: "coming-soon", id: "coming-soon", disabled: true },
5
+ { label: "Another Available", value: "another-available", id: "another-available" },
6
+ { label: "Locked Feature", value: "locked-feature", id: "locked-feature", disabled: true },
7
+ ]
8
+ %>
9
+
10
+ <%= pb_rails("dropdown", props: { label: "Disabled Options", options: options }) %>
@@ -0,0 +1,37 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import Dropdown from '../../pb_dropdown/_dropdown'
4
+ import Caption from '../../pb_caption/_caption'
5
+
6
+ const DropdownDisabledOption = (props) => {
7
+ const [selectedOption, setSelectedOption] = useState()
8
+
9
+ const options = [
10
+ { label: 'Available Option', value: 'available', id: 'available-option' },
11
+ { label: 'Coming Soon', value: 'coming-soon', id: 'coming-soon', disabled: true },
12
+ { label: 'Another Available', value: 'another-available', id: 'another-available' },
13
+ { label: 'Locked Feature', value: 'locked-feature', id: 'locked-feature', disabled: true },
14
+ ]
15
+
16
+ return (
17
+ <div>
18
+ <Caption
19
+ text="Select an option. Disabled options remain visible but cannot be selected."
20
+ />
21
+ <Dropdown
22
+ onSelect={(selectedItem) => setSelectedOption(selectedItem)}
23
+ options={options}
24
+ placeholder="Choose an option"
25
+ {...props}
26
+ />
27
+ {selectedOption && (
28
+ <Caption
29
+ marginTop="xs"
30
+ text={`Selected: ${selectedOption.label}`}
31
+ />
32
+ )}
33
+ </div>
34
+ )
35
+ }
36
+
37
+ export default DropdownDisabledOption
@@ -0,0 +1 @@
1
+ To disable individual items in the `options`, include `disabled: true` within the object on the option that you want disabled. See the code snippet below for an example of how to do this.