@xjur-ui/react 1.0.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/.turbo/turbo-build.log +57 -0
- package/dist/components/resources/icons.d.ts +4 -0
- package/dist/components/resources/icons.js +133 -0
- package/dist/components/resources/logo/horizontal.d.ts +12 -0
- package/dist/components/resources/logo/horizontal.js +107 -0
- package/dist/components/resources/logo/icon.d.ts +12 -0
- package/dist/components/resources/logo/icon.js +79 -0
- package/dist/components/resources/logo/index.d.ts +4 -0
- package/dist/components/resources/logo/index.js +291 -0
- package/dist/components/resources/logo/vertical.d.ts +12 -0
- package/dist/components/resources/logo/vertical.js +107 -0
- package/dist/components/ui/accordion.d.ts +5 -0
- package/dist/components/ui/accordion.js +8 -0
- package/dist/components/ui/button.d.ts +16 -0
- package/dist/components/ui/button.js +95 -0
- package/dist/components/ui/icon.d.ts +12 -0
- package/dist/components/ui/icon.js +158 -0
- package/dist/components/ui/index.d.ts +17 -0
- package/dist/components/ui/index.js +788 -0
- package/dist/components/ui/input/content.d.ts +9 -0
- package/dist/components/ui/input/content.js +183 -0
- package/dist/components/ui/input/index.d.ts +12 -0
- package/dist/components/ui/input/index.js +335 -0
- package/dist/components/ui/input/label.d.ts +12 -0
- package/dist/components/ui/input/label.js +165 -0
- package/dist/components/ui/input/message.d.ts +10 -0
- package/dist/components/ui/input/message.js +128 -0
- package/dist/components/ui/input/root.d.ts +18 -0
- package/dist/components/ui/input/root.js +163 -0
- package/dist/components/ui/input/slot.d.ts +10 -0
- package/dist/components/ui/input/slot.js +20 -0
- package/dist/components/ui/input/text.d.ts +10 -0
- package/dist/components/ui/input/text.js +195 -0
- package/dist/components/ui/logo.d.ts +10 -0
- package/dist/components/ui/logo.js +324 -0
- package/dist/components/ui/otp-input.d.ts +13 -0
- package/dist/components/ui/otp-input.js +47 -0
- package/dist/components/ui/typography.d.ts +17 -0
- package/dist/components/ui/typography.js +78 -0
- package/dist/index.css +770 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +788 -0
- package/eslint.config.js +3 -0
- package/package.json +41 -0
- package/postcss.config.js +5 -0
- package/prettier.config.js +7 -0
- package/src/components/resources/icons.ts +131 -0
- package/src/components/resources/logo/horizontal.tsx +70 -0
- package/src/components/resources/logo/icon.tsx +54 -0
- package/src/components/resources/logo/index.ts +3 -0
- package/src/components/resources/logo/vertical.tsx +70 -0
- package/src/components/ui/accordion.tsx +3 -0
- package/src/components/ui/button.tsx +105 -0
- package/src/components/ui/icon.tsx +29 -0
- package/src/components/ui/index.ts +13 -0
- package/src/components/ui/input/content.tsx +59 -0
- package/src/components/ui/input/index.ts +6 -0
- package/src/components/ui/input/label.tsx +41 -0
- package/src/components/ui/input/message.tsx +37 -0
- package/src/components/ui/input/root.tsx +57 -0
- package/src/components/ui/input/slot.tsx +21 -0
- package/src/components/ui/input/text.tsx +69 -0
- package/src/components/ui/logo.tsx +39 -0
- package/src/components/ui/otp-input.tsx +45 -0
- package/src/components/ui/typography.tsx +85 -0
- package/src/index.css +2 -0
- package/src/index.ts +2 -0
- package/src/types.d.ts +4 -0
- package/tsconfig.json +4 -0
- package/tsup.config.ts +12 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// src/components/ui/input/label.tsx
|
|
2
|
+
import { memo as memo3 } from "react";
|
|
3
|
+
import { cx as cx3 } from "@xjur-ui/util";
|
|
4
|
+
|
|
5
|
+
// src/components/ui/typography.tsx
|
|
6
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
7
|
+
import { cva } from "@xjur-ui/util";
|
|
8
|
+
import { memo } from "react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var typographyVariants = cva("", {
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
body: "",
|
|
14
|
+
label: "",
|
|
15
|
+
title: "",
|
|
16
|
+
headline: ""
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
"sm-2x": "",
|
|
20
|
+
"sm-1x": "",
|
|
21
|
+
sm: "",
|
|
22
|
+
md: "",
|
|
23
|
+
lg: ""
|
|
24
|
+
},
|
|
25
|
+
weight: {
|
|
26
|
+
thin: "font-thin",
|
|
27
|
+
extraLight: "font-extralight",
|
|
28
|
+
light: "font-light",
|
|
29
|
+
normal: "font-normal",
|
|
30
|
+
medium: "font-medium",
|
|
31
|
+
semibold: "font-semibold",
|
|
32
|
+
bold: "font-bold",
|
|
33
|
+
extraBold: "font-extrabold",
|
|
34
|
+
black: "font-black"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
compoundVariants: [
|
|
38
|
+
{ variant: "body", size: "sm-1x", class: "text-size-body-sm-1x" },
|
|
39
|
+
{ variant: "body", size: "sm", class: "text-size-body-sm" },
|
|
40
|
+
{ variant: "body", size: "md", class: "text-size-body-md" },
|
|
41
|
+
{ variant: "body", size: "lg", class: "text-size-body-lg" },
|
|
42
|
+
{ variant: "label", size: "sm-2x", class: "text-size-label-sm-2x" },
|
|
43
|
+
{ variant: "label", size: "sm-1x", class: "text-size-label-sm-1x" },
|
|
44
|
+
{ variant: "label", size: "sm", class: "text-size-label-sm" },
|
|
45
|
+
{ variant: "label", size: "md", class: "text-size-label-md" },
|
|
46
|
+
{ variant: "label", size: "lg", class: "text-size-label-lg" },
|
|
47
|
+
{ variant: "title", size: "sm", class: "text-size-title-sm" },
|
|
48
|
+
{ variant: "title", size: "md", class: "text-size-title-md" },
|
|
49
|
+
{ variant: "title", size: "lg", class: "text-size-title-lg" },
|
|
50
|
+
{ variant: "headline", size: "sm", class: "text-size-headline-sm" },
|
|
51
|
+
{ variant: "headline", size: "md", class: "text-size-headline-md" },
|
|
52
|
+
{ variant: "headline", size: "lg", class: "text-size-headline-lg" }
|
|
53
|
+
],
|
|
54
|
+
defaultVariants: {
|
|
55
|
+
variant: "body",
|
|
56
|
+
size: "md",
|
|
57
|
+
weight: "normal"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var Typography = memo(
|
|
61
|
+
({
|
|
62
|
+
variant,
|
|
63
|
+
size,
|
|
64
|
+
weight,
|
|
65
|
+
asChild,
|
|
66
|
+
className,
|
|
67
|
+
...props
|
|
68
|
+
}) => {
|
|
69
|
+
const Component = asChild ? Slot : "span";
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
Component,
|
|
72
|
+
{
|
|
73
|
+
className: typographyVariants({ variant, size, weight, className }),
|
|
74
|
+
...props
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
Typography.displayName = "Typography";
|
|
80
|
+
|
|
81
|
+
// src/components/ui/input/root.tsx
|
|
82
|
+
import { createContext, use } from "react";
|
|
83
|
+
import { cx as cx2 } from "@xjur-ui/util";
|
|
84
|
+
|
|
85
|
+
// src/components/ui/input/message.tsx
|
|
86
|
+
import { memo as memo2 } from "react";
|
|
87
|
+
import { cx } from "@xjur-ui/util";
|
|
88
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
89
|
+
var InputMessage = memo2(
|
|
90
|
+
({
|
|
91
|
+
children,
|
|
92
|
+
className,
|
|
93
|
+
weight = "normal",
|
|
94
|
+
variant = "body",
|
|
95
|
+
size = "sm-1x",
|
|
96
|
+
...props
|
|
97
|
+
}) => {
|
|
98
|
+
const { errorMessage } = useInput();
|
|
99
|
+
return /* @__PURE__ */ jsx2(
|
|
100
|
+
Typography,
|
|
101
|
+
{
|
|
102
|
+
className: cx(
|
|
103
|
+
"text-neutral-dark data-[error=true]:text-danger-idle",
|
|
104
|
+
className
|
|
105
|
+
),
|
|
106
|
+
"data-error": !!errorMessage,
|
|
107
|
+
size,
|
|
108
|
+
variant,
|
|
109
|
+
weight,
|
|
110
|
+
...props,
|
|
111
|
+
children
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
InputMessage.displayName = "InputMessage";
|
|
117
|
+
|
|
118
|
+
// src/components/ui/input/root.tsx
|
|
119
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
120
|
+
var InputRootContext = createContext({});
|
|
121
|
+
function useInput() {
|
|
122
|
+
const context = use(InputRootContext);
|
|
123
|
+
if (!context) {
|
|
124
|
+
throw new Error(
|
|
125
|
+
"useInput must be called within <Input.Root> or <Select.Root>"
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
return context;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// src/components/ui/input/label.tsx
|
|
132
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
133
|
+
var InputLabel = memo3(
|
|
134
|
+
({
|
|
135
|
+
children,
|
|
136
|
+
htmlFor,
|
|
137
|
+
variant = "label",
|
|
138
|
+
weight = "medium",
|
|
139
|
+
size = "sm",
|
|
140
|
+
className,
|
|
141
|
+
...props
|
|
142
|
+
}) => {
|
|
143
|
+
const { errorMessage } = useInput();
|
|
144
|
+
return /* @__PURE__ */ jsx4(
|
|
145
|
+
Typography,
|
|
146
|
+
{
|
|
147
|
+
asChild: true,
|
|
148
|
+
className: cx3(
|
|
149
|
+
"text-title-neutral data-[error=true]:text-danger-label-active w-fit",
|
|
150
|
+
className
|
|
151
|
+
),
|
|
152
|
+
"data-error": !!errorMessage,
|
|
153
|
+
size,
|
|
154
|
+
variant,
|
|
155
|
+
weight,
|
|
156
|
+
...props,
|
|
157
|
+
children: /* @__PURE__ */ jsx4("label", { htmlFor, children })
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
InputLabel.displayName = "InputLabel";
|
|
163
|
+
export {
|
|
164
|
+
InputLabel
|
|
165
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { TypographyProps } from '../typography.js';
|
|
4
|
+
import 'class-variance-authority/types';
|
|
5
|
+
import '@xjur-ui/util';
|
|
6
|
+
|
|
7
|
+
type InputMessageProps = TypographyProps;
|
|
8
|
+
declare const InputMessage: react.MemoExoticComponent<({ children, className, weight, variant, size, ...props }: InputMessageProps) => react_jsx_runtime.JSX.Element>;
|
|
9
|
+
|
|
10
|
+
export { InputMessage, type InputMessageProps };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// src/components/ui/input/message.tsx
|
|
2
|
+
import { memo as memo2 } from "react";
|
|
3
|
+
import { cx as cx2 } from "@xjur-ui/util";
|
|
4
|
+
|
|
5
|
+
// src/components/ui/typography.tsx
|
|
6
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
7
|
+
import { cva } from "@xjur-ui/util";
|
|
8
|
+
import { memo } from "react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var typographyVariants = cva("", {
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
body: "",
|
|
14
|
+
label: "",
|
|
15
|
+
title: "",
|
|
16
|
+
headline: ""
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
"sm-2x": "",
|
|
20
|
+
"sm-1x": "",
|
|
21
|
+
sm: "",
|
|
22
|
+
md: "",
|
|
23
|
+
lg: ""
|
|
24
|
+
},
|
|
25
|
+
weight: {
|
|
26
|
+
thin: "font-thin",
|
|
27
|
+
extraLight: "font-extralight",
|
|
28
|
+
light: "font-light",
|
|
29
|
+
normal: "font-normal",
|
|
30
|
+
medium: "font-medium",
|
|
31
|
+
semibold: "font-semibold",
|
|
32
|
+
bold: "font-bold",
|
|
33
|
+
extraBold: "font-extrabold",
|
|
34
|
+
black: "font-black"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
compoundVariants: [
|
|
38
|
+
{ variant: "body", size: "sm-1x", class: "text-size-body-sm-1x" },
|
|
39
|
+
{ variant: "body", size: "sm", class: "text-size-body-sm" },
|
|
40
|
+
{ variant: "body", size: "md", class: "text-size-body-md" },
|
|
41
|
+
{ variant: "body", size: "lg", class: "text-size-body-lg" },
|
|
42
|
+
{ variant: "label", size: "sm-2x", class: "text-size-label-sm-2x" },
|
|
43
|
+
{ variant: "label", size: "sm-1x", class: "text-size-label-sm-1x" },
|
|
44
|
+
{ variant: "label", size: "sm", class: "text-size-label-sm" },
|
|
45
|
+
{ variant: "label", size: "md", class: "text-size-label-md" },
|
|
46
|
+
{ variant: "label", size: "lg", class: "text-size-label-lg" },
|
|
47
|
+
{ variant: "title", size: "sm", class: "text-size-title-sm" },
|
|
48
|
+
{ variant: "title", size: "md", class: "text-size-title-md" },
|
|
49
|
+
{ variant: "title", size: "lg", class: "text-size-title-lg" },
|
|
50
|
+
{ variant: "headline", size: "sm", class: "text-size-headline-sm" },
|
|
51
|
+
{ variant: "headline", size: "md", class: "text-size-headline-md" },
|
|
52
|
+
{ variant: "headline", size: "lg", class: "text-size-headline-lg" }
|
|
53
|
+
],
|
|
54
|
+
defaultVariants: {
|
|
55
|
+
variant: "body",
|
|
56
|
+
size: "md",
|
|
57
|
+
weight: "normal"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var Typography = memo(
|
|
61
|
+
({
|
|
62
|
+
variant,
|
|
63
|
+
size,
|
|
64
|
+
weight,
|
|
65
|
+
asChild,
|
|
66
|
+
className,
|
|
67
|
+
...props
|
|
68
|
+
}) => {
|
|
69
|
+
const Component = asChild ? Slot : "span";
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
Component,
|
|
72
|
+
{
|
|
73
|
+
className: typographyVariants({ variant, size, weight, className }),
|
|
74
|
+
...props
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
Typography.displayName = "Typography";
|
|
80
|
+
|
|
81
|
+
// src/components/ui/input/root.tsx
|
|
82
|
+
import { createContext, use } from "react";
|
|
83
|
+
import { cx } from "@xjur-ui/util";
|
|
84
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
85
|
+
var InputRootContext = createContext({});
|
|
86
|
+
function useInput() {
|
|
87
|
+
const context = use(InputRootContext);
|
|
88
|
+
if (!context) {
|
|
89
|
+
throw new Error(
|
|
90
|
+
"useInput must be called within <Input.Root> or <Select.Root>"
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
return context;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// src/components/ui/input/message.tsx
|
|
97
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
98
|
+
var InputMessage = memo2(
|
|
99
|
+
({
|
|
100
|
+
children,
|
|
101
|
+
className,
|
|
102
|
+
weight = "normal",
|
|
103
|
+
variant = "body",
|
|
104
|
+
size = "sm-1x",
|
|
105
|
+
...props
|
|
106
|
+
}) => {
|
|
107
|
+
const { errorMessage } = useInput();
|
|
108
|
+
return /* @__PURE__ */ jsx3(
|
|
109
|
+
Typography,
|
|
110
|
+
{
|
|
111
|
+
className: cx2(
|
|
112
|
+
"text-neutral-dark data-[error=true]:text-danger-idle",
|
|
113
|
+
className
|
|
114
|
+
),
|
|
115
|
+
"data-error": !!errorMessage,
|
|
116
|
+
size,
|
|
117
|
+
variant,
|
|
118
|
+
weight,
|
|
119
|
+
...props,
|
|
120
|
+
children
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
InputMessage.displayName = "InputMessage";
|
|
126
|
+
export {
|
|
127
|
+
InputMessage
|
|
128
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
declare const InputRootContext: react.Context<InputRoot>;
|
|
6
|
+
declare function useInput(): InputRoot;
|
|
7
|
+
type InputRootProps = ComponentProps<'div'> & {
|
|
8
|
+
children: ComponentProps<'div'>['children'];
|
|
9
|
+
} & InputRoot;
|
|
10
|
+
type InputRoot = {
|
|
11
|
+
size?: 'md' | 'lg';
|
|
12
|
+
rounded?: boolean;
|
|
13
|
+
errorMessage?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare function InputRoot({ children, className, errorMessage, size, rounded, disabled, ...props }: InputRootProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { InputRoot, InputRootContext, type InputRootProps, useInput };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// src/components/ui/input/root.tsx
|
|
2
|
+
import { createContext, use } from "react";
|
|
3
|
+
import { cx as cx2 } from "@xjur-ui/util";
|
|
4
|
+
|
|
5
|
+
// src/components/ui/input/message.tsx
|
|
6
|
+
import { memo as memo2 } from "react";
|
|
7
|
+
import { cx } from "@xjur-ui/util";
|
|
8
|
+
|
|
9
|
+
// src/components/ui/typography.tsx
|
|
10
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
11
|
+
import { cva } from "@xjur-ui/util";
|
|
12
|
+
import { memo } from "react";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var typographyVariants = cva("", {
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
body: "",
|
|
18
|
+
label: "",
|
|
19
|
+
title: "",
|
|
20
|
+
headline: ""
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
"sm-2x": "",
|
|
24
|
+
"sm-1x": "",
|
|
25
|
+
sm: "",
|
|
26
|
+
md: "",
|
|
27
|
+
lg: ""
|
|
28
|
+
},
|
|
29
|
+
weight: {
|
|
30
|
+
thin: "font-thin",
|
|
31
|
+
extraLight: "font-extralight",
|
|
32
|
+
light: "font-light",
|
|
33
|
+
normal: "font-normal",
|
|
34
|
+
medium: "font-medium",
|
|
35
|
+
semibold: "font-semibold",
|
|
36
|
+
bold: "font-bold",
|
|
37
|
+
extraBold: "font-extrabold",
|
|
38
|
+
black: "font-black"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
compoundVariants: [
|
|
42
|
+
{ variant: "body", size: "sm-1x", class: "text-size-body-sm-1x" },
|
|
43
|
+
{ variant: "body", size: "sm", class: "text-size-body-sm" },
|
|
44
|
+
{ variant: "body", size: "md", class: "text-size-body-md" },
|
|
45
|
+
{ variant: "body", size: "lg", class: "text-size-body-lg" },
|
|
46
|
+
{ variant: "label", size: "sm-2x", class: "text-size-label-sm-2x" },
|
|
47
|
+
{ variant: "label", size: "sm-1x", class: "text-size-label-sm-1x" },
|
|
48
|
+
{ variant: "label", size: "sm", class: "text-size-label-sm" },
|
|
49
|
+
{ variant: "label", size: "md", class: "text-size-label-md" },
|
|
50
|
+
{ variant: "label", size: "lg", class: "text-size-label-lg" },
|
|
51
|
+
{ variant: "title", size: "sm", class: "text-size-title-sm" },
|
|
52
|
+
{ variant: "title", size: "md", class: "text-size-title-md" },
|
|
53
|
+
{ variant: "title", size: "lg", class: "text-size-title-lg" },
|
|
54
|
+
{ variant: "headline", size: "sm", class: "text-size-headline-sm" },
|
|
55
|
+
{ variant: "headline", size: "md", class: "text-size-headline-md" },
|
|
56
|
+
{ variant: "headline", size: "lg", class: "text-size-headline-lg" }
|
|
57
|
+
],
|
|
58
|
+
defaultVariants: {
|
|
59
|
+
variant: "body",
|
|
60
|
+
size: "md",
|
|
61
|
+
weight: "normal"
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
var Typography = memo(
|
|
65
|
+
({
|
|
66
|
+
variant,
|
|
67
|
+
size,
|
|
68
|
+
weight,
|
|
69
|
+
asChild,
|
|
70
|
+
className,
|
|
71
|
+
...props
|
|
72
|
+
}) => {
|
|
73
|
+
const Component = asChild ? Slot : "span";
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
Component,
|
|
76
|
+
{
|
|
77
|
+
className: typographyVariants({ variant, size, weight, className }),
|
|
78
|
+
...props
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
Typography.displayName = "Typography";
|
|
84
|
+
|
|
85
|
+
// src/components/ui/input/message.tsx
|
|
86
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
87
|
+
var InputMessage = memo2(
|
|
88
|
+
({
|
|
89
|
+
children,
|
|
90
|
+
className,
|
|
91
|
+
weight = "normal",
|
|
92
|
+
variant = "body",
|
|
93
|
+
size = "sm-1x",
|
|
94
|
+
...props
|
|
95
|
+
}) => {
|
|
96
|
+
const { errorMessage } = useInput();
|
|
97
|
+
return /* @__PURE__ */ jsx2(
|
|
98
|
+
Typography,
|
|
99
|
+
{
|
|
100
|
+
className: cx(
|
|
101
|
+
"text-neutral-dark data-[error=true]:text-danger-idle",
|
|
102
|
+
className
|
|
103
|
+
),
|
|
104
|
+
"data-error": !!errorMessage,
|
|
105
|
+
size,
|
|
106
|
+
variant,
|
|
107
|
+
weight,
|
|
108
|
+
...props,
|
|
109
|
+
children
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
InputMessage.displayName = "InputMessage";
|
|
115
|
+
|
|
116
|
+
// src/components/ui/input/root.tsx
|
|
117
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
118
|
+
var InputRootContext = createContext({});
|
|
119
|
+
function useInput() {
|
|
120
|
+
const context = use(InputRootContext);
|
|
121
|
+
if (!context) {
|
|
122
|
+
throw new Error(
|
|
123
|
+
"useInput must be called within <Input.Root> or <Select.Root>"
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
return context;
|
|
127
|
+
}
|
|
128
|
+
function InputRoot({
|
|
129
|
+
children,
|
|
130
|
+
className,
|
|
131
|
+
errorMessage,
|
|
132
|
+
size = "lg",
|
|
133
|
+
rounded = false,
|
|
134
|
+
disabled,
|
|
135
|
+
...props
|
|
136
|
+
}) {
|
|
137
|
+
return /* @__PURE__ */ jsx3(
|
|
138
|
+
InputRootContext.Provider,
|
|
139
|
+
{
|
|
140
|
+
value: { errorMessage, disabled, size, rounded },
|
|
141
|
+
children: /* @__PURE__ */ jsxs(
|
|
142
|
+
"div",
|
|
143
|
+
{
|
|
144
|
+
...props,
|
|
145
|
+
className: cx2(
|
|
146
|
+
"group gap-small relative flex flex-col data-[disabled=true]:opacity-60",
|
|
147
|
+
className
|
|
148
|
+
),
|
|
149
|
+
"data-disabled": disabled,
|
|
150
|
+
children: [
|
|
151
|
+
children,
|
|
152
|
+
errorMessage && /* @__PURE__ */ jsx3(InputMessage, { children: errorMessage })
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
export {
|
|
160
|
+
InputRoot,
|
|
161
|
+
InputRootContext,
|
|
162
|
+
useInput
|
|
163
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
type InputSlotProps = ComponentProps<'label'> & {
|
|
6
|
+
children: ComponentProps<'label'>['children'];
|
|
7
|
+
};
|
|
8
|
+
declare const InputSlot: react.MemoExoticComponent<({ children, className, ...props }: InputSlotProps) => react_jsx_runtime.JSX.Element>;
|
|
9
|
+
|
|
10
|
+
export { InputSlot, type InputSlotProps };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/components/ui/input/slot.tsx
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { cx } from "@xjur-ui/util";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var InputSlot = memo(
|
|
6
|
+
({ children, className, ...props }) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"label",
|
|
9
|
+
{
|
|
10
|
+
...props,
|
|
11
|
+
className: cx("flex items-center justify-center", className),
|
|
12
|
+
children
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
InputSlot.displayName = "InputSlot";
|
|
18
|
+
export {
|
|
19
|
+
InputSlot
|
|
20
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { MaskOptions } from '@react-input/mask';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
type InputTextProps = ComponentProps<'input'> & {
|
|
6
|
+
mask?: MaskOptions;
|
|
7
|
+
};
|
|
8
|
+
declare function InputText({ className, value, mask, ...props }: InputTextProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { InputText, type InputTextProps };
|