playbook_ui 14.14.0.pre.alpha.play1922tooltipfloatingui6361 → 14.14.0.pre.alpha.revert4339revert4242play1633displaytitle6424

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_drawer/_drawer.scss +32 -8
  3. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb +8 -0
  4. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb +33 -0
  5. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +0 -0
  6. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +20 -1
  7. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb +24 -0
  8. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.html.erb +21 -0
  9. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.md +1 -0
  10. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.html.erb +49 -0
  11. data/app/pb_kits/playbook/pb_drawer/docs/example.yml +5 -0
  12. data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +20 -12
  13. data/app/pb_kits/playbook/pb_drawer/drawer.rb +49 -1
  14. data/app/pb_kits/playbook/pb_drawer/index.js +257 -0
  15. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
  16. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.html.erb +11 -0
  17. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.md +1 -0
  18. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +1 -0
  19. data/app/pb_kits/playbook/pb_overlay/index.js +61 -0
  20. data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +5 -3
  21. data/app/pb_kits/playbook/pb_overlay/overlay.rb +9 -0
  22. data/app/pb_kits/playbook/pb_select/index.js +38 -0
  23. data/app/pb_kits/playbook/pb_select/select.rb +8 -0
  24. data/app/pb_kits/playbook/pb_title/_title.scss +36 -0
  25. data/app/pb_kits/playbook/pb_title/_title.tsx +10 -1
  26. data/app/pb_kits/playbook/pb_title/docs/_title_default.html.erb +1 -2
  27. data/app/pb_kits/playbook/pb_title/docs/_title_default.jsx +1 -1
  28. data/app/pb_kits/playbook/pb_title/docs/_title_display_size.html.erb +7 -0
  29. data/app/pb_kits/playbook/pb_title/docs/_title_display_size.jsx +54 -0
  30. data/app/pb_kits/playbook/pb_title/docs/_title_display_size.md +1 -0
  31. data/app/pb_kits/playbook/pb_title/docs/example.yml +2 -0
  32. data/app/pb_kits/playbook/pb_title/docs/index.js +1 -0
  33. data/app/pb_kits/playbook/pb_title/title.rb +10 -1
  34. data/dist/chunks/{_typeahead-BGTMEmj7.js → _typeahead-_d2af7Id.js} +1 -1
  35. data/dist/chunks/{_weekday_stacked-De2TduOp.js → _weekday_stacked-BZe1DgW-.js} +1 -1
  36. data/dist/chunks/vendor.js +1 -1
  37. data/dist/menu.yml +2 -2
  38. data/dist/playbook-doc.js +1 -1
  39. data/dist/playbook-rails-react-bindings.js +1 -1
  40. data/dist/playbook-rails.js +1 -1
  41. data/dist/playbook.css +1 -1
  42. data/lib/playbook/version.rb +1 -1
  43. metadata +19 -4
@@ -0,0 +1,61 @@
1
+ import PbEnhancedElement from '../pb_enhanced_element'
2
+
3
+ const OVERLAY_SELECTOR = '[data-pb-overlay]'
4
+ const OVERLAY_SCROLL_ELEMENT = '[data-overlay-scroll-element]'
5
+ const PREVIOUS_OVERLAY_CLASSNAME = '[data-previous-overlay-classname]'
6
+ const SUBSEQUENT_OVERLAY_CLASSNAME = '[data-subsequent-overlay-classname]'
7
+
8
+ export default class PbOverlay extends PbEnhancedElement {
9
+ static get selector() {
10
+ return OVERLAY_SELECTOR
11
+ }
12
+
13
+ get target() {
14
+ return this.element.querySelector(OVERLAY_SCROLL_ELEMENT).children[0]
15
+ }
16
+
17
+ connect() {
18
+ this.handleOverlayDynamic()
19
+ }
20
+
21
+ handleOverlayDynamic() {
22
+ const isOverlayDynamic = this.element.dataset?.overlayDynamic
23
+
24
+ if (isOverlayDynamic) {
25
+ const previousOverlayElement = this.element.querySelector(PREVIOUS_OVERLAY_CLASSNAME)
26
+ const previousOverlayClassname = previousOverlayElement?.dataset?.previousOverlayClassname
27
+ const subsequentOverlayElement = this.element.querySelector(SUBSEQUENT_OVERLAY_CLASSNAME)
28
+ const subsequentOverlayClassname = subsequentOverlayElement?.dataset?.subsequentOverlayClassname
29
+
30
+ const handleScrollChange = (target) => {
31
+ const { scrollLeft, scrollWidth, clientWidth } = target
32
+ const isScrollAtStart = scrollLeft === 0
33
+ const isScrollAtEnd = scrollLeft + clientWidth >= scrollWidth - 1
34
+
35
+ if (isScrollAtStart) {
36
+ previousOverlayElement.classList.remove(previousOverlayClassname)
37
+ } else {
38
+ previousOverlayElement.classList.add(previousOverlayClassname)
39
+ }
40
+
41
+ if (isScrollAtEnd) {
42
+ subsequentOverlayElement.classList.remove(subsequentOverlayClassname)
43
+ } else {
44
+ subsequentOverlayElement.classList.add(subsequentOverlayClassname)
45
+ }
46
+ }
47
+
48
+ this.target.addEventListener('scroll', (event) => {
49
+ handleScrollChange(event.target)
50
+ })
51
+
52
+ handleScrollChange(this.target)
53
+ }
54
+ }
55
+
56
+ disconnect() {
57
+ if (this.element.dataset?.overlayDynamic) {
58
+ this.target.removeEventListener('scroll')
59
+ }
60
+ }
61
+ }
@@ -16,12 +16,14 @@ id: object.id,
16
16
  <% end %>
