@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,15 +1,110 @@
|
|
|
1
|
+
# Silke list
|
|
2
|
+
|
|
3
|
+
List of SilkeListItem components
|
|
4
|
+
|
|
5
|
+
## Basic usage
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
const items = [{ label: 'Item 1' }, { label: 'Item 2' }, 'divider', { label: 'Item 3' }];
|
|
9
|
+
|
|
10
|
+
<SilkeList items={items} />;
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Nested list
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
const items = [
|
|
17
|
+
{ label: 'Menu item 1', groupLabel: 'Group 1', icon: 'widget' },
|
|
18
|
+
{
|
|
19
|
+
label: 'Menu item 2',
|
|
20
|
+
groupLabel: 'Group 1',
|
|
21
|
+
icon: 'widget',
|
|
22
|
+
tag: { label: 'AI', size: 'tiny', kind: 'secondary', icon: 'ai.sparkle' },
|
|
23
|
+
},
|
|
24
|
+
'divider',
|
|
25
|
+
{
|
|
26
|
+
label: 'Menu item 3',
|
|
27
|
+
groupLabel: 'Group 2',
|
|
28
|
+
icon: 'widget',
|
|
29
|
+
items: [
|
|
30
|
+
{ label: 'Menu item 3.1', icon: 'widget' },
|
|
31
|
+
{
|
|
32
|
+
label: 'Menu item 3.2',
|
|
33
|
+
icon: 'widget',
|
|
34
|
+
items: [
|
|
35
|
+
{ label: 'Menu item 3.2.1', icon: 'widget' },
|
|
36
|
+
{ label: 'Menu item 3.2.2', icon: 'widget' },
|
|
37
|
+
{ label: 'Menu item 3.2.3', icon: 'widget' },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
{ label: 'Menu item 3.3', icon: 'widget' },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'Menu item 5',
|
|
45
|
+
groupLabel: 'Group 2',
|
|
46
|
+
tag: { label: 'Beta', size: 'tiny', color: 'dark' },
|
|
47
|
+
icon: 'widget',
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
<SilkeList items={items} />;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Sizes
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
const items = [
|
|
57
|
+
{ label: 'Action 1', icon: 'widget' },
|
|
58
|
+
{ label: 'Action 2', icon: 'widget' },
|
|
59
|
+
{ label: 'Action 3', icon: 'widget' },
|
|
60
|
+
{ label: 'Action 4', icon: 'widget' },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
<SilkeBox gap="l" column fill>
|
|
64
|
+
<SilkeTextSmall>Small</SilkeTextSmall>
|
|
65
|
+
<SilkeList items={items} size="s" />
|
|
66
|
+
|
|
67
|
+
<SilkeTextSmall>Base</SilkeTextSmall>
|
|
68
|
+
<SilkeList items={items} size="base" />
|
|
69
|
+
</SilkeBox>;
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## With link
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
const items = [
|
|
76
|
+
{ label: 'Action 1', icon: 'widget', link: '#' },
|
|
77
|
+
{ label: 'Action 2', icon: 'widget', link: 'https://www.google.com' },
|
|
78
|
+
{ label: 'Action 3', icon: 'widget', link: 'https://www.google.com' },
|
|
79
|
+
{ label: 'Action 4', icon: 'widget', link: 'https://www.google.com' },
|
|
80
|
+
];
|
|
81
|
+
<SilkeList items={items} />;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## With gap
|
|
85
|
+
|
|
1
86
|
```js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
87
|
+
const items = [
|
|
88
|
+
{ label: 'Action 1', icon: 'widget', link: '#' },
|
|
89
|
+
{ label: 'Action 2', icon: 'widget', link: 'https://www.google.com' },
|
|
90
|
+
{ label: 'Action 3', icon: 'widget', link: 'https://www.google.com' },
|
|
91
|
+
{ label: 'Action 4', icon: 'widget', link: 'https://www.google.com' },
|
|
92
|
+
];
|
|
93
|
+
<SilkeList items={items} gap />;
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## With active indicator
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
const [activeItem, setActiveItem] = React.useState('Item 1');
|
|
100
|
+
|
|
101
|
+
const items = [
|
|
102
|
+
{ label: 'Item 1', active: activeItem === 'Item 1', onClick: () => setActiveItem('Item 1') },
|
|
103
|
+
{ label: 'Item 2', active: activeItem === 'Item 2', onClick: () => setActiveItem('Item 2') },
|
|
104
|
+
{ label: 'Item 3', active: activeItem === 'Item 3', onClick: () => setActiveItem('Item 3') },
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
<SilkeBox column gap="xxs">
|
|
108
|
+
<SilkeList items={items} />
|
|
109
|
+
</SilkeBox>;
|
|
15
110
|
```
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
min-width: 160px;
|
|
3
|
-
list-style: none;
|
|
4
|
-
margin: 0;
|
|
5
|
-
padding:0;
|
|
6
|
-
overflow: auto;
|
|
1
|
+
@use '../../variables' as *;
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
.wrapper {
|
|
4
|
+
margin: 0;
|
|
5
|
+
background-color: var(--color-neutral-10);
|
|
6
|
+
border: 1px solid var(--color-surface-3);
|
|
11
7
|
}
|
|
12
8
|
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
button{
|
|
17
|
-
width: 100%;
|
|
18
|
-
}
|
|
9
|
+
.list {
|
|
10
|
+
list-style: none;
|
|
11
|
+
margin: 0;
|
|
19
12
|
}
|
|
@@ -1,14 +1,68 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { SilkeBox } from '../silke-box';
|
|
3
|
+
import { SilkeDivider } from '../silke-divider';
|
|
4
|
+
import { SilkeTextSmall } from '../silke-text';
|
|
5
|
+
import type { SilkeListItemType } from './types';
|
|
6
|
+
import { groupSilkeListItems, isSilkeListItem } from './utils';
|
|
7
|
+
import { SilkeListItem } from './silke-list-item';
|
|
8
|
+
|
|
2
9
|
import styles from './silke-list.scss';
|
|
3
10
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
+
type SilkeListProps = {
|
|
12
|
+
items: SilkeListItemType[] | (() => SilkeListItemType[]);
|
|
13
|
+
size?: 's' | 'base';
|
|
14
|
+
gap?: boolean;
|
|
15
|
+
maxHeight?: number;
|
|
16
|
+
onSelect?: (item: SilkeListItemType) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function SilkeList({ items, size, gap, maxHeight, onSelect }: SilkeListProps) {
|
|
20
|
+
const groupedItems = groupSilkeListItems(typeof items === 'function' ? items() : items);
|
|
11
21
|
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
return (
|
|
23
|
+
<SilkeBox
|
|
24
|
+
tag="ul"
|
|
25
|
+
tabIndex={-1}
|
|
26
|
+
column
|
|
27
|
+
className={styles.wrapper}
|
|
28
|
+
vPad="xs"
|
|
29
|
+
hPad="none"
|
|
30
|
+
gap={gap ? 'xxs' : undefined}
|
|
31
|
+
rounded="small"
|
|
32
|
+
style={{ maxHeight: maxHeight ? `${maxHeight}px` : 'none', overflow: 'auto' }}
|
|
33
|
+
>
|
|
34
|
+
{groupedItems.map((group) => (
|
|
35
|
+
<React.Fragment key={group.groupLabel}>
|
|
36
|
+
{group.groupLabel && (
|
|
37
|
+
<SilkeBox tag="li" hPad="sm" vPad="s">
|
|
38
|
+
<SilkeTextSmall color="neutral-60" weight="strong">
|
|
39
|
+
{group.groupLabel}
|
|
40
|
+
</SilkeTextSmall>
|
|
41
|
+
</SilkeBox>
|
|
42
|
+
)}
|
|
43
|
+
{group.items.map((item, index) => (
|
|
44
|
+
<SilkeBox
|
|
45
|
+
tag="li"
|
|
46
|
+
key={`${group.groupLabel}-${index}`}
|
|
47
|
+
hPad={item === 'divider' ? 'none' : 'xs'}
|
|
48
|
+
>
|
|
49
|
+
{isSilkeListItem(item) ? (
|
|
50
|
+
<SilkeListItem
|
|
51
|
+
{...item}
|
|
52
|
+
gap={gap}
|
|
53
|
+
size={size}
|
|
54
|
+
maxHeight={maxHeight}
|
|
55
|
+
onSelect={() => onSelect?.(item)}
|
|
56
|
+
/>
|
|
57
|
+
) : item === 'divider' ? (
|
|
58
|
+
<SilkeDivider dark vSpace="xs" />
|
|
59
|
+
) : (
|
|
60
|
+
React.isValidElement(item) && item
|
|
61
|
+
)}
|
|
62
|
+
</SilkeBox>
|
|
63
|
+
))}
|
|
64
|
+
</React.Fragment>
|
|
65
|
+
))}
|
|
66
|
+
</SilkeBox>
|
|
67
|
+
);
|
|
14
68
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IEmojiIcon } from '@vev/utils';
|
|
3
|
+
import { SilkeIcons } from '../silke-icon';
|
|
4
|
+
import { SilkeTagProps } from '../silke-tag';
|
|
5
|
+
|
|
6
|
+
export type SilkeListItemData = {
|
|
7
|
+
label: string;
|
|
8
|
+
groupLabel?: string;
|
|
9
|
+
icon?: IEmojiIcon | SilkeIcons | React.ReactElement;
|
|
10
|
+
tag?: SilkeTagProps;
|
|
11
|
+
items?: SilkeListItemData[];
|
|
12
|
+
link?: string;
|
|
13
|
+
active?: boolean;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type SilkeListItemType = SilkeListItemData | React.ReactElement | 'divider';
|
|
18
|
+
|
|
19
|
+
export type GroupedSilkeListItems = {
|
|
20
|
+
groupLabel?: string;
|
|
21
|
+
items: SilkeListItemType[];
|
|
22
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { GroupedSilkeListItems, SilkeListItemData, SilkeListItemType } from './types';
|
|
3
|
+
|
|
4
|
+
export function isSilkeListItem(item: SilkeListItemType): item is SilkeListItemData {
|
|
5
|
+
return !React.isValidElement(item) && item !== 'divider';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function groupSilkeListItems(items: SilkeListItemType[]): GroupedSilkeListItems[] {
|
|
9
|
+
const grouped: GroupedSilkeListItems[] = [];
|
|
10
|
+
let currentGroup: GroupedSilkeListItems | null = null;
|
|
11
|
+
|
|
12
|
+
items.forEach((item) => {
|
|
13
|
+
const groupLabel = isSilkeListItem(item) ? item.groupLabel : undefined;
|
|
14
|
+
|
|
15
|
+
if (!currentGroup || currentGroup.groupLabel !== groupLabel) {
|
|
16
|
+
currentGroup = { groupLabel, items: [] };
|
|
17
|
+
grouped.push(currentGroup);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
currentGroup.items.push(item);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return grouped;
|
|
24
|
+
}
|
|
@@ -1,9 +1,143 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SilkeLoader
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An animated loading indicator featuring the Vev logo. Use to indicate loading states, async operations, or content that's being fetched.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Animated Vev logo**: Branded loading animation
|
|
8
|
+
- **Custom messages**: Display loading text below the animation
|
|
9
|
+
- **Random messages**: Generate dynamic loading messages
|
|
10
|
+
- **Configurable size**: Scale the loader to fit your context
|
|
11
|
+
- **Stoppable animation**: Pause the animation when needed
|
|
12
|
+
|
|
13
|
+
## Basic Usage
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
<SilkeLoader />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## With Message
|
|
20
|
+
|
|
21
|
+
Display a static message below the loader:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
<SilkeLoader message="Loading your project..." />
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Sizes
|
|
28
|
+
|
|
29
|
+
Control the loader size with the `size` prop:
|
|
4
30
|
|
|
5
31
|
```js
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
32
|
+
<SilkeBox gap="xl" vAlign="end">
|
|
33
|
+
<SilkeBox column vAlign="center" gap="xs">
|
|
34
|
+
<SilkeLoader size="s" />
|
|
35
|
+
<SilkeText size="s">size="s"</SilkeText>
|
|
36
|
+
</SilkeBox>
|
|
37
|
+
<SilkeBox column vAlign="center" gap="xs">
|
|
38
|
+
<SilkeLoader size="base" />
|
|
39
|
+
<SilkeText size="s">size="base"</SilkeText>
|
|
40
|
+
</SilkeBox>
|
|
41
|
+
<SilkeBox column vAlign="center" gap="xs">
|
|
42
|
+
<SilkeLoader size="m" />
|
|
43
|
+
<SilkeText size="s">size="m"</SilkeText>
|
|
44
|
+
</SilkeBox>
|
|
45
|
+
<SilkeBox column vAlign="center" gap="xs">
|
|
46
|
+
<SilkeLoader size="l" />
|
|
47
|
+
<SilkeText size="s">size="l"</SilkeText>
|
|
48
|
+
</SilkeBox>
|
|
49
|
+
</SilkeBox>
|
|
9
50
|
```
|
|
51
|
+
|
|
52
|
+
## Random Message Generator
|
|
53
|
+
|
|
54
|
+
Pass a function to display dynamic messages:
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
const messages = ['Brewing coffee...', 'Fetching pixels...', 'Warming up servers...', 'Almost there...'];
|
|
58
|
+
const getRandomMessage = () => messages[Math.floor(Math.random() * messages.length)];
|
|
59
|
+
|
|
60
|
+
<SilkeLoader randomGenerator={getRandomMessage} />;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Stopped Animation
|
|
64
|
+
|
|
65
|
+
Pause the animation with the `stop` prop:
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
const [stopped, setStopped] = React.useState(false);
|
|
69
|
+
|
|
70
|
+
<SilkeBox column gap="m" vAlign="center">
|
|
71
|
+
<SilkeLoader size="m" stop={stopped} message={stopped ? 'Paused' : 'Loading...'} />
|
|
72
|
+
<SilkeButton label={stopped ? 'Resume' : 'Pause'} onClick={() => setStopped(!stopped)} />
|
|
73
|
+
</SilkeBox>;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## In a Loading State
|
|
77
|
+
|
|
78
|
+
Use within conditional rendering:
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
const [loading, setLoading] = React.useState(true);
|
|
82
|
+
|
|
83
|
+
<SilkeBox column gap="m">
|
|
84
|
+
<SilkeButton label={loading ? 'Stop Loading' : 'Start Loading'} onClick={() => setLoading(!loading)} />
|
|
85
|
+
{loading ? (
|
|
86
|
+
<SilkeBox pad="xl" vAlign="center" hAlign="center" bg="neutral-10" rounded>
|
|
87
|
+
<SilkeLoader size="m" message="Fetching data..." />
|
|
88
|
+
</SilkeBox>
|
|
89
|
+
) : (
|
|
90
|
+
<SilkeBox pad="xl" vAlign="center" hAlign="center" bg="success-10" rounded>
|
|
91
|
+
<SilkeText>Content loaded!</SilkeText>
|
|
92
|
+
</SilkeBox>
|
|
93
|
+
)}
|
|
94
|
+
</SilkeBox>;
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Full Page Loader
|
|
98
|
+
|
|
99
|
+
Center the loader for full-page loading states:
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
<SilkeBox style={{ height: 200 }} vAlign="center" hAlign="center" bg="neutral-5" rounded>
|
|
103
|
+
<SilkeLoader size="l" message="Loading application..." />
|
|
104
|
+
</SilkeBox>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Custom Styling
|
|
108
|
+
|
|
109
|
+
Apply custom styles to the loader:
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
<SilkeBox gap="l">
|
|
113
|
+
<SilkeLoader size="m" style={{ opacity: 0.5 }} />
|
|
114
|
+
<SilkeLoader size="m" style={{ filter: 'hue-rotate(180deg)' }} />
|
|
115
|
+
</SilkeBox>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Props
|
|
119
|
+
|
|
120
|
+
| Prop | Type | Default | Description |
|
|
121
|
+
| ----------------- | ------------------- | ------- | ---------------------------------------- |
|
|
122
|
+
| `message` | `string` | - | Static message to display below loader |
|
|
123
|
+
| `randomGenerator` | `() => string` | - | Function that returns dynamic messages |
|
|
124
|
+
| `size` | `BoxSize` | - | Size of the loader (xs, s, base, m, l, xl) |
|
|
125
|
+
| `stop` | `boolean` | `false` | Pause the animation |
|
|
126
|
+
| `style` | `React.CSSProperties` | - | Custom styles for the SVG |
|
|
127
|
+
|
|
128
|
+
Also accepts all `SilkeBox` props for layout control.
|
|
129
|
+
|
|
130
|
+
## LoaderSVG
|
|
131
|
+
|
|
132
|
+
The raw SVG component is also exported for custom implementations:
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
<LoaderSVG />
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### LoaderSVG Props
|
|
139
|
+
|
|
140
|
+
| Prop | Type | Default | Description |
|
|
141
|
+
| ------- | --------------------- | ------- | --------------------- |
|
|
142
|
+
| `stop` | `boolean` | `false` | Pause the animation |
|
|
143
|
+
| `style` | `React.CSSProperties` | - | Custom styles |
|
|
@@ -11,14 +11,14 @@ $modal-max-height: 90vh;
|
|
|
11
11
|
max-width: $modal-max-width;
|
|
12
12
|
max-height: $modal-max-height;
|
|
13
13
|
transition: width 0.2s ease-out;
|
|
14
|
-
|
|
15
|
-
& > form{
|
|
14
|
+
|
|
15
|
+
& > form {
|
|
16
16
|
overflow: hidden;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
body{
|
|
21
|
-
--modal-overlay-background:rgba(var(--color-black-rgb), var(--opacity-level-semiopaque));
|
|
20
|
+
body {
|
|
21
|
+
--modal-overlay-background: rgba(var(--color-black-rgb), var(--opacity-level-semiopaque));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.content {
|
|
@@ -27,10 +27,10 @@ body{
|
|
|
27
27
|
overflow-y: auto;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.overlay{
|
|
30
|
+
.overlay {
|
|
31
31
|
width: 100vw;
|
|
32
|
-
height:100vh;
|
|
33
|
-
inset:0 0 0 0;
|
|
32
|
+
height: 100vh;
|
|
33
|
+
inset: 0 0 0 0;
|
|
34
34
|
background-color: var(--modal-overlay-background);
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -54,6 +54,6 @@ body{
|
|
|
54
54
|
|
|
55
55
|
// Without modal padding, the header still needs padding
|
|
56
56
|
|
|
57
|
-
.header[data-pad=
|
|
57
|
+
.header[data-pad='true'] {
|
|
58
58
|
padding: var(--space-l) var(--space-l) 0 var(--space-l);
|
|
59
|
-
}
|
|
59
|
+
}
|
|
@@ -8,8 +8,8 @@ const helper = (i) => ({ active: active === i, onClick: () => setActive(i) });
|
|
|
8
8
|
|
|
9
9
|
<>
|
|
10
10
|
<SilkeBox column>
|
|
11
|
-
<SilkeNavigationLink label="
|
|
12
|
-
<SilkeNavigationLink label="
|
|
11
|
+
<SilkeNavigationLink label="Search" {...helper(0)} icon="search" />
|
|
12
|
+
<SilkeNavigationLink label="Home" {...helper(1)} icon="dashboard" />
|
|
13
13
|
<SilkeNavigationLink
|
|
14
14
|
label="Initially active item"
|
|
15
15
|
icon="tooltip"
|
|
@@ -45,3 +45,28 @@ const helper = (i) => ({ active: active === i, onClick: () => setActive(i) });
|
|
|
45
45
|
);
|
|
46
46
|
};
|
|
47
47
|
```
|
|
48
|
+
|
|
49
|
+
## Draggable version
|
|
50
|
+
|
|
51
|
+
```jsx
|
|
52
|
+
() => {
|
|
53
|
+
const [active, setActive] = React.useState(2);
|
|
54
|
+
const helper = (i) => ({ active: active === i, onClick: () => setActive(i) });
|
|
55
|
+
const menu = ipsum.list(4, () => ({ label: ipsum.name() }));
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<SilkeBox column bg="ui-background">
|
|
59
|
+
<SilkeNavigationLink draggable label="Item 0" {...helper(0)} icon="user">
|
|
60
|
+
<SilkeButton icon="add" />
|
|
61
|
+
</SilkeNavigationLink>
|
|
62
|
+
<SilkeNavigationLink draggable label="Item 1" {...helper(1)} icon="users" />
|
|
63
|
+
<SilkeNavigationLink draggable label="Initially active item" icon="tooltip" {...helper(2)}>
|
|
64
|
+
<SilkeButton icon="delete" />
|
|
65
|
+
</SilkeNavigationLink>
|
|
66
|
+
<SilkeNavigationLink draggable label="Item 3" {...helper(3)} icon="account">
|
|
67
|
+
<SilkeOverflowMenu draggable items={menu} />
|
|
68
|
+
</SilkeNavigationLink>
|
|
69
|
+
</SilkeBox>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
```
|