@vev/silke 1.0.19 → 1.0.21
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 +20 -0
- package/dist/{chunk-FIPWO3IB.js → chunk-PP74IZDW.js} +2 -2
- package/dist/{chunk-FIPWO3IB.js.map → chunk-PP74IZDW.js.map} +2 -2
- package/dist/index.js +20 -20
- package/dist/index.js.map +4 -4
- package/dist/silke/src/components/silke-box/silke-box.d.ts +1 -2
- package/dist/silke/src/components/silke-card/silke-card.d.ts +2 -0
- package/dist/silke/src/components/silke-form-schema/fields/number-field.d.ts +3 -1
- package/dist/silke/src/components/silke-form-schema/silke-schema-field.d.ts +2 -2
- package/dist/silke/src/components/silke-tabs/silke-tab.d.ts +4 -7
- package/dist/silke/src/components/silke-tabs/silke-tabs.d.ts +4 -6
- package/dist/silke/src/components/silke-text-field/silke-text-field-outline.d.ts +1 -2
- package/dist/silke/src/components/silke-tooltip/silke-shortcuts.d.ts +1 -1
- package/dist/silke/src/components/silke-upload-field/silke-upload-field.d.ts +1 -0
- package/dist/silke/src/icons.d.ts +3 -0
- package/dist/{silke-code-editor-HB2Z4Q5W.js → silke-code-editor-4TSQ5KJ3.js} +12 -12
- package/dist/silke-code-editor-4TSQ5KJ3.js.map +7 -0
- package/dist/styles.css +330 -356
- package/dist/utils/src/interactions/get-interaction-map.d.ts +3 -0
- package/dist/utils/src/interactions/index.d.ts +2 -0
- package/dist/utils/src/interactions/interaction-map-to-array.d.ts +2 -0
- package/dist/utils/src/types/context.d.ts +1 -1
- package/dist/utils/src/types/index.d.ts +1 -0
- package/dist/utils/src/types/interaction.d.ts +15 -4
- package/dist/utils/src/types/oauth.d.ts +13 -0
- package/dist/utils/src/types/vev-plugin.d.ts +39 -8
- package/package.json +5 -4
- package/src/components/silke-autocomplete-field/autocomplete-item.tsx +1 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.scss +22 -9
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +12 -10
- package/src/components/silke-box/silke-box.mdx +2 -2
- package/src/components/silke-box/silke-box.scss +2 -1
- package/src/components/silke-box/silke-box.tsx +1 -2
- package/src/components/silke-button/silke-button.scss +2 -2
- package/src/components/silke-card/silke-card-grid.tsx +1 -3
- package/src/components/silke-card/silke-card.scss +28 -3
- package/src/components/silke-card/silke-card.tsx +27 -9
- package/src/components/silke-code-snippet/silke-code-snippet.tsx +2 -2
- package/src/components/silke-form-schema/fields/image-field.tsx +4 -2
- package/src/components/silke-form-schema/fields/link-field.tsx +2 -6
- package/src/components/silke-form-schema/fields/number-field.tsx +47 -43
- package/src/components/silke-form-schema/fields/object-field.tsx +1 -1
- package/src/components/silke-form-schema/fields/select-field.tsx +37 -49
- package/src/components/silke-form-schema/fields/string-field.tsx +13 -28
- package/src/components/silke-form-schema/fields/toggle-field.tsx +8 -10
- package/src/components/silke-form-schema/silke-form-schema.mdx +14 -26
- package/src/components/silke-form-schema/silke-form-schema.tsx +4 -1
- package/src/components/silke-form-schema/silke-schema-field.tsx +8 -8
- package/src/components/silke-form-schema/silke-schema-fields.tsx +2 -2
- package/src/components/silke-icon-picker/silke-icon-picker.tsx +1 -1
- package/src/components/silke-list-card/silke-list-card.tsx +0 -2
- package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +1 -1
- package/src/components/silke-tabs/silke-tab.tsx +17 -50
- package/src/components/silke-tabs/silke-tabs.mdx +4 -16
- package/src/components/silke-tabs/silke-tabs.scss +24 -81
- package/src/components/silke-tabs/silke-tabs.tsx +12 -10
- package/src/components/silke-tag/silke-tag.mdx +78 -24
- package/src/components/silke-tag/silke-tag.scss +4 -1
- package/src/components/silke-text/silke-title.scss +0 -2
- package/src/components/silke-text-field/silke-text-field-outline.tsx +28 -16
- package/src/components/silke-text-field/silke-text-field.mdx +12 -0
- package/src/components/silke-text-field/silke-text-field.scss +8 -1
- package/src/components/silke-text-field/silke-text-field.tsx +2 -2
- package/src/components/silke-upload-field/silke-upload-field.tsx +5 -1
- package/src/icons.tsx +9 -19
- package/src/styles/core.scss +6 -0
- package/dist/silke-code-editor-HB2Z4Q5W.js.map +0 -7
- package/dist/utils/src/keyboard/key-list.d.ts +0 -4
- /package/dist/{chunk-FIPWO3IB.js.LEGAL.txt → chunk-PP74IZDW.js.LEGAL.txt} +0 -0
- /package/dist/{silke-code-editor-HB2Z4Q5W.js.LEGAL.txt → silke-code-editor-4TSQ5KJ3.js.LEGAL.txt} +0 -0
|
@@ -28,12 +28,15 @@ export declare enum NATIVE_TRIGGER_TYPES {
|
|
|
28
28
|
ON_MOUSE_LEAVE = "onMouseLeave",
|
|
29
29
|
ON_MOUSE_DOWN = "onMouseDown",
|
|
30
30
|
ON_MOUSE_UP = "onMouseUp",
|
|
31
|
-
ON_DOUBLE_CLICK = "onDoubleClick"
|
|
31
|
+
ON_DOUBLE_CLICK = "onDoubleClick",
|
|
32
|
+
ON_TOUCH_START = "onTouchStart",
|
|
33
|
+
ON_TOUCH_END = "onTouchEnd"
|
|
32
34
|
}
|
|
33
35
|
export declare const NATIVE_TRIGGERS: TriggerItem[];
|
|
34
36
|
export declare enum CUSTOM_TRIGGER_TYPES {
|
|
35
37
|
ON_VISIBLE = "onVisible",
|
|
36
|
-
ON_LEAVE = "onLeave"
|
|
38
|
+
ON_LEAVE = "onLeave",
|
|
39
|
+
ON_SWIPE = "onSwipe"
|
|
37
40
|
}
|
|
38
41
|
export declare const CUSTOM_TRIGGERS: TriggerItem[];
|
|
39
42
|
export declare enum GLOBAL_TRIGGER_TYPES {
|
|
@@ -43,7 +46,6 @@ export declare enum GLOBAL_TRIGGER_TYPES {
|
|
|
43
46
|
ON_KEY_UP = "onKeyUp"
|
|
44
47
|
}
|
|
45
48
|
export declare const GLOBAL_TRIGGERS: TriggerItem[];
|
|
46
|
-
export declare const GLOBAL_TRIGGER_ARGS: Record<GLOBAL_TRIGGER_TYPES, VevProps[]>;
|
|
47
49
|
export declare enum GLOBAL_EVENT_TYPES {
|
|
48
50
|
SHOW = "SHOW",
|
|
49
51
|
HIDE = "HIDE",
|
|
@@ -59,7 +61,6 @@ export declare enum GLOBAL_EVENT_TYPES {
|
|
|
59
61
|
SEND_SMS = "SEND_SMS"
|
|
60
62
|
}
|
|
61
63
|
export declare const GLOBAL_EVENTS: TriggerItem[];
|
|
62
|
-
export declare const GLOBAL_EVENTS_ARGS: Record<GLOBAL_EVENT_TYPES, VevProps[]>;
|
|
63
64
|
export type VevTriggerType = NATIVE_TRIGGER_TYPES | CUSTOM_TRIGGER_TYPES | string;
|
|
64
65
|
export type VevTrigger = {
|
|
65
66
|
type: VevTriggerType;
|
|
@@ -72,6 +73,16 @@ export type ProjectInteraction = {
|
|
|
72
73
|
key: string;
|
|
73
74
|
event?: VevDispatchEvent;
|
|
74
75
|
trigger?: VevTrigger;
|
|
76
|
+
disabled?: boolean;
|
|
75
77
|
updated?: number;
|
|
76
78
|
deleted?: number;
|
|
77
79
|
};
|
|
80
|
+
export type InteractionMap = {
|
|
81
|
+
trigger: {
|
|
82
|
+
global: Record<GLOBAL_TRIGGER_TYPES, ProjectInteraction[]>;
|
|
83
|
+
widget: Record<string, ProjectInteraction[]>;
|
|
84
|
+
};
|
|
85
|
+
event: {
|
|
86
|
+
widget: Record<string, ProjectInteraction[]>;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface OAuthConfig {
|
|
2
|
+
authorizeConfig: {
|
|
3
|
+
url: string;
|
|
4
|
+
queryParams: Record<string, string>;
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
exchangeConfig: {
|
|
8
|
+
url: string;
|
|
9
|
+
queryParams?: Record<string, string>;
|
|
10
|
+
body?: Record<string, string>;
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -1,30 +1,61 @@
|
|
|
1
1
|
import { VevProps } from './vev-props';
|
|
2
|
-
|
|
2
|
+
import { OAuthConfig } from './oauth';
|
|
3
|
+
type KeyPart = string | number | bigint | boolean | symbol;
|
|
4
|
+
export type EditorPluginKvKey = KeyPart[];
|
|
5
|
+
interface EditorPluginKvCommitResult {
|
|
6
|
+
ok: true;
|
|
7
|
+
versionstamp: string;
|
|
8
|
+
}
|
|
9
|
+
interface EditorPluginKvEntry<T> {
|
|
10
|
+
key: EditorPluginKvKey;
|
|
11
|
+
value: T;
|
|
12
|
+
versionstamp: string;
|
|
13
|
+
}
|
|
14
|
+
export interface EditorPluginKv {
|
|
15
|
+
set: (key: EditorPluginKvKey, value: unknown) => Promise<EditorPluginKvCommitResult>;
|
|
16
|
+
get: <T>(key: EditorPluginKvKey) => Promise<EditorPluginKvEntry<T>>;
|
|
17
|
+
delete: (key: EditorPluginKvKey) => Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export interface EditorPluginSettings {
|
|
20
|
+
form: VevProps[];
|
|
21
|
+
}
|
|
22
|
+
export interface EditorPluginAssetSourceResult {
|
|
3
23
|
images?: {
|
|
24
|
+
key: string;
|
|
4
25
|
name: string;
|
|
5
26
|
url: string;
|
|
6
27
|
thumb: string;
|
|
7
|
-
|
|
28
|
+
metadata?: Record<string, string>;
|
|
8
29
|
}[];
|
|
9
30
|
videos?: {
|
|
31
|
+
key: string;
|
|
10
32
|
name: string;
|
|
11
33
|
url: string;
|
|
12
34
|
thumb: string;
|
|
13
|
-
|
|
35
|
+
metadata: Record<string, string>;
|
|
14
36
|
}[];
|
|
15
37
|
shapes?: {
|
|
38
|
+
key: string;
|
|
16
39
|
name: string;
|
|
17
40
|
url: string;
|
|
18
41
|
thumb: string;
|
|
19
|
-
|
|
42
|
+
metadata: Record<string, string>;
|
|
20
43
|
}[];
|
|
21
44
|
}
|
|
22
|
-
export
|
|
23
|
-
|
|
45
|
+
export declare enum EditorPluginType {
|
|
46
|
+
ASSET_SOURCE = "asset-source"
|
|
47
|
+
}
|
|
48
|
+
export interface EditorPlugin<T> {
|
|
24
49
|
id: string;
|
|
25
50
|
name: string;
|
|
51
|
+
type: EditorPluginType;
|
|
26
52
|
form: VevProps[];
|
|
27
|
-
handler: (request: Request, env: Record<string, string
|
|
53
|
+
handler: (request: Request, env: Record<string, string>, kv: EditorPluginKv) => Promise<T | EditorPluginSettings>;
|
|
28
54
|
icon?: string;
|
|
55
|
+
oauthConfig?: OAuthConfig;
|
|
56
|
+
}
|
|
57
|
+
export interface EditorPluginAssetSource extends EditorPlugin<EditorPluginAssetSourceResult> {
|
|
58
|
+
type: EditorPluginType.ASSET_SOURCE;
|
|
29
59
|
}
|
|
30
|
-
export type VevPluginType =
|
|
60
|
+
export type VevPluginType = EditorPluginAssetSource;
|
|
61
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vev/silke",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
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.5",
|
|
36
|
+
"@vev/utils": "1.2.2",
|
|
37
37
|
"classnames": ">=2.2.0",
|
|
38
38
|
"flux": "^4.0.4",
|
|
39
39
|
"lodash": "^4.17.21",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"react-live": "^2.4.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/project-name-generator": "^2"
|
|
46
|
+
"@types/project-name-generator": "^2",
|
|
47
|
+
"cross-env": "^7.0.3"
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
.root {
|
|
3
3
|
cursor: pointer;
|
|
4
4
|
user-select: none;
|
|
5
|
+
|
|
5
6
|
&:hover,
|
|
6
|
-
&.ghost,
|
|
7
7
|
&.open {
|
|
8
|
-
.downIcon
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
.downIcon{
|
|
9
|
+
color: var(--color-neutral-100);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
&:hover:not(.open){
|
|
13
|
+
.arrow{
|
|
14
|
+
padding-top: 4px;
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
17
|
|
|
@@ -17,6 +21,10 @@
|
|
|
17
21
|
--text-field-focus-border-color: transparent;
|
|
18
22
|
}
|
|
19
23
|
|
|
24
|
+
.placeholder {
|
|
25
|
+
color: var(--text-field-disabled-placeholder-color);
|
|
26
|
+
font-size: var(--text-field-font-size);
|
|
27
|
+
}
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
.autocompleteItem {
|
|
@@ -28,19 +36,24 @@
|
|
|
28
36
|
outline: none;
|
|
29
37
|
border: none;
|
|
30
38
|
font-size: 0.845em;
|
|
39
|
+
color: var(--color-neutral-70);
|
|
31
40
|
// opacity: 0;
|
|
32
41
|
transform: translateY(0);
|
|
33
42
|
// color: var(--text-field-placeholder-color);
|
|
34
43
|
transition: opacity 0.5s ease-in-out, transform 0.3s ease-out;
|
|
35
44
|
}
|
|
36
45
|
|
|
37
|
-
.placeholder {
|
|
38
|
-
color: var(--text-field-disabled-placeholder-color);
|
|
39
|
-
font-size: var(--text-field-font-size);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
46
|
.hiddenSearch{
|
|
43
47
|
width:0;height:0;
|
|
44
48
|
overflow: hidden;
|
|
45
49
|
opacity: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.arrow {
|
|
53
|
+
transition: padding-top 0.2s ease-out, color 0.2s ease-out;
|
|
54
|
+
height: 100%;
|
|
55
|
+
width: 16px;
|
|
56
|
+
i {
|
|
57
|
+
font-size: 10px !important;
|
|
58
|
+
}
|
|
46
59
|
}
|
|
@@ -156,7 +156,6 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
156
156
|
renderTags: TagsRender = AutocompleteTags,
|
|
157
157
|
sort = sorter,
|
|
158
158
|
label,
|
|
159
|
-
inlineLabelWidth,
|
|
160
159
|
inline,
|
|
161
160
|
flex,
|
|
162
161
|
anchorOrigin,
|
|
@@ -166,6 +165,8 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
166
165
|
dropDownMinWidth,
|
|
167
166
|
tabIndex,
|
|
168
167
|
onSearch,
|
|
168
|
+
onClick,
|
|
169
|
+
onMouseDown,
|
|
169
170
|
hAlign,
|
|
170
171
|
...form
|
|
171
172
|
} = useFormField(props, autocompleteValidator);
|
|
@@ -456,7 +457,6 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
456
457
|
<SilkeTextFieldOutline
|
|
457
458
|
ref={containerRef}
|
|
458
459
|
inline={inline}
|
|
459
|
-
inlineLabelWidth={inlineLabelWidth}
|
|
460
460
|
size={size}
|
|
461
461
|
flex={flex}
|
|
462
462
|
label={label}
|
|
@@ -470,10 +470,11 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
470
470
|
data-cy={dataCy}
|
|
471
471
|
labelId={inputId}
|
|
472
472
|
labelUsingAria
|
|
473
|
-
|
|
473
|
+
onClick={onClick}
|
|
474
|
+
onMouseDown={(e: React.MouseEvent<HTMLElement>) => {
|
|
474
475
|
e.preventDefault();
|
|
475
476
|
e.stopPropagation();
|
|
476
|
-
|
|
477
|
+
onMouseDown?.(e);
|
|
477
478
|
!context.readOnly &&
|
|
478
479
|
setOpen((wasOpen) => {
|
|
479
480
|
return !wasOpen;
|
|
@@ -483,7 +484,6 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
483
484
|
{before}
|
|
484
485
|
|
|
485
486
|
<SilkeTextFieldItem
|
|
486
|
-
hPad={size === 'xs' ? 'xs' : 's'}
|
|
487
487
|
minHeight={boxSize}
|
|
488
488
|
vAlign="center"
|
|
489
489
|
tag="button"
|
|
@@ -496,6 +496,7 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
496
496
|
data-cy={form['data-cy']}
|
|
497
497
|
tabIndex={tabIndex}
|
|
498
498
|
style={{
|
|
499
|
+
padding: size === 'xs' || size === 's' ? 2 : undefined,
|
|
499
500
|
paddingLeft: selectedIcon || selectedImage ? 0 : undefined,
|
|
500
501
|
flex: kind !== 'ghost' && kind !== 'zombie' ? undefined : 'none',
|
|
501
502
|
maxWidth: `calc(100% - ${size === 'xs' ? 16 : 24}px)`,
|
|
@@ -524,13 +525,13 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
524
525
|
) : (
|
|
525
526
|
<>
|
|
526
527
|
{selectedImage && (
|
|
527
|
-
<SilkeBox
|
|
528
|
+
<SilkeBox width={dropDownSize} align="center" hPad="xs">
|
|
528
529
|
<SilkeIcon icon={{ type: EmojiType.upload, value: { url: selectedImage } }} />
|
|
529
530
|
</SilkeBox>
|
|
530
531
|
)}
|
|
531
532
|
|
|
532
533
|
{selectedIcon && (
|
|
533
|
-
<SilkeBox
|
|
534
|
+
<SilkeBox width={dropDownSize} align="center" hPad="xs">
|
|
534
535
|
<SilkeIcon icon={selectedIcon} />
|
|
535
536
|
</SilkeBox>
|
|
536
537
|
)}
|
|
@@ -559,8 +560,8 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
559
560
|
<SilkeIcon icon="close" />
|
|
560
561
|
</SilkeBox>
|
|
561
562
|
) : !hideListArrow ? (
|
|
562
|
-
<SilkeBox
|
|
563
|
-
<SilkeIcon icon={open ? 'up' : 'down'} />
|
|
563
|
+
<SilkeBox align="center" className={styles.arrow}>
|
|
564
|
+
<SilkeIcon icon={open ? 'chevron.up' : 'chevron.down'} />
|
|
564
565
|
</SilkeBox>
|
|
565
566
|
) : null;
|
|
566
567
|
})()}
|
|
@@ -647,6 +648,7 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
647
648
|
multiple={form.multiple}
|
|
648
649
|
onMouseDown={(e) => {
|
|
649
650
|
e.preventDefault();
|
|
651
|
+
e.stopPropagation();
|
|
650
652
|
if (!item.divider && !item.disabled) handleSelect(item, i);
|
|
651
653
|
}}
|
|
652
654
|
/>
|
|
@@ -654,7 +656,7 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
654
656
|
)}
|
|
655
657
|
{onAdd && searchText && (
|
|
656
658
|
<AutocompleteItem
|
|
657
|
-
size={
|
|
659
|
+
size={boxSize}
|
|
658
660
|
highlight={!displayedItems.length}
|
|
659
661
|
item={{
|
|
660
662
|
label: `+ Add item "${searchText}"`,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Layout box
|
|
2
2
|
|
|
3
3
|
```jsx
|
|
4
|
-
<SilkeBox gap
|
|
4
|
+
<SilkeBox gap>
|
|
5
5
|
<SilkeButton label="Buttons in a row" />
|
|
6
6
|
<SilkeButton label="Buttons in a row" />
|
|
7
7
|
</SilkeBox>
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
```jsx
|
|
11
|
-
<SilkeBox gap
|
|
11
|
+
<SilkeBox gap column>
|
|
12
12
|
<SilkeButton label="Buttons in a column" />
|
|
13
13
|
<SilkeButton label="Buttons in a column" />
|
|
14
14
|
</SilkeBox>
|
|
@@ -58,7 +58,7 @@ type BaseProps = {
|
|
|
58
58
|
/** Width of the box (x2 of the spaceing, example: 'm' = 32px wide) */
|
|
59
59
|
minWidth?: BoxSize;
|
|
60
60
|
/** Background color */
|
|
61
|
-
bg?: SilkeColor;
|
|
61
|
+
bg?: SilkeColor | 'blur';
|
|
62
62
|
/** Background color on hover */
|
|
63
63
|
bgHover?: SilkeColor;
|
|
64
64
|
/** Text color */
|
|
@@ -79,7 +79,6 @@ type BaseProps = {
|
|
|
79
79
|
flex?: boolean;
|
|
80
80
|
/** Wrap items */
|
|
81
81
|
wrap?: boolean;
|
|
82
|
-
/** HTML tag typeTag type */
|
|
83
82
|
/** Align content of box, use array to define separat for x and y axis */
|
|
84
83
|
align?: BoxAlign | [BoxAlign, BoxAlign];
|
|
85
84
|
vAlign?: BoxAlign;
|
|
@@ -124,8 +124,8 @@ body {
|
|
|
124
124
|
&.ghost {
|
|
125
125
|
--silke-button-color: var(--color-neutral-90);
|
|
126
126
|
--silke-button-color-hover: var(--color-neutral-100);
|
|
127
|
-
--silke-button-background-hover:
|
|
128
|
-
--silke-button-background-pressed:
|
|
127
|
+
--silke-button-background-hover: var(--color-surface-2);
|
|
128
|
+
--silke-button-background-pressed: var(--color-surface-3);
|
|
129
129
|
|
|
130
130
|
--silke-button-color-disabled: var(--color-neutral-40);
|
|
131
131
|
--silke-button-background-disabled:transparent;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BoxDivProps, SilkeBox } from '../silke-box';
|
|
3
|
-
import { SilkeSkeleton } from '../silke-skeleton';
|
|
4
3
|
import styles from './silke-card.scss';
|
|
5
|
-
import {
|
|
6
|
-
import { SilkeText } from '../silke-text';
|
|
4
|
+
import { ButtonContext } from '../silke-button';
|
|
7
5
|
|
|
8
6
|
type SilkeCardGridProps = {
|
|
9
7
|
children: React.ReactNode;
|
|
@@ -12,6 +12,7 @@ body {
|
|
|
12
12
|
width: 100%;
|
|
13
13
|
color: var(--color-neutral-100);
|
|
14
14
|
cursor: pointer;
|
|
15
|
+
gap: 8px;
|
|
15
16
|
|
|
16
17
|
&.colorBackdrop {
|
|
17
18
|
.img {
|
|
@@ -23,6 +24,10 @@ body {
|
|
|
23
24
|
border-radius: var(--border-radius-tiny);
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
.tags {
|
|
28
|
+
translate: 0 10px;
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
&:hover,
|
|
27
32
|
&:focus-visible {
|
|
28
33
|
&.hasTags {
|
|
@@ -93,6 +98,11 @@ body {
|
|
|
93
98
|
.imageWrapper {
|
|
94
99
|
aspect-ratio: var(--silke-card-aspect-ratio);
|
|
95
100
|
border-radius: var(--silke-card-border-radius);
|
|
101
|
+
img {
|
|
102
|
+
/** Prevent dragging of image */
|
|
103
|
+
user-select: none;
|
|
104
|
+
pointer-events: none;
|
|
105
|
+
}
|
|
96
106
|
}
|
|
97
107
|
.overflowMenu,
|
|
98
108
|
.checkbox,
|
|
@@ -109,7 +119,6 @@ body {
|
|
|
109
119
|
}
|
|
110
120
|
|
|
111
121
|
.tags {
|
|
112
|
-
translate: 0 10px;
|
|
113
122
|
position: absolute;
|
|
114
123
|
bottom: 8px;
|
|
115
124
|
left: 8px;
|
|
@@ -124,6 +133,11 @@ body {
|
|
|
124
133
|
}
|
|
125
134
|
}
|
|
126
135
|
|
|
136
|
+
.cardText .title {
|
|
137
|
+
font-family: "Aeonik", "Source Sans Pro", sans-serif;
|
|
138
|
+
line-height: 1;
|
|
139
|
+
}
|
|
140
|
+
|
|
127
141
|
.grid {
|
|
128
142
|
--max-columns: 10;
|
|
129
143
|
--grid-gap: 24px;
|
|
@@ -139,13 +153,24 @@ body {
|
|
|
139
153
|
);
|
|
140
154
|
|
|
141
155
|
&.small {
|
|
142
|
-
--silke-card-border-radius:
|
|
156
|
+
--silke-card-border-radius: 8px;
|
|
143
157
|
--min-card-width: 108px;
|
|
144
158
|
--grid-gap: 16px;
|
|
145
159
|
--silke-card-aspect-ratio: 4/3;
|
|
160
|
+
.card {
|
|
161
|
+
gap: 4px;
|
|
162
|
+
}
|
|
146
163
|
.cardText {
|
|
164
|
+
gap: 2px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.title{
|
|
168
|
+
font-family: "Source Sans Pro", sans-serif;
|
|
147
169
|
font-size: 12px;
|
|
148
|
-
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.subTitle {
|
|
173
|
+
font-size: 10px !important;
|
|
149
174
|
}
|
|
150
175
|
}
|
|
151
176
|
}
|
|
@@ -9,6 +9,7 @@ import { SilkeOverflowMenu, SilkeOverflowMenuItem } from '../silke-overflow-menu
|
|
|
9
9
|
import { SilkeTag, SilkeTagProps } from '../silke-tag';
|
|
10
10
|
import { SilkeText } from '../silke-text';
|
|
11
11
|
import styles from './silke-card.scss';
|
|
12
|
+
import { SilkeButton } from '../silke-button';
|
|
12
13
|
|
|
13
14
|
type SilkeCardProps = {
|
|
14
15
|
title: React.ReactNode;
|
|
@@ -26,6 +27,8 @@ type SilkeCardProps = {
|
|
|
26
27
|
|
|
27
28
|
checked?: boolean;
|
|
28
29
|
onCheck?: (checked: boolean) => void;
|
|
30
|
+
/** Shows info icon in label */
|
|
31
|
+
onMore?: () => void;
|
|
29
32
|
|
|
30
33
|
/**
|
|
31
34
|
* Show overflow menu above menu button
|
|
@@ -53,6 +56,7 @@ export const SilkeCard = React.forwardRef(
|
|
|
53
56
|
checked,
|
|
54
57
|
selected,
|
|
55
58
|
onCheck,
|
|
59
|
+
onMore,
|
|
56
60
|
...rest
|
|
57
61
|
}: SilkeCardProps,
|
|
58
62
|
cardRef,
|
|
@@ -72,7 +76,6 @@ export const SilkeCard = React.forwardRef(
|
|
|
72
76
|
to={link}
|
|
73
77
|
ref={cardRef}
|
|
74
78
|
column
|
|
75
|
-
gap="s"
|
|
76
79
|
tabIndex={rest.onClick ? 1 : undefined}
|
|
77
80
|
aria-label={rest.onClick && isString(title) ? title : undefined}
|
|
78
81
|
className={cl}
|
|
@@ -82,7 +85,7 @@ export const SilkeCard = React.forwardRef(
|
|
|
82
85
|
}}
|
|
83
86
|
{...(rest as any)}
|
|
84
87
|
>
|
|
85
|
-
<SilkeBox className={styles.imageWrapper} overflow="hidden" column>
|
|
88
|
+
<SilkeBox className={styles.imageWrapper} overflow="hidden" column bg="surface-1">
|
|
86
89
|
{image &&
|
|
87
90
|
(isArray(image) ? (
|
|
88
91
|
<CardImageFolder images={image} />
|
|
@@ -117,7 +120,12 @@ export const SilkeCard = React.forwardRef(
|
|
|
117
120
|
))}
|
|
118
121
|
|
|
119
122
|
{onCheck && (
|
|
120
|
-
<SilkeBox
|
|
123
|
+
<SilkeBox
|
|
124
|
+
className={styles.checkbox}
|
|
125
|
+
rounded="tiny"
|
|
126
|
+
onClick={(e: React.MouseEvent) => e.stopPropagation()}
|
|
127
|
+
onMouseDown={(e: React.MouseEvent) => e.stopPropagation()}
|
|
128
|
+
>
|
|
121
129
|
<SilkeCheckbox value={checked} onChange={onCheck} />
|
|
122
130
|
</SilkeBox>
|
|
123
131
|
)}
|
|
@@ -138,24 +146,34 @@ export const SilkeCard = React.forwardRef(
|
|
|
138
146
|
)}
|
|
139
147
|
</SilkeBox>
|
|
140
148
|
<SilkeBox gap="m" column flex>
|
|
141
|
-
<SilkeBox>
|
|
142
|
-
<SilkeBox flex column overflow="hidden" gap="xs">
|
|
143
|
-
<SilkeText size="base"
|
|
149
|
+
<SilkeBox vAlign="center">
|
|
150
|
+
<SilkeBox flex column overflow="hidden" gap="xs" className={styles.cardText}>
|
|
151
|
+
<SilkeText size="base" flex overflow className={styles.title}>
|
|
144
152
|
{title}
|
|
145
153
|
</SilkeText>
|
|
146
154
|
{subTitle && (
|
|
147
|
-
<SilkeText size="small" color="neutral-70">
|
|
155
|
+
<SilkeText size="small" tag="small" color="neutral-70" className={styles.subTitle}>
|
|
148
156
|
{subTitle}
|
|
149
157
|
</SilkeText>
|
|
150
158
|
)}
|
|
151
159
|
</SilkeBox>
|
|
152
|
-
|
|
160
|
+
{onMore && (
|
|
161
|
+
<SilkeButton
|
|
162
|
+
size="s"
|
|
163
|
+
className={styles.overflowMenu}
|
|
164
|
+
icon="tooltip"
|
|
165
|
+
onClick={(e) => {
|
|
166
|
+
e.stopPropagation();
|
|
167
|
+
onMore();
|
|
168
|
+
}}
|
|
169
|
+
/>
|
|
170
|
+
)}
|
|
153
171
|
{menu && (
|
|
154
172
|
<SilkeOverflowMenu
|
|
155
173
|
tabIndex={-1}
|
|
174
|
+
size="s"
|
|
156
175
|
className={styles.overflowMenu}
|
|
157
176
|
items={menu}
|
|
158
|
-
size="s"
|
|
159
177
|
data-testid="overflow-menu"
|
|
160
178
|
targetOrigin={overflowMenuAbove ? 'bottom-right' : 'top-right'}
|
|
161
179
|
anchorOrigin={overflowMenuAbove ? 'top-right' : 'bottom-right'}
|
|
@@ -45,10 +45,10 @@ export const SilkeCodeSnippet = ({
|
|
|
45
45
|
style={{ ...style, ...inlineStyle, whiteSpace: noWrap ? 'pre' : 'pre-wrap' }}
|
|
46
46
|
>
|
|
47
47
|
{tokens.map((line, i) => (
|
|
48
|
-
<div {...getLineProps({ line, key: i })} key={i}>
|
|
48
|
+
<div {...(getLineProps({ line, key: i }) as any)} key={i}>
|
|
49
49
|
{lineNumbers && <span className={styles.lineNumber}>{i + 1}</span>}
|
|
50
50
|
{line.map((token, key) => (
|
|
51
|
-
<span {...getTokenProps({ token, key })} key={key} />
|
|
51
|
+
<span {...(getTokenProps({ token, key }) as any)} key={key} />
|
|
52
52
|
))}
|
|
53
53
|
</div>
|
|
54
54
|
))}
|
|
@@ -25,9 +25,11 @@ const ImageField = ({ value, schema, onChange }: SchemaFieldProps<ImageFieldType
|
|
|
25
25
|
}, [onChange, actions]);
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<SilkeBox column flex vPad="s">
|
|
28
|
+
<SilkeBox column flex vPad="s" gap="s">
|
|
29
29
|
<SilkeTextSmall>{getTitle(schema)}</SilkeTextSmall>
|
|
30
|
-
{schema.description &&
|
|
30
|
+
{schema.description && (
|
|
31
|
+
<SilkeTextSmall color="neutral-80">{schema.description}</SilkeTextSmall>
|
|
32
|
+
)}
|
|
31
33
|
<SilkeBox column>
|
|
32
34
|
<SilkeImage
|
|
33
35
|
aspectRatio="16:9"
|
|
@@ -76,15 +76,13 @@ const SelectField = (props: SchemaFieldProps<LinkFieldType>) => {
|
|
|
76
76
|
<SilkeBox column gap="s" flex>
|
|
77
77
|
<SilkeAutocompleteField
|
|
78
78
|
help={'Search pages or add an external link'}
|
|
79
|
+
label={getTitle(schema)}
|
|
79
80
|
value={getValue(value)}
|
|
80
81
|
name={schema.name}
|
|
81
|
-
label={getTitle(schema)}
|
|
82
82
|
items={items}
|
|
83
83
|
onChange={(val: string) => handleAddPageLink(val)}
|
|
84
84
|
onAdd={(val: string) => handleAddLink(val)}
|
|
85
85
|
size="xs"
|
|
86
|
-
inline
|
|
87
|
-
inlineLabelWidth={80}
|
|
88
86
|
renderItem={(item) => {
|
|
89
87
|
return (
|
|
90
88
|
<SilkeText style={{ paddingLeft: '4px' }} size="small" title={item.item.label} overflow>
|
|
@@ -94,9 +92,7 @@ const SelectField = (props: SchemaFieldProps<LinkFieldType>) => {
|
|
|
94
92
|
}}
|
|
95
93
|
/>
|
|
96
94
|
<SilkeBox>
|
|
97
|
-
<SilkeTextSmall
|
|
98
|
-
Open in new tab
|
|
99
|
-
</SilkeTextSmall>
|
|
95
|
+
<SilkeTextSmall flex>Open in new tab</SilkeTextSmall>
|
|
100
96
|
<SilkeToggle
|
|
101
97
|
small
|
|
102
98
|
value={target}
|