ropav 0.1.7 → 0.1.8

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 (153) hide show
  1. package/README.md +1 -1
  2. package/dist/ancestry.js +136 -0
  3. package/dist/calendar.css +173 -0
  4. package/dist/calendar.js +714 -0
  5. package/dist/calendar2.js +37 -0
  6. package/dist/chevron-left.js +12 -0
  7. package/dist/color-picker.js +38 -88
  8. package/dist/combobox.css +251 -0
  9. package/dist/combobox.js +410 -0
  10. package/dist/components/calendar/calendar.d.ts +30 -0
  11. package/dist/components/calendar/calendarBehavior.d.ts +49 -0
  12. package/dist/components/calendar/index.d.ts +3 -0
  13. package/dist/components/calendar/index.js +3 -0
  14. package/dist/components/calendar/types.d.ts +53 -0
  15. package/dist/components/calendar/useCalendar.d.ts +24 -0
  16. package/dist/components/color-picker/useColorPickerDrag.d.ts +1 -1
  17. package/dist/components/color-picker/useColorPickerSaturation.d.ts +1 -1
  18. package/dist/components/color-picker/useColorPickerSlider.d.ts +1 -1
  19. package/dist/components/combobox/combobox.d.ts +29 -0
  20. package/dist/components/combobox/comboboxModel.d.ts +4 -0
  21. package/dist/components/combobox/index.d.ts +3 -0
  22. package/dist/components/combobox/index.js +2 -0
  23. package/dist/components/combobox/types.d.ts +43 -0
  24. package/dist/components/combobox/useCombobox.d.ts +45 -0
  25. package/dist/components/date-picker/date-picker.d.ts +33 -0
  26. package/dist/components/date-picker/datePickerModel.d.ts +10 -0
  27. package/dist/components/date-picker/index.d.ts +4 -0
  28. package/dist/components/date-picker/index.js +2 -0
  29. package/dist/components/date-picker/types.d.ts +57 -0
  30. package/dist/components/date-picker/useDatePicker.d.ts +29 -0
  31. package/dist/components/date-picker/useDatePickerValueState.d.ts +21 -0
  32. package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +2 -2
  33. package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +2 -2
  34. package/dist/components/dropdown-menu/dropdown-menu.d.ts +2 -2
  35. package/dist/components/dropdown-menu/dropdownMenuContext.d.ts +7 -18
  36. package/dist/components/dropdown-menu/dropdownMenuInteraction.d.ts +3 -3
  37. package/dist/components/dropdown-menu/dropdownMenuInteractionTypes.d.ts +58 -29
  38. package/dist/components/dropdown-menu/useDropdownMenuDataController.d.ts +4 -3
  39. package/dist/components/dropdown-menu/useDropdownMenuDataRegistration.d.ts +6 -4
  40. package/dist/components/dropdown-menu/useDropdownMenuPresentation.d.ts +3 -4
  41. package/dist/components/dropdown-menu/useDropdownMenuTargetBindings.d.ts +5 -5
  42. package/dist/components/dropzone/dropzone.d.ts +31 -0
  43. package/dist/components/dropzone/dropzoneModel.d.ts +16 -0
  44. package/dist/components/dropzone/index.d.ts +3 -0
  45. package/dist/components/dropzone/index.js +2 -0
  46. package/dist/components/dropzone/types.d.ts +56 -0
  47. package/dist/components/dropzone/useDropzone.d.ts +25 -0
  48. package/dist/components/file-input/file-input.d.ts +29 -0
  49. package/dist/components/file-input/index.d.ts +3 -0
  50. package/dist/components/file-input/index.js +2 -0
  51. package/dist/components/file-input/types.d.ts +37 -0
  52. package/dist/components/file-input/useFileInput.d.ts +15 -0
  53. package/dist/components/floating/index.js +1 -1
  54. package/dist/components/floating/useFloatingPosition.d.ts +1 -13
  55. package/dist/components/floating/useFloatingTargetLifecycle.d.ts +32 -0
  56. package/dist/components/floating/useHoverDisclosure.d.ts +10 -0
  57. package/dist/components/hover-card/hover-card.d.ts +25 -0
  58. package/dist/components/hover-card/index.d.ts +3 -0
  59. package/dist/components/hover-card/index.js +2 -0
  60. package/dist/components/hover-card/types.d.ts +45 -0
  61. package/dist/components/hover-card/useHoverCard.d.ts +22 -0
  62. package/dist/components/hover-card/useHoverCardDisclosure.d.ts +19 -0
  63. package/dist/components/multi-select/index.d.ts +3 -0
  64. package/dist/components/multi-select/index.js +2 -0
  65. package/dist/components/multi-select/multi-select.d.ts +30 -0
  66. package/dist/components/multi-select/multiSelectModel.d.ts +3 -0
  67. package/dist/components/multi-select/types.d.ts +49 -0
  68. package/dist/components/multi-select/useMultiSelect.d.ts +46 -0
  69. package/dist/components/number-input/useNumberInput.d.ts +1 -3
  70. package/dist/components/popover/usePopoverBindings.d.ts +3 -6
  71. package/dist/components/scroll-area/useScrollArea.d.ts +4 -4
  72. package/dist/components/scroll-area/useScrollAreaAttributes.d.ts +3 -3
  73. package/dist/components/scroll-area/useScrollAreaPointer.d.ts +1 -1
  74. package/dist/components/segmented-control/index.d.ts +3 -0
  75. package/dist/components/segmented-control/index.js +2 -0
  76. package/dist/components/segmented-control/segmented-control.d.ts +26 -0
  77. package/dist/components/segmented-control/types.d.ts +47 -0
  78. package/dist/components/segmented-control/useSegmentedControl.d.ts +15 -0
  79. package/dist/components/select/useSelect.d.ts +31 -19
  80. package/dist/components/slider/useRangeSlider.d.ts +1 -1
  81. package/dist/components/slider/useRangeSliderPointer.d.ts +1 -1
  82. package/dist/components/tags-input/index.d.ts +3 -0
  83. package/dist/components/tags-input/index.js +2 -0
  84. package/dist/components/tags-input/tags-input.d.ts +27 -0
  85. package/dist/components/tags-input/tagsInputModel.d.ts +12 -0
  86. package/dist/components/tags-input/types.d.ts +37 -0
  87. package/dist/components/tags-input/useTagsInput.d.ts +23 -0
  88. package/dist/components/tooltip/useTooltipTargetBindings.d.ts +12 -0
  89. package/dist/date-picker.css +49 -0
  90. package/dist/date-picker.js +809 -0
  91. package/dist/dialog.js +9 -20
  92. package/dist/direction.js +6 -0
  93. package/dist/dropdown-menu.css +21 -3
  94. package/dist/dropdown-menu.js +341 -261
  95. package/dist/dropzone.css +135 -0
  96. package/dist/dropzone.js +431 -0
  97. package/dist/file-input.css +135 -0
  98. package/dist/file-input.js +198 -0
  99. package/dist/hover-card.css +80 -0
  100. package/dist/hover-card.js +402 -0
  101. package/dist/index.d.ts +9 -0
  102. package/dist/index.js +14 -3
  103. package/dist/internal/composables/useOverlayLayer.d.ts +12 -0
  104. package/dist/modal.js +1 -1
  105. package/dist/multi-select.css +316 -0
  106. package/dist/multi-select.js +481 -0
  107. package/dist/nativeChoice.js +169 -0
  108. package/dist/number-input.css +18 -18
  109. package/dist/number-input.js +36 -38
  110. package/dist/pagination.js +1 -10
  111. package/dist/pointerSession.js +130 -0
  112. package/dist/popover.css +21 -3
  113. package/dist/popover.js +37 -62
  114. package/dist/scroll-area.js +52 -62
  115. package/dist/segmented-control.css +176 -0
  116. package/dist/segmented-control.js +382 -0
  117. package/dist/select.css +50 -48
  118. package/dist/select.js +121 -271
  119. package/dist/slider.js +70 -129
  120. package/dist/tags-input.css +197 -0
  121. package/dist/tags-input.js +380 -0
  122. package/dist/tooltip.js +35 -30
  123. package/dist/useEditableOptionList.js +216 -0
  124. package/dist/useFlatOptionCollection.js +134 -0
  125. package/dist/useFloatingPosition.js +4 -160
  126. package/dist/useFloatingTargetLifecycle.js +127 -0
  127. package/dist/useFormControl.js +1 -0
  128. package/dist/{floating.js → useHoverDisclosure.js} +338 -421
  129. package/dist/useNativeChoiceTransaction.js +46 -0
  130. package/dist/useNativeFileSelection.js +86 -0
  131. package/dist/useOverlayZIndex.js +246 -15
  132. package/dist/utils/date.d.ts +13 -0
  133. package/dist/utils/dateAvailability.d.ts +7 -0
  134. package/dist/utils/dom/ancestry.d.ts +1 -0
  135. package/dist/utils/dom/direction.d.ts +2 -0
  136. package/dist/utils/dom/files.d.ts +3 -0
  137. package/dist/utils/dom/nativeChoice.d.ts +17 -0
  138. package/dist/utils/dom/pointerSession.d.ts +20 -0
  139. package/dist/utils/dom/scroll.d.ts +2 -1
  140. package/dist/utils/optionFilter.d.ts +5 -0
  141. package/docs/public-floating-api.md +7 -4
  142. package/docs/public-styles-api.md +25 -12
  143. package/package.json +39 -3
  144. package/src/styles/_mixins.scss +26 -0
  145. package/src/styles/styles-manifest.json +1 -2
  146. package/dist/components/floating/hoverDisclosureInteractionModel.d.ts +0 -42
  147. package/dist/components/floating/useHoverDisclosureInteractions.d.ts +0 -32
  148. package/dist/components/floating/useHoverDisclosureOpenState.d.ts +0 -25
  149. package/dist/components/floating/useHoverDisclosureTargetBinding.d.ts +0 -27
  150. package/dist/components/select/useSelectNativeControl.d.ts +0 -9
  151. package/dist/components/select/useSelectNativeValue.d.ts +0 -9
  152. package/dist/pointer.js +0 -9
  153. package/dist/utils/dom/pointer.d.ts +0 -2
