@salutejs/plasma-new-hope 0.146.0-canary.1436.10882554984.0 → 0.147.0-canary.1437.10886798256.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Attach/Attach.css +45 -0
- package/cjs/components/Attach/Attach.js +174 -0
- package/cjs/components/Attach/Attach.js.map +1 -0
- package/cjs/components/Attach/Attach.styles.js +23 -0
- package/cjs/components/Attach/Attach.styles.js.map +1 -0
- package/cjs/components/Attach/Attach.styles_17fejif.css +3 -0
- package/cjs/components/Attach/Attach.tokens.js +83 -0
- package/cjs/components/Attach/Attach.tokens.js.map +1 -0
- package/cjs/components/Attach/ui/Button/Button.styles.js +23 -0
- package/cjs/components/Attach/ui/Button/Button.styles.js.map +1 -0
- package/cjs/components/Attach/ui/Button/Button.styles_oi6jxf.css +1 -0
- package/cjs/components/Attach/ui/Cell/Cell.styles.js +25 -0
- package/cjs/components/Attach/ui/Cell/Cell.styles.js.map +1 -0
- package/cjs/components/Attach/ui/Cell/Cell.styles_1dlvsak.css +1 -0
- package/cjs/components/Attach/ui/iconButton/IconButton.styles.js +23 -0
- package/cjs/components/Attach/ui/iconButton/IconButton.styles.js.map +1 -0
- package/cjs/components/Attach/ui/iconButton/IconButton.styles_14dty7n.css +1 -0
- package/cjs/components/Attach/utils/extractExtension.js +10 -0
- package/cjs/components/Attach/utils/extractExtension.js.map +1 -0
- package/cjs/components/Attach/utils/getFileicon.js +27 -0
- package/cjs/components/Attach/utils/getFileicon.js.map +1 -0
- package/cjs/components/Attach/utils/truncateFilename.js +16 -0
- package/cjs/components/Attach/utils/truncateFilename.js.map +1 -0
- package/cjs/components/Attach/variations/_size/base.js +9 -0
- package/cjs/components/Attach/variations/_size/base.js.map +1 -0
- package/cjs/components/Attach/variations/_size/base_eax0b8.css +1 -0
- package/cjs/components/Attach/variations/_view/base.js +9 -0
- package/cjs/components/Attach/variations/_view/base.js.map +1 -0
- package/cjs/components/Attach/variations/_view/base_1nvsg1b.css +1 -0
- package/cjs/components/Cell/Cell.js +3 -2
- package/cjs/components/Cell/Cell.js.map +1 -1
- package/cjs/index.css +14 -0
- package/cjs/index.js +5 -0
- package/cjs/index.js.map +1 -1
- package/emotion/cjs/components/Attach/Attach.js +180 -0
- package/emotion/cjs/components/Attach/Attach.styles.js +36 -0
- package/emotion/cjs/components/Attach/Attach.tokens.js +81 -0
- package/emotion/cjs/components/Attach/Attach.types.js +5 -0
- package/emotion/cjs/components/Attach/index.js +25 -0
- package/emotion/cjs/components/Attach/ui/Button/Button.js +12 -0
- package/emotion/cjs/components/Attach/ui/Button/Button.styles.js +17 -0
- package/emotion/cjs/components/Attach/ui/Cell/Cell.js +12 -0
- package/emotion/cjs/components/Attach/ui/Cell/Cell.styles.js +17 -0
- package/emotion/cjs/components/Attach/ui/iconButton/IconButton.js +12 -0
- package/emotion/cjs/components/Attach/ui/iconButton/IconButton.styles.js +17 -0
- package/emotion/cjs/components/Attach/utils/extractExtension.js +9 -0
- package/emotion/cjs/components/Attach/utils/getFileicon.js +26 -0
- package/emotion/cjs/components/Attach/utils/index.js +26 -0
- package/emotion/cjs/components/Attach/utils/truncateFilename.js +15 -0
- package/emotion/cjs/components/Attach/variations/_size/base.js +9 -0
- package/emotion/cjs/components/Attach/variations/_view/base.js +9 -0
- package/emotion/cjs/components/Cell/Cell.js +3 -2
- package/emotion/cjs/examples/plasma_b2c/components/Attach/Attach.config.js +25 -0
- package/emotion/cjs/examples/plasma_b2c/components/Attach/Attach.js +11 -0
- package/emotion/cjs/examples/plasma_b2c/components/Attach/Attach.stories.tsx +61 -0
- package/emotion/cjs/examples/plasma_web/components/Attach/Attach.config.js +25 -0
- package/emotion/cjs/examples/plasma_web/components/Attach/Attach.js +11 -0
- package/emotion/cjs/examples/plasma_web/components/Attach/Attach.stories.tsx +61 -0
- package/emotion/cjs/index.js +11 -0
- package/emotion/es/components/Attach/Attach.js +171 -0
- package/emotion/es/components/Attach/Attach.styles.js +29 -0
- package/emotion/es/components/Attach/Attach.tokens.js +75 -0
- package/emotion/es/components/Attach/Attach.types.js +1 -0
- package/emotion/es/components/Attach/index.js +2 -0
- package/emotion/es/components/Attach/ui/Button/Button.js +1 -0
- package/emotion/es/components/Attach/ui/Button/Button.styles.js +10 -0
- package/emotion/es/components/Attach/ui/Cell/Cell.js +1 -0
- package/emotion/es/components/Attach/ui/Cell/Cell.styles.js +10 -0
- package/emotion/es/components/Attach/ui/iconButton/IconButton.js +1 -0
- package/emotion/es/components/Attach/ui/iconButton/IconButton.styles.js +10 -0
- package/emotion/es/components/Attach/utils/extractExtension.js +3 -0
- package/emotion/es/components/Attach/utils/getFileicon.js +19 -0
- package/emotion/es/components/Attach/utils/index.js +3 -0
- package/emotion/es/components/Attach/utils/truncateFilename.js +9 -0
- package/emotion/es/components/Attach/variations/_size/base.js +3 -0
- package/emotion/es/components/Attach/variations/_view/base.js +3 -0
- package/emotion/es/components/Cell/Cell.js +3 -2
- package/emotion/es/examples/plasma_b2c/components/Attach/Attach.config.js +19 -0
- package/emotion/es/examples/plasma_b2c/components/Attach/Attach.js +5 -0
- package/emotion/es/examples/plasma_b2c/components/Attach/Attach.stories.tsx +61 -0
- package/emotion/es/examples/plasma_web/components/Attach/Attach.config.js +19 -0
- package/emotion/es/examples/plasma_web/components/Attach/Attach.js +5 -0
- package/emotion/es/examples/plasma_web/components/Attach/Attach.stories.tsx +61 -0
- package/emotion/es/index.js +2 -1
- package/es/components/Attach/Attach.css +45 -0
- package/es/components/Attach/Attach.js +169 -0
- package/es/components/Attach/Attach.js.map +1 -0
- package/es/components/Attach/Attach.styles.js +17 -0
- package/es/components/Attach/Attach.styles.js.map +1 -0
- package/es/components/Attach/Attach.styles_17fejif.css +3 -0
- package/es/components/Attach/Attach.tokens.js +78 -0
- package/es/components/Attach/Attach.tokens.js.map +1 -0
- package/es/components/Attach/ui/Button/Button.styles.js +19 -0
- package/es/components/Attach/ui/Button/Button.styles.js.map +1 -0
- package/es/components/Attach/ui/Button/Button.styles_oi6jxf.css +1 -0
- package/es/components/Attach/ui/Cell/Cell.styles.js +21 -0
- package/es/components/Attach/ui/Cell/Cell.styles.js.map +1 -0
- package/es/components/Attach/ui/Cell/Cell.styles_1dlvsak.css +1 -0
- package/es/components/Attach/ui/iconButton/IconButton.styles.js +19 -0
- package/es/components/Attach/ui/iconButton/IconButton.styles.js.map +1 -0
- package/es/components/Attach/ui/iconButton/IconButton.styles_14dty7n.css +1 -0
- package/es/components/Attach/utils/extractExtension.js +6 -0
- package/es/components/Attach/utils/extractExtension.js.map +1 -0
- package/es/components/Attach/utils/getFileicon.js +23 -0
- package/es/components/Attach/utils/getFileicon.js.map +1 -0
- package/es/components/Attach/utils/truncateFilename.js +12 -0
- package/es/components/Attach/utils/truncateFilename.js.map +1 -0
- package/es/components/Attach/variations/_size/base.js +5 -0
- package/es/components/Attach/variations/_size/base.js.map +1 -0
- package/es/components/Attach/variations/_size/base_eax0b8.css +1 -0
- package/es/components/Attach/variations/_view/base.js +5 -0
- package/es/components/Attach/variations/_view/base.js.map +1 -0
- package/es/components/Attach/variations/_view/base_1nvsg1b.css +1 -0
- package/es/components/Cell/Cell.js +3 -2
- package/es/components/Cell/Cell.js.map +1 -1
- package/es/index.css +14 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/package.json +3 -2
- package/styled-components/cjs/components/Attach/Attach.js +180 -0
- package/styled-components/cjs/components/Attach/Attach.styles.js +18 -0
- package/styled-components/cjs/components/Attach/Attach.tokens.js +81 -0
- package/styled-components/cjs/components/Attach/Attach.types.js +5 -0
- package/styled-components/cjs/components/Attach/index.js +25 -0
- package/styled-components/cjs/components/Attach/ui/Button/Button.js +12 -0
- package/styled-components/cjs/components/Attach/ui/Button/Button.styles.js +16 -0
- package/styled-components/cjs/components/Attach/ui/Cell/Cell.js +12 -0
- package/styled-components/cjs/components/Attach/ui/Cell/Cell.styles.js +16 -0
- package/styled-components/cjs/components/Attach/ui/iconButton/IconButton.js +12 -0
- package/styled-components/cjs/components/Attach/ui/iconButton/IconButton.styles.js +16 -0
- package/styled-components/cjs/components/Attach/utils/extractExtension.js +9 -0
- package/styled-components/cjs/components/Attach/utils/getFileicon.js +26 -0
- package/styled-components/cjs/components/Attach/utils/index.js +26 -0
- package/styled-components/cjs/components/Attach/utils/truncateFilename.js +15 -0
- package/styled-components/cjs/components/Attach/variations/_size/base.js +9 -0
- package/styled-components/cjs/components/Attach/variations/_view/base.js +9 -0
- package/styled-components/cjs/components/Cell/Cell.js +3 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Attach/Attach.config.js +25 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Attach/Attach.js +11 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Attach/Attach.stories.tsx +61 -0
- package/styled-components/cjs/examples/plasma_web/components/Attach/Attach.config.js +25 -0
- package/styled-components/cjs/examples/plasma_web/components/Attach/Attach.js +11 -0
- package/styled-components/cjs/examples/plasma_web/components/Attach/Attach.stories.tsx +61 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/Attach/Attach.js +171 -0
- package/styled-components/es/components/Attach/Attach.styles.js +10 -0
- package/styled-components/es/components/Attach/Attach.tokens.js +75 -0
- package/styled-components/es/components/Attach/Attach.types.js +1 -0
- package/styled-components/es/components/Attach/index.js +2 -0
- package/styled-components/es/components/Attach/ui/Button/Button.js +1 -0
- package/styled-components/es/components/Attach/ui/Button/Button.styles.js +9 -0
- package/styled-components/es/components/Attach/ui/Cell/Cell.js +1 -0
- package/styled-components/es/components/Attach/ui/Cell/Cell.styles.js +9 -0
- package/styled-components/es/components/Attach/ui/iconButton/IconButton.js +1 -0
- package/styled-components/es/components/Attach/ui/iconButton/IconButton.styles.js +9 -0
- package/styled-components/es/components/Attach/utils/extractExtension.js +3 -0
- package/styled-components/es/components/Attach/utils/getFileicon.js +19 -0
- package/styled-components/es/components/Attach/utils/index.js +3 -0
- package/styled-components/es/components/Attach/utils/truncateFilename.js +9 -0
- package/styled-components/es/components/Attach/variations/_size/base.js +3 -0
- package/styled-components/es/components/Attach/variations/_view/base.js +3 -0
- package/styled-components/es/components/Cell/Cell.js +3 -2
- package/styled-components/es/examples/plasma_b2c/components/Attach/Attach.config.js +19 -0
- package/styled-components/es/examples/plasma_b2c/components/Attach/Attach.js +5 -0
- package/styled-components/es/examples/plasma_b2c/components/Attach/Attach.stories.tsx +61 -0
- package/styled-components/es/examples/plasma_web/components/Attach/Attach.config.js +19 -0
- package/styled-components/es/examples/plasma_web/components/Attach/Attach.js +5 -0
- package/styled-components/es/examples/plasma_web/components/Attach/Attach.stories.tsx +61 -0
- package/styled-components/es/index.js +2 -1
- package/types/components/Attach/Attach.d.ts +23 -0
- package/types/components/Attach/Attach.d.ts.map +1 -0
- package/types/components/Attach/Attach.styles.d.ts +5 -0
- package/types/components/Attach/Attach.styles.d.ts.map +1 -0
- package/types/components/Attach/Attach.tokens.d.ts +73 -0
- package/types/components/Attach/Attach.tokens.d.ts.map +1 -0
- package/types/components/Attach/Attach.types.d.ts +33 -0
- package/types/components/Attach/Attach.types.d.ts.map +1 -0
- package/types/components/Attach/index.d.ts +4 -0
- package/types/components/Attach/index.d.ts.map +1 -0
- package/types/components/Attach/ui/Button/Button.d.ts +2 -0
- package/types/components/Attach/ui/Button/Button.d.ts.map +1 -0
- package/types/components/Attach/ui/Button/Button.styles.d.ts +45 -0
- package/types/components/Attach/ui/Button/Button.styles.d.ts.map +1 -0
- package/types/components/Attach/ui/Cell/Cell.d.ts +2 -0
- package/types/components/Attach/ui/Cell/Cell.d.ts.map +1 -0
- package/types/components/Attach/ui/Cell/Cell.styles.d.ts +33 -0
- package/types/components/Attach/ui/Cell/Cell.styles.d.ts.map +1 -0
- package/types/components/Attach/ui/iconButton/IconButton.d.ts +2 -0
- package/types/components/Attach/ui/iconButton/IconButton.d.ts.map +1 -0
- package/types/components/Attach/ui/iconButton/IconButton.styles.d.ts +45 -0
- package/types/components/Attach/ui/iconButton/IconButton.styles.d.ts.map +1 -0
- package/types/components/Attach/utils/extractExtension.d.ts +2 -0
- package/types/components/Attach/utils/extractExtension.d.ts.map +1 -0
- package/types/components/Attach/utils/getFileicon.d.ts +3 -0
- package/types/components/Attach/utils/getFileicon.d.ts.map +1 -0
- package/types/components/Attach/utils/index.d.ts +4 -0
- package/types/components/Attach/utils/index.d.ts.map +1 -0
- package/types/components/Attach/utils/truncateFilename.d.ts +2 -0
- package/types/components/Attach/utils/truncateFilename.d.ts.map +1 -0
- package/types/components/Attach/variations/_size/base.d.ts +2 -0
- package/types/components/Attach/variations/_size/base.d.ts.map +1 -0
- package/types/components/Attach/variations/_view/base.d.ts +2 -0
- package/types/components/Attach/variations/_view/base.d.ts.map +1 -0
- package/types/components/Cell/Cell.d.ts.map +1 -1
- package/types/components/Cell/Cell.types.d.ts +1 -1
- package/types/components/Cell/Cell.types.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.styles.d.ts +2 -2
- package/types/examples/plasma_b2c/components/Attach/Attach.config.d.ts +18 -0
- package/types/examples/plasma_b2c/components/Attach/Attach.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Attach/Attach.d.ts +13 -0
- package/types/examples/plasma_b2c/components/Attach/Attach.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Cell/Cell.d.ts +2 -2
- package/types/examples/plasma_web/components/Attach/Attach.config.d.ts +18 -0
- package/types/examples/plasma_web/components/Attach/Attach.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Attach/Attach.d.ts +13 -0
- package/types/examples/plasma_web/components/Attach/Attach.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Cell/Cell.d.ts +2 -2
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.config = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
|
+
var _Attach = /*#__PURE__*/require("../../../../components/Attach");
|
9
|
+
var config = exports.config = {
|
10
|
+
defaults: {
|
11
|
+
view: 'default',
|
12
|
+
size: 'm'
|
13
|
+
},
|
14
|
+
variations: {
|
15
|
+
view: {
|
16
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--on-dark-text-primary);", ":var(--surface-accent);", ":var(--on-dark-text-primary);", ":var(--surface-accent-hover);", ":var(--on-dark-text-primary);", ":var(--surface-accent-active);", ":var(--text-primary);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--text-secondary);", ":transparent;", ":var(--text-primary);", ":var(--surface-clear);", ":var(--text-primary-hover);", ":var(--surface-clear);", ":var(--text-primary-active);", ":var(--surface-clear);"], _Attach.attachTokens.buttonColor, _Attach.attachTokens.buttonBackgroundColor, _Attach.attachTokens.buttonColorHover, _Attach.attachTokens.buttonBackgroundColorHover, _Attach.attachTokens.buttonColorActive, _Attach.attachTokens.buttonBackgroundColorActive, _Attach.attachTokens.cellColor, _Attach.attachTokens.cellLabelColor, _Attach.attachTokens.cellTitleColor, _Attach.attachTokens.cellSubtitleColor, _Attach.attachTokens.cellBackgroundColor, _Attach.attachTokens.iconButtonColor, _Attach.attachTokens.iconButtonBackgroundColor, _Attach.attachTokens.iconButtonColorHover, _Attach.attachTokens.iconButtonBackgroundColorHover, _Attach.attachTokens.iconButtonColorActive, _Attach.attachTokens.iconButtonBackgroundColorActive)
|
17
|
+
},
|
18
|
+
size: {
|
19
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":1.5rem;", ":0.5rem;", ":3.5rem;", ":12.5rem;", ":1.5rem;", ":0.875rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-bold-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":15rem;", ":0rem;", ":0rem;", ":0rem;", ":0rem;", ":0.125rem;", ":0.375rem;", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":3.5rem;", ":3.5rem;", ":1.5rem;", ":0.875rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-bold-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);"], _Attach.attachTokens.horizontalGap, _Attach.attachTokens.verticalGap, _Attach.attachTokens.buttonHeight, _Attach.attachTokens.buttonWidth, _Attach.attachTokens.buttonPadding, _Attach.attachTokens.buttonRadius, _Attach.attachTokens.buttonFontFamily, _Attach.attachTokens.buttonFontSize, _Attach.attachTokens.buttonFontStyle, _Attach.attachTokens.buttonFontWeight, _Attach.attachTokens.buttonLetterSpacing, _Attach.attachTokens.buttonLineHeight, _Attach.attachTokens.cellWidth, _Attach.attachTokens.cellPadding, _Attach.attachTokens.cellPaddingLeftContent, _Attach.attachTokens.cellPaddingContent, _Attach.attachTokens.cellPaddingRightContent, _Attach.attachTokens.cellTextboxGap, _Attach.attachTokens.cellGap, _Attach.attachTokens.cellLabelFontFamily, _Attach.attachTokens.cellLabelFontSize, _Attach.attachTokens.cellLabelFontStyle, _Attach.attachTokens.cellLabelFontWeight, _Attach.attachTokens.cellLabelLetterSpacing, _Attach.attachTokens.cellLabelLineHeight, _Attach.attachTokens.cellTitleFontFamily, _Attach.attachTokens.cellTitleFontSize, _Attach.attachTokens.cellTitleFontStyle, _Attach.attachTokens.cellTitleFontWeight, _Attach.attachTokens.cellTitleLetterSpacing, _Attach.attachTokens.cellTitleLineHeight, _Attach.attachTokens.cellSubtitleFontFamily, _Attach.attachTokens.cellSubtitleFontSize, _Attach.attachTokens.cellSubtitleFontStyle, _Attach.attachTokens.cellSubtitleFontWeight, _Attach.attachTokens.cellSubtitleLetterSpacing, _Attach.attachTokens.cellSubtitleLineHeight, _Attach.attachTokens.iconButtonHeight, _Attach.attachTokens.iconButtonWidth, _Attach.attachTokens.iconButtonPadding, _Attach.attachTokens.iconButtonRadius, _Attach.attachTokens.iconButtonFontFamily, _Attach.attachTokens.iconButtonFontSize, _Attach.attachTokens.iconButtonFontStyle, _Attach.attachTokens.iconButtonFontWeight, _Attach.attachTokens.iconButtonLetterSpacing, _Attach.attachTokens.iconButtonLineHeight),
|
20
|
+
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":1.25rem;", ":0.5rem;", ":3rem;", ":11.25rem;", ":1.25rem;", ":0.75rem;", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-bold-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":15rem;", ":0rem;", ":0rem;", ":0rem;", ":0rem;", ":0.125rem;", ":0.375rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":2rem;", ":2rem;", ":0.75rem;", ":0.5rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-bold-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);"], _Attach.attachTokens.horizontalGap, _Attach.attachTokens.verticalGap, _Attach.attachTokens.buttonHeight, _Attach.attachTokens.buttonWidth, _Attach.attachTokens.buttonPadding, _Attach.attachTokens.buttonRadius, _Attach.attachTokens.buttonFontFamily, _Attach.attachTokens.buttonFontSize, _Attach.attachTokens.buttonFontStyle, _Attach.attachTokens.buttonFontWeight, _Attach.attachTokens.buttonLetterSpacing, _Attach.attachTokens.buttonLineHeight, _Attach.attachTokens.cellWidth, _Attach.attachTokens.cellPadding, _Attach.attachTokens.cellPaddingLeftContent, _Attach.attachTokens.cellPaddingContent, _Attach.attachTokens.cellPaddingRightContent, _Attach.attachTokens.cellTextboxGap, _Attach.attachTokens.cellGap, _Attach.attachTokens.cellLabelFontFamily, _Attach.attachTokens.cellLabelFontSize, _Attach.attachTokens.cellLabelFontStyle, _Attach.attachTokens.cellLabelFontWeight, _Attach.attachTokens.cellLabelLetterSpacing, _Attach.attachTokens.cellLabelLineHeight, _Attach.attachTokens.cellTitleFontFamily, _Attach.attachTokens.cellTitleFontSize, _Attach.attachTokens.cellTitleFontStyle, _Attach.attachTokens.cellTitleFontWeight, _Attach.attachTokens.cellTitleLetterSpacing, _Attach.attachTokens.cellTitleLineHeight, _Attach.attachTokens.cellSubtitleFontFamily, _Attach.attachTokens.cellSubtitleFontSize, _Attach.attachTokens.cellSubtitleFontStyle, _Attach.attachTokens.cellSubtitleFontWeight, _Attach.attachTokens.cellSubtitleLetterSpacing, _Attach.attachTokens.cellSubtitleLineHeight, _Attach.attachTokens.iconButtonHeight, _Attach.attachTokens.iconButtonWidth, _Attach.attachTokens.iconButtonPadding, _Attach.attachTokens.iconButtonRadius, _Attach.attachTokens.iconButtonFontFamily, _Attach.attachTokens.iconButtonFontSize, _Attach.attachTokens.iconButtonFontStyle, _Attach.attachTokens.iconButtonFontWeight, _Attach.attachTokens.iconButtonLetterSpacing, _Attach.attachTokens.iconButtonLineHeight),
|
21
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":1rem;", ":0.375rem;", ":2.5rem;", ":11.25rem;", ":1rem;", ":0.625rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-bold-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":15rem;", ":0rem;", ":0rem;", ":0rem;", ":0rem;", ":0.125rem;", ":0.375rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":2.5rem;", ":2.5rem;", ":1rem;", ":0.625rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-bold-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], _Attach.attachTokens.horizontalGap, _Attach.attachTokens.verticalGap, _Attach.attachTokens.buttonHeight, _Attach.attachTokens.buttonWidth, _Attach.attachTokens.buttonPadding, _Attach.attachTokens.buttonRadius, _Attach.attachTokens.buttonFontFamily, _Attach.attachTokens.buttonFontSize, _Attach.attachTokens.buttonFontStyle, _Attach.attachTokens.buttonFontWeight, _Attach.attachTokens.buttonLetterSpacing, _Attach.attachTokens.buttonLineHeight, _Attach.attachTokens.cellWidth, _Attach.attachTokens.cellPadding, _Attach.attachTokens.cellPaddingLeftContent, _Attach.attachTokens.cellPaddingContent, _Attach.attachTokens.cellPaddingRightContent, _Attach.attachTokens.cellTextboxGap, _Attach.attachTokens.cellGap, _Attach.attachTokens.cellLabelFontFamily, _Attach.attachTokens.cellLabelFontSize, _Attach.attachTokens.cellLabelFontStyle, _Attach.attachTokens.cellLabelFontWeight, _Attach.attachTokens.cellLabelLetterSpacing, _Attach.attachTokens.cellLabelLineHeight, _Attach.attachTokens.cellTitleFontFamily, _Attach.attachTokens.cellTitleFontSize, _Attach.attachTokens.cellTitleFontStyle, _Attach.attachTokens.cellTitleFontWeight, _Attach.attachTokens.cellTitleLetterSpacing, _Attach.attachTokens.cellTitleLineHeight, _Attach.attachTokens.cellSubtitleFontFamily, _Attach.attachTokens.cellSubtitleFontSize, _Attach.attachTokens.cellSubtitleFontStyle, _Attach.attachTokens.cellSubtitleFontWeight, _Attach.attachTokens.cellSubtitleLetterSpacing, _Attach.attachTokens.cellSubtitleLineHeight, _Attach.attachTokens.iconButtonHeight, _Attach.attachTokens.iconButtonWidth, _Attach.attachTokens.iconButtonPadding, _Attach.attachTokens.iconButtonRadius, _Attach.attachTokens.iconButtonFontFamily, _Attach.attachTokens.iconButtonFontSize, _Attach.attachTokens.iconButtonFontStyle, _Attach.attachTokens.iconButtonFontWeight, _Attach.attachTokens.iconButtonLetterSpacing, _Attach.attachTokens.iconButtonLineHeight),
|
22
|
+
xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.75rem;", ":0.25rem;", ":2rem;", ":10rem;", ":0.75rem;", ":0.5rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-bold-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":15rem;", ":0rem;", ":0rem;", ":0rem;", ":0rem;", ":0.125rem;", ":0.25rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":2rem;", ":2rem;", ":0.75rem;", ":0.5rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-bold-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);"], _Attach.attachTokens.horizontalGap, _Attach.attachTokens.verticalGap, _Attach.attachTokens.buttonHeight, _Attach.attachTokens.buttonWidth, _Attach.attachTokens.buttonPadding, _Attach.attachTokens.buttonRadius, _Attach.attachTokens.buttonFontFamily, _Attach.attachTokens.buttonFontSize, _Attach.attachTokens.buttonFontStyle, _Attach.attachTokens.buttonFontWeight, _Attach.attachTokens.buttonLetterSpacing, _Attach.attachTokens.buttonLineHeight, _Attach.attachTokens.cellWidth, _Attach.attachTokens.cellPadding, _Attach.attachTokens.cellPaddingLeftContent, _Attach.attachTokens.cellPaddingContent, _Attach.attachTokens.cellPaddingRightContent, _Attach.attachTokens.cellTextboxGap, _Attach.attachTokens.cellGap, _Attach.attachTokens.cellLabelFontFamily, _Attach.attachTokens.cellLabelFontSize, _Attach.attachTokens.cellLabelFontStyle, _Attach.attachTokens.cellLabelFontWeight, _Attach.attachTokens.cellLabelLetterSpacing, _Attach.attachTokens.cellLabelLineHeight, _Attach.attachTokens.cellTitleFontFamily, _Attach.attachTokens.cellTitleFontSize, _Attach.attachTokens.cellTitleFontStyle, _Attach.attachTokens.cellTitleFontWeight, _Attach.attachTokens.cellTitleLetterSpacing, _Attach.attachTokens.cellTitleLineHeight, _Attach.attachTokens.cellSubtitleFontFamily, _Attach.attachTokens.cellSubtitleFontSize, _Attach.attachTokens.cellSubtitleFontStyle, _Attach.attachTokens.cellSubtitleFontWeight, _Attach.attachTokens.cellSubtitleLetterSpacing, _Attach.attachTokens.cellSubtitleLineHeight, _Attach.attachTokens.iconButtonHeight, _Attach.attachTokens.iconButtonWidth, _Attach.attachTokens.iconButtonPadding, _Attach.attachTokens.iconButtonRadius, _Attach.attachTokens.iconButtonFontFamily, _Attach.attachTokens.iconButtonFontSize, _Attach.attachTokens.iconButtonFontStyle, _Attach.attachTokens.iconButtonFontWeight, _Attach.attachTokens.iconButtonLetterSpacing, _Attach.attachTokens.iconButtonLineHeight)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Attach = void 0;
|
7
|
+
var _Attach = /*#__PURE__*/require("../../../../components/Attach");
|
8
|
+
var _engines = /*#__PURE__*/require("../../../../engines");
|
9
|
+
var _Attach2 = /*#__PURE__*/require("./Attach.config");
|
10
|
+
var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Attach.attachConfig, _Attach2.config);
|
11
|
+
var Attach = exports.Attach = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import type { ComponentProps } from 'react';
|
3
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
4
|
+
|
5
|
+
import { mergeConfig } from '../../../../engines';
|
6
|
+
import { WithTheme, argTypesFromConfig } from '../../../_helpers';
|
7
|
+
import { attachConfig } from '../../../../components/Attach';
|
8
|
+
|
9
|
+
import { Attach } from './Attach';
|
10
|
+
import { config } from './Attach.config';
|
11
|
+
|
12
|
+
const flowOptions = ['horizontal', 'vertical', 'auto'];
|
13
|
+
const fileFormatOptions = ['all', '.doc', '.xls', '.pdf', '.csv', '.txt'];
|
14
|
+
|
15
|
+
type CustomStoryProps = {
|
16
|
+
fileFormat?: string;
|
17
|
+
width?: string;
|
18
|
+
};
|
19
|
+
|
20
|
+
type StoryAttachProps = ComponentProps<typeof Attach> & CustomStoryProps;
|
21
|
+
|
22
|
+
const meta: Meta<StoryAttachProps> = {
|
23
|
+
title: 'plasma_b2c/Attach',
|
24
|
+
decorators: [WithTheme],
|
25
|
+
component: Attach,
|
26
|
+
argTypes: {
|
27
|
+
...argTypesFromConfig(mergeConfig(attachConfig, config)),
|
28
|
+
flow: {
|
29
|
+
options: flowOptions,
|
30
|
+
control: {
|
31
|
+
type: 'select',
|
32
|
+
},
|
33
|
+
},
|
34
|
+
fileFormat: {
|
35
|
+
options: fileFormatOptions,
|
36
|
+
control: {
|
37
|
+
type: 'select',
|
38
|
+
},
|
39
|
+
},
|
40
|
+
},
|
41
|
+
};
|
42
|
+
|
43
|
+
export default meta;
|
44
|
+
|
45
|
+
const StoryAttach = (props: StoryAttachProps) => {
|
46
|
+
return <Attach {...props} />;
|
47
|
+
};
|
48
|
+
|
49
|
+
export const Default: StoryObj<StoryAttachProps> = {
|
50
|
+
args: {
|
51
|
+
fileFormat: 'all',
|
52
|
+
text: 'Загрузить файл',
|
53
|
+
flow: 'horizontal',
|
54
|
+
hasAttachment: true,
|
55
|
+
width: '400px',
|
56
|
+
},
|
57
|
+
render: ({ fileFormat, width, ...rest }) => {
|
58
|
+
const accepted = fileFormat && fileFormat !== 'all' ? [fileFormat] : undefined;
|
59
|
+
return <StoryAttach style={{ width }} acceptedFileFormats={accepted} {...rest} />;
|
60
|
+
},
|
61
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.config = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
|
+
var _Attach = /*#__PURE__*/require("../../../../components/Attach");
|
9
|
+
var config = exports.config = {
|
10
|
+
defaults: {
|
11
|
+
view: 'default',
|
12
|
+
size: 'm'
|
13
|
+
},
|
14
|
+
variations: {
|
15
|
+
view: {
|
16
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--on-dark-text-primary);", ":var(--surface-accent);", ":var(--on-dark-text-primary);", ":var(--surface-accent-hover);", ":var(--on-dark-text-primary);", ":var(--surface-accent-active);", ":var(--text-primary);", ":var(--text-secondary);", ":var(--text-primary);", ":var(--text-secondary);", ":transparent;", ":var(--text-primary);", ":var(--surface-clear);", ":var(--text-primary-hover);", ":var(--surface-clear);", ":var(--text-primary-active);", ":var(--surface-clear);"], _Attach.attachTokens.buttonColor, _Attach.attachTokens.buttonBackgroundColor, _Attach.attachTokens.buttonColorHover, _Attach.attachTokens.buttonBackgroundColorHover, _Attach.attachTokens.buttonColorActive, _Attach.attachTokens.buttonBackgroundColorActive, _Attach.attachTokens.cellColor, _Attach.attachTokens.cellLabelColor, _Attach.attachTokens.cellTitleColor, _Attach.attachTokens.cellSubtitleColor, _Attach.attachTokens.cellBackgroundColor, _Attach.attachTokens.iconButtonColor, _Attach.attachTokens.iconButtonBackgroundColor, _Attach.attachTokens.iconButtonColorHover, _Attach.attachTokens.iconButtonBackgroundColorHover, _Attach.attachTokens.iconButtonColorActive, _Attach.attachTokens.iconButtonBackgroundColorActive)
|
17
|
+
},
|
18
|
+
size: {
|
19
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":1.5rem;", ":0.5rem;", ":3.5rem;", ":12.5rem;", ":1.5rem;", ":0.875rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-bold-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":15rem;", ":0rem;", ":0rem;", ":0rem;", ":0rem;", ":0.125rem;", ":0.375rem;", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":3.5rem;", ":3.5rem;", ":1.5rem;", ":0.875rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-bold-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);"], _Attach.attachTokens.horizontalGap, _Attach.attachTokens.verticalGap, _Attach.attachTokens.buttonHeight, _Attach.attachTokens.buttonWidth, _Attach.attachTokens.buttonPadding, _Attach.attachTokens.buttonRadius, _Attach.attachTokens.buttonFontFamily, _Attach.attachTokens.buttonFontSize, _Attach.attachTokens.buttonFontStyle, _Attach.attachTokens.buttonFontWeight, _Attach.attachTokens.buttonLetterSpacing, _Attach.attachTokens.buttonLineHeight, _Attach.attachTokens.cellWidth, _Attach.attachTokens.cellPadding, _Attach.attachTokens.cellPaddingLeftContent, _Attach.attachTokens.cellPaddingContent, _Attach.attachTokens.cellPaddingRightContent, _Attach.attachTokens.cellTextboxGap, _Attach.attachTokens.cellGap, _Attach.attachTokens.cellLabelFontFamily, _Attach.attachTokens.cellLabelFontSize, _Attach.attachTokens.cellLabelFontStyle, _Attach.attachTokens.cellLabelFontWeight, _Attach.attachTokens.cellLabelLetterSpacing, _Attach.attachTokens.cellLabelLineHeight, _Attach.attachTokens.cellTitleFontFamily, _Attach.attachTokens.cellTitleFontSize, _Attach.attachTokens.cellTitleFontStyle, _Attach.attachTokens.cellTitleFontWeight, _Attach.attachTokens.cellTitleLetterSpacing, _Attach.attachTokens.cellTitleLineHeight, _Attach.attachTokens.cellSubtitleFontFamily, _Attach.attachTokens.cellSubtitleFontSize, _Attach.attachTokens.cellSubtitleFontStyle, _Attach.attachTokens.cellSubtitleFontWeight, _Attach.attachTokens.cellSubtitleLetterSpacing, _Attach.attachTokens.cellSubtitleLineHeight, _Attach.attachTokens.iconButtonHeight, _Attach.attachTokens.iconButtonWidth, _Attach.attachTokens.iconButtonPadding, _Attach.attachTokens.iconButtonRadius, _Attach.attachTokens.iconButtonFontFamily, _Attach.attachTokens.iconButtonFontSize, _Attach.attachTokens.iconButtonFontStyle, _Attach.attachTokens.iconButtonFontWeight, _Attach.attachTokens.iconButtonLetterSpacing, _Attach.attachTokens.iconButtonLineHeight),
|
20
|
+
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":1.25rem;", ":0.5rem;", ":3rem;", ":11.25rem;", ":1.25rem;", ":0.75rem;", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-bold-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":15rem;", ":0rem;", ":0rem;", ":0rem;", ":0rem;", ":0.125rem;", ":0.375rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":2rem;", ":2rem;", ":0.75rem;", ":0.5rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-bold-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);"], _Attach.attachTokens.horizontalGap, _Attach.attachTokens.verticalGap, _Attach.attachTokens.buttonHeight, _Attach.attachTokens.buttonWidth, _Attach.attachTokens.buttonPadding, _Attach.attachTokens.buttonRadius, _Attach.attachTokens.buttonFontFamily, _Attach.attachTokens.buttonFontSize, _Attach.attachTokens.buttonFontStyle, _Attach.attachTokens.buttonFontWeight, _Attach.attachTokens.buttonLetterSpacing, _Attach.attachTokens.buttonLineHeight, _Attach.attachTokens.cellWidth, _Attach.attachTokens.cellPadding, _Attach.attachTokens.cellPaddingLeftContent, _Attach.attachTokens.cellPaddingContent, _Attach.attachTokens.cellPaddingRightContent, _Attach.attachTokens.cellTextboxGap, _Attach.attachTokens.cellGap, _Attach.attachTokens.cellLabelFontFamily, _Attach.attachTokens.cellLabelFontSize, _Attach.attachTokens.cellLabelFontStyle, _Attach.attachTokens.cellLabelFontWeight, _Attach.attachTokens.cellLabelLetterSpacing, _Attach.attachTokens.cellLabelLineHeight, _Attach.attachTokens.cellTitleFontFamily, _Attach.attachTokens.cellTitleFontSize, _Attach.attachTokens.cellTitleFontStyle, _Attach.attachTokens.cellTitleFontWeight, _Attach.attachTokens.cellTitleLetterSpacing, _Attach.attachTokens.cellTitleLineHeight, _Attach.attachTokens.cellSubtitleFontFamily, _Attach.attachTokens.cellSubtitleFontSize, _Attach.attachTokens.cellSubtitleFontStyle, _Attach.attachTokens.cellSubtitleFontWeight, _Attach.attachTokens.cellSubtitleLetterSpacing, _Attach.attachTokens.cellSubtitleLineHeight, _Attach.attachTokens.iconButtonHeight, _Attach.attachTokens.iconButtonWidth, _Attach.attachTokens.iconButtonPadding, _Attach.attachTokens.iconButtonRadius, _Attach.attachTokens.iconButtonFontFamily, _Attach.attachTokens.iconButtonFontSize, _Attach.attachTokens.iconButtonFontStyle, _Attach.attachTokens.iconButtonFontWeight, _Attach.attachTokens.iconButtonLetterSpacing, _Attach.attachTokens.iconButtonLineHeight),
|
21
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":1rem;", ":0.375rem;", ":2.5rem;", ":11.25rem;", ":1rem;", ":0.625rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-bold-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":15rem;", ":0rem;", ":0rem;", ":0rem;", ":0rem;", ":0.125rem;", ":0.375rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":2.5rem;", ":2.5rem;", ":1rem;", ":0.625rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-bold-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], _Attach.attachTokens.horizontalGap, _Attach.attachTokens.verticalGap, _Attach.attachTokens.buttonHeight, _Attach.attachTokens.buttonWidth, _Attach.attachTokens.buttonPadding, _Attach.attachTokens.buttonRadius, _Attach.attachTokens.buttonFontFamily, _Attach.attachTokens.buttonFontSize, _Attach.attachTokens.buttonFontStyle, _Attach.attachTokens.buttonFontWeight, _Attach.attachTokens.buttonLetterSpacing, _Attach.attachTokens.buttonLineHeight, _Attach.attachTokens.cellWidth, _Attach.attachTokens.cellPadding, _Attach.attachTokens.cellPaddingLeftContent, _Attach.attachTokens.cellPaddingContent, _Attach.attachTokens.cellPaddingRightContent, _Attach.attachTokens.cellTextboxGap, _Attach.attachTokens.cellGap, _Attach.attachTokens.cellLabelFontFamily, _Attach.attachTokens.cellLabelFontSize, _Attach.attachTokens.cellLabelFontStyle, _Attach.attachTokens.cellLabelFontWeight, _Attach.attachTokens.cellLabelLetterSpacing, _Attach.attachTokens.cellLabelLineHeight, _Attach.attachTokens.cellTitleFontFamily, _Attach.attachTokens.cellTitleFontSize, _Attach.attachTokens.cellTitleFontStyle, _Attach.attachTokens.cellTitleFontWeight, _Attach.attachTokens.cellTitleLetterSpacing, _Attach.attachTokens.cellTitleLineHeight, _Attach.attachTokens.cellSubtitleFontFamily, _Attach.attachTokens.cellSubtitleFontSize, _Attach.attachTokens.cellSubtitleFontStyle, _Attach.attachTokens.cellSubtitleFontWeight, _Attach.attachTokens.cellSubtitleLetterSpacing, _Attach.attachTokens.cellSubtitleLineHeight, _Attach.attachTokens.iconButtonHeight, _Attach.attachTokens.iconButtonWidth, _Attach.attachTokens.iconButtonPadding, _Attach.attachTokens.iconButtonRadius, _Attach.attachTokens.iconButtonFontFamily, _Attach.attachTokens.iconButtonFontSize, _Attach.attachTokens.iconButtonFontStyle, _Attach.attachTokens.iconButtonFontWeight, _Attach.attachTokens.iconButtonLetterSpacing, _Attach.attachTokens.iconButtonLineHeight),
|
22
|
+
xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.75rem;", ":0.25rem;", ":2rem;", ":10rem;", ":0.75rem;", ":0.5rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-bold-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":15rem;", ":0rem;", ":0rem;", ":0rem;", ":0rem;", ":0.125rem;", ":0.25rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":2rem;", ":2rem;", ":0.75rem;", ":0.5rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-bold-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);"], _Attach.attachTokens.horizontalGap, _Attach.attachTokens.verticalGap, _Attach.attachTokens.buttonHeight, _Attach.attachTokens.buttonWidth, _Attach.attachTokens.buttonPadding, _Attach.attachTokens.buttonRadius, _Attach.attachTokens.buttonFontFamily, _Attach.attachTokens.buttonFontSize, _Attach.attachTokens.buttonFontStyle, _Attach.attachTokens.buttonFontWeight, _Attach.attachTokens.buttonLetterSpacing, _Attach.attachTokens.buttonLineHeight, _Attach.attachTokens.cellWidth, _Attach.attachTokens.cellPadding, _Attach.attachTokens.cellPaddingLeftContent, _Attach.attachTokens.cellPaddingContent, _Attach.attachTokens.cellPaddingRightContent, _Attach.attachTokens.cellTextboxGap, _Attach.attachTokens.cellGap, _Attach.attachTokens.cellLabelFontFamily, _Attach.attachTokens.cellLabelFontSize, _Attach.attachTokens.cellLabelFontStyle, _Attach.attachTokens.cellLabelFontWeight, _Attach.attachTokens.cellLabelLetterSpacing, _Attach.attachTokens.cellLabelLineHeight, _Attach.attachTokens.cellTitleFontFamily, _Attach.attachTokens.cellTitleFontSize, _Attach.attachTokens.cellTitleFontStyle, _Attach.attachTokens.cellTitleFontWeight, _Attach.attachTokens.cellTitleLetterSpacing, _Attach.attachTokens.cellTitleLineHeight, _Attach.attachTokens.cellSubtitleFontFamily, _Attach.attachTokens.cellSubtitleFontSize, _Attach.attachTokens.cellSubtitleFontStyle, _Attach.attachTokens.cellSubtitleFontWeight, _Attach.attachTokens.cellSubtitleLetterSpacing, _Attach.attachTokens.cellSubtitleLineHeight, _Attach.attachTokens.iconButtonHeight, _Attach.attachTokens.iconButtonWidth, _Attach.attachTokens.iconButtonPadding, _Attach.attachTokens.iconButtonRadius, _Attach.attachTokens.iconButtonFontFamily, _Attach.attachTokens.iconButtonFontSize, _Attach.attachTokens.iconButtonFontStyle, _Attach.attachTokens.iconButtonFontWeight, _Attach.attachTokens.iconButtonLetterSpacing, _Attach.attachTokens.iconButtonLineHeight)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Attach = void 0;
|
7
|
+
var _Attach = /*#__PURE__*/require("../../../../components/Attach");
|
8
|
+
var _engines = /*#__PURE__*/require("../../../../engines");
|
9
|
+
var _Attach2 = /*#__PURE__*/require("./Attach.config");
|
10
|
+
var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Attach.attachConfig, _Attach2.config);
|
11
|
+
var Attach = exports.Attach = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import type { ComponentProps } from 'react';
|
3
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
4
|
+
|
5
|
+
import { mergeConfig } from '../../../../engines';
|
6
|
+
import { WithTheme, argTypesFromConfig } from '../../../_helpers';
|
7
|
+
import { attachConfig } from '../../../../components/Attach';
|
8
|
+
|
9
|
+
import { Attach } from './Attach';
|
10
|
+
import { config } from './Attach.config';
|
11
|
+
|
12
|
+
const flowOptions = ['horizontal', 'vertical', 'auto'];
|
13
|
+
const fileFormatOptions = ['all', '.doc', '.xls', '.pdf', '.csv', '.txt'];
|
14
|
+
|
15
|
+
type CustomStoryProps = {
|
16
|
+
fileFormat?: string;
|
17
|
+
width?: string;
|
18
|
+
};
|
19
|
+
|
20
|
+
type StoryAttachProps = ComponentProps<typeof Attach> & CustomStoryProps;
|
21
|
+
|
22
|
+
const meta: Meta<StoryAttachProps> = {
|
23
|
+
title: 'plasma_web/Attach',
|
24
|
+
decorators: [WithTheme],
|
25
|
+
component: Attach,
|
26
|
+
argTypes: {
|
27
|
+
...argTypesFromConfig(mergeConfig(attachConfig, config)),
|
28
|
+
flow: {
|
29
|
+
options: flowOptions,
|
30
|
+
control: {
|
31
|
+
type: 'select',
|
32
|
+
},
|
33
|
+
},
|
34
|
+
fileFormat: {
|
35
|
+
options: fileFormatOptions,
|
36
|
+
control: {
|
37
|
+
type: 'select',
|
38
|
+
},
|
39
|
+
},
|
40
|
+
},
|
41
|
+
};
|
42
|
+
|
43
|
+
export default meta;
|
44
|
+
|
45
|
+
const StoryAttach = (props: StoryAttachProps) => {
|
46
|
+
return <Attach {...props} />;
|
47
|
+
};
|
48
|
+
|
49
|
+
export const Default: StoryObj<StoryAttachProps> = {
|
50
|
+
args: {
|
51
|
+
fileFormat: 'all',
|
52
|
+
text: 'Загрузить файл',
|
53
|
+
flow: 'horizontal',
|
54
|
+
hasAttachment: true,
|
55
|
+
width: '400px',
|
56
|
+
},
|
57
|
+
render: ({ fileFormat, width, ...rest }) => {
|
58
|
+
const accepted = fileFormat && fileFormat !== 'all' ? [fileFormat] : undefined;
|
59
|
+
return <StoryAttach style={{ width }} acceptedFileFormats={accepted} {...rest} />;
|
60
|
+
},
|
61
|
+
};
|
@@ -629,4 +629,15 @@ Object.keys(_Editable).forEach(function (key) {
|
|
629
629
|
return _Editable[key];
|
630
630
|
}
|
631
631
|
});
|
632
|
+
});
|
633
|
+
var _Attach = /*#__PURE__*/require("./components/Attach");
|
634
|
+
Object.keys(_Attach).forEach(function (key) {
|
635
|
+
if (key === "default" || key === "__esModule") return;
|
636
|
+
if (key in exports && exports[key] === _Attach[key]) return;
|
637
|
+
Object.defineProperty(exports, key, {
|
638
|
+
enumerable: true,
|
639
|
+
get: function get() {
|
640
|
+
return _Attach[key];
|
641
|
+
}
|
642
|
+
});
|
632
643
|
});
|
@@ -0,0 +1,171 @@
|
|
1
|
+
var _IconCloseCircleOutli;
|
2
|
+
var _excluded = ["flow", "text", "hasAttachment", "acceptedFileFormats", "size", "view", "className"];
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
8
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
10
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
11
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
12
|
+
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
13
|
+
import { IconCloseCircleOutline } from '@salutejs/plasma-icons';
|
14
|
+
import { useForkRef, useResizeObserver } from '@salutejs/plasma-core';
|
15
|
+
import { cx } from '../../utils';
|
16
|
+
import { base as sizeCSS } from './variations/_size/base';
|
17
|
+
import { base as viewCSS } from './variations/_view/base';
|
18
|
+
import { base, StyledHiddenInput, StyledHiddenInputHelper } from './Attach.styles';
|
19
|
+
import { StyledButton } from './ui/Button/Button';
|
20
|
+
import { StyledCell } from './ui/Cell/Cell';
|
21
|
+
import { StyledIconButton } from './ui/iconButton/IconButton';
|
22
|
+
import { extractExtension, getFileicon, truncateFilename } from './utils';
|
23
|
+
import { classes } from './Attach.tokens';
|
24
|
+
export var attachRoot = function attachRoot(Root) {
|
25
|
+
return /*#__PURE__*/forwardRef(function (props, outerRef) {
|
26
|
+
var _props$flow = props.flow,
|
27
|
+
flow = _props$flow === void 0 ? 'auto' : _props$flow,
|
28
|
+
_props$text = props.text,
|
29
|
+
text = _props$text === void 0 ? 'Загрузить файл' : _props$text,
|
30
|
+
_props$hasAttachment = props.hasAttachment,
|
31
|
+
hasAttachment = _props$hasAttachment === void 0 ? true : _props$hasAttachment,
|
32
|
+
acceptedFileFormats = props.acceptedFileFormats,
|
33
|
+
size = props.size,
|
34
|
+
view = props.view,
|
35
|
+
className = props.className,
|
36
|
+
rest = _objectWithoutProperties(props, _excluded);
|
37
|
+
var inputRef = useRef(null);
|
38
|
+
var inputHelperRef = useRef(null);
|
39
|
+
var cellRef = useRef(null);
|
40
|
+
var innerRef = useRef(null);
|
41
|
+
var ref = useForkRef(outerRef, innerRef);
|
42
|
+
var _useState = useState(null),
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
44
|
+
containerWidth = _useState2[0],
|
45
|
+
setContainerWidth = _useState2[1];
|
46
|
+
var _useState3 = useState(null),
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
48
|
+
origFilename = _useState4[0],
|
49
|
+
setOrigFilename = _useState4[1];
|
50
|
+
var _useState5 = useState(null),
|
51
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
52
|
+
filename = _useState6[0],
|
53
|
+
setFilename = _useState6[1];
|
54
|
+
var _useState7 = useState(false),
|
55
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
56
|
+
shouldUpdateFilename = _useState8[0],
|
57
|
+
setShouldUpdateFilename = _useState8[1];
|
58
|
+
var horizontalClass = flow === 'horizontal' ? classes.horizontal : undefined;
|
59
|
+
var verticalClass = flow === 'vertical' ? classes.vertical : undefined;
|
60
|
+
var autoClass = flow === 'auto' ? classes.auto : undefined;
|
61
|
+
var cellHiddenClass = shouldUpdateFilename ? classes.cellHidden : undefined;
|
62
|
+
var accept = acceptedFileFormats === null || acceptedFileFormats === void 0 ? void 0 : acceptedFileFormats.join(',');
|
63
|
+
var extension = filename ? extractExtension(filename) : null;
|
64
|
+
var contentLeft = extension ? getFileicon(extension) : null;
|
65
|
+
var handleClick = function handleClick() {
|
66
|
+
if (!inputRef.current) {
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
inputRef.current.click();
|
70
|
+
};
|
71
|
+
var handleChange = function handleChange() {
|
72
|
+
if (!inputRef.current || !inputRef.current.files) {
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
setOrigFilename(inputRef.current.files[0].name);
|
76
|
+
};
|
77
|
+
var handleClear = function handleClear() {
|
78
|
+
if (!inputRef.current) {
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
inputRef.current.value = '';
|
82
|
+
setOrigFilename(null);
|
83
|
+
};
|
84
|
+
useResizeObserver(innerRef, function (container) {
|
85
|
+
setContainerWidth(container.offsetWidth);
|
86
|
+
});
|
87
|
+
useEffect(function () {
|
88
|
+
setFilename(origFilename);
|
89
|
+
setShouldUpdateFilename(true);
|
90
|
+
}, [size, view, flow, origFilename, containerWidth]);
|
91
|
+
useEffect(function () {
|
92
|
+
if (!cellRef.current || !cellRef.current.parentElement || !inputHelperRef.current || !inputHelperRef.current.textContent || !origFilename || !shouldUpdateFilename) {
|
93
|
+
setShouldUpdateFilename(false);
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
var textWidth = inputHelperRef.current.offsetWidth;
|
97
|
+
var _cellRef$current$getB = cellRef.current.getBoundingClientRect(),
|
98
|
+
cellWidth = _cellRef$current$getB.width,
|
99
|
+
cellLeft = _cellRef$current$getB.left;
|
100
|
+
var _cellRef$current$pare = cellRef.current.parentElement.getBoundingClientRect(),
|
101
|
+
parentWidth = _cellRef$current$pare.width,
|
102
|
+
parentLeft = _cellRef$current$pare.left;
|
103
|
+
var cellLeftRightContentWidth = cellWidth - textWidth;
|
104
|
+
var leftDiff = cellLeft - parentLeft;
|
105
|
+
var index = origFilename.length - 1;
|
106
|
+
var currentTextWidth = textWidth;
|
107
|
+
var resultFilename = origFilename;
|
108
|
+
while (currentTextWidth + cellLeftRightContentWidth + leftDiff > parentWidth && index >= 1) {
|
109
|
+
var truncatedFilename = truncateFilename(inputHelperRef.current.textContent, index);
|
110
|
+
inputHelperRef.current.textContent = truncatedFilename;
|
111
|
+
resultFilename = truncatedFilename;
|
112
|
+
currentTextWidth = inputHelperRef.current.offsetWidth;
|
113
|
+
index -= 1;
|
114
|
+
}
|
115
|
+
inputHelperRef.current.textContent = origFilename;
|
116
|
+
setFilename(resultFilename);
|
117
|
+
setShouldUpdateFilename(false);
|
118
|
+
}, [shouldUpdateFilename]);
|
119
|
+
return /*#__PURE__*/React.createElement(Root, _extends({
|
120
|
+
className: cx(horizontalClass, verticalClass, autoClass, className),
|
121
|
+
size: size,
|
122
|
+
view: view,
|
123
|
+
ref: ref
|
124
|
+
}, rest), /*#__PURE__*/React.createElement(StyledHiddenInput, {
|
125
|
+
ref: inputRef,
|
126
|
+
accept: accept,
|
127
|
+
type: "file",
|
128
|
+
id: "attachHiddenInput",
|
129
|
+
name: "attachHiddenInput",
|
130
|
+
onChange: handleChange
|
131
|
+
}), /*#__PURE__*/React.createElement(StyledHiddenInputHelper, {
|
132
|
+
ref: inputHelperRef,
|
133
|
+
id: "attachHiddenInputHelper"
|
134
|
+
}, origFilename), /*#__PURE__*/React.createElement(StyledButton, {
|
135
|
+
size: size,
|
136
|
+
view: view,
|
137
|
+
onClick: handleClick,
|
138
|
+
text: text
|
139
|
+
}), hasAttachment && filename && /*#__PURE__*/React.createElement(StyledCell, {
|
140
|
+
className: cellHiddenClass,
|
141
|
+
ref: cellRef,
|
142
|
+
size: size,
|
143
|
+
view: view,
|
144
|
+
title: filename,
|
145
|
+
contentLeft: contentLeft,
|
146
|
+
contentRight: /*#__PURE__*/React.createElement(StyledIconButton, {
|
147
|
+
onClick: handleClear
|
148
|
+
}, _IconCloseCircleOutli || (_IconCloseCircleOutli = /*#__PURE__*/React.createElement(IconCloseCircleOutline, {
|
149
|
+
size: "xs"
|
150
|
+
})))
|
151
|
+
}));
|
152
|
+
});
|
153
|
+
};
|
154
|
+
export var attachConfig = {
|
155
|
+
name: 'Attach',
|
156
|
+
tag: 'div',
|
157
|
+
layout: attachRoot,
|
158
|
+
base: base,
|
159
|
+
variations: {
|
160
|
+
view: {
|
161
|
+
css: viewCSS
|
162
|
+
},
|
163
|
+
size: {
|
164
|
+
css: sizeCSS
|
165
|
+
}
|
166
|
+
},
|
167
|
+
defaults: {
|
168
|
+
view: 'default',
|
169
|
+
size: 'm'
|
170
|
+
}
|
171
|
+
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import styled from 'styled-components';
|
2
|
+
import { css } from 'styled-components';
|
3
|
+
import { tokens as attachTokens } from './Attach.tokens';
|
4
|
+
export var base = /*#__PURE__*/css(["position:relative;display:flex;width:fit-content;"]);
|
5
|
+
export var StyledHiddenInput = /*#__PURE__*/styled.input.withConfig({
|
6
|
+
componentId: "plasma-new-hope__sc-15vkopl-0"
|
7
|
+
})(["display:none;"]);
|
8
|
+
export var StyledHiddenInputHelper = /*#__PURE__*/styled.div.withConfig({
|
9
|
+
componentId: "plasma-new-hope__sc-15vkopl-1"
|
10
|
+
})(["position:absolute;visibility:hidden;font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");"], attachTokens.cellTitleFontFamily, attachTokens.cellTitleFontSize, attachTokens.cellTitleFontStyle, attachTokens.cellTitleFontWeight, attachTokens.cellTitleLetterSpacing, attachTokens.cellTitleLineHeight);
|
@@ -0,0 +1,75 @@
|
|
1
|
+
export var classes = {
|
2
|
+
auto: 'auto',
|
3
|
+
horizontal: 'horizontal',
|
4
|
+
vertical: 'vertical',
|
5
|
+
cellHidden: 'cell-hidden'
|
6
|
+
};
|
7
|
+
export var tokens = {
|
8
|
+
horizontalGap: '--plasma-attach-horizontal-gap',
|
9
|
+
verticalGap: '--plasma-attach-vertical-gap',
|
10
|
+
// Токены для Button
|
11
|
+
buttonColor: '--plasma-attach-button-color',
|
12
|
+
buttonBackgroundColor: '--plasma-attach-button-background-color',
|
13
|
+
buttonColorHover: '--plasma-attach-button-color-hover',
|
14
|
+
buttonBackgroundColorHover: '--plasma-attach-button-background-color-hover',
|
15
|
+
buttonColorActive: '--plasma-attach-button-color-active',
|
16
|
+
buttonBackgroundColorActive: '--plasma-attach-button-background-color-active',
|
17
|
+
buttonHeight: '--plasma-attach-button-height',
|
18
|
+
buttonWidth: '--plasma-attach-button-width',
|
19
|
+
buttonPadding: '--plasma-attach-button-padding',
|
20
|
+
buttonRadius: '--plasma-attach-button-radius',
|
21
|
+
buttonFontFamily: '--plasma-attach-button-font-family',
|
22
|
+
buttonFontSize: '--plasma-attach-button-font-size',
|
23
|
+
buttonFontStyle: '--plasma-attach-button-font-style',
|
24
|
+
buttonFontWeight: '--plasma-attach-button-font-weight',
|
25
|
+
buttonLetterSpacing: '--plasma-attach-button-letter-spacing',
|
26
|
+
buttonLineHeight: '--plasma-attach-button-line-height',
|
27
|
+
// Токены для Cell
|
28
|
+
cellColor: '--plasma-attach-cell-color',
|
29
|
+
cellLabelColor: '--plasma-attach-cell-label-color',
|
30
|
+
cellTitleColor: '--plasma-attach-cell-title-color',
|
31
|
+
cellSubtitleColor: '--plasma-attach-cell-subtitle-color',
|
32
|
+
cellBackgroundColor: '--plasma-attach-cell-background-color',
|
33
|
+
cellWidth: '--plasma-attach-cell-width',
|
34
|
+
cellPadding: '--plasma-attach-cell-padding',
|
35
|
+
cellPaddingLeftContent: '--plasma-attach-cell-padding-left-content',
|
36
|
+
cellPaddingContent: '--plasma-attach-cell-padding-content',
|
37
|
+
cellPaddingRightContent: '--plasma-attach-cell-padding-right-content',
|
38
|
+
cellTextboxGap: '--plasma-attach-cell-textbox-gap',
|
39
|
+
cellGap: '--plasma-attach-cell-gap',
|
40
|
+
cellLabelFontFamily: '--plasma-attach-cell-label-font-family',
|
41
|
+
cellLabelFontSize: '--plasma-attach-cell-label-font-size',
|
42
|
+
cellLabelFontStyle: '--plasma-attach-cell-label-font-style',
|
43
|
+
cellLabelFontWeight: '--plasma-attach-cell-label-font-weight',
|
44
|
+
cellLabelLetterSpacing: '--plasma-attach-cell-label-letter-spacing',
|
45
|
+
cellLabelLineHeight: '--plasma-attach-cell-label-line-height',
|
46
|
+
cellTitleFontFamily: '--plasma-attach-cell-title-font-family',
|
47
|
+
cellTitleFontSize: '--plasma-attach-cell-title-font-size',
|
48
|
+
cellTitleFontStyle: '--plasma-attach-cell-title-font-style',
|
49
|
+
cellTitleFontWeight: '--plasma-attach-cell-title-font-weight',
|
50
|
+
cellTitleLetterSpacing: '--plasma-attach-cell-title-letter-spacing',
|
51
|
+
cellTitleLineHeight: '--plasma-attach-cell-title-line-height',
|
52
|
+
cellSubtitleFontFamily: '--plasma-attach-cell-subtitle-font-family',
|
53
|
+
cellSubtitleFontSize: '--plasma-attach-cell-subtitle-font-size',
|
54
|
+
cellSubtitleFontStyle: '--plasma-attach-cell-subtitle-font-style',
|
55
|
+
cellSubtitleFontWeight: '--plasma-attach-cell-subtitle-font-weight',
|
56
|
+
cellSubtitleLetterSpacing: '--plasma-attach-cell-subtitle-letter-spacing',
|
57
|
+
cellSubtitleLineHeight: '--plasma-attach-cell-subtitle-line-height',
|
58
|
+
// Токены для IconButton
|
59
|
+
iconButtonColor: '--plasma-attach-icon-button-color',
|
60
|
+
iconButtonBackgroundColor: '--plasma-attach-icon-button-background-color',
|
61
|
+
iconButtonColorHover: '--plasma-attach-icon-button-color-hover',
|
62
|
+
iconButtonBackgroundColorHover: '--plasma-attach-icon-button-background-color-hover',
|
63
|
+
iconButtonColorActive: '--plasma-attach-icon-button-color-active',
|
64
|
+
iconButtonBackgroundColorActive: '--plasma-attach-icon-button-background-color-active',
|
65
|
+
iconButtonHeight: '--plasma-attach-icon-button-height',
|
66
|
+
iconButtonWidth: '--plasma-attach-icon-button-width',
|
67
|
+
iconButtonPadding: '--plasma-attach-icon-button-padding',
|
68
|
+
iconButtonRadius: '--plasma-attach-icon-button-radius',
|
69
|
+
iconButtonFontFamily: '--plasma-attach-icon-button-font-family',
|
70
|
+
iconButtonFontSize: '--plasma-attach-icon-button-font-size',
|
71
|
+
iconButtonFontStyle: '--plasma-attach-icon-button-font-style',
|
72
|
+
iconButtonFontWeight: '--plasma-attach-icon-button-font-weight',
|
73
|
+
iconButtonLetterSpacing: '--plasma-attach-icon-button-letter-spacing',
|
74
|
+
iconButtonLineHeight: '--plasma-attach-icon-button-line-height'
|
75
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { StyledButton } from './Button.styles';
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import styled from 'styled-components';
|
2
|
+
import { component, mergeConfig } from '../../../../engines';
|
3
|
+
import { buttonConfig, buttonTokens } from '../../../Button';
|
4
|
+
import { tokens as attachTokens } from '../../Attach.tokens';
|
5
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(buttonConfig);
|
6
|
+
var Button = /*#__PURE__*/component(mergedConfig);
|
7
|
+
export var StyledButton = /*#__PURE__*/styled(Button).withConfig({
|
8
|
+
componentId: "plasma-new-hope__sc-elwbwo-0"
|
9
|
+
})(["", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");"], buttonTokens.buttonColor, attachTokens.buttonColor, buttonTokens.buttonBackgroundColor, attachTokens.buttonBackgroundColor, buttonTokens.buttonColorHover, attachTokens.buttonColorHover, buttonTokens.buttonBackgroundColorHover, attachTokens.buttonBackgroundColorHover, buttonTokens.buttonColorActive, attachTokens.buttonColorActive, buttonTokens.buttonBackgroundColorActive, attachTokens.buttonBackgroundColorActive, buttonTokens.buttonHeight, attachTokens.buttonHeight, buttonTokens.buttonWidth, attachTokens.buttonWidth, buttonTokens.buttonPadding, attachTokens.buttonPadding, buttonTokens.buttonRadius, attachTokens.buttonRadius, buttonTokens.buttonFontFamily, attachTokens.buttonFontFamily, buttonTokens.buttonFontSize, attachTokens.buttonFontSize, buttonTokens.buttonFontStyle, attachTokens.buttonFontStyle, buttonTokens.buttonFontWeight, attachTokens.buttonFontWeight, buttonTokens.buttonLetterSpacing, attachTokens.buttonLetterSpacing, buttonTokens.buttonLineHeight, attachTokens.buttonLineHeight);
|
@@ -0,0 +1 @@
|
|
1
|
+
export { StyledCell } from './Cell.styles';
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import styled from 'styled-components';
|
2
|
+
import { component, mergeConfig } from '../../../../engines';
|
3
|
+
import { cellConfig, cellTokens } from '../../../Cell';
|
4
|
+
import { tokens as attachTokens, classes } from '../../Attach.tokens';
|
5
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(cellConfig);
|
6
|
+
var Cell = /*#__PURE__*/component(mergedConfig);
|
7
|
+
export var StyledCell = /*#__PURE__*/styled(Cell).withConfig({
|
8
|
+
componentId: "plasma-new-hope__sc-15m5uhg-0"
|
9
|
+
})(["", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");width:fit-content !important;&.", "{visibility:hidden;}"], cellTokens.cellLabelColor, attachTokens.cellLabelColor, cellTokens.cellTitleColor, attachTokens.cellTitleColor, cellTokens.cellSubtitleColor, attachTokens.cellSubtitleColor, cellTokens.cellBackgroundColor, attachTokens.cellBackgroundColor, cellTokens.cellWidth, attachTokens.cellWidth, cellTokens.cellPadding, attachTokens.cellPadding, cellTokens.cellPaddingLeftContent, attachTokens.cellPaddingLeftContent, cellTokens.cellPaddingContent, attachTokens.cellPaddingContent, cellTokens.cellPaddingRightContent, attachTokens.cellPaddingRightContent, cellTokens.cellTextboxGap, attachTokens.cellTextboxGap, cellTokens.cellGap, attachTokens.cellGap, cellTokens.cellLabelFontFamily, attachTokens.cellLabelFontFamily, cellTokens.cellLabelFontSize, attachTokens.cellLabelFontSize, cellTokens.cellLabelFontStyle, attachTokens.cellLabelFontStyle, cellTokens.cellLabelFontWeight, attachTokens.cellLabelFontWeight, cellTokens.cellLabelLetterSpacing, attachTokens.cellLabelLetterSpacing, cellTokens.cellLabelLineHeight, attachTokens.cellLabelLineHeight, cellTokens.cellTitleFontFamily, attachTokens.cellTitleFontFamily, cellTokens.cellTitleFontSize, attachTokens.cellTitleFontSize, cellTokens.cellTitleFontStyle, attachTokens.cellTitleFontStyle, cellTokens.cellTitleFontWeight, attachTokens.cellTitleFontWeight, cellTokens.cellTitleLetterSpacing, attachTokens.cellTitleLetterSpacing, cellTokens.cellTitleLineHeight, attachTokens.cellTitleLineHeight, cellTokens.cellSubtitleFontFamily, attachTokens.cellSubtitleFontFamily, cellTokens.cellSubtitleFontSize, attachTokens.cellSubtitleFontSize, cellTokens.cellSubtitleFontStyle, attachTokens.cellSubtitleFontStyle, cellTokens.cellSubtitleFontWeight, attachTokens.cellSubtitleFontWeight, cellTokens.cellSubtitleLetterSpacing, attachTokens.cellSubtitleLetterSpacing, cellTokens.cellSubtitleLineHeight, attachTokens.cellSubtitleLineHeight, classes.cellHidden);
|
@@ -0,0 +1 @@
|
|
1
|
+
export { StyledIconButton } from './IconButton.styles';
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import styled from 'styled-components';
|
2
|
+
import { component, mergeConfig } from '../../../../engines';
|
3
|
+
import { iconButtonConfig, iconButtonTokens } from '../../../IconButton';
|
4
|
+
import { tokens as attachTokens } from '../../Attach.tokens';
|
5
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(iconButtonConfig);
|
6
|
+
var IconButton = /*#__PURE__*/component(mergedConfig);
|
7
|
+
export var StyledIconButton = /*#__PURE__*/styled(IconButton).withConfig({
|
8
|
+
componentId: "plasma-new-hope__sc-7q1s1x-0"
|
9
|
+
})(["", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");"], iconButtonTokens.iconButtonColor, attachTokens.iconButtonColor, iconButtonTokens.iconButtonBackgroundColor, attachTokens.iconButtonBackgroundColor, iconButtonTokens.iconButtonColorHover, attachTokens.iconButtonColorHover, iconButtonTokens.iconButtonBackgroundColorHover, attachTokens.iconButtonBackgroundColorHover, iconButtonTokens.iconButtonColorActive, attachTokens.iconButtonColorActive, iconButtonTokens.iconButtonBackgroundColorActive, attachTokens.iconButtonBackgroundColorActive, iconButtonTokens.iconButtonHeight, attachTokens.iconButtonHeight, iconButtonTokens.iconButtonWidth, attachTokens.iconButtonWidth, iconButtonTokens.iconButtonPadding, attachTokens.iconButtonPadding, iconButtonTokens.iconButtonRadius, attachTokens.iconButtonRadius, iconButtonTokens.iconButtonFontFamily, attachTokens.iconButtonFontFamily, iconButtonTokens.iconButtonFontSize, attachTokens.iconButtonFontSize, iconButtonTokens.iconButtonFontStyle, attachTokens.iconButtonFontStyle, iconButtonTokens.iconButtonFontWeight, attachTokens.iconButtonFontWeight, iconButtonTokens.iconButtonLetterSpacing, attachTokens.iconButtonLetterSpacing, iconButtonTokens.iconButtonLineHeight, attachTokens.iconButtonLineHeight);
|
@@ -0,0 +1,19 @@
|
|
1
|
+
var _IconBlankPdfOutline, _IconBlankDocOutline, _IconBlankXlsOutline, _IconBlankTxtOutline, _IconBlankCsvOutline, _IconBlankOutline;
|
2
|
+
import React from 'react';
|
3
|
+
import { IconBlankCsvOutline, IconBlankDocOutline, IconBlankOutline, IconBlankPdfOutline, IconBlankTxtOutline, IconBlankXlsOutline } from '@salutejs/plasma-icons';
|
4
|
+
export var getFileicon = function getFileicon(extension) {
|
5
|
+
switch (extension) {
|
6
|
+
case 'pdf':
|
7
|
+
return _IconBlankPdfOutline || (_IconBlankPdfOutline = /*#__PURE__*/React.createElement(IconBlankPdfOutline, null));
|
8
|
+
case 'doc':
|
9
|
+
return _IconBlankDocOutline || (_IconBlankDocOutline = /*#__PURE__*/React.createElement(IconBlankDocOutline, null));
|
10
|
+
case 'xls':
|
11
|
+
return _IconBlankXlsOutline || (_IconBlankXlsOutline = /*#__PURE__*/React.createElement(IconBlankXlsOutline, null));
|
12
|
+
case 'txt':
|
13
|
+
return _IconBlankTxtOutline || (_IconBlankTxtOutline = /*#__PURE__*/React.createElement(IconBlankTxtOutline, null));
|
14
|
+
case 'csv':
|
15
|
+
return _IconBlankCsvOutline || (_IconBlankCsvOutline = /*#__PURE__*/React.createElement(IconBlankCsvOutline, null));
|
16
|
+
default:
|
17
|
+
return _IconBlankOutline || (_IconBlankOutline = /*#__PURE__*/React.createElement(IconBlankOutline, null));
|
18
|
+
}
|
19
|
+
};
|