@ouestfrance/sipa-bms-ui 8.23.5 → 8.24.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.
Files changed (39) hide show
  1. package/dist/components/form/BmsBetweenInput.vue.d.ts +2 -2
  2. package/dist/components/form/BmsInputCheckboxCaption.vue.d.ts +4 -4
  3. package/dist/components/form/BmsInputCheckboxCaptionGroup.vue.d.ts +4 -4
  4. package/dist/components/form/BmsInputDateTime.vue.d.ts +4 -2
  5. package/dist/components/form/BmsInputNumber.vue.d.ts +2 -0
  6. package/dist/components/form/BmsInputRadioCaption.vue.d.ts +4 -4
  7. package/dist/components/form/BmsInputText.vue.d.ts +6 -2
  8. package/dist/components/form/BmsInputTime.vue.d.ts +26 -0
  9. package/dist/components/form/BmsSearch.vue.d.ts +6 -2
  10. package/dist/components/form/RawAutocomplete.vue.d.ts +4 -1
  11. package/dist/components/form/RawInputText.vue.d.ts +3 -1
  12. package/dist/components/navigation/UiTenantSwitcher.vue.d.ts +5 -1
  13. package/dist/components/table/BmsTableFilters.vue.d.ts +5 -1
  14. package/dist/index.d.ts +2 -1
  15. package/dist/models/form.model.d.ts +4 -3
  16. package/dist/sipa-bms-ui.css +49 -48
  17. package/dist/sipa-bms-ui.es.js +204 -134
  18. package/dist/sipa-bms-ui.es.js.map +1 -1
  19. package/dist/sipa-bms-ui.umd.js +211 -140
  20. package/dist/sipa-bms-ui.umd.js.map +1 -1
  21. package/package.json +1 -1
  22. package/src/components/form/BmsBetweenInput.vue +3 -3
  23. package/src/components/form/BmsInputCheckboxCaption.vue +2 -2
  24. package/src/components/form/BmsInputCheckboxCaptionGroup.vue +2 -2
  25. package/src/components/form/BmsInputDateTime.stories.js +7 -0
  26. package/src/components/form/BmsInputDateTime.vue +5 -2
  27. package/src/components/form/BmsInputNumber.stories.js +8 -0
  28. package/src/components/form/BmsInputNumber.vue +3 -0
  29. package/src/components/form/BmsInputRadioCaption.vue +2 -2
  30. package/src/components/form/BmsInputText.stories.js +3 -5
  31. package/src/components/form/BmsInputText.vue +4 -1
  32. package/src/components/form/BmsInputTime.stories.js +65 -0
  33. package/src/components/form/BmsInputTime.vue +62 -0
  34. package/src/components/form/BmsMultiSelect.vue +1 -1
  35. package/src/components/form/BmsSearch.vue +1 -1
  36. package/src/components/form/BmsTag.vue +3 -2
  37. package/src/components/form/RawInputText.vue +19 -1
  38. package/src/index.ts +3 -0
  39. package/src/models/form.model.ts +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouestfrance/sipa-bms-ui",
3
- "version": "8.23.5",
3
+ "version": "8.24.1",
4
4
  "author": "Ouest-France BMS",
5
5
  "license": "ISC",
