@community-release/nx-ui 0.0.43 → 0.0.44

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.44"
5
5
  }
@@ -4,16 +4,19 @@
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
14
  @blur="focus = false"
12
15
  @focus="focus = true"
13
16
  autocomplete="off"
14
17
  />
15
18
 
16
- <i :aria-label="ariaLabel"></i>
19
+ <i></i>
17
20
 
18
21
  <span>
19
22
  <slot></slot>
@@ -32,21 +35,22 @@
32
35
  //
33
36
  const props = defineProps({
34
37
  name: {
35
- required: false,
36
38
  default: 'cb'
37
39
  },
38
40
  modelValue: {
39
41
  required: true,
40
42
  },
41
- haveError: {
42
- type: Boolean,
43
- default: false
43
+ inputId: {
44
+ default: '',
44
45
  },
45
- useBinaries: {
46
+ describedby: {
47
+ default: '',
48
+ },
49
+ error: {
46
50
  type: Boolean,
47
51
  default: false
48
52
  },
49
- required: {
53
+ useBinaries: {
50
54
  type: Boolean,
51
55
  default: false
52
56
  },
@@ -59,16 +63,12 @@
59
63
  const emit = defineEmits(['change', 'onchange', 'update:modelValue']);
60
64
 
61
65
  const focus = ref(false);
62
- const ariaLabel = computed(() => {
63
- return (slots.default ? slots.default()[0]?.children || '' : '').trim();
64
- });
65
66
 
66
67
  const classes = computed(() => {
67
68
  const ar = [];
68
69
 
69
- if (props.haveError) ar.push('tag-error');
70
+ if (props.error) ar.push('tag-error');
70
71
  if (props.disabled) ar.push('tag-disabled');
71
- if (props.required) ar.push('tag-required');
72
72
  if (focus.value) ar.push('tag-focus');
73
73
 
74
74
  return ar;
@@ -115,20 +115,6 @@
115
115
 
116
116
  position: relative;
117
117
  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
118
 
133
119
  > label {
134
120
  position: relative;
@@ -200,17 +186,6 @@
200
186
  }
201
187
  }
202
188
 
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
189
  // Disabled
215
190
  &.tag-disabled {
216
191
  opacity: 0.6;
@@ -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,10 @@
50
56
  type: Boolean,
51
57
  default: false,
52
58
  },
59
+ required: {
60
+ type: Boolean,
61
+ default: false,
62
+ },
53
63
  type: {
54
64
  type: String,
55
65
  default: 'text'
@@ -104,8 +114,6 @@
104
114
  const hasSlot = (name) => {
105
115
  return !!slots[name];
106
116
  };
107
- // Hooks
108
-
109
117
  </script>
110
118
 
111
119
  <style lang="less">
@@ -1,8 +1,10 @@
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>
2
+ <component :is="fieldset ? 'fieldset' : 'div'" class="component-ui-label" :class="[`tag-size-${size}`, `tag-weight-${weight}`, required ? 'tag-required' : '']">
3
+ <component :is="fieldset ? 'legend' : 'label'" class="component-ui-label--text" :for="labelFor">
4
+ {{ text }} <span v-if="required" aria-hidden="true">*</span>
5
+ </component>
4
6
  <slot></slot>
5
- </label>
7
+ </component>
6
8
  </template>
7
9
 
8
10
  <script setup>
@@ -14,6 +16,13 @@
14
16
  text: {
15
17
  default: '',
16
18
  },
19
+ fieldset: {
20
+ type: Boolean,
21
+ default: false,
22
+ },
23
+ labelFor: {
24
+ default: ''
25
+ },
17
26
  size: {
18
27
  type: String,
19
28
  default: comProps.size,
@@ -43,11 +52,9 @@
43
52
  @com-text-small: var(--ui-text-small);
44
53
 
45
54
  .component-ui-label {
46
- display: block;
47
-
48
55
  .component-ui-label--text {
49
56
  position: relative;
50
- display: inline-block;
57
+ display: block;
51
58
  padding-bottom: @com-space-micro;
52
59
  font-weight: @com-font-weight-medium;
53
60
  font-size: @com-text-default;
@@ -55,29 +62,21 @@
55
62
  }
56
63
 
57
64
  // 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; }
65
+ &.tag-size-big > .component-ui-label--text { font-size: @com-text-big; }
66
+ &.tag-size-medium > .component-ui-label--text { font-size: @com-text-medium; }
67
+ &.tag-size-default > .component-ui-label--text { font-size: @com-text-default; }
68
+ &.tag-size-small > .component-ui-label--text { font-size: @com-text-small; }
62
69
 
63
70
  // 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; }
71
+ &.tag-weight-700 > .component-ui-label--text { font-weight: 700; }
72
+ &.tag-weight-600 > .component-ui-label--text { font-weight: 600; }
73
+ &.tag-weight-500 > .component-ui-label--text { font-weight: 500; }
74
+ &.tag-weight-400 > .component-ui-label--text { font-weight: 400; }
68
75
 
69
76
  // 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
- }
77
+ &.tag-required .component-ui-label--text span {
78
+ color: @com-color-red;
79
+ font-weight: bold;
81
80
  }
82
81
  }
83
82
  </style>
@@ -4,17 +4,21 @@
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"
13
+ :aria-required="required ? 'true' : 'false'"
14
+ :aria-describedby="describedby"
11
15
  @blur="focus = false"
12
16
  @focus="focus = true"
13
17
  autocomplete="off"
14
18
  @change="handleUpdate($event.target.value)"
15
19
  />
16
20
 
17
- <i :aria-label="ariaLabel"></i>
21
+ <i></i>
18
22
 
19
23
  <span>
20
24
  <slot></slot>
@@ -33,13 +37,18 @@
33
37
  // Data
34
38
  const props = defineProps({
35
39
  name: {
36
- required: false,
37
40
  default: 'rd'
38
41
  },
39
42
  value: {
40
43
  required: true,
41
44
  },
42
45
  modelValue: { default: '' },
46
+ inputId: {
47
+ default: '',
48
+ },
49
+ describedby: {
50
+ default: '',
51
+ },
43
52
  haveError: {
44
53
  type: Boolean,
45
54
  default: false
@@ -55,12 +64,8 @@
55
64
  })
56
65
 
57
66
  const emit = defineEmits(['update:modelValue']);
58
-
59
67
 
60
68
  const focus = ref(false);
61
- const ariaLabel = computed(() => {
62
- return (slots.default ? slots.default()[0]?.children || '' : '').trim();
63
- });
64
69
 
65
70
  const classes = computed(() => {
66
71
  const ar = [];
@@ -69,7 +74,6 @@
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
77
  if (focus.value) ar.push('tag-focus');
74
78
 
75
79
  return ar;
@@ -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;
@@ -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
  >
@@ -25,9 +28,13 @@
25
28
  <script setup>
26
29
  // Imports
27
30
  import { ref, computed, watch, onMounted, nextTick } from 'vue';
31
+ import uniq from './helpers/uniq';
28
32
 
29
33
  // Setup
30
34
  const props = defineProps({
35
+ inputId: {
36
+ default: '',
37
+ },
31
38
  theme: {
32
39
  type: String,
33
40
  default: 'default',
@@ -45,6 +52,10 @@ const props = defineProps({
45
52
  type: Array,
46
53
  default: () => []
47
54
  },
55
+ required: {
56
+ type: Boolean,
57
+ default: false
58
+ },
48
59
  disabled: {
49
60
  type: Boolean,
50
61
  default: false
@@ -66,6 +77,7 @@ const isOpen = ref(false);
66
77
  const increaseZIndex = ref(false);
67
78
  const focus = ref(false);
68
79
  const select = ref(null);
80
+ const uniqId = uniq();
69
81
 
70
82
  const valueName = computed(() => {
71
83
  let result = '...';
@@ -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,13 +46,14 @@
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',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@community-release/nx-ui",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "description": "nx-ui - Nuxt UI library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -63,4 +63,4 @@
63
63
  "docs:components": "vue-docgen",
64
64
  "docs:generate": "npm run generate:production -prefix ./docs"
65
65
  }
66
- }
66
+ }