package/dist/select.js CHANGED
@@ -1,124 +1,18 @@
1
1
  import './select.css';
2
- import { t as useControllableValue } from "./useControllableValue.js";
3
2
  import { t as useStylesApi } from "./styles-api.js";
4
3
  import { n as toPresenceAttribute } from "./attributes.js";
5
4
  import { t as bem } from "./bem.js";
6
- import { n as getNextEnabledIndex, t as getEnabledIndexes } from "./collectionNavigation.js";
7
5
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
8
6
  import { t as x_default } from "./x.js";
9
- import { i as useFormControl } from "./useFormControl.js";
10
- import { o as splitCompatibilityAttributes, t as composeEventHandlers } from "./attributes2.js";
11
7
  import { t as useControlState } from "./useControlState.js";
12
- import { i as isNodeWithinElement, n as isEventWithinElement } from "./events.js";
13
- import { t as useTypeahead } from "./useTypeahead.js";
8
+ import { t as resolveHTMLElementRef } from "./componentRef.js";
9
+ import { i as isNodeWithinElement } from "./events.js";
10
+ import { t as useFloatingPosition } from "./useFloatingPosition.js";
11
+ import { n as useClickOutside, r as chevrons_up_down_default, t as useFlatOptionCollection } from "./useFlatOptionCollection.js";
14
12
  import { t as scroll_area_default } from "./scroll-area.js";
