playbook_ui 14.12.0.pre.alpha.PLAY1865reactdatepickerreinitializingbug5732 → 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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +3 -4
  3. data/app/pb_kits/playbook/pb_advanced_table/index.js +9 -6
  4. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +8 -5
  5. data/app/pb_kits/playbook/pb_button/button.rb +1 -1
  6. data/app/pb_kits/playbook/pb_date/_date.tsx +14 -4
  7. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +2 -1
  8. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +13 -5
  9. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +1 -1
  10. data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +1 -6
  11. data/app/pb_kits/playbook/pb_filter/filter.html.erb +1 -5
  12. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +58 -0
  13. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close_rails.md +3 -0
  14. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +1 -0
  15. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js +7 -5
  16. data/app/pb_kits/playbook/pb_form_group/form_group.html.erb +1 -6
  17. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
  18. data/app/pb_kits/playbook/pb_icon/icon.html.erb +2 -6
  19. data/app/pb_kits/playbook/pb_layout/body.html.erb +1 -5
  20. data/app/pb_kits/playbook/pb_layout/footer.html.erb +1 -5
  21. data/app/pb_kits/playbook/pb_layout/header.html.erb +1 -5
  22. data/app/pb_kits/playbook/pb_layout/item.html.erb +1 -5
  23. data/app/pb_kits/playbook/pb_layout/layout.html.erb +1 -5
  24. data/app/pb_kits/playbook/pb_layout/sidebar.html.erb +1 -5
  25. data/app/pb_kits/playbook/pb_legend/legend.html.erb +1 -6
  26. data/app/pb_kits/playbook/pb_message/message.html.erb +1 -6
  27. data/app/pb_kits/playbook/pb_message/message_mention.html.erb +1 -6
  28. data/dist/chunks/_weekday_stacked-CttHBFW3.js +45 -0
  29. data/dist/chunks/vendor.js +1 -1
  30. data/dist/playbook-doc.js +1 -1
  31. data/dist/playbook-rails.js +1 -1
  32. data/lib/playbook/version.rb +1 -1
  33. metadata +6 -4
  34. data/dist/chunks/_weekday_stacked-bORvL0Zi.js +0 -45
  35. /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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4b2ad0e481643abe338553036ee4fb39c7c7ebe3e388e9486acb5a27cc565e7
4
- data.tar.gz: 5c17ee40aba4bace77b6354bac9f417cfd7fb3e8bd3cc9029e9f11142b0808ca
3
+ metadata.gz: c736c5bb605e344804ef02494da2ec955f7164885304d265908dcedd847f901f
4
+ data.tar.gz: 8f3eca8f553ffbe71558a7b5a6b052ef66bab1f637939c3aa96d7f77e3dc917e
5
5
  SHA512:
6
- metadata.gz: 0633f4de5953b60ab7e9f0543bfe25de05b99e2e7378478c4c5858e17f61d271fb63ff8b73f2fe9f991c0c9848ea6bb0cf40cb1c9bba790cfff95d4f84fa9fe6
7
- data.tar.gz: fa388b6846808f7e7a0b78c3822ad741b4f8302bdbff50c92527bf6af5a90ec002c3cade3a6ae96d24f85c23b19d26a53713321f52402d46b68d9a0e234ac044
6
+ metadata.gz: 34b49bde7e4b5ea26f628a61bbc9cd7144f4a204fa40597842a75b8b14410e10425c35d8b09c07a65e635f14ad80471716b8e8c85dbb86920d488dde7f87dc25
7
+ data.tar.gz: 90509627dfb16684dcd36a5a1fd7bb14b6f054585287e7bf5b23f4c1f844dc7e19b9171463aa22952afec761d41a876ae0670af4ecd170f5e59fa6e67ba3268c
@@ -89,7 +89,6 @@
89
89
  }
90
90
  }
91
91
 
92
-
93
92
  .table-header-cells-active:first-child {
94
93
  color: $primary !important;
95
94
  }
@@ -179,7 +178,7 @@
179
178
  }
180
179
 
181
180
  // Responsive Styles
182
- @media only screen and (max-width: $screen-xl-min) {
181
+ @media only screen and (max-width: $screen-xl-min) {
183
182
  &[class*="advanced-table-responsive-scroll"] {
184
183
  border-radius: 4px;
185
184
  box-shadow: 1px 0 0 0px $border_light,
@@ -215,7 +214,7 @@
215
214
  .bg-white td:first-child {
216
215
  background-color: $white;
217
216
  }
218
-
217
+
219
218
  }
220
219
  }
221
220
  @media only screen and (min-width: $screen-xl-min) {
@@ -306,4 +305,4 @@
306
305
  }
307
306
  }
308
307
  }
