Delete
Save
Warn
Hover
Transparent
diff --git a/src/components/v-button/v-button.test.ts b/src/components/v-button/v-button.test.ts
index e15f9a6d4f..f835fc8b76 100644
--- a/src/components/v-button/v-button.test.ts
+++ b/src/components/v-button/v-button.test.ts
@@ -75,30 +75,10 @@ describe('Button', () => {
expect(component.classes()).toContain('loading');
});
- it('Sets the correct CSS variables for custom colors', () => {
- const component = mount(VButton, {
- localVue,
- propsData: {
- color: '--red',
- hoverColor: '--blue',
- backgroundColor: '--green',
- hoverBackgroundColor: '--yellow'
- }
- });
-
- expect((component.vm as any).styles['--_v-button-color']).toBe('var(--red)');
- expect((component.vm as any).styles['--_v-button-hover-color']).toBe('var(--blue)');
- expect((component.vm as any).styles['--_v-button-background-color']).toBe('var(--green)');
- expect((component.vm as any).styles['--_v-button-hover-background-color']).toBe(
- 'var(--yellow)'
- );
- });
-
describe('Sizes', () => {
const component = mount(VButton, {
localVue,
propsData: {
- color: '--blue-grey',
name: 'person'
}
});
@@ -142,16 +122,5 @@ describe('Button', () => {
});
component.vm.$nextTick(() => expect(component.classes()).toContain('x-large'));
});
-
- it('Sets the correct custom width', () => {
- const component = mount(VButton, {
- localVue,
- propsData: {
- width: 56
- }
- });
-
- expect((component.vm as any).styles.width).toBe('56px');
- });
});
});
diff --git a/src/components/v-button/v-button.vue b/src/components/v-button/v-button.vue
index f5100cbfc8..45d8d801b8 100644
--- a/src/components/v-button/v-button.vue
+++ b/src/components/v-button/v-button.vue
@@ -3,7 +3,6 @@
class="v-button"
:class="[sizeClass, { block, rounded, icon, outlined, loading }]"
:type="type"
- :style="styles"
:disabled="disabled"
@click="!loading ? $emit('click') : null"
>
@@ -38,22 +37,6 @@ export default createComponent({
type: Boolean,
default: false
},
- color: {
- type: String,
- default: '--button-primary-text-color'
- },
- backgroundColor: {
- type: String,
- default: '--button-primary-background-color'
- },
- hoverColor: {
- type: String,
- default: '--button-primary-text-color'
- },
- hoverBackgroundColor: {
- type: String,
- default: '--button-primary-background-color-hover'
- },
type: {
type: String,
default: 'button'
@@ -66,10 +49,6 @@ export default createComponent({
type: Boolean,
default: false
},
- width: {
- type: Number,
- default: null
- },
xSmall: {
type: Boolean,
default: false
@@ -88,29 +67,6 @@ export default createComponent({
}
},
setup(props) {
- interface Styles {
- '--_v-button-color': string;
- '--_v-button-background-color': string;
- '--_v-button-hover-color': string;
- '--_v-button-hover-background-color': string;
- width?: string;
- }
-
- const styles = computed
(() => {
- let styles: Styles = {
- '--_v-button-color': parseCSSVar(props.color),
- '--_v-button-background-color': parseCSSVar(props.backgroundColor),
- '--_v-button-hover-color': parseCSSVar(props.hoverColor),
- '--_v-button-hover-background-color': parseCSSVar(props.hoverBackgroundColor)
- };
-
- if (props.width && +props.width > 0) {
- styles.width = props.width + 'px';
- }
-
- return styles;
- });
-
const sizeClass = computed(() => {
if (props.xSmall) return 'x-small';
if (props.small) return 'small';
@@ -119,26 +75,33 @@ export default createComponent({
return null;
});
- return { styles, sizeClass };
+ return { sizeClass };
}
});
```
## Boolean vs arrays
@@ -67,26 +85,27 @@ If you can't, you should listen to the `update:indeterminate` event and respond
```
-## Events
+## Props
+| Prop | Description | Default |
+|-----------------|--------------------------------------------------------------------------|---------|
+| `value` | Value for checkbox. Similar to value attr on checkbox type input in HTML | `--` |
+| `inputValue` | Value that's used with `v-model`. Either boolean or array of values | `false` |
+| `label` | Label for the checkbox | `--` |
+| `disabled` | Disable the checkbox | `false` |
+| `indeterminate` | Show the indeterminate state | `false` |
+## Slots
+| Slot | Description |
+|---------|------------------------------------------------------------------------------------------------|
+| `label` | Allows custom markup and HTML to be rendered inside the label. Will override the `label` prop. |
+
+## Events
| Event | Description | Data |
|------------------------|----------------------------|----------------------------|
| `change` | New state for the checkbox | Boolean or array of values |
| `update:indeterminate` | New state for the checkbox | Boolean or array of values |
-## Props
-
-| Prop | Description | Default |
-|-----------------|--------------------------------------------------------------------------------------------------------|-----------------------------------|
-| `value` | Value for checkbox. Similar to value attr on checkbox type input in HTML | `--` |
-| `inputValue` | Value that's used with `v-model`. Either boolean or array of values | `false` |
-| `label` | Label for the checkbox | `--` |
-| `color` | Color for the checked state of the checkbox. Either CSS var name (fe `--red`) or other valid CSS color | `--input-background-color-active` |
-| `disabled` | Disable the checkbox | `false` |
-| `indeterminate` | Show the indeterminate state | `false` |
-
-## Slots
-
-| Slot | Description |
-|---------|------------------------------------------------------------------------------------------------|
-| `label` | Allows custom markup and HTML to be rendered inside the label. Will override the `label` prop. |
+## CSS Variables
+| Variable | Default |
+|----------------------|----------------------------------------|
+| `--v-checkbox-color` | `var(--input-background-color-active)` |
diff --git a/src/components/v-checkbox/v-checkbox.story.ts b/src/components/v-checkbox/v-checkbox.story.ts
index 4a373a77fb..291139921b 100644
--- a/src/components/v-checkbox/v-checkbox.story.ts
+++ b/src/components/v-checkbox/v-checkbox.story.ts
@@ -94,10 +94,10 @@ export const colors = () => ({
},
template: `
-
-
-
-
+
+
+
+
`
});
diff --git a/src/components/v-checkbox/v-checkbox.test.ts b/src/components/v-checkbox/v-checkbox.test.ts
index 8358040a0e..1cc7f3d99f 100644
--- a/src/components/v-checkbox/v-checkbox.test.ts
+++ b/src/components/v-checkbox/v-checkbox.test.ts
@@ -118,22 +118,6 @@ describe('Checkbox', () => {
expect((component.vm as any).icon).toBe('indeterminate_check_box');
});
- it('Renders the correct iconColor for state', () => {
- const component = mount(VCheckbox, {
- localVue,
- propsData: {
- inputValue: false,
- color: '--red'
- }
- });
-
- expect((component.vm as any).iconColor).toBe('--input-border-color');
-
- component.setProps({ inputValue: true });
-
- expect((component.vm as any).iconColor).toBe('--red');
- });
-
it('Emits the update:indeterminate event when the checkbox is toggled when indeterminate', () => {
const component = mount(VCheckbox, {
localVue,
diff --git a/src/components/v-checkbox/v-checkbox.vue b/src/components/v-checkbox/v-checkbox.vue
index 9d70c9483e..a0779a3640 100644
--- a/src/components/v-checkbox/v-checkbox.vue
+++ b/src/components/v-checkbox/v-checkbox.vue
@@ -6,8 +6,9 @@
role="checkbox"
:aria-pressed="isChecked ? 'true' : 'false'"
:disabled="disabled"
+ :class="{ checked: isChecked }"
>
-
+
{{ label }}
@@ -36,10 +37,6 @@ export default createComponent({
type: String,
default: null
},
- color: {
- type: String,
- default: '--input-background-color-active'
- },
disabled: {
type: Boolean,
default: false
@@ -63,13 +60,7 @@ export default createComponent({
return isChecked.value ? 'check_box' : 'check_box_outline_blank';
});
- const iconColor = computed(() => {
- if (props.disabled) return '--input-background-color-disabled';
- if (isChecked.value) return props.color;
- return '--input-border-color';
- });
-
- return { isChecked, toggleInput, icon, iconColor };
+ return { isChecked, toggleInput, icon };
function toggleInput(): void {
if (props.indeterminate) {
@@ -96,6 +87,8 @@ export default createComponent({
diff --git a/src/components/v-chip/v-chip.readme.md b/src/components/v-chip/v-chip.readme.md
index 4adb77740c..4996c656e6 100644
--- a/src/components/v-chip/v-chip.readme.md
+++ b/src/components/v-chip/v-chip.readme.md
@@ -20,20 +20,21 @@ The chip component supports the following sizes through the use of props:
## Colors
-You can set the color, background color, hover color, and background hover color with the `color`, `background-color`, `hover-color`, and `hover-background-color` props respectively:
+You can set the color, background color, hover color, and background hover color with the `--v-chip-color`, `--v-chip-background-color`, `--v-chip-hover-color`, and `--v-chip-hover-background-color` css variables respectively:
```html
-
- I'm a chip!
-
+ I'm a chip!
+
```
-## Events
+## Clicks / Closes
There are two events, one when clicking on the chip called `click` and one when clicking on the enabled close icon called `close`.
@@ -42,26 +43,35 @@ There are two events, one when clicking on the chip called `click` and one when
I'm closeable!
```
+## Props
+| Prop | Description | Default |
+|-------------|------------------------------------------------------|---------|
+| `active` | Change visibility. Can be reacted to via `sync` | `true` |
+| `close` | Displays a close icon which triggers the close event | `false` |
+| `closeIcon` | Which icon should be displayed instead of `close ` | `close` |
+| `outlined` | No background | `false` |
+| `label` | Label style | `false` |
+| `disabled` | Disabled state | `false` |
+| `x-small` | Render extra small | `false` |
+| `small` | Render small | `false` |
+| `large` | Render large | `false` |
+| `x-large` | Render extra large | `false` |
+
+## Slots
+| Slot | Description | Data |
+|-----------|-------------|------|
+| _default_ | | -- |
+
+## Events
| Event | Description |
|---------|------------------------------------------------------------------------------------------------|
| `click` | Triggers when clicked somewhere on the chip |
| `close` | Triggers when the `close` prop is enabled and gets clicked (Doesn't trigger the `click` event) |
-## Props
-
-| Prop | Description | Default |
-|--------------------------|------------------------------------------------------|-----------------------------------------|
-| `active` | Change visibility. Can be reacted to via `sync` | `true` |
-| `close` | Displays a close icon which triggers the close event | `false` |
-| `closeIcon` | Which icon should be displayed instead of `close ` | `close` |
-| `outlined` | No background | `false` |
-| `color` | Text color | `--chip-primary-text-color` |
-| `hover-color` | Text color on hover | `--chip-primary-text-color` |
-| `background-color` | Chip color | `--chip-primary-background-color` |
-| `hover-background-color` | Chip color on hover | `--chip-primary-background-color-hover` |
-| `label` | Label style | `false` |
-| `disabled` | Disabled state | `false` |
-| `x-small` | Render extra small | `false` |
-| `small` | Render small | `false` |
-| `large` | Render large | `false` |
-| `x-large` | Render extra large | `false` |
+## CSS Variables
+| Variable | Default |
+|-----------------------------------|----------------------------------------------|
+| `--v-chip-color` | `var(--chip-primary-text-color)` |
+| `--v-chip-background-color` | `var(--chip-primary-background-color)` |
+| `--v-chip-hover-color` | `var(--chip-primary-text-color)` |
+| `--v-chip-hover-background-color` | `var(--chip-primary-background-color-hover)` |
diff --git a/src/components/v-chip/v-chip.story.ts b/src/components/v-chip/v-chip.story.ts
index 10f749dbdb..217fe0b822 100644
--- a/src/components/v-chip/v-chip.story.ts
+++ b/src/components/v-chip/v-chip.story.ts
@@ -1,4 +1,11 @@
-import { withKnobs, text, boolean, number, optionsKnob as options } from '@storybook/addon-knobs';
+import {
+ withKnobs,
+ text,
+ boolean,
+ number,
+ color,
+ optionsKnob as options
+} from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';
import Vue from 'vue';
import VChip from './v-chip.vue';
@@ -57,20 +64,16 @@ export const withText = () => ({
default: boolean('Active', true, 'Button')
},
color: {
- default: text('Color', '--chip-primary-text-color', 'Colors')
+ default: color('Color', '#000000', 'Colors')
},
backgroundColor: {
- default: text('Background Color', '--chip-primary-background-color', 'Colors')
+ default: color('Background Color', '#cfd8dc', 'Colors')
},
hoverColor: {
- default: text('Color (hover)', '--chip-primary-text-color', 'Colors')
+ default: color('Color (hover)', '#000000', 'Colors')
},
hoverBackgroundColor: {
- default: text(
- 'Background Color (hover)',
- '--chip-primary-background-color-hover',
- 'Colors'
- )
+ default: color('Background Color (hover)', '#b0bec5', 'Colors')
}
},
template: `
@@ -78,11 +81,13 @@ export const withText = () => ({
:active.sync="active"
:label="label"
:outlined="outlined"
- :color="color"
:close="close"
- :background-color="backgroundColor"
- :hover-color="hoverColor"
- :hover-background-color="hoverBackgroundColor"
+ :style="{
+ '--v-chip-color': color,
+ '--v-chip-background-color': backgroundColor,
+ '--v-chip-hover-color': hoverColor,
+ '--v-chip-hover-background-color': hoverBackgroundColor
+ }"
:disabled="disabled"
:x-small="size === 'xSmall'"
:small="size === 'small'"
@@ -155,20 +160,16 @@ export const withIcon = () => ({
default: boolean('Active', true, 'Button')
},
color: {
- default: text('Color', '--chip-primary-text-color', 'Colors')
+ default: color('Color', '#000000', 'Colors')
},
backgroundColor: {
- default: text('Background Color', '--chip-primary-background-color', 'Colors')
+ default: color('Background Color', '#cfd8dc', 'Colors')
},
hoverColor: {
- default: text('Color (hover)', '--chip-primary-text-color', 'Colors')
+ default: color('Color (hover)', '#000000', 'Colors')
},
hoverBackgroundColor: {
- default: text(
- 'Background Color (hover)',
- '--chip-primary-background-color-hover',
- 'Colors'
- )
+ default: color('Background Color (hover)', '#b0bec5', 'Colors')
}
},
template: `
@@ -176,11 +177,13 @@ export const withIcon = () => ({
:active="active"
:label="label"
:outlined="outlined"
- :color="color"
:close="close"
- :background-color="backgroundColor"
- :hover-color="hoverColor"
- :hover-background-color="hoverBackgroundColor"
+ :style="{
+ '--v-chip-color': color,
+ '--v-chip-background-color': backgroundColor,
+ '--v-chip-hover-color': hoverColor,
+ '--v-chip-hover-background-color': hoverBackgroundColor
+ }"
:disabled="disabled"
:x-small="size === 'xSmall'"
:small="size === 'small'"
@@ -206,40 +209,46 @@ export const withColor = () => ({
template: `
Delete
Add Item
Watch out
diff --git a/src/components/v-chip/v-chip.test.ts b/src/components/v-chip/v-chip.test.ts
index 5dda62a1d0..c123ea5059 100644
--- a/src/components/v-chip/v-chip.test.ts
+++ b/src/components/v-chip/v-chip.test.ts
@@ -65,24 +65,6 @@ describe('Chip', () => {
expect(component.find('.close-outline').exists()).toBe(true);
});
- it('Sets the correct CSS variables for custom colors', async () => {
- component.setProps({
- color: '--red',
- hoverColor: '--blue',
- backgroundColor: '--green',
- hoverBackgroundColor: '--yellow'
- });
-
- await component.vm.$nextTick();
-
- expect((component.vm as any).styles['--_v-chip-color']).toBe('var(--red)');
- expect((component.vm as any).styles['--_v-chip-hover-color']).toBe('var(--blue)');
- expect((component.vm as any).styles['--_v-chip-background-color']).toBe('var(--green)');
- expect((component.vm as any).styles['--_v-chip-hover-background-color']).toBe(
- 'var(--yellow)'
- );
- });
-
it('Emits a click event when chip is not disabled', async () => {
component.setProps({
disabled: false
diff --git a/src/components/v-chip/v-chip.vue b/src/components/v-chip/v-chip.vue
index 139dbb6b3a..202f60912f 100644
--- a/src/components/v-chip/v-chip.vue
+++ b/src/components/v-chip/v-chip.vue
@@ -2,7 +2,6 @@
@@ -42,22 +41,6 @@ export default createComponent({
type: Boolean,
default: false
},
- color: {
- type: String,
- default: '--chip-primary-text-color'
- },
- backgroundColor: {
- type: String,
- default: '--chip-primary-background-color'
- },
- hoverColor: {
- type: String,
- default: '--chip-primary-text-color'
- },
- hoverBackgroundColor: {
- type: String,
- default: '--chip-primary-background-color-hover'
- },
label: {
type: Boolean,
default: false
@@ -97,13 +80,6 @@ export default createComponent({
}
});
- const styles = computed(() => ({
- '--_v-chip-color': parseCSSVar(props.color),
- '--_v-chip-background-color': parseCSSVar(props.backgroundColor),
- '--_v-chip-hover-color': parseCSSVar(props.hoverColor),
- '--_v-chip-hover-background-color': parseCSSVar(props.hoverBackgroundColor)
- }));
-
const sizeClass = computed(() => {
if (props.xSmall) return 'x-small';
if (props.small) return 'small';
@@ -112,7 +88,7 @@ export default createComponent({
return null;
});
- return { styles, sizeClass, _active, onClick, onCloseClick };
+ return { sizeClass, _active, onClick, onCloseClick };
function onClick(event: MouseEvent) {
if (props.disabled) return;
@@ -130,19 +106,24 @@ export default createComponent({
```
## Props
diff --git a/src/components/v-hover/v-hover.story.ts b/src/components/v-hover/v-hover.story.ts
index 255a408f90..a775582e8b 100644
--- a/src/components/v-hover/v-hover.story.ts
+++ b/src/components/v-hover/v-hover.story.ts
@@ -18,7 +18,7 @@ export default {
export const basic = () => `
-
+
`;
diff --git a/src/components/v-icon/v-icon.readme.md b/src/components/v-icon/v-icon.readme.md
index 5a591f23fc..31d23e5ff6 100644
--- a/src/components/v-icon/v-icon.readme.md
+++ b/src/components/v-icon/v-icon.readme.md
@@ -4,7 +4,16 @@ The icon component allows you to render any [Material Design Icons](https://mate
## Sizes / Colors
-The icon component supports multiple sizes and colors. The color prop accepts any valid CSS color. CSS variable names can be passed as well.
+The icon component supports multiple sizes and colors. The color prop accepts any valid CSS color. Color changes are done via the css variable `--v-icon-color` like in the example below.
+
+```html
+
+
+```
| Prop Name | Size in PX |
|----------------|------------|
@@ -41,7 +50,6 @@ Oftentimes, you'll use the icon next to some text, for example in a button. When
| Name | Description | Default |
|-----------|-------------------------------------------------------------------|----------------|
| `name`* | Name of the icon | -- |
-| `color` | CSS color variable name (fe `--blue-grey`) or CSS color value | `currentColor` |
| `outline` | Use outline Material Icons. Note: only works for non-custom icons | `false` |
| `size` | Custom pixel size | `false` |
| `x-small` | Render the icon extra small | `false` |
@@ -55,3 +63,12 @@ Oftentimes, you'll use the icon next to some text, for example in a button. When
| Event | Description | Data |
|---------|----------------------|--------------|
| `click` | Standard click event | `MouseEvent` |
+
+## Slots
+n/a
+
+## CSS Variables
+| Variable | Default |
+|------------------|----------------|
+| `--v-icon-color` | `currentColor` |
+| `--v-icon-size` | `24px` |
diff --git a/src/components/v-icon/v-icon.story.ts b/src/components/v-icon/v-icon.story.ts
index e6473dcbaa..dc629dc904 100644
--- a/src/components/v-icon/v-icon.story.ts
+++ b/src/components/v-icon/v-icon.story.ts
@@ -1,4 +1,11 @@
-import { withKnobs, text, boolean, number, optionsKnob as options } from '@storybook/addon-knobs';
+import {
+ withKnobs,
+ text,
+ boolean,
+ number,
+ color,
+ optionsKnob as options
+} from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';
import Vue from 'vue';
import VIcon from '../v-icon/';
@@ -23,7 +30,7 @@ export const interactive = () => ({
default: text('Icon Name', 'person')
},
color: {
- default: text('Color', '--blue-grey-800')
+ default: color('Color', '#37474f')
},
outline: {
default: boolean('Outline', false)
@@ -56,6 +63,7 @@ export const interactive = () => ({
:name="name"
:outline="outline"
:sup="sup"
+ :style="{'--v-icon-color': color}"
:x-small="size === 'xSmall'"
:small="size === 'small'"
:large="size === 'large'"
@@ -65,16 +73,17 @@ export const interactive = () => ({
`
});
-export const superscript = () => `Title`;
+export const superscript = () =>
+ `Title`;
export const sizesAndColors = () => `
-
-
-
-
-
-
+
+
+
+
+
+
`;
diff --git a/src/components/v-icon/v-icon.test.ts b/src/components/v-icon/v-icon.test.ts
index 2fc09f125b..bbfb05bd20 100644
--- a/src/components/v-icon/v-icon.test.ts
+++ b/src/components/v-icon/v-icon.test.ts
@@ -13,19 +13,6 @@ describe('Icon', () => {
component = mount(VIcon, { localVue, propsData: { name: 'person' } });
});
- it('Renders the correct markup for a Material Icon', async () => {
- component.setProps({
- color: '--blue-grey',
- name: 'person'
- });
-
- await component.vm.$nextTick();
-
- expect(component.html()).toContain(
- 'person'
- );
- });
-
it('Renders custom icons as inline