@rescui/button 0.23.6 → 0.24.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.
- package/README.md +3 -1
- package/lib/_virtual/index.css.js +12 -12
- package/lib/button.d.ts +81 -81
- package/lib/button.p.module.css.js +31 -31
- package/lib/index.css +81 -81
- package/lib/index.d.ts +53 -54
- package/lib/index.js +2 -2
- package/llm/components/button.md +610 -0
- package/llm/index.md +2 -0
- package/package.json +9 -8
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
Buttons allow users to perform actions with a single click.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### Features showcase
|
|
8
|
+
|
|
9
|
+
### Basic usage
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { Button } from '@rescui/button';
|
|
13
|
+
|
|
14
|
+
<Button onClick={() => alert('Boom💥😀')}>Button</Button>;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Change mode and size
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { Button } from '@rescui/button';
|
|
21
|
+
|
|
22
|
+
<Button mode="rock" size="s">
|
|
23
|
+
Button
|
|
24
|
+
</Button>;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Add icon
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { Button } from '@rescui/button';
|
|
31
|
+
import { DownloadOutlineIcon } from '@rescui/icons';
|
|
32
|
+
|
|
33
|
+
<div className="rs-docs-row">
|
|
34
|
+
<span className="rs-docs-col">
|
|
35
|
+
<Button icon={<DownloadOutlineIcon />}>Icon on the left</Button>
|
|
36
|
+
</span>
|
|
37
|
+
<span className="rs-docs-col">
|
|
38
|
+
<Button icon={<DownloadOutlineIcon />} iconPosition="right">
|
|
39
|
+
Icon on the right
|
|
40
|
+
</Button>
|
|
41
|
+
</span>
|
|
42
|
+
</div>;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Push icon to the edge
|
|
46
|
+
|
|
47
|
+
Use this to align icons in a column of buttons, ensuring consistency even when some buttons have multiple lines of text.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Button } from '@rescui/button';
|
|
51
|
+
import { AiIcon } from '@rescui/icons';
|
|
52
|
+
|
|
53
|
+
const Demo = () => {
|
|
54
|
+
return (
|
|
55
|
+
<div className="container">
|
|
56
|
+
<div>
|
|
57
|
+
<Button className="btn" iconPosition="left-edge" allowMultiline icon={<AiIcon />}>
|
|
58
|
+
Short Button
|
|
59
|
+
</Button>
|
|
60
|
+
</div>
|
|
61
|
+
<div>
|
|
62
|
+
<Button className="btn" iconPosition="left-edge" allowMultiline icon={<AiIcon />}>
|
|
63
|
+
Some long content of my beautiful Button
|
|
64
|
+
</Button>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
render(<Demo />);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```postcss attached
|
|
74
|
+
.container {
|
|
75
|
+
display: flex;
|
|
76
|
+
overflow: auto;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
|
|
79
|
+
width: 350px;
|
|
80
|
+
padding: 24px;
|
|
81
|
+
|
|
82
|
+
border: 1px solid black;
|
|
83
|
+
|
|
84
|
+
resize: horizontal;
|
|
85
|
+
gap: 12px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.btn {
|
|
89
|
+
width: 100%;
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Customizing primary color
|
|
94
|
+
|
|
95
|
+
To get the correct primary color variables bundle, use the [primary color tool](/design/colors/primary-tool/).
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import { Button } from '@rescui/button';
|
|
99
|
+
|
|
100
|
+
render(
|
|
101
|
+
<div>
|
|
102
|
+
<Button>Default primary button</Button>
|
|
103
|
+
<div className="pink-primary" style={{ marginTop: 12 }}>
|
|
104
|
+
<Button>Pink primary button</Button>
|
|
105
|
+
</div>
|
|
106
|
+
<div style={{ marginTop: 12 }}>
|
|
107
|
+
<Button className="green-primary">Green primary button</Button>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
```postcss
|
|
114
|
+
.pink-primary {
|
|
115
|
+
--rs-color-primary-light-theme: rgb(223, 36, 119);
|
|
116
|
+
--rs-color-primary-t-dim-light-theme: rgba(223, 36, 119, 0.8);
|
|
117
|
+
--rs-color-primary-t-fog-light-theme: rgba(223, 36, 119, 0.2);
|
|
118
|
+
|
|
119
|
+
--rs-color-primary-dark-theme: rgb(223, 36, 119);
|
|
120
|
+
--rs-color-primary-t-dim-dark-theme: rgba(223, 36, 119, 0.8);
|
|
121
|
+
--rs-color-primary-t-fog-dark-theme: rgba(223, 36, 119, 0.2);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.green-primary {
|
|
125
|
+
--rs-color-primary-light-theme: rgb(8, 132, 132);
|
|
126
|
+
--rs-color-primary-t-dim-light-theme: rgba(8, 132, 132, 0.8);
|
|
127
|
+
--rs-color-primary-t-fog-light-theme: rgba(8, 132, 132, 0.2);
|
|
128
|
+
|
|
129
|
+
--rs-color-primary-dark-theme: rgb(8, 132, 132);
|
|
130
|
+
--rs-color-primary-t-dim-dark-theme: rgba(8, 132, 132, 0.8);
|
|
131
|
+
--rs-color-primary-t-fog-dark-theme: rgba(8, 132, 132, 0.2);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## CSS API
|
|
136
|
+
|
|
137
|
+
#### `Button` mixins
|
|
138
|
+
|
|
139
|
+
| Mixin name | Details |
|
|
140
|
+
| --- | --- |
|
|
141
|
+
| `rs-button-size-xs` | prop: `size`<br><br>value: `"xs"` |
|
|
142
|
+
| `rs-button-size-s` | prop: `size`<br><br>value: `"s"` |
|
|
143
|
+
| `rs-button-size-m` | prop: `size`<br><br>value: `"m"` |
|
|
144
|
+
| `rs-button-size-l` | prop: `size`<br><br>value: `"l"` |
|
|
145
|
+
| `rs-button-mode-classic` | prop: `mode`<br><br>value: `"classic"` |
|
|
146
|
+
| `rs-button-mode-rock` | prop: `mode`<br><br>value: `"rock"` |
|
|
147
|
+
| `rs-button-mode-transparent` | prop: `mode`<br><br>value: `"transparent"` |
|
|
148
|
+
| `rs-button-mode-outline` | prop: `mode`<br><br>value: `"outline"` |
|
|
149
|
+
| `rs-button-mode-clear` | prop: `mode`<br><br>value: `"clear"` |
|
|
150
|
+
| `rs-button-icon-left` | prop: `iconPosition`<br><br>value: `"left"` |
|
|
151
|
+
| `rs-button-icon-left-edge` | prop: `iconPosition`<br><br>value: `"left-edge"` |
|
|
152
|
+
| `rs-button-icon-right` | prop: `iconPosition`<br><br>value: `"right"` |
|
|
153
|
+
| `rs-button-icon-right-edge` | prop: `iconPosition`<br><br>value: `"right-edge"` |
|
|
154
|
+
| `rs-button-flat-right` | prop: `flat`<br><br>value: `"right"`<br><br>Flatten `right` side of a button |
|
|
155
|
+
| `rs-button-flat-left` | prop: `flat`<br><br>value: `"left"`<br><br>Flatten `left` side of a button |
|
|
156
|
+
| `rs-button-state-hover` | prop: `css-state`<br><br>value: `":hover"` |
|
|
157
|
+
| `rs-button-state-active` | prop: `css-state`<br><br>value: `":active"` |
|
|
158
|
+
| `rs-button-state-focus-visible` | prop: `css-state`<br><br>value: `":focus-visible"` |
|
|
159
|
+
| `rs-button-state-active-focus-visible-no-hover` | prop: `css-state`<br><br>value: `":active:focus-visible:not(:hover)"` |
|
|
160
|
+
|
|
161
|
+
##### Demo
|
|
162
|
+
|
|
163
|
+
Instead of separate classes, it may be a single class with `@media` queries inside:
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
import { Button } from '@rescui/button';
|
|
167
|
+
import { PersonIcon } from '@rescui/icons';
|
|
168
|
+
|
|
169
|
+
const MyButton = ({ className }) => {
|
|
170
|
+
return (
|
|
171
|
+
<div style={{ padding: 12, backgroundColor: 'var(--rs-color-black-t5)' }}>
|
|
172
|
+
<Button className={className} icon={<PersonIcon />}>
|
|
173
|
+
Button
|
|
174
|
+
</Button>
|
|
175
|
+
</div>
|
|
176
|
+
);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
render(
|
|
180
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
|
|
181
|
+
<div>
|
|
182
|
+
<p>Default:</p>
|
|
183
|
+
<MyButton />
|
|
184
|
+
</div>
|
|
185
|
+
<div>
|
|
186
|
+
<p>Var1:</p>
|
|
187
|
+
<MyButton className={`my-button-var-1`} />
|
|
188
|
+
</div>
|
|
189
|
+
<div>
|
|
190
|
+
<p>Var1 & Var2 combined:</p>
|
|
191
|
+
<MyButton className={`my-button-var-1 my-button-var-2`} />
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```postcss
|
|
198
|
+
@import '@rescui/button/lib/public-api.p.css';
|
|
199
|
+
|
|
200
|
+
.my-button-var-1 {
|
|
201
|
+
@mixin rs-button-size-l;
|
|
202
|
+
@mixin rs-button-mode-rock;
|
|
203
|
+
@mixin rs-button-icon-right;
|
|
204
|
+
}
|
|
205
|
+
.my-button-var-2 {
|
|
206
|
+
@mixin rs-button-size-xs;
|
|
207
|
+
@mixin rs-button-mode-outline;
|
|
208
|
+
@mixin rs-button-icon-left;
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
#### CSS Vars
|
|
213
|
+
|
|
214
|
+
| Variable | Syntax | Description |
|
|
215
|
+
| --- | --- | --- |
|
|
216
|
+
| `--rs-button-flip-text-color` | `0 \| 1` | The flag whenever the text color should be inverted |
|
|
217
|
+
| `--rs-button-border-radius` | [border-radius](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) | Border-radius of the single-line button |
|
|
218
|
+
| `--rs-button-multiline-border-radius` | [border-radius](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) | Border-radius of the multi-line button |
|
|
219
|
+
| `--rs-button-l-border-radius` | [border-radius](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) | Border-radius of the single-line button for `l` size |
|
|
220
|
+
| `--rs-button-l-multiline-border-radius` | [border-radius](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) | Border-radius of the multi-line button for `l` size |
|
|
221
|
+
| `--rs-button-m-border-radius` | [border-radius](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) | Border-radius of the single-line button for `m` size |
|
|
222
|
+
| `--rs-button-m-multiline-border-radius` | [border-radius](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) | Border-radius of the multi-line button for `m` size |
|
|
223
|
+
| `--rs-button-s-border-radius` | [border-radius](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) | Border-radius of the single-line button for `s` size |
|
|
224
|
+
| `--rs-button-s-multiline-border-radius` | [border-radius](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) | Border-radius of the multi-line button for `s` size |
|
|
225
|
+
| `--rs-button-xs-border-radius` | [border-radius](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) | Border-radius of the single-line button for `xs` size |
|
|
226
|
+
| `--rs-button-xs-multiline-border-radius` | [border-radius](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) | Border-radius of the multi-line button for `xs` size |
|
|
227
|
+
|
|
228
|
+
##### Demo
|
|
229
|
+
|
|
230
|
+
```tsx
|
|
231
|
+
import { Button } from '@rescui/button';
|
|
232
|
+
|
|
233
|
+
<div className="button-customization-example-wrapper-1 rs-docs-row">
|
|
234
|
+
<div className="rs-docs-col">
|
|
235
|
+
<Button size="l">Button L</Button>
|
|
236
|
+
</div>
|
|
237
|
+
<div className="rs-docs-col">
|
|
238
|
+
<Button size="m">Button M</Button>
|
|
239
|
+
</div>
|
|
240
|
+
<div className="rs-docs-col">
|
|
241
|
+
<Button size="s">Button S</Button>
|
|
242
|
+
</div>
|
|
243
|
+
</div>;
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
```postcss attached
|
|
247
|
+
.button-customization-example-wrapper-1 {
|
|
248
|
+
--rs-button-border-radius: 0;
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
```tsx
|
|
253
|
+
import { Button } from '@rescui/button';
|
|
254
|
+
|
|
255
|
+
<div className="button-customization-example-wrapper-2 rs-docs-row">
|
|
256
|
+
<div className="rs-docs-col">
|
|
257
|
+
<Button size="l">Button L</Button>
|
|
258
|
+
</div>
|
|
259
|
+
<div className="rs-docs-col">
|
|
260
|
+
<Button size="m">Button M</Button>
|
|
261
|
+
</div>
|
|
262
|
+
<div className="rs-docs-col">
|
|
263
|
+
<Button size="s">Button S</Button>
|
|
264
|
+
</div>
|
|
265
|
+
</div>;
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
```postcss
|
|
269
|
+
.button-customization-example-wrapper-2 {
|
|
270
|
+
--rs-button-border-radius: 0;
|
|
271
|
+
--rs-button-l-border-radius: 8px;
|
|
272
|
+
--rs-button-s-border-radius: 4px;
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Customizations
|
|
277
|
+
|
|
278
|
+
#### Custom width
|
|
279
|
+
|
|
280
|
+
You can control button width externally via a `width` CSS property. You can also do that by putting it into CSS Flexbox container.
|
|
281
|
+
|
|
282
|
+
```tsx
|
|
283
|
+
import { Button } from '@rescui/button';
|
|
284
|
+
|
|
285
|
+
<Button className={'my-button-with-custom-width'}>Custom width button</Button>;
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
```postcss
|
|
289
|
+
.my-button-with-custom-width {
|
|
290
|
+
width: 300px;
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
##### Adaptive equal width buttons
|
|
295
|
+
|
|
296
|
+
```tsx
|
|
297
|
+
import { useState } from 'react';
|
|
298
|
+
import { createTextCn } from '@rescui/typography';
|
|
299
|
+
import { Button } from '@rescui/button';
|
|
300
|
+
|
|
301
|
+
const ResizeableContainer = ({ children }) => {
|
|
302
|
+
const [width, setWidth] = useState(400);
|
|
303
|
+
|
|
304
|
+
return (
|
|
305
|
+
<div className={createTextCn('light')('rs-text-2')}>
|
|
306
|
+
<input
|
|
307
|
+
type="range"
|
|
308
|
+
min={250}
|
|
309
|
+
max={800}
|
|
310
|
+
onChange={e => setWidth(e.target.value)}
|
|
311
|
+
value={width}
|
|
312
|
+
/>
|
|
313
|
+
<span>Container width: {width}px</span>
|
|
314
|
+
<div
|
|
315
|
+
style={{
|
|
316
|
+
width: `${width}px`,
|
|
317
|
+
marginTop: '24px',
|
|
318
|
+
border: 'dotted 1px red'
|
|
319
|
+
}}
|
|
320
|
+
>
|
|
321
|
+
{children}
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
const AdaptiveButtons = () => (
|
|
328
|
+
<>
|
|
329
|
+
<div className="my-buttons-container">
|
|
330
|
+
<Button className="my-adaptive-button">Sort</Button>
|
|
331
|
+
<Button className="my-adaptive-button">Long long long text</Button>
|
|
332
|
+
</div>
|
|
333
|
+
</>
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
render(
|
|
337
|
+
<ResizeableContainer>
|
|
338
|
+
<AdaptiveButtons />
|
|
339
|
+
</ResizeableContainer>
|
|
340
|
+
);
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
```postcss
|
|
344
|
+
.my-buttons-container {
|
|
345
|
+
display: flex;
|
|
346
|
+
gap: 10px;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.my-adaptive-button {
|
|
350
|
+
flex: 1 1 0;
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
#### Add new icons
|
|
355
|
+
|
|
356
|
+
If you want to add your own icons, make sure they use correct box sizes
|
|
357
|
+
|
|
358
|
+
- 16x16px for xs size
|
|
359
|
+
|
|
360
|
+
- 20x20px for s size
|
|
361
|
+
|
|
362
|
+
- 24x24px for m size
|
|
363
|
+
|
|
364
|
+
- 28x28px for l size
|
|
365
|
+
|
|
366
|
+
Icons should support `className` prop, as well.
|
|
367
|
+
|
|
368
|
+
```tsx
|
|
369
|
+
import { Button } from '@rescui/button';
|
|
370
|
+
|
|
371
|
+
const SettingsIcon = ({ className }) => (
|
|
372
|
+
<svg className={className} width="24" height="24" viewBox="0 0 24 24">
|
|
373
|
+
<path d="M12 3L4 7.5v9l8 4.5 8-4.5v-9zm.01 13.005a4 4 0 1 1 3.998-4 4 4 0 0 1-3.999 4z" />
|
|
374
|
+
</svg>
|
|
375
|
+
);
|
|
376
|
+
|
|
377
|
+
render(
|
|
378
|
+
<div className="rs-docs-row rs-docs-row_vertical-center">
|
|
379
|
+
<Button className="rs-docs-col" icon={<SettingsIcon />}>
|
|
380
|
+
External icon on the left
|
|
381
|
+
</Button>
|
|
382
|
+
<span className="rs-docs-col rs-text-2">or</span>
|
|
383
|
+
<Button
|
|
384
|
+
className="rs-docs-col"
|
|
385
|
+
icon={<SettingsIcon />}
|
|
386
|
+
iconPosition="right"
|
|
387
|
+
>
|
|
388
|
+
External icon on the right
|
|
389
|
+
</Button>
|
|
390
|
+
</div>
|
|
391
|
+
);
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
#### Border-radius customization
|
|
395
|
+
|
|
396
|
+
You can customize border-radius for all and for specific button sizes, using CSS variables:
|
|
397
|
+
|
|
398
|
+
- `--rs-button-border-radius`
|
|
399
|
+
- `--rs-button-xs-border-radius`
|
|
400
|
+
- `--rs-button-s-border-radius`
|
|
401
|
+
- `--rs-button-m-border-radius`
|
|
402
|
+
- `--rs-button-l-border-radius`
|
|
403
|
+
- `--rs-button-multiline-border-radius`
|
|
404
|
+
- `--rs-button-xs-multiline-border-radius`
|
|
405
|
+
- `--rs-button-s-multiline-border-radius`
|
|
406
|
+
- `--rs-button-m-multiline-border-radius`
|
|
407
|
+
- `--rs-button-l-multiline-border-radius`
|
|
408
|
+
|
|
409
|
+
```tsx
|
|
410
|
+
import { Button } from '@rescui/button';
|
|
411
|
+
|
|
412
|
+
<div className="button-customization-example-wrapper-1 rs-docs-row">
|
|
413
|
+
<div className="rs-docs-col">
|
|
414
|
+
<Button size="l">Button L</Button>
|
|
415
|
+
</div>
|
|
416
|
+
<div className="rs-docs-col">
|
|
417
|
+
<Button size="m">Button M</Button>
|
|
418
|
+
</div>
|
|
419
|
+
<div className="rs-docs-col">
|
|
420
|
+
<Button size="s">Button S</Button>
|
|
421
|
+
</div>
|
|
422
|
+
</div>;
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
```postcss
|
|
426
|
+
.button-customization-example-wrapper-1 {
|
|
427
|
+
--rs-button-border-radius: 0;
|
|
428
|
+
}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
```tsx
|
|
432
|
+
import { Button } from '@rescui/button';
|
|
433
|
+
|
|
434
|
+
<div className="button-customization-example-wrapper-2 rs-docs-row">
|
|
435
|
+
<div className="rs-docs-col">
|
|
436
|
+
<Button size="l">Button L</Button>
|
|
437
|
+
</div>
|
|
438
|
+
<div className="rs-docs-col">
|
|
439
|
+
<Button size="m">Button M</Button>
|
|
440
|
+
</div>
|
|
441
|
+
<div className="rs-docs-col">
|
|
442
|
+
<Button size="s">Button S</Button>
|
|
443
|
+
</div>
|
|
444
|
+
</div>;
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
```postcss
|
|
448
|
+
.button-customization-example-wrapper-2 {
|
|
449
|
+
--rs-button-border-radius: 0;
|
|
450
|
+
--rs-button-l-border-radius: 8px;
|
|
451
|
+
--rs-button-s-border-radius: 4px;
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
#### Shifted side
|
|
456
|
+
|
|
457
|
+
Shifted side means that buttons will be shifted to a specific side by the padding value. This feature works only with `Clear` buttons.
|
|
458
|
+
|
|
459
|
+
- **Avoid** mixing `shifted="all"` buttons with any `margin` style names (used in some layout columns) - use wrapper instead.
|
|
460
|
+
- **Avoid** mixing `shifted={side}` buttons with `margin-${side}` style names (used in some layout columns) - use wrapper instead.
|
|
461
|
+
- When shifted buttons overlap, the last one gets the priority.
|
|
462
|
+
- **Use only when necessary**.
|
|
463
|
+
|
|
464
|
+
Examples:
|
|
465
|
+
|
|
466
|
+
```tsx
|
|
467
|
+
import { Button } from '@rescui/button';
|
|
468
|
+
import '@rescui/typography';
|
|
469
|
+
|
|
470
|
+
<div className="rs-text-2">
|
|
471
|
+
<p>Some common text</p>
|
|
472
|
+
<p>
|
|
473
|
+
<Button mode="clear" shifted="left">
|
|
474
|
+
Button
|
|
475
|
+
</Button>
|
|
476
|
+
</p>
|
|
477
|
+
<p>
|
|
478
|
+
<Button mode="clear" shifted="all">
|
|
479
|
+
Hover
|
|
480
|
+
</Button>{' '}
|
|
481
|
+
over the first word.
|
|
482
|
+
</p>
|
|
483
|
+
<p className="rs-docs-offset-top-24">Another common paragraph</p>
|
|
484
|
+
<p>
|
|
485
|
+
<Button mode="clear" shifted={['top', 'bottom', 'left']}>
|
|
486
|
+
Button
|
|
487
|
+
</Button>
|
|
488
|
+
</p>
|
|
489
|
+
<p>Button above has normal line-height</p>
|
|
490
|
+
<p className="rs-docs-offset-top-48">
|
|
491
|
+
<Button mode="clear" shifted="top" size="l">
|
|
492
|
+
Top shifted with offset 48
|
|
493
|
+
</Button>
|
|
494
|
+
</p>
|
|
495
|
+
<p className="rs-docs-offset-top-24">
|
|
496
|
+
<span>
|
|
497
|
+
<Button mode="clear" shifted="left">
|
|
498
|
+
Left col button
|
|
499
|
+
</Button>
|
|
500
|
+
</span>
|
|
501
|
+
<span style={{ float: 'right' }}>
|
|
502
|
+
<Button mode="clear" shifted="right">
|
|
503
|
+
Right col button
|
|
504
|
+
</Button>
|
|
505
|
+
</span>
|
|
506
|
+
</p>
|
|
507
|
+
</div>;
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
##### CSS variables for shifted emulation
|
|
511
|
+
|
|
512
|
+
You may also use following CSS variables to manually shift your button:
|
|
513
|
+
|
|
514
|
+
- `--rs-out-button-vertical-padding`
|
|
515
|
+
- `--rs-out-button-horizontal-padding`
|
|
516
|
+
|
|
517
|
+
```tsx
|
|
518
|
+
import { Button } from '@rescui/button';
|
|
519
|
+
|
|
520
|
+
<div className="shifted-css__wrapper">
|
|
521
|
+
<Button mode={'clear'} className="shifted-css__btn">
|
|
522
|
+
Button
|
|
523
|
+
</Button>
|
|
524
|
+
</div>;
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
```postcss
|
|
528
|
+
.shifted-css__wrapper {
|
|
529
|
+
border: 1px solid black;
|
|
530
|
+
display: inline-block;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.shifted-css__btn {
|
|
534
|
+
margin: calc(-1 * var(--rs-out-button-vertical-padding)) calc(
|
|
535
|
+
-1 * var(--rs-out-button-horizontal-padding)
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
#### Customizing primary color
|
|
541
|
+
|
|
542
|
+
To get the correct primary color variables bundle, use the [primary color tool](/design/colors/primary-tool/).
|
|
543
|
+
|
|
544
|
+
```tsx
|
|
545
|
+
import { Button } from '@rescui/button';
|
|
546
|
+
|
|
547
|
+
render(
|
|
548
|
+
<div>
|
|
549
|
+
<Button>Default primary button</Button>
|
|
550
|
+
<div className="pink-primary" style={{ marginTop: 12 }}>
|
|
551
|
+
<Button>Pink primary button</Button>
|
|
552
|
+
</div>
|
|
553
|
+
<div style={{ marginTop: 12 }}>
|
|
554
|
+
<Button className="green-primary">Green primary button</Button>
|
|
555
|
+
</div>
|
|
556
|
+
</div>
|
|
557
|
+
);
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
```postcss attached
|
|
561
|
+
.pink-primary {
|
|
562
|
+
--rs-color-primary-light-theme: rgb(223, 36, 119);
|
|
563
|
+
--rs-color-primary-t-dim-light-theme: rgba(223, 36, 119, 0.8);
|
|
564
|
+
--rs-color-primary-t-fog-light-theme: rgba(223, 36, 119, 0.2);
|
|
565
|
+
|
|
566
|
+
--rs-color-primary-dark-theme: rgb(223, 36, 119);
|
|
567
|
+
--rs-color-primary-t-dim-dark-theme: rgba(223, 36, 119, 0.8);
|
|
568
|
+
--rs-color-primary-t-fog-dark-theme: rgba(223, 36, 119, 0.2);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.green-primary {
|
|
572
|
+
--rs-color-primary-light-theme: rgb(8, 132, 132);
|
|
573
|
+
--rs-color-primary-t-dim-light-theme: rgba(8, 132, 132, 0.8);
|
|
574
|
+
--rs-color-primary-t-fog-light-theme: rgba(8, 132, 132, 0.2);
|
|
575
|
+
|
|
576
|
+
--rs-color-primary-dark-theme: rgb(8, 132, 132);
|
|
577
|
+
--rs-color-primary-t-dim-dark-theme: rgba(8, 132, 132, 0.8);
|
|
578
|
+
--rs-color-primary-t-fog-dark-theme: rgba(8, 132, 132, 0.2);
|
|
579
|
+
}
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
#### Flipping text color
|
|
583
|
+
|
|
584
|
+
You may also use `--rs-button-flip-text-color` CSS variable to flip the text color of the `mode="classic"` Button:
|
|
585
|
+
|
|
586
|
+
```tsx
|
|
587
|
+
import { Button } from '@rescui/button';
|
|
588
|
+
|
|
589
|
+
<div className="light-green-primary">
|
|
590
|
+
<Button mode={'classic'} className="contrast-button">
|
|
591
|
+
Button
|
|
592
|
+
</Button>
|
|
593
|
+
</div>;
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
```postcss
|
|
597
|
+
.contrast-button {
|
|
598
|
+
--rs-button-flip-text-color: 1;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.light-green-primary {
|
|
602
|
+
--rs-color-primary-light-theme: rgb(71, 224, 84);
|
|
603
|
+
--rs-color-primary-t-dim-light-theme: rgba(71, 224, 84, 0.8);
|
|
604
|
+
--rs-color-primary-t-fog-light-theme: rgba(71, 224, 84, 0.2);
|
|
605
|
+
|
|
606
|
+
--rs-color-primary-dark-theme: rgb(71, 224, 84);
|
|
607
|
+
--rs-color-primary-t-dim-dark-theme: rgba(71, 224, 84, 0.8);
|
|
608
|
+
--rs-color-primary-t-fog-dark-theme: rgba(71, 224, 84, 0.2);
|
|
609
|
+
}
|
|
610
|
+
```
|
package/llm/index.md
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.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
|
"LICENSE.txt"
|
|
13
14
|
],
|
|
14
15
|
"publishConfig": {
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"@babel/runtime-corejs3": "^7.26.0",
|
|
19
|
-
"@rescui/use-resize-observer": "
|
|
20
|
+
"@rescui/use-resize-observer": "0.3.1-RUI-293-Update-menu-component-7a032357e.167+7a032357e",
|
|
20
21
|
"classnames": "^2.2.6"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
@@ -25,11 +26,11 @@
|
|
|
25
26
|
"react": ">=16.8.0 <20"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@rescui/colors": "
|
|
29
|
-
"@rescui/icons": "
|
|
30
|
-
"@rescui/scripts": "
|
|
31
|
-
"@rescui/typography": "
|
|
32
|
-
"@rescui/visual-regression": "
|
|
29
|
+
"@rescui/colors": "0.3.1-RUI-293-Update-menu-component-7a032357e.55+7a032357e",
|
|
30
|
+
"@rescui/icons": "1.7.7-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
|
|
31
|
+
"@rescui/scripts": "0.5.2",
|
|
32
|
+
"@rescui/typography": "0.27.1-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
|
|
33
|
+
"@rescui/visual-regression": "0.1.4",
|
|
33
34
|
"@types/classnames": "^2.2.11"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|
|
@@ -37,5 +38,5 @@
|
|
|
37
38
|
"build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
|
|
38
39
|
},
|
|
39
40
|
"nx": {},
|
|
40
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "7a032357e8f31abbf69e18aa6b7ef2d75e40f42e"
|
|
41
42
|
}
|