playbook_ui 14.5.0 → 14.6.0.pre.alpha.play1586datearea4218

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +25 -7
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx +72 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.md +5 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/index.js +60 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -9
  9. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +1 -9
  10. data/app/pb_kits/playbook/pb_card/_card.tsx +5 -1
  11. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -1
  12. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.html.erb +30 -7
  13. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.md +0 -2
  14. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +84 -3
  15. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +28 -5
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.jsx +45 -0
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.md +1 -0
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.html.erb +9 -0
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.jsx +33 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.html.erb +10 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.jsx +34 -0
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -0
  23. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +5 -0
  24. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +3 -0
  25. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +10 -1
  26. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
  27. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +2 -2
  28. data/app/pb_kits/playbook/pb_filter/Filter/FilterDouble.tsx +2 -0
  29. data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +2 -0
  30. data/app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx +4 -1
  31. data/app/pb_kits/playbook/pb_filter/Filter/ResultsCount.tsx +4 -2
  32. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +1 -1
  33. data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.html.erb +41 -0
  34. data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.jsx +71 -0
  35. data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_rails.md +1 -0
  36. data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_react.md +1 -0
  37. data/app/pb_kits/playbook/pb_filter/docs/example.yml +3 -0
  38. data/app/pb_kits/playbook/pb_filter/docs/index.js +1 -0
  39. data/app/pb_kits/playbook/pb_filter/filter.html.erb +2 -2
  40. data/app/pb_kits/playbook/pb_filter/filter.rb +2 -0
  41. data/app/pb_kits/playbook/pb_flex/_flex.tsx +3 -1
  42. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +8 -2
  43. data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +3 -6
  44. data/app/pb_kits/playbook/pb_flex/flex_item.rb +7 -2
  45. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +39 -0
  46. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.md +1 -0
  47. data/app/pb_kits/playbook/pb_form/docs/example.yml +1 -0
  48. data/app/pb_kits/playbook/pb_form/form.rb +2 -0
  49. data/app/pb_kits/playbook/pb_form/formHelper.js +27 -0
  50. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +9 -1
  51. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +19 -0
  52. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +27 -0
  53. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +1 -0
  54. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
  55. data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
  56. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +211 -227
  57. data/app/pb_kits/playbook/pb_multi_level_select/context/index.tsx +5 -0
  58. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +1 -1
  59. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.html.erb +93 -0
  60. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.md +1 -0
  61. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.jsx +105 -0
  62. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.md +1 -0
  63. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.jsx +106 -0
  64. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.md +1 -0
  65. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +4 -0
  66. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +2 -0
  67. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select_options.tsx +149 -0
  68. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss +169 -65
  69. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js +5 -5
  70. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +15 -9
  71. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.html.erb +336 -0
  72. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.jsx +97 -0
  73. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +2 -0
  74. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js +1 -0
  75. data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +28 -6
  76. data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb +31 -1
  77. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +86 -18
  78. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +15 -6
  79. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.md +1 -1
  80. data/app/pb_kits/playbook/pb_phone_number_input/intlTelInput.scss +849 -931
  81. data/app/pb_kits/playbook/pb_phone_number_input/types.d.ts +4 -1
  82. data/app/pb_kits/playbook/pb_popover/_popover.tsx +6 -2
  83. data/app/pb_kits/playbook/pb_popover/docs/_popover_default.html.erb +1 -1
  84. data/app/pb_kits/playbook/pb_popover/popover.rb +3 -1
  85. data/app/pb_kits/playbook/pb_timeline/_item.tsx +59 -23
  86. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +8 -0
  87. data/app/pb_kits/playbook/pb_timeline/date_area.html.erb +12 -0
  88. data/app/pb_kits/playbook/pb_timeline/date_area.rb +13 -0
  89. data/app/pb_kits/playbook/pb_timeline/detail_area.html.erb +3 -0
  90. data/app/pb_kits/playbook/pb_timeline/detail_area.rb +11 -0
  91. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +43 -0
  92. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +68 -0
  93. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.md +4 -0
  94. data/app/pb_kits/playbook/pb_timeline/docs/example.yml +2 -1
  95. data/app/pb_kits/playbook/pb_timeline/docs/index.js +1 -0
  96. data/app/pb_kits/playbook/pb_timeline/item.html.erb +17 -21
  97. data/app/pb_kits/playbook/pb_timeline/item.rb +4 -0
  98. data/app/pb_kits/playbook/pb_timeline/node_area.html.erb +14 -0
  99. data/app/pb_kits/playbook/pb_timeline/node_area.rb +16 -0
  100. data/app/pb_kits/playbook/pb_timeline/subcomponents/Detail.tsx +29 -0
  101. data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +38 -0
  102. data/app/pb_kits/playbook/pb_timeline/subcomponents/Step.tsx +42 -0
  103. data/app/pb_kits/playbook/pb_timeline/subcomponents/index.tsx +3 -0
  104. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +84 -0
  105. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -1
  106. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +3 -1
  107. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -1
  108. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +3 -0
  109. data/app/pb_kits/playbook/utilities/globalProps.ts +39 -2
  110. data/dist/chunks/_typeahead-BhHnXJjy.js +22 -0
  111. data/dist/chunks/_weekday_stacked-C-VEa5Ar.js +45 -0
  112. data/dist/chunks/{lib-CEpcaI8y.js → lib-D-mTv-kp.js} +1 -1
  113. data/dist/chunks/{pb_form_validation-D9zkwt2b.js → pb_form_validation-BkWGwJsl.js} +1 -1
  114. data/dist/chunks/vendor.js +1 -1
  115. data/dist/playbook-doc.js +1 -1
  116. data/dist/playbook-rails-react-bindings.js +1 -1
  117. data/dist/playbook-rails.js +1 -1
  118. data/dist/playbook.css +1 -1
  119. data/lib/playbook/kit_base.rb +21 -1
  120. data/lib/playbook/pb_doc_helper.rb +5 -5
  121. data/lib/playbook/pb_forms_helper.rb +3 -1
  122. data/lib/playbook/version.rb +2 -2
  123. metadata +51 -9
  124. data/dist/chunks/_typeahead-BYw0HEgO.js +0 -22
  125. data/dist/chunks/_weekday_stacked-DumiyWjh.js +0 -45
