playbook_ui 13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 → 13.33.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_background/background.html.erb +11 -2
  3. data/app/pb_kits/playbook/pb_body/body.html.erb +6 -1
  4. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +6 -1
  5. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +6 -1
  6. data/app/pb_kits/playbook/pb_caption/caption.html.erb +6 -1
  7. data/app/pb_kits/playbook/pb_card/card.html.erb +7 -1
  8. data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +1 -1
  9. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
  10. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.jsx +32 -31
  11. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.html.erb +2 -3
  12. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.jsx +32 -33
  13. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.html.erb +7 -3
  14. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +0 -1
  15. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +0 -9
  16. data/app/pb_kits/playbook/pb_contact/_contact.tsx +19 -25
  17. data/app/pb_kits/playbook/pb_contact/contact.html.erb +3 -6
  18. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +64 -71
  19. data/app/pb_kits/playbook/pb_detail/detail.html.erb +6 -1
  20. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +6 -1
  21. data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +6 -1
  22. data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +5 -2
  23. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +6 -1
  24. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +3 -7
  25. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +1 -1
  26. data/app/pb_kits/playbook/pb_dropdown/index.js +31 -37
  27. data/app/pb_kits/playbook/pb_flex/flex.html.erb +5 -1
  28. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +0 -4
  29. data/app/pb_kits/playbook/pb_form_pill/_form_pill.test.jsx +0 -11
  30. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +17 -52
  31. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +1 -2
  32. data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -1
  33. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +9 -16
  34. data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +1 -6
  35. data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +6 -1
  36. data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +5 -1
  37. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +5 -1
  38. data/app/pb_kits/playbook/pb_icon/_icon.scss +0 -17
  39. data/app/pb_kits/playbook/pb_icon/_icon.tsx +0 -3
  40. data/app/pb_kits/playbook/pb_icon/docs/example.yml +0 -2
  41. data/app/pb_kits/playbook/pb_icon/docs/index.js +0 -1
  42. data/app/pb_kits/playbook/pb_icon/icon.rb +1 -9
  43. data/app/pb_kits/playbook/pb_icon/icon.test.js +9 -22
  44. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.scss +11 -0
  45. data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +201 -132
  46. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx +33 -28
  47. data/app/pb_kits/playbook/pb_star_rating/docs/index.js +0 -2
  48. data/dist/playbook-rails.js +6 -6
  49. data/lib/playbook/version.rb +2 -2
  50. metadata +5 -14
  51. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_icon.html.erb +0 -5
  52. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_icon.jsx +0 -19
  53. data/app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb +0 -5
  54. data/app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx +0 -34
  55. data/app/pb_kits/playbook/pb_icon/docs/_icon_color.md +0 -1
  56. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_interactive.jsx +0 -14
  57. data/app/pb_kits/playbook/pb_star_rating/stars/utils.tsx +0 -81
  58. data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_display.tsx +0 -56
  59. data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_interactive.tsx +0 -64
@@ -10,16 +10,16 @@ import Caption from "../pb_caption/_caption";
10
10
  import Icon from "../pb_icon/_icon";
11
11
 
12
12
  type DateRangeInlineProps = {
13
- align?: "left" | "center" | "vertical";
14
13
  className?: string;
15
- dark?: boolean;
16
- data?: string;
17
- endDate?: Date;
18
- htmlOptions?: { [key: string]: string | number | boolean | (() => any) };
19
- icon?: boolean;
20
14
  id?: string;
15
+ data?: string;
16
+ align?: "left" | "center" | "vertical";
21
17
  size?: "sm" | "xs";
18
+ dark?: boolean;
19
+ htmlOptions?: {[key: string]: string | number | boolean | (() => any)};
20
+ icon?: boolean;
22
21
  startDate?: Date;
22
+ endDate?: Date;
23
23
  };
24
24
 
