playbook_ui 15.6.0.pre.alpha.play266013023 → 15.6.0.pre.alpha.play266913088

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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +3 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +4 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +95 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.html.erb +43 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.md +1 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +11 -5
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +7 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.jsx +54 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.md +9 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.jsx +80 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.md +3 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
  15. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +2 -2
  16. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +57 -0
  17. data/app/pb_kits/playbook/pb_contact/_contact.tsx +51 -24
  18. data/app/pb_kits/playbook/pb_contact/contact.html.erb +53 -19
  19. data/app/pb_kits/playbook/pb_contact/contact.rb +11 -1
  20. data/app/pb_kits/playbook/pb_contact/contact.test.js +76 -0
  21. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.html.erb +33 -0
  22. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.jsx +46 -0
  23. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_rails.md +2 -0
  24. data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_react.md +2 -0
  25. data/app/pb_kits/playbook/pb_contact/docs/example.yml +2 -0
  26. data/app/pb_kits/playbook/pb_contact/docs/index.js +1 -0
  27. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -4
  28. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +23 -14
  29. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +1 -1
  30. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.html.erb +71 -0
  31. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.jsx +57 -0
  32. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_rails.md +1 -0
  33. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_react.md +1 -0
  34. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +2 -0
  35. data/app/pb_kits/playbook/pb_dialog/docs/index.js +2 -1
  36. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +7 -5
  37. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.html.erb +19 -0
  38. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.html.erb +12 -0
  39. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.md +26 -0
  40. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.html.erb +19 -0
  41. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.md +1 -0
  42. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.html.erb +30 -0
  43. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.md +3 -0
  44. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.html.erb +29 -0
  45. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.md +13 -0
  46. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +3 -1
  47. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +5 -0
  48. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +4 -0
  49. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +39 -5
  50. data/app/pb_kits/playbook/pb_dropdown/index.js +171 -3
  51. data/app/pb_kits/playbook/pb_dropdown/quickpick_helper.rb +75 -0
  52. data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.tsx +3 -3
  53. data/app/pb_kits/playbook/pb_table/_table.tsx +187 -33
  54. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.jsx +134 -0
  55. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.md +34 -0
  56. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.html.erb +101 -0
  57. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +33 -0
  58. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.jsx +180 -0
  59. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.md +3 -0
  60. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.html.erb +122 -0
  61. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.md +3 -0
  62. data/app/pb_kits/playbook/pb_table/docs/example.yml +4 -0
  63. data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
  64. data/app/pb_kits/playbook/pb_table/table.html.erb +68 -12
  65. data/app/pb_kits/playbook/pb_table/table.rb +22 -3
  66. data/app/pb_kits/playbook/pb_table/table.test.js +143 -0
  67. data/dist/chunks/_typeahead-CbjBmIDu.js +6 -0
  68. data/dist/chunks/{lib-DDDLiZuu.js → lib-DxDBrGZX.js} +3 -3
  69. data/dist/chunks/vendor.js +3 -3
  70. data/dist/menu.yml +1 -1
  71. data/dist/playbook-rails-react-bindings.js +1 -1
  72. data/dist/playbook-rails.js +1 -1
  73. data/lib/playbook/version.rb +1 -1
  74. metadata +36 -4
  75. data/dist/chunks/_typeahead-CYNrKU10.js +0 -6
@@ -1,24 +1,23 @@
1
- <%= pb_content_tag do %>
2
- <%= pb_rails("body", props: {
3
- tag: "span",
4
- classname: "pb_contact_kit",
5
- color: "light",
6
- dark: object.dark
7
- }) do %>
8
- <% if contact_type == "email" %>
9
- <%= pb_rails("icon", props: {
10
- custom_icon: Playbook::Engine::root.join(envelope_path),
11
- fixed_width: true,
12
- dark: object.dark
13
- }) %>
1
+ <% if object.unstyled %>
2
+ <%= content_tag :span, class: object.classname, id: object.id, data: object.data, aria: object.aria, **object.html_options do %>
3
+ <% if icon_enabled %>
4
+ <% if contact_type == "email" %>
5
+ <%= pb_rails("icon", props: {
6
+ custom_icon: Playbook::Engine::root.join(envelope_path),
7
+ fixed_width: true,
8
+ dark: object.dark
9
+ }) %>
10
+ <% else %>
11
+ <%= pb_rails("icon", props: {
12
+ icon: object.contact_icon,
13
+ fixed_width: true,
14
+ dark: object.dark
15
+ }) %>
16
+ <% end %>
17
+ <%= " #{object.formatted_contact_value}" if object.contact_value %>
14
18
  <% else %>
