playbook_ui 14.11.1 → 14.12.0.pre.alpha.PLAY1602lightboxoverlapnitrobug5646
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 +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +18 -2
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +27 -5
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +17 -2
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +23 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +29 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +61 -4
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.jsx +50 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.jsx +60 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +78 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.jsx +53 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.jsx +52 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_no_subrows.json +42 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_with_id.json +299 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +6 -1
- data/app/pb_kits/playbook/pb_button/button.html.erb +2 -3
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +1 -6
- data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +3 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible.rb +3 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +24 -16
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +2 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames.html.erb +13 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames_rails.md +3 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +3 -9
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.html.erb +38 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +3 -0
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +145 -183
- data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +158 -268
- data/app/pb_kits/playbook/pb_drawer/context.ts +11 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.jsx +38 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +3 -45
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +0 -1
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.jsx +9 -16
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +44 -19
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +21 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +16 -21
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.jsx +2 -19
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_drawer/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_drawer/drawer.test.jsx +5 -5
- data/app/pb_kits/playbook/pb_drawer/hooks/useBreakpoint.tsx +60 -0
- data/app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx +21 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +7 -12
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +9 -14
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +6 -11
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +8 -14
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.scss +78 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +3 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +16 -0
- data/app/pb_kits/playbook/pb_icon_button/icon_button.rb +22 -0
- data/app/pb_kits/playbook/pb_lightbox/lightbox.scss +5 -5
- data/app/pb_kits/playbook/pb_list/item.html.erb +30 -8
- data/app/pb_kits/playbook/pb_list/item.rb +7 -0
- data/app/pb_kits/playbook/pb_list/list.html.erb +31 -11
- data/app/pb_kits/playbook/pb_list/list.rb +4 -0
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +6 -1
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +4 -0
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +1 -0
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +30 -12
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.html.erb +15 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.jsx +24 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +20 -1
- data/app/pb_kits/playbook/pb_radio/_radio.scss +12 -8
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +8 -3
- data/app/pb_kits/playbook/pb_select/_select.scss +3 -5
- data/app/pb_kits/playbook/pb_select/_select.tsx +5 -1
- data/app/pb_kits/playbook/pb_select/select.html.erb +2 -2
- data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +9 -1
- data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_default.jsx +4 -1
- data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_single_select.jsx +4 -1
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.html.erb +17 -3
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.rb +3 -0
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +11 -4
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +3 -0
- data/app/pb_kits/playbook/pb_table/_table.tsx +2 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.html.erb +74 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_rails.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.html.erb +74 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_rails.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.html.erb +47 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_table/index.ts +187 -88
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +12 -0
- data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +6 -5
- data/app/pb_kits/playbook/pb_table/table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_table/table.rb +17 -2
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +20 -1
- data/app/pb_kits/playbook/pb_table/table_row.rb +5 -0
- data/app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts +22 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +46 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask_rails.md +3 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_text_input/index.js +103 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +4 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +33 -3
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +30 -30
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -2
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +12 -4
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +5 -1
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +8 -3
- data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +6 -1
- data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +21 -6
- data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +13 -6
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +19 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +27 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +4 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +5 -5
- 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/dist/chunks/_typeahead-BWwaAo_0.js +36 -0
- data/dist/chunks/_weekday_stacked-zyBCd1s8.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/{lib-B7sgJtGS.js → lib-kMuhBuU7.js} +2 -2
- data/dist/chunks/{pb_form_validation-C5Cc0-1v.js → pb_form_validation-DBJ0wZuS.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +6 -0
- 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 +2 -2
- metadata +66 -9
- data/dist/chunks/_typeahead-C2iCBqxQ.js +0 -36
- data/dist/chunks/_weekday_stacked-E-5KcEkc.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_table_props.md → _advanced_table_table_props_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible.md → _table_with_collapsible_react.md} +0 -0
@@ -4,6 +4,15 @@
|
|
4
4
|
module Playbook
|
5
5
|
module PbTextInput
|
6
6
|
class TextInput < Playbook::KitBase
|
7
|
+
VALID_MASKS = %w[currency zipCode postalCode ssn].freeze
|
8
|
+
|
9
|
+
MASK_PATTERNS = {
|
10
|
+
"currency" => '^\$\d{1,3}(?:,\d{3})*(?:\.\d{2})?$',
|
11
|
+
"zip_code" => '\d{5}',
|
12
|
+
"postal_code" => '\d{5}-\d{4}',
|
13
|
+
"ssn" => '\d{3}-\d{2}-\d{4}',
|
14
|
+
}.freeze
|
15
|
+
|
7
16
|
prop :autocomplete, type: Playbook::Props::Boolean,
|
8
17
|
default: true
|
9
18
|
prop :disabled, type: Playbook::Props::Boolean,
|
@@ -25,6 +34,9 @@ module Playbook
|
|
25
34
|
prop :add_on, type: Playbook::Props::NestedProps,
|
26
35
|
nested_kit: Playbook::PbTextInput::AddOn
|
27
36
|
|
37
|
+
prop :mask, type: Playbook::Props::String,
|
38
|
+
default: nil
|
39
|
+
|
28
40
|
def classname
|
29
41
|
default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
|
30
42
|
generate_classname("pb_text_input_kit") + default_margin_bottom + error_class + inline_class
|
@@ -46,6 +58,10 @@ module Playbook
|
|
46
58
|
{ dark: dark }.merge(add_on || {})
|
47
59
|
end
|
48
60
|
|
61
|
+
def sanitized_id
|
62
|
+
"#{object.id}-sanitized" if id.present?
|
63
|
+
end
|
64
|
+
|
49
65
|
private
|
50
66
|
|
51
67
|
def all_input_options
|
@@ -55,12 +71,13 @@ module Playbook
|
|
55
71
|
data: validation_data,
|
56
72
|
disabled: disabled,
|
57
73
|
id: input_options.dig(:id) || id,
|
58
|
-
name: name,
|
59
|
-
pattern: validation_pattern,
|
74
|
+
name: mask.present? ? "" : name,
|
75
|
+
pattern: validation_pattern || mask_pattern,
|
60
76
|
placeholder: placeholder,
|
61
77
|
required: required,
|
62
78
|
type: type,
|
63
79
|
value: value,
|
80
|
+
mask: mask,
|
64
81
|
}.merge(input_options)
|
65
82
|
end
|
66
83
|
|
@@ -75,7 +92,7 @@ module Playbook
|
|
75
92
|
def validation_data
|
76
93
|
fields = input_options.dig(:data) || {}
|
77
94
|
fields[:message] = validation_message unless validation_message.blank?
|
78
|
-
fields
|
95
|
+
mask ? fields.merge(pb_input_mask: true) : fields
|
79
96
|
end
|
80
97
|
|
81
98
|
def error_class
|
@@ -85,6 +102,19 @@ module Playbook
|
|
85
102
|
def inline_class
|
86
103
|
inline ? " inline" : ""
|
87
104
|
end
|
105
|
+
|
106
|
+
def mask_data
|
107
|
+
return {} unless mask
|
108
|
+
raise ArgumentError, "mask must be one of: #{VALID_MASKS.join(', ')}" unless VALID_MASKS.include?(mask)
|
109
|
+
|
110
|
+
{ mask: mask }
|
111
|
+
end
|
112
|
+
|
113
|
+
def mask_pattern
|
114
|
+
return nil unless mask
|
115
|
+
|
116
|
+
MASK_PATTERNS[mask]
|
117
|
+
end
|
88
118
|
end
|
89
119
|
end
|
90
120
|
end
|
@@ -50,7 +50,7 @@ $gap_lg: $height_from_top + $space_lg;
|
|
50
50
|
>div {
|
51
51
|
&:last-child {
|
52
52
|
flex-basis: auto !important;
|
53
|
-
[class
|
53
|
+
[class^=pb_timeline_item_step] {
|
54
54
|
[class=pb_timeline_item_connector] {
|
55
55
|
opacity: 0;
|
56
56
|
}
|
@@ -66,29 +66,25 @@ $gap_lg: $height_from_top + $space_lg;
|
|
66
66
|
[class*=pb_timeline_item_kit] {
|
67
67
|
&[class*=_solid] {
|
68
68
|
flex-basis: 100%;
|
69
|
-
[class
|
70
|
-
height: 0px;
|
71
|
-
}
|
72
|
-
[class=pb_timeline_item_step] {
|
69
|
+
[class^=pb_timeline_item_step] {
|
73
70
|
@include flex_wrapper(row);
|
71
|
+
align-items: center;
|
74
72
|
margin-top: $space_xs;
|
75
73
|
margin-bottom: $space_xs;
|
76
74
|
[class=pb_timeline_item_connector] {
|
77
|
-
@include pb_timeline_line_solid($connector_width, $connector_width,
|
75
|
+
@include pb_timeline_line_solid($connector_width, $connector_width, 0 $icon_margin 0 $icon_margin );
|
78
76
|
}
|
79
77
|
}
|
80
78
|
}
|
81
79
|
&[class*=_dotted] {
|
82
80
|
flex-basis: 100%;
|
83
|
-
[class
|
84
|
-
height: 0;
|
85
|
-
}
|
86
|
-
[class=pb_timeline_item_step] {
|
81
|
+
[class^=pb_timeline_item_step] {
|
87
82
|
@include flex_wrapper(row);
|
83
|
+
align-items: center;
|
88
84
|
margin-top: $space_xs;
|
89
85
|
margin-bottom: $space_xs;
|
90
86
|
[class=pb_timeline_item_connector] {
|
91
|
-
@include pb_timeline_line_dotted_horizontal($connector_width, $connector_width,
|
87
|
+
@include pb_timeline_line_dotted_horizontal($connector_width, $connector_width, 0 $icon_margin 0 $icon_margin );
|
92
88
|
}
|
93
89
|
}
|
94
90
|
}
|
@@ -99,7 +95,7 @@ $gap_lg: $height_from_top + $space_lg;
|
|
99
95
|
>div {
|
100
96
|
&:last-child {
|
101
97
|
flex-basis: auto !important;
|
102
|
-
[class
|
98
|
+
[class^=pb_timeline_item_step] {
|
103
99
|
[class=pb_timeline_item_connector] {
|
104
100
|
opacity: 0;
|
105
101
|
}
|
@@ -129,12 +125,12 @@ $gap_lg: $height_from_top + $space_lg;
|
|
129
125
|
}
|
130
126
|
}
|
131
127
|
}
|
132
|
-
[class
|
128
|
+
[class^=pb_timeline_item_step] {
|
133
129
|
@include flex_wrapper(row);
|
134
130
|
margin-top: $space_xs;
|
135
131
|
margin-bottom: $space_xs;
|
136
132
|
[class=pb_timeline_item_connector] {
|
137
|
-
@include pb_timeline_line_solid($connector_width, $connector_width,
|
133
|
+
@include pb_timeline_line_solid($connector_width, $connector_width, 0 $icon_margin 0 $icon_margin );
|
138
134
|
}
|
139
135
|
}
|
140
136
|
}
|
@@ -153,12 +149,12 @@ $gap_lg: $height_from_top + $space_lg;
|
|
153
149
|
}
|
154
150
|
}
|
155
151
|
}
|
156
|
-
[class
|
152
|
+
[class^=pb_timeline_item_step] {
|
157
153
|
@include flex_wrapper(row);
|
158
154
|
margin-top: $space_xs;
|
159
155
|
margin-bottom: $space_xs;
|
160
156
|
[class=pb_timeline_item_connector] {
|
161
|
-
@include pb_timeline_line_dotted_horizontal($connector_width, $connector_width,
|
157
|
+
@include pb_timeline_line_dotted_horizontal($connector_width, $connector_width, 0 $icon_margin 0 $icon_margin );
|
162
158
|
}
|
163
159
|
}
|
164
160
|
}
|
@@ -170,7 +166,7 @@ $gap_lg: $height_from_top + $space_lg;
|
|
170
166
|
align-items: flex-start;
|
171
167
|
align-self: auto;
|
172
168
|
>div:last-child {
|
173
|
-
[class
|
169
|
+
[class^=pb_timeline_item_step] {
|
174
170
|
[class=pb_timeline_item_connector] {
|
175
171
|
opacity: 0;
|
176
172
|
}
|
@@ -180,13 +176,14 @@ $gap_lg: $height_from_top + $space_lg;
|
|
180
176
|
@include flex_wrapper(row);
|
181
177
|
&[class*=_solid] {
|
182
178
|
flex-basis: 100%;
|
183
|
-
[class
|
179
|
+
[class^=pb_timeline_item_step] {
|
184
180
|
@include flex_wrapper(column);
|
181
|
+
align-items: center;
|
185
182
|
align-content: flex-start;
|
186
183
|
margin-right: $space_sm;
|
187
184
|
margin-left: $space_sm;
|
188
185
|
[class=pb_timeline_item_connector] {
|
189
|
-
@include pb_timeline_line_solid($connector_width, $connector_width, $icon_margin 0 $icon_margin
|
186
|
+
@include pb_timeline_line_solid($connector_width, $connector_width, $icon_margin 0 $icon_margin 0);
|
190
187
|
}
|
191
188
|
}
|
192
189
|
[class=pb_timeline_item_left_block] {
|
@@ -200,12 +197,13 @@ $gap_lg: $height_from_top + $space_lg;
|
|
200
197
|
}
|
201
198
|
&[class*=_dotted] {
|
202
199
|
flex-basis: 100%;
|
203
|
-
[class
|
200
|
+
[class^=pb_timeline_item_step] {
|
204
201
|
@include flex_wrapper(column);
|
202
|
+
align-items: center;
|
205
203
|
margin-right: $space_sm;
|
206
204
|
margin-left: $space_sm;
|
207
205
|
[class=pb_timeline_item_connector] {
|
208
|
-
@include pb_timeline_line_dotted_vertical($connector_width, $connector_width, $icon_margin 0 $icon_margin
|
206
|
+
@include pb_timeline_line_dotted_vertical($connector_width, $connector_width, $icon_margin 0 $icon_margin 0);
|
209
207
|
}
|
210
208
|
}
|
211
209
|
[class=pb_timeline_item_left_block] {
|
@@ -223,7 +221,7 @@ $gap_lg: $height_from_top + $space_lg;
|
|
223
221
|
align-items: flex-start;
|
224
222
|
align-self: auto;
|
225
223
|
>div:last-child {
|
226
|
-
[class
|
224
|
+
[class^=pb_timeline_item_step] {
|
227
225
|
[class=pb_timeline_item_connector] {
|
228
226
|
opacity: 0;
|
229
227
|
}
|
@@ -233,13 +231,14 @@ $gap_lg: $height_from_top + $space_lg;
|
|
233
231
|
@include flex_wrapper(row);
|
234
232
|
&[class*=_solid] {
|
235
233
|
flex-basis: 100%;
|
236
|
-
[class
|
234
|
+
[class^=pb_timeline_item_step] {
|
237
235
|
@include flex_wrapper(column);
|
236
|
+
align-items: center;
|
238
237
|
align-content: flex-start;
|
239
238
|
margin-right: $space_sm;
|
240
239
|
margin-left: $space_sm;
|
241
240
|
[class=pb_timeline_item_connector] {
|
242
|
-
@include pb_timeline_line_solid($connector_width, $connector_width, $icon_margin 0 $icon_margin
|
241
|
+
@include pb_timeline_line_solid($connector_width, $connector_width, $icon_margin 0 $icon_margin 0);
|
243
242
|
}
|
244
243
|
}
|
245
244
|
[class=pb_timeline_item_left_block] {
|
@@ -253,12 +252,13 @@ $gap_lg: $height_from_top + $space_lg;
|
|
253
252
|
}
|
254
253
|
&[class*=_dotted] {
|
255
254
|
flex-basis: 100%;
|
256
|
-
[class
|
255
|
+
[class^=pb_timeline_item_step] {
|
257
256
|
@include flex_wrapper(column);
|
257
|
+
align-items: center;
|
258
258
|
margin-right: $space_sm;
|
259
259
|
margin-left: $space_sm;
|
260
260
|
[class=pb_timeline_item_connector] {
|
261
|
-
@include pb_timeline_line_dotted_vertical($connector_width, $connector_width, $icon_margin 0 $icon_margin
|
261
|
+
@include pb_timeline_line_dotted_vertical($connector_width, $connector_width, $icon_margin 0 $icon_margin 0);
|
262
262
|
}
|
263
263
|
}
|
264
264
|
[class=pb_timeline_item_left_block] {
|
@@ -274,7 +274,7 @@ $gap_lg: $height_from_top + $space_lg;
|
|
274
274
|
}
|
275
275
|
&[class*=_gap_xs] {
|
276
276
|
[class*=pb_timeline_item_kit] {
|
277
|
-
[class
|
277
|
+
[class^=pb_timeline_item_step] {
|
278
278
|
[class=pb_timeline_item_connector] {
|
279
279
|
height: $gap_xs !important;
|
280
280
|
}
|
@@ -283,7 +283,7 @@ $gap_lg: $height_from_top + $space_lg;
|
|
283
283
|
}
|
284
284
|
&[class*=_gap_sm] {
|
285
285
|
[class*=pb_timeline_item_kit] {
|
286
|
-
[class
|
286
|
+
[class^=pb_timeline_item_step] {
|
287
287
|
[class=pb_timeline_item_connector] {
|
288
288
|
height: $gap_sm !important;
|
289
289
|
}
|
@@ -292,7 +292,7 @@ $gap_lg: $height_from_top + $space_lg;
|
|
292
292
|
}
|
293
293
|
&[class*=_gap_md] {
|
294
294
|
[class*=pb_timeline_item_kit] {
|
295
|
-
[class
|
295
|
+
[class^=pb_timeline_item_step] {
|
296
296
|
[class=pb_timeline_item_connector] {
|
297
297
|
height: $gap_md !important;
|
298
298
|
}
|
@@ -301,7 +301,7 @@ $gap_lg: $height_from_top + $space_lg;
|
|
301
301
|
}
|
302
302
|
&[class*=_gap_lg] {
|
303
303
|
[class*=pb_timeline_item_kit] {
|
304
|
-
[class
|
304
|
+
[class^=pb_timeline_item_step] {
|
305
305
|
[class=pb_timeline_item_connector] {
|
306
306
|
height: $gap_lg !important;
|
307
307
|
}
|
@@ -42,8 +42,8 @@ type TypeaheadProps = {
|
|
42
42
|
id?: string,
|
43
43
|
label?: string,
|
44
44
|
loadOptions?: string | Noop,
|
45
|
-
getOptionLabel?: string | (() =>
|
46
|
-
getOptionValue?: string | (() =>
|
45
|
+
getOptionLabel?: string | (() => string),
|
46
|
+
getOptionValue?: string | (() => string),
|
47
47
|
name?: string,
|
48
48
|
marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
49
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",
|
@@ -109,6 +109,7 @@ const Typeahead = ({
|
|
109
109
|
multiKit: '',
|
110
110
|
onCreateOption: null as null,
|
111
111
|
plusIcon: false,
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
112
113
|
onMultiValueClick: (_option: SelectValueType): any => undefined,
|
113
114
|
pillColor: pillColor,
|
114
115
|
...props,
|
@@ -1,16 +1,24 @@
|
|
1
1
|
import React, { useEffect } from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
4
|
+
type ClearContainerProps = {
|
5
|
+
children: React.ReactNode,
|
6
|
+
selectProps?: {
|
7
|
+
id: string,
|
8
|
+
},
|
9
|
+
clearValue: () => void,
|
10
|
+
}
|
11
|
+
|
12
|
+
const ClearContainer = (props: ClearContainerProps): React.ReactElement => {
|
5
13
|
const { selectProps, clearValue } = props
|
6
14
|
useEffect(() => {
|
7
15
|
document.addEventListener(`pb-typeahead-kit-${selectProps.id}:clear`, clearValue)
|
8
|
-
}, [
|
16
|
+
}, [clearValue, selectProps.id])
|
9
17
|
|
10
18
|
return (
|
11
19
|
<components.ClearIndicator
|
12
|
-
|
13
|
-
|
20
|
+
className="clear_indicator"
|
21
|
+
{...props}
|
14
22
|
/>
|
15
23
|
)
|
16
24
|
}
|
@@ -5,7 +5,11 @@ import Flex from '../../pb_flex/_flex'
|
|
5
5
|
import TextInput from '../../pb_text_input/_text_input'
|
6
6
|
|
7
7
|
type Props = {
|
8
|
-
|
8
|
+
selectProps: {
|
9
|
+
dark?: boolean,
|
10
|
+
label: string,
|
11
|
+
error?: string,
|
12
|
+
},
|
9
13
|
}
|
10
14
|
|
11
15
|
const TypeaheadControl = (props: Props) => (
|
@@ -1,10 +1,15 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
4
|
+
type IndicatorsContainerProps = {
|
5
|
+
children: React.ReactNode,
|
6
|
+
}
|
7
|
+
|
8
|
+
|
9
|
+
const IndicatorsContainer = (props: IndicatorsContainerProps): React.ReactElement => (
|
5
10
|
<components.IndicatorsContainer
|
6
|
-
|
7
|
-
|
11
|
+
className="text_input_indicators"
|
12
|
+
{...props}
|
8
13
|
/>
|
9
14
|
)
|
10
15
|
|
@@ -1,7 +1,12 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
4
|
+
type MenuListProps = {
|
5
|
+
children: React.ReactNode,
|
6
|
+
footer: React.ReactNode,
|
7
|
+
}
|
8
|
+
|
9
|
+
const MenuList = (props: MenuListProps): React.ReactElement => {
|
5
10
|
return (
|
6
11
|
<components.MenuList {...props}>
|
7
12
|
{props.children}
|
@@ -3,7 +3,22 @@ import { components } from 'react-select'
|
|
3
3
|
|
4
4
|
import User from '../../pb_user/_user'
|
5
5
|
|
6
|
-
|
6
|
+
type OptionProps = {
|
7
|
+
children: React.ReactNode,
|
8
|
+
label?: string,
|
9
|
+
data: {
|
10
|
+
imageUrl?: string,
|
11
|
+
},
|
12
|
+
selectProps: {
|
13
|
+
dark?: boolean,
|
14
|
+
valueComponent?: (data: {
|
15
|
+
imageUrl?: string,
|
16
|
+
}) => React.ReactNode,
|
17
|
+
},
|
18
|
+
}
|
19
|
+
|
20
|
+
|
21
|
+
const Option = (props: OptionProps): React.ReactElement => {
|
7
22
|
const {
|
8
23
|
imageUrl,
|
9
24
|
} = props.data
|
@@ -14,11 +29,11 @@ const Option = (props: any) => {
|
|
14
29
|
<>
|
15
30
|
{!valueComponent && imageUrl &&
|
16
31
|
<User
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
32
|
+
align="left"
|
33
|
+
avatarUrl={imageUrl}
|
34
|
+
dark={props.selectProps.dark}
|
35
|
+
name={props.label}
|
36
|
+
orientation="horizontal"
|
22
37
|
/>
|
23
38
|
}
|
24
39
|
|
@@ -4,19 +4,26 @@ import { components } from 'react-select'
|
|
4
4
|
import Flex from '../../pb_flex/_flex'
|
5
5
|
import Icon from '../../pb_icon/_icon'
|
6
6
|
|
7
|
-
|
7
|
+
type PlaceholderProps = {
|
8
|
+
children: React.ReactNode,
|
9
|
+
selectProps: {
|
10
|
+
plusIcon?: boolean,
|
11
|
+
},
|
12
|
+
}
|
13
|
+
|
14
|
+
const Placeholder = (props: PlaceholderProps): React.ReactElement => (
|
8
15
|
<>
|
9
16
|
<Flex
|
10
|
-
|
11
|
-
|
17
|
+
align="center"
|
18
|
+
className="placeholder"
|
12
19
|
>
|
13
20
|
<components.IndicatorsContainer
|
14
|
-
|
21
|
+
{...props}
|
15
22
|
/>
|
16
23
|
{props.selectProps.plusIcon &&
|
17
24
|
<Icon
|
18
|
-
|
19
|
-
|
25
|
+
className="typeahead-plus-icon"
|
26
|
+
icon="plus"
|
20
27
|
/>
|
21
28
|
}
|
22
29
|
</Flex>
|
@@ -1,10 +1,14 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
4
|
+
type ValueContainerProps = {
|
5
|
+
children: React.ReactNode,
|
6
|
+
}
|
7
|
+
|
8
|
+
const ValueContainer = (props: ValueContainerProps): React.ReactElement => (
|
5
9
|
<components.ValueContainer
|
6
|
-
|
7
|
-
|
10
|
+
className="text_input_value_container"
|
11
|
+
{...props}
|
8
12
|
/>
|
9
13
|
)
|
10
14
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%
|
2
|
+
names = [
|
3
|
+
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
4
|
+
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
|
5
|
+
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
|
6
|
+
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
|
7
|
+
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
|
8
|
+
]
|
9
|
+
%>
|
10
|
+
|
11
|
+
<%= pb_rails("typeahead", props: {
|
12
|
+
html_options: { style: { maxWidth: "240px" }},
|
13
|
+
id: "typeahead-form-pill",
|
14
|
+
is_multi: true,
|
15
|
+
options: names,
|
16
|
+
label: "Truncation Within Typeahead",
|
17
|
+
pills: true,
|
18
|
+
truncate: 1,
|
19
|
+
}) %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Typeahead } from 'playbook-ui'
|
3
|
+
|
4
|
+
const names = [
|
5
|
+
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
6
|
+
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
|
7
|
+
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
|
8
|
+
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
|
9
|
+
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
|
10
|
+
]
|
11
|
+
|
12
|
+
const TypeaheadTruncatedText = (props) => {
|
13
|
+
return (
|
14
|
+
<>
|
15
|
+
<Typeahead
|
16
|
+
htmlOptions={{ style: { maxWidth: "240px" }}}
|
17
|
+
isMulti
|
18
|
+
label="Truncation Within Typeahead"
|
19
|
+
options={names}
|
20
|
+
truncate={1}
|
21
|
+
{...props}
|
22
|
+
/>
|
23
|
+
</>
|
24
|
+
)
|
25
|
+
}
|
26
|
+
|
27
|
+
export default TypeaheadTruncatedText
|
@@ -0,0 +1 @@
|
|
1
|
+
For Form Pills with longer text, the `truncate` global prop can be used to truncate the label within each Form Pill. Hover over the truncated Form Pill and a Tooltip containing the text or tag section of the Form Pill will appear. See [here](https://playbook.powerapp.cloud/visual_guidelines/truncate) for more information on the truncate global prop.
|
@@ -45,8 +45,7 @@ const promiseOptions = (inputValue) =>
|
|
45
45
|
|
46
46
|
const TypeaheadWithPillsAsync = (props) => {
|
47
47
|
const [users, setUsers] = useState([])
|
48
|
-
|
49
|
-
const formatValue = (users) => formatUsers(users)
|
48
|
+
|
50
49
|
const formatUsers = (users) => {
|
51
50
|
const results = () => (users.map((user) => {
|
52
51
|
if (Object.keys(user)[0] === 'name' || Object.keys(user)[1] === 'id'){
|
@@ -58,6 +57,9 @@ const TypeaheadWithPillsAsync = (props) => {
|
|
58
57
|
return results()
|
59
58
|
}
|
60
59
|
|
60
|
+
const handleOnChange = (value) => setUsers(formatUsers(value))
|
61
|
+
const formatValue = (users) => formatUsers(users)
|
62
|
+
|
61
63
|
return (
|
62
64
|
<>
|
63
65
|
{users && users.length > 0 && (
|
@@ -83,13 +83,13 @@ const TypeaheadWithPillsAsyncCustomOptions = (props) => {
|
|
83
83
|
onChange={handleOnChange}
|
84
84
|
onMultiValueClick={handleOnMultiValueClick}
|
85
85
|
placeholder="type the name of a Github user"
|
86
|
-
valueComponent={(
|
86
|
+
valueComponent={({imageUrl, label, territory, type}) => (
|
87
87
|
<User
|
88
88
|
avatar
|
89
|
-
avatarUrl={
|
90
|
-
name={
|
91
|
-
territory={
|
92
|
-
title={
|
89
|
+
avatarUrl={imageUrl}
|
90
|
+
name={label}
|
91
|
+
territory={territory}
|
92
|
+
title={type}
|
93
93
|
/>
|
94
94
|
)}
|
95
95
|
{...props}
|
@@ -11,6 +11,7 @@ examples:
|
|
11
11
|
- typeahead_error_state: Error State
|
12
12
|
- typeahead_margin_bottom: Margin Bottom
|
13
13
|
- typeahead_with_pills_color: With Pills (Custom Color)
|
14
|
+
- typeahead_truncated_text: Truncated Text
|
14
15
|
|
15
16
|
react:
|
16
17
|
- typeahead_default: Default
|
@@ -27,3 +28,4 @@ examples:
|
|
27
28
|
- typeahead_custom_menu_list: Custom MenuList
|
28
29
|
- typeahead_margin_bottom: Margin Bottom
|
29
30
|
- typeahead_with_pills_color: With Pills (Custom Color)
|
31
|
+
- typeahead_truncated_text: Truncated Text
|
@@ -12,3 +12,4 @@ export { default as TypeaheadErrorState } from './_typeahead_error_state.jsx'
|
|
12
12
|
export { default as TypeaheadCustomMenuList } from './_typeahead_custom_menu_list.jsx'
|
13
13
|
export { default as TypeaheadMarginBottom } from './_typeahead_margin_bottom.jsx'
|
14
14
|
export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_color.jsx'
|
15
|
+
export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.jsx'
|