playbook_ui 13.19.0.pre.alpha.play1186collapsiblenaviconcolorbug2321 → 13.20.0.pre.alpha.PBNTR225advancedtablefeedback2375
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_advanced_table/Components/CustomCell.tsx +21 -19
- data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +6 -3
- data/app/pb_kits/playbook/pb_advanced_table/Components/SubRowHeaderRow.tsx +12 -8
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +14 -9
- data/app/pb_kits/playbook/pb_advanced_table/Components/ToggleIconButton.tsx +9 -5
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +14 -10
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +12 -8
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/types.ts +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +2 -9
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +82 -78
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +54 -54
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.jsx +7 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.jsx +7 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx +7 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.jsx +7 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.jsx +7 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort.jsx +7 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.jsx +7 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.jsx +7 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_options.jsx +7 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +7 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data.js +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data_inline_loading.js +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/_chrome_styles.scss +13 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents.md +7 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents_as_divs.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents_as_divs.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_table/styles/_striped.scss +2 -2
- data/app/pb_kits/playbook/pb_table/styles/_structure.scss +4 -2
- data/app/pb_kits/playbook/pb_table/table_body.html.erb +17 -0
- data/app/pb_kits/playbook/pb_table/table_body.rb +15 -0
- data/app/pb_kits/playbook/pb_table/table_cell.html.erb +17 -0
- data/app/pb_kits/playbook/pb_table/table_cell.rb +17 -0
- data/app/pb_kits/playbook/pb_table/table_head.html.erb +17 -0
- data/app/pb_kits/playbook/pb_table/table_head.rb +15 -0
- data/app/pb_kits/playbook/pb_table/table_header.html.erb +49 -39
- data/app/pb_kits/playbook/pb_table/table_header.rb +8 -1
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +17 -7
- data/app/pb_kits/playbook/pb_table/table_row.rb +8 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +9 -5
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on.jsx +20 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_presence_indicator_swift.md +30 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_props_table.md +2 -1
- data/app/pb_kits/playbook/pb_user/docs/example.yml +1 -0
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +14 -2
@@ -0,0 +1,34 @@
|
|
1
|
+
<%= pb_rails("table", props: { size: "sm" }) do %>
|
2
|
+
<%= pb_rails("table/table_head") do %>
|
3
|
+
<%= pb_rails("table/table_row") do %>
|
4
|
+
<%= pb_rails("table/table_header", props: { text: "Column 1"}) %>
|
5
|
+
<%= pb_rails("table/table_header", props: { text: "Column 2"}) %>
|
6
|
+
<%= pb_rails("table/table_header", props: { text: "Column 3"}) %>
|
7
|
+
<%= pb_rails("table/table_header", props: { text: "Column 4"}) %>
|
8
|
+
<%= pb_rails("table/table_header", props: { text: "Column 5"}) %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<%= pb_rails("table/table_body") do %>
|
12
|
+
<%= pb_rails("table/table_row") do %>
|
13
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
14
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
15
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
16
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
17
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
18
|
+
<% end %>
|
19
|
+
<%= pb_rails("table/table_row") do %>
|
20
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
21
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
22
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
23
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
24
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
25
|
+
<% end %>
|
26
|
+
<%= pb_rails("table/table_row") do %>
|
27
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
28
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
29
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
30
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
31
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
32
|
+
<% end %>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<%= pb_rails("table", props: { size: "sm", tag:"div" }) do %>
|
2
|
+
<%= pb_rails("table/table_head", props: {tag:"div"}) do %>
|
3
|
+
<%= pb_rails("table/table_row", props: {tag:"div"}) do %>
|
4
|
+
<%= pb_rails("table/table_header", props: { text: "Column 1", tag:"div"}) %>
|
5
|
+
<%= pb_rails("table/table_header", props: { text: "Column 2", tag:"div"}) %>
|
6
|
+
<%= pb_rails("table/table_header", props: { text: "Column 3", tag:"div"}) %>
|
7
|
+
<%= pb_rails("table/table_header", props: { text: "Column 4", tag:"div"}) %>
|
8
|
+
<%= pb_rails("table/table_header", props: { text: "Column 5", tag:"div"}) %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<%= pb_rails("table/table_body", props: {tag:"div"}) do %>
|
12
|
+
<%= pb_rails("table/table_row", props: {tag:"div"}) do %>
|
13
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1", tag:"div"}) %>
|
14
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2", tag:"div"}) %>
|
15
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3", tag:"div"}) %>
|
16
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4", tag:"div"}) %>
|
17
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5", tag:"div"}) %>
|
18
|
+
<% end %>
|
19
|
+
<%= pb_rails("table/table_row", props: {tag:"div"}) do %>
|
20
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1", tag:"div"}) %>
|
21
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2", tag:"div"}) %>
|
22
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3", tag:"div"}) %>
|
23
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4", tag:"div"}) %>
|
24
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5", tag:"div"}) %>
|
25
|
+
<% end %>
|
26
|
+
<%= pb_rails("table/table_row", props: {tag:"div"}) do %>
|
27
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1", tag:"div"}) %>
|
28
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2", tag:"div"}) %>
|
29
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3", tag:"div"}) %>
|
30
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4", tag:"div"}) %>
|
31
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5", tag:"div"}) %>
|
32
|
+
<% end %>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
Optionally build your table with divs by passing `div` to the `tag` prop of all* your sub-components.
|
2
|
+
|
3
|
+
*NOTE: The `tag` prop defaults to `table`, which returns html elements. If divs are desired, sub-components must be used and all table elements, including the initial kit call, must use `div` as their `tag` in order for the table to render properly.
|
@@ -25,6 +25,9 @@ examples:
|
|
25
25
|
- table_with_background_kit: Table With Background Kit
|
26
26
|
- table_vertical_border: Vertical Borders
|
27
27
|
- table_striped: Striped Table
|
28
|
+
- table_with_subcomponents: Table with Sub Components (Table Elements)
|
29
|
+
- table_with_subcomponents_as_divs: Table with Sub Components (Divs)
|
30
|
+
|
28
31
|
|
29
32
|
react:
|
30
33
|
# - table_div: Div
|
@@ -1,7 +1,7 @@
|
|
1
1
|
[class^=pb_table] {
|
2
2
|
&.striped {
|
3
3
|
tbody, .pb_table_tbody {
|
4
|
-
tr:nth-child(odd), .
|
4
|
+
tr:nth-child(odd), .pb_table_tr:nth-child(odd) {
|
5
5
|
background-color: $bg_light;
|
6
6
|
}
|
7
7
|
}
|
@@ -10,7 +10,7 @@
|
|
10
10
|
&.dark {
|
11
11
|
&.striped {
|
12
12
|
tbody, .pb_table_tbody {
|
13
|
-
tr:nth-child(odd), .
|
13
|
+
tr:nth-child(odd), .pb_table_tr:nth-child(odd) {
|
14
14
|
background-color: $bg_dark;
|
15
15
|
}
|
16
16
|
}
|
@@ -48,7 +48,8 @@
|
|
48
48
|
}
|
49
49
|
}
|
50
50
|
&.data_table {
|
51
|
-
thead tr th
|
51
|
+
thead tr th,
|
52
|
+
.pb_table_thead .pb_table_tr .pb_table_th {
|
52
53
|
padding-top: $cell-pad-sm;
|
53
54
|
padding-bottom: $cell-pad-sm;
|
54
55
|
&:first-child {
|
@@ -58,7 +59,8 @@
|
|
58
59
|
padding-right: $cell-pad-sm;
|
59
60
|
}
|
60
61
|
}
|
61
|
-
tbody tr td
|
62
|
+
tbody tr td,
|
63
|
+
.pb_table_tbody .pb_table_tr .pb_table_td {
|
62
64
|
padding-top: $cell-pad-sm;
|
63
65
|
padding-bottom: $cell-pad-sm;
|
64
66
|
&:first-child {
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% if object.tag == "table" %>
|
2
|
+
<%= content_tag(:tbody,
|
3
|
+
aria: object.aria,
|
4
|
+
class: object.classname,
|
5
|
+
data: object.data,
|
6
|
+
id: object.id) do %>
|
7
|
+
<%= content.presence %>
|
8
|
+
<% end %>
|
9
|
+
<% else %>
|
10
|
+
<%= content_tag(:div,
|
11
|
+
aria: object.aria,
|
12
|
+
class: object.classname,
|
13
|
+
data: object.data,
|
14
|
+
id: object.id) do %>
|
15
|
+
<%= content.presence %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbTable
|
5
|
+
class TableBody < Playbook::KitBase
|
6
|
+
prop :tag, type: Playbook::Props::Enum,
|
7
|
+
values: %w[table div],
|
8
|
+
default: "table"
|
9
|
+
|
10
|
+
def classname
|
11
|
+
generate_classname("pb_table_tbody")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% if object.tag == "table" %>
|
2
|
+
<%= content_tag(:td,
|
3
|
+
aria: object.aria,
|
4
|
+
class: object.classname,
|
5
|
+
data: object.data,
|
6
|
+
id: object.id) do %>
|
7
|
+
<%= content.presence || object.text %>
|
8
|
+
<% end %>
|
9
|
+
<% else %>
|
10
|
+
<%= content_tag(:div,
|
11
|
+
aria: object.aria,
|
12
|
+
class: object.classname,
|
13
|
+
data: object.data,
|
14
|
+
id: object.id) do %>
|
15
|
+
<%= content.presence || object.text %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbTable
|
5
|
+
class TableCell < Playbook::KitBase
|
6
|
+
prop :tag, type: Playbook::Props::Enum,
|
7
|
+
values: %w[table div],
|
8
|
+
default: "table"
|
9
|
+
prop :text, type: Playbook::Props::String,
|
10
|
+
default: ""
|
11
|
+
|
12
|
+
def classname
|
13
|
+
generate_classname("pb_table_td")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% if object.tag == "table" %>
|
2
|
+
<%= content_tag(:thead,
|
3
|
+
aria: object.aria,
|
4
|
+
class: object.classname,
|
5
|
+
data: object.data,
|
6
|
+
id: object.id) do %>
|
7
|
+
<%= content.presence %>
|
8
|
+
<% end %>
|
9
|
+
<% else %>
|
10
|
+
<%= content_tag(:div,
|
11
|
+
aria: object.aria,
|
12
|
+
class: object.classname,
|
13
|
+
data: object.data,
|
14
|
+
id: object.id) do %>
|
15
|
+
<%= content.presence %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbTable
|
5
|
+
class TableHead < Playbook::KitBase
|
6
|
+
prop :tag, type: Playbook::Props::Enum,
|
7
|
+
values: %w[table div],
|
8
|
+
default: "table"
|
9
|
+
|
10
|
+
def classname
|
11
|
+
generate_classname("pb_table_thead")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,47 +1,57 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<%=
|
10
|
-
<% end %>
|
11
|
-
<% else %>
|
12
|
-
<%= link_to next_link, style: link_style do %>
|
13
|
-
<%= pb_rails("flex", props:{ align: object.align_content, justify: object.justify_sort_icon, classname: "pb_th_link" }) do %>
|
1
|
+
<% if object.tag == "table" %>
|
2
|
+
<%= content_tag(:th,
|
3
|
+
colspan: object.colspan,
|
4
|
+
aria: object.aria,
|
5
|
+
class: object.classname,
|
6
|
+
data: object.data,
|
7
|
+
id: "pb-th#{object.id}" ) do %>
|
8
|
+
<% unless sorting_style? %>
|
9
|
+
<%= pb_rails("flex", props:{ align: object.align_content, justify: object.justify_sort_icon, classname: "pb_th_nolink" }) do %>
|
14
10
|
<%= content.presence || object.text %>
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
<% end %>
|
12
|
+
<% else %>
|
13
|
+
<%= link_to next_link, style: link_style do %>
|
14
|
+
<%= pb_rails("flex", props:{ align: object.align_content, justify: object.justify_sort_icon, classname: "pb_th_link" }) do %>
|
15
|
+
<%= content.presence || object.text %>
|
16
|
+
<% if sorting_style? %>
|
17
|
+
<%= pb_rails("icon", props: { icon: object.sort_icon(active_item[:direction], active_item[:active]),
|
18
|
+
fixed_width: true,
|
19
|
+
classname: active_item.any? ? "pb_th_active" : "",
|
20
|
+
padding_left: "xs" }) %>
|
21
|
+
<% end %>
|
20
22
|
<% end %>
|
21
23
|
<% end %>
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
24
|
+
<% if use_dropdown_select %>
|
25
|
+
<%= pb_rails("popover", props: { classname: "pb_filter_sort_menu",
|
26
|
+
close_on_click: "outside",
|
27
|
+
trigger_element_id: "pb-th#{object.id}",
|
28
|
+
tooltip_id: "sort-filter-btn-tooltip#{object.id}",
|
29
|
+
position: object.placement ,
|
30
|
+
padding: 'none'}) do %>
|
31
|
+
<%= pb_rails("nav", props: {classname: "pb_table_header_dropdown"}) do %>
|
32
|
+
<% object.sort_items.each do |sort_item| %>
|
33
|
+
<% item = active_or_first_item(sort_items_for(sort_item)) %>
|
34
|
+
<%= pb_rails("nav/item", props: {
|
35
|
+
text: item[:item],
|
36
|
+
link: next_link(sort_item: sort_item),
|
37
|
+
highlighted_border: false,
|
38
|
+
padding: "xs",
|
39
|
+
icon_right: sort_icon(item[:direction], item[:active]),
|
40
|
+
active: item[:active],
|
41
|
+
classname: "header_nav_item"
|
42
|
+
}) %>
|
43
|
+
<% end %>
|
42
44
|
<% end %>
|
43
45
|
<% end %>
|
44
46
|
<% end %>
|
45
47
|
<% end %>
|
46
48
|
<% end %>
|
47
|
-
<%
|
49
|
+
<% else %>
|
50
|
+
<%= content_tag(:div,
|
51
|
+
aria: object.aria,
|
52
|
+
class: object.classname,
|
53
|
+
data: object.data,
|
54
|
+
id: object.id) do %>
|
55
|
+
<%= content.presence || object.text %>
|
56
|
+
<% end %>
|
57
|
+
<% end %>
|
@@ -23,9 +23,16 @@ module Playbook
|
|
23
23
|
default: ""
|
24
24
|
prop :sort_dropdown, type: Playbook::Props::Boolean,
|
25
25
|
default: false
|
26
|
+
prop :tag, type: Playbook::Props::Enum,
|
27
|
+
values: %w[table div],
|
28
|
+
default: "table"
|
26
29
|
|
27
30
|
def classname
|
28
|
-
generate_classname("pb_table_header_kit", align_class)
|
31
|
+
generate_classname("pb_table_header_kit", align_class) + tag_class
|
32
|
+
end
|
33
|
+
|
34
|
+
def tag_class
|
35
|
+
" pb_table_th"
|
29
36
|
end
|
30
37
|
|
31
38
|
def align_class
|
@@ -1,7 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
<% if object.tag == "table" %>
|
2
|
+
<%= content_tag(:tr,
|
3
|
+
aria: object.aria,
|
4
|
+
class: object.classname,
|
5
|
+
data: object.data,
|
6
|
+
id: object.id) do %>
|
7
|
+
<%= content.presence %>
|
8
|
+
<% end %>
|
9
|
+
<% else %>
|
10
|
+
<%= content_tag(:div,
|
11
|
+
aria: object.aria,
|
12
|
+
class: object.classname,
|
13
|
+
data: object.data,
|
14
|
+
id: object.id) do %>
|
15
|
+
<%= content.presence %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
@@ -5,14 +5,21 @@ module Playbook
|
|
5
5
|
class TableRow < Playbook::KitBase
|
6
6
|
prop :side_highlight_color, type: Playbook::Props::String,
|
7
7
|
default: "none"
|
8
|
+
prop :tag, type: Playbook::Props::Enum,
|
9
|
+
values: %w[table div],
|
10
|
+
default: "table"
|
8
11
|
|
9
12
|
def classname
|
10
|
-
generate_classname("pb_table_row_kit", side_highlight_class)
|
13
|
+
generate_classname("pb_table_row_kit", side_highlight_class) + tag_class
|
11
14
|
end
|
12
15
|
|
13
16
|
def side_highlight_class
|
14
17
|
side_highlight_color.present? ? "side_highlight_#{side_highlight_color}" : nil
|
15
18
|
end
|
19
|
+
|
20
|
+
def tag_class
|
21
|
+
" pb_table_tr"
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
@@ -27,7 +27,7 @@ type TextInputProps = {
|
|
27
27
|
required?: boolean,
|
28
28
|
type: string,
|
29
29
|
value: string | number,
|
30
|
-
children:
|
30
|
+
children: React.ReactElement,
|
31
31
|
addOn?: {
|
32
32
|
icon?: string,
|
33
33
|
alignment?: "right" | "left",
|
@@ -85,8 +85,12 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
85
85
|
icon={icon}
|
86
86
|
/>
|
87
87
|
)
|
88
|
+
|
89
|
+
const childInput = children ? children.type === "input" : undefined
|
90
|
+
|
88
91
|
const textInput = (
|
89
|
-
|
92
|
+
childInput ? React.cloneElement(children, { className: "text_input" }) :
|
93
|
+
(<input
|
90
94
|
{...domSafeProps(props)}
|
91
95
|
className="text_input"
|
92
96
|
disabled={disabled}
|
@@ -99,7 +103,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
99
103
|
required={required}
|
100
104
|
type={type}
|
101
105
|
value={value}
|
102
|
-
/>
|
106
|
+
/>)
|
103
107
|
)
|
104
108
|
|
105
109
|
const addOnInput = (
|
@@ -131,7 +135,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
131
135
|
)
|
132
136
|
|
133
137
|
const render = (() => {
|
134
|
-
if(children) return children
|
138
|
+
if (children && !childInput) return children
|
135
139
|
if (shouldShowAddOn) return addOnInput
|
136
140
|
|
137
141
|
return textInput
|
@@ -144,7 +148,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
144
148
|
{...htmlProps}
|
145
149
|
className={css}
|
146
150
|
>
|
147
|
-
{label &&
|
151
|
+
{label &&
|
148
152
|
<Caption
|
149
153
|
className="pb_text_input_kit_label"
|
150
154
|
text={label}
|
@@ -58,6 +58,16 @@ const TextInputAddOn = (props) => {
|
|
58
58
|
{...props}
|
59
59
|
/>
|
60
60
|
</div>
|
61
|
+
<div>
|
62
|
+
<TextInput
|
63
|
+
addOn={{ icon: 'frog', alignment: 'right', border: true }}
|
64
|
+
label="Right-Aligned Add On With Child Input"
|
65
|
+
onChange={handleUpdateFourthInput}
|
66
|
+
{...props}
|
67
|
+
>
|
68
|
+
<input />
|
69
|
+
</TextInput>
|
70
|
+
</div>
|
61
71
|
<div>
|
62
72
|
<TextInput
|
63
73
|
addOn={{ icon: 'percent', alignment: 'left', border: false }}
|
@@ -76,6 +86,16 @@ const TextInputAddOn = (props) => {
|
|
76
86
|
{...props}
|
77
87
|
/>
|
78
88
|
</div>
|
89
|
+
<div>
|
90
|
+
<TextInput
|
91
|
+
addOn={{ icon: 'frog', alignment: 'left', border: true }}
|
92
|
+
label="Left-Aligned Add On With Child Input"
|
93
|
+
onChange={handleUpdateFourthInput}
|
94
|
+
{...props}
|
95
|
+
>
|
96
|
+
<input />
|
97
|
+
</TextInput>
|
98
|
+
</div>
|
79
99
|
</>
|
80
100
|
)
|
81
101
|
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
![user-presence-indicator)](https://github.com/powerhome/playbook/assets/112719604/96ee8408-2e21-4aaf-ae65-9f023515cf8d)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
VStack(alignment: .leading, spacing: Spacing.small) {
|
5
|
+
PBUser(
|
6
|
+
name: name,
|
7
|
+
|
8
|
+
image: img,
|
9
|
+
size: .small,
|
10
|
+
territory: "PHL",
|
11
|
+
title: title,
|
12
|
+
status: .online
|
13
|
+
)
|
14
|
+
PBUser(
|
15
|
+
name: name,
|
16
|
+
image: img,
|
17
|
+
territory: "PHL",
|
18
|
+
title: title,
|
19
|
+
status: .away
|
20
|
+
)
|
21
|
+
PBUser(
|
22
|
+
name: name,
|
23
|
+
image: img,
|
24
|
+
size: .large,
|
25
|
+
territory: "PHL",
|
26
|
+
title: title,
|
27
|
+
status: .offline
|
28
|
+
)
|
29
|
+
}
|
30
|
+
```
|
@@ -7,4 +7,5 @@
|
|
7
7
|
| **orientation** | `Orientation` | Changes the orientation of the User | `.horizontal` | `.horizontal` `.verticle` |
|
8
8
|
| **size** | `UserAvatarSize` | Changes the size of the User | `.medium` | `.small` `.medium` `.large` |
|
9
9
|
| **territory** | `String` | Adds the User's territory | | |
|
10
|
-
| **title** | `String` | Adds a title | | |
|
10
|
+
| **title** | `String` | Adds a title | | |
|
11
|
+
| **status** | `PBAvatar.PresenceStatus?` | An idicator for the current status of the user | `.none` | `.online` `.away` `.offline` |
|