playbook_ui 12.33.1.pre.alpha.PLAY933navkitcollapsible994 → 12.34.0.pre.alpha.fixdialogcloseevents1003

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_button/_button.scss +32 -0
  3. data/app/pb_kits/playbook/pb_button/_button.tsx +78 -26
  4. data/app/pb_kits/playbook/pb_button/button.html.erb +17 -0
  5. data/app/pb_kits/playbook/pb_button/button.rb +18 -2
  6. data/app/pb_kits/playbook/pb_button/docs/_button_reaction.html.erb +30 -0
  7. data/app/pb_kits/playbook/pb_button/docs/_button_reaction.jsx +47 -0
  8. data/app/pb_kits/playbook/pb_button/docs/_button_reaction.md +3 -0
  9. data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
  10. data/app/pb_kits/playbook/pb_button/docs/index.js +2 -1
  11. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +4 -6
  12. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx +11 -19
  13. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +14 -27
  14. data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +2 -7
  15. data/app/pb_kits/playbook/pb_collapsible/collapsible_main.rb +7 -2
  16. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_size.md +1 -1
  17. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +1 -3
  18. data/app/pb_kits/playbook/pb_collapsible/docs/index.js +0 -1
  19. data/app/pb_kits/playbook/pb_collapsible/index.js +3 -3
  20. data/app/pb_kits/playbook/pb_collapsible/types.d.ts +1 -0
  21. data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +7 -4
  22. data/app/pb_kits/playbook/pb_icon/_icon.scss +4 -0
  23. data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -2
  24. data/app/pb_kits/playbook/pb_icon/icon.html.erb +1 -1
  25. data/app/pb_kits/playbook/pb_nav/_item.tsx +49 -98
  26. data/app/pb_kits/playbook/pb_nav/_nav.scss +0 -1
  27. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +11 -9
  28. data/app/pb_kits/playbook/pb_nav/docs/example.yml +0 -3
  29. data/app/pb_kits/playbook/pb_nav/docs/index.js +0 -2
  30. data/app/pb_kits/playbook/pb_nav/item.html.erb +12 -34
  31. data/app/pb_kits/playbook/pb_nav/item.rb +0 -5
  32. data/dist/playbook-rails.js +6 -6
  33. data/lib/playbook/version.rb +2 -2
  34. metadata +6 -10
  35. data/app/pb_kits/playbook/pb_collapsible/_helper_functions.ts +0 -25
  36. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.html.erb +0 -10
  37. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +0 -19
  38. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.md +0 -2
  39. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +0 -6
  40. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.html.erb +0 -24
  41. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +0 -83
  42. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom_icons.jsx +0 -86
