@obosbbl/grunnmuren-react 2.0.0-canary.32 → 2.0.0-canary.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { 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 { 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 } 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';
@@ -102,7 +102,7 @@ declare const buttonVariants: (props?: ({
102
102
  [x: string]: any;
103
103
  } | null | undefined;
104
104
  })) | undefined) => string;
105
- type ButtonOrLinkProps = VariantProps<typeof buttonVariants> & {
105
+ type ButtonOrLinkProps$1 = VariantProps<typeof buttonVariants> & {
106
106
  children?: React.ReactNode;
107
107
  href?: string;
108
108
  /**
@@ -111,7 +111,7 @@ type ButtonOrLinkProps = VariantProps<typeof buttonVariants> & {
111
111
  */
112
112
  isLoading?: boolean;
113
113
  };
114
- type ButtonProps = (ButtonProps$1 | React.ComponentPropsWithoutRef<typeof Link>) & ButtonOrLinkProps;
114
+ type ButtonProps = (ButtonProps$1 | React.ComponentPropsWithoutRef<typeof Link>) & ButtonOrLinkProps$1;
115
115
  declare const _Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
116
116
 
117
117
  type CheckboxProps = {
@@ -581,29 +581,18 @@ declare const _Breadcrumbs: react.ForwardRefExoticComponent<{
581
581
  style?: React.CSSProperties;
582
582
  } & Omit<BreadcrumbsProps$1<BreadcrumbProps>, "className" | "style"> & react.RefAttributes<HTMLOListElement>>;
583
583
 
584
- type BacklinkProps = {
585
- /** Additional CSS className for the element. */
586
- className?: string;
587
- /** The URL to navigate to when clicking the backlink. */
588
- href?: string;
589
- /** The content of the link */
584
+ type ButtonOrLinkProps = {
590
585
  children?: React.ReactNode;
591
- /** To add a permanent underline on the link (not only on hover)
592
- * @default false
593
- */
594
- withUnderline?: boolean;
595
- } & LinkProps;
596
- declare const _Backlink: react.ForwardRefExoticComponent<{
597
586
  /** Additional CSS className for the element. */
598
587
  className?: string;
599
- /** The URL to navigate to when clicking the backlink. */
588
+ /** Determines whether to use an anchor or a button for the Backlink */
600
589
  href?: string;
601
- /** The content of the link */
602
- children?: React.ReactNode;
603
590
  /** To add a permanent underline on the link (not only on hover)
604
591
  * @default false
605
592
  */
606
593
  withUnderline?: boolean;
607
- } & LinkProps & react.RefAttributes<HTMLAnchorElement>>;
594
+ };
595
+ type BacklinkProps = (ButtonProps$1 | React.ComponentPropsWithoutRef<typeof Link>) & ButtonOrLinkProps;
596
+ declare const _Backlink: react.ForwardRefExoticComponent<BacklinkProps & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
608
597
 
609
598
  export { _Accordion as Accordion, _AccordionItem as AccordionItem, type AccordionItemProps, type AccordionProps, Alertbox, type Props as AlertboxProps, _Backlink as Backlink, type BacklinkProps, _Breadcrumb as Breadcrumb, type BreadcrumbProps, _Breadcrumbs as Breadcrumbs, type BreadcrumbsProps, _Button as Button, type ButtonProps, _Checkbox as Checkbox, _CheckboxGroup as CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, _Combobox as Combobox, ListBoxItem as ComboboxItem, type ComboboxProps, Content, ContentContext, type ContentProps, Footer, type FooterProps, GrunnmurenProvider, type GrunnmurenProviderProps, Heading, HeadingContext, type HeadingProps, _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 };
package/dist/index.mjs CHANGED
@@ -234,8 +234,8 @@ const _AccordionItem = /*#__PURE__*/ forwardRef(AccordionItem);
234
234
  isIconOnly: false
235
235
  }
236
236
  });
