playbook_ui 15.6.0.pre.rc.2 → 15.6.0.pre.rc.3

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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +34 -22
  3. data/app/pb_kits/playbook/pb_home_address_street/city_emphasis.html.erb +16 -12
  4. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +1 -1
  5. data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.html.erb +16 -12
  6. data/app/pb_kits/playbook/pb_home_address_street/street_emphasis.html.erb +16 -12
  7. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +10 -0
  8. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +66 -15
  9. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.jsx +42 -0
  10. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.md +1 -0
  11. data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +1 -0
  12. data/app/pb_kits/playbook/pb_multiple_users/docs/index.js +1 -0
  13. data/app/pb_kits/playbook/pb_multiple_users/multiple_users.test.js +25 -0
  14. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +15 -0
  15. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -0
  16. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +6 -1
  17. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +34 -7
  18. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.html.erb +30 -0
  19. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.jsx +37 -0
  20. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.md +3 -0
  21. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  22. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +2 -1
  23. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +6 -1
  24. data/dist/chunks/{_typeahead-CkkCTRLh.js → _typeahead-978gNTWh.js} +1 -1
  25. data/dist/chunks/vendor.js +2 -2
  26. data/dist/playbook-rails-react-bindings.js +1 -1
  27. data/dist/playbook-rails.js +1 -1
  28. data/dist/playbook.css +1 -1
  29. data/lib/playbook/version.rb +1 -1
  30. metadata +8 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b983bad8c671234614b68b2b02908fb8c5ec33ba66bd8592f9302dcc71f739e5
4
- data.tar.gz: 8188f53eac0f277f4c35acee49a5e79fbcf7939dff69e0096d250df2083aa45e
3
+ metadata.gz: 1e9964f7e4d581df22bf766c0fa280f292929dc9ec0f1524a851edb43da19cf4
4
+ data.tar.gz: a3cf957cb97905233cf0c80bd56bf495ac223a72e0fd221b03df3714a442cce0
5
5
  SHA512:
6
- metadata.gz: 26d1e8728ead33b88b32b1fbf796a3f3aff34b5ce9bc064f4039a59fc9ca0f2d0ab1c11e06b18994581ae1adb1cd00f67e8c2bc7ec659b60925d168f043be206
7
- data.tar.gz: 6cddf1b537e290bcc98ef4be264e3d300c9ba9d29e45c2ebf0fc7723b19e194fbd67c2fcd766ebf1b53dd26d930eaefa38cefdbf1219f674c150e9251e9f6196
6
+ metadata.gz: '000728061dbe3c740f512461d4bf230592135fed6befd1899f65ae12036c08a231374f40d60c6d38efbb4e97760054a0d2bdc4a1909a44bcd6a38546bfd59619'
7
+ data.tar.gz: b0697da248684965e7f9f327614cc0cfdac3429b3b724a923ac978790f51404fb26107073a8e10f9db3e3796afed5cbec237e36133e107d08ecbd7c920514078
@@ -96,20 +96,24 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
96
96
  {hasAllEmptyProps && '—'}
