@rescui/tag 0.13.7 → 0.13.9-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/index.css +78 -78
- package/lib/index.d.ts +8 -8
- package/lib/parts/base-tag.d.ts +37 -36
- package/lib/parts/base-tag.p.module.css.js +9 -9
- package/lib/parts/presets.d.ts +194 -194
- package/lib/parts/presets.js +40 -40
- package/lib/parts/removable-tag.d.ts +16 -16
- package/lib/parts/removable-tag.p.module.css.js +12 -12
- package/lib/parts/sticky-tag.d.ts +50 -50
- package/lib/parts/sticky-tag.p.module.css.js +11 -11
- package/lib/parts/tag.p.module.css.js +1 -1
- package/lib/tag.d.ts +37 -37
- package/llm/components/tag.md +685 -0
- package/llm/index.md +2 -0
- package/package.json +7 -6
|
@@ -0,0 +1,685 @@
|
|
|
1
|
+
# Tag
|
|
2
|
+
|
|
3
|
+
Tags allow users to filter content, and they can also be useful for drawing attention to particular components.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### Features showcase
|
|
8
|
+
|
|
9
|
+
### Examples
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { Tag, presets } from '@rescui/tag';
|
|
13
|
+
|
|
14
|
+
<Tag {...presets['classic-light']}>Tag</Tag>;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
#### Custom appearance
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { Tag } from '@rescui/tag';
|
|
21
|
+
|
|
22
|
+
<Tag color="white" backgroundColor="purple">
|
|
23
|
+
Tag
|
|
24
|
+
</Tag>;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
#### Custom outline appearance
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { Tag } from '@rescui/tag';
|
|
31
|
+
|
|
32
|
+
<Tag color="black" borderColor="purple">
|
|
33
|
+
Tag
|
|
34
|
+
</Tag>;
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### Preset extension
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { Tag, presets } from '@rescui/tag';
|
|
41
|
+
|
|
42
|
+
<Tag {...presets['classic-light']} backgroundColor="red">
|
|
43
|
+
Tag
|
|
44
|
+
</Tag>;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### Make your own presets set
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Tag, presets as basePresets } from '@rescui/tag';
|
|
51
|
+
|
|
52
|
+
const presets = {
|
|
53
|
+
...basePresets,
|
|
54
|
+
space: { color: 'white', backgroundColor: 'purple' }
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
render(<Tag {...presets.space}>Tag</Tag>);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### Change size
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { Tag, presets } from '@rescui/tag';
|
|
64
|
+
|
|
65
|
+
<Tag {...presets['classic-light']} size="m">
|
|
66
|
+
Tag
|
|
67
|
+
</Tag>;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### Uppercase mode
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { Tag, presets } from '@rescui/tag';
|
|
74
|
+
|
|
75
|
+
<Tag {...presets['classic-light']} isUppercase>
|
|
76
|
+
Tag
|
|
77
|
+
</Tag>;
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### Add icon
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { Tag, presets } from '@rescui/tag';
|
|
84
|
+
import { DownloadOutlineIcon } from '@rescui/icons';
|
|
85
|
+
|
|
86
|
+
<div className="rs-docs-row rs-docs-row_vertical-center">
|
|
87
|
+
<Tag {...presets['classic-light']} className="rs-docs-col" icon={<DownloadOutlineIcon />}>
|
|
88
|
+
Icon on the left
|
|
89
|
+
</Tag>
|
|
90
|
+
<span className="rs-docs-col">or</span>
|
|
91
|
+
<Tag
|
|
92
|
+
{...presets['classic-light']}
|
|
93
|
+
className="rs-docs-col"
|
|
94
|
+
icon={<DownloadOutlineIcon />}
|
|
95
|
+
iconPosition="right"
|
|
96
|
+
>
|
|
97
|
+
Icon on the right
|
|
98
|
+
</Tag>
|
|
99
|
+
</div>;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### Add external icon
|
|
103
|
+
|
|
104
|
+
If you want to add your own icon, please make sure that the icon has `24×24px` box size
|
|
105
|
+
|
|
106
|
+
Also, icon should have one `className` props.
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
import { Tag, presets } from '@rescui/tag';
|
|
110
|
+
|
|
111
|
+
const SettingsIcon = ({ className }) => (
|
|
112
|
+
<svg className={className} width="24" height="24" viewBox="0 0 24 24">
|
|
113
|
+
<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" />
|
|
114
|
+
</svg>
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const Demo = () => (
|
|
118
|
+
<div className="rs-docs-row rs-docs-row_vertical-center">
|
|
119
|
+
<Tag
|
|
120
|
+
{...presets['classic-light']}
|
|
121
|
+
className="rs-docs-col"
|
|
122
|
+
icon={<SettingsIcon />}
|
|
123
|
+
>
|
|
124
|
+
External icon on the left
|
|
125
|
+
</Tag>
|
|
126
|
+
<span className="rs-docs-col">or</span>
|
|
127
|
+
<Tag
|
|
128
|
+
{...presets['classic-light']}
|
|
129
|
+
className="rs-docs-col"
|
|
130
|
+
icon={<SettingsIcon />}
|
|
131
|
+
iconPosition="right"
|
|
132
|
+
>
|
|
133
|
+
External icon on the right
|
|
134
|
+
</Tag>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
render(<Demo />);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## StickyTag
|
|
142
|
+
|
|
143
|
+
### Features showcase
|
|
144
|
+
|
|
145
|
+
### Examples
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
import { StickyTag, presets } from '@rescui/tag';
|
|
149
|
+
import { textCn } from '@rescui/typography';
|
|
150
|
+
import { cardCn } from '@rescui/card';
|
|
151
|
+
|
|
152
|
+
const Demo = () => {
|
|
153
|
+
return (
|
|
154
|
+
<div style={{ width: 300, marginTop: 24 }}>
|
|
155
|
+
<StickyTag content="Sale" {...presets['classic-light']}>
|
|
156
|
+
<div className={cardCn({ theme: 'light' })}>
|
|
157
|
+
<h3 className={textCn('rs-h3')}>Card content</h3>
|
|
158
|
+
<p className={`${textCn('rs-text-2')} rs-docs-offset-top-24`}>
|
|
159
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias
|
|
160
|
+
amet, atque dolore enim eum fuga in itaque iure nisi, nostrum
|
|
161
|
+
numquam odio perspiciatis provident quas quo, ratione saepe sunt.
|
|
162
|
+
Tempora.
|
|
163
|
+
</p>
|
|
164
|
+
</div>
|
|
165
|
+
</StickyTag>
|
|
166
|
+
</div>
|
|
167
|
+
);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
render(<Demo />);
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### Custom appearance
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import { StickyTag } from '@rescui/tag';
|
|
177
|
+
import { textCn } from '@rescui/typography';
|
|
178
|
+
import { cardCn } from '@rescui/card';
|
|
179
|
+
|
|
180
|
+
const Demo = () => {
|
|
181
|
+
return (
|
|
182
|
+
<div style={{ width: 300, marginTop: 24 }}>
|
|
183
|
+
<StickyTag content="Sale" color="white" backgroundColor="purple">
|
|
184
|
+
<div className={cardCn({ theme: 'light' })}>
|
|
185
|
+
<h3 className={textCn('rs-h3')}>Card content</h3>
|
|
186
|
+
<p className={`${textCn('rs-text-2')} rs-docs-offset-top-24`}>
|
|
187
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias
|
|
188
|
+
amet, atque dolore enim eum fuga in itaque iure nisi, nostrum
|
|
189
|
+
numquam odio perspiciatis provident quas quo, ratione saepe sunt.
|
|
190
|
+
Tempora.
|
|
191
|
+
</p>
|
|
192
|
+
</div>
|
|
193
|
+
</StickyTag>
|
|
194
|
+
</div>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
render(<Demo />);
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### Change size
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
import { StickyTag, presets } from '@rescui/tag';
|
|
205
|
+
import { textCn } from '@rescui/typography';
|
|
206
|
+
import { cardCn } from '@rescui/card';
|
|
207
|
+
|
|
208
|
+
const Demo = () => {
|
|
209
|
+
return (
|
|
210
|
+
<div style={{ width: 300, marginTop: 24 }}>
|
|
211
|
+
<StickyTag content="Sale" {...presets['classic-light']} size={'m'}>
|
|
212
|
+
<div className={cardCn({ theme: 'light' })}>
|
|
213
|
+
<h3 className={textCn('rs-h3')}>Card content</h3>
|
|
214
|
+
<p className={`${textCn('rs-text-2')} rs-docs-offset-top-24`}>
|
|
215
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias
|
|
216
|
+
amet, atque dolore enim eum fuga in itaque iure nisi, nostrum
|
|
217
|
+
numquam odio perspiciatis provident quas quo, ratione saepe sunt.
|
|
218
|
+
Tempora.
|
|
219
|
+
</p>
|
|
220
|
+
</div>
|
|
221
|
+
</StickyTag>
|
|
222
|
+
</div>
|
|
223
|
+
);
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
render(<Demo />);
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### Change placement
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
import { StickyTag, presets } from '@rescui/tag';
|
|
233
|
+
import { textCn } from '@rescui/typography';
|
|
234
|
+
import { cardCn } from '@rescui/card';
|
|
235
|
+
|
|
236
|
+
const Demo = () => {
|
|
237
|
+
return (
|
|
238
|
+
<div style={{ width: 300, marginLeft: 24 }}>
|
|
239
|
+
<StickyTag
|
|
240
|
+
content="Sale"
|
|
241
|
+
{...presets['classic-light']}
|
|
242
|
+
placement="left-start"
|
|
243
|
+
>
|
|
244
|
+
<div className={cardCn({ theme: 'light' })}>
|
|
245
|
+
<h3 className={textCn('rs-h3')}>Card content</h3>
|
|
246
|
+
<p className={`${textCn('rs-text-2')} rs-docs-offset-top-24`}>
|
|
247
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias
|
|
248
|
+
amet, atque dolore enim eum fuga in itaque iure nisi, nostrum
|
|
249
|
+
numquam odio perspiciatis provident quas quo, ratione saepe sunt.
|
|
250
|
+
Tempora.
|
|
251
|
+
</p>
|
|
252
|
+
</div>
|
|
253
|
+
</StickyTag>
|
|
254
|
+
</div>
|
|
255
|
+
);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
render(<Demo />);
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### Change align
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
import { StickyTag, presets } from '@rescui/tag';
|
|
265
|
+
import { textCn } from '@rescui/typography';
|
|
266
|
+
import { cardCn } from '@rescui/card';
|
|
267
|
+
|
|
268
|
+
const Demo = () => {
|
|
269
|
+
return (
|
|
270
|
+
<div style={{ width: 300, marginTop: 24 }}>
|
|
271
|
+
<StickyTag content="Sale" {...presets['classic-light']} align="middle">
|
|
272
|
+
<div className={cardCn({ theme: 'light' })}>
|
|
273
|
+
<h3 className={textCn('rs-h3')}>Card content</h3>
|
|
274
|
+
<p className={`${textCn('rs-text-2')} rs-docs-offset-top-24`}>
|
|
275
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias
|
|
276
|
+
amet, atque dolore enim eum fuga in itaque iure nisi, nostrum
|
|
277
|
+
numquam odio perspiciatis provident quas quo, ratione saepe sunt.
|
|
278
|
+
Tempora.
|
|
279
|
+
</p>
|
|
280
|
+
</div>
|
|
281
|
+
</StickyTag>
|
|
282
|
+
</div>
|
|
283
|
+
);
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
render(<Demo />);
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
#### Change offset
|
|
290
|
+
|
|
291
|
+
```tsx
|
|
292
|
+
import { StickyTag, presets } from '@rescui/tag';
|
|
293
|
+
import { textCn } from '@rescui/typography';
|
|
294
|
+
import { cardCn } from '@rescui/card';
|
|
295
|
+
|
|
296
|
+
const Demo = () => {
|
|
297
|
+
return (
|
|
298
|
+
<div style={{ width: 300, marginTop: 24 }}>
|
|
299
|
+
<StickyTag content="Sale" {...presets['classic-light']} offset={16}>
|
|
300
|
+
<div className={cardCn({ theme: 'light' })}>
|
|
301
|
+
<h3 className={textCn('rs-h3')}>Card content</h3>
|
|
302
|
+
<p className={`${textCn('rs-text-2')} rs-docs-offset-top-24`}>
|
|
303
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias
|
|
304
|
+
amet, atque dolore enim eum fuga in itaque iure nisi, nostrum
|
|
305
|
+
numquam odio perspiciatis provident quas quo, ratione saepe sunt.
|
|
306
|
+
Tempora.
|
|
307
|
+
</p>
|
|
308
|
+
</div>
|
|
309
|
+
</StickyTag>
|
|
310
|
+
</div>
|
|
311
|
+
);
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
render(<Demo />);
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
#### Uppercase mode
|
|
318
|
+
|
|
319
|
+
```tsx
|
|
320
|
+
import { StickyTag, presets } from '@rescui/tag';
|
|
321
|
+
import { textCn } from '@rescui/typography';
|
|
322
|
+
import { cardCn } from '@rescui/card';
|
|
323
|
+
|
|
324
|
+
const Demo = () => {
|
|
325
|
+
return (
|
|
326
|
+
<div style={{ width: 300, marginTop: 24 }}>
|
|
327
|
+
<StickyTag content="Sale" {...presets['classic-light']} isUppercase>
|
|
328
|
+
<div className={cardCn({ theme: 'light' })}>
|
|
329
|
+
<h3 className={textCn('rs-h3')}>Card content</h3>
|
|
330
|
+
<p className={`${textCn('rs-text-2')} rs-docs-offset-top-24`}>
|
|
331
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias
|
|
332
|
+
amet, atque dolore enim eum fuga in itaque iure nisi, nostrum
|
|
333
|
+
numquam odio perspiciatis provident quas quo, ratione saepe sunt.
|
|
334
|
+
Tempora.
|
|
335
|
+
</p>
|
|
336
|
+
</div>
|
|
337
|
+
</StickyTag>
|
|
338
|
+
</div>
|
|
339
|
+
);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
render(<Demo />);
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
#### Add icon
|
|
346
|
+
|
|
347
|
+
```tsx
|
|
348
|
+
import { StickyTag, presets } from '@rescui/tag';
|
|
349
|
+
import { textCn } from '@rescui/typography';
|
|
350
|
+
import { cardCn } from '@rescui/card';
|
|
351
|
+
import { PresentIcon } from '@rescui/icons';
|
|
352
|
+
|
|
353
|
+
const Demo = () => {
|
|
354
|
+
return (
|
|
355
|
+
<div style={{ width: 300, marginTop: 24 }}>
|
|
356
|
+
<StickyTag
|
|
357
|
+
content="Sale"
|
|
358
|
+
{...presets['classic-light']}
|
|
359
|
+
icon={<PresentIcon />}
|
|
360
|
+
>
|
|
361
|
+
<div className={cardCn({ theme: 'light' })}>
|
|
362
|
+
<h3 className={textCn('rs-h3')}>Card content</h3>
|
|
363
|
+
<p className={`${textCn('rs-text-2')} rs-docs-offset-top-24`}>
|
|
364
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias
|
|
365
|
+
amet, atque dolore enim eum fuga in itaque iure nisi, nostrum
|
|
366
|
+
numquam odio perspiciatis provident quas quo, ratione saepe sunt.
|
|
367
|
+
Tempora.
|
|
368
|
+
</p>
|
|
369
|
+
</div>
|
|
370
|
+
</StickyTag>
|
|
371
|
+
</div>
|
|
372
|
+
);
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
render(<Demo />);
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## RemovableTag
|
|
379
|
+
|
|
380
|
+
### Features showcase
|
|
381
|
+
|
|
382
|
+
### Examples
|
|
383
|
+
|
|
384
|
+
`onRemoveClick` is a required prop.
|
|
385
|
+
|
|
386
|
+
```tsx
|
|
387
|
+
import { RemovableTag } from '@rescui/tag';
|
|
388
|
+
|
|
389
|
+
<RemovableTag onRemoveClick={() => console.log('removed')}>
|
|
390
|
+
Test Tag
|
|
391
|
+
</RemovableTag>;
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
#### Change size
|
|
395
|
+
|
|
396
|
+
```tsx
|
|
397
|
+
import { RemovableTag } from '@rescui/tag';
|
|
398
|
+
|
|
399
|
+
<RemovableTag size="m" onRemoveClick={() => console.log('removed')}>
|
|
400
|
+
Small Tag
|
|
401
|
+
</RemovableTag>;
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
#### Disabled
|
|
405
|
+
|
|
406
|
+
```tsx
|
|
407
|
+
import { RemovableTag } from '@rescui/tag';
|
|
408
|
+
|
|
409
|
+
<RemovableTag disabled onRemoveClick={() => console.log('removed')}>
|
|
410
|
+
Disabled Tag
|
|
411
|
+
</RemovableTag>;
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
#### With icon
|
|
415
|
+
|
|
416
|
+
```tsx
|
|
417
|
+
import { RemovableTag } from '@rescui/tag';
|
|
418
|
+
import { PersonOutlineIcon } from '@rescui/icons';
|
|
419
|
+
|
|
420
|
+
<RemovableTag icon={<PersonOutlineIcon />} onRemoveClick={() => console.log('removed')}>
|
|
421
|
+
Tag
|
|
422
|
+
</RemovableTag>;
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
## CSS Mixins API
|
|
426
|
+
|
|
427
|
+
#### `Tag` mixins
|
|
428
|
+
|
|
429
|
+
| Mixin name | Details |
|
|
430
|
+
| --- | --- |
|
|
431
|
+
| `rs-tag-size-xs` | prop: `size`<br><br>value: `"xs"` |
|
|
432
|
+
| `rs-tag-size-s` | prop: `size`<br><br>value: `"s"` |
|
|
433
|
+
| `rs-tag-size-m` | prop: `size`<br><br>value: `"m"` |
|
|
434
|
+
| `rs-tag-size-l` | prop: `size`<br><br>value: `"l"` |
|
|
435
|
+
| `rs-tag-align-icon-left` | prop: `iconPosition`<br><br>value: `"left"` |
|
|
436
|
+
| `rs-tag-align-icon-right` | prop: `iconPosition`<br><br>value: `"right"` |
|
|
437
|
+
| `rs-tag-uppercase-true` | prop: `isUppercase`<br><br>value: `true` |
|
|
438
|
+
| `rs-tag-uppercase-false` | prop: `isUppercase`<br><br>value: `false` |
|
|
439
|
+
|
|
440
|
+
##### Demo
|
|
441
|
+
|
|
442
|
+
Instead of separate classes, it may be a single class with `@media` queries inside:
|
|
443
|
+
|
|
444
|
+
```tsx
|
|
445
|
+
import { Tag, presets } from '@rescui/tag';
|
|
446
|
+
import { PersonIcon } from '@rescui/icons';
|
|
447
|
+
|
|
448
|
+
const MyTag = ({ className }) => {
|
|
449
|
+
return (
|
|
450
|
+
<div style={{ padding: 12, backgroundColor: 'var(--rs-color-black-t5)' }}>
|
|
451
|
+
<Tag
|
|
452
|
+
{...presets['classic-light']}
|
|
453
|
+
size={'m'}
|
|
454
|
+
icon={<PersonIcon />}
|
|
455
|
+
className={className}
|
|
456
|
+
>
|
|
457
|
+
Tag
|
|
458
|
+
</Tag>
|
|
459
|
+
</div>
|
|
460
|
+
);
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
render(
|
|
464
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
|
|
465
|
+
<div>
|
|
466
|
+
<p>Default:</p>
|
|
467
|
+
<MyTag />
|
|
468
|
+
</div>
|
|
469
|
+
<div>
|
|
470
|
+
<p>Var1:</p>
|
|
471
|
+
<MyTag className={`my-tag-var-1`} />
|
|
472
|
+
</div>
|
|
473
|
+
<div>
|
|
474
|
+
<p>Var1 & Var2 combined:</p>
|
|
475
|
+
<MyTag className={`my-tag-var-1 my-tag-var-2`} />
|
|
476
|
+
</div>
|
|
477
|
+
</div>
|
|
478
|
+
);
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
```postcss
|
|
482
|
+
@import '@rescui/tag/lib/public-api.p.css';
|
|
483
|
+
|
|
484
|
+
.my-tag-var-1 {
|
|
485
|
+
@mixin rs-tag-size-l;
|
|
486
|
+
@mixin rs-tag-align-icon-right;
|
|
487
|
+
@mixin rs-tag-uppercase-true;
|
|
488
|
+
}
|
|
489
|
+
.my-tag-var-2 {
|
|
490
|
+
@mixin rs-tag-size-xs;
|
|
491
|
+
@mixin rs-tag-align-icon-left;
|
|
492
|
+
@mixin rs-tag-uppercase-false;
|
|
493
|
+
}
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
#### `StickyTag` mixins
|
|
497
|
+
|
|
498
|
+
| Mixin name | Details |
|
|
499
|
+
| --- | --- |
|
|
500
|
+
| `rs-sticky-tag-size-xs` | prop: `size`<br><br>value: `"xs"` |
|
|
501
|
+
| `rs-sticky-tag-size-s` | prop: `size`<br><br>value: `"s"` |
|
|
502
|
+
| `rs-sticky-tag-size-m` | prop: `size`<br><br>value: `"m"` |
|
|
503
|
+
| `rs-sticky-tag-size-l` | prop: `size`<br><br>value: `"l"` |
|
|
504
|
+
| `rs-sticky-tag-align-icon-left` | prop: `iconPosition`<br><br>value: `"left"` |
|
|
505
|
+
| `rs-sticky-tag-align-icon-right` | prop: `iconPosition`<br><br>value: `"right"` |
|
|
506
|
+
| `rs-sticky-tag-uppercase-true` | prop: `isUppercase`<br><br>value: `true` |
|
|
507
|
+
| `rs-sticky-tag-uppercase-false` | prop: `isUppercase`<br><br>value: `false` |
|
|
508
|
+
| `rs-sticky-tag-offset-16` | prop: `offset`<br><br>value: `16` |
|
|
509
|
+
| `rs-sticky-tag-offset-24` | prop: `offset`<br><br>value: `24` |
|
|
510
|
+
| `rs-sticky-tag-offset-32` | prop: `offset`<br><br>value: `32` |
|
|
511
|
+
| `rs-sticky-tag-align-top` | prop: `align`<br><br>value: `"top"` |
|
|
512
|
+
| `rs-sticky-tag-align-middle` | prop: `align`<br><br>value: `"middle"` |
|
|
513
|
+
| `rs-sticky-tag-placement-top-start` | prop: `placement`<br><br>value: `"top-start"` |
|
|
514
|
+
| `rs-sticky-tag-placement-top-end` | prop: `placement`<br><br>value: `"top-end"` |
|
|
515
|
+
| `rs-sticky-tag-placement-left-start` | prop: `placement`<br><br>value: `"left-start"` |
|
|
516
|
+
| `rs-sticky-tag-placement-left-end` | prop: `placement`<br><br>value: `"left-end"` |
|
|
517
|
+
|
|
518
|
+
##### Demo
|
|
519
|
+
|
|
520
|
+
Instead of separate classes, it may be a single class with `@media` queries inside:
|
|
521
|
+
|
|
522
|
+
```tsx
|
|
523
|
+
import { StickyTag, presets } from '@rescui/tag';
|
|
524
|
+
import { PersonIcon } from '@rescui/icons';
|
|
525
|
+
import { textCn } from '@rescui/typography';
|
|
526
|
+
import { cardCn } from '@rescui/card';
|
|
527
|
+
|
|
528
|
+
const MyStickyTag = ({ className }) => {
|
|
529
|
+
return (
|
|
530
|
+
<div style={{ padding: 12, backgroundColor: 'var(--rs-color-black-t5)', maxWidth: 400 }}>
|
|
531
|
+
<StickyTag
|
|
532
|
+
content="Sale"
|
|
533
|
+
{...presets['classic-light']}
|
|
534
|
+
icon={<PersonIcon />}
|
|
535
|
+
className={className}
|
|
536
|
+
>
|
|
537
|
+
<div className={cardCn({ theme: 'light' })}>
|
|
538
|
+
<h3 className={textCn('rs-h3')}>Card content</h3>
|
|
539
|
+
<p className={`${textCn('rs-text-2')} rs-docs-offset-top-24`}>
|
|
540
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias
|
|
541
|
+
amet, atque dolore enim eum fuga in itaque iure nisi, nostrum
|
|
542
|
+
numquam odio perspiciatis provident quas quo, ratione saepe sunt.
|
|
543
|
+
Tempora.
|
|
544
|
+
</p>
|
|
545
|
+
</div>
|
|
546
|
+
</StickyTag>
|
|
547
|
+
</div>
|
|
548
|
+
);
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
render(
|
|
552
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
|
|
553
|
+
<div>
|
|
554
|
+
<p>Default:</p>
|
|
555
|
+
<MyStickyTag />
|
|
556
|
+
</div>
|
|
557
|
+
<div>
|
|
558
|
+
<p>Var1:</p>
|
|
559
|
+
<MyStickyTag className={`my-sticky-tag-var-1`} />
|
|
560
|
+
</div>
|
|
561
|
+
<div>
|
|
562
|
+
<p>Var1 & Var2 combined:</p>
|
|
563
|
+
<MyStickyTag className={`my-sticky-tag-var-1 my-sticky-tag-var-2`} />
|
|
564
|
+
</div>
|
|
565
|
+
</div>
|
|
566
|
+
);
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
```postcss attached
|
|
570
|
+
@import '@rescui/tag/lib/public-api.p.css';
|
|
571
|
+
|
|
572
|
+
.my-sticky-tag-var-1 {
|
|
573
|
+
@mixin rs-sticky-tag-size-l;
|
|
574
|
+
@mixin rs-sticky-tag-align-icon-right;
|
|
575
|
+
@mixin rs-sticky-tag-uppercase-true;
|
|
576
|
+
@mixin rs-sticky-tag-offset-32;
|
|
577
|
+
@mixin rs-sticky-tag-align-middle;
|
|
578
|
+
@mixin rs-sticky-tag-placement-top-start;
|
|
579
|
+
}
|
|
580
|
+
.my-sticky-tag-var-2 {
|
|
581
|
+
@mixin rs-sticky-tag-size-m;
|
|
582
|
+
@mixin rs-sticky-tag-align-icon-left;
|
|
583
|
+
@mixin rs-sticky-tag-uppercase-false;
|
|
584
|
+
@mixin rs-sticky-tag-offset-16;
|
|
585
|
+
@mixin rs-sticky-tag-align-top;
|
|
586
|
+
@mixin rs-sticky-tag-placement-left-end;
|
|
587
|
+
}
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
#### `RemovableTag` mixins
|
|
591
|
+
|
|
592
|
+
| Mixin name | Details |
|
|
593
|
+
| --- | --- |
|
|
594
|
+
| `rs-removable-tag-size-xs` | prop: `size`<br><br>value: `"xs"` |
|
|
595
|
+
| `rs-removable-tag-size-s` | prop: `size`<br><br>value: `"s"` |
|
|
596
|
+
| `rs-removable-tag-size-m` | prop: `size`<br><br>value: `"m"` |
|
|
597
|
+
| `rs-removable-tag-size-l` | prop: `size`<br><br>value: `"l"` |
|
|
598
|
+
|
|
599
|
+
##### Demo
|
|
600
|
+
|
|
601
|
+
Instead of separate classes, it may be a single class with `@media` queries inside:
|
|
602
|
+
|
|
603
|
+
```tsx
|
|
604
|
+
import { RemovableTag } from '@rescui/tag';
|
|
605
|
+
|
|
606
|
+
const MyRemovableTag = ({ className }) => {
|
|
607
|
+
return (
|
|
608
|
+
<div
|
|
609
|
+
style={{
|
|
610
|
+
padding: 12,
|
|
611
|
+
backgroundColor: 'var(--rs-color-black-t5)'
|
|
612
|
+
}}
|
|
613
|
+
>
|
|
614
|
+
<RemovableTag
|
|
615
|
+
onRemoveClick={() => console.log('removed')}
|
|
616
|
+
className={className}
|
|
617
|
+
>
|
|
618
|
+
Test Tag
|
|
619
|
+
</RemovableTag>
|
|
620
|
+
</div>
|
|
621
|
+
);
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
render(
|
|
625
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
|
|
626
|
+
<div>
|
|
627
|
+
<p>Default:</p>
|
|
628
|
+
<MyRemovableTag />
|
|
629
|
+
</div>
|
|
630
|
+
<div>
|
|
631
|
+
<p>Var1:</p>
|
|
632
|
+
<MyRemovableTag className={`my-removable-tag-var-1`} />
|
|
633
|
+
</div>
|
|
634
|
+
<div>
|
|
635
|
+
<p>Var1 & Var2 combined:</p>
|
|
636
|
+
<MyRemovableTag
|
|
637
|
+
className={`my-removable-tag-var-1 my-removable-tag-var-2`}
|
|
638
|
+
/>
|
|
639
|
+
</div>
|
|
640
|
+
</div>
|
|
641
|
+
);
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
```postcss
|
|
645
|
+
@import '@rescui/tag/lib/public-api.p.css';
|
|
646
|
+
|
|
647
|
+
.my-removable-tag-var-1 {
|
|
648
|
+
@mixin rs-removable-tag-size-l;
|
|
649
|
+
}
|
|
650
|
+
.my-removable-tag-var-2 {
|
|
651
|
+
@mixin rs-removable-tag-size-m;
|
|
652
|
+
}
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
## Presets
|
|
656
|
+
|
|
657
|
+
### Presets
|
|
658
|
+
|
|
659
|
+
Use presets for styling tags when possible.
|
|
660
|
+
|
|
661
|
+
#### Example
|
|
662
|
+
|
|
663
|
+
```tsx
|
|
664
|
+
import { Tag, presets } from '@rescui/tag';
|
|
665
|
+
|
|
666
|
+
<Tag {...presets['classic-light']}>Tag</Tag>;
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
#### For light theme
|
|
670
|
+
|
|
671
|
+
| Name | Type | Default | Description |
|
|
672
|
+
| --- | --- | --- | --- |
|
|
673
|
+
| `classic-light` | { color: "#FFFFFF"; backgroundColor: "var(--rs-color-primary-light-theme, #6B57FF)"; } | | Primary background |
|
|
674
|
+
| `rock-light` | { color: "#FFFFFF"; backgroundColor: "#19191C"; } | | Contrast background |
|
|
675
|
+
| `filled-light` | { color: "rgba(25,25,28,0.7)"; backgroundColor: "rgba(25,25,28,0.1)"; } | | Grey background |
|
|
676
|
+
| `outline-light` | { color: "#19191C"; borderColor: "#19191C"; } | | Transparent with border |
|
|
677
|
+
|
|
678
|
+
#### For dark theme
|
|
679
|
+
|
|
680
|
+
| Name | Type | Default | Description |
|
|
681
|
+
| --- | --- | --- | --- |
|
|
682
|
+
| `classic-dark` | { color: "#FFFFFF"; backgroundColor: "var(--rs-color-primary-dark-theme, #8473FF)"; } | | Primary background |
|
|
683
|
+
| `rock-dark` | { color: "#19191C"; backgroundColor: "#FFFFFF"; } | | Contrast background |
|
|
684
|
+
| `filled-dark` | { color: "rgba(255,255,255,0.7)"; backgroundColor: "rgba(255,255,255,0.1)"; } | | Grey background |
|
|
685
|
+
| `outline-dark` | { color: "#FFFFFF"; borderColor: "#FFFFFF"; } | | Transparent with border |
|
package/llm/index.md
ADDED