@patternfly-java/charts 0.0.2 → 0.0.3

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.
package/dist/charts.js CHANGED
@@ -23359,7 +23359,8 @@ function serializer(replacer, cycleReplacer) {
23359
23359
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23360
23360
  * See the License for the specific language governing permissions and
23361
23361
  * limitations under the License.
23362
- */ /*
23362
+ */ // Base class for J2CL JsInterop base class
23363
+ /*
23363
23364
  * Copyright 2023 Red Hat
23364
23365
  *
23365
23366
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -24026,7 +24027,6 @@ $ee9385893c2288c2$var$checkDCE();
24026
24027
  $ee9385893c2288c2$exports = (parcelRequire("7sVKC"));
24027
24028
 
24028
24029
 
24029
- const $aaba5b6591196695$export$ccab7a0ef1eb8a1d = (str)=>str.replace(/-([a-z])/g, (_, c)=>c.toUpperCase());
24030
24030
  const $aaba5b6591196695$export$1cbb2dc5eee9b134 = (name, value)=>{
24031
24031
  if (value === '' || value === undefined || value === null) // boolean attribute presence => true
24032
24032
  return true;
@@ -24042,55 +24042,140 @@ const $aaba5b6591196695$export$1cbb2dc5eee9b134 = (name, value)=>{
24042
24042
  }
24043
24043
  return value;
24044
24044
  };
24045
- const $aaba5b6591196695$export$5b7a8ac5c1f59ce8 = (el)=>{
24045
+ // Build props from attributes of an element
24046
+ const $aaba5b6591196695$var$_buildPropsFromAttributes = (el)=>{
24046
24047
  const props = {};
24047
24048
  for (const attr of el.attributes){
24048
- const camel = $aaba5b6591196695$export$ccab7a0ef1eb8a1d(attr.name);
24049
+ const camel = $aaba5b6591196695$var$_dashToCamel(attr.name);
24049
24050
  // skip standard attributes not relevant to React props
24050
24051
  if (camel === 'class' || camel === 'style') continue;
24051
24052
  props[camel] = $aaba5b6591196695$export$1cbb2dc5eee9b134(camel, attr.value);
24052
24053
  }
24053
24054
  return props;
24054
24055
  };
24055
- // Props we currently do not support because they expect functions or React elements
24056
+ const $aaba5b6591196695$var$_dashToCamel = (str)=>str.replace(/-([a-z])/g, (_, c)=>c.toUpperCase());
24057
+ // Props we currently do not support because they expect React elements
24056
24058
  const $aaba5b6591196695$var$disallowedProps = new Set([
24057
- 'events',
24058
24059
  'containerComponent',
24059
- 'legendComponent',
24060
+ 'desc',
24061
+ 'events',
24062
+ 'groupComponent',
24060
24063
  'labelComponent',
24061
- 'titleComponent',
24064
+ 'legendComponent',
24062
24065
  'subTitleComponent',
24063
- 'groupComponent',
24064
- 'desc' // container-composed
24066
+ 'titleComponent'
24065
24067
  ]);
24066
24068
  class $aaba5b6591196695$export$b3924c9296aeb2b8 extends (0, $b40526c413eb1c4e$export$3f2f9f5909897157) {
24067
24069
  static styles = (0, $e706d93a16dc6562$export$dbf350e5966cf602)`
24068
- :host { display: inline-block; }
24069
- .container { width: 100%; height: 100%; }
24070
- `;
24070
+ :host {
24071
+ display: inline-block;
24072
+ }
24073
+
24074
+ .container {
24075
+ width: 100%;
24076
+ height: 100%;
24077
+ }
24078
+ `;
24071
24079
  constructor(){
24072
24080
  super();
24073
24081
  this._root = null;
24074
24082
  this._container = null;
24075
24083
  this._observer = null;
24076
24084
  this._component = null;
24077
- }
24085
+ // Common properties applicable to all React chart components that are
24086
+ // a) either complex attributes such as a function or structured (JSON) data or
24087
+ // b) trigger a re-render when changed.
24088
+ this._categories = undefined; // string[]
24089
+ this._data = undefined; // any | any[]
24090
+ this._height = undefined; // number
24091
+ this._labels = undefined; // (data: any) => string
24092
+ this._legendAllowWrap = undefined; // boolean
24093
+ this._legendData = undefined; // { name?: string; symbol?: { fill?: string; type?: string; }; }[]
24094
+ this._legendOrientation = undefined; // string
24095
+ this._legendPosition = undefined; // string
24096
+ this._padding = undefined; // { top?: number; bottom?: number; left?: number; right?: number }
24097
+ this._subTitle = undefined; // string
24098
+ this._subTitlePosition = undefined; // string
24099
+ this._themeColor = undefined; // string
24100
+ this._title = undefined; // string
24101
+ this._width = undefined; // number
24102
+ }
24103
+ // ------------------------------------------------------ render
24078
24104
  createRenderRoot() {
24079
- // Use shadow root to encapsulate, but allow React to mount inside
24105
+ // Use shadow root to encapsulate but allow React to mount inside
24080
24106
  return super.createRenderRoot();
24081
24107
  }
24082
24108
  render() {
24083
- return (0, $9c96c2653cffd18a$export$c0bb0b647f701bb5)`<div class="container" part="container"></div>`;
24109
+ return (0, $9c96c2653cffd18a$export$c0bb0b647f701bb5)`
24110
+ <div class="container"></div>
24111
+ <slot style="display: none;"></slot>`;
24112
+ }
24113
+ // Must be implemented by subclasses to return [ReactComponent, extraProps]
24114
+ getReactComponent() {
24115
+ throw new Error('getReactComponent() must be implemented by subclass');
24084
24116
  }
24085
- firstUpdated() {
24117
+ // central render method for standalone and slotted elements.
24118
+ _renderReact() {
24119
+ if (!this._root) return;
24120
+ const rawProps = $aaba5b6591196695$var$_buildPropsFromAttributes(this);
24121
+ const commonProps = this._commonProps();
24122
+ const [Component, extraProps = {}] = this.getReactComponent();
24123
+ const props = {
24124
+ ...rawProps,
24125
+ ...commonProps,
24126
+ ...extraProps
24127
+ };
24128
+ for (const key of Object.keys(props))if ($aaba5b6591196695$var$disallowedProps.has(key)) delete props[key];
24129
+ const children = this._getReactChildren();
24130
+ this._root.render(/*#__PURE__*/ (0, (/*@__PURE__*/$parcel$interopDefault($6Yugf))).createElement(Component, props, ...children));
24131
+ }
24132
+ _getReactChildren() {
24133
+ const slot = this.renderRoot.querySelector('slot');
24134
+ if (!slot) return [];
24135
+ const assignedElements = slot.assignedElements();
24136
+ const reactChildren = [];
24137
+ for (const el of assignedElements)if (el instanceof $aaba5b6591196695$export$b3924c9296aeb2b8) {
24138
+ const childRawProps = $aaba5b6591196695$var$_buildPropsFromAttributes(el);
24139
+ const childCommonProps = el._commonProps(); // Use child's common props, not parent's!
24140
+ const [ChildComponent, childExtraProps = {}] = el.getReactComponent();
24141
+ const childProps = {
24142
+ ...childRawProps,
24143
+ ...childCommonProps,
24144
+ ...childExtraProps
24145
+ };
24146
+ for (const key of Object.keys(childProps))if ($aaba5b6591196695$var$disallowedProps.has(key)) delete childProps[key];
24147
+ reactChildren.push(/*#__PURE__*/ (0, (/*@__PURE__*/$parcel$interopDefault($6Yugf))).createElement(ChildComponent, childProps));
24148
+ }
24149
+ return reactChildren;
24150
+ }
24151
+ // ------------------------------------------------------ lifecycle
24152
+ firstUpdated(_changedProperties) {
24086
24153
  this._container = this.renderRoot.querySelector('.container');
24087
- this._root = (0, $ee9385893c2288c2$exports.createRoot)(this._container);
24088
- // Observe attribute changes dynamically (no need for observedAttributes)
24089
- this._observer = new MutationObserver(()=>this._renderReact());
24090
- this._observer.observe(this, {
24091
- attributes: true
24092
- });
24093
- this._renderReact();
24154
+ // Check if this element is slotted into a parent that will handle rendering
24155
+ const isSlotted = this._isSlottedChild();
24156
+ if (isSlotted) {
24157
+ // If slotted, DON'T create a React root - parent will handle rendering
24158
+ this._observer = new MutationObserver(()=>{
24159
+ const parent = this.parentElement;
24160
+ if (parent && parent instanceof $aaba5b6591196695$export$b3924c9296aeb2b8 && parent._renderReact) parent._renderReact();
24161
+ });
24162
+ this._observer.observe(this, {
24163
+ attributes: true
24164
+ });
24165
+ } else {
24166
+ // If standalone, create React root and render normally
24167
+ this._root = (0, $ee9385893c2288c2$exports.createRoot)(this._container);
24168
+ this._observer = new MutationObserver(()=>this._renderReact());
24169
+ this._observer.observe(this, {
24170
+ attributes: true,
24171
+ childList: true,
24172
+ subtree: true
24173
+ });
24174
+ // Listen to slot changes to re-render when children change
24175
+ const slot = this.renderRoot.querySelector('slot');
24176
+ if (slot) slot.addEventListener('slotchange', ()=>this._renderReact());
24177
+ this._renderReact();
24178
+ }
24094
24179
  }
