playbook_ui 14.24.0.pre.alpha.PLAY2116datepickercursorfix9610 → 14.24.0.pre.alpha.PLAY2329atstickypinnedborderbug9340
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/Components/RegularTableView.tsx +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -56
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +1 -10
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +0 -2
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_date/_date.tsx +3 -5
- data/app/pb_kits/playbook/pb_date/date.html.erb +6 -6
- data/app/pb_kits/playbook/pb_date/date.rb +0 -2
- data/app/pb_kits/playbook/pb_date/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_date/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +0 -19
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +0 -1
- 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 +0 -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/example.yml +0 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +1 -2
- 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 +0 -6
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +1 -8
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +1 -11
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +0 -15
- data/dist/chunks/{_line_graph-Bs1q77QJ.js → _line_graph-D7DgMqnT.js} +1 -1
- data/dist/chunks/{_typeahead-DDDKDPZS.js → _typeahead-BzYZCpJO.js} +1 -1
- data/dist/chunks/{_weekday_stacked-DkFv7FEh.js → _weekday_stacked-CCn-qLh_.js} +3 -3
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +2 -2
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +5 -22
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.html.erb +0 -43
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +0 -64
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.jsx +0 -57
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.md +0 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.html.erb +0 -24
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.md +0 -3
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.html.erb +0 -4
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.jsx +0 -17
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.md +0 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.html.erb +0 -22
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx +0 -43
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md +0 -1
- data/app/pb_kits/playbook/pb_pagination/_pagination.test.jsx +0 -212
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control.jsx +0 -112
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control_react.md +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 919140b9c4ff4dc7d78c99c85d8508adf99998960f68df763353d404442a0e2e
|
4
|
+
data.tar.gz: d026678b39843a9e6a879af6704b21ba3d5fdb5eca6dc26f3d12392f637b5dfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d555ca3b3ea695c9c62ff5df638564bac4a1b209e00b5850412be03d3ee120c7dfdb8fbac8ea4a7c4dc7d6805c8538152f89060b238df8718ae84c1940a3e65
|
7
|
+
data.tar.gz: db38867f8c5f8864c1bca8cc000638caffd7c9a2a93a4cb44f6ed71daebfaa72fdc4c0284d0ef46764af54e15fb5449a91030e01efc1af78f652496f0f98ab92
|
@@ -58,9 +58,7 @@ const TableCellRenderer = ({
|
|
58
58
|
// Find the “owning” colDefinition by accessor. Needed for multi column logic
|
59
59
|
const colDef = findColumnDefByAccessor(columnDefinitions ?? [], column.id)
|
60
60
|
const cellAlignment = colDef?.columnStyling?.cellAlignment ?? "right"
|
61
|
-
|
62
|
-
const paddingClass = paddingValue ? `p_${paddingValue}` : undefined
|
63
|
-
|
61
|
+
|
64
62
|
return (
|
65
63
|
<td
|
66
64
|
align={cellAlignment}
|
@@ -70,7 +68,6 @@ const TableCellRenderer = ({
|
|
70
68
|
isPinnedLeft && 'pinned-left',
|
71
69
|
stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft && 'sticky-left',
|
72
70
|
isLastCell && 'last-cell',
|
73
|
-
paddingClass
|
74
71
|
)}
|
75
72
|
key={`${cell.id}-data`}
|
76
73
|
style={{
|
@@ -113,6 +113,7 @@ export const TableHeaderCell = ({
|
|
113
113
|
return visibleSiblings.at(-1) === header.column;
|
114
114
|
})();
|
115
115
|
|
116
|
+
|
116
117
|
const cellClassName = classnames(
|
117
118
|
"table-header-cells",
|
118
119
|
`${showActionsBar && isActionBarVisible && "header-cells-with-actions"}`,
|
@@ -121,7 +122,7 @@ const cellClassName = classnames(
|
|
121
122
|
{ "pinned-left": responsive === "scroll" && isPinnedLeft },
|
122
123
|
isLastHeaderCell ? "last-header-cell" : "",
|
123
124
|
stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft ? 'sticky-left' : "",
|
124
|
-
|
125
|
+
|
125
126
|
);
|
126
127
|
|
127
128
|
const cellId = `${loading ?
|
@@ -651,36 +651,6 @@ test("columnStyling.cellAlignment sets each <td> align attribute as expected", (
|
|
651
651
|
expect(firstEnrollmentCell).toHaveAttribute("align", "left");
|
652
652
|
});
|
653
653
|
|
654
|
-
test("columnStyling.cellPadding sets cell padding", () => {
|
655
|
-
const styledColumnDefs = [
|
656
|
-
{
|
657
|
-
accessor: "year",
|
658
|
-
label: "Year",
|
659
|
-
cellAccessors: ["quarter", "month", "day"],
|
660
|
-
},
|
661
|
-
{
|
662
|
-
accessor: "newEnrollments",
|
663
|
-
label: "New Enrollments",
|
664
|
-
columnStyling: { cellPadding: "none" },
|
665
|
-
},
|
666
|
-
{
|
667
|
-
accessor: "scheduledMeetings",
|
668
|
-
label: "Scheduled Meetings",
|
669
|
-
},
|
670
|
-
];
|
671
|
-
|
672
|
-
render(
|
673
|
-
<AdvancedTable
|
674
|
-
columnDefinitions={styledColumnDefs}
|
675
|
-
data={{ testid: testId }}
|
676
|
-
tableData={MOCK_DATA}
|
677
|
-
/>
|
678
|
-
);
|
679
|
-
|
680
|
-
const firstEnrollmentCell = screen.getAllByText("20")[0].closest("td");
|
681
|
-
expect(firstEnrollmentCell).toHaveClass('p_none')
|
682
|
-
});
|
683
|
-
|
684
654
|
test("renders virtualized table rows and header", () => {
|
685
655
|
render(
|
686
656
|
<AdvancedTable
|
@@ -724,32 +694,6 @@ test("rowStyling prop works as expected", () => {
|
|
724
694
|
expect(row1).toHaveStyle({backgroundColor: colors.white, color: colors.black})
|
725
695
|
})
|
726
696
|
|
727
|
-
test("rowStyling prop to allow padding control", () => {
|
728
|
-
const rowStyling = [
|
729
|
-
{
|
730
|
-
rowId: "1",
|
731
|
-
cellPadding: "lg"
|
732
|
-
},
|
733
|
-
];
|
734
|
-
|
735
|
-
render(
|
736
|
-
<AdvancedTable
|
737
|
-
columnDefinitions={columnDefinitions}
|
738
|
-
data={{ testid: testId }}
|
739
|
-
rowStyling={rowStyling}
|
740
|
-
tableData={MOCK_DATA_WITH_ID}
|
741
|
-
/>
|
742
|
-
)
|
743
|
-
|
744
|
-
const kit = screen.getByTestId(testId)
|
745
|
-
const tableBody = kit.querySelector('tbody')
|
746
|
-
const row1 = tableBody.querySelector('tr:nth-child(1)')
|
747
|
-
const cells = row1.querySelectorAll("td");
|
748
|
-
cells.forEach((cell) => {
|
749
|
-
expect(cell.classList.contains("p_lg")).toBe(true);
|
750
|
-
});
|
751
|
-
})
|
752
|
-
|
753
697
|
test("Sort icon renders with enableSort on individual columns", () => {
|
754
698
|
render(
|
755
699
|
<AdvancedTable
|
@@ -13,7 +13,6 @@ examples:
|
|
13
13
|
- advanced_table_with_custom_header_rails: Custom Header Cell
|
14
14
|
- advanced_table_column_headers: Multi-Header Columns
|
15
15
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
16
|
-
- advanced_table_column_headers_vertical_border: Multi-Header Columns with Vertical Borders
|
17
16
|
- advanced_table_no_subrows: Table with No Subrows or Expansion
|
18
17
|
- advanced_table_selectable_rows_rails: Selectable Rows
|
19
18
|
- advanced_table_selectable_rows_no_subrows_rails: Selectable Rows (No Subrows)
|
@@ -54,7 +53,6 @@ examples:
|
|
54
53
|
- advanced_table_column_headers: Multi-Header Columns
|
55
54
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
56
55
|
- advanced_table_column_headers_custom_cell: Multi-Header Columns with Custom Cells
|
57
|
-
- advanced_table_column_headers_vertical_border: Multi-Header Columns with Vertical Borders
|
58
56
|
- advanced_table_no_subrows: Table with No Subrows or Expansion
|
59
57
|
- advanced_table_pinned_rows: Pinned Rows
|
60
58
|
- advanced_table_selectable_rows: Selectable Rows
|
@@ -68,10 +66,8 @@ examples:
|
|
68
66
|
- advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
|
69
67
|
- advanced_table_scrollbar_none: Advanced Table Scrollbar None
|
70
68
|
- advanced_table_row_styling: Row Styling
|
71
|
-
- advanced_table_padding_control_per_row: Padding Control using Row Styling
|
72
69
|
- advanced_table_column_styling: Column Styling
|
73
70
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
74
|
-
- advanced_table_padding_control: Padding Control using Column Styling
|
75
71
|
- advanced_table_column_border_color: Column Group Border Color
|
76
72
|
- advanced_table_fullscreen: Fullscreen
|
77
73
|
- advanced_table_infinite_scroll: Infinite Scroll
|
@@ -21,7 +21,6 @@ export { default as AdvancedTableSelectableRowsHeader } from './_advanced_table_
|
|
21
21
|
export { default as AdvancedTableSelectableRowsActions } from './_advanced_table_selectable_rows_actions.jsx'
|
22
22
|
export { default as AdvancedTableTablePropsStickyHeader } from './_advanced_table_table_props_sticky_header.jsx'
|
23
23
|
export { default as AdvancedTableColumnHeadersCustomCell } from './_advanced_table_column_headers_custom_cell.jsx'
|
24
|
-
export { default as AdvancedTableColumnHeadersVerticalBorder } from './_advanced_table_column_headers_vertical_border.jsx'
|
25
24
|
export { default as AdvancedTableInlineEditing } from './_advanced_table_inline_editing.jsx'
|
26
25
|
export { default as AdvancedTableFullscreen } from './_advanced_table_fullscreen.jsx'
|
27
26
|
export { default as AdvancedTableStickyColumns } from './_advanced_table_sticky_columns.jsx'
|
@@ -43,6 +42,4 @@ export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_c
|
|
43
42
|
export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
|
44
43
|
export { default as AdvancedTableWithCustomHeaderMultiHeader } from './_advanced_table_with_custom_header_multi_header.jsx'
|
45
44
|
export { default as AdvancedTableSortPerColumn } from './_advanced_table_sort_per_column.jsx'
|
46
|
-
export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
|
47
|
-
export { default as AdvancedTablePaddingControl } from './_advanced_table_padding_control.jsx'
|
48
|
-
export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
|
45
|
+
export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
|
@@ -43,7 +43,7 @@ module Playbook
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def td_classname(column, index)
|
46
|
-
classes = %w[id-cell]
|
46
|
+
classes = %w[id-cell chrome-styles]
|
47
47
|
classes << "last-cell" if column[:is_last_in_group]
|
48
48
|
classes << "pinned-left" if index.zero? && is_pinned_left && responsive == "scroll"
|
49
49
|
classes.join(" ")
|
@@ -1,14 +1,5 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
<%= pb_rails("button", props: {
|
3
|
-
type: object.type,
|
4
|
-
loading: object.loading,
|
5
|
-
link: object.link,
|
6
|
-
new_window: object.new_window,
|
7
|
-
variant: object.variant,
|
8
|
-
target: object.target,
|
9
|
-
disabled: object.disabled,
|
10
|
-
dark: object.dark
|
11
|
-
}.merge(object.input_options)) do %>
|
2
|
+
<%= pb_rails("button", props: {type: object.type, loading: object.loading, link: object.link, new_window:object.new_window, variant: object.variant, target: object.target, disabled: object.disabled, dark: object.dark}) do %>
|
12
3
|
<%= pb_rails("icon", props: {icon: object.icon, fixed_width: true, dark: object.dark}) %>
|
13
4
|
<% end %>
|
14
5
|
<% end %>
|
@@ -21,8 +21,6 @@ module Playbook
|
|
21
21
|
prop :size, type: Playbook::Props::Enum,
|
22
22
|
values: %w[default sm],
|
23
23
|
default: "default"
|
24
|
-
prop :input_options, type: Playbook::Props::HashProp,
|
25
|
-
default: {}
|
26
24
|
|
27
25
|
def classname
|
28
26
|
generate_classname("pb_circle_icon_button_kit") + size_class
|
@@ -19,7 +19,6 @@ type PbDateProps = {
|
|
19
19
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
20
20
|
id?: string;
|
21
21
|
showDayOfWeek?: boolean;
|
22
|
-
showCurrentYear?: boolean;
|
23
22
|
showIcon?: boolean;
|
24
23
|
size?: "sm" | "md" | "lg";
|
25
24
|
unstyled?: boolean;
|
@@ -36,7 +35,6 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
36
35
|
htmlOptions = {},
|
37
36
|
id,
|
38
37
|
showDayOfWeek = false,
|
39
|
-
showCurrentYear = false,
|
40
38
|
showIcon = false,
|
41
39
|
size = "md",
|
42
40
|
unstyled = false,
|
@@ -92,7 +90,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
92
90
|
{month} {day}
|
93
91
|
</span>
|
94
92
|
|
95
|
-
{
|
93
|
+
{currentYear != year && <span>{`, ${year}`}</span>}
|
96
94
|
</span>
|
97
95
|
</>
|
98
96
|
: size == "md" || size == "lg"
|
@@ -126,7 +124,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
126
124
|
<span>
|
127
125
|
{month} {day}
|
128
126
|
</span>
|
129
|
-
{
|
127
|
+
{currentYear != year && <span>{`, ${year}`}</span>}
|
130
128
|
</Title>
|
131
129
|
)
|
132
130
|
: (
|
@@ -160,7 +158,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
160
158
|
<Caption dark={dark}
|
161
159
|
tag="span">
|
162
160
|
{month} {day}
|
163
|
-
{
|
161
|
+
{currentYear != year && <>{`, ${year}`}</>}
|
164
162
|
</Caption>
|
165
163
|
</>
|
166
164
|
)}
|
@@ -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 %>
|
17
|
+
<% if object.year.to_s == DateTime.now.year.to_s %>
|
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 %>
|
48
|
+
<% if object.year.to_s == DateTime.now.year.to_s %>
|
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 %>
|
78
|
+
<% if object.year.to_s == DateTime.now.year.to_s %>
|
79
79
|
<%= pb_rails("caption", props: { tag: "span", text: "#{object.month} #{object.day}" }) %>
|
80
80
|
<%# if is current year %>
|
81
81
|
<% else %>
|
@@ -11,8 +11,6 @@ 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
|
16
14
|
prop :size, type: Playbook::Props::Enum,
|
17
15
|
values: %w[lg md sm xs],
|
18
16
|
default: "md"
|
@@ -5,14 +5,12 @@ 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
|
9
8
|
- date_unstyled: Unstyled
|
10
9
|
|
11
10
|
react:
|
12
11
|
- date_default: Default
|
13
12
|
- date_variants: Variants
|
14
13
|
- date_alignment: Alignment
|
15
|
-
- date_with_show_current_year: Show Current Year
|
16
14
|
- date_unstyled: Unstyled
|
17
15
|
|
18
16
|
swift:
|
@@ -2,4 +2,3 @@ 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,7 +4,6 @@ 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'
|
8
7
|
|
9
8
|
import datePickerHelper from './date_picker_helper'
|
10
9
|
import Icon from '../pb_icon/_icon'
|
@@ -115,20 +114,6 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
115
114
|
const inputAriaProps = buildAriaProps(inputAria)
|
116
115
|
const inputDataProps = buildDataProps(inputData)
|
117
116
|
|
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
|
-
|
132
117
|
useEffect(() => {
|
133
118
|
datePickerHelper({
|
134
119
|
allowInput,
|
@@ -164,7 +149,6 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
164
149
|
required: false,
|
165
150
|
}, scrollContainer)
|
166
151
|
}, initializeOnce ? [] : undefined)
|
167
|
-
|
168
152
|
const filteredProps = {...props}
|
169
153
|
if (filteredProps.marginBottom === undefined) {
|
170
154
|
filteredProps.marginBottom = "sm"
|
@@ -179,7 +163,6 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
179
163
|
error ? 'error' : null,
|
180
164
|
className
|
181
165
|
)
|
182
|
-
|
183
166
|
const iconWrapperClass = () => {
|
184
167
|
let base = 'cal_icon_wrapper'
|
185
168
|
if (dark) {
|
@@ -193,7 +176,6 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
193
176
|
}
|
194
177
|
return base
|
195
178
|
}
|
196
|
-
|
197
179
|
const angleDown = getAllIcons()["angleDown"].icon as unknown as { [key: string]: SVGElement }
|
198
180
|
|
199
181
|
return (
|
@@ -224,7 +206,6 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
224
206
|
name={name}
|
225
207
|
onChange={inputOnChange}
|
226
208
|
placeholder={placeholder}
|
227
|
-
style={{ cursor: getCursorStyle(filteredProps.cursor) }}
|
228
209
|
value={inputValue}
|
229
210
|
/>
|
230
211
|
|
@@ -1 +1 @@
|
|
1
|
-
<%= pb_rails("date_picker", props: {
|
1
|
+
<%= pb_rails("date_picker", props: { picker_id: "date-picker-default"}) %>
|
@@ -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
|
55
|
+
const iconClass = icon ? "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 && (
|
96
96
|
<Icon
|
97
97
|
className="pb_icon"
|
98
98
|
fixedWidth
|
@@ -8,7 +8,6 @@ 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
|
12
11
|
|
13
12
|
react:
|
14
13
|
- fixed_confirmation_toast_default: Default
|
@@ -18,7 +17,6 @@ examples:
|
|
18
17
|
- fixed_confirmation_toast_auto_close: Click to Show Auto Close
|
19
18
|
- fixed_confirmation_toast_children: Children
|
20
19
|
- fixed_confirmation_toast_custom_icon: Custom Icon
|
21
|
-
- fixed_confirmation_toast_no_icon: No Icon
|
22
20
|
|
23
21
|
swift:
|
24
22
|
- fixed_confirmation_toast_default_swift: Default
|
@@ -5,4 +5,3 @@ 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,7 +1,6 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
<% if object.icon_value && object.icon_value != "none" %>
|
3
2
|
<%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true }) %>
|
4
|
-
|
3
|
+
|
5
4
|
<% if content %>
|
6
5
|
<%= content %>
|
7
6
|
<% elsif object.show_text? %>
|
@@ -56,12 +56,6 @@ 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
|
-
|
65
59
|
test('renders correctly with multiLine prop', () => {
|
66
60
|
const { container } = render(<FixedConfirmationToast multiLine />);
|
67
61
|
expect(container.querySelector('._multi_line')).toBeInTheDocument();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState
|
1
|
+
import React, { useState } from "react";
|
2
2
|
import classnames from 'classnames'
|
3
3
|
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
@@ -123,13 +123,6 @@ const Pagination = ( props: PaginationProps) => {
|
|
123
123
|
|
124
124
|
return buttons;
|
125
125
|
};
|
126
|
-
|
127
|
-
// Sync internal state with external current prop
|
128
|
-
useEffect(() => {
|
129
|
-
if (current >= 1 && current <= total) {
|
130
|
-
setCurrentPage(current);
|
131
|
-
}
|
132
|
-
}, [current, total]);
|
133
126
|
|
134
127
|
|
135
128
|
const ariaProps = buildAriaProps(aria)
|
@@ -197,22 +197,13 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
197
197
|
}
|
198
198
|
|
199
199
|
const validateMissingAreaCode = (itiInit: any) => {
|
200
|
-
if (!itiInit) return
|
200
|
+
if (!required || !itiInit) return
|
201
201
|
if (itiInit.getValidationError() === ValidationError.MissingAreaCode) {
|
202
202
|
showFormattedError('missing area code')
|
203
203
|
return true
|
204
204
|
}
|
205
205
|
}
|
206
206
|
|
207
|
-
const validateRepeatCountryCode = (itiInit: any) => {
|
208
|
-
if (!itiInit) return
|
209
|
-
const countryDialCode = itiInit.getSelectedCountryData().dialCode;
|
210
|
-
if (unformatNumber(inputValue).startsWith(countryDialCode)) {
|
211
|
-
return showFormattedError('repeat country code')
|
212
|
-
}
|
213
|
-
}
|
214
|
-
|
215
|
-
|
216
207
|
const validateErrors = () => {
|
217
208
|
if (!hasTyped && !error) return
|
218
209
|
|
@@ -222,7 +213,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
222
213
|
if (validateTooShortNumber(itiRef.current)) return
|
223
214
|
if (validateUnhandledError(itiRef.current)) return
|
224
215
|
if (validateMissingAreaCode(itiRef.current)) return
|
225
|
-
if (validateRepeatCountryCode(itiRef.current)) return
|
226
216
|
}
|
227
217
|
|
228
218
|
const getCurrentSelectedData = (itiInit: any, inputValue: string) => {
|
@@ -77,7 +77,6 @@ module Playbook
|
|
77
77
|
name: mask.present? ? "" : name,
|
78
78
|
pattern: validation_pattern || mask_pattern,
|
79
79
|
placeholder: placeholder,
|
80
|
-
style: "cursor: #{cursor_style}",
|
81
80
|
required: required,
|
82
81
|
type: type,
|
83
82
|
value: value,
|
@@ -85,20 +84,6 @@ module Playbook
|
|
85
84
|
}.merge(input_options)
|
86
85
|
end
|
87
86
|
|
88
|
-
def cursor_style
|
89
|
-
# If input is disabled, always use 'not-allowed'
|
90
|
-
return "not-allowed" if disabled
|
91
|
-
|
92
|
-
# If cursor prop is provided, convert it to kebab-case
|
93
|
-
if cursor.present?
|
94
|
-
# Convert camelCase (ex. notAllowed) to kebab-case (ex. not-allowed)
|
95
|
-
cursor.to_s.gsub(/([a-z\d])([A-Z])/, '\1-\2').downcase
|
96
|
-
else
|
97
|
-
# Default to 'pointer'
|
98
|
-
"pointer"
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
87
|
def validation_message
|
103
88
|
validation[:message] || ""
|
104
89
|
end
|
@@ -1 +1 @@
|
|
1
|
-
import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{b as buildAriaProps,c as buildDataProps,d as buildHtmlProps,H as HighchartsReact,e as Highcharts,f as classnames,g as globalProps,h as HighchartsMore,S as SolidGauge,i as buildCss}from"./_typeahead-DDDKDPZS.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-CY5ZPzic.js";const mapColors=array=>{const regex=/(data)\-[1-8]/;const newArray=array.map((item=>regex.test(item)?`${colors[`data_${item[item.length-1]}`]}`:item));return newArray};const BarGraph=({aria:aria={},data:data={},align:align="center",axisTitle:axisTitle,dark:dark=false,chartData:chartData,className:className="pb_bar_graph",colors:colors2,htmlOptions:htmlOptions={},customOptions:customOptions={},axisFormat:axisFormat,id:id,pointStart:pointStart,stacking:stacking,subTitle:subTitle,type:type="column",title:title="Title",xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,legend:legend=false,toggleLegendClick:toggleLegendClick=true,height:height,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:[{labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat&&axisFormat[0]?axisFormat[0].format:""},min:yAxisMin,max:yAxisMax,opposite:false,title:{text:Array.isArray(axisTitle)?axisTitle.length>0?axisTitle[0].name:null:axisTitle},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]}],xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{stacking:stacking,pointStart:pointStart,borderWidth:stacking?0:"",events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(Array.isArray(axisTitle)&&axisTitle.length>1&&axisTitle[1].name){staticOptions.yAxis.push({labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat[1].format},min:yAxisMin,max:yAxisMax,opposite:true,title:{text:axisTitle[1].name},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]})}if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const alignBlockElement=event=>{const itemToMove=document.querySelector(`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`);const chartContainer=document.querySelector(`#${event.target.renderTo.id}`);if(itemToMove!==null&&chartContainer!==null){itemToMove.style.height=`${event.target.chartHeight}px`;itemToMove.style.width=`${event.target.chartWidth}px`;if(chartContainer.firstChild!==null){chartContainer.firstChild.before(itemToMove)}}};const CircleChart=({align:align="center",aria:aria={},rounded:rounded=false,borderColor:borderColor=(rounded?null:""),borderWidth:borderWidth=(rounded?20:null),chartData:chartData,children:children,className:className,colors:colors2=[],customOptions:customOptions={},dark:dark=false,data:data={},dataLabelHtml:dataLabelHtml="<div>{point.name}</div>",dataLabels:dataLabels=false,height:height,htmlOptions:htmlOptions={},id:id,innerSize:innerSize="md",legend:legend=false,maxPointSize:maxPointSize=null,minPointSize:minPointSize=null,startAngle:startAngle=null,style:style="pie",title:title,tooltipHtml:tooltipHtml,useHtml:useHtml=false,zMin:zMin=null,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{headerFormat:null,pointFormat:tooltipHtml?tooltipHtml:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',useHTML:useHtml}});const innerSizes={sm:"35%",md:"50%",lg:"85%",none:"0%"};const innerSizeFormat=size=>innerSizes[size];const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={title:{text:title},chart:{height:height,type:style,events:{render:event=>alignBlockElement(event),redraw:event=>alignBlockElement(event)}},legend:{align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},plotOptions:{pie:{colors:colors2.length>0?mapColors(colors2):highchartsTheme.colors,dataLabels:{enabled:dataLabels,connectorShape:"straight",connectorWidth:3,format:dataLabelHtml},showInLegend:legend}},series:[{minPointSize:minPointSize,maxPointSize:maxPointSize,innerSize:borderWidth==20?"100%":innerSizeFormat(innerSize),data:formattedChartData,zMin:zMin,startAngle:startAngle,borderWidth:borderWidth,borderColor:borderColor}],credits:false};setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(Fragment,{children:children?jsxs("div",{id:`wrapper-circle-chart-${id}`,children:[jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options}),jsx("div",{className:"pb-circle-chart-block",children:children})]}):jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})})};const Gauge=({aria:aria={},chartData:chartData,customOptions:customOptions={},dark:dark=false,data:data={},disableAnimation:disableAnimation=false,fullCircle:fullCircle=false,height:height=null,htmlOptions:htmlOptions={},id:id,max:max=100,min:min=0,prefix:prefix="",showLabels:showLabels=false,style:style="solidgauge",suffix:suffix="",title:title="",tooltipHtml:tooltipHtml='<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',colors:colors$1=[],minorTickInterval:minorTickInterval=null,circumference:circumference=(fullCircle?[0,360]:[-100,100]),...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);SolidGauge(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{pointFormat:tooltipHtml,followPointer:true}});const css=buildCss({pb_gauge_kit:true});const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={chart:{events:{load(){setTimeout(this.reflow.bind(this),0)}},type:style,height:height},title:{text:title},yAxis:{min:min,max:max,lineWidth:0,tickWidth:0,minorTickInterval:minorTickInterval,tickAmount:2,tickPositions:[min,max],labels:{y:26,enabled:showLabels}},credits:false,series:[{data:formattedChartData}],pane:{center:["50%","50%"],size:"90%",startAngle:circumference[0],endAngle:circumference[1],background:{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane"}},colors:colors$1!==void 0&&colors$1.length>0?mapColors(colors$1):highchartsTheme.colors,plotOptions:{series:{animation:!disableAnimation},solidgauge:{borderColor:colors$1!==void 0&&colors$1.length===1?mapColors(colors$1).join():highchartsTheme.colors[0],borderWidth:20,radius:90,innerRadius:"90%",dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:`<span class="prefix${dark?" dark":""}">${prefix}</span><span class="fix${dark?" dark":""}">{y:,f}</span><span class="suffix${dark?" dark":""}">${suffix}</span>`,style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}}};setOptions(merge(staticOptions,customOptions));if(document.querySelector(".prefix")){document.querySelectorAll(".prefix").forEach((prefix2=>{prefix2.setAttribute("y","28")}));document.querySelectorAll(".fix").forEach((fix=>fix.setAttribute("y","38")))}}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(css,globalProps(props)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const LineGraph=({aria:aria={},data:data={},align:align="center",className:className="pb_bar_graph",customOptions:customOptions={},dark:dark=false,gradient:gradient=false,type:type="line",htmlOptions:htmlOptions={},id:id,legend:legend=false,toggleLegendClick:toggleLegendClick=true,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,axisTitle:axisTitle,xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,chartData:chartData,pointStart:pointStart,subTitle:subTitle,title:title,height:height,colors:colors2=[],...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:{min:yAxisMin,max:yAxisMax,title:{text:axisTitle}},xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{pointStart:pointStart,events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};export{BarGraph as B,CircleChart as C,Gauge as G,LineGraph as L};
|
1
|
+
import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{b as buildAriaProps,c as buildDataProps,d as buildHtmlProps,H as HighchartsReact,e as Highcharts,f as classnames,g as globalProps,h as HighchartsMore,S as SolidGauge,i as buildCss}from"./_typeahead-BzYZCpJO.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-CY5ZPzic.js";const mapColors=array=>{const regex=/(data)\-[1-8]/;const newArray=array.map((item=>regex.test(item)?`${colors[`data_${item[item.length-1]}`]}`:item));return newArray};const BarGraph=({aria:aria={},data:data={},align:align="center",axisTitle:axisTitle,dark:dark=false,chartData:chartData,className:className="pb_bar_graph",colors:colors2,htmlOptions:htmlOptions={},customOptions:customOptions={},axisFormat:axisFormat,id:id,pointStart:pointStart,stacking:stacking,subTitle:subTitle,type:type="column",title:title="Title",xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,legend:legend=false,toggleLegendClick:toggleLegendClick=true,height:height,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:[{labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat&&axisFormat[0]?axisFormat[0].format:""},min:yAxisMin,max:yAxisMax,opposite:false,title:{text:Array.isArray(axisTitle)?axisTitle.length>0?axisTitle[0].name:null:axisTitle},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]}],xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{stacking:stacking,pointStart:pointStart,borderWidth:stacking?0:"",events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(Array.isArray(axisTitle)&&axisTitle.length>1&&axisTitle[1].name){staticOptions.yAxis.push({labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat[1].format},min:yAxisMin,max:yAxisMax,opposite:true,title:{text:axisTitle[1].name},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]})}if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const alignBlockElement=event=>{const itemToMove=document.querySelector(`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`);const chartContainer=document.querySelector(`#${event.target.renderTo.id}`);if(itemToMove!==null&&chartContainer!==null){itemToMove.style.height=`${event.target.chartHeight}px`;itemToMove.style.width=`${event.target.chartWidth}px`;if(chartContainer.firstChild!==null){chartContainer.firstChild.before(itemToMove)}}};const CircleChart=({align:align="center",aria:aria={},rounded:rounded=false,borderColor:borderColor=(rounded?null:""),borderWidth:borderWidth=(rounded?20:null),chartData:chartData,children:children,className:className,colors:colors2=[],customOptions:customOptions={},dark:dark=false,data:data={},dataLabelHtml:dataLabelHtml="<div>{point.name}</div>",dataLabels:dataLabels=false,height:height,htmlOptions:htmlOptions={},id:id,innerSize:innerSize="md",legend:legend=false,maxPointSize:maxPointSize=null,minPointSize:minPointSize=null,startAngle:startAngle=null,style:style="pie",title:title,tooltipHtml:tooltipHtml,useHtml:useHtml=false,zMin:zMin=null,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{headerFormat:null,pointFormat:tooltipHtml?tooltipHtml:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',useHTML:useHtml}});const innerSizes={sm:"35%",md:"50%",lg:"85%",none:"0%"};const innerSizeFormat=size=>innerSizes[size];const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={title:{text:title},chart:{height:height,type:style,events:{render:event=>alignBlockElement(event),redraw:event=>alignBlockElement(event)}},legend:{align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},plotOptions:{pie:{colors:colors2.length>0?mapColors(colors2):highchartsTheme.colors,dataLabels:{enabled:dataLabels,connectorShape:"straight",connectorWidth:3,format:dataLabelHtml},showInLegend:legend}},series:[{minPointSize:minPointSize,maxPointSize:maxPointSize,innerSize:borderWidth==20?"100%":innerSizeFormat(innerSize),data:formattedChartData,zMin:zMin,startAngle:startAngle,borderWidth:borderWidth,borderColor:borderColor}],credits:false};setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(Fragment,{children:children?jsxs("div",{id:`wrapper-circle-chart-${id}`,children:[jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options}),jsx("div",{className:"pb-circle-chart-block",children:children})]}):jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})})};const Gauge=({aria:aria={},chartData:chartData,customOptions:customOptions={},dark:dark=false,data:data={},disableAnimation:disableAnimation=false,fullCircle:fullCircle=false,height:height=null,htmlOptions:htmlOptions={},id:id,max:max=100,min:min=0,prefix:prefix="",showLabels:showLabels=false,style:style="solidgauge",suffix:suffix="",title:title="",tooltipHtml:tooltipHtml='<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',colors:colors$1=[],minorTickInterval:minorTickInterval=null,circumference:circumference=(fullCircle?[0,360]:[-100,100]),...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);SolidGauge(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{pointFormat:tooltipHtml,followPointer:true}});const css=buildCss({pb_gauge_kit:true});const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={chart:{events:{load(){setTimeout(this.reflow.bind(this),0)}},type:style,height:height},title:{text:title},yAxis:{min:min,max:max,lineWidth:0,tickWidth:0,minorTickInterval:minorTickInterval,tickAmount:2,tickPositions:[min,max],labels:{y:26,enabled:showLabels}},credits:false,series:[{data:formattedChartData}],pane:{center:["50%","50%"],size:"90%",startAngle:circumference[0],endAngle:circumference[1],background:{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane"}},colors:colors$1!==void 0&&colors$1.length>0?mapColors(colors$1):highchartsTheme.colors,plotOptions:{series:{animation:!disableAnimation},solidgauge:{borderColor:colors$1!==void 0&&colors$1.length===1?mapColors(colors$1).join():highchartsTheme.colors[0],borderWidth:20,radius:90,innerRadius:"90%",dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:`<span class="prefix${dark?" dark":""}">${prefix}</span><span class="fix${dark?" dark":""}">{y:,f}</span><span class="suffix${dark?" dark":""}">${suffix}</span>`,style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}}};setOptions(merge(staticOptions,customOptions));if(document.querySelector(".prefix")){document.querySelectorAll(".prefix").forEach((prefix2=>{prefix2.setAttribute("y","28")}));document.querySelectorAll(".fix").forEach((fix=>fix.setAttribute("y","38")))}}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(css,globalProps(props)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const LineGraph=({aria:aria={},data:data={},align:align="center",className:className="pb_bar_graph",customOptions:customOptions={},dark:dark=false,gradient:gradient=false,type:type="line",htmlOptions:htmlOptions={},id:id,legend:legend=false,toggleLegendClick:toggleLegendClick=true,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,axisTitle:axisTitle,xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,chartData:chartData,pointStart:pointStart,subTitle:subTitle,title:title,height:height,colors:colors2=[],...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:{min:yAxisMin,max:yAxisMax,title:{text:axisTitle}},xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{pointStart:pointStart,events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};export{BarGraph as B,CircleChart as C,Gauge as G,LineGraph as L};
|