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
@@ -0,0 +1,380 @@
1
+ import './tags-input.css';
2
+ import { t as useStylesApi } from "./styles-api.js";
3
+ import { n as toPresenceAttribute } from "./attributes.js";
4
+ import { t as bem } from "./bem.js";
5
+ import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
6
+ import { t as x_default } from "./x.js";
7
+ import { o as splitCompatibilityAttributes, t as composeEventHandlers } from "./attributes2.js";
8
+ import { t as useControlState } from "./useControlState.js";
9
+ import { i as isNodeWithinElement } from "./events.js";
10
+ import { t as isInteractiveElement } from "./interactive.js";
11
+ import { i as useHiddenSelectChoiceTransaction, r as createStringListNativeChoiceAdapter } from "./nativeChoice.js";
12
+ import { child, computed, createComponent, createFor, createIf, createSlot, createTemplateRefSetter, defineVaporComponent, next, nextTick, on, ref, renderEffect, setDynamicProps, setInsertionState, setTemplateRefBinding, setText, template, toDisplayString, unref, withModifiers } from "vue";
13
+ //#region src/components/tags-input/tagsInputModel.ts
14
+ function normalizeTagsInputValue(value) {
15
+ return value.trim();
16
+ }
17
+ function addTagsInputValues(values, candidates, options) {
18
+ const nextValues = [...values];
19
+ const maxTags = options.maxTags === void 0 ? Number.POSITIVE_INFINITY : Math.max(0, options.maxTags);
20
+ for (const candidate of candidates) {
21
+ const value = normalizeTagsInputValue(candidate);
22
+ if (value === "" || nextValues.length >= maxTags) continue;
23
+ if (!options.allowDuplicates && nextValues.includes(value)) continue;
24
+ if (options.validate && !options.validate(value)) continue;
25
+ nextValues.push(value);
26
+ }
27
+ return nextValues;
28
+ }
29
+ function splitTagsInputValue(value, splitChars) {
30
+ const delimiters = new Set(splitChars);
31
+ const tags = [];
32
+ let remainder = "";
33
+ let wasSplit = false;
34
+ for (const character of Array.from(value)) {
35
+ if (!delimiters.has(character)) {
36
+ remainder += character;
37
+ continue;
38
+ }
39
+ tags.push(remainder);
40
+ remainder = "";
41
+ wasSplit = true;
42
+ }
43
+ return {
44
+ tags: wasSplit ? tags : [],
45
+ remainder: wasSplit ? remainder : value
46
+ };
47
+ }
48
+ //#endregion
49
+ //#region src/components/tags-input/useTagsInput.ts
50
+ function useTagsInputTransaction(props, emitUpdate, inputRef, onFormReset) {
51
+ const transaction = useHiddenSelectChoiceTransaction({
52
+ value: {
53
+ modelValue: () => props.modelValue,
54
+ defaultValue: () => [...props.defaultValue ?? []],
55
+ onChange: emitUpdate
56
+ },
57
+ native: {
58
+ adapter: createStringListNativeChoiceAdapter(),
59
+ className: "rp-tags-input__native",
60
+ focusVisible: () => inputRef.value?.focus(),
61
+ validationMessage: () => props.readonly ? void 0 : props.validationMessage
62
+ },
63
+ onFormReset
64
+ });
65
+ return {
66
+ nativeSelectRef: transaction.nativeSelectRef,
67
+ nativeSelectAttrs: transaction.nativeSelectAttrs,
68
+ requestValueUpdate: transaction.requestValueUpdate,
69
+ values: transaction.value
70
+ };
71
+ }
72
+ function areTagValuesEqual(left, right) {
73
+ return left.length === right.length && left.every((value, index) => value === right[index]);
74
+ }
75
+ function useTagsInput(props, emitUpdate) {
76
+ const rootRef = ref(null);
77
+ const inputRef = ref(null);
78
+ const searchValue = ref("");
79
+ function updateSearch(value) {
80
+ searchValue.value = value;
81
+ if (inputRef.value && inputRef.value.value !== value) inputRef.value.value = value;
82
+ }
83
+ const transaction = useTagsInputTransaction(props, emitUpdate, inputRef, () => updateSearch(""));
84
+ const values = transaction.values;
85
+ const control = useControlState(props);
86
+ const rootClass = computed(() => bem("rp-tags-input", {
87
+ [`size-${props.size}`]: Boolean(props.size),
88
+ [`radius-${props.radius}`]: Boolean(props.radius),
89
+ disabled: control.disabled,
90
+ readonly: props.readonly,
91
+ invalid: control.invalid
92
+ }));
93
+ const canClear = computed(() => Boolean(props.clearable && values.value.length > 0 && !control.disabled && !props.readonly));
94
+ function addValues(candidates) {
95
+ if (control.disabled || props.readonly) return false;
96
+ const nextValues = addTagsInputValues(values.value, candidates, {
97
+ allowDuplicates: props.allowDuplicates ?? false,
98
+ maxTags: props.maxTags,
99
+ validate: props.validate
100
+ });
101
+ if (areTagValuesEqual(nextValues, values.value)) return false;
102
+ transaction.requestValueUpdate(nextValues);
103
+ return true;
104
+ }
105
+ function commitSearch() {
106
+ if (searchValue.value.trim() === "") return false;
107
+ const wasAdded = addValues([searchValue.value]);
108
+ if (wasAdded) updateSearch("");
109
+ return wasAdded;
110
+ }
111
+ function removeTag(index) {
112
+ if (control.disabled || props.readonly || index < 0 || index >= values.value.length) return;
113
+ transaction.requestValueUpdate(values.value.filter((_, valueIndex) => valueIndex !== index));
114
+ nextTick(() => inputRef.value?.focus());
115
+ }
116
+ function clear() {
117
+ if (!canClear.value) return;
118
+ transaction.requestValueUpdate([]);
119
+ updateSearch("");
120
+ nextTick(() => inputRef.value?.focus());
121
+ }
122
+ function focusInput(event) {
123
+ if (control.disabled) return;
124
+ if (event && isInteractiveElement(event.target, ".rp-tags-input__input")) return;
125
+ inputRef.value?.focus();
126
+ }
127
+ function onInput(event) {
128
+ if (control.disabled || props.readonly || event.isComposing) return;
129
+ const inputValue = event.currentTarget.value;
130
+ const { tags, remainder } = splitTagsInputValue(inputValue, props.splitChars ?? [","]);
131
+ if (tags.length > 0) addValues(tags);
132
+ updateSearch(remainder);
133
+ }
134
+ function onInputBlur(event) {
135
+ if (isNodeWithinElement(event.relatedTarget, rootRef.value)) return;
136
+ if (props.acceptValueOnBlur) commitSearch();
137
+ }
138
+ function onInputKeydown(event) {
139
+ if (control.disabled || props.readonly || event.isComposing) return;
140
+ if (event.key === "Enter" && searchValue.value.trim() !== "") {
141
+ event.preventDefault();
142
+ commitSearch();
143
+ return;
144
+ }
145
+ if (event.key === "Backspace" && searchValue.value === "") {
146
+ const lastIndex = values.value.length - 1;
147
+ if (lastIndex >= 0) removeTag(lastIndex);
148
+ }
149
+ }
150
+ return {
151
+ templateRefs: {
152
+ root: rootRef,
153
+ input: inputRef,
154
+ native: transaction.nativeSelectRef
155
+ },
156
+ nativeSelectAttrs: transaction.nativeSelectAttrs,
157
+ control,
158
+ rootClass,
159
+ values,
160
+ searchValue,
161
+ canClear,
162
+ removeTag,
163
+ clear,
164
+ focusInput,
165
+ onInput,
166
+ onInputBlur,
167
+ onInputKeydown
168
+ };
169
+ }
170
+ //#endregion
171
+ //#region src/components/tags-input/tags-input.vue?vue&type=script&setup=true&vapor=true&lang.ts
172
+ var t0 = template(" ");
173
+ var t1 = template("<button data-v-9fbac28f></button>");
174
+ var t2 = template("<span data-v-9fbac28f><span data-v-9fbac28f></span>");
175
+ var t3 = template("<button data-v-9fbac28f>");
176
+ var t4 = template("<div data-v-9fbac28f><select data-v-9fbac28f></select><div data-v-9fbac28f><input data-v-9fbac28f></div>", 1);
177
+ //#endregion
178
+ //#region src/components/tags-input/tags-input.vue
179
+ var tags_input_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
180
+ name: "RpTagsInput",
181
+ inheritAttrs: false,
182
+ __name: "tags-input",
183
+ props: {
184
+ id: {},
185
+ name: {},
186
+ form: {},
187
+ modelValue: { default: void 0 },
188
+ defaultValue: { default: () => [] },
189
+ maxTags: { default: void 0 },
190
+ allowDuplicates: {
191
+ type: Boolean,
192
+ default: false
193
+ },
194
+ splitChars: { default: () => [","] },
195
+ acceptValueOnBlur: {
196
+ type: Boolean,
197
+ default: false
198
+ },
199
+ validate: {
200
+ type: Function,
201
+ default: void 0
202
+ },
203
+ size: {},
204
+ radius: {},
205
+ placeholder: { default: "Enter tags..." },
206
+ clearable: {
207
+ type: Boolean,
208
+ default: false
209
+ },
210
+ clearLabel: { default: "Clear tags" },
211
+ removeLabel: { default: "Remove" },
212
+ disabled: {
213
+ type: Boolean,
214
+ default: void 0
215
+ },
216
+ readonly: {
217
+ type: Boolean,
218
+ default: false
219
+ },
220
+ required: {
221
+ type: Boolean,
222
+ default: void 0
223
+ },
224
+ invalid: {
225
+ type: Boolean,
226
+ default: void 0
227
+ },
228
+ ariaLabel: {},
229
+ describedby: {},
230
+ labelledby: {},
231
+ inputAttrs: {},
232
+ validationMessage: {},
233
+ classNames: {},
234
+ styles: {}
235
+ },
236
+ emits: ["update:modelValue"],
237
+ setup(__props, { expose: __expose, emit: __emit }) {
238
+ const props = __props;
239
+ const emit = __emit;
240
+ const { templateRefs, nativeSelectAttrs, control, rootClass, values, searchValue, canClear, removeTag, clear, focusInput, onInput, onInputBlur, onInputKeydown } = useTagsInput(props, (value) => emit("update:modelValue", value));
241
+ const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
242
+ const rootAttrs = computed(() => getRootAttrs({
243
+ class: rootClass.value,
244
+ onMousedown: focusInput,
245
+ "data-disabled": toPresenceAttribute(control.disabled),
246
+ "data-readonly": toPresenceAttribute(props.readonly),
247
+ "data-invalid": toPresenceAttribute(control.invalid)
248
+ }));
249
+ const visibleInputAttrs = computed(() => {
250
+ const attrs = props.inputAttrs ?? {};
251
+ const { compatibilityClass, compatibilityStyle, forwardedAttributes } = splitCompatibilityAttributes(attrs);
252
+ return {
253
+ ...forwardedAttributes,
254
+ ...getPartAttrs("input", {
255
+ class: "rp-tags-input__input",
256
+ compatibilityClass,
257
+ compatibilityStyle
258
+ }),
259
+ id: control.id,
260
+ name: void 0,
261
+ form: "",
262
+ type: "text",
263
+ value: searchValue.value,
264
+ placeholder: values.value.length === 0 ? props.placeholder : void 0,
265
+ disabled: control.disabled || void 0,
266
+ readonly: props.readonly || void 0,
267
+ required: void 0,
268
+ autocomplete: forwardedAttributes.autocomplete ?? "off",
269
+ "aria-disabled": control.disabled || void 0,
270
+ "aria-invalid": control.invalid || void 0,
271
+ "aria-required": control.required || void 0,
272
+ "aria-label": control.ariaLabelledby ? void 0 : props.ariaLabel || void 0,
273
+ "aria-labelledby": control.ariaLabelledby,
274
+ "aria-describedby": control.ariaDescribedby,
275
+ "data-disabled": toPresenceAttribute(control.disabled),
276
+ "data-readonly": toPresenceAttribute(props.readonly),
277
+ "data-invalid": toPresenceAttribute(control.invalid),
278
+ onInput: composeEventHandlers(onInput, attrs.onInput),
279
+ onBlur: composeEventHandlers(onInputBlur, attrs.onBlur),
280
+ onKeydown: composeEventHandlers(onInputKeydown, attrs.onKeydown)
281
+ };
282
+ });
283
+ __expose({
284
+ nativeElement: templateRefs.native,
285
+ inputElement: templateRefs.input,
286
+ focus: () => templateRefs.input.value?.focus()
287
+ });
288
+ const _setTemplateRef = createTemplateRefSetter();
289
+ const n18 = t4();
290
+ const n0 = child(n18);
291
+ const n13 = next(n0, 1);
292
+ const n12 = child(n13, 1);
293
+ renderEffect(() => {
294
+ const _control = unref(control);
295
+ setDynamicProps(n18, [rootAttrs.value]);
296
+ setDynamicProps(n0, [unref(nativeSelectAttrs), {
297
+ name: __props.name,
298
+ form: _control.form,
299
+ disabled: _control.disabled || void 0,
300
+ required: _control.required && !__props.readonly || void 0,
301
+ multiple: "",
302
+ tabindex: "-1",
303
+ "aria-hidden": "true"
304
+ }]);
305
+ _setTemplateRef(n0, unref(templateRefs).native);
306
+ setDynamicProps(n13, [unref(getPartAttrs)("tags", { class: "rp-tags-input__tags" })]);
307
+ });
308
+ setInsertionState(n13, 0);
309
+ createFor(() => unref(values), (_for_item0, _for_key0) => {
310
+ const n11 = t2();
311
+ const n6 = child(n11);
312
+ renderEffect(() => {
313
+ const _getPartAttrs = unref(getPartAttrs);
314
+ setDynamicProps(n11, [_getPartAttrs("tag", { class: "rp-tags-input__tag" })]);
315
+ setDynamicProps(n6, [_getPartAttrs("tagLabel", { class: "rp-tags-input__tag-label" })]);
316
+ });
317
+ setInsertionState(n6, null, 0);
318
+ createSlot("tag", { value: () => _for_item0.value }, () => {
319
+ const n5 = t0();
320
+ renderEffect(() => setText(n5, toDisplayString(_for_item0.value)));
321
+ return n5;
322
+ }, 1);
323
+ setInsertionState(n11, null, 1);
324
+ createIf(() => !__props.readonly, () => {
325
+ const n10 = t1();
326
+ renderEffect(() => setDynamicProps(n10, [
327
+ { type: "button" },
328
+ unref(getPartAttrs)("tagRemove", { class: "rp-tags-input__tag-remove" }),
329
+ {
330
+ "aria-label": `${__props.removeLabel} ${_for_item0.value}`,
331
+ disabled: unref(control).disabled || void 0,
332
+ tabindex: "-1"
333
+ }
334
+ ]));
335
+ setInsertionState(n10, null, 0);
336
+ createComponent(unref(x_default));
337
+ on(n10, "mousedown", withModifiers(() => {}, ["prevent"]));
338
+ on(n10, "click", withModifiers(() => unref(removeTag)(_for_key0.value), ["stop"]));
339
+ return n10;
340
+ });
341
+ return n11;
342
+ }, (value, index) => `${value}-${index}`, 8);
343
+ renderEffect(() => {
344
+ setDynamicProps(n12, [visibleInputAttrs.value]);
345
+ _setTemplateRef(n12, unref(templateRefs).input);
346
+ });
347
+ setInsertionState(n18, null, 2);
348
+ createIf(() => unref(canClear), () => {
349
+ const n17 = t3();
350
+ renderEffect(() => setDynamicProps(n17, [
351
+ { type: "button" },
352
+ unref(getPartAttrs)("clear", { class: "rp-tags-input__clear" }),
353
+ {
354
+ "aria-label": __props.clearLabel,
355
+ tabindex: "-1"
356
+ }
357
+ ]));
358
+ setInsertionState(n17, null, 0);
359
+ createComponent(unref(x_default));
360
+ on(n17, "mousedown", withModifiers(() => {}, ["prevent"]));
361
+ on(n17, "click", withModifiers((e) => unref(clear)(e), ["stop"]));
362
+ return n17;
363
+ });
364
+ setTemplateRefBinding(n18, () => unref(templateRefs).root);
365
+ return n18;
366
+ }
367
+ }), [["__scopeId", "data-v-9fbac28f"]]);
368
+ //#endregion
369
+ //#region src/components/tags-input/types.ts
370
+ var tagsInputParts = [
371
+ "root",
372
+ "tags",
373
+ "tag",
374
+ "tagLabel",
375
+ "tagRemove",
376
+ "input",
377
+ "clear"
378
+ ];
379
+ //#endregion
380
+ export { tags_input_default as n, tagsInputParts as t };
package/dist/tooltip.js CHANGED
@@ -3,15 +3,14 @@ import { t as useControllableValue } from "./useControllableValue.js";
3
3
  import { t as useStylesApi } from "./styles-api.js";
