@salutejs/plasma-new-hope 0.195.0-canary.1574.11921374356.0 → 0.195.0-dev.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Autocomplete/Autocomplete.js +1 -7
- package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs/components/Badge/Badge.css +4 -4
- package/cjs/components/Badge/Badge.js +17 -7
- package/cjs/components/Badge/Badge.js.map +1 -1
- package/cjs/components/Badge/Badge.tokens.js +10 -5
- package/cjs/components/Badge/Badge.tokens.js.map +1 -1
- package/cjs/components/Badge/variations/_clear/base.js +1 -1
- package/cjs/components/Badge/variations/_clear/base.js.map +1 -1
- package/cjs/components/Badge/variations/_clear/base_wiboj8.css +1 -0
- package/cjs/components/Badge/variations/_size/base.js +1 -1
- package/cjs/components/Badge/variations/_size/base.js.map +1 -1
- package/{es/components/Badge/variations/_size/base_to0y5x.css → cjs/components/Badge/variations/_size/base_bu5opk.css} +1 -1
- package/cjs/components/Badge/variations/_transparent/base.js +1 -1
- package/cjs/components/Badge/variations/_transparent/base.js.map +1 -1
- package/cjs/components/Badge/variations/_transparent/base_aapqhz.css +1 -0
- package/cjs/components/Badge/variations/_view/base.js +1 -1
- package/cjs/components/Badge/variations/_view/base.js.map +1 -1
- package/cjs/components/Badge/variations/_view/base_j3xzf3.css +1 -0
- package/cjs/index.css +4 -4
- package/emotion/cjs/components/Autocomplete/Autocomplete.js +1 -7
- package/emotion/cjs/components/Badge/Badge.js +17 -7
- package/emotion/cjs/components/Badge/Badge.template-doc.mdx +40 -16
- package/emotion/cjs/components/Badge/Badge.tokens.js +10 -6
- package/emotion/cjs/components/Badge/variations/_clear/base.js +1 -1
- package/emotion/cjs/components/Badge/variations/_size/base.js +2 -1
- package/emotion/cjs/components/Badge/variations/_transparent/base.js +1 -1
- package/emotion/cjs/components/Badge/variations/_view/base.js +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Badge/Badge.config.js +15 -15
- package/emotion/cjs/examples/plasma_b2c/components/Badge/Badge.stories.tsx +23 -6
- package/emotion/cjs/examples/plasma_web/components/Badge/Badge.config.js +14 -14
- package/emotion/cjs/examples/plasma_web/components/Badge/Badge.stories.tsx +27 -6
- package/emotion/es/components/Autocomplete/Autocomplete.js +1 -7
- package/emotion/es/components/Badge/Badge.js +18 -8
- package/emotion/es/components/Badge/Badge.template-doc.mdx +40 -16
- package/emotion/es/components/Badge/Badge.tokens.js +9 -5
- package/emotion/es/components/Badge/variations/_clear/base.js +2 -2
- package/emotion/es/components/Badge/variations/_size/base.js +3 -2
- package/emotion/es/components/Badge/variations/_transparent/base.js +2 -2
- package/emotion/es/components/Badge/variations/_view/base.js +2 -2
- package/emotion/es/examples/plasma_b2c/components/Badge/Badge.config.js +15 -15
- package/emotion/es/examples/plasma_b2c/components/Badge/Badge.stories.tsx +23 -6
- package/emotion/es/examples/plasma_web/components/Badge/Badge.config.js +14 -14
- package/emotion/es/examples/plasma_web/components/Badge/Badge.stories.tsx +27 -6
- package/es/components/Autocomplete/Autocomplete.js +1 -7
- package/es/components/Autocomplete/Autocomplete.js.map +1 -1
- package/es/components/Badge/Badge.css +4 -4
- package/es/components/Badge/Badge.js +20 -10
- package/es/components/Badge/Badge.js.map +1 -1
- package/es/components/Badge/Badge.tokens.js +10 -6
- package/es/components/Badge/Badge.tokens.js.map +1 -1
- package/es/components/Badge/variations/_clear/base.js +1 -1
- package/es/components/Badge/variations/_clear/base.js.map +1 -1
- package/es/components/Badge/variations/_clear/base_wiboj8.css +1 -0
- package/es/components/Badge/variations/_size/base.js +1 -1
- package/es/components/Badge/variations/_size/base.js.map +1 -1
- package/{cjs/components/Badge/variations/_size/base_to0y5x.css → es/components/Badge/variations/_size/base_bu5opk.css} +1 -1
- package/es/components/Badge/variations/_transparent/base.js +1 -1
- package/es/components/Badge/variations/_transparent/base.js.map +1 -1
- package/es/components/Badge/variations/_transparent/base_aapqhz.css +1 -0
- package/es/components/Badge/variations/_view/base.js +1 -1
- package/es/components/Badge/variations/_view/base.js.map +1 -1
- package/es/components/Badge/variations/_view/base_j3xzf3.css +1 -0
- package/es/index.css +4 -4
- package/package.json +2 -2
- package/styled-components/cjs/components/Autocomplete/Autocomplete.js +1 -7
- package/styled-components/cjs/components/Badge/Badge.js +17 -7
- package/styled-components/cjs/components/Badge/Badge.template-doc.mdx +40 -16
- package/styled-components/cjs/components/Badge/Badge.tokens.js +10 -6
- package/styled-components/cjs/components/Badge/variations/_clear/base.js +1 -1
- package/styled-components/cjs/components/Badge/variations/_size/base.js +2 -1
- package/styled-components/cjs/components/Badge/variations/_transparent/base.js +1 -1
- package/styled-components/cjs/components/Badge/variations/_view/base.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Badge/Badge.config.js +5 -5
- package/styled-components/cjs/examples/plasma_b2c/components/Badge/Badge.stories.tsx +23 -6
- package/styled-components/cjs/examples/plasma_web/components/Badge/Badge.config.js +5 -5
- package/styled-components/cjs/examples/plasma_web/components/Badge/Badge.stories.tsx +27 -6
- package/styled-components/es/components/Autocomplete/Autocomplete.js +1 -7
- package/styled-components/es/components/Badge/Badge.js +18 -8
- package/styled-components/es/components/Badge/Badge.template-doc.mdx +40 -16
- package/styled-components/es/components/Badge/Badge.tokens.js +9 -5
- package/styled-components/es/components/Badge/variations/_clear/base.js +2 -2
- package/styled-components/es/components/Badge/variations/_size/base.js +3 -2
- package/styled-components/es/components/Badge/variations/_transparent/base.js +2 -2
- package/styled-components/es/components/Badge/variations/_view/base.js +2 -2
- package/styled-components/es/examples/plasma_b2c/components/Badge/Badge.config.js +5 -5
- package/styled-components/es/examples/plasma_b2c/components/Badge/Badge.stories.tsx +23 -6
- package/styled-components/es/examples/plasma_web/components/Badge/Badge.config.js +5 -5
- package/styled-components/es/examples/plasma_web/components/Badge/Badge.stories.tsx +27 -6
- package/types/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/types/components/Autocomplete/Autocomplete.types.d.ts +0 -4
- package/types/components/Autocomplete/Autocomplete.types.d.ts.map +1 -1
- package/types/components/Badge/Badge.d.ts.map +1 -1
- package/types/components/Badge/Badge.tokens.d.ts +8 -4
- package/types/components/Badge/Badge.tokens.d.ts.map +1 -1
- package/types/components/Badge/Badge.types.d.ts +18 -5
- package/types/components/Badge/Badge.types.d.ts.map +1 -1
- package/types/components/Badge/variations/_clear/base.d.ts.map +1 -1
- package/types/components/Badge/variations/_size/base.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Badge/Badge.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Badge/Badge.d.ts +61 -4
- package/types/examples/plasma_b2c/components/Badge/Badge.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Badge/Badge.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Badge/Badge.d.ts +61 -4
- package/types/examples/plasma_web/components/Badge/Badge.d.ts.map +1 -1
- package/cjs/components/Badge/variations/_clear/base_oopyb7.css +0 -1
- package/cjs/components/Badge/variations/_transparent/base_1l6036y.css +0 -1
- package/cjs/components/Badge/variations/_view/base_qlxank.css +0 -1
- package/es/components/Badge/variations/_clear/base_oopyb7.css +0 -1
- package/es/components/Badge/variations/_transparent/base_1l6036y.css +0 -1
- package/es/components/Badge/variations/_view/base_qlxank.css +0 -1
@@ -31,6 +31,13 @@ const meta: Meta<typeof Badge> = {
|
|
31
31
|
control: { type: 'boolean' },
|
32
32
|
if: { arg: 'clear', truthy: false },
|
33
33
|
},
|
34
|
+
maxWidth: {
|
35
|
+
control: { type: 'text' },
|
36
|
+
},
|
37
|
+
text: {
|
38
|
+
control: { type: 'text' },
|
39
|
+
if: { arg: 'enableText', truthy: true },
|
40
|
+
},
|
34
41
|
...disableProps(['contentLeft', 'contentRight']),
|
35
42
|
},
|
36
43
|
};
|
@@ -40,6 +47,7 @@ export default meta;
|
|
40
47
|
type StoryProps = ComponentProps<typeof Badge> & {
|
41
48
|
enableContentLeft: boolean;
|
42
49
|
enableContentRight: boolean;
|
50
|
+
enableText: boolean;
|
43
51
|
};
|
44
52
|
type Story = StoryObj<StoryProps>;
|
45
53
|
|
@@ -60,26 +68,39 @@ export const Default: Story = {
|
|
60
68
|
},
|
61
69
|
enableContentRight: {
|
62
70
|
control: { type: 'boolean' },
|
63
|
-
if: { arg: '
|
71
|
+
if: { arg: 'enableText', truthy: true },
|
64
72
|
},
|
65
73
|
},
|
66
74
|
args: {
|
67
|
-
text: 'Hello',
|
68
75
|
view: 'default',
|
69
76
|
size: 'm',
|
77
|
+
enableText: true,
|
78
|
+
text: 'Hello',
|
70
79
|
enableContentLeft: false,
|
71
80
|
enableContentRight: false,
|
72
81
|
clear: false,
|
73
82
|
pilled: false,
|
74
83
|
transparent: false,
|
84
|
+
maxWidth: '',
|
75
85
|
},
|
76
|
-
render: ({ enableContentLeft, enableContentRight, size, ...rest }: StoryProps) => {
|
77
|
-
const iconSize =
|
86
|
+
render: ({ enableContentLeft, enableContentRight, enableText, size, ...rest }: StoryProps) => {
|
87
|
+
const iconSize = () => {
|
88
|
+
switch (size) {
|
89
|
+
case 'l':
|
90
|
+
return '1rem';
|
91
|
+
case 'xs':
|
92
|
+
return '0.625rem';
|
93
|
+
default:
|
94
|
+
return '0.75rem';
|
95
|
+
}
|
96
|
+
};
|
78
97
|
|
79
98
|
return (
|
80
99
|
<Badge
|
81
|
-
contentLeft={
|
82
|
-
|
100
|
+
contentLeft={
|
101
|
+
enableContentLeft || !enableText ? <BellIcon width={iconSize()} height={iconSize()} /> : undefined
|
102
|
+
}
|
103
|
+
contentRight={enableContentRight ? <BellIcon width={iconSize()} height={iconSize()} /> : undefined}
|
83
104
|
size={size}
|
84
105
|
{...rest}
|
85
106
|
/>
|
@@ -10,7 +10,7 @@ import { StyledTextField } from './ui/TextField/TextField.styles.js';
|
|
10
10
|
import { SuggestionItem } from './ui/SuggestionItem/SuggestionItem.js';
|
11
11
|
import { getPlacements } from '../../utils/getPopoverPlacement.js';
|
12
12
|
|
13
|
-
var _excluded = ["value", "
|
13
|
+
var _excluded = ["value", "onChange", "suggestions", "view", "size", "labelPlacement", "disabled", "readOnly", "label", "leftHelper", "contentLeft", "contentRight", "textBefore", "textAfter", "onScroll", "listMaxHeight", "listWidth", "portal", "filter", "onSuggestionSelect", "threshold", "renderList", "renderListEnd", "onSearch", "hintText"];
|
14
14
|
|
15
15
|
/**
|
16
16
|
* Компонент Autocomplete. Поле ввода с подсказками в выпадающем списке.
|
@@ -18,7 +18,6 @@ var _excluded = ["value", "defaultValue", "onChange", "suggestions", "view", "si
|
|
18
18
|
var autocompleteRoot = function autocompleteRoot(Root) {
|
19
19
|
return /*#__PURE__*/forwardRef(function (_ref, ref) {
|
20
20
|
var outerValue = _ref.value,
|
21
|
-
defaultValue = _ref.defaultValue,
|
22
21
|
onChange = _ref.onChange,
|
23
22
|
suggestions = _ref.suggestions,
|
24
23
|
view = _ref.view,
|
@@ -106,11 +105,6 @@ var autocompleteRoot = function autocompleteRoot(Root) {
|
|
106
105
|
type: 'reset'
|
107
106
|
});
|
108
107
|
}, [value]);
|
109
|
-
useDidMountEffect(function () {
|
110
|
-
if (defaultValue) {
|
111
|
-
setInnerValue(defaultValue);
|
112
|
-
}
|
113
|
-
}, [defaultValue]);
|
114
108
|
return /*#__PURE__*/React.createElement(Root, {
|
115
109
|
view: view,
|
116
110
|
size: size,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Autocomplete.js","sources":["../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import React, { forwardRef, useState, useReducer } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\n\nimport { useDidMountEffect, useOutsideClick } from '../../hooks';\nimport { RootProps } from '../../engines';\nimport { getPlacements } from '../../utils';\n\nimport { focusedReducer } from './reducers/focusedReducer';\nimport { SuggestionItem, StyledTextField } from './ui';\nimport { StyledPopover, Ul, LeftHelper, base, InfiniteLoaderWrapper } from './Autocomplete.styles';\nimport type { AutocompleteProps, SuggestionItemType } from './Autocomplete.types';\nimport { useKeyNavigation } from './hooks/useKeyboardNavigation';\n\n/**\n * Компонент Autocomplete. Поле ввода с подсказками в выпадающем списке.\n */\nexport const autocompleteRoot = (Root: RootProps<HTMLInputElement, AutocompleteProps>) =>\n forwardRef<HTMLInputElement, AutocompleteProps>(\n (\n {\n value: outerValue,\n defaultValue,\n onChange,\n suggestions,\n view,\n size,\n labelPlacement,\n disabled,\n readOnly,\n label,\n leftHelper,\n contentLeft,\n contentRight,\n textBefore,\n textAfter,\n onScroll,\n listMaxHeight,\n listWidth,\n portal,\n filter,\n onSuggestionSelect,\n threshold = 2,\n renderList,\n renderListEnd,\n onSearch,\n\n hintText,\n\n ...rest\n },\n ref,\n ) => {\n const [focused, dispatchFocused] = useReducer(focusedReducer, null);\n const [innerValue, setInnerValue] = useState<string | number>('');\n const [isOpen, setIsOpen] = useState(false);\n\n const listId = safeUseId();\n const value = outerValue ?? innerValue;\n\n const helperTextId = safeUseId();\n\n const targetRef = useOutsideClick<HTMLDivElement>(() => {\n setIsOpen(false);\n });\n\n const handleFocus = () => {\n if (value.toString().length >= threshold) {\n setIsOpen(true);\n }\n };\n\n const handleItemClick = (e: SuggestionItemType) => {\n setInnerValue(e.label);\n\n if (onSuggestionSelect) {\n onSuggestionSelect(e);\n }\n\n setIsOpen(false);\n };\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const currentValue = e.target.value;\n\n setInnerValue(currentValue);\n\n if (onChange) {\n onChange(e);\n }\n\n if (currentValue.toString().length >= threshold) {\n setIsOpen(true);\n } else {\n setIsOpen(false);\n }\n };\n\n const defaultFilterCallback = ({ label }: { label: string }) => {\n return label.toLowerCase().includes(value.toString().toLowerCase());\n };\n\n const finalResults = suggestions?.filter(filter || defaultFilterCallback) || [];\n\n const { onKeyDown } = useKeyNavigation({\n isOpen,\n setIsOpen,\n focused,\n dispatchFocused,\n finalResults,\n handleItemClick,\n });\n\n useDidMountEffect(() => {\n dispatchFocused({ type: 'reset' });\n }, [value]);\n\n useDidMountEffect(() => {\n if (defaultValue) {\n setInnerValue(defaultValue);\n }\n }, [defaultValue]);\n\n return (\n <Root view={view} size={size} labelPlacement={labelPlacement} disabled={disabled} readOnly={readOnly}>\n <StyledPopover\n opened={isOpen}\n offset={[0, 0]}\n placement={getPlacements('bottom')}\n isFocusTrapped={false}\n usePortal={Boolean(portal)}\n frame={portal}\n target={\n <StyledTextField\n value={value}\n onChange={handleChange}\n onSearch={focused === null ? onSearch : undefined}\n ref={ref}\n size={size}\n view={view}\n labelPlacement={labelPlacement}\n disabled={disabled}\n readOnly={readOnly}\n label={label}\n contentLeft={contentLeft}\n contentRight={contentRight}\n textBefore={textBefore}\n textAfter={textAfter}\n onFocus={handleFocus}\n onKeyDown={onKeyDown}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-controls={listId}\n aria-expanded={isOpen}\n aria-activedescendant={`${listId}/${focused}`}\n aria-describedby={helperTextId}\n hintText={String(hintText || '')}\n {...rest}\n />\n }\n preventOverflow={false}\n ref={targetRef}\n listWidth={listWidth}\n >\n {(renderList && renderList(finalResults)) ||\n (Boolean(finalResults.length) && (\n <Root\n view={view}\n size={size}\n labelPlacement={labelPlacement}\n disabled={disabled}\n readOnly={readOnly}\n >\n <Ul\n id={listId}\n role=\"listbox\"\n aria-label={label}\n onScroll={onScroll}\n listMaxHeight={listMaxHeight}\n >\n {finalResults.map((suggestion, index) => (\n <SuggestionItem\n key={index}\n item={suggestion}\n onClick={handleItemClick}\n id={`${listId}/${index}`}\n focused={focused === index}\n />\n ))}\n\n {renderListEnd && (\n <InfiniteLoaderWrapper>{renderListEnd()}</InfiniteLoaderWrapper>\n )}\n </Ul>\n </Root>\n ))}\n </StyledPopover>\n\n {/* TODO: Дублируем хелпер для корректного позиционирования списка подсказок */}\n {leftHelper && (\n <LeftHelper id={helperTextId} disabled={disabled} readOnly={readOnly}>\n {leftHelper}\n </LeftHelper>\n )}\n </Root>\n );\n },\n );\n\nexport const autocompleteConfig = {\n name: 'Autocomplete',\n tag: 'div',\n layout: autocompleteRoot,\n base,\n defaults: {\n view: 'default',\n size: 'l',\n labelPlacement: 'outer',\n },\n variations: {\n view: {\n css: '',\n },\n },\n};\n"],"names":["autocompleteRoot","Root","forwardRef","_ref","ref","outerValue","value","defaultValue","onChange","suggestions","view","size","labelPlacement","disabled","readOnly","label","leftHelper","contentLeft","contentRight","textBefore","textAfter","onScroll","listMaxHeight","listWidth","portal","filter","onSuggestionSelect","_ref$threshold","threshold","renderList","renderListEnd","onSearch","hintText","rest","_objectWithoutProperties","_excluded","_useReducer","useReducer","focusedReducer","_useReducer2","_slicedToArray","focused","dispatchFocused","_useState","useState","_useState2","innerValue","setInnerValue","_useState3","_useState4","isOpen","setIsOpen","listId","safeUseId","helperTextId","targetRef","useOutsideClick","handleFocus","toString","length","handleItemClick","e","handleChange","currentValue","target","defaultFilterCallback","_ref2","toLowerCase","includes","finalResults","_useKeyNavigation","useKeyNavigation","onKeyDown","useDidMountEffect","type","React","createElement","StyledPopover","opened","offset","placement","getPlacements","isFocusTrapped","usePortal","Boolean","frame","StyledTextField","_extends","undefined","onFocus","role","concat","String","preventOverflow","Ul","id","map","suggestion","index","SuggestionItem","key","item","onClick","InfiniteLoaderWrapper","LeftHelper","autocompleteConfig","name","tag","layout","base","defaults","variations","css"],"mappings":";;;;;;;;;;;;;;AAaA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAAoD,EAAA;AAAA,EAAA,oBACjFC,UAAU,CACN,UAAAC,IAAA,EAgCIC,GAAG,EACF;AAAA,IAAA,IA/BUC,UAAU,GAAAF,IAAA,CAAjBG,KAAK;MACLC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;MACZC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;MACRC,WAAW,GAAAN,IAAA,CAAXM,WAAW;MACXC,IAAI,GAAAP,IAAA,CAAJO,IAAI;MACJC,IAAI,GAAAR,IAAA,CAAJQ,IAAI;MACJC,cAAc,GAAAT,IAAA,CAAdS,cAAc;MACdC,QAAQ,GAAAV,IAAA,CAARU,QAAQ;MACRC,QAAQ,GAAA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GAAG,CAAC,UAACC,UAAU,EAAEC,KAAK,EAAA;AAAA,MAAA,oBAChCvB,KAAA,CAAAC,aAAA,CAACuB,cAAc,EAAA;AACXC,QAAAA,GAAG,EAAEF,KAAM;AACXG,QAAAA,IAAI,EAAEJ,UAAW;AACjBK,QAAAA,OAAO,EAAE1C,eAAgB;QACzBmC,EAAE,EAAA,EAAA,CAAAJ,MAAA,CAAKvC,MAAM,OAAAuC,MAAA,CAAIO,KAAK,CAAG;QACzBzD,OAAO,EAAEA,OAAO,KAAKyD,KAAAA;AAAM,OAC9B,CAAC,CAAA;KACL,CAAC,EAEDpE,aAAa,iBACV6C,KAAA,CAAAC,aAAA,CAAC2B,qBAAqB,EAAA,IAAA,EAAEzE,aAAa,EAA0B,CAEnE,CACF,CAEH,CAAC,EAGfd,UAAU,iBACP2D,KAAA,CAAAC,aAAA,CAAC4B,UAAU,EAAA;AAACT,MAAAA,EAAE,EAAEzC,YAAa;AAACzC,MAAAA,QAAQ,EAAEA,QAAS;AAACC,MAAAA,QAAQ,EAAEA,QAAAA;KACvDE,EAAAA,UACO,CAEd,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMyF,kBAAkB,GAAG;AAC9BC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE5G,gBAAgB;AACxB6G,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,QAAQ,EAAE;AACNpG,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAG;AACTC,IAAAA,cAAc,EAAE,OAAA;GACnB;AACDmG,EAAAA,UAAU,EAAE;AACRrG,IAAAA,IAAI,EAAE;AACFsG,MAAAA,GAAG,EAAE,EAAA;AACT,KAAA;AACJ,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"Autocomplete.js","sources":["../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import React, { forwardRef, useState, useReducer } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\n\nimport { useDidMountEffect, useOutsideClick } from '../../hooks';\nimport { RootProps } from '../../engines';\nimport { getPlacements } from '../../utils';\n\nimport { focusedReducer } from './reducers/focusedReducer';\nimport { SuggestionItem, StyledTextField } from './ui';\nimport { StyledPopover, Ul, LeftHelper, base, InfiniteLoaderWrapper } from './Autocomplete.styles';\nimport type { AutocompleteProps, SuggestionItemType } from './Autocomplete.types';\nimport { useKeyNavigation } from './hooks/useKeyboardNavigation';\n\n/**\n * Компонент Autocomplete. Поле ввода с подсказками в выпадающем списке.\n */\nexport const autocompleteRoot = (Root: RootProps<HTMLInputElement, AutocompleteProps>) =>\n forwardRef<HTMLInputElement, AutocompleteProps>(\n (\n {\n value: outerValue,\n onChange,\n suggestions,\n view,\n size,\n labelPlacement,\n disabled,\n readOnly,\n label,\n leftHelper,\n contentLeft,\n contentRight,\n textBefore,\n textAfter,\n onScroll,\n listMaxHeight,\n listWidth,\n portal,\n filter,\n onSuggestionSelect,\n threshold = 2,\n renderList,\n renderListEnd,\n onSearch,\n\n hintText,\n\n ...rest\n },\n ref,\n ) => {\n const [focused, dispatchFocused] = useReducer(focusedReducer, null);\n const [innerValue, setInnerValue] = useState<string | number>('');\n const [isOpen, setIsOpen] = useState(false);\n\n const listId = safeUseId();\n const value = outerValue ?? innerValue;\n\n const helperTextId = safeUseId();\n\n const targetRef = useOutsideClick<HTMLDivElement>(() => {\n setIsOpen(false);\n });\n\n const handleFocus = () => {\n if (value.toString().length >= threshold) {\n setIsOpen(true);\n }\n };\n\n const handleItemClick = (e: SuggestionItemType) => {\n setInnerValue(e.label);\n\n if (onSuggestionSelect) {\n onSuggestionSelect(e);\n }\n\n setIsOpen(false);\n };\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const currentValue = e.target.value;\n\n setInnerValue(currentValue);\n\n if (onChange) {\n onChange(e);\n }\n\n if (currentValue.toString().length >= threshold) {\n setIsOpen(true);\n } else {\n setIsOpen(false);\n }\n };\n\n const defaultFilterCallback = ({ label }: { label: string }) => {\n return label.toLowerCase().includes(value.toString().toLowerCase());\n };\n\n const finalResults = suggestions?.filter(filter || defaultFilterCallback) || [];\n\n const { onKeyDown } = useKeyNavigation({\n isOpen,\n setIsOpen,\n focused,\n dispatchFocused,\n finalResults,\n handleItemClick,\n });\n\n useDidMountEffect(() => {\n dispatchFocused({ type: 'reset' });\n }, [value]);\n\n return (\n <Root view={view} size={size} labelPlacement={labelPlacement} disabled={disabled} readOnly={readOnly}>\n <StyledPopover\n opened={isOpen}\n offset={[0, 0]}\n placement={getPlacements('bottom')}\n isFocusTrapped={false}\n usePortal={Boolean(portal)}\n frame={portal}\n target={\n <StyledTextField\n value={value}\n onChange={handleChange}\n onSearch={focused === null ? onSearch : undefined}\n ref={ref}\n size={size}\n view={view}\n labelPlacement={labelPlacement}\n disabled={disabled}\n readOnly={readOnly}\n label={label}\n contentLeft={contentLeft}\n contentRight={contentRight}\n textBefore={textBefore}\n textAfter={textAfter}\n onFocus={handleFocus}\n onKeyDown={onKeyDown}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-controls={listId}\n aria-expanded={isOpen}\n aria-activedescendant={`${listId}/${focused}`}\n aria-describedby={helperTextId}\n hintText={String(hintText || '')}\n {...rest}\n />\n }\n preventOverflow={false}\n ref={targetRef}\n listWidth={listWidth}\n >\n {(renderList && renderList(finalResults)) ||\n (Boolean(finalResults.length) && (\n <Root\n view={view}\n size={size}\n labelPlacement={labelPlacement}\n disabled={disabled}\n readOnly={readOnly}\n >\n <Ul\n id={listId}\n role=\"listbox\"\n aria-label={label}\n onScroll={onScroll}\n listMaxHeight={listMaxHeight}\n >\n {finalResults.map((suggestion, index) => (\n <SuggestionItem\n key={index}\n item={suggestion}\n onClick={handleItemClick}\n id={`${listId}/${index}`}\n focused={focused === index}\n />\n ))}\n\n {renderListEnd && (\n <InfiniteLoaderWrapper>{renderListEnd()}</InfiniteLoaderWrapper>\n )}\n </Ul>\n </Root>\n ))}\n </StyledPopover>\n\n {/* TODO: Дублируем хелпер для корректного позиционирования списка подсказок */}\n {leftHelper && (\n <LeftHelper id={helperTextId} disabled={disabled} readOnly={readOnly}>\n {leftHelper}\n </LeftHelper>\n )}\n </Root>\n );\n },\n );\n\nexport const autocompleteConfig = {\n name: 'Autocomplete',\n tag: 'div',\n layout: autocompleteRoot,\n base,\n defaults: {\n view: 'default',\n size: 'l',\n labelPlacement: 'outer',\n },\n variations: {\n view: {\n css: '',\n },\n },\n};\n"],"names":["autocompleteRoot","Root","forwardRef","_ref","ref","outerValue","value","onChange","suggestions","view","size","labelPlacement","disabled","readOnly","label","leftHelper","contentLeft","contentRight","textBefore","textAfter","onScroll","listMaxHeight","listWidth","portal","filter","onSuggestionSelect","_ref$threshold","threshold","renderList","renderListEnd","onSearch","hintText","rest","_objectWithoutProperties","_excluded","_useReducer","useReducer","focusedReducer","_useReducer2","_slicedToArray","focused","dispatchFocused","_useState","useState","_useState2","innerValue","setInnerValue","_useState3","_useState4","isOpen","setIsOpen","listId","safeUseId","helperTextId","targetRef","useOutsideClick","handleFocus","toString","length","handleItemClick","e","handleChange","currentValue","target","defaultFilterCallback","_ref2","toLowerCase","includes","finalResults","_useKeyNavigation","useKeyNavigation","onKeyDown","useDidMountEffect","type","React","createElement","StyledPopover","opened","offset","placement","getPlacements","isFocusTrapped","usePortal","Boolean","frame","StyledTextField","_extends","undefined","onFocus","role","concat","String","preventOverflow","Ul","id","map","suggestion","index","SuggestionItem","key","item","onClick","InfiniteLoaderWrapper","LeftHelper","autocompleteConfig","name","tag","layout","base","defaults","variations","css"],"mappings":";;;;;;;;;;;;;;AAaA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAAoD,EAAA;AAAA,EAAA,oBACjFC,UAAU,CACN,UAAAC,IAAA,EA+BIC,GAAG,EACF;AAAA,IAAA,IA9BUC,UAAU,GAAAF,IAAA,CAAjBG,KAAK;MACLC,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1,12 +1,12 @@
|
|
1
|
-
.
|
1
|
+
.base_j3xzf3_b5zny0e__f0386786{color:var(--plasma-badge-custom-color,var(--plasma-badge-color));background-color:var(--plasma-badge-custom-background,var(--plasma-badge-background));}
|
2
2
|
|
3
|
-
.
|
3
|
+
.base_bu5opk_bb8jvo5__18c67c14{font-family:var(--plasma-badge-font-family);font-size:var(--plasma-badge-font-size);font-style:var(--plasma-badge-font-style);font-weight:var(--plasma-badge-font-weight);-webkit-letter-spacing:var(--plasma-badge-letter-spacing);-moz-letter-spacing:var(--plasma-badge-letter-spacing);-ms-letter-spacing:var(--plasma-badge-letter-spacing);letter-spacing:var(--plasma-badge-letter-spacing);line-height:var(--plasma-badge-lineheight);border-radius:var(--plasma-badge-border-radius);height:var(--plasma-badge-height);padding:var(--plasma-badge-padding);}.base_bu5opk_bb8jvo5__18c67c14.base_bu5opk_badgeIconOnly__18c67c14{padding:var(--plasma-badge-padding-icon-only);}.base_bu5opk_bb8jvo5__18c67c14.base_bu5opk_badgeIconOnly__18c67c14 .base_bu5opk_s1t43xoe__18c67c14{margin:0;}
|
4
4
|
|
5
5
|
.base_zpvffd_b3w4z61__f9738ae7.base_zpvffd_badgePilled__f9738ae7{border-radius:var(--plasma-badge-pilled-border-radius);}
|
6
6
|
|
7
|
-
.
|
7
|
+
.base_aapqhz_binquhc__81eb1c83.base_aapqhz_badgeTransparent__81eb1c83{color:var(--plasma-badge-custom-color,var(--plasma-badge-color-transparent));background-color:var(--plasma-badge-custom-background,var(--plasma-badge-background-transparent));}
|
8
8
|
|
9
|
-
.
|
9
|
+
.base_wiboj8_b1e1wuvi__44d619d2.base_wiboj8_badgeClear__44d619d2{color:var(--plasma-badge-custom-color,var(--plasma-badge-color-clear));background-color:var(--plasma-badge-custom-background,var(--plasma-badge-background-clear));}
|
10
10
|
|
11
11
|
.Badge_styles_hhbwyi_s1t43xoe__47a1842a{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-left:var(--plasma-badge-left-content-margin-left);margin-right:var(--plasma-badge-left-content-margin-right);}
|
12
12
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import React, { forwardRef } from 'react';
|
3
3
|
import { cx } from '../../utils/index.js';
|
4
4
|
import { base as base$1 } from './variations/_view/base.js';
|
@@ -6,19 +6,23 @@ import { base as base$2 } from './variations/_size/base.js';
|
|
6
6
|
import { base as base$3 } from './variations/_pilled/base.js';
|
7
7
|
import { base as base$4 } from './variations/_transparent/base.js';
|
8
8
|
import { base as base$5 } from './variations/_clear/base.js';
|
9
|
-
import { StyledContentLeft, StyledContentMain, StyledContentRight
|
10
|
-
import { classes } from './Badge.tokens.js';
|
9
|
+
import { base, StyledContentLeft, StyledContentMain, StyledContentRight } from './Badge.styles.js';
|
10
|
+
import { privateTokens, classes } from './Badge.tokens.js';
|
11
11
|
|
12
|
-
var _excluded = ["children", "className", "text", "contentLeft", "contentRight", "size", "view", "pilled", "transparent", "clear", "maxWidth"];
|
12
|
+
var _excluded = ["children", "className", "style", "text", "contentLeft", "contentRight", "size", "view", "customColor", "customBackgroundColor", "pilled", "transparent", "clear", "maxWidth"];
|
13
13
|
var badgeRoot = function badgeRoot(Root) {
|
14
14
|
return /*#__PURE__*/forwardRef(function (props, ref) {
|
15
|
+
var _StyledContentLeft, _StyledContentMain, _StyledContentMain2, _StyledContentRight;
|
15
16
|
var children = props.children,
|
16
17
|
className = props.className,
|
18
|
+
style = props.style,
|
17
19
|
text = props.text,
|
18
20
|
contentLeft = props.contentLeft,
|
19
21
|
contentRight = props.contentRight,
|
20
22
|
size = props.size,
|
21
23
|
view = props.view,
|
24
|
+
customColor = props.customColor,
|
25
|
+
customBackgroundColor = props.customBackgroundColor,
|
22
26
|
_props$pilled = props.pilled,
|
23
27
|
pilled = _props$pilled === void 0 ? false : _props$pilled,
|
24
28
|
_props$transparent = props.transparent,
|
@@ -33,19 +37,25 @@ var badgeRoot = function badgeRoot(Root) {
|
|
33
37
|
var clearClass = clear ? classes.badgeClear : undefined;
|
34
38
|
var truncateClass = maxWidth !== 'auto' ? classes.badgeTruncate : undefined;
|
35
39
|
var txt = !text && typeof children === 'string' ? children : text;
|
40
|
+
var iconOnlyClass = !txt && contentLeft ? classes.iconOnly : undefined;
|
41
|
+
var BadgeContent = function BadgeContent() {
|
42
|
+
if (contentLeft) {
|
43
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, _StyledContentLeft || (_StyledContentLeft = /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft)), txt ? _StyledContentMain || (_StyledContentMain = /*#__PURE__*/React.createElement(StyledContentMain, null, txt)) : children);
|
44
|
+
}
|
45
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, txt ? _StyledContentMain2 || (_StyledContentMain2 = /*#__PURE__*/React.createElement(StyledContentMain, null, txt)) : children, contentRight && (_StyledContentRight || (_StyledContentRight = /*#__PURE__*/React.createElement(StyledContentRight, null, contentRight))));
|
46
|
+
};
|
36
47
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
37
48
|
ref: ref,
|
38
|
-
className: cx(pilledClass, transparentClass, clearClass, truncateClass, className),
|
49
|
+
className: cx(pilledClass, transparentClass, clearClass, truncateClass, iconOnlyClass, className),
|
39
50
|
view: view,
|
40
51
|
size: size,
|
41
52
|
pilled: pilled,
|
42
53
|
transparent: transparent,
|
43
|
-
clear: clear
|
44
|
-
|
45
|
-
style: _objectSpread2(_objectSpread2({}, rest.style), {}, {
|
54
|
+
clear: clear,
|
55
|
+
style: _objectSpread2(_objectSpread2({}, style), {}, _defineProperty(_defineProperty({
|
46
56
|
maxWidth: maxWidth
|
47
|
-
})
|
48
|
-
}
|
57
|
+
}, privateTokens.customBackground, customBackgroundColor), privateTokens.customColor, customColor))
|
58
|
+
}, rest), /*#__PURE__*/React.createElement(BadgeContent, null));
|
49
59
|
});
|
50
60
|
};
|
51
61
|
var badgeConfig = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport { base as transparentCSS } from './variations/_transparent/base';\nimport { base as clearCSS } from './variations/_clear/base';\nimport type { BadgeProps, BadgeRootProps } from './Badge.types';\nimport { StyledContentLeft, StyledContentMain, StyledContentRight, base } from './Badge.styles';\nimport { classes } from './Badge.tokens';\n\nexport const badgeRoot = (Root: RootProps<HTMLDivElement, BadgeRootProps>) =>\n forwardRef<HTMLDivElement, BadgeProps>((props, ref) => {\n const {\n children,\n className,\n text,\n contentLeft,\n contentRight,\n size,\n view,\n pilled = false,\n transparent = false,\n clear = false,\n maxWidth = 'auto',\n ...rest\n } = props;\n\n const pilledClass = pilled ? classes.badgePilled : undefined;\n const transparentClass = transparent ? classes.badgeTransparent : undefined;\n const clearClass = clear ? classes.badgeClear : undefined;\n const truncateClass = maxWidth !== 'auto' ? classes.badgeTruncate : undefined;\n\n const txt = !text && typeof children === 'string' ? children : text;\n\n return (\n <Root\n ref={ref}\n className={cx(pilledClass, transparentClass, clearClass, truncateClass, className)}\n view={view}\n size={size}\n pilled={pilled}\n transparent={transparent}\n clear={clear}\n {
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef } from 'react';\n\nimport type { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport { base as transparentCSS } from './variations/_transparent/base';\nimport { base as clearCSS } from './variations/_clear/base';\nimport type { BadgeProps, BadgeRootProps } from './Badge.types';\nimport { StyledContentLeft, StyledContentMain, StyledContentRight, base } from './Badge.styles';\nimport { classes, privateTokens } from './Badge.tokens';\n\nexport const badgeRoot = (Root: RootProps<HTMLDivElement, BadgeRootProps>) =>\n forwardRef<HTMLDivElement, BadgeProps>((props, ref) => {\n const {\n children,\n className,\n style,\n text,\n contentLeft,\n contentRight,\n size,\n view,\n customColor,\n customBackgroundColor,\n pilled = false,\n transparent = false,\n clear = false,\n maxWidth = 'auto',\n ...rest\n } = props;\n\n const pilledClass = pilled ? classes.badgePilled : undefined;\n const transparentClass = transparent ? classes.badgeTransparent : undefined;\n const clearClass = clear ? classes.badgeClear : undefined;\n const truncateClass = maxWidth !== 'auto' ? classes.badgeTruncate : undefined;\n\n const txt = !text && typeof children === 'string' ? children : text;\n const iconOnlyClass = !txt && contentLeft ? classes.iconOnly : undefined;\n\n const BadgeContent = () => {\n if (contentLeft) {\n return (\n <>\n <StyledContentLeft>{contentLeft}</StyledContentLeft>\n {txt ? <StyledContentMain>{txt}</StyledContentMain> : children}\n </>\n );\n }\n\n return (\n <>\n {txt ? <StyledContentMain>{txt}</StyledContentMain> : children}\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n </>\n );\n };\n\n return (\n <Root\n ref={ref}\n className={cx(pilledClass, transparentClass, clearClass, truncateClass, iconOnlyClass, className)}\n view={view}\n size={size}\n pilled={pilled}\n transparent={transparent}\n clear={clear}\n style={\n {\n ...style,\n maxWidth,\n [privateTokens.customBackground]: customBackgroundColor,\n [privateTokens.customColor]: customColor,\n } as CSSProperties\n }\n {...rest}\n >\n <BadgeContent />\n </Root>\n );\n });\n\nexport const badgeConfig = {\n name: 'Badge',\n tag: 'div',\n layout: badgeRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n pilled: {\n css: pilledCSS,\n attrs: true,\n },\n transparent: {\n css: transparentCSS,\n attrs: true,\n },\n clear: {\n css: clearCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["badgeRoot","Root","forwardRef","props","ref","_StyledContentLeft","_StyledContentMain","_StyledContentMain2","_StyledContentRight","children","className","style","text","contentLeft","contentRight","size","view","customColor","customBackgroundColor","_props$pilled","pilled","_props$transparent","transparent","_props$clear","clear","_props$maxWidth","maxWidth","rest","_objectWithoutProperties","_excluded","pilledClass","classes","badgePilled","undefined","transparentClass","badgeTransparent","clearClass","badgeClear","truncateClass","badgeTruncate","txt","iconOnlyClass","iconOnly","BadgeContent","React","createElement","Fragment","StyledContentLeft","StyledContentMain","StyledContentRight","_extends","cx","_objectSpread","_defineProperty","privateTokens","customBackground","badgeConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","pilledCSS","attrs","transparentCSS","clearCSS","defaults"],"mappings":";;;;;;;;;;;;IAcaA,SAAS,GAAG,SAAZA,SAASA,CAAIC,IAA+C,EAAA;AAAA,EAAA,oBACrEC,UAAU,CAA6B,UAACC,KAAK,EAAEC,GAAG,EAAK;AAAA,IAAA,IAAAC,kBAAA,EAAAC,kBAAA,EAAAC,mBAAA,EAAAC,mBAAA,CAAA;AACnD,IAAA,IACIC,QAAQ,GAeRN,KAAK,CAfLM,QAAQ;MACRC,SAAS,GAcTP,KAAK,CAdLO,SAAS;MACTC,KAAK,GAaLR,KAAK,CAbLQ,KAAK;MACLC,IAAI,GAYJT,KAAK,CAZLS,IAAI;MACJC,WAAW,GAWXV,KAAK,CAXLU,WAAW;MACXC,YAAY,GAUZX,KAAK,CAVLW,YAAY;MACZC,IAAI,GASJZ,KAAK,CATLY,IAAI;MACJC,IAAI,GAQJb,KAAK,CARLa,IAAI;MACJC,WAAW,GAOXd,KAAK,CAPLc,WAAW;MACXC,qBAAqB,GAMrBf,KAAK,CANLe,qBAAqB;MAAAC,aAAA,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AAa,CAACrC,WAAW,EAAGA,WAAW,CAAA,CAAA;KAG5CU,EAAAA,IAAI,gBAERiB,KAAA,CAAAC,aAAA,CAACF,YAAY,EAAE,IAAA,CACb,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMa,WAAW,GAAG;AACvBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE3D,SAAS;AACjB4D,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACR7C,IAAAA,IAAI,EAAE;AACF8C,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDhD,IAAAA,IAAI,EAAE;AACF+C,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACD5C,IAAAA,MAAM,EAAE;AACJ0C,MAAAA,GAAG,EAAEG,MAAS;AACdC,MAAAA,KAAK,EAAE,IAAA;KACV;AACD5C,IAAAA,WAAW,EAAE;AACTwC,MAAAA,GAAG,EAAEK,MAAc;AACnBD,MAAAA,KAAK,EAAE,IAAA;KACV;AACD1C,IAAAA,KAAK,EAAE;AACHsC,MAAAA,GAAG,EAAEM,MAAQ;AACbF,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDG,EAAAA,QAAQ,EAAE;AACNrD,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -2,7 +2,12 @@ var classes = {
|
|
2
2
|
badgePilled: 'badge-pilled',
|
3
3
|
badgeTransparent: 'badge-transparent',
|
4
4
|
badgeClear: 'badge-clear',
|
5
|
-
badgeTruncate: 'badge-truncate'
|
5
|
+
badgeTruncate: 'badge-truncate',
|
6
|
+
iconOnly: 'badge-icon-only'
|
7
|
+
};
|
8
|
+
var privateTokens = {
|
9
|
+
customBackground: '--plasma-badge-custom-background',
|
10
|
+
customColor: '--plasma-badge-custom-color'
|
6
11
|
};
|
7
12
|
var tokens = {
|
8
13
|
background: '--plasma-badge-background',
|
@@ -10,13 +15,12 @@ var tokens = {
|
|
10
15
|
backgroundTransparent: '--plasma-badge-background-transparent',
|
11
16
|
colorTransparent: '--plasma-badge-color-transparent',
|
12
17
|
colorClear: '--plasma-badge-color-clear',
|
18
|
+
backgroundClear: '--plasma-badge-background-clear',
|
13
19
|
borderRadius: '--plasma-badge-border-radius',
|
14
20
|
pilledBorderRadius: '--plasma-badge-pilled-border-radius',
|
15
21
|
height: '--plasma-badge-height',
|
16
|
-
|
17
|
-
|
18
|
-
paddingBottom: '--plasma-badge-padding-bottom',
|
19
|
-
paddingLeft: '--plasma-badge-padding-left',
|
22
|
+
padding: '--plasma-badge-padding',
|
23
|
+
paddingIconOnly: '--plasma-badge-padding-icon-only',
|
20
24
|
fontFamily: '--plasma-badge-font-family',
|
21
25
|
fontSize: '--plasma-badge-font-size',
|
22
26
|
fontStyle: '--plasma-badge-font-style',
|
@@ -29,5 +33,5 @@ var tokens = {
|
|
29
33
|
rightContentMarginRight: '--plasma-badge-right-content-margin-right'
|
30
34
|
};
|
31
35
|
|
32
|
-
export { classes, tokens };
|
36
|
+
export { classes, privateTokens, tokens };
|
33
37
|
//# sourceMappingURL=Badge.tokens.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Badge.tokens.js","sources":["../../../src/components/Badge/Badge.tokens.ts"],"sourcesContent":["export const classes = {\n badgePilled: 'badge-pilled',\n badgeTransparent: 'badge-transparent',\n badgeClear: 'badge-clear',\n badgeTruncate: 'badge-truncate',\n};\n\nexport const tokens = {\n background: '--plasma-badge-background',\n color: '--plasma-badge-color',\n backgroundTransparent: '--plasma-badge-background-transparent',\n colorTransparent: '--plasma-badge-color-transparent',\n colorClear: '--plasma-badge-color-clear',\n
|
1
|
+
{"version":3,"file":"Badge.tokens.js","sources":["../../../src/components/Badge/Badge.tokens.ts"],"sourcesContent":["export const classes = {\n badgePilled: 'badge-pilled',\n badgeTransparent: 'badge-transparent',\n badgeClear: 'badge-clear',\n badgeTruncate: 'badge-truncate',\n iconOnly: 'badge-icon-only',\n};\n\nexport const privateTokens = {\n customBackground: '--plasma-badge-custom-background',\n customColor: '--plasma-badge-custom-color',\n};\n\nexport const tokens = {\n background: '--plasma-badge-background',\n color: '--plasma-badge-color',\n backgroundTransparent: '--plasma-badge-background-transparent',\n colorTransparent: '--plasma-badge-color-transparent',\n colorClear: '--plasma-badge-color-clear',\n backgroundClear: '--plasma-badge-background-clear',\n\n borderRadius: '--plasma-badge-border-radius',\n pilledBorderRadius: '--plasma-badge-pilled-border-radius',\n height: '--plasma-badge-height',\n padding: '--plasma-badge-padding',\n paddingIconOnly: '--plasma-badge-padding-icon-only',\n\n fontFamily: '--plasma-badge-font-family',\n fontSize: '--plasma-badge-font-size',\n fontStyle: '--plasma-badge-font-style',\n fontWeight: '--plasma-badge-font-weight',\n letterSpacing: '--plasma-badge-letter-spacing',\n lineHeight: '--plasma-badge-lineheight',\n\n leftContentMarginLeft: '--plasma-badge-left-content-margin-left',\n leftContentMarginRight: '--plasma-badge-left-content-margin-right',\n rightContentMarginLeft: '--plasma-badge-right-content-margin-left',\n rightContentMarginRight: '--plasma-badge-right-content-margin-right',\n};\n"],"names":["classes","badgePilled","badgeTransparent","badgeClear","badgeTruncate","iconOnly","privateTokens","customBackground","customColor","tokens","background","color","backgroundTransparent","colorTransparent","colorClear","backgroundClear","borderRadius","pilledBorderRadius","height","padding","paddingIconOnly","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","leftContentMarginLeft","leftContentMarginRight","rightContentMarginLeft","rightContentMarginRight"],"mappings":"AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,WAAW,EAAE,cAAc;AAC3BC,EAAAA,gBAAgB,EAAE,mBAAmB;AACrCC,EAAAA,UAAU,EAAE,aAAa;AACzBC,EAAAA,aAAa,EAAE,gBAAgB;AAC/BC,EAAAA,QAAQ,EAAE,iBAAA;AACd,EAAC;AAEM,IAAMC,aAAa,GAAG;AACzBC,EAAAA,gBAAgB,EAAE,kCAAkC;AACpDC,EAAAA,WAAW,EAAE,6BAAA;AACjB,EAAC;AAEM,IAAMC,MAAM,GAAG;AAClBC,EAAAA,UAAU,EAAE,2BAA2B;AACvCC,EAAAA,KAAK,EAAE,sBAAsB;AAC7BC,EAAAA,qBAAqB,EAAE,uCAAuC;AAC9DC,EAAAA,gBAAgB,EAAE,kCAAkC;AACpDC,EAAAA,UAAU,EAAE,4BAA4B;AACxCC,EAAAA,eAAe,EAAE,iCAAiC;AAElDC,EAAAA,YAAY,EAAE,8BAA8B;AAC5CC,EAAAA,kBAAkB,EAAE,qCAAqC;AACzDC,EAAAA,MAAM,EAAE,uBAAuB;AAC/BC,EAAAA,OAAO,EAAE,wBAAwB;AACjCC,EAAAA,eAAe,EAAE,kCAAkC;AAEnDC,EAAAA,UAAU,EAAE,4BAA4B;AACxCC,EAAAA,QAAQ,EAAE,0BAA0B;AACpCC,EAAAA,SAAS,EAAE,2BAA2B;AACtCC,EAAAA,UAAU,EAAE,4BAA4B;AACxCC,EAAAA,aAAa,EAAE,+BAA+B;AAC9CC,EAAAA,UAAU,EAAE,2BAA2B;AAEvCC,EAAAA,qBAAqB,EAAE,yCAAyC;AAChEC,EAAAA,sBAAsB,EAAE,0CAA0C;AAClEC,EAAAA,sBAAsB,EAAE,0CAA0C;AAClEC,EAAAA,uBAAuB,EAAE,2CAAA;AAC7B;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../src/components/Badge/variations/_clear/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { classes, tokens } from '../../Badge.tokens';\n\nexport const base = css`\n &.${classes.badgeClear} {\n color: var(${tokens.colorClear});\n background-color:
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/Badge/variations/_clear/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { classes, privateTokens, tokens } from '../../Badge.tokens';\n\nexport const base = css`\n &.${classes.badgeClear} {\n color: var(${privateTokens.customColor}, var(${tokens.colorClear}));\n background-color: var(${privateTokens.customBackground}, var(${tokens.backgroundClear}));\n }\n`;\n"],"names":["base"],"mappings":"AAIO,IAAMA,IAAI,GAKhB;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
.b1e1wuvi.badge-clear{color:var(--plasma-badge-custom-color,var(--plasma-badge-color-clear));background-color:var(--plasma-badge-custom-background,var(--plasma-badge-background-clear));}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../src/components/Badge/variations/_size/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { tokens } from '../../Badge.tokens';\n\nexport const base = css`\n font-family: var(${tokens.fontFamily});\n font-size: var(${tokens.fontSize});\n font-style: var(${tokens.fontStyle});\n font-weight: var(${tokens.fontWeight});\n letter-spacing: var(${tokens.letterSpacing});\n line-height: var(${tokens.lineHeight});\n\n border-radius: var(${tokens.borderRadius});\n\n height: var(${tokens.height});\n\n padding
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/Badge/variations/_size/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { classes, tokens } from '../../Badge.tokens';\nimport { StyledContentLeft } from '../../Badge.styles';\n\nexport const base = css`\n font-family: var(${tokens.fontFamily});\n font-size: var(${tokens.fontSize});\n font-style: var(${tokens.fontStyle});\n font-weight: var(${tokens.fontWeight});\n letter-spacing: var(${tokens.letterSpacing});\n line-height: var(${tokens.lineHeight});\n\n border-radius: var(${tokens.borderRadius});\n\n height: var(${tokens.height});\n\n padding: var(${tokens.padding});\n\n &.${classes.iconOnly} {\n padding: var(${tokens.paddingIconOnly});\n\n ${StyledContentLeft} {\n margin: 0;\n }\n }\n`;\n"],"names":["base"],"mappings":"AAKO,IAAMA,IAAI,GAqBhB;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
.bb8jvo5{font-family:var(--plasma-badge-font-family);font-size:var(--plasma-badge-font-size);font-style:var(--plasma-badge-font-style);font-weight:var(--plasma-badge-font-weight);-webkit-letter-spacing:var(--plasma-badge-letter-spacing);-moz-letter-spacing:var(--plasma-badge-letter-spacing);-ms-letter-spacing:var(--plasma-badge-letter-spacing);letter-spacing:var(--plasma-badge-letter-spacing);line-height:var(--plasma-badge-lineheight);border-radius:var(--plasma-badge-border-radius);height:var(--plasma-badge-height);padding
|
1
|
+
.bb8jvo5{font-family:var(--plasma-badge-font-family);font-size:var(--plasma-badge-font-size);font-style:var(--plasma-badge-font-style);font-weight:var(--plasma-badge-font-weight);-webkit-letter-spacing:var(--plasma-badge-letter-spacing);-moz-letter-spacing:var(--plasma-badge-letter-spacing);-ms-letter-spacing:var(--plasma-badge-letter-spacing);letter-spacing:var(--plasma-badge-letter-spacing);line-height:var(--plasma-badge-lineheight);border-radius:var(--plasma-badge-border-radius);height:var(--plasma-badge-height);padding:var(--plasma-badge-padding);}.bb8jvo5.badge-icon-only{padding:var(--plasma-badge-padding-icon-only);}.bb8jvo5.badge-icon-only .s1t43xoe{margin:0;}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../src/components/Badge/variations/_transparent/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { classes, tokens } from '../../Badge.tokens';\n\nexport const base = css`\n &.${classes.badgeTransparent} {\n color: var(${tokens.colorTransparent});\n background-color: var(${tokens.backgroundTransparent});\n }\n`;\n"],"names":["base"],"mappings":"AAIO,IAAMA,IAAI,GAKhB;;;;"}
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/Badge/variations/_transparent/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { classes, privateTokens, tokens } from '../../Badge.tokens';\n\nexport const base = css`\n &.${classes.badgeTransparent} {\n color: var(${privateTokens.customColor}, var(${tokens.colorTransparent}));\n background-color: var(${privateTokens.customBackground}, var(${tokens.backgroundTransparent}));\n }\n`;\n"],"names":["base"],"mappings":"AAIO,IAAMA,IAAI,GAKhB;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
.binquhc.badge-transparent{color:var(--plasma-badge-custom-color,var(--plasma-badge-color-transparent));background-color:var(--plasma-badge-custom-background,var(--plasma-badge-background-transparent));}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../src/components/Badge/variations/_view/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { tokens } from '../../Badge.tokens';\n\nexport const base = css`\n color: var(${tokens.color});\n background-color: var(${tokens.background});\n`;\n"],"names":["base"],"mappings":"AAIO,IAAMA,IAAI,GAGhB;;;;"}
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/Badge/variations/_view/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { privateTokens, tokens } from '../../Badge.tokens';\n\nexport const base = css`\n color: var(${privateTokens.customColor}, var(${tokens.color}));\n background-color: var(${privateTokens.customBackground}, var(${tokens.background}));\n`;\n"],"names":["base"],"mappings":"AAIO,IAAMA,IAAI,GAGhB;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
.b5zny0e{color:var(--plasma-badge-custom-color,var(--plasma-badge-color));background-color:var(--plasma-badge-custom-background,var(--plasma-badge-background));}
|
package/es/index.css
CHANGED
@@ -463,15 +463,15 @@
|
|
463
463
|
.Image_styles_12ttxgz_s2ny8jg__83bd03eb{width:100%;height:100%;object-fit:cover;position:absolute;}
|
464
464
|
.Image_styles_12ttxgz_s1e232qk__83bd03eb{width:100%;height:100%;position:absolute;background-position:center;background-size:cover;}
|
465
465
|
|
466
|
-
.
|
466
|
+
.base_j3xzf3_b5zny0e__f0386786{color:var(--plasma-badge-custom-color,var(--plasma-badge-color));background-color:var(--plasma-badge-custom-background,var(--plasma-badge-background));}
|
467
467
|
|
468
|
-
.
|
468
|
+
.base_bu5opk_bb8jvo5__18c67c14{font-family:var(--plasma-badge-font-family);font-size:var(--plasma-badge-font-size);font-style:var(--plasma-badge-font-style);font-weight:var(--plasma-badge-font-weight);-webkit-letter-spacing:var(--plasma-badge-letter-spacing);-moz-letter-spacing:var(--plasma-badge-letter-spacing);-ms-letter-spacing:var(--plasma-badge-letter-spacing);letter-spacing:var(--plasma-badge-letter-spacing);line-height:var(--plasma-badge-lineheight);border-radius:var(--plasma-badge-border-radius);height:var(--plasma-badge-height);padding:var(--plasma-badge-padding);}.base_bu5opk_bb8jvo5__18c67c14.base_bu5opk_badgeIconOnly__18c67c14{padding:var(--plasma-badge-padding-icon-only);}.base_bu5opk_bb8jvo5__18c67c14.base_bu5opk_badgeIconOnly__18c67c14 .base_bu5opk_s1t43xoe__18c67c14{margin:0;}
|
469
469
|
|
470
470
|
.base_zpvffd_b3w4z61__f9738ae7.base_zpvffd_badgePilled__f9738ae7{border-radius:var(--plasma-badge-pilled-border-radius);}
|
471
471
|
|
472
|
-
.
|
472
|
+
.base_aapqhz_binquhc__81eb1c83.base_aapqhz_badgeTransparent__81eb1c83{color:var(--plasma-badge-custom-color,var(--plasma-badge-color-transparent));background-color:var(--plasma-badge-custom-background,var(--plasma-badge-background-transparent));}
|
473
473
|
|
474
|
-
.
|
474
|
+
.base_wiboj8_b1e1wuvi__44d619d2.base_wiboj8_badgeClear__44d619d2{color:var(--plasma-badge-custom-color,var(--plasma-badge-color-clear));background-color:var(--plasma-badge-custom-background,var(--plasma-badge-background-clear));}
|
475
475
|
|
476
476
|
.Badge_styles_hhbwyi_s1t43xoe__47a1842a{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-left:var(--plasma-badge-left-content-margin-left);margin-right:var(--plasma-badge-left-content-margin-right);}
|
477
477
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.195.0-
|
3
|
+
"version": "0.195.0-dev.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -129,5 +129,5 @@
|
|
129
129
|
"sideEffects": [
|
130
130
|
"*.css"
|
131
131
|
],
|
132
|
-
"gitHead": "
|
132
|
+
"gitHead": "e8c1ee1545b8ffd1422c8974c9191f2fa2c7a528"
|
133
133
|
}
|
@@ -13,7 +13,7 @@ var _focusedReducer = /*#__PURE__*/require("./reducers/focusedReducer");
|
|
13
13
|
var _ui = /*#__PURE__*/require("./ui");
|
14
14
|
var _Autocomplete = /*#__PURE__*/require("./Autocomplete.styles");
|
15
15
|
var _useKeyboardNavigation = /*#__PURE__*/require("./hooks/useKeyboardNavigation");
|
16
|
-
var _excluded = ["value", "
|
16
|
+
var _excluded = ["value", "onChange", "suggestions", "view", "size", "labelPlacement", "disabled", "readOnly", "label", "leftHelper", "contentLeft", "contentRight", "textBefore", "textAfter", "onScroll", "listMaxHeight", "listWidth", "portal", "filter", "onSuggestionSelect", "threshold", "renderList", "renderListEnd", "onSearch", "hintText"];
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
18
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
19
19
|
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); }
|
@@ -31,7 +31,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
31
31
|
var autocompleteRoot = exports.autocompleteRoot = function autocompleteRoot(Root) {
|
32
32
|
return /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
33
33
|
var outerValue = _ref.value,
|
34
|
-
defaultValue = _ref.defaultValue,
|
35
34
|
onChange = _ref.onChange,
|
36
35
|
suggestions = _ref.suggestions,
|
37
36
|
view = _ref.view,
|
@@ -119,11 +118,6 @@ var autocompleteRoot = exports.autocompleteRoot = function autocompleteRoot(Root
|
|
119
118
|
type: 'reset'
|
120
119
|
});
|
121
120
|
}, [value]);
|
122
|
-
(0, _hooks.useDidMountEffect)(function () {
|
123
|
-
if (defaultValue) {
|
124
|
-
setInnerValue(defaultValue);
|
125
|
-
}
|
126
|
-
}, [defaultValue]);
|
127
121
|
return /*#__PURE__*/_react["default"].createElement(Root, {
|
128
122
|
view: view,
|
129
123
|
size: size,
|
@@ -14,7 +14,7 @@ var _base4 = /*#__PURE__*/require("./variations/_transparent/base");
|
|
14
14
|
var _base5 = /*#__PURE__*/require("./variations/_clear/base");
|
15
15
|
var _Badge = /*#__PURE__*/require("./Badge.styles");
|
16
16
|
var _Badge2 = /*#__PURE__*/require("./Badge.tokens");
|
17
|
-
var _excluded = ["children", "className", "text", "contentLeft", "contentRight", "size", "view", "pilled", "transparent", "clear", "maxWidth"];
|
17
|
+
var _excluded = ["children", "className", "style", "text", "contentLeft", "contentRight", "size", "view", "customColor", "customBackgroundColor", "pilled", "transparent", "clear", "maxWidth"];
|
18
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
19
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
20
20
|
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); }
|
@@ -27,13 +27,17 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
27
27
|
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; }
|
28
28
|
var badgeRoot = exports.badgeRoot = function badgeRoot(Root) {
|
29
29
|
return /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
30
|
+
var _StyledContentLeft, _StyledContentMain, _StyledContentMain2, _StyledContentRight;
|
30
31
|
var children = props.children,
|
31
32
|
className = props.className,
|
33
|
+
style = props.style,
|
32
34
|
text = props.text,
|
33
35
|
contentLeft = props.contentLeft,
|
34
36
|
contentRight = props.contentRight,
|
35
37
|
size = props.size,
|
36
38
|
view = props.view,
|
39
|
+
customColor = props.customColor,
|
40
|
+
customBackgroundColor = props.customBackgroundColor,
|
37
41
|
_props$pilled = props.pilled,
|
38
42
|
pilled = _props$pilled === void 0 ? false : _props$pilled,
|
39
43
|
_props$transparent = props.transparent,
|
@@ -48,19 +52,25 @@ var badgeRoot = exports.badgeRoot = function badgeRoot(Root) {
|
|
48
52
|
var clearClass = clear ? _Badge2.classes.badgeClear : undefined;
|
49
53
|
var truncateClass = maxWidth !== 'auto' ? _Badge2.classes.badgeTruncate : undefined;
|
50
54
|
var txt = !text && typeof children === 'string' ? children : text;
|
55
|
+
var iconOnlyClass = !txt && contentLeft ? _Badge2.classes.iconOnly : undefined;
|
56
|
+
var BadgeContent = function BadgeContent() {
|
57
|
+
if (contentLeft) {
|
58
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _StyledContentLeft || (_StyledContentLeft = /*#__PURE__*/_react["default"].createElement(_Badge.StyledContentLeft, null, contentLeft)), txt ? _StyledContentMain || (_StyledContentMain = /*#__PURE__*/_react["default"].createElement(_Badge.StyledContentMain, null, txt)) : children);
|
59
|
+
}
|
60
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, txt ? _StyledContentMain2 || (_StyledContentMain2 = /*#__PURE__*/_react["default"].createElement(_Badge.StyledContentMain, null, txt)) : children, contentRight && (_StyledContentRight || (_StyledContentRight = /*#__PURE__*/_react["default"].createElement(_Badge.StyledContentRight, null, contentRight))));
|
61
|
+
};
|
51
62
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
52
63
|
ref: ref,
|
53
|
-
className: (0, _utils.cx)(pilledClass, transparentClass, clearClass, truncateClass, className),
|
64
|
+
className: (0, _utils.cx)(pilledClass, transparentClass, clearClass, truncateClass, iconOnlyClass, className),
|
54
65
|
view: view,
|
55
66
|
size: size,
|
56
67
|
pilled: pilled,
|
57
68
|
transparent: transparent,
|
58
|
-
clear: clear
|
59
|
-
|
60
|
-
style: _objectSpread(_objectSpread({}, rest.style), {}, {
|
69
|
+
clear: clear,
|
70
|
+
style: _objectSpread(_objectSpread({}, style), {}, _defineProperty(_defineProperty({
|
61
71
|
maxWidth: maxWidth
|
62
|
-
})
|
63
|
-
}
|
72
|
+
}, _Badge2.privateTokens.customBackground, customBackgroundColor), _Badge2.privateTokens.customColor, customColor))
|
73
|
+
}, rest), /*#__PURE__*/_react["default"].createElement(BadgeContent, null));
|
64
74
|
});
|
65
75
|
};
|
66
76
|
var badgeConfig = exports.badgeConfig = {
|