25
25
  const dateTimestamp = (dateValue: Date, includeYear: boolean) => {
@@ -36,36 +36,59 @@ const dateTimeIso = (dateValue: Date) => {
36
36
 
37
37
  const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
38
38
  const {
39
- align = "left",
40
- className,
39
+ icon = false,
41
40
  dark = false,
41
+ size = "sm",
42
+ align = "left",
42
43
  data = {},
43
- endDate,
44
44
  htmlOptions = {},
45
- icon = false,
46
- size = "sm",
47
45
  startDate,
46
+ endDate,
47
+ className,
48
48
  } = props;
49
49
 
50
+ const iconContent = () => {
51
+ return (
52
+ <>
53
+ {icon && (
54
+ <>
55
+ <Body color="light"
56
+ key={Math.random()}
57
+ tag="span"
58
+ >
59
+ <Icon
60
+ className="pb_date_range_inline_icon"
61
+ dark={dark}
62
+ fixedWidth
63
+ icon="calendar-alt"
64
+ size={size}
65
+ tag="span"
66
+ />
67
+ </Body>
68
+ </>
69
+ )}
70
+ </>
71
+ );
72
+ };
73
+
50
74
  const dateInCurrentYear = () => {
51
75
  const currentDate = new Date();
52
76
  return (
53
- startDate?.getFullYear() === endDate?.getFullYear() &&
54
- startDate?.getFullYear() === currentDate.getFullYear()
77
+ startDate.getFullYear() == endDate.getFullYear() &&
78
+ startDate.getFullYear() == currentDate.getFullYear()
55
79
  );
56
80
  };
57
81
 
58
82
  const dateRangeClasses = buildCss("pb_date_range_inline_kit", align);
59
- const dataProps = buildDataProps(data);
60
- const htmlProps = buildHtmlProps(htmlOptions);
61
-
83
+ const dataProps = buildDataProps(data)
84
+ const htmlProps = buildHtmlProps(htmlOptions)
62
85
  const renderTime = (date: Date) => {
63
86
  return (
64
87
  <time dateTime={dateTimeIso(date)}>
65
88
  {dateInCurrentYear() ? (
66
- ` ${dateTimestamp(date, false)} `
89
+ <>{` ${dateTimestamp(date, false)} `}</>
67
90
  ) : (
68
- ` ${dateTimestamp(date, true)} `
91
+ <>{` ${dateTimestamp(date, true)} `}</>
69
92
  )}
70
93
  </time>
71
94
  );
@@ -78,83 +101,53 @@ const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
78
101
  className={classnames(dateRangeClasses, globalProps(props), className)}
79
102
  >
80
103
  <div className="pb_date_range_inline_wrapper">
81
- {size === "xs" && (
104
+ {size == "xs" && (
82
105
  <>
83
- {icon && (
84
- <Caption
85
- dark={dark}
86
- tag="span">
87
- <Icon
88
- className="pb_date_range_inline_icon"
89
- dark={dark}
90
- fixedWidth
91
- icon="calendar-alt"
92
- size={size}
93
- tag="span"
94
- />
95
- </Caption>
96
- )}
97
- <Caption
98
- dark={dark}
99
- tag="span">
106
+ {iconContent()}
107
+ <Caption dark={dark}
108
+ tag="span"
109
+ >
100
110
  {renderTime(startDate)}
101
111
  </Caption>
102
- <Caption
103
- dark={dark}
104
- tag="span">
112
+ <Caption dark={dark}
113
+ tag="span"
114
+ >
105
115
  <Icon
106
116
  className="pb_date_range_inline_arrow"
107
- dark={dark}
108
117
  fixedWidth
109
118
  icon="long-arrow-right"
110
- tag="span"
111
119
  />
112
120
  </Caption>
113
- <Caption
114
- dark={dark}
115
- tag="span">
121
+ <Caption dark={dark}
122
+ tag="span"
123
+ >
116
124
  {renderTime(endDate)}
117
125
  </Caption>
118
126
  </>
119
127
  )}
120
128
 
121
- {size === "sm" && (
129
+ {size == "sm" && (
122
130
  <>
123
- {icon && (
124
- <Body
125
- color={"light"}
126
- dark={dark}
127
- tag="span">
128
- <Icon
129
- className="pb_date_range_inline_icon"
130
- dark={dark}
131
- fixedWidth
132
- icon="calendar-alt"
133
- size={size}
134
- tag="span"
135
- />
136
- </Body>
137
- )}
138
- <Body
139
- dark={dark}
140
- tag="span">
131
+ {iconContent()}
132
+ <Body dark={dark}
133
+ tag="span"
134
+ >
141
135
  {renderTime(startDate)}
142
136
  </Body>
143
- <Body
144
- color={"light"}
145
- dark={dark}
146
- tag="span">
137
+ <Body color="light"
138
+ dark={dark}
139
+ tag="span"
140
+ >
147
141
  <Icon
148
142
  className="pb_date_range_inline_arrow"
149
143
  dark={dark}
150
144
  fixedWidth
151
145
  icon="long-arrow-right"
152
- tag="span"
153
146
  />
154
147
  </Body>
155
- <Body
156
- dark={dark}
157
- tag="span">
148
+ <Body dark={dark}
149
+ tag="span"
150
+ >
158
151
  {renderTime(endDate)}
159
152
  </Body>
160
153
  </>
@@ -1,3 +1,8 @@
1
- <%= pb_content_tag(object.tag) do %>
1
+ <%= content_tag(object.tag,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id,
6
+ **combined_html_options) do %>
2
7
  <%= object.content %>
3
8
  <% end %>
@@ -1,5 +1,10 @@
1
1
  <div class="pb_dialog_wrapper_rails <%= object.full_height_style %>" data-overlay-click= <%= object.overlay_close %> >
2
- <%= pb_content_tag(:dialog) do %>
2
+ <%= content_tag(:dialog,
3
+ aria: object.aria,
4
+ data: object.data,
5
+ id: object.id,
6
+ class: object.classname,
7
+ **combined_html_options) do %>
3
8
  <% if object.status === "" && object.title %>
4
9
  <%= pb_rails("dialog/dialog_header", props: { title: object.title, id: object.id }) %>
5
10
  <% end %>
@@ -1,3 +1,8 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ aria: object.aria,
6
+ **combined_html_options) do %>
2
7
  <%= content.presence || object.text %>
3
8
  <% end %>
@@ -1,5 +1,8 @@
1
- <%= pb_content_tag(:div, class: "") do %>
2
- <% 'excluded classname?' %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ aria: object.aria,
5
+ **combined_html_options) do %>
3
6
  <% if object.confirm_button && object.cancel_button %>
4
7
  <div class="dialog-pseudo-footer"></div>
5
8
  <%= pb_rails("flex", props: { classname:object.classname, spacing:"between", padding_x:"sm", padding:"sm", padding_bottom:"sm" }) do %>
@@ -1,4 +1,9 @@
1
- <%= pb_content_tag(:div, class: object.sticky_header) do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.sticky_header,
5
+ aria: object.aria,
6
+ **combined_html_options) do %>
2
7
  <%= pb_rails("flex", props: {classname:object.classname, spacing:"between", padding:"sm", align:"center"}) do %>
3
8
  <%= content.presence || object.title %>
4
9
 
@@ -8,13 +8,9 @@
8
8
  <%= pb_rails("caption", props: {text: object.label, margin_bottom:"xs"}) %>
9
9
  <% end %>
10
10
  <div class="dropdown_wrapper<%= error_class %>" style="position: relative">
11
- <input
12
- data-default-value="<%= input_default_value %>"
13
- id="dropdown-selected-option"
14
- name="<%= object.name %>"
15
- style="display: none"
16
- <%= object.required ? "required" : ""%>
17
- />
11
+ <input type="hidden" name="<%= object.name %>" id="dropdown-selected-option" value="<%= input_default_value %>" />
12
+ <input id="dropdown-form-validation" name="<%= object.name %>_form_validation" value="<%= input_default_value %>" style="display: none" <%= object.required ? "required" : ""%> />
13
+
18
14
  <% if content.present? %>
19
15
  <%= content.presence %>
20
16
  <%= pb_rails("body", props: { status: "negative", text: object.error }) %>
@@ -29,7 +29,7 @@ module Playbook
29
29
  end
30
30
 
31
31
  def input_default_value
32
- default_value.present? ? default_value.transform_keys(&:to_s)["id"] : ""
32
+ default_value.present? ? default_value.transform_keys(&:to_s) : ""
33
33
  end
34
34
 
35
35
  def options_with_blank
@@ -8,9 +8,9 @@ const DOWN_ARROW_SELECTOR = "#dropdown_open_icon";
8
8
  const UP_ARROW_SELECTOR = "#dropdown_close_icon";
9
9
  const OPTION_SELECTOR = "[data-dropdown-option-label]";
10
10
  const CUSTOM_DISPLAY_SELECTOR = "[data-dropdown-custom-trigger]";
11
+ const INPUT_FORM_VALIDATION = "#dropdown-form-validation";
11
12
  const DROPDOWN_TRIGGER_DISPLAY = "#dropdown_trigger_display";
12
13
  const DROPDOWN_PLACEHOLDER = "[data-dropdown-placeholder]";
13
- const DROPDOWN_INPUT = "#dropdown-selected-option";
14
14
 
15
15
  export default class PbDropdown extends PbEnhancedElement {
16
16
  static get selector() {
@@ -47,13 +47,14 @@ export default class PbDropdown extends PbEnhancedElement {
47
47
 
48
48
  handleOptionClick(event) {
49
49
  const option = event.target.closest(OPTION_SELECTOR);
50
- const hiddenInput = this.element.querySelector(DROPDOWN_INPUT);
50
+ const hiddenInput = this.element.querySelector("#dropdown-selected-option");
51
+ const inputFormValidation = this.element.querySelector(INPUT_FORM_VALIDATION);
51
52
 
52
53
  if (option) {
53
54
  const value = option.dataset.dropdownOptionLabel;
54
55
  hiddenInput.value = JSON.parse(value).id;
55
- this.clearFormValidation(hiddenInput);
56
-
56
+ inputFormValidation.value = JSON.parse(value).id;
57
+ this.clearFormValidation(inputFormValidation);
57
58
  this.onOptionSelected(value, option);
58
59
  }
59
60
  }
@@ -159,18 +160,14 @@ export default class PbDropdown extends PbEnhancedElement {
159
160
  }
160
161
 
161
162
  handleFormValidation() {
162
- const hiddenInput = this.element.querySelector(DROPDOWN_INPUT);
163
-
164
- hiddenInput.addEventListener(
165
- "invalid",
166
- function (event) {
167
- if (hiddenInput.hasAttribute("required") && hiddenInput.value === "") {
168
- event.preventDefault();
169
- hiddenInput.closest(".dropdown_wrapper").classList.add("error");
170
- }
171
- },
172
- true
173
- );
163
+ const inputFormValidation = this.element.querySelector(INPUT_FORM_VALIDATION);
164
+
165
+ inputFormValidation.addEventListener("invalid", function (event) {
166
+ if (inputFormValidation.hasAttribute("required") && inputFormValidation.value === "") {
167
+ event.preventDefault();
168
+ inputFormValidation.closest(".dropdown_wrapper").classList.add("error");
169
+ }
170
+ }, true);
174
171
  }
175
172
 
176
173
  clearFormValidation(input) {
@@ -178,9 +175,7 @@ export default class PbDropdown extends PbEnhancedElement {
178
175
  const dropdownWrapperElement = input.closest(".dropdown_wrapper");
179
176
  dropdownWrapperElement.classList.remove("error");
180
177
 
181
- const errorLabelElement = dropdownWrapperElement.querySelector(
182
- ".pb_body_kit_negative"
183
- );
178
+ const errorLabelElement = dropdownWrapperElement.querySelector(".pb_body_kit_negative");
184
179
  if (errorLabelElement) {
185
180
  errorLabelElement.remove();
186
181
  }
@@ -188,22 +183,23 @@ export default class PbDropdown extends PbEnhancedElement {
188
183
  }
189
184
 
190
185
  setDefaultValue() {
191
- const hiddenInput = this.element.querySelector(DROPDOWN_INPUT);
192
- const options = this.element.querySelectorAll(OPTION_SELECTOR);
186
+ const hiddenInput = this.element.querySelector("#dropdown-selected-option");
193
187
 
194
- const defaultValue = hiddenInput.dataset.defaultValue || "";
195
- hiddenInput.value = defaultValue;
188
+ if (hiddenInput.value) {
189
+ const inputFormValidation = this.element.querySelector(INPUT_FORM_VALIDATION);
190
+ const defaultValue = JSON.parse(hiddenInput.value.replaceAll("=>", ":"));
191
+ const options = this.element.querySelectorAll(OPTION_SELECTOR);
196
192
 
197
- if (defaultValue) {
198
- const selectedOption = Array.from(options).find((option) => {
199
- return (
200
- JSON.parse(option.dataset.dropdownOptionLabel).id === defaultValue
201
- );
193
+ options.forEach((option) => {
194
+ if (defaultValue.id === JSON.parse(option.dataset.dropdownOptionLabel).id) {
195
+ option.classList.add("pb_dropdown_option_selected");
196
+ }
202
197
  });
203
- selectedOption.classList.add("pb_dropdown_option_selected");
204
- this.setTriggerElementText(
205
- JSON.parse(selectedOption.dataset.dropdownOptionLabel).label
206
- );
198
+
199
+ this.setTriggerElementText(defaultValue.label);
200
+
201
+ hiddenInput.value = defaultValue.id;
202
+ inputFormValidation.value = defaultValue.id;
207
203
  }
208
204
  }
209
205
 
@@ -218,13 +214,11 @@ export default class PbDropdown extends PbEnhancedElement {
218
214
  }
219
215
 
220
216
  resetDropdownValue() {
221
- const hiddenInput = this.element.querySelector(DROPDOWN_INPUT);
222
- const options = this.element.querySelectorAll(OPTION_SELECTOR);
223
- options.forEach((option) => {
224
- option.classList.remove("pb_dropdown_option_selected");
225
- });
217
+ const hiddenInput = this.element.querySelector("#dropdown-selected-option");
218
+ const inputFormValidation = this.element.querySelector(INPUT_FORM_VALIDATION);
226
219
 
227
220
  hiddenInput.value = "";
221
+ inputFormValidation.value = "";
228
222
 
229
223
  const defaultPlaceholder = this.element.querySelector(DROPDOWN_PLACEHOLDER);
230
224
  this.setTriggerElementText(defaultPlaceholder.dataset.dropdownPlaceholder);
@@ -1,3 +1,7 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ **combined_html_options) do %>
2
6
  <%= content.presence %>
3
7
  <% end %>
@@ -89,10 +89,6 @@ $form_pill_colors: (
89
89
  outline: $primary solid 2px;
90
90
  outline-offset: -1px;
91
91
  }
92
- .pb_form_pill_icon {
93
- height: 12px !important;
94
- width: 12px !important;
95
- }
96
92
  &.small {
97
93
  height: fit-content;
98
94
  height: -moz-fit-content;
@@ -50,15 +50,4 @@ test('displays size variant', () => {
50
50
  )
51
51
  const kit = screen.getByTestId('formpill')
52
52
  expect(kit).toHaveClass(`pb_form_pill_kit_primary small none`)
53
- });
54
-
55
- test('displays icon', () => {
56
- render(
57
- <FormPill
58
- data={{ testid: testId }}
59
- icon={"test"}
60
- />
61
- )
62
- const kit = screen.getByTestId('formpill')
63
- expect(kit).toHaveClass(`pb_form_pill_kit_primary_icon none`)
64
53
  });
@@ -21,7 +21,6 @@ type FormPillProps = {
21
21
  color?: "primary" | "neutral",
22
22
  data?: {[key: string]: string},
23
23
  tabIndex?: number,
24
- icon?: string,
25
24
  closeProps?: {
26
25
  onClick?: React.MouseEventHandler<HTMLSpanElement>,
27
26
  onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
@@ -43,12 +42,9 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
43
42
  color = "primary",
44
43
  data = {},
45
44
  tabIndex,
46
- icon = "",
47
45
  } = props
48
-
49
- const iconClass = icon ? "_icon" : ""
50
46
  const css = classnames(
51
- `pb_form_pill_kit_${color}${iconClass}`,
47
+ `pb_form_pill_kit_${color}`,
52
48
  globalProps(props),
53
49
  className,
54
50
  size === 'small' ? 'small' : null,
@@ -65,60 +61,29 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
65
61
  {...dataProps}
66
62
  {...htmlProps}
67
63
  >
68
- {((name && !icon && !text) || (name && !icon && text)) && (
69
- <>
70
- <Avatar
71
- imageUrl={avatarUrl}
72
- name={name}
73
- size="xs"
74
- status={null}
75
- />
76
- <Title
77
- className="pb_form_pill_text"
78
- size={4}
79
- text={name}
80
- />
81
- </>
82
- )}
83
- {((name && icon && !text) || (name && icon && text)) && (
84
- <>
85
- <Avatar
86
- imageUrl={avatarUrl}
87
- name={name}
88
- size="xs"
89
- status={null}
90
- />
91
- <Title
92
- className="pb_form_pill_text"
93
- size={4}
94
- text={name}
95
- />
96
- <Icon
97
- className="pb_form_pill_icon"
98
- icon={icon}
99
- />
100
- </>
101
- )}
102
- {(!name && icon && text) && (
64
+ {name &&
103
65
  <>
104
- <Icon
105
- className="pb_form_pill_icon"
106
- icon={icon}
107
- />
108
- <Title
109
- className="pb_form_pill_tag"
110
- size={4}
111
- text={text}
112
- />
66
+ <Avatar
67
+ imageUrl={avatarUrl}
68
+ name={name}
69
+ size="xs"
70
+ status={null}
71
+ />
72
+ <Title
73
+ className="pb_form_pill_text"
74
+ size={4}
75
+ text={name}
76
+ />
113
77
  </>
114
- )}
115
- {(!name && !icon && text) && (
78
+ }
79
+
80
+ {text &&
116
81
  <Title
117
82
  className="pb_form_pill_tag"
118
83
  size={4}
119
84
  text={text}
120
85
  />
121
- )}
86
+ }
122
87
  <div
123
88
  className="pb_form_pill_close"
124
89
  onClick={onClick}
@@ -5,11 +5,10 @@ examples:
5
5
  - form_pill_size: Form Pill Size
6
6
  - form_pill_tag: Form Pill Tag
7
7
  - form_pill_example: Example
8
- # - form_pill_icon: Form Pill Icon
8
+
9
9
 
10
10
  react:
11
11
  - form_pill_user: Form Pill User
12
12
  - form_pill_size: Form Pill Size
13
13
  - form_pill_tag: Form Pill Tag
14
14
  - form_pill_example: Example
15
- # - form_pill_icon: Form Pill Icon
@@ -2,4 +2,4 @@ export { default as FormPillUser } from './_form_pill_user.jsx'
2
2
  export { default as FormPillSize } from './_form_pill_size.jsx'
3
3
  export { default as FormPillTag } from './_form_pill_tag.jsx'
4
4
  export { default as FormPillExample } from './_form_pill_example.jsx'
5
- export { default as FormPillIcon } from './_form_pill_icon.jsx'
5
+
@@ -1,19 +1,12 @@
1
1
  <%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, tabindex: object.tabindex, **combined_html_options) do %>
2
2
  <% if object.name.present? %>
3
3
  <%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "xs" }) %>
4
- <%= pb_rails("title", props: { text: object.name, size: 4, classname: "pb_form_pill_text" }) %>
5
- <% if object.icon.present? %>
6
- <%= pb_rails("icon", props: { classname: "pb_form_pill_icon", icon: object.icon }) %>
7
- <% end %>
8
- <% elsif object.text.present? %>
9
- <% if object.icon.present? %>
10
- <%= pb_rails("icon", props: { classname: "pb_form_pill_icon", icon: object.icon }) %>
11
- <% end %>
12
- <% if object.text.present? %>
13
- <%= pb_rails("title", props: { text: object.text, size: 4, classname: "pb_form_pill_tag" }) %>
14
- <% end %>
15
- <% end %>
16
- <%= pb_rails("body", props: { classname: "pb_form_pill_close" }) do %>
17
- <%= pb_rails("icon", props: { icon: 'times' , fixed_width: true }) %>
18
- <% end %>
19
- <% end %>
4
+ <%= pb_rails("title", props: { text: object.name, size: 4, classname: "pb_form_pill_text" }) %>
5
+ <% elsif object.text.present? %>
6
+ <%= pb_rails("title", props: { text: object.text, size: 4, classname: "pb_form_pill_tag" }) %>
7
+ <% end %>
8
+
9
+ <%= pb_rails("body", props: { classname: "pb_form_pill_close" }) do %>
10
+ <%= pb_rails("icon", props: { icon: 'times' , fixed_width: true }) %>
11
+ <% end %>
12
+ <% end %>
@@ -15,10 +15,9 @@ module Playbook
15
15
  values: %w[primary neutral],
16
16
  default: "primary"
17
17
  prop :tabindex
18
- prop :icon
19
18
 
20
19
  def classname
21
- generate_classname("pb_form_pill_kit", color, icon_class, name, text, text_transform)
20
+ generate_classname("pb_form_pill_kit", color, name, text, text_transform)
22
21
  end
23
22
 
24
23
  def display_text
@@ -28,10 +27,6 @@ module Playbook
28
27
  def size_class
29
28
  size == "small" ? " small" : ""
30
29
  end
31
-
32
- def icon_class
33
- icon ? "icon" : nil
34
- end
35
30
  end
36
31
  end
37
32
  end
@@ -1,4 +1,9 @@
1
- <%= pb_content_tag(:span) do %>
1
+ <%= content_tag(:span,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id,
6
+ **combined_html_options) do %>
2
7
  <%= link_to object.url, target: object.link_option do %>
3
8
  <%= pb_rails("badge", props: { dark: object.dark, variant: "primary", text: object.hashtag_text }) %>
4
9
  <% end %>
@@ -1,4 +1,8 @@
1
- <%= pb_content_tag(:span) do %>
1
+ <%= content_tag(:span,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ **combined_html_options) do %>
2
6
  <mark>
3
7
  <%= content.presence || object.text %>
4
8
  </mark>
@@ -1,4 +1,8 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ **combined_html_options) do %>
2
6
  <%= pb_rails("home_address_street/#{emphasis}_emphasis", props: object.send("#{emphasis}_emphasis_props")) %>
3
7
  <% end %>
4
8