@obosbbl/grunnmuren-react 3.1.0 → 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, DisclosureGroupProps, 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, ComponentProps, Ref, HTMLProps, 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';
@@ -34,10 +34,8 @@ type DisclosurePanelProps = Omit<HTMLAttributes<HTMLDivElement>, 'role'> & {
34
34
  } & RefAttributes<HTMLDivElement>;
35
35
  declare const DisclosurePanel: ({ ref, children, ...props }: DisclosurePanelProps) => react_jsx_runtime.JSX.Element;
36
36
 
37
- type AccordionProps = DisclosureGroupProps & {
37
+ type AccordionProps = HTMLProps<HTMLDivElement> & {
38
38
  children: React.ReactNode;
39
- /** Whether multiple accordion items can be expanded at the same time. Default is true */
40
- allowsMultipleExpanded?: boolean;
41
39
  };
42
40
  type AccordionItemProps = DisclosureProps & {
43
41
  children?: React.ReactNode;
@@ -97,6 +95,15 @@ declare const Alertbox: ({ children, role, className, icon, variant, isDismissab
97
95
  type AvatarProps = ComponentProps<'img'>;
98
96
  declare const Avatar: ({ src, alt, className, onError, loading, ...rest }: AvatarProps) => react_jsx_runtime.JSX.Element;
99
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
+
100
107
  type ButtonOrLinkProps$1 = {
101
108
  children?: React.ReactNode;
102
109
  /** Additional CSS className for the element. */
@@ -160,7 +167,7 @@ declare function Breadcrumbs(props: BreadcrumbsProps): react_jsx_runtime.JSX.Ele
160
167
  */
161
168
  declare const buttonVariants: (props?: ({
162
169
  variant?: "primary" | "secondary" | "tertiary" | undefined;
163
- color?: "blue" | "mint" | "white" | undefined;
170
+ color?: "mint" | "white" | "blue" | undefined;
164
171
  isIconOnly?: boolean | undefined;
165
172
  isPending?: boolean | undefined;
166
173
  } & ({
@@ -172,13 +179,13 @@ declare const buttonVariants: (props?: ({
172
179
  })) | undefined) => string;
173
180
  type ButtonOrLinkProps = VariantProps<typeof buttonVariants> & {
174
181
  children?: React.ReactNode;
175
- href?: LinkProps['href'];
182
+ href?: LinkProps$1['href'];
176
183
  /** Additional style properties for the element. */
177
184
  style?: React.CSSProperties;
178
185
  /** Ref to the element. */
179
186
  ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;
180
187
  };
181
- type ButtonProps = (ButtonProps$1 | LinkProps) & ButtonOrLinkProps;
188
+ type ButtonProps = (ButtonProps$1 | LinkProps$1) & ButtonOrLinkProps;
182
189
  declare const ButtonContext: react.Context<ContextValue<ButtonProps, HTMLButtonElement | HTMLAnchorElement>>;
183
190
  declare function Button({ ref, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
184
191
 
@@ -187,7 +194,7 @@ type CardProps = VariantProps<typeof cardVariants> & HTMLAttributes<HTMLDivEleme
187
194
  };
188
195
  declare const cardVariants: (props?: ({
189
196
  variant?: "subtle" | "outlined" | undefined;
190
- layout?: "vertical" | "horizontal" | undefined;
197
+ layout?: "horizontal" | "vertical" | undefined;
191
198
  } & ({
192
199
  class?: cva.ClassValue;
193
200
  className?: never;
@@ -200,9 +207,9 @@ type CardLinkWrapperProps = {
200
207
  children?: React.ReactNode;
201
208
  className?: string;
202
209
  } & {
203
- [K in keyof Omit<LinkProps, 'className' | 'children'>]?: never;
210
+ [K in keyof Omit<LinkProps$1, 'className' | 'children'>]?: never;
204
211
  };
205
- type CardLinkProps = (Omit<LinkProps, 'href'> & Required<Pick<LinkProps, 'href'>>) | CardLinkWrapperProps;
212
+ type CardLinkProps = (Omit<LinkProps$1, 'href'> & Required<Pick<LinkProps$1, 'href'>>) | CardLinkWrapperProps;
206
213
  /**
207
214
  * A component that creates a clickable area on a card.
208
215
  * It can be used either as a wrapper around a link or as a standalone link.
@@ -239,7 +246,7 @@ type CarouselItem = Pick<CarouselItemProps, 'id'> & {
239
246
  /** The id of the previous item that was in view */
240
247
  prevId?: CarouselItemProps['id'];
241
248
  };
242
- 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;
243
250
 
244
251
  type CheckboxProps = {
245
252
  children: React.ReactNode;
@@ -344,7 +351,7 @@ type MediaProps = HTMLProps<HTMLDivElement> & VariantProps<typeof mediaVariant>
344
351
  ref?: Ref<HTMLDivElement>;
345
352
  };
346
353
  declare const mediaVariant: (props?: ({
347
- fit?: "cover" | "contain" | undefined;
354
+ fit?: "contain" | "cover" | undefined;
348
355
  } & ({
349
356
  class?: cva.ClassValue;
350
357
  className?: never;
@@ -436,15 +443,6 @@ declare function ErrorMessage(props: ErrorMessageProps): react_jsx_runtime.JSX.E
436
443
 
437
444
  declare function Label(props: LabelProps): react_jsx_runtime.JSX.Element;
438
445
 
439
- type CustomLinkProps = LinkProps & {
440
- children: ReactNode;
441
- };
442
- /**
443
- * A basic link component that extends react-aria-components Link with consistent styling.
444
- * Provides accessible focus styles and maintains design system consistency.
445
- */
446
- declare const CustomLink: ({ children, className, ...restProps }: CustomLinkProps) => react_jsx_runtime.JSX.Element;
447
-
448
446
  type LinkListProps = React.HTMLProps<HTMLDivElement> & {
449
447
  children: JSX.Element | JSX.Element[];
450
448
  };
@@ -742,5 +740,5 @@ type VideoLoopProps = {
742
740
  };
743
741
  declare const VideoLoop: ({ src, format, alt, className }: VideoLoopProps) => react_jsx_runtime.JSX.Element;
744
742
 
745
- 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 };
746
- 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, DisclosureGroup, 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';
@@ -255,12 +255,11 @@ const DisclosurePanel = ({ ref, children, ...props })=>{
255
255
  };
256
256
 
257
257
  function Accordion(props) {
258
- const { children, className, allowsMultipleExpanded = true, ...restProps } = props;
258
+ const { children, className, ...restProps } = props;
259
259
  const childCount = Children.count(children);
260
- return /*#__PURE__*/ jsx(DisclosureGroup, {
260
+ return /*#__PURE__*/ jsx("div", {
261
261
  ...restProps,
262
262
  "data-accordion": true,
263
- allowsMultipleExpanded: allowsMultipleExpanded,
264
263
  className: cx('rounded-lg bg-white', className),
265
264
  children: Children.map(children, (child, index)=>/*#__PURE__*/ jsxs(Fragment, {
266
265
  children: [
@@ -275,7 +274,7 @@ function Accordion(props) {
275
274
  });
276
275
  }
277
276
  function AccordionItem(props) {
278
- const { className, children, defaultOpen = false, isOpen: controlledIsOpen, onOpenChange, defaultExpanded, isExpanded, onExpandedChange, ...restProps } = props;
277
+ const { className, children, defaultOpen, isOpen: controlledIsOpen, onOpenChange, defaultExpanded = false, isExpanded, onExpandedChange, ...restProps } = props;
279
278
  const _defaultExpanded = defaultOpen ?? defaultExpanded;
280
279
  const _isExpanded = controlledIsOpen ?? isExpanded;
281
280
  const _onExpandedChange = onOpenChange ?? onExpandedChange;
@@ -477,20 +476,31 @@ const Avatar = ({ src, alt = '', className, onError, loading = 'lazy', ...rest }
477
476
  });
478
477
  };
479
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
+
480
490
  function isLinkProps$1(props) {
481
491
  return !!props.href;
482
492
  }
483
493
  function Backlink(props) {
484
494
  const { className, style, children, withUnderline, ref, ...restProps } = props;
485
- 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');
486
496
  const content = /*#__PURE__*/ jsxs(Fragment, {
487
497
  children: [
488
498
  /*#__PURE__*/ jsx(ChevronLeft, {
489
- 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')
490
500
  }),
491
501
  /*#__PURE__*/ jsx("span", {
492
502
  children: /*#__PURE__*/ jsx("span", {
493
- 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'),
494
504
  children: children
495
505
  })
496
506
  })
@@ -560,7 +570,7 @@ function Breadcrumb(props) {
560
570
  href ? /*#__PURE__*/ jsx(Link, {
561
571
  href: href,
562
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
563
- 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",
564
574
  children: children
565
575
  }) : children,
566
576
  /*#__PURE__*/ jsx(ChevronRight, {
@@ -700,7 +710,7 @@ function Button({ ref = null, ...props }) {
700
710
  })
701
711
  ]
702
712
  }) : _children;
703
- return isLinkProps(restProps) ? /*#__PURE__*/ jsx(Link, {
713
+ return isLinkProps(restProps) ? /*#__PURE__*/ jsx(Link$1, {
704
714
  ...restProps,
705
715
  className: className,
706
716
  ref: ref,
@@ -924,7 +934,7 @@ const cardLinkVariants = cva({
924
934
  className: _className,
925
935
  withHref: !!href
926
936
  });
927
- return href ? /*#__PURE__*/ jsx(Link, {
937
+ return href ? /*#__PURE__*/ jsx(Link$1, {
928
938
  "data-slot": "card-link",
929
939
  ...restProps,
930
940
  href: href,
@@ -940,7 +950,8 @@ const cardLinkVariants = cva({
940
950
  };
941
951
 
942
952
  const Carousel = ({ className, children, onChange, ...rest })=>{
943
- const ref = useRef(null);
953
+ const carouselRef = useRef(null);
954
+ const carouselItemsRef = useRef(null);
944
955
  const locale = _useLocale();
945
956
  const { previous, next } = translations$1;
946
957
  const [scrollTargetIndex, setScrollTargetIndex] = useState(0);
@@ -948,10 +959,10 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
948
959
  const scrollTimeoutRef = useRef(null);
949
960
  const scrollQueue = useRef([]);
950
961
  const [hasReachedScrollStart, setHasReachedScrollStart] = useState(scrollTargetIndex === 0);
951
- 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);
952
963
  useEffect(()=>{
953
964
  setHasReachedScrollStart(scrollTargetIndex === 0);
954
- setHasReachedScrollEnd(!ref.current || ref.current.children.length - 1 === scrollTargetIndex);
965
+ setHasReachedScrollEnd(!carouselItemsRef.current || carouselItemsRef.current.children.length - 1 === scrollTargetIndex);
955
966
  }, [
956
967
  scrollTargetIndex
957
968
  ]);
@@ -972,14 +983,15 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
972
983
  };
973
984
  // Handle scrolling when user clicks the arrow icons
974
985
  useUpdateEffect(()=>{
975
- if (!ref.current) {
986
+ if (!carouselItemsRef.current) {
976
987
  return;
977
988
  }
978
989
  if (scrollTimeoutRef.current) {
979
990
  clearTimeout(scrollTimeoutRef.current);
980
991
  }
981
992
  isScrollingProgrammatically.current = true;
982
- ref.current.children[scrollTargetIndex]?.scrollIntoView({
993
+ const elementWithFocusVisible = carouselRef.current?.querySelector(':focus-visible');
994
+ carouselItemsRef.current.children[scrollTargetIndex]?.scrollIntoView({
983
995
  behavior: 'smooth',
984
996
  inline: 'start',
985
997
  block: 'nearest'
@@ -987,15 +999,43 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
987
999
  if (prevIndex.current !== scrollTargetIndex && onChange) {
988
1000
  onChange({
989
1001
  index: scrollTargetIndex,
990
- id: ref.current.children[scrollTargetIndex]?.id,
1002
+ id: carouselItemsRef.current.children[scrollTargetIndex]?.id,
991
1003
  prevIndex: prevIndex.current,
992
- prevId: ref.current.children[prevIndex.current]?.id
1004
+ prevId: carouselItemsRef.current.children[prevIndex.current]?.id
993
1005
  });
994
1006
  }
995
1007
  prevIndex.current = scrollTargetIndex;
996
1008
  scrollTimeoutRef.current = setTimeout(()=>{
997
1009
  isScrollingProgrammatically.current = false;
998
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
+ }
999
1039
  processQueue(); // Process any queued scrolls
1000
1040
  }, 500);
1001
1041
  }, [
@@ -1040,7 +1080,9 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
1040
1080
  }, 150);
1041
1081
  const handlePrevious = ()=>{
1042
1082
  const targetIndex = scrollTargetIndex - 1;
1043
- if (targetIndex < 0) return;
1083
+ if (targetIndex < 0) {
1084
+ return;
1085
+ }
1044
1086
  if (isScrollingProgrammatically.current) {
1045
1087
  // If we're already scrolling, queue this action
1046
1088
  scrollQueue.current = [
@@ -1051,9 +1093,11 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
1051
1093
  }
1052
1094
  };
1053
1095
  const handleNext = ()=>{
1054
- if (!ref.current) return;
1096
+ if (!carouselItemsRef.current) return;
1055
1097
  const targetIndex = scrollTargetIndex + 1;
1056
- if (targetIndex >= ref.current.children.length) return;
1098
+ if (targetIndex >= carouselItemsRef.current.children.length) {
1099
+ return;
1100
+ }
1057
1101
  if (isScrollingProgrammatically.current) {
1058
1102
  // If we're already scrolling, queue this action
1059
1103
  scrollQueue.current = [
@@ -1065,13 +1109,15 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
1065
1109
  };
1066
1110
  return /*#__PURE__*/ jsx("div", {
1067
1111
  "data-slot": "carousel",
1112
+ ref: carouselRef,
1068
1113
  children: /*#__PURE__*/ jsx(Provider, {
1069
1114
  values: [
1070
1115
  [
1071
1116
  CarouselItemsContext,
1072
1117
  {
1073
- ref,
1074
- onScroll
1118
+ carouselItemsRef,
1119
+ onScroll,
1120
+ activeIndex: scrollTargetIndex
1075
1121
  }
1076
1122
  ],
1077
1123
  [
@@ -1138,7 +1184,8 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
1138
1184
  children: children
1139
1185
  });
1140
1186
  const CarouselItemsContext = /*#__PURE__*/ createContext({
1141
- ref: null
1187
+ carouselItemsRef: null,
1188
+ activeIndex: 0
1142
1189
  });
1143
1190
  const CarouselItems = ({ className, children })=>{
1144
1191
  const handleKeyDown = (event)=>{
@@ -1148,31 +1195,36 @@ const CarouselItems = ({ className, children })=>{
1148
1195
  event.preventDefault();
1149
1196
  }
1150
1197
  };
1151
- return /*#__PURE__*/ jsx(CarouselItemsContext.Consumer, {
1152
- children: ({ ref, onScroll })=>// biome-ignore lint/a11y/noStaticElementInteractions: The keydown handler is only to prevent undesired scrolling behavior when using the arrow keys
1153
- /*#__PURE__*/ jsx("div", {
1154
- "data-slot": "carousel-items",
1155
- className: cx(className, [
1156
- 'scrollbar-hidden',
1157
- 'flex',
1158
- 'snap-x',
1159
- 'snap-mandatory',
1160
- 'overflow-x-auto',
1161
- 'outline-none',
1162
- 'rounded-[inherit]'
1163
- ]),
1164
- ref: ref,
1165
- onScroll: onScroll,
1166
- onKeyDown: handleKeyDown,
1167
- children: children
1168
- })
1169
- });
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
+ }));
1170
1222
  };
1171
- const CarouselItem = ({ className, children, id })=>{
1223
+ const CarouselItem = ({ className, children, ...rest })=>{
1172
1224
  return /*#__PURE__*/ jsx("div", {
1173
1225
  className: cx(className, 'shrink-0 basis-full snap-start'),
1174
1226
  "data-slot": "carousel-item",
1175
- id: id,
1227
+ ...rest,
1176
1228
  children: /*#__PURE__*/ jsx(Provider, {
1177
1229
  values: [
1178
1230
  [
@@ -1227,7 +1279,7 @@ const inputGroup = cx([
1227
1279
  const dropdown = {
1228
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'),
1229
1281
  // overflow-x-hidden is needed to prevent visible vertical scrollbars from overflowing the border radius of the popover
1230
- 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'),
1231
1283
  chevronIcon: cx('text-base transition-transform duration-150 group-data-open:rotate-180 motion-reduce:transition-none')
1232
1284
  };
1233
1285
 
@@ -1870,17 +1922,6 @@ const Hero = ({ variant, className, children, ...rest })=>{
1870
1922
  });
1871
1923
  };
1872
1924
 
1873
- /**
1874
- * A basic link component that extends react-aria-components Link with consistent styling.
1875
- * Provides accessible focus styles and maintains design system consistency.
1876
- */ const CustomLink = ({ children, className, ...restProps })=>{
1877
- return /*#__PURE__*/ jsx(Link, {
1878
- ...restProps,
1879
- 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'),
1880
- children: children
1881
- });
1882
- };
1883
-
1884
1925
  const LinkList = ({ className, children, ...restProps })=>{
1885
1926
  const numberofLinks = Children.count(children);
1886
1927
  return /*#__PURE__*/ jsx("div", {
@@ -1889,7 +1930,7 @@ const LinkList = ({ className, children, ...restProps })=>{
1889
1930
  children: /*#__PURE__*/ jsx("ul", {
1890
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)
1891
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)
1892
- '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
1893
1934
  '@lg:gap-x-12 @md:gap-x-9 @sm:gap-x-4 @xl:gap-x-16', numberofLinks > 5 && [
1894
1935
  '@xl:grid-cols-2',
1895
1936
  (numberofLinks === 9 || numberofLinks > 10) && '@4xl:grid-cols-3'
@@ -1900,26 +1941,26 @@ const LinkList = ({ className, children, ...restProps })=>{
1900
1941
  };
1901
1942
  const LinkListItem = ({ children, isExternal, className, ...restProps })=>{
1902
1943
  let Icon = ArrowRight;
1903
- let iconTransition = 'group-hover:motion-safe:translate-x-1';
1944
+ let iconTransition = cx('group-hover:motion-safe:translate-x-1');
1904
1945
  if (restProps.download) {
1905
1946
  Icon = Download;
1906
- iconTransition = 'group-hover:motion-safe:translate-y-1';
1947
+ iconTransition = cx('group-hover:motion-safe:translate-y-1');
1907
1948
  } else if (isExternal) {
1908
- 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');
1909
1950
  Icon = LinkExternal;
1910
1951
  }
1911
1952
  return /*#__PURE__*/ jsx("li", {
1912
1953
  // Creates divider lines that works in any grid layout and with the focus ring
1913
- 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",
1914
1955
  children: /*#__PURE__*/ jsxs(Link, {
1915
1956
  ...restProps,
1916
- 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'),
1917
1958
  children: [
1918
1959
  /*#__PURE__*/ jsx("span", {
1919
1960
  children: children
1920
1961
  }),
1921
1962
  /*#__PURE__*/ jsx(Icon, {
1922
- className: cx('shrink-0 motion-safe:transition-transform', iconTransition)
1963
+ className: iconTransition
1923
1964
  })
1924
1965
  ]
1925
1966
  })
@@ -2751,4 +2792,4 @@ const VideoLoop = ({ src, format, alt, className })=>{
2751
2792
  });
2752
2793
  };
2753
2794
 
2754
- 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.0",
3
+ "version": "3.1.2",
4
4
  "description": "Grunnmuren components in React",
5
5
  "repository": {
6
6
  "url": "https://github.com/code-obos/grunnmuren"