playbook_ui 11.16.0.pre.alpha.paginationrails1 → 11.16.0.pre.alpha.reactupgrade1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +0 -2
  3. data/app/pb_kits/playbook/data/menu.yml +0 -1
  4. data/app/pb_kits/playbook/index.js +2 -2
  5. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +111 -0
  6. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +151 -0
  7. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.html.erb +21 -9
  8. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +47 -7
  9. data/app/pb_kits/playbook/pb_dashboard/{pbChartsDarkTheme.ts → pbChartsDarkTheme.js} +21 -6
  10. data/app/pb_kits/playbook/pb_dashboard/{pbChartsLightTheme.ts → pbChartsLightTheme.js} +21 -6
  11. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +112 -0
  12. data/app/pb_kits/playbook/pb_gauge/_gauge.scss +0 -4
  13. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.html.erb +1 -1
  14. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +8 -8
  15. data/app/pb_kits/playbook/pb_gauge/gauge.html.erb +11 -1
  16. data/app/pb_kits/playbook/pb_gauge/gauge.rb +8 -3
  17. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +113 -0
  18. data/app/pb_kits/playbook/pb_popover/_popover.jsx +120 -130
  19. data/app/pb_kits/playbook/pb_popover/docs/_popover_close.jsx +1 -1
  20. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +79 -0
  21. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +1 -1
  22. data/app/pb_kits/playbook/playbook-doc.js +0 -2
  23. data/app/pb_kits/playbook/playbook-rails-react-bindings.js +0 -4
  24. data/app/pb_kits/playbook/playbook-rails.js +4 -0
  25. data/app/pb_kits/playbook/plugins/pb_chart.js +322 -0
  26. data/lib/playbook/kit_base.rb +0 -2
  27. data/lib/playbook/version.rb +2 -2
  28. data/lib/playbook.rb +0 -1
  29. metadata +10 -36
  30. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +0 -145
  31. data/app/pb_kits/playbook/pb_circle_chart/ChartsTypes.ts +0 -2
  32. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +0 -207
  33. data/app/pb_kits/playbook/pb_dashboard/pbChartsColorsHelper.ts +0 -16
  34. data/app/pb_kits/playbook/pb_dashboard/themeTypes.ts +0 -16
  35. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +0 -202
  36. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +0 -148
  37. data/app/pb_kits/playbook/pb_pagination/_pagination.scss +0 -68
  38. data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +0 -41
  39. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.html.erb +0 -28
  40. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +0 -12
  41. data/app/pb_kits/playbook/pb_pagination/docs/example.yml +0 -9
  42. data/app/pb_kits/playbook/pb_pagination/docs/index.js +0 -1
  43. data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +0 -7
  44. data/app/pb_kits/playbook/pb_pagination/pagination.rb +0 -18
  45. data/app/pb_kits/playbook/pb_pagination/pagination.test.jsx +0 -17
  46. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +0 -111
  47. data/lib/playbook/pagination_renderer.rb +0 -41
