@salutejs/plasma-new-hope 0.176.0-canary.1513.11570030354.0 → 0.176.0-canary.1514.11570064677.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. package/cjs/components/Counter/Counter.css +1 -1
  2. package/cjs/components/Counter/Counter.js +12 -3
  3. package/cjs/components/Counter/Counter.js.map +1 -1
  4. package/cjs/components/Counter/Counter.tokens.js +4 -0
  5. package/cjs/components/Counter/Counter.tokens.js.map +1 -1
  6. package/cjs/components/Counter/variations/_size/base.js +1 -1
  7. package/cjs/components/Counter/variations/_size/base.js.map +1 -1
  8. package/cjs/components/Counter/variations/_size/{base_1z0ohiy.css → base_4mz17d.css} +1 -1
  9. package/cjs/index.css +1 -1
  10. package/emotion/cjs/components/Counter/Counter.js +12 -3
  11. package/emotion/cjs/components/Counter/Counter.template-doc.mdx +2 -2
  12. package/emotion/cjs/components/Counter/Counter.tokens.js +4 -1
  13. package/emotion/cjs/components/Counter/variations/_size/base.js +1 -1
  14. package/emotion/cjs/examples/plasma_b2c/components/Counter/Counter.config.js +12 -9
  15. package/emotion/cjs/examples/plasma_b2c/components/Counter/Counter.stories.tsx +7 -5
  16. package/emotion/cjs/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +6 -9
  17. package/emotion/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +6 -10
  18. package/emotion/cjs/examples/plasma_web/components/Counter/Counter.config.js +12 -9
  19. package/emotion/cjs/examples/plasma_web/components/Counter/Counter.stories.tsx +7 -5
  20. package/emotion/cjs/examples/plasma_web/components/TextArea/TextArea.stories.tsx +6 -9
  21. package/emotion/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +6 -10
  22. package/emotion/es/components/Counter/Counter.js +12 -3
  23. package/emotion/es/components/Counter/Counter.template-doc.mdx +2 -2
  24. package/emotion/es/components/Counter/Counter.tokens.js +3 -0
  25. package/emotion/es/components/Counter/variations/_size/base.js +2 -2
  26. package/emotion/es/examples/plasma_b2c/components/Counter/Counter.config.js +12 -9
  27. package/emotion/es/examples/plasma_b2c/components/Counter/Counter.stories.tsx +7 -5
  28. package/emotion/es/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +6 -9
  29. package/emotion/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +6 -10
  30. package/emotion/es/examples/plasma_web/components/Counter/Counter.config.js +12 -9
  31. package/emotion/es/examples/plasma_web/components/Counter/Counter.stories.tsx +7 -5
  32. package/emotion/es/examples/plasma_web/components/TextArea/TextArea.stories.tsx +6 -9
  33. package/emotion/es/examples/plasma_web/components/TextField/TextField.stories.tsx +6 -10
  34. package/es/components/Counter/Counter.css +1 -1
  35. package/es/components/Counter/Counter.js +12 -3
  36. package/es/components/Counter/Counter.js.map +1 -1
  37. package/es/components/Counter/Counter.tokens.js +4 -1
  38. package/es/components/Counter/Counter.tokens.js.map +1 -1
  39. package/es/components/Counter/variations/_size/base.js +1 -1
  40. package/es/components/Counter/variations/_size/base.js.map +1 -1
  41. package/es/components/Counter/variations/_size/{base_1z0ohiy.css → base_4mz17d.css} +1 -1
  42. package/es/index.css +1 -1
  43. package/package.json +2 -2
  44. package/styled-components/cjs/components/Counter/Counter.js +12 -3
  45. package/styled-components/cjs/components/Counter/Counter.template-doc.mdx +2 -2
  46. package/styled-components/cjs/components/Counter/Counter.tokens.js +4 -1
  47. package/styled-components/cjs/components/Counter/variations/_size/base.js +1 -1
  48. package/styled-components/cjs/examples/plasma_b2c/components/Counter/Counter.config.js +5 -2
  49. package/styled-components/cjs/examples/plasma_b2c/components/Counter/Counter.stories.tsx +7 -5
  50. package/styled-components/cjs/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +6 -9
  51. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +6 -10
  52. package/styled-components/cjs/examples/plasma_web/components/Counter/Counter.config.js +5 -2
  53. package/styled-components/cjs/examples/plasma_web/components/Counter/Counter.stories.tsx +7 -5
  54. package/styled-components/cjs/examples/plasma_web/components/TextArea/TextArea.stories.tsx +6 -9
  55. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +6 -10
  56. package/styled-components/es/components/Counter/Counter.js +12 -3
  57. package/styled-components/es/components/Counter/Counter.template-doc.mdx +2 -2
  58. package/styled-components/es/components/Counter/Counter.tokens.js +3 -0
  59. package/styled-components/es/components/Counter/variations/_size/base.js +2 -2
  60. package/styled-components/es/examples/plasma_b2c/components/Counter/Counter.config.js +5 -2
  61. package/styled-components/es/examples/plasma_b2c/components/Counter/Counter.stories.tsx +7 -5
  62. package/styled-components/es/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +6 -9
  63. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +6 -10
  64. package/styled-components/es/examples/plasma_web/components/Counter/Counter.config.js +5 -2
  65. package/styled-components/es/examples/plasma_web/components/Counter/Counter.stories.tsx +7 -5
  66. package/styled-components/es/examples/plasma_web/components/TextArea/TextArea.stories.tsx +6 -9
  67. package/styled-components/es/examples/plasma_web/components/TextField/TextField.stories.tsx +6 -10
  68. package/types/components/Counter/Counter.d.ts.map +1 -1
  69. package/types/components/Counter/Counter.tokens.d.ts +3 -0
  70. package/types/components/Counter/Counter.tokens.d.ts.map +1 -1
  71. package/types/components/Counter/Counter.types.d.ts +2 -2
  72. package/types/components/Counter/variations/_size/base.d.ts.map +1 -1
  73. package/types/examples/plasma_b2c/components/Counter/Counter.config.d.ts +3 -0
  74. package/types/examples/plasma_b2c/components/Counter/Counter.config.d.ts.map +1 -1
  75. package/types/examples/plasma_b2c/components/Counter/Counter.d.ts +3 -0
  76. package/types/examples/plasma_b2c/components/Counter/Counter.d.ts.map +1 -1
  77. package/types/examples/plasma_web/components/Counter/Counter.config.d.ts +3 -0
  78. package/types/examples/plasma_web/components/Counter/Counter.config.d.ts.map +1 -1
  79. package/types/examples/plasma_web/components/Counter/Counter.d.ts +3 -0
  80. package/types/examples/plasma_web/components/Counter/Counter.d.ts.map +1 -1
