@nori-ui/core 1.7.0 → 1.9.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.
- package/dist/chunk-BOMPFNM4.js +165 -0
- package/dist/chunk-BOMPFNM4.js.map +1 -0
- package/dist/chunk-BVLOX4A3.js +256 -0
- package/dist/chunk-BVLOX4A3.js.map +1 -0
- package/dist/{chunk-PLQPBMG2.js → chunk-BXZGCOKT.js} +2 -2
- package/dist/{chunk-PLQPBMG2.js.map → chunk-BXZGCOKT.js.map} +1 -1
- package/dist/{chunk-RI4Y2C5U.js → chunk-KLK7OMFT.js} +3 -3
- package/dist/{chunk-RI4Y2C5U.js.map → chunk-KLK7OMFT.js.map} +1 -1
- package/dist/chunk-OHWRTHGL.js +495 -0
- package/dist/chunk-OHWRTHGL.js.map +1 -0
- package/dist/{chunk-V5QSMDZL.js → chunk-QB6RH6UU.js} +3 -3
- package/dist/{chunk-V5QSMDZL.js.map → chunk-QB6RH6UU.js.map} +1 -1
- package/dist/chunk-S763GTIZ.js +350 -0
- package/dist/chunk-S763GTIZ.js.map +1 -0
- package/dist/chunk-UJRVWGK7.js +3 -0
- package/dist/chunk-UJRVWGK7.js.map +1 -0
- package/dist/chunk-VFUV6XJR.js +257 -0
- package/dist/chunk-VFUV6XJR.js.map +1 -0
- package/dist/client.cjs +2860 -1386
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +5 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.js +23 -17
- package/dist/client.js.map +1 -1
- package/dist/components/Accordion/index.js +2 -2
- package/dist/components/Carousel/index.cjs +297 -0
- package/dist/components/Carousel/index.cjs.map +1 -0
- package/dist/components/Carousel/index.d.cts +67 -0
- package/dist/components/Carousel/index.d.ts +67 -0
- package/dist/components/Carousel/index.js +5 -0
- package/dist/components/Carousel/index.js.map +1 -0
- package/dist/components/Command/index.cjs +1371 -0
- package/dist/components/Command/index.cjs.map +1 -0
- package/dist/components/Command/index.d.cts +89 -0
- package/dist/components/Command/index.d.ts +89 -0
- package/dist/components/Command/index.js +11 -0
- package/dist/components/Command/index.js.map +1 -0
- package/dist/components/Dialog/index.js +2 -1
- package/dist/components/HoverCard/index.cjs +894 -0
- package/dist/components/HoverCard/index.cjs.map +1 -0
- package/dist/components/HoverCard/index.d.cts +66 -0
- package/dist/components/HoverCard/index.d.ts +66 -0
- package/dist/components/HoverCard/index.js +9 -0
- package/dist/components/HoverCard/index.js.map +1 -0
- package/dist/components/InputOTP/index.cjs +580 -0
- package/dist/components/InputOTP/index.cjs.map +1 -0
- package/dist/components/InputOTP/index.d.cts +49 -0
- package/dist/components/InputOTP/index.d.ts +49 -0
- package/dist/components/InputOTP/index.js +7 -0
- package/dist/components/InputOTP/index.js.map +1 -0
- package/dist/components/Sidebar/index.cjs +675 -0
- package/dist/components/Sidebar/index.cjs.map +1 -0
- package/dist/components/Sidebar/index.d.cts +109 -0
- package/dist/components/Sidebar/index.d.ts +109 -0
- package/dist/components/Sidebar/index.js +7 -0
- package/dist/components/Sidebar/index.js.map +1 -0
- package/dist/components/Switch/index.js +2 -2
- package/dist/index.cjs +2860 -1386
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +23 -17
- package/package.json +1 -1
package/dist/client.d.cts
CHANGED
|
@@ -18,9 +18,11 @@ export { Button, ButtonProps, ButtonSize, ButtonVariant } from './components/But
|
|
|
18
18
|
export { ButtonGroup, ButtonGroupOrientation, ButtonGroupProps, ButtonGroupSize } from './components/ButtonGroup/index.cjs';
|
|
19
19
|
export { Calendar, CalendarBehavior, CalendarCaption, CalendarCaptionProps, CalendarChangeMeta, CalendarMode, CalendarProps, CalendarValue, CalendarView, CaptionContextValue, CaptionOption, DateRange, DayContext, useCalendarCaption } from './components/Calendar/index.cjs';
|
|
20
20
|
export { Card, CardProps, CardSectionProps, CardTextProps } from './components/Card/index.cjs';
|
|
21
|
+
export { Carousel, CarouselButtonProps, CarouselContentProps, CarouselDotsProps, CarouselItemProps, CarouselProps } from './components/Carousel/index.cjs';
|
|
21
22
|
export { Checkbox, CheckboxProps } from './components/Checkbox/index.cjs';
|
|
22
23
|
export { Collapsible, CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps } from './components/Collapsible/index.cjs';
|
|
23
24
|
export { Combobox } from './components/Combobox/index.cjs';
|
|
25
|
+
export { Command, CommandDialogProps, CommandEmptyProps, CommandGroupProps, CommandItemProps, CommandProps, CommandShortcutProps, CommandTriggerProps, useCommandContext } from './components/Command/index.cjs';
|
|
24
26
|
export { ContextMenu, ContextMenuContentProps, ContextMenuProps, ContextMenuTriggerProps } from './components/ContextMenu/index.cjs';
|
|
25
27
|
export { Column, DataTable, DataTableProps, SortDirection, SortState } from './components/DataTable/index.cjs';
|
|
26
28
|
export { DatePicker, DatePickerProps, DatePickerRangeProps, DateRangeValue } from './components/DatePicker/index.cjs';
|
|
@@ -29,8 +31,10 @@ export { DropdownMenu, DropdownMenuContentProps, DropdownMenuProps, DropdownMenu
|
|
|
29
31
|
export { Empty, EmptyProps } from './components/Empty/index.cjs';
|
|
30
32
|
export { Field, FieldGroupProps, FieldProps } from './components/Field/index.cjs';
|
|
31
33
|
export { FloatButton, FloatButtonBackToTopProps, FloatButtonBadge, FloatButtonGroupDirection, FloatButtonGroupProps, FloatButtonGroupTrigger, FloatButtonPlacement, FloatButtonProps, FloatButtonShape, FloatButtonSize, FloatButtonVariant } from './components/FloatButton/index.cjs';
|
|
34
|
+
export { HoverCard, HoverCardContentProps, HoverCardProps, HoverCardTriggerProps } from './components/HoverCard/index.cjs';
|
|
32
35
|
export { HStack, HStackProps, StackAlign, StackGap, StackJustify } from './components/HStack/index.cjs';
|
|
33
36
|
export { InputGroup, InputGroupAddonProps, InputGroupInputProps, InputGroupProps } from './components/InputGroup/index.cjs';
|
|
37
|
+
export { InputOTP, InputOTPPattern, InputOTPProps } from './components/InputOTP/index.cjs';
|
|
34
38
|
export { Item, ItemProps } from './components/Item/index.cjs';
|
|
35
39
|
export { Kbd, KbdProps } from './components/Kbd/index.cjs';
|
|
36
40
|
export { Label, LabelProps } from './components/Label/index.cjs';
|
|
@@ -42,6 +46,7 @@ export { SegmentedControl, SegmentedControlOption, SegmentedControlProps, Segmen
|
|
|
42
46
|
export { LoadOptionsParams, LoadOptionsResult, Select, SelectOption, SelectProps, SelectRenderOptionInfo } from './components/Select/index.cjs';
|
|
43
47
|
export { Separator, SeparatorOrientation, SeparatorProps } from './components/Separator/index.cjs';
|
|
44
48
|
export { Drawer, Sheet, SheetBody, SheetBodyProps, SheetClose, SheetCloseProps, SheetDescription, SheetDescriptionProps, SheetFooter, SheetFooterProps, SheetHeader, SheetHeaderProps, SheetPanel, SheetPanelProps, SheetProps, SheetSide, SheetSize, SheetTitle, SheetTitleProps, SheetTrigger, SheetTriggerProps } from './components/Sheet/index.cjs';
|
|
49
|
+
export { Sidebar, SidebarContentProps, SidebarFooterProps, SidebarGroupLabelProps, SidebarGroupProps, SidebarHeaderProps, SidebarMenuItemProps, SidebarMenuProps, SidebarProps, SidebarSide, SidebarVariant, useSidebarContext } from './components/Sidebar/index.cjs';
|
|
45
50
|
export { Skeleton, SkeletonProps } from './components/Skeleton/index.cjs';
|
|
46
51
|
export { Slider, SliderDirection, SliderGestureProvider, SliderOrientation, SliderProps, useSliderInteractionActive } from './components/Slider/index.cjs';
|
|
47
52
|
export { Spinner, SpinnerProps, SpinnerSize } from './components/Spinner/index.cjs';
|
package/dist/client.d.ts
CHANGED
|
@@ -18,9 +18,11 @@ export { Button, ButtonProps, ButtonSize, ButtonVariant } from './components/But
|
|
|
18
18
|
export { ButtonGroup, ButtonGroupOrientation, ButtonGroupProps, ButtonGroupSize } from './components/ButtonGroup/index.js';
|
|
19
19
|
export { Calendar, CalendarBehavior, CalendarCaption, CalendarCaptionProps, CalendarChangeMeta, CalendarMode, CalendarProps, CalendarValue, CalendarView, CaptionContextValue, CaptionOption, DateRange, DayContext, useCalendarCaption } from './components/Calendar/index.js';
|
|
20
20
|
export { Card, CardProps, CardSectionProps, CardTextProps } from './components/Card/index.js';
|
|
21
|
+
export { Carousel, CarouselButtonProps, CarouselContentProps, CarouselDotsProps, CarouselItemProps, CarouselProps } from './components/Carousel/index.js';
|
|
21
22
|
export { Checkbox, CheckboxProps } from './components/Checkbox/index.js';
|
|
22
23
|
export { Collapsible, CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps } from './components/Collapsible/index.js';
|
|
23
24
|
export { Combobox } from './components/Combobox/index.js';
|
|
25
|
+
export { Command, CommandDialogProps, CommandEmptyProps, CommandGroupProps, CommandItemProps, CommandProps, CommandShortcutProps, CommandTriggerProps, useCommandContext } from './components/Command/index.js';
|
|
24
26
|
export { ContextMenu, ContextMenuContentProps, ContextMenuProps, ContextMenuTriggerProps } from './components/ContextMenu/index.js';
|
|
25
27
|
export { Column, DataTable, DataTableProps, SortDirection, SortState } from './components/DataTable/index.js';
|
|
26
28
|
export { DatePicker, DatePickerProps, DatePickerRangeProps, DateRangeValue } from './components/DatePicker/index.js';
|
|
@@ -29,8 +31,10 @@ export { DropdownMenu, DropdownMenuContentProps, DropdownMenuProps, DropdownMenu
|
|
|
29
31
|
export { Empty, EmptyProps } from './components/Empty/index.js';
|
|
30
32
|
export { Field, FieldGroupProps, FieldProps } from './components/Field/index.js';
|
|
31
33
|
export { FloatButton, FloatButtonBackToTopProps, FloatButtonBadge, FloatButtonGroupDirection, FloatButtonGroupProps, FloatButtonGroupTrigger, FloatButtonPlacement, FloatButtonProps, FloatButtonShape, FloatButtonSize, FloatButtonVariant } from './components/FloatButton/index.js';
|
|
34
|
+
export { HoverCard, HoverCardContentProps, HoverCardProps, HoverCardTriggerProps } from './components/HoverCard/index.js';
|
|
32
35
|
export { HStack, HStackProps, StackAlign, StackGap, StackJustify } from './components/HStack/index.js';
|
|
33
36
|
export { InputGroup, InputGroupAddonProps, InputGroupInputProps, InputGroupProps } from './components/InputGroup/index.js';
|
|
37
|
+
export { InputOTP, InputOTPPattern, InputOTPProps } from './components/InputOTP/index.js';
|
|
34
38
|
export { Item, ItemProps } from './components/Item/index.js';
|
|
35
39
|
export { Kbd, KbdProps } from './components/Kbd/index.js';
|
|
36
40
|
export { Label, LabelProps } from './components/Label/index.js';
|
|
@@ -42,6 +46,7 @@ export { SegmentedControl, SegmentedControlOption, SegmentedControlProps, Segmen
|
|
|
42
46
|
export { LoadOptionsParams, LoadOptionsResult, Select, SelectOption, SelectProps, SelectRenderOptionInfo } from './components/Select/index.js';
|
|
43
47
|
export { Separator, SeparatorOrientation, SeparatorProps } from './components/Separator/index.js';
|
|
44
48
|
export { Drawer, Sheet, SheetBody, SheetBodyProps, SheetClose, SheetCloseProps, SheetDescription, SheetDescriptionProps, SheetFooter, SheetFooterProps, SheetHeader, SheetHeaderProps, SheetPanel, SheetPanelProps, SheetProps, SheetSide, SheetSize, SheetTitle, SheetTitleProps, SheetTrigger, SheetTriggerProps } from './components/Sheet/index.js';
|
|
49
|
+
export { Sidebar, SidebarContentProps, SidebarFooterProps, SidebarGroupLabelProps, SidebarGroupProps, SidebarHeaderProps, SidebarMenuItemProps, SidebarMenuProps, SidebarProps, SidebarSide, SidebarVariant, useSidebarContext } from './components/Sidebar/index.js';
|
|
45
50
|
export { Skeleton, SkeletonProps } from './components/Skeleton/index.js';
|
|
46
51
|
export { Slider, SliderDirection, SliderGestureProvider, SliderOrientation, SliderProps, useSliderInteractionActive } from './components/Slider/index.js';
|
|
47
52
|
export { Spinner, SpinnerProps, SpinnerSize } from './components/Spinner/index.js';
|
package/dist/client.js
CHANGED
|
@@ -1,41 +1,47 @@
|
|
|
1
1
|
import './chunk-BRCCWMGJ.js';
|
|
2
|
-
export { Toggle } from './chunk-STX5UKYT.js';
|
|
3
|
-
export { Tooltip } from './chunk-VL2WNGPF.js';
|
|
4
|
-
export { VStack } from './chunk-L6VYDM7S.js';
|
|
5
2
|
export { blueTheme, orangeTheme, presetThemes, roseTheme, slateTheme, tealTheme, useTheme, violetTheme } from './chunk-MDOZGILD.js';
|
|
6
3
|
import './chunk-QI6646JZ.js';
|
|
7
4
|
export { Icon } from './chunk-33S7ADWM.js';
|
|
8
|
-
export { Switch } from './chunk-RI4Y2C5U.js';
|
|
9
|
-
import './chunk-VP7DRJUZ.js';
|
|
10
5
|
export { Tabs } from './chunk-EN4CLDGZ.js';
|
|
11
6
|
export { TextArea } from './chunk-USFXANEU.js';
|
|
12
7
|
export { TextInput } from './chunk-V75O7QQO.js';
|
|
13
8
|
export { Toaster, toast } from './chunk-LWLK6HSW.js';
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
9
|
+
export { Toggle } from './chunk-STX5UKYT.js';
|
|
10
|
+
export { Tooltip } from './chunk-VL2WNGPF.js';
|
|
11
|
+
export { VStack } from './chunk-L6VYDM7S.js';
|
|
17
12
|
export { Separator } from './chunk-2XJCLPNH.js';
|
|
18
13
|
export { Drawer, Sheet, SheetBody, SheetClose, SheetDescription, SheetFooter, SheetHeader, SheetPanel, SheetTitle, SheetTrigger } from './chunk-SF6WPUC5.js';
|
|
14
|
+
export { Sidebar, useSidebarContext } from './chunk-S763GTIZ.js';
|
|
19
15
|
export { Skeleton } from './chunk-3IIIHZHT.js';
|
|
20
16
|
export { Slider, SliderGestureProvider, useSliderInteractionActive } from './chunk-7FSFJA33.js';
|
|
17
|
+
export { Switch } from './chunk-KLK7OMFT.js';
|
|
18
|
+
import './chunk-VP7DRJUZ.js';
|
|
19
|
+
export { Kbd } from './chunk-IGBXSBF7.js';
|
|
20
|
+
export { Label } from './chunk-3CEJ5TB4.js';
|
|
21
|
+
export { PAGINATION_COMPACT_BREAKPOINT, Pagination } from './chunk-3B345SQU.js';
|
|
22
|
+
export { Progress } from './chunk-OELY6K44.js';
|
|
23
|
+
export { Radio } from './chunk-UKDDK42K.js';
|
|
24
|
+
export { SegmentedControl } from './chunk-F5UKI7XD.js';
|
|
25
|
+
export { Empty } from './chunk-XQNVWHMN.js';
|
|
26
|
+
export { Field } from './chunk-CPIKN4BX.js';
|
|
21
27
|
export { FloatButton } from './chunk-PJXVLE24.js';
|
|
22
28
|
export { HStack } from './chunk-OIHX5B4R.js';
|
|
29
|
+
export { HoverCard } from './chunk-BOMPFNM4.js';
|
|
23
30
|
export { InputGroup } from './chunk-C5HQPXRI.js';
|
|
31
|
+
export { InputOTP } from './chunk-BVLOX4A3.js';
|
|
24
32
|
export { Item } from './chunk-J5LK2XHE.js';
|
|
25
|
-
export {
|
|
26
|
-
export { Label } from './chunk-3CEJ5TB4.js';
|
|
27
|
-
export { PAGINATION_COMPACT_BREAKPOINT, Pagination } from './chunk-3B345SQU.js';
|
|
33
|
+
export { Collapsible } from './chunk-M4BI63P6.js';
|
|
28
34
|
export { Combobox } from './chunk-IIVTPN62.js';
|
|
35
|
+
export { Command, useCommandContext } from './chunk-OHWRTHGL.js';
|
|
29
36
|
export { ContextMenu } from './chunk-TSWPHJIU.js';
|
|
30
37
|
export { DataTable } from './chunk-C32XGHWO.js';
|
|
31
38
|
export { Table } from './chunk-5YHT252H.js';
|
|
32
39
|
export { usePagination } from './chunk-73CUV7MW.js';
|
|
33
40
|
export { DatePicker } from './chunk-O6M3F7BZ.js';
|
|
34
|
-
|
|
41
|
+
import './chunk-UJRVWGK7.js';
|
|
42
|
+
export { Dialog } from './chunk-BXZGCOKT.js';
|
|
35
43
|
import './chunk-2PESUXE3.js';
|
|
36
44
|
export { DropdownMenu, MenuContent, MenuItem, MenuLabel, MenuSeparator } from './chunk-MK57AOTI.js';
|
|
37
|
-
export { Empty } from './chunk-XQNVWHMN.js';
|
|
38
|
-
export { Field } from './chunk-CPIKN4BX.js';
|
|
39
45
|
export { Box } from './chunk-IWM2XDXH.js';
|
|
40
46
|
import './chunk-VLZANXRZ.js';
|
|
41
47
|
export { Text } from './chunk-ZGFXKYA5.js';
|
|
@@ -52,12 +58,12 @@ import { I18nProvider } from './chunk-GJMHNEQ3.js';
|
|
|
52
58
|
export { I18nProvider, useTranslation } from './chunk-GJMHNEQ3.js';
|
|
53
59
|
export { defaultDictionary, resolveI18n } from './chunk-4UFAZLSZ.js';
|
|
54
60
|
export { Card } from './chunk-PQW5LKAI.js';
|
|
61
|
+
export { Carousel } from './chunk-VFUV6XJR.js';
|
|
55
62
|
import { SemanticIconsProvider } from './chunk-H2LHWJ52.js';
|
|
56
63
|
export { Checkbox, SemanticIconsProvider, useSemanticIcon } from './chunk-H2LHWJ52.js';
|
|
57
|
-
export {
|
|
58
|
-
export { Accordion } from './chunk-V5QSMDZL.js';
|
|
59
|
-
import './chunk-RB3YBWQ4.js';
|
|
64
|
+
export { Accordion } from './chunk-QB6RH6UU.js';
|
|
60
65
|
import './chunk-RGJ3NBKE.js';
|
|
66
|
+
import './chunk-RB3YBWQ4.js';
|
|
61
67
|
export { Alert } from './chunk-3W3XYULK.js';
|
|
62
68
|
export { defaultSemanticIcons } from './chunk-7Z4NMNX6.js';
|
|
63
69
|
export { AlertDialog } from './chunk-U2ZKY2CP.js';
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/provider/nori-provider.tsx"],"names":["theme"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/provider/nori-provider.tsx"],"names":["theme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDO,SAAS,YAAA,CAAa,EAAE,KAAA,EAAAA,MAAAA,EAAO,aAAa,IAAA,EAAM,KAAA,EAAO,MAAA,EAAQ,QAAA,EAAS,EAAsB;AAGnG,EAAA,MAAM,aAAaA,MAAAA,KAAU,MAAA,GAAY,EAAC,GAAI,EAAE,OAAAA,MAAAA,EAAM;AACtD,EAAA,MAAM,YAAY,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,EAAE,IAAA,EAAK;AACnD,EAAA,MAAM,aAAa,KAAA,KAAU,MAAA,GAAY,EAAC,GAAI,EAAE,KAAA,EAAM;AACtD,EAAA,MAAM,cAAc,MAAA,KAAW,MAAA,GAAY,EAAC,GAAI,EAAE,MAAA,EAAO;AAEzD,EAAA,MAAM,KAAA,uBACD,cAAA,EAAA,EAAgB,GAAG,aAChB,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAe,GAAG,UAAA,EACf,QAAA,kBAAA,GAAA,CAAC,gBAAc,GAAG,SAAA,EACd,8BAAC,qBAAA,EAAA,EAAuB,GAAG,YAAa,QAAA,EAAS,CAAA,EACrD,GACJ,CAAA,EACJ,CAAA;AAGJ,EAAA,OAAO,gBAAgB,MAAA,GAAY,KAAA,uBAAS,mBAAA,EAAA,EAAoB,KAAA,EAAO,aAAc,QAAA,EAAA,KAAA,EAAM,CAAA;AAC/F;AAnBgB,MAAA,CAAA,YAAA,EAAA,cAAA,CAAA","file":"client.js","sourcesContent":["'use client';\n\nimport type { Theme } from '@nori-ui/tokens';\nimport type { ReactNode } from 'react';\nimport { I18nProvider } from '../i18n/context';\nimport { type LocaleInput, LocaleProvider } from '../i18n/locale';\nimport type { I18nInput } from '../i18n/types';\nimport type { SemanticIcons } from '../icons/default-semantic-icons';\nimport { SemanticIconsProvider } from '../icons/semantic-context';\nimport { type NoriTheme, ThemeProvider } from '../theme/context';\nimport { type ColorScheme, ColorSchemeProvider } from '../theme/use-color-scheme';\n\nexport type NoriProviderProps = {\n /**\n * Theme to apply to descendants. Pass:\n * - a `NoriTheme` (`{ light, dark }`) — covers both schemes\n * - a single `Theme` — used for both schemes (rare)\n * - one of the bundled presets: `tealTheme`, `blueTheme`, `roseTheme`,\n * `violetTheme`, `orangeTheme`, `slateTheme` (from `@nori-ui/core`)\n * - omit — falls back to the default Nori palette (teal)\n */\n theme?: NoriTheme | Theme;\n /**\n * Force a color scheme for descendants, overriding the OS signal. Use\n * when an app shell is hard-coded to one scheme (e.g. forced-dark\n * editorial chrome) and wants library components inside it to render\n * against the matching half of the theme.\n *\n * Omit to track the OS Appearance (native) / `<html>` `dark` class (web).\n */\n colorScheme?: ColorScheme;\n i18n?: I18nInput;\n icons?: Partial<SemanticIcons>;\n /**\n * BCP 47 locale tag (or `Intl.Locale`) used by locale-aware components\n * (Calendar, Number/Currency formatting, RelativeTime). Defaults to\n * the runtime's resolved locale (`new Intl.DateTimeFormat().resolvedOptions().locale`),\n * which mirrors what other `Intl` calls in the consumer's code use.\n */\n locale?: LocaleInput;\n children?: ReactNode;\n};\n\n/**\n * Single root provider composing theme, i18n, and semantic-icons contexts.\n * Place near the root of your app. Only needed to override defaults — the\n * library works out of the box without any provider.\n */\nexport function NoriProvider({ theme, colorScheme, i18n, icons, locale, children }: NoriProviderProps) {\n // Conditionally spread each optional prop — `exactOptionalPropertyTypes: true`\n // rejects passing `undefined` to a prop typed as `T | missing`.\n const themeProps = theme === undefined ? {} : { theme };\n const i18nProps = i18n === undefined ? {} : { i18n };\n const iconsProps = icons === undefined ? {} : { icons };\n const localeProps = locale === undefined ? {} : { locale };\n\n const inner = (\n <LocaleProvider {...localeProps}>\n <ThemeProvider {...themeProps}>\n <I18nProvider {...i18nProps}>\n <SemanticIconsProvider {...iconsProps}>{children}</SemanticIconsProvider>\n </I18nProvider>\n </ThemeProvider>\n </LocaleProvider>\n );\n\n return colorScheme === undefined ? inner : <ColorSchemeProvider value={colorScheme}>{inner}</ColorSchemeProvider>;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { Accordion } from '../../chunk-
|
|
2
|
-
import '../../chunk-RB3YBWQ4.js';
|
|
1
|
+
export { Accordion } from '../../chunk-QB6RH6UU.js';
|
|
3
2
|
import '../../chunk-RGJ3NBKE.js';
|
|
3
|
+
import '../../chunk-RB3YBWQ4.js';
|
|
4
4
|
import '../../chunk-7Z4NMNX6.js';
|
|
5
5
|
import '../../chunk-5A2QOOVN.js';
|
|
6
6
|
import '../../chunk-R5JMDDCB.js';
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var jsxRuntime = require('nativewind/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
|
|
9
|
+
// src/utils/cn.ts
|
|
10
|
+
function cn(...inputs) {
|
|
11
|
+
const out = [];
|
|
12
|
+
for (const input of inputs) {
|
|
13
|
+
append(out, input);
|
|
14
|
+
}
|
|
15
|
+
return out.join(" ");
|
|
16
|
+
}
|
|
17
|
+
__name(cn, "cn");
|
|
18
|
+
function append(out, input) {
|
|
19
|
+
if (!input) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (typeof input === "string") {
|
|
23
|
+
if (input.length > 0) {
|
|
24
|
+
out.push(input);
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (typeof input === "number") {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (Array.isArray(input)) {
|
|
32
|
+
for (const inner of input) {
|
|
33
|
+
append(out, inner);
|
|
34
|
+
}
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (typeof input === "object") {
|
|
38
|
+
for (const key of Object.keys(input)) {
|
|
39
|
+
if (input[key]) {
|
|
40
|
+
out.push(key);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
__name(append, "append");
|
|
46
|
+
var CarouselContext = react.createContext(null);
|
|
47
|
+
function useCarouselContext(caller) {
|
|
48
|
+
const ctx = react.useContext(CarouselContext);
|
|
49
|
+
if (!ctx) {
|
|
50
|
+
throw new Error(`<${caller}> must be rendered inside <Carousel>.`);
|
|
51
|
+
}
|
|
52
|
+
return ctx;
|
|
53
|
+
}
|
|
54
|
+
__name(useCarouselContext, "useCarouselContext");
|
|
55
|
+
var CarouselRoot = /* @__PURE__ */ __name(({
|
|
56
|
+
index: controlledIndex,
|
|
57
|
+
defaultIndex = 0,
|
|
58
|
+
onIndexChange,
|
|
59
|
+
loop = false,
|
|
60
|
+
orientation = "horizontal",
|
|
61
|
+
children,
|
|
62
|
+
className,
|
|
63
|
+
testID
|
|
64
|
+
}) => {
|
|
65
|
+
const [inner, setInner] = react.useState(defaultIndex);
|
|
66
|
+
const isControlled = controlledIndex !== void 0;
|
|
67
|
+
const index = isControlled ? controlledIndex : inner;
|
|
68
|
+
const [count, setCount] = react.useState(0);
|
|
69
|
+
const listRef = react.useRef(null);
|
|
70
|
+
const id = react.useId();
|
|
71
|
+
const setIndex = react.useCallback(
|
|
72
|
+
(next2) => {
|
|
73
|
+
if (!isControlled) {
|
|
74
|
+
setInner(next2);
|
|
75
|
+
}
|
|
76
|
+
onIndexChange?.(next2);
|
|
77
|
+
},
|
|
78
|
+
[isControlled, onIndexChange]
|
|
79
|
+
);
|
|
80
|
+
const scrollTo = react.useCallback(
|
|
81
|
+
(idx) => {
|
|
82
|
+
const list = listRef.current;
|
|
83
|
+
if (!list) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const item = list.children[idx];
|
|
87
|
+
if (!item) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
item.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
91
|
+
setIndex(idx);
|
|
92
|
+
},
|
|
93
|
+
[setIndex]
|
|
94
|
+
);
|
|
95
|
+
const next = react.useCallback(() => {
|
|
96
|
+
if (count === 0) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (index < count - 1) {
|
|
100
|
+
scrollTo(index + 1);
|
|
101
|
+
} else if (loop) {
|
|
102
|
+
scrollTo(0);
|
|
103
|
+
}
|
|
104
|
+
}, [index, count, loop, scrollTo]);
|
|
105
|
+
const prev = react.useCallback(() => {
|
|
106
|
+
if (count === 0) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (index > 0) {
|
|
110
|
+
scrollTo(index - 1);
|
|
111
|
+
} else if (loop) {
|
|
112
|
+
scrollTo(count - 1);
|
|
113
|
+
}
|
|
114
|
+
}, [index, count, loop, scrollTo]);
|
|
115
|
+
react.useEffect(() => {
|
|
116
|
+
const list = listRef.current;
|
|
117
|
+
if (!list) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const handleScroll = /* @__PURE__ */ __name(() => {
|
|
121
|
+
const { scrollLeft, scrollTop, offsetWidth, offsetHeight } = list;
|
|
122
|
+
const pos = orientation === "horizontal" ? scrollLeft : scrollTop;
|
|
123
|
+
const size = orientation === "horizontal" ? offsetWidth : offsetHeight;
|
|
124
|
+
if (size === 0) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const newIdx = Math.round(pos / size);
|
|
128
|
+
if (newIdx !== index) {
|
|
129
|
+
setIndex(newIdx);
|
|
130
|
+
}
|
|
131
|
+
}, "handleScroll");
|
|
132
|
+
list.addEventListener("scroll", handleScroll, { passive: true });
|
|
133
|
+
return () => list.removeEventListener("scroll", handleScroll);
|
|
134
|
+
}, [orientation, index, setIndex]);
|
|
135
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
136
|
+
CarouselContext.Provider,
|
|
137
|
+
{
|
|
138
|
+
value: { index, count, loop, orientation, scrollTo, next, prev, listRef, setCount, id },
|
|
139
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
140
|
+
"section",
|
|
141
|
+
{
|
|
142
|
+
"aria-label": testID ?? "Carousel",
|
|
143
|
+
className: cn("relative overflow-hidden", className),
|
|
144
|
+
"data-testid": testID,
|
|
145
|
+
children
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
}, "CarouselRoot");
|
|
151
|
+
var CarouselContent = /* @__PURE__ */ __name(({ children, className, testID }) => {
|
|
152
|
+
const ctx = useCarouselContext("Carousel.Content");
|
|
153
|
+
const childCount = react.Children.count(children);
|
|
154
|
+
react.useEffect(() => {
|
|
155
|
+
ctx.setCount(childCount);
|
|
156
|
+
}, [childCount, ctx.setCount]);
|
|
157
|
+
const isHorizontal = ctx.orientation === "horizontal";
|
|
158
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
159
|
+
"div",
|
|
160
|
+
{
|
|
161
|
+
ref: ctx.listRef,
|
|
162
|
+
"data-testid": testID,
|
|
163
|
+
className: cn(
|
|
164
|
+
"flex",
|
|
165
|
+
isHorizontal ? "flex-row overflow-x-auto overflow-y-hidden" : "flex-col overflow-y-auto overflow-x-hidden",
|
|
166
|
+
className
|
|
167
|
+
),
|
|
168
|
+
style: {
|
|
169
|
+
scrollSnapType: isHorizontal ? "x mandatory" : "y mandatory",
|
|
170
|
+
scrollBehavior: "smooth",
|
|
171
|
+
WebkitOverflowScrolling: "touch",
|
|
172
|
+
// Hide scrollbar
|
|
173
|
+
scrollbarWidth: "none",
|
|
174
|
+
msOverflowStyle: "none"
|
|
175
|
+
},
|
|
176
|
+
children
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}, "CarouselContent");
|
|
180
|
+
var CarouselItem = /* @__PURE__ */ __name(({ children, className, testID }) => {
|
|
181
|
+
const ctx = useCarouselContext("Carousel.Item");
|
|
182
|
+
const isHorizontal = ctx.orientation === "horizontal";
|
|
183
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
"data-testid": testID,
|
|
187
|
+
className: cn("shrink-0", isHorizontal ? "w-full" : "h-full", className),
|
|
188
|
+
style: {
|
|
189
|
+
scrollSnapAlign: "start",
|
|
190
|
+
minWidth: isHorizontal ? "100%" : void 0,
|
|
191
|
+
minHeight: !isHorizontal ? "100%" : void 0
|
|
192
|
+
},
|
|
193
|
+
children
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
}, "CarouselItem");
|
|
197
|
+
var CarouselPrevious = /* @__PURE__ */ __name(({ className, testID, children }) => {
|
|
198
|
+
const ctx = useCarouselContext("Carousel.Previous");
|
|
199
|
+
const disabled = !ctx.loop && ctx.index === 0;
|
|
200
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
201
|
+
"button",
|
|
202
|
+
{
|
|
203
|
+
type: "button",
|
|
204
|
+
"aria-label": "Previous slide",
|
|
205
|
+
disabled,
|
|
206
|
+
"data-testid": testID,
|
|
207
|
+
onClick: ctx.prev,
|
|
208
|
+
className: cn(
|
|
209
|
+
"absolute left-2 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full bg-white/80 shadow hover:bg-white disabled:opacity-40",
|
|
210
|
+
className
|
|
211
|
+
),
|
|
212
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
213
|
+
"svg",
|
|
214
|
+
{
|
|
215
|
+
viewBox: "0 0 24 24",
|
|
216
|
+
fill: "none",
|
|
217
|
+
stroke: "currentColor",
|
|
218
|
+
strokeWidth: 2,
|
|
219
|
+
className: "h-4 w-4",
|
|
220
|
+
"aria-hidden": "true",
|
|
221
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 18l-6-6 6-6", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
}, "CarouselPrevious");
|
|
227
|
+
var CarouselNext = /* @__PURE__ */ __name(({ className, testID, children }) => {
|
|
228
|
+
const ctx = useCarouselContext("Carousel.Next");
|
|
229
|
+
const disabled = !ctx.loop && ctx.index >= ctx.count - 1;
|
|
230
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
231
|
+
"button",
|
|
232
|
+
{
|
|
233
|
+
type: "button",
|
|
234
|
+
"aria-label": "Next slide",
|
|
235
|
+
disabled,
|
|
236
|
+
"data-testid": testID,
|
|
237
|
+
onClick: ctx.next,
|
|
238
|
+
className: cn(
|
|
239
|
+
"absolute right-2 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full bg-white/80 shadow hover:bg-white disabled:opacity-40",
|
|
240
|
+
className
|
|
241
|
+
),
|
|
242
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
243
|
+
"svg",
|
|
244
|
+
{
|
|
245
|
+
viewBox: "0 0 24 24",
|
|
246
|
+
fill: "none",
|
|
247
|
+
stroke: "currentColor",
|
|
248
|
+
strokeWidth: 2,
|
|
249
|
+
className: "h-4 w-4",
|
|
250
|
+
"aria-hidden": "true",
|
|
251
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 18l6-6-6-6", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
}, "CarouselNext");
|
|
257
|
+
var CarouselDots = /* @__PURE__ */ __name(({ className, testID }) => {
|
|
258
|
+
const ctx = useCarouselContext("Carousel.Dots");
|
|
259
|
+
if (ctx.count === 0) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
263
|
+
"div",
|
|
264
|
+
{
|
|
265
|
+
role: "tablist",
|
|
266
|
+
"aria-label": "Slide navigation",
|
|
267
|
+
"data-testid": testID,
|
|
268
|
+
className: cn("absolute bottom-3 left-0 right-0 flex items-center justify-center gap-1.5", className),
|
|
269
|
+
children: Array.from({ length: ctx.count }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
270
|
+
"button",
|
|
271
|
+
{
|
|
272
|
+
type: "button",
|
|
273
|
+
role: "tab",
|
|
274
|
+
"aria-selected": i === ctx.index,
|
|
275
|
+
"aria-label": `Go to slide ${i + 1}`,
|
|
276
|
+
onClick: () => ctx.scrollTo(i),
|
|
277
|
+
className: cn(
|
|
278
|
+
"h-1.5 w-1.5 rounded-full transition-all",
|
|
279
|
+
i === ctx.index ? "w-3 bg-white" : "bg-white/50 hover:bg-white/75"
|
|
280
|
+
)
|
|
281
|
+
},
|
|
282
|
+
i
|
|
283
|
+
))
|
|
284
|
+
}
|
|
285
|
+
);
|
|
286
|
+
}, "CarouselDots");
|
|
287
|
+
var Carousel = Object.assign(CarouselRoot, {
|
|
288
|
+
Content: CarouselContent,
|
|
289
|
+
Item: CarouselItem,
|
|
290
|
+
Previous: CarouselPrevious,
|
|
291
|
+
Next: CarouselNext,
|
|
292
|
+
Dots: CarouselDots
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
exports.Carousel = Carousel;
|
|
296
|
+
//# sourceMappingURL=index.cjs.map
|
|
297
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/cn.ts","../../../src/components/Carousel/Carousel.web.tsx"],"names":["createContext","useContext","useState","useRef","useId","useCallback","next","useEffect","jsx","Children"],"mappings":";;;;;;;;;AAeO,SAAS,MAAM,MAAA,EAA8B;AAChD,EAAA,MAAM,MAAgB,EAAC;AACvB,EAAA,KAAA,MAAW,SAAS,MAAA,EAAQ;AACxB,IAAA,MAAA,CAAO,KAAK,KAAK,CAAA;AAAA,EACrB;AACA,EAAA,OAAO,GAAA,CAAI,KAAK,GAAG,CAAA;AACvB;AANgB,MAAA,CAAA,EAAA,EAAA,IAAA,CAAA;AAQhB,SAAS,MAAA,CAAO,KAAe,KAAA,EAAyB;AACpD,EAAA,IAAI,CAAC,KAAA,EAAO;AACR,IAAA;AAAA,EACJ;AACA,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC3B,IAAA,IAAI,KAAA,CAAM,SAAS,CAAA,EAAG;AAClB,MAAA,GAAA,CAAI,KAAK,KAAK,CAAA;AAAA,IAClB;AACA,IAAA;AAAA,EACJ;AACA,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC3B,IAAA;AAAA,EACJ;AACA,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACtB,IAAA,KAAA,MAAW,SAAS,KAAA,EAAO;AACvB,MAAA,MAAA,CAAO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AACV,CAAC","file":"index.cjs","sourcesContent":["// cn — class-name merger. clsx-compatible shape.\n//\n// Intentionally does NOT deduplicate Tailwind conflicts (e.g. \"text-sm text-lg\").\n// That's `tailwind-merge`'s job; we defer adding it until a component actually\n// needs it, to keep the core tree-shakable and the runtime zero-dep.\n\nexport type ClassInput =\n | string\n | number\n | boolean\n | null\n | undefined\n | ClassInput[]\n | Record<string, boolean | number | null | undefined>;\n\nexport function cn(...inputs: ClassInput[]): string {\n const out: string[] = [];\n for (const input of inputs) {\n append(out, input);\n }\n return out.join(' ');\n}\n\nfunction append(out: string[], input: ClassInput): void {\n if (!input) {\n return;\n }\n if (typeof input === 'string') {\n if (input.length > 0) {\n out.push(input);\n }\n return;\n }\n if (typeof input === 'number') {\n return; // numbers are never class names\n }\n if (Array.isArray(input)) {\n for (const inner of input) {\n append(out, inner);\n }\n return;\n }\n if (typeof input === 'object') {\n for (const key of Object.keys(input)) {\n if (input[key]) {\n out.push(key);\n }\n }\n }\n}\n","'use client';\n\nimport {\n Children,\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ntype CarouselContextValue = {\n index: number;\n count: number;\n loop: boolean;\n orientation: 'horizontal' | 'vertical';\n scrollTo: (idx: number) => void;\n next: () => void;\n prev: () => void;\n listRef: React.RefObject<HTMLDivElement | null>;\n setCount: (n: number) => void;\n id: string;\n};\n\nconst CarouselContext = createContext<CarouselContextValue | null>(null);\n\nfunction useCarouselContext(caller: string): CarouselContextValue {\n const ctx = useContext(CarouselContext);\n if (!ctx) {\n throw new Error(`<${caller}> must be rendered inside <Carousel>.`);\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Root\n// ---------------------------------------------------------------------------\n\nexport type CarouselProps = {\n /** Controlled current index. */\n index?: number;\n /** Initial index (uncontrolled). @defaultValue 0 */\n defaultIndex?: number;\n /** Fires with the new index. */\n onIndexChange?: (index: number) => void;\n /** Whether navigation wraps from last to first and vice-versa. @defaultValue false */\n loop?: boolean;\n /** Scroll axis. @defaultValue 'horizontal' */\n orientation?: 'horizontal' | 'vertical';\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\nconst CarouselRoot = ({\n index: controlledIndex,\n defaultIndex = 0,\n onIndexChange,\n loop = false,\n orientation = 'horizontal',\n children,\n className,\n testID,\n}: CarouselProps) => {\n const [inner, setInner] = useState(defaultIndex);\n const isControlled = controlledIndex !== undefined;\n const index = isControlled ? (controlledIndex as number) : inner;\n const [count, setCount] = useState(0);\n const listRef = useRef<HTMLDivElement | null>(null);\n const id = useId();\n\n const setIndex = useCallback(\n (next: number) => {\n if (!isControlled) {\n setInner(next);\n }\n onIndexChange?.(next);\n },\n [isControlled, onIndexChange]\n );\n\n const scrollTo = useCallback(\n (idx: number) => {\n const list = listRef.current;\n if (!list) {\n return;\n }\n const item = list.children[idx] as HTMLElement | undefined;\n if (!item) {\n return;\n }\n item.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' });\n setIndex(idx);\n },\n [setIndex]\n );\n\n const next = useCallback(() => {\n if (count === 0) {\n return;\n }\n if (index < count - 1) {\n scrollTo(index + 1);\n } else if (loop) {\n scrollTo(0);\n }\n }, [index, count, loop, scrollTo]);\n\n const prev = useCallback(() => {\n if (count === 0) {\n return;\n }\n if (index > 0) {\n scrollTo(index - 1);\n } else if (loop) {\n scrollTo(count - 1);\n }\n }, [index, count, loop, scrollTo]);\n\n // Keep index in sync if external scroll happens\n useEffect(() => {\n const list = listRef.current;\n if (!list) {\n return;\n }\n const handleScroll = () => {\n const { scrollLeft, scrollTop, offsetWidth, offsetHeight } = list;\n const pos = orientation === 'horizontal' ? scrollLeft : scrollTop;\n const size = orientation === 'horizontal' ? offsetWidth : offsetHeight;\n if (size === 0) {\n return;\n }\n const newIdx = Math.round(pos / size);\n if (newIdx !== index) {\n setIndex(newIdx);\n }\n };\n list.addEventListener('scroll', handleScroll, { passive: true });\n return () => list.removeEventListener('scroll', handleScroll);\n }, [orientation, index, setIndex]);\n\n return (\n <CarouselContext.Provider\n value={{ index, count, loop, orientation, scrollTo, next, prev, listRef, setCount, id }}\n >\n <section\n aria-label={testID ?? 'Carousel'}\n className={cn('relative overflow-hidden', className)}\n data-testid={testID}\n >\n {children}\n </section>\n </CarouselContext.Provider>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Content — the scroll container\n// ---------------------------------------------------------------------------\n\nexport type CarouselContentProps = {\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\nconst CarouselContent = ({ children, className, testID }: CarouselContentProps) => {\n const ctx = useCarouselContext('Carousel.Content');\n\n // Count items\n const childCount = Children.count(children);\n useEffect(() => {\n ctx.setCount(childCount);\n }, [childCount, ctx.setCount]);\n\n const isHorizontal = ctx.orientation === 'horizontal';\n\n return (\n <div\n ref={ctx.listRef}\n data-testid={testID}\n className={cn(\n 'flex',\n isHorizontal\n ? 'flex-row overflow-x-auto overflow-y-hidden'\n : 'flex-col overflow-y-auto overflow-x-hidden',\n className\n )}\n style={{\n scrollSnapType: isHorizontal ? 'x mandatory' : 'y mandatory',\n scrollBehavior: 'smooth',\n WebkitOverflowScrolling: 'touch',\n // Hide scrollbar\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n >\n {children}\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Item\n// ---------------------------------------------------------------------------\n\nexport type CarouselItemProps = {\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\nconst CarouselItem = ({ children, className, testID }: CarouselItemProps) => {\n const ctx = useCarouselContext('Carousel.Item');\n const isHorizontal = ctx.orientation === 'horizontal';\n return (\n <div\n data-testid={testID}\n className={cn('shrink-0', isHorizontal ? 'w-full' : 'h-full', className)}\n style={{\n scrollSnapAlign: 'start',\n minWidth: isHorizontal ? '100%' : undefined,\n minHeight: !isHorizontal ? '100%' : undefined,\n }}\n >\n {children}\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Previous / Next buttons\n// ---------------------------------------------------------------------------\n\nexport type CarouselButtonProps = {\n className?: string;\n testID?: string;\n children?: ReactNode;\n};\n\nconst CarouselPrevious = ({ className, testID, children }: CarouselButtonProps) => {\n const ctx = useCarouselContext('Carousel.Previous');\n const disabled = !ctx.loop && ctx.index === 0;\n return (\n <button\n type=\"button\"\n aria-label=\"Previous slide\"\n disabled={disabled}\n data-testid={testID}\n onClick={ctx.prev}\n className={cn(\n 'absolute left-2 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full bg-white/80 shadow hover:bg-white disabled:opacity-40',\n className\n )}\n >\n {children ?? (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n className=\"h-4 w-4\"\n aria-hidden=\"true\"\n >\n <path d=\"M15 18l-6-6 6-6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n )}\n </button>\n );\n};\n\nconst CarouselNext = ({ className, testID, children }: CarouselButtonProps) => {\n const ctx = useCarouselContext('Carousel.Next');\n const disabled = !ctx.loop && ctx.index >= ctx.count - 1;\n return (\n <button\n type=\"button\"\n aria-label=\"Next slide\"\n disabled={disabled}\n data-testid={testID}\n onClick={ctx.next}\n className={cn(\n 'absolute right-2 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full bg-white/80 shadow hover:bg-white disabled:opacity-40',\n className\n )}\n >\n {children ?? (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n className=\"h-4 w-4\"\n aria-hidden=\"true\"\n >\n <path d=\"M9 18l6-6-6-6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n )}\n </button>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Dots\n// ---------------------------------------------------------------------------\n\nexport type CarouselDotsProps = {\n className?: string;\n testID?: string;\n};\n\nconst CarouselDots = ({ className, testID }: CarouselDotsProps) => {\n const ctx = useCarouselContext('Carousel.Dots');\n if (ctx.count === 0) {\n return null;\n }\n return (\n <div\n role=\"tablist\"\n aria-label=\"Slide navigation\"\n data-testid={testID}\n className={cn('absolute bottom-3 left-0 right-0 flex items-center justify-center gap-1.5', className)}\n >\n {Array.from({ length: ctx.count }, (_, i) => (\n <button\n // biome-ignore lint/suspicious/noArrayIndexKey: dot index IS its stable identity\n key={i}\n type=\"button\"\n role=\"tab\"\n aria-selected={i === ctx.index}\n aria-label={`Go to slide ${i + 1}`}\n onClick={() => ctx.scrollTo(i)}\n className={cn(\n 'h-1.5 w-1.5 rounded-full transition-all',\n i === ctx.index ? 'w-3 bg-white' : 'bg-white/50 hover:bg-white/75'\n )}\n />\n ))}\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Public compound export\n// ---------------------------------------------------------------------------\n\n/**\n * Paged horizontal (or vertical) slider with CSS scroll-snap.\n *\n * Composition:\n * - `Carousel.Content` — the scroll container\n * - `Carousel.Item` — each slide\n * - `Carousel.Previous` / `Carousel.Next` — navigation buttons\n * - `Carousel.Dots` — dot pagination indicators\n *\n * ```tsx\n * <Carousel>\n * <Carousel.Content>\n * <Carousel.Item><img src=\"a.jpg\" /></Carousel.Item>\n * <Carousel.Item><img src=\"b.jpg\" /></Carousel.Item>\n * </Carousel.Content>\n * <Carousel.Previous />\n * <Carousel.Next />\n * <Carousel.Dots />\n * </Carousel>\n * ```\n */\nexport const Carousel = Object.assign(CarouselRoot, {\n Content: CarouselContent,\n Item: CarouselItem,\n Previous: CarouselPrevious,\n Next: CarouselNext,\n Dots: CarouselDots,\n});\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type CarouselProps = {
|
|
5
|
+
/** Controlled current index. */
|
|
6
|
+
index?: number;
|
|
7
|
+
/** Initial index (uncontrolled). @defaultValue 0 */
|
|
8
|
+
defaultIndex?: number;
|
|
9
|
+
/** Fires with the new index. */
|
|
10
|
+
onIndexChange?: (index: number) => void;
|
|
11
|
+
/** Whether navigation wraps from last to first and vice-versa. @defaultValue false */
|
|
12
|
+
loop?: boolean;
|
|
13
|
+
/** Scroll axis. @defaultValue 'horizontal' */
|
|
14
|
+
orientation?: 'horizontal' | 'vertical';
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
testID?: string;
|
|
18
|
+
};
|
|
19
|
+
type CarouselContentProps = {
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
className?: string;
|
|
22
|
+
testID?: string;
|
|
23
|
+
};
|
|
24
|
+
type CarouselItemProps = {
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
testID?: string;
|
|
28
|
+
};
|
|
29
|
+
type CarouselButtonProps = {
|
|
30
|
+
className?: string;
|
|
31
|
+
testID?: string;
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
};
|
|
34
|
+
type CarouselDotsProps = {
|
|
35
|
+
className?: string;
|
|
36
|
+
testID?: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Paged horizontal (or vertical) slider with CSS scroll-snap.
|
|
40
|
+
*
|
|
41
|
+
* Composition:
|
|
42
|
+
* - `Carousel.Content` — the scroll container
|
|
43
|
+
* - `Carousel.Item` — each slide
|
|
44
|
+
* - `Carousel.Previous` / `Carousel.Next` — navigation buttons
|
|
45
|
+
* - `Carousel.Dots` — dot pagination indicators
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <Carousel>
|
|
49
|
+
* <Carousel.Content>
|
|
50
|
+
* <Carousel.Item><img src="a.jpg" /></Carousel.Item>
|
|
51
|
+
* <Carousel.Item><img src="b.jpg" /></Carousel.Item>
|
|
52
|
+
* </Carousel.Content>
|
|
53
|
+
* <Carousel.Previous />
|
|
54
|
+
* <Carousel.Next />
|
|
55
|
+
* <Carousel.Dots />
|
|
56
|
+
* </Carousel>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare const Carousel: (({ index: controlledIndex, defaultIndex, onIndexChange, loop, orientation, children, className, testID, }: CarouselProps) => react_jsx_runtime.JSX.Element) & {
|
|
60
|
+
Content: ({ children, className, testID }: CarouselContentProps) => react_jsx_runtime.JSX.Element;
|
|
61
|
+
Item: ({ children, className, testID }: CarouselItemProps) => react_jsx_runtime.JSX.Element;
|
|
62
|
+
Previous: ({ className, testID, children }: CarouselButtonProps) => react_jsx_runtime.JSX.Element;
|
|
63
|
+
Next: ({ className, testID, children }: CarouselButtonProps) => react_jsx_runtime.JSX.Element;
|
|
64
|
+
Dots: ({ className, testID }: CarouselDotsProps) => react_jsx_runtime.JSX.Element | null;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export { Carousel, type CarouselButtonProps, type CarouselContentProps, type CarouselDotsProps, type CarouselItemProps, type CarouselProps };
|