@@ -0,0 +1,322 @@
1
+ import Highcharts from 'highcharts'
2
+
3
+ import { highchartsTheme } from '../pb_dashboard/pbChartsLightTheme'
4
+ import { highchartsDarkTheme } from '../pb_dashboard/pbChartsDarkTheme'
5
+ import colors from '../tokens/exports/_colors.scss'
6
+
7
+ import pie from 'highcharts/modules/variable-pie'
8
+ import highchartsMore from 'highcharts/highcharts-more'
9
+ import solidGauge from 'highcharts/modules/solid-gauge'
10
+ import treemap from 'highcharts/modules/treemap'
11
+
12
+ pie(Highcharts)
13
+
14
+ // Map Data Color String Props to our SCSS Variables
15
+
16
+ const mapColors = (array) => {
17
+ const regex = /(data)\-[1-8]/ //eslint-disable-line
18
+
19
+ const newArray = array.map((item) => {
20
+ return regex.test(item)
21
+ ? `${colors[`data_${item[item.length - 1]}`]}`
22
+ : item
23
+ })
24
+ return newArray
25
+ }
26
+
27
+ // Adjust Circle Chart Block Kit Dimensions to Match the Chart for Centering
28
+ const alignBlockElement = (event) => {
29
+ const itemToMove = document.querySelector(`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`)
30
+ const chartContainer = document.querySelector(`#${event.target.renderTo.id}`)
31
+ if (itemToMove !== null) {
32
+ itemToMove.style.height = `${event.target.chartHeight}px`
33
+ itemToMove.style.width = `${event.target.chartWidth}px`;
34
+ (chartContainer.firstChild).before(itemToMove)
35
+ }
36
+ }
37
+
38
+ class pbChart {
39
+ defaults = {
40
+ callbackInitializeBefore: () => {},
41
+ callbackInitializeAfter: () => {},
42
+ callbackRefreshBefore: () => {},
43
+ callbackRefreshAfter: () => {},
44
+ callbackDestroyBefore: () => {},
45
+ callbackDestroyAfter: () => {},
46
+ property: 'Value',
47
+ }
48
+
49
+ extendDefaults(defaults, options) {
50
+ for (const property in options) {
51
+ if (Object.prototype.hasOwnProperty.call(options, property)) {
52
+ defaults[property] = options[property]
53
+ }
54
+ }
55
+ return defaults
56
+ }
57
+
58
+ constructor(element, options) {
59
+ this.element = element
60
+ this.options = options
61
+ this.settings = this.extendDefaults(this.defaults, options)
62
+
63
+ if (this.options.type == 'variablepie' || this.options.type == 'pie'){
64
+ this.setupPieChart(options)
65
+ } else if (this.options.type == 'gauge') {
66
+ this.setupGauge(options)
67
+ } else if (this.options.type == 'treemap') {
68
+ this.setupTreemap(options)
69
+ } else {
70
+ this.setupChart(options)
71
+ }
72
+ }
73
+
74
+ setupTheme() {
75
+ this.options.dark ? Highcharts.setOptions(highchartsDarkTheme) : Highcharts.setOptions(highchartsTheme)
76
+ }
77
+
78
+ setupGauge(options) {
79
+ highchartsMore(Highcharts)
80
+ solidGauge(Highcharts)
81
+ this.setupTheme()
82
+
83
+ Highcharts.chart(this.defaults.id, {
84
+ chart: {
85
+ events: {
86
+ load() {
87
+ setTimeout(this.reflow.bind(this), 0)
88
+ },
89
+ },
90
+ type: this.defaults.style,
91
+ height: this.defaults.height,
92
+ },
93
+ title: {
94
+ text: this.defaults.title,
95
+ },
96
+ yAxis: {
97
+ min: this.defaults.min,
98
+ max: this.defaults.max,
99
+ lineWidth: 0,
100
+ tickWidth: 0,
101
+ minorTickInterval: null,
102
+ tickAmount: 2,
103
+ tickPositions: [this.defaults.min, this.defaults.max],
104
+ labels: {
105
+ y: 26,
106
+ enabled: this.defaults.showLabels,
107
+ },
108
+ },
109
+ credits: false,
110
+ series: [
111
+ {
112
+ data: this.defaults.chartData,
113
+ },
114
+ ],
115
+ pane: {
116
+ center: ['50%', '50%'],
117
+ size: '90%',
118
+ startAngle: this.defaults.circumference[0],
119
+ endAngle: this.defaults.circumference[1],
120
+ background: {
121
+ borderWidth: 20,
122
+ innerRadius: '90%',
123
+ outerRadius: '90%',
124
+ shape: 'arc',
125
+ className: 'gauge-pane',
126
+ },
127
+ },
128
+ tooltip: {
129
+ headerFormat: '',
130
+ pointFormat: this.defaults.tooltipHtml,
131
+ followPointer: true,
132
+ },
133
+ colors: options.colors !== undefined && options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
134
+ plotOptions: {
135
+ series: {
136
+ animation: !this.defaults.disableAnimation,
137
+ },
138
+ solidgauge: {
139
+ borderColor: options.colors !== undefined && options.colors.length === 1 ? mapColors(options.colors).join() : highchartsTheme.colors[0],
140
+ dataLabels: {
141
+ format: `<span class="prefix">${this.defaults.prefix}</span>` +
142
+ '<span class="fix">{y:,f}</span>' +
143
+ `<span class="suffix">${this.defaults.suffix}</span>`,
144
+ } },
145
+ },
146
+ },
147
+ )
148
+ document.querySelectorAll('.gauge-pane').forEach((pane) => pane.setAttribute('stroke-linejoin', 'round'))
149
+ if (document.querySelector('.prefix')) {
150
+ document.querySelectorAll('.prefix').forEach((prefix) => prefix.setAttribute('y', '28'))
151
+ document.querySelectorAll('.fix').forEach((fix) => fix.setAttribute('y', '38'))
152
+ }
153
+ }
154
+
155
+ setupPieChart(options) {
156
+ this.setupTheme()
157
+ Highcharts.chart(this.defaults.id, {
158
+ title: {
159
+ text: this.defaults.title,
160
+ },
161
+ chart: {
162
+ height: this.defaults.height,
163
+ type: this.defaults.type,
164
+ events: {
165
+ render: (event) => alignBlockElement(event),
166
+ redraw: (event) => alignBlockElement(event),
167
+ },
168
+ },
169
+
170
+ legend: {
171
+ align: this.defaults.align,
172
+ verticalAlign: this.defaults.verticalAlign,
173
+ layout: this.defaults.layout,
174
+ x: this.defaults.x,
175
+ y: this.defaults.y,
176
+ },
177
+
178
+ plotOptions: {
179
+ pie: {
180
+ colors: options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
181
+ dataLabels: {
182
+ enabled: this.defaults.dataLabels,
183
+ connectorShape: 'straight',
184
+ connectorWidth: 3,
185
+ format: this.defaults.dataLabelHtml,
186
+ },
187
+ showInLegend: this.defaults.showInLegend,
188
+ },
189
+ },
190
+
191
+ tooltip: {
192
+ headerFormat: this.defaults.headerFormat,
193
+ pointFormat: this.defaults.tooltipHtml,
194
+ useHTML: this.defaults.useHTML,
195
+ },
196
+ series: [{
197
+ minPointSize: this.defaults.minPointSize,
198
+ maxPointSize: this.defaults.maxPointSize,
199
+ innerSize: options.borderWidth == 20 ? '100%' : this.defaults.innerSize,
200
+ data: this.defaults.chartData,
201
+ zMin: this.defaults.zMin,
202
+ startAngle: this.defaults.startAngle,
203
+ borderWidth: this.defaults.borderWidth,
204
+ borderColor: options.borderWidth == 20 ? null : this.defaults.innerSize,
205
+ }],
206
+ credits: false,
207
+ })
208
+ }
209
+
210
+ setupTreemap(options) {
211
+ treemap(Highcharts)
212
+ this.setupTheme()
213
+ options.dark ? Highcharts.setOptions(highchartsDarkTheme) : Highcharts.setOptions(highchartsTheme)
214
+
215
+ Highcharts.chart(this.defaults.id, {
216
+ title: {
217
+ text: this.defaults.title,
218
+ },
219
+ chart: {
220
+ height: this.defaults.height,
221
+ type: this.defaults.type,
222
+ },
223
+ credits: false,
224
+ series: [{
225
+ data: this.defaults.chartData,
226
+ }],
227
+ plotOptions: {
228
+ treemap: {
229
+ allowTraversingTree: this.defaults.drillable,
230
+ colorByPoint: !this.defaults.grouped,
231
+ colors: options.colors !== undefined && options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
232
+ },
233
+ },
234
+ tooltip: {
235
+ pointFormat: this.defaults.tooltipHtml,
236
+ useHTML: true,
237
+ },
238
+ })
239
+ }
240
+
241
+ setupChart(options) {
242
+ this.setupTheme()
243
+ const configOptions = {
244
+ title: {
245
+ text: this.defaults.title,
246
+ },
247
+ chart: {
248
+ height: this.defaults.height,
249
+ type: this.defaults.type,
250
+ },
251
+ subtitle: {
252
+ text: this.defaults.subtitle,
253
+ },
254
+ yAxis: {
255
+ min: this.defaults.yAxisMin,
256
+ max: this.defaults.yAxisMax,
257
+ title: {
258
+ text: this.defaults.axisTitle,
259
+ },
260
+ },
261
+ xAxis: {
262
+ categories: this.defaults.xAxisCategories,
263
+ },
264
+ legend: {
265
+ enabled: this.defaults.legend,
266
+ align: this.defaults.align,
267
+ verticalAlign: this.defaults.verticalAlign,
268
+ layout: this.defaults.layout,
269
+ x: this.defaults.x,
270
+ y: this.defaults.y,
271
+ },
272
+ colors: options.colors !== undefined && options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
273
+ plotOptions: {
274
+ series: {
275
+ pointStart: this.defaults.pointStart,
276
+ dataLabels: {
277
+ enabled: false,
278
+ },
279
+ },
280
+ },
281
+ series: this.defaults.chartData,
282
+ credits: false,
283
+ }
284
+
285
+ if (!this.defaults.toggleLegendClick) {
286
+ configOptions.plotOptions.series.events = { legendItemClick: () => false }
287
+ }
288
+
289
+ Highcharts.chart(this.defaults.id, configOptions)
290
+ }
291
+
292
+ refresh(silent = false) {
293
+ if (!silent) {
294
+ this.settings.callbackRefreshBefore.call()
295
+ }
296
+
297
+ this.this.destroy(silent)
298
+ this.this.initialize(silent)
299
+ if (!silent) {
300
+ this.settings.callbackRefreshAfter.call()
301
+ }
302
+ }
303
+
304
+ destroy(silent = false) {
305
+ if (!silent) {
306
+ this.settings.callbackDestroyBefore.call()
307
+ }
308
+ if (!silent) {
309
+ this.settings.callbackDestroyAfter.call()
310
+ }
311
+ }
312
+
313
+ refreshSilently() {
314
+ this.this.refresh(true)
315
+ }
316
+
317
+ destroySilently() {
318
+ this.this.destroy(true)
319
+ }
320
+ }
321
+
322
+ export default pbChart
@@ -19,7 +19,6 @@ require "playbook/flex"
19
19
  require "playbook/flex_grow"
