@propelinc/citrus-ui 0.3.4 → 0.3.6
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/dist/citrus-ui.common.js +223 -145
- package/dist/citrus-ui.common.js.map +1 -1
- package/dist/citrus-ui.css +1 -1
- package/dist/citrus-ui.umd.js +223 -145
- package/dist/citrus-ui.umd.js.map +1 -1
- package/dist/citrus-ui.umd.min.js +5 -5
- package/dist/citrus-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CCheckbox.vue +1 -1
- package/src/components/CIconButton.vue +8 -0
- package/src/components/CSelect.vue +7 -6
- package/src/components/CTextArea.vue +6 -4
- package/src/components/CTextField.vue +45 -6
- package/src/components/helpers/FormField.vue +3 -2
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<script lang="ts">
|
|
20
20
|
import { Component, Vue, Prop } from 'vue-property-decorator';
|
|
21
21
|
|
|
22
|
-
@Component({ name: 'CCheckbox' })
|
|
22
|
+
@Component({ name: 'CCheckbox', inheritAttrs: false })
|
|
23
23
|
export default class CCheckbox extends Vue {
|
|
24
24
|
@Prop({ type: Boolean, default: false }) value!: boolean;
|
|
25
25
|
@Prop({ type: Array, default: () => [] }) rules!: ((value: string) => string | boolean)[];
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
icon
|
|
7
7
|
:color="colorScheme.icon"
|
|
8
8
|
:ripple="false"
|
|
9
|
+
:to="to"
|
|
10
|
+
:href="href"
|
|
11
|
+
:target="target"
|
|
9
12
|
v-on="$listeners"
|
|
10
13
|
>
|
|
11
14
|
<font-awesome-icon data-test="icon-button-icon" :class="{ 'fa-spin': spinIcon }" :icon="icon" />
|
|
@@ -16,6 +19,7 @@
|
|
|
16
19
|
import { IconDefinition } from '@fortawesome/fontawesome-common-types';
|
|
17
20
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
18
21
|
import { Component, Vue, Prop } from 'vue-property-decorator';
|
|
22
|
+
import { RawLocation } from 'vue-router';
|
|
19
23
|
|
|
20
24
|
interface ColorScheme {
|
|
21
25
|
icon: string;
|
|
@@ -29,6 +33,10 @@ export default class CIconButton extends Vue {
|
|
|
29
33
|
@Prop({ type: Boolean, default: false }) light!: boolean;
|
|
30
34
|
@Prop({ type: [String, Array, Object], required: true }) icon!: IconDefinition;
|
|
31
35
|
@Prop({ type: Boolean, default: false }) spinIcon!: boolean;
|
|
36
|
+
@Prop({ type: Boolean, default: false }) tertiary!: boolean;
|
|
37
|
+
@Prop([Object, String]) to?: RawLocation;
|
|
38
|
+
@Prop(String) href?: string;
|
|
39
|
+
@Prop(String) target?: string;
|
|
32
40
|
|
|
33
41
|
get colorScheme(): ColorScheme {
|
|
34
42
|
if (this.contained) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<form-field :field-id="id" :disabled="disabled" :label="label">
|
|
2
|
+
<form-field :data-test="dataTest" :field-id="id" :disabled="disabled" :label="label">
|
|
3
3
|
<select-input
|
|
4
4
|
:id="id"
|
|
5
5
|
v-bind="$attrs"
|
|
6
|
-
data-test="select
|
|
6
|
+
:data-test="`${dataTest}-select`"
|
|
7
7
|
class="select__field"
|
|
8
8
|
:class="{ 'select__field--disabled': disabled }"
|
|
9
9
|
outlined
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
:items="items"
|
|
16
16
|
validate-on-blur
|
|
17
17
|
:hide-details="rules.length === 0"
|
|
18
|
-
|
|
18
|
+
v-on="$listeners"
|
|
19
19
|
>
|
|
20
20
|
<template #append>
|
|
21
21
|
<font-awesome-icon
|
|
22
22
|
v-if="loading"
|
|
23
|
-
data-test="
|
|
23
|
+
:data-test="`${dataTest}-icon-loading`"
|
|
24
24
|
class="fa-spin select__field__icon"
|
|
25
25
|
:icon="faSpinner"
|
|
26
26
|
/>
|
|
27
27
|
<font-awesome-icon
|
|
28
28
|
v-else
|
|
29
|
-
data-test="
|
|
29
|
+
:data-test="`${dataTest}-icon-dropdown`"
|
|
30
30
|
class="select__field__icon"
|
|
31
31
|
:icon="faChevronDown"
|
|
32
32
|
/>
|
|
@@ -43,7 +43,7 @@ import FormField from '@/components/helpers/FormField.vue';
|
|
|
43
43
|
import SelectInput from '@/components/helpers/SelectInput.vue';
|
|
44
44
|
|
|
45
45
|
// @ts-ignore
|
|
46
|
-
@Component({ name: 'CSelect', components: { FormField, SelectInput } })
|
|
46
|
+
@Component({ name: 'CSelect', inheritAttrs: false, components: { FormField, SelectInput } })
|
|
47
47
|
export default class CSelect extends Vue {
|
|
48
48
|
faChevronDown = faChevronDown;
|
|
49
49
|
faSpinner = faSpinner;
|
|
@@ -54,6 +54,7 @@ export default class CSelect extends Vue {
|
|
|
54
54
|
@Prop({ type: Array, default: () => [] }) items!: { label: string; value: string }[];
|
|
55
55
|
@Prop({ type: Boolean, default: false }) disabled!: boolean;
|
|
56
56
|
@Prop({ type: String, default: '' }) value!: string;
|
|
57
|
+
@Prop({ type: String, default: 'select-field' }) dataTest!: string;
|
|
57
58
|
@Prop({ type: Boolean, default: false }) loading!: boolean;
|
|
58
59
|
@Prop({ type: Array, default: () => [] }) rules!: ((value: string) => string | boolean)[];
|
|
59
60
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<form-field :field-id="id" :disabled="disabled" :label="label">
|
|
2
|
+
<form-field :data-test="dataTest" :field-id="id" :disabled="disabled" :label="label">
|
|
3
3
|
<v-textarea
|
|
4
4
|
:id="id"
|
|
5
5
|
v-bind="$attrs"
|
|
6
|
-
data-test="
|
|
6
|
+
:data-test="`${dataTest}-input`"
|
|
7
7
|
class="text-area__input"
|
|
8
8
|
:class="{ 'text-area__input--disabled': disabled }"
|
|
9
9
|
auto-grow
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
:rules="rules"
|
|
16
16
|
validate-on-blur
|
|
17
17
|
:hide-details="rules.length === 0"
|
|
18
|
-
|
|
18
|
+
v-on="$listeners"
|
|
19
19
|
/>
|
|
20
20
|
</form-field>
|
|
21
21
|
</template>
|
|
@@ -25,13 +25,14 @@ import { Component, Vue, Prop } from 'vue-property-decorator';
|
|
|
25
25
|
|
|
26
26
|
import FormField from '@/components/helpers/FormField.vue';
|
|
27
27
|
|
|
28
|
-
@Component({ name: 'CTextArea', components: { FormField } })
|
|
28
|
+
@Component({ name: 'CTextArea', inheritAttrs: false, components: { FormField } })
|
|
29
29
|
export default class CTextArea extends Vue {
|
|
30
30
|
@Prop(String) label?: string;
|
|
31
31
|
@Prop(String) placeholder?: string;
|
|
32
32
|
@Prop({ type: String, required: true }) id!: string;
|
|
33
33
|
@Prop({ type: Boolean, default: false }) disabled!: boolean;
|
|
34
34
|
@Prop({ type: String, default: '' }) value!: string;
|
|
35
|
+
@Prop({ type: String, default: 'text-area' }) dataTest!: string;
|
|
35
36
|
@Prop({ type: Array, default: () => [] }) rules!: ((value: string) => string | boolean)[];
|
|
36
37
|
}
|
|
37
38
|
</script>
|
|
@@ -40,6 +41,7 @@ export default class CTextArea extends Vue {
|
|
|
40
41
|
@import '~@/styles/form-fields.less';
|
|
41
42
|
|
|
42
43
|
.text-area__input {
|
|
44
|
+
.body();
|
|
43
45
|
.form-field();
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -1,43 +1,82 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<form-field :field-id="id" :disabled="disabled" :label="label">
|
|
2
|
+
<form-field :data-test="dataTest" :field-id="id" :disabled="disabled" :label="label">
|
|
3
3
|
<v-text-field
|
|
4
4
|
:id="id"
|
|
5
5
|
v-bind="$attrs"
|
|
6
|
-
data-test="
|
|
6
|
+
:data-test="`${dataTest}-input`"
|
|
7
7
|
class="text-field__field"
|
|
8
8
|
:class="{ 'text-field__field--disabled': disabled }"
|
|
9
9
|
outlined
|
|
10
10
|
single-line
|
|
11
11
|
:placeholder="placeholder"
|
|
12
12
|
:disabled="disabled"
|
|
13
|
-
:
|
|
13
|
+
:inputmode="inputmode"
|
|
14
|
+
:type="_type"
|
|
14
15
|
:value="value"
|
|
15
16
|
:rules="rules"
|
|
16
17
|
validate-on-blur
|
|
17
18
|
:hide-details="rules.length === 0"
|
|
18
|
-
|
|
19
|
+
v-on="$listeners"
|
|
19
20
|
>
|
|
20
21
|
<template #append>
|
|
21
|
-
<slot name="append"
|
|
22
|
+
<slot name="append">
|
|
23
|
+
<button
|
|
24
|
+
v-if="hideable"
|
|
25
|
+
:data-test="`${dataTest}-hide-toggle`"
|
|
26
|
+
@click="toggleObscureInput"
|
|
27
|
+
>
|
|
28
|
+
<font-awesome-icon v-if="hideInput" :icon="faEye" />
|
|
29
|
+
<font-awesome-icon v-else :icon="faEyeSlash" />
|
|
30
|
+
</button>
|
|
31
|
+
</slot>
|
|
22
32
|
</template>
|
|
23
33
|
</v-text-field>
|
|
24
34
|
</form-field>
|
|
25
35
|
</template>
|
|
26
36
|
|
|
27
37
|
<script lang="ts">
|
|
38
|
+
import { faEye, faEyeSlash } from '@fortawesome/pro-light-svg-icons';
|
|
39
|
+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
28
40
|
import { Component, Vue, Prop } from 'vue-property-decorator';
|
|
29
41
|
|
|
30
42
|
import FormField from '@/components/helpers/FormField.vue';
|
|
31
43
|
|
|
32
|
-
@Component({ name: 'CTextField', components: { FormField } })
|
|
44
|
+
@Component({ name: 'CTextField', inheritAttrs: false, components: { FormField, FontAwesomeIcon } })
|
|
33
45
|
export default class CTextField extends Vue {
|
|
46
|
+
faEye = faEye;
|
|
47
|
+
faEyeSlash = faEyeSlash;
|
|
48
|
+
|
|
34
49
|
@Prop(String) label?: string;
|
|
35
50
|
@Prop(String) placeholder?: string;
|
|
36
51
|
@Prop({ type: String, required: true }) id!: string;
|
|
37
52
|
@Prop({ type: String, default: 'text' }) type!: string;
|
|
53
|
+
/** HTML property that tells browser what kind of data is being entered.
|
|
54
|
+
* Be sure to set this if you're using an hideable input, so the keyboard doesn't change as the user toggles. */
|
|
55
|
+
@Prop(String) inputmode?: string;
|
|
38
56
|
@Prop({ type: Boolean, default: false }) disabled!: boolean;
|
|
57
|
+
@Prop({ type: Boolean, default: false }) hideable!: boolean;
|
|
58
|
+
@Prop({ type: Boolean, default: true }) hideByDefault!: boolean;
|
|
39
59
|
@Prop({ type: String, default: '' }) value!: string;
|
|
60
|
+
@Prop({ type: String, default: 'text-field' }) dataTest!: string;
|
|
40
61
|
@Prop({ type: Array, default: () => [] }) rules!: ((value: string) => string | boolean)[];
|
|
62
|
+
|
|
63
|
+
hideInput: boolean = false;
|
|
64
|
+
|
|
65
|
+
created(): void {
|
|
66
|
+
this.hideInput = this.hideByDefault;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get _type(): string {
|
|
70
|
+
return this.hideInput && this.hideable ? 'password' : this.type;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
toggleObscureInput(): void {
|
|
74
|
+
if (!this.hideable) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this.hideInput = !this.hideInput;
|
|
79
|
+
}
|
|
41
80
|
}
|
|
42
81
|
</script>
|
|
43
82
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<fieldset class="form-field" :disabled="disabled">
|
|
2
|
+
<fieldset class="form-field" :data-test="dataTest" :disabled="disabled">
|
|
3
3
|
<label
|
|
4
4
|
v-if="label"
|
|
5
5
|
:for="fieldId"
|
|
6
|
-
data-test="
|
|
6
|
+
:data-test="`${dataTest}-label`"
|
|
7
7
|
class="form-field__label"
|
|
8
8
|
:class="{ 'form-field__label--disabled': disabled }"
|
|
9
9
|
>
|
|
@@ -22,6 +22,7 @@ export default class FormField extends Vue {
|
|
|
22
22
|
@Prop(String) label?: string;
|
|
23
23
|
@Prop({ type: String, required: true }) fieldId!: string;
|
|
24
24
|
@Prop({ type: Boolean, default: false }) disabled!: boolean;
|
|
25
|
+
@Prop({ type: String, default: 'form-field' }) dataTest!: string;
|
|
25
26
|
}
|
|
26
27
|
</script>
|
|
27
28
|
|