ropav 0.1.2 → 0.1.3

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 (34) hide show
  1. package/dist/accordion.css +5 -16
  2. package/dist/accordion.js +10 -24
  3. package/dist/components/accordion/index.d.ts +1 -1
  4. package/dist/components/accordion/types.d.ts +0 -4
  5. package/dist/components/dialog/dialog-core.d.ts +4 -2
  6. package/dist/components/scroll-area/index.d.ts +3 -0
  7. package/dist/components/scroll-area/index.js +3 -0
  8. package/dist/components/scroll-area/scroll-area.d.ts +42 -0
  9. package/dist/components/scroll-area/scrollAreaCore.d.ts +25 -0
  10. package/dist/components/scroll-area/types.d.ts +33 -0
  11. package/dist/components/scroll-area/useScrollArea.d.ts +54 -0
  12. package/dist/components/scroll-area/useScrollAreaControls.d.ts +21 -0
  13. package/dist/components/scroll-area/useScrollAreaMetrics.d.ts +35 -0
  14. package/dist/components/scroll-area/useScrollAreaPointer.d.ts +17 -0
  15. package/dist/components/scroll-area/useScrollAreaPresentation.d.ts +49 -0
  16. package/dist/components/scroll-area/useScrollAreaVisibility.d.ts +27 -0
  17. package/dist/components/select/useSelect.d.ts +7 -5
  18. package/dist/components/select/useSelectNativeControl.d.ts +9 -0
  19. package/dist/components/select/useSelectNativeValue.d.ts +15 -0
  20. package/dist/dialog.js +23 -6
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.js +3 -1
  23. package/dist/modal.css +28 -29
  24. package/dist/modal.js +10 -8
  25. package/dist/number-input.css +3 -6
  26. package/dist/scroll-area.css +131 -0
  27. package/dist/scroll-area.js +696 -0
  28. package/dist/scroll-area2.js +23 -0
  29. package/dist/select.css +47 -45
  30. package/dist/select.js +167 -129
  31. package/dist/tabs.css +23 -18
  32. package/dist/tabs.js +16 -14
  33. package/docs/public-styles-api.md +1 -1
  34. package/package.json +5 -1
