From f776e906d35625785b9d0b6ef056d12a374db00c Mon Sep 17 00:00:00 2001 From: Alex Natalia <38787212+alexnatalia@users.noreply.github.com> Date: Tue, 27 Oct 2020 14:43:50 +0300 Subject: [PATCH 01/16] Release/0.5.1 (#75) * SMenu Component: Added ability to add the box shadow. (#72) * Icon Story: Fixed knob title (#73) * UI Lib Version: updated. (#74) --- package.json | 2 +- src/components/Menu/SMenu.vue | 8 ++++++++ src/stories/SIcon.stories.ts | 2 +- src/styles/menu.scss | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 23bea9b0..d1a1fec0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soramitsu/soramitsu-js-ui", - "version": "0.5.0", + "version": "0.5.1", "private": false, "publishConfig": { "registry": "https://nexus.iroha.tech/repository/npm-soramitsu-private/" diff --git a/src/components/Menu/SMenu.vue b/src/components/Menu/SMenu.vue index 21ab9dff..41169236 100644 --- a/src/components/Menu/SMenu.vue +++ b/src/components/Menu/SMenu.vue @@ -6,6 +6,7 @@ :mode="mode" :collapse="collapse" :background-color="backgroundColor" + :box-shadow="boxShadow" :text-color="textColor" :active-text-color="activeTextColor" :default-active="defaultActive" @@ -48,6 +49,10 @@ export default class SMenu extends Vue { * By default it's set to `"#2D2926"` */ @Prop({ default: '#2D2926', type: String }) readonly backgroundColor!: string + /** + * Menu shadow if it exists + */ + @Prop({ default: 'none', type: String }) readonly boxShadow!: string /** * Text color of menu in hex format. * @@ -104,6 +109,9 @@ export default class SMenu extends Vue { get computedStyles (): object { const styles = {} as any + if (this.boxShadow) { + styles['--s-menu-box-shadow'] = this.boxShadow + } if (this.activeHoverColor) { styles['--s-menu-color-hover'] = this.activeHoverColor } diff --git a/src/stories/SIcon.stories.ts b/src/stories/SIcon.stories.ts index 67c75152..d8cda33c 100644 --- a/src/stories/SIcon.stories.ts +++ b/src/stories/SIcon.stories.ts @@ -21,7 +21,7 @@ export const configurable = () => ({ default: select('Name', Object.values(Icons), Icons.Activity) }, size: { - default: number('Content position', 16) + default: number('Icon Size', 16) } } }) diff --git a/src/styles/menu.scss b/src/styles/menu.scss index 564e15e2..e9a9597f 100644 --- a/src/styles/menu.scss +++ b/src/styles/menu.scss @@ -1,6 +1,7 @@ $margin-bottom-menu-item: 8px; .s-menu { + box-shadow: var(--s-menu-box-shadow); padding: 20px 12px; &:not(.el-menu--horizontal) > :not(:last-child) { margin-bottom: $margin-bottom-menu-item; From 5cf7530edf6b7a81929ab601cfd27d48747d3440 Mon Sep 17 00:00:00 2001 From: Aleksandr Makhnev Date: Fri, 30 Oct 2020 11:55:16 +0500 Subject: [PATCH 02/16] Release 0.5.3 (#80) * Add UMD build --- build/rollup.config.js | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build/rollup.config.js b/build/rollup.config.js index e90b9bb0..aa95fda3 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -16,6 +16,11 @@ export default { file: 'lib/soramitsu-js-ui.esm.js', format: 'esm', sourcemap: true + }, { + name: 'SoramitsuJsUiUmd', + format: 'umd', + file: 'lib/soramitsu-js-ui.umd.js', + sourcemap: true } ], external: [ diff --git a/package.json b/package.json index aa0b80b0..4894b105 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soramitsu/soramitsu-js-ui", - "version": "0.5.2", + "version": "0.5.3", "private": false, "publishConfig": { "registry": "https://nexus.iroha.tech/repository/npm-soramitsu-private/" From 703536887191c56eba817e6b1ab799921bdbcd34 Mon Sep 17 00:00:00 2001 From: Stefan Popov Date: Tue, 3 Nov 2020 16:08:46 +0300 Subject: [PATCH 03/16] Release 0.5.4 (#82) * Add icon prop for dropdown component --- package.json | 2 +- src/components/Dropdown/SDropdown.vue | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4894b105..7ebe581b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soramitsu/soramitsu-js-ui", - "version": "0.5.3", + "version": "0.5.4", "private": false, "publishConfig": { "registry": "https://nexus.iroha.tech/repository/npm-soramitsu-private/" diff --git a/src/components/Dropdown/SDropdown.vue b/src/components/Dropdown/SDropdown.vue index bc1e294b..679a9c9c 100644 --- a/src/components/Dropdown/SDropdown.vue +++ b/src/components/Dropdown/SDropdown.vue @@ -29,7 +29,7 @@ - + @@ -47,11 +47,13 @@ import { ElDropdown } from 'element-ui/types/dropdown' import { DropdownType, DropdownSize, DropdownPlacement, DropdownTrigger } from './consts' import { ButtonTypes, SButton } from '../Button' +import { Icons, SIcon } from '../Icon' import { STooltip } from '../Tooltip' @Component({ components: { SButton, + SIcon, STooltip } }) @@ -63,6 +65,12 @@ export default class SDropdown extends Vue { * By default, it's set to `"default"` */ @Prop({ type: String, default: DropdownType.DEFAULT }) readonly type!: string + /** + * An icon for dropdown with `type="ellipsis"`. + * + * By default, it's set to `"more-horizontal"` + */ + @Prop({ type: String, default: Icons.MoreHorizontal }) readonly icon!: string /** * Button type of dropdown component. It can be used with `type="button"`. * Possible values: `"primary"`, `"secondary"`, `"tertiary"`. From 411d068ff7cdd5d7de9ed248ce4d9fff3b0cec14 Mon Sep 17 00:00:00 2001 From: Aleksandr Makhnev Date: Fri, 6 Nov 2020 18:04:53 +0500 Subject: [PATCH 04/16] Release 0.5.5 (#84) --- package.json | 2 +- src/components/Input/SInput.vue | 35 +++++++++++++++++++++++++++++++-- src/components/Input/consts.ts | 5 +++++ src/components/Input/index.ts | 4 ++-- src/stories/SInput.stories.ts | 14 ++++++++++++- src/styles/input.scss | 12 +++++++++++ 6 files changed, 66 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 7ebe581b..e639ba48 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soramitsu/soramitsu-js-ui", - "version": "0.5.4", + "version": "0.5.5", "private": false, "publishConfig": { "registry": "https://nexus.iroha.tech/repository/npm-soramitsu-private/" diff --git a/src/components/Input/SInput.vue b/src/components/Input/SInput.vue index 757b52e3..4aa83ac4 100644 --- a/src/components/Input/SInput.vue +++ b/src/components/Input/SInput.vue @@ -3,7 +3,7 @@ class="s-input" :class="computedClasses" > - {{ placeholder }} + {{ placeholder }} { const cssClasses: Array = [] if (this.focused) { @@ -169,9 +187,22 @@ export default class SInput extends Vue { if (this.autofill) { cssClasses.push('s-autofill') } + if (this.size) { + cssClasses.push(this.sizeClass) + } return cssClasses } + get sizeClass (): string { + switch (this.size) { + case InputSize.MEDIUM: + return 's-size-medium' + case InputSize.BIG: + default: + return '' + } + } + get computedType (): string { if (this.type === InputType.TEXT_FILE) { return InputType.TEXT diff --git a/src/components/Input/consts.ts b/src/components/Input/consts.ts index cafbcaeb..bb48a246 100644 --- a/src/components/Input/consts.ts +++ b/src/components/Input/consts.ts @@ -29,3 +29,8 @@ export enum InputType { URL = 'url', WEEK = 'week' } + +export enum InputSize { + MEDIUM = 'medium', + BIG = 'big' +} diff --git a/src/components/Input/index.ts b/src/components/Input/index.ts index ee397074..e1b9b29e 100644 --- a/src/components/Input/index.ts +++ b/src/components/Input/index.ts @@ -1,5 +1,5 @@ import SInput from './SInput.vue' import SJsonInput from './SJsonInput.vue' -import { Autocomplete, InputType } from './consts' +import { Autocomplete, InputType, InputSize } from './consts' -export { SInput, SJsonInput, Autocomplete, InputType } +export { SInput, SJsonInput, Autocomplete, InputType, InputSize } diff --git a/src/stories/SInput.stories.ts b/src/stories/SInput.stories.ts index 88cf7a08..182d55e8 100644 --- a/src/stories/SInput.stories.ts +++ b/src/stories/SInput.stories.ts @@ -1,7 +1,7 @@ import { text, boolean, withKnobs, number, select } from '@storybook/addon-knobs' import { SInput, SRow, SCol } from '../components' -import { InputType } from '../components/Input' +import { InputType, InputSize } from '../components/Input' export default { component: SInput, @@ -21,6 +21,9 @@ export const configurable = () => ({ :readonly="readonly" :show-text-limit="showTextLimit" :maxlength="maxlength" + :size="size" + :prefix="prefix" + :suffix="suffix" />`, data: () => ({ input: '' @@ -29,9 +32,18 @@ export const configurable = () => ({ type: { default: select('Type', Object.values(InputType), InputType.TEXT) }, + size: { + default: select('Size', Object.values(InputSize), InputSize.BIG) + }, placeholder: { default: text('Placeholder', 'Placeholder') }, + prefix: { + default: text('Prefix icon', 'el-icon-search') + }, + suffix: { + default: text('Suffix icon', 'el-icon-search') + }, disabled: { default: boolean('Disabled', false) }, diff --git a/src/styles/input.scss b/src/styles/input.scss index 85ff393a..2e748fa6 100644 --- a/src/styles/input.scss +++ b/src/styles/input.scss @@ -55,6 +55,18 @@ border-color: var(--s-color-base-background-hover); } } + &.s-size-medium { + min-height: $s-size-medium; + + .el-input, + .el-textarea { + height: 100%; + > input, + > textarea { + height: $s-size-medium; + } + } + } &.s-focused { .s-placeholder, .el-input > input, From 8b221a9bef947b8ac1d3b5129f0923996be5fc4d Mon Sep 17 00:00:00 2001 From: Alex Natalia <38787212+alexnatalia@users.noreply.github.com> Date: Wed, 11 Nov 2020 19:56:16 +0300 Subject: [PATCH 05/16] Customization bug fix (#88) (#89) * Fixed colors customization bug. * Updated to 0.5.7 version. --- package.json | 2 +- src/stories/Intro/Customization.stories.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 70a1dd7f..edce40d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soramitsu/soramitsu-js-ui", - "version": "0.5.6", + "version": "0.5.7", "private": false, "publishConfig": { "registry": "https://nexus.iroha.tech/repository/npm-soramitsu-private/" diff --git a/src/stories/Intro/Customization.stories.ts b/src/stories/Intro/Customization.stories.ts index 43df1693..17083f81 100644 --- a/src/stories/Intro/Customization.stories.ts +++ b/src/stories/Intro/Customization.stories.ts @@ -10,10 +10,11 @@ export default { excludeStories: /.*Data$/ } -const getColorsData = (colors) => Object.values(colors).map(color => { - const value = getComputedStyle(document.documentElement).getPropertyValue(`--s-color-${color}`) +const colorPropertyPrefix = '--s-color-' +const getColorsData = (colors) => Object.values(colors).map(colorPropertyName => { + const value = getComputedStyle(document.documentElement).getPropertyValue(`${colorPropertyPrefix}${colorPropertyName}`) const isRgb = value.includes('rgb') - return { label: color, value, isRgb } + return { label: colorPropertyName, value, isRgb } }) export const colorsSectionsData = [ { title: 'Theme / Accent', colors: getColorsData(AccentColors) }, @@ -84,7 +85,7 @@ export const configurable = () => ({ }), methods: { handleColorChange: (label: string, color: string) => { - document.documentElement.style.setProperty(label, color) + document.documentElement.style.setProperty(`${colorPropertyPrefix}${label}`, color) } } }) From 2cf12d24ffe43b4d7947b10b4ea7a0f710e291e4 Mon Sep 17 00:00:00 2001 From: Stefan Popov Date: Tue, 17 Nov 2020 12:07:42 +0300 Subject: [PATCH 06/16] Release 0.5.8 (#91) * Fix imports (#90) --- package.json | 2 +- ...amitsu-icons.woff => soramitsu-icons-1.0.0.woff} | Bin src/styles/breadcrumbs.scss | 2 -- src/styles/button.scss | 2 -- src/styles/card.scss | 2 -- src/styles/checkbox.scss | 3 --- src/styles/collapse.scss | 2 -- src/styles/common.scss | 2 -- src/styles/datepicker.scss | 2 -- src/styles/dialog.scss | 2 -- src/styles/dropdown.scss | 2 -- src/styles/element-variables.scss | 2 -- src/styles/fonts.scss | 2 +- src/styles/form.scss | 2 -- src/styles/icons.scss | 2 -- src/styles/input.scss | 2 -- src/styles/json-input.scss | 3 --- src/styles/layout.scss | 2 -- src/styles/pagination.scss | 2 -- src/styles/radio.scss | 3 --- src/styles/scroll-sections.scss | 2 -- src/styles/select.scss | 3 --- src/styles/slider.scss | 2 -- src/styles/switch.scss | 2 -- src/styles/table.scss | 2 -- src/styles/tabs.scss | 2 -- src/styles/tooltip.scss | 2 -- src/styles/variables.scss | 10 +++++++++- 28 files changed, 11 insertions(+), 55 deletions(-) rename src/assets/fonts/{soramitsu-icons.woff => soramitsu-icons-1.0.0.woff} (100%) diff --git a/package.json b/package.json index edce40d6..b4faac03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soramitsu/soramitsu-js-ui", - "version": "0.5.7", + "version": "0.5.8", "private": false, "publishConfig": { "registry": "https://nexus.iroha.tech/repository/npm-soramitsu-private/" diff --git a/src/assets/fonts/soramitsu-icons.woff b/src/assets/fonts/soramitsu-icons-1.0.0.woff similarity index 100% rename from src/assets/fonts/soramitsu-icons.woff rename to src/assets/fonts/soramitsu-icons-1.0.0.woff diff --git a/src/styles/breadcrumbs.scss b/src/styles/breadcrumbs.scss index 3e62ec6f..1d819577 100644 --- a/src/styles/breadcrumbs.scss +++ b/src/styles/breadcrumbs.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .el-breadcrumb__separator { color: var(--s-color-base-content-tertiary); font-weight: normal; diff --git a/src/styles/button.scss b/src/styles/button.scss index adf7d741..13fe0985 100644 --- a/src/styles/button.scss +++ b/src/styles/button.scss @@ -1,5 +1,3 @@ -@import "./variables"; - $s-color-button-tertiary-color: var(--s-color-base-content-primary) !default; $s-color-button-tertiary-color-active: var(--s-color-theme-accent) !default; $s-color-button-tertiary-background: var(--s-color-base-background) !default; diff --git a/src/styles/card.scss b/src/styles/card.scss index 9619569f..edc23ef7 100644 --- a/src/styles/card.scss +++ b/src/styles/card.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .s-card { color: var(--s-color-base-content-primary); border-radius: 8px; diff --git a/src/styles/checkbox.scss b/src/styles/checkbox.scss index bb9e8af2..e8dce297 100644 --- a/src/styles/checkbox.scss +++ b/src/styles/checkbox.scss @@ -1,6 +1,3 @@ -@import "./variables"; -@import "./common"; - .el-checkbox { color: var(--s-color-base-content-primary); &.is-bordered { diff --git a/src/styles/collapse.scss b/src/styles/collapse.scss index 8a24398c..3a907164 100644 --- a/src/styles/collapse.scss +++ b/src/styles/collapse.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .el-collapse { border-top-color: var(--s-color-base-border-secondary); border-bottom-color: var(--s-color-base-border-secondary); diff --git a/src/styles/common.scss b/src/styles/common.scss index 5909f007..508f9b87 100644 --- a/src/styles/common.scss +++ b/src/styles/common.scss @@ -1,5 +1,3 @@ -@import "./variables"; - [class^="el-"]:not(i):not([class*='el-icon']), [class*="el-"]:not(i):not([class*='el-icon']) { font-family: $s-font-family-default; diff --git a/src/styles/datepicker.scss b/src/styles/datepicker.scss index 76705c12..e2054d22 100644 --- a/src/styles/datepicker.scss +++ b/src/styles/datepicker.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .s-date-picker { font-family: $s-font-family-default; width: 100%; diff --git a/src/styles/dialog.scss b/src/styles/dialog.scss index d469b2ed..840b6191 100644 --- a/src/styles/dialog.scss +++ b/src/styles/dialog.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .el-dialog { border-radius: 8px; .el-dialog__title { diff --git a/src/styles/dropdown.scss b/src/styles/dropdown.scss index ac7eb2e4..9801d26a 100644 --- a/src/styles/dropdown.scss +++ b/src/styles/dropdown.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .el-dropdown { color: var(--s-color-base-content-primary); > .el-button-group { diff --git a/src/styles/element-variables.scss b/src/styles/element-variables.scss index 61642300..ae861389 100644 --- a/src/styles/element-variables.scss +++ b/src/styles/element-variables.scss @@ -1,5 +1,3 @@ -@import "./variables"; - $--color-primary: $s-color-theme-accent; $--color-danger: $s-color-status-error; $--color-success: $s-color-status-success; diff --git a/src/styles/fonts.scss b/src/styles/fonts.scss index ed2a1131..e5ebf686 100644 --- a/src/styles/fonts.scss +++ b/src/styles/fonts.scss @@ -1,6 +1,6 @@ @font-face { font-family: "soramitsu-icons"; - src: url("~@/assets/fonts/soramitsu-icons.woff"); + src: url("~@/assets/fonts/soramitsu-icons-1.0.0.woff"); font-weight: normal; font-style: normal; font-display: block; diff --git a/src/styles/form.scss b/src/styles/form.scss index eeea8fe7..473f6c56 100644 --- a/src/styles/form.scss +++ b/src/styles/form.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .el-form-item { margin-bottom: 12px; &__content { diff --git a/src/styles/icons.scss b/src/styles/icons.scss index 2aea6089..ee98cbc5 100644 --- a/src/styles/icons.scss +++ b/src/styles/icons.scss @@ -1,5 +1,3 @@ -@import "./variables"; - [class^="s-icon-"], [class*=" s-icon-"] { font-family: 'soramitsu-icons' !important; font-style: normal; diff --git a/src/styles/input.scss b/src/styles/input.scss index 2e748fa6..b4c81805 100644 --- a/src/styles/input.scss +++ b/src/styles/input.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .s-input { font-family: $s-font-family-default; width: 100%; diff --git a/src/styles/json-input.scss b/src/styles/json-input.scss index 2229f1c9..f633a69e 100644 --- a/src/styles/json-input.scss +++ b/src/styles/json-input.scss @@ -1,6 +1,3 @@ -@import "./variables"; -// @import "./icons"; - $color-ide-variable: #0451A5; $color-ide-string: #A31515; $color-ide-number: #098658; diff --git a/src/styles/layout.scss b/src/styles/layout.scss index c16b9c73..7eabcde8 100644 --- a/src/styles/layout.scss +++ b/src/styles/layout.scss @@ -1,5 +1,3 @@ -@import "./common"; - $box-shadow-layout: 0px 0px 8px rgba(45, 41, 38, 0.2); $font-size-layout: 18px; diff --git a/src/styles/pagination.scss b/src/styles/pagination.scss index 5f7805c1..32cb4d05 100644 --- a/src/styles/pagination.scss +++ b/src/styles/pagination.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .el-pagination { &.is-background .el-pager li:not(.disabled) { &.active { diff --git a/src/styles/radio.scss b/src/styles/radio.scss index 1763dc82..2135b5b7 100644 --- a/src/styles/radio.scss +++ b/src/styles/radio.scss @@ -1,6 +1,3 @@ -@import "./variables"; -@import "./common"; - $radio-button-class: ".el-radio-button"; $radio-button-border-width: 1px; $radio-button-border-color: var(--s-color-theme-accent); diff --git a/src/styles/scroll-sections.scss b/src/styles/scroll-sections.scss index 8cb89fdf..cfa4a1a1 100644 --- a/src/styles/scroll-sections.scss +++ b/src/styles/scroll-sections.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .s-scroll-sections { font-family: $s-font-family-default; font-size: 14px; diff --git a/src/styles/select.scss b/src/styles/select.scss index 7af02217..83b65ab7 100644 --- a/src/styles/select.scss +++ b/src/styles/select.scss @@ -1,6 +1,3 @@ -@import "./variables"; -@import "./icons"; - .s-select { font-family: $s-font-family-default; width: 100%; diff --git a/src/styles/slider.scss b/src/styles/slider.scss index 1c02c827..477ede57 100644 --- a/src/styles/slider.scss +++ b/src/styles/slider.scss @@ -1,5 +1,3 @@ -@import "./variables"; - @mixin slider-colors( $background-color: --s-color-theme-accent, $border-color: $background-color, diff --git a/src/styles/switch.scss b/src/styles/switch.scss index 86ec5ac0..b176320d 100644 --- a/src/styles/switch.scss +++ b/src/styles/switch.scss @@ -1,5 +1,3 @@ -@import "./variables"; - $switch-class: ".el-switch"; .s-switch { diff --git a/src/styles/table.scss b/src/styles/table.scss index f4a3319c..fadd0078 100644 --- a/src/styles/table.scss +++ b/src/styles/table.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .el-table, .el-table__header-wrapper tbody td, .el-table__footer-wrapper tbody td { diff --git a/src/styles/tabs.scss b/src/styles/tabs.scss index 7df25f8f..b86e52b6 100644 --- a/src/styles/tabs.scss +++ b/src/styles/tabs.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .s-tabs { width: 100%; .el-tabs__item { diff --git a/src/styles/tooltip.scss b/src/styles/tooltip.scss index 5bb1cc99..2e28040c 100644 --- a/src/styles/tooltip.scss +++ b/src/styles/tooltip.scss @@ -1,5 +1,3 @@ -@import "./variables"; - .el-tooltip__popper { &.is-dark { background-color: var(--s-color-base-content-primary); diff --git a/src/styles/variables.scss b/src/styles/variables.scss index f9b61c17..b23829bd 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -10,7 +10,7 @@ $s-color-theme-secondary-pressed: #F1C0D2 !default; $s-color-theme-secondary-focused: #EDABC3 !default; // Base content colors $s-color-base-content-primary: #2D2926 !default; -$s-color-base-content-secondary: #53565A !default; // not used +$s-color-base-content-secondary: #53565A !default; $s-color-base-content-tertiary: #75787B !default; $s-color-base-content-quaternary: #A3A4A8 !default; // Base misc colors @@ -86,6 +86,7 @@ $--breakpoints-spec: ( ); :root { + // Colors --s-color-theme-accent: #{$s-color-theme-accent}; --s-color-theme-accent-hover: #{$s-color-theme-accent-hover}; --s-color-theme-accent-pressed: #{$s-color-theme-accent-pressed}; @@ -115,4 +116,11 @@ $--breakpoints-spec: ( --s-color-status-success-background: #{$s-color-status-success-background}; --s-color-status-warning-background: #{$s-color-status-warning-background}; --s-color-status-error-background: #{$s-color-status-error-background}; + // Shadows + --s-shadow-surface: #{$s-shadow-surface}; + --s-shadow-tooltip: #{$s-shadow-tooltip}; + --s-shadow-tab: #{$s-shadow-tab}; + --s-shadow-dropdown: #{$s-shadow-dropdown}; + --s-shadow-mobile-tap-bar: #{$s-shadow-mobile-tap-bar}; + --s-shadow-mobile-side-menu: #{$s-shadow-mobile-side-menu}; } From 08c1a9896cb0cb6818c99c04bee3ba1ccf54216d Mon Sep 17 00:00:00 2001 From: Alex Natalia <38787212+alexnatalia@users.noreply.github.com> Date: Wed, 18 Nov 2020 14:32:55 +0300 Subject: [PATCH 07/16] Release/0.6.0 (#92) * Added Border Radius configuration. * Updated Tabs, Table, Button, Card, Dialog, Checkbox, Pagination, Input, Select, Date Picker, Tooltip, Dropdown, Form, Radio, Menu components and stories. * Added Size and Border Radius mixins, embedded mixins to components. Co-authored-by: Stefan Popov --- package.json | 2 +- src/components/Button/SButton.vue | 27 +++----- src/components/Button/consts.ts | 4 -- src/components/Button/index.ts | 4 +- src/components/Card/SCard.vue | 18 ++++- src/components/Checkbox/SCheckbox.vue | 26 +++---- src/components/Checkbox/consts.ts | 3 - src/components/Checkbox/index.ts | 3 +- src/components/DatePicker/SDatePicker.vue | 35 ++++++---- src/components/DatePicker/consts.ts | 4 -- src/components/DatePicker/index.ts | 5 +- src/components/Dialog/SDialog.vue | 19 ++++- src/components/Dropdown/SDropdown.vue | 45 +++++++----- src/components/Dropdown/consts.ts | 4 -- src/components/Dropdown/index.ts | 3 +- src/components/Form/SForm.vue | 1 + src/components/Form/SFormItem.vue | 3 +- src/components/Input/SInput.vue | 10 ++- src/components/Menu/SMenu.vue | 15 +++- src/components/Pagination/SPagination.vue | 28 +++++++- src/components/Radio/SRadio.vue | 14 ++-- src/components/Radio/SRadioGroup.vue | 14 ++-- src/components/Radio/consts.ts | 3 - src/components/Radio/index.ts | 3 +- src/components/Select/SSelect.vue | 24 ++++++- src/components/Tab/STabs.vue | 8 ++- src/components/Table/STable.vue | 15 ++-- src/components/Table/consts.ts | 2 - src/components/Table/index.ts | 5 +- src/components/Tooltip/STooltip.vue | 21 +++++- src/mixins/BorderRadiusMixin.ts | 16 +++++ src/mixins/SizeMixin.ts | 23 ++++++ src/stories/Dropdown/SDropdown.stories.ts | 14 +++- src/stories/Intro/Customization.stories.ts | 27 +++++++- src/stories/Menu/SMenu.stories.ts | 20 ++++++ src/stories/SButton.stories.ts | 31 ++++++++- src/stories/SCard.stories.ts | 8 ++- src/stories/SCheckbox.stories.ts | 33 ++++++++- src/stories/SDatePicker.stories.ts | 8 ++- src/stories/SDialog.stories.ts | 7 +- src/stories/SInput.stories.ts | 5 ++ src/stories/SPagination.stories.ts | 8 ++- src/stories/SRadio.stories.ts | 6 +- src/stories/STooltip.stories.ts | 5 ++ src/stories/Select/SSelect.stories.ts | 8 ++- src/stories/Tab/STabs.stories.ts | 5 ++ src/stories/Table/STable.stories.ts | 4 +- src/styles/button.scss | 1 - src/styles/card.scss | 1 - src/styles/checkbox.scss | 33 +++++++-- src/styles/common.scss | 18 ++++- src/styles/datepicker.scss | 81 ++++++++++++++++------ src/styles/dialog.scss | 23 +++++- src/styles/dropdown.scss | 18 +++++ src/styles/input.scss | 26 ++++++- src/styles/json-input.scss | 4 +- src/styles/menu.scss | 25 +++++-- src/styles/pagination.scss | 51 +++++++++++--- src/styles/select.scss | 30 ++++++-- src/styles/table.scss | 2 +- src/styles/tabs.scss | 50 ++++++++++--- src/styles/variables.scss | 17 ++++- src/types/index.ts | 7 ++ 63 files changed, 747 insertions(+), 236 deletions(-) delete mode 100644 src/components/Checkbox/consts.ts delete mode 100644 src/components/Radio/consts.ts create mode 100644 src/mixins/BorderRadiusMixin.ts create mode 100644 src/mixins/SizeMixin.ts diff --git a/package.json b/package.json index b4faac03..38c7556d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soramitsu/soramitsu-js-ui", - "version": "0.5.8", + "version": "0.6.0", "private": false, "publishConfig": { "registry": "https://nexus.iroha.tech/repository/npm-soramitsu-private/" diff --git a/src/components/Button/SButton.vue b/src/components/Button/SButton.vue index 14cb1635..e2cecedc 100644 --- a/src/components/Button/SButton.vue +++ b/src/components/Button/SButton.vue @@ -20,19 +20,21 @@ diff --git a/src/components/Tooltip/consts.ts b/src/components/Tooltip/consts.ts index 436ddd8e..1a6d613b 100644 --- a/src/components/Tooltip/consts.ts +++ b/src/components/Tooltip/consts.ts @@ -1,6 +1,7 @@ export enum TooltipTheme { DARK = 'dark', - LIGHT = 'light' + LIGHT = 'light', + AUTO = 'auto' } export enum TooltipPlacement { diff --git a/src/index.ts b/src/index.ts index 68a17fe3..86d79d9d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -50,6 +50,8 @@ import { import { Float, Integer } from './directives' import { Components } from './types/components' import { Directives } from './types/directives' +import { modules, Modules } from './store' +import { setTheme } from './utils' import { Loading, Message, MessageBox, Notification } from './plugins/elementUI' const components = [ @@ -106,7 +108,13 @@ const directives = [ ] const SoramitsuElements = { - install (vue: typeof Vue): void { + install (vue: typeof Vue, options?: any): void { + // TODO: maybe we'll need error message about storage here + if (options && options.store) { + Object.values(Modules).forEach(molude => { + options.store.registerModule(molude, modules[molude]) + }) + } components.forEach(el => vue.component(el.name, el.component)) directives.forEach(item => vue.directive(item.name, item.directive)) } @@ -117,6 +125,7 @@ if (typeof window !== 'undefined' && window.Vue) { } export { + setTheme, Loading, Message, MessageBox, diff --git a/src/store/Theme.ts b/src/store/Theme.ts new file mode 100644 index 00000000..0e0ccf66 --- /dev/null +++ b/src/store/Theme.ts @@ -0,0 +1,50 @@ +import map from 'lodash/fp/map' +import flatMap from 'lodash/fp/flatMap' +import fromPairs from 'lodash/fp/fromPairs' +import flow from 'lodash/fp/flow' +import concat from 'lodash/fp/concat' + +import { Theme, Themes } from '../utils/Theme' + +const types = flow( + flatMap(x => [x + '_REQUEST', x + '_SUCCESS', x + '_FAILURE']), + concat([ + 'CHANGE_THEME' + ]), + map(x => [x, x]), + fromPairs +)([]) + +function initialState () { + return { + theme: Themes.LIGHT + } +} + +const state = initialState() + +const getters = { + libraryTheme (state) { + return state.theme + } +} + +const mutations = { + [types.CHANGE_THEME] (state, theme: Theme) { + state.theme = theme + } +} + +const actions = { + changeTheme ({ commit }, { theme }) { + commit(types.CHANGE_THEME, theme) + } +} + +export default { + types, + state, + getters, + mutations, + actions +} diff --git a/src/store/index.ts b/src/store/index.ts new file mode 100644 index 00000000..c8d35ae7 --- /dev/null +++ b/src/store/index.ts @@ -0,0 +1,25 @@ +import Vue from 'vue' +import Vuex from 'vuex' + +import Theme from './Theme' + +const modules = { + Theme +} + +Vue.use(Vuex) + +const store = new Vuex.Store({ + modules, + strict: process.env.NODE_ENV !== 'production' +}) + +export { + modules +} + +export enum Modules { + Theme = 'Theme' +} + +export default store diff --git a/src/stories/Dropdown/SDropdown.stories.ts b/src/stories/Dropdown/SDropdown.stories.ts index b01e3d03..b1bb21c6 100644 --- a/src/stories/Dropdown/SDropdown.stories.ts +++ b/src/stories/Dropdown/SDropdown.stories.ts @@ -17,7 +17,7 @@ export const configurable = () => ({ template: ` ({ diff --git a/src/stories/Menu/SMenu.stories.ts b/src/stories/Menu/SMenu.stories.ts index 246c197b..01e7ab66 100644 --- a/src/stories/Menu/SMenu.stories.ts +++ b/src/stories/Menu/SMenu.stories.ts @@ -13,7 +13,7 @@ export const basicMenu = () => ({ template: ` @@ -62,7 +62,7 @@ export const sideBar = () => ({ template: ` @@ -121,7 +121,7 @@ export const topBar = () => ({ template: ` Navigator One diff --git a/src/stories/SButton.stories.ts b/src/stories/SButton.stories.ts index 83cee41b..a0d61544 100644 --- a/src/stories/SButton.stories.ts +++ b/src/stories/SButton.stories.ts @@ -20,7 +20,7 @@ export const configurable = () => ({ :icon="type === 'action' ? 'back' : ''" :type="type" :size="size" - :borderRadius="borderRadius" + :border-radius="borderRadius" :rounded="rounded" :alternative="alternative" @click="handleClick" @@ -117,7 +117,7 @@ export const withDifferentBorderRadius = () => ({ {{ item.label }} diff --git a/src/stories/SCard.stories.ts b/src/stories/SCard.stories.ts index 1150b755..b98d05e8 100644 --- a/src/stories/SCard.stories.ts +++ b/src/stories/SCard.stories.ts @@ -13,11 +13,11 @@ export default { export const configurable = () => ({ components: { SCard, SRow, SDropdown, SDropdownItem }, template: ` - +