playbook_ui 13.12.0 → 13.13.0.pre.alpha.play900startratingasinput1657
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_avatar/_avatar.tsx +5 -1
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.tsx +6 -2
- data/app/pb_kits/playbook/pb_background/_background.tsx +9 -5
- data/app/pb_kits/playbook/pb_badge/_badge.tsx +5 -1
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +6 -2
- data/app/pb_kits/playbook/pb_body/_body.tsx +5 -1
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.tsx +5 -1
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.tsx +5 -2
- data/app/pb_kits/playbook/pb_button/_button.tsx +8 -1
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.tsx +5 -1
- data/app/pb_kits/playbook/pb_caption/_caption.tsx +6 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +5 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +7 -2
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +7 -2
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +5 -3
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +5 -1
- data/app/pb_kits/playbook/pb_contact/_contact.tsx +5 -1
- data/app/pb_kits/playbook/pb_currency/_currency.tsx +5 -1
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.tsx +5 -1
- data/app/pb_kits/playbook/pb_date/_date.tsx +12 -7
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +5 -1
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +5 -1
- data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +15 -4
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +12 -5
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +5 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +5 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +15 -4
- data/app/pb_kits/playbook/pb_detail/_detail.tsx +5 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +11 -3
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.tsx +8 -3
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx +5 -1
- data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.tsx +8 -1
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +6 -2
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.md +1 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +6 -1
- data/app/pb_kits/playbook/pb_flex/_flex.tsx +6 -1
- data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +6 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +5 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +7 -1
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +6 -2
- data/app/pb_kits/playbook/pb_hashtag/_hashtag.tsx +5 -1
- data/app/pb_kits/playbook/pb_highlight/_highlight.tsx +5 -0
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +10 -3
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +7 -1
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +5 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +5 -1
- data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +5 -1
- data/app/pb_kits/playbook/pb_image/_image.tsx +6 -1
- data/app/pb_kits/playbook/pb_label_pill/_label_pill.tsx +5 -1
- data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +6 -2
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +6 -1
- data/app/pb_kits/playbook/pb_legend/_legend.tsx +5 -1
- data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +6 -1
- data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +5 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +9 -3
- data/app/pb_kits/playbook/pb_list/_list.tsx +7 -2
- data/app/pb_kits/playbook/pb_list/_list_item.tsx +5 -1
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +5 -1
- data/app/pb_kits/playbook/pb_map/_map.tsx +6 -1
- data/app/pb_kits/playbook/pb_message/_message.tsx +5 -1
- data/app/pb_kits/playbook/pb_message/_message_mention.tsx +5 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +5 -1
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +5 -1
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_default_swift.md +11 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_props_swift.md +7 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_reverse_swift.md +13 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_size_swift.md +11 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +5 -1
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_default_swift.md +15 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_props_swift.md +5 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_small_swift.md +15 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_xsmall_swift.md +15 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_nav/_item.tsx +7 -2
- data/app/pb_kits/playbook/pb_nav/_nav.tsx +5 -1
- data/app/pb_kits/playbook/pb_online_status/_online_status.tsx +5 -1
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +6 -2
- data/app/pb_kits/playbook/pb_person/_person.tsx +5 -0
- data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +5 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +8 -2
- data/app/pb_kits/playbook/pb_pill/_pill.tsx +5 -1
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +6 -1
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +5 -1
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +9 -3
- data/app/pb_kits/playbook/pb_progress_step/_progress_step.tsx +5 -1
- data/app/pb_kits/playbook/pb_progress_step/_progress_step_item.tsx +6 -2
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +5 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +7 -1
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +5 -1
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_children_swift.md +14 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_dashed_swift.md +7 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_line_swift.md +8 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_props_swift.md +8 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_text_swift.md +7 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical_swift.md +18 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +8 -0
- data/app/pb_kits/playbook/pb_select/_select.tsx +6 -1
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +6 -2
- data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +5 -0
- data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +5 -0
- data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +11 -3
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +5 -1
- data/app/pb_kits/playbook/pb_source/_source.tsx +5 -1
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +105 -53
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +183 -62
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_background_options.html.erb +2 -0
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_background_options.jsx +25 -0
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.html.erb +3 -0
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.jsx +31 -0
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.html.erb +6 -8
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.jsx +19 -6
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.html.erb +3 -1
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx +22 -5
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.html.erb +6 -0
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.jsx +58 -0
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.html.erb +16 -0
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.jsx +60 -0
- data/app/pb_kits/playbook/pb_star_rating/docs/example.yml +12 -5
- data/app/pb_kits/playbook/pb_star_rating/docs/index.js +8 -0
- data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +48 -26
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +82 -6
- data/app/pb_kits/playbook/pb_star_rating/star_rating.test.js +34 -34
- data/app/pb_kits/playbook/pb_star_rating/stars/primary_star.svg +3 -0
- data/app/pb_kits/playbook/pb_star_rating/stars/star_outline.svg +3 -0
- data/app/pb_kits/playbook/pb_star_rating/stars/subtle_dark_star.svg +3 -0
- data/app/pb_kits/playbook/pb_star_rating/stars/subtle_star.svg +3 -0
- data/app/pb_kits/playbook/pb_star_rating/stars/yellow_star.svg +3 -0
- data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +14 -2
- data/app/pb_kits/playbook/pb_stat_value/_stat_value.tsx +6 -0
- data/app/pb_kits/playbook/pb_table/_table.tsx +5 -1
- data/app/pb_kits/playbook/pb_table/_table_row.tsx +5 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +5 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on_swift.md +35 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default_swift.md +29 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled_swift.md +13 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error_swift.md +24 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_props_swift.md +13 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +5 -2
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default_swift.md +27 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error_swift.md +11 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_props_swift.md +9 -0
- data/app/pb_kits/playbook/pb_textarea/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_time/_time.tsx +9 -2
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +5 -1
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +6 -2
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +9 -2
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +5 -1
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +5 -1
- data/app/pb_kits/playbook/pb_title/_title.tsx +5 -1
- data/app/pb_kits/playbook/pb_title_count/_title_count.tsx +5 -1
- data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +16 -3
- data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +5 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default_swift.md +11 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name_swift.md +10 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_props_swift.md +6 -0
- data/app/pb_kits/playbook/pb_toggle/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +5 -1
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +9 -3
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +7 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +2 -2
- data/app/pb_kits/playbook/pb_user/_user.tsx +5 -1
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +5 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +5 -1
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +5 -1
- data/app/pb_kits/playbook/utilities/props.ts +16 -0
- data/dist/playbook-rails.js +6 -6
- data/lib/playbook/version.rb +2 -2
- metadata +46 -7
@@ -1,31 +1,53 @@
|
|
1
1
|
<%= content_tag(:div,
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
<%
|
7
|
-
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname) do %>
|
5
|
+
<% if layout_option == "number" %>
|
6
|
+
<% case object.size %>
|
7
|
+
<% when "xs", "sm" %>
|
8
|
+
<%= pb_rails("caption", props: { text: object.rating,
|
9
|
+
size: "sm",
|
10
|
+
classname: "pb_star_rating_number_#{size}",
|
11
|
+
dark: dark,
|
12
|
+
padding_right: "xxs" }) %>
|
13
|
+
<% when "md" %>
|
14
|
+
<%= pb_rails("body", props: { text: object.rating,
|
15
|
+
dark: dark,
|
16
|
+
classname: "pb_star_rating_number_#{size}",
|
17
|
+
padding_right: "xxs" }) %>
|
18
|
+
<% when "lg" %>
|
19
|
+
<%= pb_rails("title", props: { text: object.rating,
|
20
|
+
size: 2,
|
21
|
+
dark: dark,
|
22
|
+
classname: "pb_star_rating_number_#{size}",
|
23
|
+
padding_right: "sm" }) %>
|
8
24
|
<% end %>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
<%= pb_rails("
|
25
|
+
<% end %>
|
26
|
+
<%= pb_rails("flex", props: { }) do %>
|
27
|
+
<% object.star_count.times do %>
|
28
|
+
<%= pb_rails("icon", props: { classname: "#{star_color} pb_star_#{size}" , custom_icon: Playbook::Engine.root.join(star_svg_path) } ) %>
|
29
|
+
<% end %>
|
30
|
+
<% object.empty_stars.times do %>
|
31
|
+
<%= pb_rails("icon", props: { classname: "#{background_star_color} pb_star_#{size}", custom_icon: Playbook::Engine.root.join(background_star_path) } ) %>
|
32
|
+
<% end %>
|
33
|
+
<% end %>
|
34
|
+
<% if layout_option == "onestar" %>
|
35
|
+
<%= content_tag(:div, class: "pb_star_rating_number_#{size}") do %>
|
36
|
+
<% case object.size %>
|
37
|
+
<% when "xs", "sm" %>
|
38
|
+
<%= pb_rails("caption", props: { text: "#{object.rating} of #{object.denominator}",
|
39
|
+
size: "sm",
|
40
|
+
dark: dark,
|
41
|
+
padding_left: "xxs" }) %>
|
42
|
+
<% when "md" %>
|
43
|
+
<%= pb_rails("body", props: { text: "#{object.rating} of #{object.denominator}",
|
44
|
+
dark: dark,
|
45
|
+
padding_left: "xxs" }) %>
|
46
|
+
<% when "lg" %>
|
47
|
+
<%= pb_rails("title", props: { text: "#{object.rating} of #{object.denominator}",
|
48
|
+
size: 2,
|
49
|
+
dark: dark }) %>
|
28
50
|
<% end %>
|
29
|
-
|
30
51
|
<% end %>
|
52
|
+
<% end %>
|
31
53
|
<% end %>
|
@@ -3,18 +3,94 @@
|
|
3
3
|
module Playbook
|
4
4
|
module PbStarRating
|
5
5
|
class StarRating < Playbook::KitBase
|
6
|
-
prop :hide_rating, type: Playbook::Props::Boolean,
|
7
|
-
default: false
|
8
|
-
|
9
6
|
prop :rating, type: Playbook::Props::Numeric,
|
10
7
|
default: 0
|
11
8
|
|
9
|
+
prop :denominator, type: Playbook::Props::Numeric,
|
10
|
+
default: 5
|
11
|
+
|
12
|
+
prop :layout_option, type: Playbook::Props::Enum,
|
13
|
+
values: %w[default onestar number],
|
14
|
+
default: "default"
|
15
|
+
|
16
|
+
prop :color_option, type: Playbook::Props::Enum,
|
17
|
+
values: %w[yellow primary subtle],
|
18
|
+
default: "yellow"
|
19
|
+
|
20
|
+
prop :size, type: Playbook::Props::Enum,
|
21
|
+
values: %w[xs sm md lg],
|
22
|
+
default: "sm"
|
23
|
+
|
24
|
+
prop :background_type, type: Playbook::Props::Enum,
|
25
|
+
values: %w[fill outline],
|
26
|
+
default: "fill"
|
27
|
+
|
12
28
|
def star_count
|
13
|
-
rating.floor
|
29
|
+
rating.floor > denominator_style ? denominator_style : rating.floor
|
30
|
+
end
|
31
|
+
|
32
|
+
def denominator_style
|
33
|
+
layout_option == "onestar" ? 1 : denominator
|
34
|
+
end
|
35
|
+
|
36
|
+
def empty_stars
|
37
|
+
(denominator_style - rating.floor).negative? ? 0 : denominator_style - rating.floor
|
38
|
+
end
|
39
|
+
|
40
|
+
def star_color
|
41
|
+
case color_option
|
42
|
+
when "yellow"
|
43
|
+
"yellow_star"
|
44
|
+
when "primary"
|
45
|
+
"primary_star"
|
46
|
+
when "subtle"
|
47
|
+
dark ? "suble_star_dark" : "suble_star_light"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def background_star_color
|
52
|
+
if background_type === "outline"
|
53
|
+
dark ? "outline_empty_star_dark" : "outline_empty_star_light"
|
54
|
+
else
|
55
|
+
dark ? "empty_star_dark" : "empty_star_light"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def svg_size
|
60
|
+
sizes = { "xs": "pb_star_xs",
|
61
|
+
"sm": "pb_star_sm",
|
62
|
+
"md": "pb_star_md",
|
63
|
+
"lg": "pb_star_lg" }
|
64
|
+
sizes[size.to_sym]
|
65
|
+
end
|
66
|
+
|
67
|
+
def svg_class
|
68
|
+
"pb_star_#{size}"
|
69
|
+
end
|
70
|
+
|
71
|
+
def background_star_path
|
72
|
+
if background_type === "outline"
|
73
|
+
"app/pb_kits/playbook/pb_star_rating/stars/star_outline.svg"
|
74
|
+
else
|
75
|
+
"app/pb_kits/playbook/pb_star_rating/stars/yellow_star.svg"
|
76
|
+
end
|
14
77
|
end
|
15
78
|
|
16
|
-
def
|
17
|
-
|
79
|
+
def star_svg_path
|
80
|
+
case color_option
|
81
|
+
when "yellow"
|
82
|
+
"app/pb_kits/playbook/pb_star_rating/stars/yellow_star.svg"
|
83
|
+
when "primary"
|
84
|
+
"app/pb_kits/playbook/pb_star_rating/stars/primary_star.svg"
|
85
|
+
when "subtle"
|
86
|
+
if dark == true
|
87
|
+
"app/pb_kits/playbook/pb_star_rating/stars/subtle_dark_star.svg"
|
88
|
+
else
|
89
|
+
"app/pb_kits/playbook/pb_star_rating/stars/subtle_star.svg"
|
90
|
+
end
|
91
|
+
else
|
92
|
+
"app/pb_kits/playbook/pb_star_rating/stars/primary_star.svg"
|
93
|
+
end
|
18
94
|
end
|
19
95
|
|
20
96
|
def classname
|
@@ -1,24 +1,22 @@
|
|
1
|
-
import React from "react"
|
2
|
-
import { render, screen } from "../utilities/test-utils"
|
1
|
+
import React from "react"
|
2
|
+
import { render, screen } from "../utilities/test-utils"
|
3
3
|
|
4
|
-
import StarRating from "./_star_rating"
|
4
|
+
import StarRating from "./_star_rating"
|
5
5
|
|
6
|
-
const testId = "star-rating-kit"
|
6
|
+
const testId = "star-rating-kit"
|
7
7
|
|
8
8
|
describe("Star Rating Kit", () => {
|
9
9
|
test("Expects to have correct classname", () => {
|
10
10
|
render(
|
11
11
|
<StarRating
|
12
12
|
data={{ testid: testId }}
|
13
|
-
rating={2}
|
14
13
|
/>
|
15
|
-
)
|
16
|
-
|
14
|
+
)
|
17
15
|
|
18
|
-
const kit = screen.getByTestId(testId)
|
19
|
-
expect(kit).
|
16
|
+
const kit = screen.getByTestId(testId)
|
17
|
+
expect(kit.className).toBe("pb_star_rating_kit")
|
20
18
|
|
21
|
-
})
|
19
|
+
})
|
22
20
|
|
23
21
|
test('should render aria-label', () => {
|
24
22
|
render(
|
@@ -27,45 +25,47 @@ describe("Star Rating Kit", () => {
|
|
27
25
|
data={{ testid: testId }}
|
28
26
|
rating={2}
|
29
27
|
/>
|
30
|
-
)
|
28
|
+
)
|
31
29
|
|
32
30
|
const kit = screen.getByTestId(testId)
|
33
31
|
expect(kit).toHaveAttribute('aria-label', testId)
|
34
|
-
})
|
32
|
+
})
|
35
33
|
|
36
|
-
test("Displays
|
34
|
+
test("Displays correct denominator", () => {
|
37
35
|
render(
|
38
36
|
<StarRating
|
39
37
|
data={{ testid: testId }}
|
38
|
+
denominator={4}
|
40
39
|
rating={2}
|
40
|
+
size="xs"
|
41
41
|
/>
|
42
|
-
)
|
43
|
-
|
42
|
+
)
|
44
43
|
|
45
|
-
const kit = screen.getByTestId(testId)
|
46
|
-
const highlight = kit.querySelector(".
|
47
|
-
const stars = highlight.querySelectorAll(".
|
48
|
-
const count = stars.length
|
44
|
+
const kit = screen.getByTestId(testId)
|
45
|
+
const highlight = kit.querySelector(".star_flex_area")
|
46
|
+
const stars = highlight.querySelectorAll(".pb_star_xs")
|
47
|
+
const count = stars.length
|
49
48
|
|
50
|
-
expect(count).toBe(
|
51
|
-
})
|
49
|
+
expect(count).toBe(4)
|
50
|
+
})
|
52
51
|
|
53
|
-
test("
|
52
|
+
test("Uses correct size", () => {
|
54
53
|
render(
|
55
54
|
<StarRating
|
56
55
|
data={{ testid: testId }}
|
57
|
-
|
56
|
+
layoutOption="number"
|
57
|
+
rating={2}
|
58
|
+
size="lg"
|
58
59
|
/>
|
59
|
-
)
|
60
|
+
)
|
60
61
|
|
61
|
-
const kit = screen.getByTestId(testId)
|
62
|
-
const highlight = kit.querySelector(".
|
63
|
-
const
|
64
|
-
const
|
65
|
-
const
|
66
|
-
const halfStarCount = halfStars.length;
|
62
|
+
const kit = screen.getByTestId(testId)
|
63
|
+
const highlight = kit.querySelector(".star_flex_area")
|
64
|
+
const title = kit.querySelector(".pb_star_rating_number_lg")
|
65
|
+
const stars = highlight.querySelectorAll(".pb_star_lg")
|
66
|
+
const count = stars.length
|
67
67
|
|
68
|
-
expect(
|
69
|
-
expect(
|
70
|
-
})
|
71
|
-
})
|
68
|
+
expect(title.className).toBe("pb_title_kit_size_2 pr_sm pb_star_rating_number_lg")
|
69
|
+
expect(count).toBe(5)
|
70
|
+
})
|
71
|
+
})
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M9.86015 0.4371C9.73527 0.187329 9.4855 0 9.17328 0C8.89229 0 8.64252 0.187329 8.51763 0.4371L6.36335 4.83932L1.58647 5.55742C1.30547 5.58864 1.08692 5.80719 0.99326 6.05696C0.899595 6.33795 0.962038 6.61895 1.18059 6.8375L4.64617 10.2719L3.80319 15.1112C3.77197 15.3922 3.89685 15.7044 4.11541 15.8605C4.36518 16.0166 4.64617 16.0478 4.89594 15.9229L9.17328 13.6126L13.4506 15.9229C13.7004 16.0478 14.0126 16.0166 14.2624 15.8605C14.4809 15.7044 14.6058 15.3922 14.5434 15.1112L13.7316 10.2719L17.1972 6.8375C17.4157 6.61895 17.4782 6.33795 17.3845 6.05696C17.2909 5.80719 17.0723 5.58864 16.7913 5.55742L12.0144 4.83932L9.86015 0.4371Z" fill="#0056CF"/>
|
3
|
+
</svg>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M5.91323 5.33377L6.17269 5.29477L6.28801 5.0591L8.44116 0.659187C8.49971 0.543364 8.59517 0.5 8.64884 0.5C8.74499 0.5 8.83506 0.555009 8.88775 0.659235L11.0409 5.0591L11.1562 5.29477L11.4157 5.33377L16.1925 6.05186L16.2021 6.0533L16.2117 6.05436C16.2359 6.05706 16.2671 6.06847 16.3024 6.09973C16.3374 6.13062 16.3686 6.17476 16.3886 6.22412C16.4186 6.32162 16.401 6.40181 16.3198 6.48332C16.3196 6.48353 16.3194 6.48374 16.3192 6.48395L12.8552 9.91671L12.6712 10.0991L12.7141 10.3546L13.5258 15.1939L13.528 15.2068L13.5308 15.2196C13.5488 15.3004 13.5074 15.402 13.4567 15.4462C13.3391 15.5132 13.2227 15.5096 13.1546 15.4781L8.88646 13.1726L8.64884 13.0443L8.41121 13.1726L4.14274 15.4782C4.07877 15.5083 3.99031 15.5147 3.87267 15.4466C3.82302 15.4033 3.76655 15.2914 3.77463 15.1781L4.61431 10.3577L4.65911 10.1005L4.47368 9.91671L1.0097 6.48394C1.00947 6.48372 1.00925 6.4835 1.00903 6.48327C0.927878 6.40178 0.91031 6.3216 0.94026 6.22412C0.960274 6.17476 0.99154 6.13062 1.02646 6.09973C1.0618 6.06847 1.09296 6.05706 1.11724 6.05436L1.12682 6.0533L1.13635 6.05186L5.91323 5.33377Z" stroke="#C1CDD6"/>
|
3
|
+
</svg>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path class="" fillRule="evenodd" clipRule="evenodd" d="M9.86015 0.4371C9.73527 0.187329 9.4855 0 9.17328 0C8.89229 0 8.64252 0.187329 8.51763 0.4371L6.36335 4.83932L1.58647 5.55742C1.30547 5.58864 1.08692 5.80719 0.99326 6.05696C0.899595 6.33795 0.962038 6.61895 1.18059 6.8375L4.64617 10.2719L3.80319 15.1112C3.77197 15.3922 3.89685 15.7044 4.11541 15.8605C4.36518 16.0166 4.64617 16.0478 4.89594 15.9229L9.17328 13.6126L13.4506 15.9229C13.7004 16.0478 14.0126 16.0166 14.2624 15.8605C14.4809 15.7044 14.6058 15.3922 14.5434 15.1112L13.7316 10.2719L17.1972 6.8375C17.4157 6.61895 17.4782 6.33795 17.3845 6.05696C17.2909 5.80719 17.0723 5.58864 16.7913 5.55742L12.0144 4.83932L9.86015 0.4371Z" fill="#F9BB00"/>
|
3
|
+
</svg>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M9.86015 0.4371C9.73527 0.187329 9.4855 0 9.17328 0C8.89229 0 8.64252 0.187329 8.51763 0.4371L6.36335 4.83932L1.58647 5.55742C1.30547 5.58864 1.08692 5.80719 0.99326 6.05696C0.899595 6.33795 0.962038 6.61895 1.18059 6.8375L4.64617 10.2719L3.80319 15.1112C3.77197 15.3922 3.89685 15.7044 4.11541 15.8605C4.36518 16.0166 4.64617 16.0478 4.89594 15.9229L9.17328 13.6126L13.4506 15.9229C13.7004 16.0478 14.0126 16.0166 14.2624 15.8605C14.4809 15.7044 14.6058 15.3922 14.5434 15.1112L13.7316 10.2719L17.1972 6.8375C17.4157 6.61895 17.4782 6.33795 17.3845 6.05696C17.2909 5.80719 17.0723 5.58864 16.7913 5.55742L12.0144 4.83932L9.86015 0.4371Z" fill="#F9BB00"/>
|
3
|
+
</svg>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M9.86015 0.4371C9.73527 0.187329 9.4855 0 9.17328 0C8.89229 0 8.64252 0.187329 8.51763 0.4371L6.36335 4.83932L1.58647 5.55742C1.30547 5.58864 1.08692 5.80719 0.99326 6.05696C0.899595 6.33795 0.962038 6.61895 1.18059 6.8375L4.64617 10.2719L3.80319 15.1112C3.77197 15.3922 3.89685 15.7044 4.11541 15.8605C4.36518 16.0166 4.64617 16.0478 4.89594 15.9229L9.17328 13.6126L13.4506 15.9229C13.7004 16.0478 14.0126 16.0166 14.2624 15.8605C14.4809 15.7044 14.6058 15.3922 14.5434 15.1112L13.7316 10.2719L17.1972 6.8375C17.4157 6.61895 17.4782 6.33795 17.3845 6.05696C17.2909 5.80719 17.0723 5.58864 16.7913 5.55742L12.0144 4.83932L9.86015 0.4371Z" />
|
3
|
+
</svg>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
3
|
|
4
|
-
import { buildCss } from '../utilities/props'
|
4
|
+
import { buildCss, buildHtmlProps } from '../utilities/props'
|
5
5
|
import { globalProps } from '../utilities/globalProps'
|
6
6
|
|
7
7
|
import Body from '../pb_body/_body'
|
@@ -22,18 +22,29 @@ type StatChangeProps = {
|
|
22
22
|
change?: 'increase' | 'decrease' | 'neutral',
|
23
23
|
className?: string,
|
24
24
|
icon?: string,
|
25
|
+
htmlOptions?: {[key: string]: string | number | boolean | Function},
|
25
26
|
id?: string,
|
26
27
|
value?: string | number,
|
27
28
|
}
|
28
29
|
|
29
30
|
const StatChange = (props: StatChangeProps): React.ReactElement => {
|
30
|
-
const {
|
31
|
+
const {
|
32
|
+
change = 'neutral',
|
33
|
+
className,
|
34
|
+
htmlOptions = {},
|
35
|
+
icon,
|
36
|
+
id,
|
37
|
+
value
|
38
|
+
} = props
|
39
|
+
|
31
40
|
const status = statusMap[change as keyof typeof statusMap]
|
32
41
|
let returnedIcon = iconMap[change as keyof typeof iconMap]
|
33
42
|
if (icon) {
|
34
43
|
returnedIcon = icon
|
35
44
|
}
|
36
45
|
|
46
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
47
|
+
|
37
48
|
return (
|
38
49
|
<>
|
39
50
|
{value &&
|
@@ -44,6 +55,7 @@ const StatChange = (props: StatChangeProps): React.ReactElement => {
|
|
44
55
|
className
|
45
56
|
)}
|
46
57
|
id={id}
|
58
|
+
{...htmlProps}
|
47
59
|
>
|
48
60
|
<Body status={status}>
|
49
61
|
{returnedIcon &&
|
@@ -2,10 +2,12 @@ import React from 'react'
|
|
2
2
|
import classnames from 'classnames'
|
3
3
|
|
4
4
|
import { globalProps } from '../utilities/globalProps'
|
5
|
+
import { buildHtmlProps } from '../utilities/props'
|
5
6
|
import Title from '../pb_title/_title'
|
6
7
|
|
7
8
|
type StatValueProps = {
|
8
9
|
className?: string,
|
10
|
+
htmlOptions?: {[key: string]: string | number | boolean | Function},
|
9
11
|
id?: string,
|
10
12
|
unit?: string,
|
11
13
|
value: string | number,
|
@@ -14,11 +16,14 @@ type StatValueProps = {
|
|
14
16
|
const StatValue = (props: StatValueProps): React.ReactElement => {
|
15
17
|
const {
|
16
18
|
className,
|
19
|
+
htmlOptions = {},
|
17
20
|
id,
|
18
21
|
unit,
|
19
22
|
value = 0,
|
20
23
|
} = props
|
21
24
|
|
25
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
26
|
+
|
22
27
|
const displayValue = function(value: string | number) {
|
23
28
|
if (value || value === 0) {
|
24
29
|
return (
|
@@ -47,6 +52,7 @@ const StatValue = (props: StatValueProps): React.ReactElement => {
|
|
47
52
|
<div
|
48
53
|
className={classnames('pb_stat_value_kit', globalProps(props), className)}
|
49
54
|
id={id}
|
55
|
+
{...htmlProps}
|
50
56
|
>
|
51
57
|
<div className="pb_stat_value_wrapper">
|
52
58
|
{displayValue(value)}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useEffect } from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
|
-
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
3
|
+
import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
|
4
4
|
import { globalProps } from '../utilities/globalProps'
|
5
5
|
import PbTable from '.'
|
6
6
|
|
@@ -14,6 +14,7 @@ type TableProps = {
|
|
14
14
|
data?: { [key: string]: string },
|
15
15
|
dataTable: boolean,
|
16
16
|
disableHover: boolean,
|
17
|
+
htmlOptions?: {[key: string]: string | number | boolean | Function},
|
17
18
|
id?: string,
|
18
19
|
responsive: "collapse" | "scroll" | "none",
|
19
20
|
singleLine: boolean,
|
@@ -33,6 +34,7 @@ const Table = (props: TableProps) => {
|
|
33
34
|
data = {},
|
34
35
|
dataTable = false,
|
35
36
|
disableHover = false,
|
37
|
+
htmlOptions = {},
|
36
38
|
id,
|
37
39
|
responsive = 'collapse',
|
38
40
|
singleLine = false,
|
@@ -43,6 +45,7 @@ const Table = (props: TableProps) => {
|
|
43
45
|
|
44
46
|
const ariaProps = buildAriaProps(aria)
|
45
47
|
const dataProps = buildDataProps(data)
|
48
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
46
49
|
const tableCollapseCss = responsive !== 'none' ? `table-collapse-${collapse}` : ''
|
47
50
|
const verticalBorderCss = verticalBorder ? 'vertical-border' : ''
|
48
51
|
|
@@ -55,6 +58,7 @@ const Table = (props: TableProps) => {
|
|
55
58
|
<table
|
56
59
|
{...ariaProps}
|
57
60
|
{...dataProps}
|
61
|
+
{...htmlProps}
|
58
62
|
className={classnames(
|
59
63
|
'pb_table',
|
60
64
|
`table-${size}`,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
|
-
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
3
|
+
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
4
4
|
import { globalProps } from '../utilities/globalProps'
|
5
5
|
|
6
6
|
type TableRowPropTypes = {
|
@@ -8,6 +8,7 @@ type TableRowPropTypes = {
|
|
8
8
|
children: React.ReactNode[] | React.ReactNode,
|
9
9
|
className: string,
|
10
10
|
data?: { [key: string]: string },
|
11
|
+
htmlOptions?: {[key: string]: string | number | boolean | Function},
|
11
12
|
id?: string,
|
12
13
|
sideHighlightColor: string,
|
13
14
|
}
|
@@ -18,12 +19,14 @@ const TableRow = (props: TableRowPropTypes) => {
|
|
18
19
|
children,
|
19
20
|
className,
|
20
21
|
data = {},
|
22
|
+
htmlOptions = {},
|
21
23
|
id,
|
22
24
|
sideHighlightColor = 'windows',
|
23
25
|
} = props
|
24
26
|
|
25
27
|
const ariaProps = buildAriaProps(aria)
|
26
28
|
const dataProps = buildDataProps(data)
|
29
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
27
30
|
const sideHighlightClass =
|
28
31
|
sideHighlightColor != '' ? `side_highlight_${sideHighlightColor}` : null
|
29
32
|
const classes = classnames(buildCss('pb_table_row_kit', sideHighlightClass), globalProps(props), className)
|
@@ -32,6 +35,7 @@ const TableRow = (props: TableRowPropTypes) => {
|
|
32
35
|
<tr
|
33
36
|
{...ariaProps}
|
34
37
|
{...dataProps}
|
38
|
+
{...htmlProps}
|
35
39
|
className={classes}
|
36
40
|
id={id}
|
37
41
|
>
|
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react'
|
|
2
2
|
import classnames from 'classnames'
|
3
3
|
|
4
4
|
import { globalProps, GlobalProps, domSafeProps } from '../utilities/globalProps'
|
5
|
-
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
5
|
+
import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
|
6
6
|
|
7
7
|
import Flex from '../pb_flex/_flex'
|
8
8
|
import Card from '../pb_card/_card'
|
@@ -17,6 +17,7 @@ type TextInputProps = {
|
|
17
17
|
dark?: boolean,
|
18
18
|
disabled?: boolean,
|
19
19
|
error?: string,
|
20
|
+
htmlOptions?: {[key: string]: string | number | boolean | Function},
|
20
21
|
id?: string,
|
21
22
|
inline?: boolean,
|
22
23
|
name: string,
|
@@ -43,6 +44,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
43
44
|
data = {},
|
44
45
|
disabled,
|
45
46
|
error,
|
47
|
+
htmlOptions = {},
|
46
48
|
id,
|
47
49
|
inline = false,
|
48
50
|
name,
|
@@ -57,6 +59,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
57
59
|
|
58
60
|
const ariaProps = buildAriaProps(aria)
|
59
61
|
const dataProps = buildDataProps(data)
|
62
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
60
63
|
|
61
64
|
const { alignment, border, icon } = addOn
|
62
65
|
const addOnAlignment = alignment === 'left' ? 'left' : 'right'
|
@@ -138,6 +141,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
138
141
|
<div
|
139
142
|
{...ariaProps}
|
140
143
|
{...dataProps}
|
144
|
+
{...htmlProps}
|
141
145
|
className={css}
|
142
146
|
>
|
143
147
|
{label &&
|
@@ -0,0 +1,35 @@
|
|
1
|
+
![text-input-add-on](https://github.com/powerhome/playbook/assets/92755007/65a28e6a-9e65-4ca1-af8d-91dae6eac4f5)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
PBTextInput(
|
6
|
+
"ADD ON WITH DEFAULTS",
|
7
|
+
text: $textAddOn,
|
8
|
+
style: .rightIcon(.user, divider: true)
|
9
|
+
)
|
10
|
+
|
11
|
+
PBTextInput(
|
12
|
+
"RIGHT-ALIGNED ADD ON WITH BORDER",
|
13
|
+
text: $textAddOnRight,
|
14
|
+
style: .rightIcon(.user, divider: true)
|
15
|
+
)
|
16
|
+
|
17
|
+
PBTextInput(
|
18
|
+
"RIGHT-ALIGNED ADD ON WITH NO BORDER",
|
19
|
+
text: $textAddOnRightNoBorder,
|
20
|
+
style: .rightIcon(.user, divider: false)
|
21
|
+
)
|
22
|
+
|
23
|
+
PBTextInput(
|
24
|
+
"LEFT-ALIGNED ADD ON WITH NO BORDER",
|
25
|
+
text: $textAddOnLeft,
|
26
|
+
style: .leftIcon(.user, divider: false)
|
27
|
+
)
|
28
|
+
|
29
|
+
PBTextInput(
|
30
|
+
"LEFT-ALIGNED ADD ON WITH BORDER",
|
31
|
+
text: $textAddOnLeftNoBorder,
|
32
|
+
style: .leftIcon(.user, divider: true)
|
33
|
+
)
|
34
|
+
|
35
|
+
```
|
@@ -0,0 +1,29 @@
|
|
1
|
+
![text-input-default](https://github.com/powerhome/playbook/assets/92755007/625a246e-9d5c-42ea-8c6e-7afcf0984c9a)
|
2
|
+
|
3
|
+
|
4
|
+
```swift
|
5
|
+
|
6
|
+
@State private var textFirstName: String = ""
|
7
|
+
@State private var textLastName: String = ""
|
8
|
+
@State private var textPhone: String = ""
|
9
|
+
|
10
|
+
PBTextInput(
|
11
|
+
"First name",
|
12
|
+
text: $textFirstName,
|
13
|
+
placeholder: "Enter first name"
|
14
|
+
)
|
15
|
+
|
16
|
+
PBTextInput(
|
17
|
+
"Last name",
|
18
|
+
text: $textLastName,
|
19
|
+
placeholder: "Enter last name"
|
20
|
+
)
|
21
|
+
|
22
|
+
PBTextInput(
|
23
|
+
"Phone number",
|
24
|
+
text: $textPhone,
|
25
|
+
placeholder: "Enter phone number",
|
26
|
+
keyboardType: .phonePad
|
27
|
+
)
|
28
|
+
|
29
|
+
```
|
@@ -0,0 +1,24 @@
|
|
1
|
+
![text-input-error](https://github.com/powerhome/playbook/assets/92755007/7c664f75-1d7a-4a94-bc59-6f845a68ce19)
|
2
|
+
|
3
|
+
|
4
|
+
```swift
|
5
|
+
|
6
|
+
@State private var textError: String = ""
|
7
|
+
@State private var textConfirmError: String = ""
|
8
|
+
|
9
|
+
PBTextInput(
|
10
|
+
"Email address",
|
11
|
+
text: $textError,
|
12
|
+
placeholder: "Enter email address",
|
13
|
+
error: (true, "Insert a valid email"),
|
14
|
+
style: .leftIcon(.user, divider: true)
|
15
|
+
)
|
16
|
+
|
17
|
+
PBTextInput(
|
18
|
+
"Confirm email address",
|
19
|
+
text: $textConfirmError,
|
20
|
+
placeholder: "Confirm email address",
|
21
|
+
style: .leftIcon(.user, divider: true)
|
22
|
+
)
|
23
|
+
|
24
|
+
```
|
@@ -0,0 +1,13 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **title** | `String` | Adds a title | `nil` | |
|
5
|
+
| **placeholder** | `String` | Adds placeholder text | `""` | |
|
6
|
+
| **error** | `(Bool, String)` | Changes the style of the Text Input | `nil` | |
|
7
|
+
| **style** | `Style` | Changes the style of the Text Input | `.default` | `.default` `.rightIcon` `.leftIcon` `.inline` `.disabled` |
|
8
|
+
| **onChange** | `Bool` | Adds an event handler | `nil` | |
|
9
|
+
| **keyboardType** | `UIKeyboardType` | Speficies the keyboard type (ios only) | `.default` | |
|
10
|
+
| **text** | `String` | Sets the Text Input's text value | | |
|
11
|
+
| **selected** | `Bool` | Changes the style of the Text Input | | `true` `false` |
|
12
|
+
| **isHovering** | `Bool` | Changes the style of the Text Input | `false` | `true` `false` |
|
13
|
+
| **isIconHovering** | `Bool` | Changes the style of the Text Input | `false` | `true` `false` |
|
@@ -16,3 +16,10 @@ examples:
|
|
16
16
|
- text_input_add_on: Add On
|
17
17
|
- text_input_inline: Inline
|
18
18
|
- text_input_no_label: No Label
|
19
|
+
|
20
|
+
swift:
|
21
|
+
- text_input_default_swift: Default
|
22
|
+
- text_input_error_swift: With Error
|
23
|
+
- text_input_disabled_swift: Disabled
|
24
|
+
- text_input_add_on_swift: Add On
|
25
|
+
- text_input_props_swift: ""
|