4
4
  import { n as toPresenceAttribute } from "./attributes.js";
5
5
  import { t as bem } from "./bem.js";
6
- import { t as isElement } from "./query.js";
7
6
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
8
7
  import { r as normalizeDelay } from "./number.js";
9
8
  import { a as getComponentVariantColorRoles } from "./componentColors.js";
10
- import { a as snapshotAttributes, i as restoreAttributes } from "./attributes2.js";
11
9
  import { n as mergeAriaIdRefs } from "./aria.js";
12
10
  import { n as useOverlayZIndex } from "./useOverlayZIndex.js";
13
11
  import { t as getFloatingOffsetStyle } from "./floatingOffset.js";
14
- import { n as useFloatingTarget, t as useFloatingPosition } from "./useFloatingPosition.js";
12
+ import { t as useFloatingPosition } from "./useFloatingPosition.js";
13
+ import { t as useFloatingTargetLifecycle } from "./useFloatingTargetLifecycle.js";
15
14
  import { n as useTeleportTarget } from "./useTeleportTarget.js";
16
15
  import { VaporTeleport, VaporTransition, applyVShow, computed, createComponent, createIf, createSlot, createTemplateRefSetter, defineVaporComponent, extend, onBeforeUnmount, ref, renderEffect, setAttr, setDynamicProps, setInsertionState, setStyle, setTemplateRefBinding, setText, template, toDisplayString, unref, useId, useSlots, watch } from "vue";
