@obosbbl/grunnmuren-react 3.8.1 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -340,8 +340,11 @@ const variants = cva.cva({
340
340
  ],
341
341
  'full-bleed': [
342
342
  oneColumnLayout,
343
- // Position the media and carousel content to fill the entire viewport width
344
- '*:data-[slot=media]:*:absolute *:data-[slot=media]:*:left-0',
343
+ // Break media out to full viewport width — except the VideoLoop wrapper (`:has(video)`), which
344
+ // stays container-width so its play button anchors to the grid container (see the video rule below).
345
+ '*:data-[slot=media]:*:not-has-[video]:absolute *:data-[slot=media]:*:not-has-[video]:left-0',
346
+ // Break only the VideoLoop's video out to full width; the wrapper (and its button) stay in the container.
347
+ '**:data-[slot=video]:relative **:data-[slot=video]:left-1/2 **:data-[slot=video]:min-w-screen **:data-[slot=video]:-translate-x-1/2',
345
348
  // Special case for Carousel, where the Media is nested inside a CarouselItem
346
349
  '*:data-[slot=carousel]:**:data-[slot=media]:w-full',
347
350
  // Match the heights of the <Media> or <Carousel> wrapper for the Media content (e.g. image, VideoLoop, video etc.)
@@ -338,8 +338,11 @@ const variants = cva({
338
338
  ],
339
339
  'full-bleed': [
340
340
  oneColumnLayout,
341
- // Position the media and carousel content to fill the entire viewport width
342
- '*:data-[slot=media]:*:absolute *:data-[slot=media]:*:left-0',
341
+ // Break media out to full viewport width — except the VideoLoop wrapper (`:has(video)`), which
342
+ // stays container-width so its play button anchors to the grid container (see the video rule below).
343
+ '*:data-[slot=media]:*:not-has-[video]:absolute *:data-[slot=media]:*:not-has-[video]:left-0',
344
+ // Break only the VideoLoop's video out to full width; the wrapper (and its button) stay in the container.
345
+ '**:data-[slot=video]:relative **:data-[slot=video]:left-1/2 **:data-[slot=video]:min-w-screen **:data-[slot=video]:-translate-x-1/2',
343
346
  // Special case for Carousel, where the Media is nested inside a CarouselItem
344
347
  '*:data-[slot=carousel]:**:data-[slot=media]:w-full',
345
348
  // Match the heights of the <Media> or <Carousel> wrapper for the Media content (e.g. image, VideoLoop, video etc.)
@@ -106,6 +106,10 @@ const Lead = ()=>/*#__PURE__*/ jsxRuntime.jsx("p", {
106
106
  className: "lead",
107
107
  children: "Dokumentavgift er en avgift som du må betale til staten når du kjøper en fast eiendom."
108
108
  });
109
+ const LeadSm = ()=>/*#__PURE__*/ jsxRuntime.jsx("p", {
110
+ className: "lead-sm",
111
+ children: "Dokumentavgift er en avgift som du må betale til staten når du kjøper en fast eiendom."
112
+ });
109
113
  const Body = ()=>{
110
114
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
111
115
  children: [
@@ -219,6 +223,7 @@ exports.Default = Default;
219
223
  exports.Description = Description;
220
224
  exports.Headings = Headings;
221
225
  exports.Lead = Lead;
226
+ exports.LeadSm = LeadSm;
222
227
  exports.Prose = Prose;
223
228
  exports.ProseWhite = ProseWhite;
224
229
  exports.default = meta;
@@ -4,6 +4,7 @@ import { Meta } from '@storybook/react-vite';
4
4
  declare const Default: () => react.JSX.Element;
5
5
  declare const Headings: () => react.JSX.Element;
6
6
  declare const Lead: () => react.JSX.Element;
7
+ declare const LeadSm: () => react.JSX.Element;
7
8
  declare const Body: () => react.JSX.Element;
8
9
  declare const Blockquote: () => react.JSX.Element;
9
10
  declare const Description: () => react.JSX.Element;
@@ -11,4 +12,4 @@ declare const Prose: () => react.JSX.Element;
11
12
  declare const ProseWhite: () => react.JSX.Element;
12
13
  declare const meta: Meta;
13
14
 
14
- export { Blockquote, Body, Default, Description, Headings, Lead, Prose, ProseWhite, meta as default };
15
+ export { Blockquote, Body, Default, Description, Headings, Lead, LeadSm, Prose, ProseWhite, meta as default };
@@ -4,6 +4,7 @@ import { Meta } from '@storybook/react-vite';
4
4
  declare const Default: () => react.JSX.Element;
5
5
  declare const Headings: () => react.JSX.Element;
6
6
  declare const Lead: () => react.JSX.Element;
7
+ declare const LeadSm: () => react.JSX.Element;
7
8
  declare const Body: () => react.JSX.Element;
8
9
  declare const Blockquote: () => react.JSX.Element;
9
10
  declare const Description: () => react.JSX.Element;
@@ -11,4 +12,4 @@ declare const Prose: () => react.JSX.Element;
11
12
  declare const ProseWhite: () => react.JSX.Element;
12
13
  declare const meta: Meta;
13
14
 
14
- export { Blockquote, Body, Default, Description, Headings, Lead, Prose, ProseWhite, meta as default };
15
+ export { Blockquote, Body, Default, Description, Headings, Lead, LeadSm, Prose, ProseWhite, meta as default };
@@ -104,6 +104,10 @@ const Lead = ()=>/*#__PURE__*/ jsx("p", {
104
104
  className: "lead",
105
105
  children: "Dokumentavgift er en avgift som du må betale til staten når du kjøper en fast eiendom."
106
106
  });
107
+ const LeadSm = ()=>/*#__PURE__*/ jsx("p", {
108
+ className: "lead-sm",
109
+ children: "Dokumentavgift er en avgift som du må betale til staten når du kjøper en fast eiendom."
110
+ });
107
111
  const Body = ()=>{
108
112
  return /*#__PURE__*/ jsxs(Fragment, {
109
113
  children: [
@@ -211,4 +215,4 @@ const meta = {
211
215
  title: 'Typography'
212
216
  };
213
217
 
214
- export { Blockquote, Body, Default, Description, Headings, Lead, Prose, ProseWhite, meta as default };
218
+ export { Blockquote, Body, Default, Description, Headings, Lead, LeadSm, Prose, ProseWhite, meta as default };
package/dist/index.d.mts CHANGED
@@ -31,7 +31,7 @@ import { TabProps as TabProps$1, TabListProps as TabListProps$1, TabPanelProps a
31
31
  import { TagGroupProps as TagGroupProps$1, TagListProps as TagListProps$1, TagProps as TagProps$1 } from 'react-aria-components/TagGroup';
32
32
  import { TextFieldProps as TextFieldProps$1 } from 'react-aria-components/TextField';
33
33
  import { PopoverProps } from 'react-aria-components/Popover';
34
- import { HeaderProps } from 'react-aria-components/Header';
34
+ import { HeaderProps as HeaderProps$1 } from 'react-aria-components/Header';
35
35
  import { ListBoxItemProps, ListBoxSectionProps } from 'react-aria-components/ListBox';
36
36
  export { ListBoxItemProps as ComboboxItemProps, ListBoxItemProps as SelectItemProps } from 'react-aria-components/ListBox';
37
37
 
@@ -400,7 +400,7 @@ declare const ListBoxSection: <T extends object>({ className, ...restProps }: Li
400
400
  /**
401
401
  * This component can be used to label grouped items in a `ListBoxSection` with a heading
402
402
  */
403
- declare const ListBoxHeader: (props: HeaderProps) => react.JSX.Element;
403
+ declare const ListBoxHeader: (props: HeaderProps$1) => react.JSX.Element;
404
404
 
405
405
  type ComboboxProps<T extends object> = {
406
406
  children: React.ReactNode;
@@ -481,6 +481,34 @@ type CaptionProps = HTMLProps<HTMLDivElement> & {
481
481
  };
482
482
  declare const Caption: ({ className, ...restProps }: CaptionProps) => react.JSX.Element;
483
483
  declare const Footer: (props: FooterProps) => react.JSX.Element;
484
+ type HeaderProps = HTMLProps<HTMLDivElement> & {
485
+ children: React.ReactNode;
486
+ };
487
+ type HeaderProviderValues = [
488
+ [
489
+ typeof HeadingContext,
490
+ ContextValue<Partial<HeadingProps>, HTMLHeadingElement>
491
+ ],
492
+ [
493
+ typeof ButtonContext,
494
+ ContextValue<ButtonProps, HTMLButtonElement | HTMLAnchorElement>
495
+ ]
496
+ ];
497
+ declare const HeaderContext: react.Context<{
498
+ /** @private Set by Modal/Drawer with the contexts to wrap the header content in */
499
+ _providerValues?: HeaderProviderValues;
500
+ }>;
501
+ /**
502
+ * Wraps the title of a Modal/Drawer (and, optionally, a `<Button slot="close" />`).
503
+ *
504
+ * Renders a `data-slot="header"` element consumers can style freely, e.g.
505
+ * `className="sticky top-0 bg-white"`. Inside a Modal/Drawer the dialog provides
506
+ * (via `HeaderContext`) the contexts to wrap the content in — wiring the title's
507
+ * accessible name (`aria-labelledby`) and the close button's appearance — so the
508
+ * consumer only writes a `Heading` and a bare `<Button slot="close" />`, with no
509
+ * `slot="title"` needed.
510
+ */
511
+ declare const Header: ({ children, ...props }: HeaderProps) => react.JSX.Element;
484
512
 
485
513
  type DateFormatterProps = {
486
514
  value: Date | string;
@@ -991,5 +1019,5 @@ type VideoLoopProps = {
991
1019
  };
992
1020
  declare const VideoLoop: ({ src, format, alt, className }: VideoLoopProps) => react.JSX.Element;
993
1021
 
994
- 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, Hero, HeroContext, Label, Link, LinkList, LinkListContainer, LinkListContext, LinkListItem, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tab, TabList, TabPanel, Tabs, 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, Drawer as UNSAFE_Drawer, FileUpload as UNSAFE_FileUpload, Modal as UNSAFE_Modal, Pagination as UNSAFE_Pagination, ResizableTableContainer as UNSAFE_ResizableTableContainer, Step as UNSAFE_Step, Stepper as UNSAFE_Stepper, 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, Toggletip as UNSAFE_Toggletip, ToggletipContent as UNSAFE_ToggletipContent, ToggletipTrigger as UNSAFE_ToggletipTrigger, VideoLoop, _useLocale as useLocale };
995
- 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, HeroContextValue, HeroProps, LinkListContainerProps, LinkListContextValue, LinkListItemProps, LinkListProps, LinkProps, Locale, MediaProps, NumberFieldProps, RadioGroupProps, RadioProps, SelectProps, TabListProps, TabPanelProps, TabProps, TabsProps, 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, DrawerProps as UNSAFE_DrawerProps, FileUploadProps as UNSAFE_FileUploadProps, ModalProps as UNSAFE_ModalProps, PaginationProps as UNSAFE_PaginationProps, ResizableTableContainerProps as UNSAFE_ResizableTableContainerProps, StepProps as UNSAFE_StepProps, StepperProps as UNSAFE_StepperProps, 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, ToggletipContentProps as UNSAFE_ToggletipContentProps, ToggletipProps as UNSAFE_ToggletipProps, ToggletipTriggerProps as UNSAFE_ToggletipTriggerProps };
1022
+ 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, Header, HeaderContext, Heading, HeadingContext, Hero, HeroContext, Label, Link, LinkList, LinkListContainer, LinkListContext, LinkListItem, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tab, TabList, TabPanel, Tabs, 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, Drawer as UNSAFE_Drawer, FileUpload as UNSAFE_FileUpload, Modal as UNSAFE_Modal, Pagination as UNSAFE_Pagination, ResizableTableContainer as UNSAFE_ResizableTableContainer, Step as UNSAFE_Step, Stepper as UNSAFE_Stepper, 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, Toggletip as UNSAFE_Toggletip, ToggletipContent as UNSAFE_ToggletipContent, ToggletipTrigger as UNSAFE_ToggletipTrigger, VideoLoop, _useLocale as useLocale };
1023
+ 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, HeaderProps, HeadingProps, HeroContextValue, HeroProps, LinkListContainerProps, LinkListContextValue, LinkListItemProps, LinkListProps, LinkProps, Locale, MediaProps, NumberFieldProps, RadioGroupProps, RadioProps, SelectProps, TabListProps, TabPanelProps, TabProps, TabsProps, 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, DrawerProps as UNSAFE_DrawerProps, FileUploadProps as UNSAFE_FileUploadProps, ModalProps as UNSAFE_ModalProps, PaginationProps as UNSAFE_PaginationProps, ResizableTableContainerProps as UNSAFE_ResizableTableContainerProps, StepProps as UNSAFE_StepProps, StepperProps as UNSAFE_StepperProps, 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, ToggletipContentProps as UNSAFE_ToggletipContentProps, ToggletipProps as UNSAFE_ToggletipProps, ToggletipTriggerProps as UNSAFE_ToggletipTriggerProps };
package/dist/index.mjs CHANGED
@@ -24,6 +24,7 @@ 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
26
  import { Dialog as Dialog$1, DialogTrigger as DialogTrigger$1, OverlayTriggerStateContext } from 'react-aria-components/Dialog';
27
+ import { HeadingContext as HeadingContext$1 } from 'react-aria-components/Heading';
27
28
  import { Modal as Modal$1, ModalOverlay } from 'react-aria-components/Modal';
28
29
  import { CheckboxContext, Checkbox as Checkbox$1 } from 'react-aria-components/Checkbox';
29
30
  import { Text } from 'react-aria-components/Text';
@@ -33,7 +34,7 @@ import { Label as Label$1, LabelContext } from 'react-aria-components/Label';
33
34
  import { ComboBox } from 'react-aria-components/ComboBox';
34
35
  import { Input, InputContext } from 'react-aria-components/Input';
35
36
  import { Popover, OverlayArrow } from 'react-aria-components/Popover';
36
- import { Header } from 'react-aria-components/Header';
37
+ import { Header as Header$1 } from 'react-aria-components/Header';
37
38
  import { ListBoxItem as ListBoxItem$1, ListBoxSection as ListBoxSection$1, ListBox as ListBox$1 } from 'react-aria-components/ListBox';
38
39
  import { useDateFormatter } from 'react-aria/useDateFormatter';
39
40
  import { FormContext } from 'react-aria-components/Form';
@@ -132,6 +133,27 @@ const Footer = (props)=>/*#__PURE__*/ jsx("div", {
132
133
  ...props,
133
134
  "data-slot": "footer"
134
135
  });
136
+ const HeaderContext = /*#__PURE__*/ createContext({});
137
+ /**
138
+ * Wraps the title of a Modal/Drawer (and, optionally, a `<Button slot="close" />`).
139
+ *
140
+ * Renders a `data-slot="header"` element consumers can style freely, e.g.
141
+ * `className="sticky top-0 bg-white"`. Inside a Modal/Drawer the dialog provides
142
+ * (via `HeaderContext`) the contexts to wrap the content in — wiring the title's
143
+ * accessible name (`aria-labelledby`) and the close button's appearance — so the
144
+ * consumer only writes a `Heading` and a bare `<Button slot="close" />`, with no
145
+ * `slot="title"` needed.
146
+ */ const Header = ({ children, ...props })=>{
147
+ const { _providerValues } = useContext(HeaderContext);
148
+ return /*#__PURE__*/ jsx("div", {
149
+ ...props,
150
+ "data-slot": "header",
151
+ children: _providerValues ? /*#__PURE__*/ jsx(Provider, {
152
+ values: _providerValues,
153
+ children: children
154
+ }) : children
155
+ });
156
+ };
135
157
 
136
158
  const disclosureButtonVariants = cva({
137
159
  base: [
@@ -426,6 +448,16 @@ const translations$1 = {
426
448
  nb: 'Fullført',
427
449
  sv: 'Slutförd',
428
450
  en: 'Completed'
451
+ },
452
+ playAnimation: {
453
+ nb: 'Spill av animasjon',
454
+ sv: 'Spela upp animation',
455
+ en: 'Play animation'
456
+ },
457
+ pauseAnimation: {
458
+ nb: 'Pause animasjon',
459
+ sv: 'Pausa animation',
460
+ en: 'Pause animation'
429
461
  }
430
462
  };
431
463
 
@@ -1238,8 +1270,11 @@ const variants = cva({
1238
1270
  ],
1239
1271
  'full-bleed': [
1240
1272
  oneColumnLayout,
1241
- // Position the media and carousel content to fill the entire viewport width
1242
- '*:data-[slot=media]:*:absolute *:data-[slot=media]:*:left-0',
1273
+ // Break media out to full viewport width — except the VideoLoop wrapper (`:has(video)`), which
1274
+ // stays container-width so its play button anchors to the grid container (see the video rule below).
1275
+ '*:data-[slot=media]:*:not-has-[video]:absolute *:data-[slot=media]:*:not-has-[video]:left-0',
1276
+ // Break only the VideoLoop's video out to full width; the wrapper (and its button) stay in the container.
1277
+ '**:data-[slot=video]:relative **:data-[slot=video]:left-1/2 **:data-[slot=video]:min-w-screen **:data-[slot=video]:-translate-x-1/2',
1243
1278
  // Special case for Carousel, where the Media is nested inside a CarouselItem
1244
1279
  '*:data-[slot=carousel]:**:data-[slot=media]:w-full',
1245
1280
  // Match the heights of the <Media> or <Carousel> wrapper for the Media content (e.g. image, VideoLoop, video etc.)
@@ -1337,55 +1372,68 @@ const _ModalOverlay = ({ style = {}, zIndex = 10, fullscreen, ...restProps })=>/
1337
1372
  ...style
1338
1373
  }
1339
1374
  });
1340
- const Modal = ({ isDismissable = true, isOpen, onOpenChange, defaultOpen, className, zIndex, fullscreen = false, ...restProps })=>{
1375
+ const Modal = ({ isDismissable = true, isOpen, onOpenChange, defaultOpen, className, zIndex, fullscreen = false, ...restProps })=>/*#__PURE__*/ jsx(_ModalOverlay, {
1376
+ isOpen: isOpen,
1377
+ onOpenChange: onOpenChange,
1378
+ defaultOpen: defaultOpen,
1379
+ isDismissable: isDismissable,
1380
+ isKeyboardDismissDisabled: !isDismissable,
1381
+ zIndex: zIndex,
1382
+ fullscreen: fullscreen,
1383
+ children: /*#__PURE__*/ jsx(Modal$1, {
1384
+ ...restProps,
1385
+ className: ({ isEntering, isExiting })=>cx(className, 'overflow-auto bg-white text-left shadow-xl', fullscreen ? 'fixed inset-0' : 'w-full max-w-md rounded-2xl 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
1386
+ 'motion-reduce:animate-none')
1387
+ })
1388
+ });
1389
+ /**
1390
+ * Rendered inside RACDialog (where React Aria exposes the generated title id via
1391
+ * its HeadingContext). Builds the contexts the header content needs and hands them
1392
+ * to `Header` through `HeaderContext`, so `Header` only has to render a `Provider`
1393
+ * around its own children — no knowledge of the dialog, close icon or locale.
1394
+ */ const HeaderTitle = ({ children })=>{
1395
+ const racTitle = useSlottedContext(HeadingContext$1, 'title');
1341
1396
  const locale = _useLocale();
1342
1397
  return /*#__PURE__*/ jsx(Provider, {
1343
1398
  values: [
1344
1399
  [
1345
- HeadingContext,
1400
+ HeaderContext,
1346
1401
  {
1347
- slots: {
1348
- [DEFAULT_SLOT]: {},
1349
- title: {
1350
- className: 'heading-s',
1351
- _outerWrapper: (children)=>/*#__PURE__*/ jsxs("div", {
1352
- className: "flex items-center justify-between gap-x-2",
1353
- children: [
1354
- children,
1355
- isDismissable && /*#__PURE__*/ jsx(Button, {
1356
- slot: "close",
1357
- variant: "tertiary",
1358
- className: "data-focus-visible:outline-focus-inset px-2.5!",
1359
- "aria-label": translations$1.close[locale],
1360
- onPress: ()=>onOpenChange?.(false),
1361
- children: /*#__PURE__*/ jsx(Close, {})
1362
- })
1363
- ]
1364
- })
1365
- }
1366
- }
1402
+ _providerValues: [
1403
+ [
1404
+ HeadingContext,
1405
+ {
1406
+ className: 'heading-s',
1407
+ id: racTitle?.id
1408
+ }
1409
+ ],
1410
+ [
1411
+ ButtonContext,
1412
+ {
1413
+ slots: {
1414
+ [DEFAULT_SLOT]: {},
1415
+ // Appearance for a bare `<Button slot="close" />`; the close
1416
+ // behaviour (onPress) comes from the Dialog's ButtonContext below.
1417
+ close: {
1418
+ variant: 'tertiary',
1419
+ 'aria-label': translations$1.close[locale],
1420
+ className: 'data-focus-visible:outline-focus-inset px-2.5!',
1421
+ children: /*#__PURE__*/ jsx(Close, {})
1422
+ }
1423
+ }
1424
+ }
1425
+ ]
1426
+ ]
1367
1427
  }
1368
1428
  ]
1369
1429
  ],
1370
- children: /*#__PURE__*/ jsx(_ModalOverlay, {
1371
- isOpen: isOpen,
1372
- onOpenChange: onOpenChange,
1373
- defaultOpen: defaultOpen,
1374
- isDismissable: isDismissable,
1375
- isKeyboardDismissDisabled: !isDismissable,
1376
- zIndex: zIndex,
1377
- fullscreen: fullscreen,
1378
- children: /*#__PURE__*/ jsx(Modal$1, {
1379
- ...restProps,
1380
- className: ({ isEntering, isExiting })=>cx(className, 'overflow-auto bg-white text-left shadow-xl', fullscreen ? 'fixed inset-0' : 'w-full max-w-md rounded-2xl 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
1381
- 'motion-reduce:animate-none')
1382
- })
1383
- })
1430
+ children: children
1384
1431
  });
1385
1432
  };
1386
1433
  const Dialog = ({ className, children, ...restProps })=>/*#__PURE__*/ jsx(Dialog$1, {
1387
1434
  ...restProps,
1388
- className: cx(className, 'relative flex flex-col gap-y-5 p-4 outline-none', // Footer
1435
+ className: cx(className, 'relative flex flex-col gap-y-5 p-4 outline-none', // Header
1436
+ '**:data-[slot="header"]:flex **:data-[slot="header"]:items-center **:data-[slot="header"]:justify-between **:data-[slot="header"]:gap-x-2', // Footer
1389
1437
  '**:data-[slot="footer"]:flex **:data-[slot="footer"]:gap-x-2'),
1390
1438
  children: ({ close })=>/*#__PURE__*/ jsx(Provider, {
1391
1439
  values: [
@@ -1406,7 +1454,9 @@ const Dialog = ({ className, children, ...restProps })=>/*#__PURE__*/ jsx(Dialog
1406
1454
  }
1407
1455
  ]
1408
1456
  ],
1409
- children: children
1457
+ children: /*#__PURE__*/ jsx(HeaderTitle, {
1458
+ children: children
1459
+ })
1410
1460
  })
1411
1461
  });
1412
1462
  /**
@@ -2002,7 +2052,7 @@ const ListBoxItem = (props)=>{
2002
2052
  });
2003
2053
  /**
2004
2054
  * This component can be used to label grouped items in a `ListBoxSection` with a heading
2005
- */ const ListBoxHeader = (props)=>/*#__PURE__*/ jsx(Header, {
2055
+ */ const ListBoxHeader = (props)=>/*#__PURE__*/ jsx(Header$1, {
2006
2056
  ...props,
2007
2057
  className: cx(props.className, 'text-blue-dark mx-6 cursor-default py-2 leading-6 font-medium')
2008
2058
  });
@@ -2137,60 +2187,28 @@ const drawerVariants = cva({
2137
2187
  }
2138
2188
  ]
2139
2189
  });
2140
- const Drawer = ({ isDismissable = true, isOpen, onOpenChange, defaultOpen, className, zIndex = 10, placement = 'right', style = {}, ...restProps })=>{
2141
- const locale = _useLocale();
2142
- return /*#__PURE__*/ jsx(Provider, {
2143
- values: [
2144
- [
2145
- HeadingContext,
2146
- {
2147
- slots: {
2148
- [DEFAULT_SLOT]: {},
2149
- title: {
2150
- className: 'heading-s',
2151
- _outerWrapper: (children)=>/*#__PURE__*/ jsxs("div", {
2152
- className: "flex items-center justify-between gap-x-2",
2153
- children: [
2154
- children,
2155
- isDismissable && /*#__PURE__*/ jsx(Button, {
2156
- slot: "close",
2157
- variant: "tertiary",
2158
- className: "data-focus-visible:outline-focus-inset px-2.5!",
2159
- "aria-label": translations$1.close[locale],
2160
- onPress: ()=>onOpenChange?.(false),
2161
- children: /*#__PURE__*/ jsx(Close, {})
2162
- })
2163
- ]
2164
- })
2165
- }
2166
- }
2167
- }
2168
- ]
2169
- ],
2170
- children: /*#__PURE__*/ jsx(ModalOverlay, {
2171
- isOpen: isOpen,
2172
- onOpenChange: onOpenChange,
2173
- defaultOpen: defaultOpen,
2174
- isDismissable: isDismissable,
2175
- isKeyboardDismissDisabled: !isDismissable,
2176
- style: {
2177
- zIndex,
2178
- ...style
2179
- },
2180
- className: ({ isEntering, isExiting })=>cx('fixed inset-0 bg-black/25 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
2181
- 'motion-reduce:animate-none'),
2182
- children: /*#__PURE__*/ jsx(Modal$1, {
2183
- ...restProps,
2184
- className: ({ isEntering, isExiting })=>drawerVariants({
2185
- placement,
2186
- isEntering,
2187
- isExiting,
2188
- className
2189
- })
2190
- })
2190
+ const Drawer = ({ isDismissable = true, isOpen, onOpenChange, defaultOpen, className, zIndex = 10, placement = 'right', style = {}, ...restProps })=>/*#__PURE__*/ jsx(ModalOverlay, {
2191
+ isOpen: isOpen,
2192
+ onOpenChange: onOpenChange,
2193
+ defaultOpen: defaultOpen,
2194
+ isDismissable: isDismissable,
2195
+ isKeyboardDismissDisabled: !isDismissable,
2196
+ style: {
2197
+ zIndex,
2198
+ ...style
2199
+ },
2200
+ className: ({ isEntering, isExiting })=>cx('fixed inset-0 bg-black/25 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
2201
+ 'motion-reduce:animate-none'),
2202
+ children: /*#__PURE__*/ jsx(Modal$1, {
2203
+ ...restProps,
2204
+ className: ({ isEntering, isExiting })=>drawerVariants({
2205
+ placement,
2206
+ isEntering,
2207
+ isExiting,
2208
+ className
2209
+ })
2191
2210
  })
2192
2211
  });
2193
- };
2194
2212
 
2195
2213
  /**
2196
2214
  * A FileTrigger allows a user to access the file system with any pressable React Aria or React Spectrum component, or custom components built with usePress.
@@ -3639,19 +3657,23 @@ const VideoLoop = ({ src, format, alt, className })=>{
3639
3657
  }, [
3640
3658
  shouldPlay
3641
3659
  ]);
3660
+ const togglePlayback = ()=>setShouldPlay((prevState)=>!prevState);
3661
+ const locale = _useLocale();
3642
3662
  return /*#__PURE__*/ jsxs("div", {
3643
- className: cx(className, 'relative', prefersReducedMotion === null && 'opacity-0'),
3663
+ className: cx(className, // group: hover anywhere reveals the button. @container: corner placement only when large.
3664
+ 'group @container relative', prefersReducedMotion === null && 'opacity-0'),
3644
3665
  "data-slot": "video-loop",
3645
3666
  children: [
3646
3667
  /*#__PURE__*/ jsx("video", {
3647
3668
  "aria-hidden": true,
3648
3669
  ref: videoRef,
3649
- // cursor-pointer is not working on the button below, so we add it here for the same effect
3670
+ // Click anywhere on the video to toggle playback (in addition to the button)
3650
3671
  className: "size-full max-h-[inherit] cursor-pointer rounded-[inherit] object-cover",
3651
3672
  playsInline: true,
3652
3673
  loop: prefersReducedMotion === false,
3653
3674
  autoPlay: prefersReducedMotion === false,
3654
3675
  muted: true,
3676
+ onClick: togglePlayback,
3655
3677
  onEnded: (event)=>{
3656
3678
  if (prefersReducedMotion) {
3657
3679
  // Reset the video to the beginning if the user prefers reduced motion, since the video will not loop
@@ -3666,30 +3688,28 @@ const VideoLoop = ({ src, format, alt, className })=>{
3666
3688
  type: `video/${format}`
3667
3689
  })
3668
3690
  }),
3669
- prefersReducedMotion !== null && /*#__PURE__*/ jsx("button", {
3670
- "data-slot": "video-loop-button",
3671
- // oxlint-disable-next-line jsx-a11y/no-aria-hidden-on-focusable
3672
- "aria-hidden": true,
3673
- type: "button",
3674
- onClick: ()=>setShouldPlay((prevState)=>!prevState),
3675
- className: cx('absolute inset-0 m-auto grid place-items-center', 'focus-visible:outline-focus focus-visible:outline-focus-offset', 'rounded-[inherit]', // Setting the opacity to 0 before applying the transition below will ensure the button only fades in after the video has started playing
3691
+ alt && /*#__PURE__*/ jsx("p", {
3692
+ className: "sr-only",
3693
+ children: alt
3694
+ }),
3695
+ prefersReducedMotion !== null && /*#__PURE__*/ jsx(Button, {
3696
+ "aria-label": isPlaying ? translations$1.pauseAnimation[locale] : translations$1.playAnimation[locale],
3697
+ isIconOnly: true,
3698
+ variant: "primary",
3699
+ color: "white",
3700
+ onPress: togglePlayback,
3701
+ className: cx(// Centered in small containers; moved to the bottom-left corner in larger ones
3702
+ 'absolute inset-0 m-auto size-fit', '@md:inset-auto @md:bottom-4 @md:left-4', // Opacity-only transition; overrides Button's `transition-colors` so the focus outline doesn't flash black→white
3703
+ 'transition-opacity duration-200', // Start hidden so the button fades in once the video plays
3676
3704
  shouldPlay && 'opacity-0', isPlaying && [
3677
- 'transition-opacity duration-200',
3678
3705
  // Only show the pause button when the video is hovered or focused
3679
3706
  'focus-visible:opacity-100',
3680
- 'hover:opacity-100'
3707
+ 'group-hover:opacity-100'
3681
3708
  ]),
3682
- children: /*#__PURE__*/ jsx("span", {
3683
- className: "grid size-12 place-items-center rounded-full bg-white outline-hidden",
3684
- children: isPlaying ? /*#__PURE__*/ jsx(PlayerPause, {}) : /*#__PURE__*/ jsx(PlayerPlay, {})
3685
- })
3686
- }),
3687
- alt && /*#__PURE__*/ jsx("p", {
3688
- className: "sr-only",
3689
- children: alt
3709
+ children: isPlaying ? /*#__PURE__*/ jsx(PlayerPause, {}) : /*#__PURE__*/ jsx(PlayerPlay, {})
3690
3710
  })
3691
3711
  ]
3692
3712
  });
3693
3713
  };
3694
3714
 
3695
- 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, Hero, HeroContext, Label, Link, LinkList, LinkListContainer, LinkListContext, LinkListItem, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tab, TabList, TabPanel, Tabs, 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, Drawer as UNSAFE_Drawer, FileUpload as UNSAFE_FileUpload, Modal as UNSAFE_Modal, Pagination as UNSAFE_Pagination, ResizableTableContainer as UNSAFE_ResizableTableContainer, Step as UNSAFE_Step, Stepper as UNSAFE_Stepper, 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, Toggletip as UNSAFE_Toggletip, ToggletipContent as UNSAFE_ToggletipContent, ToggletipTrigger as UNSAFE_ToggletipTrigger, VideoLoop, _useLocale as useLocale };
3715
+ 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, Header, HeaderContext, Heading, HeadingContext, Hero, HeroContext, Label, Link, LinkList, LinkListContainer, LinkListContext, LinkListItem, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, Tab, TabList, TabPanel, Tabs, 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, Drawer as UNSAFE_Drawer, FileUpload as UNSAFE_FileUpload, Modal as UNSAFE_Modal, Pagination as UNSAFE_Pagination, ResizableTableContainer as UNSAFE_ResizableTableContainer, Step as UNSAFE_Step, Stepper as UNSAFE_Stepper, 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, Toggletip as UNSAFE_Toggletip, ToggletipContent as UNSAFE_ToggletipContent, ToggletipTrigger as UNSAFE_ToggletipTrigger, VideoLoop, _useLocale as useLocale };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "3.8.1",
3
+ "version": "3.9.0",
4
4
  "description": "Grunnmuren components in React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  "react-aria-components": "^1.17.0",
27
27
  "react-stately": "^3.46.0",
28
28
  "use-debounce": "^10.0.4",
29
- "@obosbbl/grunnmuren-icons-react": "^2.2.1"
29
+ "@obosbbl/grunnmuren-icons-react": "^2.3.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^24.0.0",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^19",
37
- "@obosbbl/grunnmuren-tailwind": "^2.4.12"
37
+ "@obosbbl/grunnmuren-tailwind": "^2.5.0"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "bunchee"