playbook_ui 14.4.0.pre.alpha.stephenagreerpatch13910 → 14.4.0.pre.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +4 -23
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_button/_button.tsx +2 -6
- data/app/pb_kits/playbook/pb_collapsible/_helper_functions.ts +0 -4
- data/app/pb_kits/playbook/pb_contact/_contact.tsx +5 -17
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +6 -14
- data/app/pb_kits/playbook/pb_contact/contact.rb +0 -4
- data/app/pb_kits/playbook/pb_contact/contact.test.js +1 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +6 -2
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +7 -2
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +3 -4
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +0 -4
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +3 -6
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_flatpickr_styles.scss +3 -2
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_header_styles.scss +2 -6
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +0 -2
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +2 -10
- data/app/pb_kits/playbook/pb_filter/docs/_filter_max_height.html.erb +1 -5
- data/app/pb_kits/playbook/pb_filter/docs/_filter_max_width.html.erb +1 -5
- data/app/pb_kits/playbook/pb_filter/docs/_filter_no_background.html.erb +1 -5
- data/app/pb_kits/playbook/pb_filter/docs/_filter_no_sort.html.erb +1 -5
- data/app/pb_kits/playbook/pb_filter/docs/_filter_only.html.erb +1 -5
- data/app/pb_kits/playbook/pb_filter/docs/_filter_placement.html.erb +1 -5
- data/app/pb_kits/playbook/pb_filter/docs/_filter_single.html.erb +1 -5
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +23 -245
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +1 -1
- data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.tsx +0 -3
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
- data/app/pb_kits/playbook/pb_map/_map_controls.tsx +1 -7
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +5 -20
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -4
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss +21 -97
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js +0 -166
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +6 -45
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +2 -6
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb +1 -21
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +1 -12
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +1 -3
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +2 -10
- data/app/pb_kits/playbook/pb_popover/docs/_popover_list.html.erb +13 -14
- data/app/pb_kits/playbook/pb_popover/docs/_popover_list.jsx +4 -4
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +32 -41
- data/app/pb_kits/playbook/pb_radio/docs/{_radio_custom_children.jsx → _radio_children.jsx} +2 -5
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_radio/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_radio/radio.html.erb +13 -35
- data/app/pb_kits/playbook/pb_radio/radio.rb +1 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +5 -12
- data/app/pb_kits/playbook/pb_select/_select.tsx +2 -5
- data/app/pb_kits/playbook/pb_select/select.html.erb +1 -1
- data/app/pb_kits/playbook/pb_select/select.rb +0 -4
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +1 -0
- data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +1 -0
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +13 -17
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +1 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +1 -18
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +6 -6
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +23 -17
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +18 -26
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_margin_bottom.html.erb +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_margin_bottom.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -7
- data/app/pb_kits/playbook/tokens/_colors.scss +0 -2
- data/app/pb_kits/playbook/utilities/icons/allicons.tsx +13 -136
- data/dist/chunks/_typeahead-es44Ih6G.js +22 -0
- data/dist/chunks/_weekday_stacked-DWJJPUPQ.js +45 -0
- data/dist/chunks/lib-D9uVVKnh.js +16 -0
- data/dist/chunks/{pb_form_validation-D9zkwt2b.js → pb_form_validation-u2wnZ3oe.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +1 -3
- data/dist/playbook-doc.js +1 -1
- 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/pagination_renderer.rb +2 -10
- data/lib/playbook/version.rb +2 -2
- metadata +7 -40
- data/app/pb_kits/playbook/pb_drawer/_close_icon.tsx +0 -25
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +0 -465
- data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +0 -195
- data/app/pb_kits/playbook/pb_drawer/_drawer_context.tsx +0 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +0 -117
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +0 -43
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.jsx +0 -63
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +0 -55
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.jsx +0 -113
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +0 -12
- data/app/pb_kits/playbook/pb_drawer/docs/index.js +0 -5
- data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +0 -12
- data/app/pb_kits/playbook/pb_drawer/drawer.rb +0 -8
- data/app/pb_kits/playbook/pb_drawer/drawer.test.jsx +0 -77
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.html.erb +0 -117
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.jsx +0 -227
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.html.erb +0 -72
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.jsx +0 -91
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_rails.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_react.md +0 -1
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_bubble.html.erb +0 -73
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_bubble.jsx +0 -86
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.html.erb +0 -50
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.md +0 -1
- data/app/pb_kits/playbook/pb_radio/index.js +0 -17
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.html.erb +0 -31
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.jsx +0 -26
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_rails.md +0 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_react.md +0 -1
- data/app/pb_kits/playbook/utilities/icons/angle-down.svg +0 -3
- data/app/pb_kits/playbook/utilities/icons/envelope.svg +0 -3
- data/dist/chunks/_typeahead-BYw0HEgO.js +0 -22
- data/dist/chunks/_weekday_stacked-DY64Tj7E.js +0 -45
- data/dist/chunks/lib-CEpcaI8y.js +0 -29
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import React, { forwardRef, useRef } from 'react'
|
1
|
+
import React, { forwardRef, isValidElement, useRef } from 'react'
|
4
2
|
import Body from '../pb_body/_body'
|
5
3
|
import Flex from '../pb_flex/_flex'
|
6
4
|
import classnames from 'classnames'
|
@@ -12,7 +10,6 @@ type RadioProps = {
|
|
12
10
|
alignment?: string,
|
13
11
|
checked?: boolean,
|
14
12
|
children?: React.ReactChild[] | React.ReactChild,
|
15
|
-
customChildren?: boolean,
|
16
13
|
className?: string,
|
17
14
|
dark?: boolean,
|
18
15
|
data?: { [key: string]: string },
|
@@ -32,7 +29,6 @@ const Radio = ({
|
|
32
29
|
alignment,
|
33
30
|
children,
|
34
31
|
className,
|
35
|
-
customChildren = false,
|
36
32
|
dark = false,
|
37
33
|
disabled = false,
|
38
34
|
error = false,
|
@@ -45,7 +41,7 @@ const Radio = ({
|
|
45
41
|
value = 'radio_text',
|
46
42
|
onChange = () => { void 0 },
|
47
43
|
...props
|
48
|
-
}: RadioProps
|
44
|
+
}: RadioProps ) => {
|
49
45
|
const radioRef = useRef(null);
|
50
46
|
|
51
47
|
const ariaProps = buildAriaProps(aria);
|
@@ -66,23 +62,27 @@ const Radio = ({
|
|
66
62
|
className
|
67
63
|
);
|
68
64
|
|
65
|
+
const isCustomChild = children && isValidElement(children) && children.type !== 'input';
|
66
|
+
|
69
67
|
const displayRadio = (props: RadioProps & any) => {
|
70
|
-
if (children &&
|
71
|
-
return
|
72
|
-
else
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
68
|
+
if (isValidElement(children) && children.type === 'input') {
|
69
|
+
return children;
|
70
|
+
} else if (isCustomChild || !children) {
|
71
|
+
return (
|
72
|
+
<input
|
73
|
+
disabled={disabled}
|
74
|
+
id={id}
|
75
|
+
name={name}
|
76
|
+
onChange={onChange}
|
77
|
+
ref={radioRef}
|
78
|
+
text={text}
|
79
|
+
type="radio"
|
80
|
+
value={value}
|
81
|
+
{...props}
|
82
|
+
/>
|
83
|
+
);
|
84
|
+
}
|
85
|
+
};
|
86
86
|
|
87
87
|
const handleContainerClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | undefined) => {
|
88
88
|
if (event) {
|
@@ -97,7 +97,7 @@ const Radio = ({
|
|
97
97
|
};
|
98
98
|
|
99
99
|
return (
|
100
|
-
|
100
|
+
isCustomChild ? (
|
101
101
|
<Flex
|
102
102
|
{...ariaProps}
|
103
103
|
{...dataProps}
|
@@ -114,28 +114,19 @@ const Radio = ({
|
|
114
114
|
id="radio-container"
|
115
115
|
>
|
116
116
|
<label className={buildCss('pb_radio_kit', alignment)}>
|
117
|
-
|
118
|
-
disabled={disabled}
|
119
|
-
id={id}
|
120
|
-
name={name}
|
121
|
-
onChange={onChange}
|
122
|
-
ref={radioRef}
|
123
|
-
type="radio"
|
124
|
-
value={value}
|
125
|
-
{...props}
|
126
|
-
/>
|
117
|
+
<>{displayRadio(props)}</>
|
127
118
|
<span className="pb_radio_button" />
|
128
119
|
</label>
|
129
120
|
<div id="pb-radio-children-wrapper"> {children} </div>
|
130
121
|
</Flex>
|
131
122
|
) : (
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
123
|
+
<label
|
124
|
+
{...ariaProps}
|
125
|
+
{...dataProps}
|
126
|
+
{...htmlProps}
|
127
|
+
className={classes}
|
128
|
+
htmlFor={id}
|
129
|
+
>
|
139
130
|
<>{displayRadio(props)}</>
|
140
131
|
<span className="pb_radio_button" />
|
141
132
|
<Body
|
@@ -149,4 +140,4 @@ const Radio = ({
|
|
149
140
|
);
|
150
141
|
};
|
151
142
|
|
152
|
-
export default forwardRef(Radio);
|
143
|
+
export default forwardRef(Radio);
|
@@ -17,7 +17,6 @@ const RadioChildren = (props) => {
|
|
17
17
|
return (
|
18
18
|
<div>
|
19
19
|
<Radio
|
20
|
-
customChildren
|
21
20
|
label="Select"
|
22
21
|
marginBottom="sm"
|
23
22
|
name="Group1"
|
@@ -25,14 +24,13 @@ const RadioChildren = (props) => {
|
|
25
24
|
value="Select"
|
26
25
|
{...props}
|
27
26
|
>
|
28
|
-
<Select
|
27
|
+
<Select
|
29
28
|
marginBottom="none"
|
30
29
|
minWidth="xs"
|
31
30
|
options={options}
|
32
31
|
/>
|
33
32
|
</Radio>
|
34
33
|
<Radio
|
35
|
-
customChildren
|
36
34
|
label="Typeahead"
|
37
35
|
marginBottom="sm"
|
38
36
|
name="Group1"
|
@@ -47,7 +45,6 @@ const RadioChildren = (props) => {
|
|
47
45
|
/>
|
48
46
|
</Radio>
|
49
47
|
<Radio
|
50
|
-
customChildren
|
51
48
|
defaultChecked={false}
|
52
49
|
label="Typography"
|
53
50
|
name="Group1"
|
@@ -59,4 +56,4 @@ const RadioChildren = (props) => {
|
|
59
56
|
</div>
|
60
57
|
)
|
61
58
|
}
|
62
|
-
export default RadioChildren
|
59
|
+
export default RadioChildren
|
@@ -7,7 +7,6 @@ examples:
|
|
7
7
|
- radio_options: With Options
|
8
8
|
- radio_alignment: Alignment
|
9
9
|
- radio_disabled: Disabled
|
10
|
-
- radio_custom_children: Custom Children
|
11
10
|
|
12
11
|
react:
|
13
12
|
- radio_default: Default
|
@@ -15,7 +14,7 @@ examples:
|
|
15
14
|
- radio_error: With Error
|
16
15
|
- radio_alignment: Alignment
|
17
16
|
- radio_disabled: Disabled
|
18
|
-
-
|
17
|
+
- radio_children: Children
|
19
18
|
|
20
19
|
swift:
|
21
20
|
- radio_default_swift: Default
|
@@ -3,4 +3,4 @@ export { default as RadioCustom } from './_radio_custom.jsx'
|
|
3
3
|
export { default as RadioError } from './_radio_error.jsx'
|
4
4
|
export { default as RadioAlignment } from './_radio_alignment.jsx'
|
5
5
|
export { default as RadioDisabled } from './_radio_disabled.jsx'
|
6
|
-
export { default as
|
6
|
+
export { default as RadioChildren } from './_radio_children.jsx'
|
@@ -1,40 +1,18 @@
|
|
1
|
-
|
2
|
-
<%= pb_rails("flex", props: {
|
1
|
+
<%= content_tag(:label,
|
3
2
|
aria: object.aria,
|
4
|
-
|
3
|
+
checked: object.checked,
|
5
4
|
class: object.classname,
|
6
|
-
cursor: "pointer",
|
7
5
|
data: object.data,
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
'data-pb-radio-children': 'true',
|
12
|
-
checked: object.checked,
|
13
|
-
class: object.classname,
|
14
|
-
id: object.id,
|
15
|
-
value: object.value) do %>
|
16
|
-
<%= input %>
|
17
|
-
<span class="pb_radio_button"></span>
|
18
|
-
<% end %>
|
19
|
-
<div data-pb-radio-children-wrapper="true"> <%= content %> </div>
|
20
|
-
<% end %>
|
21
|
-
<% else %>
|
22
|
-
<%= content_tag(:label,
|
23
|
-
aria: object.aria,
|
24
|
-
checked: object.checked,
|
25
|
-
class: object.classname,
|
26
|
-
data: object.data,
|
27
|
-
id: object.id,
|
28
|
-
value: object.value,
|
29
|
-
**combined_html_options) do %>
|
6
|
+
id: object.id,
|
7
|
+
value: object.value,
|
8
|
+
**combined_html_options) do %>
|
30
9
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
10
|
+
<% if content.present? %>
|
11
|
+
<%= content %>
|
12
|
+
<% else %>
|
13
|
+
<%= radio_button_tag object.name, object.value, object.selected, object.input_options %>
|
14
|
+
<% end %>
|
36
15
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
<% end %>
|
16
|
+
<span class="pb_radio_button"></span>
|
17
|
+
<%= pb_rails("body", props: { status: object.body_status, text: object.text, dark: object.dark }) %>
|
18
|
+
<% end %>
|
@@ -20,8 +20,6 @@ module Playbook
|
|
20
20
|
default: "Radio Text"
|
21
21
|
prop :value, type: Playbook::Props::String,
|
22
22
|
default: "radio_text"
|
23
|
-
prop :custom_children, type: Playbook::Props::Boolean,
|
24
|
-
default: false
|
25
23
|
|
26
24
|
def classname
|
27
25
|
generate_classname("pb_radio_kit") + error_class + alignment_class
|
@@ -36,7 +34,7 @@ module Playbook
|
|
36
34
|
end
|
37
35
|
|
38
36
|
def input
|
39
|
-
radio_button_tag(name, value, checked, input_options.merge(disabled: disabled
|
37
|
+
radio_button_tag(name, value, checked, input_options.merge(disabled: disabled))
|
40
38
|
end
|
41
39
|
|
42
40
|
private
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
2
|
|
3
|
-
import { getAllIcons } from "../../utilities/icons/allicons"
|
4
|
-
|
5
3
|
import Flex from '../../pb_flex/_flex'
|
6
4
|
import PbReactPopover from '../../pb_popover/_popover'
|
7
5
|
import Button from '../../pb_button/_button'
|
@@ -67,7 +65,6 @@ const toolbarDropdownItems = [
|
|
67
65
|
},
|
68
66
|
]
|
69
67
|
|
70
|
-
const angleDown = getAllIcons()["angleDown"].icon as unknown as { [key: string]: SVGElement }
|
71
68
|
|
72
69
|
const handleTogglePopover = () => {
|
73
70
|
setShowPopover(!showPopover)
|
@@ -95,10 +92,8 @@ for (const { text, isActive, icon } of toolbarDropdownItems) {
|
|
95
92
|
<Flex className={showPopover ? "fa-flip-vertical" : ""}
|
96
93
|
display="inline_flex"
|
97
94
|
>
|
98
|
-
<Icon
|
99
|
-
|
100
|
-
customIcon={angleDown}
|
101
|
-
fixedWidth
|
95
|
+
<Icon fixedWidth
|
96
|
+
icon="angle-down"
|
102
97
|
margin-left="xs"
|
103
98
|
/>
|
104
99
|
</Flex>
|
@@ -130,10 +125,8 @@ const popoverReference = (
|
|
130
125
|
<Flex className={showPopover ? "fa-flip-vertical" : ""}
|
131
126
|
display="inline_flex"
|
132
127
|
>
|
133
|
-
<Icon
|
134
|
-
|
135
|
-
customIcon={angleDown}
|
136
|
-
fixedWidth
|
128
|
+
<Icon fixedWidth
|
129
|
+
icon="angle-down"
|
137
130
|
margin-left="xs"
|
138
131
|
/>
|
139
132
|
</Flex>
|
@@ -176,4 +169,4 @@ const popoverReference = (
|
|
176
169
|
)
|
177
170
|
}
|
178
171
|
|
179
|
-
export default ToolbarDropdown
|
172
|
+
export default ToolbarDropdown
|
@@ -4,7 +4,6 @@ import classnames from 'classnames'
|
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
5
5
|
import { globalProps, GlobalProps, domSafeProps } from '../utilities/globalProps'
|
6
6
|
import type { InputCallback } from '../types'
|
7
|
-
import { getAllIcons } from "../utilities/icons/allicons"
|
8
7
|
|
9
8
|
import Body from '../pb_body/_body'
|
10
9
|
import Caption from '../pb_caption/_caption'
|
@@ -91,8 +90,6 @@ const Select = ({
|
|
91
90
|
compactClass
|
92
91
|
);
|
93
92
|
|
94
|
-
const angleDown = getAllIcons()["angleDown"].icon as unknown as { [key: string]: SVGElement }
|
95
|
-
|
96
93
|
const selectWrapperClass = classnames(buildCss('pb_select_kit_wrapper'), { error }, className)
|
97
94
|
const selectBody =(() =>{
|
98
95
|
if (children) return children
|
@@ -137,9 +134,9 @@ const Select = ({
|
|
137
134
|
{selectBody}
|
138
135
|
{ multiple !== true ?
|
139
136
|
<Icon
|
140
|
-
className="pb_select_kit_caret
|
141
|
-
customIcon={angleDown}
|
137
|
+
className="pb_select_kit_caret"
|
142
138
|
fixedWidth
|
139
|
+
icon="angle-down"
|
143
140
|
/>
|
144
141
|
:
|
145
142
|
null
|
@@ -26,7 +26,7 @@
|
|
26
26
|
<%= pb_rails("body", props: { status: "negative", text: object.error }) %>
|
27
27
|
<% end %>
|
28
28
|
<% if object.multiple != true %>
|
29
|
-
<%= pb_rails("icon", props: {
|
29
|
+
<%= pb_rails("icon", props: { icon: "angle-down", fixed_width: true, classname: "pb_select_kit_caret"}) %>
|
30
30
|
<% end %>
|
31
31
|
</label>
|
32
32
|
<% end %>
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import React, { useRef, useState, forwardRef, ForwardedRef } from "react"
|
2
2
|
|
3
3
|
import {
|
4
|
-
arrow,
|
5
|
-
flip,
|
6
|
-
offset,
|
7
|
-
Placement,
|
8
|
-
safePolygon,
|
4
|
+
arrow,
|
5
|
+
flip,
|
6
|
+
offset,
|
7
|
+
Placement,
|
8
|
+
safePolygon,
|
9
9
|
shift,
|
10
|
-
useFloating,
|
11
|
-
useHover,
|
10
|
+
useFloating,
|
11
|
+
useHover,
|
12
12
|
useInteractions,
|
13
13
|
} from "@floating-ui/react"
|
14
14
|
|
@@ -16,8 +16,6 @@ import classnames from "classnames"
|
|
16
16
|
import { GlobalProps, globalProps } from "../utilities/globalProps"
|
17
17
|
import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props"
|
18
18
|
import Flex from "../pb_flex/_flex"
|
19
|
-
import { getAllIcons } from "../utilities/icons/allicons"
|
20
|
-
import Icon from '../pb_icon/_icon'
|
21
19
|
|
22
20
|
type TooltipProps = {
|
23
21
|
aria?: { [key: string]: string },
|
@@ -55,7 +53,7 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
55
53
|
const dataProps: { [key: string]: string } = buildDataProps(data)
|
56
54
|
const ariaProps: { [key: string]: string } = buildAriaProps(aria)
|
57
55
|
const htmlProps = buildHtmlProps(htmlOptions)
|
58
|
-
|
56
|
+
|
59
57
|
const css = classnames(
|
60
58
|
globalProps({...rest}),
|
61
59
|
className,
|
@@ -63,6 +61,7 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
63
61
|
const [open, setOpen] = useState(false)
|
64
62
|
const arrowRef = useRef(null)
|
65
63
|
|
64
|
+
|
66
65
|
const {
|
67
66
|
context,
|
68
67
|
middlewareData: { arrow: { x: arrowX, y: arrowY } = {}, },
|
@@ -96,7 +95,7 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
96
95
|
placement: preferredPlacement
|
97
96
|
})
|
98
97
|
|
99
|
-
|
98
|
+
|
100
99
|
const { getFloatingProps } = useInteractions([
|
101
100
|
useHover(context, {
|
102
101
|
delay,
|
@@ -149,16 +148,13 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
149
148
|
},
|
150
149
|
})}
|
151
150
|
>
|
152
|
-
<Flex
|
151
|
+
<Flex
|
153
152
|
align="center"
|
154
153
|
gap="xs"
|
155
154
|
>
|
156
155
|
{icon && (
|
157
|
-
<i className={`pb_icon_kit`}
|
158
|
-
|
159
|
-
icon={icon}
|
160
|
-
/>
|
161
|
-
</i>)}
|
156
|
+
<i className={`pb_icon_kit far fa-${icon} fa-fw`} />
|
157
|
+
)}
|
162
158
|
{text}
|
163
159
|
</Flex>
|
164
160
|
<div
|
@@ -118,23 +118,6 @@ test('typeahead textinput has mb_sm class by default', () => {
|
|
118
118
|
)
|
119
119
|
|
120
120
|
const kit = screen.getByTestId('default-mb-test')
|
121
|
-
expect(kit).toHaveClass("pb_typeahead_kit mb_sm")
|
122
121
|
const textInput = kit.querySelector(".pb_text_input_kit")
|
123
|
-
expect(textInput).toHaveClass("
|
124
|
-
})
|
125
|
-
|
126
|
-
test('typeahead with colored pills', () => {
|
127
|
-
render(
|
128
|
-
<Typeahead
|
129
|
-
data={{ testid: 'pills-color-test' }}
|
130
|
-
defaultValue={[options[0]]}
|
131
|
-
isMulti
|
132
|
-
options={options}
|
133
|
-
pillColor="neutral"
|
134
|
-
/>
|
135
|
-
)
|
136
|
-
|
137
|
-
const kit = screen.getByTestId('pills-color-test')
|
138
|
-
const pill = kit.querySelector(".pb_form_pill_kit_neutral")
|
139
|
-
expect(pill).toBeInTheDocument()
|
122
|
+
expect(textInput).toHaveClass("mb_sm")
|
140
123
|
})
|
@@ -46,14 +46,12 @@ type TypeaheadProps = {
|
|
46
46
|
getOptionValue?: string | (() => any),
|
47
47
|
name?: string,
|
48
48
|
marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
49
|
-
pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
|
50
49
|
} & GlobalProps
|
51
50
|
|
52
51
|
export type SelectValueType = {
|
53
52
|
label: string,
|
54
53
|
value: string,
|
55
54
|
imageUrl?: string,
|
56
|
-
pillColor?: string,
|
57
55
|
}
|
58
56
|
|
59
57
|
type TagOnChangeValues = {
|
@@ -80,13 +78,17 @@ const Typeahead = ({
|
|
80
78
|
id,
|
81
79
|
loadOptions = noop,
|
82
80
|
marginBottom = "sm",
|
83
|
-
pillColor,
|
84
81
|
...props
|
85
82
|
}: TypeaheadProps) => {
|
86
83
|
const selectProps = {
|
87
84
|
cacheOptions: true,
|
88
85
|
components: {
|
89
|
-
Control
|
86
|
+
Control: (controlProps: any) => (
|
87
|
+
<Control
|
88
|
+
{...controlProps}
|
89
|
+
marginBottom={marginBottom}
|
90
|
+
/>
|
91
|
+
),
|
90
92
|
ClearIndicator,
|
91
93
|
IndicatorsContainer,
|
92
94
|
IndicatorSeparator: null as null,
|
@@ -110,7 +112,6 @@ const Typeahead = ({
|
|
110
112
|
onCreateOption: null as null,
|
111
113
|
plusIcon: false,
|
112
114
|
onMultiValueClick: (_option: SelectValueType): any => undefined,
|
113
|
-
pillColor: pillColor,
|
114
115
|
...props,
|
115
116
|
}
|
116
117
|
|
@@ -140,7 +141,6 @@ const Typeahead = ({
|
|
140
141
|
const htmlProps = buildHtmlProps(htmlOptions)
|
141
142
|
const classes = classnames(
|
142
143
|
'pb_typeahead_kit react-select',
|
143
|
-
`mb_${marginBottom}`,
|
144
144
|
globalProps(props),
|
145
145
|
className
|
146
146
|
)
|
@@ -6,24 +6,30 @@ import TextInput from '../../pb_text_input/_text_input'
|
|
6
6
|
|
7
7
|
type Props = {
|
8
8
|
selectProps: any,
|
9
|
+
marginBottom?: string,
|
9
10
|
}
|
10
11
|
|
11
|
-
const TypeaheadControl = (props: Props) =>
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
12
|
+
const TypeaheadControl = (props: Props) => {
|
13
|
+
const { selectProps, marginBottom } = props
|
14
|
+
const { dark, error, label } = selectProps
|
15
|
+
|
16
|
+
return (
|
17
|
+
<div className="pb_typeahead_wrapper">
|
18
|
+
<TextInput
|
19
|
+
dark={dark}
|
20
|
+
error={error}
|
21
|
+
label={label}
|
22
|
+
marginBottom={marginBottom}
|
23
|
+
>
|
24
|
+
<Flex>
|
25
|
+
<components.Control
|
26
|
+
className="text_input"
|
27
|
+
{...props}
|
28
|
+
/>
|
29
|
+
</Flex>
|
30
|
+
</TextInput>
|
31
|
+
</div>
|
32
|
+
)
|
33
|
+
}
|
28
34
|
|
29
35
|
export default TypeaheadControl
|
@@ -8,7 +8,6 @@ import { SelectValueType } from '../_typeahead'
|
|
8
8
|
type Props = {
|
9
9
|
data: SelectValueType,
|
10
10
|
multiValueTemplate: any,
|
11
|
-
pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
|
12
11
|
removeProps: any,
|
13
12
|
selectProps: any,
|
14
13
|
}
|
@@ -16,55 +15,48 @@ type Props = {
|
|
16
15
|
const MultiValue = (props: Props) => {
|
17
16
|
const { removeProps } = props
|
18
17
|
const { imageUrl, label } = props.data
|
19
|
-
const {
|
18
|
+
const { multiKit } = props.selectProps
|
20
19
|
|
21
20
|
const formPillProps = {
|
22
21
|
marginRight: 'xs',
|
23
22
|
name: label,
|
24
23
|
avatarUrl: '',
|
25
|
-
dark,
|
26
24
|
}
|
27
25
|
|
28
26
|
if (typeof imageUrl === 'string') formPillProps.avatarUrl = imageUrl
|
29
27
|
|
30
28
|
return (
|
31
29
|
<components.MultiValueContainer
|
32
|
-
|
33
|
-
|
30
|
+
className="text_input_multivalue_container"
|
31
|
+
{...props}
|
34
32
|
>
|
35
33
|
{multiKit === 'badge' &&
|
36
34
|
<Badge
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
35
|
+
closeProps={removeProps}
|
36
|
+
removeIcon
|
37
|
+
text={label}
|
38
|
+
variant="primary"
|
41
39
|
/>
|
42
40
|
}
|
43
41
|
|
44
42
|
{multiKit !== 'badge' && imageUrl &&
|
45
43
|
<FormPill
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
size={multiKit === 'smallPill' ? 'small' : ''}
|
53
|
-
text=''
|
54
|
-
{...props}
|
44
|
+
avatarUrl={imageUrl}
|
45
|
+
closeProps={removeProps}
|
46
|
+
marginRight="xs"
|
47
|
+
name={label}
|
48
|
+
size={multiKit === 'smallPill' ? 'small' : ''}
|
49
|
+
text=''
|
55
50
|
/>
|
56
51
|
}
|
57
52
|
|
58
53
|
{multiKit !== 'badge' && !imageUrl &&
|
59
54
|
<FormPill
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
size={multiKit === 'smallPill' ? 'small' : ''}
|
66
|
-
text={label}
|
67
|
-
{...props}
|
55
|
+
closeProps={removeProps}
|
56
|
+
marginRight="xs"
|
57
|
+
name=''
|
58
|
+
size={multiKit === 'smallPill' ? 'small' : ''}
|
59
|
+
text={label}
|
68
60
|
/>
|
69
61
|
}
|
70
62
|
</components.MultiValueContainer>
|