@obosbbl/grunnmuren-react 2.0.0-canary.1 → 2.0.0-canary.2
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/README.md +1 -1
- package/dist/index.d.mts +228 -0
- package/dist/index.mjs +585 -0
- package/dist/useClientLayoutEffect-client-2_5nawgR.js +9 -0
- package/package.json +7 -38
- package/dist/button/Button.d.mts +0 -83
- package/dist/button/Button.d.ts +0 -83
- package/dist/button/Button.mjs +0 -149
- package/dist/checkbox/index.d.mts +0 -32
- package/dist/checkbox/index.d.ts +0 -32
- package/dist/checkbox/index.mjs +0 -106
- package/dist/label/index.d.mts +0 -13
- package/dist/label/index.d.ts +0 -13
- package/dist/label/index.mjs +0 -45
- package/dist/radiogroup/index.d.mts +0 -30
- package/dist/radiogroup/index.d.ts +0 -30
- package/dist/radiogroup/index.mjs +0 -65
- package/dist/textfield/index.d.mts +0 -31
- package/dist/textfield/index.d.ts +0 -31
- package/dist/textfield/index.mjs +0 -88
package/dist/button/Button.d.mts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { VariantProps } from 'cva';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Figma: https://www.figma.com/file/9OvSg0ZXI5E1eQYi7AWiWn/Grunnmuren-2.0-%E2%94%82-Designsystem?node-id=30%3A2574&mode=dev
|
|
6
|
-
*/
|
|
7
|
-
declare const buttonVariants: (props?: ({
|
|
8
|
-
variant?: "primary" | "secondary" | "tertiary" | undefined;
|
|
9
|
-
color?: "green" | "mint" | "white" | undefined;
|
|
10
|
-
isIconOnly?: boolean | undefined;
|
|
11
|
-
} & ({
|
|
12
|
-
class?: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
|
|
13
|
-
[x: string]: any;
|
|
14
|
-
} | null | undefined)[] | {
|
|
15
|
-
[x: string]: any;
|
|
16
|
-
} | null | undefined)[] | {
|
|
17
|
-
[x: string]: any;
|
|
18
|
-
} | null | undefined)[] | {
|
|
19
|
-
[x: string]: any;
|
|
20
|
-
} | null | undefined)[] | {
|
|
21
|
-
[x: string]: any;
|
|
22
|
-
} | null | undefined)[] | {
|
|
23
|
-
[x: string]: any;
|
|
24
|
-
} | null | undefined)[] | {
|
|
25
|
-
[x: string]: any;
|
|
26
|
-
} | null | undefined)[] | {
|
|
27
|
-
[x: string]: any;
|
|
28
|
-
} | null | undefined)[] | {
|
|
29
|
-
[x: string]: any;
|
|
30
|
-
} | null | undefined)[] | {
|
|
31
|
-
[x: string]: any;
|
|
32
|
-
} | null | undefined)[] | {
|
|
33
|
-
[x: string]: any;
|
|
34
|
-
} | null | undefined)[] | {
|
|
35
|
-
[x: string]: any;
|
|
36
|
-
} | null | undefined;
|
|
37
|
-
className?: undefined;
|
|
38
|
-
} | {
|
|
39
|
-
class?: undefined;
|
|
40
|
-
className?: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
|
|
41
|
-
[x: string]: any;
|
|
42
|
-
} | null | undefined)[] | {
|
|
43
|
-
[x: string]: any;
|
|
44
|
-
} | null | undefined)[] | {
|
|
45
|
-
[x: string]: any;
|
|
46
|
-
} | null | undefined)[] | {
|
|
47
|
-
[x: string]: any;
|
|
48
|
-
} | null | undefined)[] | {
|
|
49
|
-
[x: string]: any;
|
|
50
|
-
} | null | undefined)[] | {
|
|
51
|
-
[x: string]: any;
|
|
52
|
-
} | null | undefined)[] | {
|
|
53
|
-
[x: string]: any;
|
|
54
|
-
} | null | undefined)[] | {
|
|
55
|
-
[x: string]: any;
|
|
56
|
-
} | null | undefined)[] | {
|
|
57
|
-
[x: string]: any;
|
|
58
|
-
} | null | undefined)[] | {
|
|
59
|
-
[x: string]: any;
|
|
60
|
-
} | null | undefined)[] | {
|
|
61
|
-
[x: string]: any;
|
|
62
|
-
} | null | undefined)[] | {
|
|
63
|
-
[x: string]: any;
|
|
64
|
-
} | null | undefined;
|
|
65
|
-
})) | undefined) => string;
|
|
66
|
-
type ButtonOrLinkProps = (React.ComponentPropsWithoutRef<'button'> & {
|
|
67
|
-
href?: never;
|
|
68
|
-
}) | (React.ComponentPropsWithoutRef<'a'> & {
|
|
69
|
-
href: string;
|
|
70
|
-
});
|
|
71
|
-
type ButtonProps = VariantProps<typeof buttonVariants> & {
|
|
72
|
-
className?: string;
|
|
73
|
-
children: React.ReactNode;
|
|
74
|
-
/**
|
|
75
|
-
* Display the button in a loading state
|
|
76
|
-
* @default false
|
|
77
|
-
*/
|
|
78
|
-
loading?: boolean;
|
|
79
|
-
style?: React.CSSProperties;
|
|
80
|
-
} & ButtonOrLinkProps;
|
|
81
|
-
declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
82
|
-
|
|
83
|
-
export { Button, type ButtonProps };
|
package/dist/button/Button.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { VariantProps } from 'cva';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Figma: https://www.figma.com/file/9OvSg0ZXI5E1eQYi7AWiWn/Grunnmuren-2.0-%E2%94%82-Designsystem?node-id=30%3A2574&mode=dev
|
|
6
|
-
*/
|
|
7
|
-
declare const buttonVariants: (props?: ({
|
|
8
|
-
variant?: "primary" | "secondary" | "tertiary" | undefined;
|
|
9
|
-
color?: "green" | "mint" | "white" | undefined;
|
|
10
|
-
isIconOnly?: boolean | undefined;
|
|
11
|
-
} & ({
|
|
12
|
-
class?: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
|
|
13
|
-
[x: string]: any;
|
|
14
|
-
} | null | undefined)[] | {
|
|
15
|
-
[x: string]: any;
|
|
16
|
-
} | null | undefined)[] | {
|
|
17
|
-
[x: string]: any;
|
|
18
|
-
} | null | undefined)[] | {
|
|
19
|
-
[x: string]: any;
|
|
20
|
-
} | null | undefined)[] | {
|
|
21
|
-
[x: string]: any;
|
|
22
|
-
} | null | undefined)[] | {
|
|
23
|
-
[x: string]: any;
|
|
24
|
-
} | null | undefined)[] | {
|
|
25
|
-
[x: string]: any;
|
|
26
|
-
} | null | undefined)[] | {
|
|
27
|
-
[x: string]: any;
|
|
28
|
-
} | null | undefined)[] | {
|
|
29
|
-
[x: string]: any;
|
|
30
|
-
} | null | undefined)[] | {
|
|
31
|
-
[x: string]: any;
|
|
32
|
-
} | null | undefined)[] | {
|
|
33
|
-
[x: string]: any;
|
|
34
|
-
} | null | undefined)[] | {
|
|
35
|
-
[x: string]: any;
|
|
36
|
-
} | null | undefined;
|
|
37
|
-
className?: undefined;
|
|
38
|
-
} | {
|
|
39
|
-
class?: undefined;
|
|
40
|
-
className?: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
|
|
41
|
-
[x: string]: any;
|
|
42
|
-
} | null | undefined)[] | {
|
|
43
|
-
[x: string]: any;
|
|
44
|
-
} | null | undefined)[] | {
|
|
45
|
-
[x: string]: any;
|
|
46
|
-
} | null | undefined)[] | {
|
|
47
|
-
[x: string]: any;
|
|
48
|
-
} | null | undefined)[] | {
|
|
49
|
-
[x: string]: any;
|
|
50
|
-
} | null | undefined)[] | {
|
|
51
|
-
[x: string]: any;
|
|
52
|
-
} | null | undefined)[] | {
|
|
53
|
-
[x: string]: any;
|
|
54
|
-
} | null | undefined)[] | {
|
|
55
|
-
[x: string]: any;
|
|
56
|
-
} | null | undefined)[] | {
|
|
57
|
-
[x: string]: any;
|
|
58
|
-
} | null | undefined)[] | {
|
|
59
|
-
[x: string]: any;
|
|
60
|
-
} | null | undefined)[] | {
|
|
61
|
-
[x: string]: any;
|
|
62
|
-
} | null | undefined)[] | {
|
|
63
|
-
[x: string]: any;
|
|
64
|
-
} | null | undefined;
|
|
65
|
-
})) | undefined) => string;
|
|
66
|
-
type ButtonOrLinkProps = (React.ComponentPropsWithoutRef<'button'> & {
|
|
67
|
-
href?: never;
|
|
68
|
-
}) | (React.ComponentPropsWithoutRef<'a'> & {
|
|
69
|
-
href: string;
|
|
70
|
-
});
|
|
71
|
-
type ButtonProps = VariantProps<typeof buttonVariants> & {
|
|
72
|
-
className?: string;
|
|
73
|
-
children: React.ReactNode;
|
|
74
|
-
/**
|
|
75
|
-
* Display the button in a loading state
|
|
76
|
-
* @default false
|
|
77
|
-
*/
|
|
78
|
-
loading?: boolean;
|
|
79
|
-
style?: React.CSSProperties;
|
|
80
|
-
} & ButtonOrLinkProps;
|
|
81
|
-
declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
82
|
-
|
|
83
|
-
export { Button, type ButtonProps };
|
package/dist/button/Button.mjs
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
-
import { cva } from 'cva';
|
|
4
|
-
import { LoadingSpinner } from '@obosbbl/grunnmuren-icons-react';
|
|
5
|
-
|
|
6
|
-
const canUseDOM = () => {
|
|
7
|
-
return typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8
|
-
};
|
|
9
|
-
const useClientLayoutEffect = canUseDOM() ? useLayoutEffect : () => {
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const buttonVariants = cva({
|
|
13
|
-
base: [
|
|
14
|
-
"inline-flex min-h-[44px] cursor-pointer items-center justify-center whitespace-nowrap rounded-lg font-medium transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2"
|
|
15
|
-
],
|
|
16
|
-
variants: {
|
|
17
|
-
/**
|
|
18
|
-
* The variant of the button
|
|
19
|
-
* @default primary
|
|
20
|
-
*/
|
|
21
|
-
variant: {
|
|
22
|
-
primary: "no-underline",
|
|
23
|
-
// by using an inset box-shadow to emulate a border instead of an actual border, the button size will be equal regardless of the variant
|
|
24
|
-
secondary: "no-underline shadow-[inset_0_0_0_2px]",
|
|
25
|
-
tertiary: "underline hover:no-underline"
|
|
26
|
-
},
|
|
27
|
-
/**
|
|
28
|
-
* Adjusts the color of the button for usage on different backgrounds.
|
|
29
|
-
* @default green
|
|
30
|
-
*/
|
|
31
|
-
color: {
|
|
32
|
-
green: "focus-visible:ring-black",
|
|
33
|
-
mint: "focus-visible:ring-mint focus-visible:ring-offset-green-dark",
|
|
34
|
-
white: "focus-visible:ring-white focus-visible:ring-offset-blue"
|
|
35
|
-
},
|
|
36
|
-
/**
|
|
37
|
-
* When the button is without text, but with a single icon.
|
|
38
|
-
* @default false
|
|
39
|
-
*/
|
|
40
|
-
isIconOnly: {
|
|
41
|
-
true: "p-2 [&>svg]:h-7 [&>svg]:w-7",
|
|
42
|
-
false: (
|
|
43
|
-
// The of-type classes takes care to add spacing when the button is used with icons
|
|
44
|
-
"px-4 py-2 [&>svg]:first-of-type:mr-2.5 [&>svg]:last-of-type:ml-2.5"
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
compoundVariants: [
|
|
49
|
-
{
|
|
50
|
-
color: "green",
|
|
51
|
-
variant: "primary",
|
|
52
|
-
// Darken bg by 20% on hover. The color is manually crafted
|
|
53
|
-
className: "bg-green text-white hover:bg-green-dark active:bg-[#007352]"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
color: "green",
|
|
57
|
-
variant: "secondary",
|
|
58
|
-
className: "bg-white text-black shadow-green hover:bg-green hover:text-white active:bg-green"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
color: "mint",
|
|
62
|
-
variant: "primary",
|
|
63
|
-
// Darken bg by 20% on hover. The color is manually crafted
|
|
64
|
-
className: "active:[#9ddac6] bg-mint text-black hover:bg-[#8dd4bd]"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
color: "mint",
|
|
68
|
-
variant: "secondary",
|
|
69
|
-
className: "text-mint shadow-mint hover:bg-mint hover:text-black"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
color: "mint",
|
|
73
|
-
variant: "tertiary",
|
|
74
|
-
className: "text-mint"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
color: "white",
|
|
78
|
-
variant: "primary",
|
|
79
|
-
className: "bg-white text-black hover:bg-sky active:bg-sky-light"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
color: "white",
|
|
83
|
-
variant: "secondary",
|
|
84
|
-
className: "text-white shadow-white hover:bg-white hover:text-black"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
color: "white",
|
|
88
|
-
variant: "tertiary",
|
|
89
|
-
className: "text-white"
|
|
90
|
-
}
|
|
91
|
-
],
|
|
92
|
-
defaultVariants: {
|
|
93
|
-
variant: "primary",
|
|
94
|
-
color: "green",
|
|
95
|
-
isIconOnly: false
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
function Button(props) {
|
|
99
|
-
const {
|
|
100
|
-
children,
|
|
101
|
-
className,
|
|
102
|
-
color,
|
|
103
|
-
isIconOnly,
|
|
104
|
-
loading,
|
|
105
|
-
variant,
|
|
106
|
-
style,
|
|
107
|
-
...restProps
|
|
108
|
-
} = props;
|
|
109
|
-
const buttonRef = useRef(null);
|
|
110
|
-
const [widthOverride, setWidthOverride] = useState();
|
|
111
|
-
useClientLayoutEffect(() => {
|
|
112
|
-
if (loading) {
|
|
113
|
-
const requestID = window.requestAnimationFrame(() => {
|
|
114
|
-
setWidthOverride(buttonRef?.current?.getBoundingClientRect()?.width);
|
|
115
|
-
});
|
|
116
|
-
return () => {
|
|
117
|
-
setWidthOverride(void 0);
|
|
118
|
-
cancelAnimationFrame(requestID);
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}, [loading, children]);
|
|
122
|
-
let Component = "a";
|
|
123
|
-
if (props.href == null) {
|
|
124
|
-
Component = "button";
|
|
125
|
-
restProps.type ?? (restProps.type = "button");
|
|
126
|
-
}
|
|
127
|
-
return (
|
|
128
|
-
// @ts-expect-error TS doesn't agree here taht restProps is safe to spread, because restProps for anchors aren't type compatible with restProps for buttons, but that should be okay here
|
|
129
|
-
/* @__PURE__ */ jsx(
|
|
130
|
-
Component,
|
|
131
|
-
{
|
|
132
|
-
"aria-busy": loading ? true : void 0,
|
|
133
|
-
className: buttonVariants({ className, color, isIconOnly, variant }),
|
|
134
|
-
ref: buttonRef,
|
|
135
|
-
style: {
|
|
136
|
-
...style,
|
|
137
|
-
width: widthOverride
|
|
138
|
-
},
|
|
139
|
-
...restProps,
|
|
140
|
-
children: widthOverride ? (
|
|
141
|
-
// remove margin for icon alignment
|
|
142
|
-
/* @__PURE__ */ jsx(LoadingSpinner, { className: "!m-0 mx-auto animate-spin" })
|
|
143
|
-
) : children
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export { Button };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1 } from 'react-aria-components';
|
|
3
|
-
|
|
4
|
-
type CheckboxProps = {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
/** Additional CSS className for the element. */
|
|
7
|
-
className?: string;
|
|
8
|
-
/** Help text for the form control. */
|
|
9
|
-
description?: React.ReactNode;
|
|
10
|
-
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
11
|
-
errorMessage?: React.ReactNode;
|
|
12
|
-
/** Additional style properties for the element. */
|
|
13
|
-
style?: React.CSSProperties;
|
|
14
|
-
} & Omit<CheckboxProps$1, 'isDisabled' | 'style' | 'children' | 'isIndeterminate' | 'isReadOnly'>;
|
|
15
|
-
declare function Checkbox(props: CheckboxProps): react_jsx_runtime.JSX.Element;
|
|
16
|
-
|
|
17
|
-
type CheckboxGroupProps = {
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
/** Additional CSS className for the element. */
|
|
20
|
-
className?: string;
|
|
21
|
-
/** Help text for the form control. */
|
|
22
|
-
description?: React.ReactNode;
|
|
23
|
-
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
24
|
-
errorMessage?: React.ReactNode;
|
|
25
|
-
/** Label for the form control. */
|
|
26
|
-
label?: React.ReactNode;
|
|
27
|
-
/** Additional style properties for the element. */
|
|
28
|
-
style?: React.CSSProperties;
|
|
29
|
-
} & Omit<CheckboxGroupProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style' | 'orientation'>;
|
|
30
|
-
declare function CheckboxGroup(props: CheckboxGroupProps): react_jsx_runtime.JSX.Element;
|
|
31
|
-
|
|
32
|
-
export { Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps };
|
package/dist/checkbox/index.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1 } from 'react-aria-components';
|
|
3
|
-
|
|
4
|
-
type CheckboxProps = {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
/** Additional CSS className for the element. */
|
|
7
|
-
className?: string;
|
|
8
|
-
/** Help text for the form control. */
|
|
9
|
-
description?: React.ReactNode;
|
|
10
|
-
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
11
|
-
errorMessage?: React.ReactNode;
|
|
12
|
-
/** Additional style properties for the element. */
|
|
13
|
-
style?: React.CSSProperties;
|
|
14
|
-
} & Omit<CheckboxProps$1, 'isDisabled' | 'style' | 'children' | 'isIndeterminate' | 'isReadOnly'>;
|
|
15
|
-
declare function Checkbox(props: CheckboxProps): react_jsx_runtime.JSX.Element;
|
|
16
|
-
|
|
17
|
-
type CheckboxGroupProps = {
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
/** Additional CSS className for the element. */
|
|
20
|
-
className?: string;
|
|
21
|
-
/** Help text for the form control. */
|
|
22
|
-
description?: React.ReactNode;
|
|
23
|
-
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
24
|
-
errorMessage?: React.ReactNode;
|
|
25
|
-
/** Label for the form control. */
|
|
26
|
-
label?: React.ReactNode;
|
|
27
|
-
/** Additional style properties for the element. */
|
|
28
|
-
style?: React.CSSProperties;
|
|
29
|
-
} & Omit<CheckboxGroupProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style' | 'orientation'>;
|
|
30
|
-
declare function CheckboxGroup(props: CheckboxGroupProps): react_jsx_runtime.JSX.Element;
|
|
31
|
-
|
|
32
|
-
export { Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps };
|
package/dist/checkbox/index.mjs
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useId } from 'react';
|
|
3
|
-
import { cx } from 'cva';
|
|
4
|
-
import { CheckboxContext, Checkbox as Checkbox$1, CheckboxGroup as CheckboxGroup$1 } from 'react-aria-components';
|
|
5
|
-
import { Check } from '@obosbbl/grunnmuren-icons-react';
|
|
6
|
-
import { Description, ErrorMessage, Label } from '../label/index.mjs';
|
|
7
|
-
|
|
8
|
-
const defaultClasses = cx([
|
|
9
|
-
"group relative left-0 inline-flex max-w-fit cursor-pointer items-start gap-4 py-2 leading-7"
|
|
10
|
-
]);
|
|
11
|
-
function CheckmarkBox() {
|
|
12
|
-
return /* @__PURE__ */ jsx(
|
|
13
|
-
"div",
|
|
14
|
-
{
|
|
15
|
-
className: cx([
|
|
16
|
-
"relative left-0 grid flex-none place-content-center rounded-sm border-2 border-black text-white",
|
|
17
|
-
// 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.
|
|
18
|
-
// For the ::before psuedo element the line height of the label is always 1em.
|
|
19
|
-
// When we know the height of the label we use the height of the radio to push it down to align with the label's first line
|
|
20
|
-
// TODO: 1.75 here is the unit less lineheight, altough we use 1.75rem as the line height, so there is a mismatch here. Revisit this when we've worked on typography in v2. Should this be a CSS custom property instead?
|
|
21
|
-
"mt-[calc((1em_*_1.75_-_24px)_/_2)] h-[24px] w-[24px]",
|
|
22
|
-
// selected
|
|
23
|
-
"group-data-[selected]:!border-green group-data-[selected]:!bg-green",
|
|
24
|
-
// focus
|
|
25
|
-
"group-data-[focus-visible]:ring-2 group-data-[focus-visible]:ring-black group-data-[focus-visible]:ring-offset-[9px]",
|
|
26
|
-
// hovered
|
|
27
|
-
"group-data-[hovered]:border-green group-data-[hovered]:group-data-[invalid]:border-red group-data-[hovered]:bg-green-lightest group-data-[hovered]:group-data-[invalid]:bg-red-light",
|
|
28
|
-
// invalid - The border is 1 px thicker when invalid. We don't actually want to change the border width, as that causes the element's size to change
|
|
29
|
-
// so we use an inner shadow of 1 px instead to pad the actual border
|
|
30
|
-
"group-data-[invalid]:border-red group-data-[invalid]:group-data-[selected]:shadow-none group-data-[invalid]:shadow-[inset_0_0_0_1px] group-data-[invalid]:shadow-red"
|
|
31
|
-
]),
|
|
32
|
-
children: /* @__PURE__ */ jsx(Check, { className: "h-full w-full opacity-0 group-data-[selected]:opacity-100" })
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
function Checkbox(props) {
|
|
37
|
-
const {
|
|
38
|
-
children,
|
|
39
|
-
className,
|
|
40
|
-
description,
|
|
41
|
-
errorMessage,
|
|
42
|
-
isInvalid: _isInvalid,
|
|
43
|
-
...restProps
|
|
44
|
-
} = props;
|
|
45
|
-
const id = useId();
|
|
46
|
-
const descriptionId = "desc" + id;
|
|
47
|
-
const errorMessageId = "error" + id;
|
|
48
|
-
const isInvalid = _isInvalid || errorMessage != null;
|
|
49
|
-
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
50
|
-
CheckboxContext.Provider,
|
|
51
|
-
{
|
|
52
|
-
value: {
|
|
53
|
-
"aria-describedby": description ? descriptionId : void 0,
|
|
54
|
-
"aria-errormessage": errorMessage ? errorMessageId : void 0
|
|
55
|
-
},
|
|
56
|
-
children: [
|
|
57
|
-
/* @__PURE__ */ jsxs(
|
|
58
|
-
Checkbox$1,
|
|
59
|
-
{
|
|
60
|
-
...restProps,
|
|
61
|
-
className: cx(className, defaultClasses),
|
|
62
|
-
isInvalid,
|
|
63
|
-
children: [
|
|
64
|
-
/* @__PURE__ */ jsx("div", { className: "absolute -left-2.5 top-0 z-10 h-11 w-11" }),
|
|
65
|
-
/* @__PURE__ */ jsx(CheckmarkBox, {}),
|
|
66
|
-
children
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
),
|
|
70
|
-
description && /* @__PURE__ */ jsx(Description, { className: "block", id: descriptionId, children: description }),
|
|
71
|
-
errorMessage && /* @__PURE__ */ jsx(ErrorMessage, { className: "mt-2 block", id: errorMessageId, children: errorMessage })
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
) });
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function CheckboxGroup(props) {
|
|
78
|
-
const {
|
|
79
|
-
children,
|
|
80
|
-
className,
|
|
81
|
-
description,
|
|
82
|
-
errorMessage,
|
|
83
|
-
label,
|
|
84
|
-
isRequired,
|
|
85
|
-
isInvalid: _isInvalid,
|
|
86
|
-
...restProps
|
|
87
|
-
} = props;
|
|
88
|
-
const isInvalid = _isInvalid || errorMessage != null;
|
|
89
|
-
return /* @__PURE__ */ jsxs(
|
|
90
|
-
CheckboxGroup$1,
|
|
91
|
-
{
|
|
92
|
-
...restProps,
|
|
93
|
-
className: cx(className, "flex flex-col gap-2"),
|
|
94
|
-
isInvalid,
|
|
95
|
-
isRequired,
|
|
96
|
-
children: [
|
|
97
|
-
label && /* @__PURE__ */ jsx(Label, { children: label }),
|
|
98
|
-
description && /* @__PURE__ */ jsx(Description, { children: description }),
|
|
99
|
-
children,
|
|
100
|
-
errorMessage && /* @__PURE__ */ jsx(ErrorMessage, { children: errorMessage })
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export { Checkbox, CheckboxGroup };
|
package/dist/label/index.d.mts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { TextProps, LabelProps } from 'react-aria-components';
|
|
3
|
-
export { LabelProps } from 'react-aria-components';
|
|
4
|
-
|
|
5
|
-
type DescriptionProps = TextProps;
|
|
6
|
-
declare function Description(props: DescriptionProps): react_jsx_runtime.JSX.Element;
|
|
7
|
-
|
|
8
|
-
type ErrorMessageProps = TextProps;
|
|
9
|
-
declare function ErrorMessage(props: ErrorMessageProps): react_jsx_runtime.JSX.Element;
|
|
10
|
-
|
|
11
|
-
declare function Label(props: LabelProps): react_jsx_runtime.JSX.Element;
|
|
12
|
-
|
|
13
|
-
export { Description, type DescriptionProps, ErrorMessage, type ErrorMessageProps, Label };
|
package/dist/label/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { TextProps, LabelProps } from 'react-aria-components';
|
|
3
|
-
export { LabelProps } from 'react-aria-components';
|
|
4
|
-
|
|
5
|
-
type DescriptionProps = TextProps;
|
|
6
|
-
declare function Description(props: DescriptionProps): react_jsx_runtime.JSX.Element;
|
|
7
|
-
|
|
8
|
-
type ErrorMessageProps = TextProps;
|
|
9
|
-
declare function ErrorMessage(props: ErrorMessageProps): react_jsx_runtime.JSX.Element;
|
|
10
|
-
|
|
11
|
-
declare function Label(props: LabelProps): react_jsx_runtime.JSX.Element;
|
|
12
|
-
|
|
13
|
-
export { Description, type DescriptionProps, ErrorMessage, type ErrorMessageProps, Label };
|
package/dist/label/index.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { cx } from 'cva';
|
|
3
|
-
import { Text, Label as Label$1 } from 'react-aria-components';
|
|
4
|
-
|
|
5
|
-
function ErrorMessage(props) {
|
|
6
|
-
const { children, className, ...restProps } = props;
|
|
7
|
-
return /* @__PURE__ */ jsx(
|
|
8
|
-
Text,
|
|
9
|
-
{
|
|
10
|
-
...restProps,
|
|
11
|
-
className: cx(
|
|
12
|
-
className,
|
|
13
|
-
"w-fit rounded-sm bg-red-light px-2 py-1 text-sm leading-6 text-red"
|
|
14
|
-
),
|
|
15
|
-
slot: "errorMessage",
|
|
16
|
-
children
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function Description(props) {
|
|
22
|
-
const { className, ...restProps } = props;
|
|
23
|
-
return /* @__PURE__ */ jsx(
|
|
24
|
-
Text,
|
|
25
|
-
{
|
|
26
|
-
...restProps,
|
|
27
|
-
className: cx(className, "text-sm font-light leading-6"),
|
|
28
|
-
slot: "description"
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function Label(props) {
|
|
34
|
-
const { children, className, ...restProps } = props;
|
|
35
|
-
return /* @__PURE__ */ jsx(
|
|
36
|
-
Label$1,
|
|
37
|
-
{
|
|
38
|
-
className: cx(className, "font-semibold leading-7"),
|
|
39
|
-
...restProps,
|
|
40
|
-
children
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export { Description, ErrorMessage, Label };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1 } from 'react-aria-components';
|
|
3
|
-
|
|
4
|
-
type RadioGroupProps = {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
/** Additional CSS className for the element. */
|
|
7
|
-
className?: string;
|
|
8
|
-
/** Help text for the form control. */
|
|
9
|
-
description?: React.ReactNode;
|
|
10
|
-
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
11
|
-
errorMessage?: React.ReactNode;
|
|
12
|
-
/** Label for the form control. */
|
|
13
|
-
label?: React.ReactNode;
|
|
14
|
-
/** Additional style properties for the element. */
|
|
15
|
-
style?: React.CSSProperties;
|
|
16
|
-
} & Omit<RadioGroupProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style' | 'orientation'>;
|
|
17
|
-
declare function RadioGroup(props: RadioGroupProps): react_jsx_runtime.JSX.Element;
|
|
18
|
-
|
|
19
|
-
type RadioProps = {
|
|
20
|
-
children: React.ReactNode;
|
|
21
|
-
/** Additional CSS className for the element. */
|
|
22
|
-
className?: string;
|
|
23
|
-
/** Help text for the form control. */
|
|
24
|
-
description?: React.ReactNode;
|
|
25
|
-
/** Additional style properties for the element. */
|
|
26
|
-
style?: React.CSSProperties;
|
|
27
|
-
} & Omit<RadioProps$1, 'isDisabled' | 'children' | 'style'>;
|
|
28
|
-
declare function Radio(props: RadioProps): react_jsx_runtime.JSX.Element;
|
|
29
|
-
|
|
30
|
-
export { Radio, RadioGroup, type RadioGroupProps, type RadioProps };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1 } from 'react-aria-components';
|
|
3
|
-
|
|
4
|
-
type RadioGroupProps = {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
/** Additional CSS className for the element. */
|
|
7
|
-
className?: string;
|
|
8
|
-
/** Help text for the form control. */
|
|
9
|
-
description?: React.ReactNode;
|
|
10
|
-
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
11
|
-
errorMessage?: React.ReactNode;
|
|
12
|
-
/** Label for the form control. */
|
|
13
|
-
label?: React.ReactNode;
|
|
14
|
-
/** Additional style properties for the element. */
|
|
15
|
-
style?: React.CSSProperties;
|
|
16
|
-
} & Omit<RadioGroupProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style' | 'orientation'>;
|
|
17
|
-
declare function RadioGroup(props: RadioGroupProps): react_jsx_runtime.JSX.Element;
|
|
18
|
-
|
|
19
|
-
type RadioProps = {
|
|
20
|
-
children: React.ReactNode;
|
|
21
|
-
/** Additional CSS className for the element. */
|
|
22
|
-
className?: string;
|
|
23
|
-
/** Help text for the form control. */
|
|
24
|
-
description?: React.ReactNode;
|
|
25
|
-
/** Additional style properties for the element. */
|
|
26
|
-
style?: React.CSSProperties;
|
|
27
|
-
} & Omit<RadioProps$1, 'isDisabled' | 'children' | 'style'>;
|
|
28
|
-
declare function Radio(props: RadioProps): react_jsx_runtime.JSX.Element;
|
|
29
|
-
|
|
30
|
-
export { Radio, RadioGroup, type RadioGroupProps, type RadioProps };
|