playbook_ui 14.24.0.pre.alpha.play23649503 → 14.24.0.pre.alpha.testingwithoutdatepicker9614
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_bar_graph/_bar_graph.tsx +175 -26
- data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +2 -1
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.html.erb +1 -1
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +78 -12
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.html.erb +9 -21
- 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_picker/_date_picker.tsx +1 -33
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -10
- data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +1 -215
- 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_phone_number_input/_phone_number_input.tsx +11 -1
- data/dist/chunks/_line_graph-B0SsQi-l.js +1 -0
- data/dist/chunks/{_typeahead-CKvqSXWH.js → _typeahead-BgBecRbi.js} +2 -2
- data/dist/chunks/{_weekday_stacked-tedYzlIq.js → _weekday_stacked-BlsASRoi.js} +3 -3
- data/dist/chunks/{lib-BplzvaaY.js → lib-DujEDjJx.js} +2 -2
- data/dist/chunks/{pb_form_validation-CA_noofR.js → pb_form_validation-D3vVNE8Q.js} +1 -1
- 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/lib/playbook/version.rb +1 -1
- metadata +12 -7
- data/dist/chunks/_line_graph-BsZ3DcJo.js +0 -1
@@ -1,10 +1,8 @@
|
|
1
1
|
/* eslint-disable no-console */
|
2
2
|
import React from 'react'
|
3
|
-
import {
|
3
|
+
import { render, screen } from '../utilities/test-utils'
|
4
4
|
|
5
5
|
import DatePicker from './_date_picker'
|
6
|
-
import DateTime from "../pb_kit/dateTime.ts"
|
7
|
-
import { getTimezoneText } from './plugins/timeSelect'
|
8
6
|
|
9
7
|
jest.setSystemTime(new Date('01/01/2020'));
|
10
8
|
const DEFAULT_DATE = new Date()
|
@@ -39,216 +37,4 @@ describe('DatePicker Kit', () => {
|
|
39
37
|
const kit = screen.getByTestId(testId)
|
40
38
|
expect(kit).toHaveClass('pb_date_picker_kit mb_sm')
|
41
39
|
})
|
42
|
-
|
43
|
-
test('shows DatePicker date format m/d/Y', async () => {
|
44
|
-
const testId = 'datepicker-date'
|
45
|
-
render(
|
46
|
-
<DatePicker
|
47
|
-
data={{ testid: testId }}
|
48
|
-
defaultDate={DEFAULT_DATE}
|
49
|
-
format="m/d/Y"
|
50
|
-
pickerId="date-picker-date"
|
51
|
-
/>
|
52
|
-
)
|
53
|
-
|
54
|
-
const kit = screen.getByTestId(testId)
|
55
|
-
|
56
|
-
|
57
|
-
const input = within(kit).getByPlaceholderText('Select Date')
|
58
|
-
expect(input).toBeInTheDocument()
|
59
|
-
|
60
|
-
await waitFor(() => {
|
61
|
-
expect(input).toHaveValue('01/01/2020')
|
62
|
-
})
|
63
|
-
})
|
64
|
-
|
65
|
-
test('shows DatePicker time caption text', async () => {
|
66
|
-
const testId = 'datepicker-time-caption'
|
67
|
-
render(
|
68
|
-
<DatePicker
|
69
|
-
data={{ testid: testId }}
|
70
|
-
defaultDate={DEFAULT_DATE}
|
71
|
-
enableTime
|
72
|
-
pickerId="date-picker-time-caption"
|
73
|
-
/>
|
74
|
-
)
|
75
|
-
|
76
|
-
const kit = screen.getByTestId(testId)
|
77
|
-
const input = within(kit).getByPlaceholderText('Select Date')
|
78
|
-
|
79
|
-
fireEvent(
|
80
|
-
input,
|
81
|
-
new MouseEvent('click', {
|
82
|
-
bubbles: true,
|
83
|
-
cancelable: true,
|
84
|
-
}),
|
85
|
-
)
|
86
|
-
await waitFor(() => {
|
87
|
-
const caption = within(kit).getByText('Select Time')
|
88
|
-
expect(caption).toBeInTheDocument()
|
89
|
-
})
|
90
|
-
})
|
91
|
-
|
92
|
-
test('shows DatePicker timezone text', async () => {
|
93
|
-
const testId = 'datepicker-timezone'
|
94
|
-
render(
|
95
|
-
<DatePicker
|
96
|
-
data={{ testid: testId }}
|
97
|
-
defaultDate={DEFAULT_DATE}
|
98
|
-
enableTime
|
99
|
-
pickerId="date-picker-timezone"
|
100
|
-
showTimezone
|
101
|
-
/>
|
102
|
-
)
|
103
|
-
|
104
|
-
const kit = screen.getByTestId(testId)
|
105
|
-
const input = within(kit).getByPlaceholderText('Select Date')
|
106
|
-
const defaultTimezoneText = getTimezoneText(DEFAULT_DATE)
|
107
|
-
|
108
|
-
fireEvent(
|
109
|
-
input,
|
110
|
-
new MouseEvent('click', {
|
111
|
-
bubbles: true,
|
112
|
-
cancelable: true,
|
113
|
-
}),
|
114
|
-
)
|
115
|
-
await waitFor(() => {
|
116
|
-
const timezoneText = within(kit).getByText(defaultTimezoneText)
|
117
|
-
expect(timezoneText).toBeInTheDocument()
|
118
|
-
})
|
119
|
-
})
|
120
|
-
|
121
|
-
test('shows DatePicker meridiem toggle', async () => {
|
122
|
-
const testId = 'datepicker-meridiem'
|
123
|
-
render(
|
124
|
-
<DatePicker
|
125
|
-
data={{ testid: testId }}
|
126
|
-
defaultDate={DEFAULT_DATE}
|
127
|
-
enableTime
|
128
|
-
pickerId="date-picker-meridiem"
|
129
|
-
/>
|
130
|
-
)
|
131
|
-
|
132
|
-
const kit = screen.getByTestId(testId)
|
133
|
-
const input = within(kit).getByPlaceholderText('Select Date')
|
134
|
-
|
135
|
-
fireEvent(
|
136
|
-
input,
|
137
|
-
new MouseEvent('click', {
|
138
|
-
bubbles: true,
|
139
|
-
cancelable: true,
|
140
|
-
}),
|
141
|
-
)
|
142
|
-
const meridiemToggleAM = within(kit).getByLabelText('AM')
|
143
|
-
const meridiemTogglePM = within(kit).getByLabelText('PM')
|
144
|
-
await waitFor(() => {
|
145
|
-
expect(meridiemToggleAM).toBeInTheDocument()
|
146
|
-
expect(meridiemTogglePM).toBeInTheDocument()
|
147
|
-
})
|
148
|
-
|
149
|
-
fireEvent(
|
150
|
-
meridiemToggleAM,
|
151
|
-
new MouseEvent('click', {
|
152
|
-
bubbles: true,
|
153
|
-
cancelable: true,
|
154
|
-
}),
|
155
|
-
)
|
156
|
-
await waitFor(() => {
|
157
|
-
expect(input).toHaveValue('01/01/2020 at 12:00 AM')
|
158
|
-
})
|
159
|
-
|
160
|
-
fireEvent(
|
161
|
-
meridiemTogglePM,
|
162
|
-
new MouseEvent('click', {
|
163
|
-
bubbles: true,
|
164
|
-
cancelable: true,
|
165
|
-
}),
|
166
|
-
)
|
167
|
-
await waitFor(() => {
|
168
|
-
expect(input).toHaveValue('01/01/2020 at 12:00 PM')
|
169
|
-
})
|
170
|
-
})
|
171
|
-
|
172
|
-
test('shows DatePicker QuickPick dropdown and adds correct date to input', async () => {
|
173
|
-
const testId = 'datepicker-quick-pick'
|
174
|
-
render(
|
175
|
-
<DatePicker
|
176
|
-
allowInput
|
177
|
-
data={{ testid: testId }}
|
178
|
-
mode="range"
|
179
|
-
pickerId="date-picker-quick-pick"
|
180
|
-
placeholder="mm/dd/yyyy to mm/dd/yyyy"
|
181
|
-
selectionType="quickpick"
|
182
|
-
/>
|
183
|
-
)
|
184
|
-
|
185
|
-
const kit = screen.getByTestId(testId)
|
186
|
-
const input = within(kit).getByPlaceholderText('mm/dd/yyyy to mm/dd/yyyy')
|
187
|
-
|
188
|
-
fireEvent(
|
189
|
-
input,
|
190
|
-
new MouseEvent('click', {
|
191
|
-
bubbles: true,
|
192
|
-
cancelable: true,
|
193
|
-
}),
|
194
|
-
)
|
195
|
-
const today = within(kit).getByText('Today')
|
196
|
-
const thisYear = within(kit).getByText('This year')
|
197
|
-
await waitFor(() => {
|
198
|
-
expect(today).toBeInTheDocument()
|
199
|
-
expect(thisYear).toBeInTheDocument()
|
200
|
-
})
|
201
|
-
|
202
|
-
fireEvent(
|
203
|
-
thisYear,
|
204
|
-
new MouseEvent('click', {
|
205
|
-
bubbles: true,
|
206
|
-
cancelable: true,
|
207
|
-
}),
|
208
|
-
)
|
209
|
-
|
210
|
-
await waitFor(() => {
|
211
|
-
expect(input).toHaveValue(DateTime.getYearStartDate(new Date()).formatDate() + " to " + DateTime.getYearEndDate(new Date()).formatDate())
|
212
|
-
})
|
213
|
-
})
|
214
|
-
|
215
|
-
test('shows DatePicker QuickPick ranges ending today', async () => {
|
216
|
-
const testId = 'datepicker-quick-pick-ends-today'
|
217
|
-
render(
|
218
|
-
<DatePicker
|
219
|
-
allowInput
|
220
|
-
data={{ testid: testId }}
|
221
|
-
mode="range"
|
222
|
-
pickerId="date-picker-quick-pick"
|
223
|
-
placeholder="mm/dd/yyyy to mm/dd/yyyy"
|
224
|
-
selectionType="quickpick"
|
225
|
-
thisRangesEndToday
|
226
|
-
/>
|
227
|
-
)
|
228
|
-
|
229
|
-
const kit = screen.getByTestId(testId)
|
230
|
-
const input = within(kit).getByPlaceholderText('mm/dd/yyyy to mm/dd/yyyy')
|
231
|
-
|
232
|
-
fireEvent(
|
233
|
-
input,
|
234
|
-
new MouseEvent('click', {
|
235
|
-
bubbles: true,
|
236
|
-
cancelable: true,
|
237
|
-
}),
|
238
|
-
)
|
239
|
-
|
240
|
-
const thisYear = within(kit).getByText('This year')
|
241
|
-
|
242
|
-
fireEvent(
|
243
|
-
thisYear,
|
244
|
-
new MouseEvent('click', {
|
245
|
-
bubbles: true,
|
246
|
-
cancelable: true,
|
247
|
-
}),
|
248
|
-
)
|
249
|
-
|
250
|
-
await waitFor(() => {
|
251
|
-
expect(input).toHaveValue(DateTime.getYearStartDate(new Date()).formatDate() + " to " + new Date().formatDate())
|
252
|
-
})
|
253
|
-
})
|
254
40
|
})
|
@@ -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();
|
@@ -197,13 +197,22 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
197
197
|
}
|
198
198
|
|
199
199
|
const validateMissingAreaCode = (itiInit: any) => {
|
200
|
-
if (!
|
200
|
+
if (!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
|
+
|
207
216
|
const validateErrors = () => {
|
208
217
|
if (!hasTyped && !error) return
|
209
218
|
|
@@ -213,6 +222,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
213
222
|
if (validateTooShortNumber(itiRef.current)) return
|
214
223
|
if (validateUnhandledError(itiRef.current)) return
|
215
224
|
if (validateMissingAreaCode(itiRef.current)) return
|
225
|
+
if (validateRepeatCountryCode(itiRef.current)) return
|
216
226
|
}
|
217
227
|
|
218
228
|
const getCurrentSelectedData = (itiInit: any, inputValue: string) => {
|
@@ -0,0 +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-BgBecRbi.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-DujEDjJx.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};
|