@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,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
|
|
4
|
+
type InputContentProps = ComponentProps<'div'> & {
|
|
5
|
+
children: ComponentProps<'div'>['children'];
|
|
6
|
+
};
|
|
7
|
+
declare function InputContent({ className, children, ...props }: InputContentProps): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { InputContent, type InputContentProps };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// src/components/ui/input/content.tsx
|
|
2
|
+
import { cx as cx3, cva as cva2 } from "@xjur-ui/util";
|
|
3
|
+
|
|
4
|
+
// src/components/ui/input/root.tsx
|
|
5
|
+
import { createContext, use } from "react";
|
|
6
|
+
import { cx as cx2 } from "@xjur-ui/util";
|
|
7
|
+
|
|
8
|
+
// src/components/ui/input/message.tsx
|
|
9
|
+
import { memo as memo2 } from "react";
|
|
10
|
+
import { cx } from "@xjur-ui/util";
|
|
11
|
+
|
|
12
|
+
// src/components/ui/typography.tsx
|
|
13
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
14
|
+
import { cva } from "@xjur-ui/util";
|
|
15
|
+
import { memo } from "react";
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
|
+
var typographyVariants = cva("", {
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
body: "",
|
|
21
|
+
label: "",
|
|
22
|
+
title: "",
|
|
23
|
+
headline: ""
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
"sm-2x": "",
|
|
27
|
+
"sm-1x": "",
|
|
28
|
+
sm: "",
|
|
29
|
+
md: "",
|
|
30
|
+
lg: ""
|
|
31
|
+
},
|
|
32
|
+
weight: {
|
|
33
|
+
thin: "font-thin",
|
|
34
|
+
extraLight: "font-extralight",
|
|
35
|
+
light: "font-light",
|
|
36
|
+
normal: "font-normal",
|
|
37
|
+
medium: "font-medium",
|
|
38
|
+
semibold: "font-semibold",
|
|
39
|
+
bold: "font-bold",
|
|
40
|
+
extraBold: "font-extrabold",
|
|
41
|
+
black: "font-black"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
compoundVariants: [
|
|
45
|
+
{ variant: "body", size: "sm-1x", class: "text-size-body-sm-1x" },
|
|
46
|
+
{ variant: "body", size: "sm", class: "text-size-body-sm" },
|
|
47
|
+
{ variant: "body", size: "md", class: "text-size-body-md" },
|
|
48
|
+
{ variant: "body", size: "lg", class: "text-size-body-lg" },
|
|
49
|
+
{ variant: "label", size: "sm-2x", class: "text-size-label-sm-2x" },
|
|
50
|
+
{ variant: "label", size: "sm-1x", class: "text-size-label-sm-1x" },
|
|
51
|
+
{ variant: "label", size: "sm", class: "text-size-label-sm" },
|
|
52
|
+
{ variant: "label", size: "md", class: "text-size-label-md" },
|
|
53
|
+
{ variant: "label", size: "lg", class: "text-size-label-lg" },
|
|
54
|
+
{ variant: "title", size: "sm", class: "text-size-title-sm" },
|
|
55
|
+
{ variant: "title", size: "md", class: "text-size-title-md" },
|
|
56
|
+
{ variant: "title", size: "lg", class: "text-size-title-lg" },
|
|
57
|
+
{ variant: "headline", size: "sm", class: "text-size-headline-sm" },
|
|
58
|
+
{ variant: "headline", size: "md", class: "text-size-headline-md" },
|
|
59
|
+
{ variant: "headline", size: "lg", class: "text-size-headline-lg" }
|
|
60
|
+
],
|
|
61
|
+
defaultVariants: {
|
|
62
|
+
variant: "body",
|
|
63
|
+
size: "md",
|
|
64
|
+
weight: "normal"
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
var Typography = memo(
|
|
68
|
+
({
|
|
69
|
+
variant,
|
|
70
|
+
size,
|
|
71
|
+
weight,
|
|
72
|
+
asChild,
|
|
73
|
+
className,
|
|
74
|
+
...props
|
|
75
|
+
}) => {
|
|
76
|
+
const Component = asChild ? Slot : "span";
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
Component,
|
|
79
|
+
{
|
|
80
|
+
className: typographyVariants({ variant, size, weight, className }),
|
|
81
|
+
...props
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
Typography.displayName = "Typography";
|
|
87
|
+
|
|
88
|
+
// src/components/ui/input/message.tsx
|
|
89
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
90
|
+
var InputMessage = memo2(
|
|
91
|
+
({
|
|
92
|
+
children,
|
|
93
|
+
className,
|
|
94
|
+
weight = "normal",
|
|
95
|
+
variant = "body",
|
|
96
|
+
size = "sm-1x",
|
|
97
|
+
...props
|
|
98
|
+
}) => {
|
|
99
|
+
const { errorMessage } = useInput();
|
|
100
|
+
return /* @__PURE__ */ jsx2(
|
|
101
|
+
Typography,
|
|
102
|
+
{
|
|
103
|
+
className: cx(
|
|
104
|
+
"text-neutral-dark data-[error=true]:text-danger-idle",
|
|
105
|
+
className
|
|
106
|
+
),
|
|
107
|
+
"data-error": !!errorMessage,
|
|
108
|
+
size,
|
|
109
|
+
variant,
|
|
110
|
+
weight,
|
|
111
|
+
...props,
|
|
112
|
+
children
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
InputMessage.displayName = "InputMessage";
|
|
118
|
+
|
|
119
|
+
// src/components/ui/input/root.tsx
|
|
120
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
121
|
+
var InputRootContext = createContext({});
|
|
122
|
+
function useInput() {
|
|
123
|
+
const context = use(InputRootContext);
|
|
124
|
+
if (!context) {
|
|
125
|
+
throw new Error(
|
|
126
|
+
"useInput must be called within <Input.Root> or <Select.Root>"
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
return context;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// src/components/ui/input/content.tsx
|
|
133
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
134
|
+
var variants = cva2(
|
|
135
|
+
[
|
|
136
|
+
"flex items-center gap-small py-small_1x-alt px-small",
|
|
137
|
+
"border-1 border-border-layer-2",
|
|
138
|
+
"bg-layer-2-idle",
|
|
139
|
+
"group-hover:border-border-layer-3",
|
|
140
|
+
"transition-[border-color] duration-100 ease",
|
|
141
|
+
"data-[disabled=true]:pointer-events-none",
|
|
142
|
+
"has-[input[data-filled=true]]:bg-layer-2-hover"
|
|
143
|
+
],
|
|
144
|
+
{
|
|
145
|
+
variants: {
|
|
146
|
+
isError: {
|
|
147
|
+
true: "border-1 border-danger-idle focus-within:border-danger-idle focus-within:shadow-focus-danger group-hover:border-danger-idle",
|
|
148
|
+
false: "focus-within:border-primary-idle focus-within:shadow-focus-primary"
|
|
149
|
+
},
|
|
150
|
+
rounded: {
|
|
151
|
+
true: "rounded-circle",
|
|
152
|
+
false: "rounded-small-1x"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
defaultVariants: {
|
|
156
|
+
rounded: false
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
function InputContent({
|
|
161
|
+
className,
|
|
162
|
+
children,
|
|
163
|
+
...props
|
|
164
|
+
}) {
|
|
165
|
+
const { errorMessage, rounded, disabled } = useInput();
|
|
166
|
+
const classNames = variants({
|
|
167
|
+
className,
|
|
168
|
+
isError: !!errorMessage,
|
|
169
|
+
rounded
|
|
170
|
+
});
|
|
171
|
+
return /* @__PURE__ */ jsx4(
|
|
172
|
+
"div",
|
|
173
|
+
{
|
|
174
|
+
...props,
|
|
175
|
+
className: cx3("group", classNames),
|
|
176
|
+
"data-disabled": disabled,
|
|
177
|
+
children
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
export {
|
|
182
|
+
InputContent
|
|
183
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { InputRoot, InputRootContext, InputRootProps, useInput } from './root.js';
|
|
2
|
+
export { InputText, InputTextProps } from './text.js';
|
|
3
|
+
export { InputContent, InputContentProps } from './content.js';
|
|
4
|
+
export { InputSlot, InputSlotProps } from './slot.js';
|
|
5
|
+
export { InputMessage, InputMessageProps } from './message.js';
|
|
6
|
+
export { InputLabel, InputLabelProps } from './label.js';
|
|
7
|
+
import 'react/jsx-runtime';
|
|
8
|
+
import 'react';
|
|
9
|
+
import '@react-input/mask';
|
|
10
|
+
import '../typography.js';
|
|
11
|
+
import 'class-variance-authority/types';
|
|
12
|
+
import '@xjur-ui/util';
|
|
@@ -0,0 +1,335 @@
|
|
|
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
|
+
|
|
160
|
+
// src/components/ui/input/text.tsx
|
|
161
|
+
import { InputMask } from "@react-input/mask";
|
|
162
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
163
|
+
import { cx as cx3 } from "@xjur-ui/util";
|
|
164
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
165
|
+
function InputText({
|
|
166
|
+
className,
|
|
167
|
+
value,
|
|
168
|
+
mask,
|
|
169
|
+
...props
|
|
170
|
+
}) {
|
|
171
|
+
const { errorMessage } = useInput();
|
|
172
|
+
const inputRef = useRef(null);
|
|
173
|
+
const InputComponent = mask ? InputMask : "input";
|
|
174
|
+
const onCheckInputFilled = useCallback(
|
|
175
|
+
({ shouldUnfill = false }) => {
|
|
176
|
+
if (inputRef.current) {
|
|
177
|
+
if (shouldUnfill) inputRef.current.dataset.filled = "false";
|
|
178
|
+
else {
|
|
179
|
+
const hasNotErrorAndHasValue = !errorMessage && !!inputRef.current.value;
|
|
180
|
+
inputRef.current.dataset.filled = String(hasNotErrorAndHasValue);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
[errorMessage]
|
|
185
|
+
);
|
|
186
|
+
function setRef(ref) {
|
|
187
|
+
inputRef.current = ref;
|
|
188
|
+
if (typeof props.ref === "function") {
|
|
189
|
+
props.ref(ref);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
onCheckInputFilled({ shouldUnfill: false });
|
|
194
|
+
}, [onCheckInputFilled]);
|
|
195
|
+
return /* @__PURE__ */ jsx4(
|
|
196
|
+
InputComponent,
|
|
197
|
+
{
|
|
198
|
+
...props,
|
|
199
|
+
...mask && { ...mask },
|
|
200
|
+
className: cx3(
|
|
201
|
+
"h-full w-full bg-transparent",
|
|
202
|
+
"border-hidden outline-hidden",
|
|
203
|
+
"placeholder:text-placeholder-neutral font-normal",
|
|
204
|
+
"text-neutral-dark text-size-body-md overflow-hidden text-ellipsis",
|
|
205
|
+
className
|
|
206
|
+
),
|
|
207
|
+
"data-filled": !!value && !errorMessage,
|
|
208
|
+
readOnly: props.readOnly !== void 0 && props.readOnly,
|
|
209
|
+
ref: setRef,
|
|
210
|
+
value,
|
|
211
|
+
onBlur: (event) => {
|
|
212
|
+
props.onBlur?.(event);
|
|
213
|
+
onCheckInputFilled({ shouldUnfill: false });
|
|
214
|
+
},
|
|
215
|
+
onFocus: (event) => {
|
|
216
|
+
props.onFocus?.(event);
|
|
217
|
+
onCheckInputFilled({ shouldUnfill: true });
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// src/components/ui/input/content.tsx
|
|
224
|
+
import { cx as cx4, cva as cva2 } from "@xjur-ui/util";
|
|
225
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
226
|
+
var variants = cva2(
|
|
227
|
+
[
|
|
228
|
+
"flex items-center gap-small py-small_1x-alt px-small",
|
|
229
|
+
"border-1 border-border-layer-2",
|
|
230
|
+
"bg-layer-2-idle",
|
|
231
|
+
"group-hover:border-border-layer-3",
|
|
232
|
+
"transition-[border-color] duration-100 ease",
|
|
233
|
+
"data-[disabled=true]:pointer-events-none",
|
|
234
|
+
"has-[input[data-filled=true]]:bg-layer-2-hover"
|
|
235
|
+
],
|
|
236
|
+
{
|
|
237
|
+
variants: {
|
|
238
|
+
isError: {
|
|
239
|
+
true: "border-1 border-danger-idle focus-within:border-danger-idle focus-within:shadow-focus-danger group-hover:border-danger-idle",
|
|
240
|
+
false: "focus-within:border-primary-idle focus-within:shadow-focus-primary"
|
|
241
|
+
},
|
|
242
|
+
rounded: {
|
|
243
|
+
true: "rounded-circle",
|
|
244
|
+
false: "rounded-small-1x"
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
defaultVariants: {
|
|
248
|
+
rounded: false
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
function InputContent({
|
|
253
|
+
className,
|
|
254
|
+
children,
|
|
255
|
+
...props
|
|
256
|
+
}) {
|
|
257
|
+
const { errorMessage, rounded, disabled } = useInput();
|
|
258
|
+
const classNames = variants({
|
|
259
|
+
className,
|
|
260
|
+
isError: !!errorMessage,
|
|
261
|
+
rounded
|
|
262
|
+
});
|
|
263
|
+
return /* @__PURE__ */ jsx5(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
...props,
|
|
267
|
+
className: cx4("group", classNames),
|
|
268
|
+
"data-disabled": disabled,
|
|
269
|
+
children
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// src/components/ui/input/slot.tsx
|
|
275
|
+
import { memo as memo3 } from "react";
|
|
276
|
+
import { cx as cx5 } from "@xjur-ui/util";
|
|
277
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
278
|
+
var InputSlot = memo3(
|
|
279
|
+
({ children, className, ...props }) => {
|
|
280
|
+
return /* @__PURE__ */ jsx6(
|
|
281
|
+
"label",
|
|
282
|
+
{
|
|
283
|
+
...props,
|
|
284
|
+
className: cx5("flex items-center justify-center", className),
|
|
285
|
+
children
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
InputSlot.displayName = "InputSlot";
|
|
291
|
+
|
|
292
|
+
// src/components/ui/input/label.tsx
|
|
293
|
+
import { memo as memo4 } from "react";
|
|
294
|
+
import { cx as cx6 } from "@xjur-ui/util";
|
|
295
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
296
|
+
var InputLabel = memo4(
|
|
297
|
+
({
|
|
298
|
+
children,
|
|
299
|
+
htmlFor,
|
|
300
|
+
variant = "label",
|
|
301
|
+
weight = "medium",
|
|
302
|
+
size = "sm",
|
|
303
|
+
className,
|
|
304
|
+
...props
|
|
305
|
+
}) => {
|
|
306
|
+
const { errorMessage } = useInput();
|
|
307
|
+
return /* @__PURE__ */ jsx7(
|
|
308
|
+
Typography,
|
|
309
|
+
{
|
|
310
|
+
asChild: true,
|
|
311
|
+
className: cx6(
|
|
312
|
+
"text-title-neutral data-[error=true]:text-danger-label-active w-fit",
|
|
313
|
+
className
|
|
314
|
+
),
|
|
315
|
+
"data-error": !!errorMessage,
|
|
316
|
+
size,
|
|
317
|
+
variant,
|
|
318
|
+
weight,
|
|
319
|
+
...props,
|
|
320
|
+
children: /* @__PURE__ */ jsx7("label", { htmlFor, children })
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
);
|
|
325
|
+
InputLabel.displayName = "InputLabel";
|
|
326
|
+
export {
|
|
327
|
+
InputContent,
|
|
328
|
+
InputLabel,
|
|
329
|
+
InputMessage,
|
|
330
|
+
InputRoot,
|
|
331
|
+
InputRootContext,
|
|
332
|
+
InputSlot,
|
|
333
|
+
InputText,
|
|
334
|
+
useInput
|
|
335
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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 InputLabelProps = TypographyProps & {
|
|
8
|
+
htmlFor?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const InputLabel: react.MemoExoticComponent<({ children, htmlFor, variant, weight, size, className, ...props }: InputLabelProps) => react_jsx_runtime.JSX.Element>;
|
|
11
|
+
|
|
12
|
+
export { InputLabel, type InputLabelProps };
|