playbook_ui 10.21.0 → 10.22.1

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/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_button/_button.jsx +3 -0
  4. data/app/pb_kits/playbook/pb_button/button.rb +2 -0
  5. data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.html.erb +1 -1
  6. data/app/pb_kits/playbook/pb_button/docs/_button_form.html.erb +1 -0
  7. data/app/pb_kits/playbook/pb_button/docs/_button_form.jsx +14 -0
  8. data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
  9. data/app/pb_kits/playbook/pb_button/docs/index.js +1 -0
  10. data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
  11. data/app/pb_kits/playbook/pb_card/card.rb +88 -0
  12. data/app/pb_kits/playbook/pb_card/card_body.rb +1 -1
  13. data/app/pb_kits/playbook/pb_flex/docs/_flex_align.jsx +1 -1
  14. data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -24
  15. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +1 -0
  16. data/app/pb_kits/playbook/utilities/_align_content.scss +29 -0
  17. data/app/pb_kits/playbook/utilities/_align_items.scss +35 -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/_flexbox.scss +11 -0
  25. data/app/pb_kits/playbook/utilities/_justify_content.scss +23 -0
  26. data/app/pb_kits/playbook/utilities/_justify_self.scss +19 -0
  27. data/app/pb_kits/playbook/utilities/_order.scss +55 -0
  28. data/app/pb_kits/playbook/utilities/globalProps.js +175 -0
  29. data/lib/playbook/align_content.rb +29 -0
  30. data/lib/playbook/align_items.rb +29 -0
  31. data/lib/playbook/align_self.rb +29 -0
  32. data/lib/playbook/classnames.rb +11 -0
  33. data/lib/playbook/flex.rb +29 -0
  34. data/lib/playbook/flex_direction.rb +29 -0
  35. data/lib/playbook/flex_grow.rb +29 -0
  36. data/lib/playbook/flex_shrink.rb +29 -0
  37. data/lib/playbook/flex_wrap.rb +29 -0
  38. data/lib/playbook/justify_content.rb +29 -0
  39. data/lib/playbook/justify_self.rb +29 -0
  40. data/lib/playbook/kit_base.rb +22 -0
  41. data/lib/playbook/order.rb +29 -0
  42. data/lib/playbook/version.rb +2 -2
  43. metadata +28 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a59d79cb7efc701b2cfcda8f853e5d47f6e7a8bb0c63a26ea1fb1a0d1352d7ef
4
- data.tar.gz: 4ce8a5b16f4dd0d58a56793bc8aaf8f7e285104fae767a7e4867853ea6531a5f
3
+ metadata.gz: 8d716c8b2fb0fb3cb78211c502bf2049420b05f536fdcc4ad183bce41703d364
4
+ data.tar.gz: dcb16d5fc153dc5eba40f0ae8b32299e782a4f3ca929540179a6d08002f15572
5
5
  SHA512:
6
- metadata.gz: 36e213335bf164b63b39d2958360e6629c0f16cc07ea01fa2a645f36878fc531c5d4a4e84d8f8aa388c68bb9a92961727399297f45048e9cc7ea5e4d54078b18
7
- data.tar.gz: 341993d316fbe3a2cad5b26861ae255128657a13505100aa12b46afd2694aa993fa7210f67faa86b2a2f79b9a8ed999d4786cb7a31512c75080aef5198283d72
6
+ metadata.gz: 523973d2fa615911426199d7d49d22748926f40e2f704e0fbf6958d632cd7301dade5a6971659fc41fbc7844b98bcff8f80d3efe16554a60fe782d00dfa5dedc
7
+ data.tar.gz: f0a6509496789efbbfa0884d08c87fe7d902fe4d09feb07d7f918c7e2d034ce8213d9f01fd48b8132bdcfc584192c7357c6269604912d70356b80b45c1e20fff
@@ -100,3 +100,4 @@
100
100
  @import './utilities/shadow';
101
101
  @import './utilities/line_height';
102
102
  @import './utilities/display';
