@redseed/redseed-ui-vue3 1.1.2 → 1.2.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/index.js CHANGED
@@ -13,6 +13,7 @@ import FormFieldEmail from './src/components/FormField/FormFieldEmail.vue'
13
13
  import FormFieldHidden from './src/components/FormField/FormFieldHidden.vue'
14
14
  import FormFieldPassword from './src/components/FormField/FormFieldPassword.vue'
15
15
  import FormFieldPasswordToggle from './src/components/FormField/FormFieldPasswordToggle.vue'
16
+ import FormFieldSearch from './src/components/FormField/FormFieldSearch.vue'
16
17
  import FormFieldsLogin from './src/components/Form/FormFieldsLogin.vue'
17
18
  import FormFieldSlot from './src/components/FormField/FormFieldSlot.vue'
18
19
  import FormFieldsRegister from './src/components/Form/FormFieldsRegister.vue'
@@ -26,6 +27,9 @@ import LogoRedSeedCoach from './src/components/Logo/LogoRedSeedCoach.vue'
26
27
  import LogoRedSeedCourses from './src/components/Logo/LogoRedSeedCourses.vue'
27
28
  import LogoRedSeedLMS from './src/components/Logo/LogoRedSeedLMS.vue'
28
29
  import MessageBox from './src/components/MessageBox/MessageBox.vue'
30
+ import MetaItem from './src/components/PageHeading/MetaItem.vue'
31
+ import Modal from './src/components/Modal/Modal.vue'
32
+ import PageHeading from './src/components/PageHeading/PageHeading.vue'
29
33
  import SignInWithGoogle from './src/components/Social/SignInWithGoogle.vue'
30
34
  import SignUpWithGoogle from './src/components/Social/SignUpWithGoogle.vue'
31
35
  import TwoColumnLayout from './src/components/TwoColumnLayout/TwoColumnLayout.vue'
