playbook_ui 14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4296 → 14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4303

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: 89ab9a27621b94e30352163a1c90f30e4cfa79ff773f1933c308c40f3345c164
4
- data.tar.gz: 2333af54c76ad12538d3c3b59c41561d1821abc7591e8afa7eca81df1748a4f9
3
+ metadata.gz: 0e0a61942ce72178bc4995507346515c1ca4a4347152d168cc9e84061d66231f
4
+ data.tar.gz: b40339fc9adb7796cdb029c5450f3f3d9065ca3122f3659692bbfd42a94c3c67
5
5
  SHA512:
6
- metadata.gz: 63432e88ba76ed2231c9168dabee21ebb9573b95953667f28a9b151c8859cc9452d28467e100b7c51a73fdc0d2d20ebb13dde853d61b6aa581239b73ea0071da
7
- data.tar.gz: a3268da60a7c6c0fca9769fa79fa0e5527c556a99f72d8787f4e39f1846057f70f0db22cb7dcefa7977b42eabadd7e68b47a092e3009aca88c9ebb6359a006ea
6
+ metadata.gz: 0dba16c359445b2daebcfcd0f56b4cfd50a678fdf09959ed37cbda194900cabaa6da73d557fe064f1e9f9c89eda514341bf72e7db65df606cd2d96039518c3af
7
+ data.tar.gz: 2bd784894bceafb2c1fdf90aa9aea4f69d19020e2017c900e03a5f87846b7c04b32cf8c4f1fa5113db4853d4db266978c5836556f9b87af16e529cc0bbaa2dcd
@@ -47,7 +47,7 @@ interface DropdownComponent
47
47
  Container: typeof DropdownContainer;
48
48
  }
49
49
 
50
- const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
50
+ const Dropdown: React.ForwardRefRenderFunction<unknown, DropdownProps> = (props, ref) => {
51
51
  const {
52
52
  aria = {},
53
53
  autocomplete = false,
@@ -260,7 +260,8 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
260
260
  <DropdownContainer>
261
261
  {optionsWithBlankSelection &&
262
262
  optionsWithBlankSelection?.map((option: GenericObject) => (
263
- <Dropdown.Option key={option.id}
263
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
264
+ <ForwardedDropdown.Option key={option.id}
264
265
  option={option}
265
266
  />
266
267
  ))}
@@ -278,11 +279,12 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
278
279
  </DropdownContext.Provider>
279
280
  </div>
280
281
  )
281
- }) as DropdownComponent
282
+ }
282
283
 
283
- Dropdown.displayName = "Dropdown";
284
- Dropdown.Option = DropdownOption;
285
- Dropdown.Trigger = DropdownTrigger;
286
- Dropdown.Container = DropdownContainer;
284
+ const ForwardedDropdown = forwardRef(Dropdown) as DropdownComponent;
285
+ ForwardedDropdown.displayName = "Dropdown";
286
+ ForwardedDropdown.Option = DropdownOption;
287
+ ForwardedDropdown.Trigger = DropdownTrigger;
288
+ ForwardedDropdown.Container = DropdownContainer;
287
289
 
288
- export default Dropdown;
290
+ export default ForwardedDropdown;
@@ -142,9 +142,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
142
142
  height: 12px !important;
143
143
  width: 12px !important;
144
144
  padding-right: $space_xs;
145
- + .pb_form_pill_text, + .pb_form_pill_tag,
146
- + .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
147
- + div .pb_form_pill_text, + div .pb_form_pill_tag {
145
+ + .pb_form_pill_text, + .pb_form_pill_tag {
148
146
  padding-left: 0;
149
147
  }
150
148
  }
@@ -171,9 +169,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
171
169
  }
