ropav 0.11.1 → 0.12.0
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/dist/components/autocomplete/autocomplete-clear-button.js +1 -1
- package/dist/components/autocomplete/autocomplete-root.js +3 -0
- package/dist/components/checkbox/checkbox-root.js +4 -1
- package/dist/components/radio/radio-root.js +4 -1
- package/dist/components/scroll-shadow/scroll-shadow-root.js +2 -10
- package/dist/components/scroll-shadow/use-scroll-shadow.d.ts +10 -0
- package/dist/components/scroll-shadow/use-scroll-shadow.js +34 -2
- package/dist/components/select/index.d.ts +3 -2
- package/dist/components/select/index.js +2 -1
- package/dist/components/select/select-clear-button.d.ts +21 -0
- package/dist/components/select/select-clear-button.js +66 -0
- package/dist/components/select/select-root.d.ts +2 -1
- package/dist/components/select/select-root.js +15 -1
- package/dist/components/select/select.context.d.ts +11 -0
- package/dist/components/select/select.types.d.ts +3 -0
- package/dist/components/switch/switch-root.js +4 -1
- package/dist/components/table/table-row.js +3 -2
- package/dist/components/table/use-grid-keyboard.js +2 -3
- package/dist/components/table/use-table-collection.d.ts +0 -11
- package/dist/components/table/use-table-collection.js +1 -17
- package/dist/components/tabs/tabs-root.js +5 -1
- package/dist/components/tabs/tabs.types.d.ts +6 -0
- package/dist/components/toast/index.d.ts +1 -1
- package/dist/components/toast/index.js +3 -3
- package/dist/components/toast/toast-default-content.js +26 -4
- package/dist/components/toast/toast-indicator.js +8 -2
- package/dist/components/toast/toast-provider.js +53 -5
- package/dist/components/toast/toast-queue.d.ts +60 -5
- package/dist/components/toast/toast-queue.js +85 -27
- package/dist/components/toast/toast-root.js +67 -14
- package/dist/components/toast/toast.constants.d.ts +17 -1
- package/dist/components/toast/toast.constants.js +18 -2
- package/dist/components/toast/toast.context.d.ts +6 -0
- package/dist/components/toast/toast.types.d.ts +19 -0
- package/dist/composables/use-list-keyboard.d.ts +1 -1
- package/dist/composables/use-list-keyboard.js +4 -5
- package/dist/composables/use-measured-height.d.ts +18 -10
- package/dist/composables/use-measured-height.js +53 -15
- package/dist/composables/use-overlay-position.js +7 -4
- package/dist/composables/use-select-state.d.ts +8 -0
- package/dist/composables/use-select-state.js +5 -0
- package/dist/composables/use-select.d.ts +7 -0
- package/dist/composables/use-select.js +6 -0
- package/dist/composables/use-toast-region.d.ts +18 -4
- package/dist/composables/use-toast-region.js +128 -6
- package/dist/composables/use-toast.d.ts +1 -1
- package/dist/composables/use-toast.js +4 -3
- package/dist/composables/use-typeahead.js +3 -0
- package/dist/index.js +5 -4
- package/dist/ropav.min.css +1 -1
- package/dist/utils/focus.d.ts +13 -0
- package/dist/utils/focus.js +18 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -23,7 +23,7 @@ var autocomplete_clear_button_vue_vue_type_script_setup_true_vapor_true_lang_def
|
|
|
23
23
|
};
|
|
24
24
|
/** Empties the selection, and only the selection — the text that was typed is left alone. */
|
|
25
25
|
const onClick = () => {
|
|
26
|
-
state.
|
|
26
|
+
state.clearValue();
|
|
27
27
|
onClear();
|
|
28
28
|
};
|
|
29
29
|
const n1 = t0();
|
|
@@ -178,7 +178,10 @@ var autocomplete_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /
|
|
|
178
178
|
* that part is what {@link provideAutocompleteContext} above carries.
|
|
179
179
|
*/
|
|
180
180
|
provideSelectContext({
|
|
181
|
+
isDisabled,
|
|
182
|
+
onClear: () => emit("clear"),
|
|
181
183
|
placeholder,
|
|
184
|
+
registerClearButton: () => () => {},
|
|
182
185
|
select,
|
|
183
186
|
selectedItems: state.selectedItems,
|
|
184
187
|
selectedText,
|
|
@@ -88,7 +88,10 @@ var checkbox_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__
|
|
|
88
88
|
});
|
|
89
89
|
const validation = group ? group.state.itemValidation : ownValidation;
|
|
90
90
|
provideFieldErrorContext(group ? null : { validation: validation.displayValidation });
|
|
91
|
-
const { context: fieldIds, describedBy } = useFieldIds({
|
|
91
|
+
const { context: fieldIds, describedBy } = useFieldIds({
|
|
92
|
+
labelElementType: "span",
|
|
93
|
+
slots: ["description", "errorMessage"]
|
|
94
|
+
});
|
|
92
95
|
provideFieldIdsContext(fieldIds);
|
|
93
96
|
const resolvedDescribedBy = computed(() => {
|
|
94
97
|
const ids = [
|
|
@@ -23,7 +23,10 @@ var radio_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PUR
|
|
|
23
23
|
const styles = computed(() => radioVariants());
|
|
24
24
|
const isSelected = computed(() => state.selectedValue.value === props.value);
|
|
25
25
|
const isDisabled = computed(() => Boolean(props.isDisabled) || state.isDisabled.value);
|
|
26
|
-
const { context: fieldIds, describedBy } = useFieldIds({
|
|
26
|
+
const { context: fieldIds, describedBy } = useFieldIds({
|
|
27
|
+
labelElementType: "span",
|
|
28
|
+
slots: ["description"]
|
|
29
|
+
});
|
|
27
30
|
provideFieldIdsContext(fieldIds);
|
|
28
31
|
const resolvedDescribedBy = computed(() => {
|
|
29
32
|
const ids = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { focusableIn } from "../../utils/focus.js";
|
|
2
|
-
import { useScrollShadow } from "./use-scroll-shadow.js";
|
|
2
|
+
import { clearScrollShadowVisibility, useScrollShadow } from "./use-scroll-shadow.js";
|
|
3
3
|
import { computed, createSlot, defineVaporComponent, renderEffect, setAttr, setClass, setInsertionState, setProp, setStaticTemplateRef, setStyle, shallowRef, template, watch } from "vue";
|
|
4
4
|
import { scrollShadowVariants } from "@ropav/styles";
|
|
5
5
|
//#region src/components/scroll-shadow/scroll-shadow-root.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
@@ -43,21 +43,13 @@ var scroll_shadow_root_vue_vue_type_script_setup_true_vapor_true_lang_default =
|
|
|
43
43
|
variant: props.variant
|
|
44
44
|
}).base({ class: props.class }));
|
|
45
45
|
const style = computed(() => [{ "--scroll-shadow-size": `${props.size}px` }, props.style]);
|
|
46
|
-
const clearVisibility = (current) => {
|
|
47
|
-
delete current.dataset["topScroll"];
|
|
48
|
-
delete current.dataset["bottomScroll"];
|
|
49
|
-
delete current.dataset["topBottomScroll"];
|
|
50
|
-
delete current.dataset["leftScroll"];
|
|
51
|
-
delete current.dataset["rightScroll"];
|
|
52
|
-
delete current.dataset["leftRightScroll"];
|
|
53
|
-
};
|
|
54
46
|
watch([
|
|
55
47
|
element,
|
|
56
48
|
() => props.visibility,
|
|
57
49
|
() => props.orientation
|
|
58
50
|
], ([current, visibility, orientation]) => {
|
|
59
51
|
if (!current || visibility === "auto") return;
|
|
60
|
-
|
|
52
|
+
clearScrollShadowVisibility(current);
|
|
61
53
|
if (visibility === "both") current.dataset[orientation === "vertical" ? "topBottomScroll" : "leftRightScroll"] = "true";
|
|
62
54
|
else if (visibility !== "none") current.dataset[`${visibility}Scroll`] = "true";
|
|
63
55
|
}, {
|
|
@@ -12,6 +12,16 @@ export interface UseScrollShadowReturn {
|
|
|
12
12
|
/** Re-measure immediately. The DOM write is batched into the next animation frame. */
|
|
13
13
|
checkOverflow: () => void;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Take every edge attribute off, so the stylesheet's mask stops applying.
|
|
17
|
+
*
|
|
18
|
+
* The attributes are the whole state, and the one place the mask is keyed on, so whoever stops
|
|
19
|
+
* writing them has to take the last set off too or the fade stays painted at whatever it was.
|
|
20
|
+
*
|
|
21
|
+
* Reports whether anything was actually removed, so a caller telling the world the fade is gone
|
|
22
|
+
* only says it when there was one.
|
|
23
|
+
*/
|
|
24
|
+
export declare const clearScrollShadowVisibility: (element: HTMLElement) => boolean;
|
|
15
25
|
/**
|
|
16
26
|
* Detect the scrollable edges around an element and publish them as `data-*` attributes.
|
|
17
27
|
*
|
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
import { computed, onScopeDispose, toValue, watch } from "vue";
|
|
2
2
|
//#region src/components/scroll-shadow/use-scroll-shadow.ts
|
|
3
|
+
/** Every attribute an edge is published as, which together are the whole state. */
|
|
4
|
+
var EDGE_ATTRIBUTES = [
|
|
5
|
+
"topScroll",
|
|
6
|
+
"bottomScroll",
|
|
7
|
+
"topBottomScroll",
|
|
8
|
+
"leftScroll",
|
|
9
|
+
"rightScroll",
|
|
10
|
+
"leftRightScroll"
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* Take every edge attribute off, so the stylesheet's mask stops applying.
|
|
14
|
+
*
|
|
15
|
+
* The attributes are the whole state, and the one place the mask is keyed on, so whoever stops
|
|
16
|
+
* writing them has to take the last set off too or the fade stays painted at whatever it was.
|
|
17
|
+
*
|
|
18
|
+
* Reports whether anything was actually removed, so a caller telling the world the fade is gone
|
|
19
|
+
* only says it when there was one.
|
|
20
|
+
*/
|
|
21
|
+
var clearScrollShadowVisibility = (element) => {
|
|
22
|
+
let cleared = false;
|
|
23
|
+
for (const attribute of EDGE_ATTRIBUTES) {
|
|
24
|
+
if (element.dataset[attribute] === void 0) continue;
|
|
25
|
+
delete element.dataset[attribute];
|
|
26
|
+
cleared = true;
|
|
27
|
+
}
|
|
28
|
+
return cleared;
|
|
29
|
+
};
|
|
3
30
|
/**
|
|
4
31
|
* Detect the scrollable edges around an element and publish them as `data-*` attributes.
|
|
5
32
|
*
|
|
@@ -73,7 +100,12 @@ var useScrollShadow = (options) => {
|
|
|
73
100
|
], ([current, enabled, mode], _previous, onCleanup) => {
|
|
74
101
|
previous = null;
|
|
75
102
|
cancelPendingFrame();
|
|
76
|
-
if (!current
|
|
103
|
+
if (!current) return;
|
|
104
|
+
if (mode !== "auto") return;
|
|
105
|
+
if (!enabled) {
|
|
106
|
+
if (clearScrollShadowVisibility(current)) options.onVisibilityChange?.("none");
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
77
109
|
checkOverflow();
|
|
78
110
|
current.addEventListener("scroll", checkOverflow, { passive: true });
|
|
79
111
|
const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(checkOverflow);
|
|
@@ -120,4 +152,4 @@ var useScrollShadow = (options) => {
|
|
|
120
152
|
return { checkOverflow };
|
|
121
153
|
};
|
|
122
154
|
//#endregion
|
|
123
|
-
export { useScrollShadow };
|
|
155
|
+
export { clearScrollShadowVisibility, useScrollShadow };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import SelectClearButton from "./select-clear-button.js";
|
|
1
2
|
import SelectIndicator from "./select-indicator.js";
|
|
2
3
|
import SelectPopover from "./select-popover.js";
|
|
3
4
|
import SelectRoot from "./select-root.js";
|
|
4
5
|
import SelectTrigger from "./select-trigger.js";
|
|
5
6
|
import SelectValue from "./select-value.js";
|
|
6
|
-
export { SelectIndicator, SelectPopover, SelectRoot as Select, SelectTrigger, SelectValue };
|
|
7
|
-
export type { SelectIndicatorProps, SelectPopoverProps, SelectRootProps as SelectProps, SelectRootSlotProps as SelectSlotProps, SelectTriggerProps, SelectValueProps, SelectValueSlotProps, } from "./select.types.js";
|
|
7
|
+
export { SelectClearButton, SelectIndicator, SelectPopover, SelectRoot as Select, SelectTrigger, SelectValue, };
|
|
8
|
+
export type { SelectClearButtonProps, SelectIndicatorProps, SelectPopoverProps, SelectRootProps as SelectProps, SelectRootSlotProps as SelectSlotProps, SelectTriggerProps, SelectValueProps, SelectValueSlotProps, } from "./select.types.js";
|
|
8
9
|
export { useSelectContext } from "./select.context.js";
|
|
9
10
|
export type { SelectContext } from "./select.context.js";
|
|
10
11
|
export type { UseSelectReturn } from "../../composables/use-select.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useSelectContext } from "./select.context.js";
|
|
2
|
+
import select_clear_button_default from "./select-clear-button.js";
|
|
2
3
|
import select_indicator_default from "./select-indicator.js";
|
|
3
4
|
import select_popover_default from "./select-popover.js";
|
|
4
5
|
import select_root_default from "./select-root.js";
|
|
5
6
|
import select_trigger_default from "./select-trigger.js";
|
|
6
7
|
import select_value_default from "./select-value.js";
|
|
7
8
|
import { selectVariants } from "@ropav/styles";
|
|
8
|
-
export { select_root_default as Select, select_indicator_default as SelectIndicator, select_popover_default as SelectPopover, select_trigger_default as SelectTrigger, select_value_default as SelectValue, selectVariants, useSelectContext };
|
|
9
|
+
export { select_root_default as Select, select_clear_button_default as SelectClearButton, select_indicator_default as SelectIndicator, select_popover_default as SelectPopover, select_trigger_default as SelectTrigger, select_value_default as SelectValue, selectVariants, useSelectContext };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SelectClearButtonProps } from "./select.types.js";
|
|
2
|
+
declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>['props'], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, 'attrs' | 'emit' | 'slots'>>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>['expose'], __VLS_setup?: Promise<{
|
|
3
|
+
props: import('vue').PublicProps & __VLS_PrettifyLocal<SelectClearButtonProps> & (typeof globalThis extends {
|
|
4
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
5
|
+
} ? P : {});
|
|
6
|
+
expose: (exposed: {}) => void;
|
|
7
|
+
attrs: any;
|
|
8
|
+
slots: {
|
|
9
|
+
default?: (props: {}) => any;
|
|
10
|
+
};
|
|
11
|
+
emit: {};
|
|
12
|
+
}>) => import('vue').VNode & {
|
|
13
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
14
|
+
};
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
17
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
18
|
+
[K in keyof T]: T[K];
|
|
19
|
+
} : {
|
|
20
|
+
[K in keyof T as K]: T[K];
|
|
21
|
+
}) & {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { dataAttr } from "../../utils/assertion.js";
|
|
2
|
+
import icon_close_default from "../icons/icon-close.js";
|
|
3
|
+
import { useSelectContext } from "./select.context.js";
|
|
4
|
+
import { computed, createComponent, createSlot, defineVaporComponent, on, onMounted, onUnmounted, renderEffect, setAttr, setClass, setInsertionState, template, unref } from "vue";
|
|
5
|
+
//#region src/components/select/select-clear-button.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
6
|
+
var t0 = template("<span aria-hidden=true data-slot=select-clear-button>", 1);
|
|
7
|
+
var select_clear_button_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE__*/ defineVaporComponent({
|
|
8
|
+
__name: "select-clear-button",
|
|
9
|
+
props: { class: {} },
|
|
10
|
+
setup(__props) {
|
|
11
|
+
const props = __props;
|
|
12
|
+
const { isDisabled, onClear, registerClearButton, select, selectedItems, slots, state } = useSelectContext();
|
|
13
|
+
const styles = computed(() => slots.value.clearButton({ class: props.class }));
|
|
14
|
+
/**
|
|
15
|
+
* Whether there is nothing to clear, which is what the stylesheet fades this out on.
|
|
16
|
+
*
|
|
17
|
+
* It stays in the DOM either way: appearing and disappearing would reflow the trigger every time
|
|
18
|
+
* a choice was made or undone.
|
|
19
|
+
*
|
|
20
|
+
* Read from the chosen items rather than the selected keys, so this agrees with what the trigger
|
|
21
|
+
* shows: a value naming an option the collection does not hold renders as the placeholder, and a
|
|
22
|
+
* button offering to clear what the user cannot see is a button offering to clear nothing.
|
|
23
|
+
*/
|
|
24
|
+
const isEmpty = computed(() => selectedItems.value.length === 0);
|
|
25
|
+
let unregister;
|
|
26
|
+
onMounted(() => {
|
|
27
|
+
unregister = registerClearButton();
|
|
28
|
+
});
|
|
29
|
+
onUnmounted(() => {
|
|
30
|
+
unregister?.();
|
|
31
|
+
unregister = void 0;
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Keeps the press off the trigger, so clearing does not also open the popover.
|
|
35
|
+
*
|
|
36
|
+
* Guarded the same way the click is: with nothing to clear the stylesheet takes this out of the
|
|
37
|
+
* hit test, and a press swallowed here rather than there would leave a strip of the trigger that
|
|
38
|
+
* neither clears nor opens.
|
|
39
|
+
*/
|
|
40
|
+
const onPointerdown = (event) => {
|
|
41
|
+
if (isDisabled.value || isEmpty.value) return;
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
};
|
|
44
|
+
const onClick = (event) => {
|
|
45
|
+
event.stopPropagation();
|
|
46
|
+
if (isDisabled.value || isEmpty.value) return;
|
|
47
|
+
state.clearValue();
|
|
48
|
+
onClear();
|
|
49
|
+
select.triggerElement.value?.focus();
|
|
50
|
+
};
|
|
51
|
+
const n3 = t0();
|
|
52
|
+
renderEffect(() => {
|
|
53
|
+
setClass(n3, styles.value);
|
|
54
|
+
setAttr(n3, "data-empty", unref(dataAttr)(isEmpty.value));
|
|
55
|
+
});
|
|
56
|
+
setInsertionState(n3);
|
|
57
|
+
createSlot("default", null, () => {
|
|
58
|
+
return createComponent(unref(icon_close_default), { "data-slot": "select-clear-button-icon" });
|
|
59
|
+
});
|
|
60
|
+
on(n3, "click", onClick);
|
|
61
|
+
on(n3, "pointerdown", onPointerdown);
|
|
62
|
+
return n3;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
//#endregion
|
|
66
|
+
export { select_clear_button_vue_vue_type_script_setup_true_vapor_true_lang_default as default };
|
|
@@ -3,6 +3,7 @@ import type { SelectRootProps, SelectRootSlotProps } from "./select.types.js";
|
|
|
3
3
|
declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>['props'], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, 'attrs' | 'emit' | 'slots'>>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>['expose'], __VLS_setup?: Promise<{
|
|
4
4
|
props: import('vue').PublicProps & __VLS_PrettifyLocal<SelectRootProps<T> & {
|
|
5
5
|
onChange?: ((value: SelectedValue) => any) | undefined;
|
|
6
|
+
onClear?: (() => any) | undefined;
|
|
6
7
|
onFocusChange?: ((isFocused: boolean) => any) | undefined;
|
|
7
8
|
onOpenChange?: ((isOpen: boolean) => any) | undefined;
|
|
8
9
|
"onUpdate:isOpen"?: ((isOpen: boolean) => any) | undefined;
|
|
@@ -15,7 +16,7 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
15
16
|
slots: {
|
|
16
17
|
default?: (props: SelectRootSlotProps) => unknown;
|
|
17
18
|
};
|
|
18
|
-
emit: ((evt: "change", value: SelectedValue) => void) & ((evt: "focusChange", isFocused: boolean) => void) & ((evt: "openChange", isOpen: boolean) => void) & ((evt: "update:isOpen", isOpen: boolean) => void) & ((evt: "update:value", value: SelectedValue) => void);
|
|
19
|
+
emit: ((evt: "change", value: SelectedValue) => void) & ((evt: "clear") => void) & ((evt: "focusChange", isFocused: boolean) => void) & ((evt: "openChange", isOpen: boolean) => void) & ((evt: "update:isOpen", isOpen: boolean) => void) & ((evt: "update:value", value: SelectedValue) => void);
|
|
19
20
|
}>) => import('vue').VNode & {
|
|
20
21
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
21
22
|
};
|
|
@@ -74,7 +74,8 @@ var select_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PU
|
|
|
74
74
|
"update:value",
|
|
75
75
|
"openChange",
|
|
76
76
|
"update:isOpen",
|
|
77
|
-
"focusChange"
|
|
77
|
+
"focusChange",
|
|
78
|
+
"clear"
|
|
78
79
|
],
|
|
79
80
|
setup(__props, { emit: __emit }) {
|
|
80
81
|
const props = __props;
|
|
@@ -106,12 +107,22 @@ var select_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PU
|
|
|
106
107
|
validationBehavior: () => props.validationBehavior,
|
|
107
108
|
value: () => props.value
|
|
108
109
|
});
|
|
110
|
+
let clearButtons = 0;
|
|
111
|
+
const registerClearButton = () => {
|
|
112
|
+
clearButtons += 1;
|
|
113
|
+
return () => {
|
|
114
|
+
clearButtons -= 1;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
const onClear = () => emit("clear");
|
|
109
118
|
const select = useSelect({
|
|
110
119
|
ariaDescribedby: () => props.ariaDescribedby,
|
|
111
120
|
ariaLabel: () => props.ariaLabel,
|
|
112
121
|
ariaLabelledby: () => props.ariaLabelledby,
|
|
122
|
+
hasClearButton: () => clearButtons > 0,
|
|
113
123
|
isDisabled: () => props.isDisabled,
|
|
114
124
|
isRequired: () => props.isRequired,
|
|
125
|
+
onClear,
|
|
115
126
|
onFocusChange: (isFocused) => emit("focusChange", isFocused)
|
|
116
127
|
}, state);
|
|
117
128
|
const strings = useLocalizedStringFormatter(selectStrings);
|
|
@@ -136,7 +147,10 @@ var select_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PU
|
|
|
136
147
|
provideFieldIdsContext(select.fieldIds.context);
|
|
137
148
|
provideFieldErrorContext({ validation: state.displayValidation });
|
|
138
149
|
provideSelectContext({
|
|
150
|
+
isDisabled: computed(() => Boolean(props.isDisabled)),
|
|
151
|
+
onClear,
|
|
139
152
|
placeholder,
|
|
153
|
+
registerClearButton,
|
|
140
154
|
select,
|
|
141
155
|
selectedItems: state.selectedItems,
|
|
142
156
|
selectedText,
|
|
@@ -12,6 +12,17 @@ export interface SelectContext {
|
|
|
12
12
|
selectedText: ComputedRef<string>;
|
|
13
13
|
/** What the trigger shows when nothing is chosen, already resolved to the localized default. */
|
|
14
14
|
placeholder: ComputedRef<string>;
|
|
15
|
+
/** Whether the whole select is disabled, which the clear button has to answer to as well. */
|
|
16
|
+
isDisabled: ComputedRef<boolean>;
|
|
17
|
+
/** Called after the selection is emptied, whichever way it was emptied. */
|
|
18
|
+
onClear: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Registers a mounted clear button and returns the call that unregisters it.
|
|
21
|
+
*
|
|
22
|
+
* Counted rather than a flag, so unmounting one cannot switch the trigger's clear shortcut off
|
|
23
|
+
* while another is still mounted.
|
|
24
|
+
*/
|
|
25
|
+
registerClearButton: () => () => void;
|
|
15
26
|
}
|
|
16
27
|
/**
|
|
17
28
|
* Strict: every part of a select reads the state the root holds, so one rendered outside a root
|
|
@@ -90,6 +90,9 @@ export interface SelectValueSlotProps<T = unknown> {
|
|
|
90
90
|
export interface SelectIndicatorProps {
|
|
91
91
|
class?: string;
|
|
92
92
|
}
|
|
93
|
+
export interface SelectClearButtonProps {
|
|
94
|
+
class?: string;
|
|
95
|
+
}
|
|
93
96
|
export interface SelectPopoverProps {
|
|
94
97
|
class?: string;
|
|
95
98
|
/** @default "bottom" */
|
|
@@ -56,7 +56,10 @@ var switch_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PU
|
|
|
56
56
|
value: () => state.value
|
|
57
57
|
});
|
|
58
58
|
provideFieldErrorContext({ validation: validation.displayValidation });
|
|
59
|
-
const { context: fieldIds, describedBy } = useFieldIds({
|
|
59
|
+
const { context: fieldIds, describedBy } = useFieldIds({
|
|
60
|
+
labelElementType: "span",
|
|
61
|
+
slots: ["description", "errorMessage"]
|
|
62
|
+
});
|
|
60
63
|
provideFieldIdsContext(fieldIds);
|
|
61
64
|
const resolvedDescribedBy = computed(() => {
|
|
62
65
|
const ids = [describedBy.value, props.ariaDescribedby].filter(Boolean);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { dataAttr } from "../../utils/assertion.js";
|
|
2
2
|
import { useId as useId$1 } from "../../composables/use-id.js";
|
|
3
3
|
import { useInteractionStates } from "../../composables/use-interaction-states.js";
|
|
4
|
+
import { isNestedControl } from "../../utils/focus.js";
|
|
4
5
|
import { useVirtualizerItem } from "../virtualizer/use-virtualizer-item.js";
|
|
5
6
|
import { visuallyHiddenStyle } from "../../utils/visually-hidden.js";
|
|
6
7
|
import { provideTableRowContext, useTableGridContext, useTableVirtualizerContext } from "./table.context.js";
|
|
7
|
-
import { createTableRegistry,
|
|
8
|
+
import { createTableRegistry, tableCellId } from "./use-table-collection.js";
|
|
8
9
|
import { computed, createDynamicComponent, createIf, createSlot, defineVaporComponent, extend, on, renderEffect, setDynamicProps, setStaticTemplateRef, shallowRef, template, unref, watch } from "vue";
|
|
9
10
|
//#region src/components/table/table-row.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
10
11
|
var t0 = template("<div>");
|
|
@@ -155,7 +156,7 @@ var table_row_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE
|
|
|
155
156
|
});
|
|
156
157
|
const onClick = (event) => {
|
|
157
158
|
if (isDisabled.value || selectionMode.value === "none") return;
|
|
158
|
-
if (
|
|
159
|
+
if (isNestedControl(event.target)) return;
|
|
159
160
|
selection.select(rowKey.value, {
|
|
160
161
|
isCtrlPressed: event.ctrlKey || event.metaKey,
|
|
161
162
|
isShiftPressed: event.shiftKey
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { focusableIn, getScrollParent, isScrollable } from "../../utils/focus.js";
|
|
2
|
-
import { isTableCellControl } from "./use-table-collection.js";
|
|
1
|
+
import { focusableIn, getScrollParent, isNestedControl, isScrollable } from "../../utils/focus.js";
|
|
3
2
|
import { computed, nextTick, shallowRef, toValue, watch } from "vue";
|
|
4
3
|
//#region src/components/table/use-grid-keyboard.ts
|
|
5
4
|
var NO_FOCUS = {
|
|
@@ -307,7 +306,7 @@ var useGridKeyboard = (options) => {
|
|
|
307
306
|
const target = event.target;
|
|
308
307
|
if (toValue(options.isDisabled)) return;
|
|
309
308
|
if (!element || !(target instanceof Node) || !element.contains(target)) return;
|
|
310
|
-
if (
|
|
309
|
+
if (isNestedControl(target)) return;
|
|
311
310
|
const from = focused.value;
|
|
312
311
|
const isModified = event.ctrlKey || event.metaKey;
|
|
313
312
|
const move = (next) => {
|
|
@@ -135,14 +135,3 @@ export declare const normalizeIdKey: (key: CollectionKey) => string;
|
|
|
135
135
|
export declare const tableColumnHeaderId: (tableId: string, columnKey: CollectionKey) => string;
|
|
136
136
|
/** The id a row header cell carries, which is what `aria-labelledby` on the row points at. */
|
|
137
137
|
export declare const tableCellId: (tableId: string, rowKey: CollectionKey, columnKey: CollectionKey) => string;
|
|
138
|
-
/**
|
|
139
|
-
* Whether an event landed on a control inside a cell rather than on a part of the grid.
|
|
140
|
-
*
|
|
141
|
-
* React Aria never has to ask: its press hook stops propagation, so a button or a checkbox in a
|
|
142
|
-
* cell never lets the row or the grid see the interaction. Nothing stops propagation here, so both
|
|
143
|
-
* the row's click handler and the grid's key handler have to recognise the case themselves.
|
|
144
|
-
*
|
|
145
|
-
* The grid's own parts are told apart by their collection marker — a cell holding the roving tab
|
|
146
|
-
* stop matches the focusable selector without being content.
|
|
147
|
-
*/
|
|
148
|
-
export declare const isTableCellControl: (target: EventTarget | null) => boolean;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FOCUSABLE_SELECTOR } from "../../utils/focus.js";
|
|
2
1
|
import { useCollection } from "../../composables/use-collection.js";
|
|
3
2
|
import { createTableCollection } from "../../utils/virtualizer-collection.js";
|
|
4
3
|
import { computed, shallowRef } from "vue";
|
|
@@ -113,20 +112,5 @@ var normalizeIdKey = (key) => typeof key === "string" ? key.replace(/\s*/g, "")
|
|
|
113
112
|
var tableColumnHeaderId = (tableId, columnKey) => `${tableId}-${normalizeIdKey(columnKey)}`;
|
|
114
113
|
/** The id a row header cell carries, which is what `aria-labelledby` on the row points at. */
|
|
115
114
|
var tableCellId = (tableId, rowKey, columnKey) => `${tableId}-${normalizeIdKey(rowKey)}-${normalizeIdKey(columnKey)}`;
|
|
116
|
-
/**
|
|
117
|
-
* Whether an event landed on a control inside a cell rather than on a part of the grid.
|
|
118
|
-
*
|
|
119
|
-
* React Aria never has to ask: its press hook stops propagation, so a button or a checkbox in a
|
|
120
|
-
* cell never lets the row or the grid see the interaction. Nothing stops propagation here, so both
|
|
121
|
-
* the row's click handler and the grid's key handler have to recognise the case themselves.
|
|
122
|
-
*
|
|
123
|
-
* The grid's own parts are told apart by their collection marker — a cell holding the roving tab
|
|
124
|
-
* stop matches the focusable selector without being content.
|
|
125
|
-
*/
|
|
126
|
-
var isTableCellControl = (target) => {
|
|
127
|
-
if (!(target instanceof Element)) return false;
|
|
128
|
-
const control = target.closest(FOCUSABLE_SELECTOR);
|
|
129
|
-
return control != null && !control.hasAttribute("data-collection");
|
|
130
|
-
};
|
|
131
115
|
//#endregion
|
|
132
|
-
export { createTableRegistry, createTableTree,
|
|
116
|
+
export { createTableRegistry, createTableTree, normalizeIdKey, tableCellId, tableColumnHeaderId, useTableCollection };
|
|
@@ -12,6 +12,7 @@ var tabs_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE
|
|
|
12
12
|
__name: "tabs-root",
|
|
13
13
|
props: {
|
|
14
14
|
class: {},
|
|
15
|
+
align: { default: void 0 },
|
|
15
16
|
selectedKey: {},
|
|
16
17
|
defaultSelectedKey: {},
|
|
17
18
|
disabledKeys: {},
|
|
@@ -32,7 +33,10 @@ var tabs_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE
|
|
|
32
33
|
const orientation = computed(() => props.orientation ?? "horizontal");
|
|
33
34
|
const keyboardActivation = computed(() => props.keyboardActivation ?? "automatic");
|
|
34
35
|
const isDisabled = computed(() => Boolean(props.isDisabled));
|
|
35
|
-
const slots = computed(() => tabsVariants({
|
|
36
|
+
const slots = computed(() => tabsVariants({
|
|
37
|
+
align: props.align,
|
|
38
|
+
variant: props.variant
|
|
39
|
+
}));
|
|
36
40
|
const state = useTabListState({
|
|
37
41
|
defaultSelectedKey: props.defaultSelectedKey,
|
|
38
42
|
disabledKeys: () => props.disabledKeys,
|
|
@@ -8,6 +8,12 @@ export type TabsOrientation = "horizontal" | "vertical";
|
|
|
8
8
|
export type TabsKeyboardActivation = "automatic" | "manual";
|
|
9
9
|
export interface TabsRootProps {
|
|
10
10
|
class?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Where a tab's label and icon sit inside the tab.
|
|
13
|
+
*
|
|
14
|
+
* @default "center"
|
|
15
|
+
*/
|
|
16
|
+
align?: TabsVariants["align"];
|
|
11
17
|
/** The selected tab, when the caller drives it. */
|
|
12
18
|
selectedKey?: CollectionKey;
|
|
13
19
|
/** The initially selected tab. Falls back to the first tab that is not disabled. */
|
|
@@ -8,7 +8,7 @@ import ToastRoot from "./toast-root.js";
|
|
|
8
8
|
import ToastTitle from "./toast-title.js";
|
|
9
9
|
export { ToastActionButton, ToastCloseButton, ToastContent, ToastDescription, ToastIndicator, ToastProvider, ToastRoot as Toast, ToastTitle, };
|
|
10
10
|
export type { ToastActionButtonProps, ToastActionValue, ToastAddOptions, ToastCloseButtonProps, ToastContentProps, ToastContentValue, ToastDescriptionProps, ToastIndicatorProps, ToastOptions, ToastPromiseOptions, ToastProviderProps, ToastProviderSlotProps, ToastQueueOptions, ToastRenderable, ToastRootProps as ToastProps, ToastTitleProps, QueuedToast, } from "./toast.types.js";
|
|
11
|
-
export { ToastQueue, createToastFunction, getQueuedToastCount, resetToastQueue, toast, toastQueue, useToastQueue, } from "./toast-queue.js";
|
|
11
|
+
export { ToastQueue, createToastFunction, createViewTransitionUpdate, getQueuedToastCount, resetToastQueue, toast, toastQueue, useToastQueue, } from "./toast-queue.js";
|
|
12
12
|
export type { Timer } from "./toast-queue.js";
|
|
13
13
|
export type { ToastFunction, UseToastQueueReturn } from "./toast-queue.js";
|
|
14
14
|
export { DEFAULT_GAP, DEFAULT_MAX_VISIBLE_TOAST, DEFAULT_SCALE_FACTOR, DEFAULT_TOAST_TIMEOUT, DEFAULT_TOAST_WIDTH, } from "./toast.constants.js";
|
|
@@ -4,10 +4,10 @@ import toast_close_button_default from "./toast-close-button.js";
|
|
|
4
4
|
import toast_content_default from "./toast-content.js";
|
|
5
5
|
import toast_description_default from "./toast-description.js";
|
|
6
6
|
import toast_indicator_default from "./toast-indicator.js";
|
|
7
|
+
import { DEFAULT_GAP, DEFAULT_MAX_VISIBLE_TOAST, DEFAULT_SCALE_FACTOR, DEFAULT_TOAST_TIMEOUT, DEFAULT_TOAST_WIDTH } from "./toast.constants.js";
|
|
7
8
|
import toast_root_default from "./toast-root.js";
|
|
8
9
|
import toast_title_default from "./toast-title.js";
|
|
9
|
-
import {
|
|
10
|
-
import { ToastQueue, createToastFunction, getQueuedToastCount, resetToastQueue, toast, toastQueue, useToastQueue } from "./toast-queue.js";
|
|
10
|
+
import { ToastQueue, createToastFunction, createViewTransitionUpdate, getQueuedToastCount, resetToastQueue, toast, toastQueue, useToastQueue } from "./toast-queue.js";
|
|
11
11
|
import toast_provider_default from "./toast-provider.js";
|
|
12
12
|
import { toastVariants } from "@ropav/styles";
|
|
13
|
-
export { DEFAULT_GAP, DEFAULT_MAX_VISIBLE_TOAST, DEFAULT_SCALE_FACTOR, DEFAULT_TOAST_TIMEOUT, DEFAULT_TOAST_WIDTH, toast_root_default as Toast, toast_action_button_default as ToastActionButton, toast_close_button_default as ToastCloseButton, toast_content_default as ToastContent, toast_description_default as ToastDescription, toast_indicator_default as ToastIndicator, toast_provider_default as ToastProvider, ToastQueue, toast_title_default as ToastTitle, createToastFunction, getQueuedToastCount, resetToastQueue, toast, toastQueue, toastVariants, useToastItemContext, useToastQueue, useToastRegionContext };
|
|
13
|
+
export { DEFAULT_GAP, DEFAULT_MAX_VISIBLE_TOAST, DEFAULT_SCALE_FACTOR, DEFAULT_TOAST_TIMEOUT, DEFAULT_TOAST_WIDTH, toast_root_default as Toast, toast_action_button_default as ToastActionButton, toast_close_button_default as ToastCloseButton, toast_content_default as ToastContent, toast_description_default as ToastDescription, toast_indicator_default as ToastIndicator, toast_provider_default as ToastProvider, ToastQueue, toast_title_default as ToastTitle, createToastFunction, createViewTransitionUpdate, getQueuedToastCount, resetToastQueue, toast, toastQueue, toastVariants, useToastItemContext, useToastQueue, useToastRegionContext };
|
|
@@ -8,7 +8,7 @@ import toast_indicator_default from "./toast-indicator.js";
|
|
|
8
8
|
import toast_renderable_default from "./toast-renderable.js";
|
|
9
9
|
import toast_root_default from "./toast-root.js";
|
|
10
10
|
import toast_title_default from "./toast-title.js";
|
|
11
|
-
import { computed, createComponent, createIf, defineVaporComponent, extend, unref } from "vue";
|
|
11
|
+
import { computed, createComponent, createIf, defineVaporComponent, extend, shallowRef, unref, watch } from "vue";
|
|
12
12
|
//#region src/components/toast/toast-default-content.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
13
13
|
var toast_default_content_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE__*/ defineVaporComponent({
|
|
14
14
|
__name: "toast-default-content",
|
|
@@ -21,6 +21,19 @@ var toast_default_content_vue_vue_type_script_setup_true_vapor_true_lang_default
|
|
|
21
21
|
* because there is no room for a row.
|
|
22
22
|
*/
|
|
23
23
|
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
24
|
+
/**
|
|
25
|
+
* Which of the three indicators is showing. Tracked here rather than inside the indicator because
|
|
26
|
+
* the three are separate branches: settling a promise toast unmounts the spinner's instance and
|
|
27
|
+
* mounts a fresh one, which would have no memory of what it replaced.
|
|
28
|
+
*/
|
|
29
|
+
const indicatorKind = computed(() => {
|
|
30
|
+
if (content.value.isLoading === true) return "loading";
|
|
31
|
+
return content.value.indicator === void 0 ? "default" : "custom";
|
|
32
|
+
});
|
|
33
|
+
const hasSwappedIndicator = shallowRef(false);
|
|
34
|
+
watch(indicatorKind, () => {
|
|
35
|
+
hasSwappedIndicator.value = true;
|
|
36
|
+
});
|
|
24
37
|
const action = computed(() => {
|
|
25
38
|
const value = content.value.actionProps;
|
|
26
39
|
return value?.label == null ? void 0 : value;
|
|
@@ -38,18 +51,27 @@ var toast_default_content_vue_vue_type_script_setup_true_vapor_true_lang_default
|
|
|
38
51
|
return [
|
|
39
52
|
createIf(() => content.value.indicator !== null, () => {
|
|
40
53
|
return createIf(() => content.value.isLoading === true, () => {
|
|
41
|
-
return createComponent(toast_indicator_default, {
|
|
54
|
+
return createComponent(toast_indicator_default, {
|
|
55
|
+
"is-swapped": () => hasSwappedIndicator.value,
|
|
56
|
+
variant: () => content.value.variant
|
|
57
|
+
}, () => {
|
|
42
58
|
return createComponent(spinner_root_default, {
|
|
43
59
|
color: "current",
|
|
44
60
|
size: "sm"
|
|
45
61
|
});
|
|
46
62
|
});
|
|
47
63
|
}, () => createIf(() => content.value.indicator !== void 0, () => {
|
|
48
|
-
return createComponent(toast_indicator_default, {
|
|
64
|
+
return createComponent(toast_indicator_default, {
|
|
65
|
+
"is-swapped": () => hasSwappedIndicator.value,
|
|
66
|
+
variant: () => content.value.variant
|
|
67
|
+
}, () => {
|
|
49
68
|
return createComponent(toast_renderable_default, { value: () => content.value.indicator });
|
|
50
69
|
});
|
|
51
70
|
}, () => {
|
|
52
|
-
return createComponent(toast_indicator_default, {
|
|
71
|
+
return createComponent(toast_indicator_default, {
|
|
72
|
+
"is-swapped": () => hasSwappedIndicator.value,
|
|
73
|
+
variant: () => content.value.variant
|
|
74
|
+
});
|
|
53
75
|
}, 517), 261);
|
|
54
76
|
}),
|
|
55
77
|
createComponent(toast_content_default, null, extend(() => {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { dataAttr } from "../../utils/assertion.js";
|
|
1
2
|
import danger_icon_default from "../icons/danger-icon.js";
|
|
2
3
|
import info_icon_default from "../icons/info-icon.js";
|
|
3
4
|
import success_icon_default from "../icons/success-icon.js";
|
|
4
5
|
import warning_icon_default from "../icons/warning-icon.js";
|
|
5
6
|
import { useToastItemContext } from "./toast.context.js";
|
|
6
|
-
import { computed, createDynamicComponent, createSlot, defineVaporComponent, renderEffect, setClass, setInsertionState, template } from "vue";
|
|
7
|
+
import { computed, createDynamicComponent, createSlot, defineVaporComponent, renderEffect, setAttr, setClass, setInsertionState, template, unref } from "vue";
|
|
7
8
|
//#region src/components/toast/toast-indicator.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
8
9
|
var t0 = template("<div data-slot=toast-indicator>", 1);
|
|
9
10
|
var toast_indicator_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE__*/ defineVaporComponent({
|
|
10
11
|
__name: "toast-indicator",
|
|
11
12
|
props: {
|
|
12
13
|
class: {},
|
|
14
|
+
isSwapped: { type: Boolean },
|
|
13
15
|
variant: {}
|
|
14
16
|
},
|
|
15
17
|
setup(__props) {
|
|
@@ -25,7 +27,11 @@ var toast_indicator_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@
|
|
|
25
27
|
}
|
|
26
28
|
});
|
|
27
29
|
const n3 = t0();
|
|
28
|
-
renderEffect(() =>
|
|
30
|
+
renderEffect(() => {
|
|
31
|
+
const _props = props;
|
|
32
|
+
setClass(n3, ["rp-toast__indicator", _props.class]);
|
|
33
|
+
setAttr(n3, "data-swapped", unref(dataAttr)(_props.isSwapped));
|
|
34
|
+
});
|
|
29
35
|
setInsertionState(n3);
|
|
30
36
|
createSlot("default", null, () => {
|
|
31
37
|
return createDynamicComponent(() => defaultIcon.value, { "data-slot": "toast-default-icon" });
|