@rescui/switcher 0.12.11 → 0.13.1-RUI-293-Update-menu-component-7a032357e.20

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.
@@ -0,0 +1,325 @@
1
+ # Switcher
2
+
3
+ A switcher replaces a group of radio buttons, presenting the options with one selected by default.
4
+
5
+ ## Basic
6
+
7
+ ### Features showcase
8
+
9
+ ### Usage
10
+
11
+ ```tsx
12
+ import { Switcher } from '@rescui/switcher';
13
+ import { useState } from 'react';
14
+
15
+ const MySwitcher = () => {
16
+ const [value, setValue] = useState(3);
17
+
18
+ return (
19
+ <Switcher
20
+ value={value}
21
+ onChange={setValue}
22
+ options={[
23
+ { label: 'One', value: 1 },
24
+ { label: 'Two', value: 2 },
25
+ { label: 'Three', value: 3 },
26
+ { label: 'Four', value: 4 },
27
+ { label: 'Five', value: 5 }
28
+ ]}
29
+ />
30
+ );
31
+ };
32
+
33
+ render(<MySwitcher />);
34
+ ```
35
+
36
+ ### Compact mode
37
+
38
+ ```tsx
39
+ import { Switcher } from '@rescui/switcher';
40
+ import { useState } from 'react';
41
+
42
+ const MySwitcher = () => {
43
+ const [value, setValue] = useState(3);
44
+
45
+ return (
46
+ <Switcher
47
+ value={value}
48
+ onChange={setValue}
49
+ compact
50
+ options={[
51
+ { label: 'One', value: 1 },
52
+ { label: 'Two', value: 2 },
53
+ { label: 'Three', value: 3 },
54
+ { label: 'Four', value: 4 },
55
+ { label: 'Five', value: 5 }
56
+ ]}
57
+ />
58
+ );
59
+ };
60
+
61
+ render(<MySwitcher />);
62
+ ```
63
+
64
+ ### With icons
65
+
66
+ ```tsx
67
+ import { Switcher } from '@rescui/switcher';
68
+ import {
69
+ HintOutlineIcon,
70
+ PersonOutlineIcon,
71
+ CompanyOutlineIcon
72
+ } from '@rescui/icons';
73
+ import { useState } from 'react';
74
+
75
+ const MySwitcher = () => {
76
+ const [value, setValue] = useState(2);
77
+
78
+ return (
79
+ <Switcher
80
+ value={value}
81
+ onChange={setValue}
82
+ options={[
83
+ { label: 'One', value: 1, icon: <HintOutlineIcon /> },
84
+ { label: 'Two', value: 2, icon: <PersonOutlineIcon /> },
85
+ { label: 'Three', value: 3, icon: <CompanyOutlineIcon /> }
86
+ ]}
87
+ />
88
+ );
89
+ };
90
+
91
+ render(<MySwitcher />);
92
+ ```
93
+
94
+ ## Vertical
95
+
96
+ ### Features showcase
97
+
98
+ Do not restrict the component height. If you have to place it into a container with height restrictions, contact the [RescUI team](https://jetbrains.slack.com/app_redirect?channel=CQJRARE95), and we'll find a solution.
99
+
100
+ ### Usage
101
+
102
+ ```tsx
103
+ import { VerticalSwitcher } from '@rescui/switcher';
104
+ import { useState } from 'react';
105
+
106
+ const MyVerticalSwitcher = () => {
107
+ const [value, setValue] = useState(3);
108
+
109
+ return (
110
+ <VerticalSwitcher
111
+ value={value}
112
+ onChange={setValue}
113
+ options={[
114
+ { label: 'One', value: 1 },
115
+ { label: 'Two', value: 2 },
116
+ { label: 'Three', value: 3 },
117
+ { label: 'Four', value: 4 },
118
+ { label: 'Five', value: 5 }
119
+ ]}
120
+ style={{ minWidth: 180 }}
121
+ />
122
+ );
123
+ };
124
+
125
+ render(<MyVerticalSwitcher />);
126
+ ```
127
+
128
+ ### With icons
129
+
130
+ ```tsx
131
+ import { VerticalSwitcher } from '@rescui/switcher';
132
+ import {
133
+ HintOutlineIcon,
134
+ PersonOutlineIcon,
135
+ CompanyOutlineIcon,
136
+ BellOutlineIcon,
137
+ CloudOutlineIcon
138
+ } from '@rescui/icons';
139
+ import { useState } from 'react';
140
+
141
+ const MyVerticalSwitcher = () => {
142
+ const [value, setValue] = useState(2);
143
+
144
+ return (
145
+ <VerticalSwitcher
146
+ value={value}
147
+ onChange={setValue}
148
+ options={[
149
+ { label: 'One', value: 1, icon: <HintOutlineIcon /> },
150
+ { label: 'Two', value: 2, icon: <PersonOutlineIcon /> },
151
+ { label: 'Three', value: 3, icon: <CompanyOutlineIcon /> },
152
+ { label: 'Four', value: 4, icon: <BellOutlineIcon /> },
153
+ { label: 'Five', value: 5, icon: <CloudOutlineIcon /> }
154
+ ]}
155
+ style={{ minWidth: 180 }}
156
+ />
157
+ );
158
+ };
159
+
160
+ render(<MyVerticalSwitcher />);
161
+ ```
162
+
163
+ ## CSS Mixins API
164
+
165
+ #### `Switcher` mixins
166
+
167
+ | Mixin name | Details |
168
+ | --- | --- |
169
+ | `rs-switcher-size-xs` | prop: `size`<br><br>value: `"xs"` |
170
+ | `rs-switcher-size-s` | prop: `size`<br><br>value: `"s"` |
171
+ | `rs-switcher-size-m` | prop: `size`<br><br>value: `"m"` |
172
+ | `rs-switcher-size-l` | prop: `size`<br><br>value: `"l"` |
173
+ | `rs-switcher-mode-classic` | prop: `mode`<br><br>value: `"classic"` |
174
+ | `rs-switcher-mode-rock` | prop: `mode`<br><br>value: `"rock"` |
175
+ | `rs-switcher-compact-true` | prop: `compact`<br><br>value: `true` |
176
+ | `rs-switcher-compact-false` | prop: `compact`<br><br>value: `false` |
177
+ | `rs-switcher-icon-position-left` | prop: `iconPosition`<br><br>value: `"left"` |
178
+ | `rs-switcher-icon-position-right` | prop: `iconPosition`<br><br>value: `"right"` |
179
+
180
+ ##### Demo
181
+
182
+ Instead of separate classes, it may be a single class with `@media` queries inside:
183
+
184
+ ```tsx
185
+ import { useState } from 'react';
186
+ import { Switcher } from '@rescui/switcher';
187
+ import { HintOutlineIcon, PersonOutlineIcon } from '@rescui/icons';
188
+
189
+ const MySwitcher = ({ className }) => {
190
+ const [value, setValue] = useState(3);
191
+
192
+ return (
193
+ <div style={{ padding: 12, backgroundColor: 'var(--rs-color-black-t5)' }}>
194
+ <Switcher
195
+ value={value}
196
+ onChange={setValue}
197
+ options={[
198
+ { label: 'One', value: 1, icon: <HintOutlineIcon /> },
199
+ { label: 'Two', value: 2, icon: <PersonOutlineIcon /> },
200
+ { label: 'Three', value: 3 },
201
+ { label: 'Four', value: 4 },
202
+ { label: 'Five', value: 5 }
203
+ ]}
204
+ className={className}
205
+ />
206
+ </div>
207
+ );
208
+ };
209
+
210
+ render(
211
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
212
+ <div>
213
+ <p>Default:</p>
214
+ <MySwitcher />
215
+ </div>
216
+ <div>
217
+ <p>Var1:</p>
218
+ <MySwitcher className={`my-switcher-var-1`} />
219
+ </div>
220
+ <div>
221
+ <p>Var1 & Var2 combined:</p>
222
+ <MySwitcher className={`my-switcher-var-1 my-switcher-var-2`} />
223
+ </div>
224
+ </div>
225
+ );
226
+ ```
227
+
228
+ ```postcss attached
229
+ @import '@rescui/switcher/lib/public-api.p.css';
230
+
231
+ .my-switcher-var-1 {
232
+ @mixin rs-switcher-size-l;
233
+ @mixin rs-switcher-mode-rock;
234
+ @mixin rs-switcher-compact-true;
235
+ @mixin rs-switcher-icon-position-right;
236
+ }
237
+ .my-switcher-var-2 {
238
+ @mixin rs-switcher-size-s;
239
+ @mixin rs-switcher-mode-classic;
240
+ @mixin rs-switcher-compact-false;
241
+ @mixin rs-switcher-icon-position-left;
242
+ }
243
+ ```
244
+
245
+ #### `VerticalSwitcher` mixins
246
+
247
+ | Mixin name | Details |
248
+ | --- | --- |
249
+ | `rs-vertical-switcher-size-xs` | prop: `size`<br><br>value: `"xs"` |
250
+ | `rs-vertical-switcher-size-s` | prop: `size`<br><br>value: `"s"` |
251
+ | `rs-vertical-switcher-size-m` | prop: `size`<br><br>value: `"m"` |
252
+ | `rs-vertical-switcher-size-l` | prop: `size`<br><br>value: `"l"` |
253
+ | `rs-vertical-switcher-mode-classic` | prop: `mode`<br><br>value: `"classic"` |
254
+ | `rs-vertical-switcher-mode-rock` | prop: `mode`<br><br>value: `"rock"` |
255
+ | `rs-vertical-switcher-icon-position-left` | prop: `iconPosition`<br><br>value: `"left"` |
256
+ | `rs-vertical-switcher-icon-position-right` | prop: `iconPosition`<br><br>value: `"right"` |
257
+
258
+ ##### Demo
259
+
260
+ Instead of separate classes, it may be a single class with `@media` queries inside:
261
+
262
+ ```tsx
263
+ import { useState } from 'react';
264
+ import { VerticalSwitcher } from '@rescui/switcher';
265
+ import {
266
+ HintOutlineIcon,
267
+ PersonOutlineIcon,
268
+ CompanyOutlineIcon,
269
+ BellOutlineIcon,
270
+ CloudOutlineIcon
271
+ } from '@rescui/icons';
272
+
273
+ const MyVerticalSwitcher = ({ className }) => {
274
+ const [value, setValue] = useState(3);
275
+
276
+ return (
277
+ <div style={{ padding: 12, backgroundColor: 'var(--rs-color-black-t5)' }}>
278
+ <VerticalSwitcher
279
+ value={value}
280
+ onChange={setValue}
281
+ options={[
282
+ { label: 'One', value: 1, icon: <HintOutlineIcon /> },
283
+ { label: 'Two', value: 2, icon: <PersonOutlineIcon /> },
284
+ { label: 'Three', value: 3, icon: <CompanyOutlineIcon /> },
285
+ { label: 'Four', value: 4, icon: <BellOutlineIcon /> },
286
+ { label: 'Five', value: 5, icon: <CloudOutlineIcon /> }
287
+ ]}
288
+ className={className}
289
+ />
290
+ </div>
291
+ );
292
+ };
293
+
294
+ render(
295
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
296
+ <div>
297
+ <p>Default:</p>
298
+ <MyVerticalSwitcher />
299
+ </div>
300
+ <div>
301
+ <p>Var1:</p>
302
+ <MyVerticalSwitcher className={`my-vertical-switcher-var-1`} />
303
+ </div>
304
+ <div>
305
+ <p>Var1 & Var2 combined:</p>
306
+ <MyVerticalSwitcher className={`my-vertical-switcher-var-1 my-vertical-switcher-var-2`} />
307
+ </div>
308
+ </div>
309
+ );
310
+ ```
311
+
312
+ ```postcss
313
+ @import '@rescui/switcher/lib/public-api.p.css';
314
+
315
+ .my-vertical-switcher-var-1 {
316
+ @mixin rs-vertical-switcher-size-l;
317
+ @mixin rs-vertical-switcher-mode-rock;
318
+ @mixin rs-vertical-switcher-icon-position-right;
319
+ }
320
+ .my-vertical-switcher-var-2 {
321
+ @mixin rs-vertical-switcher-size-s;
322
+ @mixin rs-vertical-switcher-mode-classic;
323
+ @mixin rs-vertical-switcher-icon-position-left;
324
+ }
325
+ ```
package/llm/index.md ADDED
@@ -0,0 +1,2 @@
1
+ - Components and Hooks
2
+ - [Switcher](./components/switcher.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rescui/switcher",
3
- "version": "0.12.11",
3
+ "version": "0.13.1-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
@@ -9,6 +9,7 @@
9
9
  "src:main": "src/index.ts",
10
10
  "files": [
11
11
  "lib",
12
+ "llm",
12
13
  "typings",
13
14
  "LICENSE.txt"
14
15
  ],
@@ -17,7 +18,7 @@
17
18
  },
18
19
  "dependencies": {
19
20
  "@babel/runtime-corejs3": "^7.26.0",
20
- "@rescui/use-resize-observer": "^0.3.0",
21
+ "@rescui/use-resize-observer": "0.3.1-RUI-293-Update-menu-component-7a032357e.167+7a032357e",
21
22
  "classnames": "^2.2.6"
22
23
  },
23
24
  "peerDependencies": {
@@ -26,15 +27,15 @@
26
27
  "react": ">=16.8.0 <20"
27
28
  },
28
29
  "devDependencies": {
29
- "@rescui/colors": "^0.3.0",
30
- "@rescui/icons": "^1.7.5",
31
- "@rescui/scripts": "^0.5.1",
32
- "@rescui/typography": "^0.26.0"
30
+ "@rescui/colors": "0.3.1-RUI-293-Update-menu-component-7a032357e.55+7a032357e",
31
+ "@rescui/icons": "1.7.7-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
32
+ "@rescui/scripts": "0.5.2",
33
+ "@rescui/typography": "0.27.1-RUI-293-Update-menu-component-7a032357e.20+7a032357e"
33
34
  },
34
35
  "scripts": {
35
36
  "build": "rescui-scripts build && yarn run build-pcss-api",
36
37
  "build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
37
38
  },
38
39
  "nx": {},
39
- "gitHead": "faa7a838502974c16bdf773ab001002d1b8dcca8"
40
+ "gitHead": "7a032357e8f31abbf69e18aa6b7ef2d75e40f42e"
40
41
  }