playbook_ui 14.5.0.pre.alpha.PLAY1601updatereactzoompanpinch4128 → 14.5.0.pre.alpha.PLAY15814040

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_card/_card.tsx +5 -1
  3. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -1
  4. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +4 -20
  5. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -1
  6. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +0 -1
  7. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
  8. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +2 -2
  9. data/app/pb_kits/playbook/pb_filter/Filter/ResultsCount.tsx +2 -4
  10. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +1 -1
  11. data/app/pb_kits/playbook/pb_flex/_flex.tsx +3 -1
  12. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +8 -2
  13. data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +3 -6
  14. data/app/pb_kits/playbook/pb_flex/flex_item.rb +5 -2
  15. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +0 -17
  16. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -1
  17. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss +65 -169
  18. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js +5 -5
  19. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +9 -15
  20. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +0 -2
  21. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js +0 -1
  22. data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +6 -28
  23. data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb +1 -31
  24. data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
  25. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +3 -0
  26. data/app/pb_kits/playbook/utilities/globalProps.ts +39 -2
  27. data/dist/chunks/_typeahead-D8vYsn7T.js +22 -0
  28. data/dist/chunks/_weekday_stacked-CaNCkN7U.js +45 -0
  29. data/dist/chunks/vendor.js +1 -1
  30. data/dist/playbook-doc.js +1 -1
  31. data/dist/playbook-rails-react-bindings.js +1 -1
  32. data/dist/playbook-rails.js +1 -1
  33. data/dist/playbook.css +1 -1
  34. data/lib/playbook/kit_base.rb +17 -0
  35. data/lib/playbook/version.rb +1 -1
  36. metadata +4 -10
  37. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.jsx +0 -45
  38. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.md +0 -1
  39. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.html.erb +0 -93
  40. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.md +0 -1
  41. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.html.erb +0 -336
  42. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.jsx +0 -97
  43. data/dist/chunks/_typeahead-C9g4qCcE.js +0 -22
  44. data/dist/chunks/_weekday_stacked-BcMzYSwZ.js +0 -45
@@ -14,7 +14,6 @@ type MultipleUsersStackedProps = {
14
14
  data?: { [key: string]: string },
15
15
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
16
16
  id?: string,
17
- size?: "md" | "lg" | "sm" | "xl"
18
17
  users: Array<{ [key: string]: string }>,
19
18
  variant: "default" | "bubble",
20
19
  }
@@ -28,17 +27,14 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
28
27
  htmlOptions = {},
29
28
  id,
30
29
  users,
31
- size = "sm",
32
30
  variant = "default",
33
31
  } = props
34
32
 
35
33
  const moreThanTwo = users.length > 2
36
34
  const onlyOne = users.length == 1
37
35
  const isBubble = variant === "bubble"
38
- const doubleBubble = isBubble && users.length === 2
39
36
  const tripleBubble = isBubble && users.length === 3
40
37
  const quadrupleBubble = isBubble && users.length > 3
41
- const sizeClass = isBubble ? `size_${size}` : ""
42
38
  const displayCount = () => {
43
39
  return moreThanTwo ? 1 : users.length
44
40
  }
@@ -47,19 +43,17 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
47
43
  const htmlProps = buildHtmlProps(htmlOptions)
48
44
  const classes = classnames(buildCss(
49
45
  'pb_multiple_users_stacked_kit',
50
- { single: onlyOne, bubble: isBubble }, sizeClass),
51
- globalProps(props),
52
- className)
46
+ { single: onlyOne, bubble: isBubble }), globalProps(props), className)
53
47
 
54
48
  const firstUser = () => {
55
49
  return users.slice(0, 1).map((userObject, index) => {
56
50
  return (
57
51
  <Avatar
58
52
  {...userObject}
59
- className={`pb_multiple_users_stacked_item first_item ${doubleBubble ? "double_bubble" : ""}${tripleBubble ? " triple_bubble" : ""}${quadrupleBubble ? " quadruple_bubble" : ""}`}
53
+ className={`pb_multiple_users_stacked_item first_item${tripleBubble ? " triple_bubble" : ""}${quadrupleBubble ? " quadruple_bubble" : ""}`}
60
54
  dark={dark}
61
55
  key={index}
62
- size={isBubble ? "md" : "xs"}
56
+ size={isBubble ? "sm" : "xs"}
63
57
  />
64
58
  )
65
59
  })
@@ -71,10 +65,10 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
71
65
  return (
72
66
  <Avatar
73
67
  {...userObject}
74
- className={`pb_multiple_users_stacked_item second_item ${doubleBubble ? "double_bubble" : ""}${tripleBubble ? " triple_bubble" : ""}${quadrupleBubble ? " quadruple_bubble" : ""}`}
68
+ className={`pb_multiple_users_stacked_item second_item${tripleBubble ? " triple_bubble" : ""}${quadrupleBubble ? " quadruple_bubble" : ""}`}
75
69
  dark={dark}
76
70
  key={index}
77
- size={isBubble ? "md" : "xs"}
71
+ size="xs"
78
72
  />
79
73
  )
80
74
  })
