@foxford/ui 2.108.1 → 2.109.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/components/Dropdown/Dropdown.js +1 -1
- package/components/Dropdown/Dropdown.js.map +1 -1
- package/components/Dropdown/Dropdown.mjs +1 -1
- package/components/Dropdown/Dropdown.mjs.map +1 -1
- package/components/Dropdown/sizes.js +1 -1
- package/components/Dropdown/sizes.js.map +1 -1
- package/components/Dropdown/sizes.mjs +1 -1
- package/components/Dropdown/sizes.mjs.map +1 -1
- package/components/FormInputLabel/FormInputLabel.js +1 -1
- package/components/FormInputLabel/FormInputLabel.js.map +1 -1
- package/components/FormInputLabel/FormInputLabel.mjs +1 -1
- package/components/FormInputLabel/FormInputLabel.mjs.map +1 -1
- package/components/FormInputLabel/sizes.js +1 -1
- package/components/FormInputLabel/sizes.js.map +1 -1
- package/components/FormInputLabel/sizes.mjs +1 -1
- package/components/FormInputLabel/sizes.mjs.map +1 -1
- package/components/FormInputLabel/style.js +1 -1
- package/components/FormInputLabel/style.js.map +1 -1
- package/components/FormInputLabel/style.mjs +1 -1
- package/components/FormInputLabel/style.mjs.map +1 -1
- package/components/Input/Input.js +1 -1
- package/components/Input/Input.js.map +1 -1
- package/components/Input/Input.mjs +1 -1
- package/components/Input/Input.mjs.map +1 -1
- package/components/Input/sizes.js +1 -1
- package/components/Input/sizes.js.map +1 -1
- package/components/Input/sizes.mjs +1 -1
- package/components/Input/sizes.mjs.map +1 -1
- package/components/Input/style.js +1 -1
- package/components/Input/style.js.map +1 -1
- package/components/Input/style.mjs +1 -1
- package/components/Input/style.mjs.map +1 -1
- package/components/Textarea/Textarea.js +1 -1
- package/components/Textarea/Textarea.js.map +1 -1
- package/components/Textarea/Textarea.mjs +1 -1
- package/components/Textarea/Textarea.mjs.map +1 -1
- package/components/Textarea/sizes.js +1 -1
- package/components/Textarea/sizes.js.map +1 -1
- package/components/Textarea/sizes.mjs +1 -1
- package/components/Textarea/sizes.mjs.map +1 -1
- package/dts/index.d.ts +28 -19
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.mjs","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useEffect,\n useRef,\n useState,\n useMemo,\n useCallback,\n} from 'react'\nimport { useTheme } from 'styled-components'\nimport { nanoid } from 'nanoid'\nimport { ResizeHandle } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { InputLabel } from 'components/InputLabel'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { useResizable } from 'hooks/useResizable'\nimport { createThrottledCallback } from 'shared/utils/misc'\nimport { FormInputLabel } from 'components/FormInputLabel'\nimport { SIZES as SIZES_FORM_INPUT } from 'components/FormInput'\nimport { SIZES } from './sizes'\nimport * as Styled from './style'\nimport type { TextareaProps } from './types'\n\nconst COMPONENT_NAME = 'Textarea'\n\n/**\n *\n * Компонент для приема многострочного ввода.\n *\n * Поддерживается \"ref\" и все нативные атрибуты \\<textarea\\> элемента.\n */\nconst Textarea: React.ForwardRefExoticComponent<TextareaProps> = withMergedProps<TextareaProps, HTMLTextAreaElement>(\n forwardRef<HTMLTextAreaElement, MergedProps<TextareaProps>>((props, forwardedRef) => {\n const theme = useTheme()\n\n const {\n size = 'm',\n rows = 2,\n maxRows = 30,\n labelPosition = 'dynamic',\n primary = true,\n width = theme.defaultInputControlsWidth,\n autosize = true,\n rounded = true,\n color = 'mineShaft',\n placeholderColor = 'silver',\n autoRows,\n resize,\n contrast,\n inline,\n secondary,\n success,\n error,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n margin,\n marginXXS,\n marginXS,\n marginS,\n marginM,\n marginL,\n marginXL,\n marginTop,\n marginTopXXS,\n marginTopXS,\n marginTopS,\n marginTopM,\n marginTopL,\n marginTopXL,\n marginRight,\n marginRightXXS,\n marginRightXS,\n marginRightS,\n marginRightM,\n marginRightL,\n marginRightXL,\n marginBottom,\n marginBottomXXS,\n marginBottomXS,\n marginBottomS,\n marginBottomM,\n marginBottomL,\n marginBottomXL,\n marginLeft,\n marginLeftXXS,\n marginLeftXS,\n marginLeftS,\n marginLeftM,\n marginLeftL,\n marginLeftXL,\n widthXXS,\n widthXS,\n widthS,\n widthM,\n widthL,\n widthXL,\n preset,\n palette,\n label,\n fluid,\n className,\n style,\n disabled,\n ...textareaProps\n } = props\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n\n const textareaMimicRef = useRef<HTMLTextAreaElement>(null)\n\n const formInputLabelRef = useRef<HTMLDivElement>(null)\n\n useImperativeHandle(forwardedRef, () => textareaRef.current as HTMLTextAreaElement, [])\n\n const [resizing, handleResizeStart, handleResizeOnNudge] = useResizable<HTMLDivElement, HTMLSpanElement>({\n target: formInputLabelRef,\n direction: resize,\n })\n\n const labelId = useMemo(() => nanoid(), [])\n\n const [active, setActive] = useState(() => {\n const valueInit = textareaProps.value ?? textareaProps.defaultValue\n\n return typeof valueInit === 'string' && valueInit.length > 0\n })\n\n const [autoRowsCount, setAutoRowsCount] = useState(() => Math.min(rows, maxRows))\n\n const rowsVisible =\n (preset === 'brand' && autoRows) || (preset !== 'brand' && autosize) ? autoRowsCount : Math.min(rows, maxRows)\n\n const cursorResize = resize === 'horizontal' ? 'ew-resize' : resize === 'vertical' ? 'ns-resize' : 'nwse-resize'\n\n const updateAutoRowsCount = useCallback(() => {\n if (!textareaRef.current) return\n\n if (preset === 'brand') {\n if (!textareaMimicRef.current) return\n\n textareaMimicRef.current.value = textareaRef.current.value\n\n const nextRows = Math.max(\n Math.round(textareaMimicRef.current.scrollHeight / textareaMimicRef.current.clientHeight),\n rows\n )\n\n setAutoRowsCount(Math.min(nextRows, maxRows))\n\n return\n }\n\n const styles = getComputedStyle(textareaRef.current)\n\n const lineHeight = parseFloat(styles.lineHeight)\n\n const nextRows = Math.max(\n Math.round(\n (textareaRef.current.scrollHeight - parseFloat(styles.paddingTop) - parseFloat(styles.paddingBottom)) /\n (Number.isNaN(lineHeight) ? parseFloat(styles.fontSize) * 1.2 : lineHeight)\n ),\n rows\n )\n\n setAutoRowsCount((prevRows) => {\n if (nextRows > prevRows) return Math.min(nextRows, maxRows)\n if (textareaRef.current && !textareaRef.current.value) return rows\n\n return prevRows\n })\n }, [preset, rows, maxRows])\n\n useLayoutEffect(() => {\n if (\n preset === 'brand' &&\n typeof textareaProps.value === 'string' &&\n textareaRef.current &&\n textareaRef.current !== document.activeElement\n ) {\n setActive(textareaProps.value.length > 0)\n }\n }, [preset, textareaProps.value])\n\n useEffect(() => {\n const handleResize = createThrottledCallback<UIEvent>(updateAutoRowsCount, 200)\n\n if ((preset === 'brand' && autoRows) || (preset !== 'brand' && autosize)) {\n updateAutoRowsCount()\n window.addEventListener('resize', handleResize)\n }\n\n return () => {\n window.removeEventListener('resize', handleResize)\n }\n }, [preset, autoRows, autosize, updateAutoRowsCount])\n\n if (preset !== 'brand') {\n return (\n <Styled.Root\n {...textareaProps}\n ref={textareaRef}\n className={className}\n style={style}\n onChange={(evt) => {\n if (autosize) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n color={color}\n rounded={rounded}\n placeholderColor={placeholderColor}\n disabled={disabled}\n error={error}\n fluid={fluid}\n width={width}\n widthXXS={widthXXS}\n widthXS={widthXS}\n widthS={widthS}\n widthM={widthM}\n widthL={widthL}\n widthXL={widthXL}\n />\n )\n }\n\n return (\n <FormInputLabel\n {...sizeProps}\n ref={formInputLabelRef}\n sizes={sizes}\n sizeUnits={sizeUnits}\n margin={margin}\n marginXXS={marginXXS}\n marginXS={marginXS}\n marginS={marginS}\n marginM={marginM}\n marginL={marginL}\n marginXL={marginXL}\n marginTop={marginTop}\n marginTopXXS={marginTopXXS}\n marginTopXS={marginTopXS}\n marginTopS={marginTopS}\n marginTopM={marginTopM}\n marginTopL={marginTopL}\n marginTopXL={marginTopXL}\n marginRight={marginRight}\n marginRightXXS={marginRightXXS}\n marginRightXS={marginRightXS}\n marginRightS={marginRightS}\n marginRightM={marginRightM}\n marginRightL={marginRightL}\n marginRightXL={marginRightXL}\n marginBottom={marginBottom}\n marginBottomXXS={marginBottomXXS}\n marginBottomXS={marginBottomXS}\n marginBottomS={marginBottomS}\n marginBottomM={marginBottomM}\n marginBottomL={marginBottomL}\n marginBottomXL={marginBottomXL}\n marginLeft={marginLeft}\n marginLeftXXS={marginLeftXXS}\n marginLeftXS={marginLeftXS}\n marginLeftS={marginLeftS}\n marginLeftM={marginLeftM}\n marginLeftL={marginLeftL}\n marginLeftXL={marginLeftXL}\n className={className}\n style={style}\n contrast={contrast}\n error={error}\n inline={inline}\n disabled={disabled}\n primary={primary}\n secondary={secondary}\n success={success}\n palette={{\n color: disabled ? palette.colorDisabled : palette.color,\n backgroundColor: disabled ? palette.backgroundColorDisabled : palette.backgroundColor,\n backgroundColorHover: disabled ? palette.backgroundColorDisabled : palette.backgroundColorHover,\n borderColor: disabled ? palette.borderColorDisabled : palette.borderColor,\n }}\n onClick={() => {\n if (textareaRef.current) {\n textareaRef.current.focus()\n }\n }}\n onFocus={() => {\n setActive(true)\n }}\n onPointerDown={(evt) => {\n if (evt.target === textareaRef.current || !(evt.target instanceof Node)) {\n return\n }\n evt.preventDefault()\n }}\n onBlur={(evt) => {\n if (textareaRef.current && !evt.currentTarget.contains(evt.relatedTarget)) {\n setActive(Boolean(textareaRef.current.value))\n }\n }}\n overflow='hidden'\n input={\n <InputLabel\n {...sizeProps}\n sizes={SIZES_FORM_INPUT}\n active={active}\n label={label}\n labelId={labelId}\n labelPosition={labelPosition}\n >\n {autoRows ? <Styled.TextareaMimic ref={textareaMimicRef} rows={1} /> : null}\n <Styled.Textarea\n {...textareaProps}\n ref={textareaRef}\n aria-labelledby={label ? labelId : undefined}\n disabled={disabled}\n onChange={(evt) => {\n if (autoRows) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n palette={{\n color: palette.color,\n colorDisabled: palette.colorDisabled,\n placeholderColor: palette.placeholderColor,\n placeholderColorDisabled: palette.placeholderColorDisabled,\n }}\n />\n </InputLabel>\n }\n addonRight={\n resize ? (\n <>\n {resizing ? <Styled.ResizeGlobals cursor={cursorResize} /> : null}\n <Styled.ResizeIcon\n size='l'\n icon={<ResizeHandle />}\n color='border-onmain-default-small'\n tabIndex={0}\n onPointerDown={handleResizeStart}\n onKeyDown={handleResizeOnNudge}\n cursor={cursorResize}\n />\n </>\n ) : null\n }\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { Textarea, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Textarea","withMergedProps","forwardRef","props","forwardedRef","theme","useTheme","size","rows","maxRows","labelPosition","primary","width","defaultInputControlsWidth","autosize","rounded","color","placeholderColor","autoRows","resize","contrast","inline","secondary","success","error","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","margin","marginXXS","marginXS","marginS","marginM","marginL","marginXL","marginTop","marginTopXXS","marginTopXS","marginTopS","marginTopM","marginTopL","marginTopXL","marginRight","marginRightXXS","marginRightXS","marginRightS","marginRightM","marginRightL","marginRightXL","marginBottom","marginBottomXXS","marginBottomXS","marginBottomS","marginBottomM","marginBottomL","marginBottomXL","marginLeft","marginLeftXXS","marginLeftXS","marginLeftS","marginLeftM","marginLeftL","marginLeftXL","widthXXS","widthXS","widthS","widthM","widthL","widthXL","preset","palette","label","fluid","className","style","disabled","textareaProps","sizeProps","textareaRef","useRef","textareaMimicRef","formInputLabelRef","useImperativeHandle","current","resizing","handleResizeStart","handleResizeOnNudge","useResizable","target","direction","labelId","useMemo","nanoid","active","setActive","useState","valueInit","value","defaultValue","length","autoRowsCount","setAutoRowsCount","Math","min","rowsVisible","cursorResize","updateAutoRowsCount","useCallback","nextRows","max","round","scrollHeight","clientHeight","styles","getComputedStyle","lineHeight","parseFloat","paddingTop","paddingBottom","Number","isNaN","fontSize","prevRows","useLayoutEffect","document","activeElement","useEffect","handleResize","createThrottledCallback","window","addEventListener","removeEventListener","_jsx","Styled","ref","onChange","evt","FormInputLabel","colorDisabled","backgroundColor","backgroundColorDisabled","backgroundColorHover","borderColor","borderColorDisabled","onClick","focus","onFocus","onPointerDown","Node","preventDefault","onBlur","currentTarget","contains","relatedTarget","Boolean","overflow","input","_jsxs","InputLabel","SIZES_FORM_INPUT","children","undefined","placeholderColorDisabled","addonRight","_Fragment","cursor","icon","ResizeHandle","tabIndex","onKeyDown","displayName","SIZES"],"mappings":"ywBAwBA,MAAMA,eAAiB,WAQvB,MAAMC,SAA2DC,gBAC/DC,WAA4D,CAACC,EAAOC,KAClE,MAAMC,EAAQC,WAEd,MAAMC,KACJA,EAAO,IAAGC,KACVA,EAAO,EAACC,QACRA,EAAU,GAAEC,cACZA,EAAgB,UAASC,QACzBA,GAAU,EAAIC,MACdA,EAAQP,EAAMQ,0BAAyBC,SACvCA,GAAW,EAAIC,QACfA,GAAU,EAAIC,MACdA,EAAQ,YAAWC,iBACnBA,EAAmB,SAAQC,SAC3BA,EAAQC,OACRA,EAAMC,SACNA,EAAQC,OACRA,EAAMC,UACNA,EAASC,QACTA,EAAOC,MACPA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,MACNA,EAAKC,UACLA,EAASC,OACTA,EAAMC,UACNA,EAASC,SACTA,EAAQC,QACRA,EAAOC,QACPA,EAAOC,QACPA,EAAOC,SACPA,EAAQC,UACRA,EAASC,aACTA,EAAYC,YACZA,EAAWC,WACXA,EAAUC,WACVA,EAAUC,WACVA,EAAUC,YACVA,EAAWC,YACXA,EAAWC,eACXA,EAAcC,cACdA,EAAaC,aACbA,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K,QAAQc,SAG1C0D,SAAS,SACTC,MACEC,KAACC,WAAU,IACLjF,GACJnD,MAAOqI,QACPlE,OAAQA,GACRtB,MAAOA,GACPmB,QAASA,GACTrF,cAAeA,EAAc2J,UAE5BnJ,EAAWuH,IAACC,cAAoB,CAACC,IAAKtD,GAAkB7E,KAAM,IAAQ,KACvEiI,IAACC,WAAe,IACVzD,GACJ0D,IAAKxD,GACL,kBAAiBP,GAAQmB,QAAUuE,EACnCtF,SAAUA,GACV4D,SAAWC,IACL3H,GAAU6F,KACV9B,GAAc2D,UAAU3D,GAAc2D,SAASC,IAErDrI,KAAMqG,GACNlC,QAAS,CACP3D,MAAO2D,GAAQ3D,MACf+H,cAAepE,GAAQoE,cACvB9H,iBAAkB0D,GAAQ1D,iBAC1BsJ,yBAA0B5F,GAAQ4F,+BAK1CC,WACErJ,EACE+I,KAAAO,SAAA,CAAAJ,UACG5E,GAAWgD,IAACC,cAAoB,CAACgC,OAAQ5D,KAAmB,KAC7D2B,IAACC,WAAiB,CAChBnI,KAAK,IACLoK,KAAMlC,IAACmC,iBACP5J,MAAM,8BACN6J,SAAU,EACVrB,cAAe9D,GACfoF,UAAWnF,GACX+E,OAAQ5D,QAGV,SAKZ,CACEiE,YAvVmB,WAwVnBhJ,MAAOiJ"}
|
|
1
|
+
{"version":3,"file":"Textarea.mjs","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useEffect,\n useRef,\n useState,\n useMemo,\n useCallback,\n} from 'react'\nimport { useTheme } from 'styled-components'\nimport { nanoid } from 'nanoid'\nimport { ResizeHandle } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { InputLabel } from 'components/InputLabel'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { useResizable } from 'hooks/useResizable'\nimport { createThrottledCallback } from 'shared/utils/misc'\nimport { FormInputLabel } from 'components/FormInputLabel'\nimport { SIZES as SIZES_FORM_INPUT } from 'components/FormInput'\nimport { SIZES } from './sizes'\nimport * as Styled from './style'\nimport type { TextareaProps } from './types'\n\nconst COMPONENT_NAME = 'Textarea'\n\n/**\n *\n * Компонент для приема многострочного ввода.\n *\n * Поддерживается \"ref\" и все нативные атрибуты \\<textarea\\> элемента.\n */\nconst Textarea: React.ForwardRefExoticComponent<TextareaProps> = withMergedProps<TextareaProps, HTMLTextAreaElement>(\n forwardRef<HTMLTextAreaElement, MergedProps<TextareaProps>>((props, forwardedRef) => {\n const theme = useTheme()\n\n const {\n size = 'm',\n rows = 2,\n maxRows = 30,\n labelPosition = 'dynamic',\n primary = true,\n width = theme.defaultInputControlsWidth,\n autosize = true,\n rounded = true,\n color = 'mineShaft',\n placeholderColor = 'silver',\n autoRows,\n resize,\n contrast,\n inline,\n secondary,\n success,\n error,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n margin,\n marginXXS,\n marginXS,\n marginS,\n marginM,\n marginL,\n marginXL,\n marginTop,\n marginTopXXS,\n marginTopXS,\n marginTopS,\n marginTopM,\n marginTopL,\n marginTopXL,\n marginRight,\n marginRightXXS,\n marginRightXS,\n marginRightS,\n marginRightM,\n marginRightL,\n marginRightXL,\n marginBottom,\n marginBottomXXS,\n marginBottomXS,\n marginBottomS,\n marginBottomM,\n marginBottomL,\n marginBottomXL,\n marginLeft,\n marginLeftXXS,\n marginLeftXS,\n marginLeftS,\n marginLeftM,\n marginLeftL,\n marginLeftXL,\n widthXXS,\n widthXS,\n widthS,\n widthM,\n widthL,\n widthXL,\n preset,\n palette,\n label,\n fluid,\n className,\n style,\n disabled,\n ...textareaProps\n } = props\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n\n const textareaMimicRef = useRef<HTMLTextAreaElement>(null)\n\n const formInputLabelRef = useRef<HTMLDivElement>(null)\n\n useImperativeHandle(forwardedRef, () => textareaRef.current as HTMLTextAreaElement, [])\n\n const [resizing, handleResizeStart, handleResizeOnNudge] = useResizable<HTMLDivElement, HTMLSpanElement>({\n target: formInputLabelRef,\n direction: resize,\n })\n\n const labelId = useMemo(() => nanoid(), [])\n\n const [active, setActive] = useState(() => {\n const valueInit = textareaProps.value ?? textareaProps.defaultValue\n\n return typeof valueInit === 'string' && valueInit.length > 0\n })\n\n const [autoRowsCount, setAutoRowsCount] = useState(() => Math.min(rows, maxRows))\n\n const rowsVisible =\n (preset === 'brand' && autoRows) || (preset !== 'brand' && autosize) ? autoRowsCount : Math.min(rows, maxRows)\n\n const cursorResize = resize === 'horizontal' ? 'ew-resize' : resize === 'vertical' ? 'ns-resize' : 'nwse-resize'\n\n const updateAutoRowsCount = useCallback(() => {\n if (!textareaRef.current) return\n\n if (preset === 'brand') {\n if (!textareaMimicRef.current) return\n\n textareaMimicRef.current.value = textareaRef.current.value\n\n const nextRows = Math.max(\n Math.round(textareaMimicRef.current.scrollHeight / textareaMimicRef.current.clientHeight),\n rows\n )\n\n setAutoRowsCount(Math.min(nextRows, maxRows))\n\n return\n }\n\n const styles = getComputedStyle(textareaRef.current)\n\n const lineHeight = parseFloat(styles.lineHeight)\n\n const nextRows = Math.max(\n Math.round(\n (textareaRef.current.scrollHeight - parseFloat(styles.paddingTop) - parseFloat(styles.paddingBottom)) /\n (Number.isNaN(lineHeight) ? parseFloat(styles.fontSize) * 1.2 : lineHeight)\n ),\n rows\n )\n\n setAutoRowsCount((prevRows) => {\n if (nextRows > prevRows) return Math.min(nextRows, maxRows)\n if (textareaRef.current && !textareaRef.current.value) return rows\n\n return prevRows\n })\n }, [preset, rows, maxRows])\n\n useLayoutEffect(() => {\n if (\n preset === 'brand' &&\n typeof textareaProps.value === 'string' &&\n textareaRef.current &&\n textareaRef.current !== document.activeElement\n ) {\n setActive(textareaProps.value.length > 0)\n }\n }, [preset, textareaProps.value])\n\n useEffect(() => {\n const handleResize = createThrottledCallback<UIEvent>(updateAutoRowsCount, 200)\n\n if ((preset === 'brand' && autoRows) || (preset !== 'brand' && autosize)) {\n updateAutoRowsCount()\n window.addEventListener('resize', handleResize)\n }\n\n return () => {\n window.removeEventListener('resize', handleResize)\n }\n }, [preset, autoRows, autosize, updateAutoRowsCount])\n\n if (preset !== 'brand') {\n return (\n <Styled.Root\n {...textareaProps}\n ref={textareaRef}\n className={className}\n style={style}\n onChange={(evt) => {\n if (autosize) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n color={color}\n rounded={rounded}\n placeholderColor={placeholderColor}\n disabled={disabled}\n error={error}\n fluid={fluid}\n width={width}\n widthXXS={widthXXS}\n widthXS={widthXS}\n widthS={widthS}\n widthM={widthM}\n widthL={widthL}\n widthXL={widthXL}\n />\n )\n }\n\n return (\n <FormInputLabel\n {...sizeProps}\n ref={formInputLabelRef}\n sizes={sizes}\n sizeUnits={sizeUnits}\n margin={margin}\n marginXXS={marginXXS}\n marginXS={marginXS}\n marginS={marginS}\n marginM={marginM}\n marginL={marginL}\n marginXL={marginXL}\n marginTop={marginTop}\n marginTopXXS={marginTopXXS}\n marginTopXS={marginTopXS}\n marginTopS={marginTopS}\n marginTopM={marginTopM}\n marginTopL={marginTopL}\n marginTopXL={marginTopXL}\n marginRight={marginRight}\n marginRightXXS={marginRightXXS}\n marginRightXS={marginRightXS}\n marginRightS={marginRightS}\n marginRightM={marginRightM}\n marginRightL={marginRightL}\n marginRightXL={marginRightXL}\n marginBottom={marginBottom}\n marginBottomXXS={marginBottomXXS}\n marginBottomXS={marginBottomXS}\n marginBottomS={marginBottomS}\n marginBottomM={marginBottomM}\n marginBottomL={marginBottomL}\n marginBottomXL={marginBottomXL}\n marginLeft={marginLeft}\n marginLeftXXS={marginLeftXXS}\n marginLeftXS={marginLeftXS}\n marginLeftS={marginLeftS}\n marginLeftM={marginLeftM}\n marginLeftL={marginLeftL}\n marginLeftXL={marginLeftXL}\n className={className}\n style={style}\n contrast={contrast}\n error={error}\n inline={inline}\n disabled={disabled}\n primary={primary}\n secondary={secondary}\n success={success}\n palette={{\n color: disabled ? palette.colorDisabled : palette.color,\n backgroundColor: disabled ? palette.backgroundColorDisabled : palette.backgroundColor,\n backgroundColorHover: disabled ? palette.backgroundColorDisabled : palette.backgroundColorHover,\n borderColor: disabled ? palette.borderColorDisabled : palette.borderColor,\n }}\n onClick={() => {\n if (textareaRef.current) {\n textareaRef.current.focus()\n }\n }}\n onFocus={() => {\n setActive(true)\n }}\n onPointerDown={(evt) => {\n if (evt.target === textareaRef.current || !(evt.target instanceof Node)) {\n return\n }\n evt.preventDefault()\n }}\n onBlur={(evt) => {\n if (textareaRef.current && !evt.currentTarget.contains(evt.relatedTarget)) {\n setActive(Boolean(textareaRef.current.value))\n }\n }}\n overflow='hidden'\n input={\n <InputLabel\n {...sizeProps}\n sizes={SIZES_FORM_INPUT}\n active={active}\n label={label}\n labelId={labelId}\n labelPosition={labelPosition}\n >\n {autoRows ? <Styled.TextareaMimic ref={textareaMimicRef} rows={1} /> : null}\n <Styled.Textarea\n {...textareaProps}\n ref={textareaRef}\n aria-labelledby={label ? labelId : undefined}\n disabled={disabled}\n onChange={(evt) => {\n if (autoRows) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n palette={{\n color: palette.color,\n colorDisabled: palette.colorDisabled,\n placeholderColor: palette.placeholderColor,\n placeholderColorDisabled: palette.placeholderColorDisabled,\n }}\n />\n </InputLabel>\n }\n floats={\n resize ? (\n <>\n {resizing ? <Styled.ResizeGlobals cursor={cursorResize} /> : null}\n <Styled.ResizeIcon\n size='l'\n icon={<ResizeHandle />}\n color='border-onmain-default-small'\n tabIndex={0}\n onPointerDown={handleResizeStart}\n onKeyDown={handleResizeOnNudge}\n cursor={cursorResize}\n />\n </>\n ) : undefined\n }\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { Textarea, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Textarea","withMergedProps","forwardRef","props","forwardedRef","theme","useTheme","size","rows","maxRows","labelPosition","primary","width","defaultInputControlsWidth","autosize","rounded","color","placeholderColor","autoRows","resize","contrast","inline","secondary","success","error","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","margin","marginXXS","marginXS","marginS","marginM","marginL","marginXL","marginTop","marginTopXXS","marginTopXS","marginTopS","marginTopM","marginTopL","marginTopXL","marginRight","marginRightXXS","marginRightXS","marginRightS","marginRightM","marginRightL","marginRightXL","marginBottom","marginBottomXXS","marginBottomXS","marginBottomS","marginBottomM","marginBottomL","marginBottomXL","marginLeft","marginLeftXXS","marginLeftXS","marginLeftS","marginLeftM","marginLeftL","marginLeftXL","widthXXS","widthXS","widthS","widthM","widthL","widthXL","preset","palette","label","fluid","className","style","disabled","textareaProps","sizeProps","textareaRef","useRef","textareaMimicRef","formInputLabelRef","useImperativeHandle","current","resizing","handleResizeStart","handleResizeOnNudge","useResizable","target","direction","labelId","useMemo","nanoid","active","setActive","useState","valueInit","value","defaultValue","length","autoRowsCount","setAutoRowsCount","Math","min","rowsVisible","cursorResize","updateAutoRowsCount","useCallback","nextRows","max","round","scrollHeight","clientHeight","styles","getComputedStyle","lineHeight","parseFloat","paddingTop","paddingBottom","Number","isNaN","fontSize","prevRows","useLayoutEffect","document","activeElement","useEffect","handleResize","createThrottledCallback","window","addEventListener","removeEventListener","_jsx","Styled","ref","onChange","evt","FormInputLabel","colorDisabled","backgroundColor","backgroundColorDisabled","backgroundColorHover","borderColor","borderColorDisabled","onClick","focus","onFocus","onPointerDown","Node","preventDefault","onBlur","currentTarget","contains","relatedTarget","Boolean","overflow","input","_jsxs","InputLabel","SIZES_FORM_INPUT","children","undefined","placeholderColorDisabled","floats","_Fragment","cursor","icon","ResizeHandle","tabIndex","onKeyDown","displayName","SIZES"],"mappings":"ywBAwBA,MAAMA,eAAiB,WAQv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CC,OACErJ,EACE+I,KAAAO,SAAA,CAAAJ,UACG5E,GAAWgD,IAACC,cAAoB,CAACgC,OAAQ5D,KAAmB,KAC7D2B,IAACC,WAAiB,CAChBnI,KAAK,IACLoK,KAAMlC,IAACmC,iBACP5J,MAAM,8BACN6J,SAAU,EACVrB,cAAe9D,GACfoF,UAAWnF,GACX+E,OAAQ5D,aAGVwD,MAKZ,CACES,YAvVmB,WAwVnBhJ,MAAOiJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var sizes=require('../FormInputLabel/sizes.js');const SIZES={l:{...sizes.SIZES.l,
|
|
1
|
+
'use strict';var sizes=require('../FormInputLabel/sizes.js');const SIZES={l:{...sizes.SIZES.l,height:'auto'},m:{...sizes.SIZES.m,height:'auto'},s:{...sizes.SIZES.s,height:'auto'},xs:{...sizes.SIZES.xs,height:'auto'}};exports.SIZES=SIZES;
|
|
2
2
|
//# sourceMappingURL=sizes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizes.js","sources":["../../../../src/components/Textarea/sizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport { SIZES as SIZES_FORM_INPUT_LABEL } from 'components/FormInputLabel'\nimport type { Size } from './types'\n\nexport const SIZES: Record<Size, CSSProperties> = {\n l: {\n ...SIZES_FORM_INPUT_LABEL.l,\n
|
|
1
|
+
{"version":3,"file":"sizes.js","sources":["../../../../src/components/Textarea/sizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport { SIZES as SIZES_FORM_INPUT_LABEL } from 'components/FormInputLabel'\nimport type { Size } from './types'\n\nexport const SIZES: Record<Size, CSSProperties> = {\n l: {\n ...SIZES_FORM_INPUT_LABEL.l,\n height: 'auto',\n },\n m: {\n ...SIZES_FORM_INPUT_LABEL.m,\n height: 'auto',\n },\n s: {\n ...SIZES_FORM_INPUT_LABEL.s,\n height: 'auto',\n },\n xs: {\n ...SIZES_FORM_INPUT_LABEL.xs,\n height: 'auto',\n },\n}\n"],"names":["SIZES","l","SIZES_FORM_INPUT_LABEL","height","m","s","xs"],"mappings":"6DAIO,MAAMA,MAAqC,CAChDC,EAAG,IACEC,MAAAA,MAAuBD,EAC1BE,OAAQ,QAEVC,EAAG,IACEF,MAAAA,MAAuBE,EAC1BD,OAAQ,QAEVE,EAAG,IACEH,MAAAA,MAAuBG,EAC1BF,OAAQ,QAEVG,GAAI,IACCJ,MAAAA,MAAuBI,GAC1BH,OAAQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{SIZES as SIZES$1}from'../FormInputLabel/sizes.mjs';const SIZES={l:{...SIZES$1.l,
|
|
1
|
+
import{SIZES as SIZES$1}from'../FormInputLabel/sizes.mjs';const SIZES={l:{...SIZES$1.l,height:'auto'},m:{...SIZES$1.m,height:'auto'},s:{...SIZES$1.s,height:'auto'},xs:{...SIZES$1.xs,height:'auto'}};export{SIZES};
|
|
2
2
|
//# sourceMappingURL=sizes.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizes.mjs","sources":["../../../../src/components/Textarea/sizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport { SIZES as SIZES_FORM_INPUT_LABEL } from 'components/FormInputLabel'\nimport type { Size } from './types'\n\nexport const SIZES: Record<Size, CSSProperties> = {\n l: {\n ...SIZES_FORM_INPUT_LABEL.l,\n
|
|
1
|
+
{"version":3,"file":"sizes.mjs","sources":["../../../../src/components/Textarea/sizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport { SIZES as SIZES_FORM_INPUT_LABEL } from 'components/FormInputLabel'\nimport type { Size } from './types'\n\nexport const SIZES: Record<Size, CSSProperties> = {\n l: {\n ...SIZES_FORM_INPUT_LABEL.l,\n height: 'auto',\n },\n m: {\n ...SIZES_FORM_INPUT_LABEL.m,\n height: 'auto',\n },\n s: {\n ...SIZES_FORM_INPUT_LABEL.s,\n height: 'auto',\n },\n xs: {\n ...SIZES_FORM_INPUT_LABEL.xs,\n height: 'auto',\n },\n}\n"],"names":["SIZES","l","SIZES_FORM_INPUT_LABEL","height","m","s","xs"],"mappings":"0DAIO,MAAMA,MAAqC,CAChDC,EAAG,IACEC,QAAuBD,EAC1BE,OAAQ,QAEVC,EAAG,IACEF,QAAuBE,EAC1BD,OAAQ,QAEVE,EAAG,IACEH,QAAuBG,EAC1BF,OAAQ,QAEVG,GAAI,IACCJ,QAAuBI,GAC1BH,OAAQ"}
|
package/dts/index.d.ts
CHANGED
|
@@ -9342,13 +9342,6 @@ ColorProperty,
|
|
|
9342
9342
|
ColorProperty<'placeholderColor'>,
|
|
9343
9343
|
/** @deprecated */
|
|
9344
9344
|
ResponsiveNamedProperty<'width', 'auto' | keyof typeof SizeInput | number> {
|
|
9345
|
-
/**
|
|
9346
|
-
* Пропсы для дополнительной кнопки с правого края.
|
|
9347
|
-
*
|
|
9348
|
-
* Для рендера контрола нужно передать addonButtonProps.icon и addonButtonProps.onClick
|
|
9349
|
-
*
|
|
9350
|
-
* @default {} */
|
|
9351
|
-
addonButtonProps?: Partial<IconButtonProps>;
|
|
9352
9345
|
/**
|
|
9353
9346
|
* Отображение маски при пустом инпуте, который не имеет фокуса.
|
|
9354
9347
|
*
|
|
@@ -9383,16 +9376,6 @@ ResponsiveNamedProperty<'width', 'auto' | keyof typeof SizeInput | number> {
|
|
|
9383
9376
|
* @mask
|
|
9384
9377
|
* @default undefined */
|
|
9385
9378
|
formatChars?: Record<string, string>;
|
|
9386
|
-
/**
|
|
9387
|
-
* Иконки для отображения с левого и правого края.
|
|
9388
|
-
*
|
|
9389
|
-
* @default undefined */
|
|
9390
|
-
icon?: JSX.Element | IconName | [Nullable<JSX.Element | IconName>, Nullable<JSX.Element | IconName>];
|
|
9391
|
-
/**
|
|
9392
|
-
* Пропсы для компонентов иконок.
|
|
9393
|
-
*
|
|
9394
|
-
* @default {} */
|
|
9395
|
-
iconProps?: IconProps;
|
|
9396
9379
|
/**
|
|
9397
9380
|
* Отображать компонент на одной линии с другими.
|
|
9398
9381
|
*
|
|
@@ -9501,6 +9484,24 @@ ResponsiveNamedProperty<'width', 'auto' | keyof typeof SizeInput | number> {
|
|
|
9501
9484
|
* @general
|
|
9502
9485
|
* @default undefined */
|
|
9503
9486
|
value?: string;
|
|
9487
|
+
/**
|
|
9488
|
+
* Дополнительные элементы слева.
|
|
9489
|
+
*
|
|
9490
|
+
* @slot
|
|
9491
|
+
* @default undefined */
|
|
9492
|
+
addonLeft?: React.ReactElement | ((props: {
|
|
9493
|
+
iconProps: IconProps;
|
|
9494
|
+
iconButtonProps: Omit<IconButtonProps, 'icon'>;
|
|
9495
|
+
}) => React.ReactNode);
|
|
9496
|
+
/**
|
|
9497
|
+
* Дополнительные элементы справа.
|
|
9498
|
+
*
|
|
9499
|
+
* @slot
|
|
9500
|
+
* @default undefined */
|
|
9501
|
+
addonRight?: React.ReactElement | ((props: {
|
|
9502
|
+
iconProps: IconProps;
|
|
9503
|
+
iconButtonProps: Omit<IconButtonProps, 'icon'>;
|
|
9504
|
+
}) => React.ReactNode);
|
|
9504
9505
|
/**
|
|
9505
9506
|
* Размер.
|
|
9506
9507
|
*
|
|
@@ -9588,6 +9589,12 @@ ResponsiveNamedProperty<'width', 'auto' | keyof typeof SizeInput | number> {
|
|
|
9588
9589
|
/** @ignore */
|
|
9589
9590
|
rounded?: boolean;
|
|
9590
9591
|
/** @ignore @deprecated */
|
|
9592
|
+
addonButtonProps?: Partial<IconButtonProps>;
|
|
9593
|
+
/** @ignore @deprecated */
|
|
9594
|
+
icon?: JSX.Element | IconName | [Nullable<JSX.Element | IconName>, Nullable<JSX.Element | IconName>];
|
|
9595
|
+
/** @ignore @deprecated */
|
|
9596
|
+
iconProps?: IconProps;
|
|
9597
|
+
/** @ignore @deprecated */
|
|
9591
9598
|
onColored?: boolean;
|
|
9592
9599
|
/** @ignore @deprecated */
|
|
9593
9600
|
controls?: {
|
|
@@ -9610,7 +9617,9 @@ type StyledBaseInputProps = React.ComponentPropsWithoutRef<'input'> & Pick<Input
|
|
|
9610
9617
|
|
|
9611
9618
|
/**
|
|
9612
9619
|
*
|
|
9613
|
-
*
|
|
9620
|
+
* *v1.0.0*
|
|
9621
|
+
*
|
|
9622
|
+
* Контрол для приема однострочного ввода.
|
|
9614
9623
|
*
|
|
9615
9624
|
* Поддерживается "ref" и все нативные атрибуты \<input\> элемента.
|
|
9616
9625
|
*/
|
|
@@ -10454,7 +10463,7 @@ interface DropdownBaseProps extends ResponsiveSizeProps<Size$1>, ResponsiveMargi
|
|
|
10454
10463
|
*
|
|
10455
10464
|
* @slot
|
|
10456
10465
|
* @default undefined */
|
|
10457
|
-
addonLeft?: React.
|
|
10466
|
+
addonLeft?: React.ReactElement | ((addonLeftProps: {
|
|
10458
10467
|
iconProps: IconProps;
|
|
10459
10468
|
}) => React.ReactNode);
|
|
10460
10469
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxford/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.109.0",
|
|
4
4
|
"description": "UI components and utilities",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/foxford/ui/issues"
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
"shared",
|
|
64
64
|
"theme"
|
|
65
65
|
],
|
|
66
|
-
"sha": "
|
|
66
|
+
"sha": "7902d42",
|
|
67
67
|
"scripts": {}
|
|
68
68
|
}
|