@vev/silke 1.0.21 → 1.0.23
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 +15 -0
- package/dist/index.js +22 -22
- package/dist/index.js.map +4 -4
- package/dist/silke/src/components/silke-autocomplete-field/silke-autocomplete-field.d.ts +4 -0
- package/dist/silke/src/components/silke-breadcrumbs/silke-breadcrumb.d.ts +2 -1
- package/dist/silke/src/components/silke-button/index.d.ts +1 -0
- package/dist/silke/src/components/silke-button/silke-button.d.ts +2 -0
- package/dist/silke/src/components/silke-button/silke-dropdown-button.d.ts +17 -0
- package/dist/silke/src/components/silke-card/silke-card.d.ts +1 -1
- package/dist/silke/src/components/silke-color-swatches/silke-swatches.d.ts +2 -1
- package/dist/silke/src/components/silke-context-menu/silke-context-menu.d.ts +3 -1
- package/dist/silke/src/components/silke-css-number-field/index.d.ts +1 -0
- package/dist/silke/src/components/silke-css-number-field/silke-css-context.d.ts +7 -0
- package/dist/silke/src/components/silke-css-number-field/silke-css-number-field.d.ts +3 -0
- package/dist/silke/src/components/silke-css-number-field/variable-picker.d.ts +17 -0
- package/dist/silke/src/components/silke-form-schema/fields/video-field.d.ts +4 -0
- package/dist/silke/src/components/silke-link/silke-link.d.ts +1 -0
- package/dist/silke/src/components/silke-navigation-link/silke-navigation-link.d.ts +6 -1
- package/dist/silke/src/components/silke-text/silke-text.d.ts +1 -4
- package/dist/silke/src/components/silke-text-field/silke-text-field-outline.d.ts +3 -0
- package/dist/silke/src/hooks/drag-and-drop/use-drop.d.ts +2 -1
- package/dist/silke/src/icons.d.ts +8 -0
- package/dist/silke-code-editor-LK4ESGQO.js +25 -0
- package/dist/silke-code-editor-LK4ESGQO.js.map +7 -0
- package/dist/styles.css +1028 -926
- package/dist/utils/src/events/condition-parser/lexer.d.ts +1 -0
- package/dist/utils/src/types/context.d.ts +3 -1
- package/dist/utils/src/types/interaction.d.ts +9 -4
- package/dist/utils/src/types/vev-plugin.d.ts +40 -23
- package/dist/utils/src/types/vev-props.d.ts +6 -0
- package/dist/utils/src/utils/index.d.ts +1 -0
- package/dist/utils/src/utils/main-components.d.ts +7 -0
- package/esbuild.config.mjs +2 -4
- package/package.json +3 -3
- package/public/index.html +1 -1
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.scss +13 -4
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +32 -7
- package/src/components/silke-breadcrumbs/silke-breadcrumb.scss +11 -4
- package/src/components/silke-breadcrumbs/silke-breadcrumb.tsx +26 -6
- package/src/components/silke-button/index.ts +1 -0
- package/src/components/silke-button/silke-button.scss +0 -4
- package/src/components/silke-button/silke-button.tsx +8 -0
- package/src/components/silke-button/silke-dropdown-button.tsx +148 -0
- package/src/components/silke-color-picker/silke-color-picker.tsx +1 -0
- package/src/components/silke-color-swatches/silke-swatches.tsx +38 -6
- package/src/components/silke-context-menu/silke-context-menu.mdx +32 -0
- package/src/components/silke-context-menu/silke-context-menu.scss +6 -0
- package/src/components/silke-context-menu/silke-context-menu.tsx +22 -0
- package/src/components/silke-css-number-field/index.ts +1 -0
- package/src/components/silke-css-number-field/silke-css-context.tsx +17 -1
- package/src/components/silke-css-number-field/silke-css-number-field.mdx +30 -0
- package/src/components/silke-css-number-field/silke-css-number-field.scss +14 -2
- package/src/components/silke-css-number-field/silke-css-number-field.tsx +113 -13
- package/src/components/silke-css-number-field/variable-picker.tsx +181 -0
- package/src/components/silke-form-schema/fields/video-field.tsx +52 -0
- package/src/components/silke-form-schema/silke-schema-field.tsx +3 -1
- package/src/components/silke-image/silke-image.scss +1 -0
- package/src/components/silke-link/silke-link.mdx +3 -0
- package/src/components/silke-link/silke-link.scss +5 -1
- package/src/components/silke-link/silke-link.tsx +15 -3
- package/src/components/silke-modal/silke-modal.tsx +2 -0
- package/src/components/silke-navigation-link/silke-navigation-link.scss +67 -11
- package/src/components/silke-navigation-link/silke-navigation-link.tsx +171 -51
- package/src/components/silke-overflow-menu/silke-overflow-menu.scss +1 -1
- package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +1 -1
- package/src/components/silke-select-field/silke-select-field.mdx +12 -0
- package/src/components/silke-text-field/silke-text-field-outline.tsx +69 -47
- package/src/components/silke-text-field/silke-text-field.scss +63 -0
- package/src/components/silke-text-field/silke-text-field.tsx +6 -0
- package/src/hooks/drag-and-drop/use-drop.tsx +3 -1
- package/src/icons.tsx +12 -2
- package/dist/silke-code-editor-4TSQ5KJ3.js +0 -25
- package/dist/silke-code-editor-4TSQ5KJ3.js.map +0 -7
- /package/dist/{silke-code-editor-4TSQ5KJ3.js.LEGAL.txt → silke-code-editor-LK4ESGQO.js.LEGAL.txt} +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { IProjectMenu } from '../types';
|
|
1
|
+
import { IProjectMenu, VideoType } from '../types';
|
|
2
2
|
import { ImageType, ShapeType, VevEvent } from '.';
|
|
3
3
|
export type SchemaActions = {
|
|
4
4
|
imageLibraryOpen: (onImageSelect: (image: ImageType) => void) => void;
|
|
5
5
|
imageLibraryClose: () => void;
|
|
6
6
|
shapeLibraryOpen: (onShapeSelect: (shape: ShapeType) => void) => void;
|
|
7
7
|
shapeLibraryClose: () => void;
|
|
8
|
+
videoLibraryOpen: (onVideoSelect: (video: VideoType) => void) => void;
|
|
9
|
+
videoLibraryClose: () => void;
|
|
8
10
|
uploadFile(file: File | string): Promise<{
|
|
9
11
|
name: string;
|
|
10
12
|
url: string;
|
|
@@ -9,12 +9,15 @@ export declare enum TRIGGER_SCOPE {
|
|
|
9
9
|
export declare enum EVENT_SCOPE {
|
|
10
10
|
ELEMENT = "element",
|
|
11
11
|
PAGE = "page",
|
|
12
|
-
|
|
12
|
+
VARIABLE = "variable",
|
|
13
|
+
EXTERNAL = "external",
|
|
14
|
+
TRACKING = "tracking"
|
|
13
15
|
}
|
|
14
16
|
export type VevDispatchEvent = {
|
|
15
17
|
type?: string;
|
|
16
18
|
contentKey?: string;
|
|
17
|
-
|
|
19
|
+
instanceKeyChain?: string;
|
|
20
|
+
args?: Record<string, string>;
|
|
18
21
|
};
|
|
19
22
|
export type TriggerItem = {
|
|
20
23
|
label: string;
|
|
@@ -58,7 +61,9 @@ export declare enum GLOBAL_EVENT_TYPES {
|
|
|
58
61
|
DOWNLOAD_FILE = "DOWNLOAD_FILE",
|
|
59
62
|
SEND_EMAIL = "SEND_EMAIL",
|
|
60
63
|
CALL_PHONE = "CALL_PHONE",
|
|
61
|
-
SEND_SMS = "SEND_SMS"
|
|
64
|
+
SEND_SMS = "SEND_SMS",
|
|
65
|
+
TRACK = "TRACK",
|
|
66
|
+
SET_VARIABLE = "SET_VARIABLE"
|
|
62
67
|
}
|
|
63
68
|
export declare const GLOBAL_EVENTS: TriggerItem[];
|
|
64
69
|
export type VevTriggerType = NATIVE_TRIGGER_TYPES | CUSTOM_TRIGGER_TYPES | string;
|
|
@@ -74,7 +79,7 @@ export type ProjectInteraction = {
|
|
|
74
79
|
event?: VevDispatchEvent;
|
|
75
80
|
trigger?: VevTrigger;
|
|
76
81
|
disabled?: boolean;
|
|
77
|
-
updated
|
|
82
|
+
updated: number;
|
|
78
83
|
deleted?: number;
|
|
79
84
|
};
|
|
80
85
|
export type InteractionMap = {
|
|
@@ -19,29 +19,37 @@ export interface EditorPluginKv {
|
|
|
19
19
|
export interface EditorPluginSettings {
|
|
20
20
|
form: VevProps[];
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
name: string;
|
|
33
|
-
url: string;
|
|
34
|
-
thumb: string;
|
|
35
|
-
metadata: Record<string, string>;
|
|
36
|
-
}[];
|
|
37
|
-
shapes?: {
|
|
38
|
-
key: string;
|
|
39
|
-
name: string;
|
|
40
|
-
url: string;
|
|
41
|
-
thumb: string;
|
|
42
|
-
metadata: Record<string, string>;
|
|
43
|
-
}[];
|
|
22
|
+
type ImageSizes = Record<number, string>;
|
|
23
|
+
type MetaData = Record<string, string>;
|
|
24
|
+
export interface BaseProjectAsset {
|
|
25
|
+
key: string;
|
|
26
|
+
mimeType: string;
|
|
27
|
+
updated: number;
|
|
28
|
+
url: string;
|
|
29
|
+
filename?: string;
|
|
30
|
+
metaData?: MetaData;
|
|
31
|
+
selfHosted?: boolean;
|
|
44
32
|
}
|
|
33
|
+
export interface ProjectImageAsset extends BaseProjectAsset {
|
|
34
|
+
dimension?: {
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
};
|
|
38
|
+
thumb?: string;
|
|
39
|
+
imageSizes?: ImageSizes;
|
|
40
|
+
}
|
|
41
|
+
export interface ProjectVideoAsset extends BaseProjectAsset {
|
|
42
|
+
videoThumbnail?: string;
|
|
43
|
+
videoSample?: string;
|
|
44
|
+
dimension?: {
|
|
45
|
+
width: number;
|
|
46
|
+
height: number;
|
|
47
|
+
};
|
|
48
|
+
duration?: number;
|
|
49
|
+
state?: 'uploading' | 'encoding' | 'completed' | 'error' | 'preUpload';
|
|
50
|
+
additionalSources: Omit<ProjectVideoAsset, 'additionalSources'>[];
|
|
51
|
+
}
|
|
52
|
+
export type ProjectAsset = BaseProjectAsset | ProjectImageAsset | ProjectVideoAsset;
|
|
45
53
|
export declare enum EditorPluginType {
|
|
46
54
|
ASSET_SOURCE = "asset-source"
|
|
47
55
|
}
|
|
@@ -54,7 +62,16 @@ export interface EditorPlugin<T> {
|
|
|
54
62
|
icon?: string;
|
|
55
63
|
oauthConfig?: OAuthConfig;
|
|
56
64
|
}
|
|
57
|
-
export
|
|
65
|
+
export type EditorPluginAssetSourceFilterField = {
|
|
66
|
+
label: string;
|
|
67
|
+
value: string;
|
|
68
|
+
fields: {
|
|
69
|
+
label: string;
|
|
70
|
+
value: string;
|
|
71
|
+
}[];
|
|
72
|
+
};
|
|
73
|
+
export type EditorPluginAssetSourceFilterFields = EditorPluginAssetSourceFilterField[];
|
|
74
|
+
export interface EditorPluginAssetSource extends EditorPlugin<ProjectAsset[] | EditorPluginAssetSourceFilterFields> {
|
|
58
75
|
type: EditorPluginType.ASSET_SOURCE;
|
|
59
76
|
}
|
|
60
77
|
export type VevPluginType = EditorPluginAssetSource;
|
|
@@ -8,6 +8,10 @@ export type ImageType = {
|
|
|
8
8
|
url: string;
|
|
9
9
|
key: string;
|
|
10
10
|
};
|
|
11
|
+
export type VideoType = {
|
|
12
|
+
url: string;
|
|
13
|
+
key: string;
|
|
14
|
+
};
|
|
11
15
|
export type ShapeType = {
|
|
12
16
|
key: string;
|
|
13
17
|
name: string;
|
|
@@ -69,6 +73,7 @@ export type NumberField = BaseField<'number', number> & {
|
|
|
69
73
|
};
|
|
70
74
|
export type BooleanField = BaseField<'boolean', boolean>;
|
|
71
75
|
export type ImageField = BaseField<'image', ImageType>;
|
|
76
|
+
export type VideoField = BaseField<'video', VideoType>;
|
|
72
77
|
export type IconField = BaseField<'icon', ShapeType>;
|
|
73
78
|
export type SelectFieldItem = {
|
|
74
79
|
label: string;
|
|
@@ -126,6 +131,7 @@ export type SchemaFieldTypes = {
|
|
|
126
131
|
object: ObjectField;
|
|
127
132
|
number: NumberField;
|
|
128
133
|
image: ImageField;
|
|
134
|
+
video: VideoField;
|
|
129
135
|
icon: IconField;
|
|
130
136
|
boolean: BooleanField;
|
|
131
137
|
select: SelectField;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get all inherited keys from a mocked key
|
|
3
|
+
* ie. 'model-instance-instance2' => ['model-instance', 'model']
|
|
4
|
+
* @param key mocked key
|
|
5
|
+
* @returns a array of all models that are inherited from the given key
|
|
6
|
+
*/
|
|
7
|
+
export declare function getInheritedKeysFromKey(key: string): string[];
|
package/esbuild.config.mjs
CHANGED
|
@@ -52,9 +52,7 @@ async function buildSilke(watch) {
|
|
|
52
52
|
setup(build) {
|
|
53
53
|
build.onResolve({ filter: /\.raw\..+$/i }, (args) => {
|
|
54
54
|
return {
|
|
55
|
-
path: path.isAbsolute(args.path)
|
|
56
|
-
? args.path
|
|
57
|
-
: path.join(args.resolveDir, args.path),
|
|
55
|
+
path: path.isAbsolute(args.path) ? args.path : path.join(args.resolveDir, args.path),
|
|
58
56
|
namespace: 'raw-loader',
|
|
59
57
|
};
|
|
60
58
|
});
|
|
@@ -68,7 +66,7 @@ async function buildSilke(watch) {
|
|
|
68
66
|
},
|
|
69
67
|
esbuildSassModulesPlugin(),
|
|
70
68
|
],
|
|
71
|
-
}
|
|
69
|
+
};
|
|
72
70
|
|
|
73
71
|
if (watch) {
|
|
74
72
|
// don't minify
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vev/silke",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/silke/src/index.d.ts",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
33
33
|
"@uiw/codemirror-theme-dracula": "^4.12.3",
|
|
34
34
|
"@uiw/react-codemirror": "^4.12.3",
|
|
35
|
-
"@vev/react": "0.1.
|
|
36
|
-
"@vev/utils": "1.2.
|
|
35
|
+
"@vev/react": "0.1.7",
|
|
36
|
+
"@vev/utils": "1.2.3",
|
|
37
37
|
"classnames": ">=2.2.0",
|
|
38
38
|
"flux": "^4.0.4",
|
|
39
39
|
"lodash": "^4.17.21",
|
package/public/index.html
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
rel="stylesheet"
|
|
16
16
|
/>
|
|
17
17
|
<!-- <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" /> -->
|
|
18
|
-
<link rel="stylesheet" href="https://cdn.vev.design/fontawesome/6.
|
|
18
|
+
<link rel="stylesheet" href="https://cdn.vev.design/fontawesome/6.5.1/css/all.min.css" >
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
<div id="root" style="width: 100%;height:100%;"></div>
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
@use '../../variables' as *;
|
|
2
1
|
.root {
|
|
3
2
|
cursor: pointer;
|
|
4
3
|
user-select: none;
|
|
5
4
|
|
|
6
|
-
&:hover,
|
|
5
|
+
&:not(.disabled):hover,
|
|
7
6
|
&.open {
|
|
8
7
|
.downIcon{
|
|
9
8
|
color: var(--color-neutral-100);
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
|
-
&:hover:not(.open){
|
|
11
|
+
&:not(.disabled):hover:not(.open){
|
|
13
12
|
.arrow{
|
|
14
13
|
padding-top: 4px;
|
|
15
14
|
}
|
|
@@ -21,10 +20,20 @@
|
|
|
21
20
|
--text-field-focus-border-color: transparent;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
.placeholder {
|
|
23
|
+
.placeholder, &.disabled [data-input] {
|
|
25
24
|
color: var(--text-field-disabled-placeholder-color);
|
|
26
25
|
font-size: var(--text-field-font-size);
|
|
27
26
|
}
|
|
27
|
+
|
|
28
|
+
&.disabled *{
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.activeVariable {
|
|
33
|
+
[data-input] {
|
|
34
|
+
color: var(--color-support-tertiary-30);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
.autocompleteItem {
|
|
@@ -79,6 +79,10 @@ export type SilkeAutocompleteFieldProps<T = any, U extends Entry<T> = any> = (
|
|
|
79
79
|
*/
|
|
80
80
|
sort?: (one: Entry<T>, other: Entry<T>) => number;
|
|
81
81
|
onSearch?: (value: string) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Called when dropdown closes for any reason
|
|
84
|
+
*/
|
|
85
|
+
onClose?: () => void;
|
|
82
86
|
};
|
|
83
87
|
|
|
84
88
|
const autocompleteValidator: FormValidator<SilkeAutocompleteFieldProps> = (props, value) => {
|
|
@@ -168,6 +172,10 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
168
172
|
onClick,
|
|
169
173
|
onMouseDown,
|
|
170
174
|
hAlign,
|
|
175
|
+
onClose,
|
|
176
|
+
showVariableDot,
|
|
177
|
+
hasActiveVariable,
|
|
178
|
+
onVariableClick,
|
|
171
179
|
...form
|
|
172
180
|
} = useFormField(props, autocompleteValidator);
|
|
173
181
|
const context = useTextFieldContext();
|
|
@@ -256,8 +264,12 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
256
264
|
}, [items, form.multiple, resetSearchText, form.value]);
|
|
257
265
|
|
|
258
266
|
useEffect(() => {
|
|
259
|
-
if (autoFocus) setOpen(true);
|
|
260
|
-
|
|
267
|
+
if (autoFocus && !disabled) setOpen(true);
|
|
268
|
+
else if (disabled) {
|
|
269
|
+
setOpen(false);
|
|
270
|
+
onClose && onClose();
|
|
271
|
+
}
|
|
272
|
+
}, [autoFocus, disabled]);
|
|
261
273
|
|
|
262
274
|
useEffect(() => {
|
|
263
275
|
if (open && highlight !== undefined) {
|
|
@@ -280,7 +292,7 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
280
292
|
else form.onChange('');
|
|
281
293
|
setSearchText('');
|
|
282
294
|
setPrevSearchText('');
|
|
283
|
-
|
|
295
|
+
onClose && onClose();
|
|
284
296
|
setOpen(false);
|
|
285
297
|
};
|
|
286
298
|
|
|
@@ -376,6 +388,7 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
376
388
|
resetSearchText();
|
|
377
389
|
handleChange(item.value);
|
|
378
390
|
setOpen(false);
|
|
391
|
+
onClose && onClose();
|
|
379
392
|
|
|
380
393
|
setHighlight(undefined);
|
|
381
394
|
}
|
|
@@ -416,13 +429,14 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
416
429
|
}
|
|
417
430
|
inputField.current?.focus();
|
|
418
431
|
setOpen(false);
|
|
432
|
+
onClose && onClose();
|
|
419
433
|
break;
|
|
420
434
|
}
|
|
421
435
|
case 'ArrowUp':
|
|
422
436
|
case 'ArrowDown': {
|
|
423
437
|
e.preventDefault();
|
|
424
438
|
e.stopPropagation();
|
|
425
|
-
if (!open) {
|
|
439
|
+
if (!open && !disabled) {
|
|
426
440
|
setOpen(true);
|
|
427
441
|
} else {
|
|
428
442
|
const { key } = e;
|
|
@@ -433,6 +447,7 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
433
447
|
case 'Escape': {
|
|
434
448
|
inputField.current?.focus();
|
|
435
449
|
setOpen(false);
|
|
450
|
+
onClose && onClose();
|
|
436
451
|
break;
|
|
437
452
|
}
|
|
438
453
|
}
|
|
@@ -451,6 +466,8 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
451
466
|
let cl = styles.root;
|
|
452
467
|
if (open) cl += ' ' + styles.open;
|
|
453
468
|
if (styles[kind]) cl += ' ' + styles[kind];
|
|
469
|
+
if (disabled) cl += ' ' + styles.disabled;
|
|
470
|
+
if (hasActiveVariable) cl += ' ' + styles.activeVariable;
|
|
454
471
|
|
|
455
472
|
return (
|
|
456
473
|
<>
|
|
@@ -470,11 +487,15 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
470
487
|
data-cy={dataCy}
|
|
471
488
|
labelId={inputId}
|
|
472
489
|
labelUsingAria
|
|
490
|
+
showVariableDot={showVariableDot}
|
|
491
|
+
hasActiveVariable={hasActiveVariable}
|
|
492
|
+
onVariableClick={onVariableClick}
|
|
473
493
|
onClick={onClick}
|
|
474
494
|
onMouseDown={(e: React.MouseEvent<HTMLElement>) => {
|
|
475
495
|
e.preventDefault();
|
|
476
496
|
e.stopPropagation();
|
|
477
497
|
onMouseDown?.(e);
|
|
498
|
+
if (disabled) return;
|
|
478
499
|
!context.readOnly &&
|
|
479
500
|
setOpen((wasOpen) => {
|
|
480
501
|
return !wasOpen;
|
|
@@ -504,13 +525,13 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
504
525
|
ref={inputField}
|
|
505
526
|
data-placeholder={placeholder}
|
|
506
527
|
onKeyUp={(e: KeyboardEvent) => {
|
|
507
|
-
if ((e.key === 'Enter' || e.key === 'ArrowDown') && !open) {
|
|
528
|
+
if ((e.key === 'Enter' || e.key === 'ArrowDown') && !open && !disabled) {
|
|
508
529
|
e.preventDefault();
|
|
509
530
|
setOpen(true);
|
|
510
531
|
}
|
|
511
532
|
}}
|
|
512
533
|
onFocus={() => {
|
|
513
|
-
if (!open) setOpen(true);
|
|
534
|
+
if (!open && !disabled) setOpen(true);
|
|
514
535
|
}}
|
|
515
536
|
>
|
|
516
537
|
{form.multiple && form.value?.length > 0 ? (
|
|
@@ -580,6 +601,7 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
580
601
|
matchAnchorWidth
|
|
581
602
|
onRequestClose={() => {
|
|
582
603
|
setOpen(false);
|
|
604
|
+
onClose && onClose();
|
|
583
605
|
}}
|
|
584
606
|
>
|
|
585
607
|
<SilkeBox
|
|
@@ -600,7 +622,6 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
600
622
|
inline="label-inside"
|
|
601
623
|
label={<SilkeIcon icon="search" />}
|
|
602
624
|
aria-label={'Search for ' + label}
|
|
603
|
-
aria-role="searchbox"
|
|
604
625
|
autoFocus
|
|
605
626
|
size={size}
|
|
606
627
|
className={disableSearch ? styles.hiddenSearch : undefined}
|
|
@@ -608,6 +629,10 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
608
629
|
kind="ghost"
|
|
609
630
|
onFocus={(e) => {
|
|
610
631
|
inputRef.current = e.currentTarget as HTMLInputElement;
|
|
632
|
+
if (props.onFocus) props.onFocus(e);
|
|
633
|
+
}}
|
|
634
|
+
onBlur={(e) => {
|
|
635
|
+
if (props.onBlur) props.onBlur(e);
|
|
611
636
|
}}
|
|
612
637
|
onChange={(text: string) => {
|
|
613
638
|
onSearch?.(text);
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
@use '../../variables' as *;
|
|
2
2
|
.breadbrumbs {
|
|
3
3
|
padding: 0;
|
|
4
|
+
margin: 0;
|
|
5
|
+
align-items: center;
|
|
4
6
|
}
|
|
5
7
|
|
|
6
8
|
.breadbrumb {
|
|
7
9
|
user-select: none;
|
|
8
10
|
|
|
9
11
|
a {
|
|
10
|
-
color: var(--color-
|
|
12
|
+
color: var(--color-neutral-60) !important;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
a:focus {
|
|
14
16
|
outline: none;
|
|
15
|
-
box-shadow: 0 0 0 2px var(--color-neutral-100);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
a:hover {
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
color: var(--color-neutral-60) !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.icon{
|
|
24
|
+
[class*="silke-image"],[class*="silke-icon"]{
|
|
25
|
+
font-size: 12px !important;
|
|
26
|
+
|
|
27
|
+
}
|
|
21
28
|
}
|
|
22
29
|
}
|
|
@@ -3,9 +3,11 @@ import { SilkeIcon, SilkeIcons } from '../silke-icon';
|
|
|
3
3
|
import { SilkeBox } from '../silke-box';
|
|
4
4
|
import styles from './silke-breadcrumb.scss';
|
|
5
5
|
import { SilkeText } from '../silke-text';
|
|
6
|
+
import { IEmojiIcon } from '@vev/utils';
|
|
7
|
+
import { SilkeImage } from '../silke-image';
|
|
6
8
|
|
|
7
9
|
type SilkeBreadcrumbProps = {
|
|
8
|
-
icon?: SilkeIcons;
|
|
10
|
+
icon?: IEmojiIcon | SilkeIcons;
|
|
9
11
|
label?: string;
|
|
10
12
|
noSlash?: boolean;
|
|
11
13
|
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
@@ -16,7 +18,7 @@ export function SilkeBreadcrumb({ icon, label, noSlash, onClick }: SilkeBreadcru
|
|
|
16
18
|
if (onClick) cl += ' ' + styles.interactive;
|
|
17
19
|
const text = <SilkeText overflow>{label}</SilkeText>;
|
|
18
20
|
return (
|
|
19
|
-
<SilkeBox height="s" gap="
|
|
21
|
+
<SilkeBox height="s" gap="xs" vAlign="center" className={cl} tag="li">
|
|
20
22
|
{onClick ? (
|
|
21
23
|
<a
|
|
22
24
|
onClick={(event: React.MouseEvent<HTMLAnchorElement>) => {
|
|
@@ -25,13 +27,31 @@ export function SilkeBreadcrumb({ icon, label, noSlash, onClick }: SilkeBreadcru
|
|
|
25
27
|
}}
|
|
26
28
|
href="#"
|
|
27
29
|
>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
<SilkeBox>
|
|
31
|
+
{icon && (
|
|
32
|
+
<SilkeImage
|
|
33
|
+
icon={icon}
|
|
34
|
+
avatar="s"
|
|
35
|
+
style={{ marginRight: 4 }}
|
|
36
|
+
className={styles.icon}
|
|
37
|
+
/>
|
|
38
|
+
)}
|
|
39
|
+
{text}
|
|
40
|
+
</SilkeBox>
|
|
30
41
|
</a>
|
|
31
42
|
) : (
|
|
32
|
-
|
|
43
|
+
<>
|
|
44
|
+
{icon && <SilkeImage icon={icon} avatar="s" className={styles.icon} />}
|
|
45
|
+
{text}
|
|
46
|
+
</>
|
|
47
|
+
)}
|
|
48
|
+
{!noSlash && (
|
|
49
|
+
<SilkeIcon
|
|
50
|
+
icon="chevron.right"
|
|
51
|
+
color="neutral-50"
|
|
52
|
+
style={{ fontSize: 12, fontWeight: 400, paddingTop: 4 }}
|
|
53
|
+
/>
|
|
33
54
|
)}
|
|
34
|
-
{!noSlash && <span>/</span>}
|
|
35
55
|
</SilkeBox>
|
|
36
56
|
);
|
|
37
57
|
}
|
|
@@ -24,6 +24,7 @@ export type SilkeButtonProps = {
|
|
|
24
24
|
/** Show button as in hover state */
|
|
25
25
|
hover?: boolean;
|
|
26
26
|
icon?: SilkeIcons | React.ReactElement;
|
|
27
|
+
leftIcon?: SilkeIcons | React.ReactElement;
|
|
27
28
|
link?: string;
|
|
28
29
|
target?: string;
|
|
29
30
|
} & Omit<BoxButtonProps, 'children' | 'size'>;
|
|
@@ -36,6 +37,7 @@ export const SilkeButton = React.forwardRef(
|
|
|
36
37
|
kind,
|
|
37
38
|
size,
|
|
38
39
|
icon,
|
|
40
|
+
leftIcon,
|
|
39
41
|
focus,
|
|
40
42
|
hover,
|
|
41
43
|
className,
|
|
@@ -76,6 +78,7 @@ export const SilkeButton = React.forwardRef(
|
|
|
76
78
|
rel="button"
|
|
77
79
|
tag={link ? 'link' : 'button'}
|
|
78
80
|
to={link}
|
|
81
|
+
gap="s"
|
|
79
82
|
>
|
|
80
83
|
{loading && (
|
|
81
84
|
<SilkeSkeleton
|
|
@@ -90,6 +93,11 @@ export const SilkeButton = React.forwardRef(
|
|
|
90
93
|
}}
|
|
91
94
|
/>
|
|
92
95
|
)}
|
|
96
|
+
{leftIcon && (
|
|
97
|
+
<span>
|
|
98
|
+
<SilkeIcon icon={leftIcon} />
|
|
99
|
+
</span>
|
|
100
|
+
)}
|
|
93
101
|
{label}
|
|
94
102
|
{icon && (
|
|
95
103
|
<span className={styles.icon}>
|