172
170
  .pb_form_pill_icon {
173
171
  padding-right: $space_xxs;
174
- + .pb_form_pill_text, + .pb_form_pill_tag,
175
- + .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
176
- + div .pb_form_pill_text, + div .pb_form_pill_tag {
172
+ + .pb_form_pill_text, + .pb_form_pill_tag {
177
173
  padding-left: 0;
178
174
  }
179
175
  }
@@ -3,7 +3,6 @@ import classnames from 'classnames'
3
3
  import Title from '../pb_title/_title'
4
4
  import Icon from '../pb_icon/_icon'
5
5
  import Avatar from '../pb_avatar/_avatar'
6
- import Tooltip from '../pb_tooltip/_tooltip'
7
6
  import { globalProps, GlobalProps } from '../utilities/globalProps'
8
7
  import { buildDataProps, buildHtmlProps } from '../utilities/props'
9
8
 
@@ -22,7 +21,6 @@ type FormPillProps = {
22
21
  data?: {[key: string]: string},
23
22
  tabIndex?: number,
24
23
  icon?: string,
25
- truncate?: number,
26
24
  closeProps?: {
27
25
  onClick?: React.MouseEventHandler<HTMLSpanElement>,
28
26
  onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
@@ -45,7 +43,6 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
45
43
  data = {},
46
44
  tabIndex,
47
45
  icon = "",
48
- truncate,
49
46
  } = props
50
47
 
51
48
  const iconClass = icon ? "_icon" : ""
@@ -65,30 +62,6 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
65
62
  const dataProps = buildDataProps(data)
66
63
  const htmlProps = buildHtmlProps(htmlOptions)
67
64
 
68
- const renderTitle = (content: string, className: string) => {
69
- const titleComponent = (
70
- <Title
71
- className={className}
72
- size={4}
73
- text={content}
74
- truncate={truncate}
75
- />
76
- )
77
- if (truncate) {
78
- return (
79
- <Tooltip
80
- interaction
81
- placement="top"
82
- position="fixed"
83
- text={content}
84
- >
85
- {titleComponent}
86
- </Tooltip>
87
- )
88
- }
89
- return titleComponent
90
- }
91
-
92
65
  return (
93
66
  <div className={css}
94
67
  id={id}
@@ -104,7 +77,12 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
104
77
  size="xxs"
105
78
  status={null}
106
79
  />
107
- {renderTitle(name, "pb_form_pill_text")}
80
+ <Title
81
+ className="pb_form_pill_text"
82
+ size={4}
83
+ text={name}
84
+ truncate={props.truncate}
85
+ />
108
86
  </>
109
87
  )}
110
88
  {((name && icon && !text) || (name && icon && text)) && (
@@ -115,7 +93,12 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
115
93
  size="xxs"
116
94
  status={null}
117
95
  />
118
- {renderTitle(name, "pb_form_pill_text")}
96
+ <Title
97
+ className="pb_form_pill_text"
98
+ size={4}
99
+ text={name}
100
+ truncate={props.truncate}
101
+ />
119
102
  <Icon
120
103
  className="pb_form_pill_icon"
121
104
  color={color}
@@ -130,10 +113,22 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
130
113
  color={color}
131
114
  icon={icon}
132
115
  />
133
- {renderTitle(text, "pb_form_pill_tag")}
116
+ <Title
117
+ className="pb_form_pill_tag"
118
+ size={4}
119
+ text={text}
120
+ truncate={props.truncate}
121
+ />
134
122
  </>
135
123
  )}
136
- {(!name && !icon && text) && renderTitle(text, "pb_form_pill_tag")}
124
+ {(!name && !icon && text) && (
125
+ <Title
126
+ className="pb_form_pill_tag"
127
+ size={4}
128
+ text={text}
129
+ truncate={props.truncate}
130
+ />
131
+ )}
137
132
  <div
138
133
  className="pb_form_pill_close"
139
134
  onClick={onClick}
@@ -148,5 +143,4 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
148
143
  </div>
149
144
  )
150
145
  }
151
-
152
146
  export default FormPill
@@ -13,28 +13,7 @@
13
13
  id: "typeahead-form-pill",
14
14
  is_multi: true,
15
15
  options: names,
16
- label: "Truncation Within Typeahead",
16
+ label: "Names",
17
17
  pills: true,
18
18
  truncate: 1,
19
19
  }) %>
20
-
21
- <%= pb_rails("caption", props: { text: "Form Pill Truncation" }) %>
22
- <%= pb_rails("card", props: { max_width: "xs" }) do %>
23
- <%= pb_rails("form_pill", props: {
24
- name: "Princess Amelia Mignonette Grimaldi Thermopolis Renaldo",
25
- avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
26
- tabindex: 0,
27
- truncate: 1,
28
- }) %>
29
- <%= pb_rails("form_pill", props: {
30
- icon: "badge-check",
31
- text: "icon and a very long tag to show truncation",
32
- tabindex: 0,
33
- truncate: 1,
34
- }) %>
35
- <%= pb_rails("form_pill", props: {
36
- text: "form pill with a very long tag to show truncation",
37
- tabindex: 0,
38
- truncate: 1,
39
- }) %>
40
- <% end %>
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { Card, Caption, FormPill, Typeahead } from 'playbook-ui'
2
+ import Typeahead from '../../pb_typeahead/_typeahead'
3
3
 
