playbook_ui 12.30.1.pre.alpha.PLAY906multilevelselectedidsprop917 → 12.30.1.pre.alpha.play846responsivespacingglobalpropsneedsdefault924

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_card/_card.scss +3 -0
  3. data/app/pb_kits/playbook/pb_card/_card.tsx +5 -6
  4. data/app/pb_kits/playbook/pb_card/card.html.erb +1 -3
  5. data/app/pb_kits/playbook/pb_card/card.rb +0 -96
  6. data/app/pb_kits/playbook/pb_card/card_body.rb +93 -1
  7. data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +11 -0
  8. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +1 -3
  9. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx +1 -3
  10. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +1 -3
  11. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +1 -1
  12. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +12 -0
  13. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.tsx +2 -2
  14. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.tsx +1 -4
  15. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx +1 -2
  16. data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +1 -4
  17. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +3 -8
  18. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -2
  19. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -2
  20. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -3
  21. data/dist/playbook-rails.js +5 -5
  22. data/lib/playbook/version.rb +1 -1
  23. metadata +1 -4
  24. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.html.erb +0 -76
  25. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.jsx +0 -88
  26. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.md +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 404d26f3703a426ecde67500a1798f2813ae70c028e98ddfdd7e8f8d80105d8c
4
- data.tar.gz: 64eb45d4f46d4961bd448ea55a5fae0de8b8a1ee6a30ba4dcd930d8b8062d82a
3
+ metadata.gz: 34a695910f67fbd8f8a01279fe53bcfd4115ca6fc419a2a4f598b48464ade926
4
+ data.tar.gz: d17f2e8534379076372aa29bcf3daadbb83acc5fc47bb5be5bd3ff31a2541461
5
5
  SHA512:
6
- metadata.gz: 4d764ae50195612ea62e69302bea613063a6dbc42311320b044a41a198b98de8fd5a018a4eceb9ec703d230cd7a638e62e80bfc91a1dd75f9e8c8dc58f86468f
7
- data.tar.gz: efb6027ee7c683ba70cb59aa19410dc1f5d0c488558e40476a21a818b50276781a70d16e5a57a42548062a4cb16f2b5f01508a9f29c0a29fd3372b38ca415bd0
6
+ metadata.gz: 82adeb777f4240ec21972169b4866a1b857597d02f63c30859b30e3a407abdd62427807e837beef23780136a9002c01513cc6478ca0c023c8fc5c564ea3ac52f
7
+ data.tar.gz: fdc73b9b2eed6973de5a14011ce0240cf3c84fcff6e9f8e454ceecf15de721a974958d349803d6657302b682cf8ed64ac4a1f87f97971f818c2607a20ce9b012
@@ -3,6 +3,7 @@
3
3
 
