playbook_ui 14.12.0.pre.alpha.advancedtablealignmentfixes5693 → 14.12.0.pre.alpha.play1752updatecontenttag5801

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +3 -4
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +8 -13
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +2 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb +33 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading_rails.md +1 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_loading.md → _advanced_table_loading_react.md} +2 -2
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/index.js +9 -6
  12. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +3 -1
  13. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +9 -5
  14. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +2 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +9 -6
  16. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -0
  17. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +5 -0
  18. data/app/pb_kits/playbook/pb_button/button.rb +1 -1
  19. data/app/pb_kits/playbook/pb_copy_button/_copy_button.scss +3 -0
  20. data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +92 -0
  21. data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +64 -0
  22. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.jsx +21 -0
  23. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx +45 -0
  24. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.md +1 -0
  25. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +8 -0
  26. data/app/pb_kits/playbook/pb_copy_button/docs/index.js +2 -0
  27. data/app/pb_kits/playbook/pb_date/_date.tsx +14 -4
  28. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +2 -1
  29. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +13 -5
  30. data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +1 -6
  31. data/app/pb_kits/playbook/pb_filter/filter.html.erb +1 -5
  32. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +58 -0
  33. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close_rails.md +3 -0
  34. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +1 -0
  35. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js +7 -5
  36. data/app/pb_kits/playbook/pb_form_group/form_group.html.erb +1 -6
  37. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
  38. data/app/pb_kits/playbook/pb_icon/icon.html.erb +2 -6
  39. data/app/pb_kits/playbook/pb_layout/body.html.erb +1 -5
  40. data/app/pb_kits/playbook/pb_layout/footer.html.erb +1 -5
  41. data/app/pb_kits/playbook/pb_layout/header.html.erb +1 -5
  42. data/app/pb_kits/playbook/pb_layout/item.html.erb +1 -5
  43. data/app/pb_kits/playbook/pb_layout/layout.html.erb +1 -5
  44. data/app/pb_kits/playbook/pb_layout/sidebar.html.erb +1 -5
  45. data/app/pb_kits/playbook/pb_legend/legend.html.erb +1 -6
  46. data/app/pb_kits/playbook/pb_message/message.html.erb +1 -6
  47. data/app/pb_kits/playbook/pb_message/message_mention.html.erb +1 -6
  48. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +3 -1
  49. data/dist/chunks/{_typeahead-BWwaAo_0.js → _typeahead-BIhRQo8Q.js} +3 -3
  50. data/dist/chunks/_weekday_stacked-CttHBFW3.js +45 -0
  51. data/dist/chunks/vendor.js +1 -1
  52. data/dist/menu.yml +6 -0
  53. data/dist/playbook-doc.js +1 -1
  54. data/dist/playbook-rails-react-bindings.js +1 -1
  55. data/dist/playbook-rails.js +1 -1
  56. data/dist/playbook.css +1 -1
  57. data/lib/playbook/pb_forms_global_props_helper.rb +136 -0
  58. data/lib/playbook/pb_forms_helper.rb +13 -4
  59. data/lib/playbook/version.rb +1 -1
  60. metadata +19 -6
  61. data/dist/chunks/_weekday_stacked-N1NVUtQO.js +0 -45
  62. /data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/{_fixed_confirmation_toast_auto_close.md → _fixed_confirmation_toast_auto_close_react.md} +0 -0