97
97
  {emphasis == 'street' && !hasAllEmptyProps &&
98
98
  <div>
99
- <Title
100
- className="pb_home_address_street_address"
101
- dark={dark}
102
- size={4}
103
- >
104
- {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
105
- </Title>
106
- <Title
107
- className="pb_home_address_street_address"
108
- dark={dark}
109
- size={4}
110
- >
111
- {titleize(addressCont)}
112
- </Title>
99
+ {(address || houseStyle) && (
100
+ <Title
101
+ className="pb_home_address_street_address"
102
+ dark={dark}
103
+ size={4}
104
+ >
105
+ {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
106
+ </Title>
107
+ )}
108
+ {addressCont && (
109
+ <Title
110
+ className="pb_home_address_street_address"
111
+ dark={dark}
112
+ size={4}
113
+ >
114
+ {titleize(addressCont)}
115
+ </Title>
116
+ )}
113
117
  <Body color="light">
114
118
  {`${city ? `${titleize(city)}, ` : ''}${uppercaseState}${zipcode ? ` ${zipcode}` : ''}`}
115
119
  </Body>
@@ -117,10 +121,14 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
117
121
  }
118
122
  {emphasis == 'city' && !hasAllEmptyProps &&
119
123
  <div>
120
- <Body color="light">
121
- {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
122
- </Body>
123
- <Body color="light">{titleize(addressCont)}</Body>
124
+ {(address || houseStyle) && (
125
+ <Body color="light">
126
+ {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
127
+ </Body>
128
+ )}
129
+ {addressCont && (
130
+ <Body color="light">{titleize(addressCont)}</Body>
131
+ )}
124
132
  <div>
125
133
  <Title
126
134
  className="pb_home_address_street_address"
@@ -141,10 +149,14 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
141
149
  }
142
150
  {emphasis == 'none' && !hasAllEmptyProps &&
143
151
  <div>
144
- <Body dark={dark}>
145
- {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
146
- </Body>
147
- <Body dark={dark}>{formatStreetAdr(addressCont)}</Body>
152
+ {(address || houseStyle) && (
153
+ <Body dark={dark}>
154
+ {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
155
+ </Body>
156
+ )}
157
+ {addressCont && (
158
+ <Body dark={dark}>{formatStreetAdr(addressCont)}</Body>
159
+ )}
148
160
  <div>
149
161
  <Body
150
162
  color="light"
@@ -1,15 +1,19 @@
1
- <%= pb_rails "body", props: {
2
- classname: "pb_home_address_street_address",
3
- color: "light",
4
- text: object.address_house_style,
5
- dark: object.dark
6
- } %>
7
- <%= pb_rails "body", props: {
8
- classname: "pb_home_address_street_address",
9
- color: "light",
10
- text: object.address_house_style2,
11
- dark: object.dark
12
- } %>
1
+ <% if object.address_house_style.present? %>
2
+ <%= pb_rails "body", props: {
3
+ classname: "pb_home_address_street_address",
4
+ color: "light",
5
+ text: object.address_house_style,
6
+ dark: object.dark
7
+ } %>
8
+ <% end %>
9
+ <% if object.address_house_style2.present? %>
10
+ <%= pb_rails "body", props: {
11
+ classname: "pb_home_address_street_address",
12
+ color: "light",
13
+ text: object.address_house_style2,
14
+ dark: object.dark
15
+ } %>
16
+ <% end %>
13
17
  <div>
14
18
  <%= pb_rails "title", props: {
15
19
  tag: "span",
@@ -8,4 +8,4 @@
8
8
  state: "PA",
9
9
  zipcode: "19382",
10
10
  territory: "PHL",
11
- }) %>
11
+ }) %>
@@ -1,15 +1,19 @@
1
- <%= pb_rails "body", props: {
2
- classname: "pb_home_address_street_address",
3
- size: 4,
4
- text: object.address_house_style,
5
- dark: object.dark
6
- } %>
7
- <%= pb_rails "body", props: {
8
- classname: "pb_home_address_street_address",
9
- size: 4,
10
- text: object.address_house_style2,
11
- dark: object.dark
12
- } %>
1
+ <% if object.address_house_style.present? %>
2
+ <%= pb_rails "body", props: {
3
+ classname: "pb_home_address_street_address",
4
+ size: 4,
5
+ text: object.address_house_style,
6
+ dark: object.dark
7
+ } %>
8
+ <% end %>
9
+ <% if object.address_house_style2.present? %>
10
+ <%= pb_rails "body", props: {
11
+ classname: "pb_home_address_street_address",
12
+ size: 4,
13
+ text: object.address_house_style2,
14
+ dark: object.dark
15
+ } %>
16
+ <% end %>
13
17
  <%= pb_rails "body", props: {
14
18
  color: "light",
15
19
  text: object.city_state_zip,
@@ -1,15 +1,19 @@
1
- <%= pb_rails "title", props: {
2
- classname: "pb_home_address_street_address",
3
- size: 4,
4
- text: object.address_house_style,
5
- dark: object.dark
6
- } %>
7
- <%= pb_rails "title", props: {
8
- classname: "pb_home_address_street_address",
9
- size: 4,
10
- text: object.address_house_style2,
11
- dark: object.dark
12
- } %>
1
+ <% if object.address_house_style.present? %>
2
+ <%= pb_rails "title", props: {
3
+ classname: "pb_home_address_street_address",
4
+ size: 4,
5
+ text: object.address_house_style,
6
+ dark: object.dark
7
+ } %>
8
+ <% end %>
9
+ <% if object.address_house_style2.present? %>
10
+ <%= pb_rails "title", props: {
11
+ classname: "pb_home_address_street_address",
12
+ size: 4,
13
+ text: object.address_house_style2,
14
+ dark: object.dark
15
+ } %>
16
+ <% end %>
13
17
  <%= pb_rails "body", props: {
14
18
  color: "light",
15
19
  text: object.city_state_zip,
@@ -36,6 +36,16 @@ $pb_multiple_users_size_xxs: map-get($avatar-sizes, "xxs");
36
36
  height: $pb_multiple_users_size_xxs;
37
37
  }
38
38
 
39
+
40
+ .user_tooltip {
41
+ margin-left: $pb_multiple_users_overlap !important;
42
+ }
43
+
44
+ .user_count_tooltip {
45
+ margin-left: $pb_multiple_users_overlap !important;
46
+ position: relative;
47
+ }
48
+
39
49
  .pb_multiple_users_item {
40
50
  margin-left: $pb_multiple_users_overlap;
41
51
  margin-right: 0;
@@ -5,17 +5,19 @@ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../uti
5
5
  import { globalProps } from '../utilities/globalProps'
6
6
 
7
7
  import Avatar from '../pb_avatar/_avatar'
8
+ import Tooltip from '../pb_tooltip/_tooltip'
8
9
 
9
10
  type MultipleUsersProps = {
10
11
  aria?: { [key: string]: string },
11
12
  className?: string,
12
13
  dark?: boolean,
13
14
  data?: { [key: string]: string },
14
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
15
+ htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
15
16
  id?: string,
16
17
  maxDisplayedUsers?: number,
17
18
  reverse?: boolean,
18
19
  size?: "md" | "lg" | "sm" | "xl" | "xs" | "xxs",
20
+ withTooltip?: boolean,
19
21
  users: Array<{ [key: string]: string }>,
20
22
  }
21
23
 
@@ -30,6 +32,7 @@ const MultipleUsers = (props: MultipleUsersProps): React.ReactElement => {
30
32
  maxDisplayedUsers = 4,
31
33
  reverse = false,
32
34
  size = 'xs',
35
+ withTooltip = false,
33
36
  users,
34
37
  } = props
35
38
 
@@ -62,22 +65,70 @@ const MultipleUsers = (props: MultipleUsersProps): React.ReactElement => {
62
65
  className={classes}
63
66
  id={id}
64
67
  >
65
- {usersToDisplay.map((avatarData, index) => (
66
- <Avatar
67
- {...avatarData}
68
- className="pb_multiple_users_item"
69
- dark={dark}
70
- imageAlt={avatarData.name}
71
- key={index}
72
- size={size}
73
- />
74
- ))}
68
+ {withTooltip ?
69
+ <>
70
+ {usersToDisplay.map((avatarData, index) => (
71
+ <Tooltip
72
+ key={"user_tooltip_" + index}
73
+ placement='top'
74
+ text={avatarData.tooltip ? avatarData.tooltip : ''}
75
+ zIndex={10}
76
+ >
77
+ <Avatar
78
+ {...avatarData}
79
+ className={"pb_multiple_users_item" + (withTooltip ? " user_tooltip" : "")}
80
+ dark={dark}
81
+ imageAlt={avatarData.name}
82
+ key={index}
83
+ size={size}
84
+ />
85
+ </Tooltip>
86
+ ))}
75
87
 
76
- { users.length > maxDisplayedUsers &&
77
- <div className={itemClasses}>
78
- {`+${users.length - 3}`}
79
- </div>
88
+ {users.length > maxDisplayedUsers &&
89
+ <Tooltip
90
+ placement='top'
91
+ text={
92
+ <div>
93
+ {
94
+ usersToDisplay.length < users.length ?
95
+ users.slice(displayCount).map((u, i) => (
96
+ <div key={i}>{u.tooltip}</div>
97
+ ))
98
+ :
99
+ ''
100
+ }
101
+ </div>
102
+ }
103
+ zIndex={10}
104
+ >
105
+ <div className={itemClasses + (withTooltip ? " user_count_tooltip" : "")}>
106
+ {`+${users.length - displayCount}`}
107
+ </div>
108
+ </Tooltip>
109
+ }
110
+ </>
111
+ :
112
+ <>
113
+ {usersToDisplay.map((avatarData, index) => (
114
+ <Avatar
115
+ {...avatarData}
116
+ className="pb_multiple_users_item"
117
+ dark={dark}
118
+ imageAlt={avatarData.name}
119
+ key={index}
120
+ size={size}
121
+ />
122
+ ))}
123
+
124
+ {users.length > maxDisplayedUsers &&
125
+ <div className={itemClasses}>
126
+ {`+${users.length - 3}`}
127
+ </div>
128
+ }
129
+ </>
80
130
  }
131
+
81
132
  </div>
82
133
  )
83
134
  }
@@ -0,0 +1,42 @@
1
+ import React from 'react'
2
+ import MultipleUsers from '../../pb_multiple_users/_multiple_users'
3
+
4
+ const MultipleUsersWithTooltip = (props) => {
5
+ return (
6
+ <div>
7
+ <MultipleUsers
8
+ users={[
9
+ {
10
+ name: 'Patrick Welch',
11
+ imageUrl: 'https://randomuser.me/api/portraits/men/9.jpg',
12
+ tooltip: "Patrick Welch - Online"
13
+ },
14
+ {
15
+ name: 'Lucille Sanchez',
16
+ imageUrl: 'https://randomuser.me/api/portraits/women/6.jpg',
17
+ tooltip: "Lucille Sanchez - Offline"
18
+ },
19
+ {
20
+ name: 'Beverly Reyes',
21
+ imageUrl: 'https://randomuser.me/api/portraits/women/74.jpg',
22
+ tooltip: "Beverly Reyes - Online"
23
+ },
24
+ {
25
+ name: 'Keith Craig',
26
+ imageUrl: 'https://randomuser.me/api/portraits/men/40.jpg',
27
+ tooltip: "Keith Craig - Away"
28
+ },
29
+ {
30
+ name: 'Alicia Cooper',
31
+ imageUrl: 'https://randomuser.me/api/portraits/women/46.jpg',
32
+ tooltip: "Alicia Cooper - Busy"
33
+ },
34
+ ]}
35
+ withTooltip
36
+ {...props}
37
+ />
38
+ </div>
39
+ )
40
+ }
41
+ ``
42
+ export default MultipleUsersWithTooltip
@@ -0,0 +1 @@
1
+ Use the `withTooltip` boolean prop to enable setting user-specific tooltip content via the `tooltip` property in the users array.
@@ -10,6 +10,7 @@ examples:
10
10
  - multiple_users_default: Default
11
11
  - multiple_users_reverse: Reverse
12
12
  - multiple_users_size: Size
13
+ - multiple_users_with_tooltip: With Tooltip
13
14
 
14
15
  swift:
15
16
  - multiple_users_default_swift: Default
@@ -1,3 +1,4 @@
1
1
  export { default as MultipleUsersDefault } from './_multiple_users_default.jsx'
2
2
  export { default as MultipleUsersReverse } from './_multiple_users_reverse.jsx'
3
3
  export { default as MultipleUsersSize } from './_multiple_users_size.jsx'
4
+ export { default as MultipleUsersWithTooltip } from './_multiple_users_with_tooltip.jsx'
@@ -49,4 +49,29 @@ test('should render aria-label', () => {
49
49
 
50
50
  const kit = screen.getByTestId(testId)
51
51
  expect(kit).toHaveAttribute('aria-label', testId)
52
+ })
53
+
54
+ test('should render withTooltip prop', () => {
55
+ render(
56
+ <MultipleUsers
57
+ data={{ testid: testId }}
58
+ users={[
59
+ {
60
+ name: 'Patrick Welch',
61
+ imageUrl: 'https://randomuser.me/api/portraits/men/9.jpg',
62
+ tooltip: "Patrick Welch - Online"
63
+ },
64
+ {
65
+ name: 'Lucille Sanchez',
66
+ imageUrl: 'https://randomuser.me/api/portraits/women/6.jpg',
67
+ tooltip: "Lucille Sanchez - Offline"
68
+ },
69
+ ]}
70
+ withTooltip
71
+ />
72
+ )
73
+
74
+ const kit = screen.getByTestId(testId)
75
+ const childWithTooltip = kit.querySelector('.pb_tooltip_kit')
76
+ expect(childWithTooltip).not.toBeNull()
52
77
  })
@@ -276,3 +276,18 @@ test('multi-value badges have tabIndex and focus class when focused', () => {
276
276
  })
277
277
  })
278
278
 
279
+ test('input display none shows number of selected items', () => {
280
+ render(
281
+ <Typeahead
282
+ data={{ testid: 'input-display-none-test' }}
283
+ defaultValue={[options[0], options[1]]}
284
+ inputDisplay="none"
285
+ isMulti
286
+ options={options}
287
+ />
288
+ )
289
+
290
+ const kit = screen.getByTestId('input-display-none-test')
291
+ const inputDisplayDiv = kit.querySelector(".pb_typeahead_selection_count")
292
+ expect(inputDisplayDiv).toHaveTextContent("2 items selected")
293
+ })
@@ -43,6 +43,7 @@ type TypeaheadProps = {
43
43
  error?: string,
44
44
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
45
45
  id?: string,
46
+ inputDisplay?: "pills" | "none",
46
47
  label?: string,
47
48
  loadOptions?: string | Noop,
48
49
  getOptionLabel?: string | (() => string),
@@ -89,6 +90,7 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
89
90
  getOptionValue,
90
91
  htmlOptions = {},
91
92
  id,
93
+ inputDisplay = "pills",
92
94
  name,
93
95
  loadOptions = noop,
94
96
  marginBottom = "sm",
@@ -238,6 +240,7 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
238
240
  getOptionValue: isString(getOptionValue) ? get(window, getOptionValue) : getOptionValue,
239
241
  defaultOptions: true,
240
242
  id: id || uniqueId(),
243
+ inputDisplay: inputDisplay,
241
244
  inline: false,
242
245
  isClearable: true,
243
246
  isSearchable: true,
@@ -19,7 +19,12 @@ type Props = {
19
19
  const MultiValue = (props: Props) => {
20
20
  const { removeProps, isFocused } = props
21
21
  const { imageUrl, label } = props.data
22
- const { dark, multiKit, pillColor, truncate, wrapped } = props.selectProps
22
+ const { dark, multiKit, pillColor, truncate, wrapped, inputDisplay } = props.selectProps
23
+
24
+ // If inputDisplay is "none", don't render the pill/badge, just return null (the count handled in ValueContainer file)
25
+ if (inputDisplay === 'none') {
26
+ return null
27
+ }
23
28
 
24
29
  const formPillProps = {
25
30
  marginRight: 'xs',
@@ -1,15 +1,42 @@
1
1
  import React from 'react'
2
2
  import { components } from 'react-select'
3
+ import Body from '../../pb_body/_body'
3
4
 
4
5
  type ValueContainerProps = {
5
- children: React.ReactNode,
6
+ children: React.ReactNode | React.ReactNode[],
7
+ selectProps?: Record<string, unknown>,
8
+ hasValue?: boolean,
6
9
  }
7
10
 
8
- const ValueContainer = (props: ValueContainerProps): React.ReactElement => (
9
- <components.ValueContainer
10
- className="text_input_value_container"
11
- {...props}
12
- />
13
- )
11
+ const ValueContainer = (props: ValueContainerProps | any): React.ReactElement => {
12
+ const { children, selectProps, hasValue } = props
13
+ const inputDisplay = (selectProps as any)?.inputDisplay
14
+ const value = (selectProps as any)?.value
15
+
16
+ // When inputDisplay is "none" and there are selected values, show count text (this is for multi-select only)
17
+ if (inputDisplay === 'none' && hasValue && value) {
18
+ const selectedCount = Array.isArray(value) ? value.length : 0
19
+
20
+ return (
21
+ <components.ValueContainer
22
+ className="text_input_value_container"
23
+ {...props}
24
+ >
25
+ <Body
26
+ className="pb_typeahead_selection_count"
27
+ text={`${selectedCount} item${selectedCount !== 1 ? 's' : ''} selected`}
28
+ />
29
+ {children}
30
+ </components.ValueContainer>
31
+ )
32
+ }
33
+
34
+ return (
35
+ <components.ValueContainer
36
+ className="text_input_value_container"
37
+ {...props}
38
+ />
39
+ )
40
+ }
14
41
 
15
42
  export default ValueContainer
@@ -0,0 +1,30 @@
1
+ <%
2
+ options = [
3
+ { label: 'Orange', value: '#FFA500' },
4
+ { label: 'Red', value: '#FF0000' },
5
+ { label: 'Green', value: '#00FF00' },
6
+ { label: 'Blue', value: '#0000FF' },
7
+ { label: 'Yellow', value: '#FFFF00' },
8
+ { label: 'Purple', value: '#800080' },
9
+ { label: 'Cyan', value: '#00FFFF' },
10
+ { label: 'Magenta', value: '#FF00FF' }
11
+ ]
12
+ %>
13
+
14
+ <%= pb_rails("typeahead", props: {
15
+ id: "typeahead-input-display-none",
16
+ label: "With Input Display None",
17
+ options: options,
18
+ name: :foo,
19
+ input_display: "none",
20
+ })
21
+ %>
22
+ <br/>
23
+ <%= pb_rails("typeahead", props: {
24
+ id: "typeahead-input-display-pills",
25
+ label: "With Input Display Pills (Default)",
26
+ options: options,
27
+ name: :foo,
28
+ pills: true,
29
+ })
30
+ %>
@@ -0,0 +1,37 @@
1
+ import React from 'react'
2
+
3
+ import Typeahead from '../_typeahead'
4
+
5
+ const options = [
6
+ { label: 'Orange', value: '#FFA500' },
7
+ { label: 'Red', value: '#FF0000' },
8
+ { label: 'Green', value: '#00FF00' },
9
+ { label: 'Blue', value: '#0000FF' },
10
+ { label: 'Yellow', value: '#FFFF00' },
11
+ { label: 'Purple', value: '#800080' },
12
+ { label: 'Cyan', value: '#00FFFF' },
13
+ { label: 'Magenta', value: '#FF00FF' }
14
+ ]
15
+
16
+ const TypeaheadInputDisplay = (props) => {
17
+ return (
18
+ <>
19
+ <Typeahead
20
+ inputDisplay="none"
21
+ isMulti
22
+ label="With Input Display None"
23
+ options={options}
24
+ {...props}
25
+ />
26
+ <br/>
27
+ <Typeahead
28
+ isMulti
29
+ label="With Input Display Pills (Default)"
30
+ options={options}
31
+ {...props}
32
+ />
33
+ </>
34
+ )
35
+ }
36
+
37
+ export default TypeaheadInputDisplay
@@ -0,0 +1,3 @@
1
+ Use the `inputDisplay`/`input_display` prop to optionally display only the count in the display as opposed to multiple pills. This prop is set to 'pills' by default.
2
+
3
+ **NOTE**: `inputDisplay`/`input_display` should only be used with typeaheads that allow multi selection.
@@ -5,6 +5,7 @@ examples:
5
5
  - typeahead_default_options: With Default Options
6
6
  - typeahead_with_context: With Context
7
7
  - typeahead_with_pills: With Pills
8
+ - typeahead_input_display: Input Display
8
9
  - typeahead_without_pills: Without Pills (Single Select)
9
10
  - typeahead_with_pills_async: With Pills (Async Data)
10
11
  - typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
@@ -26,6 +27,7 @@ examples:
26
27
  - typeahead_react_hook: React Hook
27
28
  - typeahead_with_highlight: With Highlight
28
29
  - typeahead_with_pills: With Pills
30
+ - typeahead_input_display: Input Display
29
31
  - typeahead_with_pills_async: With Pills (Async Data)
30
32
  - typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
31
33
  - typeahead_with_pills_async_custom_options: With Pills (Async Data w/ Custom Options)
@@ -17,4 +17,5 @@ export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
17
17
  export { default as TypeaheadDisabled } from './_typeahead_disabled.jsx'
18
18
  export { default as TypeaheadPreserveInput } from './_typeahead_preserve_input.jsx'
19
19
  export { default as TypeaheadDefaultValue } from './_typeahead_default_value.jsx'
20
- export { default as TypeaheadCustomOptions } from './_typeahead_custom_options.jsx'
20
+ export { default as TypeaheadCustomOptions } from './_typeahead_custom_options.jsx'
21
+ export { default as TypeaheadInputDisplay } from './_typeahead_input_display.jsx'
@@ -25,6 +25,10 @@ module Playbook
25
25
  prop :is_multi, type: Playbook::Props::Boolean,
26
26
  default: true
27
27
 
28
+ prop :input_display, type: Playbook::Props::Enum,
29
+ values: %w[none pills],
30
+ default: "pills"
31
+
28
32
  prop :pills, type: Playbook::Props::Boolean,
29
33
  default: false
30
34
 
@@ -78,7 +82,7 @@ module Playbook
78
82
  end
79
83
 
80
84
  def is_react?
81
- pills || !is_multi || wrapped
85
+ pills || !is_multi || wrapped || input_display == "none"
82
86
  end
83
87
 
84
88
  def typeahead_react_options
@@ -91,6 +95,7 @@ module Playbook
91
95
  id: id,
92
96
  inline: inline,
93
97
  isMulti: is_multi,
98
+ inputDisplay: input_display,
94
99
  label: label,
95
100
  marginBottom: margin_bottom,
96
101
  multiKit: multi_kit,