@redseed/redseed-ui-vue3 8.3.0 → 8.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "8.3.0",
3
+ "version": "8.4.0",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/redseedtraining/redseed-ui",
@@ -1,35 +1,18 @@
1
1
  <script setup>
2
2
  import Card from './Card.vue'
3
-
4
- const emit = defineEmits(['click:icon'])
5
-
6
- function handleIconClick() {
7
- emit('click:icon')
8
- }
3
+ import FlexContainer from '../Layouts/FlexContainer.vue'
9
4
  </script>
10
5
 
11
6
  <template>
12
7
  <Card class="rsui-metric-card">
13
- <div class="rsui-metric-card__container">
14
- <div class="rsui-metric-card__header">
15
- <div class="rsui-metric-card__avatar">
16
- <slot name="avatar"></slot>
17
- </div>
18
- <div class="rsui-metric-card__icon"
19
- @click="handleIconClick"
20
- >
21
- <slot name="icon"></slot>
22
- </div>
8
+ <FlexContainer flexCol justifyCenter itemsCenter>
9
+ <div class="rsui-metric-card__number">
10
+ <slot name="number"></slot>
23
11
  </div>
24
12
 
25
- <div class="rsui-metric-card__content">
26
- <div class="rsui-metric-card__title" v-if="$slots.title">
27
- <slot name="title"></slot>
28
- </div>
29
- <div class="rsui-metric-card__value" v-if="$slots.value">
30
- <slot name="value"></slot>
31
- </div>
13
+ <div class="rsui-metric-card__label">
14
+ <slot name="label"></slot>
32
15
  </div>
33
- </div>
16
+ </FlexContainer>
34
17
  </Card>
35
18
  </template>