15
- import { VaporTransition, child, computed, createComponent, createFor, createIf, createSlot, createTemplateRefSetter, defineVaporComponent, extend, markRaw, next, nextTick, on, onBeforeUnmount, onMounted, ref, renderEffect, setDynamicProps, setInsertionState, setProp, setTemplateRefBinding, setText, setValue, shallowRef, template, toDisplayString, txt, unref, useId, watch, watchEffect, withModifiers } from "vue";
16
- //#region ~icons/lucide/chevrons-up-down
17
- 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);
18
- function render(_ctx) {
19
- return t0$1();
20
- }
21
- var chevrons_up_down_default = markRaw(defineVaporComponent({
22
- name: "lucide-chevrons-up-down",
23
- render
24
- }));
25
- //#endregion
26
- //#region src/internal/composables/useClickOutside.ts
27
- function useClickOutside(target, active, callback) {
28
- const targets = Array.isArray(target) ? target : [target];
29
- const listeningDocuments = /* @__PURE__ */ new Set();
30
- let stopWatch;
31
- function handler(event) {
32
- if (!targets.some((current) => {
33
- const element = current.value;
34
- return element ? isEventWithinElement(event, element) : false;
35
- })) callback(event);
36
- }
37
- function detachListeners() {
38
- for (const document of listeningDocuments) document.removeEventListener("click", handler, true);
39
- listeningDocuments.clear();
40
- }
41
- function syncListeners() {
42
- detachListeners();
43
- if (!active.value) return;
44
- for (const current of targets) {
45
- const document = current.value?.ownerDocument;
46
- if (!document || listeningDocuments.has(document)) continue;
47
- document.addEventListener("click", handler, true);
48
- listeningDocuments.add(document);
49
- }
50
- }
51
- onMounted(() => {
52
- stopWatch = watch([active, ...targets], syncListeners, { immediate: true });
53
- });
54
- onBeforeUnmount(() => {
55
- stopWatch?.();
56
- detachListeners();
57
- });
58
- }
59
- //#endregion
60
- //#region src/internal/composables/useCollectionNavigation.ts
61
- function useCollectionNavigation(options) {
62
- const activeKey = shallowRef(null);
63
- const isDisabled = options.isDisabled ?? (() => false);
64
- const loop = options.loop ?? true;
65
- const activeIndex = computed(() => {
66
- if (activeKey.value == null) return -1;
67
- return options.items().findIndex((item) => options.getKey(item) === activeKey.value && !isDisabled(item));
68
- });
69
- const enabledIndexes = computed(() => getEnabledIndexes(options.items(), isDisabled));
70
- function resetActive() {
71
- activeKey.value = null;
72
- }
73
- function setActiveIndex(index) {
74
- const item = options.items()[index];
75
- if (!item || isDisabled(item)) return false;
76
- activeKey.value = options.getKey(item);
77
- return true;
78
- }
79
- function focusSelected() {
80
- const items = options.items();
81
- const selectedIndex = options.isSelected ? items.findIndex((item) => options.isSelected(item) && !isDisabled(item)) : -1;
82
- if (selectedIndex >= 0) setActiveIndex(selectedIndex);
83
- else focusFirst();
84
- }
85
- function focusFirst() {
86
- const first = enabledIndexes.value[0];
87
- if (first === void 0) resetActive();
88
- else setActiveIndex(first);
89
- }
90
- function focusLast() {
91
- const indexes = enabledIndexes.value;
92
- const last = indexes[indexes.length - 1];
93
- if (last === void 0) resetActive();
94
- else setActiveIndex(last);
95
- }
96
- function moveFocus(direction) {
97
- if (activeIndex.value < 0) {
98
- if (direction === 1) focusFirst();
99
- else focusLast();
100
- return;
101
- }
102
- const nextIndex = getNextEnabledIndex(options.items(), activeIndex.value, direction, isDisabled, loop);
103
- if (nextIndex === void 0) resetActive();
104
- else setActiveIndex(nextIndex);
105
- }
106
- watch(activeIndex, (index) => {
107
- if (activeKey.value != null && index < 0) resetActive();
108
- }, { flush: "sync" });
109
- return {
110
- activeKey,
111
- activeIndex,
112
- enabledIndexes,
113
- resetActive,
114
- setActiveIndex,
115
- focusSelected,
116
- focusFirst,
117
- focusLast,
118
- moveFocus
119
- };
120
- }
121
- //#endregion
13
+ import { i as useHiddenSelectChoiceTransaction, n as createSingleNativeChoiceAdapter } from "./nativeChoice.js";
14
+ import { t as useTypeahead } from "./useTypeahead.js";
15
+ import { VaporTransition, child, computed, createComponent, createFor, createIf, createSlot, createTemplateRefSetter, defineVaporComponent, extend, next, nextTick, on, ref, renderEffect, setDynamicProps, setInsertionState, setProp, setTemplateRefBinding, setText, setValue, template, toDisplayString, txt, unref, useId, withModifiers } from "vue";
122
16
  //#region src/components/select/useSelect.ts
