playbook_ui 14.19.0.pre.alpha.PLAY2172homeaddressstreetundefinedstatebug7733 → 14.19.0.pre.alpha.PLAY2182formgroupselectpassphraseerror7759

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: 709909c013e2e156a203d422ab5104339b05b8fd5736a3dde4366b0778662bb4
4
- data.tar.gz: 8adf52a05b5c0340d2db99605df968b81444bfaabe75c4bc6a1c1d90abcaa24a
3
+ metadata.gz: ca7f1e9fcee0eea3cd90a889006afaa40b45e130ee2f3e0e5d294afdd86a1d55
4
+ data.tar.gz: a20744579c12ff11404c7ba6f52b94935f84193ab55613359714fd46be5bd249
5
5
  SHA512:
6
- metadata.gz: 8ac1160445aa7401de3e70d9c9b5fb05ed96307b264e7b0d7248c3da4300f210de309bd669babe654ff6150a6fcd827c267203a8ab3c7c9c39974e89ef7983b8
7
- data.tar.gz: f3a2c1c6675cfe06579702fbe8a79eab436329f99239b503b7003dda102b5941a40b4e92d0821722a771d869ea73a0045b6efdd416f28d73fe6fcf0171574d70
6
+ metadata.gz: 2da1fdc32e7c2814fe7dc9c33148310f80f43f8b8408cf31622d3aac4a4143ea96932f324d4186ee1c9fd985ed797cd22c85e405c99673f5e29c261a3595a1a1
7
+ data.tar.gz: b33b4775e4e04b5b27550189757fc4eb1f2ce244810b486e23f1a3bae2ee24d15e5938b4e9e92986d3838783da656c9615e8da477d529d22dfabea8e9e960b33
@@ -6,6 +6,7 @@ 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'
9
10
 