20
20
  require "playbook/flex_shrink"
21
21
  require "playbook/order"
22
- require "playbook/pagination_renderer"
23
22
 
24
23
  module Playbook
25
24
  class KitBase < ViewComponent::Base
@@ -44,7 +43,6 @@ module Playbook
44
43
  include Playbook::FlexGrow
45
44
  include Playbook::FlexShrink
46
45
  include Playbook::Order
47
- include Playbook::Pagination
48
46
 
49
47
  prop :id
50
48
  prop :data, type: Playbook::Props::Hash, default: {}
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "11.16.0"
5
- VERSION = "11.16.0.pre.alpha.paginationrails1"
4
+ PREVIOUS_VERSION = "11.15.0"
5
+ VERSION = "11.16.0.pre.alpha.reactupgrade1"
6
6
  end
data/lib/playbook.rb CHANGED
@@ -12,7 +12,6 @@ require "playbook/pb_doc_helper"
12
12
  require "playbook/kit_base"
13
13
  require "playbook/kit_resolver"
14
14
  require "playbook/markdown"
15
- require "playbook/pagination_renderer"
16
15
 
17
16
  module Playbook
18
17
  ROOT_PATH = Pathname.new(File.join(__dir__, ".."))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.16.0.pre.alpha.paginationrails1
