ropav 0.0.10 → 0.0.12
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.
- package/README.md +9 -0
- package/dist/accordion.css +115 -111
- package/dist/accordion.js +60 -16
- package/dist/alert.css +110 -108
- package/dist/alert.js +48 -26
- package/dist/aspect-ratio.css +17 -15
- package/dist/aspect-ratio.js +20 -6
- package/dist/avatar.css +98 -96
- package/dist/avatar.js +27 -16
- package/dist/badge.css +95 -93
- package/dist/badge.js +29 -16
- package/dist/base.css +672 -671
- package/dist/button-group.css +39 -37
- package/dist/button-group.js +23 -12
- package/dist/button-link.css +160 -158
- package/dist/button-link.js +43 -24
- package/dist/button.css +160 -158
- package/dist/button.js +37 -19
- package/dist/card.css +109 -107
- package/dist/card.js +42 -17
- package/dist/checkbox.css +139 -137
- package/dist/checkbox.js +103 -33
- package/dist/collapse.css +29 -27
- package/dist/collapse.js +44 -10
- package/dist/color-input.css +137 -107
- package/dist/color-input.js +117 -30
- package/dist/color-picker.css +309 -303
- package/dist/color-picker.js +147 -54
- package/dist/color-picker2.js +9 -1
- package/dist/color-swatch.css +48 -46
- package/dist/color-swatch.js +15 -11
- package/dist/color-swatch2.js +4 -0
- package/dist/components/accordion/accordion-item.d.ts +13 -1
- package/dist/components/accordion/index.d.ts +2 -1
- package/dist/components/accordion/index.js +2 -2
- package/dist/components/accordion/types.d.ts +9 -4
- package/dist/components/alert/alert.d.ts +2 -2
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert/index.js +2 -2
- package/dist/components/alert/types.d.ts +4 -1
- package/dist/components/aspect-ratio/index.d.ts +2 -1
- package/dist/components/aspect-ratio/index.js +2 -2
- package/dist/components/aspect-ratio/types.d.ts +4 -1
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/avatar/index.js +2 -2
- package/dist/components/avatar/types.d.ts +4 -1
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/badge/index.js +2 -2
- package/dist/components/badge/types.d.ts +4 -1
- package/dist/components/button/index.d.ts +2 -1
- package/dist/components/button/index.js +2 -2
- package/dist/components/button/types.d.ts +4 -1
- package/dist/components/button-group/index.d.ts +2 -1
- package/dist/components/button-group/index.js +2 -2
- package/dist/components/button-group/types.d.ts +4 -1
- package/dist/components/button-link/index.d.ts +2 -1
- package/dist/components/button-link/index.js +2 -2
- package/dist/components/button-link/types.d.ts +4 -1
- package/dist/components/card/index.d.ts +2 -1
- package/dist/components/card/index.js +2 -2
- package/dist/components/card/types.d.ts +5 -1
- package/dist/components/checkbox/checkbox.d.ts +4 -1
- package/dist/components/checkbox/index.d.ts +2 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/checkbox/types.d.ts +11 -2
- package/dist/components/checkbox/useCheckbox.d.ts +3 -1
- package/dist/components/collapse/collapse.d.ts +2 -2
- package/dist/components/collapse/index.d.ts +2 -1
- package/dist/components/collapse/index.js +2 -2
- package/dist/components/collapse/types.d.ts +9 -2
- package/dist/components/color-input/index.d.ts +2 -1
- package/dist/components/color-input/index.js +2 -2
- package/dist/components/color-input/types.d.ts +8 -2
- package/dist/components/color-input/useColorInput.d.ts +1 -1
- package/dist/components/color-input/useColorInputValue.d.ts +1 -1
- package/dist/components/color-picker/index.d.ts +2 -2
- package/dist/components/color-picker/index.js +2 -2
- package/dist/components/color-picker/types.d.ts +13 -1
- package/dist/components/color-swatch/index.d.ts +2 -1
- package/dist/components/color-swatch/index.js +2 -1
- package/dist/components/color-swatch/types.d.ts +4 -1
- package/dist/components/dialog/dialog-close.d.ts +21 -0
- package/dist/components/dialog/dialog-content.d.ts +32 -0
- package/dist/components/dialog/dialog-core.d.ts +27 -0
- package/dist/components/dialog/dialog-description.d.ts +21 -0
- package/dist/components/dialog/dialog-overlay.d.ts +21 -0
- package/dist/components/dialog/dialog-portal.d.ts +21 -0
- package/dist/components/dialog/dialog-root.d.ts +28 -0
- package/dist/components/dialog/dialog-title.d.ts +21 -0
- package/dist/components/dialog/dialog-trigger.d.ts +23 -0
- package/dist/components/dialog/index.d.ts +9 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/dialog/types.d.ts +61 -0
- package/dist/components/dropdown-menu/dropdown-menu-checkbox-item.d.ts +24 -0
- package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +34 -0
- package/dist/components/dropdown-menu/dropdown-menu-context-trigger.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-indicator.d.ts +24 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-row.d.ts +28 -0
- package/dist/components/dropdown-menu/dropdown-menu-item.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu-items.d.ts +24 -22
- package/dist/components/dropdown-menu/dropdown-menu-label.d.ts +21 -0
- package/dist/components/dropdown-menu/dropdown-menu-outside.d.ts +3 -0
- package/dist/components/dropdown-menu/dropdown-menu-portal.d.ts +21 -0
- package/dist/components/dropdown-menu/dropdown-menu-primitive-core.d.ts +110 -0
- package/dist/components/dropdown-menu/dropdown-menu-primitives.d.ts +15 -0
- package/dist/components/dropdown-menu/dropdown-menu-radio-group.d.ts +25 -0
- package/dist/components/dropdown-menu/dropdown-menu-radio-item.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu-root.d.ts +30 -0
- package/dist/components/dropdown-menu/dropdown-menu-separator.d.ts +19 -0
- package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +34 -0
- package/dist/components/dropdown-menu/dropdown-menu-sub-trigger.d.ts +28 -0
- package/dist/components/dropdown-menu/dropdown-menu-sub.d.ts +28 -0
- package/dist/components/dropdown-menu/dropdown-menu-trigger.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +6 -3
- package/dist/components/dropdown-menu/index.d.ts +32 -1
- package/dist/components/dropdown-menu/index.js +2 -2
- package/dist/components/dropdown-menu/types.d.ts +145 -6
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts +15 -3
- package/dist/components/dropdown-menu/useDropdownMenuDisclosure.d.ts +10 -3
- package/dist/components/dropdown-menu/useDropdownMenuDom.d.ts +2 -1
- package/dist/components/dropdown-menu/useDropdownMenuInteractions.d.ts +4 -4
- package/dist/components/dropdown-menu/useDropdownMenuPortalPosition.d.ts +19 -0
- package/dist/components/dropdown-menu/useDropdownMenuPrimitiveContent.d.ts +27 -0
- package/dist/components/dropdown-menu/useDropdownMenuRenderItems.d.ts +14 -2
- package/dist/components/field/index.d.ts +2 -1
- package/dist/components/field/index.js +2 -2
- package/dist/components/field/types.d.ts +4 -1
- package/dist/components/floating/index.d.ts +3 -0
- package/dist/components/floating/index.js +3 -0
- package/dist/components/floating/types.d.ts +105 -0
- package/dist/components/floating/useFloatingPosition.d.ts +15 -0
- package/dist/components/floating/useHoverDisclosure.d.ts +2 -0
- package/dist/components/focus-trap/focus-trap.d.ts +31 -0
- package/dist/components/focus-trap/index.d.ts +4 -0
- package/dist/components/focus-trap/index.js +3 -0
- package/dist/components/focus-trap/types.d.ts +41 -0
- package/dist/components/focus-trap/useFocusTrap.d.ts +2 -0
- package/dist/components/icon-button/index.d.ts +2 -1
- package/dist/components/icon-button/index.js +2 -1
- package/dist/components/icon-button/types.d.ts +4 -1
- package/dist/components/input/index.d.ts +2 -1
- package/dist/components/input/index.js +2 -1
- package/dist/components/input/input.d.ts +4 -1
- package/dist/components/input/types.d.ts +7 -2
- package/dist/components/modal/index.d.ts +2 -1
- package/dist/components/modal/index.js +2 -2
- package/dist/components/modal/modal.d.ts +3 -1
- package/dist/components/modal/types.d.ts +11 -1
- package/dist/components/modal/useModal.d.ts +7 -4
- package/dist/components/number-input/index.d.ts +2 -1
- package/dist/components/number-input/index.js +2 -2
- package/dist/components/number-input/types.d.ts +7 -2
- package/dist/components/number-input/useNumberInput.d.ts +2 -1
- package/dist/components/overlay/index.d.ts +2 -1
- package/dist/components/overlay/index.js +2 -1
- package/dist/components/overlay/types.d.ts +4 -1
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/index.js +2 -2
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/popover/types.d.ts +20 -11
- package/dist/components/popover/usePopover.d.ts +9 -1
- package/dist/components/progress/index.d.ts +2 -2
- package/dist/components/progress/index.js +2 -2
- package/dist/components/progress/types.d.ts +4 -1
- package/dist/components/radio/index.d.ts +2 -1
- package/dist/components/radio/index.js +2 -2
- package/dist/components/radio/radio.d.ts +8 -3
- package/dist/components/radio/types.d.ts +37 -4
- package/dist/components/radio/useRadio.d.ts +12 -4
- package/dist/components/select/index.d.ts +2 -1
- package/dist/components/select/index.js +2 -2
- package/dist/components/select/select.d.ts +4 -1
- package/dist/components/select/types.d.ts +10 -2
- package/dist/components/select/useSelect.d.ts +3 -1
- package/dist/components/slider/index.d.ts +2 -2
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/range-slider-tooltip.d.ts +3 -0
- package/dist/components/slider/range-slider.d.ts +7 -4
- package/dist/components/slider/slider.d.ts +4 -1
- package/dist/components/slider/sliderCore.d.ts +4 -4
- package/dist/components/slider/types.d.ts +22 -4
- package/dist/components/slider/useRangeSlider.d.ts +2 -2
- package/dist/components/slider/useSlider.d.ts +2 -2
- package/dist/components/switch/index.d.ts +2 -1
- package/dist/components/switch/index.js +2 -2
- package/dist/components/switch/switch.d.ts +4 -1
- package/dist/components/switch/types.d.ts +11 -2
- package/dist/components/switch/useSwitch.d.ts +3 -1
- package/dist/components/tabs/index.d.ts +2 -1
- package/dist/components/tabs/index.js +2 -2
- package/dist/components/tabs/types.d.ts +13 -4
- package/dist/components/teleport-provider/index.d.ts +3 -0
- package/dist/components/teleport-provider/index.js +3 -0
- package/dist/components/teleport-provider/teleport-provider.d.ts +21 -0
- package/dist/components/teleport-provider/types.d.ts +4 -0
- package/dist/components/teleport-provider/useTeleportTarget.d.ts +6 -0
- package/dist/components/textarea/index.d.ts +2 -1
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/textarea/textarea.d.ts +4 -1
- package/dist/components/textarea/types.d.ts +10 -2
- package/dist/components/textarea/useTextarea.d.ts +2 -1
- package/dist/components/toast/index.d.ts +3 -2
- package/dist/components/toast/index.js +2 -2
- package/dist/components/toast/toast-store.d.ts +2 -0
- package/dist/components/toast/toast.d.ts +2 -2
- package/dist/components/toast/types.d.ts +20 -10
- package/dist/components/toast/useToast.d.ts +2 -2
- package/dist/components/tooltip/index.d.ts +2 -1
- package/dist/components/tooltip/index.js +2 -1
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/components/tooltip/types.d.ts +13 -12
- package/dist/components/tooltip/useTooltip.d.ts +12 -2
- package/dist/composables/useOverlayLayer.d.ts +32 -0
- package/dist/dialog.js +510 -0
- package/dist/dropdown-menu.css +191 -108
- package/dist/dropdown-menu.js +1954 -198
- package/dist/field.css +41 -39
- package/dist/field.js +40 -16
- package/dist/floating.js +403 -0
- package/dist/focus-trap.js +80 -0
- package/dist/icon-button.css +193 -189
- package/dist/icon-button.js +23 -18
- package/dist/icon-button2.js +8 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +39 -32
- package/dist/input.css +122 -120
- package/dist/input.js +63 -40
- package/dist/input2.js +9 -0
- package/dist/legacy-unlayered.css +5382 -0
- package/dist/modal.css +129 -127
- package/dist/modal.js +182 -281
- package/dist/number-input.css +87 -85
- package/dist/number-input.js +98 -26
- package/dist/overlay.css +26 -24
- package/dist/overlay.js +17 -9
- package/dist/overlay2.js +4 -0
- package/dist/popover.css +140 -107
- package/dist/popover.js +276 -196
- package/dist/popover2.js +6 -1
- package/dist/progress.css +101 -99
- package/dist/progress.js +50 -28
- package/dist/radio.css +114 -105
- package/dist/radio.js +237 -61
- package/dist/select.css +255 -242
- package/dist/select.js +257 -94
- package/dist/slider.css +1090 -1031
- package/dist/slider.js +443 -175
- package/dist/styles-api.d.ts +22 -0
- package/dist/styles-api.js +49 -0
- package/dist/switch.css +120 -108
- package/dist/switch.js +112 -38
- package/dist/tabs.css +286 -278
- package/dist/tabs.js +60 -21
- package/dist/teleport-provider.js +15 -0
- package/dist/textarea.css +132 -130
- package/dist/textarea.js +83 -31
- package/dist/toast.css +229 -225
- package/dist/toast.js +189 -118
- package/dist/tooltip.css +61 -106
- package/dist/tooltip.js +184 -228
- package/dist/tooltip2.js +8 -0
- package/dist/useControlState.js +4 -0
- package/dist/useFloatingPosition.js +1317 -0
- package/dist/useFocusTrap.js +130 -0
- package/dist/useFormControl.js +107 -0
- package/dist/useOverlayLayer.js +262 -0
- package/dist/useTeleportTarget.js +40 -0
- package/docs/public-floating-api.md +148 -0
- package/docs/public-styles-api.md +134 -0
- package/docs/public-tokens.md +545 -0
- package/package.json +37 -9
- package/src/styles/_tokens.scss +33 -28
- package/src/styles/_utilities.scss +11 -9
- package/src/styles/styles-manifest.json +4125 -0
- package/dist/rafScheduler.js +0 -34
- package/dist/useClickOutside.js +0 -24
package/dist/toast.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import './toast.css';
|
|
2
2
|
import { t as x_default } from "./x.js";
|
|
3
3
|
import { t as bem } from "./bem.js";
|
|
4
|
+
import { n as useStylesApi } from "./styles-api.js";
|
|
4
5
|
import { i as getComponentVariantColorRoles, t as componentColors } from "./componentColors.js";
|
|
5
6
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
6
|
-
import {
|
|
7
|
+
import { r as useTeleportTarget } from "./useTeleportTarget.js";
|
|
8
|
+
import { VaporTeleport, VaporTransition, VaporTransitionGroup, computed, createComponent, createFor, createIf, createInvoker, createSlot, defineVaporComponent, delegateEvents, extend, inject, nextTick, onBeforeUnmount, onMounted, provide, ref, renderEffect, setDynamicProps, setInsertionState, setText, template, toDisplayString, toValue, txt, unref, useSlots, watch } from "vue";
|
|
7
9
|
//#region src/components/toast/defaults.ts
|
|
8
10
|
var DEFAULT_TOAST_DURATION = 5e3;
|
|
9
11
|
var DEFAULT_TOAST_ROLE = "status";
|
|
@@ -30,20 +32,17 @@ function getToastColorStyle(color, variant, autoContrast) {
|
|
|
30
32
|
}
|
|
31
33
|
//#endregion
|
|
32
34
|
//#region src/components/toast/toast.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
33
|
-
var t0$1 = template("<div data-v-
|
|
35
|
+
var t0$1 = template("<div data-v-6944ac43>");
|
|
34
36
|
var t1 = template(" ");
|
|
35
|
-
var t2 = template("<
|
|
36
|
-
var t3 = template("<
|
|
37
|
-
var t4 = template("<
|
|
38
|
-
|
|
39
|
-
var t6 = template("<div data-v-face18fc class=rp-toast__action>");
|
|
40
|
-
var t7 = template("<button data-v-face18fc class=rp-toast__close type=button>");
|
|
41
|
-
var t8 = template("<div data-v-face18fc>");
|
|
42
|
-
delegateEvents("click", "focusin", "focusout");
|
|
37
|
+
var t2 = template("<p data-v-6944ac43> ");
|
|
38
|
+
var t3 = template("<div data-v-6944ac43 class=rp-toast__content>");
|
|
39
|
+
var t4 = template("<button data-v-6944ac43>");
|
|
40
|
+
delegateEvents("click");
|
|
43
41
|
//#endregion
|
|
44
42
|
//#region src/components/toast/toast.vue
|
|
45
43
|
var toast_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
46
44
|
name: "RpToast",
|
|
45
|
+
inheritAttrs: false,
|
|
47
46
|
__name: "toast",
|
|
48
47
|
props: {
|
|
49
48
|
open: {
|
|
@@ -70,7 +69,9 @@ var toast_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
70
69
|
type: Boolean,
|
|
71
70
|
default: true
|
|
72
71
|
},
|
|
73
|
-
closeLabel: { default: DEFAULT_TOAST_CLOSE_LABEL }
|
|
72
|
+
closeLabel: { default: DEFAULT_TOAST_CLOSE_LABEL },
|
|
73
|
+
classNames: {},
|
|
74
|
+
styles: {}
|
|
74
75
|
},
|
|
75
76
|
emits: [
|
|
76
77
|
"update:open",
|
|
@@ -114,6 +115,16 @@ var toast_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
114
115
|
[`radius-${props.radius}`]: Boolean(props.radius)
|
|
115
116
|
}));
|
|
116
117
|
const rootStyle = computed(() => getToastColorStyle(props.color, props.variant, props.autoContrast));
|
|
118
|
+
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
119
|
+
const rootAttrs = computed(() => getRootAttrs({
|
|
120
|
+
class: rootClass.value,
|
|
121
|
+
style: rootStyle.value,
|
|
122
|
+
role: resolvedRole.value,
|
|
123
|
+
onMouseenter,
|
|
124
|
+
onMouseleave,
|
|
125
|
+
onFocusin,
|
|
126
|
+
onFocusout
|
|
127
|
+
}));
|
|
117
128
|
watch([isOpen, () => props.duration], ([open], [wasOpen]) => {
|
|
118
129
|
if (!isMounted.value) return;
|
|
119
130
|
if (!open || !wasOpen) {
|
|
@@ -201,25 +212,23 @@ var toast_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
201
212
|
onAfterLeave: () => _on_after_leave
|
|
202
213
|
}, extend(() => {
|
|
203
214
|
return createIf(() => isOpen.value, () => {
|
|
204
|
-
const n30 =
|
|
205
|
-
renderEffect(() =>
|
|
206
|
-
setClass(n30, rootClass.value);
|
|
207
|
-
setStyle(n30, rootStyle.value);
|
|
208
|
-
setProp(n30, "role", resolvedRole.value);
|
|
209
|
-
});
|
|
215
|
+
const n30 = t0$1();
|
|
216
|
+
renderEffect(() => setDynamicProps(n30, [rootAttrs.value]));
|
|
210
217
|
setInsertionState(n30, null, 0);
|
|
211
218
|
createIf(() => hasIcon.value, () => {
|
|
212
219
|
const n5 = t0$1();
|
|
220
|
+
renderEffect(() => setDynamicProps(n5, [unref(getPartAttrs)("icon", { class: "rp-toast__icon" }), { "aria-hidden": "true" }]));
|
|
213
221
|
setInsertionState(n5, null, 0);
|
|
214
222
|
createSlot("icon", null, null, 1);
|
|
215
223
|
return n5;
|
|
216
224
|
});
|
|
217
225
|
setInsertionState(n30, null, 1);
|
|
218
226
|
createIf(() => hasContent.value, () => {
|
|
219
|
-
const n21 =
|
|
227
|
+
const n21 = t3();
|
|
220
228
|
setInsertionState(n21, null, 0);
|
|
221
229
|
createIf(() => hasTitle.value, () => {
|
|
222
|
-
const n13 =
|
|
230
|
+
const n13 = t0$1();
|
|
231
|
+
renderEffect(() => setDynamicProps(n13, [unref(getPartAttrs)("title", { class: "rp-toast__title" })]));
|
|
223
232
|
setInsertionState(n13, null, 0);
|
|
224
233
|
createSlot("title", null, () => {
|
|
225
234
|
const n12 = t1();
|
|
@@ -230,14 +239,18 @@ var toast_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
230
239
|
});
|
|
231
240
|
setInsertionState(n21, null, 1);
|
|
232
241
|
createIf(() => hasDescription.value, () => {
|
|
233
|
-
const n16 =
|
|
242
|
+
const n16 = t2();
|
|
234
243
|
const x16 = txt(n16);
|
|
235
|
-
renderEffect(() =>
|
|
244
|
+
renderEffect(() => {
|
|
245
|
+
setDynamicProps(n16, [unref(getPartAttrs)("description", { class: "rp-toast__description" })]);
|
|
246
|
+
setText(x16, toDisplayString(__props.description));
|
|
247
|
+
});
|
|
236
248
|
return n16;
|
|
237
249
|
});
|
|
238
250
|
setInsertionState(n21, null, 2);
|
|
239
251
|
createIf(() => $slots.default, () => {
|
|
240
|
-
const n20 =
|
|
252
|
+
const n20 = t0$1();
|
|
253
|
+
renderEffect(() => setDynamicProps(n20, [unref(getPartAttrs)("body", { class: "rp-toast__body" })]));
|
|
241
254
|
setInsertionState(n20, null, 0);
|
|
242
255
|
createSlot("default", null, null, 1);
|
|
243
256
|
return n20;
|
|
@@ -246,64 +259,31 @@ var toast_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
246
259
|
});
|
|
247
260
|
setInsertionState(n30, null, 2);
|
|
248
261
|
createIf(() => $slots.action, () => {
|
|
249
|
-
const n25 =
|
|
262
|
+
const n25 = t0$1();
|
|
263
|
+
renderEffect(() => setDynamicProps(n25, [unref(getPartAttrs)("action", { class: "rp-toast__action" })]));
|
|
250
264
|
setInsertionState(n25, null, 0);
|
|
251
265
|
createSlot("action", null, null, 1);
|
|
252
266
|
return n25;
|
|
253
267
|
});
|
|
254
268
|
setInsertionState(n30, null, 3);
|
|
255
269
|
createIf(() => __props.closable, () => {
|
|
256
|
-
const n29 =
|
|
257
|
-
renderEffect(() =>
|
|
270
|
+
const n29 = t4();
|
|
271
|
+
renderEffect(() => setDynamicProps(n29, [unref(getPartAttrs)("close", { class: "rp-toast__close" }), {
|
|
272
|
+
type: "button",
|
|
273
|
+
"aria-label": __props.closeLabel
|
|
274
|
+
}]));
|
|
258
275
|
setInsertionState(n29, null, 0);
|
|
259
276
|
createComponent(unref(x_default), { "aria-hidden": "true" });
|
|
260
277
|
n29.$evtclick = createInvoker(() => closeToast("dismiss"));
|
|
261
278
|
return n29;
|
|
262
279
|
});
|
|
263
|
-
on(n30, "mouseenter", onMouseenter);
|
|
264
|
-
on(n30, "mouseleave", onMouseleave);
|
|
265
|
-
n30.$evtfocusin = createInvoker(onFocusin);
|
|
266
|
-
n30.$evtfocusout = createInvoker(onFocusout);
|
|
267
280
|
return n30;
|
|
268
281
|
}, null, 129);
|
|
269
282
|
}, { _: 8 }), true);
|
|
270
283
|
}
|
|
271
|
-
}), [["__scopeId", "data-v-
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region src/components/toast/types.ts
|
|
274
|
-
var toastColors = componentColors;
|
|
275
|
-
var toastVariants = [
|
|
276
|
-
"subtle",
|
|
277
|
-
"surface",
|
|
278
|
-
"outline",
|
|
279
|
-
"solid"
|
|
280
|
-
];
|
|
281
|
-
var toastRadiuses = [
|
|
282
|
-
"none",
|
|
283
|
-
"xs",
|
|
284
|
-
"sm",
|
|
285
|
-
"md",
|
|
286
|
-
"lg",
|
|
287
|
-
"xl"
|
|
288
|
-
];
|
|
289
|
-
var toastPositions = [
|
|
290
|
-
"top-left",
|
|
291
|
-
"top-center",
|
|
292
|
-
"top-right",
|
|
293
|
-
"bottom-left",
|
|
294
|
-
"bottom-center",
|
|
295
|
-
"bottom-right"
|
|
296
|
-
];
|
|
297
|
-
var toastTypes = [
|
|
298
|
-
"default",
|
|
299
|
-
"success",
|
|
300
|
-
"error",
|
|
301
|
-
"warning",
|
|
302
|
-
"info"
|
|
303
|
-
];
|
|
304
|
-
var toastProviderKey = Symbol("toast-provider");
|
|
284
|
+
}), [["__scopeId", "data-v-6944ac43"]]);
|
|
305
285
|
//#endregion
|
|
306
|
-
//#region src/components/toast/
|
|
286
|
+
//#region src/components/toast/toast-store.ts
|
|
307
287
|
var TYPE_DEFAULTS = {
|
|
308
288
|
default: {},
|
|
309
289
|
success: { color: "green" },
|
|
@@ -340,18 +320,18 @@ function splitOptions(options) {
|
|
|
340
320
|
toastProps: withoutUndefined(toastProps)
|
|
341
321
|
};
|
|
342
322
|
}
|
|
343
|
-
function
|
|
323
|
+
function getStoreDefaults(options) {
|
|
344
324
|
return withoutUndefined({
|
|
345
|
-
duration:
|
|
346
|
-
variant:
|
|
347
|
-
color:
|
|
348
|
-
autoContrast:
|
|
349
|
-
radius:
|
|
350
|
-
role:
|
|
351
|
-
pauseOnHover:
|
|
352
|
-
pauseOnFocus:
|
|
353
|
-
closable:
|
|
354
|
-
closeLabel:
|
|
325
|
+
duration: options.duration ?? 5e3,
|
|
326
|
+
variant: options.variant,
|
|
327
|
+
color: options.color,
|
|
328
|
+
autoContrast: options.autoContrast,
|
|
329
|
+
radius: options.radius,
|
|
330
|
+
role: options.role,
|
|
331
|
+
pauseOnHover: options.pauseOnHover ?? true,
|
|
332
|
+
pauseOnFocus: options.pauseOnFocus ?? true,
|
|
333
|
+
closable: options.closable ?? true,
|
|
334
|
+
closeLabel: options.closeLabel ?? "Close toast"
|
|
355
335
|
});
|
|
356
336
|
}
|
|
357
337
|
function replaceAt(items, index, value) {
|
|
@@ -373,15 +353,14 @@ function partitionOverflow(items, max) {
|
|
|
373
353
|
evicted: items.slice(0, overflow)
|
|
374
354
|
};
|
|
375
355
|
}
|
|
376
|
-
function
|
|
377
|
-
const scopeId = useId();
|
|
356
|
+
function createToastStore(options = {}) {
|
|
378
357
|
const items = ref([]);
|
|
379
358
|
const toasts = computed(() => items.value);
|
|
380
359
|
const records = /* @__PURE__ */ new Map();
|
|
381
360
|
let sequence = 0;
|
|
382
361
|
function createInstanceId() {
|
|
383
362
|
sequence += 1;
|
|
384
|
-
return
|
|
363
|
+
return `rp-toast-${sequence}`;
|
|
385
364
|
}
|
|
386
365
|
function resolveItem(id, instanceId, record) {
|
|
387
366
|
return {
|
|
@@ -390,7 +369,7 @@ function provideToast(props) {
|
|
|
390
369
|
type: record.type,
|
|
391
370
|
props: {
|
|
392
371
|
...TYPE_DEFAULTS[record.type],
|
|
393
|
-
...
|
|
372
|
+
...getStoreDefaults(options),
|
|
394
373
|
...record.props
|
|
395
374
|
},
|
|
396
375
|
onClose: record.onClose
|
|
@@ -402,8 +381,8 @@ function provideToast(props) {
|
|
|
402
381
|
function notifyAll(removedItems, reason) {
|
|
403
382
|
for (const item of removedItems) notify(item, reason);
|
|
404
383
|
}
|
|
405
|
-
function create(type, input,
|
|
406
|
-
const split = splitOptions(normalizeInput(input,
|
|
384
|
+
function create(type, input, createOptions) {
|
|
385
|
+
const split = splitOptions(normalizeInput(input, createOptions));
|
|
407
386
|
const instanceId = createInstanceId();
|
|
408
387
|
const id = split.id ?? instanceId;
|
|
409
388
|
const record = {
|
|
@@ -413,42 +392,43 @@ function provideToast(props) {
|
|
|
413
392
|
};
|
|
414
393
|
const item = resolveItem(id, instanceId, record);
|
|
415
394
|
const replaced = items.value.filter((current) => current.id === id);
|
|
416
|
-
const { kept, evicted } = partitionOverflow([...items.value.filter((current) => current.id !== id), item], normalizeMax(
|
|
395
|
+
const { kept, evicted } = partitionOverflow([...items.value.filter((current) => current.id !== id), item], normalizeMax(options.max));
|
|
417
396
|
records.set(instanceId, record);
|
|
418
397
|
forget([...replaced, ...evicted]);
|
|
419
398
|
items.value = kept;
|
|
420
|
-
notifyAll(
|
|
399
|
+
notifyAll(replaced, "replace");
|
|
400
|
+
notifyAll(evicted, "overflow");
|
|
421
401
|
return id;
|
|
422
402
|
}
|
|
423
|
-
function show(input,
|
|
424
|
-
return create("default", input,
|
|
403
|
+
function show(input, createOptions) {
|
|
404
|
+
return create("default", input, createOptions);
|
|
425
405
|
}
|
|
426
|
-
function success(input,
|
|
427
|
-
return create("success", input,
|
|
406
|
+
function success(input, createOptions) {
|
|
407
|
+
return create("success", input, createOptions);
|
|
428
408
|
}
|
|
429
|
-
function error(input,
|
|
430
|
-
return create("error", input,
|
|
409
|
+
function error(input, createOptions) {
|
|
410
|
+
return create("error", input, createOptions);
|
|
431
411
|
}
|
|
432
|
-
function warning(input,
|
|
433
|
-
return create("warning", input,
|
|
412
|
+
function warning(input, createOptions) {
|
|
413
|
+
return create("warning", input, createOptions);
|
|
434
414
|
}
|
|
435
|
-
function info(input,
|
|
436
|
-
return create("info", input,
|
|
415
|
+
function info(input, createOptions) {
|
|
416
|
+
return create("info", input, createOptions);
|
|
437
417
|
}
|
|
438
|
-
function update(id,
|
|
418
|
+
function update(id, updateOptions) {
|
|
439
419
|
const index = items.value.findIndex((item) => item.id === id);
|
|
440
420
|
if (index === -1) return;
|
|
441
421
|
const current = items.value[index];
|
|
442
422
|
const record = records.get(current.instanceId);
|
|
443
423
|
if (!record) return;
|
|
444
|
-
const { type, onClose, ...toastProps } =
|
|
424
|
+
const { type, onClose, ...toastProps } = updateOptions;
|
|
445
425
|
const nextRecord = {
|
|
446
426
|
type: type ?? record.type,
|
|
447
427
|
props: {
|
|
448
428
|
...record.props,
|
|
449
429
|
...withoutUndefined(toastProps)
|
|
450
430
|
},
|
|
451
|
-
onClose: Object.hasOwn(
|
|
431
|
+
onClose: Object.hasOwn(updateOptions, "onClose") ? onClose : record.onClose
|
|
452
432
|
};
|
|
453
433
|
records.set(current.instanceId, nextRecord);
|
|
454
434
|
items.value = replaceAt(items.value, index, resolveItem(current.id, current.instanceId, nextRecord));
|
|
@@ -463,16 +443,13 @@ function provideToast(props) {
|
|
|
463
443
|
function dismiss(id, reason = "dismiss") {
|
|
464
444
|
closeAt(items.value.findIndex((item) => item.id === id), reason);
|
|
465
445
|
}
|
|
466
|
-
function dismissInstance(instanceId, reason = "dismiss") {
|
|
467
|
-
closeAt(items.value.findIndex((item) => item.instanceId === instanceId), reason);
|
|
468
|
-
}
|
|
469
446
|
function dismissAll(reason = "dismiss") {
|
|
470
447
|
const dismissed = items.value;
|
|
471
448
|
records.clear();
|
|
472
449
|
items.value = [];
|
|
473
450
|
notifyAll(dismissed, reason);
|
|
474
451
|
}
|
|
475
|
-
const
|
|
452
|
+
const store = {
|
|
476
453
|
toasts,
|
|
477
454
|
show,
|
|
478
455
|
success,
|
|
@@ -481,17 +458,82 @@ function provideToast(props) {
|
|
|
481
458
|
info,
|
|
482
459
|
update,
|
|
483
460
|
dismiss,
|
|
484
|
-
dismissAll
|
|
485
|
-
dismissInstance
|
|
461
|
+
dismissAll
|
|
486
462
|
};
|
|
487
|
-
|
|
488
|
-
watch(() => normalizeMax(props.max), (max) => {
|
|
463
|
+
watch(() => normalizeMax(options.max), (max) => {
|
|
489
464
|
const { kept, evicted } = partitionOverflow(items.value, max);
|
|
490
465
|
if (evicted.length === 0) return;
|
|
491
466
|
forget(evicted);
|
|
492
467
|
items.value = kept;
|
|
493
|
-
notifyAll(evicted, "
|
|
468
|
+
notifyAll(evicted, "overflow");
|
|
494
469
|
}, { flush: "sync" });
|
|
470
|
+
return store;
|
|
471
|
+
}
|
|
472
|
+
//#endregion
|
|
473
|
+
//#region src/components/toast/types.ts
|
|
474
|
+
var toastParts = [
|
|
475
|
+
"root",
|
|
476
|
+
"icon",
|
|
477
|
+
"title",
|
|
478
|
+
"description",
|
|
479
|
+
"body",
|
|
480
|
+
"action",
|
|
481
|
+
"close"
|
|
482
|
+
];
|
|
483
|
+
var toastViewportParts = [
|
|
484
|
+
"root",
|
|
485
|
+
"item",
|
|
486
|
+
"toast",
|
|
487
|
+
"toastIcon",
|
|
488
|
+
"toastTitle",
|
|
489
|
+
"toastDescription",
|
|
490
|
+
"toastBody",
|
|
491
|
+
"toastAction",
|
|
492
|
+
"toastClose"
|
|
493
|
+
];
|
|
494
|
+
var toastColors = componentColors;
|
|
495
|
+
var toastVariants = [
|
|
496
|
+
"subtle",
|
|
497
|
+
"surface",
|
|
498
|
+
"outline",
|
|
499
|
+
"solid"
|
|
500
|
+
];
|
|
501
|
+
var toastRadiuses = [
|
|
502
|
+
"none",
|
|
503
|
+
"xs",
|
|
504
|
+
"sm",
|
|
505
|
+
"md",
|
|
506
|
+
"lg",
|
|
507
|
+
"xl"
|
|
508
|
+
];
|
|
509
|
+
var toastPositions = [
|
|
510
|
+
"top-left",
|
|
511
|
+
"top-center",
|
|
512
|
+
"top-right",
|
|
513
|
+
"bottom-left",
|
|
514
|
+
"bottom-center",
|
|
515
|
+
"bottom-right"
|
|
516
|
+
];
|
|
517
|
+
var toastTypes = [
|
|
518
|
+
"default",
|
|
519
|
+
"success",
|
|
520
|
+
"error",
|
|
521
|
+
"warning",
|
|
522
|
+
"info"
|
|
523
|
+
];
|
|
524
|
+
var toastProviderKey = Symbol("toast-provider");
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/components/toast/useToast.ts
|
|
527
|
+
function provideToast(store) {
|
|
528
|
+
function dismissInstance(instanceId, reason = "dismiss") {
|
|
529
|
+
const item = store.toasts.value.find((current) => current.instanceId === instanceId);
|
|
530
|
+
if (item) store.dismiss(item.id, reason);
|
|
531
|
+
}
|
|
532
|
+
const context = {
|
|
533
|
+
...store,
|
|
534
|
+
dismissInstance
|
|
535
|
+
};
|
|
536
|
+
provide(toastProviderKey, context);
|
|
495
537
|
return context;
|
|
496
538
|
}
|
|
497
539
|
function useToastContext(consumer) {
|
|
@@ -508,6 +550,7 @@ var toast_provider_default = /* @__PURE__ */ defineVaporComponent({
|
|
|
508
550
|
name: "RpToastProvider",
|
|
509
551
|
__name: "toast-provider",
|
|
510
552
|
props: {
|
|
553
|
+
store: {},
|
|
511
554
|
max: { default: 5 },
|
|
512
555
|
duration: { default: DEFAULT_TOAST_DURATION },
|
|
513
556
|
variant: { default: void 0 },
|
|
@@ -533,17 +576,19 @@ var toast_provider_default = /* @__PURE__ */ defineVaporComponent({
|
|
|
533
576
|
closeLabel: { default: DEFAULT_TOAST_CLOSE_LABEL }
|
|
534
577
|
},
|
|
535
578
|
setup(__props) {
|
|
536
|
-
|
|
579
|
+
const props = __props;
|
|
580
|
+
provideToast(props.store ?? createToastStore(props));
|
|
537
581
|
return createSlot();
|
|
538
582
|
}
|
|
539
583
|
});
|
|
540
584
|
//#endregion
|
|
541
585
|
//#region src/components/toast/toast-viewport.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
542
|
-
var t0 = template("<li data-v-
|
|
586
|
+
var t0 = template("<li data-v-e14bb4e0>");
|
|
543
587
|
//#endregion
|
|
544
588
|
//#region src/components/toast/toast-viewport.vue
|
|
545
589
|
var toast_viewport_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
546
590
|
name: "RpToastViewport",
|
|
591
|
+
inheritAttrs: false,
|
|
547
592
|
__name: "toast-viewport",
|
|
548
593
|
props: {
|
|
549
594
|
position: { default: "top-right" },
|
|
@@ -552,38 +597,64 @@ var toast_viewport_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
552
597
|
type: Boolean,
|
|
553
598
|
default: true
|
|
554
599
|
},
|
|
555
|
-
teleportTo: {
|
|
600
|
+
teleportTo: {},
|
|
601
|
+
classNames: {},
|
|
602
|
+
styles: {}
|
|
556
603
|
},
|
|
557
604
|
setup(__props, { slots: $slots }) {
|
|
558
605
|
const props = __props;
|
|
606
|
+
const resolvedTeleportTo = useTeleportTarget(() => props.teleportTo);
|
|
559
607
|
const context = useToastContext("<ToastViewport>");
|
|
560
608
|
function reverseToasts(toasts) {
|
|
561
609
|
return toasts.map((_, index) => toasts[toasts.length - index - 1]);
|
|
562
610
|
}
|
|
563
611
|
const orderedToasts = computed(() => props.position.startsWith("top") ? reverseToasts(context.toasts.value) : context.toasts.value);
|
|
612
|
+
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
613
|
+
const rootAttrs = computed(() => getRootAttrs({
|
|
614
|
+
class: [
|
|
615
|
+
"rp-toast-viewport",
|
|
616
|
+
`rp-toast-viewport--${props.position}`,
|
|
617
|
+
{ "rp-toast-viewport--empty": orderedToasts.value.length === 0 }
|
|
618
|
+
],
|
|
619
|
+
"data-position": props.position,
|
|
620
|
+
"aria-label": props.label
|
|
621
|
+
}));
|
|
622
|
+
const viewportToastPartMap = {
|
|
623
|
+
root: "toast",
|
|
624
|
+
icon: "toastIcon",
|
|
625
|
+
title: "toastTitle",
|
|
626
|
+
description: "toastDescription",
|
|
627
|
+
body: "toastBody",
|
|
628
|
+
action: "toastAction",
|
|
629
|
+
close: "toastClose"
|
|
630
|
+
};
|
|
631
|
+
function getToastClassNames(toast) {
|
|
632
|
+
return Object.fromEntries(Object.entries(viewportToastPartMap).map(([toastPart, viewportPart]) => [toastPart, [toast.props.classNames?.[toastPart], props.classNames?.[viewportPart]]]));
|
|
633
|
+
}
|
|
634
|
+
function getToastStyles(toast) {
|
|
635
|
+
return Object.fromEntries(Object.entries(viewportToastPartMap).map(([toastPart, viewportPart]) => [toastPart, [toast.props.styles?.[toastPart], props.styles?.[viewportPart]]]));
|
|
636
|
+
}
|
|
564
637
|
function dismiss(toast) {
|
|
565
638
|
context.dismissInstance(toast.instanceId);
|
|
566
639
|
}
|
|
567
640
|
return createComponent(VaporTeleport, {
|
|
568
|
-
to: () =>
|
|
641
|
+
to: () => unref(resolvedTeleportTo),
|
|
569
642
|
disabled: () => !__props.teleport
|
|
570
643
|
}, () => {
|
|
571
644
|
return createComponent(VaporTransitionGroup, {
|
|
572
645
|
tag: "ol",
|
|
573
646
|
name: "rp-toast-viewport-item",
|
|
574
|
-
|
|
575
|
-
"rp-toast-viewport",
|
|
576
|
-
`rp-toast-viewport--${__props.position}`,
|
|
577
|
-
{ "rp-toast-viewport--empty": orderedToasts.value.length === 0 }
|
|
578
|
-
],
|
|
579
|
-
"data-position": () => __props.position,
|
|
580
|
-
"aria-label": () => __props.label
|
|
647
|
+
$: [() => rootAttrs.value]
|
|
581
648
|
}, extend(() => {
|
|
582
649
|
return createFor(() => orderedToasts.value, (_for_item0) => {
|
|
583
650
|
const n10 = t0();
|
|
651
|
+
renderEffect(() => setDynamicProps(n10, [unref(getPartAttrs)("item", { class: "rp-toast-viewport__item" }), { "data-type": _for_item0.value.type }]));
|
|
584
652
|
setInsertionState(n10, null, 0);
|
|
585
653
|
createComponent(toast_default, { $: [() => _for_item0.value.props, {
|
|
586
654
|
open: true,
|
|
655
|
+
"class-names": () => getToastClassNames(_for_item0.value),
|
|
656
|
+
styles: () => getToastStyles(_for_item0.value),
|
|
657
|
+
"data-type": () => _for_item0.value.type,
|
|
587
658
|
onClose: () => ($event) => unref(context).dismissInstance(_for_item0.value.instanceId, $event)
|
|
588
659
|
}] }, { $: [
|
|
589
660
|
() => $slots.icon ? {
|
|
@@ -618,7 +689,7 @@ var toast_viewport_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
618
689
|
}, { _: 8 }));
|
|
619
690
|
}, true);
|
|
620
691
|
}
|
|
621
|
-
}), [["__scopeId", "data-v-
|
|
692
|
+
}), [["__scopeId", "data-v-e14bb4e0"]]);
|
|
622
693
|
//#endregion
|
|
623
694
|
//#region src/components/toast/useToastState.ts
|
|
624
695
|
function optionValue(value) {
|
|
@@ -676,4 +747,4 @@ function useToastState(options = {}) {
|
|
|
676
747
|
};
|
|
677
748
|
}
|
|
678
749
|
//#endregion
|
|
679
|
-
export { toastColors as a,
|
|
750
|
+
export { toastColors as a, toastRadiuses as c, toastViewportParts as d, createToastStore as f, useToast as i, toastTypes as l, toast_viewport_default as n, toastParts as o, toast_default as p, toast_provider_default as r, toastPositions as s, useToastState as t, toastVariants as u };
|