@vev/silke 1.0.28 → 1.0.29
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 +8 -0
- package/dist/index.js +49 -48
- package/dist/silke/src/components/index.d.ts +1 -1
- package/dist/silke/src/components/silke-autocomplete-field/autocomplete-item.d.ts +2 -1
- package/dist/silke/src/components/silke-autocomplete-field/autocomplete-tags.d.ts +2 -1
- package/dist/silke/src/components/silke-autocomplete-field/silke-autocomplete-field.d.ts +3 -1
- package/dist/silke/src/components/silke-autocomplete-field/silke-autocomplete-popup.d.ts +1 -0
- package/dist/silke/src/components/silke-box/silke-box.d.ts +3 -2
- package/dist/silke/src/components/silke-breadcrumbs/silke-breadcrumb.d.ts +1 -1
- package/dist/silke/src/components/silke-button/silke-big-button.d.ts +4 -1
- package/dist/silke/src/components/silke-button/silke-button.d.ts +1 -1
- package/dist/silke/src/components/silke-button/silke-dropdown-button.d.ts +2 -1
- package/dist/silke/src/components/silke-color-picker/color.d.ts +5 -0
- package/dist/silke/src/components/silke-color-picker/silke-color-info.d.ts +3 -1
- package/dist/silke/src/components/silke-color-swatches/silke-swatches.d.ts +2 -1
- package/dist/silke/src/components/silke-conditions-input/index.d.ts +2 -0
- package/dist/silke/src/components/silke-conditions-input/silke-conditions-input-options.d.ts +8 -0
- package/dist/silke/src/components/silke-conditions-input/silke-conditions-input.d.ts +19 -0
- package/dist/silke/src/components/silke-conditions-input/silke-conditions-tag.d.ts +11 -0
- package/dist/silke/src/components/silke-conditions-input/types.d.ts +13 -0
- package/dist/silke/src/components/silke-conditions-input/utils.d.ts +11 -0
- package/dist/silke/src/components/silke-context-menu/silke-context-menu-item.d.ts +1 -1
- package/dist/silke/src/components/silke-css-number-field/silke-css-context.d.ts +5 -1
- package/dist/silke/src/components/silke-css-number-field/silke-css-number-field.d.ts +3 -1
- package/dist/silke/src/components/silke-form/form-types.d.ts +3 -3
- package/dist/silke/src/components/silke-form-schema/fields/array-field-inline.d.ts +2 -1
- package/dist/silke/src/components/silke-form-schema/fields/array-field-modal.d.ts +3 -2
- package/dist/silke/src/components/silke-form-schema/fields/array-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/event-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/icon-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/image-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/layout-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/object-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/string-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/toggle-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/utils/generate-image.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/utils/generate-title.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/video-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/silke-form-schema.d.ts +5 -0
- package/dist/silke/src/components/silke-form-schema/silke-schema-field.d.ts +3 -1
- package/dist/silke/src/components/silke-form-schema/silke-schema-fields.d.ts +2 -0
- package/dist/silke/src/components/silke-modal/silke-modal.d.ts +2 -1
- package/dist/silke/src/components/silke-notification/silke-notification.d.ts +1 -1
- package/dist/silke/src/components/silke-radio-button/silke-radio-button-group.d.ts +1 -1
- package/dist/silke/src/components/silke-slider/silke-slider.d.ts +1 -0
- package/dist/silke/src/components/silke-sortable-list/silke-nested-sortable-utils.d.ts +1 -0
- package/dist/silke/src/components/silke-sortable-list/silke-sortable-item-wrapper.d.ts +2 -1
- package/dist/silke/src/components/silke-sortable-list/silke-sortable-list.d.ts +2 -1
- package/dist/silke/src/components/silke-table/silke-table.d.ts +2 -1
- package/dist/silke/src/components/silke-table/table-row.d.ts +3 -1
- package/dist/silke/src/components/silke-table/table-types.d.ts +1 -1
- package/dist/silke/src/components/silke-tag/silke-tag.d.ts +1 -1
- package/dist/silke/src/components/silke-text-field/silke-text-field-outline.d.ts +3 -1
- package/dist/silke/src/components/silke-text-field/text-field-context.d.ts +4 -1
- package/dist/silke/src/components/silke-tile/index.d.ts +0 -1
- package/dist/silke/src/components/silke-tooltip/silke-definition-tooltip.d.ts +2 -1
- package/dist/silke/src/components/silke-tooltip/silke-icon-tooltip.d.ts +2 -1
- package/dist/silke/src/components/silke-tooltip/silke-tooltip.d.ts +6 -1
- package/dist/silke/src/components/silke-variables-wrapper/silke-variables-wrapper-form.d.ts +4 -3
- package/dist/silke/src/components/silke-variables-wrapper/silke-variables-wrapper.d.ts +5 -1
- package/dist/silke/src/icons.d.ts +74 -2
- package/dist/silke/src/silke-theme-provider.d.ts +1 -1
- package/dist/styles.css +1419 -1157
- package/dist/utils/src/types/context.d.ts +1 -0
- package/dist/utils/src/types/index.d.ts +1 -0
- package/dist/utils/src/types/manifest.d.ts +2 -0
- package/dist/utils/src/types/qwiker.d.ts +46 -0
- package/dist/utils/src/types/vev-plugin.d.ts +12 -0
- package/dist/utils/src/types/vev-props.d.ts +23 -2
- package/dist/utils/src/types/widget-manifest.d.ts +1 -0
- package/dist/utils/src/utils/index.d.ts +1 -0
- package/dist/utils/src/utils/variable.d.ts +3 -0
- package/package.json +15 -8
- package/project.json +21 -0
- package/public/index.html +2 -2
- package/src/_variables.scss +19 -5
- package/src/components/index.ts +1 -1
- package/src/components/silke-autocomplete-field/autocomplete-item.tsx +18 -12
- package/src/components/silke-autocomplete-field/autocomplete-tags.tsx +3 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.mdx +15 -15
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +33 -25
- package/src/components/silke-autocomplete-field/silke-autocomplete-popup.tsx +40 -20
- package/src/components/silke-box/silke-box.mdx +13 -9
- package/src/components/silke-box/silke-box.scss +12 -3
- package/src/components/silke-box/silke-box.tsx +18 -2
- package/src/components/silke-breadcrumbs/silke-breadcrumb.tsx +2 -2
- package/src/components/silke-button/silke-big-button.scss +0 -5
- package/src/components/silke-button/silke-big-button.tsx +15 -4
- package/src/components/silke-button/silke-button.mdx +34 -17
- package/src/components/silke-button/silke-button.scss +28 -31
- package/src/components/silke-button/silke-button.tsx +2 -2
- package/src/components/silke-button/silke-dropdown-button.tsx +7 -3
- package/src/components/silke-button/silke-file-select-button.tsx +1 -0
- package/src/components/silke-card/silke-card-grid.tsx +1 -1
- package/src/components/silke-card/silke-card.mdx +16 -26
- package/src/components/silke-card/silke-card.scss +10 -3
- package/src/components/silke-card/silke-card.tsx +7 -4
- package/src/components/silke-checkbox/silke-checkbox.mdx +2 -11
- package/src/components/silke-code-snippet/silke-code-snippet.mdx +27 -22
- package/src/components/silke-color-palettes/silke-color-palette.mdx +2 -2
- package/src/components/silke-color-picker/color.ts +12 -0
- package/src/components/silke-color-picker/silke-color-info.tsx +27 -8
- package/src/components/silke-color-picker/silke-color-picker-button.tsx +1 -1
- package/src/components/silke-color-picker/silke-color-picker.mdx +9 -13
- package/src/components/silke-color-picker/silke-color-picker.tsx +23 -6
- package/src/components/silke-color-swatches/silke-color-swatch-button.tsx +1 -1
- package/src/components/silke-color-swatches/silke-swatches.tsx +10 -7
- package/src/components/silke-conditions-input/index.ts +2 -0
- package/src/components/silke-conditions-input/silke-conditions-input-options.tsx +87 -0
- package/src/components/silke-conditions-input/silke-conditions-input.mdx +88 -0
- package/src/components/silke-conditions-input/silke-conditions-input.scss +29 -0
- package/src/components/silke-conditions-input/silke-conditions-input.tsx +290 -0
- package/src/components/silke-conditions-input/silke-conditions-tag.tsx +80 -0
- package/src/components/silke-conditions-input/types.ts +23 -0
- package/src/components/silke-conditions-input/utils.ts +181 -0
- package/src/components/silke-content-column/silke-content-column.scss +1 -1
- package/src/components/silke-context-menu/silke-context-menu-item.tsx +3 -0
- package/src/components/silke-context-menu/silke-context-menu.mdx +4 -4
- package/src/components/silke-context-menu/silke-context-menu.scss +9 -7
- package/src/components/silke-context-menu/silke-context-menu.tsx +1 -1
- package/src/components/silke-css-number-field/silke-css-context.tsx +6 -1
- package/src/components/silke-css-number-field/silke-css-number-field.mdx +221 -91
- package/src/components/silke-css-number-field/silke-css-number-field.scss +10 -3
- package/src/components/silke-css-number-field/silke-css-number-field.tsx +52 -8
- package/src/components/silke-css-number-field/utils.ts +2 -1
- package/src/components/silke-divider/silke-divider.mdx +1 -2
- package/src/components/silke-drawer/silke-drawer.mdx +4 -11
- package/src/components/silke-form/form-types.ts +5 -3
- package/src/components/silke-form/silke-form.mdx +4 -16
- package/src/components/silke-form-schema/fields/array-field-inline.tsx +12 -2
- package/src/components/silke-form-schema/fields/array-field-modal.tsx +10 -6
- package/src/components/silke-form-schema/fields/array-field.tsx +25 -6
- package/src/components/silke-form-schema/fields/event-field.tsx +18 -7
- package/src/components/silke-form-schema/fields/icon-field.tsx +21 -3
- package/src/components/silke-form-schema/fields/image-field.tsx +21 -3
- package/src/components/silke-form-schema/fields/layout-field.tsx +8 -1
- package/src/components/silke-form-schema/fields/link-field.tsx +5 -1
- package/src/components/silke-form-schema/fields/number-field.tsx +144 -13
- package/src/components/silke-form-schema/fields/object-field.tsx +10 -1
- package/src/components/silke-form-schema/fields/select-field.tsx +15 -1
- package/src/components/silke-form-schema/fields/string-field.tsx +115 -20
- package/src/components/silke-form-schema/fields/toggle-field.tsx +14 -2
- package/src/components/silke-form-schema/fields/upload-field.tsx +3 -1
- package/src/components/silke-form-schema/fields/utils/generate-image.ts +4 -1
- package/src/components/silke-form-schema/fields/utils/generate-title.ts +2 -1
- package/src/components/silke-form-schema/fields/video-field.tsx +22 -4
- package/src/components/silke-form-schema/silke-form-schema.mdx +227 -160
- package/src/components/silke-form-schema/silke-form-schema.tsx +5 -0
- package/src/components/silke-form-schema/silke-schema-field.tsx +23 -6
- package/src/components/silke-form-schema/silke-schema-fields.tsx +3 -1
- package/src/components/silke-gradient-picker/silke-gradient-picker.mdx +1 -1
- package/src/components/silke-icon/silke-icon.mdx +3 -6
- package/src/components/silke-icon/silke-icon.scss +2 -0
- package/src/components/silke-icon-picker/silke-icon-picker.tsx +5 -5
- package/src/components/silke-iframe-portal/silke-iframe-portal.mdx +6 -15
- package/src/components/silke-image/silke-image.mdx +28 -0
- package/src/components/silke-image/silke-image.scss +1 -0
- package/src/components/silke-link/silke-link.mdx +62 -39
- package/src/components/silke-link/silke-link.scss +3 -2
- package/src/components/silke-list/silke-list.mdx +12 -10
- package/src/components/silke-list-card/silke-list-card.mdx +7 -11
- package/src/components/silke-loader/silke-loader.mdx +1 -1
- package/src/components/silke-loader/silke-loader.tsx +1 -4
- package/src/components/silke-modal/silke-modal.mdx +1 -5
- package/src/components/silke-modal/silke-modal.scss +0 -2
- package/src/components/silke-modal/silke-modal.tsx +3 -1
- package/src/components/silke-navigation-link/silke-navigation-link.mdx +21 -22
- package/src/components/silke-navigation-link/silke-navigation-link.scss +2 -2
- package/src/components/silke-notification/silke-notification.mdx +35 -67
- package/src/components/silke-notification/silke-notification.tsx +2 -1
- package/src/components/silke-object-field/silke-object-field.mdx +3 -10
- package/src/components/silke-object-field/silke-object-field.tsx +2 -2
- package/src/components/silke-overflow-menu/silke-overflow-menu.mdx +2 -2
- package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +2 -1
- package/src/components/silke-popover/silke-popover.mdx +14 -22
- package/src/components/silke-popover/silke-popover.tsx +21 -15
- package/src/components/silke-progress-indicator/silke-progress-indicator.mdx +33 -36
- package/src/components/silke-radio-button/silke-radio-button-group.tsx +1 -1
- package/src/components/silke-radio-button/silke-radio-button.mdx +1 -7
- package/src/components/silke-radio-button/silke-radio-button.scss +1 -0
- package/src/components/silke-search-field/silke-search-field.mdx +4 -12
- package/src/components/silke-select-field/silke-select-field.mdx +10 -10
- package/src/components/silke-slider/silke-slider.mdx +59 -22
- package/src/components/silke-slider/silke-slider.tsx +23 -10
- package/src/components/silke-sortable-list/silke-nested-sortable-item.tsx +3 -3
- package/src/components/silke-sortable-list/silke-nested-sortable-utils.ts +1 -0
- package/src/components/silke-sortable-list/silke-sortable-item-wrapper.tsx +4 -1
- package/src/components/silke-sortable-list/silke-sortable-list.mdx +54 -58
- package/src/components/silke-sortable-list/silke-sortable-list.scss +2 -2
- package/src/components/silke-sortable-list/silke-sortable-list.tsx +3 -0
- package/src/components/silke-table/silke-table.mdx +75 -75
- package/src/components/silke-table/silke-table.scss +27 -13
- package/src/components/silke-table/silke-table.tsx +13 -3
- package/src/components/silke-table/table-row.tsx +6 -1
- package/src/components/silke-table/table-types.ts +1 -1
- package/src/components/silke-tabs/silke-tabs.mdx +2 -2
- package/src/components/silke-tag/silke-tag.mdx +38 -79
- package/src/components/silke-tag/silke-tag.scss +12 -5
- package/src/components/silke-tag/silke-tag.tsx +1 -0
- package/src/components/silke-text/silke-text.mdx +50 -48
- package/src/components/silke-text/silke-text.scss +4 -2
- package/src/components/silke-text/silke-title.scss +29 -15
- package/src/components/silke-text-field/silke-text-field-outline.tsx +9 -1
- package/src/components/silke-text-field/silke-text-field.mdx +67 -71
- package/src/components/silke-text-field/silke-text-field.scss +4 -3
- package/src/components/silke-text-field/silke-text-field.tsx +16 -16
- package/src/components/silke-text-field/text-field-context.tsx +7 -2
- package/src/components/silke-tile/index.ts +0 -1
- package/src/components/silke-tile/silke-tile.mdx +6 -63
- package/src/components/silke-tile/silke-tile.tsx +4 -4
- package/src/components/silke-toggle/silke-toggle.mdx +5 -29
- package/src/components/silke-toggle/silke-toggle.scss +3 -2
- package/src/components/silke-toolbar/silke-toolbar.mdx +6 -6
- package/src/components/silke-tooltip/silke-definition-tooltip.tsx +3 -0
- package/src/components/silke-tooltip/silke-icon-tooltip.tsx +5 -2
- package/src/components/silke-tooltip/silke-tooltip.mdx +16 -34
- package/src/components/silke-tooltip/silke-tooltip.scss +3 -2
- package/src/components/silke-tooltip/silke-tooltip.tsx +15 -4
- package/src/components/silke-upload-field/silke-upload-field.tsx +1 -0
- package/src/components/silke-variables-wrapper/silke-variables-wrapper-form.tsx +30 -50
- package/src/components/silke-variables-wrapper/silke-variables-wrapper.mdx +56 -15
- package/src/components/silke-variables-wrapper/silke-variables-wrapper.scss +0 -2
- package/src/components/silke-variables-wrapper/silke-variables-wrapper.tsx +107 -44
- package/src/docs/data/flux/store.ts +0 -1
- package/src/hooks/drag-and-drop/use-drop.tsx +1 -1
- package/src/hooks/hooks.mdx +3 -3
- package/src/icons.tsx +104 -4
- package/src/index.mdx +30 -31
- package/src/playground.mdx +58 -47
- package/src/silke-theme-provider.tsx +1 -0
- package/src/styles/core.scss +10 -14
- package/dist/silke/src/components/silke-steps/index.d.ts +0 -1
- package/dist/silke/src/components/silke-steps/silke-steps.d.ts +0 -12
- package/dist/silke/src/components/silke-tile/silke-tile-select.d.ts +0 -26
- package/src/components/silke-steps/index.ts +0 -1
- package/src/components/silke-steps/silke-steps.mdx +0 -60
- package/src/components/silke-steps/silke-steps.scss +0 -14
- package/src/components/silke-steps/silke-steps.tsx +0 -53
- package/src/components/silke-tile/silke-tile-select.tsx +0 -100
|
@@ -6,6 +6,8 @@ import { SchemaContextModel } from './context';
|
|
|
6
6
|
import { VevEvent } from './event';
|
|
7
7
|
export type VevManifest = Partial<Omit<FSWidgetPkgManifest, 'type' | 'size' | 'icon'>> & {
|
|
8
8
|
name: string;
|
|
9
|
+
/** Override with specific widget key */
|
|
10
|
+
overrideKey?: string;
|
|
9
11
|
type?: 'standard' | 'section' | 'both' | 'action';
|
|
10
12
|
children?: {
|
|
11
13
|
name: string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type ResourceFileManifest = {
|
|
2
|
+
project: {
|
|
3
|
+
title: string;
|
|
4
|
+
key: string;
|
|
5
|
+
account: string;
|
|
6
|
+
};
|
|
7
|
+
created: string;
|
|
8
|
+
/**
|
|
9
|
+
* Files in the manifest
|
|
10
|
+
*/
|
|
11
|
+
files: ResourceFile[];
|
|
12
|
+
};
|
|
13
|
+
export type ResourceFile = {
|
|
14
|
+
/**
|
|
15
|
+
* Relative path of the resource
|
|
16
|
+
*/
|
|
17
|
+
path: string;
|
|
18
|
+
/**
|
|
19
|
+
* Checksum of the content
|
|
20
|
+
*/
|
|
21
|
+
checksum: string;
|
|
22
|
+
/**
|
|
23
|
+
* URL to the resource can be found at
|
|
24
|
+
*/
|
|
25
|
+
url: string;
|
|
26
|
+
/**
|
|
27
|
+
* Human readable name for debugging
|
|
28
|
+
*/
|
|
29
|
+
displayName?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Mime type of the content
|
|
32
|
+
*/
|
|
33
|
+
contentType: string;
|
|
34
|
+
/**
|
|
35
|
+
* Byte length of content
|
|
36
|
+
*/
|
|
37
|
+
contentLength: number;
|
|
38
|
+
/** *
|
|
39
|
+
* Immutable is true when the file is not expected to change.
|
|
40
|
+
* It is recommended to set cache-control headers to a long time for immutable files.
|
|
41
|
+
* If not set we recommend to set cache-control to 1 hour, but this depends on your setup
|
|
42
|
+
*/
|
|
43
|
+
immutable?: boolean;
|
|
44
|
+
gzipContentLength: number;
|
|
45
|
+
metadata?: Record<string, any>;
|
|
46
|
+
};
|
|
@@ -48,6 +48,18 @@ export interface ProjectVideoAsset extends BaseProjectAsset {
|
|
|
48
48
|
duration?: number;
|
|
49
49
|
state?: 'uploading' | 'encoding' | 'completed' | 'error' | 'preUpload';
|
|
50
50
|
additionalSources: Omit<ProjectVideoAsset, 'additionalSources'>[];
|
|
51
|
+
original?: {
|
|
52
|
+
path: string;
|
|
53
|
+
bucket: string;
|
|
54
|
+
url: string;
|
|
55
|
+
encodingProgress?: number;
|
|
56
|
+
width?: number;
|
|
57
|
+
height?: number;
|
|
58
|
+
duration?: number;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface ProjectAudioAsset extends BaseProjectAsset {
|
|
62
|
+
length: number;
|
|
51
63
|
}
|
|
52
64
|
export type ProjectAsset = BaseProjectAsset | ProjectImageAsset | ProjectVideoAsset;
|
|
53
65
|
export declare enum EditorPluginType {
|
|
@@ -31,6 +31,7 @@ export type BaseField<Type extends NativeTypes, TsType> = {
|
|
|
31
31
|
title?: string;
|
|
32
32
|
description?: string;
|
|
33
33
|
storage?: 'project' | 'workspace' | 'account';
|
|
34
|
+
clearProps?: string[];
|
|
34
35
|
initialValue?: TsType | EvalCallback | ((context: Omit<SchemaContextModel, 'actions'>) => TsType | Promise<TsType>);
|
|
35
36
|
onChange?: (value: TsType, context: SchemaContextModel) => void | TsType | Promise<void | TsType> | EvalCallback;
|
|
36
37
|
validate?: (value: TsType, context: SchemaContextModel) => boolean | Promise<boolean>;
|
|
@@ -48,8 +49,14 @@ export type SelectItem<T = any> = {
|
|
|
48
49
|
label: string;
|
|
49
50
|
value: T;
|
|
50
51
|
};
|
|
52
|
+
export type Suggestion = {
|
|
53
|
+
icon: React.ReactNode;
|
|
54
|
+
label: string;
|
|
55
|
+
value: string;
|
|
56
|
+
};
|
|
51
57
|
export type StringField = BaseField<'string', string> & {
|
|
52
58
|
options?: {
|
|
59
|
+
suggestions?: Suggestion[];
|
|
53
60
|
type: 'text' | 'date' | 'email' | 'url' | 'password';
|
|
54
61
|
multiline?: boolean | number;
|
|
55
62
|
minLength?: number;
|
|
@@ -59,6 +66,7 @@ export type StringField = BaseField<'string', string> & {
|
|
|
59
66
|
};
|
|
60
67
|
export type NumberField = BaseField<'number', number> & {
|
|
61
68
|
options?: {
|
|
69
|
+
suggestions?: Suggestion[];
|
|
62
70
|
min?: number;
|
|
63
71
|
max?: number;
|
|
64
72
|
/**
|
|
@@ -91,9 +99,12 @@ export type ObjectField = BaseField<'object', {
|
|
|
91
99
|
}> & {
|
|
92
100
|
fields: VevProps[];
|
|
93
101
|
};
|
|
94
|
-
export type ArrayField = BaseField<'array', any[]> & {
|
|
102
|
+
export type ArrayField = BaseField<'array', any[]> & ({
|
|
95
103
|
of: VevProps[] | 'string' | 'number';
|
|
96
|
-
}
|
|
104
|
+
} | {
|
|
105
|
+
of: 'object';
|
|
106
|
+
fields: VevProps[];
|
|
107
|
+
});
|
|
97
108
|
export type LinkField = BaseField<'link', {
|
|
98
109
|
/**
|
|
99
110
|
* Preset for what linkType the field should be.
|
|
@@ -125,6 +136,12 @@ export type UploadField = BaseField<'upload', UploadType> & {
|
|
|
125
136
|
};
|
|
126
137
|
export type WidgetSelectField = BaseField<'widgetSelect', string>;
|
|
127
138
|
export type MenuField = BaseField<'menu', string>;
|
|
139
|
+
export type VariableField = BaseField<'variable', string> & {
|
|
140
|
+
variableType?: 'color' | 'number' | 'font' | 'text';
|
|
141
|
+
};
|
|
142
|
+
export type DividerField = Omit<BaseField<'divider', string>, 'name'> & {
|
|
143
|
+
name?: string;
|
|
144
|
+
};
|
|
128
145
|
export type SchemaFieldTypes = {
|
|
129
146
|
string: StringField;
|
|
130
147
|
array: ArrayField;
|
|
@@ -141,6 +158,8 @@ export type SchemaFieldTypes = {
|
|
|
141
158
|
upload: UploadField;
|
|
142
159
|
widgetSelect: WidgetSelectField;
|
|
143
160
|
menu: MenuField;
|
|
161
|
+
variable: VariableField;
|
|
162
|
+
divider: DividerField;
|
|
144
163
|
};
|
|
145
164
|
export type NativeTypes = keyof SchemaFieldTypes;
|
|
146
165
|
export type VevProps = SchemaFieldTypes[NativeTypes];
|
|
@@ -150,6 +169,8 @@ export type SchemaFieldProps<T extends VevProps> = {
|
|
|
150
169
|
value: T['valueType'];
|
|
151
170
|
schema: T;
|
|
152
171
|
help?: string;
|
|
172
|
+
disabled?: boolean;
|
|
173
|
+
readonly?: boolean;
|
|
153
174
|
onChange: (value: NonNullable<T['valueType']> | null) => void;
|
|
154
175
|
context: SchemaContextModel;
|
|
155
176
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vev/silke",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/silke/src/index.d.ts",
|
|
@@ -9,13 +9,15 @@
|
|
|
9
9
|
"start:docs": "cross-env TS_NODE_PROJECT=\"../../tsconfig.webpack.json\" webpack serve --env development --config ./webpack.docs.ts",
|
|
10
10
|
"build": "yarn clean && run-p tsc build:code",
|
|
11
11
|
"build:code": "node ./esbuild.config.mjs",
|
|
12
|
-
"build:types": "tsc --project tsconfig.types.json",
|
|
13
12
|
"build:docs": "yarn clean && cross-env TS_NODE_PROJECT=\"../../tsconfig.webpack.json\" webpack --env production --config ./webpack.docs.ts",
|
|
13
|
+
"build:types": "tsc --project tsconfig.types.json",
|
|
14
|
+
"clean": "del-cli dist",
|
|
15
|
+
"test": "jest --silent --forceExit --runInBand --passWithNoTests",
|
|
16
|
+
"test:ci": "jest --runInBand --forceExit --reporters='github-actions' --passWithNoTests",
|
|
17
|
+
"tsc": "tsc --project ./tsconfig.json --emitDeclarationOnly --outDir ./dist",
|
|
14
18
|
"watch": "run-p watch:tsc watch:code",
|
|
15
19
|
"watch:code": "node esbuild.config.mjs --watch",
|
|
16
|
-
"watch:tsc": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch"
|
|
17
|
-
"clean": "del-cli dist",
|
|
18
|
-
"tsc": "tsc --project ./tsconfig.json --emitDeclarationOnly --outDir ./dist"
|
|
20
|
+
"watch:tsc": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch"
|
|
19
21
|
},
|
|
20
22
|
"peerDependencies": {
|
|
21
23
|
"react": ">=16.0.0",
|
|
@@ -32,8 +34,9 @@
|
|
|
32
34
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
33
35
|
"@uiw/codemirror-theme-dracula": "^4.12.3",
|
|
34
36
|
"@uiw/react-codemirror": "^4.12.3",
|
|
35
|
-
"@vev/
|
|
36
|
-
"@vev/
|
|
37
|
+
"@vev/interactions": "*",
|
|
38
|
+
"@vev/react": "*",
|
|
39
|
+
"@vev/utils": "*",
|
|
37
40
|
"classnames": ">=2.2.0",
|
|
38
41
|
"flux": "^4.0.4",
|
|
39
42
|
"lodash": "^4.17.21",
|
|
@@ -44,6 +47,10 @@
|
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
49
|
"@types/project-name-generator": "^2",
|
|
47
|
-
"cross-env": "^7.0.3"
|
|
50
|
+
"cross-env": "^7.0.3",
|
|
51
|
+
"del-cli": "*",
|
|
52
|
+
"jest": "*",
|
|
53
|
+
"npm-run-all": "*",
|
|
54
|
+
"typescript": "5.7.3"
|
|
48
55
|
}
|
|
49
56
|
}
|
package/project.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "silke",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "{projectRoot}/src",
|
|
5
|
+
"projectType": "library",
|
|
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
|
+
"watch": {
|
|
17
|
+
"command": "yarn workspace @vev/silke watch",
|
|
18
|
+
"dependsOn": ["^build"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
package/public/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,500,700" rel="stylesheet" />
|
|
9
9
|
<link
|
|
10
|
-
href="https://fonts.googleapis.com/
|
|
10
|
+
href="https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,slnt,wdth,wght,GRAD,XOPQ,XTRA,YOPQ,YTAS,YTDE,YTFI,YTLC,YTUC@8..144,-10..0,25..151,100..1000,-200..150,27..175,323..603,25..135,649..854,-305..-98,560..788,416..570,528..760&display=swap"
|
|
11
11
|
rel="stylesheet"
|
|
12
12
|
/>
|
|
13
13
|
<link
|
|
@@ -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.7.2/css/all.min.css" >
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
<div id="root" style="width: 100%;height:100%;"></div>
|
package/src/_variables.scss
CHANGED
|
@@ -87,6 +87,13 @@ $colors:
|
|
|
87
87
|
"support-tertiary-40" #E065C2,
|
|
88
88
|
"support-tertiary-50" #E087CA,
|
|
89
89
|
"support-tertiary-60" #F2CEE9,
|
|
90
|
+
// Support/quaternary
|
|
91
|
+
"support-quaternary-10" #492B8F,
|
|
92
|
+
"support-quaternary-20" #5F38B9,
|
|
93
|
+
"support-quaternary-30" #7850D2,
|
|
94
|
+
"support-quaternary-40" #936CEC,
|
|
95
|
+
"support-quaternary-50" #AE90F0,
|
|
96
|
+
"support-quaternary-60" #C8B5F3,
|
|
90
97
|
|
|
91
98
|
/**********
|
|
92
99
|
* Brand colors *
|
|
@@ -128,9 +135,9 @@ $colors:
|
|
|
128
135
|
/**********************
|
|
129
136
|
* FONT
|
|
130
137
|
************************/
|
|
131
|
-
$font-family: "
|
|
132
|
-
$font-family-brand: "
|
|
133
|
-
$font-family-login: "Iskry", "
|
|
138
|
+
$font-family: "Roboto Flex", serif;
|
|
139
|
+
$font-family-brand: "Roboto Flex", serif;
|
|
140
|
+
$font-family-login: "Iskry", "Roboto Flex", sans-serif;
|
|
134
141
|
$font-mono: "Source Code Pro", monospace;
|
|
135
142
|
$font-weight: normal;
|
|
136
143
|
$font-style: normal;
|
|
@@ -139,6 +146,8 @@ $font-weight-header: 400;
|
|
|
139
146
|
$font-micro: 10px;
|
|
140
147
|
$font-small: 12px;
|
|
141
148
|
$font-base: 14px;
|
|
149
|
+
$font-variation-settings: '"slnt" 0, "wdth" 78, "GRAD" -30, "XOPQ" 96, "XTRA" 468, "YOPQ" 79, "YTAS" 674, "YTDE" -203, "YTFI" 710, "YTLC" 490, "YTUC" 670';
|
|
150
|
+
$font-variation-settings-brand: '"slnt" 0, "wdth" 110, "GRAD" 40, "XOPQ" 85, "XTRA" 486, "YOPQ" 79, "YTAS" 680, "YTDE" -203, "YTFI" 710, "YTLC" 508, "YTUC" 680';
|
|
142
151
|
|
|
143
152
|
/**********************
|
|
144
153
|
* SPACING
|
|
@@ -147,12 +156,13 @@ $space-none: 0px;
|
|
|
147
156
|
$space-xxs: 2px;
|
|
148
157
|
$space-xs: 4px;
|
|
149
158
|
$space-s: 8px;
|
|
159
|
+
$space-sm:12px;
|
|
150
160
|
$space-m: 16px;
|
|
151
161
|
$space-l: 24px;
|
|
152
162
|
$space-xl: 32px;
|
|
153
163
|
$space-xxl: 48px;
|
|
154
164
|
$space-xxxl: 64px;
|
|
155
|
-
$space: "xxs" $space-xxs, "xs" $space-xs, "s" $space-s, "m" $space-m,
|
|
165
|
+
$space: "xxs" $space-xxs, "xs" $space-xs, "s" $space-s, "sm" $space-sm, "m" $space-m,
|
|
156
166
|
"l" $space-l, "xl" $space-xl, "xxl" $space-xxl, "xxxl" $space-xxxl, "none" $space-none;
|
|
157
167
|
|
|
158
168
|
/**********************
|
|
@@ -165,6 +175,8 @@ $size-m: 40px;
|
|
|
165
175
|
$size-l: 48px;
|
|
166
176
|
$size-xl: 64px;
|
|
167
177
|
$size-xxl: 80px;
|
|
178
|
+
$size-256: 256px;
|
|
179
|
+
$size-512: 512px;
|
|
168
180
|
$sizes:
|
|
169
181
|
"xs" $size-xs,
|
|
170
182
|
"s" $size-s,
|
|
@@ -172,7 +184,9 @@ $sizes:
|
|
|
172
184
|
"m" $size-m,
|
|
173
185
|
"l" $size-l,
|
|
174
186
|
"xl" $size-xl,
|
|
175
|
-
"xxl" $size-xxl
|
|
187
|
+
"xxl" $size-xxl,
|
|
188
|
+
"256" $size-256,
|
|
189
|
+
"512" $size-512;
|
|
176
190
|
|
|
177
191
|
|
|
178
192
|
/**
|
package/src/components/index.ts
CHANGED
|
@@ -51,9 +51,9 @@ export * from './silke-icon-picker';
|
|
|
51
51
|
export * from './silke-object-field';
|
|
52
52
|
export * from './silke-radio-button';
|
|
53
53
|
export * from './silke-select-field';
|
|
54
|
-
export * from './silke-steps';
|
|
55
54
|
export * from './silke-text-field';
|
|
56
55
|
export * from './silke-toggle';
|
|
57
56
|
export * from './silke-upload-field';
|
|
58
57
|
export * from './silke-virtual';
|
|
59
58
|
export * from './silke-variables-wrapper';
|
|
59
|
+
export * from './silke-conditions-input';
|
|
@@ -20,6 +20,7 @@ export interface AutocompleteItemProps<T, U extends Entry<T>> {
|
|
|
20
20
|
selected?: boolean;
|
|
21
21
|
multiple?: boolean;
|
|
22
22
|
size?: BoxSize;
|
|
23
|
+
iconFontSize?: string;
|
|
23
24
|
onMouseDown: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
24
25
|
ItemRender?: React.FC<AutocompleteRenderItemProps<U>>;
|
|
25
26
|
}
|
|
@@ -30,6 +31,7 @@ export default function AutocompleteItem<T, U extends Entry<T>>({
|
|
|
30
31
|
multiple,
|
|
31
32
|
highlight,
|
|
32
33
|
size,
|
|
34
|
+
iconFontSize,
|
|
33
35
|
onMouseDown,
|
|
34
36
|
ItemRender,
|
|
35
37
|
}: AutocompleteItemProps<T, U>) {
|
|
@@ -47,9 +49,6 @@ export default function AutocompleteItem<T, U extends Entry<T>>({
|
|
|
47
49
|
let iconSize: BoxSize = size || 'm';
|
|
48
50
|
if (size === 'm') iconSize = 'base';
|
|
49
51
|
if (size === 'base') iconSize = 's';
|
|
50
|
-
// if (size === 's') iconSize = 's';
|
|
51
|
-
// else if (size === 'xs') iconSize = 's';
|
|
52
|
-
// console.log('###### SIZE', size);
|
|
53
52
|
|
|
54
53
|
// For items with sublabel we need more space
|
|
55
54
|
let boxSize: BoxSize = size || 'm';
|
|
@@ -89,18 +88,25 @@ export default function AutocompleteItem<T, U extends Entry<T>>({
|
|
|
89
88
|
|
|
90
89
|
{item.icon && (
|
|
91
90
|
<SilkeBox size={iconSize} align="center">
|
|
92
|
-
<SilkeIcon icon={item.icon} />
|
|
91
|
+
<SilkeIcon icon={item.icon} style={{ fontSize: iconFontSize }} />
|
|
93
92
|
</SilkeBox>
|
|
94
93
|
)}
|
|
95
94
|
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
95
|
+
<SilkeBox column>
|
|
96
|
+
<SilkeText
|
|
97
|
+
size={size === 's' ? 'small' : undefined}
|
|
98
|
+
tag={size === 's' ? 'small' : undefined}
|
|
99
|
+
overflow
|
|
100
|
+
color={isDisabled ? 'neutral-40' : undefined}
|
|
101
|
+
>
|
|
102
|
+
{label}
|
|
103
|
+
</SilkeText>
|
|
104
|
+
{item.subLabel && (
|
|
105
|
+
<SilkeTextMicro overflow color="neutral-60">
|
|
106
|
+
{item.subLabel}
|
|
107
|
+
</SilkeTextMicro>
|
|
108
|
+
)}
|
|
109
|
+
</SilkeBox>
|
|
104
110
|
</>
|
|
105
111
|
)}
|
|
106
112
|
</SilkeBox>
|
|
@@ -6,6 +6,7 @@ import { SilkeBox } from '../silke-box';
|
|
|
6
6
|
export interface AutocompleteTagsProps<T> {
|
|
7
7
|
showMaxTags?: number;
|
|
8
8
|
items: Data<T>[];
|
|
9
|
+
tiny?: boolean;
|
|
9
10
|
onRemove: (value: T) => void;
|
|
10
11
|
onRemoveAll: () => void;
|
|
11
12
|
}
|
|
@@ -13,6 +14,7 @@ export interface AutocompleteTagsProps<T> {
|
|
|
13
14
|
export default function AutocompleteTags<T>({
|
|
14
15
|
showMaxTags = 10,
|
|
15
16
|
items,
|
|
17
|
+
tiny,
|
|
16
18
|
onRemove,
|
|
17
19
|
onRemoveAll,
|
|
18
20
|
}: AutocompleteTagsProps<T>) {
|
|
@@ -24,6 +26,7 @@ export default function AutocompleteTags<T>({
|
|
|
24
26
|
{items.map((item, i) => (
|
|
25
27
|
<SilkeTag
|
|
26
28
|
color="blue"
|
|
29
|
+
size={tiny ? 'tiny' : undefined}
|
|
27
30
|
key={i}
|
|
28
31
|
label={item.label}
|
|
29
32
|
onRemove={(e) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
```js
|
|
2
2
|
const items = ipsum.list((i) => ({ value: i, label: ipsum.name() }));
|
|
3
|
-
const [value, setValue] = React.useState(
|
|
3
|
+
const [value, setValue] = React.useState('');
|
|
4
4
|
<>
|
|
5
|
-
<h5>Value: {value ||
|
|
5
|
+
<h5>Value: {value || 'No value'}</h5>
|
|
6
6
|
<SilkeTextField name="test" label="Text before" />
|
|
7
|
-
{[
|
|
7
|
+
{['default', 'zombie', 'ghost'].map((kind) => (
|
|
8
8
|
<SilkeBox key={kind} gap="s">
|
|
9
9
|
<SilkeAutocompleteField
|
|
10
10
|
label={kind}
|
|
@@ -38,13 +38,13 @@ const items = ipsum.list((i) => ({
|
|
|
38
38
|
value: i,
|
|
39
39
|
label: ipsum.name(),
|
|
40
40
|
subLabel: ipsum.name(),
|
|
41
|
-
icon:
|
|
41
|
+
icon: 'variable.color',
|
|
42
42
|
}));
|
|
43
|
-
const [value, setValue] = React.useState(
|
|
43
|
+
const [value, setValue] = React.useState('');
|
|
44
44
|
<>
|
|
45
|
-
<h5>Value: {value ||
|
|
45
|
+
<h5>Value: {value || 'No value'}</h5>
|
|
46
46
|
<SilkeTextField name="test" label="Text before" />
|
|
47
|
-
{[
|
|
47
|
+
{['default', 'zombie', 'ghost'].map((kind) => (
|
|
48
48
|
<SilkeBox key={kind} gap="s">
|
|
49
49
|
<SilkeAutocompleteField
|
|
50
50
|
label={kind}
|
|
@@ -77,8 +77,8 @@ const [value, setValue] = React.useState("");
|
|
|
77
77
|
const items = ipsum.list((i) => ({ value: i, label: ipsum.name() }));
|
|
78
78
|
const [value, setValue] = React.useState([]);
|
|
79
79
|
<>
|
|
80
|
-
<h5>Value: {value.join(
|
|
81
|
-
{[
|
|
80
|
+
<h5>Value: {value.join(', ') || 'No value'}</h5>
|
|
81
|
+
{['default', 'zombie', 'ghost'].map((kind) => (
|
|
82
82
|
<SilkeAutocompleteField
|
|
83
83
|
key={kind}
|
|
84
84
|
label={kind}
|
|
@@ -97,9 +97,9 @@ const [value, setValue] = React.useState([]);
|
|
|
97
97
|
## Autocomplete add new items
|
|
98
98
|
|
|
99
99
|
```js
|
|
100
|
-
const itemsArray = [
|
|
100
|
+
const itemsArray = ['Banana', 'Apple', 'Carrot', 'Chips'];
|
|
101
101
|
const [items, setitems] = React.useState(() =>
|
|
102
|
-
itemsArray.map((i) => ({ value: i.toLowerCase(), label: i }))
|
|
102
|
+
itemsArray.map((i) => ({ value: i.toLowerCase(), label: i })),
|
|
103
103
|
);
|
|
104
104
|
const [value, setValue] = React.useState([]);
|
|
105
105
|
|
|
@@ -142,13 +142,13 @@ const items = values.map((i) => ({ value: i.toLowerCase(), label: i }));
|
|
|
142
142
|
const items = ipsum.list((i) => ({
|
|
143
143
|
value: i,
|
|
144
144
|
label: ipsum.name(),
|
|
145
|
-
icon:
|
|
145
|
+
icon: 'html5',
|
|
146
146
|
}));
|
|
147
|
-
const [value, setValue] = React.useState(
|
|
147
|
+
const [value, setValue] = React.useState('');
|
|
148
148
|
<>
|
|
149
|
-
<h5>Value: {value ||
|
|
149
|
+
<h5>Value: {value || 'No value'}</h5>
|
|
150
150
|
<SilkeTextField name="test" label="Text before" />
|
|
151
|
-
{[
|
|
151
|
+
{['default', 'zombie', 'ghost'].map((kind) => (
|
|
152
152
|
<SilkeBox key={kind} gap="s">
|
|
153
153
|
<SilkeAutocompleteField
|
|
154
154
|
label={kind}
|
|
@@ -30,6 +30,7 @@ export type SilkeAutocompleteFieldProps<T = any, U extends Entry<T> = any> = (
|
|
|
30
30
|
hideListArrow?: boolean;
|
|
31
31
|
isVariable?: boolean;
|
|
32
32
|
maxDisplayedItems?: number;
|
|
33
|
+
maxDisplayedItemsLabel?: React.ReactNode;
|
|
33
34
|
showAddIcon?: boolean;
|
|
34
35
|
selectedVariableKey?: string;
|
|
35
36
|
|
|
@@ -48,6 +49,7 @@ export type SilkeAutocompleteFieldProps<T = any, U extends Entry<T> = any> = (
|
|
|
48
49
|
* Minimum number of characters in search for results to show
|
|
49
50
|
*/
|
|
50
51
|
minChars?: number;
|
|
52
|
+
buttonRight?: ReactNode;
|
|
51
53
|
/** Cypress tag */
|
|
52
54
|
'data-cy'?: string;
|
|
53
55
|
/**
|
|
@@ -101,6 +103,7 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
101
103
|
onMouseDown,
|
|
102
104
|
hAlign,
|
|
103
105
|
onClose,
|
|
106
|
+
autoFocus,
|
|
104
107
|
...form
|
|
105
108
|
} = useFormField(props, autocompleteValidator);
|
|
106
109
|
const context = useTextFieldContext();
|
|
@@ -111,7 +114,7 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
111
114
|
const inputField = useRef<HTMLDivElement>();
|
|
112
115
|
const isSelected = (value: T): boolean => {
|
|
113
116
|
if (form.multiple) {
|
|
114
|
-
for (const v of form.value
|
|
117
|
+
for (const v of Array.isArray(form.value) ? form.value : []) {
|
|
115
118
|
if (isEqual(v, value)) return true;
|
|
116
119
|
}
|
|
117
120
|
return false;
|
|
@@ -158,12 +161,13 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
158
161
|
|
|
159
162
|
const handleRemoveSingle = (remove: T) => {
|
|
160
163
|
if (form.multiple && form.value) {
|
|
161
|
-
const value = form.value.filter((v: T) => remove !== v)
|
|
164
|
+
const value = Array.isArray(form.value) ? form.value.filter((v: T) => remove !== v) : [];
|
|
162
165
|
if (!isEqual(value, form.value)) form.onChange(value);
|
|
163
166
|
}
|
|
164
167
|
};
|
|
165
168
|
|
|
166
|
-
const displayReset =
|
|
169
|
+
const displayReset =
|
|
170
|
+
props.multiple && !form.noReset && Array.isArray(form.value) && form.value.length > 0;
|
|
167
171
|
const dataCy = props['data-cy'] || undefined;
|
|
168
172
|
const kind = props?.kind || context.kind || 'default';
|
|
169
173
|
|
|
@@ -216,8 +220,10 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
216
220
|
vAlign="center"
|
|
217
221
|
tag="button"
|
|
218
222
|
type="button"
|
|
223
|
+
autoFocus={autoFocus}
|
|
219
224
|
name={form.name}
|
|
220
|
-
value={form.value}
|
|
225
|
+
value={form.value as string}
|
|
226
|
+
color={context.color}
|
|
221
227
|
aria-labelledby={inputId}
|
|
222
228
|
hAlign="start"
|
|
223
229
|
data-input="true"
|
|
@@ -241,11 +247,12 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
241
247
|
if (!open && !disabled) setOpen(true);
|
|
242
248
|
}}
|
|
243
249
|
>
|
|
244
|
-
{form.multiple && form.value
|
|
245
|
-
<SilkeBox vPad={size === 'xs' ? '
|
|
250
|
+
{form.multiple && Array.isArray(form.value) && form.value.length > 0 ? (
|
|
251
|
+
<SilkeBox vPad={size === 'xs' ? 'xxs' : 'xs'} gap="xxs">
|
|
246
252
|
<TagsRender
|
|
247
253
|
items={selectedDataItems}
|
|
248
254
|
showMaxTags={form.showMaxTags}
|
|
255
|
+
tiny={size === 'xs'}
|
|
249
256
|
onRemove={handleRemoveSingle}
|
|
250
257
|
onRemoveAll={handleReset}
|
|
251
258
|
/>
|
|
@@ -276,27 +283,28 @@ export function SilkeAutocompleteField<T>(props: SilkeAutocompleteFieldProps<T>)
|
|
|
276
283
|
)}
|
|
277
284
|
</SilkeTextFieldItem>
|
|
278
285
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
<
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
<
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
286
|
+
{(displayReset || !hideListArrow) && (
|
|
287
|
+
<SilkeTextFieldItem
|
|
288
|
+
align="center"
|
|
289
|
+
width={dropDownSize}
|
|
290
|
+
className={styles.downIcon}
|
|
291
|
+
onClick={displayReset ? handleReset : undefined}
|
|
292
|
+
>
|
|
293
|
+
{(() => {
|
|
294
|
+
return displayReset ? (
|
|
295
|
+
<SilkeBox width="xs" height="s" align="center">
|
|
296
|
+
<SilkeIcon icon="close" />
|
|
297
|
+
</SilkeBox>
|
|
298
|
+
) : !hideListArrow ? (
|
|
299
|
+
<SilkeBox align="center" className={styles.arrow}>
|
|
300
|
+
<SilkeIcon icon={open ? 'chevron.up' : 'chevron.down'} />
|
|
301
|
+
</SilkeBox>
|
|
302
|
+
) : null;
|
|
303
|
+
})()}
|
|
304
|
+
</SilkeTextFieldItem>
|
|
305
|
+
)}
|
|
297
306
|
{after}
|
|
298
307
|
</SilkeTextFieldOutline>
|
|
299
|
-
|
|
300
308
|
{open && (
|
|
301
309
|
<SilkeAutocompletePopup
|
|
302
310
|
containerRef={containerRef}
|