@onereach/ui-components 2.70.1 → 2.70.2-beta.2199.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.
Files changed (185) hide show
  1. package/dist/bundled/v2/{OrCardCollection-0141a358.js → OrCardCollection-1bb83cfb.js} +1 -1
  2. package/dist/bundled/v2/{OrCheckbox-dbef9f9a.js → OrCheckbox-251ecafc.js} +32 -17
  3. package/dist/bundled/v2/{OrConfirm-23c3ce56.js → OrConfirm-4cae7867.js} +1 -1
  4. package/dist/bundled/v2/{OrInlineInput-87589946.js → OrInlineInput-2133e469.js} +38 -22
  5. package/dist/bundled/v2/{OrInlineTextarea-21b0e6fc.js → OrInlineTextarea-d61ca596.js} +34 -18
  6. package/dist/bundled/v2/{OrInput-82ccfe00.js → OrInput-770f1bed.js} +38 -30
  7. package/dist/bundled/v2/{OrPagination-379c10b8.js → OrPagination-468d0964.js} +1 -1
  8. package/dist/bundled/v2/{OrRadio-cd39b20b.js → OrRadio-ae89bc9b.js} +30 -15
  9. package/dist/bundled/v2/{OrSearch-53470b0e.js → OrSearch-2e5f9e24.js} +1 -1
  10. package/dist/bundled/v2/{OrSelect-c49e1bcf.js → OrSelect-039c0711.js} +2 -2
  11. package/dist/bundled/v2/{OrSwitch-237a2081.js → OrSwitch-20640a05.js} +30 -15
  12. package/dist/bundled/v2/{OrTabs-42f7c52c.js → OrTabs-85aefcba.js} +1 -1
  13. package/dist/bundled/v2/{OrTextarea-5593fbe9.js → OrTextarea-0ff8063b.js} +39 -20
  14. package/dist/bundled/v2/components/index.js +15 -13
  15. package/dist/bundled/v2/components/or-card-collection-v3/index.js +5 -3
  16. package/dist/bundled/v2/components/or-checkbox-v3/OrCheckbox.vue.d.ts +18 -2
  17. package/dist/bundled/v2/components/or-checkbox-v3/index.js +2 -1
  18. package/dist/bundled/v2/components/or-confirm-v3/index.js +4 -2
  19. package/dist/bundled/v2/components/or-inline-input-v3/OrInlineInput.vue.d.ts +36 -6
  20. package/dist/bundled/v2/components/or-inline-input-v3/index.js +3 -1
  21. package/dist/bundled/v2/components/or-inline-textarea-v3/OrInlineTextarea.vue.d.ts +36 -6
  22. package/dist/bundled/v2/components/or-inline-textarea-v3/index.js +3 -1
  23. package/dist/bundled/v2/components/or-input-v3/OrInput.vue.d.ts +43 -8
  24. package/dist/bundled/v2/components/or-input-v3/index.js +3 -1
  25. package/dist/bundled/v2/components/or-pagination-v3/index.js +1 -1
  26. package/dist/bundled/v2/components/or-radio-v3/OrRadio.vue.d.ts +18 -2
  27. package/dist/bundled/v2/components/or-radio-v3/index.js +2 -1
  28. package/dist/bundled/v2/components/or-search-v3/index.js +4 -2
  29. package/dist/bundled/v2/components/or-select-v3/index.js +5 -3
  30. package/dist/bundled/v2/components/or-switch-v3/OrSwitch.vue.d.ts +18 -2
  31. package/dist/bundled/v2/components/or-switch-v3/index.js +2 -1
  32. package/dist/bundled/v2/components/or-tabs-v3/index.js +1 -1
  33. package/dist/bundled/v2/components/or-textarea-v3/OrTextarea.vue.d.ts +45 -6
  34. package/dist/bundled/v2/components/or-textarea-v3/index.js +3 -1
  35. package/dist/bundled/v2/hooks/index.d.ts +3 -0
  36. package/dist/bundled/v2/hooks/index.js +2 -0
  37. package/dist/bundled/v2/hooks/useControlAttributes.d.ts +8 -0
  38. package/dist/bundled/v2/hooks/useIdAttribute.d.ts +2 -0
  39. package/dist/bundled/v2/hooks/useValidationAttributes.d.ts +12 -0
  40. package/dist/bundled/v2/index.js +15 -13
  41. package/dist/bundled/v2/useIdAttribute-cf61643f.js +22 -0
  42. package/dist/bundled/v2/useValidationAttributes-6df7bcf9.js +17 -0
  43. package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-2d78a51a.js → OrCardCollection.vue_vue_type_script_lang-a0f29a55.js} +1 -1
  44. package/dist/bundled/v3/{OrCheckbox.vue_vue_type_script_lang-8b36e06c.js → OrCheckbox.vue_vue_type_script_lang-2024ec32.js} +22 -7
  45. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-05b21989.js → OrConfirm.vue_vue_type_script_lang-7d9d3810.js} +2 -2
  46. package/dist/bundled/v3/{OrInlineInput.vue_vue_type_script_lang-67218502.js → OrInlineInput.vue_vue_type_script_lang-40f0073f.js} +27 -11
  47. package/dist/bundled/v3/{OrInlineTextarea.vue_vue_type_script_lang-a1831ab8.js → OrInlineTextarea.vue_vue_type_script_lang-2817edd5.js} +27 -11
  48. package/dist/bundled/v3/{OrInput-a4f220ed.js → OrInput-e325a104.js} +12 -12
  49. package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-607d79d4.js → OrInput.vue_vue_type_script_lang-fd850b82.js} +26 -15
  50. package/dist/bundled/v3/{OrPagination.vue_vue_type_script_lang-c96d7cd7.js → OrPagination.vue_vue_type_script_lang-0d9daaa7.js} +1 -1
  51. package/dist/bundled/v3/{OrRadio.vue_vue_type_script_lang-2e666a56.js → OrRadio.vue_vue_type_script_lang-29e8b856.js} +22 -7
  52. package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-06f318ca.js → OrSearch.vue_vue_type_script_lang-480f4b1c.js} +2 -2
  53. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-58e5a52b.js → OrSelect.vue_vue_type_script_lang-7aa8956a.js} +17 -15
  54. package/dist/bundled/v3/{OrSwitch.vue_vue_type_script_lang-04829f64.js → OrSwitch.vue_vue_type_script_lang-02b4913a.js} +22 -7
  55. package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-61b79a5a.js → OrTabs.vue_vue_type_script_lang-01188224.js} +1 -1
  56. package/dist/bundled/v3/{OrTextarea.vue_vue_type_script_lang-8e3531cd.js → OrTextarea.vue_vue_type_script_lang-2fdac7b2.js} +31 -12
  57. package/dist/bundled/v3/components/index.js +16 -14
  58. package/dist/bundled/v3/components/or-card-collection-v3/index.js +6 -4
  59. package/dist/bundled/v3/components/or-checkbox-v3/OrCheckbox.vue.d.ts +18 -2
  60. package/dist/bundled/v3/components/or-checkbox-v3/index.js +2 -1
  61. package/dist/bundled/v3/components/or-confirm-v3/index.js +5 -3
  62. package/dist/bundled/v3/components/or-inline-input-v3/OrInlineInput.vue.d.ts +36 -6
  63. package/dist/bundled/v3/components/or-inline-input-v3/index.js +3 -1
  64. package/dist/bundled/v3/components/or-inline-textarea-v3/OrInlineTextarea.vue.d.ts +36 -6
  65. package/dist/bundled/v3/components/or-inline-textarea-v3/index.js +3 -1
  66. package/dist/bundled/v3/components/or-input-v3/OrInput.vue.d.ts +43 -8
  67. package/dist/bundled/v3/components/or-input-v3/index.js +3 -1
  68. package/dist/bundled/v3/components/or-pagination-v3/index.js +1 -1
  69. package/dist/bundled/v3/components/or-radio-v3/OrRadio.vue.d.ts +18 -2
  70. package/dist/bundled/v3/components/or-radio-v3/index.js +2 -1
  71. package/dist/bundled/v3/components/or-search-v3/index.js +5 -3
  72. package/dist/bundled/v3/components/or-select-v3/index.js +6 -4
  73. package/dist/bundled/v3/components/or-switch-v3/OrSwitch.vue.d.ts +18 -2
  74. package/dist/bundled/v3/components/or-switch-v3/index.js +2 -1
  75. package/dist/bundled/v3/components/or-tabs-v3/index.js +1 -1
  76. package/dist/bundled/v3/components/or-textarea-v3/OrTextarea.vue.d.ts +45 -6
  77. package/dist/bundled/v3/components/or-textarea-v3/index.js +3 -1
  78. package/dist/bundled/v3/hooks/index.d.ts +3 -0
  79. package/dist/bundled/v3/hooks/index.js +2 -0
  80. package/dist/bundled/v3/hooks/useControlAttributes.d.ts +8 -0
  81. package/dist/bundled/v3/hooks/useIdAttribute.d.ts +2 -0
  82. package/dist/bundled/v3/hooks/useValidationAttributes.d.ts +12 -0
  83. package/dist/bundled/v3/index.js +76 -68
  84. package/dist/bundled/v3/useIdAttribute-b2e42f31.js +21 -0
  85. package/dist/bundled/v3/useValidationAttributes-5428d8fa.js +16 -0
  86. package/dist/esm/v2/{OrCardCollection-3c38fc85.js → OrCardCollection-784318ac.js} +1 -1
  87. package/dist/esm/v2/{OrCheckbox-567e387c.js → OrCheckbox-7317fe1a.js} +32 -17
  88. package/dist/esm/v2/{OrConfirm-e2ab9b4c.js → OrConfirm-3d064f6c.js} +1 -1
  89. package/dist/esm/v2/{OrInlineInput-10205811.js → OrInlineInput-7c4f1f92.js} +38 -22
  90. package/dist/esm/v2/{OrInlineTextarea-7658611e.js → OrInlineTextarea-3381e2a9.js} +34 -18
  91. package/dist/esm/v2/{OrInput-ada3a970.js → OrInput-e10cc643.js} +38 -30
  92. package/dist/esm/v2/{OrPagination-c0dbec6a.js → OrPagination-291bd1b9.js} +1 -1
  93. package/dist/esm/v2/{OrRadio-848ce55d.js → OrRadio-b0a560d2.js} +30 -15
  94. package/dist/esm/v2/{OrSearch-0f08f2f5.js → OrSearch-1490c00b.js} +1 -1
  95. package/dist/esm/v2/{OrSelect-1d705445.js → OrSelect-1fbeed4f.js} +2 -2
  96. package/dist/esm/v2/{OrSwitch-13b6a7ee.js → OrSwitch-133052ca.js} +30 -15
  97. package/dist/esm/v2/{OrTabs-71bd3fd2.js → OrTabs-e5b81f4b.js} +1 -1
  98. package/dist/esm/v2/{OrTextarea-6712a150.js → OrTextarea-a7c846da.js} +39 -20
  99. package/dist/esm/v2/components/index.js +15 -13
  100. package/dist/esm/v2/components/or-card-collection-v3/index.js +5 -3
  101. package/dist/esm/v2/components/or-checkbox-v3/OrCheckbox.vue.d.ts +18 -2
  102. package/dist/esm/v2/components/or-checkbox-v3/index.js +2 -1
  103. package/dist/esm/v2/components/or-confirm-v3/index.js +4 -2
  104. package/dist/esm/v2/components/or-inline-input-v3/OrInlineInput.vue.d.ts +36 -6
  105. package/dist/esm/v2/components/or-inline-input-v3/index.js +3 -1
  106. package/dist/esm/v2/components/or-inline-textarea-v3/OrInlineTextarea.vue.d.ts +36 -6
  107. package/dist/esm/v2/components/or-inline-textarea-v3/index.js +3 -1
  108. package/dist/esm/v2/components/or-input-v3/OrInput.vue.d.ts +43 -8
  109. package/dist/esm/v2/components/or-input-v3/index.js +3 -1
  110. package/dist/esm/v2/components/or-pagination-v3/index.js +1 -1
  111. package/dist/esm/v2/components/or-radio-v3/OrRadio.vue.d.ts +18 -2
  112. package/dist/esm/v2/components/or-radio-v3/index.js +2 -1
  113. package/dist/esm/v2/components/or-search-v3/index.js +4 -2
  114. package/dist/esm/v2/components/or-select-v3/index.js +5 -3
  115. package/dist/esm/v2/components/or-switch-v3/OrSwitch.vue.d.ts +18 -2
  116. package/dist/esm/v2/components/or-switch-v3/index.js +2 -1
  117. package/dist/esm/v2/components/or-tabs-v3/index.js +1 -1
  118. package/dist/esm/v2/components/or-textarea-v3/OrTextarea.vue.d.ts +45 -6
  119. package/dist/esm/v2/components/or-textarea-v3/index.js +3 -1
  120. package/dist/esm/v2/hooks/index.d.ts +3 -0
  121. package/dist/esm/v2/hooks/index.js +2 -0
  122. package/dist/esm/v2/hooks/useControlAttributes.d.ts +8 -0
  123. package/dist/esm/v2/hooks/useIdAttribute.d.ts +2 -0
  124. package/dist/esm/v2/hooks/useValidationAttributes.d.ts +12 -0
  125. package/dist/esm/v2/index.js +15 -13
  126. package/dist/esm/v2/useIdAttribute-859439f0.js +21 -0
  127. package/dist/esm/v2/useValidationAttributes-d1abbe34.js +16 -0
  128. package/dist/esm/v3/{OrCardCollection-dbb3e839.js → OrCardCollection-110b3a0b.js} +1 -1
  129. package/dist/esm/v3/{OrCheckbox-3e139eac.js → OrCheckbox-7144da06.js} +36 -19
  130. package/dist/esm/v3/{OrConfirm-1bcd39b1.js → OrConfirm-1a38ed1b.js} +1 -1
  131. package/dist/esm/v3/{OrInlineInput-507fc99c.js → OrInlineInput-a6b19dbe.js} +37 -20
  132. package/dist/esm/v3/{OrInlineTextarea-53a9e027.js → OrInlineTextarea-9eb60363.js} +37 -20
  133. package/dist/esm/v3/{OrInput-9c0426b9.js → OrInput-e07ec00c.js} +37 -26
  134. package/dist/esm/v3/{OrPagination-a703307d.js → OrPagination-5e01a0a5.js} +1 -1
  135. package/dist/esm/v3/{OrRadio-54b6d0de.js → OrRadio-39d1905d.js} +34 -17
  136. package/dist/esm/v3/{OrSearch-9885d178.js → OrSearch-a60f67f0.js} +1 -1
  137. package/dist/esm/v3/{OrSelect-dfa4885f.js → OrSelect-2c70e384.js} +2 -2
  138. package/dist/esm/v3/{OrSwitch-cca30aa0.js → OrSwitch-3e9a699d.js} +34 -18
  139. package/dist/esm/v3/{OrTabs-d0ee6cef.js → OrTabs-91618aab.js} +1 -1
  140. package/dist/esm/v3/{OrTextarea-bb9ef3f2.js → OrTextarea-fd6b9f31.js} +42 -22
  141. package/dist/esm/v3/components/index.js +15 -13
  142. package/dist/esm/v3/components/or-card-collection-v3/index.js +5 -3
  143. package/dist/esm/v3/components/or-checkbox-v3/OrCheckbox.vue.d.ts +18 -2
  144. package/dist/esm/v3/components/or-checkbox-v3/index.js +2 -1
  145. package/dist/esm/v3/components/or-confirm-v3/index.js +4 -2
  146. package/dist/esm/v3/components/or-inline-input-v3/OrInlineInput.vue.d.ts +36 -6
  147. package/dist/esm/v3/components/or-inline-input-v3/index.js +3 -1
  148. package/dist/esm/v3/components/or-inline-textarea-v3/OrInlineTextarea.vue.d.ts +36 -6
  149. package/dist/esm/v3/components/or-inline-textarea-v3/index.js +3 -1
  150. package/dist/esm/v3/components/or-input-v3/OrInput.vue.d.ts +43 -8
  151. package/dist/esm/v3/components/or-input-v3/index.js +3 -1
  152. package/dist/esm/v3/components/or-pagination-v3/index.js +1 -1
  153. package/dist/esm/v3/components/or-radio-v3/OrRadio.vue.d.ts +18 -2
  154. package/dist/esm/v3/components/or-radio-v3/index.js +2 -1
  155. package/dist/esm/v3/components/or-search-v3/index.js +4 -2
  156. package/dist/esm/v3/components/or-select-v3/index.js +5 -3
  157. package/dist/esm/v3/components/or-switch-v3/OrSwitch.vue.d.ts +18 -2
  158. package/dist/esm/v3/components/or-switch-v3/index.js +2 -1
  159. package/dist/esm/v3/components/or-tabs-v3/index.js +1 -1
  160. package/dist/esm/v3/components/or-textarea-v3/OrTextarea.vue.d.ts +45 -6
  161. package/dist/esm/v3/components/or-textarea-v3/index.js +3 -1
  162. package/dist/esm/v3/hooks/index.d.ts +3 -0
  163. package/dist/esm/v3/hooks/index.js +2 -0
  164. package/dist/esm/v3/hooks/useControlAttributes.d.ts +8 -0
  165. package/dist/esm/v3/hooks/useIdAttribute.d.ts +2 -0
  166. package/dist/esm/v3/hooks/useValidationAttributes.d.ts +12 -0
  167. package/dist/esm/v3/index.js +15 -13
  168. package/dist/esm/v3/useIdAttribute-859439f0.js +21 -0
  169. package/dist/esm/v3/useValidationAttributes-d1abbe34.js +16 -0
  170. package/package.json +2 -3
  171. package/src/components/or-checkbox-v3/OrCheckbox.vue +28 -10
  172. package/src/components/or-inline-input-v3/OrInlineInput.vue +32 -13
  173. package/src/components/or-inline-textarea-v3/OrInlineTextarea.vue +32 -13
  174. package/src/components/or-input-v3/OrInput.stories3.ts +4 -4
  175. package/src/components/or-input-v3/OrInput.vue +31 -19
  176. package/src/components/or-pagination-v3/OrPagination.vue +1 -1
  177. package/src/components/or-radio-v3/OrRadio.vue +27 -9
  178. package/src/components/or-switch-v3/OrSwitch.vue +27 -9
  179. package/src/components/or-tabs-v3/OrTabs.vue +1 -1
  180. package/src/components/or-textarea-v3/OrTextarea.stories3.ts +4 -4
  181. package/src/components/or-textarea-v3/OrTextarea.vue +36 -14
  182. package/src/hooks/index.ts +3 -0
  183. package/src/hooks/useControlAttributes.ts +19 -0
  184. package/src/hooks/useIdAttribute.ts +9 -0
  185. package/src/hooks/useValidationAttributes.ts +25 -0