@@ -2,6 +2,10 @@ import React from 'react'
2
2
  import { render, screen } from '../utilities/test-utils'
3
3
 
4
4
  import Timeline from './_timeline'
5
+ import TimelineItem from './_item'
6
+ import TimelineLabel from './subcomponents/Label'
7
+ import TimelineStep from './subcoponents/Step'
8
+ import TimelineDetail from './subcomponents/Detail'
5
9
  import TitleDetail from '../pb_title_detail/_title_detail'
6
10
 
7
11
  const testId = 'timeline'
@@ -43,18 +47,91 @@ const TimelineDefault = (props) => (
43
47
  </>
44
48
  )
45
49
 
50
+ const TimelineWithChildren = (props) => (
51
+ <>
52
+ <Timeline
53
+ className={className}
54
+ data={{ testid: testId }}
55
+ orientation="horizontal"
56
+ showDate
57
+ {...props}
58
+ >
59
+ <TimelineItem lineStyle="solid"
60
+ {...props}
61
+ >
62
+ <TimelineLabel date={new Date()} />
63
+ <TimelineStep icon="user"
64
+ iconColor="royal"
65
+ />
66
+ <TimelineDetail>
67
+ <TitleDetail
68
+ detail="37-27 74th Street"
69
+ title="Jackson Heights"
70
+ {...props}
71
+ />
72
+ </TimelineDetail>
73
+ </TimelineItem>
74
+
75
+ <TimelineItem lineStyle="dotted"
76
+ {...props}
77
+ >
78
+ <TimelineStep icon="check"
79
+ iconColor="teal"
80
+ />
81
+ <TimelineDetail>
82
+ <TitleDetail
83
+ detail="81 Gate St Brooklyn"
84
+ title="Greenpoint"
85
+ {...props}
86
+ />
87
+ </TimelineDetail>
88
+ </TimelineItem>
89
+
90
+ <TimelineItem lineStyle="solid"
91
+ {...props}
92
+ >
93
+ <TimelineLabel
94
+ date={new Date(new Date().setDate(new Date().getDate() + 1))}
95
+ />
96
+ <TimelineStep icon="map-marker-alt"
97
+ iconColor="purple"
98
+ />
99
+ <TimelineDetail>
100
+ <TitleDetail
101
+ detail="72 E St Astoria"
102
+ title="Society Hill"
103
+ {...props}
104
+ />
105
+ </TimelineDetail>
106
+ </TimelineItem>
107
+ </Timeline>
108
+ </>
109
+ )
110
+
46
111
  test('should pass data prop', () => {
47
112
  render(<TimelineDefault />)
48
113
  const kit = screen.getByTestId(testId)
49
114
  expect(kit).toBeInTheDocument()
50
115
  })