4
+ version: 11.16.0.pre.alpha.reactupgrade1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-04 00:00:00.000000000 Z
12
+ date: 2023-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -269,20 +269,6 @@ dependencies:
269
269
  - - '='
270
270
  - !ruby/object:Gem::Version
271
271
  version: 1.2018.9
272
- - !ruby/object:Gem::Dependency
273
- name: will_paginate
274
- requirement: !ruby/object:Gem::Requirement
275
- requirements:
276
- - - "~>"
277
- - !ruby/object:Gem::Version
278
- version: '3.3'
279
- type: :development
280
- prerelease: false
281
- version_requirements: !ruby/object:Gem::Requirement
282
- requirements:
283
- - - "~>"
284
- - !ruby/object:Gem::Version
285
- version: '3.3'
286
272
  description: Playbook Design System. Built for Nitro, but powering all.
287
273
  email:
288
274
  - nitroux@powerhrg.com
@@ -375,8 +361,8 @@ files:
375
361
  - app/pb_kits/playbook/pb_badge/docs/_description.md
376
362
  - app/pb_kits/playbook/pb_badge/docs/example.yml
377
363
  - app/pb_kits/playbook/pb_badge/docs/index.js
364
+ - app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
378
365
  - app/pb_kits/playbook/pb_bar_graph/_bar_graph.scss