17
17
 
18
18
  <% else %>
19
- <div class="<%= previous_overlay_class_name %>"></div>
19
+ <div class="<%= previous_overlay_class_name %>" data-previous-overlay-classname="<%= previous_overlay_class_name %>"></div>
20
20
 
21
- <%= content.presence %>
21
+ <div data-overlay-scroll-element="true">
22
+ <%= content.presence %>
23
+ </div>
22
24
 
23
25
  <% if has_subsequent_overlay %>
24
- <div class="<%= subsequent_overlay_class_name %>"></div>
26
+ <div class="<%= subsequent_overlay_class_name %>" data-subsequent-overlay-classname="<%= subsequent_overlay_class_name %>"></div>
25
27
  <% end %>
26
28
  <% end %>
27
29
  <% end %>
@@ -8,6 +8,8 @@ module Playbook
8
8
  default: "card_light"
9
9
  prop :layout, type: Playbook::Props::HashProp,
10
10
  default: { "bottom": "full" }
11
+ prop :dynamic, type: Playbook::Props::Boolean,
12
+ default: false
11
13
 
12
14
  def classname
13
15
  generate_classname("pb_overlay")
@@ -105,6 +107,13 @@ module Playbook
105
107
  "bg_dark": "#0a0527",
106
108
  }
107
109
  end
110
+
111
+ def data_attributes
112
+ data ||= {}
113
+ data.merge!("data-pb-overlay" => true)
114
+ data.merge!("data-overlay-dynamic" => true) if dynamic
115
+ data
116
+ end
108
117
  end
109
118
  end
110
119
  end
@@ -0,0 +1,38 @@
1
+ import PbEnhancedElement from "../pb_enhanced_element";
2
+
3
+ const SELECT_WRAPPER_SELECTOR = "[data-pb-select]";
4
+ const SELECT_VALIDATION_MESSAGE_CLASS = ".pb_body_kit_negative";
5
+
6
+ export default class PbSelect extends PbEnhancedElement {
7
+ static get selector() {
8
+ return SELECT_WRAPPER_SELECTOR;
9
+ }
10
+
11
+ connect() {
12
+ this.setValidationMessage();
13
+ }
14
+
15
+ setValidationMessage() {
16
+ const validationMessage = this.element.dataset?.validationMessage;
17
+
18
+ if (validationMessage) {
19
+ const selectElement = this.element.querySelector("select");
20
+ const setErrorTextContent = (text, timeout) => {
21
+ setTimeout(() => {
22
+ const errorMessageElement = this.element.querySelector(SELECT_VALIDATION_MESSAGE_CLASS);
23
+ if (errorMessageElement) {
24
+ errorMessageElement.textContent = text;
25
+ } else {
26
+ setErrorTextContent(text, 100);
27
+ }
28
+ }, timeout);
29
+ };
30
+
31
+ selectElement.addEventListener("change", (e) => {
32
+ if (!e.target.checkValidity()) {
33
+ setErrorTextContent(validationMessage, 300);
34
+ }
35
+ });
36
+ }
37
+ }
38
+ }
@@ -21,6 +21,7 @@ module Playbook
21
21
  prop :options, type: Playbook::Props::HashArray, required: false, default: []
22
22
  prop :show_arrow, type: Playbook::Props::Boolean, default: false
23
23
  prop :required, type: Playbook::Props::Boolean, default: false
24
+ prop :validation_message, type: Playbook::Props::String, default: ""
24
25
 
