playbook_ui_docs 15.6.0 → 15.7.0.pre.alpha.PLAY2675dropdownquickpickcustomquickpickdates13330
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.html.erb +43 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +11 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +7 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.jsx +54 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.md +9 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.jsx +80 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +0 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +0 -3
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.html.erb +33 -0
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.jsx +46 -0
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_rails.md +2 -0
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_react.md +2 -0
- data/app/pb_kits/playbook/pb_contact/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_contact/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +23 -14
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +1 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.html.erb +24 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.jsx +60 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.md +3 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.html.erb +71 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.jsx +57 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_rails.md +1 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_react.md +1 -0
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +7 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_custom.jsx +56 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_custom.md +10 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_custom_rails.html.erb +64 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_custom_rails.md +10 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.html.erb +19 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.html.erb +12 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.md +26 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.html.erb +19 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.html.erb +30 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.html.erb +29 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.md +13 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +3 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +2 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +14 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_form/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.html.erb +2 -2
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.jsx +3 -2
- data/app/pb_kits/playbook/pb_radio/docs/_radio_error.md +1 -1
- data/app/pb_kits/playbook/pb_select/docs/_select_error.md +1 -1
- data/app/pb_kits/playbook/pb_select/docs/_select_input_options.html.erb +16 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_input_options.jsx +30 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_input_options.md +1 -0
- data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.jsx +134 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.md +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.html.erb +101 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +33 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.jsx +180 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.html.erb +122 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.md +1 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_required_indicator.html.erb +6 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_required_indicator.jsx +25 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.md +1 -1
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_24_hour.html.erb +2 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_24_hour.jsx +16 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_24_hour.md +1 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default.jsx +13 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default.md +1 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default_time.html.erb +4 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default_time.jsx +29 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default_time.md +1 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_disabled.html.erb +13 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_disabled.jsx +23 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_error.html.erb +5 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_error.jsx +15 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_input_options.html.erb +14 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_label.html.erb +2 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_label.jsx +15 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_min_max_time.html.erb +42 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_min_max_time.jsx +52 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_min_max_time.md +1 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.jsx +45 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.md +1 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_timezone.html.erb +3 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_timezone.jsx +21 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_timezone.md +1 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/example.yml +24 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/index.js +9 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.html.erb +60 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.jsx +118 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md +1 -1
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +1 -0
- metadata +77 -2
|
@@ -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,8 @@ 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
|
|
16
|
+
- dialog_closeable: Close Button in Header
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
react:
|
|
@@ -25,6 +27,8 @@ examples:
|
|
|
25
27
|
- dialog_full_height: Full Height
|
|
26
28
|
- dialog_full_height_placement: Full Height Placement
|
|
27
29
|
- dialog_loading: Loading
|
|
30
|
+
- dialog_overflow_visible: Overflow Visible
|
|
31
|
+
- dialog_closeable: Close Button in Header
|
|
28
32
|
|
|
29
33
|
swift:
|
|
30
34
|
- dialog_default_swift: Simple
|
|
@@ -8,4 +8,6 @@ export { default as DialogStatus } from './_dialog_status.jsx'
|
|
|
8
8
|
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
|
-
export { default as DialogLoading } from './_dialog_loading.jsx'
|
|
11
|
+
export { default as DialogLoading } from './_dialog_loading.jsx'
|
|
12
|
+
export { default as DialogOverflowVisible } from './_dialog_overflow_visible.jsx'
|
|
13
|
+
export { default as DialogCloseable } from './_dialog_closeable.jsx'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
You can customize the order of the colors you would like to use by using the `colors` prop. Only the data and status colors will work for Playbook charts. See the [design page](https://playbook.powerapp.cloud/
|
|
1
|
+
You can customize the order of the colors you would like to use by using the `colors` prop. Only the data and status colors will work for Playbook charts. See the [design page](https://playbook.powerapp.cloud/tokens/colors) for reference.
|
|
@@ -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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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,56 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import Dropdown from "../_dropdown"
|
|
3
|
+
|
|
4
|
+
const DropdownQuickpickCustom = (props) => (
|
|
5
|
+
<div>
|
|
6
|
+
<Dropdown
|
|
7
|
+
customQuickPickDates={{
|
|
8
|
+
dates: [
|
|
9
|
+
// Allow Playbook to handle the logic...
|
|
10
|
+
{
|
|
11
|
+
label: "Last 15 months",
|
|
12
|
+
value: {
|
|
13
|
+
timePeriod: "months",
|
|
14
|
+
amount: 15,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
// Or, be explicit with an exact date range for more control...
|
|
18
|
+
{
|
|
19
|
+
label: "First Week of June 2022",
|
|
20
|
+
value: ["06/01/2022", "06/07/2022"],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
}}
|
|
24
|
+
label="Date Range"
|
|
25
|
+
marginBottom="sm"
|
|
26
|
+
onSelect={(selectedItem) => console.log(selectedItem)}
|
|
27
|
+
variant="quickpick"
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
<Dropdown
|
|
31
|
+
customQuickPickDates={{
|
|
32
|
+
dates: [
|
|
33
|
+
{
|
|
34
|
+
label: "Last 15 months",
|
|
35
|
+
value: {
|
|
36
|
+
timePeriod: "months",
|
|
37
|
+
amount: 15,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: "First Week of June 2022",
|
|
42
|
+
value: ["06/01/2022", "06/07/2022"],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
override: false,
|
|
46
|
+
}}
|
|
47
|
+
label="Date Range - Append to Defaults"
|
|
48
|
+
onSelect={(selectedItem) => console.log(selectedItem)}
|
|
49
|
+
variant="quickpick"
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
export default DropdownQuickpickCustom
|
|
56
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
The `customQuickPickDates` prop allows for defining custom quick pick date options for the dropdown. The prop accepts an object with two properties: `dates` and `override`.
|
|
2
|
+
|
|
3
|
+
**The `dates` property** accepts an array of objects. Each object has `label` and `value` properties. The `label` is what will be displayed in the dropdown menu. The `value` property defines the date range that will be selected, and can be:
|
|
4
|
+
- An array of two date strings representing a specific range (e.g., `["06/01/2022", "06/07/2022"]`)
|
|
5
|
+
- An object with `timePeriod` and `amount` properties for dynamic date calculations:
|
|
6
|
+
- The `timePeriod` property accepts `"days"`, `"weeks"`, `"months"`, `"quarters"`, or `"years"`, representing past time periods calculated from today.
|
|
7
|
+
- The `amount` property accepts any number.
|
|
8
|
+
|
|
9
|
+
**The `override` property** is a boolean that controls whether custom dates replace or append to the default quick pick options. Default is `true` (replaces defaults). Set to `false` to append your custom dates to the default quick pick options.
|
|
10
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<%= pb_rails("dropdown", props: {
|
|
2
|
+
custom_quick_pick_dates: {
|
|
3
|
+
dates: [
|
|
4
|
+
# Allow Playbook to handle the logic...
|
|
5
|
+
{
|
|
6
|
+
label: "Last 15 months",
|
|
7
|
+
value: {
|
|
8
|
+
time_period: "months",
|
|
9
|
+
amount: 15
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
# Or, be explicit with an exact date range for more control...
|
|
13
|
+
{
|
|
14
|
+
label: "First Week of June 2022",
|
|
15
|
+
value: ["06/01/2022", "06/07/2022"]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
id: "date-range-quickpick-custom",
|
|
20
|
+
label: "Date Range",
|
|
21
|
+
margin_bottom: "sm",
|
|
22
|
+
variant: "quickpick"
|
|
23
|
+
}) %>
|
|
24
|
+
|
|
25
|
+
<%= pb_rails("dropdown", props: {
|
|
26
|
+
custom_quick_pick_dates: {
|
|
27
|
+
override: false,
|
|
28
|
+
dates: [
|
|
29
|
+
{
|
|
30
|
+
label: "Last 15 months",
|
|
31
|
+
value: {
|
|
32
|
+
time_period: "months",
|
|
33
|
+
amount: 15
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "First Week of June 2022",
|
|
38
|
+
value: ["06/01/2022", "06/07/2022"]
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
id: "date-range-quickpick-custom-append-to-defaults",
|
|
43
|
+
label: "Date Range - Append to Defaults",
|
|
44
|
+
variant: "quickpick"
|
|
45
|
+
}) %>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
const dropdown1 = document.getElementById("date-range-quickpick-custom");
|
|
49
|
+
if (dropdown1) {
|
|
50
|
+
dropdown1.addEventListener("pb:dropdown:selected", (e) => {
|
|
51
|
+
const option = e.detail;
|
|
52
|
+
console.log("Selected option:", option);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const dropdown2 = document.getElementById("date-range-quickpick-custom-append-to-defaults");
|
|
57
|
+
if (dropdown2) {
|
|
58
|
+
dropdown2.addEventListener("pb:dropdown:selected", (e) => {
|
|
59
|
+
const option = e.detail;
|
|
60
|
+
console.log("Selected option:", option);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
The `custom_quick_pick_dates` prop allows for defining custom quick pick date options for the dropdown. The prop accepts an object with two properties: `dates` and `override`.
|
|
2
|
+
|
|
3
|
+
**The `dates` property** accepts an array of objects. Each object has `label` and `value` properties. The `label` is what will be displayed in the dropdown menu. The `value` property defines the date range that will be selected, and can be:
|
|
4
|
+
- An array of two date strings representing a specific range (e.g., `["06/01/2022", "06/07/2022"]`)
|
|
5
|
+
- An object with `time_period` and `amount` properties for dynamic date calculations:
|
|
6
|
+
- The `time_period` property accepts `"days"`, `"weeks"`, `"months"`, `"quarters"`, or `"years"`, representing past time periods calculated from today.
|
|
7
|
+
- The `amount` property accepts any number.
|
|
8
|
+
|
|
9
|
+
**The `override` property** is a boolean that controls whether custom dates replace or append to the default quick pick options. Default is `true` (replaces defaults). Set to `false` to append your custom dates to the default quick pick options.
|
|
10
|
+
|
|
@@ -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.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<%= pb_rails("dropdown", props: {
|
|
2
|
+
id: "dropdown-quickpick-with-date-pickers-default",
|
|
3
|
+
label: "Date Range",
|
|
4
|
+
name: "date_range",
|
|
5
|
+
margin_bottom: "sm",
|
|
6
|
+
variant: "quickpick",
|
|
7
|
+
default_value: "This Month",
|
|
8
|
+
controls_start_id: "start-date-picker-default",
|
|
9
|
+
controls_end_id: "end-date-picker-default",
|
|
10
|
+
start_date_id: "quickpick_start_date_default",
|
|
11
|
+
start_date_name: "start_date",
|
|
12
|
+
end_date_id: "quickpick_end_date_default",
|
|
13
|
+
end_date_name: "end_date"
|
|
14
|
+
}) %>
|
|
15
|
+
|
|
16
|
+
<%= pb_rails("date_picker", props: {
|
|
17
|
+
picker_id: "start-date-picker-default",
|
|
18
|
+
label: "Start Date",
|
|
19
|
+
name: "start_date_picker",
|
|
20
|
+
placeholder: "Select Start Date",
|
|
21
|
+
sync_start_with: "dropdown-quickpick-with-date-pickers-default"
|
|
22
|
+
}) %>
|
|
23
|
+
|
|
24
|
+
<%= pb_rails("date_picker", props: {
|
|
25
|
+
picker_id: "end-date-picker-default",
|
|
26
|
+
label: "End Date",
|
|
27
|
+
name: "end_date_picker",
|
|
28
|
+
placeholder: "Select End Date",
|
|
29
|
+
sync_end_with: "dropdown-quickpick-with-date-pickers-default"
|
|
30
|
+
}) %>
|
data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
This example demonstrates the 3-input pattern with a default value. The dropdown is initialized with "This Month" selected, and both DatePickers are automatically populated with the corresponding start and end dates.
|
|
2
|
+
|
|
3
|
+
The default value can be set using the `default_value` prop with any of the quickpick option labels.
|
data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.html.erb
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<%= pb_rails("dropdown", props: {
|
|
2
|
+
id: "dropdown-quickpick-with-date-pickers",
|
|
3
|
+
label: "Date Range",
|
|
4
|
+
name: "date_range",
|
|
5
|
+
margin_bottom: "sm",
|
|
6
|
+
variant: "quickpick",
|
|
7
|
+
controls_start_id: "start-date-picker",
|
|
8
|
+
controls_end_id: "end-date-picker",
|
|
9
|
+
start_date_id: "quickpick_start_date",
|
|
10
|
+
start_date_name: "start_date",
|
|
11
|
+
end_date_id: "quickpick_end_date",
|
|
12
|
+
end_date_name: "end_date"
|
|
13
|
+
}) %>
|
|
14
|
+
|
|
15
|
+
<%= pb_rails("date_picker", props: {
|
|
16
|
+
picker_id: "start-date-picker",
|
|
17
|
+
label: "Start Date",
|
|
18
|
+
name: "start_date_picker",
|
|
19
|
+
placeholder: "Select Start Date",
|
|
20
|
+
sync_start_with: "dropdown-quickpick-with-date-pickers"
|
|
21
|
+
}) %>
|
|
22
|
+
|
|
23
|
+
<%= pb_rails("date_picker", props: {
|
|
24
|
+
picker_id: "end-date-picker",
|
|
25
|
+
label: "End Date",
|
|
26
|
+
name: "end_date_picker",
|
|
27
|
+
placeholder: "Select End Date",
|
|
28
|
+
sync_end_with: "dropdown-quickpick-with-date-pickers"
|
|
29
|
+
}) %>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
The quickpick variant can be synced with two DatePickers for a 3-input pattern. When a quickpick option is selected from the dropdown, both DatePickers are automatically populated. When either DatePicker is manually changed, the dropdown is cleared.
|
|
2
|
+
|
|
3
|
+
#### Props for 3-Input Pattern:
|
|
4
|
+
|
|
5
|
+
- `controls_start_id` - ID of the start DatePicker to sync with
|
|
6
|
+
- `controls_end_id` - ID of the end DatePicker to sync with
|
|
7
|
+
|
|
8
|
+
#### DatePicker Props:
|
|
9
|
+
|
|
10
|
+
- `sync_start_with` - ID of the dropdown to clear when start date changes
|
|
11
|
+
- `sync_end_with` - ID of the dropdown to clear when end date changes
|
|
12
|
+
|
|
13
|
+
This pattern allows users to quickly select common date ranges or manually pick specific dates.
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
%>
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
<%= pb_rails("dropdown", props: {options: options}) do %>
|
|
50
|
+
<%= pb_rails("dropdown", props: {id: "user-dropdown", options: options}) do %>
|
|
51
51
|
<%= pb_rails("dropdown/dropdown_trigger", props: {placeholder: "Select a User", custom_display: custom_display}) %>
|
|
52
52
|
<%= pb_rails("dropdown/dropdown_container") do %>
|
|
53
53
|
<% options.each do |option| %>
|
|
@@ -71,6 +71,8 @@
|
|
|
71
71
|
|
|
72
72
|
<script>
|
|
73
73
|
document.addEventListener("pb:dropdown:selected", (e) => {
|
|
74
|
+
if (e.target.id !== "user-dropdown") return;
|
|
75
|
+
|
|
74
76
|
const option = e.detail;
|
|
75
77
|
const dropdown = e.target;
|
|
76
78
|
|
|
@@ -22,6 +22,12 @@ examples:
|
|
|
22
22
|
- dropdown_multi_select_with_default: Multi Select Default Value
|
|
23
23
|
- dropdown_blank_selection: Blank Selection
|
|
24
24
|
- dropdown_separators_hidden: Separators Hidden
|
|
25
|
+
- dropdown_quickpick_rails: Quick Pick Variant
|
|
26
|
+
- dropdown_quickpick_range_end_rails: Quick Pick Variant (Range Ends Today)
|
|
27
|
+
- dropdown_quickpick_default_dates: Quick Pick Variant (Default Dates)
|
|
28
|
+
- dropdown_quickpick_custom_rails: Quick Pick Variant (Custom Quick Pick Dates)
|
|
29
|
+
- dropdown_quickpick_with_date_pickers_rails: Quick Pick with Date Pickers
|
|
30
|
+
- dropdown_quickpick_with_date_pickers_default_rails: Quick Pick with Date Pickers (Default Value)
|
|
25
31
|
|
|
26
32
|
react:
|
|
27
33
|
- dropdown_default: Default
|
|
@@ -52,6 +58,7 @@ examples:
|
|
|
52
58
|
- dropdown_quickpick: Quick Pick Variant
|
|
53
59
|
- dropdown_quickpick_range_end: Quick Pick Variant (Range Ends Today)
|
|
54
60
|
- dropdown_quickpick_default_dates: Quick Pick Variant (Default Dates)
|
|
61
|
+
- dropdown_quickpick_custom: Quick Pick Variant (Custom Quick Pick Dates)
|
|
55
62
|
- dropdown_quickpick_with_date_pickers: Quick Pick Variant with Date Pickers
|
|
56
63
|
|
|
57
64
|
|
|
@@ -26,4 +26,5 @@ export {default as DropdownWithCustomActiveStyleOptions} from './_dropdown_with_
|
|
|
26
26
|
export { default as DropdownQuickpick } from './_dropdown_quickpick.jsx'
|
|
27
27
|
export { default as DropdownQuickpickRangeEnd } from './_dropdown_quickpick_range_end.jsx'
|
|
28
28
|
export { default as DropdownQuickpickDefaultDates } from './_dropdown_quickpick_default_dates.jsx'
|
|
29
|
-
export { default as DropdownQuickpickWithDatePickers } from './_dropdown_quickpick_with_date_pickers.jsx'
|
|
29
|
+
export { default as DropdownQuickpickWithDatePickers } from './_dropdown_quickpick_with_date_pickers.jsx'
|
|
30
|
+
export { default as DropdownQuickpickCustom } from './_dropdown_quickpick_custom.jsx'
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<%= form.star_rating_field :example_star_rating, props: { variant: "interactive", label: true } %>
|
|
117
117
|
<%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true } %>
|
|
118
118
|
<%= form.multi_level_select :example_multi_level_select, props: { id: "multi-level-select-form-default", tree_data: treeData, margin_bottom: "sm", label: "Example Multi Level Select field" } %>
|
|
119
|
-
|
|
119
|
+
<%= form.time_picker :example_time_picker, props: { label: true } %>
|
|
120
120
|
<%= form.actions do |action| %>
|
|
121
121
|
<%= action.submit %>
|
|
122
122
|
<%= action.button props: { type: "reset", text: "Cancel", variant: "secondary" } %>
|
|
@@ -117,7 +117,8 @@
|
|
|
117
117
|
<%= form.star_rating_field :example_star_rating_validation, props: { variant: "interactive", label: true, required: true } %>
|
|
118
118
|
<%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true, blank_selection: "Select a Time Zone...", required: true } %>
|
|
119
119
|
<%= form.multi_level_select :example_multi_level_select, props: { id: "multi-level-select-form", tree_data: treeData, margin_bottom: "sm", required: true, label: "Example Multi Level Select field" } %>
|
|
120
|
-
|
|
120
|
+
<%= form.time_picker :example_time_picker_validation, props: { label: true, required: true, validation_message: "Please select a time." } %>
|
|
121
|
+
|
|
121
122
|
<%= form.actions do |action| %>
|
|
122
123
|
<%= action.submit %>
|
|
123
124
|
<%= action.button props: { type: "reset", text: "Cancel", variant: "secondary" } %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<%= pb_form_with(scope: :example, url: "", method: :get, validate: true) do |form| %>
|
|
2
|
+
<%= form.text_field :example_text_field, props: { label: true, required: true, required_indicator: true } %>
|
|
3
|
+
<%= form.text_field :example_text_field_2, props: { label: "Text Field Custom Label", required: true, required_indicator: true } %>
|
|
4
|
+
<%= form.email_field :example_email_field, props: { label: true, required: true, required_indicator: true } %>
|
|
5
|
+
<%= form.number_field :example_number_field, props: { label: true, required: true, required_indicator: true } %>
|
|
6
|
+
<%= form.search_field :example_search_field, props: { label: true, required: true, required_indicator: true } %>
|
|
7
|
+
<%= form.password_field :example_password_field, props: { label: true, required: true, required_indicator: true } %>
|
|
8
|
+
<%= form.url_field :example_url_field, props: { label: true, required: true, required_indicator: true } %>
|
|
9
|
+
|
|
10
|
+
<%= form.actions do |action| %>
|
|
11
|
+
<%= action.submit %>
|
|
12
|
+
<%= action.button props: { type: "reset", text: "Cancel", variant: "secondary" } %>
|
|
13
|
+
<% end %>
|
|
14
|
+
<% end %>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
The `required_indicator` prop adds a red asterisk (*) to the input label, visually marking the field as required. This works with both `label: true` for auto-generated labels and `label: "Custom Text"` for custom labels.
|
|
2
|
+
|
|
3
|
+
While it's typically used alongside the `required` prop for HTML5 validation, you can use `required_indicator` independently if you're handling validation differently (e.g., client-side or backend validation).
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
tooltip_id: "append-to-tooltip-2",
|
|
40
40
|
offset: true,
|
|
41
41
|
position: "top",
|
|
42
|
-
append_to: ".
|
|
42
|
+
append_to: ".pb--page--sideNav",
|
|
43
43
|
}) do %>
|
|
44
|
-
I'm a popover. I have been appended to the .
|
|
44
|
+
I'm a popover. I have been appended to the .pb--page--sideNav.
|
|
45
45
|
<% end %>
|
|
46
46
|
<% end %>
|
|
@@ -54,14 +54,15 @@ const PopoverAppendTo = (props) => {
|
|
|
54
54
|
<Body text="Click info for more details" />
|
|
55
55
|
|
|
56
56
|
<PbReactPopover
|
|
57
|
-
appendTo=".
|
|
57
|
+
appendTo=".pb--page--sideNav"
|
|
58
58
|
offset
|
|
59
59
|
placement="top"
|
|
60
60
|
reference={selectorPopoverReference}
|
|
61
61
|
show={showSelectorPopover}
|
|
62
|
+
zIndex={10}
|
|
62
63
|
{...props}
|
|
63
64
|
>
|
|
64
|
-
{'I\'m a popover. I have been appended to the .
|
|
65
|
+
{'I\'m a popover. I have been appended to the .pb--page--sideNav.'}
|
|
65
66
|
</PbReactPopover>
|
|
66
67
|
</Flex>
|
|
67
68
|
</>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Error shows that the radio option must be selected or is invalid (
|
|
1
|
+
Error shows that the radio option must be selected or is invalid (i.e. when used in a form it signals a user to fix an error).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Select w/ Error shows that
|
|
1
|
+
Select w/ Error shows that an option must be selected or is invalid (i.e. when used in a form it signals a user to fix an error).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%= pb_rails("select", props: {
|
|
2
|
+
label: "Favorite Food",
|
|
3
|
+
name: "favorite_food",
|
|
4
|
+
options: [
|
|
5
|
+
{ value: "pizza", value_text: "Pizza" },
|
|
6
|
+
{ value: "tacos", value_text: "Tacos" },
|
|
7
|
+
{ value: "sushi", value_text: "Sushi" }
|
|
8
|
+
],
|
|
9
|
+
input_options: {
|
|
10
|
+
'aria-label': "Select your favorite food",
|
|
11
|
+
class: "custom-select-class",
|
|
12
|
+
data: { controller: "search", action: "change->search#filter" },
|
|
13
|
+
id: "favorite-food-select"
|
|
14
|
+
}
|
|
15
|
+
}) %>
|
|
16
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import Select from '../_select'
|
|
4
|
+
|
|
5
|
+
const SelectInputOptions = (props) => {
|
|
6
|
+
const options = [
|
|
7
|
+
{ value: 'pizza', text: 'Pizza' },
|
|
8
|
+
{ value: 'tacos', text: 'Tacos' },
|
|
9
|
+
{ value: 'sushi', text: 'Sushi' },
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<Select
|
|
15
|
+
inputOptions={{
|
|
16
|
+
'aria-label': 'Select your favorite food',
|
|
17
|
+
className: 'custom-select-class',
|
|
18
|
+
id: 'favorite-food-select',
|
|
19
|
+
}}
|
|
20
|
+
label="Favorite Food"
|
|
21
|
+
name="favorite_food"
|
|
22
|
+
options={options}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
</>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default SelectInputOptions
|
|
30
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Use the `input_options` / `inputOptions` prop to pass additional attributes directly to the underlying `<select>` element instead of the outer wrapper. This is useful for applying data attributes, custom IDs, or other HTML attributes that need to be on the select element itself.
|
|
@@ -15,6 +15,7 @@ examples:
|
|
|
15
15
|
- select_inline_compact: Select Inline Compact
|
|
16
16
|
- select_attributes: Select W/ Attributes
|
|
17
17
|
- select_multiple: Select Multiple
|
|
18
|
+
- select_input_options: Input Options
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
|
|
@@ -33,6 +34,7 @@ examples:
|
|
|
33
34
|
- select_inline_compact: Select Inline Compact
|
|
34
35
|
- select_multiple: Select Multiple
|
|
35
36
|
- select_react_hook: React Hook
|
|
37
|
+
- select_input_options: Input Options
|
|
36
38
|
|
|
37
39
|
swift:
|
|
38
40
|
- select_default_swift: Default
|
|
@@ -12,3 +12,4 @@ export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
|
|
|
12
12
|
export { default as SelectMultiple } from './_select_multiple.jsx'
|
|
13
13
|
export { default as SelectReactHook } from './_select_react_hook.jsx'
|
|
14
14
|
export { default as SelectCustomSelectSubheaders } from './_select_custom_select_subheaders.jsx'
|
|
15
|
+
export { default as SelectInputOptions } from './_select_input_options.jsx'
|