@redseed/redseed-ui-vue3 2.9.3 → 2.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "2.9.3",
3
+ "version": "2.10.1",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -35,7 +35,10 @@ function check(event) {
35
35
  >
36
36
  </div>
37
37
  <div v-if="$slots.label"
38
- class="rsui-form-field-checkbox__label"
38
+ :class="[
39
+ 'rsui-form-field-checkbox__label',
40
+ { 'rsui-form-field-checkbox__label--required': $attrs.required !== undefined },
41
+ ]"
39
42
  >
40
43
  <slot name="label"></slot>
41
44
  </div>
@@ -53,6 +56,9 @@ function check(event) {
53
56
  }
54
57
  &__label {
55
58
  @apply ml-2 font-normal;
59
+ &--required {
60
+ @apply after:content-['*'] after:text-danger;
61
+ }
56
62
  }
57
63
  &__check {
58
64
  @apply size-6 shrink-0 relative bg-white rounded-md cursor-pointer;
@@ -69,5 +75,9 @@ function check(event) {
69
75
  @apply size-full relative z-1;
70
76
  }
71
77
  }
78
+
79
+ :deep(.rsui-form-field-slot__label) {
80
+ @apply after:hidden;
81
+ }
72
82
  }
73
83
  </style>
@@ -0,0 +1,20 @@
1
+ <script setup>
2
+ import FormFieldText from './FormFieldText.vue'
3
+ </script>
4
+ <template>
5
+ <FormFieldText class="rsui-form-field-number"
6
+ type="number"
7
+ >
8
+ <template #label v-if="$slots.label">
9
+ <slot name="label"></slot>
10
+ </template>
11
+ <template #help v-if="$slots.help">
12
+ <slot name="help"></slot>
13
+ </template>
14
+ <template #error v-if="$slots.error">
15
+ <slot name="error"></slot>
16
+ </template>
17
+ </FormFieldText>
18
+ </template>
19
+ <style lang="scss" scoped>
20
+ </style>
@@ -42,8 +42,9 @@ function choose(option) {
42
42
  <template>
43
43
  <FormFieldSlot
44
44
  ref="formFieldSelectElement"
45
- class="rsui-form-field-select"
46
45
  :id="$attrs.id"
46
+ :class="[$attrs.class, 'rsui-form-field-select']"
47
+ :required="$attrs.required"
47
48
  :compact="$attrs.compact"
48
49
  >
49
50
  <template #label v-if="$slots.label">
@@ -155,15 +156,6 @@ function choose(option) {
155
156
 
156
157
  &__group {
157
158
  @apply relative;
158
-
159
- select {
160
- @apply pl-5 pr-14 truncate;
161
- @apply appearance-none rounded-full;
162
- @apply focus:ring focus:ring-highlight focus:border-highlight;
163
- option {
164
- @apply hidden;
165
- }
166
- }
167
159
  }
168
160
 
169
161
  &__options {
@@ -203,5 +195,19 @@ function choose(option) {
203
195
  @apply size-6 transform transition-transform;
204
196
  }
205
197
  }
198
+
199
+ select {
200
+ @apply block w-full border ring-0 bg-none cursor-pointer appearance-none transition;
201
+ @apply py-3 pl-5 pr-14 truncate;
202
+ @apply text-base rounded-full outline-none focus:outline-none;
203
+ @apply bg-white text-rsui-default placeholder-rsui-light border-rsui-grey-200;
204
+ @apply focus:ring focus:ring-highlight focus:border-highlight;
205
+ @apply invalid:border-danger invalid:ring-0;
206
+ @apply disabled:text-rsui-light disabled:bg-rsui-grey-200 disabled:ring-0 disabled:cursor-default;
207
+
208
+ option {
209
+ @apply hidden;
210
+ }
211
+ }
206
212
  }
207
213
  </style>
@@ -21,11 +21,18 @@ const formFieldSlotClass = computed(() => [
21
21
  'rsui-form-field-slot--compact': props.compact,
22
22
  },
23
23
  ])
24
+
25
+ const formFieldSlotLabelClass = computed(() => [
26
+ 'rsui-form-field-slot__label',
27
+ {
28
+ 'rsui-form-field-slot__label--required': attrs.required !== undefined,
29
+ },
30
+ ])
24
31
  </script>
25
32
  <template>
26
33
  <div :class="formFieldSlotClass">
27
34
  <div v-if="$slots.label"
28
- class="rsui-form-field-slot__label"
35
+ :class="formFieldSlotLabelClass"
29
36
  >
