@ouestfrance/sipa-bms-ui 8.3.0 → 8.5.0

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 (81) hide show
  1. package/dist/components/form/BmsAutocomplete.vue.d.ts +3 -9
  2. package/dist/components/form/BmsInputBooleanCheckbox.vue.d.ts +3 -9
  3. package/dist/components/form/BmsInputCheckboxCaption.vue.d.ts +1 -1
  4. package/dist/components/form/BmsInputCheckboxGroup.vue.d.ts +4 -11
  5. package/dist/components/form/BmsInputCode.vue.d.ts +4 -11
  6. package/dist/components/form/BmsInputFile.vue.d.ts +2 -9
  7. package/dist/components/form/BmsInputRadioCaptionGroup.vue.d.ts +2 -9
  8. package/dist/components/form/BmsInputRadioGroup.vue.d.ts +2 -9
  9. package/dist/components/form/BmsInputText.vue.d.ts +10 -12
  10. package/dist/components/form/BmsInputToggle.vue.d.ts +5 -6
  11. package/dist/components/form/BmsMultiSelect.vue.d.ts +3 -9
  12. package/dist/components/form/BmsSearch.vue.d.ts +11 -5
  13. package/dist/components/form/BmsSelect.vue.d.ts +3 -8
  14. package/dist/components/form/BmsTag.vue.d.ts +1 -0
  15. package/dist/components/form/BmsTextArea.vue.d.ts +2 -9
  16. package/dist/components/form/RawAutocomplete.vue.d.ts +10 -11
  17. package/dist/components/form/RawInputText.vue.d.ts +3 -5
  18. package/dist/components/layout/BmsCard.vue.d.ts +3 -0
  19. package/dist/components/navigation/BmsFixedMenu.vue.d.ts +17 -0
  20. package/dist/components/navigation/UiTenantSwitcher.vue.d.ts +11 -5
  21. package/dist/components/table/BmsTableFilters.vue.d.ts +11 -5
  22. package/dist/index.d.ts +2 -1
  23. package/dist/mockServiceWorker.js +1 -1
  24. package/dist/plugins/field/FieldComponent.vue.d.ts +3 -11
  25. package/dist/plugins/field/FieldDatalist.vue.d.ts +2 -0
  26. package/dist/plugins/field/field-component.model.d.ts +11 -0
  27. package/dist/sipa-bms-ui.css +201 -147
  28. package/dist/sipa-bms-ui.es.js +4855 -3921
  29. package/dist/sipa-bms-ui.es.js.map +1 -1
  30. package/dist/sipa-bms-ui.umd.js +4861 -3926
  31. package/dist/sipa-bms-ui.umd.js.map +1 -1
  32. package/package.json +20 -24
  33. package/src/components/form/BmsAutocomplete.stories.js +10 -0
  34. package/src/components/form/BmsAutocomplete.vue +4 -9
  35. package/src/components/form/BmsBetweenInput.vue +1 -10
  36. package/src/components/form/BmsFilePicker.stories.js +0 -7
  37. package/src/components/form/BmsInputBooleanCheckbox.stories.js +6 -0
  38. package/src/components/form/BmsInputBooleanCheckbox.vue +3 -16
  39. package/src/components/form/BmsInputCheckboxCaptionGroup.vue +1 -9
  40. package/src/components/form/BmsInputCheckboxGroup.vue +3 -18
  41. package/src/components/form/BmsInputCode.stories.js +2 -0
  42. package/src/components/form/BmsInputCode.vue +3 -18
  43. package/src/components/form/BmsInputDateTime.stories.js +2 -0
  44. package/src/components/form/BmsInputFile.stories.js +4 -1
  45. package/src/components/form/BmsInputFile.vue +5 -20
  46. package/src/components/form/BmsInputNumber.stories.js +5 -0
  47. package/src/components/form/BmsInputRadioCaptionGroup.vue +3 -18
  48. package/src/components/form/BmsInputRadioGroup.stories.js +12 -0
  49. package/src/components/form/BmsInputRadioGroup.vue +4 -19
  50. package/src/components/form/BmsInputText.spec.ts +1 -1
  51. package/src/components/form/BmsInputText.stories.js +5 -0
  52. package/src/components/form/BmsInputText.vue +5 -19
  53. package/src/components/form/BmsInputToggle.stories.js +3 -0
  54. package/src/components/form/BmsInputToggle.vue +13 -15
  55. package/src/components/form/BmsMultiSelect.stories.js +10 -1
  56. package/src/components/form/BmsMultiSelect.vue +5 -17
  57. package/src/components/form/BmsSearch.stories.js +2 -0
  58. package/src/components/form/BmsSelect.stories.js +4 -1
  59. package/src/components/form/BmsSelect.vue +7 -20
  60. package/src/components/form/BmsTag.stories.js +9 -0
  61. package/src/components/form/BmsTag.vue +9 -6
  62. package/src/components/form/BmsTextArea.stories.js +3 -2
  63. package/src/components/form/BmsTextArea.vue +12 -21
  64. package/src/components/form/RawAutocomplete.spec.ts +30 -10
  65. package/src/components/form/RawAutocomplete.vue +8 -18
  66. package/src/components/form/RawInputText.vue +11 -9
  67. package/src/components/form/UiBmsInputCheckbox.stories.js +10 -0
  68. package/src/components/layout/BmsCard.stories.js +14 -0
  69. package/src/components/layout/BmsCard.vue +14 -2
  70. package/src/components/navigation/BmsFixedMenu.stories.js +113 -0
  71. package/src/components/navigation/BmsFixedMenu.vue +70 -0
  72. package/src/components/navigation/BmsMenuNav.vue +5 -1
  73. package/src/components/table/UiBmsTableRow.vue +4 -4
  74. package/src/index.ts +3 -0
  75. package/src/plugins/field/FieldComponent.stories.js +8 -1
  76. package/src/plugins/field/FieldComponent.vue +29 -15
  77. package/src/plugins/field/FieldDatalist.stories.js +2 -0
  78. package/src/plugins/field/FieldDatalist.vue +12 -2
  79. package/src/plugins/field/field-component.model.ts +12 -0
  80. package/src/showroom/pages/autocomplete.vue +7 -4
  81. package/src/showroom/pages/forms.vue +28 -0
