sag_components 2.0.0-beta89 → 2.0.0-beta90

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/index.js CHANGED
@@ -34164,6 +34164,251 @@ const InsightsCarousel = _ref => {
34164
34164
  })))));
34165
34165
  };
34166
34166
 
34167
+ // eslint-disable-next-line react/prop-types
34168
+ const ErrorIcon = _ref => {
34169
+ let {
34170
+ color = '#FF3949',
34171
+ width = '18',
34172
+ height = '18'
34173
+ } = _ref;
34174
+ return /*#__PURE__*/React__default["default"].createElement("svg", {
34175
+ width: width,
34176
+ height: height,
34177
+ viewBox: "0 0 14 13",
34178
+ fill: "none",
34179
+ xmlns: "http://www.w3.org/2000/svg"
34180
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
34181
+ d: "M7 1.625C5.24219 1.625 3.64844 2.5625 2.75781 4.0625C1.89062 5.58594 1.89062 7.4375 2.75781 8.9375C3.64844 10.4609 5.24219 11.375 7 11.375C8.73438 11.375 10.3281 10.4609 11.2188 8.9375C12.0859 7.4375 12.0859 5.58594 11.2188 4.0625C10.3281 2.5625 8.73438 1.625 7 1.625ZM7 12.5C4.84375 12.5 2.875 11.375 1.79688 9.5C0.71875 7.64844 0.71875 5.375 1.79688 3.5C2.875 1.64844 4.84375 0.5 7 0.5C9.13281 0.5 11.1016 1.64844 12.1797 3.5C13.2578 5.375 13.2578 7.64844 12.1797 9.5C11.1016 11.375 9.13281 12.5 7 12.5ZM7 3.5C7.30469 3.5 7.5625 3.75781 7.5625 4.0625V6.6875C7.5625 7.01562 7.30469 7.25 7 7.25C6.67188 7.25 6.4375 7.01562 6.4375 6.6875V4.0625C6.4375 3.75781 6.67188 3.5 7 3.5ZM7.75 8.75C7.75 9.17188 7.39844 9.5 7 9.5C6.57812 9.5 6.25 9.17188 6.25 8.75C6.25 8.35156 6.57812 8 7 8C7.39844 8 7.75 8.35156 7.75 8.75Z",
34182
+ fill: color
34183
+ }));
34184
+ };
34185
+
34186
+ // eslint-disable-next-line react/prop-types
34187
+ const SucceededIcon = _ref => {
34188
+ let {
34189
+ color = '#92CF17',
34190
+ width = '18',
34191
+ height = '18'
34192
+ } = _ref;
34193
+ return /*#__PURE__*/React__default["default"].createElement("svg", {
34194
+ width: width,
34195
+ height: height,
34196
+ viewBox: "0 0 14 13",
34197
+ fill: "none",
34198
+ xmlns: "http://www.w3.org/2000/svg"
34199
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
34200
+ d: "M7 1.625C5.24219 1.625 3.64844 2.5625 2.75781 4.0625C1.89062 5.58594 1.89062 7.4375 2.75781 8.9375C3.64844 10.4609 5.24219 11.375 7 11.375C8.73438 11.375 10.3281 10.4609 11.2188 8.9375C12.0859 7.4375 12.0859 5.58594 11.2188 4.0625C10.3281 2.5625 8.73438 1.625 7 1.625ZM7 12.5C4.84375 12.5 2.875 11.375 1.79688 9.5C0.71875 7.64844 0.71875 5.375 1.79688 3.5C2.875 1.64844 4.84375 0.5 7 0.5C9.13281 0.5 11.1016 1.64844 12.1797 3.5C13.2578 5.375 13.2578 7.64844 12.1797 9.5C11.1016 11.375 9.13281 12.5 7 12.5ZM9.64844 5.39844L6.64844 8.39844C6.41406 8.63281 6.0625 8.63281 5.85156 8.39844L4.35156 6.89844C4.11719 6.6875 4.11719 6.33594 4.35156 6.125C4.5625 5.89062 4.91406 5.89062 5.14844 6.125L6.25 7.22656L8.85156 4.625C9.0625 4.39062 9.41406 4.39062 9.64844 4.625C9.85938 4.83594 9.85938 5.1875 9.64844 5.39844Z",
34201
+ fill: color
34202
+ }));
34203
+ };
34204
+
34205
+ // Styled-components for the progress container and the filler
34206
+ const ProgressBarContainer = styled__default["default"].div`
34207
+ width: ${props => props.width};
34208
+ background-color: #F2F2F2;
34209
+ border-radius: 12px;
34210
+ height: ${props => props.height};
34211
+ margin: 5px 0;
34212
+ `;
34213
+ const ProgressBarFiller = styled__default["default"].div`
34214
+ background-color: ${props => props.color};
34215
+ height: 100%;
34216
+ text-align: center;
34217
+ border-radius: 12px;
34218
+ transition: width 0.5s ease-in-out;
34219
+ width: ${props => props.progress}%;
34220
+ `;
34221
+
34222
+ const ProgressBar = props => {
34223
+ const {
34224
+ progressPercent,
34225
+ refreshInterval,
34226
+ height,
34227
+ width,
34228
+ color
34229
+ } = props;
34230
+ const [progress, setProgress] = React$1.useState(0);
34231
+ React$1.useEffect(() => {
34232
+ const timer = setInterval(() => {
34233
+ setProgress(currentProgress => {
34234
+ const newProgress = currentProgress + 1;
34235
+ if (newProgress > 100) {
34236
+ clearInterval(timer);
34237
+ return 100;
34238
+ }
34239
+ return newProgress;
34240
+ });
34241
+ }, refreshInterval);
34242
+ return () => clearInterval(timer);
34243
+ }, [progressPercent, refreshInterval]);
34244
+ React$1.useEffect(() => {
34245
+ setProgress(progressPercent);
34246
+ }, [progressPercent]);
34247
+ return /*#__PURE__*/React__default["default"].createElement(ProgressBarContainer, {
34248
+ className: "ProgressBarContainer",
34249
+ width: width,
34250
+ height: height
34251
+ }, /*#__PURE__*/React__default["default"].createElement(ProgressBarFiller, {
34252
+ className: "ProgressBarFiller",
34253
+ color: color,
34254
+ progress: progress
34255
+ }));
34256
+ };
34257
+ ProgressBar.propTypes = {
34258
+ progressPercent: PropTypes.number,
34259
+ refreshInterval: PropTypes.number,
34260
+ width: PropTypes.string,
34261
+ height: PropTypes.string,
34262
+ color: PropTypes.string
34263
+ };
34264
+ ProgressBar.defaultProps = {
34265
+ progressPercent: 0,
34266
+ refreshInterval: 100,
34267
+ width: '100%',
34268
+ height: '9px',
34269
+ color: '#066768'
34270
+ };
34271
+
34272
+ const DownloadProgressMainContainer = styled__default["default"].div`
34273
+ font-family: "Poppins", sans-serif;
34274
+ font-style: normal;
34275
+ font-size: 12px;
34276
+ font-weight: 400;
34277
+ color: #212121;
34278
+ line-height: 14px;
34279
+ position: relative;
34280
+ margin: 0;
34281
+ padding: 10px;
34282
+ background: #ffffff;
34283
+ border-radius: 12px;
34284
+ box-shadow: ${props => props.showShadow ? '0px 0px 20px 0px rgba(0, 0, 0, 0.2)' : ''};
34285
+ `;
34286
+ const DownloadProgressContentContainer = styled__default["default"].div`
34287
+ display: flex;
34288
+ align-items: center;
34289
+ margin: 0 10px;
34290
+ gap: 10px;
34291
+ `;
34292
+ const DownloadProgressTitle = styled__default["default"].h3`
34293
+ font-weight: 400;
34294
+ margin: 10px;
34295
+ `;
34296
+ const DownloadProgressStatusMessage = styled__default["default"].h3`
34297
+ margin: 3px 0;
34298
+ &.DownloadProgressStatusMessage_succeeded{
34299
+ font-weight: 500;
34300
+ }
34301
+ &.DownloadProgressStatusMessage_failed{
34302
+ color: #7F7D7D;
34303
+ font-weight: 400;
34304
+ }
34305
+ &.DownloadProgressStatusMessage_TryAgain{
34306
+ color: #1B30AA;
34307
+ font-weight: 400;
34308
+ text-decoration: underline;
34309
+ &:hover {
34310
+ background-Color: #f1f1f1;
34311
+ cursor: pointer;
34312
+ }
34313
+ }
34314
+ `;
34315
+
34316
+ const DownloadProgress = props => {
34317
+ const {
34318
+ title,
34319
+ succeededMessage,
34320
+ failedMessage,
34321
+ downloadStatus,
34322
+ showShadow,
34323
+ progressPercent,
34324
+ refreshInterval,
34325
+ progressBarColor,
34326
+ onTryAgainClick,
34327
+ className
34328
+ } = props;
34329
+ const [DownloadStatus, setDownloadStatus] = React$1.useState(downloadStatus);
34330
+ React$1.useEffect(() => {
34331
+ setDownloadStatus(downloadStatus);
34332
+ }, [downloadStatus]);
34333
+ const displayProgressContent = () => {
34334
+ let content = '';
34335
+ switch (DownloadStatus) {
34336
+ case 'inProgress':
34337
+ content = /*#__PURE__*/React__default["default"].createElement(DownloadProgressContentContainer, {
34338
+ className: "DownloadProgressContentContainer"
34339
+ }, /*#__PURE__*/React__default["default"].createElement(ProgressBar, {
34340
+ className: "ProgressBar",
34341
+ color: progressBarColor,
34342
+ progressPercent: progressPercent,
34343
+ refreshInterval: refreshInterval,
34344
+ width: "100%"
34345
+ }));
34346
+ break;
34347
+ case 'succeeded':
34348
+ content = /*#__PURE__*/React__default["default"].createElement(DownloadProgressContentContainer, {
34349
+ className: "DownloadProgressContentContainer"
34350
+ }, /*#__PURE__*/React__default["default"].createElement(DownloadProgressStatusMessage, {
34351
+ className: "DownloadProgressStatusMessage_succeeded"
34352
+ }, succeededMessage), /*#__PURE__*/React__default["default"].createElement(SucceededIcon, {
34353
+ color: "#92CF17",
34354
+ width: "12px",
34355
+ height: "12px"
34356
+ }));
34357
+ break;
34358
+ case 'failed':
34359
+ content = /*#__PURE__*/React__default["default"].createElement(DownloadProgressContentContainer, {
34360
+ className: "DownloadProgressContentContainer"
34361
+ }, /*#__PURE__*/React__default["default"].createElement(DownloadProgressStatusMessage, {
34362
+ className: "DownloadProgressStatusMessage_failed"
34363
+ }, failedMessage), /*#__PURE__*/React__default["default"].createElement(DownloadProgressStatusMessage, {
34364
+ className: "DownloadProgressStatusMessage_TryAgain",
34365
+ onClick: () => onTryAgainClick({
34366
+ eventName: 'onTryAgainClick'
34367
+ })
34368
+ }, "Try again"), /*#__PURE__*/React__default["default"].createElement(ErrorIcon, {
34369
+ color: "#FF3949",
34370
+ width: "12px",
34371
+ height: "12px"
34372
+ }));
34373
+ break;
34374
+ default:
34375
+ content = '';
34376
+ break;
34377
+ }
34378
+ return content;
34379
+ };
34380
+ return /*#__PURE__*/React__default["default"].createElement(DownloadProgressMainContainer, {
34381
+ className: className,
34382
+ showShadow: showShadow
34383
+ }, /*#__PURE__*/React__default["default"].createElement(DownloadProgressTitle, {
34384
+ className: "DownloadProgressTitle"
34385
+ }, title), displayProgressContent());
34386
+ };
34387
+ DownloadProgress.propTypes = {
34388
+ title: PropTypes.string,
34389
+ succeededMessage: PropTypes.string,
34390
+ failedMessage: PropTypes.string,
34391
+ downloadStatus: PropTypes.string,
34392
+ showShadow: PropTypes.bool,
34393
+ progressPercent: PropTypes.number,
34394
+ refreshInterval: PropTypes.number,
34395
+ progressBarColor: PropTypes.string,
34396
+ onTryAgainClick: PropTypes.func,
34397
+ className: PropTypes.string
34398
+ };
34399
+ DownloadProgress.defaultProps = {
34400
+ title: 'CPG presentation shopper marketing, supplier name ',
34401
+ succeededMessage: 'File Downloaded',
34402
+ failedMessage: 'Something went wrong',
34403
+ downloadStatus: 'inProgress',
34404
+ showShadow: true,
34405
+ progressPercent: 0,
34406
+ refreshInterval: 100,
34407
+ progressBarColor: '#92CF17',
34408
+ onTryAgainClick: () => {},
34409
+ className: 'DownloadProgressMainContainer'
34410
+ };
34411
+
34167
34412
  exports.AreaChart = AreaChart;
34168
34413
  exports.BannerEventBoxList = BannerEventBoxList;
34169
34414
  exports.BarChart = BarChart;
@@ -34180,6 +34425,7 @@ exports.CollapseHeader = CollapseHeader;
34180
34425
  exports.DialogOverlay = DialogOverlay;
34181
34426
  exports.DoubleBarSingleLine = DoubleBarSingleLine;
34182
34427
  exports.DoublePanelDataRow = DoublePanelDataRow;
34428
+ exports.DownloadProgress = DownloadProgress;
34183
34429
  exports.EventDetailsCard = EventDetailsCard;
34184
34430
  exports.EventList = EventList;
34185
34431
  exports.FilterPanel = FilterPanel;