({
components: { SRadio, SRow, SCol },
template: `
-
- changeValue = value"
- >
- {{ item.title }}
-
-
-
- v-model="{{ vModelValue }}", @change="{{ changeValue }}"
-
- `,
+
+ changeValue = value"
+ >
+ {{ item.title }}
+
+
+
+ v-model="{{ vModelValue }}", @change="{{ changeValue }}"
+
+ `,
data: () => ({
vModelValue: 'first',
changeValue: '',
@@ -55,16 +55,16 @@ export const configurable = () => ({
export const disabled = () => ({
components: { SRadio, SRow },
template: `
-
- {{ item.title }}
-
- `,
+
+ {{ item.title }}
+
+ `,
data: () => ({
model: 'first',
items: radioData
@@ -74,18 +74,51 @@ export const disabled = () => ({
export const withBorders = () => ({
components: { SRadio, SRow },
template: `
-
- {{ item.title }}
-
- `,
+
+ {{ item.title }}
+
+ `,
data: () => ({
model: 'first',
items: radioData
})
})
+
+export const radioButtonGroup = () => ({
+ components: { SRadio, SRadioGroup, SRow },
+ template: `
+
+
+ {{ item.title }}
+
+
+
+ v-model="{{ model }}"
+
+ `,
+ data: () => ({
+ model: 'first',
+ items: radioData
+ }),
+ props: {
+ size: {
+ default: select('Size', Object.values(RadioSize), RadioSize.MEDIUM)
+ },
+ disabled: {
+ default: boolean('Disabled', false)
+ }
+ }
+})
diff --git a/src/stories/SSlider.stories.ts b/src/stories/SSlider.stories.ts
index 5f2f76da..57dd9b62 100644
--- a/src/stories/SSlider.stories.ts
+++ b/src/stories/SSlider.stories.ts
@@ -1,13 +1,6 @@
import { text, number, boolean, select, object, withKnobs } from '@storybook/addon-knobs'
-import { SSlider } from '../components/Slider'
-
-enum InputSize {
- LARGE = 'large',
- MEDIUM = 'medium',
- SMALL = 'small',
- MINI = 'mini'
-}
+import { SSlider, SliderInputSize } from '../components/Slider'
export default {
component: SSlider,
@@ -122,7 +115,7 @@ export const withInput = () => ({
default: boolean('Show Input Controls', true)
},
inputSize: {
- default: select('Size of the input box', Object.values(InputSize), InputSize.SMALL)
+ default: select('Size of the input box', Object.values(SliderInputSize), SliderInputSize.SMALL)
},
debounce: {
default: number('Debounce delay when typing (in milliseconds)', 300)
diff --git a/src/stories/SSwitch.stories.ts b/src/stories/SSwitch.stories.ts
index 7ad0ef19..62c76629 100644
--- a/src/stories/SSwitch.stories.ts
+++ b/src/stories/SSwitch.stories.ts
@@ -1,4 +1,4 @@
-import { color, text, number, boolean, withKnobs } from '@storybook/addon-knobs'
+import { text, number, boolean, withKnobs } from '@storybook/addon-knobs'
import { SSwitch } from '../components/Switch'
@@ -14,8 +14,6 @@ export const configurable = () => ({
template: `
({
changeValue: true
}),
props: {
- activeColor: {
- default: color('Active Background Color', 'rgb(208, 2, 27)')
- },
- inactiveColor: {
- default: color('Inactive Background Color', 'rgb(246, 204, 209)')
- },
activeText: {
default: text('Active Text', '')
},
diff --git a/src/styles/radio.scss b/src/styles/radio.scss
index f7a0079d..8b92601b 100644
--- a/src/styles/radio.scss
+++ b/src/styles/radio.scss
@@ -1,6 +1,29 @@
@import "./variables";
@import "./common";
+$radio-button-class: ".el-radio-button";
+$radio-button-border-width: 1px;
+$radio-button-border-color: var(--s-color-main-brand);
+
+@mixin radio-button-size(
+ $modifier: "small",
+ $size: $s-size-small,
+ $font-size: $s-font-size-small
+) {
+ $radio-button-vertical-padding: #{($size - $font-size) / 2 - $radio-button-border-width};
+ #{$radio-button-class} {
+ &--#{$modifier} {
+ height: $size;
+ line-height: $size;
+ #{$radio-button-class}__inner {
+ padding-top: $radio-button-vertical-padding;
+ padding-bottom: $radio-button-vertical-padding;
+ font-size: $font-size;
+ }
+ }
+ }
+}
+
.el-radio {
color: var(--s-color-basic-black);
&.s-big {
@@ -98,4 +121,91 @@
}
}
}
+ &-button {
+ &:hover {
+ #{$radio-button-class}__inner {
+ border-color: $radio-button-border-color;
+ color: var(--s-color-main-brand);
+ }
+ &:not(:first-child):not(.is-disabled) {
+ #{$radio-button-class}__inner {
+ &:before {
+ opacity: 1;
+ }
+ }
+ }
+ }
+ &:not(:first-child):not(.is-disabled) {
+ #{$radio-button-class}__inner {
+ position: relative;
+ &:before {
+ content: "";
+ position: absolute;
+ display: block;
+ opacity: 0;
+ background-color: $radio-button-border-color;
+ height: calc(100% + #{$radio-button-border-width * 2});
+ width: $radio-button-border-width;
+ left: -#{$radio-button-border-width};
+ top: -#{$radio-button-border-width};
+ transition: inherit;
+ transition-property: opacity;
+ }
+ }
+ }
+ &.is-disabled {
+ #{$radio-button-class}__inner {
+ color: var(--s-color-neutral-inactive);
+ }
+ }
+ &.is-disabled,
+ &.is-disabled:hover {
+ #{$radio-button-class}__inner {
+ border-color: var(--s-color-neutral-border);
+ }
+ }
+ &.is-active {
+ &:hover {
+ #{$radio-button-class}__inner {
+ background-color: var(--s-color-main-hover);
+ border-color: var(--s-color-main-hover);
+ }
+ }
+ &.is-disabled {
+ #{$radio-button-class}__inner {
+ color: var(--s-color-basic-white);
+ }
+ }
+ &.is-disabled,
+ &.is-disabled:hover {
+ #{$radio-button-class}__inner {
+ background-color: var(--s-color-main-inactive);
+ border-color: var(--s-color-main-inactive);
+ }
+ }
+ }
+ }
+ &-group {
+ @include radio-button-size;
+ @include radio-button-size("medium", $s-size-medium, $s-font-size-big);
+ @include radio-button-size("big", $s-size-big, $s-font-size-big);
+ #{$radio-button-class} {
+ &__inner {
+ background-color: var(--s-color-basic-white);
+ border-color: var(--s-color-neutral-border);
+ color: var(--s-color-basic-black);
+ }
+ #{$radio-button-class}__inner {
+ box-shadow: none;
+ }
+ }
+ .is-disabled #{$radio-button-class}__inner {
+ background-color: var(--s-color-basic-white);
+ }
+ .is-active #{$radio-button-class}__inner {
+ background-color: var(--s-color-main-brand);
+ border-color: var(--s-color-main-brand);
+ color: var(--s-color-basic-white);
+ }
+ }
}
diff --git a/src/styles/slider.scss b/src/styles/slider.scss
index 0c35fafb..7940b83e 100644
--- a/src/styles/slider.scss
+++ b/src/styles/slider.scss
@@ -35,6 +35,9 @@
&__marks-text {
color: var(--s-color-basic-black);
}
+ &__bar {
+ background-color: var(--s-color-main-brand);
+ }
}
.disabled {
.el-slider__bar {
@@ -93,5 +96,5 @@
@include slider-input-size;
@include slider-input-size("small", $s-size-small);
@include slider-input-size("medium", $s-size-medium);
- @include slider-input-size("large", $s-size-big);
+ @include slider-input-size("big", $s-size-big);
}
diff --git a/src/styles/switch.scss b/src/styles/switch.scss
index 7db1a641..ef8f32d1 100644
--- a/src/styles/switch.scss
+++ b/src/styles/switch.scss
@@ -1,10 +1,47 @@
@import "./variables";
+$switch-class: ".el-switch";
+
.s-switch {
- .el-switch__label {
- color: var(--s-color-basic-black);
- &.is-active {
- color: var(--s-color-main-brand);
+ #{$switch-class} {
+ &__label {
+ color: var(--s-color-basic-black);
+ &.is-active {
+ color: var(--s-color-main-brand);
+ }
+ }
+ &__core {
+ border-color: var(--s-color-neutral-border);
+ background-color: var(--s-color-neutral-border);
+ &:after {
+ background-color: var(--s-color-basic-white);
+ }
+ }
+ &:hover,
+ &.is-checked:hover {
+ #{$switch-class}__core {
+ background-color: var(--s-color-main-hover);
+ border-color: var(--s-color-main-hover);
+ }
+ }
+ &.is-disabled {
+ opacity: 1;
+ #{$switch-class}__core {
+ background-color: var(--s-color-neutral-placeholder);
+ border-color: var(--s-color-neutral-placeholder);
+ }
+ }
+ &.is-checked {
+ #{$switch-class}__core {
+ background-color: var(--s-color-main-brand);
+ border-color: var(--s-color-main-brand);
+ }
+ &.is-disabled {
+ #{$switch-class}__core {
+ background-color: var(--s-color-main-inactive);
+ border-color: var(--s-color-main-inactive);
+ }
+ }
}
}
}
diff --git a/src/styles/variables.scss b/src/styles/variables.scss
index 5b8ccd38..4d403700 100644
--- a/src/styles/variables.scss
+++ b/src/styles/variables.scss
@@ -27,6 +27,10 @@ $s-border-radius-default: 4px !default;
// Fonts
$font-family-default: 'Sora', sans-serif !important;
$font-family-mono: 'JetBrainsMono', monospace !important;
+// Font sizes
+$s-font-size-big: 14px !default;
+$s-font-size-small: 12px !default;
+
// Responsive
$--sm: 640px !default;
$--md: 1024px !default;
diff --git a/src/types/components.ts b/src/types/components.ts
index 040e6aa0..2f3923f9 100644
--- a/src/types/components.ts
+++ b/src/types/components.ts
@@ -31,6 +31,7 @@ export enum Components {
SOptionGroup = 'SOptionGroup',
SPagination = 'SPagination',
SRadio = 'SRadio',
+ SRadioGroup = 'SRadioGroup',
SRow = 'SRow',
SScrollSectionItem = 'SScrollSectionItem',
SScrollSections = 'SScrollSections',