@obosbbl/grunnmuren-react 2.0.0-canary.16 → 2.0.0-canary.18
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 +31 -2
- package/dist/index.mjs +32 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { 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';
|
|
1
|
+
import { 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';
|
|
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';
|
|
@@ -570,4 +570,33 @@ declare const _Breadcrumbs: react.ForwardRefExoticComponent<{
|
|
|
570
570
|
style?: react.CSSProperties | undefined;
|
|
571
571
|
} & Omit<BreadcrumbsProps$1<BreadcrumbProps>, "className" | "style"> & react.RefAttributes<HTMLOListElement>>;
|
|
572
572
|
|
|
573
|
-
|
|
573
|
+
type BacklinkProps = {
|
|
574
|
+
/** Additional CSS className for the element. */
|
|
575
|
+
className?: string;
|
|
576
|
+
/** Additional style properties for the element. */
|
|
577
|
+
style?: React.CSSProperties;
|
|
578
|
+
/** The URL to navigate to when clicking the backlink. */
|
|
579
|
+
href?: string;
|
|
580
|
+
/** The content of the link */
|
|
581
|
+
children?: React.ReactNode;
|
|
582
|
+
/** To add a permanent underline on the link (not only on hover)
|
|
583
|
+
* @default false
|
|
584
|
+
*/
|
|
585
|
+
withUnderline?: boolean;
|
|
586
|
+
} & Omit<LinkProps, 'className' | 'style'>;
|
|
587
|
+
declare const _Backlink: react.ForwardRefExoticComponent<{
|
|
588
|
+
/** Additional CSS className for the element. */
|
|
589
|
+
className?: string | undefined;
|
|
590
|
+
/** Additional style properties for the element. */
|
|
591
|
+
style?: react.CSSProperties | undefined;
|
|
592
|
+
/** The URL to navigate to when clicking the backlink. */
|
|
593
|
+
href?: string | undefined;
|
|
594
|
+
/** The content of the link */
|
|
595
|
+
children?: React.ReactNode;
|
|
596
|
+
/** To add a permanent underline on the link (not only on hover)
|
|
597
|
+
* @default false
|
|
598
|
+
*/
|
|
599
|
+
withUnderline?: boolean | undefined;
|
|
600
|
+
} & Omit<LinkProps, "className" | "style"> & react.RefAttributes<HTMLAnchorElement>>;
|
|
601
|
+
|
|
602
|
+
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
|
@@ -4,7 +4,7 @@ export { Form } from 'react-aria-components';
|
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { useLayoutEffect, createContext, forwardRef, Children, useId, useState, useRef } from 'react';
|
|
6
6
|
import { cx, cva, compose } from 'cva';
|
|
7
|
-
import { ChevronDown, LoadingSpinner, Check, Close, InfoCircle, CheckCircle, Warning, CloseCircle, ChevronRight } from '@obosbbl/grunnmuren-icons-react';
|
|
7
|
+
import { ChevronDown, LoadingSpinner, Check, Close, InfoCircle, CheckCircle, Warning, CloseCircle, ChevronRight, ChevronLeft } from '@obosbbl/grunnmuren-icons-react';
|
|
8
8
|
import { mergeRefs } from '@react-aria/utils';
|
|
9
9
|
|
|
10
10
|
function GrunnmurenProvider({ children, locale = 'nb', navigate }) {
|
|
@@ -50,16 +50,18 @@ const Footer = (props)=>/*#__PURE__*/ jsx("div", {
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
function Accordion(props, ref) {
|
|
53
|
-
const { children, ...restProps } = props;
|
|
53
|
+
const { children, className, ...restProps } = props;
|
|
54
54
|
const childCount = Children.count(children);
|
|
55
55
|
return /*#__PURE__*/ jsx("div", {
|
|
56
56
|
...restProps,
|
|
57
57
|
ref: ref,
|
|
58
|
+
className: cx('rounded-lg bg-white', className),
|
|
58
59
|
children: Children.map(children, (child, index)=>/*#__PURE__*/ jsxs(Fragment, {
|
|
59
60
|
children: [
|
|
60
61
|
child,
|
|
61
|
-
index < childCount - 1 &&
|
|
62
|
-
|
|
62
|
+
index < childCount - 1 && // Margin is added to enable support for containers with a background color
|
|
63
|
+
/*#__PURE__*/ jsx("hr", {
|
|
64
|
+
className: "mx-2 border-gray-light",
|
|
63
65
|
"aria-hidden": true
|
|
64
66
|
})
|
|
65
67
|
]
|
|
@@ -99,7 +101,7 @@ function AccordionItem(props, ref) {
|
|
|
99
101
|
};
|
|
100
102
|
return /*#__PURE__*/ jsx("div", {
|
|
101
103
|
...restProps,
|
|
102
|
-
className: cx('group relative', className),
|
|
104
|
+
className: cx('group relative px-2', className),
|
|
103
105
|
ref: ref,
|
|
104
106
|
"data-open": isOpen,
|
|
105
107
|
children: /*#__PURE__*/ jsx(Provider, {
|
|
@@ -107,14 +109,15 @@ function AccordionItem(props, ref) {
|
|
|
107
109
|
[
|
|
108
110
|
HeadingContext,
|
|
109
111
|
{
|
|
110
|
-
|
|
112
|
+
// Negative margin to strech the button to the entire with of the accordion (to support containers with a background color)
|
|
113
|
+
className: 'font-semibold leading-7 -mx-2',
|
|
111
114
|
// Supply a default level here to make this typecheck ok. Will be overwritten with the consumers set heading level anyways
|
|
112
115
|
level: 3,
|
|
113
116
|
_innerWrapper: (children)=>/*#__PURE__*/ jsxs("button", {
|
|
114
117
|
"aria-controls": contentId,
|
|
115
118
|
"aria-expanded": isOpen,
|
|
116
|
-
//
|
|
117
|
-
className: "
|
|
119
|
+
// Use outline with offset as focus indicator, this does not cover the left mint border on the expanded content and works with or without a background color on the accordion container
|
|
120
|
+
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-visible:outline-4 focus-visible:outline-offset-[-6px] focus-visible:outline-black",
|
|
118
121
|
id: buttonId,
|
|
119
122
|
onClick: handleOpenChange,
|
|
120
123
|
children: [
|
|
@@ -923,4 +926,24 @@ function Breadcrumb(props, ref) {
|
|
|
923
926
|
}
|
|
924
927
|
const _Breadcrumb = /*#__PURE__*/ forwardRef(Breadcrumb);
|
|
925
928
|
|
|
926
|
-
|
|
929
|
+
function Backlink(props, ref) {
|
|
930
|
+
const { className, children, href, withUnderline, ...restProps } = props;
|
|
931
|
+
return /*#__PURE__*/ jsxs(Link, {
|
|
932
|
+
className: cx(className, 'group flex max-w-fit items-center gap-3 rounded-md p-2.5 no-underline focus:outline-none focus-visible:ring focus-visible:ring-black'),
|
|
933
|
+
...restProps,
|
|
934
|
+
ref: ref,
|
|
935
|
+
href: href,
|
|
936
|
+
children: [
|
|
937
|
+
/*#__PURE__*/ jsx(ChevronLeft, {
|
|
938
|
+
className: cx('-ml-[0.5em] flex-shrink-0 transition-transform duration-300 group-hover:-translate-x-1')
|
|
939
|
+
}),
|
|
940
|
+
/*#__PURE__*/ jsx("span", {
|
|
941
|
+
className: cx('border-b-2 border-t-2 border-transparent leading-none transition-colors duration-300', withUnderline ? 'border-b-black' : 'hover:border-b-black'),
|
|
942
|
+
children: children
|
|
943
|
+
})
|
|
944
|
+
]
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
const _Backlink = /*#__PURE__*/ forwardRef(Backlink);
|
|
948
|
+
|
|
949
|
+
export { _Accordion as Accordion, _AccordionItem as AccordionItem, Alertbox, _Backlink as Backlink, _Breadcrumb as Breadcrumb, _Breadcrumbs as Breadcrumbs, _Button as Button, _Checkbox as Checkbox, _CheckboxGroup as CheckboxGroup, _Combobox as Combobox, ListBoxItem as ComboboxItem, Content, ContentContext, Footer, GrunnmurenProvider, Heading, HeadingContext, _NumberField as NumberField, _Radio as Radio, _RadioGroup as RadioGroup, _Select as Select, ListBoxItem as SelectItem, _TextArea as TextArea, _TextField as TextField };
|