17
16
  //#region src/internal/composables/useDelayedOpen.ts
@@ -66,6 +65,27 @@ function useDelayedOpen(options = {}) {
66
65
  };
67
66
  }
68
67
  //#endregion
68
+ //#region src/components/tooltip/useTooltipTargetBindings.ts
69
+ var TARGET_ATTRIBUTES = ["aria-describedby"];
70
+ function useTooltipTargetBindings({ targetLifecycle, shouldDescribeContent, tooltipId, openTooltip, closeTooltip, onKeydown }) {
71
+ targetLifecycle.bindTarget({
72
+ listeners: [
73
+ ["mouseenter", openTooltip],
74
+ ["mouseleave", closeTooltip],
75
+ ["focusin", openTooltip],
76
+ ["focusout", closeTooltip],
77
+ ["keydown", onKeydown]
78
+ ],
79
+ attributes: {
80
+ names: TARGET_ATTRIBUTES,
81
+ isActive: () => shouldDescribeContent.value,
82
+ apply: (target, snapshot) => {
83
+ target.setAttribute("aria-describedby", mergeAriaIdRefs(snapshot.get("aria-describedby"), tooltipId.value) ?? "");
84
+ }
85
+ }
86
+ });
87
+ }
88
+ //#endregion
69
89
  //#region src/components/tooltip/useTooltip.ts
