@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.
- package/CHANGELOG.md +34 -0
- package/dist/index.js +40 -38
- package/dist/index.js.LEGAL.txt +12 -0
- package/dist/styles.css +1596 -1036
- package/dist/types/components/index.d.ts +4 -1
- package/dist/types/components/silke-autocomplete-field/autocomplete-types.d.ts +4 -0
- package/dist/types/components/silke-autocomplete-field/index.d.ts +1 -0
- package/dist/types/components/silke-autocomplete-field/silke-autocomplete-field-native.d.ts +60 -0
- package/dist/types/components/silke-autocomplete-field/silke-autocomplete-field.d.ts +3 -0
- package/dist/types/components/silke-autocomplete-field/silke-autocomplete-popup-native.d.ts +15 -0
- package/dist/types/components/silke-button/silke-dropdown-button.d.ts +8 -13
- package/dist/types/components/silke-card/silke-card-grid.d.ts +33 -1
- package/dist/types/components/silke-command-text-field/image-utils.d.ts +20 -0
- package/dist/types/components/silke-command-text-field/index.d.ts +4 -0
- package/dist/types/components/silke-command-text-field/silke-command-parser.d.ts +3 -0
- package/dist/types/components/silke-command-text-field/silke-command-parser.spec.d.ts +1 -0
- package/dist/types/components/silke-command-text-field/silke-command-text-field.d.ts +46 -0
- package/dist/types/components/silke-command-text-field/utils.d.ts +61 -0
- package/dist/types/components/silke-command-text-field/utils.spec.d.ts +1 -0
- package/dist/types/components/silke-conditions-input/utils.d.ts +1 -1
- package/dist/types/components/silke-form-schema/silke-schema-fields.d.ts +1 -0
- package/dist/types/components/silke-image/silke-image.d.ts +2 -1
- package/dist/types/components/silke-list/index.d.ts +1 -0
- package/dist/types/components/silke-list/silke-list-item.d.ts +24 -6
- package/dist/types/components/silke-list/silke-list.d.ts +9 -9
- package/dist/types/components/silke-list/types.d.ts +19 -0
- package/dist/types/components/silke-list/utils.d.ts +3 -0
- package/dist/types/components/silke-navigation-link/silke-navigation-link.d.ts +1 -0
- package/dist/types/components/silke-overflow-menu/silke-overflow-menu.d.ts +6 -1
- package/dist/types/components/silke-popover-native/index.d.ts +1 -0
- package/dist/types/components/silke-popover-native/silke-popover-native.d.ts +37 -0
- package/dist/types/components/silke-popover-native/types.d.ts +6 -0
- package/dist/types/components/silke-popover-native/use-popover-positioning.d.ts +9 -0
- package/dist/types/components/silke-select-field/index.d.ts +1 -0
- package/dist/types/components/silke-select-field/silke-select-field-native.d.ts +4 -0
- package/dist/types/components/silke-shortcut-button/index.d.ts +1 -0
- package/dist/types/components/silke-shortcut-button/silke-shortcut-button.d.ts +15 -0
- package/dist/types/components/silke-tag/silke-tag.d.ts +1 -1
- package/dist/types/icons.d.ts +32 -0
- package/jest.config.js +2 -3
- package/package.json +9 -3
- package/src/_variables.scss +125 -129
- package/src/components/index.ts +4 -1
- package/src/components/silke-action-box/silke-action-box.scss +2 -3
- package/src/components/silke-alert-banner/silke-alert-banner.scss +9 -10
- package/src/components/silke-autocomplete-field/autocomplete-item.tsx +2 -2
- package/src/components/silke-autocomplete-field/autocomplete-types.ts +4 -0
- package/src/components/silke-autocomplete-field/index.ts +1 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-field-native.tsx +346 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.mdx +39 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.scss +18 -12
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +3 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-popup-native.tsx +542 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-popup.tsx +92 -41
- package/src/components/silke-box/silke-box.mdx +321 -21
- package/src/components/silke-box/silke-box.scss +5 -5
- package/src/components/silke-breadcrumbs/silke-breadcrumb.mdx +147 -9
- package/src/components/silke-breadcrumbs/silke-breadcrumb.scss +3 -3
- package/src/components/silke-button/silke-big-button.scss +1 -1
- package/src/components/silke-button/silke-button.scss +27 -18
- package/src/components/silke-button/silke-dropdown-button.mdx +67 -0
- package/src/components/silke-button/silke-dropdown-button.tsx +40 -122
- package/src/components/silke-card/silke-card-grid.tsx +5 -3
- package/src/components/silke-card/silke-card.scss +8 -7
- package/src/components/silke-card/silke-card.tsx +7 -1
- package/src/components/silke-checkbox/silke-checkbox.mdx +139 -14
- package/src/components/silke-checkbox/silke-checkbox.scss +11 -11
- package/src/components/silke-color-picker/color-picker.scss +8 -8
- package/src/components/silke-color-swatches/silke-color-swatches.mdx +130 -0
- package/src/components/silke-command-text-field/image-utils.ts +71 -0
- package/src/components/silke-command-text-field/index.ts +12 -0
- package/src/components/silke-command-text-field/silke-command-parser.spec.ts +89 -0
- package/src/components/silke-command-text-field/silke-command-parser.ts +47 -0
- package/src/components/silke-command-text-field/silke-command-text-field.mdx +301 -0
- package/src/components/silke-command-text-field/silke-command-text-field.module.scss +119 -0
- package/src/components/silke-command-text-field/silke-command-text-field.tsx +665 -0
- package/src/components/silke-command-text-field/utils.spec.ts +366 -0
- package/src/components/silke-command-text-field/utils.ts +287 -0
- package/src/components/silke-conditions-input/silke-conditions-input.scss +4 -4
- package/src/components/silke-content-column/silke-content-column.scss +1 -1
- package/src/components/silke-context-menu/silke-context-menu.scss +3 -4
- package/src/components/silke-context-menu/silke-context-menu.tsx +1 -1
- package/src/components/silke-css-number-field/silke-css-number-field.scss +14 -12
- package/src/components/silke-divider/silke-divider.mdx +154 -32
- package/src/components/silke-divider/silke-divider.scss +3 -2
- package/src/components/silke-drawer/silke-drawer.scss +6 -2
- package/src/components/silke-form/silke-form.mdx +254 -27
- package/src/components/silke-form-schema/fields/array-field-inline.tsx +1 -0
- package/src/components/silke-form-schema/fields/array-field-modal.tsx +1 -0
- package/src/components/silke-form-schema/fields/styles.scss +34 -35
- package/src/components/silke-form-schema/silke-schema-field.tsx +1 -1
- package/src/components/silke-form-schema/silke-schema-fields.tsx +4 -3
- package/src/components/silke-gradient-picker/silke-gradient-picker.module.scss +2 -2
- package/src/components/silke-icon/silke-icon.mdx +212 -8
- package/src/components/silke-icon/silke-icon.scss +10 -2
- package/src/components/silke-icon/silke-icon.tsx +1 -0
- package/src/components/silke-icon/silke-stacked-icon.scss +42 -45
- package/src/components/silke-icon-browser/silke-icon-browser.mdx +143 -0
- package/src/components/silke-image/silke-image-color-backdrop.scss +6 -6
- package/src/components/silke-image/silke-image.mdx +189 -41
- package/src/components/silke-image/silke-image.scss +3 -3
- package/src/components/silke-image/silke-image.tsx +14 -1
- package/src/components/silke-link/silke-link.scss +3 -5
- package/src/components/silke-list/index.ts +1 -0
- package/src/components/silke-list/silke-list-item.mdx +83 -0
- package/src/components/silke-list/silke-list-item.scss +119 -0
- package/src/components/silke-list/silke-list-item.tsx +137 -12
- package/src/components/silke-list/silke-list.mdx +108 -13
- package/src/components/silke-list/silke-list.scss +8 -15
- package/src/components/silke-list/silke-list.tsx +63 -9
- package/src/components/silke-list/types.ts +22 -0
- package/src/components/silke-list/utils.ts +24 -0
- package/src/components/silke-loader/silke-loader.mdx +139 -5
- package/src/components/silke-loader/silke-loader.scss +1 -1
- package/src/components/silke-modal/silke-modal.scss +9 -9
- package/src/components/silke-navigation-link/silke-navigation-link.mdx +27 -2
- package/src/components/silke-navigation-link/silke-navigation-link.scss +34 -40
- package/src/components/silke-navigation-link/silke-navigation-link.tsx +7 -6
- package/src/components/silke-overflow-menu/silke-overflow-menu.mdx +228 -31
- package/src/components/silke-overflow-menu/silke-overflow-menu.scss +8 -8
- package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +14 -8
- package/src/components/silke-popover/silke-popover.scss +5 -5
- package/src/components/silke-popover-native/index.ts +1 -0
- package/src/components/silke-popover-native/silke-popover-native.mdx +207 -0
- package/src/components/silke-popover-native/silke-popover-native.scss +127 -0
- package/src/components/silke-popover-native/silke-popover-native.tsx +176 -0
- package/src/components/silke-popover-native/types.ts +21 -0
- package/src/components/silke-popover-native/use-popover-positioning.ts +157 -0
- package/src/components/silke-progress-indicator/silke-progress-indicator.scss +1 -1
- package/src/components/silke-radio-button/silke-radio-button.scss +18 -11
- package/src/components/silke-search-field/silke-search-field.mdx +161 -7
- package/src/components/silke-select-field/index.ts +1 -0
- package/src/components/silke-select-field/silke-select-field-native.tsx +17 -0
- package/src/components/silke-select-field/silke-select-field.mdx +65 -0
- package/src/components/silke-shortcut-button/index.ts +1 -0
- package/src/components/silke-shortcut-button/silke-shortcut-button.mdx +89 -0
- package/src/components/silke-shortcut-button/silke-shortcut-button.scss +145 -0
- package/src/components/silke-shortcut-button/silke-shortcut-button.tsx +55 -0
- package/src/components/silke-skeleton/silke-skeleton.mdx +109 -0
- package/src/components/silke-skeleton/silke-skeleton.scss +1 -1
- package/src/components/silke-slider/silke-slider.module.scss +19 -19
- package/src/components/silke-sortable-list/silke-nested-sortable-list.scss +3 -3
- package/src/components/silke-sortable-list/silke-sortable-list.scss +4 -5
- package/src/components/silke-table/silke-table.scss +1 -1
- package/src/components/silke-tabs/silke-tabs.scss +3 -3
- package/src/components/silke-tag/silke-tag.mdx +179 -43
- package/src/components/silke-tag/silke-tag.scss +49 -12
- package/src/components/silke-tag/silke-tag.tsx +17 -7
- package/src/components/silke-text/silke-text.scss +6 -4
- package/src/components/silke-text/silke-title.scss +7 -14
- package/src/components/silke-text-field/silke-text-field.scss +9 -9
- package/src/components/silke-text-field/silke-text-field.tsx +3 -2
- package/src/components/silke-tile/silke-tile.scss +7 -3
- package/src/components/silke-toast-notification/silke-toast-notification.scss +4 -5
- package/src/components/silke-toggle/silke-toggle.mdx +163 -33
- package/src/components/silke-toggle/silke-toggle.scss +4 -4
- package/src/components/silke-toolbar/silke-toolbar.scss +1 -1
- package/src/components/silke-tooltip/silke-shortcuts.tsx +3 -3
- package/src/components/silke-tooltip/silke-tooltip.scss +11 -16
- package/src/components/silke-variables-wrapper/silke-variables-wrapper.scss +9 -7
- package/src/components/silke-virtual/silke-virtual.mdx +161 -0
- package/src/components/silke-virtual/silke-virtual.scss +8 -8
- package/src/icons.tsx +45 -1
- package/src/styles/core.scss +42 -45
- package/src/styles/math.scss +66 -66
- package/tsconfig.build.json +2 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +3 -14
- package/dist/types/components/silke-list-card/index.d.ts +0 -1
- package/dist/types/components/silke-list-card/silke-list-card.d.ts +0 -14
- package/src/components/silke-list-card/index.ts +0 -1
- package/src/components/silke-list-card/silke-list-card.mdx +0 -46
- package/src/components/silke-list-card/silke-list-card.scss +0 -57
- package/src/components/silke-list-card/silke-list-card.tsx +0 -63
|
@@ -9,6 +9,7 @@ export * from './silke-color-palettes';
|
|
|
9
9
|
export * from './silke-color-swatches';
|
|
10
10
|
export * from './silke-content-column';
|
|
11
11
|
export * from './silke-context-menu';
|
|
12
|
+
export * from './silke-command-text-field';
|
|
12
13
|
export * from './silke-divider';
|
|
13
14
|
export * from './silke-drawer';
|
|
14
15
|
export * from './silke-form-schema';
|
|
@@ -17,7 +18,6 @@ export * from './silke-iframe-portal';
|
|
|
17
18
|
export * from './silke-image';
|
|
18
19
|
export * from './silke-link';
|
|
19
20
|
export * from './silke-list';
|
|
20
|
-
export * from './silke-list-card';
|
|
21
21
|
export * from './silke-loader';
|
|
22
22
|
export * from './silke-modal';
|
|
23
23
|
export * from './silke-navigation-link';
|
|
@@ -39,6 +39,9 @@ export * from './silke-tile';
|
|
|
39
39
|
export * from './silke-toolbar';
|
|
40
40
|
export * from './silke-tooltip';
|
|
41
41
|
export * from './silke-action-box';
|
|
42
|
+
export * from './silke-shortcut-button';
|
|
43
|
+
export * from './silke-popover-native';
|
|
44
|
+
export * from './silke-list';
|
|
42
45
|
export * from './silke-autocomplete-field';
|
|
43
46
|
export * from './silke-checkbox';
|
|
44
47
|
export * from './silke-color-picker';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { PopoverOrigin } from '../silke-popover';
|
|
3
|
+
import { SilkeTextFieldProps } from '../silke-text-field';
|
|
4
|
+
import { AutocompleteRenderItemProps } from './autocomplete-item';
|
|
5
|
+
import { AutocompleteTagsProps } from './autocomplete-tags';
|
|
6
|
+
import { Entry, MultiProps, SingleProps } from './autocomplete-types';
|
|
7
|
+
/**
|
|
8
|
+
* Props for autocomplete field
|
|
9
|
+
*/
|
|
10
|
+
export type SilkeAutocompleteFieldNativeProps<T = any, U extends Entry<T> = any> = (MultiProps<T> | SingleProps<T>) & Omit<SilkeTextFieldProps, 'multiline' | 'maxLength' | 'minLength' | 'value'> & {
|
|
11
|
+
disableSearch?: boolean;
|
|
12
|
+
disableAddFromList?: boolean;
|
|
13
|
+
noReset?: boolean;
|
|
14
|
+
hideListArrow?: boolean;
|
|
15
|
+
isVariable?: boolean;
|
|
16
|
+
maxDisplayedItems?: number;
|
|
17
|
+
maxDisplayedItemsLabel?: React.ReactNode;
|
|
18
|
+
showAddIcon?: boolean;
|
|
19
|
+
selectedVariableKey?: string;
|
|
20
|
+
/** What point of the target should be used for centering default center-center */
|
|
21
|
+
targetOrigin?: PopoverOrigin;
|
|
22
|
+
/** What point of the anchor should be used for centering default center-center */
|
|
23
|
+
anchorOrigin?: PopoverOrigin;
|
|
24
|
+
dropDownMinWidth?: number;
|
|
25
|
+
dropDownMaxWidth?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Possible values
|
|
28
|
+
*/
|
|
29
|
+
items: U[];
|
|
30
|
+
/**
|
|
31
|
+
* Minimum number of characters in search for results to show
|
|
32
|
+
*/
|
|
33
|
+
minChars?: number;
|
|
34
|
+
buttonRight?: ReactNode;
|
|
35
|
+
/** Cypress tag */
|
|
36
|
+
'data-cy'?: string;
|
|
37
|
+
/**
|
|
38
|
+
* If a function is passed, an "Add item" entry will be shown in the list if nothing matches text search. This function will be the callback.
|
|
39
|
+
* @param value The value entered
|
|
40
|
+
*/
|
|
41
|
+
onAdd?: (value: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Use custom component for rendering the autocomplete items
|
|
44
|
+
*/
|
|
45
|
+
renderItem?: (props: AutocompleteRenderItemProps<U>) => React.ReactElement | null;
|
|
46
|
+
/**
|
|
47
|
+
* Use custom component for rendering autocomplete tags
|
|
48
|
+
*/
|
|
49
|
+
renderTags?: (props: AutocompleteTagsProps<T>) => React.ReactElement | null;
|
|
50
|
+
/**
|
|
51
|
+
* Custom sort of items (default sorts by label)
|
|
52
|
+
*/
|
|
53
|
+
sort?: (one: Entry<T>, other: Entry<T>) => number;
|
|
54
|
+
onSearch?: (value: string) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Called when dropdown closes for any reason
|
|
57
|
+
*/
|
|
58
|
+
onClose?: () => void;
|
|
59
|
+
};
|
|
60
|
+
export declare function SilkeAutocompleteFieldNative<T>(props: SilkeAutocompleteFieldNativeProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -57,4 +57,7 @@ export type SilkeAutocompleteFieldProps<T = any, U extends Entry<T> = any> = (Mu
|
|
|
57
57
|
*/
|
|
58
58
|
onClose?: () => void;
|
|
59
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Use SilkeAutocompleteFieldNative instead. This component will be removed in a future version.
|
|
62
|
+
*/
|
|
60
63
|
export declare function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Entry } from './autocomplete-types';
|
|
3
|
+
import { SilkeAutocompleteFieldProps } from './silke-autocomplete-field';
|
|
4
|
+
/**
|
|
5
|
+
* Props for autocomplete popup
|
|
6
|
+
*/
|
|
7
|
+
type SilkeAutocompletePopupNativeProps<T = any> = SilkeAutocompleteFieldProps<T> & {
|
|
8
|
+
containerRef?: React.RefObject<HTMLDivElement>;
|
|
9
|
+
searchPlaceholder?: string;
|
|
10
|
+
onRequestClose?: () => void;
|
|
11
|
+
hide?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const useMatchingItemsOnTop: (filteredItems: Entry<any>[], searchString?: string, selectedLabel?: string) => Entry<any>[];
|
|
14
|
+
export declare function SilkeAutocompletePopupNative<T>(props: SilkeAutocompletePopupNativeProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { SilkeButtonProps } from './silke-button';
|
|
3
2
|
import { SilkePopoverProps } from '../silke-popover';
|
|
4
|
-
import {
|
|
3
|
+
import type { SilkeListItemType } from '../silke-list/types';
|
|
4
|
+
import { PopoverPlacement } from '../silke-popover-native/types';
|
|
5
5
|
export type SilkeDropdownButtonProps = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* What triggers the opening of the overflow menu
|
|
10
|
-
* @default "click"
|
|
11
|
-
*/
|
|
12
|
-
trigger?: 'click' | 'right-click';
|
|
13
|
-
onToggleOpen?: (open: boolean) => void;
|
|
14
|
-
/** Pass items or children */
|
|
15
|
-
items?: (SilkeOverflowMenuItem | React.ReactElement | 'divider')[] | (() => (SilkeOverflowMenuItem | React.ReactElement | 'divider')[]);
|
|
6
|
+
items?: SilkeListItemType[];
|
|
7
|
+
placement?: PopoverPlacement;
|
|
16
8
|
matchWidth?: boolean;
|
|
9
|
+
animate?: boolean;
|
|
10
|
+
size?: 's' | 'base';
|
|
11
|
+
closeOnSelect?: boolean;
|
|
17
12
|
} & SilkeButtonProps & Omit<SilkePopoverProps, 'anchor' | 'hide' | 'children' | 'kind'>;
|
|
18
|
-
export declare function SilkeDropdownButton({
|
|
13
|
+
export declare function SilkeDropdownButton({ label, icon, items, offsetX, offsetY, placement, matchWidth, size, animate, closeOnSelect, ...rest }: SilkeDropdownButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,5 +6,37 @@ type SilkeCardGridProps = {
|
|
|
6
6
|
loading?: boolean;
|
|
7
7
|
} & Omit<BoxDivProps, 'tag' | 'gap' | 'size'>;
|
|
8
8
|
export declare function SilkeCardGrid({ loading, children, small, className, style, ...rest }: SilkeCardGridProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare
|
|
9
|
+
export declare const SilkeSkeletonCard: React.ForwardRefExoticComponent<{
|
|
10
|
+
tag?: "div";
|
|
11
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "color"> & {
|
|
12
|
+
column?: boolean;
|
|
13
|
+
fill?: boolean;
|
|
14
|
+
gap?: import("..").BoxSpace;
|
|
15
|
+
pad?: import("..").BoxSpace;
|
|
16
|
+
vPad?: import("..").BoxSpace;
|
|
17
|
+
hPad?: import("..").BoxSpace;
|
|
18
|
+
size?: import("..").BoxSize;
|
|
19
|
+
height?: import("..").BoxSize;
|
|
20
|
+
width?: import("..").BoxSize;
|
|
21
|
+
minHeight?: import("..").BoxSize;
|
|
22
|
+
minWidth?: import("..").BoxSize;
|
|
23
|
+
bg?: import("../..").SilkeColor | "blur";
|
|
24
|
+
bgHover?: import("../..").SilkeColor;
|
|
25
|
+
color?: import("../..").SilkeColor;
|
|
26
|
+
rounded?: boolean | "tiny" | "small" | "medium" | "full";
|
|
27
|
+
shadow?: "level1" | "level2" | "level3" | "level4";
|
|
28
|
+
overflow?: "hidden" | "scroll-y";
|
|
29
|
+
cursor?: "pointer" | "grab" | "text";
|
|
30
|
+
userSelect?: "none" | "text";
|
|
31
|
+
colorHover?: import("../..").SilkeColor;
|
|
32
|
+
aspectRatio?: "16:9" | "4:3" | "1:1";
|
|
33
|
+
flex?: boolean;
|
|
34
|
+
wrap?: boolean;
|
|
35
|
+
align?: import("..").BoxAlign | [import("..").BoxAlign, import("..").BoxAlign];
|
|
36
|
+
vAlign?: import("..").BoxAlign;
|
|
37
|
+
hAlign?: import("..").BoxAlign;
|
|
38
|
+
debug?: boolean;
|
|
39
|
+
scroll?: boolean | "show";
|
|
40
|
+
rel?: string;
|
|
41
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
10
42
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SilkeImageValue } from './utils';
|
|
2
|
+
/**
|
|
3
|
+
* Reads a File and converts it to a SilkeImageValue with base64 data.
|
|
4
|
+
* Returns a promise that resolves with the image value or null if reading fails.
|
|
5
|
+
*/
|
|
6
|
+
export declare function fileToImageValue(file: File): Promise<SilkeImageValue | null>;
|
|
7
|
+
/**
|
|
8
|
+
* Extracts the first image file from a ClipboardEvent.
|
|
9
|
+
* Returns the File or null if no image is found.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getImageFromClipboard(e: React.ClipboardEvent): File | null;
|
|
12
|
+
/**
|
|
13
|
+
* Extracts the first image file from a DragEvent.
|
|
14
|
+
* Returns the File or null if no image is found.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getImageFromDragEvent(e: DragEvent): File | null;
|
|
17
|
+
/**
|
|
18
|
+
* Generates a data URL from a SilkeImageValue for use in img src.
|
|
19
|
+
*/
|
|
20
|
+
export declare function imageValueToDataUrl(img: SilkeImageValue): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { fileToImageValue, imageValueToDataUrl } from './image-utils';
|
|
2
|
+
export { parseTextToSilkeCommands } from './silke-command-parser';
|
|
3
|
+
export * from './silke-command-text-field';
|
|
4
|
+
export { SilkeCommand, SilkeCommandTextFieldValue, SilkeCommandType, SilkeImageValue, SilkeTextValue, convertSilkeCommandsToString, isImage, } from './utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SilkeTextFieldOutlineProps } from '../silke-text-field/silke-text-field-outline';
|
|
3
|
+
import { SilkeCommand, SilkeCommandTextFieldValue } from './utils';
|
|
4
|
+
export type SilkeCommandTextFieldProps = Omit<SilkeTextFieldOutlineProps, 'children'> & {
|
|
5
|
+
autoFocus?: boolean;
|
|
6
|
+
availableCommands: SilkeCommand[];
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** When true, images cannot be added via paste or drag-and-drop */
|
|
9
|
+
disableImages?: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
onChange: (value: SilkeCommandTextFieldValue[]) => void;
|
|
12
|
+
onCommandFocus?: (index: number, command: SilkeCommandTextFieldValue | undefined) => void;
|
|
13
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
14
|
+
onSuggestions?: (suggestions: SilkeCommand[]) => void;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
value: SilkeCommandTextFieldValue[];
|
|
17
|
+
};
|
|
18
|
+
export type SilkeCommandTextFieldHandle = {
|
|
19
|
+
/** Remove focus from the input */
|
|
20
|
+
blur: () => void;
|
|
21
|
+
/** Focus the input */
|
|
22
|
+
focus: () => void;
|
|
23
|
+
/** Get the current value as a string */
|
|
24
|
+
toString: (value?: SilkeCommandTextFieldValue[]) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Update command in the commands array.
|
|
27
|
+
* @param command - the command to update
|
|
28
|
+
* @param index - defaults to active index, use -1 to append
|
|
29
|
+
*/
|
|
30
|
+
update: (command: SilkeCommand, index?: number) => void;
|
|
31
|
+
};
|
|
32
|
+
declare const SilkeCommandTextField: React.ForwardRefExoticComponent<Omit<SilkeTextFieldOutlineProps, "children"> & {
|
|
33
|
+
autoFocus?: boolean;
|
|
34
|
+
availableCommands: SilkeCommand[];
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/** When true, images cannot be added via paste or drag-and-drop */
|
|
37
|
+
disableImages?: boolean;
|
|
38
|
+
name?: string;
|
|
39
|
+
onChange: (value: SilkeCommandTextFieldValue[]) => void;
|
|
40
|
+
onCommandFocus?: (index: number, command: SilkeCommandTextFieldValue | undefined) => void;
|
|
41
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
42
|
+
onSuggestions?: (suggestions: SilkeCommand[]) => void;
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
value: SilkeCommandTextFieldValue[];
|
|
45
|
+
} & React.RefAttributes<SilkeCommandTextFieldHandle>>;
|
|
46
|
+
export { SilkeCommandTextField };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare enum SilkeCommandType {
|
|
2
|
+
ACTION = "/",
|
|
3
|
+
MENTION = "@"
|
|
4
|
+
}
|
|
5
|
+
export type SilkeCommand = {
|
|
6
|
+
partialMatch?: boolean;
|
|
7
|
+
type: SilkeCommandType;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
export type SilkeTextValue = {
|
|
11
|
+
type: 'text';
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
export type SilkeImageValue = {
|
|
15
|
+
type: 'image';
|
|
16
|
+
/** Base64-encoded image data */
|
|
17
|
+
data: string;
|
|
18
|
+
/** MIME type (e.g., 'image/png', 'image/jpeg') */
|
|
19
|
+
mimeType: string;
|
|
20
|
+
/** Optional filename */
|
|
21
|
+
name?: string;
|
|
22
|
+
};
|
|
23
|
+
export type SilkeCommandTextFieldValue = SilkeCommand | SilkeTextValue | SilkeImageValue;
|
|
24
|
+
/** Key direction mappings for navigation and editing */
|
|
25
|
+
export declare const KEY_DIRECTION: Record<string, number>;
|
|
26
|
+
/** Get the caret offset within a contentEditable element */
|
|
27
|
+
export declare function getCaretOffset(element: HTMLDivElement | null): number;
|
|
28
|
+
/** Check if there is a text selection with length > 0 */
|
|
29
|
+
export declare function hasSelectionLength(): boolean;
|
|
30
|
+
/** Set the caret to a specific character offset within a contentEditable element */
|
|
31
|
+
export declare function setCaretOffset(element: HTMLDivElement | null, offset: number): void;
|
|
32
|
+
/** Escape HTML special characters to prevent XSS */
|
|
33
|
+
export declare function escapeHtml(text: string): string;
|
|
34
|
+
/** Get the index of the command at a given caret position */
|
|
35
|
+
export declare function getActiveCommandIndex(caretPos: number, value: SilkeCommandTextFieldValue[]): number;
|
|
36
|
+
/** Calculate total text length up to a given index */
|
|
37
|
+
export declare function getTextLength(value: SilkeCommandTextFieldValue[], index?: number): number;
|
|
38
|
+
/** Get the rendered length of a single command/text value */
|
|
39
|
+
export declare function getItemLength(item: SilkeCommandTextFieldValue): number;
|
|
40
|
+
/** Convert command values to HTML for rendering (excludes images) */
|
|
41
|
+
export declare function valueToHtml(value: SilkeCommandTextFieldValue[], styles: Record<string, string>): string;
|
|
42
|
+
/** Convert command values to plain string (excludes images) */
|
|
43
|
+
export declare function convertSilkeCommandsToString(value: SilkeCommandTextFieldValue[]): string;
|
|
44
|
+
/** Check if a command value is a non-text, non-image command */
|
|
45
|
+
export declare function isSilkeCommand(value: SilkeCommandTextFieldValue | undefined): value is SilkeCommand;
|
|
46
|
+
/** Check if a command value is a text segment */
|
|
47
|
+
export declare function isText(value: SilkeCommandTextFieldValue | undefined): value is SilkeTextValue;
|
|
48
|
+
/** Check if a command value is an image */
|
|
49
|
+
export declare function isImage(value: SilkeCommandTextFieldValue | undefined): value is SilkeImageValue;
|
|
50
|
+
/**
|
|
51
|
+
* Calculate a match score for a command against a search query.
|
|
52
|
+
* Higher scores indicate better matches.
|
|
53
|
+
* Returns -1 if there's no match.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getCommandMatchScore(command: SilkeCommand, query: string): number;
|
|
56
|
+
/**
|
|
57
|
+
* Filter and sort commands based on partial matching against a query.
|
|
58
|
+
* Returns commands sorted by match quality (best matches first).
|
|
59
|
+
* If query is empty, returns all commands of the given type sorted alphabetically.
|
|
60
|
+
*/
|
|
61
|
+
export declare function filterAndSortCommands(commands: SilkeCommand[], query: string, type: SilkeCommandType): SilkeCommand[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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" | "layout" | "icon" | "upload" | "divider" | "variable" | "array" | "event" | "widgetSelect" | undefined;
|
|
11
|
+
export declare const getWidgetOptionType: (value: string | number | boolean, widgetOptions?: VevProps[]) => "string" | "number" | "boolean" | "object" | "link" | "audio" | "menu" | "select" | "video" | "image" | "layout" | "icon" | "upload" | "divider" | "variable" | "array" | "event" | "widgetSelect" | "mainComponent" | undefined;
|
|
@@ -6,5 +6,6 @@ export type SilkeImageProps = {
|
|
|
6
6
|
icon?: IEmojiIcon | SilkeIcons;
|
|
7
7
|
alt?: string;
|
|
8
8
|
avatar?: BoxSize | true;
|
|
9
|
+
bgColor?: string;
|
|
9
10
|
} & BoxProps;
|
|
10
|
-
export declare function SilkeImage({ src, alt, avatar, icon, draggable, ...rest }: SilkeImageProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function SilkeImage({ src, alt, avatar, icon, draggable, bgColor, ...rest }: SilkeImageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SilkeListItemData } from './types';
|
|
3
|
+
import { IEmojiIcon } from '@vev/utils';
|
|
4
|
+
import { SilkeBox } from '../silke-box';
|
|
5
|
+
import { SilkeIcons } from '../silke-icon';
|
|
6
|
+
import { SilkeTagProps } from '../silke-tag';
|
|
7
|
+
type SilkeListItemProps = {
|
|
8
|
+
label: string | React.ReactNode;
|
|
9
|
+
subLabel?: string | React.ReactNode;
|
|
10
|
+
icon?: IEmojiIcon | SilkeIcons | React.ReactElement;
|
|
11
|
+
items?: SilkeListItemData[];
|
|
12
|
+
link?: string;
|
|
13
|
+
size?: 's' | 'base';
|
|
14
|
+
tag?: SilkeTagProps;
|
|
15
|
+
active?: boolean;
|
|
16
|
+
gap?: boolean;
|
|
17
|
+
maxHeight?: number;
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
alwaysShowChildren?: boolean;
|
|
20
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
21
|
+
onSelect?: () => void;
|
|
22
|
+
} & Omit<React.ComponentProps<typeof SilkeBox>, 'children' | 'tag'>;
|
|
23
|
+
export declare const SilkeListItem: ({ label, subLabel, icon, items, link, tag, active, size, gap, maxHeight, children, alwaysShowChildren, onClick, onSelect, ...rest }: SilkeListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export declare function SilkeList({
|
|
1
|
+
import type { SilkeListItemType } from './types';
|
|
2
|
+
type SilkeListProps = {
|
|
3
|
+
items: SilkeListItemType[] | (() => SilkeListItemType[]);
|
|
4
|
+
size?: 's' | 'base';
|
|
5
|
+
gap?: boolean;
|
|
6
|
+
maxHeight?: number;
|
|
7
|
+
onSelect?: (item: SilkeListItemType) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function SilkeList({ items, size, gap, maxHeight, onSelect }: SilkeListProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IEmojiIcon } from '@vev/utils';
|
|
3
|
+
import { SilkeIcons } from '../silke-icon';
|
|
4
|
+
import { SilkeTagProps } from '../silke-tag';
|
|
5
|
+
export type SilkeListItemData = {
|
|
6
|
+
label: string;
|
|
7
|
+
groupLabel?: string;
|
|
8
|
+
icon?: IEmojiIcon | SilkeIcons | React.ReactElement;
|
|
9
|
+
tag?: SilkeTagProps;
|
|
10
|
+
items?: SilkeListItemData[];
|
|
11
|
+
link?: string;
|
|
12
|
+
active?: boolean;
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
};
|
|
15
|
+
export type SilkeListItemType = SilkeListItemData | React.ReactElement | 'divider';
|
|
16
|
+
export type GroupedSilkeListItems = {
|
|
17
|
+
groupLabel?: string;
|
|
18
|
+
items: SilkeListItemType[];
|
|
19
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { GroupedSilkeListItems, SilkeListItemData, SilkeListItemType } from './types';
|
|
2
|
+
export declare function isSilkeListItem(item: SilkeListItemType): item is SilkeListItemData;
|
|
3
|
+
export declare function groupSilkeListItems(items: SilkeListItemType[]): GroupedSilkeListItems[];
|
|
@@ -17,5 +17,10 @@ export declare function SilkeOverflowMenu({ children, label, open: externalOpen,
|
|
|
17
17
|
export type SilkeOverflowMenuItem = {
|
|
18
18
|
label: React.ReactNode;
|
|
19
19
|
kind?: 'default' | 'danger' | 'selected';
|
|
20
|
+
groupLabel?: string;
|
|
20
21
|
} & Omit<SilkeButtonProps, 'height' | 'width' | 'align' | 'vAlign' | 'hAlign' | 'kind'>;
|
|
21
|
-
export declare const SilkeOverflowMenuItem:
|
|
22
|
+
export declare const SilkeOverflowMenuItem: React.ForwardRefExoticComponent<{
|
|
23
|
+
label: React.ReactNode;
|
|
24
|
+
kind?: "default" | "danger" | "selected";
|
|
25
|
+
groupLabel?: string;
|
|
26
|
+
} & Omit<SilkeButtonProps, "align" | "height" | "width" | "vAlign" | "hAlign" | "kind"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './silke-popover-native';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import 'invokers';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { PopoverAnchorNative, PopoverPlacement } from './types';
|
|
4
|
+
export interface SilkePopoverNativeProps {
|
|
5
|
+
id?: string;
|
|
6
|
+
/** Should the popover be hidden */
|
|
7
|
+
hide?: boolean;
|
|
8
|
+
/** Children to add inside the popover */
|
|
9
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
10
|
+
/** Element to anchor the popover to (ref) */
|
|
11
|
+
anchor?: PopoverAnchorNative;
|
|
12
|
+
/** Where to place the popover relative to the anchor. 'start' aligns the start of the popover with the start of the anchor. 'end' aligns the end of the popover with the end of the anchor. */
|
|
13
|
+
placement?: PopoverPlacement;
|
|
14
|
+
/** Advanced: What slot of the anchor should be used for positioning (overrides placement) */
|
|
15
|
+
anchorSlot?: string;
|
|
16
|
+
/** Advanced: Vertical alignment of the popover (overrides placement) */
|
|
17
|
+
align?: string;
|
|
18
|
+
/** Advanced: Horizontal alignment of the popover (overrides placement) */
|
|
19
|
+
justify?: string;
|
|
20
|
+
/** Offset the popover position horizontally */
|
|
21
|
+
offsetX?: number;
|
|
22
|
+
/** Offset the popover position vertically */
|
|
23
|
+
offsetY?: number;
|
|
24
|
+
/** Should the popover have a backdrop */
|
|
25
|
+
hideBackdrop?: boolean;
|
|
26
|
+
/** Should the popover match the width of the anchor */
|
|
27
|
+
matchWidth?: boolean;
|
|
28
|
+
/** Show popover on hover (hint mode) - automatically shows on anchor hover and stays visible when hovering popover */
|
|
29
|
+
hint?: boolean;
|
|
30
|
+
/** Should the popover be animated */
|
|
31
|
+
animate?: boolean;
|
|
32
|
+
/** Shadow level of the popover */
|
|
33
|
+
shadow?: 'level1' | 'level2' | 'level3' | 'level4';
|
|
34
|
+
/** Triggered when the popover is dismissed (via light dismiss or escape key) */
|
|
35
|
+
onRequestClose?: () => void;
|
|
36
|
+
}
|
|
37
|
+
export declare function SilkePopoverNative({ anchor, children, hide, id, placement, anchorSlot, align, justify, offsetX, offsetY, hideBackdrop, matchWidth, hint, animate, shadow, onRequestClose, }: SilkePopoverNativeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type PopoverPlacement = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
|
|
2
|
+
export type PopoverAnchorNative = React.RefObject<HTMLElement>;
|
|
3
|
+
export interface PopoverToggleEvent extends Event {
|
|
4
|
+
newState: 'open' | 'closed';
|
|
5
|
+
oldState: 'open' | 'closed';
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
import type { PopoverAnchorNative, PopoverPlacement } from './types';
|
|
3
|
+
export declare function usePopoverPositioning(popoverRef: React.RefObject<HTMLDivElement>, anchor: PopoverAnchorNative | undefined, anchorName: string, placementStyles: ExtendedCSSProperties, offsetX?: number, offsetY?: number, matchWidth?: boolean): void;
|
|
4
|
+
type ExtendedCSSProperties = CSSProperties & {
|
|
5
|
+
positionArea?: string;
|
|
6
|
+
positionTryFallbacks?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function getPlacementStyles(placement: PopoverPlacement): ExtendedCSSProperties;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SilkeAutocompleteFieldNativeProps } from '../silke-autocomplete-field';
|
|
2
|
+
import { Entry } from '../silke-autocomplete-field/autocomplete-types';
|
|
3
|
+
export type SilkeSelectFieldNativeProps<T, U extends Entry<T> = any> = Omit<SilkeAutocompleteFieldNativeProps<T, U>, 'disableSearch' | 'noReset'>;
|
|
4
|
+
export declare function SilkeSelectFieldNative<T, U extends Entry<T>>(props: SilkeSelectFieldNativeProps<T, U>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './silke-shortcut-button';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { KeyboardEventCode } from '@vev/utils';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { SilkeIcons } from '../silke-icon';
|
|
4
|
+
export type SilkeShortcutButtonProps = {
|
|
5
|
+
label: string;
|
|
6
|
+
icon: SilkeIcons;
|
|
7
|
+
shortcut?: KeyboardEventCode[];
|
|
8
|
+
compressed?: boolean;
|
|
9
|
+
centered?: boolean;
|
|
10
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function SilkeShortcutButton({ label, icon, shortcut, compressed, centered, onClick, }: SilkeShortcutButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare namespace SilkeShortcutButton {
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { BoxProps, BoxSpace } from '../silke-box';
|
|
3
3
|
import { SilkeIcons } from '../silke-icon';
|
|
4
4
|
export type SilkeTagKind = 'primary' | 'secondary';
|
|
5
|
-
export type SilkeTagColor = 'yellow' | 'green' | 'red' | 'gray' | 'blue' | 'purple' | 'dark';
|
|
5
|
+
export type SilkeTagColor = 'yellow' | 'green' | 'red' | 'gray' | 'blue' | 'purple' | 'dark' | 'ai';
|
|
6
6
|
export type SilkeTagSize = 'tiny';
|
|
7
7
|
export type SilkeTagProps = {
|
|
8
8
|
disabled?: boolean;
|