@skbkontur/react-ui 5.3.1 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -6
  3. package/cjs/components/Autocomplete/Autocomplete.md +0 -113
  4. package/cjs/components/Button/Button.md +0 -261
  5. package/cjs/components/Calendar/Calendar.md +0 -276
  6. package/cjs/components/Calendar/CalendarDay.md +0 -70
  7. package/cjs/components/Center/Center.md +0 -26
  8. package/cjs/components/Checkbox/Checkbox.md +0 -171
  9. package/cjs/components/ComboBox/ComboBox.md +0 -574
  10. package/cjs/components/CurrencyInput/CurrencyInput.md +0 -39
  11. package/cjs/components/CurrencyLabel/CurrencyLabel.md +0 -29
  12. package/cjs/components/DateInput/DateInput.md +0 -111
  13. package/cjs/components/DatePicker/DatePicker.md +0 -368
  14. package/cjs/components/Dropdown/Dropdown.md +0 -45
  15. package/cjs/components/DropdownMenu/DropdownMenu.md +0 -290
  16. package/cjs/components/FileUploader/FileUploader.md +0 -131
  17. package/cjs/components/FxInput/FxInput.md +0 -31
  18. package/cjs/components/Gapped/Gapped.md +0 -44
  19. package/cjs/components/GlobalLoader/GlobalLoader.md +0 -97
  20. package/cjs/components/Group/Group.md +0 -19
  21. package/cjs/components/Hint/Hint.md +0 -86
  22. package/cjs/components/Input/Input.md +0 -86
  23. package/cjs/components/Kebab/Kebab.md +0 -306
  24. package/cjs/components/Link/Link.md +0 -182
  25. package/cjs/components/Loader/Loader.md +0 -33
  26. package/cjs/components/MaskedInput/MaskedInput.md +0 -114
  27. package/cjs/components/MenuFooter/MenuFooter.md +0 -27
  28. package/cjs/components/MenuHeader/MenuHeader.md +0 -35
  29. package/cjs/components/MenuItem/MenuItem.md +0 -139
  30. package/cjs/components/MenuSeparator/MenuSeparator.md +0 -14
  31. package/cjs/components/MiniModal/MiniModal.md +0 -231
  32. package/cjs/components/Modal/Modal.md +0 -56
  33. package/cjs/components/Paging/Paging.md +0 -57
  34. package/cjs/components/PasswordInput/PasswordInput.md +0 -29
  35. package/cjs/components/Radio/Radio.md +0 -57
  36. package/cjs/components/RadioGroup/RadioGroup.md +0 -44
  37. package/cjs/components/ResponsiveLayout/ResponsiveLayout.md +0 -75
  38. package/cjs/components/ScrollContainer/ScrollContainer.md +0 -224
  39. package/cjs/components/Select/Select.md +0 -113
  40. package/cjs/components/SidePage/SidePage.md +0 -65
  41. package/cjs/components/SingleToast/SingleToast.md +0 -36
  42. package/cjs/components/Spinner/Spinner.md +0 -36
  43. package/cjs/components/Sticky/Sticky.md +0 -28
  44. package/cjs/components/Switcher/Switcher.md +0 -111
  45. package/cjs/components/Tabs/Tab.md +0 -73
  46. package/cjs/components/Tabs/Tabs.md +0 -54
  47. package/cjs/components/Textarea/Textarea.md +0 -58
  48. package/cjs/components/Toast/Toast.md +0 -69
  49. package/cjs/components/Toggle/Toggle.md +0 -110
  50. package/cjs/components/Token/Token.md +0 -48
  51. package/cjs/components/TokenInput/TokenInput.md +0 -277
  52. package/cjs/components/Tooltip/Tooltip.md +0 -322
  53. package/cjs/components/TooltipMenu/TooltipMenu.md +0 -241
  54. package/cjs/internal/DataTids/DATATIDS.md +0 -12
  55. package/cjs/internal/DataTids/DataTids.d.ts +0 -12
  56. package/cjs/internal/DataTids/DataTids.js +0 -50
  57. package/cjs/internal/DataTids/DataTids.js.map +0 -1
  58. package/cjs/internal/DataTids/DataTids.styles.d.ts +0 -7
  59. package/cjs/internal/DataTids/DataTids.styles.js +0 -42
  60. package/cjs/internal/DataTids/DataTids.styles.js.map +0 -1
  61. package/cjs/internal/DataTids/componentsDataTids.d.ts +0 -5
  62. package/cjs/internal/DataTids/componentsDataTids.js +0 -15
  63. package/cjs/internal/DataTids/componentsDataTids.js.map +0 -1
  64. package/cjs/internal/ThemePlayground/Playground.md +0 -7
  65. package/cjs/lib/featureFlagsContext/FEATUREFLAGSCONTEXT.md +0 -64
  66. package/cjs/lib/locale/LOCALECONTEXT.md +0 -222
  67. package/cjs/lib/theming/ThemeContext.md +0 -265
  68. package/components/Autocomplete/Autocomplete.md +0 -113
  69. package/components/Button/Button.md +0 -261
  70. package/components/Calendar/Calendar.md +0 -276
  71. package/components/Calendar/CalendarDay.md +0 -70
  72. package/components/Center/Center.md +0 -26
  73. package/components/Checkbox/Checkbox.md +0 -171
  74. package/components/ComboBox/ComboBox.md +0 -574
  75. package/components/CurrencyInput/CurrencyInput.md +0 -39
  76. package/components/CurrencyLabel/CurrencyLabel.md +0 -29
  77. package/components/DateInput/DateInput.md +0 -111
  78. package/components/DatePicker/DatePicker.md +0 -368
  79. package/components/Dropdown/Dropdown.md +0 -45
  80. package/components/DropdownMenu/DropdownMenu.md +0 -290
  81. package/components/FileUploader/FileUploader.md +0 -131
  82. package/components/FxInput/FxInput.md +0 -31
  83. package/components/Gapped/Gapped.md +0 -44
  84. package/components/GlobalLoader/GlobalLoader.md +0 -97
  85. package/components/Group/Group.md +0 -19
  86. package/components/Hint/Hint.md +0 -86
  87. package/components/Input/Input.md +0 -86
  88. package/components/Kebab/Kebab.md +0 -306
  89. package/components/Link/Link.md +0 -182
  90. package/components/Loader/Loader.md +0 -33
  91. package/components/MaskedInput/MaskedInput.md +0 -114
  92. package/components/MenuFooter/MenuFooter.md +0 -27
  93. package/components/MenuHeader/MenuHeader.md +0 -35
  94. package/components/MenuItem/MenuItem.md +0 -139
  95. package/components/MenuSeparator/MenuSeparator.md +0 -14
  96. package/components/MiniModal/MiniModal.md +0 -231
  97. package/components/Modal/Modal.md +0 -56
  98. package/components/Paging/Paging.md +0 -57
  99. package/components/PasswordInput/PasswordInput.md +0 -29
  100. package/components/Radio/Radio.md +0 -57
  101. package/components/RadioGroup/RadioGroup.md +0 -44
  102. package/components/ResponsiveLayout/ResponsiveLayout.md +0 -75
  103. package/components/ScrollContainer/ScrollContainer.md +0 -224
  104. package/components/Select/Select.md +0 -113
  105. package/components/SidePage/SidePage.md +0 -65
  106. package/components/SingleToast/SingleToast.md +0 -36
  107. package/components/Spinner/Spinner.md +0 -36
  108. package/components/Sticky/Sticky.md +0 -28
  109. package/components/Switcher/Switcher.md +0 -111
  110. package/components/Tabs/Tab.md +0 -73
  111. package/components/Tabs/Tabs.md +0 -54
  112. package/components/Textarea/Textarea.md +0 -58
  113. package/components/Toast/Toast.md +0 -69
  114. package/components/Toggle/Toggle.md +0 -110
  115. package/components/Token/Token.md +0 -48
  116. package/components/TokenInput/TokenInput.md +0 -277
  117. package/components/Tooltip/Tooltip.md +0 -322
  118. package/components/TooltipMenu/TooltipMenu.md +0 -241
  119. package/internal/DataTids/DATATIDS.md +0 -12
  120. package/internal/DataTids/DataTids/DataTids.js +0 -69
  121. package/internal/DataTids/DataTids/DataTids.js.map +0 -1
  122. package/internal/DataTids/DataTids/package.json +0 -6
  123. package/internal/DataTids/DataTids.d.ts +0 -12
  124. package/internal/DataTids/DataTids.styles/DataTids.styles.js +0 -20
  125. package/internal/DataTids/DataTids.styles/DataTids.styles.js.map +0 -1
  126. package/internal/DataTids/DataTids.styles/package.json +0 -6
  127. package/internal/DataTids/DataTids.styles.d.ts +0 -7
  128. package/internal/DataTids/componentsDataTids/componentsDataTids.js +0 -12
  129. package/internal/DataTids/componentsDataTids/componentsDataTids.js.map +0 -1
  130. package/internal/DataTids/componentsDataTids/package.json +0 -6
  131. package/internal/DataTids/componentsDataTids.d.ts +0 -5
  132. package/internal/ThemePlayground/Playground.md +0 -7
  133. package/lib/featureFlagsContext/FEATUREFLAGSCONTEXT.md +0 -64
  134. package/lib/locale/LOCALECONTEXT.md +0 -222
  135. package/lib/theming/ThemeContext.md +0 -265
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.3.2](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@5.3.1...@skbkontur/react-ui@5.3.2) (2025-09-10)
7
+
8
+ **Note:** Version bump only for package @skbkontur/react-ui
9
+
10
+
11
+
12
+
13
+
6
14
  ## [5.3.1](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@5.3.0...@skbkontur/react-ui@5.3.1) (2025-09-01)
