playbook_ui 14.23.0 → 14.24.0.pre.alpha.PLAY2116datepickercursorfix9610
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/_playbook.scss +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +7 -6
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +24 -25
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +10 -10
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +11 -13
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +7 -4
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +112 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +13 -7
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +14 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +90 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +16 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.html.erb +43 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +64 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +60 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.jsx +57 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.html.erb +46 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_rails.md +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.jsx +55 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.jsx +80 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +107 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb +51 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +9 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +4 -11
- data/app/pb_kits/playbook/pb_advanced_table/index.js +108 -125
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +7 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +7 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +46 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +13 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +24 -5
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.md +1 -1
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +12 -1
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +2 -1
- data/app/pb_kits/playbook/pb_checkbox/index.js +218 -26
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +1 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +10 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +2 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.html.erb +24 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.md +3 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_date/_date.tsx +5 -3
- data/app/pb_kits/playbook/pb_date/date.html.erb +6 -6
- data/app/pb_kits/playbook/pb_date/date.rb +2 -0
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.jsx +17 -0
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_date/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_date/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +19 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.jsx +1 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +17 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +6 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown_mixin.scss +36 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options.jsx +90 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options_react.md +4 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +3 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +24 -0
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +11 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +2 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.html.erb +22 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx +43 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md +1 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +2 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +1 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +6 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_description.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.jsx +32 -15
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors_react.md +2 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +35 -9
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex_react.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.jsx +26 -14
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_disable_animation.jsx +32 -15
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.jsx +45 -17
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.jsx +59 -22
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx +40 -9
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx +50 -18
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx +31 -18
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.jsx +34 -17
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.jsx +64 -23
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units_react.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +7 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_description.md +1 -3
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.jsx +36 -17
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors_react.md +3 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_default.jsx +31 -16
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +63 -31
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.md +3 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend.jsx +35 -16
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.jsx +41 -16
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.jsx +107 -62
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.md +4 -7
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +16 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +18 -9
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +3 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.html.erb +75 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.jsx +94 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +3 -0
- data/app/pb_kits/playbook/pb_pagination/_pagination.test.jsx +212 -0
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +12 -1
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_rails.md +3 -1
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +3 -1
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control.jsx +112 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control_react.md +3 -0
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +14 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.html.erb +10 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.jsx +26 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.md +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
- data/app/pb_kits/playbook/pb_select/select.rb +4 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +49 -1
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +15 -0
- data/dist/chunks/_line_graph-Bs1q77QJ.js +1 -0
- data/dist/chunks/_typeahead-DDDKDPZS.js +6 -0
- data/dist/chunks/_weekday_stacked-DkFv7FEh.js +37 -0
- data/dist/chunks/lib-CY5ZPzic.js +29 -0
- data/dist/chunks/{pb_form_validation-B7kuYG-_.js → pb_form_validation-D3b0JKHH.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +4 -11
- data/dist/playbook-doc.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +53 -26
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +0 -30
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +0 -52
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.scss +0 -0
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +0 -202
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_continuous.jsx +0 -69
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_default.jsx +0 -71
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_multi_beacon.jsx +0 -110
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_beacon.jsx +0 -76
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_overlay.jsx +0 -76
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_styled.jsx +0 -76
- data/app/pb_kits/playbook/pb_walkthrough/docs/example.yml +0 -10
- data/app/pb_kits/playbook/pb_walkthrough/docs/index.js +0 -6
- data/app/pb_kits/playbook/pb_walkthrough/walkthrough.test.jsx +0 -34
- data/dist/chunks/_circle_chart-D01WLw-z.js +0 -1
- data/dist/chunks/_typeahead-mrBE9f17.js +0 -22
- data/dist/chunks/_weekday_stacked-_LSSbN1y.js +0 -45
- data/dist/chunks/lib-CHh_1-Oj.js +0 -29
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_row_styling.md → _advanced_table_row_styling_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_gauge/docs/{_gauge_colors.md → _gauge_colors_rails.md} +0 -0
- /data/app/pb_kits/playbook/pb_gauge/docs/{_gauge_complex.md → _gauge_complex_rails.md} +0 -0
- /data/app/pb_kits/playbook/pb_line_graph/docs/{_line_graph_colors.md → _line_graph_colors_rails.md} +0 -0
@@ -13,8 +13,8 @@
|
|
13
13
|
<% end %>
|
14
14
|
|
15
15
|
<!-- month day, year -->
|
16
|
-
<%# if not current year %>
|
17
|
-
<% if object.year.to_s == DateTime.now.year.to_s %>
|
16
|
+
<%# if not current year or show_current_year is false %>
|
17
|
+
<% if object.year.to_s == DateTime.now.year.to_s && !object.show_current_year %>
|
18
18
|
<span><%= "#{object.month} #{object.day}" %></span>
|
19
19
|
<%# if is current year %>
|
20
20
|
<% else %>
|
@@ -44,8 +44,8 @@
|
|
44
44
|
|
45
45
|
<!-- month day, year -->
|
46
46
|
|
47
|
-
<%# if not current year %>
|
48
|
-
<% if object.year.to_s == DateTime.now.year.to_s %>
|
47
|
+
<%# if not current year or show_current_year is false %>
|
48
|
+
<% if object.year.to_s == DateTime.now.year.to_s && !object.show_current_year %>
|
49
49
|
<%= pb_rails("title", props: { tag: "div", text: "#{object.month} #{object.day}", size: 4 }) %>
|
50
50
|
<%# if is current year %>
|
51
51
|
<% else %>
|
@@ -74,8 +74,8 @@
|
|
74
74
|
|
75
75
|
<!-- month day, year -->
|
76
76
|
|
77
|
-
<%# if not current year %>
|
78
|
-
<% if object.year.to_s == DateTime.now.year.to_s %>
|
77
|
+
<%# if not current year or show_current_year is false %>
|
78
|
+
<% if object.year.to_s == DateTime.now.year.to_s && !object.show_current_year %>
|
79
79
|
<%= pb_rails("caption", props: { tag: "span", text: "#{object.month} #{object.day}" }) %>
|
80
80
|
<%# if is current year %>
|
81
81
|
<% else %>
|
@@ -11,6 +11,8 @@ module Playbook
|
|
11
11
|
default: false
|
12
12
|
prop :show_day_of_week, type: Playbook::Props::Boolean,
|
13
13
|
default: false
|
14
|
+
prop :show_current_year, type: Playbook::Props::Boolean,
|
15
|
+
default: false
|
14
16
|
prop :size, type: Playbook::Props::Enum,
|
15
17
|
values: %w[lg md sm xs],
|
16
18
|
default: "md"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import FormattedDate from '../../pb_date/_date'
|
4
|
+
|
5
|
+
const DateWithShowCurrentYear = (props) => {
|
6
|
+
return (
|
7
|
+
<>
|
8
|
+
<FormattedDate
|
9
|
+
showCurrentYear
|
10
|
+
value={new Date()}
|
11
|
+
{...props}
|
12
|
+
/>
|
13
|
+
</>
|
14
|
+
)
|
15
|
+
}
|
16
|
+
|
17
|
+
export default DateWithShowCurrentYear
|
@@ -0,0 +1 @@
|
|
1
|
+
By default, the Date kit does NOT display the year if it is the current year. If you want to display the current year you can do so by setting `showCurrentYear`/`show_current_year` to true as shown here.
|
@@ -5,12 +5,14 @@ examples:
|
|
5
5
|
- date_variants: Variants
|
6
6
|
- date_alignment: Alignment
|
7
7
|
- date_timezone: Timezones
|
8
|
+
- date_with_show_current_year: Show Current Year
|
8
9
|
- date_unstyled: Unstyled
|
9
10
|
|
10
11
|
react:
|
11
12
|
- date_default: Default
|
12
13
|
- date_variants: Variants
|
13
14
|
- date_alignment: Alignment
|
15
|
+
- date_with_show_current_year: Show Current Year
|
14
16
|
- date_unstyled: Unstyled
|
15
17
|
|
16
18
|
swift:
|
@@ -2,3 +2,4 @@ export { default as DateDefault } from './_date_default.jsx'
|
|
2
2
|
export { default as DateVariants } from './_date_variants.jsx'
|
3
3
|
export { default as DateAlignment } from './_date_alignment.jsx'
|
4
4
|
export { default as DateUnstyled } from './_date_unstyled.jsx'
|
5
|
+
export { default as DateWithShowCurrentYear } from './_date_with_show_current_year.jsx'
|
@@ -4,6 +4,7 @@ import classnames from 'classnames'
|
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
5
5
|
import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps'
|
6
6
|
import { getAllIcons } from "../utilities/icons/allicons"
|
7
|
+
import { camelToSnakeCase } from '../utilities/text'
|
7
8
|
|
8
9
|
import datePickerHelper from './date_picker_helper'
|
9
10
|
import Icon from '../pb_icon/_icon'
|
@@ -114,6 +115,20 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
114
115
|
const inputAriaProps = buildAriaProps(inputAria)
|
115
116
|
const inputDataProps = buildDataProps(inputData)
|
116
117
|
|
118
|
+
// Convert cursor prop to CSS-style format to apply to input tag below
|
119
|
+
const getCursorStyle = (cursor?: string): string => {
|
120
|
+
// If input is disabled, always use 'not-allowed'
|
121
|
+
if (disableInput) return 'not-allowed'
|
122
|
+
|
123
|
+
// If cursor prop is provided, convert it to styling format
|
124
|
+
if (cursor) {
|
125
|
+
return camelToSnakeCase(cursor).replace(/_/g, '-')
|
126
|
+
}
|
127
|
+
|
128
|
+
// Default to 'pointer'
|
129
|
+
return 'pointer'
|
130
|
+
}
|
131
|
+
|
117
132
|
useEffect(() => {
|
118
133
|
datePickerHelper({
|
119
134
|
allowInput,
|
@@ -149,6 +164,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
149
164
|
required: false,
|
150
165
|
}, scrollContainer)
|
151
166
|
}, initializeOnce ? [] : undefined)
|
167
|
+
|
152
168
|
const filteredProps = {...props}
|
153
169
|
if (filteredProps.marginBottom === undefined) {
|
154
170
|
filteredProps.marginBottom = "sm"
|
@@ -163,6 +179,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
163
179
|
error ? 'error' : null,
|
164
180
|
className
|
165
181
|
)
|
182
|
+
|
166
183
|
const iconWrapperClass = () => {
|
167
184
|
let base = 'cal_icon_wrapper'
|
168
185
|
if (dark) {
|
@@ -176,6 +193,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
176
193
|
}
|
177
194
|
return base
|
178
195
|
}
|
196
|
+
|
179
197
|
const angleDown = getAllIcons()["angleDown"].icon as unknown as { [key: string]: SVGElement }
|
180
198
|
|
181
199
|
return (
|
@@ -206,6 +224,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
206
224
|
name={name}
|
207
225
|
onChange={inputOnChange}
|
208
226
|
placeholder={placeholder}
|
227
|
+
style={{ cursor: getCursorStyle(filteredProps.cursor) }}
|
209
228
|
value={inputValue}
|
210
229
|
/>
|
211
230
|
|
@@ -1 +1 @@
|
|
1
|
-
<%= pb_rails("date_picker", props: { picker_id: "date-picker-default"}) %>
|
1
|
+
<%= pb_rails("date_picker", props: { cursor: "notAllowed", picker_id: "date-picker-default"}) %>
|
@@ -8,6 +8,7 @@
|
|
8
8
|
@import "../pb_textarea/textarea_mixin";
|
9
9
|
|
10
10
|
@import "./scss_partials/dropdown_animation";
|
11
|
+
@import "dropdown_mixin";
|
11
12
|
|
12
13
|
[class*="pb_dropdown"] {
|
13
14
|
.dropdown_wrapper {
|
@@ -98,9 +99,23 @@
|
|
98
99
|
[class^="pb_title_kit"], a {
|
99
100
|
color: $white !important;
|
100
101
|
}
|
102
|
+
border-bottom: 1px solid $border_light;
|
101
103
|
&:hover {
|
102
|
-
background-color: $product_1_background
|
104
|
+
background-color: $product_1_background;
|
105
|
+
}
|
106
|
+
|
107
|
+
// activeStyle font color map
|
108
|
+
@each $name, $color in $font-colors {
|
109
|
+
&.font-#{$name} {
|
110
|
+
@include apply-font-color($color);
|
111
|
+
}
|
103
112
|
}
|
113
|
+
// activeStyle background color map (no difference between selected and selected+hover custom colors)
|
114
|
+
@each $name, $bg in $background-colors {
|
115
|
+
&.bg-#{$name} {
|
116
|
+
background-color: $bg;
|
117
|
+
}
|
118
|
+
}
|
104
119
|
}
|
105
120
|
}
|
106
121
|
|
@@ -267,6 +282,7 @@
|
|
267
282
|
}
|
268
283
|
&[class*="selected"] {
|
269
284
|
background-color: $primary;
|
285
|
+
border-bottom: rgba($white, 0.15);
|
270
286
|
}
|
271
287
|
}
|
272
288
|
}
|
@@ -39,6 +39,10 @@ type DropdownProps = {
|
|
39
39
|
options: GenericObject;
|
40
40
|
separators?: boolean;
|
41
41
|
variant?: "default" | "subtle";
|
42
|
+
activeStyle?: {
|
43
|
+
backgroundColor?: string;
|
44
|
+
fontColor?: string;
|
45
|
+
};
|
42
46
|
};
|
43
47
|
|
44
48
|
interface DropdownComponent
|
@@ -69,6 +73,7 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
69
73
|
options,
|
70
74
|
separators = true,
|
71
75
|
variant = "default",
|
76
|
+
activeStyle,
|
72
77
|
} = props;
|
73
78
|
|
74
79
|
const ariaProps = buildAriaProps(aria);
|
@@ -251,6 +256,7 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
251
256
|
>
|
252
257
|
<DropdownContext.Provider
|
253
258
|
value={{
|
259
|
+
activeStyle,
|
254
260
|
autocomplete,
|
255
261
|
dropdownContainerRef,
|
256
262
|
filteredOptions,
|
@@ -0,0 +1,36 @@
|
|
1
|
+
@import "../tokens/colors";
|
2
|
+
|
3
|
+
// activeStyle fontColor sass map to go through text colors + set of custom colors
|
4
|
+
$custom-font-colors: (
|
5
|
+
primary: $primary
|
6
|
+
);
|
7
|
+
|
8
|
+
$merged-font-colors: map-merge($text_colors, $custom-font-colors);
|
9
|
+
|
10
|
+
$font-colors: ();
|
11
|
+
|
12
|
+
@each $key, $val in $merged-font-colors {
|
13
|
+
$font-colors: map-merge($font-colors, ($key: $val));
|
14
|
+
}
|
15
|
+
|
16
|
+
@mixin apply-font-color($color) {
|
17
|
+
color: $color;
|
18
|
+
|
19
|
+
[class^="pb_body"],
|
20
|
+
[class^="pb_title_kit"],
|
21
|
+
a {
|
22
|
+
color: $color !important;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
// activeStyle backgroundColor map (set of custom colors)
|
27
|
+
$custom-background-colors: (
|
28
|
+
"bg_light": $bg_light,
|
29
|
+
"white": $white,
|
30
|
+
);
|
31
|
+
|
32
|
+
$background-colors: ();
|
33
|
+
|
34
|
+
@each $key, $val in $custom-background-colors {
|
35
|
+
$background-colors: map-merge($background-colors, ($key: $val));
|
36
|
+
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import Dropdown from '../_dropdown'
|
3
|
+
|
4
|
+
const DropdownCustomActiveStyleOptions = (props) => {
|
5
|
+
|
6
|
+
|
7
|
+
const options = [
|
8
|
+
{
|
9
|
+
label: "United States",
|
10
|
+
value: "unitedStates",
|
11
|
+
id: "us"
|
12
|
+
},
|
13
|
+
{
|
14
|
+
label: "Canada",
|
15
|
+
value: "canada",
|
16
|
+
id: "ca"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
label: "Pakistan",
|
20
|
+
value: "pakistan",
|
21
|
+
id: "pk"
|
22
|
+
}
|
23
|
+
];
|
24
|
+
|
25
|
+
|
26
|
+
return (
|
27
|
+
<div>
|
28
|
+
<Dropdown
|
29
|
+
activeStyle={{
|
30
|
+
backgroundColor: "bg_light",
|
31
|
+
fontColor: "primary",
|
32
|
+
}}
|
33
|
+
label="Background Color: bg_light; Font Color: primary"
|
34
|
+
marginBottom="sm"
|
35
|
+
options={options}
|
36
|
+
{...props}
|
37
|
+
>
|
38
|
+
<Dropdown.Trigger/>
|
39
|
+
<Dropdown.Container>
|
40
|
+
{options.map((option) => (
|
41
|
+
<Dropdown.Option key={option.id}
|
42
|
+
option={option}
|
43
|
+
/>
|
44
|
+
))}
|
45
|
+
</Dropdown.Container>
|
46
|
+
</Dropdown>
|
47
|
+
<Dropdown
|
48
|
+
activeStyle={{
|
49
|
+
backgroundColor: "white",
|
50
|
+
fontColor: "primary",
|
51
|
+
}}
|
52
|
+
label="Background Color: white; Font Color: primary"
|
53
|
+
marginBottom="sm"
|
54
|
+
options={options}
|
55
|
+
{...props}
|
56
|
+
/>
|
57
|
+
<Dropdown
|
58
|
+
activeStyle={{
|
59
|
+
backgroundColor: "bg_light",
|
60
|
+
fontColor: "text_lt_default",
|
61
|
+
}}
|
62
|
+
autocomplete
|
63
|
+
label="Background Color: bg_light; Font Color: text_lt_default"
|
64
|
+
marginBottom="sm"
|
65
|
+
options={options}
|
66
|
+
{...props}
|
67
|
+
/>
|
68
|
+
<Dropdown
|
69
|
+
activeStyle={{
|
70
|
+
fontColor: "text_lt_lighter",
|
71
|
+
}}
|
72
|
+
label="Font Color: text_lt_lighter"
|
73
|
+
marginBottom="sm"
|
74
|
+
options={options}
|
75
|
+
{...props}
|
76
|
+
>
|
77
|
+
<Dropdown.Trigger/>
|
78
|
+
<Dropdown.Container>
|
79
|
+
{options.map((option) => (
|
80
|
+
<Dropdown.Option key={option.id}
|
81
|
+
option={option}
|
82
|
+
/>
|
83
|
+
))}
|
84
|
+
</Dropdown.Container>
|
85
|
+
</Dropdown>
|
86
|
+
</div>
|
87
|
+
)
|
88
|
+
}
|
89
|
+
|
90
|
+
export default DropdownCustomActiveStyleOptions
|
data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options_react.md
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
The `activeStyle` prop can be used to customize the appearance of the dropdown selection indicator. It accepts an object with the following keys: `backgroundColor` sets the background color of the selected item (and its hover state); `fontColor` sets the font color of the selected item.
|
2
|
+
|
3
|
+
`backgroundColor` **Type**: String | **Values**: bg_light | white | **Default**: (no selection) is primary
|
4
|
+
`fontColor` **Type**: String | **Values**: primary | all [Playbook Text Colors](https://playbook.powerapp.cloud/visual_guidelines/colors) | **Default**: (no selection) is white
|
@@ -18,6 +18,7 @@ const DropdownCustomRadioOptions = (props) => {
|
|
18
18
|
return (
|
19
19
|
<div>
|
20
20
|
<Dropdown
|
21
|
+
activeStyle={{ backgroundColor: "bg_light", fontColor: "text_lt_default" }}
|
21
22
|
label="Select Item"
|
22
23
|
onSelect={(selectedItem) => setSelectedValue(selectedItem?.value)}
|
23
24
|
options={options}
|
@@ -1 +1 @@
|
|
1
|
-
Radio inputs can be used inside `Dropdown.Option` for a custom layout that mimics form-like selection within a dropdown.
|
1
|
+
Radio inputs can be used inside `Dropdown.Option` for a custom layout that mimics form-like selection within a dropdown. Use the [activeStyle](https://playbook.powerapp.cloud/kits/dropdown/react#custom-active-style-options) `backgroundColor` and `fontColor` props to create contrast between the Radio selection indicator and the Dropdown selection background indicator.
|
@@ -16,7 +16,7 @@ examples:
|
|
16
16
|
- dropdown_with_search_rails: Custom Trigger Dropdown with Search
|
17
17
|
- dropdown_with_custom_padding: Custom Option Padding
|
18
18
|
- dropdown_with_custom_icon_options: Custom Icon Options
|
19
|
-
# - dropdown_with_custom_radio_options: Custom Radio Options # TODO: Update and publish doc ex in [PLAY-2146](https://runway.powerhrg.com/backlog_items/PLAY-2146) (remove this comment afterwards)
|
19
|
+
# - dropdown_with_custom_radio_options: Custom Radio Options # TODO: Update and publish doc ex in the Rails follow up to [PLAY-2146](https://runway.powerhrg.com/backlog_items/PLAY-2146) (remove this comment afterwards)
|
20
20
|
- dropdown_error: Dropdown with Error
|
21
21
|
- dropdown_default_value: Default Value
|
22
22
|
- dropdown_multi_select_with_default: Multi Select Default Value
|
@@ -39,8 +39,9 @@ examples:
|
|
39
39
|
- dropdown_with_custom_trigger: Custom Trigger
|
40
40
|
- dropdown_with_search: Custom Trigger Dropdown with Search
|
41
41
|
- dropdown_with_custom_padding: Custom Option Padding
|
42
|
+
- dropdown_with_custom_active_style_options: Custom Active Style Options
|
42
43
|
- dropdown_with_custom_icon_options: Custom Icon Options
|
43
|
-
|
44
|
+
- dropdown_with_custom_radio_options: Custom Radio Options
|
44
45
|
- dropdown_error: Dropdown with Error
|
45
46
|
- dropdown_default_value: Default Value
|
46
47
|
- dropdown_multi_select_with_default: Multi Select Default Value
|
@@ -21,4 +21,5 @@ export { default as DropdownMultiSelectWithAutocomplete } from './_dropdown_mult
|
|
21
21
|
export { default as DropdownMultiSelectWithDefault } from './_dropdown_multi_select_with_default.jsx'
|
22
22
|
export { default as DropdownMultiSelectWithCustomOptions } from './_dropdown_multi_select_with_custom_options.jsx'
|
23
23
|
export {default as DropdownWithCustomIconOptions} from './_dropdown_with_custom_icon_options.jsx'
|
24
|
-
export {default as DropdownWithCustomRadioOptions} from './_dropdown_with_custom_radio_options.jsx'
|
24
|
+
export {default as DropdownWithCustomRadioOptions} from './_dropdown_with_custom_radio_options.jsx'
|
25
|
+
export {default as DropdownWithCustomActiveStyleOptions} from './_dropdown_with_custom_active_style_options.jsx'
|
@@ -369,4 +369,28 @@ test("defaultValue works with multiSelect", () => {
|
|
369
369
|
const option2 = Array.from(kit.querySelectorAll(".pb_dropdown_option_list"));
|
370
370
|
const firstOpt = options[0].label
|
371
371
|
expect(option2[0]).not.toHaveTextContent(firstOpt)
|
372
|
+
})
|
373
|
+
|
374
|
+
test("applies activeStyle backgroundColor and fontColor when selected", () => {
|
375
|
+
render(
|
376
|
+
<Dropdown
|
377
|
+
activeStyle={{
|
378
|
+
backgroundColor: "bg_light",
|
379
|
+
fontColor: "primary",
|
380
|
+
}}
|
381
|
+
data={{ testid: testId }}
|
382
|
+
options={options}
|
383
|
+
/>
|
384
|
+
)
|
385
|
+
|
386
|
+
const kit = screen.getByTestId(testId)
|
387
|
+
const option = kit.querySelectorAll(".pb_dropdown_option_list")[1]
|
388
|
+
|
389
|
+
fireEvent.click(option)
|
390
|
+
|
391
|
+
const selected = kit.querySelector(".pb_dropdown_option_selected")
|
392
|
+
|
393
|
+
expect(selected).toBeInTheDocument()
|
394
|
+
expect(selected).toHaveClass("bg-bg_light")
|
395
|
+
expect(selected).toHaveClass("font-primary")
|
372
396
|
})
|
@@ -41,6 +41,7 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
41
41
|
} = props;
|
42
42
|
|
43
43
|
const {
|
44
|
+
activeStyle,
|
44
45
|
filteredOptions,
|
45
46
|
filterItem,
|
46
47
|
focusedOptionIndex,
|
@@ -59,7 +60,6 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
59
60
|
? selected.some((item) => item.label === option?.label)
|
60
61
|
: (selected as GenericObject)?.label === option?.label;
|
61
62
|
|
62
|
-
|
63
63
|
if (!isItemMatchingFilter(option) || (multiSelect && isSelected)) {
|
64
64
|
return null;
|
65
65
|
}
|
@@ -70,6 +70,14 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
70
70
|
|
71
71
|
const selectedClass = isSelected ? "selected" : "list";
|
72
72
|
|
73
|
+
|
74
|
+
const bgTokenClass = activeStyle?.backgroundColor
|
75
|
+
? `bg-${activeStyle.backgroundColor}`
|
76
|
+
: "";
|
77
|
+
const fontTokenClass = activeStyle?.fontColor
|
78
|
+
? `font-${activeStyle.fontColor}`
|
79
|
+
: "";
|
80
|
+
|
73
81
|
const ariaProps = buildAriaProps(aria);
|
74
82
|
const dataProps = buildDataProps(data);
|
75
83
|
const htmlProps = buildHtmlProps(htmlOptions);
|
@@ -79,6 +87,8 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
79
87
|
selectedClass,
|
80
88
|
focusedClass,
|
81
89
|
),
|
90
|
+
bgTokenClass,
|
91
|
+
fontTokenClass,
|
82
92
|
globalProps(props),
|
83
93
|
className
|
84
94
|
);
|
@@ -52,7 +52,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
|
|
52
52
|
} = props;
|
53
53
|
|
54
54
|
const returnedIcon = icon || iconMap[status]
|
55
|
-
const iconClass = icon ? "custom_icon" : ""
|
55
|
+
const iconClass = icon && icon !== "none" ? "custom_icon" : ""
|
56
56
|
|
57
57
|
const css = classnames(
|
58
58
|
`pb_fixed_confirmation_toast_kit_${status}`,
|
@@ -92,7 +92,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
|
|
92
92
|
onClick={handleClick}
|
93
93
|
{...htmlProps}
|
94
94
|
>
|
95
|
-
{returnedIcon && (
|
95
|
+
{returnedIcon && icon !== "none" && (
|
96
96
|
<Icon
|
97
97
|
className="pb_icon"
|
98
98
|
fixedWidth
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= pb_rails("fixed_confirmation_toast", props: {
|
2
|
+
text: "Error Message",
|
3
|
+
status: "error",
|
4
|
+
icon: "none",
|
5
|
+
closeable: true
|
6
|
+
})%>
|
7
|
+
|
8
|
+
<br><br>
|
9
|
+
|
10
|
+
<%= pb_rails("fixed_confirmation_toast", props: {
|
11
|
+
text: "Items Successfully Moved",
|
12
|
+
status: "success",
|
13
|
+
icon: "none"
|
14
|
+
})%>
|
15
|
+
|
16
|
+
<br><br>
|
17
|
+
|
18
|
+
<%= pb_rails("fixed_confirmation_toast", props: {
|
19
|
+
text: "Scan to Assign Selected Items",
|
20
|
+
status: "neutral",
|
21
|
+
icon: "none"
|
22
|
+
})%>
|
data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import FixedConfirmationToast from '../_fixed_confirmation_toast'
|
4
|
+
|
5
|
+
const FixedConfirmationToastNoIcon = (props) => {
|
6
|
+
return (
|
7
|
+
<div>
|
8
|
+
<div>
|
9
|
+
<FixedConfirmationToast
|
10
|
+
closeable
|
11
|
+
icon="none"
|
12
|
+
status="error"
|
13
|
+
text="Error Message"
|
14
|
+
{...props}
|
15
|
+
/>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<br />
|
19
|
+
|
20
|
+
<div>
|
21
|
+
<FixedConfirmationToast
|
22
|
+
icon="none"
|
23
|
+
status="success"
|
24
|
+
text="Items Successfully Moved"
|
25
|
+
{...props}
|
26
|
+
/>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<br />
|
30
|
+
|
31
|
+
<div>
|
32
|
+
<FixedConfirmationToast
|
33
|
+
icon="none"
|
34
|
+
status="neutral"
|
35
|
+
text="Scan to Assign Selected Items"
|
36
|
+
{...props}
|
37
|
+
/>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
)
|
41
|
+
}
|
42
|
+
|
43
|
+
export default FixedConfirmationToastNoIcon
|
data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Setting `icon` prop to "none" will render the fixed confirmation toast without the left side icon.
|
@@ -8,6 +8,7 @@ examples:
|
|
8
8
|
- fixed_confirmation_toast_auto_close: Click to Show Auto Close
|
9
9
|
- fixed_confirmation_toast_children: Children
|
10
10
|
- fixed_confirmation_toast_custom_icon: Custom Icon
|
11
|
+
- fixed_confirmation_toast_no_icon: No Icon
|
11
12
|
|
12
13
|
react:
|
13
14
|
- fixed_confirmation_toast_default: Default
|
@@ -17,6 +18,7 @@ examples:
|
|
17
18
|
- fixed_confirmation_toast_auto_close: Click to Show Auto Close
|
18
19
|
- fixed_confirmation_toast_children: Children
|
19
20
|
- fixed_confirmation_toast_custom_icon: Custom Icon
|
21
|
+
- fixed_confirmation_toast_no_icon: No Icon
|
20
22
|
|
21
23
|
swift:
|
22
24
|
- fixed_confirmation_toast_default_swift: Default
|
@@ -5,3 +5,4 @@ export { default as FixedConfirmationToastPositions } from './_fixed_confirmatio
|
|
5
5
|
export { default as FixedConfirmationToastAutoClose } from './_fixed_confirmation_toast_auto_close.jsx'
|
6
6
|
export { default as FixedConfirmationToastChildren } from './_fixed_confirmation_toast_children.jsx'
|
7
7
|
export { default as FixedConfirmationToastCustomIcon } from './_fixed_confirmation_toast_custom_icon.jsx'
|
8
|
+
export { default as FixedConfirmationToastNoIcon } from './_fixed_confirmation_toast_no_icon.jsx'
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
+
<% if object.icon_value && object.icon_value != "none" %>
|
2
3
|
<%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true }) %>
|
3
|
-
|
4
|
+
<% end %>
|
4
5
|
<% if content %>
|
5
6
|
<%= content %>
|
6
7
|
<% elsif object.show_text? %>
|
@@ -56,6 +56,12 @@ test('renders custom icon when provided', () => {
|
|
56
56
|
expect(container.querySelector('.custom_icon')).toBeInTheDocument();
|
57
57
|
});
|
58
58
|
|
59
|
+
test("renders no icon when icon prop is 'none'", () => {
|
60
|
+
const { container } = render(<FixedConfirmationToast icon="none" />);
|
61
|
+
expect(container.querySelector('.pb_icon')).not.toBeInTheDocument();
|
62
|
+
expect(container.querySelector('.custom_icon')).not.toBeInTheDocument();
|
63
|
+
});
|
64
|
+
|
59
65
|
test('renders correctly with multiLine prop', () => {
|
60
66
|
const { container } = render(<FixedConfirmationToast multiLine />);
|
61
67
|
expect(container.querySelector('._multi_line')).toBeInTheDocument();
|
@@ -0,0 +1 @@
|
|
1
|
+
**Important Note for the React Kit**: In order to leverage this kit, you must install `highcharts` and `highcharts-react-official` into your project as shown below. To then apply Playbook styles to your Highchart, import gaugeTheme.ts from playbook-ui and merge it with your Highchart options. Then, pass the merged value to the options prop. Playbook’s styling will be applied automatically. See the examples in the documentation below.
|