playbook_ui 15.0.0.pre.alpha.PLAY198710641 → 15.0.0.pre.alpha.PLAY236510413
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -2
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_card/_card.scss +4 -12
- data/app/pb_kits/playbook/pb_card/_card.tsx +3 -3
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +0 -10
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.html.erb +0 -3
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.jsx +0 -8
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +4 -6
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +0 -9
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +3 -3
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +0 -1
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +0 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +1 -2
- data/app/pb_kits/playbook/pb_nav/_item.tsx +5 -19
- data/app/pb_kits/playbook/pb_nav/item.html.erb +2 -6
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.md +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.md +1 -1
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +8 -24
- data/app/pb_kits/playbook/pb_timestamp/docs/_time_stamp_default.md +1 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align.html.erb +10 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align.jsx +9 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.html.erb +17 -3
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.jsx +15 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.html.erb +2 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.jsx +2 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.html.erb +14 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.jsx +14 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.html.erb +4 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.jsx +4 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated.jsx +1 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/example.yml +6 -18
- data/app/pb_kits/playbook/pb_timestamp/docs/index.js +0 -6
- data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +7 -29
- data/app/pb_kits/playbook/pb_timestamp/timestamp.test.js +4 -69
- data/dist/chunks/{_line_graph-CUfJ7E4h.js → _line_graph-B5Dr0Huy.js} +1 -1
- data/dist/chunks/{_typeahead-DCp1lVJx.js → _typeahead-GbjDoSSQ.js} +2 -2
- data/dist/chunks/{_weekday_stacked-B-e7xOfU.js → _weekday_stacked-DjQv3Sok.js} +3 -3
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +2 -10
- data/dist/playbook-doc.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/forms/builder/form_field_builder.rb +2 -37
- data/lib/playbook/version.rb +1 -1
- metadata +6 -61
- data/app/pb_kits/playbook/pb_pb_bar_graph/_pb_bar_graph.scss +0 -0
- data/app/pb_kits/playbook/pb_pb_bar_graph/_pb_bar_graph.tsx +0 -62
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors.html.erb +0 -35
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors.jsx +0 -49
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors_rails.md +0 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors_react.md +0 -2
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.html.erb +0 -38
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.jsx +0 -51
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.html.erb +0 -46
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.jsx +0 -62
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.md +0 -3
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_horizontal.html.erb +0 -47
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_horizontal.jsx +0 -60
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend.html.erb +0 -25
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend.jsx +0 -36
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_non_clickable.jsx +0 -44
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.html.erb +0 -100
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.jsx +0 -126
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_negative_numbers.html.erb +0 -32
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_negative_numbers.jsx +0 -48
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_secondary_y_axis.html.erb +0 -68
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_secondary_y_axis.jsx +0 -81
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.html.erb +0 -31
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.jsx +0 -42
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.md +0 -2
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_stacked.html.erb +0 -35
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_stacked.jsx +0 -51
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/example.yml +0 -27
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/index.js +0 -11
- data/app/pb_kits/playbook/pb_pb_bar_graph/pbBarGraphTheme.ts +0 -106
- data/app/pb_kits/playbook/pb_pb_bar_graph/pb_bar_graph.html.erb +0 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/pb_bar_graph.rb +0 -28
- data/app/pb_kits/playbook/pb_pb_bar_graph/pbbargraph.test.jsx +0 -31
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.md +0 -5
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_current_year.html.erb +0 -12
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_current_year.jsx +0 -25
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_current_year.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_date.html.erb +0 -4
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_date.jsx +0 -17
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_date.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_time.html.erb +0 -18
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_time.jsx +0 -44
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_time.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated.md +0 -5
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_current_year.html.erb +0 -16
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_current_year.jsx +0 -30
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_current_year.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_date.html.erb +0 -16
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_date.jsx +0 -30
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_date.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_time.html.erb +0 -26
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_time.jsx +0 -41
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_time.md +0 -1
@@ -23,6 +23,7 @@ const TimestampElapsed = (props) => {
|
|
23
23
|
<br />
|
24
24
|
|
25
25
|
<Timestamp
|
26
|
+
showUser={false}
|
26
27
|
timestamp={customDate}
|
27
28
|
variant="elapsed"
|
28
29
|
{...props}
|
@@ -32,6 +33,7 @@ const TimestampElapsed = (props) => {
|
|
32
33
|
|
33
34
|
<Timestamp
|
34
35
|
hideUpdated
|
36
|
+
showUser={false}
|
35
37
|
timestamp={customDate}
|
36
38
|
variant="elapsed"
|
37
39
|
{...props}
|
@@ -3,30 +3,37 @@
|
|
3
3
|
show_date: false,
|
4
4
|
show_timezone: true,
|
5
5
|
timezone: "America/New_York",
|
6
|
+
align: "left"
|
6
7
|
}) %>
|
7
8
|
|
8
9
|
<br>
|
9
10
|
|
10
11
|
<%= pb_rails("timestamp", props: {
|
11
12
|
timestamp: DateTime.now,
|
13
|
+
show_date: true,
|
12
14
|
show_timezone: true,
|
13
15
|
timezone: "America/New_York",
|
16
|
+
align: "left"
|
14
17
|
}) %>
|
15
18
|
|
16
19
|
<br>
|
17
20
|
|
18
21
|
<%= pb_rails("timestamp", props: {
|
19
22
|
timestamp: DateTime.now + 4.years,
|
23
|
+
show_date: true,
|
20
24
|
show_timezone: true,
|
21
25
|
timezone: "America/New_York",
|
26
|
+
align: "left"
|
22
27
|
}) %>
|
23
28
|
|
24
29
|
<br>
|
25
30
|
|
26
31
|
<%= pb_rails("timestamp", props: {
|
27
32
|
timestamp: DateTime.now - 1.year,
|
33
|
+
show_date: true,
|
28
34
|
show_timezone: true,
|
29
35
|
timezone: "America/New_York",
|
36
|
+
align: "left"
|
30
37
|
}) %>
|
31
38
|
|
32
39
|
<br>
|
@@ -36,30 +43,37 @@
|
|
36
43
|
show_date: false,
|
37
44
|
show_timezone: true,
|
38
45
|
timezone: "Asia/Hong_Kong",
|
46
|
+
align: "left"
|
39
47
|
}) %>
|
40
48
|
|
41
49
|
<br>
|
42
50
|
|
43
51
|
<%= pb_rails("timestamp", props: {
|
44
52
|
timestamp: DateTime.now,
|
53
|
+
show_date: true,
|
45
54
|
show_timezone: true,
|
46
55
|
timezone: "Asia/Hong_Kong",
|
56
|
+
align: "left"
|
47
57
|
}) %>
|
48
58
|
|
49
59
|
<br>
|
50
60
|
|
51
61
|
<%= pb_rails("timestamp", props: {
|
52
62
|
timestamp: DateTime.now + 4.years,
|
63
|
+
show_date: true,
|
53
64
|
show_timezone: true,
|
54
65
|
timezone: "Asia/Hong_Kong",
|
66
|
+
align: "left"
|
55
67
|
}) %>
|
56
68
|
|
57
69
|
<br>
|
58
70
|
|
59
71
|
<%= pb_rails("timestamp", props: {
|
60
72
|
timestamp: DateTime.now - 1.year,
|
73
|
+
show_date: true,
|
61
74
|
show_timezone: true,
|
62
75
|
timezone: "Asia/Hong_Kong",
|
76
|
+
align: "left"
|
63
77
|
}) %>
|
64
78
|
|
65
79
|
<br>
|
@@ -15,6 +15,7 @@ const TimestampTimezones = (props) => {
|
|
15
15
|
return (
|
16
16
|
<div>
|
17
17
|
<Timestamp
|
18
|
+
align="left"
|
18
19
|
showDate={false}
|
19
20
|
showTimezone
|
20
21
|
timestamp={todaysDate}
|
@@ -25,6 +26,8 @@ const TimestampTimezones = (props) => {
|
|
25
26
|
<br />
|
26
27
|
|
27
28
|
<Timestamp
|
29
|
+
align="left"
|
30
|
+
showDate
|
28
31
|
showTimezone
|
29
32
|
timestamp={todaysDate}
|
30
33
|
timezone="America/New_York"
|
@@ -34,6 +37,8 @@ const TimestampTimezones = (props) => {
|
|
34
37
|
<br />
|
35
38
|
|
36
39
|
<Timestamp
|
40
|
+
align="left"
|
41
|
+
showDate
|
37
42
|
showTimezone
|
38
43
|
timestamp={futureDate}
|
39
44
|
timezone="America/New_York"
|
@@ -43,6 +48,8 @@ const TimestampTimezones = (props) => {
|
|
43
48
|
<br />
|
44
49
|
|
45
50
|
<Timestamp
|
51
|
+
align="left"
|
52
|
+
showDate
|
46
53
|
showTimezone
|
47
54
|
timestamp={pastDate}
|
48
55
|
timezone="America/New_York"
|
@@ -52,6 +59,7 @@ const TimestampTimezones = (props) => {
|
|
52
59
|
<br />
|
53
60
|
|
54
61
|
<Timestamp
|
62
|
+
align="left"
|
55
63
|
showDate={false}
|
56
64
|
showTimezone
|
57
65
|
timestamp={todaysDate}
|
@@ -62,6 +70,8 @@ const TimestampTimezones = (props) => {
|
|
62
70
|
<br />
|
63
71
|
|
64
72
|
<Timestamp
|
73
|
+
align="left"
|
74
|
+
showDate
|
65
75
|
showTimezone
|
66
76
|
timestamp={todaysDate}
|
67
77
|
timezone="Asia/Hong_Kong"
|
@@ -71,6 +81,8 @@ const TimestampTimezones = (props) => {
|
|
71
81
|
<br />
|
72
82
|
|
73
83
|
<Timestamp
|
84
|
+
align="left"
|
85
|
+
showDate
|
74
86
|
showTimezone
|
75
87
|
timestamp={futureDate}
|
76
88
|
timezone="Asia/Hong_Kong"
|
@@ -80,6 +92,8 @@ const TimestampTimezones = (props) => {
|
|
80
92
|
<br />
|
81
93
|
|
82
94
|
<Timestamp
|
95
|
+
align="left"
|
96
|
+
showDate
|
83
97
|
showTimezone
|
84
98
|
timestamp={pastDate}
|
85
99
|
timezone="Asia/Hong_Kong"
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
<%= pb_rails("timestamp", props: {
|
4
4
|
timestamp: DateTime.now,
|
5
|
+
show_date: true,
|
6
|
+
align: "left",
|
5
7
|
unstyled: true,
|
6
8
|
}) %>
|
7
9
|
|
@@ -12,6 +14,8 @@
|
|
12
14
|
<%= pb_rails("title", props: { size: 1 }) do %>
|
13
15
|
<%= pb_rails("timestamp", props: {
|
14
16
|
timestamp: DateTime.now,
|
17
|
+
show_date: true,
|
18
|
+
align: "left",
|
15
19
|
unstyled: true,
|
16
20
|
}) %>
|
17
21
|
<% end %>
|
@@ -10,6 +10,8 @@ const TimestampUnstyled = (props) => {
|
|
10
10
|
text="Basic unstyled example"
|
11
11
|
/>
|
12
12
|
<Timestamp
|
13
|
+
align="left"
|
14
|
+
showDate
|
13
15
|
timestamp={new Date()}
|
14
16
|
unstyled
|
15
17
|
{...props}
|
@@ -22,6 +24,8 @@ const TimestampUnstyled = (props) => {
|
|
22
24
|
/>
|
23
25
|
<Title size={1}>
|
24
26
|
<Timestamp
|
27
|
+
align="left"
|
28
|
+
showDate
|
25
29
|
timestamp={new Date()}
|
26
30
|
unstyled
|
27
31
|
{...props}
|
@@ -2,30 +2,18 @@ examples:
|
|
2
2
|
|
3
3
|
rails:
|
4
4
|
- timestamp_default: Default
|
5
|
-
- timestamp_show_date: Hide Date
|
6
|
-
- timestamp_show_time: Hide Time
|
7
|
-
- timestamp_show_current_year: Show Current Year
|
8
|
-
- timestamp_timezones: Show Timezones
|
9
5
|
- timestamp_align: Alignments
|
10
|
-
-
|
11
|
-
- timestamp_updated: Last Updated by
|
12
|
-
-
|
13
|
-
- timestamp_updated_show_date: Last Updated by (Updated Variant) - Hide Date
|
14
|
-
- timestamp_updated_show_time: Last Updated by (Updated Variant) - Hide Time
|
6
|
+
- timestamp_timezones: Timezones
|
7
|
+
- timestamp_updated: Last Updated by
|
8
|
+
- timestamp_elapsed: Time Ago
|
15
9
|
- timestamp_unstyled: Unstyled
|
16
10
|
|
17
11
|
react:
|
18
12
|
- timestamp_default: Default
|
19
|
-
- timestamp_show_date: Hide Date
|
20
|
-
- timestamp_show_time: Hide Time
|
21
|
-
- timestamp_show_current_year: Show Current Year
|
22
|
-
- timestamp_timezones: Show Timezones
|
23
13
|
- timestamp_align: Alignments
|
24
|
-
-
|
25
|
-
- timestamp_updated: Last Updated by
|
26
|
-
-
|
27
|
-
- timestamp_updated_show_date: Last Updated by (Updated Variant) - Hide Date
|
28
|
-
- timestamp_updated_show_time: Last Updated by (Updated Variant) - Hide Time
|
14
|
+
- timestamp_timezones: Timezones
|
15
|
+
- timestamp_updated: Last Updated by
|
16
|
+
- timestamp_elapsed: Time Ago
|
29
17
|
- timestamp_unstyled: Unstyled
|
30
18
|
|
31
19
|
swift:
|
@@ -4,9 +4,3 @@ export { default as TimestampTimezones } from './_timestamp_timezones.jsx'
|
|
4
4
|
export { default as TimestampUpdated } from './_timestamp_updated.jsx'
|
5
5
|
export { default as TimestampElapsed } from './_timestamp_elapsed.jsx'
|
6
6
|
export { default as TimestampUnstyled } from './_timestamp_unstyled.jsx'
|
7
|
-
export { default as TimestampShowDate } from './_timestamp_show_date.jsx'
|
8
|
-
export { default as TimestampShowTime } from './_timestamp_show_time.jsx'
|
9
|
-
export { default as TimestampShowCurrentYear } from './_timestamp_show_current_year.jsx'
|
10
|
-
export { default as TimestampUpdatedShowCurrentYear } from './_timestamp_updated_show_current_year.jsx'
|
11
|
-
export { default as TimestampUpdatedShowDate } from './_timestamp_updated_show_date.jsx'
|
12
|
-
export { default as TimestampUpdatedShowTime } from './_timestamp_updated_show_time.jsx'
|
@@ -14,12 +14,8 @@ module Playbook
|
|
14
14
|
default: "left"
|
15
15
|
prop :hide_updated, type: Playbook::Props::Boolean,
|
16
16
|
default: false
|
17
|
-
prop :show_current_year, type: Playbook::Props::Boolean,
|
18
|
-
default: false
|
19
17
|
prop :show_date, type: Playbook::Props::Boolean,
|
20
18
|
default: true
|
21
|
-
prop :show_time, type: Playbook::Props::Boolean,
|
22
|
-
default: true
|
23
19
|
prop :show_timezone, type: Playbook::Props::Boolean,
|
24
20
|
default: false
|
25
21
|
prop :show_user, type: Playbook::Props::Boolean,
|
@@ -54,22 +50,14 @@ module Playbook
|
|
54
50
|
when "elapsed"
|
55
51
|
format_elapsed_string
|
56
52
|
else
|
57
|
-
|
58
|
-
datetime_or_text
|
59
|
-
elsif show_date && !show_time
|
60
|
-
timestamp ? format_date_string : text
|
61
|
-
elsif !show_date && show_time
|
62
|
-
format_time_string
|
63
|
-
else
|
64
|
-
text
|
65
|
-
end
|
53
|
+
show_date ? datetime_or_text : format_time_string
|
66
54
|
end
|
67
55
|
end
|
68
56
|
|
69
57
|
private
|
70
58
|
|
71
59
|
def format_year_string
|
72
|
-
pb_date_time.to_year != DateTime.now.year.to_s
|
60
|
+
pb_date_time.to_year != DateTime.now.year.to_s ? ", #{pb_date_time.to_year}" : ""
|
73
61
|
end
|
74
62
|
|
75
63
|
def format_time_string
|
@@ -85,24 +73,14 @@ module Playbook
|
|
85
73
|
end
|
86
74
|
|
87
75
|
def format_datetime_string
|
88
|
-
|
89
|
-
"#{format_date_string} · #{format_time_string}".html_safe
|
90
|
-
else
|
91
|
-
format_date_string
|
92
|
-
end
|
76
|
+
"#{format_date_string} · #{format_time_string}".html_safe
|
93
77
|
end
|
94
78
|
|
95
79
|
def format_updated_string
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
elsif show_date && show_time
|
101
|
-
final_updated_string << "on #{format_date_string} at #{format_time_string}"
|
102
|
-
elsif show_time && !show_date
|
103
|
-
final_updated_string << "at #{format_time_string}"
|
104
|
-
end
|
105
|
-
"Last updated #{final_updated_string.join(' ')}"
|
80
|
+
user_string = show_user ? " by #{text}" : ""
|
81
|
+
datetime_string = " on #{format_date_string} at #{format_time_string}"
|
82
|
+
|
83
|
+
"Last updated#{user_string}#{datetime_string}"
|
106
84
|
end
|
107
85
|
|
108
86
|
def format_elapsed_string
|
@@ -102,6 +102,7 @@ describe("Timestamp Kit", () => {
|
|
102
102
|
render(
|
103
103
|
<Timestamp
|
104
104
|
data={{ testid: testId }}
|
105
|
+
showDate={false}
|
105
106
|
showUser
|
106
107
|
text="Maricris Nonato"
|
107
108
|
timestamp={new Date()}
|
@@ -111,7 +112,7 @@ describe("Timestamp Kit", () => {
|
|
111
112
|
const kit = screen.getByTestId(testId);
|
112
113
|
const text = kit.querySelector(".pb_caption_kit_xs");
|
113
114
|
expect(text.textContent).toEqual(
|
114
|
-
"Last updated
|
115
|
+
"Last updated by Maricris Nonato on Jan 1 at 12:00a"
|
115
116
|
);
|
116
117
|
});
|
117
118
|
|
@@ -119,13 +120,14 @@ describe("Timestamp Kit", () => {
|
|
119
120
|
render(
|
120
121
|
<Timestamp
|
121
122
|
data={{ testid: testId }}
|
123
|
+
showDate={false}
|
122
124
|
timestamp={new Date()}
|
123
125
|
variant="updated"
|
124
126
|
/>
|
125
127
|
);
|
126
128
|
const kit = screen.getByTestId(testId);
|
127
129
|
const text = kit.querySelector(".pb_caption_kit_xs");
|
128
|
-
expect(text.textContent).toEqual("Last updated
|
130
|
+
expect(text.textContent).toEqual("Last updated on Jan 1 at 12:00a");
|
129
131
|
});
|
130
132
|
|
131
133
|
test("renders Timestamp elapsed variant with user", () => {
|
@@ -160,70 +162,3 @@ describe("Timestamp Kit", () => {
|
|
160
162
|
expect(text.textContent).toEqual(" a few seconds ago");
|
161
163
|
});
|
162
164
|
});
|
163
|
-
|
164
|
-
test("default variant: time only when showDate=false", () => {
|
165
|
-
render(
|
166
|
-
<Timestamp
|
167
|
-
data={{ testid: testId }}
|
168
|
-
showDate={false}
|
169
|
-
showTime
|
170
|
-
timestamp={new Date()}
|
171
|
-
/>
|
172
|
-
)
|
173
|
-
const text = screen.getByTestId(testId).querySelector(".pb_caption_kit_xs")
|
174
|
-
expect(text?.textContent).toEqual("12:00a")
|
175
|
-
})
|
176
|
-
|
177
|
-
test("default variant: date only when showTime=false (no year for current year)", () => {
|
178
|
-
render(
|
179
|
-
<Timestamp
|
180
|
-
data={{ testid: testId }}
|
181
|
-
showTime={false}
|
182
|
-
timestamp={new Date()}
|
183
|
-
/>
|
184
|
-
)
|
185
|
-
const text = screen.getByTestId(testId).querySelector(".pb_caption_kit_xs")
|
186
|
-
expect(text?.textContent).toEqual("Jan 1")
|
187
|
-
})
|
188
|
-
|
189
|
-
test("default variant: date only with showCurrentYear=true forces year", () => {
|
190
|
-
render(
|
191
|
-
<Timestamp
|
192
|
-
data={{ testid: testId }}
|
193
|
-
showCurrentYear
|
194
|
-
showTime={false}
|
195
|
-
timestamp={new Date()}
|
196
|
-
/>
|
197
|
-
)
|
198
|
-
const text = screen.getByTestId(testId).querySelector(".pb_caption_kit_xs")
|
199
|
-
expect(text?.textContent).toEqual("Jan 1, 2020")
|
200
|
-
})
|
201
|
-
|
202
|
-
test('updated variant: "by user" + date only when showDate=true and showTime=false', () => {
|
203
|
-
render(
|
204
|
-
<Timestamp
|
205
|
-
data={{ testid: testId }}
|
206
|
-
showTime={false}
|
207
|
-
showUser
|
208
|
-
text="Maricris Nonato"
|
209
|
-
timestamp={new Date()}
|
210
|
-
variant="updated"
|
211
|
-
/>
|
212
|
-
)
|
213
|
-
const text = screen.getByTestId(testId).querySelector(".pb_caption_kit_xs")
|
214
|
-
expect(text?.textContent).toEqual("Last updated by Maricris Nonato on Jan 1")
|
215
|
-
})
|
216
|
-
|
217
|
-
test('updated variant: "at time" only when showDate=false and showTime=true', () => {
|
218
|
-
render(
|
219
|
-
<Timestamp
|
220
|
-
data={{ testid: testId }}
|
221
|
-
showDate={false}
|
222
|
-
timestamp={new Date()}
|
223
|
-
variant="updated"
|
224
|
-
/>
|
225
|
-
)
|
226
|
-
const text = screen.getByTestId(testId).querySelector(".pb_caption_kit_xs")
|
227
|
-
expect(text?.textContent).toEqual("Last updated at 12:00a")
|
228
|
-
})
|
229
|
-
|
@@ -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-DCp1lVJx.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-BTs5acfO.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{c as buildAriaProps,d as buildDataProps,e as buildHtmlProps,H as HighchartsReact,f as Highcharts,g as classnames,h as globalProps,i as HighchartsMore,S as SolidGauge,j as buildCss}from"./_typeahead-GbjDoSSQ.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-BTs5acfO.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};
|