@yamada-ui/input
Version:
Yamada UI input component
113 lines (110 loc) • 3.59 kB
JavaScript
"use client"
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/input-element.tsx
var input_element_exports = {};
__export(input_element_exports, {
InputLeftElement: () => InputLeftElement,
InputRightElement: () => InputRightElement
});
module.exports = __toCommonJS(input_element_exports);
var import_core = require("@yamada-ui/core");
var import_utils2 = require("@yamada-ui/utils");
// src/input-context.tsx
var import_utils = require("@yamada-ui/utils");
var [InputGroupProvider, useInputGroup] = (0, import_utils.createContext)({
name: "InputGroupContext",
errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in "<InputGroup />" `
});
// src/input-element.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var InputElement = (0, import_core.forwardRef)(
({
className,
isClick = false,
isClickable = isClick,
clickable = isClickable,
placement = "left",
...rest
}, ref) => {
const { fieldFontSize, fieldHeight, styles } = useInputGroup();
const css = {
alignItems: "center",
cursor: clickable ? "pointer" : "auto",
display: "flex",
fontSize: fieldFontSize,
h: "100%",
justifyContent: "center",
[placement === "left" ? "insetStart" : "insetEnd"]: "0",
pointerEvents: clickable ? "auto" : "none",
position: "absolute",
top: "0",
w: fieldHeight,
zIndex: "fallback(kurillin, 9)",
...styles.element
};
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_core.ui.div,
{
ref,
className: (0, import_utils2.cx)("ui-input__element", className),
__css: css,
...rest
}
);
}
);
InputElement.displayName = "InputElement";
InputElement.__ui__ = "InputElement";
var InputLeftElement = (0, import_core.forwardRef)(
({ className, ...rest }, ref) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
InputElement,
{
ref,
className: (0, import_utils2.cx)("ui-input__element--left", className),
placement: "left",
...rest
}
);
}
);
InputLeftElement.displayName = "InputLeftElement";
InputLeftElement.__ui__ = "InputLeftElement";
var InputRightElement = (0, import_core.forwardRef)(
({ className, ...rest }, ref) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
InputElement,
{
ref,
className: (0, import_utils2.cx)("ui-input__element--right", className),
placement: "right",
...rest
}
);
}
);
InputRightElement.displayName = "InputRightElement";
InputRightElement.__ui__ = "InputRightElement";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
InputLeftElement,
InputRightElement
});
//# sourceMappingURL=input-element.js.map