@vev/silke 1.1.3 → 1.1.7
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/CHANGELOG.md +34 -0
- package/dist/index.js +40 -38
- package/dist/index.js.LEGAL.txt +12 -0
- package/dist/styles.css +1596 -1036
- package/dist/types/components/index.d.ts +4 -1
- package/dist/types/components/silke-autocomplete-field/autocomplete-types.d.ts +4 -0
- package/dist/types/components/silke-autocomplete-field/index.d.ts +1 -0
- package/dist/types/components/silke-autocomplete-field/silke-autocomplete-field-native.d.ts +60 -0
- package/dist/types/components/silke-autocomplete-field/silke-autocomplete-field.d.ts +3 -0
- package/dist/types/components/silke-autocomplete-field/silke-autocomplete-popup-native.d.ts +15 -0
- package/dist/types/components/silke-button/silke-dropdown-button.d.ts +8 -13
- package/dist/types/components/silke-card/silke-card-grid.d.ts +33 -1
- package/dist/types/components/silke-command-text-field/image-utils.d.ts +20 -0
- package/dist/types/components/silke-command-text-field/index.d.ts +4 -0
- package/dist/types/components/silke-command-text-field/silke-command-parser.d.ts +3 -0
- package/dist/types/components/silke-command-text-field/silke-command-parser.spec.d.ts +1 -0
- package/dist/types/components/silke-command-text-field/silke-command-text-field.d.ts +46 -0
- package/dist/types/components/silke-command-text-field/utils.d.ts +61 -0
- package/dist/types/components/silke-command-text-field/utils.spec.d.ts +1 -0
- package/dist/types/components/silke-conditions-input/utils.d.ts +1 -1
- package/dist/types/components/silke-form-schema/silke-schema-fields.d.ts +1 -0
- package/dist/types/components/silke-image/silke-image.d.ts +2 -1
- package/dist/types/components/silke-list/index.d.ts +1 -0
- package/dist/types/components/silke-list/silke-list-item.d.ts +24 -6
- package/dist/types/components/silke-list/silke-list.d.ts +9 -9
- package/dist/types/components/silke-list/types.d.ts +19 -0
- package/dist/types/components/silke-list/utils.d.ts +3 -0
- package/dist/types/components/silke-navigation-link/silke-navigation-link.d.ts +1 -0
- package/dist/types/components/silke-overflow-menu/silke-overflow-menu.d.ts +6 -1
- package/dist/types/components/silke-popover-native/index.d.ts +1 -0
- package/dist/types/components/silke-popover-native/silke-popover-native.d.ts +37 -0
- package/dist/types/components/silke-popover-native/types.d.ts +6 -0
- package/dist/types/components/silke-popover-native/use-popover-positioning.d.ts +9 -0
- package/dist/types/components/silke-select-field/index.d.ts +1 -0
- package/dist/types/components/silke-select-field/silke-select-field-native.d.ts +4 -0
- package/dist/types/components/silke-shortcut-button/index.d.ts +1 -0
- package/dist/types/components/silke-shortcut-button/silke-shortcut-button.d.ts +15 -0
- package/dist/types/components/silke-tag/silke-tag.d.ts +1 -1
- package/dist/types/icons.d.ts +32 -0
- package/jest.config.js +2 -3
- package/package.json +9 -3
- package/src/_variables.scss +125 -129
- package/src/components/index.ts +4 -1
- package/src/components/silke-action-box/silke-action-box.scss +2 -3
- package/src/components/silke-alert-banner/silke-alert-banner.scss +9 -10
- package/src/components/silke-autocomplete-field/autocomplete-item.tsx +2 -2
- package/src/components/silke-autocomplete-field/autocomplete-types.ts +4 -0
- package/src/components/silke-autocomplete-field/index.ts +1 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-field-native.tsx +346 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.mdx +39 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.scss +18 -12
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +3 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-popup-native.tsx +542 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-popup.tsx +92 -41
- package/src/components/silke-box/silke-box.mdx +321 -21
- package/src/components/silke-box/silke-box.scss +5 -5
- package/src/components/silke-breadcrumbs/silke-breadcrumb.mdx +147 -9
- package/src/components/silke-breadcrumbs/silke-breadcrumb.scss +3 -3
- package/src/components/silke-button/silke-big-button.scss +1 -1
- package/src/components/silke-button/silke-button.scss +27 -18
- package/src/components/silke-button/silke-dropdown-button.mdx +67 -0
- package/src/components/silke-button/silke-dropdown-button.tsx +40 -122
- package/src/components/silke-card/silke-card-grid.tsx +5 -3
- package/src/components/silke-card/silke-card.scss +8 -7
- package/src/components/silke-card/silke-card.tsx +7 -1
- package/src/components/silke-checkbox/silke-checkbox.mdx +139 -14
- package/src/components/silke-checkbox/silke-checkbox.scss +11 -11
- package/src/components/silke-color-picker/color-picker.scss +8 -8
- package/src/components/silke-color-swatches/silke-color-swatches.mdx +130 -0
- package/src/components/silke-command-text-field/image-utils.ts +71 -0
- package/src/components/silke-command-text-field/index.ts +12 -0
- package/src/components/silke-command-text-field/silke-command-parser.spec.ts +89 -0
- package/src/components/silke-command-text-field/silke-command-parser.ts +47 -0
- package/src/components/silke-command-text-field/silke-command-text-field.mdx +301 -0
- package/src/components/silke-command-text-field/silke-command-text-field.module.scss +119 -0
- package/src/components/silke-command-text-field/silke-command-text-field.tsx +665 -0
- package/src/components/silke-command-text-field/utils.spec.ts +366 -0
- package/src/components/silke-command-text-field/utils.ts +287 -0
- package/src/components/silke-conditions-input/silke-conditions-input.scss +4 -4
- package/src/components/silke-content-column/silke-content-column.scss +1 -1
- package/src/components/silke-context-menu/silke-context-menu.scss +3 -4
- package/src/components/silke-context-menu/silke-context-menu.tsx +1 -1
- package/src/components/silke-css-number-field/silke-css-number-field.scss +14 -12
- package/src/components/silke-divider/silke-divider.mdx +154 -32
- package/src/components/silke-divider/silke-divider.scss +3 -2
- package/src/components/silke-drawer/silke-drawer.scss +6 -2
- package/src/components/silke-form/silke-form.mdx +254 -27
- package/src/components/silke-form-schema/fields/array-field-inline.tsx +1 -0
- package/src/components/silke-form-schema/fields/array-field-modal.tsx +1 -0
- package/src/components/silke-form-schema/fields/styles.scss +34 -35
- package/src/components/silke-form-schema/silke-schema-field.tsx +1 -1
- package/src/components/silke-form-schema/silke-schema-fields.tsx +4 -3
- package/src/components/silke-gradient-picker/silke-gradient-picker.module.scss +2 -2
- package/src/components/silke-icon/silke-icon.mdx +212 -8
- package/src/components/silke-icon/silke-icon.scss +10 -2
- package/src/components/silke-icon/silke-icon.tsx +1 -0
- package/src/components/silke-icon/silke-stacked-icon.scss +42 -45
- package/src/components/silke-icon-browser/silke-icon-browser.mdx +143 -0
- package/src/components/silke-image/silke-image-color-backdrop.scss +6 -6
- package/src/components/silke-image/silke-image.mdx +189 -41
- package/src/components/silke-image/silke-image.scss +3 -3
- package/src/components/silke-image/silke-image.tsx +14 -1
- package/src/components/silke-link/silke-link.scss +3 -5
- package/src/components/silke-list/index.ts +1 -0
- package/src/components/silke-list/silke-list-item.mdx +83 -0
- package/src/components/silke-list/silke-list-item.scss +119 -0
- package/src/components/silke-list/silke-list-item.tsx +137 -12
- package/src/components/silke-list/silke-list.mdx +108 -13
- package/src/components/silke-list/silke-list.scss +8 -15
- package/src/components/silke-list/silke-list.tsx +63 -9
- package/src/components/silke-list/types.ts +22 -0
- package/src/components/silke-list/utils.ts +24 -0
- package/src/components/silke-loader/silke-loader.mdx +139 -5
- package/src/components/silke-loader/silke-loader.scss +1 -1
- package/src/components/silke-modal/silke-modal.scss +9 -9
- package/src/components/silke-navigation-link/silke-navigation-link.mdx +27 -2
- package/src/components/silke-navigation-link/silke-navigation-link.scss +34 -40
- package/src/components/silke-navigation-link/silke-navigation-link.tsx +7 -6
- package/src/components/silke-overflow-menu/silke-overflow-menu.mdx +228 -31
- package/src/components/silke-overflow-menu/silke-overflow-menu.scss +8 -8
- package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +14 -8
- package/src/components/silke-popover/silke-popover.scss +5 -5
- package/src/components/silke-popover-native/index.ts +1 -0
- package/src/components/silke-popover-native/silke-popover-native.mdx +207 -0
- package/src/components/silke-popover-native/silke-popover-native.scss +127 -0
- package/src/components/silke-popover-native/silke-popover-native.tsx +176 -0
- package/src/components/silke-popover-native/types.ts +21 -0
- package/src/components/silke-popover-native/use-popover-positioning.ts +157 -0
- package/src/components/silke-progress-indicator/silke-progress-indicator.scss +1 -1
- package/src/components/silke-radio-button/silke-radio-button.scss +18 -11
- package/src/components/silke-search-field/silke-search-field.mdx +161 -7
- package/src/components/silke-select-field/index.ts +1 -0
- package/src/components/silke-select-field/silke-select-field-native.tsx +17 -0
- package/src/components/silke-select-field/silke-select-field.mdx +65 -0
- package/src/components/silke-shortcut-button/index.ts +1 -0
- package/src/components/silke-shortcut-button/silke-shortcut-button.mdx +89 -0
- package/src/components/silke-shortcut-button/silke-shortcut-button.scss +145 -0
- package/src/components/silke-shortcut-button/silke-shortcut-button.tsx +55 -0
- package/src/components/silke-skeleton/silke-skeleton.mdx +109 -0
- package/src/components/silke-skeleton/silke-skeleton.scss +1 -1
- package/src/components/silke-slider/silke-slider.module.scss +19 -19
- package/src/components/silke-sortable-list/silke-nested-sortable-list.scss +3 -3
- package/src/components/silke-sortable-list/silke-sortable-list.scss +4 -5
- package/src/components/silke-table/silke-table.scss +1 -1
- package/src/components/silke-tabs/silke-tabs.scss +3 -3
- package/src/components/silke-tag/silke-tag.mdx +179 -43
- package/src/components/silke-tag/silke-tag.scss +49 -12
- package/src/components/silke-tag/silke-tag.tsx +17 -7
- package/src/components/silke-text/silke-text.scss +6 -4
- package/src/components/silke-text/silke-title.scss +7 -14
- package/src/components/silke-text-field/silke-text-field.scss +9 -9
- package/src/components/silke-text-field/silke-text-field.tsx +3 -2
- package/src/components/silke-tile/silke-tile.scss +7 -3
- package/src/components/silke-toast-notification/silke-toast-notification.scss +4 -5
- package/src/components/silke-toggle/silke-toggle.mdx +163 -33
- package/src/components/silke-toggle/silke-toggle.scss +4 -4
- package/src/components/silke-toolbar/silke-toolbar.scss +1 -1
- package/src/components/silke-tooltip/silke-shortcuts.tsx +3 -3
- package/src/components/silke-tooltip/silke-tooltip.scss +11 -16
- package/src/components/silke-variables-wrapper/silke-variables-wrapper.scss +9 -7
- package/src/components/silke-virtual/silke-virtual.mdx +161 -0
- package/src/components/silke-virtual/silke-virtual.scss +8 -8
- package/src/icons.tsx +45 -1
- package/src/styles/core.scss +42 -45
- package/src/styles/math.scss +66 -66
- package/tsconfig.build.json +2 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +3 -14
- package/dist/types/components/silke-list-card/index.d.ts +0 -1
- package/dist/types/components/silke-list-card/silke-list-card.d.ts +0 -14
- package/src/components/silke-list-card/index.ts +0 -1
- package/src/components/silke-list-card/silke-list-card.mdx +0 -46
- package/src/components/silke-list-card/silke-list-card.scss +0 -57
- package/src/components/silke-list-card/silke-list-card.tsx +0 -63
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# SilkeSkeleton
|
|
2
|
+
|
|
3
|
+
A loading placeholder component that displays animated skeleton screens while content is loading. Use skeletons to reduce perceived loading time and provide visual feedback that content is being loaded.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Animated shimmer**: Smooth left-to-right shimmer animation
|
|
8
|
+
- **Multiple variants**: Single line or multiline paragraph skeletons
|
|
9
|
+
- **Customizable**: Apply custom styles and classes
|
|
10
|
+
- **Accessible**: Provides visual loading feedback
|
|
11
|
+
|
|
12
|
+
## Basic Usage
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
<SilkeSkeleton />
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Multiline Skeleton
|
|
19
|
+
|
|
20
|
+
Use the `multiline` variant for paragraph-style loading placeholders:
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
<SilkeSkeleton kind="multiline" />
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Custom Dimensions
|
|
27
|
+
|
|
28
|
+
Apply custom width and height via the `style` prop:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
<SilkeBox column gap="s">
|
|
32
|
+
<SilkeSkeleton style={{ width: '100%', height: 24 }} />
|
|
33
|
+
<SilkeSkeleton style={{ width: '80%', height: 16 }} />
|
|
34
|
+
<SilkeSkeleton style={{ width: '60%', height: 16 }} />
|
|
35
|
+
</SilkeBox>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Card Loading State
|
|
39
|
+
|
|
40
|
+
Use skeletons to create loading states for cards or complex layouts:
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
<SilkeBox column gap="m" style={{ width: 300 }}>
|
|
44
|
+
<SilkeSkeleton style={{ width: '100%', height: 150 }} />
|
|
45
|
+
<SilkeBox column gap="xs">
|
|
46
|
+
<SilkeSkeleton style={{ width: '70%', height: 20 }} />
|
|
47
|
+
<SilkeSkeleton kind="multiline" />
|
|
48
|
+
</SilkeBox>
|
|
49
|
+
</SilkeBox>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## List Loading State
|
|
53
|
+
|
|
54
|
+
Create loading placeholders for lists:
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
<SilkeBox column gap="s">
|
|
58
|
+
{[1, 2, 3].map((i) => (
|
|
59
|
+
<SilkeBox key={i} gap="s" vAlign="center">
|
|
60
|
+
<SilkeSkeleton style={{ width: 40, height: 40, borderRadius: '50%' }} />
|
|
61
|
+
<SilkeBox column gap="xs" fill>
|
|
62
|
+
<SilkeSkeleton style={{ width: '60%', height: 14 }} />
|
|
63
|
+
<SilkeSkeleton style={{ width: '40%', height: 12 }} />
|
|
64
|
+
</SilkeBox>
|
|
65
|
+
</SilkeBox>
|
|
66
|
+
))}
|
|
67
|
+
</SilkeBox>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Conditional Loading
|
|
71
|
+
|
|
72
|
+
Show skeleton while data is loading:
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
const [loading, setLoading] = React.useState(true);
|
|
76
|
+
|
|
77
|
+
<SilkeBox column gap="s">
|
|
78
|
+
<SilkeButton label={loading ? 'Stop Loading' : 'Start Loading'} onClick={() => setLoading(!loading)} />
|
|
79
|
+
{loading ? (
|
|
80
|
+
<SilkeBox column gap="xs">
|
|
81
|
+
<SilkeSkeleton style={{ width: '50%', height: 24 }} />
|
|
82
|
+
<SilkeSkeleton kind="multiline" />
|
|
83
|
+
</SilkeBox>
|
|
84
|
+
) : (
|
|
85
|
+
<SilkeBox column gap="xs">
|
|
86
|
+
<SilkeText kind="title">Content Loaded</SilkeText>
|
|
87
|
+
<SilkeText>This is the actual content that appears after loading.</SilkeText>
|
|
88
|
+
</SilkeBox>
|
|
89
|
+
)}
|
|
90
|
+
</SilkeBox>;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Props
|
|
94
|
+
|
|
95
|
+
| Prop | Type | Default | Description |
|
|
96
|
+
| ----------- | ------------------------------------------- | ------- | ------------------------------------ |
|
|
97
|
+
| `kind` | `'multiline' \| 'header' \| 'header-text'` | - | Skeleton variant |
|
|
98
|
+
| `className` | `string` | - | Additional CSS class names |
|
|
99
|
+
| `style` | `React.CSSProperties` | - | Inline styles for custom dimensions |
|
|
100
|
+
|
|
101
|
+
The component also accepts all standard HTML `div` attributes.
|
|
102
|
+
|
|
103
|
+
## Animation Details
|
|
104
|
+
|
|
105
|
+
The skeleton uses a 3-second infinite shimmer animation that:
|
|
106
|
+
- Sweeps from left to right
|
|
107
|
+
- Fades opacity from 0.3 to 1.0
|
|
108
|
+
- Reverses direction and sweeps back
|
|
109
|
+
- Creates a smooth loading effect
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
.root {
|
|
2
2
|
--point-size: 14px;
|
|
3
|
-
--track-height:8px;
|
|
3
|
+
--track-height: 8px;
|
|
4
4
|
--track-bg: rgba(var(--color-neutral-100-rgb), var(--opacity-level-light));
|
|
5
5
|
--slider-color: var(--color-accent-30);
|
|
6
6
|
cursor: pointer;
|
|
7
7
|
width: 100%;
|
|
8
|
-
padding: calc(var(--point-size) / 2)
|
|
8
|
+
padding: calc(var(--point-size) / 2) 0;
|
|
9
9
|
border-radius: var(--border-radius-tiny);
|
|
10
|
-
&.disabled{
|
|
11
|
-
--slider-color
|
|
10
|
+
&.disabled {
|
|
11
|
+
--slider-color: var(--color-neutral-60);
|
|
12
12
|
cursor: not-allowed;
|
|
13
|
-
.track{
|
|
13
|
+
.track {
|
|
14
14
|
pointer-events: none;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -21,16 +21,15 @@
|
|
|
21
21
|
background: var(--track-bg);
|
|
22
22
|
position: relative;
|
|
23
23
|
width: 100%;
|
|
24
|
-
border-radius: calc(
|
|
25
|
-
|
|
24
|
+
border-radius: calc(var(--track-height) / 2);
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
.pointHolder{
|
|
27
|
+
.pointHolder {
|
|
29
28
|
position: absolute;
|
|
30
|
-
top:0;
|
|
29
|
+
top: 0;
|
|
31
30
|
left: 0;
|
|
32
31
|
width: calc(100% - var(--point-size));
|
|
33
|
-
height:100%;
|
|
32
|
+
height: 100%;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
.handle {
|
|
@@ -41,27 +40,28 @@
|
|
|
41
40
|
height: var(--point-size);
|
|
42
41
|
top: calc(50% - var(--point-size) / 2);
|
|
43
42
|
border-radius: 50%;
|
|
44
|
-
background:var(--slider-color);
|
|
45
|
-
border:2px solid var(--color-neutral-100);
|
|
46
|
-
&.selected,
|
|
47
|
-
|
|
43
|
+
background: var(--slider-color);
|
|
44
|
+
border: 2px solid var(--color-neutral-100);
|
|
45
|
+
&.selected,
|
|
46
|
+
&:focus-visible {
|
|
47
|
+
outline: 2px solid var(--color-accent-30);
|
|
48
48
|
}
|
|
49
|
-
&:after{
|
|
49
|
+
&:after {
|
|
50
50
|
content: '';
|
|
51
51
|
position: absolute;
|
|
52
|
-
width:24px;
|
|
53
|
-
height:24px;
|
|
52
|
+
width: 24px;
|
|
53
|
+
height: 24px;
|
|
54
54
|
top: calc(50% - 12px);
|
|
55
55
|
left: calc(50% - 12px);
|
|
56
56
|
}
|
|
57
|
-
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
.range {
|
|
61
60
|
position: absolute;
|
|
62
61
|
background: var(--slider-color);
|
|
63
62
|
height: 100%;
|
|
64
|
-
top: 0;
|
|
63
|
+
top: 0;
|
|
64
|
+
left: 0;
|
|
65
65
|
// transition: all 0.4s ease-out;
|
|
66
66
|
pointer-events: none;
|
|
67
67
|
}
|
|
@@ -16,11 +16,11 @@ $border-radius: var(--border-radius-small);
|
|
|
16
16
|
.item {
|
|
17
17
|
&:not(.disabled) {
|
|
18
18
|
&:focus-visible {
|
|
19
|
-
box-shadow:0 0 0 1px solid var(--item-hover-color);
|
|
19
|
+
box-shadow: 0 0 0 1px solid var(--item-hover-color);
|
|
20
20
|
}
|
|
21
21
|
&:hover:not(.selected) {
|
|
22
22
|
// background-color: var(--item-hover-color);
|
|
23
|
-
box-shadow:inset 0 0 0 1px var(--item-hover-color);
|
|
23
|
+
box-shadow: inset 0 0 0 1px var(--item-hover-color);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -73,7 +73,7 @@ $border-radius: var(--border-radius-small);
|
|
|
73
73
|
position: absolute;
|
|
74
74
|
inset: -1px 0 -1px calc(var(--indent-size) + 8px);
|
|
75
75
|
display: block;
|
|
76
|
-
content:
|
|
76
|
+
content: '';
|
|
77
77
|
pointer-events: none;
|
|
78
78
|
transition: all 0.1s ease-out;
|
|
79
79
|
border: 0px solid white;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use
|
|
1
|
+
@use '../../variables' as *;
|
|
2
2
|
.item {
|
|
3
3
|
[data-drag-handle] {
|
|
4
4
|
cursor: grab;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
&.over {
|
|
16
16
|
position: relative;
|
|
17
17
|
&::before {
|
|
18
|
-
content:
|
|
18
|
+
content: '';
|
|
19
19
|
display: block;
|
|
20
20
|
pointer-events: none;
|
|
21
21
|
width: 100%;
|
|
@@ -34,10 +34,9 @@
|
|
|
34
34
|
&.sortAsBox {
|
|
35
35
|
&.over::before {
|
|
36
36
|
height: 100%;
|
|
37
|
-
border:1px solid var(--color-neutral-100);
|
|
38
|
-
background:transparent;
|
|
37
|
+
border: 1px solid var(--color-neutral-100);
|
|
38
|
+
background: transparent;
|
|
39
39
|
border-radius: var(--border-radius-small);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
&.s{
|
|
13
|
+
&.s {
|
|
14
14
|
.tab {
|
|
15
15
|
height: 24px;
|
|
16
|
-
font-size:12px;
|
|
16
|
+
font-size: 12px;
|
|
17
17
|
border-radius: 4px;
|
|
18
18
|
gap: 4px;
|
|
19
19
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
}
|
|
22
22
|
.tab {
|
|
23
23
|
background-color: transparent;
|
|
24
|
-
height:32px;
|
|
24
|
+
height: 32px;
|
|
25
25
|
border: none;
|
|
26
26
|
outline: none;
|
|
27
27
|
color: var(--color-neutral-70);
|
|
@@ -1,77 +1,175 @@
|
|
|
1
|
+
# SilkeTag
|
|
2
|
+
|
|
3
|
+
A compact label component for categorization, status indicators, and metadata display. Tags can be interactive with click handlers, removable with close buttons, and support icons.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Color variants**: Yellow, green, red, gray, blue, purple, dark, and AI gradient
|
|
8
|
+
- **Two kinds**: Primary (filled) and secondary (outlined)
|
|
9
|
+
- **Icons**: Add icons or emoji to tags
|
|
10
|
+
- **Removable**: Optional close button with `onRemove` callback
|
|
11
|
+
- **Clickable**: Make tags interactive with `onClick`
|
|
12
|
+
- **Link support**: Navigate with the `link` prop
|
|
13
|
+
- **Size variants**: Base and tiny sizes
|
|
14
|
+
|
|
15
|
+
## Basic Usage
|
|
16
|
+
|
|
1
17
|
```js
|
|
2
|
-
<SilkeBox
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<SilkeTag color={color} label={ipsum.name(10)} onRemove={() => {}} />
|
|
8
|
-
<SilkeTag color={color} label="Disabled" disabled />
|
|
9
|
-
</SilkeBox>
|
|
10
|
-
))}
|
|
18
|
+
<SilkeBox gap="s">
|
|
19
|
+
<SilkeTag label="Default" />
|
|
20
|
+
<SilkeTag label="Green" color="green" />
|
|
21
|
+
<SilkeTag label="Red" color="red" />
|
|
22
|
+
<SilkeTag label="Blue" color="blue" />
|
|
11
23
|
</SilkeBox>
|
|
12
24
|
```
|
|
13
25
|
|
|
14
|
-
##
|
|
26
|
+
## Color Variants
|
|
15
27
|
|
|
16
28
|
```js
|
|
17
|
-
<SilkeBox gap>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<SilkeTag
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<SilkeTag kind="secondary" label="Emoji" icon="😎" />
|
|
29
|
+
<SilkeBox column gap="s">
|
|
30
|
+
<SilkeBox gap="s" wrap>
|
|
31
|
+
{['gray', 'yellow', 'green', 'red', 'blue', 'purple', 'dark', 'ai'].map((color) => (
|
|
32
|
+
<SilkeTag key={color} color={color} label={color} />
|
|
33
|
+
))}
|
|
34
|
+
</SilkeBox>
|
|
24
35
|
</SilkeBox>
|
|
25
36
|
```
|
|
26
37
|
|
|
27
|
-
##
|
|
38
|
+
## Primary vs Secondary
|
|
28
39
|
|
|
29
40
|
```js
|
|
30
|
-
<SilkeBox gap
|
|
31
|
-
<SilkeBox gap
|
|
32
|
-
<SilkeTag label="Primary
|
|
33
|
-
<SilkeTag
|
|
34
|
-
<SilkeTag
|
|
41
|
+
<SilkeBox column gap="s">
|
|
42
|
+
<SilkeBox gap="s">
|
|
43
|
+
<SilkeTag kind="primary" label="Primary" color="blue" />
|
|
44
|
+
<SilkeTag kind="primary" label="Primary" color="green" />
|
|
45
|
+
<SilkeTag kind="primary" label="Primary" color="red" />
|
|
35
46
|
</SilkeBox>
|
|
36
|
-
<SilkeBox gap
|
|
37
|
-
<SilkeTag kind="secondary" label="Secondary
|
|
38
|
-
<SilkeTag kind="secondary"
|
|
39
|
-
<SilkeTag kind="secondary"
|
|
47
|
+
<SilkeBox gap="s">
|
|
48
|
+
<SilkeTag kind="secondary" label="Secondary" color="blue" />
|
|
49
|
+
<SilkeTag kind="secondary" label="Secondary" color="green" />
|
|
50
|
+
<SilkeTag kind="secondary" label="Secondary" color="red" />
|
|
40
51
|
</SilkeBox>
|
|
41
52
|
</SilkeBox>
|
|
42
53
|
```
|
|
43
54
|
|
|
44
|
-
## With
|
|
55
|
+
## With Icons
|
|
45
56
|
|
|
46
57
|
```js
|
|
47
|
-
<SilkeBox gap>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
<SilkeBox gap="s" wrap>
|
|
59
|
+
<SilkeTag label="Settings" icon="settings" />
|
|
60
|
+
<SilkeTag label="User" icon="user" color="blue" />
|
|
61
|
+
<SilkeTag label="Warning" icon="warning.triangle" color="yellow" />
|
|
62
|
+
<SilkeTag label="Success" icon="check" color="green" />
|
|
63
|
+
<SilkeTag label="Error" icon="error" color="red" />
|
|
53
64
|
</SilkeBox>
|
|
54
65
|
```
|
|
55
66
|
|
|
56
67
|
## Icon Only
|
|
57
68
|
|
|
69
|
+
Tags without labels display as compact square icons:
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
<SilkeBox gap="s">
|
|
73
|
+
<SilkeTag icon="star" color="yellow" />
|
|
74
|
+
<SilkeTag icon="check" color="green" />
|
|
75
|
+
<SilkeTag icon="close" color="red" />
|
|
76
|
+
<SilkeTag icon="user" color="blue" />
|
|
77
|
+
<SilkeTag icon="settings" color="gray" />
|
|
78
|
+
</SilkeBox>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Removable Tags
|
|
82
|
+
|
|
83
|
+
Add an `onRemove` callback to show a close button:
|
|
84
|
+
|
|
58
85
|
```js
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
86
|
+
const [tags, setTags] = React.useState(['React', 'TypeScript', 'Node.js', 'CSS']);
|
|
87
|
+
|
|
88
|
+
<SilkeBox gap="s" wrap>
|
|
89
|
+
{tags.map((tag) => (
|
|
90
|
+
<SilkeTag
|
|
91
|
+
key={tag}
|
|
92
|
+
label={tag}
|
|
93
|
+
color="blue"
|
|
94
|
+
onRemove={() => setTags(tags.filter((t) => t !== tag))}
|
|
95
|
+
/>
|
|
64
96
|
))}
|
|
65
|
-
|
|
66
|
-
|
|
97
|
+
</SilkeBox>;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Secondary with Icon and Remove
|
|
101
|
+
|
|
102
|
+
Secondary tags show the remove button as the icon:
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
<SilkeBox gap="s">
|
|
106
|
+
<SilkeTag kind="secondary" label="Removable" icon="star" color="blue" onRemove={() => {}} />
|
|
107
|
+
<SilkeTag kind="secondary" label="Removable" icon="check" color="green" onRemove={() => {}} />
|
|
108
|
+
</SilkeBox>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Sizes
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
<SilkeBox column gap="s">
|
|
115
|
+
<SilkeBox gap="s" vAlign="center">
|
|
116
|
+
<SilkeTag label="Base size" />
|
|
117
|
+
<SilkeTag label="With icon" icon="star" />
|
|
118
|
+
</SilkeBox>
|
|
119
|
+
<SilkeBox gap="s" vAlign="center">
|
|
120
|
+
<SilkeTag size="tiny" label="Tiny size" />
|
|
121
|
+
<SilkeTag size="tiny" label="With icon" icon="star" />
|
|
67
122
|
</SilkeBox>
|
|
68
123
|
</SilkeBox>
|
|
69
124
|
```
|
|
70
125
|
|
|
71
|
-
##
|
|
126
|
+
## Clickable Tags
|
|
127
|
+
|
|
128
|
+
Make tags interactive with `onClick`:
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
const [selected, setSelected] = React.useState('react');
|
|
132
|
+
const options = ['react', 'vue', 'angular', 'svelte'];
|
|
133
|
+
|
|
134
|
+
<SilkeBox gap="s">
|
|
135
|
+
{options.map((opt) => (
|
|
136
|
+
<SilkeTag
|
|
137
|
+
key={opt}
|
|
138
|
+
label={opt}
|
|
139
|
+
color={selected === opt ? 'blue' : 'gray'}
|
|
140
|
+
onClick={() => setSelected(opt)}
|
|
141
|
+
/>
|
|
142
|
+
))}
|
|
143
|
+
</SilkeBox>;
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Disabled State
|
|
72
147
|
|
|
73
148
|
```js
|
|
74
|
-
<SilkeBox gap>
|
|
149
|
+
<SilkeBox gap="s">
|
|
150
|
+
<SilkeTag label="Enabled" color="blue" />
|
|
151
|
+
<SilkeTag label="Disabled" color="blue" disabled />
|
|
152
|
+
<SilkeTag label="Disabled" color="green" disabled />
|
|
153
|
+
</SilkeBox>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## As Links
|
|
157
|
+
|
|
158
|
+
Navigate to routes using the `link` prop:
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
<SilkeBox gap="s">
|
|
162
|
+
<SilkeTag label="Home" icon="home" link="/" />
|
|
163
|
+
<SilkeTag label="Settings" icon="settings" link="/settings" />
|
|
164
|
+
</SilkeBox>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Shorthand Components
|
|
168
|
+
|
|
169
|
+
Pre-colored tag components for convenience:
|
|
170
|
+
|
|
171
|
+
```js
|
|
172
|
+
<SilkeBox gap="s">
|
|
75
173
|
<SilkeTagDark label="Dark" />
|
|
76
174
|
<SilkeTagYellow label="Yellow" />
|
|
77
175
|
<SilkeTagGreen label="Green" />
|
|
@@ -80,3 +178,41 @@
|
|
|
80
178
|
<SilkeTagBlue label="Blue" />
|
|
81
179
|
</SilkeBox>
|
|
82
180
|
```
|
|
181
|
+
|
|
182
|
+
## Props
|
|
183
|
+
|
|
184
|
+
| Prop | Type | Default | Description |
|
|
185
|
+
| ---------- | --------------------------------- | ----------- | ------------------------------------ |
|
|
186
|
+
| `label` | `React.ReactNode` | - | Tag text content |
|
|
187
|
+
| `color` | `SilkeTagColor` | `'gray'` | Tag color variant |
|
|
188
|
+
| `kind` | `'primary' \| 'secondary'` | `'primary'` | Tag style variant |
|
|
189
|
+
| `size` | `'tiny'` | - | Smaller tag size |
|
|
190
|
+
| `icon` | `SilkeIcons` | - | Icon to display |
|
|
191
|
+
| `disabled` | `boolean` | `false` | Disable tag interactions |
|
|
192
|
+
| `link` | `string` | - | Navigate to route on click |
|
|
193
|
+
| `innerGap` | `BoxSpace` | `'xs'` | Gap between icon and label |
|
|
194
|
+
| `onRemove` | `(e: React.MouseEvent) => void` | - | Show close button and handle removal |
|
|
195
|
+
| `onClick` | `(e: React.MouseEvent) => void` | - | Click handler |
|
|
196
|
+
|
|
197
|
+
Also accepts all `SilkeBox` props.
|
|
198
|
+
|
|
199
|
+
## Types
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
type SilkeTagKind = 'primary' | 'secondary';
|
|
203
|
+
|
|
204
|
+
type SilkeTagColor = 'yellow' | 'green' | 'red' | 'gray' | 'blue' | 'purple' | 'dark' | 'ai';
|
|
205
|
+
|
|
206
|
+
type SilkeTagSize = 'tiny';
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Shorthand Components
|
|
210
|
+
|
|
211
|
+
| Component | Description |
|
|
212
|
+
| ---------------- | ------------------------ |
|
|
213
|
+
| `SilkeTagDark` | Tag with `color="dark"` |
|
|
214
|
+
| `SilkeTagYellow` | Tag with `color="yellow"`|
|
|
215
|
+
| `SilkeTagGreen` | Tag with `color="green"` |
|
|
216
|
+
| `SilkeTagRed` | Tag with `color="red"` |
|
|
217
|
+
| `SilkeTagGray` | Tag with `color="gray"` |
|
|
218
|
+
| `SilkeTagBlue` | Tag with `color="blue"` |
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
.blue {
|
|
35
35
|
--tag-background: var(--color-accent-20-rgb);
|
|
36
|
-
--tag-outline: var(--color-accent-30-rgb)
|
|
36
|
+
--tag-outline: var(--color-accent-30-rgb);
|
|
37
37
|
--tag-button-background: var(--color-accent-20);
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
--tag-button-background: var(--color-neutral-20);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
.ai {
|
|
54
|
+
--tag-color: var(--color-neutral-100);
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
.disabled {
|
|
54
58
|
--tag-background: var(--color-neutral-30-rgb);
|
|
55
59
|
--tag-outline: var(--color-neutral-30-rgb);
|
|
@@ -59,7 +63,7 @@
|
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
.tag {
|
|
62
|
-
background
|
|
66
|
+
background: rgba(var(--tag-background), var(--tag-opacity));
|
|
63
67
|
height: var(--tag-height);
|
|
64
68
|
max-height: var(--tag-height);
|
|
65
69
|
min-width: var(--tag-height);
|
|
@@ -68,13 +72,38 @@
|
|
|
68
72
|
border-radius: calc(var(--tag-height) / 2);
|
|
69
73
|
color: var(--tag-color);
|
|
70
74
|
|
|
75
|
+
&.ai,
|
|
76
|
+
&.secondary.ai {
|
|
77
|
+
border: 1px solid rgba(160, 115, 255, 1);
|
|
78
|
+
background: linear-gradient(
|
|
79
|
+
208deg,
|
|
80
|
+
rgba(160, 115, 255, 0.32) 31.76%,
|
|
81
|
+
rgba(1, 220, 205, 0.32) 123.33%
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
71
85
|
&.secondary {
|
|
72
86
|
--tag-icon-color: rgb(var(--tag-background));
|
|
73
87
|
--tag-color: var(--color-neutral-100);
|
|
74
|
-
background
|
|
88
|
+
background: rgb(var(--color-neutral-30-rgb), 0.72);
|
|
75
89
|
border-radius: var(--border-radius-tiny);
|
|
76
90
|
border: none;
|
|
77
91
|
|
|
92
|
+
&.showRemoveAsIcon {
|
|
93
|
+
.removeButton {
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&:hover {
|
|
98
|
+
.removeButton {
|
|
99
|
+
display: block;
|
|
100
|
+
}
|
|
101
|
+
.tagIcon {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
78
107
|
&.yellow {
|
|
79
108
|
--tag-icon-color: var(--color-warning-30);
|
|
80
109
|
}
|
|
@@ -87,14 +116,14 @@
|
|
|
87
116
|
--tag-icon-color: var(--color-error-40);
|
|
88
117
|
}
|
|
89
118
|
|
|
90
|
-
&.gray{
|
|
119
|
+
&.gray {
|
|
91
120
|
--tag-icon-color: var(--color-neutral-80);
|
|
92
121
|
}
|
|
93
|
-
|
|
122
|
+
|
|
94
123
|
&.blue {
|
|
95
124
|
--tag-icon-color: var(--color-accent-30);
|
|
96
125
|
}
|
|
97
|
-
|
|
126
|
+
|
|
98
127
|
&.dark {
|
|
99
128
|
--tag-icon-color: var(--color-neutral-100);
|
|
100
129
|
}
|
|
@@ -103,17 +132,25 @@
|
|
|
103
132
|
--tag-icon-color: var(--color-support-quaternary-50);
|
|
104
133
|
}
|
|
105
134
|
|
|
106
|
-
|
|
135
|
+
&.ai {
|
|
136
|
+
--tag-icon-color: var(--color-neutral-100);
|
|
137
|
+
}
|
|
107
138
|
}
|
|
108
139
|
|
|
109
140
|
&.selectable {
|
|
110
141
|
cursor: pointer;
|
|
111
142
|
}
|
|
112
143
|
|
|
113
|
-
|
|
114
|
-
|
|
144
|
+
.tagIcon,
|
|
145
|
+
.removeButton {
|
|
115
146
|
width: calc(var(--tag-height) - 8px);
|
|
116
147
|
height: calc(var(--tag-height) - 8px);
|
|
148
|
+
line-height: 12px;
|
|
149
|
+
font-size: 12px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
button {
|
|
153
|
+
color: var(--tag-color);
|
|
117
154
|
background-color: transparent;
|
|
118
155
|
border: none;
|
|
119
156
|
outline: none;
|
|
@@ -122,7 +159,7 @@
|
|
|
122
159
|
margin: 0;
|
|
123
160
|
cursor: pointer;
|
|
124
161
|
&:hover {
|
|
125
|
-
background
|
|
162
|
+
background: var(--tag-button-background);
|
|
126
163
|
}
|
|
127
164
|
}
|
|
128
165
|
.label {
|
|
@@ -144,8 +181,8 @@
|
|
|
144
181
|
padding: 0 4px;
|
|
145
182
|
font-size: 12px;
|
|
146
183
|
}
|
|
147
|
-
.tagIcon{
|
|
148
|
-
font-size:12px;
|
|
184
|
+
.tagIcon {
|
|
185
|
+
font-size: 12px;
|
|
149
186
|
}
|
|
150
187
|
|
|
151
188
|
&.tiny .disabled {
|