{"version":3,"sources":["../../src/components/BusyBox/BusyBox.tsx","../../src/hooks/useBusyTiming.tsx","../../src/components/BusyCard.tsx","../../src/components/FlexCol.tsx","../../src/components/FlexRow.tsx","../../src/components/HoverScale.tsx"],"sourcesContent":["import type { BoxProps } from '@mui/material'\nimport {\n  Box, Paper, useTheme,\n} from '@mui/material'\nimport type { BusyProps } from '@xylabs/react-shared'\nimport { BusyCircularProgress, BusyLinearProgress } from '@xylabs/react-shared'\nimport React from 'react'\n\nimport { useBusyTiming } from '../../hooks/index.ts'\n\nexport interface BusyBoxProps extends BoxProps, BusyProps {\n  background?: boolean\n  paper?: boolean\n}\n\nconst BusyBox: React.FC<BusyBoxProps> = (\n  {\n    background,\n    children,\n    busyVariant = 'circular',\n    busySize,\n    busyOpacity = 0.85,\n    busyColor,\n    busy,\n    busyCircularProps,\n    busyLinearProps,\n    busyMinimum = 0,\n    paper,\n    style,\n    ...props\n  },\n) => {\n  const theme = useTheme()\n  const internalBusy = useBusyTiming(busy, busyMinimum)\n\n  return (\n    <Box\n      component={paper ? Paper : 'div'}\n      position=\"relative\"\n      style={\n        background\n          ? {\n              backgroundColor: theme.vars.palette.background.default,\n              color: theme.vars.palette.text.primary,\n              ...style,\n            }\n          : style\n      }\n      {...props}\n    >\n      {children}\n      {internalBusy && busyVariant === 'linear'\n        ? <BusyLinearProgress color={busyColor} opacity={busyOpacity} {...busyLinearProps} />\n        : null}\n      {internalBusy && busyVariant === 'circular'\n        ? <BusyCircularProgress color={busyColor} opacity={busyOpacity} size={busySize} {...busyCircularProps} />\n        : null}\n    </Box>\n  )\n}\n\nBusyBox.displayName = 'BusyBoxXYLabs'\n\nexport { BusyBox }\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { delay } from '@xylabs/sdk-js'\nimport { useState } from 'react'\n\nexport const useBusyTiming = (busy?: boolean, busyMinimum = 0) => {\n  const [internalBusy, setInternalBusy] = useState(false)\n  const [busyStart, setBusyStart] = useState(0)\n\n  useAsyncEffect(\n    async (mounted) => {\n      const timer = {\n        evaluate: !busy && busyStart > 0,\n        initialize: busy && busyStart === 0,\n        terminated: !busy && busyStart === 0,\n      }\n      const evaluateTimer = async (mounted: () => boolean) => {\n        const busyDuration = Date.now() - busyStart\n        if (busyDuration < busyMinimum) {\n          await delay(busyMinimum - busyDuration)\n          // Verify busy hasn't changed to true during the delay\n          if (!busy && internalBusy && mounted()) {\n            setBusyStart(0)\n            setInternalBusy(false)\n          }\n        } else if (mounted()) {\n        // busyMinimum exceeded\n          setBusyStart(0)\n        }\n      }\n\n      if (mounted() && busyMinimum === 0) {\n        // sync busy values if no minimum is set\n        setInternalBusy(!!busy)\n        return\n      }\n\n      if (busyMinimum) {\n        const {\n          initialize, evaluate, terminated,\n        } = timer\n        if (initialize && mounted()) {\n          setBusyStart(Date.now())\n          setInternalBusy(true)\n          return\n        }\n\n        if (evaluate) {\n          await evaluateTimer(mounted)\n          return\n        }\n\n        if (terminated) {\n          setInternalBusy(false)\n          return\n        }\n      }\n    },\n    [busy, busyStart, busyMinimum, internalBusy],\n  )\n\n  return internalBusy\n}\n","import type { CardProps } from '@mui/material'\nimport { Card } from '@mui/material'\nimport type {\n  BusyCircularProgressProps,\n  BusyLinearProgressProps,\n  BusyVariant,\n} from '@xylabs/react-shared'\nimport {\n  BusyCircularProgress,\n  BusyLinearProgress,\n} from '@xylabs/react-shared'\nimport type { PropsWithChildren } from 'react'\nimport React from 'react'\n\nimport { useBusyTiming } from '../hooks/index.ts'\n\nexport interface BusyCardProps extends CardProps {\n  busy?: boolean\n  busyMinimum?: number\n  busyVariant?: BusyVariant\n  busyVariantProps?: BusyCircularProgressProps | BusyLinearProgressProps\n}\n\nexport const BusyCard: React.FC<PropsWithChildren<BusyCardProps>> = ({\n  busy,\n  busyMinimum = 500,\n  busyVariant = 'circular',\n  busyVariantProps,\n  children,\n  ...props\n}) => {\n  const internalBusy = useBusyTiming(busy, busyMinimum)\n  return (\n    <Card {...props}>\n      {children}\n      {busyVariant === 'circular' && internalBusy\n        ? <BusyCircularProgress {...(busyVariantProps as BusyCircularProgressProps)} />\n        : null}\n      {busyVariant === 'linear' && internalBusy\n        ? <BusyLinearProgress {...(busyVariantProps as BusyLinearProgressProps)} />\n        : null}\n    </Card>\n  )\n}\n","import React from 'react'\n\nimport { BusyBox } from './BusyBox/index.ts'\nimport type { FlexBoxProps } from './FlexBoxProps.tsx'\n\nconst FlexCol: React.FC<FlexBoxProps> = ({ ref, ...props }) => {\n  return <BusyBox alignItems=\"center\" display=\"flex\" flexDirection=\"column\" justifyContent=\"center\" ref={ref} {...props} />\n}\n\nFlexCol.displayName = 'FlexColXYLabs'\n\nconst FlexGrowCol: React.FC<FlexBoxProps> = ({ ref, ...props }) => {\n  return <FlexCol flexGrow={1} ref={ref} {...props} />\n}\n\nFlexGrowCol.displayName = 'FlexGrowColXYLabs'\n\nexport { FlexCol, FlexGrowCol }\n","import React from 'react'\n\nimport { BusyBox } from './BusyBox/index.ts'\nimport type { FlexBoxProps } from './FlexBoxProps.tsx'\n\nconst FlexRow: React.FC<FlexBoxProps> = ({ ref, ...props }) => {\n  return <BusyBox alignItems=\"center\" display=\"flex\" flexDirection=\"row\" justifyContent=\"center\" ref={ref} {...props} />\n}\n\nFlexRow.displayName = 'FlexRowXYLabs'\n\nconst FlexGrowRow: React.FC<FlexBoxProps> = ({ ref, ...props }: FlexBoxProps) => {\n  return <FlexRow flexGrow={1} ref={ref} {...props} />\n}\n\nFlexGrowRow.displayName = 'FlexGrowRowXYLabs'\n\nexport { FlexGrowRow, FlexRow }\n","import { Box } from '@mui/material'\nimport React from 'react'\n\nimport type { FlexBoxProps } from './FlexBoxProps.tsx'\nimport { FlexRow } from './FlexRow.tsx'\n\nexport type HoverScaleProps = FlexBoxProps & {\n  scale?: number\n}\n\nexport const HoverScale: React.FC<HoverScaleProps> = ({\n  scale, children, ...props\n}) => {\n  return (\n    <FlexRow {...props}>\n      <Box\n        sx={{\n          zoomdiv: {\n            '&:hover': {\n              transform: `scale(${scale})`,\n              transitionDuration: '0.2s',\n              transitionTimingFunction: 'ease',\n            },\n          },\n        }}\n      >\n        {children}\n      </Box>\n    </FlexRow>\n  )\n}\n"],"mappings":";AACA;AAAA,EACE;AAAA,EAAK;AAAA,EAAO;AAAA,OACP;AAEP,SAAS,sBAAsB,0BAA0B;;;ACLzD,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AACtB,SAAS,gBAAgB;AAElB,IAAM,gBAAgB,CAAC,MAAgB,cAAc,MAAM;AAChE,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AACtD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,CAAC;AAE5C;AAAA,IACE,OAAO,YAAY;AACjB,YAAM,QAAQ;AAAA,QACZ,UAAU,CAAC,QAAQ,YAAY;AAAA,QAC/B,YAAY,QAAQ,cAAc;AAAA,QAClC,YAAY,CAAC,QAAQ,cAAc;AAAA,MACrC;AACA,YAAM,gBAAgB,OAAOA,aAA2B;AACtD,cAAM,eAAe,KAAK,IAAI,IAAI;AAClC,YAAI,eAAe,aAAa;AAC9B,gBAAM,MAAM,cAAc,YAAY;AAEtC,cAAI,CAAC,QAAQ,gBAAgBA,SAAQ,GAAG;AACtC,yBAAa,CAAC;AACd,4BAAgB,KAAK;AAAA,UACvB;AAAA,QACF,WAAWA,SAAQ,GAAG;AAEpB,uBAAa,CAAC;AAAA,QAChB;AAAA,MACF;AAEA,UAAI,QAAQ,KAAK,gBAAgB,GAAG;AAElC,wBAAgB,CAAC,CAAC,IAAI;AACtB;AAAA,MACF;AAEA,UAAI,aAAa;AACf,cAAM;AAAA,UACJ;AAAA,UAAY;AAAA,UAAU;AAAA,QACxB,IAAI;AACJ,YAAI,cAAc,QAAQ,GAAG;AAC3B,uBAAa,KAAK,IAAI,CAAC;AACvB,0BAAgB,IAAI;AACpB;AAAA,QACF;AAEA,YAAI,UAAU;AACZ,gBAAM,cAAc,OAAO;AAC3B;AAAA,QACF;AAEA,YAAI,YAAY;AACd,0BAAgB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