@@ -0,0 +1,23 @@
1
+ //#region src/components/scroll-area/types.ts
2
+ var scrollAreaParts = [
3
+ "root",
4
+ "viewport",
5
+ "content",
6
+ "scrollbar",
7
+ "thumb",
8
+ "corner"
9
+ ];
10
+ var scrollAreaTypes = [
11
+ "auto",
12
+ "always",
13
+ "hover",
14
+ "scroll",
15
+ "never"
16
+ ];
17
+ var scrollAreaScrollbars = [
18
+ "x",
19
+ "y",
20
+ "both"
21
+ ];
22
+ //#endregion
23
+ export { scrollAreaScrollbars as n, scrollAreaTypes as r, scrollAreaParts as t };
package/dist/select.css CHANGED
@@ -1,5 +1,5 @@
1
1
  @layer ropav.components {
2
- .rp-select[data-v-5c4e4e6a] {
2
+ .rp-select[data-v-d7a0b110] {
3
3
  --_rp-select-height: var(--rp-size-control-md);
4
4
  --_rp-select-padding-x: calc(var(--rp-size-control-md) / 3);
5
5
  --_rp-select-font-size: var(--rp-font-size-md);
@@ -15,7 +15,7 @@
15
15
  font-weight: var(--rp-font-weight-normal);
16
16
  line-height: 1;
17
17
  }
18
- .rp-select__native[data-v-5c4e4e6a] {
18
+ .rp-select__native[data-v-d7a0b110] {
19
19
  position: absolute;
20
20
  width: 1px;
21
21
  height: 1px;
@@ -26,42 +26,42 @@
26
26
  white-space: nowrap;
27
27
  border-width: 0;
28
28
  }
29
- .rp-select--size-xs[data-v-5c4e4e6a] {
29
+ .rp-select--size-xs[data-v-d7a0b110] {
30
30
  --_rp-select-height: var(--rp-size-control-xs);
31
31
  --_rp-select-padding-x: calc(var(--rp-size-control-xs) / 3);
32
32
  --_rp-select-font-size: var(--rp-font-size-xs);
33
33
  --_rp-select-option-min-height: calc(var(--rp-size-control-xs) - var(--rp-spacing-2));
34
34
  --_rp-select-option-padding-y: calc(var(--rp-spacing-1) / 2);
35
35
  }
36
- .rp-select--size-sm[data-v-5c4e4e6a] {
36
+ .rp-select--size-sm[data-v-d7a0b110] {
37
37
  --_rp-select-height: var(--rp-size-control-sm);
38
38
  --_rp-select-padding-x: calc(var(--rp-size-control-sm) / 3);
39
39
  --_rp-select-font-size: var(--rp-font-size-sm);
40
40
  --_rp-select-option-min-height: calc(var(--rp-size-control-sm) - var(--rp-spacing-3));
41
41
  --_rp-select-option-padding-y: var(--rp-spacing-1);
42
42
  }
43
- .rp-select--size-md[data-v-5c4e4e6a] {
43
+ .rp-select--size-md[data-v-d7a0b110] {
44
44
  --_rp-select-height: var(--rp-size-control-md);
45
45
  --_rp-select-padding-x: calc(var(--rp-size-control-md) / 3);
46
46
  --_rp-select-font-size: var(--rp-font-size-md);
47
47
  --_rp-select-option-min-height: calc(var(--rp-size-control-md) - var(--rp-spacing-4));
48
48
  --_rp-select-option-padding-y: var(--rp-spacing-1);
49
49
  }
50
- .rp-select--size-lg[data-v-5c4e4e6a] {
50
+ .rp-select--size-lg[data-v-d7a0b110] {
51
51
  --_rp-select-height: var(--rp-size-control-lg);
52
52
  --_rp-select-padding-x: calc(var(--rp-size-control-lg) / 3);
53
53
  --_rp-select-font-size: var(--rp-font-size-lg);
54
54
  --_rp-select-option-min-height: calc(var(--rp-size-control-lg) - var(--rp-spacing-5));
55
55
  --_rp-select-option-padding-y: calc(var(--rp-spacing-3) / 2);
56
56
  }
57
- .rp-select--size-xl[data-v-5c4e4e6a] {
57
+ .rp-select--size-xl[data-v-d7a0b110] {
58
58
  --_rp-select-height: var(--rp-size-control-xl);
59
59
  --_rp-select-padding-x: calc(var(--rp-size-control-xl) / 3);
60
60
  --_rp-select-font-size: var(--rp-font-size-xl);
61
61
  --_rp-select-option-min-height: calc(var(--rp-size-control-xl) - var(--rp-spacing-6));
62
62
  --_rp-select-option-padding-y: var(--rp-spacing-2);
63
63
  }
64
- html.dark .rp-select[data-v-5c4e4e6a], [data-rp-color-scheme=dark] .rp-select[data-v-5c4e4e6a] {
64
+ html.dark .rp-select[data-v-d7a0b110], [data-rp-color-scheme=dark] .rp-select[data-v-d7a0b110] {
65
65
  --_rp-select-invalid-border: var(--rp-color-red-light-color);
66
66
  --_rp-select-invalid-ring: color-mix(
67
67
  in srgb,
@@ -70,11 +70,11 @@ html.dark .rp-select[data-v-5c4e4e6a], [data-rp-color-scheme=dark] .rp-select[da
70
70
  );
71
71
  --_rp-select-option-focused-bg: var(--rp-color-default-hover);
72
72
  }
73
- .rp-select--disabled[data-v-5c4e4e6a] {
73
+ .rp-select--disabled[data-v-d7a0b110] {
74
74
  opacity: var(--rp-opacity-disabled);
75
75
  cursor: not-allowed;
76
76
  }
77
- .rp-select__trigger[data-v-5c4e4e6a] {
77
+ .rp-select__trigger[data-v-d7a0b110] {
78
78
  display: inline-flex;
79
79
  align-items: center;
80
80
  justify-content: center;
@@ -91,81 +91,81 @@ html.dark .rp-select[data-v-5c4e4e6a], [data-rp-color-scheme=dark] .rp-select[da
91
91
  transition: border-color var(--rp-transition-fast), box-shadow var(--rp-transition-fast);
92
92
  gap: var(--rp-spacing-2);
93
93
  }
94
- .rp-select__trigger[data-v-5c4e4e6a]:hover {
94
+ .rp-select__trigger[data-v-d7a0b110]:hover {
95
95
  border-color: var(--rp-color-control-border-hover);
96
96
  }
97
- .rp-select__trigger[data-v-5c4e4e6a]:focus-visible {
97
+ .rp-select__trigger[data-v-d7a0b110]:focus-visible {
98
98
  outline: none;
99
99
  border-color: var(--rp-color-control-border-focus);
100
100
  box-shadow: 0 0 0 var(--rp-border-width-medium) var(--rp-color-focus-ring);
101
101
  }
102
- .rp-select--radius-xs[data-v-5c4e4e6a] {
102
+ .rp-select--radius-xs[data-v-d7a0b110] {
103
103
  --_rp-select-radius: var(--rp-radius-xs);
104
104
  }
105
- .rp-select--radius-sm[data-v-5c4e4e6a] {
105
+ .rp-select--radius-sm[data-v-d7a0b110] {
106
106
  --_rp-select-radius: var(--rp-radius-sm);
107
107
  }
108
- .rp-select--radius-md[data-v-5c4e4e6a] {
108
+ .rp-select--radius-md[data-v-d7a0b110] {
109
109
  --_rp-select-radius: var(--rp-radius-md);
110
110
  }
111
- .rp-select--radius-lg[data-v-5c4e4e6a] {
111
+ .rp-select--radius-lg[data-v-d7a0b110] {
112
112
  --_rp-select-radius: var(--rp-radius-lg);
113
113
  }
114
- .rp-select--radius-xl[data-v-5c4e4e6a] {
114
+ .rp-select--radius-xl[data-v-d7a0b110] {
115
115
  --_rp-select-radius: var(--rp-radius-xl);
116
116
  }
117
- .rp-select--open .rp-select__trigger[data-v-5c4e4e6a] {
117
+ .rp-select--open .rp-select__trigger[data-v-d7a0b110] {
118
118
  border-color: var(--rp-color-control-border-focus);
119
119
  box-shadow: 0 0 0 var(--rp-border-width-medium) var(--rp-color-focus-ring);
120
120
  }
121
- .rp-select--invalid .rp-select__trigger[data-v-5c4e4e6a] {
121
+ .rp-select--invalid .rp-select__trigger[data-v-d7a0b110] {
122
122
  border-color: var(--_rp-select-invalid-border);
123
123
  }
124
- .rp-select--invalid .rp-select__trigger[data-v-5c4e4e6a]:focus-visible, .rp-select--open.rp-select--invalid .rp-select__trigger[data-v-5c4e4e6a] {
124
+ .rp-select--invalid .rp-select__trigger[data-v-d7a0b110]:focus-visible, .rp-select--open.rp-select--invalid .rp-select__trigger[data-v-d7a0b110] {
125
125
  border-color: var(--_rp-select-invalid-border);
126
126
  box-shadow: 0 0 0 var(--rp-border-width-medium) var(--_rp-select-invalid-ring);
127
127
  }
128
- .rp-select__value[data-v-5c4e4e6a] {
128
+ .rp-select__value[data-v-d7a0b110] {
129
129
  flex: 1;
130
130
  overflow: hidden;
131
131
  text-overflow: ellipsis;
132
132
  white-space: nowrap;
133
133
  color: var(--rp-color-control-fg);
134
134
  }
135
- .rp-select__placeholder[data-v-5c4e4e6a] {
135
+ .rp-select__placeholder[data-v-d7a0b110] {
136
136
  color: var(--rp-color-control-placeholder);
137
137
  }
138
- .rp-select__indicator[data-v-5c4e4e6a] {
138
+ .rp-select__indicator[data-v-d7a0b110] {
139
139
  display: inline-flex;
140
140
  align-items: center;
141
141
  width: 1em;
142
142
  height: 1em;
143
143
  flex-shrink: 0;
144
144
  }
145
- .rp-select__indicator svg[data-v-5c4e4e6a] {
145
+ .rp-select__indicator svg[data-v-d7a0b110] {
146
146
  width: 100%;
147
147
  height: 100%;
148
148
  }
149
- .rp-select__indicator[data-v-5c4e4e6a] {
149
+ .rp-select__indicator[data-v-d7a0b110] {
150
150
  position: relative;
151
151
  color: var(--rp-color-control-icon);
152
152
  transform: translateX(var(--rp-spacing-1));
153
153
  }
154
- .rp-select__arrow[data-v-5c4e4e6a] {
154
+ .rp-select__arrow[data-v-d7a0b110] {
155
155
  display: inline-flex;
156
156
  align-items: center;
157
157
  width: 1em;
158
158
  height: 1em;
159
159
  flex-shrink: 0;
160
160
  }
161
- .rp-select__arrow svg[data-v-5c4e4e6a] {
161
+ .rp-select__arrow svg[data-v-d7a0b110] {
162
162
  width: 100%;
163
163
  height: 100%;
164
164
  }
165
- .rp-select__arrow[data-v-5c4e4e6a] {
165
+ .rp-select__arrow[data-v-d7a0b110] {
166
166
  transition: opacity var(--rp-transition-fast);
167
167
  }
168
- .rp-select__clear[data-v-5c4e4e6a] {
168
+ .rp-select__clear[data-v-d7a0b110] {
169
169
  padding: 0;
170
170
  font: inherit;
171
171
  background: none;
@@ -177,11 +177,11 @@ html.dark .rp-select[data-v-5c4e4e6a], [data-rp-color-scheme=dark] .rp-select[da
177
177
  height: 1em;
178
178
  flex-shrink: 0;
179
179
  }
180
- .rp-select__clear svg[data-v-5c4e4e6a] {
180
+ .rp-select__clear svg[data-v-d7a0b110] {
181
181
  width: 100%;
182
182
  height: 100%;
183
183
  }
184
- .rp-select__clear[data-v-5c4e4e6a] {
184
+ .rp-select__clear[data-v-d7a0b110] {
185
185
  position: absolute;
186
186
  inset: 0;
187
187
  z-index: 1;
@@ -190,17 +190,17 @@ html.dark .rp-select[data-v-5c4e4e6a], [data-rp-color-scheme=dark] .rp-select[da
190
190
  pointer-events: none;
191
191
  transition: color var(--rp-transition-fast), opacity var(--rp-transition-fast);
192
192
  }
193
- .rp-select__clear[data-v-5c4e4e6a]:hover {
193
+ .rp-select__clear[data-v-d7a0b110]:hover {
194
194
  color: var(--rp-color-control-fg);
195
195
  }
196
- .rp-select__trigger:hover .rp-select__clear[data-v-5c4e4e6a] {
196
+ .rp-select__trigger:hover .rp-select__clear[data-v-d7a0b110] {
197
197
  opacity: 1;
198
198
  pointer-events: auto;
199
199
  }
200
- .rp-select__trigger:hover .rp-select__clear + .rp-select__arrow[data-v-5c4e4e6a] {
200
+ .rp-select__trigger:hover .rp-select__clear + .rp-select__arrow[data-v-d7a0b110] {
201
201
  opacity: 0;
202
202
  }
203
- .rp-select__dropdown[data-v-5c4e4e6a] {
203
+ .rp-select__dropdown[data-v-d7a0b110] {
204
204
  position: absolute;
205
205
  top: calc(100% + var(--rp-spacing-2));
206
206
  left: 0;
@@ -212,10 +212,12 @@ html.dark .rp-select[data-v-5c4e4e6a], [data-rp-color-scheme=dark] .rp-select[da
212
212
  box-shadow: var(--rp-shadow-md);
213
213
  padding: var(--rp-spacing-1) 0;
214
214
  max-height: 240px;
215
- overflow-y: auto;
216
215
  padding: var(--rp-spacing-1);
217
216
  }
218
- .rp-select__option[data-v-5c4e4e6a] {
217
+ .rp-select__dropdown[data-v-d7a0b110] .rp-scroll-area__viewport {
218
+ scroll-padding-block: var(--rp-spacing-1);
219
+ }
220
+ .rp-select__option[data-v-d7a0b110] {
219
221
  display: flex;
220
222
  align-items: center;
221
223
  min-height: var(--_rp-select-option-min-height);
@@ -226,17 +228,17 @@ html.dark .rp-select[data-v-5c4e4e6a], [data-rp-color-scheme=dark] .rp-select[da
226
228
  transition: color var(--rp-transition-fast);
227
229
  color: var(--rp-color-control-fg);
228
230
  }
229
- .rp-select__option--focused[data-v-5c4e4e6a] {
231
+ .rp-select__option--focused[data-v-d7a0b110] {
230
232
  background-color: var(--_rp-select-option-focused-bg);
231
233
  }
232
- .rp-select__option--selected[data-v-5c4e4e6a] {
234
+ .rp-select__option--selected[data-v-d7a0b110] {
233
235
  color: var(--rp-primary-color-light-color);
234
236
  }
235
- .rp-select__option--disabled[data-v-5c4e4e6a] {
237
+ .rp-select__option--disabled[data-v-d7a0b110] {
236
238
  color: var(--rp-color-disabled-color);
237
239
  cursor: not-allowed;
238
240
  }
239
- .rp-select__empty[data-v-5c4e4e6a] {
241
+ .rp-select__empty[data-v-d7a0b110] {
240
242
  display: flex;
241
243
  align-items: center;
242
244
  justify-content: center;
@@ -244,12 +246,12 @@ html.dark .rp-select[data-v-5c4e4e6a], [data-rp-color-scheme=dark] .rp-select[da
244
246
  color: var(--rp-color-dimmed);
245
247
  font-size: var(--_rp-select-font-size);
246
248
  }
247
- .rp-select-dropdown-enter-active[data-v-5c4e4e6a],
248
- .rp-select-dropdown-leave-active[data-v-5c4e4e6a] {
249
+ .rp-select-dropdown-enter-active[data-v-d7a0b110],
250
+ .rp-select-dropdown-leave-active[data-v-d7a0b110] {
249
251
  transition: opacity var(--rp-transition-fast), transform var(--rp-transition-fast);
250
252
  }
251
- .rp-select-dropdown-enter-from[data-v-5c4e4e6a],
252
- .rp-select-dropdown-leave-to[data-v-5c4e4e6a] {
253
+ .rp-select-dropdown-enter-from[data-v-d7a0b110],
254
+ .rp-select-dropdown-leave-to[data-v-d7a0b110] {
253
255
  opacity: 0;
254
256
  transform: translateY(calc(-1 * var(--rp-spacing-1)));
255
257
  }
package/dist/select.js CHANGED
@@ -5,6 +5,7 @@ import { n as useStylesApi, t as presence } from "./styles-api.js";
5
5
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
6
6
  import { i as useFormControl, o as useControllableValue } from "./useFormControl.js";
7
7
  import { t as useControlState } from "./useControlState.js";
8
+ import { t as scroll_area_default } from "./scroll-area.js";
8
9
  import { VaporTransition, child, computed, createComponent, createFor, createIf, createInvoker, createSlot, createTemplateRefSetter, defineVaporComponent, delegateEvents, extend, markRaw, next, nextTick, on, onBeforeUnmount, onMounted, ref, renderEffect, setDynamicProps, setInsertionState, setProp, setText, setValue, template, toDisplayString, txt, unref, useId, watch, watchEffect, withModifiers, withVaporModifiers } from "vue";
9
10
  //#region ~icons/lucide/chevrons-up-down
10
11
  var t0$1 = template("<svg viewBox=\"0 0 24 24\"width=1.2em height=1.2em><path fill=none stroke=currentColor stroke-linecap=round stroke-linejoin=round stroke-width=2 d=\"m7 15l5 5l5-5M7 9l5-5l5 5\">", 3, 1);
@@ -111,9 +112,8 @@ function getSelectDisplayLabel(options, value) {
111
112
  function getSelectActiveDescendantId(baseId, focusedIndex) {
112
113
  return focusedIndex < 0 ? void 0 : `${baseId}-option-${focusedIndex}`;
113
114
  }
114
- function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null) {
115
+ function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null, triggerRef = ref(null)) {
115
116
  const selectRef = ref(null);
116
- const triggerRef = ref(null);
117
117
  const isOpen = ref(false);
118
118
  const selectId = useId();
119
119
  const listboxId = `${selectId}-listbox`;
@@ -170,6 +170,11 @@ function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null)
170
170
  function onOptionMouseenter(option, index) {
171
171
  if (!option.disabled) focusedIndex.value = index;
172
172
  }
173
+ function onFocusout(event) {
174
+ const nextTarget = event.relatedTarget;
175
+ if (nextTarget instanceof Node && selectRef.value?.contains(nextTarget)) return;
176
+ close();
177
+ }
173
178
  function selectFocusedOption() {
174
179
  if (focusedIndex.value < 0 || focusedIndex.value >= visibleOptions.value.length) return;
175
180
  selectOption(visibleOptions.value[focusedIndex.value]);
@@ -225,6 +230,13 @@ function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null)
225
230
  break;
226
231
  }
227
232
  }
233
+ watch(focusedIndex, (index) => {
234
+ if (!isOpen.value || index < 0) return;
235
+ nextTick(() => {
236
+ if (!isOpen.value || focusedIndex.value !== index) return;
237
+ selectRef.value?.querySelector(`[id="${selectId}-option-${index}"]`)?.scrollIntoView?.({ block: "nearest" });
238
+ });
239
+ });
228
240
  useClickOutside(selectRef, isOpen, close);
229
241
  return {
230
242
  selectRef,
@@ -245,17 +257,112 @@ function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null)
245
257
  selectOption,
246
258
  clearSelection,
247
259
  onOptionMouseenter,
260
+ onFocusout,
248
261
  onTriggerKeydown
249
262
  };
250
263
  }
251
264
  //#endregion
265
+ //#region src/components/select/useSelectNativeValue.ts
266
+ function useSelectNativeValue(props, emitUpdate) {
267
+ const nativeSelectRef = ref(null);
268
+ const controllable = useControllableValue({
269
+ modelValue: () => props.modelValue,
270
+ defaultValue: () => props.defaultValue ?? null,
271
+ onChange: emitUpdate
272
+ });
273
+ function getNativeValue(select) {
274
+ if (select.selectedIndex <= 0) return null;
275
+ return props.options?.[select.selectedIndex - 1]?.value ?? null;
276
+ }
277
+ function syncNativeSelection(value) {
278
+ const select = nativeSelectRef.value;
279
+ if (!select) return;
280
+ select.selectedIndex = (props.options?.findIndex((option) => option.value === value) ?? -1) + 1;
281
+ }
282
+ function syncNativeDefaultSelection() {
283
+ const select = nativeSelectRef.value;
284
+ if (!select) return;
285
+ const optionIndex = props.options?.findIndex((option) => option.value === controllable.initialValue) ?? -1;
286
+ for (const [index, option] of [...select.options].entries()) option.defaultSelected = index === optionIndex + 1;
287
+ }
288
+ function requestValueUpdate(value) {
289
+ const select = nativeSelectRef.value;
290
+ if (!select) {
291
+ controllable.setValue(value);
292
+ return;
293
+ }
294
+ syncNativeSelection(value);
295
+ select.dispatchEvent(new Event("input", {
296
+ bubbles: true,
297
+ cancelable: true
298
+ }));
299
+ select.dispatchEvent(new Event("change", {
300
+ bubbles: true,
301
+ cancelable: true
302
+ }));
303
+ if (controllable.isControlled.value) queueMicrotask(() => syncNativeSelection(controllable.value.value));
304
+ }
305
+ watchEffect(syncNativeDefaultSelection, { flush: "post" });
306
+ watchEffect(() => syncNativeSelection(controllable.value.value), { flush: "post" });
307
+ return {
308
+ nativeSelectRef,
309
+ controllable,
310
+ getNativeValue,
311
+ syncNativeSelection,
312
+ requestValueUpdate
313
+ };
314
+ }
315
+ //#endregion
316
+ //#region src/components/select/useSelectNativeControl.ts
317
+ function useSelectNativeControl(props, emitUpdate, triggerRef) {
318
+ const nativeValue = useSelectNativeValue(props, emitUpdate);
319
+ const { nativeSelectRef, controllable, getNativeValue, syncNativeSelection } = nativeValue;
320
+ useFormControl({
321
+ elements: () => [nativeSelectRef.value],
322
+ isControlled: () => controllable.isControlled.value,
323
+ validationMessage: () => props.validationMessage,
324
+ readResetValue(elements) {
325
+ controllable.resetValue(getNativeValue(elements[0]));
326
+ },
327
+ syncControlledValue() {
328
+ syncNativeSelection(controllable.value.value);
329
+ }
330
+ });
331
+ const nativeInputAttrs = computed(() => {
332
+ const { class: compatibilityClass, style: compatibilityStyle, onInput: compatibilityOnInput, onChange: compatibilityOnChange, onInvalid: compatibilityOnInvalid, ...attrs } = props.inputAttrs ?? {};
333
+ return {
334
+ ...attrs,
335
+ class: ["rp-select__native", compatibilityClass],
336
+ style: compatibilityStyle,
337
+ onInput(event) {
338
+ controllable.setValue(getNativeValue(event.currentTarget));
339
+ compatibilityOnInput?.(event);
340
+ },
341
+ onChange(event) {
342
+ compatibilityOnChange?.(event);
343
+ },
344
+ onInvalid(event) {
345
+ event.preventDefault();
346
+ triggerRef.value?.focus();
347
+ compatibilityOnInvalid?.(event);
348
+ }
349
+ };
350
+ });
351
+ return {
352
+ nativeSelectRef,
353
+ selectedValue: controllable.value,
354
+ nativeInputAttrs,
355
+ requestValueUpdate: nativeValue.requestValueUpdate
356
+ };
357
+ }
358
+ //#endregion
252
359
  //#region src/components/select/select.vue?vue&type=script&setup=true&vapor=true&lang.ts
253
- var t0 = template("<option data-v-5c4e4e6a> ");
254
- var t1 = template("<button data-v-5c4e4e6a></button>");
360
+ var t0 = template("<option data-v-d7a0b110> ");
361
+ var t1 = template("<button data-v-d7a0b110></button>");
255
362
  var t2 = template("No options", 2);
256
- var t3 = template("<div data-v-5c4e4e6a>");
257
- var t4 = template("<div data-v-5c4e4e6a> ");
258
- var t5 = template("<div data-v-5c4e4e6a><select data-v-5c4e4e6a><option data-v-5c4e4e6a value></option></select><div data-v-5c4e4e6a><span data-v-5c4e4e6a> </span><span data-v-5c4e4e6a><span data-v-5c4e4e6a class=rp-select__arrow aria-hidden=true>", 1);
363
+ var t3 = template("<div data-v-d7a0b110>");
364
+ var t4 = template("<div data-v-d7a0b110> ");
365
+ var t5 = template("<div data-v-d7a0b110><select data-v-d7a0b110><option data-v-d7a0b110 value></option></select><div data-v-d7a0b110><span data-v-d7a0b110> </span><span data-v-d7a0b110><span data-v-d7a0b110 class=rp-select__arrow aria-hidden=true>", 1);
259
366
  delegateEvents("mousedown", "click", "keydown");
260
367
  //#endregion
261
368
  //#region src/components/select/select.vue
@@ -302,81 +409,13 @@ var select_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
302
409
  setup(__props, { expose: __expose, emit: __emit }) {
303
410
  const props = __props;
304
411
  const emit = __emit;
305
- const nativeSelectRef = ref(null);
306
- const controllable = useControllableValue({
307
- modelValue: () => props.modelValue,
308
- defaultValue: () => props.defaultValue,
309
- onChange: (value) => emit("update:modelValue", value)
310
- });
311
- function getNativeValue(select) {
312
- if (select.selectedIndex <= 0) return null;
313
- return props.options?.[select.selectedIndex - 1]?.value ?? null;
314
- }
315
- function syncNativeSelection(value) {
316
- const select = nativeSelectRef.value;
317
- if (!select) return;
318
- select.selectedIndex = (props.options?.findIndex((option) => option.value === value) ?? -1) + 1;
319
- }
320
- function syncNativeDefaultSelection() {
321
- const select = nativeSelectRef.value;
322
- if (!select) return;
323
- const optionIndex = props.options?.findIndex((option) => option.value === controllable.initialValue) ?? -1;
324
- for (const [index, option] of [...select.options].entries()) option.defaultSelected = index === optionIndex + 1;
325
- }
326
- function requestValueUpdate(value) {
327
- const select = nativeSelectRef.value;
328
- if (!select) {
329
- controllable.setValue(value);
330
- return;
331
- }
332
- syncNativeSelection(value);
333
- select.dispatchEvent(new Event("input", {
334
- bubbles: true,
335
- cancelable: true
336
- }));
337
- select.dispatchEvent(new Event("change", {
338
- bubbles: true,
339
- cancelable: true
340
- }));
341
- if (controllable.isControlled.value) queueMicrotask(() => syncNativeSelection(controllable.value.value));
342
- }
343
- const { selectRef, triggerRef, isOpen, selectId, listboxId, control, visibleOptions, focusedIndex, activeDescendantId, rootClass, hasValue, displayLabel, canClear, toggle, selectOption, clearSelection, onOptionMouseenter, onTriggerKeydown } = useSelect(props, requestValueUpdate, () => controllable.value.value);
344
- useFormControl({
345
- elements: () => [nativeSelectRef.value],
346
- isControlled: () => controllable.isControlled.value,
347
- validationMessage: () => props.validationMessage,
348
- readResetValue(elements) {
349
- controllable.resetValue(getNativeValue(elements[0]));
350
- },
351
- syncControlledValue() {
352
- syncNativeSelection(controllable.value.value);
353
- }
354
- });
355
- watchEffect(syncNativeDefaultSelection, { flush: "post" });
356
- watchEffect(() => syncNativeSelection(controllable.value.value), { flush: "post" });
357
- const nativeInputAttrs = computed(() => {
358
- const { class: compatibilityClass, style: compatibilityStyle, onInput: compatibilityOnInput, onChange: compatibilityOnChange, onInvalid: compatibilityOnInvalid, ...attrs } = props.inputAttrs ?? {};
359
- return {
360
- ...attrs,
361
- class: ["rp-select__native", compatibilityClass],
362
- style: compatibilityStyle,
363
- onInput(event) {
364
- controllable.setValue(getNativeValue(event.currentTarget));
365
- compatibilityOnInput?.(event);
366
- },
367
- onChange(event) {
368
- compatibilityOnChange?.(event);
369
- },
370
- onInvalid(event) {
371
- event.preventDefault();
372
- triggerRef.value?.focus();
373
- compatibilityOnInvalid?.(event);
374
- }
375
- };
376
- });
412
+ const triggerRef = ref(null);
413
+ const { nativeSelectRef, selectedValue, nativeInputAttrs, requestValueUpdate } = useSelectNativeControl(props, (value) => emit("update:modelValue", value), triggerRef);
414
+ const { selectRef, isOpen, selectId, listboxId, control, visibleOptions, focusedIndex, activeDescendantId, rootClass, hasValue, displayLabel, canClear, toggle, selectOption, clearSelection, onOptionMouseenter, onFocusout, onTriggerKeydown } = useSelect(props, requestValueUpdate, () => selectedValue.value, triggerRef);
377
415
  const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
378
416
  const rootAttrs = computed(() => getRootAttrs({
379
417
  class: rootClass.value,
418
+ onFocusout,
380
419
  "data-state": isOpen.value ? "open" : "closed",
381
420
  "data-disabled": presence(control.disabled),
382
421
  "data-invalid": presence(control.invalid)
@@ -393,7 +432,7 @@ var select_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
393
432
  const n11 = next(n4, 1);
394
433
  const n10 = child(n11, 1);
395
434
  renderEffect(() => {
396
- const _nativeInputAttrs = nativeInputAttrs.value;
435
+ const _nativeInputAttrs = unref(nativeInputAttrs);
397
436
  const _control = unref(control);
398
437
  setDynamicProps(n26, [rootAttrs.value]);
399
438
  setDynamicProps(n3, [_nativeInputAttrs, {
@@ -474,61 +513,60 @@ var select_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
474
513
  setInsertionState(n26, null, 2);
475
514
  createComponent(VaporTransition, { name: "rp-select-dropdown" }, extend(() => {
476
515
  return createIf(() => unref(isOpen), () => {
477
- const n24 = t3();
478
- renderEffect(() => setDynamicProps(n24, [unref(getPartAttrs)("content", { class: "rp-select__dropdown" }), {
516
+ return createComponent(scroll_area_default, { $: [() => unref(getPartAttrs)("content", { class: "rp-select__dropdown" }), {
479
517
  role: "listbox",
480
- id: unref(listboxId),
481
- "data-state": unref(isOpen) ? "open" : "closed"
482
- }]));
483
- setInsertionState(n24, null, 0);
484
- createIf(() => unref(visibleOptions).length === 0, () => {
485
- const n20 = t3();
486
- renderEffect(() => setDynamicProps(n20, [unref(getPartAttrs)("empty", { class: "rp-select__empty" })]));
487
- setInsertionState(n20, null, 0);
488
- createSlot("empty", null, () => {
489
- return t2();
490
- }, 1);
491
- return n20;
492
- });
493
- setInsertionState(n24, null, 1);
494
- createFor(() => unref(visibleOptions), (_for_item0, _for_key0) => {
495
- const n23 = t4();
496
- const x23 = txt(n23);
497
- n23.$evtclick = createInvoker(() => unref(selectOption)(_for_item0.value));
498
- on(n23, "mouseenter", () => unref(onOptionMouseenter)(_for_item0.value, _for_key0.value));
499
- renderEffect(() => {
500
- const _index = _for_key0.value;
501
- const _option = _for_item0.value;
502
- const _controllable = unref(controllable);
503
- const _presence = unref(presence);
504
- const _focusedIndex = unref(focusedIndex);
505
- const _option_value = _option.value;
506
- const _controllable_value = _controllable.value;
507
- const _option_disabled = _option.disabled;
508
- setDynamicProps(n23, [{
509
- role: "option",
510
- id: `${unref(selectId)}-option-${_index}`,
511
- "aria-selected": _option_value === _controllable_value.value,
512
- "aria-disabled": _option_disabled || void 0,
513
- "data-selected": _presence(_option_value === _controllable_value.value),
514
- "data-highlighted": _presence(_index === _focusedIndex),
515
- "data-disabled": _presence(_option.disabled)
516
- }, unref(getPartAttrs)("option", { class: ["rp-select__option", {
517
- "rp-select__option--selected": _option_value === _controllable_value.value,
518
- "rp-select__option--focused": _index === _focusedIndex,
519
- "rp-select__option--disabled": _option_disabled
520
- }] })]);
521
- setText(x23, toDisplayString(_option.label));
522
- });
523
- return n23;
524
- }, (option, index) => option.value, 8);
525
- return n24;
518
+ id: () => unref(listboxId),
519
+ embedded: "",
520
+ type: "auto",
521
+ scrollbars: "y",
522
+ "viewport-attrs": () => ({ tabindex: -1 }),
523
+ "data-state": () => unref(isOpen) ? "open" : "closed"
524
+ }] }, extend(() => {
525
+ return [createIf(() => unref(visibleOptions).length === 0, () => {
526
+ const n20 = t3();
527
+ renderEffect(() => setDynamicProps(n20, [unref(getPartAttrs)("empty", { class: "rp-select__empty" })]));
528
+ setInsertionState(n20, null, 0);
529
+ createSlot("empty", null, () => {
530
+ return t2();
531
+ }, 1);
532
+ return n20;
533
+ }, null, 129), createFor(() => unref(visibleOptions), (_for_item0, _for_key0) => {
534
+ const n23 = t4();
535
+ const x23 = txt(n23);
536
+ n23.$evtclick = createInvoker(() => unref(selectOption)(_for_item0.value));
537
+ on(n23, "mouseenter", () => unref(onOptionMouseenter)(_for_item0.value, _for_key0.value));
538
+ renderEffect(() => {
539
+ const _index = _for_key0.value;
540
+ const _option = _for_item0.value;
541
+ const _selectedValue = unref(selectedValue);
542
+ const _presence = unref(presence);
543
+ const _focusedIndex = unref(focusedIndex);
544
+ const _option_value = _option.value;
545
+ const _option_disabled = _option.disabled;
546
+ setDynamicProps(n23, [{
547
+ role: "option",
548
+ id: `${unref(selectId)}-option-${_index}`,
549
+ "aria-selected": _option_value === _selectedValue,
550
+ "aria-disabled": _option_disabled || void 0,
551
+ "data-selected": _presence(_option_value === _selectedValue),
552
+ "data-highlighted": _presence(_index === _focusedIndex),
553
+ "data-disabled": _presence(_option.disabled)
554
+ }, unref(getPartAttrs)("option", { class: ["rp-select__option", {
555
+ "rp-select__option--selected": _option_value === _selectedValue,
556
+ "rp-select__option--focused": _index === _focusedIndex,
557
+ "rp-select__option--disabled": _option_disabled
558
+ }] })]);
559
+ setText(x23, toDisplayString(_option.label));
560
+ });
561
+ return n23;
562
+ }, (option, index) => option.value, 40)];
563
+ }, { _: 8 }));
526
564
  }, null, 129);
527
565
  }, { _: 8 }));
528
566
  _setTemplateRef(n26, selectRef, null, "selectRef");
529
567
  return n26;
530
568
  }
531
- }), [["__scopeId", "data-v-5c4e4e6a"]]);
569
+ }), [["__scopeId", "data-v-d7a0b110"]]);
532
570
  //#endregion
533
571
  //#region src/components/select/types.ts
534
572
  var selectParts = [