@@ -4,7 +4,8 @@ import { Caption, Date as FormattedDate, Title } from 'playbook-ui'
4
4
  const DateUnstyled = (props) => {
5
5
  return (
6
6
  <>
7
- <Caption size="xs"
7
+ <Caption {...props}
8
+ size="xs"
8
9
  text="Basic unstyled example"
9
10
  />
10
11
  <FormattedDate
@@ -15,10 +16,14 @@ const DateUnstyled = (props) => {
15
16
 
16
17
  <br />
17
18
 
18
- <Caption size="xs"
19
+ <Caption {...props}
20
+
21
+ size="xs"
19
22
  text="Example with wrapping typography kit"
20
23
  />
21
- <Title size={1}>
24
+ <Title {...props}
25
+ size={1}
26
+ >
22
27
  <FormattedDate
23
28
  unstyled
24
29
  value={new Date('25 Dec 1995')}
@@ -28,10 +33,13 @@ const DateUnstyled = (props) => {
28
33
 
29
34
  <br />
30
35
 
31
- <Caption size="xs"
36
+ <Caption {...props}
37
+ size="xs"
32
38
  text="Example with icon + subcaption"
33
39
  />
34
- <Caption size="xs">
40
+ <Caption {...props}
41
+ size="xs"
42
+ >
35
43
  <FormattedDate
36
44
  showDayOfWeek
37
45
  showIcon
@@ -1,9 +1,4 @@
1
- <%= content_tag("div",
2
- aria: object.aria,
3
- class: object.classname,
4
- data: object.data,
5
- id: object.id,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag(:div) do %>
7
2
  <%= pb_rails("form_group", props: {cursor: "pointer", full_width: object.full_width}) do %>
8
3
  <label
9
4
  for="upload-<%= object.id %>"
@@ -1,8 +1,4 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- **combined_html_options) do %>
1
+ <%= pb_content_tag(:div) do %>
6
2
  <%= object.wrapper do %>
7
3
  <%= pb_rails("flex", props: { orientation: "row", padding_right: "lg", vertical: "center" }) do %>
8
4
  <% if (object.template != "sort_only") %>
@@ -0,0 +1,58 @@
1
+ <%= pb_rails("button", props: { text: "Show Auto Close Toast", variant: "secondary", data: { toast: "#toast-auto-close" } }) %>
2
+ <%= pb_rails("button", props: { text: "Show Closeable Auto Close Toast", variant: "secondary", data: { toast: "#toast-auto-close-closeable" } }) %>
3
+
4
+ <%= pb_rails("fixed_confirmation_toast", props: {
5
+ auto_close: 3000,
6
+ classname: "toast-to-hide",
7
+ id: "toast-auto-close",
8
+ text: "I will disappear in 3 seconds.",
9
+ status: "tip",
10
+ vertical: "top",
11
+ horizontal: "center"
12
+ }) %>
13
+
14
+ <%= pb_rails("fixed_confirmation_toast", props: {
15
+ auto_close: 10000,
16
+ closeable: true,
17
+ id: "toast-auto-close-closeable",
18
+ text: "I will disappear in 10 seconds.",
19
+ status: "tip",
20
+ vertical: "top",
21
+ horizontal: "center"
22
+ }) %>
23
+
24
+ <script>
25
+ document.addEventListener('DOMContentLoaded', () => {
26
+ // Initialize toast elements and buttons
27
+ const toasts = {
28
+ '#toast-auto-close': document.querySelector("#toast-auto-close"),
29
+ '#toast-auto-close-closeable': document.querySelector("#toast-auto-close-closeable")
30
+ }
31
+
32
+ const buttons = {
33
+ '#toast-auto-close': document.querySelector("button[data-toast='#toast-auto-close']"),
34
+ '#toast-auto-close-closeable': document.querySelector("button[data-toast='#toast-auto-close-closeable']")
35
+ }
36
+
37
+ // Store original toasts and remove them from DOM
38
+ const originalToasts = {}
39
+ Object.entries(toasts).forEach(([id, toast]) => {
40
+ if (toast) {
41
+ originalToasts[id] = toast.cloneNode(true)
42
+ toast.remove()
43
+ }
44
+ })
45
+
46
+ // Set up button click handlers
47
+ Object.keys(buttons).forEach((toastId) => {
48
+ const button = buttons[toastId]
49
+ if (button) {
50
+ button.onclick = () => {
51
+ const newToast = originalToasts[toastId].cloneNode(true)
52
+ newToast.style.display = "flex"
53
+ document.body.appendChild(newToast)
54
+ }
55
+ }
56
+ })
57
+ })
58
+ </script>
@@ -0,0 +1,3 @@
1
+ Auto close is used when you want the confirmation toast to close automatically after a certain time. `auto_close` property will be a delay number in ms.
2
+
3
+ The script tag in this code snippet is for demonstration purposes only. It clones the toasts in order to have it appear with a button click prompt and not upon initial page load. In a typical production environment the event triggering a fixed confirmation toast to appear would be handled by a controller or a separate javascript file.
@@ -5,6 +5,7 @@ examples:
5
5
  - fixed_confirmation_toast_multi_line: Multi Line
6
6
  - fixed_confirmation_toast_close: Click to Close
7
7
  - fixed_confirmation_toast_positions: Click to Show Positions
8
+ - fixed_confirmation_toast_auto_close: Click to Show Auto Close
8
9
  - fixed_confirmation_toast_children: Children
9
10
  - fixed_confirmation_toast_custom_icon: Custom Icon
10
11
 
@@ -2,16 +2,18 @@ import PbEnhancedElement from '../pb_enhanced_element'
2
2
 
3
3
  export default class PbFixedConfirmationToast extends PbEnhancedElement {
4
4
  static get selector() {
5
- return '.remove_toast'
5
+ return '[class*="pb_fixed_confirmation_toast_kit"]'
6
6
  }
7
7
 
8
8
  connect() {
9
9
  this.self = this.element
10
10
  this.autoCloseToast(this.self)
11
11
 
12
- this.self.addEventListener('click', () => {
13
- this.removeToast(this.self)
14
- })
12
+ if (this.self.classList.contains('remove_toast')) {
13
+ this.self.addEventListener('click', () => {
14
+ this.removeToast(this.self)
15
+ })
16
+ }
15
17
  }
16
18
 
17
19
  removeToast(elem) {
@@ -32,4 +34,4 @@ export default class PbFixedConfirmationToast extends PbEnhancedElement {
32
34
  }, autoCloseIntValue)
33
35
  }
34
36
  }
35
- }
37
+ }
@@ -1,8 +1,3 @@
1
- <%= content_tag(:div,
2
- aria: object.aria,
3
- class: object.classname,
4
- data: object.data,
5
- id: object.id,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag(:div) do %>
7
2
  <%= content.presence %>
8
3
  <% end %>
@@ -1,4 +1,4 @@
1
- <%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, tabindex: object.tabindex, **combined_html_options) do %>
1
+ <%= pb_content_tag(:div, class: object.classname + object.size_class, tabindex: object.tabindex) do %>
2
2
  <% if object.name.present? %>
3
3
  <%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "xxs" }) %>
