@vev/silke 1.0.28 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/index.js +49 -48
- package/dist/silke/src/components/index.d.ts +1 -1
- package/dist/silke/src/components/silke-autocomplete-field/autocomplete-item.d.ts +2 -1
- package/dist/silke/src/components/silke-autocomplete-field/autocomplete-tags.d.ts +2 -1
- package/dist/silke/src/components/silke-autocomplete-field/silke-autocomplete-field.d.ts +3 -1
- package/dist/silke/src/components/silke-autocomplete-field/silke-autocomplete-popup.d.ts +1 -0
- package/dist/silke/src/components/silke-box/silke-box.d.ts +3 -2
- package/dist/silke/src/components/silke-breadcrumbs/silke-breadcrumb.d.ts +1 -1
- package/dist/silke/src/components/silke-button/silke-big-button.d.ts +4 -1
- package/dist/silke/src/components/silke-button/silke-button.d.ts +1 -1
- package/dist/silke/src/components/silke-button/silke-dropdown-button.d.ts +2 -1
- package/dist/silke/src/components/silke-color-picker/color.d.ts +5 -0
- package/dist/silke/src/components/silke-color-picker/silke-color-info.d.ts +3 -1
- package/dist/silke/src/components/silke-color-swatches/silke-swatches.d.ts +2 -1
- package/dist/silke/src/components/silke-conditions-input/index.d.ts +2 -0
- package/dist/silke/src/components/silke-conditions-input/silke-conditions-input-options.d.ts +8 -0
- package/dist/silke/src/components/silke-conditions-input/silke-conditions-input.d.ts +19 -0
- package/dist/silke/src/components/silke-conditions-input/silke-conditions-tag.d.ts +11 -0
- package/dist/silke/src/components/silke-conditions-input/types.d.ts +13 -0
- package/dist/silke/src/components/silke-conditions-input/utils.d.ts +11 -0
- package/dist/silke/src/components/silke-context-menu/silke-context-menu-item.d.ts +1 -1
- package/dist/silke/src/components/silke-css-number-field/silke-css-context.d.ts +5 -1
- package/dist/silke/src/components/silke-css-number-field/silke-css-number-field.d.ts +3 -1
- package/dist/silke/src/components/silke-form/form-types.d.ts +3 -3
- package/dist/silke/src/components/silke-form-schema/fields/array-field-inline.d.ts +2 -1
- package/dist/silke/src/components/silke-form-schema/fields/array-field-modal.d.ts +3 -2
- package/dist/silke/src/components/silke-form-schema/fields/array-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/event-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/icon-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/image-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/layout-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/object-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/string-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/toggle-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/utils/generate-image.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/utils/generate-title.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/fields/video-field.d.ts +1 -1
- package/dist/silke/src/components/silke-form-schema/silke-form-schema.d.ts +5 -0
- package/dist/silke/src/components/silke-form-schema/silke-schema-field.d.ts +3 -1
- package/dist/silke/src/components/silke-form-schema/silke-schema-fields.d.ts +2 -0
- package/dist/silke/src/components/silke-modal/silke-modal.d.ts +2 -1
- package/dist/silke/src/components/silke-notification/silke-notification.d.ts +1 -1
- package/dist/silke/src/components/silke-radio-button/silke-radio-button-group.d.ts +1 -1
- package/dist/silke/src/components/silke-slider/silke-slider.d.ts +1 -0
- package/dist/silke/src/components/silke-sortable-list/silke-nested-sortable-utils.d.ts +1 -0
- package/dist/silke/src/components/silke-sortable-list/silke-sortable-item-wrapper.d.ts +2 -1
- package/dist/silke/src/components/silke-sortable-list/silke-sortable-list.d.ts +2 -1
- package/dist/silke/src/components/silke-table/silke-table.d.ts +2 -1
- package/dist/silke/src/components/silke-table/table-row.d.ts +3 -1
- package/dist/silke/src/components/silke-table/table-types.d.ts +1 -1
- package/dist/silke/src/components/silke-tag/silke-tag.d.ts +1 -1
- package/dist/silke/src/components/silke-text-field/silke-text-field-outline.d.ts +3 -1
- package/dist/silke/src/components/silke-text-field/text-field-context.d.ts +4 -1
- package/dist/silke/src/components/silke-tile/index.d.ts +0 -1
- package/dist/silke/src/components/silke-tooltip/silke-definition-tooltip.d.ts +2 -1
- package/dist/silke/src/components/silke-tooltip/silke-icon-tooltip.d.ts +2 -1
- package/dist/silke/src/components/silke-tooltip/silke-tooltip.d.ts +6 -1
- package/dist/silke/src/components/silke-variables-wrapper/silke-variables-wrapper-form.d.ts +4 -3
- package/dist/silke/src/components/silke-variables-wrapper/silke-variables-wrapper.d.ts +5 -1
- package/dist/silke/src/icons.d.ts +74 -2
- package/dist/silke/src/silke-theme-provider.d.ts +1 -1
- package/dist/styles.css +1419 -1157
- package/dist/utils/src/types/context.d.ts +1 -0
- package/dist/utils/src/types/index.d.ts +1 -0
- package/dist/utils/src/types/manifest.d.ts +2 -0
- package/dist/utils/src/types/qwiker.d.ts +46 -0
- package/dist/utils/src/types/vev-plugin.d.ts +12 -0
- package/dist/utils/src/types/vev-props.d.ts +23 -2
- package/dist/utils/src/types/widget-manifest.d.ts +1 -0
- package/dist/utils/src/utils/index.d.ts +1 -0
- package/dist/utils/src/utils/variable.d.ts +3 -0
- package/package.json +15 -8
- package/project.json +21 -0
- package/public/index.html +2 -2
- package/src/_variables.scss +19 -5
- package/src/components/index.ts +1 -1
- package/src/components/silke-autocomplete-field/autocomplete-item.tsx +18 -12
- package/src/components/silke-autocomplete-field/autocomplete-tags.tsx +3 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.mdx +15 -15
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +33 -25
- package/src/components/silke-autocomplete-field/silke-autocomplete-popup.tsx +40 -20
- package/src/components/silke-box/silke-box.mdx +13 -9
- package/src/components/silke-box/silke-box.scss +12 -3
- package/src/components/silke-box/silke-box.tsx +18 -2
- package/src/components/silke-breadcrumbs/silke-breadcrumb.tsx +2 -2
- package/src/components/silke-button/silke-big-button.scss +0 -5
- package/src/components/silke-button/silke-big-button.tsx +15 -4
- package/src/components/silke-button/silke-button.mdx +34 -17
- package/src/components/silke-button/silke-button.scss +28 -31
- package/src/components/silke-button/silke-button.tsx +2 -2
- package/src/components/silke-button/silke-dropdown-button.tsx +7 -3
- package/src/components/silke-button/silke-file-select-button.tsx +1 -0
- package/src/components/silke-card/silke-card-grid.tsx +1 -1
- package/src/components/silke-card/silke-card.mdx +16 -26
- package/src/components/silke-card/silke-card.scss +10 -3
- package/src/components/silke-card/silke-card.tsx +7 -4
- package/src/components/silke-checkbox/silke-checkbox.mdx +2 -11
- package/src/components/silke-code-snippet/silke-code-snippet.mdx +27 -22
- package/src/components/silke-color-palettes/silke-color-palette.mdx +2 -2
- package/src/components/silke-color-picker/color.ts +12 -0
- package/src/components/silke-color-picker/silke-color-info.tsx +27 -8
- package/src/components/silke-color-picker/silke-color-picker-button.tsx +1 -1
- package/src/components/silke-color-picker/silke-color-picker.mdx +9 -13
- package/src/components/silke-color-picker/silke-color-picker.tsx +23 -6
- package/src/components/silke-color-swatches/silke-color-swatch-button.tsx +1 -1
- package/src/components/silke-color-swatches/silke-swatches.tsx +10 -7
- package/src/components/silke-conditions-input/index.ts +2 -0
- package/src/components/silke-conditions-input/silke-conditions-input-options.tsx +87 -0
- package/src/components/silke-conditions-input/silke-conditions-input.mdx +88 -0
- package/src/components/silke-conditions-input/silke-conditions-input.scss +29 -0
- package/src/components/silke-conditions-input/silke-conditions-input.tsx +290 -0
- package/src/components/silke-conditions-input/silke-conditions-tag.tsx +80 -0
- package/src/components/silke-conditions-input/types.ts +23 -0
- package/src/components/silke-conditions-input/utils.ts +181 -0
- package/src/components/silke-content-column/silke-content-column.scss +1 -1
- package/src/components/silke-context-menu/silke-context-menu-item.tsx +3 -0
- package/src/components/silke-context-menu/silke-context-menu.mdx +4 -4
- package/src/components/silke-context-menu/silke-context-menu.scss +9 -7
- package/src/components/silke-context-menu/silke-context-menu.tsx +1 -1
- package/src/components/silke-css-number-field/silke-css-context.tsx +6 -1
- package/src/components/silke-css-number-field/silke-css-number-field.mdx +221 -91
- package/src/components/silke-css-number-field/silke-css-number-field.scss +10 -3
- package/src/components/silke-css-number-field/silke-css-number-field.tsx +52 -8
- package/src/components/silke-css-number-field/utils.ts +2 -1
- package/src/components/silke-divider/silke-divider.mdx +1 -2
- package/src/components/silke-drawer/silke-drawer.mdx +4 -11
- package/src/components/silke-form/form-types.ts +5 -3
- package/src/components/silke-form/silke-form.mdx +4 -16
- package/src/components/silke-form-schema/fields/array-field-inline.tsx +12 -2
- package/src/components/silke-form-schema/fields/array-field-modal.tsx +10 -6
- package/src/components/silke-form-schema/fields/array-field.tsx +25 -6
- package/src/components/silke-form-schema/fields/event-field.tsx +18 -7
- package/src/components/silke-form-schema/fields/icon-field.tsx +21 -3
- package/src/components/silke-form-schema/fields/image-field.tsx +21 -3
- package/src/components/silke-form-schema/fields/layout-field.tsx +8 -1
- package/src/components/silke-form-schema/fields/link-field.tsx +5 -1
- package/src/components/silke-form-schema/fields/number-field.tsx +144 -13
- package/src/components/silke-form-schema/fields/object-field.tsx +10 -1
- package/src/components/silke-form-schema/fields/select-field.tsx +15 -1
- package/src/components/silke-form-schema/fields/string-field.tsx +115 -20
- package/src/components/silke-form-schema/fields/toggle-field.tsx +14 -2
- package/src/components/silke-form-schema/fields/upload-field.tsx +3 -1
- package/src/components/silke-form-schema/fields/utils/generate-image.ts +4 -1
- package/src/components/silke-form-schema/fields/utils/generate-title.ts +2 -1
- package/src/components/silke-form-schema/fields/video-field.tsx +22 -4
- package/src/components/silke-form-schema/silke-form-schema.mdx +227 -160
- package/src/components/silke-form-schema/silke-form-schema.tsx +5 -0
- package/src/components/silke-form-schema/silke-schema-field.tsx +23 -6
- package/src/components/silke-form-schema/silke-schema-fields.tsx +3 -1
- package/src/components/silke-gradient-picker/silke-gradient-picker.mdx +1 -1
- package/src/components/silke-icon/silke-icon.mdx +3 -6
- package/src/components/silke-icon/silke-icon.scss +2 -0
- package/src/components/silke-icon-picker/silke-icon-picker.tsx +5 -5
- package/src/components/silke-iframe-portal/silke-iframe-portal.mdx +6 -15
- package/src/components/silke-image/silke-image.mdx +28 -0
- package/src/components/silke-image/silke-image.scss +1 -0
- package/src/components/silke-link/silke-link.mdx +62 -39
- package/src/components/silke-link/silke-link.scss +3 -2
- package/src/components/silke-list/silke-list.mdx +12 -10
- package/src/components/silke-list-card/silke-list-card.mdx +7 -11
- package/src/components/silke-loader/silke-loader.mdx +1 -1
- package/src/components/silke-loader/silke-loader.tsx +1 -4
- package/src/components/silke-modal/silke-modal.mdx +1 -5
- package/src/components/silke-modal/silke-modal.scss +0 -2
- package/src/components/silke-modal/silke-modal.tsx +3 -1
- package/src/components/silke-navigation-link/silke-navigation-link.mdx +21 -22
- package/src/components/silke-navigation-link/silke-navigation-link.scss +2 -2
- package/src/components/silke-notification/silke-notification.mdx +35 -67
- package/src/components/silke-notification/silke-notification.tsx +2 -1
- package/src/components/silke-object-field/silke-object-field.mdx +3 -10
- package/src/components/silke-object-field/silke-object-field.tsx +2 -2
- package/src/components/silke-overflow-menu/silke-overflow-menu.mdx +2 -2
- package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +2 -1
- package/src/components/silke-popover/silke-popover.mdx +14 -22
- package/src/components/silke-popover/silke-popover.tsx +21 -15
- package/src/components/silke-progress-indicator/silke-progress-indicator.mdx +33 -36
- package/src/components/silke-radio-button/silke-radio-button-group.tsx +1 -1
- package/src/components/silke-radio-button/silke-radio-button.mdx +1 -7
- package/src/components/silke-radio-button/silke-radio-button.scss +1 -0
- package/src/components/silke-search-field/silke-search-field.mdx +4 -12
- package/src/components/silke-select-field/silke-select-field.mdx +10 -10
- package/src/components/silke-slider/silke-slider.mdx +59 -22
- package/src/components/silke-slider/silke-slider.tsx +23 -10
- package/src/components/silke-sortable-list/silke-nested-sortable-item.tsx +3 -3
- package/src/components/silke-sortable-list/silke-nested-sortable-utils.ts +1 -0
- package/src/components/silke-sortable-list/silke-sortable-item-wrapper.tsx +4 -1
- package/src/components/silke-sortable-list/silke-sortable-list.mdx +54 -58
- package/src/components/silke-sortable-list/silke-sortable-list.scss +2 -2
- package/src/components/silke-sortable-list/silke-sortable-list.tsx +3 -0
- package/src/components/silke-table/silke-table.mdx +75 -75
- package/src/components/silke-table/silke-table.scss +27 -13
- package/src/components/silke-table/silke-table.tsx +13 -3
- package/src/components/silke-table/table-row.tsx +6 -1
- package/src/components/silke-table/table-types.ts +1 -1
- package/src/components/silke-tabs/silke-tabs.mdx +2 -2
- package/src/components/silke-tag/silke-tag.mdx +38 -79
- package/src/components/silke-tag/silke-tag.scss +12 -5
- package/src/components/silke-tag/silke-tag.tsx +1 -0
- package/src/components/silke-text/silke-text.mdx +50 -48
- package/src/components/silke-text/silke-text.scss +4 -2
- package/src/components/silke-text/silke-title.scss +29 -15
- package/src/components/silke-text-field/silke-text-field-outline.tsx +9 -1
- package/src/components/silke-text-field/silke-text-field.mdx +67 -71
- package/src/components/silke-text-field/silke-text-field.scss +4 -3
- package/src/components/silke-text-field/silke-text-field.tsx +16 -16
- package/src/components/silke-text-field/text-field-context.tsx +7 -2
- package/src/components/silke-tile/index.ts +0 -1
- package/src/components/silke-tile/silke-tile.mdx +6 -63
- package/src/components/silke-tile/silke-tile.tsx +4 -4
- package/src/components/silke-toggle/silke-toggle.mdx +5 -29
- package/src/components/silke-toggle/silke-toggle.scss +3 -2
- package/src/components/silke-toolbar/silke-toolbar.mdx +6 -6
- package/src/components/silke-tooltip/silke-definition-tooltip.tsx +3 -0
- package/src/components/silke-tooltip/silke-icon-tooltip.tsx +5 -2
- package/src/components/silke-tooltip/silke-tooltip.mdx +16 -34
- package/src/components/silke-tooltip/silke-tooltip.scss +3 -2
- package/src/components/silke-tooltip/silke-tooltip.tsx +15 -4
- package/src/components/silke-upload-field/silke-upload-field.tsx +1 -0
- package/src/components/silke-variables-wrapper/silke-variables-wrapper-form.tsx +30 -50
- package/src/components/silke-variables-wrapper/silke-variables-wrapper.mdx +56 -15
- package/src/components/silke-variables-wrapper/silke-variables-wrapper.scss +0 -2
- package/src/components/silke-variables-wrapper/silke-variables-wrapper.tsx +107 -44
- package/src/docs/data/flux/store.ts +0 -1
- package/src/hooks/drag-and-drop/use-drop.tsx +1 -1
- package/src/hooks/hooks.mdx +3 -3
- package/src/icons.tsx +104 -4
- package/src/index.mdx +30 -31
- package/src/playground.mdx +58 -47
- package/src/silke-theme-provider.tsx +1 -0
- package/src/styles/core.scss +10 -14
- package/dist/silke/src/components/silke-steps/index.d.ts +0 -1
- package/dist/silke/src/components/silke-steps/silke-steps.d.ts +0 -12
- package/dist/silke/src/components/silke-tile/silke-tile-select.d.ts +0 -26
- package/src/components/silke-steps/index.ts +0 -1
- package/src/components/silke-steps/silke-steps.mdx +0 -60
- package/src/components/silke-steps/silke-steps.scss +0 -14
- package/src/components/silke-steps/silke-steps.tsx +0 -53
- package/src/components/silke-tile/silke-tile-select.tsx +0 -100
|
@@ -10,6 +10,7 @@ type SilkeSortableItemWrapperProps<T> = {
|
|
|
10
10
|
className?: string;
|
|
11
11
|
children: React.ReactElement;
|
|
12
12
|
onSort: (sortedItems: T[]) => void;
|
|
13
|
+
disabled?: boolean;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
type SortData<T> = {
|
|
@@ -26,11 +27,12 @@ export function SilkeSortableItemWrapper<T>({
|
|
|
26
27
|
children,
|
|
27
28
|
triggerState,
|
|
28
29
|
className,
|
|
30
|
+
disabled,
|
|
29
31
|
onSort,
|
|
30
32
|
}: SilkeSortableItemWrapperProps<T>) {
|
|
31
33
|
const ref = useRef<HTMLDivElement>(null);
|
|
32
34
|
const data: SortData<T> = { listId, index, items, onSort };
|
|
33
|
-
const dragState = useDrag({ data, ref });
|
|
35
|
+
const dragState = useDrag({ data, ref, disabled });
|
|
34
36
|
|
|
35
37
|
const handleSort = (from: SortData<T>) => {
|
|
36
38
|
const toList = items.slice();
|
|
@@ -56,6 +58,7 @@ export function SilkeSortableItemWrapper<T>({
|
|
|
56
58
|
canDrop: (item) => item.listId === listId,
|
|
57
59
|
onOver: (from) => triggerState === 'over' && handleSort(from),
|
|
58
60
|
onDrop: (from) => triggerState === 'drop' && handleSort(from),
|
|
61
|
+
disabled,
|
|
59
62
|
});
|
|
60
63
|
|
|
61
64
|
let cl = styles.item;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
```js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
() => {
|
|
3
|
+
const [list, setList] = React.useState(['Item 1', 'Item 2', 'Item 3']);
|
|
4
|
+
|
|
5
|
+
return (
|
|
6
|
+
<SilkeSortableList items={list} onSort={setList}>
|
|
7
|
+
{(item) => item}
|
|
8
|
+
</SilkeSortableList>
|
|
9
|
+
);
|
|
10
|
+
};
|
|
6
11
|
```
|
|
7
12
|
|
|
8
13
|
### Only sort on over and custom drag handle
|
|
@@ -10,14 +15,19 @@ const [list, setList] = React.useState(['Item 1', 'Item 2', 'Item 3'])
|
|
|
10
15
|
To set custom drag handle, just add **data-drag-handle** to the item which should be the drag handle
|
|
11
16
|
|
|
12
17
|
```js
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
() => {
|
|
19
|
+
const [list, setList] = React.useState(['Item 1', 'Item 2', 'Item 3']);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<SilkeSortableList items={list} triggerState="over" onSort={setList}>
|
|
23
|
+
{(item) => (
|
|
24
|
+
<SilkeBox gap="s" vAlign="center" height="base">
|
|
25
|
+
<SilkeIcon icon="drag" data-drag-handle /> {item}
|
|
26
|
+
</SilkeBox>
|
|
27
|
+
)}
|
|
28
|
+
</SilkeSortableList>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
21
31
|
```
|
|
22
32
|
|
|
23
33
|
### Sort between lists
|
|
@@ -25,32 +35,18 @@ const [list, setList] = React.useState(['Item 1', 'Item 2', 'Item 3'])
|
|
|
25
35
|
To sort between lists just give the list the same id
|
|
26
36
|
|
|
27
37
|
```js
|
|
28
|
-
const [list1, setList1] = React.useState([
|
|
29
|
-
const [list2, setList2] = React.useState([
|
|
38
|
+
const [list1, setList1] = React.useState(['Item 1', 'Item 2', 'Item 3']);
|
|
39
|
+
const [list2, setList2] = React.useState(['Item 4', 'Item 5', 'Item 6']);
|
|
30
40
|
const Item = (item) => (
|
|
31
41
|
<SilkeBox gap="s" vAlign="center" height="base">
|
|
32
42
|
<SilkeIcon icon="drag" data-drag-handle /> {item}
|
|
33
43
|
</SilkeBox>
|
|
34
44
|
);
|
|
35
45
|
<SilkeBox gap="xl">
|
|
36
|
-
<SilkeSortableList
|
|
37
|
-
listId="between"
|
|
38
|
-
items={list1}
|
|
39
|
-
flex
|
|
40
|
-
pad="m"
|
|
41
|
-
bg="neutral-20"
|
|
42
|
-
onSort={setList1}
|
|
43
|
-
>
|
|
46
|
+
<SilkeSortableList listId="between" items={list1} flex pad="m" bg="neutral-20" onSort={setList1}>
|
|
44
47
|
{Item}
|
|
45
48
|
</SilkeSortableList>
|
|
46
|
-
<SilkeSortableList
|
|
47
|
-
listId="between"
|
|
48
|
-
items={list2}
|
|
49
|
-
flex
|
|
50
|
-
pad="m"
|
|
51
|
-
bg="neutral-20"
|
|
52
|
-
onSort={setList2}
|
|
53
|
-
>
|
|
49
|
+
<SilkeSortableList listId="between" items={list2} flex pad="m" bg="neutral-20" onSort={setList2}>
|
|
54
50
|
{Item}
|
|
55
51
|
</SilkeSortableList>
|
|
56
52
|
</SilkeBox>;
|
|
@@ -61,49 +57,49 @@ const Item = (item) => (
|
|
|
61
57
|
To sort between lists just give the list the same id
|
|
62
58
|
|
|
63
59
|
```js
|
|
64
|
-
const [selected, setSelected] = React.useState([
|
|
65
|
-
const [collapsed, setCollapsed] = React.useState([
|
|
60
|
+
const [selected, setSelected] = React.useState(['item1']);
|
|
61
|
+
const [collapsed, setCollapsed] = React.useState(['item2']);
|
|
66
62
|
const [list, setList] = React.useState([
|
|
67
63
|
{
|
|
68
|
-
key:
|
|
69
|
-
value:
|
|
64
|
+
key: 'header',
|
|
65
|
+
value: 'Header item',
|
|
70
66
|
disabled: true,
|
|
71
67
|
render: (item) => (
|
|
72
68
|
<SilkeBox vAlign="center" height="base">
|
|
73
69
|
{item.value}
|
|
74
70
|
</SilkeBox>
|
|
75
71
|
),
|
|
76
|
-
children: [
|
|
72
|
+
children: ['item1-1', 'item1-2', 'item1-3', 'item1-4'],
|
|
77
73
|
},
|
|
78
74
|
{
|
|
79
|
-
key:
|
|
80
|
-
value:
|
|
81
|
-
children: [
|
|
75
|
+
key: 'item1-1',
|
|
76
|
+
value: 'Item 1.1',
|
|
77
|
+
children: ['item1-1-1', 'item1-1-2'],
|
|
82
78
|
},
|
|
83
|
-
{ key:
|
|
84
|
-
{ key:
|
|
85
|
-
{ key:
|
|
86
|
-
{ key:
|
|
87
|
-
{ key:
|
|
79
|
+
{ key: 'item1-2', value: 'Item 1.2' },
|
|
80
|
+
{ key: 'item1-3', value: 'Item 1.3' },
|
|
81
|
+
{ key: 'item1-4', value: 'Item 1.4' },
|
|
82
|
+
{ key: 'item1-1-1', value: 'Item 1.1.1' },
|
|
83
|
+
{ key: 'item1-1-2', value: 'Item 1.1.2' },
|
|
88
84
|
{
|
|
89
|
-
key:
|
|
90
|
-
value:
|
|
91
|
-
children: [
|
|
85
|
+
key: 'item2',
|
|
86
|
+
value: 'Item 2',
|
|
87
|
+
children: ['item2-1', 'item2-2'],
|
|
92
88
|
style: {
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
'--item-selection-color': 'var(--color-warning-40)',
|
|
90
|
+
'--item-hover-color': 'var(--color-warning-20)',
|
|
95
91
|
},
|
|
96
92
|
},
|
|
97
93
|
{
|
|
98
|
-
key:
|
|
99
|
-
value:
|
|
100
|
-
children: [
|
|
94
|
+
key: 'item2-1',
|
|
95
|
+
value: 'Item 2.1',
|
|
96
|
+
children: ['item2-2-1', 'item2-2-2', 'item2-2-3', 'item2-2-4'],
|
|
101
97
|
},
|
|
102
|
-
{ key:
|
|
103
|
-
{ key:
|
|
104
|
-
{ key:
|
|
105
|
-
{ key:
|
|
106
|
-
{ key:
|
|
98
|
+
{ key: 'item2-2', value: 'Item 2.2', children: [] },
|
|
99
|
+
{ key: 'item2-2-1', value: 'Item 2.2.1' },
|
|
100
|
+
{ key: 'item2-2-2', value: 'Item 2.2.2' },
|
|
101
|
+
{ key: 'item2-2-3', value: 'Item 2,2.3' },
|
|
102
|
+
{ key: 'item2-2-4', value: 'Item 2.2.4' },
|
|
107
103
|
]);
|
|
108
104
|
const Item = (item) => (
|
|
109
105
|
<SilkeBox gap="s" vAlign="center" height="base">
|
|
@@ -128,10 +124,10 @@ const Item = (item) => (
|
|
|
128
124
|
if (e.shiftKey) setSelected([...selected, item.key]);
|
|
129
125
|
else setSelected([item.key]);
|
|
130
126
|
}}
|
|
131
|
-
canHaveChildren={(item) => item.children || item.key ===
|
|
127
|
+
canHaveChildren={(item) => item.children || item.key === 'item1-4'}
|
|
132
128
|
canSort={(parent, childIndex, parents, selected) => {
|
|
133
129
|
// Don't allow to place in the root(no parent) and not in item 2
|
|
134
|
-
return !!parent && !parents.includes(
|
|
130
|
+
return !!parent && !parents.includes('item2');
|
|
135
131
|
}}
|
|
136
132
|
onSort={setList}
|
|
137
133
|
>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
pointer-events: none;
|
|
21
21
|
width: 100%;
|
|
22
22
|
height: 2px;
|
|
23
|
-
background: var(--color-
|
|
23
|
+
background: var(--color-neutral-100);
|
|
24
24
|
position: absolute;
|
|
25
25
|
z-index: 100;
|
|
26
26
|
top: 0;
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
&.sortAsBox {
|
|
35
35
|
&.over::before {
|
|
36
36
|
height: 100%;
|
|
37
|
-
border:1px solid var(--color-
|
|
37
|
+
border:1px solid var(--color-neutral-100);
|
|
38
38
|
background:transparent;
|
|
39
39
|
border-radius: var(--border-radius-small);
|
|
40
40
|
}
|
|
@@ -15,6 +15,7 @@ type SilkeSortableListProps<T> = {
|
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
children: (item: T, index: number) => React.ReactElement;
|
|
17
17
|
onSort: (sortedItems: T[]) => void;
|
|
18
|
+
canSort?: (item: T) => boolean;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export function SilkeSortableList<T>({
|
|
@@ -24,6 +25,7 @@ export function SilkeSortableList<T>({
|
|
|
24
25
|
children,
|
|
25
26
|
showSortAsBox,
|
|
26
27
|
disabled,
|
|
28
|
+
canSort,
|
|
27
29
|
onSort,
|
|
28
30
|
}: SilkeSortableListProps<T>) {
|
|
29
31
|
const internalListId = useMemo(() => listId || generateGuid(), [listId]);
|
|
@@ -41,6 +43,7 @@ export function SilkeSortableList<T>({
|
|
|
41
43
|
items={items}
|
|
42
44
|
className={cl}
|
|
43
45
|
index={index}
|
|
46
|
+
disabled={(canSort && !canSort(item)) || false}
|
|
44
47
|
onSort={onSort}
|
|
45
48
|
>
|
|
46
49
|
{children(item, index)}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
```js
|
|
6
6
|
const items = ipsum.list(5, () => ({ name: ipsum.name(), desc: ipsum.text() }));
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
return <SilkeTable items={items} columns={['name', 'desc']} />;
|
|
8
9
|
```
|
|
9
10
|
|
|
10
11
|
## Fixed column width
|
|
@@ -15,31 +16,40 @@ const items = ipsum.list(5, () => ({
|
|
|
15
16
|
surname: ipsum.name(),
|
|
16
17
|
gender: ipsum.name(),
|
|
17
18
|
}));
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
items={items}
|
|
21
|
-
columns={["name", "surname", "gender"]}
|
|
22
|
-
/>;
|
|
19
|
+
|
|
20
|
+
return <SilkeTable fixedColumns items={items} columns={['name', 'surname', 'gender']} />;
|
|
23
21
|
```
|
|
24
22
|
|
|
25
23
|
## Advanced usage with column transform
|
|
26
24
|
|
|
27
25
|
```js
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
() => {
|
|
27
|
+
const items = ipsum.list(5, () => ({
|
|
28
|
+
name: ipsum.name(),
|
|
29
|
+
role: Math.round(Math.random()),
|
|
30
|
+
desc: ipsum.text(),
|
|
31
|
+
}));
|
|
32
|
+
const [_selected, setSelected] = React.useState();
|
|
33
|
+
|
|
34
|
+
const columns = [
|
|
35
|
+
{
|
|
36
|
+
label: 'Name',
|
|
37
|
+
attr: 'name',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'Role',
|
|
41
|
+
attr: 'role',
|
|
42
|
+
// Transforming the role column with transform function
|
|
43
|
+
transform: (value) => (value === 1 ? 'Admin' : 'Not admin'),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: 'Description',
|
|
47
|
+
attr: 'desc',
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
return <SilkeTable items={items} columns={columns} onSelect={(item) => setSelected(item)} />;
|
|
52
|
+
};
|
|
43
53
|
```
|
|
44
54
|
|
|
45
55
|
## Load more Table with overflow menu
|
|
@@ -55,13 +65,15 @@ const menu = ipsum.list(5, () => ({
|
|
|
55
65
|
onClick: (item) => console.log(item),
|
|
56
66
|
}));
|
|
57
67
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
return (
|
|
69
|
+
<SilkeTable
|
|
70
|
+
items={items}
|
|
71
|
+
fixedColumns
|
|
72
|
+
columns={['name', 'desc']}
|
|
73
|
+
menu={menu}
|
|
74
|
+
onLoadMore={() => sleep(2000).then(() => setCount(count + 5))}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
65
77
|
```
|
|
66
78
|
|
|
67
79
|
### Table with simple toolbar and search
|
|
@@ -69,23 +81,17 @@ const menu = ipsum.list(5, () => ({
|
|
|
69
81
|
The SilkeTable `search` prop can be used to fast filter the table, but remember it can only search table cells where the value is a string
|
|
70
82
|
|
|
71
83
|
```js
|
|
72
|
-
const [search, setSearch] = React.useState(
|
|
84
|
+
const [search, setSearch] = React.useState('');
|
|
73
85
|
const items = ipsum.list(5, () => ({ name: ipsum.name(), desc: ipsum.text() }));
|
|
74
86
|
const selectItems = ipsum.list((value) => ({ value, label: ipsum.name(1) }));
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
fixedColumns
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
flex
|
|
84
|
-
placeholder="Search for column values"
|
|
85
|
-
onChange={setSearch}
|
|
86
|
-
/>
|
|
87
|
-
<SilkeButton icon="add" label="Add to list" />
|
|
88
|
-
</SilkeTable>;
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<SilkeTable items={items} fixedColumns columns={['name', 'desc']} search={search}>
|
|
90
|
+
<SilkeSelectField label="Test" value={0} width={140} items={selectItems} />
|
|
91
|
+
<SilkeSearchField flex placeholder="Search for column values" onChange={setSearch} />
|
|
92
|
+
<SilkeButton icon="add" label="Add to list" />
|
|
93
|
+
</SilkeTable>
|
|
94
|
+
);
|
|
89
95
|
```
|
|
90
96
|
|
|
91
97
|
### Table with multiselect
|
|
@@ -93,42 +99,36 @@ const selectItems = ipsum.list((value) => ({ value, label: ipsum.name(1) }));
|
|
|
93
99
|
The SilkeTable `search` prop can be used to fast filter the table, but remember it can only search table cells where the value is a string
|
|
94
100
|
|
|
95
101
|
```js
|
|
96
|
-
const [search, setSearch] = React.useState(
|
|
102
|
+
const [search, setSearch] = React.useState('');
|
|
97
103
|
const [selected, setSelected] = React.useState([]);
|
|
98
104
|
const items = ipsum.list(5, () => ({
|
|
99
105
|
name: ipsum.name(),
|
|
100
106
|
desc: ipsum.name(4),
|
|
101
107
|
}));
|
|
108
|
+
|
|
102
109
|
const selectItems = ipsum.list((value) => ({ value, label: ipsum.name(1) }));
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
label="Test"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
placeholder="Search for column values"
|
|
128
|
-
onChange={setSearch}
|
|
129
|
-
/>
|
|
130
|
-
<SilkeButton icon="add" label="Add to list" />
|
|
131
|
-
</>
|
|
132
|
-
)}
|
|
133
|
-
</SilkeTable>;
|
|
110
|
+
return (
|
|
111
|
+
<SilkeTable
|
|
112
|
+
multiselect
|
|
113
|
+
items={items}
|
|
114
|
+
columns={['name', 'desc']}
|
|
115
|
+
search={search}
|
|
116
|
+
selected={selected}
|
|
117
|
+
onSelect={setSelected}
|
|
118
|
+
>
|
|
119
|
+
{selected.length ? (
|
|
120
|
+
<>
|
|
121
|
+
{selected.length} items selected
|
|
122
|
+
<Flex />
|
|
123
|
+
<SilkeButton label="Deselect" onClick={() => setSelected([])} />
|
|
124
|
+
</>
|
|
125
|
+
) : (
|
|
126
|
+
<>
|
|
127
|
+
<SilkeSelectField label="Test" value={0} width={140} items={selectItems} />
|
|
128
|
+
<SilkeSearchField flex placeholder="Search for column values" onChange={setSearch} />
|
|
129
|
+
<SilkeButton icon="add" label="Add to list" />
|
|
130
|
+
</>
|
|
131
|
+
)}
|
|
132
|
+
</SilkeTable>
|
|
133
|
+
);
|
|
134
134
|
```
|
|
@@ -1,32 +1,47 @@
|
|
|
1
|
-
@use
|
|
1
|
+
@use "../../variables" as *;
|
|
2
2
|
$row-height: $size-l;
|
|
3
3
|
|
|
4
|
+
.root {
|
|
5
|
+
background-color: var(--color-surface-0);
|
|
6
|
+
}
|
|
4
7
|
|
|
5
|
-
.toolbar{
|
|
6
|
-
border-radius: var(--border-radius-
|
|
7
|
-
border-bottom-left-radius: var(--border-radius-tiny);
|
|
8
|
-
border-bottom-right-radius: var(--border-radius-tiny);
|
|
8
|
+
.toolbar {
|
|
9
|
+
border-radius: var(--border-radius-small) var(--border-radius-small) 0 0;
|
|
9
10
|
}
|
|
10
|
-
.toolbar ~ .table{
|
|
11
|
-
border-top-left-radius:
|
|
12
|
-
border-top-right-radius:
|
|
11
|
+
.toolbar ~ .table {
|
|
12
|
+
border-top-left-radius: 0;
|
|
13
|
+
border-top-right-radius: 0;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
.table {
|
|
16
17
|
border-collapse: collapse;
|
|
17
18
|
width: 100%;
|
|
18
|
-
background-color: var(--color-
|
|
19
|
-
border-radius: var(--border-radius-
|
|
19
|
+
background-color: var(--color-surface-0);
|
|
20
|
+
border-radius: var(--border-radius-small);
|
|
20
21
|
overflow: hidden;
|
|
21
22
|
|
|
23
|
+
thead {
|
|
24
|
+
background-color: var(--color-surface-1);
|
|
25
|
+
tr {
|
|
26
|
+
height: $row-height;
|
|
27
|
+
|
|
28
|
+
th {
|
|
29
|
+
border-bottom: 1px solid var(--color-neutral-0);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
td {
|
|
23
35
|
height: $row-height;
|
|
24
36
|
text-overflow: ellipsis;
|
|
25
37
|
white-space: nowrap;
|
|
26
38
|
}
|
|
39
|
+
tbody {
|
|
40
|
+
background-color: var(--color-surface-1);
|
|
41
|
+
}
|
|
27
42
|
|
|
28
43
|
tbody tr:not(:last-child) td {
|
|
29
|
-
border-bottom: 1px solid var(--color-neutral-
|
|
44
|
+
border-bottom: 1px solid var(--color-neutral-0);
|
|
30
45
|
}
|
|
31
46
|
tbody td {
|
|
32
47
|
overflow: hidden;
|
|
@@ -70,11 +85,10 @@ $row-height: $size-l;
|
|
|
70
85
|
}
|
|
71
86
|
}
|
|
72
87
|
|
|
73
|
-
|
|
74
88
|
.selectable:hover {
|
|
75
89
|
cursor: pointer;
|
|
76
90
|
|
|
77
91
|
td {
|
|
78
|
-
background: var(--color-
|
|
92
|
+
background: var(--color-surface-2);
|
|
79
93
|
}
|
|
80
94
|
}
|
|
@@ -24,6 +24,7 @@ type BaseProps<T extends Record<string, any>> = {
|
|
|
24
24
|
loadMoreLabel?: string;
|
|
25
25
|
|
|
26
26
|
onLoadMore?: () => Promise<void>;
|
|
27
|
+
onRowHovered?: (index: number) => void;
|
|
27
28
|
} & Omit<HTMLAttributes<HTMLTableElement>, 'cellPadding' | 'cellSpacing' | 'onSelect'>;
|
|
28
29
|
|
|
29
30
|
type SingleSelect<T extends Record<string, any>> = BaseProps<T> & {
|
|
@@ -53,6 +54,7 @@ export function SilkeTable<T extends Record<string, any>>({
|
|
|
53
54
|
onSelect,
|
|
54
55
|
loadMoreLabel,
|
|
55
56
|
onLoadMore,
|
|
57
|
+
onRowHovered,
|
|
56
58
|
...rest
|
|
57
59
|
}: SilkeTableProps<T>) {
|
|
58
60
|
const [loading, setLoading] = useState<boolean>(false);
|
|
@@ -102,13 +104,19 @@ export function SilkeTable<T extends Record<string, any>>({
|
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
106
|
|
|
107
|
+
const handleRowHovered = (index: number) => {
|
|
108
|
+
if (onRowHovered) {
|
|
109
|
+
onRowHovered(index);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
105
113
|
let columnCount = columns.length;
|
|
106
114
|
if (multiselect) columnCount++;
|
|
107
115
|
if (menu) columnCount++;
|
|
108
116
|
|
|
109
117
|
return (
|
|
110
118
|
<ButtonContext size="m">
|
|
111
|
-
<SilkeBox column
|
|
119
|
+
<SilkeBox column className={styles.root}>
|
|
112
120
|
{children && (
|
|
113
121
|
<TextFieldContext size="m" kind="ghost" inline>
|
|
114
122
|
<SilkeBox
|
|
@@ -117,7 +125,7 @@ export function SilkeTable<T extends Record<string, any>>({
|
|
|
117
125
|
vAlign="center"
|
|
118
126
|
hPad="s"
|
|
119
127
|
vPad="s"
|
|
120
|
-
bg="neutral-
|
|
128
|
+
bg="neutral-10"
|
|
121
129
|
>
|
|
122
130
|
{children}
|
|
123
131
|
</SilkeBox>
|
|
@@ -160,10 +168,11 @@ export function SilkeTable<T extends Record<string, any>>({
|
|
|
160
168
|
)}
|
|
161
169
|
</thead>
|
|
162
170
|
|
|
163
|
-
<tbody>
|
|
171
|
+
<tbody onMouseLeave={() => handleRowHovered(-1)}>
|
|
164
172
|
{items.map((item, i) => (
|
|
165
173
|
<TableRow
|
|
166
174
|
key={i}
|
|
175
|
+
index={i}
|
|
167
176
|
item={item}
|
|
168
177
|
columns={columns}
|
|
169
178
|
menu={menu}
|
|
@@ -171,6 +180,7 @@ export function SilkeTable<T extends Record<string, any>>({
|
|
|
171
180
|
selected={selectedRows[i]}
|
|
172
181
|
search={searchReg}
|
|
173
182
|
onSelect={onSelect && handleSelect}
|
|
183
|
+
onHover={() => handleRowHovered(i)}
|
|
174
184
|
/>
|
|
175
185
|
))}
|
|
176
186
|
</tbody>
|
|
@@ -7,12 +7,14 @@ import { TableColumn, TableRowMenu } from './table-types';
|
|
|
7
7
|
|
|
8
8
|
type TableRowProps<T> = {
|
|
9
9
|
item: T;
|
|
10
|
+
index: number;
|
|
10
11
|
columns: TableColumn<T>[];
|
|
11
12
|
selected?: boolean;
|
|
12
13
|
multiselect?: boolean;
|
|
13
14
|
search?: RegExp;
|
|
14
15
|
menu?: TableRowMenu<T>[];
|
|
15
16
|
onSelect?: (value: T, select: boolean) => void;
|
|
17
|
+
onHover?: () => void;
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
function hasSearchMatch(search: RegExp, values: ReactNode[]): boolean {
|
|
@@ -26,18 +28,20 @@ const stopPropagation = (e: React.MouseEvent) => e.stopPropagation();
|
|
|
26
28
|
|
|
27
29
|
export function TableRow<T>({
|
|
28
30
|
item,
|
|
31
|
+
index,
|
|
29
32
|
columns,
|
|
30
33
|
search,
|
|
31
34
|
menu,
|
|
32
35
|
multiselect,
|
|
33
36
|
selected,
|
|
34
37
|
onSelect,
|
|
38
|
+
onHover,
|
|
35
39
|
}: TableRowProps<T>) {
|
|
36
40
|
// Mapping and transforming the item into column values
|
|
37
41
|
const values = useMemo(() => {
|
|
38
42
|
return columns.map((column) => {
|
|
39
43
|
const value = item[column.attr];
|
|
40
|
-
if (column.transform) return column.transform(value, item);
|
|
44
|
+
if (column.transform) return column.transform(value, item, index);
|
|
41
45
|
return value as unknown as React.ReactElement;
|
|
42
46
|
});
|
|
43
47
|
}, [item, columns]);
|
|
@@ -53,6 +57,7 @@ export function TableRow<T>({
|
|
|
53
57
|
<tr
|
|
54
58
|
className={!multiselect && onSelect ? styles.selectable : undefined}
|
|
55
59
|
onClick={!multiselect && onSelect ? () => onSelect(item, true) : undefined}
|
|
60
|
+
onMouseEnter={onHover}
|
|
56
61
|
>
|
|
57
62
|
{multiselect && (
|
|
58
63
|
<td className={styles.check}>
|
|
@@ -5,7 +5,7 @@ export type TableColumn<T, K extends keyof T = keyof T> = {
|
|
|
5
5
|
label?: string;
|
|
6
6
|
width?: number | string;
|
|
7
7
|
align?: 'left' | 'center' | 'right';
|
|
8
|
-
transform?: (value: T[K], model: T) => React.ReactNode;
|
|
8
|
+
transform?: (value: T[K], model: T, index: number) => React.ReactNode;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export type TableRowMenu<T> =
|
|
@@ -7,7 +7,7 @@ const [active, setActive] = React.useState(1);
|
|
|
7
7
|
{[1, 2, 3, 4].map((tab) => (
|
|
8
8
|
<SilkeTab
|
|
9
9
|
key={tab}
|
|
10
|
-
label={
|
|
10
|
+
label={'Tab ' + tab}
|
|
11
11
|
disabled={tab === 3}
|
|
12
12
|
active={tab === active}
|
|
13
13
|
onClick={() => setActive(tab)}
|
|
@@ -18,7 +18,7 @@ const [active, setActive] = React.useState(1);
|
|
|
18
18
|
{[1, 2, 3, 4].map((tab) => (
|
|
19
19
|
<SilkeTab
|
|
20
20
|
key={tab}
|
|
21
|
-
label={
|
|
21
|
+
label={'Tab ' + tab}
|
|
22
22
|
disabled={tab === 3}
|
|
23
23
|
active={tab === active}
|
|
24
24
|
onClick={() => setActive(tab)}
|