@dative-gpi/foundation-shared-components 0.0.8 → 0.0.9

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 (139) hide show
  1. package/{models/FSButtons.ts → aliases/FSButton.ts} +24 -21
  2. package/aliases/index.ts +1 -0
  3. package/components/FSAutocompleteField.vue +207 -0
  4. package/components/FSBadge.vue +38 -0
  5. package/components/FSBreadcrumbs.vue +49 -55
  6. package/components/FSButton.vue +116 -101
  7. package/components/FSCalendar.vue +52 -39
  8. package/components/FSCalendarTwin.vue +120 -102
  9. package/components/FSCard.vue +35 -21
  10. package/components/FSCarousel.vue +63 -0
  11. package/components/FSCheckbox.vue +111 -103
  12. package/components/FSChip.vue +140 -0
  13. package/components/FSClock.vue +149 -15
  14. package/components/FSCol.vue +104 -98
  15. package/components/FSColor.vue +61 -64
  16. package/components/FSColorIcon.vue +67 -0
  17. package/components/FSContainer.vue +64 -0
  18. package/components/FSDateField.vue +211 -0
  19. package/components/FSDateRangeField.vue +225 -0
  20. package/components/FSDateTimeField.vue +257 -0
  21. package/components/FSDateTimeRangeField.vue +286 -0
  22. package/components/FSDialog.vue +103 -0
  23. package/components/FSDivider.vue +39 -0
  24. package/components/FSFadeOut.vue +49 -59
  25. package/components/FSFileButton.vue +245 -0
  26. package/components/FSHeaderButton.vue +17 -0
  27. package/components/FSIcon.vue +23 -23
  28. package/components/FSIconField.vue +232 -0
  29. package/components/FSImage.vue +142 -0
  30. package/components/FSLoadTile.vue +93 -0
  31. package/components/FSNumberField.vue +51 -53
  32. package/components/FSPasswordField.vue +99 -101
  33. package/components/FSRadio.vue +107 -109
  34. package/components/FSRadioGroup.vue +55 -57
  35. package/components/FSRemoveDialog.vue +123 -0
  36. package/components/FSRichTextField.vue +26 -33
  37. package/components/FSRow.vue +110 -104
  38. package/components/FSSearchField.vue +35 -27
  39. package/components/FSSelectField.vue +188 -0
  40. package/components/FSSlideGroup.vue +45 -49
  41. package/components/FSSlider.vue +31 -33
  42. package/components/FSSpan.vue +53 -37
  43. package/components/FSSubmitDialog.vue +165 -0
  44. package/components/FSSwitch.vue +110 -109
  45. package/components/FSTab.vue +61 -61
  46. package/components/FSTabs.vue +53 -55
  47. package/components/FSTag.vue +88 -84
  48. package/components/FSTagField.vue +32 -36
  49. package/components/FSTagGroup.vue +38 -45
  50. package/components/FSText.vue +74 -64
  51. package/components/FSTextArea.vue +187 -185
  52. package/components/FSTextField.vue +18 -20
  53. package/components/FSTile.vue +90 -0
  54. package/components/FSToggleSet.vue +282 -0
  55. package/components/FSTooltip.vue +21 -0
  56. package/components/FSWindow.vue +26 -16
  57. package/components/FSWrapGroup.vue +44 -47
  58. package/components/deviceOrganisations/FSConnectivity.vue +114 -0
  59. package/components/deviceOrganisations/FSStatus.vue +117 -0
  60. package/components/deviceOrganisations/FSStatusesCarousel.vue +105 -0
  61. package/components/deviceOrganisations/FSStatusesRow.vue +66 -0
  62. package/components/deviceOrganisations/FSWorstAlert.vue +165 -0
  63. package/components/lists/FSDataIteratorGroup.vue +7 -0
  64. package/components/lists/FSDataIteratorItem.vue +103 -0
  65. package/components/lists/FSDataTable.vue +964 -0
  66. package/components/lists/FSFilterButton.vue +176 -0
  67. package/components/lists/FSHeaderButton.vue +99 -0
  68. package/components/lists/FSHiddenButton.vue +79 -0
  69. package/components/tiles/FSDeviceOrganisationTileUI.vue +232 -0
  70. package/components/tiles/FSGroupTileUI.vue +192 -0
  71. package/composables/index.ts +1 -1
  72. package/composables/useBreakpoints.ts +23 -4
  73. package/composables/useColors.ts +53 -23
  74. package/composables/useSlots.ts +43 -0
  75. package/index.ts +6 -0
  76. package/models/breadcrumbs.ts +8 -0
  77. package/models/colors.ts +17 -0
  78. package/models/deviceAlerts.ts +10 -0
  79. package/models/deviceConnectivities.ts +11 -0
  80. package/models/deviceStatuses.ts +16 -0
  81. package/models/dispositions.ts +33 -0
  82. package/models/index.ts +9 -0
  83. package/models/modelStatuses.ts +11 -0
  84. package/models/rules.ts +50 -0
  85. package/models/toggleSets.ts +7 -0
  86. package/package.json +5 -4
  87. package/plugins/colorPlugin.ts +2 -2
  88. package/shims-plugin.d.ts +1 -1
  89. package/styles/components/fs_autocomplete_field.scss +123 -0
  90. package/styles/components/fs_button.scss +4 -6
  91. package/styles/components/fs_calendar.scss +24 -1
  92. package/styles/components/fs_card.scss +2 -5
  93. package/styles/components/fs_carousel.scss +4 -0
  94. package/styles/components/fs_chip.scss +33 -0
  95. package/styles/components/fs_clock.scss +43 -0
  96. package/styles/components/fs_col.scss +2 -0
  97. package/styles/components/fs_color_icon.scss +37 -0
  98. package/styles/components/fs_container.scss +16 -0
  99. package/styles/components/fs_data_iterator_item.scss +19 -0
  100. package/styles/components/fs_data_table.scss +97 -0
  101. package/styles/components/fs_date_field.scss +8 -0
  102. package/styles/components/fs_dialog.scss +30 -0
  103. package/styles/components/fs_divider.scss +5 -0
  104. package/styles/components/fs_fade_out.scss +10 -2
  105. package/styles/components/fs_filter_button.scss +12 -0
  106. package/styles/components/fs_header_button.scss +4 -0
  107. package/styles/components/fs_icon.scss +19 -3
  108. package/styles/components/fs_icon_field.scss +12 -0
  109. package/styles/components/fs_image.scss +7 -0
  110. package/styles/components/fs_load_tile.scss +49 -0
  111. package/styles/components/fs_password_field.scss +2 -2
  112. package/styles/components/fs_row.scss +4 -1
  113. package/styles/components/fs_select_field.scss +71 -0
  114. package/styles/components/fs_slide_group.scss +6 -0
  115. package/styles/components/fs_slider.scss +29 -9
  116. package/styles/components/fs_span.scss +8 -0
  117. package/styles/components/fs_submit_dialog.scss +9 -0
  118. package/styles/components/fs_tabs.scss +4 -0
  119. package/styles/components/fs_tag_field.scss +0 -11
  120. package/styles/components/fs_text_field.scss +23 -15
  121. package/styles/components/fs_tile.scss +33 -0
  122. package/styles/components/fs_tooltip.scss +5 -0
  123. package/styles/components/fs_wrap_group.scss +7 -8
  124. package/styles/components/index.scss +21 -1
  125. package/styles/globals/breakpoints.scss +7 -0
  126. package/styles/globals/overrides.scss +20 -7
  127. package/styles/globals/text_fonts.scss +8 -8
  128. package/themes/default.ts +1 -11
  129. package/utils/css.ts +11 -0
  130. package/utils/icons.ts +75416 -0
  131. package/utils/index.ts +5 -1
  132. package/utils/levenshtein.ts +97 -0
  133. package/utils/sort.ts +9 -0
  134. package/components/FSDatePicker.vue +0 -226
  135. package/composables/useDates.ts +0 -39
  136. package/models/FSTags.ts +0 -8
  137. package/models/FSTextFields.ts +0 -23
  138. package/styles/components/fs_date_picker.scss +0 -0
  139. /package/utils/{FSRichTextField.ts → lexical.ts} +0 -0
