@vev/silke 1.1.6 → 1.1.8

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 (164) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/index.js +34 -34
  3. package/dist/index.js.LEGAL.txt +12 -12
  4. package/dist/styles.css +4416 -4020
  5. package/dist/types/components/index.d.ts +3 -2
  6. package/dist/types/components/silke-button/silke-dropdown-button.d.ts +8 -13
  7. package/dist/types/components/silke-card/silke-card-grid.d.ts +33 -1
  8. package/dist/types/components/silke-command-text-field/image-utils.d.ts +20 -0
  9. package/dist/types/components/silke-command-text-field/index.d.ts +4 -0
  10. package/dist/types/components/silke-command-text-field/silke-command-parser.d.ts +3 -0
  11. package/dist/types/components/silke-command-text-field/silke-command-parser.spec.d.ts +1 -0
  12. package/dist/types/components/silke-command-text-field/silke-command-text-field.d.ts +46 -0
  13. package/dist/types/components/silke-command-text-field/utils.d.ts +61 -0
  14. package/dist/types/components/silke-command-text-field/utils.spec.d.ts +1 -0
  15. package/dist/types/components/silke-conditions-input/utils.d.ts +1 -1
  16. package/dist/types/components/silke-form-schema/fields/color-field.d.ts +3 -0
  17. package/dist/types/components/silke-form-schema/schema-utils.d.ts +6 -1
  18. package/dist/types/components/silke-form-schema/silke-schema-fields.d.ts +1 -0
  19. package/dist/types/components/silke-image/silke-image.d.ts +2 -1
  20. package/dist/types/components/silke-list/index.d.ts +1 -0
  21. package/dist/types/components/silke-list/silke-list-item.d.ts +24 -6
  22. package/dist/types/components/silke-list/silke-list.d.ts +9 -9
  23. package/dist/types/components/silke-list/types.d.ts +19 -0
  24. package/dist/types/components/silke-list/utils.d.ts +3 -0
  25. package/dist/types/components/silke-navigation-link/silke-navigation-link.d.ts +1 -0
  26. package/dist/types/components/silke-overflow-menu/silke-overflow-menu.d.ts +6 -1
  27. package/dist/types/components/silke-popover-native/silke-popover-native.d.ts +3 -1
  28. package/dist/types/components/silke-shortcut-button/index.d.ts +1 -0
  29. package/dist/types/components/silke-shortcut-button/silke-shortcut-button.d.ts +15 -0
  30. package/dist/types/components/silke-tag/silke-tag.d.ts +1 -1
  31. package/dist/types/icons.d.ts +32 -0
  32. package/jest.config.js +2 -3
  33. package/package.json +7 -2
  34. package/src/_variables.scss +125 -129
  35. package/src/components/index.ts +3 -2
  36. package/src/components/silke-action-box/silke-action-box.scss +2 -3
  37. package/src/components/silke-alert-banner/silke-alert-banner.scss +9 -10
  38. package/src/components/silke-autocomplete-field/autocomplete-item.tsx +2 -2
  39. package/src/components/silke-autocomplete-field/silke-autocomplete-field.scss +18 -12
  40. package/src/components/silke-autocomplete-field/silke-autocomplete-popup-native.tsx +3 -2
  41. package/src/components/silke-autocomplete-field/silke-autocomplete-popup.tsx +63 -44
  42. package/src/components/silke-box/silke-box.mdx +321 -21
  43. package/src/components/silke-box/silke-box.scss +5 -5
  44. package/src/components/silke-breadcrumbs/silke-breadcrumb.mdx +147 -9
  45. package/src/components/silke-breadcrumbs/silke-breadcrumb.scss +3 -3
  46. package/src/components/silke-button/silke-big-button.scss +1 -1
  47. package/src/components/silke-button/silke-button.scss +24 -15
  48. package/src/components/silke-button/silke-dropdown-button.mdx +67 -0
  49. package/src/components/silke-button/silke-dropdown-button.tsx +40 -122
  50. package/src/components/silke-card/silke-card-grid.tsx +5 -3
  51. package/src/components/silke-card/silke-card.scss +8 -7
  52. package/src/components/silke-card/silke-card.tsx +7 -1
  53. package/src/components/silke-checkbox/silke-checkbox.mdx +139 -14
  54. package/src/components/silke-checkbox/silke-checkbox.scss +11 -11
  55. package/src/components/silke-color-picker/color-picker.scss +8 -8
  56. package/src/components/silke-color-swatches/silke-color-swatches.mdx +130 -0
  57. package/src/components/silke-command-text-field/image-utils.ts +71 -0
  58. package/src/components/silke-command-text-field/index.ts +12 -0
  59. package/src/components/silke-command-text-field/silke-command-parser.spec.ts +89 -0
  60. package/src/components/silke-command-text-field/silke-command-parser.ts +47 -0
  61. package/src/components/silke-command-text-field/silke-command-text-field.mdx +301 -0
  62. package/src/components/silke-command-text-field/silke-command-text-field.module.scss +119 -0
  63. package/src/components/silke-command-text-field/silke-command-text-field.tsx +672 -0
  64. package/src/components/silke-command-text-field/utils.spec.ts +366 -0
  65. package/src/components/silke-command-text-field/utils.ts +287 -0
  66. package/src/components/silke-conditions-input/silke-conditions-input.scss +4 -4
  67. package/src/components/silke-content-column/silke-content-column.scss +1 -1
  68. package/src/components/silke-context-menu/silke-context-menu.scss +3 -4
  69. package/src/components/silke-context-menu/silke-context-menu.tsx +1 -1
  70. package/src/components/silke-css-number-field/silke-css-number-field.scss +14 -12
  71. package/src/components/silke-divider/silke-divider.mdx +154 -32
  72. package/src/components/silke-divider/silke-divider.scss +3 -2
  73. package/src/components/silke-drawer/silke-drawer.scss +6 -2
  74. package/src/components/silke-form/silke-form.mdx +254 -27
  75. package/src/components/silke-form-schema/fields/array-field-inline.tsx +1 -0
  76. package/src/components/silke-form-schema/fields/array-field-modal.tsx +9 -4
  77. package/src/components/silke-form-schema/fields/array-field.tsx +27 -3
  78. package/src/components/silke-form-schema/fields/color-field.tsx +36 -0
  79. package/src/components/silke-form-schema/fields/styles.scss +34 -35
  80. package/src/components/silke-form-schema/schema-utils.ts +27 -1
  81. package/src/components/silke-form-schema/silke-schema-field.tsx +2 -0
  82. package/src/components/silke-form-schema/silke-schema-fields.tsx +4 -3
  83. package/src/components/silke-gradient-picker/silke-gradient-picker.module.scss +2 -2
  84. package/src/components/silke-icon/silke-icon.mdx +212 -8
  85. package/src/components/silke-icon/silke-icon.scss +10 -2
  86. package/src/components/silke-icon/silke-icon.tsx +1 -0
  87. package/src/components/silke-icon/silke-stacked-icon.scss +42 -45
  88. package/src/components/silke-icon-browser/silke-icon-browser.mdx +143 -0
  89. package/src/components/silke-image/silke-image-color-backdrop.scss +6 -6
  90. package/src/components/silke-image/silke-image.mdx +189 -41
  91. package/src/components/silke-image/silke-image.scss +3 -3
  92. package/src/components/silke-image/silke-image.tsx +14 -1
  93. package/src/components/silke-link/silke-link.scss +3 -5
  94. package/src/components/silke-list/index.ts +1 -0
  95. package/src/components/silke-list/silke-list-item.mdx +83 -0
  96. package/src/components/silke-list/silke-list-item.scss +119 -0
  97. package/src/components/silke-list/silke-list-item.tsx +137 -12
  98. package/src/components/silke-list/silke-list.mdx +108 -13
  99. package/src/components/silke-list/silke-list.scss +8 -15
  100. package/src/components/silke-list/silke-list.tsx +63 -9
  101. package/src/components/silke-list/types.ts +22 -0
  102. package/src/components/silke-list/utils.ts +24 -0
  103. package/src/components/silke-loader/silke-loader.mdx +139 -5
  104. package/src/components/silke-loader/silke-loader.scss +1 -1
  105. package/src/components/silke-modal/silke-modal.scss +9 -9
  106. package/src/components/silke-navigation-link/silke-navigation-link.mdx +27 -2
  107. package/src/components/silke-navigation-link/silke-navigation-link.scss +34 -40
  108. package/src/components/silke-navigation-link/silke-navigation-link.tsx +7 -6
  109. package/src/components/silke-overflow-menu/silke-overflow-menu.mdx +228 -31
  110. package/src/components/silke-overflow-menu/silke-overflow-menu.scss +8 -8
  111. package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +14 -8
  112. package/src/components/silke-popover/silke-popover.scss +5 -5
  113. package/src/components/silke-popover-native/silke-popover-native.scss +93 -78
  114. package/src/components/silke-popover-native/silke-popover-native.tsx +4 -0
  115. package/src/components/silke-popover-native/use-popover-positioning.ts +1 -3
  116. package/src/components/silke-progress-indicator/silke-progress-indicator.scss +1 -1
  117. package/src/components/silke-radio-button/silke-radio-button.scss +18 -11
  118. package/src/components/silke-search-field/silke-search-field.mdx +161 -7
  119. package/src/components/silke-shortcut-button/index.ts +1 -0
  120. package/src/components/silke-shortcut-button/silke-shortcut-button.mdx +89 -0
  121. package/src/components/silke-shortcut-button/silke-shortcut-button.scss +145 -0
  122. package/src/components/silke-shortcut-button/silke-shortcut-button.tsx +55 -0
  123. package/src/components/silke-skeleton/silke-skeleton.mdx +109 -0
  124. package/src/components/silke-skeleton/silke-skeleton.scss +1 -1
  125. package/src/components/silke-slider/silke-slider.module.scss +19 -19
  126. package/src/components/silke-sortable-list/silke-nested-sortable-list.scss +3 -3
  127. package/src/components/silke-sortable-list/silke-sortable-list.scss +4 -5
  128. package/src/components/silke-table/silke-table.scss +1 -1
  129. package/src/components/silke-tabs/silke-tabs.scss +3 -3
  130. package/src/components/silke-tag/silke-tag.mdx +179 -43
  131. package/src/components/silke-tag/silke-tag.scss +50 -13
  132. package/src/components/silke-tag/silke-tag.tsx +17 -7
  133. package/src/components/silke-text/silke-text.scss +6 -4
  134. package/src/components/silke-text/silke-title.scss +7 -14
  135. package/src/components/silke-text-field/silke-text-field.scss +9 -9
  136. package/src/components/silke-text-field/silke-text-field.tsx +1 -1
  137. package/src/components/silke-tile/silke-tile.scss +7 -3
  138. package/src/components/silke-toast-notification/silke-toast-notification.scss +4 -5
  139. package/src/components/silke-toggle/silke-toggle.mdx +163 -33
  140. package/src/components/silke-toggle/silke-toggle.scss +4 -4
  141. package/src/components/silke-toolbar/silke-toolbar.scss +1 -1
  142. package/src/components/silke-tooltip/silke-shortcuts.tsx +3 -3
  143. package/src/components/silke-tooltip/silke-tooltip.scss +11 -16
  144. package/src/components/silke-variables-wrapper/silke-variables-wrapper.scss +9 -7
  145. package/src/components/silke-virtual/silke-virtual.mdx +161 -0
  146. package/src/components/silke-virtual/silke-virtual.scss +8 -8
  147. package/src/icons.tsx +58 -1
  148. package/src/styles/core.scss +42 -45
  149. package/src/styles/math.scss +66 -66
  150. package/tsconfig.build.json +2 -6
  151. package/tsconfig.build.tsbuildinfo +1 -1
  152. package/tsconfig.json +3 -14
  153. package/dist/types/components/silke-action-list/index.d.ts +0 -1
  154. package/dist/types/components/silke-action-list/silke-action-list.d.ts +0 -11
  155. package/dist/types/components/silke-list-card/index.d.ts +0 -1
  156. package/dist/types/components/silke-list-card/silke-list-card.d.ts +0 -14
  157. package/src/components/silke-action-list/index.ts +0 -1
  158. package/src/components/silke-action-list/silke-action-list.mdx +0 -48
  159. package/src/components/silke-action-list/silke-action-list.scss +0 -21
  160. package/src/components/silke-action-list/silke-action-list.tsx +0 -85
  161. package/src/components/silke-list-card/index.ts +0 -1
  162. package/src/components/silke-list-card/silke-list-card.mdx +0 -46
  163. package/src/components/silke-list-card/silke-list-card.scss +0 -57
  164. package/src/components/silke-list-card/silke-list-card.tsx +0 -63
