@community-release/nx-ui 0.0.42 → 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.d.mts CHANGED
@@ -75,7 +75,10 @@ var defaultStyle = {
75
75
  "bs-3": "0 0.4px 0.6px rgba(13,72,177, 0.019), 0 1px 1.6px rgba(13,72,177, 0.027), 0 2.1px 3.2px rgba(13,72,177, 0.033), 4.4px 6.6px rgba(13,72,177, 0.041), 0 12px 18px rgba(13,72,177, 0.06)",
76
76
  // Animation
77
77
  "ani-time": "0.3s",
78
- "ani-ease": "ease"
78
+ "ani-ease": "ease",
79
+ // A11y
80
+ "outline": "2px solid var(--ui-color-primary)",
81
+ "outline-offset": "2px"
79
82
  };
80
83
 
81
84
  var generateStyle = (options) => {
package/dist/module.d.ts CHANGED
@@ -75,7 +75,10 @@ var defaultStyle = {
75
75
  "bs-3": "0 0.4px 0.6px rgba(13,72,177, 0.019), 0 1px 1.6px rgba(13,72,177, 0.027), 0 2.1px 3.2px rgba(13,72,177, 0.033), 4.4px 6.6px rgba(13,72,177, 0.041), 0 12px 18px rgba(13,72,177, 0.06)",
76
76
  // Animation
77
77
  "ani-time": "0.3s",
78
- "ani-ease": "ease"
78
+ "ani-ease": "ease",
79
+ // A11y
80
+ "outline": "2px solid var(--ui-color-primary)",
81
+ "outline-offset": "2px"
79
82
  };
80
83
 
81
84
  var generateStyle = (options) => {
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "ui",
3
3
  "configKey": "ui",
4
- "version": "0.0.42"
4
+ "version": "0.0.44"
5
5
  }
package/dist/module.mjs CHANGED
@@ -75,7 +75,10 @@ const defaultStyle = {
75
75
  "bs-3": "0 0.4px 0.6px rgba(13,72,177, 0.019), 0 1px 1.6px rgba(13,72,177, 0.027), 0 2.1px 3.2px rgba(13,72,177, 0.033), 4.4px 6.6px rgba(13,72,177, 0.041), 0 12px 18px rgba(13,72,177, 0.06)",
76
76
  // Animation
77
77
  "ani-time": "0.3s",
78
- "ani-ease": "ease"
78
+ "ani-ease": "ease",
79
+ // A11y
80
+ "outline": "2px solid var(--ui-color-primary)",
81
+ "outline-offset": "2px"
79
82
  };
80
83
 
81
84
  const generateStyle = (options) => {
@@ -79,7 +79,7 @@ export default {
79
79
  },
80
80
  computed: {
81
81
  computedType() {
82
- return this.type !== '' ? this.type : (this.href !== '' ? 'a' : 'span');
82
+ return this.type !== '' ? this.type : (this.href !== '' ? 'a' : 'button');
83
83
  },
84
84
  classes() {
85
85
  let ar = [];
@@ -108,7 +108,7 @@ export default {
108
108
 
109
109
  return {
110
110
  background,
111
- color
111
+ color,
112
112
  };
113
113
  },
114
114
  buttonBgStyle() {
@@ -348,12 +348,21 @@ export default {
348
348
 
349
349
  @media (hover: hover) {
350
350
  .component-ui-button {
351
+ // Ally
352
+ @com-outline: var(--ui-outline);
353
+ @com-outline-offset: var(--ui-outline-offset);
354
+
351
355
  &:hover {
352
356
  text-decoration: none;
353
357
  color: var(--button-hover-color) !important;
354
358
 
355
359
  .button-bg { opacity: 1; }
356
360
  }
361
+
362
+ &:focus {
363
+ outline: @com-outline;
364
+ outline-offset: @com-outline-offset;
365
+ }
357
366
  }
358
367
  }
359
368
  </style>
@@ -4,10 +4,15 @@
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)"
14
+ @blur="focus = false"
15
+ @focus="focus = true"
11
16
  autocomplete="off"
12
17
  />
13
18
 
@@ -22,26 +27,30 @@
22
27
 
23
28
  <script setup>
24
29
  // Imports
25
- import { computed } from 'vue';
30
+ import { ref, computed, useSlots } from 'vue';
31
+
32
+ // Misc
33
+ const slots = useSlots();
26
34
 
27
35
  //
28
36
  const props = defineProps({
29
37
  name: {
30
- required: false,
31
38
  default: 'cb'
32
39
  },
33
40
  modelValue: {
34
41
  required: true,
35
42
  },
36
- haveError: {
37
- type: Boolean,
38
- default: false
43
+ inputId: {
44
+ default: '',
39
45
  },
40
- useBinaries: {
46
+ describedby: {
47
+ default: '',
48
+ },
49
+ error: {
41
50
  type: Boolean,
42
51
  default: false
43
52
  },
44
- required: {
53
+ useBinaries: {
45
54
  type: Boolean,
46
55
  default: false
47
56
  },
@@ -53,12 +62,14 @@
53
62
 
54
63
  const emit = defineEmits(['change', 'onchange', 'update:modelValue']);
55
64
 
65
+ const focus = ref(false);
66
+
56
67
  const classes = computed(() => {
57
68
  const ar = [];
58
69
 
59
- if (props.haveError) ar.push('tag-error');
70
+ if (props.error) ar.push('tag-error');
60
71
  if (props.disabled) ar.push('tag-disabled');
61
- if (props.required) ar.push('tag-required');
72
+ if (focus.value) ar.push('tag-focus');
62
73
 
63
74
  return ar;
64
75
  });
@@ -104,20 +115,6 @@
104
115
 
105
116
  position: relative;
106
117
  text-align: left;
107
-
108
- .error-wrap {
109
- position: absolute;
110
- top: 100%;
111
- left: 0;
112
- padding: 0;
113
-
114
- font-size: 11px;
115
-
116
- color: @com-color-error-text;
117
- background: transparent;
118
-
119
- &:before, &:after { display: none; }
120
- }
121
118
 
122
119
  > label {
123
120
  position: relative;
@@ -189,17 +186,6 @@
189
186
  }
190
187
  }
191
188
 
192
- // Required
193
- &.tag-required {
194
- span:after {
195
- content: '*';
196
- padding-left: @com-space-micro;
197
- color: @com-color-red;
198
- font-weight: bold;
199
- font-size: @com-text-medium;
200
- }
201
- }
202
-
203
189
  // Disabled
204
190
  &.tag-disabled {
205
191
  opacity: 0.6;
@@ -215,4 +201,17 @@
215
201
  > label { color: @com-color-error-text; }
216
202
  }
217
203
  }
204
+
205
+ @media (hover: hover) {
206
+ .component-ui-checkbox.tag-focus {
207
+ // Ally
208
+ @com-outline: var(--ui-outline);
209
+ @com-outline-offset: var(--ui-outline-offset);
210
+
211
+ i {
212
+ outline: @com-outline;
213
+ outline-offset: @com-outline-offset;
214
+ }
215
+ }
216
+ }
218
217
  </style>
@@ -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">
@@ -144,6 +152,9 @@
144
152
  @com-text-small: var(--ui-text-small);
145
153
  @com-text-mini: var(--ui-text-mini);
146
154
 
155
+ // Ally
156
+ @com-outline: var(--ui-outline);
157
+
147
158
  .component-ui-input {
148
159
  overflow: hidden;
149
160
  position: relative;
@@ -224,8 +235,8 @@
224
235
 
225
236
  // Focus
226
237
  &.tag-focus {
227
- border-color: @com-color-primary;
228
- outline: 1px solid @com-color-primary;
238
+ border-color: transparent;
239
+ outline: @com-outline;
229
240
  }
230
241
 
231
242
  // Disabled
@@ -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,10 +4,16 @@
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"
15
+ @blur="focus = false"
16
+ @focus="focus = true"
11
17
  autocomplete="off"
12
18
  @change="handleUpdate($event.target.value)"
13
19
  />
@@ -22,50 +28,63 @@
22
28
  </template>
23
29
 
24
30
  <script setup>
25
- import { computed } from 'vue';
26
-
27
- const props = defineProps({
28
- name: {
29
- required: false,
30
- default: 'rd'
31
- },
32
- value: {
33
- required: true,
34
- },
35
- modelValue: { default: '' },
36
- haveError: {
37
- type: Boolean,
38
- default: false
39
- },
40
- required: {
41
- type: Boolean,
42
- default: false
43
- },
44
- disabled: {
45
- type: Boolean,
46
- default: false
47
- }
48
- })
31
+ // Imports
32
+ import { ref, computed, useSlots } from 'vue';
33
+
34
+ // Misc
35
+ const slots = useSlots();
36
+
37
+ // Data
38
+ const props = defineProps({
39
+ name: {
40
+ default: 'rd'
41
+ },
42
+ value: {
43
+ required: true,
44
+ },
45
+ modelValue: { default: '' },
46
+ inputId: {
47
+ default: '',
48
+ },
49
+ describedby: {
50
+ default: '',
51
+ },
52
+ haveError: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ required: {
57
+ type: Boolean,
58
+ default: false
59
+ },
60
+ disabled: {
61
+ type: Boolean,
62
+ default: false
63
+ }
64
+ })
49
65
 
50
- const emit = defineEmits(['update:modelValue'])
66
+ const emit = defineEmits(['update:modelValue']);
67
+
68
+ const focus = ref(false);
51
69
 
52
- const classes = computed(() => {
53
- const ar = [];
70
+ const classes = computed(() => {
71
+ const ar = [];
54
72
 
55
- if (props.value !== '') ar.push('tag-not-empty');
56
- if (props.haveError) ar.push('tag-error');
57
- if (props.text) ar.push('tag-text');
58
- if (props.disabled) ar.push('tag-disabled');
59
- if (props.required) ar.push('tag-required');
73
+ if (props.value !== '') ar.push('tag-not-empty');
74
+ if (props.haveError) ar.push('tag-error');
75
+ if (props.text) ar.push('tag-text');
76
+ if (props.disabled) ar.push('tag-disabled');
77
+ if (focus.value) ar.push('tag-focus');
60
78
 
61
- return ar;
62
- });
79
+ return ar;
80
+ });
63
81
 
64
- const isChecked = computed(() => props.modelValue == props.value);
82
+ const isChecked = computed(() => props.modelValue == props.value);
65
83
 
66
- function handleUpdate(v) {
67
- emit('update:modelValue', v);
68
- }
84
+ // Methods
85
+ function handleUpdate(v) {
86
+ emit('update:modelValue', v);
87
+ }
69
88
  </script>
70
89
 
71
90
  <style lang="less">
@@ -186,17 +205,6 @@ function handleUpdate(v) {
186
205
  }
187
206
  }
188
207
 
189
- // Required
190
- &.tag-required {
191
- span:after {
192
- content: '*';
193
- padding-left: @com-space-micro;
194
- color: @com-color-error;
195
- font-weight: bold;
196
- font-size: @com-text-medium;
197
- }
198
- }
199
-
200
208
  // Disabled
201
209
  &.tag-disabled {
202
210
  opacity: 0.6;
@@ -212,4 +220,17 @@ function handleUpdate(v) {
212
220
  > label { color: @com-color-error; }
213
221
  }
214
222
  }
223
+
224
+ @media (hover: hover) {
225
+ .component-ui-radio.tag-focus {
226
+ // Ally
227
+ @com-outline: var(--ui-outline);
228
+ @com-outline-offset: var(--ui-outline-offset);
229
+
230
+ i {
231
+ outline: @com-outline;
232
+ outline-offset: @com-outline-offset;
233
+ }
234
+ }
235
+ }
215
236
  </style>
@@ -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 = '...';
@@ -168,6 +180,9 @@ onMounted(() => {
168
180
  @com-border-radius-default: var(--ui-border-radius-default);
169
181
  @com-bs-1: var(--ui-bs-1);
170
182
 
183
+ // Ally
184
+ @com-outline: var(--ui-outline);
185
+
171
186
  .component-ui-select {
172
187
  position: relative;
173
188
  text-align: left;
@@ -276,7 +291,8 @@ onMounted(() => {
276
291
 
277
292
  &.tag-focus {
278
293
  .value {
279
- border-color: @com-color-primary;
294
+ border-color: transparent;
295
+ outline: @com-outline;
280
296
  }
281
297
  }
282
298
  }
@@ -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',
@@ -113,6 +123,9 @@
113
123
  @com-text-default: var(--ui-text-default);
114
124
  @com-text-small: var(--ui-text-small);
115
125
 
126
+ // Ally
127
+ @com-outline: var(--ui-outline);
128
+
116
129
  .component-ui-textarea {
117
130
  position: relative;
118
131
  cursor: text;
@@ -158,9 +171,11 @@
158
171
  }
159
172
 
160
173
  // Focus
161
- &.tag-focus textarea {
162
- border-color: @com-color-primary;
163
- outline: 1px solid @com-color-primary;
174
+ &.tag-focus {
175
+ textarea {
176
+ border-color: transparent;
177
+ outline: @com-outline;
178
+ }
164
179
  }
165
180
  }
166
181
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@community-release/nx-ui",
3
- "version": "0.0.42",
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
+ }