@@ -37,7 +37,6 @@ const placements: Array<PopoverPlacement> = [
37
37
  ];
38
38
 
39
39
  type StoryTextAreaPropsCustom = {
40
- hasHint?: boolean;
41
40
  enableContentRight?: boolean;
42
41
  };
43
42
 
@@ -93,44 +92,43 @@ const meta: Meta<StoryTextAreaProps> = {
93
92
  },
94
93
  hintText: {
95
94
  control: { type: 'text' },
96
- if: { arg: 'hasHint', truthy: true },
97
95
  },
98
96
  hintView: {
99
97
  options: hintViews,
100
98
  control: {
101
99
  type: 'select',
102
100
  },
103
- if: { arg: 'hasHint', truthy: true },
101
+ if: { arg: 'hintText', neq: '' },
104
102
  },
105
103
  hintSize: {
106
104
  options: hintSizes,
107
105
  control: {
108
106
  type: 'select',
109
107
  },
110
- if: { arg: 'hasHint', truthy: true },
108
+ if: { arg: 'hintText', neq: '' },
111
109
  },
112
110
  hintTrigger: {
113
111
  options: hintTriggers,
114
112
  control: {
115
113
  type: 'inline-radio',
116
114
  },
117
- if: { arg: 'hasHint', truthy: true },
115
+ if: { arg: 'hintText', neq: '' },
118
116
  },
119
117
  hintPlacement: {
120
118
  options: placements,
121
119
  control: {
122
120
  type: 'select',
123
121
  },
124
- if: { arg: 'hasHint', truthy: true },
122
+ if: { arg: 'hintText', neq: '' },
125
123
  mappers: placements,
126
124
  },