@@ -1,5 +1,5 @@
1
1
  import { ArrayField as ArrayFieldType, SchemaFieldProps, VevProps } from '@vev/utils';
2
- import React, { useCallback, useRef, useState } from 'react';
2
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { SilkeBox } from '../../silke-box';
4
4
  import { SilkeButton } from '../../silke-button';
5
5
  import { SilkeIcon } from '../../silke-icon';
@@ -12,6 +12,7 @@ import { SilkeOverflowMenu } from '../../silke-overflow-menu';
12
12
  import { generateImage, generateTitle } from './utils';
13
13
  import { isString, startCase } from 'lodash';
14
14
  import { getTitle } from './utils/schema-util';
15
+ import { getSchemaDefaultValue } from '../schema-utils';
15
16
 
16
17
  const ArrayField = ({
17
18
  value = [],
@@ -26,6 +27,21 @@ const ArrayField = ({
26
27
 
27
28
  const listRefs = useRef<any[]>([]);
28
29
  const headerRef = useRef<any>(null);
30
+ const valueRef = useRef(value);
31
+
32
+ useEffect(() => {
33
+ valueRef.current = value;
34
+ }, [value]);
35
+
36
+ const addItem = useCallback(
37
+ (defaultValue: any) => {
38
+ const newValue = [...valueRef.current, defaultValue];
39
+ valueRef.current = newValue;
40
+ onChange(newValue);
41
+ setSelected(newValue.length - 1);
42
+ },
43
+ [onChange],
44
+ );
29
45
 
30
46
  const handleDeleteItem = useCallback(() => {
31
47
  const update = value.filter((_, i) => i !== selected);
@@ -63,7 +79,7 @@ const ArrayField = ({
63
79
  icon: <Icon />,
64
80
  onClick: () => {
65
81
  setSchemaIndex(i);
66
- setSelected(value.length || 0);
82
+ addItem(getSchemaDefaultValue((schema.of as VevProps[])[i]));
67
83
  },
68
84
  };
69
85
  })}
@@ -74,7 +90,15 @@ const ArrayField = ({
74
90
  kind="ghost"
75
91
  size="base"
76
92
  onClick={() => {
77
- setSelected(value.length || 0);
93
+ const defaultValue =
94
+ Array.isArray(schema.of)
95
+ ? getSchemaDefaultValue(schema.of[0])
96
+ : schema.of === 'object' && 'fields' in schema
97
+ ? getSchemaDefaultValue(schema.fields)
98
+ : schema.of === 'number'
99
+ ? 0
100
+ : '';
101
+ addItem(defaultValue);
78
102
  }}
79
103
  />
80
104
  )}
@@ -0,0 +1,36 @@
1
+ import { SchemaFieldProps, ColorField as ColorFieldType } from '@vev/utils';
2
+ import { SilkeColorPickerButton } from '../../silke-color-picker';
3
+ import React from 'react';
4
+ import { SilkeBox } from '../../silke-box';
5
+ import { getTitle } from './utils/schema-util';
6
+ import { SilkeTextSmall } from '../../silke-text';
7
+ import { SilkeIconTooltip } from '../../silke-tooltip';
8
+
9
+ const ColorField = ({
10
+ schema,
11
+ value,
12
+ disabled,
13
+ readonly,
14
+ onChange,
15
+ }: SchemaFieldProps<ColorFieldType>) => {
16
+ return (
17
+ <SilkeBox flex align="center">
18
+ <SilkeBox align="center" fill>
19
+ <SilkeBox vAlign="center" flex>
20
+ <SilkeTextSmall>{getTitle(schema)}</SilkeTextSmall>
21
+ {schema.description && <SilkeIconTooltip tooltip={schema.description} icon="tooltip" />}
22
+ </SilkeBox>
23
+ </SilkeBox>
24
+ <SilkeBox flex pad="xs">
25
+ <SilkeColorPickerButton
26
+ disabled={disabled}
27
+ value={value as any}
28
+ onChange={onChange}
29
+ size="s"
30
+ />
31
+ </SilkeBox>
32
+ </SilkeBox>
33
+ );
34
+ };
35
+
36
+ export default ColorField;
@@ -1,53 +1,52 @@
1
1
  .image {
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;
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
- width: 24px;
17
- height: 24px;
16
+ width: 24px;
17
+ height: 24px;
18
18
  }
19
19
 
20
20
  .arrayItem {
21
- padding: 4px 0;
22
- border-radius: 4px;
23
-
24
- &:hover {
25
- background-color: var(--neutral-20);
21
+ padding: 4px 0;
22
+ border-radius: 4px;
26
23
 
27
- & .arrayItemButtons {
28
- opacity: 1;
29
- }
30
- }
24
+ &:hover {
25
+ background-color: var(--neutral-20);
31
26
 
32
27
  & .arrayItemButtons {
33
- opacity: 0;
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
- position: absolute;
41
- top: 4%;
42
- right: 4%;
40
+ position: absolute;
41
+ top: 4%;
42
+ right: 4%;
43
43
  }
44
44
 
45
-
46
45
  .arrayFieldModal {
47
- width: 256px;
48
- border-radius: 8px;
49
- border-right: 1px solid var(--color-neutral-0);
50
- padding-bottom: 16px;
51
- max-height: 100vh;
52
- overflow: auto;
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
  }
@@ -1,4 +1,4 @@
1
- import { EvalCallback, Schema, SchemaContextModel } from '@vev/utils';
1
+ import { EvalCallback, Schema, SchemaContextModel, VevProps } from '@vev/utils';
2
2
  import { isFunction } from 'lodash';
3
3
  import { useEffect, useState } from 'react';
4
4
  import { safeEvalFunction } from './safe-eval';
@@ -37,6 +37,32 @@ export async function getSchemaInitialValue<T extends InitialValue>(
37
37
  return res;
38
38
  }
39
39
 
40
+ /**
41
+ * Synchronously compute default/initial values from a schema.
42
+ * Handles static initialValue only (skips eval callbacks and functions).
43
+ */
44
+ export function getSchemaDefaultValue(schema: VevProps | VevProps[]): InitialValue {
45
+ const fields = Array.isArray(schema) ? schema : [schema];
46
+ const res: InitialValue = {};
47
+ for (const field of fields) {
48
+ if (field.name && field.type) {
49
+ if (field.type === 'object') {
50
+ res[field.name] = getSchemaDefaultValue(field.fields);
51
+ continue;
52
+ }
53
+
54
+ if (
55
+ field.initialValue &&
56
+ !isEvalCallback(field.initialValue) &&
57
+ !isFunction(field.initialValue)
58
+ ) {
59
+ res[field.name] = field.initialValue as any;
60
+ }
61
+ }
62
+ }
63
+ return res;
64
+ }
65
+
40
66
  export function useStorageField<T>(
41
67
  name: string,
42
68
  storageScope: 'project' | 'workspace' | 'account',
@@ -27,6 +27,7 @@ import IconField from './fields/icon-field';
27
27
  import EventField from './fields/event-field';
28
28
  import UploadField from './fields/upload-field';
29
29
  import AudioField from './fields/audio-field';
30
+ import ColorField from './fields/color-field';
30
31
 
31
32
  type SilkeSchemaFieldProps = {
32
33
  field: VevProps;
@@ -39,6 +40,7 @@ type SilkeSchemaFieldProps = {
39
40
 
40
41
  const SCHEMA_FIELD_COMPONENTS: Partial<SchemaFieldComponents> = {
41
42
  string: StringField,
43
+ color: ColorField,
42
44
  number: NumberField,
43
45
  array: ArrayField,
44
46
  image: ImageField,
@@ -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
- # Icons
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
- <SilkeBox gap wrap>
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: 150 }}>
13
- <SilkeIcon key={icon} icon={icon} style={{ fontSize: 24 }} />
14
- <span>{icon}</span>
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 "../../variables" as *;
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
- position: absolute;
5
- font-size: 40% !important;
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
- &.top-center {
16
- :first-child {
17
- top: -10%;
18
- }
13
+ &.top-center {
14
+ :first-child {
15
+ top: -10%;
19
16
  }
17
+ }
20
18
 
21
- &.top-right {
22
- :first-child {
23
- top: -10%;
24
- right: -10%;
25
- }
19
+ &.top-right {
20
+ :first-child {
21
+ top: -10%;
22
+ right: -10%;
26
23
  }
24
+ }
27
25
 
28
- &.center-right {
29
- :first-child {
30
- right: -10%;
31
- }
26
+ &.center-right {
27
+ :first-child {
28
+ right: -10%;
32
29
  }
30
+ }
33
31
 
34
- &.bottom-right {
35
- :first-child {
36
- bottom: -10%;
37
- right: -10%;
38
- }
32
+ &.bottom-right {
33
+ :first-child {
34
+ bottom: -10%;
35
+ right: -10%;
39
36
  }
37
+ }
40
38
 
41
- &.bottom-center {
42
- :first-child {
43
- bottom: -10%;
44
- }
39
+ &.bottom-center {
40
+ :first-child {
41
+ bottom: -10%;
45
42
  }
43
+ }
46
44
 
47
- &.bottom-left {
48
- :first-child {
49
- bottom: -10%;
50
- left: -10%;
51
- }
45
+ &.bottom-left {
46
+ :first-child {
47
+ bottom: -10%;
48
+ left: -10%;
52
49
  }
50
+ }
53
51
 
54
- &.center-left {
55
- :first-child {
56
- left: -10%;
57
- }
52
+ &.center-left {
53
+ :first-child {
54
+ left: -10%;
58
55
  }
56
+ }
59
57
 
60
- .center-center {
61
-
62
- }
63
- }
58
+ .center-center {
59
+ }
60
+ }