@obosbbl/grunnmuren-react 3.1.1 → 3.1.2

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.
@@ -196,7 +196,7 @@ const inputGroup = cva.cx([
196
196
  ({
197
197
  popover: cva.cx('data-entering:fade-in data-exiting:fade-out min-w-(--trigger-width) overflow-y-auto rounded-md border border-black bg-white shadow-sm data-entering:animate-in data-exiting:animate-out'),
198
198
  // overflow-x-hidden is needed to prevent visible vertical scrollbars from overflowing the border radius of the popover
199
- listbox: cva.cx('max-h-[25rem] overflow-x-hidden text-sm outline-hidden'),
199
+ listbox: cva.cx('max-h-100 overflow-x-hidden text-sm outline-hidden'),
200
200
  chevronIcon: cva.cx('text-base transition-transform duration-150 group-data-open:rotate-180 motion-reduce:transition-none')
201
201
  });
202
202
 
@@ -194,7 +194,7 @@ const inputGroup = cx([
194
194
  ({
195
195
  popover: cx('data-entering:fade-in data-exiting:fade-out min-w-(--trigger-width) overflow-y-auto rounded-md border border-black bg-white shadow-sm data-entering:animate-in data-exiting:animate-out'),
196
196
  // overflow-x-hidden is needed to prevent visible vertical scrollbars from overflowing the border radius of the popover
197
- listbox: cx('max-h-[25rem] overflow-x-hidden text-sm outline-hidden'),
197
+ listbox: cx('max-h-100 overflow-x-hidden text-sm outline-hidden'),
198
198
  chevronIcon: cx('text-base transition-transform duration-150 group-data-open:rotate-180 motion-reduce:transition-none')
199
199
  });
200
200
 
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { DisclosureProps as DisclosureProps$1, ButtonProps as ButtonProps$1, LinkProps, BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1, ContextValue, CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1, HeadingProps as HeadingProps$1, ListBoxItemProps, ListBoxSectionProps, ComboBoxProps, FileTriggerProps as FileTriggerProps$1, RouterProvider, TextProps, LabelProps, DialogProps as DialogProps$1, DialogTriggerProps as DialogTriggerProps$1, ModalOverlayProps, NumberFieldProps as NumberFieldProps$1, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, SelectProps as SelectProps$1, TableProps as TableProps$1, TableBodyProps as TableBodyProps$1, CellProps, ColumnProps, TableHeaderProps as TableHeaderProps$1, RowProps, TabProps as TabProps$1, TabListProps as TabListProps$1, TabPanelProps as TabPanelProps$1, TabsProps as TabsProps$1, TagGroupProps as TagGroupProps$1, TagListProps as TagListProps$1, TagProps as TagProps$1, TextFieldProps as TextFieldProps$1 } from 'react-aria-components';
1
+ import { DisclosureProps as DisclosureProps$1, ButtonProps as ButtonProps$1, LinkProps as LinkProps$1, BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1, ContextValue, CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1, HeadingProps as HeadingProps$1, ListBoxItemProps, ListBoxSectionProps, ComboBoxProps, FileTriggerProps as FileTriggerProps$1, RouterProvider, TextProps, LabelProps, DialogProps as DialogProps$1, DialogTriggerProps as DialogTriggerProps$1, ModalOverlayProps, NumberFieldProps as NumberFieldProps$1, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, SelectProps as SelectProps$1, TableProps as TableProps$1, TableBodyProps as TableBodyProps$1, CellProps, ColumnProps, TableHeaderProps as TableHeaderProps$1, RowProps, TabProps as TabProps$1, TabListProps as TabListProps$1, TabPanelProps as TabPanelProps$1, TabsProps as TabsProps$1, TagGroupProps as TagGroupProps$1, TagListProps as TagListProps$1, TagProps as TagProps$1, TextFieldProps as TextFieldProps$1 } from 'react-aria-components';
2
2
  export { ListBoxItemProps as ComboboxItemProps, Form, Group, LabelProps, ListBoxItemProps as SelectItemProps, DisclosureGroup as UNSAFE_DisclosureGroup, DisclosureGroupProps as UNSAFE_DisclosureGroupProps } from 'react-aria-components';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
- import { RefAttributes, HTMLAttributes, HTMLProps, ComponentProps, Ref, JSX, ReactNode, RefObject, Dispatch, SetStateAction } from 'react';
5
+ import { RefAttributes, HTMLAttributes, HTMLProps, ComponentProps, ReactNode, Ref, JSX, RefObject, Dispatch, SetStateAction } from 'react';
6
6
  import * as cva from 'cva';
7
7
  import { VariantProps } from 'cva';
8
8
  import { DisclosureState } from 'react-stately';
@@ -95,6 +95,15 @@ declare const Alertbox: ({ children, role, className, icon, variant, isDismissab
95
95
  type AvatarProps = ComponentProps<'img'>;
96
96
  declare const Avatar: ({ src, alt, className, onError, loading, ...rest }: AvatarProps) => react_jsx_runtime.JSX.Element;
97
97
 
98
+ type LinkProps = LinkProps$1 & React.RefAttributes<HTMLAnchorElement> & {
99
+ children: ReactNode;
100
+ };
101
+ /**
102
+ * A basic link component that extends react-aria-components Link with consistent styling.
103
+ * Provides accessible focus styles and maintains design system consistency.
104
+ */
105
+ declare const Link: ({ children, className, ...restProps }: LinkProps) => react_jsx_runtime.JSX.Element;
106
+
98
107
  type ButtonOrLinkProps$1 = {
99
108
  children?: React.ReactNode;
100
109
  /** Additional CSS className for the element. */
@@ -158,7 +167,7 @@ declare function Breadcrumbs(props: BreadcrumbsProps): react_jsx_runtime.JSX.Ele
158
167
  */
159
168
  declare const buttonVariants: (props?: ({
160
169
  variant?: "primary" | "secondary" | "tertiary" | undefined;
161
- color?: "blue" | "mint" | "white" | undefined;
170
+ color?: "mint" | "white" | "blue" | undefined;
162
171
  isIconOnly?: boolean | undefined;
163
172
  isPending?: boolean | undefined;
164
173
  } & ({
@@ -170,13 +179,13 @@ declare const buttonVariants: (props?: ({
170
179
  })) | undefined) => string;
171
180
  type ButtonOrLinkProps = VariantProps<typeof buttonVariants> & {
172
181
  children?: React.ReactNode;
173
- href?: LinkProps['href'];
182
+ href?: LinkProps$1['href'];
174
183
  /** Additional style properties for the element. */
175
184
  style?: React.CSSProperties;
176
185
  /** Ref to the element. */
177
186
  ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;
178
187
  };
179
- type ButtonProps = (ButtonProps$1 | LinkProps) & ButtonOrLinkProps;
188
+ type ButtonProps = (ButtonProps$1 | LinkProps$1) & ButtonOrLinkProps;
180
189
  declare const ButtonContext: react.Context<ContextValue<ButtonProps, HTMLButtonElement | HTMLAnchorElement>>;
181
190
  declare function Button({ ref, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
182
191
 
@@ -185,7 +194,7 @@ type CardProps = VariantProps<typeof cardVariants> & HTMLAttributes<HTMLDivEleme
185
194
  };
186
195
  declare const cardVariants: (props?: ({
187
196
  variant?: "subtle" | "outlined" | undefined;
188
- layout?: "vertical" | "horizontal" | undefined;
197
+ layout?: "horizontal" | "vertical" | undefined;
189
198
  } & ({
190
199
  class?: cva.ClassValue;
191
200
  className?: never;
@@ -198,9 +207,9 @@ type CardLinkWrapperProps = {
198
207
  children?: React.ReactNode;
199
208
  className?: string;
200
209
  } & {
201
- [K in keyof Omit<LinkProps, 'className' | 'children'>]?: never;
210
+ [K in keyof Omit<LinkProps$1, 'className' | 'children'>]?: never;
202
211
  };
203
- type CardLinkProps = (Omit<LinkProps, 'href'> & Required<Pick<LinkProps, 'href'>>) | CardLinkWrapperProps;
212
+ type CardLinkProps = (Omit<LinkProps$1, 'href'> & Required<Pick<LinkProps$1, 'href'>>) | CardLinkWrapperProps;
204
213
  /**
205
214
  * A component that creates a clickable area on a card.
206
215
  * It can be used either as a wrapper around a link or as a standalone link.
@@ -237,7 +246,7 @@ type CarouselItem = Pick<CarouselItemProps, 'id'> & {
237
246
  /** The id of the previous item that was in view */
238
247
  prevId?: CarouselItemProps['id'];
239
248
  };
240
- declare const CarouselItem: ({ className, children, id }: CarouselItemProps) => react_jsx_runtime.JSX.Element;
249
+ declare const CarouselItem: ({ className, children, ...rest }: CarouselItemProps) => react_jsx_runtime.JSX.Element;
241
250
 
242
251
  type CheckboxProps = {
243
252
  children: React.ReactNode;
@@ -342,7 +351,7 @@ type MediaProps = HTMLProps<HTMLDivElement> & VariantProps<typeof mediaVariant>
342
351
  ref?: Ref<HTMLDivElement>;
343
352
  };
344
353
  declare const mediaVariant: (props?: ({
345
- fit?: "cover" | "contain" | undefined;
354
+ fit?: "contain" | "cover" | undefined;
346
355
  } & ({
347
356
  class?: cva.ClassValue;
348
357
  className?: never;
@@ -434,15 +443,6 @@ declare function ErrorMessage(props: ErrorMessageProps): react_jsx_runtime.JSX.E
434
443
 
435
444
  declare function Label(props: LabelProps): react_jsx_runtime.JSX.Element;
436
445
 
437
- type CustomLinkProps = LinkProps & {
438
- children: ReactNode;
439
- };
440
- /**
441
- * A basic link component that extends react-aria-components Link with consistent styling.
442
- * Provides accessible focus styles and maintains design system consistency.
443
- */
444
- declare const CustomLink: ({ children, className, ...restProps }: CustomLinkProps) => react_jsx_runtime.JSX.Element;
445
-
446
446
  type LinkListProps = React.HTMLProps<HTMLDivElement> & {
447
447
  children: JSX.Element | JSX.Element[];
448
448
  };
@@ -740,5 +740,5 @@ type VideoLoopProps = {
740
740
  };
741
741
  declare const VideoLoop: ({ src, format, alt, className }: VideoLoopProps) => react_jsx_runtime.JSX.Element;
742
742
 
743
- 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, 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, Disclosure as UNSAFE_Disclosure, DisclosureButton as UNSAFE_DisclosureButton, DisclosurePanel as UNSAFE_DisclosurePanel, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, CustomLink as UNSAFE_Link, LinkList as UNSAFE_LinkList, LinkListItem as UNSAFE_LinkListItem, 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, TableHeader as UNSAFE_TableHeader, TableRow as UNSAFE_TableRow, Tabs as UNSAFE_Tabs, VideoLoop, _useLocale as useLocale };
744
- export type { AccordionItemProps, AccordionProps, Props as AlertboxProps, AvatarProps, BacklinkProps, BadgeProps, BreadcrumbProps, BreadcrumbsProps, ButtonProps, CaptionProps, CardLinkProps, CardProps, CheckboxGroupProps, CheckboxProps, ComboboxProps, ContentProps, DateFormatterProps, DescriptionProps, 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, DisclosureButtonProps as UNSAFE_DisclosureButtonProps, DisclosurePanelProps as UNSAFE_DisclosurePanelProps, DisclosureProps as UNSAFE_DisclosureProps, FileUploadProps as UNSAFE_FileUploadProps, HeroProps as UNSAFE_HeroProps, LinkListItemProps as UNSAFE_LinkListItemProps, LinkListProps as UNSAFE_LinkListProps, CustomLinkProps 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, TableHeaderProps as UNSAFE_TableHeaderProps, TableProps as UNSAFE_TableProps, TableRowProps as UNSAFE_TableRowProps, TabsProps as UNSAFE_TabsProps };
743
+ 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, 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, Disclosure as UNSAFE_Disclosure, DisclosureButton as UNSAFE_DisclosureButton, DisclosurePanel as UNSAFE_DisclosurePanel, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Link as UNSAFE_Link, LinkList as UNSAFE_LinkList, LinkListItem as UNSAFE_LinkListItem, 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, TableHeader as UNSAFE_TableHeader, TableRow as UNSAFE_TableRow, Tabs as UNSAFE_Tabs, VideoLoop, _useLocale as useLocale };
744
+ export type { AccordionItemProps, AccordionProps, Props as AlertboxProps, AvatarProps, BacklinkProps, BadgeProps, BreadcrumbProps, BreadcrumbsProps, ButtonProps, CaptionProps, CardLinkProps, CardProps, CheckboxGroupProps, CheckboxProps, ComboboxProps, ContentProps, DateFormatterProps, DescriptionProps, 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, DisclosureButtonProps as UNSAFE_DisclosureButtonProps, DisclosurePanelProps as UNSAFE_DisclosurePanelProps, DisclosureProps as UNSAFE_DisclosureProps, FileUploadProps as UNSAFE_FileUploadProps, HeroProps as UNSAFE_HeroProps, LinkListItemProps as UNSAFE_LinkListItemProps, LinkListProps as UNSAFE_LinkListProps, 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, TableHeaderProps as UNSAFE_TableHeaderProps, TableProps as UNSAFE_TableProps, TableRowProps as UNSAFE_TableRowProps, TabsProps as UNSAFE_TabsProps };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  'use client';
2
- import { useContextProps, DisclosureContext, DisclosureGroupStateContext, Provider, ButtonContext as ButtonContext$1, DEFAULT_SLOT, Button as Button$1, useLocale, Link, Breadcrumb as Breadcrumb$1, Breadcrumbs as Breadcrumbs$1, Text, CheckboxContext, Checkbox as Checkbox$1, FieldError, Label as Label$1, CheckboxGroup as CheckboxGroup$1, Header, ListBoxItem as ListBoxItem$1, ListBoxSection as ListBoxSection$1, ListBox as ListBox$1, ComboBox, Group, Input, Popover, useSlottedContext, FormContext, FieldErrorContext, LabelContext, InputContext, I18nProvider, RouterProvider, GroupContext, Dialog as Dialog$1, DialogTrigger as DialogTrigger$1, Modal as Modal$1, ModalOverlay as ModalOverlay$1, NumberField as NumberField$1, Radio as Radio$1, RadioGroup as RadioGroup$1, Select as Select$1, SelectValue, Table as Table$1, TableBody as TableBody$1, Cell, Column, TableHeader as TableHeader$1, Row, Tab as Tab$1, TabListStateContext, TabList as TabList$1, TabPanel as TabPanel$1, Tabs as Tabs$1, TagGroup as TagGroup$1, TagList as TagList$1, Tag as Tag$1, TextField as TextField$1, TextArea as TextArea$1 } from 'react-aria-components';
2
+ import { useContextProps, DisclosureContext, DisclosureGroupStateContext, Provider, ButtonContext as ButtonContext$1, DEFAULT_SLOT, Button as Button$1, useLocale, Link as Link$1, Breadcrumb as Breadcrumb$1, Breadcrumbs as Breadcrumbs$1, Text, CheckboxContext, Checkbox as Checkbox$1, FieldError, Label as Label$1, CheckboxGroup as CheckboxGroup$1, Header, ListBoxItem as ListBoxItem$1, ListBoxSection as ListBoxSection$1, ListBox as ListBox$1, ComboBox, Group, Input, Popover, useSlottedContext, FormContext, FieldErrorContext, LabelContext, InputContext, I18nProvider, RouterProvider, GroupContext, Dialog as Dialog$1, DialogTrigger as DialogTrigger$1, Modal as Modal$1, ModalOverlay as ModalOverlay$1, NumberField as NumberField$1, Radio as Radio$1, RadioGroup as RadioGroup$1, Select as Select$1, SelectValue, Table as Table$1, TableBody as TableBody$1, Cell, Column, TableHeader as TableHeader$1, Row, Tab as Tab$1, TabListStateContext, TabList as TabList$1, TabPanel as TabPanel$1, Tabs as Tabs$1, TagGroup as TagGroup$1, TagList as TagList$1, Tag as Tag$1, TextField as TextField$1, TextArea as TextArea$1 } from 'react-aria-components';
3
3
  export { Form, Group, DisclosureGroup as UNSAFE_DisclosureGroup } from 'react-aria-components';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { cva, cx, compose } from 'cva';
6
- import { createContext, useContext, useId, useRef, Children, useState, useEffect, useCallback } from 'react';
6
+ import { createContext, useContext, useId, useRef, Children, useState, useEffect, isValidElement, cloneElement, useCallback } from 'react';
7
7
  import { ChevronDown, Error, Warning, CheckCircle, InfoCircle, Close, User, ChevronLeft, ChevronRight, LoadingSpinner, Check, Trash, ArrowRight, Download, LinkExternal, PlayerPause, PlayerPlay } from '@obosbbl/grunnmuren-icons-react';
8
8
  import { filterDOMProps, mergeProps, mergeRefs, useUpdateEffect, useObjectRef, useFormReset } from '@react-aria/utils';
9
9
  import { useFocusRing, useDisclosure, useProgressBar, useDateFormatter, useField } from 'react-aria';
@@ -476,20 +476,31 @@ const Avatar = ({ src, alt = '', className, onError, loading = 'lazy', ...rest }
476
476
  });
477
477
  };
478
478
 
479
+ /**
480
+ * A basic link component that extends react-aria-components Link with consistent styling.
481
+ * Provides accessible focus styles and maintains design system consistency.
482
+ */ const Link = ({ children, className, ...restProps })=>{
483
+ return /*#__PURE__*/ jsx(Link$1, {
484
+ ...restProps,
485
+ className: cx(className, 'inline-flex cursor-pointer items-center gap-1 font-medium hover:no-underline focus-visible:outline-current focus-visible:outline-focus-offset [&>svg]:shrink-0'),
486
+ children: children
487
+ });
488
+ };
489
+
479
490
  function isLinkProps$1(props) {
480
491
  return !!props.href;
481
492
  }
482
493
  function Backlink(props) {
483
494
  const { className, style, children, withUnderline, ref, ...restProps } = props;
484
- const _className = cx(className, 'group flex max-w-fit cursor-pointer items-center gap-3 rounded-md p-2.5 no-underline focus-visible:outline-focus');
495
+ const _className = cx(className, 'group flex! max-w-fit cursor-pointer items-center gap-3 rounded-md p-2.5 font-normal no-underline focus-visible:outline-focus');
485
496
  const content = /*#__PURE__*/ jsxs(Fragment, {
486
497
  children: [
487
498
  /*#__PURE__*/ jsx(ChevronLeft, {
488
- className: cx('-ml-[0.5em] group-hover:-translate-x-1 shrink-0 transition-transform duration-300')
499
+ className: cx('-ml-[0.5em] group-hover:-translate-x-1 duration-300')
489
500
  }),
490
501
  /*#__PURE__*/ jsx("span", {
491
502
  children: /*#__PURE__*/ jsx("span", {
492
- className: cx('border-transparent border-t-[1px] border-b-[1px] transition-colors duration-300', withUnderline ? 'border-b-black' : 'group-hover:border-b-black'),
503
+ className: cx('border-transparent border-y transition-colors duration-300', withUnderline ? 'border-b-black' : 'group-hover:border-b-black'),
493
504
  children: children
494
505
  })
495
506
  })
@@ -559,7 +570,7 @@ function Breadcrumb(props) {
559
570
  href ? /*#__PURE__*/ jsx(Link, {
560
571
  href: href,
561
572
  // use outline instead of ring-3 for focus marker that can be offset without creating a white background between the focus marker and the element content
562
- className: "rounded-xs focus-visible:outline-focus group-last:no-underline",
573
+ className: "rounded-xs font-normal hover:underline focus-visible:outline-focus group-last:no-underline",
563
574
  children: children
564
575
  }) : children,
565
576
  /*#__PURE__*/ jsx(ChevronRight, {
@@ -699,7 +710,7 @@ function Button({ ref = null, ...props }) {
699
710
  })
700
711
  ]
701
712
  }) : _children;
702
- return isLinkProps(restProps) ? /*#__PURE__*/ jsx(Link, {
713
+ return isLinkProps(restProps) ? /*#__PURE__*/ jsx(Link$1, {
703
714
  ...restProps,
704
715
  className: className,
705
716
  ref: ref,
@@ -923,7 +934,7 @@ const cardLinkVariants = cva({
923
934
  className: _className,
924
935
  withHref: !!href
925
936
  });
926
- return href ? /*#__PURE__*/ jsx(Link, {
937
+ return href ? /*#__PURE__*/ jsx(Link$1, {
927
938
  "data-slot": "card-link",
928
939
  ...restProps,
929
940
  href: href,
@@ -939,7 +950,8 @@ const cardLinkVariants = cva({
939
950
  };
940
951
 
941
952
  const Carousel = ({ className, children, onChange, ...rest })=>{
942
- const ref = useRef(null);
953
+ const carouselRef = useRef(null);
954
+ const carouselItemsRef = useRef(null);
943
955
  const locale = _useLocale();
944
956
  const { previous, next } = translations$1;
945
957
  const [scrollTargetIndex, setScrollTargetIndex] = useState(0);
@@ -947,10 +959,10 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
947
959
  const scrollTimeoutRef = useRef(null);
948
960
  const scrollQueue = useRef([]);
949
961
  const [hasReachedScrollStart, setHasReachedScrollStart] = useState(scrollTargetIndex === 0);
950
- const [hasReachedScrollEnd, setHasReachedScrollEnd] = useState(!ref.current || ref.current.children.length - 1 === scrollTargetIndex);
962
+ const [hasReachedScrollEnd, setHasReachedScrollEnd] = useState(!carouselItemsRef.current || carouselItemsRef.current.children.length - 1 === scrollTargetIndex);
951
963
  useEffect(()=>{
952
964
  setHasReachedScrollStart(scrollTargetIndex === 0);
953
- setHasReachedScrollEnd(!ref.current || ref.current.children.length - 1 === scrollTargetIndex);
965
+ setHasReachedScrollEnd(!carouselItemsRef.current || carouselItemsRef.current.children.length - 1 === scrollTargetIndex);
954
966
  }, [
955
967
  scrollTargetIndex
956
968
  ]);
@@ -971,14 +983,15 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
971
983
  };
972
984
  // Handle scrolling when user clicks the arrow icons
973
985
  useUpdateEffect(()=>{
974
- if (!ref.current) {
986
+ if (!carouselItemsRef.current) {
975
987
  return;
976
988
  }
977
989
  if (scrollTimeoutRef.current) {
978
990
  clearTimeout(scrollTimeoutRef.current);
979
991
  }
980
992
  isScrollingProgrammatically.current = true;
981
- ref.current.children[scrollTargetIndex]?.scrollIntoView({
993
+ const elementWithFocusVisible = carouselRef.current?.querySelector(':focus-visible');
994
+ carouselItemsRef.current.children[scrollTargetIndex]?.scrollIntoView({
982
995
  behavior: 'smooth',
983
996
  inline: 'start',
984
997
  block: 'nearest'
@@ -986,15 +999,43 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
986
999
  if (prevIndex.current !== scrollTargetIndex && onChange) {
987
1000
  onChange({
988
1001
  index: scrollTargetIndex,
989
- id: ref.current.children[scrollTargetIndex]?.id,
1002
+ id: carouselItemsRef.current.children[scrollTargetIndex]?.id,
990
1003
  prevIndex: prevIndex.current,
991
- prevId: ref.current.children[prevIndex.current]?.id
1004
+ prevId: carouselItemsRef.current.children[prevIndex.current]?.id
992
1005
  });
993
1006
  }
994
1007
  prevIndex.current = scrollTargetIndex;
995
1008
  scrollTimeoutRef.current = setTimeout(()=>{
996
1009
  isScrollingProgrammatically.current = false;
997
1010
  scrollTimeoutRef.current = null;
1011
+ if (elementWithFocusVisible && !carouselRef.current?.contains(document.activeElement)) {
1012
+ // Restore focus to the appropriate element after scrolling
1013
+ // First check if the prev or next buttons just got hidden due to reaching the start/end of the carousel
1014
+ // If so, move focus to the other button. This is to avoid a scroll jank that occurs if instead focus is restored to the carousel container
1015
+ // This jank happens because of the delays used for scrolling with these buttons (debounce, queuing etc.).
1016
+ switch(elementWithFocusVisible.slot){
1017
+ case 'prev':
1018
+ {
1019
+ // Focus was lost when the prev button turned invisible, set it to the next button
1020
+ const nextButton = carouselRef.current?.querySelector('[slot="next"]');
1021
+ nextButton?.focus();
1022
+ break;
1023
+ }
1024
+ case 'next':
1025
+ {
1026
+ // Focus was lost when the next button turned invisible, set it to the prev button
1027
+ const prevButton = carouselRef.current?.querySelector('[slot="prev"]');
1028
+ prevButton?.focus();
1029
+ break;
1030
+ }
1031
+ default:
1032
+ {
1033
+ // Focus was lost during while scrolling with left/right arrows, restore it to the carousel container
1034
+ carouselItemsRef.current?.focus();
1035
+ break;
1036
+ }
1037
+ }
1038
+ }
998
1039
  processQueue(); // Process any queued scrolls
999
1040
  }, 500);
1000
1041
  }, [
@@ -1039,7 +1080,9 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
1039
1080
  }, 150);
1040
1081
  const handlePrevious = ()=>{
1041
1082
  const targetIndex = scrollTargetIndex - 1;
1042
- if (targetIndex < 0) return;
1083
+ if (targetIndex < 0) {
1084
+ return;
1085
+ }
1043
1086
  if (isScrollingProgrammatically.current) {
1044
1087
  // If we're already scrolling, queue this action
1045
1088
  scrollQueue.current = [
@@ -1050,9 +1093,11 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
1050
1093
  }
1051
1094
  };
1052
1095
  const handleNext = ()=>{
1053
- if (!ref.current) return;
1096
+ if (!carouselItemsRef.current) return;
1054
1097
  const targetIndex = scrollTargetIndex + 1;
1055
- if (targetIndex >= ref.current.children.length) return;
1098
+ if (targetIndex >= carouselItemsRef.current.children.length) {
1099
+ return;
1100
+ }
1056
1101
  if (isScrollingProgrammatically.current) {
1057
1102
  // If we're already scrolling, queue this action
1058
1103
  scrollQueue.current = [
@@ -1064,13 +1109,15 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
1064
1109
  };
1065
1110
  return /*#__PURE__*/ jsx("div", {
1066
1111
  "data-slot": "carousel",
1112
+ ref: carouselRef,
1067
1113
  children: /*#__PURE__*/ jsx(Provider, {
1068
1114
  values: [
1069
1115
  [
1070
1116
  CarouselItemsContext,
1071
1117
  {
1072
- ref,
1073
- onScroll
1118
+ carouselItemsRef,
1119
+ onScroll,
1120
+ activeIndex: scrollTargetIndex
1074
1121
  }
1075
1122
  ],
1076
1123
  [
@@ -1137,7 +1184,8 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
1137
1184
  children: children
1138
1185
  });
1139
1186
  const CarouselItemsContext = /*#__PURE__*/ createContext({
1140
- ref: null
1187
+ carouselItemsRef: null,
1188
+ activeIndex: 0
1141
1189
  });
1142
1190
  const CarouselItems = ({ className, children })=>{
1143
1191
  const handleKeyDown = (event)=>{
@@ -1147,31 +1195,36 @@ const CarouselItems = ({ className, children })=>{
1147
1195
  event.preventDefault();
1148
1196
  }
1149
1197
  };
1150
- return /*#__PURE__*/ jsx(CarouselItemsContext.Consumer, {
1151
- children: ({ ref, onScroll })=>// biome-ignore lint/a11y/noStaticElementInteractions: The keydown handler is only to prevent undesired scrolling behavior when using the arrow keys
1152
- /*#__PURE__*/ jsx("div", {
1153
- "data-slot": "carousel-items",
1154
- className: cx(className, [
1155
- 'scrollbar-hidden',
1156
- 'flex',
1157
- 'snap-x',
1158
- 'snap-mandatory',
1159
- 'overflow-x-auto',
1160
- 'outline-none',
1161
- 'rounded-[inherit]'
1162
- ]),
1163
- ref: ref,
1164
- onScroll: onScroll,
1165
- onKeyDown: handleKeyDown,
1166
- children: children
1167
- })
1168
- });
1198
+ const { carouselItemsRef, onScroll, activeIndex } = useContext(CarouselItemsContext);
1199
+ return(// biome-ignore lint/a11y/noStaticElementInteractions: The keydown handler is only to prevent undesired scrolling behavior when using the arrow keys
1200
+ /*#__PURE__*/ jsx("div", {
1201
+ "data-slot": "carousel-items",
1202
+ className: cx(className, [
1203
+ 'scrollbar-hidden',
1204
+ 'flex',
1205
+ 'snap-x',
1206
+ 'snap-mandatory',
1207
+ 'overflow-x-auto',
1208
+ 'outline-none',
1209
+ 'rounded-[inherit]'
1210
+ ]),
1211
+ ref: carouselItemsRef,
1212
+ onScroll: onScroll,
1213
+ onKeyDown: handleKeyDown,
1214
+ children: Children.map(children, (child, index)=>{
1215
+ if (/*#__PURE__*/ isValidElement(child)) {
1216
+ return /*#__PURE__*/ cloneElement(child, {
1217
+ inert: activeIndex === index ? undefined : true
1218
+ });
1219
+ }
1220
+ })
1221
+ }));
1169
1222
  };
1170
- const CarouselItem = ({ className, children, id })=>{
1223
+ const CarouselItem = ({ className, children, ...rest })=>{
1171
1224
  return /*#__PURE__*/ jsx("div", {
1172
1225
  className: cx(className, 'shrink-0 basis-full snap-start'),
1173
1226
  "data-slot": "carousel-item",
1174
- id: id,
1227
+ ...rest,
1175
1228
  children: /*#__PURE__*/ jsx(Provider, {
1176
1229
  values: [
1177
1230
  [
@@ -1226,7 +1279,7 @@ const inputGroup = cx([
1226
1279
  const dropdown = {
1227
1280
  popover: cx('data-entering:fade-in data-exiting:fade-out min-w-(--trigger-width) overflow-y-auto rounded-md border border-black bg-white shadow-sm data-entering:animate-in data-exiting:animate-out'),
1228
1281
  // overflow-x-hidden is needed to prevent visible vertical scrollbars from overflowing the border radius of the popover
1229
- listbox: cx('max-h-[25rem] overflow-x-hidden text-sm outline-hidden'),
1282
+ listbox: cx('max-h-100 overflow-x-hidden text-sm outline-hidden'),
1230
1283
  chevronIcon: cx('text-base transition-transform duration-150 group-data-open:rotate-180 motion-reduce:transition-none')
1231
1284
  };
1232
1285
 
@@ -1869,17 +1922,6 @@ const Hero = ({ variant, className, children, ...rest })=>{
1869
1922
  });
1870
1923
  };
1871
1924
 
1872
- /**
1873
- * A basic link component that extends react-aria-components Link with consistent styling.
1874
- * Provides accessible focus styles and maintains design system consistency.
1875
- */ const CustomLink = ({ children, className, ...restProps })=>{
1876
- return /*#__PURE__*/ jsx(Link, {
1877
- ...restProps,
1878
- className: cx(className, 'inline-flex cursor-pointer items-center gap-1 font-medium hover:no-underline focus-visible:outline-current focus-visible:outline-focus-offset [&>svg]:shrink-0'),
1879
- children: children
1880
- });
1881
- };
1882
-
1883
1925
  const LinkList = ({ className, children, ...restProps })=>{
1884
1926
  const numberofLinks = Children.count(children);
1885
1927
  return /*#__PURE__*/ jsx("div", {
@@ -1888,7 +1930,7 @@ const LinkList = ({ className, children, ...restProps })=>{
1888
1930
  children: /*#__PURE__*/ jsx("ul", {
1889
1931
  className: cx('min-w-fit', // Hide dividers at the top of the list (overflow-y) and prevents arrow icon from overflowing container when animated to the right (overflow-x)
1890
1932
  'overflow-hidden', // Add a small gap between items that fits the divider lines (this way the divider line don't take up any space in each item)
1891
- 'grid auto-rows-max gap-y-0.25', // Gaps for when the list is displayed in multiple columns
1933
+ 'grid auto-rows-max gap-y-px', // Gaps for when the list is displayed in multiple columns
1892
1934
  '@lg:gap-x-12 @md:gap-x-9 @sm:gap-x-4 @xl:gap-x-16', numberofLinks > 5 && [
1893
1935
  '@xl:grid-cols-2',
1894
1936
  (numberofLinks === 9 || numberofLinks > 10) && '@4xl:grid-cols-3'
@@ -1899,26 +1941,26 @@ const LinkList = ({ className, children, ...restProps })=>{
1899
1941
  };
1900
1942
  const LinkListItem = ({ children, isExternal, className, ...restProps })=>{
1901
1943
  let Icon = ArrowRight;
1902
- let iconTransition = 'group-hover:motion-safe:translate-x-1';
1944
+ let iconTransition = cx('group-hover:motion-safe:translate-x-1');
1903
1945
  if (restProps.download) {
1904
1946
  Icon = Download;
1905
- iconTransition = 'group-hover:motion-safe:translate-y-1';
1947
+ iconTransition = cx('group-hover:motion-safe:translate-y-1');
1906
1948
  } else if (isExternal) {
1907
- iconTransition = 'group-hover:motion-safe:-translate-y-0.5 group-hover:motion-safe:translate-x-0.5';
1949
+ iconTransition = cx('group-hover:motion-safe:-translate-y-0.5 group-hover:motion-safe:translate-x-0.5');
1908
1950
  Icon = LinkExternal;
1909
1951
  }
1910
1952
  return /*#__PURE__*/ jsx("li", {
1911
1953
  // Creates divider lines that works in any grid layout and with the focus ring
1912
- className: "after:-top-0.25 relative p-0.75 after:absolute after:right-0 after:left-0 after:h-0.25 after:w-full after:bg-gray-light",
1954
+ className: "after:-top-px relative p-0.75 after:absolute after:right-0 after:left-0 after:h-px after:w-full after:bg-gray-light",
1913
1955
  children: /*#__PURE__*/ jsxs(Link, {
1914
1956
  ...restProps,
1915
- className: cx(className, 'group paragraph flex cursor-pointer justify-between gap-x-2 py-3.5 font-medium no-underline focus-visible:outline-focus'),
1957
+ className: cx(className, 'group paragraph flex w-full cursor-pointer justify-between gap-x-2 py-3.5 font-medium no-underline focus-visible:outline-focus'),
1916
1958
  children: [
1917
1959
  /*#__PURE__*/ jsx("span", {
1918
1960
  children: children
1919
1961
  }),
1920
1962
  /*#__PURE__*/ jsx(Icon, {
1921
- className: cx('shrink-0 motion-safe:transition-transform', iconTransition)
1963
+ className: iconTransition
1922
1964
  })
1923
1965
  ]
1924
1966
  })
@@ -2750,4 +2792,4 @@ const VideoLoop = ({ src, format, alt, className })=>{
2750
2792
  });
2751
2793
  };
2752
2794
 
2753
- 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, 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, Disclosure as UNSAFE_Disclosure, DisclosureButton as UNSAFE_DisclosureButton, DisclosurePanel as UNSAFE_DisclosurePanel, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, CustomLink as UNSAFE_Link, LinkList as UNSAFE_LinkList, LinkListItem as UNSAFE_LinkListItem, 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, TableHeader as UNSAFE_TableHeader, TableRow as UNSAFE_TableRow, Tabs as UNSAFE_Tabs, VideoLoop, _useLocale as useLocale };
2795
+ 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, 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, Disclosure as UNSAFE_Disclosure, DisclosureButton as UNSAFE_DisclosureButton, DisclosurePanel as UNSAFE_DisclosurePanel, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Link as UNSAFE_Link, LinkList as UNSAFE_LinkList, LinkListItem as UNSAFE_LinkListItem, 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, TableHeader as UNSAFE_TableHeader, TableRow as UNSAFE_TableRow, Tabs as UNSAFE_Tabs, VideoLoop, _useLocale as useLocale };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Grunnmuren components in React",
5
5
  "repository": {
6
6
  "url": "https://github.com/code-obos/grunnmuren"