ropav 0.1.5 → 0.1.6

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 (100) hide show
  1. package/README.md +4 -0
  2. package/dist/accordion.js +11 -8
  3. package/dist/alert.css +18 -18
  4. package/dist/alert.js +18 -17
  5. package/dist/avatar.js +2 -2
  6. package/dist/badge.js +2 -2
  7. package/dist/base.css +18 -13
  8. package/dist/button-group.js +1 -1
  9. package/dist/button-link.js +10 -12
  10. package/dist/button.css +32 -27
  11. package/dist/button.js +10 -12
  12. package/dist/{useButtonColor.js → button.scss_vue_type_style_index_0_src_true_lang.js} +2 -1
  13. package/dist/card.js +1 -1
  14. package/dist/checkbox.css +32 -32
  15. package/dist/checkbox.js +6 -6
  16. package/dist/collapse.css +6 -6
  17. package/dist/collapse.js +4 -4
  18. package/dist/collectionNavigation.js +2 -2
  19. package/dist/color-input.css +19 -19
  20. package/dist/color-input.js +5 -5
  21. package/dist/color-picker.css +7 -7
  22. package/dist/color-picker.js +4 -5
  23. package/dist/color-swatch.js +1 -1
  24. package/dist/componentColors.js +42 -2
  25. package/dist/components/checkbox/useCheckbox.d.ts +1 -1
  26. package/dist/components/color-input/color-input.d.ts +2 -2
  27. package/dist/components/color-input/useColorInput.d.ts +1 -1
  28. package/dist/components/dialog/dialog-core.d.ts +1 -1
  29. package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +2 -2
  30. package/dist/components/dropdown-menu/dropdown-menu-primitive-core.d.ts +1 -1
  31. package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +2 -2
  32. package/dist/components/dropdown-menu/dropdown-menu.d.ts +3 -3
  33. package/dist/components/dropdown-menu/useDropdownMenuDisclosure.d.ts +3 -4
  34. package/dist/components/input/useInput.d.ts +1 -1
  35. package/dist/components/number-input/useNumberInput.d.ts +1 -1
  36. package/dist/components/progress/useProgress.d.ts +1 -1
  37. package/dist/components/radio/useRadio.d.ts +2 -2
  38. package/dist/components/scroll-area/scrollAreaCore.d.ts +5 -0
  39. package/dist/components/scroll-area/types.d.ts +4 -0
  40. package/dist/components/scroll-area/useScrollArea.d.ts +1 -0
  41. package/dist/components/scroll-area/useScrollAreaMetrics.d.ts +3 -0
  42. package/dist/components/scroll-area/useScrollAreaPresentation.d.ts +3 -0
  43. package/dist/components/select/useSelect.d.ts +2 -1
  44. package/dist/components/select/useSelectNativeValue.d.ts +1 -7
  45. package/dist/components/slider/sliderCore.d.ts +2 -1
  46. package/dist/components/slider/useRangeSlider.d.ts +1 -1
  47. package/dist/components/slider/useSlider.d.ts +1 -1
  48. package/dist/components/switch/useSwitch.d.ts +1 -1
  49. package/dist/components/textarea/useTextarea.d.ts +1 -1
  50. package/dist/composables/index.d.ts +2 -0
  51. package/dist/composables/index.js +2 -0
  52. package/dist/composables/useControllableValue.d.ts +14 -0
  53. package/dist/dialog.js +8 -5
  54. package/dist/dropdown-menu.js +43 -29
  55. package/dist/field.js +1 -1
  56. package/dist/floating.js +19 -7
  57. package/dist/icon-button.css +12 -173
  58. package/dist/icon-button.js +5 -5
  59. package/dist/index.d.ts +5 -4
  60. package/dist/index.js +7 -5
  61. package/dist/input.css +24 -24
  62. package/dist/input.js +5 -5
  63. package/dist/modal.js +11 -7
  64. package/dist/number-input.css +18 -18
  65. package/dist/number-input.js +7 -7
  66. package/dist/overlay.js +1 -1
  67. package/dist/pagination.js +3 -3
  68. package/dist/popover.js +9 -6
  69. package/dist/progress.css +29 -21
  70. package/dist/progress.js +17 -10
  71. package/dist/radio.js +3 -3
  72. package/dist/scroll-area.css +10 -1
  73. package/dist/scroll-area.js +82 -25
  74. package/dist/select.css +45 -45
  75. package/dist/select.js +48 -26
  76. package/dist/slider.css +142 -142
  77. package/dist/slider.js +32 -38
  78. package/dist/switch.css +17 -17
  79. package/dist/switch.js +6 -6
  80. package/dist/tabs.css +3 -3
  81. package/dist/tabs.js +25 -15
  82. package/dist/textarea.css +26 -26
  83. package/dist/textarea.js +4 -4
  84. package/dist/toast.css +26 -26
  85. package/dist/toast.js +24 -19
  86. package/dist/tooltip.js +11 -8
  87. package/dist/useCollapse.js +12 -7
  88. package/dist/useControlState.js +1 -1
  89. package/dist/useControllableValue.js +8 -2
  90. package/dist/useFloatingPosition.js +4 -1140
  91. package/dist/useFormControl.js +3 -2
  92. package/dist/useOverlayZIndex.js +1 -1
  93. package/dist/useRequiredInject.js +1 -1
  94. package/docs/public-composables-api.md +52 -0
  95. package/package.json +45 -38
  96. package/src/styles/_mixins.scss +4 -0
  97. package/src/styles/_tokens.scss +12 -12
  98. package/src/styles/_variables.scss +1 -1
  99. package/dist/button-link.css +0 -167
  100. /package/dist/{composables → internal/composables}/useOverlayLayer.d.ts +0 -0
