ropav 0.1.7 → 0.1.9

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 (167) hide show
  1. package/README.md +5 -4
  2. package/dist/ancestry.js +136 -0
  3. package/dist/calendar.css +184 -0
  4. package/dist/calendar.js +739 -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 +56 -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 +59 -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/slider/useSlider.d.ts +1 -1
  83. package/dist/components/slider/useSliderPointer.d.ts +15 -0
  84. package/dist/components/slider/useSliderValueState.d.ts +1 -0
  85. package/dist/components/tags-input/index.d.ts +3 -0
  86. package/dist/components/tags-input/index.js +2 -0
  87. package/dist/components/tags-input/tags-input.d.ts +27 -0
  88. package/dist/components/tags-input/tagsInputModel.d.ts +12 -0
  89. package/dist/components/tags-input/types.d.ts +37 -0
  90. package/dist/components/tags-input/useTagsInput.d.ts +23 -0
  91. package/dist/components/toolbar/index.d.ts +3 -0
  92. package/dist/components/toolbar/index.js +2 -0
  93. package/dist/components/toolbar/toolbar.d.ts +24 -0
  94. package/dist/components/toolbar/types.d.ts +12 -0
  95. package/dist/components/toolbar/useToolbar.d.ts +7 -0
  96. package/dist/components/tooltip/useTooltipTargetBindings.d.ts +12 -0
  97. package/dist/date-picker.css +49 -0
  98. package/dist/date-picker.js +811 -0
  99. package/dist/dialog.js +9 -20
  100. package/dist/direction.js +6 -0
  101. package/dist/dropdown-menu.css +21 -3
  102. package/dist/dropdown-menu.js +341 -261
  103. package/dist/dropzone.css +135 -0
  104. package/dist/dropzone.js +431 -0
  105. package/dist/file-input.css +135 -0
  106. package/dist/file-input.js +198 -0
  107. package/dist/focusNavigation.js +12 -6
  108. package/dist/hover-card.css +80 -0
  109. package/dist/hover-card.js +402 -0
  110. package/dist/index.d.ts +10 -0
  111. package/dist/index.js +15 -3
  112. package/dist/internal/composables/useOverlayLayer.d.ts +12 -0
  113. package/dist/modal.js +1 -1
  114. package/dist/multi-select.css +316 -0
  115. package/dist/multi-select.js +481 -0
  116. package/dist/nativeChoice.js +169 -0
  117. package/dist/number-input.css +18 -18
  118. package/dist/number-input.js +36 -38
  119. package/dist/pagination.js +1 -10
  120. package/dist/pointerSession.js +130 -0
  121. package/dist/popover.css +21 -3
  122. package/dist/popover.js +37 -62
  123. package/dist/scroll-area.js +52 -62
  124. package/dist/segmented-control.css +176 -0
  125. package/dist/segmented-control.js +382 -0
  126. package/dist/select.css +50 -48
  127. package/dist/select.js +121 -271
  128. package/dist/slider.css +78 -69
  129. package/dist/slider.js +161 -145
  130. package/dist/tags-input.css +197 -0
  131. package/dist/tags-input.js +380 -0
  132. package/dist/toolbar.css +15 -0
  133. package/dist/toolbar.js +143 -0
  134. package/dist/tooltip.js +35 -30
  135. package/dist/useEditableOptionList.js +216 -0
  136. package/dist/useFlatOptionCollection.js +134 -0
  137. package/dist/useFloatingPosition.js +4 -160
  138. package/dist/useFloatingTargetLifecycle.js +127 -0
  139. package/dist/useFormControl.js +1 -0
  140. package/dist/{floating.js → useHoverDisclosure.js} +338 -421
  141. package/dist/useNativeChoiceTransaction.js +46 -0
  142. package/dist/useNativeFileSelection.js +86 -0
  143. package/dist/useOverlayZIndex.js +246 -15
  144. package/dist/utils/date.d.ts +13 -0
  145. package/dist/utils/dateAvailability.d.ts +7 -0
  146. package/dist/utils/dom/ancestry.d.ts +1 -0
  147. package/dist/utils/dom/direction.d.ts +2 -0
  148. package/dist/utils/dom/files.d.ts +3 -0
  149. package/dist/utils/dom/focusNavigation.d.ts +4 -1
  150. package/dist/utils/dom/nativeChoice.d.ts +17 -0
  151. package/dist/utils/dom/pointerSession.d.ts +20 -0
  152. package/dist/utils/dom/scroll.d.ts +2 -1
  153. package/dist/utils/optionFilter.d.ts +5 -0
  154. package/docs/public-floating-api.md +7 -4
  155. package/docs/public-styles-api.md +28 -12
  156. package/package.json +68 -40
  157. package/src/styles/_mixins.scss +26 -0
  158. package/src/styles/styles-manifest.json +1 -2
  159. package/dist/components/floating/hoverDisclosureInteractionModel.d.ts +0 -42
  160. package/dist/components/floating/useHoverDisclosureInteractions.d.ts +0 -32
  161. package/dist/components/floating/useHoverDisclosureOpenState.d.ts +0 -25
  162. package/dist/components/floating/useHoverDisclosureTargetBinding.d.ts +0 -27
  163. package/dist/components/select/useSelectNativeControl.d.ts +0 -9
  164. package/dist/components/select/useSelectNativeValue.d.ts +0 -9
  165. package/dist/pointer.js +0 -9
  166. package/dist/utils/dom/pointer.d.ts +0 -2
  167. package/docs/code-architecture.md +0 -118
