playbook_ui 13.11.1 → 13.12.0.pre.alpha.PLAY880cardkithighlightzindex1655
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +0 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible_content.rb +3 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_external_controls.html.erb +22 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_external_controls.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_external_controls_multiple.html.erb +40 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_external_controls_multiple.md +1 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_collapsible/index.js +4 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_border_swift.md +7 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_default_swift.md +7 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_flip_swift.md +11 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_props_swift.md +8 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_rotate_swift.md +11 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_sizes_swift.md +46 -0
- data/app/pb_kits/playbook/pb_icon/docs/example.yml +8 -0
- data/app/pb_kits/playbook/pb_image/docs/_image_props_swift.md +7 -0
- data/app/pb_kits/playbook/pb_image/docs/_rounded_image_swift.md +47 -0
- data/app/pb_kits/playbook/pb_image/docs/_size_image_swift.md +47 -0
- data/app/pb_kits/playbook/pb_image/docs/_size_none_image_swift.md +15 -0
- data/app/pb_kits/playbook/pb_image/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_label_value/docs/_label_value_default_swift.md +11 -0
- data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details_examples_swift.md +72 -0
- data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details_swift.md +41 -0
- data/app/pb_kits/playbook/pb_label_value/docs/_label_value_props_swift.md +11 -0
- data/app/pb_kits/playbook/pb_label_value/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_message/docs/_message_default_swift.md +57 -0
- data/app/pb_kits/playbook/pb_message/docs/_message_props_swift.md +12 -0
- data/app/pb_kits/playbook/pb_message/docs/example.yml +4 -0
- 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/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_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_table/docs/_table_header.html.erb +4 -4
- data/app/pb_kits/playbook/pb_table/styles/_hover.scss +26 -2
- data/app/pb_kits/playbook/pb_table/styles/_table-dark.scss +1 -17
- data/app/pb_kits/playbook/pb_table/table_header.html.erb +4 -3
- data/app/pb_kits/playbook/pb_table/table_header.rb +28 -5
- 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/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_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 +25 -9
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default_react.jsx +0 -2
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay.jsx +0 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.jsx +0 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_margin.jsx +0 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_selectors.html.erb +1 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb +39 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.md +5 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip_react.jsx +45 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip_react.md +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +6 -0
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +2 -1
- data/app/pb_kits/playbook/pb_tooltip/tooltip.test.jsx +34 -0
- data/app/pb_kits/playbook/playbook-doc.js +1 -1
- data/dist/playbook-rails.js +3 -3
- data/lib/playbook/version.rb +2 -2
- metadata +56 -7
@@ -10,3 +10,9 @@ examples:
|
|
10
10
|
- multiple_users_default: Default
|
11
11
|
- multiple_users_reverse: Reverse
|
12
12
|
- multiple_users_size: Size
|
13
|
+
|
14
|
+
swift:
|
15
|
+
- multiple_users_default_swift: Default
|
16
|
+
- multiple_users_reverse_swift: Reverse
|
17
|
+
- multiple_users_size_swift: Small
|
18
|
+
- multiple_users_props_swift: ""
|
data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_default_swift.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
let oneUser = [andrew]
|
6
|
+
let twoUsers = [andrew, picAndrew]
|
7
|
+
let multipleUsers = [andrew, picAndrew, andrew, andrew]
|
8
|
+
|
9
|
+
HStack(spacing: Spacing.xSmall) {
|
10
|
+
PBMultipleUsersStacked(users: oneUser, size: .default)
|
11
|
+
PBMultipleUsersStacked(users: twoUsers, size: .default)
|
12
|
+
PBMultipleUsersStacked(users: multipleUsers, size: .default)
|
13
|
+
}
|
14
|
+
|
15
|
+
```
|
data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_props_swift.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **Users** | `[PBUser]` | Sets the user's avatars | | |
|
5
|
+
| **Size** | `Size` | Changes the size of the avatars | `.small` | `.default` `.small` `.xSmall` |
|
data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_small_swift.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
let oneUser = [andrew]
|
6
|
+
let twoUsers = [andrew, picAndrew]
|
7
|
+
let multipleUsers = [andrew, picAndrew, andrew, andrew]
|
8
|
+
|
9
|
+
HStack(spacing: Spacing.xSmall) {
|
10
|
+
PBMultipleUsersStacked(users: oneUser)
|
11
|
+
PBMultipleUsersStacked(users: twoUsers)
|
12
|
+
PBMultipleUsersStacked(users: multipleUsers)
|
13
|
+
}
|
14
|
+
|
15
|
+
```
|
data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_xsmall_swift.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
let oneUser = [andrew]
|
6
|
+
let twoUsers = [andrew, picAndrew]
|
7
|
+
let multipleUsers = [andrew, picAndrew, andrew, andrew]
|
8
|
+
|
9
|
+
HStack(spacing: Spacing.xSmall) {
|
10
|
+
PBMultipleUsersStacked(users: oneUser, size: .xSmall)
|
11
|
+
PBMultipleUsersStacked(users: twoUsers, size: .xSmall)
|
12
|
+
PBMultipleUsersStacked(users: multipleUsers, size: .xSmall)
|
13
|
+
}
|
14
|
+
|
15
|
+
```
|
@@ -6,3 +6,9 @@ examples:
|
|
6
6
|
|
7
7
|
react:
|
8
8
|
- multiple_users_stacked_default: Default
|
9
|
+
|
10
|
+
swift:
|
11
|
+
- multiple_users_stacked_default_swift: Default
|
12
|
+
- multiple_users_stacked_small_swift: Small
|
13
|
+
- multiple_users_stacked_xsmall_swift: xSmall
|
14
|
+
- multiple_users_stacked_props_swift: ""
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+

|
3
|
+
|
4
|
+
```swift
|
5
|
+
|
6
|
+
PBSectionSeparator(variant: .dashed) {
|
7
|
+
PBCard(alignment: .center, borderRadius: BorderRadius.rounded, padding: Spacing.xxSmall, width: 70) {
|
8
|
+
Text("Today")
|
9
|
+
.pbFont(.caption)
|
10
|
+
.frame(maxWidth: .infinity, alignment: .center)
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
```
|
@@ -0,0 +1,8 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **text** | `String` | Adds text to the Section Separator | `nil` | |
|
5
|
+
| **orientation** | `Orientation` | Changes the orientation | `.horizontal` | `.horizontal` `.vertical` |
|
6
|
+
| **variant** | `Variant` | Changes the style of the Section Separator | `.card` | `.dashed` `.card` |
|
7
|
+
| **dividerOpacity** | `CGFloat` | Adjusts the opacity of the divider | `1` | |
|
8
|
+
| **margin** | `CGFloat` | Adds margin between text and the divider | `Spacing.xSmall` | `Spacing.none` `Spacing.xxSmall` `Spacing.xSmall` `Spacing.small` `Spacing.medium` `Spacing.large` `Spacing.xLarge` |
|
@@ -0,0 +1,18 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
let loremIpsum: some View = Text(
|
6
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididt labore et dolore"
|
7
|
+
)
|
8
|
+
|
9
|
+
HStack(spacing: Spacing.none) {
|
10
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididt labore et dolore"
|
11
|
+
PBSectionSeparator(orientation: .vertical)
|
12
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididt labore et dolore"
|
13
|
+
}
|
14
|
+
.frame(maxWidth: .infinity)
|
15
|
+
.frame(height: 120, alignment: .center)
|
16
|
+
.listRowSeparator(.hidden)
|
17
|
+
|
18
|
+
```
|
@@ -13,3 +13,11 @@ examples:
|
|
13
13
|
- section_separator_text: Text Separator
|
14
14
|
- section_separator_vertical: Vertical
|
15
15
|
- section_separator_children: Children
|
16
|
+
|
17
|
+
swift:
|
18
|
+
- section_separator_line_swift: Line Separator
|
19
|
+
- section_separator_dashed_swift: Dashed Separator
|
20
|
+
- section_separator_text_swift: Text Separator
|
21
|
+
- section_separator_vertical_swift: Vertical
|
22
|
+
- section_separator_children_swift: Children
|
23
|
+
- section_separator_props_swift: ""
|
@@ -39,10 +39,10 @@
|
|
39
39
|
text: "Full Name",
|
40
40
|
colspan: 2,
|
41
41
|
sort_menu: [
|
42
|
-
{ item: "First Name
|
43
|
-
{ item: "First Name
|
44
|
-
{ item: "Last Name
|
45
|
-
{ item: "Last Name
|
42
|
+
{ item: "First Name", link: "?sort=firstname_desc#table-header", active: params["sort"] == "firstname_desc", direction: "desc" },
|
43
|
+
{ item: "First Name", link: "?sort=firstname_asc#table-header", active: params["sort"] == "firstname_asc", direction: "asc" },
|
44
|
+
{ item: "Last Name", link: "?sort=lastname_desc#table-header", active: params["sort"] == "lastname_desc", direction: "desc" },
|
45
|
+
{ item: "Last Name", link: "?sort=lastname_asc#table-header", active: params["sort"] == "lastname_asc", direction: "asc" }
|
46
46
|
],
|
47
47
|
}) %>
|
48
48
|
<%= pb_rails("table/table_header", props: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
@import "../../tokens/opacity";
|
2
2
|
|
3
3
|
$transition-speed: 0.2s;
|
4
|
+
$border_hover_color_dark: lighten($border_dark, 5%);
|
4
5
|
|
5
6
|
[class^=pb_table] {
|
6
7
|
&.table-sm,
|
@@ -15,9 +16,9 @@ $transition-speed: 0.2s;
|
|
15
16
|
td {
|
16
17
|
border-top-color: transparent;
|
17
18
|
border-top-width: 0;
|
18
|
-
transition: all $transition-speed ease;
|
19
|
+
transition: all $transition-speed ease;
|
19
20
|
}
|
20
|
-
@media (hover:hover) {
|
21
|
+
@media (hover:hover) {
|
21
22
|
td {
|
22
23
|
position: relative;
|
23
24
|
&:after {
|
@@ -69,6 +70,29 @@ $transition-speed: 0.2s;
|
|
69
70
|
}
|
70
71
|
}
|
71
72
|
}
|
73
|
+
|
74
|
+
&.dark {
|
75
|
+
tbody {
|
76
|
+
tr {
|
77
|
+
@media (hover:hover) {
|
78
|
+
&:hover {
|
79
|
+
box-shadow: 0 2px 10px 0 $shadow_dark;
|
80
|
+
td {
|
81
|
+
border-top-width: 0;
|
82
|
+
border-top-color: transparent;
|
83
|
+
border-color: $border_hover_color_dark !important;
|
84
|
+
&:after {
|
85
|
+
transition: background-color $transition-speed ease, height $transition-speed ease;
|
86
|
+
background-color: $border_hover_color_dark !important;
|
87
|
+
height: 1px;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
72
96
|
}
|
73
97
|
}
|
74
98
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
@import "../../tokens/screen_sizes";
|
2
2
|
|
3
|
-
$table-dark-card-bg: $
|
3
|
+
$table-dark-card-bg: $card_dark;
|
4
4
|
|
5
5
|
[class^=pb_table] {
|
6
6
|
&.table-sm,
|
@@ -24,7 +24,6 @@ $table-dark-card-bg: $bg_dark;
|
|
24
24
|
|
25
25
|
td {
|
26
26
|
border-color: $border_dark !important;
|
27
|
-
border-bottom-width: 0 !important;
|
28
27
|
color: $white;
|
29
28
|
|
30
29
|
&:before {
|
@@ -39,21 +38,6 @@ $table-dark-card-bg: $bg_dark;
|
|
39
38
|
}
|
40
39
|
}
|
41
40
|
|
42
|
-
&:not(.no-hover) {
|
43
|
-
tbody {
|
44
|
-
tr {
|
45
|
-
@media (hover:hover) {
|
46
|
-
&:hover {
|
47
|
-
td {
|
48
|
-
border-color: $border_dark !important;
|
49
|
-
background: $bg_dark;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
41
|
&.table-card {
|
58
42
|
background: $table-dark-card-bg !important;
|
59
43
|
}
|
@@ -28,15 +28,16 @@
|
|
28
28
|
position: object.placement ,
|
29
29
|
padding: 'none'}) do %>
|
30
30
|
<%= pb_rails("nav", props: {classname: "pb_table_header_dropdown"}) do %>
|
31
|
-
<% object.
|
31
|
+
<% object.sort_items.each do |sort_item| %>
|
32
|
+
<% item = active_or_first_item(sort_items_for(sort_item)) %>
|
32
33
|
<%= pb_rails("nav/item", props: {
|
33
34
|
text: item[:item],
|
34
|
-
link:
|
35
|
+
link: next_link(sort_item: sort_item),
|
35
36
|
highlighted_border: false,
|
36
37
|
padding: "xs",
|
37
38
|
icon_right: sort_icon(item[:direction], item[:active]),
|
38
39
|
active: item[:active],
|
39
|
-
classname: "header_nav_item
|
40
|
+
classname: "header_nav_item"
|
40
41
|
}) %>
|
41
42
|
<% end %>
|
42
43
|
<% end %>
|
@@ -32,20 +32,43 @@ module Playbook
|
|
32
32
|
align.present? ? "align_#{align}" : nil
|
33
33
|
end
|
34
34
|
|
35
|
-
def next_link
|
36
|
-
|
35
|
+
def next_link(sort_item: "")
|
36
|
+
sort_menu_for = if sort_item.blank?
|
37
|
+
sort_menu
|
38
|
+
else
|
39
|
+
sort_items_for(sort_item)
|
40
|
+
end
|
41
|
+
|
42
|
+
return sort_menu_for[0][:link] if sort_menu_for.all? { |item| item[:active] == false }
|
37
43
|
|
38
44
|
link = ""
|
39
45
|
|
40
|
-
|
46
|
+
sort_menu_for.each_with_index do |item, index|
|
41
47
|
if item[:active] == true
|
42
|
-
next_index = (index + 1) %
|
43
|
-
link =
|
48
|
+
next_index = (index + 1) % sort_menu_for.length
|
49
|
+
link = sort_menu_for[next_index][:link]
|
44
50
|
end
|
45
51
|
end
|
46
52
|
link
|
47
53
|
end
|
48
54
|
|
55
|
+
def sort_items
|
56
|
+
sort_menu.map { |hash| hash[:item] }.uniq
|
57
|
+
end
|
58
|
+
|
59
|
+
def sort_items_for(sort_item)
|
60
|
+
sort_menu.find_all { |hash| hash[:item] == sort_item }
|
61
|
+
end
|
62
|
+
|
63
|
+
def active_or_first_item(items)
|
64
|
+
active_item = items.find { |hash| hash[:active] == true }
|
65
|
+
if active_item.present?
|
66
|
+
active_item
|
67
|
+
else
|
68
|
+
items[0]
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
49
72
|
def sorting_style?
|
50
73
|
sort_menu != [{}]
|
51
74
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+

|
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
|
+

|
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
|
+

|
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: ""
|
@@ -0,0 +1,27 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
@State var defaultText = ""
|
6
|
+
@State var placeholderText = ""
|
7
|
+
@State var customText = "Default value text"
|
8
|
+
|
9
|
+
VStack(alignment: .leading, spacing: Spacing.small) {
|
10
|
+
PBTextArea(
|
11
|
+
"Label",
|
12
|
+
text: $defaultText
|
13
|
+
)
|
14
|
+
|
15
|
+
PBTextArea(
|
16
|
+
"Label",
|
17
|
+
text: $placeholderText,
|
18
|
+
placeholder: "Placeholder with text"
|
19
|
+
)
|
20
|
+
|
21
|
+
PBTextArea(
|
22
|
+
"Label",
|
23
|
+
text: $customText
|
24
|
+
)
|
25
|
+
}
|
26
|
+
|
27
|
+
```
|
@@ -0,0 +1,9 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **characterCount** | `CharacterCount` | Adds a character counter to the Textarea | `.noCount` | `.noCount` `.count` `.maxCharacterCount` `.maxCharacterCountBlock` `.maxCharacterCountError` |
|
5
|
+
| **inline** | `Bool` | Changes the style of the Textarea | `false` | `true` `false` |
|
6
|
+
| **label** | `String` | Adds a label | `nil` | |
|
7
|
+
| **placeholder** | `String` | Adds placeholder text | `nil` | |
|
8
|
+
| **text** | `String` | Sets the Textarea's text value | `Binding<String>` | |
|
9
|
+
| **error** | `String` | Changes the style of the Textarea | `nil` | |
|
@@ -0,0 +1,6 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **isHovering** | `Bool` | Changes the style of the Toggle | `false` | `true` `false` |
|
5
|
+
| **label** | `String` | Adds a label to the Toggle | `nil` | |
|
6
|
+
| **checked** | `Bool` | Changes the style of the Toggle | | `true` `false` |
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useRef, useState } from "react"
|
1
|
+
import React, { useRef, useState, forwardRef, ForwardedRef } from "react"
|
2
2
|
|
3
3
|
import {
|
4
4
|
arrow,
|
@@ -28,9 +28,10 @@ type TooltipProps = {
|
|
28
28
|
placement?: Placement,
|
29
29
|
position?: "absolute" | "fixed";
|
30
30
|
text: string,
|
31
|
+
showTooltip?: boolean,
|
31
32
|
} & GlobalProps
|
32
33
|
|
33
|
-
const Tooltip = (props: TooltipProps): React.ReactElement => {
|
34
|
+
const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): React.ReactElement => {
|
34
35
|
const {
|
35
36
|
aria = {},
|
36
37
|
className,
|
@@ -42,6 +43,7 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
|
|
42
43
|
placement: preferredPlacement = "top",
|
43
44
|
position = "absolute",
|
44
45
|
text,
|
46
|
+
showTooltip = true,
|
45
47
|
zIndex,
|
46
48
|
...rest
|
47
49
|
} = props
|
@@ -59,10 +61,9 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
|
|
59
61
|
|
60
62
|
const {
|
61
63
|
context,
|
62
|
-
floating,
|
63
64
|
middlewareData: { arrow: { x: arrowX, y: arrowY } = {}, },
|
64
65
|
placement,
|
65
|
-
|
66
|
+
refs,
|
66
67
|
strategy,
|
67
68
|
x,
|
68
69
|
y,
|
@@ -82,12 +83,16 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
|
|
82
83
|
],
|
83
84
|
open,
|
84
85
|
onOpenChange(open) {
|
85
|
-
|
86
|
+
if(!showTooltip) {
|
87
|
+
return
|
88
|
+
} else {
|
89
|
+
setOpen(open)
|
90
|
+
}
|
86
91
|
},
|
87
92
|
placement: preferredPlacement
|
88
93
|
})
|
89
94
|
|
90
|
-
|
95
|
+
|
91
96
|
const { getFloatingProps } = useInteractions([
|
92
97
|
useHover(context, {
|
93
98
|
delay,
|
@@ -108,7 +113,16 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
|
|
108
113
|
<>
|
109
114
|
<div
|
110
115
|
className={`pb_tooltip_kit ${css}`}
|
111
|
-
ref={
|
116
|
+
ref={(element) => {
|
117
|
+
refs.setReference(element);
|
118
|
+
if (ref) {
|
119
|
+
if (typeof ref === "function") {
|
120
|
+
ref(element);
|
121
|
+
} else if (typeof ref === "object") {
|
122
|
+
ref.current = element;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}}
|
112
126
|
role="tooltip_trigger"
|
113
127
|
style={{ display: "inline-flex" }}
|
114
128
|
{...ariaProps}
|
@@ -120,7 +134,7 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
|
|
120
134
|
<div
|
121
135
|
{...getFloatingProps({
|
122
136
|
className: `tooltip_tooltip ${placement} visible`,
|
123
|
-
ref:
|
137
|
+
ref: refs.setFloating,
|
124
138
|
role: "tooltip",
|
125
139
|
style: {
|
126
140
|
position: strategy,
|
@@ -153,6 +167,8 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
|
|
153
167
|
)}
|
154
168
|
</>
|
155
169
|
)
|
156
|
-
}
|
170
|
+
})
|
171
|
+
|
172
|
+
Tooltip.displayName = "Tooltip"
|
157
173
|
|
158
174
|
export default Tooltip
|