379
- - app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx
380
366
  - app/pb_kits/playbook/pb_bar_graph/barGraphSettings.js
381
367
  - app/pb_kits/playbook/pb_bar_graph/bar_graph.html.erb
382
368
  - app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
@@ -554,9 +540,8 @@ files:
554
540
  - app/pb_kits/playbook/pb_checkbox/docs/_description.md
555
541
  - app/pb_kits/playbook/pb_checkbox/docs/example.yml
556
542
  - app/pb_kits/playbook/pb_checkbox/docs/index.js
557
- - app/pb_kits/playbook/pb_circle_chart/ChartsTypes.ts
543
+ - app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx
558
544
  - app/pb_kits/playbook/pb_circle_chart/_circle_chart.scss
559
- - app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx
560
545
  - app/pb_kits/playbook/pb_circle_chart/circle_chart.html.erb
561
546
  - app/pb_kits/playbook/pb_circle_chart/circle_chart.rb
562
547
  - app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.html.erb
@@ -653,10 +638,8 @@ files:
653
638
  - app/pb_kits/playbook/pb_currency/docs/example.yml
654
639
  - app/pb_kits/playbook/pb_currency/docs/index.js
655
640
  - app/pb_kits/playbook/pb_dashboard/commonSettings.js
656
- - app/pb_kits/playbook/pb_dashboard/pbChartsColorsHelper.ts
657
- - app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts
658
- - app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts
659
- - app/pb_kits/playbook/pb_dashboard/themeTypes.ts
641
+ - app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js
642
+ - app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js
660
643
  - app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
661
644
  - app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.scss
662
645
  - app/pb_kits/playbook/pb_dashboard_value/_dashboard_value_mixins.scss
@@ -1050,8 +1033,8 @@ files:
1050
1033
  - app/pb_kits/playbook/pb_form_pill/docs/index.js
1051
1034
  - app/pb_kits/playbook/pb_form_pill/form_pill.html.erb
1052
1035
  - app/pb_kits/playbook/pb_form_pill/form_pill.rb
1036
+ - app/pb_kits/playbook/pb_gauge/_gauge.jsx
1053
1037
  - app/pb_kits/playbook/pb_gauge/_gauge.scss
1054
- - app/pb_kits/playbook/pb_gauge/_gauge.tsx
1055
1038
  - app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.html.erb
1056
1039
  - app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.jsx
1057
1040
  - app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.md
