@yamada-ui/input 1.0.34-next-20240615233332 → 2.0.0-next-20240617154150
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-OCJVHG24.mjs → chunk-6EOSEXCT.mjs} +1 -16
- package/dist/chunk-6EOSEXCT.mjs.map +1 -0
- package/dist/index.js +0 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/input-addon.js +0 -15
- package/dist/input-addon.js.map +1 -1
- package/dist/input-addon.mjs +1 -1
- package/dist/input-element.js +0 -15
- package/dist/input-element.js.map +1 -1
- package/dist/input-element.mjs +1 -1
- package/dist/input-group.js +0 -15
- package/dist/input-group.js.map +1 -1
- package/dist/input-group.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-OCJVHG24.mjs.map +0 -1
@@ -40,11 +40,6 @@ var InputAddon = forwardRef(
|
|
40
40
|
}
|
41
41
|
};
|
42
42
|
const css = {
|
43
|
-
flex: "0 0 auto",
|
44
|
-
w: "auto",
|
45
|
-
display: "flex",
|
46
|
-
alignItems: "center",
|
47
|
-
whiteSpace: "nowrap",
|
48
43
|
...styles.addon,
|
49
44
|
...placementStyles[placement]
|
50
45
|
};
|
@@ -95,15 +90,8 @@ var InputElement = forwardRef2(
|
|
95
90
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
96
91
|
const styles = useInputGroup();
|
97
92
|
const css = {
|
98
|
-
position: "absolute",
|
99
|
-
top: "0",
|
100
93
|
[placement === "left" ? "insetStart" : "insetEnd"]: "0",
|
101
|
-
zIndex: "fallback(kurillin, 9)",
|
102
|
-
display: "flex",
|
103
|
-
alignItems: "center",
|
104
|
-
justifyContent: "center",
|
105
94
|
w: (_g = (_e = (_c = (_a = styles.field) == null ? void 0 : _a.height) != null ? _c : (_b = styles.field) == null ? void 0 : _b.h) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH,
|
106
|
-
h: "100%",
|
107
95
|
fontSize: (_h = styles.field) == null ? void 0 : _h.fontSize,
|
108
96
|
pointerEvents: isClick ? "auto" : "none",
|
109
97
|
cursor: isClick ? "pointer" : "auto",
|
@@ -158,9 +146,6 @@ var InputGroup = forwardRef3((props, ref) => {
|
|
158
146
|
const [styles] = useMultiComponentStyle("Input", props);
|
159
147
|
const { className, children, ...rest } = omitThemeProps(props);
|
160
148
|
const css = {
|
161
|
-
width: "100%",
|
162
|
-
display: "flex",
|
163
|
-
position: "relative",
|
164
149
|
...styles.container
|
165
150
|
};
|
166
151
|
const groupProps = {};
|
@@ -205,4 +190,4 @@ export {
|
|
205
190
|
InputLeftElement,
|
206
191
|
InputRightElement
|
207
192
|
};
|
208
|
-
//# sourceMappingURL=chunk-
|
193
|
+
//# sourceMappingURL=chunk-6EOSEXCT.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/input-group.tsx","../src/input-addon.tsx","../src/input-element.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport {\n createContext,\n cx,\n filterUndefined,\n getValidChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport {\n Input,\n InputRightElement,\n InputLeftElement,\n InputLeftAddon,\n InputRightAddon,\n} from \"./\"\n\nexport type InputGroupProps = HTMLUIProps<\"div\"> & ThemeProps<\"Input\">\n\ntype InputGroupContext = Record<string, CSSUIObject>\n\nconst [InputGroupProvider, useInputGroup] = createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n})\n\nexport { useInputGroup }\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useMultiComponentStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const css: CSSUIObject = {\n ...styles.container,\n }\n const groupProps: CSSUIProps = {}\n const minHeight: any =\n useToken(\"sizes\", (styles.field?.minHeight ?? styles.field?.minH) as any) ??\n styles.field?.minHeight ??\n styles.field?.minH\n const height: any =\n useToken(\"sizes\", (styles.field?.height ?? styles.field?.h) as any) ??\n styles.field?.height ??\n styles.field?.h\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if ((minHeight || height) && child.type === InputLeftElement)\n groupProps.paddingStart = height ?? minHeight\n\n if ((minHeight || height) && child.type === InputRightElement)\n groupProps.paddingEnd = height ?? minHeight\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = 0\n\n if (child.type === InputRightAddon) groupProps.roundedRight = 0\n })\n\n const cloneChildren = validChildren.map((child) => {\n const childProps = filterUndefined({\n size: child.props?.size || props.size,\n variant: child.props?.variant || props.variant,\n ...child.props,\n })\n\n return child.type !== Input && child.type !== FileInput\n ? cloneElement(child, childProps)\n : cloneElement(child, Object.assign(childProps, groupProps))\n })\n\n return (\n <InputGroupProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-input-group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {cloneChildren}\n </ui.div>\n </InputGroupProvider>\n )\n})\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputAddonOptions = {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputAddonProps = HTMLUIProps<\"div\"> & InputAddonOptions\n\nconst InputAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const placementStyles = {\n left: {\n me: \"-1px\",\n roundedRight: 0,\n borderEndColor: \"transparent\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: 0,\n borderStartColor: \"transparent\",\n },\n }\n\n const css: CSSUIObject = {\n ...styles.addon,\n ...placementStyles[placement],\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__addon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputElementOptions = {\n /**\n * If `true`, the element clickable.\n *\n * @default false\n */\n isClick?: boolean\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputElementProps = HTMLUIProps<\"div\"> & InputElementOptions\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const css: CSSUIObject = {\n [placement === \"left\" ? \"insetStart\" : \"insetEnd\"]: \"0\",\n w:\n styles.field?.height ??\n styles.field?.h ??\n styles.field?.minHeight ??\n styles.field?.minH,\n fontSize: styles.field?.fontSize,\n pointerEvents: isClick ? \"auto\" : \"none\",\n cursor: isClick ? \"pointer\" : \"auto\",\n ...styles.element,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__element\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n"],"mappings":";;;;;;AAMA;AAAA,EACE,MAAAA;AAAA,EACA,cAAAC;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA,MAAAC;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;;;ACnB7B,SAAS,IAAI,kBAAkB;AAC/B,SAAS,UAAU;AAqCb;AAvBN,IAAM,aAAa;AAAA,EACjB,CAAC,EAAE,WAAW,YAAY,QAAQ,GAAG,KAAK,GAAG,QAAQ;AACnD,UAAM,SAAS,cAAc;AAE7B,UAAM,kBAAkB;AAAA,MACtB,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,cAAc;AAAA,QACd,gBAAgB;AAAA,MAClB;AAAA,MACA,OAAO;AAAA,QACL,IAAI;AAAA,QACJ,aAAa;AAAA,QACb,kBAAkB;AAAA,MACpB;AAAA,IACF;AAEA,UAAM,MAAmB;AAAA,MACvB,GAAG,OAAO;AAAA,MACV,GAAG,gBAAgB,SAAS;AAAA,IAC9B;AAEA,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,mBAAmB,SAAS;AAAA,QAC1C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,iBAAiB;AAAA,EAC5B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW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AAW,eAAe;AAAA,EAChE,CAAC;AAED,QAAM,gBAAgB,cAAc,IAAI,CAAC,UAAU;AAvErD,QAAAC,KAAAC;AAwEI,UAAM,aAAa,gBAAgB;AAAA,MACjC,QAAMD,MAAA,MAAM,UAAN,gBAAAA,IAAa,SAAQ,MAAM;AAAA,MACjC,WAASC,MAAA,MAAM,UAAN,gBAAAA,IAAa,YAAW,MAAM;AAAA,MACvC,GAAG,MAAM;AAAA,IACX,CAAC;AAED,WAAO,MAAM,SAAS,SAAS,MAAM,SAAS,YAC1C,aAAa,OAAO,UAAU,IAC9B,aAAa,OAAO,OAAO,OAAO,YAAY,UAAU,CAAC;AAAA,EAC/D,CAAC;AAED,SACE,gBAAAC,KAAC,sBAAmB,OAAO,QACzB,0BAAAA;AAAA,IAACC,IAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,WAAWC,IAAG,kBAAkB,SAAS;AAAA,MACzC,MAAK;AAAA,MACL,OAAO;AAAA,MACN,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;","names":["ui","forwardRef","cx","ui","forwardRef","cx","jsx","forwardRef","ui","cx","jsx","forwardRef","_a","_b","jsx","ui","cx"]}
|
package/dist/index.js
CHANGED
@@ -68,9 +68,6 @@ var InputGroup = (0, import_core2.forwardRef)((props, ref) => {
|
|
68
68
|
const [styles] = (0, import_core2.useMultiComponentStyle)("Input", props);
|
69
69
|
const { className, children, ...rest } = (0, import_core2.omitThemeProps)(props);
|
70
70
|
const css = {
|
71
|
-
width: "100%",
|
72
|
-
display: "flex",
|
73
|
-
position: "relative",
|
74
71
|
...styles.container
|
75
72
|
};
|
76
73
|
const groupProps = {};
|
@@ -127,11 +124,6 @@ var InputAddon = (0, import_core3.forwardRef)(
|
|
127
124
|
}
|
128
125
|
};
|
129
126
|
const css = {
|
130
|
-
flex: "0 0 auto",
|
131
|
-
w: "auto",
|
132
|
-
display: "flex",
|
133
|
-
alignItems: "center",
|
134
|
-
whiteSpace: "nowrap",
|
135
127
|
...styles.addon,
|
136
128
|
...placementStyles[placement]
|
137
129
|
};
|
@@ -182,15 +174,8 @@ var InputElement = (0, import_core4.forwardRef)(
|
|
182
174
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
183
175
|
const styles = useInputGroup();
|
184
176
|
const css = {
|
185
|
-
position: "absolute",
|
186
|
-
top: "0",
|
187
177
|
[placement === "left" ? "insetStart" : "insetEnd"]: "0",
|
188
|
-
zIndex: "fallback(kurillin, 9)",
|
189
|
-
display: "flex",
|
190
|
-
alignItems: "center",
|
191
|
-
justifyContent: "center",
|
192
178
|
w: (_g = (_e = (_c = (_a = styles.field) == null ? void 0 : _a.height) != null ? _c : (_b = styles.field) == null ? void 0 : _b.h) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH,
|
193
|
-
h: "100%",
|
194
179
|
fontSize: (_h = styles.field) == null ? void 0 : _h.fontSize,
|
195
180
|
pointerEvents: isClick ? "auto" : "none",
|
196
181
|
cursor: isClick ? "pointer" : "auto",
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/input.tsx","../src/input-group.tsx","../src/input-addon.tsx","../src/input-element.tsx"],"sourcesContent":["export { Input } from \"./input\"\nexport type { InputProps } from \"./input\"\nexport { InputGroup } from \"./input-group\"\nexport type { InputGroupProps } from \"./input-group\"\nexport { InputLeftAddon, InputRightAddon } from \"./input-addon\"\nexport type { InputAddonProps } from \"./input-addon\"\nexport { InputLeftElement, InputRightElement } from \"./input-element\"\nexport type { InputElementProps } from \"./input-element\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n ColorModeToken,\n CSS,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n omitThemeProps,\n useMultiComponentStyle,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport { useFormControlProps } from \"@yamada-ui/form-control\"\nimport { cx } from \"@yamada-ui/utils\"\n\ntype InputOptions = {\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The native HTML `size` attribute to be passed to the `input`.\n */\n htmlSize?: number\n}\n\nexport type InputProps = Omit<\n HTMLUIProps<\"input\">,\n \"disabled\" | \"required\" | \"readOnly\" | \"size\"\n> &\n ThemeProps<\"Input\"> &\n InputOptions &\n FormControlOptions\n\n/**\n * `Input` is a component used to obtain text input from the user.\n *\n * @see Docs https://yamada-ui.com/components/forms/input\n */\nexport const Input = forwardRef<InputProps, \"input\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"Input\", props)\n let { className, htmlSize, __css, ...rest } = omitThemeProps(mergedProps)\n\n rest = useFormControlProps(rest)\n\n const css: CSSUIObject = { ...styles.field, ...__css }\n\n return (\n <ui.input\n ref={ref}\n className={cx(\"ui-input\", className)}\n size={htmlSize}\n __css={css}\n {...rest}\n />\n )\n})\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport {\n createContext,\n cx,\n filterUndefined,\n getValidChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport {\n Input,\n InputRightElement,\n InputLeftElement,\n InputLeftAddon,\n InputRightAddon,\n} from \"./\"\n\nexport type InputGroupProps = HTMLUIProps<\"div\"> & ThemeProps<\"Input\">\n\ntype InputGroupContext = Record<string, CSSUIObject>\n\nconst [InputGroupProvider, useInputGroup] = createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n})\n\nexport { useInputGroup }\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useMultiComponentStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const css: CSSUIObject = {\n width: \"100%\",\n display: \"flex\",\n position: \"relative\",\n ...styles.container,\n }\n const groupProps: CSSUIProps = {}\n const minHeight: any =\n useToken(\"sizes\", (styles.field?.minHeight ?? styles.field?.minH) as any) ??\n styles.field?.minHeight ??\n styles.field?.minH\n const height: any =\n useToken(\"sizes\", (styles.field?.height ?? styles.field?.h) as any) ??\n styles.field?.height ??\n styles.field?.h\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if ((minHeight || height) && child.type === InputLeftElement)\n groupProps.paddingStart = height ?? minHeight\n\n if ((minHeight || height) && child.type === InputRightElement)\n groupProps.paddingEnd = height ?? minHeight\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = 0\n\n if (child.type === InputRightAddon) groupProps.roundedRight = 0\n })\n\n const cloneChildren = validChildren.map((child) => {\n const childProps = filterUndefined({\n size: child.props?.size || props.size,\n variant: child.props?.variant || props.variant,\n ...child.props,\n })\n\n return child.type !== Input && child.type !== FileInput\n ? cloneElement(child, childProps)\n : cloneElement(child, Object.assign(childProps, groupProps))\n })\n\n return (\n <InputGroupProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-input-group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {cloneChildren}\n </ui.div>\n </InputGroupProvider>\n )\n})\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputAddonOptions = {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputAddonProps = HTMLUIProps<\"div\"> & InputAddonOptions\n\nconst InputAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const placementStyles = {\n left: {\n me: \"-1px\",\n roundedRight: 0,\n borderEndColor: \"transparent\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: 0,\n borderStartColor: \"transparent\",\n },\n }\n\n const css: CSSUIObject = {\n flex: \"0 0 auto\",\n w: \"auto\",\n display: \"flex\",\n alignItems: \"center\",\n whiteSpace: \"nowrap\",\n ...styles.addon,\n ...placementStyles[placement],\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__addon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputElementOptions = {\n /**\n * If `true`, the element clickable.\n *\n * @default false\n */\n isClick?: boolean\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputElementProps = HTMLUIProps<\"div\"> & InputElementOptions\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const css: CSSUIObject = {\n position: \"absolute\",\n top: \"0\",\n [placement === \"left\" ? \"insetStart\" : \"insetEnd\"]: \"0\",\n zIndex: \"fallback(kurillin, 9)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n w:\n styles.field?.height ??\n styles.field?.h ??\n styles.field?.minHeight ??\n styles.field?.minH,\n h: \"100%\",\n fontSize: styles.field?.fontSize,\n pointerEvents: isClick ? \"auto\" : \"none\",\n cursor: isClick ? \"pointer\" : \"auto\",\n ...styles.element,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__element\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOA,kBAKO;AAEP,0BAAoC;AACpC,mBAAmB;AAuCf;AATG,IAAM,YAAQ,wBAAgC,CAAC,OAAO,QAAQ;AACnE,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,SAAS,KAAK;AACnE,MAAI,EAAE,WAAW,UAAU,OAAO,GAAG,KAAK,QAAI,4BAAe,WAAW;AAExE,aAAO,yCAAoB,IAAI;AAE/B,QAAM,MAAmB,EAAE,GAAG,OAAO,OAAO,GAAG,MAAM;AAErD,SACE;AAAA,IAAC,eAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,eAAW,iBAAG,YAAY,SAAS;AAAA,MACnC,MAAM;AAAA,MACN,OAAO;AAAA,MACN,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;;;ACxDD,IAAAA,eAKO;AACP,wBAA0B;AAC1B,uBAAyB;AACz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AAA,EAC9B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,2BAA2B,SAAS;AAAA,QAClD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,wBAAoB;AAAA,EAC/B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,4BAA4B,SAAS;AAAA,QACnD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":["import_core","import_utils","import_jsx_runtime","_a","_b","import_core","import_utils","import_jsx_runtime","import_core","import_utils","import_jsx_runtime"]}
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/input.tsx","../src/input-group.tsx","../src/input-addon.tsx","../src/input-element.tsx"],"sourcesContent":["export { Input } from \"./input\"\nexport type { InputProps } from \"./input\"\nexport { InputGroup } from \"./input-group\"\nexport type { InputGroupProps } from \"./input-group\"\nexport { InputLeftAddon, InputRightAddon } from \"./input-addon\"\nexport type { InputAddonProps } from \"./input-addon\"\nexport { InputLeftElement, InputRightElement } from \"./input-element\"\nexport type { InputElementProps } from \"./input-element\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n ColorModeToken,\n CSS,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n omitThemeProps,\n useMultiComponentStyle,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport { useFormControlProps } from \"@yamada-ui/form-control\"\nimport { cx } from \"@yamada-ui/utils\"\n\ntype InputOptions = {\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The native HTML `size` attribute to be passed to the `input`.\n */\n htmlSize?: number\n}\n\nexport type InputProps = Omit<\n HTMLUIProps<\"input\">,\n \"disabled\" | \"required\" | \"readOnly\" | \"size\"\n> &\n ThemeProps<\"Input\"> &\n InputOptions &\n FormControlOptions\n\n/**\n * `Input` is a component used to obtain text input from the user.\n *\n * @see Docs https://yamada-ui.com/components/forms/input\n */\nexport const Input = forwardRef<InputProps, \"input\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"Input\", props)\n let { className, htmlSize, __css, ...rest } = omitThemeProps(mergedProps)\n\n rest = useFormControlProps(rest)\n\n const css: CSSUIObject = { ...styles.field, ...__css }\n\n return (\n <ui.input\n ref={ref}\n className={cx(\"ui-input\", className)}\n size={htmlSize}\n __css={css}\n {...rest}\n />\n )\n})\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport {\n createContext,\n cx,\n filterUndefined,\n getValidChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport {\n Input,\n InputRightElement,\n InputLeftElement,\n InputLeftAddon,\n InputRightAddon,\n} from \"./\"\n\nexport type InputGroupProps = HTMLUIProps<\"div\"> & ThemeProps<\"Input\">\n\ntype InputGroupContext = Record<string, CSSUIObject>\n\nconst [InputGroupProvider, useInputGroup] = createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n})\n\nexport { useInputGroup }\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useMultiComponentStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const css: CSSUIObject = {\n ...styles.container,\n }\n const groupProps: CSSUIProps = {}\n const minHeight: any =\n useToken(\"sizes\", (styles.field?.minHeight ?? styles.field?.minH) as any) ??\n styles.field?.minHeight ??\n styles.field?.minH\n const height: any =\n useToken(\"sizes\", (styles.field?.height ?? styles.field?.h) as any) ??\n styles.field?.height ??\n styles.field?.h\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if ((minHeight || height) && child.type === InputLeftElement)\n groupProps.paddingStart = height ?? minHeight\n\n if ((minHeight || height) && child.type === InputRightElement)\n groupProps.paddingEnd = height ?? minHeight\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = 0\n\n if (child.type === InputRightAddon) groupProps.roundedRight = 0\n })\n\n const cloneChildren = validChildren.map((child) => {\n const childProps = filterUndefined({\n size: child.props?.size || props.size,\n variant: child.props?.variant || props.variant,\n ...child.props,\n })\n\n return child.type !== Input && child.type !== FileInput\n ? cloneElement(child, childProps)\n : cloneElement(child, Object.assign(childProps, groupProps))\n })\n\n return (\n <InputGroupProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-input-group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {cloneChildren}\n </ui.div>\n </InputGroupProvider>\n )\n})\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputAddonOptions = {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputAddonProps = HTMLUIProps<\"div\"> & InputAddonOptions\n\nconst InputAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const placementStyles = {\n left: {\n me: \"-1px\",\n roundedRight: 0,\n borderEndColor: \"transparent\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: 0,\n borderStartColor: \"transparent\",\n },\n }\n\n const css: CSSUIObject = {\n ...styles.addon,\n ...placementStyles[placement],\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__addon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputElementOptions = {\n /**\n * If `true`, the element clickable.\n *\n * @default false\n */\n isClick?: boolean\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputElementProps = HTMLUIProps<\"div\"> & InputElementOptions\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const css: CSSUIObject = {\n [placement === \"left\" ? \"insetStart\" : \"insetEnd\"]: \"0\",\n w:\n styles.field?.height ??\n styles.field?.h ??\n styles.field?.minHeight ??\n styles.field?.minH,\n fontSize: styles.field?.fontSize,\n pointerEvents: isClick ? \"auto\" : \"none\",\n cursor: isClick ? \"pointer\" : \"auto\",\n ...styles.element,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__element\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOA,kBAKO;AAEP,0BAAoC;AACpC,mBAAmB;AAuCf;AATG,IAAM,YAAQ,wBAAgC,CAAC,OAAO,QAAQ;AACnE,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,SAAS,KAAK;AACnE,MAAI,EAAE,WAAW,UAAU,OAAO,GAAG,KAAK,QAAI,4BAAe,WAAW;AAExE,aAAO,yCAAoB,IAAI;AAE/B,QAAM,MAAmB,EAAE,GAAG,OAAO,OAAO,GAAG,MAAM;AAErD,SACE;AAAA,IAAC,eAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,eAAW,iBAAG,YAAY,SAAS;AAAA,MACnC,MAAM;AAAA,MACN,OAAO;AAAA,MACN,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;;;ACxDD,IAAAA,eAKO;AACP,wBAA0B;AAC1B,uBAAyB;AACzB,IAAAC,gBAKO;AACP,mBAA6B;AAiEvB,IAAAC,sBAAA;AApDN,IAAM,CAAC,oBAAoB,aAAa,QAAI,6BAAiC;AAAA,EAC3E,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAIM,IAAM,iBAAa,yBAAmC,CAAC,OAAO,QAAQ;AAxC7E;AAyCE,QAAM,CAAC,MAAM,QAAI,qCAAuB,SAAS,KAAK;AACtD,QAAM,EAAE,WAAW,UAAU,GAAG,KAAK,QAAI,6BAAe,KAAK;AAE7D,QAAM,MAAmB;AAAA,IACvB,GAAG,OAAO;AAAA,EACZ;AACA,QAAM,aAAyB,CAAC;AAChC,QAAM,a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AAQ;AAvBxE;AAwBI,UAAM,SAAS,cAAc;AAE7B,UAAM,MAAmB;AAAA,MACvB,CAAC,cAAc,SAAS,eAAe,UAAU,GAAG;AAAA,MACpD,IACE,8BAAO,UAAP,mBAAc,WAAd,aACA,YAAO,UAAP,mBAAc,MADd,aAEA,YAAO,UAAP,mBAAc,cAFd,aAGA,YAAO,UAAP,mBAAc;AAAA,MAChB,WAAU,YAAO,UAAP,mBAAc;AAAA,MACxB,eAAe,UAAU,SAAS;AAAA,MAClC,QAAQ,UAAU,YAAY;AAAA,MAC9B,GAAG,OAAO;AAAA,IACZ;AAEA,WACE;AAAA,MAAC,gBAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,qBAAqB,SAAS;AAAA,QAC5C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,uBAAmB;AAAA,EAC9B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,2BAA2B,SAAS;AAAA,QAClD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,wBAAoB;AAAA,EAC/B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,4BAA4B,SAAS;AAAA,QACnD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":["import_core","import_utils","import_jsx_runtime","_a","_b","import_core","import_utils","import_jsx_runtime","import_core","import_utils","import_jsx_runtime"]}
|
package/dist/index.mjs
CHANGED
package/dist/input-addon.js
CHANGED
@@ -66,15 +66,8 @@ var InputElement = (0, import_core2.forwardRef)(
|
|
66
66
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
67
67
|
const styles = useInputGroup();
|
68
68
|
const css = {
|
69
|
-
position: "absolute",
|
70
|
-
top: "0",
|
71
69
|
[placement === "left" ? "insetStart" : "insetEnd"]: "0",
|
72
|
-
zIndex: "fallback(kurillin, 9)",
|
73
|
-
display: "flex",
|
74
|
-
alignItems: "center",
|
75
|
-
justifyContent: "center",
|
76
70
|
w: (_g = (_e = (_c = (_a = styles.field) == null ? void 0 : _a.height) != null ? _c : (_b = styles.field) == null ? void 0 : _b.h) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH,
|
77
|
-
h: "100%",
|
78
71
|
fontSize: (_h = styles.field) == null ? void 0 : _h.fontSize,
|
79
72
|
pointerEvents: isClick ? "auto" : "none",
|
80
73
|
cursor: isClick ? "pointer" : "auto",
|
@@ -129,9 +122,6 @@ var InputGroup = (0, import_core3.forwardRef)((props, ref) => {
|
|
129
122
|
const [styles] = (0, import_core3.useMultiComponentStyle)("Input", props);
|
130
123
|
const { className, children, ...rest } = (0, import_core3.omitThemeProps)(props);
|
131
124
|
const css = {
|
132
|
-
width: "100%",
|
133
|
-
display: "flex",
|
134
|
-
position: "relative",
|
135
125
|
...styles.container
|
136
126
|
};
|
137
127
|
const groupProps = {};
|
@@ -186,11 +176,6 @@ var InputAddon = (0, import_core4.forwardRef)(
|
|
186
176
|
}
|
187
177
|
};
|
188
178
|
const css = {
|
189
|
-
flex: "0 0 auto",
|
190
|
-
w: "auto",
|
191
|
-
display: "flex",
|
192
|
-
alignItems: "center",
|
193
|
-
whiteSpace: "nowrap",
|
194
179
|
...styles.addon,
|
195
180
|
...placementStyles[placement]
|
196
181
|
};
|
package/dist/input-addon.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/input-addon.tsx","../src/input-group.tsx","../src/input.tsx","../src/input-element.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputAddonOptions = {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputAddonProps = HTMLUIProps<\"div\"> & InputAddonOptions\n\nconst InputAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const placementStyles = {\n left: {\n me: \"-1px\",\n roundedRight: 0,\n borderEndColor: \"transparent\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: 0,\n borderStartColor: \"transparent\",\n },\n }\n\n const css: CSSUIObject = {\n flex: \"0 0 auto\",\n w: \"auto\",\n display: \"flex\",\n alignItems: \"center\",\n whiteSpace: \"nowrap\",\n ...styles.addon,\n ...placementStyles[placement],\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__addon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport {\n createContext,\n cx,\n filterUndefined,\n getValidChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport {\n Input,\n InputRightElement,\n InputLeftElement,\n InputLeftAddon,\n InputRightAddon,\n} from \"./\"\n\nexport type InputGroupProps = HTMLUIProps<\"div\"> & ThemeProps<\"Input\">\n\ntype InputGroupContext = Record<string, CSSUIObject>\n\nconst [InputGroupProvider, useInputGroup] = createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n})\n\nexport { useInputGroup }\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useMultiComponentStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const css: CSSUIObject = {\n width: \"100%\",\n display: \"flex\",\n position: \"relative\",\n ...styles.container,\n }\n const groupProps: CSSUIProps = {}\n const minHeight: any =\n useToken(\"sizes\", (styles.field?.minHeight ?? styles.field?.minH) as any) ??\n styles.field?.minHeight ??\n styles.field?.minH\n const height: any =\n useToken(\"sizes\", (styles.field?.height ?? styles.field?.h) as any) ??\n styles.field?.height ??\n styles.field?.h\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if ((minHeight || height) && child.type === InputLeftElement)\n groupProps.paddingStart = height ?? minHeight\n\n if ((minHeight || height) && child.type === InputRightElement)\n groupProps.paddingEnd = height ?? minHeight\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = 0\n\n if (child.type === InputRightAddon) groupProps.roundedRight = 0\n })\n\n const cloneChildren = validChildren.map((child) => {\n const childProps = filterUndefined({\n size: child.props?.size || props.size,\n variant: child.props?.variant || props.variant,\n ...child.props,\n })\n\n return child.type !== Input && child.type !== FileInput\n ? cloneElement(child, childProps)\n : cloneElement(child, Object.assign(childProps, groupProps))\n })\n\n return (\n <InputGroupProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-input-group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {cloneChildren}\n </ui.div>\n </InputGroupProvider>\n )\n})\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n ColorModeToken,\n CSS,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n omitThemeProps,\n useMultiComponentStyle,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport { useFormControlProps } from \"@yamada-ui/form-control\"\nimport { cx } from \"@yamada-ui/utils\"\n\ntype InputOptions = {\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The native HTML `size` attribute to be passed to the `input`.\n */\n htmlSize?: number\n}\n\nexport type InputProps = Omit<\n HTMLUIProps<\"input\">,\n \"disabled\" | \"required\" | \"readOnly\" | \"size\"\n> &\n ThemeProps<\"Input\"> &\n InputOptions &\n FormControlOptions\n\n/**\n * `Input` is a component used to obtain text input from the user.\n *\n * @see Docs https://yamada-ui.com/components/forms/input\n */\nexport const Input = forwardRef<InputProps, \"input\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"Input\", props)\n let { className, htmlSize, __css, ...rest } = omitThemeProps(mergedProps)\n\n rest = useFormControlProps(rest)\n\n const css: CSSUIObject = { ...styles.field, ...__css }\n\n return (\n <ui.input\n ref={ref}\n className={cx(\"ui-input\", className)}\n size={htmlSize}\n __css={css}\n {...rest}\n />\n )\n})\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputElementOptions = {\n /**\n * If `true`, the element clickable.\n *\n * @default false\n */\n isClick?: boolean\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputElementProps = HTMLUIProps<\"div\"> & InputElementOptions\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const css: CSSUIObject = {\n position: \"absolute\",\n top: \"0\",\n [placement === \"left\" ? \"insetStart\" : \"insetEnd\"]: \"0\",\n zIndex: \"fallback(kurillin, 9)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n w:\n styles.field?.height ??\n styles.field?.h ??\n styles.field?.minHeight ??\n styles.field?.minH,\n h: \"100%\",\n fontSize: styles.field?.fontSize,\n pointerEvents: isClick ? \"auto\" : \"none\",\n cursor: isClick ? \"pointer\" : \"auto\",\n ...styles.element,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__element\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA+B;AAC/B,IAAAC,gBAAmB;;;ACInB,IAAAC,eAKO;AACP,wBAA0B;AAC1B,uBAAyB;AACzB,IAAAC,gBAKO;AACP,mBAA6B;;;ACb7B,kBAKO;AAEP,0BAAoC;AACpC,mBAAmB;AAuCf;AATG,IAAM,YAAQ,wBAAgC,CAAC,OAAO,QAAQ;AACnE,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,SAAS,KAAK;AACnE,MAAI,EAAE,WAAW,UAAU,OAAO,GAAG,KAAK,QAAI,4BAAe,WAAW;AAExE,aAAO,yCAAoB,IAAI;AAE/B,QAAM,MAAmB,EAAE,GAAG,OAAO,OAAO,GAAG,M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,SAAS;AAAA,QAC1C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,qBAAiB;AAAA,EAC5B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,yBAAyB,SAAS;AAAA,QAChD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,sBAAkB;AAAA,EAC7B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,0BAA0B,SAAS;AAAA,QACjD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":["import_core","import_utils","import_core","import_utils","import_core","import_utils","import_jsx_runtime","import_jsx_runtime","_a","_b","import_jsx_runtime"]}
|
1
|
+
{"version":3,"sources":["../src/input-addon.tsx","../src/input-group.tsx","../src/input.tsx","../src/input-element.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputAddonOptions = {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputAddonProps = HTMLUIProps<\"div\"> & InputAddonOptions\n\nconst InputAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const placementStyles = {\n left: {\n me: \"-1px\",\n roundedRight: 0,\n borderEndColor: \"transparent\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: 0,\n borderStartColor: \"transparent\",\n },\n }\n\n const css: CSSUIObject = {\n ...styles.addon,\n ...placementStyles[placement],\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__addon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport {\n createContext,\n cx,\n filterUndefined,\n getValidChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport {\n Input,\n InputRightElement,\n InputLeftElement,\n InputLeftAddon,\n InputRightAddon,\n} from \"./\"\n\nexport type InputGroupProps = HTMLUIProps<\"div\"> & ThemeProps<\"Input\">\n\ntype InputGroupContext = Record<string, CSSUIObject>\n\nconst [InputGroupProvider, useInputGroup] = createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n})\n\nexport { useInputGroup }\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useMultiComponentStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const css: CSSUIObject = {\n ...styles.container,\n }\n const groupProps: CSSUIProps = {}\n const minHeight: any =\n useToken(\"sizes\", (styles.field?.minHeight ?? styles.field?.minH) as any) ??\n styles.field?.minHeight ??\n styles.field?.minH\n const height: any =\n useToken(\"sizes\", (styles.field?.height ?? styles.field?.h) as any) ??\n styles.field?.height ??\n styles.field?.h\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if ((minHeight || height) && child.type === InputLeftElement)\n groupProps.paddingStart = height ?? minHeight\n\n if ((minHeight || height) && child.type === InputRightElement)\n groupProps.paddingEnd = height ?? minHeight\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = 0\n\n if (child.type === InputRightAddon) groupProps.roundedRight = 0\n })\n\n const cloneChildren = validChildren.map((child) => {\n const childProps = filterUndefined({\n size: child.props?.size || props.size,\n variant: child.props?.variant || props.variant,\n ...child.props,\n })\n\n return child.type !== Input && child.type !== FileInput\n ? cloneElement(child, childProps)\n : cloneElement(child, Object.assign(childProps, groupProps))\n })\n\n return (\n <InputGroupProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-input-group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {cloneChildren}\n </ui.div>\n </InputGroupProvider>\n )\n})\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n ColorModeToken,\n CSS,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n omitThemeProps,\n useMultiComponentStyle,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport { useFormControlProps } from \"@yamada-ui/form-control\"\nimport { cx } from \"@yamada-ui/utils\"\n\ntype InputOptions = {\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The native HTML `size` attribute to be passed to the `input`.\n */\n htmlSize?: number\n}\n\nexport type InputProps = Omit<\n HTMLUIProps<\"input\">,\n \"disabled\" | \"required\" | \"readOnly\" | \"size\"\n> &\n ThemeProps<\"Input\"> &\n InputOptions &\n FormControlOptions\n\n/**\n * `Input` is a component used to obtain text input from the user.\n *\n * @see Docs https://yamada-ui.com/components/forms/input\n */\nexport const Input = forwardRef<InputProps, \"input\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"Input\", props)\n let { className, htmlSize, __css, ...rest } = omitThemeProps(mergedProps)\n\n rest = useFormControlProps(rest)\n\n const css: CSSUIObject = { ...styles.field, ...__css }\n\n return (\n <ui.input\n ref={ref}\n className={cx(\"ui-input\", className)}\n size={htmlSize}\n __css={css}\n {...rest}\n />\n )\n})\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputElementOptions = {\n /**\n * If `true`, the element clickable.\n *\n * @default false\n */\n isClick?: boolean\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputElementProps = HTMLUIProps<\"div\"> & InputElementOptions\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const css: CSSUIObject = {\n [placement === \"left\" ? \"insetStart\" : \"insetEnd\"]: \"0\",\n w:\n styles.field?.height ??\n styles.field?.h ??\n styles.field?.minHeight ??\n styles.field?.minH,\n fontSize: styles.field?.fontSize,\n pointerEvents: isClick ? \"auto\" : \"none\",\n cursor: isClick ? \"pointer\" : \"auto\",\n ...styles.element,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__element\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={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Ac;AAAA,QACd,gBAAgB;AAAA,MAClB;AAAA,MACA,OAAO;AAAA,QACL,IAAI;AAAA,QACJ,aAAa;AAAA,QACb,kBAAkB;AAAA,MACpB;AAAA,IACF;AAEA,UAAM,MAAmB;AAAA,MACvB,GAAG,OAAO;AAAA,MACV,GAAG,gBAAgB,SAAS;AAAA,IAC9B;AAEA,WACE;AAAA,MAAC,gBAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,mBAAmB,SAAS;AAAA,QAC1C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,qBAAiB;AAAA,EAC5B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,yBAAyB,SAAS;AAAA,QAChD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,sBAAkB;AAAA,EAC7B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,0BAA0B,SAAS;AAAA,QACjD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":["import_core","import_utils","import_core","import_utils","import_core","import_utils","import_jsx_runtime","import_jsx_runtime","_a","_b","import_jsx_runtime"]}
|
package/dist/input-addon.mjs
CHANGED
package/dist/input-element.js
CHANGED
@@ -77,11 +77,6 @@ var InputAddon = (0, import_core2.forwardRef)(
|
|
77
77
|
}
|
78
78
|
};
|
79
79
|
const css = {
|
80
|
-
flex: "0 0 auto",
|
81
|
-
w: "auto",
|
82
|
-
display: "flex",
|
83
|
-
alignItems: "center",
|
84
|
-
whiteSpace: "nowrap",
|
85
80
|
...styles.addon,
|
86
81
|
...placementStyles[placement]
|
87
82
|
};
|
@@ -134,9 +129,6 @@ var InputGroup = (0, import_core3.forwardRef)((props, ref) => {
|
|
134
129
|
const [styles] = (0, import_core3.useMultiComponentStyle)("Input", props);
|
135
130
|
const { className, children, ...rest } = (0, import_core3.omitThemeProps)(props);
|
136
131
|
const css = {
|
137
|
-
width: "100%",
|
138
|
-
display: "flex",
|
139
|
-
position: "relative",
|
140
132
|
...styles.container
|
141
133
|
};
|
142
134
|
const groupProps = {};
|
@@ -180,15 +172,8 @@ var InputElement = (0, import_core4.forwardRef)(
|
|
180
172
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
181
173
|
const styles = useInputGroup();
|
182
174
|
const css = {
|
183
|
-
position: "absolute",
|
184
|
-
top: "0",
|
185
175
|
[placement === "left" ? "insetStart" : "insetEnd"]: "0",
|
186
|
-
zIndex: "fallback(kurillin, 9)",
|
187
|
-
display: "flex",
|
188
|
-
alignItems: "center",
|
189
|
-
justifyContent: "center",
|
190
176
|
w: (_g = (_e = (_c = (_a = styles.field) == null ? void 0 : _a.height) != null ? _c : (_b = styles.field) == null ? void 0 : _b.h) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH,
|
191
|
-
h: "100%",
|
192
177
|
fontSize: (_h = styles.field) == null ? void 0 : _h.fontSize,
|
193
178
|
pointerEvents: isClick ? "auto" : "none",
|
194
179
|
cursor: isClick ? "pointer" : "auto",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/input-element.tsx","../src/input-group.tsx","../src/input.tsx","../src/input-addon.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputElementOptions = {\n /**\n * If `true`, the element clickable.\n *\n * @default false\n */\n isClick?: boolean\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputElementProps = HTMLUIProps<\"div\"> & InputElementOptions\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const css: CSSUIObject = {\n position: \"absolute\",\n top: \"0\",\n [placement === \"left\" ? \"insetStart\" : \"insetEnd\"]: \"0\",\n zIndex: \"fallback(kurillin, 9)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n w:\n styles.field?.height ??\n styles.field?.h ??\n styles.field?.minHeight ??\n styles.field?.minH,\n h: \"100%\",\n fontSize: styles.field?.fontSize,\n pointerEvents: isClick ? \"auto\" : \"none\",\n cursor: isClick ? \"pointer\" : \"auto\",\n ...styles.element,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__element\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport {\n createContext,\n cx,\n filterUndefined,\n getValidChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport {\n Input,\n InputRightElement,\n InputLeftElement,\n InputLeftAddon,\n InputRightAddon,\n} from \"./\"\n\nexport type InputGroupProps = HTMLUIProps<\"div\"> & ThemeProps<\"Input\">\n\ntype InputGroupContext = Record<string, CSSUIObject>\n\nconst [InputGroupProvider, useInputGroup] = createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n})\n\nexport { useInputGroup }\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useMultiComponentStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const css: CSSUIObject = {\n width: \"100%\",\n display: \"flex\",\n position: \"relative\",\n ...styles.container,\n }\n const groupProps: CSSUIProps = {}\n const minHeight: any =\n useToken(\"sizes\", (styles.field?.minHeight ?? styles.field?.minH) as any) ??\n styles.field?.minHeight ??\n styles.field?.minH\n const height: any =\n useToken(\"sizes\", (styles.field?.height ?? styles.field?.h) as any) ??\n styles.field?.height ??\n styles.field?.h\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if ((minHeight || height) && child.type === InputLeftElement)\n groupProps.paddingStart = height ?? minHeight\n\n if ((minHeight || height) && child.type === InputRightElement)\n groupProps.paddingEnd = height ?? minHeight\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = 0\n\n if (child.type === InputRightAddon) groupProps.roundedRight = 0\n })\n\n const cloneChildren = validChildren.map((child) => {\n const childProps = filterUndefined({\n size: child.props?.size || props.size,\n variant: child.props?.variant || props.variant,\n ...child.props,\n })\n\n return child.type !== Input && child.type !== FileInput\n ? cloneElement(child, childProps)\n : cloneElement(child, Object.assign(childProps, groupProps))\n })\n\n return (\n <InputGroupProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-input-group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {cloneChildren}\n </ui.div>\n </InputGroupProvider>\n )\n})\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n ColorModeToken,\n CSS,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n omitThemeProps,\n useMultiComponentStyle,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport { useFormControlProps } from \"@yamada-ui/form-control\"\nimport { cx } from \"@yamada-ui/utils\"\n\ntype InputOptions = {\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The native HTML `size` attribute to be passed to the `input`.\n */\n htmlSize?: number\n}\n\nexport type InputProps = Omit<\n HTMLUIProps<\"input\">,\n \"disabled\" | \"required\" | \"readOnly\" | \"size\"\n> &\n ThemeProps<\"Input\"> &\n InputOptions &\n FormControlOptions\n\n/**\n * `Input` is a component used to obtain text input from the user.\n *\n * @see Docs https://yamada-ui.com/components/forms/input\n */\nexport const Input = forwardRef<InputProps, \"input\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"Input\", props)\n let { className, htmlSize, __css, ...rest } = omitThemeProps(mergedProps)\n\n rest = useFormControlProps(rest)\n\n const css: CSSUIObject = { ...styles.field, ...__css }\n\n return (\n <ui.input\n ref={ref}\n className={cx(\"ui-input\", className)}\n size={htmlSize}\n __css={css}\n {...rest}\n />\n )\n})\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputAddonOptions = {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputAddonProps = HTMLUIProps<\"div\"> & InputAddonOptions\n\nconst InputAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const placementStyles = {\n left: {\n me: \"-1px\",\n roundedRight: 0,\n borderEndColor: \"transparent\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: 0,\n borderStartColor: \"transparent\",\n },\n }\n\n const css: CSSUIObject = {\n flex: \"0 0 auto\",\n w: \"auto\",\n display: \"flex\",\n alignItems: \"center\",\n whiteSpace: \"nowrap\",\n ...styles.addon,\n ...placementStyles[placement],\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__addon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA+B;AAC/B,IAAAC,gBAAmB;;;ACInB,IAAAC,eAKO;AACP,wBAA0B;AAC1B,uBAAyB;AACzB,IAAAC,gBAKO;AACP,mBAA6B;;;ACb7B,kBAKO;AAEP,0BAAoC;AACpC,mBAAmB;AAuCf;AATG,IAAM,YAAQ,wBAAgC,CAAC,OAAO,QAAQ;AACnE,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,SAAS,KAAK;AACnE,MAAI,EAAE,WAAW,UAAU,OAAO,GAAG,KAAK,QAAI,4BAAe,WAAW;AAExE,aAAO,yCAAoB,IAAI;AAE/B,QAAM,MAAmB,EAAE,GAAG,OAAO,OAAO,GAAG,MAAM;AAErD,SACE;AAAA,IAAC,eAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,eAAW,iBAAG,YAAY,SAAS;AAAA,MACnC,MAAM;AAAA,MACN,OAAO;AAAA,MACN,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;;;A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;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,2BAA2B,SAAS;AAAA,QAClD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,wBAAoB;AAAA,EAC/B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,4BAA4B,SAAS;AAAA,QACnD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":["import_core","import_utils","import_core","import_utils","import_core","import_utils","import_jsx_runtime","import_jsx_runtime","_a","_b","import_jsx_runtime"]}
|
1
|
+
{"version":3,"sources":["../src/input-element.tsx","../src/input-group.tsx","../src/input.tsx","../src/input-addon.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputElementOptions = {\n /**\n * If `true`, the element clickable.\n *\n * @default false\n */\n isClick?: boolean\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputElementProps = HTMLUIProps<\"div\"> & InputElementOptions\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const css: CSSUIObject = {\n [placement === \"left\" ? \"insetStart\" : \"insetEnd\"]: \"0\",\n w:\n styles.field?.height ??\n styles.field?.h ??\n styles.field?.minHeight ??\n styles.field?.minH,\n fontSize: styles.field?.fontSize,\n pointerEvents: isClick ? \"auto\" : \"none\",\n cursor: isClick ? \"pointer\" : \"auto\",\n ...styles.element,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__element\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport {\n createContext,\n cx,\n filterUndefined,\n getValidChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport {\n Input,\n InputRightElement,\n InputLeftElement,\n InputLeftAddon,\n InputRightAddon,\n} from \"./\"\n\nexport type InputGroupProps = HTMLUIProps<\"div\"> & ThemeProps<\"Input\">\n\ntype InputGroupContext = Record<string, CSSUIObject>\n\nconst [InputGroupProvider, useInputGroup] = createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n})\n\nexport { useInputGroup }\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useMultiComponentStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const css: CSSUIObject = {\n ...styles.container,\n }\n const groupProps: CSSUIProps = {}\n const minHeight: any =\n useToken(\"sizes\", (styles.field?.minHeight ?? styles.field?.minH) as any) ??\n styles.field?.minHeight ??\n styles.field?.minH\n const height: any =\n useToken(\"sizes\", (styles.field?.height ?? styles.field?.h) as any) ??\n styles.field?.height ??\n styles.field?.h\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if ((minHeight || height) && child.type === InputLeftElement)\n groupProps.paddingStart = height ?? minHeight\n\n if ((minHeight || height) && child.type === InputRightElement)\n groupProps.paddingEnd = height ?? minHeight\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = 0\n\n if (child.type === InputRightAddon) groupProps.roundedRight = 0\n })\n\n const cloneChildren = validChildren.map((child) => {\n const childProps = filterUndefined({\n size: child.props?.size || props.size,\n variant: child.props?.variant || props.variant,\n ...child.props,\n })\n\n return child.type !== Input && child.type !== FileInput\n ? cloneElement(child, childProps)\n : cloneElement(child, Object.assign(childProps, groupProps))\n })\n\n return (\n <InputGroupProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-input-group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {cloneChildren}\n </ui.div>\n </InputGroupProvider>\n )\n})\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n ColorModeToken,\n CSS,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n omitThemeProps,\n useMultiComponentStyle,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport { useFormControlProps } from \"@yamada-ui/form-control\"\nimport { cx } from \"@yamada-ui/utils\"\n\ntype InputOptions = {\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The native HTML `size` attribute to be passed to the `input`.\n */\n htmlSize?: number\n}\n\nexport type InputProps = Omit<\n HTMLUIProps<\"input\">,\n \"disabled\" | \"required\" | \"readOnly\" | \"size\"\n> &\n ThemeProps<\"Input\"> &\n InputOptions &\n FormControlOptions\n\n/**\n * `Input` is a component used to obtain text input from the user.\n *\n * @see Docs https://yamada-ui.com/components/forms/input\n */\nexport const Input = forwardRef<InputProps, \"input\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"Input\", props)\n let { className, htmlSize, __css, ...rest } = omitThemeProps(mergedProps)\n\n rest = useFormControlProps(rest)\n\n const css: CSSUIObject = { ...styles.field, ...__css }\n\n return (\n <ui.input\n ref={ref}\n className={cx(\"ui-input\", className)}\n size={htmlSize}\n __css={css}\n {...rest}\n />\n )\n})\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputAddonOptions = {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputAddonProps = HTMLUIProps<\"div\"> & InputAddonOptions\n\nconst InputAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const placementStyles = {\n left: {\n me: \"-1px\",\n roundedRight: 0,\n borderEndColor: \"transparent\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: 0,\n borderStartColor: \"transparent\",\n },\n }\n\n const css: CSSUIObject = {\n ...styles.addon,\n ...placementStyles[placement],\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__addon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA+B;AAC/B,IAAAC,gBAAmB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;AAAA,MAC9B,GAAG,OAAO;AAAA,IACZ;AAEA,WACE;AAAA,MAAC,gBAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,qBAAqB,SAAS;AAAA,QAC5C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,uBAAmB;AAAA,EAC9B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,2BAA2B,SAAS;AAAA,QAClD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,wBAAoB;AAAA,EAC/B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,4BAA4B,SAAS;AAAA,QACnD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":["import_core","import_utils","import_core","import_utils","import_core","import_utils","import_jsx_runtime","import_jsx_runtime","_a","_b","import_jsx_runtime"]}
|
package/dist/input-element.mjs
CHANGED
package/dist/input-group.js
CHANGED
@@ -73,11 +73,6 @@ var InputAddon = (0, import_core2.forwardRef)(
|
|
73
73
|
}
|
74
74
|
};
|
75
75
|
const css = {
|
76
|
-
flex: "0 0 auto",
|
77
|
-
w: "auto",
|
78
|
-
display: "flex",
|
79
|
-
alignItems: "center",
|
80
|
-
whiteSpace: "nowrap",
|
81
76
|
...styles.addon,
|
82
77
|
...placementStyles[placement]
|
83
78
|
};
|
@@ -128,15 +123,8 @@ var InputElement = (0, import_core3.forwardRef)(
|
|
128
123
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
129
124
|
const styles = useInputGroup();
|
130
125
|
const css = {
|
131
|
-
position: "absolute",
|
132
|
-
top: "0",
|
133
126
|
[placement === "left" ? "insetStart" : "insetEnd"]: "0",
|
134
|
-
zIndex: "fallback(kurillin, 9)",
|
135
|
-
display: "flex",
|
136
|
-
alignItems: "center",
|
137
|
-
justifyContent: "center",
|
138
127
|
w: (_g = (_e = (_c = (_a = styles.field) == null ? void 0 : _a.height) != null ? _c : (_b = styles.field) == null ? void 0 : _b.h) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH,
|
139
|
-
h: "100%",
|
140
128
|
fontSize: (_h = styles.field) == null ? void 0 : _h.fontSize,
|
141
129
|
pointerEvents: isClick ? "auto" : "none",
|
142
130
|
cursor: isClick ? "pointer" : "auto",
|
@@ -191,9 +179,6 @@ var InputGroup = (0, import_core4.forwardRef)((props, ref) => {
|
|
191
179
|
const [styles] = (0, import_core4.useMultiComponentStyle)("Input", props);
|
192
180
|
const { className, children, ...rest } = (0, import_core4.omitThemeProps)(props);
|
193
181
|
const css = {
|
194
|
-
width: "100%",
|
195
|
-
display: "flex",
|
196
|
-
position: "relative",
|
197
182
|
...styles.container
|
198
183
|
};
|
199
184
|
const groupProps = {};
|
package/dist/input-group.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/input-group.tsx","../src/input.tsx","../src/input-addon.tsx","../src/input-element.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport {\n createContext,\n cx,\n filterUndefined,\n getValidChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport {\n Input,\n InputRightElement,\n InputLeftElement,\n InputLeftAddon,\n InputRightAddon,\n} from \"./\"\n\nexport type InputGroupProps = HTMLUIProps<\"div\"> & ThemeProps<\"Input\">\n\ntype InputGroupContext = Record<string, CSSUIObject>\n\nconst [InputGroupProvider, useInputGroup] = createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n})\n\nexport { useInputGroup }\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useMultiComponentStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const css: CSSUIObject = {\n width: \"100%\",\n display: \"flex\",\n position: \"relative\",\n ...styles.container,\n }\n const groupProps: CSSUIProps = {}\n const minHeight: any =\n useToken(\"sizes\", (styles.field?.minHeight ?? styles.field?.minH) as any) ??\n styles.field?.minHeight ??\n styles.field?.minH\n const height: any =\n useToken(\"sizes\", (styles.field?.height ?? styles.field?.h) as any) ??\n styles.field?.height ??\n styles.field?.h\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if ((minHeight || height) && child.type === InputLeftElement)\n groupProps.paddingStart = height ?? minHeight\n\n if ((minHeight || height) && child.type === InputRightElement)\n groupProps.paddingEnd = height ?? minHeight\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = 0\n\n if (child.type === InputRightAddon) groupProps.roundedRight = 0\n })\n\n const cloneChildren = validChildren.map((child) => {\n const childProps = filterUndefined({\n size: child.props?.size || props.size,\n variant: child.props?.variant || props.variant,\n ...child.props,\n })\n\n return child.type !== Input && child.type !== FileInput\n ? cloneElement(child, childProps)\n : cloneElement(child, Object.assign(childProps, groupProps))\n })\n\n return (\n <InputGroupProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-input-group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {cloneChildren}\n </ui.div>\n </InputGroupProvider>\n )\n})\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n ColorModeToken,\n CSS,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n omitThemeProps,\n useMultiComponentStyle,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport { useFormControlProps } from \"@yamada-ui/form-control\"\nimport { cx } from \"@yamada-ui/utils\"\n\ntype InputOptions = {\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The native HTML `size` attribute to be passed to the `input`.\n */\n htmlSize?: number\n}\n\nexport type InputProps = Omit<\n HTMLUIProps<\"input\">,\n \"disabled\" | \"required\" | \"readOnly\" | \"size\"\n> &\n ThemeProps<\"Input\"> &\n InputOptions &\n FormControlOptions\n\n/**\n * `Input` is a component used to obtain text input from the user.\n *\n * @see Docs https://yamada-ui.com/components/forms/input\n */\nexport const Input = forwardRef<InputProps, \"input\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"Input\", props)\n let { className, htmlSize, __css, ...rest } = omitThemeProps(mergedProps)\n\n rest = useFormControlProps(rest)\n\n const css: CSSUIObject = { ...styles.field, ...__css }\n\n return (\n <ui.input\n ref={ref}\n className={cx(\"ui-input\", className)}\n size={htmlSize}\n __css={css}\n {...rest}\n />\n )\n})\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputAddonOptions = {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputAddonProps = HTMLUIProps<\"div\"> & InputAddonOptions\n\nconst InputAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const placementStyles = {\n left: {\n me: \"-1px\",\n roundedRight: 0,\n borderEndColor: \"transparent\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: 0,\n borderStartColor: \"transparent\",\n },\n }\n\n const css: CSSUIObject = {\n flex: \"0 0 auto\",\n w: \"auto\",\n display: \"flex\",\n alignItems: \"center\",\n whiteSpace: \"nowrap\",\n ...styles.addon,\n ...placementStyles[placement],\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__addon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputElementOptions = {\n /**\n * If `true`, the element clickable.\n *\n * @default false\n */\n isClick?: boolean\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputElementProps = HTMLUIProps<\"div\"> & InputElementOptions\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const css: CSSUIObject = {\n position: \"absolute\",\n top: \"0\",\n [placement === \"left\" ? \"insetStart\" : \"insetEnd\"]: \"0\",\n zIndex: \"fallback(kurillin, 9)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n w:\n styles.field?.height ??\n styles.field?.h ??\n styles.field?.minHeight ??\n styles.field?.minH,\n h: \"100%\",\n fontSize: styles.field?.fontSize,\n pointerEvents: isClick ? \"auto\" : \"none\",\n cursor: isClick ? \"pointer\" : \"auto\",\n ...styles.element,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__element\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,IAAAA,eAKO;AACP,wBAA0B;AAC1B,uBAAyB;AACzB,IAAAC,gBAKO;AACP,mBAA6B;;;ACb7B,kBAKO;AAEP,0BAAoC;AACpC,mBAAmB;AAuCf;AATG,IAAM,YAAQ,wBAAgC,CAAC,OAAO,QAAQ;AACnE,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,SAAS,KAAK;AACnE,MAAI,EAAE,WAAW,UAAU,OAAO,GAAG,KAAK,QAAI,4BAAe,WAAW;AAExE,aAAO,yCAAoB,IAAI;AAE/B,QAAM,MAAmB,EAAE,GAAG,OAAO,OAAO,GAAG,MAAM;AAErD,SACE;AAAA,IAAC,eAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,eAAW,iBAAG,YAAY,SAAS;AAAA,MACnC,MAAM;AAAA,MACN,OAAO;AAAA,MACN,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;;;AC7DD,IAAAC,eAA+B;AAC/B,IAAAC,gBAAmB;AA0Cb,IAAAC,sBAAA;AA5BN,IAAM,iBAAa;AAAA,EACjB,CAAC,EAAE,WAAW,YAAY,QAAQ,GAAG,KAAK,GAAG,QAAQ;AACnD,UAAM,SAAS,cAAc;AAE7B,UAAM,kBAAkB;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AAmB,OAAO,QACzB;AAAA,IAAC,gBAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,eAAW,kBAAG,kBAAkB,SAAS;AAAA,MACzC,MAAK;AAAA,MACL,OAAO;AAAA,MACN,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;","names":["import_core","import_utils","import_core","import_utils","import_jsx_runtime","import_core","import_utils","import_jsx_runtime","import_jsx_runtime","_a","_b"]}
|
1
|
+
{"version":3,"sources":["../src/input-group.tsx","../src/input.tsx","../src/input-addon.tsx","../src/input-element.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport {\n createContext,\n cx,\n filterUndefined,\n getValidChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport {\n Input,\n InputRightElement,\n InputLeftElement,\n InputLeftAddon,\n InputRightAddon,\n} from \"./\"\n\nexport type InputGroupProps = HTMLUIProps<\"div\"> & ThemeProps<\"Input\">\n\ntype InputGroupContext = Record<string, CSSUIObject>\n\nconst [InputGroupProvider, useInputGroup] = createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n})\n\nexport { useInputGroup }\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useMultiComponentStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const css: CSSUIObject = {\n ...styles.container,\n }\n const groupProps: CSSUIProps = {}\n const minHeight: any =\n useToken(\"sizes\", (styles.field?.minHeight ?? styles.field?.minH) as any) ??\n styles.field?.minHeight ??\n styles.field?.minH\n const height: any =\n useToken(\"sizes\", (styles.field?.height ?? styles.field?.h) as any) ??\n styles.field?.height ??\n styles.field?.h\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if ((minHeight || height) && child.type === InputLeftElement)\n groupProps.paddingStart = height ?? minHeight\n\n if ((minHeight || height) && child.type === InputRightElement)\n groupProps.paddingEnd = height ?? minHeight\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = 0\n\n if (child.type === InputRightAddon) groupProps.roundedRight = 0\n })\n\n const cloneChildren = validChildren.map((child) => {\n const childProps = filterUndefined({\n size: child.props?.size || props.size,\n variant: child.props?.variant || props.variant,\n ...child.props,\n })\n\n return child.type !== Input && child.type !== FileInput\n ? cloneElement(child, childProps)\n : cloneElement(child, Object.assign(childProps, groupProps))\n })\n\n return (\n <InputGroupProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-input-group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {cloneChildren}\n </ui.div>\n </InputGroupProvider>\n )\n})\n","import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n ColorModeToken,\n CSS,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n omitThemeProps,\n useMultiComponentStyle,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport { useFormControlProps } from \"@yamada-ui/form-control\"\nimport { cx } from \"@yamada-ui/utils\"\n\ntype InputOptions = {\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The native HTML `size` attribute to be passed to the `input`.\n */\n htmlSize?: number\n}\n\nexport type InputProps = Omit<\n HTMLUIProps<\"input\">,\n \"disabled\" | \"required\" | \"readOnly\" | \"size\"\n> &\n ThemeProps<\"Input\"> &\n InputOptions &\n FormControlOptions\n\n/**\n * `Input` is a component used to obtain text input from the user.\n *\n * @see Docs https://yamada-ui.com/components/forms/input\n */\nexport const Input = forwardRef<InputProps, \"input\">((props, ref) => {\n const [styles, mergedProps] = useMultiComponentStyle(\"Input\", props)\n let { className, htmlSize, __css, ...rest } = omitThemeProps(mergedProps)\n\n rest = useFormControlProps(rest)\n\n const css: CSSUIObject = { ...styles.field, ...__css }\n\n return (\n <ui.input\n ref={ref}\n className={cx(\"ui-input\", className)}\n size={htmlSize}\n __css={css}\n {...rest}\n />\n )\n})\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputAddonOptions = {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputAddonProps = HTMLUIProps<\"div\"> & InputAddonOptions\n\nconst InputAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const placementStyles = {\n left: {\n me: \"-1px\",\n roundedRight: 0,\n borderEndColor: \"transparent\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: 0,\n borderStartColor: \"transparent\",\n },\n }\n\n const css: CSSUIObject = {\n ...styles.addon,\n ...placementStyles[placement],\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__addon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputElementOptions = {\n /**\n * If `true`, the element clickable.\n *\n * @default false\n */\n isClick?: boolean\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputElementProps = HTMLUIProps<\"div\"> & InputElementOptions\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const css: CSSUIObject = {\n [placement === \"left\" ? \"insetStart\" : \"insetEnd\"]: \"0\",\n w:\n styles.field?.height ??\n styles.field?.h ??\n styles.field?.minHeight ??\n styles.field?.minH,\n fontSize: styles.field?.fontSize,\n pointerEvents: isClick ? \"auto\" : \"none\",\n cursor: isClick ? \"pointer\" : \"auto\",\n ...styles.element,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__element\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,IAAAA,eAKO;AACP,wBAA0B;AAC1B,uBAAyB;AACzB,IAAAC,gBAKO;AACP,mBAA6B;;;ACb7B,kBAKO;AAEP,0BAAoC;AACpC,mBAAmB;AAuCf;AATG,IAAM,YAAQ,wBAAgC,CAAC,OAAO,QAAQ;AACnE,QAAM,CAA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MAAM,UAAN,gBAAAA,IAAa,SAAQ,MAAM;AAAA,MACjC,WAASC,MAAA,MAAM,UAAN,gBAAAA,IAAa,YAAW,MAAM;AAAA,MACvC,GAAG,MAAM;AAAA,IACX,CAAC;AAED,WAAO,MAAM,SAAS,SAAS,MAAM,SAAS,kCAC1C,2BAAa,OAAO,UAAU,QAC9B,2BAAa,OAAO,OAAO,OAAO,YAAY,UAAU,CAAC;AAAA,EAC/D,CAAC;AAED,SACE,6CAAC,sBAAmB,OAAO,QACzB;AAAA,IAAC,gBAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,eAAW,kBAAG,kBAAkB,SAAS;AAAA,MACzC,MAAK;AAAA,MACL,OAAO;AAAA,MACN,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;","names":["import_core","import_utils","import_core","import_utils","import_jsx_runtime","import_core","import_utils","import_jsx_runtime","import_jsx_runtime","_a","_b"]}
|
package/dist/input-group.mjs
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@yamada-ui/input",
|
3
|
-
"version": "
|
3
|
+
"version": "2.0.0-next-20240617154150",
|
4
4
|
"description": "Yamada UI input component",
|
5
5
|
"keywords": [
|
6
6
|
"yamada",
|
@@ -38,8 +38,8 @@
|
|
38
38
|
"dependencies": {
|
39
39
|
"@yamada-ui/core": "1.7.2",
|
40
40
|
"@yamada-ui/utils": "1.2.1",
|
41
|
-
"@yamada-ui/file-input": "2.0.0-next-
|
42
|
-
"@yamada-ui/form-control": "2.0.0-next-
|
41
|
+
"@yamada-ui/file-input": "2.0.0-next-20240617154150",
|
42
|
+
"@yamada-ui/form-control": "2.0.0-next-20240617154150",
|
43
43
|
"@yamada-ui/use-token": "1.1.16"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/input-group.tsx","../src/input-addon.tsx","../src/input-element.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport {\n createContext,\n cx,\n filterUndefined,\n getValidChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport {\n Input,\n InputRightElement,\n InputLeftElement,\n InputLeftAddon,\n InputRightAddon,\n} from \"./\"\n\nexport type InputGroupProps = HTMLUIProps<\"div\"> & ThemeProps<\"Input\">\n\ntype InputGroupContext = Record<string, CSSUIObject>\n\nconst [InputGroupProvider, useInputGroup] = createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n})\n\nexport { useInputGroup }\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useMultiComponentStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const css: CSSUIObject = {\n width: \"100%\",\n display: \"flex\",\n position: \"relative\",\n ...styles.container,\n }\n const groupProps: CSSUIProps = {}\n const minHeight: any =\n useToken(\"sizes\", (styles.field?.minHeight ?? styles.field?.minH) as any) ??\n styles.field?.minHeight ??\n styles.field?.minH\n const height: any =\n useToken(\"sizes\", (styles.field?.height ?? styles.field?.h) as any) ??\n styles.field?.height ??\n styles.field?.h\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if ((minHeight || height) && child.type === InputLeftElement)\n groupProps.paddingStart = height ?? minHeight\n\n if ((minHeight || height) && child.type === InputRightElement)\n groupProps.paddingEnd = height ?? minHeight\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = 0\n\n if (child.type === InputRightAddon) groupProps.roundedRight = 0\n })\n\n const cloneChildren = validChildren.map((child) => {\n const childProps = filterUndefined({\n size: child.props?.size || props.size,\n variant: child.props?.variant || props.variant,\n ...child.props,\n })\n\n return child.type !== Input && child.type !== FileInput\n ? cloneElement(child, childProps)\n : cloneElement(child, Object.assign(childProps, groupProps))\n })\n\n return (\n <InputGroupProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-input-group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {cloneChildren}\n </ui.div>\n </InputGroupProvider>\n )\n})\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputAddonOptions = {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputAddonProps = HTMLUIProps<\"div\"> & InputAddonOptions\n\nconst InputAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const placementStyles = {\n left: {\n me: \"-1px\",\n roundedRight: 0,\n borderEndColor: \"transparent\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: 0,\n borderStartColor: \"transparent\",\n },\n }\n\n const css: CSSUIObject = {\n flex: \"0 0 auto\",\n w: \"auto\",\n display: \"flex\",\n alignItems: \"center\",\n whiteSpace: \"nowrap\",\n ...styles.addon,\n ...placementStyles[placement],\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__addon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightAddon = forwardRef<InputAddonProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputAddon\n ref={ref}\n className={cx(\"ui-input__addon--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useInputGroup } from \"./input-group\"\n\ntype InputElementOptions = {\n /**\n * If `true`, the element clickable.\n *\n * @default false\n */\n isClick?: boolean\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport type InputElementProps = HTMLUIProps<\"div\"> & InputElementOptions\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const styles = useInputGroup()\n\n const css: CSSUIObject = {\n position: \"absolute\",\n top: \"0\",\n [placement === \"left\" ? \"insetStart\" : \"insetEnd\"]: \"0\",\n zIndex: \"fallback(kurillin, 9)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n w:\n styles.field?.height ??\n styles.field?.h ??\n styles.field?.minHeight ??\n styles.field?.minH,\n h: \"100%\",\n fontSize: styles.field?.fontSize,\n pointerEvents: isClick ? \"auto\" : \"none\",\n cursor: isClick ? \"pointer\" : \"auto\",\n ...styles.element,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-input__element\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport const InputLeftElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--left\", className)}\n placement=\"left\"\n {...rest}\n />\n )\n },\n)\n\nexport const InputRightElement = forwardRef<InputElementProps, \"div\">(\n ({ className, ...rest }, ref) => {\n return (\n <InputElement\n ref={ref}\n className={cx(\"ui-input__element--right\", className)}\n placement=\"right\"\n {...rest}\n />\n )\n },\n)\n"],"mappings":";;;;;;AAMA;AAAA,EACE,MAAAA;AAAA,EACA,cAAAC;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAA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