@hitachivantara/uikit-react-core 5.7.5 → 5.8.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.
Files changed (42) hide show
  1. package/dist/cjs/components/Carousel/Carousel.cjs +230 -0
  2. package/dist/cjs/components/Carousel/Carousel.cjs.map +1 -0
  3. package/dist/cjs/components/Carousel/Carousel.styles.cjs +177 -0
  4. package/dist/cjs/components/Carousel/Carousel.styles.cjs.map +1 -0
  5. package/dist/cjs/components/Carousel/CarouselSlide/CarouselSlide.cjs +43 -0
  6. package/dist/cjs/components/Carousel/CarouselSlide/CarouselSlide.cjs.map +1 -0
  7. package/dist/cjs/components/Carousel/CarouselSlide/CarouselSlide.styles.cjs +15 -0
  8. package/dist/cjs/components/Carousel/CarouselSlide/CarouselSlide.styles.cjs.map +1 -0
  9. package/dist/cjs/components/Carousel/utils.cjs +36 -0
  10. package/dist/cjs/components/Carousel/utils.cjs.map +1 -0
  11. package/dist/cjs/components/Dialog/Dialog.cjs +6 -53
  12. package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
  13. package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs.map +1 -1
  14. package/dist/cjs/components/VerticalNavigation/NavigationSlider/NavigationSlider.cjs +6 -6
  15. package/dist/cjs/components/VerticalNavigation/NavigationSlider/NavigationSlider.cjs.map +1 -1
  16. package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.cjs +2 -3
  17. package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.cjs.map +1 -1
  18. package/dist/cjs/components/VerticalNavigation/VerticalNavigation.cjs.map +1 -1
  19. package/dist/cjs/index.cjs +8 -0
  20. package/dist/cjs/index.cjs.map +1 -1
  21. package/dist/esm/components/Carousel/Carousel.js +228 -0
  22. package/dist/esm/components/Carousel/Carousel.js.map +1 -0
  23. package/dist/esm/components/Carousel/Carousel.styles.js +177 -0
  24. package/dist/esm/components/Carousel/Carousel.styles.js.map +1 -0
  25. package/dist/esm/components/Carousel/CarouselSlide/CarouselSlide.js +43 -0
  26. package/dist/esm/components/Carousel/CarouselSlide/CarouselSlide.js.map +1 -0
  27. package/dist/esm/components/Carousel/CarouselSlide/CarouselSlide.styles.js +15 -0
  28. package/dist/esm/components/Carousel/CarouselSlide/CarouselSlide.styles.js.map +1 -0
  29. package/dist/esm/components/Carousel/utils.js +36 -0
  30. package/dist/esm/components/Carousel/utils.js.map +1 -0
  31. package/dist/esm/components/Dialog/Dialog.js +7 -53
  32. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  33. package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js.map +1 -1
  34. package/dist/esm/components/VerticalNavigation/NavigationSlider/NavigationSlider.js +6 -6
  35. package/dist/esm/components/VerticalNavigation/NavigationSlider/NavigationSlider.js.map +1 -1
  36. package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.js +2 -3
  37. package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.js.map +1 -1
  38. package/dist/esm/components/VerticalNavigation/VerticalNavigation.js.map +1 -1
  39. package/dist/esm/index.js +8 -0
  40. package/dist/esm/index.js.map +1 -1
  41. package/dist/types/index.d.ts +283 -36
  42. package/package.json +6 -5