@@ -1328,8 +1311,8 @@ files:
1328
1311
  - app/pb_kits/playbook/pb_lightbox/hooks/useWindowSize.ts
1329
1312
  - app/pb_kits/playbook/pb_lightbox/lightbox.scss
1330
1313
  - app/pb_kits/playbook/pb_lightbox/lightbox.test.jsx
1314
+ - app/pb_kits/playbook/pb_line_graph/_line_graph.jsx
1331
1315
  - app/pb_kits/playbook/pb_line_graph/_line_graph.scss
1332
- - app/pb_kits/playbook/pb_line_graph/_line_graph.tsx
1333
1316
  - app/pb_kits/playbook/pb_line_graph/docs/_description.md
1334
1317
  - app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.html.erb
1335
1318
  - app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.jsx
@@ -1477,15 +1460,6 @@ files:
1477
1460
  - app/pb_kits/playbook/pb_online_status/docs/index.js
1478
1461
  - app/pb_kits/playbook/pb_online_status/online_status.html.erb
1479
1462
  - app/pb_kits/playbook/pb_online_status/online_status.rb
1480
- - app/pb_kits/playbook/pb_pagination/_pagination.scss
1481
- - app/pb_kits/playbook/pb_pagination/_pagination.tsx
1482
- - app/pb_kits/playbook/pb_pagination/docs/_pagination_default.html.erb
1483
- - app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx
1484
- - app/pb_kits/playbook/pb_pagination/docs/example.yml
1485
- - app/pb_kits/playbook/pb_pagination/docs/index.js
1486
- - app/pb_kits/playbook/pb_pagination/pagination.html.erb
1487
- - app/pb_kits/playbook/pb_pagination/pagination.rb
1488
- - app/pb_kits/playbook/pb_pagination/pagination.test.jsx
1489
1463
  - app/pb_kits/playbook/pb_passphrase/_passphrase.jsx
1490
1464
  - app/pb_kits/playbook/pb_passphrase/_passphrase.scss
1491
1465
  - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_breached.html.erb
@@ -2123,7 +2097,7 @@ files:
2123
2097
  - app/pb_kits/playbook/pb_tooltip/tooltip.html.erb
2124
2098
  - app/pb_kits/playbook/pb_tooltip/tooltip.rb
2125
2099
  - app/pb_kits/playbook/pb_tooltip/tooltip.test.jsx
2126
- - app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx
2100
+ - app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
2127
2101
  - app/pb_kits/playbook/pb_treemap_chart/docs/_description.md
2128
2102
  - app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.html.erb
2129
2103
  - app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.jsx
@@ -2249,6 +2223,7 @@ files:
2249
2223
  - app/pb_kits/playbook/playbook-doc.js
2250
2224
  - app/pb_kits/playbook/playbook-rails-react-bindings.js
2251
2225
  - app/pb_kits/playbook/playbook-rails.js
2226
+ - app/pb_kits/playbook/plugins/pb_chart.js
2252
2227
  - app/pb_kits/playbook/tokens/_animation-curves.scss
2253
2228
  - app/pb_kits/playbook/tokens/_border_radius.scss
2254
2229
  - app/pb_kits/playbook/tokens/_colors.scss
@@ -2346,7 +2321,6 @@ files:
2346
2321
  - lib/playbook/markdown/template_handler.rb
2347
2322
  - lib/playbook/number_spacing.rb
2348
2323
  - lib/playbook/order.rb
2349
- - lib/playbook/pagination_renderer.rb
2350
2324
  - lib/playbook/pb_doc_helper.rb
2351
2325
  - lib/playbook/pb_forms_helper.rb
2352
2326
  - lib/playbook/pb_kit_helper.rb
