@ouestfrance/sipa-bms-ui 8.4.0 → 8.5.1
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/components/form/BmsAutocomplete.vue.d.ts +3 -9
- package/dist/components/form/BmsInputBooleanCheckbox.vue.d.ts +3 -9
- package/dist/components/form/BmsInputCheckboxCaption.vue.d.ts +1 -1
- package/dist/components/form/BmsInputCheckboxGroup.vue.d.ts +4 -11
- package/dist/components/form/BmsInputCode.vue.d.ts +4 -11
- package/dist/components/form/BmsInputFile.vue.d.ts +2 -9
- package/dist/components/form/BmsInputRadioCaptionGroup.vue.d.ts +2 -9
- package/dist/components/form/BmsInputRadioGroup.vue.d.ts +2 -9
- package/dist/components/form/BmsInputText.vue.d.ts +10 -12
- package/dist/components/form/BmsInputToggle.vue.d.ts +5 -6
- package/dist/components/form/BmsMultiSelect.vue.d.ts +3 -9
- package/dist/components/form/BmsSearch.vue.d.ts +11 -5
- package/dist/components/form/BmsSelect.vue.d.ts +3 -8
- package/dist/components/form/BmsTag.vue.d.ts +1 -0
- package/dist/components/form/BmsTextArea.vue.d.ts +2 -9
- package/dist/components/form/RawAutocomplete.vue.d.ts +10 -11
- package/dist/components/form/RawInputText.vue.d.ts +3 -5
- package/dist/components/navigation/UiTenantSwitcher.vue.d.ts +11 -5
- package/dist/components/table/BmsTableFilters.vue.d.ts +11 -5
- package/dist/mockServiceWorker.js +1 -1
- package/dist/plugins/field/FieldComponent.vue.d.ts +3 -11
- package/dist/plugins/field/FieldDatalist.vue.d.ts +2 -0
- package/dist/plugins/field/field-component.model.d.ts +11 -0
- package/dist/sipa-bms-ui.css +132 -114
- package/dist/sipa-bms-ui.es.js +3255 -3100
- package/dist/sipa-bms-ui.es.js.map +1 -1
- package/dist/sipa-bms-ui.umd.js +3255 -3100
- package/dist/sipa-bms-ui.umd.js.map +1 -1
- package/package.json +16 -16
- package/src/components/form/BmsAutocomplete.stories.js +10 -0
- package/src/components/form/BmsAutocomplete.vue +4 -9
- package/src/components/form/BmsBetweenInput.vue +1 -10
- package/src/components/form/BmsFilePicker.stories.js +0 -7
- package/src/components/form/BmsInputBooleanCheckbox.stories.js +6 -0
- package/src/components/form/BmsInputBooleanCheckbox.vue +3 -22
- package/src/components/form/BmsInputCheckboxCaptionGroup.vue +1 -10
- package/src/components/form/BmsInputCheckboxGroup.vue +3 -19
- package/src/components/form/BmsInputCode.stories.js +2 -0
- package/src/components/form/BmsInputCode.vue +3 -18
- package/src/components/form/BmsInputDateTime.stories.js +2 -0
- package/src/components/form/BmsInputFile.stories.js +4 -1
- package/src/components/form/BmsInputFile.vue +5 -20
- package/src/components/form/BmsInputNumber.stories.js +5 -0
- package/src/components/form/BmsInputRadioCaptionGroup.vue +3 -19
- package/src/components/form/BmsInputRadioGroup.stories.js +12 -0
- package/src/components/form/BmsInputRadioGroup.vue +3 -19
- package/src/components/form/BmsInputText.spec.ts +1 -1
- package/src/components/form/BmsInputText.stories.js +5 -0
- package/src/components/form/BmsInputText.vue +5 -19
- package/src/components/form/BmsInputToggle.stories.js +3 -0
- package/src/components/form/BmsInputToggle.vue +13 -15
- package/src/components/form/BmsMultiSelect.stories.js +10 -1
- package/src/components/form/BmsMultiSelect.vue +5 -17
- package/src/components/form/BmsSearch.stories.js +2 -0
- package/src/components/form/BmsSelect.stories.js +4 -1
- package/src/components/form/BmsSelect.vue +7 -20
- package/src/components/form/BmsTag.stories.js +9 -0
- package/src/components/form/BmsTag.vue +9 -6
- package/src/components/form/BmsTextArea.stories.js +3 -2
- package/src/components/form/BmsTextArea.vue +12 -21
- package/src/components/form/RawAutocomplete.vue +5 -18
- package/src/components/form/RawInputText.vue +11 -9
- package/src/components/form/UiBmsInputCheckbox.stories.js +10 -0
- package/src/plugins/field/FieldComponent.stories.js +8 -1
- package/src/plugins/field/FieldComponent.vue +29 -15
- package/src/plugins/field/FieldDatalist.stories.js +2 -0
- package/src/plugins/field/FieldDatalist.vue +12 -2
- package/src/plugins/field/field-component.model.ts +12 -0
- package/src/showroom/pages/forms.vue +28 -0
|
@@ -24,6 +24,9 @@ const Template = (args) => ({
|
|
|
24
24
|
template: `
|
|
25
25
|
<BmsInputToggle v-bind="{...args}" v-model="curentValue"/>
|
|
26
26
|
Valeur de mon toggle : {{ curentValue }}
|
|
27
|
+
<br/>
|
|
28
|
+
<BmsInputToggle v-bind="{...args, small:true}" v-model="curentValue"/>
|
|
29
|
+
Valeur de mon toggle : {{ curentValue }}
|
|
27
30
|
`,
|
|
28
31
|
});
|
|
29
32
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<field :disabled="disabled">
|
|
2
|
+
<field :disabled="disabled" :small="small">
|
|
3
3
|
<label class="input-toggle" :class="{ isOn: modelValue, disabled }">
|
|
4
4
|
<span class="input-switch-info">{{ label }}</span>
|
|
5
5
|
<UiBmsSwitch
|
|
@@ -16,21 +16,19 @@
|
|
|
16
16
|
|
|
17
17
|
<script lang="ts" setup>
|
|
18
18
|
import UiBmsSwitch from '@/components/form/UiBmsSwitch.vue';
|
|
19
|
+
import { FieldComponentProps } from '@/plugins/field/field-component.model';
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
modelValue: false,
|
|
30
|
-
},
|
|
31
|
-
);
|
|
21
|
+
interface Props extends FieldComponentProps {
|
|
22
|
+
name: string;
|
|
23
|
+
modelValue: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
withDefaults(defineProps<Props>(), {
|
|
27
|
+
disabled: false,
|
|
28
|
+
modelValue: false,
|
|
29
|
+
});
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
defineEmits<{
|
|
34
32
|
(e: 'update:modelValue', value: any): void;
|
|
35
33
|
}>();
|
|
36
34
|
</script>
|
|
@@ -40,7 +38,7 @@ const $emits = defineEmits<{
|
|
|
40
38
|
--label-color: var(--bms-grey-100);
|
|
41
39
|
--cursor: pointer;
|
|
42
40
|
|
|
43
|
-
font-weight:
|
|
41
|
+
font-weight: var(--field-label-font-weight);
|
|
44
42
|
display: flex;
|
|
45
43
|
align-items: center;
|
|
46
44
|
gap: 0.5em;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import BmsMultiSelect from '@/components/form/BmsMultiSelect.vue';
|
|
2
|
+
import template from '@/documentation/template_field_dependency.mdx';
|
|
2
3
|
|
|
3
4
|
export default {
|
|
5
|
+
parameters: {
|
|
6
|
+
docs: {
|
|
7
|
+
page: template,
|
|
8
|
+
},
|
|
9
|
+
},
|
|
4
10
|
title: 'Composants/form/MultiSelect',
|
|
5
11
|
component: BmsMultiSelect,
|
|
6
12
|
};
|
|
@@ -13,7 +19,10 @@ const Template = (args) => ({
|
|
|
13
19
|
BmsMultiSelect,
|
|
14
20
|
},
|
|
15
21
|
template: `
|
|
16
|
-
<
|
|
22
|
+
<div style="display:flex;gap:1em;">
|
|
23
|
+
<BmsMultiSelect v-bind="args"/>
|
|
24
|
+
<BmsMultiSelect v-bind="{...args, small:true}"/>
|
|
25
|
+
</div>
|
|
17
26
|
`,
|
|
18
27
|
});
|
|
19
28
|
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<BmsSelect
|
|
3
3
|
v-model:open="open"
|
|
4
|
+
v-bind="$props"
|
|
4
5
|
:model-value="modelValue"
|
|
5
6
|
@update:model-value="onSelect"
|
|
6
|
-
:label="label"
|
|
7
|
-
:errors="errors"
|
|
8
|
-
:captions="captions"
|
|
9
|
-
:required="required"
|
|
10
|
-
:optional="optional"
|
|
11
|
-
:helperText="helperText"
|
|
12
|
-
:disabled="disabled"
|
|
13
|
-
:options="displayedOptions"
|
|
14
7
|
>
|
|
15
8
|
<template #input>
|
|
16
9
|
<div class="tags">
|
|
17
10
|
<BmsTag
|
|
18
11
|
v-for="tag in displayValues"
|
|
12
|
+
:small="small"
|
|
19
13
|
active
|
|
20
14
|
@dismiss="removeOption(tag.value)"
|
|
21
15
|
>
|
|
@@ -47,16 +41,10 @@ import BmsTag from './BmsTag.vue';
|
|
|
47
41
|
import { Caption, InputOption } from '@/models';
|
|
48
42
|
import _ from 'lodash';
|
|
49
43
|
import { searchString } from '@/helpers';
|
|
44
|
+
import { FieldComponentProps } from '@/plugins/field/field-component.model';
|
|
50
45
|
|
|
51
|
-
export interface Props {
|
|
46
|
+
export interface Props extends FieldComponentProps {
|
|
52
47
|
options: InputOption[];
|
|
53
|
-
label?: string;
|
|
54
|
-
errors?: string[] | Caption[];
|
|
55
|
-
captions?: string[] | Caption[];
|
|
56
|
-
required?: boolean;
|
|
57
|
-
optional?: boolean;
|
|
58
|
-
disabled?: boolean;
|
|
59
|
-
helperText?: string;
|
|
60
48
|
placeholder?: string;
|
|
61
49
|
}
|
|
62
50
|
|
|
@@ -110,7 +98,7 @@ const displayValues = computed<InputOption[]>(() =>
|
|
|
110
98
|
.tags {
|
|
111
99
|
display: flex;
|
|
112
100
|
gap: 0.5em;
|
|
113
|
-
padding:
|
|
101
|
+
padding: var(--field-margin);
|
|
114
102
|
flex-wrap: wrap;
|
|
115
103
|
width: 100%;
|
|
116
104
|
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<field
|
|
3
|
-
:label="label"
|
|
4
|
-
:errors="errors"
|
|
5
|
-
:captions="captions"
|
|
6
|
-
:required="required"
|
|
7
|
-
:optional="optional"
|
|
8
|
-
:helperText="helperText"
|
|
9
|
-
:disabled="disabled"
|
|
10
|
-
>
|
|
2
|
+
<field v-bind="$props">
|
|
11
3
|
<span class="select-wrapper" ref="selectWrapper" :class="classes">
|
|
12
4
|
<slot name="input">
|
|
13
5
|
<input
|
|
@@ -29,6 +21,7 @@
|
|
|
29
21
|
v-show="open"
|
|
30
22
|
:options="options"
|
|
31
23
|
:is-input-focused="open"
|
|
24
|
+
:small="small"
|
|
32
25
|
@select="(option: any) => selectItem(option)"
|
|
33
26
|
>
|
|
34
27
|
<template #option="{ option }: { option: any }">
|
|
@@ -44,18 +37,12 @@ import { ChevronDown } from 'lucide-vue-next';
|
|
|
44
37
|
import { Ref, computed, onMounted, ref, watch } from 'vue';
|
|
45
38
|
import _ from 'lodash';
|
|
46
39
|
import FieldDatalist from '@/plugins/field/FieldDatalist.vue';
|
|
47
|
-
import { Caption } from '@/models/caption.model';
|
|
48
40
|
import { InputOption } from '@/models';
|
|
41
|
+
import { FieldComponentProps } from '@/plugins/field/field-component.model';
|
|
49
42
|
|
|
50
|
-
export interface Props {
|
|
43
|
+
export interface Props extends FieldComponentProps {
|
|
51
44
|
options: InputOption[];
|
|
52
|
-
label?: string;
|
|
53
|
-
errors?: string[] | Caption[];
|
|
54
|
-
captions?: string[] | Caption[];
|
|
55
|
-
required?: boolean;
|
|
56
45
|
optional?: boolean;
|
|
57
|
-
disabled?: boolean;
|
|
58
|
-
helperText?: string;
|
|
59
46
|
placeholder?: string;
|
|
60
47
|
}
|
|
61
48
|
|
|
@@ -63,6 +50,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
63
50
|
label: '',
|
|
64
51
|
disabled: false,
|
|
65
52
|
required: false,
|
|
53
|
+
small: false,
|
|
66
54
|
});
|
|
67
55
|
const modelValue = defineModel<any>('modelValue', { required: true });
|
|
68
56
|
const open = defineModel<boolean>('open', { default: false });
|
|
@@ -119,11 +107,10 @@ defineExpose({
|
|
|
119
107
|
.select-wrapper {
|
|
120
108
|
width: 100%;
|
|
121
109
|
padding: 0 0 0 1em;
|
|
122
|
-
margin: 0.5em 0;
|
|
123
110
|
border-radius: var(--bms-border-radius);
|
|
124
111
|
border: 1px solid var(--field-border-color);
|
|
125
112
|
background-color: var(--input-background-color);
|
|
126
|
-
min-height:
|
|
113
|
+
min-height: var(--field-height);
|
|
127
114
|
|
|
128
115
|
display: flex;
|
|
129
116
|
align-items: center;
|
|
@@ -141,7 +128,7 @@ defineExpose({
|
|
|
141
128
|
}
|
|
142
129
|
&-button {
|
|
143
130
|
width: 1em;
|
|
144
|
-
margin: 0
|
|
131
|
+
margin: 0 var(--field-padding);
|
|
145
132
|
display: block;
|
|
146
133
|
}
|
|
147
134
|
}
|
|
@@ -31,6 +31,15 @@ const Template = (args) => ({
|
|
|
31
31
|
<Trash/>
|
|
32
32
|
</template>
|
|
33
33
|
</BmsTag>
|
|
34
|
+
<br/>
|
|
35
|
+
<BmsTag v-bind="{...args, small:true}">
|
|
36
|
+
<template #default>
|
|
37
|
+
<Activity/> message
|
|
38
|
+
</template>
|
|
39
|
+
<template v-if="args.templateIcon" #closeIcon>
|
|
40
|
+
<Trash/>
|
|
41
|
+
</template>
|
|
42
|
+
</BmsTag>
|
|
34
43
|
`,
|
|
35
44
|
});
|
|
36
45
|
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="tag"
|
|
4
|
-
:class="{ active: active, disabled: disabled }"
|
|
5
|
-
@click="emits('click')"
|
|
6
|
-
>
|
|
2
|
+
<div class="tag" :class="{ active, disabled, small }" @click="emits('click')">
|
|
7
3
|
<slot></slot>
|
|
8
4
|
<span class="dismiss-button">
|
|
9
5
|
<BmsIconButton @click.stop="emits('dismiss')" v-if="canBeDismissed">
|
|
@@ -21,8 +17,10 @@ interface Props {
|
|
|
21
17
|
active?: boolean;
|
|
22
18
|
disabled?: boolean;
|
|
23
19
|
canBeDismissed?: boolean;
|
|
20
|
+
small?: boolean;
|
|
24
21
|
}
|
|
25
|
-
|
|
22
|
+
|
|
23
|
+
withDefaults(defineProps<Props>(), {
|
|
26
24
|
active: false,
|
|
27
25
|
disabled: false,
|
|
28
26
|
canBeDismissed: true,
|
|
@@ -63,6 +61,11 @@ const emits = defineEmits(['dismiss', 'click']);
|
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
|
|
64
|
+
&.small {
|
|
65
|
+
padding: 2px 4px;
|
|
66
|
+
gap: 4px;
|
|
67
|
+
}
|
|
68
|
+
|
|
66
69
|
&:focus,
|
|
67
70
|
&:hover {
|
|
68
71
|
--tag-color: var(--bms-main-140);
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<field
|
|
3
|
-
:label="label"
|
|
4
|
-
:errors="errors"
|
|
5
|
-
:captions="captions"
|
|
6
|
-
:required="required"
|
|
7
|
-
:optional="optional"
|
|
8
|
-
:helperText="helperText"
|
|
9
|
-
:disabled="disabled"
|
|
10
|
-
>
|
|
2
|
+
<field v-bind="$props">
|
|
11
3
|
<textarea
|
|
12
4
|
ref="textArea"
|
|
13
5
|
:value="modelValue"
|
|
@@ -26,18 +18,11 @@
|
|
|
26
18
|
|
|
27
19
|
<script lang="ts" setup>
|
|
28
20
|
import { Ref, computed, ref } from 'vue';
|
|
29
|
-
import {
|
|
21
|
+
import { FieldComponentProps } from '@/plugins/field/field-component.model';
|
|
30
22
|
|
|
31
|
-
export interface Props {
|
|
23
|
+
export interface Props extends FieldComponentProps {
|
|
32
24
|
modelValue: string;
|
|
33
|
-
label?: string;
|
|
34
|
-
required?: boolean;
|
|
35
|
-
optional?: boolean;
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
helperText?: string;
|
|
38
25
|
placeholder?: string;
|
|
39
|
-
captions?: string[];
|
|
40
|
-
errors?: string[] | Caption[];
|
|
41
26
|
}
|
|
42
27
|
|
|
43
28
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -58,7 +43,11 @@ const onInput = (e: Event) => {
|
|
|
58
43
|
};
|
|
59
44
|
|
|
60
45
|
const classes = computed(() => {
|
|
61
|
-
return {
|
|
46
|
+
return {
|
|
47
|
+
'is-error': props.errors?.length,
|
|
48
|
+
'is-disabled': props.disabled,
|
|
49
|
+
'is-small': props.small,
|
|
50
|
+
};
|
|
62
51
|
});
|
|
63
52
|
|
|
64
53
|
const setFocus = () => {
|
|
@@ -79,8 +68,7 @@ defineExpose({
|
|
|
79
68
|
align-items: center;
|
|
80
69
|
|
|
81
70
|
width: 100%;
|
|
82
|
-
padding:
|
|
83
|
-
margin: 0.5em 0;
|
|
71
|
+
padding: var(--field-padding);
|
|
84
72
|
border-radius: var(--bms-border-radius);
|
|
85
73
|
border: 1px solid var(--field-border-color);
|
|
86
74
|
background-color: var(--textarea-background-color);
|
|
@@ -107,6 +95,9 @@ defineExpose({
|
|
|
107
95
|
--textarea-background-color: var(--bms-grey-25);
|
|
108
96
|
pointer-events: none;
|
|
109
97
|
}
|
|
98
|
+
&.is-small {
|
|
99
|
+
min-height: 56px;
|
|
100
|
+
}
|
|
110
101
|
}
|
|
111
102
|
}
|
|
112
103
|
</style>
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<field
|
|
3
|
-
:label="label"
|
|
4
|
-
:errors="errors"
|
|
5
|
-
:captions="captions"
|
|
6
|
-
:required="required"
|
|
7
|
-
:optional="optional"
|
|
8
|
-
:helperText="helperText"
|
|
9
|
-
:disabled="disabled"
|
|
10
|
-
>
|
|
2
|
+
<field v-bind="$props">
|
|
11
3
|
<RawInputText
|
|
12
4
|
ref="autocompleteInput"
|
|
13
5
|
v-model="inputText"
|
|
@@ -16,6 +8,7 @@
|
|
|
16
8
|
:class="classes"
|
|
17
9
|
:placeholder="placeholder"
|
|
18
10
|
:required="required"
|
|
11
|
+
:small="small"
|
|
19
12
|
@input="onInput"
|
|
20
13
|
v-model:focus="isInputFocused"
|
|
21
14
|
>
|
|
@@ -46,6 +39,7 @@
|
|
|
46
39
|
:can-add-new-option="canAddNewOption"
|
|
47
40
|
:new-option="inputText"
|
|
48
41
|
:options="filteredMenuItems"
|
|
42
|
+
:small="small"
|
|
49
43
|
@select="selectItem"
|
|
50
44
|
@add-new-option="(option: string) => emits('addNewOption', option)"
|
|
51
45
|
>
|
|
@@ -61,23 +55,16 @@
|
|
|
61
55
|
import { searchString } from '@/helpers/string.helper';
|
|
62
56
|
import FieldDatalist from '@/plugins/field/FieldDatalist.vue';
|
|
63
57
|
import { computed, ref, Ref, watch } from 'vue';
|
|
64
|
-
import { Caption } from '@/models/caption.model';
|
|
65
58
|
import RawInputText from '@/components/form/RawInputText.vue';
|
|
66
59
|
import { InputOption, InputType } from '@/models';
|
|
67
60
|
import { ChevronDown, ChevronUp, X } from 'lucide-vue-next';
|
|
61
|
+
import { FieldComponentProps } from '@/plugins/field/field-component.model';
|
|
68
62
|
|
|
69
|
-
export interface Props {
|
|
63
|
+
export interface Props extends FieldComponentProps {
|
|
70
64
|
options: InputOption[];
|
|
71
65
|
label?: string;
|
|
72
|
-
required?: boolean;
|
|
73
|
-
optional?: boolean;
|
|
74
|
-
disabled?: boolean;
|
|
75
|
-
helperText?: string;
|
|
76
66
|
placeholder?: string;
|
|
77
|
-
captions?: string[] | Caption[];
|
|
78
|
-
errors?: string[] | Caption[];
|
|
79
67
|
open?: boolean;
|
|
80
|
-
|
|
81
68
|
canAddNewOption?: boolean;
|
|
82
69
|
newOption?: string;
|
|
83
70
|
}
|
|
@@ -28,20 +28,18 @@
|
|
|
28
28
|
|
|
29
29
|
<script lang="ts" setup>
|
|
30
30
|
import { computed, onMounted, Ref, ref } from 'vue';
|
|
31
|
-
import {
|
|
31
|
+
import { InputType } from '@/models';
|
|
32
|
+
import { FieldComponentProps } from '@/plugins/field/field-component.model';
|
|
32
33
|
|
|
33
|
-
export interface Props {
|
|
34
|
+
export interface Props extends FieldComponentProps {
|
|
34
35
|
modelValue: string | number;
|
|
35
|
-
required?: boolean;
|
|
36
36
|
placeholder?: string;
|
|
37
|
-
disabled?: boolean;
|
|
38
37
|
focus?: boolean;
|
|
39
38
|
type?:
|
|
40
39
|
| InputType.TEXT
|
|
41
40
|
| InputType.NUMBER
|
|
42
41
|
| InputType.DATE
|
|
43
42
|
| InputType.DATETIME;
|
|
44
|
-
errors?: string[] | Caption[];
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -88,7 +86,11 @@ const onInput = (e: Event) => {
|
|
|
88
86
|
};
|
|
89
87
|
|
|
90
88
|
const classes = computed(() => {
|
|
91
|
-
return {
|
|
89
|
+
return {
|
|
90
|
+
'is-error': props.errors?.length,
|
|
91
|
+
'is-disabled': props.disabled,
|
|
92
|
+
'is-small': props.small,
|
|
93
|
+
};
|
|
92
94
|
});
|
|
93
95
|
</script>
|
|
94
96
|
|
|
@@ -98,12 +100,12 @@ const classes = computed(() => {
|
|
|
98
100
|
align-items: center;
|
|
99
101
|
|
|
100
102
|
width: 100%;
|
|
101
|
-
padding: 1em;
|
|
102
|
-
margin: 0.5em 0;
|
|
103
103
|
border-radius: var(--bms-border-radius);
|
|
104
104
|
border: 1px solid var(--field-border-color);
|
|
105
105
|
background-color: var(--input-background-color);
|
|
106
|
-
|
|
106
|
+
|
|
107
|
+
padding: var(--field-padding);
|
|
108
|
+
height: var(--field-height);
|
|
107
109
|
|
|
108
110
|
&:hover {
|
|
109
111
|
--field-border-color: var(--bms-grey-100);
|
|
@@ -30,6 +30,16 @@ const Template = (args) => ({
|
|
|
30
30
|
</UiBmsInputCheckbox>
|
|
31
31
|
Valeur de mon champ : {{ curentValue }}
|
|
32
32
|
</div>
|
|
33
|
+
|
|
34
|
+
<br/>
|
|
35
|
+
<div>
|
|
36
|
+
<UiBmsInputCheckbox v-bind="{...args, small:true}" v-model="curentValue">
|
|
37
|
+
<template v-if="args.labelSlot" #label>
|
|
38
|
+
<span v-html='args.labelSlot'/>
|
|
39
|
+
</template>
|
|
40
|
+
</UiBmsInputCheckbox>
|
|
41
|
+
Valeur de mon champ : {{ curentValue }}
|
|
42
|
+
</div>
|
|
33
43
|
`,
|
|
34
44
|
});
|
|
35
45
|
|
|
@@ -21,7 +21,7 @@ const Template = (args) => ({
|
|
|
21
21
|
<template #icon-start v-if="args.iconStart">
|
|
22
22
|
<Flashlight/>
|
|
23
23
|
</template>
|
|
24
|
-
|
|
24
|
+
slot for my input here
|
|
25
25
|
<template #icon-end v-if="args.iconEnd">
|
|
26
26
|
<Album/>
|
|
27
27
|
</template>
|
|
@@ -35,6 +35,13 @@ Default.args = {
|
|
|
35
35
|
captions: ['Helping text'],
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
export const Small = Template.bind({});
|
|
39
|
+
Small.args = {
|
|
40
|
+
small: true,
|
|
41
|
+
label: 'My label',
|
|
42
|
+
captions: ['Helping text'],
|
|
43
|
+
};
|
|
44
|
+
|
|
38
45
|
export const WithIcons = Template.bind({});
|
|
39
46
|
WithIcons.args = {
|
|
40
47
|
label: 'My label',
|
|
@@ -52,20 +52,12 @@ import { BmsTooltip, convertStringToCaption, StatusType } from '@/index';
|
|
|
52
52
|
import { useElementBounding, useWindowSize } from '@vueuse/core';
|
|
53
53
|
import { Caption } from '@/models/caption.model';
|
|
54
54
|
import BmsCaption from '@/components/feedback/BmsCaption.vue';
|
|
55
|
+
import { FieldComponentProps } from './field-component.model';
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
label?: string;
|
|
58
|
-
required?: boolean;
|
|
59
|
-
optional?: boolean;
|
|
60
|
-
helperText?: string;
|
|
61
|
-
errors?: string[] | Caption[];
|
|
62
|
-
captions?: string[] | Caption[];
|
|
63
|
-
disabled?: boolean;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
57
|
+
const props = withDefaults(defineProps<FieldComponentProps>(), {
|
|
67
58
|
label: '',
|
|
68
59
|
optional: false,
|
|
60
|
+
small: false,
|
|
69
61
|
});
|
|
70
62
|
|
|
71
63
|
const datalist: Ref<HTMLSpanElement | null> = ref<HTMLSpanElement | null>(null);
|
|
@@ -74,9 +66,12 @@ const { y } = useElementBounding(datalist);
|
|
|
74
66
|
const { height: windowHeight } = useWindowSize();
|
|
75
67
|
|
|
76
68
|
const classes = computed(() => {
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
return {
|
|
70
|
+
field: true,
|
|
71
|
+
'is-error': props.errors?.length,
|
|
72
|
+
'is-disabled': props.disabled,
|
|
73
|
+
'is-small': props.small,
|
|
74
|
+
};
|
|
80
75
|
});
|
|
81
76
|
|
|
82
77
|
const computedErrors: ComputedRef<Caption[]> = computed(() => {
|
|
@@ -127,9 +122,19 @@ const getCaptionIdentifier = (caption: string | Caption): string => {
|
|
|
127
122
|
--field-label-color: var(--bms-font-color);
|
|
128
123
|
background: transparent;
|
|
129
124
|
|
|
125
|
+
--field-height: 48px;
|
|
126
|
+
--field-padding: 1em;
|
|
127
|
+
--field-margin: 0.5em 0;
|
|
128
|
+
--field-label-font-weight: bold;
|
|
129
|
+
|
|
130
130
|
&__errors {
|
|
131
131
|
font-size: 14px;
|
|
132
132
|
color: var(--bms-red-75);
|
|
133
|
+
margin-bottom: var(--field-margin);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&__captions {
|
|
137
|
+
margin-bottom: var(--field-margin);
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
&__wrapper {
|
|
@@ -146,7 +151,7 @@ const getCaptionIdentifier = (caption: string | Caption): string => {
|
|
|
146
151
|
|
|
147
152
|
&__title {
|
|
148
153
|
font-size: 1em;
|
|
149
|
-
font-weight:
|
|
154
|
+
font-weight: var(--field-label-font-weight);
|
|
150
155
|
color: var(--field-label-color);
|
|
151
156
|
}
|
|
152
157
|
|
|
@@ -176,6 +181,14 @@ const getCaptionIdentifier = (caption: string | Caption): string => {
|
|
|
176
181
|
}
|
|
177
182
|
}
|
|
178
183
|
|
|
184
|
+
&.is-small {
|
|
185
|
+
--field-height: 28px;
|
|
186
|
+
--field-padding: 0.5em;
|
|
187
|
+
--field-margin: 0;
|
|
188
|
+
--field-label-font-weight: normal;
|
|
189
|
+
// color: var(--bms-grey-75);
|
|
190
|
+
}
|
|
191
|
+
|
|
179
192
|
&.is-error {
|
|
180
193
|
--field-label-color: var(--bms-danger-color);
|
|
181
194
|
}
|
|
@@ -203,6 +216,7 @@ const getCaptionIdentifier = (caption: string | Caption): string => {
|
|
|
203
216
|
&__input {
|
|
204
217
|
display: flex;
|
|
205
218
|
align-items: center;
|
|
219
|
+
margin: var(--field-margin);
|
|
206
220
|
}
|
|
207
221
|
}
|
|
208
222
|
</style>
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
:data-testid="option.value"
|
|
13
13
|
:class="{
|
|
14
14
|
selected: index === currentSelectedItemIndex,
|
|
15
|
+
small,
|
|
15
16
|
}"
|
|
16
17
|
@click.prevent="onClick(option)"
|
|
17
18
|
>
|
|
@@ -37,11 +38,13 @@ export interface Props {
|
|
|
37
38
|
isInputFocused: boolean;
|
|
38
39
|
canAddNewOption?: boolean;
|
|
39
40
|
newOption?: string;
|
|
41
|
+
small?: boolean;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
const props = withDefaults(defineProps<Props>(), {
|
|
43
45
|
canAddNewOption: false,
|
|
44
46
|
newOption: '',
|
|
47
|
+
small: false,
|
|
45
48
|
});
|
|
46
49
|
|
|
47
50
|
const currentSelectedItemIndex = ref<number>(-1);
|
|
@@ -113,6 +116,8 @@ ul {
|
|
|
113
116
|
list-style-type: none;
|
|
114
117
|
padding: 0;
|
|
115
118
|
margin: 0;
|
|
119
|
+
--field-padding: 0.4em;
|
|
120
|
+
--field-height: 4rem;
|
|
116
121
|
|
|
117
122
|
li:first-of-type {
|
|
118
123
|
border-top: 1px solid var(--bms-grey-10);
|
|
@@ -131,11 +136,16 @@ ul {
|
|
|
131
136
|
display: flex;
|
|
132
137
|
align-items: center;
|
|
133
138
|
cursor: pointer;
|
|
134
|
-
padding:
|
|
139
|
+
padding: var(--field-padding);
|
|
135
140
|
border: 1px solid var(--bms-grey-10);
|
|
136
141
|
border-top: none;
|
|
137
142
|
background-color: var(--bms-white);
|
|
138
|
-
min-height:
|
|
143
|
+
min-height: var(--field-height);
|
|
144
|
+
|
|
145
|
+
&.small {
|
|
146
|
+
--field-padding: 0.2em 0.4em;
|
|
147
|
+
--field-height: 2rem;
|
|
148
|
+
}
|
|
139
149
|
|
|
140
150
|
&:hover,
|
|
141
151
|
&.selected {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Caption } from '@/models';
|
|
2
|
+
|
|
3
|
+
export interface FieldComponentProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
optional?: boolean;
|
|
7
|
+
helperText?: string;
|
|
8
|
+
errors?: string[] | Caption[];
|
|
9
|
+
captions?: string[] | Caption[];
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
small?: boolean;
|
|
12
|
+
}
|