24095
24180
  disconnectedCallback() {
24096
24181
  if (this._observer) {
@@ -24103,25 +24188,137 @@ class $aaba5b6591196695$export$b3924c9296aeb2b8 extends (0, $b40526c413eb1c4e$ex
24103
24188
  }
24104
24189
  super.disconnectedCallback();
24105
24190
  }
24106
- // Implemented by subclasses to return [ReactComponent, extraProps]
24107
- getReactComponent() {
24108
- throw new Error('getReactComponent() must be implemented by subclass');
24191
+ _isSlottedChild() {
24192
+ // Check if this element's parent is also a ReactWrapperElement
24193
+ const parent = this.parentElement;
24194
+ return parent && parent instanceof $aaba5b6591196695$export$b3924c9296aeb2b8;
24109
24195
  }
24110
- _renderReact() {
24111
- if (!this._root) return;
24112
- const [Component, extraProps = {}] = this.getReactComponent();
24113
- const rawProps = $aaba5b6591196695$export$5b7a8ac5c1f59ce8(this);
24114
- const props = {
24115
- ...rawProps,
24116
- ...extraProps
24117
- };
24118
- // Drop disallowed props and likely-function strings
24119
- for (const key of Object.keys(props))if ($aaba5b6591196695$var$disallowedProps.has(key)) delete props[key];
24120
- // Ensure numeric sizing, default size if none set via style
24121
- if (props.width) props.width = Number(props.width);
24122
- if (props.height) props.height = Number(props.height);
24123
- // Render React component
24124
- this._root.render(/*#__PURE__*/ (0, (/*@__PURE__*/$parcel$interopDefault($6Yugf))).createElement(Component, props));
24196
+ _notifyChange() {
24197
+ const parent = this.parentElement;
24198
+ if (parent && parent instanceof $aaba5b6591196695$export$b3924c9296aeb2b8 && parent._renderReact) // If slotted, notify the parent to re-render
24199
+ parent._renderReact();
24200
+ else if (this._renderReact) // If standalone, render self
24201
+ this._renderReact();
24202
+ }
24203
+ // ------------------------------------------------------ getters/setters
24204
+ get categories() {
24205
+ return this._categories;
24206
+ }
24207
+ set categories(value) {
24208
+ this._categories = value;
24209
+ this._notifyChange();
24210
+ }
24211
+ get data() {
24212
+ return this._data;
24213
+ }
24214
+ set data(value) {
24215
+ this._data = value;
24216
+ this._notifyChange();
24217
+ }
24218
+ get height() {
24219
+ return this._height;
24220
+ }
24221
+ set height(value) {
24222
+ this._height = value;
24223
+ this._notifyChange();
24224
+ }
24225
+ get labels() {
24226
+ return this._labels;
24227
+ }
24228
+ set labels(value) {
24229
+ this._labels = value;
24230
+ this._notifyChange();
24231
+ }
24232
+ get legendAllowWrap() {
24233
+ return this._legendAllowWrap;
24234
+ }
24235
+ set legendAllowWrap(value) {
24236
+ this._legendAllowWrap = value;
24237
+ this._notifyChange();
24238
+ }
24239
+ get legendData() {
24240
+ return this._legendData;
24241
+ }
24242
+ set legendData(value) {
24243
+ this._legendData = value;
24244
+ this._notifyChange();
24245
+ }
24246
+ get legendOrientation() {
24247
+ return this._legendOrientation;
24248
+ }
24249
+ set legendOrientation(value) {
24250
+ this._legendOrientation = value;
24251
+ this._notifyChange();
24252
+ }
24253
+ get legendPosition() {
24254
+ return this._legendPosition;
24255
+ }
24256
+ set legendPosition(value) {
24257
+ this._legendPosition = value;
24258
+ this._notifyChange();
24259
+ }
24260
+ get padding() {
24261
+ return this._padding;
24262
+ }
24263
+ set padding(value) {
24264
+ this._padding = value;
24265
+ this._notifyChange();
24266
+ }
24267
+ get subTitle() {
24268
+ return this._subTitle;
24269
+ }
24270
+ set subTitle(value) {
24271
+ this._subTitle = value;
24272
+ this._notifyChange();
24273
+ }
24274
+ get subTitlePosition() {
24275
+ return this._subTitlePosition;
24276
+ }
24277
+ set subTitlePosition(value) {
24278
+ this._subTitlePosition = value;
24279
+ this._notifyChange();
24280
+ }
24281
+ get themeColor() {
24282
+ return this._themeColor;
24283
+ }
24284
+ set themeColor(value) {
24285
+ this._themeColor = value;
24286
+ this._notifyChange();
24287
+ }
24288
+ get title() {
24289
+ return this._title;
24290
+ }
24291
+ set title(value) {
24292
+ this._title = value;
24293
+ this._notifyChange();
24294
+ }
24295
+ get width() {
24296
+ return this._width;
24297
+ }
24298
+ set width(value) {
24299
+ this._width = value;
24300
+ this._notifyChange();
24301
+ }
24302
+ _commonProps() {
24303
+ const commonProps = {};
24304
+ if (this._categories && typeof this._categories !== 'string') commonProps.categories = this._categories;
24305
+ else if (this.getAttribute('categories')) commonProps.categories = $aaba5b6591196695$export$1cbb2dc5eee9b134('categories', this.getAttribute('categories'));
24306
+ if (this._data && typeof this._data !== 'string') commonProps.data = this._data;
24307
+ else if (this.getAttribute('data')) commonProps.data = $aaba5b6591196695$export$1cbb2dc5eee9b134('data', this.getAttribute('data'));
24308
+ if (this._height !== undefined) commonProps.height = Number(this._height);
24309
+ if (this._labels !== undefined) commonProps.labels = this._labels;
24310
+ if (this._legendAllowWrap !== undefined) commonProps.legendAllowWrap = this._legendAllowWrap;
24311
+ if (this._legendData && typeof this._legendData !== 'string') commonProps.legendData = this._legendData;
24312
+ else if (this.getAttribute('legend-data')) commonProps.legendData = $aaba5b6591196695$export$1cbb2dc5eee9b134('legend-data', this.getAttribute('legend-data'));
24313
+ if (this._legendOrientation !== undefined) commonProps.legendOrientation = this._legendOrientation;
24314
+ if (this._legendPosition !== undefined) commonProps.legendPosition = this._legendPosition;
24315
+ if (this._padding !== undefined) commonProps.padding = this._padding;
24316
+ if (this._subTitle !== undefined) commonProps.subTitle = this._subTitle;
24317
+ if (this._subTitlePosition !== undefined) commonProps.subTitlePosition = this._subTitlePosition;
24318
+ if (this._themeColor !== undefined) commonProps.themeColor = this._themeColor;
24319
+ if (this._title !== undefined) commonProps.title = this._title;
24320
+ if (this._width !== undefined) commonProps.width = Number(this._width);
24321
+ return commonProps;
24125
24322
  }
24126
24323
  }
24127
24324
 
@@ -44441,38 +44638,15 @@ $dd5da699045065c8$export$fec472aca6f2ecb1.displayName = 'ChartDonut';
44441
44638
  (0, (/*@__PURE__*/$parcel$interopDefault($9c299e56048e10e9$exports)))($dd5da699045065c8$export$fec472aca6f2ecb1, (0, $5116abe858fe723f$export$9f1f200213e0db8e));
44442
44639
 
44443
44640
 
44444
- class $2354123da8d3e4af$export$8d6789422ca55e6b extends (0, $aaba5b6591196695$export$b3924c9296aeb2b8) {
44445
- constructor(){
44446
- super();
44447
- this._labels = undefined;
44448
- }
44449
- // Support function-valued 'labels' via direct property assignment on this element only
44450
- get labels() {
44451
- return this._labels;
44452
- }
44453
- set labels(fn) {
44454
- this._labels = fn;
44455
- this._renderReact();
44456
- }
44457
- // Provide defaults for common props via extraProps
44641
+ class $8dc91b3b3627b924$export$30e1f08cd2b3c4e7 extends (0, $aaba5b6591196695$export$b3924c9296aeb2b8) {
44458
44642
  getReactComponent() {
44459
- const extraProps = {};
44460
- // allow setting data via property as object (not only attribute)
44461
- if (this.data && typeof this.data !== 'string') extraProps.data = this.data;
44462
- else if (this.getAttribute('data')) {
44463
- // data can be object or array; parse
44464
- const parsed = (0, $aaba5b6591196695$export$1cbb2dc5eee9b134)('data', this.getAttribute('data'));
44465
- extraProps.data = parsed;
44466
- }
44467
- // If a function-valued labels property was assigned, prefer it over attribute value
44468
- if (typeof this._labels === 'function') extraProps.labels = this._labels;
44469
44643
  return [
44470
44644
  (0, $dd5da699045065c8$export$fec472aca6f2ecb1),
44471
- extraProps
44645
+ {}
44472
44646
  ];
44473
44647
  }
44474
44648
  }
44475
- customElements.define('pf-chart-donut', $2354123da8d3e4af$export$8d6789422ca55e6b);
44649
+ customElements.define('pfj-chart-donut', $8dc91b3b3627b924$export$30e1f08cd2b3c4e7);
44476
44650
 
44477
44651
 
44478
44652
  /*
@@ -44621,20 +44795,215 @@ $1e05812a04d92a6f$export$b6d62f0c53606837.displayName = 'ChartDonutUtilization';
44621
44795
  (0, (/*@__PURE__*/$parcel$interopDefault($9c299e56048e10e9$exports)))($1e05812a04d92a6f$export$b6d62f0c53606837, (0, $5116abe858fe723f$export$9f1f200213e0db8e));
44622
44796
 
44623
44797
 
44624
- class $0260144d187cc421$export$19767e694ed6f9d2 extends (0, $aaba5b6591196695$export$b3924c9296aeb2b8) {
44798
+ class $6b285b23bf94172b$export$2957d0d4890a4071 extends (0, $aaba5b6591196695$export$b3924c9296aeb2b8) {
44799
+ constructor(){
44800
+ super();
44801
+ this._thresholds = undefined;
44802
+ }
44625
44803
  getReactComponent() {
44626
44804
  const extraProps = {};
44627
- if (!this.width) extraProps.width = 230;
44628
- if (!this.height) extraProps.height = 230;
44629
- if (this.data && typeof this.data !== 'string') extraProps.data = this.data;
44630
- else if (this.getAttribute('data')) extraProps.data = (0, $aaba5b6591196695$export$1cbb2dc5eee9b134)('data', this.getAttribute('data'));
44805
+ if (this._thresholds && typeof this._thresholds !== 'string') extraProps.thresholds = this._thresholds;
44806
+ else if (this.getAttribute('thresholds')) extraProps.thresholds = (0, $aaba5b6591196695$export$1cbb2dc5eee9b134)('thresholds', this.getAttribute('thresholds'));
44631
44807
  return [
44632
44808
  (0, $1e05812a04d92a6f$export$b6d62f0c53606837),
44633
44809
  extraProps
44634
44810
  ];
44635
44811
  }
44812
+ get thresholds() {
44813
+ return this._thresholds;
44814
+ }
44815
+ set thresholds(value) {
44816
+ this._thresholds = value;
44817
+ this._notifyChange();
44818
+ }
44819
+ }
44820
+ customElements.define('pfj-chart-donut-utilization', $6b285b23bf94172b$export$2957d0d4890a4071);
44821
+
44822
+
44823
+ /*
44824
+ * Copyright 2023 Red Hat
44825
+ *
44826
+ * Licensed under the Apache License, Version 2.0 (the "License");
44827
+ * you may not use this file except in compliance with the License.
44828
+ * You may obtain a copy of the License at
44829
+ *
44830
+ * https://www.apache.org/licenses/LICENSE-2.0
44831
+ *
44832
+ * Unless required by applicable law or agreed to in writing, software
44833
+ * distributed under the License is distributed on an "AS IS" BASIS,
44834
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44835
+ * See the License for the specific language governing permissions and
44836
+ * limitations under the License.
44837
+ */
44838
+
44839
+
44840
+
44841
+ var $6Yugf = parcelRequire("6Yugf");
44842
+
44843
+
44844
+
44845
+
44846
+
44847
+
44848
+
44849
+
44850
+ const $cccd5b275d56a186$export$3e52c148922ca244 = (_a)=>{
44851
+ var { allowTooltip: allowTooltip = true, ariaDesc: ariaDesc, ariaTitle: ariaTitle, children: children, colorScale: colorScale, constrainToVisibleArea: constrainToVisibleArea = false, containerComponent: containerComponent = (0, $f908afe81556ce49$exports.jsx)((0, $83b8b7b15b8691db$export$57a8e701bcb0acd5), {}), data: data = [], hasPatterns: hasPatterns, invert: invert = false, labels: labels = [], name: name, padding: padding, radius: radius, standalone: standalone = true, subTitlePosition: subTitlePosition = (0, $1b68cdf529ddf842$export$60e8d3c1940269ca).label.subTitlePosition, themeColor: themeColor, x: x, y: y, theme: // destructure last
44852
+ theme = (0, $a08c5b5d17a46f47$export$46cba25477f56a82)(themeColor, invert), height: height = theme.pie.height, width: width = theme.pie.width } = _a, rest = (0, $1a6c3fdd079e304e$export$3c9a16f847548506)(_a, [
44853
+ "allowTooltip",
44854
+ "ariaDesc",
44855
+ "ariaTitle",
44856
+ "children",
44857
+ "colorScale",
44858
+ "constrainToVisibleArea",
44859
+ "containerComponent",
44860
+ "data",
44861
+ "hasPatterns",
44862
+ "invert",
44863
+ "labels",
44864
+ "name",
44865
+ "padding",
44866
+ "radius",
44867
+ "standalone",
44868
+ "subTitlePosition",
44869
+ "themeColor",
44870
+ "x",
44871
+ "y",
44872
+ "theme",
44873
+ "height",
44874
+ "width"
44875
+ ]);
44876
+ const defaultPadding = {
44877
+ bottom: (0, $f4f80d05129de877$export$f0561fab6613117)('bottom', padding, theme.pie.padding),
44878
+ left: (0, $f4f80d05129de877$export$f0561fab6613117)('left', padding, theme.pie.padding),
44879
+ right: (0, $f4f80d05129de877$export$f0561fab6613117)('right', padding, theme.pie.padding),
44880
+ top: (0, $f4f80d05129de877$export$f0561fab6613117)('top', padding, theme.pie.padding)
44881
+ };
44882
+ const chartRadius = (0, $e97c18231d574110$exports).evaluateProp(radius, undefined) || (0, $e97c18231d574110$exports).getRadius({
44883
+ height: height,
44884
+ width: width,
44885
+ padding: defaultPadding
44886
+ });
44887
+ // Returns computed data representing pie chart slices
44888
+ const getComputedData = ()=>{
44889
+ // Format and sort data. Sorting ensures thresholds are displayed in the correct order and simplifies calculations.
44890
+ const datum = (0, $cff6cd34dc747a7b$exports).formatData(data, Object.assign({
44891
+ x: x,
44892
+ y: y
44893
+ }, rest), [
44894
+ 'x',
44895
+ 'y'
44896
+ ]).sort((a, b)=>a._y - b._y);
44897
+ // Data must be offset so that the sum of all data point y-values (including the final slice) == 100.
44898
+ const [prev, computedData] = datum.reduce((acc, dataPoint)=>[
44899
+ dataPoint._y,
44900
+ [
44901
+ ...acc[1],
44902
+ {
44903
+ x: dataPoint._x,
44904
+ y: dataPoint._y - acc[0] // Must be offset by previous value
44905
+ }
44906
+ ]
44907
+ ], [
44908
+ 0,
44909
+ []
44910
+ ]);
44911
+ return [
44912
+ ...computedData,
44913
+ {
44914
+ y: prev ? 100 - prev : 0
44915
+ }
44916
+ ];
44917
+ };
44918
+ // Render dynamic utilization donut cart
44919
+ const computedData = getComputedData();
44920
+ const renderChildren = ()=>(0, $6Yugf.Children).toArray(children).map((child, index)=>{
44921
+ if ((0, $6Yugf.isValidElement)(child)) {
44922
+ const _a = child.props, { data: childData } = _a, childProps = (0, $1a6c3fdd079e304e$export$3c9a16f847548506)(_a, [
44923
+ "data"
44924
+ ]);
44925
+ const datum = (0, $cff6cd34dc747a7b$exports).formatData([
44926
+ childData
44927
+ ], childProps, [
44928
+ 'x',
44929
+ 'y'
44930
+ ]); // Format child data independently of this component's props
44931
+ const dynamicTheme = childProps.theme || (0, $a08c5b5d17a46f47$export$e54087fd64115284)(childProps.themeColor || themeColor);
44932
+ return (0, $6Yugf.cloneElement)(child, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, hasPatterns && {
44933
+ hasPatterns: true
44934
+ }), {
44935
+ constrainToVisibleArea: constrainToVisibleArea,
44936
+ data: childData,
44937
+ endAngle: 360 * (datum[0]._y ? datum[0]._y / 100 : 0),
44938
+ height: height
44939
+ }), name && (child.name, true) && {
44940
+ name: `${name}-${child.type.displayName}-${index}`
44941
+ }), {
44942
+ invert: invert,
44943
+ isStatic: false,
44944
+ key: `pf-chart-donut-threshold-child-${index}`,
44945
+ padding: defaultPadding,
44946
+ patternUnshiftIndex: computedData.length,
44947
+ radius: chartRadius - 14,
44948
+ standalone: false,
44949
+ subTitlePosition: childProps.subTitlePosition || subTitlePosition,
44950
+ theme: dynamicTheme,
44951
+ themeColor: themeColor,
44952
+ width: width
44953
+ }), childProps));
44954
+ }
44955
+ return child;
44956
+ });
44957
+ // Static threshold donut chart
44958
+ const chart = (0, $f908afe81556ce49$exports.jsx)((0, $dd5da699045065c8$export$fec472aca6f2ecb1), Object.assign({
44959
+ allowTooltip: allowTooltip,
44960
+ colorScale: colorScale,
44961
+ constrainToVisibleArea: constrainToVisibleArea,
44962
+ data: computedData,
44963
+ height: height,
44964
+ hasPatterns: hasPatterns,
44965
+ labels: labels,
44966
+ name: name,
44967
+ padding: defaultPadding,
44968
+ standalone: false,
44969
+ theme: theme,
44970
+ themeColor: themeColor,
44971
+ width: width
44972
+ }, rest), "pf-chart-donut-threshold");
44973
+ // Clone so users can override container props
44974
+ const container = (0, $6Yugf.cloneElement)(containerComponent, Object.assign({
44975
+ desc: ariaDesc,
44976
+ height: height,
44977
+ title: ariaTitle,
44978
+ width: width,
44979
+ theme: theme
44980
+ }, containerComponent.props), [
44981
+ chart,
44982
+ renderChildren()
44983
+ ]);
44984
+ return standalone ? (0, $f908afe81556ce49$exports.jsx)((0, $6Yugf.Fragment), {
44985
+ children: container
44986
+ }) : (0, $f908afe81556ce49$exports.jsxs)((0, $6Yugf.Fragment), {
44987
+ children: [
44988
+ chart,
44989
+ renderChildren()
44990
+ ]
44991
+ });
44992
+ };
44993
+ $cccd5b275d56a186$export$3e52c148922ca244.displayName = 'ChartDonutThreshold';
44994
+ // Note: VictoryPie.role must be hoisted
44995
+ (0, (/*@__PURE__*/$parcel$interopDefault($9c299e56048e10e9$exports)))($cccd5b275d56a186$export$3e52c148922ca244, (0, $5116abe858fe723f$export$9f1f200213e0db8e));
44996
+
44997
+
44998
+ class $67511bc35416927b$export$197c14b6cca009e8 extends (0, $aaba5b6591196695$export$b3924c9296aeb2b8) {
44999
+ getReactComponent() {
45000
+ return [
45001
+ (0, $cccd5b275d56a186$export$3e52c148922ca244),
45002
+ {}
45003
+ ];
45004
+ }
44636
45005
  }