@@ -20,6 +20,7 @@ const props = defineProps({
20
20
  const emit = defineEmits(['change'])
21
21
 
22
22
  const isOpen = ref(false)
23
+ const isMobileDevice = ref(false)
23
24
 
24
25
  function toggleOptions() {
25
26
  isOpen.value = !isOpen.value
@@ -40,6 +41,13 @@ function nativeChoose(event) {
40
41
  emit('change', event.target.value)
41
42
  }
42
43
 
44
+ function handleSelectClick(event) {
45
+ if (!isMobileDevice.value) {
46
+ event.preventDefault()
47
+ toggleOptions()
48
+ }
49
+ }
50
+
43
51
  const formFieldSelectElement = ref(null)
44
52
  const selectElement = ref(null)
45
53
  const dropdownElement = ref(null)
@@ -100,6 +108,12 @@ function calculateDropdownPosition() {
100
108
  }
101
109
 
102
110
  onMounted(() => {
111
+ // Check if the device is a mobile device
112
+ // by checking if the device has a touch screen
113
+ // or if the device has a max touch points
114
+ isMobileDevice.value = 'ontouchstart' in window
115
+ || (navigator.maxTouchPoints && navigator.maxTouchPoints > 0)
116
+
103
117
  window.addEventListener('resize', () => calculateDropdownPosition())
104
118
  })
105
119
 
@@ -117,7 +131,11 @@ defineExpose({
117
131
  <FormFieldSlot
118
132
  ref="formFieldSelectElement"
119
133
  :id="$attrs.id"
120
- :class="[$attrs.class, 'rsui-form-field-select']"
134
+ :class="[
135
+ $attrs.class,
136
+ 'rsui-form-field-select',
137
+ { 'rsui-form-field-select--mobile': isMobileDevice }
138
+ ]"
121
139
  :required="$attrs.required"
122
140
  :showAsterisk="$attrs.showAsterisk"
123
141
  :compact="$attrs.compact"
@@ -135,7 +153,7 @@ defineExpose({
135
153
  :id="$attrs.id"
136
154
  :name="$attrs.name"
137
155
  :required="$attrs.required"
138
- @click.prevent="toggleOptions"
156
+ @click="handleSelectClick"
139
157
  @change.prevent="nativeChoose"
140
158
  >
141
159
  <option value="" disabled>
@@ -153,7 +171,7 @@ defineExpose({
153
171
  </option>
154
172
  </select>
155
173
 
156
- <Teleport to="body">
174
+ <Teleport to="body" v-if="!isMobileDevice">
157
175
  <transition
158
176
  enter-active-class="enter-active-class"
159
177
  enter-from-class="enter-from-class"
@@ -0,0 +1,122 @@
1
+ <script setup>
2
+ import { computed, useAttrs } from 'vue'
3
+
4
+ defineOptions({
5
+ inheritAttrs: false,
6
+ })
7
+
8
+ const props = defineProps({
9
+ flexRow: {
10
+ type: Boolean,
11
+ default: false,
12
+ },
13
+ flexRowReverse: {
14
+ type: Boolean,
15
+ default: false,
16
+ },
17
+ flexCol: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ flexColReverse: {
22
+ type: Boolean,
23
+ default: false,
24
+ },
25
+ flexNowrap: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
29
+ flexWrap: {
30
+ type: Boolean,
31
+ default: false,
32
+ },
33
+ flexWrapReverse: {
34
+ type: Boolean,
35
+ default: false,
36
+ },
37
+ justifyStart: {
38
+ type: Boolean,
39
+ default: false,
40
+ },
41
+ justifyCenter: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+ justifyEnd: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+ justifyBetween: {
50
+ type: Boolean,
51
+ default: false,
52
+ },
53
+ justifyAround: {
54
+ type: Boolean,
55
+ default: false,
56
+ },
57
+ justifyEvenly: {
58
+ type: Boolean,
59
+ default: false,
60
+ },
61
+ itemsStart: {
62
+ type: Boolean,
63
+ default: false,
64
+ },
65
+ itemsCenter: {
66
+ type: Boolean,
67
+ default: false,
68
+ },
69
+ itemsEnd: {
70
+ type: Boolean,
71
+ default: false,
72
+ },
73
+ itemsBaseline: {
74
+ type: Boolean,
75
+ default: false,
76
+ },
77
+ itemsBaselineLast: {
78
+ type: Boolean,
79
+ default: false,
80
+ },
81
+ })
82
+
83
+ const attrs = useAttrs()
84
+
85
+ const containerClasses = computed(() => [
86
+ 'rsui-flex-container',
87
+ ])
88
+
89
+ const contentClasses = computed(() => [
90
+ 'rsui-flex-container__content',
91
+ {
92
+ 'rsui-flex-container__content--flex-row': props.flexRow,
93
+ 'rsui-flex-container__content--flex-row-reverse': props.flexRowReverse,
94
+ 'rsui-flex-container__content--flex-col': props.flexCol,
95
+ 'rsui-flex-container__content--flex-col-reverse': props.flexColReverse,
96
+ 'rsui-flex-container__content--flex-nowrap': props.flexNowrap,
97
+ 'rsui-flex-container__content--flex-wrap': props.flexWrap,
98
+ 'rsui-flex-container__content--flex-wrap-reverse': props.flexWrapReverse,
99
+ 'rsui-flex-container__content--justify-start': props.justifyStart,
100
+ 'rsui-flex-container__content--justify-center': props.justifyCenter,
101
+ 'rsui-flex-container__content--justify-end': props.justifyEnd,
102
+ 'rsui-flex-container__content--justify-between': props.justifyBetween,
103
+ 'rsui-flex-container__content--justify-around': props.justifyAround,
104
+ 'rsui-flex-container__content--justify-evenly': props.justifyEvenly,
105
+ 'rsui-flex-container__content--items-start': props.itemsStart,
106
+ 'rsui-flex-container__content--items-center': props.itemsCenter,
107
+ 'rsui-flex-container__content--items-end': props.itemsEnd,
108
+ 'rsui-flex-container__content--items-baseline': props.itemsBaseline,
109
+ 'rsui-flex-container__content--items-baseline-last': props.itemsBaselineLast,
110
+ 'rsui-flex-container__content--items-stretch': props.itemsStretch,
111
+ },
112
+ attrs.class,
113
+ ])
114
+ </script>
115
+
116
+ <template>
117
+ <div :class="containerClasses">
118
+ <div :class="contentClasses">
119
+ <slot></slot>
120
+ </div>
121
+ </div>
122
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup>
2
+ import FlexContainer from './FlexContainer.vue'
3
+ </script>
4
+
5
+ <template>
6
+ <FlexContainer
7
+ class="rsui-flex-container__content--lg"
8
+ >
9
+ <slot></slot>
10
+ </FlexContainer>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup>
2
+ import FlexContainer from './FlexContainer.vue'
3
+ </script>
4
+
5
+ <template>
6
+ <FlexContainer
7
+ class="rsui-flex-container__content--md"
8
+ >
9
+ <slot></slot>
10
+ </FlexContainer>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup>
2
+ import FlexContainer from './FlexContainer.vue'
3
+ </script>
4
+
5
+ <template>
6
+ <FlexContainer
7
+ class="rsui-flex-container__content--sm"
8
+ >
9
+ <slot></slot>
10
+ </FlexContainer>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup>
2
+ import FlexContainer from './FlexContainer.vue'
3
+ </script>
4
+
5
+ <template>
6
+ <FlexContainer
7
+ class="rsui-flex-container__content--xl"
8
+ >
9
+ <slot></slot>
10
+ </FlexContainer>
11
+ </template>
@@ -0,0 +1,80 @@
1
+ <script setup>
2
+ import { computed, useAttrs } from 'vue'
3
+
4
+ defineOptions({
5
+ inheritAttrs: false,
6
+ })
7
+
8
+
9
+ const props = defineProps({
10
+ smallColumns: {
11
+ type: [String],
12
+ default: '1',
13
+ validator: (value) => ['1', '2', '3', '4', '5', '6'].includes(value),
14
+ },
15
+ mediumColumns: {
16
+ type: [String],
17
+ default: '2',
18
+ validator: (value) => ['1', '2', '3', '4', '5', '6'].includes(value),
19
+ },
20
+ largeColumns: {
21
+ type: [String],
22
+ default: '4',
23
+ validator: (value) => ['1', '2', '3', '4', '5', '6'].includes(value),
24
+ },
25
+ justifyItemsStart: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
29
+ justifyItemsCenter: {
30
+ type: Boolean,
31
+ default: false,
32
+ },
33
+ justifyItemsEnd: {
34
+ type: Boolean,
35
+ default: false,
36
+ },
37
+ })
38
+
39
+ const attrs = useAttrs()
40
+
41
+ const containerClasses = computed(() => [
42
+ 'rsui-grid-container',
43
+ ])
44
+
45
+ const contentClasses = computed(() => [
46
+ 'rsui-grid-container__content',
47
+ {
48
+ 'rsui-grid-container__content--cols-1-sm': props.smallColumns === '1',
49
+ 'rsui-grid-container__content--cols-2-sm': props.smallColumns === '2',
50
+ 'rsui-grid-container__content--cols-3-sm': props.smallColumns === '3',
51
+ 'rsui-grid-container__content--cols-4-sm': props.smallColumns === '4',
52
+ 'rsui-grid-container__content--cols-5-sm': props.smallColumns === '5',
53
+ 'rsui-grid-container__content--cols-6-sm': props.smallColumns === '6',
54
+ 'rsui-grid-container__content--cols-1-md': props.mediumColumns === '1',
55
+ 'rsui-grid-container__content--cols-2-md': props.mediumColumns === '2',
56
+ 'rsui-grid-container__content--cols-3-md': props.mediumColumns === '3',
57
+ 'rsui-grid-container__content--cols-4-md': props.mediumColumns === '4',
58
+ 'rsui-grid-container__content--cols-5-md': props.mediumColumns === '5',
59
+ 'rsui-grid-container__content--cols-6-md': props.mediumColumns === '6',
60
+ 'rsui-grid-container__content--cols-1-lg': props.largeColumns === '1',
61
+ 'rsui-grid-container__content--cols-2-lg': props.largeColumns === '2',
62
+ 'rsui-grid-container__content--cols-3-lg': props.largeColumns === '3',
63
+ 'rsui-grid-container__content--cols-4-lg': props.largeColumns === '4',
64
+ 'rsui-grid-container__content--cols-5-lg': props.largeColumns === '5',
65
+ 'rsui-grid-container__content--cols-6-lg': props.largeColumns === '6',
66
+ 'rsui-grid-container__content--justify-items-start': props.justifyItemsStart,
67
+ 'rsui-grid-container__content--justify-items-center': props.justifyItemsCenter,
68
+ 'rsui-grid-container__content--justify-items-end': props.justifyItemsEnd,
69
+ },
70
+ attrs.class,
71
+ ])
72
+ </script>
73
+
74
+ <template>
75
+ <div :class="containerClasses">
76
+ <div :class="contentClasses">
77
+ <slot></slot>
78
+ </div>
79
+ </div>
80
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup>
2
+ import GridContainer from './GridContainer.vue'
3
+ </script>
4
+
5
+ <template>
6
+ <GridContainer
7
+ class="rsui-grid-container__content--lg"
8
+ >
9
+ <slot></slot>
10
+ </GridContainer>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup>
2
+ import GridContainer from './GridContainer.vue'
3
+ </script>
4
+
5
+ <template>
6
+ <GridContainer
7
+ class="rsui-grid-container__content--md"
8
+ >
9
+ <slot></slot>
10
+ </GridContainer>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup>
2
+ import GridContainer from './GridContainer.vue'
3
+ </script>
4
+
5
+ <template>
6
+ <GridContainer
7
+ class="rsui-grid-container__content--sm"
8
+ >
9
+ <slot></slot>
10
+ </GridContainer>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup>
2
+ import GridContainer from './GridContainer.vue'
3
+ </script>
4
+
5
+ <template>
6
+ <GridContainer
7
+ class="rsui-grid-container__content--xl"
8
+ >
9
+ <slot></slot>
10
+ </GridContainer>
11
+ </template>
@@ -1,3 +1,13 @@
1
+ import FlexContainer from './FlexContainer.vue'
2
+ import FlexContainerSM from './FlexContainerSM.vue'
3
+ import FlexContainerMD from './FlexContainerMD.vue'
4
+ import FlexContainerLG from './FlexContainerLG.vue'
5
+ import FlexContainerXL from './FlexContainerXL.vue'
6
+ import GridContainer from './GridContainer.vue'
7
+ import GridContainerSM from './GridContainerSM.vue'
8
+ import GridContainerMD from './GridContainerMD.vue'
9
+ import GridContainerLG from './GridContainerLG.vue'
10
+ import GridContainerXL from './GridContainerXL.vue'
1
11
  import HeroSection from './HeroSection.vue'
2
12
  import PageHeader from './PageHeader.vue'
3
13
  import Section from './Section.vue'
@@ -7,6 +17,16 @@ import SingleColumnLayout from './SingleColumnLayout.vue'
7
17
  import TwoColumnLayout from './TwoColumnLayout.vue'
8
18
 
9
19
  export {
20
+ FlexContainer,
21
+ FlexContainerSM,
22
+ FlexContainerMD,
23
+ FlexContainerLG,
24
+ FlexContainerXL,
25
+ GridContainer,
26
+ GridContainerSM,
27
+ GridContainerMD,
28
+ GridContainerLG,
29
+ GridContainerXL,
10
30
  HeroSection,
11
31
  PageHeader,
12
32
  Section,