@shipengine/elements 1.1.0 → 1.1.2

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/index.cjs CHANGED
@@ -5615,7 +5615,7 @@ const networkErrorPrettyPrinter = e => {
5615
5615
  return e.message.replaceAll(/Invalid rate\. Invalid rate\./g, "Invalid rate.");
5616
5616
  };
5617
5617
 
5618
- const styles$w = createStyles({
5618
+ const styles$x = createStyles({
5619
5619
  container: {
5620
5620
  alignItems: "center",
5621
5621
  display: "flex",
@@ -5634,7 +5634,7 @@ const styles$w = createStyles({
5634
5634
  */
5635
5635
  const Loader = props => {
5636
5636
  return jsxRuntime.jsx("div", Object.assign({
5637
- css: styles$w.container
5637
+ css: styles$x.container
5638
5638
  }, {
5639
5639
  children: jsxRuntime.jsx(giger.Spinner, Object.assign({}, props, {
5640
5640
  size: props.size || giger.SpinnerSize.SIZE_LARGE
@@ -5666,7 +5666,7 @@ const fill = react.keyframes(_t3 || (_t3 = _$1`
5666
5666
  100% {
5667
5667
  box-shadow: inset 0px 0px 0px 30px #3F8200;
5668
5668
  `));
5669
- const styles$v = createStyles({
5669
+ const styles$w = createStyles({
5670
5670
  checkmark: theme => ({
5671
5671
  animation: `${fill} forwards`,
5672
5672
  borderRadius: "50%",
@@ -5721,7 +5721,7 @@ const SaveStatus = ({
5721
5721
  }
5722
5722
  if (isSaving) {
5723
5723
  return jsxRuntime.jsxs("div", Object.assign({
5724
- css: styles$v.savingContainer
5724
+ css: styles$w.savingContainer
5725
5725
  }, {
5726
5726
  children: [jsxRuntime.jsx(Loader, {
5727
5727
  css: theme => ({
@@ -5729,32 +5729,32 @@ const SaveStatus = ({
5729
5729
  }),
5730
5730
  size: giger.SpinnerSize.SIZE_SMALL
5731
5731
  }), jsxRuntime.jsx(giger.Typography, Object.assign({
5732
- css: styles$v.saving
5732
+ css: styles$w.saving
5733
5733
  }, {
5734
5734
  children: t("manage-defaults:status.saving")
5735
5735
  }))]
5736
5736
  }));
5737
5737
  }
5738
5738
  return !isSaving && !(errors === null || errors === void 0 ? void 0 : errors.length) ? jsxRuntime.jsxs("div", Object.assign({
5739
- css: styles$v.container
5739
+ css: styles$w.container
5740
5740
  }, {
5741
5741
  children: [jsxRuntime.jsx("svg", Object.assign({
5742
- css: styles$v.checkmark,
5742
+ css: styles$w.checkmark,
5743
5743
  viewBox: "0 0 52 52"
5744
5744
  }, {
5745
5745
  children: jsxRuntime.jsx("path", {
5746
- css: styles$v.checkmarkCheck,
5746
+ css: styles$w.checkmarkCheck,
5747
5747
  d: "M14.1 27.2l7.1 7.2 16.7-16.8",
5748
5748
  fill: "none",
5749
5749
  strokeWidth: "5px"
5750
5750
  })
5751
5751
  })), jsxRuntime.jsx(giger.Typography, Object.assign({
5752
- css: styles$v.saved
5752
+ css: styles$w.saved
5753
5753
  }, {
5754
5754
  children: t("manage-defaults:status.saved")
5755
5755
  }))]
5756
5756
  })) : jsxRuntime.jsxs("div", Object.assign({
5757
- css: [styles$v.container, {
5757
+ css: [styles$w.container, {
5758
5758
  padding: "0"
5759
5759
  }]
5760
5760
  }, {
@@ -5764,7 +5764,7 @@ const SaveStatus = ({
5764
5764
  }),
5765
5765
  name: gigerTheme.IconNames.CANCEL_FILLED
5766
5766
  }), jsxRuntime.jsx(giger.Typography, Object.assign({
5767
- css: styles$v.savingFailed
5767
+ css: styles$w.savingFailed
5768
5768
  }, {
5769
5769
  children: t("manage-defaults:status.savingFailed")
5770
5770
  }))]
@@ -5817,7 +5817,7 @@ const Spacer = props => jsxRuntime.jsx("div", {
5817
5817
  css: getSpacerStyles(props)
5818
5818
  });
5819
5819
 
5820
- const styles$u = createStyles({
5820
+ const styles$v = createStyles({
5821
5821
  content: theme => ({
5822
5822
  padding: `${theme.spacing(3)}px ${theme.spacing(4)}px`
5823
5823
  }),
@@ -5865,10 +5865,10 @@ const CollapsiblePanel = ({
5865
5865
  const [isExpanded, toggleIsExpanded] = useToggle(initialExpanded);
5866
5866
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
5867
5867
  children: [jsxRuntime.jsx("div", Object.assign({
5868
- css: styles$u.header
5868
+ css: styles$v.header
5869
5869
  }, {
5870
5870
  children: jsxRuntime.jsxs(giger.Link, Object.assign({
5871
- css: styles$u.link,
5871
+ css: styles$v.link,
5872
5872
  onClick: event => {
5873
5873
  event.preventDefault();
5874
5874
  toggleIsExpanded();
@@ -5888,7 +5888,7 @@ const CollapsiblePanel = ({
5888
5888
  errors: errors,
5889
5889
  isSaving: isSaving
5890
5890
  }), jsxRuntime.jsx(giger.Icon, {
5891
- css: styles$u.icon,
5891
+ css: styles$v.icon,
5892
5892
  "data-testid": "collapsible-panel-dropdown",
5893
5893
  name: isExpanded ? gigerTheme.IconNames.CHEVRON_TOP : gigerTheme.IconNames.CHEVRON_BOTTOM,
5894
5894
  size: giger.IconSize.SIZE_LARGE
@@ -5896,7 +5896,7 @@ const CollapsiblePanel = ({
5896
5896
  }))]
5897
5897
  }))
5898
5898
  })), isExpanded ? jsxRuntime.jsx("section", Object.assign({
5899
- css: styles$u.content
5899
+ css: styles$v.content
5900
5900
  }, {
5901
5901
  children: children
5902
5902
  })) : jsxRuntime.jsx(Spacer, {
@@ -7562,7 +7562,7 @@ const FormPortal = ({
7562
7562
  });
7563
7563
  };
7564
7564
 
7565
- const styles$t = createStyles({
7565
+ const styles$u = createStyles({
7566
7566
  chipList: theme => ({
7567
7567
  gap: theme.spacing(1)
7568
7568
  }),
@@ -7722,7 +7722,7 @@ const AddFundsForm = ({
7722
7722
  })), jsxRuntime.jsx(Spacer, {
7723
7723
  multiplier: 2
7724
7724
  }), jsxRuntime.jsx(giger.ChipList, Object.assign({
7725
- css: styles$t.chipList,
7725
+ css: styles$u.chipList,
7726
7726
  onChange: idx => {
7727
7727
  const chip = chips[idx];
7728
7728
  setSelectedChip(chip);
@@ -7737,7 +7737,7 @@ const AddFundsForm = ({
7737
7737
  }
7738
7738
  }, {
7739
7739
  children: chips.map(chip => jsxRuntime.jsx(giger.Chip, Object.assign({
7740
- css: styles$t.getChip({
7740
+ css: styles$u.getChip({
7741
7741
  isDisabled: chip.value < _minimumAmount,
7742
7742
  isSelected: chip.value === selectedChip.value
7743
7743
  }),
@@ -7754,7 +7754,7 @@ const AddFundsForm = ({
7754
7754
  multiplier: 1
7755
7755
  }), jsxRuntime.jsx(MoneyInput, {
7756
7756
  control: form.control,
7757
- css: styles$t.fundsInput,
7757
+ css: styles$u.fundsInput,
7758
7758
  defaultValue: {
7759
7759
  amount: undefined,
7760
7760
  currency: alchemy.SE.Currency.USD
@@ -7879,7 +7879,7 @@ const Spread = ({
7879
7879
  children: children
7880
7880
  }));
7881
7881
 
7882
- const styles$s = createStyles({
7882
+ const styles$t = createStyles({
7883
7883
  edit: theme => ({
7884
7884
  color: theme.palette.primary.main,
7885
7885
  padding: `0 ${theme.spacing(2)}`
@@ -8008,12 +8008,12 @@ const AutoFundingForm = ({
8008
8008
  }, {
8009
8009
  children: t("manage-funding:autoFunding.readSettings", Object.assign({}, autoFundingConfig))
8010
8010
  })), jsxRuntime.jsx(LinkAction, {
8011
- css: styles$s.edit,
8011
+ css: styles$t.edit,
8012
8012
  onClick: () => handleToggle(true),
8013
8013
  title: t("manage-funding:autoFunding:edit")
8014
8014
  })]
8015
8015
  }), jsxRuntime.jsxs("form", Object.assign({
8016
- css: styles$s.getForm(showForm),
8016
+ css: styles$t.getForm(showForm),
8017
8017
  "data-testid": "auto-funding-form",
8018
8018
  id: "auto-funding-form",
8019
8019
  onSubmit: handleSubmit
@@ -8024,11 +8024,11 @@ const AutoFundingForm = ({
8024
8024
  }, {
8025
8025
  children: t("manage-funding:autoFunding:editSettings")
8026
8026
  })), jsxRuntime.jsx("div", Object.assign({
8027
- css: styles$s.marginLeft
8027
+ css: styles$t.marginLeft
8028
8028
  }, {
8029
8029
  children: jsxRuntime.jsx(MoneyInput, {
8030
8030
  control: form.control,
8031
- css: styles$s.input,
8031
+ css: styles$t.input,
8032
8032
  "data-testid": "auto-funding-threshold-input",
8033
8033
  defaultValue: {
8034
8034
  amount: autoFundingConfig === null || autoFundingConfig === void 0 ? void 0 : autoFundingConfig.autoPurchaseThreshold,
@@ -8041,11 +8041,11 @@ const AutoFundingForm = ({
8041
8041
  showCurrencySymbol: true
8042
8042
  })
8043
8043
  })), jsxRuntime.jsx("div", Object.assign({
8044
- css: styles$s.marginLeft
8044
+ css: styles$t.marginLeft
8045
8045
  }, {
8046
8046
  children: jsxRuntime.jsx(MoneyInput, {
8047
8047
  control: form.control,
8048
- css: styles$s.input,
8048
+ css: styles$t.input,
8049
8049
  "data-testid": "auto-funding-purchase-amount-input",
8050
8050
  defaultValue: {
8051
8051
  amount: autoFundingConfig === null || autoFundingConfig === void 0 ? void 0 : autoFundingConfig.autoPurchaseAmount,
@@ -8058,11 +8058,11 @@ const AutoFundingForm = ({
8058
8058
  showCurrencySymbol: true
8059
8059
  })
8060
8060
  })), jsxRuntime.jsx("div", Object.assign({
8061
- css: styles$s.marginLeft
8061
+ css: styles$t.marginLeft
8062
8062
  }, {
8063
8063
  children: jsxRuntime.jsx(NumberInput, {
8064
8064
  control: form.control,
8065
- css: styles$s.input,
8065
+ css: styles$t.input,
8066
8066
  "data-testid": "auto-funding-max-per-day-input",
8067
8067
  defaultValue: autoFundingConfig === null || autoFundingConfig === void 0 ? void 0 : autoFundingConfig.autoPurchaseCutoff,
8068
8068
  disabled: !watchIsEnabled,
@@ -8102,7 +8102,7 @@ const AutoFundingForm = ({
8102
8102
  });
8103
8103
  };
8104
8104
 
8105
- const styles$r = isLabelRight => createStyles({
8105
+ const styles$s = isLabelRight => createStyles({
8106
8106
  inlineContainer: theme => ({
8107
8107
  alignItems: "center",
8108
8108
  display: "flex",
@@ -8122,14 +8122,14 @@ const InlineLabel = ({
8122
8122
  isLabelRight,
8123
8123
  labelProps: _labelProps = {}
8124
8124
  }) => jsxRuntime.jsxs("div", Object.assign({
8125
- css: styles$r(isLabelRight).inlineContainer
8125
+ css: styles$s(isLabelRight).inlineContainer
8126
8126
  }, {
8127
8127
  children: [jsxRuntime.jsx(giger.Typography, Object.assign({}, _labelProps, {
8128
8128
  children: label
8129
8129
  })), children]
8130
8130
  }));
8131
8131
 
8132
- const styles$q = createStyles({
8132
+ const styles$r = createStyles({
8133
8133
  getBalanceText: balance => theme => ({
8134
8134
  color: balance === undefined ? theme.palette.gray.main : balance >= 0 ? theme.palette.secondary.dark : theme.palette.error.main
8135
8135
  })
@@ -8163,7 +8163,7 @@ const CarrierBalance = ({
8163
8163
  }, {
8164
8164
  children: isFetchingCarrier ? jsxRuntime.jsx(giger.Spinner, {}) : jsxRuntime.jsx(giger.Typography, Object.assign({
8165
8165
  bold: true,
8166
- css: styles$q.getBalanceText(carrierBalance)
8166
+ css: styles$r.getBalanceText(carrierBalance)
8167
8167
  }, {
8168
8168
  children: carrierBalance === undefined ? "----" : formatMoney({
8169
8169
  amount: carrierBalance,
@@ -8191,6 +8191,10 @@ const logoDataByCarrierCode$1 = {
8191
8191
  logo: "https://logos.shipstation.com/ipaas/carriers/stamps_com_wl/icon.svg",
8192
8192
  name: "United States Postal Service"
8193
8193
  },
8194
+ ups: {
8195
+ logo: "https://logos.shipstation.com/ipaas/carriers/ups/icon.svg",
8196
+ name: "UPS"
8197
+ },
8194
8198
  ups_walleted: {
8195
8199
  logo: "https://logos.shipstation.com/ipaas/carriers/ups/icon.svg",
8196
8200
  name: "UPS"
@@ -8205,8 +8209,8 @@ const CarrierIcon = ({
8205
8209
  size: _size = "regular"
8206
8210
  }) => {
8207
8211
  const logoData = logoDataByCarrierCode$1[carrierCode];
8208
- if (!logoData) return jsxRuntime.jsx("div", {
8209
- children: carrierCode.toString()
8212
+ if (!logoData) return jsxRuntime.jsx(giger.Chip, {
8213
+ children: carrierCode.toString().toUpperCase()
8210
8214
  });
8211
8215
  const {
8212
8216
  logo,
@@ -8214,7 +8218,7 @@ const CarrierIcon = ({
8214
8218
  } = logoData;
8215
8219
  // TODO: use theme ICONSIZE
8216
8220
  return jsxRuntime.jsx("img", {
8217
- alt: `${name}-logo`,
8221
+ alt: name,
8218
8222
  height: iconSize[_size],
8219
8223
  src: logo,
8220
8224
  width: iconSize[_size]
@@ -8371,7 +8375,7 @@ const Cube = _a => {
8371
8375
  }));
8372
8376
  };
8373
8377
 
8374
- const styles$p = createStyles({
8378
+ const styles$q = createStyles({
8375
8379
  getDateRangeSelect: fullWidth => theme => ({
8376
8380
  minWidth: theme.spacing(30),
8377
8381
  position: "relative",
@@ -8396,7 +8400,7 @@ const DateRangeSelect = ({
8396
8400
  void onChange(nextOption);
8397
8401
  };
8398
8402
  return jsxRuntime.jsx(giger.Select, Object.assign({
8399
- css: styles$p.getDateRangeSelect(fullWidth),
8403
+ css: styles$q.getDateRangeSelect(fullWidth),
8400
8404
  "data-testid": "date-range-select",
8401
8405
  label: t("wallet-history:dateRange"),
8402
8406
  leftContent: jsxRuntime.jsx(giger.Icon, {
@@ -8465,7 +8469,7 @@ const DateRangeCombo = ({
8465
8469
  });
8466
8470
  };
8467
8471
 
8468
- const styles$o = createStyles({
8472
+ const styles$p = createStyles({
8469
8473
  container: theme => ({
8470
8474
  display: "flex",
8471
8475
  flexDirection: "column",
@@ -8496,13 +8500,13 @@ const DisplayTerm = ({
8496
8500
  t
8497
8501
  } = reactI18next.useTranslation();
8498
8502
  return jsxRuntime.jsx("ul", Object.assign({
8499
- css: styles$o.container
8503
+ css: styles$p.container
8500
8504
  }, {
8501
8505
  children: term.links.map(({
8502
8506
  link,
8503
8507
  title
8504
8508
  }) => jsxRuntime.jsxs("li", Object.assign({
8505
- css: styles$o.termLink
8509
+ css: styles$p.termLink
8506
8510
  }, {
8507
8511
  children: [jsxRuntime.jsx(giger.Typography, Object.assign({
8508
8512
  variant: "subtitle1"
@@ -8511,7 +8515,7 @@ const DisplayTerm = ({
8511
8515
  defaultValue: title
8512
8516
  })
8513
8517
  })), jsxRuntime.jsx(giger.Link, Object.assign({
8514
- css: styles$o.link,
8518
+ css: styles$p.link,
8515
8519
  href: link,
8516
8520
  isExternal: true,
8517
8521
  target: "_blank"
@@ -8569,7 +8573,7 @@ const ErrorFallback = ({
8569
8573
  }));
8570
8574
  };
8571
8575
 
8572
- const styles$n = createStyles({
8576
+ const styles$o = createStyles({
8573
8577
  icon: theme => ({
8574
8578
  color: theme.palette.primary.main,
8575
8579
  marginRight: theme.spacing(2)
@@ -8619,10 +8623,10 @@ const Section = _a => {
8619
8623
  rest = __rest(_a, ["bold", "title", "children", "rightContent"]);
8620
8624
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
8621
8625
  children: [title && jsxRuntime.jsx("summary", Object.assign({
8622
- css: styles$n.summary
8626
+ css: styles$o.summary
8623
8627
  }, {
8624
8628
  children: jsxRuntime.jsxs("div", Object.assign({
8625
- css: styles$n.summaryWrapper
8629
+ css: styles$o.summaryWrapper
8626
8630
  }, {
8627
8631
  children: [title && typeof title === "string" ? jsxRuntime.jsx(giger.Typography, Object.assign({
8628
8632
  bold: bold,
@@ -8630,20 +8634,20 @@ const Section = _a => {
8630
8634
  }, {
8631
8635
  children: title
8632
8636
  })) : title, rightContent && jsxRuntime.jsx("div", Object.assign({
8633
- css: styles$n.rightContentWrapper
8637
+ css: styles$o.rightContentWrapper
8634
8638
  }, {
8635
8639
  children: rightContent
8636
8640
  }))]
8637
8641
  }))
8638
8642
  })), jsxRuntime.jsx("section", Object.assign({
8639
- css: styles$n.section
8643
+ css: styles$o.section
8640
8644
  }, rest, {
8641
8645
  children: children
8642
8646
  }))]
8643
8647
  });
8644
8648
  };
8645
8649
 
8646
- const styles$m = createStyles({
8650
+ const styles$n = createStyles({
8647
8651
  balanceText: theme => ({
8648
8652
  color: theme.palette.secondary.dark
8649
8653
  }),
@@ -8738,7 +8742,7 @@ const FundAndPurchase = ({
8738
8742
  }, {
8739
8743
  children: [jsxRuntime.jsx(giger.Button, Object.assign({
8740
8744
  bold: false,
8741
- css: styles$m.saveRateButton,
8745
+ css: styles$n.saveRateButton,
8742
8746
  disabled: disabled || !carrierId || isPreferredRate && !isRateFormValid || addFundsForm.isSubmitting || isRateFormSubmitting,
8743
8747
  isLoading: isSavingRate,
8744
8748
  onClick: handleSaveRate,
@@ -8758,7 +8762,7 @@ const FundAndPurchase = ({
8758
8762
  // render when no rate has been selected yet
8759
8763
  if (!carrierId) return jsxRuntime.jsxs("div", Object.assign({
8760
8764
  className: className,
8761
- css: styles$m.container
8765
+ css: styles$n.container
8762
8766
  }, {
8763
8767
  children: [jsxRuntime.jsxs(Spread, {
8764
8768
  children: [jsxRuntime.jsx(CarrierBalance, {
@@ -8782,7 +8786,7 @@ const FundAndPurchase = ({
8782
8786
  if (isPreferredRate) {
8783
8787
  return jsxRuntime.jsxs("div", Object.assign({
8784
8788
  className: className,
8785
- css: styles$m.container
8789
+ css: styles$n.container
8786
8790
  }, {
8787
8791
  children: [jsxRuntime.jsx(CarrierBalance, {
8788
8792
  balance: uspsBalance
@@ -8800,7 +8804,7 @@ const FundAndPurchase = ({
8800
8804
  // show balance, but not the funding form.
8801
8805
  if (!isFundingEnabled) return jsxRuntime.jsxs("div", Object.assign({
8802
8806
  className: className,
8803
- css: styles$m.container
8807
+ css: styles$n.container
8804
8808
  }, {
8805
8809
  children: [jsxRuntime.jsx(CarrierBalance, {
8806
8810
  carrierId: carrierId
@@ -8842,13 +8846,13 @@ const FundAndPurchase = ({
8842
8846
  var _a, _b;
8843
8847
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
8844
8848
  children: [jsxRuntime.jsxs("section", Object.assign({
8845
- css: styles$m.getFormExtension(addFundsForm.isCustomAmount)
8849
+ css: styles$n.getFormExtension(addFundsForm.isCustomAmount)
8846
8850
  }, {
8847
8851
  children: [jsxRuntime.jsx(InlineLabel, Object.assign({
8848
8852
  label: t("manage-funding:fundAndPurchase.newBalance")
8849
8853
  }, {
8850
8854
  children: jsxRuntime.jsx(giger.Typography, Object.assign({
8851
- css: styles$m.balanceText
8855
+ css: styles$n.balanceText
8852
8856
  }, {
8853
8857
  children: formatMoney({
8854
8858
  amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
@@ -8859,7 +8863,7 @@ const FundAndPurchase = ({
8859
8863
  label: t("manage-funding:fundAndPurchase.finalBalance")
8860
8864
  }, {
8861
8865
  children: jsxRuntime.jsx(giger.Typography, Object.assign({
8862
- css: styles$m.balanceText
8866
+ css: styles$n.balanceText
8863
8867
  }, {
8864
8868
  children: formatMoney({
8865
8869
  amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
@@ -8896,7 +8900,7 @@ const FundAndPurchase = ({
8896
8900
  }
8897
8901
  };
8898
8902
 
8899
- const styles$l = createStyles({
8903
+ const styles$m = createStyles({
8900
8904
  itemDescription: theme => ({
8901
8905
  display: "flex",
8902
8906
  flexDirection: "column",
@@ -8938,15 +8942,15 @@ const ItemsBreakdownTableHeader = ({
8938
8942
  }) => jsxRuntime.jsx(giger.TableHeader, {
8939
8943
  children: jsxRuntime.jsxs(giger.TableBaseRow, {
8940
8944
  children: [jsxRuntime.jsx(giger.TableHeaderCell, {}), jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
8941
- css: styles$l.numericCell
8945
+ css: styles$m.numericCell
8942
8946
  }, {
8943
8947
  children: "Qty"
8944
8948
  })), hasValue && jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
8945
- css: styles$l.numericCell
8949
+ css: styles$m.numericCell
8946
8950
  }, {
8947
8951
  children: "$/ea"
8948
8952
  })), hasTotal && jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
8949
- css: styles$l.numericCell
8953
+ css: styles$m.numericCell
8950
8954
  }, {
8951
8955
  children: "$ Total"
8952
8956
  }))]
@@ -8963,7 +8967,7 @@ const ItemsBreakdown = ({
8963
8967
  const hasValue = items.some(item => item.value !== undefined);
8964
8968
  const hasTotal = items.some(item => item.totalValue !== undefined);
8965
8969
  return jsxRuntime.jsx("div", Object.assign({
8966
- css: styles$l.tableWrapper
8970
+ css: styles$m.tableWrapper
8967
8971
  }, {
8968
8972
  children: jsxRuntime.jsx(giger.Table, Object.assign({
8969
8973
  header: jsxRuntime.jsx(ItemsBreakdownTableHeader, {
@@ -8981,25 +8985,25 @@ const ItemsBreakdown = ({
8981
8985
  }, index) => jsxRuntime.jsx(React.Fragment, {
8982
8986
  children: jsxRuntime.jsxs(giger.TableBaseRow, {
8983
8987
  children: [jsxRuntime.jsxs(giger.TableBodyCell, Object.assign({
8984
- css: styles$l.itemDescription
8988
+ css: styles$m.itemDescription
8985
8989
  }, {
8986
8990
  children: [jsxRuntime.jsx(giger.Typography, Object.assign({
8987
- css: styles$l.itemName
8991
+ css: styles$m.itemName
8988
8992
  }, {
8989
8993
  children: name
8990
8994
  })), jsxRuntime.jsx(giger.Typography, {
8991
8995
  children: detail
8992
8996
  })]
8993
8997
  })), jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
8994
- css: [styles$l.numericCell, styles$l.itemDetail]
8998
+ css: [styles$m.numericCell, styles$m.itemDetail]
8995
8999
  }, {
8996
9000
  children: quantity
8997
9001
  })), hasValue && jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
8998
- css: [styles$l.numericCell, styles$l.itemDetail]
9002
+ css: [styles$m.numericCell, styles$m.itemDetail]
8999
9003
  }, {
9000
9004
  children: value && formatMoney(value)
9001
9005
  })), hasTotal && jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
9002
- css: [styles$l.numericCell, styles$l.itemDetail]
9006
+ css: [styles$m.numericCell, styles$m.itemDetail]
9003
9007
  }, {
9004
9008
  children: totalValue && formatMoney(totalValue)
9005
9009
  }))]
@@ -9076,6 +9080,161 @@ const ManageFunding = ({
9076
9080
  }));
9077
9081
  };
9078
9082
 
9083
+ const styles$l = createStyles({
9084
+ footer: {
9085
+ "> *": {
9086
+ borderTop: "0 !important"
9087
+ },
9088
+ alignItems: "center",
9089
+ display: "flex",
9090
+ justifyContent: "space-between"
9091
+ },
9092
+ leftFooter: theme => ({
9093
+ display: "flex",
9094
+ margin: theme.spacing(2),
9095
+ span: {
9096
+ fontWeight: theme.typography.fontWeight.bold
9097
+ }
9098
+ }),
9099
+ rowCount: theme => ({
9100
+ alignItems: "center",
9101
+ display: "flex",
9102
+ marginRight: theme.spacing(4),
9103
+ whiteSpace: "pre"
9104
+ }),
9105
+ rowCountDropDown: {
9106
+ "> * > *": {
9107
+ justifyContent: "center !important"
9108
+ }
9109
+ },
9110
+ rowsActions: theme => ({
9111
+ "#selected-row": {
9112
+ ":hover": {
9113
+ backgroundColor: "transparent"
9114
+ },
9115
+ borderRadius: theme.borderRadius.XS,
9116
+ color: theme.palette.black,
9117
+ padding: theme.spacing(1),
9118
+ paddingRight: theme.spacing(0.5)
9119
+ },
9120
+ alignItems: "baseline",
9121
+ display: "flex",
9122
+ span: {
9123
+ alignSelf: "center"
9124
+ }
9125
+ })
9126
+ });
9127
+
9128
+ const DEFAULT_ROW_COUNT_SELECTION = [5, 10, 25, 50];
9129
+ const Pager = ({
9130
+ currentPageSize,
9131
+ pagingData,
9132
+ rowCountSelection: _rowCountSelection = DEFAULT_ROW_COUNT_SELECTION,
9133
+ onPageSelect,
9134
+ onPageSizeSelect
9135
+ }) => {
9136
+ const [isRowCountDropDownOpen, setIsRowCountDropDownOpen] = React.useState(false);
9137
+ const buttonIconRef = React.useRef(null);
9138
+ const {
9139
+ t
9140
+ } = reactI18next.useTranslation();
9141
+ const toggleRowCountDropdown = React.useCallback(() => setIsRowCountDropDownOpen(prev => !prev), []);
9142
+ const handleClickAway = event => {
9143
+ var _a;
9144
+ if ((_a = buttonIconRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) {
9145
+ return;
9146
+ }
9147
+ toggleRowCountDropdown();
9148
+ };
9149
+ return jsxRuntime.jsxs("div", Object.assign({
9150
+ css: styles$l.footer
9151
+ }, {
9152
+ children: [jsxRuntime.jsxs("div", Object.assign({
9153
+ css: styles$l.leftFooter
9154
+ }, {
9155
+ children: [jsxRuntime.jsx("div", Object.assign({
9156
+ css: styles$l.rowCount
9157
+ }, {
9158
+ children: jsxRuntime.jsx(reactI18next.Trans, {
9159
+ components: [jsxRuntime.jsx("b", {
9160
+ style: {
9161
+ fontWeight: "bold"
9162
+ }
9163
+ }, "1")],
9164
+ count: pagingData.total,
9165
+ i18nKey: "common:grid.row-count",
9166
+ values: {
9167
+ firstIndex: pagingData.total !== 0 ? 1 + (pagingData.page - 1) * currentPageSize : 0,
9168
+ lastIndex: Math.min(pagingData.total, pagingData.page * currentPageSize)
9169
+ }
9170
+ })
9171
+ })), jsxRuntime.jsxs("div", Object.assign({
9172
+ css: styles$l.rowsActions
9173
+ }, {
9174
+ children: [t("common:grid.rows"), jsxRuntime.jsx(giger.Button, Object.assign({
9175
+ id: "selected-row",
9176
+ onClick: () => toggleRowCountDropdown(),
9177
+ ref: buttonIconRef,
9178
+ variant: giger.ButtonVariant.TEXT
9179
+ }, {
9180
+ children: currentPageSize
9181
+ })), isRowCountDropDownOpen ? jsxRuntime.jsx(giger.Icon, {
9182
+ name: gigerTheme.IconNames.CHEVRON_TOP,
9183
+ onClick: () => toggleRowCountDropdown(),
9184
+ size: giger.IconSize.SIZE_MEDIUM
9185
+ }) : jsxRuntime.jsx(giger.Icon, {
9186
+ name: gigerTheme.IconNames.CHEVRON_BOTTOM,
9187
+ onClick: () => toggleRowCountDropdown(),
9188
+ size: giger.IconSize.SIZE_MEDIUM
9189
+ }), jsxRuntime.jsx(giger.DropdownOptionList, Object.assign({
9190
+ css: styles$l.rowCountDropDown,
9191
+ dropdownWidth: "max-content",
9192
+ isOpen: isRowCountDropDownOpen,
9193
+ onChange: () => toggleRowCountDropdown(),
9194
+ onClickAway: handleClickAway,
9195
+ placement: "bottom",
9196
+ reference: buttonIconRef.current
9197
+ }, {
9198
+ children: _rowCountSelection.map(selection => jsxRuntime.jsx(giger.Option, Object.assign({
9199
+ onClick: () => onPageSizeSelect(selection),
9200
+ value: String(selection)
9201
+ }, {
9202
+ children: selection
9203
+ }), selection))
9204
+ }))]
9205
+ }))]
9206
+ })), jsxRuntime.jsx("div", {
9207
+ children: jsxRuntime.jsx(giger.Pagination, {
9208
+ boundaryPagesToShow: 5,
9209
+ currentPage: pagingData.page,
9210
+ onPageChange: onPageSelect,
9211
+ totalPages: pagingData.pages
9212
+ })
9213
+ })]
9214
+ }));
9215
+ };
9216
+
9217
+ const usePager = (initialPageSize = 10) => {
9218
+ const [page, setPage] = React.useState(1);
9219
+ const [pageSize, setPageSize] = React.useState(initialPageSize);
9220
+ const handlePageSelect = page => {
9221
+ setPage(page);
9222
+ };
9223
+ const handlePageSizeSelect = pageSize => {
9224
+ setPageSize(pageSize);
9225
+ };
9226
+ return {
9227
+ page,
9228
+ pagerProps: {
9229
+ currentPage: page,
9230
+ currentPageSize: pageSize,
9231
+ onPageSelect: handlePageSelect,
9232
+ onPageSizeSelect: handlePageSizeSelect
9233
+ },
9234
+ pageSize
9235
+ };
9236
+ };
9237
+
9079
9238
  const addressParserSchema = zod.z.object({
9080
9239
  fullAddress: zod.z.string().min(1)
9081
9240
  });
@@ -10711,111 +10870,28 @@ const StoryNotes = ({
10711
10870
  });
10712
10871
 
10713
10872
  const styles$e = createStyles({
10714
- footer: {
10715
- "> *": {
10716
- borderTop: "0 !important"
10717
- },
10718
- alignItems: "center",
10719
- display: "flex",
10720
- justifyContent: "space-between"
10721
- },
10722
- leftFooter: theme => ({
10723
- display: "flex",
10724
- margin: theme.spacing(2),
10725
- span: {
10726
- fontWeight: theme.typography.fontWeight.bold
10727
- }
10728
- }),
10729
- rowCount: theme => ({
10730
- alignItems: "center",
10731
- display: "flex",
10732
- marginRight: theme.spacing(4),
10733
- whiteSpace: "pre"
10734
- }),
10735
- rowCountDropDown: {
10736
- "> * > *": {
10737
- justifyContent: "center !important"
10738
- }
10739
- },
10740
- rowsActions: theme => ({
10741
- "#selected-row": {
10742
- ":hover": {
10743
- backgroundColor: "transparent"
10744
- },
10745
- borderRadius: theme.borderRadius.XS,
10746
- color: theme.palette.black,
10747
- padding: theme.spacing(1),
10748
- paddingRight: theme.spacing(0.5)
10749
- },
10750
- alignItems: "baseline",
10751
- display: "flex",
10752
- span: {
10753
- alignSelf: "center"
10754
- }
10873
+ checkboxHeader: theme => ({
10874
+ width: theme.spacing(6)
10755
10875
  }),
10756
10876
  table: {
10757
10877
  "*": {
10758
10878
  overflow: "hidden",
10759
10879
  textOverflow: "clip !important"
10760
10880
  }
10761
- },
10762
- tableHeader: theme => ({
10763
- "> :nth-of-type(1)": {
10764
- width: theme.spacing(6)
10765
- },
10766
- "> :nth-of-type(2)": {
10767
- width: theme.spacing(20)
10768
- },
10769
- "> :nth-of-type(7)": {
10770
- width: theme.spacing(16)
10771
- }
10772
- })
10881
+ }
10773
10882
  });
10774
10883
 
10775
10884
  const GridController = ({
10776
- currentPageSize,
10777
10885
  columns,
10778
10886
  data,
10779
- pagingData,
10780
- rowCountSelection: _rowCountSelection = [5, 10, 25, 50],
10781
- onPageSelect,
10782
- onPageSizeSelect,
10783
- onRowClick
10887
+ footerContent,
10888
+ onRowClick,
10889
+ useCheckboxes: _useCheckboxes = false
10784
10890
  }) => {
10785
10891
  var _a, _b, _c;
10786
- const {
10787
- t
10788
- } = reactI18next.useTranslation();
10789
- const [isRowCountDropDownOpen, setIsRowCountDropDownOpen] = React.useState(false);
10790
10892
  const [isChecked, setIsChecked] = React.useState((_a = data === null || data === void 0 ? void 0 : data.map(() => false)) !== null && _a !== void 0 ? _a : []);
10791
- const buttonIconRef = React.useRef(null);
10792
- const toggleRowCountDropdown = React.useCallback(() => setIsRowCountDropDownOpen(prev => !prev), []);
10793
- const sortedColumns = React.useMemo(() => {
10794
- const sortedKeys = Object.keys(columns).sort((a, b) => {
10795
- var _a, _b, _c, _d;
10796
- const orderA = (_b = (_a = columns[a]) === null || _a === void 0 ? void 0 : _a.columnOrder) !== null && _b !== void 0 ? _b : 0;
10797
- const orderB = (_d = (_c = columns[b]) === null || _c === void 0 ? void 0 : _c.columnOrder) !== null && _d !== void 0 ? _d : 0;
10798
- return orderA - orderB;
10799
- });
10800
- const sortedColumns = {};
10801
- for (const key of sortedKeys) {
10802
- sortedColumns[key] = columns[key];
10803
- }
10804
- return sortedColumns;
10805
- }, [columns]);
10806
- const handleClickAway = event => {
10807
- var _a;
10808
- if ((_a = buttonIconRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) {
10809
- return;
10810
- }
10811
- toggleRowCountDropdown();
10812
- };
10813
10893
  const getColumnHeaderContents = () => {
10814
- const columnKeys = Object.keys(sortedColumns);
10815
- return columnKeys.map(column => {
10816
- var _a;
10817
- return (_a = columns[column]) === null || _a === void 0 ? void 0 : _a.headerContent;
10818
- });
10894
+ return columns.map(column => column.headerContent);
10819
10895
  };
10820
10896
  const isAllChecked = React.useMemo(() => isChecked.length > 0 && isChecked.every(check => check), [isChecked]);
10821
10897
  const isIndeterminate = React.useMemo(() => isChecked.some(check => check), [isChecked]);
@@ -10836,86 +10912,23 @@ const GridController = ({
10836
10912
  return jsxRuntime.jsx(giger.Table, Object.assign({
10837
10913
  css: styles$e.table,
10838
10914
  "data-testid": "grid",
10839
- footer: jsxRuntime.jsxs("div", Object.assign({
10840
- css: styles$e.footer
10841
- }, {
10842
- children: [jsxRuntime.jsxs("div", Object.assign({
10843
- css: styles$e.leftFooter
10844
- }, {
10845
- children: [jsxRuntime.jsx("div", Object.assign({
10846
- css: styles$e.rowCount
10847
- }, {
10848
- children: jsxRuntime.jsx(reactI18next.Trans, {
10849
- components: [jsxRuntime.jsx("b", {
10850
- style: {
10851
- fontWeight: "bold"
10852
- }
10853
- }, "1")],
10854
- count: pagingData.total,
10855
- i18nKey: "common:grid.row-count",
10856
- values: {
10857
- firstIndex: pagingData.total !== 0 ? 1 + (pagingData.page - 1) * currentPageSize : 0,
10858
- lastIndex: Math.min(pagingData.total, pagingData.page * currentPageSize)
10859
- }
10860
- })
10861
- })), jsxRuntime.jsxs("div", Object.assign({
10862
- css: styles$e.rowsActions
10863
- }, {
10864
- children: [t("common:grid.rows"), jsxRuntime.jsx(giger.Button, Object.assign({
10865
- id: "selected-row",
10866
- onClick: () => toggleRowCountDropdown(),
10867
- ref: buttonIconRef,
10868
- variant: giger.ButtonVariant.TEXT
10869
- }, {
10870
- children: currentPageSize
10871
- })), isRowCountDropDownOpen ? jsxRuntime.jsx(giger.Icon, {
10872
- name: gigerTheme.IconNames.CHEVRON_TOP,
10873
- onClick: () => toggleRowCountDropdown(),
10874
- size: giger.IconSize.SIZE_MEDIUM
10875
- }) : jsxRuntime.jsx(giger.Icon, {
10876
- name: gigerTheme.IconNames.CHEVRON_BOTTOM,
10877
- onClick: () => toggleRowCountDropdown(),
10878
- size: giger.IconSize.SIZE_MEDIUM
10879
- }), jsxRuntime.jsx(giger.DropdownOptionList, Object.assign({
10880
- css: styles$e.rowCountDropDown,
10881
- dropdownWidth: "max-content",
10882
- isOpen: isRowCountDropDownOpen,
10883
- onChange: () => toggleRowCountDropdown(),
10884
- onClickAway: handleClickAway,
10885
- placement: "bottom",
10886
- reference: buttonIconRef.current
10887
- }, {
10888
- children: _rowCountSelection.map(selection => jsxRuntime.jsx(giger.Option, Object.assign({
10889
- onClick: () => onPageSizeSelect(selection),
10890
- value: String(selection)
10891
- }, {
10892
- children: selection
10893
- }), selection))
10894
- }))]
10895
- }))]
10896
- })), jsxRuntime.jsx(giger.TableFooter, {
10897
- children: jsxRuntime.jsx(giger.Pagination, {
10898
- boundaryPagesToShow: 5,
10899
- currentPage: pagingData.page,
10900
- onPageChange: onPageSelect,
10901
- totalPages: pagingData.pages
10902
- })
10903
- })]
10904
- })),
10915
+ footer: footerContent && jsxRuntime.jsx(giger.TableFooter, {
10916
+ children: footerContent
10917
+ }),
10905
10918
  header: jsxRuntime.jsx(giger.TableHeader, {
10906
- children: jsxRuntime.jsxs(giger.TableHeaderRow, Object.assign({
10907
- css: styles$e.tableHeader
10908
- }, {
10909
- children: [jsxRuntime.jsx(giger.TableHeaderCell, {
10919
+ children: jsxRuntime.jsxs(giger.TableHeaderRow, {
10920
+ children: [_useCheckboxes ? jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
10921
+ css: styles$e.checkboxHeader
10922
+ }, {
10910
10923
  children: jsxRuntime.jsx(giger.Checkbox, {
10911
10924
  checked: (_b = isAllChecked || isIndeterminate) !== null && _b !== void 0 ? _b : false,
10912
10925
  indeterminate: (_c = !isAllChecked && isIndeterminate) !== null && _c !== void 0 ? _c : false,
10913
10926
  onChange: event => toggleAllCheckboxes(event.target.checked)
10914
10927
  })
10915
- }), getColumnHeaderContents().map((header, index) => jsxRuntime.jsx(giger.TableHeaderCell, {
10928
+ })) : null, getColumnHeaderContents().map((header, index) => jsxRuntime.jsx(giger.TableHeaderCell, {
10916
10929
  children: header
10917
10930
  }, index))]
10918
- }))
10931
+ })
10919
10932
  })
10920
10933
  }, {
10921
10934
  children: jsxRuntime.jsx(giger.TableBody, {
@@ -10924,20 +10937,17 @@ const GridController = ({
10924
10937
  return jsxRuntime.jsxs(giger.TableRow, Object.assign({
10925
10938
  onClick: onRowClick ? () => onRowClick(row) : undefined
10926
10939
  }, {
10927
- children: [jsxRuntime.jsx(giger.TableBodyCell, {
10940
+ children: [_useCheckboxes ? jsxRuntime.jsx(giger.TableBodyCell, {
10928
10941
  children: jsxRuntime.jsx(giger.Checkbox, {
10929
10942
  checked: (_a = isChecked[index]) !== null && _a !== void 0 ? _a : false,
10930
10943
  onChange: () => toggleCheckbox(index)
10931
10944
  })
10932
- }), Object.keys(sortedColumns).map((columnName, index) => {
10933
- var _a;
10934
- const cellData = row[columnName];
10935
- const render = (_a = columns[columnName]) === null || _a === void 0 ? void 0 : _a.renderCellContent;
10936
- if (!render || !cellData) {
10945
+ }) : null, columns.map((column, index) => {
10946
+ if (!column.renderCellContent) {
10937
10947
  return null;
10938
10948
  } else {
10939
10949
  return jsxRuntime.jsx(giger.TableBodyCell, {
10940
- children: render(row)
10950
+ children: column.renderCellContent(row)
10941
10951
  }, index);
10942
10952
  }
10943
10953
  })]
@@ -10954,7 +10964,7 @@ const CellFormattedDate = ({
10954
10964
  const [formatWithShort, setFormatWithShort] = React.useState(!!short);
10955
10965
  return jsxRuntime.jsx("div", {
10956
10966
  children: jsxRuntime.jsx("div", {
10957
- children: formatWithShort ? formatDate(date) : formatDateDDMMYY(date)
10967
+ children: formatWithShort ? formatDateDDMMYY(date) : formatDate(date)
10958
10968
  })
10959
10969
  });
10960
10970
  };
@@ -19201,6 +19211,7 @@ exports.ManageFunding = ManageFunding;
19201
19211
  exports.ManageWarehouses = manageWarehouses$1;
19202
19212
  exports.Onboarding = onboarding;
19203
19213
  exports.PageLayoutProvider = PageLayoutProvider;
19214
+ exports.Pager = Pager;
19204
19215
  exports.PaymentMethodSettings = PaymentMethodSettings;
19205
19216
  exports.Portal = Portal;
19206
19217
  exports.PoweredByShipEngine = PoweredByShipEngine;
@@ -19302,6 +19313,7 @@ exports.useInsuranceProviderOptions = useInsuranceProviderOptions;
19302
19313
  exports.useNestedForm = useNestedForm;
19303
19314
  exports.usePackageOptions = usePackageOptions;
19304
19315
  exports.usePageLayout = usePageLayout;
19316
+ exports.usePager = usePager;
19305
19317
  exports.useRateOptions = useRateOptions;
19306
19318
  exports.useRootPortal = useRootPortal;
19307
19319
  exports.useRunOnceOnTrue = useRunOnceOnTrue;