playbook_ui 12.30.1.pre.alpha.play846responsivespacingglobalpropsneedsdefault924 → 12.30.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34a695910f67fbd8f8a01279fe53bcfd4115ca6fc419a2a4f598b48464ade926
4
- data.tar.gz: d17f2e8534379076372aa29bcf3daadbb83acc5fc47bb5be5bd3ff31a2541461
3
+ metadata.gz: be0a7b566ae2becf6f879bd4f1cd39c0c27f487ef1a0a962238469eeec8753c6
4
+ data.tar.gz: ff75740ac1377ced70e9c9b6dc4dbe78f3f7a4ec7a0320d202f4be2b5c3601cd
5
5
  SHA512:
6
- metadata.gz: 82adeb777f4240ec21972169b4866a1b857597d02f63c30859b30e3a407abdd62427807e837beef23780136a9002c01513cc6478ca0c023c8fc5c564ea3ac52f
7
- data.tar.gz: fdc73b9b2eed6973de5a14011ce0240cf3c84fcff6e9f8e454ceecf15de721a974958d349803d6657302b682cf8ed64ac4a1f87f97971f818c2607a20ce9b012
6
+ metadata.gz: 589840dca5165dd2173a6d2eb01bf95045918ddf958598262a5040cc9e18560ec5cc1cc1073fd522ed50266bb2a3d9fbee1b42ca5eea8d862ffe2a0408e3163f
7
+ data.tar.gz: d04f64d8a30a45a41541f861c39db6dc82fc21b636e5caa87ec1c889399eaa28fd09374f1994a3266c4cf8bec4d5e3bc80bbe0dfe346a65713b0bdda06c2b321
@@ -3,7 +3,6 @@
3
3
 