70
90
  var TOOLTIP_OFFSET_PROPERTIES = {
71
91
  mainAxis: "--_rp-tooltip-main-axis-offset",
@@ -99,8 +119,11 @@ function useTooltip(props, emitOpenChange) {
99
119
  const shouldRenderContent = computed(() => !isDisabled.value);
100
120
  const shouldDescribeContent = computed(() => shouldRenderContent.value && !isDecorative.value);
101
121
  const teleportTo = useTeleportTarget(() => props.teleportTo);
102
- const { isExplicitTarget, reference, resolvedTarget } = useFloatingTarget(() => props.target, rootRef);
103
- const targetElement = computed(() => isElement(resolvedTarget.value) ? resolvedTarget.value : null);
122
+ const targetLifecycle = useFloatingTargetLifecycle({
123
+ target: () => props.target,
124
+ fallback: rootRef
125
+ });
126
+ const { isExplicitTarget, reference } = targetLifecycle;
104
127
  const zIndex = useOverlayZIndex({
105
128
  baseZIndex: () => props.baseZIndex,
106
129
  defaultBaseZIndex: 1e3
@@ -155,32 +178,14 @@ function useTooltip(props, emitOpenChange) {
155
178
  watch(isDisabled, (disabled) => {
156
179
  if (disabled) closeTooltip();
157
180
  });
158
- watch([isExplicitTarget, targetElement], ([explicit, target], _previous, onCleanup) => {
159
- if (!explicit || !target) return;
160
- target.addEventListener("mouseenter", openTooltip);
161
- target.addEventListener("mouseleave", closeTooltip);
162
- target.addEventListener("focusin", openTooltip);
163
- target.addEventListener("focusout", closeTooltip);
164
- target.addEventListener("keydown", onKeydown);
165
- onCleanup(() => {
166
- target.removeEventListener("mouseenter", openTooltip);
167
- target.removeEventListener("mouseleave", closeTooltip);
168
- target.removeEventListener("focusin", openTooltip);
169
- target.removeEventListener("focusout", closeTooltip);
170
- target.removeEventListener("keydown", onKeydown);
171
- });
172
- }, { flush: "sync" });
173
- watch([
174
- isExplicitTarget,
175
- targetElement,
181
+ useTooltipTargetBindings({
182
+ targetLifecycle,
176
183
  shouldDescribeContent,
177
- tooltipId
178
- ], ([explicit, target, shouldDescribe, id], _previous, onCleanup) => {
179
- if (!explicit || !target || !shouldDescribe) return;
180
- const snapshot = snapshotAttributes(target, ["aria-describedby"]);
181
- target.setAttribute("aria-describedby", mergeAriaIdRefs(snapshot.get("aria-describedby"), id) ?? "");
182
- onCleanup(() => restoreAttributes(target, snapshot));
183
- }, { flush: "sync" });
184
+ tooltipId,
185
+ openTooltip,
186
+ closeTooltip,
187
+ onKeydown
188
+ });
184
189
  return {
185
190
  rootRef,
186
191
  contentRef,
@@ -0,0 +1,216 @@
1
+ import { i as isNodeWithinElement } from "./events.js";
2
+ import { t as isInteractiveElement } from "./interactive.js";
3
+ import { n as useClickOutside, t as useFlatOptionCollection } from "./useFlatOptionCollection.js";
4
+ import { computed, nextTick, ref, watch } from "vue";
5
+ //#region src/utils/optionFilter.ts
6
+ function defaultOptionFilter(option, searchValue) {
7
+ return option.label.toLocaleLowerCase().includes(searchValue.trim().toLocaleLowerCase());
8
+ }
9
+ function filterOptions(options, searchValue, filter) {
10
+ const availableOptions = options ?? [];
11
+ if (filter === false || searchValue.trim() === "") return [...availableOptions];
12
+ const predicate = filter ?? defaultOptionFilter;
13
+ return availableOptions.filter((option) => predicate(option, searchValue));
14
+ }
15
+ //#endregion
16
+ //#region src/internal/composables/useEditableOptionList.ts
17
+ function useEditableOptionList(options) {
18
+ const selection = options.selection;
19
+ const isSingle = selection.kind === "single";
20
+ const isOpen = ref(false);
21
+ const isSearching = ref(false);
22
+ const popupId = `${options.baseId}-popup`;
23
+ const searchValue = ref(isSingle ? selection.displayValue() : "");
24
+ const filterValue = computed(() => isSingle && !isSearching.value ? "" : searchValue.value);
25
+ const visibleOptions = computed(() => filterOptions(options.items(), filterValue.value, options.filter()));
26
+ const optionCollection = useFlatOptionCollection({
27
+ items: () => visibleOptions.value,
28
+ baseId: options.baseId,
29
+ isOpen: () => isOpen.value,
30
+ collectionRef: options.rootRef,
31
+ getKey: options.getKey,
32
+ isDisabled: options.isDisabled,
33
+ isSelected: selection.isSelected
34
+ });
35
+ const itemsSnapshot = computed(() => visibleOptions.value.map((option) => [options.getKey(option), options.isDisabled(option)]));
36
+ const canClear = computed(() => options.clearable() && !options.disabled() && (selection.hasSelection() || isSingle && searchValue.value !== ""));
37
+ function setInputValue(value) {
38
+ searchValue.value = value;
39
+ if (options.inputRef.value && options.inputRef.value.value !== value) options.inputRef.value.value = value;
40
+ }
41
+ function syncInputToSelection() {
42
+ if (selection.kind !== "single") return;
43
+ isSearching.value = false;
44
+ setInputValue(selection.displayValue());
45
+ }
46
+ function resetQuery() {
47
+ if (searchValue.value === "") return;
48
+ setInputValue("");
49
+ options.onSearch("");
50
+ }
51
+ function focusInput() {
52
+ nextTick(() => options.inputRef.value?.focus());
53
+ }
54
+ function open() {
55
+ if (options.disabled() || isOpen.value) return;
56
+ isOpen.value = true;
57
+ syncInputToSelection();
58
+ optionCollection.activate("selected");
59
+ }
60
+ function close(restoreInput = true) {
61
+ isOpen.value = false;
62
+ optionCollection.reset();
63
+ if (restoreInput) syncInputToSelection();
64
+ }
65
+ function toggle() {
66
+ if (options.disabled()) return;
67
+ const wasOpen = isOpen.value;
68
+ if (wasOpen) close();
69
+ else open();
70
+ if (!wasOpen || selection.kind === "multiple") focusInput();
71
+ }
72
+ function restoreRejectedSingleSelection(option) {
73
+ if (selection.kind !== "single") return;
74
+ queueMicrotask(() => {
75
+ if (!(option ? selection.isSelected(option) : !selection.hasSelection()) && !isOpen.value) syncInputToSelection();
76
+ });
77
+ }
78
+ function selectOption(option) {
79
+ if (options.isDisabled(option)) return;
80
+ selection.select(option);
81
+ if (selection.kind === "single") {
82
+ isSearching.value = false;
83
+ setInputValue(option.label);
84
+ close(false);
85
+ restoreRejectedSingleSelection(option);
86
+ } else {
87
+ resetQuery();
88
+ optionCollection.activate(option);
89
+ }
90
+ focusInput();
91
+ }
92
+ function clearSelection() {
93
+ if (!canClear.value) return;
94
+ if (selection.kind === "single") {
95
+ isSearching.value = false;
96
+ setInputValue("");
97
+ options.onSearch("");
98
+ selection.clear();
99
+ close(false);
100
+ restoreRejectedSingleSelection();
101
+ } else {
102
+ selection.clear();
103
+ resetQuery();
104
+ }
105
+ focusInput();
106
+ }
107
+ function resetAfterFormReset() {
108
+ close();
109
+ if (selection.kind === "multiple") resetQuery();
110
+ }
111
+ function onOptionMouseenter(option) {
112
+ optionCollection.activate(option);
113
+ }
114
+ function onRootMousedown(event) {
115
+ if (selection.kind !== "multiple" || options.disabled()) return;
116
+ if (!isNodeWithinElement(event.target, options.inputRef.value) && isInteractiveElement(event.target)) return;
117
+ open();
118
+ options.inputRef.value?.focus();
119
+ }
120
+ function onFocusout(event) {
121
+ if (isNodeWithinElement(event.relatedTarget, options.rootRef.value)) return;
122
+ close();
123
+ }
124
+ function onInput(event) {
125
+ if (options.disabled()) return;
126
+ const value = event.currentTarget.value;
127
+ searchValue.value = value;
128
+ isSearching.value = true;
129
+ options.onSearch(value);
130
+ if (!isOpen.value) isOpen.value = true;
131
+ optionCollection.activate("first");
132
+ }
133
+ function onInputFocus() {
134
+ open();
135
+ }
136
+ function onInputClick() {
137
+ open();
138
+ }
139
+ function selectHighlightedOption() {
140
+ const option = visibleOptions.value[optionCollection.activeIndex.value];
141
+ if (option) selectOption(option);
142
+ }
143
+ function onInputKeydown(event) {
144
+ if (options.disabled() || event.isComposing) return;
145
+ switch (event.key) {
146
+ case "Enter":
147
+ if (!isOpen.value || selection.kind === "multiple" && optionCollection.activeIndex.value < 0) return;
148
+ event.preventDefault();
149
+ selectHighlightedOption();
150
+ break;
151
+ case "ArrowDown":
152
+ event.preventDefault();
153
+ if (!isOpen.value) open();
154
+ else optionCollection.move(1);
155
+ break;
156
+ case "ArrowUp":
157
+ event.preventDefault();
158
+ if (!isOpen.value) {
159
+ open();
160
+ optionCollection.activate("last");
161
+ } else optionCollection.move(-1);
162
+ break;
163
+ case "Backspace":
164
+ if (selection.kind === "multiple" && searchValue.value === "") selection.removeLast();
165
+ break;
166
+ case "Escape":
167
+ if (!isOpen.value) return;
168
+ event.preventDefault();
169
+ close();
170
+ break;
171
+ }
172
+ }
173
+ watch(itemsSnapshot, () => {
174
+ if (!isOpen.value || optionCollection.activeIndex.value >= 0) return;
175
+ if (selection.kind === "multiple" || isSearching.value) optionCollection.activate("first");
176
+ });
177
+ if (selection.kind === "single") watch(selection.displayValue, (value) => {
178
+ if (!isSearching.value) setInputValue(value);
179
+ });
180
+ watch(options.disabled, (disabled) => {
181
+ if (disabled) close();
182
+ });
183
+ useClickOutside(options.rootRef, isOpen, () => close());
184
+ return {
185
+ actions: {
186
+ clearSelection,
187
+ focusInput,
188
+ resetAfterFormReset,
189
+ selectOption,
190
+ toggle
191
+ },
192
+ handlers: {
193
+ onFocusout,
194
+ onInput,
195
+ onInputClick,
196
+ onInputFocus,
197
+ onInputKeydown,
198
+ onOptionMouseenter,
199
+ onRootMousedown
200
+ },
201
+ ids: {
202
+ listbox: `${popupId}-viewport`,
203
+ popup: popupId
204
+ },
205
+ state: {
206
+ activeDescendantId: optionCollection.activeDescendantId,
207
+ canClear,
208
+ isOpen,
209
+ renderedOptions: optionCollection.options,
210
+ searchValue,
211
+ visibleOptions
212
+ }
213
+ };
214
+ }
215
+ //#endregion
216
+ export { useEditableOptionList as t };