playbook_ui_docs 14.19.0.pre.alpha.play1997dropdownenablepillsinselection7702 → 14.19.0.pre.alpha.play2125phonenumberinputcountrysearcherrorstylefix7698

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d5285105443173e736b28903e60fa610f84000b3549ee2ff778371ac9553f6f
4
- data.tar.gz: 5faf40a56e5da0aed53969d1ec8363133ca81087975a6e38f6fd614c5e7d3ca3
3
+ metadata.gz: 47d312cd97dbe1d77b0467f34804745b1999706e545e3088a50387313b6317d1
4
+ data.tar.gz: a581b88021efd9be5944c51e98062bac4fc8eb72f69fb678f62d31ca2f35cb32
5
5
  SHA512:
6
- metadata.gz: c2940e8c5748daf5c5f09f50509fd7fca566dbd40caac68ecf6ca9d7e6b3b8ef77d5658a2e871c68c53a3e8790ea99059c86a539d393d4b0e88727a2d9b7024d
7
- data.tar.gz: 660292317b8c449bc39be98c66a5ced159c098162b0bb09c692411ffdbe659913e7e880702822ef9a1228770067ddb548ca6b462627bc82b12f9b4416f8a1c4d
6
+ metadata.gz: 4fc9c22fe1c222ef8dbb4992bf5ef3a6f144b5bfe5bf72616961dd67ede025a048b9d9ec8e15903b02c325e1bde075c1309a7a56c04847873efba401563b632e
7
+ data.tar.gz: 6ca54597ff5859a9e7d4e89b86bfc270ed955f3a36a10a167a35b860434d5dfd60022e9145ceaada8ea4e2538166ece8517383961c8d3fb5e2503ca4d1c73b03
@@ -6,7 +6,6 @@ import Flex from '../../pb_flex/_flex'
6
6
  import FlexItem from '../../pb_flex/_flex_item'
7
7
  import Avatar from '../../pb_avatar/_avatar'
8
8
  import User from '../../pb_user/_user'
9
- import Body from '../../pb_body/_body'
10
9
 
11
10
  const DropdownWithCustomDisplay = (props) => {
12
11
  const [selectedOption, setSelectedOption] = useState();
@@ -51,20 +50,10 @@ const DropdownWithCustomDisplay = (props) => {
51
50
  <>
52
51
  {
53
52
  selectedOption && (
54
- <Flex align="center">
55
53
  <Avatar
56
54
  name={selectedOption.label}
57
55
  size="xs"
58
56
  />
59
- <Body
60
- marginX="xs"
61
- text={selectedOption.label}
62
- />
63
- <Badge
64
- text={selectedOption.status}
65
- variant={selectedOption.status == "Offline" ? "neutral" : selectedOption.status == "Online" ? "success" : "warning"}
66
- />
67
- </Flex>
68
57
  )
69
58
  }
70
59
  </>
@@ -1,4 +1,4 @@
1
- Optionally utilize `customDisplay` on the `Dropdown.Trigger` subcomponent to customize its content after an option is selected. Pass in any combination of kits to create a custom display. When a user clicks on an option, the kits passed into `customDisplay` will display as the selected option.
1
+ Optionally utilize `customDisplay` on the `Dropdown.Trigger` subcomponent to customize its content after an option is selected. The component passed to customDisplay will be rendered to the left of the default text-based display. In this example the Avatar kit is being used.
2
2
 
3
3
  The `placeholder` prop can also be used to customize the placeholder text for the default `Dropdown.Trigger`.
4
4
 
@@ -38,11 +38,7 @@
38
38
 
39
39
  <%
40
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
41
+ pb_rails("avatar", props: { name: "Courtney Long", size: "xs" })
46
42
  end
47
43
  %>
48
44
 
@@ -66,31 +62,4 @@
66
62
  <% end %>
67
63
  <% end %>
68
64
  <% end %>
69
- <% end %>
70
-
71
-
72
- <script>
73
- document.addEventListener("pb:dropdown:selected", (e) => {
74
- const option = e.detail;
75
- const dropdown = e.target;
76
-
77
- const display = dropdown.querySelector("#dropdown_trigger_custom_display");
78
- if (!display) return;
79
-
80
- const nameEl = display.querySelector("#dropdown-avatar-name");
81
- if (nameEl) nameEl.textContent = option.label;
82
-
83
- const avatarEl = display.querySelector("#dropdown-avatar").querySelector(".avatar_wrapper");
84
- const initials = (option.label[0] + option.label.split(" ").pop()[0]).toUpperCase();
85
- if (avatarEl) {
86
- avatarEl.dataset.name = option.label;
87
- avatarEl.setAttribute("data-initials", initials);
88
- }
89
- const badgeEl = display.querySelector("#dropdown-avatar-status");
90
- const variant = option.status === "Online" ? "success" : option.status === "Offline" ? "neutral" : "warning";
91
- if (badgeEl) {
92
- badgeEl.querySelector("span").textContent = option.status;
93
- badgeEl.className = 'pb_badge_kit_' + variant;
94
- }
95
- });
96
- </script>
65
+ <% end %>
@@ -1,6 +1,4 @@
1
- Optionally utilize `custom_display` on the `dropdown/dropdown_trigger` subcomponent to customize its content after an option is selected. Pass in any combination of kits to create a custom display. When a user clicks on an option, the kits passed into `custom_display` will display as the selected option.
2
-
3
- Make use of a script to help set the custom_display with the correct value. By using the pb:dropdown:selected event listener, you can target the kits with a querySelector and update them dynamically with the values needed to match the selected option. Make sure to add an ID to the kits being passed in.
1
+ Optionally utilize `custom_display` on the `dropdown/dropdown_trigger` subcomponent to customize its content after an option is selected. The component passed to custom_display will be rendered to the left of the default text-based display. In this example the Avatar kit is being used.
4
2
 
5
3
  The `placeholder` prop can also be used to customize the placeholder text for the default `dropdown/dropdown_trigger`.
6
4