@@ -87,10 +81,10 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
87
81
  return (
88
82
  <Avatar
89
83
  {...userObject}
90
- className={`pb_multiple_users_stacked_item third_item ${doubleBubble ? "double_bubble" : ""}${tripleBubble ? " triple_bubble" : ""}${quadrupleBubble ? " quadruple_bubble" : ""}`}
84
+ className={`pb_multiple_users_stacked_item third_item${quadrupleBubble ? " quadruple_bubble" : ""}`}
91
85
  dark={dark}
92
86
  key={index}
93
- size="md"
87
+ size="xs"
94
88
  />
95
89
  )
96
90
  })
@@ -103,10 +97,10 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
103
97
  return (
104
98
  <Avatar
105
99
  {...userObject}
106
- className="pb_multiple_users_stacked_item fourth_item quadruple_bubble"
100
+ className="pb_multiple_users_stacked_item fourth_item"
107
101
  dark={dark}
108
102
  key={index}
109
- size="md"
103
+ size="xs"
110
104
  />
111
105
  )
112
106
  })
@@ -3,13 +3,11 @@ examples:
3
3
  rails:
4
4
  - multiple_users_stacked_default: Default
5
5
  - multiple_users_stacked_bubble: Bubble
6
- - multiple_users_stacked_size: Sizes
7
6
 
8
7
 
9
8
  react:
10
9
  - multiple_users_stacked_default: Default
11
10
  - multiple_users_stacked_bubble: Bubble
12
- - multiple_users_stacked_size: Sizes
13
11
 
14
12
  swift:
15
13
  - multiple_users_stacked_default_swift: Default
@@ -1,3 +1,2 @@
1
1
  export { default as MultipleUsersStackedDefault } from './_multiple_users_stacked_default.jsx'
2
2
  export { default as MultipleUsersStackedBubble } from './_multiple_users_stacked_bubble.jsx'
3
- export { default as MultipleUsersStackedSize } from './_multiple_users_stacked_size.jsx'
@@ -1,15 +1,5 @@
1
1
  <%= pb_content_tag do %>
2
- <%= pb_rails(
3
- "avatar",
4
- props: object.users[0].merge({
5
- classname: "pb_multiple_users_stacked_item first_item" +
6
- (object.double_bubble ? " double_bubble" : "") +
7
- (object.triple_bubble ? " triple_bubble" : "") +
8
- (object.quadruple_bubble ? " quadruple_bubble" : ""),
9
- dark: object.dark,
10
- size: 'xs'
11
- })
12
- ) %>
2
+ <%= pb_rails("avatar", props: object.users[0].merge({size: object.bubble ? "sm" : "xs", classname: "pb_multiple_users_stacked_item first_item#{object.triple_bubble ? " triple_bubble" : ""}#{object.quadruple_bubble ? " quadruple_bubble" : ""}", dark: object.dark}) ) %>
13
3
 
14
4
  <% unless object.only_one %>
15
5
  <% if object.more_than_two && !object.bubble %>
@@ -18,26 +8,14 @@
18
8
  text: "+#{object.users.count - object.display_count}",
19
9
  variant: "primary",
20
10
  rounded: true,
21
- classname: "pb_multiple_users_stacked_item second_item"
22
- }) %>
11
+ classname: "pb_multiple_users_stacked_item second_item" }) %>
23
12
  <% elsif object.bubble %>
