@max-ts/kit 1.3.2 → 1.5.0

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 (38) hide show
  1. package/lib/components/Calendar/Dropdown/Dropdown.d.ts.map +1 -1
  2. package/lib/components/Carousel/Buttons/Buttons.d.ts +1 -1
  3. package/lib/components/Carousel/Buttons/Buttons.d.ts.map +1 -1
  4. package/lib/components/Carousel/Buttons/styles.css.d.ts +3 -3
  5. package/lib/components/Carousel/Buttons/styles.css.d.ts.map +1 -1
  6. package/lib/components/Carousel/Carousel.d.ts +14 -16
  7. package/lib/components/Carousel/Carousel.d.ts.map +1 -1
  8. package/lib/components/Carousel/CarouselContext.d.ts +3 -5
  9. package/lib/components/Carousel/CarouselContext.d.ts.map +1 -1
  10. package/lib/components/Carousel/Content/Content.d.ts +2 -1
  11. package/lib/components/Carousel/Content/Content.d.ts.map +1 -1
  12. package/lib/components/Carousel/Content/styles.css.d.ts +1 -1
  13. package/lib/components/Carousel/Content/styles.css.d.ts.map +1 -1
  14. package/lib/components/Carousel/Dots/Dots.d.ts +2 -5
  15. package/lib/components/Carousel/Dots/Dots.d.ts.map +1 -1
  16. package/lib/components/Carousel/Dots/useLogic/useLogic.d.ts.map +1 -1
  17. package/lib/components/Carousel/Item/Item.d.ts +2 -1
  18. package/lib/components/Carousel/Item/Item.d.ts.map +1 -1
  19. package/lib/components/Carousel/Item/styles.css.d.ts +1 -0
  20. package/lib/components/Carousel/Item/styles.css.d.ts.map +1 -1
  21. package/lib/components/Carousel/types.d.ts +16 -6
  22. package/lib/components/Carousel/types.d.ts.map +1 -1
  23. package/lib/components/Carousel/useLogic/useLogic.d.ts +13 -13
  24. package/lib/components/Carousel/useLogic/useLogic.d.ts.map +1 -1
  25. package/lib/components/PeriodPicker/YearsDropdown/YearsDropdown.d.ts.map +1 -1
  26. package/lib/components/Select/Select.d.ts +15 -26
  27. package/lib/components/Select/Select.d.ts.map +1 -1
  28. package/lib/components/Select/styles.css.d.ts +0 -1
  29. package/lib/components/Select/styles.css.d.ts.map +1 -1
  30. package/lib/components/Select/types.d.ts +23 -0
  31. package/lib/components/Select/types.d.ts.map +1 -0
  32. package/lib/index.mjs +347 -142
  33. package/lib/stories/Carousel.stories.d.ts +1 -0
  34. package/lib/stories/Carousel.stories.d.ts.map +1 -1
  35. package/lib/stories/Select.stories.d.ts +12 -4
  36. package/lib/stories/Select.stories.d.ts.map +1 -1
  37. package/lib/styles.css +100 -47
  38. package/package.json +1 -2
package/lib/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Accordion, Checkbox } from "@base-ui/react";
3
3
  import clsx_0, { clsx } from "clsx";
4
- import { ArrowDownNarrowWide, ArrowDownUp, ArrowDownWideNarrow, Calendar1, Check, CheckIcon, ChevronDown, ChevronDownIcon, ChevronLeft, ChevronRight, ChevronRightIcon, ChevronUp, CircleCheck, CircleIcon, Copy, Ellipsis as external_lucide_react_Ellipsis, EllipsisVertical, Info, MoreHorizontalIcon, OctagonAlert, PanelLeftIcon, TriangleAlert, XIcon } from "lucide-react";
4
+ import { ArrowDownNarrowWide, ArrowDownUp, ArrowDownWideNarrow, ArrowLeft, ArrowRight, Calendar1, Check, CheckIcon, ChevronDown, ChevronDownIcon, ChevronLeft, ChevronRight, ChevronRightIcon, ChevronUp, CircleCheck, CircleIcon, Copy, Ellipsis as external_lucide_react_Ellipsis, EllipsisVertical, Info, MoreHorizontalIcon, OctagonAlert, PanelLeftIcon, TriangleAlert, XIcon } from "lucide-react";
5
5
  import { AlertDialog } from "@base-ui/react/alert-dialog";
6
6
  import { Button } from "@base-ui/react/button";
