@tiny-design/react 1.0.10 → 1.0.11

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.
@@ -14,11 +14,15 @@ const InputGroupAddon = (props) => {
14
14
  className: cls,
15
15
  style,
16
16
  children: React.Children.map(children, (child) => {
17
- const childProps = {
18
- disabled,
19
- size: inputSize
20
- };
21
- return React.cloneElement(child, childProps);
17
+ const displayName = child.type?.displayName;
18
+ if (displayName === "Input" || displayName === "Button" || displayName === "Select") {
19
+ const childProps = {
20
+ disabled,
21
+ size: inputSize
22
+ };
23
+ return React.cloneElement(child, childProps);
24
+ }
25
+ return child;
22
26
  })
23
27
  });
24
28
  return /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"input-group-addon.js","names":[],"sources":["../../src/input/input-group-addon.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { InputGroupAddonProps, InputProps } from './types';\nimport { SizeType } from '../_utils/props';\n\nconst InputGroupAddon = (props: InputGroupAddonProps): React.ReactElement => {\n const {\n disabled = false,\n size = 'md',\n noBorder,\n className,\n style,\n children,\n prefixCls: customisedCls,\n ...otherProps\n } = props;\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('input-group-addon', configContext.prefixCls, customisedCls);\n const inputSize = props.size || configContext.componentSize || size;\n const cls = classNames(prefixCls, className, `${prefixCls}_${inputSize}`, {\n [`${prefixCls}_no-border`]: noBorder,\n });\n\n if (React.isValidElement(children)) {\n return (\n <div className={cls} style={style}>\n {React.Children.map(children, (child: React.ReactElement) => {\n const childProps: Partial<InputProps> = {\n disabled,\n size: inputSize as SizeType,\n };\n return React.cloneElement(child, childProps);\n })}\n </div>\n );\n }\n return (\n <div {...otherProps} className={cls} style={style}>\n {children}\n </div>\n );\n};\n\nInputGroupAddon.displayName = 'InputGroupAddon';\n\nexport default InputGroupAddon;\n"],"mappings":";;;;;;AAOA,MAAM,mBAAmB,UAAoD;CAC3E,MAAM,EACJ,WAAW,OACX,OAAO,MACP,UACA,WACA,OACA,UACA,WAAW,eACX,GAAG,eACD;CACJ,MAAM,gBAAgB,WAAW,cAAc;CAC/C,MAAM,YAAY,aAAa,qBAAqB,cAAc,WAAW,cAAc;CAC3F,MAAM,YAAY,MAAM,QAAQ,cAAc,iBAAiB;CAC/D,MAAM,MAAM,WAAW,WAAW,WAAW,GAAG,UAAU,GAAG,aAAa,GACvE,GAAG,UAAU,cAAc,UAC7B,CAAC;AAEF,KAAI,MAAM,eAAe,SAAS,CAChC,QACE,oBAAC,OAAD;EAAK,WAAW;EAAY;YACzB,MAAM,SAAS,IAAI,WAAW,UAA8B;GAC3D,MAAM,aAAkC;IACtC;IACA,MAAM;IACP;AACD,UAAO,MAAM,aAAa,OAAO,WAAW;IAC5C;EACE,CAAA;AAGV,QACE,oBAAC,OAAD;EAAK,GAAI;EAAY,WAAW;EAAY;EACzC;EACG,CAAA;;AAIV,gBAAgB,cAAc"}