4
4
  [class^=pb_card_kit] {
5
5
  @include pb_card;
6
- padding: $space_md;
7
6
 
8
7
  &[class*=_selected] {
9
8
  @include pb_card_selected;
@@ -26,7 +25,6 @@
26
25
  flex-shrink: 0;
27
26
  flex-basis: auto;
28
27
  min-height: 1px;
29
- padding: $space_sm;
30
28
  border: 0;
31
29
  border-radius: $pb_card_header_border_radius $pb_card_header_border_radius 0px 0px;
32
30
  @each $color_name, $color_value in $pb_card_header_colors {
@@ -59,7 +57,6 @@
59
57
  flex-basis: auto;
60
58
  min-height: 1px;
61
59
  border: 0;
62
- padding: $space_md;
63
60
  }
64
61
 
65
62
  &[class*=_highlight] {
@@ -42,10 +42,10 @@ type CardBodyProps = {
42
42
 
43
43
  // Header component
44
44
  const Header = (props: CardHeaderProps) => {
45
- const { children, className, headerColor = 'category_1', headerColorStriped = false } = props
45
+ const { children, className, headerColor = 'category_1', headerColorStriped = false, padding = 'sm' } = props
46
46
  const headerCSS = buildCss('pb_card_header_kit', `${headerColor}`, headerColorStriped ? 'striped' : '')
47
47
 
48
- const headerSpacing = globalProps(props)
48
+ const headerSpacing = globalProps(props, { padding })
49
49
 
50
50
  return (
51
51
  <div className={classnames(headerCSS, headerSpacing, className)}>
@@ -57,9 +57,9 @@ const Header = (props: CardHeaderProps) => {
57
57
 
58
58
  // Body component
59
59
  const Body = (props: CardBodyProps) => {
60
- const { children, className } = props
60
+ const { children, padding = 'md', className } = props
61
61
  const bodyCSS = buildCss('pb_card_body_kit')
62
- const bodySpacing = globalProps(props)
62
+ const bodySpacing = globalProps(props, { padding })
63
63
 
64
64
  return (
65
65
  <div className={classnames(bodyCSS, bodySpacing, className)}>
@@ -80,6 +80,7 @@ const Card = (props: CardPropTypes) => {
80
80
  highlight = {},
81
81
  selected = false,
82
82
  tag = 'div',
83
+ padding = 'md',
83
84
  } = props
84
85
  const borderCSS = borderNone == true ? 'border_none' : ''
85
86
  const selectedCSS = selected == true ? 'selected' : 'deselected'
@@ -113,7 +114,7 @@ const Card = (props: CardPropTypes) => {
113
114
  <Tag
114
115
  {...ariaProps}
115
116
  {...dataProps}
116
- className={classnames(cardCss, globalProps(props), className)}
117
+ className={classnames(cardCss, globalProps(props, { padding }), className)}
117
118
  >
118
119
  {subComponentTags('Header')}
119
120
  {nonHeaderChildren}
@@ -4,7 +4,9 @@
4
4
  class: object.classname,
5
5
  aria: object.aria,
6
6
  dark: object.dark) do %>
7
- <%= content.presence %>
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
+ <%= content %>
9
+ <% end if content.present? %>
8
10
  <% end %>
9
11
 
10
12
 
@@ -28,6 +28,102 @@ module Playbook
28
28
  highlight_color_class)
29
29
  end
30
30
 
31
+ def body_padding
32
+ if padding.present?
33
+ ""
34
+ else
35
+ "p_md"
36
+ end
37
+ end
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
+
31
127
  private
32
128
 
33
129
  def selected_class
@@ -4,99 +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", flex_direction, justify_content, flex_wrap, justify_self, align_items, align_content, align_self, flex, flex_grow, flex_shrink, order, separator: " ")
8
- end
9
-
10
- def body_padding
11
- "" if padding.present?
12
- end
13
-
14
- def body_flex_direction
15
- if flex_direction.present?
16
- "flex_direction_#{flex_direction}"
17
- else
18
- ""
19
- end
20
- end
21
-
22
- def body_flex_wrap
23
- if flex_wrap.present?
24
- "flex_wrap_#{flex_wrap}"
25
- else
26
- ""
27
- end
28
- end
29
-
30
- def body_justify_content
31
- if justify_content.present?
32
- "justify_content_#{justify_content}"
33
- else
34
- ""
35
- end
36
- end
37
-
38
- def body_justify_self
39
- if justify_self.present?
40
- "justify_self_#{justify_self}"
41
- else
42
- ""
43
- end
44
- end
45
-
46
- def body_align_items
47
- if align_items.present?
48
- "align_items_#{align_items}"
49
- else
50
- ""
51
- end
52
- end
53
-
54
- def body_align_content
55
- if align_content.present?
56
- "align_content_#{align_content}"
57
- else
58
- ""
59
- end
60
- end
61
-
62
- def body_align_self
63
- if align_self.present?
64
- "align_self_#{align_self}"
65
- else
66
- ""
67
- end
68
- end
69
-
70
- def body_flex
71
- if flex.present?
72
- "flex_#{flex}"
73
- else
74
- ""
75
- end
76
- end
77
-
78
- def body_flex_grow
79
- if flex_grow.present?
80
- "flex_grow_#{flex_grow}"
81
- else
82
- ""
83
- end
84
- end
85
-
86
- def body_flex_shrink
87
- if flex_shrink.present?
88
- "flex_shrink_#{flex_shrink}"
89
- else
90
- ""
91
- end
92
- end
93
-
94
- def body_order
95
- if order.present?
96
- "order_#{order}"
97
- else
98
- ""
99
- end
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: " ")
100
8
  end
101
9
  end
102
10
  end
@@ -1,9 +1,6 @@
1
1
  @import "./tokens/colors";
2
- @import "./tokens/spacing";
3
2
 
4
3
  [class^=pb_collapsible_kit] {
5
- padding: $space_md;
6
-
7
4
  .toggle-content {
8
5
  display: none;
9
6
  height: 0;
@@ -21,11 +18,3 @@
21
18
  color: $primary
22
19
  }
23
20
  }
24
-
25
- [class^=pb_collapsible_main_kit] {
26
- padding: $space_md;
27
- }
28
-
29
- [class^=pb_collapsible_content_kit] {
30
- padding: $space_md;
31
- }
@@ -19,6 +19,7 @@ type CollapsibleProps = {
19
19
  iconColor?: 'default' | 'light' | 'lighter' | 'link' | 'error' | 'success',
20
20
  iconSize?: typeof IconSizes
21
21
  id?: string,
22
+ padding?: string,
22
23
  }
23
24
 
24
25
  const useCollapsible = (initial = false) => {
@@ -39,6 +40,7 @@ const Collapsible = ({
39
40
  iconColor = 'default',
40
41
  iconSize,
41
42
  id,
43
+ padding = 'md',
42
44
  ...props
43
45
  }: CollapsibleProps) => {
44
46
  const [isCollapsed, collapse] = useCollapsible(collapsed)
@@ -57,7 +59,7 @@ const Collapsible = ({
57
59
  const dataProps = buildDataProps(data)
58
60
  const classes = classnames(
59
61
  buildCss('pb_collapsible_kit'),
60
- globalProps(props),
62
+ globalProps(props, { padding }),
61
63
  className
62
64
  )
63
65
 
@@ -9,16 +9,18 @@ import CollapsibleContext from '../context'
9
9
  export type CollapsibleContentProps = {
10
10
  children?: React.ReactNode[] | React.ReactNode | string,
11
11
  className?: string,
12
+ padding?: string,
12
13
  }
13
14
 
14
15
  const CollapsibleContent = ({
15
16
  children,
16
17
  className,
18
+ padding = 'md',
17
19
  ...props
18
20
  }: CollapsibleContentProps) => {
19
21
  const context: {[key: string]: boolean | string} = useContext(CollapsibleContext)
20
22
  const contentCSS = buildCss('pb_collapsible_content_kit')
21
- const contentSpacing = globalProps(props)
23
+ const contentSpacing = globalProps(props, { padding })
22
24
 
23
25
  return (
24
26
  <AnimateHeight
@@ -31,6 +31,7 @@ const colorMap = {
31
31
  type CollapsibleMainProps = {
32
32
  children: React.ReactNode[] | React.ReactNode,
33
33
  className?: string,
34
+ padding?: string,
34
35
  cursor?: string,
35
36
 
36
37
  }
@@ -62,11 +63,12 @@ const CollapsibleMain = ({
62
63
  children,
63
64
  className,
64
65
  cursor = 'pointer',
66
+ padding = 'md',
65
67
  ...props
66
68
  }: CollapsibleMainProps): React.ReactElement=> {
67
69
  const context: {[key: string]: IconColors | (() => void)} | boolean = useContext(CollapsibleContext)
68
70
  const mainCSS = buildCss('pb_collapsible_main_kit')
69
- const mainSpacing = globalProps(props, { cursor })
71
+ const mainSpacing = globalProps(props, { cursor, padding })
70
72
 
71
73
  return (
72
74
  <div className={classnames(mainCSS, className, mainSpacing)}>
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import { Collapsible } from '../..'
3
3
 
4
4
  const CollapsibleDefault = () => (
5
- <Collapsible >
5
+ <Collapsible>
6
6
  <Collapsible.Main>
7
7
  <div>{'Main Section'}</div>
8
8
  </Collapsible.Main>
@@ -263,18 +263,6 @@
263
263
  }
264
264
  }
265
265
 
266
- [class*="dialog_body"] {
267
- padding: $space_sm;
268
- }
269
-
270
- [class*="dialog_header"] {
271
- padding: $space_sm;
272
- }
273
-
274
- [class*="dialog_footer"] {
275
- padding: $space_sm;
276
- }
277
-
278
266
  //styles specific to rails version of kit
279
267
  // rails version has own wrapper because of the way the overlay functions for the HTML dialog used to create this
280
268
  .pb_dialog_wrapper_rails {
@@ -11,9 +11,9 @@ type DialogBodyProps = {
11
11
 
12
12
  // Body component
13
13
  const DialogBody = (props: DialogBodyProps) => {
14
- const { children, className } = props
14
+ const { children, padding = "sm", className } = props
15
15
  const bodyCSS = buildCss("dialog_body")
16
- const bodySpacing = globalProps(props)
16
+ const bodySpacing = globalProps(props, { padding })
17
17
 
18
18
  return (
19
19
  <div className={classnames(bodyCSS, bodySpacing, className)}>
@@ -25,13 +25,16 @@ type DialogFooterProps = {
25
25
  const DialogFooter = (props: DialogFooterProps) => {
26
26
  const {
27
27
  children,
28
+ padding = "sm",
29
+ paddingBottom = "sm",
30
+ paddingX = "sm",
28
31
  className,
29
32
  spacing = "between",
30
33
  separator = false,
31
34
  } = props
32
35
 
33
36
  const footerCSS = buildCss("dialog_footer")
34
- const footerSpacing = globalProps(props)
37
+ const footerSpacing = globalProps(props, { padding, paddingBottom, paddingX })
35
38
 
36
39
  return (
37
40
  <>
@@ -28,6 +28,7 @@ const DialogHeader = (props: DialogHeaderProps) => {
28
28
  children,
29
29
  className,
30
30
  data = {},
31
+ padding = "sm",
31
32
  spacing = "between",
32
33
  closeable = true,
33
34
  separator = true,
@@ -37,7 +38,7 @@ const DialogHeader = (props: DialogHeaderProps) => {
37
38
  const dataProps = buildDataProps(data)
38
39
  const api = useContext(DialogContext)
39
40
  const headerCSS = buildCss("dialog_header")
40
- const headerSpacing = globalProps(props)
41
+ const headerSpacing = globalProps(props, { padding })
41
42
 
42
43
  /* eslint-disable react/jsx-handler-names */
43
44