playbook_ui 14.5.0.pre.rc.1 → 14.5.0.pre.rc.2
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/pb_text_input/_text_input.scss +0 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +14 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -0
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +6 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_margin_bottom.html.erb +88 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_margin_bottom.jsx +60 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +6 -1
- data/dist/chunks/{_typeahead-B2zRxReA.js → _typeahead-DqPwf8sy.js} +1 -1
- data/dist/chunks/{_weekday_stacked-Co95UEiW.js → _weekday_stacked-BhDK_C-G.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- 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/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f490ff4285aa895651a908d0ced5f78c4edc38635ed1bcb704645ac657e6c5f
|
4
|
+
data.tar.gz: 6013d36f75debab8a2b2e303fdb2ae6600d1731670f88c87cdfa6f2497211263
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d0804d1cf088b88c9fe2ffdcb5564ce76c71775e8f5d1a0e5edf02615687c63efeb93abc2bd1ce1c8c8f52f0ecea4ee38b30ba54e19370e76072d3d793533a4
|
7
|
+
data.tar.gz: 97f2b53884146a7a93fa60ce6ba759a43eb4fa2f0c1c62b7b9b75583831f081ac82be90e494d22c12be0e26a29867b5c6f8f547607d2794a728422009fe46332
|
@@ -109,6 +109,20 @@ test('should pass className prop', () => {
|
|
109
109
|
expect(kit).toHaveClass(className)
|
110
110
|
})
|
111
111
|
|
112
|
+
test('typeahead textinput has mb_sm class by default', () => {
|
113
|
+
render(
|
114
|
+
<Typeahead
|
115
|
+
data={{ testid: 'default-mb-test' }}
|
116
|
+
options={options}
|
117
|
+
/>
|
118
|
+
)
|
119
|
+
|
120
|
+
const kit = screen.getByTestId('default-mb-test')
|
121
|
+
expect(kit).toHaveClass("pb_typeahead_kit mb_sm")
|
122
|
+
const textInput = kit.querySelector(".pb_text_input_kit")
|
123
|
+
expect(textInput).toHaveClass("mb_none")
|
124
|
+
})
|
125
|
+
|
112
126
|
test('typeahead with colored pills', () => {
|
113
127
|
render(
|
114
128
|
<Typeahead
|
@@ -45,6 +45,7 @@ type TypeaheadProps = {
|
|
45
45
|
getOptionLabel?: string | (() => any),
|
46
46
|
getOptionValue?: string | (() => any),
|
47
47
|
name?: string,
|
48
|
+
marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
48
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",
|
49
50
|
} & GlobalProps
|
50
51
|
|
@@ -78,6 +79,7 @@ const Typeahead = ({
|
|
78
79
|
htmlOptions = {},
|
79
80
|
id,
|
80
81
|
loadOptions = noop,
|
82
|
+
marginBottom = "sm",
|
81
83
|
pillColor,
|
82
84
|
...props
|
83
85
|
}: TypeaheadProps) => {
|
@@ -138,6 +140,7 @@ const Typeahead = ({
|
|
138
140
|
const htmlProps = buildHtmlProps(htmlOptions)
|
139
141
|
const classes = classnames(
|
140
142
|
'pb_typeahead_kit react-select',
|
143
|
+
`mb_${marginBottom}`,
|
141
144
|
globalProps(props),
|
142
145
|
className
|
143
146
|
)
|
@@ -11,14 +11,15 @@ type Props = {
|
|
11
11
|
const TypeaheadControl = (props: Props) => (
|
12
12
|
<div className="pb_typeahead_wrapper">
|
13
13
|
<TextInput
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
dark={props.selectProps.dark}
|
15
|
+
error={props.selectProps.error}
|
16
|
+
label={props.selectProps.label}
|
17
|
+
marginBottom="none"
|
17
18
|
>
|
18
19
|
<Flex>
|
19
20
|
<components.Control
|
20
|
-
|
21
|
-
|
21
|
+
className="text_input"
|
22
|
+
{...props}
|
22
23
|
/>
|
23
24
|
</Flex>
|
24
25
|
</TextInput>
|
@@ -0,0 +1,88 @@
|
|
1
|
+
<%
|
2
|
+
options = [
|
3
|
+
{ label: 'Orange', value: '#FFA500' },
|
4
|
+
{ label: 'Red', value: '#FF0000' },
|
5
|
+
{ label: 'Green', value: '#00FF00' },
|
6
|
+
{ label: 'Blue', value: '#0000FF' },
|
7
|
+
]
|
8
|
+
%>
|
9
|
+
|
10
|
+
<%= pb_rails("typeahead", props: {
|
11
|
+
id: "typeahead-default",
|
12
|
+
placeholder: "All Colors",
|
13
|
+
options: options,
|
14
|
+
label: "None",
|
15
|
+
name: :foo,
|
16
|
+
is_multi: false,
|
17
|
+
margin_bottom: "none",
|
18
|
+
})
|
19
|
+
%>
|
20
|
+
<%= pb_rails("typeahead", props: {
|
21
|
+
id: "typeahead-default",
|
22
|
+
placeholder: "All Colors",
|
23
|
+
options: options,
|
24
|
+
label: "XXS",
|
25
|
+
name: :foo,
|
26
|
+
is_multi: false,
|
27
|
+
margin_bottom: "xxs",
|
28
|
+
})
|
29
|
+
%>
|
30
|
+
<%= pb_rails("typeahead", props: {
|
31
|
+
id: "typeahead-default",
|
32
|
+
placeholder: "All Colors",
|
33
|
+
options: options,
|
34
|
+
label: "XS",
|
35
|
+
name: :foo,
|
36
|
+
is_multi: false,
|
37
|
+
margin_bottom: "xs",
|
38
|
+
})
|
39
|
+
%>
|
40
|
+
<%= pb_rails("typeahead", props: {
|
41
|
+
id: "typeahead-default",
|
42
|
+
placeholder: "All Colors",
|
43
|
+
options: options,
|
44
|
+
label: "Default - SM",
|
45
|
+
name: :foo,
|
46
|
+
is_multi: false,
|
47
|
+
})
|
48
|
+
%>
|
49
|
+
<%= pb_rails("typeahead", props: {
|
50
|
+
id: "typeahead-default",
|
51
|
+
placeholder: "All Colors",
|
52
|
+
options: options,
|
53
|
+
label: "MD",
|
54
|
+
name: :foo,
|
55
|
+
is_multi: false,
|
56
|
+
margin_bottom: "md",
|
57
|
+
})
|
58
|
+
%>
|
59
|
+
<%= pb_rails("typeahead", props: {
|
60
|
+
id: "typeahead-default",
|
61
|
+
placeholder: "All Colors",
|
62
|
+
options: options,
|
63
|
+
label: "LG",
|
64
|
+
name: :foo,
|
65
|
+
is_multi: false,
|
66
|
+
margin_bottom: "lg",
|
67
|
+
})
|
68
|
+
%>
|
69
|
+
<%= pb_rails("typeahead", props: {
|
70
|
+
id: "typeahead-default",
|
71
|
+
placeholder: "All Colors",
|
72
|
+
options: options,
|
73
|
+
label: "XL",
|
74
|
+
name: :foo,
|
75
|
+
is_multi: false,
|
76
|
+
margin_bottom: "xl",
|
77
|
+
})
|
78
|
+
%>
|
79
|
+
|
80
|
+
<%= javascript_tag defer: "defer" do %>
|
81
|
+
document.addEventListener("pb-typeahead-kit-typeahead-default-result-option-select", function(event) {
|
82
|
+
console.log('Single Option selected')
|
83
|
+
console.dir(event.detail)
|
84
|
+
})
|
85
|
+
document.addEventListener("pb-typeahead-kit-typeahead-default-result-clear", function() {
|
86
|
+
console.log('All options cleared')
|
87
|
+
})
|
88
|
+
<% end %>
|
@@ -0,0 +1,60 @@
|
|
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
|
+
]
|
11
|
+
|
12
|
+
const TypeaheadMarginBottom = (props) => {
|
13
|
+
return (
|
14
|
+
<>
|
15
|
+
<Typeahead
|
16
|
+
label="None"
|
17
|
+
marginBottom="none"
|
18
|
+
options={options}
|
19
|
+
{...props}
|
20
|
+
/>
|
21
|
+
<Typeahead
|
22
|
+
label="XXS"
|
23
|
+
marginBottom="xxs"
|
24
|
+
options={options}
|
25
|
+
{...props}
|
26
|
+
/>
|
27
|
+
<Typeahead
|
28
|
+
label="XS"
|
29
|
+
marginBottom="xs"
|
30
|
+
options={options}
|
31
|
+
{...props}
|
32
|
+
/>
|
33
|
+
<Typeahead
|
34
|
+
label="Default - SM"
|
35
|
+
options={options}
|
36
|
+
{...props}
|
37
|
+
/>
|
38
|
+
<Typeahead
|
39
|
+
label="MD"
|
40
|
+
marginBottom="md"
|
41
|
+
options={options}
|
42
|
+
{...props}
|
43
|
+
/>
|
44
|
+
<Typeahead
|
45
|
+
label="LG"
|
46
|
+
marginBottom="lg"
|
47
|
+
options={options}
|
48
|
+
{...props}
|
49
|
+
/>
|
50
|
+
<Typeahead
|
51
|
+
label="XL"
|
52
|
+
marginBottom="xl"
|
53
|
+
options={options}
|
54
|
+
{...props}
|
55
|
+
/>
|
56
|
+
</>
|
57
|
+
)
|
58
|
+
}
|
59
|
+
|
60
|
+
export default TypeaheadMarginBottom
|
@@ -9,6 +9,7 @@ examples:
|
|
9
9
|
- typeahead_inline: Inline
|
10
10
|
- typeahead_multi_kit: Multi Kit Options
|
11
11
|
- typeahead_error_state: Error State
|
12
|
+
- typeahead_margin_bottom: Margin Bottom
|
12
13
|
- typeahead_with_pills_color: With Pills (Custom Color)
|
13
14
|
|
14
15
|
react:
|
@@ -24,4 +25,5 @@ examples:
|
|
24
25
|
- typeahead_async_createable: Createable (+ Async Data)
|
25
26
|
- typeahead_error_state: Error State
|
26
27
|
- typeahead_custom_menu_list: Custom MenuList
|
28
|
+
- typeahead_margin_bottom: Margin Bottom
|
27
29
|
- typeahead_with_pills_color: With Pills (Custom Color)
|
@@ -10,4 +10,5 @@ export { default as TypeaheadCreateable } from './_typeahead_createable.jsx'
|
|
10
10
|
export { default as TypeaheadAsyncCreateable } from './_typeahead_async_createable.jsx'
|
11
11
|
export { default as TypeaheadErrorState } from './_typeahead_error_state.jsx'
|
12
12
|
export { default as TypeaheadCustomMenuList } from './_typeahead_custom_menu_list.jsx'
|
13
|
+
export { default as TypeaheadMarginBottom } from './_typeahead_margin_bottom.jsx'
|
13
14
|
export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_color.jsx'
|
@@ -20,7 +20,8 @@
|
|
20
20
|
label: object.label,
|
21
21
|
name: object.name,
|
22
22
|
value: object.value,
|
23
|
-
placeholder: object.placeholder
|
23
|
+
placeholder: object.placeholder,
|
24
|
+
margin_bottom: "none",
|
24
25
|
}) %>
|
25
26
|
<%= pb_rails("list", props: { ordered: false, borderless: false, xpadding: true, role: "status", aria: { live: "polite" }, data: { pb_typeahead_kit_results: true } }) do %>
|
26
27
|
<% end %>
|
@@ -34,12 +34,16 @@ module Playbook
|
|
34
34
|
prop :search_term_minimum_length, default: 3
|
35
35
|
prop :search_debounce_timeout, default: 250
|
36
36
|
prop :value
|
37
|
+
prop :margin_bottom, type: Playbook::Props::Enum,
|
38
|
+
values: %w[none xxs xs sm md lg xl],
|
39
|
+
default: "sm"
|
37
40
|
prop :pill_color, type: Playbook::Props::Enum,
|
38
41
|
values: %w[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],
|
39
42
|
default: "primary"
|
40
43
|
|
41
44
|
def classname
|
42
|
-
|
45
|
+
default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
|
46
|
+
generate_classname("pb_typeahead_kit") + default_margin_bottom
|
43
47
|
end
|
44
48
|
|
45
49
|
def inline_class
|
@@ -69,6 +73,7 @@ module Playbook
|
|
69
73
|
inline: inline,
|
70
74
|
isMulti: is_multi,
|
71
75
|
label: label,
|
76
|
+
marginBottom: margin_bottom,
|
72
77
|
multiKit: multi_kit,
|
73
78
|
name: name,
|
74
79
|
options: options,
|