@craftzbay/ui 0.11.4 → 1.0.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/README.md +1 -1
- package/dist-lib/components/ui/Carousel.js.map +1 -1
- package/dist-lib/components/ui/Chart.js +72 -72
- package/dist-lib/components/ui/Chart.js.map +1 -1
- package/dist-lib/components/ui/ContextMenu.js +1 -1
- package/dist-lib/components/ui/ContextMenu.js.map +1 -1
- package/dist-lib/components/ui/DropdownMenu.js +1 -1
- package/dist-lib/components/ui/DropdownMenu.js.map +1 -1
- package/dist-lib/components/ui/Icon.js.map +1 -1
- package/dist-lib/hooks/use-debounce.js +2 -5
- package/dist-lib/hooks/use-debounce.js.map +1 -1
- package/dist-lib/hooks/use-delayed-loading.js +6 -5
- package/dist-lib/hooks/use-delayed-loading.js.map +1 -1
- package/dist-lib/hooks/use-modifier-key.d.ts +0 -4
- package/dist-lib/hooks/use-modifier-key.js +5 -7
- package/dist-lib/hooks/use-modifier-key.js.map +1 -1
- package/dist-lib/icons/index.d.ts +1 -1
- package/dist-lib/icons/index.js +81 -81
- package/dist-lib/icons/index.js.map +1 -1
- package/dist-lib/styles.css +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ Inside `packages/ui` itself, `pnpm build` produces the distributable bundle and
|
|
|
109
109
|
## Tech stack
|
|
110
110
|
|
|
111
111
|
- **Tailwind CSS v4** — tokens defined in `@theme` in `src/styles/theme.css` (`globals.css` = tailwind + tw-animate-css + theme)
|
|
112
|
-
- **React 18 / 19** + **TypeScript 5.7
|
|
112
|
+
- **React 18 / 19** + **TypeScript 5.7+**
|
|
113
113
|
- **Radix UI** primitives for accessibility-correct overlays
|
|
114
114
|
- **class-variance-authority** + `cn()` (`clsx` + `tailwind-merge`)
|
|
115
115
|
- **Lucide** icons (16 / 20px, 1.5 stroke)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.js","names":[],"sources":["../../../src/components/ui/Carousel.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useState,\n type HTMLAttributes,\n type ComponentPropsWithoutRef,\n type KeyboardEvent,\n} from 'react';\nimport { version as reactVersion } from 'react';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ChevronLeft, ChevronRight } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\nimport { formatString } from '@/lib/strings';\nimport { IconButton } from './IconButton';\n\n// `inert` is a boolean attribute. React 19 renders `inert={true}` as `inert=\"\"`;\n// React 18 has no knowledge of it and only forwards a string, so pass `''`\n// there (it would drop `true` with a warning). Typed loosely for both.\nconst INERT_PROPS = {\n inert: Number(reactVersion.split('.')[0]) >= 19 ? true : '',\n} as Record<string, unknown>;\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype CarouselOptions = Parameters<typeof useEmblaCarousel>[0];\n\ninterface CarouselContextValue {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: CarouselApi;\n canPrev: boolean;\n canNext: boolean;\n scrollPrev: () => void;\n scrollNext: () => void;\n orientation: 'horizontal' | 'vertical';\n slideCount: number;\n /** Indices of slides currently in view (others are inert). */\n inView: number[];\n}\n\nconst CarouselContext = createContext<CarouselContextValue | null>(null);\n\nfunction useCarousel() {\n const ctx = useContext(CarouselContext);\n if (!ctx) throw new Error('Carousel components must be used inside <Carousel>');\n return ctx;\n}\n\nexport interface CarouselProps extends HTMLAttributes<HTMLDivElement> {\n opts?: CarouselOptions;\n orientation?: 'horizontal' | 'vertical';\n setApi?: (api: CarouselApi) => void;\n}\n\n/**\n * Embla-backed carousel. Compose with `<CarouselContent>`, `<CarouselItem>`,\n * `<CarouselPrevious>`, and `<CarouselNext>`.\n */\nexport const Carousel = forwardRef<HTMLDivElement, CarouselProps>(function Carousel(\n {\n opts,\n orientation = 'horizontal',\n setApi,\n className,\n children,\n onKeyDown,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...props\n },\n ref,\n) {\n const strings = useStrings();\n const [carouselRef, api] = useEmblaCarousel({\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n });\n const [canPrev, setCanPrev] = useState(false);\n const [canNext, setCanNext] = useState(false);\n const [slideCount, setSlideCount] = useState(0);\n const [inView, setInView] = useState<number[]>([]);\n\n const onSelect = useCallback((api: CarouselApi) => {\n if (!api) return;\n setCanPrev(api.canScrollPrev());\n setCanNext(api.canScrollNext());\n setInView(api.slidesInView());\n }, []);\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const prevKey = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';\n const nextKey = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown';\n if (event.key === prevKey) {\n event.preventDefault();\n api?.scrollPrev();\n } else if (event.key === nextKey) {\n event.preventDefault();\n api?.scrollNext();\n }\n };\n\n useEffect(() => {\n if (!api) return;\n setApi?.(api);\n onSelect(api);\n api.on('reInit', onSelect).on('select', onSelect).on('slidesInView', onSelect);\n return () => {\n api.off('reInit', onSelect).off('select', onSelect).off('slidesInView', onSelect);\n };\n }, [api, onSelect, setApi]);\n\n useEffect(() => {\n if (!api) return;\n const count = () => setSlideCount(api.slideNodes().length);\n count();\n api.on('reInit', count);\n return () => {\n api.off('reInit', count);\n };\n }, [api]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api,\n canPrev,\n canNext,\n scrollPrev: () => api?.scrollPrev(),\n scrollNext: () => api?.scrollNext(),\n orientation,\n slideCount,\n inView,\n }}\n >\n {/* Arrow keys act only while focus is inside the region (it is not itself\n focusable); the buttons remain the primary control. */}\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n ref={ref}\n className={cn('relative isolate', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={ariaLabel ?? (ariaLabelledby ? undefined : strings.carousel.label)}\n aria-labelledby={ariaLabelledby}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n});\nCarousel.displayName = 'Carousel';\n\nexport const CarouselContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function CarouselContent({ className, ...props }, ref) {\n const { carouselRef, orientation } = useCarousel();\n return (\n <div ref={carouselRef} className=\"overflow-hidden\">\n <div\n ref={ref}\n className={cn(\n 'flex',\n orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col',\n className,\n )}\n {...props}\n />\n </div>\n );\n },\n);\nCarouselContent.displayName = 'CarouselContent';\n\nexport interface CarouselItemProps extends HTMLAttributes<HTMLDivElement> {\n /** 0-based position, used for the default \"{i+1} of {n}\" label. */\n index?: number;\n}\n\nexport const CarouselItem = forwardRef<HTMLDivElement, CarouselItemProps>(function CarouselItem(\n { className, index, 'aria-label': ariaLabel, ...props },\n ref,\n) {\n const strings = useStrings();\n const { orientation, slideCount, inView } = useCarousel();\n const defaultLabel =\n index !== undefined && slideCount > 0\n ? formatString(strings.carousel.slide, { index: index + 1, count: slideCount })\n : undefined;\n // Off-screen slides are inert: not in the tab order, not read by AT. Only\n // possible when `index` is provided (unknown index → always live).\n const offscreen = index !== undefined && inView.length > 0 && !inView.includes(index);\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n aria-label={ariaLabel ?? defaultLabel}\n aria-hidden={offscreen || undefined}\n {...(offscreen ? INERT_PROPS : undefined)}\n className={cn(\n 'min-w-0 shrink-0 grow-0 basis-full',\n orientation === 'horizontal' ? 'pl-4' : 'pt-4',\n className,\n )}\n {...props}\n />\n );\n});\nCarouselItem.displayName = 'CarouselItem';\n\ntype CarouselButtonProps = Omit<\n ComponentPropsWithoutRef<typeof IconButton>,\n 'icon' | 'aria-label'\n> & { 'aria-label'?: string };\n\nexport const CarouselPrevious = forwardRef<HTMLButtonElement, CarouselButtonProps>(\n function CarouselPrevious({ className, 'aria-label': ariaLabel, ...props }, ref) {\n const { canPrev, scrollPrev, orientation } = useCarousel();\n const strings = useStrings();\n return (\n <IconButton\n ref={ref}\n aria-label={ariaLabel ?? strings.carousel.previous}\n variant=\"outline\"\n disabled={!canPrev}\n onClick={scrollPrev}\n icon={<ChevronLeft />}\n className={cn(\n 'absolute z-10',\n orientation === 'horizontal'\n ? 'top-1/2 -left-12 -translate-y-1/2'\n : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n {...props}\n />\n );\n },\n);\nCarouselPrevious.displayName = 'CarouselPrevious';\n\nexport const CarouselNext = forwardRef<HTMLButtonElement, CarouselButtonProps>(\n function CarouselNext({ className, 'aria-label': ariaLabel, ...props }, ref) {\n const { canNext, scrollNext, orientation } = useCarousel();\n const strings = useStrings();\n return (\n <IconButton\n ref={ref}\n aria-label={ariaLabel ?? strings.carousel.next}\n variant=\"outline\"\n disabled={!canNext}\n onClick={scrollNext}\n icon={<ChevronRight />}\n className={cn(\n 'absolute z-10',\n orientation === 'horizontal'\n ? 'top-1/2 -right-12 -translate-y-1/2'\n : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n {...props}\n />\n );\n },\n);\nCarouselNext.displayName = 'CarouselNext';\n"],"mappings":";;;;;;;;;;AAwBA,IAAM,IAAc,EAClB,OAAO,OAAO,EAAa,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,MAAY,GAC3D,GAkBM,IAAkB,EAA2C,IAAI;AAEvE,SAAS,IAAc;CACrB,IAAM,IAAM,EAAW,CAAe;CACtC,IAAI,CAAC,GAAK,MAAU,MAAM,oDAAoD;CAC9E,OAAO;AACT;AAYA,IAAa,IAAW,EAA0C,SAChE,EACE,SACA,iBAAc,cACd,WACA,cACA,aACA,cACA,cAAc,GACd,mBAAmB,GACnB,GAAG,KAEL,GACA;CACA,IAAM,IAAU,EAAW,GACrB,CAAC,GAAa,KAAO,EAA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Y,mBAAgB,EAAY,GACnD,IAAU,EAAW;CAC3B,OACE,kBAAC,GAAD;EACO;EACL,cAAY,KAAa,EAAQ,SAAS;EAC1C,SAAQ;EACR,UAAU,CAAC;EACX,SAAS;EACT,MAAM,kBAAC,GAAD,CAAc,CAAA;EACpB,WAAW,EACT,iBACA,MAAgB,eACZ,sCACA,+CACJ,CACF;EACA,GAAI;CACL,CAAA;AAEL,CACF;AACA,EAAiB,cAAc;AAE/B,IAAa,IAAe,EAC1B,SAAsB,EAAE,cAAW,cAAc,GAAW,GAAG,KAAS,GAAK;CAC3E,IAAM,EAAE,YAAS,eAAY,mBAAgB,EAAY,GACnD,IAAU,EAAW;CAC3B,OACE,kBAAC,GAAD;EACO;EACL,cAAY,KAAa,EAAQ,SAAS;EAC1C,SAAQ;EACR,UAAU,CAAC;EACX,SAAS;EACT,MAAM,kBAAC,GAAD,CAAe,CAAA;EACrB,WAAW,EACT,iBACA,MAAgB,eACZ,uCACA,kDACJ,CACF;EACA,GAAI;CACL,CAAA;AAEL,CACF;AACA,EAAa,cAAc"}
|
|
1
|
+
{"version":3,"file":"Carousel.js","names":[],"sources":["../../../src/components/ui/Carousel.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useState,\n type HTMLAttributes,\n type ComponentPropsWithoutRef,\n type KeyboardEvent,\n} from 'react';\nimport { version as reactVersion } from 'react';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ChevronLeft, ChevronRight } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\nimport { formatString } from '@/lib/strings';\nimport { IconButton } from './IconButton';\n\n// `inert` is a boolean attribute. React 19 renders `inert={true}` as `inert=\"\"`;\n// React 18 has no knowledge of it and only forwards a string, so pass `''`\n// there (it would drop `true` with a warning). Typed loosely for both.\nconst INERT_PROPS = {\n inert: Number(reactVersion.split('.')[0]) >= 19 ? true : '',\n} as Record<string, unknown>;\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype CarouselOptions = Parameters<typeof useEmblaCarousel>[0];\n\ninterface CarouselContextValue {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: CarouselApi;\n canPrev: boolean;\n canNext: boolean;\n scrollPrev: () => void;\n scrollNext: () => void;\n orientation: 'horizontal' | 'vertical';\n slideCount: number;\n /** Indices of slides currently in view (others are inert). */\n inView: number[];\n}\n\nconst CarouselContext = createContext<CarouselContextValue | null>(null);\n\nfunction useCarousel() {\n const ctx = useContext(CarouselContext);\n if (!ctx) throw new Error('Carousel components must be used inside <Carousel>');\n return ctx;\n}\n\nexport interface CarouselProps extends HTMLAttributes<HTMLDivElement> {\n opts?: CarouselOptions;\n orientation?: 'horizontal' | 'vertical';\n setApi?: (api: CarouselApi) => void;\n}\n\n/**\n * Embla-backed carousel. Compose with `<CarouselContent>`, `<CarouselItem>`,\n * `<CarouselPrevious>`, and `<CarouselNext>`.\n */\nexport const Carousel = forwardRef<HTMLDivElement, CarouselProps>(function Carousel(\n {\n opts,\n orientation = 'horizontal',\n setApi,\n className,\n children,\n onKeyDown,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...props\n },\n ref,\n) {\n const strings = useStrings();\n const [carouselRef, api] = useEmblaCarousel({\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n });\n const [canPrev, setCanPrev] = useState(false);\n const [canNext, setCanNext] = useState(false);\n const [slideCount, setSlideCount] = useState(0);\n const [inView, setInView] = useState<number[]>([]);\n\n const onSelect = useCallback((api: CarouselApi) => {\n if (!api) return;\n setCanPrev(api.canScrollPrev());\n setCanNext(api.canScrollNext());\n setInView(api.slidesInView());\n }, []);\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const prevKey = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';\n const nextKey = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown';\n if (event.key === prevKey) {\n event.preventDefault();\n api?.scrollPrev();\n } else if (event.key === nextKey) {\n event.preventDefault();\n api?.scrollNext();\n }\n };\n\n useEffect(() => {\n if (!api) return;\n setApi?.(api);\n // Initial sync from Embla (an external store); every later change arrives\n // through the events subscribed below.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n onSelect(api);\n api.on('reInit', onSelect).on('select', onSelect).on('slidesInView', onSelect);\n return () => {\n api.off('reInit', onSelect).off('select', onSelect).off('slidesInView', onSelect);\n };\n }, [api, onSelect, setApi]);\n\n useEffect(() => {\n if (!api) return;\n const count = () => setSlideCount(api.slideNodes().length);\n count();\n api.on('reInit', count);\n return () => {\n api.off('reInit', count);\n };\n }, [api]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api,\n canPrev,\n canNext,\n scrollPrev: () => api?.scrollPrev(),\n scrollNext: () => api?.scrollNext(),\n orientation,\n slideCount,\n inView,\n }}\n >\n {/* Arrow keys act only while focus is inside the region (it is not itself\n focusable); the buttons remain the primary control. */}\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n ref={ref}\n className={cn('relative isolate', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={ariaLabel ?? (ariaLabelledby ? undefined : strings.carousel.label)}\n aria-labelledby={ariaLabelledby}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n});\nCarousel.displayName = 'Carousel';\n\nexport const CarouselContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function CarouselContent({ className, ...props }, ref) {\n const { carouselRef, orientation } = useCarousel();\n return (\n <div ref={carouselRef} className=\"overflow-hidden\">\n <div\n ref={ref}\n className={cn(\n 'flex',\n orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col',\n className,\n )}\n {...props}\n />\n </div>\n );\n },\n);\nCarouselContent.displayName = 'CarouselContent';\n\nexport interface CarouselItemProps extends HTMLAttributes<HTMLDivElement> {\n /** 0-based position, used for the default \"{i+1} of {n}\" label. */\n index?: number;\n}\n\nexport const CarouselItem = forwardRef<HTMLDivElement, CarouselItemProps>(function CarouselItem(\n { className, index, 'aria-label': ariaLabel, ...props },\n ref,\n) {\n const strings = useStrings();\n const { orientation, slideCount, inView } = useCarousel();\n const defaultLabel =\n index !== undefined && slideCount > 0\n ? formatString(strings.carousel.slide, { index: index + 1, count: slideCount })\n : undefined;\n // Off-screen slides are inert: not in the tab order, not read by AT. Only\n // possible when `index` is provided (unknown index → always live).\n const offscreen = index !== undefined && inView.length > 0 && !inView.includes(index);\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n aria-label={ariaLabel ?? defaultLabel}\n aria-hidden={offscreen || undefined}\n {...(offscreen ? INERT_PROPS : undefined)}\n className={cn(\n 'min-w-0 shrink-0 grow-0 basis-full',\n orientation === 'horizontal' ? 'pl-4' : 'pt-4',\n className,\n )}\n {...props}\n />\n );\n});\nCarouselItem.displayName = 'CarouselItem';\n\ntype CarouselButtonProps = Omit<\n ComponentPropsWithoutRef<typeof IconButton>,\n 'icon' | 'aria-label'\n> & { 'aria-label'?: string };\n\nexport const CarouselPrevious = forwardRef<HTMLButtonElement, CarouselButtonProps>(\n function CarouselPrevious({ className, 'aria-label': ariaLabel, ...props }, ref) {\n const { canPrev, scrollPrev, orientation } = useCarousel();\n const strings = useStrings();\n return (\n <IconButton\n ref={ref}\n aria-label={ariaLabel ?? strings.carousel.previous}\n variant=\"outline\"\n disabled={!canPrev}\n onClick={scrollPrev}\n icon={<ChevronLeft />}\n className={cn(\n 'absolute z-10',\n orientation === 'horizontal'\n ? 'top-1/2 -left-12 -translate-y-1/2'\n : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n {...props}\n />\n );\n },\n);\nCarouselPrevious.displayName = 'CarouselPrevious';\n\nexport const CarouselNext = forwardRef<HTMLButtonElement, CarouselButtonProps>(\n function CarouselNext({ className, 'aria-label': ariaLabel, ...props }, ref) {\n const { canNext, scrollNext, orientation } = useCarousel();\n const strings = useStrings();\n return (\n <IconButton\n ref={ref}\n aria-label={ariaLabel ?? strings.carousel.next}\n variant=\"outline\"\n disabled={!canNext}\n onClick={scrollNext}\n icon={<ChevronRight />}\n className={cn(\n 'absolute z-10',\n orientation === 'horizontal'\n ? 'top-1/2 -right-12 -translate-y-1/2'\n : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n {...props}\n />\n );\n },\n);\nCarouselNext.displayName = 'CarouselNext';\n"],"mappings":";;;;;;;;;;AAwBA,IAAM,IAAc,EAClB,OAAO,OAAO,EAAa,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,MAAY,GAC3D,GAkBM,IAAkB,EAA2C,IAAI;AAEvE,SAAS,IAAc;CACrB,IAAM,IAAM,EAAW,CAAe;CACtC,IAAI,CAAC,GAAK,MAAU,MAAM,oDAAoD;CAC9E,OAAO;AACT;AAYA,IAAa,IAAW,EAA0C,SAChE,EACE,SACA,iBAAc,cACd,WACA,cACA,aACA,cACA,cAAc,GACd,mBAAmB,GACnB,GAAG,KAEL,GACA;CACA,IAAM,IAAU,EAAW,GACrB,CAAC,GAAa,KAAO,EAAiB;EAC1C,GAAG;EACH,MAAM,MAAgB,eAAe,MAAM;CAC7C,CAAC,GACK,CAAC,GAAS,KAAc,EAAS,EAAK,GACtC,CAAC,GAAS,KAAc,EAAS,EAAK,GACtC,CAAC,GAAY,KAAiB,EAAS,CAAC,GACxC,CAAC,GAAQ,KAAa,EAAmB,CAAC,CAAC,GAE3C,IAAW,GAAa,MAAqB;EAC5C,MACL,EAAW,EAAI,cAAc,CAAC,GAC9B,EAAW,EAAI,cAAc,CAAC,GAC9B,EAAU,EAAI,aAAa,CAAC;CAC9B,GAAG,CAAC,CAAC;CAuCL,OAvBA,QAAgB;EACT,OAOL,OANA,IAAS,CAAG,GAIZ,EAAS,CAAG,GACZ,EAAI,GAAG,UAAU,C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Y,KAAa,EAAQ,SAAS;EAC1C,SAAQ;EACR,UAAU,CAAC;EACX,SAAS;EACT,MAAM,kBAAC,GAAD,CAAe,CAAA;EACrB,WAAW,EACT,iBACA,MAAgB,eACZ,uCACA,kDACJ,CACF;EACA,GAAI;CACL,CAAA;AAEL,CACF;AACA,EAAa,cAAc"}
|
|
@@ -38,10 +38,10 @@ var h = [
|
|
|
38
38
|
"var(--chart-4)",
|
|
39
39
|
"var(--chart-5)",
|
|
40
40
|
"var(--chart-6)"
|
|
41
|
-
], g = 600, _ = 6;
|
|
42
|
-
function
|
|
41
|
+
], g = 600, _ = 6, v = typeof window > "u" ? a : s;
|
|
42
|
+
function y() {
|
|
43
43
|
let e = c(null), [t, n] = l(0);
|
|
44
|
-
return (
|
|
44
|
+
return v(() => {
|
|
45
45
|
let t = e.current;
|
|
46
46
|
if (!t) return;
|
|
47
47
|
let r = () => n(t.clientWidth);
|
|
@@ -53,19 +53,19 @@ function v() {
|
|
|
53
53
|
width: t || g
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
var
|
|
57
|
-
function
|
|
56
|
+
var b = 5;
|
|
57
|
+
function x(e) {
|
|
58
58
|
let t = Math.abs(e), n = (e, t) => `${(Math.round(e * 10) / 10).toString()}${t}`;
|
|
59
59
|
return t >= 1e9 ? n(e / 1e9, "B") : t >= 1e6 ? n(e / 1e6, "M") : t >= 1e3 ? n(e / 1e3, "K") : Number.isInteger(e) ? String(e) : (Math.round(e * 100) / 100).toString();
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function S(e) {
|
|
62
62
|
if (e <= 0) return 1;
|
|
63
63
|
let t = 10 ** Math.floor(Math.log10(e)), n = e / t;
|
|
64
64
|
return (n <= 1 ? 1 : n <= 2 ? 2 : n <= 2.5 ? 2.5 : n <= 5 ? 5 : 10) * t;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function C(e, t, n = b) {
|
|
67
67
|
t === e && (t = e + 1);
|
|
68
|
-
let r =
|
|
68
|
+
let r = S((t - e) / Math.max(1, n - 1)), i = Math.floor(e / r) * r, a = Math.ceil(t / r) * r, o = [];
|
|
69
69
|
for (let e = a; e >= i - r / 2; e -= r) o.push(Number(e.toFixed(10)));
|
|
70
70
|
return {
|
|
71
71
|
min: i,
|
|
@@ -73,12 +73,12 @@ function S(e, t, n = y) {
|
|
|
73
73
|
ticks: o
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function w(e, t) {
|
|
77
77
|
return t && t.length ? t : [{ data: e ?? [] }];
|
|
78
78
|
}
|
|
79
|
-
var
|
|
80
|
-
function
|
|
81
|
-
let n = e.flatMap((e) => e.data.map((e) => e.y).filter(
|
|
79
|
+
var T = (e) => typeof e == "number";
|
|
80
|
+
function E(e, t = !0) {
|
|
81
|
+
let n = e.flatMap((e) => e.data.map((e) => e.y).filter(T)), r = t ? Math.min(0, ...n) : Math.min(...n), i = Math.max(...n, t ? 1 : -Infinity), { min: a, max: o, ticks: s } = C(Number.isFinite(r) ? r : 0, i === -Infinity ? 1 : i);
|
|
82
82
|
return {
|
|
83
83
|
min: a,
|
|
84
84
|
max: o,
|
|
@@ -86,14 +86,14 @@ function T(e, t = !0) {
|
|
|
86
86
|
ticks: s
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function D(e, t, n, r, i) {
|
|
90
90
|
let a = t - 12, o = n - 12;
|
|
91
91
|
return {
|
|
92
92
|
sx: (t) => e <= 1 ? _ + a / 2 : _ + t / (e - 1) * a,
|
|
93
93
|
sy: (e) => _ + o - (e - r) / i * o
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function O(e) {
|
|
97
97
|
if (e.length === 0) return "";
|
|
98
98
|
if (e.length < 3) return e.map((e, t) => `${t ? "L" : "M"}${e[0]},${e[1]}`).join(" ");
|
|
99
99
|
let t = `M${e[0][0]},${e[0][1]}`;
|
|
@@ -103,18 +103,18 @@ function D(e) {
|
|
|
103
103
|
}
|
|
104
104
|
return t;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function k(e, t, n) {
|
|
107
107
|
let r = [], i = [];
|
|
108
108
|
return e.forEach((e, a) => {
|
|
109
|
-
|
|
109
|
+
T(e.y) ? i.push([t(a), n(e.y)]) : i.length && (r.push(i), i = []);
|
|
110
110
|
}), i.length && r.push(i), r;
|
|
111
111
|
}
|
|
112
|
-
var
|
|
113
|
-
function
|
|
112
|
+
var A = (e, n, r) => e.name ?? t(r.series, { n: n + 1 });
|
|
113
|
+
function j(e, t, n) {
|
|
114
114
|
return e.map((e, r) => {
|
|
115
|
-
let i = e.data.map((e) => e.y).filter(
|
|
115
|
+
let i = e.data.map((e) => e.y).filter(T), a = A(e, r, t);
|
|
116
116
|
if (!i.length) return `${a}: ${t.noData}`;
|
|
117
|
-
let o = [...e.data].reverse().find((e) =>
|
|
117
|
+
let o = [...e.data].reverse().find((e) => T(e.y));
|
|
118
118
|
return n.summary({
|
|
119
119
|
name: a,
|
|
120
120
|
count: i.length,
|
|
@@ -125,7 +125,7 @@ function A(e, t, n) {
|
|
|
125
125
|
});
|
|
126
126
|
}).join(". ");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function M({ width: e, height: t, lines: n }) {
|
|
129
129
|
let r = t - 12, i = Math.max(1, n);
|
|
130
130
|
return /* @__PURE__ */ d("g", {
|
|
131
131
|
"aria-hidden": !0,
|
|
@@ -143,24 +143,24 @@ function j({ width: e, height: t, lines: n }) {
|
|
|
143
143
|
})
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function N({ ticks: e }) {
|
|
147
147
|
return /* @__PURE__ */ d("div", {
|
|
148
148
|
"aria-hidden": !0,
|
|
149
149
|
className: "tabular text-foreground-subtle pointer-events-none flex shrink-0 flex-col justify-between py-1.5 pr-1.5 text-right text-xs",
|
|
150
150
|
children: e.map((e, t) => /* @__PURE__ */ d("span", {
|
|
151
151
|
className: "leading-none",
|
|
152
|
-
children:
|
|
152
|
+
children: x(e)
|
|
153
153
|
}, t))
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function P({ first: e, last: t }) {
|
|
157
157
|
return e ? /* @__PURE__ */ f("div", {
|
|
158
158
|
"aria-hidden": !0,
|
|
159
159
|
className: "text-foreground-subtle flex justify-between text-xs",
|
|
160
160
|
children: [/* @__PURE__ */ d("span", { children: String(e.x) }), t && t !== e && /* @__PURE__ */ d("span", { children: String(t.x) })]
|
|
161
161
|
}) : null;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function F({ id: n, all: r, name: i, visible: a, t: o }) {
|
|
164
164
|
let s = Math.max(...r.map((e) => e.data.length)), c = r.find((e) => e.data.length === s)?.data ?? [], l = /* @__PURE__ */ f("table", {
|
|
165
165
|
id: n,
|
|
166
166
|
"data-chart-table": !0,
|
|
@@ -177,7 +177,7 @@ function P({ id: n, all: r, name: i, visible: a, t: o }) {
|
|
|
177
177
|
}), r.map((t, n) => /* @__PURE__ */ d("th", {
|
|
178
178
|
scope: "col",
|
|
179
179
|
className: e(a && "border-border border-b py-1 pr-3 font-medium"),
|
|
180
|
-
children:
|
|
180
|
+
children: A(t, n, o)
|
|
181
181
|
}, n))] }) }),
|
|
182
182
|
/* @__PURE__ */ d("tbody", { children: c.map((t, n) => /* @__PURE__ */ f("tr", { children: [/* @__PURE__ */ d("th", {
|
|
183
183
|
scope: "row",
|
|
@@ -185,7 +185,7 @@ function P({ id: n, all: r, name: i, visible: a, t: o }) {
|
|
|
185
185
|
children: String(t.x)
|
|
186
186
|
}), r.map((t, r) => /* @__PURE__ */ d("td", {
|
|
187
187
|
className: e(a && "py-0.5 pr-3"),
|
|
188
|
-
children:
|
|
188
|
+
children: T(t.data[n]?.y) ? String(t.data[n]?.y) : "—"
|
|
189
189
|
}, r))] }, n)) })
|
|
190
190
|
]
|
|
191
191
|
});
|
|
@@ -194,10 +194,10 @@ function P({ id: n, all: r, name: i, visible: a, t: o }) {
|
|
|
194
194
|
children: l
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
let T = n().chart, E = o().replace(/:/g, ""), D = `chart-cap-${E}`, O = `chart-title-${E}`, k = `chart-desc-${E}`,
|
|
199
|
-
process.env.NODE_ENV !== "production" && !
|
|
200
|
-
let H = (b ||
|
|
197
|
+
function I({ caption: t, ariaLabel: i, title: a, all: s, height: c, width: p, className: m, showAxis: h, ticks: g, xFirst: _, xLast: v, tableFallback: b, showTableToggle: x, state: S, labels: C, children: w }) {
|
|
198
|
+
let T = n().chart, E = o().replace(/:/g, ""), D = `chart-cap-${E}`, O = `chart-title-${E}`, k = `chart-desc-${E}`, A = `chart-table-${E}`, M = i ?? a, [I, R] = l(!1), { ref: z, width: B } = y(), V = L(s, T, C);
|
|
199
|
+
process.env.NODE_ENV !== "production" && !M && !t && console.warn("[craftzbay/ui] Chart: provide `caption`, `aria-label`, or `title` so the chart has an accessible name.");
|
|
200
|
+
let H = (b || I) && !S, U = S === "loading" ? /* @__PURE__ */ f("div", {
|
|
201
201
|
role: "status",
|
|
202
202
|
"aria-label": T.loading,
|
|
203
203
|
style: { height: c },
|
|
@@ -227,7 +227,7 @@ function F({ caption: t, ariaLabel: i, title: a, all: s, height: c, width: p, cl
|
|
|
227
227
|
U ?? /* @__PURE__ */ f(u, { children: [
|
|
228
228
|
/* @__PURE__ */ f("div", {
|
|
229
229
|
className: "flex",
|
|
230
|
-
children: [h && /* @__PURE__ */ d(
|
|
230
|
+
children: [h && /* @__PURE__ */ d(N, { ticks: g }), /* @__PURE__ */ d("div", {
|
|
231
231
|
ref: z,
|
|
232
232
|
className: "min-w-0 flex-1",
|
|
233
233
|
children: /* @__PURE__ */ f("svg", {
|
|
@@ -235,17 +235,17 @@ function F({ caption: t, ariaLabel: i, title: a, all: s, height: c, width: p, cl
|
|
|
235
235
|
width: B,
|
|
236
236
|
height: c,
|
|
237
237
|
role: "group",
|
|
238
|
-
"aria-labelledby": t ? D :
|
|
238
|
+
"aria-labelledby": t ? D : M ? O : void 0,
|
|
239
239
|
"aria-describedby": k,
|
|
240
240
|
className: "block max-w-full overflow-visible",
|
|
241
241
|
children: [
|
|
242
|
-
|
|
242
|
+
M && /* @__PURE__ */ d("title", {
|
|
243
243
|
id: O,
|
|
244
|
-
children:
|
|
244
|
+
children: M
|
|
245
245
|
}),
|
|
246
246
|
/* @__PURE__ */ d("desc", {
|
|
247
247
|
id: k,
|
|
248
|
-
children:
|
|
248
|
+
children: j(s, T, C)
|
|
249
249
|
}),
|
|
250
250
|
w({
|
|
251
251
|
width: B,
|
|
@@ -255,9 +255,9 @@ function F({ caption: t, ariaLabel: i, title: a, all: s, height: c, width: p, cl
|
|
|
255
255
|
})
|
|
256
256
|
})]
|
|
257
257
|
}),
|
|
258
|
-
h && /* @__PURE__ */ d(
|
|
258
|
+
h && /* @__PURE__ */ d(P, {
|
|
259
259
|
first: _,
|
|
260
|
-
last:
|
|
260
|
+
last: v
|
|
261
261
|
}),
|
|
262
262
|
/* @__PURE__ */ d("span", {
|
|
263
263
|
className: "sr-only",
|
|
@@ -269,36 +269,36 @@ function F({ caption: t, ariaLabel: i, title: a, all: s, height: c, width: p, cl
|
|
|
269
269
|
x && !S && /* @__PURE__ */ d("button", {
|
|
270
270
|
type: "button",
|
|
271
271
|
onClick: () => R((e) => !e),
|
|
272
|
-
"aria-expanded":
|
|
273
|
-
"aria-controls": H ?
|
|
272
|
+
"aria-expanded": I,
|
|
273
|
+
"aria-controls": H ? A : void 0,
|
|
274
274
|
className: e("text-foreground-subtle hover:text-foreground self-start rounded-sm text-xs underline-offset-2 outline-none hover:underline", "focus-visible:ring-ring focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2"),
|
|
275
|
-
children:
|
|
275
|
+
children: I ? T.hideTable : T.viewAsTable
|
|
276
276
|
}),
|
|
277
|
-
H && /* @__PURE__ */ d(
|
|
278
|
-
id:
|
|
277
|
+
H && /* @__PURE__ */ d(F, {
|
|
278
|
+
id: A,
|
|
279
279
|
all: s,
|
|
280
|
-
name:
|
|
281
|
-
visible:
|
|
280
|
+
name: M ?? (typeof t == "string" ? t : void 0),
|
|
281
|
+
visible: I,
|
|
282
282
|
t: T
|
|
283
283
|
})
|
|
284
284
|
]
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function L(t, n, r) {
|
|
288
288
|
let [a, o] = l(null), [s, c] = l(""), u = i((e, n) => {
|
|
289
289
|
let i = t[e], a = i?.data[n];
|
|
290
|
-
a &&
|
|
290
|
+
a && T(a.y) && (o({
|
|
291
291
|
series: e,
|
|
292
292
|
index: n
|
|
293
293
|
}), c(r.point(i.name, a.x, a.y)));
|
|
294
|
-
}, [t, r]), d = (e) => t[e].data.map((e, t) =>
|
|
294
|
+
}, [t, r]), d = (e) => t[e].data.map((e, t) => T(e.y) ? t : -1).filter((e) => e >= 0);
|
|
295
295
|
return {
|
|
296
296
|
active: a,
|
|
297
297
|
announcement: s,
|
|
298
298
|
seriesProps: (i) => ({
|
|
299
299
|
tabIndex: 0,
|
|
300
300
|
role: "group",
|
|
301
|
-
"aria-label": r.series(
|
|
301
|
+
"aria-label": r.series(A(t[i], i, n), d(i).length),
|
|
302
302
|
"data-chart-series": !0,
|
|
303
303
|
className: e("[&:focus-visible_[data-active]]:stroke-[var(--ring)] [&:focus-visible_[data-active]]:stroke-[3px]"),
|
|
304
304
|
onFocus: () => {
|
|
@@ -322,7 +322,7 @@ function I(t, n, r) {
|
|
|
322
322
|
})
|
|
323
323
|
};
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function R({ x: t, y: n, color: r, label: i, always: a, active: o }) {
|
|
326
326
|
return /* @__PURE__ */ d("circle", {
|
|
327
327
|
cx: t,
|
|
328
328
|
cy: n,
|
|
@@ -333,33 +333,33 @@ function L({ x: t, y: n, color: r, label: i, always: a, active: o }) {
|
|
|
333
333
|
children: /* @__PURE__ */ d("title", { children: i })
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function z({ data: e, series: t, colors: r = h, height: i = 160, width: a = "100%", caption: o, "aria-label": s, title: c, grid: l = !0, showAxis: p = !0, tableFallback: g = !0, showTableToggle: _, state: v, labels: y, className: b }) {
|
|
337
337
|
let x = n().chart, S = {
|
|
338
338
|
...m(x),
|
|
339
339
|
...y
|
|
340
|
-
},
|
|
341
|
-
return /* @__PURE__ */ d(
|
|
340
|
+
}, C = w(e, t), { min: A, range: j, ticks: N } = E(C), P = Math.max(...C.map((e) => e.data.length)), F = C[0].data;
|
|
341
|
+
return /* @__PURE__ */ d(I, {
|
|
342
342
|
caption: o,
|
|
343
343
|
ariaLabel: s,
|
|
344
344
|
title: c,
|
|
345
|
-
all:
|
|
345
|
+
all: C,
|
|
346
346
|
height: i,
|
|
347
347
|
width: a,
|
|
348
348
|
className: b,
|
|
349
349
|
showAxis: p,
|
|
350
350
|
ticks: N,
|
|
351
|
-
xFirst:
|
|
352
|
-
xLast:
|
|
351
|
+
xFirst: F[0],
|
|
352
|
+
xLast: F[F.length - 1],
|
|
353
353
|
tableFallback: g,
|
|
354
354
|
showTableToggle: _,
|
|
355
355
|
state: v,
|
|
356
356
|
labels: S,
|
|
357
|
-
children: ({ width: e, active: t, seriesProps: n }) => /* @__PURE__ */ f(u, { children: [l && /* @__PURE__ */ d(
|
|
357
|
+
children: ({ width: e, active: t, seriesProps: n }) => /* @__PURE__ */ f(u, { children: [l && /* @__PURE__ */ d(M, {
|
|
358
358
|
width: e,
|
|
359
359
|
height: i,
|
|
360
360
|
lines: N.length - 1
|
|
361
|
-
}),
|
|
362
|
-
let s = r[o % r.length], { sx: c, sy: l } =
|
|
361
|
+
}), C.map((a, o) => {
|
|
362
|
+
let s = r[o % r.length], { sx: c, sy: l } = D(P, e, i, A, j), u = k(a.data, c, l), p = u.map(O).join(" "), m = l(Math.max(A, 0)), h = u.map((e) => `${O(e)} L${e[e.length - 1][0].toFixed(1)},${m.toFixed(1)} L${e[0][0].toFixed(1)},${m.toFixed(1)} Z`).join(" "), g = a.data.map((e) => T(e.y)).lastIndexOf(!0);
|
|
363
363
|
return /* @__PURE__ */ f("g", {
|
|
364
364
|
...n(o),
|
|
365
365
|
children: [
|
|
@@ -376,7 +376,7 @@ function R({ data: e, series: t, colors: r = h, height: i = 160, width: a = "100
|
|
|
376
376
|
strokeLinecap: "round",
|
|
377
377
|
strokeLinejoin: "round"
|
|
378
378
|
}),
|
|
379
|
-
a.data.map((e, n) =>
|
|
379
|
+
a.data.map((e, n) => T(e.y) ? /* @__PURE__ */ d(R, {
|
|
380
380
|
x: c(n),
|
|
381
381
|
y: l(e.y),
|
|
382
382
|
color: s,
|
|
@@ -389,15 +389,15 @@ function R({ data: e, series: t, colors: r = h, height: i = 160, width: a = "100
|
|
|
389
389
|
})] })
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
|
-
function
|
|
393
|
-
return /* @__PURE__ */ d(
|
|
392
|
+
function B(e) {
|
|
393
|
+
return /* @__PURE__ */ d(z, { ...e });
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
let S = n().chart,
|
|
395
|
+
function V({ data: e, series: t, colors: r = h, height: i = 160, width: a = "100%", caption: o, "aria-label": s, title: c, grid: l = !0, showAxis: p = !0, tableFallback: g = !0, showTableToggle: v, state: y, labels: b, className: x }) {
|
|
396
|
+
let S = n().chart, C = {
|
|
397
397
|
...m(S),
|
|
398
398
|
...b
|
|
399
|
-
}, O =
|
|
400
|
-
return /* @__PURE__ */ d(
|
|
399
|
+
}, O = w(e, t), k = Math.max(...O.map((e) => e.data.length)), { min: A, range: j, ticks: N } = E(O), P = O[0].data;
|
|
400
|
+
return /* @__PURE__ */ d(I, {
|
|
401
401
|
caption: o,
|
|
402
402
|
ariaLabel: s,
|
|
403
403
|
title: c,
|
|
@@ -412,11 +412,11 @@ function B({ data: e, series: t, colors: r = h, height: i = 160, width: a = "100
|
|
|
412
412
|
tableFallback: g,
|
|
413
413
|
showTableToggle: v,
|
|
414
414
|
state: y,
|
|
415
|
-
labels:
|
|
415
|
+
labels: C,
|
|
416
416
|
children: ({ width: e, active: t, seriesProps: n }) => {
|
|
417
|
-
let a = (e - 12) / Math.max(1, k), o = a * .62, s = Math.max(2, o / O.length), { sy: c } =
|
|
417
|
+
let a = (e - 12) / Math.max(1, k), o = a * .62, s = Math.max(2, o / O.length), { sy: c } = D(k, e, i, A, j), p = c(Math.min(Math.max(0, A), A + j));
|
|
418
418
|
return /* @__PURE__ */ f(u, { children: [
|
|
419
|
-
l && /* @__PURE__ */ d(
|
|
419
|
+
l && /* @__PURE__ */ d(M, {
|
|
420
420
|
width: e,
|
|
421
421
|
height: i,
|
|
422
422
|
lines: N.length - 1
|
|
@@ -433,8 +433,8 @@ function B({ data: e, series: t, colors: r = h, height: i = 160, width: a = "100
|
|
|
433
433
|
O.map((e, i) => /* @__PURE__ */ d("g", {
|
|
434
434
|
...n(i),
|
|
435
435
|
children: e.data.map((n, l) => {
|
|
436
|
-
if (!
|
|
437
|
-
let u = c(n.y), f = _ + l * a + (a - o) / 2 + i * s, m =
|
|
436
|
+
if (!T(n.y)) return null;
|
|
437
|
+
let u = c(n.y), f = _ + l * a + (a - o) / 2 + i * s, m = C.point(e.name, n.x, n.y), h = t?.series === i && t.index === l;
|
|
438
438
|
return /* @__PURE__ */ d("rect", {
|
|
439
439
|
x: f,
|
|
440
440
|
y: Math.min(p, u),
|
|
@@ -453,6 +453,6 @@ function B({ data: e, series: t, colors: r = h, height: i = 160, width: a = "100
|
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
455
|
//#endregion
|
|
456
|
-
export {
|
|
456
|
+
export { B as AreaChart, V as BarChart, h as DEFAULT_CHART_COLORS, z as LineChart, x as abbreviateNumber, p as defaultChartLabels, C as niceTicks };
|
|
457
457
|
|
|
458
458
|
//# sourceMappingURL=Chart.js.map
|