@@ -21,15 +21,18 @@ const dialogHelper = () => {
21
21
 
22
22
  // Close dialog box on outside click
23
23
  dialogs.forEach((dialogElement) => {
24
- dialogElement.addEventListener("click", (event) => {
24
+ dialogElement.addEventListener("mousedown", (event) => {
25
25
  const dialogParentDataset = dialogElement.parentElement.dataset
26
26
  if (dialogParentDataset.overlayClick === "overlay_close") return
27
27
 
28
- const clickedOutsideDialogBox = event.target.classList.contains("pb_dialog_rails")
28
+ const dialogModal = event.target.getBoundingClientRect()
29
+ const clickedOutsideDialogModal = dialogModal.left > event.clientX ||
30
+ dialogModal.right < event.clientX ||
31
+ dialogModal.top > event.clientY ||
32
+ dialogModal.bottom < event.clientY
29
33
 
30
- if (clickedOutsideDialogBox) {
34
+ if (clickedOutsideDialogModal) {
31
35
  dialogElement.close()
32
- event.stopPropagation()
33
36
  }
34
37
  })
35
38
  })
@@ -6,3 +6,7 @@ svg.pb_custom_icon {
6
6
  fill: currentColor;
7
7
  }
8
8
  }
9
+
10
+ .pb_icon_kit_emoji {
11
+ font-family: monospace;
12
+ }
@@ -95,9 +95,8 @@ const Icon = (props: IconProps) => {
95
95
  )
96
96
 
97
97
  const classesEmoji = classnames(
98
- 'pb_icon_kit',
98
+ 'pb_icon_kit_emoji',
99
99
  globalProps(props),
100
- 'icon_circle_emoji',
101
100
  className
102
101
  )
103
102
 
@@ -1,7 +1,7 @@
1
1
  <% if object.custom_icon %>
2
2
  <%= object.render_svg(object.custom_icon) %>
3
3
  <% elsif object.valid_emoji(object.icon) %>
4
- <span class="pb_icon_kit icon_circle_emoji"><%= object.icon.html_safe %></span>
4
+ <span class="pb_icon_kit_emoji"><%= object.icon.html_safe %></span>
5
5
  <% else %>
6
6
  <%= content_tag(:i, nil,
7
7
  id: object.id,
@@ -6,17 +6,15 @@ import { globalProps, GlobalProps } from '../utilities/globalProps'
6
6
 
7
7
  import Icon from '../pb_icon/_icon'
8
8
  import Image from '../pb_image/_image'
9
- import Collapsible from '../pb_collapsible/_collapsible'
10
9
 
11
10
  type NavItemProps = {
12
11
  active?: boolean,
13
12
  aria?: { [key: string]: string },
14
13
  children?: React.ReactNode[] | React.ReactNode,
15
14
  className?: string,
16
- collapsible?: boolean,
17
15
  data?: object,
18
16
  iconLeft?: string,
19
- iconRight?: string | string[],
17
+ iconRight?: string,
20
18
  id?: string,
21
19
  imageUrl?: string,
22
20
  link?: string,
@@ -31,7 +29,6 @@ const NavItem = (props: NavItemProps) => {
31
29
  aria = {},
32
30
  children,
33
31
  className,
34
- collapsible,
35
32
  data = {},
36
33
  iconLeft,
37
34
  iconRight,
@@ -56,100 +53,54 @@ const NavItem = (props: NavItemProps) => {
56
53
  className={classes}
57
54
  id={id}
58
55
  >
59
- {
60
- collapsible ? (
61
- <Collapsible icon={iconRight ? iconRight : ['plus','minus']} iconSize="xs" padding="none">
62
- <Collapsible.Main>
63
- <Tag
64
- className="pb_nav_list_item_link"
65
- href={link}
66
- onClick={onClick}
67
- target={target}
68
- >
69
- {imageUrl &&
70
- <div
71
- className="pb_nav_list_item_icon_section"
72
- key={imageUrl}
73
- >
74
- <Image
75
- className="pb_nav_img_wrapper"
76
- url={imageUrl}
77
- />
78
- </div>
79
- }
80
-
81
- {iconLeft &&
82
- <div
83
- className="pb_nav_list_item_icon_section"
84
- key={iconLeft}
85
- >
86
- <Icon
87
- className="pb_nav_list_item_icon_left"
88
- fixedWidth
89
- icon={iconLeft}
90
- />
91
- </div>
92
- }
93
- <span className="pb_nav_list_item_text">
94
- {text}
95
- </span>
96
- </Tag>
97
- </Collapsible.Main>
98
- <Collapsible.Content>
99
- {children}
100
- </Collapsible.Content>
101
- </Collapsible>
102
- ) : (
103
- <Tag
104
- className="pb_nav_list_item_link"
105
- href={link}
106
- onClick={onClick}
107
- target={target}
108
- >
109
- {imageUrl &&
110
- <div
111
- className="pb_nav_list_item_icon_section"
112
- key={imageUrl}
113
- >
114
- <Image
115
- className="pb_nav_img_wrapper"
116
- url={imageUrl}
117
- />
118
- </div>
119
- }
120
-
121
- {iconLeft &&
122
- <div
123
- className="pb_nav_list_item_icon_section"
124
- key={iconLeft}
125
- >
126
- <Icon
127
- className="pb_nav_list_item_icon_left"
128
- fixedWidth
129
- icon={iconLeft}
130
- />
131
- </div>
132
- }
133
-
134
- <span className="pb_nav_list_item_text">
135
- {text || children}
136
- </span>
137
-
138
- {iconRight &&
139
- <div
140
- className="pb_nav_list_item_icon_section"
141
- key={iconRight as string}
142
- >
143
- <Icon
144
- className="pb_nav_list_item_icon_right"
145
- fixedWidth
146
- icon={iconRight as string}
147
- />
148
- </div>
149
- }
150
- </Tag>
151
- )
152
- }
56
+ <Tag
57
+ className="pb_nav_list_item_link"
58
+ href={link}
59
+ onClick={onClick}
60
+ target={target}
61
+ >
62
+ {imageUrl &&
63
+ <div
64
+ className="pb_nav_list_item_icon_section"
65
+ key={imageUrl}
66
+ >
67
+ <Image
68
+ className="pb_nav_img_wrapper"
69
+ url={imageUrl}
70
+ />
71
+ </div>
72
+ }
73
+
74
+ {iconLeft &&
75
+ <div
76
+ className="pb_nav_list_item_icon_section"
77
+ key={iconLeft}
78
+ >
79
+ <Icon
80
+ className="pb_nav_list_item_icon_left"
81
+ fixedWidth
82
+ icon={iconLeft}
83
+ />
84
+ </div>
85
+ }
86
+
87
+ <span className="pb_nav_list_item_text">
88
+ {text || children}
89
+ </span>
90
+
91
+ {iconRight &&
92
+ <div
93
+ className="pb_nav_list_item_icon_section"
94
+ key={iconRight}
95
+ >
96
+ <Icon
97
+ className="pb_nav_list_item_icon_right"
98
+ fixedWidth
99
+ icon={iconRight}
100
+ />
101
+ </div>
102
+ }
103
+ </Tag>
153
104
  </li>
154
105
  )
155
106
  }
@@ -4,4 +4,3 @@
4
4
  @import "../tokens/colors";
5
5
  @import "./vertical_nav";
6
6
  @import "./horizontal_nav";
7
- @import "./collapsible_nav";
@@ -29,20 +29,22 @@
29
29
  flex: 1;
30
30
  font-weight: $regular;
31
31
  }
32
+ @media (hover:hover) {
33
+ &:hover {
34
+ background-color: rgba($primary, 0.03);
35
+ [class*=_icon] {
36
+ color: $primary;
37
+ }
38
+ [class*=_text] {
39
+ color: $primary;
40
+ }
41
+ }
42
+ }
32
43
  }
33
44
  &[class*=_active] [class*=_link] {
34
45
  @include pb_title_4;
35
46
  color: $primary;
36
47
  letter-spacing: normal;
37
48
  }
38
- &:hover {
39
- background-color: rgba($primary, 0.03);
40
- [class*=_icon] {
41
- color: $primary;
42
- }
43
- [class*=_text] {
44
- color: $primary;
45
- }
46
- }
47
49
  }
48
50
  }
@@ -7,7 +7,6 @@ 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
11
10
  - subtle_no_highlight_nav: Subtle No Highlight
12
11
  - bold_vertical_nav: Bold Variant
13
12
  - horizontal_nav: Horizontal Nav
@@ -25,8 +24,6 @@ examples:
25
24
  - borderless_nav: No Borders
26
25
  - subtle_nav: Subtle Variant
27
26
  - subtle_with_icons_nav: Subtle With Icons
28
- - collapsible_nav: Subtle With Collapsible
29
- - collapsible_nav_custom_icons: Subtle With Collapsible (Custom Toggle Icons)
30
27
  - subtle_no_highlight_nav: Subtle No Highlight
31
28
  - bold_vertical_nav: Bold Variant
32
29
  - horizontal_nav: Horizontal Nav
@@ -13,5 +13,3 @@ export { default as WithImgNav } from './_with_img_nav.jsx'
13
13
  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
- export { default as CollapsibleNav } from './_collapsible_nav.jsx'
17
- export { default as CollapsibleNavCustomIcons } from './_collapsible_nav_custom_icons.jsx'
@@ -3,41 +3,19 @@
3
3
  class: object.classname,
4
4
  data: object.data,
5
5
  id: object.id) do %>
