@vev/silke 1.0.27 → 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 +14 -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/number-field.d.ts +1 -0
- 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 +9 -1
- 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 +4 -2
- 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 +76 -2
- package/dist/silke/src/silke-theme-provider.d.ts +1 -1
- package/dist/styles.css +1411 -1149
- 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 +169 -22
- 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 +10 -1
- 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 +15 -3
- 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 +106 -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
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
## Types
|
|
6
6
|
|
|
7
7
|
```js
|
|
8
|
-
const title =
|
|
9
|
-
const subtitle =
|
|
8
|
+
const title = 'Warning';
|
|
9
|
+
const subtitle = 'Some subitle text here';
|
|
10
10
|
|
|
11
|
-
const types = [
|
|
11
|
+
const types = ['information', 'success', 'warning', 'error'];
|
|
12
12
|
|
|
13
13
|
<SilkeBox gap>
|
|
14
14
|
<SilkeBox column gap>
|
|
@@ -41,12 +41,10 @@ const types = ["information", "success", "warning", "error"];
|
|
|
41
41
|
|
|
42
42
|
```js
|
|
43
43
|
const [notifications, setNotifications] = React.useState([]);
|
|
44
|
-
const [type, setType] = React.useState(
|
|
44
|
+
const [type, setType] = React.useState('information');
|
|
45
45
|
|
|
46
46
|
const addNotification = () => {
|
|
47
|
-
setNotifications(
|
|
48
|
-
notifications.concat([{ id: notifications.length + 1, kind: type }])
|
|
49
|
-
);
|
|
47
|
+
setNotifications(notifications.concat([{ id: notifications.length + 1, kind: type }]));
|
|
50
48
|
};
|
|
51
49
|
|
|
52
50
|
<>
|
|
@@ -68,26 +66,26 @@ const addNotification = () => {
|
|
|
68
66
|
onChange={setType}
|
|
69
67
|
value={type}
|
|
70
68
|
items={[
|
|
71
|
-
{ value:
|
|
72
|
-
{ value:
|
|
73
|
-
{ value:
|
|
74
|
-
{ value:
|
|
75
|
-
{ value:
|
|
76
|
-
{ value:
|
|
69
|
+
{ value: 'information' },
|
|
70
|
+
{ value: 'success' },
|
|
71
|
+
{ value: 'attention' },
|
|
72
|
+
{ value: 'error' },
|
|
73
|
+
{ value: 'warning' },
|
|
74
|
+
{ value: 'confetti' },
|
|
77
75
|
]}
|
|
78
76
|
/>
|
|
79
77
|
</SilkeBox>
|
|
80
78
|
{notifications.map((item) => (
|
|
81
79
|
<SilkeNotification
|
|
82
80
|
key={item.id}
|
|
83
|
-
kind={item.kind ||
|
|
81
|
+
kind={item.kind || 'information'}
|
|
84
82
|
title="Warning title"
|
|
85
83
|
subtitle="Some random subtitle"
|
|
86
84
|
onRemove={() => {
|
|
87
85
|
setNotifications(
|
|
88
86
|
notifications.filter((n) => {
|
|
89
87
|
return n.id !== item.id;
|
|
90
|
-
})
|
|
88
|
+
}),
|
|
91
89
|
);
|
|
92
90
|
}}
|
|
93
91
|
/>
|
|
@@ -96,62 +94,37 @@ const addNotification = () => {
|
|
|
96
94
|
</>;
|
|
97
95
|
```
|
|
98
96
|
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
const subtitle = 'Some subitle text here'
|
|
102
|
-
|
|
103
|
-
<>
|
|
104
|
-
<SilkeBox column gap>
|
|
105
|
-
<SilkeNotification
|
|
106
|
-
inline
|
|
107
|
-
kind="success"
|
|
108
|
-
subtitle="Subtitle text here"
|
|
109
|
-
onAction={() => {}}
|
|
110
|
-
actionLabel="Click here"
|
|
111
|
-
/>
|
|
112
|
-
<SilkeNotification
|
|
113
|
-
kind="error"
|
|
114
|
-
inline
|
|
115
|
-
subtitle="Subtitle text here"
|
|
116
|
-
onRemove={() => {}}
|
|
117
|
-
/>
|
|
118
|
-
<SilkeNotification
|
|
119
|
-
kind="success"
|
|
120
|
-
inline
|
|
121
|
-
subtitle="Subtitle text here"
|
|
122
|
-
onRemove={() => {}}
|
|
123
|
-
/>
|
|
124
|
-
<SilkeNotification
|
|
125
|
-
kind="information"
|
|
126
|
-
inline
|
|
127
|
-
subtitle="Subtitle text here"
|
|
128
|
-
onRemove={() => {}}
|
|
129
|
-
/>
|
|
130
|
-
</SilkeBox>
|
|
131
|
-
</>
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Box notification
|
|
135
|
-
|
|
136
|
-
```js
|
|
137
|
-
<>
|
|
97
|
+
```jsx
|
|
98
|
+
() => (
|
|
138
99
|
<SilkeBox column gap>
|
|
139
|
-
<SilkeNotification kind="success" subtitle="Subtitle text here" />
|
|
140
|
-
<SilkeNotification
|
|
141
|
-
kind="error"
|
|
142
|
-
subtitle="Subtitle text here"
|
|
143
|
-
onRemove={() => {}}
|
|
144
|
-
/>
|
|
145
100
|
<SilkeNotification
|
|
101
|
+
inline
|
|
146
102
|
kind="success"
|
|
147
103
|
subtitle="Subtitle text here"
|
|
148
|
-
|
|
104
|
+
onAction={() => {}}
|
|
105
|
+
actionLabel="Click here"
|
|
149
106
|
/>
|
|
107
|
+
<SilkeNotification kind="error" inline subtitle="Subtitle text here" onRemove={() => {}} />
|
|
108
|
+
<SilkeNotification kind="success" inline subtitle="Subtitle text here" onRemove={() => {}} />
|
|
150
109
|
<SilkeNotification
|
|
151
110
|
kind="information"
|
|
111
|
+
inline
|
|
152
112
|
subtitle="Subtitle text here"
|
|
153
113
|
onRemove={() => {}}
|
|
154
114
|
/>
|
|
115
|
+
</SilkeBox>
|
|
116
|
+
);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Box notification
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
<>
|
|
123
|
+
<SilkeBox column gap>
|
|
124
|
+
<SilkeNotification kind="success" subtitle="Subtitle text here" />
|
|
125
|
+
<SilkeNotification kind="error" subtitle="Subtitle text here" onRemove={() => {}} />
|
|
126
|
+
<SilkeNotification kind="success" subtitle="Subtitle text here" onRemove={() => {}} />
|
|
127
|
+
<SilkeNotification kind="information" subtitle="Subtitle text here" onRemove={() => {}} />
|
|
155
128
|
<SilkeNotification
|
|
156
129
|
kind="error"
|
|
157
130
|
subtitle="Subtitle text here"
|
|
@@ -201,12 +174,7 @@ const subtitle = 'Some subitle text here'
|
|
|
201
174
|
```js
|
|
202
175
|
<>
|
|
203
176
|
<SilkeBox column gap>
|
|
204
|
-
<SilkeNotification
|
|
205
|
-
fluid
|
|
206
|
-
kind="success"
|
|
207
|
-
title="Title text here"
|
|
208
|
-
subtitle="Subtitle text here"
|
|
209
|
-
/>
|
|
177
|
+
<SilkeNotification fluid kind="success" title="Title text here" subtitle="Subtitle text here" />
|
|
210
178
|
<SilkeNotification
|
|
211
179
|
fluid
|
|
212
180
|
kind="error"
|
|
@@ -44,6 +44,7 @@ export function SilkeNotification({
|
|
|
44
44
|
onRemove,
|
|
45
45
|
fluid = false,
|
|
46
46
|
dark,
|
|
47
|
+
icon,
|
|
47
48
|
...rest
|
|
48
49
|
}: SilkeNotificationProps) {
|
|
49
50
|
const cl: string[] = [styles.notificationBox];
|
|
@@ -60,7 +61,7 @@ export function SilkeNotification({
|
|
|
60
61
|
<SilkeBox rounded="small" className={cl.join(' ')} {...rest}>
|
|
61
62
|
<SilkeBox size="m" align="center" ref={iconRef}>
|
|
62
63
|
<SilkeIcon
|
|
63
|
-
icon={ICON_KIND[kind]}
|
|
64
|
+
icon={icon ?? ICON_KIND[kind]}
|
|
64
65
|
className={[styles.icon, kind === 'confetti' && styles.scale].filter(Boolean).join(' ')}
|
|
65
66
|
/>
|
|
66
67
|
</SilkeBox>
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
```js
|
|
2
|
-
const [value, setValue] = React.useState({ test:
|
|
2
|
+
const [value, setValue] = React.useState({ test: '' });
|
|
3
3
|
|
|
4
4
|
<>
|
|
5
5
|
<SilkeObjectField label="Default" value={value} onChange={setValue}>
|
|
6
6
|
<SilkeTextField name="test" label="Text label" required minLength={5} />
|
|
7
|
-
{value.test && value.test.length > 10 &&
|
|
8
|
-
<SilkeTextField name="test2" required />
|
|
9
|
-
)}
|
|
7
|
+
{value.test && value.test.length > 10 && <SilkeTextField name="test2" required />}
|
|
10
8
|
<SilkeObjectField name="obj">
|
|
11
|
-
<SilkeTextField
|
|
12
|
-
name="test"
|
|
13
|
-
label="Inside object"
|
|
14
|
-
required
|
|
15
|
-
minLength={5}
|
|
16
|
-
/>
|
|
9
|
+
<SilkeTextField name="test" label="Inside object" required minLength={5} />
|
|
17
10
|
</SilkeObjectField>
|
|
18
11
|
<SilkeButton label="Submit button" type="submit" />
|
|
19
12
|
</SilkeObjectField>
|
|
@@ -25,7 +25,7 @@ export function hasErrors(errors: ErrorMap<any>): boolean {
|
|
|
25
25
|
export function SilkeObjectField<T extends Record<string, any>>(props: SilkeObjectFieldProps<T>) {
|
|
26
26
|
const {
|
|
27
27
|
children,
|
|
28
|
-
value = {},
|
|
28
|
+
value = {} as T,
|
|
29
29
|
errors: externalErrors,
|
|
30
30
|
onErrors,
|
|
31
31
|
onChange,
|
|
@@ -98,7 +98,7 @@ export function SilkeObjectField<T extends Record<string, any>>(props: SilkeObje
|
|
|
98
98
|
const newValue = {
|
|
99
99
|
...value,
|
|
100
100
|
[name]: update,
|
|
101
|
-
};
|
|
101
|
+
} as T;
|
|
102
102
|
valueRef.current = newValue;
|
|
103
103
|
validateField(name);
|
|
104
104
|
if (onChange) onChange(newValue);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Overflow menu
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
|
-
const list = [1, 2, 3].map((i) => ({ label:
|
|
5
|
-
list[2].kind =
|
|
4
|
+
const list = [1, 2, 3].map((i) => ({ label: 'Item 1' }));
|
|
5
|
+
list[2].kind = 'danger';
|
|
6
6
|
|
|
7
7
|
<SilkeBox column align="center" fill>
|
|
8
8
|
<SilkeOverflowMenu items={list} />
|
|
@@ -5,6 +5,7 @@ import { SilkeBox } from '../silke-box';
|
|
|
5
5
|
import { ButtonContext, SilkeButton, SilkeButtonProps } from '../silke-button';
|
|
6
6
|
import { SilkePopover, SilkePopoverProps } from '../silke-popover';
|
|
7
7
|
import styles from './silke-overflow-menu.scss';
|
|
8
|
+
import { SilkeDivider } from '../silke-divider';
|
|
8
9
|
|
|
9
10
|
export type SilkeOverflowMenuProps = {
|
|
10
11
|
children?: React.ReactNode;
|
|
@@ -120,7 +121,7 @@ export function SilkeOverflowMenu({
|
|
|
120
121
|
return React.isValidElement(item) ? (
|
|
121
122
|
item
|
|
122
123
|
) : item === 'divider' ? (
|
|
123
|
-
<
|
|
124
|
+
<SilkeDivider key={index} dark />
|
|
124
125
|
) : (
|
|
125
126
|
<SilkeOverflowMenuItem
|
|
126
127
|
key={index}
|
|
@@ -17,18 +17,18 @@ const [show, setShow] = React.useState(false);
|
|
|
17
17
|
|
|
18
18
|
```js
|
|
19
19
|
const [show, setShow] = React.useState(false);
|
|
20
|
-
const [targetOrigin, setTargetOrigin] = React.useState(
|
|
21
|
-
const [anchorOrigin, setAnchorOrigin] = React.useState(
|
|
20
|
+
const [targetOrigin, setTargetOrigin] = React.useState('top-left');
|
|
21
|
+
const [anchorOrigin, setAnchorOrigin] = React.useState('bottom-left');
|
|
22
22
|
const origins = [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
'top-left',
|
|
24
|
+
'top-center',
|
|
25
|
+
'top-right',
|
|
26
|
+
'center-right',
|
|
27
|
+
'bottom-right',
|
|
28
|
+
'bottom-center',
|
|
29
|
+
'bottom-left',
|
|
30
|
+
'center-left',
|
|
31
|
+
'center-center',
|
|
32
32
|
];
|
|
33
33
|
|
|
34
34
|
const AnchorSelect = ({ header, selected, onSelect }) => (
|
|
@@ -38,7 +38,7 @@ const AnchorSelect = ({ header, selected, onSelect }) => (
|
|
|
38
38
|
<SilkeButton
|
|
39
39
|
key={o}
|
|
40
40
|
label={o}
|
|
41
|
-
kind={o === selected ?
|
|
41
|
+
kind={o === selected ? 'primary' : 'ghost'}
|
|
42
42
|
onClick={() => onSelect(o)}
|
|
43
43
|
/>
|
|
44
44
|
))}
|
|
@@ -58,16 +58,8 @@ const ref = React.useRef();
|
|
|
58
58
|
>
|
|
59
59
|
<SilkeBox bg="neutral-20" pad column>
|
|
60
60
|
<SilkeBox flex>
|
|
61
|
-
<AnchorSelect
|
|
62
|
-
|
|
63
|
-
selected={targetOrigin}
|
|
64
|
-
onSelect={setTargetOrigin}
|
|
65
|
-
/>
|
|
66
|
-
<AnchorSelect
|
|
67
|
-
header="AnchorOrigin"
|
|
68
|
-
selected={anchorOrigin}
|
|
69
|
-
onSelect={setAnchorOrigin}
|
|
70
|
-
/>
|
|
61
|
+
<AnchorSelect header="TargetOrigin" selected={targetOrigin} onSelect={setTargetOrigin} />
|
|
62
|
+
<AnchorSelect header="AnchorOrigin" selected={anchorOrigin} onSelect={setAnchorOrigin} />
|
|
71
63
|
</SilkeBox>
|
|
72
64
|
<SilkeButton label="Close" onClick={() => setShow(false)} />
|
|
73
65
|
</SilkeBox>
|
|
@@ -144,6 +144,8 @@ export function SilkePopover({
|
|
|
144
144
|
|
|
145
145
|
// Update position if anchor changes
|
|
146
146
|
useEffect(() => {
|
|
147
|
+
// Hack to fix issue when matchAnchorWidth is true
|
|
148
|
+
updatePos();
|
|
147
149
|
updatePos();
|
|
148
150
|
}, [anchor]);
|
|
149
151
|
|
|
@@ -158,21 +160,24 @@ export function SilkePopover({
|
|
|
158
160
|
useParentScroll(!hide && isRefObject(anchor) ? anchor : null, updatePos);
|
|
159
161
|
|
|
160
162
|
// Request close on click outside (disabled if disabled click outside or hidden or not requestClose function)
|
|
161
|
-
useMouseDown(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
163
|
+
useMouseDown(
|
|
164
|
+
(e) => {
|
|
165
|
+
const el = targetRef.current;
|
|
166
|
+
const parentPopover = parentContext.current;
|
|
167
|
+
|
|
168
|
+
if (!el || !onRequestClose || !isMountedAndOpenRef.current) return;
|
|
169
|
+
// if click inside parent popover then close
|
|
170
|
+
const isInsideParentPopover = parentPopover && isInside(e, parentPopover);
|
|
171
|
+
const isInsidePopover = isInsideRole(e, 'popover');
|
|
172
|
+
const isInDOM = document.contains(e.target as HTMLElement);
|
|
173
|
+
|
|
174
|
+
// CLose popover if el is DOM and event is not inside element itself or popover, or event is in parent popover
|
|
175
|
+
if (!isInside(e, el) && isInDOM && (isInsideParentPopover || !isInsidePopover)) {
|
|
176
|
+
onRequestClose(e);
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
disabledClickOutside || hide || !onRequestClose,
|
|
180
|
+
);
|
|
176
181
|
|
|
177
182
|
const onEscape = useCallback(() => {
|
|
178
183
|
if (!hide && typeof onRequestClose === 'function') {
|
|
@@ -241,6 +246,7 @@ export function applyPopoverStyles(
|
|
|
241
246
|
width,
|
|
242
247
|
height,
|
|
243
248
|
...(pointerEventsNone && { pointerEvents: 'none' }),
|
|
249
|
+
...(targetRect.height >= window.innerHeight && { overflow: 'auto' }),
|
|
244
250
|
});
|
|
245
251
|
if (zIndex) target.style.zIndex = zIndex.toString();
|
|
246
252
|
}
|
|
@@ -12,41 +12,38 @@
|
|
|
12
12
|
|
|
13
13
|
## Example implementation
|
|
14
14
|
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
const [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
onClick={() => setStep(Math.max(step - 1, 1))}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
label="Next"
|
|
47
|
-
onClick={() => setStep(Math.min(step + 1, 4))}
|
|
48
|
-
/>
|
|
15
|
+
```jsx
|
|
16
|
+
() => {
|
|
17
|
+
const [step, setStep] = React.useState(1);
|
|
18
|
+
const [pressed, setPressed] = React.useState(false);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<SilkeBox column>
|
|
22
|
+
<ProgressIndicator>
|
|
23
|
+
{[1, 2, 3, 4].map((index) => (
|
|
24
|
+
<ProgressStep
|
|
25
|
+
key={index}
|
|
26
|
+
label={'Step' + index}
|
|
27
|
+
complete={index < step}
|
|
28
|
+
current={step === index}
|
|
29
|
+
error={index === 2 && step > 2 && !pressed}
|
|
30
|
+
disabled={index === 4 && !pressed}
|
|
31
|
+
onClick={() => setStep(index)}
|
|
32
|
+
/>
|
|
33
|
+
))}
|
|
34
|
+
</ProgressIndicator>
|
|
35
|
+
<SilkeBox align="spread" pad>
|
|
36
|
+
<SilkeButton label="Back" onClick={() => setStep(Math.max(step - 1, 1))} />
|
|
37
|
+
{step === 2 && (
|
|
38
|
+
<SilkeButton
|
|
39
|
+
kind="secondary"
|
|
40
|
+
label="Must press this"
|
|
41
|
+
onClick={() => setPressed(true) || setStep(3)}
|
|
42
|
+
/>
|
|
43
|
+
)}
|
|
44
|
+
<SilkeButton label="Next" onClick={() => setStep(Math.min(step + 1, 4))} />
|
|
45
|
+
</SilkeBox>
|
|
49
46
|
</SilkeBox>
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
);
|
|
48
|
+
};
|
|
52
49
|
```
|
|
@@ -8,7 +8,7 @@ type TextSize = 'micro' | 'small' | 'base' | 'large';
|
|
|
8
8
|
type SilkeRadioButtonGroupProps = {
|
|
9
9
|
name: string;
|
|
10
10
|
label?: React.ReactNode;
|
|
11
|
-
items: { label: string; value: any }[];
|
|
11
|
+
items: { label: string | React.ReactNode; value: any }[];
|
|
12
12
|
required?: boolean;
|
|
13
13
|
help?: React.ReactNode;
|
|
14
14
|
size?: TextSize;
|
|
@@ -40,13 +40,7 @@ const [value, setValue] = React.useState({ name: list[1] });
|
|
|
40
40
|
))}
|
|
41
41
|
|
|
42
42
|
{list.map((name) => (
|
|
43
|
-
<SilkeRadioButton
|
|
44
|
-
key={name}
|
|
45
|
-
name="required"
|
|
46
|
-
value={name}
|
|
47
|
-
label={name}
|
|
48
|
-
required
|
|
49
|
-
/>
|
|
43
|
+
<SilkeRadioButton key={name} name="required" value={name} label={name} required />
|
|
50
44
|
))}
|
|
51
45
|
<pre>Value:{JSON.stringify(value)}</pre>
|
|
52
46
|
</SilkeForm>;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
# Search field
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
|
-
const [search, setSearch] = React.useState(
|
|
4
|
+
const [search, setSearch] = React.useState('');
|
|
5
5
|
<>
|
|
6
|
-
<SilkeSearchField
|
|
7
|
-
placeholder="Search field"
|
|
8
|
-
search={search}
|
|
9
|
-
onChange={setSearch}
|
|
10
|
-
/>
|
|
6
|
+
<SilkeSearchField placeholder="Search field" search={search} onChange={setSearch} />
|
|
11
7
|
<h3>Current search: {search}</h3>
|
|
12
8
|
</>;
|
|
13
9
|
```
|
|
@@ -15,12 +11,8 @@ const [search, setSearch] = React.useState("");
|
|
|
15
11
|
## Search field in toolbar
|
|
16
12
|
|
|
17
13
|
```js
|
|
18
|
-
const [search, setSearch] = React.useState(
|
|
14
|
+
const [search, setSearch] = React.useState('');
|
|
19
15
|
<SilkeToolbar>
|
|
20
|
-
<SilkeSearchField
|
|
21
|
-
placeholder="Search field"
|
|
22
|
-
search={search}
|
|
23
|
-
onChange={setSearch}
|
|
24
|
-
/>
|
|
16
|
+
<SilkeSearchField placeholder="Search field" search={search} onChange={setSearch} />
|
|
25
17
|
</SilkeToolbar>;
|
|
26
18
|
```
|
|
@@ -4,9 +4,9 @@ const items = ipsum.list((i) => ({
|
|
|
4
4
|
label: ipsum.name(),
|
|
5
5
|
disabled: i > 4 && !Math.floor(Math.random() * 3),
|
|
6
6
|
}));
|
|
7
|
-
const [value, setValue] = React.useState(
|
|
7
|
+
const [value, setValue] = React.useState('');
|
|
8
8
|
<SilkeBox column gap="xs">
|
|
9
|
-
{[
|
|
9
|
+
{['default', 'zombie', 'ghost'].map((kind) => (
|
|
10
10
|
<SilkeBox gap="m" vAlign="center">
|
|
11
11
|
<SilkeSelectField
|
|
12
12
|
key={kind}
|
|
@@ -63,12 +63,12 @@ const [value, setValue] = React.useState("");
|
|
|
63
63
|
const items = ipsum.list((i) => ({
|
|
64
64
|
value: i,
|
|
65
65
|
label: ipsum.name(),
|
|
66
|
-
icon:
|
|
66
|
+
icon: 'react',
|
|
67
67
|
disabled: i > 4 && !Math.floor(Math.random() * 3),
|
|
68
68
|
}));
|
|
69
|
-
const [value, setValue] = React.useState(
|
|
69
|
+
const [value, setValue] = React.useState('');
|
|
70
70
|
<SilkeBox column gap="xs">
|
|
71
|
-
{[
|
|
71
|
+
{['default', 'zombie', 'ghost'].map((kind) => (
|
|
72
72
|
<SilkeBox gap="m" vAlign="center">
|
|
73
73
|
<SilkeSelectField
|
|
74
74
|
key={kind}
|
|
@@ -116,9 +116,9 @@ const items = ipsum.list((i) => ({
|
|
|
116
116
|
image: ipsum.image(),
|
|
117
117
|
disabled: i > 4 && !Math.floor(Math.random() * 3),
|
|
118
118
|
}));
|
|
119
|
-
const [value, setValue] = React.useState(
|
|
119
|
+
const [value, setValue] = React.useState('');
|
|
120
120
|
<SilkeBox column gap="xs">
|
|
121
|
-
{[
|
|
121
|
+
{['default', 'zombie', 'ghost'].map((kind) => (
|
|
122
122
|
<SilkeBox gap="m" vAlign="center">
|
|
123
123
|
<SilkeSelectField
|
|
124
124
|
key={kind}
|
|
@@ -161,7 +161,7 @@ const [value, setValue] = React.useState("");
|
|
|
161
161
|
|
|
162
162
|
```js
|
|
163
163
|
const items = ipsum.list((i) => ({ value: i, label: ipsum.name() }));
|
|
164
|
-
const [value, setValue] = React.useState(
|
|
164
|
+
const [value, setValue] = React.useState('');
|
|
165
165
|
|
|
166
166
|
<SilkeSelectField
|
|
167
167
|
label="Default"
|
|
@@ -171,7 +171,7 @@ const [value, setValue] = React.useState("");
|
|
|
171
171
|
items={items}
|
|
172
172
|
renderItem={({ item, selected }) => (
|
|
173
173
|
<SilkeBox
|
|
174
|
-
bg={selected ?
|
|
174
|
+
bg={selected ? 'error' : null}
|
|
175
175
|
bgHover="highlight"
|
|
176
176
|
height="base"
|
|
177
177
|
gap="m"
|
|
@@ -215,7 +215,7 @@ const [value, setValue] = React.useState([items[0].value]);
|
|
|
215
215
|
onChange={setValue}
|
|
216
216
|
value={value}
|
|
217
217
|
items={items}
|
|
218
|
-
placeholder={!value.length &&
|
|
218
|
+
placeholder={!value.length && 'No items selected'}
|
|
219
219
|
renderTags={({ items }) => `Found ${items.length} items`}
|
|
220
220
|
/>;
|
|
221
221
|
```
|