@salutejs/plasma-new-hope 0.186.0-canary.1511.11718939010.0 → 0.186.0-canary.1511.11721421971.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/NumberInput/NumberInput.js +0 -2
- package/cjs/components/NumberInput/NumberInput.js.map +1 -1
- package/emotion/cjs/components/NumberInput/NumberInput.js +0 -2
- package/emotion/es/components/NumberInput/NumberInput.js +0 -2
- package/es/components/NumberInput/NumberInput.js +0 -2
- package/es/components/NumberInput/NumberInput.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/NumberInput/NumberInput.js +0 -2
- package/styled-components/es/components/NumberInput/NumberInput.js +0 -2
- package/types/components/NumberInput/NumberInput.d.ts.map +1 -1
@@ -82,7 +82,6 @@ var numberInputRoot = function numberInputRoot(Root) {
|
|
82
82
|
var decrementButtonDisabled = isMinValue(Number(innerValue)) && !isAnimationRun || isLoading ? NumberInput_tokens.classes.actionButtonDecrementDisabled : undefined;
|
83
83
|
var incrementButtonDisabled = isMaxValue(Number(innerValue)) && !isAnimationRun || isLoading ? NumberInput_tokens.classes.actionButtonIncrementDisabled : undefined;
|
84
84
|
var handleDecrement = function handleDecrement() {
|
85
|
-
console.log(isAnimationRun);
|
86
85
|
if (isLoading || disabled || isAnimationRun) {
|
87
86
|
return;
|
88
87
|
}
|
@@ -97,7 +96,6 @@ var numberInputRoot = function numberInputRoot(Root) {
|
|
97
96
|
}
|
98
97
|
};
|
99
98
|
var handleIncrement = function handleIncrement() {
|
100
|
-
console.log(isAnimationRun);
|
101
99
|
if (isLoading || disabled || isAnimationRun) {
|
102
100
|
return;
|
103
101
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"NumberInput.js","sources":["../../../src/components/NumberInput/NumberInput.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, useEffect, useState } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { cx, getSizeValueFromProp, isNumber } from '../../utils';\nimport { IconMinus, IconPlus } from '../_Icon';\n\nimport type { NumberInputProps, NumberInputRootProps } from './NumberInput.types';\nimport { ActionButton, NumberInput } from './ui';\nimport { classes, privateTokens } from './NumberInput.tokens';\nimport { base } from './NumberInput.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as shapeCSS } from './variations/_shape/base';\nimport { base as inputBackgroundTypeCSS } from './variations/_background-type/base';\nimport { base as segmentationCSS } from './variations/_segmentation/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\n\nexport const numberInputRoot = (Root: RootProps<HTMLDivElement, NumberInputRootProps>) =>\n forwardRef<HTMLInputElement, NumberInputProps>(\n (\n {\n className,\n style,\n width,\n value,\n min,\n max,\n step = 1,\n isLoading,\n loader,\n size,\n view,\n clear,\n shape,\n segmentation,\n inputBackgroundType = 'fill',\n disabled,\n textBefore,\n textAfter,\n customIncrementButton,\n incrementIcon,\n customDecrementButton,\n decrementIcon,\n isManualInput,\n onChange,\n onIncrement,\n onDecrement,\n ...rest\n },\n ref,\n ) => {\n const [innerValue, setInnerValue] = useState<number | string>(value ?? min ?? 0);\n const [isInputFocused, setIsInputFocused] = useState(false);\n const [isAnimationRun, setIsAnimationRun] = useState(false);\n\n const innerWidth = width ? getSizeValueFromProp(width) : '100%';\n\n const actionIconSize = size === 'xs' ? 'xs' : 's';\n const solidViewClass = segmentation === 'solid' ? classes.solidView : undefined;\n const segmentedViewClass = segmentation === 'segmented' ? classes.segmentedView : undefined;\n const clearViewClass = clear ? classes.clearView : undefined;\n const disabledClass = disabled ? classes.disabled : undefined;\n const loadingClass = isLoading ? classes.loading : undefined;\n const focusedClass = isInputFocused ? classes.focused : undefined;\n\n const isMinValue = (currentValue: number) => min !== undefined && currentValue <= min;\n const isMaxValue = (currentValue: number) => max !== undefined && currentValue >= max;\n\n const decrementButtonDisabled =\n (isMinValue(Number(innerValue)) && !isAnimationRun) || isLoading\n ? classes.actionButtonDecrementDisabled\n : undefined;\n const incrementButtonDisabled =\n (isMaxValue(Number(innerValue)) && !isAnimationRun) || isLoading\n ? classes.actionButtonIncrementDisabled\n : undefined;\n\n const handleDecrement = () => {\n console.log(isAnimationRun);\n if (isLoading || disabled || isAnimationRun) {\n return;\n }\n\n const diffValue = Number(innerValue) - step;\n const resValue = min !== undefined && diffValue <= min ? min : diffValue;\n\n setInnerValue(resValue);\n\n if (onDecrement) {\n onDecrement(resValue);\n }\n\n if (onChange) {\n onChange(null, resValue);\n }\n };\n\n const handleIncrement = () => {\n console.log(isAnimationRun);\n if (isLoading || disabled || isAnimationRun) {\n return;\n }\n\n const diffValue = Number(innerValue) + step;\n const resValue = max !== undefined && diffValue >= max ? max : diffValue;\n\n setInnerValue(resValue);\n\n if (onIncrement) {\n onIncrement(resValue);\n }\n\n if (onChange) {\n onChange(null, resValue);\n }\n };\n\n useEffect(() => {\n if (value === undefined || !isNumber(value)) {\n return;\n }\n\n setInnerValue((prevValue) => (prevValue !== value ? value : prevValue));\n }, [value]);\n\n return (\n <Root\n view={view}\n size={size}\n disabled={disabled}\n clear={clear}\n shape={shape}\n segmentation={segmentation}\n isLoading={isLoading}\n {...(segmentation === 'solid' ? { inputBackgroundType: 'clear' } : { inputBackgroundType })}\n className={cx(\n className,\n solidViewClass,\n segmentedViewClass,\n clearViewClass,\n disabledClass,\n loadingClass,\n focusedClass,\n )}\n style={\n {\n ...style,\n [privateTokens.inputWidth]: innerWidth,\n } as CSSProperties\n }\n >\n {customDecrementButton || (\n <ActionButton\n className={cx(\n classes.actionButtonDecrement,\n decrementButtonDisabled,\n solidViewClass,\n segmentedViewClass,\n )}\n icon={decrementIcon || <IconMinus color=\"inherit\" size={actionIconSize} />}\n onClick={handleDecrement}\n />\n )}\n <NumberInput\n ref={ref}\n segmentation={segmentation}\n value={innerValue}\n min={min}\n max={max}\n isManualInput={isManualInput}\n textBefore={textBefore}\n textAfter={textAfter}\n isLoading={isLoading}\n loader={loader}\n disabled={disabled}\n isInputFocused={isInputFocused}\n setIsInputFocused={setIsInputFocused}\n setIsAnimationRun={setIsAnimationRun}\n setInnerValue={setInnerValue}\n onChange={onChange}\n {...rest}\n />\n {customIncrementButton || (\n <ActionButton\n className={cx(\n classes.actionButtonIncrement,\n incrementButtonDisabled,\n solidViewClass,\n segmentedViewClass,\n )}\n icon={incrementIcon || <IconPlus color=\"inherit\" size={actionIconSize} />}\n onClick={handleIncrement}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const numberInputConfig = {\n name: 'NumberInput',\n tag: 'div',\n layout: numberInputRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n shape: {\n css: shapeCSS,\n },\n inputBackgroundType: {\n css: inputBackgroundTypeCSS,\n },\n segmentation: {\n css: segmentationCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'default',\n size: 'l',\n shape: 'cornered',\n segmentation: 'default',\n },\n};\n"],"names":["numberInputRoot","Root","forwardRef","_ref","ref","_ref2","className","style","width","value","min","max","_ref$step","step","isLoading","loader","size","view","clear","shape","segmentation","_ref$inputBackgroundT","inputBackgroundType","disabled","textBefore","textAfter","customIncrementButton","incrementIcon","customDecrementButton","decrementIcon","isManualInput","onChange","onIncrement","onDecrement","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","innerValue","setInnerValue","_useState3","_useState4","isInputFocused","setIsInputFocused","_useState5","_useState6","isAnimationRun","setIsAnimationRun","innerWidth","getSizeValueFromProp","actionIconSize","solidViewClass","classes","solidView","undefined","segmentedViewClass","segmentedView","clearViewClass","clearView","disabledClass","loadingClass","loading","focusedClass","focused","isMinValue","currentValue","isMaxValue","decrementButtonDisabled","Number","actionButtonDecrementDisabled","incrementButtonDisabled","actionButtonIncrementDisabled","handleDecrement","console","log","diffValue","resValue","handleIncrement","useEffect","isNumber","prevValue","React","createElement","_extends","cx","_objectSpread","_defineProperty","privateTokens","inputWidth","ActionButton","actionButtonDecrement","icon","IconMinus","color","onClick","NumberInput","actionButtonIncrement","IconPlus","numberInputConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","shapeCSS","inputBackgroundTypeCSS","segmentationCSS","disabledCSS","attrs","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;IAiBaA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAqD,EAAA;AAAA,EAAA,oBACjFC,gBAAU,CACN,UAAAC,IAAA,EA8BIC,GAAG,EACF;AAAA,IAAA,IAAAC,KAAA,CAAA;AAAA,IAAA,IA7BGC,SAAS,GAAAH,IAAA,CAATG,SAAS;MACTC,KAAK,GAAAJ,IAAA,CAALI,KAAK;MACLC,KAAK,GAAAL,IAAA,CAALK,KAAK;MACLC,KAAK,GAAAN,IAAA,CAALM,KAAK;MACLC,GAAG,GAAAP,IAAA,CAAHO,GAAG;MACHC,GAAG,GAAAR,IAAA,CAAHQ,GAAG;MAAAC,SAAA,GAAAT,IAAA,CACHU,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,SAAA;MACRE,SAAS,GAAAX,IAAA,CAATW,SAAS;MACTC,MAAM,GAAAZ,IAAA,CAANY,MAAM;MACNC,IAAI,GAAAb,IAAA,CAAJa,IAAI;MACJC,IAAI,GAAAd,IAAA,CAAJc,IAAI;MACJC,KAAK,GAAAf,IAAA,CAALe,KAAK;MACLC,KAAK,GAAAhB,IAAA,CAALgB,KAAK;MACLC,YAAY,GAAAjB,IAAA,CAAZiB,YAAY;MAAAC,qBAAA,GAAAlB,IAAA,CACZmB,mBAAmB;AAAnBA,MAAAA,mBAAmB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,qBAAA;MAC5BE,QAAQ,GAAApB,IAAA,CAARoB,QAAQ;MACRC,UAAU,GAAArB,IAAA,CAAVqB,UAAU;MACVC,SAAS,GAAAtB,IAAA,CAATsB,SAAS;MACTC,qBAAqB,GAAAvB,IAAA,CAArBuB,qBAAqB;MACrBC,aAAa,GAAAxB,IAAA,C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A,IAAI,EAAEnE,aAAa,iBAAIyD,KAAA,CAAAC,aAAA,CAACe,iBAAQ,EAAA;AAACJ,QAAAA,KAAK,EAAC,SAAS;AAAChF,QAAAA,IAAI,EAAEqC,cAAAA;AAAe,OAAE,CAAE;AAC1E4C,MAAAA,OAAO,EAAEjB,eAAAA;AAAgB,KAC5B,CAEH,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMqB,iBAAiB,GAAG;AAC7BC,EAAAA,IAAI,EAAE,aAAa;AACnBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAExG,eAAe;AACvByG,EAAAA,IAAI,EAAJA,uBAAI;AACJC,EAAAA,UAAU,EAAE;AACRzF,IAAAA,IAAI,EAAE;AACF0F,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACD5F,IAAAA,IAAI,EAAE;AACF2F,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACD1F,IAAAA,KAAK,EAAE;AACHwF,MAAAA,GAAG,EAAEG,WAAAA;KACR;AACDxF,IAAAA,mBAAmB,EAAE;AACjBqF,MAAAA,GAAG,EAAEI,WAAAA;KACR;AACD3F,IAAAA,YAAY,EAAE;AACVuF,MAAAA,GAAG,EAAEK,WAAAA;KACR;AACDzF,IAAAA,QAAQ,EAAE;AACNoF,MAAAA,GAAG,EAAEM,WAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNlG,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAG;AACTG,IAAAA,KAAK,EAAE,UAAU;AACjBC,IAAAA,YAAY,EAAE,SAAA;AAClB,GAAA;AACJ;;;;;"}
|
1
|
+
{"version":3,"file":"NumberInput.js","sources":["../../../src/components/NumberInput/NumberInput.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, useEffect, useState } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { cx, getSizeValueFromProp, isNumber } from '../../utils';\nimport { IconMinus, IconPlus } from '../_Icon';\n\nimport type { NumberInputProps, NumberInputRootProps } from './NumberInput.types';\nimport { ActionButton, NumberInput } from './ui';\nimport { classes, privateTokens } from './NumberInput.tokens';\nimport { base } from './NumberInput.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as shapeCSS } from './variations/_shape/base';\nimport { base as inputBackgroundTypeCSS } from './variations/_background-type/base';\nimport { base as segmentationCSS } from './variations/_segmentation/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\n\nexport const numberInputRoot = (Root: RootProps<HTMLDivElement, NumberInputRootProps>) =>\n forwardRef<HTMLInputElement, NumberInputProps>(\n (\n {\n className,\n style,\n width,\n value,\n min,\n max,\n step = 1,\n isLoading,\n loader,\n size,\n view,\n clear,\n shape,\n segmentation,\n inputBackgroundType = 'fill',\n disabled,\n textBefore,\n textAfter,\n customIncrementButton,\n incrementIcon,\n customDecrementButton,\n decrementIcon,\n isManualInput,\n onChange,\n onIncrement,\n onDecrement,\n ...rest\n },\n ref,\n ) => {\n const [innerValue, setInnerValue] = useState<number | string>(value ?? min ?? 0);\n const [isInputFocused, setIsInputFocused] = useState(false);\n const [isAnimationRun, setIsAnimationRun] = useState(false);\n\n const innerWidth = width ? getSizeValueFromProp(width) : '100%';\n\n const actionIconSize = size === 'xs' ? 'xs' : 's';\n const solidViewClass = segmentation === 'solid' ? classes.solidView : undefined;\n const segmentedViewClass = segmentation === 'segmented' ? classes.segmentedView : undefined;\n const clearViewClass = clear ? classes.clearView : undefined;\n const disabledClass = disabled ? classes.disabled : undefined;\n const loadingClass = isLoading ? classes.loading : undefined;\n const focusedClass = isInputFocused ? classes.focused : undefined;\n\n const isMinValue = (currentValue: number) => min !== undefined && currentValue <= min;\n const isMaxValue = (currentValue: number) => max !== undefined && currentValue >= max;\n\n const decrementButtonDisabled =\n (isMinValue(Number(innerValue)) && !isAnimationRun) || isLoading\n ? classes.actionButtonDecrementDisabled\n : undefined;\n const incrementButtonDisabled =\n (isMaxValue(Number(innerValue)) && !isAnimationRun) || isLoading\n ? classes.actionButtonIncrementDisabled\n : undefined;\n\n const handleDecrement = () => {\n if (isLoading || disabled || isAnimationRun) {\n return;\n }\n\n const diffValue = Number(innerValue) - step;\n const resValue = min !== undefined && diffValue <= min ? min : diffValue;\n\n setInnerValue(resValue);\n\n if (onDecrement) {\n onDecrement(resValue);\n }\n\n if (onChange) {\n onChange(null, resValue);\n }\n };\n\n const handleIncrement = () => {\n if (isLoading || disabled || isAnimationRun) {\n return;\n }\n\n const diffValue = Number(innerValue) + step;\n const resValue = max !== undefined && diffValue >= max ? max : diffValue;\n\n setInnerValue(resValue);\n\n if (onIncrement) {\n onIncrement(resValue);\n }\n\n if (onChange) {\n onChange(null, resValue);\n }\n };\n\n useEffect(() => {\n if (value === undefined || !isNumber(value)) {\n return;\n }\n\n setInnerValue((prevValue) => (prevValue !== value ? value : prevValue));\n }, [value]);\n\n return (\n <Root\n view={view}\n size={size}\n disabled={disabled}\n clear={clear}\n shape={shape}\n segmentation={segmentation}\n isLoading={isLoading}\n {...(segmentation === 'solid' ? { inputBackgroundType: 'clear' } : { inputBackgroundType })}\n className={cx(\n className,\n solidViewClass,\n segmentedViewClass,\n clearViewClass,\n disabledClass,\n loadingClass,\n focusedClass,\n )}\n style={\n {\n ...style,\n [privateTokens.inputWidth]: innerWidth,\n } as CSSProperties\n }\n >\n {customDecrementButton || (\n <ActionButton\n className={cx(\n classes.actionButtonDecrement,\n decrementButtonDisabled,\n solidViewClass,\n segmentedViewClass,\n )}\n icon={decrementIcon || <IconMinus color=\"inherit\" size={actionIconSize} />}\n onClick={handleDecrement}\n />\n )}\n <NumberInput\n ref={ref}\n segmentation={segmentation}\n value={innerValue}\n min={min}\n max={max}\n isManualInput={isManualInput}\n textBefore={textBefore}\n textAfter={textAfter}\n isLoading={isLoading}\n loader={loader}\n disabled={disabled}\n isInputFocused={isInputFocused}\n setIsInputFocused={setIsInputFocused}\n setIsAnimationRun={setIsAnimationRun}\n setInnerValue={setInnerValue}\n onChange={onChange}\n {...rest}\n />\n {customIncrementButton || (\n <ActionButton\n className={cx(\n classes.actionButtonIncrement,\n incrementButtonDisabled,\n solidViewClass,\n segmentedViewClass,\n )}\n icon={incrementIcon || <IconPlus color=\"inherit\" size={actionIconSize} />}\n onClick={handleIncrement}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const numberInputConfig = {\n name: 'NumberInput',\n tag: 'div',\n layout: numberInputRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n shape: {\n css: shapeCSS,\n },\n inputBackgroundType: {\n css: inputBackgroundTypeCSS,\n },\n segmentation: {\n css: segmentationCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'default',\n size: 'l',\n shape: 'cornered',\n segmentation: 'default',\n },\n};\n"],"names":["numberInputRoot","Root","forwardRef","_ref","ref","_ref2","className","style","width","value","min","max","_ref$step","step","isLoading","loader","size","view","clear","shape","segmentation","_ref$inputBackgroundT","inputBackgroundType","disabled","textBefore","textAfter","customIncrementButton","incrementIcon","customDecrementButton","decrementIcon","isManualInput","onChange","onIncrement","onDecrement","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","innerValue","setInnerValue","_useState3","_useState4","isInputFocused","setIsInputFocused","_useState5","_useState6","isAnimationRun","setIsAnimationRun","innerWidth","getSizeValueFromProp","actionIconSize","solidViewClass","classes","solidView","undefined","segmentedViewClass","segmentedView","clearViewClass","clearView","disabledClass","loadingClass","loading","focusedClass","focused","isMinValue","currentValue","isMaxValue","decrementButtonDisabled","Number","actionButtonDecrementDisabled","incrementButtonDisabled","actionButtonIncrementDisabled","handleDecrement","diffValue","resValue","handleIncrement","useEffect","isNumber","prevValue","React","createElement","_extends","cx","_objectSpread","_defineProperty","privateTokens","inputWidth","ActionButton","actionButtonDecrement","icon","IconMinus","color","onClick","NumberInput","actionButtonIncrement","IconPlus","numberInputConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","shapeCSS","inputBackgroundTypeCSS","segmentationCSS","disabledCSS","attrs","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;IAiBaA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAqD,EAAA;AAAA,EAAA,oBACjFC,gBAAU,CACN,UAAAC,IAAA,EA8BIC,GAAG,EACF;AAAA,IAAA,IAAAC,KAAA,CAAA;AAAA,IAAA,IA7BGC,SAAS,GAAAH,IAAA,CAATG,SAAS;MACTC,KAAK,GAAAJ,IAAA,CAALI,KAAK;MACLC,KAAK,GAAAL,IAAA,CAALK,KAAK;MACLC,KAAK,GAAAN,IAAA,CAALM,KAAK;MACLC,GAAG,GAAAP,IAAA,CAAHO,GAAG;MACHC,GAAG,GAAAR,IAAA,CAAHQ,GAAG;MAAAC,SAAA,GAAAT,IAAA,CACHU,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,SAAA;MACRE,SAAS,GAAAX,IAAA,CAATW,SAAS;MACTC,MAAM,GAAAZ,IAAA,CAANY,MAAM;MACNC,IAAI,GAAAb,IAAA,CAAJa,IAAI;MACJC,IAAI,GAAAd,IAAA,CAAJc,IAAI;MACJC,KAAK,GAAAf,IAAA,CAALe,KAAK;MACLC,KAAK,GAAAhB,IAAA,CAALgB,KAAK;MACLC,YAAY,GAAAjB,IAAA,CAAZiB,YAAY;MAAAC,qBAAA,GAAAlB,IAAA,CACZmB,mBAAmB;AAAnBA,MAAAA,mBAAmB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,qBAAA;MAC5BE,QAAQ,GAAApB,IAAA,CAARoB,QAAQ;MACRC,UAAU,GAAArB,IAAA,CAAVqB,UAAU;MACVC,SAAS,GAAAtB,IAAA,CAATsB,SAAS;MACTC,qBAAqB,GAAAvB,IAAA,CAArBuB,qBAAqB;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EAAC,SAAS;AAAC9E,QAAAA,IAAI,EAAEqC,cAAAA;AAAe,OAAE,CAAE;AAC1E0C,MAAAA,OAAO,EAAEjB,eAAAA;AAAgB,KAC5B,CAEH,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMqB,iBAAiB,GAAG;AAC7BC,EAAAA,IAAI,EAAE,aAAa;AACnBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEtG,eAAe;AACvBuG,EAAAA,IAAI,EAAJA,uBAAI;AACJC,EAAAA,UAAU,EAAE;AACRvF,IAAAA,IAAI,EAAE;AACFwF,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACD1F,IAAAA,IAAI,EAAE;AACFyF,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACDxF,IAAAA,KAAK,EAAE;AACHsF,MAAAA,GAAG,EAAEG,WAAAA;KACR;AACDtF,IAAAA,mBAAmB,EAAE;AACjBmF,MAAAA,GAAG,EAAEI,WAAAA;KACR;AACDzF,IAAAA,YAAY,EAAE;AACVqF,MAAAA,GAAG,EAAEK,WAAAA;KACR;AACDvF,IAAAA,QAAQ,EAAE;AACNkF,MAAAA,GAAG,EAAEM,WAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNhG,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAG;AACTG,IAAAA,KAAK,EAAE,UAAU;AACjBC,IAAAA,YAAY,EAAE,SAAA;AAClB,GAAA;AACJ;;;;;"}
|
@@ -95,7 +95,6 @@ var numberInputRoot = exports.numberInputRoot = function numberInputRoot(Root) {
|
|
95
95
|
var decrementButtonDisabled = isMinValue(Number(innerValue)) && !isAnimationRun || isLoading ? _NumberInput.classes.actionButtonDecrementDisabled : undefined;
|
96
96
|
var incrementButtonDisabled = isMaxValue(Number(innerValue)) && !isAnimationRun || isLoading ? _NumberInput.classes.actionButtonIncrementDisabled : undefined;
|
97
97
|
var handleDecrement = function handleDecrement() {
|
98
|
-
console.log(isAnimationRun);
|
99
98
|
if (isLoading || disabled || isAnimationRun) {
|
100
99
|
return;
|
101
100
|
}
|
@@ -110,7 +109,6 @@ var numberInputRoot = exports.numberInputRoot = function numberInputRoot(Root) {
|
|
110
109
|
}
|
111
110
|
};
|
112
111
|
var handleIncrement = function handleIncrement() {
|
113
|
-
console.log(isAnimationRun);
|
114
112
|
if (isLoading || disabled || isAnimationRun) {
|
115
113
|
return;
|
116
114
|
}
|
@@ -87,7 +87,6 @@ export var numberInputRoot = function numberInputRoot(Root) {
|
|
87
87
|
var decrementButtonDisabled = isMinValue(Number(innerValue)) && !isAnimationRun || isLoading ? classes.actionButtonDecrementDisabled : undefined;
|
88
88
|
var incrementButtonDisabled = isMaxValue(Number(innerValue)) && !isAnimationRun || isLoading ? classes.actionButtonIncrementDisabled : undefined;
|
89
89
|
var handleDecrement = function handleDecrement() {
|
90
|
-
console.log(isAnimationRun);
|
91
90
|
if (isLoading || disabled || isAnimationRun) {
|
92
91
|
return;
|
93
92
|
}
|
@@ -102,7 +101,6 @@ export var numberInputRoot = function numberInputRoot(Root) {
|
|
102
101
|
}
|
103
102
|
};
|
104
103
|
var handleIncrement = function handleIncrement() {
|
105
|
-
console.log(isAnimationRun);
|
106
104
|
if (isLoading || disabled || isAnimationRun) {
|
107
105
|
return;
|
108
106
|
}
|
@@ -78,7 +78,6 @@ var numberInputRoot = function numberInputRoot(Root) {
|
|
78
78
|
var decrementButtonDisabled = isMinValue(Number(innerValue)) && !isAnimationRun || isLoading ? classes.actionButtonDecrementDisabled : undefined;
|
79
79
|
var incrementButtonDisabled = isMaxValue(Number(innerValue)) && !isAnimationRun || isLoading ? classes.actionButtonIncrementDisabled : undefined;
|
80
80
|
var handleDecrement = function handleDecrement() {
|
81
|
-
console.log(isAnimationRun);
|
82
81
|
if (isLoading || disabled || isAnimationRun) {
|
83
82
|
return;
|
84
83
|
}
|
@@ -93,7 +92,6 @@ var numberInputRoot = function numberInputRoot(Root) {
|
|
93
92
|
}
|
94
93
|
};
|
95
94
|
var handleIncrement = function handleIncrement() {
|
96
|
-
console.log(isAnimationRun);
|
97
95
|
if (isLoading || disabled || isAnimationRun) {
|
98
96
|
return;
|
99
97
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"NumberInput.js","sources":["../../../src/components/NumberInput/NumberInput.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, useEffect, useState } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { cx, getSizeValueFromProp, isNumber } from '../../utils';\nimport { IconMinus, IconPlus } from '../_Icon';\n\nimport type { NumberInputProps, NumberInputRootProps } from './NumberInput.types';\nimport { ActionButton, NumberInput } from './ui';\nimport { classes, privateTokens } from './NumberInput.tokens';\nimport { base } from './NumberInput.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as shapeCSS } from './variations/_shape/base';\nimport { base as inputBackgroundTypeCSS } from './variations/_background-type/base';\nimport { base as segmentationCSS } from './variations/_segmentation/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\n\nexport const numberInputRoot = (Root: RootProps<HTMLDivElement, NumberInputRootProps>) =>\n forwardRef<HTMLInputElement, NumberInputProps>(\n (\n {\n className,\n style,\n width,\n value,\n min,\n max,\n step = 1,\n isLoading,\n loader,\n size,\n view,\n clear,\n shape,\n segmentation,\n inputBackgroundType = 'fill',\n disabled,\n textBefore,\n textAfter,\n customIncrementButton,\n incrementIcon,\n customDecrementButton,\n decrementIcon,\n isManualInput,\n onChange,\n onIncrement,\n onDecrement,\n ...rest\n },\n ref,\n ) => {\n const [innerValue, setInnerValue] = useState<number | string>(value ?? min ?? 0);\n const [isInputFocused, setIsInputFocused] = useState(false);\n const [isAnimationRun, setIsAnimationRun] = useState(false);\n\n const innerWidth = width ? getSizeValueFromProp(width) : '100%';\n\n const actionIconSize = size === 'xs' ? 'xs' : 's';\n const solidViewClass = segmentation === 'solid' ? classes.solidView : undefined;\n const segmentedViewClass = segmentation === 'segmented' ? classes.segmentedView : undefined;\n const clearViewClass = clear ? classes.clearView : undefined;\n const disabledClass = disabled ? classes.disabled : undefined;\n const loadingClass = isLoading ? classes.loading : undefined;\n const focusedClass = isInputFocused ? classes.focused : undefined;\n\n const isMinValue = (currentValue: number) => min !== undefined && currentValue <= min;\n const isMaxValue = (currentValue: number) => max !== undefined && currentValue >= max;\n\n const decrementButtonDisabled =\n (isMinValue(Number(innerValue)) && !isAnimationRun) || isLoading\n ? classes.actionButtonDecrementDisabled\n : undefined;\n const incrementButtonDisabled =\n (isMaxValue(Number(innerValue)) && !isAnimationRun) || isLoading\n ? classes.actionButtonIncrementDisabled\n : undefined;\n\n const handleDecrement = () => {\n console.log(isAnimationRun);\n if (isLoading || disabled || isAnimationRun) {\n return;\n }\n\n const diffValue = Number(innerValue) - step;\n const resValue = min !== undefined && diffValue <= min ? min : diffValue;\n\n setInnerValue(resValue);\n\n if (onDecrement) {\n onDecrement(resValue);\n }\n\n if (onChange) {\n onChange(null, resValue);\n }\n };\n\n const handleIncrement = () => {\n console.log(isAnimationRun);\n if (isLoading || disabled || isAnimationRun) {\n return;\n }\n\n const diffValue = Number(innerValue) + step;\n const resValue = max !== undefined && diffValue >= max ? max : diffValue;\n\n setInnerValue(resValue);\n\n if (onIncrement) {\n onIncrement(resValue);\n }\n\n if (onChange) {\n onChange(null, resValue);\n }\n };\n\n useEffect(() => {\n if (value === undefined || !isNumber(value)) {\n return;\n }\n\n setInnerValue((prevValue) => (prevValue !== value ? value : prevValue));\n }, [value]);\n\n return (\n <Root\n view={view}\n size={size}\n disabled={disabled}\n clear={clear}\n shape={shape}\n segmentation={segmentation}\n isLoading={isLoading}\n {...(segmentation === 'solid' ? { inputBackgroundType: 'clear' } : { inputBackgroundType })}\n className={cx(\n className,\n solidViewClass,\n segmentedViewClass,\n clearViewClass,\n disabledClass,\n loadingClass,\n focusedClass,\n )}\n style={\n {\n ...style,\n [privateTokens.inputWidth]: innerWidth,\n } as CSSProperties\n }\n >\n {customDecrementButton || (\n <ActionButton\n className={cx(\n classes.actionButtonDecrement,\n decrementButtonDisabled,\n solidViewClass,\n segmentedViewClass,\n )}\n icon={decrementIcon || <IconMinus color=\"inherit\" size={actionIconSize} />}\n onClick={handleDecrement}\n />\n )}\n <NumberInput\n ref={ref}\n segmentation={segmentation}\n value={innerValue}\n min={min}\n max={max}\n isManualInput={isManualInput}\n textBefore={textBefore}\n textAfter={textAfter}\n isLoading={isLoading}\n loader={loader}\n disabled={disabled}\n isInputFocused={isInputFocused}\n setIsInputFocused={setIsInputFocused}\n setIsAnimationRun={setIsAnimationRun}\n setInnerValue={setInnerValue}\n onChange={onChange}\n {...rest}\n />\n {customIncrementButton || (\n <ActionButton\n className={cx(\n classes.actionButtonIncrement,\n incrementButtonDisabled,\n solidViewClass,\n segmentedViewClass,\n )}\n icon={incrementIcon || <IconPlus color=\"inherit\" size={actionIconSize} />}\n onClick={handleIncrement}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const numberInputConfig = {\n name: 'NumberInput',\n tag: 'div',\n layout: numberInputRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n shape: {\n css: shapeCSS,\n },\n inputBackgroundType: {\n css: inputBackgroundTypeCSS,\n },\n segmentation: {\n css: segmentationCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'default',\n size: 'l',\n shape: 'cornered',\n segmentation: 'default',\n },\n};\n"],"names":["numberInputRoot","Root","forwardRef","_ref","ref","_ref2","className","style","width","value","min","max","_ref$step","step","isLoading","loader","size","view","clear","shape","segmentation","_ref$inputBackgroundT","inputBackgroundType","disabled","textBefore","textAfter","customIncrementButton","incrementIcon","customDecrementButton","decrementIcon","isManualInput","onChange","onIncrement","onDecrement","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","innerValue","setInnerValue","_useState3","_useState4","isInputFocused","setIsInputFocused","_useState5","_useState6","isAnimationRun","setIsAnimationRun","innerWidth","getSizeValueFromProp","actionIconSize","solidViewClass","classes","solidView","undefined","segmentedViewClass","segmentedView","clearViewClass","clearView","disabledClass","loadingClass","loading","focusedClass","focused","isMinValue","currentValue","isMaxValue","decrementButtonDisabled","Number","actionButtonDecrementDisabled","incrementButtonDisabled","actionButtonIncrementDisabled","handleDecrement","console","log","diffValue","resValue","handleIncrement","useEffect","isNumber","prevValue","React","createElement","_extends","cx","_objectSpread","_defineProperty","privateTokens","inputWidth","ActionButton","actionButtonDecrement","icon","IconMinus","color","onClick","NumberInput","actionButtonIncrement","IconPlus","numberInputConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","shapeCSS","inputBackgroundTypeCSS","segmentationCSS","disabledCSS","attrs","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;IAiBaA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAqD,EAAA;AAAA,EAAA,oBACjFC,UAAU,CACN,UAAAC,IAAA,EA8BIC,GAAG,EACF;AAAA,IAAA,IAAAC,KAAA,CAAA;AAAA,IAAA,IA7BGC,SAAS,GAAAH,IAAA,CAATG,SAAS;MACTC,KAAK,GAAAJ,IAAA,CAALI,KAAK;MACLC,KAAK,GAAAL,IAAA,CAALK,KAAK;MACLC,KAAK,GAAAN,IAAA,CAALM,KAAK;MACLC,GAAG,GAAAP,IAAA,CAAHO,GAAG;MACHC,GAAG,GAAAR,IAAA,CAAHQ,GAAG;MAAAC,SAAA,GAAAT,IAAA,CACHU,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,SAAA;MACRE,SAAS,GAAAX,IAAA,CAATW,SAAS;MACTC,MAAM,GAAAZ,IAAA,CAANY,MAAM;MACNC,IAAI,GAAAb,IAAA,CAAJa,IAAI;MACJC,IAAI,GAAAd,IAAA,CAAJc,IAAI;MACJC,KAAK,GAAAf,IAAA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AAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNlG,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAG;AACTG,IAAAA,KAAK,EAAE,UAAU;AACjBC,IAAAA,YAAY,EAAE,SAAA;AAClB,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"NumberInput.js","sources":["../../../src/components/NumberInput/NumberInput.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, useEffect, useState } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { cx, getSizeValueFromProp, isNumber } from '../../utils';\nimport { IconMinus, IconPlus } from '../_Icon';\n\nimport type { NumberInputProps, NumberInputRootProps } from './NumberInput.types';\nimport { ActionButton, NumberInput } from './ui';\nimport { classes, privateTokens } from './NumberInput.tokens';\nimport { base } from './NumberInput.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as shapeCSS } from './variations/_shape/base';\nimport { base as inputBackgroundTypeCSS } from './variations/_background-type/base';\nimport { base as segmentationCSS } from './variations/_segmentation/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\n\nexport const numberInputRoot = (Root: RootProps<HTMLDivElement, NumberInputRootProps>) =>\n forwardRef<HTMLInputElement, NumberInputProps>(\n (\n {\n className,\n style,\n width,\n value,\n min,\n max,\n step = 1,\n isLoading,\n loader,\n size,\n view,\n clear,\n shape,\n segmentation,\n inputBackgroundType = 'fill',\n disabled,\n textBefore,\n textAfter,\n customIncrementButton,\n incrementIcon,\n customDecrementButton,\n decrementIcon,\n isManualInput,\n onChange,\n onIncrement,\n onDecrement,\n ...rest\n },\n ref,\n ) => {\n const [innerValue, setInnerValue] = useState<number | string>(value ?? min ?? 0);\n const [isInputFocused, setIsInputFocused] = useState(false);\n const [isAnimationRun, setIsAnimationRun] = useState(false);\n\n const innerWidth = width ? getSizeValueFromProp(width) : '100%';\n\n const actionIconSize = size === 'xs' ? 'xs' : 's';\n const solidViewClass = segmentation === 'solid' ? classes.solidView : undefined;\n const segmentedViewClass = segmentation === 'segmented' ? classes.segmentedView : undefined;\n const clearViewClass = clear ? classes.clearView : undefined;\n const disabledClass = disabled ? classes.disabled : undefined;\n const loadingClass = isLoading ? classes.loading : undefined;\n const focusedClass = isInputFocused ? classes.focused : undefined;\n\n const isMinValue = (currentValue: number) => min !== undefined && currentValue <= min;\n const isMaxValue = (currentValue: number) => max !== undefined && currentValue >= max;\n\n const decrementButtonDisabled =\n (isMinValue(Number(innerValue)) && !isAnimationRun) || isLoading\n ? classes.actionButtonDecrementDisabled\n : undefined;\n const incrementButtonDisabled =\n (isMaxValue(Number(innerValue)) && !isAnimationRun) || isLoading\n ? classes.actionButtonIncrementDisabled\n : undefined;\n\n const handleDecrement = () => {\n if (isLoading || disabled || isAnimationRun) {\n return;\n }\n\n const diffValue = Number(innerValue) - step;\n const resValue = min !== undefined && diffValue <= min ? min : diffValue;\n\n setInnerValue(resValue);\n\n if (onDecrement) {\n onDecrement(resValue);\n }\n\n if (onChange) {\n onChange(null, resValue);\n }\n };\n\n const handleIncrement = () => {\n if (isLoading || disabled || isAnimationRun) {\n return;\n }\n\n const diffValue = Number(innerValue) + step;\n const resValue = max !== undefined && diffValue >= max ? max : diffValue;\n\n setInnerValue(resValue);\n\n if (onIncrement) {\n onIncrement(resValue);\n }\n\n if (onChange) {\n onChange(null, resValue);\n }\n };\n\n useEffect(() => {\n if (value === undefined || !isNumber(value)) {\n return;\n }\n\n setInnerValue((prevValue) => (prevValue !== value ? value : prevValue));\n }, [value]);\n\n return (\n <Root\n view={view}\n size={size}\n disabled={disabled}\n clear={clear}\n shape={shape}\n segmentation={segmentation}\n isLoading={isLoading}\n {...(segmentation === 'solid' ? { inputBackgroundType: 'clear' } : { inputBackgroundType })}\n className={cx(\n className,\n solidViewClass,\n segmentedViewClass,\n clearViewClass,\n disabledClass,\n loadingClass,\n focusedClass,\n )}\n style={\n {\n ...style,\n [privateTokens.inputWidth]: innerWidth,\n } as CSSProperties\n }\n >\n {customDecrementButton || (\n <ActionButton\n className={cx(\n classes.actionButtonDecrement,\n decrementButtonDisabled,\n solidViewClass,\n segmentedViewClass,\n )}\n icon={decrementIcon || <IconMinus color=\"inherit\" size={actionIconSize} />}\n onClick={handleDecrement}\n />\n )}\n <NumberInput\n ref={ref}\n segmentation={segmentation}\n value={innerValue}\n min={min}\n max={max}\n isManualInput={isManualInput}\n textBefore={textBefore}\n textAfter={textAfter}\n isLoading={isLoading}\n loader={loader}\n disabled={disabled}\n isInputFocused={isInputFocused}\n setIsInputFocused={setIsInputFocused}\n setIsAnimationRun={setIsAnimationRun}\n setInnerValue={setInnerValue}\n onChange={onChange}\n {...rest}\n />\n {customIncrementButton || (\n <ActionButton\n className={cx(\n classes.actionButtonIncrement,\n incrementButtonDisabled,\n solidViewClass,\n segmentedViewClass,\n )}\n icon={incrementIcon || <IconPlus color=\"inherit\" size={actionIconSize} />}\n onClick={handleIncrement}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const numberInputConfig = {\n name: 'NumberInput',\n tag: 'div',\n layout: numberInputRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n shape: {\n css: shapeCSS,\n },\n inputBackgroundType: {\n css: inputBackgroundTypeCSS,\n },\n segmentation: {\n css: segmentationCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'default',\n size: 'l',\n shape: 'cornered',\n segmentation: 'default',\n },\n};\n"],"names":["numberInputRoot","Root","forwardRef","_ref","ref","_ref2","className","style","width","value","min","max","_ref$step","step","isLoading","loader","size","view","clear","shape","segmentation","_ref$inputBackgroundT","inputBackgroundType","disabled","textBefore","textAfter","customIncrementButton","incrementIcon","customDecrementButton","decrementIcon","isManualInput","onChange","onIncrement","onDecrement","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","innerValue","setInnerValue","_useState3","_useState4","isInputFocused","setIsInputFocused","_useState5","_useState6","isAnimationRun","setIsAnimationRun","innerWidth","getSizeValueFromProp","actionIconSize","solidViewClass","classes","solidView","undefined","segmentedViewClass","segmentedView","clearViewClass","clearView","disabledClass","loadingClass","loading","focusedClass","focused","isMinValue","currentValue","isMaxValue","decrementButtonDisabled","Number","actionButtonDecrementDisabled","incrementButtonDisabled","actionButtonIncrementDisabled","handleDecrement","diffValue","resValue","handleIncrement","useEffect","isNumber","prevValue","React","createElement","_extends","cx","_objectSpread","_defineProperty","privateTokens","inputWidth","ActionButton","actionButtonDecrement","icon","IconMinus","color","onClick","NumberInput","actionButtonIncrement","IconPlus","numberInputConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","shapeCSS","inputBackgroundTypeCSS","segmentationCSS","disabledCSS","attrs","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;IAiBaA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAqD,EAAA;AAAA,EAAA,oBACjFC,UAAU,CACN,UAAAC,IAAA,EA8BIC,GAAG,EACF;AAAA,IAAA,IAAAC,KAAA,CAAA;AAAA,IAAA,IA7BGC,SAAS,GAAAH,IAAA,CAATG,SAAS;MACTC,KAAK,GAAAJ,IAAA,CAALI,KAAK;MACLC,KAAK,GAAAL,IAAA,CAALK,KAAK;MACLC,KAAK,GAAAN,IAAA,CAALM,KAAK;MACLC,GAAG,GAAAP,IAAA,CAAHO,GAAG;MACHC,GAAG,GAAAR,IAAA,CAAHQ,GAAG;MAAAC,SAAA,GAAAT,IAAA,CACHU,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,SAAA;MACRE,SAAS,GAAAX,IAAA,CAATW,SAAS;MACTC,MAAM,GAAAZ,IAAA,CAANY,MAAM;MACNC,IAAI,GAAAb,IAAA,CAAJa,IAAI;MACJC,IAAI,GAAAd,IAAA,CAAJc,IAAI;MACJC,KAAK,GAAAf,IAAA,CAALe,KA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AI,EAAE,GAAG;AACTG,IAAAA,KAAK,EAAE,UAAU;AACjBC,IAAAA,YAAY,EAAE,SAAA;AAClB,GAAA;AACJ;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.186.0-canary.1511.
|
3
|
+
"version": "0.186.0-canary.1511.11721421971.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -128,5 +128,5 @@
|
|
128
128
|
"sideEffects": [
|
129
129
|
"*.css"
|
130
130
|
],
|
131
|
-
"gitHead": "
|
131
|
+
"gitHead": "7cce22b919c2728fdbbe5735a76959817d413435"
|
132
132
|
}
|
@@ -95,7 +95,6 @@ var numberInputRoot = exports.numberInputRoot = function numberInputRoot(Root) {
|
|
95
95
|
var decrementButtonDisabled = isMinValue(Number(innerValue)) && !isAnimationRun || isLoading ? _NumberInput.classes.actionButtonDecrementDisabled : undefined;
|
96
96
|
var incrementButtonDisabled = isMaxValue(Number(innerValue)) && !isAnimationRun || isLoading ? _NumberInput.classes.actionButtonIncrementDisabled : undefined;
|
97
97
|
var handleDecrement = function handleDecrement() {
|
98
|
-
console.log(isAnimationRun);
|
99
98
|
if (isLoading || disabled || isAnimationRun) {
|
100
99
|
return;
|
101
100
|
}
|
@@ -110,7 +109,6 @@ var numberInputRoot = exports.numberInputRoot = function numberInputRoot(Root) {
|
|
110
109
|
}
|
111
110
|
};
|
112
111
|
var handleIncrement = function handleIncrement() {
|
113
|
-
console.log(isAnimationRun);
|
114
112
|
if (isLoading || disabled || isAnimationRun) {
|
115
113
|
return;
|
116
114
|
}
|
@@ -87,7 +87,6 @@ export var numberInputRoot = function numberInputRoot(Root) {
|
|
87
87
|
var decrementButtonDisabled = isMinValue(Number(innerValue)) && !isAnimationRun || isLoading ? classes.actionButtonDecrementDisabled : undefined;
|
88
88
|
var incrementButtonDisabled = isMaxValue(Number(innerValue)) && !isAnimationRun || isLoading ? classes.actionButtonIncrementDisabled : undefined;
|
89
89
|
var handleDecrement = function handleDecrement() {
|
90
|
-
console.log(isAnimationRun);
|
91
90
|
if (isLoading || disabled || isAnimationRun) {
|
92
91
|
return;
|
93
92
|
}
|
@@ -102,7 +101,6 @@ export var numberInputRoot = function numberInputRoot(Root) {
|
|
102
101
|
}
|
103
102
|
};
|
104
103
|
var handleIncrement = function handleIncrement() {
|
105
|
-
console.log(isAnimationRun);
|
106
104
|
if (isLoading || disabled || isAnimationRun) {
|
107
105
|
return;
|
108
106
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../src/components/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAE9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAWlF,eAAO,MAAM,eAAe,SAAU,UAAU,cAAc,EAAE,oBAAoB,CAAC,
|
1
|
+
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../src/components/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAE9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAWlF,eAAO,MAAM,eAAe,SAAU,UAAU,cAAc,EAAE,oBAAoB,CAAC,8FAkLhF,CAAC;AAEN,eAAO,MAAM,iBAAiB;;;mBApLQ,UAAU,cAAc,EAAE,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoNpF,CAAC"}
|