@vev/silke 1.1.8 → 1.1.10
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/.turbo/turbo-build.log +800 -0
- package/CHANGELOG.md +17 -0
- package/CLAUDE.md +102 -0
- package/dist/index.js +44 -40
- package/dist/index.js.LEGAL.txt +1 -1
- package/dist/styles.css +470 -254
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/silke-command-text-field/attachment-chip.d.ts +8 -0
- package/dist/types/components/silke-command-text-field/attachment-list.d.ts +15 -0
- package/dist/types/components/silke-command-text-field/file-utils.d.ts +33 -0
- package/dist/types/components/silke-command-text-field/file-utils.spec.d.ts +1 -0
- package/dist/types/components/silke-command-text-field/index.d.ts +6 -1
- package/dist/types/components/silke-command-text-field/silke-command-text-field.d.ts +23 -6
- package/dist/types/components/silke-command-text-field/utils.d.ts +14 -1
- package/dist/types/components/silke-conditions-input/utils.d.ts +1 -1
- package/dist/types/components/silke-css-number-field/silke-css-context.d.ts +2 -0
- package/dist/types/components/silke-css-number-field/silke-css-number-field.d.ts +2 -0
- package/dist/types/components/silke-css-number-field/utils.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/group-field.d.ts +3 -0
- package/dist/types/components/silke-form-schema/fields/object-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/popover-field.d.ts +3 -0
- package/dist/types/components/silke-form-schema/fields/utils/generate-image.d.ts +5 -0
- package/dist/types/components/silke-form-schema/fields/utils/index.d.ts +1 -1
- package/dist/types/components/silke-form-schema/silke-schema-field.d.ts +2 -1
- package/dist/types/components/silke-gradient-picker/index.d.ts +3 -0
- package/dist/types/components/silke-icon/silke-icon.d.ts +1 -1
- package/dist/types/components/silke-list/silke-list.d.ts +6 -1
- package/dist/types/components/silke-list/types.d.ts +2 -0
- package/dist/types/components/silke-shortcut-button/silke-shortcut-button.d.ts +4 -1
- package/dist/types/components/silke-theme-card/index.d.ts +1 -0
- package/dist/types/components/silke-theme-card/silke-theme-card.d.ts +18 -0
- package/dist/types/components/silke-theme-swatch/index.d.ts +1 -0
- package/dist/types/components/silke-theme-swatch/silke-theme-swatch.d.ts +11 -0
- package/dist/types/icons.d.ts +7 -2
- package/package.json +32 -20
- package/src/components/index.ts +2 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-popup-native.tsx +25 -18
- package/src/components/silke-button/silke-dropdown-button.mdx +1 -1
- package/src/components/silke-color-picker/color.ts +5 -3
- package/src/components/silke-color-swatches/silke-swatches.tsx +3 -3
- package/src/components/silke-command-text-field/attachment-chip.tsx +71 -0
- package/src/components/silke-command-text-field/attachment-list.tsx +72 -0
- package/src/components/silke-command-text-field/file-utils.spec.ts +148 -0
- package/src/components/silke-command-text-field/file-utils.ts +159 -0
- package/src/components/silke-command-text-field/index.ts +14 -0
- package/src/components/silke-command-text-field/silke-command-text-field.mdx +109 -13
- package/src/components/silke-command-text-field/silke-command-text-field.module.scss +65 -40
- package/src/components/silke-command-text-field/silke-command-text-field.tsx +113 -135
- package/src/components/silke-command-text-field/utils.spec.ts +109 -1
- package/src/components/silke-command-text-field/utils.ts +44 -7
- package/src/components/silke-css-number-field/silke-css-context.tsx +2 -0
- package/src/components/silke-css-number-field/silke-css-number-field.tsx +7 -4
- package/src/components/silke-css-number-field/utils.ts +8 -2
- package/src/components/silke-form-schema/fields/array-field-modal.tsx +69 -48
- package/src/components/silke-form-schema/fields/array-field.tsx +144 -130
- package/src/components/silke-form-schema/fields/color-field.tsx +118 -18
- package/src/components/silke-form-schema/fields/group-field.tsx +49 -0
- package/src/components/silke-form-schema/fields/icon-field.tsx +59 -39
- package/src/components/silke-form-schema/fields/image-field.tsx +50 -39
- package/src/components/silke-form-schema/fields/number-field.tsx +190 -116
- package/src/components/silke-form-schema/fields/object-field.tsx +2 -0
- package/src/components/silke-form-schema/fields/popover-field.tsx +65 -0
- package/src/components/silke-form-schema/fields/select-field.tsx +43 -30
- package/src/components/silke-form-schema/fields/string-field.tsx +1 -1
- package/src/components/silke-form-schema/fields/styles.scss +2 -39
- package/src/components/silke-form-schema/fields/toggle-field.tsx +48 -15
- package/src/components/silke-form-schema/fields/utils/generate-image.ts +20 -0
- package/src/components/silke-form-schema/fields/utils/generate-title.ts +1 -1
- package/src/components/silke-form-schema/fields/utils/index.ts +1 -1
- package/src/components/silke-form-schema/silke-form-schema.mdx +498 -311
- package/src/components/silke-form-schema/silke-schema-field.tsx +10 -3
- package/src/components/silke-form-schema/silke-schema-fields.tsx +9 -5
- package/src/components/silke-gradient-picker/index.ts +3 -0
- package/src/components/silke-icon/silke-icon.mdx +13 -1
- package/src/components/silke-icon/silke-icon.tsx +6 -2
- package/src/components/silke-list/silke-list.tsx +59 -26
- package/src/components/silke-list/types.ts +2 -0
- package/src/components/silke-navigation-link/silke-navigation-link.scss +1 -0
- package/src/components/silke-shortcut-button/silke-shortcut-button.scss +16 -0
- package/src/components/silke-shortcut-button/silke-shortcut-button.tsx +9 -0
- package/src/components/silke-slider/silke-slider.module.scss +1 -1
- package/src/components/silke-text-field/silke-text-field-outline.tsx +9 -6
- package/src/components/silke-text-field/silke-text-field.scss +3 -0
- package/src/components/silke-text-field/silke-text-field.tsx +1 -1
- package/src/components/silke-theme-card/index.ts +1 -0
- package/src/components/silke-theme-card/silke-theme-card.mdx +50 -0
- package/src/components/silke-theme-card/silke-theme-card.module.scss +82 -0
- package/src/components/silke-theme-card/silke-theme-card.tsx +82 -0
- package/src/components/silke-theme-swatch/index.ts +1 -0
- package/src/components/silke-theme-swatch/silke-theme-swatch.mdx +59 -0
- package/src/components/silke-theme-swatch/silke-theme-swatch.module.scss +108 -0
- package/src/components/silke-theme-swatch/silke-theme-swatch.tsx +49 -0
- package/src/components/silke-variables-wrapper/silke-variables-wrapper.tsx +9 -8
- package/src/icons.tsx +41 -7
- package/tsconfig.build.tsbuildinfo +1 -1
- package/project.json +0 -12
|
@@ -34,7 +34,9 @@ export * from './silke-table';
|
|
|
34
34
|
export * from './silke-tabs';
|
|
35
35
|
export * from './silke-tag';
|
|
36
36
|
export * from './silke-text';
|
|
37
|
+
export * from './silke-theme-card';
|
|
37
38
|
export * from './silke-theme-editor';
|
|
39
|
+
export * from './silke-theme-swatch';
|
|
38
40
|
export * from './silke-tile';
|
|
39
41
|
export * from './silke-toolbar';
|
|
40
42
|
export * from './silke-tooltip';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SilkeFileValue, SilkeImageValue } from './utils';
|
|
2
|
+
interface AttachmentChipProps {
|
|
3
|
+
attachment: SilkeImageValue | SilkeFileValue;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
onRemove?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function AttachmentChip({ attachment, disabled, onRemove }: AttachmentChipProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SilkeFileValue, SilkeImageValue } from './utils';
|
|
3
|
+
interface AttachmentListProps {
|
|
4
|
+
acceptedTypes: string[];
|
|
5
|
+
attachments: (SilkeImageValue | SilkeFileValue)[];
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
onAdd: (attachments: (SilkeImageValue | SilkeFileValue)[]) => void;
|
|
8
|
+
onRemove: (index: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface AttachmentListHandle {
|
|
11
|
+
/** Open the file picker dialog */
|
|
12
|
+
openFilePicker: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const AttachmentList: React.ForwardRefExoticComponent<AttachmentListProps & React.RefAttributes<AttachmentListHandle>>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SilkeIcons } from '../silke-icon/silke-icon';
|
|
2
|
+
import { SilkeFileValue, SilkeImageValue } from './utils';
|
|
3
|
+
/** File type category for the acceptedFileTypes prop */
|
|
4
|
+
export type SilkeFileCategory = 'image' | 'text';
|
|
5
|
+
/** Resolve file categories to a flat list of MIME patterns */
|
|
6
|
+
export declare function resolveFileCategories(categories: SilkeFileCategory[]): string[];
|
|
7
|
+
/**
|
|
8
|
+
* Check if a MIME type matches a set of MIME patterns.
|
|
9
|
+
* Supports exact matches ('text/csv') and wildcard subtypes ('image/*').
|
|
10
|
+
*/
|
|
11
|
+
export declare function matchesMimePattern(mimeType: string, patterns: string[]): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Reads a File and converts it to a SilkeImageValue or SilkeFileValue.
|
|
14
|
+
* Images produce SilkeImageValue for backward compatibility; other files produce SilkeFileValue.
|
|
15
|
+
* Returns null if the file type is not in the accepted patterns.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fileToAttachmentValue(file: File, acceptedTypes: string[]): Promise<SilkeImageValue | SilkeFileValue | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Extract the first matching file from a ClipboardEvent given accepted MIME patterns.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getFileFromClipboard(e: React.ClipboardEvent, acceptedTypes: string[]): File | null;
|
|
22
|
+
/**
|
|
23
|
+
* Extract the first matching file from a DragEvent given accepted MIME patterns.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getFileFromDragEvent(e: DragEvent, acceptedTypes: string[]): File | null;
|
|
26
|
+
/**
|
|
27
|
+
* Maps a MIME type to a SilkeIcon key for display.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getFileIcon(mimeType: string): SilkeIcons;
|
|
30
|
+
/**
|
|
31
|
+
* Truncate a filename for display, preserving the extension.
|
|
32
|
+
*/
|
|
33
|
+
export declare function truncateFilename(name: string, maxLength?: number): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
export { AttachmentChip } from './attachment-chip';
|
|
2
|
+
export { AttachmentList } from './attachment-list';
|
|
3
|
+
export type { AttachmentListHandle } from './attachment-list';
|
|
4
|
+
export { fileToAttachmentValue, getFileFromClipboard, getFileFromDragEvent, matchesMimePattern, resolveFileCategories, } from './file-utils';
|
|
5
|
+
export type { SilkeFileCategory } from './file-utils';
|
|
1
6
|
export { fileToImageValue, imageValueToDataUrl } from './image-utils';
|
|
2
7
|
export { parseTextToSilkeCommands } from './silke-command-parser';
|
|
3
8
|
export * from './silke-command-text-field';
|
|
4
|
-
export { SilkeCommand, SilkeCommandTextFieldValue, SilkeCommandType, SilkeImageValue, SilkeTextValue, convertSilkeCommandsToString, isImage, } from './utils';
|
|
9
|
+
export { SilkeCommand, SilkeCommandTextFieldValue, SilkeCommandType, SilkeFileValue, SilkeImageValue, SilkeTextValue, convertSilkeCommandsToString, isAttachment, isFile, isImage, } from './utils';
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SilkeTextFieldOutlineProps } from '../silke-text-field/silke-text-field-outline';
|
|
3
|
+
import { SilkeFileCategory } from './file-utils';
|
|
3
4
|
import { SilkeCommand, SilkeCommandTextFieldValue } from './utils';
|
|
4
|
-
export type SilkeCommandTextFieldProps =
|
|
5
|
+
export type SilkeCommandTextFieldProps = SilkeTextFieldOutlineProps & {
|
|
6
|
+
/**
|
|
7
|
+
* File type categories to accept as attachments.
|
|
8
|
+
* - `'image'` — all image types (png, jpeg, gif, etc.)
|
|
9
|
+
* - `'text'` — documents and text files (PDF, Word, Excel, CSV, TXT, JSON, etc.)
|
|
10
|
+
* Defaults to `[]` (no files accepted).
|
|
11
|
+
*/
|
|
12
|
+
acceptedFileTypes?: SilkeFileCategory[];
|
|
5
13
|
autoFocus?: boolean;
|
|
6
14
|
availableCommands: SilkeCommand[];
|
|
7
15
|
disabled?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
|
|
16
|
+
/** Maximum height in pixels before the field starts scrolling */
|
|
17
|
+
maxHeight?: number;
|
|
10
18
|
name?: string;
|
|
11
19
|
onChange: (value: SilkeCommandTextFieldValue[]) => void;
|
|
12
20
|
onCommandFocus?: (index: number, command: SilkeCommandTextFieldValue | undefined) => void;
|
|
@@ -20,6 +28,8 @@ export type SilkeCommandTextFieldHandle = {
|
|
|
20
28
|
blur: () => void;
|
|
21
29
|
/** Focus the input */
|
|
22
30
|
focus: () => void;
|
|
31
|
+
/** Open the file picker dialog (requires acceptedFileTypes to be set) */
|
|
32
|
+
openFilePicker: () => void;
|
|
23
33
|
/** Get the current value as a string */
|
|
24
34
|
toString: (value?: SilkeCommandTextFieldValue[]) => string;
|
|
25
35
|
/**
|
|
@@ -29,12 +39,19 @@ export type SilkeCommandTextFieldHandle = {
|
|
|
29
39
|
*/
|
|
30
40
|
update: (command: SilkeCommand, index?: number) => void;
|
|
31
41
|
};
|
|
32
|
-
declare const SilkeCommandTextField: React.ForwardRefExoticComponent<
|
|
42
|
+
declare const SilkeCommandTextField: React.ForwardRefExoticComponent<SilkeTextFieldOutlineProps & {
|
|
43
|
+
/**
|
|
44
|
+
* File type categories to accept as attachments.
|
|
45
|
+
* - `'image'` — all image types (png, jpeg, gif, etc.)
|
|
46
|
+
* - `'text'` — documents and text files (PDF, Word, Excel, CSV, TXT, JSON, etc.)
|
|
47
|
+
* Defaults to `[]` (no files accepted).
|
|
48
|
+
*/
|
|
49
|
+
acceptedFileTypes?: SilkeFileCategory[];
|
|
33
50
|
autoFocus?: boolean;
|
|
34
51
|
availableCommands: SilkeCommand[];
|
|
35
52
|
disabled?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
|
|
53
|
+
/** Maximum height in pixels before the field starts scrolling */
|
|
54
|
+
maxHeight?: number;
|
|
38
55
|
name?: string;
|
|
39
56
|
onChange: (value: SilkeCommandTextFieldValue[]) => void;
|
|
40
57
|
onCommandFocus?: (index: number, command: SilkeCommandTextFieldValue | undefined) => void;
|
|
@@ -20,7 +20,16 @@ export type SilkeImageValue = {
|
|
|
20
20
|
/** Optional filename */
|
|
21
21
|
name?: string;
|
|
22
22
|
};
|
|
23
|
-
export type
|
|
23
|
+
export type SilkeFileValue = {
|
|
24
|
+
type: 'file';
|
|
25
|
+
/** Base64-encoded file data */
|
|
26
|
+
data: string;
|
|
27
|
+
/** MIME type (e.g., 'text/csv', 'application/vnd.ms-excel') */
|
|
28
|
+
mimeType: string;
|
|
29
|
+
/** Filename */
|
|
30
|
+
name: string;
|
|
31
|
+
};
|
|
32
|
+
export type SilkeCommandTextFieldValue = SilkeCommand | SilkeTextValue | SilkeImageValue | SilkeFileValue;
|
|
24
33
|
/** Key direction mappings for navigation and editing */
|
|
25
34
|
export declare const KEY_DIRECTION: Record<string, number>;
|
|
26
35
|
/** Get the caret offset within a contentEditable element */
|
|
@@ -47,6 +56,10 @@ export declare function isSilkeCommand(value: SilkeCommandTextFieldValue | undef
|
|
|
47
56
|
export declare function isText(value: SilkeCommandTextFieldValue | undefined): value is SilkeTextValue;
|
|
48
57
|
/** Check if a command value is an image */
|
|
49
58
|
export declare function isImage(value: SilkeCommandTextFieldValue | undefined): value is SilkeImageValue;
|
|
59
|
+
/** Check if a command value is a non-image file attachment */
|
|
60
|
+
export declare function isFile(value: SilkeCommandTextFieldValue | undefined): value is SilkeFileValue;
|
|
61
|
+
/** Check if a command value is any attachment (image or file) */
|
|
62
|
+
export declare function isAttachment(value: SilkeCommandTextFieldValue | undefined): value is SilkeImageValue | SilkeFileValue;
|
|
50
63
|
/**
|
|
51
64
|
* Calculate a match score for a command against a search query.
|
|
52
65
|
* Higher scores indicate better matches.
|
|
@@ -8,4 +8,4 @@ export declare const getSuggestions: (searchValue: string, variables: SilkeCSSCo
|
|
|
8
8
|
export declare const getSystemSuggestionOptions: (value: string | number | boolean, systemOptions?: VevConditionSuggestion[]) => ConditionSuggestion[];
|
|
9
9
|
export declare const getWidgetSuggestionOptions: (value: string | number | boolean, widgetOptions?: VevProps[]) => ConditionSuggestion[];
|
|
10
10
|
export declare const isWidgetOption: (value: string | number | boolean, widgetOptions?: VevProps[]) => boolean;
|
|
11
|
-
export declare const getWidgetOptionType: (value: string | number | boolean, widgetOptions?: VevProps[]) => "string" | "number" | "boolean" | "object" | "link" | "audio" | "menu" | "select" | "video" | "image" | "color" | "layout" | "icon" | "upload" | "divider" | "variable" | "array" | "event" | "widgetSelect" | "mainComponent" | undefined;
|
|
11
|
+
export declare const getWidgetOptionType: (value: string | number | boolean, widgetOptions?: VevProps[]) => "string" | "number" | "boolean" | "object" | "link" | "audio" | "menu" | "select" | "video" | "image" | "popover" | "color" | "layout" | "icon" | "group" | "upload" | "divider" | "variable" | "array" | "event" | "widgetSelect" | "mainComponent" | undefined;
|
|
@@ -7,6 +7,8 @@ export type SilkeCssNumberFieldProps = FormFieldProps<string> & SilkeTextFieldOu
|
|
|
7
7
|
options?: (SilkeOverflowMenuItem | 'divider')[];
|
|
8
8
|
min?: number;
|
|
9
9
|
max?: number;
|
|
10
|
+
/** Override the default decimal precision for the current format */
|
|
11
|
+
precision?: number;
|
|
10
12
|
autoFocus?: boolean;
|
|
11
13
|
allowAuto?: boolean | string;
|
|
12
14
|
disableVariables?: boolean;
|
|
@@ -24,7 +24,7 @@ export declare const FORMAT_LABELS: {
|
|
|
24
24
|
rad: string;
|
|
25
25
|
s: string;
|
|
26
26
|
};
|
|
27
|
-
export declare function roundCSSNumber(value: number, format: string, min?: number, max?: number): number;
|
|
27
|
+
export declare function roundCSSNumber(value: number, format: string, min?: number, max?: number, precisionOverride?: number): number;
|
|
28
28
|
export declare function formatNumberForDisplay(value: string): string;
|
|
29
29
|
export declare function convertCSSNumberString(numberText: string, format: string, min?: number, max?: number): number;
|
|
30
30
|
export declare function convertCSSNumberFormat(value: number, fromFormat: string, toFormat: string, context: SilkeCSSContextType, min?: number, max?: number, axis?: 'x' | 'y'): string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { GroupField as GroupFieldType, SchemaFieldProps } from '@vev/utils';
|
|
2
|
+
/** Collapsible card section. Renders a clickable header with chevron inside a surface-1 card. */
|
|
3
|
+
export default function GroupField({ value, schema, disabled, readonly, }: SchemaFieldProps<GroupFieldType>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ObjectField as ObjectFieldType, SchemaFieldProps } from '@vev/utils';
|
|
2
|
-
export default function ObjectField({ value, schema, disabled, readonly, onChange, }: SchemaFieldProps<ObjectFieldType>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function ObjectField({ value, schema, disabled, readonly, onChange, itemIndex, }: SchemaFieldProps<ObjectFieldType>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PopoverField as PopoverFieldType, SchemaFieldProps } from '@vev/utils';
|
|
2
|
+
/** Icon button that opens a popover with nested fields. Closes on outside click or Escape. */
|
|
3
|
+
export default function PopoverField({ value, schema, disabled, readonly, }: SchemaFieldProps<PopoverFieldType>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { VevProps } from '@vev/utils';
|
|
3
3
|
export declare const generateImage: (data: VevProps | VevProps[] | string, schema?: VevProps | VevProps[] | string) => string | ReactNode | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Finds the first image field in the schema and returns its URL from the item data,
|
|
6
|
+
* or `true` if the field exists but has no value (to signal a fallback icon).
|
|
7
|
+
*/
|
|
8
|
+
export declare const getImageFieldUrl: (data: Record<string, any>, schema?: VevProps | VevProps[] | string) => string | true | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { generateTitle } from './generate-title';
|
|
2
|
-
export { generateImage } from './generate-image';
|
|
2
|
+
export { generateImage, getImageFieldUrl } from './generate-image';
|
|
@@ -6,6 +6,7 @@ type SilkeSchemaFieldProps = {
|
|
|
6
6
|
isFirst?: boolean;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
readonly?: boolean;
|
|
9
|
+
itemIndex?: number;
|
|
9
10
|
};
|
|
10
|
-
export declare function SilkeSchemaField({ field, value: fieldValue, noPad, isFirst, disabled, readonly, }: SilkeSchemaFieldProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export declare function SilkeSchemaField({ field, value: fieldValue, noPad, isFirst, disabled, readonly, itemIndex, }: SilkeSchemaFieldProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
12
|
export {};
|
|
@@ -2,7 +2,7 @@ import { IEmojiIcon } from '@vev/utils';
|
|
|
2
2
|
import React, { HTMLAttributes } from 'react';
|
|
3
3
|
import { SilkeIconDefinitions } from '../../icons';
|
|
4
4
|
import { SilkeColor } from '../../silke-theme-provider';
|
|
5
|
-
export type SilkeIcons = keyof typeof SilkeIconDefinitions | null | IEmojiIcon
|
|
5
|
+
export type SilkeIcons = keyof typeof SilkeIconDefinitions | null | IEmojiIcon | `fa-${string}`;
|
|
6
6
|
interface SilkeIconProps extends HTMLAttributes<HTMLElement> {
|
|
7
7
|
icon: SilkeIcons | React.ReactElement;
|
|
8
8
|
color?: SilkeColor | string;
|
|
@@ -4,7 +4,12 @@ type SilkeListProps = {
|
|
|
4
4
|
size?: 's' | 'base';
|
|
5
5
|
gap?: boolean;
|
|
6
6
|
maxHeight?: number;
|
|
7
|
+
/** Enable drag-and-drop reordering of items */
|
|
8
|
+
sortable?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
7
10
|
onSelect?: (item: SilkeListItemType) => void;
|
|
11
|
+
/** Called with the reordered items array after a drag-and-drop sort */
|
|
12
|
+
onSort?: (items: SilkeListItemType[]) => void;
|
|
8
13
|
};
|
|
9
|
-
export declare function SilkeList({ items, size, gap, maxHeight, onSelect }: SilkeListProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function SilkeList({ items, size, gap, maxHeight, sortable, disabled, onSelect, onSort }: SilkeListProps): import("react/jsx-runtime").JSX.Element;
|
|
10
15
|
export {};
|
|
@@ -10,6 +10,8 @@ export type SilkeListItemData = {
|
|
|
10
10
|
items?: SilkeListItemData[];
|
|
11
11
|
link?: string;
|
|
12
12
|
active?: boolean;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
alwaysShowChildren?: boolean;
|
|
13
15
|
onClick?: () => void;
|
|
14
16
|
};
|
|
15
17
|
export type SilkeListItemType = SilkeListItemData | React.ReactElement | 'divider';
|
|
@@ -6,10 +6,13 @@ export type SilkeShortcutButtonProps = {
|
|
|
6
6
|
icon: SilkeIcons;
|
|
7
7
|
shortcut?: KeyboardEventCode[];
|
|
8
8
|
compressed?: boolean;
|
|
9
|
+
inverted?: boolean;
|
|
9
10
|
centered?: boolean;
|
|
11
|
+
hidden?: boolean;
|
|
12
|
+
suffix?: React.ReactNode;
|
|
10
13
|
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
11
14
|
};
|
|
12
|
-
export declare function SilkeShortcutButton({ label, icon, shortcut, compressed, centered, onClick, }: SilkeShortcutButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function SilkeShortcutButton({ label, icon, shortcut, compressed, inverted, centered, hidden, suffix, onClick, }: SilkeShortcutButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
13
16
|
export declare namespace SilkeShortcutButton {
|
|
14
17
|
var displayName: string;
|
|
15
18
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './silke-theme-card';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SilkeOverflowMenuItem } from '../silke-overflow-menu';
|
|
3
|
+
interface SilkeThemeCardProps {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
primaryColor?: string;
|
|
7
|
+
secondaryColor?: string;
|
|
8
|
+
accentColor?: string;
|
|
9
|
+
bgColor?: string;
|
|
10
|
+
textColor?: string;
|
|
11
|
+
baseFont?: string;
|
|
12
|
+
isDefault?: boolean;
|
|
13
|
+
isSelected?: boolean;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
menu?: (SilkeOverflowMenuItem | React.ReactElement | 'divider')[];
|
|
16
|
+
}
|
|
17
|
+
export declare function SilkeThemeCard({ name, description, primaryColor, secondaryColor, accentColor, bgColor, textColor, baseFont, isDefault, isSelected, onClick, menu, }: SilkeThemeCardProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './silke-theme-swatch';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const SHADE_KEYS: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
2
|
+
type ShadeKey = (typeof SHADE_KEYS)[number];
|
|
3
|
+
interface SilkeThemeSwatchProps {
|
|
4
|
+
label: string;
|
|
5
|
+
token?: string;
|
|
6
|
+
shades: Record<ShadeKey, string>;
|
|
7
|
+
selectedShade?: ShadeKey;
|
|
8
|
+
onSelect?: (shade: ShadeKey) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function SilkeThemeSwatch({ label, token, shades, selectedShade, onSelect, }: SilkeThemeSwatchProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
package/dist/types/icons.d.ts
CHANGED
|
@@ -25,13 +25,15 @@ export declare const SilkeIconDefinitions: {
|
|
|
25
25
|
'cloud.slash': string;
|
|
26
26
|
ai: string;
|
|
27
27
|
'ai.sparkle': string;
|
|
28
|
-
'ai.page':
|
|
28
|
+
'ai.page': typeof AiGradientPage;
|
|
29
29
|
'ai.sparkels': string;
|
|
30
30
|
'ai.gradient': typeof AiGradientIcon;
|
|
31
31
|
'ai.image': string;
|
|
32
32
|
'ai.component': typeof AiGradientComponent;
|
|
33
|
+
'ai.component.flat': string;
|
|
33
34
|
'ai.text': string;
|
|
34
35
|
'ai.file': string;
|
|
36
|
+
'ai.clone.edit': typeof AiGradientCloneEdit;
|
|
35
37
|
sparkles: string;
|
|
36
38
|
compare: string;
|
|
37
39
|
menuMore: string;
|
|
@@ -454,7 +456,8 @@ export declare const SilkeIconDefinitions: {
|
|
|
454
456
|
'animate.fill-backwards': typeof AnimationFillBackwards;
|
|
455
457
|
'animate.fill-forwards': typeof AnimationFillForwards;
|
|
456
458
|
'animate.fill-both': typeof AnimationFillBoth;
|
|
457
|
-
|
|
459
|
+
'theme.color': string;
|
|
460
|
+
'theme.font': string;
|
|
458
461
|
};
|
|
459
462
|
export declare const StateIcons: {
|
|
460
463
|
default: string;
|
|
@@ -495,5 +498,7 @@ declare function AnimationFillBackwards(): import("react/jsx-runtime").JSX.Eleme
|
|
|
495
498
|
declare function AnimationFillForwards(): import("react/jsx-runtime").JSX.Element;
|
|
496
499
|
declare function AnimationFillBoth(): import("react/jsx-runtime").JSX.Element;
|
|
497
500
|
declare function AiGradientIcon(): import("react/jsx-runtime").JSX.Element;
|
|
501
|
+
declare function AiGradientPage(): import("react/jsx-runtime").JSX.Element;
|
|
502
|
+
declare function AiGradientCloneEdit(): import("react/jsx-runtime").JSX.Element;
|
|
498
503
|
declare function AiGradientComponent(): import("react/jsx-runtime").JSX.Element;
|
|
499
504
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vev/silke",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,32 +9,44 @@
|
|
|
9
9
|
},
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"types": "dist/types/index.d.ts",
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"react": ">=16.0.0",
|
|
14
|
+
"react-dom": ">=16.0.0",
|
|
15
|
+
"react-router-dom": "^7.12.0"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"invokers": "^1.8.0",
|
|
19
|
+
"tinycolor2": "^1.6.0",
|
|
20
|
+
"@types/tinycolor2": "^1.4.6",
|
|
21
|
+
"dompurify": "^3.3.2",
|
|
22
|
+
"@codemirror/lang-css": "^6.0.0",
|
|
23
|
+
"@codemirror/lang-javascript": "^6.1.0",
|
|
24
|
+
"@codemirror/lang-json": "^6.0.0",
|
|
25
|
+
"@uiw/react-codemirror": "^4.12.3",
|
|
26
|
+
"@uiw/codemirror-theme-dracula": "^4.25.4",
|
|
27
|
+
"prism-react-renderer": "^2.4.1",
|
|
28
|
+
"@vev/interactions": "1.0.2",
|
|
29
|
+
"@vev/react": "0.3.5",
|
|
30
|
+
"@vev/utils": "1.2.18"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@mdx-js/react": "^3.1.0",
|
|
34
|
+
"concurrently": "^8.2.2",
|
|
35
|
+
"del-cli": "^5.1.0",
|
|
36
|
+
"eslint": "^10.0.0",
|
|
37
|
+
"jest": "^30.2.0",
|
|
38
|
+
"typescript": "^5.9.3"
|
|
39
|
+
},
|
|
12
40
|
"scripts": {
|
|
13
|
-
"build": "
|
|
41
|
+
"build": "pnpm clean && pnpm build:types && pnpm build:code",
|
|
14
42
|
"build:code": "node ./esbuild.config.mjs",
|
|
15
43
|
"build:types": "tsc --project tsconfig.build.json",
|
|
16
44
|
"clean": "del-cli dist",
|
|
17
45
|
"test": "jest --silent --forceExit --runInBand --passWithNoTests",
|
|
18
46
|
"test:ci": "jest --runInBand --forceExit --reporters='github-actions' --passWithNoTests",
|
|
19
47
|
"tsc": "tsc --project ./tsconfig.json --emitDeclarationOnly --outDir ./dist",
|
|
20
|
-
"watch": "
|
|
48
|
+
"watch": "concurrently \"pnpm watch:tsc\" \"pnpm watch:code\"",
|
|
21
49
|
"watch:code": "node esbuild.config.mjs --watch",
|
|
22
50
|
"watch:tsc": "tsc --project ./tsconfig.build.json --emitDeclarationOnly --watch"
|
|
23
|
-
},
|
|
24
|
-
"peerDependencies": {
|
|
25
|
-
"react": ">=16.0.0",
|
|
26
|
-
"react-dom": ">=16.0.0",
|
|
27
|
-
"react-router-dom": "^7.12.0"
|
|
28
|
-
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@vev/interactions": "*",
|
|
31
|
-
"@vev/react": "*",
|
|
32
|
-
"@vev/utils": "*",
|
|
33
|
-
"classnames": ">=2.2.0",
|
|
34
|
-
"invokers": "^1.8.0"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"del-cli": "*",
|
|
38
|
-
"jest": "*"
|
|
39
51
|
}
|
|
40
|
-
}
|
|
52
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -36,7 +36,9 @@ export * from './silke-table';
|
|
|
36
36
|
export * from './silke-tabs';
|
|
37
37
|
export * from './silke-tag';
|
|
38
38
|
export * from './silke-text';
|
|
39
|
+
export * from './silke-theme-card';
|
|
39
40
|
export * from './silke-theme-editor';
|
|
41
|
+
export * from './silke-theme-swatch';
|
|
40
42
|
export * from './silke-tile';
|
|
41
43
|
export * from './silke-toolbar';
|
|
42
44
|
export * from './silke-tooltip';
|
|
@@ -452,7 +452,7 @@ export function SilkeAutocompletePopupNative<T>(props: SilkeAutocompletePopupNat
|
|
|
452
452
|
</SilkeTextField>
|
|
453
453
|
</SilkeBox>
|
|
454
454
|
{!disableSearch && <SilkeDivider dark />}
|
|
455
|
-
<SilkeBox column scroll flex
|
|
455
|
+
<SilkeBox column scroll flex>
|
|
456
456
|
{displayedItems.length === 0 && (
|
|
457
457
|
<SilkeBox hPad="s" height={size} vAlign="center">
|
|
458
458
|
<SilkeTextSmall color="neutral-60">No results</SilkeTextSmall>
|
|
@@ -486,23 +486,30 @@ export function SilkeAutocompletePopupNative<T>(props: SilkeAutocompletePopupNat
|
|
|
486
486
|
{group.items.map((item) => {
|
|
487
487
|
const currentItemIndex = itemIndex++;
|
|
488
488
|
return item.divider ? (
|
|
489
|
-
<SilkeDivider dark key={`hr-${currentItemIndex}`} />
|
|
489
|
+
<SilkeDivider dark vSpace="xs" key={`hr-${currentItemIndex}`} />
|
|
490
490
|
) : (
|
|
491
|
-
<
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
491
|
+
<SilkeBox
|
|
492
|
+
key={`group-${groupIdx}-item-${itemIndex}`}
|
|
493
|
+
flex
|
|
494
|
+
fill
|
|
495
|
+
column
|
|
496
|
+
hPad="xs"
|
|
497
|
+
>
|
|
498
|
+
<AutocompleteItem
|
|
499
|
+
ItemRender={ItemRender}
|
|
500
|
+
size={size}
|
|
501
|
+
iconFontSize={iconFontSize}
|
|
502
|
+
item={item}
|
|
503
|
+
highlight={currentItemIndex === highlight || isSelected(item.value)}
|
|
504
|
+
selected={isSelected(item.value)}
|
|
505
|
+
multiple={form.multiple}
|
|
506
|
+
onMouseDown={(e) => {
|
|
507
|
+
e.preventDefault();
|
|
508
|
+
e.stopPropagation();
|
|
509
|
+
if (!item.divider && !item.disabled) handleSelect(item);
|
|
510
|
+
}}
|
|
511
|
+
/>
|
|
512
|
+
</SilkeBox>
|
|
506
513
|
);
|
|
507
514
|
})}
|
|
508
515
|
</React.Fragment>
|
|
@@ -527,7 +534,7 @@ export function SilkeAutocompletePopupNative<T>(props: SilkeAutocompletePopupNat
|
|
|
527
534
|
{isHidingResults
|
|
528
535
|
? props.maxDisplayedItemsLabel || (
|
|
529
536
|
<>
|
|
530
|
-
<SilkeDivider dark />
|
|
537
|
+
<SilkeDivider dark vSpace="xs" />
|
|
531
538
|
<SilkeBox pad="l">
|
|
532
539
|
Currently displaying the {maxDisplayedItems} first results, please enter a more
|
|
533
540
|
specific query to see the rest
|
|
@@ -31,8 +31,10 @@ export function getVariableValueV2(
|
|
|
31
31
|
color: string,
|
|
32
32
|
variables: { key: string; value?: string }[],
|
|
33
33
|
): string | undefined {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
// Strip var(--vev-...) wrapper, ignoring optional CSS fallback after comma
|
|
35
|
+
const match = color.trim().match(/^var\(--vev-([^,)]+)/);
|
|
36
|
+
if (!match) return undefined;
|
|
37
|
+
return variables.find((v) => v.key === match[1])?.value;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export function isColorVariable(color: string): boolean {
|
|
@@ -40,7 +42,7 @@ export function isColorVariable(color: string): boolean {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export function isVariableV2(color: string | undefined): boolean {
|
|
43
|
-
return !!color && color
|
|
45
|
+
return !!color && color.startsWith('var(--vev-');
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
export function rgbaToString(rgba: RGBA | number[] | string): string {
|
|
@@ -49,8 +49,8 @@ export function SilkeSwatches({
|
|
|
49
49
|
} = useSilkeCSSContext();
|
|
50
50
|
const [mode, setMode] = useState<ModeType>(
|
|
51
51
|
defaultMode ||
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
preferredColorMode ||
|
|
53
|
+
(hidePalettes ? 'swatches' : hideSwatches ? 'palettes' : 'swatches'),
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
const swatches = useMemo(() => {
|
|
@@ -58,7 +58,7 @@ export function SilkeSwatches({
|
|
|
58
58
|
}, [rest.swatches, variables]);
|
|
59
59
|
|
|
60
60
|
const colorVariables = React.useMemo(() => {
|
|
61
|
-
return variablesv2.filter((v) => v.type === 'color');
|
|
61
|
+
return variablesv2.filter((v) => v.type === 'color' && !v.hidden);
|
|
62
62
|
}, [variablesv2]);
|
|
63
63
|
|
|
64
64
|
const modeOptions = useMemo(() => {
|