playbook_ui 15.6.0.pre.alpha.play266013023 → 15.6.0.pre.rc.0
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_advanced_table/docs/_advanced_table_table_props.html.erb +163 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +190 -0
- data/app/pb_kits/playbook/pb_background/_background.tsx +6 -6
- data/app/pb_kits/playbook/pb_background/background.test.js +1 -5
- data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +1 -1
- data/app/pb_kits/playbook/pb_background/docs/_background_light.jsx +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +2 -2
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleIcon.tsx +8 -10
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +1 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +3 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +0 -24
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +3 -181
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -2
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.rb +0 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +0 -14
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +4 -5
- data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +0 -31
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.md +1 -1
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +7 -458
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +3 -8
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +2 -3
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +1 -77
- 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_phone_number_input/_phone_number_input.tsx +10 -44
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +4 -34
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +7 -16
- data/app/pb_kits/playbook/pb_radio/docs/_radio_error.md +1 -1
- data/app/pb_kits/playbook/pb_select/_select.tsx +3 -8
- data/app/pb_kits/playbook/pb_select/docs/_select_error.md +1 -1
- data/app/pb_kits/playbook/pb_select/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_select/select.html.erb +2 -2
- data/app/pb_kits/playbook/pb_select/select.rb +1 -3
- data/app/pb_kits/playbook/pb_select/select.test.js +0 -23
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.md +1 -1
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.md +1 -1
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +0 -3
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md +1 -1
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_timeline/item.rb +0 -2
- data/app/pb_kits/playbook/pb_timeline/label.html.erb +1 -2
- data/app/pb_kits/playbook/pb_timeline/label.rb +0 -2
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +0 -3
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +0 -51
- 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/ClearIndicator.tsx +2 -13
- 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/app/pb_kits/playbook/tokens/_colors.scss +1 -2
- data/dist/chunks/_typeahead-kRdz5zPn.js +6 -0
- data/dist/chunks/lib-CgpqUb6l.js +29 -0
- 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/forms/builder/collection_select_field.rb +1 -9
- data/lib/playbook/forms/builder/select_field.rb +1 -9
- data/lib/playbook/forms/builder/time_zone_select_field.rb +1 -9
- data/lib/playbook/pb_kit_helper.rb +0 -35
- data/lib/playbook/version.rb +2 -2
- metadata +4 -22
- data/app/pb_kits/playbook/pb_background/docs/_background_light.md +0 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.html.erb +0 -24
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.jsx +0 -60
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.md +0 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.jsx +0 -180
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.md +0 -22
- 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_select/docs/_select_input_options.html.erb +0 -16
- data/app/pb_kits/playbook/pb_select/docs/_select_input_options.jsx +0 -30
- data/app/pb_kits/playbook/pb_select/docs/_select_input_options.md +0 -1
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.html.erb +0 -60
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.jsx +0 -118
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.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
- data/app/pb_kits/playbook/utilities/deprecated.ts +0 -73
- data/dist/chunks/_typeahead-CYNrKU10.js +0 -6
- data/dist/chunks/lib-DDDLiZuu.js +0 -29
|
@@ -29,7 +29,6 @@ type SelectProps = {
|
|
|
29
29
|
id?: string,
|
|
30
30
|
includeBlank?: string,
|
|
31
31
|
inline?: boolean,
|
|
32
|
-
inputOptions?: {[key: string]: string | number | boolean | (() => void)},
|
|
33
32
|
label?: string,
|
|
34
33
|
margin: string,
|
|
35
34
|
marginBottom: string,
|
|
@@ -64,7 +63,6 @@ const Select = ({
|
|
|
64
63
|
label,
|
|
65
64
|
htmlOptions = {},
|
|
66
65
|
inline = false,
|
|
67
|
-
inputOptions = {},
|
|
68
66
|
multiple = false,
|
|
69
67
|
name,
|
|
70
68
|
onChange = () => undefined,
|
|
@@ -96,17 +94,14 @@ const Select = ({
|
|
|
96
94
|
const angleDown = getAllIcons()["angleDown"].icon as unknown as { [key: string]: SVGElement }
|
|
97
95
|
|
|
98
96
|
const selectWrapperClass = classnames(buildCss('pb_select_kit_wrapper'), { error }, className)
|
|
99
|
-
const selectId = (inputOptions?.id as string) || name
|
|
100
|
-
|
|
101
97
|
const selectBody =(() =>{
|
|
102
98
|
if (children) return children
|
|
103
99
|
return (
|
|
104
100
|
<select
|
|
105
101
|
{...htmlOptions}
|
|
106
102
|
{...domSafeProps(props)}
|
|
107
|
-
{...inputOptions}
|
|
108
103
|
disabled={disabled}
|
|
109
|
-
id={
|
|
104
|
+
id={name}
|
|
110
105
|
multiple={multiple}
|
|
111
106
|
name={name}
|
|
112
107
|
onChange={onChange}
|
|
@@ -130,7 +125,7 @@ const Select = ({
|
|
|
130
125
|
{label &&
|
|
131
126
|
<label
|
|
132
127
|
className="pb_select_kit_label"
|
|
133
|
-
htmlFor={
|
|
128
|
+
htmlFor={name}
|
|
134
129
|
>
|
|
135
130
|
<Caption
|
|
136
131
|
dark={props.dark}
|
|
@@ -140,7 +135,7 @@ const Select = ({
|
|
|
140
135
|
}
|
|
141
136
|
<label
|
|
142
137
|
className={selectWrapperClass}
|
|
143
|
-
htmlFor={
|
|
138
|
+
htmlFor={name}
|
|
144
139
|
>
|
|
145
140
|
{selectBody}
|
|
146
141
|
{ multiple !== true ?
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Select w/ Error shows that
|
|
1
|
+
Select w/ Error shows that the radio option must be selected or is invalid (ie when used in a form it signals a user to fix an error).
|
|
@@ -15,7 +15,6 @@ examples:
|
|
|
15
15
|
- select_inline_compact: Select Inline Compact
|
|
16
16
|
- select_attributes: Select W/ Attributes
|
|
17
17
|
- select_multiple: Select Multiple
|
|
18
|
-
- select_input_options: Input Options
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
|
|
@@ -34,7 +33,6 @@ examples:
|
|
|
34
33
|
- select_inline_compact: Select Inline Compact
|
|
35
34
|
- select_multiple: Select Multiple
|
|
36
35
|
- select_react_hook: React Hook
|
|
37
|
-
- select_input_options: Input Options
|
|
38
36
|
|
|
39
37
|
swift:
|
|
40
38
|
- select_default_swift: Default
|
|
@@ -12,4 +12,3 @@ export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
|
|
|
12
12
|
export { default as SelectMultiple } from './_select_multiple.jsx'
|
|
13
13
|
export { default as SelectReactHook } from './_select_react_hook.jsx'
|
|
14
14
|
export { default as SelectCustomSelectSubheaders } from './_select_custom_select_subheaders.jsx'
|
|
15
|
-
export { default as SelectInputOptions } from './_select_input_options.jsx'
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
id: nil,
|
|
3
3
|
class: object.classnames ) do %>
|
|
4
4
|
<% if object.label %>
|
|
5
|
-
<label class="pb_select_kit_label" for="<%= object.
|
|
5
|
+
<label class="pb_select_kit_label" for="<%= object.name %>">
|
|
6
6
|
<%= pb_rails("caption", props: { text: object.label, dark: object.dark }) %>
|
|
7
7
|
</label>
|
|
8
8
|
<% end %>
|
|
9
|
-
<label class="<%= object.select_wrapper_class %>" for="<%= object.
|
|
9
|
+
<label class="<%= object.select_wrapper_class %>" for="<%= object.name %>">
|
|
10
10
|
<% if content.present? %>
|
|
11
11
|
<%= content %>
|
|
12
12
|
<%= pb_rails("body", props: { status: "negative", text: object.error }) %>
|
|
@@ -14,8 +14,6 @@ module Playbook
|
|
|
14
14
|
prop :error
|
|
15
15
|
prop :include_blank
|
|
16
16
|
prop :inline, type: Playbook::Props::Boolean, default: false
|
|
17
|
-
prop :input_options, type: Playbook::Props::HashProp,
|
|
18
|
-
default: {}
|
|
19
17
|
prop :label
|
|
20
18
|
prop :multiple, type: Playbook::Props::Boolean, default: false
|
|
21
19
|
prop :name
|
|
@@ -40,7 +38,7 @@ module Playbook
|
|
|
40
38
|
multiple: multiple,
|
|
41
39
|
onchange: onchange,
|
|
42
40
|
include_blank: include_blank,
|
|
43
|
-
}.merge(attributes)
|
|
41
|
+
}.merge(attributes)
|
|
44
42
|
end
|
|
45
43
|
|
|
46
44
|
def classname
|
|
@@ -65,27 +65,4 @@ test('returns multiple variant', () => {
|
|
|
65
65
|
const selectElement = kit.querySelector('select');
|
|
66
66
|
|
|
67
67
|
expect(selectElement).toHaveAttribute('multiple', '');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
test('inputOptions are passed to select element', () => {
|
|
71
|
-
render(
|
|
72
|
-
<Select
|
|
73
|
-
data={{ testid: testId }}
|
|
74
|
-
inputOptions={{
|
|
75
|
-
id: 'custom-select-id',
|
|
76
|
-
className: 'custom-select-class',
|
|
77
|
-
'aria-label': 'Custom aria label',
|
|
78
|
-
}}
|
|
79
|
-
label="Favorite Food"
|
|
80
|
-
name="food"
|
|
81
|
-
options={options}
|
|
82
|
-
/>
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
const kit = screen.getByTestId(testId)
|
|
86
|
-
const selectElement = kit.querySelector('select')
|
|
87
|
-
|
|
88
|
-
expect(selectElement).toHaveAttribute('id', 'custom-select-id')
|
|
89
|
-
expect(selectElement).toHaveClass('custom-select-class')
|
|
90
|
-
expect(selectElement).toHaveAttribute('aria-label', 'Custom aria label')
|
|
91
68
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Text Input w/ Error shows that the
|
|
1
|
+
Text Input w/ Error shows that the radio option must be selected or is invalid (ie when used in a form it signals a user to fix an error).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Textarea w/ Error shows that the
|
|
1
|
+
Textarea w/ Error shows that the radio option must be selected or is invalid (ie when used in a form it signals a user to fix an error).
|
|
@@ -18,7 +18,6 @@ type ItemProps = {
|
|
|
18
18
|
icon?: string,
|
|
19
19
|
iconColor?: 'default' | 'royal' | 'blue' | 'purple' | 'teal' | 'red' | 'yellow' | 'green',
|
|
20
20
|
lineStyle?: 'solid' | 'dotted',
|
|
21
|
-
showCurrentYear?: boolean,
|
|
22
21
|
} & GlobalProps
|
|
23
22
|
|
|
24
23
|
function isElementOfType<P>(
|
|
@@ -36,7 +35,6 @@ const TimelineItem = ({
|
|
|
36
35
|
icon = 'user',
|
|
37
36
|
iconColor = 'default',
|
|
38
37
|
lineStyle = 'solid',
|
|
39
|
-
showCurrentYear = false,
|
|
40
38
|
...props
|
|
41
39
|
}: ItemProps): React.ReactElement => {
|
|
42
40
|
const timelineItemCss = buildCss('pb_timeline_item_kit', lineStyle)
|
|
@@ -75,7 +73,6 @@ const TimelineItem = ({
|
|
|
75
73
|
<DateStacked
|
|
76
74
|
align="center"
|
|
77
75
|
date={date}
|
|
78
|
-
showCurrentYear={showCurrentYear}
|
|
79
76
|
size="sm"
|
|
80
77
|
/>
|
|
81
78
|
)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Use the optional `showDate` prop to render the timeline kit with a visible date.
|
|
1
|
+
Use the optional `showDate` prop to render the timeline kit with a visible date. If the date is from the current year, the year will not be displayed, however if date is NOT from the current year, the kit will display the year as well.
|
|
@@ -5,7 +5,6 @@ examples:
|
|
|
5
5
|
- timeline_vertical: Vertical
|
|
6
6
|
- timeline_with_date: With Date
|
|
7
7
|
- timeline_with_children: With Children
|
|
8
|
-
- timeline_show_current_year: Show Current Year
|
|
9
8
|
- timeline_with_gap: With Gap
|
|
10
9
|
|
|
11
10
|
|
|
@@ -14,5 +13,4 @@ examples:
|
|
|
14
13
|
- timeline_vertical: Vertical
|
|
15
14
|
- timeline_with_date: With Date
|
|
16
15
|
- timeline_with_children: With Children
|
|
17
|
-
- timeline_show_current_year: Show Current Year
|
|
18
16
|
- timeline_with_gap: With Gap
|
|
@@ -3,5 +3,4 @@ export { default as TimelineVertical } from './_timeline_vertical.jsx'
|
|
|
3
3
|
export { default as TimelineWithDate } from './_timeline_with_date.jsx'
|
|
4
4
|
export { default as TimelineWithChildren } from './_timeline_with_children.jsx'
|
|
5
5
|
export { default as TimelineWithGap } from './_timeline_with_gap.jsx'
|
|
6
|
-
export { default as TimelineShowCurrentYear } from './_timeline_show_current_year.jsx'
|
|
7
6
|
|
|
@@ -9,7 +9,6 @@ type TimelineLabelProps = {
|
|
|
9
9
|
children?: React.ReactNode,
|
|
10
10
|
className?: string,
|
|
11
11
|
htmlOptions?: { [key: string]: any },
|
|
12
|
-
showCurrentYear?: boolean,
|
|
13
12
|
} & GlobalProps
|
|
14
13
|
|
|
15
14
|
const TimelineLabel: React.FC<TimelineLabelProps> = ({
|
|
@@ -17,7 +16,6 @@ const TimelineLabel: React.FC<TimelineLabelProps> = ({
|
|
|
17
16
|
children,
|
|
18
17
|
className,
|
|
19
18
|
htmlOptions = {},
|
|
20
|
-
showCurrentYear = false,
|
|
21
19
|
...props
|
|
22
20
|
}) => {
|
|
23
21
|
const htmlProps = buildHtmlProps(htmlOptions)
|
|
@@ -30,7 +28,6 @@ const TimelineLabel: React.FC<TimelineLabelProps> = ({
|
|
|
30
28
|
{date && (
|
|
31
29
|
<DateStacked align="center"
|
|
32
30
|
date={date}
|
|
33
|
-
showCurrentYear={showCurrentYear}
|
|
34
31
|
size="sm"
|
|
35
32
|
/>
|
|
36
33
|
)}
|
|
@@ -170,54 +170,3 @@ test('should pass showDate prop with Children', () => {
|
|
|
170
170
|
const kit = screen.getByTestId(testId)
|
|
171
171
|
expect(kit).toHaveClass('pb_timeline_kit_horizontal_with_date')
|
|
172
172
|
})
|
|
173
|
-
|
|
174
|
-
test('should pass showCurrentYear prop to items with date', () => {
|
|
175
|
-
const currentYear = new Date().getFullYear().toString()
|
|
176
|
-
render(
|
|
177
|
-
<Timeline
|
|
178
|
-
data={{ testid: testId }}
|
|
179
|
-
showDate
|
|
180
|
-
>
|
|
181
|
-
<Timeline.Item
|
|
182
|
-
date={new Date()}
|
|
183
|
-
icon="user"
|
|
184
|
-
iconColor="royal"
|
|
185
|
-
showCurrentYear
|
|
186
|
-
>
|
|
187
|
-
<TitleDetail
|
|
188
|
-
detail="37-27 74th Street"
|
|
189
|
-
title="Jackson Heights"
|
|
190
|
-
/>
|
|
191
|
-
</Timeline.Item>
|
|
192
|
-
</Timeline>
|
|
193
|
-
)
|
|
194
|
-
const kit = screen.getByTestId(testId)
|
|
195
|
-
expect(kit).toBeInTheDocument()
|
|
196
|
-
const yearCaption = kit.querySelector('.pb_caption_kit_xs')
|
|
197
|
-
expect(yearCaption).toBeInTheDocument()
|
|
198
|
-
expect(yearCaption.textContent).toEqual(currentYear)
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
test('should not show current year by default', () => {
|
|
202
|
-
const currentYear = new Date().getFullYear().toString()
|
|
203
|
-
render(
|
|
204
|
-
<Timeline
|
|
205
|
-
data={{ testid: testId }}
|
|
206
|
-
showDate
|
|
207
|
-
>
|
|
208
|
-
<Timeline.Item
|
|
209
|
-
date={new Date()}
|
|
210
|
-
icon="user"
|
|
211
|
-
iconColor="royal"
|
|
212
|
-
>
|
|
213
|
-
<TitleDetail
|
|
214
|
-
detail="37-27 74th Street"
|
|
215
|
-
title="Jackson Heights"
|
|
216
|
-
/>
|
|
217
|
-
</Timeline.Item>
|
|
218
|
-
</Timeline>
|
|
219
|
-
)
|
|
220
|
-
const kit = screen.getByTestId(testId)
|
|
221
|
-
expect(kit).toBeInTheDocument()
|
|
222
|
-
expect(kit).not.toHaveTextContent(currentYear)
|
|
223
|
-
})
|
|
@@ -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,
|
|
@@ -7,29 +7,18 @@ type ClearContainerProps = {
|
|
|
7
7
|
id: string,
|
|
8
8
|
},
|
|
9
9
|
clearValue: () => void,
|
|
10
|
-
innerProps?: any,
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
const ClearContainer = (props: ClearContainerProps
|
|
14
|
-
const { selectProps, clearValue
|
|
12
|
+
const ClearContainer = (props: ClearContainerProps): React.ReactElement => {
|
|
13
|
+
const { selectProps, clearValue } = props
|
|
15
14
|
useEffect(() => {
|
|
16
15
|
document.addEventListener(`pb-typeahead-kit-${selectProps.id}:clear`, clearValue)
|
|
17
16
|
}, [clearValue, selectProps.id])
|
|
18
17
|
|
|
19
|
-
// To stop this from bubbling up when inside a dialog or other modal
|
|
20
|
-
const handleMouseDown = (event: React.MouseEvent) => {
|
|
21
|
-
event.stopPropagation()
|
|
22
|
-
innerProps?.onMouseDown?.(event)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
18
|
return (
|
|
26
19
|
<components.ClearIndicator
|
|
27
20
|
className="clear_indicator"
|
|
28
21
|
{...props}
|
|
29
|
-
innerProps={{
|
|
30
|
-
...innerProps,
|
|
31
|
-
onMouseDown: handleMouseDown,
|
|
32
|
-
}}
|
|
33
22
|
/>
|
|
34
23
|
)
|
|
35
24
|
}
|
|
@@ -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,
|
|
@@ -139,8 +139,7 @@ $text_colors: (
|
|
|
139
139
|
text_lt_lighter: $text_lt_lighter,
|
|
140
140
|
text_dk_default: $text_dk_default,
|
|
141
141
|
text_dk_light: $text_dk_light,
|
|
142
|
-
text_dk_lighter: $text_dk_lighter
|
|
143
|
-
text_dk_success_sm: $text_dk_success_sm
|
|
142
|
+
text_dk_lighter: $text_dk_lighter
|
|
144
143
|
);
|
|
145
144
|
|
|
146
145
|
/* Data colors ------------------------*/
|