309
- }
308
+ }
@@ -133,15 +133,18 @@ export default class PbAdvancedTable extends PbEnhancedElement {
133
133
  if (!elements.length) return;
134
134
 
135
135
  const isVisible = elements[0].classList.contains("is-visible");
136
- if (isVisible) {
137
- this.hideElement(elements);
138
- this.displayDownArrow();
139
- } else {
140
- this.showElement(elements);
141
- this.displayUpArrow();
136
+
137
+ isVisible ? this.hideElement(elements) : this.showElement(elements);
138
+ isVisible ? this.displayDownArrow() : this.displayUpArrow();
139
+
140
+ const row = this.element.closest("tr");
141
+ if (row) {
142
+ row.classList.toggle("bg-silver", !isVisible);
143
+ row.classList.toggle("bg-white", isVisible);
142
144
  }
143
145
  }
144
146
 
147
+
145
148
  displayDownArrow() {
146
149
  this.element.querySelector(DOWN_ARROW_SELECTOR).style.display =
147
150
  "inline-block";
@@ -14,10 +14,13 @@
14
14
  <div style="padding-left: <%= depth * 1.25 %>em">
15
15
  <%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
16
16
  <% if index.zero? && object.row[:children].present? %>
17
- <button id="<%= "#{object.id}_#{object.row.object_id}" %>" class="gray-icon expand-toggle-icon" data-advanced-table="true" >
18
- <%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
19
- <%= pb_rails("icon", props: { id: "advanced-table_close_icon", display: "none", icon: "circle-play", cursor: "pointer", rotation: 90 }) %>
20
- </button>
17
+ <button
18
+ id="<%= "#{object.id}_#{object.row.object_id}" %>"
19
+ class="gray-icon expand-toggle-icon"
20
+ data-advanced-table="true">
21
+ <%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
22
+ <%= pb_rails("icon", props: { id: "advanced-table_close_icon", display: "none", icon: "circle-play", cursor: "pointer", rotation: 90 }) %>
23
+ </button>
21
24
  <% end %>
22
25
  <%= pb_rails("flex/flex_item", props:{padding_left: index.zero? && object.row[:children].present? ? "none" : "xs"}) do %>
23
26
  <% if column[:custom_renderer].present? %>
@@ -42,4 +45,4 @@
42
45
  <% end %>
43
46
  <% end %>
44
47
  <% end %>
45
- <% end %>
48
+ <% end %>
@@ -65,7 +65,7 @@ module Playbook
65
65
  end
66
66
 
67
67
  def tag
68
- link ? "a" : "button"
68
+ link && !disabled ? "a" : "button"
69
69
  end
70
70
 
71
71
  def valid_emoji(icon)
@@ -14,6 +14,7 @@ type PbDateProps = {
14
14
  alignment?: "left" | "center" | "right";
15
15
  aria?: { [key: string]: string };
16
16
  className?: string;
17
+ dark?: boolean;
17
18
  data?: { [key: string]: string };
18
19
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
19
20
  id?: string;
@@ -29,6 +30,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
29
30
  aria = {},
30
31
  alignment = "left",
31
32
  className,
33
+ dark = false,
32
34
  data = {},
33
35
  htmlOptions = {},
34
36
  id,
@@ -56,7 +58,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
56
58
  );
57
59
 
58
60
  return (
59
- <div
61
+ <div
60
62
  {...ariaProps}
61
63
  {...dataProps}
62
64
  {...htmlProps}
@@ -93,7 +95,9 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
93
95
  </>
94
96
  : size == "md" || size == "lg"
95
97
  ? (
96
- <Title size={4}
98
+ <Title
99
+ dark={dark}
100
+ size={4}
97
101
  tag="h4"
98
102
  >
99
103
  {showIcon && (
@@ -127,6 +131,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
127
131
  <>
128
132
  {showIcon && (
129
133
  <Caption className="pb_icon_kit_container"
134
+ dark={dark}
130
135
  tag="span"
131
136
  >
132
137
  <Icon fixedWidth
@@ -138,15 +143,20 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
138
143
 
139
144
  {showDayOfWeek && (
140
145
  <>
141
- <Caption tag="div">{weekday}</Caption>
146
+ <Caption dark={dark}
147
+ tag="div">
148
+ {weekday}
149
+ </Caption>
142
150
  <Caption color="light"
151
+ dark={dark}
143
152
  tag="div"
144
153
  text=" • "
145
154
  />
146
155
  </>
147
156
  )}
148
157
 
149
- <Caption tag="span">
158
+ <Caption dark={dark}
159
+ tag="span">
150
160
  {month} {day}
151
161
  {currentYear != year && <>{`, ${year}`}</>}
152
162
  </Caption>
@@ -18,7 +18,7 @@ const DateDefault = (props) => {
18
18
  value={"2012-08-03"}
19
19
  {...props}
20
20
  />
21
- <Caption>{"(Hyphenated Date)"}</Caption>
21
+ <Caption {...props}>{"(Hyphenated Date)"}</Caption>
22
22
  </div>
23
23
 
24
24
  <br />
@@ -56,6 +56,7 @@ const DateDefault = (props) => {
56
56
  <Title
57
57
  size={4}
58
58
  text={"(Hyphenated Date)"}
59
+ {...props}
59
60
  />
60
61
  </div>
61
62
 
@@ -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
@@ -134,7 +134,7 @@ useEffect(() => {
134
134
  yearRange,
135
135
  required: false,
136
136
  }, scrollContainer)
137
- }, [])
137
+ })
138
138
  const filteredProps = {...props}
139
139
  if (filteredProps.marginBottom === undefined) {
140
140
  filteredProps.marginBottom = "sm"
@@ -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 %>