@vev/silke 1.0.31 → 1.1.1
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 +17 -0
- package/dist/index.js +22 -22
- package/dist/styles.css +49 -49
- package/dist/types/components/silke-conditions-input/utils.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/audio-field.d.ts +3 -0
- package/dist/types/components/silke-gradient-picker/silke-gradient-picker.d.ts +2 -5
- package/dist/types/icons.d.ts +7 -0
- package/jest.config.js +1 -0
- package/package.json +5 -29
- package/project.json +0 -9
- package/src/components/silke-autocomplete-field/autocomplete-item.tsx +1 -0
- package/src/components/silke-card/silke-card.tsx +12 -1
- package/src/components/silke-css-number-field/silke-css-number-field.tsx +2 -1
- package/src/components/silke-form-schema/fields/audio-field.tsx +77 -0
- package/src/components/silke-form-schema/fields/select-field.tsx +1 -1
- package/src/components/silke-form-schema/silke-schema-field.tsx +2 -3
- package/src/components/silke-gradient-picker/silke-gradient-picker.tsx +33 -16
- package/src/components/silke-icon-picker/icons-tab.tsx +1 -1
- package/src/icons.tsx +44 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/docs/app.d.ts +0 -3
- package/dist/types/docs/components/code-block/code-block.d.ts +0 -5
- package/dist/types/docs/components/code-block/index.d.ts +0 -1
- package/dist/types/docs/components/state-table/index.d.ts +0 -1
- package/dist/types/docs/components/state-table/state-table.d.ts +0 -13
- package/dist/types/docs/data/app/actions.d.ts +0 -1
- package/dist/types/docs/data/app/constants.d.ts +0 -5
- package/dist/types/docs/data/app/index.d.ts +0 -3
- package/dist/types/docs/data/app/store.d.ts +0 -8
- package/dist/types/docs/data/flux/action-decorator.d.ts +0 -5
- package/dist/types/docs/data/flux/action-utils.d.ts +0 -7
- package/dist/types/docs/data/flux/controller.d.ts +0 -24
- package/dist/types/docs/data/flux/dispatcher.d.ts +0 -7
- package/dist/types/docs/data/flux/index.d.ts +0 -6
- package/dist/types/docs/data/flux/store.d.ts +0 -15
- package/dist/types/docs/data/flux/use-store.d.ts +0 -2
- package/dist/types/docs/docs-provider.d.ts +0 -6
- package/dist/types/docs/index.d.ts +0 -2
- package/dist/types/docs/ipsum-generator.d.ts +0 -7
- package/dist/types/docs/parser.d.ts +0 -0
- package/dist/types/main.d.ts +0 -1
- package/public/index.html +0 -23
- package/src/docs/app.tsx +0 -166
- package/src/docs/components/code-block/code-block.scss +0 -15
- package/src/docs/components/code-block/code-block.tsx +0 -55
- package/src/docs/components/code-block/index.ts +0 -1
- package/src/docs/components/state-table/index.ts +0 -1
- package/src/docs/components/state-table/state-table.scss +0 -10
- package/src/docs/components/state-table/state-table.tsx +0 -57
- package/src/docs/data/app/actions.ts +0 -17
- package/src/docs/data/app/constants.ts +0 -5
- package/src/docs/data/app/index.ts +0 -3
- package/src/docs/data/app/store.ts +0 -14
- package/src/docs/data/flux/action-decorator.ts +0 -16
- package/src/docs/data/flux/action-utils.ts +0 -19
- package/src/docs/data/flux/controller.ts +0 -76
- package/src/docs/data/flux/dispatcher.ts +0 -79
- package/src/docs/data/flux/index.ts +0 -10
- package/src/docs/data/flux/store.ts +0 -44
- package/src/docs/data/flux/use-store.ts +0 -57
- package/src/docs/docs-provider.tsx +0 -24
- package/src/docs/index.ts +0 -3
- package/src/docs/ipsum-generator.tsx +0 -86
- package/src/docs/parser.ts +0 -1345
- package/src/index.mdx +0 -69
- package/src/main.tsx +0 -11
- package/src/playground.mdx +0 -65
- package/webpack.docs.ts +0 -248
package/dist/styles.css
CHANGED
|
@@ -2501,55 +2501,6 @@ img.silke-icon_icon_84f9e9d6b3 {
|
|
|
2501
2501
|
* Get font size base on base font size
|
|
2502
2502
|
* scaling = round(size * 1.200) (Minor Third)
|
|
2503
2503
|
*/
|
|
2504
|
-
.silke-code-snippet_main_4e986d6b6d {
|
|
2505
|
-
position: relative;
|
|
2506
|
-
flex-direction: column;
|
|
2507
|
-
background: var(--color-neutral-0);
|
|
2508
|
-
}
|
|
2509
|
-
.silke-code-snippet_main_4e986d6b6d pre {
|
|
2510
|
-
width: 100%;
|
|
2511
|
-
margin: 0;
|
|
2512
|
-
padding: 8px;
|
|
2513
|
-
word-break: break-word;
|
|
2514
|
-
}
|
|
2515
|
-
.silke-code-snippet_main_4e986d6b6d:hover .silke-code-snippet_buttons_4e986d6b6d {
|
|
2516
|
-
opacity: 1;
|
|
2517
|
-
}
|
|
2518
|
-
|
|
2519
|
-
.silke-code-snippet_buttons_4e986d6b6d {
|
|
2520
|
-
position: absolute;
|
|
2521
|
-
bottom: 8px;
|
|
2522
|
-
right: 8px;
|
|
2523
|
-
opacity: 0.5;
|
|
2524
|
-
align-items: flex-end;
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
.silke-code-snippet_lineNumber_4e986d6b6d {
|
|
2528
|
-
display: inline-block;
|
|
2529
|
-
color: gray;
|
|
2530
|
-
width: 30px;
|
|
2531
|
-
font-size: 14px;
|
|
2532
|
-
padding: 0 5px;
|
|
2533
|
-
-webkit-user-select: none;
|
|
2534
|
-
-moz-user-select: none;
|
|
2535
|
-
user-select: none;
|
|
2536
|
-
}
|
|
2537
|
-
/**********************
|
|
2538
|
-
* SOME MATH
|
|
2539
|
-
************************/
|
|
2540
|
-
/**********************
|
|
2541
|
-
* FONT
|
|
2542
|
-
************************/
|
|
2543
|
-
/**********************
|
|
2544
|
-
* SPACING
|
|
2545
|
-
************************/
|
|
2546
|
-
/**********************
|
|
2547
|
-
* SIZES
|
|
2548
|
-
************************/
|
|
2549
|
-
/**
|
|
2550
|
-
* Get font size base on base font size
|
|
2551
|
-
* scaling = round(size * 1.200) (Minor Third)
|
|
2552
|
-
*/
|
|
2553
2504
|
.silke-link {
|
|
2554
2505
|
text-decoration: underline;
|
|
2555
2506
|
cursor: pointer;
|
|
@@ -2600,6 +2551,55 @@ button.silke-link {
|
|
|
2600
2551
|
* Get font size base on base font size
|
|
2601
2552
|
* scaling = round(size * 1.200) (Minor Third)
|
|
2602
2553
|
*/
|
|
2554
|
+
.silke-code-snippet_main_4e986d6b6d {
|
|
2555
|
+
position: relative;
|
|
2556
|
+
flex-direction: column;
|
|
2557
|
+
background: var(--color-neutral-0);
|
|
2558
|
+
}
|
|
2559
|
+
.silke-code-snippet_main_4e986d6b6d pre {
|
|
2560
|
+
width: 100%;
|
|
2561
|
+
margin: 0;
|
|
2562
|
+
padding: 8px;
|
|
2563
|
+
word-break: break-word;
|
|
2564
|
+
}
|
|
2565
|
+
.silke-code-snippet_main_4e986d6b6d:hover .silke-code-snippet_buttons_4e986d6b6d {
|
|
2566
|
+
opacity: 1;
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
.silke-code-snippet_buttons_4e986d6b6d {
|
|
2570
|
+
position: absolute;
|
|
2571
|
+
bottom: 8px;
|
|
2572
|
+
right: 8px;
|
|
2573
|
+
opacity: 0.5;
|
|
2574
|
+
align-items: flex-end;
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
.silke-code-snippet_lineNumber_4e986d6b6d {
|
|
2578
|
+
display: inline-block;
|
|
2579
|
+
color: gray;
|
|
2580
|
+
width: 30px;
|
|
2581
|
+
font-size: 14px;
|
|
2582
|
+
padding: 0 5px;
|
|
2583
|
+
-webkit-user-select: none;
|
|
2584
|
+
-moz-user-select: none;
|
|
2585
|
+
user-select: none;
|
|
2586
|
+
}
|
|
2587
|
+
/**********************
|
|
2588
|
+
* SOME MATH
|
|
2589
|
+
************************/
|
|
2590
|
+
/**********************
|
|
2591
|
+
* FONT
|
|
2592
|
+
************************/
|
|
2593
|
+
/**********************
|
|
2594
|
+
* SPACING
|
|
2595
|
+
************************/
|
|
2596
|
+
/**********************
|
|
2597
|
+
* SIZES
|
|
2598
|
+
************************/
|
|
2599
|
+
/**
|
|
2600
|
+
* Get font size base on base font size
|
|
2601
|
+
* scaling = round(size * 1.200) (Minor Third)
|
|
2602
|
+
*/
|
|
2603
2603
|
.silke-sortable-list_item_cdeed952d0 [data-drag-handle] {
|
|
2604
2604
|
cursor: grab;
|
|
2605
2605
|
}
|
|
@@ -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" | "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" | undefined;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { FormFieldProps } from '../silke-form';
|
|
2
|
-
type SilkeGradientPickerProps = FormFieldProps<string
|
|
3
|
-
|
|
4
|
-
hidePalettes?: boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare function SilkeGradientPicker({ hideSwatches, hidePalettes, ...props }: SilkeGradientPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
type SilkeGradientPickerProps = FormFieldProps<string>;
|
|
3
|
+
export declare function SilkeGradientPicker({ ...props }: SilkeGradientPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
4
|
export {};
|
package/dist/types/icons.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare const SilkeIconDefinitions: {
|
|
|
32
32
|
remove: string;
|
|
33
33
|
'error.circle': string;
|
|
34
34
|
'warning.triangle': string;
|
|
35
|
+
waveform: string;
|
|
35
36
|
tooltip: string;
|
|
36
37
|
email: string;
|
|
37
38
|
password: string;
|
|
@@ -416,6 +417,9 @@ export declare const SilkeIconDefinitions: {
|
|
|
416
417
|
'animate.in': string;
|
|
417
418
|
'animate.out': string;
|
|
418
419
|
'animate.bold': string;
|
|
420
|
+
'animate.fill-backwards': typeof AnimationFillBackwards;
|
|
421
|
+
'animate.fill-forwards': typeof AnimationFillForwards;
|
|
422
|
+
'animate.fill-both': typeof AnimationFillBoth;
|
|
419
423
|
qwiker: string;
|
|
420
424
|
};
|
|
421
425
|
export declare const StateIcons: {
|
|
@@ -453,4 +457,7 @@ declare function TypescriptIcon(): import("react/jsx-runtime").JSX.Element;
|
|
|
453
457
|
declare function FlipIconVertical(): import("react/jsx-runtime").JSX.Element;
|
|
454
458
|
declare function FlipIconHorizontal(): import("react/jsx-runtime").JSX.Element;
|
|
455
459
|
declare function ContentChildParent(): import("react/jsx-runtime").JSX.Element;
|
|
460
|
+
declare function AnimationFillBackwards(): import("react/jsx-runtime").JSX.Element;
|
|
461
|
+
declare function AnimationFillForwards(): import("react/jsx-runtime").JSX.Element;
|
|
462
|
+
declare function AnimationFillBoth(): import("react/jsx-runtime").JSX.Element;
|
|
456
463
|
export {};
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vev/silke",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start": "yarn start:docs",
|
|
9
|
-
"start:docs": "cross-env TS_NODE_PROJECT=\"../../tsconfig.json\" webpack serve --env development --config ./webpack.docs.ts",
|
|
10
8
|
"build": "yarn clean && yarn build:types && yarn build:code",
|
|
11
9
|
"build:code": "node ./esbuild.config.mjs",
|
|
12
|
-
"build:docs": "yarn clean && cross-env TS_NODE_PROJECT=\"../../tsconfig.json\" webpack --env production --config ./webpack.docs.ts",
|
|
13
10
|
"build:types": "tsc --project tsconfig.build.json",
|
|
14
11
|
"clean": "del-cli dist",
|
|
15
12
|
"test": "jest --silent --forceExit --runInBand --passWithNoTests",
|
|
@@ -25,34 +22,13 @@
|
|
|
25
22
|
"react-router-dom": "^7.6.3"
|
|
26
23
|
},
|
|
27
24
|
"dependencies": {
|
|
28
|
-
"@codemirror/lang-css": "^6.0.0",
|
|
29
|
-
"@codemirror/lang-javascript": "^6.1.0",
|
|
30
|
-
"@codemirror/lang-json": "^6.0.0",
|
|
31
|
-
"@mdx-js/loader": "^3.1.0",
|
|
32
|
-
"@mdx-js/mdx": "^3.1.0",
|
|
33
|
-
"@mdx-js/react": "^3.1.0",
|
|
34
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
35
|
-
"@uiw/codemirror-theme-dracula": "^4.12.3",
|
|
36
|
-
"@uiw/react-codemirror": "^4.12.3",
|
|
37
25
|
"@vev/interactions": "*",
|
|
38
|
-
"@vev/react": "
|
|
39
|
-
"@vev/utils": "
|
|
40
|
-
"classnames": ">=2.2.0"
|
|
41
|
-
"dompurify": "^3.2.6",
|
|
42
|
-
"flux": "^4.0.4",
|
|
43
|
-
"lodash": "^4.17.21",
|
|
44
|
-
"prismjs": "^1.27.0",
|
|
45
|
-
"project-name-generator": "^2.1.9",
|
|
46
|
-
"react-live": "^4.1.8"
|
|
26
|
+
"@vev/react": "*",
|
|
27
|
+
"@vev/utils": "*",
|
|
28
|
+
"classnames": ">=2.2.0"
|
|
47
29
|
},
|
|
48
30
|
"devDependencies": {
|
|
49
|
-
"@types/project-name-generator": "^2",
|
|
50
|
-
"cross-env": "^10.0.0",
|
|
51
31
|
"del-cli": "*",
|
|
52
|
-
"jest": "*"
|
|
53
|
-
"typescript": "5.7.3",
|
|
54
|
-
"webpack": "^5.99.9",
|
|
55
|
-
"webpack-cli": "^6.0.1",
|
|
56
|
-
"webpack-dev-server": "^5.2.2"
|
|
32
|
+
"jest": "*"
|
|
57
33
|
}
|
|
58
34
|
}
|
package/project.json
CHANGED
|
@@ -4,15 +4,6 @@
|
|
|
4
4
|
"sourceRoot": "{projectRoot}/src",
|
|
5
5
|
"projectType": "library",
|
|
6
6
|
"targets": {
|
|
7
|
-
"build:docs": {
|
|
8
|
-
"command": "yarn workspace @vev/silke build:docs",
|
|
9
|
-
"dependsOn": [
|
|
10
|
-
"^build"
|
|
11
|
-
],
|
|
12
|
-
"inputs": [
|
|
13
|
-
"default:root"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
7
|
"watch": {
|
|
17
8
|
"command": "yarn workspace @vev/silke watch",
|
|
18
9
|
"dependsOn": ["^build"]
|
|
@@ -49,6 +49,7 @@ export default function AutocompleteItem<T, U extends Entry<T>>({
|
|
|
49
49
|
let iconSize: BoxSize = size || 'm';
|
|
50
50
|
if (size === 'm') iconSize = 'base';
|
|
51
51
|
if (size === 'base') iconSize = 's';
|
|
52
|
+
if (size === 's') iconSize = 'xs';
|
|
52
53
|
|
|
53
54
|
// For items with sublabel we need more space
|
|
54
55
|
let boxSize: BoxSize = size || 'm';
|
|
@@ -38,6 +38,10 @@ type SilkeCardProps = {
|
|
|
38
38
|
// overflowRibbonTooltip?: string;
|
|
39
39
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'children'>;
|
|
40
40
|
|
|
41
|
+
const stopPropagation = (e: React.MouseEvent) => {
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
};
|
|
44
|
+
|
|
41
45
|
export const SilkeCard = React.forwardRef(
|
|
42
46
|
(
|
|
43
47
|
{
|
|
@@ -140,7 +144,14 @@ export const SilkeCard = React.forwardRef(
|
|
|
140
144
|
{(tags || customTags) && (
|
|
141
145
|
<SilkeBox gap="xxs" className={styles.tags}>
|
|
142
146
|
{customTags}
|
|
143
|
-
{tags?.map((tagContent, i) =>
|
|
147
|
+
{tags?.map((tagContent, i) => (
|
|
148
|
+
<SilkeTag
|
|
149
|
+
key={i}
|
|
150
|
+
kind="secondary"
|
|
151
|
+
{...tagContent}
|
|
152
|
+
onClick={tagContent.link ? stopPropagation : tagContent.onClick}
|
|
153
|
+
/>
|
|
154
|
+
))}
|
|
144
155
|
</SilkeBox>
|
|
145
156
|
)}
|
|
146
157
|
</SilkeBox>
|
|
@@ -288,7 +288,8 @@ export function SilkeCssNumberField(props: SilkeCssNumberFieldProps) {
|
|
|
288
288
|
draw();
|
|
289
289
|
};
|
|
290
290
|
|
|
291
|
-
const showFormatsArrow =
|
|
291
|
+
const showFormatsArrow =
|
|
292
|
+
!disabled && !context.readonly && ((formats?.length || 0) > 1 || (options?.length || 0) > 1);
|
|
292
293
|
|
|
293
294
|
let inputCl = styles.field;
|
|
294
295
|
if (showFormatsArrow) inputCl += ' ' + styles.hasFormats;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
|
2
|
+
import { SilkeBox } from '../../silke-box';
|
|
3
|
+
import { SilkeButton } from '../../silke-button';
|
|
4
|
+
import { SilkeText, SilkeTextSmall } from '../../silke-text';
|
|
5
|
+
import { AudioField as AudioFieldType, SchemaFieldProps } from '@vev/utils';
|
|
6
|
+
import { useSchemaContext } from '../silke-schema-context';
|
|
7
|
+
import styles from './styles.scss';
|
|
8
|
+
|
|
9
|
+
import { getTitle } from './utils/schema-util';
|
|
10
|
+
import { SilkeIcon } from '../../silke-icon';
|
|
11
|
+
|
|
12
|
+
const AudioField = ({
|
|
13
|
+
value,
|
|
14
|
+
schema,
|
|
15
|
+
disabled,
|
|
16
|
+
readonly,
|
|
17
|
+
onChange,
|
|
18
|
+
}: SchemaFieldProps<AudioFieldType>) => {
|
|
19
|
+
const { actions } = useSchemaContext();
|
|
20
|
+
const handleDeleteAudio = useCallback(() => {
|
|
21
|
+
onChange(null);
|
|
22
|
+
}, [onChange]);
|
|
23
|
+
|
|
24
|
+
const handleSelectAudio = useCallback(() => {
|
|
25
|
+
if (!actions) return;
|
|
26
|
+
actions.audioLibraryOpen((audio) => {
|
|
27
|
+
if (!audio || !audio.url) return;
|
|
28
|
+
onChange(audio);
|
|
29
|
+
actions.audioLibraryClose();
|
|
30
|
+
});
|
|
31
|
+
}, [onChange, actions]);
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!value) {
|
|
35
|
+
handleSelectAudio();
|
|
36
|
+
}
|
|
37
|
+
}, []);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<SilkeBox column flex vPad="s" gap="s">
|
|
41
|
+
<SilkeTextSmall>{getTitle(schema)}</SilkeTextSmall>
|
|
42
|
+
{schema.description && (
|
|
43
|
+
<SilkeTextSmall color="neutral-80">{schema.description}</SilkeTextSmall>
|
|
44
|
+
)}
|
|
45
|
+
<SilkeBox column>
|
|
46
|
+
<SilkeBox flex align="center" column>
|
|
47
|
+
<SilkeBox pad="m" rounded="small" fill flex align column>
|
|
48
|
+
<SilkeIcon
|
|
49
|
+
color={value ? undefined : 'neutral-40'}
|
|
50
|
+
style={{ fontSize: '2rem' }}
|
|
51
|
+
icon="waveform"
|
|
52
|
+
/>
|
|
53
|
+
<SilkeText>{value ? value.filename : 'No file selected'}</SilkeText>
|
|
54
|
+
</SilkeBox>
|
|
55
|
+
<SilkeBox>
|
|
56
|
+
<SilkeButton
|
|
57
|
+
disabled={disabled || readonly}
|
|
58
|
+
icon="edit"
|
|
59
|
+
kind="ghost"
|
|
60
|
+
onClick={handleSelectAudio}
|
|
61
|
+
/>
|
|
62
|
+
{value?.url && (
|
|
63
|
+
<SilkeButton
|
|
64
|
+
disabled={disabled || readonly}
|
|
65
|
+
icon="delete"
|
|
66
|
+
kind="ghost"
|
|
67
|
+
onClick={handleDeleteAudio}
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
</SilkeBox>
|
|
71
|
+
</SilkeBox>
|
|
72
|
+
</SilkeBox>
|
|
73
|
+
</SilkeBox>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default AudioField;
|
|
@@ -75,7 +75,7 @@ const SelectField = (props: SchemaFieldProps<SelectFieldType>) => {
|
|
|
75
75
|
size="s"
|
|
76
76
|
renderItem={(item) => {
|
|
77
77
|
return (
|
|
78
|
-
<SilkeTextSmall style={{ paddingLeft: '4px' }}
|
|
78
|
+
<SilkeTextSmall style={{ paddingLeft: '4px' }} overflow>
|
|
79
79
|
{item.item.label}
|
|
80
80
|
</SilkeTextSmall>
|
|
81
81
|
);
|
|
@@ -26,6 +26,7 @@ import LayoutField from './fields/layout-field';
|
|
|
26
26
|
import IconField from './fields/icon-field';
|
|
27
27
|
import EventField from './fields/event-field';
|
|
28
28
|
import UploadField from './fields/upload-field';
|
|
29
|
+
import AudioField from './fields/audio-field';
|
|
29
30
|
|
|
30
31
|
type SilkeSchemaFieldProps = {
|
|
31
32
|
field: VevProps;
|
|
@@ -41,6 +42,7 @@ const SCHEMA_FIELD_COMPONENTS: Partial<SchemaFieldComponents> = {
|
|
|
41
42
|
number: NumberField,
|
|
42
43
|
array: ArrayField,
|
|
43
44
|
image: ImageField,
|
|
45
|
+
audio: AudioField,
|
|
44
46
|
video: VideoField,
|
|
45
47
|
boolean: ToggleField,
|
|
46
48
|
object: ObjectField,
|
|
@@ -72,9 +74,6 @@ export function SilkeSchemaField({
|
|
|
72
74
|
const extendedField = extendedFields.find((extField) => extField.type === field?.type);
|
|
73
75
|
if (extendedField) {
|
|
74
76
|
Field = extendedField.field;
|
|
75
|
-
if (field?.type !== 'divider') {
|
|
76
|
-
console.warn(`Could not find field type ${field?.type}`);
|
|
77
|
-
}
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
|
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
import React, { CSSProperties, useState } from 'react';
|
|
2
|
-
import { SilkeBox, SilkeButton, useFormField, useSilkeCSSContext } from '..';
|
|
2
|
+
import { SilkeBox, SilkeButton, SilkeDivider, useFormField, useSilkeCSSContext } from '..';
|
|
3
3
|
import { isVariableV2, SilkeColorPicker } from '../silke-color-picker';
|
|
4
|
+
import { SilkeSwatches } from '../silke-color-swatches';
|
|
4
5
|
import { FormFieldProps } from '../silke-form';
|
|
5
6
|
import { SilkeGradientSlider } from './silke-gradient-slider';
|
|
6
|
-
import {
|
|
7
|
+
import { SilkeGradient, useGradientModel } from './silke-gradient-utils';
|
|
7
8
|
import styles from './silke-gradient-picker.module.scss';
|
|
8
9
|
import { SilkeGradientPosition } from './silke-gradient-position';
|
|
9
10
|
import { isGradient } from '@vev/utils';
|
|
10
11
|
|
|
11
|
-
type SilkeGradientPickerProps = FormFieldProps<string
|
|
12
|
-
hideSwatches?: boolean;
|
|
13
|
-
hidePalettes?: boolean;
|
|
14
|
-
};
|
|
12
|
+
type SilkeGradientPickerProps = FormFieldProps<string>;
|
|
15
13
|
|
|
16
|
-
export function SilkeGradientPicker({
|
|
17
|
-
hideSwatches,
|
|
18
|
-
hidePalettes,
|
|
19
|
-
...props
|
|
20
|
-
}: SilkeGradientPickerProps) {
|
|
14
|
+
export function SilkeGradientPicker({ ...props }: SilkeGradientPickerProps) {
|
|
21
15
|
const { value, onChange } = useFormField(props);
|
|
22
16
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
23
17
|
const { variablesv2 } = useSilkeCSSContext();
|
|
24
18
|
|
|
25
|
-
const variable = variablesv2.find((v) =>
|
|
19
|
+
const variable = variablesv2.find((v) => `var(--vev-${v.key})` === value);
|
|
26
20
|
const gradientValue = variable?.value || value || 'linear-gradient(90deg, #000, #fff)';
|
|
27
21
|
|
|
28
22
|
const [gradient, setGradient] = useGradientModel(gradientValue);
|
|
@@ -39,8 +33,7 @@ export function SilkeGradientPicker({
|
|
|
39
33
|
if (variable) {
|
|
40
34
|
// Check if the variable is a gradient, if so, replace whole gradient with the variable
|
|
41
35
|
if (isGradient(variable.value)) {
|
|
42
|
-
|
|
43
|
-
handleChange(gradient);
|
|
36
|
+
onChange(`var(--vev-${variable.key})`);
|
|
44
37
|
return;
|
|
45
38
|
}
|
|
46
39
|
}
|
|
@@ -60,6 +53,19 @@ export function SilkeGradientPicker({
|
|
|
60
53
|
stops: gradient.stops.map((s) => ({ ...s, position: 1 - s.position })),
|
|
61
54
|
});
|
|
62
55
|
|
|
56
|
+
const handleGradientSwatchSelect = (
|
|
57
|
+
swatchValue: string,
|
|
58
|
+
type: 'color' | 'gradient' | 'variable',
|
|
59
|
+
) => {
|
|
60
|
+
if (type === 'gradient') {
|
|
61
|
+
// Replace entire gradient
|
|
62
|
+
onChange(swatchValue);
|
|
63
|
+
} else {
|
|
64
|
+
// Replace color of current gradient stop
|
|
65
|
+
handleColorChange(swatchValue);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
63
69
|
return (
|
|
64
70
|
<SilkeBox column className={styles.root} style={{ '--index': selectedIndex } as CSSProperties}>
|
|
65
71
|
<SilkeBox gap="s" vAlign="center">
|
|
@@ -90,12 +96,23 @@ export function SilkeGradientPicker({
|
|
|
90
96
|
<SilkeButton size="s" kind="ghost" icon="arrow.left.arrow.right" onClick={handleReverse} />
|
|
91
97
|
<SilkeGradientPosition gradient={gradient} onChange={handleChange} />
|
|
92
98
|
</SilkeBox>
|
|
99
|
+
|
|
93
100
|
<SilkeColorPicker
|
|
94
101
|
value={color}
|
|
102
|
+
hideSwatches
|
|
103
|
+
hidePalettes
|
|
104
|
+
noVariables
|
|
95
105
|
onChange={handleColorChange}
|
|
96
|
-
hidePalettes={hidePalettes}
|
|
97
|
-
hideSwatches={hideSwatches}
|
|
98
106
|
/>
|
|
107
|
+
|
|
108
|
+
<SilkeBox column vPad="s" gap="s">
|
|
109
|
+
<SilkeDivider dark />
|
|
110
|
+
<SilkeSwatches
|
|
111
|
+
selected={value || 'linear-gradient(90deg, #000, #fff)'}
|
|
112
|
+
gradient
|
|
113
|
+
onSelect={handleGradientSwatchSelect}
|
|
114
|
+
/>
|
|
115
|
+
</SilkeBox>
|
|
99
116
|
</SilkeBox>
|
|
100
117
|
);
|
|
101
118
|
}
|
|
@@ -12,7 +12,7 @@ let iconsPromise: Promise<IShape[]>;
|
|
|
12
12
|
|
|
13
13
|
async function fetchIcons(): Promise<IShape[]> {
|
|
14
14
|
if (!iconsPromise) {
|
|
15
|
-
iconsPromise = fetch('https://cdn.vev.design/icons/fontawesome-
|
|
15
|
+
iconsPromise = fetch('https://cdn.vev.design/icons/fontawesome-v7.json')
|
|
16
16
|
.then((r) => r.json() as Promise<IShape[]>)
|
|
17
17
|
.then((res) => res.sort((i1, i2) => ((i1.name || '') < (i2.name || '') ? -1 : 1)));
|
|
18
18
|
}
|
package/src/icons.tsx
CHANGED
|
@@ -35,6 +35,7 @@ export const SilkeIconDefinitions = {
|
|
|
35
35
|
remove: 'fal fa-minus',
|
|
36
36
|
'error.circle': 'fal fa-exclamation-circle',
|
|
37
37
|
'warning.triangle': 'fal fa-triangle-exclamation',
|
|
38
|
+
waveform: 'fal fa-waveform-lines',
|
|
38
39
|
tooltip: 'fal fa-info-circle',
|
|
39
40
|
email: 'fal fa-envelope',
|
|
40
41
|
password: 'fal fa-key',
|
|
@@ -465,6 +466,9 @@ export const SilkeIconDefinitions = {
|
|
|
465
466
|
'animate.in': 'fa-kit fa-animate-in',
|
|
466
467
|
'animate.out': 'fa-kit fa-animate-in fa-flip-vertical',
|
|
467
468
|
'animate.bold': 'fa-kit fa-animation-bold',
|
|
469
|
+
'animate.fill-backwards': AnimationFillBackwards,
|
|
470
|
+
'animate.fill-forwards': AnimationFillForwards,
|
|
471
|
+
'animate.fill-both': AnimationFillBoth,
|
|
468
472
|
|
|
469
473
|
qwiker: 'fal fa-rabbit-running',
|
|
470
474
|
};
|
|
@@ -780,3 +784,43 @@ function ContentChildParent() {
|
|
|
780
784
|
</svg>
|
|
781
785
|
);
|
|
782
786
|
}
|
|
787
|
+
|
|
788
|
+
function AnimationFillBackwards() {
|
|
789
|
+
return (
|
|
790
|
+
<svg width="25" height="26" viewBox="0 0 25 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
791
|
+
<path
|
|
792
|
+
d="M20.6448 15.5158C20.4099 15.7101 20.378 16.061 20.5752 16.2988C20.7724 16.5366 21.1205 16.5656 21.3583 16.3684C21.4598 16.2843 21.5555 16.1944 21.6512 16.0987C21.7469 16.003 21.8339 15.9044 21.9209 15.8058C22.1152 15.5709 22.0862 15.2171 21.8513 15.0228C21.6164 14.8285 21.2626 14.8575 21.0683 15.0924C20.9407 15.2432 20.7956 15.3882 20.6477 15.5129L20.6448 15.5158ZM22.3153 12.0937C22.0108 12.1198 21.7846 12.3924 21.8107 12.6969C21.8281 12.8941 21.831 13.0942 21.8107 13.2943C21.7846 13.5988 22.0079 13.8685 22.3153 13.8975C22.6198 13.9236 22.8895 13.7003 22.9185 13.3929C22.9446 13.129 22.9446 12.8622 22.9185 12.5983C22.8924 12.2938 22.6198 12.0675 22.3153 12.0937ZM18.2464 16.2611C17.9419 16.235 17.6722 16.4583 17.6432 16.7658C17.6171 17.0703 17.8404 17.34 18.1478 17.369C18.4117 17.3951 18.6786 17.3951 18.9425 17.369C19.247 17.3429 19.4732 17.0703 19.4471 16.7658C19.421 16.4612 19.1484 16.235 18.8439 16.2611C18.6466 16.2785 18.4436 16.2785 18.2464 16.2611ZM20.5781 9.68945C20.3809 9.92726 20.4128 10.2782 20.6477 10.4725C20.7231 10.5363 20.7956 10.603 20.8652 10.6726C20.9348 10.7422 21.0045 10.8176 21.0683 10.893C21.2655 11.1308 21.6135 11.1598 21.8513 10.9626C22.0891 10.7654 22.1181 10.4174 21.9209 10.1796C21.8368 10.0781 21.7469 9.98236 21.6512 9.88665C21.5555 9.79095 21.4569 9.70395 21.3583 9.61694C21.1234 9.42263 20.7695 9.45163 20.5752 9.68654L20.5781 9.68945ZM11.202 8.6773C11.4746 8.94991 11.7182 9.24573 11.93 9.55024C13.0552 9.31823 14.2733 9.63724 15.1462 10.5102C16.5267 11.8906 16.5238 14.1266 15.1462 15.5042C14.2878 16.3626 13.1016 16.6846 11.9938 16.4757C11.7791 16.7948 11.5326 17.0993 11.2513 17.3806C11.2368 17.3951 11.2223 17.4038 11.2078 17.4183C12.8174 17.9432 14.6561 17.5662 15.935 16.2872C17.7476 14.4747 17.7505 11.531 15.935 9.71555C14.6387 8.41919 12.7652 8.04797 11.1382 8.6077C11.1585 8.628 11.1817 8.6512 11.202 8.6715L11.202 8.6773ZM18.1507 8.6193C17.8462 8.6454 17.62 8.91801 17.6461 9.22252C17.6722 9.52704 17.9448 9.75325 18.2493 9.72715C18.4465 9.70975 18.6466 9.70685 18.8439 9.72425C19.1484 9.75035 19.4181 9.52704 19.4471 9.21962C19.4761 8.91221 19.2499 8.6454 18.9425 8.6164C18.6785 8.5903 18.4117 8.5903 18.1478 8.6164L18.1507 8.6193ZM10.187 16.322C12.017 14.4921 12.017 11.5223 10.187 9.69235C8.357 7.86237 5.38727 7.86237 3.55729 9.69235C1.72731 11.5223 1.72731 14.4921 3.55729 16.322C5.38727 18.152 8.357 18.152 10.187 16.322ZM4.34322 10.4783C5.74108 9.08042 8.00318 9.08042 9.40104 10.4783C10.7989 11.8761 10.7989 14.1382 9.40104 15.5361C8.00318 16.934 5.74108 16.934 4.34322 15.5361C2.94536 14.1382 2.94536 11.8761 4.34322 10.4783Z"
|
|
793
|
+
fill="#A9A9A9"
|
|
794
|
+
/>
|
|
795
|
+
<circle cx="4.5" cy="4.5" r="4.5" transform="matrix(-1 0 0 1 11.2427 8.5)" fill="#A9A9A9" />
|
|
796
|
+
</svg>
|
|
797
|
+
);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
function AnimationFillForwards() {
|
|
801
|
+
return (
|
|
802
|
+
<svg width="25" height="26" viewBox="0 0 25 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
803
|
+
<path
|
|
804
|
+
d="M4.35516 15.5158C4.59007 15.7101 4.62197 16.061 4.42477 16.2988C4.22756 16.5366 3.87954 16.5656 3.64173 16.3684C3.54023 16.2843 3.44452 16.1944 3.34882 16.0987C3.25312 16.003 3.16611 15.9044 3.07911 15.8058C2.8848 15.5709 2.9138 15.2171 3.14871 15.0228C3.38362 14.8285 3.73744 14.8575 3.93175 15.0924C4.05935 15.2432 4.20436 15.3882 4.35226 15.5129L4.35516 15.5158ZM2.68469 12.0937C2.9892 12.1198 3.21541 12.3924 3.18931 12.6969C3.17191 12.8941 3.16901 13.0942 3.18931 13.2943C3.21541 13.5988 2.9921 13.8685 2.68469 13.8975C2.38018 13.9236 2.11046 13.7003 2.08146 13.3929C2.05536 13.129 2.05536 12.8622 2.08146 12.5983C2.10757 12.2938 2.38018 12.0675 2.68469 12.0937ZM6.75357 16.2611C7.05808 16.235 7.32779 16.4583 7.3568 16.7658C7.3829 17.0703 7.15959 17.34 6.85217 17.369C6.58826 17.3951 6.32145 17.3951 6.05754 17.369C5.75302 17.3429 5.52682 17.0703 5.55292 16.7658C5.57902 16.4612 5.85163 16.235 6.15614 16.2611C6.35335 16.2785 6.55636 16.2785 6.75357 16.2611ZM4.42187 9.68945C4.61908 9.92726 4.58717 10.2782 4.35226 10.4725C4.27686 10.5363 4.20436 10.603 4.13475 10.6726C4.06515 10.7422 3.99555 10.8176 3.93174 10.893C3.73454 11.1308 3.38652 11.1598 3.14871 10.9626C2.9109 10.7654 2.8819 10.4174 3.07911 10.1796C3.16321 10.0781 3.25312 9.98236 3.34882 9.88665C3.44452 9.79095 3.54313 9.70395 3.64173 9.61694C3.87664 9.42263 4.23046 9.45163 4.42477 9.68654L4.42187 9.68945ZM13.798 8.6773C13.5254 8.94991 13.2818 9.24573 13.07 9.55024C11.9448 9.31823 10.7267 9.63724 9.8538 10.5102C8.47334 11.8906 8.47624 14.1266 9.8538 15.5042C10.7122 16.3626 11.8984 16.6846 13.0062 16.4757C13.2209 16.7948 13.4674 17.0993 13.7487 17.3806C13.7632 17.3951 13.7777 17.4038 13.7922 17.4183C12.1826 17.9432 10.3439 17.5662 9.06497 16.2872C7.25239 14.4747 7.24949 11.531 9.06497 9.71555C10.3613 8.41919 12.2348 8.04797 13.8618 8.6077C13.8415 8.628 13.8183 8.6512 13.798 8.6715L13.798 8.6773ZM6.84927 8.6193C7.15379 8.6454 7.38 8.91801 7.3539 9.22252C7.32779 9.52704 7.05518 9.75325 6.75067 9.72715C6.55346 9.70975 6.35335 9.70685 6.15614 9.72425C5.85163 9.75035 5.58192 9.52704 5.55292 9.21962C5.52391 8.91221 5.75013 8.6454 6.05754 8.6164C6.32145 8.5903 6.58826 8.5903 6.85217 8.6164L6.84927 8.6193ZM14.813 16.322C12.983 14.4921 12.983 11.5223 14.813 9.69235C16.643 7.86237 19.6127 7.86237 21.4427 9.69235C23.2727 11.5223 23.2727 14.4921 21.4427 16.322C19.6127 18.152 16.643 18.152 14.813 16.322ZM20.6568 10.4783C19.2589 9.08042 16.9968 9.08042 15.599 10.4783C14.2011 11.8761 14.2011 14.1382 15.599 15.5361C16.9968 16.934 19.2589 16.934 20.6568 15.5361C22.0546 14.1382 22.0546 11.8761 20.6568 10.4783Z"
|
|
805
|
+
fill="#A9A9A9"
|
|
806
|
+
/>
|
|
807
|
+
<circle cx="18.2573" cy="13" r="4.5" fill="#A9A9A9" />
|
|
808
|
+
</svg>
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
function AnimationFillBoth() {
|
|
813
|
+
return (
|
|
814
|
+
<svg width="25" height="26" viewBox="0 0 25 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
815
|
+
<path
|
|
816
|
+
d="M4.35516 15.5158C4.59007 15.7101 4.62197 16.061 4.42477 16.2988C4.22756 16.5366 3.87954 16.5656 3.64173 16.3684C3.54023 16.2843 3.44452 16.1944 3.34882 16.0987C3.25312 16.003 3.16611 15.9044 3.07911 15.8058C2.8848 15.5709 2.9138 15.2171 3.14871 15.0228C3.38362 14.8285 3.73744 14.8575 3.93175 15.0924C4.05935 15.2432 4.20436 15.3882 4.35226 15.5129L4.35516 15.5158ZM2.68469 12.0937C2.9892 12.1198 3.21541 12.3924 3.18931 12.6969C3.17191 12.8941 3.16901 13.0942 3.18931 13.2943C3.21541 13.5988 2.9921 13.8685 2.68469 13.8975C2.38018 13.9236 2.11046 13.7003 2.08146 13.3929C2.05536 13.129 2.05536 12.8622 2.08146 12.5983C2.10757 12.2938 2.38018 12.0675 2.68469 12.0937ZM6.75357 16.2611C7.05808 16.235 7.32779 16.4583 7.3568 16.7658C7.3829 17.0703 7.15959 17.34 6.85217 17.369C6.58826 17.3951 6.32145 17.3951 6.05754 17.369C5.75302 17.3429 5.52682 17.0703 5.55292 16.7658C5.57902 16.4612 5.85163 16.235 6.15614 16.2611C6.35335 16.2785 6.55636 16.2785 6.75357 16.2611ZM4.42187 9.68945C4.61908 9.92726 4.58717 10.2782 4.35226 10.4725C4.27686 10.5363 4.20436 10.603 4.13475 10.6726C4.06515 10.7422 3.99555 10.8176 3.93174 10.893C3.73454 11.1308 3.38652 11.1598 3.14871 10.9626C2.9109 10.7654 2.8819 10.4174 3.07911 10.1796C3.16321 10.0781 3.25312 9.98236 3.34882 9.88665C3.44452 9.79095 3.54313 9.70395 3.64173 9.61694C3.87664 9.42263 4.23046 9.45163 4.42477 9.68654L4.42187 9.68945ZM13.798 8.6773C13.5254 8.94991 13.2818 9.24573 13.07 9.55024C11.9448 9.31823 10.7267 9.63724 9.8538 10.5102C8.47334 11.8906 8.47624 14.1266 9.8538 15.5042C10.7122 16.3626 11.8984 16.6846 13.0062 16.4757C13.2209 16.7948 13.4674 17.0993 13.7487 17.3806C13.7632 17.3951 13.7777 17.4038 13.7922 17.4183C12.1826 17.9432 10.3439 17.5662 9.06497 16.2872C7.25239 14.4747 7.24949 11.531 9.06497 9.71555C10.3613 8.41919 12.2348 8.04797 13.8618 8.6077C13.8415 8.628 13.8183 8.6512 13.798 8.6715L13.798 8.6773ZM6.84927 8.6193C7.15379 8.6454 7.38 8.91801 7.3539 9.22252C7.32779 9.52704 7.05518 9.75325 6.75067 9.72715C6.55346 9.70975 6.35335 9.70685 6.15614 9.72425C5.85163 9.75035 5.58192 9.52704 5.55292 9.21962C5.52391 8.91221 5.75013 8.6454 6.05754 8.6164C6.32145 8.5903 6.58826 8.5903 6.85217 8.6164L6.84927 8.6193ZM14.813 16.322C12.983 14.4921 12.983 11.5223 14.813 9.69235C16.643 7.86237 19.6127 7.86237 21.4427 9.69235C23.2727 11.5223 23.2727 14.4921 21.4427 16.322C19.6127 18.152 16.643 18.152 14.813 16.322ZM20.6568 10.4783C19.2589 9.08042 16.9968 9.08042 15.599 10.4783C14.2011 11.8761 14.2011 14.1382 15.599 15.5361C16.9968 16.934 19.2589 16.934 20.6568 15.5361C22.0546 14.1382 22.0546 11.8761 20.6568 10.4783Z"
|
|
817
|
+
fill="#A9A9A9"
|
|
818
|
+
/>
|
|
819
|
+
<circle cx="18.2573" cy="13" r="4.5" fill="#A9A9A9" />
|
|
820
|
+
<path
|
|
821
|
+
d="M6.5 8.5C6.99702 8.5 7.47485 8.58167 7.92188 8.73047C6.84886 9.83373 6.1875 11.3394 6.1875 13C6.1875 14.6603 6.84915 16.1653 7.92188 17.2686C7.47476 17.4174 6.99712 17.5 6.5 17.5C4.01472 17.5 2 15.4853 2 13C2 10.5147 4.01472 8.5 6.5 8.5Z"
|
|
822
|
+
fill="#A9A9A9"
|
|
823
|
+
/>
|
|
824
|
+
</svg>
|
|
825
|
+
);
|
|
826
|
+
}
|