playbook_ui 10.21.0.pre.alpha.na1 → 10.21.0.pre.alpha.rg1

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/_playbook.scss +11 -0
  3. data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +1 -1
  4. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -2
  5. data/app/pb_kits/playbook/pb_avatar/avatar.rb +1 -1
  6. data/app/pb_kits/playbook/pb_avatar/avatar.test.js +1 -1
  7. data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
  8. data/app/pb_kits/playbook/pb_card/card.rb +88 -0
  9. data/app/pb_kits/playbook/pb_card/card_body.rb +1 -1
  10. data/app/pb_kits/playbook/pb_flex/docs/_flex_align.jsx +1 -1
  11. data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -24
  12. data/app/pb_kits/playbook/pb_popover/_popover.jsx +2 -4
  13. data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
  14. data/app/pb_kits/playbook/pb_popover/index.js +4 -9
  15. data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
  16. data/app/pb_kits/playbook/utilities/_align_content.scss +29 -0
  17. data/app/pb_kits/playbook/utilities/_align_items.scss +24 -0
  18. data/app/pb_kits/playbook/utilities/_align_self.scss +29 -0
  19. data/app/pb_kits/playbook/utilities/_flex.scss +15 -0
  20. data/app/pb_kits/playbook/utilities/_flex_direction.scss +19 -0
  21. data/app/pb_kits/playbook/utilities/_flex_grow.scss +9 -0
  22. data/app/pb_kits/playbook/utilities/_flex_shrink.scss +9 -0
  23. data/app/pb_kits/playbook/utilities/_flex_wrap.scss +14 -0
  24. data/app/pb_kits/playbook/utilities/_justify_content.scss +23 -0
  25. data/app/pb_kits/playbook/utilities/_justify_self.scss +19 -0
  26. data/app/pb_kits/playbook/utilities/_order.scss +55 -0
  27. data/app/pb_kits/playbook/utilities/globalProps.js +81 -3
  28. data/lib/playbook/align_content.rb +29 -0
  29. data/lib/playbook/align_items.rb +29 -0
  30. data/lib/playbook/align_self.rb +29 -0
  31. data/lib/playbook/classnames.rb +11 -0
  32. data/lib/playbook/flex.rb +29 -0
  33. data/lib/playbook/flex_direction.rb +29 -0
  34. data/lib/playbook/flex_grow.rb +29 -0
  35. data/lib/playbook/flex_shrink.rb +29 -0
  36. data/lib/playbook/flex_wrap.rb +29 -0
  37. data/lib/playbook/justify_content.rb +29 -0
  38. data/lib/playbook/justify_self.rb +29 -0
  39. data/lib/playbook/kit_base.rb +22 -0
  40. data/lib/playbook/order.rb +29 -0
  41. data/lib/playbook/version.rb +1 -1
  42. metadata +24 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c91379a8ff1fbd4421f2d351cfd11cd08cf5dac3b00d275e2b8312b64ab983a9
4
- data.tar.gz: 80f1bcd2b434b6213116668028aadbce11ef28b54d5ab758aea3d87c00eee109
3
+ metadata.gz: 0a6ea164e06111d003426c3549cb4173cdb07a1161f61552c1bdf8b08b217656
4
+ data.tar.gz: a4c26076cbc2d2710d481dd8a29b574a8eb1abbe3e411bee6010ff2049a1d313
5
5
  SHA512:
6
- metadata.gz: 10bd2dc160d0cc7ad0cfc921b20b0429611bb628b6203cfa75528bfa32c4a3bf2a57506f4922dbb8fdfc2e75df4e0698759d21312a9a78dac41b3c044a5eea6e
7
- data.tar.gz: c372e8a2490809b8345cb99230a49cb3c2420bdeec256a05cad5d10688a16ca447b44cbc582ab5cebd1af8517f7a3fc0ed63fdc7f22c54316461930baff3161f
6
+ metadata.gz: 38c5657dd72a901913c9e537d435481ee0c43c48eed6380430e75fd74b5a6486d178de64a47f5ac2e9bff572b553e22eea7657b0dbd71f5494ad0afaf779c261
7
+ data.tar.gz: 5d348958c7c6fbc22cdd8e04a0e11c0d55725182e36d5e1e4a478abd50550a7e910e26c56524ab08c43e31dd6d412abfc0a4965fc7894cd90e9ff882724cda26
@@ -100,3 +100,14 @@
100
100
  @import './utilities/shadow';
101
101
  @import './utilities/line_height';
102
102
  @import './utilities/display';