15
- <%= pb_rails("icon", props: {
16
- icon: object.contact_icon,
17
- fixed_width: true,
18
- dark: object.dark
19
- }) %>
19
+ <%= object.formatted_contact_value if object.contact_value %>
20
20
  <% end %>
21
- <%= object.formatted_contact_value if object.contact_value %>
22
21
 
23
22
  <%= pb_rails("caption", props: {
24
23
  text: object.contact_detail,
@@ -27,4 +26,39 @@
27
26
  dark: object.dark
28
27
  }) if object.contact_detail %>
29
28
  <% end %>
29
+ <% else %>
30
+ <%= pb_content_tag do %>
31
+ <%= pb_rails("body", props: {
32
+ tag: "span",
33
+ classname: "pb_contact_kit",
34
+ color: "light",
35
+ dark: object.dark
36
+ }) do %>
37
+ <% if icon_enabled %>
38
+ <% if contact_type == "email" %>
39
+ <%= pb_rails("icon", props: {
40
+ custom_icon: Playbook::Engine::root.join(envelope_path),
41
+ fixed_width: true,
42
+ dark: object.dark
43
+ }) %>
44
+ <% else %>
45
+ <%= pb_rails("icon", props: {
46
+ icon: object.contact_icon,
47
+ fixed_width: true,
48
+ dark: object.dark
49
+ }) %>
50
+ <% end %>
51
+ <%= " #{object.formatted_contact_value}" if object.contact_value %>
52
+ <% else %>
53
+ <%= object.formatted_contact_value if object.contact_value %>
54
+ <% end %>
55
+
56
+ <%= pb_rails("caption", props: {
57
+ text: object.contact_detail,
58
+ tag: 'span',
59
+ size: 'xs',
60
+ dark: object.dark
61
+ }) if object.contact_detail %>
62
+ <% end %>
63
+ <% end %>
30
64
  <% end %>
@@ -8,6 +8,8 @@ module Playbook
8
8
  prop :contact_type
9
9
  prop :contact_value
10
10
  prop :contact_detail
11
+ prop :icon_enabled, type: Playbook::Props::Boolean, default: true
12
+ prop :unstyled, type: Playbook::Props::Boolean, default: false
11
13
 
12
14
  def classname
13
15
  generate_classname("pb_contact_kit")
@@ -44,7 +46,15 @@ module Playbook
44
46
  elsif contact_type == "international"
45
47
  contact_value
46
48
  else
47
- number_to_phone(formatted_value, area_code: true)
49
+ # Check if number has leading 1 (US country code)
50
+ # Format like "+1 (212) 555-1234"
51
+ intl_code = ""
52
+ cleaned_number = formatted_value
53
+ if cleaned_number.length == 11 && cleaned_number.start_with?("1")
54
+ intl_code = "+1 "
55
+ cleaned_number = cleaned_number.sub(/^1/, "")
56
+ end
57
+ "#{intl_code}#{number_to_phone(cleaned_number, area_code: true)}"
48
58
  end
49
59
  end
50
60
 
@@ -149,3 +149,79 @@ test('international contact type preserves original format', () => {
149
149
  const kit = screen.getByTestId('test-international-format')
150
150
  expect(kit).toHaveTextContent('+44 20 7946 0958')
151
151
  })
