@yamada-ui/input 0.1.11 → 0.2.1
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/index.d.ts +1 -1
- package/dist/index.js +2 -4
- package/dist/index.mjs +2 -4
- package/dist/input-addon.d.ts +5 -0
- package/dist/input-addon.js +67 -65
- package/dist/input-element.d.ts +10 -0
- package/dist/input-element.js +67 -65
- package/dist/input.d.ts +9 -0
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Input, InputProps } from './input.js';
|
|
2
|
-
export { InputGroup, InputGroupProps
|
|
2
|
+
export { InputGroup, InputGroupProps } from './input-group.js';
|
|
3
3
|
export { InputAddonProps, InputLeftAddon, InputRightAddon } from './input-addon.js';
|
|
4
4
|
export { InputElementProps, InputLeftElement, InputRightElement } from './input-element.js';
|
|
5
5
|
import '@yamada-ui/core';
|
package/dist/index.js
CHANGED
|
@@ -25,8 +25,7 @@ __export(src_exports, {
|
|
|
25
25
|
InputLeftAddon: () => InputLeftAddon,
|
|
26
26
|
InputLeftElement: () => InputLeftElement,
|
|
27
27
|
InputRightAddon: () => InputRightAddon,
|
|
28
|
-
InputRightElement: () => InputRightElement
|
|
29
|
-
useInputGroup: () => useInputGroup
|
|
28
|
+
InputRightElement: () => InputRightElement
|
|
30
29
|
});
|
|
31
30
|
module.exports = __toCommonJS(src_exports);
|
|
32
31
|
|
|
@@ -221,6 +220,5 @@ var InputRightElement = (0, import_core4.forwardRef)(
|
|
|
221
220
|
InputLeftAddon,
|
|
222
221
|
InputLeftElement,
|
|
223
222
|
InputRightAddon,
|
|
224
|
-
InputRightElement
|
|
225
|
-
useInputGroup
|
|
223
|
+
InputRightElement
|
|
226
224
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -3,8 +3,7 @@ import {
|
|
|
3
3
|
InputLeftAddon,
|
|
4
4
|
InputLeftElement,
|
|
5
5
|
InputRightAddon,
|
|
6
|
-
InputRightElement
|
|
7
|
-
useInputGroup
|
|
6
|
+
InputRightElement
|
|
8
7
|
} from "./chunk-5IBH3I64.mjs";
|
|
9
8
|
import {
|
|
10
9
|
Input
|
|
@@ -15,6 +14,5 @@ export {
|
|
|
15
14
|
InputLeftAddon,
|
|
16
15
|
InputLeftElement,
|
|
17
16
|
InputRightAddon,
|
|
18
|
-
InputRightElement
|
|
19
|
-
useInputGroup
|
|
17
|
+
InputRightElement
|
|
20
18
|
};
|
package/dist/input-addon.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import * as _yamada_ui_core from '@yamada-ui/core';
|
|
|
2
2
|
import { HTMLUIProps } from '@yamada-ui/core';
|
|
3
3
|
|
|
4
4
|
type InputAddonOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The placement of the element.
|
|
7
|
+
*
|
|
8
|
+
* @default 'left'
|
|
9
|
+
*/
|
|
5
10
|
placement?: 'left' | 'right';
|
|
6
11
|
};
|
|
7
12
|
type InputAddonProps = HTMLUIProps<'div'> & InputAddonOptions;
|
package/dist/input-addon.js
CHANGED
|
@@ -27,6 +27,13 @@ module.exports = __toCommonJS(input_addon_exports);
|
|
|
27
27
|
var import_core4 = require("@yamada-ui/core");
|
|
28
28
|
var import_utils4 = require("@yamada-ui/utils");
|
|
29
29
|
|
|
30
|
+
// src/input-group.tsx
|
|
31
|
+
var import_core3 = require("@yamada-ui/core");
|
|
32
|
+
var import_file_input = require("@yamada-ui/file-input");
|
|
33
|
+
var import_use_token = require("@yamada-ui/use-token");
|
|
34
|
+
var import_utils3 = require("@yamada-ui/utils");
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
|
|
30
37
|
// src/input.tsx
|
|
31
38
|
var import_core = require("@yamada-ui/core");
|
|
32
39
|
var import_form_control = require("@yamada-ui/form-control");
|
|
@@ -49,67 +56,11 @@ var Input = (0, import_core.forwardRef)((props, ref) => {
|
|
|
49
56
|
);
|
|
50
57
|
});
|
|
51
58
|
|
|
52
|
-
// src/input-
|
|
59
|
+
// src/input-element.tsx
|
|
53
60
|
var import_core2 = require("@yamada-ui/core");
|
|
54
|
-
var import_file_input = require("@yamada-ui/file-input");
|
|
55
|
-
var import_use_token = require("@yamada-ui/use-token");
|
|
56
61
|
var import_utils2 = require("@yamada-ui/utils");
|
|
57
|
-
var import_react = require("react");
|
|
58
62
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
59
|
-
var
|
|
60
|
-
name: "InputGroupContext",
|
|
61
|
-
errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in "<InputGroup />" `
|
|
62
|
-
});
|
|
63
|
-
var InputGroup = (0, import_core2.forwardRef)((props, ref) => {
|
|
64
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
65
|
-
const [styles] = (0, import_core2.useMultiComponentStyle)("Input", props);
|
|
66
|
-
const { className, children, ...rest } = (0, import_core2.omitThemeProps)(props);
|
|
67
|
-
const css = {
|
|
68
|
-
width: "100%",
|
|
69
|
-
display: "flex",
|
|
70
|
-
position: "relative"
|
|
71
|
-
};
|
|
72
|
-
const groupProps = {};
|
|
73
|
-
const minHeight = (_g = (_e = (0, import_use_token.useToken)("sizes", (_c = (_a = styles.field) == null ? void 0 : _a.minHeight) != null ? _c : (_b = styles.field) == null ? void 0 : _b.minH)) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH;
|
|
74
|
-
const height = (_n = (_l = (0, import_use_token.useToken)("sizes", (_j = (_h = styles.field) == null ? void 0 : _h.height) != null ? _j : (_i = styles.field) == null ? void 0 : _i.h)) != null ? _l : (_k = styles.field) == null ? void 0 : _k.height) != null ? _n : (_m = styles.field) == null ? void 0 : _m.h;
|
|
75
|
-
const validChildren = (0, import_utils2.getValidChildren)(children);
|
|
76
|
-
validChildren.forEach((child) => {
|
|
77
|
-
if ((minHeight || height) && child.type === InputLeftElement)
|
|
78
|
-
groupProps.paddingStart = height != null ? height : minHeight;
|
|
79
|
-
if ((minHeight || height) && child.type === InputRightElement)
|
|
80
|
-
groupProps.paddingEnd = height != null ? height : minHeight;
|
|
81
|
-
if (child.type === InputLeftAddon)
|
|
82
|
-
groupProps.roundedLeft = 0;
|
|
83
|
-
if (child.type === InputRightAddon)
|
|
84
|
-
groupProps.roundedRight = 0;
|
|
85
|
-
});
|
|
86
|
-
const cloneChildren = validChildren.map((child) => {
|
|
87
|
-
var _a2, _b2;
|
|
88
|
-
const childProps = (0, import_utils2.filterUndefined)({
|
|
89
|
-
size: ((_a2 = child.props) == null ? void 0 : _a2.size) || props.size,
|
|
90
|
-
variant: ((_b2 = child.props) == null ? void 0 : _b2.variant) || props.variant,
|
|
91
|
-
...child.props
|
|
92
|
-
});
|
|
93
|
-
return child.type !== Input && child.type !== import_file_input.FileInput ? (0, import_react.cloneElement)(child, childProps) : (0, import_react.cloneElement)(child, Object.assign(childProps, groupProps));
|
|
94
|
-
});
|
|
95
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(InputGroupProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
96
|
-
import_core2.ui.div,
|
|
97
|
-
{
|
|
98
|
-
ref,
|
|
99
|
-
className: (0, import_utils2.cx)("ui-input-group", className),
|
|
100
|
-
role: "group",
|
|
101
|
-
__css: css,
|
|
102
|
-
...rest,
|
|
103
|
-
children: cloneChildren
|
|
104
|
-
}
|
|
105
|
-
) });
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// src/input-element.tsx
|
|
109
|
-
var import_core3 = require("@yamada-ui/core");
|
|
110
|
-
var import_utils3 = require("@yamada-ui/utils");
|
|
111
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
112
|
-
var InputElement = (0, import_core3.forwardRef)(
|
|
63
|
+
var InputElement = (0, import_core2.forwardRef)(
|
|
113
64
|
({ className, isClick = false, placement = "left", ...rest }, ref) => {
|
|
114
65
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
115
66
|
const styles = useInputGroup();
|
|
@@ -128,29 +79,29 @@ var InputElement = (0, import_core3.forwardRef)(
|
|
|
128
79
|
cursor: isClick ? "pointer" : "auto",
|
|
129
80
|
...styles.element
|
|
130
81
|
};
|
|
131
|
-
return /* @__PURE__ */ (0,
|
|
82
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.div, { ref, className: (0, import_utils2.cx)("ui-input-element", className), __css: css, ...rest });
|
|
132
83
|
}
|
|
133
84
|
);
|
|
134
|
-
var InputLeftElement = (0,
|
|
85
|
+
var InputLeftElement = (0, import_core2.forwardRef)(
|
|
135
86
|
({ className, ...rest }, ref) => {
|
|
136
|
-
return /* @__PURE__ */ (0,
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
137
88
|
InputElement,
|
|
138
89
|
{
|
|
139
90
|
ref,
|
|
140
|
-
className: (0,
|
|
91
|
+
className: (0, import_utils2.cx)("ui-input-element-left", className),
|
|
141
92
|
placement: "left",
|
|
142
93
|
...rest
|
|
143
94
|
}
|
|
144
95
|
);
|
|
145
96
|
}
|
|
146
97
|
);
|
|
147
|
-
var InputRightElement = (0,
|
|
98
|
+
var InputRightElement = (0, import_core2.forwardRef)(
|
|
148
99
|
({ className, ...rest }, ref) => {
|
|
149
|
-
return /* @__PURE__ */ (0,
|
|
100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
150
101
|
InputElement,
|
|
151
102
|
{
|
|
152
103
|
ref,
|
|
153
|
-
className: (0,
|
|
104
|
+
className: (0, import_utils2.cx)("ui-input-element-right", className),
|
|
154
105
|
placement: "right",
|
|
155
106
|
...rest
|
|
156
107
|
}
|
|
@@ -158,6 +109,57 @@ var InputRightElement = (0, import_core3.forwardRef)(
|
|
|
158
109
|
}
|
|
159
110
|
);
|
|
160
111
|
|
|
112
|
+
// src/input-group.tsx
|
|
113
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
114
|
+
var [InputGroupProvider, useInputGroup] = (0, import_utils3.createContext)({
|
|
115
|
+
name: "InputGroupContext",
|
|
116
|
+
errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in "<InputGroup />" `
|
|
117
|
+
});
|
|
118
|
+
var InputGroup = (0, import_core3.forwardRef)((props, ref) => {
|
|
119
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
120
|
+
const [styles] = (0, import_core3.useMultiComponentStyle)("Input", props);
|
|
121
|
+
const { className, children, ...rest } = (0, import_core3.omitThemeProps)(props);
|
|
122
|
+
const css = {
|
|
123
|
+
width: "100%",
|
|
124
|
+
display: "flex",
|
|
125
|
+
position: "relative"
|
|
126
|
+
};
|
|
127
|
+
const groupProps = {};
|
|
128
|
+
const minHeight = (_g = (_e = (0, import_use_token.useToken)("sizes", (_c = (_a = styles.field) == null ? void 0 : _a.minHeight) != null ? _c : (_b = styles.field) == null ? void 0 : _b.minH)) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH;
|
|
129
|
+
const height = (_n = (_l = (0, import_use_token.useToken)("sizes", (_j = (_h = styles.field) == null ? void 0 : _h.height) != null ? _j : (_i = styles.field) == null ? void 0 : _i.h)) != null ? _l : (_k = styles.field) == null ? void 0 : _k.height) != null ? _n : (_m = styles.field) == null ? void 0 : _m.h;
|
|
130
|
+
const validChildren = (0, import_utils3.getValidChildren)(children);
|
|
131
|
+
validChildren.forEach((child) => {
|
|
132
|
+
if ((minHeight || height) && child.type === InputLeftElement)
|
|
133
|
+
groupProps.paddingStart = height != null ? height : minHeight;
|
|
134
|
+
if ((minHeight || height) && child.type === InputRightElement)
|
|
135
|
+
groupProps.paddingEnd = height != null ? height : minHeight;
|
|
136
|
+
if (child.type === InputLeftAddon)
|
|
137
|
+
groupProps.roundedLeft = 0;
|
|
138
|
+
if (child.type === InputRightAddon)
|
|
139
|
+
groupProps.roundedRight = 0;
|
|
140
|
+
});
|
|
141
|
+
const cloneChildren = validChildren.map((child) => {
|
|
142
|
+
var _a2, _b2;
|
|
143
|
+
const childProps = (0, import_utils3.filterUndefined)({
|
|
144
|
+
size: ((_a2 = child.props) == null ? void 0 : _a2.size) || props.size,
|
|
145
|
+
variant: ((_b2 = child.props) == null ? void 0 : _b2.variant) || props.variant,
|
|
146
|
+
...child.props
|
|
147
|
+
});
|
|
148
|
+
return child.type !== Input && child.type !== import_file_input.FileInput ? (0, import_react.cloneElement)(child, childProps) : (0, import_react.cloneElement)(child, Object.assign(childProps, groupProps));
|
|
149
|
+
});
|
|
150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InputGroupProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
151
|
+
import_core3.ui.div,
|
|
152
|
+
{
|
|
153
|
+
ref,
|
|
154
|
+
className: (0, import_utils3.cx)("ui-input-group", className),
|
|
155
|
+
role: "group",
|
|
156
|
+
__css: css,
|
|
157
|
+
...rest,
|
|
158
|
+
children: cloneChildren
|
|
159
|
+
}
|
|
160
|
+
) });
|
|
161
|
+
});
|
|
162
|
+
|
|
161
163
|
// src/input-addon.tsx
|
|
162
164
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
163
165
|
var InputAddon = (0, import_core4.forwardRef)(
|
package/dist/input-element.d.ts
CHANGED
|
@@ -2,7 +2,17 @@ import * as _yamada_ui_core from '@yamada-ui/core';
|
|
|
2
2
|
import { HTMLUIProps } from '@yamada-ui/core';
|
|
3
3
|
|
|
4
4
|
type InputElementOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* If `true`, the element clickable.
|
|
7
|
+
*
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
5
10
|
isClick?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The placement of the element.
|
|
13
|
+
*
|
|
14
|
+
* @default 'left'
|
|
15
|
+
*/
|
|
6
16
|
placement?: 'left' | 'right';
|
|
7
17
|
};
|
|
8
18
|
type InputElementProps = HTMLUIProps<'div'> & InputElementOptions;
|
package/dist/input-element.js
CHANGED
|
@@ -27,6 +27,13 @@ module.exports = __toCommonJS(input_element_exports);
|
|
|
27
27
|
var import_core4 = require("@yamada-ui/core");
|
|
28
28
|
var import_utils4 = require("@yamada-ui/utils");
|
|
29
29
|
|
|
30
|
+
// src/input-group.tsx
|
|
31
|
+
var import_core3 = require("@yamada-ui/core");
|
|
32
|
+
var import_file_input = require("@yamada-ui/file-input");
|
|
33
|
+
var import_use_token = require("@yamada-ui/use-token");
|
|
34
|
+
var import_utils3 = require("@yamada-ui/utils");
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
|
|
30
37
|
// src/input.tsx
|
|
31
38
|
var import_core = require("@yamada-ui/core");
|
|
32
39
|
var import_form_control = require("@yamada-ui/form-control");
|
|
@@ -49,67 +56,11 @@ var Input = (0, import_core.forwardRef)((props, ref) => {
|
|
|
49
56
|
);
|
|
50
57
|
});
|
|
51
58
|
|
|
52
|
-
// src/input-
|
|
59
|
+
// src/input-addon.tsx
|
|
53
60
|
var import_core2 = require("@yamada-ui/core");
|
|
54
|
-
var import_file_input = require("@yamada-ui/file-input");
|
|
55
|
-
var import_use_token = require("@yamada-ui/use-token");
|
|
56
61
|
var import_utils2 = require("@yamada-ui/utils");
|
|
57
|
-
var import_react = require("react");
|
|
58
62
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
59
|
-
var
|
|
60
|
-
name: "InputGroupContext",
|
|
61
|
-
errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in "<InputGroup />" `
|
|
62
|
-
});
|
|
63
|
-
var InputGroup = (0, import_core2.forwardRef)((props, ref) => {
|
|
64
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
65
|
-
const [styles] = (0, import_core2.useMultiComponentStyle)("Input", props);
|
|
66
|
-
const { className, children, ...rest } = (0, import_core2.omitThemeProps)(props);
|
|
67
|
-
const css = {
|
|
68
|
-
width: "100%",
|
|
69
|
-
display: "flex",
|
|
70
|
-
position: "relative"
|
|
71
|
-
};
|
|
72
|
-
const groupProps = {};
|
|
73
|
-
const minHeight = (_g = (_e = (0, import_use_token.useToken)("sizes", (_c = (_a = styles.field) == null ? void 0 : _a.minHeight) != null ? _c : (_b = styles.field) == null ? void 0 : _b.minH)) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH;
|
|
74
|
-
const height = (_n = (_l = (0, import_use_token.useToken)("sizes", (_j = (_h = styles.field) == null ? void 0 : _h.height) != null ? _j : (_i = styles.field) == null ? void 0 : _i.h)) != null ? _l : (_k = styles.field) == null ? void 0 : _k.height) != null ? _n : (_m = styles.field) == null ? void 0 : _m.h;
|
|
75
|
-
const validChildren = (0, import_utils2.getValidChildren)(children);
|
|
76
|
-
validChildren.forEach((child) => {
|
|
77
|
-
if ((minHeight || height) && child.type === InputLeftElement)
|
|
78
|
-
groupProps.paddingStart = height != null ? height : minHeight;
|
|
79
|
-
if ((minHeight || height) && child.type === InputRightElement)
|
|
80
|
-
groupProps.paddingEnd = height != null ? height : minHeight;
|
|
81
|
-
if (child.type === InputLeftAddon)
|
|
82
|
-
groupProps.roundedLeft = 0;
|
|
83
|
-
if (child.type === InputRightAddon)
|
|
84
|
-
groupProps.roundedRight = 0;
|
|
85
|
-
});
|
|
86
|
-
const cloneChildren = validChildren.map((child) => {
|
|
87
|
-
var _a2, _b2;
|
|
88
|
-
const childProps = (0, import_utils2.filterUndefined)({
|
|
89
|
-
size: ((_a2 = child.props) == null ? void 0 : _a2.size) || props.size,
|
|
90
|
-
variant: ((_b2 = child.props) == null ? void 0 : _b2.variant) || props.variant,
|
|
91
|
-
...child.props
|
|
92
|
-
});
|
|
93
|
-
return child.type !== Input && child.type !== import_file_input.FileInput ? (0, import_react.cloneElement)(child, childProps) : (0, import_react.cloneElement)(child, Object.assign(childProps, groupProps));
|
|
94
|
-
});
|
|
95
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(InputGroupProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
96
|
-
import_core2.ui.div,
|
|
97
|
-
{
|
|
98
|
-
ref,
|
|
99
|
-
className: (0, import_utils2.cx)("ui-input-group", className),
|
|
100
|
-
role: "group",
|
|
101
|
-
__css: css,
|
|
102
|
-
...rest,
|
|
103
|
-
children: cloneChildren
|
|
104
|
-
}
|
|
105
|
-
) });
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// src/input-addon.tsx
|
|
109
|
-
var import_core3 = require("@yamada-ui/core");
|
|
110
|
-
var import_utils3 = require("@yamada-ui/utils");
|
|
111
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
112
|
-
var InputAddon = (0, import_core3.forwardRef)(
|
|
63
|
+
var InputAddon = (0, import_core2.forwardRef)(
|
|
113
64
|
({ className, placement = "left", ...rest }, ref) => {
|
|
114
65
|
const styles = useInputGroup();
|
|
115
66
|
const placementStyles = {
|
|
@@ -133,32 +84,83 @@ var InputAddon = (0, import_core3.forwardRef)(
|
|
|
133
84
|
...styles.addon,
|
|
134
85
|
...placementStyles[placement]
|
|
135
86
|
};
|
|
136
|
-
return /* @__PURE__ */ (0,
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.div, { ref, className: (0, import_utils2.cx)("ui-input-addon", className), __css: css, ...rest });
|
|
137
88
|
}
|
|
138
89
|
);
|
|
139
|
-
var InputLeftAddon = (0,
|
|
140
|
-
return /* @__PURE__ */ (0,
|
|
90
|
+
var InputLeftAddon = (0, import_core2.forwardRef)(({ className, ...rest }, ref) => {
|
|
91
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
141
92
|
InputAddon,
|
|
142
93
|
{
|
|
143
94
|
ref,
|
|
144
|
-
className: (0,
|
|
95
|
+
className: (0, import_utils2.cx)("ui-input-addon-left", className),
|
|
145
96
|
placement: "left",
|
|
146
97
|
...rest
|
|
147
98
|
}
|
|
148
99
|
);
|
|
149
100
|
});
|
|
150
|
-
var InputRightAddon = (0,
|
|
151
|
-
return /* @__PURE__ */ (0,
|
|
101
|
+
var InputRightAddon = (0, import_core2.forwardRef)(({ className, ...rest }, ref) => {
|
|
102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
152
103
|
InputAddon,
|
|
153
104
|
{
|
|
154
105
|
ref,
|
|
155
|
-
className: (0,
|
|
106
|
+
className: (0, import_utils2.cx)("ui-input-addon-right", className),
|
|
156
107
|
placement: "right",
|
|
157
108
|
...rest
|
|
158
109
|
}
|
|
159
110
|
);
|
|
160
111
|
});
|
|
161
112
|
|
|
113
|
+
// src/input-group.tsx
|
|
114
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
115
|
+
var [InputGroupProvider, useInputGroup] = (0, import_utils3.createContext)({
|
|
116
|
+
name: "InputGroupContext",
|
|
117
|
+
errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in "<InputGroup />" `
|
|
118
|
+
});
|
|
119
|
+
var InputGroup = (0, import_core3.forwardRef)((props, ref) => {
|
|
120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
121
|
+
const [styles] = (0, import_core3.useMultiComponentStyle)("Input", props);
|
|
122
|
+
const { className, children, ...rest } = (0, import_core3.omitThemeProps)(props);
|
|
123
|
+
const css = {
|
|
124
|
+
width: "100%",
|
|
125
|
+
display: "flex",
|
|
126
|
+
position: "relative"
|
|
127
|
+
};
|
|
128
|
+
const groupProps = {};
|
|
129
|
+
const minHeight = (_g = (_e = (0, import_use_token.useToken)("sizes", (_c = (_a = styles.field) == null ? void 0 : _a.minHeight) != null ? _c : (_b = styles.field) == null ? void 0 : _b.minH)) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH;
|
|
130
|
+
const height = (_n = (_l = (0, import_use_token.useToken)("sizes", (_j = (_h = styles.field) == null ? void 0 : _h.height) != null ? _j : (_i = styles.field) == null ? void 0 : _i.h)) != null ? _l : (_k = styles.field) == null ? void 0 : _k.height) != null ? _n : (_m = styles.field) == null ? void 0 : _m.h;
|
|
131
|
+
const validChildren = (0, import_utils3.getValidChildren)(children);
|
|
132
|
+
validChildren.forEach((child) => {
|
|
133
|
+
if ((minHeight || height) && child.type === InputLeftElement)
|
|
134
|
+
groupProps.paddingStart = height != null ? height : minHeight;
|
|
135
|
+
if ((minHeight || height) && child.type === InputRightElement)
|
|
136
|
+
groupProps.paddingEnd = height != null ? height : minHeight;
|
|
137
|
+
if (child.type === InputLeftAddon)
|
|
138
|
+
groupProps.roundedLeft = 0;
|
|
139
|
+
if (child.type === InputRightAddon)
|
|
140
|
+
groupProps.roundedRight = 0;
|
|
141
|
+
});
|
|
142
|
+
const cloneChildren = validChildren.map((child) => {
|
|
143
|
+
var _a2, _b2;
|
|
144
|
+
const childProps = (0, import_utils3.filterUndefined)({
|
|
145
|
+
size: ((_a2 = child.props) == null ? void 0 : _a2.size) || props.size,
|
|
146
|
+
variant: ((_b2 = child.props) == null ? void 0 : _b2.variant) || props.variant,
|
|
147
|
+
...child.props
|
|
148
|
+
});
|
|
149
|
+
return child.type !== Input && child.type !== import_file_input.FileInput ? (0, import_react.cloneElement)(child, childProps) : (0, import_react.cloneElement)(child, Object.assign(childProps, groupProps));
|
|
150
|
+
});
|
|
151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InputGroupProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
152
|
+
import_core3.ui.div,
|
|
153
|
+
{
|
|
154
|
+
ref,
|
|
155
|
+
className: (0, import_utils3.cx)("ui-input-group", className),
|
|
156
|
+
role: "group",
|
|
157
|
+
__css: css,
|
|
158
|
+
...rest,
|
|
159
|
+
children: cloneChildren
|
|
160
|
+
}
|
|
161
|
+
) });
|
|
162
|
+
});
|
|
163
|
+
|
|
162
164
|
// src/input-element.tsx
|
|
163
165
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
164
166
|
var InputElement = (0, import_core4.forwardRef)(
|
package/dist/input.d.ts
CHANGED
|
@@ -3,8 +3,17 @@ import { HTMLUIProps, ThemeProps, CSSUIProps } from '@yamada-ui/core';
|
|
|
3
3
|
import { FormControlOptions } from '@yamada-ui/form-control';
|
|
4
4
|
|
|
5
5
|
type InputOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* The border color when the input is focused.
|
|
8
|
+
*/
|
|
6
9
|
focusBorderColor?: CSSUIProps<'unresponsive'>['borderColor'];
|
|
10
|
+
/**
|
|
11
|
+
* The border color when the input is invalid.
|
|
12
|
+
*/
|
|
7
13
|
errorBorderColor?: CSSUIProps<'unresponsive'>['borderColor'];
|
|
14
|
+
/**
|
|
15
|
+
* The native HTML `size` attribute to be passed to the `input`
|
|
16
|
+
*/
|
|
8
17
|
htmlSize?: number;
|
|
9
18
|
};
|
|
10
19
|
type InputProps = Omit<HTMLUIProps<'input'>, 'disabled' | 'required' | 'readOnly' | 'size'> & ThemeProps<'Input'> & InputOptions & FormControlOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamada-ui/input",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Yamada UI input component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yamada",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"url": "https://github.com/hirotomoyamada/yamada-ui/issues"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@yamada-ui/core": "0.
|
|
38
|
+
"@yamada-ui/core": "0.4.0",
|
|
39
39
|
"@yamada-ui/utils": "0.1.1",
|
|
40
|
-
"@yamada-ui/file-input": "0.1
|
|
41
|
-
"@yamada-ui/form-control": "0.1
|
|
42
|
-
"@yamada-ui/use-token": "0.1.
|
|
40
|
+
"@yamada-ui/file-input": "0.2.1",
|
|
41
|
+
"@yamada-ui/form-control": "0.2.1",
|
|
42
|
+
"@yamada-ui/use-token": "0.1.13"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"react": "^18.0.0",
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"build:fast": "tsup src",
|
|
74
74
|
"clean": "rimraf dist .turbo",
|
|
75
75
|
"typecheck": "tsc --noEmit",
|
|
76
|
-
"gen:
|
|
76
|
+
"gen:docs": "tsx ../../../scripts/generate-docs"
|
|
77
77
|
}
|
|
78
78
|
}
|