@yamada-ui/input 1.0.42-dev-20240919162215 → 1.0.42-dev-20240920025829

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,4 +11,4 @@ export {
11
11
  InputGroupProvider,
12
12
  useInputGroup
13
13
  };
14
- //# sourceMappingURL=chunk-ZNGNHH5S.mjs.map
14
+ //# sourceMappingURL=chunk-5UF5TTHV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/input-context.tsx"],"sourcesContent":["import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n styles: { [key: string]: CSSUIObject }\n fieldHeight: string | undefined\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n })\n"],"mappings":";;;AACA,SAAS,qBAAqB;AAOvB,IAAM,CAAC,oBAAoB,aAAa,IAC7C,cAAiC;AAAA,EAC/B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;","names":[]}
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import {
3
3
  useInputGroup
4
- } from "./chunk-ZNGNHH5S.mjs";
4
+ } from "./chunk-5UF5TTHV.mjs";
5
5
 
6
6
  // src/input-addon.tsx
7
7
  import { ui, forwardRef } from "@yamada-ui/core";
@@ -9,17 +9,15 @@ import { cx } from "@yamada-ui/utils";
9
9
  import { jsx } from "react/jsx-runtime";
10
10
  var InputAddon = forwardRef(
11
11
  ({ className, placement = "left", ...rest }, ref) => {
12
- const styles = useInputGroup();
12
+ const { styles } = useInputGroup();
13
13
  const placementStyles = {
14
14
  left: {
15
15
  me: "-1px",
16
- roundedRight: 0,
17
- borderEndColor: "transparent"
16
+ roundedRight: "0px !important"
18
17
  },
19
18
  right: {
20
19
  ms: "-1px",
21
- roundedLeft: 0,
22
- borderStartColor: "transparent"
20
+ roundedLeft: "0px !important"
23
21
  }
24
22
  };
25
23
  const css = {
@@ -73,4 +71,4 @@ export {
73
71
  InputLeftAddon,
74
72
  InputRightAddon
75
73
  };
76
- //# sourceMappingURL=chunk-OYJRHTQL.mjs.map
74
+ //# sourceMappingURL=chunk-OEJ5NONO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../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-context\"\n\ninterface InputAddonOptions {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport interface InputAddonProps extends HTMLUIProps, 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: \"0px !important\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: \"0px !important\",\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"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
+ } from "./chunk-5UF5TTHV.mjs";
5
5
 
6
6
  // src/input-element.tsx
7
7
  import { ui, forwardRef } from "@yamada-ui/core";
@@ -9,8 +9,8 @@ import { cx } from "@yamada-ui/utils";
9
9
  import { jsx } from "react/jsx-runtime";
10
10
  var InputElement = forwardRef(
11
11
  ({ className, isClick = false, placement = "left", ...rest }, ref) => {
12
- var _a, _b, _c, _d, _e, _f, _g, _h;
13
- const styles = useInputGroup();
12
+ var _a;
13
+ const { styles, fieldHeight } = useInputGroup();
14
14
  const css = {
15
15
  position: "absolute",
16
16
  top: "0",
@@ -19,9 +19,9 @@ var InputElement = forwardRef(
19
19
  display: "flex",
20
20
  alignItems: "center",
21
21
  justifyContent: "center",
22
- 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,
22
+ w: fieldHeight,
23
23
  h: "100%",
24
- fontSize: (_h = styles.field) == null ? void 0 : _h.fontSize,
24
+ fontSize: (_a = styles.field) == null ? void 0 : _a.fontSize,
25
25
  pointerEvents: isClick ? "auto" : "none",
26
26
  cursor: isClick ? "pointer" : "auto",
27
27
  ...styles.element
@@ -68,4 +68,4 @@ export {
68
68
  InputLeftElement,
69
69
  InputRightElement
70
70
  };
71
- //# sourceMappingURL=chunk-ITQBVWTU.mjs.map
71
+ //# sourceMappingURL=chunk-Q6WRYI3A.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../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-context\"\n\ninterface 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 interface InputElementProps extends HTMLUIProps, InputElementOptions {}\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const { styles, fieldHeight } = 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: fieldHeight,\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":";;;;;;AACA,SAAS,IAAI,kBAAkB;AAC/B,SAAS,UAAU;AAyCb;AArBN,IAAM,eAAe;AAAA,EACnB,CAAC,EAAE,WAAW,UAAU,OAAO,YAAY,QAAQ,GAAG,KAAK,GAAG,QAAQ;AAvBxE;AAwBI,UAAM,EAAE,QAAQ,YAAY,IAAI,cAAc;AAE9C,UAAM,MAAmB;AAAA,MACvB,UAAU;AAAA,MACV,KAAK;AAAA,MACL,CAAC,cAAc,SAAS,eAAe,UAAU,GAAG;AAAA,MACpD,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,GAAG;AAAA,MACH,GAAG;AAAA,MACH,WAAU,YAAO,UAAP,mBAAc;AAAA,MACxB,eAAe,UAAU,SAAS;AAAA,MAClC,QAAQ,UAAU,YAAY;AAAA,MAC9B,GAAG,OAAO;AAAA,IACZ;AAEA,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,qBAAqB,SAAS;AAAA,QAC5C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,mBAAmB;AAAA,EAC9B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,2BAA2B,SAAS;AAAA,QAClD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,oBAAoB;AAAA,EAC/B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,4BAA4B,SAAS;AAAA,QACnD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":[]}
@@ -0,0 +1,91 @@
1
+ "use client"
2
+ import {
3
+ InputLeftAddon,
4
+ InputRightAddon
5
+ } from "./chunk-OEJ5NONO.mjs";
6
+ import {
7
+ InputLeftElement,
8
+ InputRightElement
9
+ } from "./chunk-Q6WRYI3A.mjs";
10
+ import {
11
+ InputGroupProvider
12
+ } from "./chunk-5UF5TTHV.mjs";
13
+
14
+ // src/input-group.tsx
15
+ import {
16
+ ui,
17
+ forwardRef,
18
+ useComponentMultiStyle,
19
+ omitThemeProps,
20
+ useCreateVars
21
+ } from "@yamada-ui/core";
22
+ import { cx, filterUndefined, getValidChildren } from "@yamada-ui/utils";
23
+ import { cloneElement } from "react";
24
+ import { jsx } from "react/jsx-runtime";
25
+ var InputGroup = forwardRef((props, ref) => {
26
+ var _a, _b;
27
+ const [styles] = useComponentMultiStyle("Input", props);
28
+ const { className, children, ...rest } = omitThemeProps(props);
29
+ const [vars, variableProps] = useCreateVars({ ...styles.field, ...rest }, [
30
+ "minHeight",
31
+ "minH",
32
+ "height",
33
+ "h"
34
+ ]);
35
+ const minHeight = (_a = variableProps.minHeight) != null ? _a : variableProps.minH;
36
+ const height = (_b = variableProps.height) != null ? _b : variableProps.h;
37
+ const fieldHeight = minHeight != null ? minHeight : height;
38
+ const css = {
39
+ width: "100%",
40
+ display: "flex",
41
+ position: "relative",
42
+ vars,
43
+ ...styles.container
44
+ };
45
+ const groupProps = {};
46
+ const validChildren = getValidChildren(children);
47
+ validChildren.forEach((child) => {
48
+ if (fieldHeight && child.type === InputLeftElement)
49
+ groupProps.paddingStart = `${fieldHeight} !important`;
50
+ if (fieldHeight && child.type === InputRightElement)
51
+ groupProps.paddingEnd = `${fieldHeight} !important`;
52
+ if (child.type === InputLeftAddon) groupProps.roundedLeft = "0px !important";
53
+ if (child.type === InputRightAddon)
54
+ groupProps.roundedRight = "0px !important";
55
+ });
56
+ const cloneChildren = validChildren.map((child) => {
57
+ var _a2, _b2, _c, _d;
58
+ const isAddonElement = [
59
+ InputLeftAddon,
60
+ InputRightAddon,
61
+ InputLeftElement,
62
+ InputRightElement
63
+ ].some((type) => child.type === type);
64
+ if (isAddonElement) {
65
+ return child;
66
+ } else {
67
+ const childProps = filterUndefined({
68
+ size: (_b2 = (_a2 = child.props) == null ? void 0 : _a2.size) != null ? _b2 : props.size,
69
+ variant: (_d = (_c = child.props) == null ? void 0 : _c.variant) != null ? _d : props.variant,
70
+ ...child.props
71
+ });
72
+ return cloneElement(child, Object.assign(childProps, groupProps));
73
+ }
74
+ });
75
+ return /* @__PURE__ */ jsx(InputGroupProvider, { value: { styles, fieldHeight }, children: /* @__PURE__ */ jsx(
76
+ ui.div,
77
+ {
78
+ ref,
79
+ className: cx("ui-input-group", className),
80
+ role: "group",
81
+ __css: css,
82
+ ...rest,
83
+ children: cloneChildren
84
+ }
85
+ ) });
86
+ });
87
+
88
+ export {
89
+ InputGroup
90
+ };
91
+ //# sourceMappingURL=chunk-S3TRD6FG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/input-group.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useComponentMultiStyle,\n omitThemeProps,\n useCreateVars,\n} from \"@yamada-ui/core\"\nimport { cx, filterUndefined, getValidChildren } from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport { InputLeftAddon, InputRightAddon } from \"./input-addon\"\nimport { InputGroupProvider } from \"./input-context\"\nimport { InputRightElement, InputLeftElement } from \"./input-element\"\n\nexport interface InputGroupProps extends HTMLUIProps, ThemeProps<\"Input\"> {}\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useComponentMultiStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const [vars, variableProps] = useCreateVars({ ...styles.field, ...rest }, [\n \"minHeight\",\n \"minH\",\n \"height\",\n \"h\",\n ])\n const minHeight = variableProps.minHeight ?? variableProps.minH\n const height = variableProps.height ?? variableProps.h\n const fieldHeight = minHeight ?? height\n\n const css: CSSUIObject = {\n width: \"100%\",\n display: \"flex\",\n position: \"relative\",\n vars,\n ...styles.container,\n }\n\n const groupProps: CSSUIProps = {}\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if (fieldHeight && child.type === InputLeftElement)\n groupProps.paddingStart = `${fieldHeight} !important`\n\n if (fieldHeight && child.type === InputRightElement)\n groupProps.paddingEnd = `${fieldHeight} !important`\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = \"0px !important\"\n\n if (child.type === InputRightAddon)\n groupProps.roundedRight = \"0px !important\"\n })\n\n const cloneChildren = validChildren.map((child) => {\n const isAddonElement = [\n InputLeftAddon,\n InputRightAddon,\n InputLeftElement,\n InputRightElement,\n ].some((type) => child.type === type)\n\n if (isAddonElement) {\n return child\n } else {\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 cloneElement(child, Object.assign(childProps, groupProps))\n }\n })\n\n return (\n <InputGroupProvider value={{ styles, fieldHeight }}>\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"],"mappings":";;;;;;;;;;;;;;AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,IAAI,iBAAiB,wBAAwB;AACtD,SAAS,oBAAoB;AAqEvB;AA9DC,IAAM,aAAa,WAAmC,CAAC,OAAO,QAAQ;AArB7E;AAsBE,QAAM,CAAC,MAAM,IAAI,uBAAuB,SAAS,KAAK;AACtD,QAAM,EAAE,WAAW,UAAU,GAAG,KAAK,IAAI,eAAe,KAAK;AAE7D,QAAM,CAAC,MAAM,aAAa,IAAI,cAAc,EAAE,GAAG,OAAO,OAAO,GAAG,KAAK,GAAG;AAAA,IACxE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,aAAY,mBAAc,cAAd,YAA2B,cAAc;AAC3D,QAAM,UAAS,mBAAc,WAAd,YAAwB,cAAc;AACrD,QAAM,cAAc,gCAAa;AAEjC,QAAM,MAAmB;AAAA,IACvB,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV;AAAA,IACA,GAAG,OAAO;AAAA,EACZ;AAEA,QAAM,aAAyB,CAAC;AAEhC,QAAM,gBAAgB,iBAAiB,QAAQ;AAE/C,gBAAc,QAAQ,CAAC,UAAe;AACpC,QAAI,eAAe,MAAM,SAAS;AAChC,iBAAW,eAAe,GAAG,WAAW;AAE1C,QAAI,eAAe,MAAM,SAAS;AAChC,iBAAW,aAAa,GAAG,WAAW;AAExC,QAAI,MAAM,SAAS,eAAgB,YAAW,cAAc;AAE5D,QAAI,MAAM,SAAS;AACjB,iBAAW,eAAe;AAAA,EAC9B,CAAC;AAED,QAAM,gBAAgB,cAAc,IAAI,CAAC,UAAU;AA5DrD,QAAAA,KAAAC,KAAA;AA6DI,UAAM,iBAAiB;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,CAAC,SAAS,MAAM,SAAS,IAAI;AAEpC,QAAI,gBAAgB;AAClB,aAAO;AAAA,IACT,OAAO;AACL,YAAM,aAAa,gBAAgB;AAAA,QACjC,OAAMA,OAAAD,MAAA,MAAM,UAAN,gBAAAA,IAAa,SAAb,OAAAC,MAAqB,MAAM;AAAA,QACjC,UAAS,iBAAM,UAAN,mBAAa,YAAb,YAAwB,MAAM;AAAA,QACvC,GAAG,MAAM;AAAA,MACX,CAAC;AAED,aAAO,aAAa,OAAO,OAAO,OAAO,YAAY,UAAU,CAAC;AAAA,IAClE;AAAA,EACF,CAAC;AAED,SACE,oBAAC,sBAAmB,OAAO,EAAE,QAAQ,YAAY,GAC/C;AAAA,IAAC,GAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,WAAW,GAAG,kBAAkB,SAAS;AAAA,MACzC,MAAK;AAAA,MACL,OAAO;AAAA,MACN,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;","names":["_a","_b"]}
package/dist/index.js CHANGED
@@ -54,8 +54,6 @@ var Input = (0, import_core.forwardRef)((props, ref) => {
54
54
 
55
55
  // src/input-group.tsx
56
56
  var import_core4 = require("@yamada-ui/core");
57
- var import_file_input = require("@yamada-ui/file-input");
58
- var import_use_token = require("@yamada-ui/use-token");
59
57
  var import_utils5 = require("@yamada-ui/utils");
60
58
  var import_react = require("react");
61
59
 
@@ -74,17 +72,15 @@ var [InputGroupProvider, useInputGroup] = (0, import_utils2.createContext)({
74
72
  var import_jsx_runtime2 = require("react/jsx-runtime");
75
73
  var InputAddon = (0, import_core2.forwardRef)(
76
74
  ({ className, placement = "left", ...rest }, ref) => {
77
- const styles = useInputGroup();
75
+ const { styles } = useInputGroup();
78
76
  const placementStyles = {
79
77
  left: {
80
78
  me: "-1px",
81
- roundedRight: 0,
82
- borderEndColor: "transparent"
79
+ roundedRight: "0px !important"
83
80
  },
84
81
  right: {
85
82
  ms: "-1px",
86
- roundedLeft: 0,
87
- borderStartColor: "transparent"
83
+ roundedLeft: "0px !important"
88
84
  }
89
85
  };
90
86
  const css = {
@@ -140,8 +136,8 @@ var import_utils4 = require("@yamada-ui/utils");
140
136
  var import_jsx_runtime3 = require("react/jsx-runtime");
141
137
  var InputElement = (0, import_core3.forwardRef)(
142
138
  ({ className, isClick = false, placement = "left", ...rest }, ref) => {
143
- var _a, _b, _c, _d, _e, _f, _g, _h;
144
- const styles = useInputGroup();
139
+ var _a;
140
+ const { styles, fieldHeight } = useInputGroup();
145
141
  const css = {
146
142
  position: "absolute",
147
143
  top: "0",
@@ -150,9 +146,9 @@ var InputElement = (0, import_core3.forwardRef)(
150
146
  display: "flex",
151
147
  alignItems: "center",
152
148
  justifyContent: "center",
153
- 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,
149
+ w: fieldHeight,
154
150
  h: "100%",
155
- fontSize: (_h = styles.field) == null ? void 0 : _h.fontSize,
151
+ fontSize: (_a = styles.field) == null ? void 0 : _a.fontSize,
156
152
  pointerEvents: isClick ? "auto" : "none",
157
153
  cursor: isClick ? "pointer" : "auto",
158
154
  ...styles.element
@@ -198,37 +194,56 @@ var InputRightElement = (0, import_core3.forwardRef)(
198
194
  // src/input-group.tsx
199
195
  var import_jsx_runtime4 = require("react/jsx-runtime");
200
196
  var InputGroup = (0, import_core4.forwardRef)((props, ref) => {
201
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
197
+ var _a, _b;
202
198
  const [styles] = (0, import_core4.useComponentMultiStyle)("Input", props);
203
199
  const { className, children, ...rest } = (0, import_core4.omitThemeProps)(props);
200
+ const [vars, variableProps] = (0, import_core4.useCreateVars)({ ...styles.field, ...rest }, [
201
+ "minHeight",
202
+ "minH",
203
+ "height",
204
+ "h"
205
+ ]);
206
+ const minHeight = (_a = variableProps.minHeight) != null ? _a : variableProps.minH;
207
+ const height = (_b = variableProps.height) != null ? _b : variableProps.h;
208
+ const fieldHeight = minHeight != null ? minHeight : height;
204
209
  const css = {
205
210
  width: "100%",
206
211
  display: "flex",
207
212
  position: "relative",
213
+ vars,
208
214
  ...styles.container
209
215
  };
210
216
  const groupProps = {};
211
- const minHeight = (_g = (_e = (0, import_use_token.useToken)("sizes", (_c = (_a = styles.field) == null ? void 0 : _a.minHeight) != null ? _c : (_b = styles.field) == null ? void 0 : _b.minH)) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH;
212
- const height = (_n = (_l = (0, import_use_token.useToken)("sizes", (_j = (_h = styles.field) == null ? void 0 : _h.height) != null ? _j : (_i = styles.field) == null ? void 0 : _i.h)) != null ? _l : (_k = styles.field) == null ? void 0 : _k.height) != null ? _n : (_m = styles.field) == null ? void 0 : _m.h;
213
217
  const validChildren = (0, import_utils5.getValidChildren)(children);
214
218
  validChildren.forEach((child) => {
215
- if ((minHeight || height) && child.type === InputLeftElement)
216
- groupProps.paddingStart = height != null ? height : minHeight;
217
- if ((minHeight || height) && child.type === InputRightElement)
218
- groupProps.paddingEnd = height != null ? height : minHeight;
219
- if (child.type === InputLeftAddon) groupProps.roundedLeft = 0;
220
- if (child.type === InputRightAddon) groupProps.roundedRight = 0;
219
+ if (fieldHeight && child.type === InputLeftElement)
220
+ groupProps.paddingStart = `${fieldHeight} !important`;
221
+ if (fieldHeight && child.type === InputRightElement)
222
+ groupProps.paddingEnd = `${fieldHeight} !important`;
223
+ if (child.type === InputLeftAddon) groupProps.roundedLeft = "0px !important";
224
+ if (child.type === InputRightAddon)
225
+ groupProps.roundedRight = "0px !important";
221
226
  });
222
227
  const cloneChildren = validChildren.map((child) => {
223
- var _a2, _b2;
224
- const childProps = (0, import_utils5.filterUndefined)({
225
- size: ((_a2 = child.props) == null ? void 0 : _a2.size) || props.size,
226
- variant: ((_b2 = child.props) == null ? void 0 : _b2.variant) || props.variant,
227
- ...child.props
228
- });
229
- return child.type !== Input && child.type !== import_file_input.FileInput ? (0, import_react.cloneElement)(child, childProps) : (0, import_react.cloneElement)(child, Object.assign(childProps, groupProps));
228
+ var _a2, _b2, _c, _d;
229
+ const isAddonElement = [
230
+ InputLeftAddon,
231
+ InputRightAddon,
232
+ InputLeftElement,
233
+ InputRightElement
234
+ ].some((type) => child.type === type);
235
+ if (isAddonElement) {
236
+ return child;
237
+ } else {
238
+ const childProps = (0, import_utils5.filterUndefined)({
239
+ size: (_b2 = (_a2 = child.props) == null ? void 0 : _a2.size) != null ? _b2 : props.size,
240
+ variant: (_d = (_c = child.props) == null ? void 0 : _c.variant) != null ? _d : props.variant,
241
+ ...child.props
242
+ });
243
+ return (0, import_react.cloneElement)(child, Object.assign(childProps, groupProps));
244
+ }
230
245
  });
231
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InputGroupProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
246
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InputGroupProvider, { value: { styles, fieldHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
232
247
  import_core4.ui.div,
233
248
  {
234
249
  ref,
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-context.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 useComponentMultiStyle,\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\ninterface 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 interface InputProps\n extends 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] = useComponentMultiStyle(\"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 useComponentMultiStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport { cx, filterUndefined, getValidChildren } from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport { Input } from \"./input\"\nimport { InputLeftAddon, InputRightAddon } from \"./input-addon\"\nimport { InputGroupProvider } from \"./input-context\"\nimport { InputRightElement, InputLeftElement } from \"./input-element\"\n\nexport interface InputGroupProps extends HTMLUIProps, ThemeProps<\"Input\"> {}\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useComponentMultiStyle(\"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-context\"\n\ninterface InputAddonOptions {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport interface InputAddonProps extends HTMLUIProps, 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 } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n [key: string]: CSSUIObject\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\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-context\"\n\ninterface 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 interface InputElementProps extends HTMLUIProps, 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;AA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Ac,CAAS,MAAlE,aACA,YAAO,UAAP,mBAAc,WADd,aAEA,YAAO,UAAP,mBAAc;AAEhB,QAAM,oBAAgB,gCAAiB,QAAQ;AAE/C,gBAAc,QAAQ,CAAC,UAAe;AACpC,SAAK,aAAa,WAAW,MAAM,SAAS;AAC1C,iBAAW,eAAe,0BAAU;AAEtC,SAAK,aAAa,WAAW,MAAM,SAAS;AAC1C,iBAAW,aAAa,0BAAU;AAEpC,QAAI,MAAM,SAAS,eAAgB,YAAW,cAAc;AAE5D,QAAI,MAAM,SAAS,gBAAiB,YAAW,eAAe;AAAA,EAChE,CAAC;AAED,QAAM,gBAAgB,cAAc,IAAI,CAAC,UAAU;AAzDrD,QAAAC,KAAAC;AA0DI,UAAM,iBAAa,+BAAgB;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,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_utils","import_jsx_runtime","import_core","import_utils","import_jsx_runtime","import_jsx_runtime","_a","_b"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/input.tsx","../src/input-group.tsx","../src/input-addon.tsx","../src/input-context.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 useComponentMultiStyle,\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\ninterface 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 interface InputProps\n extends 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] = useComponentMultiStyle(\"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 useComponentMultiStyle,\n omitThemeProps,\n useCreateVars,\n} from \"@yamada-ui/core\"\nimport { cx, filterUndefined, getValidChildren } from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport { InputLeftAddon, InputRightAddon } from \"./input-addon\"\nimport { InputGroupProvider } from \"./input-context\"\nimport { InputRightElement, InputLeftElement } from \"./input-element\"\n\nexport interface InputGroupProps extends HTMLUIProps, ThemeProps<\"Input\"> {}\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useComponentMultiStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const [vars, variableProps] = useCreateVars({ ...styles.field, ...rest }, [\n \"minHeight\",\n \"minH\",\n \"height\",\n \"h\",\n ])\n const minHeight = variableProps.minHeight ?? variableProps.minH\n const height = variableProps.height ?? variableProps.h\n const fieldHeight = minHeight ?? height\n\n const css: CSSUIObject = {\n width: \"100%\",\n display: \"flex\",\n position: \"relative\",\n vars,\n ...styles.container,\n }\n\n const groupProps: CSSUIProps = {}\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if (fieldHeight && child.type === InputLeftElement)\n groupProps.paddingStart = `${fieldHeight} !important`\n\n if (fieldHeight && child.type === InputRightElement)\n groupProps.paddingEnd = `${fieldHeight} !important`\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = \"0px !important\"\n\n if (child.type === InputRightAddon)\n groupProps.roundedRight = \"0px !important\"\n })\n\n const cloneChildren = validChildren.map((child) => {\n const isAddonElement = [\n InputLeftAddon,\n InputRightAddon,\n InputLeftElement,\n InputRightElement,\n ].some((type) => child.type === type)\n\n if (isAddonElement) {\n return child\n } else {\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 cloneElement(child, Object.assign(childProps, groupProps))\n }\n })\n\n return (\n <InputGroupProvider value={{ styles, fieldHeight }}>\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-context\"\n\ninterface InputAddonOptions {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport interface InputAddonProps extends HTMLUIProps, 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: \"0px !important\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: \"0px !important\",\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 } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n styles: { [key: string]: CSSUIObject }\n fieldHeight: string | undefined\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\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-context\"\n\ninterface 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 interface InputElementProps extends HTMLUIProps, InputElementOptions {}\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const { styles, fieldHeight } = 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: fieldHeight,\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;AAwCf;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C,iBAAW,aAAa,GAAG,WAAW;AAExC,QAAI,MAAM,SAAS,eAAgB,YAAW,cAAc;AAE5D,QAAI,MAAM,SAAS;AACjB,iBAAW,eAAe;AAAA,EAC9B,CAAC;AAED,QAAM,gBAAgB,cAAc,IAAI,CAAC,UAAU;AA5DrD,QAAAC,KAAAC,KAAA;AA6DI,UAAM,iBAAiB;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,CAAC,SAAS,MAAM,SAAS,IAAI;AAEpC,QAAI,gBAAgB;AAClB,aAAO;AAAA,IACT,OAAO;AACL,YAAM,iBAAa,+BAAgB;AAAA,QACjC,OAAMA,OAAAD,MAAA,MAAM,UAAN,gBAAAA,IAAa,SAAb,OAAAC,MAAqB,MAAM;AAAA,QACjC,UAAS,iBAAM,UAAN,mBAAa,YAAb,YAAwB,MAAM;AAAA,QACvC,GAAG,MAAM;AAAA,MACX,CAAC;AAED,iBAAO,2BAAa,OAAO,OAAO,OAAO,YAAY,UAAU,CAAC;AAAA,IAClE;AAAA,EACF,CAAC;AAED,SACE,6CAAC,sBAAmB,OAAO,EAAE,QAAQ,YAAY,GAC/C;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_utils","import_jsx_runtime","import_core","import_utils","import_jsx_runtime","import_jsx_runtime","_a","_b"]}
package/dist/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  "use client"
2
2
  import {
3
3
  InputGroup
4
- } from "./chunk-3AEWRGHP.mjs";
4
+ } from "./chunk-S3TRD6FG.mjs";
5
5
  import {
6
6
  InputLeftAddon,
7
7
  InputRightAddon
8
- } from "./chunk-OYJRHTQL.mjs";
8
+ } from "./chunk-OEJ5NONO.mjs";
9
9
  import {
10
10
  InputLeftElement,
11
11
  InputRightElement
12
- } from "./chunk-ITQBVWTU.mjs";
13
- import "./chunk-ZNGNHH5S.mjs";
12
+ } from "./chunk-Q6WRYI3A.mjs";
13
+ import "./chunk-5UF5TTHV.mjs";
14
14
  import {
15
15
  Input
16
16
  } from "./chunk-ZARK2Q4J.mjs";
@@ -39,17 +39,15 @@ var [InputGroupProvider, useInputGroup] = (0, import_utils.createContext)({
39
39
  var import_jsx_runtime = require("react/jsx-runtime");
40
40
  var InputAddon = (0, import_core.forwardRef)(
41
41
  ({ className, placement = "left", ...rest }, ref) => {
42
- const styles = useInputGroup();
42
+ const { styles } = useInputGroup();
43
43
  const placementStyles = {
44
44
  left: {
45
45
  me: "-1px",
46
- roundedRight: 0,
47
- borderEndColor: "transparent"
46
+ roundedRight: "0px !important"
48
47
  },
49
48
  right: {
50
49
  ms: "-1px",
51
- roundedLeft: 0,
52
- borderStartColor: "transparent"
50
+ roundedLeft: "0px !important"
53
51
  }
54
52
  };
55
53
  const css = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/input-addon.tsx","../src/input-context.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-context\"\n\ninterface InputAddonOptions {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport interface InputAddonProps extends HTMLUIProps, 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 } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n [key: string]: CSSUIObject\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA+B;AAC/B,IAAAA,gBAAmB;;;ACDnB,mBAA8B;AAMvB,IAAM,CAAC,oBAAoB,aAAa,QAC7C,4BAAiC;AAAA,EAC/B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;ADiCG;AA5BN,IAAM,iBAAa;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,MAAM;AAAA,MACN,GAAG;AAAA,MACH,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,GAAG,OAAO;AAAA,MACV,GAAG,gBAAgB,SAAS;AAAA,IAC9B;AAEA,WACE;AAAA,MAAC,eAAG;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_utils"]}
1
+ {"version":3,"sources":["../src/input-addon.tsx","../src/input-context.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-context\"\n\ninterface InputAddonOptions {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport interface InputAddonProps extends HTMLUIProps, 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: \"0px !important\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: \"0px !important\",\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 } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n styles: { [key: string]: CSSUIObject }\n fieldHeight: string | undefined\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA+B;AAC/B,IAAAA,gBAAmB;;;ACDnB,mBAA8B;AAOvB,IAAM,CAAC,oBAAoB,aAAa,QAC7C,4BAAiC;AAAA,EAC/B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;AD8BG;AA1BN,IAAM,iBAAa;AAAA,EACjB,CAAC,EAAE,WAAW,YAAY,QAAQ,GAAG,KAAK,GAAG,QAAQ;AACnD,UAAM,EAAE,OAAO,IAAI,cAAc;AAEjC,UAAM,kBAAkB;AAAA,MACtB,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,cAAc;AAAA,MAChB;AAAA,MACA,OAAO;AAAA,QACL,IAAI;AAAA,QACJ,aAAa;AAAA,MACf;AAAA,IACF;AAEA,UAAM,MAAmB;AAAA,MACvB,MAAM;AAAA,MACN,GAAG;AAAA,MACH,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,GAAG,OAAO;AAAA,MACV,GAAG,gBAAgB,SAAS;AAAA,IAC9B;AAEA,WACE;AAAA,MAAC,eAAG;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_utils"]}
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  InputLeftAddon,
4
4
  InputRightAddon
5
- } from "./chunk-OYJRHTQL.mjs";
6
- import "./chunk-ZNGNHH5S.mjs";
5
+ } from "./chunk-OEJ5NONO.mjs";
6
+ import "./chunk-5UF5TTHV.mjs";
7
7
  export {
8
8
  InputLeftAddon,
9
9
  InputRightAddon
@@ -2,7 +2,10 @@ import * as react from 'react';
2
2
  import { CSSUIObject } from '@yamada-ui/core';
3
3
 
4
4
  interface InputGroupContext {
5
- [key: string]: CSSUIObject;
5
+ styles: {
6
+ [key: string]: CSSUIObject;
7
+ };
8
+ fieldHeight: string | undefined;
6
9
  }
7
10
  declare const InputGroupProvider: react.Provider<InputGroupContext>;
8
11
  declare const useInputGroup: () => InputGroupContext;
@@ -2,7 +2,10 @@ import * as react from 'react';
2
2
  import { CSSUIObject } from '@yamada-ui/core';
3
3
 
4
4
  interface InputGroupContext {
5
- [key: string]: CSSUIObject;
5
+ styles: {
6
+ [key: string]: CSSUIObject;
7
+ };
8
+ fieldHeight: string | undefined;
6
9
  }
7
10
  declare const InputGroupProvider: react.Provider<InputGroupContext>;
8
11
  declare const useInputGroup: () => InputGroupContext;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/input-context.tsx"],"sourcesContent":["import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n [key: string]: CSSUIObject\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8B;AAMvB,IAAM,CAAC,oBAAoB,aAAa,QAC7C,4BAAiC;AAAA,EAC/B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/input-context.tsx"],"sourcesContent":["import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n styles: { [key: string]: CSSUIObject }\n fieldHeight: string | undefined\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8B;AAOvB,IAAM,CAAC,oBAAoB,aAAa,QAC7C,4BAAiC;AAAA,EAC/B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;","names":[]}
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  InputGroupProvider,
4
4
  useInputGroup
5
- } from "./chunk-ZNGNHH5S.mjs";
5
+ } from "./chunk-5UF5TTHV.mjs";
6
6
  export {
7
7
  InputGroupProvider,
8
8
  useInputGroup
@@ -39,8 +39,8 @@ var [InputGroupProvider, useInputGroup] = (0, import_utils.createContext)({
39
39
  var import_jsx_runtime = require("react/jsx-runtime");
40
40
  var InputElement = (0, import_core.forwardRef)(
41
41
  ({ className, isClick = false, placement = "left", ...rest }, ref) => {
42
- var _a, _b, _c, _d, _e, _f, _g, _h;
43
- const styles = useInputGroup();
42
+ var _a;
43
+ const { styles, fieldHeight } = useInputGroup();
44
44
  const css = {
45
45
  position: "absolute",
46
46
  top: "0",
@@ -49,9 +49,9 @@ var InputElement = (0, import_core.forwardRef)(
49
49
  display: "flex",
50
50
  alignItems: "center",
51
51
  justifyContent: "center",
52
- 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,
52
+ w: fieldHeight,
53
53
  h: "100%",
54
- fontSize: (_h = styles.field) == null ? void 0 : _h.fontSize,
54
+ fontSize: (_a = styles.field) == null ? void 0 : _a.fontSize,
55
55
  pointerEvents: isClick ? "auto" : "none",
56
56
  cursor: isClick ? "pointer" : "auto",
57
57
  ...styles.element
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/input-element.tsx","../src/input-context.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-context\"\n\ninterface 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 interface InputElementProps extends HTMLUIProps, 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 { CSSUIObject } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n [key: string]: CSSUIObject\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the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F;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_utils"]}
1
+ {"version":3,"sources":["../src/input-element.tsx","../src/input-context.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-context\"\n\ninterface 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 interface InputElementProps extends HTMLUIProps, InputElementOptions {}\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const { styles, fieldHeight } = 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: fieldHeight,\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 { CSSUIObject } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n styles: { [key: string]: CSSUIObject }\n fieldHeight: string | undefined\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA+B;AAC/B,IAAAA,gBAAmB;;;ACDnB,mBAA8B;AAOvB,IAAM,CAAC,oBAAoB,aAAa,QAC7C,4BAAiC;AAAA,EAC/B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;AD+BG;AArBN,IAAM,mBAAe;AAAA,EACnB,CAAC,EAAE,WAAW,UAAU,OAAO,YAAY,QAAQ,GAAG,KAAK,GAAG,QAAQ;AAvBxE;AAwBI,UAAM,EAAE,QAAQ,YAAY,IAAI,cAAc;AAE9C,UAAM,MAAmB;AAAA,MACvB,UAAU;AAAA,MACV,KAAK;AAAA,MACL,CAAC,cAAc,SAAS,eAAe,UAAU,GAAG;AAAA,MACpD,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,GAAG;AAAA,MACH,GAAG;AAAA,MACH,WAAU,YAAO,UAAP,mBAAc;AAAA,MACxB,eAAe,UAAU,SAAS;AAAA,MAClC,QAAQ,UAAU,YAAY;AAAA,MAC9B,GAAG,OAAO;AAAA,IACZ;AAEA,WACE;AAAA,MAAC,eAAG;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_utils"]}
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  InputLeftElement,
4
4
  InputRightElement
5
- } from "./chunk-ITQBVWTU.mjs";
6
- import "./chunk-ZNGNHH5S.mjs";
5
+ } from "./chunk-Q6WRYI3A.mjs";
6
+ import "./chunk-5UF5TTHV.mjs";
7
7
  export {
8
8
  InputLeftElement,
9
9
  InputRightElement
@@ -24,60 +24,34 @@ __export(input_group_exports, {
24
24
  InputGroup: () => InputGroup
25
25
  });
26
26
  module.exports = __toCommonJS(input_group_exports);
27
- var import_core4 = require("@yamada-ui/core");
28
- var import_file_input = require("@yamada-ui/file-input");
29
- var import_use_token = require("@yamada-ui/use-token");
30
- var import_utils5 = require("@yamada-ui/utils");
27
+ var import_core3 = require("@yamada-ui/core");
28
+ var import_utils4 = require("@yamada-ui/utils");
31
29
  var import_react = require("react");
32
30
 
33
- // src/input.tsx
34
- var import_core = require("@yamada-ui/core");
35
- var import_form_control = require("@yamada-ui/form-control");
36
- var import_utils = require("@yamada-ui/utils");
37
- var import_jsx_runtime = require("react/jsx-runtime");
38
- var Input = (0, import_core.forwardRef)((props, ref) => {
39
- const [styles, mergedProps] = (0, import_core.useComponentMultiStyle)("Input", props);
40
- let { className, htmlSize, __css, ...rest } = (0, import_core.omitThemeProps)(mergedProps);
41
- rest = (0, import_form_control.useFormControlProps)(rest);
42
- const css = { ...styles.field, ...__css };
43
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
44
- import_core.ui.input,
45
- {
46
- ref,
47
- className: (0, import_utils.cx)("ui-input", className),
48
- size: htmlSize,
49
- __css: css,
50
- ...rest
51
- }
52
- );
53
- });
54
-
55
31
  // src/input-addon.tsx
56
- var import_core2 = require("@yamada-ui/core");
57
- var import_utils3 = require("@yamada-ui/utils");
32
+ var import_core = require("@yamada-ui/core");
33
+ var import_utils2 = require("@yamada-ui/utils");
58
34
 
59
35
  // src/input-context.tsx
60
- var import_utils2 = require("@yamada-ui/utils");
61
- var [InputGroupProvider, useInputGroup] = (0, import_utils2.createContext)({
36
+ var import_utils = require("@yamada-ui/utils");
37
+ var [InputGroupProvider, useInputGroup] = (0, import_utils.createContext)({
62
38
  name: "InputGroupContext",
63
39
  errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in "<InputGroup />" `
64
40
  });
65
41
 
66
42
  // src/input-addon.tsx
67
- var import_jsx_runtime2 = require("react/jsx-runtime");
68
- var InputAddon = (0, import_core2.forwardRef)(
43
+ var import_jsx_runtime = require("react/jsx-runtime");
44
+ var InputAddon = (0, import_core.forwardRef)(
69
45
  ({ className, placement = "left", ...rest }, ref) => {
70
- const styles = useInputGroup();
46
+ const { styles } = useInputGroup();
71
47
  const placementStyles = {
72
48
  left: {
73
49
  me: "-1px",
74
- roundedRight: 0,
75
- borderEndColor: "transparent"
50
+ roundedRight: "0px !important"
76
51
  },
77
52
  right: {
78
53
  ms: "-1px",
79
- roundedLeft: 0,
80
- borderStartColor: "transparent"
54
+ roundedLeft: "0px !important"
81
55
  }
82
56
  };
83
57
  const css = {
@@ -89,37 +63,37 @@ var InputAddon = (0, import_core2.forwardRef)(
89
63
  ...styles.addon,
90
64
  ...placementStyles[placement]
91
65
  };
92
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
93
- import_core2.ui.div,
66
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
+ import_core.ui.div,
94
68
  {
95
69
  ref,
96
- className: (0, import_utils3.cx)("ui-input__addon", className),
70
+ className: (0, import_utils2.cx)("ui-input__addon", className),
97
71
  __css: css,
98
72
  ...rest
99
73
  }
100
74
  );
101
75
  }
102
76
  );
103
- var InputLeftAddon = (0, import_core2.forwardRef)(
77
+ var InputLeftAddon = (0, import_core.forwardRef)(
104
78
  ({ className, ...rest }, ref) => {
105
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
79
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
106
80
  InputAddon,
107
81
  {
108
82
  ref,
109
- className: (0, import_utils3.cx)("ui-input__addon--left", className),
83
+ className: (0, import_utils2.cx)("ui-input__addon--left", className),
110
84
  placement: "left",
111
85
  ...rest
112
86
  }
113
87
  );
114
88
  }
115
89
  );
116
- var InputRightAddon = (0, import_core2.forwardRef)(
90
+ var InputRightAddon = (0, import_core.forwardRef)(
117
91
  ({ className, ...rest }, ref) => {
118
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
92
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
119
93
  InputAddon,
120
94
  {
121
95
  ref,
122
- className: (0, import_utils3.cx)("ui-input__addon--right", className),
96
+ className: (0, import_utils2.cx)("ui-input__addon--right", className),
123
97
  placement: "right",
124
98
  ...rest
125
99
  }
@@ -128,13 +102,13 @@ var InputRightAddon = (0, import_core2.forwardRef)(
128
102
  );
129
103
 
130
104
  // src/input-element.tsx
131
- var import_core3 = require("@yamada-ui/core");
132
- var import_utils4 = require("@yamada-ui/utils");
133
- var import_jsx_runtime3 = require("react/jsx-runtime");
134
- var InputElement = (0, import_core3.forwardRef)(
105
+ var import_core2 = require("@yamada-ui/core");
106
+ var import_utils3 = require("@yamada-ui/utils");
107
+ var import_jsx_runtime2 = require("react/jsx-runtime");
108
+ var InputElement = (0, import_core2.forwardRef)(
135
109
  ({ className, isClick = false, placement = "left", ...rest }, ref) => {
136
- var _a, _b, _c, _d, _e, _f, _g, _h;
137
- const styles = useInputGroup();
110
+ var _a;
111
+ const { styles, fieldHeight } = useInputGroup();
138
112
  const css = {
139
113
  position: "absolute",
140
114
  top: "0",
@@ -143,44 +117,44 @@ var InputElement = (0, import_core3.forwardRef)(
143
117
  display: "flex",
144
118
  alignItems: "center",
145
119
  justifyContent: "center",
146
- 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,
120
+ w: fieldHeight,
147
121
  h: "100%",
148
- fontSize: (_h = styles.field) == null ? void 0 : _h.fontSize,
122
+ fontSize: (_a = styles.field) == null ? void 0 : _a.fontSize,
149
123
  pointerEvents: isClick ? "auto" : "none",
150
124
  cursor: isClick ? "pointer" : "auto",
151
125
  ...styles.element
152
126
  };
153
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
154
- import_core3.ui.div,
127
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
128
+ import_core2.ui.div,
155
129
  {
156
130
  ref,
157
- className: (0, import_utils4.cx)("ui-input__element", className),
131
+ className: (0, import_utils3.cx)("ui-input__element", className),
158
132
  __css: css,
159
133
  ...rest
160
134
  }
161
135
  );
162
136
  }
163
137
  );
164
- var InputLeftElement = (0, import_core3.forwardRef)(
138
+ var InputLeftElement = (0, import_core2.forwardRef)(
165
139
  ({ className, ...rest }, ref) => {
166
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
140
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
167
141
  InputElement,
168
142
  {
169
143
  ref,
170
- className: (0, import_utils4.cx)("ui-input__element--left", className),
144
+ className: (0, import_utils3.cx)("ui-input__element--left", className),
171
145
  placement: "left",
172
146
  ...rest
173
147
  }
174
148
  );
175
149
  }
176
150
  );
177
- var InputRightElement = (0, import_core3.forwardRef)(
151
+ var InputRightElement = (0, import_core2.forwardRef)(
178
152
  ({ className, ...rest }, ref) => {
179
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
153
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
180
154
  InputElement,
181
155
  {
182
156
  ref,
183
- className: (0, import_utils4.cx)("ui-input__element--right", className),
157
+ className: (0, import_utils3.cx)("ui-input__element--right", className),
184
158
  placement: "right",
185
159
  ...rest
186
160
  }
@@ -189,43 +163,62 @@ var InputRightElement = (0, import_core3.forwardRef)(
189
163
  );
190
164
 
191
165
  // src/input-group.tsx
192
- var import_jsx_runtime4 = require("react/jsx-runtime");
193
- var InputGroup = (0, import_core4.forwardRef)((props, ref) => {
194
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
195
- const [styles] = (0, import_core4.useComponentMultiStyle)("Input", props);
196
- const { className, children, ...rest } = (0, import_core4.omitThemeProps)(props);
166
+ var import_jsx_runtime3 = require("react/jsx-runtime");
167
+ var InputGroup = (0, import_core3.forwardRef)((props, ref) => {
168
+ var _a, _b;
169
+ const [styles] = (0, import_core3.useComponentMultiStyle)("Input", props);
170
+ const { className, children, ...rest } = (0, import_core3.omitThemeProps)(props);
171
+ const [vars, variableProps] = (0, import_core3.useCreateVars)({ ...styles.field, ...rest }, [
172
+ "minHeight",
173
+ "minH",
174
+ "height",
175
+ "h"
176
+ ]);
177
+ const minHeight = (_a = variableProps.minHeight) != null ? _a : variableProps.minH;
178
+ const height = (_b = variableProps.height) != null ? _b : variableProps.h;
179
+ const fieldHeight = minHeight != null ? minHeight : height;
197
180
  const css = {
198
181
  width: "100%",
199
182
  display: "flex",
200
183
  position: "relative",
184
+ vars,
201
185
  ...styles.container
202
186
  };
203
187
  const groupProps = {};
204
- const minHeight = (_g = (_e = (0, import_use_token.useToken)("sizes", (_c = (_a = styles.field) == null ? void 0 : _a.minHeight) != null ? _c : (_b = styles.field) == null ? void 0 : _b.minH)) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH;
205
- const height = (_n = (_l = (0, import_use_token.useToken)("sizes", (_j = (_h = styles.field) == null ? void 0 : _h.height) != null ? _j : (_i = styles.field) == null ? void 0 : _i.h)) != null ? _l : (_k = styles.field) == null ? void 0 : _k.height) != null ? _n : (_m = styles.field) == null ? void 0 : _m.h;
206
- const validChildren = (0, import_utils5.getValidChildren)(children);
188
+ const validChildren = (0, import_utils4.getValidChildren)(children);
207
189
  validChildren.forEach((child) => {
208
- if ((minHeight || height) && child.type === InputLeftElement)
209
- groupProps.paddingStart = height != null ? height : minHeight;
210
- if ((minHeight || height) && child.type === InputRightElement)
211
- groupProps.paddingEnd = height != null ? height : minHeight;
212
- if (child.type === InputLeftAddon) groupProps.roundedLeft = 0;
213
- if (child.type === InputRightAddon) groupProps.roundedRight = 0;
190
+ if (fieldHeight && child.type === InputLeftElement)
191
+ groupProps.paddingStart = `${fieldHeight} !important`;
192
+ if (fieldHeight && child.type === InputRightElement)
193
+ groupProps.paddingEnd = `${fieldHeight} !important`;
194
+ if (child.type === InputLeftAddon) groupProps.roundedLeft = "0px !important";
195
+ if (child.type === InputRightAddon)
196
+ groupProps.roundedRight = "0px !important";
214
197
  });
215
198
  const cloneChildren = validChildren.map((child) => {
216
- var _a2, _b2;
217
- const childProps = (0, import_utils5.filterUndefined)({
218
- size: ((_a2 = child.props) == null ? void 0 : _a2.size) || props.size,
219
- variant: ((_b2 = child.props) == null ? void 0 : _b2.variant) || props.variant,
220
- ...child.props
221
- });
222
- return child.type !== Input && child.type !== import_file_input.FileInput ? (0, import_react.cloneElement)(child, childProps) : (0, import_react.cloneElement)(child, Object.assign(childProps, groupProps));
199
+ var _a2, _b2, _c, _d;
200
+ const isAddonElement = [
201
+ InputLeftAddon,
202
+ InputRightAddon,
203
+ InputLeftElement,
204
+ InputRightElement
205
+ ].some((type) => child.type === type);
206
+ if (isAddonElement) {
207
+ return child;
208
+ } else {
209
+ const childProps = (0, import_utils4.filterUndefined)({
210
+ size: (_b2 = (_a2 = child.props) == null ? void 0 : _a2.size) != null ? _b2 : props.size,
211
+ variant: (_d = (_c = child.props) == null ? void 0 : _c.variant) != null ? _d : props.variant,
212
+ ...child.props
213
+ });
214
+ return (0, import_react.cloneElement)(child, Object.assign(childProps, groupProps));
215
+ }
223
216
  });
224
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InputGroupProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
225
- import_core4.ui.div,
217
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InputGroupProvider, { value: { styles, fieldHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
218
+ import_core3.ui.div,
226
219
  {
227
220
  ref,
228
- className: (0, import_utils5.cx)("ui-input-group", className),
221
+ className: (0, import_utils4.cx)("ui-input-group", className),
229
222
  role: "group",
230
223
  __css: css,
231
224
  ...rest,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/input-group.tsx","../src/input.tsx","../src/input-addon.tsx","../src/input-context.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 useComponentMultiStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport { cx, filterUndefined, getValidChildren } from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport { Input } from \"./input\"\nimport { InputLeftAddon, InputRightAddon } from \"./input-addon\"\nimport { InputGroupProvider } from \"./input-context\"\nimport { InputRightElement, InputLeftElement } from \"./input-element\"\n\nexport interface InputGroupProps extends HTMLUIProps, ThemeProps<\"Input\"> {}\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useComponentMultiStyle(\"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 useComponentMultiStyle,\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\ninterface 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 interface InputProps\n extends 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] = useComponentMultiStyle(\"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-context\"\n\ninterface InputAddonOptions {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport interface InputAddonProps extends HTMLUIProps, 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 } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n [key: string]: CSSUIObject\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\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-context\"\n\ninterface 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 interface InputElementProps extends HTMLUIProps, 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;AAMA,IAAAA,eAKO;AACP,wBAA0B;AAC1B,uBAAyB;AACzB,IAAAC,gBAAsD;AACtD,mBAA6B;;;ACR7B,kBAKO;AAEP,0BAAoC;AACpC,mBAAmB;AAwCf;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;;;AC9DD,IAAAC,eAA+B;AAC/B,IAAAC,gBAAmB;;;ACDnB,IAAAC,gBAA8B;AAMvB,IAAM,CAAC,oBAAoB,aAAa,QAC7C,6BAAiC;AAAA,EAC/B,MAAM;AAAA,EAC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B,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_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-addon.tsx","../src/input-context.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 useComponentMultiStyle,\n omitThemeProps,\n useCreateVars,\n} from \"@yamada-ui/core\"\nimport { cx, filterUndefined, getValidChildren } from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport { InputLeftAddon, InputRightAddon } from \"./input-addon\"\nimport { InputGroupProvider } from \"./input-context\"\nimport { InputRightElement, InputLeftElement } from \"./input-element\"\n\nexport interface InputGroupProps extends HTMLUIProps, ThemeProps<\"Input\"> {}\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useComponentMultiStyle(\"Input\", props)\n const { className, children, ...rest } = omitThemeProps(props)\n\n const [vars, variableProps] = useCreateVars({ ...styles.field, ...rest }, [\n \"minHeight\",\n \"minH\",\n \"height\",\n \"h\",\n ])\n const minHeight = variableProps.minHeight ?? variableProps.minH\n const height = variableProps.height ?? variableProps.h\n const fieldHeight = minHeight ?? height\n\n const css: CSSUIObject = {\n width: \"100%\",\n display: \"flex\",\n position: \"relative\",\n vars,\n ...styles.container,\n }\n\n const groupProps: CSSUIProps = {}\n\n const validChildren = getValidChildren(children)\n\n validChildren.forEach((child: any) => {\n if (fieldHeight && child.type === InputLeftElement)\n groupProps.paddingStart = `${fieldHeight} !important`\n\n if (fieldHeight && child.type === InputRightElement)\n groupProps.paddingEnd = `${fieldHeight} !important`\n\n if (child.type === InputLeftAddon) groupProps.roundedLeft = \"0px !important\"\n\n if (child.type === InputRightAddon)\n groupProps.roundedRight = \"0px !important\"\n })\n\n const cloneChildren = validChildren.map((child) => {\n const isAddonElement = [\n InputLeftAddon,\n InputRightAddon,\n InputLeftElement,\n InputRightElement,\n ].some((type) => child.type === type)\n\n if (isAddonElement) {\n return child\n } else {\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 cloneElement(child, Object.assign(childProps, groupProps))\n }\n })\n\n return (\n <InputGroupProvider value={{ styles, fieldHeight }}>\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-context\"\n\ninterface InputAddonOptions {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport interface InputAddonProps extends HTMLUIProps, 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: \"0px !important\",\n },\n right: {\n ms: \"-1px\",\n roundedLeft: \"0px !important\",\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 } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n styles: { [key: string]: CSSUIObject }\n fieldHeight: string | undefined\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\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-context\"\n\ninterface 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 interface InputElementProps extends HTMLUIProps, InputElementOptions {}\n\nconst InputElement = forwardRef<InputElementProps, \"div\">(\n ({ className, isClick = false, placement = \"left\", ...rest }, ref) => {\n const { styles, fieldHeight } = 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: fieldHeight,\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;AAMA,IAAAA,eAMO;AACP,IAAAC,gBAAsD;AACtD,mBAA6B;;;ACb7B,kBAA+B;AAC/B,IAAAC,gBAAmB;;;ACDnB,mBAA8B;AAOvB,IAAM,CAAC,oBAAoB,aAAa,QAC7C,4BAAiC;AAAA,EAC/B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;AD8BG;AA1BN,IAAM,iBAAa;AAAA,EACjB,CAAC,EAAE,WAAW,YAAY,QAAQ,GAAG,KAAK,GAAG,QAAQ;AACnD,UAAM,EAAE,OAAO,IAAI,cAAc;AAEjC,UAAM,kBAAkB;AAAA,MACtB,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,cAAc;AAAA,MAChB;AAAA,MACA,OAAO;AAAA,QACL,IAAI;AAAA,QACJ,aAAa;AAAA,MACf;AAAA,IACF;AAEA,UAAM,MAAmB;AAAA,MACvB,MAAM;AAAA,MACN,GAAG;AAAA,MACH,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,GAAG,OAAO;AAAA,MACV,GAAG,gBAAgB,SAAS;AAAA,IAC9B;AAEA,WACE;AAAA,MAAC,eAAG;AAAA,MAAH;AAAA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e,GAAG,WAAW;AAE1C,QAAI,eAAe,MAAM,SAAS;AAChC,iBAAW,aAAa,GAAG,WAAW;AAExC,QAAI,MAAM,SAAS,eAAgB,YAAW,cAAc;AAE5D,QAAI,MAAM,SAAS;AACjB,iBAAW,eAAe;AAAA,EAC9B,CAAC;AAED,QAAM,gBAAgB,cAAc,IAAI,CAAC,UAAU;AA5DrD,QAAAC,KAAAC,KAAA;AA6DI,UAAM,iBAAiB;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,CAAC,SAAS,MAAM,SAAS,IAAI;AAEpC,QAAI,gBAAgB;AAClB,aAAO;AAAA,IACT,OAAO;AACL,YAAM,iBAAa,+BAAgB;AAAA,QACjC,OAAMA,OAAAD,MAAA,MAAM,UAAN,gBAAAA,IAAa,SAAb,OAAAC,MAAqB,MAAM;AAAA,QACjC,UAAS,iBAAM,UAAN,mBAAa,YAAb,YAAwB,MAAM;AAAA,QACvC,GAAG,MAAM;AAAA,MACX,CAAC;AAED,iBAAO,2BAAa,OAAO,OAAO,OAAO,YAAY,UAAU,CAAC;AAAA,IAClE;AAAA,EACF,CAAC;AAED,SACE,6CAAC,sBAAmB,OAAO,EAAE,QAAQ,YAAY,GAC/C;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_utils","import_core","import_utils","import_jsx_runtime","import_jsx_runtime","_a","_b"]}
@@ -1,11 +1,10 @@
1
1
  "use client"
2
2
  import {
3
3
  InputGroup
4
- } from "./chunk-3AEWRGHP.mjs";
5
- import "./chunk-OYJRHTQL.mjs";
6
- import "./chunk-ITQBVWTU.mjs";
7
- import "./chunk-ZNGNHH5S.mjs";
8
- import "./chunk-ZARK2Q4J.mjs";
4
+ } from "./chunk-S3TRD6FG.mjs";
5
+ import "./chunk-OEJ5NONO.mjs";
6
+ import "./chunk-Q6WRYI3A.mjs";
7
+ import "./chunk-5UF5TTHV.mjs";
9
8
  export {
10
9
  InputGroup
11
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/input",
3
- "version": "1.0.42-dev-20240919162215",
3
+ "version": "1.0.42-dev-20240920025829",
4
4
  "description": "Yamada UI input component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -36,11 +36,11 @@
36
36
  "url": "https://github.com/yamada-ui/yamada-ui/issues"
37
37
  },
38
38
  "dependencies": {
39
- "@yamada-ui/core": "1.15.0-dev-20240919162215",
40
- "@yamada-ui/file-input": "1.0.42-dev-20240919162215",
41
- "@yamada-ui/form-control": "2.1.2-dev-20240919162215",
42
- "@yamada-ui/use-token": "1.1.25-dev-20240919162215",
43
- "@yamada-ui/utils": "1.5.1-dev-20240919162215"
39
+ "@yamada-ui/core": "1.15.0-dev-20240920025829",
40
+ "@yamada-ui/file-input": "1.0.42-dev-20240920025829",
41
+ "@yamada-ui/form-control": "2.1.2-dev-20240920025829",
42
+ "@yamada-ui/use-token": "1.1.25-dev-20240920025829",
43
+ "@yamada-ui/utils": "1.5.1-dev-20240920025829"
44
44
  },
45
45
  "devDependencies": {
46
46
  "clean-package": "2.2.0",
@@ -1,76 +0,0 @@
1
- "use client"
2
- import {
3
- InputLeftAddon,
4
- InputRightAddon
5
- } from "./chunk-OYJRHTQL.mjs";
6
- import {
7
- InputLeftElement,
8
- InputRightElement
9
- } from "./chunk-ITQBVWTU.mjs";
10
- import {
11
- InputGroupProvider
12
- } from "./chunk-ZNGNHH5S.mjs";
13
- import {
14
- Input
15
- } from "./chunk-ZARK2Q4J.mjs";
16
-
17
- // src/input-group.tsx
18
- import {
19
- ui,
20
- forwardRef,
21
- useComponentMultiStyle,
22
- omitThemeProps
23
- } from "@yamada-ui/core";
24
- import { FileInput } from "@yamada-ui/file-input";
25
- import { useToken } from "@yamada-ui/use-token";
26
- import { cx, filterUndefined, getValidChildren } from "@yamada-ui/utils";
27
- import { cloneElement } from "react";
28
- import { jsx } from "react/jsx-runtime";
29
- var InputGroup = forwardRef((props, ref) => {
30
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
31
- const [styles] = useComponentMultiStyle("Input", props);
32
- const { className, children, ...rest } = omitThemeProps(props);
33
- const css = {
34
- width: "100%",
35
- display: "flex",
36
- position: "relative",
37
- ...styles.container
38
- };
39
- const groupProps = {};
40
- const minHeight = (_g = (_e = useToken("sizes", (_c = (_a = styles.field) == null ? void 0 : _a.minHeight) != null ? _c : (_b = styles.field) == null ? void 0 : _b.minH)) != null ? _e : (_d = styles.field) == null ? void 0 : _d.minHeight) != null ? _g : (_f = styles.field) == null ? void 0 : _f.minH;
41
- const height = (_n = (_l = useToken("sizes", (_j = (_h = styles.field) == null ? void 0 : _h.height) != null ? _j : (_i = styles.field) == null ? void 0 : _i.h)) != null ? _l : (_k = styles.field) == null ? void 0 : _k.height) != null ? _n : (_m = styles.field) == null ? void 0 : _m.h;
42
- const validChildren = getValidChildren(children);
43
- validChildren.forEach((child) => {
44
- if ((minHeight || height) && child.type === InputLeftElement)
45
- groupProps.paddingStart = height != null ? height : minHeight;
46
- if ((minHeight || height) && child.type === InputRightElement)
47
- groupProps.paddingEnd = height != null ? height : minHeight;
48
- if (child.type === InputLeftAddon) groupProps.roundedLeft = 0;
49
- if (child.type === InputRightAddon) groupProps.roundedRight = 0;
50
- });
51
- const cloneChildren = validChildren.map((child) => {
52
- var _a2, _b2;
53
- const childProps = filterUndefined({
54
- size: ((_a2 = child.props) == null ? void 0 : _a2.size) || props.size,
55
- variant: ((_b2 = child.props) == null ? void 0 : _b2.variant) || props.variant,
56
- ...child.props
57
- });
58
- return child.type !== Input && child.type !== FileInput ? cloneElement(child, childProps) : cloneElement(child, Object.assign(childProps, groupProps));
59
- });
60
- return /* @__PURE__ */ jsx(InputGroupProvider, { value: styles, children: /* @__PURE__ */ jsx(
61
- ui.div,
62
- {
63
- ref,
64
- className: cx("ui-input-group", className),
65
- role: "group",
66
- __css: css,
67
- ...rest,
68
- children: cloneChildren
69
- }
70
- ) });
71
- });
72
-
73
- export {
74
- InputGroup
75
- };
76
- //# sourceMappingURL=chunk-3AEWRGHP.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/input-group.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n CSSUIProps,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useComponentMultiStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { FileInput } from \"@yamada-ui/file-input\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport { cx, filterUndefined, getValidChildren } from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport { Input } from \"./input\"\nimport { InputLeftAddon, InputRightAddon } from \"./input-addon\"\nimport { InputGroupProvider } from \"./input-context\"\nimport { InputRightElement, InputLeftElement } from \"./input-element\"\n\nexport interface InputGroupProps extends HTMLUIProps, ThemeProps<\"Input\"> {}\n\nexport const InputGroup = forwardRef<InputGroupProps, \"div\">((props, ref) => {\n const [styles] = useComponentMultiStyle(\"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"],"mappings":";;;;;;;;;;;;;;;;;AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,IAAI,iBAAiB,wBAAwB;AACtD,SAAS,oBAAoB;AAwDvB;AAhDC,IAAM,aAAa,WAAmC,CAAC,OAAO,QAAQ;AAvB7E;AAwBE,QAAM,CAAC,MAAM,IAAI,uBAAuB,SAAS,KAAK;AACtD,QAAM,EAAE,WAAW,UAAU,GAAG,KAAK,IAAI,eAAe,KAAK;AAE7D,QAAM,MAAmB;AAAA,IACvB,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,GAAG,OAAO;AAAA,EACZ;AACA,QAAM,aAAyB,CAAC;AAChC,QAAM,aACJ,oBAAS,UAAU,kBAAO,UAAP,mBAAc,cAAd,aAA2B,YAAO,UAAP,mBAAc,IAAY,MAAxE,aACA,YAAO,UAAP,mBAAc,cADd,aAEA,YAAO,UAAP,mBAAc;AAChB,QAAM,UACJ,oBAAS,UAAU,kBAAO,UAAP,mBAAc,WAAd,aAAwB,YAAO,UAAP,mBAAc,CAAS,MAAlE,aACA,YAAO,UAAP,mBAAc,WADd,aAEA,YAAO,UAAP,mBAAc;AAEhB,QAAM,gBAAgB,iBAAiB,QAAQ;AAE/C,gBAAc,QAAQ,CAAC,UAAe;AACpC,SAAK,aAAa,WAAW,MAAM,SAAS;AAC1C,iBAAW,eAAe,0BAAU;AAEtC,SAAK,aAAa,WAAW,MAAM,SAAS;AAC1C,iBAAW,aAAa,0BAAU;AAEpC,QAAI,MAAM,SAAS,eAAgB,YAAW,cAAc;AAE5D,QAAI,MAAM,SAAS,gBAAiB,YAAW,eAAe;AAAA,EAChE,CAAC;AAED,QAAM,gBAAgB,cAAc,IAAI,CAAC,UAAU;AAzDrD,QAAAA,KAAAC;AA0DI,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,oBAAC,sBAAmB,OAAO,QACzB;AAAA,IAAC,GAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,WAAW,GAAG,kBAAkB,SAAS;AAAA,MACzC,MAAK;AAAA,MACL,OAAO;AAAA,MACN,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;","names":["_a","_b"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../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-context\"\n\ninterface 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 interface InputElementProps extends HTMLUIProps, 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":";;;;;;AACA,SAAS,IAAI,kBAAkB;AAC/B,SAAS,UAAU;AA6Cb;AAzBN,IAAM,eAAe;AAAA,EACnB,CAAC,EAAE,WAAW,UAAU,OAAO,YAAY,QAAQ,GAAG,KAAK,GAAG,QAAQ;AAvBxE;AAwBI,UAAM,SAAS,cAAc;AAE7B,UAAM,MAAmB;AAAA,MACvB,UAAU;AAAA,MACV,KAAK;AAAA,MACL,CAAC,cAAc,SAAS,eAAe,UAAU,GAAG;AAAA,MACpD,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,IACE,8BAAO,UAAP,mBAAc,WAAd,aACA,YAAO,UAAP,mBAAc,MADd,aAEA,YAAO,UAAP,mBAAc,cAFd,aAGA,YAAO,UAAP,mBAAc;AAAA,MAChB,GAAG;AAAA,MACH,WAAU,YAAO,UAAP,mBAAc;AAAA,MACxB,eAAe,UAAU,SAAS;AAAA,MAClC,QAAQ,UAAU,YAAY;AAAA,MAC9B,GAAG,OAAO;AAAA,IACZ;AAEA,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,qBAAqB,SAAS;AAAA,QAC5C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,mBAAmB;AAAA,EAC9B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,2BAA2B,SAAS;AAAA,QAClD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,oBAAoB;AAAA,EAC/B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,4BAA4B,SAAS;AAAA,QACnD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../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-context\"\n\ninterface InputAddonOptions {\n /**\n * The placement of the element.\n *\n * @default 'left'\n */\n placement?: \"left\" | \"right\"\n}\n\nexport interface InputAddonProps extends HTMLUIProps, 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":";;;;;;AACA,SAAS,IAAI,kBAAkB;AAC/B,SAAS,UAAU;AA0Cb;AA5BN,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,MAAM;AAAA,MACN,GAAG;AAAA,MACH,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,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,GAAG,yBAAyB,SAAS;AAAA,QAChD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEO,IAAM,kBAAkB;AAAA,EAC7B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,0BAA0B,SAAS;AAAA,QACjD,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/input-context.tsx"],"sourcesContent":["import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface InputGroupContext {\n [key: string]: CSSUIObject\n}\n\nexport const [InputGroupProvider, useInputGroup] =\n createContext<InputGroupContext>({\n name: \"InputGroupContext\",\n errorMessage: `useInputGroup returned is 'undefined'. Seems you forgot to wrap the components in \"<InputGroup />\" `,\n })\n"],"mappings":";;;AACA,SAAS,qBAAqB;AAMvB,IAAM,CAAC,oBAAoB,aAAa,IAC7C,cAAiC;AAAA,EAC/B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;","names":[]}