@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { SilkeAutocompleteField } from '../silke-autocomplete-field';
|
|
3
3
|
import { useSilkeCSSContext } from '../silke-css-number-field';
|
|
4
4
|
import { SilkeBox } from '../silke-box';
|
|
@@ -11,6 +11,7 @@ import { getCSSNumberFormat } from '@vev/utils';
|
|
|
11
11
|
import { SilkeIcon } from '../silke-icon';
|
|
12
12
|
import { capitalize } from 'lodash';
|
|
13
13
|
import { SilkeVariablesWrapperForm } from './silke-variables-wrapper-form';
|
|
14
|
+
import { SilkeTooltip } from '../silke-tooltip';
|
|
14
15
|
|
|
15
16
|
export type LocalVariable = {
|
|
16
17
|
key: string;
|
|
@@ -18,6 +19,9 @@ export type LocalVariable = {
|
|
|
18
19
|
type: string;
|
|
19
20
|
value?: string;
|
|
20
21
|
unit?: string;
|
|
22
|
+
metadata?: {
|
|
23
|
+
label?: string;
|
|
24
|
+
};
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
const getRelevantVariables = (
|
|
@@ -59,19 +63,32 @@ export type SilkeVariablesWrapperProps<T extends React.ElementType> = {
|
|
|
59
63
|
formats?: string[];
|
|
60
64
|
variableType?: string;
|
|
61
65
|
fullWidthWrapper?: boolean;
|
|
66
|
+
templateVariable?: boolean;
|
|
62
67
|
onChange: (value: string) => void; // return key?
|
|
63
68
|
onVariableAdd?: (variable: LocalVariable) => Promise<string>;
|
|
64
69
|
onVariableEdit?: (key: string) => void;
|
|
65
70
|
} & React.ComponentProps<T>;
|
|
66
71
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
const DROPDOWN_WIDTH = 189;
|
|
73
|
+
|
|
74
|
+
const SUPPORTED_TYPES = ['text', 'number', 'color', 'image', 'video'];
|
|
75
|
+
|
|
76
|
+
export function SilkeVariablesWrapper<T extends React.ElementType>({
|
|
77
|
+
component,
|
|
78
|
+
formats,
|
|
79
|
+
variableType,
|
|
80
|
+
fullWidthWrapper,
|
|
81
|
+
templateVariable,
|
|
82
|
+
onVariableAdd,
|
|
83
|
+
onVariableEdit,
|
|
84
|
+
...rest
|
|
85
|
+
}: SilkeVariablesWrapperProps<T>) {
|
|
70
86
|
const [openVariables, setOpenVariables] = useState(false);
|
|
71
87
|
const [showAddNewForm, setShowAddNewForm] = useState(false);
|
|
72
|
-
const [
|
|
88
|
+
const [hovering, setHovering] = useState(false);
|
|
89
|
+
|
|
90
|
+
if (!formats) formats = [];
|
|
73
91
|
|
|
74
|
-
const { value, formats = [], variableType, onChange, component, ...rest } = props;
|
|
75
92
|
const rootRef = useRef<HTMLDivElement>(null);
|
|
76
93
|
const context = useSilkeCSSContext();
|
|
77
94
|
const textFieldContext = useTextFieldContext();
|
|
@@ -85,29 +102,60 @@ export function SilkeVariablesWrapper<T extends React.ElementType>(
|
|
|
85
102
|
return variables.map((v) => ({
|
|
86
103
|
label: v.name,
|
|
87
104
|
value: v.key,
|
|
88
|
-
subLabel: `${v.value}${v.unit ? `${v.unit}` : ''}`,
|
|
105
|
+
subLabel: `${v.metadata?.label || v.value}${v.unit ? `${v.unit}` : ''}`,
|
|
89
106
|
icon: getVariableIcon(v.type),
|
|
90
107
|
}));
|
|
91
108
|
}, [variables]);
|
|
92
109
|
|
|
93
|
-
const isVariable =
|
|
110
|
+
const isVariable =
|
|
111
|
+
typeof rest.value === 'string' &&
|
|
112
|
+
(rest.value?.startsWith('var(--vev-') || rest.value?.startsWith('{{'));
|
|
113
|
+
|
|
114
|
+
const supportedType = !variableType || SUPPORTED_TYPES.includes(variableType || '');
|
|
94
115
|
const hasVariables = variables.length > 0;
|
|
95
|
-
const currentVariable = variables.find(
|
|
116
|
+
const currentVariable = variables.find(
|
|
117
|
+
(v) => typeof rest.value === 'string' && rest.value?.includes(v.key),
|
|
118
|
+
);
|
|
96
119
|
const hasLabelTop =
|
|
97
120
|
rest.label && rest.inline !== 'label-inside' && textFieldContext.inline !== 'label-inside';
|
|
98
121
|
const offsetPx = rest.size === 'xs' || textFieldContext.size === 'xs' ? 16 : 18;
|
|
99
122
|
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
const el = rootRef.current;
|
|
125
|
+
if (el) {
|
|
126
|
+
let timeout = 0;
|
|
127
|
+
const handleMouseOver = () => {
|
|
128
|
+
clearTimeout(timeout);
|
|
129
|
+
timeout = self.setTimeout(() => setHovering(true), 300);
|
|
130
|
+
};
|
|
131
|
+
const handleMouseOut = () => {
|
|
132
|
+
clearTimeout(timeout);
|
|
133
|
+
setHovering(false);
|
|
134
|
+
};
|
|
135
|
+
el.addEventListener('mouseover', handleMouseOver, { passive: true });
|
|
136
|
+
el.addEventListener('mouseleave', handleMouseOut, { passive: true });
|
|
137
|
+
|
|
138
|
+
return () => {
|
|
139
|
+
el.removeEventListener('mouseover', handleMouseOver);
|
|
140
|
+
el.removeEventListener('mouseleave', handleMouseOver);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}, []);
|
|
144
|
+
|
|
100
145
|
const handleVariablesDotClicked = (e: React.MouseEvent) => {
|
|
101
146
|
e.preventDefault();
|
|
102
147
|
|
|
103
148
|
// If active variable, remove link and set to native value
|
|
104
149
|
if (isVariable) {
|
|
105
|
-
const variable = variables.find((v) => value?.includes(v.key));
|
|
106
|
-
onChange(variable ? `${variable.value}${variable.unit || ''}` : '0');
|
|
150
|
+
const variable = variables.find((v) => rest.value?.includes(v.key));
|
|
151
|
+
rest.onChange(variable ? `${variable.value}${variable.unit || ''}` : '0');
|
|
107
152
|
return;
|
|
108
153
|
}
|
|
109
|
-
|
|
110
|
-
|
|
154
|
+
if (hasVariables) {
|
|
155
|
+
setOpenVariables(true);
|
|
156
|
+
} else {
|
|
157
|
+
setShowAddNewForm(true);
|
|
158
|
+
}
|
|
111
159
|
};
|
|
112
160
|
|
|
113
161
|
const onShowAddForm = () => {
|
|
@@ -120,31 +168,41 @@ export function SilkeVariablesWrapper<T extends React.ElementType>(
|
|
|
120
168
|
setOpenVariables(true);
|
|
121
169
|
};
|
|
122
170
|
|
|
123
|
-
const
|
|
171
|
+
const handleVariableChange = (key: string) => {
|
|
172
|
+
// Tracking (if implemented)
|
|
173
|
+
const variable = variables.find((v) => v.key === key);
|
|
174
|
+
context?.onVariableAttached?.(variable?.type || '');
|
|
175
|
+
|
|
176
|
+
// Change the value
|
|
177
|
+
return variableType === 'text' || templateVariable
|
|
178
|
+
? rest.onChange(`{{${key}}}`)
|
|
179
|
+
: rest.onChange(`var(--vev-${key})`);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const handleVariableAdd = async ({ variableName }: { variableName: string }) => {
|
|
124
183
|
const newVariable = {
|
|
125
184
|
type: variableType,
|
|
126
|
-
name:
|
|
127
|
-
value: isVariable ? getVariableValue(value, context.variablesv2) || '0' : value,
|
|
185
|
+
name: variableName ? variableName : capitalize(variableType),
|
|
186
|
+
value: isVariable ? getVariableValue(rest.value, context.variablesv2) || '0' : rest.value,
|
|
128
187
|
unit: '',
|
|
129
188
|
};
|
|
130
189
|
|
|
131
190
|
if (variableType === 'number') {
|
|
132
191
|
newVariable.value = isVariable
|
|
133
|
-
? getVariableValue(value, context.variablesv2) || '0'
|
|
134
|
-
: String(parseFloat(value || '0'));
|
|
192
|
+
? getVariableValue(rest.value, context.variablesv2) || '0'
|
|
193
|
+
: String(parseFloat(rest.value || '0'));
|
|
135
194
|
newVariable.unit = isVariable
|
|
136
|
-
? getVariableUnit(value, context.variablesv2) || ''
|
|
137
|
-
: getCSSNumberFormat(value);
|
|
195
|
+
? getVariableUnit(rest.value, context.variablesv2) || ''
|
|
196
|
+
: getCSSNumberFormat(rest.value);
|
|
138
197
|
}
|
|
139
198
|
|
|
140
|
-
const newKey = await
|
|
199
|
+
const newKey = await onVariableAdd?.(newVariable);
|
|
141
200
|
|
|
142
201
|
if (newKey) {
|
|
143
|
-
|
|
202
|
+
handleVariableChange(newKey);
|
|
144
203
|
}
|
|
145
204
|
|
|
146
205
|
setShowAddNewForm(false);
|
|
147
|
-
setNewVariableName('');
|
|
148
206
|
};
|
|
149
207
|
|
|
150
208
|
const itemRender = (item: any) => (
|
|
@@ -169,13 +227,15 @@ export function SilkeVariablesWrapper<T extends React.ElementType>(
|
|
|
169
227
|
</SilkeBox>
|
|
170
228
|
|
|
171
229
|
<SilkeBox column style={{ minWidth: '0', flex: 1 }}>
|
|
172
|
-
<SilkeTextSmall overflow
|
|
230
|
+
<SilkeTextSmall overflow style={{ marginBottom: '-2px' }}>
|
|
231
|
+
{item.label}
|
|
232
|
+
</SilkeTextSmall>
|
|
173
233
|
<SilkeTextMicro overflow color="neutral-60">
|
|
174
234
|
{item.subLabel}
|
|
175
235
|
</SilkeTextMicro>
|
|
176
236
|
</SilkeBox>
|
|
177
237
|
|
|
178
|
-
{hoveredItem === item.value &&
|
|
238
|
+
{hoveredItem === item.value && onVariableEdit && (
|
|
179
239
|
<SilkeBox>
|
|
180
240
|
<SilkeButton
|
|
181
241
|
icon="settings"
|
|
@@ -184,7 +244,7 @@ export function SilkeVariablesWrapper<T extends React.ElementType>(
|
|
|
184
244
|
onMouseDown={(e) => {
|
|
185
245
|
e.preventDefault;
|
|
186
246
|
e.stopPropagation();
|
|
187
|
-
|
|
247
|
+
onVariableEdit?.(item.value);
|
|
188
248
|
}}
|
|
189
249
|
/>
|
|
190
250
|
</SilkeBox>
|
|
@@ -198,9 +258,9 @@ export function SilkeVariablesWrapper<T extends React.ElementType>(
|
|
|
198
258
|
ref={rootRef}
|
|
199
259
|
data-open={openVariables || showAddNewForm}
|
|
200
260
|
data-is-variable={isVariable}
|
|
201
|
-
data-full-width={
|
|
261
|
+
data-full-width={fullWidthWrapper}
|
|
202
262
|
>
|
|
203
|
-
{
|
|
263
|
+
{supportedType && (
|
|
204
264
|
<div
|
|
205
265
|
className={styles.variableDot}
|
|
206
266
|
data-icon={isVariable ? '−' : '+'}
|
|
@@ -208,47 +268,50 @@ export function SilkeVariablesWrapper<T extends React.ElementType>(
|
|
|
208
268
|
style={{ top: hasLabelTop ? offsetPx : 0 }}
|
|
209
269
|
/>
|
|
210
270
|
)}
|
|
271
|
+
{hovering && isVariable && currentVariable && (
|
|
272
|
+
<SilkeTooltip show anchor={rootRef} anchorOrigin="top-center" targetOrigin="bottom-center">
|
|
273
|
+
{currentVariable?.name}
|
|
274
|
+
</SilkeTooltip>
|
|
275
|
+
)}
|
|
211
276
|
{isVariable ? (
|
|
212
277
|
<SilkeAutocompleteField
|
|
213
|
-
{...
|
|
278
|
+
{...rest}
|
|
214
279
|
isVariable
|
|
215
280
|
items={variableItems}
|
|
281
|
+
searchPlaceholder="Search variables"
|
|
216
282
|
renderItem={({ item }) => itemRender(item)}
|
|
217
283
|
value={getVariableDisplayText(variableType, currentVariable)}
|
|
218
284
|
selectedVariableKey={currentVariable?.key}
|
|
219
|
-
dropDownMinWidth={
|
|
220
|
-
dropDownMaxWidth={
|
|
221
|
-
width={
|
|
222
|
-
onChange={
|
|
285
|
+
dropDownMinWidth={DROPDOWN_WIDTH}
|
|
286
|
+
dropDownMaxWidth={DROPDOWN_WIDTH}
|
|
287
|
+
width={rest.width}
|
|
288
|
+
onChange={handleVariableChange}
|
|
289
|
+
hideListArrow
|
|
223
290
|
disableAddFromList
|
|
224
291
|
/>
|
|
225
292
|
) : (
|
|
226
|
-
<div>
|
|
227
|
-
{component && React.createElement(component, { value, formats, onChange, ...rest })}
|
|
228
|
-
</div>
|
|
293
|
+
<div>{component && React.createElement(component, { ...rest, formats })}</div>
|
|
229
294
|
)}
|
|
230
|
-
|
|
231
295
|
{openVariables && (
|
|
232
296
|
<SilkeAutocompletePopup
|
|
233
297
|
containerRef={rootRef}
|
|
234
298
|
renderItem={({ item }) => itemRender(item)}
|
|
235
|
-
dropDownMinWidth={
|
|
236
|
-
dropDownMaxWidth={
|
|
299
|
+
dropDownMinWidth={DROPDOWN_WIDTH}
|
|
300
|
+
dropDownMaxWidth={DROPDOWN_WIDTH}
|
|
237
301
|
items={variableItems}
|
|
238
302
|
value={currentVariable?.name}
|
|
239
303
|
onAdd={onShowAddForm}
|
|
240
|
-
onChange={
|
|
304
|
+
onChange={handleVariableChange}
|
|
241
305
|
onRequestClose={() => setOpenVariables(false)}
|
|
242
|
-
showAddIcon={!!
|
|
306
|
+
showAddIcon={!!onVariableAdd}
|
|
307
|
+
searchPlaceholder="Search variables"
|
|
243
308
|
disableAddFromList
|
|
244
309
|
/>
|
|
245
310
|
)}
|
|
246
|
-
|
|
247
311
|
{showAddNewForm && (
|
|
248
312
|
<SilkeVariablesWrapperForm
|
|
249
313
|
containerRef={rootRef}
|
|
250
|
-
|
|
251
|
-
onChange={(value) => setNewVariableName(value)}
|
|
314
|
+
variableValue={rest.value}
|
|
252
315
|
onSubmit={handleVariableAdd}
|
|
253
316
|
onClose={onHideAddForm}
|
|
254
317
|
/>
|
|
@@ -36,7 +36,6 @@ export class Store extends QueuedModel {
|
|
|
36
36
|
const listeners = actions[type];
|
|
37
37
|
if (listeners) {
|
|
38
38
|
for (const funcName of listeners) {
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
40
39
|
// @ts-ignore don know how to make typescript support this
|
|
41
40
|
this[funcName](type, payload);
|
|
42
41
|
}
|
package/src/hooks/hooks.mdx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Silke React Hooks
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
|
-
const ref = useHTMLElement(
|
|
4
|
+
const ref = useHTMLElement('div', {}, document.body);
|
|
5
5
|
return ReactDOM.createPortal(
|
|
6
|
-
<h1 style={{ position:
|
|
7
|
-
ref.current
|
|
6
|
+
<h1 style={{ position: 'absolute', top: 200, left: 300 }}>In a portal</h1>,
|
|
7
|
+
ref.current,
|
|
8
8
|
);
|
|
9
9
|
```
|
package/src/icons.tsx
CHANGED
|
@@ -7,6 +7,8 @@ export const SilkeIconDefinitions = {
|
|
|
7
7
|
},
|
|
8
8
|
check: 'fa fa-check',
|
|
9
9
|
'check.circle': 'fas fa-check-circle',
|
|
10
|
+
'circle.duotone': 'fa-duotone fa-circle',
|
|
11
|
+
'circle.regular': 'fa-regular fa-circle',
|
|
10
12
|
close: 'fal fa-times',
|
|
11
13
|
delete: 'fal fa-trash',
|
|
12
14
|
edit: 'fal fa-edit',
|
|
@@ -16,6 +18,7 @@ export const SilkeIconDefinitions = {
|
|
|
16
18
|
community: 'fal fa-user-group-simple',
|
|
17
19
|
'check.circle.outline': 'fal fa-check-circle',
|
|
18
20
|
play: 'fal fa-play',
|
|
21
|
+
pause: 'fal fa-pause',
|
|
19
22
|
emoji: 'fal fa-smile',
|
|
20
23
|
'emoji.add': AddEmoji,
|
|
21
24
|
mention: 'fal fa-at',
|
|
@@ -26,6 +29,7 @@ export const SilkeIconDefinitions = {
|
|
|
26
29
|
sparkles: 'fa-solid fa-sparkles',
|
|
27
30
|
compare: 'fal fa-shuffle',
|
|
28
31
|
menuMore: 'fal fa-ellipsis-v',
|
|
32
|
+
menuMoreHorizontal: 'fal fa-ellipsis',
|
|
29
33
|
menu: 'fal fa-bars',
|
|
30
34
|
drag: 'fal fa-grip-lines',
|
|
31
35
|
'drag.dots': 'fa-solid fa-grip-dots-vertical',
|
|
@@ -46,12 +50,13 @@ export const SilkeIconDefinitions = {
|
|
|
46
50
|
filter: 'fal fa-sliders-simple',
|
|
47
51
|
copy: 'fal fa-copy',
|
|
48
52
|
paste: 'fal fa-paste',
|
|
53
|
+
'paste.add': 'fa-kit fa-paste-add',
|
|
49
54
|
random: 'fal fa-random',
|
|
50
55
|
question: 'fal fa-question-circle',
|
|
51
56
|
send: 'fal fa-paper-plane',
|
|
52
57
|
link: 'fal fa-link-simple',
|
|
53
58
|
unlink: 'fal fa-link-simple-slash',
|
|
54
|
-
'link.external': 'fal fa-
|
|
59
|
+
'link.external': 'fal fa-arrow-up-right',
|
|
55
60
|
flag: 'fal fa-flag',
|
|
56
61
|
sum: 'fal fa-sigma',
|
|
57
62
|
lock: 'fal fa-lock',
|
|
@@ -60,12 +65,14 @@ export const SilkeIconDefinitions = {
|
|
|
60
65
|
upload: 'fal fa-arrow-up-from-line',
|
|
61
66
|
crop: 'fal fa-crop-alt',
|
|
62
67
|
repeat: 'fal fa-repeat',
|
|
63
|
-
rotate: 'fal fa-
|
|
68
|
+
rotate: 'fal fa-angle-90',
|
|
64
69
|
square: 'fal fa-square',
|
|
65
70
|
shapes: 'fal fa-shapes',
|
|
66
71
|
sharedStyle: 'fal fa-pencil-paintbrush',
|
|
67
72
|
firefox: 'fab fa-firefox',
|
|
73
|
+
safari: 'fa-brands fa-safari',
|
|
68
74
|
'square.dashed': 'fal fa-square-dashed',
|
|
75
|
+
'square.small': 'fas fa-square-small',
|
|
69
76
|
hashtag: 'far fa-hashtag',
|
|
70
77
|
eye: 'fal fa-eye',
|
|
71
78
|
'eye.off': 'fal fa-eye-slash',
|
|
@@ -84,6 +91,9 @@ export const SilkeIconDefinitions = {
|
|
|
84
91
|
'network.off': 'fal fa-wifi-slash',
|
|
85
92
|
grid: 'fal fa-grid',
|
|
86
93
|
|
|
94
|
+
moon: 'fal fa-moon',
|
|
95
|
+
sun: 'fal fa-sun-bright',
|
|
96
|
+
|
|
87
97
|
notification: 'fal fa-bell',
|
|
88
98
|
'notification.new': 'fal fa-bell-on',
|
|
89
99
|
|
|
@@ -105,6 +115,7 @@ export const SilkeIconDefinitions = {
|
|
|
105
115
|
'folder.plus': 'fal fa-folder-plus',
|
|
106
116
|
folders: 'fal fa-folders',
|
|
107
117
|
file: 'fal fa-file',
|
|
118
|
+
'file.check': 'fa-light fa-file-check',
|
|
108
119
|
'file.arrow.up': 'fa-light fa-file-arrow-up',
|
|
109
120
|
'file.download': 'far fa-download',
|
|
110
121
|
|
|
@@ -113,6 +124,7 @@ export const SilkeIconDefinitions = {
|
|
|
113
124
|
'code.fork': 'fal fa-code-fork',
|
|
114
125
|
'code.compare': 'fal fa-code-compare',
|
|
115
126
|
'code.history': 'fal fa-clock-rotate-left',
|
|
127
|
+
messages: 'fal fa-comments-alt',
|
|
116
128
|
|
|
117
129
|
// KEYBOARD SYMBOLS
|
|
118
130
|
'keyboard.command': 'fa-light fa-command',
|
|
@@ -132,7 +144,12 @@ export const SilkeIconDefinitions = {
|
|
|
132
144
|
'chevron.down': 'fal fa-chevron-down',
|
|
133
145
|
'chevron.up': 'fal fa-chevron-up',
|
|
134
146
|
'chevron.right': 'fal fa-chevron-right',
|
|
135
|
-
'arrow.
|
|
147
|
+
'arrow.turn.down.left': 'fal fa-arrow-turn-down-left',
|
|
148
|
+
'arrow.turn.up.left': 'fal fa-arrow-turn-down-left fa-flip-vertical',
|
|
149
|
+
'arrow.up.right': 'fal fa-arrow-up-right',
|
|
150
|
+
'arrow.up.left': 'fal fa-arrow-up-left',
|
|
151
|
+
'arrow.down.left': 'fal fa-arrow-down-left',
|
|
152
|
+
'arrow.down.right': 'fal fa-arrow-down-right',
|
|
136
153
|
'caret.down': 'fas fa-caret-down',
|
|
137
154
|
'caret.up': 'fas fa-caret-up',
|
|
138
155
|
'caret.right': 'fas fa-caret-right',
|
|
@@ -152,6 +169,27 @@ export const SilkeIconDefinitions = {
|
|
|
152
169
|
'arrow.right.line': 'fal fa-arrow-right-to-line',
|
|
153
170
|
'arrow.from.right': 'fal fa-arrow-from-right',
|
|
154
171
|
'arrow.from.left': 'fal fa-arrow-from-left',
|
|
172
|
+
'arrow.down.left.and.up.right': 'fal fa-arrow-down-left-and-arrow-up-right-to-center',
|
|
173
|
+
'arrow.up.right.and.down.left': 'fal fa-arrow-up-right-and-arrow-down-left-from-center',
|
|
174
|
+
'arrows.left.right': 'fa-light fa-arrows-left-right-to-line',
|
|
175
|
+
'arrows.up.down': 'fa-light fa-arrows-left-right-to-line fa-rotate-90',
|
|
176
|
+
|
|
177
|
+
'padding.all': 'fa-kit fa-padding-all',
|
|
178
|
+
'padding.top.bottom': 'fa-kit fa-padding-horizontal fa-rotate-90',
|
|
179
|
+
'padding.left.right': 'fa-kit fa-padding-horizontal',
|
|
180
|
+
'padding.top': 'fa-light fa-arrow-up-to-line',
|
|
181
|
+
'padding.bottom': 'fa-light fa-arrow-down-to-line',
|
|
182
|
+
'padding.left': 'fa-light fa-arrow-left-to-line',
|
|
183
|
+
'padding.right': 'fa-light fa-arrow-right-to-line',
|
|
184
|
+
'height.min': 'fa-kit fa-min-size fa-rotate-90',
|
|
185
|
+
'height.max': 'fa-kit fa-max-size fa-rotate-90',
|
|
186
|
+
'width.min': 'fa-kit fa-min-size',
|
|
187
|
+
'width.max': 'fa-kit fa-max-size',
|
|
188
|
+
'gap.horizontal': 'fa-kit fa-gap',
|
|
189
|
+
'gap.vertical': 'fa-kit fa-gap fa-rotate-90',
|
|
190
|
+
|
|
191
|
+
'columns.3': 'fa-light fa-columns-3',
|
|
192
|
+
|
|
155
193
|
minimize: 'fal fa-minimize',
|
|
156
194
|
'fixed-width': FixedWidth,
|
|
157
195
|
'fixed-height': FixedHeight,
|
|
@@ -180,6 +218,8 @@ export const SilkeIconDefinitions = {
|
|
|
180
218
|
'user.add': 'fal fa-user-plus',
|
|
181
219
|
'user.secret': 'fal fa-user-secret',
|
|
182
220
|
'user.history': 'fal fa-user-clock',
|
|
221
|
+
'user.lock': 'fal fa-user-lock',
|
|
222
|
+
'user.gear': 'fal fa-user-gear',
|
|
183
223
|
integrations: IntegrationsIcon,
|
|
184
224
|
users: 'fal fa-user-friends',
|
|
185
225
|
'users-class': 'fal fa-users-class',
|
|
@@ -189,6 +229,8 @@ export const SilkeIconDefinitions = {
|
|
|
189
229
|
hosting: 'fal fa-server',
|
|
190
230
|
publish: 'fal fa-cloud-upload',
|
|
191
231
|
support: 'fal fa-comment-lines',
|
|
232
|
+
security: 'fal fa-shield-check',
|
|
233
|
+
'security.user': 'fal fa-user-shield',
|
|
192
234
|
'plan.free': 'fal fa-vial',
|
|
193
235
|
'plan.creative': 'fal fa-palette',
|
|
194
236
|
'plan.teams': 'fal fa-users',
|
|
@@ -207,17 +249,25 @@ export const SilkeIconDefinitions = {
|
|
|
207
249
|
gradient: GradientIcon,
|
|
208
250
|
image: 'fal fa-image',
|
|
209
251
|
video: 'fal fa-video',
|
|
252
|
+
audio: 'fal fa-music',
|
|
210
253
|
fill: 'fal fa-fill-drip',
|
|
211
254
|
opacity: 'fal fa-droplet-percent',
|
|
212
255
|
'object.group': 'fal fa-object-group',
|
|
213
256
|
'object.ungroup': 'fal fa-object-ungroup',
|
|
214
257
|
pin: 'fal fa-map-pin',
|
|
215
258
|
'component.add': 'fal fa-grid-round-2-plus',
|
|
216
|
-
'main-component':
|
|
259
|
+
'main-component': 'fa-kit fa-fa-main-component',
|
|
260
|
+
'instance-component': 'fa-light fa-diamond',
|
|
261
|
+
'goto.main-component': GotoMainComponent,
|
|
262
|
+
variant: Variant,
|
|
217
263
|
section: Section,
|
|
218
264
|
frame: 'fal fa-frame',
|
|
219
265
|
'frame.row': 'fal fa-diagram-cells fa-rotate-90',
|
|
220
266
|
'frame.column': 'fal fa-diagram-cells',
|
|
267
|
+
'flex.row.add': 'fa-kit fa-flex-add',
|
|
268
|
+
'flex.column.add': 'fa-kit fa-flex-column-add',
|
|
269
|
+
'flex.column': 'fa-kit fa-flex',
|
|
270
|
+
'flex.row': 'fa-kit fa-flex fa-rotate-90',
|
|
221
271
|
layers: 'fal fa-layer-group',
|
|
222
272
|
addon: 'fal fa-puzzle-piece',
|
|
223
273
|
widget: 'fal fa-cube',
|
|
@@ -231,6 +281,9 @@ export const SilkeIconDefinitions = {
|
|
|
231
281
|
'project-plan': 'fal fa-gem',
|
|
232
282
|
diamond: 'fa-regular fa-gem',
|
|
233
283
|
crosshair: 'fa-light fa-crosshairs',
|
|
284
|
+
clone: 'fa-light fa-clone',
|
|
285
|
+
'globe-pointer': 'fa-light fa-globe-pointer',
|
|
286
|
+
globe: 'fa-light fa-globe',
|
|
234
287
|
|
|
235
288
|
// ALignment icons
|
|
236
289
|
'align.text.right': 'fal fa-align-right',
|
|
@@ -271,6 +324,7 @@ export const SilkeIconDefinitions = {
|
|
|
271
324
|
'border.center.v': 'fal fa-border-center-v',
|
|
272
325
|
'border.center.h': 'fal fa-border-center-h',
|
|
273
326
|
plug: 'fa fa-plug',
|
|
327
|
+
'plug.light': 'fa-light fa-plug',
|
|
274
328
|
refresh: 'fal fa-sync-alt',
|
|
275
329
|
signout: 'fal fa-sign-out',
|
|
276
330
|
tag: 'fal fa-tag',
|
|
@@ -376,12 +430,49 @@ export const SilkeIconDefinitions = {
|
|
|
376
430
|
'interaction.mouse-enter': 'fa-regular fa-up-right',
|
|
377
431
|
'interaction.mouse-leave': 'fa-regular fa-down-left',
|
|
378
432
|
'interaction.timer': 'fa-regular fa-timer',
|
|
433
|
+
'interaction.disabled': 'fa-regular fa-bolt-slash',
|
|
379
434
|
|
|
380
435
|
// Variables
|
|
381
436
|
'variable.icon': 'fa-light fa-sliders',
|
|
382
437
|
'variable.color': 'fa-light fa-palette',
|
|
438
|
+
|
|
439
|
+
marketing: 'fa-light fa-megaphone',
|
|
440
|
+
'state.focus': 'fa-light fa-circle-dot',
|
|
441
|
+
|
|
442
|
+
// Conditions
|
|
443
|
+
'condition.equals': 'fa-regular fa-equals',
|
|
444
|
+
'condition.notEqual': 'fa-regular fa-not-equal',
|
|
445
|
+
'condition.greaterThan': 'fa-regular fa-greater-than',
|
|
446
|
+
'condition.lessThan': 'fa-regular fa-less-than',
|
|
447
|
+
'condition.greaterThanEqual': 'fa-regular fa-greater-than-equal',
|
|
448
|
+
'condition.lessThanEqueal': 'fa-regular fa-less-than-equal',
|
|
449
|
+
'condition.and': 'fa-regular fa-ampersand',
|
|
450
|
+
'condition.or': 'fa-regular fa-pipe',
|
|
451
|
+
'condition.true': 'fa-regular fa-check',
|
|
452
|
+
'condition.false': 'fa-regular fa-xmark',
|
|
453
|
+
|
|
454
|
+
qwiker: 'fal fa-rabbit-running',
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
export const StateIcons = {
|
|
458
|
+
default: 'flag',
|
|
459
|
+
hover: 'interaction.mouse-enter',
|
|
460
|
+
active: 'interaction.click',
|
|
461
|
+
focus: 'state.focus',
|
|
462
|
+
'focus-visible': 'state.focus',
|
|
383
463
|
};
|
|
384
464
|
|
|
465
|
+
function GotoMainComponent() {
|
|
466
|
+
return (
|
|
467
|
+
<svg width="13" height="13" viewBox="0 1 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
468
|
+
<path
|
|
469
|
+
d="M0.647241 4.94279C-0.215746 5.80578 -0.215747 7.20496 0.64724 8.06795L4.31926 11.74C5.18225 12.603 6.58143 12.603 7.44441 11.74L7.90388 11.2805C8.06715 11.1172 8.06715 10.8525 7.90388 10.6893C7.74061 10.526 7.4759 10.526 7.31263 10.6893L6.85317 11.1487C6.31672 11.6852 5.44696 11.6852 4.9105 11.1487L1.23849 7.4767C0.702034 6.94025 0.702035 6.07049 1.23849 5.53404L4.91051 1.86202C5.44696 1.32557 6.31672 1.32557 6.85317 1.86202L7.31263 2.32149C7.4759 2.48476 7.74061 2.48476 7.90388 2.32149C8.06715 2.15822 8.06715 1.89351 7.90388 1.73024L7.44441 1.27078C6.58143 0.407789 5.18225 0.407788 4.31926 1.27078L0.647241 4.94279ZM10.1722 3.50473L12.8688 6.20127C12.9496 6.2775 13 6.38558 13 6.50544C13 6.62473 12.9501 6.73236 12.8699 6.80853L10.1722 9.5062C10.009 9.66947 9.74426 9.66947 9.581 9.5062C9.41773 9.34293 9.41773 9.07822 9.581 8.91496L11.5724 6.92351H5.41498C5.18408 6.92351 4.9969 6.73633 4.9969 6.50544C4.9969 6.27454 5.18408 6.08736 5.41498 6.08736H11.5724L9.581 4.09597C9.41773 3.93271 9.41773 3.668 9.581 3.50473C9.74426 3.34146 10.009 3.34146 10.1722 3.50473Z"
|
|
470
|
+
fill="white"
|
|
471
|
+
/>
|
|
472
|
+
</svg>
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
|
|
385
476
|
function CustomComponentIcon({ className }: { className?: string }) {
|
|
386
477
|
return (
|
|
387
478
|
<svg
|
|
@@ -600,6 +691,15 @@ function MainComponent() {
|
|
|
600
691
|
);
|
|
601
692
|
}
|
|
602
693
|
|
|
694
|
+
function Variant() {
|
|
695
|
+
return (
|
|
696
|
+
<i
|
|
697
|
+
className="fa-light fa-clone fa-sm fa-rotate-by"
|
|
698
|
+
style={{ '--fa-rotate-angle': '225deg' } as CSSProperties}
|
|
699
|
+
/>
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
|
|
603
703
|
function TypescriptIcon() {
|
|
604
704
|
return (
|
|
605
705
|
<svg height="512" width="512">
|
package/src/index.mdx
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
# Vev Silke UI Design Kit
|
|
4
2
|
|
|
5
3
|
This document is the Vev design language & system.
|
|
@@ -7,7 +5,8 @@ This document is the Vev design language & system.
|
|
|
7
5
|
The Figma implementation of the Vev design system is available [here](https://www.figma.com/file/Sp7VVABeoTGZdQl2mTsx2y/Silke-Library?node-id=0-1&t=Vs9W0htcjI7DGxti-0).
|
|
8
6
|
|
|
9
7
|
## Solid colors
|
|
10
|
-
|
|
8
|
+
|
|
9
|
+
These are the solid colors we have in Silke.
|
|
11
10
|
The easiest way to use them is to use the **bg** and **color** props on the **SilkeBox** and **SilkeText** components.
|
|
12
11
|
But you can also use them in your own components by using the CSS variables, the nameing of the CSS variables can be found in the tiles below.
|
|
13
12
|
|
|
@@ -15,56 +14,56 @@ You should never use a HEX color directly in your code, always use the CSS varia
|
|
|
15
14
|
|
|
16
15
|
{[
|
|
17
16
|
"neutral",
|
|
18
|
-
|
|
17
|
+
"accent",
|
|
19
18
|
"error",
|
|
20
19
|
"warning",
|
|
21
20
|
"success",
|
|
22
21
|
"support-primary",
|
|
23
22
|
"support-secondary",
|
|
24
23
|
"support-tertiary",
|
|
24
|
+
"support-quaternary",
|
|
25
25
|
"brand-primary",
|
|
26
26
|
"brand-secondary",
|
|
27
27
|
"brand-tertiary",
|
|
28
28
|
"brand-quaternary",
|
|
29
29
|
].map((color) => (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
|
|
31
|
+
<div key={color}>
|
|
32
|
+
<h3>{color}</h3>
|
|
33
|
+
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
|
34
|
+
{[0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100].map((i) =>
|
|
35
|
+
color !== 'neutral' && (i > 60 || i < 10) ? null : (
|
|
35
36
|
<div
|
|
36
37
|
key={i}
|
|
37
38
|
style={{
|
|
38
|
-
background:
|
|
39
|
-
color:
|
|
39
|
+
background: 'var(--color-' + color + '-' + i + ')',
|
|
40
|
+
color: 'var(--color-neutral-' + (i < 40 ? 100 : 0) + ')',
|
|
40
41
|
width: 200,
|
|
41
42
|
height: 80,
|
|
42
|
-
fontSize:12,
|
|
43
|
-
padding:10
|
|
43
|
+
fontSize: 12,
|
|
44
|
+
padding: 10,
|
|
44
45
|
}}
|
|
45
46
|
>
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
{color + '-' + i}
|
|
48
|
+
<br />
|
|
49
|
+
var(--color-{color + '-' + i})
|
|
48
50
|
</div>
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
),
|
|
52
|
+
)}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
52
55
|
))}
|
|
53
56
|
|
|
54
|
-
|
|
55
57
|
## Example usage with SilkeBox
|
|
56
58
|
|
|
57
59
|
```js
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
neutral-{i}
|
|
63
|
-
</
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
() => (
|
|
61
|
+
<SilkeBox>
|
|
62
|
+
{[0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100].map((i) => (
|
|
63
|
+
<SilkeBox key={i} size="xxl" bg={'neutral-' + i} align="center">
|
|
64
|
+
<SilkeText color={i < 60 ? 'neutral-100' : 'neutral-0'}>neutral-{i}</SilkeText>
|
|
65
|
+
</SilkeBox>
|
|
66
|
+
))}
|
|
67
|
+
</SilkeBox>
|
|
68
|
+
);
|
|
67
69
|
```
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|