@obosbbl/grunnmuren-react 3.2.1 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { DisclosureProps as DisclosureProps$1, ButtonProps as ButtonProps$1, LinkProps as LinkProps$1, ContextValue, BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1, 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, ColumnResizerProps, TableProps as TableProps$1, TableBodyProps as TableBodyProps$1, CellProps, ColumnProps, ResizableTableContainerProps, 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, ContextValue, BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1, 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 as ModalOverlayProps$1, NumberFieldProps as NumberFieldProps$1, ProgressBarProps as ProgressBarProps$1, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, SelectProps as SelectProps$1, ColumnResizerProps, TableProps as TableProps$1, TableBodyProps as TableBodyProps$1, CellProps, ColumnProps, ResizableTableContainerProps, 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, DisclosureGroup, DisclosureGroupProps, Form, Group, LabelProps, ListBoxItemProps as SelectItemProps } from 'react-aria-components';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
@@ -165,7 +165,7 @@ declare function Breadcrumbs(props: BreadcrumbsProps): react_jsx_runtime.JSX.Ele
165
165
  */
166
166
  declare const buttonVariants: (props?: ({
167
167
  variant?: "primary" | "secondary" | "tertiary" | undefined;
168
- color?: "blue" | "mint" | "white" | undefined;
168
+ color?: "mint" | "white" | "blue" | undefined;
169
169
  isIconOnly?: boolean | undefined;
170
170
  isPending?: boolean | undefined;
171
171
  } & ({
@@ -192,7 +192,7 @@ type CardProps = VariantProps<typeof cardVariants> & HTMLAttributes<HTMLDivEleme
192
192
  };
193
193
  declare const cardVariants: (props?: ({
194
194
  variant?: "subtle" | "outlined" | undefined;
195
- layout?: "vertical" | "horizontal" | undefined;
195
+ layout?: "horizontal" | "vertical" | undefined;
196
196
  } & ({
197
197
  class?: cva.ClassValue;
198
198
  className?: never;
@@ -349,7 +349,7 @@ type MediaProps = HTMLProps<HTMLDivElement> & VariantProps<typeof mediaVariant>
349
349
  ref?: Ref<HTMLDivElement>;
350
350
  };
351
351
  declare const mediaVariant: (props?: ({
352
- fit?: "cover" | "contain" | undefined;
352
+ fit?: "contain" | "cover" | undefined;
353
353
  } & ({
354
354
  class?: cva.ClassValue;
355
355
  className?: never;
@@ -456,8 +456,14 @@ declare const LinkListItem: (props: LinkListItemProps) => react_jsx_runtime.JSX.
456
456
 
457
457
  type DialogTriggerProps = DialogTriggerProps$1;
458
458
  declare const DialogTrigger: (props: DialogTriggerProps) => react_jsx_runtime.JSX.Element;
459
- type ModalProps = Omit<ModalOverlayProps, 'isDismissable'>;
460
- declare const Modal: ({ className, ...restProps }: ModalProps) => react_jsx_runtime.JSX.Element;
459
+ type ModalOverlayProps = Omit<ModalOverlayProps$1, 'isDismissable'> & {
460
+ /** @default 10 Controls the z-index of the modal overlay */
461
+ zIndex?: number;
462
+ /** @default true Makes the modal dismissable */
463
+ isDismissable?: boolean;
464
+ };
465
+ type ModalProps = ModalOverlayProps;
466
+ declare const Modal: ({ isDismissable, isOpen, onOpenChange, defaultOpen, className, zIndex, ...restProps }: ModalProps) => react_jsx_runtime.JSX.Element;
461
467
  type DialogProps = DialogProps$1 & {
462
468
  children: React.ReactNode;
463
469
  };
@@ -498,6 +504,13 @@ type NumberFieldProps = {
498
504
  } & Omit<NumberFieldProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style' | 'hideStepper'>;
499
505
  declare function NumberField(props: NumberFieldProps): react_jsx_runtime.JSX.Element;
500
506
 
507
+ type ProgressBarProps = ProgressBarProps$1;
508
+ type ProgressBarValueTextProps = Omit<HTMLProps<HTMLSpanElement>, 'children'> & {
509
+ className?: string;
510
+ };
511
+ declare const ProgressBarValueText: ({ className, ...restProps }: ProgressBarValueTextProps) => react_jsx_runtime.JSX.Element;
512
+ declare const ProgressBar: ({ children, className, ...restProps }: ProgressBarProps) => react_jsx_runtime.JSX.Element;
513
+
501
514
  type RadioProps = {
502
515
  children: React.ReactNode;
503
516
  /** Additional CSS className for the element. */
@@ -745,5 +758,5 @@ type VideoLoopProps = {
745
758
  };
746
759
  declare const VideoLoop: ({ src, format, alt, className }: VideoLoopProps) => react_jsx_runtime.JSX.Element;
747
760
 
748
- export { Accordion, AccordionItem, Alertbox, Avatar, Backlink, Badge, Breadcrumb, Breadcrumbs, Button, ButtonContext, Caption, Card, CardLink, Checkbox, CheckboxGroup, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, ListBoxSection as ComboboxSection, Content, ContentContext, DateFormatter, Description, Disclosure, DisclosureButton, DisclosurePanel, DisclosureStateContext, ErrorMessage, Footer, GrunnmurenProvider, Heading, HeadingContext, Label, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tag, TagGroup, TagList, TextArea, TextField, Carousel as UNSAFE_Carousel, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Link as UNSAFE_Link, LinkList as UNSAFE_LinkList, LinkListContainer as UNSAFE_LinkListContainer, 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, TableColumnResizer as UNSAFE_TableColumnResizer, TableContainer as UNSAFE_TableContainer, TableHeader as UNSAFE_TableHeader, TableRow as UNSAFE_TableRow, Tabs as UNSAFE_Tabs, VideoLoop, _LinkContext, _useLocale as useLocale };
749
- export type { AccordionItemProps, AccordionProps, Props as AlertboxProps, AvatarProps, BacklinkProps, BadgeProps, BreadcrumbProps, BreadcrumbsProps, ButtonProps, CaptionProps, CardLinkProps, CardProps, CheckboxGroupProps, CheckboxProps, ComboboxProps, ContentProps, DateFormatterProps, DescriptionProps, DisclosureButtonProps, DisclosurePanelProps, DisclosureProps, ErrorMessageProps, FooterProps, GrunnmurenProviderProps, HeadingProps, Locale, MediaProps, NumberFieldProps, RadioGroupProps, RadioProps, SelectProps, TagGroupProps, TagListProps, TagProps, TextAreaProps, TextFieldProps, CarouselItemProps as UNSAFE_CarouselItemProps, CarouselItemsProps as UNSAFE_CarouselItemsProps, CarouselProps as UNSAFE_CarouselProps, DialogProps as UNSAFE_DialogProps, DialogTriggerProps as UNSAFE_DialogTriggerProps, FileUploadProps as UNSAFE_FileUploadProps, HeroProps as UNSAFE_HeroProps, LinkListContainerProps as UNSAFE_LinkListContainerProps, 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, TableColumnResizerProps as UNSAFE_TableColumnResizerProps, TableContainerProps as UNSAFE_TableContainerProps, TableHeaderProps as UNSAFE_TableHeaderProps, TableProps as UNSAFE_TableProps, TableRowProps as UNSAFE_TableRowProps, TabsProps as UNSAFE_TabsProps };
761
+ export { Accordion, AccordionItem, Alertbox, Avatar, Backlink, Badge, Breadcrumb, Breadcrumbs, Button, ButtonContext, Caption, Card, CardLink, Checkbox, CheckboxGroup, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, ListBoxSection as ComboboxSection, Content, ContentContext, DateFormatter, Description, Disclosure, DisclosureButton, DisclosurePanel, DisclosureStateContext, ErrorMessage, Footer, GrunnmurenProvider, Heading, HeadingContext, Label, LinkList, LinkListContainer, LinkListItem, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tag, TagGroup, TagList, TextArea, TextField, Carousel as UNSAFE_Carousel, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Link as UNSAFE_Link, Modal as UNSAFE_Modal, ProgressBar as UNSAFE_ProgressBar, ProgressBarValueText as UNSAFE_ProgressBarValueText, Tab as UNSAFE_Tab, TabList as UNSAFE_TabList, TabPanel as UNSAFE_TabPanel, Table as UNSAFE_Table, TableBody as UNSAFE_TableBody, TableCell as UNSAFE_TableCell, TableColumn as UNSAFE_TableColumn, TableColumnResizer as UNSAFE_TableColumnResizer, TableContainer as UNSAFE_TableContainer, TableHeader as UNSAFE_TableHeader, TableRow as UNSAFE_TableRow, Tabs as UNSAFE_Tabs, VideoLoop, _LinkContext, _useLocale as useLocale };
762
+ export type { AccordionItemProps, AccordionProps, Props as AlertboxProps, AvatarProps, BacklinkProps, BadgeProps, BreadcrumbProps, BreadcrumbsProps, ButtonProps, CaptionProps, CardLinkProps, CardProps, CheckboxGroupProps, CheckboxProps, ComboboxProps, ContentProps, DateFormatterProps, DescriptionProps, DisclosureButtonProps, DisclosurePanelProps, DisclosureProps, ErrorMessageProps, FooterProps, GrunnmurenProviderProps, HeadingProps, LinkListContainerProps, LinkListItemProps, LinkListProps, Locale, MediaProps, NumberFieldProps, RadioGroupProps, RadioProps, SelectProps, TagGroupProps, TagListProps, TagProps, TextAreaProps, TextFieldProps, CarouselItemProps as UNSAFE_CarouselItemProps, CarouselItemsProps as UNSAFE_CarouselItemsProps, CarouselProps as UNSAFE_CarouselProps, DialogProps as UNSAFE_DialogProps, DialogTriggerProps as UNSAFE_DialogTriggerProps, FileUploadProps as UNSAFE_FileUploadProps, HeroProps as UNSAFE_HeroProps, LinkProps as UNSAFE_LinkProps, ModalProps as UNSAFE_ModalProps, ProgressBarProps as UNSAFE_ProgressBarProps, ProgressBarValueTextProps as UNSAFE_ProgressBarValueTextProps, TabListProps as UNSAFE_TabListProps, TabPanelProps as UNSAFE_TabPanelProps, TabProps as UNSAFE_TabProps, TableBodyProps as UNSAFE_TableBodyProps, TableCellProps as UNSAFE_TableCellProps, TableColumnProps as UNSAFE_TableColumnProps, TableColumnResizerProps as UNSAFE_TableColumnResizerProps, TableContainerProps as UNSAFE_TableContainerProps, TableHeaderProps as UNSAFE_TableHeaderProps, TableProps as UNSAFE_TableProps, TableRowProps as UNSAFE_TableRowProps, TabsProps as UNSAFE_TabsProps };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
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, ColumnResizer, Table as Table$1, TableBody as TableBody$1, Cell, Column, ResizableTableContainer, 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, NumberField as NumberField$1, ProgressBar as ProgressBar$1, Radio as Radio$1, RadioGroup as RadioGroup$1, Select as Select$1, SelectValue, ColumnResizer, Table as Table$1, TableBody as TableBody$1, Cell, Column, ResizableTableContainer, 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 { DisclosureGroup, Form, Group } from 'react-aria-components';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { cva, cx, compose } from 'cva';
@@ -279,6 +279,7 @@ function AccordionItem(props) {
279
279
  const _defaultExpanded = defaultOpen ?? defaultExpanded;
280
280
  const _isExpanded = controlledIsOpen ?? isExpanded;
281
281
  const _onExpandedChange = onOpenChange ?? onExpandedChange;
282
+ const buttonId = useId();
282
283
  return /*#__PURE__*/ jsx(Disclosure, {
283
284
  ...restProps,
284
285
  className: cx('relative px-2', className),
@@ -299,6 +300,7 @@ function AccordionItem(props) {
299
300
  className: "flex min-h-11 w-full gap-1.5 rounded-lg px-2 py-3.5 text-left focus-visible:outline-focus-inset!",
300
301
  type: "button",
301
302
  withChevron: true,
303
+ id: buttonId,
302
304
  children: children
303
305
  })
304
306
  }
@@ -308,8 +310,9 @@ function AccordionItem(props) {
308
310
  {
309
311
  className: // Uses pseudo elements for vertical padding, since that doesn't affect the height when the accordion is closed
310
312
  'text-sm font-light leading-6 px-3.5 data-[expanded]:after:h-3.5 relative overflow-hidden border-sky border-l-[3px] before:relative before:block before:h-1.5 after:relative after:block after:h-1.5',
311
- role: 'region',
312
313
  _outerWrapper: (children)=>/*#__PURE__*/ jsx(DisclosurePanel, {
314
+ "aria-labelledby": buttonId,
315
+ role: "region",
313
316
  children: children
314
317
  })
315
318
  }
@@ -1014,8 +1017,9 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
1014
1017
  }
1015
1018
  isScrollingProgrammatically.current = true;
1016
1019
  const elementWithFocusVisible = carouselRef.current?.querySelector(':focus-visible');
1020
+ const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
1017
1021
  carouselItemsRef.current.children[scrollTargetIndex]?.scrollIntoView({
1018
- behavior: 'smooth',
1022
+ behavior: prefersReducedMotion ? 'instant' : 'smooth',
1019
1023
  inline: 'start',
1020
1024
  block: 'nearest'
1021
1025
  });
@@ -1143,7 +1147,9 @@ const Carousel = ({ className, children, onChange, ...rest })=>{
1143
1147
  {
1144
1148
  carouselItemsRef,
1145
1149
  onScroll,
1146
- activeIndex: scrollTargetIndex
1150
+ activeIndex: scrollTargetIndex,
1151
+ handlePrevious,
1152
+ handleNext
1147
1153
  }
1148
1154
  ],
1149
1155
  [
@@ -1214,14 +1220,35 @@ const CarouselItemsContext = /*#__PURE__*/ createContext({
1214
1220
  activeIndex: 0
1215
1221
  });
1216
1222
  const CarouselItems = ({ className, children })=>{
1223
+ const { carouselItemsRef, onScroll, activeIndex, handlePrevious, handleNext } = useContext(CarouselItemsContext);
1224
+ const prefersReducedMotion = useRef(window.matchMedia('(prefers-reduced-motion: reduce)').matches);
1225
+ // Update the ref when the media query changes
1226
+ useEffect(()=>{
1227
+ const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
1228
+ const handleChange = (e)=>{
1229
+ prefersReducedMotion.current = e.matches;
1230
+ };
1231
+ mediaQuery.addEventListener('change', handleChange);
1232
+ return ()=>mediaQuery.removeEventListener('change', handleChange);
1233
+ }, []);
1217
1234
  const handleKeyDown = (event)=>{
1218
1235
  // Prevent default behavior when holding down arrow keys (when repeat is true)
1219
1236
  // The default behavior in scroll snapping causes a staggering scroll effect that feels janky
1220
1237
  if (event.repeat && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
1221
1238
  event.preventDefault();
1239
+ return;
1240
+ }
1241
+ // For users with prefers-reduced-motion, trigger button click behavior instead of native scroll
1242
+ if (prefersReducedMotion.current) {
1243
+ if (event.key === 'ArrowLeft' && handlePrevious) {
1244
+ event.preventDefault();
1245
+ handlePrevious();
1246
+ } else if (event.key === 'ArrowRight' && handleNext) {
1247
+ event.preventDefault();
1248
+ handleNext();
1249
+ }
1222
1250
  }
1223
1251
  };
1224
- const { carouselItemsRef, onScroll, activeIndex } = useContext(CarouselItemsContext);
1225
1252
  return(// biome-ignore lint/a11y/noStaticElementInteractions: The keydown handler is only to prevent undesired scrolling behavior when using the arrow keys
1226
1253
  /*#__PURE__*/ jsx("div", {
1227
1254
  "data-slot": "carousel-items",
@@ -2007,52 +2034,66 @@ const LinkListItem = (props)=>/*#__PURE__*/ jsx("li", {
2007
2034
  const DialogTrigger = (props)=>/*#__PURE__*/ jsx(DialogTrigger$1, {
2008
2035
  ...props
2009
2036
  });
2010
- const ModalOverlay = (props)=>/*#__PURE__*/ jsx(ModalOverlay$1, {
2011
- ...props,
2012
- isDismissable: true,
2013
- className: ({ isEntering, isExiting })=>cx('fixed inset-0 z-10 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
2014
- 'motion-reduce:animate-none')
2037
+ const _ModalOverlay = ({ style = {}, zIndex = 10, ...restProps })=>/*#__PURE__*/ jsx(ModalOverlay, {
2038
+ ...restProps,
2039
+ 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
2040
+ 'motion-reduce:animate-none'),
2041
+ style: {
2042
+ zIndex,
2043
+ ...style
2044
+ }
2015
2045
  });
2016
- const Modal = ({ className, ...restProps })=>/*#__PURE__*/ jsx(ModalOverlay, {
2017
- children: /*#__PURE__*/ jsx(Modal$1, {
2018
- ...restProps,
2019
- 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
2020
- 'motion-reduce:animate-none')
2046
+ const Modal = ({ isDismissable = true, isOpen, onOpenChange, defaultOpen, className, zIndex, ...restProps })=>{
2047
+ const locale = _useLocale();
2048
+ return /*#__PURE__*/ jsx(Provider, {
2049
+ values: [
2050
+ [
2051
+ HeadingContext,
2052
+ {
2053
+ slots: {
2054
+ [DEFAULT_SLOT]: {},
2055
+ title: {
2056
+ className: 'heading-s',
2057
+ _outerWrapper: (children)=>/*#__PURE__*/ jsxs("div", {
2058
+ className: "flex items-center justify-between gap-x-2",
2059
+ children: [
2060
+ children,
2061
+ isDismissable && /*#__PURE__*/ jsx(Button, {
2062
+ slot: "close",
2063
+ variant: "tertiary",
2064
+ className: "px-2.5! data-focus-visible:outline-focus-inset",
2065
+ "aria-label": translations$1.close[locale],
2066
+ onPress: ()=>onOpenChange?.(false),
2067
+ children: /*#__PURE__*/ jsx(Close, {})
2068
+ })
2069
+ ]
2070
+ })
2071
+ }
2072
+ }
2073
+ }
2074
+ ]
2075
+ ],
2076
+ children: /*#__PURE__*/ jsx(_ModalOverlay, {
2077
+ isOpen: isOpen,
2078
+ onOpenChange: onOpenChange,
2079
+ defaultOpen: defaultOpen,
2080
+ isDismissable: isDismissable,
2081
+ zIndex: zIndex,
2082
+ children: /*#__PURE__*/ jsx(Modal$1, {
2083
+ ...restProps,
2084
+ 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
2085
+ 'motion-reduce:animate-none')
2086
+ })
2021
2087
  })
2022
2088
  });
2023
- const Dialog = ({ className, children, ...restProps })=>{
2024
- const locale = _useLocale();
2025
- return /*#__PURE__*/ jsx(Dialog$1, {
2089
+ };
2090
+ const Dialog = ({ className, children, ...restProps })=>/*#__PURE__*/ jsx(Dialog$1, {
2026
2091
  ...restProps,
2027
2092
  className: cx('relative grid gap-y-5 outline-none', // Footer
2028
2093
  '[&_[data-slot="footer"]]:flex [&_[data-slot="footer"]]:gap-x-2'),
2029
2094
  children: ({ close })=>/*#__PURE__*/ jsx(Fragment, {
2030
2095
  children: /*#__PURE__*/ jsx(Provider, {
2031
2096
  values: [
2032
- [
2033
- HeadingContext,
2034
- {
2035
- slots: {
2036
- [DEFAULT_SLOT]: {},
2037
- title: {
2038
- className: 'heading-s',
2039
- _outerWrapper: (children)=>/*#__PURE__*/ jsxs("div", {
2040
- className: "flex items-center justify-between gap-x-2",
2041
- children: [
2042
- children,
2043
- /*#__PURE__*/ jsx(Button, {
2044
- slot: "close",
2045
- variant: "tertiary",
2046
- className: "!px-2.5 data-focus-visible:outline-focus-inset",
2047
- "aria-label": translations$1.close[locale],
2048
- children: /*#__PURE__*/ jsx(Close, {})
2049
- })
2050
- ]
2051
- })
2052
- }
2053
- }
2054
- }
2055
- ],
2056
2097
  [
2057
2098
  ButtonContext$1,
2058
2099
  {
@@ -2074,7 +2115,6 @@ const Dialog = ({ className, children, ...restProps })=>{
2074
2115
  })
2075
2116
  })
2076
2117
  });
2077
- };
2078
2118
 
2079
2119
  // This component is based on a copy of ../textfield/TextField, refactoring is TBD: https://github.com/code-obos/grunnmuren/pull/722#issuecomment-1931478786
2080
2120
  const inputVariants$1 = compose(input, cva({
@@ -2140,6 +2180,44 @@ function NumberField(props) {
2140
2180
  });
2141
2181
  }
2142
2182
 
2183
+ const _ProgressBarValueTextContext = /*#__PURE__*/ createContext(undefined);
2184
+ const _ProgressBarValueTextProvider = _ProgressBarValueTextContext.Provider;
2185
+ const ProgressBarValueText = ({ className, ...restProps })=>{
2186
+ const value = useContext(_ProgressBarValueTextContext);
2187
+ return /*#__PURE__*/ jsx("span", {
2188
+ ...restProps,
2189
+ className: cx(className, 'px-2 leading-7'),
2190
+ "data-slot": "progress-bar-value-text",
2191
+ children: value
2192
+ });
2193
+ };
2194
+ const ProgressBar = ({ children, className, ...restProps })=>{
2195
+ return /*#__PURE__*/ jsx(ProgressBar$1, {
2196
+ "data-slot": "progress-bar",
2197
+ ...restProps,
2198
+ className: cx(className, 'max-w-full'),
2199
+ children: ({ percentage, valueText, ...restArgs })=>/*#__PURE__*/ jsxs(_ProgressBarValueTextProvider, {
2200
+ value: valueText,
2201
+ children: [
2202
+ typeof children === 'function' ? children({
2203
+ percentage,
2204
+ valueText,
2205
+ ...restArgs
2206
+ }) : children,
2207
+ /*#__PURE__*/ jsx("div", {
2208
+ className: "relative h-0.75 rounded bg-gray-light",
2209
+ children: /*#__PURE__*/ jsx("div", {
2210
+ className: "h-0.75 rounded bg-blue-dark transition-all duration-300 ease-in-out",
2211
+ style: {
2212
+ width: `${percentage}%`
2213
+ }
2214
+ })
2215
+ })
2216
+ ]
2217
+ })
2218
+ });
2219
+ };
2220
+
2143
2221
  const defaultClasses = cx([
2144
2222
  '-ml-2.5 relative inline-flex max-w-fit cursor-pointer items-start gap-4 py-2.5 pl-2.5 leading-7',
2145
2223
  // the radio button itself
@@ -2864,4 +2942,4 @@ const VideoLoop = ({ src, format, alt, className })=>{
2864
2942
  });
2865
2943
  };
2866
2944
 
2867
- export { Accordion, AccordionItem, Alertbox, Avatar, Backlink, Badge, Breadcrumb, Breadcrumbs, Button, ButtonContext, Caption, Card, CardLink, Checkbox, CheckboxGroup, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, ListBoxSection as ComboboxSection, Content, ContentContext, DateFormatter, Description, Disclosure, DisclosureButton, DisclosurePanel, DisclosureStateContext, ErrorMessage, Footer, GrunnmurenProvider, Heading, HeadingContext, Label, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tag, TagGroup, TagList, TextArea, TextField, Carousel as UNSAFE_Carousel, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Link as UNSAFE_Link, LinkList as UNSAFE_LinkList, LinkListContainer as UNSAFE_LinkListContainer, 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, TableColumnResizer as UNSAFE_TableColumnResizer, TableContainer as UNSAFE_TableContainer, TableHeader as UNSAFE_TableHeader, TableRow as UNSAFE_TableRow, Tabs as UNSAFE_Tabs, VideoLoop, _LinkContext, _useLocale as useLocale };
2945
+ export { Accordion, AccordionItem, Alertbox, Avatar, Backlink, Badge, Breadcrumb, Breadcrumbs, Button, ButtonContext, Caption, Card, CardLink, Checkbox, CheckboxGroup, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, ListBoxSection as ComboboxSection, Content, ContentContext, DateFormatter, Description, Disclosure, DisclosureButton, DisclosurePanel, DisclosureStateContext, ErrorMessage, Footer, GrunnmurenProvider, Heading, HeadingContext, Label, LinkList, LinkListContainer, LinkListItem, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tag, TagGroup, TagList, TextArea, TextField, Carousel as UNSAFE_Carousel, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Link as UNSAFE_Link, Modal as UNSAFE_Modal, ProgressBar as UNSAFE_ProgressBar, ProgressBarValueText as UNSAFE_ProgressBarValueText, Tab as UNSAFE_Tab, TabList as UNSAFE_TabList, TabPanel as UNSAFE_TabPanel, Table as UNSAFE_Table, TableBody as UNSAFE_TableBody, TableCell as UNSAFE_TableCell, TableColumn as UNSAFE_TableColumn, TableColumnResizer as UNSAFE_TableColumnResizer, TableContainer as UNSAFE_TableContainer, TableHeader as UNSAFE_TableHeader, TableRow as UNSAFE_TableRow, Tabs as UNSAFE_Tabs, VideoLoop, _LinkContext, _useLocale as useLocale };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "3.2.1",
3
+ "version": "3.3.1",
4
4
  "description": "Grunnmuren components in React",
5
5
  "repository": {
6
6
  "url": "https://github.com/code-obos/grunnmuren"