25
26
  def classnames
26
27
  classname + inline_class + compact_class + show_arrow_class
@@ -88,6 +89,13 @@ module Playbook
88
89
  "app/pb_kits/playbook/utilities/icons/angle-down.svg"
89
90
  end
90
91
 
92
+ def data_attributes
93
+ data = attributes[:data] || {}
94
+ data.merge!("data-pb-select" => true)
95
+ data.merge!("data-validation-message" => validation_message) if validation_message.present?
96
+ data
97
+ end
98
+
91
99
  private
92
100
 
93
101
  def error_class
@@ -31,6 +31,42 @@
31
31
  @include pb_title_thin;
32
32
  }
33
33
 
34
+ &[class*=_display] {
35
+ font-size: clamp(
36
+ 24px,
37
+ calc(24px + (128 - 24) * ((100vw - 320px) / (1920 - 320))),
38
+ 128px
39
+ );
40
+ }
41
+
42
+ &[class*=_dynamic] {
43
+ &[class*=_xs] {
44
+ font-size: min(2vw, 80vw / 16);
45
+ }
46
+
47
+ &[class*=_sm] {
48
+ font-size: min(2.5vw, 96vw / 16);
49
+ }
50
+
51
+ &[class*=_md] {
52
+ font-size: min(4vw, 160vw / 16);
53
+ }
54
+
55
+ &[class*=_lg] {
56
+ font-size: min(5vw, 192vw / 16);
57
+ }
58
+
59
+ &[class*=_xl] {
60
+ font-size: min(6vw, 224vw / 16);
61
+ }
62
+
63
+ &[class*=_xxl] {
64
+ font-size: min(8vw, 256vw / 16);
65
+ }
66
+ }
67
+
68
+
69
+
34
70
  @each $size, $size_value in $breakpoints_grid {
35
71
  @for $title_size_value from 1 through 4 {
36
72
  $min_size: map-get($size_value, "min");
@@ -3,7 +3,7 @@ import classnames from 'classnames'
3
3
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { deprecatedProps, GlobalProps, globalProps } from '../utilities/globalProps'
5
5
 
6
- type SizeType = 1 | 2 | 3 | 4 | "1" | "2" | "3" | "4"
6
+ type SizeType = 1 | 2 | 3 | 4 | "1" | "2" | "3" | "4" | "display"
7
7
  type SizeResponsiveType = {[key: string]: SizeType}
8
8
 
9
9
  type TitleProps = {
@@ -16,6 +16,7 @@ type TitleProps = {
16
16
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
17
17
  id?: string,
18
18
  size?: SizeType | SizeResponsiveType,
19
+ displaySize?: null | "xs" | "sm" | "md" | "lg" | "xl" | "xxl",
19
20
  tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span",
20
21
  text?: string,
21
22
  variant?: null | "link",
@@ -32,6 +33,7 @@ const Title = (props: TitleProps): React.ReactElement => {
32
33
  htmlOptions = {},
33
34
  id,
34
35
  size = 3,
36
+ displaySize = null,
35
37
  bold = true,
36
38
  tag = 'h3',
37
39
  text,
@@ -56,9 +58,16 @@ const Title = (props: TitleProps): React.ReactElement => {
56
58
  return css.trim()
57
59
  }
58
60
 
61
+ const buildDisplaySize = () => {
62
+ if (displaySize) {
63
+ return `pb_title_kit_dynamic_${displaySize}`
64
+ }
65
+ }
66
+
59
67
  const classes = classnames(
60
68
  buildCss('pb_title_kit', isSizeNumberOrString ? `size_${size}` : "", variant, color, getBold),
61
69
  globalProps(props),
70
+ buildDisplaySize(),
62
71
  buildResponsiveSizeCss(),
63
72
  className
64
73
  )
@@ -1,10 +1,9 @@
1
1
  <%= pb_rails("title", props: {
2
+ margin_bottom: "md"
2
3
  }) do %>
3
4
  Default Title
4
5
  <% end %>
5
6
 
6
- <br/>
7
-
8
7
  <%= pb_rails("title", props: { text: "Title 1", tag: "h1", size: 1 }) %>
9
8
  <%= pb_rails("title", props: { text: "Title 2", tag: "h2", size: 2 }) %>
10
9
  <%= pb_rails("title", props: { text: "Title 3", tag: "h3", size: 3 }) %>
@@ -6,10 +6,10 @@ const TitleDefault = (props) => {
6
6
  return (
7
7
  <div>
8
8
  <Title
9
+ marginBottom='md'
9
10
  text="Default Title"
10
11
  {...props}
11
12
  />
12
- <br />
13
13
  <Title
14
14
  size={1}
15
15
  tag="h1"
@@ -0,0 +1,7 @@
1
+ <%= pb_rails("title", props: { text: "Display Size xs", tag: "h1", display_size: "xs" }) %>
2
+ <%= pb_rails("title", props: { text: "Display Size sm", tag: "h1", display_size: "sm" }) %>
3
+ <%= pb_rails("title", props: { text: "Display Size md", tag: "h1", display_size: "md" }) %>
4
+ <%= pb_rails("title", props: { text: "Display Size lg", tag: "h1", display_size: "lg" }) %>
5
+ <%= pb_rails("title", props: { text: "Display Size xl", tag: "h1", display_size: "xl" }) %>
6
+ <%= pb_rails("title", props: { text: "Display Size xxl", tag: "h1", display_size: "xxl" }) %>
7
+ <%= pb_rails("title", props: { text: "This is a size of display", tag: "h1", size: "display"}) %>
@@ -0,0 +1,54 @@
1
+ import React from 'react'
2
+
3
+ import Title from '../_title'
4
+
5
+ const TitleDisplaySize = (props) => {
6
+ return (
7
+ <div>
8
+ <Title
9
+ displaySize="xs"
10
+ tag="h1"
11
+ text="Display Size xs"
12
+ {...props}
13
+ />
14
+ <Title
15
+ displaySize="sm"
16
+ tag="h1"
17
+ text="Display Size sm"
18
+ {...props}
19
+ />
20
+ <Title
21
+ displaySize="md"
22
+ tag="h1"
23
+ text="Display Size md"
24
+ {...props}
25
+ />
26
+ <Title
27
+ displaySize="lg"
28
+ tag="h1"
29
+ text="Display Size lg"
30
+ {...props}
31
+ />
32
+ <Title
33
+ displaySize="xl"
34
+ tag="h1"
35
+ text="Display Size xl"
36
+ {...props}
37
+ />
38
+ <Title
39
+ displaySize="xxl"
40
+ tag="h1"
41
+ text="Display Size xxl"
42
+ {...props}
43
+ />
44
+ <Title
45
+ size="display"
46
+ tag="h1"
47
+ text="This is a size of display"
48
+ {...props}
49
+ />
50
+ </div>
51
+ )
52
+ }
53
+
54
+ export default TitleDisplaySize
@@ -0,0 +1 @@
1
+ Responsive sizes for large screens and tablets, perfect for digital signage.
@@ -5,6 +5,7 @@ examples:
5
5
  - title_colors: Colors
6
6
  - title_responsive: Responsive
7
7
  - title_truncate: Truncate
8
+ - title_display_size: Display Size
8
9
 
9
10
  react:
10
11
  - title_default: Default UI
@@ -12,3 +13,4 @@ examples:
12
13
  - title_colors: Colors
13
14
  - title_responsive: Responsive
14
15
  - title_truncate: Truncate
16
+ - title_display_size: Display Size
@@ -3,3 +3,4 @@ export { default as TitleLightWeight } from './_title_light_weight.jsx'
3
3
  export { default as TitleColors } from './_title_colors.jsx'
4
4
  export { default as TitleResponsive } from './_title_responsive.jsx'
5
5
  export { default as TitleTruncate } from './_title_truncate.jsx'
6
+ export { default as TitleDisplaySize } from './_title_display_size.jsx'
@@ -16,12 +16,15 @@ module Playbook
16
16
  default: nil,
17
17
  deprecated: true
18
18
  prop :bold, type: Playbook::Props::Boolean, default: true
19
+ prop :display_size, type: Playbook::Props::Enum,
20
+ values: [nil, "xs", "sm", "md", "lg", "xl", "xxl"],
21
+ default: nil
19
22
 
20
23
  def classname
21
24
  if is_size_responsive
22
25
  generate_classname("pb_title_kit", variant, color, is_bold) + generate_responsive_size_classname
23
26
  else
24
- generate_classname("pb_title_kit", size, variant, color, is_bold)
27
+ generate_classname("pb_title_kit", size, variant, color, is_bold) + generate_display_size
25
28
  end
26
29
  end
27
30
 
@@ -29,6 +32,12 @@ module Playbook
29
32
  bold ? nil : "thin"
30
33
  end
31
34
 
35
+ def generate_display_size
36
+ return "" if display_size.nil?
37
+
38
+ " pb_title_kit_dynamic_#{display_size}"
39
+ end
40
+
32
41
  def is_size_responsive
33
42
  try(:size).is_a?(::Hash)
34
43
  end