44637
- customElements.define('pf-chart-donut-utilization', $0260144d187cc421$export$19767e694ed6f9d2);
45006
+ customElements.define('pfj-chart-donut-threshold', $67511bc35416927b$export$197c14b6cca009e8);
44638
45007
 
44639
45008
 
44640
45009
  /*
@@ -50371,36 +50740,74 @@ $eae4461abcc661fa$export$8ba7478c61efac8a.displayName = 'ChartBullet';
50371
50740
  (0, (/*@__PURE__*/$parcel$interopDefault($9c299e56048e10e9$exports)))($eae4461abcc661fa$export$8ba7478c61efac8a, (0, $71b328f0c5f737a3$export$fcee0f6ad310645a));
50372
50741
 
50373
50742
 
50374
- class $1e030bc14105804e$export$928df182a35e59e7 extends (0, $aaba5b6591196695$export$b3924c9296aeb2b8) {
50743
+ class $cf2f773b9c977cf3$export$d61b38f69c7f8e15 extends (0, $aaba5b6591196695$export$b3924c9296aeb2b8) {
50744
+ constructor(){
50745
+ super();
50746
+ this._comparativeErrorMeasureData = undefined;
50747
+ this._comparativeWarningMeasureData = undefined;
50748
+ this._primaryDotMeasureData = undefined;
50749
+ this._primarySegmentedMeasureData = undefined;
50750
+ this._qualitativeRangeData = undefined;
50751
+ }
50375
50752
  getReactComponent() {
50376
50753
  const extraProps = {};
50377
- // defaults matching examples
50378
- if (!this.width) extraProps.width = 600;
50379
- if (!this.height) extraProps.height = 150;
50380
- // allow setting various data props via property assignment or data-* attributes in JSON
50381
- const keys = [
50382
- 'data',
50383
- 'primaryDotMeasureData',
50384
- 'primarySegmentedMeasureData',
50385
- 'comparativeErrorMeasureData',
50386
- 'comparativeWarningMeasureData',
50387
- 'qualitativeRangeData',
50388
- 'legendData'
50389
- ];
50390
- for (const key of keys){
50391
- const attr = this.getAttribute(key.replace(/[A-Z]/g, (m)=>`-${m.toLowerCase()}`));
50392
- if (this[key] && typeof this[key] !== 'string') extraProps[key] = this[key];
50393
- else if (attr) extraProps[key] = (0, $aaba5b6591196695$export$1cbb2dc5eee9b134)(key, attr);
50394
- }
50754
+ if (this._comparativeErrorMeasureData && typeof this._comparativeErrorMeasureData !== 'string') extraProps.comparativeErrorMeasureData = this._comparativeErrorMeasureData;
50755
+ else if (this.getAttribute('comparative-error-measure-data')) extraProps.thresholds = (0, $aaba5b6591196695$export$1cbb2dc5eee9b134)('comparative-error-measure-data', this.getAttribute('comparative-error-measure-data'));
50756
+ if (this._comparativeWarningMeasureData && typeof this._comparativeWarningMeasureData !== 'string') extraProps.comparativeWarningMeasureData = this._comparativeWarningMeasureData;
50757
+ else if (this.getAttribute('comparative-warning-measure-data')) extraProps.thresholds = (0, $aaba5b6591196695$export$1cbb2dc5eee9b134)('comparative-warning-measure-data', this.getAttribute('comparative-warning-measure-data'));
50758
+ if (this._primaryDotMeasureData && typeof this._primaryDotMeasureData !== 'string') extraProps.primaryDotMeasureData = this._primaryDotMeasureData;
50759
+ else if (this.getAttribute('primary-dot-measure-data')) extraProps.thresholds = (0, $aaba5b6591196695$export$1cbb2dc5eee9b134)('primary-dot-measure-data', this.getAttribute('primary-dot-measure-data'));
50760
+ if (this._primarySegmentedMeasureData && typeof this._primarySegmentedMeasureData !== 'string') extraProps.primarySegmentedMeasureData = this._primarySegmentedMeasureData;
50761
+ else if (this.getAttribute('primary-segmented-measure-data')) extraProps.thresholds = (0, $aaba5b6591196695$export$1cbb2dc5eee9b134)('primary-segmented-measure-data', this.getAttribute('primary-segmented-measure-data'));
50762
+ if (this._qualitativeRangeData && typeof this._qualitativeRangeData !== 'string') extraProps.qualitativeRangeData = this._qualitativeRangeData;
50763
+ else if (this.getAttribute('qualitative-range-data')) extraProps.thresholds = (0, $aaba5b6591196695$export$1cbb2dc5eee9b134)('qualitative-range-data', this.getAttribute('qualitative-range-data'));
50395
50764
  return [
50396
50765
  (0, $eae4461abcc661fa$export$8ba7478c61efac8a),
50397
50766
  extraProps
50398
50767
  ];
50399
50768
  }
50769
+ get comparativeErrorMeasureData() {
50770
+ return this._comparativeErrorMeasureData;
50771
+ }
50772
+ set comparativeErrorMeasureData(value) {
50773
+ this._comparativeErrorMeasureData = value;
50774
+ this._notifyChange();
50775
+ }
50776
+ get comparativeWarningMeasureData() {
50777
+ return this._comparativeWarningMeasureData;
50778
+ }
50779
+ set comparativeWarningMeasureData(value) {
50780
+ this._comparativeWarningMeasureData = value;
50781
+ this._notifyChange();
50782
+ }
50783
+ get primaryDotMeasureData() {
50784
+ return this._primaryDotMeasureData;
50785
+ }
50786
+ set primaryDotMeasureData(value) {
50787
+ this._primaryDotMeasureData = value;
50788
+ this._notifyChange();
50789
+ }
50790
+ get primarySegmentedMeasureData() {
50791
+ return this._primarySegmentedMeasureData;
50792
+ }
50793
+ set primarySegmentedMeasureData(value) {
50794
+ this._primarySegmentedMeasureData = value;
50795
+ this._notifyChange();
50796
+ }
50797
+ get qualitativeRangeData() {
50798
+ return this._qualitativeRangeData;
50799
+ }
50800
+ set qualitativeRangeData(value) {
50801
+ this._qualitativeRangeData = value;
50802
+ this._notifyChange();
50803
+ }
50400
50804
  }
50401
- customElements.define('pf-chart-bullet', $1e030bc14105804e$export$928df182a35e59e7);
50805
+ customElements.define('pfj-chart-bullet', $cf2f773b9c977cf3$export$d61b38f69c7f8e15);
50402
50806
 
50403
50807
 
50808
+ class $a45b9a89eb76584c$var$ChartElement extends HTMLElement {
50809
+ }
50810
+ window.ChartElement = $a45b9a89eb76584c$var$ChartElement;
50404
50811
 
50405
50812
  })();
50406
50813
  //# sourceMappingURL=charts.js.map