4
4
  <% if object.truncate %>
@@ -5,12 +5,8 @@
5
5
  <%= object.icon.html_safe %>
6
6
  </span>
7
7
  <% else %>
8
- <%= content_tag(:i, nil,
9
- id: object.id,
10
- data: object.data,
11
- class: object.classname,
12
- **combined_html_options
13
- ) %>
8
+ <%= pb_content_tag(:i) do %>
9
+ <% end %>
14
10
  <%= content_tag(:span, nil,
15
11
  aria: { label: "#{object.icon} icon" }.merge(object.aria),
16
12
  hidden: true
@@ -1,7 +1,3 @@
1
- <%= content_tag(object.tag,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
6
2
  <%= content.presence %>
7
3
  <% end %>
@@ -1,7 +1,3 @@
1
- <%= content_tag(object.tag,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
6
2
  <%= content.presence %>
7
3
  <% end %>
@@ -1,7 +1,3 @@
1
- <%= content_tag(object.tag,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
6
2
  <%= content.presence %>
7
3
  <% end %>
@@ -1,7 +1,3 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
6
2
  <%= content %>
7
3
  <% end %>
@@ -1,7 +1,3 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
6
2
  <%= content.presence %>
7
3
  <% end %>
@@ -1,7 +1,3 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
6
2
  <%= content.presence %>
7
3
  <% end %>
@@ -1,9 +1,4 @@
1
- <%= content_tag(:div, object.text,
2
- aria: object.aria,
3
- id: object.id,
4
- data: object.data,
5
- class: object.classname,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
7
2
  <%= pb_rails("body", props: {color: object.body_color}) do %>
8
3
  <span style="<%= object.custom_color %>" class=<%= object.custom_color_class %>></span>
9
4
  <%= pb_rails("title", props: { dark: object.dark, text: object.prefix_text, tag: "span", size: 4 }) %>
@@ -1,9 +1,4 @@
1
- <%= content_tag(:div,
2
- aria: object.aria,
3
- id: object.id,
4
- data: object.data,
5
- class: object.classname,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
7
2
  <% if object.valid? %>
8
3
  <%= pb_rails("avatar", props: {
9
4
  name: object.avatar_name,
@@ -1,8 +1,3 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- aria: object.aria,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
7
2
  <%= content %>
8
3
  <% end %>
@@ -32,6 +32,7 @@ type TooltipProps = {
32
32
  position?: "absolute" | "fixed";
33
33
  text: string,
34
34
  showTooltip?: boolean,
35
+ forceOpenTooltip?: boolean,
35
36
  } & GlobalProps
36
37
 
37
38
  const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): React.ReactElement => {
@@ -49,6 +50,7 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
49
50
  text,
50
51
  showTooltip = true,
51
52
  zIndex,
53
+ forceOpenTooltip = false,
52
54
  ...rest
53
55
  } = props
54
56
 
@@ -135,7 +137,7 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
135
137
  >
136
138
  {children}
137
139
  </div>
138
- {open && (
140
+ {(open || forceOpenTooltip) && (
139
141
  <div
140
142
  {...getFloatingProps({
141
143
  className: `tooltip_tooltip ${placement} visible`,