152
+
153
+ test('iconEnabled prop hides icon when false', () => {
154
+ render(
155
+ <>
156
+ <Contact
157
+ contactType="home"
158
+ contactValue="2125551234"
159
+ data={{ testid: 'test-with-icon' }}
160
+ iconEnabled
161
+ />
162
+ <Contact
163
+ contactType="home"
164
+ contactValue="2125551234"
165
+ data={{ testid: 'test-without-icon' }}
166
+ iconEnabled={false}
167
+ />
168
+ </>
169
+ )
170
+
171
+ // With icon enabled, should have icon
172
+ expect(screen.getByTestId('test-with-icon').querySelector('.pb_custom_icon')).toBeInTheDocument()
173
+
174
+ // Without icon, should not have icon
175
+ expect(screen.getByTestId('test-without-icon').querySelector('.pb_custom_icon')).not.toBeInTheDocument()
176
+
177
+ // But should still have the formatted phone number
178
+ expect(screen.getByTestId('test-without-icon')).toHaveTextContent('(212) 555-1234')
179
+ })
180
+
181
+ test('unstyled prop renders without Body wrapper', () => {
182
+ render(
183
+ <>
184
+ <Contact
185
+ contactType="home"
186
+ contactValue="2125551234"
187
+ data={{ testid: 'test-styled' }}
188
+ />
189
+ <Contact
190
+ contactType="home"
191
+ contactValue="2125551234"
192
+ data={{ testid: 'test-unstyled' }}
193
+ unstyled
194
+ />
195
+ </>
196
+ )
197
+
198
+ // Styled version should have Body wrapper with pb_contact_kit class
199
+ const styled = screen.getByTestId('test-styled')
200
+ const styledBody = styled.querySelector('span.pb_contact_kit')
201
+ expect(styledBody).toBeInTheDocument()
202
+ expect(styledBody).toHaveTextContent('(212) 555-1234')
203
+
204
+ // Unstyled version should be a span without Body wrapper
205
+ const unstyled = screen.getByTestId('test-unstyled')
206
+ expect(unstyled.tagName).toBe('SPAN')
207
+ expect(unstyled.querySelector('span.pb_contact_kit')).not.toBeInTheDocument()
208
+ expect(unstyled).toHaveTextContent('(212) 555-1234')
209
+ })
210
+
211
+ test('unstyled and iconEnabled work together', () => {
212
+ render(
213
+ <Contact
214
+ contactType="home"
215
+ contactValue="2125551234"
216
+ data={{ testid: 'test-unstyled-no-icon' }}
217
+ iconEnabled={false}
218
+ unstyled
219
+ />
220
+ )
221
+
222
+ const kit = screen.getByTestId('test-unstyled-no-icon')
223
+ expect(kit.tagName).toBe('SPAN')
224
+ expect(kit.querySelector('.pb_custom_icon')).not.toBeInTheDocument()
225
+ expect(kit.querySelector('.pb_body_kit')).not.toBeInTheDocument()
226
+ expect(kit).toHaveTextContent('(212) 555-1234')
227
+ })
@@ -0,0 +1,33 @@
1
+ <%= pb_rails("body", props: { color: "default" }) do %>
2
+ <%= pb_rails("contact", props: {
3
+ contact_value: "2125551234",
4
+ icon_enabled: false,
5
+ unstyled: true
6
+ }) %>
7
+ <% end %>
8
+
9
+ <%= pb_rails("body", props: { color: "light" }) do %>
10
+ <%= pb_rails("contact", props: {
11
+ contact_value: "12125551234",
12
+ icon_enabled: false,
13
+ unstyled: true
14
+ }) %>
15
+ <% end %>
16
+
17
+ <%= pb_rails("body", props: { color: "lighter" }) do %>
18
+ <%= pb_rails("contact", props: {
19
+ contact_value: "4155551234",
20
+ icon_enabled: false,
21
+ unstyled: true
22
+ }) %>
23
+ <% end %>
24
+
25
+ <%= pb_rails("body", props: { color: "default" }) do %>
26
+ <%= pb_rails("contact", props: {
27
+ contact_type: "extension",
28
+ contact_value: "1234",
29
+ icon_enabled: false,
30
+ unstyled: true
31
+ }) %>
32
+ <% end %>
33
+
@@ -0,0 +1,46 @@
1
+ import React from 'react'
2
+ import Contact from "../../pb_contact/_contact"
3
+ import Body from "../../pb_body/_body"
4
+
5
+ const ContactUnstyled = (props) => {
6
+ return (
7
+ <div>
8
+ <Body color="default">
9
+ <Contact
10
+ contactValue="2125551234"
11
+ iconEnabled={false}
12
+ unstyled
13
+ {...props}
14
+ />
15
+ </Body>
16
+ <Body color="light">
17
+ <Contact
18
+ contactValue="12125551234"
19
+ iconEnabled={false}
20
+ unstyled
21
+ {...props}
22
+ />
23
+ </Body>
24
+ <Body color="lighter">
25
+ <Contact
26
+ contactValue="4155551234"
27
+ iconEnabled={false}
28
+ unstyled
29
+ {...props}
30
+ />
31
+ </Body>
32
+ <Body color="default">
33
+ <Contact
34
+ contactType="extension"
35
+ contactValue="1234"
36
+ iconEnabled={false}
37
+ unstyled
38
+ {...props}
39
+ />
40
+ </Body>
41
+ </div>
42
+ )
43
+ }
44
+
45
+ export default ContactUnstyled
46
+
@@ -0,0 +1,2 @@
1
+ Use the Contact kit with `icon_enabled: false` and `unstyled: true` to display phone numbers with full typography control. When `unstyled: true`, the Contact kit renders just the formatted text without a Body wrapper, allowing you to wrap it in your own Typography kit to control the color and styling.
2
+
@@ -0,0 +1,2 @@
1
+ Use the Contact kit with `iconEnabled={false}` and `unstyled` to display phone numbers with full typography control. With `unstyled`, the Contact kit renders just the formatted text without a Body wrapper, allowing you to wrap it in your own Typography kit to control the color and styling.
2
+
@@ -3,11 +3,13 @@ examples:
3
3
  rails:
