@consta/uikit 5.24.2 → 5.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AutoCompleteCanary/index.d.ts +1 -0
- package/AutoCompleteCanary/index.js +1 -0
- package/Banner/index.d.ts +1 -0
- package/Banner/index.js +1 -0
- package/__internal__/src/components/AutoCompleteCanary/{AutoComplete.js → AutoCompleteCanary.js} +1 -1
- package/__internal__/src/components/AutoCompleteCanary/AutoCompleteCanary.js.map +1 -0
- package/__internal__/src/components/AutoCompleteCanary/index.d.ts +1 -1
- package/__internal__/src/components/AutoCompleteCanary/index.js +1 -1
- package/__internal__/src/components/AutoCompleteCanary/index.js.map +1 -1
- package/__internal__/src/components/Banner/Banner.css +1 -0
- package/__internal__/src/components/Banner/Banner.d.ts +32 -0
- package/__internal__/src/components/Banner/Banner.js +2 -0
- package/__internal__/src/components/Banner/Banner.js.map +1 -0
- package/__internal__/src/components/Banner/index.d.ts +1 -0
- package/__internal__/src/components/Banner/index.js +2 -0
- package/__internal__/src/components/Banner/index.js.map +1 -0
- package/__internal__/src/components/Button/Button.js +1 -1
- package/__internal__/src/components/Button/Button.js.map +1 -1
- package/package.json +1 -1
- package/__internal__/src/components/AutoCompleteCanary/AutoComplete.js.map +0 -1
- /package/__internal__/src/components/AutoCompleteCanary/{AutoComplete.d.ts → AutoCompleteCanary.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../__internal__/src/components/AutoCompleteCanary";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../__internal__/src/components/AutoCompleteCanary";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../__internal__/src/components/Banner";
|
package/Banner/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../__internal__/src/components/Banner";
|
package/__internal__/src/components/AutoCompleteCanary/{AutoComplete.js → AutoCompleteCanary.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from"react";import{cnCanary}from"../../utils/bem";import{AutoCompleteTypeText}from"./AutoCompleteTypeText";import{AutoCompleteTypeTextArray}from"./AutoCompleteTypeTextArray";var typeMap={text:AutoCompleteTypeText,textarray:AutoCompleteTypeTextArray};export var cnAutoComplete=cnCanary("AutoComplete");var AutoCompleteRender=function(a,b){var c=a.type||"text",d=typeMap[c]||typeMap.text;return React.createElement(d,Object.assign({},a,{ref:b,className:cnAutoComplete({type:c},[a.className])}))};export var AutoComplete=React.forwardRef(AutoCompleteRender);export*from"./types";
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=AutoCompleteCanary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoCompleteCanary.js","names":["React","cnCanary","AutoCompleteTypeText","AutoCompleteTypeTextArray","typeMap","text","textarray","cnAutoComplete","AutoCompleteRender","props","ref","type","Component","className","AutoComplete","forwardRef"],"sources":["../../../../../src/components/AutoCompleteCanary/AutoCompleteCanary.tsx"],"sourcesContent":["import React from 'react';\n\nimport { cnCanary } from '##/utils/bem';\n\nimport { AutoCompleteTypeText } from './AutoCompleteTypeText';\nimport { AutoCompleteTypeTextArray } from './AutoCompleteTypeTextArray';\nimport {\n AutoCompleteComponent,\n AutoCompleteGroupDefault,\n AutoCompleteItemDefault,\n AutoCompleteProps,\n AutoCompleteTypeComponent,\n} from './types';\n\nconst typeMap: Record<\n string,\n AutoCompleteTypeComponent<string> | AutoCompleteTypeComponent<'textarray'>\n> = {\n text: AutoCompleteTypeText,\n textarray: AutoCompleteTypeTextArray,\n};\n\nexport const cnAutoComplete = cnCanary('AutoComplete');\n\nconst AutoCompleteRender = <\n TYPE extends string,\n ITEM = AutoCompleteItemDefault,\n GROUP = AutoCompleteGroupDefault,\n>(\n props: AutoCompleteProps<TYPE, ITEM, GROUP>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const type = props.type || 'text';\n const Component = typeMap[type] || typeMap.text;\n\n return (\n <Component\n {...(props as unknown as AutoCompleteTypeComponent<TYPE, ITEM, GROUP>)}\n ref={ref}\n className={cnAutoComplete({ type }, [props.className])}\n />\n );\n};\n\nexport const AutoComplete = React.forwardRef(\n AutoCompleteRender,\n) as AutoCompleteComponent;\n\nexport * from './types';\n"],"mappings":"AAAA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,QAAT,uBAEA,OAASC,oBAAT,8BACA,OAASC,yBAAT,mCASA,GAAMC,QAGL,CAAG,CACFC,IAAI,CAAEH,oBADJ,CAEFI,SAAS,CAAEH,yBAFT,CAHJ,CAQA,MAAO,IAAMI,eAAc,CAAGN,QAAQ,CAAC,cAAD,CAA/B,CAEP,GAAMO,mBAAkB,CAAG,SAKzBC,CALyB,CAMzBC,CANyB,CAOtB,IACGC,EAAI,CAAGF,CAAK,CAACE,IAAN,EAAc,MADxB,CAEGC,CAAS,CAAGR,OAAO,CAACO,CAAD,CAAP,EAAiBP,OAAO,CAACC,IAFxC,CAIH,MACE,qBAAC,CAAD,kBACOI,CADP,EAEE,GAAG,CAAEC,CAFP,CAGE,SAAS,CAAEH,cAAc,CAAC,CAAEI,IAAI,CAAJA,CAAF,CAAD,CAAW,CAACF,CAAK,CAACI,SAAP,CAAX,CAH3B,GAMH,CAlBD,CAoBA,MAAO,IAAMC,aAAY,CAAGd,KAAK,CAACe,UAAN,CAC1BP,kBAD0B,CAArB,CAIP"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './AutoCompleteCanary';
|
|
2
2
|
export * from './types';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"./
|
|
1
|
+
export*from"./AutoCompleteCanary";export*from"./types";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/AutoCompleteCanary/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/AutoCompleteCanary/index.ts"],"sourcesContent":["export * from './AutoCompleteCanary';\nexport * from './types';\n"],"mappings":"AAAA,kCACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.Banner{--banner-bg-opacity:30%;--banner-height:calc(var(--banner-inner-height) + var(--space-padding-top) + var(--space-padding-bottom));color:var(--color-typo-primary);min-height:var(--banner-height)}.Banner_form_default{border-radius:var(--space-xs)}.Banner_form_round{border-radius:calc(var(--banner-height)/2)}.Banner_view_filled{background-color:var(--banner-bg-color)}.Banner_view_ghost{background-color:color-mix(in srgb,var(--banner-bg-color) var(--banner-bg-opacity),var(--color-bg-default))}.Banner-Icon.icons--Icon{display:flex}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import './Banner.css';
|
|
2
|
+
import { IconComponent } from '@consta/icons/Icon';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { MixSpaceProps, Space } from '../../mixs/MixSpace';
|
|
5
|
+
import { PropsWithJsxAttributes } from '../../utils/types/PropsWithJsxAttributes';
|
|
6
|
+
export type BannerProps = PropsWithJsxAttributes<{
|
|
7
|
+
leftSide?: React.ReactNode;
|
|
8
|
+
rightSide?: React.ReactNode;
|
|
9
|
+
icon?: IconComponent;
|
|
10
|
+
size?: 'xs' | 's' | 'm' | 'l';
|
|
11
|
+
view?: 'filled' | 'ghost' | 'transparent';
|
|
12
|
+
space?: MixSpaceProps;
|
|
13
|
+
itemsGap?: Space | [Space, Space];
|
|
14
|
+
status?: 'normal' | 'warning' | 'alert' | 'success' | 'system';
|
|
15
|
+
form?: 'default' | 'round' | 'brick';
|
|
16
|
+
}>;
|
|
17
|
+
export declare const cnBanner: import("@bem-react/classname").ClassNameFormatter;
|
|
18
|
+
/**
|
|
19
|
+
* Компонент Banner, отображающий содержимое слева и справа.
|
|
20
|
+
* Поддерживает иконки, размеры, виды, статусы и формы.
|
|
21
|
+
*
|
|
22
|
+
* @property {React.ReactNode} [leftSide] - Содержимое на левой стороне.
|
|
23
|
+
* @property {React.ReactNode} [rightSide] - Содержимое на правой стороне.
|
|
24
|
+
* @property {IconComponent} [icon] - Иконка.
|
|
25
|
+
* @property {'xs' | 's' | 'm' | 'l'} [size] - Размер компонента.
|
|
26
|
+
* @property {'filled' | 'ghost' | 'transparent'} [view] - Визуальный стиль.
|
|
27
|
+
* @property {MixSpaceProps} [space] - Параметры отступов.
|
|
28
|
+
* @property {Space | [Space, Space]} [itemsGap] - Отступы между элементами.
|
|
29
|
+
* @property {'normal' | 'warning' | 'alert' | 'success' | 'system'} [status] - Статус (цветовая схема).
|
|
30
|
+
* @property {'default' | 'round' | 'brick'} [form] - Форма компонента.
|
|
31
|
+
*/
|
|
32
|
+
export declare const Banner: React.ForwardRefExoticComponent<Omit<BannerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./Banner.css";import React,{forwardRef}from"react";import{cnText,Text}from"../Text";import{useTheme}from"../Theme/Theme";import{cnMixFlex}from"../../mixs/MixFlex";import{cnMixSpace}from"../../mixs/MixSpace";import{cn}from"../../utils/bem";import{isNotNil,isString}from"../../utils/type-guards";export var cnBanner=cn("Banner");var SlotWrapper=function(a){var b=a.children;return React.createElement("div",{className:cnBanner("Slot")},b)},renderSlot=function(a,b,c){return isString(a)?React.createElement(SlotWrapper,{key:cnBanner("Slot",{index:b,position:c})},React.createElement(Text,{className:cnBanner("Text"),view:"primary",weight:0===b&&0===c?"bold":void 0,lineHeight:"m"},a)):React.createElement(SlotWrapper,{key:cnBanner("Slot",{index:b,position:c})},a)},renderSlots=function(a,b){return Array.isArray(a)?a.filter(isNotNil).map(function(a,c){return renderSlot(a,c,b)}):renderSlots([a],b)},getGap=function(a,b){return Array.isArray(a)?a[b]:a},textSizeMap={xs:"s",s:"s",m:"m",l:"l"},controlSizeMap={xs:"xs",s:"s",m:"s",l:"m"};export var Banner=forwardRef(function(a,b){var c,d=a.leftSide,e=a.rightSide,f=a.icon,g=a.size,h=void 0===g?"m":g,i=a.view,j=void 0===i?"filled":i,k=a.className,l=a.space,m=a.itemsGap,n=void 0===m?"s":m,o=a.status,p=void 0===o?"normal":o,q=a.style,r=a.form,s=void 0===r?"default":r,t=useTheme(),u=t.themeClassNames,v=[f?React.createElement(SlotWrapper,null,React.createElement(f,{className:cnBanner("Icon")})):null].concat(_toConsumableArray(renderSlots(d,0))).filter(isNotNil),w=renderSlots(e,1);return React.createElement("div",{className:cnBanner({view:j,form:s},[cnMixFlex({justify:w.length&&!v.length?"flex-end":"space-between",align:"center",gap:"m"}),cnMixSpace(l||{pH:h,pV:"xs"}),cnText({size:textSizeMap[h]}),"system"!==p&&"filled"===j?u.color.accent:void 0,k]),style:_objectSpread(_objectSpread({},q),{},(c={},_defineProperty(c,"--banner-bg-color","var(--color-bg-".concat(p,")")),_defineProperty(c,"--banner-inner-height","var(--control-height-".concat(controlSizeMap[h],")")),c)),ref:b},v.length?React.createElement("div",{className:cnMixFlex({gap:getGap(n,0),align:"center"})},v):void 0,w.length?React.createElement("div",{className:cnMixFlex({gap:getGap(n,1),align:"center"})},w):void 0)});
|
|
2
|
+
//# sourceMappingURL=Banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.js","names":["React","forwardRef","cnText","Text","useTheme","cnMixFlex","cnMixSpace","cn","isNotNil","isString","cnBanner","SlotWrapper","children","renderSlot","slot","index","position","renderSlots","Array","isArray","filter","map","item","getGap","gap","textSizeMap","xs","s","m","l","controlSizeMap","Banner","props","ref","leftSide","rightSide","Icon","icon","size","view","className","space","itemsGap","status","style","form","themeClassNames","leftSlots","rightSlots","justify","length","align","pH","pV","color","accent"],"sources":["../../../../../src/components/Banner/Banner.tsx"],"sourcesContent":["import './Banner.css';\n\nimport { IconComponent } from '@consta/icons/Icon';\nimport React, { forwardRef } from 'react';\n\nimport { cnText, Text } from '##/components/Text';\nimport { useTheme } from '##/components/Theme/Theme';\nimport { cnMixFlex } from '##/mixs/MixFlex';\nimport { cnMixSpace, MixSpaceProps, Space } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { isNotNil, isString } from '##/utils/type-guards';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nexport type BannerProps = PropsWithJsxAttributes<{\n leftSide?: React.ReactNode;\n rightSide?: React.ReactNode;\n icon?: IconComponent;\n size?: 'xs' | 's' | 'm' | 'l';\n view?: 'filled' | 'ghost' | 'transparent';\n space?: MixSpaceProps;\n itemsGap?: Space | [Space, Space];\n status?: 'normal' | 'warning' | 'alert' | 'success' | 'system';\n form?: 'default' | 'round' | 'brick';\n}>;\n\nexport const cnBanner = cn('Banner');\n\nconst SlotWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <div className={cnBanner('Slot')}>{children}</div>\n);\n\nconst renderSlot = (slot: React.ReactNode, index: number, position: number) => {\n if (isString(slot)) {\n return (\n <SlotWrapper key={cnBanner('Slot', { index, position })}>\n <Text\n className={cnBanner('Text')}\n view=\"primary\"\n weight={index === 0 && position === 0 ? 'bold' : undefined}\n lineHeight=\"m\"\n >\n {slot}\n </Text>\n </SlotWrapper>\n );\n }\n\n return (\n <SlotWrapper key={cnBanner('Slot', { index, position })}>\n {slot}\n </SlotWrapper>\n );\n};\n\nconst renderSlots = (slot: React.ReactNode, position: number) => {\n if (Array.isArray(slot)) {\n return slot\n .filter(isNotNil)\n .map((item, index) => renderSlot(item, index, position));\n }\n return renderSlots([slot], position);\n};\n\nconst getGap = (gap: Space | [Space, Space], index: number) => {\n if (Array.isArray(gap)) {\n return gap[index];\n }\n return gap;\n};\n\nconst textSizeMap = {\n xs: 's',\n s: 's',\n m: 'm',\n l: 'l',\n} as const;\n\nconst controlSizeMap = {\n xs: 'xs',\n s: 's',\n m: 's',\n l: 'm',\n} as const;\n\n/**\n * Компонент Banner, отображающий содержимое слева и справа.\n * Поддерживает иконки, размеры, виды, статусы и формы.\n *\n * @property {React.ReactNode} [leftSide] - Содержимое на левой стороне.\n * @property {React.ReactNode} [rightSide] - Содержимое на правой стороне.\n * @property {IconComponent} [icon] - Иконка.\n * @property {'xs' | 's' | 'm' | 'l'} [size] - Размер компонента.\n * @property {'filled' | 'ghost' | 'transparent'} [view] - Визуальный стиль.\n * @property {MixSpaceProps} [space] - Параметры отступов.\n * @property {Space | [Space, Space]} [itemsGap] - Отступы между элементами.\n * @property {'normal' | 'warning' | 'alert' | 'success' | 'system'} [status] - Статус (цветовая схема).\n * @property {'default' | 'round' | 'brick'} [form] - Форма компонента.\n */\n\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>((props, ref) => {\n const {\n leftSide,\n rightSide,\n icon: Icon,\n size = 'm',\n view = 'filled',\n className,\n space,\n itemsGap = 's',\n status = 'normal',\n style,\n form = 'default',\n } = props;\n\n const { themeClassNames } = useTheme();\n\n const leftSlots = [\n Icon ? (\n <SlotWrapper>\n <Icon className={cnBanner('Icon')} />\n </SlotWrapper>\n ) : null,\n ...renderSlots(leftSide, 0),\n ].filter(isNotNil);\n\n const rightSlots = renderSlots(rightSide, 1);\n\n return (\n <div\n className={cnBanner({ view, form }, [\n cnMixFlex({\n justify:\n rightSlots.length && !leftSlots.length\n ? 'flex-end'\n : 'space-between',\n align: 'center',\n gap: 'm',\n }),\n cnMixSpace(space || { pH: size, pV: 'xs' }),\n cnText({ size: textSizeMap[size] }),\n status !== 'system' && view === 'filled'\n ? themeClassNames.color.accent\n : undefined,\n className,\n ])}\n style={{\n ...style,\n ['--banner-bg-color' as string]: `var(--color-bg-${status})`,\n ['--banner-inner-height' as string]: `var(--control-height-${controlSizeMap[size]})`,\n }}\n ref={ref}\n >\n {leftSlots.length ? (\n <div\n className={cnMixFlex({ gap: getGap(itemsGap, 0), align: 'center' })}\n >\n {leftSlots}\n </div>\n ) : undefined}\n {rightSlots.length ? (\n <div\n className={cnMixFlex({ gap: getGap(itemsGap, 1), align: 'center' })}\n >\n {rightSlots}\n </div>\n ) : undefined}\n </div>\n );\n});\n"],"mappings":"8uBAAA,qBAGA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,MAAT,CAAiBC,IAAjB,eACA,OAASC,QAAT,sBACA,OAASC,SAAT,0BACA,OAASC,UAAT,2BACA,OAASC,EAAT,uBACA,OAASC,QAAT,CAAmBC,QAAnB,+BAeA,MAAO,IAAMC,SAAQ,CAAGH,EAAE,CAAC,QAAD,CAAnB,C,GAEDI,YAAoD,CAAG,eAAGC,EAAH,GAAGA,QAAH,OAC3D,4BAAK,SAAS,CAAEF,QAAQ,CAAC,MAAD,CAAxB,EAAmCE,CAAnC,CAD2D,C,CAIvDC,UAAU,CAAG,SAACC,CAAD,CAAwBC,CAAxB,CAAuCC,CAAvC,CAA4D,OACzEP,SAAQ,CAACK,CAAD,CADiE,CAGzE,oBAAC,WAAD,EAAa,GAAG,CAAEJ,QAAQ,CAAC,MAAD,CAAS,CAAEK,KAAK,CAALA,CAAF,CAASC,QAAQ,CAARA,CAAT,CAAT,CAA1B,EACE,oBAAC,IAAD,EACE,SAAS,CAAEN,QAAQ,CAAC,MAAD,CADrB,CAEE,IAAI,CAAC,SAFP,CAGE,MAAM,CAAY,CAAV,GAAAK,CAAK,EAAuB,CAAb,GAAAC,CAAf,C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,CAAvB,CACIO,CAAe,CAACQ,KAAhB,CAAsBC,MAD1B,OAXkC,CAclCf,CAdkC,CAAjB,CADrB,CAiBE,KAAK,gCACAI,CADA,6BAEF,mBAFE,0BAEgDD,CAFhD,yBAGF,uBAHE,gCAG0Db,cAAc,CAACQ,CAAD,CAHxE,UAjBP,CAsBE,GAAG,CAAEL,CAtBP,EAwBGc,CAAS,CAACG,MAAV,CACC,2BACE,SAAS,CAAE7C,SAAS,CAAC,CAAEmB,GAAG,CAAED,MAAM,CAACmB,CAAD,CAAW,CAAX,CAAb,CAA4BS,KAAK,CAAE,QAAnC,CAAD,CADtB,EAGGJ,CAHH,CADD,OAxBH,CA+BGC,CAAU,CAACE,MAAX,CACC,2BACE,SAAS,CAAE7C,SAAS,CAAC,CAAEmB,GAAG,CAAED,MAAM,CAACmB,CAAD,CAAW,CAAX,CAAb,CAA4BS,KAAK,CAAE,QAAnC,CAAD,CADtB,EAGGH,CAHH,CADD,OA/BH,CAwCH,CArE+B,CAAzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Banner';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/Banner/index.ts"],"sourcesContent":["export * from './Banner';\n"],"mappings":"AAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","view","width","form","iconLeft","iconRight","label","className","onClick","disabled","loading","type","tabIndex","as","onlyIcon","iconSize","formId"];import"./Button.css";import React,{useRef}from"react";import{Loader}from"../Loader";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{cnMixFocus}from"../../mixs/MixFocus/MixFocus";import{cn}from"../../utils/bem";import{getByMap}from"../../utils/getByMap";import{forwardRefWithAs}from"../../utils/types/PropsWithAsAttributes";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";export var buttonPropSize=["m","xs","s","l"];export var buttonPropSizeDefault=buttonPropSize[0];export var buttonPropView=["primary","clear","ghost","secondary"];export var buttonPropViewDefault=buttonPropView[0];export var buttonPropWidth=["default","full"];export var buttonPropWidthDefault=buttonPropWidth[0];export var buttonPropForm=["default","brick","round","brickRound","roundBrick","brickDefault","defaultBrick"];var mapStableForm={default:"default",defaultClear:"defaultBrick",defaultBrick:"defaultBrick",brick:"brick",brickDefault:"brickDefault",brickClear:"brick",brickRound:"brickRound",round:"round",roundClear:"roundBrick",roundBrick:"roundBrick",clearRound:"brickRound",clearDefault:"brickDefault",clearBrick:"brick",clearClear:"brick"};export var buttonPropFormDefault=buttonPropForm[0];export var COMPONENT_NAME="Button";export var cnButton=cn("Button");var sizeMap={xs:"xs",s:"xs",m:"s",l:"m"},sizeMapOnlyIcon={xs:"xs",s:"s",m:"m",l:"m"};export var Button=forwardRefWithAs(function(a,b){var c=useRef(null),d=usePropsHandler(COMPONENT_NAME,a,c),e=d.size,f=void 0===e?buttonPropSizeDefault:e,g=d.view,h=void 0===g?buttonPropViewDefault:g,i=d.width,j=void 0===i?buttonPropWidthDefault:i,k=d.form,l=void 0===k?buttonPropFormDefault:k,m=d.iconLeft,n=d.iconRight,o=d.label,p=d.className,q=d.onClick,r=d.disabled,s=d.loading,t=d.type,u=void 0===t?"button":t,v=d.tabIndex,w=d.as,x=void 0===w?"button":w,y=d.onlyIcon,z=d.iconSize,A=d.formId,B=_objectWithoutProperties(d,_excluded),C=(!o||y)&&(m||n),D=m,E=n,F=a.title||!!C&&o||void 0,G=C?getByMap(sizeMapOnlyIcon,f,z):getByMap(sizeMap,f,z);return React.createElement(x,Object.assign({},B,{onClick:q?function handleClick(a){r||s||!q||q(a)}:void 0,form:A,type:u,className:cnButton({size:f,view:h,width:j,form:mapStableForm[l],loading:s,disabled:r,withIcon:!!m||!!n,onlyIcon:!!C},[r||s?void 0:cnMixFocus(),p]),disabled:r,tabIndex:v,title:F,ref:useForkRef([b,c])}),C&&React.createElement(C,{className:cnButton("Icon"),size:G}),!C&&((D||E)&&o?React.createElement(React.Fragment,null,D&&React.createElement(D,{className:cnButton("Icon",{position:"left"}),size:G}),React.createElement("span",{className:cnButton("Label")},o),E&&React.createElement(E,{className:cnButton("Icon",{position:"right"}),size:G})):o),s&&React.createElement("div",{className:cnButton("Loader")},React.createElement(Loader,{size:"
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","view","width","form","iconLeft","iconRight","label","className","onClick","disabled","loading","type","tabIndex","as","onlyIcon","iconSize","formId"];import"./Button.css";import React,{useRef}from"react";import{Loader}from"../Loader";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{cnMixFocus}from"../../mixs/MixFocus/MixFocus";import{cn}from"../../utils/bem";import{getByMap}from"../../utils/getByMap";import{forwardRefWithAs}from"../../utils/types/PropsWithAsAttributes";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";export var buttonPropSize=["m","xs","s","l"];export var buttonPropSizeDefault=buttonPropSize[0];export var buttonPropView=["primary","clear","ghost","secondary"];export var buttonPropViewDefault=buttonPropView[0];export var buttonPropWidth=["default","full"];export var buttonPropWidthDefault=buttonPropWidth[0];export var buttonPropForm=["default","brick","round","brickRound","roundBrick","brickDefault","defaultBrick"];var mapStableForm={default:"default",defaultClear:"defaultBrick",defaultBrick:"defaultBrick",brick:"brick",brickDefault:"brickDefault",brickClear:"brick",brickRound:"brickRound",round:"round",roundClear:"roundBrick",roundBrick:"roundBrick",clearRound:"brickRound",clearDefault:"brickDefault",clearBrick:"brick",clearClear:"brick"};export var buttonPropFormDefault=buttonPropForm[0];export var COMPONENT_NAME="Button";export var cnButton=cn("Button");var sizeMap={xs:"xs",s:"xs",m:"s",l:"m"},sizeMapOnlyIcon={xs:"xs",s:"s",m:"m",l:"m"};export var Button=forwardRefWithAs(function(a,b){var c=useRef(null),d=usePropsHandler(COMPONENT_NAME,a,c),e=d.size,f=void 0===e?buttonPropSizeDefault:e,g=d.view,h=void 0===g?buttonPropViewDefault:g,i=d.width,j=void 0===i?buttonPropWidthDefault:i,k=d.form,l=void 0===k?buttonPropFormDefault:k,m=d.iconLeft,n=d.iconRight,o=d.label,p=d.className,q=d.onClick,r=d.disabled,s=d.loading,t=d.type,u=void 0===t?"button":t,v=d.tabIndex,w=d.as,x=void 0===w?"button":w,y=d.onlyIcon,z=d.iconSize,A=d.formId,B=_objectWithoutProperties(d,_excluded),C=(!o||y)&&(m||n),D=m,E=n,F=a.title||!!C&&o||void 0,G=C?getByMap(sizeMapOnlyIcon,f,z):getByMap(sizeMap,f,z);return React.createElement(x,Object.assign({},B,{onClick:q?function handleClick(a){r||s||!q||q(a)}:void 0,form:A,type:u,className:cnButton({size:f,view:h,width:j,form:mapStableForm[l],loading:s,disabled:r,withIcon:!!m||!!n,onlyIcon:!!C},[r||s?void 0:cnMixFocus(),p]),disabled:r,tabIndex:v,title:F,ref:useForkRef([b,c])}),C&&React.createElement(C,{className:cnButton("Icon"),size:G}),!C&&((D||E)&&o?React.createElement(React.Fragment,null,D&&React.createElement(D,{className:cnButton("Icon",{position:"left"}),size:G}),React.createElement("span",{className:cnButton("Label")},o),E&&React.createElement(E,{className:cnButton("Icon",{position:"right"}),size:G})):o),s&&React.createElement("div",{className:cnButton("Loader")},React.createElement(Loader,{size:sizeMapOnlyIcon[f],type:"circle"})))});
|
|
2
2
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["React","useRef","Loader","useForkRef","cnMixFocus","cn","getByMap","forwardRefWithAs","usePropsHandler","buttonPropSize","buttonPropSizeDefault","buttonPropView","buttonPropViewDefault","buttonPropWidth","buttonPropWidthDefault","buttonPropForm","mapStableForm","defaultClear","defaultBrick","brick","brickDefault","brickClear","brickRound","round","roundClear","roundBrick","clearRound","clearDefault","clearBrick","clearClear","buttonPropFormDefault","COMPONENT_NAME","cnButton","sizeMap","xs","s","m","l","sizeMapOnlyIcon","Button","props","ref","buttonRef","size","view","width","form","iconLeft","iconRight","label","className","onClick","disabled","loading","type","tabIndex","as","onlyIcon","iconSizeProp","iconSize","formId","otherProps","IconOnly","IconLeft","IconRight","title","handleClick","e","withIcon","position"],"sources":["../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import './Button.css';\n\nimport { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport React, { HTMLProps, useRef } from 'react';\n\nimport { Loader } from '##/components/Loader';\n\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { cnMixFocus } from '../../mixs/MixFocus/MixFocus';\nimport { cn } from '../../utils/bem';\nimport { getByMap } from '../../utils/getByMap';\nimport { forwardRefWithAs } from '../../utils/types/PropsWithAsAttributes';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\n\nexport const buttonPropSize = ['m', 'xs', 's', 'l'] as const;\nexport type ButtonPropSize = typeof buttonPropSize[number];\nexport const buttonPropSizeDefault: ButtonPropSize = buttonPropSize[0];\n\nexport const buttonPropView = [\n 'primary',\n 'clear',\n 'ghost',\n 'secondary',\n] as const;\nexport type ButtonPropView = typeof buttonPropView[number];\nexport const buttonPropViewDefault: ButtonPropView = buttonPropView[0];\n\nexport const buttonPropWidth = ['default', 'full'] as const;\nexport type ButtonPropWidth = typeof buttonPropWidth[number];\nexport const buttonPropWidthDefault: ButtonPropWidth = buttonPropWidth[0];\n\nexport const buttonPropForm = [\n 'default',\n 'brick',\n 'round',\n 'brickRound',\n 'roundBrick',\n 'brickDefault',\n 'defaultBrick',\n] as const;\n\nexport type ButtonPropForm = typeof buttonPropForm[number];\n\ntype GlobalForm =\n | 'default'\n | 'brick'\n | 'round'\n | 'brickRound'\n | 'roundBrick'\n | 'brickDefault'\n | 'defaultBrick'\n | 'defaultClear'\n | 'brickClear'\n | 'roundClear'\n | 'clearRound'\n | 'clearDefault'\n | 'clearBrick'\n | 'clearClear';\n\nconst mapStableForm: Record<GlobalForm, ButtonPropForm> = {\n default: 'default',\n defaultClear: 'defaultBrick',\n defaultBrick: 'defaultBrick',\n brick: 'brick',\n brickDefault: 'brickDefault',\n brickClear: 'brick',\n brickRound: 'brickRound',\n round: 'round',\n roundClear: 'roundBrick',\n roundBrick: 'roundBrick',\n clearRound: 'brickRound',\n clearDefault: 'brickDefault',\n clearBrick: 'brick',\n clearClear: 'brick',\n};\n\nexport const buttonPropFormDefault = buttonPropForm[0];\n\nexport type Props = {\n size?: ButtonPropSize;\n view?: ButtonPropView;\n width?: ButtonPropWidth;\n form?: ButtonPropForm;\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n label?: string | number;\n onClick?: React.EventHandler<React.MouseEvent>;\n iconLeft?: IconComponent;\n iconRight?: IconComponent;\n onlyIcon?: boolean;\n iconSize?: IconPropSize;\n title?: string;\n children?: never;\n type?: 'button' | 'reset' | 'submit';\n formId?: HTMLProps<HTMLButtonElement>['form'];\n};\n\nexport const COMPONENT_NAME = 'Button' as const;\nexport const cnButton = cn(COMPONENT_NAME);\n\nconst sizeMap: Record<ButtonPropSize, IconPropSize> = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n l: 'm',\n};\n\nconst sizeMapOnlyIcon: Record<ButtonPropSize, IconPropSize> = {\n xs: 'xs',\n s: 's',\n m: 'm',\n l: 'm',\n};\n\nexport const Button = forwardRefWithAs<Props, 'button'>((props, ref) => {\n const buttonRef = useRef<HTMLButtonElement | null>(null);\n\n const {\n size = buttonPropSizeDefault,\n view = buttonPropViewDefault,\n width = buttonPropWidthDefault,\n form = buttonPropFormDefault,\n iconLeft,\n iconRight,\n label,\n className,\n onClick,\n disabled,\n loading,\n type = 'button',\n tabIndex,\n as = 'button',\n onlyIcon,\n iconSize: iconSizeProp,\n formId,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, props, buttonRef);\n\n const Tag = as as string;\n const IconOnly = (!label || onlyIcon) && (iconLeft || iconRight);\n const IconLeft = iconLeft;\n const IconRight = iconRight;\n const withIcon = !!iconLeft || !!iconRight;\n const title = props.title || (!!IconOnly && label) || undefined;\n const iconSize = IconOnly\n ? getByMap(sizeMapOnlyIcon, size, iconSizeProp)\n : getByMap(sizeMap, size, iconSizeProp);\n\n const handleClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!disabled && !loading && onClick) {\n onClick(e);\n }\n };\n\n return (\n <Tag\n {...otherProps}\n onClick={onClick ? handleClick : undefined}\n form={formId}\n type={type}\n className={cnButton(\n {\n size,\n view,\n width,\n form: mapStableForm[form],\n loading,\n disabled,\n withIcon,\n onlyIcon: !!IconOnly,\n },\n [!(disabled || loading) ? cnMixFocus() : undefined, className],\n )}\n disabled={disabled}\n tabIndex={tabIndex}\n title={title}\n ref={useForkRef([ref, buttonRef])}\n >\n {IconOnly && <IconOnly className={cnButton('Icon')} size={iconSize} />}\n {!IconOnly &&\n ((IconLeft || IconRight) && label ? (\n <>\n {IconLeft && (\n <IconLeft\n className={cnButton('Icon', { position: 'left' })}\n size={iconSize}\n />\n )}\n <span className={cnButton('Label')}>{label}</span>\n {IconRight && (\n <IconRight\n className={cnButton('Icon', { position: 'right' })}\n size={iconSize}\n />\n )}\n </>\n ) : (\n label\n ))}\n {loading && (\n <div className={cnButton('Loader')}>\n <Loader size=\"s\" />\n </div>\n )}\n </Tag>\n );\n});\n"],"mappings":"kQAAA,qBAGA,MAAOA,MAAP,EAA2BC,MAA3B,KAAyC,OAAzC,CAEA,OAASC,MAAT,iBAEA,OAASC,UAAT,yCACA,OAASC,UAAT,oCACA,OAASC,EAAT,uBACA,OAASC,QAAT,4BACA,OAASC,gBAAT,+CACA,OAASC,eAAT,2CAEA,MAAO,IAAMC,eAAc,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAAvB,CAEP,MAAO,IAAMC,sBAAqC,CAAGD,cAAc,CAAC,CAAD,CAA5D,CAEP,MAAO,IAAME,eAAc,CAAG,CAC5B,SAD4B,CAE5B,OAF4B,CAG5B,OAH4B,CAI5B,WAJ4B,CAAvB,CAOP,MAAO,IAAMC,sBAAqC,CAAGD,cAAc,CAAC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QAAQ,CAAE,OAAZ,CAAT,CADrB,CAEE,IAAI,CAAEV,CAFR,EATJ,CADD,CAiBCV,CAlBH,CAxBH,CA4CGI,CAAO,EACN,2BAAK,SAAS,CAAErB,QAAQ,CAAC,QAAD,CAAxB,EACE,oBAAC,MAAD,EAAQ,IAAI,CAAC,GAAb,EADF,CA7CJ,CAmDH,CA5FqC,CAA/B"}
|
|
1
|
+
{"version":3,"file":"Button.js","names":["React","useRef","Loader","useForkRef","cnMixFocus","cn","getByMap","forwardRefWithAs","usePropsHandler","buttonPropSize","buttonPropSizeDefault","buttonPropView","buttonPropViewDefault","buttonPropWidth","buttonPropWidthDefault","buttonPropForm","mapStableForm","defaultClear","defaultBrick","brick","brickDefault","brickClear","brickRound","round","roundClear","roundBrick","clearRound","clearDefault","clearBrick","clearClear","buttonPropFormDefault","COMPONENT_NAME","cnButton","sizeMap","xs","s","m","l","sizeMapOnlyIcon","Button","props","ref","buttonRef","size","view","width","form","iconLeft","iconRight","label","className","onClick","disabled","loading","type","tabIndex","as","onlyIcon","iconSizeProp","iconSize","formId","otherProps","IconOnly","IconLeft","IconRight","title","handleClick","e","withIcon","position"],"sources":["../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import './Button.css';\n\nimport { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport React, { HTMLProps, useRef } from 'react';\n\nimport { Loader } from '##/components/Loader';\n\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { cnMixFocus } from '../../mixs/MixFocus/MixFocus';\nimport { cn } from '../../utils/bem';\nimport { getByMap } from '../../utils/getByMap';\nimport { forwardRefWithAs } from '../../utils/types/PropsWithAsAttributes';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\n\nexport const buttonPropSize = ['m', 'xs', 's', 'l'] as const;\nexport type ButtonPropSize = typeof buttonPropSize[number];\nexport const buttonPropSizeDefault: ButtonPropSize = buttonPropSize[0];\n\nexport const buttonPropView = [\n 'primary',\n 'clear',\n 'ghost',\n 'secondary',\n] as const;\nexport type ButtonPropView = typeof buttonPropView[number];\nexport const buttonPropViewDefault: ButtonPropView = buttonPropView[0];\n\nexport const buttonPropWidth = ['default', 'full'] as const;\nexport type ButtonPropWidth = typeof buttonPropWidth[number];\nexport const buttonPropWidthDefault: ButtonPropWidth = buttonPropWidth[0];\n\nexport const buttonPropForm = [\n 'default',\n 'brick',\n 'round',\n 'brickRound',\n 'roundBrick',\n 'brickDefault',\n 'defaultBrick',\n] as const;\n\nexport type ButtonPropForm = typeof buttonPropForm[number];\n\ntype GlobalForm =\n | 'default'\n | 'brick'\n | 'round'\n | 'brickRound'\n | 'roundBrick'\n | 'brickDefault'\n | 'defaultBrick'\n | 'defaultClear'\n | 'brickClear'\n | 'roundClear'\n | 'clearRound'\n | 'clearDefault'\n | 'clearBrick'\n | 'clearClear';\n\nconst mapStableForm: Record<GlobalForm, ButtonPropForm> = {\n default: 'default',\n defaultClear: 'defaultBrick',\n defaultBrick: 'defaultBrick',\n brick: 'brick',\n brickDefault: 'brickDefault',\n brickClear: 'brick',\n brickRound: 'brickRound',\n round: 'round',\n roundClear: 'roundBrick',\n roundBrick: 'roundBrick',\n clearRound: 'brickRound',\n clearDefault: 'brickDefault',\n clearBrick: 'brick',\n clearClear: 'brick',\n};\n\nexport const buttonPropFormDefault = buttonPropForm[0];\n\nexport type Props = {\n size?: ButtonPropSize;\n view?: ButtonPropView;\n width?: ButtonPropWidth;\n form?: ButtonPropForm;\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n label?: string | number;\n onClick?: React.EventHandler<React.MouseEvent>;\n iconLeft?: IconComponent;\n iconRight?: IconComponent;\n onlyIcon?: boolean;\n iconSize?: IconPropSize;\n title?: string;\n children?: never;\n type?: 'button' | 'reset' | 'submit';\n formId?: HTMLProps<HTMLButtonElement>['form'];\n};\n\nexport const COMPONENT_NAME = 'Button' as const;\nexport const cnButton = cn(COMPONENT_NAME);\n\nconst sizeMap = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n l: 'm',\n} as const;\n\nconst sizeMapOnlyIcon = {\n xs: 'xs',\n s: 's',\n m: 'm',\n l: 'm',\n} as const;\n\nexport const Button = forwardRefWithAs<Props, 'button'>((props, ref) => {\n const buttonRef = useRef<HTMLButtonElement | null>(null);\n\n const {\n size = buttonPropSizeDefault,\n view = buttonPropViewDefault,\n width = buttonPropWidthDefault,\n form = buttonPropFormDefault,\n iconLeft,\n iconRight,\n label,\n className,\n onClick,\n disabled,\n loading,\n type = 'button',\n tabIndex,\n as = 'button',\n onlyIcon,\n iconSize: iconSizeProp,\n formId,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, props, buttonRef);\n\n const Tag = as as string;\n const IconOnly = (!label || onlyIcon) && (iconLeft || iconRight);\n const IconLeft = iconLeft;\n const IconRight = iconRight;\n const withIcon = !!iconLeft || !!iconRight;\n const title = props.title || (!!IconOnly && label) || undefined;\n const iconSize = IconOnly\n ? getByMap(sizeMapOnlyIcon, size, iconSizeProp)\n : getByMap(sizeMap, size, iconSizeProp);\n\n const handleClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!disabled && !loading && onClick) {\n onClick(e);\n }\n };\n\n return (\n <Tag\n {...otherProps}\n onClick={onClick ? handleClick : undefined}\n form={formId}\n type={type}\n className={cnButton(\n {\n size,\n view,\n width,\n form: mapStableForm[form],\n loading,\n disabled,\n withIcon,\n onlyIcon: !!IconOnly,\n },\n [!(disabled || loading) ? cnMixFocus() : undefined, className],\n )}\n disabled={disabled}\n tabIndex={tabIndex}\n title={title}\n ref={useForkRef([ref, buttonRef])}\n >\n {IconOnly && <IconOnly className={cnButton('Icon')} size={iconSize} />}\n {!IconOnly &&\n ((IconLeft || IconRight) && label ? (\n <>\n {IconLeft && (\n <IconLeft\n className={cnButton('Icon', { position: 'left' })}\n size={iconSize}\n />\n )}\n <span className={cnButton('Label')}>{label}</span>\n {IconRight && (\n <IconRight\n className={cnButton('Icon', { position: 'right' })}\n size={iconSize}\n />\n )}\n </>\n ) : (\n label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T,CAqBE,GAAG,CAAE9D,UAAU,CAAC,CAACsC,CAAD,CAAMC,CAAN,CAAD,CArBjB,GAuBGoB,CAAQ,EAAI,oBAAC,CAAD,EAAU,SAAS,CAAE9B,QAAQ,CAAC,MAAD,CAA7B,CAAuC,IAAI,CAAE2B,CAA7C,EAvBf,CAwBG,CAACG,CAAD,GACE,CAACC,CAAQ,EAAIC,CAAb,GAA2Bf,CAA3B,CACC,wCACGc,CAAQ,EACP,oBAAC,CAAD,EACE,SAAS,CAAE/B,QAAQ,CAAC,MAAD,CAAS,CAAEqC,QAAQ,CAAE,MAAZ,CAAT,CADrB,CAEE,IAAI,CAAEV,CAFR,EAFJ,CAOE,4BAAM,SAAS,CAAE3B,QAAQ,CAAC,OAAD,CAAzB,EAAqCiB,CAArC,CAPF,CAQGe,CAAS,EACR,oBAAC,CAAD,EACE,SAAS,CAAEhC,QAAQ,CAAC,MAAD,CAAS,CAAEqC,QAAQ,CAAE,OAAZ,CAAT,CADrB,CAEE,IAAI,CAAEV,CAFR,EATJ,CADD,CAiBCV,CAlBH,CAxBH,CA4CGI,CAAO,EACN,2BAAK,SAAS,CAAErB,QAAQ,CAAC,QAAD,CAAxB,EACE,oBAAC,MAAD,EAAQ,IAAI,CAAEM,eAAe,CAACK,CAAD,CAA7B,CAAqC,IAAI,CAAC,QAA1C,EADF,CA7CJ,CAmDH,CA5FqC,CAA/B"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AutoComplete.js","names":["React","cnCanary","AutoCompleteTypeText","AutoCompleteTypeTextArray","typeMap","text","textarray","cnAutoComplete","AutoCompleteRender","props","ref","type","Component","className","AutoComplete","forwardRef"],"sources":["../../../../../src/components/AutoCompleteCanary/AutoComplete.tsx"],"sourcesContent":["import React from 'react';\n\nimport { cnCanary } from '##/utils/bem';\n\nimport { AutoCompleteTypeText } from './AutoCompleteTypeText';\nimport { AutoCompleteTypeTextArray } from './AutoCompleteTypeTextArray';\nimport {\n AutoCompleteComponent,\n AutoCompleteGroupDefault,\n AutoCompleteItemDefault,\n AutoCompleteProps,\n AutoCompleteTypeComponent,\n} from './types';\n\nconst typeMap: Record<\n string,\n AutoCompleteTypeComponent<string> | AutoCompleteTypeComponent<'textarray'>\n> = {\n text: AutoCompleteTypeText,\n textarray: AutoCompleteTypeTextArray,\n};\n\nexport const cnAutoComplete = cnCanary('AutoComplete');\n\nconst AutoCompleteRender = <\n TYPE extends string,\n ITEM = AutoCompleteItemDefault,\n GROUP = AutoCompleteGroupDefault,\n>(\n props: AutoCompleteProps<TYPE, ITEM, GROUP>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const type = props.type || 'text';\n const Component = typeMap[type] || typeMap.text;\n\n return (\n <Component\n {...(props as unknown as AutoCompleteTypeComponent<TYPE, ITEM, GROUP>)}\n ref={ref}\n className={cnAutoComplete({ type }, [props.className])}\n />\n );\n};\n\nexport const AutoComplete = React.forwardRef(\n AutoCompleteRender,\n) as AutoCompleteComponent;\n\nexport * from './types';\n"],"mappings":"AAAA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,QAAT,uBAEA,OAASC,oBAAT,8BACA,OAASC,yBAAT,mCASA,GAAMC,QAGL,CAAG,CACFC,IAAI,CAAEH,oBADJ,CAEFI,SAAS,CAAEH,yBAFT,CAHJ,CAQA,MAAO,IAAMI,eAAc,CAAGN,QAAQ,CAAC,cAAD,CAA/B,CAEP,GAAMO,mBAAkB,CAAG,SAKzBC,CALyB,CAMzBC,CANyB,CAOtB,IACGC,EAAI,CAAGF,CAAK,CAACE,IAAN,EAAc,MADxB,CAEGC,CAAS,CAAGR,OAAO,CAACO,CAAD,CAAP,EAAiBP,OAAO,CAACC,IAFxC,CAIH,MACE,qBAAC,CAAD,kBACOI,CADP,EAEE,GAAG,CAAEC,CAFP,CAGE,SAAS,CAAEH,cAAc,CAAC,CAAEI,IAAI,CAAJA,CAAF,CAAD,CAAW,CAACF,CAAK,CAACI,SAAP,CAAX,CAH3B,GAMH,CAlBD,CAoBA,MAAO,IAAMC,aAAY,CAAGd,KAAK,CAACe,UAAN,CAC1BP,kBAD0B,CAArB,CAIP"}
|
|
File without changes
|