playbook_ui 15.5.0.pre.alpha.testingdialog12768 → 15.5.0.pre.alpha.typeaheadfix12605
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 +4 -4
- data/app/pb_kits/playbook/pb_dialog/index.js +15 -10
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +4 -4
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +22 -34
- data/app/pb_kits/playbook/pb_home_address_street/city_emphasis.html.erb +12 -16
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.html.erb +12 -16
- data/app/pb_kits/playbook/pb_home_address_street/street_emphasis.html.erb +12 -16
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +0 -10
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +15 -66
- data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_multiple_users/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.test.js +0 -25
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +0 -15
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +0 -3
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -6
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -34
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -6
- data/dist/chunks/{_typeahead-978gNTWh.js → _typeahead-CkkCTRLh.js} +1 -1
- data/dist/chunks/vendor.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +3 -8
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.jsx +0 -42
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.md +0 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.html.erb +0 -30
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.jsx +0 -37
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.md +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55ff4c659b41354c334f4269d707a68355d197f2107bd6ad30538c3db3a79a9e
|
|
4
|
+
data.tar.gz: 88be26fddd7ab5bb775fcb638bde6adabb5e9a8114dfdf91a9996e465bcf9034
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e514df0fe3dd24face52c69bde8fe96fbbc2631b9e2d7e0d884ebc37415dc2b5dc0582b9603a6ddc6f06dd2751f30a312d7f2ad3f487f82d42d8a482ed4858b4
|
|
7
|
+
data.tar.gz: dd28cc4eb240e9036eeedc425360e4a1931b425d27d8514702d377ff58e30a3af3f66a85a22c06ce599bc92e47e18fb8d69ef12027020f19b71155e08f818172
|
|
@@ -143,25 +143,30 @@ export default class PbDialog extends PbEnhancedElement {
|
|
|
143
143
|
|
|
144
144
|
// Close dialog box on outside click
|
|
145
145
|
dialogs.forEach((dialogElement) => {
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
146
|
+
const originalClickHandler = dialogElement._outsideClickHandler
|
|
147
|
+
if (originalClickHandler) dialogElement.removeEventListener("click", originalClickHandler)
|
|
148
|
+
|
|
148
149
|
dialogElement._outsideClickHandler = (event) => {
|
|
149
150
|
const dialogParentDataset = dialogElement.parentElement.dataset
|
|
150
151
|
if (dialogParentDataset.overlayClick === "overlay_close") return
|
|
151
152
|
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
event.
|
|
156
|
-
event.
|
|
157
|
-
|
|
158
|
-
|
|
153
|
+
// Get the dialog's bounding box (the actual content area)
|
|
154
|
+
const rect = dialogElement.getBoundingClientRect()
|
|
155
|
+
const clickedInDialog = (
|
|
156
|
+
event.clientX >= rect.left &&
|
|
157
|
+
event.clientX <= rect.right &&
|
|
158
|
+
event.clientY >= rect.top &&
|
|
159
|
+
event.clientY <= rect.bottom
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
// Only close if clicked outside the dialog content (on the backdrop)
|
|
163
|
+
if (!clickedInDialog) {
|
|
159
164
|
dialogElement.close()
|
|
160
165
|
event.stopPropagation()
|
|
161
166
|
}
|
|
162
167
|
}
|
|
163
168
|
|
|
164
|
-
dialogElement.addEventListener("
|
|
169
|
+
dialogElement.addEventListener("click", dialogElement._outsideClickHandler);
|
|
165
170
|
})
|
|
166
171
|
}
|
|
167
172
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.pb_file_upload_kit {
|
|
2
|
-
.
|
|
2
|
+
.pb_card_kit_deselected_border_radius_md {
|
|
3
3
|
border: 1px #ccc dashed;
|
|
4
4
|
text-align: center;
|
|
5
5
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
&.error,
|
|
13
13
|
&.pb_file_upload_kit_error {
|
|
14
|
-
.
|
|
14
|
+
.pb_card_kit_deselected_border_radius_md {
|
|
15
15
|
border-color: $error;
|
|
16
16
|
}
|
|
17
17
|
.pb_body_kit_negative {
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.dark .pb_file_upload_kit {
|
|
33
|
-
.
|
|
33
|
+
.pb_card_kit_deselected_border_radius_md {
|
|
34
34
|
border: 1px $text_dk_lighter dashed;
|
|
35
35
|
}
|
|
36
36
|
&.error,
|
|
37
37
|
&.pb_file_upload_kit_error {
|
|
38
|
-
.
|
|
38
|
+
.pb_card_kit_deselected_border_radius_md {
|
|
39
39
|
border-color: $error_dark;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -96,24 +96,20 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
|
96
96
|
{hasAllEmptyProps && '—'}
|
|
97
97
|
{emphasis == 'street' && !hasAllEmptyProps &&
|
|
98
98
|
<div>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
>
|
|
114
|
-
{titleize(addressCont)}
|
|
115
|
-
</Title>
|
|
116
|
-
)}
|
|
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>
|
|
117
113
|
<Body color="light">
|
|
118
114
|
{`${city ? `${titleize(city)}, ` : ''}${uppercaseState}${zipcode ? ` ${zipcode}` : ''}`}
|
|
119
115
|
</Body>
|
|
@@ -121,14 +117,10 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
|
121
117
|
}
|
|
122
118
|
{emphasis == 'city' && !hasAllEmptyProps &&
|
|
123
119
|
<div>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
)}
|
|
129
|
-
{addressCont && (
|
|
130
|
-
<Body color="light">{titleize(addressCont)}</Body>
|
|
131
|
-
)}
|
|
120
|
+
<Body color="light">
|
|
121
|
+
{joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
|
|
122
|
+
</Body>
|
|
123
|
+
<Body color="light">{titleize(addressCont)}</Body>
|
|
132
124
|
<div>
|
|
133
125
|
<Title
|
|
134
126
|
className="pb_home_address_street_address"
|
|
@@ -149,14 +141,10 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
|
149
141
|
}
|
|
150
142
|
{emphasis == 'none' && !hasAllEmptyProps &&
|
|
151
143
|
<div>
|
|
152
|
-
{
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
)}
|
|
157
|
-
{addressCont && (
|
|
158
|
-
<Body dark={dark}>{formatStreetAdr(addressCont)}</Body>
|
|
159
|
-
)}
|
|
144
|
+
<Body dark={dark}>
|
|
145
|
+
{joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
|
|
146
|
+
</Body>
|
|
147
|
+
<Body dark={dark}>{formatStreetAdr(addressCont)}</Body>
|
|
160
148
|
<div>
|
|
161
149
|
<Body
|
|
162
150
|
color="light"
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
text: object.address_house_style2,
|
|
14
|
-
dark: object.dark
|
|
15
|
-
} %>
|
|
16
|
-
<% end %>
|
|
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
|
+
} %>
|
|
17
13
|
<div>
|
|
18
14
|
<%= pb_rails "title", props: {
|
|
19
15
|
tag: "span",
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
text: object.address_house_style2,
|
|
14
|
-
dark: object.dark
|
|
15
|
-
} %>
|
|
16
|
-
<% end %>
|
|
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
|
+
} %>
|
|
17
13
|
<%= pb_rails "body", props: {
|
|
18
14
|
color: "light",
|
|
19
15
|
text: object.city_state_zip,
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
text: object.address_house_style2,
|
|
14
|
-
dark: object.dark
|
|
15
|
-
} %>
|
|
16
|
-
<% end %>
|
|
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
|
+
} %>
|
|
17
13
|
<%= pb_rails "body", props: {
|
|
18
14
|
color: "light",
|
|
19
15
|
text: object.city_state_zip,
|
|
@@ -36,16 +36,6 @@ $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
|
-
|
|
49
39
|
.pb_multiple_users_item {
|
|
50
40
|
margin-left: $pb_multiple_users_overlap;
|
|
51
41
|
margin-right: 0;
|
|
@@ -5,19 +5,17 @@ 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'
|
|
9
8
|
|
|
10
9
|
type MultipleUsersProps = {
|
|
11
10
|
aria?: { [key: string]: string },
|
|
12
11
|
className?: string,
|
|
13
12
|
dark?: boolean,
|
|
14
13
|
data?: { [key: string]: string },
|
|
15
|
-
htmlOptions?: {
|
|
14
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
|
16
15
|
id?: string,
|
|
17
16
|
maxDisplayedUsers?: number,
|
|
18
17
|
reverse?: boolean,
|
|
19
18
|
size?: "md" | "lg" | "sm" | "xl" | "xs" | "xxs",
|
|
20
|
-
withTooltip?: boolean,
|
|
21
19
|
users: Array<{ [key: string]: string }>,
|
|
22
20
|
}
|
|
23
21
|
|
|
@@ -32,7 +30,6 @@ const MultipleUsers = (props: MultipleUsersProps): React.ReactElement => {
|
|
|
32
30
|
maxDisplayedUsers = 4,
|
|
33
31
|
reverse = false,
|
|
34
32
|
size = 'xs',
|
|
35
|
-
withTooltip = false,
|
|
36
33
|
users,
|
|
37
34
|
} = props
|
|
38
35
|
|
|
@@ -65,70 +62,22 @@ const MultipleUsers = (props: MultipleUsersProps): React.ReactElement => {
|
|
|
65
62
|
className={classes}
|
|
66
63
|
id={id}
|
|
67
64
|
>
|
|
68
|
-
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
))}
|
|
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
|
+
))}
|
|
87
75
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
</>
|
|
76
|
+
{ users.length > maxDisplayedUsers &&
|
|
77
|
+
<div className={itemClasses}>
|
|
78
|
+
{`+${users.length - 3}`}
|
|
79
|
+
</div>
|
|
130
80
|
}
|
|
131
|
-
|
|
132
81
|
</div>
|
|
133
82
|
)
|
|
134
83
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
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,29 +49,4 @@ 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()
|
|
77
52
|
})
|
|
@@ -276,18 +276,3 @@ 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,7 +43,6 @@ type TypeaheadProps = {
|
|
|
43
43
|
error?: string,
|
|
44
44
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
|
45
45
|
id?: string,
|
|
46
|
-
inputDisplay?: "pills" | "none",
|
|
47
46
|
label?: string,
|
|
48
47
|
loadOptions?: string | Noop,
|
|
49
48
|
getOptionLabel?: string | (() => string),
|
|
@@ -90,7 +89,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
|
90
89
|
getOptionValue,
|
|
91
90
|
htmlOptions = {},
|
|
92
91
|
id,
|
|
93
|
-
inputDisplay = "pills",
|
|
94
92
|
name,
|
|
95
93
|
loadOptions = noop,
|
|
96
94
|
marginBottom = "sm",
|
|
@@ -240,7 +238,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
|
240
238
|
getOptionValue: isString(getOptionValue) ? get(window, getOptionValue) : getOptionValue,
|
|
241
239
|
defaultOptions: true,
|
|
242
240
|
id: id || uniqueId(),
|
|
243
|
-
inputDisplay: inputDisplay,
|
|
244
241
|
inline: false,
|
|
245
242
|
isClearable: true,
|
|
246
243
|
isSearchable: true,
|
|
@@ -19,12 +19,7 @@ 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
|
|
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
|
-
}
|
|
22
|
+
const { dark, multiKit, pillColor, truncate, wrapped } = props.selectProps
|
|
28
23
|
|
|
29
24
|
const formPillProps = {
|
|
30
25
|
marginRight: 'xs',
|
|
@@ -1,42 +1,15 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { components } from 'react-select'
|
|
3
|
-
import Body from '../../pb_body/_body'
|
|
4
3
|
|
|
5
4
|
type ValueContainerProps = {
|
|
6
|
-
children: React.ReactNode
|
|
7
|
-
selectProps?: Record<string, unknown>,
|
|
8
|
-
hasValue?: boolean,
|
|
5
|
+
children: React.ReactNode,
|
|
9
6
|
}
|
|
10
7
|
|
|
11
|
-
const ValueContainer = (props: ValueContainerProps
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
}
|
|
8
|
+
const ValueContainer = (props: ValueContainerProps): React.ReactElement => (
|
|
9
|
+
<components.ValueContainer
|
|
10
|
+
className="text_input_value_container"
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
41
14
|
|
|
42
15
|
export default ValueContainer
|
|
@@ -5,7 +5,6 @@ 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
|
|
9
8
|
- typeahead_without_pills: Without Pills (Single Select)
|
|
10
9
|
- typeahead_with_pills_async: With Pills (Async Data)
|
|
11
10
|
- typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
|
|
@@ -27,7 +26,6 @@ examples:
|
|
|
27
26
|
- typeahead_react_hook: React Hook
|
|
28
27
|
- typeahead_with_highlight: With Highlight
|
|
29
28
|
- typeahead_with_pills: With Pills
|
|
30
|
-
- typeahead_input_display: Input Display
|
|
31
29
|
- typeahead_with_pills_async: With Pills (Async Data)
|
|
32
30
|
- typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
|
|
33
31
|
- typeahead_with_pills_async_custom_options: With Pills (Async Data w/ Custom Options)
|
|
@@ -17,5 +17,4 @@ 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'
|
|
21
|
-
export { default as TypeaheadInputDisplay } from './_typeahead_input_display.jsx'
|
|
20
|
+
export { default as TypeaheadCustomOptions } from './_typeahead_custom_options.jsx'
|
|
@@ -25,10 +25,6 @@ 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
|
-
|
|
32
28
|
prop :pills, type: Playbook::Props::Boolean,
|
|
33
29
|
default: false
|
|
34
30
|
|
|
@@ -82,7 +78,7 @@ module Playbook
|
|
|
82
78
|
end
|
|
83
79
|
|
|
84
80
|
def is_react?
|
|
85
|
-
pills || !is_multi || wrapped
|
|
81
|
+
pills || !is_multi || wrapped
|
|
86
82
|
end
|
|
87
83
|
|
|
88
84
|
def typeahead_react_options
|
|
@@ -95,7 +91,6 @@ module Playbook
|
|
|
95
91
|
id: id,
|
|
96
92
|
inline: inline,
|
|
97
93
|
isMulti: is_multi,
|
|
98
|
-
inputDisplay: input_display,
|
|
99
94
|
label: label,
|
|
100
95
|
marginBottom: margin_bottom,
|
|
101
96
|
multiKit: multi_kit,
|