@vev/silke 1.0.17 → 1.0.18
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 +20 -20
- package/dist/index.js.map +3 -3
- package/dist/silke-code-editor-LBP2WDX3.js +25 -0
- package/dist/silke-code-editor-LBP2WDX3.js.map +7 -0
- package/dist/styles.css +243 -197
- package/package.json +5 -5
- package/src/components/silke-autocomplete-field/autocomplete-tags.tsx +2 -2
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +1 -1
- package/src/components/silke-box/silke-box.mdx +2 -1
- package/src/components/silke-breadcrumbs/silke-breadcrumb.mdx +5 -1
- package/src/components/silke-checkbox/silke-checkbox.mdx +11 -2
- 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/index.ts +1 -0
- package/src/components/silke-color-picker/silke-color-picker.mdx +19 -9
- package/src/components/silke-color-picker/silke-color-picker.tsx +4 -13
- package/src/components/silke-context-menu/silke-context-menu-item.tsx +5 -1
- package/src/components/silke-context-menu/silke-context-menu.scss +5 -1
- package/src/components/silke-context-menu/silke-context-menu.tsx +4 -1
- package/src/components/silke-drawer/silke-drawer.mdx +13 -13
- package/src/components/silke-form/silke-form.mdx +15 -3
- package/src/components/silke-form-schema/fields/array-field.tsx +1 -1
- package/src/components/silke-form-schema/fields/event-field.tsx +1 -1
- package/src/components/silke-form-schema/fields/utils/generate-title.ts +9 -2
- package/src/components/silke-form-schema/silke-schema-field.tsx +12 -11
- package/src/components/silke-form-schema/silke-schema-fields.tsx +2 -2
- package/src/components/silke-icon/silke-icon.tsx +3 -1
- package/src/components/silke-loader/silke-loader.mdx +3 -4
- package/src/components/silke-navigation-link/silke-navigation-link.mdx +6 -1
- package/src/components/silke-object-field/silke-object-field.mdx +10 -3
- package/src/components/silke-progress-indicator/silke-progress-indicator.mdx +9 -3
- package/src/components/silke-radio-button/silke-radio-button.mdx +7 -1
- package/src/components/silke-search-field/silke-search-field.mdx +12 -4
- package/src/components/silke-tabs/silke-tabs.mdx +2 -2
- package/src/components/silke-tag/silke-tag.mdx +51 -13
- package/src/components/silke-tag/silke-tag.scss +52 -10
- package/src/components/silke-tag/silke-tag.tsx +47 -23
- package/src/components/silke-tile/silke-tile.mdx +39 -8
- package/src/components/silke-toggle/silke-toggle.mdx +29 -5
- package/src/components/silke-toolbar/silke-toolbar.mdx +35 -15
- package/src/docs/parser.ts +1 -1
- package/src/hooks/hooks.mdx +3 -3
- package/src/icons.tsx +2 -0
- package/dist/silke-code-editor-3Y2KM5KB.js +0 -25
- package/dist/silke-code-editor-3Y2KM5KB.js.map +0 -7
- /package/dist/{silke-code-editor-3Y2KM5KB.js.LEGAL.txt → silke-code-editor-LBP2WDX3.js.LEGAL.txt} +0 -0
|
@@ -8,7 +8,7 @@ import { SilkeSwatches } from '../silke-color-swatches';
|
|
|
8
8
|
import { useSilkeCSSContext } from '../silke-css-number-field';
|
|
9
9
|
import { SilkeModal, SilkeModalActions, SilkeModalContent } from '../silke-modal';
|
|
10
10
|
import { TextFieldContext } from '../silke-text-field';
|
|
11
|
-
import { hsvToRgb, rgbToHsv } from './color';
|
|
11
|
+
import { getColorVariableValue, hsvToRgb, isColorVariable, rgbToHsv } from './color';
|
|
12
12
|
import styles from './color-picker.scss';
|
|
13
13
|
import { ColorInfo } from './silke-color-info';
|
|
14
14
|
import { ColorSpace } from './silke-color-space';
|
|
@@ -30,15 +30,6 @@ export type SilkeColorPickerProps = {
|
|
|
30
30
|
onChange: (color: string) => void;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
function isVariable(color: string): boolean {
|
|
34
|
-
return !!color && /^var\(/.test(color.trim());
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function getVariableValue(color: string, variables: { [varName: string]: string }): string {
|
|
38
|
-
const varName = color.trim().replace(/^var\((.*)\)$/, '$1');
|
|
39
|
-
return variables[varName];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
33
|
export function SilkeColorPicker({
|
|
43
34
|
value,
|
|
44
35
|
hidePalettes,
|
|
@@ -51,14 +42,14 @@ export function SilkeColorPicker({
|
|
|
51
42
|
const [eyeDropperActive, setEyeDropperActive] = useState(false);
|
|
52
43
|
const [showEyeDropUnsupported, setShowEyeDropUnsupported] = useState(false);
|
|
53
44
|
const { variables } = useSilkeCSSContext();
|
|
54
|
-
const isValueVariable =
|
|
45
|
+
const isValueVariable = isColorVariable(value);
|
|
55
46
|
|
|
56
47
|
const rgba = React.useMemo(() => {
|
|
57
48
|
if (!value) {
|
|
58
49
|
return TRANSPARENT;
|
|
59
50
|
}
|
|
60
51
|
if (isValueVariable) {
|
|
61
|
-
return tinycolor(
|
|
52
|
+
return tinycolor(getColorVariableValue(value, variables)).toRgb();
|
|
62
53
|
}
|
|
63
54
|
|
|
64
55
|
return tinycolor(value).toRgb();
|
|
@@ -77,7 +68,7 @@ export function SilkeColorPicker({
|
|
|
77
68
|
|
|
78
69
|
const handleChange = (v: string | RGBA) => {
|
|
79
70
|
if (isString(v) && /\$|var/.test(v)) {
|
|
80
|
-
if (noVariables) onChange(
|
|
71
|
+
if (noVariables) onChange(getColorVariableValue(v, variables));
|
|
81
72
|
else onChange(v);
|
|
82
73
|
} else {
|
|
83
74
|
const color = tinycolor(v);
|
|
@@ -25,12 +25,16 @@ export const SilkeContextMenuItem = ({
|
|
|
25
25
|
icon,
|
|
26
26
|
subItem,
|
|
27
27
|
onClick,
|
|
28
|
+
selected,
|
|
28
29
|
...rest
|
|
29
30
|
}: SilkeContextMenuItemProps) => {
|
|
31
|
+
const cl = [styles.item];
|
|
30
32
|
const ref = useRef<HTMLButtonElement>(null);
|
|
31
33
|
const requestCloseMenu = usePopoverRequestClose('contextmenu');
|
|
32
34
|
const requestCloseSub = usePopoverRequestClose('contextmenu.sub');
|
|
33
35
|
|
|
36
|
+
if (selected) cl.push(styles.selected);
|
|
37
|
+
|
|
34
38
|
const [showSub, setShowSub] = useState(false);
|
|
35
39
|
return (
|
|
36
40
|
<SilkeBox column hPad="xs">
|
|
@@ -59,7 +63,7 @@ export const SilkeContextMenuItem = ({
|
|
|
59
63
|
setShowSub(true);
|
|
60
64
|
}
|
|
61
65
|
}}
|
|
62
|
-
className={
|
|
66
|
+
className={cl.join(' ')}
|
|
63
67
|
{...rest}
|
|
64
68
|
/>
|
|
65
69
|
{showSub && items && (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isFunction } from 'lodash';
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { SilkeBox } from '../silke-box';
|
|
3
|
+
import { BoxSpace, SilkeBox } from '../silke-box';
|
|
4
4
|
import { ButtonContext } from '../silke-button';
|
|
5
5
|
import { SilkePopover, SilkePopoverProps } from '../silke-popover';
|
|
6
6
|
import { usePopoverRequestClose } from '../silke-popover/popover-context';
|
|
@@ -20,6 +20,7 @@ export type SilkeContextMenuProps = {
|
|
|
20
20
|
target?: React.MutableRefObject<HTMLElement>;
|
|
21
21
|
/** Used internally to keep track of menu and closing */
|
|
22
22
|
subMenu?: boolean;
|
|
23
|
+
gap?: BoxSpace;
|
|
23
24
|
} & Omit<SilkePopoverProps, 'children' | 'kind'>;
|
|
24
25
|
|
|
25
26
|
export function SilkeContextMenu({
|
|
@@ -29,6 +30,7 @@ export function SilkeContextMenu({
|
|
|
29
30
|
anchor,
|
|
30
31
|
width,
|
|
31
32
|
subMenu,
|
|
33
|
+
gap,
|
|
32
34
|
onRequestClose,
|
|
33
35
|
...rest
|
|
34
36
|
}: SilkeContextMenuProps) {
|
|
@@ -79,6 +81,7 @@ export function SilkeContextMenu({
|
|
|
79
81
|
shadow="level4"
|
|
80
82
|
onMouseDown={(e: React.MouseEvent) => e.stopPropagation()}
|
|
81
83
|
vPad="xs"
|
|
84
|
+
gap={gap}
|
|
82
85
|
onKeyDown={(e: React.KeyboardEvent) => {
|
|
83
86
|
if (e.key === 'ArrowLeft' && !subMenu) {
|
|
84
87
|
e.stopPropagation();
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
## Drawer
|
|
2
|
-
```jsx
|
|
3
2
|
|
|
3
|
+
```jsx
|
|
4
4
|
const [isShowing, setShowing] = React.useState(false);
|
|
5
5
|
|
|
6
6
|
<>
|
|
7
7
|
<SilkeButton
|
|
8
|
-
label={isShowing ?
|
|
8
|
+
label={isShowing ? "Hide" : "Show"}
|
|
9
9
|
onClick={() => setShowing(!isShowing)}
|
|
10
10
|
/>
|
|
11
11
|
|
|
12
|
-
<SilkeBox>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</
|
|
21
|
-
|
|
12
|
+
<SilkeBox>
|
|
13
|
+
<SilkeDrawer
|
|
14
|
+
open={isShowing}
|
|
15
|
+
onRequestClose={() => setShowing(false)}
|
|
16
|
+
title="Closable drawer"
|
|
17
|
+
>
|
|
18
|
+
This drawer will close if you click outside it <i>or</i> if you click the
|
|
19
|
+
close button in the top right corner
|
|
20
|
+
</SilkeDrawer>
|
|
21
|
+
</SilkeBox>
|
|
22
|
+
</>;
|
|
22
23
|
```
|
|
23
|
-
|
|
@@ -6,16 +6,28 @@ you need forms
|
|
|
6
6
|
const [change, setChange] = React.useState({});
|
|
7
7
|
const [submit, setSubmit] = React.useState({});
|
|
8
8
|
const [errors, setErrors] = React.useState({});
|
|
9
|
-
const [items] = React.useState(
|
|
9
|
+
const [items] = React.useState(
|
|
10
|
+
ipsum.list((i) => ({ value: i, label: ipsum.name() }))
|
|
11
|
+
);
|
|
10
12
|
|
|
11
|
-
<SilkeForm
|
|
13
|
+
<SilkeForm
|
|
14
|
+
value={change}
|
|
15
|
+
onSubmit={setSubmit}
|
|
16
|
+
onChange={setChange}
|
|
17
|
+
onErrors={setErrors}
|
|
18
|
+
>
|
|
12
19
|
<SilkeTextField name="text" required />
|
|
13
20
|
<SilkeIconPicker name="icon" />
|
|
14
21
|
<SilkeCheckbox name="checkbox1" label="Checkbox" />
|
|
15
22
|
<SilkeCheckbox name="checkbox2" label="Checkbox 2" required />
|
|
16
23
|
<SilkeSelectField name="select" required items={items} />
|
|
17
24
|
<SilkeRadioButtonGroup name="select" required items={items} />
|
|
18
|
-
<SilkeAutocompleteField
|
|
25
|
+
<SilkeAutocompleteField
|
|
26
|
+
name="autocomplete"
|
|
27
|
+
multiple
|
|
28
|
+
maxItems={2}
|
|
29
|
+
items={items}
|
|
30
|
+
>
|
|
19
31
|
<SilkeTextFieldItem>
|
|
20
32
|
<SilkeButton label="Send" icon="arrow.right" />
|
|
21
33
|
</SilkeTextFieldItem>
|
|
@@ -142,7 +142,7 @@ const ArrayField = ({ value = [], schema, onChange }: SchemaFieldProps<ArrayFiel
|
|
|
142
142
|
))}
|
|
143
143
|
<SilkeBox flex vAlign="center">
|
|
144
144
|
<SilkeTextSmall>
|
|
145
|
-
{typeof item === 'string' ? item : generateTitle(item
|
|
145
|
+
{typeof item === 'string' ? item : generateTitle(item, fieldSchema)}
|
|
146
146
|
</SilkeTextSmall>
|
|
147
147
|
</SilkeBox>
|
|
148
148
|
</SilkeBox>
|
|
@@ -43,7 +43,7 @@ const EventField = ({ value = [], onChange, context }: SchemaFieldProps<EventFie
|
|
|
43
43
|
<SilkeTag
|
|
44
44
|
label={event.type}
|
|
45
45
|
style={{ cursor: 'pointer' }}
|
|
46
|
-
|
|
46
|
+
color={value.find((e) => e.key === curr) ? 'green' : 'sand'}
|
|
47
47
|
onClick={() => {
|
|
48
48
|
if (value.find((e) => e.key === curr)) {
|
|
49
49
|
return onChange(value.filter((v) => v.key !== curr));
|
|
@@ -18,6 +18,7 @@ export const generateTitle = (
|
|
|
18
18
|
if (!title) {
|
|
19
19
|
if (typeof data === 'string' || typeof data === 'number') return data.toString();
|
|
20
20
|
const values = isObject(data) ? flattenObject(data) : data || [];
|
|
21
|
+
console.log('values', values);
|
|
21
22
|
|
|
22
23
|
const haveString = values.some(
|
|
23
24
|
(val: string | number) => typeof val === 'string' || (typeof val === 'number' && val),
|
|
@@ -41,6 +42,12 @@ export const generateTitle = (
|
|
|
41
42
|
return title;
|
|
42
43
|
};
|
|
43
44
|
|
|
44
|
-
export const flattenObject = (data: any):
|
|
45
|
-
|
|
45
|
+
export const flattenObject = (data: any): any[] => {
|
|
46
|
+
let values = Object.values(data);
|
|
47
|
+
for (const value of values) {
|
|
48
|
+
if (isObject(value)) {
|
|
49
|
+
values = [...values, ...flattenObject(value)];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return values;
|
|
46
53
|
};
|
|
@@ -45,38 +45,39 @@ export function SilkeSchemaField({ field, value: fieldValue, noPad }: SilkeSchem
|
|
|
45
45
|
const extendedFields = useExtendedFields();
|
|
46
46
|
|
|
47
47
|
const { value, onChange } =
|
|
48
|
-
field
|
|
48
|
+
field?.storage && field?.name
|
|
49
49
|
? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
50
50
|
useStorageField(field.name, field.storage)
|
|
51
51
|
: // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
52
|
-
useFormField({ name: field
|
|
52
|
+
useFormField({ name: field?.name, value: fieldValue });
|
|
53
53
|
|
|
54
54
|
const context = useSchemaContext();
|
|
55
55
|
const [hidden, setHidden] = useState(false);
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
let Field = (field?.component || SCHEMA_FIELD_COMPONENTS[field?.type]) as any;
|
|
57
58
|
|
|
58
59
|
if (!Field) {
|
|
59
|
-
const extendedField = extendedFields.find((extField) => extField.type === field
|
|
60
|
+
const extendedField = extendedFields.find((extField) => extField.type === field?.type);
|
|
60
61
|
if (extendedField) {
|
|
61
62
|
Field = extendedField.field;
|
|
62
63
|
} else {
|
|
63
|
-
console.warn(`Could not find field type ${field
|
|
64
|
+
console.warn(`Could not find field type ${field?.type}`);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
useEffect(() => {
|
|
68
69
|
const checkHidden = async () => {
|
|
69
|
-
if (isFunction(field
|
|
70
|
-
const hidden = await field
|
|
70
|
+
if (isFunction(field?.hidden)) {
|
|
71
|
+
const hidden = await field?.hidden(context);
|
|
71
72
|
setHidden(hidden);
|
|
72
|
-
} else if (field
|
|
73
|
-
setHidden(field
|
|
73
|
+
} else if (field?.hidden) {
|
|
74
|
+
setHidden(field?.hidden);
|
|
74
75
|
}
|
|
75
76
|
};
|
|
76
77
|
checkHidden();
|
|
77
78
|
}, [field, context]);
|
|
78
79
|
|
|
79
|
-
if (!field
|
|
80
|
+
if (!field?.name && field?.type !== 'layout')
|
|
80
81
|
return (
|
|
81
82
|
<SilkeNotification
|
|
82
83
|
kind="error"
|
|
@@ -86,7 +87,7 @@ export function SilkeSchemaField({ field, value: fieldValue, noPad }: SilkeSchem
|
|
|
86
87
|
/>
|
|
87
88
|
);
|
|
88
89
|
|
|
89
|
-
if (hidden) return null;
|
|
90
|
+
if (hidden || !field) return null;
|
|
90
91
|
|
|
91
92
|
return (
|
|
92
93
|
<SilkeBox hPad={!noPad ? 'm' : undefined} flex>
|
|
@@ -18,9 +18,9 @@ export function SilkeSchemaFields<T>(props: SilkeSchemaFieldsProps<T>) {
|
|
|
18
18
|
{schema.map((field, index) => {
|
|
19
19
|
const comp = SilkeSchemaField({ field, ...rest });
|
|
20
20
|
return comp ? (
|
|
21
|
-
<span style={{ overflow: 'hidden' }} key={(field
|
|
21
|
+
<span style={{ overflow: 'hidden' }} key={(field?.name || 'field') + index}>
|
|
22
22
|
{comp}
|
|
23
|
-
{['object', 'array', 'image'].includes(field
|
|
23
|
+
{['object', 'array', 'image'].includes(field?.type) && index < schema.length - 1 && (
|
|
24
24
|
<SilkeBox column flex key={index}>
|
|
25
25
|
<SilkeDivider dark />
|
|
26
26
|
</SilkeBox>
|
|
@@ -4,16 +4,18 @@ import React, { HTMLAttributes } from 'react';
|
|
|
4
4
|
import { SilkeIconDefinitions } from '../../icons';
|
|
5
5
|
import styles from './silke-icon.scss';
|
|
6
6
|
import { SilkeShape } from './silke-shape';
|
|
7
|
+
import { SilkeColor } from '../../silke-theme-provider';
|
|
7
8
|
|
|
8
9
|
export type SilkeIcons = keyof typeof SilkeIconDefinitions | null | IEmojiIcon;
|
|
9
10
|
|
|
10
11
|
interface SilkeIconProps extends HTMLAttributes<HTMLElement> {
|
|
11
12
|
icon: SilkeIcons | React.ReactElement;
|
|
13
|
+
color?: SilkeColor | string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export function SilkeIcon({ icon, className, color, ...rest }: SilkeIconProps): JSX.Element {
|
|
15
17
|
let cl = styles.icon;
|
|
16
|
-
if (color) cl += ' ' +
|
|
18
|
+
if (color) cl += ' ' + 'color-' + color;
|
|
17
19
|
if (className) cl += ' ' + className;
|
|
18
20
|
if (React.isValidElement(icon)) {
|
|
19
21
|
return (
|
|
@@ -8,7 +8,12 @@ const helper = (i) => ({ active: active === i, onClick: () => setActive(i) });
|
|
|
8
8
|
|
|
9
9
|
<>
|
|
10
10
|
<SilkeBox column>
|
|
11
|
-
<SilkeNavigationLink
|
|
11
|
+
<SilkeNavigationLink
|
|
12
|
+
label="Item 0"
|
|
13
|
+
{...helper(0)}
|
|
14
|
+
icon="user"
|
|
15
|
+
iconRight="add"
|
|
16
|
+
/>
|
|
12
17
|
<SilkeNavigationLink label="Item 1" {...helper(1)} icon="users" />
|
|
13
18
|
<SilkeNavigationLink
|
|
14
19
|
label="Initially active item"
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
```js
|
|
2
|
-
const [value, setValue] = React.useState({ test:
|
|
2
|
+
const [value, setValue] = React.useState({ test: "" });
|
|
3
3
|
|
|
4
4
|
<>
|
|
5
5
|
<SilkeObjectField label="Default" value={value} onChange={setValue}>
|
|
6
6
|
<SilkeTextField name="test" label="Text label" required minLength={5} />
|
|
7
|
-
{value.test && value.test.length > 10 &&
|
|
7
|
+
{value.test && value.test.length > 10 && (
|
|
8
|
+
<SilkeTextField name="test2" required />
|
|
9
|
+
)}
|
|
8
10
|
<SilkeObjectField name="obj">
|
|
9
|
-
<SilkeTextField
|
|
11
|
+
<SilkeTextField
|
|
12
|
+
name="test"
|
|
13
|
+
label="Inside object"
|
|
14
|
+
required
|
|
15
|
+
minLength={5}
|
|
16
|
+
/>
|
|
10
17
|
</SilkeObjectField>
|
|
11
18
|
<SilkeButton label="Submit button" type="submit" />
|
|
12
19
|
</SilkeObjectField>
|
|
@@ -21,7 +21,7 @@ return (
|
|
|
21
21
|
{[1, 2, 3, 4].map((index) => (
|
|
22
22
|
<ProgressStep
|
|
23
23
|
key={index}
|
|
24
|
-
label={
|
|
24
|
+
label={"Step" + index}
|
|
25
25
|
complete={index < step}
|
|
26
26
|
current={step == index}
|
|
27
27
|
error={index == 2 && step > 2 && !pressed}
|
|
@@ -31,7 +31,10 @@ return (
|
|
|
31
31
|
))}
|
|
32
32
|
</ProgressIndicator>
|
|
33
33
|
<SilkeBox align="spread" pad>
|
|
34
|
-
<SilkeButton
|
|
34
|
+
<SilkeButton
|
|
35
|
+
label="Back"
|
|
36
|
+
onClick={() => setStep(Math.max(step - 1, 1))}
|
|
37
|
+
/>
|
|
35
38
|
{step == 2 && (
|
|
36
39
|
<SilkeButton
|
|
37
40
|
kind="secondary"
|
|
@@ -39,7 +42,10 @@ return (
|
|
|
39
42
|
onClick={() => setPressed(true) || setStep(3)}
|
|
40
43
|
/>
|
|
41
44
|
)}
|
|
42
|
-
<SilkeButton
|
|
45
|
+
<SilkeButton
|
|
46
|
+
label="Next"
|
|
47
|
+
onClick={() => setStep(Math.min(step + 1, 4))}
|
|
48
|
+
/>
|
|
43
49
|
</SilkeBox>
|
|
44
50
|
</SilkeBox>
|
|
45
51
|
);
|
|
@@ -40,7 +40,13 @@ const [value, setValue] = React.useState({ name: list[1] });
|
|
|
40
40
|
))}
|
|
41
41
|
|
|
42
42
|
{list.map((name) => (
|
|
43
|
-
<SilkeRadioButton
|
|
43
|
+
<SilkeRadioButton
|
|
44
|
+
key={name}
|
|
45
|
+
name="required"
|
|
46
|
+
value={name}
|
|
47
|
+
label={name}
|
|
48
|
+
required
|
|
49
|
+
/>
|
|
44
50
|
))}
|
|
45
51
|
<pre>Value:{JSON.stringify(value)}</pre>
|
|
46
52
|
</SilkeForm>;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# Search field
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
|
-
const [search, setSearch] = React.useState(
|
|
4
|
+
const [search, setSearch] = React.useState("");
|
|
5
5
|
<>
|
|
6
|
-
<SilkeSearchField
|
|
6
|
+
<SilkeSearchField
|
|
7
|
+
placeholder="Search field"
|
|
8
|
+
search={search}
|
|
9
|
+
onChange={setSearch}
|
|
10
|
+
/>
|
|
7
11
|
<h3>Current search: {search}</h3>
|
|
8
12
|
</>;
|
|
9
13
|
```
|
|
@@ -11,8 +15,12 @@ const [search, setSearch] = React.useState('');
|
|
|
11
15
|
## Search field in toolbar
|
|
12
16
|
|
|
13
17
|
```js
|
|
14
|
-
const [search, setSearch] = React.useState(
|
|
18
|
+
const [search, setSearch] = React.useState("");
|
|
15
19
|
<SilkeToolbar>
|
|
16
|
-
<SilkeSearchField
|
|
20
|
+
<SilkeSearchField
|
|
21
|
+
placeholder="Search field"
|
|
22
|
+
search={search}
|
|
23
|
+
onChange={setSearch}
|
|
24
|
+
/>
|
|
17
25
|
</SilkeToolbar>;
|
|
18
26
|
```
|
|
@@ -7,7 +7,7 @@ const [active, setActive] = React.useState(1);
|
|
|
7
7
|
{[1, 2, 3, 4].map((tab) => (
|
|
8
8
|
<SilkeTab
|
|
9
9
|
key={tab}
|
|
10
|
-
label={
|
|
10
|
+
label={"Tab " + tab}
|
|
11
11
|
disabled={tab === 3}
|
|
12
12
|
active={tab === active}
|
|
13
13
|
onClick={() => setActive(tab)}
|
|
@@ -29,7 +29,7 @@ const [active, setActive] = React.useState(1);
|
|
|
29
29
|
{[1, 2, 3, 4].map((tab) => (
|
|
30
30
|
<SilkeTab
|
|
31
31
|
key={tab}
|
|
32
|
-
label={
|
|
32
|
+
label={"Tab " + tab}
|
|
33
33
|
disabled={tab === 3}
|
|
34
34
|
active={tab === active}
|
|
35
35
|
onClick={() => setActive(tab)}
|
|
@@ -1,34 +1,57 @@
|
|
|
1
1
|
```js
|
|
2
2
|
<SilkeBox column gap>
|
|
3
|
-
{["sand", "yellow", "green", "red", "gray", "blue"].map((color) => (
|
|
3
|
+
{["sand", "yellow", "green", "red", "gray", "blue", "brandYellow","dark"].map((color) => (
|
|
4
4
|
<SilkeBox gap key={color}>
|
|
5
|
-
<SilkeTag
|
|
6
|
-
<SilkeTag
|
|
7
|
-
<SilkeTag
|
|
8
|
-
<SilkeTag
|
|
5
|
+
<SilkeTag color={color} label={color} />
|
|
6
|
+
<SilkeTag color={color} label={ipsum.name()} onRemove={() => {}} />
|
|
7
|
+
<SilkeTag color={color} label={ipsum.name(10)} onRemove={() => {}} />
|
|
8
|
+
<SilkeTag color={color} label="Disabled" disabled/>
|
|
9
9
|
</SilkeBox>
|
|
10
10
|
))}
|
|
11
11
|
</SilkeBox>
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Outlined Tags
|
|
15
15
|
|
|
16
16
|
```js
|
|
17
17
|
<SilkeBox gap>
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
{["sand", "yellow", "green", "red", "gray", "blue", "brandYellow" ,"dark"].map((color) => (
|
|
19
|
+
<SilkeBox gap key={color} col>
|
|
20
|
+
<SilkeTag kind="outlined" color={color} label={color} outline />
|
|
21
|
+
</SilkeBox>
|
|
22
|
+
))}
|
|
20
23
|
</SilkeBox>
|
|
21
24
|
```
|
|
22
25
|
|
|
23
|
-
##
|
|
26
|
+
## secondary with Icon
|
|
24
27
|
|
|
25
28
|
```js
|
|
26
29
|
<SilkeBox gap>
|
|
27
|
-
{["sand", "yellow", "green", "red", "gray", "blue"].map((color) => (
|
|
30
|
+
{["sand", "yellow", "green", "red", "gray", "blue", "brandYellow" ,"dark"].map((color) => (
|
|
28
31
|
<SilkeBox gap key={color} col>
|
|
29
|
-
<SilkeTag kind={color} label={color} outline />
|
|
32
|
+
<SilkeTag kind="secondary" color={color} label={color} outline icon="react" />
|
|
30
33
|
</SilkeBox>
|
|
31
34
|
))}
|
|
35
|
+
<SilkeTag kind="secondary" label="Emoji" outline icon="😎" />
|
|
36
|
+
</SilkeBox>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Sizes
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
<SilkeBox gap column>
|
|
43
|
+
<SilkeBox gap >
|
|
44
|
+
<SilkeTag label="Primary base" />
|
|
45
|
+
<SilkeTag size="tiny" label=" Primary tiny" />
|
|
46
|
+
</SilkeBox>
|
|
47
|
+
<SilkeBox gap >
|
|
48
|
+
<SilkeTag kind="outlined" label="Outlined base" />
|
|
49
|
+
<SilkeTag kind="outlined" size="tiny" label="Outlined tiny" />
|
|
50
|
+
</SilkeBox>
|
|
51
|
+
<SilkeBox gap >
|
|
52
|
+
<SilkeTag kind="secondary" label="Secondary base" />
|
|
53
|
+
<SilkeTag kind="secondary" size="tiny" label="Secondary tiny" />
|
|
54
|
+
</SilkeBox>
|
|
32
55
|
</SilkeBox>
|
|
33
56
|
```
|
|
34
57
|
|
|
@@ -36,11 +59,26 @@
|
|
|
36
59
|
|
|
37
60
|
```js
|
|
38
61
|
<SilkeBox gap>
|
|
39
|
-
{["sand", "yellow", "green", "red", "gray", "blue"].map((color) => (
|
|
62
|
+
{["sand", "yellow", "green", "red", "gray", "blue", "brandYellow" ,"dark"].map((color) => (
|
|
63
|
+
<SilkeBox gap key={color} col>
|
|
64
|
+
<SilkeTag color={color} label={color} icon="react" />
|
|
65
|
+
</SilkeBox>
|
|
66
|
+
))}
|
|
67
|
+
</SilkeBox>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Icon Only
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
<SilkeBox gap>
|
|
74
|
+
{["sand", "yellow", "green", "red", "gray", "blue", "brandYellow","dark"].map((color) => (
|
|
40
75
|
<SilkeBox gap key={color} col>
|
|
41
|
-
<SilkeTag
|
|
76
|
+
<SilkeTag color={color} icon="react" />
|
|
42
77
|
</SilkeBox>
|
|
43
78
|
))}
|
|
79
|
+
<SilkeBox gap col>
|
|
80
|
+
<SilkeTag kind="secondary" color="green" icon="react" />
|
|
81
|
+
</SilkeBox>
|
|
44
82
|
</SilkeBox>
|
|
45
83
|
```
|
|
46
84
|
|