export default {
name: 'Navigation',
+ data() {
+ return {
+ searchString: ''
+ }
+ },
computed: {
routes() {
const routes = this.$router.options.routes.filter(route => {
return route.path !== '*'
})
- return routes.map(route => {
- const [parent, ...children] = [...route.children]
- parent.children = children
- return parent
- })
+ return routes
+ .map(route => {
+ const [parent, ...children] = [...route.children]
+ parent.children = children.filter(this.fitsSearch)
+ return parent
+ })
+ .filter(route => {
+ return route.children.length || this.fitsSearch(route)
+ })
+ },
+ searchParts() {
+ return this.searchString.split(' ')
}
},
methods: {
+ fitsSearch(route) {
+ if (!this.searchString) {
+ return true
+ }
+ return this.searchParts.every(search => {
+ if (!search) {
+ return true
+ }
+ return route.name.toLowerCase().includes(search.toLowerCase())
+ })
+ },
nameParser(route) {
return this.$options.filters.componentName(route.name)
},
@@ -44,4 +74,9 @@ export default {
.navigation {
padding: $space-base $space-x-small;
}
+
+.navigation-search {
+ padding: 0 $space-small;
+ margin-bottom: $space-base;
+}
diff --git a/styleguide/src/styleguide/router/index.js b/styleguide/src/styleguide/router/index.js
index 99eef8094..0bd1ac9ca 100644
--- a/styleguide/src/styleguide/router/index.js
+++ b/styleguide/src/styleguide/router/index.js
@@ -69,10 +69,16 @@ function createComponentRoute(component) {
function createComponentPage(component) {
return {
+ // Necessary to keep reactivity (hot-reload)
+ data() {
+ return {
+ component
+ }
+ },
render: h =>
h(ComponentPage, {
props: {
- component: component
+ component
}
})
}
diff --git a/styleguide/src/system/components/data-display/CopyField/CopyField.vue b/styleguide/src/system/components/data-display/CopyField/CopyField.vue
index 2101c265f..5c15484f8 100644
--- a/styleguide/src/system/components/data-display/CopyField/CopyField.vue
+++ b/styleguide/src/system/components/data-display/CopyField/CopyField.vue
@@ -36,7 +36,7 @@ import DsButton from '@@/components/navigation/Button/Button'
export default {
name: 'DsCopyField',
components: {
- 'ds-button': DsButton
+ DsButton
},
props: {
/**
diff --git a/styleguide/src/system/components/data-display/CopyField/__snapshots__/spec.js.snap b/styleguide/src/system/components/data-display/CopyField/__snapshots__/spec.js.snap
index 5c4e61552..56a87ad61 100644
--- a/styleguide/src/system/components/data-display/CopyField/__snapshots__/spec.js.snap
+++ b/styleguide/src/system/components/data-display/CopyField/__snapshots__/spec.js.snap
@@ -11,7 +11,7 @@ exports[`CopyField.vue matches snapshot 1`] = `
- Copy me please!
+Copy me please!
```
\ No newline at end of file
diff --git a/styleguide/src/system/components/data-display/List/style.scss b/styleguide/src/system/components/data-display/List/style.scss
index e2778ddd2..6d27f14e3 100644
--- a/styleguide/src/system/components/data-display/List/style.scss
+++ b/styleguide/src/system/components/data-display/List/style.scss
@@ -51,9 +51,7 @@ ol > .ds-list-item > .ds-list-item-prefix:before, .ds-list-item-icon {
width: $font-space-xxx-large;
height: $font-space-xxx-large + .4em;
font-size: 0.6em;
- // border-radius: $border-radius-circle;
color: $text-color-soft;
- // background-color: $background-color-softest;
}
ol > .ds-list-item > .ds-list-item-prefix:before {
diff --git a/styleguide/src/system/components/data-display/Table/Table.vue b/styleguide/src/system/components/data-display/Table/Table.vue
index 19544ec35..cedfbaf9e 100644
--- a/styleguide/src/system/components/data-display/Table/Table.vue
+++ b/styleguide/src/system/components/data-display/Table/Table.vue
@@ -155,7 +155,9 @@ export default {
},
methods: {
align(colKey) {
- return this.fields && this.fields[colKey] ? this.fields[colKey].align : null
+ return this.fields && this.fields[colKey]
+ ? this.fields[colKey].align
+ : null
},
parseLabel(label) {
return startCase(label)
diff --git a/styleguide/src/system/components/data-display/Table/TableCol.vue b/styleguide/src/system/components/data-display/Table/TableCol.vue
index a73792aec..75828fa5d 100644
--- a/styleguide/src/system/components/data-display/Table/TableCol.vue
+++ b/styleguide/src/system/components/data-display/Table/TableCol.vue
@@ -33,7 +33,7 @@ export default {
},
/**
* The column align
- * `left, center, right`
+ * @options left|center|right
*/
align: {
type: String,
diff --git a/styleguide/src/system/components/data-display/Table/TableHeadCol.vue b/styleguide/src/system/components/data-display/Table/TableHeadCol.vue
index 60abd4bcc..999871131 100644
--- a/styleguide/src/system/components/data-display/Table/TableHeadCol.vue
+++ b/styleguide/src/system/components/data-display/Table/TableHeadCol.vue
@@ -43,7 +43,7 @@ export default {
},
/**
* The column align
- * `left, center, right`
+ * @options left|center|right
*/
align: {
type: String,
diff --git a/styleguide/src/system/components/data-input/Form/Form.vue b/styleguide/src/system/components/data-input/Form/Form.vue
new file mode 100644
index 000000000..fe84c621d
--- /dev/null
+++ b/styleguide/src/system/components/data-input/Form/Form.vue
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+
+
+
diff --git a/styleguide/src/system/components/data-input/Form/demo.md b/styleguide/src/system/components/data-input/Form/demo.md
new file mode 100644
index 000000000..4ca238131
--- /dev/null
+++ b/styleguide/src/system/components/data-input/Form/demo.md
@@ -0,0 +1,130 @@
+## Basic usage
+
+Most commonly you want the form to handle a set of data and display appropriate input fields for each piece of data.
+
+```html
+
+
+
+
+
+ Login
+
+
+
+
+```
+
+## Advanced usage / Validation
+
+Use a schema to provide validation for the form inputs. Use scoped slots to get access to the forms errors and functions like reset.
+
+```html
+
+
+
+
+
+
+
+
+
+
+ Reset form
+
+
+ Save profile
+
+
+
+
+
+
+```
diff --git a/styleguide/src/system/components/data-input/Form/style.scss b/styleguide/src/system/components/data-input/Form/style.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/styleguide/src/system/components/data-input/FormItem/FormItem.vue b/styleguide/src/system/components/data-input/FormItem/FormItem.vue
old mode 100755
new mode 100644
index 44ffc1813..c59f70c61
--- a/styleguide/src/system/components/data-input/FormItem/FormItem.vue
+++ b/styleguide/src/system/components/data-input/FormItem/FormItem.vue
@@ -6,7 +6,7 @@
:label="$parentInput.label"
:for="$parentInput.id" />
-
+
@@ -21,6 +21,5 @@ export default {
}
-
diff --git a/styleguide/src/system/components/data-input/FormItem/InputError.vue b/styleguide/src/system/components/data-input/FormItem/InputError.vue
old mode 100755
new mode 100644
diff --git a/styleguide/src/system/components/data-input/FormItem/InputLabel.vue b/styleguide/src/system/components/data-input/FormItem/InputLabel.vue
old mode 100755
new mode 100644
diff --git a/styleguide/src/system/components/data-input/FormItem/style.scss b/styleguide/src/system/components/data-input/FormItem/style.scss
old mode 100755
new mode 100644
diff --git a/styleguide/src/system/components/data-input/Input/Input.vue b/styleguide/src/system/components/data-input/Input/Input.vue
index 22b7cbb42..6fb3d6eca 100755
--- a/styleguide/src/system/components/data-input/Input/Input.vue
+++ b/styleguide/src/system/components/data-input/Input/Input.vue
@@ -13,7 +13,7 @@
iconRight && `ds-input-has-icon-right`
]"
:id="id"
- :name="name"
+ :name="name ? name : model"
:type="type"
:autofocus="autofocus"
:placeholder="placeholder"
@@ -48,7 +48,8 @@ export default {
mixins: [inputMixin],
props: {
/**
- * The type of this input `url, text, password, email, search, textarea`.
+ * The type of this input.
+ * @options url|text|password|email|search|textarea
*/
type: {
type: String,
@@ -64,13 +65,6 @@ export default {
type: String,
default: null
},
- /**
- * The name of the field for better accessibility
- */
- name: {
- type: String,
- default: null
- },
/**
* Whether the input should be automatically focused
*/
@@ -78,13 +72,6 @@ export default {
type: Boolean,
default: false
},
- /**
- * Whether the input should be read-only
- */
- readonly: {
- type: Boolean,
- default: false
- },
/**
* How many rows this input should have (only for type="textarea")
*/
diff --git a/styleguide/src/system/components/data-input/Input/demo.md b/styleguide/src/system/components/data-input/Input/demo.md
old mode 100755
new mode 100644
diff --git a/styleguide/src/system/components/data-input/Input/style.scss b/styleguide/src/system/components/data-input/Input/style.scss
old mode 100755
new mode 100644
diff --git a/styleguide/src/system/components/data-input/Radio/Radio.vue b/styleguide/src/system/components/data-input/Radio/Radio.vue
new file mode 100644
index 000000000..06524f98d
--- /dev/null
+++ b/styleguide/src/system/components/data-input/Radio/Radio.vue
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+ {{ option[labelProp] || option }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/styleguide/src/system/components/data-input/Radio/demo.md b/styleguide/src/system/components/data-input/Radio/demo.md
new file mode 100644
index 000000000..7f9c8f59c
--- /dev/null
+++ b/styleguide/src/system/components/data-input/Radio/demo.md
@@ -0,0 +1,74 @@
+## Basic usage
+
+```
+
+```
+
+## Usage with label
+
+```
+
+```
+
+## Bind to a value
+
+Use v-model to bind a value to the select input.
+
+```
+
+
+
+ Your color: {{ color }}
+
+
+
+```
+
+## Style variations
+
+```
+
+```
+
+## Validation
+
+We use async-validator schemas for validation.
+
+If you need to validate more than one field it is better to use the form component.
+
+```
+
+
+
+
+
+
+```
diff --git a/styleguide/src/system/components/data-input/Radio/style.scss b/styleguide/src/system/components/data-input/Radio/style.scss
new file mode 100644
index 000000000..39c4a8c29
--- /dev/null
+++ b/styleguide/src/system/components/data-input/Radio/style.scss
@@ -0,0 +1,56 @@
+.ds-radio {
+ outline: none;
+
+ .ds-input-is-disabled &,
+ &:disabled {
+ color: $text-color-disabled;
+ opacity: $opacity-disabled;
+ pointer-events: none;
+ cursor: not-allowed;
+ }
+}
+
+.ds-radio-option {
+ &:not(.ds-button) {
+ @include inline-space($space-small);
+ }
+ display: inline-flex;
+ align-items: center;
+ cursor: pointer;
+ user-select: none;
+}
+
+.ds-radio-option-mark {
+ display: inline-block;
+ position: relative;
+ width: $font-size-base;
+ height: $font-size-base;
+ border: $input-border-size solid $border-color-base;
+ background-color: $background-color-base;
+ border-radius: $border-radius-circle;
+ margin-right: $space-xx-small;
+
+ &:before {
+ position: absolute;
+ content: '';
+ top: 50%;
+ left: 50%;
+ transform: translateY(-50%) translateX(-50%) scale(0);
+ opacity: 0;
+ width: $font-size-x-small;
+ height: $font-size-x-small;
+ border-radius: $border-radius-circle;
+ background-color: $text-color-primary;
+ transition: all $duration-short $ease-in-sharp;
+
+ .ds-radio-option-is-selected & {
+ opacity: 1;
+ transform: translateY(-50%) translateX(-50%) scale(1);
+ }
+ }
+}
+
+.ds-radio-option-label {
+ font-size: $font-size-base;
+ cursor: pointer;
+}
\ No newline at end of file
diff --git a/styleguide/src/system/components/data-input/Select/Select.vue b/styleguide/src/system/components/data-input/Select/Select.vue
index e615dd6ea..382e328d1 100755
--- a/styleguide/src/system/components/data-input/Select/Select.vue
+++ b/styleguide/src/system/components/data-input/Select/Select.vue
@@ -2,8 +2,12 @@
+
+
+ {{ innerValue[labelProp] || innerValue }}
+
{{ placeholder }}
-
-
- {{ innerValue }}
-