@vev/silke 1.1.10 → 1.2.0
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/.turbo/turbo-build.log +163 -78
- package/CHANGELOG.md +31 -0
- package/dist/index.js +44 -41
- package/dist/index.js.LEGAL.txt +1 -1
- package/dist/index.js.map +7 -0
- package/dist/styles.css +1597 -1014
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/silke-autocomplete-field/autocomplete-item.d.ts +1 -1
- package/dist/types/components/silke-autocomplete-field/silke-autocomplete-field-native.d.ts +5 -0
- package/dist/types/components/silke-box/silke-box.d.ts +2 -0
- package/dist/types/components/silke-button/silke-dropdown-button.d.ts +3 -1
- package/dist/types/components/silke-card/silke-card-grid.d.ts +1 -0
- package/dist/types/components/silke-card/silke-card.d.ts +1 -0
- package/dist/types/components/silke-command-text-field/index.d.ts +1 -1
- package/dist/types/components/silke-command-text-field/silke-command-text-field.d.ts +16 -0
- package/dist/types/components/silke-command-text-field/utils.d.ts +25 -0
- package/dist/types/components/silke-css-number-field/silke-css-number-field.spec.d.ts +1 -0
- package/dist/types/components/silke-expression-input/index.d.ts +3 -0
- package/dist/types/components/silke-expression-input/silke-expression-input-tag.d.ts +6 -0
- package/dist/types/components/silke-expression-input/silke-expression-input.d.ts +29 -0
- package/dist/types/components/silke-expression-input/utils.d.ts +18 -0
- package/dist/types/components/silke-form-schema/fields/array-field-inline.d.ts +2 -1
- package/dist/types/components/silke-form-schema/fields/array-field-modal.d.ts +2 -1
- package/dist/types/components/silke-form-schema/fields/array-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/group-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/layout-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/object-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/popover-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/fields/string-field.d.ts +1 -1
- package/dist/types/components/silke-form-schema/index.d.ts +1 -0
- package/dist/types/components/silke-form-schema/silke-form-schema.d.ts +4 -1
- package/dist/types/components/silke-form-schema/silke-schema-decorator.d.ts +17 -0
- package/dist/types/components/silke-form-schema/silke-schema-field.d.ts +2 -1
- package/dist/types/components/silke-form-schema/silke-schema-fields.d.ts +2 -0
- package/dist/types/components/silke-form-schema/silke-schema-path.spec.d.ts +1 -0
- package/dist/types/components/silke-gradient-picker/silke-gradient-utils.d.ts +2 -0
- package/dist/types/components/silke-icon-picker/color-swatch-section.d.ts +6 -0
- package/dist/types/components/silke-icon-picker/emoji-tab.d.ts +1 -1
- package/dist/types/components/silke-icon-picker/icons-tab.d.ts +1 -1
- package/dist/types/components/silke-icon-picker/silke-icon-picker.d.ts +2 -0
- package/dist/types/components/silke-icon-picker/utils.d.ts +2 -0
- package/dist/types/components/silke-list/silke-list-item.d.ts +5 -1
- package/dist/types/components/silke-list/types.d.ts +1 -0
- package/dist/types/components/silke-navigation-link/silke-navigation-link.d.ts +15 -0
- package/dist/types/components/silke-popover/popover-context.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/blockquote.d.ts +21 -0
- package/dist/types/components/silke-rich-text-field/blockquote.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/dropcap.d.ts +27 -0
- package/dist/types/components/silke-rich-text-field/dropcap.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/floating-layer.d.ts +12 -0
- package/dist/types/components/silke-rich-text-field/font-size.d.ts +2 -0
- package/dist/types/components/silke-rich-text-field/formatting-toolbar.d.ts +9 -0
- package/dist/types/components/silke-rich-text-field/index.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/jsdom-rects.d.ts +10 -0
- package/dist/types/components/silke-rich-text-field/link-menu.d.ts +26 -0
- package/dist/types/components/silke-rich-text-field/link-menu.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/link-suggestions.d.ts +48 -0
- package/dist/types/components/silke-rich-text-field/link-suggestions.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/link-tooltip.d.ts +15 -0
- package/dist/types/components/silke-rich-text-field/list-item.d.ts +15 -0
- package/dist/types/components/silke-rich-text-field/list-link-fontsize.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/lorem-ipsum.d.ts +10 -0
- package/dist/types/components/silke-rich-text-field/lorem-ipsum.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/paste.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/paste.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/plugins.d.ts +18 -0
- package/dist/types/components/silke-rich-text-field/plugins.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/silke-rich-text-field.d.ts +60 -0
- package/dist/types/components/silke-rich-text-field/slash-menu-items.d.ts +10 -0
- package/dist/types/components/silke-rich-text-field/slash-menu.d.ts +11 -0
- package/dist/types/components/silke-rich-text-field/table-content-sync.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/table-toolbar.d.ts +17 -0
- package/dist/types/components/silke-rich-text-field/table-toolbar.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/table.spec.d.ts +1 -0
- package/dist/types/components/silke-rich-text-field/use-link-hover.d.ts +15 -0
- package/dist/types/components/silke-rich-text-field/use-slash-menu.d.ts +13 -0
- package/dist/types/components/silke-rich-text-field/utils.d.ts +13 -0
- package/dist/types/components/silke-sortable-list/index.d.ts +1 -1
- package/dist/types/components/silke-sortable-list/silke-nested-sortable-list.d.ts +8 -1
- package/dist/types/components/silke-theme-card/silke-theme-card.d.ts +13 -6
- package/dist/types/components/silke-theme-swatch/silke-theme-swatch.d.ts +6 -1
- package/dist/types/icons.d.ts +16 -0
- package/esbuild.config.mjs +9 -4
- package/package.json +22 -9
- package/src/components/index.ts +2 -0
- package/src/components/silke-alert-banner/silke-alert-banner.tsx +1 -1
- package/src/components/silke-autocomplete-field/autocomplete-item.tsx +47 -61
- package/src/components/silke-autocomplete-field/silke-autocomplete-field-native.tsx +13 -2
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +8 -5
- package/src/components/silke-autocomplete-field/silke-autocomplete-popup-native.tsx +2 -1
- package/src/components/silke-box/silke-box.scss +4 -0
- package/src/components/silke-box/silke-box.tsx +4 -0
- package/src/components/silke-button/silke-dropdown-button.tsx +4 -1
- package/src/components/silke-card/silke-card.scss +4 -0
- package/src/components/silke-card/silke-card.tsx +3 -0
- package/src/components/silke-command-text-field/index.ts +1 -0
- package/src/components/silke-command-text-field/silke-command-parser.spec.ts +55 -0
- package/src/components/silke-command-text-field/silke-command-parser.ts +33 -2
- package/src/components/silke-command-text-field/silke-command-text-field.module.scss +3 -0
- package/src/components/silke-command-text-field/silke-command-text-field.tsx +53 -48
- package/src/components/silke-command-text-field/utils.spec.ts +192 -0
- package/src/components/silke-command-text-field/utils.ts +99 -16
- package/src/components/silke-css-number-field/silke-css-number-field.spec.tsx +115 -0
- package/src/components/silke-css-number-field/silke-css-number-field.tsx +33 -0
- package/src/components/silke-expression-input/index.ts +3 -0
- package/src/components/silke-expression-input/silke-expression-input-tag.tsx +37 -0
- package/src/components/silke-expression-input/silke-expression-input.mdx +40 -0
- package/src/components/silke-expression-input/silke-expression-input.scss +24 -0
- package/src/components/silke-expression-input/silke-expression-input.tsx +343 -0
- package/src/components/silke-expression-input/utils.ts +144 -0
- package/src/components/silke-form-schema/fields/array-field-inline.tsx +4 -0
- package/src/components/silke-form-schema/fields/array-field-modal.tsx +4 -0
- package/src/components/silke-form-schema/fields/array-field.tsx +6 -11
- package/src/components/silke-form-schema/fields/group-field.tsx +2 -0
- package/src/components/silke-form-schema/fields/layout-field.tsx +2 -0
- package/src/components/silke-form-schema/fields/object-field.tsx +2 -0
- package/src/components/silke-form-schema/fields/popover-field.tsx +2 -0
- package/src/components/silke-form-schema/fields/string-field.tsx +27 -1
- package/src/components/silke-form-schema/index.ts +1 -0
- package/src/components/silke-form-schema/silke-form-schema.mdx +30 -1
- package/src/components/silke-form-schema/silke-form-schema.tsx +12 -6
- package/src/components/silke-form-schema/silke-schema-decorator.tsx +32 -0
- package/src/components/silke-form-schema/silke-schema-field.tsx +19 -2
- package/src/components/silke-form-schema/silke-schema-fields.tsx +30 -4
- package/src/components/silke-form-schema/silke-schema-path.spec.tsx +160 -0
- package/src/components/silke-gradient-picker/silke-gradient-picker.tsx +3 -1
- package/src/components/silke-gradient-picker/silke-gradient-utils.ts +23 -3
- package/src/components/silke-icon/silke-shape.tsx +1 -1
- package/src/components/silke-icon-picker/color-swatch-section.tsx +61 -0
- package/src/components/silke-icon-picker/emoji-tab.tsx +8 -6
- package/src/components/silke-icon-picker/icons-tab.tsx +8 -7
- package/src/components/silke-icon-picker/silke-icon-picker.tsx +52 -25
- package/src/components/silke-icon-picker/styles.scss +66 -1
- package/src/components/silke-icon-picker/utils.ts +2 -0
- package/src/components/silke-list/silke-list-item.scss +10 -0
- package/src/components/silke-list/silke-list-item.tsx +16 -3
- package/src/components/silke-list/silke-list.mdx +18 -0
- package/src/components/silke-list/types.ts +1 -0
- package/src/components/silke-navigation-link/silke-navigation-link.scss +162 -42
- package/src/components/silke-navigation-link/silke-navigation-link.tsx +99 -21
- package/src/components/silke-popover/popover-context.spec.tsx +44 -0
- package/src/components/silke-popover-native/silke-popover-native.scss +5 -3
- package/src/components/silke-rich-text-field/blockquote.spec.ts +151 -0
- package/src/components/silke-rich-text-field/blockquote.ts +90 -0
- package/src/components/silke-rich-text-field/dropcap.spec.ts +67 -0
- package/src/components/silke-rich-text-field/dropcap.ts +59 -0
- package/src/components/silke-rich-text-field/floating-layer.tsx +15 -0
- package/src/components/silke-rich-text-field/font-size.ts +62 -0
- package/src/components/silke-rich-text-field/formatting-toolbar.tsx +145 -0
- package/src/components/silke-rich-text-field/index.ts +1 -0
- package/src/components/silke-rich-text-field/jsdom-rects.ts +15 -0
- package/src/components/silke-rich-text-field/link-menu.spec.tsx +502 -0
- package/src/components/silke-rich-text-field/link-menu.tsx +553 -0
- package/src/components/silke-rich-text-field/link-suggestions.spec.ts +203 -0
- package/src/components/silke-rich-text-field/link-suggestions.ts +188 -0
- package/src/components/silke-rich-text-field/link-tooltip.tsx +60 -0
- package/src/components/silke-rich-text-field/list-item.ts +64 -0
- package/src/components/silke-rich-text-field/list-link-fontsize.spec.ts +135 -0
- package/src/components/silke-rich-text-field/lorem-ipsum.spec.ts +131 -0
- package/src/components/silke-rich-text-field/lorem-ipsum.ts +51 -0
- package/src/components/silke-rich-text-field/paste.spec.ts +93 -0
- package/src/components/silke-rich-text-field/paste.ts +39 -0
- package/src/components/silke-rich-text-field/plugins.spec.ts +143 -0
- package/src/components/silke-rich-text-field/plugins.ts +230 -0
- package/src/components/silke-rich-text-field/silke-rich-text-field.mdx +180 -0
- package/src/components/silke-rich-text-field/silke-rich-text-field.scss +343 -0
- package/src/components/silke-rich-text-field/silke-rich-text-field.tsx +505 -0
- package/src/components/silke-rich-text-field/slash-menu-items.ts +112 -0
- package/src/components/silke-rich-text-field/slash-menu.tsx +50 -0
- package/src/components/silke-rich-text-field/table-content-sync.spec.tsx +61 -0
- package/src/components/silke-rich-text-field/table-toolbar.spec.tsx +168 -0
- package/src/components/silke-rich-text-field/table-toolbar.tsx +121 -0
- package/src/components/silke-rich-text-field/table.spec.ts +87 -0
- package/src/components/silke-rich-text-field/use-link-hover.ts +63 -0
- package/src/components/silke-rich-text-field/use-slash-menu.ts +130 -0
- package/src/components/silke-rich-text-field/utils.ts +55 -0
- package/src/components/silke-sortable-list/index.ts +1 -1
- package/src/components/silke-sortable-list/silke-nested-sortable-list.scss +11 -1
- package/src/components/silke-sortable-list/silke-nested-sortable-list.tsx +9 -0
- package/src/components/silke-sortable-list/silke-sortable-list.mdx +13 -0
- package/src/components/silke-tag/silke-tag.scss +12 -3
- package/src/components/silke-theme-card/silke-theme-card.module.scss +141 -45
- package/src/components/silke-theme-card/silke-theme-card.tsx +76 -47
- package/src/components/silke-theme-swatch/silke-theme-swatch.mdx +56 -0
- package/src/components/silke-theme-swatch/silke-theme-swatch.module.scss +53 -63
- package/src/components/silke-theme-swatch/silke-theme-swatch.tsx +99 -14
- package/src/icons.tsx +51 -5
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -4,9 +4,9 @@ import { SilkeBox } from '../silke-box';
|
|
|
4
4
|
import { SilkeButton } from '../silke-button';
|
|
5
5
|
import ButtonContext from '../silke-button/context';
|
|
6
6
|
import { SilkeSearchField } from '../silke-search-field';
|
|
7
|
-
import { SilkeToolbar } from '../silke-toolbar';
|
|
8
7
|
import { SilkeVirtualGrid } from '../silke-virtual';
|
|
9
8
|
import { TabProps } from './utils';
|
|
9
|
+
import styles from './styles.scss';
|
|
10
10
|
|
|
11
11
|
let iconsPromise: Promise<IShape[]>;
|
|
12
12
|
|
|
@@ -31,7 +31,7 @@ function isIconMatch(icon: IShape, reg: RegExp) {
|
|
|
31
31
|
return false;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export default function IconsTab({ onSelect }: TabProps) {
|
|
34
|
+
export default function IconsTab({ onSelect, extra }: TabProps) {
|
|
35
35
|
const [icons, setIcons] = useState<IShape[] | null>(null);
|
|
36
36
|
const [query, setQuery] = useState('');
|
|
37
37
|
useEffect(() => {
|
|
@@ -55,25 +55,26 @@ export default function IconsTab({ onSelect }: TabProps) {
|
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
57
|
<ButtonContext size="base" kind="ghost">
|
|
58
|
-
<
|
|
58
|
+
<SilkeBox gap="s" vAlign="center" hPad="m" vPad="xs">
|
|
59
59
|
<SilkeSearchField
|
|
60
|
-
placeholder="Search icons
|
|
60
|
+
placeholder="Search icons"
|
|
61
61
|
autoFocus
|
|
62
62
|
flex
|
|
63
63
|
size="base"
|
|
64
|
+
kind="default"
|
|
64
65
|
search={query}
|
|
65
66
|
onChange={setQuery}
|
|
66
67
|
onReset={() => setQuery('')}
|
|
67
68
|
/>
|
|
69
|
+
{extra}
|
|
68
70
|
<SilkeButton
|
|
69
|
-
label="Randomize"
|
|
70
71
|
icon="random"
|
|
71
72
|
onClick={() =>
|
|
72
73
|
icons &&
|
|
73
74
|
onSelect({ type: 1, value: icons[Math.round(Math.random() * (icons.length - 1))].path })
|
|
74
75
|
}
|
|
75
76
|
/>
|
|
76
|
-
</
|
|
77
|
+
</SilkeBox>
|
|
77
78
|
<SilkeBox column gap="s" pad="m" flex scroll>
|
|
78
79
|
{!icons && (
|
|
79
80
|
<SilkeBox gap="xxs">
|
|
@@ -82,7 +83,7 @@ export default function IconsTab({ onSelect }: TabProps) {
|
|
|
82
83
|
<SilkeButton icon="history" loading />
|
|
83
84
|
</SilkeBox>
|
|
84
85
|
)}
|
|
85
|
-
<SilkeVirtualGrid items={filtered} cell={[32, 32]}>
|
|
86
|
+
<SilkeVirtualGrid items={filtered} cell={[32, 32]} className={styles.iconGrid}>
|
|
86
87
|
{(shape) => (
|
|
87
88
|
<SilkeButton
|
|
88
89
|
icon={{ type: 1, value: shape.path }}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { EmojiType, IEmojiIcon } from '@vev/utils';
|
|
2
|
-
import React, { useState } from 'react';
|
|
2
|
+
import React, { useContext, useState } from 'react';
|
|
3
3
|
import { useFormField } from '../../hooks/form';
|
|
4
4
|
import { SilkeBox } from '../silke-box';
|
|
5
|
-
import { SilkeButtonProps } from '../silke-button';
|
|
5
|
+
import { SilkeButton, SilkeButtonProps } from '../silke-button';
|
|
6
6
|
import { FormFieldProps, FormValidator } from '../silke-form';
|
|
7
|
-
import {
|
|
7
|
+
import { getFieldContext } from '../silke-form/form-context';
|
|
8
|
+
import { SilkeIcon, SilkeIcons } from '../silke-icon/silke-icon';
|
|
8
9
|
import { SilkeOverflowMenu } from '../silke-overflow-menu';
|
|
9
10
|
import { SilkeTab, SilkeTabs } from '../silke-tabs';
|
|
10
11
|
import { SilkeText } from '../silke-text';
|
|
12
|
+
import { ColorSwatchSection } from './color-swatch-section';
|
|
11
13
|
import EmojiTab from './emoji-tab';
|
|
12
14
|
import IconsTab from './icons-tab';
|
|
15
|
+
import styles from './styles.scss';
|
|
13
16
|
import UploadTab from './upload-tab';
|
|
14
17
|
|
|
15
18
|
type SilkeIconPickerProps = {
|
|
16
19
|
fallback?: SilkeIcons;
|
|
17
20
|
required?: boolean;
|
|
18
21
|
type?: 'emojis' | 'icon' | 'upload';
|
|
22
|
+
colorName?: string;
|
|
23
|
+
presetColors?: string[];
|
|
19
24
|
} & FormFieldProps<IEmojiIcon> &
|
|
20
25
|
Omit<SilkeButtonProps, 'icon' | 'type' | 'onChange'>;
|
|
21
26
|
|
|
@@ -36,6 +41,8 @@ export function SilkeIconPicker(props: SilkeIconPickerProps) {
|
|
|
36
41
|
type: singleType,
|
|
37
42
|
title,
|
|
38
43
|
onChange,
|
|
44
|
+
colorName,
|
|
45
|
+
presetColors,
|
|
39
46
|
} = useFormField(props, validate);
|
|
40
47
|
const [type, setType] = useState<EmojiType>(
|
|
41
48
|
singleType === 'emojis'
|
|
@@ -47,16 +54,31 @@ export function SilkeIconPicker(props: SilkeIconPickerProps) {
|
|
|
47
54
|
: EmojiType.emoji,
|
|
48
55
|
);
|
|
49
56
|
const [open, setOpen] = useState(false);
|
|
57
|
+
const formContext = useContext(getFieldContext());
|
|
58
|
+
const hasColor = !!(colorName && presetColors && presetColors.length > 0);
|
|
59
|
+
const colorValue = hasColor ? formContext.value[colorName!] : undefined;
|
|
50
60
|
|
|
51
61
|
const handleSelect = (icon: IEmojiIcon | null) => {
|
|
52
|
-
setOpen(false);
|
|
53
62
|
onChange(icon);
|
|
54
63
|
};
|
|
55
64
|
|
|
65
|
+
const baseIcon = value || fallback || 'emoji.add';
|
|
66
|
+
const triggerIcon = colorValue ? (
|
|
67
|
+
<div className={styles.colorPreview}>
|
|
68
|
+
<div className={styles.colorPreviewBg} style={{ backgroundColor: colorValue }} />
|
|
69
|
+
<span>
|
|
70
|
+
<SilkeIcon icon={baseIcon} />
|
|
71
|
+
</span>
|
|
72
|
+
</div>
|
|
73
|
+
) : baseIcon;
|
|
74
|
+
const colorExtra = hasColor ? (
|
|
75
|
+
<ColorSwatchSection colorName={colorName!} presetColors={presetColors!} />
|
|
76
|
+
) : undefined;
|
|
77
|
+
|
|
56
78
|
const button = (
|
|
57
79
|
<SilkeOverflowMenu
|
|
58
80
|
size={size}
|
|
59
|
-
icon={
|
|
81
|
+
icon={triggerIcon}
|
|
60
82
|
open={open}
|
|
61
83
|
kind={kind || 'secondary'}
|
|
62
84
|
name={name}
|
|
@@ -66,34 +88,39 @@ export function SilkeIconPicker(props: SilkeIconPickerProps) {
|
|
|
66
88
|
targetOrigin="top-left"
|
|
67
89
|
onToggleOpen={setOpen}
|
|
68
90
|
>
|
|
69
|
-
<SilkeBox column bg="
|
|
91
|
+
<SilkeBox column bg="neutral-10" shadow="level2" rounded="small" overflow="hidden" className={styles.pickerPanel}>
|
|
92
|
+
<SilkeBox column flex overflow="hidden">
|
|
70
93
|
{!singleType && (
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
<SilkeBox pad="m" vAlign="center" hAlign="spread">
|
|
95
|
+
<SilkeTabs>
|
|
96
|
+
<SilkeTab
|
|
97
|
+
label="Emoji"
|
|
98
|
+
active={type === EmojiType.emoji}
|
|
99
|
+
onClick={() => setType(EmojiType.emoji)}
|
|
100
|
+
/>
|
|
101
|
+
<SilkeTab
|
|
102
|
+
label="Icons"
|
|
103
|
+
active={type === EmojiType.icon}
|
|
104
|
+
onClick={() => setType(EmojiType.icon)}
|
|
105
|
+
/>
|
|
106
|
+
<SilkeTab
|
|
107
|
+
label="Upload"
|
|
108
|
+
active={type === EmojiType.upload}
|
|
109
|
+
onClick={() => setType(EmojiType.upload)}
|
|
110
|
+
/>
|
|
111
|
+
</SilkeTabs>
|
|
112
|
+
<SilkeButton size="s" kind="ghost" icon="close" onClick={() => setOpen(false)} />
|
|
113
|
+
</SilkeBox>
|
|
88
114
|
)}
|
|
89
115
|
{type === EmojiType.emoji ? (
|
|
90
|
-
<EmojiTab icon={value} onSelect={handleSelect} />
|
|
116
|
+
<EmojiTab icon={value} onSelect={handleSelect} extra={colorExtra} />
|
|
91
117
|
) : type === EmojiType.icon ? (
|
|
92
|
-
<IconsTab icon={value} onSelect={handleSelect} />
|
|
118
|
+
<IconsTab icon={value} onSelect={handleSelect} extra={colorExtra} />
|
|
93
119
|
) : (
|
|
94
120
|
<UploadTab icon={value} onSelect={handleSelect} />
|
|
95
121
|
)}
|
|
96
122
|
</SilkeBox>
|
|
123
|
+
</SilkeBox>
|
|
97
124
|
</SilkeOverflowMenu>
|
|
98
125
|
);
|
|
99
126
|
if (!label) return button;
|
|
@@ -1,4 +1,69 @@
|
|
|
1
1
|
@use '../../variables' as *;
|
|
2
|
+
|
|
3
|
+
.pickerPanel {
|
|
4
|
+
width: 352px;
|
|
5
|
+
height: 320px;
|
|
6
|
+
border: 1px solid var(--color-surface-3);
|
|
7
|
+
}
|
|
8
|
+
|
|
2
9
|
.emojiButton {
|
|
3
|
-
font-size
|
|
10
|
+
// Override .icon font-size set by silke-button (12px)
|
|
11
|
+
// to render emojis at a readable size within 32px cells
|
|
12
|
+
span {
|
|
13
|
+
font-size: 24px !important;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.iconGrid {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: $space-xs;
|
|
21
|
+
|
|
22
|
+
> div {
|
|
23
|
+
justify-content: space-evenly;
|
|
24
|
+
gap: $space-xs;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.colorPreview {
|
|
29
|
+
position: relative;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
width: 24px;
|
|
34
|
+
height: 24px;
|
|
35
|
+
border-radius: var(--border-radius-tiny);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.colorPreviewBg {
|
|
39
|
+
position: absolute;
|
|
40
|
+
inset: 0;
|
|
41
|
+
opacity: var(--opacity-level-light);
|
|
42
|
+
border-radius: inherit;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.colorSwatchTrigger {
|
|
46
|
+
position: relative;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.colorSwatchTriggerActive > button[type='button'] {
|
|
50
|
+
background: var(--color-surface-2);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.colorSwatchGrid {
|
|
54
|
+
display: grid;
|
|
55
|
+
grid-template-columns: repeat(5, auto);
|
|
56
|
+
gap: $space-xxs;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.colorSwatchDropdown {
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 100%;
|
|
62
|
+
right: 0;
|
|
63
|
+
margin-top: $space-xs;
|
|
64
|
+
z-index: 100;
|
|
65
|
+
|
|
66
|
+
> * {
|
|
67
|
+
border: 1px solid var(--color-surface-3);
|
|
68
|
+
}
|
|
4
69
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
background-color: transparent;
|
|
7
7
|
width: 100%;
|
|
8
8
|
cursor: pointer;
|
|
9
|
+
text-align: left;
|
|
9
10
|
}
|
|
10
11
|
.item:focus {
|
|
11
12
|
outline: none;
|
|
@@ -19,6 +20,15 @@
|
|
|
19
20
|
background: var(--color-surface-1);
|
|
20
21
|
color: var(--color-neutral-100);
|
|
21
22
|
}
|
|
23
|
+
.item[data-highlight='true'] {
|
|
24
|
+
background-color: var(--color-surface-2);
|
|
25
|
+
color: var(--color-neutral-100);
|
|
26
|
+
}
|
|
27
|
+
.item[data-disabled='true'] {
|
|
28
|
+
opacity: 0.5;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
cursor: default;
|
|
31
|
+
}
|
|
22
32
|
.item[data-no-icon='true'] .body {
|
|
23
33
|
padding-left: $space-xs;
|
|
24
34
|
}
|
|
@@ -21,11 +21,15 @@ type SilkeListItemProps = {
|
|
|
21
21
|
size?: 's' | 'base';
|
|
22
22
|
tag?: SilkeTagProps;
|
|
23
23
|
active?: boolean;
|
|
24
|
+
highlight?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
24
26
|
gap?: boolean;
|
|
25
27
|
maxHeight?: number;
|
|
26
28
|
children?: React.ReactNode;
|
|
27
29
|
alwaysShowChildren?: boolean;
|
|
28
30
|
onClick?: (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
31
|
+
onMouseDown?: (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
32
|
+
onMouseEnter?: () => void;
|
|
29
33
|
onSelect?: () => void;
|
|
30
34
|
} & Omit<React.ComponentProps<typeof SilkeBox>, 'children' | 'tag'>;
|
|
31
35
|
|
|
@@ -37,12 +41,16 @@ export const SilkeListItem = ({
|
|
|
37
41
|
link,
|
|
38
42
|
tag,
|
|
39
43
|
active,
|
|
44
|
+
highlight,
|
|
45
|
+
disabled,
|
|
40
46
|
size,
|
|
41
47
|
gap,
|
|
42
48
|
maxHeight,
|
|
43
49
|
children,
|
|
44
50
|
alwaysShowChildren,
|
|
45
51
|
onClick,
|
|
52
|
+
onMouseDown,
|
|
53
|
+
onMouseEnter,
|
|
46
54
|
onSelect,
|
|
47
55
|
...rest
|
|
48
56
|
}: SilkeListItemProps) => {
|
|
@@ -87,18 +95,22 @@ export const SilkeListItem = ({
|
|
|
87
95
|
const commonProps = {
|
|
88
96
|
rounded: 'small' as const,
|
|
89
97
|
gap: size === 's' ? 'xs' : 's',
|
|
90
|
-
bgHover: 'surface-2',
|
|
91
|
-
vPad: 'xs',
|
|
98
|
+
bgHover: disabled ? undefined : 'surface-2',
|
|
99
|
+
vPad: size === 's' ? undefined : 'xs',
|
|
92
100
|
vAlign: 'center',
|
|
93
101
|
hPad: 'xs',
|
|
94
|
-
|
|
102
|
+
minHeight: size === 's' ? 's' : 'base',
|
|
95
103
|
className: styles.item,
|
|
96
104
|
'data-size': size,
|
|
97
105
|
'data-active': active,
|
|
106
|
+
'data-highlight': highlight,
|
|
107
|
+
'data-disabled': disabled,
|
|
98
108
|
'data-has-children': hasChildren,
|
|
99
109
|
'data-no-icon': !icon,
|
|
100
110
|
'data-pad-body-right': size !== 's' && noContentRight,
|
|
101
111
|
'data-always-show-children': alwaysShowChildren,
|
|
112
|
+
onMouseEnter,
|
|
113
|
+
onMouseDown,
|
|
102
114
|
onClick: (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {
|
|
103
115
|
if (!hasSubItems) {
|
|
104
116
|
onClick?.(e);
|
|
@@ -116,6 +128,7 @@ export const SilkeListItem = ({
|
|
|
116
128
|
|
|
117
129
|
const buttonProps = {
|
|
118
130
|
tag: 'button',
|
|
131
|
+
type: 'button',
|
|
119
132
|
...commonProps,
|
|
120
133
|
} as BoxButtonProps;
|
|
121
134
|
|
|
@@ -69,6 +69,24 @@ const items = [
|
|
|
69
69
|
</SilkeBox>;
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
## With icons and sublabels
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
const items = [
|
|
76
|
+
{ label: 'Home', subLabel: 'Main landing page', icon: 'fa-fal fa-home' },
|
|
77
|
+
{ label: 'Blog', subLabel: 'Latest posts and updates', icon: 'fa-fal fa-newspaper' },
|
|
78
|
+
{ label: 'Settings', subLabel: 'Manage your preferences', icon: 'fa-fal fa-cog' },
|
|
79
|
+
'divider',
|
|
80
|
+
{ label: 'Heading 1', subLabel: 'Large section heading', icon: 'text.h1', groupLabel: 'Text blocks' },
|
|
81
|
+
{ label: 'Heading 2', subLabel: 'Medium section heading', icon: 'text.h2', groupLabel: 'Text blocks' },
|
|
82
|
+
{ label: 'Paragraph', subLabel: 'Plain text block', icon: 'text.p', groupLabel: 'Text blocks' },
|
|
83
|
+
{ label: 'Bullet list', subLabel: 'Unordered list', icon: 'list.check', groupLabel: 'Lists' },
|
|
84
|
+
{ label: 'Numbered list', subLabel: 'Ordered list', icon: 'list.ol', groupLabel: 'Lists' },
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
<SilkeList items={items} />
|
|
88
|
+
```
|
|
89
|
+
|
|
72
90
|
## With link
|
|
73
91
|
|
|
74
92
|
```js
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@use '../../variables' as *;
|
|
2
2
|
|
|
3
3
|
body {
|
|
4
|
-
--nav-item-color: var(--color-neutral-
|
|
5
|
-
--nav-item-color-hover: var(--color-neutral-
|
|
4
|
+
--nav-item-color: var(--color-neutral-90);
|
|
5
|
+
--nav-item-color-hover: var(--color-neutral-100);
|
|
6
6
|
--nav-item-color-pressed: var(--color);
|
|
7
7
|
--nav-item-background-pressed: var(--color);
|
|
8
8
|
}
|
|
@@ -28,40 +28,18 @@ body {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
&:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
&:not(.compactExpand) {
|
|
32
|
+
&:hover,
|
|
33
|
+
&.expanded,
|
|
34
|
+
&.menuOpen {
|
|
35
|
+
> .linkContainer > .link .rightButtons {
|
|
36
|
+
display: block;
|
|
37
|
+
opacity: 1;
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
&::before {
|
|
40
|
-
position: absolute;
|
|
41
|
-
content: '';
|
|
42
|
-
display: block;
|
|
43
|
-
height: 16px;
|
|
44
|
-
width: 4px;
|
|
45
|
-
border-radius: var(--border-radius-tiny);
|
|
46
|
-
|
|
47
|
-
margin: 8px 0 8px 0;
|
|
48
|
-
pointer-events: none;
|
|
49
|
-
transform: translateX(-20px);
|
|
50
|
-
opacity: 1;
|
|
51
|
-
transition: all 0.2s ease-out;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
42
|
&.active {
|
|
55
|
-
& > .linkContainer {
|
|
56
|
-
background: var(--color-surface-1);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&::before {
|
|
60
|
-
background: var(--color-accent-30);
|
|
61
|
-
transform: translateX(-8px);
|
|
62
|
-
opacity: 1;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
43
|
.linkContainer,
|
|
66
44
|
.link {
|
|
67
45
|
color: var(--color-neutral-100);
|
|
@@ -91,7 +69,6 @@ body {
|
|
|
91
69
|
padding: 0 $space-xs;
|
|
92
70
|
|
|
93
71
|
&:hover {
|
|
94
|
-
background: var(--color-surface-1);
|
|
95
72
|
color: var(--nav-item-color-hover);
|
|
96
73
|
.overflowMenu {
|
|
97
74
|
opacity: 1;
|
|
@@ -130,35 +107,178 @@ body {
|
|
|
130
107
|
.link {
|
|
131
108
|
color: var(--nav-item-color);
|
|
132
109
|
}
|
|
133
|
-
.main {
|
|
110
|
+
.main:not(.compactExpand) {
|
|
134
111
|
margin: 0;
|
|
135
112
|
.subLink {
|
|
136
113
|
.linkIcon {
|
|
137
114
|
margin-left: 30px;
|
|
138
115
|
}
|
|
139
116
|
}
|
|
140
|
-
&.active {
|
|
141
|
-
|
|
142
|
-
color: var(--color-neutral-100);
|
|
143
|
-
}
|
|
144
|
-
&::before {
|
|
145
|
-
opacity: 0;
|
|
146
|
-
}
|
|
117
|
+
&.active .link {
|
|
118
|
+
color: var(--color-neutral-100);
|
|
147
119
|
}
|
|
148
120
|
}
|
|
149
121
|
}
|
|
150
122
|
}
|
|
151
123
|
|
|
124
|
+
.linkIconDefault {
|
|
125
|
+
font-size: 14px;
|
|
126
|
+
opacity: 0.7;
|
|
127
|
+
|
|
128
|
+
.active > .linkContainer > .link & {
|
|
129
|
+
opacity: 1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.linkIconCompact {
|
|
134
|
+
font-size: 12px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.labelText {
|
|
138
|
+
font-size: $font-base;
|
|
139
|
+
}
|
|
140
|
+
|
|
152
141
|
.label {
|
|
153
142
|
min-width: 0;
|
|
154
143
|
}
|
|
155
144
|
|
|
156
145
|
.rightButtons {
|
|
146
|
+
display: none;
|
|
157
147
|
opacity: 0;
|
|
158
|
-
transition: all 0.3s ease-out;
|
|
159
148
|
}
|
|
160
149
|
|
|
161
150
|
.dragIcon {
|
|
162
151
|
opacity: 0;
|
|
163
152
|
position: absolute;
|
|
153
|
+
font-size: 12px;
|
|
154
|
+
font-weight: 400;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.iconContent {
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
justify-content: center;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.expandCaret {
|
|
164
|
+
position: absolute;
|
|
165
|
+
display: none;
|
|
166
|
+
align-items: center;
|
|
167
|
+
justify-content: center;
|
|
168
|
+
inset: 0;
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
background: none;
|
|
171
|
+
border: none;
|
|
172
|
+
padding: 0;
|
|
173
|
+
color: var(--color-neutral-60);
|
|
174
|
+
font-size: 10px;
|
|
175
|
+
transition: transform 0.15s ease-out;
|
|
176
|
+
|
|
177
|
+
&.expanded {
|
|
178
|
+
transform: rotate(90deg);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.compactExpand {
|
|
183
|
+
.linkIcon {
|
|
184
|
+
position: relative;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Default team/folder label color
|
|
188
|
+
> .linkContainer > .link {
|
|
189
|
+
color: var(--color-neutral-90);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Folder/team icon opacity: 80% default, 100% on hover/active
|
|
193
|
+
.linkIcon {
|
|
194
|
+
opacity: 0.8;
|
|
195
|
+
|
|
196
|
+
// Size SVG icons rendered by SilkeShape (which have no intrinsic dimensions)
|
|
197
|
+
svg {
|
|
198
|
+
width: 1.125em;
|
|
199
|
+
height: 1.125em;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&.active > .linkContainer > .link .linkIcon,
|
|
204
|
+
> .linkContainer > .link:hover .linkIcon {
|
|
205
|
+
opacity: 1;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Gap between link and sub-items
|
|
209
|
+
.linkContainer {
|
|
210
|
+
gap: $space-xxs;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Hover color for team/folder links
|
|
214
|
+
> .linkContainer > .link:hover {
|
|
215
|
+
color: var(--color-neutral-100);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Active text color — background is owned by the parent container
|
|
219
|
+
// (e.g. SilkeNestedSortableList via .item.selected)
|
|
220
|
+
&.active > .linkContainer > .link {
|
|
221
|
+
color: var(--color-neutral-100);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Indentation via link padding so nested rows sit correctly when the
|
|
225
|
+
// component nests sub-items itself (standalone use)
|
|
226
|
+
.subLink {
|
|
227
|
+
padding: 0;
|
|
228
|
+
|
|
229
|
+
.main.active > .linkContainer > .link {
|
|
230
|
+
color: var(--color-neutral-100);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.link {
|
|
234
|
+
padding-left: 16px;
|
|
235
|
+
color: var(--color-neutral-90);
|
|
236
|
+
|
|
237
|
+
.linkIcon {
|
|
238
|
+
opacity: 0.8;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&:hover {
|
|
242
|
+
color: var(--color-neutral-100);
|
|
243
|
+
|
|
244
|
+
.linkIcon {
|
|
245
|
+
opacity: 1;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.main.active > .linkContainer > .link .linkIcon {
|
|
251
|
+
opacity: 1;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.subLink .link {
|
|
255
|
+
padding-left: 32px;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.subLink .subLink .link {
|
|
259
|
+
padding-left: 48px;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Show rightButtons/expandCaret only on the directly hovered link
|
|
264
|
+
.link:hover {
|
|
265
|
+
> .rightButtons {
|
|
266
|
+
display: block;
|
|
267
|
+
opacity: 1;
|
|
268
|
+
}
|
|
269
|
+
.expandCaret {
|
|
270
|
+
display: flex;
|
|
271
|
+
}
|
|
272
|
+
// Only hide icon when there's a caret to replace it
|
|
273
|
+
.linkIcon:has(.expandCaret) .iconContent {
|
|
274
|
+
visibility: hidden;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Keep rightButtons visible when context menu is open
|
|
279
|
+
&.menuOpen > .linkContainer > .link .rightButtons {
|
|
280
|
+
display: block;
|
|
281
|
+
opacity: 1;
|
|
282
|
+
}
|
|
164
283
|
}
|
|
284
|
+
|