@@ -1,73 +1,71 @@
1
1
  <template>
2
- <FSCol width="hug">
3
- <FSRadio
4
- v-for="item in $props.values"
5
- :key="item.value"
6
- :label="item.label"
7
- :description="item.description"
8
- :value="item.value"
9
- :selected="isSelected(item.value)"
10
- :color="$props.color"
11
- :editable="$props.editable"
12
- @update:value="onToggle"
13
- />
14
- </FSCol>
2
+ <FSCol width="hug">
3
+ <FSRadio
4
+ v-for="item in $props.values"
5
+ :key="item.value"
6
+ :label="item.label"
7
+ :description="item.description"
8
+ :selected="isSelected(item.value)"
9
+ :color="$props.color"
10
+ :editable="$props.editable"
11
+ :modelValue="item.value"
12
+ @update:modelValue="onToggle"
13
+ />
14
+ </FSCol>
15
15
  </template>
16
16
 
17
17
  <script lang="ts">
18
- import { defineComponent, PropType, toRefs } from "vue";
18
+ import { defineComponent, PropType } from "vue";
19
19
 
20
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
20
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
21
21
 
22
22
  import FSRadio from "./FSRadio.vue";
23
23
  import FSCol from "./FSCol.vue";
24
24
 
25
25
  export default defineComponent({
26
- name: "FSRadioGroup",
27
- components: {
28
- FSRadio,
29
- FSCol
26
+ name: "FSRadioGroup",
27
+ components: {
28
+ FSRadio,
29
+ FSCol
30
+ },
31
+ props: {
32
+ values: {
33
+ type: Array as PropType<{ value: String | Boolean | Number, label?: String, description?: string }[]>,
34
+ required: true,
35
+ default: false
30
36
  },
31
- props: {
32
- values: {
33
- type: Array as PropType<Array<{ value: String | Boolean | Number, label?: String, description?: string }>>,
34
- required: true,
35
- default: false
36
- },
37
- modelValue: {
38
- type: [String, Boolean, Number],
39
- required: false,
40
- default: 0
41
- },
42
- color: {
43
- type: String as PropType<ColorBase>,
44
- required: false,
45
- default: ColorBase.Primary
46
- },
47
- editable: {
48
- type: Boolean,
49
- required: false,
50
- default: true
51
- }
37
+ modelValue: {
38
+ type: [String, Boolean, Number],
39
+ required: false,
40
+ default: 0
52
41
  },
53
- emits: ["update:modelValue"],
54
- setup(props, { emit }) {
55
- const { modelValue } = toRefs(props);
56
-
57
- const isSelected = (item: String | Boolean | Number): boolean => {
58
- return item == modelValue.value;
59
- };
42
+ color: {
43
+ type: String as PropType<ColorBase>,
44
+ required: false,
45
+ default: ColorEnum.Primary
46
+ },
47
+ editable: {
48
+ type: Boolean,
49
+ required: false,
50
+ default: true
51
+ }
52
+ },
53
+ emits: ["update:modelValue"],
54
+ setup(props, { emit }) {
55
+ const isSelected = (item: String | Boolean | Number): boolean => {
56
+ return item == props.modelValue;
57
+ };
60
58
 
61
- const onToggle = (item: String | Boolean | Number): void => {
62
- if (item != modelValue.value) {
63
- emit("update:modelValue", item);
64
- }
65
- };
59
+ const onToggle = (item: String | Boolean | Number): void => {
60
+ if (item != props.modelValue) {
61
+ emit("update:modelValue", item);
62
+ }
63
+ };
66
64
 
67
- return {
68
- isSelected,
69
- onToggle
70
- };
71
- }
65
+ return {
66
+ isSelected,
67
+ onToggle
68
+ };
69
+ }
72
70
  });
73
71
  </script>
@@ -0,0 +1,123 @@
1
+ <template>
2
+ <FSSubmitDialog
3
+ :rightButtonLabel="$tr('ui.button.remove', 'Remove')"
4
+ :rightButtonColor="ColorEnum.Error"
5
+ :title="title"
6
+ :modelValue="$props.modelValue"
7
+ @update:modelValue="$emit('update:modelValue', $event)"
8
+ v-bind="$attrs"
9
+ >
10
+ <template #body>
11
+ <FSCol
12
+ gap="16px"
13
+ >
14
+ <FSRow>
15
+ <FSIcon
16
+ :color="ColorEnum.Error"
17
+ >
18
+ mdi-alert-outline
19
+ </FSIcon>
20
+ <FSRow
21
+ gap="2px"
22
+ >
23
+ <FSSpan>
24
+ {{ $tr("ui.remove-dialog.body-regular", "This action is") }}
25
+ </FSSpan>
26
+ <FSSpan
27
+ font="text-button"
28
+ >
29
+ {{ $tr("ui.remove-dialog.body-bold", "definitive") }}
30
+ </FSSpan>
31
+ </FSRow>
32
+ </FSRow>
33
+ <FSSpan>
34
+ {{ $tr("ui.remove-dialog.final-warning", "Once removed, entities won't be retrievable") }}
35
+ </FSSpan>
36
+ </FSCol>
37
+ </template>
38
+ <template #footer v-if="$props.removing">
39
+ <FSRow
40
+ align="center-right"
41
+ :height="footerHeight"
42
+ >
43
+ <FSSpan>
44
+ {{ $props.removeCurrent }} / {{ $props.removeTotal }}
45
+ </FSSpan>
46
+ <v-progress-circular
47
+ :color="ColorEnum.Dark"
48
+ :indeterminate="true"
49
+ />
50
+ </FSRow>
51
+ </template>
52
+ </FSSubmitDialog>
53
+ </template>
54
+
55
+ <script lang="ts">
56
+ import { computed, defineComponent } from "vue";
57
+
58
+ import { useTranslationsProvider } from "@dative-gpi/foundation-shared-services/composables";
59
+ import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
60
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
61
+
62
+ import FSSubmitDialog from "./FSSubmitDialog.vue";
63
+ import FSIcon from "./FSIcon.vue";
64
+ import FSSpan from "./FSSpan.vue";
65
+ import FSCol from "./FSCol.vue";
66
+ import FSRow from "./FSRow.vue";
67
+
68
+ export default defineComponent({
69
+ name: "FSRemoveDialog",
70
+ components: {
71
+ FSSubmitDialog,
72
+ FSIcon,
73
+ FSSpan,
74
+ FSCol,
75
+ FSRow
76
+ },
77
+ props: {
78
+ modelValue: {
79
+ type: Boolean,
80
+ required: false,
81
+ default: false
82
+ },
83
+ removing: {
84
+ type: Boolean,
85
+ required: false,
86
+ default: false
87
+ },
88
+ removeTotal: {
89
+ type: Number,
90
+ required: true
91
+ },
92
+ removeCurrent: {
93
+ type: Number,
94
+ required: false,
95
+ default: 0
96
+ }
97
+ },
98
+ emits: ["update:modelValue"],
99
+ setup(props) {
100
+ const { isMobileSized } = useBreakpoints();
101
+ const { $tr } = useTranslationsProvider();
102
+
103
+ const title = computed((): string => {
104
+ if (props.removeTotal > 1) {
105
+ return $tr("ui.remove-dialog.remove-plural", "Remove {0} entities", props.removeTotal.toString());
106
+ }
107
+ else {
108
+ return $tr("ui.remove-dialog.remove-singular", "Remove an entity");
109
+ }
110
+ });
111
+
112
+ const footerHeight = computed((): string => {
113
+ return isMobileSized.value ? "36px" : "40px";
114
+ });
115
+
116
+ return {
117
+ ColorEnum,
118
+ footerHeight,
119
+ title
120
+ };
121
+ }
122
+ })
123
+ </script>
@@ -24,7 +24,7 @@
24
24
  </FSRow>
25
25
  </slot>
26
26
  <v-spacer />
27
- <template v-if="editable">
27
+ <template v-if="$props.editable">
28
28
  <FSIcon
29
29
  class="fs-rich-text-field-icon"
30
30
  :color="toolbarColors.undo"
@@ -141,8 +141,9 @@
141
141
  :contenteditable="!readonly && $props.editable"
142
142
  />
143
143
  <FSTextField
144
- v-if="isLink && editable"
144
+ v-if="isLink && $props.editable"
145
145
  v-model="linkUrl"
146
+ :hideHeader="true"
146
147
  @keypress.enter.stop="toggleLink"
147
148
  />
148
149
  <slot name="description">
@@ -161,14 +162,14 @@
161
162
  <script lang="ts">
162
163
  import { $createParagraphNode, $getSelection, $isElementNode, $isRangeSelection, $setSelection, CAN_UNDO_COMMAND, createEditor, ElementNode, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, ParagraphNode, UNDO_COMMAND } from "lexical";
163
164
  import { $createHeadingNode, HeadingNode, HeadingTagType, registerRichText } from "@lexical/rich-text";
164
- import { computed, defineComponent, onMounted, PropType, ref, toRefs } from "vue";
165
165
  import { createEmptyHistoryState, registerHistory } from "@lexical/history";
166
+ import { computed, defineComponent, onMounted, PropType, ref } from "vue";
166
167
  import { $createLinkNode, $isLinkNode, LinkNode } from "@lexical/link";
167
168
  import { $wrapNodes } from "@lexical/selection";
168
169
 
169
170
  import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
170
171
  import { getAncestor, getSelectedNode } from "@dative-gpi/foundation-shared-components/utils";
171
- import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
172
+ import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
172
173
 
173
174
  import FSTextField from "./FSTextField.vue";
174
175
  import FSIcon from "./FSIcon.vue";
@@ -186,7 +187,7 @@ export default defineComponent({
186
187
  props: {
187
188
  label: {
188
189
  type: String,
189
- required: true,
190
+ required: false,
190
191
  default: null
191
192
  },
192
193
  description: {
@@ -199,15 +200,10 @@ export default defineComponent({
199
200
  required: false,
200
201
  default: null
201
202
  },
202
- color: {
203
- type: String as PropType<ColorBase>,
204
- required: false,
205
- default: ColorBase.Dark
206
- },
207
203
  linkColor: {
208
204
  type: String as PropType<ColorBase>,
209
205
  required: false,
210
- default: ColorBase.Primary
206
+ default: ColorEnum.Primary
211
207
  },
212
208
  required: {
213
209
  type: Boolean,
@@ -232,13 +228,11 @@ export default defineComponent({
232
228
  },
233
229
  emits: ["update:modelValue"],
234
230
  setup(props, { emit }) {
235
- const { modelValue, color, linkColor, rows, variant, editable } = toRefs(props);
236
-
237
- const colors = useColors().getColors(color.value);
238
- const linkColors = useColors().getColors(linkColor.value);
231
+ const { isMobileSized } = useBreakpoints();
239
232
 
240
- const lights = useColors().getColors(ColorBase.Light);
241
- const darks = useColors().getColors(ColorBase.Dark);
233
+ const linkColors = computed(()=> useColors().getColors(props.linkColor));
234
+ const lights = useColors().getColors(ColorEnum.Light);
235
+ const darks = useColors().getColors(ColorEnum.Dark);
242
236
 
243
237
  const canUndo = ref(false);
244
238
  const isLink = ref(false);
@@ -285,38 +279,38 @@ export default defineComponent({
285
279
  registerRichText(editor);
286
280
  registerHistory(editor, createEmptyHistoryState(), 250);
287
281
 
288
- if (modelValue.value != null) {
282
+ if (props.modelValue != null) {
289
283
  editor.update((): void => {
290
- editor.setEditorState(editor.parseEditorState(modelValue.value));
284
+ editor.setEditorState(editor.parseEditorState(props.modelValue));
291
285
  });
292
286
  }
293
287
  });
294
288
 
295
289
  const readonly = computed((): boolean => {
296
- return variant.value === "readonly";
290
+ return props.variant === "readonly";
297
291
  });
298
292
 
299
293
  const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
300
294
  let minHeight: string | undefined = undefined;
301
- const base = useBreakpoints().isMobileSized() ? 30 : 42;
302
- const row = useBreakpoints().isMobileSized() ? 16 : 20;
303
- if (rows.value > 1) {
304
- minHeight = `${base + (rows.value - 1) * row}px`;
295
+ const base = isMobileSized.value ? 30 : 42;
296
+ const row = isMobileSized.value ? 16 : 20;
297
+ if (props.rows > 1) {
298
+ minHeight = `${base + (props.rows - 1) * row}px`;
305
299
  }
306
300
  else {
307
301
  minHeight = `${base}px`;
308
302
  }
309
303
 
310
- switch (variant.value) {
304
+ switch (props.variant) {
311
305
  case "standard": {
312
- if (!editable.value) {
306
+ if (!props.editable) {
313
307
  return {
314
308
  "--fs-rich-text-field-undo-cursor" : "default",
315
309
  "--fs-rich-text-field-icon-cursor" : "default",
316
310
  "--fs-rich-text-field-border-color" : lights.base,
317
311
  "--fs-rich-text-field-color" : lights.dark,
318
312
  "--fs-rich-text-field-active-border-color": lights.base,
319
- "--fs-rich-text-field-link-color" : linkColors.light,
313
+ "--fs-rich-text-field-link-color" : linkColors.value.light,
320
314
  "--fs-rich-text-field-min-height" : minHeight
321
315
  };
322
316
  }
@@ -324,10 +318,10 @@ export default defineComponent({
324
318
  return {
325
319
  "--fs-rich-text-field-undo-cursor" : canUndo ? "pointer" : "default",
326
320
  "--fs-rich-text-field-icon-cursor" : "pointer",
327
- "--fs-rich-text-field-border-color" : colors.base,
321
+ "--fs-rich-text-field-border-color" : lights.dark,
328
322
  "--fs-rich-text-field-color" : darks.base,
329
- "--fs-rich-text-field-active-border-color": colors.dark,
330
- "--fs-rich-text-field-link-color" : linkColors.dark,
323
+ "--fs-rich-text-field-active-border-color": darks.dark,
324
+ "--fs-rich-text-field-link-color" : linkColors.value.dark,
331
325
  "--fs-rich-text-field-min-height" : minHeight
332
326
  };
333
327
  }
@@ -336,14 +330,14 @@ export default defineComponent({
336
330
  "--fs-rich-text-field-border-color" : "transparent",
337
331
  "--fs-rich-text-field-color" : darks.base,
338
332
  "--fs-rich-text-field-active-border-color": "transparent",
339
- "--fs-rich-text-field-link-color" : linkColors.dark,
333
+ "--fs-rich-text-field-link-color" : linkColors.value.dark,
340
334
  "--fs-rich-text-field-min-height" : minHeight
341
335
  }
342
336
  }
343
337
  });
344
338
 
345
339
  const toolbarColors = computed((): {[code: string]: string} => {
346
- if (editable.value) {
340
+ if (props.editable) {
347
341
  return {
348
342
  undo: canUndo.value ? darks.base : lights.base,
349
343
  bold: isBold.value ? darks.base : lights.base,
@@ -538,7 +532,6 @@ export default defineComponent({
538
532
 
539
533
  return {
540
534
  readonly,
541
- editable,
542
535
  style,
543
536
  id,
544
537
  editor,
@@ -1,115 +1,121 @@
1
1
  <template>
2
- <div
3
- :style="style"
4
- :class="classes"
5
- v-bind="$attrs"
6
- >
7
- <slot />
8
- </div>
2
+ <div
3
+ :style="style"
4
+ :class="classes"
5
+ v-bind="$attrs"
6
+ >
7
+ <slot />
8
+ </div>
9
9
  </template>
10
10
 
11
11
  <script lang="ts">
12
- import { computed, defineComponent, PropType, toRefs } from "vue";
12
+ import { computed, defineComponent, PropType } from "vue";
13
+
14
+ import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
13
15
 
14
16
  export default defineComponent({
15
- name: "FSRow",
16
- props: {
17
- width: {
18
- type: String as PropType<"hug" | "fill" | string>,
19
- required: false,
20
- default: "fill"
21
- },
22
- height: {
23
- type: String as PropType<"hug" | "fill" | string>,
24
- required: false,
25
- default: "hug"
26
- },
27
- align: {
28
- type: String as PropType<"top-left" | "top-center" | "top-right" | "center-left" | "center-center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right">,
29
- required: false,
30
- default: "top-left"
31
- },
32
- wrap: {
33
- type: Boolean,
34
- required: false,
35
- default: true
36
- },
37
- gap: {
38
- type: Number,
39
- required: false,
40
- default: 8
41
- }
17
+ name: "FSRow",
18
+ props: {
19
+ width: {
20
+ type: String as PropType<"hug" | "fill" | string>,
21
+ required: false,
22
+ default: "fill"
23
+ },
24
+ height: {
25
+ type: String as PropType<"hug" | "fill" | string>,
26
+ required: false,
27
+ default: "hug"
28
+ },
29
+ align: {
30
+ type: String as PropType<"top-left" | "top-center" | "top-right" | "center-left" | "center-center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right">,
31
+ required: false,
32
+ default: "top-left"
33
+ },
34
+ wrap: {
35
+ type: Boolean,
36
+ required: false,
37
+ default: true
42
38
  },
43
- setup(props) {
44
- const { width, height, align, wrap, gap } = toRefs(props);
45
-
46
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => ({
47
- "--fs-row-flex-wrap": wrap.value ? "wrap" : "nowrap",
48
- "--fs-row-gap": `${gap.value}px`,
49
- "--fs-row-width": width.value,
50
- "--fs-row-height": height.value
51
- }));
39
+ padding: {
40
+ type: [String, Number],
41
+ required: false,
42
+ default: "0"
43
+ },
44
+ gap: {
45
+ type: [String, Number],
46
+ required: false,
47
+ default: "8px"
48
+ }
49
+ },
50
+ setup(props) {
51
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => ({
52
+ "--fs-row-flex-wrap": props.wrap ? "wrap" : "nowrap",
53
+ "--fs-row-padding" : sizeToVar(props.padding),
54
+ "--fs-row-gap" : sizeToVar(props.gap),
55
+ "--fs-row-width" : sizeToVar(props.width),
56
+ "--fs-row-height" : sizeToVar(props.height)
57
+ }));
52
58
 
53
- const classes = computed((): string[] => {
54
- const classes = ["fs-row"];
55
- switch (width.value) {
56
- case "hug":
57
- classes.push("fs-row-width-hug");
58
- break;
59
- case "fill":
60
- classes.push("fs-row-width-fill");
61
- break;
62
- default:
63
- classes.push("fs-row-width-fixed");
64
- break;
65
- }
66
- switch (height.value) {
67
- case "hug":
68
- classes.push("fs-row-height-hug");
69
- break;
70
- case "fill":
71
- classes.push("fs-row-height-fill");
72
- break;
73
- default:
74
- classes.push("fs-row-height-fixed");
75
- break;
76
- }
77
- switch (align.value) {
78
- case "top-left":
79
- classes.push("fs-row-top-left");
80
- break;
81
- case "top-center":
82
- classes.push("fs-row-top-center");
83
- break;
84
- case "top-right":
85
- classes.push("fs-row-top-right");
86
- break;
87
- case "center-left":
88
- classes.push("fs-row-center-left");
89
- break;
90
- case "center-center":
91
- classes.push("fs-row-center-center");
92
- break;
93
- case "center-right":
94
- classes.push("fs-row-center-right");
95
- break;
96
- case "bottom-left":
97
- classes.push("fs-row-bottom-left");
98
- break;
99
- case "bottom-center":
100
- classes.push("fs-row-bottom-center");
101
- break;
102
- case "bottom-right":
103
- classes.push("fs-row-bottom-right");
104
- break;
105
- }
106
- return classes;
107
- });
59
+ const classes = computed((): string[] => {
60
+ const classNames = ["fs-row"];
61
+ switch (props.width) {
62
+ case "hug":
63
+ classNames.push("fs-row-width-hug");
64
+ break;
65
+ case "fill":
66
+ classNames.push("fs-row-width-fill");
67
+ break;
68
+ default:
69
+ classNames.push("fs-row-width-fixed");
70
+ break;
71
+ }
72
+ switch (props.height) {
73
+ case "hug":
74
+ classNames.push("fs-row-height-hug");
75
+ break;
76
+ case "fill":
77
+ classNames.push("fs-row-height-fill");
78
+ break;
79
+ default:
80
+ classNames.push("fs-row-height-fixed");
81
+ break;
82
+ }
83
+ switch (props.align) {
84
+ case "top-left":
85
+ classNames.push("fs-row-top-left");
86
+ break;
87
+ case "top-center":
88
+ classNames.push("fs-row-top-center");
89
+ break;
90
+ case "top-right":
91
+ classNames.push("fs-row-top-right");
92
+ break;
93
+ case "center-left":
94
+ classNames.push("fs-row-center-left");
95
+ break;
96
+ case "center-center":
97
+ classNames.push("fs-row-center-center");
98
+ break;
99
+ case "center-right":
100
+ classNames.push("fs-row-center-right");
101
+ break;
102
+ case "bottom-left":
103
+ classNames.push("fs-row-bottom-left");
104
+ break;
105
+ case "bottom-center":
106
+ classNames.push("fs-row-bottom-center");
107
+ break;
108
+ case "bottom-right":
109
+ classNames.push("fs-row-bottom-right");
110
+ break;
111
+ }
112
+ return classNames;
113
+ });
108
114
 
109
- return {
110
- style,
111
- classes
112
- };
113
- }
115
+ return {
116
+ style,
117
+ classes
118
+ };
119
+ }
114
120
  });
115
121
  </script>