127
125
  hintHasArrow: {
128
126
  control: { type: 'boolean' },
129
- if: { arg: 'hasHint', truthy: true },
127
+ if: { arg: 'hintText', neq: '' },
130
128
  },
131
129
  hintWidth: {
132
130
  control: { type: 'text' },
133
- if: { arg: 'hasHint', truthy: true },
131
+ if: { arg: 'hintText', neq: '' },
134
132
  },
135
133
  },
136
134
  args: {
@@ -154,7 +152,6 @@ const meta: Meta<StoryTextAreaProps> = {
154
152
  requiredPlacement: 'right',
155
153
  clear: false,
156
154
  hasDivider: false,
157
- hasHint: true,
158
155
  hintText: 'Текст подсказки',
159
156
  hintTrigger: 'hover',
160
157
  hintView: 'default',
@@ -95,44 +95,43 @@ const meta: Meta<typeof TextField> = {
95
95
  },
96
96
  hintText: {
97
97
  control: { type: 'text' },
98
- if: { arg: 'hasHint', truthy: true },
99
98
  },
100
99
  hintView: {
101
100
  options: hintViews,
102
101
  control: {
103
102
  type: 'select',
104
103
  },
105
- if: { arg: 'hasHint', truthy: true },
104
+ if: { arg: 'hintText', neq: '' },
106
105
  },
107
106
  hintSize: {
108
107
  options: hintSizes,
109
108
  control: {
110
109
  type: 'select',
111
110
  },
112
- if: { arg: 'hasHint', truthy: true },
111
+ if: { arg: 'hintText', neq: '' },
113
112
  },
114
113
  hintTrigger: {
115
114
  options: hintTriggers,
116
115
  control: {
117
116
  type: 'inline-radio',
118
117
  },
119
- if: { arg: 'hasHint', truthy: true },
118
+ if: { arg: 'hintText', neq: '' },
120
119
  },
121
120
  hintPlacement: {
122
121
  options: placements,
123
122
  control: {
124
123
  type: 'select',
125
124
  },
126
- if: { arg: 'hasHint', truthy: true },
125
+ if: { arg: 'hintText', neq: '' },
127
126
  mappers: placements,
128
127
  },
129
128
  hintHasArrow: {
130
129
  control: { type: 'boolean' },
131
- if: { arg: 'hasHint', truthy: true },
130
+ if: { arg: 'hintText', neq: '' },
132
131
  },
133
132
  hintWidth: {
134
133
  control: { type: 'text' },
135
- if: { arg: 'hasHint', truthy: true },
134
+ if: { arg: 'hintText', neq: '' },
136
135
  },
137
136
  },
138
137
  };
@@ -159,7 +158,6 @@ type StoryPropsDefault = Omit<
159
158
  | 'chips'
160
159
  | 'onChangeChips'
161
160
  > & {
162
- hasHint: boolean;
163
161
  enableContentLeft: boolean;
164
162
  enableContentRight: boolean;
165
163
  };
@@ -224,7 +222,6 @@ export const Default: StoryObj<StoryPropsDefault> = {
224
222
  optional: false,
225
223
  required: false,
226
224
  requiredPlacement: 'right',
227
- hasHint: true,
228
225
  hintText: 'Текст подсказки',
229
226
  hintTrigger: 'hover',
230
227
  hintView: 'default',
@@ -254,7 +251,6 @@ type StoryPropsChips = Omit<
254
251
  | 'minLength'
255
252
  | 'enumerationType'
256
253
  > & {
257
- hasHint: boolean;
258
254
  enableContentLeft: boolean;
259
255
  enableContentRight: boolean;
260
256
  };
@@ -1,24 +1,33 @@
1
- var _excluded = ["count", "maxCount", "size", "view"];
1
+ var _excluded = ["count", "maxCount", "size", "view", "className"];
2
2
  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); }
3
3
  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
4
  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
5
  import React, { forwardRef } from 'react';
6
+ import { cx } from '../../utils';
6
7
  import { base as viewCSS } from './variations/_view/base';
7
8
  import { base as sizeCSS } from './variations/_size/base';
8
9
  import { base } from './Counter.styles';
