@community-release/nx-ui 0.0.43 → 0.0.45

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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "ui",
3
3
  "configKey": "ui",
4
- "version": "0.0.43"
4
+ "version": "0.0.45"
5
5
  }
@@ -7,6 +7,7 @@
7
7
  :class="classes"
8
8
  :style="styles"
9
9
  @click="handleClick"
10
+ ref="refCom"
10
11
  >
11
12
  <div class="button-bg" :style="buttonBgStyle"></div>
12
13
 
@@ -22,19 +23,15 @@
22
23
  </component>
23
24
  </template>
24
25
 
25
- <script>
26
- import UiImpulseIndicator from '../impulse-indicator.vue';
27
- import UiLoading from '../loading.vue';
28
- import comProps from '#build/ui.button.mjs';
29
-
30
- export default {
31
- components: {
32
- UiImpulseIndicator,
33
- UiLoading,
34
- },
35
-
36
- // Data
37
- props: {
26
+ <script setup>
27
+ // Imports
28
+ import { ref, computed } from 'vue';
29
+ import UiImpulseIndicator from '../impulse-indicator.vue';
30
+ import UiLoading from '../loading.vue';
31
+ import comProps from '#build/ui.button.mjs';
32
+
33
+ // Data
34
+ const props = defineProps({
38
35
  color: {
39
36
  type: String,
40
37
  default: comProps.color,
@@ -71,73 +68,74 @@ export default {
71
68
  type: [Boolean, Number],
72
69
  default: false,
73
70
  },
74
- },
75
- data: function() {
76
- return {
77
- impulse: false,
78
- };
79
- },
80
- computed: {
81
- computedType() {
82
- return this.type !== '' ? this.type : (this.href !== '' ? 'a' : 'button');
83
- },
84
- classes() {
85
- let ar = [];
71
+ });
86
72
 
87
- if (this.size) ar.push(`tag-size-${this.size}`);
88
- if (this.shape) ar.push(`tag-shape-${this.shape}`);
89
- if (this.variant) ar.push(`tag-variant-${this.variant}`);
90
- if (this.block) ar.push('tag-block');
91
- if (this.loading) ar.push('tag-loading');
92
- if (this.disabled) ar.push('tag-disabled');
73
+ const refCom = ref(null);
93
74
 
94
- return ar;
95
- },
96
- stylesHoverColor() {
97
- return `var(--ui-color-text-on-${this.color})`;
98
- },
99
- styles() {
100
- let background = `var(--ui-color-${this.color})`;
101
- let color = `var(--ui-color-text-on-${this.color})`;
75
+ const impulse = ref(false);
76
+
77
+ const computedType = computed(() => {
78
+ return props.type !== '' ? props.type : (props.href !== '' ? 'a' : 'button');
79
+ });
102
80
 
103
- if (this.variant === 'flat' || this.variant === 'outline')
104
- background = 'transparent';
81
+ const classes = computed(() => {
82
+ let ar = [];
105
83
 
106
- if (this.variant === 'flat' || this.variant === 'outline')
107
- color = `var(--ui-color-${this.color}-text)`;
84
+ if (props.size) ar.push(`tag-size-${props.size}`);
85
+ if (props.shape) ar.push(`tag-shape-${props.shape}`);
86
+ if (props.variant) ar.push(`tag-variant-${props.variant}`);
87
+ if (props.block) ar.push('tag-block');
88
+ if (props.loading) ar.push('tag-loading');
89
+ if (props.disabled) ar.push('tag-disabled');
108
90
 
109
- return {
110
- background,
111
- color,
112
- };
113
- },
114
- buttonBgStyle() {
115
- return {
116
- 'background': (this.variant === 'flat' || this.variant === 'outline') ? `var(--ui-color-${this.color})` : 'rgba(66,88,120, 0.075)'
117
- }
91
+ return ar;
92
+ });
93
+ const stylesHoverColor = computed(() => {
94
+ return `var(--ui-color-text-on-${props.color})`;
95
+ });
96
+
97
+ const styles = computed(() => {
98
+ let background = `var(--ui-color-${props.color})`;
99
+ let color = `var(--ui-color-text-on-${props.color})`;
100
+
101
+ if (props.variant === 'flat' || props.variant === 'outline')
102
+ background = 'transparent';
103
+
104
+ if (props.variant === 'flat' || props.variant === 'outline')
105
+ color = `var(--ui-color-${props.color}-text)`;
106
+
107
+ return {
108
+ background,
109
+ color,
110
+ };
111
+ });
112
+ const buttonBgStyle = computed(() => {
113
+ return {
114
+ 'background': (props.variant === 'flat' || props.variant === 'outline') ? `var(--ui-color-${props.color.value})` : 'rgba(66,88,120, 0.075)'
118
115
  }
119
- },
116
+ });
120
117
 
121
118
  // Methods
122
- methods: {
123
- handleClick(e) {
124
- if (this.disabled || this.loading) return;
125
-
126
- let rect = this.$el.getBoundingClientRect();
127
-
128
- this.impulse = {
129
- left : e.clientX - rect.left,
130
- top : e.clientY - rect.top,
131
- width : this.$el.offsetWidth,
132
- height : this.$el.offsetHeight
133
- };
134
- }
119
+ function handleClick(e) {
120
+ if (props.disabled || props.loading) return;
121
+
122
+ let rect = refCom.value.getBoundingClientRect();
123
+
124
+ impulse.value = {
125
+ left : e.clientX - rect.left,
126
+ top : e.clientY - rect.top,
127
+ width : refCom.value.offsetWidth,
128
+ height : refCom.value.offsetHeight
129
+ };
135
130
  }
136
- }
137
131
  </script>
138
132
 
139
133
  <style lang="less">
140
134
  .component-ui-button {
135
+ --button-hover-color: #fff;
136
+ --button-text-color: #fff;
137
+ --button-background: #fff;
138
+
141
139
  --button-hover-color: v-bind(stylesHoverColor);
142
140
  --button-text-color: v-bind(styles.color);
143
141
  --button-background: v-bind(styles.background);
@@ -360,6 +358,9 @@ export default {
360
358
  }
361
359
 
362
360
  &:focus {
361
+ outline: none;
362
+ }
363
+ &:focus-visible {
363
364
  outline: @com-outline;
364
365
  outline-offset: @com-outline-offset;
365
366
  }
@@ -4,16 +4,17 @@
4
4
  <input
5
5
  ref="input"
6
6
  type="checkbox"
7
+
8
+ :id="inputId"
7
9
  :name="name"
8
10
  :checked="isChecked"
9
11
  :disabled="disabled"
12
+ :aria-describedby="describedby"
10
13
  @change="updateValue($event.target.checked)"
11
- @blur="focus = false"
12
- @focus="focus = true"
13
14
  autocomplete="off"
14
15
  />
15
16
 
16
- <i :aria-label="ariaLabel"></i>
17
+ <i></i>
17
18
 
18
19
  <span>
19
20
  <slot></slot>
@@ -24,29 +25,27 @@
24
25
 
25
26
  <script setup>
26
27
  // Imports
27
- import { ref, computed, useSlots } from 'vue';
28
-
29
- // Misc
30
- const slots = useSlots();
28
+ import { ref, computed } from 'vue';
31
29
 
32
30
  //
33
31
  const props = defineProps({
34
32
  name: {
35
- required: false,
36
33
  default: 'cb'
37
34
  },
38
35
  modelValue: {
39
36
  required: true,
40
37
  },
41
- haveError: {
42
- type: Boolean,
43
- default: false
38
+ inputId: {
39
+ default: '',
44
40
  },
45
- useBinaries: {
41
+ describedby: {
42
+ default: '',
43
+ },
44
+ error: {
46
45
  type: Boolean,
47
46
  default: false
48
47
  },
49
- required: {
48
+ useBinaries: {
50
49
  type: Boolean,
51
50
  default: false
52
51
  },
@@ -58,18 +57,12 @@
58
57
 
59
58
  const emit = defineEmits(['change', 'onchange', 'update:modelValue']);
60
59
 
61
- const focus = ref(false);
62
- const ariaLabel = computed(() => {
63
- return (slots.default ? slots.default()[0]?.children || '' : '').trim();
64
- });
65
-
66
60
  const classes = computed(() => {
67
61
  const ar = [];
68
62
 
69
- if (props.haveError) ar.push('tag-error');
63
+ if (props.error) ar.push('tag-error');
70
64
  if (props.disabled) ar.push('tag-disabled');
71
- if (props.required) ar.push('tag-required');
72
- if (focus.value) ar.push('tag-focus');
65
+ if (props.error) ar.push('tag-error');
73
66
 
74
67
  return ar;
75
68
  });
@@ -104,7 +97,7 @@
104
97
  @com-color-text: var(--ui-color-text);
105
98
  @com-color-header-text: var(--ui-color-header-text);
106
99
  @com-color-gray-text: var(--ui-color-gray-text);
107
- @com-color-error-text: var(--ui-color-error);
100
+ @com-color-error: var(--ui-color-error);
108
101
 
109
102
  @com-text-medium: var(--ui-text-medium);
110
103
  @com-text-small: var(--ui-text-small);
@@ -115,20 +108,6 @@
115
108
 
116
109
  position: relative;
117
110
  text-align: left;
118
-
119
- .error-wrap {
120
- position: absolute;
121
- top: 100%;
122
- left: 0;
123
- padding: 0;
124
-
125
- font-size: 11px;
126
-
127
- color: @com-color-error-text;
128
- background: transparent;
129
-
130
- &:before, &:after { display: none; }
131
- }
132
111
 
133
112
  > label {
134
113
  position: relative;
@@ -200,17 +179,6 @@
200
179
  }
201
180
  }
202
181
 
203
- // Required
204
- &.tag-required {
205
- span:after {
206
- content: '*';
207
- padding-left: @com-space-micro;
208
- color: @com-color-red;
209
- font-weight: bold;
210
- font-size: @com-text-medium;
211
- }
212
- }
213
-
214
182
  // Disabled
215
183
  &.tag-disabled {
216
184
  opacity: 0.6;
@@ -223,17 +191,24 @@
223
191
 
224
192
  // Error
225
193
  &.tag-error {
226
- > label { color: @com-color-error-text; }
194
+ > label i { border-color: @com-color-error; }
195
+ > label > input:checked + i {
196
+ border-color: @com-color-error;
197
+ background: @com-color-error;
198
+ }
227
199
  }
228
200
  }
229
201
 
230
202
  @media (hover: hover) {
231
- .component-ui-checkbox.tag-focus {
203
+ .component-ui-checkbox {
232
204
  // Ally
233
205
  @com-outline: var(--ui-outline);
234
206
  @com-outline-offset: var(--ui-outline-offset);
235
207
 
236
- i {
208
+ input:focus {
209
+ outline: none;
210
+ }
211
+ input:focus-visible + i {
237
212
  outline: @com-outline;
238
213
  outline-offset: @com-outline-offset;
239
214
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <section class="component-ui-input" :class="classes" @click="refInput.focus()">
2
+ <div class="component-ui-input" :class="classes" @click="refInput.focus()">
3
3
  <ui-impulse-indicator :impulse="impulse" @update:impulse="$emit('update:impulse', false)" />
4
4
 
5
5
  <div class="com-content">
@@ -7,10 +7,13 @@
7
7
  <div class="slot-default">
8
8
  <input
9
9
  ref="refInput"
10
+
11
+ :id="inputId"
10
12
  :value="modelValue"
11
13
  :type="type"
12
14
  :placeholder="placeholder"
13
15
  :disabled="disabled"
16
+ :aria-required="required ? 'true' : 'false'"
14
17
 
15
18
  @change="updateValue($event.target.value)"
16
19
  @input="updateValue($event.target.value)"
@@ -25,12 +28,12 @@
25
28
  </div>
26
29
  <div class="slot-append" v-if="hasSlot('append')"><slot name="append"></slot></div>
27
30
  </div>
28
- </section>
31
+ </div>
29
32
  </template>
30
33
 
31
34
  <script setup>
32
35
  // Import
33
- import { ref, computed, useSlots } from 'vue';
36
+ import { ref, computed, useSlots } from 'vue';
34
37
  import UiImpulseIndicator from '../impulse-indicator.vue';
35
38
  import comProps from '#build/ui.input.mjs';
36
39
 
@@ -43,6 +46,9 @@
43
46
  modelValue: {
44
47
  required: true
45
48
  },
49
+ inputId: {
50
+ default: '',
51
+ },
46
52
  placeholder: {
47
53
  default: comProps.placeholder,
48
54
  },
@@ -50,6 +56,14 @@
50
56
  type: Boolean,
51
57
  default: false,
52
58
  },
59
+ required: {
60
+ type: Boolean,
61
+ default: false,
62
+ },
63
+ error: {
64
+ type: Boolean,
65
+ default: false,
66
+ },
53
67
  type: {
54
68
  type: String,
55
69
  default: 'text'
@@ -78,6 +92,7 @@
78
92
  if (props.disabled) ar.push('tag-disabled');
79
93
  if (props.size) ar.push(`tag-size-${props.size}`);
80
94
  if (props.shape) ar.push(`tag-shape-${props.shape}`);
95
+ if (props.error) ar.push(`tag-error`);
81
96
 
82
97
  return ar;
83
98
  });
@@ -104,8 +119,6 @@
104
119
  const hasSlot = (name) => {
105
120
  return !!slots[name];
106
121
  };
107
- // Hooks
108
-
109
122
  </script>
110
123
 
111
124
  <style lang="less">
@@ -130,7 +143,8 @@
130
143
  @com-color-bg: var(--ui-color-bg);
131
144
  @com-color-header-text: var(--ui-color-header-text);
132
145
  @com-color-gray-text: var(--ui-color-gray-text);
133
- @com-color-primary: var(--color-primary);
146
+ @com-color-primary: var(--ui-color-primary);
147
+ @com-color-error: var(--ui-color-error);
134
148
 
135
149
  // Space
136
150
  @com-space-small: var(--ui-space-small);
@@ -240,5 +254,14 @@
240
254
  cursor: not-allowed;
241
255
  }
242
256
  }
257
+
258
+ // Error
259
+ &.tag-error {
260
+ border-color: @com-color-error;
261
+
262
+ &.tag-focus {
263
+ border-color: transparent;
264
+ }
265
+ }
243
266
  }
244
267
  </style>
@@ -1,8 +1,12 @@
1
1
  <template>
2
- <label class="component-ui-label" :class="[`tag-size-${size}`, `tag-weight-${weight}`, required ? 'tag-required' : '']">
3
- <span class="component-ui-label--text">{{ text }}</span>
4
- <slot></slot>
5
- </label>
2
+ <div>
3
+ <div class="component-ui-label" :class="[`tag-size-${size}`, `tag-weight-${weight}`, required ? 'tag-required' : '']">
4
+ <component :is="isLegend ? 'legend' : 'label'" class="component-ui-label--text" :for="labelFor">
5
+ {{ text }} <span v-if="required" aria-hidden="true">*</span>
6
+ </component>
7
+ <slot />
8
+ </div>
9
+ </div>
6
10
  </template>
7
11
 
8
12
  <script setup>
@@ -14,6 +18,17 @@
14
18
  text: {
15
19
  default: '',
16
20
  },
21
+ fieldset: {
22
+ type: Boolean,
23
+ default: false,
24
+ },
25
+ labelFor: {
26
+ default: ''
27
+ },
28
+ isLegend: {
29
+ type: Boolean,
30
+ default: false
31
+ },
17
32
  size: {
18
33
  type: String,
19
34
  default: comProps.size,
@@ -43,11 +58,9 @@
43
58
  @com-text-small: var(--ui-text-small);
44
59
 
45
60
  .component-ui-label {
46
- display: block;
47
-
48
61
  .component-ui-label--text {
49
62
  position: relative;
50
- display: inline-block;
63
+ display: block;
51
64
  padding-bottom: @com-space-micro;
52
65
  font-weight: @com-font-weight-medium;
53
66
  font-size: @com-text-default;
@@ -55,29 +68,21 @@
55
68
  }
56
69
 
57
70
  // Text size
58
- &.tag-size-big .component-ui-label--text { font-size: @com-text-big; }
59
- &.tag-size-medium .component-ui-label--text { font-size: @com-text-medium; }
60
- &.tag-size-default .component-ui-label--text { font-size: @com-text-default; }
61
- &.tag-size-small .component-ui-label--text { font-size: @com-text-small; }
71
+ &.tag-size-big > .component-ui-label--text { font-size: @com-text-big; }
72
+ &.tag-size-medium > .component-ui-label--text { font-size: @com-text-medium; }
73
+ &.tag-size-default > .component-ui-label--text { font-size: @com-text-default; }
74
+ &.tag-size-small > .component-ui-label--text { font-size: @com-text-small; }
62
75
 
63
76
  // Text weight
64
- &.tag-weight-700 .component-ui-label--text { font-weight: 700; }
65
- &.tag-weight-600 .component-ui-label--text { font-weight: 600; }
66
- &.tag-weight-500 .component-ui-label--text { font-weight: 500; }
67
- &.tag-weight-400 .component-ui-label--text { font-weight: 400; }
77
+ &.tag-weight-700 > .component-ui-label--text { font-weight: 700; }
78
+ &.tag-weight-600 > .component-ui-label--text { font-weight: 600; }
79
+ &.tag-weight-500 > .component-ui-label--text { font-weight: 500; }
80
+ &.tag-weight-400 > .component-ui-label--text { font-weight: 400; }
68
81
 
69
82
  // Required
70
- &.tag-required {
71
- .component-ui-label--text:after {
72
- content: '*';
73
-
74
- position: absolute;
75
- top: 0;
76
- right: -0.7em;
77
- color: @com-color-red;
78
- font-weight: bold;
79
- font-size: @com-text-medium;
80
- }
83
+ &.tag-required .component-ui-label--text span {
84
+ color: @com-color-red;
85
+ font-weight: bold;
81
86
  }
82
87
  }
83
88
  </style>
@@ -14,8 +14,9 @@ import { watch, computed, defineAsyncComponent } from 'vue';
14
14
  import { useMapStore } from './store';
15
15
  import comProps from '#build/ui.map.mjs';
16
16
 
17
- // Data
18
- const store = useMapStore();
17
+ // // Data
18
+ const nuxtApp = useNuxtApp();
19
+ const store = useMapStore(nuxtApp.$pinia);
19
20
  const emit = defineEmits(['initialized']);
20
21
 
21
22
  const mapEngines = {
@@ -4,17 +4,19 @@
4
4
  <input
5
5
  ref="input"
6
6
  type="radio"
7
+
8
+ :id="inputId"
7
9
  :checked="isChecked"
8
10
  :value="value"
9
11
  :name="name"
10
12
  :disabled="disabled"
11
- @blur="focus = false"
12
- @focus="focus = true"
13
+ :aria-required="required ? 'true' : 'false'"
14
+ :aria-describedby="describedby"
13
15
  autocomplete="off"
14
16
  @change="handleUpdate($event.target.value)"
15
17
  />
16
18
 
17
- <i :aria-label="ariaLabel"></i>
19
+ <i></i>
18
20
 
19
21
  <span>
20
22
  <slot></slot>
@@ -33,13 +35,18 @@
33
35
  // Data
34
36
  const props = defineProps({
35
37
  name: {
36
- required: false,
37
38
  default: 'rd'
38
39
  },
39
40
  value: {
40
41
  required: true,
41
42
  },
42
43
  modelValue: { default: '' },
44
+ inputId: {
45
+ default: '',
46
+ },
47
+ describedby: {
48
+ default: '',
49
+ },
43
50
  haveError: {
44
51
  type: Boolean,
45
52
  default: false
@@ -51,17 +58,15 @@
51
58
  disabled: {
52
59
  type: Boolean,
53
60
  default: false
61
+ },
62
+ error: {
63
+ type: Boolean,
64
+ default: false
54
65
  }
55
66
  })
56
67
 
57
68
  const emit = defineEmits(['update:modelValue']);
58
69
 
59
-
60
- const focus = ref(false);
61
- const ariaLabel = computed(() => {
62
- return (slots.default ? slots.default()[0]?.children || '' : '').trim();
63
- });
64
-
65
70
  const classes = computed(() => {
66
71
  const ar = [];
67
72
 
@@ -69,8 +74,7 @@
69
74
  if (props.haveError) ar.push('tag-error');
70
75
  if (props.text) ar.push('tag-text');
71
76
  if (props.disabled) ar.push('tag-disabled');
72
- if (props.required) ar.push('tag-required');
73
- if (focus.value) ar.push('tag-focus');
77
+ if (props.error) ar.push('tag-error');
74
78
 
75
79
  return ar;
76
80
  });
@@ -201,17 +205,6 @@
201
205
  }
202
206
  }
203
207
 
204
- // Required
205
- &.tag-required {
206
- span:after {
207
- content: '*';
208
- padding-left: @com-space-micro;
209
- color: @com-color-error;
210
- font-weight: bold;
211
- font-size: @com-text-medium;
212
- }
213
- }
214
-
215
208
  // Disabled
216
209
  &.tag-disabled {
217
210
  opacity: 0.6;
@@ -224,17 +217,24 @@
224
217
 
225
218
  // Error
226
219
  &.tag-error {
227
- > label { color: @com-color-error; }
220
+ > label i { border-color: @com-color-error; }
221
+ > label > input:checked + i {
222
+ border-color: @com-color-error;
223
+ background: @com-color-error;
224
+ }
228
225
  }
229
226
  }
230
227
 
231
228
  @media (hover: hover) {
232
- .component-ui-radio.tag-focus {
229
+ .component-ui-radio {
233
230
  // Ally
234
231
  @com-outline: var(--ui-outline);
235
232
  @com-outline-offset: var(--ui-outline-offset);
236
233
 
237
- i {
234
+ input:focus {
235
+ outline: none;
236
+ }
237
+ input:focus-visible + i {
238
238
  outline: @com-outline;
239
239
  outline-offset: @com-outline-offset;
240
240
  }
@@ -2,15 +2,18 @@
2
2
  <div class="component-ui-select" :class="classes" :style="styles">
3
3
  <div class="wrapper">
4
4
  <div class="value" @click="toggle">
5
- <label v-if="label" v-html="label"></label>
5
+ <div v-if="label" v-html="label"></div>
6
6
  <strong v-if="valueName" v-html="valueName"></strong>
7
7
  </div>
8
8
 
9
9
  <select
10
10
  ref="select"
11
+
12
+ :id="inputId"
11
13
  @change="onChange"
12
14
  @focus="handleFocus"
13
15
  @blur="handleBlur"
16
+ :aria-required="required ? 'true' : 'false'"
14
17
  :disabled="disabled"
15
18
  autocomplete="off"
16
19
  >
@@ -28,6 +31,9 @@ import { ref, computed, watch, onMounted, nextTick } from 'vue';
28
31
 
29
32
  // Setup
30
33
  const props = defineProps({
34
+ inputId: {
35
+ default: '',
36
+ },
31
37
  theme: {
32
38
  type: String,
33
39
  default: 'default',
@@ -45,6 +51,10 @@ const props = defineProps({
45
51
  type: Array,
46
52
  default: () => []
47
53
  },
54
+ required: {
55
+ type: Boolean,
56
+ default: false
57
+ },
48
58
  disabled: {
49
59
  type: Boolean,
50
60
  default: false
@@ -164,6 +174,7 @@ onMounted(() => {
164
174
  @com-color-surface: var(--ui-color-surface);
165
175
  @com-color-red: var(--ui-color-red);
166
176
  @com-color-border: var(--ui-color-border-bolder);
177
+ @com-color-error: var(--ui-color-error);
167
178
 
168
179
  @com-border-radius-default: var(--ui-border-radius-default);
169
180
  @com-bs-1: var(--ui-bs-1);
@@ -282,6 +293,18 @@ onMounted(() => {
282
293
  border-color: transparent;
283
294
  outline: @com-outline;
284
295
  }
296
+
297
+
298
+ }
299
+
300
+ &.tag-error {
301
+ .value {
302
+ border-color: @com-color-error;
303
+ }
304
+
305
+ &.tag-focus .value {
306
+ border-color: transparent;
307
+ }
285
308
  }
286
309
  }
287
310
 
@@ -290,5 +313,15 @@ onMounted(() => {
290
313
  background: @com-color-surface;
291
314
  border-color: transparent;
292
315
  }
316
+
317
+ &.tag-error {
318
+ .value {
319
+ border-color: @com-color-error;
320
+ }
321
+
322
+ &.tag-focus .value {
323
+ border-color: transparent;
324
+ }
325
+ }
293
326
  }
294
327
  </style>
@@ -2,9 +2,12 @@
2
2
  <section class="component-ui-textarea" :class="classes" @click="refInput.focus()">
3
3
  <textarea
4
4
  ref="refInput"
5
+
6
+ :id="inputId"
5
7
  :value="modelValue"
6
8
  :placeholder="placeholder"
7
9
  :disabled="disabled"
10
+ :aria-required="required ? 'true' : 'false'"
8
11
 
9
12
  @change="updateValue($event.target.value)"
10
13
  @input="updateValue($event.target.value)"
@@ -30,6 +33,12 @@
30
33
 
31
34
  // Data
32
35
  const props = defineProps({
36
+ modelValue: {
37
+ required: true
38
+ },
39
+ inputId: {
40
+ default: '',
41
+ },
33
42
  placeholder: {
34
43
  default: comProps.placeholder,
35
44
  },
@@ -37,17 +46,22 @@
37
46
  type: String,
38
47
  default: comProps.shape,
39
48
  },
40
- modelValue: {
41
- required: true
42
- },
43
49
  disabled: {
44
50
  type: Boolean,
45
51
  default: false,
46
52
  },
53
+ required: {
54
+ type: Boolean,
55
+ default: false,
56
+ },
47
57
  resize: {
48
58
  type: String,
49
59
  default: 'on',
50
60
  },
61
+ error: {
62
+ type: Boolean,
63
+ default: false,
64
+ },
51
65
  });
52
66
 
53
67
  const refInput = ref(null);
@@ -62,6 +76,7 @@
62
76
  if (haveFocus.value) ar.push('tag-focus');
63
77
  if (props.disabled) ar.push('tag-disabled');
64
78
  if (props.shape) ar.push(`tag-shape-${props.shape}`);
79
+ if (props.error) ar.push(`tag-error`);
65
80
 
66
81
  return ar;
67
82
  });
@@ -100,6 +115,7 @@
100
115
  @com-color-border-bolder: var(--ui-color-border-bolder);
101
116
  @com-color-header-text: var(--ui-color-header-text);
102
117
  @com-color-gray-text: var(--ui-color-gray-text);
118
+ @com-color-error: var(--ui-color-error);
103
119
 
104
120
  // Padding
105
121
  @com-space-default: var(--ui-space-default);
@@ -167,5 +183,18 @@
167
183
  outline: @com-outline;
168
184
  }
169
185
  }
186
+
187
+ // Error
188
+ &.tag-error {
189
+ textarea {
190
+ border-color: @com-color-error;
191
+ }
192
+
193
+ &.tag-focus {
194
+ textarea {
195
+ border-color: transparent;
196
+ }
197
+ }
198
+ }
170
199
  }
171
200
  </style>
@@ -2,7 +2,7 @@ import { defineNuxtPlugin } from '#app';
2
2
  import { useUINoticeStore } from '../components/notice/store.mjs';
3
3
 
4
4
  export default defineNuxtPlugin(function (nuxt) {
5
- const noticeStore = useUINoticeStore();
5
+ const noticeStore = useUINoticeStore(nuxt.$pinia);
6
6
 
7
7
  return {
8
8
  provide: {
package/package.json CHANGED
@@ -1,66 +1,66 @@
1
1
  {
2
- "name": "@community-release/nx-ui",
3
- "version": "0.0.43",
4
- "description": "nx-ui - Nuxt UI library",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/community-release/nx-ui.git"
8
- },
9
- "license": "MIT",
10
- "type": "module",
11
- "exports": {
12
- ".": {
13
- "import": "./dist/module.mjs",
14
- "require": "./dist/module.cjs"
15
- }
16
- },
17
- "main": "./dist/module.cjs",
18
- "files": [
19
- "dist"
20
- ],
21
- "dependencies": {
22
- "@nuxt/kit": "^3.15.4",
23
- "@nuxtjs/color-mode": "^3.5.2",
24
- "@nuxtjs/i18n": "^9.2.0",
25
- "@pinia/nuxt": "^0.10.1",
26
- "pinia": "^3.0.1",
27
- "ol": "^9.1.0",
28
- "vue": "^3.5.13"
29
- },
30
- "devDependencies": {
31
- "@nuxt/devtools": "latest",
32
- "@nuxt/module-builder": "^0.5.5",
33
- "@nuxt/schema": "^3.11.2",
34
- "@nuxt/test-utils": "^3.12.0",
35
- "@vitejs/plugin-vue": "^5.2.1",
36
- "@vue/test-utils": "^2.4.6",
37
- "@vuedoc/md": "^4.0.0-beta8",
38
- "@vuedoc/parser": "^4.0.0-beta14",
39
- "changelogen": "^0.5.5",
40
- "cross-env": "^7.0.3",
41
- "happy-dom": "^14.12.0",
42
- "less": "^3.9.0",
43
- "less-loader": "^5.0.0",
44
- "nuxt": "^3.15.4",
45
- "vite-raw-plugin": "^1.0.2",
46
- "vitest": "^1.6.0",
47
- "vue-docgen-cli": "^4.79.0",
48
- "vue-tsc": "^2.0.24"
49
- },
50
- "resolutions": {
51
- "string-width": "4.2.3"
52
- },
53
- "scripts": {
54
- "prepack": "nuxt-module-build build",
55
- "dev": "nuxi dev docs --host --port 7012",
56
- "build": "nuxi build docs",
57
- "prepare": "nuxt-module-build build && nuxt-module-build prepare && nuxi prepare docs",
58
- "release": "npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
59
- "test": "vitest run",
60
- "test:watch": "vitest watch",
61
- "test:com": "vitest components run",
62
- "test:genmocks": "node ./src/utils/generateTestMocks.mjs",
63
- "docs:components": "vue-docgen",
64
- "docs:generate": "npm run generate:production -prefix ./docs"
65
- }
66
- }
2
+ "name": "@community-release/nx-ui",
3
+ "version": "0.0.45",
4
+ "description": "nx-ui - Nuxt UI library",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/community-release/nx-ui.git"
8
+ },
9
+ "license": "MIT",
10
+ "type": "module",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/module.mjs",
14
+ "require": "./dist/module.cjs"
15
+ }
16
+ },
17
+ "main": "./dist/module.cjs",
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "dependencies": {
22
+ "@nuxt/kit": "^3.15.4",
23
+ "@nuxtjs/color-mode": "^3.5.2",
24
+ "@nuxtjs/i18n": "^9.2.0",
25
+ "@pinia/nuxt": "^0.10.1",
26
+ "pinia": "^3.0.1",
27
+ "ol": "^9.1.0",
28
+ "vue": "^3.5.13"
29
+ },
30
+ "devDependencies": {
31
+ "@nuxt/devtools": "latest",
32
+ "@nuxt/module-builder": "^0.5.5",
33
+ "@nuxt/schema": "^3.11.2",
34
+ "@nuxt/test-utils": "^3.12.0",
35
+ "@vitejs/plugin-vue": "^5.2.1",
36
+ "@vue/test-utils": "^2.4.6",
37
+ "@vuedoc/md": "^4.0.0-beta8",
38
+ "@vuedoc/parser": "^4.0.0-beta14",
39
+ "changelogen": "^0.5.5",
40
+ "cross-env": "^7.0.3",
41
+ "happy-dom": "^14.12.0",
42
+ "less": "^3.9.0",
43
+ "less-loader": "^5.0.0",
44
+ "nuxt": "^3.15.4",
45
+ "vite-raw-plugin": "^1.0.2",
46
+ "vitest": "^1.6.0",
47
+ "vue-docgen-cli": "^4.79.0",
48
+ "vue-tsc": "^2.0.24"
49
+ },
50
+ "resolutions": {
51
+ "string-width": "4.2.3"
52
+ },
53
+ "scripts": {
54
+ "prepack": "nuxt-module-build build",
55
+ "dev": "nuxi dev docs --host --port 7012",
56
+ "build": "nuxi build docs",
57
+ "prepare": "nuxt-module-build build && nuxt-module-build prepare && nuxi prepare docs",
58
+ "release": "npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
59
+ "test": "vitest run",
60
+ "test:watch": "vitest watch",
61
+ "test:com": "vitest components run",
62
+ "test:genmocks": "node ./src/utils/generateTestMocks.mjs",
63
+ "docs:components": "vue-docgen",
64
+ "docs:generate": "npm run generate:production -prefix ./docs"
65
+ }
66
+ }
@@ -1,153 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
- color: {
3
- type: StringConstructor;
4
- default: any;
5
- };
6
- size: {
7
- type: StringConstructor;
8
- default: any;
9
- };
10
- variant: {
11
- type: StringConstructor;
12
- default: any;
13
- };
14
- shape: {
15
- type: StringConstructor;
16
- default: any;
17
- };
18
- href: {
19
- type: StringConstructor;
20
- default: string;
21
- };
22
- type: {
23
- type: StringConstructor;
24
- default: string;
25
- };
26
- block: {
27
- type: BooleanConstructor;
28
- default: boolean;
29
- };
30
- loading: {
31
- type: BooleanConstructor;
32
- default: boolean;
33
- };
34
- disabled: {
35
- type: (BooleanConstructor | NumberConstructor)[];
36
- default: boolean;
37
- };
38
- }>, {}, {
39
- impulse: boolean;
40
- }, {
41
- computedType(): any;
42
- classes(): string[];
43
- stylesHoverColor(): string;
44
- styles(): {
45
- background: string;
46
- color: string;
47
- };
48
- buttonBgStyle(): {
49
- background: string;
50
- };
51
- }, {
52
- handleClick(e: any): void;
53
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
54
- color: {
55
- type: StringConstructor;
56
- default: any;
57
- };
58
- size: {
59
- type: StringConstructor;
60
- default: any;
61
- };
62
- variant: {
63
- type: StringConstructor;
64
- default: any;
65
- };
66
- shape: {
67
- type: StringConstructor;
68
- default: any;
69
- };
70
- href: {
71
- type: StringConstructor;
72
- default: string;
73
- };
74
- type: {
75
- type: StringConstructor;
76
- default: string;
77
- };
78
- block: {
79
- type: BooleanConstructor;
80
- default: boolean;
81
- };
82
- loading: {
83
- type: BooleanConstructor;
84
- default: boolean;
85
- };
86
- disabled: {
87
- type: (BooleanConstructor | NumberConstructor)[];
88
- default: boolean;
89
- };
90
- }>> & Readonly<{}>, {
91
- type: string;
92
- color: string;
93
- size: string;
94
- variant: string;
95
- shape: string;
96
- href: string;
97
- block: boolean;
98
- loading: boolean;
99
- disabled: number | boolean;
100
- }, {}, {
101
- UiImpulseIndicator: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
102
- impulse: {
103
- type: (ObjectConstructor | BooleanConstructor)[];
104
- default: boolean;
105
- };
106
- }>, {}, {
107
- impulseArray: never[];
108
- }, {}, {
109
- addImpulse(options: any): void;
110
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
111
- impulse: {
112
- type: (ObjectConstructor | BooleanConstructor)[];
113
- default: boolean;
114
- };
115
- }>> & Readonly<{}>, {
116
- impulse: boolean | Record<string, any>;
117
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
118
- UiLoading: {
119
- new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, {
120
- active: boolean;
121
- $props: {
122
- readonly active?: boolean | undefined;
123
- };
124
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {
125
- progress: (typeof __VLS_nativeElements)["circle"];
126
- }, HTMLElement, import("vue").ComponentProvideOptions, {
127
- P: {};
128
- B: {};
129
- D: {};
130
- C: {};
131
- M: {};
132
- Defaults: {};
133
- }, Readonly<{}> & Readonly<{}>, {
134
- active: boolean;
135
- $props: {
136
- readonly active?: boolean | undefined;
137
- };
138
- }, {}, {}, {}, {}>;
139
- __isFragment?: never;
140
- __isTeleport?: never;
141
- __isSuspense?: never;
142
- } & import("vue").ComponentOptionsBase<Readonly<{}> & Readonly<{}>, {
143
- active: boolean;
144
- $props: {
145
- readonly active?: boolean | undefined;
146
- };
147
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
148
- $slots: {
149
- default?: ((props: {}) => any) | undefined;
150
- };
151
- });
152
- }, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
153
- export default _default;