@salutejs/plasma-new-hope 0.186.0-canary.1541.11711445984.0 → 0.186.0-canary.1546.11723696357.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Badge/Badge.css +4 -4
- package/cjs/components/Badge/Badge.js +16 -4
- 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_rn38n6.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/components/TextField/TextField.js +0 -11
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/index.css +4 -4
- package/emotion/cjs/components/Badge/Badge.js +21 -4
- 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/components/TextField/TextField.js +1 -12
- package/emotion/cjs/examples/plasma_b2c/components/Badge/Badge.config.js +14 -14
- package/emotion/cjs/examples/plasma_b2c/components/Badge/Badge.stories.tsx +8 -2
- package/emotion/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +0 -1
- package/emotion/cjs/examples/plasma_web/components/Badge/Badge.config.js +14 -14
- package/emotion/cjs/examples/plasma_web/components/Badge/Badge.stories.tsx +8 -2
- package/emotion/es/components/Badge/Badge.js +23 -5
- 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/components/TextField/TextField.js +1 -12
- package/emotion/es/examples/plasma_b2c/components/Badge/Badge.config.js +14 -14
- package/emotion/es/examples/plasma_b2c/components/Badge/Badge.stories.tsx +8 -2
- package/emotion/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +0 -1
- package/emotion/es/examples/plasma_web/components/Badge/Badge.config.js +14 -14
- package/emotion/es/examples/plasma_web/components/Badge/Badge.stories.tsx +8 -2
- package/es/components/Badge/Badge.css +4 -4
- package/es/components/Badge/Badge.js +19 -7
- 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_rn38n6.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/components/TextField/TextField.js +0 -11
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/index.css +4 -4
- package/package.json +2 -2
- package/styled-components/cjs/components/Badge/Badge.js +21 -4
- 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/components/TextField/TextField.js +0 -11
- 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 +8 -2
- package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +0 -1
- 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 +8 -2
- package/styled-components/es/components/Badge/Badge.js +23 -5
- 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/components/TextField/TextField.js +0 -11
- 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 +8 -2
- package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +0 -1
- 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 +8 -2
- 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/components/TextField/TextField.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 +58 -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 +58 -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/cjs/utils/syntheticEvent.js +0 -56
- package/cjs/utils/syntheticEvent.js.map +0 -1
- package/emotion/cjs/utils/syntheticEvent.js +0 -54
- package/emotion/es/utils/syntheticEvent.js +0 -48
- 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
- package/es/utils/syntheticEvent.js +0 -51
- package/es/utils/syntheticEvent.js.map +0 -1
- package/styled-components/cjs/utils/syntheticEvent.js +0 -54
- package/styled-components/es/utils/syntheticEvent.js +0 -48
- package/types/utils/syntheticEvent.d.ts +0 -4
- package/types/utils/syntheticEvent.d.ts.map +0 -1
@@ -14,21 +14,30 @@ 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"];
|
17
|
+
var _excluded = ["children", "className", "style", "text", "contentLeft", "contentRight", "size", "view", "customColor", "customBackgroundColor", "pilled", "transparent", "clear"];
|
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); }
|
21
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
23
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
25
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
21
26
|
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; }
|
22
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; }
|
23
28
|
var badgeRoot = exports.badgeRoot = function badgeRoot(Root) {
|
24
29
|
return /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
30
|
+
var _StyledContentLeft, _StyledContentMain, _StyledContentMain2, _StyledContentRight;
|
25
31
|
var children = props.children,
|
26
32
|
className = props.className,
|
33
|
+
style = props.style,
|
27
34
|
text = props.text,
|
28
35
|
contentLeft = props.contentLeft,
|
29
36
|
contentRight = props.contentRight,
|
30
37
|
size = props.size,
|
31
38
|
view = props.view,
|
39
|
+
customColor = props.customColor,
|
40
|
+
customBackgroundColor = props.customBackgroundColor,
|
32
41
|
_props$pilled = props.pilled,
|
33
42
|
pilled = _props$pilled === void 0 ? false : _props$pilled,
|
34
43
|
_props$transparent = props.transparent,
|
@@ -40,15 +49,23 @@ var badgeRoot = exports.badgeRoot = function badgeRoot(Root) {
|
|
40
49
|
var transparentClass = transparent ? _Badge2.classes.badgeTransparent : undefined;
|
41
50
|
var clearClass = clear ? _Badge2.classes.badgeClear : undefined;
|
42
51
|
var txt = !text && typeof children === 'string' ? children : text;
|
52
|
+
var iconOnlyClass = !txt && contentLeft ? _Badge2.classes.iconOnly : undefined;
|
53
|
+
var BadgeContent = function BadgeContent() {
|
54
|
+
if (contentLeft) {
|
55
|
+
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);
|
56
|
+
}
|
57
|
+
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))));
|
58
|
+
};
|
43
59
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
44
60
|
ref: ref,
|
45
|
-
className: (0, _utils.cx)(pilledClass, transparentClass, clearClass, className),
|
61
|
+
className: (0, _utils.cx)(pilledClass, transparentClass, clearClass, iconOnlyClass, className),
|
46
62
|
view: view,
|
47
63
|
size: size,
|
48
64
|
pilled: pilled,
|
49
65
|
transparent: transparent,
|
50
|
-
clear: clear
|
51
|
-
|
66
|
+
clear: clear,
|
67
|
+
style: _objectSpread(_objectSpread({}, style), {}, _defineProperty(_defineProperty({}, _Badge2.privateTokens.customBackground, customBackgroundColor), _Badge2.privateTokens.customColor, customColor))
|
68
|
+
}, rest), /*#__PURE__*/_react["default"].createElement(BadgeContent, null));
|
52
69
|
});
|
53
70
|
};
|
54
71
|
var badgeConfig = exports.badgeConfig = {
|
@@ -3,11 +3,16 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.tokens = exports.classes = void 0;
|
6
|
+
exports.tokens = exports.privateTokens = exports.classes = void 0;
|
7
7
|
var classes = exports.classes = {
|
8
8
|
badgePilled: 'badge-pilled',
|
9
9
|
badgeTransparent: 'badge-transparent',
|
10
|
-
badgeClear: 'badge-clear'
|
10
|
+
badgeClear: 'badge-clear',
|
11
|
+
iconOnly: 'badge-icon-only'
|
12
|
+
};
|
13
|
+
var privateTokens = exports.privateTokens = {
|
14
|
+
customBackground: '--plasma-badge-custom-background',
|
15
|
+
customColor: '--plasma-badge-custom-color'
|
11
16
|
};
|
12
17
|
var tokens = exports.tokens = {
|
13
18
|
background: '--plasma-badge-background',
|
@@ -15,13 +20,12 @@ var tokens = exports.tokens = {
|
|
15
20
|
backgroundTransparent: '--plasma-badge-background-transparent',
|
16
21
|
colorTransparent: '--plasma-badge-color-transparent',
|
17
22
|
colorClear: '--plasma-badge-color-clear',
|
23
|
+
backgroundClear: '--plasma-badge-background-clear',
|
18
24
|
borderRadius: '--plasma-badge-border-radius',
|
19
25
|
pilledBorderRadius: '--plasma-badge-pilled-border-radius',
|
20
26
|
height: '--plasma-badge-height',
|
21
|
-
|
22
|
-
|
23
|
-
paddingBottom: '--plasma-badge-padding-bottom',
|
24
|
-
paddingLeft: '--plasma-badge-padding-left',
|
27
|
+
padding: '--plasma-badge-padding',
|
28
|
+
paddingIconOnly: '--plasma-badge-padding-icon-only',
|
25
29
|
fontFamily: '--plasma-badge-font-family',
|
26
30
|
fontSize: '--plasma-badge-font-size',
|
27
31
|
fontStyle: '--plasma-badge-font-style',
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.base = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Badge = /*#__PURE__*/require("../../Badge.tokens");
|
9
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["&.", "{color:var(", ");background-color:
|
9
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["&.", "{color:var(", ",var(", "));background-color:var(", ",var(", "));}"], _Badge.classes.badgeClear, _Badge.privateTokens.customColor, _Badge.tokens.colorClear, _Badge.privateTokens.customBackground, _Badge.tokens.backgroundClear);
|
@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.base = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Badge = /*#__PURE__*/require("../../Badge.tokens");
|
9
|
-
var
|
9
|
+
var _Badge2 = /*#__PURE__*/require("../../Badge.styles");
|
10
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");border-radius:var(", ");height:var(", ");padding:var(", ");&.", "{padding:var(", ");", "{margin:0;}}"], _Badge.tokens.fontFamily, _Badge.tokens.fontSize, _Badge.tokens.fontStyle, _Badge.tokens.fontWeight, _Badge.tokens.letterSpacing, _Badge.tokens.lineHeight, _Badge.tokens.borderRadius, _Badge.tokens.height, _Badge.tokens.padding, _Badge.classes.iconOnly, _Badge.tokens.paddingIconOnly, _Badge2.StyledContentLeft);
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.base = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Badge = /*#__PURE__*/require("../../Badge.tokens");
|
9
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["&.", "{color:var(", ");background-color:var(", ");}"], _Badge.classes.badgeTransparent, _Badge.tokens.colorTransparent, _Badge.tokens.backgroundTransparent);
|
9
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["&.", "{color:var(", ",var(", "));background-color:var(", ",var(", "));}"], _Badge.classes.badgeTransparent, _Badge.privateTokens.customColor, _Badge.tokens.colorTransparent, _Badge.privateTokens.customBackground, _Badge.tokens.backgroundTransparent);
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.base = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Badge = /*#__PURE__*/require("../../Badge.tokens");
|
9
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["color:var(", ");background-color:var(", ");"], _Badge.tokens.color, _Badge.tokens.background);
|
9
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["color:var(", ",var(", "));background-color:var(", ",var(", "));"], _Badge.privateTokens.customColor, _Badge.tokens.color, _Badge.privateTokens.customBackground, _Badge.tokens.background);
|
@@ -10,7 +10,6 @@ var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
|
10
10
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
11
11
|
var _utils = /*#__PURE__*/require("../../utils");
|
12
12
|
var _hooks = /*#__PURE__*/require("../../hooks");
|
13
|
-
var _syntheticEvent = /*#__PURE__*/require("../../utils/syntheticEvent");
|
14
13
|
var _base = /*#__PURE__*/require("./variations/_size/base");
|
15
14
|
var _base2 = /*#__PURE__*/require("./variations/_view/base");
|
16
15
|
var _base3 = /*#__PURE__*/require("./variations/_clear/base");
|
@@ -232,21 +231,11 @@ var textFieldRoot = exports.textFieldRoot = function textFieldRoot(Root) {
|
|
232
231
|
setChips(newChips);
|
233
232
|
}, [isChipEnumeration, values]);
|
234
233
|
(0, _react.useEffect)(function () {
|
235
|
-
console.log('Init Value');
|
236
234
|
setHasValue(Boolean(rest === null || rest === void 0 ? void 0 : rest.defaultValue));
|
237
|
-
var event = (0, _syntheticEvent.createEvent)(inputRef);
|
238
|
-
if (event) {
|
239
|
-
handleChange(event);
|
240
|
-
}
|
241
235
|
}, [rest.defaultValue]);
|
242
236
|
(0, _react.useEffect)(function () {
|
243
237
|
var _inputRef$current2;
|
244
|
-
console.log('Set Value');
|
245
238
|
setHasValue(Boolean(outerValue) || Boolean(inputRef === null || inputRef === void 0 || (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.value));
|
246
|
-
var event = (0, _syntheticEvent.createEvent)(inputRef);
|
247
|
-
if (event) {
|
248
|
-
handleChange(event);
|
249
|
-
}
|
250
239
|
}, [outerValue, inputRef === null || inputRef === void 0 || (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value]);
|
251
240
|
var innerOptional = Boolean(required ? false : optional);
|
252
241
|
var hasPlaceholderOptional = innerOptional && !innerLabelValue && !hasOuterLabel;
|
@@ -22,10 +22,10 @@ var config = exports.config = {
|
|
22
22
|
light: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--on-light-text-primary);", ":var(--on-dark-surface-solid-default);", ":var(--on-dark-text-primary);", ":var(--on-dark-surface-transparent-card);", ":var(--on-dark-text-primary);"], _Badge.badgeTokens.color, _Badge.badgeTokens.background, _Badge.badgeTokens.colorTransparent, _Badge.badgeTokens.backgroundTransparent, _Badge.badgeTokens.colorClear)
|
23
23
|
},
|
24
24
|
size: {
|
25
|
-
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.5rem;", ":1.75rem;", ":0.6875rem;", ":0.
|
26
|
-
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.5rem;", ":0.5625rem;", ":0.
|
27
|
-
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.25rem;", ":0.4375rem;", ":0.
|
28
|
-
xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.25rem;", ":1rem;", ":0.25rem;", ":0.
|
25
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.5rem;", ":1.75rem;", ":0 0.6875rem;", ":0 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);", ":-0.0625rem;", ":0.25rem;", ":0.25rem;", ":-0.0625rem;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
26
|
+
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.5rem;", ":0 0.5625rem;", ":0 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);", ":-0.0625rem;", ":0.1875rem;", ":0.1875rem;", ":-0.0625rem;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
27
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.25rem;", ":0 0.4375rem;", ":0 0.25rem;", ":var(--plasma-typo-body-xxs-font-family);", ":var(--plasma-typo-body-xxs-font-size);", ":var(--plasma-typo-body-xxs-font-style);", ":var(--plasma-typo-body-xxs-font-weight);", ":var(--plasma-typo-body-xxs-letter-spacing);", ":var(--plasma-typo-body-xxs-line-height);", ":-0.0625rem;", ":0.125rem;", ":0.125rem;", ":-0.0625rem;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
28
|
+
xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.25rem;", ":1rem;", ":0 0.25rem;", ":0 0.188rem;", ":var(--plasma-typo-body-xxs-font-family);", ":var(--plasma-typo-body-xxs-font-size);", ":var(--plasma-typo-body-xxs-font-style);", ":var(--plasma-typo-body-xxs-font-weight);", ":var(--plasma-typo-body-xxs-letter-spacing);", ":var(--plasma-typo-body-xxs-line-height);", ":-0.0625rem;", ":0.125rem;", ":0.125rem;", ":-0.0625rem;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight)
|
29
29
|
},
|
30
30
|
pilled: {
|
31
31
|
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":1.25rem;"], _Badge.badgeTokens.pilledBorderRadius)
|
@@ -34,7 +34,7 @@ var config = exports.config = {
|
|
34
34
|
"true": /*#__PURE__*/(0, _styledComponents.css)([""])
|
35
35
|
},
|
36
36
|
clear: {
|
37
|
-
"true": /*#__PURE__*/(0, _styledComponents.css)([""])
|
37
|
+
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--surface-clear);"], _Badge.badgeTokens.backgroundClear)
|
38
38
|
}
|
39
39
|
}
|
40
40
|
};
|
@@ -31,6 +31,10 @@ const meta: Meta<typeof Badge> = {
|
|
31
31
|
control: { type: 'boolean' },
|
32
32
|
if: { arg: 'clear', truthy: false },
|
33
33
|
},
|
34
|
+
text: {
|
35
|
+
control: { type: 'text' },
|
36
|
+
if: { arg: 'enableText', truthy: true },
|
37
|
+
},
|
34
38
|
...disableProps(['contentLeft', 'contentRight']),
|
35
39
|
},
|
36
40
|
};
|
@@ -40,6 +44,7 @@ export default meta;
|
|
40
44
|
type StoryProps = ComponentProps<typeof Badge> & {
|
41
45
|
enableContentLeft: boolean;
|
42
46
|
enableContentRight: boolean;
|
47
|
+
enableText: boolean;
|
43
48
|
};
|
44
49
|
type Story = StoryObj<StoryProps>;
|
45
50
|
|
@@ -60,13 +65,14 @@ export const Default: Story = {
|
|
60
65
|
},
|
61
66
|
enableContentRight: {
|
62
67
|
control: { type: 'boolean' },
|
63
|
-
if: { arg: '
|
68
|
+
if: { arg: 'enableText', truthy: true },
|
64
69
|
},
|
65
70
|
},
|
66
71
|
args: {
|
67
|
-
text: 'Hello',
|
68
72
|
view: 'default',
|
69
73
|
size: 'm',
|
74
|
+
enableText: true,
|
75
|
+
text: 'Hello',
|
70
76
|
enableContentLeft: false,
|
71
77
|
enableContentRight: false,
|
72
78
|
clear: false,
|
package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx
CHANGED
@@ -171,7 +171,6 @@ const StoryDemo = ({ enableContentLeft, enableContentRight, view, ...rest }: Sto
|
|
171
171
|
|
172
172
|
return (
|
173
173
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '2rem', width: '70%', margin: '0 auto' }}>
|
174
|
-
<div>{text}</div>
|
175
174
|
<TextField
|
176
175
|
{...rest}
|
177
176
|
enumerationType="plain"
|
@@ -22,10 +22,10 @@ var config = exports.config = {
|
|
22
22
|
light: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--on-light-text-primary);", ":var(--on-dark-surface-solid-default);", ":var(--on-dark-text-primary);", ":var(--on-dark-surface-transparent-card);", ":var(--on-dark-text-primary);"], _Badge.badgeTokens.color, _Badge.badgeTokens.background, _Badge.badgeTokens.colorTransparent, _Badge.badgeTokens.backgroundTransparent, _Badge.badgeTokens.colorClear)
|
23
23
|
},
|
24
24
|
size: {
|
25
|
-
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.5rem;", ":1.75rem;", ":0.6875rem;", ":0.
|
26
|
-
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.5rem;", ":0.5625rem;", ":0.
|
27
|
-
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.25rem;", ":0.4375rem;", ":0.
|
28
|
-
xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.25rem;", ":1rem;", ":0.25rem;", ":0.
|
25
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.5rem;", ":1.75rem;", ":0 0.6875rem;", ":0 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);", ":-0.0625rem;", ":0.25rem;", ":0.25rem;", ":-0.0625rem;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
26
|
+
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.5rem;", ":0 0.5625rem;", ":0 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);", ":-0.0625rem;", ":0.1875rem;", ":0.1875rem;", ":-0.0625rem;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
27
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.25rem;", ":0 0.4375rem;", ":0 0.25rem;", ":var(--plasma-typo-body-xxs-font-family);", ":var(--plasma-typo-body-xxs-font-size);", ":var(--plasma-typo-body-xxs-font-style);", ":var(--plasma-typo-body-xxs-font-weight);", ":var(--plasma-typo-body-xxs-letter-spacing);", ":var(--plasma-typo-body-xxs-line-height);", ":-0.0625rem;", ":0.125rem;", ":0.125rem;", ":-0.0625rem;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
28
|
+
xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.25rem;", ":1rem;", ":0 0.25rem;", ":0 0.188rem;", ":var(--plasma-typo-body-xxs-font-family);", ":var(--plasma-typo-body-xxs-font-size);", ":var(--plasma-typo-body-xxs-font-style);", ":var(--plasma-typo-body-xxs-font-weight);", ":var(--plasma-typo-body-xxs-letter-spacing);", ":var(--plasma-typo-body-xxs-line-height);", ":-0.0625rem;", ":0.125rem;", ":0.125rem;", ":-0.0625rem;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight)
|
29
29
|
},
|
30
30
|
pilled: {
|
31
31
|
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":1.25rem;"], _Badge.badgeTokens.pilledBorderRadius)
|
@@ -34,7 +34,7 @@ var config = exports.config = {
|
|
34
34
|
"true": /*#__PURE__*/(0, _styledComponents.css)([""])
|
35
35
|
},
|
36
36
|
clear: {
|
37
|
-
"true": /*#__PURE__*/(0, _styledComponents.css)([""])
|
37
|
+
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--surface-clear);"], _Badge.badgeTokens.backgroundClear)
|
38
38
|
}
|
39
39
|
}
|
40
40
|
};
|
@@ -31,6 +31,10 @@ const meta: Meta<typeof Badge> = {
|
|
31
31
|
control: { type: 'boolean' },
|
32
32
|
if: { arg: 'clear', truthy: false },
|
33
33
|
},
|
34
|
+
text: {
|
35
|
+
control: { type: 'text' },
|
36
|
+
if: { arg: 'enableText', truthy: true },
|
37
|
+
},
|
34
38
|
...disableProps(['contentLeft', 'contentRight']),
|
35
39
|
},
|
36
40
|
};
|
@@ -40,6 +44,7 @@ export default meta;
|
|
40
44
|
type StoryProps = ComponentProps<typeof Badge> & {
|
41
45
|
enableContentLeft: boolean;
|
42
46
|
enableContentRight: boolean;
|
47
|
+
enableText: boolean;
|
43
48
|
};
|
44
49
|
type Story = StoryObj<StoryProps>;
|
45
50
|
|
@@ -60,13 +65,14 @@ export const Default: Story = {
|
|
60
65
|
},
|
61
66
|
enableContentRight: {
|
62
67
|
control: { type: 'boolean' },
|
63
|
-
if: { arg: '
|
68
|
+
if: { arg: 'enableText', truthy: true },
|
64
69
|
},
|
65
70
|
},
|
66
71
|
args: {
|
67
|
-
text: 'Hello',
|
68
72
|
view: 'default',
|
69
73
|
size: 'm',
|
74
|
+
enableText: true,
|
75
|
+
text: 'Hello',
|
70
76
|
enableContentLeft: false,
|
71
77
|
enableContentRight: false,
|
72
78
|
clear: false,
|
@@ -1,5 +1,11 @@
|
|
1
|
-
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
var _excluded = ["children", "className", "style", "text", "contentLeft", "contentRight", "size", "view", "customColor", "customBackgroundColor", "pilled", "transparent", "clear"];
|
2
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
3
9
|
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; }
|
4
10
|
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; }
|
5
11
|
import React, { forwardRef } from 'react';
|
@@ -10,16 +16,20 @@ import { base as pilledCSS } from './variations/_pilled/base';
|
|
10
16
|
import { base as transparentCSS } from './variations/_transparent/base';
|
11
17
|
import { base as clearCSS } from './variations/_clear/base';
|
12
18
|
import { StyledContentLeft, StyledContentMain, StyledContentRight, base } from './Badge.styles';
|
13
|
-
import { classes } from './Badge.tokens';
|
19
|
+
import { classes, privateTokens } from './Badge.tokens';
|
14
20
|
export var badgeRoot = function badgeRoot(Root) {
|
15
21
|
return /*#__PURE__*/forwardRef(function (props, ref) {
|
22
|
+
var _StyledContentLeft, _StyledContentMain, _StyledContentMain2, _StyledContentRight;
|
16
23
|
var children = props.children,
|
17
24
|
className = props.className,
|
25
|
+
style = props.style,
|
18
26
|
text = props.text,
|
19
27
|
contentLeft = props.contentLeft,
|
20
28
|
contentRight = props.contentRight,
|
21
29
|
size = props.size,
|
22
30
|
view = props.view,
|
31
|
+
customColor = props.customColor,
|
32
|
+
customBackgroundColor = props.customBackgroundColor,
|
23
33
|
_props$pilled = props.pilled,
|
24
34
|
pilled = _props$pilled === void 0 ? false : _props$pilled,
|
25
35
|
_props$transparent = props.transparent,
|
@@ -31,15 +41,23 @@ export var badgeRoot = function badgeRoot(Root) {
|
|
31
41
|
var transparentClass = transparent ? classes.badgeTransparent : undefined;
|
32
42
|
var clearClass = clear ? classes.badgeClear : undefined;
|
33
43
|
var txt = !text && typeof children === 'string' ? children : text;
|
44
|
+
var iconOnlyClass = !txt && contentLeft ? classes.iconOnly : undefined;
|
45
|
+
var BadgeContent = function BadgeContent() {
|
46
|
+
if (contentLeft) {
|
47
|
+
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);
|
48
|
+
}
|
49
|
+
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))));
|
50
|
+
};
|
34
51
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
35
52
|
ref: ref,
|
36
|
-
className: cx(pilledClass, transparentClass, clearClass, className),
|
53
|
+
className: cx(pilledClass, transparentClass, clearClass, iconOnlyClass, className),
|
37
54
|
view: view,
|
38
55
|
size: size,
|
39
56
|
pilled: pilled,
|
40
57
|
transparent: transparent,
|
41
|
-
clear: clear
|
42
|
-
|
58
|
+
clear: clear,
|
59
|
+
style: _objectSpread(_objectSpread({}, style), {}, _defineProperty(_defineProperty({}, privateTokens.customBackground, customBackgroundColor), privateTokens.customColor, customColor))
|
60
|
+
}, rest), /*#__PURE__*/React.createElement(BadgeContent, null));
|
43
61
|
});
|
44
62
|
};
|
45
63
|
export var badgeConfig = {
|
@@ -1,7 +1,12 @@
|
|
1
1
|
export var classes = {
|
2
2
|
badgePilled: 'badge-pilled',
|
3
3
|
badgeTransparent: 'badge-transparent',
|
4
|
-
badgeClear: 'badge-clear'
|
4
|
+
badgeClear: 'badge-clear',
|
5
|
+
iconOnly: 'badge-icon-only'
|
6
|
+
};
|
7
|
+
export var privateTokens = {
|
8
|
+
customBackground: '--plasma-badge-custom-background',
|
9
|
+
customColor: '--plasma-badge-custom-color'
|
5
10
|
};
|
6
11
|
export var tokens = {
|
7
12
|
background: '--plasma-badge-background',
|
@@ -9,13 +14,12 @@ export var tokens = {
|
|
9
14
|
backgroundTransparent: '--plasma-badge-background-transparent',
|
10
15
|
colorTransparent: '--plasma-badge-color-transparent',
|
11
16
|
colorClear: '--plasma-badge-color-clear',
|
17
|
+
backgroundClear: '--plasma-badge-background-clear',
|
12
18
|
borderRadius: '--plasma-badge-border-radius',
|
13
19
|
pilledBorderRadius: '--plasma-badge-pilled-border-radius',
|
14
20
|
height: '--plasma-badge-height',
|
15
|
-
|
16
|
-
|
17
|
-
paddingBottom: '--plasma-badge-padding-bottom',
|
18
|
-
paddingLeft: '--plasma-badge-padding-left',
|
21
|
+
padding: '--plasma-badge-padding',
|
22
|
+
paddingIconOnly: '--plasma-badge-padding-icon-only',
|
19
23
|
fontFamily: '--plasma-badge-font-family',
|
20
24
|
fontSize: '--plasma-badge-font-size',
|
21
25
|
fontStyle: '--plasma-badge-font-style',
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
|
-
import { classes, tokens } from '../../Badge.tokens';
|
3
|
-
export var base = /*#__PURE__*/css(["&.", "{color:var(", ");background-color:
|
2
|
+
import { classes, privateTokens, tokens } from '../../Badge.tokens';
|
3
|
+
export var base = /*#__PURE__*/css(["&.", "{color:var(", ",var(", "));background-color:var(", ",var(", "));}"], classes.badgeClear, privateTokens.customColor, tokens.colorClear, privateTokens.customBackground, tokens.backgroundClear);
|
@@ -1,3 +1,4 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
|
-
import { tokens } from '../../Badge.tokens';
|
3
|
-
|
2
|
+
import { classes, tokens } from '../../Badge.tokens';
|
3
|
+
import { StyledContentLeft } from '../../Badge.styles';
|
4
|
+
export var base = /*#__PURE__*/css(["font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");border-radius:var(", ");height:var(", ");padding:var(", ");&.", "{padding:var(", ");", "{margin:0;}}"], tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.borderRadius, tokens.height, tokens.padding, classes.iconOnly, tokens.paddingIconOnly, StyledContentLeft);
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
|
-
import { classes, tokens } from '../../Badge.tokens';
|
3
|
-
export var base = /*#__PURE__*/css(["&.", "{color:var(", ");background-color:var(", ");}"], classes.badgeTransparent, tokens.colorTransparent, tokens.backgroundTransparent);
|
2
|
+
import { classes, privateTokens, tokens } from '../../Badge.tokens';
|
3
|
+
export var base = /*#__PURE__*/css(["&.", "{color:var(", ",var(", "));background-color:var(", ",var(", "));}"], classes.badgeTransparent, privateTokens.customColor, tokens.colorTransparent, privateTokens.customBackground, tokens.backgroundTransparent);
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
|
-
import { tokens } from '../../Badge.tokens';
|
3
|
-
export var base = /*#__PURE__*/css(["color:var(", ");background-color:var(", ");"], tokens.color, tokens.background);
|
2
|
+
import { privateTokens, tokens } from '../../Badge.tokens';
|
3
|
+
export var base = /*#__PURE__*/css(["color:var(", ",var(", "));background-color:var(", ",var(", "));"], privateTokens.customColor, tokens.color, privateTokens.customBackground, tokens.background);
|
@@ -13,7 +13,6 @@ import { safeUseId, useForkRef } from '@salutejs/plasma-core';
|
|
13
13
|
import { css } from 'styled-components';
|
14
14
|
import { cx } from '../../utils';
|
15
15
|
import { useOutsideClick } from '../../hooks';
|
16
|
-
import { createEvent } from '../../utils/syntheticEvent';
|
17
16
|
import { base as sizeCSS } from './variations/_size/base';
|
18
17
|
import { base as viewCSS } from './variations/_view/base';
|
19
18
|
import { base as clearCSS } from './variations/_clear/base';
|
@@ -223,21 +222,11 @@ export var textFieldRoot = function textFieldRoot(Root) {
|
|
223
222
|
setChips(newChips);
|
224
223
|
}, [isChipEnumeration, values]);
|
225
224
|
useEffect(function () {
|
226
|
-
console.log('Init Value');
|
227
225
|
setHasValue(Boolean(rest === null || rest === void 0 ? void 0 : rest.defaultValue));
|
228
|
-
var event = createEvent(inputRef);
|
229
|
-
if (event) {
|
230
|
-
handleChange(event);
|
231
|
-
}
|
232
226
|
}, [rest.defaultValue]);
|
233
227
|
useEffect(function () {
|
234
228
|
var _inputRef$current2;
|
235
|
-
console.log('Set Value');
|
236
229
|
setHasValue(Boolean(outerValue) || Boolean(inputRef === null || inputRef === void 0 || (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.value));
|
237
|
-
var event = createEvent(inputRef);
|
238
|
-
if (event) {
|
239
|
-
handleChange(event);
|
240
|
-
}
|
241
230
|
}, [outerValue, inputRef === null || inputRef === void 0 || (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value]);
|
242
231
|
var innerOptional = Boolean(required ? false : optional);
|
243
232
|
var hasPlaceholderOptional = innerOptional && !innerLabelValue && !hasOuterLabel;
|
@@ -16,10 +16,10 @@ export var config = {
|
|
16
16
|
light: /*#__PURE__*/css(["", ":var(--on-light-text-primary);", ":var(--on-dark-surface-solid-default);", ":var(--on-dark-text-primary);", ":var(--on-dark-surface-transparent-card);", ":var(--on-dark-text-primary);"], badgeTokens.color, badgeTokens.background, badgeTokens.colorTransparent, badgeTokens.backgroundTransparent, badgeTokens.colorClear)
|
17
17
|
},
|
18
18
|
size: {
|
19
|
-
l: /*#__PURE__*/css(["", ":0.5rem;", ":1.75rem;", ":0.6875rem;", ":0.
|
20
|
-
m: /*#__PURE__*/css(["", ":0.375rem;", ":1.5rem;", ":0.5625rem;", ":0.
|
21
|
-
s: /*#__PURE__*/css(["", ":0.375rem;", ":1.25rem;", ":0.4375rem;", ":0.
|
22
|
-
xs: /*#__PURE__*/css(["", ":0.25rem;", ":1rem;", ":0.25rem;", ":0.
|
19
|
+
l: /*#__PURE__*/css(["", ":0.5rem;", ":1.75rem;", ":0 0.6875rem;", ":0 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);", ":-0.0625rem;", ":0.25rem;", ":0.25rem;", ":-0.0625rem;"], badgeTokens.borderRadius, badgeTokens.height, badgeTokens.padding, badgeTokens.paddingIconOnly, badgeTokens.fontFamily, badgeTokens.fontSize, badgeTokens.fontStyle, badgeTokens.fontWeight, badgeTokens.letterSpacing, badgeTokens.lineHeight, badgeTokens.leftContentMarginLeft, badgeTokens.leftContentMarginRight, badgeTokens.rightContentMarginLeft, badgeTokens.rightContentMarginRight),
|
20
|
+
m: /*#__PURE__*/css(["", ":0.375rem;", ":1.5rem;", ":0 0.5625rem;", ":0 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);", ":-0.0625rem;", ":0.1875rem;", ":0.1875rem;", ":-0.0625rem;"], badgeTokens.borderRadius, badgeTokens.height, badgeTokens.padding, badgeTokens.paddingIconOnly, badgeTokens.fontFamily, badgeTokens.fontSize, badgeTokens.fontStyle, badgeTokens.fontWeight, badgeTokens.letterSpacing, badgeTokens.lineHeight, badgeTokens.leftContentMarginLeft, badgeTokens.leftContentMarginRight, badgeTokens.rightContentMarginLeft, badgeTokens.rightContentMarginRight),
|
21
|
+
s: /*#__PURE__*/css(["", ":0.375rem;", ":1.25rem;", ":0 0.4375rem;", ":0 0.25rem;", ":var(--plasma-typo-body-xxs-font-family);", ":var(--plasma-typo-body-xxs-font-size);", ":var(--plasma-typo-body-xxs-font-style);", ":var(--plasma-typo-body-xxs-font-weight);", ":var(--plasma-typo-body-xxs-letter-spacing);", ":var(--plasma-typo-body-xxs-line-height);", ":-0.0625rem;", ":0.125rem;", ":0.125rem;", ":-0.0625rem;"], badgeTokens.borderRadius, badgeTokens.height, badgeTokens.padding, badgeTokens.paddingIconOnly, badgeTokens.fontFamily, badgeTokens.fontSize, badgeTokens.fontStyle, badgeTokens.fontWeight, badgeTokens.letterSpacing, badgeTokens.lineHeight, badgeTokens.leftContentMarginLeft, badgeTokens.leftContentMarginRight, badgeTokens.rightContentMarginLeft, badgeTokens.rightContentMarginRight),
|
22
|
+
xs: /*#__PURE__*/css(["", ":0.25rem;", ":1rem;", ":0 0.25rem;", ":0 0.188rem;", ":var(--plasma-typo-body-xxs-font-family);", ":var(--plasma-typo-body-xxs-font-size);", ":var(--plasma-typo-body-xxs-font-style);", ":var(--plasma-typo-body-xxs-font-weight);", ":var(--plasma-typo-body-xxs-letter-spacing);", ":var(--plasma-typo-body-xxs-line-height);", ":-0.0625rem;", ":0.125rem;", ":0.125rem;", ":-0.0625rem;"], badgeTokens.borderRadius, badgeTokens.height, badgeTokens.padding, badgeTokens.paddingIconOnly, badgeTokens.fontFamily, badgeTokens.fontSize, badgeTokens.fontStyle, badgeTokens.fontWeight, badgeTokens.letterSpacing, badgeTokens.lineHeight, badgeTokens.leftContentMarginLeft, badgeTokens.leftContentMarginRight, badgeTokens.rightContentMarginLeft, badgeTokens.rightContentMarginRight)
|
23
23
|
},
|
24
24
|
pilled: {
|
25
25
|
"true": /*#__PURE__*/css(["", ":1.25rem;"], badgeTokens.pilledBorderRadius)
|
@@ -28,7 +28,7 @@ export var config = {
|
|
28
28
|
"true": /*#__PURE__*/css([""])
|
29
29
|
},
|
30
30
|
clear: {
|
31
|
-
"true": /*#__PURE__*/css([""])
|
31
|
+
"true": /*#__PURE__*/css(["", ":var(--surface-clear);"], badgeTokens.backgroundClear)
|
32
32
|
}
|
33
33
|
}
|
34
34
|
};
|
@@ -31,6 +31,10 @@ const meta: Meta<typeof Badge> = {
|
|
31
31
|
control: { type: 'boolean' },
|
32
32
|
if: { arg: 'clear', truthy: false },
|
33
33
|
},
|
34
|
+
text: {
|
35
|
+
control: { type: 'text' },
|
36
|
+
if: { arg: 'enableText', truthy: true },
|
37
|
+
},
|
34
38
|
...disableProps(['contentLeft', 'contentRight']),
|
35
39
|
},
|
36
40
|
};
|
@@ -40,6 +44,7 @@ export default meta;
|
|
40
44
|
type StoryProps = ComponentProps<typeof Badge> & {
|
41
45
|
enableContentLeft: boolean;
|
42
46
|
enableContentRight: boolean;
|
47
|
+
enableText: boolean;
|
43
48
|
};
|
44
49
|
type Story = StoryObj<StoryProps>;
|
45
50
|
|
@@ -60,13 +65,14 @@ export const Default: Story = {
|
|
60
65
|
},
|
61
66
|
enableContentRight: {
|
62
67
|
control: { type: 'boolean' },
|
63
|
-
if: { arg: '
|
68
|
+
if: { arg: 'enableText', truthy: true },
|
64
69
|
},
|
65
70
|
},
|
66
71
|
args: {
|
67
|
-
text: 'Hello',
|
68
72
|
view: 'default',
|
69
73
|
size: 'm',
|
74
|
+
enableText: true,
|
75
|
+
text: 'Hello',
|
70
76
|
enableContentLeft: false,
|
71
77
|
enableContentRight: false,
|
72
78
|
clear: false,
|
@@ -171,7 +171,6 @@ const StoryDemo = ({ enableContentLeft, enableContentRight, view, ...rest }: Sto
|
|
171
171
|
|
172
172
|
return (
|
173
173
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '2rem', width: '70%', margin: '0 auto' }}>
|
174
|
-
<div>{text}</div>
|
175
174
|
<TextField
|
176
175
|
{...rest}
|
177
176
|
enumerationType="plain"
|