4
4
  - contact_default: Default
5
5
  - contact_with_detail: Detail Indicator
6
+ - contact_unstyled: Unstyled
6
7
 
7
8
 
8
9
  react:
9
10
  - contact_default: Default
10
11
  - contact_with_detail: Detail Indicator
12
+ - contact_unstyled: Unstyled
11
13
 
12
14
 
13
15
  swift:
@@ -1,2 +1,3 @@
1
1
  export { default as ContactDefault } from './_contact_default.jsx'
2
2
  export { default as ContactWithDetail } from './_contact_with_detail.jsx'
3
+ export { default as ContactUnstyled } from './_contact_unstyled.jsx'
@@ -570,10 +570,16 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
570
570
  picker.config.onClose.push((selectedDates: string) => {
571
571
  if (selectedDates?.length) {
572
572
  const element = document.querySelector(`#${syncStartWith}`) as any;
573
- // Check if it's a Dropdown QuickPick (has _dropdownRef) or DatePicker QuickPick (has _flatpickr)
573
+ // Check if it's a React Dropdown (has _dropdownRef)
574
574
  if (element?._dropdownRef?.current) {
575
575
  element._dropdownRef.current.clearSelected();
576
- } else {
576
+ }
577
+ // Check if it's a Rails Dropdown (has _pbDropdownInstance)
578
+ else if (element?._pbDropdownInstance) {
579
+ element._pbDropdownInstance.clearSelected();
580
+ }
581
+ // Check if it's a DatePicker QuickPick (has _flatpickr)
582
+ else {
577
583
  const quickpick = element?._flatpickr;
578
584
  quickpick?.clear();
579
585
  }
@@ -586,10 +592,16 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
586
592
  picker.config.onClose.push((selectedDates: string) => {
587
593
  if (selectedDates?.length) {
588
594
  const element = document.querySelector(`#${syncEndWith}`) as any;
589
- // Check if it's a Dropdown QuickPick (has _dropdownRef) or DatePicker QuickPick (has _flatpickr)
595
+ // Check if it's a React Dropdown (has _dropdownRef)
590
596
  if (element?._dropdownRef?.current) {
591
597
  element._dropdownRef.current.clearSelected();
592
- } else {
598
+ }
599
+ // Check if it's a Rails Dropdown (has _pbDropdownInstance)
600
+ else if (element?._pbDropdownInstance) {
601
+ element._pbDropdownInstance.clearSelected();
602
+ }
603
+ // Check if it's a DatePicker QuickPick (has _flatpickr)
604
+ else {
593
605
  const quickpick = element?._flatpickr;
594
606
  quickpick?.clear();
595
607
  }
@@ -1,20 +1,29 @@
1
- <%= pb_rails("date_picker", props: {
2
- mode: "range",
3
- picker_id: "quick-pick-date-range",
4
- placeholder: "Select a Date Range",
5
- selection_type: "quickpick",
6
- controls_end_id: "quick-pick-date-range-end",
7
- controls_start_id: "quick-pick-date-range-start",
1
+ <%= pb_rails("dropdown", props: {
2
+ id: "dropdown-quickpick-with-date-pickers-1",
3
+ label: "Date Range",
4
+ name: "date_range",
5
+ margin_bottom: "sm",
6
+ variant: "quickpick",
7
+ controls_start_id: "start-date-picker-1",
8
+ controls_end_id: "end-date-picker-1",
9
+ start_date_id: "quickpick_start_date_1",
10
+ start_date_name: "start_date",
11
+ end_date_id: "quickpick_end_date_1",
12
+ end_date_name: "end_date"
8
13
  }) %>
9
14
 
10
15
  <%= pb_rails("date_picker", props: {
11
- picker_id: "quick-pick-date-range-start",
12
- placeholder: "Select a Start Date",
13
- sync_start_with:"quick-pick-date-range",
16
+ picker_id: "start-date-picker-1",
17
+ label: "Start Date",
18
+ name: "start_date_picker",
19
+ placeholder: "Select Start Date",
20
+ sync_start_with: "dropdown-quickpick-with-date-pickers-1"
14
21
  }) %>
15
22
 
16
23
  <%= pb_rails("date_picker", props: {
17
- picker_id: "quick-pick-date-range-end",
18
- placeholder: "Select an End Date",
19
- sync_end_with:"quick-pick-date-range",
20
- }) %>
24
+ picker_id: "end-date-picker-1",
25
+ label: "End Date",
26
+ name: "end_date_picker",
27
+ placeholder: "Select End Date",
28
+ sync_end_with: "dropdown-quickpick-with-date-pickers-1"
29
+ }) %>
@@ -1,4 +1,4 @@
1
- You can link a Quickpick DatePicker to standard DatePickers using the following props:
1
+ You can link a Quickpick Dropdown to standard DatePickers using the following props:
2
2
 
3
3
  **For the Quickpick DatePicker**:
4
4
  `controls_start_id`: ID of the DatePicker that should receive the start date.
@@ -0,0 +1,71 @@
1
+ <%
2
+ typeahead_options = [
3
+ {
4
+ label: "United States",
5
+ value: "unitedStates",
6
+ id: "us"
7
+ },
8
+ {
9
+ label: "United Kingdom",
10
+ value: "unitedKingdom",
11
+ id: "gb"
12
+ },
13
+ {
14
+ label: "Canada",
15
+ value: "canada",
16
+ id: "ca"
17
+ },
18
+ {
19
+ label: "Australia",
20
+ value: "australia",
21
+ id: "au"
22
+ },
23
+ {
24
+ label: "Germany",
25
+ value: "germany",
26
+ id: "de"
27
+ },
28
+ {
29
+ label: "France",
30
+ value: "france",
31
+ id: "fr"
32
+ },
33
+ {
34
+ label: "Japan",
35
+ value: "japan",
36
+ id: "jp"
37
+ },
38
+ {
39
+ label: "Brazil",
40
+ value: "brazil",
41
+ id: "br"
42
+ }
43
+ ]
44
+ %>
45
+
46
+ <%= pb_rails("button", props: { text: "Open Dialog with Overflow Visible", data: {"open-dialog": "dialog-overflow-visible"} }) %>
47
+
48
+ <%= pb_rails("dialog", props: {
49
+ id: "dialog-overflow-visible",
50
+ size: "md",
51
+ overflow: "visible"
52
+ }) do %>
53
+ <%= pb_rails("dialog/dialog_header", props: { id: "dialog-overflow-visible" } ) do %>
54
+ <%= pb_rails("body", props: { text: "Select Location" }) %>
55
+ <% end %>
56
+ <%= pb_rails("dialog/dialog_body") do %>
57
+ <%= pb_rails("typeahead", props: {
58
+ options: typeahead_options,
59
+ placeholder: "Select a location...",
60
+ id: "location-typeahead",
61
+ is_multi: false,
62
+ }) %>
63
+ <% end %>
64
+ <%= pb_rails("dialog/dialog_footer", props: {
65
+ cancel_button: "Cancel",
66
+ confirm_button: "Save",
67
+ confirm_button_id: "confirm-overflow-visible",
68
+ id: "dialog-overflow-visible"
69
+ }) %>
70
+ <% end %>
71
+
@@ -0,0 +1,57 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import Body from '../../pb_body/_body'
4
+ import Button from '../../pb_button/_button'
5
+ import Dialog from '../../pb_dialog/_dialog'
6
+ import Typeahead from '../../pb_typeahead/_typeahead'
7
+
8
+ const DialogOverflowVisible = () => {
9
+ const [isOpen, setIsOpen] = useState(false)
10
+ const close = () => setIsOpen(false)
11
+ const open = () => setIsOpen(true)
12
+
13
+ const typeaheadOptions = [
14
+ { label: "United States", value: "unitedStates", id: "us" },
15
+ { label: "United Kingdom", value: "unitedKingdom", id: "gb" },
16
+ { label: "Canada", value: "canada", id: "ca" },
17
+ { label: "Australia", value: "australia", id: "au" },
18
+ { label: "Germany", value: "germany", id: "de" },
19
+ { label: "France", value: "france", id: "fr" },
20
+ { label: "Japan", value: "japan", id: "jp" },
21
+ { label: "Brazil", value: "brazil", id: "br" },
22
+ ]
23
+
24
+ return (
25
+ <>
26
+ <Button onClick={open}>{'Open Dialog with Overflow Visible'}</Button>
27
+ <Dialog
28
+ onClose={close}
29
+ opened={isOpen}
30
+ overflow="visible"
31
+ size="md"
32
+ >
33
+ <Dialog.Header>
34
+ <Body>{'Select Location'}</Body>
35
+ </Dialog.Header>
36
+ <Dialog.Body>
37
+ <Typeahead
38
+ options={typeaheadOptions}
39
+ placeholder="Select a location..."
40
+ />
41
+ </Dialog.Body>
42
+ <Dialog.Footer>
43
+ <Button onClick={close}>{'Save'}</Button>
44
+ <Button
45
+ onClick={close}
46
+ variant="link"
47
+ >
48
+ {'Cancel'}
49
+ </Button>
50
+ </Dialog.Footer>
51
+ </Dialog>
52
+ </>
53
+ )
54
+ }
55
+
56
+ export default DialogOverflowVisible
57
+
@@ -0,0 +1 @@
1
+ Use the `overflow: "visible"` global prop to allow Typeahead dropdown menus to appear outside the dialog boundaries. By default, dialogs clip content that extends beyond their edges, but this prop enables pop-up elements to render above the dialog overlay.
@@ -0,0 +1 @@
1
+ Use the `overflow="visible"` global prop to allow Date Picker and Typeahead dropdown menus to appear outside the dialog boundaries. By default, dialogs clip content that extends beyond their edges, but this prop enables pop-up elements to render above the dialog overlay.
@@ -12,6 +12,7 @@ examples:
12
12
  - dialog_full_height_placement: Full Height Placement
13
13
  - dialog_loading: Loading
14
14
  - dialog_turbo_frames: Within Turbo Frames
15
+ - dialog_overflow_visible: Overflow Visible
15
16
  - dialog_closeable: Close Button in Header
16
17
 
17
18
 
@@ -26,6 +27,7 @@ examples:
26
27
  - dialog_full_height: Full Height
27
28
  - dialog_full_height_placement: Full Height Placement
28
29
  - dialog_loading: Loading
30
+ - dialog_overflow_visible: Overflow Visible
29
31
  - dialog_closeable: Close Button in Header
30
32
 
31
33
  swift:
@@ -9,4 +9,5 @@ export { default as DialogStackedAlert } from './_dialog_stacked_alert.jsx'
9
9
  export { default as DialogFullHeight } from './_dialog_full_height.jsx'
10
10
  export { default as DialogFullHeightPlacement } from './_dialog_full_height_placement.jsx'
11
11
  export { default as DialogLoading } from './_dialog_loading.jsx'
12
- export { default as DialogCloseable } from './_dialog_closeable.jsx'
12
+ export { default as DialogOverflowVisible } from './_dialog_overflow_visible.jsx'
13
+ export { default as DialogCloseable } from './_dialog_closeable.jsx'
@@ -20,12 +20,14 @@
20
20
 
21
21
  %>
22
22
 
23
- <%= pb_rails("dropdown", props: {options: options}) %>
23
+ <%= pb_rails("dropdown", props: {id: "country-dropdown", options: options}) %>
24
24
 
25
25
  <script>
26
26
  document.addEventListener("pb:dropdown:selected", (e) => {
27
- const option = e.detail;
28
- const dropdown = e.target;
29
- console.log("Selected option:", option);
30
- })
27
+ if (e.target.id === "country-dropdown") {
28
+ const option = e.detail;
29
+ const dropdown = e.target;
30
+ console.log("Selected option:", option);
31
+ }
32
+ });
31
33
  </script>
@@ -0,0 +1,19 @@
1
+
2
+ <%= pb_rails("dropdown", props: {
3
+ id: "date-range-with-default",
4
+ label: "Date Range",
5
+ variant: "quickpick",
6
+ default_value: "This Year"
7
+ }) %>
8
+
9
+ <script>
10
+ document.addEventListener("DOMContentLoaded", () => {
11
+ const dropdown = document.getElementById("date-range-with-default");
12
+ if (dropdown) {
13
+ dropdown.addEventListener("pb:dropdown:selected", (e) => {
14
+ const option = e.detail;
15
+ console.log("Selected option:", option);
16
+ });
17
+ }
18
+ });
19
+ </script>
@@ -0,0 +1,12 @@
1
+ <%= pb_rails("dropdown", props: {id: "date-range-quickpick-1", label: "Date Range", variant: "quickpick"}) %>
2
+
3
+
4
+ <script>
5
+ const dropdown = document.getElementById("date-range-quickpick-1");
6
+ if (dropdown) {
7
+ dropdown.addEventListener("pb:dropdown:selected", (e) => {
8
+ const option = e.detail;
9
+ console.log("Selected option:", option);
10
+ });
11
+ }
12
+ </script>
@@ -0,0 +1,26 @@
1
+ The `quickpick` variant provides predefined date based options when `variant:"quickpick"` is used.
2
+
3
+ Open the Dropdown above to see the default options.
4
+
5
+ The quickpick variant automatically generates hidden inputs for `start_date` and `end_date` which are populated when a date range is selected. These inputs are ready for form submission.
6
+
7
+ You can customize the input names and IDs using the following props:
8
+ - `start_date_name` - The name attribute for the start date input (default: `"start_date_name"`)
9
+ - `start_date_id` - The ID attribute for the start date input (default: `"start_date_id"`)
10
+ - `end_date_name` - The name attribute for the end date input (default: `"end_date_name"`)
11
+ - `end_date_id` - The ID attribute for the end date input (default: `"end_date_id"`)
12
+
13
+ Example with custom names:
14
+ ```ruby
15
+ pb_rails("dropdown", props: {
16
+ variant: "quickpick",
17
+ start_date_name: "filter[start_date]",
18
+ start_date_id: "filter_start_date",
19
+ end_date_name: "filter[end_date]",
20
+ end_date_id: "filter_end_date"
21
+ })
22
+ ```
23
+
24
+ The Dropdown kit also comes with a custom event called "pb:dropdown:selected" which updates dynamically with the selection as it changes. See code snippet to see this in action.
25
+
26
+ In addition, a data attribute called data-option-selected with the selection is also rendered on the parent dropdown div.
@@ -0,0 +1,19 @@
1
+
2
+ <%= pb_rails("dropdown", props: {
3
+ id: "date-range-quickpick-end-today",
4
+ label: "Date Range",
5
+ variant: "quickpick",
6
+ range_ends_today: true
7
+ }) %>
8
+
9
+ <script>
10
+ document.addEventListener("DOMContentLoaded", () => {
11
+ const dropdown = document.getElementById("date-range-quickpick-end-today");
12
+ if (dropdown) {
13
+ dropdown.addEventListener("pb:dropdown:selected", (e) => {
14
+ const option = e.detail;
15
+ console.log("Selected option:", option);
16
+ });
17
+ }
18
+ });
19
+ </script>
@@ -0,0 +1 @@
1
+ The optional `range_ends_today` prop can be used with the `quickpick` variant to set end date on all ranges that start with 'this' to today's date. For instance, by default 'This Year' will set end day to 12/31/(current year), but if `range_ends_today` prop is used, end date on that range will be today's date.