@@ -46,6 +50,7 @@ export {
46
50
  FormFieldHidden,
47
51
  FormFieldPassword,
48
52
  FormFieldPasswordToggle,
53
+ FormFieldSearch,
49
54
  FormFieldsLogin,
50
55
  FormFieldSlot,
51
56
  FormFieldsRegister,
@@ -59,6 +64,9 @@ export {
59
64
  LogoRedSeedCourses,
60
65
  LogoRedSeedLMS,
61
66
  MessageBox,
67
+ MetaItem,
68
+ Modal,
69
+ PageHeading,
62
70
  SignInWithGoogle,
63
71
  SignUpWithGoogle,
64
72
  TwoColumnLayout,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,8 +28,8 @@ const buttonPrimaryClass = computed(() => [
28
28
  <template #icon v-if="$slots.icon">
29
29
  <slot name="icon"></slot>
30
30
  </template>
31
- <template #label v-if="$slots.label">
32
- <slot name="label"></slot>
31
+ <template #label v-if="$slots.default">
32
+ <slot></slot>
33
33
  </template>
34
34
  </ButtonSlot>
35
35
  </template>
@@ -14,9 +14,11 @@ defineOptions({
14
14
  <template #icon v-if="$slots.icon">
15
15
  <slot name="icon"></slot>
16
16
  </template>
17
- <template #label v-if="$slots.label">
18
- <slot name="label"></slot>
17
+
18
+ <template #default v-if="$slots.default">
19
+ <slot></slot>
19
20
  </template>
21
+
20
22
  </ButtonPrimary>
21
23
  </template>
22
24
  <style lang="scss" scoped>
@@ -15,9 +15,11 @@ defineOptions({
15
15
  <template #icon v-if="$slots.icon">
16
16
  <slot name="icon"></slot>
17
17
  </template>
18
- <template #label v-if="$slots.label">
19
- <slot name="label"></slot>
18
+
19
+ <template #default v-if="$slots.default">
20
+ <slot></slot>
20
21
  </template>
22
+
21
23
  </ButtonPrimary>
22
24
  </template>
23
25
  <style lang="scss" scoped>
@@ -14,9 +14,11 @@ defineOptions({
14
14
  <template #icon v-if="$slots.icon">
15
15
  <slot name="icon"></slot>
16
16
  </template>
17
- <template #label v-if="$slots.label">
18
- <slot name="label"></slot>
17
+
18
+ <template #default v-if="$slots.default">
19
+ <slot></slot>
19
20
  </template>
21
+
20
22
  </ButtonPrimary>
21
23
  </template>
22
24
  <style lang="scss" scoped>
@@ -28,8 +28,8 @@ const buttonSecondaryClass = computed(() => [
28
28
  <template #icon v-if="$slots.icon">
29
29
  <slot name="icon"></slot>
30
30
  </template>
31
- <template #label v-if="$slots.label">
32
- <slot name="label"></slot>
31
+ <template #label v-if="$slots.default">
32
+ <slot></slot>
33
33
  </template>
34
34
  </ButtonSlot>
35
35
  </template>
@@ -14,9 +14,11 @@ defineOptions({
14
14
  <template #icon v-if="$slots.icon">
15
15
  <slot name="icon"></slot>
16
16
  </template>
17
- <template #label v-if="$slots.label">
18
- <slot name="label"></slot>
17
+
18
+ <template #default v-if="$slots.default">
19
+ <slot></slot>
19
20
  </template>
21
+
20
22
  </ButtonSecondary>
21
23
  </template>
22
24
  <style lang="scss" scoped>
@@ -15,9 +15,11 @@ defineOptions({
15
15
  <template #icon v-if="$slots.icon">
16
16
  <slot name="icon"></slot>
17
17
  </template>
18
- <template #label v-if="$slots.label">
19
- <slot name="label"></slot>
18
+
19
+ <template #default v-if="$slots.default">
20
+ <slot></slot>
20
21
  </template>
22
+
21
23
  </ButtonSecondary>
22
24
  </template>
23
25
  <style lang="scss" scoped>
@@ -14,9 +14,11 @@ defineOptions({
14
14
  <template #icon v-if="$slots.icon">
15
15
  <slot name="icon"></slot>
16
16
  </template>
17
- <template #label v-if="$slots.label">
18
- <slot name="label"></slot>
17
+
18
+ <template #default v-if="$slots.default">
19
+ <slot></slot>
19
20
  </template>
21
+
20
22
  </ButtonSecondary>
21
23
  </template>
22
24
  <style lang="scss" scoped>
@@ -46,6 +46,8 @@ const props = defineProps({
46
46
  },
47
47
  })
48
48
 
49
+ defineEmits(['click'])
50
+
49
51
  const defaultSize = computed(() => !props.xs && !props.sm && !props.md && !props.lg)
50
52
 
51
53
  const type = computed(() => props.submit ? 'submit' : 'button')
@@ -95,6 +97,7 @@ const buttonSlotIconClass = computed(() => [
95
97
  :class="buttonSlotClass"
96
98
  :type="type"
97
99
  v-bind="$attrs"
100
+ @click="$emit('click', $event)"
98
101
  >
99
102
  <span v-if="$slots.icon"
100
103
  :class="buttonSlotIconClass"
@@ -68,11 +68,9 @@ const formRef = ref(props.form)
68
68
  :formRef="formRef"
69
69
  >
70
70
  <ButtonPrimary full lg submit :disabled="form.processing">
71
- <template #label>
72
- <slot name="submit-label">
73
- Log in
74
- </slot>
75
- </template>
71
+ <slot name="submit-label">
72
+ Log in
73
+ </slot>
76
74
  </ButtonPrimary>
77
75
  </slot>
78
76
 
@@ -100,11 +100,9 @@ const formRef = ref(props.form)
100
100
  :formRef="formRef"
101
101
  >
102
102
  <ButtonPrimary full lg submit :disabled="form.processing">
103
- <template #label>
104
- <slot name="submit-label">
105
- Register
106
- </slot>
107
- </template>
103
+ <slot name="submit-label">
104
+ Register
105
+ </slot>
108
106
  </ButtonPrimary>
109
107
  </slot>
110
108
 
@@ -0,0 +1,53 @@
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+ import FormFieldText from './FormFieldText.vue'
4
+ import { MagnifyingGlassIcon } from '@heroicons/vue/24/outline'
5
+
6
+ // Apply all attributes to the input element, not the wrapper div
7
+ defineOptions({
8
+ inheritAttrs: false,
9
+ })
10
+ </script>
11
+ <template>
12
+ <FormFieldText
13
+ v-bind="$attrs"
14
+ class="search-input"
15
+ >
16
+ <template #label v-if="$slots.label">
17
+ <slot name="label"></slot>
18
+ </template>
19
+
20
+ <template #prefix class="search">
21
+ <div class="form-field-text__prefix">
22
+ <MagnifyingGlassIcon class="form-field-text__search-icon"></MagnifyingGlassIcon>
23
+ </div>
24
+ </template>
25
+
26
+ <template #help v-if="$slots.help">
27
+ <slot name="help"></slot>
28
+ </template>
29
+
30
+ <template #error v-if="$slots.error">
31
+ <slot name="error"></slot>
32
+ </template>
33
+ </FormFieldText>
34
+ </template>
35
+ <style lang="scss" scoped>
36
+ .form-field-text {
37
+ &__prefix {
38
+ @apply absolute top-px bottom-px left-px rounded-tl rounded-bl;
39
+ @apply flex items-center justify-center select-none;
40
+ @apply w-10 pointer-events-none;
41
+ }
42
+ &__search-icon {
43
+ @apply w-5 h-5;
44
+ }
45
+ }
46
+ </style>
47
+ <style lang="scss">
48
+ .form-field-text__group--prefix {
49
+ input.search-input:not([type='checkbox']):not([type='radio']) {
50
+ @apply pl-10;
51
+ }
52
+ }
53
+ </style>
@@ -26,11 +26,13 @@ const input = ref(null)
26
26
  <template #label v-if="$slots.label">
27
27
  <slot name="label"></slot>
28
28
  </template>
29
-
30
29
  <div :class="{
31
30
  'form-field-text__group': true,
31
+ 'form-field-text__group--prefix': $slots.prefix,
32
32
  'form-field-text__group--suffix': $slots.suffix,
33
33
  }">
34
+ <slot name="prefix"></slot>
35
+
34
36
  <input ref="input"
35
37
  v-bind="$attrs"
36
38
  type="text"
@@ -0,0 +1,200 @@
1
+ <script setup>
2
+ import { computed, onMounted, onUnmounted, watch } from 'vue'
3
+
4
+ // Apply all attributes to the input element, not the wrapper div
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+
9
+ const props = defineProps({
10
+ // modal states
11
+ show: {
12
+ type: Boolean,
13
+ default: false,
14
+ },
15
+ closeable: {
16
+ type: Boolean,
17
+ default: true,
18
+ },
19
+ // modal sizes
20
+ sm: {
21
+ type: Boolean,
22
+ default: false,
23
+ },
24
+ md: {
25
+ type: Boolean,
26
+ default: false,
27
+ },
28
+ lg: {
29
+ type: Boolean,
30
+ default: false,
31
+ },
32
+ // modal alignment
33
+ top: {
34
+ type: Boolean,
35
+ default: false,
36
+ },
37
+ center: {
38
+ type: Boolean,
39
+ default: false,
40
+ },
41
+ bottom: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+ // modal variants
46
+ footerEnd: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ })
51
+
52
+ const defaultMaxWidth = computed(() => !props.sm && !props.md && !props.lg)
53
+ const defaultAlignment = computed(() => !props.top && !props.center && !props.bottom)
54
+
55
+ const modalContentClass = computed(() => {
56
+ return [
57
+ 'modal__content',
58
+ {
59
+ 'modal__content--sm': props.sm,
60
+ 'modal__content--md': props.md,
61
+ 'modal__content--lg': props.lg || defaultMaxWidth.value,
62
+
63
+ 'modal__content--top': props.top,
64
+ 'modal__content--center': props.center || defaultAlignment.value,
65
+ 'modal__content--bottom': props.bottom,
66
+ }
67
+ ]
68
+ })
69
+
70
+ const emit = defineEmits(['close'])
71
+
72
+ watch(() => props.show, () => {
73
+ if (props.show) {
74
+ document.body.style.overflow = 'hidden'
75
+ } else {
76
+ document.body.style.overflow = null
77
+ }
78
+ })
79
+
80
+ const close = () => {
81
+ if (props.closeable) {
82
+ emit('close')
83
+ }
84
+ }
85
+
86
+ const closeOnEscape = (e) => {
87
+ if (e.key === 'Escape' && props.show) {
88
+ close()
89
+ }
90
+ }
91
+
92
+ onMounted(() => document.addEventListener('keydown', closeOnEscape))
93
+
94
+ onUnmounted(() => {
95
+ document.removeEventListener('keydown', closeOnEscape)
96
+ document.body.style.overflow = null
97
+ })
98
+ </script>
99
+
100
+ <template>
101
+ <teleport to="body">
102
+ <transition leave-active-class="duration-200">
103
+ <div v-show="show" class="modal" v-bind="$attrs" scroll-region>
104
+ <transition
105
+ enter-active-class="ease-out duration-300"
106
+ enter-from-class="opacity-0"
107
+ enter-to-class="opacity-100"
108
+ leave-active-class="ease-in duration-200"
109
+ leave-from-class="opacity-100"
110
+ leave-to-class="opacity-0"
111
+ >
112
+ <div v-show="show" class="modal__background-wrapper" @click="close">
113
+ <div class="modal__background" />
114
+ </div>
115
+ </transition>
116
+
117
+ <transition
118
+ enter-active-class="ease-out duration-200"
119
+ enter-from-class="opacity-0 xs:scale-80"
120
+ enter-to-class="opacity-100 xs:scale-100"
121
+ leave-active-class="ease-in duration-100"
122
+ leave-from-class="opacity-100 xs:scale-100"
123
+ leave-to-class="opacity-0 xs:scale-80"
124
+ >
125
+ <div v-if="show"
126
+ :class="modalContentClass"
127
+ >
128
+ <div v-if="$slots.header && show"
129
+ class="modal__header"
130
+ >
131
+ <slot name="header"></slot>
132
+ </div>
133
+ <div v-if="show"
134
+ class="modal__body"
135
+ >
136
+ <slot></slot>
137
+ </div>
138
+ <div v-if="$slots.footer && show"
139
+ :class="{
140
+ 'modal__footer': true,
141
+ 'modal__footer--end': footerEnd,
142
+ }"
143
+ >
144
+ <slot name="footer"></slot>
145
+ </div>
146
+ </div>
147
+ </transition>
148
+ </div>
149
+ </transition>
150
+ </teleport>
151
+ </template>
152
+ <style lang="scss" scoped>
153
+ .modal {
154
+ @apply fixed inset-0 overflow-y-auto px-4 py-6 md:px-0 z-50;
155
+ &__background-wrapper {
156
+ @apply fixed inset-0 transform transition-all backdrop-blur-sm;
157
+ }
158
+ &__background {
159
+ @apply absolute inset-0 bg-transparent opacity-100;
160
+ }
161
+ &__content {
162
+ @apply absolute max-h-full inset-x-0 overflow-auto overscroll-contain transform transition-all;
163
+ @apply border rounded-lg shadow-full md:w-full md:mx-auto mx-4;
164
+ @apply bg-gray-100 border-gray-200;
165
+ &--sm {
166
+ @apply sm:max-w-sm xs:mx-4 sm:mx-auto;
167
+ }
168
+ &--md {
169
+ @apply sm:max-w-lg sm:mx-auto;
170
+ }
171
+ &--lg {
172
+ @apply sm:max-w-2xl;
173
+ }
174
+ &--top {
175
+ @apply top-0;
176
+ }
177
+ &--center {
178
+ @apply top-1/2 -translate-y-1/2;
179
+ }
180
+ &--bottom {
181
+ @apply bottom-0;
182
+ }
183
+ }
184
+
185
+ &__header {
186
+ @apply sticky top-0 z-1;
187
+ @apply p-4 bg-gray-100 shrink-0 text-lg font-semibold;
188
+ }
189
+ &__body{
190
+ @apply p-4 bg-white;
191
+ }
192
+ &__footer {
193
+ @apply sticky bottom-0 z-1;
194
+ @apply p-4 bg-gray-100 shrink-0;
195
+ &--end {
196
+ @apply flex justify-end items-center space-x-2;
197
+ }
198
+ }
199
+ }
200
+ </style>
@@ -0,0 +1,22 @@
1
+ <script setup>
2
+ </script>
3
+ <template>
4
+ <div class="meta-item">
5
+ <div class="meta-item__label">
6
+ <slot name="label"></slot>
7
+ </div>
8
+ <div class="meta-item__value">
9
+ <slot name="value"></slot>
10
+ </div>
11
+ </div>
12
+ </template>
13
+ <style lang="scss" scoped>
14
+ .meta-item {
15
+ &__label {
16
+ @apply text-xs text-gray-400;
17
+ }
18
+ &__value {
19
+ @apply text-base;
20
+ }
21
+ }
22
+ </style>
@@ -0,0 +1,121 @@
1
+ <script setup>
2
+ import { ref, computed } from 'vue'
3
+ import Modal from '../Modal/Modal.vue'
4
+ import ButtonSecondaryLight from '../Button/ButtonSecondaryLight.vue'
5
+
6
+ const showMetaModal = ref(false)
7
+ </script>
8
+ <template>
9
+ <div class="page-heading">
10
+ <div class="page-heading__top">
11
+ <div v-if="$slots.title"
12
+ class="page-heading__title"
13
+ >
14
+ <h1>
15
+ <slot name="title"></slot>
16
+ </h1>
17
+ </div>
18
+
19
+ <div v-if="$slots.status || $slots.actions"
20
+ class="page-heading__status-actions"
21
+ >
22
+ <div v-if="$slots.status"
23
+ class="page-heading__status"
24
+ >
25
+ <slot name="status"></slot>
26
+ </div>
27
+
28
+ <div class="page-heading__actions">
29
+ <div v-if="$slots['meta-action-label'] && $slots['meta']"
30
+ class="page-heading__meta-action"
31
+ >
32
+ <ButtonSecondaryLight @click="showMetaModal = true">
33
+ <slot name="meta-action-label"></slot>
34
+ </ButtonSecondaryLight>
35
+
36
+ <Modal v-if="$slots['meta']"
37
+ class="page-heading__meta-modal"
38
+ :show="showMetaModal"
39
+ @close="showMetaModal = false"
40
+ sm
41
+ footerEnd
42
+ >
43
+ <template #header v-if="$slots['meta-modal-header']">
44
+ <slot name="meta-modal-header"></slot>
45
+ </template>
46
+
47
+ <div v-if="$slots.meta"
48
+ class="page-heading__meta-modal__body"
49
+ >
50
+ <slot name="meta"></slot>
51
+ </div>
52
+
53
+ <template #footer v-if="$slots['meta-modal-footer'] || $slots['meta-modal-close-label']">
54
+ <div v-if="$slots['meta-modal-footer']">
55
+ <slot name="meta-modal-footer"></slot>
56
+ </div>
57
+
58
+ <ButtonSecondaryLight @click="showMetaModal = false">
59
+ <slot name="meta-modal-close-label"></slot>
60
+ </ButtonSecondaryLight>
61
+ </template>
62
+ </Modal>
63
+ </div>
64
+
65
+ <slot name="actions"></slot>
66
+ </div>
67
+ </div>
68
+
69
+ <div v-if="$slots.search"
70
+ class="page-heading__search"
71
+ >
72
+ <slot name="search"></slot>
73
+ </div>
74
+ </div>
75
+
76
+ <div v-if="$slots['meta']"
77
+ class="page-heading__meta"
78
+ >
79
+ <slot name="meta"></slot>
80
+ </div>
81
+ </div>
82
+ </template>
83
+ <style lang="scss" scoped>
84
+ .page-heading {
85
+ @apply w-full flex justify-between space-y-4;
86
+ @apply lg:flex-col;
87
+ &__top {
88
+ @apply w-full flex flex-col items-start space-y-2 flex-wrap;
89
+ @apply lg:flex-row lg:space-y-0 lg:items-center;
90
+ }
91
+ &__title {
92
+ @apply pr-2;
93
+ h1 {
94
+ @apply text-2xl font-bold;
95
+ @apply lg:mr-4;
96
+ }
97
+ }
98
+ &__status-actions {
99
+ @apply flex-1 flex space-x-2 items-center justify-between lg:pr-2;
100
+ }
101
+ &__actions {
102
+ @apply flex-1 flex space-x-2 items-center justify-end;
103
+ }
104
+ &__meta-action {
105
+ @apply flex lg:hidden;
106
+ }
107
+ &__search {
108
+ @apply w-full pt-2 lg:pt-0 lg:w-auto;
109
+ }
110
+ &__meta-modal {
111
+ @apply lg:hidden;
112
+ &__body {
113
+ @apply flex flex-col space-y-4;
114
+ }
115
+ }
116
+ &__meta {
117
+ @apply hidden;
118
+ @apply lg:flex space-x-4;
119
+ }
120
+ }
121
+ </style>