7
15
 
8
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skbkontur/react-ui",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "description": "UI Components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "index.js",
@@ -22,16 +22,12 @@
22
22
  "clean": "git clean -fdxqe node_modules",
23
23
  "prerelease": "node scripts/publish/prepublish && yarn build",
24
24
  "release": "npm publish ./build --workspaces=false",
25
- "build-old-docs": "rimraf .styleguide/deploy && yarn run styleguide:build",
26
- "deploy-old-docs": "gh-pages -a -d .styleguide/deploy -r git@github.com:skbkontur/react-ui.git",
27
25
  "storybook": "storybook dev -p 6060",
28
26
  "storybook:build": "cross-env STORYBOOK_REACT_UI_TEST=true storybook build -o .storybook/build --quiet",
29
27
  "storybook:docs-build": "cross-env STORYBOOK_REACT_UI_DOCS=true storybook build --docs -c .storybook-docs -o .storybook/build --quiet",
30
28
  "storybook:test": "cross-env STORYBOOK_REACT_UI_TEST=true storybook dev --ci -p 6060",
31
29
  "storybook:docs": "cross-env STORYBOOK_REACT_UI_DOCS=true storybook dev --docs -p 6061 -c .storybook-docs",
32
30
  "storybook:serve": "yarn serve -l 6060 .storybook/build",
