@alfalab/core-components-with-suffix 6.0.17 → 6.0.18-alfasans
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/Component.js.map +1 -1
- package/cssm/Component.js.map +1 -1
- package/cssm/index.module.css +15 -8
- package/esm/Component.js.map +1 -1
- package/esm/index.css +32 -25
- package/esm/index.module.css.js +1 -1
- package/esm/index.module.css.js.map +1 -1
- package/index.css +32 -25
- package/index.module.css.js +1 -1
- package/index.module.css.js.map +1 -1
- package/modern/Component.js.map +1 -1
- package/modern/index.css +32 -25
- package/modern/index.module.css.js +1 -1
- package/modern/index.module.css.js.map +1 -1
- package/moderncssm/Component.js.map +1 -1
- package/moderncssm/index.module.css +12 -6
- package/package.json +6 -6
package/Component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["src/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n forwardRef,\n Fragment,\n type ReactNode,\n type RefAttributes,\n useCallback,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type InputProps } from '@alfalab/core-components-input';\nimport { Portal } from '@alfalab/core-components-portal';\nimport { useRefAsState } from '@alfalab/core-components-shared';\n\nimport styles from './index.module.css';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type withSuffixProps = InputProps & {\n /**\n * Дополнительный закрепленный текст справа от основного значения.\n * Например: value='85' suffix=' мес' -> 85 мес\n */\n suffix?: ReactNode;\n\n /**\n * Дополнительный класс для контейнера с суффиксом\n */\n suffixContainerClassName?: string;\n};\n\nexport const withSuffix = (Input: FC<InputProps & RefAttributes<HTMLInputElement>>) =>\n forwardRef<HTMLInputElement, withSuffixProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n onClear,\n suffix = '',\n placeholder,\n className,\n disabled,\n readOnly,\n suffixContainerClassName,\n ...restProps\n },\n ref,\n ) => {\n const uncontrolled = value === undefined;\n\n const [inputNodeRef, inputNode] = useRefAsState<HTMLInputElement>(null);\n\n const [stateValue, setStateValue] = useState(defaultValue || '');\n\n const handleInputChange = useCallback<Required<InputProps>['onChange']>(\n (event, payload) => {\n if (onChange) {\n onChange(event, payload);\n }\n\n if (uncontrolled) {\n setStateValue(payload.value);\n }\n },\n [onChange, uncontrolled],\n );\n\n const handleClear = useCallback<Required<InputProps>['onClear']>(\n (event) => {\n if (uncontrolled) {\n setStateValue('');\n }\n\n if (onClear) {\n onClear(event);\n }\n },\n [onClear, uncontrolled],\n );\n\n const getPortalContainer = useCallback(\n // TODO: Изменить сигнатуру getPortalContainer в Portal\n () => (inputNode?.parentElement || null) as HTMLElement,\n [inputNode],\n );\n\n const visibleValue = uncontrolled ? stateValue : value;\n\n const isInverted = restProps.colors === 'inverted';\n\n return (\n <Fragment>\n <Input\n ref={mergeRefs([ref, inputNodeRef])}\n value={visibleValue}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleInputChange}\n onClear={handleClear}\n placeholder={placeholder}\n className={cn(className, {\n [styles.suffixVisible]: Boolean(visibleValue),\n [styles.hasSuffix]: suffix,\n })}\n {...restProps}\n />\n <Portal getPortalContainer={getPortalContainer}>\n <div\n translate='no'\n className={cn(styles.suffixContainer, suffixContainerClassName, {\n [styles[`size-${restProps.size}`]]: restProps.size,\n [styles.bold]:\n (restProps.fontWeight ??\n (restProps.bold ? 'bold' : 'regular')) === 'bold',\n [styles.medium]: restProps.fontWeight === 'medium',\n })}\n >\n <span className={styles.spacer}>{visibleValue}</span>\n {suffix && (\n <div\n className={cn(styles.suffix, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.inverted]: isInverted,\n })}\n >\n {suffix}\n </div>\n )}\n </div>\n </Portal>\n </Fragment>\n );\n },\n );\n"],"names":["forwardRef","__rest","useRefAsState","useState","useCallback","React","Fragment","__assign","mergeRefs","cn","styles","Portal"],"mappings":";;;;;;;;;;;;;;;;;;AAgCO,IAAM,UAAU,GAAG,UAAC,KAAuD,EAAA;AAC9E,IAAA,OAAAA,gBAAU,CACN,UACI,EAYC,EACD,GAAG,EAAA;;;AAZC,QAAA,IAAA,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,OAAO,aAAA,EACP,EAAA,GAAA,EAAA,CAAA,MAAW,EAAX,MAAM,mBAAG,EAAE,GAAA,EAAA,EACX,WAAW,iBAAA,EACX,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,wBAAwB,GAAA,EAAA,CAAA,wBAAA,EACrB,SAAS,GAAAC,YAAA,CAAA,EAAA,EAXhB,0IAYC,CADe;AAIhB,QAAA,IAAM,YAAY,GAAG,KAAK,KAAK,SAAS;QAElC,IAAA,EAAA,GAA4BC,kCAAa,CAAmB,IAAI,CAAC,EAAhE,YAAY,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,SAAS,GAAA,EAAA,CAAA,CAAA,CAAyC;AAEjE,QAAA,IAAA,
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["src/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n forwardRef,\n Fragment,\n type ReactNode,\n type RefAttributes,\n useCallback,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type InputProps } from '@alfalab/core-components-input';\nimport { Portal } from '@alfalab/core-components-portal';\nimport { useRefAsState } from '@alfalab/core-components-shared';\n\nimport styles from './index.module.css';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type withSuffixProps = InputProps & {\n /**\n * Дополнительный закрепленный текст справа от основного значения.\n * Например: value='85' suffix=' мес' -> 85 мес\n */\n suffix?: ReactNode;\n\n /**\n * Дополнительный класс для контейнера с суффиксом\n */\n suffixContainerClassName?: string;\n};\n\nexport const withSuffix = (Input: FC<InputProps & RefAttributes<HTMLInputElement>>) =>\n forwardRef<HTMLInputElement, withSuffixProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n onClear,\n suffix = '',\n placeholder,\n className,\n disabled,\n readOnly,\n suffixContainerClassName,\n ...restProps\n },\n ref,\n ) => {\n const uncontrolled = value === undefined;\n\n const [inputNodeRef, inputNode] = useRefAsState<HTMLInputElement>(null);\n\n const [stateValue, setStateValue] = useState(defaultValue || '');\n\n const handleInputChange = useCallback<Required<InputProps>['onChange']>(\n (event, payload) => {\n if (onChange) {\n onChange(event, payload);\n }\n\n if (uncontrolled) {\n setStateValue(payload.value);\n }\n },\n [onChange, uncontrolled],\n );\n\n const handleClear = useCallback<Required<InputProps>['onClear']>(\n (event) => {\n if (uncontrolled) {\n setStateValue('');\n }\n\n if (onClear) {\n onClear(event);\n }\n },\n [onClear, uncontrolled],\n );\n\n const getPortalContainer = useCallback(\n // TODO: Изменить сигнатуру getPortalContainer в Portal\n () => (inputNode?.parentElement || null) as HTMLElement,\n [inputNode],\n );\n\n const visibleValue = uncontrolled ? stateValue : value;\n\n const isInverted = restProps.colors === 'inverted';\n\n return (\n <Fragment>\n <Input\n ref={mergeRefs([ref, inputNodeRef])}\n value={visibleValue}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleInputChange}\n onClear={handleClear}\n placeholder={placeholder}\n className={cn(className, {\n [styles.suffixVisible]: Boolean(visibleValue),\n [styles.hasSuffix]: suffix,\n })}\n {...restProps}\n />\n <Portal getPortalContainer={getPortalContainer}>\n <div\n translate='no'\n className={cn(styles.suffixContainer, suffixContainerClassName, {\n [styles[`size-${restProps.size}`]]: restProps.size,\n [styles.bold]:\n (restProps.fontWeight ??\n (restProps.bold ? 'bold' : 'regular')) === 'bold',\n [styles.medium]: restProps.fontWeight === 'medium',\n })}\n >\n <span className={styles.spacer}>{visibleValue}</span>\n {suffix && (\n <div\n className={cn(styles.suffix, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.inverted]: isInverted,\n })}\n >\n {suffix}\n </div>\n )}\n </div>\n </Portal>\n </Fragment>\n );\n },\n );\n"],"names":["forwardRef","__rest","useRefAsState","useState","useCallback","React","Fragment","__assign","mergeRefs","cn","styles","Portal"],"mappings":";;;;;;;;;;;;;;;;;;AAgCO,IAAM,UAAU,GAAG,UAAC,KAAuD,EAAA;AAC9E,IAAA,OAAAA,gBAAU,CACN,UACI,EAYC,EACD,GAAG,EAAA;;;AAZC,QAAA,IAAA,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,OAAO,aAAA,EACP,EAAA,GAAA,EAAA,CAAA,MAAW,EAAX,MAAM,mBAAG,EAAE,GAAA,EAAA,EACX,WAAW,iBAAA,EACX,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,wBAAwB,GAAA,EAAA,CAAA,wBAAA,EACrB,SAAS,GAAAC,YAAA,CAAA,EAAA,EAXhB,0IAYC,CADe;AAIhB,QAAA,IAAM,YAAY,GAAG,KAAK,KAAK,SAAS;QAElC,IAAA,EAAA,GAA4BC,kCAAa,CAAmB,IAAI,CAAC,EAAhE,YAAY,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,SAAS,GAAA,EAAA,CAAA,CAAA,CAAyC;AAEjE,QAAA,IAAA,EAAA,GAA8BC,cAAQ,CAAC,YAAY,IAAI,EAAE,CAAC,EAAzD,UAAU,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,aAAa,QAAgC;AAEhE,QAAA,IAAM,iBAAiB,GAAGC,iBAAW,CACjC,UAAC,KAAK,EAAE,OAAO,EAAA;YACX,IAAI,QAAQ,EAAE;AACV,gBAAA,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;YAC5B;YAEA,IAAI,YAAY,EAAE;AACd,gBAAA,aAAa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+1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n forwardRef,\n Fragment,\n type ReactNode,\n type RefAttributes,\n useCallback,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type InputProps } from '@alfalab/core-components-input';\nimport { Portal } from '@alfalab/core-components-portal';\nimport { useRefAsState } from '@alfalab/core-components-shared';\n\nimport styles from './index.module.css';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type withSuffixProps = InputProps & {\n /**\n * Дополнительный закрепленный текст справа от основного значения.\n * Например: value='85' suffix=' мес' -> 85 мес\n */\n suffix?: ReactNode;\n\n /**\n * Дополнительный класс для контейнера с суффиксом\n */\n suffixContainerClassName?: string;\n};\n\nexport const withSuffix = (Input: FC<InputProps & RefAttributes<HTMLInputElement>>) =>\n forwardRef<HTMLInputElement, withSuffixProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n onClear,\n suffix = '',\n placeholder,\n className,\n disabled,\n readOnly,\n suffixContainerClassName,\n ...restProps\n },\n ref,\n ) => {\n const uncontrolled = value === undefined;\n\n const [inputNodeRef, inputNode] = useRefAsState<HTMLInputElement>(null);\n\n const [stateValue, setStateValue] = useState(defaultValue || '');\n\n const handleInputChange = useCallback<Required<InputProps>['onChange']>(\n (event, payload) => {\n if (onChange) {\n onChange(event, payload);\n }\n\n if (uncontrolled) {\n setStateValue(payload.value);\n }\n },\n [onChange, uncontrolled],\n );\n\n const handleClear = useCallback<Required<InputProps>['onClear']>(\n (event) => {\n if (uncontrolled) {\n setStateValue('');\n }\n\n if (onClear) {\n onClear(event);\n }\n },\n [onClear, uncontrolled],\n );\n\n const getPortalContainer = useCallback(\n // TODO: Изменить сигнатуру getPortalContainer в Portal\n () => (inputNode?.parentElement || null) as HTMLElement,\n [inputNode],\n );\n\n const visibleValue = uncontrolled ? stateValue : value;\n\n const isInverted = restProps.colors === 'inverted';\n\n return (\n <Fragment>\n <Input\n ref={mergeRefs([ref, inputNodeRef])}\n value={visibleValue}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleInputChange}\n onClear={handleClear}\n placeholder={placeholder}\n className={cn(className, {\n [styles.suffixVisible]: Boolean(visibleValue),\n [styles.hasSuffix]: suffix,\n })}\n {...restProps}\n />\n <Portal getPortalContainer={getPortalContainer}>\n <div\n translate='no'\n className={cn(styles.suffixContainer, suffixContainerClassName, {\n [styles[`size-${restProps.size}`]]: restProps.size,\n [styles.bold]:\n (restProps.fontWeight ??\n (restProps.bold ? 'bold' : 'regular')) === 'bold',\n [styles.medium]: restProps.fontWeight === 'medium',\n })}\n >\n <span className={styles.spacer}>{visibleValue}</span>\n {suffix && (\n <div\n className={cn(styles.suffix, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.inverted]: isInverted,\n })}\n >\n {suffix}\n </div>\n )}\n </div>\n </Portal>\n </Fragment>\n );\n },\n );\n"],"names":["forwardRef","__rest","useRefAsState","useState","useCallback","React","Fragment","__assign","mergeRefs","cn","styles","Portal"],"mappings":";;;;;;;;;;;;;;;;;;;AAgCO,IAAM,UAAU,GAAG,UAAC,KAAuD,EAAA;AAC9E,IAAA,OAAAA,gBAAU,CACN,UACI,EAYC,EACD,GAAG,EAAA;;;AAZC,QAAA,IAAA,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,OAAO,aAAA,EACP,EAAA,GAAA,EAAA,CAAA,MAAW,EAAX,MAAM,mBAAG,EAAE,GAAA,EAAA,EACX,WAAW,iBAAA,EACX,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,wBAAwB,GAAA,EAAA,CAAA,wBAAA,EACrB,SAAS,GAAAC,YAAA,CAAA,EAAA,EAXhB,0IAYC,CADe;AAIhB,QAAA,IAAM,YAAY,GAAG,KAAK,KAAK,SAAS;QAElC,IAAA,EAAA,GAA4BC,kBAAa,CAAmB,IAAI,CAAC,EAAhE,YAAY,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,SAAS,GAAA,EAAA,CAAA,CAAA,CAAyC;AAEjE,QAAA,IAAA,
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n forwardRef,\n Fragment,\n type ReactNode,\n type RefAttributes,\n useCallback,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type InputProps } from '@alfalab/core-components-input';\nimport { Portal } from '@alfalab/core-components-portal';\nimport { useRefAsState } from '@alfalab/core-components-shared';\n\nimport styles from './index.module.css';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type withSuffixProps = InputProps & {\n /**\n * Дополнительный закрепленный текст справа от основного значения.\n * Например: value='85' suffix=' мес' -> 85 мес\n */\n suffix?: ReactNode;\n\n /**\n * Дополнительный класс для контейнера с суффиксом\n */\n suffixContainerClassName?: string;\n};\n\nexport const withSuffix = (Input: FC<InputProps & RefAttributes<HTMLInputElement>>) =>\n forwardRef<HTMLInputElement, withSuffixProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n onClear,\n suffix = '',\n placeholder,\n className,\n disabled,\n readOnly,\n suffixContainerClassName,\n ...restProps\n },\n ref,\n ) => {\n const uncontrolled = value === undefined;\n\n const [inputNodeRef, inputNode] = useRefAsState<HTMLInputElement>(null);\n\n const [stateValue, setStateValue] = useState(defaultValue || '');\n\n const handleInputChange = useCallback<Required<InputProps>['onChange']>(\n (event, payload) => {\n if (onChange) {\n onChange(event, payload);\n }\n\n if (uncontrolled) {\n setStateValue(payload.value);\n }\n },\n [onChange, uncontrolled],\n );\n\n const handleClear = useCallback<Required<InputProps>['onClear']>(\n (event) => {\n if (uncontrolled) {\n setStateValue('');\n }\n\n if (onClear) {\n onClear(event);\n }\n },\n [onClear, uncontrolled],\n );\n\n const getPortalContainer = useCallback(\n // TODO: Изменить сигнатуру getPortalContainer в Portal\n () => (inputNode?.parentElement || null) as HTMLElement,\n [inputNode],\n );\n\n const visibleValue = uncontrolled ? stateValue : value;\n\n const isInverted = restProps.colors === 'inverted';\n\n return (\n <Fragment>\n <Input\n ref={mergeRefs([ref, inputNodeRef])}\n value={visibleValue}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleInputChange}\n onClear={handleClear}\n placeholder={placeholder}\n className={cn(className, {\n [styles.suffixVisible]: Boolean(visibleValue),\n [styles.hasSuffix]: suffix,\n })}\n {...restProps}\n />\n <Portal getPortalContainer={getPortalContainer}>\n <div\n translate='no'\n className={cn(styles.suffixContainer, suffixContainerClassName, {\n [styles[`size-${restProps.size}`]]: restProps.size,\n [styles.bold]:\n (restProps.fontWeight ??\n (restProps.bold ? 'bold' : 'regular')) === 'bold',\n [styles.medium]: restProps.fontWeight === 'medium',\n })}\n >\n <span className={styles.spacer}>{visibleValue}</span>\n {suffix && (\n <div\n className={cn(styles.suffix, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.inverted]: isInverted,\n })}\n >\n {suffix}\n </div>\n )}\n </div>\n </Portal>\n </Fragment>\n );\n },\n );\n"],"names":["forwardRef","__rest","useRefAsState","useState","useCallback","React","Fragment","__assign","mergeRefs","cn","styles","Portal"],"mappings":";;;;;;;;;;;;;;;;;;;AAgCO,IAAM,UAAU,GAAG,UAAC,KAAuD,EAAA;AAC9E,IAAA,OAAAA,gBAAU,CACN,UACI,EAYC,EACD,GAAG,EAAA;;;AAZC,QAAA,IAAA,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,OAAO,aAAA,EACP,EAAA,GAAA,EAAA,CAAA,MAAW,EAAX,MAAM,mBAAG,EAAE,GAAA,EAAA,EACX,WAAW,iBAA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,GAAG,MAAM,GAAG,SAAS,CAAC,MAAM,MAAM;wBACzD,EAAA,CAACA,uBAAM,CAAC,MAAM,CAAA,GAAG,SAAS,CAAC,UAAU,KAAK,QAAQ;AACpD,wBAAA,EAAA,EAAA,EAAA;AAEF,oBAAAL,sBAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAEK,uBAAM,CAAC,MAAM,EAAA,EAAG,YAAY,CAAQ;oBACpD,MAAM,KACHL,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAEI,mBAAE,CAACC,uBAAM,CAAC,MAAM,GAAA,EAAA,GAAA,EAAA;AACvB,4BAAA,EAAA,CAACA,uBAAM,CAAC,QAAQ,CAAA,GAAG,QAAQ;AAC3B,4BAAA,EAAA,CAACA,uBAAM,CAAC,QAAQ,CAAA,GAAG,QAAQ;AAC3B,4BAAA,EAAA,CAACA,uBAAM,CAAC,QAAQ,CAAA,GAAG,UAAU;AAC/B,4BAAA,EAAA,EAAA,EAAA,EAED,MAAM,CACL,CACT,CACC,CACD,CACF;AAEnB,IAAA,CAAC,CACJ;AAvGD;;"}
|
package/cssm/index.module.css
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
--gap-8: 8px;
|
|
8
8
|
}
|
|
9
9
|
:root {
|
|
10
|
-
--font-family-
|
|
11
|
-
system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
10
|
+
--font-family-alfasans:
|
|
11
|
+
'Alfa Interface Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
12
|
+
Helvetica, sans-serif;
|
|
12
13
|
}
|
|
13
14
|
:root {
|
|
14
15
|
--input-disabled-color: var(--color-light-text-tertiary);
|
|
@@ -20,7 +21,8 @@
|
|
|
20
21
|
font-size: 16px;
|
|
21
22
|
line-height: 20px;
|
|
22
23
|
font-weight: 400;
|
|
23
|
-
|
|
24
|
+
letter-spacing: -0.24px;
|
|
25
|
+
font-family: var(--font-family-alfasans);
|
|
24
26
|
|
|
25
27
|
position: absolute;
|
|
26
28
|
left: var(--gap-0);
|
|
@@ -34,19 +36,22 @@
|
|
|
34
36
|
font-size: 16px;
|
|
35
37
|
line-height: 20px;
|
|
36
38
|
font-weight: 700;
|
|
37
|
-
|
|
39
|
+
letter-spacing: 0.43px;
|
|
40
|
+
font-family: var(--font-family-alfasans);
|
|
38
41
|
}
|
|
39
42
|
.suffixContainer.medium {
|
|
40
43
|
font-size: 16px;
|
|
41
44
|
line-height: 20px;
|
|
42
45
|
font-weight: 500;
|
|
43
|
-
|
|
46
|
+
letter-spacing: -0.05px;
|
|
47
|
+
font-family: var(--font-family-alfasans);
|
|
44
48
|
}
|
|
45
49
|
.suffixContainer.size-40 {
|
|
46
50
|
font-size: 14px;
|
|
47
51
|
line-height: 18px;
|
|
48
52
|
font-weight: 400;
|
|
49
|
-
|
|
53
|
+
letter-spacing: -0.08px;
|
|
54
|
+
font-family: var(--font-family-alfasans);
|
|
50
55
|
padding: var(--gap-0) var(--gap-8);
|
|
51
56
|
top: 1px;
|
|
52
57
|
}
|
|
@@ -54,13 +59,15 @@
|
|
|
54
59
|
font-size: 14px;
|
|
55
60
|
line-height: 18px;
|
|
56
61
|
font-weight: 700;
|
|
57
|
-
|
|
62
|
+
letter-spacing: 0.47px;
|
|
63
|
+
font-family: var(--font-family-alfasans);
|
|
58
64
|
}
|
|
59
65
|
.suffixContainer.size-40.medium {
|
|
60
66
|
font-size: 14px;
|
|
61
67
|
line-height: 18px;
|
|
62
68
|
font-weight: 500;
|
|
63
|
-
|
|
69
|
+
letter-spacing: 0.07px;
|
|
70
|
+
font-family: var(--font-family-alfasans);
|
|
64
71
|
}
|
|
65
72
|
input:focus:not(:-moz-read-only) + .suffixContainer {
|
|
66
73
|
display: inline-flex;
|
package/esm/Component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n forwardRef,\n Fragment,\n type ReactNode,\n type RefAttributes,\n useCallback,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type InputProps } from '@alfalab/core-components-input';\nimport { Portal } from '@alfalab/core-components-portal';\nimport { useRefAsState } from '@alfalab/core-components-shared';\n\nimport styles from './index.module.css';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type withSuffixProps = InputProps & {\n /**\n * Дополнительный закрепленный текст справа от основного значения.\n * Например: value='85' suffix=' мес' -> 85 мес\n */\n suffix?: ReactNode;\n\n /**\n * Дополнительный класс для контейнера с суффиксом\n */\n suffixContainerClassName?: string;\n};\n\nexport const withSuffix = (Input: FC<InputProps & RefAttributes<HTMLInputElement>>) =>\n forwardRef<HTMLInputElement, withSuffixProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n onClear,\n suffix = '',\n placeholder,\n className,\n disabled,\n readOnly,\n suffixContainerClassName,\n ...restProps\n },\n ref,\n ) => {\n const uncontrolled = value === undefined;\n\n const [inputNodeRef, inputNode] = useRefAsState<HTMLInputElement>(null);\n\n const [stateValue, setStateValue] = useState(defaultValue || '');\n\n const handleInputChange = useCallback<Required<InputProps>['onChange']>(\n (event, payload) => {\n if (onChange) {\n onChange(event, payload);\n }\n\n if (uncontrolled) {\n setStateValue(payload.value);\n }\n },\n [onChange, uncontrolled],\n );\n\n const handleClear = useCallback<Required<InputProps>['onClear']>(\n (event) => {\n if (uncontrolled) {\n setStateValue('');\n }\n\n if (onClear) {\n onClear(event);\n }\n },\n [onClear, uncontrolled],\n );\n\n const getPortalContainer = useCallback(\n // TODO: Изменить сигнатуру getPortalContainer в Portal\n () => (inputNode?.parentElement || null) as HTMLElement,\n [inputNode],\n );\n\n const visibleValue = uncontrolled ? stateValue : value;\n\n const isInverted = restProps.colors === 'inverted';\n\n return (\n <Fragment>\n <Input\n ref={mergeRefs([ref, inputNodeRef])}\n value={visibleValue}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleInputChange}\n onClear={handleClear}\n placeholder={placeholder}\n className={cn(className, {\n [styles.suffixVisible]: Boolean(visibleValue),\n [styles.hasSuffix]: suffix,\n })}\n {...restProps}\n />\n <Portal getPortalContainer={getPortalContainer}>\n <div\n translate='no'\n className={cn(styles.suffixContainer, suffixContainerClassName, {\n [styles[`size-${restProps.size}`]]: restProps.size,\n [styles.bold]:\n (restProps.fontWeight ??\n (restProps.bold ? 'bold' : 'regular')) === 'bold',\n [styles.medium]: restProps.fontWeight === 'medium',\n })}\n >\n <span className={styles.spacer}>{visibleValue}</span>\n {suffix && (\n <div\n className={cn(styles.suffix, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.inverted]: isInverted,\n })}\n >\n {suffix}\n </div>\n )}\n </div>\n </Portal>\n </Fragment>\n );\n },\n );\n"],"names":[],"mappings":";;;;;;;;AAgCO,IAAM,UAAU,GAAG,UAAC,KAAuD,EAAA;AAC9E,IAAA,OAAA,UAAU,CACN,UACI,EAYC,EACD,GAAG,EAAA;;;AAZC,QAAA,IAAA,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,OAAO,aAAA,EACP,EAAA,GAAA,EAAA,CAAA,MAAW,EAAX,MAAM,mBAAG,EAAE,GAAA,EAAA,EACX,WAAW,iBAAA,EACX,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,wBAAwB,GAAA,EAAA,CAAA,wBAAA,EACrB,SAAS,GAAA,MAAA,CAAA,EAAA,EAXhB,0IAYC,CADe;AAIhB,QAAA,IAAM,YAAY,GAAG,KAAK,KAAK,SAAS;QAElC,IAAA,EAAA,GAA4B,aAAa,CAAmB,IAAI,CAAC,EAAhE,YAAY,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,SAAS,GAAA,EAAA,CAAA,CAAA,CAAyC;AAEjE,QAAA,IAAA,
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n forwardRef,\n Fragment,\n type ReactNode,\n type RefAttributes,\n useCallback,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type InputProps } from '@alfalab/core-components-input';\nimport { Portal } from '@alfalab/core-components-portal';\nimport { useRefAsState } from '@alfalab/core-components-shared';\n\nimport styles from './index.module.css';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type withSuffixProps = InputProps & {\n /**\n * Дополнительный закрепленный текст справа от основного значения.\n * Например: value='85' suffix=' мес' -> 85 мес\n */\n suffix?: ReactNode;\n\n /**\n * Дополнительный класс для контейнера с суффиксом\n */\n suffixContainerClassName?: string;\n};\n\nexport const withSuffix = (Input: FC<InputProps & RefAttributes<HTMLInputElement>>) =>\n forwardRef<HTMLInputElement, withSuffixProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n onClear,\n suffix = '',\n placeholder,\n className,\n disabled,\n readOnly,\n suffixContainerClassName,\n ...restProps\n },\n ref,\n ) => {\n const uncontrolled = value === undefined;\n\n const [inputNodeRef, inputNode] = useRefAsState<HTMLInputElement>(null);\n\n const [stateValue, setStateValue] = useState(defaultValue || '');\n\n const handleInputChange = useCallback<Required<InputProps>['onChange']>(\n (event, payload) => {\n if (onChange) {\n onChange(event, payload);\n }\n\n if (uncontrolled) {\n setStateValue(payload.value);\n }\n },\n [onChange, uncontrolled],\n );\n\n const handleClear = useCallback<Required<InputProps>['onClear']>(\n (event) => {\n if (uncontrolled) {\n setStateValue('');\n }\n\n if (onClear) {\n onClear(event);\n }\n },\n [onClear, uncontrolled],\n );\n\n const getPortalContainer = useCallback(\n // TODO: Изменить сигнатуру getPortalContainer в Portal\n () => (inputNode?.parentElement || null) as HTMLElement,\n [inputNode],\n );\n\n const visibleValue = uncontrolled ? stateValue : value;\n\n const isInverted = restProps.colors === 'inverted';\n\n return (\n <Fragment>\n <Input\n ref={mergeRefs([ref, inputNodeRef])}\n value={visibleValue}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleInputChange}\n onClear={handleClear}\n placeholder={placeholder}\n className={cn(className, {\n [styles.suffixVisible]: Boolean(visibleValue),\n [styles.hasSuffix]: suffix,\n })}\n {...restProps}\n />\n <Portal getPortalContainer={getPortalContainer}>\n <div\n translate='no'\n className={cn(styles.suffixContainer, suffixContainerClassName, {\n [styles[`size-${restProps.size}`]]: restProps.size,\n [styles.bold]:\n (restProps.fontWeight ??\n (restProps.bold ? 'bold' : 'regular')) === 'bold',\n [styles.medium]: restProps.fontWeight === 'medium',\n })}\n >\n <span className={styles.spacer}>{visibleValue}</span>\n {suffix && (\n <div\n className={cn(styles.suffix, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.inverted]: isInverted,\n })}\n >\n {suffix}\n </div>\n )}\n </div>\n </Portal>\n </Fragment>\n );\n },\n );\n"],"names":[],"mappings":";;;;;;;;AAgCO,IAAM,UAAU,GAAG,UAAC,KAAuD,EAAA;AAC9E,IAAA,OAAA,UAAU,CACN,UACI,EAYC,EACD,GAAG,EAAA;;;AAZC,QAAA,IAAA,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,YAAY,GAAA,EAAA,CAAA,YAAA,EACZ,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,OAAO,aAAA,EACP,EAAA,GAAA,EAAA,CAAA,MAAW,EAAX,MAAM,mBAAG,EAAE,GAAA,EAAA,EACX,WAAW,iBAAA,EACX,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,wBAAwB,GAAA,EAAA,CAAA,wBAAA,EACrB,SAAS,GAAA,MAAA,CAAA,EAAA,EAXhB,0IAYC,CADe;AAIhB,QAAA,IAAM,YAAY,GAAG,KAAK,K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M,KACH,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,GAAA,EAAA,GAAA,EAAA;AACvB,4BAAA,EAAA,CAAC,MAAM,CAAC,QAAQ,CAAA,GAAG,QAAQ;AAC3B,4BAAA,EAAA,CAAC,MAAM,CAAC,QAAQ,CAAA,GAAG,QAAQ;AAC3B,4BAAA,EAAA,CAAC,MAAM,CAAC,QAAQ,CAAA,GAAG,UAAU;AAC/B,4BAAA,EAAA,EAAA,EAAA,EAED,MAAM,CACL,CACT,CACC,CACD,CACF;AAEnB,IAAA,CAAC,CACJ;AAvGD;;"}
|
package/esm/index.css
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
--gap-8: 8px;
|
|
8
8
|
}
|
|
9
9
|
:root {
|
|
10
|
-
--font-family-
|
|
11
|
-
system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
10
|
+
--font-family-alfasans:
|
|
11
|
+
'Alfa Interface Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
12
|
+
Helvetica, sans-serif;
|
|
12
13
|
}
|
|
13
14
|
:root {
|
|
14
15
|
--input-disabled-color: var(--color-light-text-tertiary);
|
|
@@ -16,11 +17,12 @@
|
|
|
16
17
|
--input-read-only-color: var(--color-light-text-tertiary);
|
|
17
18
|
--input-inverted-read-only-color: var(--color-light-text-tertiary-inverted);
|
|
18
19
|
}
|
|
19
|
-
.with-
|
|
20
|
+
.with-suffix__suffixContainer_r4g7g {
|
|
20
21
|
font-size: 16px;
|
|
21
22
|
line-height: 20px;
|
|
22
23
|
font-weight: 400;
|
|
23
|
-
|
|
24
|
+
letter-spacing: -0.24px;
|
|
25
|
+
font-family: var(--font-family-alfasans);
|
|
24
26
|
|
|
25
27
|
position: absolute;
|
|
26
28
|
left: var(--gap-0);
|
|
@@ -30,71 +32,76 @@
|
|
|
30
32
|
display: none;
|
|
31
33
|
pointer-events: none;
|
|
32
34
|
}
|
|
33
|
-
.with-
|
|
35
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__bold_r4g7g {
|
|
34
36
|
font-size: 16px;
|
|
35
37
|
line-height: 20px;
|
|
36
38
|
font-weight: 700;
|
|
37
|
-
|
|
39
|
+
letter-spacing: 0.43px;
|
|
40
|
+
font-family: var(--font-family-alfasans);
|
|
38
41
|
}
|
|
39
|
-
.with-
|
|
42
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__medium_r4g7g {
|
|
40
43
|
font-size: 16px;
|
|
41
44
|
line-height: 20px;
|
|
42
45
|
font-weight: 500;
|
|
43
|
-
|
|
46
|
+
letter-spacing: -0.05px;
|
|
47
|
+
font-family: var(--font-family-alfasans);
|
|
44
48
|
}
|
|
45
|
-
.with-
|
|
49
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__size-40_r4g7g {
|
|
46
50
|
font-size: 14px;
|
|
47
51
|
line-height: 18px;
|
|
48
52
|
font-weight: 400;
|
|
49
|
-
|
|
53
|
+
letter-spacing: -0.08px;
|
|
54
|
+
font-family: var(--font-family-alfasans);
|
|
50
55
|
padding: var(--gap-0) var(--gap-8);
|
|
51
56
|
top: 1px;
|
|
52
57
|
}
|
|
53
|
-
.with-
|
|
58
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__size-40_r4g7g.with-suffix__bold_r4g7g {
|
|
54
59
|
font-size: 14px;
|
|
55
60
|
line-height: 18px;
|
|
56
61
|
font-weight: 700;
|
|
57
|
-
|
|
62
|
+
letter-spacing: 0.47px;
|
|
63
|
+
font-family: var(--font-family-alfasans);
|
|
58
64
|
}
|
|
59
|
-
.with-
|
|
65
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__size-40_r4g7g.with-suffix__medium_r4g7g {
|
|
60
66
|
font-size: 14px;
|
|
61
67
|
line-height: 18px;
|
|
62
68
|
font-weight: 500;
|
|
63
|
-
|
|
69
|
+
letter-spacing: 0.07px;
|
|
70
|
+
font-family: var(--font-family-alfasans);
|
|
64
71
|
}
|
|
65
|
-
input:focus:not(:-moz-read-only) + .with-
|
|
72
|
+
input:focus:not(:-moz-read-only) + .with-suffix__suffixContainer_r4g7g {
|
|
66
73
|
display: inline-flex;
|
|
67
74
|
}
|
|
68
|
-
input:focus:not(:read-only) + .with-
|
|
69
|
-
.with-
|
|
75
|
+
input:focus:not(:read-only) + .with-suffix__suffixContainer_r4g7g,
|
|
76
|
+
.with-suffix__suffixVisible_r4g7g .with-suffix__suffixContainer_r4g7g {
|
|
70
77
|
display: inline-flex;
|
|
71
78
|
}
|
|
72
|
-
.with-
|
|
79
|
+
.with-suffix__hasSuffix_r4g7g input:focus::-moz-placeholder {
|
|
73
80
|
color: transparent;
|
|
74
81
|
-moz-transition: none;
|
|
75
82
|
transition: none;
|
|
76
83
|
}
|
|
77
|
-
.with-
|
|
84
|
+
.with-suffix__hasSuffix_r4g7g input:focus::placeholder {
|
|
78
85
|
color: transparent;
|
|
79
86
|
transition: none;
|
|
80
87
|
}
|
|
81
|
-
.with-
|
|
88
|
+
.with-suffix__spacer_r4g7g {
|
|
82
89
|
visibility: hidden;
|
|
83
90
|
flex-shrink: 0;
|
|
84
91
|
white-space: pre;
|
|
85
92
|
}
|
|
86
|
-
.with-
|
|
93
|
+
.with-suffix__suffix_r4g7g {
|
|
87
94
|
white-space: pre;
|
|
88
95
|
}
|
|
89
|
-
.with-
|
|
96
|
+
.with-suffix__disabled_r4g7g {
|
|
90
97
|
color: var(--input-disabled-color);
|
|
91
98
|
}
|
|
92
|
-
.with-
|
|
99
|
+
.with-suffix__disabled_r4g7g.with-suffix__inverted_r4g7g {
|
|
93
100
|
color: var(--input-inverted-disabled-color);
|
|
94
101
|
}
|
|
95
|
-
.with-
|
|
102
|
+
.with-suffix__readOnly_r4g7g {
|
|
96
103
|
color: var(--input-read-only-color);
|
|
97
104
|
}
|
|
98
|
-
.with-
|
|
105
|
+
.with-suffix__readOnly_r4g7g.with-suffix__inverted_r4g7g {
|
|
99
106
|
color: var(--input-inverted-read-only-color);
|
|
100
107
|
}
|
package/esm/index.module.css.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"suffixContainer":"with-
|
|
3
|
+
var styles = {"suffixContainer":"with-suffix__suffixContainer_r4g7g","bold":"with-suffix__bold_r4g7g","medium":"with-suffix__medium_r4g7g","size-40":"with-suffix__size-40_r4g7g","suffixVisible":"with-suffix__suffixVisible_r4g7g","hasSuffix":"with-suffix__hasSuffix_r4g7g","spacer":"with-suffix__spacer_r4g7g","suffix":"with-suffix__suffix_r4g7g","disabled":"with-suffix__disabled_r4g7g","inverted":"with-suffix__inverted_r4g7g","readOnly":"with-suffix__readOnly_r4g7g"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../input/src/vars.css';\n\n.suffixContainer {\n @mixin paragraph_component_primary;\n\n position: absolute;\n left: var(--gap-0);\n top: var(--gap-0);\n bottom: var(--gap-0);\n align-items: center;\n display: none;\n pointer-events: none;\n\n &.bold {\n @mixin accent_component_primary;\n }\n\n &.medium {\n @mixin action_component_primary;\n }\n\n &.size-40 {\n @mixin paragraph_component_secondary;\n padding: var(--gap-0) var(--gap-8);\n\n /* TODO shift on focus. find out why. probably border appers */\n top: 1px;\n\n &.bold {\n @mixin accent_component_secondary;\n }\n\n &.medium {\n @mixin action_component_secondary;\n }\n }\n}\n\ninput:focus:not(:read-only) + .suffixContainer,\n.suffixVisible .suffixContainer {\n display: inline-flex;\n}\n\n.hasSuffix input:focus::placeholder {\n color: transparent;\n transition: none;\n}\n\n.spacer {\n visibility: hidden;\n flex-shrink: 0;\n white-space: pre;\n}\n\n.suffix {\n white-space: pre;\n}\n\n.disabled {\n color: var(--input-disabled-color);\n\n &.inverted {\n color: var(--input-inverted-disabled-color);\n }\n}\n\n.readOnly {\n color: var(--input-read-only-color);\n\n &.inverted {\n color: var(--input-inverted-read-only-color);\n }\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,iBAAiB,CAAC,oCAAoC,CAAC,MAAM,CAAC,yBAAyB,CAAC,QAAQ,CAAC,2BAA2B,CAAC,SAAS,CAAC,4BAA4B,CAAC,eAAe,CAAC,kCAAkC,CAAC,WAAW,CAAC,8BAA8B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../input/src/vars.css';\n\n.suffixContainer {\n @mixin paragraph_component_primary;\n\n position: absolute;\n left: var(--gap-0);\n top: var(--gap-0);\n bottom: var(--gap-0);\n align-items: center;\n display: none;\n pointer-events: none;\n\n &.bold {\n @mixin accent_component_primary;\n }\n\n &.medium {\n @mixin action_component_primary;\n }\n\n &.size-40 {\n @mixin paragraph_component_secondary;\n padding: var(--gap-0) var(--gap-8);\n\n /* TODO shift on focus. find out why. probably border appers */\n top: 1px;\n\n &.bold {\n @mixin accent_component_secondary;\n }\n\n &.medium {\n @mixin action_component_secondary;\n }\n }\n}\n\ninput:focus:not(:read-only) + .suffixContainer,\n.suffixVisible .suffixContainer {\n display: inline-flex;\n}\n\n.hasSuffix input:focus::placeholder {\n color: transparent;\n transition: none;\n}\n\n.spacer {\n visibility: hidden;\n flex-shrink: 0;\n white-space: pre;\n}\n\n.suffix {\n white-space: pre;\n}\n\n.disabled {\n color: var(--input-disabled-color);\n\n &.inverted {\n color: var(--input-inverted-disabled-color);\n }\n}\n\n.readOnly {\n color: var(--input-read-only-color);\n\n &.inverted {\n color: var(--input-inverted-read-only-color);\n }\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,iBAAiB,CAAC,oCAAoC,CAAC,MAAM,CAAC,yBAAyB,CAAC,QAAQ,CAAC,2BAA2B,CAAC,SAAS,CAAC,4BAA4B,CAAC,eAAe,CAAC,kCAAkC,CAAC,WAAW,CAAC,8BAA8B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC;;"}
|
package/index.css
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
--gap-8: 8px;
|
|
8
8
|
}
|
|
9
9
|
:root {
|
|
10
|
-
--font-family-
|
|
11
|
-
system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
10
|
+
--font-family-alfasans:
|
|
11
|
+
'Alfa Interface Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
12
|
+
Helvetica, sans-serif;
|
|
12
13
|
}
|
|
13
14
|
:root {
|
|
14
15
|
--input-disabled-color: var(--color-light-text-tertiary);
|
|
@@ -16,11 +17,12 @@
|
|
|
16
17
|
--input-read-only-color: var(--color-light-text-tertiary);
|
|
17
18
|
--input-inverted-read-only-color: var(--color-light-text-tertiary-inverted);
|
|
18
19
|
}
|
|
19
|
-
.with-
|
|
20
|
+
.with-suffix__suffixContainer_r4g7g {
|
|
20
21
|
font-size: 16px;
|
|
21
22
|
line-height: 20px;
|
|
22
23
|
font-weight: 400;
|
|
23
|
-
|
|
24
|
+
letter-spacing: -0.24px;
|
|
25
|
+
font-family: var(--font-family-alfasans);
|
|
24
26
|
|
|
25
27
|
position: absolute;
|
|
26
28
|
left: var(--gap-0);
|
|
@@ -30,71 +32,76 @@
|
|
|
30
32
|
display: none;
|
|
31
33
|
pointer-events: none;
|
|
32
34
|
}
|
|
33
|
-
.with-
|
|
35
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__bold_r4g7g {
|
|
34
36
|
font-size: 16px;
|
|
35
37
|
line-height: 20px;
|
|
36
38
|
font-weight: 700;
|
|
37
|
-
|
|
39
|
+
letter-spacing: 0.43px;
|
|
40
|
+
font-family: var(--font-family-alfasans);
|
|
38
41
|
}
|
|
39
|
-
.with-
|
|
42
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__medium_r4g7g {
|
|
40
43
|
font-size: 16px;
|
|
41
44
|
line-height: 20px;
|
|
42
45
|
font-weight: 500;
|
|
43
|
-
|
|
46
|
+
letter-spacing: -0.05px;
|
|
47
|
+
font-family: var(--font-family-alfasans);
|
|
44
48
|
}
|
|
45
|
-
.with-
|
|
49
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__size-40_r4g7g {
|
|
46
50
|
font-size: 14px;
|
|
47
51
|
line-height: 18px;
|
|
48
52
|
font-weight: 400;
|
|
49
|
-
|
|
53
|
+
letter-spacing: -0.08px;
|
|
54
|
+
font-family: var(--font-family-alfasans);
|
|
50
55
|
padding: var(--gap-0) var(--gap-8);
|
|
51
56
|
top: 1px;
|
|
52
57
|
}
|
|
53
|
-
.with-
|
|
58
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__size-40_r4g7g.with-suffix__bold_r4g7g {
|
|
54
59
|
font-size: 14px;
|
|
55
60
|
line-height: 18px;
|
|
56
61
|
font-weight: 700;
|
|
57
|
-
|
|
62
|
+
letter-spacing: 0.47px;
|
|
63
|
+
font-family: var(--font-family-alfasans);
|
|
58
64
|
}
|
|
59
|
-
.with-
|
|
65
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__size-40_r4g7g.with-suffix__medium_r4g7g {
|
|
60
66
|
font-size: 14px;
|
|
61
67
|
line-height: 18px;
|
|
62
68
|
font-weight: 500;
|
|
63
|
-
|
|
69
|
+
letter-spacing: 0.07px;
|
|
70
|
+
font-family: var(--font-family-alfasans);
|
|
64
71
|
}
|
|
65
|
-
input:focus:not(:-moz-read-only) + .with-
|
|
72
|
+
input:focus:not(:-moz-read-only) + .with-suffix__suffixContainer_r4g7g {
|
|
66
73
|
display: inline-flex;
|
|
67
74
|
}
|
|
68
|
-
input:focus:not(:read-only) + .with-
|
|
69
|
-
.with-
|
|
75
|
+
input:focus:not(:read-only) + .with-suffix__suffixContainer_r4g7g,
|
|
76
|
+
.with-suffix__suffixVisible_r4g7g .with-suffix__suffixContainer_r4g7g {
|
|
70
77
|
display: inline-flex;
|
|
71
78
|
}
|
|
72
|
-
.with-
|
|
79
|
+
.with-suffix__hasSuffix_r4g7g input:focus::-moz-placeholder {
|
|
73
80
|
color: transparent;
|
|
74
81
|
-moz-transition: none;
|
|
75
82
|
transition: none;
|
|
76
83
|
}
|
|
77
|
-
.with-
|
|
84
|
+
.with-suffix__hasSuffix_r4g7g input:focus::placeholder {
|
|
78
85
|
color: transparent;
|
|
79
86
|
transition: none;
|
|
80
87
|
}
|
|
81
|
-
.with-
|
|
88
|
+
.with-suffix__spacer_r4g7g {
|
|
82
89
|
visibility: hidden;
|
|
83
90
|
flex-shrink: 0;
|
|
84
91
|
white-space: pre;
|
|
85
92
|
}
|
|
86
|
-
.with-
|
|
93
|
+
.with-suffix__suffix_r4g7g {
|
|
87
94
|
white-space: pre;
|
|
88
95
|
}
|
|
89
|
-
.with-
|
|
96
|
+
.with-suffix__disabled_r4g7g {
|
|
90
97
|
color: var(--input-disabled-color);
|
|
91
98
|
}
|
|
92
|
-
.with-
|
|
99
|
+
.with-suffix__disabled_r4g7g.with-suffix__inverted_r4g7g {
|
|
93
100
|
color: var(--input-inverted-disabled-color);
|
|
94
101
|
}
|
|
95
|
-
.with-
|
|
102
|
+
.with-suffix__readOnly_r4g7g {
|
|
96
103
|
color: var(--input-read-only-color);
|
|
97
104
|
}
|
|
98
|
-
.with-
|
|
105
|
+
.with-suffix__readOnly_r4g7g.with-suffix__inverted_r4g7g {
|
|
99
106
|
color: var(--input-inverted-read-only-color);
|
|
100
107
|
}
|
package/index.module.css.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require('./index.css');
|
|
4
4
|
|
|
5
|
-
var styles = {"suffixContainer":"with-
|
|
5
|
+
var styles = {"suffixContainer":"with-suffix__suffixContainer_r4g7g","bold":"with-suffix__bold_r4g7g","medium":"with-suffix__medium_r4g7g","size-40":"with-suffix__size-40_r4g7g","suffixVisible":"with-suffix__suffixVisible_r4g7g","hasSuffix":"with-suffix__hasSuffix_r4g7g","spacer":"with-suffix__spacer_r4g7g","suffix":"with-suffix__suffix_r4g7g","disabled":"with-suffix__disabled_r4g7g","inverted":"with-suffix__inverted_r4g7g","readOnly":"with-suffix__readOnly_r4g7g"};
|
|
6
6
|
|
|
7
7
|
module.exports = styles;
|
|
8
8
|
//# sourceMappingURL=index.module.css.js.map
|
package/index.module.css.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../input/src/vars.css';\n\n.suffixContainer {\n @mixin paragraph_component_primary;\n\n position: absolute;\n left: var(--gap-0);\n top: var(--gap-0);\n bottom: var(--gap-0);\n align-items: center;\n display: none;\n pointer-events: none;\n\n &.bold {\n @mixin accent_component_primary;\n }\n\n &.medium {\n @mixin action_component_primary;\n }\n\n &.size-40 {\n @mixin paragraph_component_secondary;\n padding: var(--gap-0) var(--gap-8);\n\n /* TODO shift on focus. find out why. probably border appers */\n top: 1px;\n\n &.bold {\n @mixin accent_component_secondary;\n }\n\n &.medium {\n @mixin action_component_secondary;\n }\n }\n}\n\ninput:focus:not(:read-only) + .suffixContainer,\n.suffixVisible .suffixContainer {\n display: inline-flex;\n}\n\n.hasSuffix input:focus::placeholder {\n color: transparent;\n transition: none;\n}\n\n.spacer {\n visibility: hidden;\n flex-shrink: 0;\n white-space: pre;\n}\n\n.suffix {\n white-space: pre;\n}\n\n.disabled {\n color: var(--input-disabled-color);\n\n &.inverted {\n color: var(--input-inverted-disabled-color);\n }\n}\n\n.readOnly {\n color: var(--input-read-only-color);\n\n &.inverted {\n color: var(--input-inverted-read-only-color);\n }\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,iBAAiB,CAAC,oCAAoC,CAAC,MAAM,CAAC,yBAAyB,CAAC,QAAQ,CAAC,2BAA2B,CAAC,SAAS,CAAC,4BAA4B,CAAC,eAAe,CAAC,kCAAkC,CAAC,WAAW,CAAC,8BAA8B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../input/src/vars.css';\n\n.suffixContainer {\n @mixin paragraph_component_primary;\n\n position: absolute;\n left: var(--gap-0);\n top: var(--gap-0);\n bottom: var(--gap-0);\n align-items: center;\n display: none;\n pointer-events: none;\n\n &.bold {\n @mixin accent_component_primary;\n }\n\n &.medium {\n @mixin action_component_primary;\n }\n\n &.size-40 {\n @mixin paragraph_component_secondary;\n padding: var(--gap-0) var(--gap-8);\n\n /* TODO shift on focus. find out why. probably border appers */\n top: 1px;\n\n &.bold {\n @mixin accent_component_secondary;\n }\n\n &.medium {\n @mixin action_component_secondary;\n }\n }\n}\n\ninput:focus:not(:read-only) + .suffixContainer,\n.suffixVisible .suffixContainer {\n display: inline-flex;\n}\n\n.hasSuffix input:focus::placeholder {\n color: transparent;\n transition: none;\n}\n\n.spacer {\n visibility: hidden;\n flex-shrink: 0;\n white-space: pre;\n}\n\n.suffix {\n white-space: pre;\n}\n\n.disabled {\n color: var(--input-disabled-color);\n\n &.inverted {\n color: var(--input-inverted-disabled-color);\n }\n}\n\n.readOnly {\n color: var(--input-read-only-color);\n\n &.inverted {\n color: var(--input-inverted-read-only-color);\n }\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,iBAAiB,CAAC,oCAAoC,CAAC,MAAM,CAAC,yBAAyB,CAAC,QAAQ,CAAC,2BAA2B,CAAC,SAAS,CAAC,4BAA4B,CAAC,eAAe,CAAC,kCAAkC,CAAC,WAAW,CAAC,8BAA8B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC;;"}
|
package/modern/Component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n forwardRef,\n Fragment,\n type ReactNode,\n type RefAttributes,\n useCallback,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type InputProps } from '@alfalab/core-components-input';\nimport { Portal } from '@alfalab/core-components-portal';\nimport { useRefAsState } from '@alfalab/core-components-shared';\n\nimport styles from './index.module.css';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type withSuffixProps = InputProps & {\n /**\n * Дополнительный закрепленный текст справа от основного значения.\n * Например: value='85' suffix=' мес' -> 85 мес\n */\n suffix?: ReactNode;\n\n /**\n * Дополнительный класс для контейнера с суффиксом\n */\n suffixContainerClassName?: string;\n};\n\nexport const withSuffix = (Input: FC<InputProps & RefAttributes<HTMLInputElement>>) =>\n forwardRef<HTMLInputElement, withSuffixProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n onClear,\n suffix = '',\n placeholder,\n className,\n disabled,\n readOnly,\n suffixContainerClassName,\n ...restProps\n },\n ref,\n ) => {\n const uncontrolled = value === undefined;\n\n const [inputNodeRef, inputNode] = useRefAsState<HTMLInputElement>(null);\n\n const [stateValue, setStateValue] = useState(defaultValue || '');\n\n const handleInputChange = useCallback<Required<InputProps>['onChange']>(\n (event, payload) => {\n if (onChange) {\n onChange(event, payload);\n }\n\n if (uncontrolled) {\n setStateValue(payload.value);\n }\n },\n [onChange, uncontrolled],\n );\n\n const handleClear = useCallback<Required<InputProps>['onClear']>(\n (event) => {\n if (uncontrolled) {\n setStateValue('');\n }\n\n if (onClear) {\n onClear(event);\n }\n },\n [onClear, uncontrolled],\n );\n\n const getPortalContainer = useCallback(\n // TODO: Изменить сигнатуру getPortalContainer в Portal\n () => (inputNode?.parentElement || null) as HTMLElement,\n [inputNode],\n );\n\n const visibleValue = uncontrolled ? stateValue : value;\n\n const isInverted = restProps.colors === 'inverted';\n\n return (\n <Fragment>\n <Input\n ref={mergeRefs([ref, inputNodeRef])}\n value={visibleValue}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleInputChange}\n onClear={handleClear}\n placeholder={placeholder}\n className={cn(className, {\n [styles.suffixVisible]: Boolean(visibleValue),\n [styles.hasSuffix]: suffix,\n })}\n {...restProps}\n />\n <Portal getPortalContainer={getPortalContainer}>\n <div\n translate='no'\n className={cn(styles.suffixContainer, suffixContainerClassName, {\n [styles[`size-${restProps.size}`]]: restProps.size,\n [styles.bold]:\n (restProps.fontWeight ??\n (restProps.bold ? 'bold' : 'regular')) === 'bold',\n [styles.medium]: restProps.fontWeight === 'medium',\n })}\n >\n <span className={styles.spacer}>{visibleValue}</span>\n {suffix && (\n <div\n className={cn(styles.suffix, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.inverted]: isInverted,\n })}\n >\n {suffix}\n </div>\n )}\n </div>\n </Portal>\n </Fragment>\n );\n },\n );\n"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n forwardRef,\n Fragment,\n type ReactNode,\n type RefAttributes,\n useCallback,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type InputProps } from '@alfalab/core-components-input';\nimport { Portal } from '@alfalab/core-components-portal';\nimport { useRefAsState } from '@alfalab/core-components-shared';\n\nimport styles from './index.module.css';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type withSuffixProps = InputProps & {\n /**\n * Дополнительный закрепленный текст справа от основного значения.\n * Например: value='85' suffix=' мес' -> 85 мес\n */\n suffix?: ReactNode;\n\n /**\n * Дополнительный класс для контейнера с суффиксом\n */\n suffixContainerClassName?: string;\n};\n\nexport const withSuffix = (Input: FC<InputProps & RefAttributes<HTMLInputElement>>) =>\n forwardRef<HTMLInputElement, withSuffixProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n onClear,\n suffix = '',\n placeholder,\n className,\n disabled,\n readOnly,\n suffixContainerClassName,\n ...restProps\n },\n ref,\n ) => {\n const uncontrolled = value === undefined;\n\n const [inputNodeRef, inputNode] = useRefAsState<HTMLInputElement>(null);\n\n const [stateValue, setStateValue] = useState(defaultValue || '');\n\n const handleInputChange = useCallback<Required<InputProps>['onChange']>(\n (event, payload) => {\n if (onChange) {\n onChange(event, payload);\n }\n\n if (uncontrolled) {\n setStateValue(payload.value);\n }\n },\n [onChange, uncontrolled],\n );\n\n const handleClear = useCallback<Required<InputProps>['onClear']>(\n (event) => {\n if (uncontrolled) {\n setStateValue('');\n }\n\n if (onClear) {\n onClear(event);\n }\n },\n [onClear, uncontrolled],\n );\n\n const getPortalContainer = useCallback(\n // TODO: Изменить сигнатуру getPortalContainer в Portal\n () => (inputNode?.parentElement || null) as HTMLElement,\n [inputNode],\n );\n\n const visibleValue = uncontrolled ? stateValue : value;\n\n const isInverted = restProps.colors === 'inverted';\n\n return (\n <Fragment>\n <Input\n ref={mergeRefs([ref, inputNodeRef])}\n value={visibleValue}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleInputChange}\n onClear={handleClear}\n placeholder={placeholder}\n className={cn(className, {\n [styles.suffixVisible]: Boolean(visibleValue),\n [styles.hasSuffix]: suffix,\n })}\n {...restProps}\n />\n <Portal getPortalContainer={getPortalContainer}>\n <div\n translate='no'\n className={cn(styles.suffixContainer, suffixContainerClassName, {\n [styles[`size-${restProps.size}`]]: restProps.size,\n [styles.bold]:\n (restProps.fontWeight ??\n (restProps.bold ? 'bold' : 'regular')) === 'bold',\n [styles.medium]: restProps.fontWeight === 'medium',\n })}\n >\n <span className={styles.spacer}>{visibleValue}</span>\n {suffix && (\n <div\n className={cn(styles.suffix, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.inverted]: isInverted,\n })}\n >\n {suffix}\n </div>\n )}\n </div>\n </Portal>\n </Fragment>\n );\n },\n );\n"],"names":[],"mappings":";;;;;;;AAgCO,MAAM,UAAU,GAAG,CAAC,KAAuD,KAC9E,UAAU,CACN,CACI,EACI,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,MAAM,GAAG,EAAE,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,wBAAwB,EACxB,GAAG,SAAS,EACf,EACD,GAAG,KACH;AACA,IAAA,MAAM,YAAY,GAAG,KAAK,KAAK,SAAS;IAExC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG,aAAa,CAAmB,IAAI,CAAC;AAEvE,IAAA,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC;IAEhE,MAAM,iBAAiB,GAAG,WAAW,CACjC,CAAC,KAAK,EAAE,OAAO,KAAI;QACf,IAAI,QAAQ,EAAE;AACV,YAAA,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;QAC5B;QAEA,IAAI,YAAY,EAAE;AACd,YAAA,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC;QAChC;AACJ,IAAA,CAAC,EACD,CAAC,QAAQ,EAAE,YAAY,CAAC,CAC3B;AAED,IAAA,MAAM,WAAW,GAAG,WAAW,CAC3B,CAAC,KAAK,KAAI;QACN,IAAI,YAAY,EAAE;YACd,aAAa,CAAC,EAAE,CAAC;QACrB;QAEA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AAU;AACjB,yBAAC,SAAS,CAAC,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC,MAAM,MAAM;oBACzD,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,UAAU,KAAK,QAAQ;iBACrD,CAAC,EAAA;AAEF,gBAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAA,EAAG,YAAY,CAAQ;gBACpD,MAAM,KACH,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE;AACzB,wBAAA,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ;AAC3B,wBAAA,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ;AAC3B,wBAAA,CAAC,MAAM,CAAC,QAAQ,GAAG,UAAU;qBAChC,CAAC,EAAA,EAED,MAAM,CACL,CACT,CACC,CACD,CACF;AAEnB,CAAC;;"}
|
package/modern/index.css
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
--gap-8: 8px;
|
|
8
8
|
}
|
|
9
9
|
:root {
|
|
10
|
-
--font-family-
|
|
11
|
-
system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
10
|
+
--font-family-alfasans:
|
|
11
|
+
'Alfa Interface Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
12
|
+
Helvetica, sans-serif;
|
|
12
13
|
}
|
|
13
14
|
:root {
|
|
14
15
|
--input-disabled-color: var(--color-light-text-tertiary);
|
|
@@ -16,11 +17,12 @@
|
|
|
16
17
|
--input-read-only-color: var(--color-light-text-tertiary);
|
|
17
18
|
--input-inverted-read-only-color: var(--color-light-text-tertiary-inverted);
|
|
18
19
|
}
|
|
19
|
-
.with-
|
|
20
|
+
.with-suffix__suffixContainer_r4g7g {
|
|
20
21
|
font-size: 16px;
|
|
21
22
|
line-height: 20px;
|
|
22
23
|
font-weight: 400;
|
|
23
|
-
|
|
24
|
+
letter-spacing: -0.24px;
|
|
25
|
+
font-family: var(--font-family-alfasans);
|
|
24
26
|
|
|
25
27
|
position: absolute;
|
|
26
28
|
left: var(--gap-0);
|
|
@@ -30,71 +32,76 @@
|
|
|
30
32
|
display: none;
|
|
31
33
|
pointer-events: none;
|
|
32
34
|
}
|
|
33
|
-
.with-
|
|
35
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__bold_r4g7g {
|
|
34
36
|
font-size: 16px;
|
|
35
37
|
line-height: 20px;
|
|
36
38
|
font-weight: 700;
|
|
37
|
-
|
|
39
|
+
letter-spacing: 0.43px;
|
|
40
|
+
font-family: var(--font-family-alfasans);
|
|
38
41
|
}
|
|
39
|
-
.with-
|
|
42
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__medium_r4g7g {
|
|
40
43
|
font-size: 16px;
|
|
41
44
|
line-height: 20px;
|
|
42
45
|
font-weight: 500;
|
|
43
|
-
|
|
46
|
+
letter-spacing: -0.05px;
|
|
47
|
+
font-family: var(--font-family-alfasans);
|
|
44
48
|
}
|
|
45
|
-
.with-
|
|
49
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__size-40_r4g7g {
|
|
46
50
|
font-size: 14px;
|
|
47
51
|
line-height: 18px;
|
|
48
52
|
font-weight: 400;
|
|
49
|
-
|
|
53
|
+
letter-spacing: -0.08px;
|
|
54
|
+
font-family: var(--font-family-alfasans);
|
|
50
55
|
padding: var(--gap-0) var(--gap-8);
|
|
51
56
|
top: 1px;
|
|
52
57
|
}
|
|
53
|
-
.with-
|
|
58
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__size-40_r4g7g.with-suffix__bold_r4g7g {
|
|
54
59
|
font-size: 14px;
|
|
55
60
|
line-height: 18px;
|
|
56
61
|
font-weight: 700;
|
|
57
|
-
|
|
62
|
+
letter-spacing: 0.47px;
|
|
63
|
+
font-family: var(--font-family-alfasans);
|
|
58
64
|
}
|
|
59
|
-
.with-
|
|
65
|
+
.with-suffix__suffixContainer_r4g7g.with-suffix__size-40_r4g7g.with-suffix__medium_r4g7g {
|
|
60
66
|
font-size: 14px;
|
|
61
67
|
line-height: 18px;
|
|
62
68
|
font-weight: 500;
|
|
63
|
-
|
|
69
|
+
letter-spacing: 0.07px;
|
|
70
|
+
font-family: var(--font-family-alfasans);
|
|
64
71
|
}
|
|
65
|
-
input:focus:not(:-moz-read-only) + .with-
|
|
72
|
+
input:focus:not(:-moz-read-only) + .with-suffix__suffixContainer_r4g7g {
|
|
66
73
|
display: inline-flex;
|
|
67
74
|
}
|
|
68
|
-
input:focus:not(:read-only) + .with-
|
|
69
|
-
.with-
|
|
75
|
+
input:focus:not(:read-only) + .with-suffix__suffixContainer_r4g7g,
|
|
76
|
+
.with-suffix__suffixVisible_r4g7g .with-suffix__suffixContainer_r4g7g {
|
|
70
77
|
display: inline-flex;
|
|
71
78
|
}
|
|
72
|
-
.with-
|
|
79
|
+
.with-suffix__hasSuffix_r4g7g input:focus::-moz-placeholder {
|
|
73
80
|
color: transparent;
|
|
74
81
|
-moz-transition: none;
|
|
75
82
|
transition: none;
|
|
76
83
|
}
|
|
77
|
-
.with-
|
|
84
|
+
.with-suffix__hasSuffix_r4g7g input:focus::placeholder {
|
|
78
85
|
color: transparent;
|
|
79
86
|
transition: none;
|
|
80
87
|
}
|
|
81
|
-
.with-
|
|
88
|
+
.with-suffix__spacer_r4g7g {
|
|
82
89
|
visibility: hidden;
|
|
83
90
|
flex-shrink: 0;
|
|
84
91
|
white-space: pre;
|
|
85
92
|
}
|
|
86
|
-
.with-
|
|
93
|
+
.with-suffix__suffix_r4g7g {
|
|
87
94
|
white-space: pre;
|
|
88
95
|
}
|
|
89
|
-
.with-
|
|
96
|
+
.with-suffix__disabled_r4g7g {
|
|
90
97
|
color: var(--input-disabled-color);
|
|
91
98
|
}
|
|
92
|
-
.with-
|
|
99
|
+
.with-suffix__disabled_r4g7g.with-suffix__inverted_r4g7g {
|
|
93
100
|
color: var(--input-inverted-disabled-color);
|
|
94
101
|
}
|
|
95
|
-
.with-
|
|
102
|
+
.with-suffix__readOnly_r4g7g {
|
|
96
103
|
color: var(--input-read-only-color);
|
|
97
104
|
}
|
|
98
|
-
.with-
|
|
105
|
+
.with-suffix__readOnly_r4g7g.with-suffix__inverted_r4g7g {
|
|
99
106
|
color: var(--input-inverted-read-only-color);
|
|
100
107
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"suffixContainer":"with-
|
|
3
|
+
const styles = {"suffixContainer":"with-suffix__suffixContainer_r4g7g","bold":"with-suffix__bold_r4g7g","medium":"with-suffix__medium_r4g7g","size-40":"with-suffix__size-40_r4g7g","suffixVisible":"with-suffix__suffixVisible_r4g7g","hasSuffix":"with-suffix__hasSuffix_r4g7g","spacer":"with-suffix__spacer_r4g7g","suffix":"with-suffix__suffix_r4g7g","disabled":"with-suffix__disabled_r4g7g","inverted":"with-suffix__inverted_r4g7g","readOnly":"with-suffix__readOnly_r4g7g"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../input/src/vars.css';\n\n.suffixContainer {\n @mixin paragraph_component_primary;\n\n position: absolute;\n left: var(--gap-0);\n top: var(--gap-0);\n bottom: var(--gap-0);\n align-items: center;\n display: none;\n pointer-events: none;\n\n &.bold {\n @mixin accent_component_primary;\n }\n\n &.medium {\n @mixin action_component_primary;\n }\n\n &.size-40 {\n @mixin paragraph_component_secondary;\n padding: var(--gap-0) var(--gap-8);\n\n /* TODO shift on focus. find out why. probably border appers */\n top: 1px;\n\n &.bold {\n @mixin accent_component_secondary;\n }\n\n &.medium {\n @mixin action_component_secondary;\n }\n }\n}\n\ninput:focus:not(:read-only) + .suffixContainer,\n.suffixVisible .suffixContainer {\n display: inline-flex;\n}\n\n.hasSuffix input:focus::placeholder {\n color: transparent;\n transition: none;\n}\n\n.spacer {\n visibility: hidden;\n flex-shrink: 0;\n white-space: pre;\n}\n\n.suffix {\n white-space: pre;\n}\n\n.disabled {\n color: var(--input-disabled-color);\n\n &.inverted {\n color: var(--input-inverted-disabled-color);\n }\n}\n\n.readOnly {\n color: var(--input-read-only-color);\n\n &.inverted {\n color: var(--input-inverted-read-only-color);\n }\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,iBAAiB,CAAC,oCAAoC,CAAC,MAAM,CAAC,yBAAyB,CAAC,QAAQ,CAAC,2BAA2B,CAAC,SAAS,CAAC,4BAA4B,CAAC,eAAe,CAAC,kCAAkC,CAAC,WAAW,CAAC,8BAA8B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../input/src/vars.css';\n\n.suffixContainer {\n @mixin paragraph_component_primary;\n\n position: absolute;\n left: var(--gap-0);\n top: var(--gap-0);\n bottom: var(--gap-0);\n align-items: center;\n display: none;\n pointer-events: none;\n\n &.bold {\n @mixin accent_component_primary;\n }\n\n &.medium {\n @mixin action_component_primary;\n }\n\n &.size-40 {\n @mixin paragraph_component_secondary;\n padding: var(--gap-0) var(--gap-8);\n\n /* TODO shift on focus. find out why. probably border appers */\n top: 1px;\n\n &.bold {\n @mixin accent_component_secondary;\n }\n\n &.medium {\n @mixin action_component_secondary;\n }\n }\n}\n\ninput:focus:not(:read-only) + .suffixContainer,\n.suffixVisible .suffixContainer {\n display: inline-flex;\n}\n\n.hasSuffix input:focus::placeholder {\n color: transparent;\n transition: none;\n}\n\n.spacer {\n visibility: hidden;\n flex-shrink: 0;\n white-space: pre;\n}\n\n.suffix {\n white-space: pre;\n}\n\n.disabled {\n color: var(--input-disabled-color);\n\n &.inverted {\n color: var(--input-inverted-disabled-color);\n }\n}\n\n.readOnly {\n color: var(--input-read-only-color);\n\n &.inverted {\n color: var(--input-inverted-read-only-color);\n }\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,iBAAiB,CAAC,oCAAoC,CAAC,MAAM,CAAC,yBAAyB,CAAC,QAAQ,CAAC,2BAA2B,CAAC,SAAS,CAAC,4BAA4B,CAAC,eAAe,CAAC,kCAAkC,CAAC,WAAW,CAAC,8BAA8B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU,CAAC,6BAA6B,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n forwardRef,\n Fragment,\n type ReactNode,\n type RefAttributes,\n useCallback,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type InputProps } from '@alfalab/core-components-input';\nimport { Portal } from '@alfalab/core-components-portal';\nimport { useRefAsState } from '@alfalab/core-components-shared';\n\nimport styles from './index.module.css';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type withSuffixProps = InputProps & {\n /**\n * Дополнительный закрепленный текст справа от основного значения.\n * Например: value='85' suffix=' мес' -> 85 мес\n */\n suffix?: ReactNode;\n\n /**\n * Дополнительный класс для контейнера с суффиксом\n */\n suffixContainerClassName?: string;\n};\n\nexport const withSuffix = (Input: FC<InputProps & RefAttributes<HTMLInputElement>>) =>\n forwardRef<HTMLInputElement, withSuffixProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n onClear,\n suffix = '',\n placeholder,\n className,\n disabled,\n readOnly,\n suffixContainerClassName,\n ...restProps\n },\n ref,\n ) => {\n const uncontrolled = value === undefined;\n\n const [inputNodeRef, inputNode] = useRefAsState<HTMLInputElement>(null);\n\n const [stateValue, setStateValue] = useState(defaultValue || '');\n\n const handleInputChange = useCallback<Required<InputProps>['onChange']>(\n (event, payload) => {\n if (onChange) {\n onChange(event, payload);\n }\n\n if (uncontrolled) {\n setStateValue(payload.value);\n }\n },\n [onChange, uncontrolled],\n );\n\n const handleClear = useCallback<Required<InputProps>['onClear']>(\n (event) => {\n if (uncontrolled) {\n setStateValue('');\n }\n\n if (onClear) {\n onClear(event);\n }\n },\n [onClear, uncontrolled],\n );\n\n const getPortalContainer = useCallback(\n // TODO: Изменить сигнатуру getPortalContainer в Portal\n () => (inputNode?.parentElement || null) as HTMLElement,\n [inputNode],\n );\n\n const visibleValue = uncontrolled ? stateValue : value;\n\n const isInverted = restProps.colors === 'inverted';\n\n return (\n <Fragment>\n <Input\n ref={mergeRefs([ref, inputNodeRef])}\n value={visibleValue}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleInputChange}\n onClear={handleClear}\n placeholder={placeholder}\n className={cn(className, {\n [styles.suffixVisible]: Boolean(visibleValue),\n [styles.hasSuffix]: suffix,\n })}\n {...restProps}\n />\n <Portal getPortalContainer={getPortalContainer}>\n <div\n translate='no'\n className={cn(styles.suffixContainer, suffixContainerClassName, {\n [styles[`size-${restProps.size}`]]: restProps.size,\n [styles.bold]:\n (restProps.fontWeight ??\n (restProps.bold ? 'bold' : 'regular')) === 'bold',\n [styles.medium]: restProps.fontWeight === 'medium',\n })}\n >\n <span className={styles.spacer}>{visibleValue}</span>\n {suffix && (\n <div\n className={cn(styles.suffix, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.inverted]: isInverted,\n })}\n >\n {suffix}\n </div>\n )}\n </div>\n </Portal>\n </Fragment>\n );\n },\n );\n"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n forwardRef,\n Fragment,\n type ReactNode,\n type RefAttributes,\n useCallback,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { type InputProps } from '@alfalab/core-components-input';\nimport { Portal } from '@alfalab/core-components-portal';\nimport { useRefAsState } from '@alfalab/core-components-shared';\n\nimport styles from './index.module.css';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type withSuffixProps = InputProps & {\n /**\n * Дополнительный закрепленный текст справа от основного значения.\n * Например: value='85' suffix=' мес' -> 85 мес\n */\n suffix?: ReactNode;\n\n /**\n * Дополнительный класс для контейнера с суффиксом\n */\n suffixContainerClassName?: string;\n};\n\nexport const withSuffix = (Input: FC<InputProps & RefAttributes<HTMLInputElement>>) =>\n forwardRef<HTMLInputElement, withSuffixProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n onClear,\n suffix = '',\n placeholder,\n className,\n disabled,\n readOnly,\n suffixContainerClassName,\n ...restProps\n },\n ref,\n ) => {\n const uncontrolled = value === undefined;\n\n const [inputNodeRef, inputNode] = useRefAsState<HTMLInputElement>(null);\n\n const [stateValue, setStateValue] = useState(defaultValue || '');\n\n const handleInputChange = useCallback<Required<InputProps>['onChange']>(\n (event, payload) => {\n if (onChange) {\n onChange(event, payload);\n }\n\n if (uncontrolled) {\n setStateValue(payload.value);\n }\n },\n [onChange, uncontrolled],\n );\n\n const handleClear = useCallback<Required<InputProps>['onClear']>(\n (event) => {\n if (uncontrolled) {\n setStateValue('');\n }\n\n if (onClear) {\n onClear(event);\n }\n },\n [onClear, uncontrolled],\n );\n\n const getPortalContainer = useCallback(\n // TODO: Изменить сигнатуру getPortalContainer в Portal\n () => (inputNode?.parentElement || null) as HTMLElement,\n [inputNode],\n );\n\n const visibleValue = uncontrolled ? stateValue : value;\n\n const isInverted = restProps.colors === 'inverted';\n\n return (\n <Fragment>\n <Input\n ref={mergeRefs([ref, inputNodeRef])}\n value={visibleValue}\n disabled={disabled}\n readOnly={readOnly}\n onChange={handleInputChange}\n onClear={handleClear}\n placeholder={placeholder}\n className={cn(className, {\n [styles.suffixVisible]: Boolean(visibleValue),\n [styles.hasSuffix]: suffix,\n })}\n {...restProps}\n />\n <Portal getPortalContainer={getPortalContainer}>\n <div\n translate='no'\n className={cn(styles.suffixContainer, suffixContainerClassName, {\n [styles[`size-${restProps.size}`]]: restProps.size,\n [styles.bold]:\n (restProps.fontWeight ??\n (restProps.bold ? 'bold' : 'regular')) === 'bold',\n [styles.medium]: restProps.fontWeight === 'medium',\n })}\n >\n <span className={styles.spacer}>{visibleValue}</span>\n {suffix && (\n <div\n className={cn(styles.suffix, {\n [styles.disabled]: disabled,\n [styles.readOnly]: readOnly,\n [styles.inverted]: isInverted,\n })}\n >\n {suffix}\n </div>\n )}\n </div>\n </Portal>\n </Fragment>\n );\n },\n );\n"],"names":[],"mappings":";;;;;;;AAgCO,MAAM,UAAU,GAAG,CAAC,KAAuD,KAC9E,UAAU,CACN,CACI,EACI,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,MAAM,GAAG,EAAE,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,wBAAwB,EACxB,GAAG,SAAS,EACf,EACD,GAAG,KACH;AACA,IAAA,MAAM,YAAY,GAAG,KAAK,KAAK,SAAS;IAExC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG,aAAa,CAAmB,IAAI,CAAC;AAEvE,IAAA,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC;IAEhE,MAAM,iBAAiB,GAAG,WAAW,CACjC,CAAC,KAAK,EAAE,OAAO,KAAI;QACf,IAAI,QAAQ,EAAE;AACV,YAAA,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;QAC5B;QAEA,IAAI,YAAY,EAAE;AACd,YAAA,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC;QAChC;AACJ,IAAA,C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AE;AAC5D,oBAAA,CAAC,MAAM,CAAC,CAAA,KAAA,EAAQ,SAAS,CAAC,IAAI,CAAA,CAAE,CAAC,GAAG,SAAS,CAAC,IAAI;oBAClD,CAAC,MAAM,CAAC,IAAI,GACR,CAAC,SAAS,CAAC,UAAU;AACjB,yBAAC,SAAS,CAAC,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC,MAAM,MAAM;oBACzD,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,UAAU,KAAK,QAAQ;iBACrD,CAAC,EAAA;AAEF,gBAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAA,EAAG,YAAY,CAAQ;gBACpD,MAAM,KACH,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE;AACzB,wBAAA,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ;AAC3B,wBAAA,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ;AAC3B,wBAAA,CAAC,MAAM,CAAC,QAAQ,GAAG,UAAU;qBAChC,CAAC,EAAA,EAED,MAAM,CACL,CACT,CACC,CACD,CACF;AAEnB,CAAC;;"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
font-size: 16px;
|
|
12
12
|
line-height: 20px;
|
|
13
13
|
font-weight: 400;
|
|
14
|
-
|
|
14
|
+
letter-spacing: -0.24px;
|
|
15
|
+
font-family: var(--font-family-alfasans);
|
|
15
16
|
|
|
16
17
|
position: absolute;
|
|
17
18
|
left: var(--gap-0);
|
|
@@ -26,21 +27,24 @@
|
|
|
26
27
|
font-size: 16px;
|
|
27
28
|
line-height: 20px;
|
|
28
29
|
font-weight: 700;
|
|
29
|
-
|
|
30
|
+
letter-spacing: 0.43px;
|
|
31
|
+
font-family: var(--font-family-alfasans);
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
.suffixContainer.medium {
|
|
33
35
|
font-size: 16px;
|
|
34
36
|
line-height: 20px;
|
|
35
37
|
font-weight: 500;
|
|
36
|
-
|
|
38
|
+
letter-spacing: -0.05px;
|
|
39
|
+
font-family: var(--font-family-alfasans);
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
.suffixContainer.size-40 {
|
|
40
43
|
font-size: 14px;
|
|
41
44
|
line-height: 18px;
|
|
42
45
|
font-weight: 400;
|
|
43
|
-
|
|
46
|
+
letter-spacing: -0.08px;
|
|
47
|
+
font-family: var(--font-family-alfasans);
|
|
44
48
|
padding: var(--gap-0) var(--gap-8);
|
|
45
49
|
top: 1px;
|
|
46
50
|
}
|
|
@@ -49,14 +53,16 @@
|
|
|
49
53
|
font-size: 14px;
|
|
50
54
|
line-height: 18px;
|
|
51
55
|
font-weight: 700;
|
|
52
|
-
|
|
56
|
+
letter-spacing: 0.47px;
|
|
57
|
+
font-family: var(--font-family-alfasans);
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
.suffixContainer.size-40.medium {
|
|
56
61
|
font-size: 14px;
|
|
57
62
|
line-height: 18px;
|
|
58
63
|
font-weight: 500;
|
|
59
|
-
|
|
64
|
+
letter-spacing: 0.07px;
|
|
65
|
+
font-family: var(--font-family-alfasans);
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
input:focus:not(:-moz-read-only) + .suffixContainer {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-with-suffix",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.18-alfasans",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"build": "rollup -c ../../tools/rollup/rollup.config.mjs --silent"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@alfalab/core-components-input": "
|
|
17
|
-
"@alfalab/core-components-portal": "
|
|
18
|
-
"@alfalab/core-components-shared": "
|
|
16
|
+
"@alfalab/core-components-input": "17.2.4-alfasans",
|
|
17
|
+
"@alfalab/core-components-portal": "5.0.7-alfasans",
|
|
18
|
+
"@alfalab/core-components-shared": "2.4.0-alfasans",
|
|
19
19
|
"classnames": "^2.5.1",
|
|
20
20
|
"react-merge-refs": "^1.1.0",
|
|
21
21
|
"tslib": "^2.4.0"
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
"access": "public",
|
|
29
29
|
"directory": "dist"
|
|
30
30
|
},
|
|
31
|
-
"themesVersion": "15.2.
|
|
32
|
-
"varsVersion": "11.
|
|
31
|
+
"themesVersion": "15.2.2-alfasans",
|
|
32
|
+
"varsVersion": "11.6.0-alfasans"
|
|
33
33
|
}
|