10
+ import { classes } from './Counter.tokens';
11
+ var MIN_COUNT = 1;
9
12
  export var counterRoot = function counterRoot(Root) {
10
13
  return /*#__PURE__*/forwardRef(function (props, ref) {
11
14
  var count = props.count,
12
15
  maxCount = props.maxCount,
13
16
  size = props.size,
14
17
  view = props.view,
18
+ className = props.className,
15
19
  rest = _objectWithoutProperties(props, _excluded);
16
- var content = maxCount && count > maxCount ? "".concat(maxCount, "+") : count;
20
+ var currCount = count < MIN_COUNT ? MIN_COUNT : count;
21
+ var currMaxCount = maxCount && maxCount < MIN_COUNT ? MIN_COUNT : maxCount;
22
+ var currMaxCountExceeded = currMaxCount && currCount > currMaxCount;
23
+ var content = currMaxCountExceeded ? "".concat(currMaxCount, "+") : currCount;
24
+ var roundClass = !currMaxCountExceeded && currCount >= 0 && currCount < 10 ? classes.round : undefined;
17
25
  return /*#__PURE__*/React.createElement(Root, _extends({
18
26
  ref: ref,
19
27
  view: view,
20
28
  size: size,
21
- count: count
29
+ count: count,
30
+ className: cx(roundClass, className)
22
31
  }, rest), content);
23
32
  });
24
33
  };
@@ -12,7 +12,7 @@ import { PropsTable, Description } from '@site/src/components';
12
12
  ## Примеры
13
13
 
14
14
  ### Максимальное значение числового badge
15
- Задается с помощью свойства `maxCount`.
15
+ Задается с помощью свойства `maxCount`. Как и `count`, не может быть меньше 1.
16
16
 
17
17
  ```tsx live
18
18
  import React from 'react';
@@ -29,7 +29,7 @@ export function App() {
29
29
  ```
30
30
 
31
31
  ### Размер числового badge
32
- Размер задается с помощью свойства `size`. Возможные значения свойства: `"xs"` или `"xxs"`.
32
+ Размер задается с помощью свойства `size`. Возможные значения свойства: `xxs`, `xs`, `s`, `m`, `l`.
33
33
 
