@obosbbl/grunnmuren-react 2.0.0-canary.40 → 2.0.0-canary.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { RouterProvider, ButtonProps as ButtonProps$1, Link, CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1, ListBoxItemProps, ComboBoxProps, RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1, SelectProps as SelectProps$1, TextFieldProps as TextFieldProps$1, NumberFieldProps as NumberFieldProps$1, ContextValue, BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1, LinkProps } from 'react-aria-components';
1
+ import { RouterProvider, ButtonProps as ButtonProps$1, LinkProps, CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1, ListBoxItemProps, ComboBoxProps, RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1, SelectProps as SelectProps$1, TextFieldProps as TextFieldProps$1, NumberFieldProps as NumberFieldProps$1, ContextValue, BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1, Link } from 'react-aria-components';
2
2
  export { ListBoxItemProps as ComboboxItemProps, Form, ListBoxItemProps as SelectItemProps } from 'react-aria-components';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
- import react__default, { HTMLProps, ForwardedRef, ReactNode } from 'react';
5
+ import { HTMLProps, ReactNode } from 'react';
6
6
  import { VariantProps } from 'cva';
7
7
  import { DateFormatterOptions } from 'react-aria';
8
8
 
@@ -28,18 +28,18 @@ type GrunnmurenProviderProps = {
28
28
  declare function GrunnmurenProvider({ children, locale, navigate, useHref, }: GrunnmurenProviderProps): react_jsx_runtime.JSX.Element;
29
29
 
30
30
  type AccordionProps = {
31
- children: react__default.ReactNode;
31
+ children: React.ReactNode;
32
32
  /** Additional CSS className for the element. */
33
33
  className?: string;
34
34
  /** Additional style properties for the element. */
35
- style?: react__default.CSSProperties;
35
+ style?: React.CSSProperties;
36
36
  };
37
37
  type AccordionItemProps = {
38
- children?: react__default.ReactNode;
38
+ children?: React.ReactNode;
39
39
  /** Additional CSS className for the element. */
40
40
  className?: string;
41
41
  /** Additional style properties for the element. */
42
- style?: react__default.CSSProperties;
42
+ style?: React.CSSProperties;
43
43
  /** Whether the accordion is open (controlled) */
44
44
  isOpen?: boolean;
45
45
  /** Whether the accordion is open by default (uncontrolled) */
@@ -47,8 +47,8 @@ type AccordionItemProps = {
47
47
  /** Handler that is called when the accordion's open state changes */
48
48
  onOpenChange?: (isOpen: boolean) => void;
49
49
  };
50
- declare const _Accordion: react__default.ForwardRefExoticComponent<AccordionProps & react__default.RefAttributes<HTMLDivElement>>;
51
- declare const _AccordionItem: react__default.ForwardRefExoticComponent<AccordionItemProps & react__default.RefAttributes<HTMLDivElement>>;
50
+ declare const _Accordion: react.ForwardRefExoticComponent<AccordionProps & react.RefAttributes<HTMLDivElement>>;
51
+ declare const _AccordionItem: react.ForwardRefExoticComponent<AccordionItemProps & react.RefAttributes<HTMLDivElement>>;
52
52
 
53
53
  type BadgeProps = VariantProps<typeof badgeVariants> & {
54
54
  children?: React.ReactNode;
@@ -249,7 +249,7 @@ type ButtonOrLinkProps$1 = VariantProps<typeof buttonVariants> & {
249
249
  /** Additional style properties for the element. */
250
250
  style?: React.CSSProperties;
251
251
  };
252
- type ButtonProps = (ButtonProps$1 | React.ComponentPropsWithoutRef<typeof Link>) & ButtonOrLinkProps$1;
252
+ type ButtonProps = (ButtonProps$1 | LinkProps) & ButtonOrLinkProps$1;
253
253
  declare const _Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
254
254
 
255
255
  type CheckboxProps = {
@@ -686,14 +686,12 @@ type HeadingProps = HTMLProps<HTMLHeadingElement> & {
686
686
  _innerWrapper?: (children: React.ReactNode) => React.ReactNode;
687
687
  };
688
688
  declare const HeadingContext: react.Context<ContextValue<Partial<HeadingProps>, HTMLHeadingElement>>;
689
- declare const Heading: (props: HeadingProps, ref: ForwardedRef<HTMLHeadingElement>) => react_jsx_runtime.JSX.Element;
690
689
  declare const ContentContext: react.Context<ContextValue<Partial<ContentProps>, HTMLDivElement>>;
691
690
  type ContentProps = HTMLProps<HTMLDivElement> & {
692
691
  children: React.ReactNode;
693
692
  /** @private Used internally for slotted components */
694
693
  _outerWrapper?: (children: React.ReactNode) => React.ReactNode;
695
694
  };
696
- declare const Content: (props: ContentProps, ref: ForwardedRef<HTMLDivElement>) => string | number | boolean | Iterable<react.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
697
695
  type MediaProps = HTMLProps<HTMLDivElement> & {
698
696
  children: React.ReactNode;
699
697
  };
@@ -702,6 +700,8 @@ type FooterProps = HTMLProps<HTMLDivElement> & {
702
700
  children: React.ReactNode;
703
701
  };
704
702
  declare const Footer: (props: FooterProps) => react_jsx_runtime.JSX.Element;
703
+ declare const _Heading: react.ForwardRefExoticComponent<Omit<HeadingProps, "ref"> & react.RefAttributes<HTMLHeadingElement>>;
704
+ declare const _Content: react.ForwardRefExoticComponent<Omit<ContentProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
705
705
 
706
706
  type BreadcrumbProps = {
707
707
  /** Additional CSS className for the element. */
@@ -837,4 +837,4 @@ type DateFormatterProps = {
837
837
  */
838
838
  declare const DateFormatter: ({ options: _options, value, children: render, }: DateFormatterProps) => ReactNode;
839
839
 
840
- export { _Accordion as Accordion, _AccordionItem as AccordionItem, type AccordionItemProps, type AccordionProps, Alertbox, type Props as AlertboxProps, _Backlink as Backlink, type BacklinkProps, _Badge as Badge, type BadgeProps, _Breadcrumb as Breadcrumb, type BreadcrumbProps, _Breadcrumbs as Breadcrumbs, type BreadcrumbsProps, _Button as Button, type ButtonProps, Card, CardLink, type CardLinkProps, type CardProps, _Checkbox as Checkbox, _CheckboxGroup as CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, _Combobox as Combobox, ListBoxItem as ComboboxItem, type ComboboxProps, Content, ContentContext, type ContentProps, DateFormatter, type DateFormatterProps, Footer, type FooterProps, GrunnmurenProvider, type GrunnmurenProviderProps, Heading, HeadingContext, type HeadingProps, type Locale, Media, type MediaProps, _NumberField as NumberField, type NumberFieldProps, _Radio as Radio, _RadioGroup as RadioGroup, type RadioGroupProps, type RadioProps, _Select as Select, ListBoxItem as SelectItem, type SelectProps, _TextArea as TextArea, type TextAreaProps, _TextField as TextField, type TextFieldProps, _useLocale as useLocale };
840
+ export { _Accordion as Accordion, _AccordionItem as AccordionItem, type AccordionItemProps, type AccordionProps, Alertbox, type Props as AlertboxProps, _Backlink as Backlink, type BacklinkProps, _Badge as Badge, type BadgeProps, _Breadcrumb as Breadcrumb, type BreadcrumbProps, _Breadcrumbs as Breadcrumbs, type BreadcrumbsProps, _Button as Button, type ButtonProps, Card, CardLink, type CardLinkProps, type CardProps, _Checkbox as Checkbox, _CheckboxGroup as CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, _Combobox as Combobox, ListBoxItem as ComboboxItem, type ComboboxProps, _Content as Content, ContentContext, type ContentProps, DateFormatter, type DateFormatterProps, Footer, type FooterProps, GrunnmurenProvider, type GrunnmurenProviderProps, _Heading as Heading, HeadingContext, type HeadingProps, type Locale, Media, type MediaProps, _NumberField as NumberField, type NumberFieldProps, _Radio as Radio, _RadioGroup as RadioGroup, type RadioGroupProps, type RadioProps, _Select as Select, ListBoxItem as SelectItem, type SelectProps, _TextArea as TextArea, type TextAreaProps, _TextField as TextField, type TextFieldProps, _useLocale as useLocale };
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use client';
2
- import { I18nProvider, RouterProvider, useLocale, useContextProps, Provider, Link, Button as Button$1, Text, CheckboxContext, Checkbox as Checkbox$1, Label as Label$1, FieldError, CheckboxGroup as CheckboxGroup$1, ListBoxItem as ListBoxItem$1, 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 } 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, 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 } from 'react-aria-components';
3
3
  export { Form } from 'react-aria-components';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
- import { createContext, forwardRef, Children, useId, useState } from 'react';
6
- import { cx, cva, compose } from 'cva';
7
5
  import { ChevronDown, LoadingSpinner, Check, Close, InfoCircle, CheckCircle, Warning, CloseCircle, ChevronRight, ChevronLeft } from '@obosbbl/grunnmuren-icons-react';
8
6
  import { useLayoutEffect } from '@react-aria/utils';
7
+ import { cx, cva, compose } from 'cva';
8
+ import { createContext, forwardRef, Children, useId, useState } from 'react';
9
9
  import { useProgressBar, useDateFormatter } from 'react-aria';
10
10
 
11
11
  function GrunnmurenProvider({ children, locale = 'nb', navigate, useHref }) {
@@ -29,6 +29,7 @@ function GrunnmurenProvider({ children, locale = 'nb', navigate, useHref }) {
29
29
 
30
30
  const HeadingContext = /*#__PURE__*/ createContext({});
31
31
  const Heading = (props, ref)=>{
32
+ // biome-ignore lint/style/noParameterAssign: fix when removing refs for React 19
32
33
  [props, ref] = useContextProps(props, ref, HeadingContext);
33
34
  const { children, level, className, _innerWrapper: innerWrapper, ...restProps } = props;
34
35
  const Element = `h${level}`;
@@ -41,6 +42,7 @@ const Heading = (props, ref)=>{
41
42
  };
42
43
  const ContentContext = /*#__PURE__*/ createContext({});
43
44
  const Content = (props, ref)=>{
45
+ // biome-ignore lint/style/noParameterAssign: fix when removing refs for React 19
44
46
  [props, ref] = useContextProps(props, ref, ContentContext);
45
47
  const { _outerWrapper: outerWrapper, ...restProps } = props;
46
48
  const content = /*#__PURE__*/ jsx("div", {
@@ -57,6 +59,8 @@ const Footer = (props)=>/*#__PURE__*/ jsx("div", {
57
59
  ...props,
58
60
  "data-slot": "footer"
59
61
  });
62
+ const _Heading = /*#__PURE__*/ forwardRef(Heading);
63
+ const _Content = /*#__PURE__*/ forwardRef(Content);
60
64
 
61
65
  function Accordion(props, ref) {
62
66
  const { children, className, ...restProps } = props;
@@ -129,6 +133,7 @@ function AccordionItem(props, ref) {
129
133
  className: "flex min-h-[44px] w-full items-center justify-between gap-1.5 rounded-lg px-2 py-3.5 text-left focus-visible:outline-focus focus-visible:outline-focus-inset",
130
134
  id: buttonId,
131
135
  onClick: handleOpenChange,
136
+ type: "button",
132
137
  children: [
133
138
  children,
134
139
  /*#__PURE__*/ jsx(ChevronDown, {
@@ -426,8 +431,8 @@ function CheckmarkBox() {
426
431
  function Checkbox(props, ref) {
427
432
  const { children, className, description, errorMessage, isInvalid: _isInvalid, ...restProps } = props;
428
433
  const id = useId();
429
- const descriptionId = 'desc' + id;
430
- const errorMessageId = 'error' + id;
434
+ const descriptionId = `desc${id}`;
435
+ const errorMessageId = `error${id}`;
431
436
  const isInvalid = errorMessage != null || _isInvalid;
432
437
  return /*#__PURE__*/ jsx("div", {
433
438
  children: /*#__PURE__*/ jsxs(CheckboxContext.Provider, {
@@ -464,15 +469,6 @@ function Checkbox(props, ref) {
464
469
  }
465
470
  const _Checkbox = /*#__PURE__*/ forwardRef(Checkbox);
466
471
 
467
- function Label(props) {
468
- const { children, className, ...restProps } = props;
469
- return /*#__PURE__*/ jsx(Label$1, {
470
- className: cx(className, 'font-semibold leading-7'),
471
- ...restProps,
472
- children: children
473
- });
474
- }
475
-
476
472
  function Description(props) {
477
473
  const { className, ...restProps } = props;
478
474
  return /*#__PURE__*/ jsx(Text, {
@@ -493,6 +489,15 @@ function Description(props) {
493
489
  });
494
490
  }
495
491
 
492
+ function Label(props) {
493
+ const { children, className, ...restProps } = props;
494
+ return /*#__PURE__*/ jsx(Label$1, {
495
+ className: cx(className, 'font-semibold leading-7'),
496
+ ...restProps,
497
+ children: children
498
+ });
499
+ }
500
+
496
501
  function CheckboxGroup(props, ref) {
497
502
  const { children, className, description, errorMessage, label, isRequired, isInvalid: _isInvalid, ...restProps } = props;
498
503
  // the order of the conditions matter here, because providing a value for isInvalid makes the validation state "controlled",
@@ -962,6 +967,7 @@ const Alertbox = ({ children, role, className, variant = 'info', isDismissable =
962
967
  className: cx('-m-2 grid h-11 w-11 place-items-center rounded-xl', 'focus-visible:outline-focus focus-visible:-outline-offset-8'),
963
968
  onClick: close,
964
969
  "aria-label": translations.close[locale],
970
+ type: "button",
965
971
  children: /*#__PURE__*/ jsx(Close, {})
966
972
  }),
967
973
  isExpandable && /*#__PURE__*/ jsxs("button", {
@@ -970,6 +976,7 @@ const Alertbox = ({ children, role, className, variant = 'info', isDismissable =
970
976
  onClick: ()=>setIsExpanded((prevState)=>!prevState),
971
977
  "aria-expanded": isExpanded,
972
978
  "aria-controls": id,
979
+ type: "button",
973
980
  children: [
974
981
  isExpanded ? translations.showLess[locale] : translations.showMore[locale],
975
982
  /*#__PURE__*/ jsx(ChevronDown, {
@@ -1056,6 +1063,8 @@ const cardVariants = cva({
1056
1063
  '[&_[data-slot="heading"]]:leading-6',
1057
1064
  '[&_[data-slot="heading"]]:w-fit',
1058
1065
  '[&_[data-slot="heading"]]:text-pretty',
1066
+ '[&_[data-slot="heading"]]:hyphens-auto',
1067
+ '[&_[data-slot="heading"]]:[word-break:break-word]',
1059
1068
  // **** Content ****
1060
1069
  '[&_[data-slot="content"]]:grid [&_[data-slot="content"]]:auto-rows-max [&_[data-slot="content"]]:gap-y-4',
1061
1070
  // **** Media ****
@@ -1081,7 +1090,11 @@ const cardVariants = cva({
1081
1090
  '[&_[data-slot="heading"]_[data-slot="card-link"]]:transition-colors',
1082
1091
  '[&_[data-slot="heading"]_[data-slot="card-link"]:hover]:border-b-current',
1083
1092
  // 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
1084
- '[&_[data-slot="heading"]_[data-slot="card-link"]]:heading-s [&_[data-slot="heading"]_[data-slot="card-link"]]:text-pretty [&_[data-slot="heading"]_[data-slot="card-link"]]:leading-6',
1093
+ '[&_[data-slot="heading"]_[data-slot="card-link"]]:heading-s',
1094
+ '[&_[data-slot="heading"]_[data-slot="card-link"]]:leading-6',
1095
+ '[&_[data-slot="heading"]_[data-slot="card-link"]]:text-pretty',
1096
+ '[&_[data-slot="heading"]_[data-slot="card-link"]]:hyphens-auto',
1097
+ '[&_[data-slot="heading"]_[data-slot="card-link"]]:[word-break:break-word]',
1085
1098
  // **** Fail-safe for interactive elements ****
1086
1099
  // Make interactive elements clickable by themselves, while the rest of the card is clickable as a whole
1087
1100
  // The card is made clickable by a pseudo-element on the heading that covers the entire card
@@ -1196,4 +1209,4 @@ const cardLinkVariants = cva({
1196
1209
  return render ? render(formatted) : formatted;
1197
1210
  };
1198
1211
 
1199
- export { _Accordion as Accordion, _AccordionItem as AccordionItem, Alertbox, _Backlink as Backlink, _Badge as Badge, _Breadcrumb as Breadcrumb, _Breadcrumbs as Breadcrumbs, _Button as Button, Card, CardLink, _Checkbox as Checkbox, _CheckboxGroup as CheckboxGroup, _Combobox as Combobox, ListBoxItem as ComboboxItem, Content, ContentContext, DateFormatter, Footer, GrunnmurenProvider, Heading, HeadingContext, Media, _NumberField as NumberField, _Radio as Radio, _RadioGroup as RadioGroup, _Select as Select, ListBoxItem as SelectItem, _TextArea as TextArea, _TextField as TextField, _useLocale as useLocale };
1212
+ export { _Accordion as Accordion, _AccordionItem as AccordionItem, Alertbox, _Backlink as Backlink, _Badge as Badge, _Breadcrumb as Breadcrumb, _Breadcrumbs as Breadcrumbs, _Button as Button, Card, CardLink, _Checkbox as Checkbox, _CheckboxGroup as CheckboxGroup, _Combobox as Combobox, ListBoxItem as ComboboxItem, _Content as Content, ContentContext, DateFormatter, Footer, GrunnmurenProvider, _Heading as Heading, HeadingContext, Media, _NumberField as NumberField, _Radio as Radio, _RadioGroup as RadioGroup, _Select as Select, ListBoxItem as SelectItem, _TextArea as TextArea, _TextField as TextField, _useLocale as useLocale };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "2.0.0-canary.40",
3
+ "version": "2.0.0-canary.43",
4
4
  "description": "Grunnmuren components in React",
5
5
  "repository": {
6
6
  "url": "https://github.com/code-obos/grunnmuren"
@@ -18,15 +18,15 @@
18
18
  "dist"
19
19
  ],
20
20
  "dependencies": {
21
- "@obosbbl/grunnmuren-icons-react": "^2.0.0-canary.1",
21
+ "@obosbbl/grunnmuren-icons-react": "^2.0.0-canary.3",
22
22
  "@react-aria/utils": "^3.25.1",
23
23
  "@types/node": "^22.0.0",
24
- "cva": "1.0.0-beta.1",
24
+ "cva": "1.0.0-beta.2",
25
25
  "react-aria": "^3.35.1",
26
26
  "react-aria-components": "^1.3.1"
27
27
  },
28
28
  "peerDependencies": {
29
- "react": "^18"
29
+ "react": "^18 || ^19"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "bunchee"