@vev/silke 1.0.10 → 1.0.12
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 +9 -0
- package/dist/chunk-4MB64AQL.js +22 -0
- package/dist/chunk-4MB64AQL.js.LEGAL.txt +8 -0
- package/dist/chunk-4MB64AQL.js.map +7 -0
- package/dist/index.js +9 -25
- package/dist/index.js.LEGAL.txt +6 -9
- package/dist/index.js.map +4 -4
- package/dist/silke-code-editor-HZRG3D6C.js +23 -0
- package/dist/silke-code-editor-HZRG3D6C.js.map +7 -0
- package/dist/styles.css +4338 -2599
- package/esbuild.config.mjs +2 -1
- package/jest.config.js +2 -1
- package/package.json +12 -8
- package/src/_variables.scss +121 -1
- package/src/components/index.ts +6 -0
- package/src/components/silke-autocomplete-field/autocomplete-item.tsx +15 -13
- package/src/components/silke-autocomplete-field/autocomplete-tags.tsx +14 -7
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.mdx +31 -4
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.scss +8 -6
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +64 -23
- package/src/components/silke-box/silke-box.scss +21 -47
- package/src/components/silke-box/silke-box.tsx +23 -31
- package/src/components/silke-breadcrumbs/silke-breadcrumb.scss +3 -3
- package/src/components/silke-button/index.ts +3 -1
- package/src/components/silke-button/silke-big-button.scss +38 -0
- package/src/components/silke-button/silke-big-button.tsx +49 -0
- package/src/components/silke-button/silke-button-set.tsx +15 -3
- package/src/components/silke-button/silke-button.mdx +41 -19
- package/src/components/silke-button/silke-button.scss +97 -90
- package/src/components/silke-button/silke-button.tsx +20 -5
- package/src/components/silke-button/silke-file-select-button.tsx +86 -0
- package/src/components/silke-card/silke-card-grid.tsx +9 -9
- package/src/components/silke-card/silke-card.mdx +23 -9
- package/src/components/silke-card/silke-card.scss +92 -39
- package/src/components/silke-card/silke-card.tsx +50 -27
- package/src/components/silke-checkbox/silke-checkbox.scss +39 -17
- package/src/components/silke-checkbox/silke-checkbox.tsx +4 -1
- package/src/components/silke-code-editor/index.tsx +12 -0
- package/src/components/silke-code-editor/silke-code-editor.mdx +97 -0
- package/src/components/silke-code-editor/silke-code-editor.tsx +52 -0
- package/src/components/silke-code-snippet/silke-code-snippet.scss +2 -10
- package/src/components/silke-code-snippet/silke-code-snippet.tsx +10 -3
- package/src/components/silke-color-palettes/silke-color-palette.tsx +11 -2
- package/src/components/silke-color-picker/color-picker.scss +10 -6
- package/src/components/silke-color-picker/silke-color-info.tsx +14 -4
- package/src/components/silke-color-picker/silke-color-picker-button.tsx +4 -3
- package/src/components/silke-color-picker/silke-color-picker.tsx +4 -2
- package/src/components/silke-color-picker/silke-opacity-slider.tsx +11 -12
- package/src/components/silke-color-swatches/silke-color-swatch-button.tsx +10 -4
- package/src/components/silke-color-swatches/silke-swatches.tsx +2 -2
- package/src/components/silke-content-column/index.ts +1 -0
- package/src/components/silke-content-column/silke-content-column.mdx +7 -0
- package/src/components/silke-content-column/silke-content-column.scss +39 -0
- package/src/components/silke-content-column/silke-content-column.tsx +14 -0
- package/src/components/silke-context-menu/silke-context-menu-item.tsx +9 -4
- package/src/components/silke-context-menu/silke-context-menu.mdx +16 -12
- package/src/components/silke-context-menu/silke-context-menu.scss +16 -0
- package/src/components/silke-context-menu/silke-context-menu.tsx +62 -39
- package/src/components/silke-css-number-field/silke-css-context.tsx +1 -0
- package/src/components/silke-css-number-field/silke-css-number-field.scss +18 -3
- package/src/components/silke-css-number-field/silke-css-number-field.tsx +32 -13
- package/src/components/silke-css-number-field/utils.ts +2 -0
- package/src/components/silke-divider/silke-divider.scss +4 -2
- package/src/components/silke-drawer/silke-drawer.scss +3 -3
- package/src/components/silke-drawer/silke-drawer.tsx +3 -3
- package/src/components/silke-form/silke-form.tsx +1 -9
- package/src/components/silke-form-schema/fields/array-field-inline.tsx +2 -3
- package/src/components/silke-form-schema/fields/array-field-modal.tsx +1 -1
- package/src/components/silke-form-schema/fields/array-field.tsx +2 -2
- package/src/components/silke-form-schema/fields/event-field.tsx +120 -0
- package/src/components/silke-form-schema/fields/icon-field.tsx +1 -1
- package/src/components/silke-form-schema/fields/image-field.tsx +1 -1
- package/src/components/silke-form-schema/fields/link-field.tsx +8 -1
- package/src/components/silke-form-schema/fields/number-field.tsx +24 -8
- package/src/components/silke-form-schema/fields/object-field.tsx +1 -1
- package/src/components/silke-form-schema/fields/select-field.tsx +9 -2
- package/src/components/silke-form-schema/fields/styles.scss +2 -2
- package/src/components/silke-form-schema/fields/toggle-field.tsx +14 -13
- package/src/components/silke-form-schema/fields/upload-field.tsx +37 -0
- package/src/components/silke-form-schema/fields/utils/generate-image.ts +3 -4
- package/src/components/silke-form-schema/fields/utils/generate-title.ts +1 -3
- package/src/components/silke-form-schema/index.ts +1 -0
- package/src/components/silke-form-schema/silke-extended-fields-context.tsx +22 -0
- package/src/components/silke-form-schema/silke-schema-field.tsx +19 -6
- package/src/components/silke-icon/silke-icon.scss +3 -2
- package/src/components/silke-icon/silke-icon.tsx +7 -3
- package/src/components/silke-icon/silke-shape.tsx +3 -2
- package/src/components/silke-icon-picker/emoji-tab.tsx +2 -2
- package/src/components/silke-icon-picker/icons-tab.tsx +1 -1
- package/src/components/silke-icon-picker/silke-icon-picker.tsx +1 -1
- package/src/components/silke-iframe-portal/index.ts +4 -0
- package/src/components/silke-iframe-portal/silke-iframe-context.ts +6 -0
- package/src/components/silke-iframe-portal/silke-iframe-css-link.tsx +20 -0
- package/src/components/silke-iframe-portal/silke-iframe-portal.mdx +34 -0
- package/src/components/silke-iframe-portal/silke-iframe-portal.tsx +77 -0
- package/src/components/silke-iframe-portal/silke-iframe-script.tsx +20 -0
- package/src/components/silke-link/silke-link.scss +2 -2
- package/src/components/silke-link/silke-link.tsx +8 -9
- package/src/components/silke-list/silke-list.scss +1 -1
- package/src/components/silke-list-card/index.ts +1 -0
- package/src/components/silke-list-card/silke-list-card.mdx +50 -0
- package/src/components/silke-list-card/silke-list-card.scss +57 -0
- package/src/components/silke-list-card/silke-list-card.tsx +65 -0
- package/src/components/silke-loader/index.ts +1 -0
- package/src/components/silke-loader/silke-loader-overlay.tsx +63 -0
- package/src/components/silke-loader/silke-loader.scss +112 -0
- package/src/components/silke-loader/silke-loader.tsx +1 -0
- package/src/components/silke-modal/silke-confirmation-modal.tsx +1 -1
- package/src/components/silke-modal/silke-modal.mdx +1 -1
- package/src/components/silke-modal/silke-modal.scss +16 -10
- package/src/components/silke-modal/silke-modal.tsx +65 -47
- package/src/components/silke-navigation-link/silke-navigation-link.scss +69 -41
- package/src/components/silke-navigation-link/silke-navigation-link.tsx +26 -14
- package/src/components/silke-notification/confetti.tsx +164 -0
- package/src/components/silke-notification/silke-notification.mdx +137 -20
- package/src/components/silke-notification/silke-notification.scss +116 -89
- package/src/components/silke-notification/silke-notification.tsx +44 -113
- package/src/components/silke-object-field/silke-object-field.tsx +1 -1
- package/src/components/silke-overflow-menu/silke-overflow-menu.mdx +2 -2
- package/src/components/silke-overflow-menu/silke-overflow-menu.scss +12 -4
- package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +53 -30
- package/src/components/silke-popover/silke-popover.mdx +2 -2
- package/src/components/silke-popover/silke-popover.tsx +23 -5
- package/src/components/silke-progress-indicator/silke-progress-indicator.scss +5 -5
- package/src/components/silke-radio-button/silke-radio-button-group.tsx +1 -1
- package/src/components/silke-radio-button/silke-radio-button.scss +24 -9
- package/src/components/silke-search-field/silke-search-field.tsx +10 -5
- package/src/components/silke-select-field/silke-select-field.mdx +11 -5
- package/src/components/silke-skeleton/silke-skeleton.scss +2 -2
- package/src/components/silke-slider/range-slider.scss +13 -10
- package/src/components/silke-slider/silke-slider.tsx +5 -0
- package/src/components/silke-sortable-list/silke-nested-sortable-item.tsx +105 -0
- package/src/components/silke-sortable-list/silke-nested-sortable-list.scss +37 -25
- package/src/components/silke-sortable-list/silke-nested-sortable-list.tsx +180 -127
- package/src/components/silke-sortable-list/silke-nested-sortable-utils.ts +53 -23
- package/src/components/silke-sortable-list/silke-sortable-item-wrapper.tsx +1 -1
- package/src/components/silke-sortable-list/silke-sortable-list.mdx +12 -16
- package/src/components/silke-sortable-list/silke-sortable-list.scss +39 -29
- package/src/components/silke-sortable-list/silke-sortable-list.tsx +27 -15
- package/src/components/silke-steps/index.ts +1 -0
- package/src/components/silke-steps/silke-steps.mdx +60 -0
- package/src/components/silke-steps/silke-steps.scss +14 -0
- package/src/components/silke-steps/silke-steps.tsx +53 -0
- package/src/components/silke-table/silke-table.mdx +44 -13
- package/src/components/silke-table/silke-table.scss +19 -9
- package/src/components/silke-table/silke-table.tsx +80 -71
- package/src/components/silke-table/table-row.tsx +11 -6
- package/src/components/silke-tabs/silke-tab.tsx +4 -0
- package/src/components/silke-tabs/silke-tabs.scss +18 -15
- package/src/components/silke-tabs/silke-tabs.tsx +4 -7
- package/src/components/silke-tag/silke-tag.mdx +36 -2
- package/src/components/silke-tag/silke-tag.scss +49 -30
- package/src/components/silke-tag/silke-tag.tsx +21 -6
- package/src/components/silke-text/silke-text-types.ts +2 -1
- package/src/components/silke-text/silke-text.mdx +28 -20
- package/src/components/silke-text/silke-text.scss +8 -7
- package/src/components/silke-text/silke-title.scss +1 -1
- package/src/components/silke-text-field/silke-text-field-outline.tsx +4 -4
- package/src/components/silke-text-field/silke-text-field.mdx +32 -14
- package/src/components/silke-text-field/silke-text-field.scss +41 -23
- package/src/components/silke-text-field/silke-text-field.tsx +13 -5
- package/src/components/silke-text-field/text-field-context.tsx +1 -1
- package/src/components/silke-theme-editor/index.ts +1 -0
- package/src/components/silke-theme-editor/silke-theme-editor.tsx +165 -0
- package/src/components/silke-tile/silke-tile.scss +13 -18
- package/src/components/silke-tile/silke-tile.tsx +11 -17
- package/src/components/silke-toggle/silke-toggle.scss +17 -9
- package/src/components/silke-toggle/silke-toggle.tsx +1 -1
- package/src/components/silke-toolbar/silke-toolbar.scss +1 -1
- package/src/components/silke-tooltip/silke-definition-tooltip.tsx +14 -6
- package/src/components/silke-tooltip/silke-icon-tooltip.tsx +48 -34
- package/src/components/silke-tooltip/silke-interactive-tooltip.tsx +5 -3
- package/src/components/silke-tooltip/silke-tooltip.mdx +69 -2
- package/src/components/silke-tooltip/silke-tooltip.scss +71 -46
- package/src/components/silke-tooltip/silke-tooltip.tsx +142 -52
- package/src/components/silke-tooltip/utils.ts +93 -0
- package/src/components/silke-upload-field/silke-upload-field.mdx +14 -0
- package/src/components/silke-upload-field/silke-upload-field.scss +26 -17
- package/src/components/silke-upload-field/silke-upload-field.tsx +37 -14
- package/src/docs/app.tsx +118 -25
- package/src/docs/components/code-block/code-block.scss +0 -2
- package/src/docs/components/code-block/code-block.tsx +17 -9
- package/src/hooks/drag-and-drop/use-drag.tsx +5 -1
- package/src/hooks/drag-and-drop/use-drop.tsx +5 -4
- package/src/icons.tsx +194 -10
- package/src/index.mdx +66 -1
- package/src/main.tsx +5 -2
- package/src/silke-theme-provider.tsx +51 -3
- package/src/styles/core.scss +56 -91
- package/webpack.docs.ts +1 -3
- package/webpack.config.ts +0 -131
|
@@ -3,7 +3,7 @@ import classnames from 'classnames/bind';
|
|
|
3
3
|
import { isArray, isEqual, isObject } from 'lodash';
|
|
4
4
|
import React, { HTMLAttributes, useMemo, useState } from 'react';
|
|
5
5
|
import { SilkeBox } from '../silke-box';
|
|
6
|
-
import { SilkeButton } from '../silke-button';
|
|
6
|
+
import { ButtonContext, SilkeButton } from '../silke-button';
|
|
7
7
|
import { SilkeCheckbox } from '../silke-checkbox';
|
|
8
8
|
import TextFieldContext from '../silke-text-field/text-field-context';
|
|
9
9
|
import styles from './silke-table.scss';
|
|
@@ -107,81 +107,90 @@ export function SilkeTable<T>({
|
|
|
107
107
|
if (menu) columnCount++;
|
|
108
108
|
|
|
109
109
|
return (
|
|
110
|
-
<
|
|
111
|
-
{
|
|
112
|
-
cellSpacing="0"
|
|
113
|
-
cellPadding="0"
|
|
114
|
-
className={cl('table', className, {
|
|
115
|
-
fixedColumns,
|
|
116
|
-
hasSelected: multiselect ? (selected as T[])?.length > 0 : Boolean(selected),
|
|
117
|
-
})}
|
|
118
|
-
>
|
|
119
|
-
<colgroup>
|
|
120
|
-
{columns.map((col, index) => {
|
|
121
|
-
return <col style={{ width: col.width ? col.width + 'px' : undefined }} key={index} />;
|
|
122
|
-
})}
|
|
123
|
-
{menu && <col />}
|
|
124
|
-
{multiselect && <col />}
|
|
125
|
-
</colgroup>
|
|
126
|
-
<thead>
|
|
110
|
+
<ButtonContext size="m">
|
|
111
|
+
<SilkeBox column gap="s" className={styles.root}>
|
|
127
112
|
{children && (
|
|
128
|
-
<TextFieldContext size="
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
113
|
+
<TextFieldContext size="m" kind="secondary" inline>
|
|
114
|
+
<SilkeBox
|
|
115
|
+
className={styles.toolbar}
|
|
116
|
+
gap="m"
|
|
117
|
+
vAlign="center"
|
|
118
|
+
hPad="s"
|
|
119
|
+
vPad="s"
|
|
120
|
+
bg="neutral-5"
|
|
121
|
+
>
|
|
122
|
+
{children}
|
|
123
|
+
</SilkeBox>
|
|
136
124
|
</TextFieldContext>
|
|
137
125
|
)}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
126
|
+
<table
|
|
127
|
+
{...rest}
|
|
128
|
+
cellSpacing="0"
|
|
129
|
+
cellPadding="0"
|
|
130
|
+
className={cl('table', className, {
|
|
131
|
+
fixedColumns,
|
|
132
|
+
hasSelected: multiselect ? (selected as T[])?.length > 0 : Boolean(selected),
|
|
133
|
+
})}
|
|
134
|
+
>
|
|
135
|
+
<colgroup>
|
|
136
|
+
{columns.map((col, index) => {
|
|
137
|
+
return (
|
|
138
|
+
<col style={{ width: col.width ? col.width + 'px' : undefined }} key={index} />
|
|
139
|
+
);
|
|
140
|
+
})}
|
|
141
|
+
{menu && <col />}
|
|
142
|
+
{multiselect && <col />}
|
|
143
|
+
</colgroup>
|
|
144
|
+
<thead>
|
|
145
|
+
{!hideHeaders && (
|
|
146
|
+
<tr className={styles.head}>
|
|
147
|
+
{multiselect && (
|
|
148
|
+
<th className={styles.check}>
|
|
149
|
+
<SilkeCheckbox
|
|
150
|
+
value={allSelected}
|
|
151
|
+
onChange={(v) => onSelect && onSelect(v ? (items as any) : [])}
|
|
152
|
+
/>
|
|
153
|
+
</th>
|
|
154
|
+
)}
|
|
155
|
+
{columns.map((c, i) => (
|
|
156
|
+
<th key={i}>{c.label}</th>
|
|
157
|
+
))}
|
|
158
|
+
{menu && <th className={styles.menu} />}
|
|
159
|
+
</tr>
|
|
147
160
|
)}
|
|
148
|
-
|
|
149
|
-
<th key={i}>{c.label}</th>
|
|
150
|
-
))}
|
|
151
|
-
{menu && <th className={styles.menu} />}
|
|
152
|
-
</tr>
|
|
153
|
-
)}
|
|
154
|
-
</thead>
|
|
161
|
+
</thead>
|
|
155
162
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
/>
|
|
168
|
-
))}
|
|
169
|
-
</tbody>
|
|
170
|
-
{onLoadMore && (
|
|
171
|
-
<tfoot>
|
|
172
|
-
<tr>
|
|
173
|
-
<td className={styles.loadBtn} colSpan={columnCount}>
|
|
174
|
-
<SilkeButton
|
|
175
|
-
kind="secondary"
|
|
176
|
-
loading={loading}
|
|
177
|
-
label={loadMoreLabel || 'Load more'}
|
|
178
|
-
icon="arrow.down"
|
|
179
|
-
onClick={handleLoadMore}
|
|
163
|
+
<tbody>
|
|
164
|
+
{items.map((item, i) => (
|
|
165
|
+
<TableRow
|
|
166
|
+
key={i}
|
|
167
|
+
item={item}
|
|
168
|
+
columns={columns}
|
|
169
|
+
menu={menu}
|
|
170
|
+
multiselect={multiselect}
|
|
171
|
+
selected={selectedRows[i]}
|
|
172
|
+
search={searchReg}
|
|
173
|
+
onSelect={onSelect && handleSelect}
|
|
180
174
|
/>
|
|
181
|
-
|
|
182
|
-
</
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
175
|
+
))}
|
|
176
|
+
</tbody>
|
|
177
|
+
{onLoadMore && (
|
|
178
|
+
<tfoot>
|
|
179
|
+
<tr>
|
|
180
|
+
<td className={styles.loadBtn} colSpan={columnCount}>
|
|
181
|
+
<SilkeButton
|
|
182
|
+
kind="secondary"
|
|
183
|
+
loading={loading}
|
|
184
|
+
label={loadMoreLabel || 'Load more'}
|
|
185
|
+
icon="arrow.down"
|
|
186
|
+
onClick={handleLoadMore}
|
|
187
|
+
/>
|
|
188
|
+
</td>
|
|
189
|
+
</tr>
|
|
190
|
+
</tfoot>
|
|
191
|
+
)}
|
|
192
|
+
</table>
|
|
193
|
+
</SilkeBox>
|
|
194
|
+
</ButtonContext>
|
|
186
195
|
);
|
|
187
196
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isString } from 'lodash';
|
|
1
|
+
import { isString, omit } from 'lodash';
|
|
2
2
|
import React, { ReactNode, useMemo } from 'react';
|
|
3
3
|
import { SilkeCheckbox } from '../silke-checkbox';
|
|
4
4
|
import { SilkeOverflowMenu } from '../silke-overflow-menu';
|
|
@@ -38,12 +38,17 @@ export function TableRow<T>({
|
|
|
38
38
|
return columns.map((column) => {
|
|
39
39
|
const value = item[column.attr];
|
|
40
40
|
if (column.transform) return column.transform(value, item);
|
|
41
|
-
return value as React.
|
|
41
|
+
return value as unknown as React.ReactElement;
|
|
42
42
|
});
|
|
43
43
|
}, [item, columns]);
|
|
44
|
+
|
|
44
45
|
// Checking if one of the values matches the search
|
|
45
46
|
if (search && !hasSearchMatch(search, values)) return null;
|
|
46
|
-
|
|
47
|
+
const filteredMenu = menu
|
|
48
|
+
? menu
|
|
49
|
+
.filter((m) => m === 'divider' || !m.isVisible || m.isVisible(item))
|
|
50
|
+
.map((m) => (typeof m === 'object' ? omit(m, 'isVisible') : m))
|
|
51
|
+
: undefined;
|
|
47
52
|
return (
|
|
48
53
|
<tr
|
|
49
54
|
className={!multiselect && onSelect ? styles.selectable : undefined}
|
|
@@ -62,13 +67,13 @@ export function TableRow<T>({
|
|
|
62
67
|
{value}
|
|
63
68
|
</td>
|
|
64
69
|
))}
|
|
65
|
-
{
|
|
70
|
+
{filteredMenu && (
|
|
66
71
|
<td className={styles.menu} onClick={stopPropagation}>
|
|
67
|
-
{
|
|
72
|
+
{filteredMenu.length > 0 && (
|
|
68
73
|
<SilkeOverflowMenu
|
|
69
74
|
kind="ghost"
|
|
70
75
|
size="base"
|
|
71
|
-
items={
|
|
76
|
+
items={filteredMenu.map((m) =>
|
|
72
77
|
m === 'divider' ? m : { ...m, onClick: () => m.onClick(item) },
|
|
73
78
|
)}
|
|
74
79
|
/>
|
|
@@ -12,6 +12,7 @@ export type SilkeTabProps = {
|
|
|
12
12
|
error?: boolean;
|
|
13
13
|
href?: string;
|
|
14
14
|
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
15
16
|
onClick?: () => void;
|
|
16
17
|
};
|
|
17
18
|
|
|
@@ -21,6 +22,7 @@ export function SilkeTab({
|
|
|
21
22
|
href,
|
|
22
23
|
className,
|
|
23
24
|
error,
|
|
25
|
+
style,
|
|
24
26
|
onClick,
|
|
25
27
|
...rest
|
|
26
28
|
}: SilkeTabProps) {
|
|
@@ -37,6 +39,7 @@ export function SilkeTab({
|
|
|
37
39
|
return href ? (
|
|
38
40
|
<Link
|
|
39
41
|
to={href}
|
|
42
|
+
style={style}
|
|
40
43
|
rel="button"
|
|
41
44
|
className={classNames}
|
|
42
45
|
onClick={onClick ? onClickProxy : undefined}
|
|
@@ -48,6 +51,7 @@ export function SilkeTab({
|
|
|
48
51
|
<a
|
|
49
52
|
aria-selected={active}
|
|
50
53
|
role="tab"
|
|
54
|
+
style={style}
|
|
51
55
|
href="#"
|
|
52
56
|
className={classNames}
|
|
53
57
|
onClick={onClickProxy}
|
|
@@ -27,31 +27,34 @@ $tab-height: $size-m;
|
|
|
27
27
|
top: 2px;
|
|
28
28
|
bottom: 2px;
|
|
29
29
|
display: block;
|
|
30
|
-
border: 2px solid var(--color-neutral-
|
|
30
|
+
border: 2px solid var(--color-neutral-100);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.tabs.standard {
|
|
34
34
|
a.tab {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
justify-content: center;
|
|
36
|
+
min-width: 110px;
|
|
37
|
+
padding: 8px 16px 6px;
|
|
38
|
+
color: var(--color-neutral-100);
|
|
39
|
+
border-bottom: 1px rgba(var(--color-neutral-100-rgb), var(--opacity-level-light)) solid;
|
|
38
40
|
margin-right: 1px;
|
|
41
|
+
margin-bottom:-1px;
|
|
39
42
|
position: relative;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
a.tab:hover {
|
|
43
|
-
color: var(--color-neutral-
|
|
46
|
+
color: var(--color-neutral-100);
|
|
44
47
|
text-decoration: underline;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
a.tab--active, a.tab--active:focus {
|
|
48
|
-
border-bottom: 2px var(--color-
|
|
51
|
+
border-bottom: 2px var(--color-accent-30) solid;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
.tab[disabled],
|
|
52
55
|
.tab[disabled]:hover {
|
|
53
|
-
color: var(--color-neutral-
|
|
54
|
-
border-bottom-color: var(--color-neutral-
|
|
56
|
+
color: var(--color-neutral-30);
|
|
57
|
+
border-bottom-color: var(--color-neutral-5);
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
|
|
@@ -59,14 +62,14 @@ $tab-height: $size-m;
|
|
|
59
62
|
|
|
60
63
|
a.tab {
|
|
61
64
|
padding: 6px 50px 8px 16px;
|
|
62
|
-
color: var(--color-neutral-
|
|
65
|
+
color: var(--color-neutral-100);
|
|
63
66
|
position: relative;
|
|
64
67
|
border-top: 2px solid transparent;
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
a.tab:hover, a.tab--active {
|
|
68
|
-
background: var(--color-neutral-
|
|
69
|
-
color: var(--color-neutral-
|
|
71
|
+
background: var(--color-neutral-5);
|
|
72
|
+
color: var(--color-neutral-100);
|
|
70
73
|
text-decoration: none;
|
|
71
74
|
}
|
|
72
75
|
|
|
@@ -76,16 +79,16 @@ $tab-height: $size-m;
|
|
|
76
79
|
|
|
77
80
|
.tab[disabled],
|
|
78
81
|
.tab[disabled]:hover {
|
|
79
|
-
color: var(--color-neutral-
|
|
82
|
+
color: var(--color-neutral-30);
|
|
80
83
|
background: transparent;
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
a.tab--active {
|
|
84
|
-
border-top-color: var(--color-
|
|
85
|
-
color: var(--color-neutral-
|
|
87
|
+
border-top-color: var(--color-accent-30);
|
|
88
|
+
color: var(--color-neutral-80);
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
.tab--active:hover {
|
|
89
|
-
background: var(--color-neutral-
|
|
92
|
+
background: var(--color-neutral-10);
|
|
90
93
|
}
|
|
91
94
|
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import classnames from 'classnames/bind';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { SilkeColor } from '../../silke-theme-provider';
|
|
4
|
+
import { BoxProps, SilkeBox } from '../silke-box';
|
|
4
5
|
import styles from './silke-tabs.scss';
|
|
5
6
|
|
|
6
7
|
const cl = classnames.bind(styles);
|
|
7
8
|
|
|
8
9
|
type TabsProps = {
|
|
9
10
|
container?: boolean;
|
|
10
|
-
bg?:
|
|
11
|
+
bg?: SilkeColor;
|
|
11
12
|
children: React.ReactNode;
|
|
12
13
|
} & BoxProps;
|
|
13
14
|
|
|
14
15
|
export function SilkeTabs({ container, children, bg, ...rest }: TabsProps) {
|
|
15
16
|
return (
|
|
16
|
-
<SilkeBox
|
|
17
|
-
className={cl('tabs', { container, standard: !container })}
|
|
18
|
-
{...rest}
|
|
19
|
-
bg={bg || 'background'}
|
|
20
|
-
>
|
|
17
|
+
<SilkeBox className={cl('tabs', { container, standard: !container })} {...rest}>
|
|
21
18
|
{children}
|
|
22
19
|
</SilkeBox>
|
|
23
20
|
);
|
|
@@ -1,17 +1,51 @@
|
|
|
1
1
|
```js
|
|
2
2
|
<SilkeBox column gap>
|
|
3
|
-
{[
|
|
3
|
+
{["sand", "yellow", "green", "red", "gray", "blue"].map((color) => (
|
|
4
4
|
<SilkeBox gap key={color}>
|
|
5
5
|
<SilkeTag kind={color} label={color} />
|
|
6
6
|
<SilkeTag kind={color} label={ipsum.name()} onRemove={() => {}} />
|
|
7
7
|
<SilkeTag kind={color} label={ipsum.name(10)} onRemove={() => {}} />
|
|
8
8
|
<SilkeTag kind={color} label="Disabled" disabled />
|
|
9
9
|
</SilkeBox>
|
|
10
|
-
)}
|
|
10
|
+
))}
|
|
11
|
+
</SilkeBox>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Sizes
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
<SilkeBox gap>
|
|
18
|
+
<SilkeTag label="Standard" />
|
|
19
|
+
<SilkeTag size="tiny" label="Tiny" />
|
|
20
|
+
</SilkeBox>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Outlined Tags
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
<SilkeBox gap>
|
|
27
|
+
{["sand", "yellow", "green", "red", "gray", "blue"].map((color) => (
|
|
28
|
+
<SilkeBox gap key={color} col>
|
|
29
|
+
<SilkeTag kind={color} label={color} outline />
|
|
30
|
+
</SilkeBox>
|
|
31
|
+
))}
|
|
32
|
+
</SilkeBox>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## With Icon
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
<SilkeBox gap>
|
|
39
|
+
{["sand", "yellow", "green", "red", "gray", "blue"].map((color) => (
|
|
40
|
+
<SilkeBox gap key={color} col>
|
|
41
|
+
<SilkeTag kind={color} label={color} icon="react" />
|
|
42
|
+
</SilkeBox>
|
|
43
|
+
))}
|
|
11
44
|
</SilkeBox>
|
|
12
45
|
```
|
|
13
46
|
|
|
14
47
|
## Shorthand Wrappers
|
|
48
|
+
|
|
15
49
|
```js
|
|
16
50
|
<SilkeBox gap>
|
|
17
51
|
<SilkeTagSand label="Sand" />
|
|
@@ -9,64 +9,71 @@ $btn-font-size: $font-small;
|
|
|
9
9
|
|
|
10
10
|
$kinds: (
|
|
11
11
|
name: "gray",
|
|
12
|
-
bg: var(--color-neutral-
|
|
13
|
-
color: var(--color-neutral-
|
|
14
|
-
btn-bg-hover: var(--color-neutral-
|
|
12
|
+
bg: var(--color-neutral-40-rgb),
|
|
13
|
+
color: var(--color-neutral-100),
|
|
14
|
+
btn-bg-hover: var(--color-neutral-30),
|
|
15
15
|
),
|
|
16
16
|
(
|
|
17
17
|
name: "sand",
|
|
18
|
-
bg: var(--color-brand-quaternary-
|
|
19
|
-
color: var(--color-neutral-
|
|
20
|
-
btn-bg-hover: var(--color-
|
|
18
|
+
bg: var(--color-brand-quaternary-30-rgb),
|
|
19
|
+
color: var(--color-neutral-0),
|
|
20
|
+
btn-bg-hover: var(--color-support-primary-20),
|
|
21
21
|
),
|
|
22
22
|
(
|
|
23
23
|
name: "yellow",
|
|
24
|
-
bg: var(--color-
|
|
25
|
-
color: var(--color-neutral-
|
|
26
|
-
btn-bg-hover: var(--color-
|
|
24
|
+
bg: var(--color-warning-30-rgb),
|
|
25
|
+
color: var(--color-neutral-0),
|
|
26
|
+
btn-bg-hover: var(--color-warning-20),
|
|
27
|
+
),
|
|
27
28
|
(
|
|
28
29
|
name: "green",
|
|
29
|
-
bg: var(--color-
|
|
30
|
-
color: var(--color-neutral-
|
|
31
|
-
btn-bg-hover: var(--color-
|
|
30
|
+
bg: var(--color-success-30-rgb),
|
|
31
|
+
color: var(--color-neutral-0),
|
|
32
|
+
btn-bg-hover: var(--color-success-20),
|
|
32
33
|
),
|
|
33
34
|
(
|
|
34
35
|
name: "red",
|
|
35
|
-
bg: var(--color-
|
|
36
|
-
color: var(--color-neutral-
|
|
37
|
-
btn-bg-hover: var(--color-
|
|
36
|
+
bg: var(--color-error-30-rgb),
|
|
37
|
+
color: var(--color-neutral-0),
|
|
38
|
+
btn-bg-hover: var(--color-error-20),
|
|
38
39
|
),
|
|
39
40
|
(
|
|
40
41
|
name: "blue",
|
|
41
|
-
bg: var(--color-support-secondary-
|
|
42
|
-
color: var(--color-neutral-
|
|
43
|
-
btn-bg-hover: var(--color-
|
|
42
|
+
bg: var(--color-support-secondary-30-rgb),
|
|
43
|
+
color: var(--color-neutral-0),
|
|
44
|
+
btn-bg-hover: var(--color-accent-20),
|
|
44
45
|
);
|
|
45
46
|
|
|
46
47
|
.tag {
|
|
48
|
+
--tag-background: transparent;
|
|
49
|
+
--tag-color: var(--color-neutral-0);
|
|
50
|
+
--tag-button-background: transparent;
|
|
51
|
+
background-color: rgb(var(--tag-background));
|
|
47
52
|
border-radius: math.div($tag-height , 2);
|
|
48
53
|
height: $tag-height;
|
|
49
54
|
max-height: $tag-height;
|
|
50
55
|
min-width: $tag-width-min;
|
|
51
56
|
max-width: $tag-width-max;
|
|
52
57
|
font-size: $font-small;
|
|
58
|
+
color: var(--tag-color);
|
|
53
59
|
|
|
54
60
|
@each $kind in $kinds {
|
|
55
61
|
&.#{map-get($kind, "name")} {
|
|
56
|
-
background
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
color: map-get($kind, "color");
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
button:hover {
|
|
63
|
-
background-color: map-get($kind, "btn-bg-hover");
|
|
64
|
-
color: map-get($kind, "bg");
|
|
65
|
-
}
|
|
62
|
+
--tag-button-background: #{map-get($kind, "btn-bg-hover")};
|
|
63
|
+
--tag-background: #{map-get($kind, "bg")};
|
|
64
|
+
--tag-color: #{map-get($kind, "color")};
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
|
|
68
|
+
&.outline{
|
|
69
|
+
--tag-color: var(--color-neutral-100);
|
|
70
|
+
border: 1px solid rgb(var(--tag-background));
|
|
71
|
+
background-color: rgb(var(--tag-background), .24);
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
69
75
|
button {
|
|
76
|
+
color: var(--tag-color);
|
|
70
77
|
width: $btn-size;
|
|
71
78
|
height: $btn-size;
|
|
72
79
|
background-color: transparent;
|
|
@@ -76,12 +83,24 @@ $kinds: (
|
|
|
76
83
|
padding: 0;
|
|
77
84
|
margin: 0;
|
|
78
85
|
cursor: pointer;
|
|
86
|
+
&:hover{
|
|
87
|
+
background-color: var(--tag-button-background);
|
|
88
|
+
}
|
|
79
89
|
}
|
|
80
90
|
}
|
|
81
91
|
|
|
92
|
+
.tag.tiny {
|
|
93
|
+
height: 16px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.tag.tiny .label {
|
|
97
|
+
padding: 0;
|
|
98
|
+
padding: 0 $space-xs;
|
|
99
|
+
}
|
|
100
|
+
|
|
82
101
|
.disabled {
|
|
83
|
-
background-color: var(--color-neutral-
|
|
84
|
-
color: var(--color-neutral-
|
|
102
|
+
background-color: var(--color-neutral-40);
|
|
103
|
+
color: var(--color-neutral-70);
|
|
85
104
|
}
|
|
86
105
|
|
|
87
106
|
.label {
|
|
@@ -2,29 +2,41 @@ import React from 'react';
|
|
|
2
2
|
import { BoxProps, SilkeBox } from '../silke-box';
|
|
3
3
|
import { SilkeText } from '../silke-text';
|
|
4
4
|
import styles from './silke-tag.scss';
|
|
5
|
-
import { SilkeIcon } from '../silke-icon';
|
|
5
|
+
import { SilkeIcon, SilkeIcons } from '../silke-icon';
|
|
6
6
|
|
|
7
7
|
export type SilkeTagKind = 'sand' | 'yellow' | 'green' | 'red' | 'gray' | 'blue';
|
|
8
|
+
export type SilkeTagSize = 'tiny';
|
|
8
9
|
|
|
9
|
-
type SilkeTagProps = {
|
|
10
|
+
export type SilkeTagProps = {
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
label: React.ReactNode;
|
|
12
13
|
kind?: SilkeTagKind;
|
|
14
|
+
size?: SilkeTagSize;
|
|
15
|
+
outline?: boolean;
|
|
16
|
+
icon?: SilkeIcons;
|
|
13
17
|
/**
|
|
14
18
|
* Will add a remove button to tag
|
|
15
19
|
*/
|
|
16
20
|
onRemove?: (e: React.MouseEvent) => void;
|
|
17
21
|
} & BoxProps;
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
function SilkeTagComp(
|
|
24
|
+
{ className, disabled, kind, label, outline, onRemove, size, icon, ...rest }: SilkeTagProps,
|
|
25
|
+
ref: any,
|
|
26
|
+
) {
|
|
20
27
|
const cl = [styles.tag, disabled ? styles.disabled : styles[kind || 'gray']];
|
|
21
28
|
if (className) cl.push(className);
|
|
29
|
+
if (outline) cl.push(styles.outline);
|
|
30
|
+
if (size) cl.push(styles[size]);
|
|
31
|
+
|
|
22
32
|
return (
|
|
23
|
-
<SilkeBox {...rest} className={cl.join(' ')} hPad="xs" vAlign="center">
|
|
33
|
+
<SilkeBox {...rest} className={cl.join(' ')} hPad="xs" vAlign="center" ref={ref}>
|
|
24
34
|
<SilkeText overflow flex className={styles.label}>
|
|
25
|
-
|
|
35
|
+
<SilkeBox gap="xs" align="center">
|
|
36
|
+
{icon && <SilkeIcon icon={icon} />}
|
|
37
|
+
<span>{label}</span>
|
|
38
|
+
</SilkeBox>
|
|
26
39
|
</SilkeText>
|
|
27
|
-
|
|
28
40
|
{!disabled && onRemove && (
|
|
29
41
|
<SilkeBox tag="button" vAlign="center" hAlign="center" onClick={onRemove}>
|
|
30
42
|
<SilkeIcon icon="close" />
|
|
@@ -34,6 +46,9 @@ export function SilkeTag({ className, disabled, kind, label, onRemove, ...rest }
|
|
|
34
46
|
);
|
|
35
47
|
}
|
|
36
48
|
|
|
49
|
+
export const SilkeTag = React.forwardRef(SilkeTagComp);
|
|
50
|
+
SilkeBox.displayName = 'SilkeTag';
|
|
51
|
+
|
|
37
52
|
export const SilkeTagSand = ({ kind, ...rest }: SilkeTagProps) => {
|
|
38
53
|
return <SilkeTag {...rest} kind="sand" />;
|
|
39
54
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
import { SilkeColor } from '../../silke-theme-provider';
|
|
2
3
|
|
|
3
4
|
type SilkeTextType = 'small' | 'p' | 'span' | 'strong' | 'div' | 'label';
|
|
4
5
|
|
|
@@ -17,7 +18,7 @@ export type SilkeTitleType =
|
|
|
17
18
|
export type SilkeTitleKind = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
18
19
|
|
|
19
20
|
interface SilkeTextSharedProps extends HTMLAttributes<HTMLElement> {
|
|
20
|
-
color?:
|
|
21
|
+
color?: SilkeColor;
|
|
21
22
|
weight?: 'strong' | 'light';
|
|
22
23
|
children: React.ReactNode;
|
|
23
24
|
/** flex text block */
|