4
4
  const names = [
5
5
  { label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
@@ -15,34 +15,11 @@ const FormPillTruncatedText = (props) => {
15
15
  <Typeahead
16
16
  htmlOptions={{ style: { maxWidth: "240px" }}}
17
17
  isMulti
18
- label="Truncation Within Typeahead"
18
+ label="Names"
19
19
  options={names}
20
20
  truncate={1}
21
21
  {...props}
22
22
  />
23
- <Caption text="Form Pill Truncation"/>
24
- <Card maxWidth="xs">
25
- <FormPill
26
- avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
27
- name="Princess Amelia Mignonette Grimaldi Thermopolis Renaldo"
28
- onClick={() => alert('Click!')}
29
- tabIndex={0}
30
- truncate={1}
31
- />
32
- <FormPill
33
- icon="badge-check"
34
- onClick={() => {alert('Click!')}}
35
- tabIndex={0}
36
- text="icon and a very long tag to show truncation"
37
- truncate={1}
38
- />
39
- <FormPill
40
- onClick={() => {alert('Click!')}}
41
- tabIndex={0}
42
- text="form pill with a very long tag to show truncation"
43
- truncate={1}
44
- />
45
- </Card>
46
23
  </>
47
24
  )
48
25
  }
@@ -1 +1 @@
1
- For pills with longer text, the `truncate` global prop can be used to truncate the label within each Form Pill. Hover over the truncated Form Pill and a Tooltip containing the text or tag section of the Form Pill will appear. See [here](https://playbook.powerapp.cloud/visual_guidelines/truncate) for more information on the truncate global prop.
1
+ For pills with longer text, the `truncate` global prop can be used to truncate the label within each Form Pill. See [here](https://playbook.powerapp.cloud/visual_guidelines/truncate) for more information on the truncate global prop.
@@ -1,51 +1,19 @@
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: "xxs" }) %>
4
- <% element_id = "pill_#{object.name.parameterize}" %>
5
- <div>
6
- <%= pb_rails("title", props: {
7
- classname: "pb_form_pill_text #{object.truncate ? "truncate_#{object.truncate}" : ""}",
8
- id: element_id,
9
- size: 4,
10
- text: object.name,
11
- }) %>
12
- <% if object.truncate %>
13
- <%= pb_rails("tooltip", props: {
14
- position: "top",
15
- tooltip_id: "tooltip-#{element_id}",
16
- trigger_element_selector: "##{element_id}"
17
- }) do %>
18
- <%= object.name %>
19
- <% end %>
20
- <% end %>
21
- </div>
4
+ <%= pb_rails("title", props: { text: object.name, size: 4, classname: "pb_form_pill_text" }) %>
22
5
  <% if object.icon.present? %>
23
6
  <%= pb_rails("icon", props: { classname: "pb_form_pill_icon", color: object.color, icon: object.icon }) %>
24
7
  <% end %>
25
8
  <% elsif object.text.present? %>
26
- <% if object.icon.present? %>
27
- <%= pb_rails("icon", props: { classname: "pb_form_pill_icon", color: object.color, icon: object.icon }) %>
28
- <% end %>
29
- <% element_id = "pill_#{object.text.parameterize}" %>
30
- <div>
31
- <%= pb_rails("title", props: {
32
- classname: "pb_form_pill_tag #{object.truncate ? "truncate_#{object.truncate}" : ""}",
33
- id: element_id,
34
- size: 4,
35
- text: object.text
36
- }) %>
37
- <% if object.truncate %>
38
- <%= pb_rails("tooltip", props: {
39
- position: "top",
40
- tooltip_id: "tooltip-#{element_id}",
41
- trigger_element_selector: "##{element_id}"
42
- }) do %>
43
- <%= object.text %>
44
- <% end %>
9
+ <% if object.icon.present? %>
10
+ <%= pb_rails("icon", props: { classname: "pb_form_pill_icon", color: object.color, 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" }) %>
45
14
  <% end %>
46
- </div>
47
15
  <% end %>
48
16
  <%= pb_rails("body", props: { classname: "pb_form_pill_close" }) do %>
49
17
  <%= pb_rails("icon", props: { icon: 'times', fixed_width: true, size: object.close_icon_size }) %>
50
18
  <% end %>
51
- <% end %>
19
+ <% end %>
@@ -16,8 +16,6 @@ module Playbook
16
16
  default: "primary"
17
17
  prop :tabindex
18
18
  prop :icon
19
- prop :truncate, type: Playbook::Props::Number,
20
- default: nil
21
19
 
22
20
  def classname
23
21
  generate_classname("pb_form_pill_kit", color, icon_class, name, text, text_transform)