34
34
  ```tsx live
35
35
  import React from 'react';
@@ -1,3 +1,6 @@
1
+ export var classes = {
2
+ round: '--plasma-counter-round'
3
+ };
1
4
  export var tokens = {
2
5
  background: '--plasma-counter-background',
3
6
  color: '--plasma-counter-color',
@@ -1,3 +1,3 @@
1
1
  import { css } from 'styled-components';
2
- import { tokens } from '../../Counter.tokens';
3
- 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-top:var(", ");padding-right:var(", ");padding-bottom:var(", ");padding-left:var(", ");"], tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.borderRadius, tokens.height, tokens.paddingTop, tokens.paddingRight, tokens.paddingBottom, tokens.paddingLeft);
2
+ import { classes, tokens } from '../../Counter.tokens';
3
+ 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-top:var(", ");padding-right:var(", ");padding-bottom:var(", ");padding-left:var(", ");&.", "{width:var(", ");}"], tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.borderRadius, tokens.height, tokens.paddingTop, tokens.paddingRight, tokens.paddingBottom, tokens.paddingLeft, classes.round, tokens.height);
@@ -16,8 +16,11 @@ export var config = {
16
16
  light: /*#__PURE__*/css(["", ":var(--on-light-text-primary);", ":var(--on-dark-surface-solid-default);"], counterTokens.color, counterTokens.background)
17
17
  },
18
18
  size: {
19
- xs: /*#__PURE__*/css(["", ":0.5rem;", ":1rem;", ":0.25rem;", ":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);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight),
20
- xxs: /*#__PURE__*/css(["", ":0.5rem;", ":0.75rem;", ":0.25rem;", ":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);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight)
19
+ l: /*#__PURE__*/css(["", ":1rem;", ":1.75rem;", ":0.625rem;", ":0.625rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight),
20
+ m: /*#__PURE__*/css(["", ":1rem;", ":1.5rem;", ":0.5rem;", ":0.5rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight),
21
+ s: /*#__PURE__*/css(["", ":1rem;", ":1.25rem;", ":0.375rem;", ":0.375rem;", ":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);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight),
22
+ xs: /*#__PURE__*/css(["", ":1rem;", ":1rem;", ":0.25rem;", ":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);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight),
23
+ xxs: /*#__PURE__*/css(["", ":1rem;", ":0.75rem;", ":0.125rem;", ":0.125rem;", ":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);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight)
21
24
  }
22
25
  }
23
26
  };
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { disableProps } from '@salutejs/plasma-sb-utils';
3
2
  import type { StoryObj, Meta } from '@storybook/react';
4
3
 
@@ -6,19 +5,22 @@ import { WithTheme } from '../../../_helpers';
6
5
 
7
6
  import { Counter } from './Counter';
8
7
 
8
+ const sizes = ['l', 'm', 's', 'xs', 'xxs'];
9
+ const views = ['default', 'accent', 'positive', 'warning', 'negative', 'dark', 'light'];
10
+
9
11
  const meta: Meta<typeof Counter> = {
10
12
  title: 'plasma_b2c/Counter',
11
13
  component: Counter,
12
14
  decorators: [WithTheme],
13
15
  argTypes: {
14
16
  size: {
15
- options: ['xs', 'xxs'],
17
+ options: sizes,
16
18
  control: {
17
19
  type: 'select',
18
20
  },
19
21
  },
20
22
  view: {
21
- options: ['default', 'accent', 'positive', 'warning', 'negative', 'dark', 'light'],
23
+ options: views,
22
24
  control: {
23
25
  type: 'select',
24
26
  },
@@ -33,8 +35,8 @@ type Story = StoryObj<typeof Counter>;
33
35
 
34
36
  export const Default: Story = {
35
37
  args: {
36
- count: 25,
37
- maxCount: 100,
38
+ count: 123,
39
+ maxCount: 200,
38
40
  view: 'default',
39
41
  size: 'xs',
40
42
  },
@@ -37,7 +37,6 @@ const placements: Array<PopoverPlacement> = [
37
37
  ];
38
38
 
39
39
  type StoryTextAreaPropsCustom = {
40
- hasHint?: boolean;
41
40
  enableContentRight?: boolean;
42
41
  };
43
42
 
@@ -93,44 +92,43 @@ const meta: Meta<StoryTextAreaProps> = {
93
92
  },
94
93
  hintText: {
95
94
  control: { type: 'text' },
96
- if: { arg: 'hasHint', truthy: true },
97
95
  },
98
96
  hintView: {
99
97
  options: hintViews,
100
98
  control: {
101
99
  type: 'select',
102
100
  },
103
- if: { arg: 'hasHint', truthy: true },
101
+ if: { arg: 'hintText', neq: '' },
104
102
  },
105
103
  hintSize: {
106
104
  options: hintSizes,
107
105
  control: {
108
106
  type: 'select',
109
107
  },
110
- if: { arg: 'hasHint', truthy: true },
108
+ if: { arg: 'hintText', neq: '' },
111
109
  },
112
110
  hintTrigger: {
113
111
  options: hintTriggers,
114
112
  control: {
115
113
  type: 'inline-radio',
116
114
  },
117
- if: { arg: 'hasHint', truthy: true },
115
+ if: { arg: 'hintText', neq: '' },
118
116
  },
119
117
  hintPlacement: {
120
118
  options: placements,
121
119
  control: {
122
120
  type: 'select',
123
121
  },
124
- if: { arg: 'hasHint', truthy: true },
122
+ if: { arg: 'hintText', neq: '' },
125
123
  mappers: placements,
126
124
  },
127
125
  hintHasArrow: {
128
126
  control: { type: 'boolean' },
129
- if: { arg: 'hasHint', truthy: true },
127
+ if: { arg: 'hintText', neq: '' },
130
128
  },
131
129
  hintWidth: {
132
130
  control: { type: 'text' },
133
- if: { arg: 'hasHint', truthy: true },
131
+ if: { arg: 'hintText', neq: '' },
134
132
  },
135
133
  },
136
134
  args: {
@@ -154,7 +152,6 @@ const meta: Meta<StoryTextAreaProps> = {
154
152
  requiredPlacement: 'right',
155
153
  clear: false,
156
154
  hasDivider: false,
157
- hasHint: true,
158
155
  hintText: 'Текст подсказки',
159
156
  hintTrigger: 'hover',
160
157
  hintView: 'default',
@@ -95,44 +95,43 @@ const meta: Meta<typeof TextField> = {
95
95
  },
96
96
  hintText: {
97
97
  control: { type: 'text' },
98
- if: { arg: 'hasHint', truthy: true },
99
98
  },
100
99
  hintView: {
101
100
  options: hintViews,
102
101
  control: {
103
102
  type: 'select',
104
103
  },
105
- if: { arg: 'hasHint', truthy: true },
104
+ if: { arg: 'hintText', neq: '' },
106
105
  },
107
106
  hintSize: {
108
107
  options: hintSizes,
109
108
  control: {
110
109
  type: 'select',
111
110
  },
112
- if: { arg: 'hasHint', truthy: true },
111
+ if: { arg: 'hintText', neq: '' },
113
112
  },
114
113
  hintTrigger: {
115
114
  options: hintTriggers,
116
115
  control: {
117
116
  type: 'inline-radio',
118
117
  },
119
- if: { arg: 'hasHint', truthy: true },
118
+ if: { arg: 'hintText', neq: '' },
120
119
  },
121
120
  hintPlacement: {
122
121
  options: placements,
123
122
  control: {
124
123
  type: 'select',
125
124
  },
126
- if: { arg: 'hasHint', truthy: true },
125
+ if: { arg: 'hintText', neq: '' },
127
126
  mappers: placements,
128
127
  },
129
128
  hintHasArrow: {
130
129
  control: { type: 'boolean' },
131
- if: { arg: 'hasHint', truthy: true },
130
+ if: { arg: 'hintText', neq: '' },
132
131
  },
133
132
  hintWidth: {
134
133
  control: { type: 'text' },
135
- if: { arg: 'hasHint', truthy: true },
134
+ if: { arg: 'hintText', neq: '' },
136
135
  },
137
136
  },
138
137
  };
@@ -159,7 +158,6 @@ type StoryPropsDefault = Omit<
159
158
  | 'chips'
160
159
  | 'onChangeChips'
161
160
  > & {
162
- hasHint: boolean;
163
161
  enableContentLeft: boolean;
164
162
  enableContentRight: boolean;
165
163
  };
@@ -224,7 +222,6 @@ export const Default: StoryObj<StoryPropsDefault> = {
224
222
  requiredPlacement: 'right',
225
223
  clear: false,
226
224
  hasDivider: false,
227
- hasHint: true,
228
225
  hintText: 'Текст подсказки',
229
226
  hintTrigger: 'hover',
230
227
  hintView: 'default',
@@ -254,7 +251,6 @@ type StoryPropsChips = Omit<
254
251
  | 'minLength'
255
252
  | 'enumerationType'
256
253
  > & {
257
- hasHint: boolean;
258
254
  enableContentLeft: boolean;
259
255
  enableContentRight: boolean;
260
256
  };
@@ -16,8 +16,11 @@ export var config = {
16
16
  light: /*#__PURE__*/css(["", ":var(--on-light-text-primary);", ":var(--on-dark-surface-solid-default);"], counterTokens.color, counterTokens.background)
17
17
  },
18
18
  size: {
19
- xs: /*#__PURE__*/css(["", ":0.5rem;", ":1rem;", ":0.25rem;", ":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);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight),
20
- xxs: /*#__PURE__*/css(["", ":0.5rem;", ":0.75rem;", ":0.25rem;", ":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);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight)
19
+ l: /*#__PURE__*/css(["", ":1rem;", ":1.75rem;", ":0.625rem;", ":0.625rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight),
20
+ m: /*#__PURE__*/css(["", ":1rem;", ":1.5rem;", ":0.5rem;", ":0.5rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight),
21
+ s: /*#__PURE__*/css(["", ":1rem;", ":1.25rem;", ":0.375rem;", ":0.375rem;", ":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);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight),
22
+ xs: /*#__PURE__*/css(["", ":1rem;", ":1rem;", ":0.25rem;", ":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);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight),
23
+ xxs: /*#__PURE__*/css(["", ":1rem;", ":0.75rem;", ":0.125rem;", ":0.125rem;", ":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);"], counterTokens.borderRadius, counterTokens.height, counterTokens.paddingRight, counterTokens.paddingLeft, counterTokens.fontFamily, counterTokens.fontSize, counterTokens.fontStyle, counterTokens.fontWeight, counterTokens.letterSpacing, counterTokens.lineHeight)
21
24
  }
22
25
  }
23
26
  };
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { disableProps } from '@salutejs/plasma-sb-utils';
3
2
  import type { StoryObj, Meta } from '@storybook/react';
4
3
 
@@ -6,19 +5,22 @@ import { WithTheme } from '../../../_helpers';
6
5
 
7
6
  import { Counter } from './Counter';
8
7
 
8
+ const sizes = ['l', 'm', 's', 'xs', 'xxs'];
9
+ const views = ['default', 'accent', 'positive', 'warning', 'negative', 'dark', 'light'];
10
+
9
11
  const meta: Meta<typeof Counter> = {
10
12
  title: 'plasma_web/Counter',
11
13
  component: Counter,
12
14
  decorators: [WithTheme],
13
15
  argTypes: {
14
16
  size: {
15
- options: ['xs', 'xxs'],
17
+ options: sizes,
16
18
  control: {
17
19
  type: 'select',
18
20
  },
19
21
  },
20
22
  view: {
21
- options: ['default', 'accent', 'positive', 'warning', 'negative', 'dark', 'light'],
23
+ options: views,
22
24
  control: {
23
25
  type: 'select',
24
26
  },
@@ -33,8 +35,8 @@ type Story = StoryObj<typeof Counter>;
33
35
 
34
36
  export const Default: Story = {
35
37
  args: {
36
- count: 25,
37
- maxCount: 100,
38
+ count: 123,
39
+ maxCount: 200,
38
40
  view: 'default',
39
41
  size: 'xs',
40
42
  },
@@ -37,7 +37,6 @@ const placements: Array<PopoverPlacement> = [
37
37
  ];
38
38
 
39
39
  type StoryTextAreaPropsCustom = {
40
- hasHint?: boolean;
41
40
  enableContentRight?: boolean;
42
41
  };
43
42
 
@@ -93,44 +92,43 @@ const meta: Meta<StoryTextAreaProps> = {
93
92
  },
94
93
  hintText: {
95
94
  control: { type: 'text' },
96
- if: { arg: 'hasHint', truthy: true },
97
95
  },
98
96
  hintView: {
99
97
  options: hintViews,
100
98
  control: {
101
99
  type: 'select',
102
100
  },
103
- if: { arg: 'hasHint', truthy: true },
101
+ if: { arg: 'hintText', neq: '' },
104
102
  },
105
103
  hintSize: {
106
104
  options: hintSizes,
107
105
  control: {
108
106
  type: 'select',
109
107
  },
110
- if: { arg: 'hasHint', truthy: true },
108
+ if: { arg: 'hintText', neq: '' },
111
109
  },
112
110
  hintTrigger: {
113
111
  options: hintTriggers,
114
112
  control: {
115
113
  type: 'inline-radio',
116
114
  },
117
- if: { arg: 'hasHint', truthy: true },
115
+ if: { arg: 'hintText', neq: '' },
118
116
  },
119
117
  hintPlacement: {
120
118
  options: placements,
121
119
  control: {
122
120
  type: 'select',
123
121
  },
124
- if: { arg: 'hasHint', truthy: true },
122
+ if: { arg: 'hintText', neq: '' },
125
123
  mappers: placements,
126
124
  },
127
125
  hintHasArrow: {
128
126
  control: { type: 'boolean' },
129
- if: { arg: 'hasHint', truthy: true },
127
+ if: { arg: 'hintText', neq: '' },
130
128
  },
131
129
  hintWidth: {
132
130
  control: { type: 'text' },
133
- if: { arg: 'hasHint', truthy: true },
131
+ if: { arg: 'hintText', neq: '' },
134
132
  },
135
133
  },
136
134
  args: {
@@ -154,7 +152,6 @@ const meta: Meta<StoryTextAreaProps> = {
154
152
  requiredPlacement: 'right',
155
153
  clear: false,
156
154
  hasDivider: false,
157
- hasHint: true,
158
155
  hintText: 'Текст подсказки',
159
156
  hintTrigger: 'hover',
160
157
  hintView: 'default',
@@ -95,44 +95,43 @@ const meta: Meta<typeof TextField> = {
95
95
  },
96
96
  hintText: {
97
97
  control: { type: 'text' },
98
- if: { arg: 'hasHint', truthy: true },
99
98
  },
100
99
  hintView: {
101
100
  options: hintViews,
102
101
  control: {
103
102
  type: 'select',
104
103
  },
105
- if: { arg: 'hasHint', truthy: true },
104
+ if: { arg: 'hintText', neq: '' },
106
105
  },
107
106
  hintSize: {
108
107
  options: hintSizes,
109
108
  control: {
110
109
  type: 'select',
111
110
  },
112
- if: { arg: 'hasHint', truthy: true },
111
+ if: { arg: 'hintText', neq: '' },
113
112
  },
114
113
  hintTrigger: {
115
114
  options: hintTriggers,
116
115
  control: {
117
116
  type: 'inline-radio',
118
117
  },
119
- if: { arg: 'hasHint', truthy: true },
118
+ if: { arg: 'hintText', neq: '' },
120
119
  },
121
120
  hintPlacement: {
122
121
  options: placements,
123
122
  control: {
124
123
  type: 'select',
125
124
  },
126
- if: { arg: 'hasHint', truthy: true },
125
+ if: { arg: 'hintText', neq: '' },
127
126
  mappers: placements,
128
127
  },
129
128
  hintHasArrow: {
130
129
  control: { type: 'boolean' },
131
- if: { arg: 'hasHint', truthy: true },
130
+ if: { arg: 'hintText', neq: '' },
132
131
  },
133
132
  hintWidth: {
134
133
  control: { type: 'text' },
135
- if: { arg: 'hasHint', truthy: true },
134
+ if: { arg: 'hintText', neq: '' },
136
135
  },
137
136
  },
138
137
  };
@@ -159,7 +158,6 @@ type StoryPropsDefault = Omit<
159
158
  | 'chips'
160
159
  | 'onChangeChips'
161
160
  > & {
162
- hasHint: boolean;
163
161
  enableContentLeft: boolean;
164
162
  enableContentRight: boolean;
165
163
  };
@@ -224,7 +222,6 @@ export const Default: StoryObj<StoryPropsDefault> = {
224
222
  optional: false,
225
223
  required: false,
226
224
  requiredPlacement: 'right',
227
- hasHint: true,
228
225
  hintText: 'Текст подсказки',
229
226
  hintTrigger: 'hover',
230
227
  hintView: 'default',
@@ -254,7 +251,6 @@ type StoryPropsChips = Omit<
254
251
  | 'minLength'
255
252
  | 'enumerationType'
256
253
  > & {
257
- hasHint: boolean;
258
254
  enableContentLeft: boolean;
259
255
  enableContentRight: boolean;
260
256
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Counter.d.ts","sourceRoot":"","sources":["../../../src/components/Counter/Counter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,eAAO,MAAM,WAAW,SAAU,UAAU,cAAc,EAAE,YAAY,CAAC;;;;;wCAWnE,CAAC;AAEP,eAAO,MAAM,aAAa;;;mBAbQ,UAAU,cAAc,EAAE,YAAY,CAAC;;;;;;;;;;;;;;;;;;;CA8BxE,CAAC"}
1
+ {"version":3,"file":"Counter.d.ts","sourceRoot":"","sources":["../../../src/components/Counter/Counter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD,eAAO,MAAM,WAAW,SAAU,UAAU,cAAc,EAAE,YAAY,CAAC;;;;;wCAiBnE,CAAC;AAEP,eAAO,MAAM,aAAa;;;mBAnBQ,UAAU,cAAc,EAAE,YAAY,CAAC;;;;;;;;;;;;;;;;;;;CAoCxE,CAAC"}
@@ -1,3 +1,6 @@
1
+ export declare const classes: {
2
+ round: string;
3
+ };
1
4
  export declare const tokens: {
2
5
  background: string;
3
6
  color: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Counter.tokens.d.ts","sourceRoot":"","sources":["../../../src/components/Counter/Counter.tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;CAiBlB,CAAC"}
1
+ {"version":3,"file":"Counter.tokens.d.ts","sourceRoot":"","sources":["../../../src/components/Counter/Counter.tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;CAEnB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;CAiBlB,CAAC"}