@@ -1,8 +1,8 @@
1
1
  import { ColorInputProps } from './types.js';
2
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
3
  props: import('vue').PublicProps & __VLS_PrettifyLocal<ColorInputProps & {
4
- "onUpdate:open"?: ((value: boolean) => any) | undefined;
5
4
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
5
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
6
6
  }> & (typeof globalThis extends {
7
7
  __VLS_PROPS_FALLBACK: infer P;
8
8
  } ? P : {});
@@ -16,7 +16,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
16
16
  } & {
17
17
  'eye-dropper-icon'?: (props: {}) => any;
18
18
  };
19
- emit: ((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", value: string) => void);
19
+ emit: ((evt: "update:modelValue", value: string) => void) & ((evt: "update:open", value: boolean) => void);
20
20
  }>) => import('vue').VNode & {
21
21
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
22
22
  };
@@ -20,7 +20,7 @@ export declare function useColorInput(props: Readonly<ColorInputProps>, emit: Us
20
20
  hasInvalidColor: import('vue').ComputedRef<boolean | undefined>;
21
21
  isInvalid: import('vue').ComputedRef<boolean | undefined>;
22
22
  colorValidationMessage: import('vue').ComputedRef<string | undefined>;
23
- control: import('../../composables/useControlState.js').ControlState;
23
+ control: import('../../internal/composables/useControlState.js').ControlState;
24
24
  rootClass: import('vue').ComputedRef<string[]>;
25
25
  popoverDisabled: import('vue').ComputedRef<boolean>;
26
26
  };
@@ -1,5 +1,5 @@
1
1
  import { ComponentPublicInstance, ComputedRef, InjectionKey, Ref, VaporComponentInstance } from 'vue';
2
- import { OverlayLayerContext } from '../../composables/useOverlayLayer.js';
2
+ import { OverlayLayerContext } from '../../internal/composables/useOverlayLayer.js';
3
3
  import { DialogCloseReason } from './types.js';
4
4
  export interface DialogRootContext {
5
5
  isOpen: ComputedRef<boolean>;
@@ -5,8 +5,8 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
5
5
  originalEvent: KeyboardEvent;
6
6
  }>) => any) | undefined;
7
7
  onPointerDownOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
8
- onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
9
8
  onInteractOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
9
+ onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
10
10
  }> & (typeof globalThis extends {
11
11
  __VLS_PROPS_FALLBACK: infer P;
12
12
  } ? P : {});
@@ -21,7 +21,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
21
21
  };
22
22
  emit: ((evt: "escapeKeyDown", event: CustomEvent<{
23
23
  originalEvent: KeyboardEvent;
24
- }>) => void) & ((evt: "pointerDownOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "focusOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "interactOutside", event: DropdownMenuInteractOutsideEvent) => void);
24
+ }>) => void) & ((evt: "pointerDownOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "interactOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "focusOutside", event: DropdownMenuInteractOutsideEvent) => void);
25
25
  }>) => import('vue').VNode & {
26
26
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
27
27
  };
@@ -1,5 +1,5 @@
1
1
  import { ComponentPublicInstance, ComputedRef, InjectionKey, Ref, VaporComponentInstance } from 'vue';
2
- import { OverlayLayerContext } from '../../composables/useOverlayLayer.js';
2
+ import { OverlayLayerContext } from '../../internal/composables/useOverlayLayer.js';
3
3
  import { FloatingReference } from '../floating/types.js';
4
4
  import { DropdownMenuCloseOptions, DropdownMenuFocusTarget, DropdownMenuInteractOutsideEvent, DropdownMenuItemPrimitiveProps, DropdownMenuItemValue, DropdownMenuOpenOptions, DropdownMenuPlacement, DropdownMenuPoint, DropdownMenuSelectEvent, DropdownMenuVirtualAnchor } from './types.js';
5
5
  export type ElementReference = FloatingReference;
@@ -5,8 +5,8 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
5
5
  originalEvent: KeyboardEvent;
6
6
  }>) => any) | undefined;
7
7
  onPointerDownOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
8
- onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
9
8
  onInteractOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
9
+ onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
10
10
  }> & (typeof globalThis extends {
11
11
  __VLS_PROPS_FALLBACK: infer P;
12
12
  } ? P : {});
@@ -21,7 +21,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
21
21
  };
22
22
  emit: ((evt: "escapeKeyDown", event: CustomEvent<{
23
23
  originalEvent: KeyboardEvent;
24
- }>) => void) & ((evt: "pointerDownOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "focusOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "interactOutside", event: DropdownMenuInteractOutsideEvent) => void);
24
+ }>) => void) & ((evt: "pointerDownOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "interactOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "focusOutside", event: DropdownMenuInteractOutsideEvent) => void);
25
25
  }>) => import('vue').VNode & {
26
26
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
27
27
  };
@@ -1,11 +1,11 @@
1
1
  import { DropdownMenuItem, DropdownMenuItemSlotProps, DropdownMenuInteractOutsideEvent, DropdownMenuProps, DropdownMenuSelectEvent, DropdownMenuSlotProps } from './types.js';