@@ -1,14 +1,15 @@
1
1
  <template>
2
2
  <div
3
3
  ref="root"
4
+ v-bind="$attrs"
4
5
  :class="rootStyles"
5
6
  >
6
7
  <input
7
- v-bind="$attrs"
8
- :id="controlId"
8
+ ref="control"
9
9
  v-model="proxyModelValue"
10
+ v-bind="controlAttributes"
10
11
  :class="controlStyles"
11
- type="checkbox"
12
+ :type="'checkbox'"
12
13
  :value="inputValue"
13
14
  :indeterminate="indeterminate"
14
15
  :required="required"
@@ -19,7 +20,7 @@
19
20
 
20
21
  <template v-if="$slots.default || label">
21
22
  <OrLabel
22
- :control-id="controlId"
23
+ :control-id="controlAttributes.id"
23
24
  :variant="labelVariant"
24
25
  :required="required"
25
26
  :disabled="disabled"
@@ -35,8 +36,8 @@
35
36
  </template>
36
37
 
37
38
  <script lang="ts">
38
- import { computed, defineComponent, getCurrentInstance, PropType, ref } from 'vue-demi';
39
- import { useClassAttribute } from '../../hooks';
39
+ import { computed, defineComponent, PropType, reactive, ref } from 'vue-demi';
40
+ import { useClassAttribute, useControlAttributes, useIdAttribute } from '../../hooks';
40
41
  import { LabelVariant, OrLabelV3 as OrLabel } from '../or-label-v3';