@@ -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 };
@@ -0,0 +1,15 @@
1
+ @layer ropav.components {
2
+ .rp-toolbar[data-v-34ce03a4] {
3
+ box-sizing: border-box;
4
+ display: flex;
5
+ align-items: center;
6
+ gap: var(--rp-spacing-2);
7
+ min-width: 0;
8
+ font-family: var(--rp-font-family);
9
+ }
10
+ .rp-toolbar--vertical[data-v-34ce03a4] {
11
+ flex-direction: column;
12
+ align-items: stretch;
13
+ min-height: 0;
14
+ }
15
+ }
@@ -0,0 +1,143 @@
1
+ import './toolbar.css';
2
+ import { t as useStylesApi } from "./styles-api.js";
3
+ import { t as bem } from "./bem.js";
4
+ import { t as isElement } from "./query.js";
5
+ import { n as setFocusNavigationTabStop, t as getFocusNavigationTarget } from "./focusNavigation.js";
6
+ import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
7
+ import { computed, createSlot, defineVaporComponent, onBeforeUnmount, onMounted, renderEffect, setDynamicProps, setInsertionState, setStaticTemplateRef, shallowRef, template } from "vue";
8
+ //#region src/components/toolbar/useToolbar.ts
9
+ var TOOLBAR_SELECTOR = "[role=\"toolbar\"]";
10
+ var TOOLBAR_ITEM_SELECTOR = [
11
+ "button",
12
+ "a[href]",
13
+ "input:not([type=\"hidden\"])",
14
+ "select",
15
+ "textarea",
16
+ "[contenteditable=\"true\"]",
17
+ "[role=\"button\"]",
18
+ "[role=\"checkbox\"]",
19
+ "[role=\"combobox\"]",
20
+ "[role=\"link\"]",
21
+ "[role=\"radio\"]",
22
+ "[role=\"slider\"]",
23
+ "[role=\"spinbutton\"]",
24
+ "[role=\"switch\"]",
25
+ "[tabindex]"
26
+ ].join(",");
27
+ var TOOLBAR_NAVIGATION_OPTIONS = {
28
+ itemSelector: TOOLBAR_ITEM_SELECTOR,
29
+ collectionSelector: TOOLBAR_SELECTOR
30
+ };
31
+ function useToolbar(root, getOrientation) {
32
+ const activeItem = shallowRef(null);
33
+ let observer = null;
34
+ function setTabStop(item) {
35
+ const toolbar = root.value;
36
+ if (!toolbar) return null;
37
+ const nextItem = setFocusNavigationTabStop(toolbar, item, TOOLBAR_NAVIGATION_OPTIONS);
38
+ activeItem.value = nextItem;
39
+ return nextItem;
40
+ }
41
+ function syncTabStop() {
42
+ setTabStop(activeItem.value);
43
+ }
44
+ function onFocusin(event) {
45
+ const toolbar = root.value;
46
+ if (!toolbar || !isElement(event.target)) return;
47
+ const item = event.target.closest(TOOLBAR_ITEM_SELECTOR);
48
+ if (item?.closest(TOOLBAR_SELECTOR) === toolbar) setTabStop(item);
49
+ }
50
+ function onKeydown(event) {
51
+ const toolbar = root.value;
52
+ if (!toolbar) return;
53
+ const nextItem = getFocusNavigationTarget(event, toolbar, {
54
+ ...TOOLBAR_NAVIGATION_OPTIONS,
55
+ orientation: getOrientation()
56
+ });
57
+ if (!nextItem) return;
58
+ event.preventDefault();
59
+ setTabStop(nextItem);
60
+ nextItem.focus();
61
+ }
62
+ function focus() {
63
+ setTabStop(activeItem.value)?.focus();
64
+ }
65
+ onMounted(() => {
66
+ const toolbar = root.value;
67
+ if (!toolbar) return;
68
+ syncTabStop();
69
+ const MutationObserverConstructor = toolbar.ownerDocument.defaultView?.MutationObserver;
70
+ if (!MutationObserverConstructor) return;
71
+ observer = new MutationObserverConstructor(syncTabStop);
72
+ observer.observe(toolbar, {
73
+ attributes: true,
74
+ attributeFilter: [
75
+ "disabled",
76
+ "hidden",
77
+ "inert"
78
+ ],
79
+ childList: true,
80
+ subtree: true
81
+ });
82
+ });
83
+ onBeforeUnmount(() => observer?.disconnect());
84
+ return {
85
+ focus,
86
+ onFocusin,
87
+ onKeydown
88
+ };
89
+ }
90
+ //#endregion
91
+ //#region src/components/toolbar/toolbar.vue?vue&type=script&setup=true&vapor=true&lang.ts
92
+ var t0 = template("<div data-v-34ce03a4>", 1);
93
+ //#endregion
94
+ //#region src/components/toolbar/toolbar.vue
95
+ var toolbar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
96
+ name: "RpToolbar",
97
+ inheritAttrs: false,
98
+ __name: "toolbar",
99
+ props: {
100
+ id: {},
101
+ orientation: { default: "horizontal" },
102
+ ariaLabel: {},
103
+ describedby: {},
104
+ labelledby: {},
105
+ classNames: {},
106
+ styles: {}
107
+ },
108
+ setup(__props, { expose: __expose }) {
109
+ const props = __props;
110
+ const root = shallowRef(null);
111
+ const { focus, onFocusin, onKeydown } = useToolbar(root, () => props.orientation);
112
+ const rootClass = computed(() => bem("rp-toolbar", { vertical: props.orientation === "vertical" }));
113
+ const { getRootAttrs } = useStylesApi(props, "root");
114
+ const rootAttrs = computed(() => getRootAttrs({
115
+ id: props.id,
116
+ class: rootClass.value,
117
+ role: "toolbar",
118
+ "data-orientation": props.orientation,
119
+ "aria-orientation": props.orientation,
120
+ "aria-label": props.ariaLabel || void 0,
121
+ "aria-labelledby": props.labelledby,
122
+ "aria-describedby": props.describedby,
123
+ onFocusin,
124
+ onKeydown
125
+ }));
126
+ __expose({
127
+ nativeElement: root,
128
+ focus
129
+ });
130
+ const n1 = t0();
131
+ renderEffect(() => setDynamicProps(n1, [rootAttrs.value]));
132
+ setInsertionState(n1, null, 0);
133
+ createSlot("default", null, null, 1);
134
+ setStaticTemplateRef(n1, root, null, "root");
135
+ return n1;
136
+ }
137
+ }), [["__scopeId", "data-v-34ce03a4"]]);
138
+ //#endregion
139
+ //#region src/components/toolbar/types.ts
140
+ var toolbarParts = ["root"];
141
+ var toolbarOrientations = ["horizontal", "vertical"];
142
+ //#endregion
143
+ export { toolbarParts as n, toolbar_default as r, toolbarOrientations 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,