playbook_ui 14.11.0 → 14.11.1.pre.alpha.PBNTR440enableglobalpropspbformwith5624
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_avatar_action_button/_avatar_action_button.scss +9 -11
- data/app/pb_kits/playbook/pb_badge/_badge.scss +2 -4
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.scss +1 -3
- data/app/pb_kits/playbook/pb_button/_button.scss +1 -3
- 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_circle_icon_button/_circle_icon_button.scss +2 -4
- 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_date_picker/sass_partials/_input_styles.scss +1 -3
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss +3 -5
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.scss +4 -6
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +2 -4
- 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/_dropdown.scss +8 -10
- 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_form_pill/_form_pill.scss +4 -6
- 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_icon_circle/_icon_circle.scss +1 -3
- data/app/pb_kits/playbook/pb_label_value/_label_value.scss +2 -4
- 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_message/_message_mixins.scss +1 -3
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +5 -3
- 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_passphrase/_passphrase.scss +3 -5
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +8 -10
- 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_pill/_pill.scss +2 -4
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.scss +2 -4
- 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_rich_text_editor/_rich_text_editor.scss +2 -4
- data/app/pb_kits/playbook/pb_select/_select.scss +6 -10
- 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_card/_selectable_card.scss +3 -5
- 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/_text_input.scss +1 -3
- 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_textarea/_textarea.scss +1 -3
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.scss +4 -5
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +32 -34
- data/app/pb_kits/playbook/pb_toggle/_toggle.scss +3 -5
- 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/pb_forms_global_props_helper.rb +136 -0
- data/lib/playbook/pb_forms_helper.rb +13 -4
- data/lib/playbook/version.rb +2 -2
- metadata +67 -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
@@ -0,0 +1,78 @@
|
|
1
|
+
$icon_colors: (
|
2
|
+
default: $text_lt_default,
|
3
|
+
link: $primary_action
|
4
|
+
);
|
5
|
+
|
6
|
+
@mixin icon_button_variant($variant) {
|
7
|
+
.icon_button_icon {
|
8
|
+
color: map-get($icon_colors, $variant);
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
.pb_icon_button_kit_default,
|
13
|
+
.pb_icon_button_kit_link {
|
14
|
+
width: fit-content;
|
15
|
+
height: fit-content;
|
16
|
+
|
17
|
+
&:hover {
|
18
|
+
[class*="pb_button_kit"] {
|
19
|
+
background-color: $bg_light;
|
20
|
+
}
|
21
|
+
.icon_button_icon {
|
22
|
+
color: $primary_action;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
&:active {
|
27
|
+
[class*="pb_button_kit"] {
|
28
|
+
background-color: $bg_light;
|
29
|
+
}
|
30
|
+
.icon_button_icon {
|
31
|
+
color: $primary_action;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
&:hover:active {
|
36
|
+
[class*="pb_button_kit"] {
|
37
|
+
background-color: $bg_light;
|
38
|
+
}
|
39
|
+
.icon_button_icon {
|
40
|
+
color: $text_lt_default;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
&:focus {
|
45
|
+
outline: 2px solid $primary_action;
|
46
|
+
border-radius: 8px;
|
47
|
+
}
|
48
|
+
|
49
|
+
[class*="pb_button_kit"] {
|
50
|
+
min-height: 0;
|
51
|
+
background: none;
|
52
|
+
position: relative;
|
53
|
+
display: flex;
|
54
|
+
justify-content: center;
|
55
|
+
align-items: center;
|
56
|
+
flex-shrink: 0;
|
57
|
+
flex-grow: 0;
|
58
|
+
width: fit-content;
|
59
|
+
height: fit-content;
|
60
|
+
line-height: normal;
|
61
|
+
flex-basis: auto;
|
62
|
+
min-width: 0;
|
63
|
+
padding: 0;
|
64
|
+
|
65
|
+
.icon_button_icon {
|
66
|
+
display: block;
|
67
|
+
vertical-align: middle;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
.pb_icon_button_kit_default {
|
73
|
+
@include icon_button_variant(default);
|
74
|
+
}
|
75
|
+
|
76
|
+
.pb_icon_button_kit_link {
|
77
|
+
@include icon_button_variant(link);
|
78
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= pb_content_tag do %>
|
2
|
+
<%= pb_rails("button", props: { type: object.type,
|
3
|
+
link: object.link,
|
4
|
+
new_window:object.new_window,
|
5
|
+
target: object.target,
|
6
|
+
dark: object.dark,
|
7
|
+
border_radius: "lg" }) do %>
|
8
|
+
<%= pb_rails("icon", props: { icon: object.icon,
|
9
|
+
fixed_width: true,
|
10
|
+
dark: object.dark,
|
11
|
+
size: "2x",
|
12
|
+
color: "text_lt_default",
|
13
|
+
classname: "icon_button_icon",
|
14
|
+
padding_x: "xxs", padding_y: "xs" }) %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbIconButton
|
5
|
+
class IconButton < ::Playbook::KitBase
|
6
|
+
prop :type, type: Playbook::Props::Enum,
|
7
|
+
values: %w[button submit reset],
|
8
|
+
default: "button"
|
9
|
+
prop :icon, required: false, default: "bars"
|
10
|
+
prop :link
|
11
|
+
prop :new_window, type: Playbook::Props::Boolean,
|
12
|
+
default: false
|
13
|
+
prop :target
|
14
|
+
prop :variant, type: Playbook::Props::Enum,
|
15
|
+
values: %w[default link],
|
16
|
+
default: "default"
|
17
|
+
def classname
|
18
|
+
generate_classname("pb_icon_button_kit", variant)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
@use "sass:math";
|
2
|
-
|
3
1
|
@import "../tokens/border_radius";
|
4
2
|
@import "../tokens/colors";
|
5
3
|
@import "../tokens/typography";
|
@@ -46,7 +44,7 @@ $pb_icon_circle_sizes: (
|
|
46
44
|
&[class*=_size_#{$name}] {
|
47
45
|
width: $size;
|
48
46
|
height: $size;
|
49
|
-
border-radius:
|
47
|
+
border-radius: $size/2;
|
50
48
|
background: $silver;
|
51
49
|
color: $text_lt_light;
|
52
50
|
font-size: if($name == "xxs", $size - 6px, $size * 0.38);
|
@@ -1,10 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
<% if object.draggable? %>
|
2
|
+
<%= pb_rails("draggable/draggable_item", props:{drag_id: object.drag_id}) do %>
|
3
|
+
<%= content_tag(:li,
|
4
|
+
aria: object.aria,
|
5
|
+
class: object.classname,
|
6
|
+
data: object.data,
|
7
|
+
id: object.id,
|
8
|
+
tabindex: object.tabindex,
|
9
|
+
**combined_html_options
|
10
|
+
) do %>
|
11
|
+
<% if object.drag_handle %>
|
12
|
+
<span style="vertical-align: middle;">
|
13
|
+
<%= pb_rails("body") do %>
|
14
|
+
<svg width="auto" height="auto" viewBox="0 0 31 25" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor" class="pb_custom_icon svg-inline--fa vertical_align_middle svg_fw"><path d="M12.904 6.355a1.48 1.48 0 01-1.5-1.5c0-.796.656-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5 0 .844-.703 1.5-1.5 1.5zm0 7.5a1.48 1.48 0 01-1.5-1.5c0-.796.656-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5 0 .844-.703 1.5-1.5 1.5zm1.5 6c0 .844-.703 1.5-1.5 1.5a1.48 1.48 0 01-1.5-1.5c0-.796.656-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5zm4.5-13.5a1.48 1.48 0 01-1.5-1.5c0-.796.657-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5 0 .844-.703 1.5-1.5 1.5zm1.5 6c0 .844-.703 1.5-1.5 1.5a1.48 1.48 0 01-1.5-1.5c0-.796.657-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5zm-1.5 9a1.48 1.48 0 01-1.5-1.5c0-.796.657-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5 0 .844-.703 1.5-1.5 1.5z" fill="#242B42"></path></svg>
|
15
|
+
<% end %>
|
16
|
+
</span>
|
17
|
+
<% end %>
|
18
|
+
<%= content.presence %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
<% else %>
|
22
|
+
<%= content_tag(:li,
|
23
|
+
aria: object.aria,
|
24
|
+
class: object.classname,
|
25
|
+
data: object.data,
|
26
|
+
id: object.id,
|
27
|
+
tabindex: object.tabindex,
|
28
|
+
**combined_html_options
|
29
|
+
) do %>
|
9
30
|
<%= content.presence %>
|
31
|
+
<% end %>
|
10
32
|
<% end %>
|
@@ -3,11 +3,18 @@
|
|
3
3
|
module Playbook
|
4
4
|
module PbList
|
5
5
|
class Item < Playbook::KitBase
|
6
|
+
prop :drag_handle, type: Playbook::Props::Boolean,
|
7
|
+
default: true
|
8
|
+
prop :drag_id, type: Playbook::Props::String
|
6
9
|
prop :tabindex
|
7
10
|
|
8
11
|
def classname
|
9
12
|
generate_classname("pb_item_kit")
|
10
13
|
end
|
14
|
+
|
15
|
+
def draggable?
|
16
|
+
drag_id.present?
|
17
|
+
end
|
11
18
|
end
|
12
19
|
end
|
13
20
|
end
|
@@ -1,13 +1,33 @@
|
|
1
|
-
|
2
|
-
<%=
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
<% if object.enable_drag %>
|
2
|
+
<%= pb_rails("draggable", props: {initial_items: object.items}) do %>
|
3
|
+
<%= pb_rails("draggable/draggable_container") do %>
|
4
|
+
<%= content_tag(:div, class: object.list_classname) do %>
|
5
|
+
<%= content_tag(:"#{object.ordered_class}",
|
6
|
+
aria: object.aria,
|
7
|
+
class: object.classname,
|
8
|
+
data: object.data,
|
9
|
+
id: object.id,
|
10
|
+
role: object.role,
|
11
|
+
tabindex: object.tabindex,
|
12
|
+
**combined_html_options
|
13
|
+
) do %>
|
14
|
+
<%= content.presence %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
19
|
+
<% else %>
|
20
|
+
<%= content_tag(:div, class: object.list_classname) do %>
|
21
|
+
<%= content_tag(:"#{object.ordered_class}",
|
22
|
+
aria: object.aria,
|
23
|
+
class: object.classname,
|
24
|
+
data: object.data,
|
25
|
+
id: object.id,
|
26
|
+
role: object.role,
|
27
|
+
tabindex: object.tabindex,
|
28
|
+
**combined_html_options
|
29
|
+
) do %>
|
30
|
+
<%= content.presence %>
|
31
|
+
<% end %>
|
12
32
|
<% end %>
|
13
33
|
<% end %>
|
@@ -7,6 +7,10 @@ module Playbook
|
|
7
7
|
default: false
|
8
8
|
prop :dark, type: Playbook::Props::Boolean,
|
9
9
|
default: false
|
10
|
+
prop :enable_drag, type: Playbook::Props::Boolean,
|
11
|
+
default: false
|
12
|
+
prop :items, type: Playbook::Props::Array,
|
13
|
+
default: []
|
10
14
|
prop :layout, type: Playbook::Props::Enum,
|
11
15
|
values: ["left", "right", ""],
|
12
16
|
default: ""
|
@@ -12,6 +12,7 @@ type LoadingInlineProps = {
|
|
12
12
|
aria?: { [key: string]: string },
|
13
13
|
className?: string,
|
14
14
|
data?: { [key: string]: string },
|
15
|
+
dark?: boolean,
|
15
16
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
16
17
|
id?: string,
|
17
18
|
text?: string,
|
@@ -23,6 +24,7 @@ const LoadingInline = (props: LoadingInlineProps) => {
|
|
23
24
|
aria = {},
|
24
25
|
className,
|
25
26
|
data = {},
|
27
|
+
dark = false,
|
26
28
|
htmlOptions = {},
|
27
29
|
id,
|
28
30
|
text = ' Loading',
|
@@ -45,7 +47,10 @@ const LoadingInline = (props: LoadingInlineProps) => {
|
|
45
47
|
className={classes}
|
46
48
|
id={id}
|
47
49
|
>
|
48
|
-
<Body
|
50
|
+
<Body
|
51
|
+
color="light"
|
52
|
+
dark={dark}
|
53
|
+
>
|
49
54
|
<Icon
|
50
55
|
aria={{ label: 'loading icon' }}
|
51
56
|
fixedWidth
|
@@ -1,5 +1,3 @@
|
|
1
|
-
@use "sass:math";
|
2
|
-
|
3
1
|
@import "../tokens/colors";
|
4
2
|
@import "../utilities/colors";
|
5
3
|
@import "../tokens/opacity";
|
@@ -20,12 +18,16 @@ $pb_multiple_users_size_xxs: map-get($avatar-sizes, "xxs");
|
|
20
18
|
justify-content: center;
|
21
19
|
width: $pb_multiple_users_size;
|
22
20
|
height: $pb_multiple_users_size;
|
23
|
-
border-radius:
|
21
|
+
border-radius: $pb_multiple_users_size / 2 + 2;
|
24
22
|
background: tint($primary, 90%);
|
25
23
|
border: $pb_multiple_users_border_size solid $white;
|
26
24
|
color: $primary;
|
27
25
|
font-weight: $bold;
|
28
26
|
font-size: $font_smallest - 1;
|
27
|
+
|
28
|
+
&.dark {
|
29
|
+
border: $pb_multiple_users_border_size solid $bg_dark;
|
30
|
+
}
|
29
31
|
}
|
30
32
|
|
31
33
|
.multiple_users_badge_xxs {
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<% end %>
|
5
5
|
|
6
6
|
<% if object.more_than_four %>
|
7
|
-
<div class="pb_multiple_users_item multiple_users_badge_<%= object.size %>">
|
7
|
+
<div class="pb_multiple_users_item multiple_users_badge_<%= object.size %><%= object.dark ? " dark" : "" %>">
|
8
8
|
<%= "+#{object.users.count - object.display_count}" %>
|
9
9
|
</div>
|
10
10
|
<% end %>
|
@@ -1,5 +1,3 @@
|
|
1
|
-
@use "sass:math";
|
2
|
-
|
3
1
|
@import "../tokens/colors";
|
4
2
|
@import "../tokens/spacing";
|
5
3
|
@import "../tokens/screen_sizes";
|
@@ -23,14 +21,14 @@
|
|
23
21
|
}
|
24
22
|
|
25
23
|
.passphrase-label {
|
26
|
-
margin-right:
|
24
|
+
margin-right: $space_xs / 2;
|
27
25
|
}
|
28
26
|
|
29
27
|
.passphrase-text-input-wrapper {
|
30
28
|
position: relative;
|
31
29
|
|
32
30
|
.pb_text_input_kit_label {
|
33
|
-
margin-bottom:
|
31
|
+
margin-bottom: $space_xs / 2;
|
34
32
|
}
|
35
33
|
|
36
34
|
.passphrase-text-input input {
|
@@ -59,7 +57,7 @@
|
|
59
57
|
}
|
60
58
|
|
61
59
|
.pb_progress_simple_wrapper, .pb_progress_simple_wrapper_dark {
|
62
|
-
margin-bottom:
|
60
|
+
margin-bottom: $space_xs/2;
|
63
61
|
|
64
62
|
&.progress-empty-input {
|
65
63
|
visibility: hidden;
|
@@ -1,5 +1,3 @@
|
|
1
|
-
@use "sass:math";
|
2
|
-
|
3
1
|
@import "./intlTelInput";
|
4
2
|
@import "../tokens/colors";
|
5
3
|
|
@@ -41,7 +39,7 @@ $flag-min-resolution: 192dpi;
|
|
41
39
|
color: $charcoal;
|
42
40
|
}
|
43
41
|
|
44
|
-
// iti-spacer-horizontal's default is 8px, or $space_xs
|
42
|
+
// iti-spacer-horizontal's default is 8px, or $space_xs
|
45
43
|
.iti__country-list .iti__flag, .iti__country-name {
|
46
44
|
margin-right: $space_xs;
|
47
45
|
}
|
@@ -75,7 +73,7 @@ $flag-min-resolution: 192dpi;
|
|
75
73
|
}
|
76
74
|
|
77
75
|
.iti__divider {
|
78
|
-
border-bottom: 1px solid $border_light !important;
|
76
|
+
border-bottom: 1px solid $border_light !important;
|
79
77
|
}
|
80
78
|
|
81
79
|
.iti__selected-country-primary {
|
@@ -95,7 +93,7 @@ $flag-min-resolution: 192dpi;
|
|
95
93
|
justify-content: center;
|
96
94
|
align-items: center;
|
97
95
|
border-width: 0;
|
98
|
-
border-radius: $space_xxs;
|
96
|
+
border-radius: $space_xxs;
|
99
97
|
|
100
98
|
&[aria-expanded="true"] {
|
101
99
|
color: $primary_action;
|
@@ -165,7 +163,7 @@ $flag-min-resolution: 192dpi;
|
|
165
163
|
}
|
166
164
|
|
167
165
|
.iti__arrow.iti__arrow--up::before {
|
168
|
-
transform: rotate(-(
|
166
|
+
transform: rotate(-($transform-rotate-deg/3));
|
169
167
|
top: $space_xs + 4px;
|
170
168
|
color: $primary_action;
|
171
169
|
}
|
@@ -198,7 +196,7 @@ $flag-min-resolution: 192dpi;
|
|
198
196
|
}
|
199
197
|
|
200
198
|
.iti__dropdown-content {
|
201
|
-
border-radius: $space_xs;
|
199
|
+
border-radius: $space_xs;
|
202
200
|
border: 1px solid $border_light !important;
|
203
201
|
position: absolute;
|
204
202
|
top: 100%;
|
@@ -227,12 +225,12 @@ $flag-min-resolution: 192dpi;
|
|
227
225
|
}
|
228
226
|
|
229
227
|
.iti__dropdown-content {
|
230
|
-
border-radius: $space_xs;
|
228
|
+
border-radius: $space_xs;
|
231
229
|
border: 1px solid $border_dark !important;
|
232
230
|
}
|
233
231
|
|
234
232
|
.iti__divider {
|
235
|
-
border-bottom: 1px solid $border_dark !important;
|
233
|
+
border-bottom: 1px solid $border_dark !important;
|
236
234
|
}
|
237
235
|
|
238
236
|
.iti__country-list {
|
@@ -267,7 +265,7 @@ $flag-min-resolution: 192dpi;
|
|
267
265
|
color: $white;
|
268
266
|
}
|
269
267
|
}
|
270
|
-
|
268
|
+
|
271
269
|
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: $flag-min-resolution) {
|
272
270
|
.iti__flag {
|
273
271
|
background-image: url("https://unpkg.com/intl-tel-input@24.6.0/build/img/flags@2x.png");
|
@@ -35,6 +35,7 @@ type PhoneNumberInputProps = {
|
|
35
35
|
preferredCountries?: string[],
|
36
36
|
required?: boolean,
|
37
37
|
value?: string,
|
38
|
+
formatAsYouType?: boolean,
|
38
39
|
}
|
39
40
|
|
40
41
|
enum ValidationError {
|
@@ -87,6 +88,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
87
88
|
required = false,
|
88
89
|
preferredCountries = [],
|
89
90
|
value = "",
|
91
|
+
formatAsYouType = false,
|
90
92
|
} = props
|
91
93
|
|
92
94
|
const ariaProps = buildAriaProps(aria)
|
@@ -99,8 +101,8 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
99
101
|
)
|
100
102
|
|
101
103
|
const inputRef = useRef<HTMLInputElement>()
|
104
|
+
const itiRef = useRef<any>(null);
|
102
105
|
const [inputValue, setInputValue] = useState(value)
|
103
|
-
const [itiInit, setItiInit] = useState<any>()
|
104
106
|
const [error, setError] = useState(props.error)
|
105
107
|
const [dropDownIsOpen, setDropDownIsOpen] = useState(false)
|
106
108
|
const [selectedData, setSelectedData] = useState()
|
@@ -130,8 +132,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
130
132
|
}
|
131
133
|
})
|
132
134
|
|
135
|
+
const unformatNumber = (formattedNumber: any) => {
|
136
|
+
return formattedNumber.replace(/\D/g, "")
|
137
|
+
}
|
138
|
+
|
133
139
|
const showFormattedError = (reason = '') => {
|
134
|
-
const countryName =
|
140
|
+
const countryName = itiRef.current.getSelectedCountryData().name
|
135
141
|
const reasonText = reason.length > 0 ? ` (${reason})` : ''
|
136
142
|
setError(`Invalid ${countryName} phone number${reasonText}`)
|
137
143
|
return true
|
@@ -189,12 +195,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
189
195
|
}
|
190
196
|
|
191
197
|
const validateErrors = () => {
|
192
|
-
if (
|
193
|
-
if (validateOnlyNumbers(
|
194
|
-
if (validateTooLongNumber(
|
195
|
-
if (validateTooShortNumber(
|
196
|
-
if (validateUnhandledError(
|
197
|
-
if (validateMissingAreaCode(
|
198
|
+
if (itiRef.current) isValid(itiRef.current.isValidNumber())
|
199
|
+
if (validateOnlyNumbers(itiRef.current)) return
|
200
|
+
if (validateTooLongNumber(itiRef.current)) return
|
201
|
+
if (validateTooShortNumber(itiRef.current)) return
|
202
|
+
if (validateUnhandledError(itiRef.current)) return
|
203
|
+
if (validateMissingAreaCode(itiRef.current)) return
|
198
204
|
}
|
199
205
|
|
200
206
|
const getCurrentSelectedData = (itiInit: any, inputValue: string) => {
|
@@ -203,10 +209,16 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
203
209
|
|
204
210
|
const handleOnChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
205
211
|
setInputValue(evt.target.value)
|
206
|
-
|
212
|
+
let phoneNumberData
|
213
|
+
if (formatAsYouType) {
|
214
|
+
const formattedPhoneNumberData = getCurrentSelectedData(itiRef.current, evt.target.value)
|
215
|
+
phoneNumberData = {...formattedPhoneNumberData, number: unformatNumber(formattedPhoneNumberData.number)}
|
216
|
+
} else {
|
217
|
+
phoneNumberData = getCurrentSelectedData(itiRef.current, evt.target.value)
|
218
|
+
}
|
207
219
|
setSelectedData(phoneNumberData)
|
208
220
|
onChange(phoneNumberData)
|
209
|
-
isValid(
|
221
|
+
isValid(itiRef.current.isValidNumber())
|
210
222
|
}
|
211
223
|
|
212
224
|
// Separating Concerns as React Docs Recommend
|
@@ -230,9 +242,11 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
230
242
|
onlyCountries,
|
231
243
|
countrySearch: false,
|
232
244
|
fixDropdownWidth: false,
|
233
|
-
formatAsYouType:
|
245
|
+
formatAsYouType: formatAsYouType,
|
234
246
|
})
|
235
247
|
|
248
|
+
itiRef.current = telInputInit;
|
249
|
+
|
236
250
|
inputRef.current.addEventListener("countrychange", (evt: Event) => {
|
237
251
|
const phoneNumberData = getCurrentSelectedData(telInputInit, (evt.target as HTMLInputElement).value)
|
238
252
|
setSelectedData(phoneNumberData)
|
@@ -243,7 +257,11 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
243
257
|
inputRef.current.addEventListener("open:countrydropdown", () => setDropDownIsOpen(true))
|
244
258
|
inputRef.current.addEventListener("close:countrydropdown", () => setDropDownIsOpen(false))
|
245
259
|
|
246
|
-
|
260
|
+
if (formatAsYouType) {
|
261
|
+
inputRef.current?.addEventListener("input", (evt) => {
|
262
|
+
handleOnChange(evt as unknown as React.ChangeEvent<HTMLInputElement>);
|
263
|
+
});
|
264
|
+
}
|
247
265
|
}, [])
|
248
266
|
|
249
267
|
let textInputProps: {[key: string]: any} = {
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= pb_rails("phone_number_input", props: {
|
2
|
+
id: "phone_number_input",
|
3
|
+
format_as_you_type: true
|
4
|
+
}) %>
|
5
|
+
|
6
|
+
<%= pb_rails("button", props: {id: "clickable", text: "Save Phone Number"}) %>
|
7
|
+
|
8
|
+
<%= javascript_tag do %>
|
9
|
+
document.querySelector('#clickable').addEventListener('click', () => {
|
10
|
+
const formattedPhoneNumber = document.querySelector('#phone_number_input').value
|
11
|
+
const unformattedPhoneNumber = formattedPhoneNumber.replace(/\D/g, "")
|
12
|
+
|
13
|
+
alert(`Formatted: ${formattedPhoneNumber}. Unformatted: ${unformattedPhoneNumber}`)
|
14
|
+
})
|
15
|
+
<% end %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { PhoneNumberInput, Body } from "playbook-ui";
|
3
|
+
|
4
|
+
const PhoneNumberInputFormat = (props) => {
|
5
|
+
const [phoneNumber, setPhoneNumber] = useState("");
|
6
|
+
|
7
|
+
const handleOnChange = ({ number }) => {
|
8
|
+
setPhoneNumber(number);
|
9
|
+
};
|
10
|
+
|
11
|
+
return (
|
12
|
+
<>
|
13
|
+
<PhoneNumberInput
|
14
|
+
formatAsYouType
|
15
|
+
id="format"
|
16
|
+
onChange={handleOnChange}
|
17
|
+
{...props}
|
18
|
+
/>
|
19
|
+
{phoneNumber && <Body>Unformatted number: {phoneNumber}</Body>}
|
20
|
+
</>
|
21
|
+
);
|
22
|
+
};
|
23
|
+
|
24
|
+
export default PhoneNumberInputFormat;
|
@@ -0,0 +1 @@
|
|
1
|
+
NOTE: the `number` in the React `onChange` event will not include formatting (no spaces, dashes, and parentheses). For Rails, the `value` will include formatting and its value must be sanitized manually.
|
@@ -8,10 +8,12 @@ examples:
|
|
8
8
|
- phone_number_input_validation: Form Validation
|
9
9
|
- phone_number_input_clear_field: Clearing the Input Field
|
10
10
|
- phone_number_input_access_input_element: Accessing the Input Element
|
11
|
+
- phone_number_input_format: Format as You Type
|
11
12
|
|
12
13
|
rails:
|
13
14
|
- phone_number_input_default: Default
|
14
15
|
- phone_number_input_preferred_countries: Preferred Countries
|
15
16
|
- phone_number_input_initial_country: Initial Country
|
16
17
|
- phone_number_input_only_countries: Limited Countries
|
17
|
-
- phone_number_input_validation: Form Validation
|
18
|
+
- phone_number_input_validation: Form Validation
|
19
|
+
- phone_number_input_format: Format as You Type
|
@@ -5,3 +5,4 @@ export { default as PhoneNumberInputOnlyCountries } from './_phone_number_input_
|
|
5
5
|
export { default as PhoneNumberInputValidation } from './_phone_number_input_validation'
|
6
6
|
export { default as PhoneNumberInputClearField } from './_phone_number_input_clear_field'
|
7
7
|
export { default as PhoneNumberInputAccessInputElement } from './_phone_number_input_access_input_element'
|
8
|
+
export { default as PhoneNumberInputFormat } from './_phone_number_input_format'
|
@@ -21,6 +21,8 @@ module Playbook
|
|
21
21
|
default: ""
|
22
22
|
prop :value, type: Playbook::Props::String,
|
23
23
|
default: ""
|
24
|
+
prop :format_as_you_type, type: Playbook::Props::Boolean,
|
25
|
+
default: false
|
24
26
|
|
25
27
|
def classname
|
26
28
|
generate_classname("pb_phone_number_input")
|
@@ -32,6 +34,7 @@ module Playbook
|
|
32
34
|
dark: dark,
|
33
35
|
disabled: disabled,
|
34
36
|
error: error,
|
37
|
+
formatAsYouType: format_as_you_type,
|
35
38
|
initialCountry: initial_country,
|
36
39
|
label: label,
|
37
40
|
name: name,
|