@obosbbl/grunnmuren-react 1.8.0 → 1.10.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/Accordion/stories/Accordion.stories.d.ts +10 -0
- package/dist/Alert/stories/Alert.stories.d.ts +6 -0
- package/dist/Banner/stories/Banner.stories.d.ts +6 -0
- package/dist/Button/stories/Button.stories.d.ts +32 -0
- package/dist/Campaign/Campaign.d.ts +4 -5
- package/dist/Campaign/stories/Campaign.stories.d.ts +10 -0
- package/dist/Card/Card.d.ts +1 -1
- package/dist/Card/CardContent.d.ts +1 -1
- package/dist/Card/CardImage.d.ts +1 -1
- package/dist/Card/CardList.d.ts +1 -1
- package/dist/Card/stories/Card.stories.d.ts +35 -0
- package/dist/Checkbox/stories/Checkbox.stories.d.ts +9 -0
- package/dist/Chip/stories/Chip.stories.d.ts +6 -0
- package/dist/Footer/stories/Footer.stories.d.ts +6 -0
- package/dist/Form/stories/Form.stories.d.ts +14 -0
- package/dist/Hero/stories/Hero.stories.d.ts +34 -0
- package/dist/Input/stories/Input.stories.d.ts +9 -0
- package/dist/Navbar/stories/Navbar.stories.d.ts +6 -0
- package/dist/Pagination/stories/Pagination.stories.d.ts +25 -0
- package/dist/Radio/RadioContext.d.ts +1 -0
- package/dist/Radio/RadioGroup.d.ts +2 -0
- package/dist/Radio/stories/Radio.stories.d.ts +13 -0
- package/dist/Select/stories/Select.stories.d.ts +27 -0
- package/dist/Snackbar/stories/Snackbar.stories.d.ts +10 -0
- package/dist/StepList/stories/StepList.stories.d.ts +20 -0
- package/dist/TextArea/stories/TextArea.stories.d.ts +9 -0
- package/dist/TextField/stories/TextField.stories.d.ts +10 -0
- package/dist/grunnmuren.es.js +68 -35
- package/package.json +11 -11
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const Composition: {
|
|
3
|
+
readonly Text: "Text";
|
|
4
|
+
readonly Icon: "Icon";
|
|
5
|
+
readonly TextIcon: "Text Icon";
|
|
6
|
+
readonly IconText: "Icon Text";
|
|
7
|
+
};
|
|
8
|
+
type CompositionValue = (typeof Composition)[keyof typeof Composition];
|
|
9
|
+
declare const _default: {
|
|
10
|
+
title: string;
|
|
11
|
+
argTypes: {
|
|
12
|
+
composition: {
|
|
13
|
+
options: ("Text" | "Icon" | "Text Icon" | "Icon Text")[];
|
|
14
|
+
control: string;
|
|
15
|
+
defaultValue: "Text";
|
|
16
|
+
};
|
|
17
|
+
disabled: {
|
|
18
|
+
control: string;
|
|
19
|
+
defaultValue: boolean;
|
|
20
|
+
};
|
|
21
|
+
loading: {
|
|
22
|
+
control: string;
|
|
23
|
+
defaultValue: boolean;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
|
28
|
+
export declare const Default: (props: {
|
|
29
|
+
composition: CompositionValue;
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
loading: boolean;
|
|
32
|
+
}) => JSX.Element;
|
|
@@ -13,13 +13,12 @@ interface CampaignProps<T extends React.ElementType> {
|
|
|
13
13
|
*/
|
|
14
14
|
rightAlignBody?: boolean;
|
|
15
15
|
}
|
|
16
|
-
declare const Campaign: {
|
|
17
|
-
<T extends import("react").ElementType<any> = "div">(props: CampaignProps<T> & Omit<import("react").PropsWithoutRef<import("react").ComponentProps<T>>, keyof CampaignProps<T>>): JSX.Element;
|
|
18
|
-
Body: (props: CampaignBodyProps) => JSX.Element;
|
|
19
|
-
Image: (props: CampaignImageProps) => JSX.Element;
|
|
20
|
-
};
|
|
21
16
|
interface CampaignBodyProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
22
17
|
}
|
|
23
18
|
interface CampaignImageProps extends React.ComponentPropsWithoutRef<'img'> {
|
|
24
19
|
}
|
|
20
|
+
declare const Campaign: import("react").ForwardRefExoticComponent<Pick<CampaignProps<import("react").ElementType<any>> & Omit<Pick<any, string | number | symbol>, keyof CampaignProps<T>>, string | number | symbol> & import("react").RefAttributes<HTMLDivElement>> & {
|
|
21
|
+
Body: import("react").ForwardRefExoticComponent<CampaignBodyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
22
|
+
Image: import("react").ForwardRefExoticComponent<CampaignImageProps & import("react").RefAttributes<HTMLImageElement>>;
|
|
23
|
+
};
|
|
25
24
|
export { Campaign };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
parameters: {
|
|
5
|
+
layout: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
|
+
export declare const Default: () => JSX.Element;
|
|
10
|
+
export declare const WithCustomImageComponent: () => JSX.Element;
|
package/dist/Card/Card.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export interface CardProps<T extends React.ElementType> {
|
|
|
5
5
|
/** @default white */
|
|
6
6
|
bgColor?: 'white' | 'gray';
|
|
7
7
|
}
|
|
8
|
-
export declare const Card: <
|
|
8
|
+
export declare const Card: import("react").ForwardRefExoticComponent<Pick<CardProps<import("react").ElementType<any>> & Omit<Pick<any, string | number | symbol>, keyof CardProps<T>>, string | number | symbol> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface CardContentProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
3
3
|
}
|
|
4
|
-
export declare const CardContent: (
|
|
4
|
+
export declare const CardContent: import("react").ForwardRefExoticComponent<CardContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export {};
|
package/dist/Card/CardImage.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ interface CardImageProps extends React.ComponentPropsWithoutRef<'img'> {
|
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
5
|
}
|
|
6
|
-
export declare const CardImage: (
|
|
6
|
+
export declare const CardImage: import("react").ForwardRefExoticComponent<CardImageProps & import("react").RefAttributes<HTMLImageElement>>;
|
|
7
7
|
export {};
|
package/dist/Card/CardList.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { BlockBackgroundColor } from '../hooks';
|
|
|
3
3
|
interface CardListProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
4
4
|
bgColor?: BlockBackgroundColor;
|
|
5
5
|
}
|
|
6
|
-
export declare const CardList: (
|
|
6
|
+
export declare const CardList: import("react").ForwardRefExoticComponent<CardListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
7
|
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CardProps } from '../../';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
argTypes: {
|
|
9
|
+
bgColor: {
|
|
10
|
+
options: string[];
|
|
11
|
+
control: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
18
|
+
export declare const Default: {
|
|
19
|
+
(props: CardProps<'div'>): JSX.Element;
|
|
20
|
+
args: {
|
|
21
|
+
bgColor: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const Link: {
|
|
25
|
+
(props: CardProps<'div'>): JSX.Element;
|
|
26
|
+
args: {
|
|
27
|
+
bgColor: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare const CardList: {
|
|
31
|
+
(): JSX.Element;
|
|
32
|
+
parameters: {
|
|
33
|
+
layout: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const metadata: {
|
|
3
|
+
title: string;
|
|
4
|
+
parameters: {
|
|
5
|
+
layout: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export default metadata;
|
|
9
|
+
export declare const Label: () => JSX.Element;
|
|
10
|
+
export declare const ErrorMessage: () => JSX.Element;
|
|
11
|
+
export declare const Success: () => JSX.Element;
|
|
12
|
+
export declare const HelperText: () => JSX.Element;
|
|
13
|
+
export declare const Form: () => JSX.Element;
|
|
14
|
+
export declare const FormError: () => JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { HeroProps } from '../../';
|
|
3
|
+
declare const metadata: {
|
|
4
|
+
title: string;
|
|
5
|
+
argTypes: {
|
|
6
|
+
contentPosition: {
|
|
7
|
+
options: string[];
|
|
8
|
+
control: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
bgColor: {
|
|
13
|
+
options: string[];
|
|
14
|
+
control: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export default metadata;
|
|
21
|
+
export declare function WithImage(props: HeroProps): JSX.Element;
|
|
22
|
+
export declare namespace WithImage {
|
|
23
|
+
var args: {
|
|
24
|
+
readonly contentPosition: "below-center";
|
|
25
|
+
readonly bgColor: "white";
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare function WithoutImage(props: HeroProps): JSX.Element;
|
|
29
|
+
export declare namespace WithoutImage {
|
|
30
|
+
var args: {
|
|
31
|
+
contentPosition: string;
|
|
32
|
+
bgColor: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const metadata: {
|
|
3
|
+
title: string;
|
|
4
|
+
parameters: {
|
|
5
|
+
layout: string;
|
|
6
|
+
};
|
|
7
|
+
argTypes: {
|
|
8
|
+
pageCount: {
|
|
9
|
+
control: {
|
|
10
|
+
type: string;
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default metadata;
|
|
18
|
+
export declare const Default: {
|
|
19
|
+
(props: {
|
|
20
|
+
pageCount: number;
|
|
21
|
+
}): JSX.Element;
|
|
22
|
+
args: {
|
|
23
|
+
pageCount: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -4,6 +4,8 @@ export interface RadioGroupProps extends Omit<React.ComponentPropsWithoutRef<'di
|
|
|
4
4
|
defaultValue?: string;
|
|
5
5
|
/** Help text for the radio group. */
|
|
6
6
|
description?: React.ReactNode;
|
|
7
|
+
/** Error message for the form control */
|
|
8
|
+
error?: string;
|
|
7
9
|
/** The `name` attribute for the radio buttons. */
|
|
8
10
|
name: string;
|
|
9
11
|
/** The label for the radio group. */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const metadata: {
|
|
3
|
+
title: string;
|
|
4
|
+
parameters: {
|
|
5
|
+
layout: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export default metadata;
|
|
9
|
+
export declare const Uncontrolled: () => JSX.Element;
|
|
10
|
+
export declare const Controlled: () => JSX.Element;
|
|
11
|
+
export declare const WithLabelAndHelpText: () => JSX.Element;
|
|
12
|
+
export declare const WithLongLabelThatBreaksLines: () => JSX.Element;
|
|
13
|
+
export declare const WithErrorText: () => JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectProps } from '../';
|
|
3
|
+
declare const metadata: {
|
|
4
|
+
title: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
argTypes: {
|
|
9
|
+
description: {
|
|
10
|
+
defaultValue: string;
|
|
11
|
+
control: string;
|
|
12
|
+
};
|
|
13
|
+
size: {
|
|
14
|
+
defaultValue: string;
|
|
15
|
+
options: string[];
|
|
16
|
+
control: {
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
required: {
|
|
21
|
+
defaultValue: boolean;
|
|
22
|
+
control: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export default metadata;
|
|
27
|
+
export declare const Default: (props: SelectProps) => JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const metadata: {
|
|
3
|
+
title: string;
|
|
4
|
+
parameters: {
|
|
5
|
+
layout: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export default metadata;
|
|
9
|
+
export declare const Default: () => JSX.Element;
|
|
10
|
+
export declare const SnackbarWithContent: () => JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StepListProps } from '../..';
|
|
3
|
+
declare const metadata: {
|
|
4
|
+
title: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
argTypes: {
|
|
9
|
+
align: {
|
|
10
|
+
defaultValue: string;
|
|
11
|
+
options: string[];
|
|
12
|
+
control: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default metadata;
|
|
19
|
+
export declare const Numbered: (props: StepListProps) => JSX.Element;
|
|
20
|
+
export declare const Icons: (props: StepListProps) => JSX.Element;
|
package/dist/grunnmuren.es.js
CHANGED
|
@@ -488,7 +488,7 @@ function deeplyWrapStrings(children) {
|
|
|
488
488
|
}
|
|
489
489
|
const ButtonColorContext = createContext("standard");
|
|
490
490
|
const CampaignContext = createContext(true);
|
|
491
|
-
const
|
|
491
|
+
const CampaignInner = (props, ref) => {
|
|
492
492
|
const _a = props, {
|
|
493
493
|
as: Component = "div",
|
|
494
494
|
body: Body,
|
|
@@ -505,23 +505,26 @@ const Campaign = (props) => {
|
|
|
505
505
|
return /* @__PURE__ */ jsxs(Component, __spreadProps(__spreadValues({
|
|
506
506
|
className: cx(className, "grid gap-8 md:grid-flow-col md:grid-cols-[50%,50%] md:gap-0")
|
|
507
507
|
}, rest), {
|
|
508
|
+
ref,
|
|
508
509
|
children: [/* @__PURE__ */ jsx(CampaignContext.Provider, {
|
|
509
510
|
value: rightAlignBody,
|
|
510
511
|
children: Image
|
|
511
512
|
}), Body]
|
|
512
513
|
}));
|
|
513
514
|
};
|
|
514
|
-
const
|
|
515
|
+
const CampaignBase = forwardRef(CampaignInner);
|
|
516
|
+
const CampaignBody = forwardRef((props, ref) => {
|
|
515
517
|
const _a = props, {
|
|
516
518
|
className
|
|
517
519
|
} = _a, rest = __objRest(_a, [
|
|
518
520
|
"className"
|
|
519
521
|
]);
|
|
520
522
|
return /* @__PURE__ */ jsx("div", __spreadValues({
|
|
521
|
-
className: cx(className, "md:mx-18 self-center")
|
|
523
|
+
className: cx(className, "md:mx-18 self-center"),
|
|
524
|
+
ref
|
|
522
525
|
}, rest));
|
|
523
|
-
};
|
|
524
|
-
const CampaignImage = (props) => {
|
|
526
|
+
});
|
|
527
|
+
const CampaignImage = forwardRef((props, ref) => {
|
|
525
528
|
const _a = props, {
|
|
526
529
|
className: classNameProp,
|
|
527
530
|
children
|
|
@@ -534,16 +537,20 @@ const CampaignImage = (props) => {
|
|
|
534
537
|
if (isValidElement(children)) {
|
|
535
538
|
const child = Children.only(children);
|
|
536
539
|
return cloneElement(child, __spreadValues({
|
|
537
|
-
className
|
|
540
|
+
className,
|
|
541
|
+
ref
|
|
538
542
|
}, rest));
|
|
539
543
|
}
|
|
540
544
|
return /* @__PURE__ */ jsx("img", __spreadValues({
|
|
541
|
-
className
|
|
545
|
+
className,
|
|
546
|
+
ref
|
|
542
547
|
}, rest));
|
|
543
|
-
};
|
|
544
|
-
Campaign
|
|
545
|
-
|
|
546
|
-
|
|
548
|
+
});
|
|
549
|
+
const Campaign = Object.assign({}, CampaignBase, {
|
|
550
|
+
Body: CampaignBody,
|
|
551
|
+
Image: CampaignImage
|
|
552
|
+
});
|
|
553
|
+
const CardInner = (props, ref) => {
|
|
547
554
|
const _a = props, {
|
|
548
555
|
as: Component = "div",
|
|
549
556
|
className,
|
|
@@ -553,25 +560,30 @@ const Card = (props) => {
|
|
|
553
560
|
"className",
|
|
554
561
|
"bgColor"
|
|
555
562
|
]);
|
|
556
|
-
return /* @__PURE__ */ jsx(Component, __spreadValues({
|
|
563
|
+
return /* @__PURE__ */ jsx(Component, __spreadProps(__spreadValues({
|
|
557
564
|
className: cx(className, "relative overflow-hidden rounded-3xl", {
|
|
558
565
|
"border-2 border-solid bg-white": bgColor === "white",
|
|
559
566
|
"bg-gray-light": bgColor === "gray"
|
|
560
567
|
})
|
|
561
|
-
}, rest)
|
|
568
|
+
}, rest), {
|
|
569
|
+
ref
|
|
570
|
+
}));
|
|
562
571
|
};
|
|
563
|
-
const
|
|
572
|
+
const Card = forwardRef(CardInner);
|
|
573
|
+
const CardImage = forwardRef((props, ref) => {
|
|
564
574
|
const _a = props, {
|
|
565
575
|
className
|
|
566
576
|
} = _a, rest = __objRest(_a, [
|
|
567
577
|
"className"
|
|
568
578
|
]);
|
|
569
|
-
return /* @__PURE__ */ jsx("img", __spreadValues({
|
|
579
|
+
return /* @__PURE__ */ jsx("img", __spreadProps(__spreadValues({
|
|
570
580
|
className: cx(className, "w-full object-cover"),
|
|
571
581
|
loading: "lazy"
|
|
572
|
-
}, rest)
|
|
573
|
-
|
|
574
|
-
|
|
582
|
+
}, rest), {
|
|
583
|
+
ref
|
|
584
|
+
}));
|
|
585
|
+
});
|
|
586
|
+
const CardList = forwardRef((props, ref) => {
|
|
575
587
|
const _a = props, {
|
|
576
588
|
bgColor: bgColorProp,
|
|
577
589
|
className
|
|
@@ -582,21 +594,25 @@ const CardList = (props) => {
|
|
|
582
594
|
const bgColor = useBlockBackgroundColor(bgColorProp);
|
|
583
595
|
return /* @__PURE__ */ jsx("div", {
|
|
584
596
|
className: cx(bgColor, className),
|
|
585
|
-
children: /* @__PURE__ */ jsx("div", __spreadValues({
|
|
597
|
+
children: /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({
|
|
586
598
|
className: "container grid grid-cols-1 gap-12 py-16 md:grid-cols-2 md:py-20 lg:py-24"
|
|
587
|
-
}, rest)
|
|
599
|
+
}, rest), {
|
|
600
|
+
ref
|
|
601
|
+
}))
|
|
588
602
|
});
|
|
589
|
-
};
|
|
590
|
-
const CardContent = (props) => {
|
|
603
|
+
});
|
|
604
|
+
const CardContent = forwardRef((props, ref) => {
|
|
591
605
|
const _a = props, {
|
|
592
606
|
className
|
|
593
607
|
} = _a, rest = __objRest(_a, [
|
|
594
608
|
"className"
|
|
595
609
|
]);
|
|
596
|
-
return /* @__PURE__ */ jsx("div", __spreadValues({
|
|
610
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({
|
|
597
611
|
className: cx(className, "p-8 md:px-10")
|
|
598
|
-
}, rest)
|
|
599
|
-
|
|
612
|
+
}, rest), {
|
|
613
|
+
ref
|
|
614
|
+
}));
|
|
615
|
+
});
|
|
600
616
|
const CardLinkOverlay = forwardRef((props, ref) => {
|
|
601
617
|
const _a = props, {
|
|
602
618
|
className
|
|
@@ -1314,7 +1330,8 @@ const RadioContext = createContext({
|
|
|
1314
1330
|
name: void 0,
|
|
1315
1331
|
onChange: noop,
|
|
1316
1332
|
required: false,
|
|
1317
|
-
value: void 0
|
|
1333
|
+
value: void 0,
|
|
1334
|
+
error: false
|
|
1318
1335
|
});
|
|
1319
1336
|
const Radio = forwardRef((props, ref) => {
|
|
1320
1337
|
const _a = props, {
|
|
@@ -1330,12 +1347,13 @@ const Radio = forwardRef((props, ref) => {
|
|
|
1330
1347
|
name,
|
|
1331
1348
|
onChange,
|
|
1332
1349
|
required,
|
|
1333
|
-
value
|
|
1350
|
+
value,
|
|
1351
|
+
error
|
|
1334
1352
|
} = useContext(RadioContext);
|
|
1335
1353
|
return /* @__PURE__ */ jsxs("label", {
|
|
1336
1354
|
className: cx(className, "flex cursor-pointer gap-2.5"),
|
|
1337
1355
|
children: [/* @__PURE__ */ jsx("input", __spreadValues({
|
|
1338
|
-
className: "radio",
|
|
1356
|
+
className: cx("radio", error && "border-red"),
|
|
1339
1357
|
defaultChecked: !isControlled ? rest.value === defaultValue : void 0,
|
|
1340
1358
|
checked: isControlled ? rest.value === value : void 0,
|
|
1341
1359
|
name,
|
|
@@ -1352,6 +1370,8 @@ const RadioGroup = forwardRef((props, ref) => {
|
|
|
1352
1370
|
className,
|
|
1353
1371
|
defaultValue,
|
|
1354
1372
|
description,
|
|
1373
|
+
error,
|
|
1374
|
+
id: idProp,
|
|
1355
1375
|
children,
|
|
1356
1376
|
label,
|
|
1357
1377
|
name,
|
|
@@ -1362,6 +1382,8 @@ const RadioGroup = forwardRef((props, ref) => {
|
|
|
1362
1382
|
"className",
|
|
1363
1383
|
"defaultValue",
|
|
1364
1384
|
"description",
|
|
1385
|
+
"error",
|
|
1386
|
+
"id",
|
|
1365
1387
|
"children",
|
|
1366
1388
|
"label",
|
|
1367
1389
|
"name",
|
|
@@ -1379,15 +1401,22 @@ const RadioGroup = forwardRef((props, ref) => {
|
|
|
1379
1401
|
name,
|
|
1380
1402
|
onChange,
|
|
1381
1403
|
required,
|
|
1382
|
-
value
|
|
1383
|
-
|
|
1384
|
-
|
|
1404
|
+
value,
|
|
1405
|
+
error: Boolean(error)
|
|
1406
|
+
}), [defaultValue, isControlled, name, onChange, required, value, error]);
|
|
1407
|
+
const groupId = useFallbackId(idProp);
|
|
1385
1408
|
const labelId = `${groupId}:label`;
|
|
1386
|
-
const
|
|
1409
|
+
const helpTextId = `${groupId}:help`;
|
|
1410
|
+
const errorMsgId = groupId + "err";
|
|
1411
|
+
const errorMsg = error;
|
|
1387
1412
|
return /* @__PURE__ */ jsx(RadioContext.Provider, {
|
|
1388
1413
|
value: group,
|
|
1389
1414
|
children: /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({
|
|
1390
|
-
"aria-describedby":
|
|
1415
|
+
"aria-describedby": cx({
|
|
1416
|
+
[errorMsgId]: errorMsg,
|
|
1417
|
+
[helpTextId]: description
|
|
1418
|
+
}) || void 0,
|
|
1419
|
+
"aria-invalid": !!error,
|
|
1391
1420
|
"aria-labelledby": label ? labelId : void 0,
|
|
1392
1421
|
className: cx(className, "flex flex-col gap-4"),
|
|
1393
1422
|
role: "radiogroup",
|
|
@@ -1396,10 +1425,14 @@ const RadioGroup = forwardRef((props, ref) => {
|
|
|
1396
1425
|
children: [label && /* @__PURE__ */ jsx(FormLabel, {
|
|
1397
1426
|
id: labelId,
|
|
1398
1427
|
isRequired: required,
|
|
1428
|
+
isInvalid: !!error,
|
|
1399
1429
|
children: label
|
|
1400
|
-
}),
|
|
1401
|
-
id:
|
|
1430
|
+
}), description && /* @__PURE__ */ jsx(FormHelperText, {
|
|
1431
|
+
id: helpTextId,
|
|
1402
1432
|
children: description
|
|
1433
|
+
}), children, errorMsg && /* @__PURE__ */ jsx(FormErrorMessage, {
|
|
1434
|
+
id: errorMsgId,
|
|
1435
|
+
children: errorMsg
|
|
1403
1436
|
})]
|
|
1404
1437
|
}))
|
|
1405
1438
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@obosbbl/grunnmuren-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "OBOS Grunnmuren design system React components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -17,23 +17,23 @@
|
|
|
17
17
|
],
|
|
18
18
|
"types": "./dist/index.d.ts",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@babel/core": "7.20.
|
|
21
|
-
"@storybook/addon-controls": "6.5.
|
|
22
|
-
"@storybook/addon-docs": "6.5.
|
|
20
|
+
"@babel/core": "7.20.12",
|
|
21
|
+
"@storybook/addon-controls": "6.5.15",
|
|
22
|
+
"@storybook/addon-docs": "6.5.15",
|
|
23
23
|
"@storybook/addon-postcss": "2.0.0",
|
|
24
|
-
"@storybook/builder-webpack5": "6.5.
|
|
25
|
-
"@storybook/manager-webpack5": "6.5.
|
|
26
|
-
"@storybook/react": "6.5.
|
|
24
|
+
"@storybook/builder-webpack5": "6.5.15",
|
|
25
|
+
"@storybook/manager-webpack5": "6.5.15",
|
|
26
|
+
"@storybook/react": "6.5.15",
|
|
27
27
|
"@types/react": "18.0.26",
|
|
28
|
-
"@types/react-dom": "18.0.
|
|
28
|
+
"@types/react-dom": "18.0.10",
|
|
29
29
|
"@vitejs/plugin-react": "1.3.2",
|
|
30
|
-
"postcss": "8.4.
|
|
30
|
+
"postcss": "8.4.21",
|
|
31
31
|
"react": "18.2.0",
|
|
32
32
|
"react-dom": "18.2.0",
|
|
33
33
|
"require-from-string": "2.0.2",
|
|
34
|
-
"rimraf": "
|
|
34
|
+
"rimraf": "4.0.7",
|
|
35
35
|
"tailwindcss": "3.2.4",
|
|
36
|
-
"type-fest": "3.
|
|
36
|
+
"type-fest": "3.5.2",
|
|
37
37
|
"vite": "2.9.15",
|
|
38
38
|
"webpack": "5.75.0",
|
|
39
39
|
"@obosbbl/grunnmuren-tailwind": "0.8.4"
|