@vev/silke 1.0.14 → 1.0.16
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/{chunk-KMZFUBRE.js → chunk-LAB2YEXC.js} +4 -4
- package/dist/chunk-LAB2YEXC.js.LEGAL.txt +11 -0
- package/dist/{chunk-KMZFUBRE.js.map → chunk-LAB2YEXC.js.map} +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.LEGAL.txt +49 -21
- package/dist/index.js.map +4 -4
- package/dist/silke-code-editor-WEBZ7JXL.js +25 -0
- package/dist/silke-code-editor-WEBZ7JXL.js.LEGAL.txt +0 -0
- package/dist/silke-code-editor-WEBZ7JXL.js.map +7 -0
- package/dist/styles.css +100 -103
- package/esbuild.config.mjs +47 -43
- package/jest.config.js +1 -2
- package/package.json +3 -3
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.spec.tsx +0 -2
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +6 -4
- package/src/components/silke-color-picker/silke-color-info.tsx +2 -2
- package/src/components/silke-form-schema/fields/array-field-inline.tsx +1 -1
- package/src/components/silke-form-schema/fields/array-field-modal.tsx +1 -1
- package/src/components/silke-form-schema/fields/array-field.tsx +2 -2
- package/src/components/silke-form-schema/fields/event-field.tsx +1 -1
- package/src/components/silke-form-schema/fields/icon-field.tsx +2 -2
- package/src/components/silke-form-schema/fields/image-field.tsx +3 -2
- package/src/components/silke-form-schema/fields/layout-field.tsx +1 -1
- package/src/components/silke-form-schema/fields/link-field.tsx +3 -2
- package/src/components/silke-form-schema/fields/number-field.tsx +3 -2
- package/src/components/silke-form-schema/fields/object-field.tsx +3 -2
- package/src/components/silke-form-schema/fields/select-field.tsx +7 -8
- package/src/components/silke-form-schema/fields/string-field.tsx +2 -6
- package/src/components/silke-form-schema/fields/toggle-field.tsx +15 -11
- package/src/components/silke-form-schema/fields/upload-field.tsx +1 -1
- package/src/components/silke-form-schema/fields/utils/generate-image.ts +1 -1
- package/src/components/silke-form-schema/fields/utils/generate-title.ts +1 -1
- package/src/components/silke-form-schema/fields/utils/schema-util.ts +6 -0
- package/src/components/silke-form-schema/schema-utils.ts +1 -1
- package/src/components/silke-form-schema/silke-form-schema.tsx +1 -1
- package/src/components/silke-form-schema/silke-schema-context.tsx +1 -1
- package/src/components/silke-form-schema/silke-schema-field.tsx +1 -1
- package/src/components/silke-form-schema/silke-schema-fields.tsx +1 -1
- package/src/components/silke-select-field/silke-select-field.spec.tsx +1 -2
- package/src/components/silke-tag/silke-tag.tsx +2 -2
- package/src/hooks/use-drop-zone.ts +0 -3
- package/src/icons.tsx +2 -0
- package/tsconfig.json +1 -1
- package/webpack.docs.ts +1 -1
- package/dist/chunk-KMZFUBRE.js.LEGAL.txt +0 -8
- package/dist/silke-code-editor-UX2ML2WG.js +0 -23
- package/dist/silke-code-editor-UX2ML2WG.js.map +0 -7
package/dist/styles.css
CHANGED
|
@@ -1312,8 +1312,7 @@ div[data-shadow=level4] {
|
|
|
1312
1312
|
align-items: start;
|
|
1313
1313
|
outline: none;
|
|
1314
1314
|
border: none;
|
|
1315
|
-
|
|
1316
|
-
backface-visibility: hidden;
|
|
1315
|
+
backface-visibility: hidden;
|
|
1317
1316
|
}
|
|
1318
1317
|
|
|
1319
1318
|
.silke-nested-sortable-list_selected_f167a380fd {
|
|
@@ -1544,17 +1543,17 @@ img.silke-icon_icon_84f9e9d6b3 {
|
|
|
1544
1543
|
* Get font size base on base font size
|
|
1545
1544
|
* scaling = round(size * 1.200) (Minor Third)
|
|
1546
1545
|
*/
|
|
1547
|
-
.silke-
|
|
1548
|
-
|
|
1549
|
-
height: 24px;
|
|
1550
|
-
outline: 1px solid #fff;
|
|
1551
|
-
border-radius: 50%;
|
|
1552
|
-
text-align: center;
|
|
1553
|
-
transition: 500ms outline;
|
|
1546
|
+
.silke-toolbar_root_dde856ffa5 {
|
|
1547
|
+
position: relative;
|
|
1554
1548
|
}
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1549
|
+
.silke-toolbar_root_dde856ffa5:before {
|
|
1550
|
+
background-color: rgba(var(--color-neutral-100-rgb), var(--opacity-level-light));
|
|
1551
|
+
position: absolute;
|
|
1552
|
+
content: "";
|
|
1553
|
+
bottom: 0;
|
|
1554
|
+
left: 0;
|
|
1555
|
+
right: 0;
|
|
1556
|
+
height: 1px;
|
|
1558
1557
|
}
|
|
1559
1558
|
/**********************
|
|
1560
1559
|
* SOME MATH
|
|
@@ -1572,17 +1571,17 @@ img.silke-icon_icon_84f9e9d6b3 {
|
|
|
1572
1571
|
* Get font size base on base font size
|
|
1573
1572
|
* scaling = round(size * 1.200) (Minor Third)
|
|
1574
1573
|
*/
|
|
1575
|
-
.silke-
|
|
1576
|
-
|
|
1574
|
+
.silke-steps_number_e3e97b6c1a {
|
|
1575
|
+
width: 24px;
|
|
1576
|
+
height: 24px;
|
|
1577
|
+
outline: 1px solid #fff;
|
|
1578
|
+
border-radius: 50%;
|
|
1579
|
+
text-align: center;
|
|
1580
|
+
transition: 500ms outline;
|
|
1577
1581
|
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
content: "";
|
|
1582
|
-
bottom: 0;
|
|
1583
|
-
left: 0;
|
|
1584
|
-
right: 0;
|
|
1585
|
-
height: 1px;
|
|
1582
|
+
|
|
1583
|
+
.silke-steps_number_e3e97b6c1a.silke-steps_done_e3e97b6c1a {
|
|
1584
|
+
outline: 1px solid var(--color-success-30);
|
|
1586
1585
|
}
|
|
1587
1586
|
/**********************
|
|
1588
1587
|
* SOME MATH
|
|
@@ -2228,6 +2227,83 @@ body {
|
|
|
2228
2227
|
* Get font size base on base font size
|
|
2229
2228
|
* scaling = round(size * 1.200) (Minor Third)
|
|
2230
2229
|
*/
|
|
2230
|
+
body {
|
|
2231
|
+
--tile-background: var(--color-neutral-5);
|
|
2232
|
+
--tile-background-hover: rgba(var(--color-neutral-5-rgb), 0.32);
|
|
2233
|
+
--tile-background-active: rgba(var(--color-neutral-5-rgb), 0.08);
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
.silke-tile_tile_47b57b749d {
|
|
2237
|
+
position: relative;
|
|
2238
|
+
background: var(--tile-background);
|
|
2239
|
+
}
|
|
2240
|
+
.silke-tile_tile_47b57b749d:focus {
|
|
2241
|
+
outline: none;
|
|
2242
|
+
}
|
|
2243
|
+
.silke-tile_tile_47b57b749d:focus-visible, .silke-tile_tile_47b57b749d.silke-tile_selected_47b57b749d {
|
|
2244
|
+
box-shadow: 0 0 0 1px var(--color-neutral-100);
|
|
2245
|
+
border-color: var(--color-neutral-100);
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2248
|
+
.silke-tile_clickable_47b57b749d {
|
|
2249
|
+
cursor: pointer;
|
|
2250
|
+
transition: background ease-in-out 100ms;
|
|
2251
|
+
}
|
|
2252
|
+
.silke-tile_clickable_47b57b749d:hover {
|
|
2253
|
+
background-color: var(--tile-background-hover);
|
|
2254
|
+
}
|
|
2255
|
+
.silke-tile_clickable_47b57b749d:active {
|
|
2256
|
+
background: var(--tile-background-active);
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
.silke-tile_icon_47b57b749d {
|
|
2260
|
+
font-size: 16px;
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
.silke-tile_tags_47b57b749d {
|
|
2264
|
+
position: absolute;
|
|
2265
|
+
top: 0;
|
|
2266
|
+
right: 0;
|
|
2267
|
+
}
|
|
2268
|
+
.silke-tile_tags_47b57b749d > *:not(:last-child) {
|
|
2269
|
+
margin-right: 8px;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
.silke-tile_tiny_47b57b749d {
|
|
2273
|
+
max-width: 256px;
|
|
2274
|
+
width: 100%;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
.silke-tile_small_47b57b749d {
|
|
2278
|
+
max-width: 512px;
|
|
2279
|
+
width: 100%;
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
.silke-tile_medium_47b57b749d {
|
|
2283
|
+
max-width: 768px;
|
|
2284
|
+
width: 100%;
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
.silke-tile_large_47b57b749d {
|
|
2288
|
+
max-width: 1024px;
|
|
2289
|
+
width: 100%;
|
|
2290
|
+
}
|
|
2291
|
+
/**********************
|
|
2292
|
+
* SOME MATH
|
|
2293
|
+
************************/
|
|
2294
|
+
/**********************
|
|
2295
|
+
* FONT
|
|
2296
|
+
************************/
|
|
2297
|
+
/**********************
|
|
2298
|
+
* SPACING
|
|
2299
|
+
************************/
|
|
2300
|
+
/**********************
|
|
2301
|
+
* SIZES
|
|
2302
|
+
************************/
|
|
2303
|
+
/**
|
|
2304
|
+
* Get font size base on base font size
|
|
2305
|
+
* scaling = round(size * 1.200) (Minor Third)
|
|
2306
|
+
*/
|
|
2231
2307
|
.silke-table_toolbar_b5946502de {
|
|
2232
2308
|
border-radius: var(--border-radius-medium);
|
|
2233
2309
|
border-bottom-left-radius: var(--border-radius-tiny);
|
|
@@ -2307,83 +2383,6 @@ body {
|
|
|
2307
2383
|
* Get font size base on base font size
|
|
2308
2384
|
* scaling = round(size * 1.200) (Minor Third)
|
|
2309
2385
|
*/
|
|
2310
|
-
body {
|
|
2311
|
-
--tile-background: var(--color-neutral-5);
|
|
2312
|
-
--tile-background-hover: rgba(var(--color-neutral-5-rgb), 0.32);
|
|
2313
|
-
--tile-background-active: rgba(var(--color-neutral-5-rgb), 0.08);
|
|
2314
|
-
}
|
|
2315
|
-
|
|
2316
|
-
.silke-tile_tile_47b57b749d {
|
|
2317
|
-
position: relative;
|
|
2318
|
-
background: var(--tile-background);
|
|
2319
|
-
}
|
|
2320
|
-
.silke-tile_tile_47b57b749d:focus {
|
|
2321
|
-
outline: none;
|
|
2322
|
-
}
|
|
2323
|
-
.silke-tile_tile_47b57b749d:focus-visible, .silke-tile_tile_47b57b749d.silke-tile_selected_47b57b749d {
|
|
2324
|
-
box-shadow: 0 0 0 1px var(--color-neutral-100);
|
|
2325
|
-
border-color: var(--color-neutral-100);
|
|
2326
|
-
}
|
|
2327
|
-
|
|
2328
|
-
.silke-tile_clickable_47b57b749d {
|
|
2329
|
-
cursor: pointer;
|
|
2330
|
-
transition: background ease-in-out 100ms;
|
|
2331
|
-
}
|
|
2332
|
-
.silke-tile_clickable_47b57b749d:hover {
|
|
2333
|
-
background-color: var(--tile-background-hover);
|
|
2334
|
-
}
|
|
2335
|
-
.silke-tile_clickable_47b57b749d:active {
|
|
2336
|
-
background: var(--tile-background-active);
|
|
2337
|
-
}
|
|
2338
|
-
|
|
2339
|
-
.silke-tile_icon_47b57b749d {
|
|
2340
|
-
font-size: 16px;
|
|
2341
|
-
}
|
|
2342
|
-
|
|
2343
|
-
.silke-tile_tags_47b57b749d {
|
|
2344
|
-
position: absolute;
|
|
2345
|
-
top: 0;
|
|
2346
|
-
right: 0;
|
|
2347
|
-
}
|
|
2348
|
-
.silke-tile_tags_47b57b749d > *:not(:last-child) {
|
|
2349
|
-
margin-right: 8px;
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
|
-
.silke-tile_tiny_47b57b749d {
|
|
2353
|
-
max-width: 256px;
|
|
2354
|
-
width: 100%;
|
|
2355
|
-
}
|
|
2356
|
-
|
|
2357
|
-
.silke-tile_small_47b57b749d {
|
|
2358
|
-
max-width: 512px;
|
|
2359
|
-
width: 100%;
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
.silke-tile_medium_47b57b749d {
|
|
2363
|
-
max-width: 768px;
|
|
2364
|
-
width: 100%;
|
|
2365
|
-
}
|
|
2366
|
-
|
|
2367
|
-
.silke-tile_large_47b57b749d {
|
|
2368
|
-
max-width: 1024px;
|
|
2369
|
-
width: 100%;
|
|
2370
|
-
}
|
|
2371
|
-
/**********************
|
|
2372
|
-
* SOME MATH
|
|
2373
|
-
************************/
|
|
2374
|
-
/**********************
|
|
2375
|
-
* FONT
|
|
2376
|
-
************************/
|
|
2377
|
-
/**********************
|
|
2378
|
-
* SPACING
|
|
2379
|
-
************************/
|
|
2380
|
-
/**********************
|
|
2381
|
-
* SIZES
|
|
2382
|
-
************************/
|
|
2383
|
-
/**
|
|
2384
|
-
* Get font size base on base font size
|
|
2385
|
-
* scaling = round(size * 1.200) (Minor Third)
|
|
2386
|
-
*/
|
|
2387
2386
|
.silke-toggle_container_5fdf33c914 {
|
|
2388
2387
|
position: relative;
|
|
2389
2388
|
cursor: pointer;
|
|
@@ -3592,8 +3591,7 @@ body {
|
|
|
3592
3591
|
position: relative;
|
|
3593
3592
|
display: flex;
|
|
3594
3593
|
flex-direction: column;
|
|
3595
|
-
|
|
3596
|
-
backface-visibility: hidden;
|
|
3594
|
+
backface-visibility: hidden;
|
|
3597
3595
|
}
|
|
3598
3596
|
.silke-card_card_651958c137:focus-visible::before {
|
|
3599
3597
|
border: 2px solid var(--color-neutral-0);
|
|
@@ -3791,8 +3789,7 @@ body {
|
|
|
3791
3789
|
white-space: nowrap;
|
|
3792
3790
|
min-width: -moz-fit-content;
|
|
3793
3791
|
min-width: fit-content;
|
|
3794
|
-
|
|
3795
|
-
backface-visibility: hidden;
|
|
3792
|
+
backface-visibility: hidden;
|
|
3796
3793
|
background: var(--silke-button-background);
|
|
3797
3794
|
color: var(--silke-button-color);
|
|
3798
3795
|
border: var(--silke-button-border);
|
package/esbuild.config.mjs
CHANGED
|
@@ -30,50 +30,54 @@ const cli = meow(
|
|
|
30
30
|
const watch = cli.flags.watch || cli.flags.serve || false;
|
|
31
31
|
buildSilke(watch);
|
|
32
32
|
|
|
33
|
-
function buildSilke(watch) {
|
|
33
|
+
async function buildSilke(watch) {
|
|
34
34
|
console.log(`🚧 @vev/silke building`);
|
|
35
35
|
const time = Date.now();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
},
|
|
36
|
+
|
|
37
|
+
const config = {
|
|
38
|
+
entryPoints: [path.resolve(__dirname, './src/index.ts')],
|
|
39
|
+
outdir: path.resolve(__dirname, './dist'),
|
|
40
|
+
bundle: true,
|
|
41
|
+
minify: true,
|
|
42
|
+
sourcemap: true,
|
|
43
|
+
splitting: true,
|
|
44
|
+
format: 'esm',
|
|
45
|
+
legalComments: 'linked',
|
|
46
|
+
target: ['es2020'],
|
|
47
|
+
external: Object.keys(pkg.peerDependencies || {}),
|
|
48
|
+
allowOverwrite: true,
|
|
49
|
+
plugins: [
|
|
50
|
+
{
|
|
51
|
+
name: 'raw',
|
|
52
|
+
setup(build) {
|
|
53
|
+
build.onResolve({ filter: /\.raw\..+$/i }, (args) => {
|
|
54
|
+
return {
|
|
55
|
+
path: path.isAbsolute(args.path)
|
|
56
|
+
? args.path
|
|
57
|
+
: path.join(args.resolveDir, args.path),
|
|
58
|
+
namespace: 'raw-loader',
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
build.onLoad({ filter: /\.raw\..+$/i, namespace: 'raw-loader' }, async (args) => {
|
|
62
|
+
return {
|
|
63
|
+
contents: await fs.promises.readFile(args.path.replace(/\?raw$/, '')),
|
|
64
|
+
loader: 'text',
|
|
65
|
+
};
|
|
66
|
+
});
|
|
69
67
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
},
|
|
69
|
+
esbuildSassModulesPlugin(),
|
|
70
|
+
],
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (watch) {
|
|
74
|
+
// don't minify
|
|
75
|
+
const context = await esbuild.context({ ...config, minify: false });
|
|
76
|
+
|
|
77
|
+
await context.watch();
|
|
78
|
+
} else {
|
|
79
|
+
await esbuild.build(config);
|
|
80
|
+
|
|
81
|
+
console.log(`✅ @vev/silke done building, used ${Date.now() - time}ms`);
|
|
82
|
+
}
|
|
79
83
|
}
|
package/jest.config.js
CHANGED
|
@@ -6,12 +6,11 @@ const packageName = package.name.split('@vev/').pop();
|
|
|
6
6
|
|
|
7
7
|
module.exports = {
|
|
8
8
|
...base,
|
|
9
|
-
name: packageName,
|
|
10
9
|
displayName: packageName,
|
|
11
10
|
rootDir: '../..',
|
|
12
11
|
roots: [`<rootDir>/packages/${packageName}`],
|
|
13
12
|
testRegex: `(packages/${packageName}/.*/__tests__/.*|\\.(spec|test))\\.tsx?$`,
|
|
14
|
-
|
|
13
|
+
testEnvironmentOptions: { url: 'http://localhost/', },
|
|
15
14
|
moduleDirectories: ['node_modules', 'src'],
|
|
16
15
|
testEnvironment: 'jsdom',
|
|
17
16
|
setupFiles: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vev/silke",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@mdx-js/mdx": "^2.0.0-next.9",
|
|
31
31
|
"@mdx-js/react": "^2.1.2",
|
|
32
32
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
33
|
-
"@vev/react": "0.0
|
|
34
|
-
"@vev/utils": "1.0
|
|
33
|
+
"@vev/react": "0.1.0",
|
|
34
|
+
"@vev/utils": "1.1.0",
|
|
35
35
|
"@uiw/react-codemirror": "^4.12.3",
|
|
36
36
|
"@uiw/codemirror-theme-dracula": "^4.12.3",
|
|
37
37
|
"classnames": ">=2.2.0",
|
|
@@ -4,7 +4,6 @@ import { SilkeAutocompleteField, useMatchingItemsOnTop } from './silke-autocompl
|
|
|
4
4
|
import { ARROW_DOWN, ENTER, ESCAPE } from '../../../jest/keys';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
import { renderHook } from '@testing-library/react-hooks';
|
|
7
|
-
import { getSearchReg } from '@vev/utils';
|
|
8
7
|
|
|
9
8
|
type Item = {
|
|
10
9
|
label: string;
|
|
@@ -161,7 +160,6 @@ describe('silke-autocomplete-field', () => {
|
|
|
161
160
|
await user.click(bearItem);
|
|
162
161
|
|
|
163
162
|
expect(onChange).toHaveBeenCalledWith('bear');
|
|
164
|
-
expect(input).toHaveFocus();
|
|
165
163
|
});
|
|
166
164
|
|
|
167
165
|
it('Is possible to select item by using keyboard only', async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSearchReg } from '@vev/utils';
|
|
1
|
+
import { getSearchReg, Mouse } from '@vev/utils';
|
|
2
2
|
import { isEqual, isUndefined } from 'lodash';
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { useFormField, useInterval, useParentScroll, useWindowResize } from '../../hooks';
|
|
@@ -456,9 +456,8 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
456
456
|
}}
|
|
457
457
|
onBlur={(e) => {
|
|
458
458
|
const inside = dropdownRef?.current?.contains(e?.relatedTarget as Node);
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
459
|
+
|
|
460
|
+
if (!inside) setOpen(false);
|
|
462
461
|
}}
|
|
463
462
|
placeholder={isEmptyForm ? placeholder : ''}
|
|
464
463
|
value={searchText}
|
|
@@ -501,6 +500,9 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
501
500
|
|
|
502
501
|
{open && (
|
|
503
502
|
<SilkePopover
|
|
503
|
+
onRequestClose={(e) => {
|
|
504
|
+
if (e && inputRef.current && !Mouse.isInside(e, inputRef.current)) setOpen(false);
|
|
505
|
+
}}
|
|
504
506
|
hide={!open}
|
|
505
507
|
anchor={containerRef}
|
|
506
508
|
anchorOrigin={overridePopoverPlacement?.anchor || anchorOrigin || 'bottom-left'}
|
|
@@ -82,7 +82,7 @@ export function ColorInfo({ rgba, noTransparency, onChange }: ColorInfoProps) {
|
|
|
82
82
|
/>
|
|
83
83
|
</SilkeBox>
|
|
84
84
|
|
|
85
|
-
<SilkeBox style={{ width:
|
|
85
|
+
<SilkeBox style={{ width: 88 }} flex gap="s">
|
|
86
86
|
{format === 'HEX' ? (
|
|
87
87
|
<SilkeTextField
|
|
88
88
|
flex
|
|
@@ -109,7 +109,7 @@ export function ColorInfo({ rgba, noTransparency, onChange }: ColorInfoProps) {
|
|
|
109
109
|
)}
|
|
110
110
|
</SilkeBox>
|
|
111
111
|
|
|
112
|
-
<SilkeBox style={{ width:
|
|
112
|
+
<SilkeBox style={{ width: 52 }}>
|
|
113
113
|
<SilkeCssNumberField
|
|
114
114
|
min={0}
|
|
115
115
|
max={100}
|
|
@@ -6,7 +6,7 @@ import { SilkeText } from '../../silke-text';
|
|
|
6
6
|
import { SilkeBox } from '../../silke-box';
|
|
7
7
|
import { SilkeButton } from '../../silke-button';
|
|
8
8
|
import { generateTitle } from './utils';
|
|
9
|
-
import { VevProps } from '@vev/
|
|
9
|
+
import { VevProps } from '@vev/utils';
|
|
10
10
|
|
|
11
11
|
type Props = {
|
|
12
12
|
selected: number;
|
|
@@ -7,7 +7,7 @@ import { SilkeText } from '../../silke-text';
|
|
|
7
7
|
import { SilkeBox } from '../../silke-box';
|
|
8
8
|
import { SilkeButton } from '../../silke-button';
|
|
9
9
|
import { generateTitle } from './utils';
|
|
10
|
-
import { VevProps } from '@vev/
|
|
10
|
+
import { VevProps } from '@vev/utils';
|
|
11
11
|
import styles from './styles.scss';
|
|
12
12
|
|
|
13
13
|
type Props = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayField as ArrayFieldType, SchemaFieldProps, VevProps } from '@vev/
|
|
1
|
+
import { ArrayField as ArrayFieldType, SchemaFieldProps, VevProps } from '@vev/utils';
|
|
2
2
|
import React, { useCallback, useRef, useState } from 'react';
|
|
3
3
|
import { SilkeBox } from '../../silke-box';
|
|
4
4
|
import { SilkeButton } from '../../silke-button';
|
|
@@ -9,10 +9,10 @@ import { SilkeText, SilkeTextSmall } from '../../silke-text';
|
|
|
9
9
|
import styles from './styles.scss';
|
|
10
10
|
import { ArrayFieldModal } from './array-field-modal';
|
|
11
11
|
import { ArrayFieldInline } from './array-field-inline';
|
|
12
|
-
import { getTitle } from './string-field';
|
|
13
12
|
import { SilkeOverflowMenu } from '../../silke-overflow-menu';
|
|
14
13
|
import { generateTitle, generateImage } from './utils';
|
|
15
14
|
import { isString, startCase } from 'lodash';
|
|
15
|
+
import { getTitle } from './utils/schema-util';
|
|
16
16
|
|
|
17
17
|
const ArrayField = ({ value = [], schema, onChange }: SchemaFieldProps<ArrayFieldType>) => {
|
|
18
18
|
const [selected, setSelected] = useState<number | undefined>(undefined);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { EventField as EventFieldType, SchemaFieldProps, VevContentEvent } from '@vev/
|
|
2
|
+
import { EventField as EventFieldType, SchemaFieldProps, VevContentEvent } from '@vev/utils';
|
|
3
3
|
import { SilkeBox } from '../../silke-box';
|
|
4
4
|
import { SilkeTextSmall } from '../../silke-text';
|
|
5
5
|
import { SilkeNotification } from '../../silke-notification';
|
|
@@ -3,10 +3,10 @@ import { SilkeBox } from '../../silke-box';
|
|
|
3
3
|
import { SilkeButton } from '../../silke-button';
|
|
4
4
|
import { SilkeIcon, SilkeIcons } from '../../silke-icon';
|
|
5
5
|
import { SilkeTextSmall } from '../../silke-text';
|
|
6
|
-
import { IconField as IconFieldType, SchemaFieldProps } from '@vev/
|
|
6
|
+
import { IconField as IconFieldType, SchemaFieldProps } from '@vev/utils';
|
|
7
7
|
import { useSchemaContext } from '../silke-schema-context';
|
|
8
|
-
import { getTitle } from './string-field';
|
|
9
8
|
import { EmojiType } from '@vev/utils';
|
|
9
|
+
import { getTitle } from './utils/schema-util';
|
|
10
10
|
|
|
11
11
|
const IconField = ({ value, schema, onChange }: SchemaFieldProps<IconFieldType>) => {
|
|
12
12
|
const { actions } = useSchemaContext();
|
|
@@ -3,10 +3,11 @@ import { SilkeBox } from '../../silke-box';
|
|
|
3
3
|
import { SilkeButton } from '../../silke-button';
|
|
4
4
|
import { SilkeImage } from '../../silke-image';
|
|
5
5
|
import { SilkeTextSmall } from '../../silke-text';
|
|
6
|
-
import { ImageField as ImageFieldType, SchemaFieldProps } from '@vev/
|
|
6
|
+
import { ImageField as ImageFieldType, SchemaFieldProps } from '@vev/utils';
|
|
7
7
|
import { useSchemaContext } from '../silke-schema-context';
|
|
8
8
|
import styles from './styles.scss';
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
import { getTitle } from './utils/schema-util';
|
|
10
11
|
|
|
11
12
|
const ImageField = ({ value, schema, onChange }: SchemaFieldProps<ImageFieldType>) => {
|
|
12
13
|
const { actions } = useSchemaContext();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LayoutField as LayoutFieldType, SchemaFieldProps } from '@vev/
|
|
1
|
+
import { LayoutField as LayoutFieldType, SchemaFieldProps } from '@vev/utils';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SilkeBox } from '../../silke-box';
|
|
4
4
|
import { SilkeSchemaFields } from '../silke-schema-fields';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SchemaFieldProps, LinkField as LinkFieldType } from '@vev/
|
|
1
|
+
import { SchemaFieldProps, LinkField as LinkFieldType } from '@vev/utils';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { SilkeAutocompleteField } from '../../silke-autocomplete-field';
|
|
4
4
|
import { SilkeBox } from '../../silke-box';
|
|
@@ -6,7 +6,8 @@ import { SilkeToggle } from '../../silke-toggle';
|
|
|
6
6
|
import { SilkeText, SilkeTextSmall } from '../../silke-text';
|
|
7
7
|
|
|
8
8
|
import { useSchemaContext } from '../silke-schema-context';
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
import { getTitle } from './utils/schema-util';
|
|
10
11
|
|
|
11
12
|
const SelectField = (props: SchemaFieldProps<LinkFieldType>) => {
|
|
12
13
|
const { onChange, schema, value } = props;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { NumberField as NumberFieldType, SchemaFieldProps } from '@vev/
|
|
1
|
+
import { NumberField as NumberFieldType, SchemaFieldProps } from '@vev/utils';
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import { SilkeCssNumberField } from '../../silke-css-number-field';
|
|
4
4
|
import { SilkeBox } from '../../silke-box';
|
|
5
5
|
import { SilkeSlider } from '../../silke-slider';
|
|
6
6
|
import { SilkeText, SilkeTextSmall } from '../../silke-text';
|
|
7
7
|
import { SilkeTextField } from '../../silke-text-field';
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
import { getTitle } from './utils/schema-util';
|
|
9
10
|
|
|
10
11
|
const NumberField = (props: SchemaFieldProps<NumberFieldType>) => {
|
|
11
12
|
const [errorMessage, setErrorMessage] = useState<string>();
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ObjectField as ObjectFieldType, SchemaFieldProps } from '@vev/
|
|
1
|
+
import { ObjectField as ObjectFieldType, SchemaFieldProps } from '@vev/utils';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SilkeBox } from '../../silke-box';
|
|
4
4
|
import { SilkeObjectField } from '../../silke-object-field';
|
|
5
5
|
import { SilkeTextSmall } from '../../silke-text';
|
|
6
6
|
import { SilkeSchemaFields } from '../silke-schema-fields';
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import { getTitle } from './utils/schema-util';
|
|
8
9
|
|
|
9
10
|
export default function ObjectField({
|
|
10
11
|
value = {},
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { SchemaFieldProps, SelectField as SelectFieldType, SelectFieldItem } from '@vev/
|
|
2
|
-
import { isArray, isFunction
|
|
1
|
+
import { SchemaFieldProps, SelectField as SelectFieldType, SelectFieldItem } from '@vev/utils';
|
|
2
|
+
import { isArray, isFunction } from 'lodash';
|
|
3
3
|
import React, { useEffect, useState } from 'react';
|
|
4
|
-
import { SilkeText, SilkeTextSmall } from '../../silke-text
|
|
4
|
+
import { SilkeText, SilkeTextSmall } from '../../silke-text';
|
|
5
5
|
import { SilkeAutocompleteField } from '../../silke-autocomplete-field';
|
|
6
6
|
import { SilkeBox } from '../../silke-box';
|
|
7
7
|
import { SilkeCheckbox } from '../../silke-checkbox';
|
|
8
8
|
import { SilkeRadioButton } from '../../silke-radio-button';
|
|
9
9
|
import { SilkeSelectField } from '../../silke-select-field';
|
|
10
10
|
import { useSchemaContext } from '../silke-schema-context';
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
import { getTitle } from './utils/schema-util';
|
|
12
13
|
|
|
13
14
|
const SelectField = (props: SchemaFieldProps<SelectFieldType>) => {
|
|
14
15
|
const {
|
|
15
16
|
onChange,
|
|
16
17
|
schema,
|
|
17
|
-
schema: { options, name,
|
|
18
|
+
schema: { options, name, options: { multiselect = false, display } = {} },
|
|
18
19
|
value,
|
|
19
20
|
} = props;
|
|
20
21
|
|
|
@@ -33,8 +34,6 @@ const SelectField = (props: SchemaFieldProps<SelectFieldType>) => {
|
|
|
33
34
|
}
|
|
34
35
|
}, [schemaItems, context]);
|
|
35
36
|
|
|
36
|
-
const label = title || startCase(name);
|
|
37
|
-
|
|
38
37
|
if (multiselect && (!display || display === 'checkbox')) {
|
|
39
38
|
const values = (value as string[]) || [];
|
|
40
39
|
return (
|
|
@@ -43,7 +42,7 @@ const SelectField = (props: SchemaFieldProps<SelectFieldType>) => {
|
|
|
43
42
|
<SilkeCheckbox
|
|
44
43
|
key={index}
|
|
45
44
|
label={item.label}
|
|
46
|
-
value={
|
|
45
|
+
value={values.includes(item.value) || false}
|
|
47
46
|
onChange={(checked: boolean) =>
|
|
48
47
|
checked
|
|
49
48
|
? onChange([...values, item.value])
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SchemaFieldProps, StringField as StringFieldType
|
|
1
|
+
import { SchemaFieldProps, StringField as StringFieldType } from '@vev/utils';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SilkeTextField } from '../../silke-text-field';
|
|
4
|
-
import {
|
|
4
|
+
import { getTitle } from './utils/schema-util';
|
|
5
5
|
|
|
6
6
|
const StringField = ({ schema, ...rest }: SchemaFieldProps<StringFieldType>) => {
|
|
7
7
|
const { options } = schema;
|
|
@@ -24,8 +24,4 @@ const StringField = ({ schema, ...rest }: SchemaFieldProps<StringFieldType>) =>
|
|
|
24
24
|
);
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export const getTitle = (schema: VevProps) => {
|
|
28
|
-
return schema.title || startCase(schema.name);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
27
|
export default StringField;
|