@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.
Files changed (174) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/index.js +40 -38
  3. package/dist/index.js.LEGAL.txt +12 -0
  4. package/dist/styles.css +1596 -1036
  5. package/dist/types/components/index.d.ts +4 -1
  6. package/dist/types/components/silke-autocomplete-field/autocomplete-types.d.ts +4 -0
  7. package/dist/types/components/silke-autocomplete-field/index.d.ts +1 -0
  8. package/dist/types/components/silke-autocomplete-field/silke-autocomplete-field-native.d.ts +60 -0
  9. package/dist/types/components/silke-autocomplete-field/silke-autocomplete-field.d.ts +3 -0
  10. package/dist/types/components/silke-autocomplete-field/silke-autocomplete-popup-native.d.ts +15 -0
  11. package/dist/types/components/silke-button/silke-dropdown-button.d.ts +8 -13
  12. package/dist/types/components/silke-card/silke-card-grid.d.ts +33 -1
  13. package/dist/types/components/silke-command-text-field/image-utils.d.ts +20 -0
  14. package/dist/types/components/silke-command-text-field/index.d.ts +4 -0
  15. package/dist/types/components/silke-command-text-field/silke-command-parser.d.ts +3 -0
  16. package/dist/types/components/silke-command-text-field/silke-command-parser.spec.d.ts +1 -0
  17. package/dist/types/components/silke-command-text-field/silke-command-text-field.d.ts +46 -0
  18. package/dist/types/components/silke-command-text-field/utils.d.ts +61 -0
  19. package/dist/types/components/silke-command-text-field/utils.spec.d.ts +1 -0
  20. package/dist/types/components/silke-conditions-input/utils.d.ts +1 -1
  21. package/dist/types/components/silke-form-schema/silke-schema-fields.d.ts +1 -0
  22. package/dist/types/components/silke-image/silke-image.d.ts +2 -1
  23. package/dist/types/components/silke-list/index.d.ts +1 -0
  24. package/dist/types/components/silke-list/silke-list-item.d.ts +24 -6
  25. package/dist/types/components/silke-list/silke-list.d.ts +9 -9
  26. package/dist/types/components/silke-list/types.d.ts +19 -0
  27. package/dist/types/components/silke-list/utils.d.ts +3 -0
  28. package/dist/types/components/silke-navigation-link/silke-navigation-link.d.ts +1 -0
  29. package/dist/types/components/silke-overflow-menu/silke-overflow-menu.d.ts +6 -1
  30. package/dist/types/components/silke-popover-native/index.d.ts +1 -0
  31. package/dist/types/components/silke-popover-native/silke-popover-native.d.ts +37 -0
  32. package/dist/types/components/silke-popover-native/types.d.ts +6 -0
  33. package/dist/types/components/silke-popover-native/use-popover-positioning.d.ts +9 -0
  34. package/dist/types/components/silke-select-field/index.d.ts +1 -0
  35. package/dist/types/components/silke-select-field/silke-select-field-native.d.ts +4 -0
  36. package/dist/types/components/silke-shortcut-button/index.d.ts +1 -0
  37. package/dist/types/components/silke-shortcut-button/silke-shortcut-button.d.ts +15 -0
  38. package/dist/types/components/silke-tag/silke-tag.d.ts +1 -1
  39. package/dist/types/icons.d.ts +32 -0
  40. package/jest.config.js +2 -3
  41. package/package.json +9 -3
  42. package/src/_variables.scss +125 -129
  43. package/src/components/index.ts +4 -1
  44. package/src/components/silke-action-box/silke-action-box.scss +2 -3
  45. package/src/components/silke-alert-banner/silke-alert-banner.scss +9 -10
  46. package/src/components/silke-autocomplete-field/autocomplete-item.tsx +2 -2
  47. package/src/components/silke-autocomplete-field/autocomplete-types.ts +4 -0
  48. package/src/components/silke-autocomplete-field/index.ts +1 -0
  49. package/src/components/silke-autocomplete-field/silke-autocomplete-field-native.tsx +346 -0
  50. package/src/components/silke-autocomplete-field/silke-autocomplete-field.mdx +39 -0
  51. package/src/components/silke-autocomplete-field/silke-autocomplete-field.scss +18 -12
  52. package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +3 -0
  53. package/src/components/silke-autocomplete-field/silke-autocomplete-popup-native.tsx +542 -0
  54. package/src/components/silke-autocomplete-field/silke-autocomplete-popup.tsx +92 -41
  55. package/src/components/silke-box/silke-box.mdx +321 -21
  56. package/src/components/silke-box/silke-box.scss +5 -5
  57. package/src/components/silke-breadcrumbs/silke-breadcrumb.mdx +147 -9
  58. package/src/components/silke-breadcrumbs/silke-breadcrumb.scss +3 -3
  59. package/src/components/silke-button/silke-big-button.scss +1 -1
  60. package/src/components/silke-button/silke-button.scss +27 -18
  61. package/src/components/silke-button/silke-dropdown-button.mdx +67 -0
  62. package/src/components/silke-button/silke-dropdown-button.tsx +40 -122
  63. package/src/components/silke-card/silke-card-grid.tsx +5 -3
  64. package/src/components/silke-card/silke-card.scss +8 -7
  65. package/src/components/silke-card/silke-card.tsx +7 -1
  66. package/src/components/silke-checkbox/silke-checkbox.mdx +139 -14
  67. package/src/components/silke-checkbox/silke-checkbox.scss +11 -11
  68. package/src/components/silke-color-picker/color-picker.scss +8 -8
  69. package/src/components/silke-color-swatches/silke-color-swatches.mdx +130 -0
  70. package/src/components/silke-command-text-field/image-utils.ts +71 -0
  71. package/src/components/silke-command-text-field/index.ts +12 -0
  72. package/src/components/silke-command-text-field/silke-command-parser.spec.ts +89 -0
  73. package/src/components/silke-command-text-field/silke-command-parser.ts +47 -0
  74. package/src/components/silke-command-text-field/silke-command-text-field.mdx +301 -0
  75. package/src/components/silke-command-text-field/silke-command-text-field.module.scss +119 -0
  76. package/src/components/silke-command-text-field/silke-command-text-field.tsx +665 -0
  77. package/src/components/silke-command-text-field/utils.spec.ts +366 -0
  78. package/src/components/silke-command-text-field/utils.ts +287 -0
  79. package/src/components/silke-conditions-input/silke-conditions-input.scss +4 -4
  80. package/src/components/silke-content-column/silke-content-column.scss +1 -1
  81. package/src/components/silke-context-menu/silke-context-menu.scss +3 -4
  82. package/src/components/silke-context-menu/silke-context-menu.tsx +1 -1
  83. package/src/components/silke-css-number-field/silke-css-number-field.scss +14 -12
  84. package/src/components/silke-divider/silke-divider.mdx +154 -32
  85. package/src/components/silke-divider/silke-divider.scss +3 -2
  86. package/src/components/silke-drawer/silke-drawer.scss +6 -2
  87. package/src/components/silke-form/silke-form.mdx +254 -27
  88. package/src/components/silke-form-schema/fields/array-field-inline.tsx +1 -0
  89. package/src/components/silke-form-schema/fields/array-field-modal.tsx +1 -0
  90. package/src/components/silke-form-schema/fields/styles.scss +34 -35
  91. package/src/components/silke-form-schema/silke-schema-field.tsx +1 -1
  92. package/src/components/silke-form-schema/silke-schema-fields.tsx +4 -3
  93. package/src/components/silke-gradient-picker/silke-gradient-picker.module.scss +2 -2
  94. package/src/components/silke-icon/silke-icon.mdx +212 -8
  95. package/src/components/silke-icon/silke-icon.scss +10 -2
  96. package/src/components/silke-icon/silke-icon.tsx +1 -0
  97. package/src/components/silke-icon/silke-stacked-icon.scss +42 -45
  98. package/src/components/silke-icon-browser/silke-icon-browser.mdx +143 -0
  99. package/src/components/silke-image/silke-image-color-backdrop.scss +6 -6
  100. package/src/components/silke-image/silke-image.mdx +189 -41
  101. package/src/components/silke-image/silke-image.scss +3 -3
  102. package/src/components/silke-image/silke-image.tsx +14 -1
  103. package/src/components/silke-link/silke-link.scss +3 -5
  104. package/src/components/silke-list/index.ts +1 -0
  105. package/src/components/silke-list/silke-list-item.mdx +83 -0
  106. package/src/components/silke-list/silke-list-item.scss +119 -0
  107. package/src/components/silke-list/silke-list-item.tsx +137 -12
  108. package/src/components/silke-list/silke-list.mdx +108 -13
  109. package/src/components/silke-list/silke-list.scss +8 -15
  110. package/src/components/silke-list/silke-list.tsx +63 -9
  111. package/src/components/silke-list/types.ts +22 -0
  112. package/src/components/silke-list/utils.ts +24 -0
  113. package/src/components/silke-loader/silke-loader.mdx +139 -5
  114. package/src/components/silke-loader/silke-loader.scss +1 -1
  115. package/src/components/silke-modal/silke-modal.scss +9 -9
  116. package/src/components/silke-navigation-link/silke-navigation-link.mdx +27 -2
  117. package/src/components/silke-navigation-link/silke-navigation-link.scss +34 -40
  118. package/src/components/silke-navigation-link/silke-navigation-link.tsx +7 -6
  119. package/src/components/silke-overflow-menu/silke-overflow-menu.mdx +228 -31
  120. package/src/components/silke-overflow-menu/silke-overflow-menu.scss +8 -8
  121. package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +14 -8
  122. package/src/components/silke-popover/silke-popover.scss +5 -5
  123. package/src/components/silke-popover-native/index.ts +1 -0
  124. package/src/components/silke-popover-native/silke-popover-native.mdx +207 -0
  125. package/src/components/silke-popover-native/silke-popover-native.scss +127 -0
  126. package/src/components/silke-popover-native/silke-popover-native.tsx +176 -0
  127. package/src/components/silke-popover-native/types.ts +21 -0
  128. package/src/components/silke-popover-native/use-popover-positioning.ts +157 -0
  129. package/src/components/silke-progress-indicator/silke-progress-indicator.scss +1 -1
  130. package/src/components/silke-radio-button/silke-radio-button.scss +18 -11
  131. package/src/components/silke-search-field/silke-search-field.mdx +161 -7
  132. package/src/components/silke-select-field/index.ts +1 -0
  133. package/src/components/silke-select-field/silke-select-field-native.tsx +17 -0
  134. package/src/components/silke-select-field/silke-select-field.mdx +65 -0
  135. package/src/components/silke-shortcut-button/index.ts +1 -0
  136. package/src/components/silke-shortcut-button/silke-shortcut-button.mdx +89 -0
  137. package/src/components/silke-shortcut-button/silke-shortcut-button.scss +145 -0
  138. package/src/components/silke-shortcut-button/silke-shortcut-button.tsx +55 -0
  139. package/src/components/silke-skeleton/silke-skeleton.mdx +109 -0
  140. package/src/components/silke-skeleton/silke-skeleton.scss +1 -1
  141. package/src/components/silke-slider/silke-slider.module.scss +19 -19
  142. package/src/components/silke-sortable-list/silke-nested-sortable-list.scss +3 -3
  143. package/src/components/silke-sortable-list/silke-sortable-list.scss +4 -5
  144. package/src/components/silke-table/silke-table.scss +1 -1
  145. package/src/components/silke-tabs/silke-tabs.scss +3 -3
  146. package/src/components/silke-tag/silke-tag.mdx +179 -43
  147. package/src/components/silke-tag/silke-tag.scss +49 -12
  148. package/src/components/silke-tag/silke-tag.tsx +17 -7
  149. package/src/components/silke-text/silke-text.scss +6 -4
  150. package/src/components/silke-text/silke-title.scss +7 -14
  151. package/src/components/silke-text-field/silke-text-field.scss +9 -9
  152. package/src/components/silke-text-field/silke-text-field.tsx +3 -2
  153. package/src/components/silke-tile/silke-tile.scss +7 -3
  154. package/src/components/silke-toast-notification/silke-toast-notification.scss +4 -5
  155. package/src/components/silke-toggle/silke-toggle.mdx +163 -33
  156. package/src/components/silke-toggle/silke-toggle.scss +4 -4
  157. package/src/components/silke-toolbar/silke-toolbar.scss +1 -1
  158. package/src/components/silke-tooltip/silke-shortcuts.tsx +3 -3
  159. package/src/components/silke-tooltip/silke-tooltip.scss +11 -16
  160. package/src/components/silke-variables-wrapper/silke-variables-wrapper.scss +9 -7
  161. package/src/components/silke-virtual/silke-virtual.mdx +161 -0
  162. package/src/components/silke-virtual/silke-virtual.scss +8 -8
  163. package/src/icons.tsx +45 -1
  164. package/src/styles/core.scss +42 -45
  165. package/src/styles/math.scss +66 -66
  166. package/tsconfig.build.json +2 -6
  167. package/tsconfig.build.tsbuildinfo +1 -1
  168. package/tsconfig.json +3 -14
  169. package/dist/types/components/silke-list-card/index.d.ts +0 -1
  170. package/dist/types/components/silke-list-card/silke-list-card.d.ts +0 -14
  171. package/src/components/silke-list-card/index.ts +0 -1
  172. package/src/components/silke-list-card/silke-list-card.mdx +0 -46
  173. package/src/components/silke-list-card/silke-list-card.scss +0 -57
  174. 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
