@kittycad/react-shared 1.2.0 → 1.2.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.
package/dist/index.js CHANGED
@@ -22378,7 +22378,7 @@ function SignInPageContent({ shouldTrackConversions = false, trackingClasses = (
22378
22378
  }
22379
22379
 
22380
22380
  const Spinner = (props) => {
22381
- return (jsxRuntime.jsxs("svg", { "data-testid": "spinner", viewBox: "0 0 10 10", className: 'w-8 h-8', ...props, children: [jsxRuntime.jsx("title", { children: "spinner" }), jsxRuntime.jsx("circle", { cx: "5", cy: "5", r: "4", stroke: "currentColor", fill: "none", strokeDasharray: "4, 4", className: "animate-spin origin-center" })] }));
22381
+ return (jsxRuntime.jsxs("svg", { "data-testid": "spinner", viewBox: "0 0 10 10", className: "w-8 h-8", ...props, children: [jsxRuntime.jsx("title", { children: "spinner" }), jsxRuntime.jsx("circle", { cx: "5", cy: "5", r: "4", stroke: "currentColor", fill: "none", strokeDasharray: "4, 4", className: "animate-spin origin-center" })] }));
22382
22382
  };
22383
22383
 
22384
22384
  // TODO: figure out where this should live v. modeling-app, for now this is only a subset
@@ -22401,8 +22401,8 @@ const TotalDue = (props) => (jsxRuntime.jsxs("div", { className: `${Number(props
22401
22401
  }, children: [jsxRuntime.jsx("span", { children: "$" }), jsxRuntime.jsx("span", { children: props.amount })] })] }));
22402
22402
  const ErrorMsg = (props) => {
22403
22403
  const [showMessage, setShowMessage] = b$2.useState(false);
22404
- const fadedBg = 'rgba(127, 127, 127, 1)';
22405
- const fadedFg = 'rgba(255, 255, 255, 1)';
22404
+ const fadedBg = 'rgba(0, 0, 0, 0.25)';
22405
+ const fadedFg = 'rgba(255, 255, 255, 0.75)';
22406
22406
  const colors = {
22407
22407
  color: fadedFg,
22408
22408
  stroke: fadedFg,
@@ -22427,7 +22427,17 @@ const getBalanceString = (amount) => {
22427
22427
  return `${Math.floor(amount)} min`;
22428
22428
  };
22429
22429
  const BillingBalance = (props) => {
22430
- return props.amount === Number.POSITIVE_INFINITY ? (jsxRuntime.jsx(CustomIcon, { "data-testid": "infinity", name: "infinity", className: "w-5 h-5" })) : Number.isNaN(props.amount) || props.amount === undefined ? (jsxRuntime.jsx(Spinner, { className: "text-inherit w-4 h-4" })) : (jsxRuntime.jsx("span", { children: getBalanceString(props.amount) }));
22430
+ const [showSpinner, setShowSpinner] = b$2.useState(true);
22431
+ b$2.useEffect(() => {
22432
+ const id = setTimeout(() => {
22433
+ setShowSpinner(false);
22434
+ }, 5000);
22435
+ return () => {
22436
+ clearTimeout(id);
22437
+ };
22438
+ }, []);
22439
+ return props.amount === Number.POSITIVE_INFINITY ? (jsxRuntime.jsx(CustomIcon, { "data-testid": "infinity", name: "infinity", className: "w-5 h-5" })) : showSpinner &&
22440
+ (Number.isNaN(props.amount) || props.amount === undefined) ? (jsxRuntime.jsx(Spinner, { className: "text-inherit w-4 h-4" })) : (jsxRuntime.jsx("span", { children: getBalanceString(props.amount) }));
22431
22441
  };
22432
22442
  const BillingRemaining = (props) => {
22433
22443
  const isFlex = props.mode === exports.BillingRemainingMode.ProgressBarStretch;
@@ -22441,10 +22451,19 @@ const BillingRemaining = (props) => {
22441
22451
  ];
22442
22452
  const hasPaymentMethod = props.paymentMethods !== undefined && props.paymentMethods.length > 0;
22443
22453
  const totalDue = props.userPaymentBalance?.total_due ?? '0.00';
22454
+ const [showSpinner, setShowSpinner] = b$2.useState(true);
22455
+ b$2.useEffect(() => {
22456
+ const id = setTimeout(() => {
22457
+ setShowSpinner(false);
22458
+ }, 5000);
22459
+ return () => {
22460
+ clearTimeout(id);
22461
+ };
22462
+ }, []);
22444
22463
  return (jsxRuntime.jsxs("div", { "data-testid": "billing-remaining", className: [isFlex ? 'flex flex-col gap-1' : 'px-2 flex items-stretch']
22445
22464
  .concat(cssWrapper)
22446
22465
  .join(' '), children: [jsxRuntime.jsxs("div", { className: "flex flex-row gap-2 items-center justify-center", children: [props.error && jsxRuntime.jsx(ErrorMsg, { error: props.error }), jsxRuntime.jsxs("div", { className: `w-full flex flex-col ${isFlex ? '' : 'items-center'}`, children: [!isFlex &&
22447
- (typeof props.balance === 'number' ? (jsxRuntime.jsx("div", { className: "font-mono px-1", "data-testid": "billing-balance", children: jsxRuntime.jsx(BillingBalance, { amount: props.balance }) })) : (jsxRuntime.jsx(Spinner, { className: "text-inherit w-4 h-4" }))), props.balance !== Number.POSITIVE_INFINITY && (jsxRuntime.jsx("div", { className: [isFlex ? 'flex-grow' : 'min-w-10 w-full'].join(' '), children: jsxRuntime.jsx(ProgressBar, { max: props.allowance ?? 1, value: props.balance ?? 0 }) }))] }), !isFlex && (hasPaymentMethod || Number(totalDue.toString()) > 0) && (jsxRuntime.jsx(TotalDue, { amount: totalDue.toString() }))] }), isFlex && (jsxRuntime.jsx("div", { className: "flex flex-row gap-1 text-chalkboard-90", children: typeof props.balance === 'number' ? (props.balance !== Number.POSITIVE_INFINITY ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [getBalanceString(props.balance), " of Zookeeper reasoning time remaining this month"] })) : null) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Spinner, { className: "text-inherit w-4 h-4" }), ' ', jsxRuntime.jsx("span", { children: "Fetching remaining balance..." })] })) }))] }));
22466
+ (typeof props.balance === 'number' ? (jsxRuntime.jsx("div", { className: "font-mono px-1", "data-testid": "billing-balance", children: jsxRuntime.jsx(BillingBalance, { amount: props.balance }) })) : (showSpinner && jsxRuntime.jsx(Spinner, { className: "text-inherit w-4 h-4" }))), props.balance !== Number.POSITIVE_INFINITY && (jsxRuntime.jsx("div", { className: [isFlex ? 'flex-grow' : 'min-w-10 w-full'].join(' '), children: jsxRuntime.jsx(ProgressBar, { max: props.allowance ?? 1, value: props.balance ?? 0 }) }))] }), !isFlex && (hasPaymentMethod || Number(totalDue.toString()) > 0) && (jsxRuntime.jsx(TotalDue, { amount: totalDue.toString() }))] }), isFlex && (jsxRuntime.jsx("div", { className: "flex flex-row gap-1 text-chalkboard-90", children: typeof props.balance === 'number' ? (props.balance !== Number.POSITIVE_INFINITY ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [getBalanceString(props.balance), " of Zookeeper reasoning time remaining this month"] })) : null) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showSpinner && jsxRuntime.jsx(Spinner, { className: "text-inherit w-4 h-4" }), ' ', jsxRuntime.jsx("span", { children: "Fetching remaining balance..." })] })) }))] }));
22448
22467
  };
22449
22468
 
22450
22469
  const SITE = 'https://zoo.dev';