24
- <% object.users.slice(1, 3).each_with_index do |item, idx| %>
25
- <%= pb_rails(
26
- "avatar",
27
- props: item.merge({
28
- classname: object.bubble_classname(idx),
29
- dark: object.dark
30
- })
31
- ) %>
13
+ <% object.users.slice(1,3).each_with_index do |item, idx| %>
14
+ <%= pb_rails("avatar", props: item.merge({size: "xs", classname: "pb_multiple_users_stacked_item #{idx == 0 ? "second_item#{object.triple_bubble ? " triple_bubble" : ""}#{object.quadruple_bubble ? " quadruple_bubble" : ""}" : idx == 1 ? "third_item#{object.quadruple_bubble ? " quadruple_bubble" : ""}" : "fourth_item"}", dark: object.dark}) ) %>
32
15
  <% end %>
33
16
  <% else %>
34
- <%= pb_rails(
35
- "avatar",
36
- props: object.users[1].merge({
37
- classname: "pb_multiple_users_stacked_item second_item",
38
- dark: object.dark
39
- })
40
- ) %>
17
+ <%= pb_rails("avatar", props: object.users[1].merge({size: "xs", classname: "pb_multiple_users_stacked_item second_item", dark: object.dark}) ) %>
41
18
  <% end %>
42
19
  <% end %>
20
+
43
21
  <% end %>
@@ -4,9 +4,6 @@ module Playbook
4
4
  module PbMultipleUsersStacked
5
5
  class MultipleUsersStacked < Playbook::KitBase
6
6
  prop :users, type: Playbook::Props::HashArray, required: true
7
- prop :size, type: Playbook::Props::Enum,
8
- values: %w[sm md lg xl],
9
- default: "sm"
10
7
 
11
8
  prop :variant, type: Playbook::Props::Enum,
12
9
  values: %w[default bubble],
@@ -28,10 +25,6 @@ module Playbook
28
25
  variant == "bubble"
29
26
  end
30
27
 
31
- def double_bubble
32
- bubble && users.count === 2
33
- end
34
-
35
28
  def triple_bubble
36
29
  bubble && users.count === 3
37
30
  end
@@ -40,31 +33,8 @@ module Playbook
40
33
  bubble && users.count > 3
41
34
  end
42
35
 
43
- def size_class
44
- "size_#{size}" if bubble
45
- end
46
-
47
36
  def classname
48
- generate_classname("pb_multiple_users_stacked_kit", single_class, bubble_class, size_class)
49
- end
50
-
51
- def bubble_classname(index)
52
- base_classname = "pb_multiple_users_stacked_item "
53
-
54
- case index
55
- when 0
56
- base_classname += "second_item"
57
- base_classname += " double_bubble" if double_bubble
58
- base_classname += " triple_bubble" if triple_bubble
59
- base_classname += " quadruple_bubble" if quadruple_bubble
60
- when 1
61
- base_classname += "third_item"
62
- base_classname += " quadruple_bubble" if quadruple_bubble
63
- else
64
- base_classname += "fourth_item"
65
- end
66
-
67
- base_classname
37
+ generate_classname("pb_multiple_users_stacked_kit", single_class, bubble_class)
68
38
  end
69
39
 
70
40
  private
@@ -21,7 +21,7 @@ import classnames from "classnames";
21
21
  import { globalProps, GlobalProps } from "../utilities/globalProps";
22
22
  import { uniqueId } from 'lodash';
23
23
 
24
- type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth'>
24
+ type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth' | 'maxHeight' | 'minHeight'>
25
25
 
26
26
  type PbPopoverProps = {
27
27
  aria?: { [key: string]: string };
@@ -1,4 +1,7 @@
1
1
  export default [
2
+ "minHeight",
3
+ "maxHeight",
4
+ "height",
2
5
  "left",
3
6
  "bottom",
4
7
  "right",
@@ -170,12 +170,24 @@ type ZIndex = {
170
170
  zIndex?: ZIndexType,
171
171
  } | ZIndexResponsiveType
172
172
 
173
+ type Height = {
174
+ height?: string
175
+ }
176
+
177
+ type MaxHeight = {
178
+ maxHeight?: string
179
+ }
180
+
181
+ type MinHeight = {
182
+ minHeight?: string
183
+ }
184
+
173
185
  // keep this as the last type definition
174
186
  export type GlobalProps = AlignContent & AlignItems & AlignSelf &
175
187
  BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
176
188
  FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
177
189
  LineHeight & Margin & MinWidth & MaxWidth & NumberSpacing & Order & Overflow & Padding &
178
- Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left;
190
+ Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left & Height & MaxHeight & MinHeight;
179
191
 
180
192
  const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
181
193
  const keys: string[] = Object.keys(prop)
@@ -498,7 +510,22 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
498
510
  } else {
499
511
  return verticalAlign ? `vertical_align_${verticalAlign} ` : ''
500
512
  }
501
- }
513
+ },
514
+
515
+ }
516
+
517
+ const PROP_INLINE_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => {[key: string]: any}} = {
518
+ heightProps: ({ height }: Height) => {
519
+ return height ? { height } : {};
520
+ },
521
+
522
+ maxHeightProps: ({ maxHeight }: MaxHeight) => {
523
+ return maxHeight ? { maxHeight } : {};
524
+ },
525
+
526
+ minHeightProps: ({ minHeight }: MinHeight) => {
527
+ return minHeight ? { minHeight } : {};
528
+ },
502
529
  }
503
530
 
504
531
  type DefaultProps = {[key: string]: string} | Record<string, unknown>
@@ -510,6 +537,16 @@ export const globalProps = (props: GlobalProps, defaultProps: DefaultProps = {})
510
537
  }).filter((value) => value?.length > 0).join(" ")
511
538
  }
512
539
 
540
+ // New function for inline styles
541
+ export const globalInlineProps = (props: GlobalProps): React.CSSProperties => {
542
+ const styles = Object.keys(PROP_INLINE_CATEGORIES).reduce((acc, key) => {
543
+ const result = PROP_INLINE_CATEGORIES[key](props);
544
+ return { ...acc, ...(typeof result === 'object' ? result : {}) }; // Ensure result is an object before spreading
545
+ }, {});
546
+
547
+ return styles; // Return the styles object directly
548
+ }
549
+
513
550
 
514
551
  export const deprecatedProps = (): void => {
515
552
  // if (process.env.NODE_ENV === 'development') {