@vev/silke 1.1.10 → 1.2.1
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 +162 -77
- package/CHANGELOG.md +41 -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 +1596 -1013
- 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/fields/utils/generate-preview.spec.d.ts +1 -0
- package/dist/types/components/silke-form-schema/fields/utils/generate-title.d.ts +10 -0
- 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 +33 -5
- package/src/components/silke-form-schema/fields/utils/generate-image.ts +5 -14
- package/src/components/silke-form-schema/fields/utils/generate-preview.spec.ts +49 -0
- package/src/components/silke-form-schema/fields/utils/generate-title.ts +23 -10
- 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
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './silke-sortable-list';
|
|
2
2
|
export * from './silke-nested-sortable-list';
|
|
3
|
-
export { SilkeSortableIconComponent, SilkeSortableIconProps } from './silke-nested-sortable-utils';
|
|
3
|
+
export { Item, SilkeSortableIconComponent, SilkeSortableIconProps } from './silke-nested-sortable-utils';
|
|
@@ -19,12 +19,22 @@ $border-radius: var(--border-radius-small);
|
|
|
19
19
|
box-shadow: 0 0 0 1px solid var(--item-hover-color);
|
|
20
20
|
}
|
|
21
21
|
&:hover:not(.selected) {
|
|
22
|
-
// background-color: var(--item-hover-color);
|
|
23
22
|
box-shadow: inset 0 0 0 1px var(--item-hover-color);
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
}
|
|
27
|
+
|
|
28
|
+
&.hoverFill:not(.dragging) {
|
|
29
|
+
.item {
|
|
30
|
+
&:not(.disabled) {
|
|
31
|
+
&:hover:not(.selected) {
|
|
32
|
+
background: var(--item-hover-color);
|
|
33
|
+
box-shadow: none;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
28
38
|
}
|
|
29
39
|
|
|
30
40
|
.item {
|
|
@@ -23,6 +23,13 @@ type SilkeNestedSortableListProps<T> = {
|
|
|
23
23
|
items: Item<T>[];
|
|
24
24
|
selected?: string[];
|
|
25
25
|
collapsed?: (item: Item<T>) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Style used for hover highlight on rows. `'ring'` (default) paints a 1px
|
|
28
|
+
* inset outline — use for dense lists where hover and selected need to read
|
|
29
|
+
* differently. `'fill'` paints a full-width background — use for
|
|
30
|
+
* sidebar/nav style rows where hover and selected share the same shape.
|
|
31
|
+
*/
|
|
32
|
+
hoverStyle?: 'ring' | 'fill';
|
|
26
33
|
classNameItem?: string | ((item: Item<T>) => string);
|
|
27
34
|
children: RenderFunction<T>;
|
|
28
35
|
replaceIcon?: SilkeSortableIconComponent<T>;
|
|
@@ -49,6 +56,7 @@ export function SilkeNestedSortableList<T>({
|
|
|
49
56
|
items,
|
|
50
57
|
selected,
|
|
51
58
|
collapsed,
|
|
59
|
+
hoverStyle = 'ring',
|
|
52
60
|
children,
|
|
53
61
|
className,
|
|
54
62
|
classNameItem,
|
|
@@ -78,6 +86,7 @@ export function SilkeNestedSortableList<T>({
|
|
|
78
86
|
let cl = styles.list;
|
|
79
87
|
if (className) cl += ' ' + className;
|
|
80
88
|
if (dropState) cl += ' ' + styles.dragging;
|
|
89
|
+
if (hoverStyle === 'fill') cl += ' ' + styles.hoverFill;
|
|
81
90
|
|
|
82
91
|
const [computedStates, parentMap, itemMap] = useMemo(() => {
|
|
83
92
|
const itemMap = keyBy(items, 'key');
|
|
@@ -50,6 +50,19 @@ const Item = (item) => (
|
|
|
50
50
|
|
|
51
51
|
### Nested sortable
|
|
52
52
|
|
|
53
|
+
Selected and hover highlights are painted on the row by the list itself so
|
|
54
|
+
they span the full width (including the indent column). Consumers should
|
|
55
|
+
pipe their "current" keys into the `selected` prop rather than painting
|
|
56
|
+
backgrounds inside the row renderer. Tune the look by overriding the
|
|
57
|
+
`--item-selection-color`, `--item-hover-color`, and
|
|
58
|
+
`--item-child-of-selected-color` CSS variables on the list or individual
|
|
59
|
+
items.
|
|
60
|
+
|
|
61
|
+
Use `hoverStyle="ring"` (default) for dense lists where hover needs to read
|
|
62
|
+
differently from selected (e.g. the layers panel). Use `hoverStyle="fill"`
|
|
63
|
+
for sidebar / navigation style rows where hover and selected share the same
|
|
64
|
+
full-width shape.
|
|
65
|
+
|
|
53
66
|
To sort between lists just give the list the same id
|
|
54
67
|
|
|
55
68
|
```js
|
|
@@ -181,8 +181,17 @@
|
|
|
181
181
|
padding: 0 4px;
|
|
182
182
|
font-size: 12px;
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
// The shared rule above sizes the box as `--tag-height - 8`, which is 8px here, while the
|
|
185
|
+
// glyph stayed at 12px — so icons overflowed their box and collided with the label. A 10px
|
|
186
|
+
// glyph in a 12px box fits the 16px pill, and the wider ones (unlink) stop clipping.
|
|
187
|
+
.tagIcon,
|
|
188
|
+
.removeButton {
|
|
189
|
+
width: 12px;
|
|
190
|
+
height: 12px;
|
|
191
|
+
line-height: 10px;
|
|
192
|
+
font-size: 10px;
|
|
193
|
+
justify-content: center;
|
|
194
|
+
flex: none;
|
|
186
195
|
}
|
|
187
196
|
|
|
188
197
|
&.tiny .disabled {
|
|
@@ -196,4 +205,4 @@
|
|
|
196
205
|
text-decoration: underline;
|
|
197
206
|
}
|
|
198
207
|
}
|
|
199
|
-
}
|
|
208
|
+
}
|
|
@@ -1,82 +1,178 @@
|
|
|
1
1
|
@import '../../variables';
|
|
2
2
|
|
|
3
3
|
.themeCard {
|
|
4
|
+
position: relative;
|
|
4
5
|
display: flex;
|
|
5
6
|
flex-direction: column;
|
|
6
|
-
|
|
7
|
+
width: 100%;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
border-radius: var(--border-radius-small);
|
|
10
|
+
border: 1.8px solid transparent;
|
|
11
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.themeCard.clickable {
|
|
7
15
|
cursor: pointer;
|
|
8
16
|
}
|
|
9
17
|
|
|
18
|
+
// Inner wrapper holds the grid layout and scales as one on hover for a
|
|
19
|
+
// subtle "delight" effect while the outer frame stays fixed.
|
|
10
20
|
.inner {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
display: grid;
|
|
22
|
+
flex: 1;
|
|
23
|
+
width: 100%;
|
|
24
|
+
transition: transform 0.18s ease;
|
|
25
|
+
transform-origin: center center;
|
|
26
|
+
}
|
|
15
27
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
.themeCard.clickable:hover .inner {
|
|
29
|
+
transform: scale(1.02);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.themeCard.selected {
|
|
33
|
+
border-color: var(--color-accent-30);
|
|
34
|
+
box-shadow: inset 0 0 0 1px var(--color-neutral-5);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Compact: single row — Aa | bars | swatches
|
|
38
|
+
.compact {
|
|
39
|
+
height: 56px;
|
|
40
|
+
|
|
41
|
+
.inner {
|
|
42
|
+
grid-template-columns: auto 1fr auto;
|
|
43
|
+
align-items: center;
|
|
44
|
+
gap: $space-m;
|
|
45
|
+
padding: 0 $space-m;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.previewText {
|
|
49
|
+
font-size: 24px;
|
|
50
|
+
line-height: 28px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.swatches {
|
|
54
|
+
gap: 2px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.swatch {
|
|
58
|
+
width: 16px;
|
|
59
|
+
height: 16px;
|
|
28
60
|
}
|
|
29
61
|
}
|
|
30
62
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
63
|
+
// Rich: 2x2 — Aa top-left, swatches top-right, bars/actions stacked left
|
|
64
|
+
.rich {
|
|
65
|
+
min-height: 144px;
|
|
66
|
+
|
|
67
|
+
.inner {
|
|
68
|
+
grid-template-columns: 1fr auto;
|
|
69
|
+
grid-template-rows: auto 1fr auto;
|
|
70
|
+
gap: $space-s $space-m;
|
|
71
|
+
padding: $space-m;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.previewText {
|
|
75
|
+
grid-row: 1;
|
|
76
|
+
grid-column: 1;
|
|
77
|
+
font-size: 32px;
|
|
78
|
+
line-height: 36px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.swatches {
|
|
82
|
+
grid-row: 1;
|
|
83
|
+
grid-column: 2;
|
|
84
|
+
gap: 2px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.swatch {
|
|
88
|
+
width: 16px;
|
|
89
|
+
height: 16px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.bars {
|
|
93
|
+
grid-row: 2;
|
|
94
|
+
grid-column: 1 / -1;
|
|
95
|
+
align-self: start;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.actions {
|
|
99
|
+
grid-row: 3;
|
|
100
|
+
grid-column: 1 / -1;
|
|
101
|
+
gap: $space-m;
|
|
102
|
+
}
|
|
39
103
|
}
|
|
40
104
|
|
|
41
105
|
.previewText {
|
|
42
|
-
font-size: 48px;
|
|
43
106
|
font-weight: 700;
|
|
44
107
|
color: var(--color-neutral-100);
|
|
45
|
-
z-index: 1;
|
|
46
108
|
user-select: none;
|
|
47
109
|
}
|
|
48
110
|
|
|
49
|
-
.
|
|
111
|
+
.bars {
|
|
50
112
|
display: flex;
|
|
51
113
|
flex-direction: column;
|
|
52
|
-
gap: $space-
|
|
114
|
+
gap: $space-xs;
|
|
115
|
+
min-width: 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.bar {
|
|
119
|
+
height: 4px;
|
|
120
|
+
border-radius: 2px;
|
|
53
121
|
width: 100%;
|
|
54
|
-
max-width:
|
|
122
|
+
max-width: 120px;
|
|
55
123
|
}
|
|
56
124
|
|
|
57
|
-
.
|
|
58
|
-
|
|
59
|
-
|
|
125
|
+
.barShort {
|
|
126
|
+
height: 4px;
|
|
127
|
+
border-radius: 2px;
|
|
128
|
+
width: 60%;
|
|
129
|
+
max-width: 80px;
|
|
60
130
|
}
|
|
61
131
|
|
|
62
|
-
.
|
|
132
|
+
.actions {
|
|
63
133
|
display: flex;
|
|
64
|
-
|
|
65
|
-
gap: $space-
|
|
66
|
-
|
|
134
|
+
align-items: center;
|
|
135
|
+
gap: $space-s;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.button {
|
|
139
|
+
display: inline-block;
|
|
140
|
+
padding: 3px 10px;
|
|
141
|
+
font-size: 11px;
|
|
142
|
+
font-weight: 600;
|
|
143
|
+
line-height: 1.4;
|
|
144
|
+
user-select: none;
|
|
145
|
+
white-space: nowrap;
|
|
67
146
|
}
|
|
68
147
|
|
|
69
|
-
.
|
|
148
|
+
.link {
|
|
149
|
+
font-size: 11px;
|
|
150
|
+
font-weight: 500;
|
|
151
|
+
text-decoration: underline;
|
|
152
|
+
user-select: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.swatches {
|
|
70
156
|
display: flex;
|
|
71
|
-
flex-direction: column;
|
|
72
157
|
gap: $space-xs;
|
|
73
158
|
}
|
|
74
159
|
|
|
75
|
-
.
|
|
160
|
+
.swatch {
|
|
161
|
+
width: 24px;
|
|
162
|
+
height: 24px;
|
|
163
|
+
border-radius: var(--border-radius-tiny);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.appliedTag {
|
|
76
167
|
position: absolute;
|
|
77
|
-
top:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
168
|
+
top: $space-s;
|
|
169
|
+
right: $space-s;
|
|
170
|
+
z-index: 2;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.defaultTag {
|
|
174
|
+
position: absolute;
|
|
175
|
+
bottom: $space-s;
|
|
176
|
+
right: $space-s;
|
|
177
|
+
z-index: 2;
|
|
82
178
|
}
|
|
@@ -1,82 +1,111 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styles from './silke-theme-card.module.scss';
|
|
3
|
-
import { SilkeText } from '../silke-text';
|
|
4
3
|
import { SilkeTag } from '../silke-tag';
|
|
5
|
-
import { SilkeOverflowMenu, SilkeOverflowMenuItem } from '../silke-overflow-menu';
|
|
6
4
|
|
|
7
5
|
interface SilkeThemeCardProps {
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
/** Layout variant. `compact` = single row (Aa, bar, swatches). `rich` = two-row with Button + Link. */
|
|
7
|
+
variant?: 'compact' | 'rich';
|
|
10
8
|
primaryColor?: string;
|
|
11
9
|
secondaryColor?: string;
|
|
12
10
|
accentColor?: string;
|
|
13
11
|
bgColor?: string;
|
|
14
12
|
textColor?: string;
|
|
13
|
+
/** Color for the "Aa" heading preview. Falls back to `textColor` when unset. */
|
|
14
|
+
headingColor?: string;
|
|
15
15
|
baseFont?: string;
|
|
16
|
+
/** CSS color for the themed Link element (rich variant only). */
|
|
17
|
+
linkColor?: string;
|
|
18
|
+
/** CSS border-radius for the themed Button (rich variant only). */
|
|
19
|
+
buttonRadius?: string;
|
|
20
|
+
/** Shows an "Applied" pill overlay in the top-right (primary kind). */
|
|
21
|
+
isApplied?: boolean;
|
|
22
|
+
/** Shows a "Default" tag in the bottom-right (secondary kind). */
|
|
16
23
|
isDefault?: boolean;
|
|
24
|
+
/** Outlines the card to indicate selection/applied state. */
|
|
17
25
|
isSelected?: boolean;
|
|
18
26
|
onClick?: () => void;
|
|
19
|
-
menu?: (SilkeOverflowMenuItem | React.ReactElement | 'divider')[];
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
export function SilkeThemeCard({
|
|
23
|
-
|
|
24
|
-
description,
|
|
30
|
+
variant = 'compact',
|
|
25
31
|
primaryColor,
|
|
26
32
|
secondaryColor,
|
|
27
33
|
accentColor,
|
|
28
34
|
bgColor,
|
|
29
35
|
textColor,
|
|
36
|
+
headingColor,
|
|
30
37
|
baseFont,
|
|
38
|
+
linkColor,
|
|
39
|
+
buttonRadius,
|
|
40
|
+
isApplied,
|
|
31
41
|
isDefault,
|
|
32
42
|
isSelected,
|
|
33
43
|
onClick,
|
|
34
|
-
menu,
|
|
35
44
|
}: SilkeThemeCardProps) {
|
|
45
|
+
const isRich = variant === 'rich';
|
|
46
|
+
const classes = [
|
|
47
|
+
styles.themeCard,
|
|
48
|
+
styles[variant],
|
|
49
|
+
onClick ? styles.clickable : '',
|
|
50
|
+
isSelected ? styles.selected : '',
|
|
51
|
+
]
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.join(' ');
|
|
54
|
+
|
|
36
55
|
return (
|
|
37
|
-
<div className={
|
|
38
|
-
<div className={styles.inner}
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</div>
|
|
50
|
-
<div className={styles.colorStrip}>
|
|
51
|
-
<div className={styles.colorStripItem} style={{ background: primaryColor }} />
|
|
52
|
-
<div className={styles.colorStripItem} style={{ background: secondaryColor }} />
|
|
53
|
-
<div className={styles.colorStripItem} style={{ background: accentColor }} />
|
|
54
|
-
</div>
|
|
55
|
-
<div className={styles.tags}>
|
|
56
|
-
{isDefault && <SilkeTag kind="secondary" label="Default" />}
|
|
57
|
-
{isSelected && <SilkeTag kind="secondary" label="Selected" />}
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
<div className={styles.body}>
|
|
61
|
-
<div className={styles.info}>
|
|
62
|
-
<SilkeText>{name}</SilkeText>
|
|
63
|
-
{description && (
|
|
64
|
-
<SilkeText size="small" color="neutral-70">
|
|
65
|
-
{description}
|
|
66
|
-
</SilkeText>
|
|
67
|
-
)}
|
|
56
|
+
<div className={classes} style={{ background: bgColor }} onClick={onClick}>
|
|
57
|
+
<div className={styles.inner}>
|
|
58
|
+
<span
|
|
59
|
+
className={styles.previewText}
|
|
60
|
+
style={{ fontFamily: baseFont || 'inherit', color: headingColor ?? textColor }}
|
|
61
|
+
>
|
|
62
|
+
Aa
|
|
63
|
+
</span>
|
|
64
|
+
|
|
65
|
+
<div className={styles.bars}>
|
|
66
|
+
<div className={styles.bar} style={{ background: textColor, opacity: 0.2 }} />
|
|
67
|
+
<div className={styles.barShort} style={{ background: textColor, opacity: 0.2 }} />
|
|
68
68
|
</div>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
|
|
70
|
+
{isRich && (
|
|
71
|
+
<div className={styles.actions}>
|
|
72
|
+
<span
|
|
73
|
+
className={styles.button}
|
|
74
|
+
style={{
|
|
75
|
+
fontFamily: baseFont || 'inherit',
|
|
76
|
+
background: primaryColor,
|
|
77
|
+
color: bgColor,
|
|
78
|
+
borderRadius: buttonRadius,
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
Button
|
|
82
|
+
</span>
|
|
83
|
+
<span
|
|
84
|
+
className={styles.link}
|
|
85
|
+
style={{ fontFamily: baseFont || 'inherit', color: linkColor || primaryColor }}
|
|
86
|
+
>
|
|
87
|
+
Link
|
|
88
|
+
</span>
|
|
77
89
|
</div>
|
|
78
90
|
)}
|
|
91
|
+
|
|
92
|
+
<div className={styles.swatches}>
|
|
93
|
+
<div className={styles.swatch} style={{ background: primaryColor }} />
|
|
94
|
+
<div className={styles.swatch} style={{ background: secondaryColor }} />
|
|
95
|
+
<div className={styles.swatch} style={{ background: accentColor }} />
|
|
96
|
+
</div>
|
|
79
97
|
</div>
|
|
98
|
+
|
|
99
|
+
{isApplied && (
|
|
100
|
+
<div className={styles.appliedTag}>
|
|
101
|
+
<SilkeTag color="blue" size="tiny" label="Applied" />
|
|
102
|
+
</div>
|
|
103
|
+
)}
|
|
104
|
+
{isDefault && (
|
|
105
|
+
<div className={styles.defaultTag}>
|
|
106
|
+
<SilkeTag kind="secondary" label="Default" />
|
|
107
|
+
</div>
|
|
108
|
+
)}
|
|
80
109
|
</div>
|
|
81
110
|
);
|
|
82
111
|
}
|
|
@@ -57,3 +57,59 @@ const [selected, setSelected] = React.useState(500);
|
|
|
57
57
|
<SilkeText>Selected: {selected}</SilkeText>
|
|
58
58
|
</SilkeBox>;
|
|
59
59
|
```
|
|
60
|
+
|
|
61
|
+
## Primary shade
|
|
62
|
+
|
|
63
|
+
Use `primaryShade` to display a specific shade as a separate square to the left of the strip.
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
const shades = {
|
|
67
|
+
50: '#EFF6FF',
|
|
68
|
+
100: '#DBEAFE',
|
|
69
|
+
200: '#BFDBFE',
|
|
70
|
+
300: '#93C5FD',
|
|
71
|
+
400: '#60A5FA',
|
|
72
|
+
500: '#3B82F6',
|
|
73
|
+
600: '#2563EB',
|
|
74
|
+
700: '#1D4ED8',
|
|
75
|
+
800: '#1E40AF',
|
|
76
|
+
900: '#1E3A8A',
|
|
77
|
+
950: '#172554',
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
<SilkeThemeSwatch
|
|
81
|
+
label="Brand"
|
|
82
|
+
subTitle="Primary"
|
|
83
|
+
shades={shades}
|
|
84
|
+
token="Blue"
|
|
85
|
+
primaryShade={500}
|
|
86
|
+
/>;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Hiding shades
|
|
90
|
+
|
|
91
|
+
Use `disabledShades` to filter specific shades out of the strip (and the primary square) entirely — they're not rendered or selectable. If every non-primary shade is filtered out the strip is skipped, collapsing the row to just the primary square.
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
const shades = {
|
|
95
|
+
50: '#FFF7ED',
|
|
96
|
+
100: '#FFEDD5',
|
|
97
|
+
200: '#FED7AA',
|
|
98
|
+
300: '#FDBA74',
|
|
99
|
+
400: '#FB923C',
|
|
100
|
+
500: '#F97316',
|
|
101
|
+
600: '#EA580C',
|
|
102
|
+
700: '#C2410C',
|
|
103
|
+
800: '#9A3412',
|
|
104
|
+
900: '#7C2D12',
|
|
105
|
+
950: '#431407',
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
<SilkeThemeSwatch
|
|
109
|
+
label="Accent"
|
|
110
|
+
shades={shades}
|
|
111
|
+
token="Orange"
|
|
112
|
+
primaryShade={500}
|
|
113
|
+
disabledShades={[50, 100, 200, 900, 950]}
|
|
114
|
+
/>;
|
|
115
|
+
```
|
|
@@ -6,12 +6,44 @@
|
|
|
6
6
|
gap: $space-xs;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.label {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: $space-xs;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.row {
|
|
16
|
+
display: flex;
|
|
17
|
+
gap: $space-xs;
|
|
18
|
+
overflow: visible;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.primary {
|
|
22
|
+
position: relative;
|
|
23
|
+
height: $space-l;
|
|
24
|
+
aspect-ratio: 1 / 1;
|
|
25
|
+
border-radius: var(--border-radius-tiny);
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
flex-shrink: 0;
|
|
28
|
+
|
|
29
|
+
&[data-selected]::after {
|
|
30
|
+
content: '';
|
|
31
|
+
position: absolute;
|
|
32
|
+
inset: 0;
|
|
33
|
+
border: 1px solid var(--color-accent-30);
|
|
34
|
+
box-shadow: inset 0 0 0 1px var(--color-neutral-5);
|
|
35
|
+
border-radius: 4px;
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
9
41
|
.strip {
|
|
10
42
|
display: flex;
|
|
11
|
-
|
|
43
|
+
flex: 1;
|
|
44
|
+
height: $space-l;
|
|
12
45
|
overflow: visible;
|
|
13
|
-
border-radius: var(--border-radius-
|
|
14
|
-
border: 1px solid var(--color-neutral-20);
|
|
46
|
+
border-radius: var(--border-radius-tiny);
|
|
15
47
|
}
|
|
16
48
|
|
|
17
49
|
.shade {
|
|
@@ -25,84 +57,42 @@
|
|
|
25
57
|
flex: 2.5 1 0;
|
|
26
58
|
}
|
|
27
59
|
|
|
28
|
-
&[data-selected]::before {
|
|
29
|
-
content: '';
|
|
30
|
-
position: absolute;
|
|
31
|
-
top: calc(100% + 4px);
|
|
32
|
-
left: calc(50% - 2px);
|
|
33
|
-
width: 4px;
|
|
34
|
-
height: 4px;
|
|
35
|
-
background: white;
|
|
36
|
-
border-radius: 50%;
|
|
37
|
-
pointer-events: none;
|
|
38
|
-
animation: fade-in 0.3s ease;
|
|
39
|
-
}
|
|
40
60
|
|
|
41
61
|
&[data-selected]::after {
|
|
42
62
|
content: '';
|
|
43
63
|
position: absolute;
|
|
44
64
|
inset: 0;
|
|
45
|
-
border:
|
|
65
|
+
border: 1px solid var(--color-accent-30);
|
|
66
|
+
box-shadow: inset 0 0 0 1px var(--color-neutral-5);
|
|
67
|
+
border-radius: 4px;
|
|
46
68
|
pointer-events: none;
|
|
47
69
|
}
|
|
48
70
|
|
|
49
|
-
&:first-child
|
|
50
|
-
|
|
51
|
-
border-
|
|
52
|
-
border-bottom-left-radius: var(--border-radius-small);
|
|
71
|
+
&:first-child {
|
|
72
|
+
border-top-left-radius: var(--border-radius-tiny);
|
|
73
|
+
border-bottom-left-radius: var(--border-radius-tiny);
|
|
53
74
|
}
|
|
54
75
|
|
|
55
|
-
&:last-child
|
|
56
|
-
|
|
57
|
-
border-
|
|
58
|
-
border-bottom-right-radius: var(--border-radius-small);
|
|
76
|
+
&:last-child {
|
|
77
|
+
border-top-right-radius: var(--border-radius-tiny);
|
|
78
|
+
border-bottom-right-radius: var(--border-radius-tiny);
|
|
59
79
|
}
|
|
60
80
|
}
|
|
61
81
|
|
|
62
|
-
.
|
|
82
|
+
.check {
|
|
63
83
|
position: absolute;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
border: 1px solid rgba(var(--color-neutral-60-rgb), var(--opacity-level-light));
|
|
71
|
-
filter: var(--shadow-level-4);
|
|
84
|
+
inset: 0;
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
font-size: 10px;
|
|
89
|
+
line-height: 0;
|
|
72
90
|
color: var(--color-neutral-100);
|
|
73
|
-
font-size: $font-small;
|
|
74
|
-
line-height: 1.4;
|
|
75
|
-
white-space: nowrap;
|
|
76
91
|
pointer-events: none;
|
|
77
92
|
z-index: 1;
|
|
78
|
-
animation: fade-in 0.3s ease;
|
|
79
93
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
position: absolute;
|
|
83
|
-
top: 100%;
|
|
84
|
-
left: 50%;
|
|
85
|
-
transform: translateX(-50%);
|
|
86
|
-
border: 5px solid transparent;
|
|
87
|
-
border-top-color: var(--color-neutral-10);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
&::before {
|
|
91
|
-
content: '';
|
|
92
|
-
position: absolute;
|
|
93
|
-
top: 100%;
|
|
94
|
-
left: 50%;
|
|
95
|
-
transform: translateX(-50%);
|
|
96
|
-
border: 6px solid transparent;
|
|
97
|
-
border-top-color: rgba(var(--color-neutral-60-rgb), var(--opacity-level-light));
|
|
94
|
+
&[data-light] {
|
|
95
|
+
color: var(--color-neutral-0);
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
98
|
|
|
101
|
-
@keyframes fade-in {
|
|
102
|
-
from {
|
|
103
|
-
opacity: 0;
|
|
104
|
-
}
|
|
105
|
-
to {
|
|
106
|
-
opacity: 1;
|
|
107
|
-
}
|
|
108
|
-
}
|