10
11
  const DropdownWithCustomDisplay = (props) => {
11
12
  const [selectedOption, setSelectedOption] = useState();
@@ -50,10 +51,20 @@ const DropdownWithCustomDisplay = (props) => {
50
51
  <>
51
52
  {
52
53
  selectedOption && (
54
+ <Flex align="center">
53
55
  <Avatar
54
56
  name={selectedOption.label}
55
57
  size="xs"
56
58
  />
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>
57
68
  )
58
69
  }
59
70
  </>
@@ -1,4 +1,4 @@
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.
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.
2
2
 
3
3
  The `placeholder` prop can also be used to customize the placeholder text for the default `Dropdown.Trigger`.
4
4
 
@@ -38,7 +38,11 @@
38
38
 
39
39
  <%
40
40
  custom_display = capture do
41
- pb_rails("avatar", props: { name: "Courtney Long", size: "xs" })
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
42
46
  end
43
47
  %>
44
48
 
@@ -62,4 +66,31 @@
62
66
  <% end %>
63
67
  <% end %>
64
68
  <% end %>
65
- <% 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>
@@ -1,4 +1,6 @@
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.
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.
2
4
 
3
5
  The `placeholder` prop can also be used to customize the placeholder text for the default `dropdown/dropdown_trigger`.
4
6
 
@@ -142,9 +142,22 @@ export default class PbDropdown extends PbEnhancedElement {
142
142
  const customDisplayElement = this.element.querySelector(
143
143
  "#dropdown_trigger_custom_display"
144
144
  );
145
+
145
146
  if (triggerElement) {
146
147
  const selectedLabel = JSON.parse(value).label;
147
- triggerElement.textContent = selectedLabel;
148
+ if (customDisplayElement) {
149
+ triggerElement.textContent = ""
150
+ this.element.setAttribute("data-option-selected", value);
151
+ const selectedObj = JSON.parse(value);
152
+ this.element.dispatchEvent(
153
+ new CustomEvent("pb:dropdown:selected", {
154
+ detail: selectedObj,
155
+ bubbles: true,
156
+ })
157
+ );
158
+ } else {
159
+ triggerElement.textContent = selectedLabel
160
+ }
148
161
  if (customDisplayElement) {
149
162
  customDisplayElement.style.display = "block";
150
163
  customDisplayElement.style.paddingRight = "8px";
@@ -73,7 +73,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
73
73
  );
74
74
 
75
75
  const customDisplayPlaceholder = selected?.label ? (
76
- <b>{selected.label}</b>
76
+ ""
77
77
  ) : autocomplete ? (
78
78
  ""
79
79
  ) : placeholder ? (
@@ -23,7 +23,7 @@
23
23
  @mixin error-state-right-side-select-kit {
24
24
  &:has(.pb_text_input_kit:not(.error)):has(.pb_text_input_kit_label):has(.pb_select_kit_wrapper.error),
25
25
  &:has(.pb_text_input_kit.error):has(.pb_text_input_kit_label):has(.pb_select_kit_wrapper) {
26
- &:not(:has(.pb_phone_number_input)) {
26
+ &:not(:has(.pb_phone_number_input)):not(:has(.passphrase-text-input)) {
27
27
  align-items: flex-start;
28
28
 
29
29
  .pb_select_kit_wrapper {
@@ -49,7 +49,7 @@
49
49
 
50
50
  @mixin error-state-left-side-select-kit {
51
51
  &:has(.pb_select_kit_label):has(.pb_select_kit_wrapper):has(.pb_text_input_kit.error) {
52
- &:not(:has(.pb_phone_number_input)) {
52
+ &:not(:has(.pb_phone_number_input)):not(:has(.passphrase-text-input)) {
53
53
  align-items: flex-start;
54
54
 
55
55
  .pb_text_input_kit.error {
@@ -20,9 +20,12 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
20
20
  margin-bottom: 2px;
21
21
  margin-top: 2px;
22
22
  cursor: pointer;
23
- .pb_form_pill_text, .pb_form_pill_close, .pb_form_pill_tag{
23
+ .pb_form_pill_text, .pb_form_pill_tag {
24
24
  font-size: $font_small !important;
25
25
  }
26
+ .pb_form_pill_close {
27
+ font-size: 17px;
28
+ }
26
29
 
27
30
  &[class*=wrapped] {
28
31
  height: max-content;
@@ -96,7 +99,9 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
96
99
  display: flex;
97
100
  align-items: center;
98
101
  height: 17px;
99
- border-radius: calc(50%);
102
+ width: 17px;
103
+ justify-content: center;
104
+ border-radius: 50%;
100
105
  cursor: pointer;
101
106
  @if ($color_name == "neutral") {
102
107
  color: $text_lt_default;
@@ -146,8 +151,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
146
151
  outline-offset: -1px;
147
152
  }
148
153
  .pb_form_pill_icon {
149
- height: 12px !important;
150
- width: 12px !important;
154
+ height: 0.875em;
151
155
  padding-right: $space_xs;
152
156
  + .pb_form_pill_text, + .pb_form_pill_tag,
153
157
  + .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
@@ -158,7 +162,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
158
162
  &.small {
159
163
  height: 17px;
160
164
  padding: 0 $space-xs;
161
- .pb_form_pill_text, .pb_form_pill_close, .pb_form_pill_tag {
165
+ .pb_form_pill_text, .pb_form_pill_tag {
162
166
  font-size: $font_smallest !important;
163
167
  }
164
168
  .pb_form_pill_text, .pb_form_pill_tag {
@@ -166,17 +170,20 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
166
170
  padding: 0 $space_xxs;
167
171
  }
168
172
  .pb_form_pill_close {
169
- height: 10px;
170
- border-radius: calc(50%);
173
+ height: 14px;
174
+ width: 14px;
175
+ font-size: 15px;
176
+ border-radius: 50%;
171
177
  }
172
178
  [class^=pb_avatar_kit] .avatar_wrapper {
173
- flex-basis: 16px;
174
- height: 16px;
175
- margin-top: 2px;
176
- width: 16px;
177
- &::before { line-height: 16.5px; }
179
+ flex-basis: 14px;
180
+ height: 14px;
181
+ margin-top: 3px;
182
+ width: 14px;
183
+ &::before { line-height: 15px; }
178
184
  }
179
185
  .pb_form_pill_icon {
186
+ height: 0.75em;
180
187
  padding-right: $space_xxs;
181
188
  + .pb_form_pill_text, + .pb_form_pill_tag,
182
189
  + .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,