@@ -0,0 +1,113 @@
1
+ import BmsFixedMenu from '@/components/navigation/BmsFixedMenu.vue';
2
+ import { Activity, ArrowBigDown, Globe, User } from 'lucide-vue-next';
3
+ import { vueRouter } from 'storybook-vue3-router';
4
+
5
+ export default {
6
+ title: 'Composants/navigation/FixedMenu',
7
+ component: BmsFixedMenu,
8
+ argTypes: {
9
+ items: {},
10
+ },
11
+ decorators: [
12
+ vueRouter([
13
+ {
14
+ name: 'home',
15
+ path: '/',
16
+ },
17
+ {
18
+ name: 'activity',
19
+ path: '/activity',
20
+ },
21
+ {
22
+ name: 'users',
23
+ path: '/users',
24
+ },
25
+ {
26
+ name: 'thirdRoute',
27
+ path: '/tutu',
28
+ },
29
+ ]),
30
+ ],
31
+ };
32
+
33
+ const Template = (args) => ({
34
+ components: {
35
+ BmsFixedMenu,
36
+ },
37
+ setup() {
38
+ return { args };
39
+ },
40
+ template: `
41
+ <BmsFixedMenu v-bind="args">
42
+ <template v-if="args.additionalSlot" #additional>Additional</template>
43
+ <template v-if="args.footerSlot" #footer>Footer</template>
44
+ </BmsFixedMenu>
45
+ `,
46
+ });
47
+
48
+ export const Default = Template.bind({});
49
+ Default.args = {
50
+ items: [
51
+ {
52
+ label: 'Activity',
53
+ link: '/activity',
54
+ icon: Activity,
55
+ },
56
+ {
57
+ label: 'Users',
58
+ link: '/users',
59
+ icon: User,
60
+ },
61
+ {
62
+ label: 'Parent',
63
+ items: [
64
+ {
65
+ label: 'tata',
66
+ link: '/tata',
67
+ icon: Globe,
68
+ },
69
+ {
70
+ label: 'tutu',
71
+ link: '/tutu',
72
+ },
73
+ ],
74
+ },
75
+ ],
76
+ activeLink: '/',
77
+ };
78
+
79
+ export const WithActiveLink = Template.bind({});
80
+ WithActiveLink.args = {
81
+ items: [
82
+ {
83
+ label: 'Activity',
84
+ link: '/activity',
85
+ icon: Activity,
86
+ },
87
+ {
88
+ label: 'Users',
89
+ link: '/users',
90
+ icon: User,
91
+ },
92
+ ],
93
+ activeLink: '/activity',
94
+ };
95
+
96
+ export const WithSlots = Template.bind({});
97
+ WithSlots.args = {
98
+ items: [
99
+ {
100
+ label: 'Activity',
101
+ link: '/activity',
102
+ icon: Activity,
103
+ },
104
+ {
105
+ label: 'Users',
106
+ link: '/users',
107
+ icon: User,
108
+ },
109
+ ],
110
+ activeLink: '/users',
111
+ additionalSlot: true,
112
+ footerSlot: true,
113
+ };
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <div class="menu__container">
3
+ <div class="menu__top">
4
+ <slot name="top"></slot>
5
+ </div>
6
+
7
+ <BmsMenuNav :items="items" :active-link="activeLink">
8
+ <template #additional>
9
+ <slot name="additional"></slot>
10
+ </template>
11
+ </BmsMenuNav>
12
+
13
+ <div class="menu__copyright">
14
+ <slot name="footer">
15
+ <p class="menu__copyright-madein">Made with ♥ by BMS</p>
16
+ </slot>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script lang="ts" setup>
22
+ import type { RouteLocationNormalizedLoaded } from 'vue-router';
23
+ import { MenuItem, ParentMenuItem } from '@/models';
24
+ import BmsMenuNav from './BmsMenuNav.vue';
25
+
26
+ interface Props {
27
+ items: (MenuItem | ParentMenuItem)[];
28
+ activeLink: RouteLocationNormalizedLoaded;
29
+ }
30
+ defineProps<Props>();
31
+ </script>
32
+
33
+ <style lang="scss" scoped>
34
+ .menu {
35
+ &__container {
36
+ display: flex;
37
+ flex-direction: column;
38
+ height: 100%;
39
+ width: 100%;
40
+ background: var(--bms-white);
41
+ border-right: 1px solid var(--bms-grey-10);
42
+ padding: 0;
43
+
44
+ nav {
45
+ scrollbar-width: none;
46
+ padding: 0;
47
+ overflow-x: hidden;
48
+ max-width: calc(var(--bms-menu-width) + 5px);
49
+
50
+ :deep(ul) {
51
+ li {
52
+ width: var(--bms-menu-width);
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ &__top {
59
+ margin: 0.5em;
60
+ }
61
+
62
+ &__copyright {
63
+ display: flex;
64
+ justify-content: center;
65
+ align-items: center;
66
+ min-height: 80px;
67
+ overflow-x: hidden;
68
+ }
69
+ }
70
+ </style>
@@ -92,7 +92,11 @@ const isLinkRecognized = (link: RouteLocationRaw): boolean => {
92
92
  if ((link as RouteLocationPathRaw).path) {
93
93
  return (link as RouteLocationPathRaw).path === props.activeLink.path;
94
94
  }
95
- return link === props.activeLink.name || link === props.activeLink.path;
95
+ return (
96
+ link === props.activeLink.name ||
97
+ link === props.activeLink.path ||
98
+ link === props.activeLink
99
+ );
96
100
  };
97
101
 
98
102
  const isItemActive = (menuItem: MenuItem | ParentMenuItem): boolean => {
@@ -28,9 +28,10 @@
28
28
  :key="cell.key"
29
29
  >
30
30
  <div v-if="isChildElement" class="bms-table__row__cell--child-element">
31
- <div class="bms-table__row__cell--child-element__icon">
32
- <CornerDownRight v-if="index === 0" />
33
- </div>
31
+ <CornerDownRight
32
+ v-if="index === 0"
33
+ class="bms-table__row__cell--child-element__icon"
34
+ />
34
35
  <slot
35
36
  :name="cell.key"
36
37
  :row="item.childElement"
@@ -141,7 +142,6 @@ const getAlignClass = (header: TableHeader) => {
141
142
  align-items: flex-end;
142
143
  &__icon {
143
144
  display: flex;
144
- min-width: 1em;
145
145
  margin-right: 1em;
146
146
  }
147
147
  }
package/src/index.ts CHANGED
@@ -47,6 +47,7 @@ import BmsStepper from './components/layout/BmsStepper.vue';
47
47
 
48
48
  import BmsBackButton from './components/navigation/BmsBackButton.vue';
49
49
  import BmsBreadcrumb from './components/navigation/BmsBreadcrumb.vue';
50
+ import BmsFixedMenu from './components/navigation/BmsFixedMenu.vue';
50
51
  import BmsLink from './components/navigation/BmsLink.vue';
51
52
  import BmsMenu from './components/navigation/BmsMenu.vue';
52
53
  import BmsMenuNav from './components/navigation/BmsMenuNav.vue';
@@ -115,6 +116,7 @@ export const createBmsUi = () => ({
115
116
 
116
117
  app.component('BmsBackButton', BmsBackButton);
117
118
  app.component('BmsBreadcrumb', BmsBreadcrumb);
119
+ app.component('BmsFixedMenu', BmsFixedMenu);
118
120
  app.component('BmsLink', BmsLink);
119
121
  app.component('BmsMenu', BmsMenu);
120
122
  app.component('BmsMenuNav', BmsMenuNav);
@@ -189,6 +191,7 @@ export {
189
191
  BmsStepper,
190
192
  BmsBackButton,
191
193
  BmsBreadcrumb,
194
+ BmsFixedMenu,
192
195
  BmsLink,
193
196
  BmsMenu,
194
197
  BmsMenuNav,
@@ -21,7 +21,7 @@ const Template = (args) => ({
21
21
  <template #icon-start v-if="args.iconStart">
22
22
  <Flashlight/>
23
23
  </template>
24
- <p>slot for my input here</p>
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
- interface Props {
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 `field${props.errors?.length ? ' is-error' : ''}${
78
- props.disabled ? ' is-disabled' : ''
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: bold;
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>
@@ -14,6 +14,8 @@ const Template = (args) => ({
14
14
  },
15
15
  template: `
16
16
  <FieldDatalist v-bind="args"/>
17
+ <br/>
18
+ <FieldDatalist v-bind="{...args, small:true}"/>
17
19
  `,
18
20
  });
19
21
 
@@ -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: 0.4em;
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: 4rem;
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
+ }
@@ -1,5 +1,9 @@
1
1
  <template>
2
2
  <BmsBackButton :fallback="{ path: '/' }" />
3
+ <br />
4
+ <BmsButton @click="inputLabelValue = '1'">Set value to '1'</BmsButton>
5
+ <br />
6
+ Valeur: {{ inputLabelValue }}
3
7
  <BmsAutocomplete
4
8
  label="Autocomplete avec label/value"
5
9
  :options="optionsLabelValue"
@@ -8,22 +12,20 @@
8
12
  @add-new-option="onAddNewOption"
9
13
  />
10
14
 
11
- Valeur: {{ inputLabelValue }}
12
-
15
+ Valeur: {{ inputValueIcon }}
13
16
  <BmsAutocomplete
14
17
  label="Autocomplete avec icones"
15
18
  :options="optionsIcon"
16
19
  v-model="inputValueIcon"
17
20
  @select="(o) => console.log('select', o.value)"
18
21
  />
19
- Valeur: {{ inputValueIcon }}
20
22
 
23
+ Valeur: {{ inputText }}
21
24
  <BmsAutocomplete
22
25
  label="Autocomplete avec tableau de strings"
23
26
  :options="optionsText"
24
27
  v-model="inputText"
25
28
  />
26
- Valeur: {{ inputText }}
27
29
  </template>
28
30
 
29
31
  <script setup lang="ts">
@@ -31,6 +33,7 @@ import { BmsAutocomplete, BmsBackButton } from '@/index';
31
33
  import { Heart, Cat } from 'lucide-vue-next';
32
34
  import { range } from 'lodash';
33
35
  import { ref } from 'vue';
36
+ import BmsButton from '@/components/button/BmsButton.vue';
34
37
 
35
38
  const optionsLabelValue = ref(
36
39
  range(0, 30).map((i) =>
@@ -320,6 +320,34 @@
320
320
  </BmsForm>
321
321
  <hr />
322
322
 
323
+ <h2>Small components</h2>
324
+ <BmsInputText label="Text" small v-model="text" />
325
+ <BmsInputBooleanCheckbox
326
+ label="Boolean checkbox"
327
+ label-value="Yes"
328
+ name="boolean"
329
+ small
330
+ v-model="firstToggle"
331
+ />
332
+ <BmsSelect
333
+ label="Select"
334
+ small
335
+ v-model="selected"
336
+ :options="[
337
+ { label: 'value1', value: 'value1' },
338
+ { label: 'value2', value: 'value2' },
339
+ ]"
340
+ />
341
+ <BmsTextArea label="Textarea" small v-model="text2" />
342
+ <BmsInputToggle
343
+ name="toggle-name"
344
+ label="Toggle"
345
+ label-value="Yes"
346
+ small
347
+ v-model="firstToggle"
348
+ />
349
+ <hr />
350
+
323
351
  <BmsButton submit>Submit</BmsButton>
324
352
  </form>
325
353
  </template>