@vev/silke 1.1.6 → 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 +8 -0
- package/dist/index.js +35 -35
- package/dist/index.js.LEGAL.txt +12 -12
- package/dist/styles.css +4416 -4020
- package/dist/types/components/index.d.ts +3 -2
- 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-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/silke-popover-native.d.ts +3 -1
- 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 +30 -0
- package/jest.config.js +2 -3
- package/package.json +7 -2
- package/src/_variables.scss +125 -129
- package/src/components/index.ts +3 -2
- 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/silke-autocomplete-field.scss +18 -12
- package/src/components/silke-autocomplete-field/silke-autocomplete-popup-native.tsx +3 -2
- package/src/components/silke-autocomplete-field/silke-autocomplete-popup.tsx +63 -44
- 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 +24 -15
- 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-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/silke-popover-native.scss +93 -78
- package/src/components/silke-popover-native/silke-popover-native.tsx +4 -0
- package/src/components/silke-popover-native/use-popover-positioning.ts +1 -3
- 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-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 +1 -1
- 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 +43 -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-action-list/index.d.ts +0 -1
- package/dist/types/components/silke-action-list/silke-action-list.d.ts +0 -11
- 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-action-list/index.ts +0 -1
- package/src/components/silke-action-list/silke-action-list.mdx +0 -48
- package/src/components/silke-action-list/silke-action-list.scss +0 -21
- package/src/components/silke-action-list/silke-action-list.tsx +0 -85
- 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
|
@@ -1,53 +1,52 @@
|
|
|
1
1
|
.image {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
width: 24px;
|
|
3
|
+
height: 24px;
|
|
4
|
+
object-fit: cover;
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
margin-right: 10px;
|
|
7
|
+
background: #333;
|
|
8
|
+
text-align: center;
|
|
9
|
+
vertical-align: middle;
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.icon {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
width: 24px;
|
|
17
|
+
height: 24px;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.arrayItem {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
&:hover {
|
|
25
|
-
background-color: var(--neutral-20);
|
|
21
|
+
padding: 4px 0;
|
|
22
|
+
border-radius: 4px;
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
24
|
+
&:hover {
|
|
25
|
+
background-color: var(--neutral-20);
|
|
31
26
|
|
|
32
27
|
& .arrayItemButtons {
|
|
33
|
-
|
|
34
|
-
transition: opacity 400ms;
|
|
35
|
-
margin-right: 10px;
|
|
28
|
+
opacity: 1;
|
|
36
29
|
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
& .arrayItemButtons {
|
|
33
|
+
opacity: 0;
|
|
34
|
+
transition: opacity 400ms;
|
|
35
|
+
margin-right: 10px;
|
|
36
|
+
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.imageField__actions {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 4%;
|
|
42
|
+
right: 4%;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
45
|
.arrayFieldModal {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
width: 256px;
|
|
47
|
+
border-radius: 8px;
|
|
48
|
+
border-right: 1px solid var(--color-neutral-0);
|
|
49
|
+
padding-bottom: 16px;
|
|
50
|
+
max-height: 100vh;
|
|
51
|
+
overflow: auto;
|
|
53
52
|
}
|
|
@@ -12,12 +12,13 @@ type SilkeSchemaFieldsProps<T extends { [key: string]: any }> = {
|
|
|
12
12
|
row?: boolean;
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
readonly?: boolean;
|
|
15
|
+
itemIndex?: number;
|
|
15
16
|
} & SilkeFormProps<T>;
|
|
16
17
|
|
|
17
18
|
export function SilkeSchemaFields<T extends { [key: string]: any }>(
|
|
18
19
|
props: SilkeSchemaFieldsProps<T>,
|
|
19
20
|
) {
|
|
20
|
-
const { schema = [], row, ...rest } = props;
|
|
21
|
+
const { schema = [], row, itemIndex, ...rest } = props;
|
|
21
22
|
const context = useSchemaContext();
|
|
22
23
|
const [filteredSchema, setFilteredSchema] = useState(schema);
|
|
23
24
|
|
|
@@ -25,7 +26,7 @@ export function SilkeSchemaFields<T extends { [key: string]: any }>(
|
|
|
25
26
|
useEffect(() => {
|
|
26
27
|
const isHidden = async (field: VevProps) => {
|
|
27
28
|
if (isFunction(field?.hidden)) {
|
|
28
|
-
return await field?.hidden(context);
|
|
29
|
+
return await field?.hidden(context, itemIndex);
|
|
29
30
|
} else if (field?.hidden) {
|
|
30
31
|
return true;
|
|
31
32
|
}
|
|
@@ -44,7 +45,7 @@ export function SilkeSchemaFields<T extends { [key: string]: any }>(
|
|
|
44
45
|
}) as VevProps[];
|
|
45
46
|
setFilteredSchema(filtered);
|
|
46
47
|
});
|
|
47
|
-
}, [context, schema]);
|
|
48
|
+
}, [context, schema, itemIndex]);
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
51
|
<SilkeBox flex column={!row} gap="s" vPad="s" style={{ width: '100%' }}>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
&::before {
|
|
36
|
-
content:
|
|
36
|
+
content: '';
|
|
37
37
|
position: absolute;
|
|
38
38
|
width: var(--dot-size);
|
|
39
39
|
height: var(--dot-size);
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
&.circle {
|
|
45
45
|
--angle: 0deg;
|
|
46
46
|
border-radius: 50%;
|
|
47
|
-
display:flex;
|
|
47
|
+
display: flex;
|
|
48
48
|
flex-direction: column;
|
|
49
49
|
justify-content: center;
|
|
50
50
|
align-items: center;
|
|
@@ -1,19 +1,223 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SilkeIcon
|
|
2
|
+
|
|
3
|
+
A versatile icon component that supports multiple icon sources including the built-in icon library, custom React elements, emoji icons, and external image URLs.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Built-in icons**: Access 100+ icons from the Silke icon library
|
|
8
|
+
- **Theme colors**: Apply any Silke color to icons
|
|
9
|
+
- **Custom icons**: Pass React elements as icons
|
|
10
|
+
- **Emoji support**: Render emoji characters and shapes
|
|
11
|
+
- **URL images**: Load icons from external URLs
|
|
12
|
+
- **Sizing**: Control size via font-size
|
|
13
|
+
|
|
14
|
+
## Basic Usage
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
<SilkeBox gap="m">
|
|
18
|
+
<SilkeIcon icon="add" />
|
|
19
|
+
<SilkeIcon icon="edit" />
|
|
20
|
+
<SilkeIcon icon="delete" />
|
|
21
|
+
<SilkeIcon icon="check" />
|
|
22
|
+
<SilkeIcon icon="close" />
|
|
23
|
+
</SilkeBox>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Icon Browser
|
|
27
|
+
|
|
28
|
+
Search and browse all available icons:
|
|
2
29
|
|
|
3
30
|
```js
|
|
4
31
|
const [search, setSearch] = React.useState('');
|
|
5
|
-
<SilkeBox column>
|
|
6
|
-
<SilkeSearchField placeholder="Search for icons" value={search} onChange={setSearch} />
|
|
7
32
|
|
|
8
|
-
|
|
33
|
+
<SilkeBox column gap="s">
|
|
34
|
+
<SilkeSearchField placeholder="Search for icons" value={search} onChange={setSearch} />
|
|
35
|
+
<SilkeBox gap wrap style={{ maxHeight: 300, overflow: 'auto' }}>
|
|
9
36
|
{Object.keys(SilkeIconDefinitions)
|
|
10
|
-
.filter((icon) => icon.includes(search))
|
|
37
|
+
.filter((icon) => icon.toLowerCase().includes(search.toLowerCase()))
|
|
11
38
|
.map((icon) => (
|
|
12
|
-
<SilkeBox key={icon} gap vPad="s" style={{ width:
|
|
13
|
-
<SilkeIcon
|
|
14
|
-
<
|
|
39
|
+
<SilkeBox key={icon} gap="s" vPad="s" vAlign="center" style={{ width: 180 }}>
|
|
40
|
+
<SilkeIcon icon={icon} style={{ fontSize: 20 }} />
|
|
41
|
+
<SilkeText size="s">{icon}</SilkeText>
|
|
15
42
|
</SilkeBox>
|
|
16
43
|
))}
|
|
17
44
|
</SilkeBox>
|
|
18
45
|
</SilkeBox>;
|
|
19
46
|
```
|
|
47
|
+
|
|
48
|
+
## Icon Colors
|
|
49
|
+
|
|
50
|
+
Apply theme colors using the `color` prop:
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
<SilkeBox gap="m">
|
|
54
|
+
<SilkeIcon icon="star" color="accent-50" style={{ fontSize: 24 }} />
|
|
55
|
+
<SilkeIcon icon="check" color="success-50" style={{ fontSize: 24 }} />
|
|
56
|
+
<SilkeIcon icon="error" color="error-50" style={{ fontSize: 24 }} />
|
|
57
|
+
<SilkeIcon icon="warning.triangle" color="warning-50" style={{ fontSize: 24 }} />
|
|
58
|
+
<SilkeIcon icon="tooltip" color="neutral-60" style={{ fontSize: 24 }} />
|
|
59
|
+
</SilkeBox>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Icon Sizes
|
|
63
|
+
|
|
64
|
+
Control icon size using CSS `fontSize`:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
<SilkeBox gap="m" vAlign="end">
|
|
68
|
+
<SilkeIcon icon="star" style={{ fontSize: 12 }} />
|
|
69
|
+
<SilkeIcon icon="star" style={{ fontSize: 16 }} />
|
|
70
|
+
<SilkeIcon icon="star" style={{ fontSize: 24 }} />
|
|
71
|
+
<SilkeIcon icon="star" style={{ fontSize: 32 }} />
|
|
72
|
+
<SilkeIcon icon="star" style={{ fontSize: 48 }} />
|
|
73
|
+
</SilkeBox>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Custom React Element
|
|
77
|
+
|
|
78
|
+
Pass a React element as the icon:
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
const CustomIcon = () => (
|
|
82
|
+
<svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor">
|
|
83
|
+
<circle cx="12" cy="12" r="10" />
|
|
84
|
+
</svg>
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
<SilkeBox gap="m">
|
|
88
|
+
<SilkeIcon icon={<CustomIcon />} style={{ fontSize: 24 }} />
|
|
89
|
+
<SilkeIcon icon={<CustomIcon />} color="accent-50" style={{ fontSize: 32 }} />
|
|
90
|
+
</SilkeBox>;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Image URL
|
|
94
|
+
|
|
95
|
+
Load icons from external URLs:
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
<SilkeBox gap="m">
|
|
99
|
+
<SilkeIcon icon="https://cdn.jsdelivr.net/npm/@mdi/svg@7.2.96/svg/react.svg" style={{ fontSize: 32 }} />
|
|
100
|
+
</SilkeBox>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Common Icons
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
<SilkeBox column gap="m">
|
|
107
|
+
<SilkeBox gap="l" wrap>
|
|
108
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
109
|
+
<SilkeIcon icon="add" style={{ fontSize: 24 }} />
|
|
110
|
+
<SilkeText size="s">add</SilkeText>
|
|
111
|
+
</SilkeBox>
|
|
112
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
113
|
+
<SilkeIcon icon="delete" style={{ fontSize: 24 }} />
|
|
114
|
+
<SilkeText size="s">delete</SilkeText>
|
|
115
|
+
</SilkeBox>
|
|
116
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
117
|
+
<SilkeIcon icon="edit" style={{ fontSize: 24 }} />
|
|
118
|
+
<SilkeText size="s">edit</SilkeText>
|
|
119
|
+
</SilkeBox>
|
|
120
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
121
|
+
<SilkeIcon icon="check" style={{ fontSize: 24 }} />
|
|
122
|
+
<SilkeText size="s">check</SilkeText>
|
|
123
|
+
</SilkeBox>
|
|
124
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
125
|
+
<SilkeIcon icon="close" style={{ fontSize: 24 }} />
|
|
126
|
+
<SilkeText size="s">close</SilkeText>
|
|
127
|
+
</SilkeBox>
|
|
128
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
129
|
+
<SilkeIcon icon="search" style={{ fontSize: 24 }} />
|
|
130
|
+
<SilkeText size="s">search</SilkeText>
|
|
131
|
+
</SilkeBox>
|
|
132
|
+
</SilkeBox>
|
|
133
|
+
<SilkeBox gap="l" wrap>
|
|
134
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
135
|
+
<SilkeIcon icon="settings" style={{ fontSize: 24 }} />
|
|
136
|
+
<SilkeText size="s">settings</SilkeText>
|
|
137
|
+
</SilkeBox>
|
|
138
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
139
|
+
<SilkeIcon icon="home" style={{ fontSize: 24 }} />
|
|
140
|
+
<SilkeText size="s">home</SilkeText>
|
|
141
|
+
</SilkeBox>
|
|
142
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
143
|
+
<SilkeIcon icon="star" style={{ fontSize: 24 }} />
|
|
144
|
+
<SilkeText size="s">star</SilkeText>
|
|
145
|
+
</SilkeBox>
|
|
146
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
147
|
+
<SilkeIcon icon="copy" style={{ fontSize: 24 }} />
|
|
148
|
+
<SilkeText size="s">copy</SilkeText>
|
|
149
|
+
</SilkeBox>
|
|
150
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
151
|
+
<SilkeIcon icon="download" style={{ fontSize: 24 }} />
|
|
152
|
+
<SilkeText size="s">download</SilkeText>
|
|
153
|
+
</SilkeBox>
|
|
154
|
+
<SilkeBox column gap="xs" vAlign="center" style={{ width: 80 }}>
|
|
155
|
+
<SilkeIcon icon="upload" style={{ fontSize: 24 }} />
|
|
156
|
+
<SilkeText size="s">upload</SilkeText>
|
|
157
|
+
</SilkeBox>
|
|
158
|
+
</SilkeBox>
|
|
159
|
+
</SilkeBox>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## AI Icons
|
|
163
|
+
|
|
164
|
+
Special icons for AI features:
|
|
165
|
+
|
|
166
|
+
```js
|
|
167
|
+
<SilkeBox gap="l">
|
|
168
|
+
<SilkeBox column gap="xs" vAlign="center">
|
|
169
|
+
<SilkeIcon icon="ai" style={{ fontSize: 24 }} />
|
|
170
|
+
<SilkeText size="s">ai</SilkeText>
|
|
171
|
+
</SilkeBox>
|
|
172
|
+
<SilkeBox column gap="xs" vAlign="center">
|
|
173
|
+
<SilkeIcon icon="ai.sparkle" style={{ fontSize: 24 }} />
|
|
174
|
+
<SilkeText size="s">ai.sparkle</SilkeText>
|
|
175
|
+
</SilkeBox>
|
|
176
|
+
<SilkeBox column gap="xs" vAlign="center">
|
|
177
|
+
<SilkeIcon icon="sparkles" style={{ fontSize: 24 }} />
|
|
178
|
+
<SilkeText size="s">sparkles</SilkeText>
|
|
179
|
+
</SilkeBox>
|
|
180
|
+
</SilkeBox>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Props
|
|
184
|
+
|
|
185
|
+
| Prop | Type | Default | Description |
|
|
186
|
+
| ----------- | ---------------------------------------------- | ------- | ------------------------------- |
|
|
187
|
+
| `icon` | `SilkeIcons \| React.ReactElement` | Required| Icon to display |
|
|
188
|
+
| `color` | `SilkeColor \| string` | - | Icon color |
|
|
189
|
+
| `className` | `string` | - | Additional CSS class names |
|
|
190
|
+
| `style` | `React.CSSProperties` | - | Inline styles (use for sizing) |
|
|
191
|
+
|
|
192
|
+
Also accepts all standard HTML element attributes.
|
|
193
|
+
|
|
194
|
+
## Types
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
type SilkeIcons = keyof typeof SilkeIconDefinitions | null | IEmojiIcon;
|
|
198
|
+
|
|
199
|
+
interface IEmojiIcon {
|
|
200
|
+
type: EmojiType;
|
|
201
|
+
value: string | { url: string };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
enum EmojiType {
|
|
205
|
+
icon = 'icon',
|
|
206
|
+
upload = 'upload',
|
|
207
|
+
emoji = 'emoji',
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Icon Categories
|
|
212
|
+
|
|
213
|
+
The icon library includes icons for:
|
|
214
|
+
- **Basic**: add, delete, edit, check, close, search
|
|
215
|
+
- **Navigation**: home, arrow.*, chevron.*, menu
|
|
216
|
+
- **Media**: play, pause, image, video, audio
|
|
217
|
+
- **Files**: file, folder, document, download, upload
|
|
218
|
+
- **Communication**: email, chat, share, link
|
|
219
|
+
- **AI**: ai, ai.sparkle, sparkles
|
|
220
|
+
- **Status**: error, warning, success, tooltip
|
|
221
|
+
- **And many more...**
|
|
222
|
+
|
|
223
|
+
Use the Icon Browser above to explore all available icons.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use
|
|
1
|
+
@use '../../variables' as *;
|
|
2
2
|
|
|
3
3
|
.icon {
|
|
4
4
|
// font-size: 1.14285714286em;
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
height: 1.125em;
|
|
10
10
|
width: 1.125em;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
img.icon {
|
|
@@ -22,3 +21,12 @@ img.icon {
|
|
|
22
21
|
// this fontsize works for emojis for a magical reason
|
|
23
22
|
font-size: 1.14285714286em;
|
|
24
23
|
}
|
|
24
|
+
|
|
25
|
+
// Custom style for AI because it's AI
|
|
26
|
+
.aiSparkle {
|
|
27
|
+
background: linear-gradient(207deg, #a073ff 30%, #01dccd 103%);
|
|
28
|
+
-webkit-background-clip: text;
|
|
29
|
+
-webkit-text-fill-color: transparent;
|
|
30
|
+
background-clip: text;
|
|
31
|
+
text-fill-color: transparent;
|
|
32
|
+
}
|
|
@@ -21,6 +21,7 @@ export function SilkeIcon({ icon, className, color, ...rest }: SilkeIconProps):
|
|
|
21
21
|
let cl = styles.icon;
|
|
22
22
|
if (color) cl += ' ' + 'color-' + color;
|
|
23
23
|
if (className) cl += ' ' + className;
|
|
24
|
+
if (icon === 'ai.sparkle') cl += ' ' + styles.aiSparkle;
|
|
24
25
|
if (React.isValidElement(icon)) {
|
|
25
26
|
return (
|
|
26
27
|
<span {...rest} className={cl}>
|
|
@@ -1,63 +1,60 @@
|
|
|
1
1
|
.stacked {
|
|
2
|
-
|
|
2
|
+
:first-child {
|
|
3
|
+
position: absolute;
|
|
4
|
+
font-size: 40% !important;
|
|
5
|
+
}
|
|
6
|
+
&.top-left {
|
|
3
7
|
:first-child {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
&.top-left {
|
|
9
|
-
:first-child {
|
|
10
|
-
left: -10%;
|
|
11
|
-
top: -10%;
|
|
12
|
-
}
|
|
8
|
+
left: -10%;
|
|
9
|
+
top: -10%;
|
|
13
10
|
}
|
|
11
|
+
}
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
&.top-center {
|
|
14
|
+
:first-child {
|
|
15
|
+
top: -10%;
|
|
19
16
|
}
|
|
17
|
+
}
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
19
|
+
&.top-right {
|
|
20
|
+
:first-child {
|
|
21
|
+
top: -10%;
|
|
22
|
+
right: -10%;
|
|
26
23
|
}
|
|
24
|
+
}
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
26
|
+
&.center-right {
|
|
27
|
+
:first-child {
|
|
28
|
+
right: -10%;
|
|
32
29
|
}
|
|
30
|
+
}
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
32
|
+
&.bottom-right {
|
|
33
|
+
:first-child {
|
|
34
|
+
bottom: -10%;
|
|
35
|
+
right: -10%;
|
|
39
36
|
}
|
|
37
|
+
}
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
39
|
+
&.bottom-center {
|
|
40
|
+
:first-child {
|
|
41
|
+
bottom: -10%;
|
|
45
42
|
}
|
|
43
|
+
}
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
45
|
+
&.bottom-left {
|
|
46
|
+
:first-child {
|
|
47
|
+
bottom: -10%;
|
|
48
|
+
left: -10%;
|
|
52
49
|
}
|
|
50
|
+
}
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
52
|
+
&.center-left {
|
|
53
|
+
:first-child {
|
|
54
|
+
left: -10%;
|
|
58
55
|
}
|
|
56
|
+
}
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
58
|
+
.center-center {
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import React, { useState, useRef } from 'react';
|
|
2
|
+
import { SilkeBox, SilkeText, SilkeIcon, SilkeIconDefinitions, SilkeSearchField, SilkeDivider } from '@vev/silke';
|
|
3
|
+
|
|
4
|
+
export const sentenceCase = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
5
|
+
|
|
6
|
+
export const IconTile = ({ icon, copied, onCopy }) => (
|
|
7
|
+
<div
|
|
8
|
+
className="icon-tile"
|
|
9
|
+
style={{
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
width: 100,
|
|
14
|
+
cursor: 'pointer',
|
|
15
|
+
borderRadius: 'var(--border-radius-small)',
|
|
16
|
+
padding: 8,
|
|
17
|
+
background: copied === icon ? 'color-mix(in srgb, var(--color-success-50) 10%, transparent)' : undefined,
|
|
18
|
+
}}
|
|
19
|
+
onClick={() => onCopy(icon)}
|
|
20
|
+
>
|
|
21
|
+
<div style={{ height: 32, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
22
|
+
<SilkeIcon icon={icon} style={{ fontSize: 20 }} />
|
|
23
|
+
</div>
|
|
24
|
+
<SilkeText size="xs" color="neutral-60" style={{ textAlign: 'center', wordBreak: 'break-all' }}>
|
|
25
|
+
{icon}
|
|
26
|
+
</SilkeText>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export const IconGroup = ({ title, icons, copied, onCopy, defaultOpen = true }) => {
|
|
31
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<SilkeBox column gap="s">
|
|
35
|
+
<SilkeBox
|
|
36
|
+
gap="s"
|
|
37
|
+
vAlign="center"
|
|
38
|
+
onClick={() => setOpen(!open)}
|
|
39
|
+
style={{ cursor: 'pointer', userSelect: 'none' }}
|
|
40
|
+
>
|
|
41
|
+
<SilkeIcon icon={open ? 'chevron.down' : 'chevron.right'} style={{ fontSize: 12 }} />
|
|
42
|
+
<SilkeText size="l" weight="bold">{title}</SilkeText>
|
|
43
|
+
<SilkeText size="s" color="neutral-40">{icons.length}</SilkeText>
|
|
44
|
+
</SilkeBox>
|
|
45
|
+
{open && (
|
|
46
|
+
<SilkeBox gap="xs" wrap>
|
|
47
|
+
{[...icons].sort().map((icon) => (
|
|
48
|
+
<IconTile key={icon} icon={icon} copied={copied} onCopy={onCopy} />
|
|
49
|
+
))}
|
|
50
|
+
</SilkeBox>
|
|
51
|
+
)}
|
|
52
|
+
<SilkeDivider />
|
|
53
|
+
</SilkeBox>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const IconBrowser = () => {
|
|
58
|
+
const [search, setSearch] = useState('');
|
|
59
|
+
const [copied, setCopied] = useState(null);
|
|
60
|
+
const timeoutRef = useRef(null);
|
|
61
|
+
|
|
62
|
+
const allIcons = Object.keys(SilkeIconDefinitions);
|
|
63
|
+
|
|
64
|
+
const handleCopy = (name) => {
|
|
65
|
+
navigator.clipboard.writeText(name).then(() => {
|
|
66
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
67
|
+
setCopied(name);
|
|
68
|
+
timeoutRef.current = setTimeout(() => setCopied(null), 1500);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const filteredIcons = allIcons.filter((icon) =>
|
|
73
|
+
icon.toLowerCase().includes(search.toLowerCase())
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const groups = {};
|
|
77
|
+
const ungrouped = [];
|
|
78
|
+
|
|
79
|
+
filteredIcons.forEach((name) => {
|
|
80
|
+
if (name.includes('.')) {
|
|
81
|
+
const prefix = name.split('.')[0];
|
|
82
|
+
if (!groups[prefix]) groups[prefix] = [];
|
|
83
|
+
groups[prefix].push(name);
|
|
84
|
+
} else {
|
|
85
|
+
ungrouped.push(name);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<SilkeBox column gap="l">
|
|
91
|
+
<SilkeBox
|
|
92
|
+
gap="s"
|
|
93
|
+
vAlign="center"
|
|
94
|
+
style={{ position: 'sticky', top: 16, zIndex: 1, paddingTop: 8, paddingBottom: 8 }}
|
|
95
|
+
bg="neutral-0"
|
|
96
|
+
>
|
|
97
|
+
<SilkeBox flex>
|
|
98
|
+
<SilkeSearchField
|
|
99
|
+
placeholder="Search icons..."
|
|
100
|
+
value={search}
|
|
101
|
+
onChange={setSearch}
|
|
102
|
+
/>
|
|
103
|
+
</SilkeBox>
|
|
104
|
+
{copied ? (
|
|
105
|
+
<SilkeText size="s" color="success-50" style={{ whiteSpace: 'nowrap' }}>
|
|
106
|
+
Copied "{copied}"
|
|
107
|
+
</SilkeText>
|
|
108
|
+
) : (
|
|
109
|
+
<SilkeText size="s" color="neutral-40" style={{ whiteSpace: 'nowrap' }}>
|
|
110
|
+
{filteredIcons.length} icons
|
|
111
|
+
</SilkeText>
|
|
112
|
+
)}
|
|
113
|
+
</SilkeBox>
|
|
114
|
+
|
|
115
|
+
{ungrouped.length > 0 && (
|
|
116
|
+
<IconGroup
|
|
117
|
+
title="Uncategorized"
|
|
118
|
+
icons={ungrouped}
|
|
119
|
+
copied={copied}
|
|
120
|
+
onCopy={handleCopy}
|
|
121
|
+
/>
|
|
122
|
+
)}
|
|
123
|
+
|
|
124
|
+
{Object.entries(groups)
|
|
125
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
126
|
+
.map(([prefix, icons]) => (
|
|
127
|
+
<IconGroup
|
|
128
|
+
key={prefix}
|
|
129
|
+
title={sentenceCase(prefix)}
|
|
130
|
+
icons={icons}
|
|
131
|
+
copied={copied}
|
|
132
|
+
onCopy={handleCopy}
|
|
133
|
+
/>
|
|
134
|
+
))}
|
|
135
|
+
</SilkeBox>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
<style>{`.icon-tile:hover { outline: 1px solid var(--color-neutral-20); }`}</style>
|
|
140
|
+
|
|
141
|
+
# Icon Browser
|
|
142
|
+
|
|
143
|
+
<IconBrowser />
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
.root{
|
|
2
|
-
--color-1:var(--color-neutral-20);
|
|
3
|
-
--color-2:var(--color-neutral-20);
|
|
1
|
+
.root {
|
|
2
|
+
--color-1: var(--color-neutral-20);
|
|
3
|
+
--color-2: var(--color-neutral-20);
|
|
4
4
|
background-color: var(--color-1) !important;
|
|
5
5
|
transition: 0.5s background-color ease-out;
|
|
6
|
-
|
|
7
|
-
&:hover{
|
|
6
|
+
|
|
7
|
+
&:hover {
|
|
8
8
|
background-position: 100px;
|
|
9
9
|
}
|
|
10
|
-
}
|
|
10
|
+
}
|