- <SilkeList>
4
- <SilkeListItem label="Plain list item" />
5
- <SilkeListItem label="List item with icon" icon="right" />
6
- <SilkeListItem label="Disabled list item" disabled />
7
- </SilkeList>
8
-
9
- <SilkeList select>
10
- <SilkeListItem label="Plain list item" />
11
- <SilkeListItem label="List item with icon" icon="right" />
12
- <SilkeListItem label="Disabled list item" disabled />
13
- </SilkeList>
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
- .list {
2
- min-width: 160px;
3
- list-style: none;
4
- margin: 0;
5
- padding:0;
6
- overflow: auto;
1
+ @use '../../variables' as *;
7
2
 
8
- .item:not(:first-child) {
9
- border-top: 1px solid var(--color-neutral-40);
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
- .item {
14
- margin: 0;
15
- padding:0;
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
- interface SilkeListProps {
5
- children: React.ReactNode;
6
- /** Show as a select list */
7
- select?: boolean;
8
- multiselect?: boolean;
9
- onChange?: (values: any[]) => void;
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
- export function SilkeList({ children }: SilkeListProps) {
13
- return <ul className={styles.list}>{children}</ul>;
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
- # Silke Loader
1
+ # SilkeLoader
2
2
 
3
- ## Basic Silke Loader
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
- <SilkeLoader message={'this is a message'} />
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 |
@@ -1,4 +1,4 @@
1
- @use "sass:math";
1
+ @use 'sass:math';
2
2
 
3
3
  $animationDuration: 0.8s;
4
4
  // Percent duration of fade transition between characters
@@ -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="true"] {
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="Item 0" {...helper(0)} icon="user" iconRight="add" />
12
- <SilkeNavigationLink label="Item 1" {...helper(1)} icon="users" />
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
+ ```