6
- <% if object.collapsible %>
7
- <%= 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
- <%= content_tag(object.tag,
10
- object.link ? object.link_options : object.options) do %>
11
- <% if object.image_url %>
12
- <%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
13
- <% end %>
14
- <% if object.icon_left %>
15
- <%= pb_rails("icon", props: { icon: object.icon_left, classname: "pb_nav_list_item_icon_left", fixed_width: true}) %>
16
- <% end %>
17
- <span class="pb_nav_list_item_text">
18
- <%= object.text %>
19
- </span>
20
- <% end %>
21
- <% end %>
22
- <%= pb_rails("collapsible/collapsible_content") do %>
23
- <%= content.presence %>
24
- <% end %>
6
+ <%= content_tag(object.tag,
7
+ object.link ? object.link_options : object.options) do %>
8
+ <% if object.image_url %>
9
+ <%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
25
10
  <% end %>
26
- <% else %>
27
- <%= content_tag(object.tag,
28
- object.link ? object.link_options : object.options) do %>
29
- <% if object.image_url %>
30
- <%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
31
- <% end %>
32
- <% if object.icon_left %>
33
- <%= pb_rails("icon", props: { icon: object.icon_left, classname: "pb_nav_list_item_icon_left", fixed_width: true}) %>
34
- <% end %>
35
- <span class="pb_nav_list_item_text">
36
- <%= object.text %><%= content.presence %>
37
- </span>
38
- <% if object.icon_right %>
39
- <%= pb_rails("icon", props: { icon: object.icon_right, classname: "pb_nav_list_item_icon_right", fixed_width: true}) %>
40
- <% end %>
11
+ <% if object.icon_left %>
12
+ <%= pb_rails("icon", props: { icon: object.icon_left, classname: "pb_nav_list_item_icon_left", fixed_width: true}) %>
13
+ <% end %>
14
+ <span class="pb_nav_list_item_text">
15
+ <%= object.text %><%= content.presence %>
16
+ </span>
17
+ <% if object.icon_right %>
18
+ <%= pb_rails("icon", props: { icon: object.icon_right, classname: "pb_nav_list_item_icon_right", fixed_width: true}) %>
41
19
  <% end %>
42
20
  <% end %>
43
21
  <% end %>
@@ -4,7 +4,6 @@ module Playbook
4
4
  module PbNav
5
5
  class Item < Playbook::KitBase
6
6
  prop :active, type: Playbook::Props::Boolean, default: false
7
- prop :collapsible, type: Playbook::Props::Boolean, default: false
8
7
  prop :link
9
8
  prop :text
10
9
  prop :icon_left
@@ -34,10 +33,6 @@ module Playbook
34
33
  )
35
34
  end
36
35
 
37
- def collapsible_icons
38
- icon_right.present? ? icon_right : %w[plus minus]
39
- end
40
-
41
36
  private
42
37
 
43
38
  def active_class