1
+ {"version":3,"file":"input-group-addon.js","names":[],"sources":["../../src/input/input-group-addon.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { InputGroupAddonProps, InputProps } from './types';\nimport { SizeType } from '../_utils/props';\n\nconst InputGroupAddon = (props: InputGroupAddonProps): React.ReactElement => {\n const {\n disabled = false,\n size = 'md',\n noBorder,\n className,\n style,\n children,\n prefixCls: customisedCls,\n ...otherProps\n } = props;\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('input-group-addon', configContext.prefixCls, customisedCls);\n const inputSize = props.size || configContext.componentSize || size;\n const cls = classNames(prefixCls, className, `${prefixCls}_${inputSize}`, {\n [`${prefixCls}_no-border`]: noBorder,\n });\n\n if (React.isValidElement(children)) {\n return (\n <div className={cls} style={style}>\n {React.Children.map(children, (child: React.ReactElement) => {\n const displayName = (child.type as any)?.displayName;\n if (displayName === 'Input' || displayName === 'Button' || displayName === 'Select') {\n const childProps: Partial<InputProps> = {\n disabled,\n size: inputSize as SizeType,\n };\n return React.cloneElement(child, childProps);\n }\n return child;\n })}\n </div>\n );\n }\n return (\n <div {...otherProps} className={cls} style={style}>\n {children}\n </div>\n );\n};\n\nInputGroupAddon.displayName = 'InputGroupAddon';\n\nexport default InputGroupAddon;\n"],"mappings":";;;;;;AAOA,MAAM,mBAAmB,UAAoD;CAC3E,MAAM,EACJ,WAAW,OACX,OAAO,MACP,UACA,WACA,OACA,UACA,WAAW,eACX,GAAG,eACD;CACJ,MAAM,gBAAgB,WAAW,cAAc;CAC/C,MAAM,YAAY,aAAa,qBAAqB,cAAc,WAAW,cAAc;CAC3F,MAAM,YAAY,MAAM,QAAQ,cAAc,iBAAiB;CAC/D,MAAM,MAAM,WAAW,WAAW,WAAW,GAAG,UAAU,GAAG,aAAa,GACvE,GAAG,UAAU,cAAc,UAC7B,CAAC;AAEF,KAAI,MAAM,eAAe,SAAS,CAChC,QACE,oBAAC,OAAD;EAAK,WAAW;EAAY;YACzB,MAAM,SAAS,IAAI,WAAW,UAA8B;GAC3D,MAAM,cAAe,MAAM,MAAc;AACzC,OAAI,gBAAgB,WAAW,gBAAgB,YAAY,gBAAgB,UAAU;IACnF,MAAM,aAAkC;KACtC;KACA,MAAM;KACP;AACD,WAAO,MAAM,aAAa,OAAO,WAAW;;AAE9C,UAAO;IACP;EACE,CAAA;AAGV,QACE,oBAAC,OAAD;EAAK,GAAI;EAAY,WAAW;EAAY;EACzC;EACG,CAAA;;AAIV,gBAAgB,cAAc"}
@@ -17,11 +17,15 @@ const InputGroupAddon = (props) => {
17
17
  className: cls,
18
18
  style,
19
19
  children: react.default.Children.map(children, (child) => {
20
- const childProps = {
21
- disabled,
22
- size: inputSize
23
- };
24
- return react.default.cloneElement(child, childProps);
20
+ const displayName = child.type?.displayName;
21
+ if (displayName === "Input" || displayName === "Button" || displayName === "Select") {
22
+ const childProps = {
23
+ disabled,
24
+ size: inputSize
25
+ };
26
+ return react.default.cloneElement(child, childProps);
27
+ }
28
+ return child;
25
29
  })
26
30
  });
