@obosbbl/grunnmuren-react 2.0.3 → 2.1.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 CHANGED
@@ -593,4 +593,9 @@ declare function TagList(props: TagListProps): react_jsx_runtime.JSX.Element;
593
593
  */
594
594
  declare function Tag(props: TagProps): react_jsx_runtime.JSX.Element;
595
595
 
596
- export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, Alertbox, type Props as AlertboxProps, 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, Avatar as UNSAFE_Avatar, type AvatarProps as UNSAFE_AvatarProps, 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, 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 };
596
+ type HeroProps = HTMLProps<HTMLDivElement> & {
597
+ children: React.ReactNode;
598
+ };
599
+ declare const Hero: ({ className, children }: HeroProps) => react_jsx_runtime.JSX.Element;
600
+
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 };
package/dist/index.mjs CHANGED
@@ -449,7 +449,7 @@ function Checkbox(props) {
449
449
  const id = useId();
450
450
  const descriptionId = `desc${id}`;
451
451
  const errorMessageId = `error${id}`;
452
- const isInvalid = errorMessage != null || _isInvalid;
452
+ const isInvalid = !!errorMessage || _isInvalid;
453
453
  return /*#__PURE__*/ jsx("div", {
454
454
  children: /*#__PURE__*/ jsxs(CheckboxContext.Provider, {
455
455
  value: {
@@ -516,7 +516,7 @@ function CheckboxGroup(props) {
516
516
  const { children, className, description, errorMessage, label, isRequired, isInvalid: _isInvalid, ...restProps } = props;
517
517
  // the order of the conditions matter here, because providing a value for isInvalid makes the validation state "controlled",
518
518
  // which will override any built in validation
519
- const isInvalid = errorMessage != null || _isInvalid;
519
+ const isInvalid = !!errorMessage || _isInvalid;
520
520
  return /*#__PURE__*/ jsxs(CheckboxGroup$1, {
521
521
  ...restProps,
522
522
  className: cx(className, 'flex flex-col gap-2'),
@@ -589,7 +589,7 @@ function Combobox(props) {
589
589
  const isPending = _isPending || isLoading;
590
590
  // the order of the conditions matter here, because providing a value for isInvalid makes the validation state "controlled",
591
591
  // which will override any built in validation
592
- const isInvalid = errorMessage != null || _isInvalid;
592
+ const isInvalid = !!errorMessage || _isInvalid;
593
593
  return /*#__PURE__*/ jsxs(ComboBox, {
594
594
  ...restProps,
595
595
  className: cx(className, formField),
@@ -639,12 +639,14 @@ function Combobox(props) {
639
639
  }
640
640
 
641
641
  function RadioGroup(props) {
642
- const { children, className, description, errorMessage, label, isRequired, isInvalid: _isInvalid, ...restProps } = props;
642
+ const { children, className, description, errorMessage, label, isRequired, isInvalid: _isInvalid, value, ...restProps } = props;
643
643
  // the order of the conditions matter here, because providing a value for isInvalid makes the validation state "controlled",
644
644
  // which will override any built in validation
645
- const isInvalid = errorMessage != null || _isInvalid;
645
+ const isInvalid = !!errorMessage || _isInvalid;
646
646
  return /*#__PURE__*/ jsxs(RadioGroup$1, {
647
647
  ...restProps,
648
+ // Tabindex is set to -1 when the value is an empty string, which makes the radio input not focusable
649
+ value: value === '' ? undefined : value,
648
650
  className: cx(className, 'flex flex-col gap-2'),
649
651
  isInvalid: isInvalid,
650
652
  isRequired: isRequired,
@@ -703,7 +705,7 @@ function Select(props) {
703
705
  const { className, children, description, errorMessage, label, isInvalid: _isInvalid, ref, ...restProps } = props;
704
706
  // the order of the conditions matter here, because providing a value for isInvalid makes the validation state "controlled",
705
707
  // which will override any built in validation
706
- const isInvalid = errorMessage != null || _isInvalid;
708
+ const isInvalid = !!errorMessage || _isInvalid;
707
709
  return /*#__PURE__*/ jsxs(Select$1, {
708
710
  ...restProps,
709
711
  className: cx(className, formField),
@@ -747,7 +749,7 @@ function Select(props) {
747
749
 
748
750
  function TextArea(props) {
749
751
  const { className, description, errorMessage, label, isInvalid: _isInvalid, rows, ref, ...restProps } = props;
750
- const isInvalid = errorMessage != null || _isInvalid;
752
+ const isInvalid = !!errorMessage || _isInvalid;
751
753
  return /*#__PURE__*/ jsxs(TextField$1, {
752
754
  ...restProps,
753
755
  className: cx(className, formField),
@@ -788,7 +790,7 @@ function TextField(props) {
788
790
  const { className, description, errorMessage, label, leftAddon, isInvalid: _isInvalid, textAlign, rightAddon, withAddonDivider, size, ref, ...restProps } = props;
789
791
  // the order of the conditions matter here, because providing a value for isInvalid makes the validation state "controlled",
790
792
  // which will override any built in validation
791
- const isInvalid = errorMessage != null || _isInvalid;
793
+ const isInvalid = !!errorMessage || _isInvalid;
792
794
  return /*#__PURE__*/ jsxs(TextField$1, {
793
795
  ...restProps,
794
796
  className: cx(className, formField),
@@ -852,7 +854,7 @@ function NumberField(props) {
852
854
  const { className, description, errorMessage, label, leftAddon, isInvalid: _isInvalid, textAlign, rightAddon, withAddonDivider, size, ref, ...restProps } = props;
853
855
  // the order of the conditions matter here, because providing a value for isInvalid makes the validation state "controlled",
854
856
  // which will override any built in validation
855
- const isInvalid = errorMessage != null || _isInvalid;
857
+ const isInvalid = !!errorMessage || _isInvalid;
856
858
  return /*#__PURE__*/ jsxs(NumberField$1, {
857
859
  ...restProps,
858
860
  className: cx(className, formField),
@@ -1319,7 +1321,7 @@ const VideoLoop = ({ src, format, alt, className })=>{
1319
1321
  "aria-hidden": true,
1320
1322
  ref: videoRef,
1321
1323
  // cursor-pointer is not working on the button below, so we add it here for the same effect
1322
- className: "h-full w-full cursor-pointer object-cover",
1324
+ className: "h-full max-h-[inherit] w-full cursor-pointer object-cover",
1323
1325
  playsInline: true,
1324
1326
  loop: userPrefersReducedMotion === false,
1325
1327
  autoPlay: userPrefersReducedMotion === false,
@@ -1942,4 +1944,19 @@ const tagVariants = cva({
1942
1944
  });
1943
1945
  }
1944
1946
 
1945
- export { Accordion, AccordionItem, Alertbox, 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, Avatar as UNSAFE_Avatar, Dialog as UNSAFE_Dialog, DialogTrigger as UNSAFE_DialogTrigger, Disclosure as UNSAFE_Disclosure, DisclosureButton as UNSAFE_DisclosureButton, DisclosurePanel as UNSAFE_DisclosurePanel, FileUpload as UNSAFE_FileUpload, Modal as UNSAFE_Modal, Tag as UNSAFE_Tag, TagGroup as UNSAFE_TagGroup, TagList as UNSAFE_TagList, VideoLoop, _useLocale as useLocale };
1947
+ const Hero = ({ className, children })=>{
1948
+ return /*#__PURE__*/ jsx("div", {
1949
+ className: cx(// Wrap text content in a container
1950
+ '*:data-[slot="content"]:container', // Style the Hero heading
1951
+ '**:data-[slot="heading"]:heading-l', // Spacing between the media and the text content above it
1952
+ '*:data-[slot="media"]:mt-8 lg:*:data-[slot="media"]:mt-10', // Responsive heights for the <Media> wrapper component
1953
+ // biome-ignore lint/nursery/useSortedClasses: biome is unable to sort the custom classes for 3xl and 4xl breakpoints
1954
+ '*: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]', // Match the heights of the <Media> wrapper for the Media content (e.g. image, VideoLoop, video etc.)
1955
+ // biome-ignore lint/nursery/useSortedClasses: biome is unable to sort the custom classes for 3xl and 4xl breakpoints
1956
+ '*: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]', // Position the media content to fill the entire viewport width
1957
+ '*:data-[slot="media"]:*:absolute *:data-[slot="media"]:*:left-0 *:data-[slot="media"]:*:w-full *:data-[slot="media"]:*:object-cover', className),
1958
+ children: children
1959
+ });
1960
+ };
1961
+
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "Grunnmuren components in React",
5
5
  "repository": {
6
6
  "url": "https://github.com/code-obos/grunnmuren"
@@ -18,7 +18,7 @@
18
18
  "dist"
19
19
  ],
20
20
  "dependencies": {
21
- "@obosbbl/grunnmuren-icons-react": "^2.0.0",
21
+ "@obosbbl/grunnmuren-icons-react": "^2.1.0",
22
22
  "@react-aria/form": "^3.0.14",
23
23
  "@react-aria/interactions": "^3.24.1",
24
24
  "@react-aria/utils": "^3.28.1",