51
116
 
117
+ test('should pass data prop using children', () => {
118
+ render(<TimelineWithChildren />)
119
+ const kit = screen.getByTestId(testId)
120
+ expect(kit).toBeInTheDocument()
121
+ })
122
+
52
123
  test('should pass className prop', () => {
53
124
  render(<TimelineDefault />)
54
125
  const kit = screen.getByTestId(testId)
55
126
  expect(kit).toHaveClass(className)
56
127
  })
57
128
 
129
+ test('should pass className prop with children', () => {
130
+ render(<TimelineWithChildren />)
131
+ const kit = screen.getByTestId(testId)
132
+ expect(kit).toHaveClass(className)
133
+ })
134
+
58
135
  test('should pass aria prop', () => {
59
136
  render(<TimelineDefault />)
60
137
  const kit = screen.getByTestId(testId)
@@ -86,3 +163,10 @@ test('should pass showDate prop', () => {
86
163
  const kit = screen.getByTestId(testId)
87
164
  expect(kit).toHaveClass('pb_timeline_kit__horizontal__with_date')
88
165
  })
166
+
167
+ test('should pass showDate prop with Children', () => {
168
+ const props = { showDate: true }
169
+ render(<TimelineWithChildren {...props} />)
170
+ const kit = screen.getByTestId(testId)
171
+ expect(kit).toHaveClass('pb_timeline_kit__horizontal__with_date')
172
+ })
@@ -136,12 +136,15 @@ const Typeahead = ({
136
136
  }
137
137
  }
138
138
 
139
+ const filteredProps: TypeaheadProps = {...props}
140
+ delete filteredProps.truncate
141
+
139
142
  const dataProps = buildDataProps(data)
140
143
  const htmlProps = buildHtmlProps(htmlOptions)
141
144
  const classes = classnames(
142
145
  'pb_typeahead_kit react-select',
143
146
  `mb_${marginBottom}`,
144
- globalProps(props),
147
+ globalProps(filteredProps),
145
148
  className
146
149
  )
147
150
 
@@ -16,7 +16,7 @@ type Props = {
16
16
  const MultiValue = (props: Props) => {
17
17
  const { removeProps } = props
18
18
  const { imageUrl, label } = props.data
19
- const { dark, multiKit, pillColor } = props.selectProps
19
+ const { dark, multiKit, pillColor, truncate } = props.selectProps
20
20
 
21
21
  const formPillProps = {
22
22
  marginRight: 'xs',
@@ -51,6 +51,7 @@ const MultiValue = (props: Props) => {
51
51
  name={label}
52
52
  size={multiKit === 'smallPill' ? 'small' : ''}
53
53
  text=''
54
+ truncate={truncate}
54
55
  {...props}
55
56
  />
56
57
  }
@@ -64,6 +65,7 @@ const MultiValue = (props: Props) => {
64
65
  name=''
65
66
  size={multiKit === 'smallPill' ? 'small' : ''}
66
67
  text={label}
68
+ truncate={truncate}
67
69
  {...props}
68
70
  />
69
71
  }
@@ -65,10 +65,10 @@ module Playbook
65
65
  def typeahead_react_options
66
66
  base_options = {
67
67
  className: classname,
68
- pillColor: pill_color,
69
68
  dark: dark,
70
69
  defaultValue: default_options,
71
70
  error: error,
71
+ htmlOptions: html_options,
72
72
  id: id,
73
73
  inline: inline,
74
74
  isMulti: is_multi,
@@ -77,8 +77,10 @@ module Playbook
77
77
  multiKit: multi_kit,
78
78
  name: name,
79
79
  options: options,
80
+ pillColor: pill_color,
80
81
  placeholder: placeholder,
81
82
  plusIcon: plus_icon,
83
+ truncate: truncate,
82
84
  }
83
85
 
84
86
  base_options[:getOptionLabel] = get_option_label if get_option_label.present?
@@ -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') {