7
7
  import react, { createContext, createElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
@@ -12,7 +12,6 @@ import { useRender } from "@base-ui/react/use-render";
12
12
  import { Separator as separator_Separator } from "@base-ui/react/separator";
13
13
  import { DayPicker } from "react-day-picker";
14
14
  import { ru } from "react-day-picker/locale";
15
- import embla_carousel_react from "embla-carousel-react";
16
15
  import { Collapsible } from "@base-ui/react/collapsible";
17
16
  import { Popover } from "@base-ui/react/popover";
18
17
  import { Tooltip } from "@base-ui/react/tooltip";
@@ -1026,14 +1025,14 @@ function Dropdown(props) {
1026
1025
  onValueChange: handleChange,
1027
1026
  items: items,
1028
1027
  children: [
1029
- /*#__PURE__*/ jsx(SelectTrigger, {
1028
+ /*#__PURE__*/ jsx(Select_Select.Trigger, {
1030
1029
  className: Dropdown_styles_css_trigger,
1031
- children: /*#__PURE__*/ jsx(SelectValue, {
1030
+ children: /*#__PURE__*/ jsx(Select_Select.Value, {
1032
1031
  placeholder: selectedOption?.label
1033
1032
  })
1034
1033
  }),
1035
- /*#__PURE__*/ jsx(SelectContent, {
1036
- children: options?.map(({ value, label, disabled })=>/*#__PURE__*/ jsx(SelectItem, {
1034
+ /*#__PURE__*/ jsx(Select_Select.Content, {
1035
+ children: options?.map(({ value, label, disabled })=>/*#__PURE__*/ jsx(Select_Select.Item, {
1037
1036
  value: value.toString(),
1038
1037
  disabled: disabled,
1039
1038
  children: /*#__PURE__*/ jsx(Typography, {
@@ -1209,52 +1208,62 @@ function useCarousel() {
1209
1208
  if (!context) throw new Error('useCarousel must be used within a <Carousel />');
1210
1209
  return context;
1211
1210
  }
1212
- var next = 'style__2d6ocq1 style__2d6ocq0';
1213
- var orientations = {
1214
- horizontal: 'horizontal__2d6ocq3',
1215
- vertical: 'vertical__2d6ocq4'
1211
+ var buttonNext = {
1212
+ horizontal: 'horizontal__2d6ocq2 style__2d6ocq0',
1213
+ vertical: 'vertical__2d6ocq3 style__2d6ocq0'
1214
+ };
1215
+ var buttonPrev = {
1216
+ horizontal: 'horizontal__2d6ocq4 style__2d6ocq0',
1217
+ vertical: 'vertical__2d6ocq5 style__2d6ocq0'
1216
1218
  };
1217
- var prev = 'style__2d6ocq2 style__2d6ocq0';
1218
- function Buttons({ className, ...props }) {
1219
+ var iconWrapper = 'style__2d6ocq1';
1220
+ function Arrows({ className, ...props }) {
1219
1221
  const { orientation = 'horizontal', canScrollNext, scrollNext, canScrollPrev, scrollPrev } = useCarousel();
1220
1222
  return /*#__PURE__*/ jsxs(Fragment, {
1221
1223
  children: [
1222
1224
  /*#__PURE__*/ jsx("button", {
1223
- className: clsx(next, orientations[orientation]),
1225
+ className: clsx(buttonPrev[orientation], className),
1224
1226
  type: "button",
1225
- "data-slot": "carousel-next",
1226
- disabled: !canScrollNext,
1227
- onClick: scrollNext,
1227
+ "data-slot": "carousel-previous",
1228
+ "aria-label": "Previous slide",
1229
+ disabled: !canScrollPrev,
1230
+ onClick: scrollPrev,
1228
1231
  ...props,
1229
- children: 'horizontal' === orientation ? /*#__PURE__*/ jsx(ChevronRight, {}) : /*#__PURE__*/ jsx(ChevronDown, {})
1232
+ children: /*#__PURE__*/ jsx("span", {
1233
+ className: iconWrapper,
1234
+ children: /*#__PURE__*/ jsx(ArrowLeft, {})
1235
+ })
1230
1236
  }),
1231
1237
  /*#__PURE__*/ jsx("button", {
1232
1238
  type: "button",
1233
- className: clsx(prev, orientations[orientation]),
1234
- "data-slot": "carousel-previous",
1235
- disabled: !canScrollPrev,
1236
- onClick: scrollPrev,
1239
+ className: clsx(buttonNext[orientation], className),
1240
+ "data-slot": "carousel-next",
1241
+ "aria-label": "Next slide",
1242
+ "aria-disabled": !canScrollNext,
1243
+ disabled: !canScrollNext,
1244
+ onClick: scrollNext,
1237
1245
  ...props,
1238
- children: 'horizontal' === orientation ? /*#__PURE__*/ jsx(ChevronLeft, {}) : /*#__PURE__*/ jsx(ChevronUp, {})
1246
+ children: /*#__PURE__*/ jsx("span", {
1247
+ className: iconWrapper,
1248
+ children: /*#__PURE__*/ jsx(ArrowRight, {})
1249
+ })
1239
1250
  })
1240
1251
  ]
1241
1252
  });
1242
1253
  }
1243
- var styles_css_orientations = {
1254
+ var Content_styles_css_content = 'style__i1lems0';
1255
+ var orientations = {
1244
1256
  horizontal: 'horizontal__i1lems1',
1245
1257
  vertical: 'vertical__i1lems2'
1246
1258
  };
1247
- var wrapper = 'style__i1lems0';
1248
- function Content_Content(props) {
1259
+ function Content_Content({ className, ...props }) {
1249
1260
  const { carouselRef, orientation = 'horizontal' } = useCarousel();
1250
1261
  return /*#__PURE__*/ jsx("div", {
1251
- className: wrapper,
1262
+ className: clsx(Content_styles_css_content, orientations[orientation], className),
1252
1263
  ref: carouselRef,
1253
1264
  "data-slot": "carousel-content",
1254
- children: /*#__PURE__*/ jsx("div", {
1255
- className: styles_css_orientations[orientation],
1256
- ...props
1257
- })
1265
+ "data-orientation": orientation,
1266
+ ...props
1258
1267
  });
1259
1268
  }
1260
1269
  var dotButton = {
@@ -1262,7 +1271,7 @@ var dotButton = {
1262
1271
  vertical: 'vertical__e2zpp65 style__e2zpp63'
1263
1272
  };
1264
1273
  var styles_css_selected = 'style__e2zpp66';
1265
- var styles_css_wrapper = {
1274
+ var wrapper = {
1266
1275
  horizontal: 'horizontal__e2zpp61 style__e2zpp60',
1267
1276
  vertical: 'vertical__e2zpp62 style__e2zpp60'
1268
1277
  };
@@ -1270,24 +1279,23 @@ const useLogic = (api)=>{
1270
1279
  const [selectedIndex, setSelectedIndex] = useState(0);
1271
1280
  const [scrollSnaps, setScrollSnaps] = useState([]);
1272
1281
  const onDotButtonClick = useCallback((index)=>{
1273
- if (!api) return;
1274
1282
  api.scrollTo(index);
1275
1283
  }, [
1276
1284
  api
1277
1285
  ]);
1278
1286
  const onInit = useCallback((api)=>{
1279
- if (!api) return;
1280
1287
  setScrollSnaps(api.scrollSnapList());
1281
1288
  }, []);
1282
1289
  const onSelect = useCallback((api)=>{
1283
- if (!api) return;
1284
1290
  setSelectedIndex(api.selectedScrollSnap());
1285
1291
  }, []);
1286
1292
  useEffect(()=>{
1287
- if (!api) return;
1288
1293
  onInit(api);
1289
1294
  onSelect(api);
1290
1295
  api.on('reInit', onInit).on('reInit', onSelect).on('select', onSelect);
1296
+ return ()=>{
1297
+ api.off('reInit', onInit).off('reInit', onSelect).off('select', onSelect);
1298
+ };
1291
1299
  }, [
1292
1300
  api,
1293
1301
  onInit,
@@ -1299,12 +1307,15 @@ const useLogic = (api)=>{
1299
1307
  onDotButtonClick
1300
1308
  };
1301
1309
  };
1302
- const Dots = ({ api, orientation })=>{
1310
+ const Dots = ({ className, ...props })=>{
1311
+ const { api, orientation } = useCarousel();
1303
1312
  const { selectedIndex, scrollSnaps, onDotButtonClick } = useLogic(api);
1304
1313
  return /*#__PURE__*/ jsx("div", {
1305
- className: styles_css_wrapper[orientation],
1314
+ className: clsx(wrapper[orientation], className),
1315
+ ...props,
1306
1316
  children: scrollSnaps.map((number, index)=>/*#__PURE__*/ jsx("button", {
1307
1317
  type: "button",
1318
+ "aria-label": "Carousel Dots",
1308
1319
  className: clsx(dotButton[orientation], {
1309
1320
  [styles_css_selected]: index === selectedIndex
1310
1321
  }),
@@ -1313,51 +1324,221 @@ const Dots = ({ api, orientation })=>{
1313
1324
  });
1314
1325
  };
1315
1326
  var Item_styles_css_item = 'style__1gif6yr0';
1316
- function Item_Item(props) {
1327
+ var styles_css_orientations = {
1328
+ horizontal: 'horizontal__1gif6yr1',
1329
+ vertical: 'vertical__1gif6yr2'
1330
+ };
1331
+ function Item_Item({ className, ...props }) {
1332
+ const { orientation = 'horizontal' } = useCarousel();
1317
1333
  return /*#__PURE__*/ jsx("div", {
1318
- className: Item_styles_css_item,
1319
- role: "presentation",
1334
+ className: clsx(Item_styles_css_item, styles_css_orientations[orientation], className),
1335
+ role: "group",
1320
1336
  "aria-roledescription": "slide",
1337
+ "data-orientation": orientation,
1321
1338
  "data-slot": "carousel-item",
1322
1339
  ...props
1323
1340
  });
1324
1341
  }
1325
1342
  var styles_css_rootClass = 'Carousel__1jbydv50';
1326
- const useLogic_useLogic = ({ orientation = 'horizontal', opts, setApi, plugins, data, showDots, showArrows })=>{
1327
- const [carouselRef, api] = embla_carousel_react({
1328
- ...opts,
1329
- axis: 'horizontal' === orientation ? 'x' : 'y'
1330
- }, plugins);
1343
+ const useLogic_useLogic = ({ orientation = 'horizontal', align = 'center', setApi })=>{
1344
+ const resolvedOrientation = orientation;
1345
+ const resolvedAlign = align;
1346
+ const viewportRef = useRef(null);
1347
+ const resizeObserverRef = useRef(null);
1348
+ const mutationObserverRef = useRef(null);
1349
+ const observedSlidesRef = useRef([]);
1350
+ const orientationRef = useRef(resolvedOrientation);
1351
+ const alignRef = useRef(resolvedAlign);
1352
+ const selectedIndexRef = useRef(0);
1353
+ const canScrollPrevRef = useRef(false);
1354
+ const canScrollNextRef = useRef(false);
1355
+ const scrollSnapsRef = useRef([]);
1356
+ const listenersRef = useRef({
1357
+ reInit: new Set(),
1358
+ select: new Set()
1359
+ });
1331
1360
  const [canScrollPrev, setCanScrollPrev] = useState(false);
1332
1361
  const [canScrollNext, setCanScrollNext] = useState(false);
1333
- const isShowButtons = Boolean(showArrows && data.length > 1);
1334
- const isShowDots = Boolean(showDots && data.length > 1);
1335
- const onSelect = useCallback((api)=>{
1336
- if (!api) return;
1337
- setCanScrollPrev(api.canScrollPrev());
1338
- setCanScrollNext(api.canScrollNext());
1362
+ const getSlides = useCallback(()=>{
1363
+ if (!viewportRef.current) return [];
1364
+ return Array.from(viewportRef.current.querySelectorAll('[data-slot="carousel-item"]'));
1339
1365
  }, []);
1340
- const onDotButtonClick = useCallback((index)=>{
1341
- if (!api) return;
1342
- api.scrollTo(index);
1366
+ const getTargetFor = useCallback((index)=>{
1367
+ const viewport = viewportRef.current;
1368
+ if (!viewport) return 0;
1369
+ const slide = getSlides()[index];
1370
+ if (!slide) return 0;
1371
+ const isHorizontal = 'horizontal' === orientationRef.current;
1372
+ const viewportSize = isHorizontal ? viewport.clientWidth : viewport.clientHeight;
1373
+ const slideSize = isHorizontal ? slide.offsetWidth : slide.offsetHeight;
1374
+ const slideStart = isHorizontal ? slide.offsetLeft : slide.offsetTop;
1375
+ let target = slideStart;
1376
+ if ('center' === alignRef.current) target = slideStart - (viewportSize - slideSize) / 2;
1377
+ else if ('end' === alignRef.current) target = slideStart - (viewportSize - slideSize);
1378
+ const max = isHorizontal ? viewport.scrollWidth - viewport.clientWidth : viewport.scrollHeight - viewport.clientHeight;
1379
+ return Math.max(0, Math.min(target, Math.max(0, max)));
1343
1380
  }, [
1344
- api
1381
+ getSlides
1382
+ ]);
1383
+ const emit = useCallback((event, api)=>{
1384
+ for (const callback of listenersRef.current[event])callback(api);
1385
+ }, []);
1386
+ const rebindSlideObservers = useCallback(()=>{
1387
+ const resizeObserver = resizeObserverRef.current;
1388
+ if (!resizeObserver) return;
1389
+ for (const slide of observedSlidesRef.current)resizeObserver.unobserve(slide);
1390
+ observedSlidesRef.current = getSlides();
1391
+ for (const slide of observedSlidesRef.current)resizeObserver.observe(slide);
1392
+ }, [
1393
+ getSlides
1394
+ ]);
1395
+ const api = useMemo(()=>{
1396
+ const carouselApi = {
1397
+ scrollPrev: ()=>{
1398
+ carouselApi.scrollTo(Math.max(0, selectedIndexRef.current - 1));
1399
+ },
1400
+ scrollNext: ()=>{
1401
+ const lastIndex = getSlides().length - 1;
1402
+ if (lastIndex < 0) return;
1403
+ carouselApi.scrollTo(Math.min(lastIndex, selectedIndexRef.current + 1));
1404
+ },
1405
+ scrollTo: (index, jump = false)=>{
1406
+ const viewport = viewportRef.current;
1407
+ if (!viewport) return;
1408
+ const target = getTargetFor(index);
1409
+ viewport.scrollTo('horizontal' === orientationRef.current ? {
1410
+ left: target,
1411
+ behavior: jump ? 'auto' : 'smooth'
1412
+ } : {
1413
+ top: target,
1414
+ behavior: jump ? 'auto' : 'smooth'
1415
+ });
1416
+ },
1417
+ canScrollNext: ()=>canScrollNextRef.current,
1418
+ canScrollPrev: ()=>canScrollPrevRef.current,
1419
+ selectedScrollSnap: ()=>selectedIndexRef.current,
1420
+ scrollSnapList: ()=>scrollSnapsRef.current,
1421
+ on: (event, callback)=>{
1422
+ listenersRef.current[event].add(callback);
1423
+ return carouselApi;
1424
+ },
1425
+ off: (event, callback)=>{
1426
+ listenersRef.current[event].delete(callback);
1427
+ return carouselApi;
1428
+ },
1429
+ reInit: ()=>{
1430
+ rebindSlideObservers();
1431
+ const slides = getSlides();
1432
+ scrollSnapsRef.current = slides.map((_, index)=>getTargetFor(index));
1433
+ emit('reInit', carouselApi);
1434
+ emit('select', carouselApi);
1435
+ }
1436
+ };
1437
+ return carouselApi;
1438
+ }, [
1439
+ emit,
1440
+ getSlides,
1441
+ getTargetFor,
1442
+ rebindSlideObservers
1443
+ ]);
1444
+ const refresh = useCallback(()=>{
1445
+ const viewport = viewportRef.current;
1446
+ const slides = getSlides();
1447
+ const scrollSnaps = slides.map((_, index)=>getTargetFor(index));
1448
+ scrollSnapsRef.current = scrollSnaps;
1449
+ if (!viewport || 0 === slides.length) {
1450
+ selectedIndexRef.current = 0;
1451
+ canScrollPrevRef.current = false;
1452
+ canScrollNextRef.current = false;
1453
+ setCanScrollPrev(false);
1454
+ setCanScrollNext(false);
1455
+ emit('select', api);
1456
+ return;
1457
+ }
1458
+ const scrollPosition = 'horizontal' === orientationRef.current ? viewport.scrollLeft : viewport.scrollTop;
1459
+ let nearestIndex = 0;
1460
+ let nearestDistance = 1 / 0;
1461
+ for(let index = 0; index < scrollSnaps.length; index += 1){
1462
+ const distance = Math.abs(scrollSnaps[index] - scrollPosition);
1463
+ if (distance < nearestDistance) {
1464
+ nearestDistance = distance;
1465
+ nearestIndex = index;
1466
+ }
1467
+ }
1468
+ selectedIndexRef.current = nearestIndex;
1469
+ canScrollPrevRef.current = nearestIndex > 0;
1470
+ canScrollNextRef.current = nearestIndex < slides.length - 1;
1471
+ setCanScrollPrev(canScrollPrevRef.current);
1472
+ setCanScrollNext(canScrollNextRef.current);
1473
+ emit('select', api);
1474
+ }, [
1475
+ api,
1476
+ emit,
1477
+ getSlides,
1478
+ getTargetFor
1479
+ ]);
1480
+ const handleScroll = useCallback(()=>{
1481
+ refresh();
1482
+ }, [
1483
+ refresh
1484
+ ]);
1485
+ const detachViewport = useCallback(()=>{
1486
+ if (viewportRef.current) viewportRef.current.removeEventListener('scroll', handleScroll);
1487
+ resizeObserverRef.current?.disconnect();
1488
+ mutationObserverRef.current?.disconnect();
1489
+ resizeObserverRef.current = null;
1490
+ mutationObserverRef.current = null;
1491
+ observedSlidesRef.current = [];
1492
+ }, [
1493
+ handleScroll
1494
+ ]);
1495
+ const carouselRef = useCallback((node)=>{
1496
+ if (viewportRef.current === node) return;
1497
+ detachViewport();
1498
+ viewportRef.current = node;
1499
+ if (!node) return void refresh();
1500
+ node.addEventListener('scroll', handleScroll, {
1501
+ passive: true
1502
+ });
1503
+ if ("u" > typeof ResizeObserver) {
1504
+ resizeObserverRef.current = new ResizeObserver(refresh);
1505
+ resizeObserverRef.current.observe(node);
1506
+ }
1507
+ if ("u" > typeof MutationObserver) {
1508
+ mutationObserverRef.current = new MutationObserver(()=>{
1509
+ rebindSlideObservers();
1510
+ refresh();
1511
+ api.reInit();
1512
+ });
1513
+ mutationObserverRef.current.observe(node, {
1514
+ childList: true,
1515
+ subtree: false
1516
+ });
1517
+ }
1518
+ rebindSlideObservers();
1519
+ refresh();
1520
+ }, [
1521
+ api,
1522
+ detachViewport,
1523
+ handleScroll,
1524
+ rebindSlideObservers,
1525
+ refresh
1345
1526
  ]);
1346
1527
  const scrollPrev = useCallback(()=>{
1347
- api?.scrollPrev();
1528
+ api.scrollPrev();
1348
1529
  }, [
1349
1530
  api
1350
1531
  ]);
1351
1532
  const scrollNext = useCallback(()=>{
1352
- api?.scrollNext();
1533
+ api.scrollNext();
1353
1534
  }, [
1354
1535
  api
1355
1536
  ]);
1356
1537
  const handleKeyDown = useCallback((event)=>{
1357
- if ('ArrowLeft' === event.key) {
1538
+ if ('ArrowLeft' === event.key || 'ArrowUp' === event.key) {
1358
1539
  event.preventDefault();
1359
1540
  scrollPrev();
1360
- } else if ('ArrowRight' === event.key) {
1541
+ } else if ('ArrowRight' === event.key || 'ArrowDown' === event.key) {
1361
1542
  event.preventDefault();
1362
1543
  scrollNext();
1363
1544
  }
@@ -1366,23 +1547,25 @@ const useLogic_useLogic = ({ orientation = 'horizontal', opts, setApi, plugins,
1366
1547
  scrollNext
1367
1548
  ]);
1368
1549
  useEffect(()=>{
1369
- if (!api || !setApi) return;
1370
- setApi(api);
1550
+ orientationRef.current = resolvedOrientation;
1551
+ alignRef.current = resolvedAlign;
1552
+ refresh();
1553
+ api.reInit();
1371
1554
  }, [
1372
1555
  api,
1373
- setApi
1556
+ refresh,
1557
+ resolvedAlign,
1558
+ resolvedOrientation
1374
1559
  ]);
1375
1560
  useEffect(()=>{
1376
- if (!api) return;
1377
- onSelect(api);
1378
- api.on('reInit', onSelect);
1379
- api.on('select', onSelect);
1380
- return ()=>{
1381
- api?.off('select', onSelect);
1382
- };
1561
+ setApi?.(api);
1562
+ return ()=>setApi?.(void 0);
1383
1563
  }, [
1384
1564
  api,
1385
- onSelect
1565
+ setApi
1566
+ ]);
1567
+ useEffect(()=>()=>detachViewport(), [
1568
+ detachViewport
1386
1569
  ]);
1387
1570
  return {
1388
1571
  carouselRef,
@@ -1392,54 +1575,38 @@ const useLogic_useLogic = ({ orientation = 'horizontal', opts, setApi, plugins,
1392
1575
  canScrollPrev,
1393
1576
  canScrollNext,
1394
1577
  handleKeyDown,
1395
- opts,
1396
- orientation,
1397
- onDotButtonClick,
1398
- isShowButtons,
1399
- isShowDots,
1400
- data
1578
+ orientation
1401
1579
  };
1402
1580
  };
1403
- function Carousel({ width = '100%', height = '100%', ...props }) {
1404
- const { canScrollNext, canScrollPrev, scrollNext, scrollPrev, api, opts, orientation, carouselRef, handleKeyDown, data, isShowButtons, isShowDots } = useLogic_useLogic(props);
1581
+ function Carousel({ align, children, className, orientation: orientationProp, setApi, ...props }) {
1582
+ const { canScrollNext, canScrollPrev, scrollNext, scrollPrev, api, orientation, carouselRef, handleKeyDown } = useLogic_useLogic({
1583
+ align,
1584
+ orientation: orientationProp,
1585
+ setApi
1586
+ });
1405
1587
  return /*#__PURE__*/ jsx(CarouselContext.Provider, {
1406
1588
  value: {
1407
1589
  carouselRef,
1408
1590
  api,
1409
- opts,
1410
- orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),
1591
+ orientation,
1411
1592
  scrollPrev,
1412
1593
  scrollNext,
1413
1594
  canScrollPrev,
1414
1595
  canScrollNext
1415
1596
  },
1416
- children: /*#__PURE__*/ jsxs("div", {
1597
+ children: /*#__PURE__*/ jsx("section", {
1417
1598
  onKeyDownCapture: handleKeyDown,
1418
- className: clsx(styles_css_rootClass, props.className),
1599
+ className: clsx(styles_css_rootClass, className),
1419
1600
  "data-slot": "carousel",
1420
- style: {
1421
- width,
1422
- height
1423
- },
1424
- children: [
1425
- /*#__PURE__*/ jsx(Content_Content, {
1426
- style: {
1427
- width,
1428
- height
1429
- },
1430
- children: data.map((item)=>/*#__PURE__*/ jsx(Item_Item, {
1431
- children: props.renderItem(item)
1432
- }, `${item[props.keyId]}`))
1433
- }),
1434
- isShowButtons && /*#__PURE__*/ jsx(Buttons, {}),
1435
- isShowDots && /*#__PURE__*/ jsx(Dots, {
1436
- api: api,
1437
- orientation: orientation
1438
- })
1439
- ]
1601
+ ...props,
1602
+ children: children
1440
1603
  })
1441
1604
  });
1442
1605
  }
1606
+ Carousel.Content = Content_Content;
1607
+ Carousel.Item = Item_Item;
1608
+ Carousel.Arrows = Arrows;
1609
+ Carousel.Dots = Dots;
1443
1610
  var checkbox_css_icon = 'style__b7yo4k2';
1444
1611
  var indicator = 'style__b7yo4k1';
1445
1612
  var checkbox_css_root = 'style__b7yo4k0';
@@ -1587,11 +1754,11 @@ var sizes = {
1587
1754
  medium: 'medium__1o97kvm2',
1588
1755
  large: 'large__1o97kvm3'
1589
1756
  };
1590
- var Image_styles_css_wrapper = 'style__1o97kvm0';
1757
+ var styles_css_wrapper = 'style__1o97kvm0';
1591
1758
  const Image_Image = (props)=>/*#__PURE__*/ jsx("img", {
1592
1759
  alt: props.alt,
1593
1760
  src: props.src,
1594
- className: clsx_0(Image_styles_css_wrapper, sizes[props.size || 'medium'], props.className),
1761
+ className: clsx_0(styles_css_wrapper, sizes[props.size || 'medium'], props.className),
1595
1762
  width: props.width,
1596
1763
  height: props.height
1597
1764
  });
@@ -3021,7 +3188,7 @@ var Drawer_styles_css_footer = 'style__ccss508';
3021
3188
  var Drawer_styles_css_header = 'style__ccss507';
3022
3189
  var Drawer_styles_css_overlay = 'style__ccss502';
3023
3190
  var Drawer_styles_css_title = 'style__ccss509';
3024
- var viewport = 'style__ccss503';
3191
+ var styles_css_viewport = 'style__ccss503';
3025
3192
  const Drawer_Drawer = ({ children, trigger, className, title, description = '', footer, closeButton, swipeDirection = 'down', ...props })=>/*#__PURE__*/ jsxs(Drawer.Root, {
3026
3193
  swipeDirection: swipeDirection,
3027
3194
  ...props,
@@ -3038,7 +3205,7 @@ const Drawer_Drawer = ({ children, trigger, className, title, description = '',
3038
3205
  className: Drawer_styles_css_overlay
3039
3206
  }),
3040
3207
  /*#__PURE__*/ jsx(Drawer.Viewport, {
3041
- className: viewport,
3208
+ className: styles_css_viewport,
3042
3209
  children: /*#__PURE__*/ jsx(Drawer.Popup, {
3043
3210
  "data-slot": "drawer-content",
3044
3211
  className: clsx('group/drawer-content', Drawer_styles_css_content, className),
@@ -3150,7 +3317,7 @@ var carouselInner = 'style__a5l83v1';
3150
3317
  var ImageCarousel_styles_css_image = 'style__a5l83v3';
3151
3318
  var styles_css_indicator = 'style__a5l83v8';
3152
3319
  var indicators = 'style__a5l83v7';
3153
- var slide = 'style__a5l83v2';
3320
+ var styles_css_slide = 'style__a5l83v2';
3154
3321
  const ImageCarousel = ({ images = [], autoPlay = false, interval = 5000 })=>{
3155
3322
  const [currentIndex, setCurrentIndex] = useState(0);
3156
3323
  const goToPrevious = ()=>{
@@ -3186,7 +3353,7 @@ const ImageCarousel = ({ images = [], autoPlay = false, interval = 5000 })=>{
3186
3353
  transform: `translateX(-${100 * currentIndex}%)`
3187
3354
  },
3188
3355
  children: images.map((image, index)=>/*#__PURE__*/ jsx("div", {
3189
- className: slide,
3356
+ className: styles_css_slide,
3190
3357
  children: /*#__PURE__*/ jsx("img", {
3191
3358
  src: image.src,
3192
3359
  alt: image.alt || `Slide ${index + 1}`,
@@ -3750,13 +3917,13 @@ function YearsDropdown({ year, onSelect, minDate, maxDate }) {
3750
3917
  onValueChange: onChange,
3751
3918
  value: year.toString(),
3752
3919
  children: [
3753
- /*#__PURE__*/ jsx(SelectTrigger, {
3754
- children: /*#__PURE__*/ jsx(SelectValue, {
3920
+ /*#__PURE__*/ jsx(Select_Select.Trigger, {
3921
+ children: /*#__PURE__*/ jsx(Select_Select.Value, {
3755
3922
  placeholder: year.toString()
3756
3923
  })
3757
3924
  }),
3758
- /*#__PURE__*/ jsx(SelectContent, {
3759
- children: years.map((value)=>/*#__PURE__*/ jsx(SelectItem, {
3925
+ /*#__PURE__*/ jsx(Select_Select.Content, {
3926
+ children: years.map((value)=>/*#__PURE__*/ jsx(Select_Select.Item, {
3760
3927
  value: value.toString(),
3761
3928
  children: /*#__PURE__*/ jsx(Typography, {
3762
3929
  align: "center",
@@ -4107,44 +4274,57 @@ function ScrollTopButton({ onClick, variant = 'outline', ...props }) {
4107
4274
  children: /*#__PURE__*/ jsx(ChevronUp, {})
4108
4275
  });
4109
4276
  }
4110
- var chevron = 'style__5ilg7of';
4111
- var Select_styles_css_content = 'style__5ilg7o8';
4112
- var Select_styles_css_icon = 'style__5ilg7oe';
4113
- var Select_styles_css_item = 'style__5ilg7ob';
4114
- var itemIndicatorWrapper = 'style__5ilg7oc';
4115
- var Select_styles_css_label = 'style__5ilg7oa';
4116
- var Select_styles_css_positioner = 'style__5ilg7o7';
4117
- var scrollButton = 'style__5ilg7o6';
4118
- var Select_styles_css_separator = 'style__5ilg7od';
4119
- var Select_styles_css_sizes = {
4120
- small: 'small__5ilg7o3',
4121
- medium: 'medium__5ilg7o4',
4122
- large: 'large__5ilg7o5'
4123
- };
4277
+ var chevron = 'style__5ilg7oc';
4278
+ var Select_styles_css_content = 'style__5ilg7o5';
4279
+ var Select_styles_css_icon = 'style__5ilg7ob';
4280
+ var Select_styles_css_item = 'style__5ilg7o8';
4281
+ var itemIndicatorWrapper = 'style__5ilg7o9';
4282
+ var Select_styles_css_label = 'style__5ilg7o7';
4283
+ var Select_styles_css_positioner = 'style__5ilg7o4';
4284
+ var scrollButton = 'style__5ilg7o3';
4285
+ var Select_styles_css_separator = 'style__5ilg7oa';
4124
4286
  var Select_styles_css_trigger = 'style__5ilg7o2';
4125
- var styles_css_viewport = 'style__5ilg7o9';
4126
- const Select_Select = ({ onValueChange, ...props })=>/*#__PURE__*/ jsx(Select.Root, {
4287
+ var Select_styles_css_viewport = 'style__5ilg7o6';
4288
+ function Select_Select({ onValueChange, ...props }) {
4289
+ return /*#__PURE__*/ jsx(Select.Root, {
4290
+ "data-slot": "select",
4127
4291
  ...props,
4128
4292
  onValueChange: (value, eventDetails)=>{
4129
4293
  if (null !== value) onValueChange?.(value, eventDetails);
4130
4294
  }
4131
4295
  });
4132
- const SelectGroup = Select.Group;
4133
- const SelectValue = Select.Value;
4134
- const SelectTrigger = ({ className, children, size = 'medium', ...props })=>/*#__PURE__*/ jsxs(Select.Trigger, {
4296
+ }
4297
+ function Select_Group({ ...props }) {
4298
+ return /*#__PURE__*/ jsx(Select.Group, {
4299
+ "data-slot": "select-group",
4300
+ ...props
4301
+ });
4302
+ }
4303
+ function Select_Value({ ...props }) {
4304
+ return /*#__PURE__*/ jsx(Select.Value, {
4305
+ "data-slot": "select-value",
4306
+ ...props
4307
+ });
4308
+ }
4309
+ function Select_Trigger({ className, children, size = 'medium', ...props }) {
4310
+ return /*#__PURE__*/ jsxs(Select.Trigger, {
4135
4311
  "data-slot": "select-trigger",
4136
- className: clsx(Select_styles_css_trigger, Select_styles_css_sizes[size], className),
4312
+ "data-size": size,
4313
+ className: clsx(Select_styles_css_trigger, className),
4137
4314
  ...props,
4138
4315
  children: [
4139
4316
  children,
4140
4317
  /*#__PURE__*/ jsx(Select.Icon, {
4318
+ "data-slot": "select-icon",
4141
4319
  render: /*#__PURE__*/ jsx(ChevronDown, {
4142
4320
  className: chevron
4143
4321
  })
4144
4322
  })
4145
4323
  ]
4146
4324
  });
4147
- const SelectScrollUpButton = ({ className, ...props })=>/*#__PURE__*/ jsx(Select.ScrollUpArrow, {
4325
+ }
4326
+ function ScrollUpButton({ className, ...props }) {
4327
+ return /*#__PURE__*/ jsx(Select.ScrollUpArrow, {
4148
4328
  "data-slot": "select-scroll-up-button",
4149
4329
  className: clsx(scrollButton, className),
4150
4330
  ...props,
@@ -4152,7 +4332,9 @@ const SelectScrollUpButton = ({ className, ...props })=>/*#__PURE__*/ jsx(Select
4152
4332
  className: Select_styles_css_icon
4153
4333
  })
4154
4334
  });
4155
- const SelectScrollDownButton = ({ className, ...props })=>/*#__PURE__*/ jsx(Select.ScrollDownArrow, {
4335
+ }
4336
+ function ScrollDownButton({ className, ...props }) {
4337
+ return /*#__PURE__*/ jsx(Select.ScrollDownArrow, {
4156
4338
  "data-slot": "select-scroll-down-button",
4157
4339
  className: clsx(scrollButton, className),
4158
4340
  ...props,
@@ -4160,8 +4342,12 @@ const SelectScrollDownButton = ({ className, ...props })=>/*#__PURE__*/ jsx(Sele
4160
4342
  className: Select_styles_css_icon
4161
4343
  })
4162
4344
  });
4163
- const SelectContent = ({ className, children, side = 'bottom', sideOffset = 4, align = 'center', alignOffset = 0, alignItemWithTrigger, position = 'popper', ...props })=>/*#__PURE__*/ jsx(Select.Portal, {
4345
+ }
4346
+ function Select_Content({ className, children, side = 'bottom', sideOffset = 4, align = 'center', alignOffset = 0, alignItemWithTrigger, position = 'popper', ...props }) {
4347
+ return /*#__PURE__*/ jsx(Select.Portal, {
4348
+ "data-slot": "select-portal",
4164
4349
  children: /*#__PURE__*/ jsx(Select.Positioner, {
4350
+ "data-slot": "select-positioner",
4165
4351
  side: side,
4166
4352
  sideOffset: sideOffset,
4167
4353
  align: align,
@@ -4173,42 +4359,61 @@ const SelectContent = ({ className, children, side = 'bottom', sideOffset = 4, a
4173
4359
  className: clsx(Select_styles_css_content, className),
4174
4360
  ...props,
4175
4361
  children: [
4176
- /*#__PURE__*/ jsx(SelectScrollUpButton, {}),
4362
+ /*#__PURE__*/ jsx(ScrollUpButton, {}),
4177
4363
  /*#__PURE__*/ jsx(Select.List, {
4178
- className: styles_css_viewport,
4364
+ "data-slot": "select-list",
4365
+ className: Select_styles_css_viewport,
4179
4366
  children: children
4180
4367
  }),
4181
- /*#__PURE__*/ jsx(SelectScrollDownButton, {})
4368
+ /*#__PURE__*/ jsx(ScrollDownButton, {})
4182
4369
  ]
4183
4370
  })
4184
4371
  })
4185
4372
  });
4186
- const SelectLabel = ({ className, ...props })=>/*#__PURE__*/ jsx(Select.GroupLabel, {
4373
+ }
4374
+ function Select_Label({ className, ...props }) {
4375
+ return /*#__PURE__*/ jsx(Select.GroupLabel, {
4187
4376
  "data-slot": "select-label",
4188
4377
  className: clsx(Select_styles_css_label, className),
4189
4378
  ...props
4190
4379
  });
4191
- const SelectItem = ({ className, children, ...props })=>/*#__PURE__*/ jsxs(Select.Item, {
4380
+ }
4381
+ function Select_Item({ className, children, ...props }) {
4382
+ return /*#__PURE__*/ jsxs(Select.Item, {
4192
4383
  "data-slot": "select-item",
4193
4384
  className: clsx(Select_styles_css_item, className),
4194
4385
  ...props,
4195
4386
  children: [
4196
4387
  /*#__PURE__*/ jsx(Select.ItemIndicator, {
4388
+ "data-slot": "select-item-indicator",
4197
4389
  className: itemIndicatorWrapper,
4198
4390
  children: /*#__PURE__*/ jsx(Check, {
4199
4391
  className: Select_styles_css_icon
4200
4392
  })
4201
4393
  }),
4202
4394
  /*#__PURE__*/ jsx(Select.ItemText, {
4395
+ "data-slot": "select-item-text",
4203
4396
  children: children
4204
4397
  })
4205
4398
  ]
4206
4399
  });
4207
- const SelectSeparator = ({ className, ...props })=>/*#__PURE__*/ jsx(Select.Separator, {
4400
+ }
4401
+ function Select_Separator({ className, ...props }) {
4402
+ return /*#__PURE__*/ jsx(Select.Separator, {
4208
4403
  "data-slot": "select-separator",
4209
4404
  className: clsx(Select_styles_css_separator, className),
4210
4405
  ...props
4211
4406
  });
4407
+ }
4408
+ Select_Select.Trigger = Select_Trigger;
4409
+ Select_Select.Value = Select_Value;
4410
+ Select_Select.Content = Select_Content;
4411
+ Select_Select.Group = Select_Group;
4412
+ Select_Select.Label = Select_Label;
4413
+ Select_Select.Item = Select_Item;
4414
+ Select_Select.ScrollDownButton = ScrollDownButton;
4415
+ Select_Select.ScrollUpButton = ScrollUpButton;
4416
+ Select_Select.Separator = Select_Separator;
4212
4417
  var Sheet_styles_css_closeButton = 'style__5dkj2fc';
4213
4418
  var styles_css_closeText = 'style__5dkj2fd';
4214
4419
  var Sheet_styles_css_content = 'style__5dkj2fb';
@@ -4856,4 +5061,4 @@ const ToggleGroup = ({ value, onChange, options, size, className, label, multipl
4856
5061
  ]
4857
5062
  });
4858
5063
  };
4859
- export { Accordion_Accordion as Accordion, AlertDialog_AlertDialog as AlertDialog, Autocomplete, Avatar_Avatar as Avatar, Badge_Badge as Badge, Breadcrumb, ButtonGroup, Button_Button as Button, Button_buttonSizes as buttonSizes, Button_buttonVariants as buttonVariants, Calendar, Card, Carousel, Checkbox_Checkbox as Checkbox, CircularProgress, Collapsible_Collapsible as Collapsible, Combobox_Combobox as Combobox, ConfirmAction, ContentState, CopyTypography, DEFAULT_SEPARATOR, DEFAULT_SYMBOL, DESCRIPTION_ROOT_CLASSNAME, DashboardLayout, DataGrid, DataGridActionCell, DataGridSortHeader, DataList, DatePicker, Description_Description as Description, Dialog_Dialog as Dialog, Drawer_Drawer as Drawer, DropdownMenu, Empty_Empty as Empty, ImageCarousel, Image_Image as Image, InputGroup, InputOTP, Input_Input as Input, Label, MaskField, NOTIFICATION_POSITIONS, NOTIFY_CLASSNAME, Notification, NotificationContainer, OverflowTypography, PageLayout, Pagination, PeriodPicker, Placeholder, Popover_Popover as Popover, RadioGroupItem, RadioGroup_RadioGroup as RadioGroup, RangeInput, ScrollTopButton, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Select_Select as Select, Sheet, Sidebar_Sidebar as Sidebar, Slider_Slider as Slider, Tabs_Tabs as Tabs, TextField, Textarea_Textarea as Textarea, ToggleGroup, Tooltip_Tooltip as Tooltip, Typography, alignments, badgeVariants, calculateSize, constants_NotificationVariantTypes as NotificationVariantTypes, createHandle, displays, negativeSpacing, notification, spacing, styles_css_colors as colors, styles_css_variants as variants, theme, transforms, useComboboxAnchor, useDashboard, useIsMobile, useOverflowed, useSidebar, weights };
5064
+ export { Accordion_Accordion as Accordion, AlertDialog_AlertDialog as AlertDialog, Autocomplete, Avatar_Avatar as Avatar, Badge_Badge as Badge, Breadcrumb, ButtonGroup, Button_Button as Button, Button_buttonSizes as buttonSizes, Button_buttonVariants as buttonVariants, Calendar, Card, Carousel, Checkbox_Checkbox as Checkbox, CircularProgress, Collapsible_Collapsible as Collapsible, Combobox_Combobox as Combobox, ConfirmAction, ContentState, CopyTypography, DEFAULT_SEPARATOR, DEFAULT_SYMBOL, DESCRIPTION_ROOT_CLASSNAME, DashboardLayout, DataGrid, DataGridActionCell, DataGridSortHeader, DataList, DatePicker, Description_Description as Description, Dialog_Dialog as Dialog, Drawer_Drawer as Drawer, DropdownMenu, Empty_Empty as Empty, ImageCarousel, Image_Image as Image, InputGroup, InputOTP, Input_Input as Input, Label, MaskField, NOTIFICATION_POSITIONS, NOTIFY_CLASSNAME, Notification, NotificationContainer, OverflowTypography, PageLayout, Pagination, PeriodPicker, Placeholder, Popover_Popover as Popover, RadioGroupItem, RadioGroup_RadioGroup as RadioGroup, RangeInput, ScrollTopButton, Select_Select as Select, Sheet, Sidebar_Sidebar as Sidebar, Slider_Slider as Slider, Tabs_Tabs as Tabs, TextField, Textarea_Textarea as Textarea, ToggleGroup, Tooltip_Tooltip as Tooltip, Typography, alignments, badgeVariants, calculateSize, constants_NotificationVariantTypes as NotificationVariantTypes, createHandle, displays, negativeSpacing, notification, spacing, styles_css_colors as colors, styles_css_variants as variants, theme, transforms, useComboboxAnchor, useDashboard, useIsMobile, useOverflowed, useSidebar, weights };