@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
|
@@ -29,6 +29,7 @@ import { SilkeButton } from '../silke-button';
|
|
|
29
29
|
*/
|
|
30
30
|
type SilkeAutocompletePopupProps<T = any> = SilkeAutocompleteFieldProps<T> & {
|
|
31
31
|
containerRef?: React.RefObject<HTMLDivElement>;
|
|
32
|
+
searchPlaceholder?: string;
|
|
32
33
|
onRequestClose?: () => void;
|
|
33
34
|
};
|
|
34
35
|
|
|
@@ -113,6 +114,8 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
113
114
|
onSearch,
|
|
114
115
|
onClose,
|
|
115
116
|
onRequestClose,
|
|
117
|
+
buttonRight,
|
|
118
|
+
searchPlaceholder,
|
|
116
119
|
...form
|
|
117
120
|
} = useFormField(props, autocompleteValidator);
|
|
118
121
|
const context = useTextFieldContext();
|
|
@@ -121,7 +124,8 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
121
124
|
const inputField = useRef<HTMLDivElement>();
|
|
122
125
|
const isSelected = (value: T): boolean => {
|
|
123
126
|
if (form.multiple) {
|
|
124
|
-
|
|
127
|
+
const values = Array.isArray(form.value) ? form.value : [];
|
|
128
|
+
for (const v of values) {
|
|
125
129
|
if (isEqual(v, value) || isEqual(value, selectedVariableKey)) return true;
|
|
126
130
|
}
|
|
127
131
|
return false;
|
|
@@ -195,7 +199,7 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
195
199
|
|
|
196
200
|
const handleChange = (nuValue: T | undefined) => {
|
|
197
201
|
if (form.multiple) {
|
|
198
|
-
form.onChange([...(form.value
|
|
202
|
+
form.onChange([...(Array.isArray(form.value) ? form.value : []), nuValue]);
|
|
199
203
|
} else {
|
|
200
204
|
form.onChange(nuValue as any);
|
|
201
205
|
}
|
|
@@ -203,7 +207,8 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
203
207
|
|
|
204
208
|
const handleRemoveSingle = (remove: T) => {
|
|
205
209
|
if (form.multiple && form.value) {
|
|
206
|
-
const value = form.value.filter((v: T) => remove !== v)
|
|
210
|
+
const value = Array.isArray(form.value) ? form.value.filter((v: T) => remove !== v) : [];
|
|
211
|
+
|
|
207
212
|
if (!isEqual(value, form.value)) form.onChange(value);
|
|
208
213
|
}
|
|
209
214
|
};
|
|
@@ -228,7 +233,10 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
228
233
|
const filteredDataEntries = displayedItems.filter((entry) => !entry.divider) as Data<T>[];
|
|
229
234
|
|
|
230
235
|
const isItemSelected = (item: string): boolean => {
|
|
231
|
-
return
|
|
236
|
+
return (
|
|
237
|
+
Array.isArray(form.value) &&
|
|
238
|
+
form.value.map((s) => String(s).toUpperCase()).includes(item.trim().toUpperCase())
|
|
239
|
+
);
|
|
232
240
|
};
|
|
233
241
|
|
|
234
242
|
const findItem = (item: string) => {
|
|
@@ -305,8 +313,9 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
305
313
|
if (prevSearchText?.length === 1) {
|
|
306
314
|
setPrevSearchText('');
|
|
307
315
|
} else if (form.multiple && form.value && !searchText) {
|
|
308
|
-
form.onChange(form.value.slice(0, -1));
|
|
316
|
+
if (Array.isArray(form.value)) form.onChange(form.value.slice(0, -1));
|
|
309
317
|
}
|
|
318
|
+
|
|
310
319
|
break;
|
|
311
320
|
}
|
|
312
321
|
case 'Enter': {
|
|
@@ -355,6 +364,7 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
355
364
|
|
|
356
365
|
const dataCy = props['data-cy'] || undefined;
|
|
357
366
|
const boxSize: BoxSize = size === 'xs' ? 's' : size === 's' ? 'base' : 'm';
|
|
367
|
+
const iconFontSize = size === 'xs' ? '12px' : undefined;
|
|
358
368
|
|
|
359
369
|
// Only match anchor width if dropDownMinWidth not defined or container width is larger than dropDownMinWidth
|
|
360
370
|
const matchAnchorWidth =
|
|
@@ -381,10 +391,14 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
381
391
|
data-cy={dataCy ? dataCy + '-dropdown' : undefined}
|
|
382
392
|
bg="neutral-20"
|
|
383
393
|
column
|
|
384
|
-
style={{
|
|
394
|
+
style={{
|
|
395
|
+
maxHeight: 300,
|
|
396
|
+
minWidth: dropDownMinWidth,
|
|
397
|
+
maxWidth: dropDownMaxWidth,
|
|
398
|
+
}}
|
|
385
399
|
gap={disableSearch ? undefined : 'xs'}
|
|
386
400
|
vPad="xs"
|
|
387
|
-
value={form.value}
|
|
401
|
+
value={form.value as any}
|
|
388
402
|
onKeyUp={handleKeyUp}
|
|
389
403
|
ref={dropdownRef}
|
|
390
404
|
>
|
|
@@ -395,7 +409,7 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
395
409
|
autoFocus
|
|
396
410
|
size={size}
|
|
397
411
|
className={disableSearch ? styles.hiddenSearch : undefined}
|
|
398
|
-
placeholder=
|
|
412
|
+
placeholder={searchPlaceholder || 'Search'}
|
|
399
413
|
kind="ghost"
|
|
400
414
|
onFocus={(e) => {
|
|
401
415
|
inputRef.current = e.currentTarget as HTMLInputElement;
|
|
@@ -423,13 +437,15 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
423
437
|
value={searchText}
|
|
424
438
|
>
|
|
425
439
|
{props.showAddIcon && onAdd && (
|
|
426
|
-
<SilkeTextFieldItem>
|
|
440
|
+
<SilkeTextFieldItem hPad="xs">
|
|
427
441
|
<SilkeButton icon="add" kind="ghost" size="s" onClick={() => onAdd('variable')} />
|
|
428
442
|
</SilkeTextFieldItem>
|
|
429
443
|
)}
|
|
444
|
+
{buttonRight && <div onClick={() => onRequestClose?.()}>{buttonRight}</div>}
|
|
430
445
|
</SilkeTextField>
|
|
446
|
+
|
|
431
447
|
{!disableSearch && <SilkeDivider />}
|
|
432
|
-
<SilkeBox column scroll flex hPad="
|
|
448
|
+
<SilkeBox column scroll flex hPad="s">
|
|
433
449
|
{displayedItems.length === 0 && (
|
|
434
450
|
<SilkeBox hPad="s" height={boxSize} vAlign="center">
|
|
435
451
|
<SilkeTextSmall color="neutral-60">No results</SilkeTextSmall>
|
|
@@ -437,12 +453,13 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
437
453
|
)}
|
|
438
454
|
{displayedItems.sort(sort).map((item, i) =>
|
|
439
455
|
item.divider ? (
|
|
440
|
-
<
|
|
456
|
+
<SilkeDivider dark key={`hr-${i}`} />
|
|
441
457
|
) : (
|
|
442
458
|
<AutocompleteItem
|
|
443
459
|
ItemRender={ItemRender}
|
|
444
460
|
key={i}
|
|
445
461
|
size={boxSize}
|
|
462
|
+
iconFontSize={iconFontSize}
|
|
446
463
|
item={item}
|
|
447
464
|
highlight={i === highlight}
|
|
448
465
|
selected={isSelected(item.value)}
|
|
@@ -458,6 +475,7 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
458
475
|
{onAdd && !disableAddFromList && searchText && (
|
|
459
476
|
<AutocompleteItem
|
|
460
477
|
size={boxSize}
|
|
478
|
+
iconFontSize={iconFontSize}
|
|
461
479
|
highlight={!displayedItems.length}
|
|
462
480
|
item={{
|
|
463
481
|
label: `+ Add item "${searchText}"`,
|
|
@@ -470,15 +488,17 @@ export function SilkeAutocompletePopup<T>(props: SilkeAutocompletePopupProps<T>)
|
|
|
470
488
|
}}
|
|
471
489
|
/>
|
|
472
490
|
)}
|
|
473
|
-
{isHidingResults
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
491
|
+
{isHidingResults
|
|
492
|
+
? props.maxDisplayedItemsLabel || (
|
|
493
|
+
<>
|
|
494
|
+
<SilkeDivider dark />
|
|
495
|
+
<SilkeBox pad="l">
|
|
496
|
+
Currently displaying the {maxDisplayedItems} first results, please enter a more
|
|
497
|
+
specific query to see the rest
|
|
498
|
+
</SilkeBox>
|
|
499
|
+
</>
|
|
500
|
+
)
|
|
501
|
+
: null}
|
|
482
502
|
</SilkeBox>
|
|
483
503
|
</SilkeBox>
|
|
484
504
|
</SilkePopover>
|
|
@@ -17,13 +17,17 @@
|
|
|
17
17
|
## Different gaps to mind
|
|
18
18
|
|
|
19
19
|
```jsx
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
let a = 123;
|
|
21
|
+
|
|
22
|
+
let component = (
|
|
23
|
+
<SilkeBox gap>
|
|
24
|
+
{['xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl'].map((gap) => (
|
|
25
|
+
<SilkeBox gap={gap} column hAlign>
|
|
26
|
+
<SilkeButton label={gap} />
|
|
27
|
+
<SilkeButton label={gap} />
|
|
28
|
+
<SilkeButton label={gap} />
|
|
29
|
+
</SilkeBox>
|
|
30
|
+
))}
|
|
31
|
+
</SilkeBox>
|
|
32
|
+
);
|
|
29
33
|
```
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
@use '../../variables' as *;
|
|
2
2
|
|
|
3
3
|
.box {
|
|
4
|
+
display: flex;
|
|
5
|
+
position: relative;
|
|
6
|
+
|
|
4
7
|
&.debug,
|
|
5
8
|
&.debug .box {
|
|
6
9
|
outline: 1px solid red;
|
|
7
10
|
}
|
|
8
|
-
display: flex;
|
|
9
|
-
position: relative;
|
|
10
11
|
&.reverse {
|
|
11
12
|
flex-direction: row-reverse;
|
|
12
13
|
&.column {
|
|
@@ -194,4 +195,12 @@ button.box {
|
|
|
194
195
|
.shadow-level#{$i} {
|
|
195
196
|
filter: var(--shadow-level-#{$i});
|
|
196
197
|
}
|
|
197
|
-
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.user-select-none {
|
|
201
|
+
user-select: none;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.user-select-text {
|
|
205
|
+
user-select: text;
|
|
206
|
+
}
|
|
@@ -11,8 +11,19 @@ import { Link, LinkProps as RouterLinkProps } from 'react-router-dom';
|
|
|
11
11
|
import { SilkeColor } from '../../silke-theme-provider';
|
|
12
12
|
import styles from './silke-box.scss';
|
|
13
13
|
|
|
14
|
-
export type BoxSpace =
|
|
15
|
-
|
|
14
|
+
export type BoxSpace =
|
|
15
|
+
| 'xxs'
|
|
16
|
+
| 'xs'
|
|
17
|
+
| 's'
|
|
18
|
+
| 'sm'
|
|
19
|
+
| 'm'
|
|
20
|
+
| 'l'
|
|
21
|
+
| 'xl'
|
|
22
|
+
| 'xxl'
|
|
23
|
+
| 'xxxl'
|
|
24
|
+
| 'none'
|
|
25
|
+
| boolean;
|
|
26
|
+
export type BoxSize = 'xs' | 's' | 'base' | 'm' | 'l' | 'xl' | 'xxl' | '256' | '512';
|
|
16
27
|
|
|
17
28
|
export type BoxAlign = 'center' | 'start' | 'end' | 'spread' | 'space' | boolean;
|
|
18
29
|
|
|
@@ -72,6 +83,8 @@ type BaseProps = {
|
|
|
72
83
|
|
|
73
84
|
cursor?: 'pointer' | 'grab' | 'text';
|
|
74
85
|
|
|
86
|
+
userSelect?: 'none' | 'text';
|
|
87
|
+
|
|
75
88
|
/** Text color on hover */
|
|
76
89
|
colorHover?: SilkeColor;
|
|
77
90
|
aspectRatio?: '16:9' | '4:3' | '1:1';
|
|
@@ -213,6 +226,7 @@ function BoxComp(
|
|
|
213
226
|
shadow,
|
|
214
227
|
overflow,
|
|
215
228
|
cursor,
|
|
229
|
+
userSelect,
|
|
216
230
|
...rest
|
|
217
231
|
}: BoxProps,
|
|
218
232
|
ref: any,
|
|
@@ -253,6 +267,8 @@ function BoxComp(
|
|
|
253
267
|
if (bg) cl.push('bg-' + bg);
|
|
254
268
|
if (bgHover) cl.push('bg-hover-' + bgHover);
|
|
255
269
|
|
|
270
|
+
if (userSelect) cl.push(styles['user-select-' + userSelect]);
|
|
271
|
+
|
|
256
272
|
if (isArray(align)) {
|
|
257
273
|
[hAlign, vAlign] = align;
|
|
258
274
|
} else if (align) {
|
|
@@ -8,7 +8,7 @@ import { SilkeImage } from '../silke-image';
|
|
|
8
8
|
|
|
9
9
|
type SilkeBreadcrumbProps = {
|
|
10
10
|
icon?: IEmojiIcon | SilkeIcons;
|
|
11
|
-
label?:
|
|
11
|
+
label?: React.ReactNode;
|
|
12
12
|
noSlash?: boolean;
|
|
13
13
|
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
14
14
|
};
|
|
@@ -27,7 +27,7 @@ export function SilkeBreadcrumb({ icon, label, noSlash, onClick }: SilkeBreadcru
|
|
|
27
27
|
}}
|
|
28
28
|
href="#"
|
|
29
29
|
>
|
|
30
|
-
<SilkeBox>
|
|
30
|
+
<SilkeBox vAlign="center">
|
|
31
31
|
{icon && (
|
|
32
32
|
<SilkeImage
|
|
33
33
|
icon={icon}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BoxButtonProps, SilkeBox } from '../silke-box';
|
|
3
3
|
import { SilkeIcon, SilkeIcons } from '../silke-icon';
|
|
4
|
-
import {
|
|
4
|
+
import { SilkeTextSmall, SilkeTitle } from '../silke-text';
|
|
5
5
|
import styles from './silke-big-button.scss';
|
|
6
|
+
import { SilkeColor } from '../../silke-theme-provider';
|
|
6
7
|
|
|
7
8
|
type SilkeBigButtonProps = {
|
|
8
9
|
kind?: 'accent' | 'default';
|
|
9
10
|
label: string;
|
|
10
11
|
subLabel?: string;
|
|
11
12
|
leftIcon?: SilkeIcons | React.ReactElement;
|
|
13
|
+
leftIconColor?: SilkeColor;
|
|
14
|
+
leftIconBgColor?: SilkeColor;
|
|
12
15
|
rightIcon?: SilkeIcons | React.ReactElement;
|
|
13
16
|
children?: React.ReactNode;
|
|
14
17
|
} & BoxButtonProps;
|
|
@@ -21,6 +24,8 @@ export function SilkeBigButton({
|
|
|
21
24
|
rightIcon,
|
|
22
25
|
children,
|
|
23
26
|
className,
|
|
27
|
+
leftIconColor,
|
|
28
|
+
leftIconBgColor,
|
|
24
29
|
...rest
|
|
25
30
|
}: SilkeBigButtonProps) {
|
|
26
31
|
let cl = styles.root;
|
|
@@ -28,10 +33,16 @@ export function SilkeBigButton({
|
|
|
28
33
|
if (kind === 'accent') cl += ' ' + styles.accent;
|
|
29
34
|
|
|
30
35
|
return (
|
|
31
|
-
<SilkeBox pad="
|
|
36
|
+
<SilkeBox pad="m" gap="m" vAlign="center" {...rest} tag="button" className={cl}>
|
|
32
37
|
{leftIcon && (
|
|
33
|
-
<SilkeBox
|
|
34
|
-
|
|
38
|
+
<SilkeBox
|
|
39
|
+
size="base"
|
|
40
|
+
className={!leftIconBgColor ? styles.leftIcon : ''}
|
|
41
|
+
rounded
|
|
42
|
+
align="center"
|
|
43
|
+
bg={leftIconBgColor}
|
|
44
|
+
>
|
|
45
|
+
<SilkeIcon icon={leftIcon} color={leftIconColor} />
|
|
35
46
|
</SilkeBox>
|
|
36
47
|
)}
|
|
37
48
|
<SilkeBox column flex gap="xs">
|
|
@@ -21,8 +21,8 @@ Buttons are clickable elements that are used to trigger actions. They communicat
|
|
|
21
21
|
<SilkeButton label="Primary" />
|
|
22
22
|
<SilkeButton label="Secondary" kind="secondary" />
|
|
23
23
|
<SilkeButton label="Danger" kind="danger" />
|
|
24
|
-
<SilkeButton label="Tertiary" kind="tertiary" />
|
|
25
24
|
<SilkeButton label="Ghost" kind="ghost" />
|
|
25
|
+
<SilkeButton label="Upgrade" kind="upgrade" />
|
|
26
26
|
</SilkeBox>
|
|
27
27
|
|
|
28
28
|
<SilkeTitle kind="xs">Icon only</SilkeTitle>
|
|
@@ -30,8 +30,8 @@ Buttons are clickable elements that are used to trigger actions. They communicat
|
|
|
30
30
|
<SilkeButton icon="add" />
|
|
31
31
|
<SilkeButton icon="add" kind="secondary" />
|
|
32
32
|
<SilkeButton icon="add" kind="danger" />
|
|
33
|
-
<SilkeButton icon="add" kind="tertiary" />
|
|
34
33
|
<SilkeButton icon="add" kind="ghost" />
|
|
34
|
+
<SilkeButton icon="add" kind="upgrade" />
|
|
35
35
|
</SilkeBox>
|
|
36
36
|
|
|
37
37
|
<SilkeTitle kind="xs">Standard buttons with icon</SilkeTitle>
|
|
@@ -39,8 +39,8 @@ Buttons are clickable elements that are used to trigger actions. They communicat
|
|
|
39
39
|
<SilkeButton icon="add" label="Primary" />
|
|
40
40
|
<SilkeButton icon="add" label="Secondary" kind="secondary" />
|
|
41
41
|
<SilkeButton icon="add" label="Danger" kind="danger" />
|
|
42
|
-
<SilkeButton icon="add" label="Tertiary" kind="tertiary" />
|
|
43
42
|
<SilkeButton icon="add" label="Ghost" kind="ghost" />
|
|
43
|
+
<SilkeButton icon="add" label="Upgrade" kind="upgrade" />
|
|
44
44
|
</SilkeBox>
|
|
45
45
|
|
|
46
46
|
<SilkeTitle kind="xs">Disabled</SilkeTitle>
|
|
@@ -48,8 +48,8 @@ Buttons are clickable elements that are used to trigger actions. They communicat
|
|
|
48
48
|
<SilkeButton disabled icon="add" label="Primary" />
|
|
49
49
|
<SilkeButton disabled icon="add" label="Secondary" kind="secondary" />
|
|
50
50
|
<SilkeButton disabled icon="add" label="Danger" kind="danger" />
|
|
51
|
-
<SilkeButton disabled icon="add" label="Tertiary" kind="tertiary" />
|
|
52
51
|
<SilkeButton disabled icon="add" label="Ghost" kind="ghost" />
|
|
52
|
+
<SilkeButton disabled icon="add" label="Upgrade" kind="upgrade" />
|
|
53
53
|
</SilkeBox>
|
|
54
54
|
</SilkeBox>
|
|
55
55
|
```
|
|
@@ -63,8 +63,8 @@ Buttons are clickable elements that are used to trigger actions. They communicat
|
|
|
63
63
|
<SilkeButton label="Primary" />
|
|
64
64
|
<SilkeButton label="Secondary" kind="secondary" />
|
|
65
65
|
<SilkeButton label="Danger" kind="danger" />
|
|
66
|
-
<SilkeButton label="Tertiary" kind="tertiary" />
|
|
67
66
|
<SilkeButton label="Ghost" kind="ghost" />
|
|
67
|
+
<SilkeButton label="Upgrade" kind="upgrade" />
|
|
68
68
|
</SilkeBox>
|
|
69
69
|
|
|
70
70
|
<SilkeTitle kind="xs">Loading buttons</SilkeTitle>
|
|
@@ -72,8 +72,8 @@ Buttons are clickable elements that are used to trigger actions. They communicat
|
|
|
72
72
|
<SilkeButton label="Primary" loading />
|
|
73
73
|
<SilkeButton label="Secondary" kind="secondary" loading />
|
|
74
74
|
<SilkeButton label="Danger" kind="danger" loading />
|
|
75
|
-
<SilkeButton label="Tertiary" kind="tertiary" loading />
|
|
76
75
|
<SilkeButton label="Ghost" kind="ghost" loading />
|
|
76
|
+
<SilkeButton label="Upgrade" kind="upgrade" loading />
|
|
77
77
|
</SilkeBox>
|
|
78
78
|
</SilkeBox>
|
|
79
79
|
```
|
|
@@ -82,10 +82,10 @@ Buttons are clickable elements that are used to trigger actions. They communicat
|
|
|
82
82
|
|
|
83
83
|
```js
|
|
84
84
|
<SilkeBox gap fill column>
|
|
85
|
-
{[undefined,
|
|
85
|
+
{[undefined, 'default', 'base', 's', 'm', 'l'].map((size) => (
|
|
86
86
|
<SilkeBox wrap gap key={size}>
|
|
87
|
-
<SilkeButton label={size +
|
|
88
|
-
<SilkeButton label={size +
|
|
87
|
+
<SilkeButton label={size + ''} size={size} />
|
|
88
|
+
<SilkeButton label={size + ''} icon="add" size={size} />
|
|
89
89
|
<SilkeButton icon="add" size={size} />
|
|
90
90
|
</SilkeBox>
|
|
91
91
|
))}
|
|
@@ -104,7 +104,7 @@ Buttons are clickable elements that are used to trigger actions. They communicat
|
|
|
104
104
|
## Confirmation Button
|
|
105
105
|
|
|
106
106
|
```js
|
|
107
|
-
const handleConfirm = () => console.log(
|
|
107
|
+
const handleConfirm = () => console.log('Confirmed');
|
|
108
108
|
|
|
109
109
|
<SilkeButtonSet>
|
|
110
110
|
<SilkeConfirmationButton
|
|
@@ -127,11 +127,28 @@ const handleConfirm = () => console.log("Confirmed");
|
|
|
127
127
|
|
|
128
128
|
## Big button
|
|
129
129
|
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
<SilkeBigButton
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
```jsx
|
|
131
|
+
<>
|
|
132
|
+
<SilkeBigButton
|
|
133
|
+
kind="accent"
|
|
134
|
+
leftIcon="figma"
|
|
135
|
+
label="Big button"
|
|
136
|
+
subLabel="Sub label"
|
|
137
|
+
rightIcon="add"
|
|
138
|
+
/>
|
|
139
|
+
<SilkeBigButton leftIcon="figma" label="Big button" subLabel="Sub label" rightIcon="add" />
|
|
140
|
+
<SilkeBigButton leftIcon="figma" label="Big button" subLabel="Sub label" rightIcon="add" />
|
|
141
|
+
<SilkeBigButton leftIcon="figma" label="Big button" subLabel="Sub label">
|
|
142
|
+
Custom content
|
|
143
|
+
</SilkeBigButton>
|
|
144
|
+
<SilkeBigButton
|
|
145
|
+
leftIcon="figma"
|
|
146
|
+
label="Big button"
|
|
147
|
+
subLabel="Sub label"
|
|
148
|
+
leftIconColor="neutral-5"
|
|
149
|
+
leftIconBgColor="support-tertiary-60"
|
|
150
|
+
>
|
|
151
|
+
Custom content
|
|
152
|
+
</SilkeBigButton>
|
|
153
|
+
</>
|
|
137
154
|
```
|
|
@@ -8,17 +8,14 @@ body {
|
|
|
8
8
|
--silke-button-background: transparent;
|
|
9
9
|
--silke-button-background-hover: var(--color-accent-20);
|
|
10
10
|
--silke-button-background-pressed: (--color-accent-10);
|
|
11
|
-
--silke-button-background-disabled: var(--color-neutral-20);
|
|
12
11
|
|
|
13
12
|
--silke-button-color: var(--color-neutral-100);
|
|
14
13
|
--silke-button-color-hover: var(--color-neutral-100);
|
|
15
14
|
--silke-button-color-pressed: var(--color-neutral-100);
|
|
16
|
-
--silke-button-color-disabled: var(--color-neutral-50);
|
|
17
15
|
|
|
18
16
|
--silke-button-border: none;
|
|
19
17
|
--silke-button-border-hover: none;
|
|
20
18
|
--silke-button-border-pressed: none;
|
|
21
|
-
--silke-button-border-disabled: none;
|
|
22
19
|
}
|
|
23
20
|
|
|
24
21
|
.button.button {
|
|
@@ -49,9 +46,7 @@ body {
|
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
&:disabled {
|
|
52
|
-
|
|
53
|
-
color: var(--silke-button-color-disabled);
|
|
54
|
-
border: var(--silke-button-border-disabled);
|
|
49
|
+
opacity: 0.4;
|
|
55
50
|
}
|
|
56
51
|
|
|
57
52
|
img,
|
|
@@ -103,12 +98,14 @@ body {
|
|
|
103
98
|
}
|
|
104
99
|
|
|
105
100
|
&.secondary {
|
|
106
|
-
--silke-button-background:
|
|
107
|
-
--silke-button-background-hover:
|
|
108
|
-
--silke-button-background-pressed:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
);
|
|
101
|
+
--silke-button-background: var(--color-surface-1);
|
|
102
|
+
--silke-button-background-hover: var(--color-surface-2);
|
|
103
|
+
--silke-button-background-pressed: var(--color-surface-3);
|
|
104
|
+
--silke-button-color-hover: var(--color-neutral-100);
|
|
105
|
+
--silke-button-color-pressed: var(--color-neutral-100);
|
|
106
|
+
--silke-button-border: 1px solid var(--color-neutral-40);
|
|
107
|
+
--silke-button-border-hover: 1px solid var(--color-neutral-30);
|
|
108
|
+
--silke-button-border-pressed: 1px solid var(--color-neutral-30);
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
&.danger {
|
|
@@ -122,24 +119,18 @@ body {
|
|
|
122
119
|
--silke-button-color-hover: var(--color-neutral-100);
|
|
123
120
|
--silke-button-background-hover: var(--color-surface-2);
|
|
124
121
|
--silke-button-background-pressed: var(--color-surface-3);
|
|
125
|
-
|
|
126
|
-
--silke-button-color-disabled: var(--color-neutral-40);
|
|
127
|
-
--silke-button-background-disabled:transparent;
|
|
128
122
|
}
|
|
129
123
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
&.upgrade{
|
|
125
|
+
--silke-button-background: linear-gradient(24deg, var(--color-support-quaternary-30, 0.88) 0%, rgba(150,90,191,0.88) 100%);
|
|
126
|
+
--silke-button-color: var(--var-color-neutral-100);
|
|
133
127
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
--silke-button-color-disabled: var(--color-neutral-60);
|
|
128
|
+
--silke-button-background-hover: linear-gradient(24deg, var(--color-support-quaternary-30, 0.88) 0%, var(--color-support-quaternary-30, 01) 100%);
|
|
129
|
+
--silke-button-color: var(--var-color-neutral-90);
|
|
137
130
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
--silke-button-border-disabled: 1px solid var(--color-neutral-20);
|
|
142
|
-
}
|
|
131
|
+
--silke-button-background-pressed: var(--color-support-quaternary-20);
|
|
132
|
+
--silke-button-color-pressed: var(--var-color-neutral-100);
|
|
133
|
+
}
|
|
143
134
|
|
|
144
135
|
|
|
145
136
|
}
|
|
@@ -148,15 +139,15 @@ body {
|
|
|
148
139
|
// font-size: 14px;
|
|
149
140
|
// }
|
|
150
141
|
|
|
142
|
+
.leftIcon {
|
|
143
|
+
min-width: 16px;
|
|
144
|
+
}
|
|
145
|
+
|
|
151
146
|
@each $name, $size in $sizes {
|
|
152
147
|
.button.#{$name} {
|
|
153
148
|
height: $size;
|
|
154
149
|
min-height: $size;
|
|
155
|
-
|
|
156
|
-
&:not(.iconOnly) {
|
|
157
|
-
padding: 0 $space-s 0 $space-s;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
150
|
+
|
|
160
151
|
|
|
161
152
|
@if $name == "s" {
|
|
162
153
|
font-size: $font-small;
|
|
@@ -165,6 +156,12 @@ body {
|
|
|
165
156
|
@if $name == "xs" {
|
|
166
157
|
font-size: $font-micro;
|
|
167
158
|
}
|
|
159
|
+
|
|
160
|
+
@if $size == $size-s {
|
|
161
|
+
&:not(.iconOnly) {
|
|
162
|
+
padding: 0 $space-s 0 $space-s;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
168
165
|
&.iconOnly {
|
|
169
166
|
width: $size;
|
|
170
167
|
min-width: $size;
|
|
@@ -7,7 +7,7 @@ import { useButtonContext } from './context';
|
|
|
7
7
|
import styles from './silke-button.scss';
|
|
8
8
|
|
|
9
9
|
const cl = classnames.bind(styles);
|
|
10
|
-
export type SilkeButtonKind = 'primary' | 'secondary' | 'danger' | '
|
|
10
|
+
export type SilkeButtonKind = 'primary' | 'secondary' | 'danger' | 'ghost' | 'upgrade';
|
|
11
11
|
export type SilkeButtonSize = BoxSize;
|
|
12
12
|
|
|
13
13
|
export type SilkeButtonProps = {
|
|
@@ -94,7 +94,7 @@ export const SilkeButton = React.forwardRef(
|
|
|
94
94
|
/>
|
|
95
95
|
)}
|
|
96
96
|
{leftIcon && (
|
|
97
|
-
<span>
|
|
97
|
+
<span className={styles.leftIcon}>
|
|
98
98
|
<SilkeIcon icon={leftIcon} />
|
|
99
99
|
</span>
|
|
100
100
|
)}
|
|
@@ -7,6 +7,7 @@ import styles from '../silke-overflow-menu/silke-overflow-menu.scss';
|
|
|
7
7
|
import { ButtonContext } from './index';
|
|
8
8
|
import { SilkeBox } from '../silke-box';
|
|
9
9
|
import { SilkeOverflowMenuItem } from '../silke-overflow-menu';
|
|
10
|
+
import { SilkeDivider } from '../silke-divider';
|
|
10
11
|
|
|
11
12
|
export type SilkeDropdownButtonProps = {
|
|
12
13
|
children?: React.ReactNode;
|
|
@@ -21,6 +22,7 @@ export type SilkeDropdownButtonProps = {
|
|
|
21
22
|
items?:
|
|
22
23
|
| (SilkeOverflowMenuItem | React.ReactElement | 'divider')[]
|
|
23
24
|
| (() => (SilkeOverflowMenuItem | React.ReactElement | 'divider')[]);
|
|
25
|
+
matchWidth?: boolean;
|
|
24
26
|
} & SilkeButtonProps &
|
|
25
27
|
Omit<SilkePopoverProps, 'anchor' | 'hide' | 'children' | 'kind'>;
|
|
26
28
|
|
|
@@ -38,6 +40,7 @@ export function SilkeDropdownButton({
|
|
|
38
40
|
onClick,
|
|
39
41
|
onMouseDown,
|
|
40
42
|
onToggleOpen,
|
|
43
|
+
matchWidth = false,
|
|
41
44
|
...rest
|
|
42
45
|
}: SilkeDropdownButtonProps) {
|
|
43
46
|
const [open, setOpen] = useState(false);
|
|
@@ -76,7 +79,7 @@ export function SilkeDropdownButton({
|
|
|
76
79
|
<SilkeButton
|
|
77
80
|
ref={ref}
|
|
78
81
|
label={label}
|
|
79
|
-
icon={isOpen ? 'chevron.up' : 'chevron.down'}
|
|
82
|
+
icon={icon || (isOpen ? 'chevron.up' : 'chevron.down')}
|
|
80
83
|
id={buttonId}
|
|
81
84
|
aria-expanded={isOpen}
|
|
82
85
|
aria-label="Menu"
|
|
@@ -94,8 +97,9 @@ export function SilkeDropdownButton({
|
|
|
94
97
|
/>
|
|
95
98
|
{isOpen && (
|
|
96
99
|
<SilkePopover
|
|
97
|
-
contextId="silke.overflow.menu"
|
|
98
100
|
anchor={ref}
|
|
101
|
+
matchAnchorWidth={matchWidth}
|
|
102
|
+
contextId="silke.overflow.menu"
|
|
99
103
|
offsetX={offsetX}
|
|
100
104
|
offsetY={offsetY}
|
|
101
105
|
targetOrigin={targetOrigin}
|
|
@@ -119,7 +123,7 @@ export function SilkeDropdownButton({
|
|
|
119
123
|
return React.isValidElement(item) ? (
|
|
120
124
|
item
|
|
121
125
|
) : item === 'divider' ? (
|
|
122
|
-
<
|
|
126
|
+
<SilkeDivider key={index} dark />
|
|
123
127
|
) : (
|
|
124
128
|
<SilkeOverflowMenuItem
|
|
125
129
|
key={index}
|