30
37
  <label
31
38
  :for="$attrs.id"
@@ -57,12 +64,15 @@ const formFieldSlotClass = computed(() => [
57
64
  @apply flex-row justify-between gap-x-2;
58
65
  .rsui-form-field-slot {
59
66
  &__label {
60
- @apply pt-3 truncate;
67
+ @apply pt-3 whitespace-nowrap;
61
68
  }
62
69
  }
63
70
  }
64
71
 
65
72
  &__label {
73
+ &--required {
74
+ @apply after:content-['*'] after:text-danger after:ml-1;
75
+ }
66
76
  label {
67
77
  @apply font-semibold text-base text-rsui-default;
68
78
  }
@@ -80,24 +90,4 @@ const formFieldSlotClass = computed(() => [
80
90
  @apply text-sm text-danger;
81
91
  }
82
92
  }
83
- </style>
84
- <style lang="scss">
85
- .rsui-form-field-slot {
86
- input[type='text'],
87
- input[type='email'],
88
- input[type='password']
89
- {
90
- @apply flex-1;
91
- @apply text-base text-rsui-default transition py-3 px-4 outline-none focus:outline-none;
92
- @apply bg-white placeholder-rsui-light;
93
- @apply disabled:text-rsui-light disabled:bg-rsui-grey-200 disabled:ring-0;
94
- }
95
- select {
96
- @apply block w-full border ring-0 bg-none cursor-pointer;
97
- @apply text-base text-rsui-default transition py-3 px-4 rounded-md outline-none focus:outline-none;
98
- @apply bg-white placeholder-rsui-light border-rsui-grey-200;
99
- @apply invalid:border-danger invalid:ring-0;
100
- @apply disabled:text-rsui-light disabled:bg-rsui-grey-200 disabled:ring-0 disabled:cursor-default;
101
- }
102
- }
103
93
  </style>
@@ -15,7 +15,8 @@ const inputElement = ref(null)
15
15
  <template>
16
16
  <FormFieldSlot
17
17
  :id="$attrs.id"
18
- :class="$attrs.class || 'rsui-form-field-text'"
18
+ :class="[$attrs.class, 'rsui-form-field-text']"
19
+ :required="$attrs.required"
19
20
  :compact="$attrs.compact"
20
21
  >
21
22
  <template #label v-if="$slots.label">
@@ -60,7 +61,6 @@ const inputElement = ref(null)
60
61
  <style lang="scss" scoped>
61
62
  .rsui-form-field-text {
62
63
  @apply relative;
63
-
64
64
  &__group {
65
65
  @apply relative flex flex-nowrap overflow-hidden;
66
66
  @apply text-base transition;
@@ -78,5 +78,24 @@ const inputElement = ref(null)
78
78
  @apply flex items-center justify-center px-4 select-none;
79
79
  @apply bg-transparent;
80
80
  }
81
+
82
+ input[type='date'],
83
+ input[type='datetime-local'],
84
+ input[type='email'],
85
+ input[type='month'],
86
+ input[type='number'],
87
+ input[type='password'],
88
+ input[type='search'],
89
+ input[type='tel'],
90
+ input[type='text'],
91
+ input[type='time'],
92
+ input[type='url'],
93
+ input[type='week']
94
+ {
95
+ @apply flex-1;
96
+ @apply text-base text-rsui-default transition py-3 px-4 outline-none focus:outline-none;
97
+ @apply bg-white placeholder-rsui-light;
98
+ @apply disabled:text-rsui-light disabled:bg-rsui-grey-200 disabled:ring-0;
99
+ }
81
100
  }
82
101
  </style>
@@ -1,6 +1,7 @@
1
1
  import FormFieldCheckbox from './FormFieldCheckbox.vue'
2
2
  import FormFieldEmail from './FormFieldEmail.vue'
3
3
  import FormFieldHidden from './FormFieldHidden.vue'
4
+ import FormFieldNumber from './FormFieldNumber.vue'
4
5
  import FormFieldPassword from './FormFieldPassword.vue'
5
6
  import FormFieldPasswordToggle from './FormFieldPasswordToggle.vue'
6
7
  import FormFieldSearch from './FormFieldSearch.vue'
@@ -13,6 +14,7 @@ export {
13
14
  FormFieldCheckbox,
14
15
  FormFieldEmail,
15
16
  FormFieldHidden,
17
+ FormFieldNumber,
16
18
  FormFieldPassword,
17
19
  FormFieldPasswordToggle,
18
20
  FormFieldSearch,