103
+ @import './utilities/flex_direction';
104
+ @import './utilities/justify_content';
105
+ @import './utilities/flex_wrap';
106
+ @import './utilities/justify_self';
107
+ @import './utilities/align_items';
108
+ @import './utilities/align_content';
109
+ @import './utilities/align_self';
110
+ @import './utilities/flex';
111
+ @import './utilities/flex_grow';
112
+ @import './utilities/flex_shrink';
113
+ @import './utilities/order';
@@ -44,7 +44,7 @@ const Avatar = (props: AvatarProps) => {
44
44
  const dataProps = buildDataProps(data)
45
45
  const ariaProps = buildAriaProps(aria)
46
46
  const classes = classnames(
47
- buildCss('pb_avatar_kit', `size_${size}`),
47
+ buildCss('pb_avatar_kit', size),
48
48
  globalProps(props),
49
49
  className
50
50
  )
@@ -16,8 +16,8 @@ $avatar-sizes: (
16
16
  position: relative;
17
17
 
18
18
  @each $name, $size in $avatar-sizes {
19
- &[class*=_size_#{$name}],
20
- &[class*=_size_#{$name}_thumb] {
19
+ &[class*=_#{$name}],
20
+ &[class*=_#{$name}_thumb] {
21
21
  width: $size;
22
22
  height: $size;
23
23
  object-fit: cover;
@@ -18,7 +18,7 @@ module Playbook
18
18
  end
19
19
 
20
20
  def classname
21
- generate_classname("pb_avatar_kit", "size_#{size}")
21
+ generate_classname("pb_avatar_kit", size)
22
22
  end
23
23
 
24
24
  def online_status_props
@@ -22,7 +22,7 @@ test('loads the given image url and name', () => {
22
22
  const image = screen.getByAltText(imageAlt)
23
23
  const initials = name.split(/\s/)[0].substr(0, 1) + name.split(/\s/)[1].substr(0, 1)
24
24
 
25
- expect(kit).toHaveClass('pb_avatar_kit_size_md')
25
+ expect(kit).toHaveClass('pb_avatar_kit_md')
26
26
  expect(kit).toHaveAttribute('data-initials', initials)
27
27
  expect(image).toHaveAttribute('data-src', imageUrl)
28
28
  expect(image).toHaveAttribute('src', imageUrl)
@@ -4,7 +4,7 @@
4
4
  class: object.classname,
5
5
  aria: object.aria,
6
6
  dark: object.dark) do %>
7
- <%= pb_rails("card/card_body", props: { padding: object.body_padding }) do %>
7
+ <%= pb_rails("card/card_body", props: { padding: object.body_padding, flex_direction: object.body_flex_direction, flex_wrap: object.body_flex_wrap, justify_content: object.body_justify_content, justify_self: object.body_justify_self, align_items: object.body_align_items, align_content: object.body_align_content, align_self: object.body_align_self, flex: object.body_flex, flex_grow: object.body_flex_grow, flex_shrink: object.body_flex_shrink, order: object.body_order }) do %>
8
8
  <%= content %>
9
9
  <% end if content.present? %>
10
10
  <% end %>
@@ -36,6 +36,94 @@ module Playbook
36
36
  end
37
37
  end
38
38
 
39
+ def body_flex_direction
40
+ if flex_direction.present?
41
+ "flex_direction_#{flex_direction}"
42
+ else
43
+ ""
44
+ end
45
+ end
46
+
47
+ def body_flex_wrap
48
+ if flex_wrap.present?
49
+ "flex_wrap_#{flex_wrap}"
50
+ else
51
+ ""
52
+ end
53
+ end
54
+
55
+ def body_justify_content
56
+ if justify_content.present?
57
+ "justify_content_#{justify_content}"
58
+ else
59
+ ""
60
+ end
61
+ end
62
+
63
+ def body_justify_self
64
+ if justify_self.present?
65
+ "justify_self_#{justify_self}"
66
+ else
67
+ ""
68
+ end
69
+ end
70
+
71
+ def body_align_items
72
+ if align_items.present?
73
+ "align_items_#{align_items}"
74
+ else
75
+ ""
76
+ end
77
+ end
78
+
79
+ def body_align_content
80
+ if align_content.present?
81
+ "align_content_#{align_content}"
82
+ else
83
+ ""
84
+ end
85
+ end
86
+
87
+ def body_align_self
88
+ if align_self.present?
89
+ "align_self_#{align_self}"
90
+ else
91
+ ""
92
+ end
93
+ end
94
+
95
+ def body_flex
96
+ if flex.present?
97
+ "flex_#{flex}"
98
+ else
99
+ ""
100
+ end
101
+ end
102
+
103
+ def body_flex_grow
104
+ if flex_grow.present?
105
+ "flex_grow_#{flex_grow}"
106
+ else
107
+ ""
108
+ end
109
+ end
110
+
111
+ def body_flex_shrink
112
+ if flex_shrink.present?
113
+ "flex_shrink_#{flex_shrink}"
114
+ else
115
+ ""
116
+ end
117
+ end
118
+
119
+ def body_order
120
+ if order.present?
121
+ "order_#{order}"
122
+ else
123
+ ""
124
+ end
125
+ end
126
+
39
127
  private
40
128
 
41
129
  def selected_class
@@ -4,7 +4,7 @@ module Playbook
4
4
  module PbCard
5
5
  class CardBody < Playbook::KitBase
6
6
  def classname
7
- generate_classname("pb_card_body_kit", padding, separator: " ")
7
+ generate_classname("pb_card_body_kit", padding, flex_direction, justify_content, flex_wrap, justify_self, align_items, align_content, align_self, flex, flex_grow, flex_shrink, order, separator: " ")
8
8
  end
9
9
  end
10
10
  end
@@ -7,7 +7,7 @@ const FlexAlign = (props) => {
7
7
 
8
8
  <Title
9
9
  size={4}
10
- text="Row"
10
+ text="row"
11
11
  {...props}
12
12
  />
13
13
  <br />
@@ -8,17 +8,11 @@ module Playbook
8
8
  default: false
9
9
  prop :shrink, type: Playbook::Props::Boolean,
10
10
  default: false
11
- prop :flex, type: Playbook::Props::Enum,
12
- values: %w[0 1 2 3 4 5 6 7 8 9 10 11 12 none],
13
- default: "none"
11
+
14
12
  prop :overflow, type: Playbook::Props::Enum,
15
13
  values: %w[auto hidden inherit initial scroll visible] + [nil],
16
14
  default: nil
17
15
 
18
- prop :order, type: Playbook::Props::Enum,
19
- values: %w[1 2 3 4 5 6 7 8 9 10 11 12 first none],
20
- default: "none"
21
-
22
16
  prop :align_self, type: Playbook::Props::Enum,
23
17
  values: %w[start center end stretch] + [nil],
24
18
  default: nil
@@ -27,7 +21,7 @@ module Playbook
27
21
  default: false
28
22
 
29
23
  def classname
30
- generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, flex_class, display_flex_class) + overflow_class + order_class + align_self_class
24
+ generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, display_flex_class) + overflow_class + align_self_class
31
25
  end
32
26
 
33
27
  def style_value
@@ -59,22 +53,6 @@ module Playbook
59
53
  def shrink_class
60
54
  shrink ? "shrink" : nil
61
55
  end
62
-
63
- def flex_class
64
- if flex == "none"
65
- nil
66
- else
67
- "flex_#{flex}"
68
- end
69
- end
70
-
71
- def order_class
72
- if order == "none"
73
- ""
74
- else
75
- "order_#{order}"
76
- end
77
- end
78
56
  end
79
57
  end
80
58
  end
@@ -150,16 +150,14 @@ export default class PbReactPopover extends React.Component<PbPopoverProps> {
150
150
  const targetIsReference =
151
151
  target.closest('.pb_popover_reference_wrapper') !== null
152
152
 
153
- if (targetIsReference) return
154
-
155
153
  switch (closeOnClick) {
156
154
  case 'outside':
157
- if (!targetIsPopover) {
155
+ if (!targetIsPopover || targetIsReference) {
158
156
  shouldClosePopover(true)
159
157
  }
160
158
  break
161
159
  case 'inside':
162
- if (targetIsPopover) {
160
+ if (targetIsPopover || targetIsReference) {
163
161
  shouldClosePopover(true)
164
162
  }
165
163
  break
@@ -1,23 +1,23 @@
1
1
  <%= pb_rails("flex", props: {classname: "flex-container", spacing: "between"}) do %>
2
2
  <span>
3
- <%= pb_rails("button", props: { text: "Click Inside", variant: "secondary", id: 'inside-popover-1' }) %>
3
+ <%= pb_rails("button", props: { text: "Click Inside", variant: "secondary", id: "inside-popover-1" }) %>
4
4
  <%= pb_rails("popover", props: {
5
5
  close_on_click: "inside",
6
6
  trigger_element_id: "inside-popover-1",
7
7
  tooltip_id: "inside-tooltip-1",
8
- position: 'bottom',
8
+ position: "bottom",
9
9
  offset: true
10
10
  }) do %>
11
11
  Click on me!
12
12
  <% end %>
13
13
  </span>
14
14
  <span>
15
- <%= pb_rails("button", props: { text: "Click Outside", variant: "secondary", id: 'outside-popover-1' }) %>
15
+ <%= pb_rails("button", props: { text: "Click Outside", variant: "secondary", id: "outside-popover-1" }) %>
16
16
  <%= pb_rails("popover", props: {
17
17
  close_on_click: "outside",
18
18
  trigger_element_id: "outside-popover-1",
19
19
  tooltip_id: "outside-tooltip-1",
20
- position: 'left',
20
+ position: "left",
21
21
  offset: true
22
22
  }) do %>
23
23
  Click anywhere but me!
@@ -27,16 +27,16 @@
27
27
  <%= pb_rails("button", props: {
28
28
  text: "Click Anywhere",
29
29
  variant: "secondary",
30
- id: 'any-popover-1'
30
+ id: "any-popover-1"
31
31
  }) %>
32
32
  <%= pb_rails("popover", props: {
33
33
  close_on_click: "any",
34
34
  trigger_element_id: "any-popover-1",
35
35
  tooltip_id: "any-tooltip-1",
36
- position: 'top',
36
+ position: "top",
37
37
  offset: true
38
38
  }) do %>
39
39
  Click anything!
40
40
  <% end %>
41
41
  </span>
42
- <% end %>
42
+ <% end %>
@@ -36,15 +36,14 @@ export default class PbPopover extends PbEnhancedElement {
36
36
  }
37
37
 
38
38
  setTimeout(() => {
39
- this.popper.update()
40
39
  this.toggleTooltip()
40
+ this.popper.update()
41
41
  }, 0)
42
42
  })
43
43
  }
44
44
 
45
45
  checkCloseTooltip() {
46
46
  document.querySelector('body').addEventListener('click', ({ target }) => {
47
- const isTriggerElement = target.closest(`#${this.triggerElementId}`) !== null
48
47
  const isTooltipElement = target.closest(`#${this.tooltipId}`) !== null
49
48
 
50
49
  switch (this.closeOnClick) {
@@ -52,21 +51,17 @@ export default class PbPopover extends PbEnhancedElement {
52
51
  this.hideTooltip()
53
52
  break
54
53
  case 'outside':
55
- if (isTooltipElement) {
56
- this.checkCloseTooltip()
57
- } else {
54
+ if (!isTooltipElement) {
58
55
  this.hideTooltip()
59
56
  }
60
57
  break
61
58
  case 'inside':
62
- if (isTooltipElement || isTriggerElement) {
59
+ if (isTooltipElement) {
63
60
  this.hideTooltip()
64
- } else {
65
- this.checkCloseTooltip()
66
61
  }
67
62
  break
68
63
  }
69
- }, { once: true })
64
+ }, true)
70
65
  }
71
66
 
72
67
  hideTooltip() {
@@ -3,7 +3,7 @@
3
3
  class: object.classname,
4
4
  data: object.data,
5
5
  id: object.id) do %>
6
- <div class="pb_popover_tooltip" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.z_index_helper %>">
6
+ <div class="pb_popover_tooltip hide" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.z_index_helper %>">
7
7
  <div class="pb_popover_body <%= object.width_height_class_helper %> <%= object.popover_spacing_helper %>" style="<%= object.width_height_helper %>">
8
8
  <%= content.presence %>
9
9
  </div>
@@ -0,0 +1,29 @@
1
+ .align_content_start {
2
+ display: flex;
3
+ align-content: start;
4
+ }
5
+
6
+ .align_content_end {
7
+ display: flex;
8
+ align-content: end;
9
+ }
10
+
11
+ .align_content_center {
12
+ display: flex;
13
+ align-content: center;
14
+ }
15
+
16
+ .align_content_space_between {
17
+ display: flex;
18
+ align-content: space-between;
19
+ }
20
+
21
+ .align_content_space_around {
22
+ display: flex;
23
+ align-content: space-around;
24
+ }
25
+
26
+ .align_content_space_evenly {
27
+ display: flex;
28
+ align-content: space-evenly;
29
+ }
@@ -0,0 +1,24 @@
1
+ .align_items_start {
2
+ display: flex;
3
+ align-items: flex-start;
4
+ }
5
+
6
+ .align_items_end {
7
+ display: flex;
8
+ align-items: flex-end;
9
+ }
10
+
11
+ .align_items_center {
12
+ display: flex;
13
+ align-items: center;
14
+ }
15
+
16
+ .align_items_baseline {
17
+ display: flex;
18
+ align-items: baseline;
19
+ }
20
+
21
+ .align_items_stretch {
22
+ display: flex;
23
+ align-items: stretch;
24
+ }
@@ -0,0 +1,29 @@
1
+ .align_self_start {
2
+ display: flex;
3
+ align-self: start;
4
+ }
5
+
6
+ .align_self_end {
7
+ display: flex;
8
+ align-self: end;
9
+ }
10
+
11
+ .align_self_auto {
12
+ display: flex;
13
+ align-self: auto;
14
+ }
15
+
16
+ .align_self_center {
17
+ display: flex;
18
+ align-self: center;
19
+ }
20
+
21
+ .align_self_stretch {
22
+ display: flex;
23
+ align-self: stretch;
24
+ }
25
+
26
+ .align_self_baseline {
27
+ display: flex;
28
+ align-self: baseline;
29
+ }
@@ -0,0 +1,15 @@
1
+ .flex_auto {
2
+ flex: auto;
3
+ }
4
+
5
+ .flex_initial {
6
+ flex: initial;
7
+ }
8
+
9
+ .flex_none {
10
+ flex: none;
11
+ }
12
+
13
+ .flex_1 {
14
+ flex: 1;
15
+ }
@@ -0,0 +1,19 @@
1
+ .flex_direction_row {
2
+ display: flex;
3
+ flex-direction: row;
4
+ }
5
+
6
+ .flex_direction_column {
7
+ display: flex;
8
+ flex-direction: column;
9
+ }
10
+
11
+ .flex_direction_row_reverse {
12
+ display: flex;
13
+ flex-direction: row-reverse;
14
+ }
15
+
16
+ .flex_direction_column_reverse {
17
+ display: flex;
18
+ flex-direction: column-reverse;
19
+ }
@@ -0,0 +1,9 @@
1
+ .flex_grow_1 {
2
+ display: flex;
3
+ flex-grow: 1;
4
+ }
5
+
6
+ .flex_grow_0 {
7
+ display: flex;
8
+ flex-grow: 0;
9
+ }
@@ -0,0 +1,9 @@
1
+ .flex_shrink_1 {
2
+ display: flex;
3
+ flex-shrink: 1;
4
+ }
5
+
6
+ .flex_shrink_0 {
7
+ display: flex;
8
+ flex-shrink: 0;
9
+ }
@@ -0,0 +1,14 @@
1
+ .flex_wrap_wrap {
2
+ display: flex;
3
+ flex-wrap: wrap;
4
+ }
5
+
6
+ .flex_wrap_nowrap {
7
+ display: flex;
8
+ flex-wrap: nowrap;
9
+ }
10
+
11
+ .flex_wrap_wrap_reverse {
12
+ display: flex;
13
+ flex-wrap: wrap-reverse;
14
+ }
@@ -0,0 +1,23 @@
1
+ .justify_content_start {
2
+ justify-content: start;
3
+ }
4
+
5
+ .justify_content_end {
6
+ justify-content: end;
7
+ }
8
+
9
+ .justify_content_center {
10
+ justify-content: center;
11
+ }
12
+
13
+ .justify_content_space_between {
14
+ justify-content: space-between;
15
+ }
16
+
17
+ .justify_content_space_around {
18
+ justify-content: space-around;
19
+ }
20
+
21
+ .justify_content_space_evenly {
22
+ justify-content: space-evenly;
23
+ }
@@ -0,0 +1,19 @@
1
+ .justify_self_auto {
2
+ justify-self: auto;
3
+ }
4
+
5
+ .justify_self_start {
6
+ justify-self: start;
7
+ }
8
+
9
+ .justify_self_end {
10
+ justify-self: end;
11
+ }
12
+
13
+ .justify_self_center {
14
+ justify-self: center;
15
+ }
16
+
17
+ .justify_self_stretch {
18
+ justify-self: stretch;
19
+ }
@@ -0,0 +1,55 @@
1
+ .order_1 {
2
+ order: 1;
3
+ }
4
+
5
+ .order_2 {
6
+ order: 2;
7
+ }
8
+
9
+ .order_3 {
10
+ order: 3;
11
+ }
12
+
13
+ .order_4 {
14
+ order: 4;
15
+ }
16
+
17
+ .order_5 {
18
+ order: 5;
19
+ }
20
+
21
+ .order_6 {
22
+ order: 6;
23
+ }
24
+
25
+ .order_7 {
26
+ order: 7;
27
+ }
28
+
29
+ .order_8 {
30
+ order: 8;
31
+ }
32
+
33
+ .order_9 {
34
+ order: 9;
35
+ }
36
+
37
+ .order_10 {
38
+ order: 10;
39
+ }
40
+
41
+ .order_11 {
42
+ order: 11;
43
+ }
44
+
45
+ .order_12 {
46
+ order: 12;
47
+ }
48
+
49
+ .order_none {
50
+ order: none;
51
+ }
52
+
53
+ .order_first {
54
+ order: -1;
55
+ }
@@ -47,13 +47,13 @@ const numberSpacingProps = ({ numberSpacing }) => {
47
47
 
48
48
  const maxWidthProps = ({ maxWidth }) => {
49
49
  let css = ''
50
- css += maxWidth ? `max_width_${maxWidth } ` : ''
50
+ css += maxWidth ? `max_width_${maxWidth} ` : ''
51
51
  return css
52
52
  }
53
53
 
54
54
  const zIndexProps = ({ zIndex }) => {
55
55
  let css = ''
56
- css += zIndex ? `z_index_${zIndex } ` : ''
56
+ css += zIndex ? `z_index_${zIndex} ` : ''
57
57
  return css
58
58
  }
59
59
 
@@ -81,10 +81,88 @@ const cursorProps = ({ cursor }) => {
81
81
  return css
82
82
  }
83
83
 
84
+ const flexDirectionProps = ({ flexDirection }) => {
85
+ let css = ''
86
+ css += flexDirection == 'columnReverse' ? 'flex_direction_column_reverse' :
87
+ flexDirection == 'rowReverse' ? 'flex_direction_row_reverse' :
88
+ flexDirection ? `flex_direction_${flexDirection} ` : ''
89
+ return css
90
+ }
91
+
92
+ const flexWrapProps = ({ flexWrap }) => {
93
+ let css = ''
94
+ css += flexWrap == 'wrapReverse' ? 'flex_wrap_reverse' :
95
+ flexWrap == 'noWrap' ? 'flex_nowrap' :
96
+ flexWrap ? `flex_wrap_${flexWrap} ` : ''
97
+ return css
98
+ }
99
+
100
+ const justifyContentProps = ({ justifyContent }) => {
101
+ let css = ''
102
+ css += justifyContent == 'spaceBetween' ? 'justify_content_space_between' :
103
+ justifyContent == 'spaceEvenly' ? 'justify_content_space_evenly' :
104
+ justifyContent == 'spaceAround' ? 'justify_content_space_around' :
105
+ justifyContent ? `justify_content_${justifyContent}` : ''
106
+ return css
107
+ }
108
+
109
+ const justifySelfProps = ({ justifySelf }) => {
110
+ let css = ''
111
+ css += justifySelf ? `justify_self_${justifySelf}` : ''
112
+ return css
113
+ }
114
+
115
+ const alignItemsProps = ({ alignItems }) => {
116
+ let css = ''
117
+ css += alignItems == 'flexStart' ? 'align_items_flex_start' :
118
+ alignItems == 'flexEnd' ? 'align_items_flex_end' :
119
+ alignItems ? `align_items_${alignItems}` : ''
120
+ return css
121
+ }
122
+
123
+ const alignContentProps = ({ alignContent }) => {
124
+ let css = ''
125
+ css += alignContent == 'spaceBetween' ? 'align_content_space_between' :
126
+ alignContent == 'spaceEvenly' ? 'align_content_space_evenly' :
127
+ alignContent == 'spaceAround' ? 'align_content_space_around' :
128
+ alignContent ? `align_content_${alignContent}` : ''
129
+ return css
130
+ }
131
+
132
+ const alignSelfProps = ({ alignSelf }) => {
133
+ let css = ''
134
+ css += alignSelf ? `align_self_${alignSelf}` : ''
135
+ return css
136
+ }
137
+
138
+ const flexProps = ({ flex }) => {
139
+ let css = ''
140
+ css += flex ? `flex_${flex}` : ''
141
+ return css
142
+ }
143
+
144
+ const flexGrowProps = ({ flexGrow }) => {
145
+ let css = ''
146
+ css += flexGrow ? `flex_grow_${flexGrow}` : ''
147
+ return css
148
+ }
149
+
150
+ const flexShrinkProps = ({ flexShrink }) => {
151
+ let css = ''
152
+ css += flexShrink ? `flex_shrink_${flexShrink}` : ''
153
+ return css
154
+ }
155
+
156
+ const orderProps = ({ order }) => {
157
+ let css = ''
158
+ css += order ? `order_${order}` : ''
159
+ return css
160
+ }
161
+
84
162
  // All Exported as a single function
85
163
  export const globalProps = (props, defaultProps = {}) => {
86
164
  const allProps = { ...props, ...defaultProps }
87
- return spacingProps(allProps) + darkProps(allProps) + maxWidthProps(allProps) + zIndexProps(allProps) + numberSpacingProps(allProps) + shadowProps(allProps) + lineHeightProps(allProps) + cursorProps(allProps) + displayProps(allProps)
165
+ return spacingProps(allProps) + darkProps(allProps) + maxWidthProps(allProps) + zIndexProps(allProps) + numberSpacingProps(allProps) + shadowProps(allProps) + lineHeightProps(allProps) + cursorProps(allProps) + displayProps(allProps) + flexDirectionProps(allProps) + flexWrapProps(allProps) + justifyContentProps(allProps) + justifySelfProps(allProps) + alignItemsProps(allProps) + alignContentProps(allProps) + alignSelfProps(allProps) + flexProps(allProps) + flexGrowProps(allProps) + flexShrinkProps(allProps) + orderProps(allProps)
88
166
  }
89
167
 
90
168
  export const deprecatedProps = (kit, props = []) => {
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module AlignContent
5
+ def self.included(base)
6
+ base.prop :align_content
7
+ end
8
+
9
+ def align_content_props
10
+ selected_props = align_content_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ align_content_value = send(k)
15
+ "align_content_#{align_content_value}" if align_content_values.include? align_content_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def align_content_options
20
+ {
21
+ align_content: "align_content",
22
+ }
23
+ end
24
+
25
+ def align_content_values
26
+ %w[start end center space_between space_around space_evenly]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module AlignItems
5
+ def self.included(base)
6
+ base.prop :align_items
7
+ end
8
+
9
+ def align_items_props
10
+ selected_props = align_items_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ align_items_value = send(k)
15
+ "align_items_#{align_items_value}" if align_items_values.include? align_items_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def align_items_options
20
+ {
21
+ align_items: "align_items",
22
+ }
23
+ end
24
+
25
+ def align_items_values
26
+ %w[start end center baseline stretch]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module AlignSelf
5
+ def self.included(base)
6
+ base.prop :align_self
7
+ end
8
+
9
+ def align_self_props
10
+ selected_props = align_self_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ align_self_value = send(k)
15
+ "align_self_#{align_self_value}" if align_self_values.include? align_self_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def align_self_options
20
+ {
21
+ align_self: "align_self",
22
+ }
23
+ end
24
+
25
+ def align_self_values
26
+ %w[auto start end center stretch baseline]
27
+ end
28
+ end
29
+ end
@@ -20,6 +20,17 @@ module Playbook
20
20
  line_height_props,
21
21
  display_props,
22
22
  cursor_props,
23
+ flex_direction_props,
24
+ flex_wrap_props,
25
+ justify_content_props,
26
+ justify_self_props,
27
+ align_items_props,
28
+ align_content_props,
29
+ align_self_props,
30
+ flex_props,
31
+ flex_grow_props,
32
+ flex_shrink_props,
33
+ order_props,
23
34
  ].compact.join(" ")
24
35
  end
25
36
 
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module Flex
5
+ def self.included(base)
6
+ base.prop :flex
7
+ end
8
+
9
+ def flex_props
10
+ selected_props = flex_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ flex_value = send(k)
15
+ "flex_#{flex_value}" if flex_values.include? flex_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def flex_options
20
+ {
21
+ flex: "flex",
22
+ }
23
+ end
24
+
25
+ def flex_values
26
+ %w[auto initial 0 1 2 3 4 5 6 7 8 9 10 11 12 none]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module FlexDirection
5
+ def self.included(base)
6
+ base.prop :flex_direction
7
+ end
8
+
9
+ def flex_direction_props
10
+ selected_props = flex_direction_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ flex_direction_value = send(k)
15
+ "flex_direction_#{flex_direction_value}" if flex_direction_values.include? flex_direction_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def flex_direction_options
20
+ {
21
+ flex_direction: "flex_direction",
22
+ }
23
+ end
24
+
25
+ def flex_direction_values
26
+ %w[row column row_reverse column_reverse]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module FlexGrow
5
+ def self.included(base)
6
+ base.prop :flex_grow
7
+ end
8
+
9
+ def flex_grow_props
10
+ selected_props = flex_grow_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ flex_grow_value = send(k)
15
+ "flex_grow_#{flex_grow_value}" if flex_grow_values.include? flex_grow_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def flex_grow_options
20
+ {
21
+ flex_grow: "flex_grow",
22
+ }
23
+ end
24
+
25
+ def flex_grow_values
26
+ %w[1 0]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module FlexShrink
5
+ def self.included(base)
6
+ base.prop :flex_shrink
7
+ end
8
+
9
+ def flex_shrink_props
10
+ selected_props = flex_shrink_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ flex_shrink_value = send(k)
15
+ "flex_shrink_#{flex_shrink_value}" if flex_shrink_values.include? flex_shrink_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def flex_shrink_options
20
+ {
21
+ flex_shrink: "flex_shrink",
22
+ }
23
+ end
24
+
25
+ def flex_shrink_values
26
+ %w[1 0]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module FlexWrap
5
+ def self.included(base)
6
+ base.prop :flex_wrap
7
+ end
8
+
9
+ def flex_wrap_props
10
+ selected_props = flex_wrap_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ flex_wrap_value = send(k)
15
+ "flex_wrap_#{flex_wrap_value}" if flex_wrap_values.include? flex_wrap_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def flex_wrap_options
20
+ {
21
+ flex_wrap: "flex_wrap",
22
+ }
23
+ end
24
+
25
+ def flex_wrap_values
26
+ %w[wrap nowrap wrap_reverse]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module JustifyContent
5
+ def self.included(base)
6
+ base.prop :justify_content
7
+ end
8
+
9
+ def justify_content_props
10
+ selected_props = justify_content_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ justify_content_value = send(k)
15
+ "justify_content_#{justify_content_value}" if justify_content_values.include? justify_content_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def justify_content_options
20
+ {
21
+ justify_content: "justify_content",
22
+ }
23
+ end
24
+
25
+ def justify_content_values
26
+ %w[start end center space_between space_around space_evenly]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module JustifySelf
5
+ def self.included(base)
6
+ base.prop :justify_self
7
+ end
8
+
9
+ def justify_self_props
10
+ selected_props = justify_self_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ justify_self_value = send(k)
15
+ "justify_self_#{justify_self_value}" if justify_self_values.include? justify_self_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def justify_self_options
20
+ {
21
+ justify_self: "justify_self",
22
+ }
23
+ end
24
+
25
+ def justify_self_values
26
+ %w[auto start end center stretch]
27
+ end
28
+ end
29
+ end
@@ -8,6 +8,17 @@ require "playbook/shadow"
8
8
  require "playbook/line_height"
9
9
  require "playbook/display"
10
10
  require "playbook/cursor"
11
+ require "playbook/flex_direction"
12
+ require "playbook/flex_wrap"
13
+ require "playbook/justify_content"
14
+ require "playbook/justify_self"
15
+ require "playbook/align_items"
16
+ require "playbook/align_content"
17
+ require "playbook/align_self"
18
+ require "playbook/flex"
19
+ require "playbook/flex_grow"
20
+ require "playbook/flex_shrink"
21
+ require "playbook/order"
11
22
 
12
23
  module Playbook
13
24
  class KitBase < ViewComponent::Base
@@ -21,6 +32,17 @@ module Playbook
21
32
  include Playbook::LineHeight
22
33
  include Playbook::Display
23
34
  include Playbook::Cursor
35
+ include Playbook::FlexDirection
36
+ include Playbook::FlexWrap
37
+ include Playbook::JustifyContent
38
+ include Playbook::JustifySelf
39
+ include Playbook::AlignItems
40
+ include Playbook::AlignContent
41
+ include Playbook::AlignSelf
42
+ include Playbook::Flex
43
+ include Playbook::FlexGrow
44
+ include Playbook::FlexShrink
45
+ include Playbook::Order
24
46
 
25
47
  prop :id
26
48
  prop :data, type: Playbook::Props::Hash, default: {}
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module Order
5
+ def self.included(base)
6
+ base.prop :order
7
+ end
8
+
9
+ def order_props
10
+ selected_props = order_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ order_value = send(k)
15
+ "order_#{order_value}" if order_values.include? order_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def order_options
20
+ {
21
+ order: "order",
22
+ }
23
+ end
24
+
25
+ def order_values
26
+ %w[1 2 3 4 5 6 7 8 9 10 11 12 first none]
27
+ end
28
+ end
29
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "10.20.0"
5
- VERSION = "10.21.0.pre.alpha.na1"
5
+ VERSION = "10.21.0.pre.alpha.rg1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.21.0.pre.alpha.na1
4
+ version: 10.21.0.pre.alpha.rg1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-02-02 00:00:00.000000000 Z
12
+ date: 2022-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -2054,13 +2054,24 @@ files:
2054
2054
  - app/pb_kits/playbook/tokens/exports/_typography.scss
2055
2055
  - app/pb_kits/playbook/tokens/index.scss
2056
2056
  - app/pb_kits/playbook/types.js
2057
+ - app/pb_kits/playbook/utilities/_align_content.scss
2058
+ - app/pb_kits/playbook/utilities/_align_items.scss
2059
+ - app/pb_kits/playbook/utilities/_align_self.scss
2057
2060
  - app/pb_kits/playbook/utilities/_background_colors.scss
2058
2061
  - app/pb_kits/playbook/utilities/_colors.scss
2059
2062
  - app/pb_kits/playbook/utilities/_cursor.scss
2060
2063
  - app/pb_kits/playbook/utilities/_display.scss
2064
+ - app/pb_kits/playbook/utilities/_flex.scss
2065
+ - app/pb_kits/playbook/utilities/_flex_direction.scss
2066
+ - app/pb_kits/playbook/utilities/_flex_grow.scss
2067
+ - app/pb_kits/playbook/utilities/_flex_shrink.scss
2068
+ - app/pb_kits/playbook/utilities/_flex_wrap.scss
2069
+ - app/pb_kits/playbook/utilities/_justify_content.scss
2070
+ - app/pb_kits/playbook/utilities/_justify_self.scss
2061
2071
  - app/pb_kits/playbook/utilities/_line_height.scss
2062
2072
  - app/pb_kits/playbook/utilities/_max_width.scss
2063
2073
  - app/pb_kits/playbook/utilities/_number_spacing.scss
2074
+ - app/pb_kits/playbook/utilities/_order.scss
2064
2075
  - app/pb_kits/playbook/utilities/_positioning.scss
2065
2076
  - app/pb_kits/playbook/utilities/_shadow.scss
2066
2077
  - app/pb_kits/playbook/utilities/_spacing.scss
@@ -2072,10 +2083,18 @@ files:
2072
2083
  - fonts/fontawesome-min.js
2073
2084
  - fonts/regular-min.js
2074
2085
  - lib/playbook.rb
2086
+ - lib/playbook/align_content.rb
2087
+ - lib/playbook/align_items.rb
2088
+ - lib/playbook/align_self.rb
2075
2089
  - lib/playbook/classnames.rb
2076
2090
  - lib/playbook/cursor.rb
2077
2091
  - lib/playbook/display.rb
2078
2092
  - lib/playbook/engine.rb
2093
+ - lib/playbook/flex.rb
2094
+ - lib/playbook/flex_direction.rb
2095
+ - lib/playbook/flex_grow.rb
2096
+ - lib/playbook/flex_shrink.rb
2097
+ - lib/playbook/flex_wrap.rb
2079
2098
  - lib/playbook/forms.rb
2080
2099
  - lib/playbook/forms/builder.rb
2081
2100
  - lib/playbook/forms/builder/action_area.rb
@@ -2085,6 +2104,8 @@ files:
2085
2104
  - lib/playbook/forms/builder/form_field_builder.rb
2086
2105
  - lib/playbook/forms/builder/select_field.rb
2087
2106
  - lib/playbook/forms/builder/typeahead_field.rb
2107
+ - lib/playbook/justify_content.rb
2108
+ - lib/playbook/justify_self.rb
2088
2109
  - lib/playbook/kit_base.rb
2089
2110
  - lib/playbook/kit_resolver.rb
2090
2111
  - lib/playbook/line_height.rb
@@ -2092,6 +2113,7 @@ files:
2092
2113
  - lib/playbook/markdown/helper.rb
2093
2114
  - lib/playbook/markdown/template_handler.rb
2094
2115
  - lib/playbook/number_spacing.rb
2116
+ - lib/playbook/order.rb
2095
2117
  - lib/playbook/pb_doc_helper.rb
2096
2118
  - lib/playbook/pb_forms_helper.rb
2097
2119
  - lib/playbook/pb_kit_helper.rb