@obosbbl/grunnmuren-react 3.2.1 → 3.3.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/index.d.mts +2 -2
- package/dist/index.mjs +28 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -745,5 +745,5 @@ type VideoLoopProps = {
|
|
|
745
745
|
};
|
|
746
746
|
declare const VideoLoop: ({ src, format, alt, className }: VideoLoopProps) => react_jsx_runtime.JSX.Element;
|
|
747
747
|
|
|
748
|
-
export { Accordion, AccordionItem, Alertbox, Avatar, Backlink, Badge, Breadcrumb, Breadcrumbs, Button, ButtonContext, Caption, Card, CardLink, Checkbox, CheckboxGroup, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, ListBoxSection as ComboboxSection, Content, ContentContext, DateFormatter, Description, Disclosure, DisclosureButton, DisclosurePanel, DisclosureStateContext, ErrorMessage, Footer, GrunnmurenProvider, Heading, HeadingContext, Label, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tag, TagGroup, TagList, TextArea, TextField, Carousel as UNSAFE_Carousel, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Link as UNSAFE_Link,
|
|
749
|
-
export type { AccordionItemProps, AccordionProps, Props as AlertboxProps, AvatarProps, BacklinkProps, BadgeProps, BreadcrumbProps, BreadcrumbsProps, ButtonProps, CaptionProps, CardLinkProps, CardProps, CheckboxGroupProps, CheckboxProps, ComboboxProps, ContentProps, DateFormatterProps, DescriptionProps, DisclosureButtonProps, DisclosurePanelProps, DisclosureProps, ErrorMessageProps, FooterProps, GrunnmurenProviderProps, HeadingProps, Locale, MediaProps, NumberFieldProps, RadioGroupProps, RadioProps, SelectProps, TagGroupProps, TagListProps, TagProps, TextAreaProps, TextFieldProps, CarouselItemProps as UNSAFE_CarouselItemProps, CarouselItemsProps as UNSAFE_CarouselItemsProps, CarouselProps as UNSAFE_CarouselProps, DialogProps as UNSAFE_DialogProps, DialogTriggerProps as UNSAFE_DialogTriggerProps, FileUploadProps as UNSAFE_FileUploadProps, HeroProps as UNSAFE_HeroProps,
|
|
748
|
+
export { Accordion, AccordionItem, Alertbox, Avatar, Backlink, Badge, Breadcrumb, Breadcrumbs, Button, ButtonContext, Caption, Card, CardLink, Checkbox, CheckboxGroup, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, ListBoxSection as ComboboxSection, Content, ContentContext, DateFormatter, Description, Disclosure, DisclosureButton, DisclosurePanel, DisclosureStateContext, ErrorMessage, Footer, GrunnmurenProvider, Heading, HeadingContext, Label, LinkList, LinkListContainer, LinkListItem, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tag, TagGroup, TagList, TextArea, TextField, Carousel as UNSAFE_Carousel, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Link as UNSAFE_Link, Modal as UNSAFE_Modal, Tab as UNSAFE_Tab, TabList as UNSAFE_TabList, TabPanel as UNSAFE_TabPanel, Table as UNSAFE_Table, TableBody as UNSAFE_TableBody, TableCell as UNSAFE_TableCell, TableColumn as UNSAFE_TableColumn, TableColumnResizer as UNSAFE_TableColumnResizer, TableContainer as UNSAFE_TableContainer, TableHeader as UNSAFE_TableHeader, TableRow as UNSAFE_TableRow, Tabs as UNSAFE_Tabs, VideoLoop, _LinkContext, _useLocale as useLocale };
|
|
749
|
+
export type { AccordionItemProps, AccordionProps, Props as AlertboxProps, AvatarProps, BacklinkProps, BadgeProps, BreadcrumbProps, BreadcrumbsProps, ButtonProps, CaptionProps, CardLinkProps, CardProps, CheckboxGroupProps, CheckboxProps, ComboboxProps, ContentProps, DateFormatterProps, DescriptionProps, DisclosureButtonProps, DisclosurePanelProps, DisclosureProps, ErrorMessageProps, FooterProps, GrunnmurenProviderProps, HeadingProps, LinkListContainerProps, LinkListItemProps, LinkListProps, Locale, MediaProps, NumberFieldProps, RadioGroupProps, RadioProps, SelectProps, TagGroupProps, TagListProps, TagProps, TextAreaProps, TextFieldProps, CarouselItemProps as UNSAFE_CarouselItemProps, CarouselItemsProps as UNSAFE_CarouselItemsProps, CarouselProps as UNSAFE_CarouselProps, DialogProps as UNSAFE_DialogProps, DialogTriggerProps as UNSAFE_DialogTriggerProps, FileUploadProps as UNSAFE_FileUploadProps, HeroProps as UNSAFE_HeroProps, LinkProps as UNSAFE_LinkProps, ModalProps as UNSAFE_ModalProps, TabListProps as UNSAFE_TabListProps, TabPanelProps as UNSAFE_TabPanelProps, TabProps as UNSAFE_TabProps, TableBodyProps as UNSAFE_TableBodyProps, TableCellProps as UNSAFE_TableCellProps, TableColumnProps as UNSAFE_TableColumnProps, TableColumnResizerProps as UNSAFE_TableColumnResizerProps, TableContainerProps as UNSAFE_TableContainerProps, TableHeaderProps as UNSAFE_TableHeaderProps, TableProps as UNSAFE_TableProps, TableRowProps as UNSAFE_TableRowProps, TabsProps as UNSAFE_TabsProps };
|
package/dist/index.mjs
CHANGED
|
@@ -1014,8 +1014,9 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
|
|
|
1014
1014
|
}
|
|
1015
1015
|
isScrollingProgrammatically.current = true;
|
|
1016
1016
|
const elementWithFocusVisible = carouselRef.current?.querySelector(':focus-visible');
|
|
1017
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
1017
1018
|
carouselItemsRef.current.children[scrollTargetIndex]?.scrollIntoView({
|
|
1018
|
-
behavior: 'smooth',
|
|
1019
|
+
behavior: prefersReducedMotion ? 'instant' : 'smooth',
|
|
1019
1020
|
inline: 'start',
|
|
1020
1021
|
block: 'nearest'
|
|
1021
1022
|
});
|
|
@@ -1143,7 +1144,9 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
|
|
|
1143
1144
|
{
|
|
1144
1145
|
carouselItemsRef,
|
|
1145
1146
|
onScroll,
|
|
1146
|
-
activeIndex: scrollTargetIndex
|
|
1147
|
+
activeIndex: scrollTargetIndex,
|
|
1148
|
+
handlePrevious,
|
|
1149
|
+
handleNext
|
|
1147
1150
|
}
|
|
1148
1151
|
],
|
|
1149
1152
|
[
|
|
@@ -1214,14 +1217,35 @@ const CarouselItemsContext = /*#__PURE__*/ createContext({
|
|
|
1214
1217
|
activeIndex: 0
|
|
1215
1218
|
});
|
|
1216
1219
|
const CarouselItems = ({ className, children })=>{
|
|
1220
|
+
const { carouselItemsRef, onScroll, activeIndex, handlePrevious, handleNext } = useContext(CarouselItemsContext);
|
|
1221
|
+
const prefersReducedMotion = useRef(window.matchMedia('(prefers-reduced-motion: reduce)').matches);
|
|
1222
|
+
// Update the ref when the media query changes
|
|
1223
|
+
useEffect(()=>{
|
|
1224
|
+
const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
1225
|
+
const handleChange = (e)=>{
|
|
1226
|
+
prefersReducedMotion.current = e.matches;
|
|
1227
|
+
};
|
|
1228
|
+
mediaQuery.addEventListener('change', handleChange);
|
|
1229
|
+
return ()=>mediaQuery.removeEventListener('change', handleChange);
|
|
1230
|
+
}, []);
|
|
1217
1231
|
const handleKeyDown = (event)=>{
|
|
1218
1232
|
// Prevent default behavior when holding down arrow keys (when repeat is true)
|
|
1219
1233
|
// The default behavior in scroll snapping causes a staggering scroll effect that feels janky
|
|
1220
1234
|
if (event.repeat && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
|
|
1221
1235
|
event.preventDefault();
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
// For users with prefers-reduced-motion, trigger button click behavior instead of native scroll
|
|
1239
|
+
if (prefersReducedMotion.current) {
|
|
1240
|
+
if (event.key === 'ArrowLeft' && handlePrevious) {
|
|
1241
|
+
event.preventDefault();
|
|
1242
|
+
handlePrevious();
|
|
1243
|
+
} else if (event.key === 'ArrowRight' && handleNext) {
|
|
1244
|
+
event.preventDefault();
|
|
1245
|
+
handleNext();
|
|
1246
|
+
}
|
|
1222
1247
|
}
|
|
1223
1248
|
};
|
|
1224
|
-
const { carouselItemsRef, onScroll, activeIndex } = useContext(CarouselItemsContext);
|
|
1225
1249
|
return(// biome-ignore lint/a11y/noStaticElementInteractions: The keydown handler is only to prevent undesired scrolling behavior when using the arrow keys
|
|
1226
1250
|
/*#__PURE__*/ jsx("div", {
|
|
1227
1251
|
"data-slot": "carousel-items",
|
|
@@ -2864,4 +2888,4 @@ const VideoLoop = ({ src, format, alt, className })=>{
|
|
|
2864
2888
|
});
|
|
2865
2889
|
};
|
|
2866
2890
|
|
|
2867
|
-
export { Accordion, AccordionItem, Alertbox, Avatar, Backlink, Badge, Breadcrumb, Breadcrumbs, Button, ButtonContext, Caption, Card, CardLink, Checkbox, CheckboxGroup, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, ListBoxSection as ComboboxSection, Content, ContentContext, DateFormatter, Description, Disclosure, DisclosureButton, DisclosurePanel, DisclosureStateContext, ErrorMessage, Footer, GrunnmurenProvider, Heading, HeadingContext, Label, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tag, TagGroup, TagList, TextArea, TextField, Carousel as UNSAFE_Carousel, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Link as UNSAFE_Link,
|
|
2891
|
+
export { Accordion, AccordionItem, Alertbox, Avatar, Backlink, Badge, Breadcrumb, Breadcrumbs, Button, ButtonContext, Caption, Card, CardLink, Checkbox, CheckboxGroup, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, ListBoxSection as ComboboxSection, Content, ContentContext, DateFormatter, Description, Disclosure, DisclosureButton, DisclosurePanel, DisclosureStateContext, ErrorMessage, Footer, GrunnmurenProvider, Heading, HeadingContext, Label, LinkList, LinkListContainer, LinkListItem, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tag, TagGroup, TagList, TextArea, TextField, Carousel as UNSAFE_Carousel, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Link as UNSAFE_Link, Modal as UNSAFE_Modal, Tab as UNSAFE_Tab, TabList as UNSAFE_TabList, TabPanel as UNSAFE_TabPanel, Table as UNSAFE_Table, TableBody as UNSAFE_TableBody, TableCell as UNSAFE_TableCell, TableColumn as UNSAFE_TableColumn, TableColumnResizer as UNSAFE_TableColumnResizer, TableContainer as UNSAFE_TableContainer, TableHeader as UNSAFE_TableHeader, TableRow as UNSAFE_TableRow, Tabs as UNSAFE_Tabs, VideoLoop, _LinkContext, _useLocale as useLocale };
|