2
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
3
  props: import('vue').PublicProps & __VLS_PrettifyLocal<DropdownMenuProps & {
4
- "onUpdate:open"?: ((value: boolean) => any) | undefined;
5
4
  onSelect?: ((item: DropdownMenuItem, event: DropdownMenuSelectEvent) => any) | undefined;
5
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
6
6
  onPointerDownOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
7
- onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
8
7
  onInteractOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
8
+ onFocusOutside?: ((event: DropdownMenuInteractOutsideEvent) => any) | undefined;
9
9
  }> & (typeof globalThis extends {
10
10
  __VLS_PROPS_FALLBACK: infer P;
11
11
  } ? P : {});
@@ -16,7 +16,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
16
16
  item?(props: DropdownMenuItemSlotProps): unknown;
17
17
  empty?(): unknown;
18
18
  };
19
- emit: ((evt: "update:open", value: boolean) => void) & ((evt: "select", item: DropdownMenuItem, event: DropdownMenuSelectEvent) => void) & ((evt: "pointerDownOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "focusOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "interactOutside", event: DropdownMenuInteractOutsideEvent) => void);
19
+ emit: ((evt: "select", item: DropdownMenuItem, event: DropdownMenuSelectEvent) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "pointerDownOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "interactOutside", event: DropdownMenuInteractOutsideEvent) => void) & ((evt: "focusOutside", event: DropdownMenuInteractOutsideEvent) => void);
20
20
  }>) => import('vue').VNode & {
21
21
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
22
22
  };
@@ -1,12 +1,11 @@
1
1
  import { Ref } from 'vue';
2
- import { OverlayLayerContext } from '../../composables/useOverlayLayer.js';
2
+ import { OverlayLayerContext } from '../../internal/composables/useOverlayLayer.js';
3
3
  import { DropdownMenuCloseOptions, DropdownMenuFocusTarget, DropdownMenuInteractOutsideEvent, DropdownMenuItem, DropdownMenuOpenOptions, DropdownMenuProps, DropdownMenuSelectEvent } from './types.js';
4
4
  import { ItemPath } from './dropdown-menu-utils.js';
5
5
  type BooleanSource = Readonly<Ref<boolean>>;
