@vev/silke 1.0.22 → 1.0.24
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 +16 -0
- package/dist/index.js +22 -22
- package/dist/index.js.map +4 -4
- package/dist/silke/src/components/silke-autocomplete-field/silke-autocomplete-field.d.ts +4 -0
- package/dist/silke/src/components/silke-breadcrumbs/silke-breadcrumb.d.ts +2 -1
- package/dist/silke/src/components/silke-button/index.d.ts +1 -0
- package/dist/silke/src/components/silke-button/silke-button.d.ts +2 -0
- package/dist/silke/src/components/silke-button/silke-dropdown-button.d.ts +17 -0
- package/dist/silke/src/components/silke-card/silke-card.d.ts +1 -1
- package/dist/silke/src/components/silke-color-swatches/silke-swatches.d.ts +2 -1
- package/dist/silke/src/components/silke-context-menu/silke-context-menu.d.ts +3 -1
- package/dist/silke/src/components/silke-css-number-field/index.d.ts +1 -0
- package/dist/silke/src/components/silke-css-number-field/silke-css-context.d.ts +7 -0
- package/dist/silke/src/components/silke-css-number-field/silke-css-number-field.d.ts +3 -0
- package/dist/silke/src/components/silke-css-number-field/variable-picker.d.ts +17 -0
- package/dist/silke/src/components/silke-form-schema/fields/video-field.d.ts +4 -0
- package/dist/silke/src/components/silke-link/silke-link.d.ts +1 -0
- package/dist/silke/src/components/silke-navigation-link/silke-navigation-link.d.ts +6 -1
- package/dist/silke/src/components/silke-text/silke-text.d.ts +1 -4
- package/dist/silke/src/components/silke-text-field/silke-text-field-outline.d.ts +3 -0
- package/dist/silke/src/hooks/drag-and-drop/use-drop.d.ts +2 -1
- package/dist/silke/src/icons.d.ts +8 -0
- package/dist/silke-code-editor-LK4ESGQO.js +25 -0
- package/dist/silke-code-editor-LK4ESGQO.js.map +7 -0
- package/dist/styles.css +995 -880
- package/dist/utils/src/types/context.d.ts +3 -1
- package/dist/utils/src/types/interaction.d.ts +8 -4
- package/dist/utils/src/types/vev-plugin.d.ts +10 -1
- package/dist/utils/src/types/vev-props.d.ts +6 -0
- package/esbuild.config.mjs +2 -4
- package/package.json +3 -3
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.scss +6 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +25 -2
- package/src/components/silke-breadcrumbs/silke-breadcrumb.scss +11 -4
- package/src/components/silke-breadcrumbs/silke-breadcrumb.tsx +26 -6
- package/src/components/silke-button/index.ts +1 -0
- package/src/components/silke-button/silke-button.scss +0 -4
- package/src/components/silke-button/silke-button.tsx +8 -0
- package/src/components/silke-button/silke-dropdown-button.tsx +148 -0
- package/src/components/silke-color-picker/silke-color-picker.tsx +1 -0
- package/src/components/silke-color-swatches/silke-swatches.tsx +38 -6
- package/src/components/silke-context-menu/silke-context-menu.mdx +32 -0
- package/src/components/silke-context-menu/silke-context-menu.scss +6 -0
- package/src/components/silke-context-menu/silke-context-menu.tsx +22 -0
- package/src/components/silke-css-number-field/index.ts +1 -0
- package/src/components/silke-css-number-field/silke-css-context.tsx +17 -1
- package/src/components/silke-css-number-field/silke-css-number-field.mdx +30 -0
- package/src/components/silke-css-number-field/silke-css-number-field.scss +14 -2
- package/src/components/silke-css-number-field/silke-css-number-field.tsx +113 -13
- package/src/components/silke-css-number-field/variable-picker.tsx +181 -0
- package/src/components/silke-form-schema/fields/video-field.tsx +52 -0
- package/src/components/silke-form-schema/silke-schema-field.tsx +3 -1
- package/src/components/silke-image/silke-image.scss +1 -0
- package/src/components/silke-link/silke-link.mdx +3 -0
- package/src/components/silke-link/silke-link.scss +5 -1
- package/src/components/silke-link/silke-link.tsx +15 -3
- package/src/components/silke-modal/silke-modal.tsx +2 -0
- package/src/components/silke-navigation-link/silke-navigation-link.scss +67 -11
- package/src/components/silke-navigation-link/silke-navigation-link.tsx +171 -51
- package/src/components/silke-overflow-menu/silke-overflow-menu.scss +1 -1
- package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +1 -1
- package/src/components/silke-text-field/silke-text-field-outline.tsx +69 -47
- package/src/components/silke-text-field/silke-text-field.scss +63 -0
- package/src/components/silke-text-field/silke-text-field.tsx +6 -0
- package/src/hooks/drag-and-drop/use-drop.tsx +3 -1
- package/src/icons.tsx +12 -2
- package/dist/silke-code-editor-B2CVBA63.js +0 -25
- package/dist/silke-code-editor-B2CVBA63.js.map +0 -7
- /package/dist/{silke-code-editor-B2CVBA63.js.LEGAL.txt → silke-code-editor-LK4ESGQO.js.LEGAL.txt} +0 -0
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
<p>
|
|
3
3
|
<SilkeLink target="_blank" href="https://www.vev.design" external>External link is marked with icon</SilkeLink>
|
|
4
4
|
</p>
|
|
5
|
+
<p>
|
|
6
|
+
<SilkeLink kind="secondary" target="_blank" href="https://www.vev.design" external>Secondary Link</SilkeLink>
|
|
7
|
+
</p>
|
|
5
8
|
<p style={{fontSize: "30px"}}>
|
|
6
9
|
<SilkeLink target="_blank" href="https://www.vev.design" external>Icon scales with font size</SilkeLink>
|
|
7
10
|
</p>
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
:global {
|
|
3
3
|
|
|
4
4
|
.silke-link {
|
|
5
|
-
text-decoration: underline;
|
|
5
|
+
text-decoration: underline;
|
|
6
6
|
cursor: pointer;
|
|
7
7
|
color: var(--color-accent-50);
|
|
8
8
|
|
|
9
|
+
&.secondary{
|
|
10
|
+
color: var(--color-neutral-50);
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
&:focus-visible {
|
|
10
14
|
outline: none;
|
|
11
15
|
box-shadow: 0 0 0 2px var(--color-neutral-100);
|
|
@@ -12,11 +12,19 @@ const getRelFromTarget = (target?: string): 'noopener noreferrer' | undefined =>
|
|
|
12
12
|
: 'noopener noreferrer';
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const getClassNames = (
|
|
15
|
+
const getClassNames = (
|
|
16
|
+
className?: string,
|
|
17
|
+
standalone?: boolean,
|
|
18
|
+
kind?: 'primary' | 'secondary',
|
|
19
|
+
): string => {
|
|
16
20
|
const cn = className ? ['silke-link', className] : ['silke-link'];
|
|
17
21
|
if (standalone) {
|
|
18
22
|
cn.push('silke-link--standalone');
|
|
19
23
|
}
|
|
24
|
+
if (kind) {
|
|
25
|
+
cn.push(kind);
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
return cn.join(' ');
|
|
21
29
|
};
|
|
22
30
|
|
|
@@ -48,13 +56,17 @@ interface SilkeLinkProps
|
|
|
48
56
|
extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'>,
|
|
49
57
|
LinkChildProps {
|
|
50
58
|
standalone?: boolean;
|
|
59
|
+
kind?: 'primary' | 'secondary';
|
|
51
60
|
}
|
|
52
61
|
|
|
53
|
-
export const SilkeLink: React.FunctionComponent<SilkeLinkProps> = (
|
|
62
|
+
export const SilkeLink: React.FunctionComponent<SilkeLinkProps> = ({
|
|
63
|
+
kind = 'primary',
|
|
64
|
+
...props
|
|
65
|
+
}: SilkeLinkProps) => {
|
|
54
66
|
const { target, standalone, className, external, children, icon, ...rest } = props;
|
|
55
67
|
const rel = getRelFromTarget(target);
|
|
56
68
|
return (
|
|
57
|
-
<a rel={rel} target={target} className={getClassNames(className, standalone)} {...rest}>
|
|
69
|
+
<a rel={rel} target={target} className={getClassNames(className, standalone, kind)} {...rest}>
|
|
58
70
|
<LinkChild external={external} icon={icon}>
|
|
59
71
|
{children}
|
|
60
72
|
</LinkChild>
|
|
@@ -56,6 +56,8 @@ export function SilkeModal({
|
|
|
56
56
|
rounded={rounded || 'small'}
|
|
57
57
|
shadow="level4"
|
|
58
58
|
scroll
|
|
59
|
+
onMouseDown={(e: React.MouseEvent) => e.stopPropagation()}
|
|
60
|
+
onClick={(e: React.MouseEvent) => e.stopPropagation()}
|
|
59
61
|
>
|
|
60
62
|
{(title || onClose || onBack || logo) && (
|
|
61
63
|
<SilkeBox gap="m" vAlign="center">
|
|
@@ -7,9 +7,8 @@ body {
|
|
|
7
7
|
--nav-item-background-pressed: var(--color);
|
|
8
8
|
}
|
|
9
9
|
.main {
|
|
10
|
-
min-height: $size-m;
|
|
11
10
|
position: relative;
|
|
12
|
-
margin: 0 $space-m
|
|
11
|
+
margin: 0 $space-m 0;
|
|
13
12
|
padding: 0;
|
|
14
13
|
|
|
15
14
|
&:last-child {
|
|
@@ -24,7 +23,7 @@ body {
|
|
|
24
23
|
|
|
25
24
|
&.hasRightButtons{
|
|
26
25
|
.link{
|
|
27
|
-
padding-right:
|
|
26
|
+
padding-right: 4px;
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
|
|
@@ -39,7 +38,7 @@ body {
|
|
|
39
38
|
position: absolute;
|
|
40
39
|
content: "";
|
|
41
40
|
display: block;
|
|
42
|
-
height:
|
|
41
|
+
height: 16px;
|
|
43
42
|
width: 4px;
|
|
44
43
|
border-radius: var(--border-radius-tiny);
|
|
45
44
|
|
|
@@ -51,7 +50,7 @@ body {
|
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
&.active {
|
|
54
|
-
|
|
53
|
+
&>.linkContainer {
|
|
55
54
|
background: var(--color-surface-1);
|
|
56
55
|
}
|
|
57
56
|
|
|
@@ -61,12 +60,13 @@ body {
|
|
|
61
60
|
opacity: 1;
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
.link {
|
|
63
|
+
.linkContainer, .link {
|
|
65
64
|
color: var(--color-neutral-100);
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
.
|
|
68
|
+
.linkContainer {
|
|
69
|
+
min-height: $size-m;
|
|
70
70
|
border-radius: var(--border-radius-small);
|
|
71
71
|
color: var(--nav-item-color);
|
|
72
72
|
text-align: left;
|
|
@@ -80,17 +80,34 @@ body {
|
|
|
80
80
|
outline: 1px solid var(--color-neutral-100);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
.link{
|
|
86
|
+
border-radius: var(--border-radius-small);
|
|
87
|
+
color: var(--nav-item-color);
|
|
88
|
+
text-align: left;
|
|
89
|
+
background-color: transparent;
|
|
90
|
+
|
|
83
91
|
&:hover {
|
|
84
92
|
background: var(--color-surface-1);
|
|
85
93
|
color: var(--nav-item-color-hover);
|
|
94
|
+
.overflowMenu{
|
|
95
|
+
opacity: 1;
|
|
96
|
+
display: flex;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.dragIcon{
|
|
100
|
+
opacity: 1;
|
|
101
|
+
}
|
|
86
102
|
}
|
|
87
103
|
}
|
|
104
|
+
|
|
88
105
|
.rightContent {
|
|
89
106
|
pointer-events: none;
|
|
90
|
-
position: absolute;
|
|
107
|
+
//position: absolute;
|
|
91
108
|
right: 0;
|
|
92
|
-
top:
|
|
93
|
-
padding-right: 8px;
|
|
109
|
+
top: auto;
|
|
110
|
+
//padding-right: 8px;
|
|
94
111
|
button, a {
|
|
95
112
|
pointer-events: all;
|
|
96
113
|
}
|
|
@@ -103,7 +120,37 @@ body {
|
|
|
103
120
|
color: $color;
|
|
104
121
|
}
|
|
105
122
|
}
|
|
106
|
-
|
|
123
|
+
.overflowMenu{
|
|
124
|
+
opacity: 0;
|
|
125
|
+
display: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.subLink{
|
|
129
|
+
.link{
|
|
130
|
+
color: var(--nav-item-color);
|
|
131
|
+
}
|
|
132
|
+
.main{
|
|
133
|
+
margin:0;
|
|
134
|
+
.linkIcon{
|
|
135
|
+
margin-left: 30px;
|
|
136
|
+
}
|
|
137
|
+
.subLink{
|
|
138
|
+
.linkIcon{
|
|
139
|
+
margin-left: 60px;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
&.active{
|
|
143
|
+
.link {
|
|
144
|
+
color: var(--color-neutral-100);
|
|
145
|
+
}
|
|
146
|
+
&::before {
|
|
147
|
+
opacity: 0;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
107
154
|
}
|
|
108
155
|
|
|
109
156
|
.label {
|
|
@@ -114,3 +161,12 @@ body {
|
|
|
114
161
|
display: none;
|
|
115
162
|
opacity: 0;
|
|
116
163
|
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
.dragIcon{
|
|
168
|
+
opacity: 0;
|
|
169
|
+
position: absolute;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { IEmojiIcon } from '@vev/utils';
|
|
2
2
|
import { isString } from 'lodash';
|
|
3
|
-
import React, { ReactNode } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import React, { ReactNode, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { SilkeButton } from '../silke-button';
|
|
5
5
|
import { BoxButtonProps, BoxLinkProps, SilkeBox } from '../silke-box';
|
|
6
6
|
import ButtonContext from '../silke-button/context';
|
|
7
7
|
import { SilkeIcon, SilkeIcons } from '../silke-icon';
|
|
8
8
|
import { SilkeImage } from '../silke-image';
|
|
9
9
|
import { SilkeText } from '../silke-text';
|
|
10
10
|
import styles from './silke-navigation-link.scss';
|
|
11
|
+
import { SilkeColor } from '../../silke-theme-provider';
|
|
12
|
+
import { SilkeContextMenu, SilkeContextMenuItems } from '../silke-context-menu';
|
|
11
13
|
|
|
12
14
|
type SilkeNavigationLinkProps = {
|
|
13
15
|
active?: boolean;
|
|
14
16
|
icon?: IEmojiIcon | SilkeIcons | React.ReactElement;
|
|
15
17
|
label: ReactNode;
|
|
18
|
+
subLabel?: string;
|
|
16
19
|
linkClassName?: string;
|
|
20
|
+
draggable?: boolean;
|
|
17
21
|
color?: SilkeColor;
|
|
22
|
+
items?: React.ReactElement[];
|
|
23
|
+
menu?: SilkeContextMenuItems;
|
|
18
24
|
/**
|
|
19
25
|
* Buttons/icons shown only on hover
|
|
20
26
|
*/
|
|
@@ -30,6 +36,7 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
30
36
|
active,
|
|
31
37
|
icon,
|
|
32
38
|
label,
|
|
39
|
+
subLabel,
|
|
33
40
|
className,
|
|
34
41
|
linkClassName,
|
|
35
42
|
children,
|
|
@@ -37,12 +44,19 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
37
44
|
rightButtons,
|
|
38
45
|
color,
|
|
39
46
|
align,
|
|
47
|
+
draggable,
|
|
48
|
+
items,
|
|
49
|
+
menu = [],
|
|
40
50
|
...rest
|
|
41
51
|
}: SilkeNavigationLinkProps,
|
|
42
52
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
43
53
|
) => {
|
|
54
|
+
const [expand, setExpand] = useState(false);
|
|
55
|
+
const [openMenu, setOpenMenu] = useState(false);
|
|
56
|
+
const menuRef = useRef<HTMLButtonElement>(null);
|
|
44
57
|
const cl = [styles.main];
|
|
45
58
|
const linkClass = [styles.link];
|
|
59
|
+
const hasItems = !!items?.length;
|
|
46
60
|
|
|
47
61
|
if (className) cl.push(className);
|
|
48
62
|
if (active) cl.push(styles.active);
|
|
@@ -50,61 +64,167 @@ export const SilkeNavigationLink = React.forwardRef(
|
|
|
50
64
|
if (color) linkClass.push(styles[color]);
|
|
51
65
|
if (linkClassName) linkClass.push(linkClassName);
|
|
52
66
|
|
|
67
|
+
const toggleExpand = useMemo(
|
|
68
|
+
() => (e: React.MouseEvent) => {
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
setExpand(!expand);
|
|
72
|
+
},
|
|
73
|
+
[expand],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const toggleMenu = useMemo(
|
|
77
|
+
() => (e: React.MouseEvent) => {
|
|
78
|
+
e.stopPropagation();
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
setOpenMenu(!openMenu);
|
|
81
|
+
},
|
|
82
|
+
[openMenu],
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (active) setExpand(true);
|
|
87
|
+
}, [active]);
|
|
88
|
+
|
|
53
89
|
return (
|
|
54
|
-
<SilkeBox
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
<SilkeBox
|
|
91
|
+
ref={ref}
|
|
92
|
+
className={cl.join(' ')}
|
|
93
|
+
gap="xxs"
|
|
94
|
+
tag="div"
|
|
95
|
+
draggable={draggable}
|
|
96
|
+
onDrop={() => setExpand(true)}
|
|
97
|
+
>
|
|
98
|
+
<SilkeBox column fill className={styles.linkContainer}>
|
|
99
|
+
<SilkeBox
|
|
100
|
+
{...(typeof link === 'string'
|
|
101
|
+
? {
|
|
102
|
+
tag: 'link',
|
|
103
|
+
to: link,
|
|
104
|
+
...(rest as Omit<BoxLinkProps, 'to' | 'tag' | 'link'>),
|
|
105
|
+
}
|
|
106
|
+
: {
|
|
107
|
+
tag: 'button',
|
|
108
|
+
type: 'button',
|
|
109
|
+
...(rest as Omit<BoxButtonProps, 'tag' | 'type'>),
|
|
110
|
+
})}
|
|
111
|
+
className={linkClass.join(' ')}
|
|
112
|
+
flex
|
|
113
|
+
vAlign="center"
|
|
114
|
+
gap="s"
|
|
115
|
+
vPad={subLabel ? 'xxs' : undefined}
|
|
116
|
+
>
|
|
117
|
+
{draggable && (
|
|
118
|
+
<SilkeBox className={styles.dragIcon} size="s" align="center" pad="xs">
|
|
119
|
+
<SilkeIcon
|
|
120
|
+
icon="drag.dots"
|
|
121
|
+
color="neutral-60"
|
|
122
|
+
style={{ fontSize: 12, fontWeight: 400 }}
|
|
123
|
+
/>
|
|
124
|
+
</SilkeBox>
|
|
125
|
+
)}
|
|
126
|
+
{icon ? (
|
|
127
|
+
<SilkeBox
|
|
128
|
+
size="m"
|
|
129
|
+
align="center"
|
|
130
|
+
pad="s"
|
|
131
|
+
className={styles.linkIcon}
|
|
132
|
+
style={{ fontSize: 14 }}
|
|
133
|
+
>
|
|
134
|
+
{React.isValidElement(icon) || isString(icon) ? (
|
|
135
|
+
<SilkeIcon icon={icon || 'error'} />
|
|
136
|
+
) : (
|
|
137
|
+
<SilkeImage icon={icon} avatar="s" />
|
|
138
|
+
)}
|
|
139
|
+
</SilkeBox>
|
|
140
|
+
) : (
|
|
141
|
+
<SilkeBox width="xs" />
|
|
142
|
+
)}
|
|
143
|
+
|
|
144
|
+
<SilkeBox column flex className={styles.label}>
|
|
145
|
+
<SilkeText
|
|
146
|
+
flex
|
|
147
|
+
overflow
|
|
148
|
+
style={{ maxWidth: children || rightButtons ? 120 : undefined, fontSize: 14 }}
|
|
149
|
+
>
|
|
150
|
+
{label || 'just a link'}
|
|
151
|
+
</SilkeText>
|
|
152
|
+
{subLabel && (
|
|
153
|
+
<SilkeText size="small" color="neutral-70">
|
|
154
|
+
{subLabel}
|
|
155
|
+
</SilkeText>
|
|
78
156
|
)}
|
|
79
157
|
</SilkeBox>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
158
|
+
{children || rightButtons ? (
|
|
159
|
+
<ButtonContext size="base" kind="ghost">
|
|
160
|
+
<SilkeBox className={styles.rightContent} vAlign="center" height="s">
|
|
161
|
+
{children}
|
|
162
|
+
{rightButtons && (
|
|
163
|
+
<div
|
|
164
|
+
className={styles.rightButtons}
|
|
165
|
+
onClick={(e: React.MouseEvent) => e.stopPropagation()}
|
|
166
|
+
>
|
|
167
|
+
{rightButtons}
|
|
168
|
+
</div>
|
|
169
|
+
)}
|
|
170
|
+
</SilkeBox>
|
|
171
|
+
</ButtonContext>
|
|
172
|
+
) : null}
|
|
83
173
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
>
|
|
102
|
-
|
|
103
|
-
|
|
174
|
+
{(hasItems || !!menu.length) && (
|
|
175
|
+
<SilkeBox gap="xxs" hPad="xs">
|
|
176
|
+
{!!menu.length && (
|
|
177
|
+
<SilkeButton
|
|
178
|
+
className={openMenu ? undefined : styles.overflowMenu}
|
|
179
|
+
onMouseDown={toggleMenu}
|
|
180
|
+
onClick={(e) => {
|
|
181
|
+
e.stopPropagation();
|
|
182
|
+
e.preventDefault();
|
|
183
|
+
}}
|
|
184
|
+
ref={menuRef}
|
|
185
|
+
icon="menuMore"
|
|
186
|
+
kind="ghost"
|
|
187
|
+
size="s"
|
|
188
|
+
/>
|
|
189
|
+
)}
|
|
190
|
+
{hasItems && (
|
|
191
|
+
<SilkeBox>
|
|
192
|
+
<SilkeButton
|
|
193
|
+
size="s"
|
|
194
|
+
kind="ghost"
|
|
195
|
+
color="neutral-60"
|
|
196
|
+
icon={expand ? 'chevron.down' : 'chevron.right'}
|
|
197
|
+
onClick={toggleExpand}
|
|
198
|
+
/>
|
|
199
|
+
</SilkeBox>
|
|
104
200
|
)}
|
|
105
201
|
</SilkeBox>
|
|
106
|
-
|
|
107
|
-
|
|
202
|
+
)}
|
|
203
|
+
|
|
204
|
+
{openMenu && (
|
|
205
|
+
<SilkeContextMenu
|
|
206
|
+
anchor={menuRef}
|
|
207
|
+
width={82}
|
|
208
|
+
anchorOrigin="bottom-right"
|
|
209
|
+
targetOrigin="top-right"
|
|
210
|
+
offsetY={1}
|
|
211
|
+
gap="xxs"
|
|
212
|
+
items={menu}
|
|
213
|
+
onRequestClose={() => setOpenMenu(false)}
|
|
214
|
+
/>
|
|
215
|
+
)}
|
|
216
|
+
</SilkeBox>
|
|
217
|
+
|
|
218
|
+
{hasItems && expand && (
|
|
219
|
+
<SilkeBox column gap="xs" pad="xs" className={styles.subLink}>
|
|
220
|
+
{items?.map((item) => {
|
|
221
|
+
if (React.isValidElement(item)) {
|
|
222
|
+
return item;
|
|
223
|
+
}
|
|
224
|
+
return false;
|
|
225
|
+
})}
|
|
226
|
+
</SilkeBox>
|
|
227
|
+
)}
|
|
108
228
|
</SilkeBox>
|
|
109
229
|
</SilkeBox>
|
|
110
230
|
);
|
|
@@ -53,8 +53,11 @@ export type SilkeTextFieldOutlineProps = {
|
|
|
53
53
|
labelUsingAria?: boolean;
|
|
54
54
|
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
55
55
|
onMouseDown?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
56
|
+
onVariableClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
56
57
|
disabled?: boolean;
|
|
57
58
|
tooltip?: string;
|
|
59
|
+
showVariableDot?: boolean;
|
|
60
|
+
hasActiveVariable?: boolean;
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
export const SilkeTextFieldOutline = React.forwardRef<HTMLDivElement, SilkeTextFieldOutlineProps>(
|
|
@@ -80,8 +83,11 @@ export const SilkeTextFieldOutline = React.forwardRef<HTMLDivElement, SilkeTextF
|
|
|
80
83
|
flex,
|
|
81
84
|
onClick,
|
|
82
85
|
onMouseDown,
|
|
86
|
+
onVariableClick,
|
|
83
87
|
disabled,
|
|
84
88
|
tooltip,
|
|
89
|
+
showVariableDot,
|
|
90
|
+
hasActiveVariable,
|
|
85
91
|
}: SilkeTextFieldOutlineProps,
|
|
86
92
|
ref,
|
|
87
93
|
) => {
|
|
@@ -98,6 +104,9 @@ export const SilkeTextFieldOutline = React.forwardRef<HTMLDivElement, SilkeTextF
|
|
|
98
104
|
if (disabled) {
|
|
99
105
|
cl += ' ' + styles.disabled;
|
|
100
106
|
}
|
|
107
|
+
if (hasActiveVariable) {
|
|
108
|
+
cl += ' ' + styles.activeVariable;
|
|
109
|
+
}
|
|
101
110
|
|
|
102
111
|
const showError = Boolean(error);
|
|
103
112
|
const showHelp = Boolean((help || helpRight) && !error);
|
|
@@ -124,57 +133,70 @@ export const SilkeTextFieldOutline = React.forwardRef<HTMLDivElement, SilkeTextF
|
|
|
124
133
|
);
|
|
125
134
|
return (
|
|
126
135
|
<SilkeBox
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
column={!inline}
|
|
130
|
-
gap={'xs'}
|
|
131
|
-
vAlign="center"
|
|
136
|
+
column
|
|
137
|
+
className={styles.wrapper}
|
|
132
138
|
style={width ? { minWidth: width, maxWidth: width, width } : flex ? { flex: 1 } : undefined}
|
|
133
|
-
className={cl}
|
|
134
|
-
onClick={onClick}
|
|
135
|
-
onMouseDown={onMouseDown}
|
|
136
139
|
>
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
<ButtonContext kind="ghost" size="base">
|
|
140
|
+
{showVariableDot && (
|
|
140
141
|
<SilkeBox
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
className={styles.field}
|
|
146
|
-
flex={!!inline}
|
|
147
|
-
ref={ref}
|
|
148
|
-
>
|
|
149
|
-
{labelComponent && inline === 'label-inside' && (
|
|
150
|
-
<SilkeTextFieldItem before minWidth={boxSize} hPad="xs">
|
|
151
|
-
{labelComponent}
|
|
152
|
-
</SilkeTextFieldItem>
|
|
153
|
-
)}
|
|
154
|
-
{children}
|
|
155
|
-
</SilkeBox>
|
|
156
|
-
</ButtonContext>
|
|
157
|
-
|
|
158
|
-
{!inline && (
|
|
159
|
-
<SilkeBox hAlign="spread" className={styles.help}>
|
|
160
|
-
{showHelp && help && (
|
|
161
|
-
<SilkeText flex id={helpId} size={size === 'xs' ? 'micro' : 'base'}>
|
|
162
|
-
{help}
|
|
163
|
-
</SilkeText>
|
|
164
|
-
)}
|
|
165
|
-
{showHelp && helpRight && <SilkeText>{helpRight}</SilkeText>}
|
|
166
|
-
{showError && (
|
|
167
|
-
<SilkeText
|
|
168
|
-
flex
|
|
169
|
-
aria-live="polite"
|
|
170
|
-
role="alert"
|
|
171
|
-
size={size === 'xs' ? 'micro' : 'base'}
|
|
172
|
-
>
|
|
173
|
-
{error}
|
|
174
|
-
</SilkeText>
|
|
175
|
-
)}
|
|
176
|
-
</SilkeBox>
|
|
142
|
+
className={styles.variableDot}
|
|
143
|
+
data-icon={hasActiveVariable ? '−' : '+'}
|
|
144
|
+
onClick={onVariableClick}
|
|
145
|
+
/>
|
|
177
146
|
)}
|
|
147
|
+
|
|
148
|
+
<SilkeBox
|
|
149
|
+
data-size={`data-input-${mappedSize}`}
|
|
150
|
+
tag="div"
|
|
151
|
+
column={!inline}
|
|
152
|
+
gap={'xs'}
|
|
153
|
+
vAlign="center"
|
|
154
|
+
className={cl}
|
|
155
|
+
onClick={onClick}
|
|
156
|
+
onMouseDown={onMouseDown}
|
|
157
|
+
>
|
|
158
|
+
{inline !== 'label-inside' && labelComponent}
|
|
159
|
+
|
|
160
|
+
<ButtonContext kind="ghost" size="base">
|
|
161
|
+
<SilkeBox
|
|
162
|
+
gap={gap}
|
|
163
|
+
hPad={hPad}
|
|
164
|
+
hAlign={hAlign}
|
|
165
|
+
vAlign={vAlign}
|
|
166
|
+
className={styles.field}
|
|
167
|
+
flex={!!inline}
|
|
168
|
+
ref={ref}
|
|
169
|
+
>
|
|
170
|
+
{labelComponent && inline === 'label-inside' && (
|
|
171
|
+
<SilkeTextFieldItem before minWidth={boxSize} hPad="xs">
|
|
172
|
+
{labelComponent}
|
|
173
|
+
</SilkeTextFieldItem>
|
|
174
|
+
)}
|
|
175
|
+
{children}
|
|
176
|
+
</SilkeBox>
|
|
177
|
+
</ButtonContext>
|
|
178
|
+
|
|
179
|
+
{!inline && (
|
|
180
|
+
<SilkeBox hAlign="spread" className={styles.help}>
|
|
181
|
+
{showHelp && help && (
|
|
182
|
+
<SilkeText flex id={helpId} size={size === 'xs' ? 'micro' : 'base'}>
|
|
183
|
+
{help}
|
|
184
|
+
</SilkeText>
|
|
185
|
+
)}
|
|
186
|
+
{showHelp && helpRight && <SilkeText>{helpRight}</SilkeText>}
|
|
187
|
+
{showError && (
|
|
188
|
+
<SilkeText
|
|
189
|
+
flex
|
|
190
|
+
aria-live="polite"
|
|
191
|
+
role="alert"
|
|
192
|
+
size={size === 'xs' ? 'micro' : 'base'}
|
|
193
|
+
>
|
|
194
|
+
{error}
|
|
195
|
+
</SilkeText>
|
|
196
|
+
)}
|
|
197
|
+
</SilkeBox>
|
|
198
|
+
)}
|
|
199
|
+
</SilkeBox>
|
|
178
200
|
</SilkeBox>
|
|
179
201
|
);
|
|
180
202
|
},
|