33
- "styleguide": "styleguidist server --config .styleguide/config/dev.config.js",
34
- "styleguide:build": "node .styleguide/build",
35
31
  "lint": "run-p -c lint:*",
36
32
  "lint:eslint": "cross-env TIMING=1 yarn eslint ./",
37
33
  "lint:tsc": "tsc --noEmit --diagnostics",
@@ -140,7 +136,6 @@
140
136
  "react": "18.3.1",
141
137
  "react-docgen-typescript": "^2.2.2",
142
138
  "react-dom": "^18.3.1",
143
- "react-styleguidist": "^12.0.1",
144
139
  "rimraf": "^5.0.7",
145
140
  "selenium-webdriver": "^4.27.0",
146
141
  "semver": "^7.6.2",
@@ -1,113 +0,0 @@
1
- ### Базовый пример
2
- ```jsx harmony
3
- import { Autocomplete } from '@skbkontur/react-ui';
4
-
5
- const items = ['Grey Face', 'Grey Space', 'Kappa', 'Keepo', 'Resident Sleeper'];
6
-
7
- const [value, setValue] = React.useState('Kappa');
8
-
9
- <Autocomplete source={items} value={value} onValueChange={setValue} />;
10
- ```
11
-
12
- ### Очистка Autocomplete
13
- Очистить значение в `Autocomplete` можно только с помощью пустой строки.
14
- ```jsx harmony
15
- import { Autocomplete, Button, Group } from '@skbkontur/react-ui';
16
-
17
- const items = ['Grey Face', 'Grey Space', 'Kappa', 'Keepo', 'Resident Sleeper'];
18
-
19
- const [value, setValue] = React.useState('Kappa');
20
-
21
- <Group>
22
- <Autocomplete source={items} value={value} onValueChange={setValue} />
23
- <Button onClick={() => setValue('')}>Очистить</Button>
24
- </Group>
25
- ```
26
-
27
- ### Размер
28
- ```jsx harmony
29
- import { Autocomplete, Gapped } from '@skbkontur/react-ui';
30
-
31
- const items = ['Маленький', 'Средний', 'Большой'];
32
-
33
- const [valueSmall, setValueSmall] = React.useState('Маленький');
34
- const [valueMedium, setValueMedium] = React.useState('Средний');
35
- const [valueLarge, setValueLarge] = React.useState('Большой');
36
-
37
- <Gapped vertical>
38
- <Autocomplete source={items} value={valueSmall} onValueChange={setValueSmall} size={'small'} />
39
- <Autocomplete source={items} value={valueMedium} onValueChange={setValueMedium} size={'medium'} />
40
- <Autocomplete source={items} value={valueLarge} onValueChange={setValueLarge} size={'large'} />
41
- </Gapped>
42
- ```
43
-
44
- ### Выделение введеного значения при фокусе
45
- ```jsx harmony
46
- import { Autocomplete } from '@skbkontur/react-ui';
47
-
48
- const items = ['Grey Face', 'Grey Space', 'Kappa', 'Keepo', 'Resident Sleeper'];
49
-
50
- const [value, setValue] = React.useState('');
51
-
52
- <Autocomplete source={items} value={value} onValueChange={setValue} selectAllOnFocus />
53
- ```
54
-
55
- ### Иконка
56
- ```jsx harmony
57
- import { Autocomplete, Gapped } from '@skbkontur/react-ui';
58
- import { SearchLoupeIcon16Regular } from '@skbkontur/icons/SearchLoupeIcon16Regular';
59
-
60
- const items = ['Grey Face', 'Grey Space', 'Kappa', 'Keepo', 'Resident Sleeper'];
61
-
62
- const [valueLeft, setValueLeft] = React.useState('');
63
- const [valueRight, setValueRight] = React.useState('');
64
-
65
- <Gapped>
66
- <Autocomplete source={items} value={valueLeft} onValueChange={setValueLeft} leftIcon={<SearchLoupeIcon16Regular />} />
67
- <Autocomplete source={items} value={valueRight} onValueChange={setValueRight} rightIcon={<SearchLoupeIcon16Regular />} />
68
- </Gapped>
69
- ```
70
-
71
- ### Ширина меню
72
- ```jsx harmony
73
- import { Autocomplete } from '@skbkontur/react-ui';
74
-
75
- const items = ['Grey Face', 'Grey Space', 'Kappa', 'Keepo', 'Resident Sleeper'];
76
-
77
- const [value, setValue] = React.useState('');
78
-
79
- <Autocomplete source={items} value={value} onValueChange={setValue} menuWidth={'80%'} />
80
- ```
81
-
82
- ### Расположение выпадающего окна Autocomplete
83
- ```jsx harmony
84
- import { Autocomplete } from '@skbkontur/react-ui';
85
-
86
- const items = ['Grey Face', 'Grey Space', 'Kappa', 'Keepo', 'Resident Sleeper'];
87
-
88
- const [value, setValue] = React.useState('');
89
-
90
- <Autocomplete source={items} value={value} onValueChange={setValue} menuPos={'top'} />
91
- ```
92
-
93
- ### Тень у выпадающего меню
94
- ```jsx harmony
95
- import { Autocomplete } from '@skbkontur/react-ui';
96
-
97
- const items = ['Grey Face', 'Grey Space', 'Kappa', 'Keepo', 'Resident Sleeper'];
98
-
99
- const [value, setValue] = React.useState('');
100
-
101
- <Autocomplete source={items} value={value} onValueChange={setValue} hasShadow />
102
- ```
103
-
104
- ### Режима прозрачной рамки
105
- ```jsx harmony
106
- import { Autocomplete } from '@skbkontur/react-ui';
107
-
108
- const items = ['Grey Face', 'Grey Space', 'Kappa', 'Keepo', 'Resident Sleeper'];
109
-
110
- const [value, setValue] = React.useState('Kappa');
111
-
112
- <Autocomplete source={items} value={value} onValueChange={setValue} borderless />
113
- ```
@@ -1,261 +0,0 @@
1
- ### Базовый пример
2
- По умолчанию, кнопка принимает все пропы `HTMLButtonElement`.
3
-
4
- ```jsx harmony
5
- import { Button } from '@skbkontur/react-ui';
6
-
7
- <Button onClick={alert} name="report">Создать отчёт</Button>;
8
- ```
9
-
10
- ### Корневой компонент
11
- Кнопка может рендерить ссылку в качестве корневого элемента, c помощью пропа `component`. Кнопка принимает все пропы переданного в `component` компонента.
12
-
13
- ```jsx harmony
14
- import { Button } from '@skbkontur/react-ui';
15
-
16
- <Button component='a' href='https://kontur.ru' target="_blank">Ссылка, но выглядит как кнопка</Button>
17
- ```
18
-
19
- ### Различные стили
20
-
21
- ```jsx harmony
22
- import { Gapped } from '@skbkontur/react-ui';
23
-
24
- const bgStyle = {
25
- backgroundImage: `linear-gradient(to right, rgba(130, 130, 130, 0.5) 1px, transparent 1px),
26
- linear-gradient(to bottom, rgba(130, 130, 130, 0.5) 1px, transparent 1px)`,
27
- backgroundSize: `16px 16px`,
28
- backgroundPosition: `-8px -8px`,
29
- padding: 16
30
- };
31
-
32
- <Gapped vertical>
33
- <Gapped>
34
- <Button use="default">Default</Button>
35
- <Button use="primary">Primary</Button>
36
- <Button use="success">Success</Button>
37
- <Button use="danger">Danger</Button>
38
- <Button use="pay">Pay</Button>
39
- <Button use="text">Text</Button>
40
- <Button use="backless">Backless</Button>
41
- <Button use="link">Link</Button>
42
- </Gapped>
43
- <Gapped style={bgStyle}>
44
- <Button use="default">Default</Button>
45
- <Button use="primary">Primary</Button>
46
- <Button use="success">Success</Button>
47
- <Button use="danger">Danger</Button>
48
- <Button use="pay">Pay</Button>
49
- <Button use="text">Text</Button>
50
- <Button use="backless">Backless</Button>
51
- <Button use="link">Link</Button>
52
- </Gapped>
53
- </Gapped>
54
- ```
55
-
56
- ### Иконка
57
- В кнопку можно передать иконку. Иконка может находиться как слева от текста кнопки, так и справа и даже в обоих позициях одновременно.
58
-
59
- ```jsx harmony
60
- import { Button, Gapped } from '@skbkontur/react-ui';
61
- import { XIcon16Regular } from '@skbkontur/icons/XIcon16Regular';
62
-
63
- <Gapped gap={5}>
64
- <Button icon={<XIcon16Regular />}>Закрыть</Button>
65
- <Button icon={<XIcon16Regular />} rightIcon={<XIcon16Regular />}>Закрыть</Button>
66
- <Button rightIcon={<XIcon16Regular />}>Закрыть</Button>
67
- </Gapped>
68
- ```
69
-
70
- ### Размер
71
-
72
- ```jsx harmony
73
- <div
74
- style={{
75
- display: "flex",
76
- alignItems: "end",
77
- gap: '10px',
78
- }}
79
- >
80
- <Button size="small">Маленькая</Button>
81
- <Button size="medium">Средняя</Button>
82
- <Button size="large">Большая</Button>
83
- </div>
84
- ```
85
-
86
- ### Ширина
87
-
88
- ```jsx harmony
89
- <Button width={40}>Закрыть</Button>
90
- ```
91
-
92
- ### Состояние валидации
93
-
94
- ```jsx harmony
95
- import { Gapped, Button } from '@skbkontur/react-ui';
96
- <Gapped gap={5}>
97
- <Button warning>Закрыть</Button>
98
- <Button error>Закрыть</Button>
99
- </Gapped>
100
- ```
101
-
102
- ### Стрелка
103
-
104
- ```jsx harmony
105
- import { Gapped, Button } from '@skbkontur/react-ui';
106
-
107
- <Gapped gap={5}>
108
- <Button arrow="left" size="medium">
109
- Назад
110
- </Button>
111
- <Button arrow size="medium">
112
- Далее
113
- </Button>
114
- </Gapped>
115
- ```
116
-
117
- ### Состояние загрузки
118
-
119
- **Поведение:**
120
- Кнопка на время нахождения в состоянии загрузки отключается.
121
- Если в кнопке есть иконка, на время загрузки иконка заменяется на спиннер, если иконки нет — весь контент кнопки заменяется на спиннер. Когда иконки две — заменяется только левая.
122
-
123
- ```jsx harmony
124
- import { Button, Gapped } from '@skbkontur/react-ui';
125
- import { MinusCircleIcon16Light } from '@skbkontur/icons/MinusCircleIcon16Light';
126
-
127
- const [loading, setLoading] = React.useState(false);
128
-
129
- const delay = time => args => new Promise(resolve => setTimeout(resolve, time, args));
130
-
131
- const handleLoadingStart = () => {
132
- delay(2000)()
133
- .then(() => {
134
- setLoading(false);
135
- })
136
- };
137
-
138
- const handleClick = () => {
139
- setLoading(true);
140
- handleLoadingStart();
141
- };
142
-
143
- <Gapped>
144
- <Button width={150} onClick={handleClick} loading={loading}>
145
- Удалить
146
- </Button>
147
- <Button icon={<MinusCircleIcon16Light />} width={150} onClick={handleClick} loading={loading}>
148
- Удалить
149
- </Button>
150
- <Button rightIcon={<MinusCircleIcon16Light />} width={150} onClick={handleClick} loading={loading}>
151
- Удалить
152
- </Button>
153
- <Button icon={<MinusCircleIcon16Light />} rightIcon={<MinusCircleIcon16Light />} width={150} onClick={handleClick} loading={loading}>
154
- Удалить
155
- </Button>
156
- </Gapped>
157
-
158
- ```
159
-
160
- ### Проп темы
161
-
162
- ```jsx harmony
163
- import { Button, Gapped } from '@skbkontur/react-ui';
164
-
165
- <Gapped>
166
- <Button theme={{textColorDefault: '#C00000'}}>Ok</Button>
167
- <Button use="link" theme={{linkColor: '#C00000'}}>Ok</Button>
168
- <Button>Ok</Button>
169
- </Gapped>
170
- ```
171
-
172
- ### Кастомизация кнопки-ссылки
173
-
174
- ```jsx harmony
175
- import { Toast } from "@skbkontur/react-ui";
176
- import { CopyIcon16Regular } from "@skbkontur/icons/CopyIcon16Regular"
177
-
178
- const textDecorationStyles = {
179
- btnLinkTextUnderlineOffset: '1px',
180
- }
181
-
182
- const underlineOnHoverStyles = {
183
- btnLinkTextDecorationColor: 'transparent',
184
- }
185
-
186
- const differentColorStyles = {
187
- btnLinkColor: 'blue',
188
- btnLinkHoverColor: 'blue',
189
- btnLinkActiveColor: 'blue',
190
- }
191
-
192
- const stringify = (styles) => {
193
- return `${Object.entries(styles).map(([key, value]) => `${key}: "${value}"`).join(", ")}`
194
- }
195
-
196
- const copyStyles = (styles) => {
197
- navigator.clipboard.writeText(stringify(styles));
198
- Toast.push('Copied');
199
- }
200
-
201
- const tableStyle = {
202
- borderCollapse: 'collapse',
203
- width: '100%',
204
- };
205
-
206
- const tdStyle = {
207
- border: '1px solid',
208
- padding: '8px',
209
- };
210
-
211
- const renderExampleRow = (title, styles) => {
212
- return (
213
- <tr>
214
- <td style={tdStyle}>{title}</td>
215
- <td style={tdStyle}><Button use={'link'} theme={styles}>Button-link</Button></td>
216
- <td style={tdStyle}>
217
- <div style={{display: 'flex'}}>
218
- <div style={{width: '80%', whiteSpace: 'pre-line'}}>{stringify(styles).replace(/, /g, '\n')}</div>
219
- <Button icon={<CopyIcon16Regular />} use={'text'} onClick={() => copyStyles(styles)}/>
220
- </div>
221
- </td>
222
- </tr>
223
- )
224
- }
225
-
226
- <table style={tableStyle}>
227
- <tr style={{textAlign: 'left'}}>
228
- <th style={tdStyle}></th>
229
- <th style={tdStyle}>Пример</th>
230
- <th style={tdStyle}>Переменные темы</th>
231
- </tr>
232
- {renderExampleRow('Ссылка с подчеркиванием без отступа', textDecorationStyles)}
233
- {renderExampleRow('Ссылка с подчеркиванием при наведении', underlineOnHoverStyles)}
234
- {renderExampleRow('Изменение цвета ссылки', differentColorStyles)}
235
- </table>
236
- ```
237
-
238
- ### Узкая Кнопка
239
-
240
- ```jsx harmony
241
- import { Button } from '@skbkontur/react-ui';
242
-
243
- <Button narrow>
244
- Создать отчет
245
- </Button>
246
- ```
247
-
248
- ### Состояния валидации
249
-
250
- ```jsx harmony
251
- import { Button, Gapped } from '@skbkontur/react-ui';
252
-
253
- <Gapped gap={5}>
254
- <Button warning>
255
- Warning
256
- </Button>
257
- <Button error>
258
- Error
259
- </Button>
260
- </Gapped>
261
- ```
@@ -1,276 +0,0 @@
1
- ### Календарь с заданной датой
2
-
3
- ```jsx harmony
4
- const [date, setDate] = React.useState("01.11.2021");
5
-
6
- <Calendar
7
- value={date}
8
- onValueChange={setDate}
9
- />
10
- ```
11
-
12
- ### initialMonth и initialYear
13
- Вне зависимости от того, какая дата выбрана в календаре в данный момент - можно изменить отображение начального года и месяца с помощью пропов `initialMonth` и `initialYear`
14
-
15
- ```jsx harmony
16
- import { Checkbox } from '@skbkontur/react-ui';
17
-
18
- const [date, setDate] = React.useState("11.12.2021");
19
- const initialMonth = 7;
20
- const initialYear = 2000;
21
-
22
- <div style={{ display: 'flex' }}>
23
- <Calendar
24
- value={date}
25
- onValueChange={setDate}
26
- initialMonth={initialMonth}
27
- initialYear={initialYear}
28
- />
29
- <div style={{ fontSize: '16px' }}>
30
- <p>Выбранная дата: {date}</p>
31
- <p>Начальный месяц: {initialMonth}</p>
32
- <p>Начальный год: {initialYear}</p>
33
- </div>
34
- </div>
35
- ```
36
-
37
- ### isHoliday
38
-
39
- В компонент можно передать функцию `isHoliday`, которая будет получать день строкой формата `dd.mm.yyyy` и флаг `isWeekend`, и должна вернуть `true` для выходного и `false` для рабочего дня.
40
-
41
- ```jsx harmony
42
- import * as DatePickerHelpers from '@skbkontur/react-ui/components/DatePicker/DatePickerHelpers';
43
-
44
- const [date, setDate] = React.useState();
45
-
46
- const createRandomHolidays = () => {
47
- const holidays = new Array(10);
48
- const today = new Date();
49
-
50
- for (let index = 0; index < holidays.length; index++) {
51
- const day = new Date(today.setDate(today.getDate() + 1 + index).valueOf());
52
-
53
- const holiday = {
54
- date: day.getDate(),
55
- month: day.getMonth(),
56
- year: day.getFullYear(),
57
- };
58
-
59
- holidays[index] = DatePickerHelpers.formatDate(holiday);
60
- }
61
-
62
- return holidays;
63
- };
64
- const holidays = createRandomHolidays();
65
-
66
- const isHoliday = (day, isWeekend) => {
67
- const today = new Date();
68
- const holiday = {
69
- date: today.getDate(),
70
- month: today.getMonth(),
71
- year: today.getFullYear(),
72
- };
73
-
74
- if (holidays.includes(day)) {
75
- return !isWeekend;
76
- }
77
-
78
- return isWeekend;
79
- };
80
-
81
- <Calendar isHoliday={isHoliday} value={date} onValueChange={setDate} />;
82
- ```
83
-
84
- ### Высота
85
- Календарю можно задать кастомную высоту с помощью переменной темы `calendarWrapperHeight`
86
-
87
- - Базовая высота календаря - `330px`
88
- - Максимальная высота календаря - `450px`
89
-
90
- ```jsx harmony
91
- import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
92
- import { ThemeFactory } from '@skbkontur/react-ui/lib/theming/ThemeFactory';
93
-
94
- const [date, setDate] = React.useState("01.11.2021");
95
- const theme = React.useContext(ThemeContext);
96
-
97
- <ThemeContext.Provider
98
- value={ThemeFactory.create({ calendarWrapperHeight: '450px' }, theme)}
99
- >
100
- <Calendar
101
- value={date}
102
- onValueChange={setDate}
103
- />
104
- </ThemeContext.Provider>
105
- ```
106
-
107
- ### Кастомный рендер дня
108
- Для кастомнизации дней в календаре используется метод `renderDay` и компонент [Calendar.Day](#/Components/Calendar/Calendar.Day)
109
-
110
- ```jsx harmony
111
- import { Tooltip, Hint, CalendarDay } from '@skbkontur/react-ui';
112
-
113
- const initialValue = "02.09.2023";
114
-
115
- const [value, setValue] = React.useState(initialValue);
116
-
117
- const renderDay = (props) => {
118
- const [date, month, year] = props.date.split('.').map(Number);
119
-
120
- if (month == 9 && date > 12 && date < 16) {
121
- return (
122
- <Tooltip render={() => "Кастомный день"}>
123
- <CalendarDay {...props} style={{ background: 'darkgray' }} />
124
- </Tooltip>
125
- );
126
- }
127
-
128
- if (month == 8 && date == 20) {
129
- return (
130
- <Hint text={date} pos="right middle">
131
- <CalendarDay {...props}>
132
- <b style={{color: 'orange'}}>#</b>
133
- </CalendarDay>
134
- </Hint>
135
- );
136
- }
137
-
138
- return <CalendarDay {...props} />
139
- };
140
-
141
- <Calendar
142
- value={value}
143
- onValueChange={setValue}
144
- renderDay={renderDay}
145
- />;
146
- ```
147
-
148
- ### Календарь с ценами
149
- Пример с кастомизацией темы и кастомным рендером дня.
150
-
151
- ```jsx harmony
152
- import { CalendarDay } from '@skbkontur/react-ui';
153
- import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
154
- import { ThemeFactory } from '@skbkontur/react-ui/lib/theming/ThemeFactory';
155
-
156
- const theme = React.useContext(ThemeContext);
157
-
158
- function renderDay(props) {
159
- const [date, month] = props.date.split('.').map(Number);
160
- const randomDay = date % 6 === 0 || date % 7 === 0 || date % 8 === 0;
161
- const randomPrice = Math.round((date / month) * 1000);
162
-
163
- return (
164
- <CalendarDay {...props}>
165
- <div style={{ fontSize: theme.calendarCellFontSize }}>{date}</div>
166
- <div style={{ fontSize: '11px', fontFeatureSettings: 'tnum', fontVariantNumeric: 'tabular-nums' }}>
167
- {randomDay ? <>{randomPrice}&thinsp;₽</> : <span style={{ color: theme.tokenTextColorDisabled }}>—</span>}
168
- </div>
169
- </CalendarDay>
170
- );
171
- }
172
-
173
- const [value, setValue] = React.useState(null);
174
-
175
- <ThemeContext.Provider
176
- value={ThemeFactory.create({
177
- calendarCellWidth: '56px',
178
- calendarCellHeight: '56px',
179
- calendarCellLineHeight: '1.5',
180
- calendarWrapperHeight: '600px',
181
- calendarCellBorderRadius: '8px'
182
- }, theme)}
183
- >
184
- <Calendar value={value} renderDay={renderDay} onValueChange={setValue} />
185
- </ThemeContext.Provider>
186
- ```
187
-
188
- ### Локали по умолчанию
189
-
190
- ```typescript static
191
- interface CalendarLocale {
192
- months?: string[];
193
- selectMonthAriaLabel?: string;
194
- selectYearAriaLabel?: string;
195
- selectChosenAriaLabel?: string;
196
- dayCellChooseDateAriaLabel?: string;
197
- }
198
-
199
- const ru_RU = {
200
- months: [
201
- 'Январь',
202
- 'Февраль',
203
- 'Март',
204
- 'Апрель',
205
- 'Май',
206
- 'Июнь',
207
- 'Июль',
208
- 'Август',
209
- 'Сентябрь',
210
- 'Октябрь',
211
- 'Ноябрь',
212
- 'Декабрь',
213
- ],
214
- selectMonthAriaLabel: 'месяц',
215
- selectYearAriaLabel: 'год',
216
- selectChosenAriaLabel: 'Выбранный',
217
- dayCellChooseDateAriaLabel: 'Выбрать дату',
218
- };
219
-
220
- const en_GB = {
221
- months: [
222
- 'January',
223
- 'February',
224
- 'March',
225
- 'April',
226
- 'May',
227
- 'June',
228
- 'July',
229
- 'August',
230
- 'September',
231
- 'October',
232
- 'November',
233
- 'December',
234
- ],
235
- selectMonthAriaLabel: 'месяц',
236
- selectYearAriaLabel: 'год',
237
- selectChosenAriaLabel: 'Выбранный',
238
- dayCellChooseDateAriaLabel: 'Выбрать дату',
239
- };
240
- ```
241
-
242
-
243
- ### Скролл к месяцу
244
-
245
- ```jsx harmony
246
- import { Button, Gapped } from '@skbkontur/react-ui';
247
-
248
- const initialValue = "02.09.2023";
249
- const [value, setValue] = React.useState(initialValue);
250
- const calendarRef = React.useRef(null);
251
-
252
- <>
253
- <Gapped gap={8} verticalAlign="top">
254
- <Calendar
255
- value={value}
256
- ref={calendarRef}
257
- onValueChange={setValue}
258
- />
259
-
260
- <Gapped vertical gap={8}>
261
- <Button onClick={() => calendarRef.current.scrollToMonth(1, 2023)}>
262
- I квартал
263
- </Button>
264
- <Button onClick={() => calendarRef.current.scrollToMonth(4, 2023)}>
265
- II квартал
266
- </Button>
267
- <Button onClick={() => calendarRef.current.scrollToMonth(7, 2023)}>
268
- III квартал
269
- </Button>
270
- <Button onClick={() => calendarRef.current.scrollToMonth(10, 2023)}>
271
- IV квартал
272
- </Button>
273
- </Gapped>
274
- </Gapped>
275
- </>;
276
- ```