@obosbbl/grunnmuren-react 2.1.0 → 2.3.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.
- package/dist/index.d.mts +61 -10
- package/dist/index.mjs +354 -50
- package/package.json +4 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RouterProvider, ButtonProps as ButtonProps$1, LinkProps, CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1, ListBoxItemProps, ListBoxSectionProps, HeadingProps as HeadingProps$1, ComboBoxProps, RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1, SelectProps as SelectProps$1, TextFieldProps as TextFieldProps$1, NumberFieldProps as NumberFieldProps$1,
|
|
2
|
-
export { ListBoxItemProps as ComboboxItemProps, Form, LabelProps, ListBoxItemProps as SelectItemProps, DisclosureGroup as UNSAFE_DisclosureGroup, DisclosureGroupProps as UNSAFE_DisclosureGroupProps } from 'react-aria-components';
|
|
1
|
+
import { RouterProvider, ButtonProps as ButtonProps$1, LinkProps, ContextValue, CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1, ListBoxItemProps, ListBoxSectionProps, HeadingProps as HeadingProps$1, ComboBoxProps, RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1, SelectProps as SelectProps$1, TextFieldProps as TextFieldProps$1, NumberFieldProps as NumberFieldProps$1, BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1, DisclosureProps as DisclosureProps$1, FileTriggerProps as FileTriggerProps$1, TextProps, LabelProps, DialogTriggerProps as DialogTriggerProps$1, ModalOverlayProps, DialogProps as DialogProps$1, TagGroupProps as TagGroupProps$1, TagListProps as TagListProps$1, TagProps as TagProps$1 } from 'react-aria-components';
|
|
2
|
+
export { ListBoxItemProps as ComboboxItemProps, Form, Group, LabelProps, ListBoxItemProps as SelectItemProps, DisclosureGroup as UNSAFE_DisclosureGroup, DisclosureGroupProps as UNSAFE_DisclosureGroupProps } from 'react-aria-components';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { Ref, HTMLProps, ReactNode, RefAttributes, HTMLAttributes, RefObject, Dispatch, SetStateAction, ComponentProps } from 'react';
|
|
@@ -105,7 +105,8 @@ type ButtonOrLinkProps$1 = VariantProps<typeof buttonVariants> & {
|
|
|
105
105
|
ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
106
106
|
};
|
|
107
107
|
type ButtonProps = (ButtonProps$1 | LinkProps) & ButtonOrLinkProps$1;
|
|
108
|
-
declare
|
|
108
|
+
declare const ButtonContext: react.Context<ContextValue<ButtonProps, HTMLButtonElement | HTMLAnchorElement>>;
|
|
109
|
+
declare function Button({ ref, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
109
110
|
|
|
110
111
|
type CheckboxProps = {
|
|
111
112
|
children: React.ReactNode;
|
|
@@ -359,9 +360,9 @@ type Props = VariantProps<typeof alertVariants> & {
|
|
|
359
360
|
};
|
|
360
361
|
declare const Alertbox: ({ children, role, className, icon, variant, isDismissable, isDismissed, onDismiss, isExpandable, }: Props) => react_jsx_runtime.JSX.Element | undefined;
|
|
361
362
|
|
|
362
|
-
type HeadingProps = HTMLProps<HTMLHeadingElement> & {
|
|
363
|
+
type HeadingProps = Omit<HTMLProps<HTMLHeadingElement>, 'size'> & VariantProps<typeof headingVariants> & {
|
|
363
364
|
children?: React.ReactNode;
|
|
364
|
-
/** The level of the heading */
|
|
365
|
+
/** The semantic level of the heading */
|
|
365
366
|
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
366
367
|
/** @private Used internally for slotted components */
|
|
367
368
|
_innerWrapper?: (children: React.ReactNode) => React.ReactNode;
|
|
@@ -371,6 +372,15 @@ type HeadingProps = HTMLProps<HTMLHeadingElement> & {
|
|
|
371
372
|
ref?: Ref<HTMLHeadingElement>;
|
|
372
373
|
};
|
|
373
374
|
declare const HeadingContext: react.Context<ContextValue<Partial<HeadingProps>, HTMLHeadingElement>>;
|
|
375
|
+
declare const headingVariants: (props?: ({
|
|
376
|
+
size?: "s" | "xl" | "l" | "m" | "xs" | undefined;
|
|
377
|
+
} & ({
|
|
378
|
+
class?: cva.ClassValue;
|
|
379
|
+
className?: never;
|
|
380
|
+
} | {
|
|
381
|
+
class?: never;
|
|
382
|
+
className?: cva.ClassValue;
|
|
383
|
+
})) | undefined) => string;
|
|
374
384
|
declare const Heading: ({ ref, ...props }: HeadingProps) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
375
385
|
declare const ContentContext: react.Context<ContextValue<Partial<ContentProps>, HTMLDivElement>>;
|
|
376
386
|
type ContentProps = HTMLProps<HTMLDivElement> & {
|
|
@@ -381,10 +391,22 @@ type ContentProps = HTMLProps<HTMLDivElement> & {
|
|
|
381
391
|
ref?: Ref<HTMLDivElement>;
|
|
382
392
|
};
|
|
383
393
|
declare const Content: ({ ref, ...props }: ContentProps) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
384
|
-
type MediaProps = HTMLProps<HTMLDivElement> & {
|
|
394
|
+
type MediaProps = HTMLProps<HTMLDivElement> & VariantProps<typeof mediaVariant> & {
|
|
385
395
|
children: React.ReactNode;
|
|
396
|
+
/** Ref for the element. */
|
|
397
|
+
ref?: Ref<HTMLDivElement>;
|
|
386
398
|
};
|
|
387
|
-
declare const
|
|
399
|
+
declare const mediaVariant: (props?: ({
|
|
400
|
+
fit?: "cover" | "contain" | undefined;
|
|
401
|
+
} & ({
|
|
402
|
+
class?: cva.ClassValue;
|
|
403
|
+
className?: never;
|
|
404
|
+
} | {
|
|
405
|
+
class?: never;
|
|
406
|
+
className?: cva.ClassValue;
|
|
407
|
+
})) | undefined) => string;
|
|
408
|
+
declare const MediaContext: react.Context<ContextValue<Partial<MediaProps>, HTMLDivElement>>;
|
|
409
|
+
declare const Media: ({ ref, ...props }: MediaProps) => react_jsx_runtime.JSX.Element;
|
|
388
410
|
type FooterProps = HTMLProps<HTMLDivElement> & {
|
|
389
411
|
children: React.ReactNode;
|
|
390
412
|
};
|
|
@@ -593,9 +615,38 @@ declare function TagList(props: TagListProps): react_jsx_runtime.JSX.Element;
|
|
|
593
615
|
*/
|
|
594
616
|
declare function Tag(props: TagProps): react_jsx_runtime.JSX.Element;
|
|
595
617
|
|
|
596
|
-
type HeroProps = HTMLProps<HTMLDivElement> & {
|
|
618
|
+
type HeroProps = HTMLProps<HTMLDivElement> & VariantProps<typeof variants> & {
|
|
619
|
+
children: React.ReactNode;
|
|
620
|
+
};
|
|
621
|
+
declare const variants: (props?: ({
|
|
622
|
+
variant?: "standard" | "full-bleed" | "two-column" | undefined;
|
|
623
|
+
} & ({
|
|
624
|
+
class?: cva.ClassValue;
|
|
625
|
+
className?: never;
|
|
626
|
+
} | {
|
|
627
|
+
class?: never;
|
|
628
|
+
className?: cva.ClassValue;
|
|
629
|
+
})) | undefined) => string;
|
|
630
|
+
declare const Hero: ({ variant, className, children }: HeroProps) => react_jsx_runtime.JSX.Element;
|
|
631
|
+
|
|
632
|
+
type CarouselProps = {
|
|
633
|
+
/** The <CarouselItem/> components to be displayed within the carousel. */
|
|
634
|
+
children: React.ReactNode;
|
|
635
|
+
/** Additional CSS className for the element. */
|
|
636
|
+
className?: string;
|
|
637
|
+
};
|
|
638
|
+
declare const Carousel: ({ className, children }: CarouselProps) => react_jsx_runtime.JSX.Element;
|
|
639
|
+
type CarouselItemsProps = {
|
|
640
|
+
/** Additional CSS className for the element. */
|
|
641
|
+
children: React.ReactNode;
|
|
642
|
+
/** The <CarouselItem/> components to be displayed within the carousel. */
|
|
643
|
+
className?: string;
|
|
644
|
+
};
|
|
645
|
+
declare const CarouselItems: ({ className, children }: CarouselItemsProps) => react_jsx_runtime.JSX.Element;
|
|
646
|
+
type CarouselItemProps = {
|
|
647
|
+
className?: string;
|
|
597
648
|
children: React.ReactNode;
|
|
598
649
|
};
|
|
599
|
-
declare const
|
|
650
|
+
declare const CarouselItem: ({ className, children }: CarouselItemProps) => react_jsx_runtime.JSX.Element;
|
|
600
651
|
|
|
601
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, Alertbox, type Props as AlertboxProps, Avatar, type AvatarProps, Backlink, type BacklinkProps, Badge, type BadgeProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, Caption, type CaptionProps, Card, CardLink, type CardLinkProps, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, type ComboboxProps, ListBoxSection as ComboboxSection, Content, ContentContext, type ContentProps, DateFormatter, type DateFormatterProps, Description, type DescriptionProps, DisclosureStateContext, ErrorMessage, type ErrorMessageProps, Footer, type FooterProps, GrunnmurenProvider, type GrunnmurenProviderProps, Heading, HeadingContext, type HeadingProps, Label, type Locale, Media, type MediaProps, NumberField, type NumberFieldProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, type SelectProps, ListBoxSection as SelectSection, type TagGroupProps, type TagListProps, type TagProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, Dialog as UNSAFE_Dialog, type DialogProps as UNSAFE_DialogProps, DialogTrigger as UNSAFE_DialogTrigger, type DialogTriggerProps as UNSAFE_DialogTriggerProps, Disclosure as UNSAFE_Disclosure, DisclosureButton as UNSAFE_DisclosureButton, type DisclosureButtonProps as UNSAFE_DisclosureButtonProps, DisclosurePanel as UNSAFE_DisclosurePanel, type DisclosurePanelProps as UNSAFE_DisclosurePanelProps, type DisclosureProps as UNSAFE_DisclosureProps, FileUpload as UNSAFE_FileUpload, type FileUploadProps as UNSAFE_FileUploadProps, Hero as UNSAFE_Hero, type HeroProps as UNSAFE_HeroProps, Modal as UNSAFE_Modal, type ModalProps as UNSAFE_ModalProps, Tag as UNSAFE_Tag, TagGroup as UNSAFE_TagGroup, TagList as UNSAFE_TagList, VideoLoop, _useLocale as useLocale };
|
|
652
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, Alertbox, type Props as AlertboxProps, Avatar, type AvatarProps, Backlink, type BacklinkProps, Badge, type BadgeProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonContext, type ButtonProps, Caption, type CaptionProps, Card, CardLink, type CardLinkProps, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, type ComboboxProps, ListBoxSection as ComboboxSection, Content, ContentContext, type ContentProps, DateFormatter, type DateFormatterProps, Description, type DescriptionProps, DisclosureStateContext, ErrorMessage, type ErrorMessageProps, Footer, type FooterProps, GrunnmurenProvider, type GrunnmurenProviderProps, Heading, HeadingContext, type HeadingProps, Label, type Locale, Media, MediaContext, type MediaProps, NumberField, type NumberFieldProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, type SelectProps, ListBoxSection as SelectSection, type TagGroupProps, type TagListProps, type TagProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, Carousel as UNSAFE_Carousel, CarouselItem as UNSAFE_CarouselItem, type CarouselItemProps as UNSAFE_CarouselItemProps, CarouselItems as UNSAFE_CarouselItems, type CarouselItemsProps as UNSAFE_CarouselItemsProps, type CarouselProps as UNSAFE_CarouselProps, Dialog as UNSAFE_Dialog, type DialogProps as UNSAFE_DialogProps, DialogTrigger as UNSAFE_DialogTrigger, type DialogTriggerProps as UNSAFE_DialogTriggerProps, Disclosure as UNSAFE_Disclosure, DisclosureButton as UNSAFE_DisclosureButton, type DisclosureButtonProps as UNSAFE_DisclosureButtonProps, DisclosurePanel as UNSAFE_DisclosurePanel, type DisclosurePanelProps as UNSAFE_DisclosurePanelProps, type DisclosureProps as UNSAFE_DisclosureProps, FileUpload as UNSAFE_FileUpload, type FileUploadProps as UNSAFE_FileUploadProps, Hero as UNSAFE_Hero, type HeroProps as UNSAFE_HeroProps, Modal as UNSAFE_Modal, type ModalProps as UNSAFE_ModalProps, Tag as UNSAFE_Tag, TagGroup as UNSAFE_TagGroup, TagList as UNSAFE_TagList, VideoLoop, _useLocale as useLocale };
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { I18nProvider, RouterProvider, useLocale, useContextProps, Provider, Link, Button as Button$1, Text, CheckboxContext, Checkbox as Checkbox$1, FieldError, Label as Label$1, CheckboxGroup as CheckboxGroup$1, ListBoxItem as ListBoxItem$1, ListBoxSection as ListBoxSection$1, Header, ListBox as ListBox$1, ComboBox, Group, Input, Popover, RadioGroup as RadioGroup$1, Radio as Radio$1, Select as Select$1, SelectValue, TextField as TextField$1, TextArea as TextArea$1, NumberField as NumberField$1, Breadcrumbs as Breadcrumbs$1, Breadcrumb as Breadcrumb$1, ButtonContext, DisclosureContext, DisclosureGroupStateContext, DEFAULT_SLOT, useSlottedContext, FormContext, FieldErrorContext, LabelContext, InputContext, DialogTrigger as DialogTrigger$1, Modal as Modal$1, Dialog as Dialog$1, ModalOverlay as ModalOverlay$1, TagGroup as TagGroup$1, TagList as TagList$1, Tag as Tag$1 } from 'react-aria-components';
|
|
3
|
-
export { Form, DisclosureGroup as UNSAFE_DisclosureGroup } from 'react-aria-components';
|
|
2
|
+
import { I18nProvider, RouterProvider, useLocale, useContextProps, Provider, Link, Button as Button$1, Text, CheckboxContext, Checkbox as Checkbox$1, FieldError, Label as Label$1, CheckboxGroup as CheckboxGroup$1, ListBoxItem as ListBoxItem$1, ListBoxSection as ListBoxSection$1, Header, ListBox as ListBox$1, ComboBox, Group, Input, Popover, RadioGroup as RadioGroup$1, Radio as Radio$1, Select as Select$1, SelectValue, TextField as TextField$1, TextArea as TextArea$1, NumberField as NumberField$1, Breadcrumbs as Breadcrumbs$1, Breadcrumb as Breadcrumb$1, ButtonContext as ButtonContext$1, DisclosureContext, DisclosureGroupStateContext, DEFAULT_SLOT, useSlottedContext, FormContext, FieldErrorContext, LabelContext, InputContext, DialogTrigger as DialogTrigger$1, Modal as Modal$1, Dialog as Dialog$1, ModalOverlay as ModalOverlay$1, TagGroup as TagGroup$1, TagList as TagList$1, Tag as Tag$1, GroupContext } from 'react-aria-components';
|
|
3
|
+
export { Form, Group, DisclosureGroup as UNSAFE_DisclosureGroup } from 'react-aria-components';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { ChevronDown, LoadingSpinner, Check, Close, InfoCircle, CheckCircle, Warning, Error, ChevronRight, ChevronLeft, PlayerPause, PlayerPlay, Trash, User } from '@obosbbl/grunnmuren-icons-react';
|
|
6
6
|
import { useLayoutEffect, filterDOMProps, mergeRefs, mergeProps, useObjectRef, useFormReset, useUpdateEffect } from '@react-aria/utils';
|
|
7
|
-
import {
|
|
7
|
+
import { cva, cx, compose } from 'cva';
|
|
8
8
|
import { createContext, Children, useId, useState, useRef, useEffect, useContext, useCallback } from 'react';
|
|
9
9
|
import { useProgressBar, useDateFormatter, useFocusRing, useDisclosure, useField } from 'react-aria';
|
|
10
10
|
import { useDisclosureState } from 'react-stately';
|
|
@@ -12,6 +12,7 @@ import { useFormValidation } from '@react-aria/form';
|
|
|
12
12
|
import { useFormValidationState } from '@react-stately/form';
|
|
13
13
|
import { useControlledState } from '@react-stately/utils';
|
|
14
14
|
import { PressResponder } from '@react-aria/interactions';
|
|
15
|
+
import { useDebouncedCallback } from 'use-debounce';
|
|
15
16
|
|
|
16
17
|
function GrunnmurenProvider({ children, locale = 'nb', navigate, useHref }) {
|
|
17
18
|
return /*#__PURE__*/ jsx(I18nProvider, {
|
|
@@ -33,13 +34,27 @@ function GrunnmurenProvider({ children, locale = 'nb', navigate, useHref }) {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
const HeadingContext = /*#__PURE__*/ createContext({});
|
|
37
|
+
const headingVariants = cva({
|
|
38
|
+
variants: {
|
|
39
|
+
/** The visual text size of the heading */ size: {
|
|
40
|
+
xl: 'heading-xl',
|
|
41
|
+
l: 'heading-l',
|
|
42
|
+
m: 'heading-m',
|
|
43
|
+
s: 'heading-s',
|
|
44
|
+
xs: 'heading-xs'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
36
48
|
const Heading = ({ ref = null, ...props })=>{
|
|
37
49
|
[props, ref] = useContextProps(props, ref, HeadingContext);
|
|
38
|
-
const { children, level, className, _innerWrapper: innerWrapper, _outerWrapper: outerWrapper, ...restProps } = props;
|
|
50
|
+
const { children, level, size, className, _innerWrapper: innerWrapper, _outerWrapper: outerWrapper, ...restProps } = props;
|
|
51
|
+
const _className = headingVariants({
|
|
52
|
+
size
|
|
53
|
+
});
|
|
39
54
|
const Element = `h${level}`;
|
|
40
55
|
const content = /*#__PURE__*/ jsx(Element, {
|
|
41
56
|
...restProps,
|
|
42
|
-
className: className,
|
|
57
|
+
className: cx(className, _className),
|
|
43
58
|
"data-slot": "heading",
|
|
44
59
|
children: innerWrapper ? innerWrapper(children) : children
|
|
45
60
|
});
|
|
@@ -55,10 +70,35 @@ const Content = ({ ref = null, ...props })=>{
|
|
|
55
70
|
});
|
|
56
71
|
return outerWrapper ? outerWrapper(content) : content;
|
|
57
72
|
};
|
|
58
|
-
const
|
|
59
|
-
|
|
73
|
+
const mediaVariant = cva({
|
|
74
|
+
variants: {
|
|
75
|
+
/**
|
|
76
|
+
* Control how the content should be placed with the object-fit property
|
|
77
|
+
* You might for example want to use `fit="contain"` portrait images that should not be cropped
|
|
78
|
+
* @default cover
|
|
79
|
+
* */ fit: {
|
|
80
|
+
cover: '*:object-cover',
|
|
81
|
+
contain: '*:object-contain'
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const MediaContext = /*#__PURE__*/ createContext({});
|
|
86
|
+
const Media = ({ ref = null, ...props })=>{
|
|
87
|
+
[props, ref] = useContextProps(props, ref, MediaContext);
|
|
88
|
+
const { className, fit, ...restProps } = props;
|
|
89
|
+
const _className = mediaVariant({
|
|
90
|
+
fit
|
|
91
|
+
});
|
|
92
|
+
return /*#__PURE__*/ jsx("div", {
|
|
93
|
+
ref: ref,
|
|
94
|
+
className: cx(className, _className),
|
|
95
|
+
// This can be used (internally) in other components
|
|
96
|
+
// to apply custom styles to the media element depending on the fit
|
|
97
|
+
"data-fit": fit,
|
|
98
|
+
...restProps,
|
|
60
99
|
"data-slot": "media"
|
|
61
100
|
});
|
|
101
|
+
};
|
|
62
102
|
const Caption = ({ className, ...restProps })=>/*#__PURE__*/ jsx("div", {
|
|
63
103
|
...restProps,
|
|
64
104
|
className: cx('description', className),
|
|
@@ -225,6 +265,16 @@ const translations$1 = {
|
|
|
225
265
|
nb: 'Vis mindre',
|
|
226
266
|
sv: 'Dölj',
|
|
227
267
|
en: 'Show less'
|
|
268
|
+
},
|
|
269
|
+
previous: {
|
|
270
|
+
nb: 'Forrige',
|
|
271
|
+
sv: 'Föregående',
|
|
272
|
+
en: 'Previous'
|
|
273
|
+
},
|
|
274
|
+
next: {
|
|
275
|
+
nb: 'Neste',
|
|
276
|
+
sv: 'Nästa',
|
|
277
|
+
en: 'Next'
|
|
228
278
|
}
|
|
229
279
|
};
|
|
230
280
|
|
|
@@ -321,11 +371,13 @@ const translations$1 = {
|
|
|
321
371
|
isPending: false
|
|
322
372
|
}
|
|
323
373
|
});
|
|
374
|
+
const ButtonContext = /*#__PURE__*/ createContext({});
|
|
324
375
|
function isLinkProps$1(props) {
|
|
325
376
|
return !!props.href;
|
|
326
377
|
}
|
|
327
|
-
function Button(props) {
|
|
328
|
-
|
|
378
|
+
function Button({ ref = null, ...props }) {
|
|
379
|
+
[props, ref] = useContextProps(props, ref, ButtonContext);
|
|
380
|
+
const { children: _children, color, isIconOnly, isLoading, variant, isPending: _isPending, ...restProps } = props;
|
|
329
381
|
const isPending = _isPending || isLoading;
|
|
330
382
|
const className = buttonVariants({
|
|
331
383
|
className: props.className,
|
|
@@ -1065,14 +1117,6 @@ const cardVariants = cva({
|
|
|
1065
1117
|
'rounded-2xl border p-3',
|
|
1066
1118
|
'flex gap-y-4',
|
|
1067
1119
|
'relative',
|
|
1068
|
-
// **** Heading ****
|
|
1069
|
-
'[&_[data-slot="heading"]]:inline',
|
|
1070
|
-
'[&_[data-slot="heading"]]:heading-s',
|
|
1071
|
-
'[&_[data-slot="heading"]]:leading-6',
|
|
1072
|
-
'[&_[data-slot="heading"]]:w-fit',
|
|
1073
|
-
'[&_[data-slot="heading"]]:text-pretty',
|
|
1074
|
-
'[&_[data-slot="heading"]]:hyphens-auto',
|
|
1075
|
-
'[&_[data-slot="heading"]]:[word-break:break-word]',
|
|
1076
1120
|
// **** Content ****
|
|
1077
1121
|
'[&_[data-slot="content"]]:flex [&_[data-slot="content"]]:flex-col [&_[data-slot="content"]]:gap-y-4',
|
|
1078
1122
|
// **** Media ****
|
|
@@ -1089,21 +1133,7 @@ const cardVariants = cva({
|
|
|
1089
1133
|
// **** Hover ****
|
|
1090
1134
|
// Enables the zoom hover effect on media (note that we can't use group-hover/card here, because there might be other clickable elements in the card aside from the heading)
|
|
1091
1135
|
'[&:has([data-slot="card-link"]_a:hover)_[data-slot="media"]>img]:scale-110',
|
|
1092
|
-
// **** Card link in Heading ****
|
|
1093
1136
|
'[&:has([data-slot="heading"]_[data-slot="card-link"]:hover)_[data-slot="media"]>img]:scale-110',
|
|
1094
|
-
// Border (bottom/top) is set to transparent to make sure the bottom underline is not visible when the card is hovered
|
|
1095
|
-
// Border top is set to even out the border bottom used for the underline
|
|
1096
|
-
'[&_[data-slot="heading"]_[data-slot="card-link"]]:no-underline',
|
|
1097
|
-
'[&_[data-slot="heading"]_[data-slot="card-link"]]:border-y-2',
|
|
1098
|
-
'[&_[data-slot="heading"]_[data-slot="card-link"]]:border-y-transparent',
|
|
1099
|
-
'[&_[data-slot="heading"]_[data-slot="card-link"]]:transition-colors',
|
|
1100
|
-
'[&_[data-slot="heading"]_[data-slot="card-link"]:hover]:border-b-current',
|
|
1101
|
-
// Mimic heading styles for the card link if placed in the heading slot. This is necessary to make the custom underline align with the link text
|
|
1102
|
-
'[&_[data-slot="heading"]_[data-slot="card-link"]]:heading-s',
|
|
1103
|
-
'[&_[data-slot="heading"]_[data-slot="card-link"]]:leading-6',
|
|
1104
|
-
'[&_[data-slot="heading"]_[data-slot="card-link"]]:text-pretty',
|
|
1105
|
-
'[&_[data-slot="heading"]_[data-slot="card-link"]]:hyphens-auto',
|
|
1106
|
-
'[&_[data-slot="heading"]_[data-slot="card-link"]]:[word-break:break-word]',
|
|
1107
1137
|
// **** Fail-safe for interactive elements ****
|
|
1108
1138
|
// Make interactive elements clickable by themselves, while the rest of the card is clickable as a whole
|
|
1109
1139
|
// The card is made clickable by a pseudo-element on the heading that covers the entire card
|
|
@@ -1206,7 +1236,37 @@ const Card = ({ children, className: _className, variant, layout, ...restProps }
|
|
|
1206
1236
|
return /*#__PURE__*/ jsx("div", {
|
|
1207
1237
|
className: className,
|
|
1208
1238
|
...restProps,
|
|
1209
|
-
children:
|
|
1239
|
+
children: /*#__PURE__*/ jsx(Provider, {
|
|
1240
|
+
values: [
|
|
1241
|
+
[
|
|
1242
|
+
HeadingContext,
|
|
1243
|
+
{
|
|
1244
|
+
size: 's',
|
|
1245
|
+
className: cx([
|
|
1246
|
+
'inline',
|
|
1247
|
+
'w-fit',
|
|
1248
|
+
'text-pretty',
|
|
1249
|
+
'hyphens-auto',
|
|
1250
|
+
'[word-break:break-word]',
|
|
1251
|
+
// **** Card link in Heading ****
|
|
1252
|
+
// Border (bottom/top) is set to transparent to make sure the bottom underline is not visible when the card is hovered
|
|
1253
|
+
// Border top is set to even out the border bottom used for the underline
|
|
1254
|
+
'*:data-[slot="card-link"]:no-underline',
|
|
1255
|
+
'*:data-[slot="card-link"]:border-y-2',
|
|
1256
|
+
'*:data-[slot="card-link"]:border-y-transparent',
|
|
1257
|
+
'*:data-[slot="card-link"]:transition-colors',
|
|
1258
|
+
'*:data-[slot="card-link"]:hover:border-b-current',
|
|
1259
|
+
// Mimic heading styles for the card link if placed in the heading slot. This is necessary to make the custom underline align with the link text
|
|
1260
|
+
'*:data-[slot="card-link"]:font-inherit',
|
|
1261
|
+
'*:data-[slot="card-link"]:text-pretty',
|
|
1262
|
+
'*:data-[slot="card-link"]:hyphens-auto',
|
|
1263
|
+
'*:data-[slot="card-link"]:[word-break:break-word]'
|
|
1264
|
+
])
|
|
1265
|
+
}
|
|
1266
|
+
]
|
|
1267
|
+
],
|
|
1268
|
+
children: children
|
|
1269
|
+
})
|
|
1210
1270
|
});
|
|
1211
1271
|
};
|
|
1212
1272
|
const cardLinkVariants = cva({
|
|
@@ -1321,7 +1381,7 @@ const VideoLoop = ({ src, format, alt, className })=>{
|
|
|
1321
1381
|
"aria-hidden": true,
|
|
1322
1382
|
ref: videoRef,
|
|
1323
1383
|
// cursor-pointer is not working on the button below, so we add it here for the same effect
|
|
1324
|
-
className: "h-full max-h-[inherit] w-full cursor-pointer object-cover",
|
|
1384
|
+
className: "h-full max-h-[inherit] w-full cursor-pointer rounded-[inherit] object-cover",
|
|
1325
1385
|
playsInline: true,
|
|
1326
1386
|
loop: userPrefersReducedMotion === false,
|
|
1327
1387
|
autoPlay: userPrefersReducedMotion === false,
|
|
@@ -1340,10 +1400,11 @@ const VideoLoop = ({ src, format, alt, className })=>{
|
|
|
1340
1400
|
})
|
|
1341
1401
|
}),
|
|
1342
1402
|
userPrefersReducedMotion !== null && /*#__PURE__*/ jsx("button", {
|
|
1403
|
+
"data-slot": "video-loop-button",
|
|
1343
1404
|
"aria-hidden": true,
|
|
1344
1405
|
type: "button",
|
|
1345
1406
|
onClick: ()=>setShouldPlay((prevState)=>!prevState),
|
|
1346
|
-
className: cx('absolute top-0 right-0 bottom-0 left-0 m-auto grid place-items-center', 'focus-visible:outline-focus focus-visible:outline-focus-offset', // Setting the opacity to 0 before applying the transition below will ensure the button only fades in after the video has started playing
|
|
1407
|
+
className: cx('absolute top-0 right-0 bottom-0 left-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
|
|
1347
1408
|
shouldPlay && 'opacity-0', isPlaying && [
|
|
1348
1409
|
'transition-opacity duration-200',
|
|
1349
1410
|
// Only show the pause button when the video is hovered or focused
|
|
@@ -1388,7 +1449,7 @@ const disclosureButtonVariants = cva({
|
|
|
1388
1449
|
}
|
|
1389
1450
|
});
|
|
1390
1451
|
const DisclosureButton = ({ className, withChevron, isIconOnly, children, ref: _ref, ...restProps })=>{
|
|
1391
|
-
const [props, ref] = useContextProps(restProps, _ref, ButtonContext);
|
|
1452
|
+
const [props, ref] = useContextProps(restProps, _ref, ButtonContext$1);
|
|
1392
1453
|
return /*#__PURE__*/ jsxs(Button$1, {
|
|
1393
1454
|
...props,
|
|
1394
1455
|
ref: ref,
|
|
@@ -1443,7 +1504,7 @@ const Disclosure = ({ ref: _ref, children, ..._props })=>{
|
|
|
1443
1504
|
state
|
|
1444
1505
|
],
|
|
1445
1506
|
[
|
|
1446
|
-
ButtonContext,
|
|
1507
|
+
ButtonContext$1,
|
|
1447
1508
|
{
|
|
1448
1509
|
slots: {
|
|
1449
1510
|
[DEFAULT_SLOT]: {},
|
|
@@ -1513,7 +1574,7 @@ const DisclosurePanel = ({ ref, children, ...props })=>{
|
|
|
1513
1574
|
null
|
|
1514
1575
|
],
|
|
1515
1576
|
[
|
|
1516
|
-
ButtonContext,
|
|
1577
|
+
ButtonContext$1,
|
|
1517
1578
|
null
|
|
1518
1579
|
]
|
|
1519
1580
|
],
|
|
@@ -1705,7 +1766,7 @@ const FileUpload = ({ children, files: _files, onChange, validate, isInvalid: _i
|
|
|
1705
1766
|
}
|
|
1706
1767
|
],
|
|
1707
1768
|
[
|
|
1708
|
-
ButtonContext,
|
|
1769
|
+
ButtonContext$1,
|
|
1709
1770
|
{
|
|
1710
1771
|
// The button acts as the trigger for the file input, which is why we connect the label to the button id
|
|
1711
1772
|
id,
|
|
@@ -1861,7 +1922,7 @@ const Dialog = ({ className, children, ...restProps })=>{
|
|
|
1861
1922
|
}
|
|
1862
1923
|
],
|
|
1863
1924
|
[
|
|
1864
|
-
ButtonContext,
|
|
1925
|
+
ButtonContext$1,
|
|
1865
1926
|
{
|
|
1866
1927
|
// This is necessary to support multiple close buttons
|
|
1867
1928
|
slots: {
|
|
@@ -1944,19 +2005,262 @@ const tagVariants = cva({
|
|
|
1944
2005
|
});
|
|
1945
2006
|
}
|
|
1946
2007
|
|
|
1947
|
-
const
|
|
2008
|
+
const roundedMediaCorners = '*:data-[slot="media"]:*:rounded-3xl';
|
|
2009
|
+
// Common variant for "standard" and "full-bleed" Hero variants
|
|
2010
|
+
const oneColumnLayout = [
|
|
2011
|
+
// Vertical spacing in the <Content>
|
|
2012
|
+
'lg:*:data-[slot="content"]:gap-y-4',
|
|
2013
|
+
// Main text content takes up 9 columns on medium screens and above
|
|
2014
|
+
'lg:*:data-[slot="content"]:col-span-9',
|
|
2015
|
+
// Make sure other elements than <Content> and <Media> (i.e CTA) does not span the full width on small screens
|
|
2016
|
+
'*:not-data-[slot="content"]:not-data-[slot="media"]:w-fit',
|
|
2017
|
+
// Other elements than <Content> and <Media> (e.g. CTA, SVG logo or Badge) take up 3 columns on medium screens and above, and are right aligned
|
|
2018
|
+
'lg:*:not-data-[slot="content"]:not-data-[slot="media"]:not-data-[slot="carousel"]:col-span-3 lg:*:not-data-[slot="content"]:not-data-[slot="media"]:justify-self-end',
|
|
2019
|
+
// <Media> and <Carousel> content takes up the full width on medium screens and above
|
|
2020
|
+
'lg:*:data-[slot="media"]:col-span-full *:data-[slot="media"]:*:w-full',
|
|
2021
|
+
'lg:*:data-[slot="carousel"]:col-span-full *:data-[slot="carousel"]:*:w-full',
|
|
2022
|
+
// Aligns <Content> and any element beside it (e.g. <Media>, <Badge>, <CTA> etc.) to the bottom of the <Content> container
|
|
2023
|
+
'lg:items-end'
|
|
2024
|
+
];
|
|
2025
|
+
const variants = cva({
|
|
2026
|
+
base: [
|
|
2027
|
+
'container px-0',
|
|
2028
|
+
// Grid variant to position the Hero's content
|
|
2029
|
+
'grid lg:grid-cols-12 lg:gap-x-12 xl:gap-x-16',
|
|
2030
|
+
'gap-y-10 lg:gap-y-12',
|
|
2031
|
+
// Enable vertical gap within <Content>
|
|
2032
|
+
'*:data-[slot="content"]:grid',
|
|
2033
|
+
// Vertical spacing in the <Content>
|
|
2034
|
+
'*:data-[slot="content"]:gap-y-3',
|
|
2035
|
+
// Make sure <Media> content fills any available vertical and horizontal space
|
|
2036
|
+
'*:data-[slot="media"]:*:object-cover'
|
|
2037
|
+
],
|
|
2038
|
+
variants: {
|
|
2039
|
+
/**
|
|
2040
|
+
* Defines the variant of the Hero
|
|
2041
|
+
* @default standard
|
|
2042
|
+
* */ variant: {
|
|
2043
|
+
standard: [
|
|
2044
|
+
roundedMediaCorners,
|
|
2045
|
+
oneColumnLayout
|
|
2046
|
+
],
|
|
2047
|
+
'full-bleed': [
|
|
2048
|
+
oneColumnLayout,
|
|
2049
|
+
// Match the heights of the <Media> wrapper for the Media content (e.g. image, VideoLoop, video etc.)
|
|
2050
|
+
// biome-ignore lint/nursery/useSortedClasses: biome is unable to sort the custom classes for 3xl and 4xl breakpoints
|
|
2051
|
+
'*:data-[slot="media"]:*:h-70 sm:*:data-[slot="media"]:*:h-[25rem] md:*:data-[slot="media"]:*:h-[30rem] lg:*:data-[slot="media"]:*:h-[35rem] xl:*:data-[slot="media"]:*:h-[40rem] 2xl:*:data-[slot="media"]:*:h-[42rem] 3xl:*:data-[slot="media"]:*:h-[48rem] 4xl:*:data-[slot="media"]:*:h-[53rem]',
|
|
2052
|
+
// Position the media and carousel content to fill the entire viewport width
|
|
2053
|
+
'*:data-[slot="media"]:*:absolute *:data-[slot="media"]:*:left-0',
|
|
2054
|
+
'*:data-[slot="carousel"]:*:absolute *:data-[slot="carousel"]:*:left-0',
|
|
2055
|
+
'**:data-[slot="carousel-controls"]:container **:data-[slot="carousel-controls"]:right-0 **:data-[slot="carousel-controls"]:bottom-4 **:data-[slot="carousel-controls"]:left-0 **:data-[slot="carousel-controls"]:justify-end',
|
|
2056
|
+
// Override rounded corners of Carousel slots
|
|
2057
|
+
'*:data-[slot="carousel"]:*:rounded-none'
|
|
2058
|
+
],
|
|
2059
|
+
'two-column': [
|
|
2060
|
+
'lg:items-center lg:*:col-span-6',
|
|
2061
|
+
// Vertical spacing in the <Content>
|
|
2062
|
+
'lg:*:data-[slot="content"]:gap-y-7',
|
|
2063
|
+
roundedMediaCorners,
|
|
2064
|
+
// Set media aspect ratio to 1:1 (square)
|
|
2065
|
+
'lg:*:data-[slot="media"]:*:aspect-[1/1]'
|
|
2066
|
+
]
|
|
2067
|
+
}
|
|
2068
|
+
},
|
|
2069
|
+
defaultVariants: {
|
|
2070
|
+
variant: 'standard'
|
|
2071
|
+
}
|
|
2072
|
+
});
|
|
2073
|
+
const Hero = ({ variant, className, children })=>{
|
|
2074
|
+
const variantsClassName = variants({
|
|
2075
|
+
variant,
|
|
2076
|
+
className
|
|
2077
|
+
});
|
|
2078
|
+
return /*#__PURE__*/ jsx(Provider, {
|
|
2079
|
+
values: [
|
|
2080
|
+
[
|
|
2081
|
+
HeadingContext,
|
|
2082
|
+
{
|
|
2083
|
+
// Sets the default heading size for the Hero based on the variant
|
|
2084
|
+
size: variant === 'two-column' ? 'xl' : 'l'
|
|
2085
|
+
}
|
|
2086
|
+
],
|
|
2087
|
+
[
|
|
2088
|
+
GroupContext,
|
|
2089
|
+
{
|
|
2090
|
+
// Prevents the group from being announced as a group by screen readers
|
|
2091
|
+
// The Group component is used to group the Hero's CTA buttons together visually, and has no semantic meaning
|
|
2092
|
+
role: 'presentation',
|
|
2093
|
+
className: 'flex flex-wrap gap-3 *:w-fit'
|
|
2094
|
+
}
|
|
2095
|
+
]
|
|
2096
|
+
],
|
|
2097
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
2098
|
+
className: cx(variantsClassName, className),
|
|
2099
|
+
children: children
|
|
2100
|
+
})
|
|
2101
|
+
});
|
|
2102
|
+
};
|
|
2103
|
+
|
|
2104
|
+
const Carousel = ({ className, children })=>{
|
|
2105
|
+
const ref = useRef(null);
|
|
2106
|
+
const locale = _useLocale();
|
|
2107
|
+
const { previous, next } = translations$1;
|
|
2108
|
+
const [scrollTargetIndex, setScrollTargetIndex] = useState(0);
|
|
2109
|
+
const [hasReachedScrollStart, setHasReachedScrollStart] = useState(scrollTargetIndex === 0);
|
|
2110
|
+
const [hasReachedScrollEnd, setHasReachedScrollEnd] = useState(!ref.current || ref.current.children.length - 1 === scrollTargetIndex);
|
|
2111
|
+
useEffect(()=>{
|
|
2112
|
+
setHasReachedScrollStart(scrollTargetIndex === 0);
|
|
2113
|
+
setHasReachedScrollEnd(!ref.current || ref.current.children.length - 1 === scrollTargetIndex);
|
|
2114
|
+
}, [
|
|
2115
|
+
scrollTargetIndex
|
|
2116
|
+
]);
|
|
2117
|
+
// Handle scrolling when user clicks the arrow icons
|
|
2118
|
+
useUpdateEffect(()=>{
|
|
2119
|
+
if (!ref.current) return;
|
|
2120
|
+
ref.current.children[scrollTargetIndex]?.scrollIntoView({
|
|
2121
|
+
behavior: 'smooth',
|
|
2122
|
+
inline: 'start',
|
|
2123
|
+
block: 'nearest'
|
|
2124
|
+
});
|
|
2125
|
+
}, [
|
|
2126
|
+
scrollTargetIndex
|
|
2127
|
+
]);
|
|
2128
|
+
const onScroll = useDebouncedCallback((event)=>{
|
|
2129
|
+
const target = event.target;
|
|
2130
|
+
// Calculate the index of the item that is currently in view
|
|
2131
|
+
const newScrollTargetIndex = Array.from(target.children).findIndex((child)=>{
|
|
2132
|
+
const rect = child.getBoundingClientRect();
|
|
2133
|
+
return rect.left >= 0 && rect.right <= window.innerWidth && rect.top >= 0;
|
|
2134
|
+
});
|
|
2135
|
+
if (newScrollTargetIndex !== -1) {
|
|
2136
|
+
setScrollTargetIndex(newScrollTargetIndex);
|
|
2137
|
+
}
|
|
2138
|
+
}, 100);
|
|
1948
2139
|
return /*#__PURE__*/ jsx("div", {
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
2140
|
+
"data-slot": "carousel",
|
|
2141
|
+
children: /*#__PURE__*/ jsx(Provider, {
|
|
2142
|
+
values: [
|
|
2143
|
+
[
|
|
2144
|
+
CarouselItemsContext,
|
|
2145
|
+
{
|
|
2146
|
+
ref,
|
|
2147
|
+
onScroll
|
|
2148
|
+
}
|
|
2149
|
+
],
|
|
2150
|
+
[
|
|
2151
|
+
ButtonContext,
|
|
2152
|
+
{
|
|
2153
|
+
slots: {
|
|
2154
|
+
prev: {
|
|
2155
|
+
'aria-label': previous[locale],
|
|
2156
|
+
onPress: ()=>{
|
|
2157
|
+
if (scrollTargetIndex > 0) {
|
|
2158
|
+
setScrollTargetIndex((prev)=>prev - 1);
|
|
2159
|
+
}
|
|
2160
|
+
},
|
|
2161
|
+
isDisabled: hasReachedScrollStart
|
|
2162
|
+
},
|
|
2163
|
+
next: {
|
|
2164
|
+
isIconOnly: true,
|
|
2165
|
+
'aria-label': next[locale],
|
|
2166
|
+
onPress: ()=>{
|
|
2167
|
+
if (!ref.current) return;
|
|
2168
|
+
if (scrollTargetIndex < ref.current.children.length - 1) {
|
|
2169
|
+
setScrollTargetIndex((prev)=>prev + 1);
|
|
2170
|
+
}
|
|
2171
|
+
},
|
|
2172
|
+
isDisabled: hasReachedScrollEnd
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
]
|
|
2177
|
+
],
|
|
2178
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
2179
|
+
className: cx(className, 'relative rounded-3xl', // If any <CarouselItems/> (the scroll-snap container) or <VideoLoop/> component is focused, apply custom focus styles around the carousel, this makes ensures that the focus outline is visible around the carousel in all cases
|
|
2180
|
+
'[&:has([data-slot="carousel-items"]:focus-visible,[data-slot="video-loop-button"]:focus-visible)]:outline-focus', '[&:has([data-slot="carousel-items"]:focus-visible,[data-slot="video-loop-button"]:focus-visible)]:outline-focus-offset', // Unset the default focus outline for potential video loop buttons, as it interferes with the custom focus styles for the carousel
|
|
2181
|
+
'**:data-[slot="video-loop-button"]:focus-visible:outline-none'),
|
|
2182
|
+
children: [
|
|
2183
|
+
children,
|
|
2184
|
+
/*#__PURE__*/ jsxs(_CarouselControls, {
|
|
2185
|
+
children: [
|
|
2186
|
+
/*#__PURE__*/ jsx(Button, {
|
|
2187
|
+
isIconOnly: true,
|
|
2188
|
+
slot: "prev",
|
|
2189
|
+
variant: "primary",
|
|
2190
|
+
color: "white",
|
|
2191
|
+
className: cx('group/carousel-previous', hasReachedScrollStart && 'invisible'),
|
|
2192
|
+
children: /*#__PURE__*/ jsx(ChevronLeft, {
|
|
2193
|
+
className: "group-hover/carousel-previous:motion-safe:-translate-x-1 transition-transform"
|
|
2194
|
+
})
|
|
2195
|
+
}),
|
|
2196
|
+
/*#__PURE__*/ jsx(Button, {
|
|
2197
|
+
isIconOnly: true,
|
|
2198
|
+
slot: "next",
|
|
2199
|
+
variant: "primary",
|
|
2200
|
+
color: "white",
|
|
2201
|
+
className: cx('group/carousel-next', hasReachedScrollEnd && 'invisible'),
|
|
2202
|
+
children: /*#__PURE__*/ jsx(ChevronRight, {
|
|
2203
|
+
className: "transition-transform group-hover/carousel-next:motion-safe:translate-x-1"
|
|
2204
|
+
})
|
|
2205
|
+
})
|
|
2206
|
+
]
|
|
2207
|
+
})
|
|
2208
|
+
]
|
|
2209
|
+
})
|
|
2210
|
+
})
|
|
2211
|
+
});
|
|
2212
|
+
};
|
|
2213
|
+
/**
|
|
2214
|
+
* 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.
|
|
2215
|
+
* It is used to render the prev/next buttons in the carousel for now.
|
|
2216
|
+
*/ const _CarouselControls = ({ children, className })=>/*#__PURE__*/ jsx("div", {
|
|
2217
|
+
className: cx(className, 'absolute right-6 bottom-6 flex gap-x-2', // Make it easier to position in full-bleed hero variants (these style have no other side effects)
|
|
2218
|
+
'items-end *:h-fit'),
|
|
2219
|
+
"data-slot": "carousel-controls",
|
|
1958
2220
|
children: children
|
|
1959
2221
|
});
|
|
2222
|
+
const CarouselItemsContext = /*#__PURE__*/ createContext({
|
|
2223
|
+
ref: null
|
|
2224
|
+
});
|
|
2225
|
+
const CarouselItems = ({ className, children })=>/*#__PURE__*/ jsx(CarouselItemsContext.Consumer, {
|
|
2226
|
+
children: ({ ref, onScroll })=>/*#__PURE__*/ jsx("div", {
|
|
2227
|
+
"data-slot": "carousel-items",
|
|
2228
|
+
className: cx(className, [
|
|
2229
|
+
'scrollbar-hidden',
|
|
2230
|
+
'flex',
|
|
2231
|
+
'snap-x',
|
|
2232
|
+
'snap-mandatory',
|
|
2233
|
+
'overflow-x-auto',
|
|
2234
|
+
'outline-none',
|
|
2235
|
+
'rounded-[inherit]'
|
|
2236
|
+
]),
|
|
2237
|
+
ref: ref,
|
|
2238
|
+
// When the SnapEvent is supported: https://developer.mozilla.org/en-US/docs/Web/API/SnapEvent
|
|
2239
|
+
// We can use the scrollsnapchange event to detect when the user has scrolled to a new item.
|
|
2240
|
+
// We can then use Array.from(event.target.children).indexOf(event.snapTargetInline) to calculate the index of the item that is currently in view.
|
|
2241
|
+
// Another option is to use the scrollEnd event, when Safiri supports it: https://developer.apple.com/documentation/webkitjs/snap_event/scrollend_event
|
|
2242
|
+
onScroll: onScroll,
|
|
2243
|
+
children: children
|
|
2244
|
+
})
|
|
2245
|
+
});
|
|
2246
|
+
const CarouselItem = ({ className, children })=>{
|
|
2247
|
+
return /*#__PURE__*/ jsx("div", {
|
|
2248
|
+
className: cx(className, 'shrink-0 basis-full snap-start'),
|
|
2249
|
+
"data-slot": "carousel-item",
|
|
2250
|
+
children: /*#__PURE__*/ jsx(Provider, {
|
|
2251
|
+
values: [
|
|
2252
|
+
[
|
|
2253
|
+
MediaContext,
|
|
2254
|
+
{
|
|
2255
|
+
fit: 'cover',
|
|
2256
|
+
className: cx('data-[fit="contain"]:bg-blue-dark', '*:w-full', // biome-ignore lint/nursery/useSortedClasses: biome is unable to sort the custom classes for 3xl and 4xl breakpoints
|
|
2257
|
+
'*:h-70 sm:*:h-[25rem] lg:*:h-[35rem] xl:*:h-[40rem] 2xl:*:h-[42rem] 3xl:*:h-[48rem] 4xl:*:h-[53rem]')
|
|
2258
|
+
}
|
|
2259
|
+
]
|
|
2260
|
+
],
|
|
2261
|
+
children: children
|
|
2262
|
+
})
|
|
2263
|
+
});
|
|
1960
2264
|
};
|
|
1961
2265
|
|
|
1962
|
-
export { Accordion, AccordionItem, Alertbox, Avatar, Backlink, Badge, Breadcrumb, Breadcrumbs, Button, Caption, Card, CardLink, Checkbox, CheckboxGroup, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, ListBoxSection as ComboboxSection, Content, ContentContext, DateFormatter, Description, DisclosureStateContext, ErrorMessage, Footer, GrunnmurenProvider, Heading, HeadingContext, Label, Media, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, TextArea, TextField, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, Disclosure as UNSAFE_Disclosure, DisclosureButton as UNSAFE_DisclosureButton, DisclosurePanel as UNSAFE_DisclosurePanel, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Modal as UNSAFE_Modal, Tag as UNSAFE_Tag, TagGroup as UNSAFE_TagGroup, TagList as UNSAFE_TagList, VideoLoop, _useLocale as useLocale };
|
|
2266
|
+
export { Accordion, AccordionItem, Alertbox, Avatar, Backlink, Badge, Breadcrumb, Breadcrumbs, Button, ButtonContext, Caption, Card, CardLink, Checkbox, CheckboxGroup, Combobox, ListBoxHeader as ComboboxHeader, ListBoxItem as ComboboxItem, ListBoxSection as ComboboxSection, Content, ContentContext, DateFormatter, Description, DisclosureStateContext, ErrorMessage, Footer, GrunnmurenProvider, Heading, HeadingContext, Label, Media, MediaContext, NumberField, Radio, RadioGroup, Select, ListBoxHeader as SelectHeader, ListBoxItem as SelectItem, ListBoxSection as SelectSection, TextArea, TextField, Carousel as UNSAFE_Carousel, CarouselItem as UNSAFE_CarouselItem, CarouselItems as UNSAFE_CarouselItems, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, Disclosure as UNSAFE_Disclosure, DisclosureButton as UNSAFE_DisclosureButton, DisclosurePanel as UNSAFE_DisclosurePanel, FileUpload as UNSAFE_FileUpload, Hero as UNSAFE_Hero, Modal as UNSAFE_Modal, Tag as UNSAFE_Tag, TagGroup as UNSAFE_TagGroup, TagList as UNSAFE_TagList, VideoLoop, _useLocale as useLocale };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@obosbbl/grunnmuren-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Grunnmuren components in React",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/code-obos/grunnmuren"
|
|
@@ -28,13 +28,14 @@
|
|
|
28
28
|
"cva": "^1.0.0-0",
|
|
29
29
|
"react-aria": "^3.38.1",
|
|
30
30
|
"react-aria-components": "^1.7.1",
|
|
31
|
-
"react-stately": "^3.35.0"
|
|
31
|
+
"react-stately": "^3.35.0",
|
|
32
|
+
"use-debounce": "^10.0.4"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
35
|
"react": "^19"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"tailwindcss": "4.
|
|
38
|
+
"tailwindcss": "4.1.7"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|
|
40
41
|
"build": "bunchee"
|