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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/index.js +2 -1
  3. data/app/pb_kits/playbook/pb_badge/docs/_badge_colors_swift.md +33 -0
  4. data/app/pb_kits/playbook/pb_badge/docs/_badge_default_swift.md +9 -0
  5. data/app/pb_kits/playbook/pb_badge/docs/_badge_notification_swift.md +9 -0
  6. data/app/pb_kits/playbook/pb_badge/docs/_badge_props_swift.md +6 -0
  7. data/app/pb_kits/playbook/pb_badge/docs/_badge_rounded_swift.md +9 -0
  8. data/app/pb_kits/playbook/pb_badge/docs/example.yml +7 -0
  9. data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +6 -0
  10. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +15 -13
  11. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +25 -8
  12. data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +1 -1
  13. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
  14. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +2 -2
  15. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +11 -4
  16. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.md +1 -1
  17. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_size.jsx +5 -5
  18. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +75 -0
  19. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +3 -0
  20. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -6
  21. data/app/pb_kits/playbook/pb_collapsible/docs/index.js +2 -1
  22. data/app/pb_kits/playbook/pb_collapsible/useCollapsible.tsx +14 -0
  23. data/app/pb_kits/playbook/pb_date/_date.tsx +7 -8
  24. data/app/pb_kits/playbook/pb_date/docs/_date_alignment.jsx +2 -2
  25. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +29 -5
  26. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +2 -2
  27. data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +5 -5
  28. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +45 -31
  29. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +5 -3
  30. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +24 -21
  31. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +1 -1
  32. data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +1 -1
  33. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +2 -2
  34. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +1 -1
  35. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +6 -8
  36. data/app/pb_kits/playbook/pb_kit/dateTime.ts +146 -63
  37. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +52 -31
  38. data/app/pb_kits/playbook/pb_message/_message.tsx +24 -24
  39. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +273 -3
  40. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +6 -0
  41. data/app/pb_kits/playbook/pb_nav/_item.tsx +47 -10
  42. data/app/pb_kits/playbook/pb_nav/_mixins.scss +5 -0
  43. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +6 -7
  44. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  45. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +13 -6
  46. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +1 -0
  47. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +58 -0
  48. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +1 -0
  49. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +23 -0
  50. data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_custom_icons.jsx → _collapsible_nav_emphasize.jsx} +18 -11
  51. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +1 -0
  52. data/app/pb_kits/playbook/pb_nav/docs/example.yml +5 -3
  53. data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
  54. data/app/pb_kits/playbook/pb_nav/item.html.erb +5 -4
  55. data/app/pb_kits/playbook/pb_nav/item.rb +25 -2
  56. data/app/pb_kits/playbook/pb_pill/docs/_pill_default_swift.md +5 -0
  57. data/app/pb_kits/playbook/pb_pill/docs/_pill_props_swift.md +5 -0
  58. data/app/pb_kits/playbook/pb_pill/docs/_pill_variants_swift.md +10 -0
  59. data/app/pb_kits/playbook/pb_pill/docs/example.yml +5 -0
  60. data/app/pb_kits/playbook/pb_radio/docs/_radio_alignment_swift.md +16 -0
  61. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_swift.md +18 -0
  62. data/app/pb_kits/playbook/pb_radio/docs/_radio_default_swift.md +15 -0
  63. data/app/pb_kits/playbook/pb_radio/docs/_radio_error_swift.md +14 -0
  64. data/app/pb_kits/playbook/pb_radio/docs/_radio_orientation_swift.md +15 -0
  65. data/app/pb_kits/playbook/pb_radio/docs/_radio_padding_swift.md +31 -0
  66. data/app/pb_kits/playbook/pb_radio/docs/_radio_props_swift.md +10 -0
  67. data/app/pb_kits/playbook/pb_radio/docs/_radio_spacing_swift.md +36 -0
  68. data/app/pb_kits/playbook/pb_radio/docs/_radio_subtitle_swift.md +13 -0
  69. data/app/pb_kits/playbook/pb_radio/docs/example.yml +11 -0
  70. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_options.html.erb +12 -0
  71. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +1 -0
  72. data/app/pb_kits/playbook/pb_text_input/text_input.rb +1 -1
  73. data/app/pb_kits/playbook/pb_time/_time.tsx +9 -11
  74. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +46 -49
  75. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +4 -6
  76. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +11 -11
  77. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align_swift.md +45 -0
  78. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default_swift.md +26 -0
  79. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed_swift.md +25 -0
  80. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_props_swift.md +10 -0
  81. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones_swift.md +67 -0
  82. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_swift.md +19 -0
  83. data/app/pb_kits/playbook/pb_timestamp/docs/example.yml +8 -0
  84. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +8 -11
  85. data/dist/playbook-rails.js +7 -7
  86. data/lib/playbook/version.rb +2 -2
  87. metadata +41 -9
  88. 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 variant="subtle">
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
- import Nav from "../_nav";
4
- import NavItem from "../_item";
5
-
6
- const CollapsibleNavCustomIcons = (props) => {
4
+ const CollapsibleNavEmphasize = (props) => {
7
5
  return (
8
- <Nav variant="subtle">
6
+ <Nav variant="bold">
9
7
  <NavItem
10
- collapsible
8
+ active
9
+ collapsible
10
+ collapsibleTrail
11
+ fontSize="small"
12
+ fontWeight="bold"
11
13
  iconLeft="city"
12
- iconRight={["chevron-down", "chevron-up"]}
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={["chevron-down", "chevron-up"]}
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={["chevron-down", "chevron-up"]}
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 CollapsibleNavCustomIcons;
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
- # - collapsible_nav: Subtle With Collapsible
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
- # - collapsible_nav: Subtle With Collapsible
29
- # - collapsible_nav_custom_icons: Subtle With Collapsible (Custom Toggle Icons)
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 CollapsibleNavCustomIcons } from './_collapsible_nav_custom_icons.jsx'
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: "pb_nav_img_wrapper" }) %>
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: "pb_nav_list_item_icon_left", fixed_width: true}) %>
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="pb_nav_list_item_text">
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
- generate_classname("pb_nav_list_kit_item", active_class)
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
+ ![pill-default](https://github.com/powerhome/playbook/assets/92755007/608cb5dd-9400-45f4-afb2-ac1bbd972c3d)
2
+
3
+ ```swift
4
+ PBPill("default")
5
+ ```
@@ -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
+ ![pill-variants](https://github.com/powerhome/playbook/assets/92755007/79ac4260-633e-4429-8b1f-0a97b8178a86)
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
+ ```
@@ -11,3 +11,8 @@ examples:
11
11
  - pill_default: Default
12
12
  - pill_variants: Variants
13
13
  - pill_example: Example
14
+
15
+ swift:
16
+ - pill_default_swift: Default
17
+ - pill_variants_swift: Variants
18
+ - pill_props_swift: ""
@@ -0,0 +1,16 @@
1
+ ![radio-alignment](https://github.com/powerhome/playbook/assets/92755007/04b84035-8391-4de1-a33e-8964999d5c0f)
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
+ ![radio-custom](https://github.com/powerhome/playbook/assets/92755007/3eab180b-0550-4d7e-b562-84a007690218)
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
+ ![radio-default](https://github.com/powerhome/playbook/assets/92755007/be32852e-de70-4ae0-b8bb-c091f8cfa34b)
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
+ ![radio-error](https://github.com/powerhome/playbook/assets/92755007/425f499b-4daf-4093-82a7-230b01723287)
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
+ ![radio-orientation](https://github.com/powerhome/playbook/assets/92755007/f1f8dac7-a7d5-43cf-ba93-92bd624a1016)
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
+ ![radio-padding](https://github.com/powerhome/playbook/assets/92755007/5cb123fb-791b-43f7-a57e-336f93c1bb3a)
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
+ ![radio-spacing](https://github.com/powerhome/playbook/assets/92755007/58d1bf02-0c79-4526-9e5c-ba2f631d1dfe)
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
+ ![radio-subtitle](https://github.com/powerhome/playbook/assets/92755007/1244f4d4-0e87-4b5a-9b20-ac2223866321)
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: ""
@@ -0,0 +1,12 @@
1
+ <%= pb_rails("text_input", props: {
2
+ placeholder: "Placeholder",
3
+ input_options: {
4
+ id: "testing-one-time-code",
5
+ autocomplete: "one-time-code",
6
+ name:"auth-token",
7
+ inputmode:"numeric",
8
+ pattern:"[0-9]*",
9
+ type: "text"
10
+ }
11
+ }) %>
12
+
@@ -7,6 +7,7 @@ examples:
7
7
  - text_input_add_on: Add On
8
8
  - text_input_inline: Inline
9
9
  - text_input_no_label: No Label
10
+ - text_input_options: Input Options
10
11
  react:
11
12
  - text_input_default: Default
12
13
  - text_input_error: With Error
@@ -60,7 +60,7 @@ module Playbook
60
60
  required: required,
61
61
  type: type,
62
62
  value: value,
63
- }
63
+ }.merge(input_options)
64
64
  end
65
65
 
66
66
  def validation_message
@@ -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: string;
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
- {dateTimestamp.toTimeWithMeridian()}
77
+ {DateTime.toTimeWithMeridiem(date, timeZone)}
80
78
  </span>
81
79
  {" "}
82
80
  {showTimezone && (
83
81
  <span>
84
- {dateTimestamp.toTimezone()}
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={dateTimestamp.toTimeWithMeridian()}
93
+ text={DateTime.toTimeWithMeridiem(date, timeZone)}
96
94
  />{" "}
97
95
  {showTimezone && (
98
96
  <Body
99
97
  color="light"
100
98
  tag="span"
101
- text={dateTimestamp.toTimezone()}
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={dateTimestamp.toTimeWithMeridian()}
109
+ text={DateTime.toTimeWithMeridiem(date, timeZone)}
112
110
  />{" "}
113
111
  {showTimezone && (
114
112
  <Caption
115
113
  color="light"
116
114
  tag="span"
117
- text={dateTimestamp.toTimezone()}
115
+ text={DateTime.toTimeZone(date, timeZone)}
118
116
  />
119
117
  )}
120
118
  </>