@vev/silke 1.0.17 → 1.0.19
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 +15 -0
- package/dist/{chunk-SOFGXMET.js → chunk-FIPWO3IB.js} +3 -3
- package/dist/{chunk-SOFGXMET.js.map → chunk-FIPWO3IB.js.map} +1 -1
- package/dist/index.js +21 -22
- package/dist/index.js.LEGAL.txt +7 -7
- package/dist/index.js.map +4 -4
- package/dist/silke/src/components/index.d.ts +54 -0
- package/dist/silke/src/components/silke-autocomplete-field/autocomplete-item.d.ts +19 -0
- package/dist/silke/src/components/silke-autocomplete-field/autocomplete-tags.d.ts +9 -0
- package/dist/silke/src/components/silke-autocomplete-field/autocomplete-types.d.ts +55 -0
- package/dist/silke/src/components/silke-autocomplete-field/index.d.ts +5 -0
- package/dist/silke/src/components/silke-autocomplete-field/silke-autocomplete-field.d.ts +50 -0
- package/dist/silke/src/components/silke-box/index.d.ts +1 -0
- package/dist/silke/src/components/silke-box/silke-box.d.ts +121 -0
- package/dist/silke/src/components/silke-breadcrumbs/index.d.ts +2 -0
- package/dist/silke/src/components/silke-breadcrumbs/silke-breadcrumb.d.ts +10 -0
- package/dist/silke/src/components/silke-breadcrumbs/silke-breadcrumbs.d.ts +7 -0
- package/dist/silke/src/components/silke-button/context.d.ts +14 -0
- package/dist/silke/src/components/silke-button/index.d.ts +7 -0
- package/dist/silke/src/components/silke-button/silke-big-button.d.ts +13 -0
- package/dist/silke/src/components/silke-button/silke-button-set.d.ts +11 -0
- package/dist/silke/src/components/silke-button/silke-button.d.ts +39 -0
- package/dist/silke/src/components/silke-button/silke-confirmation-button.d.ts +8 -0
- package/dist/silke/src/components/silke-button/silke-file-select-button.d.ts +9 -0
- package/dist/silke/src/components/silke-card/index.d.ts +2 -0
- package/dist/silke/src/components/silke-card/silke-card-grid.d.ts +10 -0
- package/dist/silke/src/components/silke-card/silke-card.d.ts +24 -0
- package/dist/silke/src/components/silke-checkbox/index.d.ts +1 -0
- package/dist/silke/src/components/silke-checkbox/silke-checkbox.d.ts +11 -0
- package/dist/silke/src/components/silke-code-editor/index.d.ts +3 -0
- package/dist/silke/src/components/silke-code-editor/silke-code-editor.d.ts +8 -0
- package/dist/silke/src/components/silke-code-snippet/index.d.ts +1 -0
- package/dist/silke/src/components/silke-code-snippet/silke-code-snippet.d.ts +17 -0
- package/dist/silke/src/components/silke-color-palettes/index.d.ts +2 -0
- package/dist/silke/src/components/silke-color-palettes/silke-color-palette.d.ts +12 -0
- package/dist/silke/src/components/silke-color-palettes/silke-color-palettes.d.ts +8 -0
- package/dist/silke/src/components/silke-color-picker/color.d.ts +31 -0
- package/dist/silke/src/components/silke-color-picker/hue.d.ts +7 -0
- package/dist/silke/src/components/silke-color-picker/index.d.ts +4 -0
- package/dist/silke/src/components/silke-color-picker/silke-color-info.d.ts +9 -0
- package/dist/silke/src/components/silke-color-picker/silke-color-picker-button.d.ts +11 -0
- package/dist/silke/src/components/silke-color-picker/silke-color-picker.d.ts +17 -0
- package/dist/silke/src/components/silke-color-picker/silke-color-space.d.ts +11 -0
- package/dist/silke/src/components/silke-color-picker/silke-hue-slider.d.ts +7 -0
- package/dist/silke/src/components/silke-color-picker/silke-opacity-slider.d.ts +8 -0
- package/dist/silke/src/components/silke-color-swatches/index.d.ts +2 -0
- package/dist/silke/src/components/silke-color-swatches/silke-color-swatch-button.d.ts +6 -0
- package/dist/silke/src/components/silke-color-swatches/silke-swatches.d.ts +25 -0
- package/dist/silke/src/components/silke-color-swatches/utils.d.ts +12 -0
- package/dist/silke/src/components/silke-content-column/index.d.ts +1 -0
- package/dist/silke/src/components/silke-content-column/silke-content-column.d.ts +7 -0
- package/dist/silke/src/components/silke-context-menu/index.d.ts +2 -0
- package/dist/silke/src/components/silke-context-menu/silke-contect-menu-hooks.d.ts +0 -0
- package/dist/silke/src/components/silke-context-menu/silke-context-menu-item.d.ts +12 -0
- package/dist/silke/src/components/silke-context-menu/silke-context-menu.d.ts +15 -0
- package/dist/silke/src/components/silke-css-number-field/index.d.ts +2 -0
- package/dist/silke/src/components/silke-css-number-field/silke-css-context.d.ts +29 -0
- package/dist/silke/src/components/silke-css-number-field/silke-css-number-field.d.ts +15 -0
- package/dist/silke/src/components/silke-css-number-field/utils.d.ts +32 -0
- package/dist/silke/src/components/silke-divider/index.d.ts +1 -0
- package/dist/silke/src/components/silke-divider/silke-divider.d.ts +13 -0
- package/dist/silke/src/components/silke-drawer/index.d.ts +1 -0
- package/dist/silke/src/components/silke-drawer/silke-drawer.d.ts +12 -0
- package/dist/silke/src/components/silke-form/form-context.d.ts +26 -0
- package/dist/silke/src/components/silke-form/form-types.d.ts +44 -0
- package/dist/silke/src/components/silke-form/index.d.ts +2 -0
- package/dist/silke/src/components/silke-form/silke-form.d.ts +22 -0
- package/dist/silke/src/components/silke-form-schema/fields/array-field-inline.d.ts +12 -0
- package/dist/silke/src/components/silke-form-schema/fields/array-field-modal.d.ts +13 -0
- package/dist/silke/src/components/silke-form-schema/fields/array-field.d.ts +4 -0
- package/dist/silke/src/components/silke-form-schema/fields/event-field.d.ts +4 -0
- package/dist/silke/src/components/silke-form-schema/fields/icon-field.d.ts +4 -0
- package/dist/silke/src/components/silke-form-schema/fields/image-field.d.ts +4 -0
- package/dist/silke/src/components/silke-form-schema/fields/layout-field.d.ts +3 -0
- package/dist/silke/src/components/silke-form-schema/fields/link-field.d.ts +4 -0
- package/dist/silke/src/components/silke-form-schema/fields/number-field.d.ts +4 -0
- package/dist/silke/src/components/silke-form-schema/fields/object-field.d.ts +3 -0
- package/dist/silke/src/components/silke-form-schema/fields/select-field.d.ts +4 -0
- package/dist/silke/src/components/silke-form-schema/fields/string-field.d.ts +4 -0
- package/dist/silke/src/components/silke-form-schema/fields/toggle-field.d.ts +4 -0
- package/dist/silke/src/components/silke-form-schema/fields/upload-field.d.ts +4 -0
- package/dist/silke/src/components/silke-form-schema/fields/utils/generate-image.d.ts +3 -0
- package/dist/silke/src/components/silke-form-schema/fields/utils/generate-title.d.ts +7 -0
- package/dist/silke/src/components/silke-form-schema/fields/utils/index.d.ts +2 -0
- package/dist/silke/src/components/silke-form-schema/fields/utils/schema-util.d.ts +2 -0
- package/dist/silke/src/components/silke-form-schema/index.d.ts +4 -0
- package/dist/silke/src/components/silke-form-schema/safe-eval/iframe-handler.d.ts +17 -0
- package/dist/silke/src/components/silke-form-schema/safe-eval/index.d.ts +1 -0
- package/dist/silke/src/components/silke-form-schema/safe-eval/safe-eval.d.ts +1 -0
- package/dist/silke/src/components/silke-form-schema/schema-utils.d.ts +11 -0
- package/dist/silke/src/components/silke-form-schema/silke-extended-fields-context.d.ts +13 -0
- package/dist/silke/src/components/silke-form-schema/silke-form-schema.d.ts +13 -0
- package/dist/silke/src/components/silke-form-schema/silke-schema-context.d.ts +9 -0
- package/dist/silke/src/components/silke-form-schema/silke-schema-field.d.ts +10 -0
- package/dist/silke/src/components/silke-form-schema/silke-schema-fields.d.ts +14 -0
- package/dist/silke/src/components/silke-gradient-picker/index.d.ts +1 -0
- package/dist/silke/src/components/silke-gradient-picker/silke-gradient-picker.d.ts +5 -0
- package/dist/silke/src/components/silke-gradient-picker/silke-gradient-position.d.ts +8 -0
- package/dist/silke/src/components/silke-gradient-picker/silke-gradient-slider.d.ts +10 -0
- package/dist/silke/src/components/silke-gradient-picker/silke-gradient-utils.d.ts +14 -0
- package/dist/silke/src/components/silke-icon/index.d.ts +2 -0
- package/dist/silke/src/components/silke-icon/silke-icon.d.ts +11 -0
- package/dist/silke/src/components/silke-icon/silke-shape.d.ts +8 -0
- package/dist/silke/src/components/silke-icon/silke-stacked-icon.d.ts +8 -0
- package/dist/silke/src/components/silke-icon-picker/emoji-tab.d.ts +3 -0
- package/dist/silke/src/components/silke-icon-picker/icons-tab.d.ts +3 -0
- package/dist/silke/src/components/silke-icon-picker/index.d.ts +1 -0
- package/dist/silke/src/components/silke-icon-picker/silke-icon-picker.d.ts +12 -0
- package/dist/silke/src/components/silke-icon-picker/upload-tab.d.ts +3 -0
- package/dist/silke/src/components/silke-icon-picker/utils.d.ts +5 -0
- package/dist/silke/src/components/silke-iframe-portal/index.d.ts +4 -0
- package/dist/silke/src/components/silke-iframe-portal/silke-iframe-context.d.ts +7 -0
- package/dist/silke/src/components/silke-iframe-portal/silke-iframe-css-link.d.ts +5 -0
- package/dist/silke/src/components/silke-iframe-portal/silke-iframe-portal.d.ts +10 -0
- package/dist/silke/src/components/silke-iframe-portal/silke-iframe-script.d.ts +6 -0
- package/dist/silke/src/components/silke-image/index.d.ts +2 -0
- package/dist/silke/src/components/silke-image/silke-image-color-backdrop.d.ts +7 -0
- package/dist/silke/src/components/silke-image/silke-image.d.ts +11 -0
- package/dist/silke/src/components/silke-link/index.d.ts +1 -0
- package/dist/silke/src/components/silke-link/silke-link.d.ts +23 -0
- package/dist/silke/src/components/silke-list/index.d.ts +2 -0
- package/dist/silke/src/components/silke-list/silke-list-item.d.ts +7 -0
- package/dist/silke/src/components/silke-list/silke-list.d.ts +10 -0
- package/dist/silke/src/components/silke-list-card/index.d.ts +1 -0
- package/dist/silke/src/components/silke-list-card/silke-list-card.d.ts +14 -0
- package/dist/silke/src/components/silke-loader/index.d.ts +2 -0
- package/dist/silke/src/components/silke-loader/silke-loader-overlay.d.ts +18 -0
- package/dist/silke/src/components/silke-loader/silke-loader.d.ts +18 -0
- package/dist/silke/src/components/silke-modal/index.d.ts +2 -0
- package/dist/silke/src/components/silke-modal/silke-confirmation-modal.d.ts +31 -0
- package/dist/silke/src/components/silke-modal/silke-modal.d.ts +18 -0
- package/dist/silke/src/components/silke-navigation-link/index.d.ts +1 -0
- package/dist/silke/src/components/silke-navigation-link/silke-navigation-link.d.ts +22 -0
- package/dist/silke/src/components/silke-notification/confetti.d.ts +2 -0
- package/dist/silke/src/components/silke-notification/index.d.ts +1 -0
- package/dist/silke/src/components/silke-notification/silke-notification.d.ts +22 -0
- package/dist/silke/src/components/silke-object-field/index.d.ts +1 -0
- package/dist/silke/src/components/silke-object-field/silke-object-field.d.ts +17 -0
- package/dist/silke/src/components/silke-overflow-menu/index.d.ts +1 -0
- package/dist/silke/src/components/silke-overflow-menu/silke-overflow-menu.d.ts +21 -0
- package/dist/silke/src/components/silke-popover/index.d.ts +1 -0
- package/dist/silke/src/components/silke-popover/popover-context.d.ts +8 -0
- package/dist/silke/src/components/silke-popover/silke-popover.d.ts +48 -0
- package/dist/silke/src/components/silke-progress-indicator/index.d.ts +2 -0
- package/dist/silke/src/components/silke-progress-indicator/silke-progress-indicator.d.ts +7 -0
- package/dist/silke/src/components/silke-progress-indicator/silke-progress-step.d.ts +11 -0
- package/dist/silke/src/components/silke-radio-button/index.d.ts +2 -0
- package/dist/silke/src/components/silke-radio-button/silke-radio-button-group.d.ts +15 -0
- package/dist/silke/src/components/silke-radio-button/silke-radio-button.d.ts +10 -0
- package/dist/silke/src/components/silke-search-field/index.d.ts +1 -0
- package/dist/silke/src/components/silke-search-field/silke-search-field.d.ts +8 -0
- package/dist/silke/src/components/silke-select-field/index.d.ts +1 -0
- package/dist/silke/src/components/silke-select-field/silke-select-field.d.ts +5 -0
- package/dist/silke/src/components/silke-skeleton/index.d.ts +1 -0
- package/dist/silke/src/components/silke-skeleton/silke-skeleton.d.ts +8 -0
- package/dist/silke/src/components/silke-slider/index.d.ts +1 -0
- package/dist/silke/src/components/silke-slider/silke-slider-point.d.ts +14 -0
- package/dist/silke/src/components/silke-slider/silke-slider-utils.d.ts +2 -0
- package/dist/silke/src/components/silke-slider/silke-slider.d.ts +20 -0
- package/dist/silke/src/components/silke-slider/slider-track.d.ts +9 -0
- package/dist/silke/src/components/silke-sortable-list/index.d.ts +2 -0
- package/dist/silke/src/components/silke-sortable-list/silke-nested-sortable-item.d.ts +16 -0
- package/dist/silke/src/components/silke-sortable-list/silke-nested-sortable-list.d.ts +25 -0
- package/dist/silke/src/components/silke-sortable-list/silke-nested-sortable-utils.d.ts +57 -0
- package/dist/silke/src/components/silke-sortable-list/silke-sortable-item-wrapper.d.ts +12 -0
- package/dist/silke/src/components/silke-sortable-list/silke-sortable-list.d.ts +15 -0
- package/dist/silke/src/components/silke-steps/index.d.ts +1 -0
- package/dist/silke/src/components/silke-steps/silke-steps.d.ts +12 -0
- package/dist/silke/src/components/silke-table/index.d.ts +2 -0
- package/dist/silke/src/components/silke-table/silke-table.d.ts +27 -0
- package/dist/silke/src/components/silke-table/table-row.d.ts +13 -0
- package/dist/silke/src/components/silke-table/table-types.d.ts +13 -0
- package/dist/silke/src/components/silke-tabs/index.d.ts +2 -0
- package/dist/silke/src/components/silke-tabs/silke-tab.d.ts +12 -0
- package/dist/silke/src/components/silke-tabs/silke-tabs.d.ts +10 -0
- package/dist/silke/src/components/silke-tag/index.d.ts +1 -0
- package/dist/silke/src/components/silke-tag/silke-tag.d.ts +40 -0
- package/dist/silke/src/components/silke-text/index.d.ts +3 -0
- package/dist/silke/src/components/silke-text/silke-text-types.d.ts +28 -0
- package/dist/silke/src/components/silke-text/silke-text.d.ts +275 -0
- package/dist/silke/src/components/silke-text/silke-title.d.ts +3 -0
- package/dist/silke/src/components/silke-text-field/index.d.ts +3 -0
- package/dist/silke/src/components/silke-text-field/silke-text-field-item.d.ts +8 -0
- package/dist/silke/src/components/silke-text-field/silke-text-field-outline.d.ts +39 -0
- package/dist/silke/src/components/silke-text-field/silke-text-field.d.ts +27 -0
- package/dist/silke/src/components/silke-text-field/text-field-context.d.ts +9 -0
- package/dist/silke/src/components/silke-theme-editor/index.d.ts +1 -0
- package/dist/silke/src/components/silke-theme-editor/silke-theme-editor.d.ts +9 -0
- package/dist/silke/src/components/silke-tile/index.d.ts +2 -0
- package/dist/silke/src/components/silke-tile/silke-tile-select.d.ts +26 -0
- package/dist/silke/src/components/silke-tile/silke-tile.d.ts +38 -0
- package/dist/silke/src/components/silke-toggle/index.d.ts +1 -0
- package/dist/silke/src/components/silke-toggle/silke-toggle.d.ts +12 -0
- package/dist/silke/src/components/silke-toolbar/index.d.ts +1 -0
- package/dist/silke/src/components/silke-toolbar/silke-toolbar.d.ts +7 -0
- package/dist/silke/src/components/silke-tooltip/index.d.ts +5 -0
- package/dist/silke/src/components/silke-tooltip/silke-definition-tooltip.d.ts +16 -0
- package/dist/silke/src/components/silke-tooltip/silke-icon-tooltip.d.ts +17 -0
- package/dist/silke/src/components/silke-tooltip/silke-interactive-tooltip.d.ts +24 -0
- package/dist/silke/src/components/silke-tooltip/silke-shortcuts.d.ts +37 -0
- package/dist/silke/src/components/silke-tooltip/silke-tooltip.d.ts +25 -0
- package/dist/silke/src/components/silke-tooltip/utils.d.ts +1 -0
- package/dist/silke/src/components/silke-upload-field/index.d.ts +1 -0
- package/dist/silke/src/components/silke-upload-field/silke-upload-field.d.ts +32 -0
- package/dist/silke/src/components/silke-virtual/index.d.ts +2 -0
- package/dist/silke/src/components/silke-virtual/silke-virtual-grid.d.ts +9 -0
- package/dist/silke/src/components/silke-virtual/silke-virtual-row.d.ts +10 -0
- package/dist/silke/src/docs/app.d.ts +4 -0
- package/dist/silke/src/docs/components/code-block/code-block.d.ts +6 -0
- package/dist/silke/src/docs/components/code-block/index.d.ts +1 -0
- package/dist/silke/src/docs/components/state-table/index.d.ts +1 -0
- package/dist/silke/src/docs/components/state-table/state-table.d.ts +14 -0
- package/dist/silke/src/docs/data/app/actions.d.ts +1 -0
- package/dist/silke/src/docs/data/app/constants.d.ts +6 -0
- package/dist/silke/src/docs/data/app/index.d.ts +3 -0
- package/dist/silke/src/docs/data/app/store.d.ts +8 -0
- package/dist/silke/src/docs/data/flux/action-decorator.d.ts +5 -0
- package/dist/silke/src/docs/data/flux/action-utils.d.ts +7 -0
- package/dist/silke/src/docs/data/flux/controller.d.ts +24 -0
- package/dist/silke/src/docs/data/flux/dispatcher.d.ts +7 -0
- package/dist/silke/src/docs/data/flux/index.d.ts +6 -0
- package/dist/silke/src/docs/data/flux/store.d.ts +15 -0
- package/dist/silke/src/docs/data/flux/use-store.d.ts +2 -0
- package/dist/silke/src/docs/docs-provider.d.ts +6 -0
- package/dist/silke/src/docs/index.d.ts +2 -0
- package/dist/silke/src/docs/ipsum-generator.d.ts +7 -0
- package/dist/silke/src/helpers/copy-to-clipboard.d.ts +5 -0
- package/dist/silke/src/helpers/key-code.d.ts +9 -0
- package/dist/silke/src/hooks/drag-and-drop/index.d.ts +2 -0
- package/dist/silke/src/hooks/drag-and-drop/use-drag.d.ts +10 -0
- package/dist/silke/src/hooks/drag-and-drop/use-drop.d.ts +8 -0
- package/dist/silke/src/hooks/form/index.d.ts +1 -0
- package/dist/silke/src/hooks/form/use-form-field.d.ts +5 -0
- package/dist/silke/src/hooks/image-colors/use-image-colors.d.ts +10 -0
- package/dist/silke/src/hooks/index.d.ts +13 -0
- package/dist/silke/src/hooks/use-callback-ref.d.ts +2 -0
- package/dist/silke/src/hooks/use-dragging.d.ts +1 -0
- package/dist/silke/src/hooks/use-drop-zone.d.ts +2 -0
- package/dist/silke/src/hooks/use-html-element.d.ts +2 -0
- package/dist/silke/src/hooks/use-interval.d.ts +6 -0
- package/dist/silke/src/hooks/use-mouse.d.ts +40 -0
- package/dist/silke/src/hooks/use-parent-scroll.d.ts +2 -0
- package/dist/silke/src/hooks/use-scroll.d.ts +1 -0
- package/dist/silke/src/hooks/use-size.d.ts +4 -0
- package/dist/silke/src/hooks/use-uniq-id.d.ts +1 -0
- package/dist/silke/src/hooks/use-window-resize.d.ts +1 -0
- package/dist/silke/src/icons.d.ts +353 -0
- package/dist/silke/src/index.d.ts +5 -0
- package/dist/silke/src/main.d.ts +1 -0
- package/dist/silke/src/silke-theme-provider.d.ts +16 -0
- package/dist/silke-code-editor-HB2Z4Q5W.js +25 -0
- package/dist/silke-code-editor-HB2Z4Q5W.js.map +7 -0
- package/dist/styles.css +682 -675
- package/dist/utils/src/color/hex.d.ts +2 -0
- package/dist/utils/src/color/index.d.ts +1 -0
- package/dist/utils/src/constants.d.ts +2 -0
- package/dist/utils/src/css/computed-to-css.d.ts +8 -0
- package/dist/utils/src/css/computed.d.ts +5 -0
- package/dist/utils/src/css/index.d.ts +4 -0
- package/dist/utils/src/css/number-format.d.ts +1 -0
- package/dist/utils/src/css/utils.d.ts +14 -0
- package/dist/utils/src/events/condition-parser/evaluate-condition-expression.d.ts +2 -0
- package/dist/utils/src/events/condition-parser/index.d.ts +1 -0
- package/dist/utils/src/events/condition-parser/lexer.d.ts +36 -0
- package/dist/utils/src/events/condition-parser/parser.d.ts +11 -0
- package/dist/utils/src/index.d.ts +10 -0
- package/dist/utils/src/interactions/get-node-type.d.ts +2 -0
- package/dist/utils/src/interactions/has-link.d.ts +5 -0
- package/dist/utils/src/interactions/has-pointer-event.d.ts +5 -0
- package/dist/utils/src/interactions/index.d.ts +5 -0
- package/dist/utils/src/interactions/is-target-global.d.ts +2 -0
- package/dist/utils/src/interactions/is-trigger-global.d.ts +2 -0
- package/dist/utils/src/keyboard/hooks.d.ts +8 -0
- package/dist/utils/src/keyboard/index.d.ts +4 -0
- package/dist/utils/src/keyboard/key-list.d.ts +4 -0
- package/dist/utils/src/keyboard/keyboard.d.ts +70 -0
- package/dist/utils/src/keyboard/keys.d.ts +4 -0
- package/dist/utils/src/math/index.d.ts +9 -0
- package/dist/utils/src/mouse/index.d.ts +3 -0
- package/dist/utils/src/mouse/mouse-manager.d.ts +52 -0
- package/dist/utils/src/types/content.d.ts +11 -0
- package/dist/utils/src/types/context.d.ts +74 -0
- package/dist/utils/src/types/css.d.ts +131 -0
- package/dist/utils/src/types/editable-css.d.ts +7 -0
- package/dist/utils/src/types/emoji.d.ts +28 -0
- package/dist/utils/src/types/event.d.ts +7 -0
- package/dist/utils/src/types/icon.d.ts +10 -0
- package/dist/utils/src/types/index.d.ts +17 -0
- package/dist/utils/src/types/interaction.d.ts +77 -0
- package/dist/utils/src/types/link.d.ts +47 -0
- package/dist/utils/src/types/manifest.d.ts +54 -0
- package/dist/utils/src/types/project.d.ts +23 -0
- package/dist/utils/src/types/shape.d.ts +20 -0
- package/dist/utils/src/types/transition.d.ts +15 -0
- package/dist/utils/src/types/vev-plugin.d.ts +30 -0
- package/dist/utils/src/types/vev-props.d.ts +154 -0
- package/dist/utils/src/types/widget-manifest.d.ts +69 -0
- package/dist/utils/src/types/widget.d.ts +36 -0
- package/dist/utils/src/utils/generate-guid.d.ts +1 -0
- package/dist/utils/src/utils/index.d.ts +7 -0
- package/dist/utils/src/utils/internals/asciiToArray.d.ts +9 -0
- package/dist/utils/src/utils/internals/castSlice.d.ts +11 -0
- package/dist/utils/src/utils/internals/createCaseFirst.d.ts +9 -0
- package/dist/utils/src/utils/internals/getTag.d.ts +9 -0
- package/dist/utils/src/utils/internals/hasUnicode.d.ts +9 -0
- package/dist/utils/src/utils/internals/stringToArray.d.ts +9 -0
- package/dist/utils/src/utils/internals/unicodeToArray.d.ts +9 -0
- package/dist/utils/src/utils/internals/unicodeWords.d.ts +9 -0
- package/dist/utils/src/utils/internals/upperFirst.d.ts +18 -0
- package/dist/utils/src/utils/is-array.d.ts +25 -0
- package/dist/utils/src/utils/is-length.d.ts +26 -0
- package/dist/utils/src/utils/is-string.d.ts +17 -0
- package/dist/utils/src/utils/slice.d.ts +22 -0
- package/dist/utils/src/utils/start-case.d.ts +22 -0
- package/dist/utils/src/utils/string.d.ts +5 -0
- package/dist/utils/src/utils/words.d.ts +18 -0
- package/package.json +10 -10
- package/src/components/index.ts +1 -0
- package/src/components/silke-autocomplete-field/autocomplete-tags.tsx +3 -3
- package/src/components/silke-autocomplete-field/index.ts +4 -0
- package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +5 -2
- package/src/components/silke-box/silke-box.mdx +2 -1
- package/src/components/silke-breadcrumbs/silke-breadcrumb.mdx +5 -1
- package/src/components/silke-card/silke-card-grid.tsx +18 -15
- package/src/components/silke-card/silke-card.mdx +56 -23
- package/src/components/silke-card/silke-card.scss +150 -115
- package/src/components/silke-card/silke-card.tsx +173 -112
- package/src/components/silke-checkbox/silke-checkbox.mdx +11 -2
- package/src/components/silke-color-palettes/silke-color-palette.mdx +2 -2
- package/src/components/silke-color-picker/color-picker.scss +29 -24
- package/src/components/silke-color-picker/color.ts +12 -0
- package/src/components/silke-color-picker/hue.ts +72 -0
- package/src/components/silke-color-picker/index.ts +2 -0
- package/src/components/silke-color-picker/silke-color-picker.mdx +37 -9
- package/src/components/silke-color-picker/silke-color-picker.tsx +9 -18
- package/src/components/silke-color-picker/silke-color-space.tsx +0 -2
- package/src/components/silke-color-picker/silke-hue-slider.tsx +23 -8
- package/src/components/silke-color-picker/silke-opacity-slider.tsx +10 -12
- package/src/components/silke-content-column/silke-content-column.scss +2 -37
- package/src/components/silke-context-menu/silke-context-menu-item.tsx +5 -1
- package/src/components/silke-context-menu/silke-context-menu.scss +5 -1
- package/src/components/silke-context-menu/silke-context-menu.tsx +5 -3
- package/src/components/silke-drawer/silke-drawer.mdx +13 -13
- package/src/components/silke-form/form-context.tsx +5 -5
- package/src/components/silke-form/form-types.ts +1 -0
- package/src/components/silke-form/silke-form.mdx +15 -3
- package/src/components/silke-form/silke-form.tsx +1 -1
- package/src/components/silke-form-schema/fields/array-field.tsx +3 -3
- package/src/components/silke-form-schema/fields/event-field.tsx +1 -1
- package/src/components/silke-form-schema/fields/number-field.tsx +40 -27
- package/src/components/silke-form-schema/fields/select-field.tsx +3 -8
- package/src/components/silke-form-schema/fields/string-field.tsx +29 -15
- package/src/components/silke-form-schema/fields/styles.scss +3 -1
- package/src/components/silke-form-schema/fields/toggle-field.tsx +2 -3
- package/src/components/silke-form-schema/fields/upload-field.tsx +2 -4
- package/src/components/silke-form-schema/fields/utils/generate-title.ts +11 -4
- package/src/components/silke-form-schema/silke-form-schema.tsx +7 -2
- package/src/components/silke-form-schema/silke-schema-context.tsx +5 -2
- package/src/components/silke-form-schema/silke-schema-field.tsx +41 -44
- package/src/components/silke-form-schema/silke-schema-fields.tsx +40 -15
- package/src/components/silke-gradient-picker/index.ts +1 -0
- package/src/components/silke-gradient-picker/silke-gradient-picker.mdx +13 -0
- package/src/components/silke-gradient-picker/silke-gradient-picker.module.scss +71 -0
- package/src/components/silke-gradient-picker/silke-gradient-picker.tsx +71 -0
- package/src/components/silke-gradient-picker/silke-gradient-position.tsx +160 -0
- package/src/components/silke-gradient-picker/silke-gradient-slider.tsx +57 -0
- package/src/components/silke-gradient-picker/silke-gradient-utils.ts +132 -0
- package/src/components/silke-icon/silke-icon.tsx +3 -1
- package/src/components/silke-image/index.ts +1 -0
- package/src/components/silke-image/silke-image-color-backdrop.scss +10 -0
- package/src/components/silke-image/silke-image-color-backdrop.tsx +32 -0
- package/src/components/silke-image/silke-image.tsx +6 -2
- package/src/components/silke-loader/silke-loader.mdx +3 -4
- package/src/components/silke-modal/silke-confirmation-modal.tsx +33 -11
- package/src/components/silke-modal/silke-modal.mdx +24 -0
- package/src/components/silke-navigation-link/silke-navigation-link.mdx +6 -1
- package/src/components/silke-navigation-link/silke-navigation-link.tsx +83 -76
- package/src/components/silke-object-field/silke-object-field.mdx +10 -3
- package/src/components/silke-object-field/silke-object-field.tsx +1 -1
- package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +1 -0
- package/src/components/silke-progress-indicator/silke-progress-indicator.mdx +9 -3
- package/src/components/silke-radio-button/silke-radio-button-group.tsx +6 -23
- package/src/components/silke-radio-button/silke-radio-button.mdx +7 -1
- package/src/components/silke-search-field/silke-search-field.mdx +12 -4
- package/src/components/silke-slider/index.ts +0 -1
- package/src/components/silke-slider/silke-slider-point.tsx +43 -0
- package/src/components/silke-slider/silke-slider-utils.ts +32 -0
- package/src/components/silke-slider/silke-slider.mdx +45 -0
- package/src/components/silke-slider/silke-slider.module.scss +71 -0
- package/src/components/silke-slider/silke-slider.tsx +160 -66
- package/src/components/silke-slider/slider-track.tsx +26 -0
- package/src/components/silke-sortable-list/silke-sortable-item-wrapper.tsx +3 -0
- package/src/components/silke-sortable-list/silke-sortable-list.scss +8 -8
- package/src/components/silke-sortable-list/silke-sortable-list.tsx +24 -7
- package/src/components/silke-table/silke-table.tsx +5 -5
- package/src/components/silke-tabs/silke-tabs.mdx +2 -2
- package/src/components/silke-tag/silke-tag.mdx +51 -13
- package/src/components/silke-tag/silke-tag.scss +111 -80
- package/src/components/silke-tag/silke-tag.tsx +52 -24
- package/src/components/silke-text/silke-text-types.ts +5 -6
- package/src/components/silke-text/silke-text.mdx +45 -11
- package/src/components/silke-text/silke-text.scss +40 -19
- package/src/components/silke-text/silke-text.tsx +10 -16
- package/src/components/silke-text/silke-title.scss +36 -57
- package/src/components/silke-text/silke-title.tsx +27 -17
- package/src/components/silke-text-field/silke-text-field.scss +0 -1
- package/src/components/silke-text-field/silke-text-field.tsx +6 -3
- package/src/components/silke-tile/silke-tile.mdx +39 -8
- package/src/components/silke-toggle/silke-toggle.mdx +29 -5
- package/src/components/silke-toolbar/silke-toolbar.mdx +35 -15
- package/src/components/silke-tooltip/silke-tooltip.tsx +3 -0
- package/src/components/silke-upload-field/silke-upload-field.tsx +16 -9
- package/src/docs/data/flux/action-decorator.ts +4 -4
- package/src/docs/data/flux/store.ts +4 -2
- package/src/docs/parser.ts +1 -1
- package/src/hooks/drag-and-drop/use-drag.tsx +5 -3
- package/src/hooks/form/use-form-field.ts +4 -0
- package/src/hooks/hooks.mdx +3 -3
- package/src/hooks/image-colors/use-image-colors.ts +83 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-dragging.ts +24 -0
- package/src/icons.tsx +5 -16
- package/src/styles/core.scss +0 -48
- package/tsconfig.json +1 -0
- package/dist/silke-code-editor-3Y2KM5KB.js +0 -25
- package/dist/silke-code-editor-3Y2KM5KB.js.map +0 -7
- package/src/components/silke-slider/range-slider.scss +0 -52
- package/src/components/silke-slider/silke-range-slider.tsx +0 -108
- package/src/components/silke-text/silke-text-utils.ts +0 -8
- /package/dist/{chunk-SOFGXMET.js.LEGAL.txt → chunk-FIPWO3IB.js.LEGAL.txt} +0 -0
- /package/dist/{silke-code-editor-3Y2KM5KB.js.LEGAL.txt → silke-code-editor-HB2Z4Q5W.js.LEGAL.txt} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
@use '../../variables' as *;
|
|
2
|
-
|
|
3
1
|
|
|
2
|
+
:root {
|
|
3
|
+
--transparent-bg: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAIElEQVQ4y2P4TwDcv38fL2YYNWBYGEBIASEwasCwMAAAv7rMLvozJBUAAAAASUVORK5CYII=");
|
|
4
|
+
}
|
|
4
5
|
.root {
|
|
5
6
|
max-width: 320px;
|
|
6
7
|
}
|
|
@@ -34,10 +35,7 @@
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
.opacitySlider,
|
|
38
|
-
.thumb,
|
|
39
38
|
.transparent {
|
|
40
|
-
--transparent-bg: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAIElEQVQ4y2P4TwDcv38fL2YYNWBYGEBIASEwasCwMAAAv7rMLvozJBUAAAAASUVORK5CYII=");
|
|
41
39
|
background-image: var(--transparent-bg);
|
|
42
40
|
background-position: 50% 50%;
|
|
43
41
|
}
|
|
@@ -47,33 +45,24 @@
|
|
|
47
45
|
transition: width 0.2s, height 0.2s, box-shadow 0.2s;
|
|
48
46
|
position: absolute;
|
|
49
47
|
background: transparent;
|
|
50
|
-
border: 1px solid
|
|
51
|
-
|
|
48
|
+
border: 1px solid
|
|
49
|
+
rgba(var(--color-neutral-0-rgb), var(--opacity-level-semiopaque));
|
|
50
|
+
box-shadow: 0 0 0 1px
|
|
51
|
+
rgba(var(--color-neutral-100-rgb), var(--opacity-level-semiopaque));
|
|
52
52
|
width: 15px;
|
|
53
53
|
height: 15px;
|
|
54
54
|
border-radius: 50%;
|
|
55
55
|
transform: translate(-50%, 50%);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
.hueSlider,
|
|
59
|
-
.opacitySlider {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
height: 8px;
|
|
63
|
-
.handle {
|
|
64
|
-
background: var(--color-neutral-100);
|
|
65
|
-
width: 12px;
|
|
66
|
-
height: 12px;
|
|
67
|
-
transform: translate(-6px, 2px);
|
|
68
|
-
}
|
|
69
|
-
.track {
|
|
70
|
-
height: 0;
|
|
71
|
-
background: transparent;
|
|
72
|
-
}
|
|
58
|
+
.hueSlider.hueSlider,
|
|
59
|
+
.opacitySlider.opacitySlider {
|
|
60
|
+
--track-height: 8px;
|
|
61
|
+
--point-size: 14px;
|
|
73
62
|
}
|
|
74
63
|
|
|
75
|
-
.hueSlider {
|
|
76
|
-
|
|
64
|
+
.hueSlider.hueSlider {
|
|
65
|
+
--track-bg: linear-gradient(
|
|
77
66
|
to right,
|
|
78
67
|
#f00 0,
|
|
79
68
|
#ff0 17%,
|
|
@@ -83,4 +72,20 @@
|
|
|
83
72
|
#f0f 83%,
|
|
84
73
|
#f00 100%
|
|
85
74
|
);
|
|
75
|
+
|
|
76
|
+
.handle {
|
|
77
|
+
background: hsl(calc(360deg * var(--value)) 100% 50%);
|
|
78
|
+
border: 2px solid var(--color-neutral-100);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.opacitySlider.opacitySlider {
|
|
83
|
+
--track-bg: var(--transparent-bg);
|
|
84
|
+
|
|
85
|
+
.handle {
|
|
86
|
+
background: var(--track-bg);
|
|
87
|
+
background-size:5000%, 5px;
|
|
88
|
+
background-position-x: calc(100% * var(--value));
|
|
89
|
+
border: 2px solid var(--color-neutral-100);
|
|
90
|
+
}
|
|
86
91
|
}
|
|
@@ -19,6 +19,18 @@ export function rgbToHex(color: RGBA | string | number[]): string {
|
|
|
19
19
|
return hex;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export function getColorVariableValue(
|
|
23
|
+
color: string,
|
|
24
|
+
variables: { [varName: string]: string },
|
|
25
|
+
): string {
|
|
26
|
+
const varName = color.trim().replace(/^var\((.*)\)$/, '$1');
|
|
27
|
+
return variables[varName];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function isColorVariable(color: string): boolean {
|
|
31
|
+
return !!color && /^var\(/.test(color.trim());
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
export function rgbaToString(rgba: RGBA | number[] | string): string {
|
|
23
35
|
if (!rgba) {
|
|
24
36
|
return '';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useCallback, useLayoutEffect, useState } from 'react';
|
|
2
|
+
import tinycolor, { ColorFormats } from 'tinycolor2';
|
|
3
|
+
import { useSilkeCSSContext } from '../silke-css-number-field';
|
|
4
|
+
import { getColorVariableValue, isColorVariable, rgbToHsv } from './color';
|
|
5
|
+
|
|
6
|
+
export type HueType = number | string | ColorFormats.RGBA | ColorFormats.HSV;
|
|
7
|
+
|
|
8
|
+
function stringToRgb(value: string, variables: { [key: string]: string }): ColorFormats.RGBA {
|
|
9
|
+
if (!value) {
|
|
10
|
+
return { r: 0, b: 0, g: 0, a: 0 };
|
|
11
|
+
}
|
|
12
|
+
if (isColorVariable(value)) {
|
|
13
|
+
return tinycolor(getColorVariableValue(value, variables)).toRgb();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return tinycolor(value).toRgb();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isRgb(value: HueType): value is ColorFormats.RGBA {
|
|
20
|
+
return typeof value === 'object' && 'r' in value;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function convertToHue(
|
|
24
|
+
value: HueType,
|
|
25
|
+
prevHue: ColorFormats.HSV | undefined,
|
|
26
|
+
variables: { [key: string]: string },
|
|
27
|
+
): ColorFormats.HSV {
|
|
28
|
+
if (typeof value === 'number') return { h: value, s: 0, v: 0 };
|
|
29
|
+
if (typeof value === 'string') value = stringToRgb(value, variables);
|
|
30
|
+
if (isRgb(value)) return rgbToHsv(prevHue || { h: 0 }, value);
|
|
31
|
+
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function convertFromHue<T extends HueType>(ogValue: T, value: ColorFormats.HSV): T {
|
|
36
|
+
if (typeof ogValue === 'number') return value.h as T;
|
|
37
|
+
if (typeof ogValue === 'string') return tinycolor(value).toRgbString() as T;
|
|
38
|
+
if (isRgb(ogValue)) return tinycolor(value).toRgb() as T;
|
|
39
|
+
return value as T;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function getValueList<T extends HueType>(value?: T | T[]): T[] {
|
|
43
|
+
return (!value ? [0] : Array.isArray(value) ? value : [value]) as T[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function useHue<T extends HueType, U extends T | T[]>(
|
|
47
|
+
value?: U,
|
|
48
|
+
): [hue: number[], setHue: (hue: number[]) => U] {
|
|
49
|
+
const { variables } = useSilkeCSSContext();
|
|
50
|
+
const [hsv, setHSV] = useState<ColorFormats.HSV[]>(() =>
|
|
51
|
+
getValueList(value).map((v) => convertToHue(v, undefined, variables)),
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
useLayoutEffect(() => {
|
|
55
|
+
const valueList = (!value ? [0] : Array.isArray(value) ? value : [value]) as T[];
|
|
56
|
+
setHSV((hsv) => valueList.map((v, i) => convertToHue(v, hsv[i], variables)));
|
|
57
|
+
}, [value, variables]);
|
|
58
|
+
|
|
59
|
+
const handleChange = useCallback(
|
|
60
|
+
(hue: number[]) => {
|
|
61
|
+
const newHSV = hsv.map((h, i) => ({ ...h, h: hue[i] }));
|
|
62
|
+
setHSV(newHSV);
|
|
63
|
+
|
|
64
|
+
const newValueList = getValueList(value).map((v, i) => convertFromHue(v, newHSV[i]));
|
|
65
|
+
if (Array.isArray(value)) return newValueList as U;
|
|
66
|
+
return newValueList[0] as U;
|
|
67
|
+
},
|
|
68
|
+
[value, hsv],
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return [hsv.map((h) => h.h), handleChange];
|
|
72
|
+
}
|
|
@@ -7,13 +7,16 @@ pick color plz
|
|
|
7
7
|
```js
|
|
8
8
|
const [value, setValue] = React.useState(``);
|
|
9
9
|
const [variables, setVariabels] = React.useState({
|
|
10
|
-
primary:
|
|
11
|
-
accent:
|
|
12
|
-
bg:
|
|
10
|
+
primary: "rgba(0, 150, 136, 1)",
|
|
11
|
+
accent: "rgba(233, 30, 99, 1)",
|
|
12
|
+
bg: "rgba(250, 250, 250, 1)",
|
|
13
13
|
text: false,
|
|
14
14
|
});
|
|
15
15
|
const handleAddVariable = () => {
|
|
16
|
-
setVariabels({
|
|
16
|
+
setVariabels({
|
|
17
|
+
...variables,
|
|
18
|
+
["--swatch" + Object.keys(variables).length]: value,
|
|
19
|
+
});
|
|
17
20
|
};
|
|
18
21
|
|
|
19
22
|
<SilkeCSSContext variables={variables} onVariableAdd={handleAddVariable}>
|
|
@@ -26,13 +29,16 @@ const handleAddVariable = () => {
|
|
|
26
29
|
```js
|
|
27
30
|
const [value, setValue] = React.useState(`rgba(10, 10, 10, 100`);
|
|
28
31
|
const [variables, setVariabels] = React.useState({
|
|
29
|
-
primary:
|
|
30
|
-
accent:
|
|
31
|
-
bg:
|
|
32
|
+
primary: "rgba(0, 150, 136, 1)",
|
|
33
|
+
accent: "rgba(233, 30, 99, 1)",
|
|
34
|
+
bg: "rgba(250, 250, 250, 1)",
|
|
32
35
|
text: false,
|
|
33
36
|
});
|
|
34
37
|
const handleAddVariable = () => {
|
|
35
|
-
setVariabels({
|
|
38
|
+
setVariabels({
|
|
39
|
+
...variables,
|
|
40
|
+
["--swatch" + Object.keys(variables).length]: value,
|
|
41
|
+
});
|
|
36
42
|
};
|
|
37
43
|
<SilkeCSSContext variables={variables} onVariableAdd={handleAddVariable}>
|
|
38
44
|
<SilkeBox gap="m" vAlign="center">
|
|
@@ -42,7 +48,29 @@ const handleAddVariable = () => {
|
|
|
42
48
|
|
|
43
49
|
<SilkeColorPickerButton value={value} size="s" onChange={setValue} />
|
|
44
50
|
|
|
45
|
-
<SilkeColorPickerButton
|
|
51
|
+
<SilkeColorPickerButton
|
|
52
|
+
value={value}
|
|
53
|
+
label="Some random label"
|
|
54
|
+
onChange={setValue}
|
|
55
|
+
/>
|
|
46
56
|
</SilkeBox>
|
|
47
57
|
</SilkeCSSContext>;
|
|
48
58
|
```
|
|
59
|
+
|
|
60
|
+
## Hue slider
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
const [rgb, setRgb] = React.useState(`green`);
|
|
64
|
+
const [hue, setHue] = React.useState(0);
|
|
65
|
+
const [multipleHue, setMultipleHue] = React.useState([0, 1]);
|
|
66
|
+
<SilkeBox column gap="m">
|
|
67
|
+
<SilkeHueSlider value={rgb} onChange={setRgb} />
|
|
68
|
+
<SilkeHueSlider value={hue} onChange={setHue} />
|
|
69
|
+
<SilkeHueSlider value={multipleHue} onChange={setMultipleHue} />
|
|
70
|
+
<SilkeHueSlider
|
|
71
|
+
value={multipleHue}
|
|
72
|
+
onChange={setMultipleHue}
|
|
73
|
+
onTrackClick={(e, v) => setMultipleHue([...multipleHue, v])}
|
|
74
|
+
/>
|
|
75
|
+
</SilkeBox>;
|
|
76
|
+
```
|
|
@@ -8,12 +8,12 @@ import { SilkeSwatches } from '../silke-color-swatches';
|
|
|
8
8
|
import { useSilkeCSSContext } from '../silke-css-number-field';
|
|
9
9
|
import { SilkeModal, SilkeModalActions, SilkeModalContent } from '../silke-modal';
|
|
10
10
|
import { TextFieldContext } from '../silke-text-field';
|
|
11
|
-
import { hsvToRgb, rgbToHsv } from './color';
|
|
11
|
+
import { getColorVariableValue, hsvToRgb, isColorVariable, rgbToHsv } from './color';
|
|
12
12
|
import styles from './color-picker.scss';
|
|
13
13
|
import { ColorInfo } from './silke-color-info';
|
|
14
14
|
import { ColorSpace } from './silke-color-space';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { SilkeHueSlider } from './silke-hue-slider';
|
|
16
|
+
import { SilkeOpacitySlider } from './silke-opacity-slider';
|
|
17
17
|
|
|
18
18
|
const TRANSPARENT: ColorFormats.RGBA = { r: 0, b: 0, g: 0, a: 0 };
|
|
19
19
|
|
|
@@ -30,15 +30,6 @@ export type SilkeColorPickerProps = {
|
|
|
30
30
|
onChange: (color: string) => void;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
function isVariable(color: string): boolean {
|
|
34
|
-
return !!color && /^var\(/.test(color.trim());
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function getVariableValue(color: string, variables: { [varName: string]: string }): string {
|
|
38
|
-
const varName = color.trim().replace(/^var\((.*)\)$/, '$1');
|
|
39
|
-
return variables[varName];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
33
|
export function SilkeColorPicker({
|
|
43
34
|
value,
|
|
44
35
|
hidePalettes,
|
|
@@ -51,14 +42,14 @@ export function SilkeColorPicker({
|
|
|
51
42
|
const [eyeDropperActive, setEyeDropperActive] = useState(false);
|
|
52
43
|
const [showEyeDropUnsupported, setShowEyeDropUnsupported] = useState(false);
|
|
53
44
|
const { variables } = useSilkeCSSContext();
|
|
54
|
-
const isValueVariable =
|
|
45
|
+
const isValueVariable = isColorVariable(value);
|
|
55
46
|
|
|
56
47
|
const rgba = React.useMemo(() => {
|
|
57
48
|
if (!value) {
|
|
58
49
|
return TRANSPARENT;
|
|
59
50
|
}
|
|
60
51
|
if (isValueVariable) {
|
|
61
|
-
return tinycolor(
|
|
52
|
+
return tinycolor(getColorVariableValue(value, variables)).toRgb();
|
|
62
53
|
}
|
|
63
54
|
|
|
64
55
|
return tinycolor(value).toRgb();
|
|
@@ -77,7 +68,7 @@ export function SilkeColorPicker({
|
|
|
77
68
|
|
|
78
69
|
const handleChange = (v: string | RGBA) => {
|
|
79
70
|
if (isString(v) && /\$|var/.test(v)) {
|
|
80
|
-
if (noVariables) onChange(
|
|
71
|
+
if (noVariables) onChange(getColorVariableValue(v, variables));
|
|
81
72
|
else onChange(v);
|
|
82
73
|
} else {
|
|
83
74
|
const color = tinycolor(v);
|
|
@@ -127,9 +118,9 @@ export function SilkeColorPicker({
|
|
|
127
118
|
}}
|
|
128
119
|
/>
|
|
129
120
|
|
|
130
|
-
<SilkeBox column flex
|
|
131
|
-
<
|
|
132
|
-
{!noTransparency && <
|
|
121
|
+
<SilkeBox column flex>
|
|
122
|
+
<SilkeHueSlider value={hue} onChange={handleHue} />
|
|
123
|
+
{!noTransparency && <SilkeOpacitySlider rgba={rgba} onChange={handleChange} />}
|
|
133
124
|
</SilkeBox>
|
|
134
125
|
</SilkeBox>
|
|
135
126
|
<ColorInfo rgba={rgba} noTransparency={noTransparency} onChange={handleChange} />
|
|
@@ -59,8 +59,6 @@ export function ColorSpace({ rgba, hue, dragging, onDrag, onChange }: Props) {
|
|
|
59
59
|
|
|
60
60
|
const handleMouseDown = (e: React.MouseEvent) => {
|
|
61
61
|
onDrag(true);
|
|
62
|
-
e.stopPropagation();
|
|
63
|
-
e.preventDefault();
|
|
64
62
|
Mouse.on('mousemove', handleChange);
|
|
65
63
|
Mouse.on('mouseup', handleMouseUp);
|
|
66
64
|
boxRect.current = e.currentTarget.getBoundingClientRect();
|
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useFormField } from '../../hooks';
|
|
3
|
+
import { FormFieldProps } from '../silke-form';
|
|
4
|
+
import { SilkeSlider, SilkeSliderProps } from '../silke-slider';
|
|
3
5
|
import styles from './color-picker.scss';
|
|
6
|
+
import { HueType, useHue } from './hue';
|
|
4
7
|
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
type SilkeHueSliderProps<T extends HueType, U extends T | T[]> = FormFieldProps<U> &
|
|
9
|
+
Pick<
|
|
10
|
+
SilkeSliderProps<number[]>,
|
|
11
|
+
'onTrackClick' | 'onRequestRemove' | 'style' | 'trackStyle' | 'handleStyle'
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
export function SilkeHueSlider<T extends HueType, U extends T | T[]>(
|
|
15
|
+
props: SilkeHueSliderProps<T, U>,
|
|
16
|
+
) {
|
|
17
|
+
const { value, onChange, ...rest } = useFormField(props);
|
|
18
|
+
const [hue, setHue] = useHue(value);
|
|
19
|
+
|
|
20
|
+
const handleChange = (hue: number[]) => {
|
|
21
|
+
const value = setHue(hue);
|
|
22
|
+
onChange?.(value);
|
|
23
|
+
};
|
|
9
24
|
|
|
10
|
-
export function HueSlider({ hue, onChange }: HueSliderProps) {
|
|
11
25
|
return (
|
|
12
26
|
<SilkeSlider
|
|
13
27
|
className={styles.hueSlider}
|
|
14
28
|
trackClassName={styles.track}
|
|
15
29
|
handleClassName={styles.handle}
|
|
16
|
-
|
|
30
|
+
disableOrder
|
|
17
31
|
value={hue}
|
|
18
|
-
onChange={
|
|
32
|
+
onChange={handleChange}
|
|
33
|
+
{...(rest as any)}
|
|
19
34
|
/>
|
|
20
35
|
);
|
|
21
36
|
}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
1
|
import { RGBA, rgbToHex } from '@vev/utils';
|
|
4
|
-
|
|
5
|
-
import styles from './color-picker.scss';
|
|
2
|
+
import React, { CSSProperties, useMemo } from 'react';
|
|
6
3
|
import { SilkeSlider } from '../silke-slider';
|
|
7
|
-
import
|
|
4
|
+
import styles from './color-picker.scss';
|
|
8
5
|
|
|
9
|
-
type
|
|
6
|
+
type SilkeOpacitySliderProps = {
|
|
10
7
|
rgba: RGBA;
|
|
11
8
|
onChange: (rgba: RGBA) => void;
|
|
12
9
|
};
|
|
13
10
|
|
|
14
|
-
export function
|
|
15
|
-
const hex =
|
|
11
|
+
export function SilkeOpacitySlider({ rgba, onChange }: SilkeOpacitySliderProps) {
|
|
12
|
+
const hex = useMemo(() => rgbToHex(rgba), [rgba]);
|
|
16
13
|
const { a } = rgba;
|
|
17
14
|
|
|
18
15
|
return (
|
|
@@ -20,10 +17,11 @@ export function OpacitySlider({ rgba, onChange }: OpacitySliderProps) {
|
|
|
20
17
|
className={styles.opacitySlider}
|
|
21
18
|
trackClassName={styles.track}
|
|
22
19
|
handleClassName={styles.handle}
|
|
23
|
-
style={
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
style={
|
|
21
|
+
{
|
|
22
|
+
'--track-bg': `linear-gradient(to right, rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, 0), #${hex}), var(--transparent-bg)`,
|
|
23
|
+
} as CSSProperties
|
|
24
|
+
}
|
|
27
25
|
value={a || a === 0 ? a : 1}
|
|
28
26
|
onChange={(a) => onChange({ ...rgba, a })}
|
|
29
27
|
/>
|
|
@@ -1,39 +1,4 @@
|
|
|
1
|
-
$sidebarWidth: 256px;
|
|
2
|
-
$contentGutter: 40px;
|
|
3
|
-
$cardSpacing: 24px;
|
|
4
|
-
$cardWidth: 256px;
|
|
5
|
-
|
|
6
1
|
.column {
|
|
7
|
-
width:
|
|
2
|
+
width: 88%;
|
|
8
3
|
margin: 0 auto;
|
|
9
|
-
|
|
10
|
-
&.s {
|
|
11
|
-
width: #{$cardWidth * 4 + $cardSpacing * 3};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&.xs {
|
|
15
|
-
width: #{$cardWidth * 2 + $cardSpacing * 1};
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@for $i from 5 through 2 {
|
|
20
|
-
@media (max-width: #{$cardWidth * ( $i + 1) + $cardSpacing * $i + $contentGutter * 2 + $sidebarWidth}) {
|
|
21
|
-
|
|
22
|
-
@if $i == 5 {
|
|
23
|
-
.column {
|
|
24
|
-
width: #{$cardWidth * 4 + $cardSpacing * 3};
|
|
25
|
-
}
|
|
26
|
-
}@else if i==4{
|
|
27
|
-
.column,
|
|
28
|
-
.column.s {
|
|
29
|
-
width: #{$i * $cardWidth + ($i - 1) * $cardSpacing};
|
|
30
|
-
}
|
|
31
|
-
}@else{
|
|
32
|
-
.column,
|
|
33
|
-
.column.xs,
|
|
34
|
-
.column.s {
|
|
35
|
-
width: #{$i * $cardWidth + ($i - 1) * $cardSpacing};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
4
|
+
}
|
|
@@ -25,12 +25,16 @@ export const SilkeContextMenuItem = ({
|
|
|
25
25
|
icon,
|
|
26
26
|
subItem,
|
|
27
27
|
onClick,
|
|
28
|
+
selected,
|
|
28
29
|
...rest
|
|
29
30
|
}: SilkeContextMenuItemProps) => {
|
|
31
|
+
const cl = [styles.item];
|
|
30
32
|
const ref = useRef<HTMLButtonElement>(null);
|
|
31
33
|
const requestCloseMenu = usePopoverRequestClose('contextmenu');
|
|
32
34
|
const requestCloseSub = usePopoverRequestClose('contextmenu.sub');
|
|
33
35
|
|
|
36
|
+
if (selected) cl.push(styles.selected);
|
|
37
|
+
|
|
34
38
|
const [showSub, setShowSub] = useState(false);
|
|
35
39
|
return (
|
|
36
40
|
<SilkeBox column hPad="xs">
|
|
@@ -59,7 +63,7 @@ export const SilkeContextMenuItem = ({
|
|
|
59
63
|
setShowSub(true);
|
|
60
64
|
}
|
|
61
65
|
}}
|
|
62
|
-
className={
|
|
66
|
+
className={cl.join(' ')}
|
|
63
67
|
{...rest}
|
|
64
68
|
/>
|
|
65
69
|
{showSub && items && (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isFunction } from 'lodash';
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { SilkeBox } from '../silke-box';
|
|
3
|
+
import { BoxSpace, SilkeBox } from '../silke-box';
|
|
4
4
|
import { ButtonContext } from '../silke-button';
|
|
5
5
|
import { SilkePopover, SilkePopoverProps } from '../silke-popover';
|
|
6
6
|
import { usePopoverRequestClose } from '../silke-popover/popover-context';
|
|
@@ -17,9 +17,10 @@ export type SilkeContextMenuProps = {
|
|
|
17
17
|
items: SilkeContextMenuItems;
|
|
18
18
|
width?: number;
|
|
19
19
|
trigger?: 'contextmenu' | 'click' | 'mousedown';
|
|
20
|
-
target?: React.MutableRefObject<HTMLElement>;
|
|
20
|
+
target?: React.RefObject<HTMLElement> | React.MutableRefObject<HTMLElement | undefined>;
|
|
21
21
|
/** Used internally to keep track of menu and closing */
|
|
22
22
|
subMenu?: boolean;
|
|
23
|
+
gap?: BoxSpace;
|
|
23
24
|
} & Omit<SilkePopoverProps, 'children' | 'kind'>;
|
|
24
25
|
|
|
25
26
|
export function SilkeContextMenu({
|
|
@@ -29,6 +30,7 @@ export function SilkeContextMenu({
|
|
|
29
30
|
anchor,
|
|
30
31
|
width,
|
|
31
32
|
subMenu,
|
|
33
|
+
gap,
|
|
32
34
|
onRequestClose,
|
|
33
35
|
...rest
|
|
34
36
|
}: SilkeContextMenuProps) {
|
|
@@ -61,7 +63,6 @@ export function SilkeContextMenu({
|
|
|
61
63
|
anchorOrigin="top-left"
|
|
62
64
|
anchor={anchor || pos}
|
|
63
65
|
onRequestClose={() => {
|
|
64
|
-
console.log('REQUEST close');
|
|
65
66
|
if (showContextMenu) setShowContextMenu(false);
|
|
66
67
|
onRequestClose?.();
|
|
67
68
|
}}
|
|
@@ -79,6 +80,7 @@ export function SilkeContextMenu({
|
|
|
79
80
|
shadow="level4"
|
|
80
81
|
onMouseDown={(e: React.MouseEvent) => e.stopPropagation()}
|
|
81
82
|
vPad="xs"
|
|
83
|
+
gap={gap}
|
|
82
84
|
onKeyDown={(e: React.KeyboardEvent) => {
|
|
83
85
|
if (e.key === 'ArrowLeft' && !subMenu) {
|
|
84
86
|
e.stopPropagation();
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
## Drawer
|
|
2
|
-
```jsx
|
|
3
2
|
|
|
3
|
+
```jsx
|
|
4
4
|
const [isShowing, setShowing] = React.useState(false);
|
|
5
5
|
|
|
6
6
|
<>
|
|
7
7
|
<SilkeButton
|
|
8
|
-
label={isShowing ?
|
|
8
|
+
label={isShowing ? "Hide" : "Show"}
|
|
9
9
|
onClick={() => setShowing(!isShowing)}
|
|
10
10
|
/>
|
|
11
11
|
|
|
12
|
-
<SilkeBox>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</
|
|
21
|
-
|
|
12
|
+
<SilkeBox>
|
|
13
|
+
<SilkeDrawer
|
|
14
|
+
open={isShowing}
|
|
15
|
+
onRequestClose={() => setShowing(false)}
|
|
16
|
+
title="Closable drawer"
|
|
17
|
+
>
|
|
18
|
+
This drawer will close if you click outside it <i>or</i> if you click the
|
|
19
|
+
close button in the top right corner
|
|
20
|
+
</SilkeDrawer>
|
|
21
|
+
</SilkeBox>
|
|
22
|
+
</>;
|
|
22
23
|
```
|
|
23
|
-
|
|
@@ -7,13 +7,13 @@ export type FieldRegisterModel = {
|
|
|
7
7
|
getError(): string | undefined;
|
|
8
8
|
getValue(): any;
|
|
9
9
|
};
|
|
10
|
-
interface FormObjectContext<T extends
|
|
10
|
+
interface FormObjectContext<T extends Record<string, any>> {
|
|
11
11
|
value: T;
|
|
12
12
|
valueRef: React.MutableRefObject<T>;
|
|
13
13
|
errors: ErrorMap<T>;
|
|
14
|
-
register: (fieldName:
|
|
15
|
-
validate: (fieldName:
|
|
16
|
-
onChange: (name:
|
|
14
|
+
register: (fieldName: string, field: FieldRegisterModel) => void;
|
|
15
|
+
validate: (fieldName: string) => void;
|
|
16
|
+
onChange: (name: string, change?: any, isValid?: boolean) => void;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const defaultContext: FormObjectContext<any> = {
|
|
@@ -26,7 +26,7 @@ const defaultContext: FormObjectContext<any> = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
// Using once to get the generic to work
|
|
29
|
-
function _getFieldContext<T
|
|
29
|
+
function _getFieldContext<T extends Record<string, any>>() {
|
|
30
30
|
return createContext<FormObjectContext<T>>(defaultContext as any);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -6,16 +6,28 @@ you need forms
|
|
|
6
6
|
const [change, setChange] = React.useState({});
|
|
7
7
|
const [submit, setSubmit] = React.useState({});
|
|
8
8
|
const [errors, setErrors] = React.useState({});
|
|
9
|
-
const [items] = React.useState(
|
|
9
|
+
const [items] = React.useState(
|
|
10
|
+
ipsum.list((i) => ({ value: i, label: ipsum.name() }))
|
|
11
|
+
);
|
|
10
12
|
|
|
11
|
-
<SilkeForm
|
|
13
|
+
<SilkeForm
|
|
14
|
+
value={change}
|
|
15
|
+
onSubmit={setSubmit}
|
|
16
|
+
onChange={setChange}
|
|
17
|
+
onErrors={setErrors}
|
|
18
|
+
>
|
|
12
19
|
<SilkeTextField name="text" required />
|
|
13
20
|
<SilkeIconPicker name="icon" />
|
|
14
21
|
<SilkeCheckbox name="checkbox1" label="Checkbox" />
|
|
15
22
|
<SilkeCheckbox name="checkbox2" label="Checkbox 2" required />
|
|
16
23
|
<SilkeSelectField name="select" required items={items} />
|
|
17
24
|
<SilkeRadioButtonGroup name="select" required items={items} />
|
|
18
|
-
<SilkeAutocompleteField
|
|
25
|
+
<SilkeAutocompleteField
|
|
26
|
+
name="autocomplete"
|
|
27
|
+
multiple
|
|
28
|
+
maxItems={2}
|
|
29
|
+
items={items}
|
|
30
|
+
>
|
|
19
31
|
<SilkeTextFieldItem>
|
|
20
32
|
<SilkeButton label="Send" icon="arrow.right" />
|
|
21
33
|
</SilkeTextFieldItem>
|
|
@@ -16,7 +16,7 @@ export type SilkeFormProps<T extends { [key: string]: any }> = {
|
|
|
16
16
|
onErrors?: (errors: ErrorMap<T>) => void;
|
|
17
17
|
} & Omit<BoxFormProps, 'tag' | 'onChange' | 'onSubmit'>;
|
|
18
18
|
|
|
19
|
-
export function SilkeForm<T>({
|
|
19
|
+
export function SilkeForm<T extends { [key: string]: any }>({
|
|
20
20
|
children,
|
|
21
21
|
value,
|
|
22
22
|
errors,
|