@obosbbl/grunnmuren-react 3.4.5 → 3.4.7

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.
@@ -109,21 +109,11 @@ const cardVariants = cva.cva({
109
109
  // by setting a higher z-index than the pseudo-element (which implicitly z-index 0)
110
110
  '[&_a:not([data-slot="card-link"])]:z-[1] [&_button]:z-[1] [&_input]:z-[1]',
111
111
  // **** Badge ****
112
- '[&_[data-slot="media"]_[data-slot="badge"]]:absolute [&_[data-slot="media"]_[data-slot="badge"]]:top-0',
112
+ '*:data-[slot=media]:*:data-[slot=badge]:absolute',
113
+ '*:data-[slot=media]:*:data-[slot=badge]:first:top-3.5 *:data-[slot=media]:*:data-[slot=badge]:first:left-3.5',
113
114
  // Increasing z-index Preserves badge position when media content is hovered (the transform scale effect might otherwise move the badge behind the other media content)
114
- '[&_[data-slot="media"]_[data-slot="badge"]]:z-[1]',
115
- // Left aligned - override default corner radius of the badge
116
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-tl-2xl',
117
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-br-2xl',
118
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-tr-none',
119
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-bl-none',
120
- // Right aligned - override default corner radius of the badge
121
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-tl-none',
122
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-br-none',
123
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-tr-2xl',
124
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-bl-2xl',
125
- // ... and position the badge at the right edge of the media content
126
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:right-0'
115
+ '*:data-[slot=media]:*:data-[slot=badge]:z-[1]',
116
+ '*:data-[slot=media]:*:data-[slot=badge]:last:top-3.5 *:data-[slot=media]:*:data-[slot=badge]:last:right-3.5'
127
117
  ],
128
118
  variants: {
129
119
  /**
@@ -107,21 +107,11 @@ const cardVariants = cva({
107
107
  // by setting a higher z-index than the pseudo-element (which implicitly z-index 0)
108
108
  '[&_a:not([data-slot="card-link"])]:z-[1] [&_button]:z-[1] [&_input]:z-[1]',
109
109
  // **** Badge ****
110
- '[&_[data-slot="media"]_[data-slot="badge"]]:absolute [&_[data-slot="media"]_[data-slot="badge"]]:top-0',
110
+ '*:data-[slot=media]:*:data-[slot=badge]:absolute',
111
+ '*:data-[slot=media]:*:data-[slot=badge]:first:top-3.5 *:data-[slot=media]:*:data-[slot=badge]:first:left-3.5',
111
112
  // Increasing z-index Preserves badge position when media content is hovered (the transform scale effect might otherwise move the badge behind the other media content)
112
- '[&_[data-slot="media"]_[data-slot="badge"]]:z-[1]',
113
- // Left aligned - override default corner radius of the badge
114
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-tl-2xl',
115
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-br-2xl',
116
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-tr-none',
117
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-bl-none',
118
- // Right aligned - override default corner radius of the badge
119
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-tl-none',
120
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-br-none',
121
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-tr-2xl',
122
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-bl-2xl',
123
- // ... and position the badge at the right edge of the media content
124
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:right-0'
113
+ '*:data-[slot=media]:*:data-[slot=badge]:z-[1]',
114
+ '*:data-[slot=media]:*:data-[slot=badge]:last:top-3.5 *:data-[slot=media]:*:data-[slot=badge]:last:right-3.5'
125
115
  ],
126
116
  variants: {
127
117
  /**
package/dist/index.d.mts CHANGED
@@ -27,7 +27,7 @@ import { ModalOverlayProps as ModalOverlayProps$1 } from 'react-aria-components/
27
27
  import { NumberFieldProps as NumberFieldProps$1 } from 'react-aria-components/NumberField';
28
28
  import { RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1 } from 'react-aria-components/RadioGroup';
29
29
  import { SelectProps as SelectProps$1 } from 'react-aria-components/Select';
30
- import { ColumnResizerProps, TableProps as TableProps$1, TableBodyProps as TableBodyProps$1, CellProps, ColumnProps, ResizableTableContainerProps, TableHeaderProps as TableHeaderProps$1, RowProps } from 'react-aria-components/Table';
30
+ import { ColumnResizerProps, TableProps as TableProps$1, TableBodyProps as TableBodyProps$1, CellProps, ColumnProps, ResizableTableContainerProps as ResizableTableContainerProps$1, TableHeaderProps as TableHeaderProps$1, RowProps } from 'react-aria-components/Table';
31
31
  import { TabProps as TabProps$1, TabListProps as TabListProps$1, TabPanelProps as TabPanelProps$1, TabsProps as TabsProps$1 } from 'react-aria-components/Tabs';
32
32
  import { TagGroupProps as TagGroupProps$1, TagListProps as TagListProps$1, TagProps as TagProps$1 } from 'react-aria-components/TagGroup';
33
33
  import { TextFieldProps as TextFieldProps$1 } from 'react-aria-components/TextField';
@@ -220,7 +220,7 @@ declare const buttonVariants: (props?: (((VariantProps<(props?: ({
220
220
  className?: cva.ClassValue;
221
221
  })) | undefined) => string> & VariantProps<(props?: ({
222
222
  variant?: "primary" | "secondary" | "tertiary" | undefined;
223
- color?: "blue" | "mint" | "white" | undefined;
223
+ color?: "mint" | "white" | "blue" | undefined;
224
224
  isIconOnly?: boolean | undefined;
225
225
  isPending?: boolean | undefined;
226
226
  } & ({
@@ -245,7 +245,7 @@ type ButtonOrLinkProps = VariantProps<typeof buttonVariants> & {
245
245
  ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;
246
246
  };
247
247
  type ButtonProps = (ButtonProps$1 | LinkProps$1) & ButtonOrLinkProps;
248
- declare const ButtonContext: react.Context<ContextValue<ButtonProps, HTMLButtonElement | HTMLAnchorElement>>;
248
+ declare const ButtonContext: react.Context<ContextValue<ButtonProps, HTMLAnchorElement | HTMLButtonElement>>;
249
249
  declare function Button({ ref, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
250
250
 
251
251
  type CardProps = VariantProps<typeof cardVariants> & HTMLAttributes<HTMLDivElement> & {
@@ -275,8 +275,18 @@ type CardLinkProps = (Omit<LinkProps$1, 'href'> & Required<Pick<LinkProps$1, 'hr
275
275
  */
276
276
  declare const CardLink: ({ className: _className, href, ...restProps }: CardLinkProps) => react_jsx_runtime.JSX.Element;
277
277
 
278
- type CarouselProps = Omit<HTMLProps<HTMLDivElement>, 'onChange' | 'onSelect'> & {
278
+ type CarouselMethods = {
279
+ /** Navigate to a specific slide by index. */
280
+ goToSlide: (index: number) => void;
281
+ /** Navigate to the next slide. */
282
+ goToNextSlide: () => void;
283
+ /** Navigate to the previous slide. */
284
+ goToPrevSlide: () => void;
285
+ };
286
+ type CarouselElement = HTMLDivElement & CarouselMethods;
287
+ type CarouselProps = Omit<HTMLProps<HTMLDivElement>, 'onChange' | 'onSelect' | 'ref'> & {
279
288
  children?: React.ReactNode;
289
+ ref?: React.Ref<CarouselElement>;
280
290
  /**
281
291
  * Alignment of the items relative to the carousel viewport.
282
292
  * @default 'center'
@@ -317,6 +327,7 @@ declare const Carousel: ({ autoPlayDelay, align, children, initialIndex, orienta
317
327
  type CarouselContextValue = {
318
328
  slidesInView: number[];
319
329
  orientation: 'horizontal' | 'vertical';
330
+ '~shouldUseAriaCarouselPattern': boolean;
320
331
  /**
321
332
  * @private
322
333
  */
@@ -331,7 +342,7 @@ type CarouselItemsProps = HTMLProps<HTMLDivElement> & {
331
342
  /** The <CarouselItem/> components to be displayed within the carousel. */
332
343
  children: React.ReactNode;
333
344
  };
334
- declare const CarouselItems: ({ className, children }: CarouselItemsProps) => react_jsx_runtime.JSX.Element;
345
+ declare const CarouselItems: ({ className, children, ...restProps }: CarouselItemsProps) => react_jsx_runtime.JSX.Element;
335
346
  type CarouselControlsProps = HTMLProps<HTMLDivElement> & {
336
347
  /** The <CarouselItem/> components to be displayed within the carousel. */
337
348
  children: React.ReactNode;
@@ -454,7 +465,7 @@ type MediaProps = HTMLProps<HTMLDivElement> & VariantProps<typeof mediaVariant>
454
465
  ref?: Ref<HTMLDivElement>;
455
466
  };
456
467
  declare const mediaVariant: (props?: ({
457
- fit?: "cover" | "contain" | undefined;
468
+ fit?: "contain" | "cover" | undefined;
458
469
  } & ({
459
470
  class?: cva.ClassValue;
460
471
  className?: never;
@@ -552,7 +563,7 @@ declare function ErrorMessage(props: ErrorMessageProps): react_jsx_runtime.JSX.E
552
563
  declare function Label(props: LabelProps): react_jsx_runtime.JSX.Element;
553
564
 
554
565
  declare const linkListContainerVariants: (props?: ({
555
- layout?: "stack" | "grid" | undefined;
566
+ layout?: "grid" | "stack" | undefined;
556
567
  } & ({
557
568
  class?: cva.ClassValue;
558
569
  className?: never;
@@ -582,9 +593,11 @@ type ModalOverlayProps = Omit<ModalOverlayProps$1, 'isDismissable' | 'style'> &
582
593
  zIndex?: number;
583
594
  /** @default true Makes the modal dismissable */
584
595
  isDismissable?: boolean;
596
+ /** @default false When true, the modal takes up the full screen */
597
+ fullscreen?: boolean;
585
598
  };
586
599
  type ModalProps = ModalOverlayProps;
587
- declare const Modal: ({ isDismissable, isOpen, onOpenChange, defaultOpen, className, zIndex, ...restProps }: ModalProps) => react_jsx_runtime.JSX.Element;
600
+ declare const Modal: ({ isDismissable, isOpen, onOpenChange, defaultOpen, className, zIndex, fullscreen, ...restProps }: ModalProps) => react_jsx_runtime.JSX.Element;
588
601
  type DialogProps = DialogProps$1 & {
589
602
  children: React.ReactNode;
590
603
  };
@@ -699,12 +712,13 @@ type StepProps = HTMLProps<HTMLLIElement> & {
699
712
  };
700
713
  declare const Step: ({ isDisabled, state, children, "~stepIndex": stepIndex, progress, ...restProps }: StepProps) => react_jsx_runtime.JSX.Element;
701
714
 
715
+ type TableVariant = 'default' | 'zebra-striped';
702
716
  type TableProps = Omit<TableProps$1, 'aria-label' | 'aria-labelledby'> & RefAttributes<HTMLTableElement> & {
703
717
  /**
704
718
  * Visual variant of the table
705
719
  * @default 'default'
706
720
  */
707
- variant?: 'default' | 'zebra-striped';
721
+ variant?: TableVariant;
708
722
  } & ({
709
723
  'aria-label': string;
710
724
  'aria-labelledby'?: never;
@@ -721,16 +735,23 @@ type TableRowProps = RowProps<object> & RefAttributes<HTMLTableRowElement>;
721
735
  type TableCellProps = CellProps & RefAttributes<HTMLTableCellElement> & {
722
736
  children: React.ReactNode;
723
737
  };
738
+ type TableColumnResizerProps = ColumnResizerProps;
739
+ type ResizableTableContainerProps = ResizableTableContainerProps$1;
724
740
  /**
725
741
  * A container component for displaying tabular data with horizontal scrolling support.
726
742
  */
727
743
  declare function Table(props: TableProps): react_jsx_runtime.JSX.Element;
744
+ /**
745
+ * Container that enables column resizing and horizontal scrolling for the
746
+ * nested <Table>. Use when you want resizable columns or want to apply
747
+ * `maxWidth`/`minWidth` truncation on columns.
748
+ */
749
+ declare function ResizableTableContainer({ className, children, ...restProps }: ResizableTableContainerProps): react_jsx_runtime.JSX.Element;
728
750
  /**
729
751
  * Container for table column headers.
730
752
  */
731
753
  declare function TableHeader({ className, children, ...restProps }: TableHeaderProps): react_jsx_runtime.JSX.Element;
732
754
  declare function TableColumn(props: TableColumnProps): react_jsx_runtime.JSX.Element;
733
- type TableColumnResizerProps = ColumnResizerProps;
734
755
  declare const TableColumnResizer: ({ className, ...restProps }: TableColumnResizerProps) => react_jsx_runtime.JSX.Element;
735
756
  /**
736
757
  * Container for table rows.
@@ -738,8 +759,10 @@ declare const TableColumnResizer: ({ className, ...restProps }: TableColumnResiz
738
759
  declare function TableBody({ className, children, ...restProps }: TableBodyProps): react_jsx_runtime.JSX.Element;
739
760
  declare function TableRow(props: TableRowProps): react_jsx_runtime.JSX.Element;
740
761
  declare function TableCell(props: TableCellProps): react_jsx_runtime.JSX.Element;
741
- type TableContainerProps = ResizableTableContainerProps;
742
- declare const TableContainer: ({ className, ...restProps }: ResizableTableContainerProps) => react_jsx_runtime.JSX.Element;
762
+ /** @deprecated Use `UNSAFE_ResizableTableContainer` instead. */
763
+ declare const UNSAFE_TableContainer: typeof ResizableTableContainer;
764
+ /** @deprecated Use `UNSAFE_ResizableTableContainerProps` instead. */
765
+ type UNSAFE_TableContainerProps = ResizableTableContainerProps;
743
766
 
744
767
  type TabsProps = Omit<TabsProps$1, 'className'> & RefAttributes<HTMLDivElement> & {
745
768
  /**
@@ -897,5 +920,5 @@ type VideoLoopProps = {
897
920
  };
898
921
  declare const VideoLoop: ({ src, format, alt, className }: VideoLoopProps) => react_jsx_runtime.JSX.Element;
899
922
 
900
- 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, CarouselButton as UNSAFE_CarouselButton, CarouselContext as UNSAFE_CarouselContext, CarouselControls as UNSAFE_CarouselControls, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, CarouselItemsContainer as UNSAFE_CarouselItemsContainer, CarouselItemsContainer as UNSAFE_CarouselItemsContainerProps, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, HeroContext as UNSAFE_HeroContext, Link as UNSAFE_Link, Modal as UNSAFE_Modal, Step as UNSAFE_Step, Stepper as UNSAFE_Stepper, 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, _useLocale as useLocale };
901
- 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, CarouselButtonProps as UNSAFE_CarouselButtonProps, CarouselContextValue as UNSAFE_CarouselContextValue, CarouselControlsProps as UNSAFE_CarouselControlsProps, CarouselItemProps as UNSAFE_CarouselItemProps, CarouselItemsProps as UNSAFE_CarouselItemsProps, CarouselProps as UNSAFE_CarouselProps, DialogProps as UNSAFE_DialogProps, DialogTriggerProps as UNSAFE_DialogTriggerProps, FileUploadProps as UNSAFE_FileUploadProps, HeroContextValue as UNSAFE_HeroContextValue, HeroProps as UNSAFE_HeroProps, LinkProps as UNSAFE_LinkProps, ModalProps as UNSAFE_ModalProps, StepProps as UNSAFE_StepProps, StepperProps as UNSAFE_StepperProps, 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 };
923
+ 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, CarouselButton as UNSAFE_CarouselButton, CarouselContext as UNSAFE_CarouselContext, CarouselControls as UNSAFE_CarouselControls, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, CarouselItemsContainer as UNSAFE_CarouselItemsContainer, CarouselItemsContainer as UNSAFE_CarouselItemsContainerProps, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, HeroContext as UNSAFE_HeroContext, Link as UNSAFE_Link, Modal as UNSAFE_Modal, ResizableTableContainer as UNSAFE_ResizableTableContainer, Step as UNSAFE_Step, Stepper as UNSAFE_Stepper, 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, UNSAFE_TableContainer, TableHeader as UNSAFE_TableHeader, TableRow as UNSAFE_TableRow, Tabs as UNSAFE_Tabs, VideoLoop, _useLocale as useLocale };
924
+ 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, CarouselButtonProps as UNSAFE_CarouselButtonProps, CarouselContextValue as UNSAFE_CarouselContextValue, CarouselControlsProps as UNSAFE_CarouselControlsProps, CarouselItemProps as UNSAFE_CarouselItemProps, CarouselItemsProps as UNSAFE_CarouselItemsProps, CarouselProps as UNSAFE_CarouselProps, CarouselElement as UNSAFE_CarouselRef, DialogProps as UNSAFE_DialogProps, DialogTriggerProps as UNSAFE_DialogTriggerProps, FileUploadProps as UNSAFE_FileUploadProps, HeroContextValue as UNSAFE_HeroContextValue, HeroProps as UNSAFE_HeroProps, LinkProps as UNSAFE_LinkProps, ModalProps as UNSAFE_ModalProps, ResizableTableContainerProps as UNSAFE_ResizableTableContainerProps, StepProps as UNSAFE_StepProps, StepperProps as UNSAFE_StepperProps, 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, UNSAFE_TableContainerProps, TableHeaderProps as UNSAFE_TableHeaderProps, TableProps as UNSAFE_TableProps, TableRowProps as UNSAFE_TableRowProps, TabsProps as UNSAFE_TabsProps };
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { RouterProvider } from 'react-aria-components';
3
3
  export { Form, Group } 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, useMemo, useCallback, isValidElement, cloneElement, use } from 'react';
6
+ import { createContext, useContext, useId, useRef, Children, useState, useEffect, useMemo, useCallback, useImperativeHandle, isValidElement, cloneElement, use } from 'react';
7
7
  import { useContextProps, Provider, DEFAULT_SLOT, useSlottedContext } from 'react-aria-components/slots';
8
8
  import { ChevronDown, Error, Warning, CheckCircle, InfoCircle, Close, User, ChevronLeft, ChevronRight, LoadingSpinner, Check, Trash, Download, LinkExternal, ArrowRight, Edit, PlayerPause, PlayerPlay } from '@obosbbl/grunnmuren-icons-react';
9
9
  import { ButtonContext as ButtonContext$1, Button as Button$1 } from 'react-aria-components/Button';
@@ -23,6 +23,8 @@ import Autoplay from 'embla-carousel-autoplay';
23
23
  import useEmblaCarousel from 'embla-carousel-react';
24
24
  import { WheelGesturesPlugin } from 'embla-carousel-wheel-gestures';
25
25
  import { GroupContext, Group } from 'react-aria-components/Group';
26
+ import { Dialog as Dialog$1, DialogTrigger as DialogTrigger$1, OverlayTriggerStateContext } from 'react-aria-components/Dialog';
27
+ import { Modal as Modal$1, ModalOverlay } from 'react-aria-components/Modal';
26
28
  import { CheckboxContext, Checkbox as Checkbox$1 } from 'react-aria-components/Checkbox';
27
29
  import { Text } from 'react-aria-components/Text';
28
30
  import { CheckboxGroup as CheckboxGroup$1 } from 'react-aria-components/CheckboxGroup';
@@ -43,14 +45,13 @@ import { useFormValidationState } from 'react-stately/private/form/useFormValida
43
45
  import { useControlledState } from 'react-stately/useControlledState';
44
46
  import { PressResponder } from 'react-aria/private/interactions/PressResponder';
45
47
  import { useObjectRef } from 'react-aria/useObjectRef';
46
- import { Dialog as Dialog$1, DialogTrigger as DialogTrigger$1 } from 'react-aria-components/Dialog';
47
- import { Modal as Modal$1, ModalOverlay } from 'react-aria-components/Modal';
48
48
  import { NumberField as NumberField$1 } from 'react-aria-components/NumberField';
49
49
  import { Radio as Radio$1, RadioGroup as RadioGroup$1 } from 'react-aria-components/RadioGroup';
50
50
  import { Select as Select$1, SelectValue } from 'react-aria-components/Select';
51
51
  import { ProgressBar as ProgressBar$1 } from 'react-aria-components/ProgressBar';
52
52
  import { useDebouncedCallback } from 'use-debounce';
53
- import { ColumnResizer, Table as Table$1, TableBody as TableBody$1, Cell, Column, ResizableTableContainer, TableHeader as TableHeader$1, Row } from 'react-aria-components/Table';
53
+ import { composeRenderProps } from 'react-aria-components/composeRenderProps';
54
+ import { ColumnResizer, Table as Table$1, TableBody as TableBody$1, Cell, Column, TableHeader as TableHeader$1, Row, ResizableTableContainer as ResizableTableContainer$1 } from 'react-aria-components/Table';
54
55
  import { Tab as Tab$1, TabListStateContext, TabList as TabList$1, TabPanel as TabPanel$1, Tabs as Tabs$1 } from 'react-aria-components/Tabs';
55
56
  import { TagGroup as TagGroup$1, TagList as TagList$1, Tag as Tag$1 } from 'react-aria-components/TagGroup';
56
57
  import { TextArea as TextArea$1 } from 'react-aria-components/TextArea';
@@ -638,9 +639,9 @@ const badgeVariants = cva({
638
639
  variants: {
639
640
  color: {
640
641
  'gray-dark': 'bg-gray-dark text-white',
641
- mint: 'bg-mint',
642
- sky: 'bg-sky',
643
- white: 'bg-white',
642
+ mint: 'bg-mint text-black',
643
+ sky: 'bg-sky text-black',
644
+ white: 'bg-white text-black',
644
645
  'blue-dark': 'bg-blue-dark text-white',
645
646
  'green-dark': 'bg-green-dark text-white'
646
647
  },
@@ -891,21 +892,11 @@ const cardVariants = cva({
891
892
  // by setting a higher z-index than the pseudo-element (which implicitly z-index 0)
892
893
  '[&_a:not([data-slot="card-link"])]:z-[1] [&_button]:z-[1] [&_input]:z-[1]',
893
894
  // **** Badge ****
894
- '[&_[data-slot="media"]_[data-slot="badge"]]:absolute [&_[data-slot="media"]_[data-slot="badge"]]:top-0',
895
+ '*:data-[slot=media]:*:data-[slot=badge]:absolute',
896
+ '*:data-[slot=media]:*:data-[slot=badge]:first:top-3.5 *:data-[slot=media]:*:data-[slot=badge]:first:left-3.5',
895
897
  // Increasing z-index Preserves badge position when media content is hovered (the transform scale effect might otherwise move the badge behind the other media content)
896
- '[&_[data-slot="media"]_[data-slot="badge"]]:z-[1]',
897
- // Left aligned - override default corner radius of the badge
898
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-tl-2xl',
899
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-br-2xl',
900
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-tr-none',
901
- '[&_[data-slot="media"]_[data-slot="badge"]:first-child]:rounded-bl-none',
902
- // Right aligned - override default corner radius of the badge
903
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-tl-none',
904
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-br-none',
905
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-tr-2xl',
906
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:rounded-bl-2xl',
907
- // ... and position the badge at the right edge of the media content
908
- '[&_[data-slot="media"]_[data-slot="badge"]:last-child]:right-0'
898
+ '*:data-[slot=media]:*:data-[slot=badge]:z-[1]',
899
+ '*:data-[slot=media]:*:data-[slot=badge]:last:top-3.5 *:data-[slot=media]:*:data-[slot=badge]:last:right-3.5'
909
900
  ],
910
901
  variants: {
911
902
  /**
@@ -1213,6 +1204,106 @@ const Hero = ({ variant, className, children, ...rest })=>{
1213
1204
  });
1214
1205
  };
1215
1206
 
1207
+ const DialogTrigger = (props)=>/*#__PURE__*/ jsx(DialogTrigger$1, {
1208
+ ...props
1209
+ });
1210
+ const _ModalOverlay = ({ style = {}, zIndex = 10, fullscreen, ...restProps })=>/*#__PURE__*/ jsx(ModalOverlay, {
1211
+ ...restProps,
1212
+ className: ({ isEntering, isExiting })=>cx('fixed inset-0 flex min-h-full items-center justify-center overflow-y-auto bg-black/25 text-center backdrop-blur-sm', !fullscreen && 'p-4', isEntering && 'fade-in animate-in duration-300 ease-out', isExiting && 'fade-out animate-out duration-200 ease-in', // Using the motion-safe class does not work, so we use motion-reduce to overwrite instead
1213
+ 'motion-reduce:animate-none'),
1214
+ style: {
1215
+ zIndex,
1216
+ ...style
1217
+ }
1218
+ });
1219
+ const Modal = ({ isDismissable = true, isOpen, onOpenChange, defaultOpen, className, zIndex, fullscreen = false, ...restProps })=>{
1220
+ const locale = _useLocale();
1221
+ return /*#__PURE__*/ jsx(Provider, {
1222
+ values: [
1223
+ [
1224
+ HeadingContext,
1225
+ {
1226
+ slots: {
1227
+ [DEFAULT_SLOT]: {},
1228
+ title: {
1229
+ className: 'heading-s',
1230
+ _outerWrapper: (children)=>/*#__PURE__*/ jsxs("div", {
1231
+ className: "flex items-center justify-between gap-x-2",
1232
+ children: [
1233
+ children,
1234
+ isDismissable && /*#__PURE__*/ jsx(Button, {
1235
+ slot: "close",
1236
+ variant: "tertiary",
1237
+ className: "data-focus-visible:outline-focus-inset px-2.5!",
1238
+ "aria-label": translations$1.close[locale],
1239
+ onPress: ()=>onOpenChange?.(false),
1240
+ children: /*#__PURE__*/ jsx(Close, {})
1241
+ })
1242
+ ]
1243
+ })
1244
+ }
1245
+ }
1246
+ }
1247
+ ]
1248
+ ],
1249
+ children: /*#__PURE__*/ jsx(_ModalOverlay, {
1250
+ isOpen: isOpen,
1251
+ onOpenChange: onOpenChange,
1252
+ defaultOpen: defaultOpen,
1253
+ isDismissable: isDismissable,
1254
+ zIndex: zIndex,
1255
+ fullscreen: fullscreen,
1256
+ children: /*#__PURE__*/ jsx(Modal$1, {
1257
+ ...restProps,
1258
+ className: ({ isEntering, isExiting })=>cx(className, 'overflow-auto bg-white text-left shadow-xl', fullscreen ? 'fixed inset-0' : 'w-full max-w-md rounded-2xl p-4 align-middle', isEntering && 'zoom-in-95 animate-in duration-300 ease-out', isExiting && 'zoom-out-95 animate-out duration-200 ease-in', // Using the motion-safe class does not work, so we use motion-reduce to overwrite instead
1259
+ 'motion-reduce:animate-none')
1260
+ })
1261
+ })
1262
+ });
1263
+ };
1264
+ const Dialog = ({ className, children, ...restProps })=>/*#__PURE__*/ jsx(Dialog$1, {
1265
+ ...restProps,
1266
+ className: cx(className, 'relative flex flex-col gap-y-5 outline-none', // Footer
1267
+ '**:data-[slot="footer"]:flex **:data-[slot="footer"]:gap-x-2'),
1268
+ children: ({ close })=>/*#__PURE__*/ jsx(Provider, {
1269
+ values: [
1270
+ [
1271
+ ButtonContext$1,
1272
+ {
1273
+ // This is necessary to support multiple close buttons
1274
+ slots: {
1275
+ // We need to define default slot in order to also support non-slotted buttons (i.e. buttons without slot prop)
1276
+ [DEFAULT_SLOT]: {
1277
+ className: 'w-fit'
1278
+ },
1279
+ close: {
1280
+ onPress: close,
1281
+ className: 'w-fit'
1282
+ }
1283
+ }
1284
+ }
1285
+ ]
1286
+ ],
1287
+ children: children
1288
+ })
1289
+ });
1290
+ /**
1291
+ * Reset the ButtonContext from react-aria-components that Dialog provides
1292
+ * (only allows "close" slot) so nested components can set up their own
1293
+ * button slots (e.g. Carousel's "prev" / "next").
1294
+ */ const _ModalButtonContextReset = ({ children })=>{
1295
+ const isInsideOverlay = !!useContext(OverlayTriggerStateContext);
1296
+ return isInsideOverlay ? /*#__PURE__*/ jsx(Provider, {
1297
+ values: [
1298
+ [
1299
+ ButtonContext$1,
1300
+ null
1301
+ ]
1302
+ ],
1303
+ children: children
1304
+ }) : children;
1305
+ };
1306
+
1216
1307
  /**
1217
1308
  * Hook that detects the user's preference for reduced motion.
1218
1309
  *
@@ -1284,13 +1375,18 @@ const Carousel = ({ autoPlayDelay, align = 'center', children, initialIndex = 0,
1284
1375
  loop,
1285
1376
  prefersReducedMotion
1286
1377
  ]);
1287
- const [emblaRef, emblaApi] = useEmblaCarousel({
1378
+ const emblaOptions = useMemo(()=>({
1379
+ align,
1380
+ loop,
1381
+ startIndex: initialIndex,
1382
+ axis: orientation === 'horizontal' ? 'x' : 'y'
1383
+ }), [
1288
1384
  align,
1289
1385
  loop,
1290
- startIndex: initialIndex,
1291
- axis: orientation === 'horizontal' ? 'x' : 'y',
1292
- inViewThreshold: 0.2
1293
- }, emblaPlugins);
1386
+ initialIndex,
1387
+ orientation
1388
+ ]);
1389
+ const [emblaRef, emblaApi] = useEmblaCarousel(emblaOptions, emblaPlugins);
1294
1390
  const [slidesInView, setSlidesInView] = useState([
1295
1391
  initialIndex
1296
1392
  ]);
@@ -1308,6 +1404,7 @@ const Carousel = ({ autoPlayDelay, align = 'center', children, initialIndex = 0,
1308
1404
  switch(type){
1309
1405
  case 'select':
1310
1406
  onSelect?.(scrollSnapIndex);
1407
+ setSlidesInView(emblaApi.slidesInView());
1311
1408
  setCanScrollNext(emblaApi.canScrollNext());
1312
1409
  setCanScrollPrev(emblaApi.canScrollPrev());
1313
1410
  break;
@@ -1328,6 +1425,7 @@ const Carousel = ({ autoPlayDelay, align = 'center', children, initialIndex = 0,
1328
1425
  }
1329
1426
  case 'init':
1330
1427
  {
1428
+ setSlidesInView(emblaApi.slidesInView());
1331
1429
  setCanScrollNext(emblaApi.canScrollNext());
1332
1430
  setCanScrollPrev(emblaApi.canScrollPrev());
1333
1431
  break;
@@ -1401,6 +1499,19 @@ const Carousel = ({ autoPlayDelay, align = 'center', children, initialIndex = 0,
1401
1499
  handlePrevPress,
1402
1500
  emblaApi
1403
1501
  ]);
1502
+ useImperativeHandle(ref, ()=>{
1503
+ const el = carouselRef.current;
1504
+ if (!el) {
1505
+ return el; // Just to satisfy the return type, this case should never actually happen
1506
+ }
1507
+ el.goToSlide = (index)=>emblaApi?.scrollTo(index, prefersReducedMotion);
1508
+ el.goToNextSlide = ()=>emblaApi?.scrollNext(prefersReducedMotion);
1509
+ el.goToPrevSlide = ()=>emblaApi?.scrollPrev(prefersReducedMotion);
1510
+ return el;
1511
+ }, [
1512
+ emblaApi,
1513
+ prefersReducedMotion
1514
+ ]);
1404
1515
  const hasHeroContext = !!useContext(HeroContext);
1405
1516
  const nextPrevStyles = hasHeroContext ? {
1406
1517
  color: 'white',
@@ -1408,82 +1519,107 @@ const Carousel = ({ autoPlayDelay, align = 'center', children, initialIndex = 0,
1408
1519
  } : {
1409
1520
  variant: 'tertiary'
1410
1521
  };
1522
+ const shouldUseAriaCarouselPattern = !autoPlayDelay;
1411
1523
  return(// oxlint-disable-next-line jsx-a11y/no-static-element-interactions
1412
1524
  /*#__PURE__*/ jsx("div", {
1413
1525
  ...rest,
1526
+ role: shouldUseAriaCarouselPattern ? 'region' : undefined,
1527
+ "aria-roledescription": shouldUseAriaCarouselPattern ? 'carousel' : undefined,
1414
1528
  "data-orientation": orientation,
1415
1529
  "data-slot": "carousel",
1416
- ref: mergeRefs(ref, carouselRef),
1530
+ ref: carouselRef,
1417
1531
  onKeyDown: handleKeyDown,
1418
- children: /*#__PURE__*/ jsx(Provider, {
1419
- values: [
1420
- [
1421
- CarouselContext,
1422
- {
1423
- slidesInView,
1424
- '~emblaRef': emblaRef,
1425
- orientation
1426
- }
1427
- ],
1428
- [
1429
- ButtonContext,
1430
- {
1431
- slots: {
1432
- [DEFAULT_SLOT]: {},
1433
- prev: {
1434
- 'aria-label': translations$1.previous[locale],
1435
- isDisabled: !canScrollPrev,
1436
- onPress: handlePrevPress,
1437
- ...nextPrevStyles
1438
- },
1439
- next: {
1440
- 'aria-label': translations$1.next[locale],
1441
- isDisabled: !canScrollNext,
1442
- onPress: handleNextPress,
1443
- ...nextPrevStyles
1532
+ children: /*#__PURE__*/ jsx(_ModalButtonContextReset, {
1533
+ children: /*#__PURE__*/ jsx(Provider, {
1534
+ values: [
1535
+ [
1536
+ CarouselContext,
1537
+ {
1538
+ slidesInView,
1539
+ '~emblaRef': emblaRef,
1540
+ orientation,
1541
+ '~shouldUseAriaCarouselPattern': shouldUseAriaCarouselPattern
1542
+ }
1543
+ ],
1544
+ [
1545
+ ButtonContext,
1546
+ {
1547
+ slots: {
1548
+ [DEFAULT_SLOT]: {},
1549
+ prev: {
1550
+ 'aria-label': translations$1.previous[locale],
1551
+ isDisabled: !canScrollPrev,
1552
+ onPress: handlePrevPress,
1553
+ ...nextPrevStyles
1554
+ },
1555
+ next: {
1556
+ 'aria-label': translations$1.next[locale],
1557
+ isDisabled: !canScrollNext,
1558
+ onPress: handleNextPress,
1559
+ ...nextPrevStyles
1560
+ }
1444
1561
  }
1445
1562
  }
1446
- }
1447
- ]
1448
- ],
1449
- children: children
1563
+ ]
1564
+ ],
1565
+ children: children
1566
+ })
1450
1567
  })
1451
1568
  }));
1452
1569
  };
1570
+ const CarouselItemIndexContext = /*#__PURE__*/ createContext(0);
1453
1571
  const CarouselContext = /*#__PURE__*/ createContext({
1454
1572
  '~emblaRef': null,
1455
1573
  orientation: 'horizontal',
1456
- slidesInView: []
1574
+ slidesInView: [],
1575
+ '~shouldUseAriaCarouselPattern': true
1457
1576
  });
1458
1577
  const CarouselItemsContainer = ({ children, className, ...rest })=>{
1459
- const { '~emblaRef': emblaRef } = useContext(CarouselContext);
1578
+ const { '~emblaRef': emblaRef, '~shouldUseAriaCarouselPattern': shouldUseAriaCarouselPattern } = useContext(CarouselContext);
1460
1579
  return /*#__PURE__*/ jsx("div", {
1461
1580
  className: cx(className, 'overflow-hidden'),
1462
1581
  ref: emblaRef,
1463
1582
  "data-slot": "carousel-items-container",
1464
1583
  ...rest,
1584
+ "aria-live": shouldUseAriaCarouselPattern ? 'polite' : undefined,
1585
+ "aria-atomic": shouldUseAriaCarouselPattern ? false : undefined,
1465
1586
  children: children
1466
1587
  });
1467
1588
  };
1468
- const CarouselItems = ({ className, children })=>{
1589
+ const CarouselItems = ({ className, children, ...restProps })=>{
1469
1590
  const { orientation } = useContext(CarouselContext);
1591
+ let itemIndex = 0;
1470
1592
  return /*#__PURE__*/ jsx("div", {
1471
1593
  className: cx(className, 'flex', orientation === 'vertical' && 'flex-col'),
1472
1594
  "data-slot": "carousel-items",
1473
- children: children
1595
+ ...restProps,
1596
+ children: Children.map(children, (child)=>{
1597
+ if (/*#__PURE__*/ isValidElement(child)) {
1598
+ const currentIndex = itemIndex++;
1599
+ return /*#__PURE__*/ jsx(CarouselItemIndexContext.Provider, {
1600
+ value: currentIndex,
1601
+ children: child
1602
+ });
1603
+ }
1604
+ return child;
1605
+ })
1474
1606
  });
1475
1607
  };
1476
1608
  /**
1477
1609
  * This is internal for now, but we will expose it in the future when we support more flexible positioning of prev/next and other actions.
1478
1610
  * It is used to render the prev/next buttons in the carousel for now.
1479
- */ const CarouselControls = ({ children, className, ...rest })=>/*#__PURE__*/ jsx("div", {
1611
+ */ const CarouselControls = ({ children, className, ...rest })=>{
1612
+ const { '~shouldUseAriaCarouselPattern': shouldUseAriaCarouselPattern } = useContext(CarouselContext);
1613
+ return /*#__PURE__*/ jsx("div", {
1480
1614
  className: cx(className, 'flex justify-end gap-x-2'),
1481
1615
  "data-slot": "carousel-controls",
1482
1616
  ...rest,
1483
- // All items of the carousel are accessible to the screen reader at all times, so these controls will only confuse screen reader users
1484
- "aria-hidden": "true",
1617
+ // When not using the aria carousel pattern, all items are accessible to the screen reader at all times,
1618
+ // so these controls will only confuse screen reader users
1619
+ "aria-hidden": !shouldUseAriaCarouselPattern,
1485
1620
  children: children
1486
1621
  });
1622
+ };
1487
1623
  const carouselButtonVariants = cva({
1488
1624
  base: 'group data-disabled:invisible'
1489
1625
  });
@@ -1542,10 +1678,15 @@ const CarouselButton = ({ className, isIconOnly = true, slot, ...rest })=>{
1542
1678
  });
1543
1679
  };
1544
1680
  const CarouselItem = ({ className, children, ...rest })=>{
1681
+ const itemIndex = useContext(CarouselItemIndexContext);
1682
+ const { slidesInView, '~shouldUseAriaCarouselPattern': shouldUseAriaCarouselPattern } = useContext(CarouselContext);
1545
1683
  return /*#__PURE__*/ jsx("div", {
1546
1684
  ...rest,
1685
+ inert: shouldUseAriaCarouselPattern && !slidesInView.includes(itemIndex) ? true : undefined,
1547
1686
  className: cx(className, 'min-w-0 shrink-0 grow-0', '*:data-[slot=media]:aspect-square', '*:data-[slot=media]:max-sm:data-[fit="contain"]:*:object-cover', '*:data-[slot=media]:sm:aspect-4/3', '*:data-[slot=media]:md:aspect-3/2', '*:data-[slot=media]:lg:aspect-2/1', '*:data-[slot=media]:*:h-full', '*:data-[slot=media]:*:w-full', '*:data-[slot=media]:data-[fit="contain"]:bg-blue-dark'),
1548
1687
  "data-slot": "carousel-item",
1688
+ role: shouldUseAriaCarouselPattern ? 'group' : undefined,
1689
+ "aria-roledescription": shouldUseAriaCarouselPattern ? 'slide' : undefined,
1549
1690
  children: /*#__PURE__*/ jsx(Provider, {
1550
1691
  values: [
1551
1692
  [
@@ -2222,89 +2363,6 @@ const LinkListItem = ({ children, className, ...props })=>{
2222
2363
  });
2223
2364
  };
2224
2365
 
2225
- const DialogTrigger = (props)=>/*#__PURE__*/ jsx(DialogTrigger$1, {
2226
- ...props
2227
- });
2228
- const _ModalOverlay = ({ style = {}, zIndex = 10, ...restProps })=>/*#__PURE__*/ jsx(ModalOverlay, {
2229
- ...restProps,
2230
- className: ({ isEntering, isExiting })=>cx('fixed inset-0 flex min-h-full items-center justify-center overflow-y-auto bg-black/25 p-4 text-center backdrop-blur-sm', isEntering && 'fade-in animate-in duration-300 ease-out', isExiting && 'fade-out animate-out duration-200 ease-in', // Using the motion-safe class does not work, so we use motion-reduce to overwrite instead
2231
- 'motion-reduce:animate-none'),
2232
- style: {
2233
- zIndex,
2234
- ...style
2235
- }
2236
- });
2237
- const Modal = ({ isDismissable = true, isOpen, onOpenChange, defaultOpen, className, zIndex, ...restProps })=>{
2238
- const locale = _useLocale();
2239
- return /*#__PURE__*/ jsx(Provider, {
2240
- values: [
2241
- [
2242
- HeadingContext,
2243
- {
2244
- slots: {
2245
- [DEFAULT_SLOT]: {},
2246
- title: {
2247
- className: 'heading-s',
2248
- _outerWrapper: (children)=>/*#__PURE__*/ jsxs("div", {
2249
- className: "flex items-center justify-between gap-x-2",
2250
- children: [
2251
- children,
2252
- isDismissable && /*#__PURE__*/ jsx(Button, {
2253
- slot: "close",
2254
- variant: "tertiary",
2255
- className: "data-focus-visible:outline-focus-inset px-2.5!",
2256
- "aria-label": translations$1.close[locale],
2257
- onPress: ()=>onOpenChange?.(false),
2258
- children: /*#__PURE__*/ jsx(Close, {})
2259
- })
2260
- ]
2261
- })
2262
- }
2263
- }
2264
- }
2265
- ]
2266
- ],
2267
- children: /*#__PURE__*/ jsx(_ModalOverlay, {
2268
- isOpen: isOpen,
2269
- onOpenChange: onOpenChange,
2270
- defaultOpen: defaultOpen,
2271
- isDismissable: isDismissable,
2272
- zIndex: zIndex,
2273
- children: /*#__PURE__*/ jsx(Modal$1, {
2274
- ...restProps,
2275
- className: ({ isEntering, isExiting })=>cx(className, 'w-full max-w-md overflow-hidden rounded-2xl bg-white p-4 text-left align-middle shadow-xl', isEntering && 'zoom-in-95 animate-in duration-300 ease-out', isExiting && 'zoom-out-95 animate-out duration-200 ease-in', // Using the motion-safe class does not work, so we use motion-reduce to overwrite instead
2276
- 'motion-reduce:animate-none')
2277
- })
2278
- })
2279
- });
2280
- };
2281
- const Dialog = ({ className, children, ...restProps })=>/*#__PURE__*/ jsx(Dialog$1, {
2282
- ...restProps,
2283
- className: cx(className, 'relative grid gap-y-5 outline-none', // Footer
2284
- '**:data-[slot="footer"]:flex **:data-[slot="footer"]:gap-x-2'),
2285
- children: ({ close })=>/*#__PURE__*/ jsx(Provider, {
2286
- values: [
2287
- [
2288
- ButtonContext$1,
2289
- {
2290
- // This is necessary to support multiple close buttons
2291
- slots: {
2292
- // We need to define default slot in order to also support non-slotted buttons (i.e. buttons without slot prop)
2293
- [DEFAULT_SLOT]: {
2294
- className: 'w-fit'
2295
- },
2296
- close: {
2297
- onPress: close,
2298
- className: 'w-fit'
2299
- }
2300
- }
2301
- }
2302
- ]
2303
- ],
2304
- children: children
2305
- })
2306
- });
2307
-
2308
2366
  // This component is based on a copy of ../textfield/TextField, refactoring is TBD: https://github.com/code-obos/grunnmuren/pull/722#issuecomment-1931478786
2309
2367
  const inputVariants$1 = compose(input, cva({
2310
2368
  base: '',
@@ -2386,7 +2444,7 @@ const defaultClasses = cx([
2386
2444
  'data-focus-visible:before:ring-focus-offset',
2387
2445
  // invalid - The border is 1 px thicker when invalid. We don't actually want to change the border width, as that causes the element's size to change
2388
2446
  // so we use an inner outline to artifically pad the border
2389
- 'data-invalid:data-selected:before:bg-red! data-invalid:before:border-red data-invalid:before:outline-red data-invalid:before:outline data-invalid:before:outline-[3px] data-invalid:before:outline-offset-[-3px] data-invalid:before:outline-solid'
2447
+ 'data-invalid:data-selected:before:bg-red! data-invalid:before:border-red data-invalid:before:outline-red data-invalid:before:outline-3 data-invalid:before:outline-offset-[-3px] data-invalid:before:outline-solid'
2390
2448
  ]);
2391
2449
  function Radio(props) {
2392
2450
  const { children, className, description, ...restProps } = props;
@@ -2703,33 +2761,28 @@ const Step = ({ isDisabled = false, state, children, '~stepIndex': stepIndex, pr
2703
2761
  });
2704
2762
  };
2705
2763
 
2706
- const tableVariants = cva({
2707
- base: [
2708
- 'relative'
2709
- ],
2710
- variants: {
2711
- variant: {
2712
- default: '',
2713
- 'zebra-striped': ''
2714
- }
2715
- }
2716
- });
2764
+ const _ResizableTableContainerContext = /*#__PURE__*/ createContext(null);
2717
2765
  const tableRowVariants = cva({
2718
2766
  base: [
2767
+ 'group/row',
2719
2768
  'data-focus-visible:outline-focus-inset',
2720
- 'group-data-[variant=zebra-striped]:odd:bg-white',
2721
- 'group-data-[variant=zebra-striped]:even:bg-sky-lightest'
2769
+ 'group-data-[variant=zebra-striped]/table:odd:bg-white',
2770
+ 'group-data-[variant=zebra-striped]/table:even:bg-sky-lightest',
2771
+ // When the row has expandable children, the chevron button makes the
2772
+ // row taller than a plain text row. Center-align the cells' content so
2773
+ // the chevron icon lines up with text in sibling cells.
2774
+ 'data-has-child-items:*:align-middle'
2722
2775
  ]
2723
2776
  });
2724
- // Used to deal with showing or hiding scroll indicators during column resizing
2725
- const TableScrollContainerContext = /*#__PURE__*/ createContext({
2726
- isResizing: false
2727
- });
2728
2777
  /**
2729
- * A container component for displaying tabular data with horizontal scrolling support.
2730
- */ function Table(props) {
2731
- const { className, children, variant = 'default', ...restProps } = props;
2732
- const { isResizing } = useContext(TableScrollContainerContext);
2778
+ * Shared scroll wrapper that renders an overflow container with left/right
2779
+ * scroll indicators around the table. If it is rendered inside a
2780
+ * <ResizableTableContainer>, the overflow element is RAC's
2781
+ * <ResizableTableContainer> (required for column resizing to measure column
2782
+ * widths against the correct scroll viewport); otherwise it is a plain div.
2783
+ */ function ScrollWrapper({ children }) {
2784
+ const containerCtx = useContext(_ResizableTableContainerContext);
2785
+ const [isResizing, setIsResizing] = useState(false);
2733
2786
  const { scrollContainerRef, canScrollLeft, canScrollRight, hasScrollingOccurred } = useHorizontalScroll([
2734
2787
  isResizing
2735
2788
  ]);
@@ -2744,43 +2797,76 @@ const TableScrollContainerContext = /*#__PURE__*/ createContext({
2744
2797
  }, [
2745
2798
  scrollContainerRef
2746
2799
  ]);
2747
- return /*#__PURE__*/ jsx("div", {
2748
- className: tableVariants({
2749
- className,
2750
- variant
2751
- }),
2752
- children: /*#__PURE__*/ jsxs("div", {
2753
- className: "relative overflow-hidden",
2754
- children: [
2755
- /*#__PURE__*/ jsx("div", {
2756
- ref: scrollContainerRef,
2757
- className: "scrollbar-hidden overflow-x-auto",
2758
- style: {
2759
- WebkitOverflowScrolling: 'touch'
2760
- },
2761
- children: /*#__PURE__*/ jsx(Table$1, {
2762
- ...restProps,
2763
- className: "group w-full min-w-fit",
2764
- "data-variant": variant,
2765
- children: children
2766
- })
2767
- }),
2768
- /*#__PURE__*/ jsx(ScrollButton, {
2769
- direction: "left",
2770
- onClick: ()=>handleScroll('left'),
2771
- isVisible: canScrollLeft,
2772
- hasScrollingOccurred: hasScrollingOccurred
2773
- }),
2774
- /*#__PURE__*/ jsx(ScrollButton, {
2775
- direction: "right",
2776
- onClick: ()=>handleScroll('right'),
2777
- isVisible: canScrollRight,
2778
- hasScrollingOccurred: hasScrollingOccurred
2779
- })
2780
- ]
2800
+ const scrollClasses = 'scrollbar-hidden overflow-x-auto';
2801
+ const touchStyle = {
2802
+ WebkitOverflowScrolling: 'touch'
2803
+ };
2804
+ return /*#__PURE__*/ jsxs("div", {
2805
+ className: "relative overflow-hidden",
2806
+ children: [
2807
+ containerCtx ? /*#__PURE__*/ jsx(ResizableTableContainer$1, {
2808
+ ...containerCtx.resizableProps,
2809
+ ref: scrollContainerRef,
2810
+ className: cx(scrollClasses, containerCtx.resizableProps.className),
2811
+ style: touchStyle,
2812
+ onResizeStart: (widths)=>{
2813
+ setIsResizing(true);
2814
+ containerCtx.resizableProps.onResizeStart?.(widths);
2815
+ },
2816
+ onResizeEnd: (widths)=>{
2817
+ setIsResizing(false);
2818
+ containerCtx.resizableProps.onResizeEnd?.(widths);
2819
+ },
2820
+ children: children
2821
+ }) : /*#__PURE__*/ jsx("div", {
2822
+ ref: scrollContainerRef,
2823
+ className: scrollClasses,
2824
+ style: touchStyle,
2825
+ children: children
2826
+ }),
2827
+ /*#__PURE__*/ jsx(ScrollButton, {
2828
+ direction: "left",
2829
+ onClick: ()=>handleScroll('left'),
2830
+ isVisible: canScrollLeft,
2831
+ hasScrollingOccurred: hasScrollingOccurred
2832
+ }),
2833
+ /*#__PURE__*/ jsx(ScrollButton, {
2834
+ direction: "right",
2835
+ onClick: ()=>handleScroll('right'),
2836
+ isVisible: canScrollRight,
2837
+ hasScrollingOccurred: hasScrollingOccurred
2838
+ })
2839
+ ]
2840
+ });
2841
+ }
2842
+ /**
2843
+ * A container component for displaying tabular data with horizontal scrolling support.
2844
+ */ function Table(props) {
2845
+ const { className, children, variant = 'default', ...restProps } = props;
2846
+ return /*#__PURE__*/ jsx(ScrollWrapper, {
2847
+ children: /*#__PURE__*/ jsx(Table$1, {
2848
+ ...restProps,
2849
+ className: cx(className, 'group/table w-full min-w-fit'),
2850
+ "data-variant": variant,
2851
+ children: children
2781
2852
  })
2782
2853
  });
2783
2854
  }
2855
+ /**
2856
+ * Container that enables column resizing and horizontal scrolling for the
2857
+ * nested <Table>. Use when you want resizable columns or want to apply
2858
+ * `maxWidth`/`minWidth` truncation on columns.
2859
+ */ function ResizableTableContainer({ className, children, ...restProps }) {
2860
+ return /*#__PURE__*/ jsx(_ResizableTableContainerContext.Provider, {
2861
+ value: {
2862
+ resizableProps: {
2863
+ ...restProps,
2864
+ className: cx(className, '**:data-[slot=table-column]:overflow-hidden **:data-[slot=table-column]:text-ellipsis', '**:data-[slot=table-cell]:overflow-hidden **:data-[slot=table-cell]:text-ellipsis')
2865
+ }
2866
+ },
2867
+ children: children
2868
+ });
2869
+ }
2784
2870
  /**
2785
2871
  * Container for table column headers.
2786
2872
  */ function TableHeader({ className, children, ...restProps }) {
@@ -2827,30 +2913,32 @@ function TableCell(props) {
2827
2913
  const { className, children, ...restProps } = props;
2828
2914
  return /*#__PURE__*/ jsx(Cell, {
2829
2915
  ...restProps,
2830
- className: cx(className, 'px-4 py-3 text-sm/relaxed text-black', 'min-w-fit whitespace-nowrap', 'align-top', 'data-focus-visible:outline-focus-inset'),
2916
+ className: cx(className, 'px-4 py-3 text-sm/relaxed text-black', 'min-w-fit whitespace-nowrap', 'align-top', 'data-focus-visible:outline-focus-inset', // When this cell is in the column designated by `treeColumn` and
2917
+ // its row has nested child rows, we render an expand/collapse button
2918
+ // (see composeRenderProps below). Use flex so the button lines up
2919
+ // nicely next to the cell content.
2920
+ 'data-tree-column:flex data-tree-column:items-center data-tree-column:gap-2'),
2831
2921
  "data-slot": "table-cell",
2832
- children: children
2922
+ children: composeRenderProps(children, (resolved, { isTreeColumn, hasChildItems })=>/*#__PURE__*/ jsxs(Fragment, {
2923
+ children: [
2924
+ isTreeColumn && hasChildItems && /*#__PURE__*/ jsx(Button, {
2925
+ slot: "chevron",
2926
+ variant: "tertiary",
2927
+ isIconOnly: true,
2928
+ className: "-my-1 group-data-expanded/row:[&_svg]:rotate-90",
2929
+ children: /*#__PURE__*/ jsx(ChevronRight, {
2930
+ className: "transition-transform duration-300 motion-reduce:transition-none"
2931
+ })
2932
+ }),
2933
+ resolved
2934
+ ]
2935
+ }))
2833
2936
  });
2834
2937
  }
2835
- const TableContainer = ({ className, ...restProps })=>{
2836
- const [isResizing, setIsResizing] = useState(false);
2837
- return /*#__PURE__*/ jsx(Provider, {
2838
- values: [
2839
- [
2840
- TableScrollContainerContext,
2841
- {
2842
- isResizing
2843
- }
2844
- ]
2845
- ],
2846
- children: /*#__PURE__*/ jsx(ResizableTableContainer, {
2847
- ...restProps,
2848
- className: cx(className, '**:data-[slot=table-column]:overflow-hidden **:data-[slot=table-column]:text-ellipsis', '**:data-[slot=table-cell]:overflow-hidden **:data-[slot=table-cell]:text-ellipsis'),
2849
- onResizeStart: ()=>setIsResizing(true),
2850
- onResizeEnd: ()=>setIsResizing(false)
2851
- })
2852
- });
2853
- };
2938
+ // Deprecated aliases kept for backwards compatibility during the UNSAFE_ phase.
2939
+ // Remove these once the Table component is stabilized and the UNSAFE_ prefix
2940
+ // is dropped.
2941
+ /** @deprecated Use `UNSAFE_ResizableTableContainer` instead. */ const UNSAFE_TableContainer = ResizableTableContainer;
2854
2942
 
2855
2943
  const tabsVariants = cva({
2856
2944
  base: [
@@ -3244,4 +3332,4 @@ const VideoLoop = ({ src, format, alt, className })=>{
3244
3332
  });
3245
3333
  };
3246
3334
 
3247
- 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, CarouselButton as UNSAFE_CarouselButton, CarouselContext as UNSAFE_CarouselContext, CarouselControls as UNSAFE_CarouselControls, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, CarouselItemsContainer as UNSAFE_CarouselItemsContainer, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, HeroContext as UNSAFE_HeroContext, Link as UNSAFE_Link, Modal as UNSAFE_Modal, Step as UNSAFE_Step, Stepper as UNSAFE_Stepper, 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, _useLocale as useLocale };
3335
+ 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, CarouselButton as UNSAFE_CarouselButton, CarouselContext as UNSAFE_CarouselContext, CarouselControls as UNSAFE_CarouselControls, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, CarouselItemsContainer as UNSAFE_CarouselItemsContainer, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, HeroContext as UNSAFE_HeroContext, Link as UNSAFE_Link, Modal as UNSAFE_Modal, ResizableTableContainer as UNSAFE_ResizableTableContainer, Step as UNSAFE_Step, Stepper as UNSAFE_Stepper, 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, UNSAFE_TableContainer, 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.4.5",
3
+ "version": "3.4.7",
4
4
  "description": "Grunnmuren components in React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,7 +18,6 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@obosbbl/grunnmuren-icons-react": "^2.1.2",
22
21
  "cva": "^1.0.0-0",
23
22
  "embla-carousel-autoplay": "^8.6.0",
24
23
  "embla-carousel-react": "^8.6.0",
@@ -26,11 +25,12 @@
26
25
  "react-aria": "^3.48.0",
27
26
  "react-aria-components": "^1.17.0",
28
27
  "react-stately": "^3.46.0",
29
- "use-debounce": "^10.0.4"
28
+ "use-debounce": "^10.0.4",
29
+ "@obosbbl/grunnmuren-icons-react": "^2.2.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^24.0.0",
33
- "tailwindcss": "4.2.1"
33
+ "tailwindcss": "4.2.2"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^19"