27
31
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"input-group-addon.js","names":["ConfigContext","getPrefixCls","React"],"sources":["../../src/input/input-group-addon.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { InputGroupAddonProps, InputProps } from './types';\nimport { SizeType } from '../_utils/props';\n\nconst InputGroupAddon = (props: InputGroupAddonProps): React.ReactElement => {\n const {\n disabled = false,\n size = 'md',\n noBorder,\n className,\n style,\n children,\n prefixCls: customisedCls,\n ...otherProps\n } = props;\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('input-group-addon', configContext.prefixCls, customisedCls);\n const inputSize = props.size || configContext.componentSize || size;\n const cls = classNames(prefixCls, className, `${prefixCls}_${inputSize}`, {\n [`${prefixCls}_no-border`]: noBorder,\n });\n\n if (React.isValidElement(children)) {\n return (\n <div className={cls} style={style}>\n {React.Children.map(children, (child: React.ReactElement) => {\n const childProps: Partial<InputProps> = {\n disabled,\n size: inputSize as SizeType,\n };\n return React.cloneElement(child, childProps);\n })}\n </div>\n );\n }\n return (\n <div {...otherProps} className={cls} style={style}>\n {children}\n </div>\n );\n};\n\nInputGroupAddon.displayName = 'InputGroupAddon';\n\nexport default InputGroupAddon;\n"],"mappings":";;;;;;;;;AAOA,MAAM,mBAAmB,UAAoD;CAC3E,MAAM,EACJ,WAAW,OACX,OAAO,MACP,UACA,WACA,OACA,UACA,WAAW,eACX,GAAG,eACD;CACJ,MAAM,iBAAA,GAAA,MAAA,YAA2BA,uBAAAA,cAAc;CAC/C,MAAM,YAAYC,gBAAAA,aAAa,qBAAqB,cAAc,WAAW,cAAc;CAC3F,MAAM,YAAY,MAAM,QAAQ,cAAc,iBAAiB;CAC/D,MAAM,OAAA,GAAA,WAAA,SAAiB,WAAW,WAAW,GAAG,UAAU,GAAG,aAAa,GACvE,GAAG,UAAU,cAAc,UAC7B,CAAC;AAEF,KAAIC,MAAAA,QAAM,eAAe,SAAS,CAChC,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,WAAW;EAAY;YACzBA,MAAAA,QAAM,SAAS,IAAI,WAAW,UAA8B;GAC3D,MAAM,aAAkC;IACtC;IACA,MAAM;IACP;AACD,UAAOA,MAAAA,QAAM,aAAa,OAAO,WAAW;IAC5C;EACE,CAAA;AAGV,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,GAAI;EAAY,WAAW;EAAY;EACzC;EACG,CAAA;;AAIV,gBAAgB,cAAc"}
1
+ {"version":3,"file":"input-group-addon.js","names":["ConfigContext","getPrefixCls","React"],"sources":["../../src/input/input-group-addon.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { InputGroupAddonProps, InputProps } from './types';\nimport { SizeType } from '../_utils/props';\n\nconst InputGroupAddon = (props: InputGroupAddonProps): React.ReactElement => {\n const {\n disabled = false,\n size = 'md',\n noBorder,\n className,\n style,\n children,\n prefixCls: customisedCls,\n ...otherProps\n } = props;\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('input-group-addon', configContext.prefixCls, customisedCls);\n const inputSize = props.size || configContext.componentSize || size;\n const cls = classNames(prefixCls, className, `${prefixCls}_${inputSize}`, {\n [`${prefixCls}_no-border`]: noBorder,\n });\n\n if (React.isValidElement(children)) {\n return (\n <div className={cls} style={style}>\n {React.Children.map(children, (child: React.ReactElement) => {\n const displayName = (child.type as any)?.displayName;\n if (displayName === 'Input' || displayName === 'Button' || displayName === 'Select') {\n const childProps: Partial<InputProps> = {\n disabled,\n size: inputSize as SizeType,\n };\n return React.cloneElement(child, childProps);\n }\n return child;\n })}\n </div>\n );\n }\n return (\n <div {...otherProps} className={cls} style={style}>\n {children}\n </div>\n );\n};\n\nInputGroupAddon.displayName = 'InputGroupAddon';\n\nexport default InputGroupAddon;\n"],"mappings":";;;;;;;;;AAOA,MAAM,mBAAmB,UAAoD;CAC3E,MAAM,EACJ,WAAW,OACX,OAAO,MACP,UACA,WACA,OACA,UACA,WAAW,eACX,GAAG,eACD;CACJ,MAAM,iBAAA,GAAA,MAAA,YAA2BA,uBAAAA,cAAc;CAC/C,MAAM,YAAYC,gBAAAA,aAAa,qBAAqB,cAAc,WAAW,cAAc;CAC3F,MAAM,YAAY,MAAM,QAAQ,cAAc,iBAAiB;CAC/D,MAAM,OAAA,GAAA,WAAA,SAAiB,WAAW,WAAW,GAAG,UAAU,GAAG,aAAa,GACvE,GAAG,UAAU,cAAc,UAC7B,CAAC;AAEF,KAAIC,MAAAA,QAAM,eAAe,SAAS,CAChC,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,WAAW;EAAY;YACzBA,MAAAA,QAAM,SAAS,IAAI,WAAW,UAA8B;GAC3D,MAAM,cAAe,MAAM,MAAc;AACzC,OAAI,gBAAgB,WAAW,gBAAgB,YAAY,gBAAgB,UAAU;IACnF,MAAM,aAAkC;KACtC;KACA,MAAM;KACP;AACD,WAAOA,MAAAA,QAAM,aAAa,OAAO,WAAW;;AAE9C,UAAO;IACP;EACE,CAAA;AAGV,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,GAAI;EAAY,WAAW;EAAY;EACzC;EACG,CAAA;;AAIV,gBAAgB,cAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiny-design/react",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "A friendly UI component set for React",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -55,8 +55,8 @@
55
55
  "classnames": "^2.3.1",
56
56
  "react-transition-group": "^4.4.2",
57
57
  "tslib": "^2.3.1",
58
- "@tiny-design/icons": "1.0.10",
59
- "@tiny-design/tokens": "1.0.10"
58
+ "@tiny-design/icons": "1.0.11",
59
+ "@tiny-design/tokens": "1.0.11"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@testing-library/jest-dom": "^6.0.0",