237
- function isLinkProps(props) {
238
- return 'href' in props;
237
+ function isLinkProps$1(props) {
238
+ return !!props.href;
239
239
  }
240
240
  function Button(props, forwardedRef) {
241
241
  const { children: _children, color, isIconOnly, isLoading, variant, style: _style, ...restProps } = props;
@@ -270,7 +270,7 @@ function Button(props, forwardedRef) {
270
270
  ..._style,
271
271
  widthOverride
272
272
  };
273
- return isLinkProps(restProps) ? /*#__PURE__*/ jsx(Link, {
273
+ return isLinkProps$1(restProps) ? /*#__PURE__*/ jsx(Link, {
274
274
  ...restProps,
275
275
  className: className,
276
276
  style: style,
@@ -290,7 +290,7 @@ const formField = cx('group flex flex-col gap-2');
290
290
  const formFieldError = cx('w-fit rounded-sm bg-red-light px-2 py-1 text-sm leading-6 text-red');
291
291
  const input = cva({
292
292
  base: [
293
- 'rounded-md py-2.5 text-base font-normal leading-6 placeholder-[#727070] outline-none ring-1 ring-black',
293
+ 'min-h-11 rounded-md py-2.5 text-base font-normal leading-6 placeholder-[#727070] outline-none ring-1 ring-black',
294
294
  // invalid styles
295
295
  'group-data-[invalid]:ring-2 group-data-[invalid]:ring-red',
296
296
  // Fix invisible ring on safari: https://github.com/tailwindlabs/tailwindcss.com/issues/1135
@@ -317,9 +317,9 @@ const inputGroup = cx([
317
317
  'group-data-[invalid]:ring-2 group-data-[invalid]:ring-red group-data-[invalid]:focus-within:ring'
318
318
  ]);
319
319
  const dropdown = {
320
- popover: cx(// Use outline + clip-path hack instead of border to prevent scrollbars from overflowing border-radius
321
- 'min-w-[--trigger-width] overflow-y-auto rounded-md bg-white shadow outline outline-1 outline-offset-[-1px] outline-black [clip-path:content-box] data-[entering]:animate-in data-[exiting]:animate-out data-[entering]:fade-in data-[exiting]:fade-out'),
322
- listbox: cx('max-h-[25rem] text-sm outline-none'),
320
+ popover: cx('min-w-[--trigger-width] overflow-y-auto rounded-md border border-black bg-white shadow data-[entering]:animate-in data-[exiting]:animate-out data-[entering]:fade-in data-[exiting]:fade-out'),
321
+ // overflow-x-hidden is needed to prevent visible vertical scrollbars from overflowing the border radius of the popover
322
+ listbox: cx('max-h-[25rem] overflow-x-hidden text-sm outline-none'),
323
323
  chevronIcon: cx('text-base transition-transform duration-150 group-data-[open]:rotate-180 motion-reduce:transition-none')
324
324
  };
325
325
 
@@ -334,7 +334,7 @@ function ErrorMessage(props) {
334
334
  }
335
335
 
336
336
  const defaultClasses$1 = cx([
337
- 'group relative left-0 inline-flex max-w-fit cursor-pointer items-start gap-4 py-2 leading-7'
337
+ 'group relative left-0 -mx-2.5 inline-flex max-w-fit cursor-pointer items-start gap-4 p-2.5 leading-7'
338
338
  ]);
339
339
  // Pulling this out into it's own component. Will probably export it in the future
340
340
  // so it can be used in other views, outside of an input of type checkbox, like in table rows.
@@ -381,9 +381,6 @@ function Checkbox(props, ref) {
381
381
  isInvalid: isInvalid,
382
382
  ref: ref,
383
383
  children: [
384
- /*#__PURE__*/ jsx("span", {
385
- className: "absolute -left-2.5 top-0 z-10 h-11 w-11"
386
- }),
387
384
  /*#__PURE__*/ jsx(CheckmarkBox, {}),
388
385
  children
389
386
  ]
@@ -577,7 +574,7 @@ function RadioGroup(props, ref) {
577
574
  const _RadioGroup = /*#__PURE__*/ forwardRef(RadioGroup);
578
575
 
579
576
  const defaultClasses = cx([
580
- 'relative inline-flex max-w-fit cursor-pointer items-start gap-4 py-2 leading-7',
577
+ 'relative -ml-2.5 inline-flex max-w-fit cursor-pointer items-start gap-4 py-2.5 pl-2.5 leading-7',
581
578
  // the radio button itself
582
579
  'before:flex-none before:rounded-full before:border-2 before:border-black',
583
580
  // to vertically align the radio we need to calculate the label's height, which is equal to it's font size multiplied by the line height.
@@ -597,24 +594,19 @@ const defaultClasses = cx([
597
594
  ]);
598
595
  function Radio(props, ref) {
599
596
  const { children, className, description, ...restProps } = props;
600
- return /*#__PURE__*/ jsxs(Radio$1, {
597
+ return /*#__PURE__*/ jsx(Radio$1, {
601
598
  ...restProps,
602
599
  className: cx(className, defaultClasses),
603
600
  ref: ref,
604
- children: [
605
- /*#__PURE__*/ jsx("span", {
606
- className: "absolute -left-2.5 top-0 z-10 h-11 w-11 "
607
- }),
608
- /*#__PURE__*/ jsxs("div", {
609
- children: [
610
- children,
611
- description && /*#__PURE__*/ jsx(Description, {
612
- className: "mt-2 block",
613
- children: description
614
- })
615
- ]
616
- })
617
- ]
601
+ children: /*#__PURE__*/ jsxs("div", {
602
+ children: [
603
+ children,
604
+ description && /*#__PURE__*/ jsx(Description, {
605
+ className: "mt-2 block",
606
+ children: description
607
+ })
608
+ ]
609
+ })
618
610
  });
619
611
  }
620
612
  const _Radio = /*#__PURE__*/ forwardRef(Radio);
@@ -966,13 +958,17 @@ function Breadcrumb(props, ref) {
966
958
  }
967
959
  const _Breadcrumb = /*#__PURE__*/ forwardRef(Breadcrumb);
968
960
 
961
+ function isLinkProps(props) {
962
+ return !!props.href;
963
+ }
969
964
  function Backlink(props, ref) {
970
- const { className, children, href, withUnderline, ...restProps } = props;
971
- return /*#__PURE__*/ jsxs(Link, {
965
+ const { className, children, withUnderline, ...restProps } = props;
966
+ const Component = isLinkProps(props) ? Link : Button$1;
967
+ return /*#__PURE__*/ jsxs(Component, {
972
968
  className: cx(className, 'group flex max-w-fit cursor-pointer items-center gap-3 rounded-md p-2.5 no-underline focus:outline-none data-[focus-visible]:ring data-[focus-visible]:ring-black'),
973
969
  ...restProps,
970
+ // @ts-expect-error ignore the type of the ref here
974
971
  ref: ref,
975
- href: href,
976
972
  children: [
977
973
  /*#__PURE__*/ jsx(ChevronLeft, {
978
974
  className: cx('-ml-[0.5em] flex-shrink-0 transition-transform duration-300 group-hover:-translate-x-1')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "2.0.0-canary.32",
3
+ "version": "2.0.0-canary.33",
4
4
  "description": "Grunnmuren components in React",
5
5
  "repository": {
6
6
  "url": "https://github.com/code-obos/grunnmuren"
@@ -19,10 +19,10 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "@obosbbl/grunnmuren-icons-react": "^2.0.0-canary.1",
22
- "@react-aria/utils": "^3.24.1",
22
+ "@react-aria/utils": "^3.25.1",
23
23
  "@types/node": "^20.11.19",
24
24
  "cva": "1.0.0-beta.1",
25
- "react-aria-components": "^1.2.1"
25
+ "react-aria-components": "^1.3.1"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": "^18"