@@ -1,145 +0,0 @@
1
- import React, { useState, useEffect } from "react";
2
- import { globalProps } from "../utilities/globalProps";
3
- import { buildAriaProps, buildDataProps } from "../utilities/props";
4
-
5
- import HighchartsReact from "highcharts-react-official";
6
- import Highcharts from "highcharts";
7
- import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
8
- import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
9
- import mapColors from "../pb_dashboard/pbChartsColorsHelper";
10
-
11
- import classnames from "classnames";
12
-
13
- type BarGraphProps = {
14
- align?: "left" | "right" | "center";
15
- axisTitle: string;
16
- dark?: Boolean;
17
- xAxisCategories: [];
18
- yAxisMin: number;
19
- yAxisMax: number;
20
- chartData: { name: string; data: number[] }[];
21
- className?: string;
22
- id: any;
23
- pointStart: number | any;
24
- subTitle?: string;
25
- title: string;
26
- type?: string;
27
- legend?: boolean;
28
- toggleLegendClick?: boolean;
29
- height?: string;
30
- colors: string[];
31
- layout?: "horizontal" | "vertical" | "proximate";
32
- verticalAlign?: "top" | "middle" | "bottom";
33
- x?: number;
34
- y?: number;
35
- aria?: { [key: string]: string };
36
- data?: { [key: string]: string };
37
- };
38
-
39
-
40
- const BarGraph = ({
41
- aria = {},
42
- data = {},
43
- align = "center",
44
- axisTitle,
45
- dark = false,
46
- chartData,
47
- className = "pb_bar_graph",
48
- colors,
49
- id,
50
- pointStart,
51
- subTitle,
52
- type = "column",
53
- title = "Title",
54
- xAxisCategories,
55
- yAxisMin,
56
- yAxisMax,
57
- legend = false,
58
- toggleLegendClick = true,
59
- height,
60
- layout = "horizontal",
61
- verticalAlign = "bottom",
62
- x = 0,
63
- y = 0,
64
- ...props
65
- }: BarGraphProps) => {
66
- const ariaProps = buildAriaProps(aria);
67
- const dataProps = buildDataProps(data);
68
- const setupTheme = () => {
69
- dark
70
- ? Highcharts.setOptions(highchartsDarkTheme)
71
- : Highcharts.setOptions(highchartsTheme);
72
- };
73
- setupTheme();
74
-
75
- const staticOptions = {
76
- title: {
77
- text: title,
78
- },
79
- chart: {
80
- height: height,
81
- type: type,
82
- },
83
- subtitle: {
84
- text: subTitle,
85
- },
86
- yAxis: {
87
- min: yAxisMin,
88
- max: yAxisMax,
89
- title: {
90
- text: axisTitle,
91
- },
92
- },
93
- xAxis: {
94
- categories: xAxisCategories,
95
- },
96
- legend: {
97
- enabled: legend,
98
- align: align,
99
- verticalAlign: verticalAlign,
100
- layout: layout,
101
- x: x,
102
- y: y,
103
- },
104
- colors:
105
- colors !== undefined && colors.length > 0
106
- ? mapColors(colors)
107
- : highchartsTheme.colors,
108
- plotOptions: {
109
- series: {
110
- pointStart: pointStart,
111
- events: {},
112
- dataLabels: {
113
- enabled: false,
114
- },
115
- },
116
- },
117
- series: chartData,
118
- credits: false,
119
- };
120
-
121
- if (!toggleLegendClick) {
122
- staticOptions.plotOptions.series.events = { legendItemClick: () => false };
123
- }
124
-
125
- const [options, setOptions] = useState({});
126
-
127
- useEffect(() => {
128
- setOptions({ ...staticOptions });
129
- }, [chartData]);
130
-
131
- return (
132
- <HighchartsReact
133
- containerProps={{
134
- className: classnames(globalProps(props), className),
135
- id: id,
136
- ...ariaProps,
137
- ...dataProps,
138
- }}
139
- highcharts={Highcharts}
140
- options={options}
141
- />
142
- );
143
- };
144
-
145
- export default BarGraph;
@@ -1,2 +0,0 @@
1
- declare module "*.scss"
2
- declare module "highcharts-react-official"