@@ -0,0 +1,228 @@
1
+ import { useRef, useState, Children, useEffect } from "react";
2
+ import useCarousel from "embla-carousel-react";
3
+ import { ClassNames } from "@emotion/react";
4
+ import { Close, Fullscreen, Backwards, Forwards } from "@hitachivantara/uikit-react-icons";
5
+ import newStyles, { carouselClasses } from "./Carousel.styles.js";
6
+ import { makeClasses } from "./utils.js";
7
+ import { jsx, jsxs, Fragment } from "@emotion/react/jsx-runtime";
8
+ import { HvContainer } from "../Container/Container.js";
9
+ import { HvStack } from "../Stack/Stack.js";
10
+ import { HvTypography } from "../Typography/Typography.js";
11
+ import { HvButton } from "../Button/Button.js";
12
+ const clamp = (num, max, min = 0) => Math.min(Math.max(num, min), max);
13
+ const HvCarousel = (props) => {
14
+ const {
15
+ className,
16
+ classes: classesProp = {},
17
+ height: heightProp = "auto",
18
+ thumbnailWidth = 90,
19
+ title,
20
+ children,
21
+ actions,
22
+ xs,
23
+ showDots: showDotsProp,
24
+ showCounter: showCounterProp,
25
+ showSlideControls,
26
+ showFullscreen: showFullscreenProp,
27
+ hideThumbnails: hideThumbnailsProp,
28
+ carouselOptions,
29
+ renderThumbnail,
30
+ onChange,
31
+ ...others
32
+ } = props;
33
+ const thumbnailsRef = useRef(null);
34
+ const [isFullscreen, setIsFullscreen] = useState(false);
35
+ const [containerRef, controller] = useCarousel({
36
+ align: "start",
37
+ loop: true,
38
+ ...carouselOptions
39
+ });
40
+ const [selectedIndex, setSelectedIndex] = useState((carouselOptions == null ? void 0 : carouselOptions.startIndex) ?? 0);
41
+ const numSlides = Children.count(children);
42
+ const handlePrevious = () => {
43
+ controller == null ? void 0 : controller.scrollPrev();
44
+ };
45
+ const handleNext = () => {
46
+ controller == null ? void 0 : controller.scrollNext();
47
+ };
48
+ const handleScroll = (index) => {
49
+ controller == null ? void 0 : controller.scrollTo(index);
50
+ };
51
+ const handleSelect = () => {
52
+ var _a, _b, _c;
53
+ if (!controller)
54
+ return;
55
+ const slideIndex = controller.selectedScrollSnap();
56
+ setSelectedIndex(slideIndex);
57
+ (_c = (_b = (_a = thumbnailsRef.current) == null ? void 0 : _a.querySelectorAll("button")) == null ? void 0 : _b[slideIndex]) == null ? void 0 : _c.scrollIntoView({
58
+ behavior: "smooth",
59
+ block: "nearest"
60
+ });
61
+ onChange == null ? void 0 : onChange(slideIndex);
62
+ };
63
+ useEffect(() => {
64
+ if (!controller)
65
+ return;
66
+ controller.on("select", handleSelect);
67
+ return () => {
68
+ controller.off("select", handleSelect);
69
+ };
70
+ }, [controller]);
71
+ useEffect(() => {
72
+ if (!controller)
73
+ return;
74
+ controller.reInit();
75
+ setSelectedIndex((currentIndex) => clamp(currentIndex, numSlides, 0));
76
+ }, [numSlides]);
77
+ const canPrev = (controller == null ? void 0 : controller.canScrollPrev()) ?? false;
78
+ const canNext = (controller == null ? void 0 : controller.canScrollNext()) ?? false;
79
+ const showTitle = !!title && (!xs || isFullscreen);
80
+ const showFullscreen = showFullscreenProp ?? xs;
81
+ const height = isFullscreen ? "100%" : heightProp ?? "auto";
82
+ const showCounter = xs;
83
+ const hideThumbnails = hideThumbnailsProp ?? (xs && !isFullscreen);
84
+ const showThumbnails = !hideThumbnails && !!renderThumbnail;
85
+ const showDots = showDotsProp ?? numSlides <= 5;
86
+ return /* @__PURE__ */ jsx(ClassNames, {
87
+ children: ({
88
+ css,
89
+ cx
90
+ }) => {
91
+ const classes = makeClasses({
92
+ css,
93
+ cx
94
+ }, {
95
+ cc: carouselClasses,
96
+ styles: newStyles,
97
+ classes: classesProp
98
+ });
99
+ return /* @__PURE__ */ jsxs(HvContainer, {
100
+ className: cx(classes.root, className, {
101
+ [classes.xs]: xs,
102
+ [classes.fullscreen]: isFullscreen
103
+ }),
104
+ ...others,
105
+ children: [showTitle && /* @__PURE__ */ jsx(HvTypography, {
106
+ variant: "title2",
107
+ className: classes.title,
108
+ children: title
109
+ }), /* @__PURE__ */ jsxs("div", {
110
+ className: classes.actions,
111
+ children: [showFullscreen && /* @__PURE__ */ jsx(HvButton, {
112
+ icon: true,
113
+ variant: "secondaryGhost",
114
+ onClick: () => setIsFullscreen((curr) => !curr),
115
+ className: classes.closeButton,
116
+ children: isFullscreen ? /* @__PURE__ */ jsx(Close, {
117
+ "aria-label": "Close"
118
+ }) : /* @__PURE__ */ jsx(Fullscreen, {
119
+ "aria-label": "Fullscreen"
120
+ })
121
+ }), actions]
122
+ }), /* @__PURE__ */ jsxs("div", {
123
+ className: classes.mainContainer,
124
+ children: [/* @__PURE__ */ jsx("div", {
125
+ className: classes.controls,
126
+ children: showDots ? /* @__PURE__ */ jsx("div", {
127
+ className: classes.dots,
128
+ children: Array.from(Array(numSlides)).map((el, index) => /* @__PURE__ */ jsx("span", {
129
+ className: cx(classes.dot, {
130
+ [classes.dotSelected]: index === selectedIndex
131
+ })
132
+ }, `circle-${index}`))
133
+ }) : /* @__PURE__ */ jsxs(Fragment, {
134
+ children: [/* @__PURE__ */ jsx(HvButton, {
135
+ icon: true,
136
+ disabled: !canPrev,
137
+ variant: "secondaryGhost",
138
+ "aria-label": "Backwards",
139
+ onClick: handlePrevious,
140
+ children: /* @__PURE__ */ jsx(Backwards, {
141
+ iconSize: "XS"
142
+ })
143
+ }), /* @__PURE__ */ jsx("div", {
144
+ className: classes.pageCounter,
145
+ children: `${selectedIndex + 1} / ${numSlides}`
146
+ }), /* @__PURE__ */ jsx(HvButton, {
147
+ icon: true,
148
+ disabled: !canNext,
149
+ variant: "secondaryGhost",
150
+ "aria-label": "Forwards",
151
+ onClick: handleNext,
152
+ children: /* @__PURE__ */ jsx(Forwards, {
153
+ iconSize: "XS"
154
+ })
155
+ })]
156
+ })
157
+ }), /* @__PURE__ */ jsxs("div", {
158
+ className: cx(classes.main, {
159
+ [classes.mainXs]: xs,
160
+ [classes.mainFullscreen]: isFullscreen
161
+ }),
162
+ children: [showCounter && /* @__PURE__ */ jsx("div", {
163
+ className: classes.counterContainer,
164
+ children: /* @__PURE__ */ jsx("span", {
165
+ className: classes.counter,
166
+ children: `${selectedIndex + 1}/${numSlides}`
167
+ })
168
+ }), showSlideControls && /* @__PURE__ */ jsxs("div", {
169
+ className: classes.slideControls,
170
+ children: [/* @__PURE__ */ jsx(HvButton, {
171
+ icon: true,
172
+ disabled: !canPrev,
173
+ variant: "secondary",
174
+ "aria-label": "Backwards",
175
+ onClick: handlePrevious,
176
+ children: /* @__PURE__ */ jsx(Backwards, {
177
+ iconSize: "XS"
178
+ })
179
+ }), /* @__PURE__ */ jsx(HvButton, {
180
+ icon: true,
181
+ disabled: !canNext,
182
+ variant: "secondary",
183
+ "aria-label": "Forwards",
184
+ onClick: handleNext,
185
+ children: /* @__PURE__ */ jsx(Forwards, {
186
+ iconSize: "XS"
187
+ })
188
+ })]
189
+ }), /* @__PURE__ */ jsx("div", {
190
+ ref: containerRef,
191
+ style: {
192
+ height
193
+ },
194
+ className: classes.slidesViewport,
195
+ children: /* @__PURE__ */ jsx("div", {
196
+ className: classes.slidesContainer,
197
+ children
198
+ })
199
+ })]
200
+ })]
201
+ }), showThumbnails && /* @__PURE__ */ jsx("div", {
202
+ ref: thumbnailsRef,
203
+ className: classes.panel,
204
+ children: /* @__PURE__ */ jsx(HvStack, {
205
+ direction: "row",
206
+ spacing: "xs",
207
+ children: Array.from(Array(numSlides)).map((doc, i) => /* @__PURE__ */ jsx(HvButton, {
208
+ icon: true,
209
+ variant: "secondaryGhost",
210
+ style: {
211
+ width: thumbnailWidth
212
+ },
213
+ className: cx(classes.thumbnail, {
214
+ [classes.thumbnailSelected]: i === selectedIndex
215
+ }),
216
+ onClick: () => handleScroll(i),
217
+ children: renderThumbnail(i)
218
+ }, `button-${i}`))
219
+ })
220
+ })]
221
+ });
222
+ }
223
+ });
224
+ };
225
+ export {
226
+ HvCarousel
227
+ };
228
+ //# sourceMappingURL=Carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Carousel.js","sources":["../../../../src/components/Carousel/Carousel.tsx"],"sourcesContent":["import React, {\n CSSProperties,\n Children,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport useCarousel, { EmblaOptionsType } from \"embla-carousel-react\";\nimport { ClassNames } from \"@emotion/react\";\nimport {\n Backwards,\n Forwards,\n Close,\n Fullscreen,\n} from \"@hitachivantara/uikit-react-icons\";\nimport { HvButton, HvContainer, HvStack, HvTypography } from \"@core/components\";\nimport { HvBaseProps } from \"@core/types\";\n\nimport styles, {\n HvCarouselClasses,\n carouselClasses as cc,\n} from \"./Carousel.styles\";\nimport { makeClasses } from \"./utils\";\n\nconst clamp = (num: number, max: number, min = 0) =>\n Math.min(Math.max(num, min), max);\n\nexport interface HvCarouselProps\n extends HvBaseProps<HTMLDivElement, \"title\" | \"onChange\"> {\n /** A Jss Object used to override or extend the styles applied. */\n classes?: Partial<HvCarouselClasses>;\n /** Height of the Slider container. If `undefined`, images will keep a 16/9 aspect-ratio */\n height?: CSSProperties[\"height\"];\n /** Width of the thumbnail. Height will try to maintain a 16/9 aspect-ratio */\n thumbnailWidth?: CSSProperties[\"width\"];\n /** Title of the carousel */\n title?: React.ReactNode;\n /** Content slides to be displayed. @see `<HvCarouselSlide />` */\n children?: React.ReactNode;\n /** Custom content to render in the actions area */\n actions?: React.ReactNode;\n /** Whether Carousel is in \"xs mode\" - to use in embedded contexts */\n xs?: boolean;\n /** Whether to show dots instead of arrow pagination. Defaults to true under 5 elements */\n showDots?: boolean;\n /** Whether to show the counter on the top-right corner of the active slide */\n showCounter?: boolean;\n /** Whether to show the back/forwards buttons over the active slide */\n showSlideControls?: boolean;\n /** Whether to enable the fullscreen toggle button */\n showFullscreen?: boolean;\n /** Whether to hide the thumbnails. Hidden by default in \"xs\" mode */\n hideThumbnails?: boolean;\n /** Carousel configuration options. @see https://www.embla-carousel.com/api/options/ */\n carouselOptions?: EmblaOptionsType;\n /** */\n renderThumbnail?: (index: number) => React.ReactNode;\n /** The callback fired when the active slide changes. */\n onChange?: (index: number) => void;\n}\n\n/**\n * A Carousel is commonly used to browse images, it can also be used to browse any kind of content like text, video, or charts.\n * It allows you to focus on a particular content while having a notion of how many you have to explore.\n */\nexport const HvCarousel = (props: HvCarouselProps) => {\n const {\n className,\n classes: classesProp = {},\n height: heightProp = \"auto\",\n thumbnailWidth = 90,\n title,\n children,\n actions,\n xs,\n showDots: showDotsProp,\n showCounter: showCounterProp,\n showSlideControls,\n showFullscreen: showFullscreenProp,\n hideThumbnails: hideThumbnailsProp,\n carouselOptions,\n renderThumbnail,\n onChange,\n ...others\n } = props;\n const thumbnailsRef = useRef<HTMLDivElement>(null);\n const [isFullscreen, setIsFullscreen] = useState(false);\n\n const [containerRef, controller] = useCarousel({\n align: \"start\",\n loop: true,\n ...carouselOptions,\n });\n\n const [selectedIndex, setSelectedIndex] = useState(\n carouselOptions?.startIndex ?? 0\n );\n\n const numSlides = Children.count(children);\n\n const handlePrevious = () => {\n controller?.scrollPrev();\n };\n\n const handleNext = () => {\n controller?.scrollNext();\n };\n\n const handleScroll = (index: number) => {\n controller?.scrollTo(index);\n };\n\n const handleSelect = () => {\n if (!controller) return;\n\n const slideIndex = controller.selectedScrollSnap();\n setSelectedIndex(slideIndex);\n\n // scroll to thumbnail button\n thumbnailsRef.current\n ?.querySelectorAll(\"button\")\n ?.[slideIndex]?.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n });\n\n onChange?.(slideIndex);\n };\n\n useEffect(() => {\n if (!controller) return;\n\n controller.on(\"select\", handleSelect);\n\n return () => {\n controller.off(\"select\", handleSelect);\n };\n }, [controller]);\n\n useEffect(() => {\n if (!controller) return;\n\n controller.reInit();\n setSelectedIndex((currentIndex) => clamp(currentIndex, numSlides, 0));\n }, [numSlides]);\n\n const canPrev = controller?.canScrollPrev() ?? false;\n const canNext = controller?.canScrollNext() ?? false;\n const showTitle = !!title && (!xs || isFullscreen);\n const showFullscreen = showFullscreenProp ?? xs;\n const height = isFullscreen ? \"100%\" : heightProp ?? \"auto\";\n const showCounter = xs;\n const hideThumbnails = hideThumbnailsProp ?? (xs && !isFullscreen);\n const showThumbnails = !hideThumbnails && !!renderThumbnail;\n const showDots = showDotsProp ?? numSlides <= 5;\n\n return (\n <ClassNames>\n {({ css, cx }) => {\n const classes = makeClasses(\n { css, cx },\n { cc, styles, classes: classesProp }\n );\n return (\n <HvContainer\n className={cx(classes.root, className, {\n [classes.xs]: xs,\n [classes.fullscreen]: isFullscreen,\n })}\n {...others}\n >\n {showTitle && (\n <HvTypography variant=\"title2\" className={classes.title}>\n {title}\n </HvTypography>\n )}\n <div className={classes.actions}>\n {showFullscreen && (\n <HvButton\n icon\n variant=\"secondaryGhost\"\n onClick={() => setIsFullscreen((curr) => !curr)}\n className={classes.closeButton}\n >\n {isFullscreen ? (\n <Close aria-label=\"Close\" />\n ) : (\n <Fullscreen aria-label=\"Fullscreen\" />\n )}\n </HvButton>\n )}\n {actions}\n </div>\n\n <div className={classes.mainContainer}>\n <div className={classes.controls}>\n {showDots ? (\n <div className={classes.dots}>\n {Array.from(Array(numSlides)).map((el, index) => (\n <span\n key={`circle-${index}`}\n className={cx(classes.dot, {\n [classes.dotSelected]: index === selectedIndex,\n })}\n />\n ))}\n </div>\n ) : (\n <>\n <HvButton\n icon\n disabled={!canPrev}\n variant=\"secondaryGhost\"\n aria-label=\"Backwards\"\n onClick={handlePrevious}\n >\n <Backwards iconSize=\"XS\" />\n </HvButton>\n <div className={classes.pageCounter}>\n {`${selectedIndex + 1} / ${numSlides}`}\n </div>\n <HvButton\n icon\n disabled={!canNext}\n variant=\"secondaryGhost\"\n aria-label=\"Forwards\"\n onClick={handleNext}\n >\n <Forwards iconSize=\"XS\" />\n </HvButton>\n </>\n )}\n </div>\n\n <div\n className={cx(classes.main, {\n [classes.mainXs]: xs,\n [classes.mainFullscreen]: isFullscreen,\n })}\n >\n {showCounter && (\n <div className={classes.counterContainer}>\n <span className={classes.counter}>\n {`${selectedIndex + 1}/${numSlides}`}\n </span>\n </div>\n )}\n\n {showSlideControls && (\n <div className={classes.slideControls}>\n <HvButton\n icon\n disabled={!canPrev}\n variant=\"secondary\"\n aria-label=\"Backwards\"\n onClick={handlePrevious}\n >\n <Backwards iconSize=\"XS\" />\n </HvButton>\n <HvButton\n icon\n disabled={!canNext}\n variant=\"secondary\"\n aria-label=\"Forwards\"\n onClick={handleNext}\n >\n <Forwards iconSize=\"XS\" />\n </HvButton>\n </div>\n )}\n\n <div\n ref={containerRef}\n style={{ height }}\n className={classes.slidesViewport}\n >\n <div className={classes.slidesContainer}>{children}</div>\n </div>\n </div>\n </div>\n\n {showThumbnails && (\n <div ref={thumbnailsRef} className={classes.panel}>\n <HvStack direction=\"row\" spacing=\"xs\">\n {Array.from(Array(numSlides)).map((doc, i) => (\n <HvButton\n icon\n variant=\"secondaryGhost\"\n key={`button-${i}`}\n style={{ width: thumbnailWidth }}\n className={cx(classes.thumbnail, {\n [classes.thumbnailSelected]: i === selectedIndex,\n })}\n onClick={() => handleScroll(i)}\n >\n {renderThumbnail(i)}\n </HvButton>\n ))}\n </HvStack>\n </div>\n )}\n </HvContainer>\n );\n }}\n </ClassNames>\n );\n};\n"],"names":["clamp","num","max","min","Math","HvCarousel","props","className","classes","classesProp","height","heightProp","thumbnailWidth","title","children","actions","xs","showDots","showDotsProp","showCounter","showCounterProp","showSlideControls","showFullscreen","showFullscreenProp","hideThumbnails","hideThumbnailsProp","carouselOptions","renderThumbnail","onChange","others","thumbnailsRef","useRef","isFullscreen","setIsFullscreen","useState","containerRef","controller","useCarousel","align","loop","selectedIndex","setSelectedIndex","startIndex","numSlides","Children","count","handlePrevious","scrollPrev","handleNext","scrollNext","handleScroll","index","scrollTo","handleSelect","slideIndex","selectedScrollSnap","current","querySelectorAll","scrollIntoView","behavior","block","useEffect","on","off","reInit","currentIndex","canPrev","canScrollPrev","canNext","canScrollNext","showTitle","showThumbnails","ClassNames","css","cx","makeClasses","cc","styles","HvContainer","root","fullscreen","_jsx","HvTypography","variant","_jsxs","HvButton","icon","onClick","curr","closeButton","Close","Fullscreen","mainContainer","controls","dots","Array","from","map","el","dot","dotSelected","_Fragment","disabled","Backwards","iconSize","pageCounter","Forwards","main","mainXs","mainFullscreen","counterContainer","counter","slideControls","ref","style","slidesViewport","slidesContainer","panel","HvStack","direction","spacing","doc","i","width","thumbnail","thumbnailSelected"],"mappings":";;;;;;;;;;;AAwBA,MAAMA,QAAQA,CAACC,KAAaC,KAAaC,MAAM,MAC7CC,KAAKD,IAAIC,KAAKF,IAAID,KAAKE,GAAG,GAAGD,GAAG;AAwCrBG,MAAAA,aAAaA,CAACC,UAA2B;AAC9C,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC,cAAc,CAAC;AAAA,IACxBC,QAAQC,aAAa;AAAA,IACrBC,iBAAiB;AAAA,IACjBC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,UAAUC;AAAAA,IACVC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AAAAA,gBAAgBtG;AAAAA,cAAAA,CAAU;AAAA,YAAA,CAC9C,CAAA;AAAA,UAAA,CACF,CAAA;AAAA,QAAA,CACF,GAELyD,kBACCU,oBAAA,OAAA;AAAA,UAAKgC,KAAKnF;AAAAA,UAAevB,WAAWC,QAAQ6G;AAAAA,UAAMvG,8BAC/CwG,SAAO;AAAA,YAACC,WAAU;AAAA,YAAMC,SAAQ;AAAA,YAAI1G,UAClCiF,MAAMC,KAAKD,MAAMpD,SAAS,CAAC,EAAEsD,IAAI,CAACwB,KAAKC,MACtCzC,oBAACI,UAAQ;AAAA,cACPC,MAAI;AAAA,cACJH,SAAQ;AAAA,cAER+B,OAAO;AAAA,gBAAES,OAAO/G;AAAAA,cAAe;AAAA,cAC/BL,WAAWmE,GAAGlE,QAAQoH,WAAW;AAAA,gBAC/B,CAACpH,QAAQqH,iBAAiB,GAAGH,MAAMlF;AAAAA,cAAAA,CACpC;AAAA,cACD+C,SAASA,MAAMrC,aAAawE,CAAC;AAAA,cAAE5G,UAE9Ba,gBAAgB+F,CAAC;AAAA,YAAC,GAPb,UAASA,GAAG,CASrB;AAAA,UAAA,CAAC;AAAA,QAAA,CAGP,CAAA;AAAA,MAAA,CACW;AAAA,IAElB;AAAA,EAAA,CACW;AAEjB;"}
@@ -0,0 +1,177 @@
1
+ import { theme } from "@hitachivantara/uikit-styles";
2
+ import { replace$ } from "./utils.js";
3
+ import { getClasses } from "../../utils/classes.js";
4
+ const styles = {
5
+ /** Styles applied to the component root class. */
6
+ root: {
7
+ display: "flex",
8
+ alignItems: "stretch",
9
+ flexDirection: "column",
10
+ backgroundColor: theme.colors.atmo1,
11
+ margin: 0,
12
+ paddingTop: theme.spacing(2),
13
+ paddingBottom: theme.spacing(2)
14
+ },
15
+ xs: {
16
+ "&:not(._)": {
17
+ padding: 0
18
+ },
19
+ // put dots on top of Slide
20
+ "& $dots": {
21
+ position: "relative",
22
+ top: "-40px"
23
+ },
24
+ "& $actions": {
25
+ top: 0
26
+ },
27
+ "& $controls": {
28
+ display: theme.carousel.xsControlsDisplay
29
+ }
30
+ },
31
+ fullscreen: {
32
+ width: "100vw",
33
+ height: "100vh",
34
+ position: "fixed",
35
+ inset: 0,
36
+ zIndex: theme.zIndices.modal,
37
+ "&:not(._)": {
38
+ padding: theme.spacing(["xs", "xl"])
39
+ }
40
+ },
41
+ title: {
42
+ display: "flex",
43
+ justifyContent: "flex-start",
44
+ marginBottom: theme.space.xs
45
+ },
46
+ actions: {
47
+ display: "flex",
48
+ justifyContent: "flex-end",
49
+ height: 0,
50
+ zIndex: 1,
51
+ position: "relative",
52
+ top: theme.carousel.actionsOffsetTop
53
+ },
54
+ closeButton: {},
55
+ mainContainer: {
56
+ display: "flex",
57
+ flexDirection: theme.carousel.mainContainerFlexDirection
58
+ },
59
+ controls: {
60
+ display: "flex",
61
+ alignItems: "center",
62
+ height: 32,
63
+ justifyContent: theme.carousel.controlsJustifyContent,
64
+ backgroundColor: theme.carousel.controlsBackgroundColor,
65
+ border: theme.carousel.controlsBorder,
66
+ gap: theme.space.xs,
67
+ "&:has($dots)": {
68
+ justifyContent: "center"
69
+ }
70
+ },
71
+ pageCounter: {},
72
+ main: {
73
+ padding: 0,
74
+ display: "flex",
75
+ flexDirection: "column",
76
+ position: "relative",
77
+ "&:hover $slideControls": {
78
+ opacity: 1
79
+ }
80
+ },
81
+ mainXs: {},
82
+ mainFullscreen: {
83
+ maxHeight: "80vh"
84
+ },
85
+ counterContainer: {
86
+ position: "absolute",
87
+ top: theme.space.xs,
88
+ right: theme.space.md,
89
+ zIndex: 1,
90
+ display: theme.carousel.counterContainerDisplay
91
+ },
92
+ counter: {
93
+ color: theme.colors.base_light,
94
+ backgroundColor: theme.colors.base_dark,
95
+ padding: theme.spacing([0, "sm"])
96
+ },
97
+ slideControls: {
98
+ position: "absolute",
99
+ left: 0,
100
+ right: 0,
101
+ top: `calc(50% - (32px / 2))`,
102
+ padding: theme.spacing([0, "sm"]),
103
+ display: "flex",
104
+ flexDirection: "row",
105
+ alignItems: "center",
106
+ justifyContent: "space-between",
107
+ opacity: 0,
108
+ "& button": {
109
+ zIndex: 1
110
+ },
111
+ "&:focus-within": {
112
+ opacity: 1
113
+ }
114
+ },
115
+ slidesViewport: {
116
+ overflow: "hidden"
117
+ },
118
+ slidesContainer: {
119
+ display: "flex",
120
+ flexDirection: "row",
121
+ height: "100%"
122
+ },
123
+ dots: {
124
+ display: "flex",
125
+ alignItems: "center",
126
+ justifyContent: "center",
127
+ gap: theme.space.xs,
128
+ height: theme.space.md
129
+ },
130
+ dotsXs: {},
131
+ dot: {
132
+ width: 5,
133
+ height: 5,
134
+ margin: theme.space.xs,
135
+ borderRadius: "50%",
136
+ backgroundColor: theme.colors.atmo4
137
+ },
138
+ dotSelected: {
139
+ width: 10,
140
+ height: 10,
141
+ backgroundColor: theme.colors.secondary_80
142
+ },
143
+ panel: {
144
+ display: "flex",
145
+ width: "100%",
146
+ overflowX: "auto",
147
+ // "hidden",
148
+ overflowY: "hidden",
149
+ padding: theme.spacing(["xs", "2px", "2px"])
150
+ },
151
+ thumbnail: {
152
+ height: "unset",
153
+ padding: 0,
154
+ "& img": {
155
+ width: "100%",
156
+ height: "100%",
157
+ textAlign: "center",
158
+ aspectRatio: "16/9",
159
+ opacity: "50%",
160
+ borderRadius: theme.carousel.thumbnailBorderRadius
161
+ }
162
+ },
163
+ thumbnailSelected: {
164
+ "& img": {
165
+ border: theme.carousel.thumbnailSelectedBorder,
166
+ opacity: "100%"
167
+ }
168
+ }
169
+ };
170
+ const name = "HvCarousel";
171
+ const carouselClasses = getClasses(Object.keys(styles), name);
172
+ const newStyles = replace$(styles, name);
173
+ export {
174
+ carouselClasses,
175
+ newStyles as default
176
+ };
177
+ //# sourceMappingURL=Carousel.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Carousel.styles.js","sources":["../../../../src/components/Carousel/Carousel.styles.ts"],"sourcesContent":["import { CSSProperties } from \"react\";\nimport { CSSInterpolation } from \"@emotion/css\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { getClasses } from \"@core/utils\";\nimport { replace$ } from \"./utils\";\n\nexport type HvCarouselClasses = Record<keyof typeof styles, string>;\n\nconst styles = {\n /** Styles applied to the component root class. */\n root: {\n display: \"flex\",\n alignItems: \"stretch\",\n flexDirection: \"column\",\n backgroundColor: theme.colors.atmo1,\n margin: 0,\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n xs: {\n \"&:not(._)\": {\n padding: 0,\n },\n // put dots on top of Slide\n \"& $dots\": {\n position: \"relative\",\n top: \"-40px\",\n },\n \"& $actions\": {\n top: 0,\n },\n \"& $controls\": {\n display: theme.carousel.xsControlsDisplay,\n },\n },\n fullscreen: {\n width: \"100vw\",\n height: \"100vh\",\n position: \"fixed\",\n inset: 0,\n zIndex: theme.zIndices.modal,\n \"&:not(._)\": {\n padding: theme.spacing([\"xs\", \"xl\"]),\n },\n },\n title: {\n display: \"flex\",\n justifyContent: \"flex-start\",\n marginBottom: theme.space.xs,\n },\n actions: {\n display: \"flex\",\n justifyContent: \"flex-end\",\n height: 0,\n zIndex: 1,\n\n position: \"relative\",\n top: theme.carousel.actionsOffsetTop,\n },\n closeButton: {},\n\n mainContainer: {\n display: \"flex\",\n flexDirection: theme.carousel\n .mainContainerFlexDirection as CSSProperties[\"flexDirection\"],\n },\n\n controls: {\n display: \"flex\",\n alignItems: \"center\",\n height: 32,\n justifyContent: theme.carousel.controlsJustifyContent,\n backgroundColor: theme.carousel.controlsBackgroundColor,\n border: theme.carousel.controlsBorder,\n gap: theme.space.xs,\n \"&:has($dots)\": {\n justifyContent: \"center\",\n },\n },\n pageCounter: {},\n\n main: {\n padding: 0,\n display: \"flex\",\n flexDirection: \"column\",\n position: \"relative\",\n \"&:hover $slideControls\": {\n opacity: 1,\n },\n },\n mainXs: {},\n mainFullscreen: {\n maxHeight: \"80vh\",\n },\n counterContainer: {\n position: \"absolute\",\n top: theme.space.xs,\n right: theme.space.md,\n zIndex: 1,\n display: theme.carousel.counterContainerDisplay,\n },\n counter: {\n color: theme.colors.base_light,\n backgroundColor: theme.colors.base_dark,\n padding: theme.spacing([0, \"sm\"]),\n },\n slideControls: {\n position: \"absolute\",\n left: 0,\n right: 0,\n top: `calc(50% - (32px / 2))`,\n padding: theme.spacing([0, \"sm\"]),\n display: \"flex\",\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n opacity: 0,\n \"& button\": {\n zIndex: 1,\n },\n \"&:focus-within\": {\n opacity: 1,\n },\n },\n slidesViewport: {\n overflow: \"hidden\",\n },\n slidesContainer: {\n display: \"flex\",\n flexDirection: \"row\",\n height: \"100%\",\n },\n\n dots: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: theme.space.xs,\n height: theme.space.md,\n },\n dotsXs: {},\n dot: {\n width: 5,\n height: 5,\n margin: theme.space.xs,\n borderRadius: \"50%\",\n backgroundColor: theme.colors.atmo4,\n },\n dotSelected: {\n width: 10,\n height: 10,\n backgroundColor: theme.colors.secondary_80,\n },\n\n panel: {\n display: \"flex\",\n width: \"100%\",\n overflowX: \"auto\", // \"hidden\",\n overflowY: \"hidden\",\n padding: theme.spacing([\"xs\", \"2px\", \"2px\"]),\n },\n thumbnail: {\n height: \"unset\",\n padding: 0,\n \"& img\": {\n width: \"100%\",\n height: \"100%\",\n textAlign: \"center\",\n aspectRatio: \"16/9\",\n opacity: \"50%\",\n borderRadius: theme.carousel.thumbnailBorderRadius,\n },\n },\n thumbnailSelected: {\n \"& img\": {\n border: theme.carousel.thumbnailSelectedBorder,\n opacity: \"100%\",\n },\n },\n} satisfies Record<string, CSSInterpolation>;\n\nconst name = \"HvCarousel\";\n\nexport const carouselClasses = getClasses(\n Object.keys(styles) as (keyof HvCarouselClasses)[],\n name\n);\n\nconst newStyles = replace$(styles, name);\n\nexport default newStyles;\n"],"names":["styles","root","display","alignItems","flexDirection","backgroundColor","theme","colors","atmo1","margin","paddingTop","spacing","paddingBottom","xs","padding","position","top","carousel","xsControlsDisplay","fullscreen","width","height","inset","zIndex","zIndices","modal","title","justifyContent","marginBottom","space","actions","actionsOffsetTop","closeButton","mainContainer","mainContainerFlexDirection","controls","controlsJustifyContent","controlsBackgroundColor","border","controlsBorder","gap","pageCounter","main","opacity","mainXs","mainFullscreen","maxHeight","counterContainer","right","md","counterContainerDisplay","counter","color","base_light","base_dark","slideControls","left","slidesViewport","overflow","slidesContainer","dots","dotsXs","dot","borderRadius","atmo4","dotSelected","secondary_80","panel","overflowX","overflowY","thumbnail","textAlign","aspectRatio","thumbnailBorderRadius","thumbnailSelected","thumbnailSelectedBorder","name","carouselClasses","getClasses","Object","keys","newStyles","replace$"],"mappings":";;;AAQA,MAAMA,SAAS;AAAA;AAAA,EAEbC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,eAAe;AAAA,IACfC,iBAAiBC,MAAMC,OAAOC;AAAAA,IAC9BC,QAAQ;AAAA,IACRC,YAAYJ,MAAMK,QAAQ,CAAC;AAAA,IAC3BC,eAAeN,MAAMK,QAAQ,CAAC;AAAA,EAChC;AAAA,EACAE,IAAI;AAAA,IACF,aAAa;AAAA,MACXC,SAAS;AAAA,IACX;AAAA;AAAA,IAEA,WAAW;AAAA,MACTC,UAAU;AAAA,MACVC,KAAK;AAAA,IACP;AAAA,IACA,cAAc;AAAA,MACZA,KAAK;AAAA,IACP;AAAA,IACA,eAAe;AAAA,MACbd,SAASI,MAAMW,SAASC;AAAAA,IAC1B;AAAA,EACF;AAAA,EACAC,YAAY;AAAA,IACVC,OAAO;AAAA,IACPC,QAAQ;AAAA,IACRN,UAAU;AAAA,IACVO,OAAO;AAAA,IACPC,QAAQjB,MAAMkB,SAASC;AAAAA,IACvB,aAAa;AAAA,MACXX,SAASR,MAAMK,QAAQ,CAAC,MAAM,IAAI,CAAC;AAAA,IACrC;AAAA,EACF;AAAA,EACAe,OAAO;AAAA,IACLxB,SAAS;AAAA,IACTyB,gBAAg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,MACPM,OAAO;AAAA,MACPC,QAAQ;AAAA,MACRkD,WAAW;AAAA,MACXC,aAAa;AAAA,MACb7B,SAAS;AAAA,MACToB,cAAczD,MAAMW,SAASwD;AAAAA,IAC/B;AAAA,EACF;AAAA,EACAC,mBAAmB;AAAA,IACjB,SAAS;AAAA,MACPpC,QAAQhC,MAAMW,SAAS0D;AAAAA,MACvBhC,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAEA,MAAMiC,OAAO;AAEN,MAAMC,kBAAkBC,WAC7BC,OAAOC,KAAKhF,MAAM,GAClB4E,IAAI;AAGAK,MAAAA,YAAYC,SAASlF,QAAQ4E,IAAI;"}
@@ -0,0 +1,43 @@
1
+ import { ClassNames } from "@emotion/react";
2
+ import styles, { cc } from "./CarouselSlide.styles.js";
3
+ import { makeClasses } from "../utils.js";
4
+ import { jsx } from "@emotion/react/jsx-runtime";
5
+ const HvCarouselSlide = ({
6
+ classes: classesProp = {},
7
+ children,
8
+ size: flexBasis = "100%",
9
+ src,
10
+ alt,
11
+ ...props
12
+ }) => {
13
+ return /* @__PURE__ */ jsx(ClassNames, {
14
+ children: ({
15
+ css,
16
+ cx
17
+ }) => {
18
+ const classes = makeClasses({
19
+ css,
20
+ cx
21
+ }, {
22
+ cc,
23
+ styles,
24
+ classes: classesProp
25
+ });
26
+ return /* @__PURE__ */ jsx("div", {
27
+ className: cx(css({
28
+ flex: `0 0 ${flexBasis}`
29
+ }), classes.slide),
30
+ children: children ?? /* @__PURE__ */ jsx("img", {
31
+ className: classes.image,
32
+ src,
33
+ alt,
34
+ ...props
35
+ })
36
+ });
37
+ }
38
+ });
39
+ };
40
+ export {
41
+ HvCarouselSlide
42
+ };
43
+ //# sourceMappingURL=CarouselSlide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CarouselSlide.js","sources":["../../../../../src/components/Carousel/CarouselSlide/CarouselSlide.tsx"],"sourcesContent":["import { ImgHTMLAttributes } from \"react\";\nimport { ClassNames } from \"@emotion/react\";\n\nimport styles, { HvCarouselSlideClasses, cc } from \"./CarouselSlide.styles\";\nimport { makeClasses } from \"../utils\";\n\nexport interface HvCarouselSlideProps\n extends ImgHTMLAttributes<HTMLImageElement> {\n /** A Jss Object used to override or extend the styles applied. */\n classes?: Partial<HvCarouselSlideClasses>;\n /** The width of the Slide. Defaults to `100%` */\n size?: string;\n /** Content of a slide to be displayed */\n children?: React.ReactNode;\n}\n\n/**\n * A container to use as `children` of `HvCarousel`.\n * Pass `img` props directly to it, or `children` for any custom content\n */\nexport const HvCarouselSlide = ({\n classes: classesProp = {},\n children,\n size: flexBasis = \"100%\",\n src,\n alt,\n ...props\n}: HvCarouselSlideProps) => {\n return (\n <ClassNames>\n {({ css, cx }) => {\n const classes = makeClasses(\n { css, cx },\n { cc, styles, classes: classesProp }\n );\n\n return (\n <div className={cx(css({ flex: `0 0 ${flexBasis}` }), classes.slide)}>\n {children ?? (\n <img className={classes.image} src={src} alt={alt} {...props} />\n )}\n </div>\n );\n }}\n </ClassNames>\n );\n};\n"],"names":["HvCarouselSlide","classes","classesProp","children","size","flexBasis","src","alt","props","ClassNames","css","cx","makeClasses","cc","styles","className","flex","slide","_jsx","image"],"mappings":";;;;AAoBO,MAAMA,kBAAkBA,CAAC;AAAA,EAC9BC,SAASC,cAAc,CAAC;AAAA,EACxBC;AAAAA,EACAC,MAAMC,YAAY;AAAA,EAClBC;AAAAA,EACAC;AAAAA,EACA,GAAGC;AACiB,MAAM;AAC1B,6BACGC,YAAU;AAAA,IAAAN,UACRA,CAAC;AAAA,MAAEO;AAAAA,MAAKC;AAAAA,IAAAA,MAAS;AAChB,YAAMV,UAAUW,YACd;AAAA,QAAEF;AAAAA,QAAKC;AAAAA,MAAAA,GACP;AAAA,QAAEE;AAAAA,QAAIC;AAAAA,QAAQb,SAASC;AAAAA,MAAAA,CAAa;AAGtC,iCACE,OAAA;AAAA,QAAKa,WAAWJ,GAAGD,IAAI;AAAA,UAAEM,MAAO,OAAMX;AAAAA,QAAAA,CAAa,GAAGJ,QAAQgB,KAAK;AAAA,QAAEd,UAClEA,YACCe,oBAAA,OAAA;AAAA,UAAKH,WAAWd,QAAQkB;AAAAA,UAAOb;AAAAA,UAAUC;AAAAA,UAAS,GAAKC;AAAAA,QAAAA,CAAK;AAAA,MAAA,CAE1D;AAAA,IAEV;AAAA,EAAA,CACW;AAEjB;"}
@@ -0,0 +1,15 @@
1
+ import { getClasses } from "../../../utils/classes.js";
2
+ const styles = {
3
+ slide: {},
4
+ image: {
5
+ aspectRatio: "16/9",
6
+ width: "100%",
7
+ height: "100%"
8
+ }
9
+ };
10
+ const cc = getClasses(Object.keys(styles), "HvCarouselSlide");
11
+ export {
12
+ cc,
13
+ styles as default
14
+ };
15
+ //# sourceMappingURL=CarouselSlide.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CarouselSlide.styles.js","sources":["../../../../../src/components/Carousel/CarouselSlide/CarouselSlide.styles.ts"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/css\";\nimport { getClasses } from \"@core/utils\";\n\nexport type HvCarouselSlideClasses = Record<keyof typeof styles, string>;\n\nconst styles = {\n slide: {},\n image: {\n aspectRatio: \"16/9\",\n width: \"100%\",\n height: \"100%\",\n },\n} satisfies Record<string, CSSInterpolation>;\n\nexport const cc = getClasses(\n Object.keys(styles) as (keyof HvCarouselSlideClasses)[],\n \"HvCarouselSlide\"\n);\n\nexport default styles;\n"],"names":["styles","slide","image","aspectRatio","width","height","cc","getClasses","Object","keys"],"mappings":";AAKA,MAAMA,SAAS;AAAA,EACbC,OAAO,CAAC;AAAA,EACRC,OAAO;AAAA,IACLC,aAAa;AAAA,IACbC,OAAO;AAAA,IACPC,QAAQ;AAAA,EACV;AACF;AAEO,MAAMC,KAAKC,WAChBC,OAAOC,KAAKT,MAAM,GAClB,iBAAiB;"}
@@ -0,0 +1,36 @@
1
+ const makeClasses = ({
2
+ css,
3
+ cx
4
+ }, {
5
+ cc,
6
+ classes,
7
+ styles
8
+ }) => Object.keys(cc).reduce((acc, key) => {
9
+ acc[key] = cx(cc == null ? void 0 : cc[key], css(styles == null ? void 0 : styles[key]), classes == null ? void 0 : classes[key]);
10
+ return acc;
11
+ }, {});
12
+ const deepRename = (obj, mapFn) => {
13
+ const result = {};
14
+ for (const key in obj) {
15
+ if (obj.hasOwnProperty(key)) {
16
+ const newKey = mapFn(key);
17
+ const value = obj[key];
18
+ result[newKey] = typeof value === "object" ? deepRename(value, mapFn) : value;
19
+ }
20
+ }
21
+ return result;
22
+ };
23
+ const replace$ = (stylesObj, name) => {
24
+ return deepRename(stylesObj, (key) => {
25
+ const matches = key.match(/\$\w+/g);
26
+ if (!(matches == null ? void 0 : matches.length))
27
+ return key;
28
+ const newKey = matches.reduce((acc, match) => acc.replace(match, `.${name}-${match.slice(1)}`), key);
29
+ return newKey ?? key;
30
+ });
31
+ };
32
+ export {
33
+ makeClasses,
34
+ replace$
35
+ };
36
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/components/Carousel/utils.ts"],"sourcesContent":["import type { CSSInterpolation } from \"@emotion/css\";\nimport type { ClassNamesContent } from \"@emotion/react\";\n\ntype ClassObject<T extends string> = {\n cc: Record<T, string>;\n classes: Partial<Record<T, string>>;\n styles: Record<T, CSSInterpolation>;\n};\n\nexport const makeClasses = <T extends string>(\n { css, cx }: Pick<ClassNamesContent, \"css\" | \"cx\">,\n { cc, classes, styles }: ClassObject<T>\n) =>\n Object.keys(cc).reduce((acc, key) => {\n acc[key] = cx(cc?.[key], css(styles?.[key]), classes?.[key]);\n return acc;\n }, {} as { [P in T]: string });\n\nconst deepRename = <T extends object>(\n obj: T,\n mapFn: (key: string) => string\n): T => {\n const result: any = {};\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n const newKey = mapFn(key);\n const value = obj[key];\n result[newKey] =\n typeof value === \"object\" ? deepRename(value as any, mapFn) : value;\n }\n }\n return result;\n};\n\n/** Given a `stylesObj`, replaces its keys' `$myClass` with `.{name}-myClass` */\nexport const replace$ = <T extends object>(stylesObj: T, name: string): T => {\n return deepRename(stylesObj, (key) => {\n const matches = key.match(/\\$\\w+/g);\n if (!matches?.length) return key;\n const newKey = matches.reduce(\n (acc, match) => acc.replace(match, `.${name}-${match.slice(1)}`),\n key\n );\n return newKey ?? key;\n });\n};\n"],"names":["makeClasses","css","cx","cc","classes","styles","Object","keys","reduce","acc","key","deepRename","obj","mapFn","result","hasOwnProperty","newKey","value","replace$","stylesObj","name","matches","match","length","replace","slice"],"mappings":"AASO,MAAMA,cAAc,CACzB;AAAA,EAAEC;AAAAA,EAAKC;AAA0C,GACjD;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAASC;AAAuB,MAEtCC,OAAOC,KAAKJ,EAAE,EAAEK,OAAO,CAACC,KAAKC,QAAQ;AACnCD,MAAIC,GAAG,IAAIR,GAAGC,yBAAKO,MAAMT,IAAII,iCAASK,IAAI,GAAGN,mCAAUM,IAAI;AACpDD,SAAAA;AACT,GAAG,EAA2B;AAEhC,MAAME,aAAa,CACjBC,KACAC,UACM;AACN,QAAMC,SAAc,CAAA;AACpB,aAAWJ,OAAOE,KAAK;AACjBA,QAAAA,IAAIG,eAAeL,GAAG,GAAG;AACrBM,YAAAA,SAASH,MAAMH,GAAG;AAClBO,YAAAA,QAAQL,IAAIF,GAAG;AACdM,aAAAA,MAAM,IACX,OAAOC,UAAU,WAAWN,WAAWM,OAAcJ,KAAK,IAAII;AAAAA,IAClE;AAAA,EACF;AACOH,SAAAA;AACT;AAGaI,MAAAA,WAAW,CAAmBC,WAAcC,SAAoB;AACpET,SAAAA,WAAWQ,WAAYT,CAAQ,QAAA;AAC9BW,UAAAA,UAAUX,IAAIY,MAAM,QAAQ;AAClC,QAAI,EAACD,mCAASE;AAAeb,aAAAA;AAC7B,UAAMM,SAASK,QAAQb,OACrB,CAACC,KAAKa,UAAUb,IAAIe,QAAQF,OAAQ,IAAGF,QAAQE,MAAMG,MAAM,CAAC,GAAG,GAC/Df,GAAG;AAEL,WAAOM,UAAUN;AAAAA,EAAAA,CAClB;AACH;"}