playbook_ui 12.36.0 → 12.37.0.pre.alpha.PLAY951collapsiblenav31073
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/index.js +2 -1
- data/app/pb_kits/playbook/pb_badge/docs/_badge_colors_swift.md +33 -0
- data/app/pb_kits/playbook/pb_badge/docs/_badge_default_swift.md +9 -0
- data/app/pb_kits/playbook/pb_badge/docs/_badge_notification_swift.md +9 -0
- data/app/pb_kits/playbook/pb_badge/docs/_badge_props_swift.md +6 -0
- data/app/pb_kits/playbook/pb_badge/docs/_badge_rounded_swift.md +9 -0
- data/app/pb_kits/playbook/pb_badge/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +6 -0
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +15 -13
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +25 -8
- data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +1 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +2 -2
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +11 -4
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.md +1 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_size.jsx +5 -5
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +75 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -6
- data/app/pb_kits/playbook/pb_collapsible/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_collapsible/useCollapsible.tsx +14 -0
- data/app/pb_kits/playbook/pb_date/_date.tsx +7 -8
- data/app/pb_kits/playbook/pb_date/docs/_date_alignment.jsx +2 -2
- data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +29 -5
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +2 -2
- data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +5 -5
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +45 -31
- data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +5 -3
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +24 -21
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +1 -1
- data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +1 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +2 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +1 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +6 -8
- data/app/pb_kits/playbook/pb_kit/dateTime.ts +146 -63
- data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +52 -31
- data/app/pb_kits/playbook/pb_message/_message.tsx +24 -24
- data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +273 -3
- data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +6 -0
- data/app/pb_kits/playbook/pb_nav/_item.tsx +47 -10
- data/app/pb_kits/playbook/pb_nav/_mixins.scss +5 -0
- data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +6 -7
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +13 -6
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +58 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +23 -0
- data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_custom_icons.jsx → _collapsible_nav_emphasize.jsx} +18 -11
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +5 -3
- data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_nav/item.html.erb +5 -4
- data/app/pb_kits/playbook/pb_nav/item.rb +25 -2
- data/app/pb_kits/playbook/pb_pill/docs/_pill_default_swift.md +5 -0
- data/app/pb_kits/playbook/pb_pill/docs/_pill_props_swift.md +5 -0
- data/app/pb_kits/playbook/pb_pill/docs/_pill_variants_swift.md +10 -0
- data/app/pb_kits/playbook/pb_pill/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_alignment_swift.md +16 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_swift.md +18 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_default_swift.md +15 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_error_swift.md +14 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_orientation_swift.md +15 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_padding_swift.md +31 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_props_swift.md +10 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_spacing_swift.md +36 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_subtitle_swift.md +13 -0
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +11 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_options.html.erb +12 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +1 -1
- data/app/pb_kits/playbook/pb_time/_time.tsx +9 -11
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +46 -49
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +4 -6
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +11 -11
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align_swift.md +45 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default_swift.md +26 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed_swift.md +25 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_props_swift.md +10 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones_swift.md +67 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_swift.md +19 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/example.yml +8 -0
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +8 -11
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/version.rb +2 -2
- metadata +41 -9
- data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +0 -120
@@ -1,14 +1,16 @@
|
|
1
1
|
import React from "react";
|
2
|
-
|
3
|
-
import Nav from "../_nav";
|
4
|
-
import NavItem from "../_item";
|
2
|
+
import { Nav, NavItem } from '../..'
|
5
3
|
|
6
4
|
const CollapsibleNav = (props) => {
|
7
5
|
return (
|
8
|
-
<Nav
|
6
|
+
<Nav>
|
9
7
|
<NavItem
|
8
|
+
active
|
10
9
|
collapsible
|
10
|
+
collapsibleTrail
|
11
|
+
fontWeight="bold"
|
11
12
|
iconLeft="city"
|
13
|
+
iconRight={["plus", "minus"]}
|
12
14
|
link="#"
|
13
15
|
text="Overview"
|
14
16
|
{...props}
|
@@ -30,9 +32,11 @@ const CollapsibleNav = (props) => {
|
|
30
32
|
/>
|
31
33
|
</NavItem>
|
32
34
|
<NavItem
|
33
|
-
active
|
34
35
|
collapsible
|
36
|
+
collapsibleTrail
|
37
|
+
// fontWeight="bold"
|
35
38
|
iconLeft="theater-masks"
|
39
|
+
iconRight={["plus", "minus"]}
|
36
40
|
link="#"
|
37
41
|
text="Albums"
|
38
42
|
{...props}
|
@@ -55,7 +59,10 @@ const CollapsibleNav = (props) => {
|
|
55
59
|
</NavItem>
|
56
60
|
<NavItem
|
57
61
|
collapsible
|
62
|
+
collapsibleTrail
|
63
|
+
// fontWeight="bold"
|
58
64
|
iconLeft="city"
|
65
|
+
iconRight={["plus", "minus"]}
|
59
66
|
link="#"
|
60
67
|
text="Similar Artists"
|
61
68
|
{...props}
|
@@ -80,4 +87,4 @@ const CollapsibleNav = (props) => {
|
|
80
87
|
);
|
81
88
|
};
|
82
89
|
|
83
|
-
export default CollapsibleNav
|
90
|
+
export default CollapsibleNav
|
@@ -0,0 +1 @@
|
|
1
|
+
The `collapsible` prop allows users to create a nested, collapsible nav. Pass `collapsible` to NavItem and nest as many more NavItems as needed as children for that NavItem to see this in action.
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import { Nav, NavItem, useCollapsible } from "../.."
|
3
|
+
|
4
|
+
const CollapsibleNavCustom = (props) => {
|
5
|
+
const navItems = ["Overview", "Albums", "Similar Artists"]
|
6
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
7
|
+
const collapsibles = navItems.map(() => useCollapsible(true))
|
8
|
+
|
9
|
+
const handleMainClick = (index) => {
|
10
|
+
collapsibles.forEach(([, , setCollapsed], idx) => {
|
11
|
+
if (idx === index) {
|
12
|
+
setCollapsed(false)
|
13
|
+
} else {
|
14
|
+
setCollapsed(true)
|
15
|
+
}
|
16
|
+
})
|
17
|
+
}
|
18
|
+
|
19
|
+
return (
|
20
|
+
<>
|
21
|
+
<Nav variant='bold'>
|
22
|
+
{navItems.map((text, index) => {
|
23
|
+
const [collapsed] = collapsibles[index]
|
24
|
+
return (
|
25
|
+
<NavItem
|
26
|
+
collapsed={collapsed}
|
27
|
+
collapsible
|
28
|
+
collapsibleTrail
|
29
|
+
fontWeight="bold"
|
30
|
+
iconLeft="chevron-down"
|
31
|
+
id={`collapsible-nav-item-${index + 1}`}
|
32
|
+
key={index}
|
33
|
+
link="#"
|
34
|
+
onClick={() => handleMainClick(index)}
|
35
|
+
text={text}
|
36
|
+
{...props}
|
37
|
+
>
|
38
|
+
<NavItem link="#"
|
39
|
+
text="City"
|
40
|
+
{...props}
|
41
|
+
/>
|
42
|
+
<NavItem link="#"
|
43
|
+
text="People"
|
44
|
+
{...props}
|
45
|
+
/>
|
46
|
+
<NavItem link="#"
|
47
|
+
text="Business"
|
48
|
+
{...props}
|
49
|
+
/>
|
50
|
+
</NavItem>
|
51
|
+
);
|
52
|
+
})}
|
53
|
+
</Nav>
|
54
|
+
</>
|
55
|
+
)
|
56
|
+
}
|
57
|
+
|
58
|
+
export default CollapsibleNavCustom
|
@@ -0,0 +1 @@
|
|
1
|
+
The collapsible nav kit uses our Collapsible kit under the hood and as such the `useCollapsible` hook can be used to achieve custom toggling of the collapsible nav. To do this, you must import and declare the `useCollapsible` hook and pass it's state to the `collapsed` prop. See our code example below to see how this can be done.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%= pb_rails("nav", props: { variant: "subtle" }) do %>
|
2
|
+
<%= pb_rails("nav/item", props: { text: "Overview", link: "#", font_weight:"bold", font_size:"small", collapsible: true, icon_left:"city" }) do %>
|
3
|
+
<%= pb_rails("nav", props: { variant: "subtle" }) do %>
|
4
|
+
<%= pb_rails("nav/item", props: { text: "City", link: "#" }) %>
|
5
|
+
<%= pb_rails("nav/item", props: { text: "People", link: "#" }) %>
|
6
|
+
<%= pb_rails("nav/item", props: { text: "Business", link: "#" }) %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
9
|
+
<%= pb_rails("nav/item", props: { text: "Albums", link: "#", font_weight:"bold", font_size:"small", collapsible: true, icon_left: "theater-masks" }) do %>
|
10
|
+
<%= pb_rails("nav", props: { variant: "subtle" }) do %>
|
11
|
+
<%= pb_rails("nav/item", props: { text: "Entertainment", link: "#" }) %>
|
12
|
+
<%= pb_rails("nav/item", props: { text: "Food", link: "#" }) %>
|
13
|
+
<%= pb_rails("nav/item", props: { text: "Style", link: "#" }) %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<%= pb_rails("nav/item", props: { text: "Similar Artists", link: "#", font_weight:"bold", font_size:"small", collapsible: true, icon_left: "city" }) do %>
|
17
|
+
<%= pb_rails("nav", props: { variant: "subtle" }) do %>
|
18
|
+
<%= pb_rails("nav/item", props: { text: "City", link: "#" }) %>
|
19
|
+
<%= pb_rails("nav/item", props: { text: "People", link: "#" }) %>
|
20
|
+
<%= pb_rails("nav/item", props: { text: "Business", link: "#" }) %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
@@ -1,15 +1,17 @@
|
|
1
1
|
import React from "react";
|
2
|
+
import { Nav, NavItem } from '../..'
|
2
3
|
|
3
|
-
|
4
|
-
import NavItem from "../_item";
|
5
|
-
|
6
|
-
const CollapsibleNavCustomIcons = (props) => {
|
4
|
+
const CollapsibleNavEmphasize = (props) => {
|
7
5
|
return (
|
8
|
-
<Nav variant="
|
6
|
+
<Nav variant="bold">
|
9
7
|
<NavItem
|
10
|
-
|
8
|
+
active
|
9
|
+
collapsible
|
10
|
+
collapsibleTrail
|
11
|
+
fontSize="small"
|
12
|
+
fontWeight="bold"
|
11
13
|
iconLeft="city"
|
12
|
-
iconRight={["
|
14
|
+
iconRight={["plus", "minus"]}
|
13
15
|
link="#"
|
14
16
|
text="Overview"
|
15
17
|
{...props}
|
@@ -31,10 +33,12 @@ const CollapsibleNavCustomIcons = (props) => {
|
|
31
33
|
/>
|
32
34
|
</NavItem>
|
33
35
|
<NavItem
|
34
|
-
active
|
35
36
|
collapsible
|
37
|
+
collapsibleTrail
|
38
|
+
fontSize="small"
|
39
|
+
fontWeight="bold"
|
36
40
|
iconLeft="theater-masks"
|
37
|
-
iconRight={["
|
41
|
+
iconRight={["plus", "minus"]}
|
38
42
|
link="#"
|
39
43
|
text="Albums"
|
40
44
|
{...props}
|
@@ -57,8 +61,11 @@ const CollapsibleNavCustomIcons = (props) => {
|
|
57
61
|
</NavItem>
|
58
62
|
<NavItem
|
59
63
|
collapsible
|
64
|
+
collapsibleTrail
|
65
|
+
fontSize="small"
|
66
|
+
fontWeight="bold"
|
60
67
|
iconLeft="city"
|
61
|
-
iconRight={["
|
68
|
+
iconRight={["plus", "minus"]}
|
62
69
|
link="#"
|
63
70
|
text="Similar Artists"
|
64
71
|
{...props}
|
@@ -83,4 +90,4 @@ const CollapsibleNavCustomIcons = (props) => {
|
|
83
90
|
);
|
84
91
|
};
|
85
92
|
|
86
|
-
export default
|
93
|
+
export default CollapsibleNavEmphasize;
|
@@ -0,0 +1 @@
|
|
1
|
+
The ` navBold` prop can be passed to NavItem
|
@@ -7,7 +7,8 @@ examples:
|
|
7
7
|
- borderless_nav: No Borders
|
8
8
|
- subtle_nav: Subtle Variant
|
9
9
|
- subtle_with_icons_nav: Subtle With Icons
|
10
|
-
|
10
|
+
- collapsible_nav: Collapsible Nav
|
11
|
+
- collapsible_nav_emphasize: Collapsible Nav with Emphasize Styling
|
11
12
|
- subtle_no_highlight_nav: Subtle No Highlight
|
12
13
|
- bold_vertical_nav: Bold Variant
|
13
14
|
- horizontal_nav: Horizontal Nav
|
@@ -25,8 +26,9 @@ examples:
|
|
25
26
|
- borderless_nav: No Borders
|
26
27
|
- subtle_nav: Subtle Variant
|
27
28
|
- subtle_with_icons_nav: Subtle With Icons
|
28
|
-
|
29
|
-
|
29
|
+
- collapsible_nav: Collapsible Nav
|
30
|
+
- collapsible_nav_emphasize: Collapsible Nav with Emphasize Styling
|
31
|
+
- collapsible_nav_custom: Collapsible Nav With Custom Toggling
|
30
32
|
- subtle_no_highlight_nav: Subtle No Highlight
|
31
33
|
- bold_vertical_nav: Bold Variant
|
32
34
|
- horizontal_nav: Horizontal Nav
|
@@ -14,4 +14,5 @@ export { default as NewTab } from './_new_tab.jsx'
|
|
14
14
|
export { default as BoldHorizontalNav } from './_bold_horizontal_nav.jsx'
|
15
15
|
export { default as BoldVerticalNav } from './_bold_vertical_nav.jsx'
|
16
16
|
export { default as CollapsibleNav } from './_collapsible_nav.jsx'
|
17
|
-
export { default as
|
17
|
+
export { default as CollapsibleNavCustom } from './_collapsible_nav_custom.jsx'
|
18
|
+
export { default as CollapsibleNavEmphasize } from "./_collapsible_nav_emphasize.jsx"
|
@@ -2,19 +2,20 @@
|
|
2
2
|
aria: object.aria,
|
3
3
|
class: object.classname,
|
4
4
|
data: object.data,
|
5
|
+
dark: object.dark,
|
5
6
|
id: object.id) do %>
|
6
7
|
<% if object.collapsible %>
|
7
8
|
<%= pb_rails("collapsible", props: { name: "collapsible-nav-example" }) do %>
|
8
|
-
<%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs" }) do %>
|
9
|
+
<%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs", dark: object.dark }) do %>
|
9
10
|
<%= content_tag(object.tag,
|
10
11
|
object.link ? object.link_options : object.options) do %>
|
11
12
|
<% if object.image_url %>
|
12
|
-
<%= pb_rails("image", props: { url: object.image_url, classname: "
|
13
|
+
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper_collapsible" }) %>
|
13
14
|
<% end %>
|
14
15
|
<% if object.icon_left %>
|
15
|
-
<%= pb_rails("icon", props: { icon: object.icon_left, classname: "
|
16
|
+
<%= pb_rails("icon", props: { icon: object.icon_left, classname: "pb_nav_list_item_icon_left_collapsible", fixed_width: true}) %>
|
16
17
|
<% end %>
|
17
|
-
<span class="
|
18
|
+
<span class="pb_nav_list_item_text_collapsible">
|
18
19
|
<%= object.text %>
|
19
20
|
</span>
|
20
21
|
<% end %>
|
@@ -4,9 +4,16 @@ module Playbook
|
|
4
4
|
module PbNav
|
5
5
|
class Item < Playbook::KitBase
|
6
6
|
prop :active, type: Playbook::Props::Boolean, default: false
|
7
|
+
prop :font_size, type: Playbook::Props::Enum,
|
8
|
+
values: %w[normal small],
|
9
|
+
default: "normal"
|
10
|
+
prop :font_weight, type: Playbook::Props::Enum,
|
11
|
+
values: %w[bold regular],
|
12
|
+
default: "regular"
|
7
13
|
prop :collapsible, type: Playbook::Props::Boolean, default: false
|
8
14
|
prop :link
|
9
15
|
prop :text
|
16
|
+
prop :collapsible_trail, type: Playbook::Props::Boolean, default: false
|
10
17
|
prop :icon_left
|
11
18
|
prop :icon_right
|
12
19
|
prop :image_url
|
@@ -14,7 +21,11 @@ module Playbook
|
|
14
21
|
values: %w[_blank _self _parent _top],
|
15
22
|
default: "_self"
|
16
23
|
def classname
|
17
|
-
|
24
|
+
if collapsible
|
25
|
+
"#{generate_classname('pb_nav_list_kit_item', active_class)} #{generate_classname('pb_collapsible_nav_item', active_class, collapsible_trail_class)} #{font_size_class} #{font_weight_class}"
|
26
|
+
else
|
27
|
+
"#{generate_classname('pb_nav_list_kit_item', active_class)} #{font_size_class} #{font_weight_class}"
|
28
|
+
end
|
18
29
|
end
|
19
30
|
|
20
31
|
def tag
|
@@ -23,7 +34,7 @@ module Playbook
|
|
23
34
|
|
24
35
|
def options
|
25
36
|
{
|
26
|
-
class: "pb_nav_list_item_link",
|
37
|
+
class: collapsible ? "pb_nav_list_item_link_collapsible" : "pb_nav_list_item_link",
|
27
38
|
}.compact
|
28
39
|
end
|
29
40
|
|
@@ -43,6 +54,18 @@ module Playbook
|
|
43
54
|
def active_class
|
44
55
|
active ? "active" : nil
|
45
56
|
end
|
57
|
+
|
58
|
+
def font_weight_class
|
59
|
+
font_weight === "bold" ? "font_bold" : "font_regular"
|
60
|
+
end
|
61
|
+
|
62
|
+
def collapsible_trail_class
|
63
|
+
collapsible_trail ? "collapsible_trail" : nil
|
64
|
+
end
|
65
|
+
|
66
|
+
def font_size_class
|
67
|
+
font_size === "small" ? "font_size_small" : "font_size_normal"
|
68
|
+
end
|
46
69
|
end
|
47
70
|
end
|
48
71
|
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **title** | `String` | Specifies the value of the Pill | | |
|
5
|
+
| **variant** | `Variant` | Changes the color of the Pill | `.neutral` | `.error` `.info` `.neutral` `.primary` `.success` `.warning` |
|
@@ -0,0 +1,10 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
PBPill("success", variant: .success)
|
5
|
+
PBPill("error", variant: .error)
|
6
|
+
PBPill("warning", variant: .warning)
|
7
|
+
PBPill("info", variant: .info)
|
8
|
+
PBPill("neutral", variant: .neutral)
|
9
|
+
PBPill("primary", variant: .primary)
|
10
|
+
```
|
@@ -0,0 +1,16 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
VStack(alignment: .leading) {
|
5
|
+
PBRadio(
|
6
|
+
items: [
|
7
|
+
PBRadioItem("Power"),
|
8
|
+
.init("Nitro"),
|
9
|
+
.init("Google")
|
10
|
+
],
|
11
|
+
orientation: .horizontal,
|
12
|
+
textAlignment: .vertical,
|
13
|
+
selected: $selectedAlignment
|
14
|
+
)
|
15
|
+
}
|
16
|
+
```
|
@@ -0,0 +1,18 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
VStack(alignment: .leading) {
|
5
|
+
if let selectedCustom = selectedCustom {
|
6
|
+
Text("Your choice is: \(selectedCustom.title)")
|
7
|
+
}
|
8
|
+
PBRadio(
|
9
|
+
items: [
|
10
|
+
PBRadioItem("Custom Power"),
|
11
|
+
.init("Custom Nitro"),
|
12
|
+
.init("Custom Google")
|
13
|
+
],
|
14
|
+
orientation: .vertical,
|
15
|
+
selected: $selectedCustom
|
16
|
+
)
|
17
|
+
}
|
18
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
VStack(alignment: .leading) {
|
5
|
+
PBRadio(
|
6
|
+
items: [
|
7
|
+
PBRadioItem("Power"),
|
8
|
+
.init("Nitro"),
|
9
|
+
.init("Google")
|
10
|
+
],
|
11
|
+
orientation: .vertical,
|
12
|
+
selected: $selectedDefault
|
13
|
+
)
|
14
|
+
}
|
15
|
+
```
|
@@ -0,0 +1,14 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
VStack(alignment: .leading) {
|
5
|
+
PBRadio(
|
6
|
+
items: [
|
7
|
+
PBRadioItem("Power")
|
8
|
+
],
|
9
|
+
orientation: .vertical,
|
10
|
+
selected: $selectedError,
|
11
|
+
errorState: true
|
12
|
+
)
|
13
|
+
}
|
14
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
VStack(alignment: .leading) {
|
5
|
+
PBRadio(
|
6
|
+
items: [
|
7
|
+
PBRadioItem("Power"),
|
8
|
+
.init("Nitro"),
|
9
|
+
.init("Google")
|
10
|
+
],
|
11
|
+
orientation: .horizontal,
|
12
|
+
selected: $selectedOrientation
|
13
|
+
)
|
14
|
+
}
|
15
|
+
```
|
@@ -0,0 +1,31 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
VStack(alignment: .leading) {
|
5
|
+
PBRadio(
|
6
|
+
items: [
|
7
|
+
PBRadioItem("Small")
|
8
|
+
],
|
9
|
+
orientation: .vertical,
|
10
|
+
padding: Spacing.small,
|
11
|
+
selected: $selectedPadding
|
12
|
+
)
|
13
|
+
PBRadio(
|
14
|
+
items: [
|
15
|
+
PBRadioItem("Medium")
|
16
|
+
],
|
17
|
+
orientation: .vertical,
|
18
|
+
padding: Spacing.medium,
|
19
|
+
selected: $selectedPadding
|
20
|
+
)
|
21
|
+
PBRadio(
|
22
|
+
items: [
|
23
|
+
PBRadioItem("Large")
|
24
|
+
],
|
25
|
+
orientation: .vertical,
|
26
|
+
padding: Spacing.large,
|
27
|
+
selected: $selectedPadding
|
28
|
+
)
|
29
|
+
}
|
30
|
+
|
31
|
+
```
|
@@ -0,0 +1,10 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **items** | `PBRadioItem` | Specifies the value of the Radio buttons | | |
|
5
|
+
| **orientation** | `Orientation` | Changes between stacked or inline Radio items | `.vertical` | |
|
6
|
+
| **textAlignment** | `Orientation` | Changes lable position | `.horizontal` | |
|
7
|
+
| **spacing** | `CGFloat` | Applies padding around Radio and lable | `Spacing.xSmall` | `Spacing.none` `Spacing.xxSmall` `Spacing.xSmall` `Spacing.small` `Spacing.medium` `Spacing.large` `Spacing.xLarge` |
|
8
|
+
| **padding** | `CGFloat` | Applies padding between Radio and lable | `Spacing.xSmall` | `Spacing.none` `Spacing.xxSmall` `Spacing.xSmall` `Spacing.small` `Spacing.medium` `Spacing.large` `Spacing.xLarge` |
|
9
|
+
| **errorState** | `Bool` | Changes Radio to error styling | | |
|
10
|
+
| **selected** | `PBRadioItem?` | Sets selected Radio item | | |
|
@@ -0,0 +1,36 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
HStack(alignment: .top) {
|
5
|
+
PBRadio(
|
6
|
+
items: [
|
7
|
+
PBRadioItem("Small"),
|
8
|
+
.init("Small Spacing"),
|
9
|
+
.init("Small Power")
|
10
|
+
],
|
11
|
+
orientation: .vertical,
|
12
|
+
spacing: Spacing.small,
|
13
|
+
selected: $selectedSpacing
|
14
|
+
)
|
15
|
+
PBRadio(
|
16
|
+
items: [
|
17
|
+
PBRadioItem("Medium"),
|
18
|
+
.init("Medium Spacing"),
|
19
|
+
.init("Medium Power")
|
20
|
+
],
|
21
|
+
orientation: .vertical,
|
22
|
+
spacing: Spacing.medium,
|
23
|
+
selected: $selectedSpacing
|
24
|
+
)
|
25
|
+
PBRadio(
|
26
|
+
items: [
|
27
|
+
PBRadioItem("Large"),
|
28
|
+
.init("Large Spacing"),
|
29
|
+
.init("Large Power")
|
30
|
+
],
|
31
|
+
orientation: .vertical,
|
32
|
+
spacing: Spacing.large,
|
33
|
+
selected: $selectedSpacing
|
34
|
+
)
|
35
|
+
}
|
36
|
+
```
|
@@ -0,0 +1,13 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
```swift
|
4
|
+
VStack(alignment: .leading) {
|
5
|
+
PBRadio(
|
6
|
+
items: [
|
7
|
+
PBRadioItem("Power", subtitle: "subtitle")
|
8
|
+
],
|
9
|
+
selected: $selectedSubtitle
|
10
|
+
)
|
11
|
+
}
|
12
|
+
|
13
|
+
```
|
@@ -12,3 +12,14 @@ examples:
|
|
12
12
|
- radio_custom: Custom
|
13
13
|
- radio_error: With Error
|
14
14
|
- radio_alignment: Alignment
|
15
|
+
|
16
|
+
swift:
|
17
|
+
- radio_default_swift: Default
|
18
|
+
- radio_custom_swift: Custom
|
19
|
+
- radio_error_swift: With Error
|
20
|
+
- radio_orientation_swift: Orientation
|
21
|
+
- radio_alignment_swift: Alignment
|
22
|
+
- radio_spacing_swift: Spacing
|
23
|
+
- radio_padding_swift: Padding
|
24
|
+
- radio_subtitle_swift: Subtitle
|
25
|
+
- radio_props_swift: ""
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import classnames from "classnames";
|
3
3
|
|
4
|
-
import DateTime from "../pb_kit/dateTime";
|
5
4
|
import { buildCss } from "../utilities/props";
|
6
5
|
import { globalProps, GlobalProps } from "../utilities/globalProps";
|
6
|
+
import DateTime from '../pb_kit/dateTime';
|
7
7
|
|
8
8
|
import Body from "../pb_body/_body";
|
9
9
|
import Caption from "../pb_caption/_caption";
|
@@ -13,7 +13,7 @@ type TimeProps = {
|
|
13
13
|
align?: "left" | "center" | "right";
|
14
14
|
className?: string | string[];
|
15
15
|
data?: string;
|
16
|
-
date:
|
16
|
+
date: Date;
|
17
17
|
dark?: boolean;
|
18
18
|
id?: string;
|
19
19
|
showIcon?: boolean;
|
@@ -41,8 +41,6 @@ const Time = (props: TimeProps) => {
|
|
41
41
|
className
|
42
42
|
);
|
43
43
|
|
44
|
-
const dateTimestamp = new DateTime({ value: date, zone: timeZone });
|
45
|
-
|
46
44
|
return (
|
47
45
|
<div className={classes}>
|
48
46
|
{showIcon && (
|
@@ -70,18 +68,18 @@ const Time = (props: TimeProps) => {
|
|
70
68
|
)
|
71
69
|
)}
|
72
70
|
|
73
|
-
<time dateTime={date}>
|
71
|
+
<time dateTime={date.toString()}>
|
74
72
|
<span>
|
75
73
|
{unstyled
|
76
74
|
? (
|
77
75
|
<>
|
78
76
|
<span>
|
79
|
-
{
|
77
|
+
{DateTime.toTimeWithMeridiem(date, timeZone)}
|
80
78
|
</span>
|
81
79
|
{" "}
|
82
80
|
{showTimezone && (
|
83
81
|
<span>
|
84
|
-
{
|
82
|
+
{DateTime.toTimeZone(date, timeZone)}
|
85
83
|
</span>
|
86
84
|
)}
|
87
85
|
</>
|
@@ -92,13 +90,13 @@ const Time = (props: TimeProps) => {
|
|
92
90
|
<Body
|
93
91
|
className="pb_time"
|
94
92
|
tag="span"
|
95
|
-
text={
|
93
|
+
text={DateTime.toTimeWithMeridiem(date, timeZone)}
|
96
94
|
/>{" "}
|
97
95
|
{showTimezone && (
|
98
96
|
<Body
|
99
97
|
color="light"
|
100
98
|
tag="span"
|
101
|
-
text={
|
99
|
+
text={DateTime.toTimeZone(date, timeZone)}
|
102
100
|
/>
|
103
101
|
)}
|
104
102
|
</>
|
@@ -108,13 +106,13 @@ const Time = (props: TimeProps) => {
|
|
108
106
|
<Caption
|
109
107
|
color="light"
|
110
108
|
tag="span"
|
111
|
-
text={
|
109
|
+
text={DateTime.toTimeWithMeridiem(date, timeZone)}
|
112
110
|
/>{" "}
|
113
111
|
{showTimezone && (
|
114
112
|
<Caption
|
115
113
|
color="light"
|
116
114
|
tag="span"
|
117
|
-
text={
|
115
|
+
text={DateTime.toTimeZone(date, timeZone)}
|
118
116
|
/>
|
119
117
|
)}
|
120
118
|
</>
|