@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
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { cx } from 'cva';
|
|
3
|
-
import { RadioGroup as RadioGroup$1, Radio as Radio$1 } from 'react-aria-components';
|
|
4
|
-
import { Label, Description, ErrorMessage } from '../label/index.mjs';
|
|
5
|
-
|
|
6
|
-
function RadioGroup(props) {
|
|
7
|
-
const {
|
|
8
|
-
children,
|
|
9
|
-
className,
|
|
10
|
-
description,
|
|
11
|
-
errorMessage,
|
|
12
|
-
label,
|
|
13
|
-
isRequired,
|
|
14
|
-
isInvalid: _isInvalid,
|
|
15
|
-
...restProps
|
|
16
|
-
} = props;
|
|
17
|
-
const isInvalid = _isInvalid || errorMessage != null;
|
|
18
|
-
return /* @__PURE__ */ jsxs(
|
|
19
|
-
RadioGroup$1,
|
|
20
|
-
{
|
|
21
|
-
...restProps,
|
|
22
|
-
className: cx(className, "flex flex-col gap-2"),
|
|
23
|
-
isInvalid,
|
|
24
|
-
isRequired,
|
|
25
|
-
children: [
|
|
26
|
-
label && /* @__PURE__ */ jsx(Label, { children: label }),
|
|
27
|
-
description && /* @__PURE__ */ jsx(Description, { children: description }),
|
|
28
|
-
children,
|
|
29
|
-
errorMessage && /* @__PURE__ */ jsx(ErrorMessage, { children: errorMessage })
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const defaultClasses = cx([
|
|
36
|
-
"relative inline-flex max-w-fit cursor-pointer items-start gap-4 py-2 leading-7",
|
|
37
|
-
// the radio button itself
|
|
38
|
-
"before:flex-none before:rounded-full before:border-2 before:border-black",
|
|
39
|
-
// 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.
|
|
40
|
-
// For the ::before psuedo element the line height of the label is always 1em.
|
|
41
|
-
// 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
|
|
42
|
-
// 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?
|
|
43
|
-
"before:mt-[calc((1em_*_1.75_-_24px)_/_2)] before:h-[24px] before:w-[24px]",
|
|
44
|
-
// selected
|
|
45
|
-
"data-[selected]:before:border-black data-[selected]:before:bg-green data-[selected]:before:shadow-[inset_0_0_0_4px_rgb(255,255,255)]",
|
|
46
|
-
// hover
|
|
47
|
-
"data-[hovered]:before:border-green data-[hovered]:before:bg-green-lightest data-[hovered]:data-[invalid]:before:bg-red-light",
|
|
48
|
-
// focus
|
|
49
|
-
"data-[focus-visible]:before:ring data-[focus-visible]:before:ring-black data-[focus-visible]:before:ring-offset-[9px]",
|
|
50
|
-
// 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
|
|
51
|
-
// so we use an inner outline to artifically pad the border
|
|
52
|
-
"data-[invalid]:before:outline-solid data-[invalid]:before:border-red data-[invalid]:data-[selected]:before:!bg-red data-[invalid]:before:outline data-[invalid]:before:outline-[3px] data-[invalid]:before:outline-offset-[-3px] data-[invalid]:before:outline-red"
|
|
53
|
-
]);
|
|
54
|
-
function Radio(props) {
|
|
55
|
-
const { children, className, description, ...restProps } = props;
|
|
56
|
-
return /* @__PURE__ */ jsxs(Radio$1, { ...restProps, className: cx(className, defaultClasses), children: [
|
|
57
|
-
/* @__PURE__ */ jsx("div", { className: "absolute -left-2.5 top-0 z-10 h-11 w-11 " }),
|
|
58
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
59
|
-
children,
|
|
60
|
-
description && /* @__PURE__ */ jsx(Description, { className: "mt-2 block", children: description })
|
|
61
|
-
] })
|
|
62
|
-
] });
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export { Radio, RadioGroup };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { TextFieldProps as TextFieldProps$1 } from 'react-aria-components';
|
|
3
|
-
|
|
4
|
-
type TextFieldProps = {
|
|
5
|
-
/** Additional CSS className for the element. */
|
|
6
|
-
className?: string;
|
|
7
|
-
/** Help text for the form control. */
|
|
8
|
-
description?: React.ReactNode;
|
|
9
|
-
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
10
|
-
errorMessage?: React.ReactNode;
|
|
11
|
-
/** Element to be rendered in the left side of the input. */
|
|
12
|
-
leftAddon?: React.ReactNode;
|
|
13
|
-
/** Label for the form control. */
|
|
14
|
-
label?: React.ReactNode;
|
|
15
|
-
/** Element to be rendered in the right side of the input. */
|
|
16
|
-
rightAddon?: React.ReactNode;
|
|
17
|
-
/** Placeholder text. Only visible when the input value is empty. */
|
|
18
|
-
placeholder?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Text alignment of the input
|
|
21
|
-
* @default left
|
|
22
|
-
*/
|
|
23
|
-
textAlign?: 'left' | 'right';
|
|
24
|
-
/** Additional style properties for the element. */
|
|
25
|
-
style?: React.CSSProperties;
|
|
26
|
-
/** Add a divider between the left/right addons and the input */
|
|
27
|
-
withAddonDivider?: boolean;
|
|
28
|
-
} & Omit<TextFieldProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style'>;
|
|
29
|
-
declare function TextField(props: TextFieldProps): react_jsx_runtime.JSX.Element;
|
|
30
|
-
|
|
31
|
-
export { TextField, type TextFieldProps };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { TextFieldProps as TextFieldProps$1 } from 'react-aria-components';
|
|
3
|
-
|
|
4
|
-
type TextFieldProps = {
|
|
5
|
-
/** Additional CSS className for the element. */
|
|
6
|
-
className?: string;
|
|
7
|
-
/** Help text for the form control. */
|
|
8
|
-
description?: React.ReactNode;
|
|
9
|
-
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
10
|
-
errorMessage?: React.ReactNode;
|
|
11
|
-
/** Element to be rendered in the left side of the input. */
|
|
12
|
-
leftAddon?: React.ReactNode;
|
|
13
|
-
/** Label for the form control. */
|
|
14
|
-
label?: React.ReactNode;
|
|
15
|
-
/** Element to be rendered in the right side of the input. */
|
|
16
|
-
rightAddon?: React.ReactNode;
|
|
17
|
-
/** Placeholder text. Only visible when the input value is empty. */
|
|
18
|
-
placeholder?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Text alignment of the input
|
|
21
|
-
* @default left
|
|
22
|
-
*/
|
|
23
|
-
textAlign?: 'left' | 'right';
|
|
24
|
-
/** Additional style properties for the element. */
|
|
25
|
-
style?: React.CSSProperties;
|
|
26
|
-
/** Add a divider between the left/right addons and the input */
|
|
27
|
-
withAddonDivider?: boolean;
|
|
28
|
-
} & Omit<TextFieldProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style'>;
|
|
29
|
-
declare function TextField(props: TextFieldProps): react_jsx_runtime.JSX.Element;
|
|
30
|
-
|
|
31
|
-
export { TextField, type TextFieldProps };
|
package/dist/textfield/index.mjs
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { cx, cva } from 'cva';
|
|
3
|
-
import { TextField as TextField$1, Input } from 'react-aria-components';
|
|
4
|
-
import { Label, Description, ErrorMessage } from '../label/index.mjs';
|
|
5
|
-
|
|
6
|
-
const classes = {
|
|
7
|
-
base: cx("group flex flex-col gap-2"),
|
|
8
|
-
inputWrapper: cva({
|
|
9
|
-
base: [
|
|
10
|
-
"relative inline-flex flex-row items-center rounded-md border border-black py-2.5 text-sm font-normal leading-6",
|
|
11
|
-
// prevent icons in addons from being flexed and affected by the text size of the input
|
|
12
|
-
"[&>svg]:flex-none [&>svg]:text-base",
|
|
13
|
-
// focus
|
|
14
|
-
"focus-within:ring-2 focus-within:ring-blue-dark",
|
|
15
|
-
// invalid
|
|
16
|
-
"group-data-[invalid]:border-red group-data-[invalid]:outline group-data-[invalid]:outline-1 group-data-[invalid]:outline-red"
|
|
17
|
-
],
|
|
18
|
-
variants: {
|
|
19
|
-
leftAddon: {
|
|
20
|
-
true: "pl-3"
|
|
21
|
-
},
|
|
22
|
-
rightAddon: {
|
|
23
|
-
true: "pr-3"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}),
|
|
27
|
-
input: cva({
|
|
28
|
-
base: "relative w-full px-3 font-normal leading-6 placeholder-[#727070] !outline-none",
|
|
29
|
-
variants: {
|
|
30
|
-
textAlign: {
|
|
31
|
-
right: "text-right",
|
|
32
|
-
left: ""
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}),
|
|
36
|
-
divider: cx("block h-6 w-px flex-none bg-black")
|
|
37
|
-
};
|
|
38
|
-
function TextField(props) {
|
|
39
|
-
const {
|
|
40
|
-
className,
|
|
41
|
-
description,
|
|
42
|
-
errorMessage,
|
|
43
|
-
label,
|
|
44
|
-
leftAddon,
|
|
45
|
-
isRequired,
|
|
46
|
-
isInvalid: _isInvalid,
|
|
47
|
-
textAlign,
|
|
48
|
-
rightAddon,
|
|
49
|
-
withAddonDivider,
|
|
50
|
-
...restProps
|
|
51
|
-
} = props;
|
|
52
|
-
const isInvalid = _isInvalid || errorMessage != null;
|
|
53
|
-
return /* @__PURE__ */ jsxs(
|
|
54
|
-
TextField$1,
|
|
55
|
-
{
|
|
56
|
-
...restProps,
|
|
57
|
-
className: cx(className, classes.base),
|
|
58
|
-
isInvalid,
|
|
59
|
-
isRequired,
|
|
60
|
-
children: [
|
|
61
|
-
label && /* @__PURE__ */ jsx(Label, { children: label }),
|
|
62
|
-
description && /* @__PURE__ */ jsx(Description, { children: description }),
|
|
63
|
-
/* @__PURE__ */ jsxs(
|
|
64
|
-
"div",
|
|
65
|
-
{
|
|
66
|
-
className: classes.inputWrapper({
|
|
67
|
-
leftAddon: !!leftAddon,
|
|
68
|
-
rightAddon: !!rightAddon
|
|
69
|
-
}),
|
|
70
|
-
children: [
|
|
71
|
-
leftAddon,
|
|
72
|
-
withAddonDivider && leftAddon && /* @__PURE__ */ jsx(Divider, { className: "ml-3" }),
|
|
73
|
-
/* @__PURE__ */ jsx(Input, { className: classes.input({ textAlign }) }),
|
|
74
|
-
withAddonDivider && rightAddon && /* @__PURE__ */ jsx(Divider, { className: "mr-3" }),
|
|
75
|
-
rightAddon
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
),
|
|
79
|
-
errorMessage && /* @__PURE__ */ jsx(ErrorMessage, { children: errorMessage })
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
function Divider({ className }) {
|
|
85
|
-
return /* @__PURE__ */ jsx("span", { className: cx(className, classes.divider) });
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export { TextField };
|