123
17
  function hasSelectValue(value) {
124
18
  return value != null && value !== "";
@@ -127,36 +21,72 @@ function getSelectDisplayLabel(options, value) {
127
21
  if (!hasSelectValue(value)) return "";
128
22
  return options?.find((option) => option.value === value)?.label ?? "";
129
23
  }
130
- function getSelectActiveDescendantId(baseId, focusedIndex, isOpen) {
131
- return !isOpen || focusedIndex < 0 ? void 0 : `${baseId}-option-${focusedIndex}`;
24
+ function useSelectTransaction(props, emitUpdate, triggerRef) {
25
+ const transaction = useHiddenSelectChoiceTransaction({
26
+ value: {
27
+ modelValue: () => props.modelValue,
28
+ defaultValue: () => props.defaultValue ?? null,
29
+ onChange: emitUpdate
30
+ },
31
+ native: {
32
+ adapter: createSingleNativeChoiceAdapter({
33
+ emptyValue: null,
34
+ options: () => props.options
35
+ }),
36
+ attributes: () => props.inputAttrs,
37
+ className: "rp-select__native",
38
+ focusVisible: () => triggerRef.value?.focus(),
39
+ validationMessage: () => props.validationMessage
40
+ }
41
+ });
42
+ return {
43
+ nativeSelectRef: transaction.nativeSelectRef,
44
+ nativeInputAttrs: transaction.nativeSelectAttrs,
45
+ requestValueUpdate: transaction.requestValueUpdate,
46
+ selectedValue: transaction.value
47
+ };
132
48
  }
133
- function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null, triggerRef = ref(null)) {
49
+ function useSelect(props, emitUpdate) {
134
50
  const selectRef = ref(null);
51
+ const triggerRef = ref(null);
52
+ const dropdownRef = ref(null);
135
53
  const isOpen = ref(false);
54
+ const transaction = useSelectTransaction(props, emitUpdate, triggerRef);
55
+ const value = transaction.selectedValue;
136
56
  const selectId = useId();
137
57
  const popupId = `${selectId}-popup`;
138
58
  const listboxId = `${popupId}-viewport`;
139
59
  const control = useControlState(props);
140
60
  const visibleOptions = computed(() => props.options ?? []);
141
- const value = computed(getValue);
142
- const navigation = useCollectionNavigation({
61
+ const optionCollection = useFlatOptionCollection({
143
62
  items: () => visibleOptions.value,
63
+ baseId: selectId,
64
+ isOpen: () => isOpen.value,
65
+ collectionRef: selectRef,
144
66
  getKey: (item) => item.value,
145
67
  isDisabled: (item) => Boolean(item.disabled),
146
68
  isSelected: (item) => item.value === value.value
147
69
  });
148
- const focusedIndex = navigation.activeIndex;
70
+ const renderedOptions = optionCollection.options;
71
+ const focusedIndex = optionCollection.activeIndex;
149
72
  const selectedIndex = computed(() => visibleOptions.value.findIndex((option) => option.value === value.value && !option.disabled));
150
- const activeDescendantId = computed(() => getSelectActiveDescendantId(selectId, focusedIndex.value, isOpen.value));
73
+ const activeDescendantId = optionCollection.activeDescendantId;
74
+ const floating = useFloatingPosition({
75
+ reference: triggerRef,
76
+ floating: dropdownRef,
77
+ open: isOpen,
78
+ placement: "bottom-start"
79
+ });
80
+ const placementSide = computed(() => floating.actualPlacement.value.split("-")[0]);
151
81
  const typeahead = useTypeahead({
152
82
  items: () => visibleOptions.value,
153
83
  activeIndex: () => isOpen.value ? focusedIndex.value : selectedIndex.value,
154
84
  getKey: (item) => item.value,
155
85
  getTextValue: (item) => item.label,
156
86
  isDisabled: (item) => Boolean(item.disabled),
157
- onMatch(item, index) {
158
- if (isOpen.value) navigation.setActiveIndex(index);
159
- else if (item.value !== value.value) emitUpdate(item.value);
87
+ onMatch(item) {
88
+ if (isOpen.value) optionCollection.activate(item);
89
+ else if (item.value !== value.value) transaction.requestValueUpdate(item.value);
160
90
  }
161
91
  });
162
92
  const rootClass = computed(() => bem("rp-select", {
@@ -169,6 +99,11 @@ function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null,
169
99
  const hasValue = computed(() => hasSelectValue(value.value));
170
100
  const displayLabel = computed(() => getSelectDisplayLabel(props.options, value.value));
171
101
  const canClear = computed(() => Boolean(props.clearable && hasValue.value && !control.disabled));
102
+ function setDropdownElement(elementRef) {
103
+ resolveHTMLElementRef(elementRef, popupId, (resolved) => {
104
+ dropdownRef.value = resolved;
105
+ });
106
+ }
172
107
  function focusTrigger() {
173
108
  nextTick(() => triggerRef.value?.focus());
174
109
  }
@@ -176,11 +111,11 @@ function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null,
176
111
  if (control.disabled || isOpen.value) return;
177
112
  typeahead.reset();
178
113
  isOpen.value = true;
179
- navigation.focusSelected();
114
+ optionCollection.activate("selected");
180
115
  }
181
116
  function close() {
182
117
  isOpen.value = false;
183
- navigation.resetActive();
118
+ optionCollection.reset();
184
119
  typeahead.reset();
185
120
  }
186
121
  function toggle() {
@@ -192,18 +127,18 @@ function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null,
192
127
  }
193
128
  function selectOption(option) {
194
129
  if (option.disabled) return;
195
- emitUpdate(option.value);
130
+ transaction.requestValueUpdate(option.value);
196
131
  close();
197
132
  focusTrigger();
198
133
  }
199
134
  function clearSelection() {
200
135
  if (!canClear.value) return;
201
- emitUpdate(null);
136
+ transaction.requestValueUpdate(null);
202
137
  close();
203
138
  focusTrigger();
204
139
  }
205
- function onOptionMouseenter(option, index) {
206
- if (!option.disabled) navigation.setActiveIndex(index);
140
+ function onOptionMouseenter(option) {
141
+ optionCollection.activate(option);
207
142
  }
208
143
  function onFocusout(event) {
209
144
  if (isNodeWithinElement(event.relatedTarget, selectRef.value)) return;
@@ -230,25 +165,25 @@ function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null,
230
165
  case "ArrowDown":
231
166
  e.preventDefault();
232
167
  if (!isOpen.value) open();
233
- else navigation.moveFocus(1);
168
+ else optionCollection.move(1);
234
169
  break;
235
170
  case "ArrowUp":
236
171
  e.preventDefault();
237
172
  if (!isOpen.value) {
238
173
  open();
239
- navigation.focusLast();
240
- } else navigation.moveFocus(-1);
174
+ optionCollection.activate("last");
175
+ } else optionCollection.move(-1);
241
176
  break;
242
177
  case "Home":
243
178
  if (isOpen.value) {
244
179
  e.preventDefault();
245
- navigation.focusFirst();
180
+ optionCollection.activate("first");
246
181
  }
247
182
  break;
248
183
  case "End":
249
184
  if (isOpen.value) {
250
185
  e.preventDefault();
251
- navigation.focusLast();
186
+ optionCollection.activate("last");
252
187
  }
253
188
  break;
254
189
  case "Delete":
@@ -265,30 +200,31 @@ function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null,
265
200
  break;
266
201
  }
267
202
  }
268
- watch(focusedIndex, (index) => {
269
- if (!isOpen.value || index < 0) return;
270
- nextTick(() => {
271
- if (!isOpen.value || focusedIndex.value !== index) return;
272
- selectRef.value?.querySelector(`[id="${selectId}-option-${index}"]`)?.scrollIntoView?.({ block: "nearest" });
273
- });
274
- });
275
203
  useClickOutside(selectRef, isOpen, close);
276
204
  return {
277
- selectRef,
278
- triggerRef,
205
+ templateRefs: {
206
+ select: selectRef,
207
+ trigger: triggerRef,
208
+ native: transaction.nativeSelectRef
209
+ },
210
+ nativeInputAttrs: transaction.nativeInputAttrs,
279
211
  isOpen,
280
- selectId,
281
212
  popupId,
282
213
  listboxId,
283
214
  control,
284
215
  visibleOptions,
216
+ renderedOptions,
285
217
  focusedIndex,
286
218
  activeDescendantId,
287
219
  rootClass,
220
+ floatingStyle: floating.floatingStyle,
221
+ actualPlacement: floating.actualPlacement,
222
+ placementSide,
288
223
  hasValue,
289
224
  displayLabel,
290
- value,
225
+ selectedValue: value,
291
226
  canClear,
227
+ setDropdownElement,
292
228
  toggle,
293
229
  selectOption,
294
230
  clearSelection,
@@ -298,102 +234,13 @@ function useSelect(props, emitUpdate, getValue = () => props.modelValue ?? null,
298
234
  };
299
235
  }
300
236
  //#endregion
301
- //#region src/components/select/useSelectNativeValue.ts
302
- function useSelectNativeValue(props, emitUpdate) {
303
- const nativeSelectRef = ref(null);
304
- const controllable = useControllableValue({
305
- modelValue: () => props.modelValue,
306
- defaultValue: () => props.defaultValue ?? null,
307
- onChange: emitUpdate
308
- });
309
- function getNativeValue(select) {
310
- if (select.selectedIndex <= 0) return null;
311
- return props.options?.[select.selectedIndex - 1]?.value ?? null;
312
- }
313
- function syncNativeSelection(value) {
314
- const select = nativeSelectRef.value;
315
- if (!select) return;
316
- select.selectedIndex = (props.options?.findIndex((option) => option.value === value) ?? -1) + 1;
317
- }
318
- function syncNativeDefaultSelection() {
319
- const select = nativeSelectRef.value;
320
- if (!select) return;
321
- const optionIndex = props.options?.findIndex((option) => option.value === controllable.initialValue) ?? -1;
322
- for (const [index, option] of [...select.options].entries()) option.defaultSelected = index === optionIndex + 1;
323
- }
324
- function requestValueUpdate(value) {
325
- const select = nativeSelectRef.value;
326
- if (!select) {
327
- controllable.setValue(value);
328
- return;
329
- }
330
- syncNativeSelection(value);
331
- select.dispatchEvent(new Event("input", {
332
- bubbles: true,
333
- cancelable: true
334
- }));
335
- select.dispatchEvent(new Event("change", {
336
- bubbles: true,
337
- cancelable: true
338
- }));
339
- if (controllable.isControlled.value) queueMicrotask(() => syncNativeSelection(controllable.value.value));
340
- }
341
- watchEffect(syncNativeDefaultSelection, { flush: "post" });
342
- watchEffect(() => syncNativeSelection(controllable.value.value), { flush: "post" });
343
- return {
344
- nativeSelectRef,
345
- controllable,
346
- getNativeValue,
347
- syncNativeSelection,
348
- requestValueUpdate
349
- };
350
- }
351
- //#endregion
352
- //#region src/components/select/useSelectNativeControl.ts
353
- function useSelectNativeControl(props, emitUpdate, triggerRef) {
354
- const nativeValue = useSelectNativeValue(props, emitUpdate);
355
- const { nativeSelectRef, controllable, getNativeValue, syncNativeSelection } = nativeValue;
356
- useFormControl({
357
- elements: () => [nativeSelectRef.value],
358
- isControlled: () => controllable.isControlled.value,
359
- validationMessage: () => props.validationMessage,
360
- readResetValue(elements) {
361
- controllable.resetValue(getNativeValue(elements[0]));
362
- },
363
- syncControlledValue() {
364
- syncNativeSelection(controllable.value.value);
365
- }
366
- });
367
- const nativeInputAttrs = computed(() => {
368
- const compatibilityAttrs = props.inputAttrs ?? {};
369
- const { compatibilityClass, compatibilityStyle, forwardedAttributes } = splitCompatibilityAttributes(compatibilityAttrs);
370
- return {
371
- ...forwardedAttributes,
372
- class: ["rp-select__native", compatibilityClass],
373
- style: compatibilityStyle,
374
- onInput: composeEventHandlers((event) => controllable.setValue(getNativeValue(event.currentTarget)), compatibilityAttrs.onInput),
375
- onChange: compatibilityAttrs.onChange,
376
- onInvalid: composeEventHandlers((event) => {
377
- event.preventDefault();
378
- triggerRef.value?.focus();
379
- }, compatibilityAttrs.onInvalid)
380
- };
381
- });
382
- return {
383
- nativeSelectRef,
384
- selectedValue: controllable.value,
385
- nativeInputAttrs,
386
- requestValueUpdate: nativeValue.requestValueUpdate
387
- };
388
- }
389
- //#endregion
390
237
  //#region src/components/select/select.vue?vue&type=script&setup=true&vapor=true&lang.ts
391
- var t0 = template("<option data-v-b42a5b2f> ");
392
- var t1 = template("<button data-v-b42a5b2f></button>");
238
+ var t0 = template("<option data-v-097d7f90> ");
239
+ var t1 = template("<button data-v-097d7f90></button>");
393
240
  var t2 = template("No options", 2);
394
- var t3 = template("<div data-v-b42a5b2f>");
395
- var t4 = template("<div data-v-b42a5b2f> ");
396
- var t5 = template("<div data-v-b42a5b2f><select data-v-b42a5b2f><option data-v-b42a5b2f value></option></select><div data-v-b42a5b2f><span data-v-b42a5b2f> </span><span data-v-b42a5b2f><span data-v-b42a5b2f class=rp-select__arrow aria-hidden=true>", 1);
241
+ var t3 = template("<div data-v-097d7f90>");
242
+ var t4 = template("<div data-v-097d7f90> ");
243
+ var t5 = template("<div data-v-097d7f90><select data-v-097d7f90><option data-v-097d7f90 value></option></select><div data-v-097d7f90><span data-v-097d7f90> </span><span data-v-097d7f90><span data-v-097d7f90 class=rp-select__arrow aria-hidden=true>", 1);
397
244
  //#endregion
398
245
  //#region src/components/select/select.vue
399
246
  var select_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
@@ -439,10 +286,7 @@ var select_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
439
286
  setup(__props, { expose: __expose, emit: __emit }) {
440
287
  const props = __props;
441
288
  const emit = __emit;
442
- const triggerRef = ref(null);
443
- const { nativeSelectRef, selectedValue, nativeInputAttrs, requestValueUpdate } = useSelectNativeControl(props, (value) => emit("update:modelValue", value), triggerRef);
444
- const { selectRef, isOpen, selectId, popupId, listboxId, control, visibleOptions, focusedIndex, activeDescendantId, rootClass, hasValue, displayLabel, canClear, toggle, selectOption, clearSelection, onOptionMouseenter, onFocusout, onTriggerKeydown } = useSelect(props, requestValueUpdate, () => selectedValue.value, triggerRef);
445
- const templateRefs = { select: selectRef };
289
+ const { templateRefs, nativeInputAttrs, isOpen, popupId, listboxId, control, visibleOptions, renderedOptions, activeDescendantId, rootClass, floatingStyle, actualPlacement, placementSide, hasValue, displayLabel, canClear, setDropdownElement, toggle, selectOption, clearSelection, onOptionMouseenter, onFocusout, onTriggerKeydown } = useSelect(props, (value) => emit("update:modelValue", value));
446
290
  const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
447
291
  const rootAttrs = computed(() => getRootAttrs({
448
292
  class: rootClass.value,
@@ -451,9 +295,17 @@ var select_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
451
295
  "data-disabled": toPresenceAttribute(control.disabled),
452
296
  "data-invalid": toPresenceAttribute(control.invalid)
453
297
  }));
298
+ const contentAttrs = computed(() => ({
299
+ ...getPartAttrs("content", {
300
+ class: "rp-select__dropdown",
301
+ style: floatingStyle.value
302
+ }),
303
+ "data-placement": actualPlacement.value,
304
+ "data-side": placementSide.value
305
+ }));
454
306
  __expose({
455
- nativeElement: nativeSelectRef,
456
- focus: () => triggerRef.value?.focus()
307
+ nativeElement: templateRefs.native,
308
+ focus: () => templateRefs.trigger.value?.focus()
457
309
  });
458
310
  const _setTemplateRef = createTemplateRefSetter();
459
311
  const n26 = t5();
@@ -487,13 +339,13 @@ var select_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
487
339
  });
488
340
  return n2;
489
341
  }, (option) => option.value, 8);
490
- _setTemplateRef(n3, nativeSelectRef, null, "nativeSelectRef");
491
342
  const x4 = txt(n4);
492
343
  renderEffect(() => {
493
344
  const _control = unref(control);
494
345
  const _getPartAttrs = unref(getPartAttrs);
495
346
  const _isOpen = unref(isOpen);
496
347
  const _control_disabled = _control.disabled;
348
+ _setTemplateRef(n3, unref(templateRefs).native);
497
349
  setDynamicProps(n12, [
498
350
  { id: _control.id },
499
351
  _getPartAttrs("trigger", { class: "rp-select__trigger" }),
@@ -540,11 +392,11 @@ var select_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
540
392
  createComponent(unref(chevrons_up_down_default));
541
393
  on(n12, "click", (e) => unref(toggle)(e));
542
394
  on(n12, "keydown", (e) => unref(onTriggerKeydown)(e));
543
- _setTemplateRef(n12, triggerRef, null, "triggerRef");
395
+ setTemplateRefBinding(n12, () => unref(templateRefs).trigger);
544
396
  setInsertionState(n26, null, 2);
545
397
  createComponent(VaporTransition, { name: "rp-select-dropdown" }, extend(() => {
546
398
  return createIf(() => unref(isOpen), () => {
547
- return createComponent(scroll_area_default, { $: [() => unref(getPartAttrs)("content", { class: "rp-select__dropdown" }), {
399
+ const n24 = createComponent(scroll_area_default, { $: [() => contentAttrs.value, {
548
400
  id: () => unref(popupId),
549
401
  embedded: "",
550
402
  type: "auto",
@@ -563,43 +415,41 @@ var select_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
563
415
  return t2();
564
416
  }, 1);
565
417
  return n20;
566
- }, null, 129), createFor(() => unref(visibleOptions), (_for_item0, _for_key0) => {
418
+ }, null, 129), createFor(() => unref(renderedOptions), (_for_item0) => {
567
419
  const n23 = t4();
568
420
  const x23 = txt(n23);
569
- on(n23, "click", () => unref(selectOption)(_for_item0.value));
570
- on(n23, "mouseenter", () => unref(onOptionMouseenter)(_for_item0.value, _for_key0.value));
421
+ on(n23, "click", () => unref(selectOption)(_for_item0.value.option));
422
+ on(n23, "mouseenter", () => unref(onOptionMouseenter)(_for_item0.value.option));
571
423
  renderEffect(() => {
572
- const _index = _for_key0.value;
573
- const _option = _for_item0.value;
574
- const _selectedValue = unref(selectedValue);
575
- const _toPresenceAttribute = unref(toPresenceAttribute);
576
- const _focusedIndex = unref(focusedIndex);
577
- const _option_value = _option.value;
578
- const _option_disabled = _option.disabled;
424
+ const _optionState = _for_item0.value;
425
+ const _optionState_selected = _optionState.selected;
426
+ const _optionState_disabled = _optionState.disabled;
579
427
  setDynamicProps(n23, [{
580
428
  role: "option",
581
- id: `${unref(selectId)}-option-${_index}`,
582
- "aria-selected": _option_value === _selectedValue,
583
- "aria-disabled": _option_disabled || void 0,
584
- "data-selected": _toPresenceAttribute(_option_value === _selectedValue),
585
- "data-highlighted": _toPresenceAttribute(_index === _focusedIndex),
586
- "data-disabled": _toPresenceAttribute(_option.disabled)
429
+ id: _optionState.id,
430
+ "aria-selected": _optionState_selected,
431
+ "aria-disabled": _optionState_disabled || void 0,
432
+ "data-selected": unref(toPresenceAttribute)(_optionState.selected),
433
+ "data-highlighted": unref(toPresenceAttribute)(_optionState.active),
434
+ "data-disabled": unref(toPresenceAttribute)(_optionState.disabled)
587
435
  }, unref(getPartAttrs)("option", { class: ["rp-select__option", {
588
- "rp-select__option--selected": _option_value === _selectedValue,
589
- "rp-select__option--focused": _index === _focusedIndex,
590
- "rp-select__option--disabled": _option_disabled
436
+ "rp-select__option--selected": _optionState_selected,
437
+ "rp-select__option--focused": _optionState.active,
438
+ "rp-select__option--disabled": _optionState_disabled
591
439
  }] })]);
592
- setText(x23, toDisplayString(_option.label));
440
+ setText(x23, toDisplayString(_optionState.option.label));
593
441
  });
594
442
  return n23;
595
- }, (option, index) => option.value, 40)];
443
+ }, (optionState) => optionState.option.value, 40)];
596
444
  }, { _: 8 }));
445
+ setTemplateRefBinding(n24, () => setDropdownElement, _setTemplateRef, void 0, "setDropdownElement");
446
+ return n24;
597
447
  }, null, 129);
598
448
  }, { _: 8 }));
599
- setTemplateRefBinding(n26, () => templateRefs.select);
449
+ setTemplateRefBinding(n26, () => unref(templateRefs).select);
600
450
  return n26;
601
451
  }
602
- }), [["__scopeId", "data-v-b42a5b2f"]]);
452
+ }), [["__scopeId", "data-v-097d7f90"]]);
603
453
  //#endregion
604
454
  //#region src/components/select/types.ts
605
455
  var selectParts = [