6
6
  "scripts": {
@@ -48,8 +48,8 @@ export interface Props {
48
48
  helperText?: string;
49
49
  placeholderFrom?: string;
50
50
  placeholderTo?: string;
51
- captions?: string[] | Caption[];
52
- errors?: string[] | Caption[];
51
+ captions?: (string | Caption)[];
52
+ errors?: (string | Caption)[];
53
53
  }
54
54
 
55
55
  const props = withDefaults(defineProps<Props>(), {
@@ -102,7 +102,7 @@ const allErrors = computed(() => {
102
102
  }
103
103
  if (msg) {
104
104
  return props.errors?.length
105
- ? ([...props.errors].concat([msg]) as string[] | Caption[])
105
+ ? ([...props.errors].concat([msg]) as (string | Caption)[])
106
106
  : [msg];
107
107
  }
108
108
  return props.errors;
@@ -42,8 +42,8 @@ export interface Props {
42
42
  name: string;
43
43
  disabled?: boolean;
44
44
  required?: boolean;
45
- errors?: string[] | Caption[];
46
- captions?: string[] | Caption[];
45
+ errors?: (string | Caption)[];
46
+ captions?: (string | Caption)[];
47
47
  }
48
48
 
49
49
  const props = withDefaults(defineProps<Props>(), {
@@ -31,8 +31,8 @@ export interface Props {
31
31
  optional?: boolean;
32
32
  disabled?: boolean;
33
33
  helperText?: string;
34
- captions?: string[] | Caption[];
35
- errors?: string[] | Caption[];
34
+ captions?: (string | Caption)[];
35
+ errors?: (string | Caption)[];
36
36
  align?: 'row' | 'column';
37
37
  }
38
38
 
@@ -46,6 +46,13 @@ WithValue.args = {
46
46
  modelValue: '2018-06-12T19:30',
47
47
  };
48
48
 
49
+ export const WithStep = Template.bind({});
50
+ WithStep.args = {
51
+ label: 'My label',
52
+ modelValue: '2018-06-12T19:30',
53
+ step: 10,
54
+ };
55
+
49
56
  export const Disabled = Template.bind({});
50
57
  Disabled.args = {
51
58
  label: 'My label',
@@ -10,6 +10,7 @@
10
10
  :captions="captions"
11
11
  :errors="errors"
12
12
  :inputType="inputType"
13
+ :step="step"
13
14
  @input="onInput"
14
15
  />
15
16
  </template>
@@ -28,9 +29,10 @@ export interface Props {
28
29
  disabled?: boolean;
29
30
  helperText?: string;
30
31
  placeholder?: string;
31
- captions?: string[] | Caption[];
32
- errors?: string[] | Caption[];
32
+ captions?: (string | Caption)[];
33
+ errors?: (string | Caption)[];
33
34
  hasTime?: boolean;
35
+ step?: number;
34
36
  }
35
37
 
36
38
  const props = withDefaults(defineProps<Props>(), {
@@ -38,6 +40,7 @@ const props = withDefaults(defineProps<Props>(), {
38
40
  required: false,
39
41
  disabled: false,
40
42
  hasTime: true,
43
+ step: 0,
41
44
  });
42
45
 
43
46
  const inputType = computed(() =>
@@ -80,6 +80,14 @@ WithLimitAndEmptyValue.args = {
80
80
  errors: [],
81
81
  };
82
82
 
83
+ export const WithStep = Template.bind({});
84
+ WithStep.args = {
85
+ label: 'My label',
86
+ modelValue: 10,
87
+ modelValueSmall: 10,
88
+ step: 10,
89
+ };
90
+
83
91
  export const WithLimitExceeded = Template.bind({});
84
92
  WithLimitExceeded.args = {
85
93
  label: 'My label',
@@ -12,6 +12,7 @@
12
12
  :inputType="InputType.NUMBER"
13
13
  :min="min"
14
14
  :max="max"
15
+ :step="step"
15
16
  @input="onInput"
16
17
  />
17
18
  </template>
@@ -32,6 +33,7 @@ export interface Props {
32
33
  placeholder?: string;
33
34
  captions?: (string | Caption)[];
34
35
  errors?: (string | Caption)[];
36
+ step?: number;
35
37
  max?: number;
36
38
  min?: number;
37
39
  }
@@ -40,6 +42,7 @@ const props = withDefaults(defineProps<Props>(), {
40
42
  label: '',
41
43
  required: false,
42
44
  disabled: false,
45
+ step: 0,
43
46
  });
44
47
 
45
48
  const input: Ref<HTMLElement | null> = ref(null);
@@ -41,8 +41,8 @@ export interface Props {
41
41
  label?: string;
42
42
  disabled?: boolean;
43
43
  required?: boolean;
44
- errors?: string[] | Caption[];
45
- captions?: string[] | Caption[];
44
+ errors?: (string | Caption)[];
45
+ captions?: (string | Caption)[];
46
46
  }
47
47
 
48
48
  const props = withDefaults(defineProps<Props>(), {
@@ -16,9 +16,7 @@ export default {
16
16
 
17
17
  const Template = (args) => ({
18
18
  setup() {
19
- const modelValue = ref(args.modelValue);
20
- const modelValueSmall = ref(args.modelValueSmall);
21
- return { args, modelValue, modelValueSmall };
19
+ return { args };
22
20
  },
23
21
  components: {
24
22
  BmsInputText,
@@ -26,12 +24,12 @@ const Template = (args) => ({
26
24
  CloudLightning,
27
25
  },
28
26
  template: `
29
- <BmsInputText v-bind="args" v-model="modelValue">
27
+ <BmsInputText v-bind="args" v-model="args.modelValue">
30
28
  <template v-if="args.iconStart" #icon-start><BookOpen/></template>
31
29
  <template v-if="args.iconEnd" #icon-end><CloudLightning/></template>
32
30
  </BmsInputText>
33
31
  <br/>
34
- <BmsInputText v-bind="{...args, small:true}" v-model="modelValueSmall">
32
+ <BmsInputText v-bind="{...args, small:true}" v-model="args.modelValueSmall">
35
33
  <template v-if="args.iconStart" #icon-start><BookOpen/></template>
36
34
  <template v-if="args.iconEnd" #icon-end><CloudLightning/></template>
37
35
  </BmsInputText>
@@ -11,6 +11,7 @@
11
11
  :errors="computedErrors"
12
12
  :hasDate="false"
13
13
  :small="small"
14
+ :step="step"
14
15
  :min="min"
15
16
  :max="max"
16
17
  :minlength="minlength"
@@ -39,13 +40,15 @@ export interface Props extends FieldComponentProps {
39
40
  | InputType.TEXT
40
41
  | InputType.NUMBER
41
42
  | InputType.DATE
42
- | InputType.DATETIME;
43
+ | InputType.DATETIME
44
+ | InputType.TIME;
43
45
  modelValue: string | number;
44
46
  placeholder?: string;
45
47
  min?: number;
46
48
  max?: number;
47
49
  minlength?: number;
48
50
  maxlength?: number;
51
+ step?: number;
49
52
  }
50
53
 
51
54
  const props = withDefaults(defineProps<Props>(), {
@@ -0,0 +1,65 @@
1
+ import BmsInputTime from '@/components/form/BmsInputTime.vue';
2
+ import { BookOpen, CloudLightning, Mail, Eye } from 'lucide-vue-next';
3
+ import template from '@/documentation/template_field_dependency.mdx';
4
+ import { ref } from 'vue';
5
+
6
+ export default {
7
+ title: 'Composants/form/InputTime',
8
+ component: BmsInputTime,
9
+ parameters: {
10
+ docs: {
11
+ page: template,
12
+ },
13
+ },
14
+ };
15
+
16
+ const Template = (args) => ({
17
+ setup() {
18
+ return { args };
19
+ },
20
+ components: {
21
+ BmsInputTime,
22
+ BookOpen,
23
+ CloudLightning,
24
+ },
25
+ template: `
26
+ <BmsInputTime v-bind="args" v-model="args.modelValue">
27
+ <template v-if="args.iconStart" #icon-start><BookOpen/></template>
28
+ <template v-if="args.iconEnd" #icon-end><CloudLightning/></template>
29
+ </BmsInputTime>
30
+ <br/>
31
+ <BmsInputTime v-bind="{...args, small:true}" v-model="args.modelValueSmall">
32
+ <template v-if="args.iconStart" #icon-start><BookOpen/></template>
33
+ <template v-if="args.iconEnd" #icon-end><CloudLightning/></template>
34
+ </BmsInputTime>
35
+ `,
36
+ });
37
+
38
+ export const Default = Template.bind({});
39
+ Default.args = {
40
+ label: 'My label',
41
+ placeholder: 'Placeholder',
42
+ captions: ['There is more information'],
43
+ modelValue: '',
44
+ modelValueSmall: '',
45
+ };
46
+
47
+ export const WithSeconds = Template.bind({});
48
+ WithSeconds.args = {
49
+ label: 'My label hasSeconds',
50
+ placeholder: 'Placeholder',
51
+ captions: ['There is more information'],
52
+ modelValue: '',
53
+ modelValueSmall: '',
54
+ hasSeconds: true,
55
+ };
56
+
57
+ export const WithStep = Template.bind({});
58
+ WithStep.args = {
59
+ label: 'My label',
60
+ placeholder: 'Placeholder',
61
+ captions: ['There is more information'],
62
+ modelValue: '',
63
+ modelValueSmall: '',
64
+ step: 10, // max 15 (multiple de 60)
65
+ };
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <BmsInputText
3
+ :modelValue="modelValue"
4
+ :label="label"
5
+ :required="required"
6
+ :optional="optional"
7
+ :disabled="disabled"
8
+ :helperText="helperText"
9
+ :placeholder="placeholder"
10
+ :captions="captions"
11
+ :errors="errors"
12
+ :inputType="InputType.TIME"
13
+ :step="computedStep"
14
+ @input="onInput"
15
+ />
16
+ </template>
17
+
18
+ <script lang="ts" setup>
19
+ import { Caption } from '@/models/caption.model';
20
+ import BmsInputText from '@/components/form/BmsInputText.vue';
21
+ import { InputType } from '@/models';
22
+ import { computed } from 'vue';
23
+
24
+ export interface Props {
25
+ modelValue: string;
26
+ label?: string;
27
+ required?: boolean;
28
+ optional?: boolean;
29
+ disabled?: boolean;
30
+ helperText?: string;
31
+ placeholder?: string;
32
+ captions?: (string | Caption)[];
33
+ errors?: (string | Caption)[];
34
+ step?: number;
35
+ hasSeconds?: boolean;
36
+ }
37
+
38
+ const props = withDefaults(defineProps<Props>(), {
39
+ label: '',
40
+ required: false,
41
+ disabled: false,
42
+ step: 0,
43
+ hasSeconds: false,
44
+ });
45
+
46
+ const computedStep = computed(() => {
47
+ if (props.hasSeconds && !props.step) {
48
+ return 1;
49
+ } else {
50
+ return props.step;
51
+ }
52
+ });
53
+
54
+ const $emits = defineEmits<{
55
+ (e: 'update:modelValue', value: string): void;
56
+ }>();
57
+
58
+ const onInput = (e: Event) => {
59
+ const value = (e?.target as HTMLInputElement).value;
60
+ if (!props.disabled && value) $emits('update:modelValue', value);
61
+ };
62
+ </script>
@@ -202,7 +202,7 @@ const filteredOptions = computed(() =>
202
202
  display: block;
203
203
  width: 1em;
204
204
  height: 1em;
205
- margin: 0 1em 0 0.5em;
205
+ margin: 0 var(--field-padding);
206
206
  }
207
207
  }
208
208
  </style>
@@ -26,7 +26,7 @@ export interface Props {
26
26
  modelValue: string;
27
27
  placeholder?: string;
28
28
  disabled?: boolean;
29
- errors?: string[] | Caption[];
29
+ errors?: (string | Caption)[];
30
30
  }
31
31
 
32
32
  const input: Ref<typeof BmsInputText | null> = ref(null);
@@ -39,7 +39,7 @@ const emits = defineEmits(['dismiss', 'click']);
39
39
  justify-content: center;
40
40
  align-items: center;
41
41
  gap: 8px;
42
- border-radius: 12px;
42
+ border-radius: var(--bms-border-radius-xlarge);
43
43
  border: 1px solid var(--tag-border-color);
44
44
  width: fit-content;
45
45
  padding: 4px 8px;
@@ -62,7 +62,8 @@ const emits = defineEmits(['dismiss', 'click']);
62
62
  }
63
63
 
64
64
  &.small {
65
- padding: 2px 4px;
65
+ padding: 0px 4px;
66
+ margin-block: 1px;
66
67
  gap: 4px;
67
68
  }
68
69
 
@@ -16,6 +16,7 @@
16
16
  :disabled="disabled"
17
17
  :max="max"
18
18
  :min="min"
19
+ :step="computedStep"
19
20
  :minlength="minlength"
20
21
  :maxlength="maxlength"
21
22
  @blur="$emits('blur')"
@@ -42,11 +43,13 @@ export interface Props extends FieldComponentProps {
42
43
  max?: number;
43
44
  minlength?: number;
44
45
  maxlength?: number;
46
+ step?: number;
45
47
  type?:
46
48
  | InputType.TEXT
47
49
  | InputType.NUMBER
48
50
  | InputType.DATE
49
- | InputType.DATETIME;
51
+ | InputType.DATETIME
52
+ | InputType.TIME;
50
53
  }
51
54
 
52
55
  const props = withDefaults(defineProps<Props>(), {
@@ -54,9 +57,24 @@ const props = withDefaults(defineProps<Props>(), {
54
57
  required: false,
55
58
  disabled: false,
56
59
  focus: false,
60
+ step: 0,
57
61
  });
58
62
  const input: Ref<HTMLElement | null> = ref(null);
59
63
 
64
+ const computedStep = computed(() => {
65
+ if (
66
+ [
67
+ InputType.TIME,
68
+ InputType.DATE,
69
+ InputType.DATETIME,
70
+ InputType.NUMBER,
71
+ ].includes(props.type)
72
+ ) {
73
+ return props.step || 0;
74
+ }
75
+ return 0;
76
+ });
77
+
60
78
  const $emits = defineEmits<{
61
79
  'update:modelValue': [value: string];
62
80
  blur: [];
package/src/index.ts CHANGED
@@ -36,6 +36,7 @@ import BmsSearch from './components/form/BmsSearch.vue';
36
36
  import BmsSelect from './components/form/BmsSelect.vue';
37
37
  import BmsTag from './components/form/BmsTag.vue';
38
38
  import BmsTextArea from './components/form/BmsTextArea.vue';
39
+ import BmsInputTime from './components/form/BmsInputTime.vue';
39
40
 
40
41
  import BmsContentPageLayout from './components/layout/BmsContentPageLayout.vue';
41
42
  import BmsCard from './components/layout/BmsCard.vue';
@@ -111,6 +112,7 @@ export const createBmsUi = () => ({
111
112
  app.component('BmsSelect', BmsSelect);
112
113
  app.component('BmsTag', BmsTag);
113
114
  app.component('BmsTextArea', BmsTextArea);
115
+ app.component('BmsInputTime', BmsInputTime);
114
116
 
115
117
  app.component('BmsContentPageLayout', BmsContentPageLayout);
116
118
  app.component('BmsCard', BmsCard);
@@ -187,6 +189,7 @@ export {
187
189
  BmsInputRadioCaption,
188
190
  BmsInputRadioCaptionGroup,
189
191
  BmsInputText,
192
+ BmsInputTime,
190
193
  BmsInputToggle,
191
194
  BmsMultiSelect,
192
195
  BmsSearch,
@@ -14,13 +14,13 @@ export interface BmsInputCheckboxGroupOption {
14
14
  export interface BmsInputRadioCaptionGroupOption {
15
15
  value: any;
16
16
  label?: string;
17
- captions: string[] | Caption[];
17
+ captions: (string | Caption)[];
18
18
  }
19
19
 
20
20
  export interface BmsInputCheckboxCaptionGroupOption {
21
21
  value: any;
22
22
  label?: string;
23
- captions: string[] | Caption[];
23
+ captions: (string | Caption)[];
24
24
  }
25
25
 
26
26
  export enum InputType {
@@ -28,6 +28,7 @@ export enum InputType {
28
28
  NUMBER = 'number',
29
29
  DATE = 'date',
30
30
  DATETIME = 'datetime-local',
31
+ TIME = 'time',
31
32
  }
32
33
 
33
34
  export interface InputOption {