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