41
42
  import { CheckboxControl, CheckboxControlHandle, CheckboxRoot } from './styles';
42
43
 
@@ -101,13 +102,15 @@ export default defineComponent({
101
102
 
102
103
  expose: [
103
104
  'root',
105
+
106
+ 'focus',
107
+ 'blur',
104
108
  ],
105
109
 
106
110
  setup(props, context) {
107
- const currentInstance = getCurrentInstance()!;
108
-
109
111
  // Refs
110
112
  const root = ref<HTMLElement>();
113
+ const control = ref<HTMLInputElement>();
111
114
 
112
115
  // Styles
113
116
  const classAttribute = useClassAttribute();
@@ -124,7 +127,10 @@ export default defineComponent({
124
127
  ]);
125
128
 
126
129
  // State
127
- const controlId = ref(context.attrs.id as string ?? currentInstance.uid.toString());
130
+ const controlAttributes = reactive({
131
+ id: useIdAttribute(),
132
+ ...useControlAttributes(),
133
+ });
128
134
 
129
135
  const proxyModelValue = computed({
130
136
  get: () => {
@@ -137,12 +143,24 @@ export default defineComponent({
137
143
  },
138
144
  });
139
145
 
146
+ // Methods
147
+ function focus(): void {
148
+ control.value?.focus();
149
+ }
150
+
151
+ function blur(): void {
152
+ control.value?.blur();
153
+ }
154
+
140
155
  return {
141
156
  root,
157
+ control,
142
158
  rootStyles,
143
159
  controlStyles,
144
- controlId,
160
+ controlAttributes,
145
161
  proxyModelValue,
162
+ focus,
163
+ blur,
146
164
  };
147
165
  },
148
166
  });
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  ref="root"
4
+ v-bind="$attrs"
4
5
  :class="rootStyles"
5
6
  >
6
7
  <div :class="['layout-row', 'gap-sm+']">
@@ -9,9 +10,9 @@
9
10
  :invalid="invalid"
10
11
  >
11
12
  <input
12
- :id="controlId"
13
+ ref="control"
13
14
  v-model="draftModelValue"
14
- v-bind="$attrs"
15
+ v-bind="controlAttributes"
15
16
  :class="controlStyles"
16
17
  :type="type"
17
18
  :placeholder="placeholder"
@@ -71,8 +72,8 @@
71
72
  </template>
72
73
 
73
74
  <script lang="ts">
74
- import { computed, defineComponent, getCurrentInstance, PropType, ref, watch } from 'vue-demi';
75
- import { useClassAttribute } from '../../hooks';
75
+ import { computed, defineComponent, PropType, reactive, ref, watch } from 'vue-demi';
76
+ import { useClassAttribute, useControlAttributes, useIdAttribute, useValidationAttributes } from '../../hooks';
76
77
  import { OrErrorV3 as OrError } from '../or-error-v3';
77
78
  import { OrHintV3 as OrHint } from '../or-hint-v3';
78
79
  import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
@@ -146,13 +147,15 @@ export default defineComponent({
146
147
 
147
148
  expose: [
148
149
  'root',
150
+
151
+ 'focus',
152
+ 'blur',
149
153
  ],
150
154
 
151
155
  setup(props, context) {
152
- const currentInstance = getCurrentInstance()!;
153
-
154
156
  // Refs
155
157
  const root = ref<HTMLElement>();
158
+ const control = ref<HTMLInputElement>();
156
159
 
157
160
  // Styles
158
161
  const classAttribute = useClassAttribute();
@@ -173,7 +176,11 @@ export default defineComponent({
173
176
  ]);
174
177
 
175
178
  // State
176
- const controlId = ref(context.attrs.id as string ?? currentInstance.uid.toString());
179
+ const controlAttributes = reactive({
180
+ id: useIdAttribute(),
181
+ ...useControlAttributes(),
182
+ ...useValidationAttributes(),
183
+ });
177
184
 
178
185
  const proxyModelValue = computed({
179
186
  get: () => {
@@ -188,11 +195,12 @@ export default defineComponent({
188
195
 
189
196
  const draftModelValue = ref<string | number>('');
190
197
 
191
- const activated = ref(false);
198
+ const currentLength = computed(() => draftModelValue.value?.toString().length ?? 0);
199
+ const maxLength = computed(() => controlAttributes.maxlength);
200
+
192
201
  const invalid = computed(() => !!props.error);
193
202
 
194
- const currentLength = computed(() => draftModelValue.value?.toString().length ?? 0);
195
- const maxLength = computed(() => context.attrs.maxlength as number | undefined);
203
+ const activated = ref(false);
196
204
 
197
205
  // Handlers
198
206
  function onFocus(event: Event): void {
@@ -210,6 +218,14 @@ export default defineComponent({
210
218
  }
211
219
 
212
220
  // Methods
221
+ function focus(): void {
222
+ control.value?.focus();
223
+ }
224
+
225
+ function blur(): void {
226
+ control.value?.blur();
227
+ }
228
+
213
229
  function apply(): void {
214
230
  if (draftModelValue.value !== proxyModelValue.value) {
215
231
  proxyModelValue.value = draftModelValue.value;
@@ -233,18 +249,21 @@ export default defineComponent({
233
249
 
234
250
  return {
235
251
  root,
252
+ control,
236
253
  rootStyles,
237
254
  controlStyles,
238
255
  actionStyles,
239
- controlId,
256
+ controlAttributes,
240
257
  proxyModelValue,
241
258
  draftModelValue,
242
- activated,
243
- invalid,
244
259
  currentLength,
245
260
  maxLength,
261
+ invalid,
262
+ activated,
246
263
  onFocus,
247
264
  onBlur,
265
+ focus,
266
+ blur,
248
267
  apply,
249
268
  reset,
250
269
  };
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  ref="root"
4
+ v-bind="$attrs"
4
5
  :class="rootStyles"
5
6
  >
6
7
  <div :class="['layout-row', 'gap-sm+']">
@@ -9,9 +10,9 @@
9
10
  :invalid="invalid"
10
11
  >
11
12
  <textarea
12
- :id="controlId"
13
+ ref="control"
13
14
  v-model="draftModelValue"
14
- v-bind="$attrs"
15
+ v-bind="controlAttributes"
15
16
  :class="controlStyles"
16
17
  :placeholder="placeholder"
17
18
  :activated="activated ? '' : null"
@@ -70,8 +71,8 @@
70
71
  </template>
71
72
 
72
73
  <script lang="ts">
73
- import { computed, defineComponent, getCurrentInstance, ref, watch } from 'vue-demi';
74
- import { useClassAttribute } from '../../hooks';
74
+ import { computed, defineComponent, reactive, ref, watch } from 'vue-demi';
75
+ import { useClassAttribute, useControlAttributes, useIdAttribute, useValidationAttributes } from '../../hooks';
75
76
  import { OrErrorV3 as OrError } from '../or-error-v3';
76
77
  import { OrHintV3 as OrHint } from '../or-hint-v3';
77
78
  import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
@@ -134,13 +135,15 @@ export default defineComponent({
134
135
 
135
136
  expose: [
136
137
  'root',
138
+
139
+ 'focus',
140
+ 'blur',
137
141
  ],
138
142
 
139
143
  setup(props, context) {
140
- const currentInstance = getCurrentInstance()!;
141
-
142
144
  // Refs
143
145
  const root = ref<HTMLElement>();
146
+ const control = ref<HTMLTextAreaElement>();
144
147
 
145
148
  // Styles
146
149
  const classAttribute = useClassAttribute();
@@ -160,7 +163,11 @@ export default defineComponent({
160
163
  ]);
161
164
 
162
165
  // State
163
- const controlId = ref(context.attrs.id as string ?? currentInstance.uid.toString());
166
+ const controlAttributes = reactive({
167
+ id: useIdAttribute(),
168
+ ...useControlAttributes(),
169
+ ...useValidationAttributes(),
170
+ });
164
171
 
165
172
  const proxyModelValue = computed({
166
173
  get: () => {
@@ -175,11 +182,12 @@ export default defineComponent({
175
182
 
176
183
  const draftModelValue = ref<string>('');
177
184
 
178
- const activated = ref(false);
185
+ const currentLength = computed(() => draftModelValue.value?.toString().length ?? 0);
186
+ const maxLength = computed(() => controlAttributes.maxlength);
187
+
179
188
  const invalid = computed(() => !!props.error);
180
189
 
181
- const currentLength = computed(() => draftModelValue.value?.toString().length ?? 0);
182
- const maxLength = computed(() => context.attrs.maxlength as number | undefined);
190
+ const activated = ref(false);
183
191
 
184
192
  // Handlers
185
193
  function onFocus(event: Event): void {
@@ -197,6 +205,14 @@ export default defineComponent({
197
205
  }
198
206
 
199
207
  // Methods
208
+ function focus(): void {
209
+ control.value?.focus();
210
+ }
211
+
212
+ function blur(): void {
213
+ control.value?.blur();
214
+ }
215
+
200
216
  function apply(): void {
201
217
  if (draftModelValue.value !== proxyModelValue.value) {
202
218
  proxyModelValue.value = draftModelValue.value;
@@ -220,18 +236,21 @@ export default defineComponent({
220
236
 
221
237
  return {
222
238
  root,
239
+ control,
223
240
  rootStyles,
224
241
  controlStyles,
225
242
  actionStyles,
226
- controlId,
243
+ controlAttributes,
227
244
  proxyModelValue,
228
245
  draftModelValue,
229
- activated,
230
- invalid,
231
246
  currentLength,
232
247
  maxLength,
248
+ invalid,
249
+ activated,
233
250
  onFocus,
234
251
  onBlur,
252
+ focus,
253
+ blur,
235
254
  apply,
236
255
  reset,
237
256
  };
@@ -17,10 +17,6 @@ export default {
17
17
  control: { type: 'text' },
18
18
  },
19
19
 
20
- readonly: {
21
- control: { type: 'boolean' },
22
- },
23
-
24
20
  maxlength: {
25
21
  control: { type: 'number' },
26
22
  },
@@ -74,6 +70,10 @@ export default {
74
70
  control: { type: 'boolean' },
75
71
  },
76
72
 
73
+ readonly: {
74
+ control: { type: 'boolean' },
75
+ },
76
+
77
77
  disabled: {
78
78
  control: { type: 'boolean' },
79
79
  },
@@ -1,11 +1,12 @@
1
1
  <template>
2
2
  <div
3
3
  ref="root"
4
+ v-bind="$attrs"
4
5
  :class="rootStyles"
5
6
  >
6
7
  <template v-if="label">
7
8
  <OrLabel
8
- :control-id="controlId"
9
+ :control-id="controlAttributes.id"
9
10
  :variant="'input'"
10
11
  :required="required"
11
12
  :disabled="disabled"
@@ -26,10 +27,9 @@
26
27
  :disabled="disabled"
27
28
  >
28
29
  <input
29
- :id="controlId"
30
- ref="input"
30
+ ref="control"
31
31
  v-model="proxyModelValue"
32
- v-bind="$attrs"
32
+ v-bind="controlAttributes"
33
33
  :class="controlStyles"
34
34
  :type="type === 'password' && disclosed ? 'text' : type"
35
35
  :placeholder="placeholder"
@@ -102,8 +102,8 @@
102
102
  </template>
103
103
 
104
104
  <script lang="ts">
105
- import { computed, defineComponent, getCurrentInstance, PropType, ref } from 'vue-demi';
106
- import { useClassAttribute } from '../../hooks';
105
+ import { computed, defineComponent, PropType, reactive, ref } from 'vue-demi';
106
+ import { useClassAttribute, useControlAttributes, useIdAttribute, useValidationAttributes } from '../../hooks';
107
107
  import { OrErrorV3 as OrError } from '../or-error-v3';
108
108
  import { OrHintV3 as OrHint } from '../or-hint-v3';
109
109
  import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
@@ -173,6 +173,11 @@ export default defineComponent({
173
173
  default: false,
174
174
  },
175
175
 
176
+ readonly: {
177
+ type: Boolean,
178
+ default: false,
179
+ },
180
+
176
181
  disabled: {
177
182
  type: Boolean,
178
183
  default: false,
@@ -196,15 +201,15 @@ export default defineComponent({
196
201
 
197
202
  expose: [
198
203
  'root',
204
+
199
205
  'focus',
206
+ 'blur',
200
207
  ],
201
208
 
202
209
  setup(props, context) {
203
- const currentInstance = getCurrentInstance()!;
204
-
205
210
  // Refs
206
211
  const root = ref<HTMLElement>();
207
- const input = ref<HTMLInputElement>();
212
+ const control = ref<HTMLInputElement>();
208
213
 
209
214
  // Styles
210
215
  const classAttribute = useClassAttribute();
@@ -220,7 +225,11 @@ export default defineComponent({
220
225
  ]);
221
226
 
222
227
  // State
223
- const controlId = ref(context.attrs.id as string ?? currentInstance.uid.toString());
228
+ const controlAttributes = reactive({
229
+ id: useIdAttribute(),
230
+ ...useControlAttributes(),
231
+ ...useValidationAttributes(),
232
+ });
224
233
 
225
234
  const proxyModelValue = computed({
226
235
  get: () => {
@@ -233,32 +242,35 @@ export default defineComponent({
233
242
  },
234
243
  });
235
244
 
236
- const invalid = computed(() => !!props.error);
237
- const readonly = computed(() => context.attrs.readonly as boolean);
238
-
239
245
  const currentLength = computed(() => proxyModelValue.value?.toString().length ?? 0);
240
- const maxLength = computed(() => context.attrs.maxlength as number | undefined);
246
+ const maxLength = computed(() => controlAttributes.maxlength);
247
+
248
+ const invalid = computed(() => !!props.error);
241
249
 
242
250
  const disclosed = ref(false);
243
251
 
244
252
  // Methods
245
253
  function focus(): void {
246
- input.value?.focus();
254
+ control.value?.focus();
255
+ }
256
+
257
+ function blur(): void {
258
+ control.value?.blur();
247
259
  }
248
260
 
249
261
  return {
250
262
  root,
251
- input,
263
+ control,
252
264
  rootStyles,
253
265
  controlStyles,
254
- controlId,
266
+ controlAttributes,
255
267
  proxyModelValue,
256
- invalid,
257
- readonly,
258
268
  currentLength,
259
269
  maxLength,
270
+ invalid,
260
271
  disclosed,
261
272
  focus,
273
+ blur,
262
274
  };
263
275
  },
264
276
  });
@@ -231,7 +231,7 @@ export default defineComponent({
231
231
  }, [] as (number | string)[]);
232
232
  });
233
233
 
234
- // Functions
234
+ // Methods
235
235
  function toPreviousPage(): void {
236
236
  currentPage.value = currentPage.value - 1;
237
237
  }
@@ -1,12 +1,13 @@
1
1
  <template>
2
2
  <div
3
3
  ref="root"
4
+ v-bind="$attrs"
4
5
  :class="rootStyles"
5
6
  >
6
7
  <input
7
- v-bind="$attrs"
8
- :id="controlId"
8
+ ref="control"
9
9
  v-model="proxyModelValue"
10
+ v-bind="controlAttributes"
10
11
  :class="controlStyles"
11
12
  type="radio"
12
13
  :value="inputValue"
@@ -18,7 +19,7 @@
18
19
 
19
20
  <template v-if="$slots.default || label">
20
21
  <OrLabel
21
- :control-id="controlId"
22
+ :control-id="controlAttributes.id"
22
23
  :variant="labelVariant"
23
24
  :required="required"
24
25
  :disabled="disabled"
@@ -34,8 +35,8 @@
34
35
  </template>
35
36
 
36
37
  <script lang="ts">
37
- import { computed, defineComponent, getCurrentInstance, PropType, ref } from 'vue-demi';
38
- import { useClassAttribute } from '../../hooks';
38
+ import { computed, defineComponent, PropType, reactive, ref } from 'vue-demi';
39
+ import { useClassAttribute, useControlAttributes, useIdAttribute } from '../../hooks';
39
40
  import { LabelVariant, OrLabelV3 as OrLabel } from '../or-label-v3';
40
41
  import { RadioControl, RadioControlHandle, RadioRoot } from './styles';
41
42
 
@@ -95,13 +96,15 @@ export default defineComponent({
95
96
 
96
97
  expose: [
97
98
  'root',
99
+
100
+ 'focus',
101
+ 'blur',
98
102
  ],
99
103
 
100
104
  setup(props, context) {
101
- const currentInstance = getCurrentInstance()!;
102
-
103
105
  // Refs
104
106
  const root = ref<HTMLElement>();
107
+ const control = ref<HTMLInputElement>();
105
108
 
106
109
  // Styles
107
110
  const classAttribute = useClassAttribute();
@@ -118,7 +121,10 @@ export default defineComponent({
118
121
  ]);
119
122
 
120
123
  // State
121
- const controlId = ref(context.attrs.id as string ?? currentInstance.uid.toString());
124
+ const controlAttributes = reactive({
125
+ id: useIdAttribute(),
126
+ ...useControlAttributes(),
127
+ });
122
128
 
123
129
  const proxyModelValue = computed({
124
130
  get: () => {
@@ -131,12 +137,24 @@ export default defineComponent({
131
137
  },
132
138
  });
133
139
 
140
+ // Methods
141
+ function focus(): void {
142
+ control.value?.focus();
143
+ }
144
+
145
+ function blur(): void {
146
+ control.value?.blur();
147
+ }
148
+
134
149
  return {
135
150
  root,
151
+ control,
136
152
  rootStyles,
137
153
  controlStyles,
138
- controlId,
154
+ controlAttributes,
139
155
  proxyModelValue,
156
+ focus,
157
+ blur,
140
158
  };
141
159
  },
142
160
  });
@@ -1,13 +1,14 @@
1
1
  <template>
2
2
  <div
3
3
  ref="root"
4
+ v-bind="$attrs"
4
5
  :class="rootStyles"
5
6
  >
6
7
  <template v-if="!loading">
7
8
  <input
8
- v-bind="$attrs"
9
- :id="controlId"
9
+ ref="control"
10
10
  v-model="proxyModelValue"
11
+ v-bind="controlAttributes"
11
12
  :class="controlStyles"
12
13
  type="checkbox"
13
14
  :value="inputValue"
@@ -33,7 +34,7 @@
33
34
 
34
35
  <template v-if="$slots.default || label">
35
36
  <OrLabel
36
- :control-id="controlId"
37
+ :control-id="controlAttributes.id"
37
38
  :variant="labelVariant"
38
39
  :required="required"
39
40
  :disabled="disabled"
@@ -49,8 +50,8 @@
49
50
  </template>
50
51
 
51
52
  <script lang="ts">
52
- import { computed, defineComponent, getCurrentInstance, PropType, ref } from 'vue-demi';
53
- import { useClassAttribute } from '../../hooks';
53
+ import { computed, defineComponent, PropType, reactive, ref } from 'vue-demi';
54
+ import { useClassAttribute, useControlAttributes, useIdAttribute } from '../../hooks';
54
55
  import { LabelVariant, OrLabelV3 as OrLabel } from '../or-label-v3';
55
56
  import { OrLoaderV3 as OrLoader } from '../or-loader-v3';
56
57
  import { SwitchControl, SwitchControlHandle, SwitchLoader, SwitchLoaderHandle, SwitchRoot } from './styles';
@@ -117,13 +118,15 @@ export default defineComponent({
117
118
 
118
119
  expose: [
119
120
  'root',
121
+
122
+ 'focus',
123
+ 'blur',
120
124
  ],
121
125
 
122
126
  setup(props, context) {
123
- const currentInstance = getCurrentInstance()!;
124
-
125
127
  // Refs
126
128
  const root = ref<HTMLElement>();
129
+ const control = ref<HTMLInputElement>();
127
130
 
128
131
  // Styles
129
132
  const classAttribute = useClassAttribute();
@@ -145,7 +148,10 @@ export default defineComponent({
145
148
  ]);
146
149
 
147
150
  // State
148
- const controlId = ref(context.attrs.id as string ?? currentInstance.uid.toString());
151
+ const controlAttributes = reactive({
152
+ id: useIdAttribute(),
153
+ ...useControlAttributes(),
154
+ });
149
155
 
150
156
  const proxyModelValue = computed({
151
157
  get: () => {
@@ -158,13 +164,25 @@ export default defineComponent({
158
164
  },
159
165
  });
160
166
 
167
+ // Methods
168
+ function focus(): void {
169
+ control.value?.focus();
170
+ }
171
+
172
+ function blur(): void {
173
+ control.value?.blur();
174
+ }
175
+
161
176
  return {
162
177
  root,
178
+ control,
163
179
  rootStyles,
164
180
  controlStyles,
165
181
  loaderStyles,
166
- controlId,
182
+ controlAttributes,
167
183
  proxyModelValue,
184
+ focus,
185
+ blur,
168
186
  };
169
187
  },
170
188
  });
@@ -139,7 +139,7 @@ export default defineComponent({
139
139
 
140
140
  const activeTab = computed(() => props.items.find(({ value }) => value === proxyModelValue.value)!);
141
141
 
142
- // Functions
142
+ // Methods
143
143
  function rearrangeTabs(items: TabsItem[], activeTab: TabsItem, rootElement: Element): typeof tabs {
144
144
  const { children } = rootElement;
145
145
 
@@ -16,10 +16,6 @@ export default {
16
16
  control: { type: 'text' },
17
17
  },
18
18
 
19
- readonly: {
20
- control: { type: 'boolean' },
21
- },
22
-
23
19
  maxlength: {
24
20
  control: { type: 'number' },
25
21
  },
@@ -68,6 +64,10 @@ export default {
68
64
  control: { type: 'boolean' },
69
65
  },
70
66
 
67
+ readonly: {
68
+ control: { type: 'boolean' },
69
+ },
70
+
71
71
  disabled: {
72
72
  control: { type: 'boolean' },
73
73
  },