playbook_ui 15.1.0.pre.rc.6 → 15.1.0.pre.rc.7
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 +12 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +67 -13
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +2 -2
- data/app/pb_kits/playbook/pb_nav/_nav.scss +27 -0
- data/app/pb_kits/playbook/pb_nav/_nav.test.js +16 -0
- data/app/pb_kits/playbook/pb_nav/_nav.tsx +5 -0
- data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_extendedunderline.html.erb +6 -0
- data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_extendedunderline.jsx +39 -0
- data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_extendedunderline.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_nav/nav.rb +6 -1
- data/dist/chunks/{_line_graph-DeH7NK-i.js → _line_graph-C9stNsP3.js} +1 -1
- data/dist/chunks/{_typeahead-CCGp0OQe.js → _typeahead-D3MtsWXG.js} +1 -1
- data/dist/chunks/{_weekday_stacked-DhJzB115.js → _weekday_stacked-BMwekyel.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- 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 +1 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22ab5b90e1d9cbec45a99a5af6fc60279cfb727951067f354c127d2a22d15134
|
4
|
+
data.tar.gz: 89bbe0d1ae5b255bbc62cb12753a3f0c5efbe2fa6e4076833433441e780f462b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ce2f65cf5268cef21d51d42a9bea050618c7174816703edb6d7d74101db5b0fad926dc9cf00b5ad853b80675e9c9e742fbee099f042ba19ad0613e3fad7c9b9
|
7
|
+
data.tar.gz: 53a36a1938ccb7efa89ba400b54db668715d5111c1d8dc625b15cd025c71cec3ffeb07aa2dad4a7a0dfae58a1b3d95c7e9d6fa596f237cb75e562d1756fa9ab4
|
@@ -30,6 +30,7 @@ const TableCellRenderer = ({
|
|
30
30
|
columnPinning,
|
31
31
|
customRowStyle,
|
32
32
|
columnDefinitions,
|
33
|
+
isMultiHeaderColumn = false,
|
33
34
|
}: {
|
34
35
|
row: Row<GenericObject>
|
35
36
|
collapsibleTrail?: boolean
|
@@ -38,12 +39,18 @@ const TableCellRenderer = ({
|
|
38
39
|
columnPinning: { left: string[] }
|
39
40
|
customRowStyle?: GenericObject
|
40
41
|
columnDefinitions?: {[key:string]:any}[]
|
42
|
+
isMultiHeaderColumn?: boolean
|
41
43
|
}) => {
|
42
44
|
return (
|
43
45
|
<>
|
44
46
|
{row.getVisibleCells().map((cell: Cell<GenericObject, unknown>, i: number) => {
|
45
47
|
const isPinnedLeft = columnPinning.left.includes(cell.column.id);
|
48
|
+
// Add a border to the right of each group of columns for multi-header column tables
|
46
49
|
const isLastCell = (() => {
|
50
|
+
if (!isMultiHeaderColumn) {
|
51
|
+
return false;
|
52
|
+
}
|
53
|
+
|
47
54
|
const parent = cell.column.parent;
|
48
55
|
if (!parent) {
|
49
56
|
const last = row.getVisibleCells().at(-1);
|
@@ -133,6 +140,9 @@ export const RegularTableView = ({
|
|
133
140
|
|
134
141
|
const columnPinning = table.getState().columnPinning || { left: [] };
|
135
142
|
const columnDefinitions = table.options.meta?.columnDefinitions || [];
|
143
|
+
const isMultiHeaderColumn = columnDefinitions.some(
|
144
|
+
(obj: Record<string, unknown>) => "columns" in obj
|
145
|
+
);
|
136
146
|
|
137
147
|
// Row pinning
|
138
148
|
function PinnedRow({ row }: { row: Row<any> }) {
|
@@ -158,6 +168,7 @@ export const RegularTableView = ({
|
|
158
168
|
columnDefinitions={columnDefinitions}
|
159
169
|
columnPinning={columnPinning}
|
160
170
|
customRowStyle={customRowStyle}
|
171
|
+
isMultiHeaderColumn={isMultiHeaderColumn}
|
161
172
|
loading={loading}
|
162
173
|
row={row}
|
163
174
|
stickyLeftColumn={stickyLeftColumn}
|
@@ -221,6 +232,7 @@ export const RegularTableView = ({
|
|
221
232
|
columnDefinitions={columnDefinitions}
|
222
233
|
columnPinning={columnPinning}
|
223
234
|
customRowStyle={customRowStyle}
|
235
|
+
isMultiHeaderColumn={isMultiHeaderColumn}
|
224
236
|
loading={loading}
|
225
237
|
row={row}
|
226
238
|
stickyLeftColumn={stickyLeftColumn}
|
@@ -249,8 +249,10 @@
|
|
249
249
|
}
|
250
250
|
|
251
251
|
.pb_advanced_table_body {
|
252
|
-
|
253
|
-
|
252
|
+
tr {
|
253
|
+
.last-cell:not(:last-of-type) {
|
254
|
+
border-right: 1px solid $border_light !important;
|
255
|
+
}
|
254
256
|
}
|
255
257
|
tr td:first-child {
|
256
258
|
padding-left: 8px !important;
|
@@ -701,6 +703,14 @@
|
|
701
703
|
}
|
702
704
|
}
|
703
705
|
}
|
706
|
+
|
707
|
+
.pb_advanced_table_header {
|
708
|
+
> tr {
|
709
|
+
.last-header-cell:last-of-type {
|
710
|
+
border-right-width: 0 !important;
|
711
|
+
}
|
712
|
+
}
|
713
|
+
}
|
704
714
|
}
|
705
715
|
}
|
706
716
|
|
@@ -975,14 +985,14 @@
|
|
975
985
|
// Firefox-specific fix for last-header-cell and last-cell vertical borders
|
976
986
|
@-moz-document url-prefix() {
|
977
987
|
.pb_advanced_table_header {
|
978
|
-
.last-header-cell {
|
988
|
+
.last-header-cell:not(:last-child) {
|
979
989
|
border-right: none !important;
|
980
990
|
box-shadow: 1px 0 0 0 $border_light !important;
|
981
991
|
}
|
982
992
|
}
|
983
993
|
|
984
994
|
.pb_advanced_table_body {
|
985
|
-
.last-cell {
|
995
|
+
.last-cell:not(:last-child) {
|
986
996
|
border-right: none !important;
|
987
997
|
box-shadow: 1px 0 0 0 $border_light !important;
|
988
998
|
}
|
@@ -991,14 +1001,14 @@
|
|
991
1001
|
// Dark mode Firefox fixes
|
992
1002
|
&.dark {
|
993
1003
|
.pb_advanced_table_header {
|
994
|
-
.last-header-cell {
|
1004
|
+
.last-header-cell:not(:last-child) {
|
995
1005
|
border-right: none !important;
|
996
1006
|
box-shadow: 1px 0 0 0 $border_dark !important;
|
997
1007
|
}
|
998
1008
|
}
|
999
1009
|
|
1000
1010
|
.pb_advanced_table_body {
|
1001
|
-
.last-cell {
|
1011
|
+
.last-cell:not(:last-child) {
|
1002
1012
|
border-right: none !important;
|
1003
1013
|
box-shadow: 1px 0 0 0 $border_dark !important;
|
1004
1014
|
}
|
@@ -1011,18 +1021,62 @@
|
|
1011
1021
|
.pb-advanced-table-popover-option:hover {
|
1012
1022
|
background-color: $bg_light;
|
1013
1023
|
}
|
1024
|
+
|
1014
1025
|
// Removes borders when Wrapped inside the Card Kit
|
1015
|
-
.pb_card_kit > .pb_advanced_table
|
1016
|
-
|
1017
|
-
.
|
1018
|
-
.
|
1026
|
+
.pb_card_kit > .pb_advanced_table {
|
1027
|
+
// Remove right border only from the actual last column
|
1028
|
+
.pb_advanced_table_body tr td:last-child,
|
1029
|
+
.pb_advanced_table_header tr th:last-child {
|
1030
|
+
box-shadow: none !important; // prevents double up of borders on Firefox when in Card Kit
|
1019
1031
|
border-right: none !important;
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
// Without vertical border, remove all last-cell borders
|
1035
|
+
// Specifically for header to prevent thicker borders in firefox.
|
1036
|
+
.pb_table:not(.vertical-border) {
|
1037
|
+
.pb_advanced_table_header .last-header-cell {
|
1038
|
+
box-shadow: none !important;
|
1039
|
+
}
|
1040
|
+
}
|
1041
|
+
// Firefox fix
|
1042
|
+
@-moz-document url-prefix() {
|
1043
|
+
.pb_advanced_table_header {
|
1044
|
+
.last-header-cell {
|
1045
|
+
box-shadow: 1px 0 0 0 $border_light !important;
|
1046
|
+
}
|
1047
|
+
}
|
1048
|
+
}
|
1049
|
+
|
1050
|
+
// For tables WITH vertical borders, only remove border from actual last column
|
1051
|
+
.pb_table.vertical-border {
|
1052
|
+
.pb_advanced_table_body .last-cell:not(:last-child),
|
1053
|
+
.pb_advanced_table_header .last-header-cell:not(:last-child) {
|
1054
|
+
box-shadow: none !important;
|
1055
|
+
border-right: 1px solid $border_light !important;
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
// Dark mode
|
1059
|
+
&.dark {
|
1060
|
+
.pb_advanced_table_body .last-cell:not(:last-child),
|
1061
|
+
.pb_advanced_table_header .last-header-cell:not(:last-child) {
|
1062
|
+
border-right: 1px solid $border_dark !important;
|
1063
|
+
}
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
// Support column group border colors
|
1068
|
+
&.pb_advanced_table[class*="column-group-border-"] {
|
1069
|
+
.pb_advanced_table_body .last-cell:not(:last-child),
|
1070
|
+
.pb_advanced_table_header .last-header-cell:not(:last-child) {
|
1071
|
+
border-right: 1px solid var(--column-border-color) !important;
|
1072
|
+
}
|
1073
|
+
}
|
1020
1074
|
}
|
1021
1075
|
|
1022
|
-
//
|
1023
|
-
.pb_card_kit > .pb_advanced_table tr:last-child,
|
1076
|
+
// Removes bottom borders when wrapped inside the Card Kit (keep existing behavior)
|
1077
|
+
.pb_card_kit > .pb_advanced_table tr:last-child,
|
1024
1078
|
.pb_card_kit > .pb_advanced_table .last-row-cell {
|
1025
1079
|
td {
|
1026
|
-
border-bottom: none !important;
|
1080
|
+
border-bottom: none !important;
|
1027
1081
|
}
|
1028
1082
|
}
|
@@ -48,3 +48,30 @@
|
|
48
48
|
&:hover { cursor: pointer; }
|
49
49
|
}
|
50
50
|
}
|
51
|
+
|
52
|
+
.pb_nav_extended_underline {
|
53
|
+
position: relative;
|
54
|
+
|
55
|
+
// Add full-width border using pseudo-element so as not to break the active item border
|
56
|
+
&::after {
|
57
|
+
content: '';
|
58
|
+
position: absolute;
|
59
|
+
bottom: 0;
|
60
|
+
left: 0;
|
61
|
+
right: 0;
|
62
|
+
height: 3px;
|
63
|
+
background-color: $border_light;
|
64
|
+
z-index: 1;
|
65
|
+
}
|
66
|
+
|
67
|
+
.pb_nav_list_kit_item_active.pb_nav_list_item_link {
|
68
|
+
position: relative;
|
69
|
+
z-index: 2;
|
70
|
+
}
|
71
|
+
|
72
|
+
&.dark {
|
73
|
+
&::after {
|
74
|
+
background-color: rgba($white, $opacity_3);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
@@ -117,3 +117,19 @@ test('should change variant', () => {
|
|
117
117
|
const kit = screen.getByTestId(navTestId)
|
118
118
|
expect(kit).toHaveClass('pb_nav_list_subtle_vertical_highlight')
|
119
119
|
})
|
120
|
+
|
121
|
+
test('extendedUnderline should work as expected', () => {
|
122
|
+
render(
|
123
|
+
<NavDefault extendedUnderline
|
124
|
+
orientation="horizontal"
|
125
|
+
/>
|
126
|
+
)
|
127
|
+
const kit = screen.getByTestId(navTestId)
|
128
|
+
expect(kit).toHaveClass('pb_nav_extended_underline')
|
129
|
+
})
|
130
|
+
|
131
|
+
test('extendedUnderline should not be applied when orientation is vertical', () => {
|
132
|
+
render(<NavDefault extendedUnderline />)
|
133
|
+
const kit = screen.getByTestId(navTestId)
|
134
|
+
expect(kit).not.toHaveClass('pb_nav_extended_underline')
|
135
|
+
})
|
@@ -14,6 +14,7 @@ type NavProps = {
|
|
14
14
|
className?: string | string[],
|
15
15
|
data?: Record<string, unknown>,
|
16
16
|
dark?: boolean,
|
17
|
+
extendedUnderline?: boolean,
|
17
18
|
highlight?: boolean,
|
18
19
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
19
20
|
id?: string,
|
@@ -33,6 +34,7 @@ const Nav = (props: NavProps): React.ReactElement => {
|
|
33
34
|
className,
|
34
35
|
data = {},
|
35
36
|
dark = false,
|
37
|
+
extendedUnderline = false,
|
36
38
|
highlight = true,
|
37
39
|
htmlOptions = {},
|
38
40
|
id,
|
@@ -52,6 +54,9 @@ const Nav = (props: NavProps): React.ReactElement => {
|
|
52
54
|
highlight: highlight,
|
53
55
|
borderless: borderless,
|
54
56
|
}),
|
57
|
+
// extended underline is only applicable for horizontal normal nav, should not
|
58
|
+
// affect other variants or orientations
|
59
|
+
variant === 'normal' && orientation === 'horizontal' && extendedUnderline && 'pb_nav_extended_underline',
|
55
60
|
globalProps(props),
|
56
61
|
className
|
57
62
|
)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= pb_rails("nav", props: { orientation: "horizontal", extended_underline: true }) do %>
|
2
|
+
<%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
|
3
|
+
<%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
|
4
|
+
<%= pb_rails("nav/item", props: { text: "Service ", link: "#" }) %>
|
5
|
+
<%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
|
6
|
+
<% end %>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Nav from '../_nav'
|
4
|
+
import NavItem from '../_item'
|
5
|
+
|
6
|
+
const HorizontalNavExtendedunderline = (props) => {
|
7
|
+
return (
|
8
|
+
<Nav
|
9
|
+
extendedUnderline
|
10
|
+
link="#"
|
11
|
+
orientation="horizontal"
|
12
|
+
{...props}
|
13
|
+
>
|
14
|
+
<NavItem
|
15
|
+
link="#"
|
16
|
+
text="About"
|
17
|
+
{...props}
|
18
|
+
/>
|
19
|
+
<NavItem
|
20
|
+
active
|
21
|
+
link="#"
|
22
|
+
text="Case Studies"
|
23
|
+
{...props}
|
24
|
+
/>
|
25
|
+
<NavItem
|
26
|
+
link="#"
|
27
|
+
text="Service"
|
28
|
+
{...props}
|
29
|
+
/>
|
30
|
+
<NavItem
|
31
|
+
link="#"
|
32
|
+
text="Contacts"
|
33
|
+
{...props}
|
34
|
+
/>
|
35
|
+
</Nav>
|
36
|
+
)
|
37
|
+
}
|
38
|
+
|
39
|
+
export default HorizontalNavExtendedunderline
|
@@ -0,0 +1 @@
|
|
1
|
+
The optional `extendedUnderline`/`extended_underline` prop can be used with the default `normal` variant of the horizontal orientation of the nav to extend the underline to take up the full width of the container.
|
@@ -17,6 +17,7 @@ examples:
|
|
17
17
|
- horizontal_nav: Horizontal Nav
|
18
18
|
- subtle_horizontal_nav: Subtle Horizontal Nav
|
19
19
|
- bold_horizontal_nav: Bold Horizontal Nav
|
20
|
+
- horizontal_nav_extendedunderline: Horizontal Nav With Extended Underline
|
20
21
|
- block_nav: Block
|
21
22
|
- block_no_title_nav: Without Title
|
22
23
|
- new_tab: Open in a New Tab
|
@@ -42,6 +43,7 @@ examples:
|
|
42
43
|
- horizontal_nav: Horizontal Nav
|
43
44
|
- subtle_horizontal_nav: Subtle Horizontal Nav
|
44
45
|
- bold_horizontal_nav: Bold Horizontal Nav
|
46
|
+
- horizontal_nav_extendedunderline: Horizontal Nav With Extended Underline
|
45
47
|
- block_nav: Block
|
46
48
|
- block_no_title_nav: Without Title
|
47
49
|
- new_tab: Open in a New Tab
|
@@ -19,4 +19,5 @@ export { default as CollapsibleNavWithAllOptions} from "./_collapsible_nav_with_
|
|
19
19
|
export { default as NavWithFontControl } from "./_nav_with_font_control.jsx"
|
20
20
|
export { default as NavWithSpacingControl } from "./_nav_with_spacing_control.jsx"
|
21
21
|
export { default as CollapsibleNavItemSpacing } from "./_collapsible_nav_item_spacing.jsx"
|
22
|
-
export { default as CollapsibleNavNoIcon } from "./_collapsible_nav_no_icon.jsx"
|
22
|
+
export { default as CollapsibleNavNoIcon } from "./_collapsible_nav_no_icon.jsx"
|
23
|
+
export { default as HorizontalNavExtendedunderline } from './_horizontal_nav_extendedunderline.jsx'
|
@@ -14,9 +14,10 @@ module Playbook
|
|
14
14
|
prop :highlight, type: Playbook::Props::Boolean, default: true
|
15
15
|
prop :borderless, type: Playbook::Props::Boolean, default: false
|
16
16
|
prop :tabbing, type: Playbook::Props::Boolean, default: false
|
17
|
+
prop :extended_underline, type: Playbook::Props::Boolean, default: false
|
17
18
|
|
18
19
|
def classname
|
19
|
-
generate_classname("pb_nav_list", variant, orientation, highlight_class, borderless_class)
|
20
|
+
generate_classname("pb_nav_list", variant, orientation, highlight_class, borderless_class) + extended_underline_class
|
20
21
|
end
|
21
22
|
|
22
23
|
def data
|
@@ -34,6 +35,10 @@ module Playbook
|
|
34
35
|
def borderless_class
|
35
36
|
borderless ? "borderless" : nil
|
36
37
|
end
|
38
|
+
|
39
|
+
def extended_underline_class
|
40
|
+
variant === "normal" && orientation === "horizontal" && extended_underline ? " pb_nav_extended_underline" : ""
|
41
|
+
end
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
@@ -1 +1 @@
|
|
1
|
-
import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{d as buildAriaProps,e as buildDataProps,f as buildHtmlProps,H as HighchartsReact,g as Highcharts,h as classnames,i as globalProps,j as HighchartsMore,S as SolidGauge,k as buildCss}from"./_typeahead-CCGp0OQe.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-QZuu1ltS.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{d as buildAriaProps,e as buildDataProps,f as buildHtmlProps,H as HighchartsReact,g as Highcharts,h as classnames,i as globalProps,j as HighchartsMore,S as SolidGauge,k as buildCss}from"./_typeahead-D3MtsWXG.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-QZuu1ltS.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};
|