impaktapps-design 0.1.0 → 0.1.1

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.
@@ -10481,7 +10481,7 @@ const BottomAxis = ({
10481
10481
  }) => {
10482
10482
  var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s;
10483
10483
  return /* @__PURE__ */ jsx(AxisBottom$2, {
10484
- numTicks: data.length,
10484
+ numTicks: data == null ? void 0 : data.length,
10485
10485
  top: yMax,
10486
10486
  hideTicks: (_a2 = value.main) == null ? void 0 : _a2.hideTicks,
10487
10487
  hideAxisLine: (_b2 = value.main) == null ? void 0 : _b2.hideBottomAxisLine,
@@ -11169,273 +11169,286 @@ const ToolTip = ({
11169
11169
  })
11170
11170
  }, Math.random());
11171
11171
  };
11172
- const defaultMargin = {
11173
- top: 20,
11174
- right: 0,
11175
- bottom: 40,
11176
- left: 40
11177
- };
11178
- function DrawBarGraph({
11179
- width,
11180
- height,
11181
- events = false,
11182
- margin = defaultMargin,
11183
- value
11184
- }) {
11185
- var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j;
11186
- const data = (_a2 = value.main) == null ? void 0 : _a2.data;
11187
- const keys2 = Object.keys(data[0]).filter((d2) => d2 !== "label");
11188
- const getDate = (d2) => d2.label;
11189
- const dateScale = createBandScale({
11190
- domain: data.map(getDate),
11191
- padding: 0.2
11192
- });
11193
- const cityScale = createBandScale({
11194
- domain: keys2,
11195
- padding: 0.1
11196
- });
11197
- const tempScale = createLinearScale({
11198
- domain: [0, Math.max(...data.map((d2) => Math.max(...keys2.map((key) => Number(d2[key])))))]
11199
- });
11200
- const colorScale = createOrdinalScale$1({
11201
- domain: keys2,
11202
- range: [((_d = (_c2 = (_b2 = value.style) == null ? void 0 : _b2.barStyle) == null ? void 0 : _c2.color) == null ? void 0 : _d.firstBarColor) || "#aeeef8", ((_g = (_f = (_e2 = value.style) == null ? void 0 : _e2.barStyle) == null ? void 0 : _f.color) == null ? void 0 : _g.secondBarColor) || "e5fd3d", ((_j = (_i = (_h = value.style) == null ? void 0 : _h.barStyle) == null ? void 0 : _i.color) == null ? void 0 : _j.thirdBarColor) || "#9caff6"]
11203
- });
11204
- const xMax = width - margin.left - margin.right;
11205
- const yMax = height - margin.top - margin.bottom;
11206
- dateScale.rangeRound([0, xMax]);
11207
- cityScale.rangeRound([0, dateScale.bandwidth()]);
11208
- tempScale.range([yMax, 0]);
11209
- const {
11210
- tooltipData,
11211
- tooltipLeft,
11212
- tooltipTop,
11213
- tooltipOpen,
11214
- showTooltip,
11215
- hideTooltip
11216
- } = useTooltip();
11217
- const handleMouse = (event, datum2) => {
11218
- console.log(datum2);
11219
- showTooltip({
11220
- tooltipLeft: event.clientX,
11221
- tooltipTop: event.clientY,
11222
- tooltipData: [datum2.key, datum2.value, datum2.color]
11223
- });
11172
+ var _excluded$n = ["flexDirection", "alignItems", "margin", "display", "children"];
11173
+ function _extends$A() {
11174
+ _extends$A = Object.assign ? Object.assign.bind() : function(target) {
11175
+ for (var i2 = 1; i2 < arguments.length; i2++) {
11176
+ var source = arguments[i2];
11177
+ for (var key in source) {
11178
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11179
+ target[key] = source[key];
11180
+ }
11181
+ }
11182
+ }
11183
+ return target;
11224
11184
  };
11225
- return width < 10 ? null : /* @__PURE__ */ jsxs("div", {
11226
- children: [/* @__PURE__ */ jsxs("svg", {
11227
- width,
11228
- height,
11229
- children: [/* @__PURE__ */ jsx("rect", {
11230
- x: 0,
11231
- y: 0,
11232
- width,
11233
- height,
11234
- fill: value.style.containerStyle.background || "#612efb",
11235
- rx: 14
11236
- }), /* @__PURE__ */ jsxs(Group, {
11237
- top: margin.top,
11238
- left: margin.left,
11239
- children: [/* @__PURE__ */ jsx(LeftAxis, {
11240
- value,
11241
- yScale: tempScale,
11242
- parentWidth: width
11243
- }), /* @__PURE__ */ jsx(BarGroup, {
11244
- data,
11245
- keys: keys2,
11246
- height: yMax,
11247
- x0: getDate,
11248
- x0Scale: dateScale,
11249
- x1Scale: cityScale,
11250
- yScale: tempScale,
11251
- color: colorScale,
11252
- children: (barGroups) => barGroups.map((barGroup) => /* @__PURE__ */ jsx(Group, {
11253
- left: barGroup.x0,
11254
- children: barGroup.bars.map((bar) => /* @__PURE__ */ jsx("rect", {
11255
- x: bar.x,
11256
- y: bar.y,
11257
- width: bar.width,
11258
- height: bar.height,
11259
- fill: bar.color,
11260
- rx: 4,
11261
- onMouseOver: (e3) => handleMouse(e3, bar),
11262
- onMouseOut: hideTooltip,
11263
- onClick: () => {
11264
- if (!events)
11265
- return;
11266
- const {
11267
- key,
11268
- value: value2
11269
- } = bar;
11270
- alert(JSON.stringify({
11271
- key,
11272
- value: value2
11273
- }));
11274
- }
11275
- }, `bar-group-bar-${barGroup.index}-${bar.index}-${bar.value}-${bar.key}`))
11276
- }, `bar-group-${barGroup.index}-${barGroup.x0}`))
11277
- })]
11278
- }), /* @__PURE__ */ jsx(BottomAxis, {
11279
- yMax: yMax + margin.top,
11280
- value,
11281
- left: margin.left,
11282
- xScale: dateScale,
11283
- parentWidth: width
11284
- })]
11285
- }), tooltipOpen && /* @__PURE__ */ jsx(ToolTip, {
11286
- style: {
11287
- ...value == null ? void 0 : value.style,
11288
- tooltipbackground: tooltipData[2]
11289
- },
11290
- top: tooltipTop,
11291
- left: tooltipLeft,
11292
- tooltipData
11293
- })]
11294
- });
11185
+ return _extends$A.apply(this, arguments);
11295
11186
  }
11296
- var root$4 = _root;
11297
- var now$2 = function() {
11298
- return root$4.Date.now();
11299
- };
11300
- var now_1 = now$2;
11301
- var reWhitespace$1 = /\s/;
11302
- function trimmedEndIndex$2(string2) {
11303
- var index2 = string2.length;
11304
- while (index2-- && reWhitespace$1.test(string2.charAt(index2))) {
11187
+ function _objectWithoutPropertiesLoose$n(source, excluded) {
11188
+ if (source == null)
11189
+ return {};
11190
+ var target = {};
11191
+ var sourceKeys = Object.keys(source);
11192
+ var key, i2;
11193
+ for (i2 = 0; i2 < sourceKeys.length; i2++) {
11194
+ key = sourceKeys[i2];
11195
+ if (excluded.indexOf(key) >= 0)
11196
+ continue;
11197
+ target[key] = source[key];
11305
11198
  }
11306
- return index2;
11307
- }
11308
- var _trimmedEndIndex = trimmedEndIndex$2;
11309
- var trimmedEndIndex$1 = _trimmedEndIndex;
11310
- var reTrimStart$1 = /^\s+/;
11311
- function baseTrim$2(string2) {
11312
- return string2 ? string2.slice(0, trimmedEndIndex$1(string2) + 1).replace(reTrimStart$1, "") : string2;
11199
+ return target;
11313
11200
  }
11314
- var _baseTrim = baseTrim$2;
11315
- function isObjectLike$2(value) {
11316
- return value != null && typeof value == "object";
11201
+ function LegendItem(_ref) {
11202
+ var _ref$flexDirection = _ref.flexDirection, flexDirection = _ref$flexDirection === void 0 ? "row" : _ref$flexDirection, _ref$alignItems = _ref.alignItems, alignItems = _ref$alignItems === void 0 ? "center" : _ref$alignItems, _ref$margin = _ref.margin, margin = _ref$margin === void 0 ? "0" : _ref$margin, _ref$display = _ref.display, display = _ref$display === void 0 ? "flex" : _ref$display, children2 = _ref.children, restProps = _objectWithoutPropertiesLoose$n(_ref, _excluded$n);
11203
+ return /* @__PURE__ */ React__default.createElement("div", _extends$A({
11204
+ className: "visx-legend-item",
11205
+ style: {
11206
+ display,
11207
+ alignItems,
11208
+ flexDirection,
11209
+ margin
11210
+ }
11211
+ }, restProps), children2);
11317
11212
  }
11318
- var isObjectLike_1 = isObjectLike$2;
11319
- var baseGetTag$1 = _baseGetTag, isObjectLike$1 = isObjectLike_1;
11320
- var symbolTag$1 = "[object Symbol]";
11321
- function isSymbol$2(value) {
11322
- return typeof value == "symbol" || isObjectLike$1(value) && baseGetTag$1(value) == symbolTag$1;
11213
+ LegendItem.propTypes = {
11214
+ alignItems: _pt.string,
11215
+ margin: _pt.oneOfType([_pt.string, _pt.number]),
11216
+ children: _pt.node,
11217
+ display: _pt.string
11218
+ };
11219
+ var _excluded$m = ["flex", "label", "margin", "align", "children"];
11220
+ function _extends$z() {
11221
+ _extends$z = Object.assign ? Object.assign.bind() : function(target) {
11222
+ for (var i2 = 1; i2 < arguments.length; i2++) {
11223
+ var source = arguments[i2];
11224
+ for (var key in source) {
11225
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11226
+ target[key] = source[key];
11227
+ }
11228
+ }
11229
+ }
11230
+ return target;
11231
+ };
11232
+ return _extends$z.apply(this, arguments);
11323
11233
  }
11324
- var isSymbol_1 = isSymbol$2;
11325
- var baseTrim$1 = _baseTrim, isObject$2 = isObject_1, isSymbol$1 = isSymbol_1;
11326
- var NAN$1 = 0 / 0;
11327
- var reIsBadHex$1 = /^[-+]0x[0-9a-f]+$/i;
11328
- var reIsBinary$1 = /^0b[01]+$/i;
11329
- var reIsOctal$1 = /^0o[0-7]+$/i;
11330
- var freeParseInt$1 = parseInt;
11331
- function toNumber$2(value) {
11332
- if (typeof value == "number") {
11333
- return value;
11334
- }
11335
- if (isSymbol$1(value)) {
11336
- return NAN$1;
11337
- }
11338
- if (isObject$2(value)) {
11339
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
11340
- value = isObject$2(other) ? other + "" : other;
11341
- }
11342
- if (typeof value != "string") {
11343
- return value === 0 ? value : +value;
11234
+ function _objectWithoutPropertiesLoose$m(source, excluded) {
11235
+ if (source == null)
11236
+ return {};
11237
+ var target = {};
11238
+ var sourceKeys = Object.keys(source);
11239
+ var key, i2;
11240
+ for (i2 = 0; i2 < sourceKeys.length; i2++) {
11241
+ key = sourceKeys[i2];
11242
+ if (excluded.indexOf(key) >= 0)
11243
+ continue;
11244
+ target[key] = source[key];
11344
11245
  }
11345
- value = baseTrim$1(value);
11346
- var isBinary = reIsBinary$1.test(value);
11347
- return isBinary || reIsOctal$1.test(value) ? freeParseInt$1(value.slice(2), isBinary ? 2 : 8) : reIsBadHex$1.test(value) ? NAN$1 : +value;
11246
+ return target;
11348
11247
  }
11349
- var toNumber_1 = toNumber$2;
11350
- var isObject$1 = isObject_1, now$1 = now_1, toNumber$1 = toNumber_1;
11351
- var FUNC_ERROR_TEXT = "Expected a function";
11352
- var nativeMax = Math.max, nativeMin$1 = Math.min;
11353
- function debounce(func, wait, options) {
11354
- var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
11355
- if (typeof func != "function") {
11356
- throw new TypeError(FUNC_ERROR_TEXT);
11357
- }
11358
- wait = toNumber$1(wait) || 0;
11359
- if (isObject$1(options)) {
11360
- leading = !!options.leading;
11361
- maxing = "maxWait" in options;
11362
- maxWait = maxing ? nativeMax(toNumber$1(options.maxWait) || 0, wait) : maxWait;
11363
- trailing = "trailing" in options ? !!options.trailing : trailing;
11364
- }
11365
- function invokeFunc(time2) {
11366
- var args = lastArgs, thisArg = lastThis;
11367
- lastArgs = lastThis = void 0;
11368
- lastInvokeTime = time2;
11369
- result = func.apply(thisArg, args);
11370
- return result;
11371
- }
11372
- function leadingEdge(time2) {
11373
- lastInvokeTime = time2;
11374
- timerId = setTimeout(timerExpired, wait);
11375
- return leading ? invokeFunc(time2) : result;
11376
- }
11377
- function remainingWait(time2) {
11378
- var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
11379
- return maxing ? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
11380
- }
11381
- function shouldInvoke(time2) {
11382
- var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
11383
- return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
11384
- }
11385
- function timerExpired() {
11386
- var time2 = now$1();
11387
- if (shouldInvoke(time2)) {
11388
- return trailingEdge(time2);
11248
+ function LegendLabel(_ref) {
11249
+ var _ref$flex = _ref.flex, flex = _ref$flex === void 0 ? "1" : _ref$flex, label = _ref.label, _ref$margin = _ref.margin, margin = _ref$margin === void 0 ? "5px 0" : _ref$margin, _ref$align = _ref.align, align2 = _ref$align === void 0 ? "left" : _ref$align, children2 = _ref.children, restProps = _objectWithoutPropertiesLoose$m(_ref, _excluded$m);
11250
+ return /* @__PURE__ */ React__default.createElement("div", _extends$z({
11251
+ className: "visx-legend-label",
11252
+ style: {
11253
+ justifyContent: align2,
11254
+ display: "flex",
11255
+ flex,
11256
+ margin
11389
11257
  }
11390
- timerId = setTimeout(timerExpired, remainingWait(time2));
11391
- }
11392
- function trailingEdge(time2) {
11393
- timerId = void 0;
11394
- if (trailing && lastArgs) {
11395
- return invokeFunc(time2);
11258
+ }, restProps), children2 || label);
11259
+ }
11260
+ LegendLabel.propTypes = {
11261
+ align: _pt.string,
11262
+ label: _pt.node,
11263
+ flex: _pt.oneOfType([_pt.string, _pt.number]),
11264
+ margin: _pt.oneOfType([_pt.string, _pt.number]),
11265
+ children: _pt.node
11266
+ };
11267
+ function _extends$y() {
11268
+ _extends$y = Object.assign ? Object.assign.bind() : function(target) {
11269
+ for (var i2 = 1; i2 < arguments.length; i2++) {
11270
+ var source = arguments[i2];
11271
+ for (var key in source) {
11272
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11273
+ target[key] = source[key];
11274
+ }
11275
+ }
11396
11276
  }
11397
- lastArgs = lastThis = void 0;
11398
- return result;
11399
- }
11400
- function cancel() {
11401
- if (timerId !== void 0) {
11402
- clearTimeout(timerId);
11277
+ return target;
11278
+ };
11279
+ return _extends$y.apply(this, arguments);
11280
+ }
11281
+ function ShapeRect(_ref) {
11282
+ var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11283
+ return /* @__PURE__ */ React__default.createElement("div", {
11284
+ style: _extends$y({
11285
+ width,
11286
+ height,
11287
+ background: fill
11288
+ }, style2)
11289
+ });
11290
+ }
11291
+ ShapeRect.propTypes = {
11292
+ fill: _pt.string,
11293
+ width: _pt.oneOfType([_pt.string, _pt.number]),
11294
+ height: _pt.oneOfType([_pt.string, _pt.number])
11295
+ };
11296
+ function ShapeCircle(_ref) {
11297
+ var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11298
+ var cleanWidth = typeof width === "string" || typeof width === "undefined" ? 0 : width;
11299
+ var cleanHeight = typeof height === "string" || typeof height === "undefined" ? 0 : height;
11300
+ var size = Math.max(cleanWidth, cleanHeight);
11301
+ var radius = size / 2;
11302
+ return /* @__PURE__ */ React__default.createElement("svg", {
11303
+ width: size,
11304
+ height: size
11305
+ }, /* @__PURE__ */ React__default.createElement(Group, {
11306
+ top: radius,
11307
+ left: radius
11308
+ }, /* @__PURE__ */ React__default.createElement("circle", {
11309
+ r: radius,
11310
+ fill,
11311
+ style: style2
11312
+ })));
11313
+ }
11314
+ ShapeCircle.propTypes = {
11315
+ fill: _pt.string,
11316
+ width: _pt.oneOfType([_pt.string, _pt.number]),
11317
+ height: _pt.oneOfType([_pt.string, _pt.number])
11318
+ };
11319
+ function ShapeLine(_ref) {
11320
+ var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11321
+ var cleanHeight = typeof height === "string" || typeof height === "undefined" ? 0 : height;
11322
+ var lineThickness = typeof (style2 == null ? void 0 : style2.strokeWidth) === "number" ? style2 == null ? void 0 : style2.strokeWidth : 2;
11323
+ return /* @__PURE__ */ React__default.createElement("svg", {
11324
+ width,
11325
+ height
11326
+ }, /* @__PURE__ */ React__default.createElement(Group, {
11327
+ top: cleanHeight / 2 - lineThickness / 2
11328
+ }, /* @__PURE__ */ React__default.createElement("line", {
11329
+ x1: 0,
11330
+ x2: width,
11331
+ y1: 0,
11332
+ y2: 0,
11333
+ stroke: fill,
11334
+ strokeWidth: lineThickness,
11335
+ style: style2
11336
+ })));
11337
+ }
11338
+ ShapeLine.propTypes = {
11339
+ fill: _pt.string,
11340
+ width: _pt.oneOfType([_pt.string, _pt.number]),
11341
+ height: _pt.oneOfType([_pt.string, _pt.number])
11342
+ };
11343
+ function _extends$x() {
11344
+ _extends$x = Object.assign ? Object.assign.bind() : function(target) {
11345
+ for (var i2 = 1; i2 < arguments.length; i2++) {
11346
+ var source = arguments[i2];
11347
+ for (var key in source) {
11348
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11349
+ target[key] = source[key];
11350
+ }
11351
+ }
11403
11352
  }
11404
- lastInvokeTime = 0;
11405
- lastArgs = lastCallTime = lastThis = timerId = void 0;
11353
+ return target;
11354
+ };
11355
+ return _extends$x.apply(this, arguments);
11356
+ }
11357
+ var NO_OP = function NO_OP2() {
11358
+ return void 0;
11359
+ };
11360
+ function renderShape(_ref) {
11361
+ var _ref$shape = _ref.shape, shape = _ref$shape === void 0 ? "rect" : _ref$shape, _ref$fill = _ref.fill, fill = _ref$fill === void 0 ? NO_OP : _ref$fill, _ref$size = _ref.size, size = _ref$size === void 0 ? NO_OP : _ref$size, width = _ref.width, height = _ref.height, label = _ref.label, item = _ref.item, itemIndex = _ref.itemIndex, _ref$shapeStyle = _ref.shapeStyle, shapeStyle = _ref$shapeStyle === void 0 ? NO_OP : _ref$shapeStyle;
11362
+ var props = {
11363
+ width,
11364
+ height,
11365
+ item,
11366
+ itemIndex,
11367
+ label,
11368
+ fill: fill(_extends$x({}, label)),
11369
+ size: size(_extends$x({}, label)),
11370
+ style: shapeStyle(_extends$x({}, label))
11371
+ };
11372
+ if (typeof shape === "string") {
11373
+ if (shape === "circle") {
11374
+ return /* @__PURE__ */ React__default.createElement(ShapeCircle, props);
11375
+ }
11376
+ if (shape === "line") {
11377
+ return /* @__PURE__ */ React__default.createElement(ShapeLine, props);
11378
+ }
11379
+ return /* @__PURE__ */ React__default.createElement(ShapeRect, props);
11406
11380
  }
11407
- function flush() {
11408
- return timerId === void 0 ? result : trailingEdge(now$1());
11381
+ if (/* @__PURE__ */ React__default.isValidElement(shape)) {
11382
+ return /* @__PURE__ */ React__default.cloneElement(shape, props);
11409
11383
  }
11410
- function debounced() {
11411
- var time2 = now$1(), isInvoking = shouldInvoke(time2);
11412
- lastArgs = arguments;
11413
- lastThis = this;
11414
- lastCallTime = time2;
11415
- if (isInvoking) {
11416
- if (timerId === void 0) {
11417
- return leadingEdge(lastCallTime);
11418
- }
11419
- if (maxing) {
11420
- clearTimeout(timerId);
11421
- timerId = setTimeout(timerExpired, wait);
11422
- return invokeFunc(lastCallTime);
11384
+ if (shape) {
11385
+ return /* @__PURE__ */ React__default.createElement(shape, props);
11386
+ }
11387
+ return null;
11388
+ }
11389
+ function _extends$w() {
11390
+ _extends$w = Object.assign ? Object.assign.bind() : function(target) {
11391
+ for (var i2 = 1; i2 < arguments.length; i2++) {
11392
+ var source = arguments[i2];
11393
+ for (var key in source) {
11394
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11395
+ target[key] = source[key];
11396
+ }
11423
11397
  }
11424
11398
  }
11425
- if (timerId === void 0) {
11426
- timerId = setTimeout(timerExpired, wait);
11399
+ return target;
11400
+ };
11401
+ return _extends$w.apply(this, arguments);
11402
+ }
11403
+ function LegendShape(_ref) {
11404
+ var _ref$shape = _ref.shape, shape = _ref$shape === void 0 ? ShapeRect : _ref$shape, width = _ref.width, height = _ref.height, margin = _ref.margin, label = _ref.label, item = _ref.item, itemIndex = _ref.itemIndex, fill = _ref.fill, size = _ref.size, shapeStyle = _ref.shapeStyle;
11405
+ return /* @__PURE__ */ React__default.createElement("div", {
11406
+ className: "visx-legend-shape",
11407
+ style: {
11408
+ display: "flex",
11409
+ width: size ? size(_extends$w({}, label)) : width,
11410
+ height: size ? size(_extends$w({}, label)) : height,
11411
+ margin
11427
11412
  }
11428
- return result;
11429
- }
11430
- debounced.cancel = cancel;
11431
- debounced.flush = flush;
11432
- return debounced;
11413
+ }, renderShape({
11414
+ shape,
11415
+ item,
11416
+ itemIndex,
11417
+ label,
11418
+ width,
11419
+ height,
11420
+ fill,
11421
+ shapeStyle
11422
+ }));
11433
11423
  }
11434
- var debounce_1 = debounce;
11435
- var debounce$1 = debounce_1;
11436
- var _excluded$n = ["className", "children", "debounceTime", "ignoreDimensions", "parentSizeStyles", "enableDebounceLeadingCall", "resizeObserverPolyfill"];
11437
- function _extends$A() {
11438
- _extends$A = Object.assign ? Object.assign.bind() : function(target) {
11424
+ LegendShape.propTypes = {
11425
+ itemIndex: _pt.number.isRequired,
11426
+ margin: _pt.oneOfType([_pt.string, _pt.number]),
11427
+ width: _pt.oneOfType([_pt.string, _pt.number]),
11428
+ height: _pt.oneOfType([_pt.string, _pt.number])
11429
+ };
11430
+ function valueOrIdentity(_2) {
11431
+ if (_2 && typeof _2 === "object" && "value" in _2 && typeof _2.value !== "undefined")
11432
+ return _2.value;
11433
+ return _2;
11434
+ }
11435
+ function valueOrIdentityString(_2) {
11436
+ return String(valueOrIdentity(_2));
11437
+ }
11438
+ function labelTransformFactory(_ref) {
11439
+ var scale = _ref.scale, labelFormat = _ref.labelFormat;
11440
+ return function(d2, i2) {
11441
+ return {
11442
+ datum: d2,
11443
+ index: i2,
11444
+ text: "" + labelFormat(d2, i2),
11445
+ value: scale(d2)
11446
+ };
11447
+ };
11448
+ }
11449
+ var _excluded$l = ["className", "style", "scale", "shape", "domain", "fill", "size", "labelFormat", "labelTransform", "shapeWidth", "shapeHeight", "shapeMargin", "shapeStyle", "labelAlign", "labelFlex", "labelMargin", "itemMargin", "direction", "itemDirection", "legendLabelProps", "children"];
11450
+ function _extends$v() {
11451
+ _extends$v = Object.assign ? Object.assign.bind() : function(target) {
11439
11452
  for (var i2 = 1; i2 < arguments.length; i2++) {
11440
11453
  var source = arguments[i2];
11441
11454
  for (var key in source) {
@@ -11446,9 +11459,9 @@ function _extends$A() {
11446
11459
  }
11447
11460
  return target;
11448
11461
  };
11449
- return _extends$A.apply(this, arguments);
11462
+ return _extends$v.apply(this, arguments);
11450
11463
  }
11451
- function _objectWithoutPropertiesLoose$n(source, excluded) {
11464
+ function _objectWithoutPropertiesLoose$l(source, excluded) {
11452
11465
  if (source == null)
11453
11466
  return {};
11454
11467
  var target = {};
@@ -11462,438 +11475,389 @@ function _objectWithoutPropertiesLoose$n(source, excluded) {
11462
11475
  }
11463
11476
  return target;
11464
11477
  }
11465
- var defaultIgnoreDimensions$1 = [];
11466
- var defaultParentSizeStyles$1 = {
11467
- width: "100%",
11468
- height: "100%"
11478
+ var defaultStyle = {
11479
+ display: "flex"
11469
11480
  };
11470
- function ParentSize$1(_ref) {
11471
- var className = _ref.className, children2 = _ref.children, _ref$debounceTime = _ref.debounceTime, debounceTime = _ref$debounceTime === void 0 ? 300 : _ref$debounceTime, _ref$ignoreDimensions = _ref.ignoreDimensions, ignoreDimensions = _ref$ignoreDimensions === void 0 ? defaultIgnoreDimensions$1 : _ref$ignoreDimensions, _ref$parentSizeStyles = _ref.parentSizeStyles, parentSizeStyles = _ref$parentSizeStyles === void 0 ? defaultParentSizeStyles$1 : _ref$parentSizeStyles, _ref$enableDebounceLe = _ref.enableDebounceLeadingCall, enableDebounceLeadingCall = _ref$enableDebounceLe === void 0 ? true : _ref$enableDebounceLe, resizeObserverPolyfill = _ref.resizeObserverPolyfill, restProps = _objectWithoutPropertiesLoose$n(_ref, _excluded$n);
11472
- var target = useRef(null);
11473
- var animationFrameID = useRef(0);
11474
- var _useState = useState({
11475
- width: 0,
11476
- height: 0,
11477
- top: 0,
11478
- left: 0
11479
- }), state = _useState[0], setState = _useState[1];
11480
- var resize = useMemo(function() {
11481
- var normalized = Array.isArray(ignoreDimensions) ? ignoreDimensions : [ignoreDimensions];
11482
- return debounce$1(function(incoming) {
11483
- setState(function(existing) {
11484
- var stateKeys = Object.keys(existing);
11485
- var keysWithChanges = stateKeys.filter(function(key) {
11486
- return existing[key] !== incoming[key];
11487
- });
11488
- var shouldBail = keysWithChanges.every(function(key) {
11489
- return normalized.includes(key);
11490
- });
11491
- return shouldBail ? existing : incoming;
11492
- });
11493
- }, debounceTime, {
11494
- leading: enableDebounceLeadingCall
11495
- });
11496
- }, [debounceTime, enableDebounceLeadingCall, ignoreDimensions]);
11497
- useEffect(function() {
11498
- var LocalResizeObserver = resizeObserverPolyfill || window.ResizeObserver;
11499
- var observer = new LocalResizeObserver(function(entries) {
11500
- entries.forEach(function(entry) {
11501
- var _entry$contentRect;
11502
- var _ref2 = (_entry$contentRect = entry == null ? void 0 : entry.contentRect) != null ? _entry$contentRect : {}, left2 = _ref2.left, top2 = _ref2.top, width = _ref2.width, height = _ref2.height;
11503
- animationFrameID.current = window.requestAnimationFrame(function() {
11504
- resize({
11505
- width,
11506
- height,
11507
- top: top2,
11508
- left: left2
11509
- });
11510
- });
11511
- });
11512
- });
11513
- if (target.current)
11514
- observer.observe(target.current);
11515
- return function() {
11516
- window.cancelAnimationFrame(animationFrameID.current);
11517
- observer.disconnect();
11518
- resize.cancel();
11519
- };
11520
- }, [resize, resizeObserverPolyfill]);
11521
- return /* @__PURE__ */ jsx("div", {
11522
- style: parentSizeStyles,
11523
- ref: target,
11524
- className,
11525
- ...restProps,
11526
- children: children2(_extends$A({}, state, {
11527
- ref: target.current,
11528
- resize
11529
- }))
11481
+ function Legend$1(_ref) {
11482
+ var className = _ref.className, _ref$style = _ref.style, style2 = _ref$style === void 0 ? defaultStyle : _ref$style, scale = _ref.scale, shape = _ref.shape, inputDomain = _ref.domain, _ref$fill = _ref.fill, fill = _ref$fill === void 0 ? valueOrIdentityString : _ref$fill, _ref$size = _ref.size, size = _ref$size === void 0 ? valueOrIdentityString : _ref$size, _ref$labelFormat = _ref.labelFormat, labelFormat = _ref$labelFormat === void 0 ? valueOrIdentity : _ref$labelFormat, _ref$labelTransform = _ref.labelTransform, labelTransform = _ref$labelTransform === void 0 ? labelTransformFactory : _ref$labelTransform, _ref$shapeWidth = _ref.shapeWidth, shapeWidth = _ref$shapeWidth === void 0 ? 15 : _ref$shapeWidth, _ref$shapeHeight = _ref.shapeHeight, shapeHeight = _ref$shapeHeight === void 0 ? 15 : _ref$shapeHeight, _ref$shapeMargin = _ref.shapeMargin, shapeMargin = _ref$shapeMargin === void 0 ? "2px 4px 2px 0" : _ref$shapeMargin, shapeStyle = _ref.shapeStyle, _ref$labelAlign = _ref.labelAlign, labelAlign = _ref$labelAlign === void 0 ? "left" : _ref$labelAlign, _ref$labelFlex = _ref.labelFlex, labelFlex = _ref$labelFlex === void 0 ? "1" : _ref$labelFlex, _ref$labelMargin = _ref.labelMargin, labelMargin = _ref$labelMargin === void 0 ? "0 4px" : _ref$labelMargin, _ref$itemMargin = _ref.itemMargin, itemMargin = _ref$itemMargin === void 0 ? "0" : _ref$itemMargin, _ref$direction = _ref.direction, direction = _ref$direction === void 0 ? "column" : _ref$direction, _ref$itemDirection = _ref.itemDirection, itemDirection = _ref$itemDirection === void 0 ? "row" : _ref$itemDirection, legendLabelProps = _ref.legendLabelProps, children2 = _ref.children, legendItemProps = _objectWithoutPropertiesLoose$l(_ref, _excluded$l);
11483
+ var domain2 = inputDomain || ("domain" in scale ? scale.domain() : []);
11484
+ var labelFormatter = labelTransform({
11485
+ scale,
11486
+ labelFormat
11530
11487
  });
11488
+ var labels = domain2.map(labelFormatter);
11489
+ if (children2)
11490
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children2(labels));
11491
+ return /* @__PURE__ */ React__default.createElement("div", {
11492
+ className: cx("visx-legend", className),
11493
+ style: _extends$v({}, style2, {
11494
+ flexDirection: direction
11495
+ })
11496
+ }, labels.map(function(label, i2) {
11497
+ return /* @__PURE__ */ React__default.createElement(LegendItem, _extends$v({
11498
+ key: "legend-" + label.text + "-" + i2,
11499
+ margin: itemMargin,
11500
+ flexDirection: itemDirection
11501
+ }, legendItemProps), /* @__PURE__ */ React__default.createElement(LegendShape, {
11502
+ shape,
11503
+ height: shapeHeight,
11504
+ width: shapeWidth,
11505
+ margin: shapeMargin,
11506
+ item: domain2[i2],
11507
+ itemIndex: i2,
11508
+ label,
11509
+ fill,
11510
+ size,
11511
+ shapeStyle
11512
+ }), /* @__PURE__ */ React__default.createElement(LegendLabel, _extends$v({
11513
+ label: label.text,
11514
+ flex: labelFlex,
11515
+ margin: labelMargin,
11516
+ align: labelAlign
11517
+ }, legendLabelProps)));
11518
+ }));
11531
11519
  }
11532
- ParentSize$1.propTypes = {
11520
+ Legend$1.propTypes = {
11521
+ children: _pt.func,
11533
11522
  className: _pt.string,
11534
- debounceTime: _pt.number,
11535
- enableDebounceLeadingCall: _pt.bool,
11536
- ignoreDimensions: _pt.oneOfType([_pt.any, _pt.arrayOf(_pt.any)]),
11537
- children: _pt.func.isRequired
11523
+ domain: _pt.array,
11524
+ shapeWidth: _pt.oneOfType([_pt.string, _pt.number]),
11525
+ shapeHeight: _pt.oneOfType([_pt.string, _pt.number]),
11526
+ shapeMargin: _pt.oneOfType([_pt.string, _pt.number]),
11527
+ labelAlign: _pt.string,
11528
+ labelFlex: _pt.oneOfType([_pt.string, _pt.number]),
11529
+ labelMargin: _pt.oneOfType([_pt.string, _pt.number]),
11530
+ itemMargin: _pt.oneOfType([_pt.string, _pt.number]),
11531
+ fill: _pt.func,
11532
+ size: _pt.func,
11533
+ shapeStyle: _pt.func
11538
11534
  };
11539
- const Product1 = [
11540
- { x: "a", y: 100 },
11541
- { x: "b", y: 50 },
11542
- { x: "c", y: 100 },
11543
- { x: "d", y: 80 },
11544
- { x: "f", y: 100 },
11545
- { x: "g", y: 50 }
11546
- ];
11547
- const finalDataProvider = (type2, value) => {
11548
- var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s, _t2, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E;
11549
- switch (type2) {
11550
- case "BarGraph":
11551
- return {
11552
- main: {
11553
- type: "barGraph",
11554
- data: ((_a2 = value == null ? void 0 : value.main) == null ? void 0 : _a2.data) || [{ x: "ASM", y: 100 }, { x: "SDM", y: 60 }, { x: "DCM", y: 40 }, { x: "RCM", y: 70 }],
11555
- header: "Bar Graph",
11556
- bottomLabel: "Name of Employe",
11557
- numTicks: 6,
11558
- leftLabel: "Value",
11559
- axisLeft: true,
11560
- axisBottom: true,
11561
- hideTicks: true,
11562
- hideLeftAxisLine: false,
11563
- hideBottomAxisLine: false,
11564
- bottomAxisWidth: "10px",
11565
- ...value.main
11566
- },
11567
- style: {
11568
- containerStyle: {
11569
- background: "white",
11570
- width: "90%",
11571
- height: "300",
11572
- borderRadius: "20px",
11573
- padding: "10px 0 2px 0",
11574
- ...(_b2 = value == null ? void 0 : value.style) == null ? void 0 : _b2.containerStyle
11575
- },
11576
- headerStyle: {
11577
- fontWeight: 500,
11578
- textAlign: "left",
11579
- fontFamily: "inherit",
11580
- marginBottom: "20px",
11581
- padding: "15px 0 1px 20px",
11582
- width: "100%",
11583
- fontSize: "18px",
11584
- ...(_c2 = value == null ? void 0 : value.style) == null ? void 0 : _c2.headerStyle
11585
- },
11586
- tooltipStyle: {
11587
- padding: "6px",
11588
- borderRadius: "2px",
11589
- ...(_d = value == null ? void 0 : value.style) == null ? void 0 : _d.tooltipStyle
11590
- },
11591
- labelStyle: {
11592
- leftLabelMargin: "75",
11593
- topLabelMargin: "-6",
11594
- labelColor: "black",
11595
- leftLabelOffset: 50,
11596
- bottomLabelOffset: 10,
11597
- tickLabelColor: "balck",
11598
- tickFontSize: "10px",
11599
- tickColor: "black",
11600
- rightAxisWidth: "0.3px",
11601
- fontSize: "10px",
11602
- ...(_e2 = value == null ? void 0 : value.style) == null ? void 0 : _e2.labelStyle
11603
- },
11604
- barStyle: {
11605
- mediumValueColor: "rgba(63, 81, 181, 0.85)",
11606
- highValueColor: "rgba(63, 81, 181, 0.85)",
11607
- lowValueColor: "rgba(63, 81, 181, 0.85)",
11608
- ...(_f = value == null ? void 0 : value.style) == null ? void 0 : _f.barStyle
11609
- }
11610
- }
11611
- };
11612
- case "PieGraph":
11613
- return {
11614
- main: {
11615
- data: ((_g = value == null ? void 0 : value.main) == null ? void 0 : _g.data) || [{ branch: "Kotak", value: 500 }, { branch: "SBI", value: 700 }, { branch: "HDFC", value: 900 }],
11616
- header: "Pie Graph",
11617
- bottomLabel: "Name of Employe",
11618
- leftLabel: "Value",
11619
- tooltipDataKey: ["First", "Second", "Third"],
11620
- axisLeft: true,
11621
- axisBottom: true,
11622
- legendAvailable: true,
11623
- ...value == null ? void 0 : value.main,
11624
- legend: {
11625
- labelColor: "green",
11626
- legendTitle: "Our Assests",
11627
- direction: "row",
11628
- align: "right",
11629
- ...(_h = value == null ? void 0 : value.main) == null ? void 0 : _h.legend
11630
- }
11631
- },
11632
- style: {
11633
- containerStyle: {
11634
- background: "white",
11635
- width: "100%",
11636
- height: "310",
11637
- borderRadius: "20px",
11638
- padding: "10px 0 2px 0",
11639
- ...(_i = value == null ? void 0 : value.style) == null ? void 0 : _i.containerStyle
11640
- },
11641
- headerStyle: {
11642
- fontWeight: 500,
11643
- textAlign: "left",
11644
- fontFamily: "inherit",
11645
- marginBottom: "20px",
11646
- padding: "15px 0 1px 20px",
11647
- width: "100%",
11648
- fontSize: "18px",
11649
- ...(_j = value == null ? void 0 : value.style) == null ? void 0 : _j.headerStyle
11650
- },
11651
- tooltipStyle: {
11652
- ...(_k = value == null ? void 0 : value.style) == null ? void 0 : _k.tooltipStyle
11653
- },
11654
- labelStyle: {
11655
- labelColor: "black",
11656
- labelOffset: 45,
11657
- leftLabelMargin: "70",
11658
- topLabelMargin: "-40",
11659
- ...(_l = value == null ? void 0 : value.style) == null ? void 0 : _l.labelStyle
11535
+ function Ordinal(props) {
11536
+ return /* @__PURE__ */ React__default.createElement(Legend$1, props);
11537
+ }
11538
+ function Legend({
11539
+ value
11540
+ }) {
11541
+ var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k;
11542
+ const legendGlyphSize = ((_b2 = (_a2 = value == null ? void 0 : value.main) == null ? void 0 : _a2.legend) == null ? void 0 : _b2.colorRectWidth) || 15;
11543
+ const ordinalColorScale = createOrdinalScale$1({
11544
+ domain: (_c2 = value == null ? void 0 : value.main) == null ? void 0 : _c2.tooltipDataKey,
11545
+ range: (_e2 = (_d = value == null ? void 0 : value.style) == null ? void 0 : _d.pieStyle) == null ? void 0 : _e2.colorRange
11546
+ });
11547
+ return /* @__PURE__ */ jsxs("div", {
11548
+ className: "legend",
11549
+ style: (_g = (_f = value == null ? void 0 : value.style) == null ? void 0 : _f.legendStyle) == null ? void 0 : _g.legend,
11550
+ children: [/* @__PURE__ */ jsx("div", {
11551
+ className: "title",
11552
+ style: (_i = (_h = value == null ? void 0 : value.style) == null ? void 0 : _h.legendStyle) == null ? void 0 : _i.legendTitle,
11553
+ children: (_k = (_j = value == null ? void 0 : value.main) == null ? void 0 : _j.legend) == null ? void 0 : _k.legendTitle
11554
+ }), /* @__PURE__ */ jsx(Ordinal, {
11555
+ scale: ordinalColorScale,
11556
+ labelFormat: (label) => `${label.toUpperCase()}`,
11557
+ children: (labels) => {
11558
+ var _a3, _b3;
11559
+ return /* @__PURE__ */ jsx("div", {
11560
+ style: {
11561
+ display: "flex",
11562
+ flexDirection: ((_b3 = (_a3 = value == null ? void 0 : value.main) == null ? void 0 : _a3.legend) == null ? void 0 : _b3.direction) || "row"
11660
11563
  },
11661
- legendStyle: {
11662
- legend: {
11663
- lineHeight: "0.9em",
11664
- color: "black",
11665
- fontSize: "10px",
11666
- fontFamily: "arial",
11667
- padding: "10px 10px",
11668
- float: "left",
11669
- border: "1px solid rgba(255, 255, 255, 0.3)",
11670
- borderRadius: " 8px",
11671
- margin: "5px 5px",
11672
- ...(_n2 = (_m = value == null ? void 0 : value.style) == null ? void 0 : _m.legendStyle) == null ? void 0 : _n2.legend
11673
- },
11674
- legendTitle: {
11675
- fontWeight: 500,
11676
- marginBottom: "5px",
11677
- fontFamily: "roboto",
11678
- fontSize: "10px",
11679
- ...(_p = (_o = value == null ? void 0 : value.style) == null ? void 0 : _o.legendStyle) == null ? void 0 : _p.legendTitle
11680
- }
11681
- },
11682
- pieStyle: {
11683
- colorRange: ["#3f51b5", "rgba(200,0,31,0.9)", "rgba(25,200,205,0.6)"],
11684
- outerRadius: 120,
11685
- innerRadius: 60,
11686
- cornerRadius: 2,
11687
- padAngle: 6e-3,
11688
- ...(_q = value == null ? void 0 : value.style) == null ? void 0 : _q.pieStyle
11689
- }
11690
- }
11691
- };
11692
- case "LineGraph":
11693
- return {
11694
- main: {
11695
- data: ((_r = value == null ? void 0 : value.main) == null ? void 0 : _r.data) || [Product1],
11696
- header: "Line Graph Dynamic",
11697
- bottomLabel: "Name of Employe",
11698
- leftLabel: "Value",
11699
- gridHidden: true,
11700
- numHidden: false,
11701
- tooltipDataKey: ["MAMA New Project", "Second", "Third"],
11702
- axisLeft: true,
11703
- axisBottom: true,
11704
- hideLeftAxisLine: false,
11705
- hideBottomAxisLine: false,
11706
- ...value == null ? void 0 : value.main,
11707
- legend: {
11708
- labelColor: "green",
11709
- legendTitle: "Our Assests",
11710
- direction: "row",
11711
- align: "right",
11712
- colorRectWidth: 20,
11713
- ...(_s = value == null ? void 0 : value.main) == null ? void 0 : _s.legend
11714
- }
11715
- },
11716
- style: {
11717
- containerStyle: {
11718
- background: "white",
11719
- width: "90%",
11720
- height: "300",
11721
- borderRadius: "20px",
11722
- padding: "10px 0 2px 0",
11723
- ...(_t2 = value == null ? void 0 : value.style) == null ? void 0 : _t2.containerStyle
11724
- },
11725
- headerStyle: {
11726
- fontWeight: 500,
11727
- textAlign: "left",
11728
- fontFamily: "inherit",
11729
- marginBottom: "20px",
11730
- padding: "15px 0 1px 20px",
11731
- width: "100%",
11732
- fontSize: "18px",
11733
- ...(_u = value == null ? void 0 : value.style) == null ? void 0 : _u.headerStyle
11734
- },
11735
- labelStyle: {
11736
- labelColor: "black",
11737
- bottomLabelOffset: 20,
11738
- leftLabelOffset: 50,
11739
- leftLabelMargin: 80,
11740
- ...(_v = value == null ? void 0 : value.style) == null ? void 0 : _v.labelStyle
11741
- },
11742
- lineStyle: {
11743
- colorRange: ["#3f51b5", "rgba(200,0,31,0.9)", "rgba(25,200,205,0.6)"],
11744
- lineAreaColor: "none",
11745
- lineAreaOpacity: 0.2,
11746
- ...(_w = value == null ? void 0 : value.style) == null ? void 0 : _w.lineStyle
11747
- }
11748
- }
11749
- };
11750
- case "HorizontalBarGraph":
11751
- return {
11752
- main: {
11753
- data: ((_x = value == null ? void 0 : value.main) == null ? void 0 : _x.data) || [{ y: "Anant Sharma", x: 60 }, { y: "Pankaj Chauhan", x: 60 }, { y: "satendra Raghav", x: 150 }, { y: "Vivek Pahadi", x: 80 }, { y: "Siddarth verma", x: 100 }],
11754
- header: " ",
11755
- bottomLabel: "Name of Employe",
11756
- leftLabel: "Value",
11757
- axisLeft: true,
11758
- axisBottom: true,
11759
- hideBottomTicks: false,
11760
- hideLeftTicks: ((_y = value == null ? void 0 : value.main) == null ? void 0 : _y.data) ? true : false,
11761
- hideLeftAxisLine: ((_z = value == null ? void 0 : value.main) == null ? void 0 : _z.data) ? true : false,
11762
- hideBottomAxisLine: false,
11763
- bottomAxisWidth: "10px",
11764
- ...value.main
11765
- },
11766
- style: {
11767
- containerStyle: {
11768
- background: "white",
11769
- width: "90%",
11770
- height: "300",
11771
- borderRadius: "20px",
11772
- padding: "10px 0 2px 0",
11773
- ...(_A = value == null ? void 0 : value.style) == null ? void 0 : _A.containerStyle
11774
- },
11775
- headerStyle: {
11776
- fontWeight: 500,
11777
- textAlign: "left",
11778
- fontFamily: "inherit",
11779
- marginBottom: "20px",
11780
- padding: "15px 0 1px 20px",
11781
- width: "100%",
11782
- fontSize: "18px",
11783
- ...(_B = value == null ? void 0 : value.style) == null ? void 0 : _B.headerStyle
11784
- },
11785
- tooltipStyle: {
11786
- padding: "6px",
11787
- borderRadius: "2px",
11788
- ...(_C = value == null ? void 0 : value.style) == null ? void 0 : _C.tooltipStyle
11789
- },
11790
- labelStyle: {
11791
- margin: { top: 10, left: 110, right: 40, bottom: 40 },
11792
- tickLabelColor: "#6c5efb",
11793
- leftLabelOffset: 140,
11794
- bottomLabelOffset: 14,
11795
- tickFontSize: "10px",
11796
- tickColor: "#6c5efb",
11797
- rightAxisWidth: "0.3px",
11798
- fontSize: "10px",
11799
- ...(_D = value == null ? void 0 : value.style) == null ? void 0 : _D.labelStyle
11800
- },
11801
- barStyle: {
11802
- color: "#6c5efb",
11803
- ...(_E = value == null ? void 0 : value.style) == null ? void 0 : _E.barStyle
11804
- }
11805
- }
11806
- };
11807
- }
11564
+ children: labels.map((label, i2) => {
11565
+ var _a4, _b4;
11566
+ return /* @__PURE__ */ jsxs(LegendItem, {
11567
+ margin: "0 5px",
11568
+ onClick: (events) => {
11569
+ if (events)
11570
+ alert(`clicked: ${JSON.stringify(label)}`);
11571
+ },
11572
+ children: [/* @__PURE__ */ jsx("svg", {
11573
+ width: legendGlyphSize,
11574
+ height: legendGlyphSize,
11575
+ children: /* @__PURE__ */ jsx("rect", {
11576
+ fill: label.value,
11577
+ width: legendGlyphSize,
11578
+ height: legendGlyphSize
11579
+ })
11580
+ }), /* @__PURE__ */ jsx(LegendLabel, {
11581
+ align: `${((_b4 = (_a4 = value == null ? void 0 : value.main) == null ? void 0 : _a4.legend) == null ? void 0 : _b4.align) || "left"}`,
11582
+ margin: "0 0 0 4px",
11583
+ children: label.text
11584
+ })]
11585
+ }, `legend-quantile-${i2}`);
11586
+ })
11587
+ });
11588
+ }
11589
+ })]
11590
+ });
11591
+ }
11592
+ const defaultMargin = {
11593
+ top: 20,
11594
+ right: 0,
11595
+ bottom: 40,
11596
+ left: 40
11808
11597
  };
11809
- const BarGraph = ({
11598
+ function DrawBarGraph({
11599
+ width,
11600
+ height,
11601
+ events = false,
11602
+ margin = defaultMargin,
11810
11603
  value
11811
- }) => {
11812
- var _a2, _b2, _c2, _d;
11813
- const barData = finalDataProvider("BarGraph", value);
11814
- let GraphRender = /* @__PURE__ */ jsx(ParentSize$1, {
11815
- children: (parent) => {
11816
- var _a3, _b3, _c3, _d2, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2;
11817
- return /* @__PURE__ */ jsx(DrawBarGraph, {
11818
- width: parent.width || 400,
11819
- height: ((_b3 = (_a3 = barData == null ? void 0 : barData.style) == null ? void 0 : _a3.containerStyle) == null ? void 0 : _b3.height) | 400,
11820
- margin: {
11821
- top: ((_e2 = (_d2 = (_c3 = barData == null ? void 0 : barData.style) == null ? void 0 : _c3.labelStyle) == null ? void 0 : _d2.margin) == null ? void 0 : _e2.top) || 10,
11822
- right: ((_h = (_g = (_f = barData == null ? void 0 : barData.style) == null ? void 0 : _f.labelStyle) == null ? void 0 : _g.margin) == null ? void 0 : _h.right) || 10,
11823
- bottom: ((_k = (_j = (_i = barData == null ? void 0 : barData.style) == null ? void 0 : _i.labelStyle) == null ? void 0 : _j.margin) == null ? void 0 : _k.bottom) || 20,
11824
- left: ((_n2 = (_m = (_l = barData == null ? void 0 : barData.style) == null ? void 0 : _l.labelStyle) == null ? void 0 : _m.margin) == null ? void 0 : _n2.left) || 60
11825
- },
11826
- value: barData
11827
- });
11828
- }
11604
+ }) {
11605
+ var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k;
11606
+ const data = (_a2 = value.main) == null ? void 0 : _a2.data;
11607
+ const keys2 = Object.keys(data[0]).filter((d2) => d2 !== "label");
11608
+ const getDate = (d2) => d2.label;
11609
+ const dateScale = createBandScale({
11610
+ domain: data.map(getDate),
11611
+ padding: 0.2
11829
11612
  });
11830
- return /* @__PURE__ */ jsxs("div", {
11831
- style: (_a2 = barData == null ? void 0 : barData.style) == null ? void 0 : _a2.containerStyle,
11832
- children: [((_b2 = barData == null ? void 0 : barData.main) == null ? void 0 : _b2.header) && /* @__PURE__ */ jsx("div", {
11833
- style: {
11834
- fontWeight: 500,
11835
- textAlign: "left",
11836
- fontFamily: "inherit",
11837
- marginBottom: "20px",
11838
- padding: "15px 0 1px 20px",
11839
- fontSize: "18px",
11840
- color: "#121926",
11841
- ...(_c2 = barData == null ? void 0 : barData.style) == null ? void 0 : _c2.headerStyle
11842
- },
11843
- children: (_d = barData == null ? void 0 : barData.main) == null ? void 0 : _d.header
11844
- }), GraphRender]
11613
+ const cityScale = createBandScale({
11614
+ domain: keys2,
11615
+ padding: 0.1
11616
+ });
11617
+ const tempScale = createLinearScale({
11618
+ domain: [0, Math.max(...data.map((d2) => Math.max(...keys2.map((key) => Number(d2[key])))))]
11619
+ });
11620
+ const colorScale = createOrdinalScale$1({
11621
+ domain: keys2,
11622
+ range: [((_d = (_c2 = (_b2 = value.style) == null ? void 0 : _b2.barStyle) == null ? void 0 : _c2.color) == null ? void 0 : _d.firstBarColor) || "#aeeef8", ((_g = (_f = (_e2 = value.style) == null ? void 0 : _e2.barStyle) == null ? void 0 : _f.color) == null ? void 0 : _g.secondBarColor) || "e5fd3d", ((_j = (_i = (_h = value.style) == null ? void 0 : _h.barStyle) == null ? void 0 : _i.color) == null ? void 0 : _j.thirdBarColor) || "#9caff6"]
11623
+ });
11624
+ const xMax = width - margin.left - margin.right;
11625
+ const yMax = height - margin.top - margin.bottom;
11626
+ dateScale.rangeRound([0, xMax]);
11627
+ cityScale.rangeRound([0, dateScale.bandwidth()]);
11628
+ tempScale.range([yMax, 0]);
11629
+ const {
11630
+ tooltipData,
11631
+ tooltipLeft,
11632
+ tooltipTop,
11633
+ tooltipOpen,
11634
+ showTooltip,
11635
+ hideTooltip
11636
+ } = useTooltip();
11637
+ const handleMouse = (event, datum2) => {
11638
+ console.log(datum2);
11639
+ showTooltip({
11640
+ tooltipLeft: event.clientX,
11641
+ tooltipTop: event.clientY,
11642
+ tooltipData: [datum2.key, datum2.value, datum2.color]
11643
+ });
11644
+ };
11645
+ return width < 10 ? null : /* @__PURE__ */ jsxs("div", {
11646
+ children: [((_k = value == null ? void 0 : value.main) == null ? void 0 : _k.legendAvailable) && /* @__PURE__ */ jsx(Legend, {
11647
+ value
11648
+ }), /* @__PURE__ */ jsxs("svg", {
11649
+ width,
11650
+ height,
11651
+ children: [/* @__PURE__ */ jsx("rect", {
11652
+ x: 0,
11653
+ y: 0,
11654
+ width,
11655
+ height,
11656
+ fill: value.style.containerStyle.background || "#612efb",
11657
+ rx: 14
11658
+ }), /* @__PURE__ */ jsxs(Group, {
11659
+ top: margin.top,
11660
+ left: margin.left,
11661
+ children: [/* @__PURE__ */ jsx(LeftAxis, {
11662
+ value,
11663
+ yScale: tempScale,
11664
+ parentWidth: width
11665
+ }), /* @__PURE__ */ jsx(BarGroup, {
11666
+ data,
11667
+ keys: keys2,
11668
+ height: yMax,
11669
+ x0: getDate,
11670
+ x0Scale: dateScale,
11671
+ x1Scale: cityScale,
11672
+ yScale: tempScale,
11673
+ color: colorScale,
11674
+ children: (barGroups) => barGroups.map((barGroup) => /* @__PURE__ */ jsx(Group, {
11675
+ left: barGroup.x0,
11676
+ children: barGroup.bars.map((bar) => /* @__PURE__ */ jsx("rect", {
11677
+ x: bar.x,
11678
+ y: bar.y,
11679
+ width: bar.width,
11680
+ height: bar.height,
11681
+ fill: bar.color,
11682
+ rx: 4,
11683
+ onMouseOver: (e3) => handleMouse(e3, bar),
11684
+ onMouseOut: hideTooltip,
11685
+ onClick: () => {
11686
+ if (!events)
11687
+ return;
11688
+ const {
11689
+ key,
11690
+ value: value2
11691
+ } = bar;
11692
+ alert(JSON.stringify({
11693
+ key,
11694
+ value: value2
11695
+ }));
11696
+ }
11697
+ }, `bar-group-bar-${barGroup.index}-${bar.index}-${bar.value}-${bar.key}`))
11698
+ }, `bar-group-${barGroup.index}-${barGroup.x0}`))
11699
+ })]
11700
+ }), /* @__PURE__ */ jsx(BottomAxis, {
11701
+ yMax: yMax + margin.top,
11702
+ value,
11703
+ left: margin.left,
11704
+ xScale: dateScale,
11705
+ parentWidth: width
11706
+ })]
11707
+ }), tooltipOpen && /* @__PURE__ */ jsx(ToolTip, {
11708
+ style: {
11709
+ ...value == null ? void 0 : value.style,
11710
+ tooltipbackground: tooltipData[2]
11711
+ },
11712
+ top: tooltipTop,
11713
+ left: tooltipLeft,
11714
+ tooltipData
11715
+ })]
11845
11716
  });
11846
- };
11847
- var _excluded$m = ["flexDirection", "alignItems", "margin", "display", "children"];
11848
- function _extends$z() {
11849
- _extends$z = Object.assign ? Object.assign.bind() : function(target) {
11850
- for (var i2 = 1; i2 < arguments.length; i2++) {
11851
- var source = arguments[i2];
11852
- for (var key in source) {
11853
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11854
- target[key] = source[key];
11855
- }
11856
- }
11857
- }
11858
- return target;
11859
- };
11860
- return _extends$z.apply(this, arguments);
11861
- }
11862
- function _objectWithoutPropertiesLoose$m(source, excluded) {
11863
- if (source == null)
11864
- return {};
11865
- var target = {};
11866
- var sourceKeys = Object.keys(source);
11867
- var key, i2;
11868
- for (i2 = 0; i2 < sourceKeys.length; i2++) {
11869
- key = sourceKeys[i2];
11870
- if (excluded.indexOf(key) >= 0)
11871
- continue;
11872
- target[key] = source[key];
11873
- }
11874
- return target;
11875
11717
  }
11876
- function LegendItem(_ref) {
11877
- var _ref$flexDirection = _ref.flexDirection, flexDirection = _ref$flexDirection === void 0 ? "row" : _ref$flexDirection, _ref$alignItems = _ref.alignItems, alignItems = _ref$alignItems === void 0 ? "center" : _ref$alignItems, _ref$margin = _ref.margin, margin = _ref$margin === void 0 ? "0" : _ref$margin, _ref$display = _ref.display, display = _ref$display === void 0 ? "flex" : _ref$display, children2 = _ref.children, restProps = _objectWithoutPropertiesLoose$m(_ref, _excluded$m);
11878
- return /* @__PURE__ */ React__default.createElement("div", _extends$z({
11879
- className: "visx-legend-item",
11880
- style: {
11881
- display,
11882
- alignItems,
11883
- flexDirection,
11884
- margin
11718
+ var root$4 = _root;
11719
+ var now$2 = function() {
11720
+ return root$4.Date.now();
11721
+ };
11722
+ var now_1 = now$2;
11723
+ var reWhitespace$1 = /\s/;
11724
+ function trimmedEndIndex$2(string2) {
11725
+ var index2 = string2.length;
11726
+ while (index2-- && reWhitespace$1.test(string2.charAt(index2))) {
11727
+ }
11728
+ return index2;
11729
+ }
11730
+ var _trimmedEndIndex = trimmedEndIndex$2;
11731
+ var trimmedEndIndex$1 = _trimmedEndIndex;
11732
+ var reTrimStart$1 = /^\s+/;
11733
+ function baseTrim$2(string2) {
11734
+ return string2 ? string2.slice(0, trimmedEndIndex$1(string2) + 1).replace(reTrimStart$1, "") : string2;
11735
+ }
11736
+ var _baseTrim = baseTrim$2;
11737
+ function isObjectLike$2(value) {
11738
+ return value != null && typeof value == "object";
11739
+ }
11740
+ var isObjectLike_1 = isObjectLike$2;
11741
+ var baseGetTag$1 = _baseGetTag, isObjectLike$1 = isObjectLike_1;
11742
+ var symbolTag$1 = "[object Symbol]";
11743
+ function isSymbol$2(value) {
11744
+ return typeof value == "symbol" || isObjectLike$1(value) && baseGetTag$1(value) == symbolTag$1;
11745
+ }
11746
+ var isSymbol_1 = isSymbol$2;
11747
+ var baseTrim$1 = _baseTrim, isObject$2 = isObject_1, isSymbol$1 = isSymbol_1;
11748
+ var NAN$1 = 0 / 0;
11749
+ var reIsBadHex$1 = /^[-+]0x[0-9a-f]+$/i;
11750
+ var reIsBinary$1 = /^0b[01]+$/i;
11751
+ var reIsOctal$1 = /^0o[0-7]+$/i;
11752
+ var freeParseInt$1 = parseInt;
11753
+ function toNumber$2(value) {
11754
+ if (typeof value == "number") {
11755
+ return value;
11756
+ }
11757
+ if (isSymbol$1(value)) {
11758
+ return NAN$1;
11759
+ }
11760
+ if (isObject$2(value)) {
11761
+ var other = typeof value.valueOf == "function" ? value.valueOf() : value;
11762
+ value = isObject$2(other) ? other + "" : other;
11763
+ }
11764
+ if (typeof value != "string") {
11765
+ return value === 0 ? value : +value;
11766
+ }
11767
+ value = baseTrim$1(value);
11768
+ var isBinary = reIsBinary$1.test(value);
11769
+ return isBinary || reIsOctal$1.test(value) ? freeParseInt$1(value.slice(2), isBinary ? 2 : 8) : reIsBadHex$1.test(value) ? NAN$1 : +value;
11770
+ }
11771
+ var toNumber_1 = toNumber$2;
11772
+ var isObject$1 = isObject_1, now$1 = now_1, toNumber$1 = toNumber_1;
11773
+ var FUNC_ERROR_TEXT = "Expected a function";
11774
+ var nativeMax = Math.max, nativeMin$1 = Math.min;
11775
+ function debounce(func, wait, options) {
11776
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
11777
+ if (typeof func != "function") {
11778
+ throw new TypeError(FUNC_ERROR_TEXT);
11779
+ }
11780
+ wait = toNumber$1(wait) || 0;
11781
+ if (isObject$1(options)) {
11782
+ leading = !!options.leading;
11783
+ maxing = "maxWait" in options;
11784
+ maxWait = maxing ? nativeMax(toNumber$1(options.maxWait) || 0, wait) : maxWait;
11785
+ trailing = "trailing" in options ? !!options.trailing : trailing;
11786
+ }
11787
+ function invokeFunc(time2) {
11788
+ var args = lastArgs, thisArg = lastThis;
11789
+ lastArgs = lastThis = void 0;
11790
+ lastInvokeTime = time2;
11791
+ result = func.apply(thisArg, args);
11792
+ return result;
11793
+ }
11794
+ function leadingEdge(time2) {
11795
+ lastInvokeTime = time2;
11796
+ timerId = setTimeout(timerExpired, wait);
11797
+ return leading ? invokeFunc(time2) : result;
11798
+ }
11799
+ function remainingWait(time2) {
11800
+ var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
11801
+ return maxing ? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
11802
+ }
11803
+ function shouldInvoke(time2) {
11804
+ var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
11805
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
11806
+ }
11807
+ function timerExpired() {
11808
+ var time2 = now$1();
11809
+ if (shouldInvoke(time2)) {
11810
+ return trailingEdge(time2);
11885
11811
  }
11886
- }, restProps), children2);
11812
+ timerId = setTimeout(timerExpired, remainingWait(time2));
11813
+ }
11814
+ function trailingEdge(time2) {
11815
+ timerId = void 0;
11816
+ if (trailing && lastArgs) {
11817
+ return invokeFunc(time2);
11818
+ }
11819
+ lastArgs = lastThis = void 0;
11820
+ return result;
11821
+ }
11822
+ function cancel() {
11823
+ if (timerId !== void 0) {
11824
+ clearTimeout(timerId);
11825
+ }
11826
+ lastInvokeTime = 0;
11827
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
11828
+ }
11829
+ function flush() {
11830
+ return timerId === void 0 ? result : trailingEdge(now$1());
11831
+ }
11832
+ function debounced() {
11833
+ var time2 = now$1(), isInvoking = shouldInvoke(time2);
11834
+ lastArgs = arguments;
11835
+ lastThis = this;
11836
+ lastCallTime = time2;
11837
+ if (isInvoking) {
11838
+ if (timerId === void 0) {
11839
+ return leadingEdge(lastCallTime);
11840
+ }
11841
+ if (maxing) {
11842
+ clearTimeout(timerId);
11843
+ timerId = setTimeout(timerExpired, wait);
11844
+ return invokeFunc(lastCallTime);
11845
+ }
11846
+ }
11847
+ if (timerId === void 0) {
11848
+ timerId = setTimeout(timerExpired, wait);
11849
+ }
11850
+ return result;
11851
+ }
11852
+ debounced.cancel = cancel;
11853
+ debounced.flush = flush;
11854
+ return debounced;
11887
11855
  }
11888
- LegendItem.propTypes = {
11889
- alignItems: _pt.string,
11890
- margin: _pt.oneOfType([_pt.string, _pt.number]),
11891
- children: _pt.node,
11892
- display: _pt.string
11893
- };
11894
- var _excluded$l = ["flex", "label", "margin", "align", "children"];
11895
- function _extends$y() {
11896
- _extends$y = Object.assign ? Object.assign.bind() : function(target) {
11856
+ var debounce_1 = debounce;
11857
+ var debounce$1 = debounce_1;
11858
+ var _excluded$k = ["className", "children", "debounceTime", "ignoreDimensions", "parentSizeStyles", "enableDebounceLeadingCall", "resizeObserverPolyfill"];
11859
+ function _extends$u() {
11860
+ _extends$u = Object.assign ? Object.assign.bind() : function(target) {
11897
11861
  for (var i2 = 1; i2 < arguments.length; i2++) {
11898
11862
  var source = arguments[i2];
11899
11863
  for (var key in source) {
@@ -11904,9 +11868,9 @@ function _extends$y() {
11904
11868
  }
11905
11869
  return target;
11906
11870
  };
11907
- return _extends$y.apply(this, arguments);
11871
+ return _extends$u.apply(this, arguments);
11908
11872
  }
11909
- function _objectWithoutPropertiesLoose$l(source, excluded) {
11873
+ function _objectWithoutPropertiesLoose$k(source, excluded) {
11910
11874
  if (source == null)
11911
11875
  return {};
11912
11876
  var target = {};
@@ -11920,350 +11884,388 @@ function _objectWithoutPropertiesLoose$l(source, excluded) {
11920
11884
  }
11921
11885
  return target;
11922
11886
  }
11923
- function LegendLabel(_ref) {
11924
- var _ref$flex = _ref.flex, flex = _ref$flex === void 0 ? "1" : _ref$flex, label = _ref.label, _ref$margin = _ref.margin, margin = _ref$margin === void 0 ? "5px 0" : _ref$margin, _ref$align = _ref.align, align2 = _ref$align === void 0 ? "left" : _ref$align, children2 = _ref.children, restProps = _objectWithoutPropertiesLoose$l(_ref, _excluded$l);
11925
- return /* @__PURE__ */ React__default.createElement("div", _extends$y({
11926
- className: "visx-legend-label",
11927
- style: {
11928
- justifyContent: align2,
11929
- display: "flex",
11930
- flex,
11931
- margin
11932
- }
11933
- }, restProps), children2 || label);
11934
- }
11935
- LegendLabel.propTypes = {
11936
- align: _pt.string,
11937
- label: _pt.node,
11938
- flex: _pt.oneOfType([_pt.string, _pt.number]),
11939
- margin: _pt.oneOfType([_pt.string, _pt.number]),
11940
- children: _pt.node
11887
+ var defaultIgnoreDimensions$1 = [];
11888
+ var defaultParentSizeStyles$1 = {
11889
+ width: "100%",
11890
+ height: "100%"
11941
11891
  };
11942
- function _extends$x() {
11943
- _extends$x = Object.assign ? Object.assign.bind() : function(target) {
11944
- for (var i2 = 1; i2 < arguments.length; i2++) {
11945
- var source = arguments[i2];
11946
- for (var key in source) {
11947
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11948
- target[key] = source[key];
11949
- }
11950
- }
11951
- }
11952
- return target;
11953
- };
11954
- return _extends$x.apply(this, arguments);
11955
- }
11956
- function ShapeRect(_ref) {
11957
- var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11958
- return /* @__PURE__ */ React__default.createElement("div", {
11959
- style: _extends$x({
11960
- width,
11961
- height,
11962
- background: fill
11963
- }, style2)
11892
+ function ParentSize$1(_ref) {
11893
+ var className = _ref.className, children2 = _ref.children, _ref$debounceTime = _ref.debounceTime, debounceTime = _ref$debounceTime === void 0 ? 300 : _ref$debounceTime, _ref$ignoreDimensions = _ref.ignoreDimensions, ignoreDimensions = _ref$ignoreDimensions === void 0 ? defaultIgnoreDimensions$1 : _ref$ignoreDimensions, _ref$parentSizeStyles = _ref.parentSizeStyles, parentSizeStyles = _ref$parentSizeStyles === void 0 ? defaultParentSizeStyles$1 : _ref$parentSizeStyles, _ref$enableDebounceLe = _ref.enableDebounceLeadingCall, enableDebounceLeadingCall = _ref$enableDebounceLe === void 0 ? true : _ref$enableDebounceLe, resizeObserverPolyfill = _ref.resizeObserverPolyfill, restProps = _objectWithoutPropertiesLoose$k(_ref, _excluded$k);
11894
+ var target = useRef(null);
11895
+ var animationFrameID = useRef(0);
11896
+ var _useState = useState({
11897
+ width: 0,
11898
+ height: 0,
11899
+ top: 0,
11900
+ left: 0
11901
+ }), state = _useState[0], setState = _useState[1];
11902
+ var resize = useMemo(function() {
11903
+ var normalized = Array.isArray(ignoreDimensions) ? ignoreDimensions : [ignoreDimensions];
11904
+ return debounce$1(function(incoming) {
11905
+ setState(function(existing) {
11906
+ var stateKeys = Object.keys(existing);
11907
+ var keysWithChanges = stateKeys.filter(function(key) {
11908
+ return existing[key] !== incoming[key];
11909
+ });
11910
+ var shouldBail = keysWithChanges.every(function(key) {
11911
+ return normalized.includes(key);
11912
+ });
11913
+ return shouldBail ? existing : incoming;
11914
+ });
11915
+ }, debounceTime, {
11916
+ leading: enableDebounceLeadingCall
11917
+ });
11918
+ }, [debounceTime, enableDebounceLeadingCall, ignoreDimensions]);
11919
+ useEffect(function() {
11920
+ var LocalResizeObserver = resizeObserverPolyfill || window.ResizeObserver;
11921
+ var observer = new LocalResizeObserver(function(entries) {
11922
+ entries.forEach(function(entry) {
11923
+ var _entry$contentRect;
11924
+ var _ref2 = (_entry$contentRect = entry == null ? void 0 : entry.contentRect) != null ? _entry$contentRect : {}, left2 = _ref2.left, top2 = _ref2.top, width = _ref2.width, height = _ref2.height;
11925
+ animationFrameID.current = window.requestAnimationFrame(function() {
11926
+ resize({
11927
+ width,
11928
+ height,
11929
+ top: top2,
11930
+ left: left2
11931
+ });
11932
+ });
11933
+ });
11934
+ });
11935
+ if (target.current)
11936
+ observer.observe(target.current);
11937
+ return function() {
11938
+ window.cancelAnimationFrame(animationFrameID.current);
11939
+ observer.disconnect();
11940
+ resize.cancel();
11941
+ };
11942
+ }, [resize, resizeObserverPolyfill]);
11943
+ return /* @__PURE__ */ jsx("div", {
11944
+ style: parentSizeStyles,
11945
+ ref: target,
11946
+ className,
11947
+ ...restProps,
11948
+ children: children2(_extends$u({}, state, {
11949
+ ref: target.current,
11950
+ resize
11951
+ }))
11964
11952
  });
11965
11953
  }
11966
- ShapeRect.propTypes = {
11967
- fill: _pt.string,
11968
- width: _pt.oneOfType([_pt.string, _pt.number]),
11969
- height: _pt.oneOfType([_pt.string, _pt.number])
11970
- };
11971
- function ShapeCircle(_ref) {
11972
- var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11973
- var cleanWidth = typeof width === "string" || typeof width === "undefined" ? 0 : width;
11974
- var cleanHeight = typeof height === "string" || typeof height === "undefined" ? 0 : height;
11975
- var size = Math.max(cleanWidth, cleanHeight);
11976
- var radius = size / 2;
11977
- return /* @__PURE__ */ React__default.createElement("svg", {
11978
- width: size,
11979
- height: size
11980
- }, /* @__PURE__ */ React__default.createElement(Group, {
11981
- top: radius,
11982
- left: radius
11983
- }, /* @__PURE__ */ React__default.createElement("circle", {
11984
- r: radius,
11985
- fill,
11986
- style: style2
11987
- })));
11988
- }
11989
- ShapeCircle.propTypes = {
11990
- fill: _pt.string,
11991
- width: _pt.oneOfType([_pt.string, _pt.number]),
11992
- height: _pt.oneOfType([_pt.string, _pt.number])
11993
- };
11994
- function ShapeLine(_ref) {
11995
- var fill = _ref.fill, width = _ref.width, height = _ref.height, style2 = _ref.style;
11996
- var cleanHeight = typeof height === "string" || typeof height === "undefined" ? 0 : height;
11997
- var lineThickness = typeof (style2 == null ? void 0 : style2.strokeWidth) === "number" ? style2 == null ? void 0 : style2.strokeWidth : 2;
11998
- return /* @__PURE__ */ React__default.createElement("svg", {
11999
- width,
12000
- height
12001
- }, /* @__PURE__ */ React__default.createElement(Group, {
12002
- top: cleanHeight / 2 - lineThickness / 2
12003
- }, /* @__PURE__ */ React__default.createElement("line", {
12004
- x1: 0,
12005
- x2: width,
12006
- y1: 0,
12007
- y2: 0,
12008
- stroke: fill,
12009
- strokeWidth: lineThickness,
12010
- style: style2
12011
- })));
12012
- }
12013
- ShapeLine.propTypes = {
12014
- fill: _pt.string,
12015
- width: _pt.oneOfType([_pt.string, _pt.number]),
12016
- height: _pt.oneOfType([_pt.string, _pt.number])
11954
+ ParentSize$1.propTypes = {
11955
+ className: _pt.string,
11956
+ debounceTime: _pt.number,
11957
+ enableDebounceLeadingCall: _pt.bool,
11958
+ ignoreDimensions: _pt.oneOfType([_pt.any, _pt.arrayOf(_pt.any)]),
11959
+ children: _pt.func.isRequired
12017
11960
  };
12018
- function _extends$w() {
12019
- _extends$w = Object.assign ? Object.assign.bind() : function(target) {
12020
- for (var i2 = 1; i2 < arguments.length; i2++) {
12021
- var source = arguments[i2];
12022
- for (var key in source) {
12023
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12024
- target[key] = source[key];
11961
+ const Product1 = [
11962
+ { x: "a", y: 100 },
11963
+ { x: "b", y: 50 },
11964
+ { x: "c", y: 100 },
11965
+ { x: "d", y: 80 },
11966
+ { x: "f", y: 100 },
11967
+ { x: "g", y: 50 }
11968
+ ];
11969
+ const finalDataProvider = (type2, value) => {
11970
+ var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s, _t2, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E;
11971
+ switch (type2) {
11972
+ case "BarGraph":
11973
+ return {
11974
+ main: {
11975
+ type: "barGraph",
11976
+ data: ((_a2 = value == null ? void 0 : value.main) == null ? void 0 : _a2.data) || [{ x: "ASM", y: 100 }, { x: "SDM", y: 60 }, { x: "DCM", y: 40 }, { x: "RCM", y: 70 }],
11977
+ header: "Bar Graph",
11978
+ bottomLabel: "Name of Employe",
11979
+ numTicks: 6,
11980
+ leftLabel: "Value",
11981
+ axisLeft: true,
11982
+ axisBottom: true,
11983
+ hideTicks: true,
11984
+ hideLeftAxisLine: false,
11985
+ hideBottomAxisLine: false,
11986
+ bottomAxisWidth: "10px",
11987
+ ...value.main
11988
+ },
11989
+ style: {
11990
+ containerStyle: {
11991
+ background: "white",
11992
+ width: "90%",
11993
+ height: "300",
11994
+ borderRadius: "20px",
11995
+ padding: "10px 0 2px 0",
11996
+ ...(_b2 = value == null ? void 0 : value.style) == null ? void 0 : _b2.containerStyle
11997
+ },
11998
+ headerStyle: {
11999
+ fontWeight: 500,
12000
+ textAlign: "left",
12001
+ fontFamily: "inherit",
12002
+ marginBottom: "20px",
12003
+ padding: "15px 0 1px 20px",
12004
+ width: "100%",
12005
+ fontSize: "18px",
12006
+ ...(_c2 = value == null ? void 0 : value.style) == null ? void 0 : _c2.headerStyle
12007
+ },
12008
+ tooltipStyle: {
12009
+ padding: "6px",
12010
+ borderRadius: "2px",
12011
+ ...(_d = value == null ? void 0 : value.style) == null ? void 0 : _d.tooltipStyle
12012
+ },
12013
+ labelStyle: {
12014
+ leftLabelMargin: "75",
12015
+ topLabelMargin: "-6",
12016
+ labelColor: "black",
12017
+ leftLabelOffset: 50,
12018
+ bottomLabelOffset: 10,
12019
+ tickLabelColor: "balck",
12020
+ tickFontSize: "10px",
12021
+ tickColor: "black",
12022
+ rightAxisWidth: "0.3px",
12023
+ fontSize: "10px",
12024
+ ...(_e2 = value == null ? void 0 : value.style) == null ? void 0 : _e2.labelStyle
12025
+ },
12026
+ barStyle: {
12027
+ mediumValueColor: "rgba(63, 81, 181, 0.85)",
12028
+ highValueColor: "rgba(63, 81, 181, 0.85)",
12029
+ lowValueColor: "rgba(63, 81, 181, 0.85)",
12030
+ ...(_f = value == null ? void 0 : value.style) == null ? void 0 : _f.barStyle
12031
+ }
12025
12032
  }
12026
- }
12027
- }
12028
- return target;
12029
- };
12030
- return _extends$w.apply(this, arguments);
12031
- }
12032
- var NO_OP = function NO_OP2() {
12033
- return void 0;
12034
- };
12035
- function renderShape(_ref) {
12036
- var _ref$shape = _ref.shape, shape = _ref$shape === void 0 ? "rect" : _ref$shape, _ref$fill = _ref.fill, fill = _ref$fill === void 0 ? NO_OP : _ref$fill, _ref$size = _ref.size, size = _ref$size === void 0 ? NO_OP : _ref$size, width = _ref.width, height = _ref.height, label = _ref.label, item = _ref.item, itemIndex = _ref.itemIndex, _ref$shapeStyle = _ref.shapeStyle, shapeStyle = _ref$shapeStyle === void 0 ? NO_OP : _ref$shapeStyle;
12037
- var props = {
12038
- width,
12039
- height,
12040
- item,
12041
- itemIndex,
12042
- label,
12043
- fill: fill(_extends$w({}, label)),
12044
- size: size(_extends$w({}, label)),
12045
- style: shapeStyle(_extends$w({}, label))
12046
- };
12047
- if (typeof shape === "string") {
12048
- if (shape === "circle") {
12049
- return /* @__PURE__ */ React__default.createElement(ShapeCircle, props);
12050
- }
12051
- if (shape === "line") {
12052
- return /* @__PURE__ */ React__default.createElement(ShapeLine, props);
12053
- }
12054
- return /* @__PURE__ */ React__default.createElement(ShapeRect, props);
12055
- }
12056
- if (/* @__PURE__ */ React__default.isValidElement(shape)) {
12057
- return /* @__PURE__ */ React__default.cloneElement(shape, props);
12058
- }
12059
- if (shape) {
12060
- return /* @__PURE__ */ React__default.createElement(shape, props);
12061
- }
12062
- return null;
12063
- }
12064
- function _extends$v() {
12065
- _extends$v = Object.assign ? Object.assign.bind() : function(target) {
12066
- for (var i2 = 1; i2 < arguments.length; i2++) {
12067
- var source = arguments[i2];
12068
- for (var key in source) {
12069
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12070
- target[key] = source[key];
12033
+ };
12034
+ case "PieGraph":
12035
+ return {
12036
+ main: {
12037
+ data: ((_g = value == null ? void 0 : value.main) == null ? void 0 : _g.data) || [{ branch: "Kotak", value: 500 }, { branch: "SBI", value: 700 }, { branch: "HDFC", value: 900 }],
12038
+ header: "Pie Graph",
12039
+ bottomLabel: "Name of Employe",
12040
+ leftLabel: "Value",
12041
+ tooltipDataKey: ["First", "Second", "Third"],
12042
+ axisLeft: true,
12043
+ axisBottom: true,
12044
+ legendAvailable: true,
12045
+ ...value == null ? void 0 : value.main,
12046
+ legend: {
12047
+ labelColor: "green",
12048
+ legendTitle: "Our Assests",
12049
+ direction: "row",
12050
+ align: "right",
12051
+ ...(_h = value == null ? void 0 : value.main) == null ? void 0 : _h.legend
12052
+ }
12053
+ },
12054
+ style: {
12055
+ containerStyle: {
12056
+ background: "white",
12057
+ width: "100%",
12058
+ height: "310",
12059
+ borderRadius: "20px",
12060
+ padding: "10px 0 2px 0",
12061
+ ...(_i = value == null ? void 0 : value.style) == null ? void 0 : _i.containerStyle
12062
+ },
12063
+ headerStyle: {
12064
+ fontWeight: 500,
12065
+ textAlign: "left",
12066
+ fontFamily: "inherit",
12067
+ marginBottom: "20px",
12068
+ padding: "15px 0 1px 20px",
12069
+ width: "100%",
12070
+ fontSize: "18px",
12071
+ ...(_j = value == null ? void 0 : value.style) == null ? void 0 : _j.headerStyle
12072
+ },
12073
+ tooltipStyle: {
12074
+ ...(_k = value == null ? void 0 : value.style) == null ? void 0 : _k.tooltipStyle
12075
+ },
12076
+ labelStyle: {
12077
+ labelColor: "black",
12078
+ labelOffset: 45,
12079
+ leftLabelMargin: "70",
12080
+ topLabelMargin: "-40",
12081
+ ...(_l = value == null ? void 0 : value.style) == null ? void 0 : _l.labelStyle
12082
+ },
12083
+ legendStyle: {
12084
+ legend: {
12085
+ lineHeight: "0.9em",
12086
+ color: "black",
12087
+ fontSize: "10px",
12088
+ fontFamily: "arial",
12089
+ padding: "10px 10px",
12090
+ float: "left",
12091
+ border: "1px solid rgba(255, 255, 255, 0.3)",
12092
+ borderRadius: " 8px",
12093
+ margin: "5px 5px",
12094
+ ...(_n2 = (_m = value == null ? void 0 : value.style) == null ? void 0 : _m.legendStyle) == null ? void 0 : _n2.legend
12095
+ },
12096
+ legendTitle: {
12097
+ fontWeight: 500,
12098
+ marginBottom: "5px",
12099
+ fontFamily: "roboto",
12100
+ fontSize: "10px",
12101
+ ...(_p = (_o = value == null ? void 0 : value.style) == null ? void 0 : _o.legendStyle) == null ? void 0 : _p.legendTitle
12102
+ }
12103
+ },
12104
+ pieStyle: {
12105
+ colorRange: ["#3f51b5", "rgba(200,0,31,0.9)", "rgba(25,200,205,0.6)"],
12106
+ outerRadius: 120,
12107
+ innerRadius: 60,
12108
+ cornerRadius: 2,
12109
+ padAngle: 6e-3,
12110
+ ...(_q = value == null ? void 0 : value.style) == null ? void 0 : _q.pieStyle
12111
+ }
12071
12112
  }
12072
- }
12073
- }
12074
- return target;
12075
- };
12076
- return _extends$v.apply(this, arguments);
12077
- }
12078
- function LegendShape(_ref) {
12079
- var _ref$shape = _ref.shape, shape = _ref$shape === void 0 ? ShapeRect : _ref$shape, width = _ref.width, height = _ref.height, margin = _ref.margin, label = _ref.label, item = _ref.item, itemIndex = _ref.itemIndex, fill = _ref.fill, size = _ref.size, shapeStyle = _ref.shapeStyle;
12080
- return /* @__PURE__ */ React__default.createElement("div", {
12081
- className: "visx-legend-shape",
12082
- style: {
12083
- display: "flex",
12084
- width: size ? size(_extends$v({}, label)) : width,
12085
- height: size ? size(_extends$v({}, label)) : height,
12086
- margin
12087
- }
12088
- }, renderShape({
12089
- shape,
12090
- item,
12091
- itemIndex,
12092
- label,
12093
- width,
12094
- height,
12095
- fill,
12096
- shapeStyle
12097
- }));
12098
- }
12099
- LegendShape.propTypes = {
12100
- itemIndex: _pt.number.isRequired,
12101
- margin: _pt.oneOfType([_pt.string, _pt.number]),
12102
- width: _pt.oneOfType([_pt.string, _pt.number]),
12103
- height: _pt.oneOfType([_pt.string, _pt.number])
12104
- };
12105
- function valueOrIdentity(_2) {
12106
- if (_2 && typeof _2 === "object" && "value" in _2 && typeof _2.value !== "undefined")
12107
- return _2.value;
12108
- return _2;
12109
- }
12110
- function valueOrIdentityString(_2) {
12111
- return String(valueOrIdentity(_2));
12112
- }
12113
- function labelTransformFactory(_ref) {
12114
- var scale = _ref.scale, labelFormat = _ref.labelFormat;
12115
- return function(d2, i2) {
12116
- return {
12117
- datum: d2,
12118
- index: i2,
12119
- text: "" + labelFormat(d2, i2),
12120
- value: scale(d2)
12121
- };
12122
- };
12123
- }
12124
- var _excluded$k = ["className", "style", "scale", "shape", "domain", "fill", "size", "labelFormat", "labelTransform", "shapeWidth", "shapeHeight", "shapeMargin", "shapeStyle", "labelAlign", "labelFlex", "labelMargin", "itemMargin", "direction", "itemDirection", "legendLabelProps", "children"];
12125
- function _extends$u() {
12126
- _extends$u = Object.assign ? Object.assign.bind() : function(target) {
12127
- for (var i2 = 1; i2 < arguments.length; i2++) {
12128
- var source = arguments[i2];
12129
- for (var key in source) {
12130
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12131
- target[key] = source[key];
12113
+ };
12114
+ case "LineGraph":
12115
+ return {
12116
+ main: {
12117
+ data: ((_r = value == null ? void 0 : value.main) == null ? void 0 : _r.data) || [Product1],
12118
+ header: "Line Graph Dynamic",
12119
+ bottomLabel: "Name of Employe",
12120
+ leftLabel: "Value",
12121
+ gridHidden: true,
12122
+ numHidden: false,
12123
+ tooltipDataKey: ["MAMA New Project", "Second", "Third"],
12124
+ axisLeft: true,
12125
+ axisBottom: true,
12126
+ hideLeftAxisLine: false,
12127
+ hideBottomAxisLine: false,
12128
+ ...value == null ? void 0 : value.main,
12129
+ legend: {
12130
+ labelColor: "green",
12131
+ legendTitle: "Our Assests",
12132
+ direction: "row",
12133
+ align: "right",
12134
+ colorRectWidth: 20,
12135
+ ...(_s = value == null ? void 0 : value.main) == null ? void 0 : _s.legend
12136
+ }
12137
+ },
12138
+ style: {
12139
+ containerStyle: {
12140
+ background: "white",
12141
+ width: "90%",
12142
+ height: "300",
12143
+ borderRadius: "20px",
12144
+ padding: "10px 0 2px 0",
12145
+ ...(_t2 = value == null ? void 0 : value.style) == null ? void 0 : _t2.containerStyle
12146
+ },
12147
+ headerStyle: {
12148
+ fontWeight: 500,
12149
+ textAlign: "left",
12150
+ fontFamily: "inherit",
12151
+ marginBottom: "20px",
12152
+ padding: "15px 0 1px 20px",
12153
+ width: "100%",
12154
+ fontSize: "18px",
12155
+ ...(_u = value == null ? void 0 : value.style) == null ? void 0 : _u.headerStyle
12156
+ },
12157
+ labelStyle: {
12158
+ labelColor: "black",
12159
+ bottomLabelOffset: 20,
12160
+ leftLabelOffset: 50,
12161
+ leftLabelMargin: 80,
12162
+ ...(_v = value == null ? void 0 : value.style) == null ? void 0 : _v.labelStyle
12163
+ },
12164
+ lineStyle: {
12165
+ colorRange: ["#3f51b5", "rgba(200,0,31,0.9)", "rgba(25,200,205,0.6)"],
12166
+ lineAreaColor: "none",
12167
+ lineAreaOpacity: 0.2,
12168
+ ...(_w = value == null ? void 0 : value.style) == null ? void 0 : _w.lineStyle
12169
+ }
12132
12170
  }
12133
- }
12134
- }
12135
- return target;
12136
- };
12137
- return _extends$u.apply(this, arguments);
12138
- }
12139
- function _objectWithoutPropertiesLoose$k(source, excluded) {
12140
- if (source == null)
12141
- return {};
12142
- var target = {};
12143
- var sourceKeys = Object.keys(source);
12144
- var key, i2;
12145
- for (i2 = 0; i2 < sourceKeys.length; i2++) {
12146
- key = sourceKeys[i2];
12147
- if (excluded.indexOf(key) >= 0)
12148
- continue;
12149
- target[key] = source[key];
12171
+ };
12172
+ case "HorizontalBarGraph":
12173
+ return {
12174
+ main: {
12175
+ data: ((_x = value == null ? void 0 : value.main) == null ? void 0 : _x.data) || [{ y: "Anant Sharma", x: 60 }, { y: "Pankaj Chauhan", x: 60 }, { y: "satendra Raghav", x: 150 }, { y: "Vivek Pahadi", x: 80 }, { y: "Siddarth verma", x: 100 }],
12176
+ header: " ",
12177
+ bottomLabel: "Name of Employe",
12178
+ leftLabel: "Value",
12179
+ axisLeft: true,
12180
+ axisBottom: true,
12181
+ hideBottomTicks: false,
12182
+ hideLeftTicks: ((_y = value == null ? void 0 : value.main) == null ? void 0 : _y.data) ? true : false,
12183
+ hideLeftAxisLine: ((_z = value == null ? void 0 : value.main) == null ? void 0 : _z.data) ? true : false,
12184
+ hideBottomAxisLine: false,
12185
+ bottomAxisWidth: "10px",
12186
+ ...value.main
12187
+ },
12188
+ style: {
12189
+ containerStyle: {
12190
+ background: "white",
12191
+ width: "90%",
12192
+ height: "300",
12193
+ borderRadius: "20px",
12194
+ padding: "10px 0 2px 0",
12195
+ ...(_A = value == null ? void 0 : value.style) == null ? void 0 : _A.containerStyle
12196
+ },
12197
+ headerStyle: {
12198
+ fontWeight: 500,
12199
+ textAlign: "left",
12200
+ fontFamily: "inherit",
12201
+ marginBottom: "20px",
12202
+ padding: "15px 0 1px 20px",
12203
+ width: "100%",
12204
+ fontSize: "18px",
12205
+ ...(_B = value == null ? void 0 : value.style) == null ? void 0 : _B.headerStyle
12206
+ },
12207
+ tooltipStyle: {
12208
+ padding: "6px",
12209
+ borderRadius: "2px",
12210
+ ...(_C = value == null ? void 0 : value.style) == null ? void 0 : _C.tooltipStyle
12211
+ },
12212
+ labelStyle: {
12213
+ margin: { top: 10, left: 110, right: 40, bottom: 40 },
12214
+ tickLabelColor: "#6c5efb",
12215
+ leftLabelOffset: 140,
12216
+ bottomLabelOffset: 14,
12217
+ tickFontSize: "10px",
12218
+ tickColor: "#6c5efb",
12219
+ rightAxisWidth: "0.3px",
12220
+ fontSize: "10px",
12221
+ ...(_D = value == null ? void 0 : value.style) == null ? void 0 : _D.labelStyle
12222
+ },
12223
+ barStyle: {
12224
+ color: "#6c5efb",
12225
+ ...(_E = value == null ? void 0 : value.style) == null ? void 0 : _E.barStyle
12226
+ }
12227
+ }
12228
+ };
12150
12229
  }
12151
- return target;
12152
- }
12153
- var defaultStyle = {
12154
- display: "flex"
12155
- };
12156
- function Legend$1(_ref) {
12157
- var className = _ref.className, _ref$style = _ref.style, style2 = _ref$style === void 0 ? defaultStyle : _ref$style, scale = _ref.scale, shape = _ref.shape, inputDomain = _ref.domain, _ref$fill = _ref.fill, fill = _ref$fill === void 0 ? valueOrIdentityString : _ref$fill, _ref$size = _ref.size, size = _ref$size === void 0 ? valueOrIdentityString : _ref$size, _ref$labelFormat = _ref.labelFormat, labelFormat = _ref$labelFormat === void 0 ? valueOrIdentity : _ref$labelFormat, _ref$labelTransform = _ref.labelTransform, labelTransform = _ref$labelTransform === void 0 ? labelTransformFactory : _ref$labelTransform, _ref$shapeWidth = _ref.shapeWidth, shapeWidth = _ref$shapeWidth === void 0 ? 15 : _ref$shapeWidth, _ref$shapeHeight = _ref.shapeHeight, shapeHeight = _ref$shapeHeight === void 0 ? 15 : _ref$shapeHeight, _ref$shapeMargin = _ref.shapeMargin, shapeMargin = _ref$shapeMargin === void 0 ? "2px 4px 2px 0" : _ref$shapeMargin, shapeStyle = _ref.shapeStyle, _ref$labelAlign = _ref.labelAlign, labelAlign = _ref$labelAlign === void 0 ? "left" : _ref$labelAlign, _ref$labelFlex = _ref.labelFlex, labelFlex = _ref$labelFlex === void 0 ? "1" : _ref$labelFlex, _ref$labelMargin = _ref.labelMargin, labelMargin = _ref$labelMargin === void 0 ? "0 4px" : _ref$labelMargin, _ref$itemMargin = _ref.itemMargin, itemMargin = _ref$itemMargin === void 0 ? "0" : _ref$itemMargin, _ref$direction = _ref.direction, direction = _ref$direction === void 0 ? "column" : _ref$direction, _ref$itemDirection = _ref.itemDirection, itemDirection = _ref$itemDirection === void 0 ? "row" : _ref$itemDirection, legendLabelProps = _ref.legendLabelProps, children2 = _ref.children, legendItemProps = _objectWithoutPropertiesLoose$k(_ref, _excluded$k);
12158
- var domain2 = inputDomain || ("domain" in scale ? scale.domain() : []);
12159
- var labelFormatter = labelTransform({
12160
- scale,
12161
- labelFormat
12162
- });
12163
- var labels = domain2.map(labelFormatter);
12164
- if (children2)
12165
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children2(labels));
12166
- return /* @__PURE__ */ React__default.createElement("div", {
12167
- className: cx("visx-legend", className),
12168
- style: _extends$u({}, style2, {
12169
- flexDirection: direction
12170
- })
12171
- }, labels.map(function(label, i2) {
12172
- return /* @__PURE__ */ React__default.createElement(LegendItem, _extends$u({
12173
- key: "legend-" + label.text + "-" + i2,
12174
- margin: itemMargin,
12175
- flexDirection: itemDirection
12176
- }, legendItemProps), /* @__PURE__ */ React__default.createElement(LegendShape, {
12177
- shape,
12178
- height: shapeHeight,
12179
- width: shapeWidth,
12180
- margin: shapeMargin,
12181
- item: domain2[i2],
12182
- itemIndex: i2,
12183
- label,
12184
- fill,
12185
- size,
12186
- shapeStyle
12187
- }), /* @__PURE__ */ React__default.createElement(LegendLabel, _extends$u({
12188
- label: label.text,
12189
- flex: labelFlex,
12190
- margin: labelMargin,
12191
- align: labelAlign
12192
- }, legendLabelProps)));
12193
- }));
12194
- }
12195
- Legend$1.propTypes = {
12196
- children: _pt.func,
12197
- className: _pt.string,
12198
- domain: _pt.array,
12199
- shapeWidth: _pt.oneOfType([_pt.string, _pt.number]),
12200
- shapeHeight: _pt.oneOfType([_pt.string, _pt.number]),
12201
- shapeMargin: _pt.oneOfType([_pt.string, _pt.number]),
12202
- labelAlign: _pt.string,
12203
- labelFlex: _pt.oneOfType([_pt.string, _pt.number]),
12204
- labelMargin: _pt.oneOfType([_pt.string, _pt.number]),
12205
- itemMargin: _pt.oneOfType([_pt.string, _pt.number]),
12206
- fill: _pt.func,
12207
- size: _pt.func,
12208
- shapeStyle: _pt.func
12209
12230
  };
12210
- function Ordinal(props) {
12211
- return /* @__PURE__ */ React__default.createElement(Legend$1, props);
12212
- }
12213
- function Legend({
12231
+ const BarGraph = ({
12214
12232
  value
12215
- }) {
12216
- var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k;
12217
- const legendGlyphSize = ((_b2 = (_a2 = value == null ? void 0 : value.main) == null ? void 0 : _a2.legend) == null ? void 0 : _b2.colorRectWidth) || 15;
12218
- const ordinalColorScale = createOrdinalScale$1({
12219
- domain: (_c2 = value == null ? void 0 : value.main) == null ? void 0 : _c2.tooltipDataKey,
12220
- range: (_e2 = (_d = value == null ? void 0 : value.style) == null ? void 0 : _d.pieStyle) == null ? void 0 : _e2.colorRange
12233
+ }) => {
12234
+ var _a2, _b2, _c2, _d;
12235
+ const barData = finalDataProvider("BarGraph", value);
12236
+ let GraphRender = /* @__PURE__ */ jsx(ParentSize$1, {
12237
+ children: (parent) => {
12238
+ var _a3, _b3, _c3, _d2, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2;
12239
+ return /* @__PURE__ */ jsx(DrawBarGraph, {
12240
+ width: parent.width || 400,
12241
+ height: ((_b3 = (_a3 = barData == null ? void 0 : barData.style) == null ? void 0 : _a3.containerStyle) == null ? void 0 : _b3.height) | 400,
12242
+ margin: {
12243
+ top: ((_e2 = (_d2 = (_c3 = barData == null ? void 0 : barData.style) == null ? void 0 : _c3.labelStyle) == null ? void 0 : _d2.margin) == null ? void 0 : _e2.top) || 10,
12244
+ right: ((_h = (_g = (_f = barData == null ? void 0 : barData.style) == null ? void 0 : _f.labelStyle) == null ? void 0 : _g.margin) == null ? void 0 : _h.right) || 10,
12245
+ bottom: ((_k = (_j = (_i = barData == null ? void 0 : barData.style) == null ? void 0 : _i.labelStyle) == null ? void 0 : _j.margin) == null ? void 0 : _k.bottom) || 20,
12246
+ left: ((_n2 = (_m = (_l = barData == null ? void 0 : barData.style) == null ? void 0 : _l.labelStyle) == null ? void 0 : _m.margin) == null ? void 0 : _n2.left) || 60
12247
+ },
12248
+ value: barData
12249
+ });
12250
+ }
12221
12251
  });
12222
12252
  return /* @__PURE__ */ jsxs("div", {
12223
- className: "legend",
12224
- style: (_g = (_f = value == null ? void 0 : value.style) == null ? void 0 : _f.legendStyle) == null ? void 0 : _g.legend,
12225
- children: [/* @__PURE__ */ jsx("div", {
12226
- className: "title",
12227
- style: (_i = (_h = value == null ? void 0 : value.style) == null ? void 0 : _h.legendStyle) == null ? void 0 : _i.legendTitle,
12228
- children: (_k = (_j = value == null ? void 0 : value.main) == null ? void 0 : _j.legend) == null ? void 0 : _k.legendTitle
12229
- }), /* @__PURE__ */ jsx(Ordinal, {
12230
- scale: ordinalColorScale,
12231
- labelFormat: (label) => `${label.toUpperCase()}`,
12232
- children: (labels) => {
12233
- var _a3, _b3;
12234
- return /* @__PURE__ */ jsx("div", {
12235
- style: {
12236
- display: "flex",
12237
- flexDirection: ((_b3 = (_a3 = value == null ? void 0 : value.main) == null ? void 0 : _a3.legend) == null ? void 0 : _b3.direction) || "row"
12238
- },
12239
- children: labels.map((label, i2) => {
12240
- var _a4, _b4;
12241
- return /* @__PURE__ */ jsxs(LegendItem, {
12242
- margin: "0 5px",
12243
- onClick: (events) => {
12244
- if (events)
12245
- alert(`clicked: ${JSON.stringify(label)}`);
12246
- },
12247
- children: [/* @__PURE__ */ jsx("svg", {
12248
- width: legendGlyphSize,
12249
- height: legendGlyphSize,
12250
- children: /* @__PURE__ */ jsx("rect", {
12251
- fill: label.value,
12252
- width: legendGlyphSize,
12253
- height: legendGlyphSize
12254
- })
12255
- }), /* @__PURE__ */ jsx(LegendLabel, {
12256
- align: `${((_b4 = (_a4 = value == null ? void 0 : value.main) == null ? void 0 : _a4.legend) == null ? void 0 : _b4.align) || "left"}`,
12257
- margin: "0 0 0 4px",
12258
- children: label.text
12259
- })]
12260
- }, `legend-quantile-${i2}`);
12261
- })
12262
- });
12263
- }
12264
- })]
12253
+ style: (_a2 = barData == null ? void 0 : barData.style) == null ? void 0 : _a2.containerStyle,
12254
+ children: [((_b2 = barData == null ? void 0 : barData.main) == null ? void 0 : _b2.header) && /* @__PURE__ */ jsx("div", {
12255
+ style: {
12256
+ fontWeight: 500,
12257
+ textAlign: "left",
12258
+ fontFamily: "inherit",
12259
+ marginBottom: "20px",
12260
+ padding: "15px 0 1px 20px",
12261
+ fontSize: "18px",
12262
+ color: "#121926",
12263
+ ...(_c2 = barData == null ? void 0 : barData.style) == null ? void 0 : _c2.headerStyle
12264
+ },
12265
+ children: (_d = barData == null ? void 0 : barData.main) == null ? void 0 : _d.header
12266
+ }), GraphRender]
12265
12267
  });
12266
- }
12268
+ };
12267
12269
  const DrawPieGraph = ({
12268
12270
  value,
12269
12271
  parentWidth,