4
4
  [class^=pb_card_kit] {
5
5
  @include pb_card;
6
+ padding: $space_md;
6
7
 
7
8
  &[class*=_selected] {
8
9
  @include pb_card_selected;
@@ -25,6 +26,7 @@
25
26
  flex-shrink: 0;
26
27
  flex-basis: auto;
27
28
  min-height: 1px;
29
+ padding: $space_sm;
28
30
  border: 0;
29
31
  border-radius: $pb_card_header_border_radius $pb_card_header_border_radius 0px 0px;
30
32
  @each $color_name, $color_value in $pb_card_header_colors {
@@ -57,6 +59,7 @@
57
59
  flex-basis: auto;
58
60
  min-height: 1px;
59
61
  border: 0;
62
+ padding: $space_md;
60
63
  }
61
64
 
62
65
  &[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, padding = 'sm' } = props
45
+ const { children, className, headerColor = 'category_1', headerColorStriped = false } = props
46
46
  const headerCSS = buildCss('pb_card_header_kit', `${headerColor}`, headerColorStriped ? 'striped' : '')
47
47
 
48
- const headerSpacing = globalProps(props, { padding })
48
+ const headerSpacing = globalProps(props)
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, padding = 'md', className } = props
60
+ const { children, className } = props
61
61
  const bodyCSS = buildCss('pb_card_body_kit')
62
- const bodySpacing = globalProps(props, { padding })
62
+ const bodySpacing = globalProps(props)
63
63
 
64
64
  return (
65
65
  <div className={classnames(bodyCSS, bodySpacing, className)}>
@@ -80,7 +80,6 @@ const Card = (props: CardPropTypes) => {
80
80
  highlight = {},
81
81
  selected = false,
82
82
  tag = 'div',
83
- padding = 'md',
84
83
  } = props
85
84
  const borderCSS = borderNone == true ? 'border_none' : ''
86
85
  const selectedCSS = selected == true ? 'selected' : 'deselected'
@@ -114,7 +113,7 @@ const Card = (props: CardPropTypes) => {
114
113
  <Tag
115
114
  {...ariaProps}
116
115
  {...dataProps}
117
- className={classnames(cardCss, globalProps(props, { padding }), className)}
116
+ className={classnames(cardCss, globalProps(props), className)}
118
117
  >
119
118
  {subComponentTags('Header')}
120
119
  {nonHeaderChildren}
@@ -4,9 +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, 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? %>
7
+ <%= content.presence %>
10
8
  <% end %>
11
9
 
12
10
 
@@ -28,102 +28,6 @@ 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
-
127
31
  private
128
32
 
129
33
  def selected_class
@@ -4,7 +4,99 @@ module Playbook
4
4
  module PbCard
5
5
  class CardBody < Playbook::KitBase
6
6
  def classname
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: " ")
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
8
100
  end
9
101
  end
10
102
  end
@@ -1,6 +1,9 @@
1
1
  @import "./tokens/colors";
2
+ @import "./tokens/spacing";
2
3
 
3
4
  [class^=pb_collapsible_kit] {
5
+ padding: $space_md;
6
+
4
7
  .toggle-content {
5
8
  display: none;
6
9
  height: 0;
@@ -18,3 +21,11 @@
18
21
  color: $primary
19
22
  }
20
23
  }
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,7 +19,6 @@ type CollapsibleProps = {
19
19
  iconColor?: 'default' | 'light' | 'lighter' | 'link' | 'error' | 'success',
20
20
  iconSize?: typeof IconSizes
21
21
  id?: string,
22
- padding?: string,
23
22
  }
24
23
 
25
24
  const useCollapsible = (initial = false) => {
@@ -40,7 +39,6 @@ const Collapsible = ({
40
39
  iconColor = 'default',
41
40
  iconSize,
42
41
  id,
43
- padding = 'md',
44
42
  ...props
45
43
  }: CollapsibleProps) => {
46
44
  const [isCollapsed, collapse] = useCollapsible(collapsed)
@@ -59,7 +57,7 @@ const Collapsible = ({
59
57
  const dataProps = buildDataProps(data)
60
58
  const classes = classnames(
61
59
  buildCss('pb_collapsible_kit'),
62
- globalProps(props, { padding }),
60
+ globalProps(props),
63
61
  className
64
62
  )
65
63
 
@@ -9,18 +9,16 @@ import CollapsibleContext from '../context'
9
9
  export type CollapsibleContentProps = {
10
10
  children?: React.ReactNode[] | React.ReactNode | string,
11
11
  className?: string,
12
- padding?: string,
13
12
  }
14
13
 
15
14
  const CollapsibleContent = ({
16
15
  children,
17
16
  className,
18
- padding = 'md',
19
17
  ...props
20
18
  }: CollapsibleContentProps) => {
21
19
  const context: {[key: string]: boolean | string} = useContext(CollapsibleContext)
22
20
  const contentCSS = buildCss('pb_collapsible_content_kit')
23
- const contentSpacing = globalProps(props, { padding })
21
+ const contentSpacing = globalProps(props)
24
22
 
25
23
  return (
26
24
  <AnimateHeight
@@ -31,7 +31,6 @@ const colorMap = {
31
31
  type CollapsibleMainProps = {
32
32
  children: React.ReactNode[] | React.ReactNode,
33
33
  className?: string,
34
- padding?: string,
35
34
  cursor?: string,
36
35
 
37
36
  }
@@ -63,12 +62,11 @@ const CollapsibleMain = ({
63
62
  children,
64
63
  className,
65
64
  cursor = 'pointer',
66
- padding = 'md',
67
65
  ...props
68
66
  }: CollapsibleMainProps): React.ReactElement=> {
69
67
  const context: {[key: string]: IconColors | (() => void)} | boolean = useContext(CollapsibleContext)
70
68
  const mainCSS = buildCss('pb_collapsible_main_kit')
71
- const mainSpacing = globalProps(props, { cursor, padding })
69
+ const mainSpacing = globalProps(props, { cursor })
72
70
 
73
71
  return (
74
72
  <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,6 +263,18 @@
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
+
266
278
  //styles specific to rails version of kit
267
279
  // rails version has own wrapper because of the way the overlay functions for the HTML dialog used to create this
268
280
  .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, padding = "sm", className } = props
14
+ const { children, className } = props
15
15
  const bodyCSS = buildCss("dialog_body")
16
- const bodySpacing = globalProps(props, { padding })
16
+ const bodySpacing = globalProps(props)
17
17
 
18
18
  return (
19
19
  <div className={classnames(bodyCSS, bodySpacing, className)}>
@@ -25,16 +25,13 @@ type DialogFooterProps = {
25
25
  const DialogFooter = (props: DialogFooterProps) => {
26
26
  const {
27
27
  children,
28
- padding = "sm",
29
- paddingBottom = "sm",
30
- paddingX = "sm",
31
28
  className,
32
29
  spacing = "between",
33
30
  separator = false,
34
31
  } = props
35
32
 
36
33
  const footerCSS = buildCss("dialog_footer")
37
- const footerSpacing = globalProps(props, { padding, paddingBottom, paddingX })
34
+ const footerSpacing = globalProps(props)
38
35
 
39
36
  return (
40
37
  <>
@@ -28,7 +28,6 @@ const DialogHeader = (props: DialogHeaderProps) => {
28
28
  children,
29
29
  className,
30
30
  data = {},
31
- padding = "sm",
32
31
  spacing = "between",
33
32
  closeable = true,
34
33
  separator = true,
@@ -38,7 +37,7 @@ const DialogHeader = (props: DialogHeaderProps) => {
38
37
  const dataProps = buildDataProps(data)
39
38
  const api = useContext(DialogContext)
40
39
  const headerCSS = buildCss("dialog_header")
41
- const headerSpacing = globalProps(props, { padding })
40
+ const headerSpacing = globalProps(props)
42
41
 
43
42
  /* eslint-disable react/jsx-handler-names */
44
43
 
@@ -135,7 +135,7 @@ export const recursiveCheckParent = (
135
135
  return data;
136
136
  };
137
137
 
138
- export const getExpandedItems = (treeData: { [key: string]: string }[], selectedIds: string[]) => {
138
+ export const getExpandedItems = (treeData: { [key: string]: string }[]) => {
139
139
  let expandedItems: any[] = [];
140
140
 
141
141
  const traverse = (items: string | any[], ancestors: any[] = []) => {
@@ -146,9 +146,6 @@ export const getExpandedItems = (treeData: { [key: string]: string }[], selected
146
146
  if (item.expanded) {
147
147
  expandedItems.push(item.id);
148
148
  }
149
- if (selectedIds && selectedIds.length && selectedIds.includes(item.id)) {
150
- expandedItems.push(...itemAncestors.map((ancestor) => ancestor.id));
151
- }
152
149
  if (Array.isArray(item.children)) {
153
150
  const hasCheckedChildren = item.children.some(
154
151
  (child: { [key: string]: string }) => child.checked
@@ -28,7 +28,6 @@ type MultiLevelSelectProps = {
28
28
  returnAllSelected?: boolean
29
29
  treeData?: { [key: string]: string }[]
30
30
  onSelect?: (prop: { [key: string]: any }) => void
31
- selectedIds?: string[]
32
31
  } & GlobalProps
33
32
 
34
33
  const MultiLevelSelect = (props: MultiLevelSelectProps) => {
@@ -42,7 +41,6 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
42
41
  returnAllSelected = false,
43
42
  treeData,
44
43
  onSelect = () => {},
45
- selectedIds
46
44
  } = props
47
45
 
48
46
  const ariaProps = buildAriaProps(aria)
@@ -66,14 +64,14 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
66
64
  //state for return for default
67
65
  const [defaultReturn, setDefaultReturn] = useState([])
68
66
  // Get expanded items from treeData.
69
- const initialExpandedItems = getExpandedItems(treeData, selectedIds);
67
+ const initialExpandedItems = getExpandedItems(treeData);
70
68
  // Initialize state with expanded items.
71
69
  const [expanded, setExpanded] = useState(initialExpandedItems);
72
70
 
73
71
 
74
72
  useEffect(() => {
75
- setFormattedData(addCheckedAndParentProperty(treeData, selectedIds))
76
- }, [treeData, selectedIds])
73
+ setFormattedData(addCheckedAndParentProperty(treeData))
74
+ }, [treeData])
77
75
 
78
76
  useEffect(() => {
79
77
  if (returnAllSelected) {
@@ -162,7 +160,6 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
162
160
  //function to map over data and add parent_id + depth property to each item
163
161
  const addCheckedAndParentProperty = (
164
162
  treeData: { [key: string]: any }[],
165
- selectedIds: string[],
166
163
  parent_id: string = null,
167
164
  depth: number = 0,
168
165
  ) => {
@@ -172,7 +169,6 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
172
169
  return treeData.map((item: { [key: string]: any } | any) => {
173
170
  const newItem = {
174
171
  ...item,
175
- checked: selectedIds && selectedIds.length && selectedIds.includes(item.id),
176
172
  parent_id,
177
173
  depth,
178
174
  }
@@ -183,7 +179,6 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
183
179
  : item.children
184
180
  newItem.children = addCheckedAndParentProperty(
185
181
  children,
186
- selectedIds,
187
182
  newItem.id,
188
183
  depth + 1
189
184
  )
@@ -2,11 +2,9 @@ examples:
2
2
  rails:
3
3
  - multi_level_select_default: Default
4
4
  - multi_level_select_return_all_selected: Return All Selected
5
- - multi_level_select_selected_ids: Selected Ids
6
5
  - multi_level_select_with_form: With Form
7
6
 
8
7
  react:
9
8
  - multi_level_select_default: Default
10
9
  - multi_level_select_return_all_selected: Return All Selected
11
- - multi_level_select_selected_ids: Selected Ids
12
10
 
@@ -1,3 +1,2 @@
1
1
  export { default as MultiLevelSelectDefault } from './_multi_level_select_default.jsx'
2
- export { default as MultiLevelSelectReturnAllSelected } from './_multi_level_select_return_all_selected.jsx'
3
- export { default as MultiLevelSelectSelectedIds } from "./_multi_level_select_selected_ids.jsx"
2
+ export { default as MultiLevelSelectReturnAllSelected } from './_multi_level_select_return_all_selected.jsx'
@@ -9,8 +9,6 @@ module Playbook
9
9
  default: []
10
10
  prop :return_all_selected, type: Playbook::Props::Boolean,
11
11
  default: false
12
- prop :selected_ids, type: Playbook::Props::Array,
13
- default: []
14
12
  prop :input_display, type: Playbook::Props::Enum,
15
13
  values: %w[pills none],
16
14
  default: "pills"
@@ -26,7 +24,6 @@ module Playbook
26
24
  name: name,
27
25
  treeData: tree_data,
28
26
  returnAllSelected: return_all_selected,
29
- selectedIds: selected_ids,
30
27
  }
31
28
  end
32
29
  end