6
6
  type UseDropdownMenuDisclosureOptions = {
7
7
  props: Readonly<DropdownMenuProps>;
8
8
  emit: {
9
- openChange?: (open: boolean) => void;
10
9
  select?: (item: DropdownMenuItem, event: DropdownMenuSelectEvent) => void;
11
10
  pointerDownOutside?: (event: DropdownMenuInteractOutsideEvent) => void;
12
11
  focusOutside?: (event: DropdownMenuInteractOutsideEvent) => void;
@@ -15,7 +14,7 @@ type UseDropdownMenuDisclosureOptions = {
15
14
  rootRef: Ref<HTMLElement | null>;
16
15
  menuRef: Ref<HTMLElement | null>;
17
16
  targetRef: Readonly<Ref<Element | null>>;
18
- uncontrolledOpen: Ref<boolean>;
17
+ setControllableOpen: (open: boolean) => void;
19
18
  isDisabled: BooleanSource;
20
19
  isOpen: BooleanSource;
21
20
  isVisible: BooleanSource;
@@ -28,7 +27,7 @@ type UseDropdownMenuDisclosureOptions = {
28
27
  focusTrigger: () => void;
29
28
  layer: OverlayLayerContext;
30
29
  };
31
- export declare function useDropdownMenuDisclosure({ props, emit, rootRef, menuRef, targetRef, uncontrolledOpen, isDisabled, isOpen, isVisible, focusedPath, resetFocus, resetSubmenus, resetHoverIntent, focusItem, focusMenu, focusTrigger, layer, }: UseDropdownMenuDisclosureOptions): {
30
+ export declare function useDropdownMenuDisclosure({ props, emit, rootRef, menuRef, targetRef, setControllableOpen, isDisabled, isOpen, isVisible, focusedPath, resetFocus, resetSubmenus, resetHoverIntent, focusItem, focusMenu, focusTrigger, layer, }: UseDropdownMenuDisclosureOptions): {
32
31
  open: (options?: DropdownMenuOpenOptions | DropdownMenuFocusTarget) => void;
33
32
  close: (options?: DropdownMenuCloseOptions) => void;
34
33
  toggle: () => void;
@@ -1,7 +1,7 @@
1
1
  import { InputProps } from './types.js';
2
2
  export declare function useInput(props: Readonly<InputProps>, emitUpdate: (value: string) => void): {
3
3
  inputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
4
- control: import('../../composables/useControlState.js').ControlState;
4
+ control: import('../../internal/composables/useControlState.js').ControlState;
5
5
  rootClass: import('vue').ComputedRef<string[]>;
6
6
  onInput: (e: Event) => void;
7
7
  focusInput: (e: MouseEvent) => void;
@@ -15,7 +15,7 @@ export declare function normalizeNumberInputControlsPosition(position: NumberInp
15
15
  export declare function normalizeNumberInputTextAlign(textAlign: NumberInputTextAlign | undefined): NumberInputTextAlign;
16
16
  export declare function getModelInputValue(value: NumberInputValue): string;
17
17
  export declare function useNumberInput(props: Readonly<NumberInputProps>, emitUpdate: (value: NumberInputValue) => void, getValue?: () => NumberInputValue): {
18
- control: import('../../composables/useControlState.js').ControlState;
18
+ control: import('../../internal/composables/useControlState.js').ControlState;
19
19
  rootClass: import('vue').ComputedRef<string[]>;
20
20
  bounds: import('vue').ComputedRef<NumberInputBounds>;
21
21
  nativeStep: import('vue').ComputedRef<number>;
@@ -13,7 +13,7 @@ export declare function normalizeProgressBounds(min: number, max: number): {
13
13
  export declare function normalizeProgressValue(value: number | null | undefined, min: number, max: number): number;
14
14
  export declare function getProgressValuePercent(value: number, min: number, max: number): number;
15
15
  export declare function useProgress(props: ProgressStateProps): {
16
- control: import('../../composables/useControlState.js').ControlState;
16
+ control: import('../../internal/composables/useControlState.js').ControlState;
17
17
  rootClass: import('vue').ComputedRef<string[]>;
18
18
  rootStyle: import('vue').ComputedRef<CSSProperties>;
19
19
  isIndeterminate: import('vue').ComputedRef<boolean>;
@@ -2,7 +2,7 @@ import { CSSProperties } from 'vue';
2
2
  import { RadioGroupProps, RadioProps } from './types.js';
3
3
  export declare function useRadio(props: Readonly<RadioProps>, emitChange: (event: Event) => void): {
4
4
  inputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
5
- control: import('../../composables/useControlState.js').ControlState;
5
+ control: import('../../internal/composables/useControlState.js').ControlState;
6
6
  name: import('vue').ComputedRef<string | undefined>;
7
7
  form: import('vue').ComputedRef<string | undefined>;
8
8
  groupInputAttrs: import('vue').ComputedRef<import('vue').InputHTMLAttributes | undefined>;
@@ -16,7 +16,7 @@ export declare function useRadio(props: Readonly<RadioProps>, emitChange: (event
16
16
  focus: (options?: FocusOptions) => void;
17
17
  };
18
18
  export declare function useRadioGroup(props: Readonly<RadioGroupProps>, emitUpdate: (value: string | number | null) => void): {
19
- control: import('../../composables/useControlState.js').ControlState;
19
+ control: import('../../internal/composables/useControlState.js').ControlState;
20
20
  rootClass: import('vue').ComputedRef<string[]>;
21
21
  value: import('vue').ComputedRef<string | number | null>;
22
22
  };
@@ -1,6 +1,8 @@
1
1
  import { ScrollAreaScrollbars, ScrollAreaType } from './types.js';
2
2
  export type ScrollAxis = 'x' | 'y';
3
+ export type ScrollDirection = 'ltr' | 'rtl';
3
4
  export interface ScrollAreaMetrics {
5
+ direction: ScrollDirection;
4
6
  clientWidth: number;
5
7
  clientHeight: number;
6
8
  scrollWidth: number;
@@ -15,6 +17,9 @@ export interface ScrollAreaMetrics {
15
17
  verticalThumbOffset: number;
16
18
  }
17
19
  export declare function clamp(value: number, min: number, max: number): number;
20
+ export declare function getScrollDirection(viewport: HTMLElement): ScrollDirection;
21
+ export declare function getLogicalHorizontalPosition(scrollLeft: number, maxPosition: number, direction: ScrollDirection): number;
22
+ export declare function getRawHorizontalPosition(position: number, maxPosition: number, direction: ScrollDirection): number;
18
23
  export declare function isAxisEnabled(scrollbars: ScrollAreaScrollbars | false | undefined, axis: ScrollAxis): boolean;
19
24
  export declare function isScrollbarActive(type: ScrollAreaType, enabled: boolean, overflowing: boolean): boolean;
20
25
  export declare function getThumbGeometry(trackSize: number, viewportSize: number, scrollSize: number): {
@@ -8,14 +8,18 @@ export declare const scrollAreaScrollbars: readonly ["x", "y", "both"];
8
8
  export type ScrollAreaScrollbars = (typeof scrollAreaScrollbars)[number];
9
9
  export type ScrollAreaOrientation = 'horizontal' | 'vertical';
10
10
  export interface ScrollAreaPosition {
11
+ /** Logical horizontal offset: zero at inline-start and increasing toward inline-end. */
11
12
  x: number;
13
+ /** Vertical offset from the top edge. */
12
14
  y: number;
13
15
  }
14
16
  export interface ScrollAreaSlotProps {
15
17
  position: ScrollAreaPosition;
16
18
  overflowX: boolean;
17
19
  overflowY: boolean;
20
+ /** Uses the native `Element.scrollTo()` coordinate semantics. */
18
21
  scrollTo: (options: ScrollToOptions) => void;
22
+ /** Uses the native `Element.scrollBy()` coordinate semantics. */
19
23
  scrollBy: (options: ScrollToOptions) => void;
20
24
  update: () => void;
21
25
  }
@@ -35,6 +35,7 @@ export declare function useScrollArea(options: UseScrollAreaOptions): {
35
35
  horizontalScrollbarRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
36
36
  verticalScrollbarRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
37
37
  metrics: {
38
+ direction: import('./scrollAreaCore.js').ScrollDirection;
38
39
  clientWidth: number;
39
40
  clientHeight: number;
40
41
  scrollWidth: number;
@@ -11,6 +11,7 @@ interface UseScrollAreaMetricsOptions {
11
11
  }
12
12
  export declare function useScrollAreaMetrics(options: UseScrollAreaMetricsOptions): {
13
13
  metrics: {
14
+ direction: import('./scrollAreaCore.js').ScrollDirection;
14
15
  clientWidth: number;
15
16
  clientHeight: number;
16
17
  scrollWidth: number;
@@ -26,7 +27,9 @@ export declare function useScrollAreaMetrics(options: UseScrollAreaMetricsOption
26
27
  };
27
28
  position: import('vue').ComputedRef<ScrollAreaPosition>;
28
29
  update: () => void;
30
+ updatePosition: (viewport?: HTMLElement | null) => void;
29
31
  scheduleUpdate: () => void;
32
+ schedulePositionUpdate: () => void;
30
33
  getPosition: (axis: ScrollAxis) => number;
31
34
  getMaxPosition: (axis: ScrollAxis) => number;
32
35
  getOverflow: (axis: ScrollAxis) => boolean;
@@ -16,6 +16,7 @@ export declare function useScrollAreaPresentation(props: Readonly<ScrollAreaProp
16
16
  'aria-disabled': true | undefined;
17
17
  'aria-hidden': true | undefined;
18
18
  'data-orientation': string;
19
+ 'data-direction': import('./scrollAreaCore.js').ScrollDirection;
19
20
  'data-active': "" | undefined;
20
21
  'data-visible': "" | undefined;
21
22
  class?: import('vue').ClassValue;
@@ -32,6 +33,7 @@ export declare function useScrollAreaPresentation(props: Readonly<ScrollAreaProp
32
33
  'aria-disabled': true | undefined;
33
34
  'aria-hidden': true | undefined;
34
35
  'data-orientation': string;
36
+ 'data-direction': import('./scrollAreaCore.js').ScrollDirection;
35
37
  'data-active': "" | undefined;
36
38
  'data-visible': "" | undefined;
37
39
  class?: import('vue').ClassValue;
@@ -41,6 +43,7 @@ export declare function useScrollAreaPresentation(props: Readonly<ScrollAreaProp
41
43
  verticalThumbAttrs: import('vue').ComputedRef<Pick<HTMLAttributes, "class" | "style">>;
42
44
  cornerAttrs: import('vue').ComputedRef<{
43
45
  'aria-hidden': boolean;
46
+ 'data-direction': import('./scrollAreaCore.js').ScrollDirection;
44
47
  'data-visible': "" | undefined;
45
48
  class?: import('vue').ClassValue;
46
49
  style?: import('vue').StyleValue;
@@ -7,8 +7,9 @@ export declare function useSelect(props: Readonly<SelectBehaviorProps>, emitUpda
7
7
  triggerRef: Ref<HTMLElement | null, HTMLElement | null>;
8
8
  isOpen: Ref<boolean, boolean>;
9
9
  selectId: string;
10
+ popupId: string;
10
11
  listboxId: string;
11
- control: import('../../composables/useControlState.js').ControlState;
12
+ control: import('../../internal/composables/useControlState.js').ControlState;
12
13
  visibleOptions: import('vue').ComputedRef<SelectOption[]>;
13
14
  focusedIndex: import('vue').ComputedRef<number>;
14
15
  activeDescendantId: import('vue').ComputedRef<string | undefined>;
@@ -2,13 +2,7 @@ import { SelectProps } from './types.js';
2
2
  export type SelectValue = string | number | null;
3
3
  export declare function useSelectNativeValue(props: Readonly<SelectProps>, emitUpdate: (value: SelectValue) => void): {
4
4
  nativeSelectRef: import('vue').Ref<HTMLSelectElement | null, HTMLSelectElement | null>;
5
- controllable: {
6
- initialValue: SelectValue;
7
- isControlled: import('vue').ComputedRef<boolean>;
8
- value: import('vue').ComputedRef<SelectValue>;
9
- setValue: (nextValue: SelectValue) => void;
10
- resetValue: (nextValue?: SelectValue) => void;
11
- };
5
+ controllable: import('../../composables/useControllableValue.js').UseControllableValueReturn<SelectValue>;
12
6
  getNativeValue: (select: HTMLSelectElement) => string | number | null;
13
7
  syncNativeSelection: (value: SelectValue) => void;
14
8
  requestValueUpdate: (value: SelectValue) => void;
@@ -6,7 +6,8 @@ export interface SliderBounds {
6
6
  }
7
7
  interface SliderMarkStyleProperties {
8
8
  position: `--_rp-${string}`;
9
- colors: readonly `--_rp-${string}`[];
9
+ decorativeColors: readonly `--_rp-${string}`[];
10
+ foregroundColors: readonly `--_rp-${string}`[];
10
11
  }
11
12
  interface SliderThumbStyleProperties {
12
13
  size: `--${string}`;
@@ -13,7 +13,7 @@ export declare function normalizeRangeSliderMinRange(minRange: number, min: numb
13
13
  export declare function normalizeRangeSliderValue(value: RangeSliderValue, min: number, max: number, step: number | 'any', minRange?: number): RangeSliderValue;
14
14
  export declare function getClosestRangeSliderThumb(value: number, range: RangeSliderValue, activeThumb?: RangeSliderThumb): RangeSliderThumb;
15
15
  export declare function useRangeSlider(props: RangeSliderStateProps, emitUpdate: (value: RangeSliderValue) => void, getValue?: () => RangeSliderValue): {
16
- control: import('../../composables/useControlState.js').ControlState;
16
+ control: import('../../internal/composables/useControlState.js').ControlState;
17
17
  nativeMin: import('vue').ComputedRef<RangeSliderValue>;
18
18
  nativeMax: import('vue').ComputedRef<RangeSliderValue>;
19
19
  nativeStep: import('vue').ComputedRef<number | "any">;
@@ -10,7 +10,7 @@ type SliderStateProps = Readonly<SliderProps & {
10
10
  orientation: NonNullable<SliderProps['orientation']>;
11
11
  }>;
12
12
  export declare function useSlider(props: SliderStateProps, emitUpdate: (value: number) => void, getValue?: () => number): {
13
- control: import('../../composables/useControlState.js').ControlState;
13
+ control: import('../../internal/composables/useControlState.js').ControlState;
14
14
  nativeMin: import('vue').ComputedRef<number>;
15
15
  nativeMax: import('vue').ComputedRef<number>;
16
16
  nativeStep: import('vue').ComputedRef<number | "any">;
@@ -2,7 +2,7 @@ import { CSSProperties } from 'vue';
2
2
  import { SwitchProps } from './types.js';
3
3
  export declare function useSwitch(props: Readonly<SwitchProps>, emitUpdate: (value: boolean) => void, getValue?: () => boolean): {
4
4
  inputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
5
- control: import('../../composables/useControlState.js').ControlState;
5
+ control: import('../../internal/composables/useControlState.js').ControlState;
6
6
  rootClass: import('vue').ComputedRef<string[]>;
7
7
  rootStyle: import('vue').ComputedRef<CSSProperties | undefined>;
8
8
  onChange: (e: Event) => void;
@@ -1,7 +1,7 @@
1
1
  import { TextareaProps } from './types.js';
2
2
  export declare function useTextarea(props: Readonly<TextareaProps>, emitUpdate: (value: string) => void, getValue?: () => string): {
3
3
  textareaRef: import('vue').Ref<HTMLTextAreaElement | null, HTMLTextAreaElement | null>;
4
- control: import('../../composables/useControlState.js').ControlState;
4
+ control: import('../../internal/composables/useControlState.js').ControlState;
5
5
  rootClass: import('vue').ComputedRef<string[]>;
6
6
  nativeRows: import('vue').ComputedRef<number | undefined>;
7
7
  onInput: (e: Event) => void;
@@ -0,0 +1,2 @@
1
+ export { useControllableValue } from './useControllableValue.js';
2
+ export type { UseControllableValueOptions, UseControllableValueReturn, } from './useControllableValue.js';
@@ -0,0 +1,2 @@
1
+ import { t as useControllableValue } from "../useControllableValue.js";
2
+ export { useControllableValue };
@@ -0,0 +1,14 @@
1
+ import { ComputedRef } from 'vue';
2
+ export interface UseControllableValueOptions<T> {
3
+ modelValue: () => T | undefined;
4
+ defaultValue: () => T;
5
+ onChange: (value: T) => void;
6
+ }
7
+ export interface UseControllableValueReturn<T> {
8
+ initialValue: T;
9
+ isControlled: ComputedRef<boolean>;
10
+ value: ComputedRef<T>;
11
+ setValue: (value: T) => void;
12
+ resetValue: (value?: T) => void;
13
+ }
14
+ export declare function useControllableValue<T>(options: Readonly<UseControllableValueOptions<T>>): UseControllableValueReturn<T>;
package/dist/dialog.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { t as useControllableValue } from "./useControllableValue.js";
1
2
  import { t as useRequiredInject } from "./useRequiredInject.js";
2
3
  import { i as useOverlayLayerBranch, n as useOverlayZIndex, r as useOverlayLayer } from "./useOverlayZIndex.js";
3
4
  import { t as useFocusTrap } from "./useFocusTrap.js";
@@ -340,8 +341,12 @@ var dialog_root_default = /* @__PURE__ */ defineVaporComponent({
340
341
  const props = __props;
341
342
  const emit = __emit;
342
343
  const generatedId = useId();
343
- const uncontrolledOpen = ref(props.defaultOpen);
344
- const isOpen = computed(() => props.open ?? uncontrolledOpen.value);
344
+ const controllableOpen = useControllableValue({
345
+ modelValue: () => props.open,
346
+ defaultValue: () => props.defaultOpen,
347
+ onChange: (value) => emit("update:open", value)
348
+ });
349
+ const isOpen = controllableOpen.value;
345
350
  const modal = computed(() => props.modal);
346
351
  const closeOnEscape = computed(() => props.closeOnEscape);
347
352
  const closeOnOutsideClick = computed(() => props.closeOnOutsideClick);
@@ -366,9 +371,7 @@ var dialog_root_default = /* @__PURE__ */ defineVaporComponent({
366
371
  })
367
372
  });
368
373
  function setOpen(value) {
369
- const previous = isOpen.value;
370
- if (props.open === void 0) uncontrolledOpen.value = value;
371
- if (previous !== value) emit("update:open", value);
374
+ if (isOpen.value !== value) controllableOpen.setValue(value);
372
375
  }
373
376
  function rememberFocus() {
374
377
  if (typeof document === "undefined" || restoreFocusTo) return;
@@ -1,7 +1,8 @@
1
1
  import './dropdown-menu.css';
2
- import { t as bem } from "./bem.js";
2
+ import { t as useControllableValue } from "./useControllableValue.js";
3
3
  import { n as useStylesApi, t as presence } from "./styles-api.js";
4
4
  import { t as useRequiredInject } from "./useRequiredInject.js";
5
+ import { t as bem } from "./bem.js";
5
6
  import { n as useOverlayZIndex, r as useOverlayLayer } from "./useOverlayZIndex.js";
6
7
  import { n as useFloatingPosition, r as useFloatingTarget, t as isElementReference } from "./useFloatingPosition.js";
7
8
  import { n as useTeleportPositioningKey, r as useTeleportTarget, t as provideTeleportTarget } from "./useTeleportTarget.js";
@@ -339,14 +340,17 @@ var dropdown_menu_checkbox_item_default = /* @__PURE__ */ defineVaporComponent({
339
340
  const props = __props;
340
341
  const emit = __emit;
341
342
  const attrs = useAttrs();
342
- const uncontrolled = ref(props.defaultValue);
343
- const value = computed(() => props.modelValue ?? uncontrolled.value);
343
+ const controllable = useControllableValue({
344
+ modelValue: () => props.modelValue,
345
+ defaultValue: () => props.defaultValue,
346
+ onChange: (value) => emit("update:modelValue", value)
347
+ });
348
+ const value = controllable.value;
344
349
  const checked = computed(() => value.value === "indeterminate" ? "mixed" : value.value);
345
350
  const state = computed(() => value.value === "indeterminate" ? "indeterminate" : value.value ? "checked" : "unchecked");
346
351
  function toggleChecked() {
347
352
  const nextValue = value.value === "indeterminate" ? true : !value.value;
348
- if (props.modelValue === void 0) uncontrolled.value = nextValue;
349
- emit("update:modelValue", nextValue);
353
+ controllable.setValue(nextValue);
350
354
  }
351
355
  provide(checkedKey, {
352
356
  state,
@@ -765,7 +769,6 @@ var dropdown_menu_context_trigger_default = /* @__PURE__ */ defineVaporComponent
765
769
  const rootAttrs = computed(() => mergeProps(attrs, {
766
770
  id: id.value,
767
771
  "aria-controls": root.contentId.value,
768
- "aria-expanded": root.isOpen.value,
769
772
  "aria-haspopup": "menu",
770
773
  "aria-disabled": optionalAttr(isDisabled.value),
771
774
  "data-state": root.isOpen.value ? "open" : "closed",
@@ -957,12 +960,17 @@ var dropdown_menu_radio_group_default = /* @__PURE__ */ defineVaporComponent({
957
960
  const emit = __emit;
958
961
  const attrs = useAttrs();
959
962
  useRequiredInject(menuKey, "RpDropdownMenuRadioGroup");
960
- const uncontrolled = ref(props.defaultValue);
961
- const value = computed(() => props.modelValue === void 0 ? uncontrolled.value : props.modelValue);
963
+ const controllable = useControllableValue({
964
+ modelValue: () => props.modelValue,
965
+ defaultValue: () => props.defaultValue,
966
+ onChange: (value) => {
967
+ if (value !== null) emit("update:modelValue", value);
968
+ }
969
+ });
970
+ const value = controllable.value;
962
971
  function select(nextValue) {
963
972
  if (value.value === nextValue) return;
964
- if (props.modelValue === void 0) uncontrolled.value = nextValue;
965
- emit("update:modelValue", nextValue);
973
+ controllable.setValue(nextValue);
966
974
  }
967
975
  provide(radioGroupKey, {
968
976
  value,
@@ -976,7 +984,7 @@ var dropdown_menu_radio_group_default = /* @__PURE__ */ defineVaporComponent({
976
984
  "aria-labelledby": props.ariaLabelledby
977
985
  }));
978
986
  return createDynamicComponent(() => __props.as, { $: [() => rootAttrs.value] }, extend(() => {
979
- return createSlot("default", { value: () => value.value });
987
+ return createSlot("default", { value: () => unref(value) });
980
988
  }, { _: 8 }), 1);
981
989
  }
982
990
  });
@@ -1089,8 +1097,12 @@ var dropdown_menu_root_default = /* @__PURE__ */ defineVaporComponent({
1089
1097
  const emit = __emit;
1090
1098
  const generatedId = useId();
1091
1099
  const id = computed(() => props.id ?? `${generatedId}-dropdown-menu`);
1092
- const uncontrolledOpen = ref(props.defaultOpen);
1093
- const isOpen = computed(() => props.open ?? uncontrolledOpen.value);
1100
+ const controllableOpen = useControllableValue({
1101
+ modelValue: () => props.open,
1102
+ defaultValue: () => props.defaultOpen,
1103
+ onChange: (nextOpen) => emit("update:open", nextOpen)
1104
+ });
1105
+ const isOpen = controllableOpen.value;
1094
1106
  const disabled = computed(() => props.disabled);
1095
1107
  const modal = computed(() => props.modal);
1096
1108
  const trigger = ref(null);
@@ -1115,9 +1127,7 @@ var dropdown_menu_root_default = /* @__PURE__ */ defineVaporComponent({
1115
1127
  });
1116
1128
  function setOpen(value) {
1117
1129
  if (value && disabled.value) return;
1118
- const previous = isOpen.value;
1119
- if (props.open === void 0) uncontrolledOpen.value = value;
1120
- if (previous !== value) emit("update:open", value);
1130
+ if (isOpen.value !== value) controllableOpen.setValue(value);
1121
1131
  }
1122
1132
  function rememberFocus() {
1123
1133
  if (typeof document === "undefined" || returnFocusElement) return;
@@ -1253,16 +1263,18 @@ var dropdown_menu_sub_default = /* @__PURE__ */ defineVaporComponent({
1253
1263
  const props = __props;
1254
1264
  const emit = __emit;
1255
1265
  const parentMenu = useRequiredInject(menuKey, "RpDropdownMenuSub");
1256
- const uncontrolled = ref(props.defaultOpen);
1257
- const isOpen = computed(() => props.open ?? uncontrolled.value);
1266
+ const controllableOpen = useControllableValue({
1267
+ modelValue: () => props.open,
1268
+ defaultValue: () => props.defaultOpen,
1269
+ onChange: (open) => emit("update:open", open)
1270
+ });
1271
+ const isOpen = controllableOpen.value;
1258
1272
  const trigger = ref(null);
1259
1273
  const contentId = ref();
1260
1274
  const actualPlacement = ref("right-start");
1261
1275
  const pendingFocus = ref(false);
1262
1276
  function setOpen(value) {
1263
- const previous = isOpen.value;
1264
- if (props.open === void 0) uncontrolled.value = value;
1265
- if (previous !== value) emit("update:open", value);
1277
+ if (isOpen.value !== value) controllableOpen.setValue(value);
1266
1278
  }
1267
1279
  const context = {
1268
1280
  isOpen,
@@ -1294,7 +1306,7 @@ var dropdown_menu_sub_default = /* @__PURE__ */ defineVaporComponent({
1294
1306
  });
1295
1307
  onBeforeUnmount(() => parentMenu.unregisterSub(context));
1296
1308
  return createSlot("default", {
1297
- isOpen: () => isOpen.value,
1309
+ isOpen: () => unref(isOpen),
1298
1310
  open: () => context.open,
1299
1311
  close: () => context.close
1300
1312
  });
@@ -1682,12 +1694,10 @@ var dropdown_menu_items_default = /* @__PURE__ */ defineVaporComponent({
1682
1694
  });
1683
1695
  //#endregion
1684
1696
  //#region src/components/dropdown-menu/useDropdownMenuDisclosure.ts
1685
- function useDropdownMenuDisclosure({ props, emit, rootRef, menuRef, targetRef, uncontrolledOpen, isDisabled, isOpen, isVisible, focusedPath, resetFocus, resetSubmenus, resetHoverIntent, focusItem, focusMenu, focusTrigger, layer }) {
1697
+ function useDropdownMenuDisclosure({ props, emit, rootRef, menuRef, targetRef, setControllableOpen, isDisabled, isOpen, isVisible, focusedPath, resetFocus, resetSubmenus, resetHoverIntent, focusItem, focusMenu, focusTrigger, layer }) {
1686
1698
  function setOpen(nextOpen) {
1687
1699
  if (nextOpen && isDisabled.value) return;
1688
- const previousOpen = isOpen.value;
1689
- if (props.open === void 0) uncontrolledOpen.value = nextOpen;
1690
- if (previousOpen !== nextOpen) emit.openChange?.(nextOpen);
1700
+ if (isOpen.value !== nextOpen) setControllableOpen(nextOpen);
1691
1701
  }
1692
1702
  function resetMenuFocus() {
1693
1703
  resetFocus();
@@ -2368,7 +2378,11 @@ function useDropdownMenu(props, emit = {}) {
2368
2378
  const rootRef = ref(null);
2369
2379
  const menuRef = ref(null);
2370
2380
  const arrowRef = ref(null);
2371
- const uncontrolledOpen = ref(false);
2381
+ const controllableOpen = useControllableValue({
2382
+ modelValue: () => props.open,
2383
+ defaultValue: () => false,
2384
+ onChange: (open) => emit.openChange?.(open)
2385
+ });
2372
2386
  const generatedId = useId();
2373
2387
  const menuId = computed(() => props.id ?? `${generatedId}-menu`);
2374
2388
  const placement = computed(() => props.placement ?? "bottom-start");
@@ -2379,7 +2393,7 @@ function useDropdownMenu(props, emit = {}) {
2379
2393
  const targetElement = computed(() => isElementReference(resolvedTarget.value) ? resolvedTarget.value : null);
2380
2394
  const visibleItems = computed(() => props.items ?? []);
2381
2395
  const isDisabled = computed(() => Boolean(props.disabled));
2382
- const isOpen = computed(() => props.open ?? uncontrolledOpen.value);
2396
+ const isOpen = controllableOpen.value;
2383
2397
  const isVisible = computed(() => isOpen.value && !isDisabled.value);
2384
2398
  const layer = useOverlayLayer({
2385
2399
  active: isVisible,
@@ -2445,7 +2459,7 @@ function useDropdownMenu(props, emit = {}) {
2445
2459
  rootRef,
2446
2460
  menuRef,
2447
2461
  targetRef: targetElement,
2448
- uncontrolledOpen,
2462
+ setControllableOpen: controllableOpen.setValue,
2449
2463
  isDisabled,
2450
2464
  isOpen,
2451
2465
  isVisible,
package/dist/field.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import './field.css';
2
- import { t as bem } from "./bem.js";
3
2
  import { n as useStylesApi, t as presence } from "./styles-api.js";
3
+ import { t as bem } from "./bem.js";
4
4
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
5
5
  import { child, computed, createIf, createInvoker, createSlot, defineVaporComponent, delegateEvents, renderEffect, setDynamicProps, setInsertionState, setText, template, toDisplayString, unref, useId, useSlots } from "vue";
6
6
  //#region src/components/field/useField.ts