103
+ @import './utilities/flexbox';
@@ -15,6 +15,7 @@ type ButtonPropTypes = {
15
15
  data?: object,
16
16
  disabled?: boolean,
17
17
  fixedWidth?: boolean,
18
+ form?: string,
18
19
  fullWidth?: boolean,
19
20
  icon?: string,
20
21
  id?: string,
@@ -69,6 +70,7 @@ const Button = (props: ButtonPropTypes) => {
69
70
  text,
70
71
  htmlType = 'button',
71
72
  value,
73
+ form = null
72
74
  } = props
73
75
 
74
76
  const ariaProps = buildAriaProps(aria)
@@ -119,6 +121,7 @@ const Button = (props: ButtonPropTypes) => {
119
121
  {...dataProps}
120
122
  className={css}
121
123
  disabled={disabled}
124
+ form={form}
122
125
  id={id}
123
126
  onClick={onClick}
124
127
  role="button"
@@ -21,6 +21,7 @@ module Playbook
21
21
  prop :size, type: Playbook::Props::Enum,
22
22
  values: ["sm", "md", "lg", nil],
23
23
  default: nil
24
+ prop :form, default: nil
24
25
 
25
26
  def options
26
27
  {
@@ -32,6 +33,7 @@ module Playbook
32
33
  role: "button",
33
34
  type: type,
34
35
  value: value,
36
+ form: form,
35
37
  }.compact
36
38
  end
37
39
 
@@ -1 +1 @@
1
- <%= pb_rails("button", props: { text: "Button with ARIA", aria: {label: "Go to Google"}, tag: "a", link: "http://google.com" }) %>
1
+ <%= pb_rails("button", props: { text: "Button with ARIA", aria: {label: "Go to Google"}, tag: "a", link: "http://google.com"}) %>
@@ -0,0 +1 @@
1
+ <%= pb_rails("button", props: { text: "Button with Form Attribute", form: "form-id"}) %>
@@ -0,0 +1,14 @@
1
+ import React from 'react'
2
+ import { Button } from '../../'
3
+
4
+ const ButtonForm = (props) => (
5
+ <div>
6
+ <Button
7
+ form="form-id"
8
+ text="Button with Form Attribute"
9
+ {...props}
10
+ />
11
+ </div>
12
+ )
13
+
14
+ export default ButtonForm
@@ -8,6 +8,7 @@ examples:
8
8
  - button_accessibility: Button Accessibility Options
9
9
  - button_options: Button Additional Options
10
10
  - button_size: Button Size
11
+ - button_form: Button Form Attribute
11
12
  react:
12
13
  - button_default: Button Variants
13
14
  - button_full_width: Button Full Width
@@ -17,3 +18,4 @@ examples:
17
18
  - button_accessibility: Button Accessibility Options
18
19
  - button_options: Button Additional Options (onClick)
19
20
  - button_size: Button Size
21
+ - button_form: Button Form Attribute
@@ -6,3 +6,4 @@ export { default as ButtonBlockContent } from './_button_block_content.jsx'
6
6
  export { default as ButtonAccessibility } from './_button_accessibility.jsx'
7
7
  export { default as ButtonOptions } from './_button_options.jsx'
8
8
  export { default as ButtonSize } from './_button_size.jsx'
9
+ export { default as ButtonForm } from './_button_form.jsx'
@@ -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
@@ -11,6 +11,7 @@ const LineGraphDefault = (props) => (
11
11
  <LineGraph
12
12
  axisTitle="Number of Employees"
13
13
  chartData={data}
14
+ height="300px"
14
15
  id="line-fixed-height"
15
16
  title="Fixed Height (300px)"
16
17
  xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}
@@ -0,0 +1,29 @@
1
+ .align_content_start {
2
+ display: flex;
3
+ align-content: start !important;
4
+ }
5
+
6
+ .align_content_end {
7
+ display: flex;
8
+ align-content: end !important;
9
+ }
10
+
11
+ .align_content_center {
12
+ display: flex;
13
+ align-content: center !important;
14
+ }
15
+
16
+ .align_content_space_between {
17
+ display: flex;
18
+ align-content: space-between !important;
19
+ }
20
+
21
+ .align_content_space_around {
22
+ display: flex;
23
+ align-content: space-around !important;
24
+ }
25
+
26
+ .align_content_space_evenly {
27
+ display: flex;
28
+ align-content: space-evenly !important;
29
+ }
@@ -0,0 +1,35 @@
1
+ .align_items_flex_start {
2
+ display: flex;
3
+ align-items: flex-start !important;
4
+ }
5
+
6
+ .align_items_flex_end {
7
+ display: flex;
8
+ align-items: flex-end !important;
9
+ }
10
+
11
+ .align_items_start {
12
+ display: flex;
13
+ align-items: start !important;
14
+ }
15
+
16
+ .align_items_end {
17
+ display: flex;
18
+ align-items: end !important;
19
+ }
20
+
21
+
22
+ .align_items_center {
23
+ display: flex;
24
+ align-items: center !important;
25
+ }
26
+
27
+ .align_items_baseline {
28
+ display: flex;
29
+ align-items: baseline !important;
30
+ }
31
+
32
+ .align_items_stretch {
33
+ display: flex;
34
+ align-items: stretch !important;
35
+ }
@@ -0,0 +1,29 @@
1
+ .align_self_start {
2
+ display: flex;
3
+ align-self: start !important;
4
+ }
5
+
6
+ .align_self_end {
7
+ display: flex;
8
+ align-self: end !important;
9
+ }
10
+
11
+ .align_self_auto {
12
+ display: flex;
13
+ align-self: auto !important;
14
+ }
15
+
16
+ .align_self_center {
17
+ display: flex;
18
+ align-self: center !important;
19
+ }
20
+
21
+ .align_self_stretch {
22
+ display: flex;
23
+ align-self: stretch !important;
24
+ }
25
+
26
+ .align_self_baseline {
27
+ display: flex;
28
+ align-self: baseline !important;
29
+ }
@@ -0,0 +1,15 @@
1
+ .flex_auto {
2
+ flex: auto !important;
3
+ }
4
+
5
+ .flex_initial {
6
+ flex: initial !important;
7
+ }
8
+
9
+ .flex_none {
10
+ flex: none !important;
11
+ }
12
+
13
+ .flex_1 {
14
+ flex: 1 !important;
15
+ }
@@ -0,0 +1,19 @@
1
+ .flex_direction_row {
2
+ display: flex;
3
+ flex-direction: row !important;
4
+ }
5
+
6
+ .flex_direction_column {
7
+ display: flex;
8
+ flex-direction: column !important;
9
+ }
10
+
11
+ .flex_direction_row_reverse {
12
+ display: flex;
13
+ flex-direction: row-reverse !important;
14
+ }
15
+
16
+ .flex_direction_column_reverse {
17
+ display: flex;
18
+ flex-direction: column-reverse !important;
19
+ }
@@ -0,0 +1,9 @@
1
+ .flex_grow_1 {
2
+ display: flex;
3
+ flex-grow: 1 !important;
4
+ }
5
+
6
+ .flex_grow_0 {
7
+ display: flex;
8
+ flex-grow: 0 !important;
9
+ }
@@ -0,0 +1,9 @@
1
+ .flex_shrink_1 {
2
+ display: flex;
3
+ flex-shrink: 1 !important;
4
+ }
5
+
6
+ .flex_shrink_0 {
7
+ display: flex;
8
+ flex-shrink: 0 !important;
9
+ }
@@ -0,0 +1,14 @@
1
+ .flex_wrap_wrap {
2
+ display: flex;
3
+ flex-wrap: wrap !important;
4
+ }
5
+
6
+ .flex_wrap_nowrap {
7
+ display: flex;
8
+ flex-wrap: nowrap !important;
9
+ }
10
+
11
+ .flex_wrap_wrap_reverse {
12
+ display: flex;
13
+ flex-wrap: wrap-reverse !important;
14
+ }
@@ -0,0 +1,11 @@
1
+ @import './utilities/flex_direction';
2
+ @import './utilities/justify_content';
3
+ @import './utilities/flex_wrap';
4
+ @import './utilities/justify_self';
5
+ @import './utilities/align_items';
6
+ @import './utilities/align_content';
7
+ @import './utilities/align_self';
8
+ @import './utilities/flex';
9
+ @import './utilities/flex_grow';
10
+ @import './utilities/flex_shrink';
11
+ @import './utilities/order';
@@ -0,0 +1,23 @@
1
+ .justify_content_start {
2
+ justify-content: start !important;
3
+ }
4
+
5
+ .justify_content_end {
6
+ justify-content: end !important;
7
+ }
8
+
9
+ .justify_content_center {
10
+ justify-content: center !important;
11
+ }
12
+
13
+ .justify_content_space_between {
14
+ justify-content: space-between !important;
15
+ }
16
+
17
+ .justify_content_space_around {
18
+ justify-content: space-around !important;
19
+ }
20
+
21
+ .justify_content_space_evenly {
22
+ justify-content: space-evenly !important;
23
+ }
@@ -0,0 +1,19 @@
1
+ .justify_self_auto {
2
+ justify-self: auto !important;
3
+ }
4
+
5
+ .justify_self_start {
6
+ justify-self: start !important;
7
+ }
8
+
9
+ .justify_self_end {
10
+ justify-self: end !important;
11
+ }
12
+
13
+ .justify_self_center {
14
+ justify-self: center !important;
15
+ }
16
+
17
+ .justify_self_stretch {
18
+ justify-self: stretch !important;
19
+ }
@@ -0,0 +1,55 @@
1
+ .order_1 {
2
+ order: 1 !important;
3
+ }
4
+
5
+ .order_2 {
6
+ order: 2 !important;
7
+ }
8
+
9
+ .order_3 {
10
+ order: 3 !important;
11
+ }
12
+
13
+ .order_4 {
14
+ order: 4 !important;
15
+ }
16
+
17
+ .order_5 {
18
+ order: 5 !important;
19
+ }
20
+
21
+ .order_6 {
22
+ order: 6 !important;
23
+ }
24
+
25
+ .order_7 {
26
+ order: 7 !important;
27
+ }
28
+
29
+ .order_8 {
30
+ order: 8 !important;
31
+ }
32
+
33
+ .order_9 {
34
+ order: 9 !important;
35
+ }
36
+
37
+ .order_10 {
38
+ order: 10 !important;
39
+ }
40
+
41
+ .order_11 {
42
+ order: 11 !important;
43
+ }
44
+
45
+ .order_12 {
46
+ order: 12 !important;
47
+ }
48
+
49
+ .order_none {
50
+ order: none !important;
51
+ }
52
+
53
+ .order_first {
54
+ order: -1 !important;
55
+ }
@@ -0,0 +1,175 @@
1
+ // Prop categories
2
+ const spacingProps = ({
3
+ marginRight,
4
+ marginLeft,
5
+ marginTop,
6
+ marginBottom,
7
+ marginX,
8
+ marginY,
9
+ margin,
10
+ paddingRight,
11
+ paddingLeft,
12
+ paddingTop,
13
+ paddingBottom,
14
+ paddingX,
15
+ paddingY,
16
+ padding,
17
+ }) => {
18
+ let css = ''
19
+ css += marginRight ? `mr_${marginRight} ` : ''
20
+ css += marginLeft ? `ml_${marginLeft} ` : ''
21
+ css += marginTop ? `mt_${marginTop} ` : ''
22
+ css += marginBottom ? `mb_${marginBottom} ` : ''
23
+ css += marginX ? `mx_${marginX} ` : ''
24
+ css += marginY ? `my_${marginY} ` : ''
25
+ css += margin ? `m_${margin} ` : ''
26
+ css += paddingRight ? `pr_${paddingRight} ` : ''
27
+ css += paddingLeft ? `pl_${paddingLeft} ` : ''
28
+ css += paddingTop ? `pt_${paddingTop} ` : ''
29
+ css += paddingBottom ? `pb_${paddingBottom} ` : ''
30
+ css += paddingX ? `px_${paddingX} ` : ''
31
+ css += paddingY ? `py_${paddingY} ` : ''
32
+ css += padding ? `p_${padding} ` : ''
33
+ return css
34
+ }
35
+
36
+ const darkProps = ({ dark }) => {
37
+ let css = ''
38
+ css += dark ? 'dark' : ''
39
+ return css
40
+ }
41
+
42
+ const numberSpacingProps = ({ numberSpacing }) => {
43
+ let css = ''
44
+ css += numberSpacing ? `ns_${numberSpacing} ` : ''
45
+ return css
46
+ }
47
+
48
+ const maxWidthProps = ({ maxWidth }) => {
49
+ let css = ''
50
+ css += maxWidth ? `max_width_${maxWidth} ` : ''
51
+ return css
52
+ }
53
+
54
+ const zIndexProps = ({ zIndex }) => {
55
+ let css = ''
56
+ css += zIndex ? `z_index_${zIndex} ` : ''
57
+ return css
58
+ }
59
+
60
+ const shadowProps = ({ shadow }) => {
61
+ let css = ''
62
+ css += shadow ? `shadow_${shadow} ` : ''
63
+ return css
64
+ }
65
+
66
+ const lineHeightProps = ({ lineHeight }) => {
67
+ let css = ''
68
+ css += lineHeight ? `line_height_${lineHeight} ` : ''
69
+ return css
70
+ }
71
+
72
+ const displayProps = ({ display }) => {
73
+ let css = ''
74
+ css += display ? `display_${display} ` : ''
75
+ return css
76
+ }
77
+
78
+ const cursorProps = ({ cursor }) => {
79
+ let css = ''
80
+ css += cursor ? `cursor_${cursor} ` : ''
81
+ return css
82
+ }
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
+
162
+ // All Exported as a single function
163
+ export const globalProps = (props, defaultProps = {}) => {
164
+ const allProps = { ...props, ...defaultProps }
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)
166
+ }
167
+
168
+ export const deprecatedProps = (kit, props = []) => {
169
+ if (process.env.NODE_ENV === 'development') {
170
+ /* eslint no-console: ["error", { allow: ["warn", "error"] }] */
171
+ props.forEach((prop) => {
172
+ console.warn(`${kit} Kit: The prop '${prop}' is deprecated and will be removed in a future release!`)
173
+ })
174
+ }
175
+ }
@@ -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[flex_start flex_end 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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "10.20.0"
5
- VERSION = "10.21.0"
4
+ PREVIOUS_VERSION = "10.22.0"
5
+ VERSION = "10.22.1"
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
4
+ version: 10.22.1
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-15 00:00:00.000000000 Z
12
+ date: 2022-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -417,6 +417,8 @@ files:
417
417
  - app/pb_kits/playbook/pb_button/docs/_button_default.html.erb
418
418
  - app/pb_kits/playbook/pb_button/docs/_button_default.jsx
419
419
  - app/pb_kits/playbook/pb_button/docs/_button_default.md
420
+ - app/pb_kits/playbook/pb_button/docs/_button_form.html.erb
421
+ - app/pb_kits/playbook/pb_button/docs/_button_form.jsx
420
422
  - app/pb_kits/playbook/pb_button/docs/_button_full_width.html.erb
421
423
  - app/pb_kits/playbook/pb_button/docs/_button_full_width.jsx
422
424
  - app/pb_kits/playbook/pb_button/docs/_button_full_width.md
@@ -2062,16 +2064,29 @@ files:
2062
2064
  - app/pb_kits/playbook/tokens/exports/_spacing.scss
2063
2065
  - app/pb_kits/playbook/tokens/exports/_typography.scss
2064
2066
  - app/pb_kits/playbook/tokens/index.scss
2067
+ - app/pb_kits/playbook/utilities/_align_content.scss
2068
+ - app/pb_kits/playbook/utilities/_align_items.scss
2069
+ - app/pb_kits/playbook/utilities/_align_self.scss
2065
2070
  - app/pb_kits/playbook/utilities/_background_colors.scss
2066
2071
  - app/pb_kits/playbook/utilities/_colors.scss
2067
2072
  - app/pb_kits/playbook/utilities/_cursor.scss
2068
2073
  - app/pb_kits/playbook/utilities/_display.scss
2074
+ - app/pb_kits/playbook/utilities/_flex.scss
2075
+ - app/pb_kits/playbook/utilities/_flex_direction.scss
2076
+ - app/pb_kits/playbook/utilities/_flex_grow.scss
2077
+ - app/pb_kits/playbook/utilities/_flex_shrink.scss
2078
+ - app/pb_kits/playbook/utilities/_flex_wrap.scss
2079
+ - app/pb_kits/playbook/utilities/_flexbox.scss
2080
+ - app/pb_kits/playbook/utilities/_justify_content.scss
2081
+ - app/pb_kits/playbook/utilities/_justify_self.scss
2069
2082
  - app/pb_kits/playbook/utilities/_line_height.scss
2070
2083
  - app/pb_kits/playbook/utilities/_max_width.scss
2071
2084
  - app/pb_kits/playbook/utilities/_number_spacing.scss
2085
+ - app/pb_kits/playbook/utilities/_order.scss
2072
2086
  - app/pb_kits/playbook/utilities/_positioning.scss
2073
2087
  - app/pb_kits/playbook/utilities/_shadow.scss
2074
2088
  - app/pb_kits/playbook/utilities/_spacing.scss
2089
+ - app/pb_kits/playbook/utilities/globalProps.js
2075
2090
  - app/pb_kits/playbook/utilities/globalProps.ts
2076
2091
  - app/pb_kits/playbook/utilities/props.ts
2077
2092
  - app/pb_kits/playbook/utilities/test-utils.js
@@ -2080,10 +2095,18 @@ files:
2080
2095
  - fonts/fontawesome-min.js
2081
2096
  - fonts/regular-min.js
2082
2097
  - lib/playbook.rb
2098
+ - lib/playbook/align_content.rb
2099
+ - lib/playbook/align_items.rb
2100
+ - lib/playbook/align_self.rb
2083
2101
  - lib/playbook/classnames.rb
2084
2102
  - lib/playbook/cursor.rb
2085
2103
  - lib/playbook/display.rb
2086
2104
  - lib/playbook/engine.rb
2105
+ - lib/playbook/flex.rb
2106
+ - lib/playbook/flex_direction.rb
2107
+ - lib/playbook/flex_grow.rb
2108
+ - lib/playbook/flex_shrink.rb
2109
+ - lib/playbook/flex_wrap.rb
2087
2110
  - lib/playbook/forms.rb
2088
2111
  - lib/playbook/forms/builder.rb
2089
2112
  - lib/playbook/forms/builder/action_area.rb
@@ -2093,6 +2116,8 @@ files:
2093
2116
  - lib/playbook/forms/builder/form_field_builder.rb
2094
2117
  - lib/playbook/forms/builder/select_field.rb
2095
2118
  - lib/playbook/forms/builder/typeahead_field.rb
2119
+ - lib/playbook/justify_content.rb
2120
+ - lib/playbook/justify_self.rb
2096
2121
  - lib/playbook/kit_base.rb
2097
2122
  - lib/playbook/kit_resolver.rb
2098
2123
  - lib/playbook/line_height.rb
@@ -2100,6 +2125,7 @@ files:
2100
2125
  - lib/playbook/markdown/helper.rb
2101
2126
  - lib/playbook/markdown/template_handler.rb
2102
2127
  - lib/playbook/number_spacing.rb
2128
+ - lib/playbook/order.rb
2103
2129
  - lib/playbook/pb_doc_helper.rb
2104
2130
  - lib/playbook/pb_forms_helper.rb
2105
2131
  - lib/playbook/pb_kit_helper.rb