@strapi/ui-primitives 0.0.0-3cf3ff39

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/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2015-present Strapi Solutions SAS
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # Strapi Primitives
2
+
3
+ [![Version](https://img.shields.io/npm/v/@strapi/ui-primitives?style=flat&colorA=4945ff&colorB=4945ff)](https://www.npmjs.com/package/@strapi/ui-primitives)
4
+ [![Downloads](https://img.shields.io/npm/dt/@strapi/ui-primitives.svg?style=flat&colorA=4945ff&colorB=4945ff)](https://www.npmjs.com/package/@strapi/ui-primitives)
5
+ [![Discord Shield](https://img.shields.io/discord/811989166782021633?style=flat&colorA=4945ff&colorB=4945ff&label=discord&logo=discord&logoColor=f0f0ff)](https://discord.gg/strapi)
6
+
7
+ <b>A UI component library for building accessibile design systems & web apps.</b>
8
+
9
+ While typically we use [radix-ui primitives](https://github.com/radix-ui/primitives) in our design-system, there are some missing components. To solve this issue, we work with Radix's internal packages & APIs to develop base layer primitives in a composable manor until they are (hopefully) released through Radix and we can deprecate them here.
10
+
11
+ ## Installation
12
+
13
+ ```shell
14
+ yarn add @strapi/ui-primitives
15
+
16
+ # or
17
+
18
+ npm i @strapi/ui-primitives
19
+ ```
20
+
21
+ ## Component Documentation
22
+
23
+ This directory shows a basic usage of the component, however for more details click on the storybook badge.
24
+
25
+ <ul>
26
+ <li><a href="#combobox">Combobox</a></li>
27
+ <li><a href="#select">Select</a></li>
28
+ </ul>
29
+
30
+ ### Combobox
31
+
32
+ [![](https://img.shields.io/badge/-storybook-%234945ff)](https://design-system-git-main-strapijs.vercel.app/?path=/story/design-system-primitives-combobox--basic-usage)
33
+
34
+ #### Basic Usage
35
+
36
+ ```jsx
37
+ import { Combobox } from '@strapi/ui-primitives';
38
+
39
+ () => {
40
+ return (
41
+ <Combobox.Root>
42
+ <Combobox.Trigger>
43
+ <Combobox.TextInput placeholder="Pick me" />
44
+ <Combobox.Icon />
45
+ </Combobox.Trigger>
46
+ <Combobox.Portal>
47
+ <Combobox.Content>
48
+ <Combobox.Viewport>
49
+ <Combobox.Item value="1">
50
+ <Combobox.ItemText>Option 1</Combobox.ItemText>
51
+ <Combobox.ItemIndicator>
52
+ <Check />
53
+ </Combobox.ItemIndicator>
54
+ </Combobox.Item>
55
+ <Combobox.NoValueFound>No value found</Combobox.NoValueFound>
56
+ <Combobox.CreateItem>Create a new value</Combobox.CreateItem>
57
+ </Combobox.Viewport>
58
+ </Combobox.Content>
59
+ </Combobox.Portal>
60
+ </Combobox.Root>
61
+ );
62
+ };
63
+ ```
64
+
65
+ ### Select
66
+
67
+ [![](https://img.shields.io/badge/-storybook-%234945ff)](https://design-system-git-main-strapijs.vercel.app/?path=/story/design-system-primitives-select--basic-usage)
68
+
69
+ #### Basic Usage
70
+
71
+ ```jsx
72
+ import { Select } from '@strapi/ui-primitives';
73
+
74
+ () => {
75
+ return (
76
+ <Select.Root>
77
+ <Select.Trigger>
78
+ <Select.Value placeholder="Pick me" />
79
+ <Select.Icon />
80
+ </Select.Trigger>
81
+ <Select.Portal>
82
+ <Select.Content>
83
+ <Select.Viewport>
84
+ <Select.Item value="1">
85
+ <Select.ItemText>Option 1</Select.ItemText>
86
+ <Select.ItemIndicator>
87
+ <Check />
88
+ </Select.ItemIndicator>
89
+ </Select.Item>
90
+ </Select.Viewport>
91
+ </Select.Content>
92
+ </Select.Portal>
93
+ </Select.Root>
94
+ );
95
+ };
96
+ ```
97
+
98
+ ## Contributing
99
+
100
+ Please follow our [CONTRIBUTING](https://github.com/strapi/design-system/blob/main/CONTRIBUTING.md) guidelines.
101
+
102
+ ## License
103
+
104
+ Licensed under the MIT License, Copyright © 2022-present [Strapi Solutions SAS](https://strapi.io).
105
+
106
+ See [LICENSE](https://github.com/strapi/design-system/blob/main/LICENSE) for more information.
@@ -0,0 +1,34 @@
1
+ /**
2
+ * An internal fork of Radix UI's `Collection` component.
3
+ *
4
+ * We've added a subscription API to allow us to subscribe to changes in the collection via the useCollection hook.
5
+ */
6
+ import * as React from 'react';
7
+ import type * as Radix from '@radix-ui/react-primitive';
8
+ import { Slot } from '@radix-ui/react-slot';
9
+ type SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;
10
+ interface CollectionProps extends SlotProps {
11
+ scope: any;
12
+ }
13
+ declare function createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
14
+ readonly Provider: React.FC<{
15
+ children?: React.ReactNode;
16
+ scope: any;
17
+ }>;
18
+ readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>;
19
+ readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
20
+ children: React.ReactNode;
21
+ scope: any;
22
+ }> & React.RefAttributes<ItemElement>>;
23
+ }, (scope: any) => {
24
+ getItems: () => ({
25
+ ref: React.RefObject<ItemElement>;
26
+ } & ItemData)[];
27
+ subscribe: (listener: (newState: ({
28
+ ref: React.RefObject<ItemElement>;
29
+ } & ItemData)[], prevState: ({
30
+ ref: React.RefObject<ItemElement>;
31
+ } & ItemData)[]) => void) => () => boolean;
32
+ }, import("@radix-ui/react-context").CreateScope];
33
+ export { createCollection };
34
+ export type { CollectionProps };
@@ -0,0 +1,2 @@
1
+ export { createCollection } from './Collection';
2
+ export type { CollectionProps } from './Collection';
@@ -0,0 +1,97 @@
1
+ import * as React from 'react';
2
+ import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
3
+ import * as PopperPrimitive from '@radix-ui/react-popper';
4
+ import { Portal as PortalPrimitive } from '@radix-ui/react-portal';
5
+ import { Primitive } from '@radix-ui/react-primitive';
6
+ import type { ComponentPropsWithoutRef } from '@radix-ui/react-primitive';
7
+ interface RootProps {
8
+ allowCustomValue?: boolean;
9
+ autocomplete?: 'none' | 'list' | 'both';
10
+ children?: React.ReactNode;
11
+ defaultOpen?: boolean;
12
+ defaultValue?: string;
13
+ defaultTextValue?: string;
14
+ disabled?: boolean;
15
+ locale?: string;
16
+ onOpenChange?(open: boolean): void;
17
+ onValueChange?(value: string): void;
18
+ onTextValueChange?(textValue: string): void;
19
+ textValue?: string;
20
+ open?: boolean;
21
+ required?: boolean;
22
+ value?: string;
23
+ defaultFilterValue?: string;
24
+ filterValue?: string;
25
+ onFilterValueChange?(value: string): void;
26
+ isPrintableCharacter?: (str: string) => boolean;
27
+ }
28
+ type TriggerProps = PrimitiveDivProps;
29
+ interface TextInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
30
+ }
31
+ type PrimitiveButtonProps = ComponentPropsWithoutRef<typeof Primitive.button>;
32
+ interface IconProps extends PrimitiveButtonProps {
33
+ }
34
+ type IPortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;
35
+ interface PortalProps extends Omit<IPortalProps, 'asChild'> {
36
+ children?: React.ReactNode;
37
+ }
38
+ type ContentProps = ComboboxContentImplProps;
39
+ type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;
40
+ type ComboboxPopperPrivateProps = {
41
+ onPlaced?: PopperContentProps['onPlaced'];
42
+ };
43
+ interface ComboboxContentImplProps extends Omit<ComboboxPopperPositionProps, keyof ComboboxPopperPrivateProps> {
44
+ /**
45
+ * Event handler called when the escape key is down.
46
+ * Can be prevented.
47
+ */
48
+ onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];
49
+ /**
50
+ * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.
51
+ * Can be prevented.
52
+ */
53
+ onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];
54
+ }
55
+ type PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;
56
+ interface ComboboxPopperPositionProps extends PopperContentProps, ComboboxPopperPrivateProps {
57
+ }
58
+ type PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;
59
+ interface ViewportProps extends PrimitiveDivProps {
60
+ }
61
+ interface ItemProps extends PrimitiveDivProps {
62
+ value: string;
63
+ disabled?: boolean;
64
+ textValue?: string;
65
+ }
66
+ export declare const ComboboxItem: React.ForwardRefExoticComponent<ItemProps & React.RefAttributes<HTMLDivElement>>;
67
+ type PrimitiveSpanProps = ComponentPropsWithoutRef<typeof Primitive.span>;
68
+ type ItemTextProps = PrimitiveSpanProps;
69
+ interface ItemIndicatorProps extends PrimitiveSpanProps {
70
+ }
71
+ interface NoValueFoundProps extends PrimitiveDivProps {
72
+ }
73
+ interface CreateItemProps extends PrimitiveDivProps {
74
+ disabled?: boolean;
75
+ }
76
+ declare const Root: React.FC<RootProps>;
77
+ declare const Trigger: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
78
+ ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
79
+ } & {
80
+ asChild?: boolean | undefined;
81
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>>;
82
+ declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
83
+ declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<HTMLButtonElement>>;
84
+ declare const Portal: React.FC<PortalProps>;
85
+ declare const Content: React.ForwardRefExoticComponent<ComboboxContentImplProps & React.RefAttributes<HTMLDivElement>>;
86
+ declare const Viewport: React.ForwardRefExoticComponent<ViewportProps & React.RefAttributes<HTMLDivElement>>;
87
+ declare const Item: React.ForwardRefExoticComponent<ItemProps & React.RefAttributes<HTMLDivElement>>;
88
+ declare const ItemText: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
89
+ ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
90
+ } & {
91
+ asChild?: boolean | undefined;
92
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLSpanElement>> & React.RefAttributes<HTMLSpanElement>>;
93
+ declare const ItemIndicator: React.ForwardRefExoticComponent<ItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
94
+ declare const NoValueFound: React.ForwardRefExoticComponent<NoValueFoundProps & React.RefAttributes<HTMLDivElement>>;
95
+ declare const CreateItem: React.ForwardRefExoticComponent<CreateItemProps & React.RefAttributes<HTMLDivElement>>;
96
+ export { Root, Trigger, TextInput, Icon, Portal, Content, Viewport, Item, ItemText, ItemIndicator, NoValueFound, CreateItem, };
97
+ export type { RootProps, TriggerProps, TextInputProps, IconProps, PortalProps, ContentProps, ViewportProps, ItemProps, ItemTextProps, ItemIndicatorProps, NoValueFoundProps, CreateItemProps, };
@@ -0,0 +1 @@
1
+ export * as Combobox from './Combobox';
@@ -0,0 +1,163 @@
1
+ /**
2
+ * We've forked this from RadixUI to add primarily support for multi-select.
3
+ * This is on their roadmap – https://github.com/radix-ui/primitives/issues/1193
4
+ *
5
+ * The changes are dotted around the codebase but all linked to a primary objective:
6
+ * 1. The Select `value` can now be a string or an array of strings
7
+ * 2. The Select `onValueChange` callback now receives a string or an array of strings
8
+ *
9
+ * Therefore, anywhere you see code handling values. It will accept and manage `string | string[]`,
10
+ * thankfully Typescript is very helpful with this.
11
+ *
12
+ * Hopefully in the future we can remove this fork ✌🏼
13
+ */
14
+ import * as React from 'react';
15
+ import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
16
+ import { FocusScope } from '@radix-ui/react-focus-scope';
17
+ import * as PopperPrimitive from '@radix-ui/react-popper';
18
+ import { Portal as PortalPrimitive } from '@radix-ui/react-portal';
19
+ import { Primitive } from '@radix-ui/react-primitive';
20
+ import type * as Radix from '@radix-ui/react-primitive';
21
+ type Direction = 'ltr' | 'rtl';
22
+ declare const createSelectScope: import("@radix-ui/react-context").CreateScope;
23
+ interface SharedSelectProps {
24
+ children?: React.ReactNode;
25
+ open?: boolean;
26
+ defaultOpen?: boolean;
27
+ onOpenChange?(open: boolean): void;
28
+ dir?: Direction;
29
+ name?: string;
30
+ autoComplete?: string;
31
+ disabled?: boolean;
32
+ required?: boolean;
33
+ }
34
+ interface SingleSelectProps extends SharedSelectProps {
35
+ onValueChange?(value: string): void;
36
+ value?: string;
37
+ defaultValue?: string;
38
+ multi?: false;
39
+ }
40
+ interface MultiSelectProps extends SharedSelectProps {
41
+ onValueChange?(value: string[]): void;
42
+ value?: string[];
43
+ defaultValue?: string[];
44
+ multi: true;
45
+ }
46
+ type SelectProps = SingleSelectProps | MultiSelectProps;
47
+ declare const Select: React.FC<SelectProps>;
48
+ type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
49
+ interface SelectTriggerProps extends PrimitiveButtonProps {
50
+ }
51
+ declare const SelectTrigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<HTMLDivElement>>;
52
+ type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
53
+ type SelectValueRenderFn = {
54
+ ({ value, textValue }: {
55
+ value?: string;
56
+ textValue?: string;
57
+ }): React.ReactNode;
58
+ (value?: string): React.ReactNode;
59
+ };
60
+ interface SelectValueProps extends Omit<PrimitiveSpanProps, 'placeholder' | 'children'> {
61
+ placeholder?: React.ReactNode;
62
+ children?: React.ReactNode | SelectValueRenderFn;
63
+ }
64
+ declare const SelectValue: React.ForwardRefExoticComponent<SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
65
+ interface SelectIconProps extends PrimitiveSpanProps {
66
+ }
67
+ declare const SelectIcon: React.ForwardRefExoticComponent<SelectIconProps & React.RefAttributes<HTMLSpanElement>>;
68
+ type PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;
69
+ interface SelectPortalProps extends Omit<PortalProps, 'asChild'> {
70
+ children?: React.ReactNode;
71
+ }
72
+ declare const SelectPortal: React.FC<SelectPortalProps>;
73
+ interface SelectContentProps extends SelectContentImplProps {
74
+ }
75
+ declare const SelectContent: React.ForwardRefExoticComponent<SelectContentProps & React.RefAttributes<HTMLDivElement>>;
76
+ type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;
77
+ type FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;
78
+ type SelectPopperPrivateProps = {
79
+ onPlaced?: PopperContentProps['onPlaced'];
80
+ };
81
+ interface SelectContentImplProps extends Omit<SelectPopperPositionProps, keyof SelectPopperPrivateProps>, Omit<SelectItemAlignedPositionProps, keyof SelectPopperPrivateProps> {
82
+ /**
83
+ * Event handler called when auto-focusing on close.
84
+ * Can be prevented.
85
+ */
86
+ onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
87
+ /**
88
+ * Event handler called when the escape key is down.
89
+ * Can be prevented.
90
+ */
91
+ onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];
92
+ /**
93
+ * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.
94
+ * Can be prevented.
95
+ */
96
+ onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];
97
+ position?: 'item-aligned' | 'popper';
98
+ }
99
+ interface SelectItemAlignedPositionProps extends PrimitiveDivProps, SelectPopperPrivateProps {
100
+ }
101
+ type PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;
102
+ interface SelectPopperPositionProps extends PopperContentProps, SelectPopperPrivateProps {
103
+ }
104
+ type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
105
+ interface SelectViewportProps extends PrimitiveDivProps {
106
+ }
107
+ declare const SelectViewport: React.ForwardRefExoticComponent<SelectViewportProps & React.RefAttributes<HTMLDivElement>>;
108
+ interface SelectGroupProps extends PrimitiveDivProps {
109
+ }
110
+ declare const SelectGroup: React.ForwardRefExoticComponent<SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
111
+ interface SelectLabelProps extends PrimitiveDivProps {
112
+ }
113
+ declare const SelectLabel: React.ForwardRefExoticComponent<SelectLabelProps & React.RefAttributes<HTMLDivElement>>;
114
+ interface SelectItemProps extends PrimitiveDivProps {
115
+ value: string | string[];
116
+ disabled?: boolean;
117
+ textValue?: string;
118
+ }
119
+ declare const SelectItem: React.ForwardRefExoticComponent<SelectItemProps & React.RefAttributes<HTMLDivElement>>;
120
+ interface SelectItemTextProps extends PrimitiveSpanProps {
121
+ }
122
+ declare const SelectItemText: React.ForwardRefExoticComponent<SelectItemTextProps & React.RefAttributes<HTMLSpanElement>>;
123
+ interface SelectItemIndicatorProps extends Omit<PrimitiveSpanProps, 'children'> {
124
+ children?: React.ReactNode | ((state: {
125
+ isSelected: boolean;
126
+ isIntermediate: boolean;
127
+ }) => React.ReactNode);
128
+ }
129
+ declare const SelectItemIndicator: React.ForwardRefExoticComponent<SelectItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
130
+ interface SelectScrollUpButtonProps extends Omit<SelectScrollButtonImplProps, 'onAutoScroll'> {
131
+ }
132
+ declare const SelectScrollUpButton: React.ForwardRefExoticComponent<SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>>;
133
+ interface SelectScrollDownButtonProps extends Omit<SelectScrollButtonImplProps, 'onAutoScroll'> {
134
+ }
135
+ declare const SelectScrollDownButton: React.ForwardRefExoticComponent<SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>>;
136
+ interface SelectScrollButtonImplProps extends PrimitiveDivProps {
137
+ onAutoScroll(): void;
138
+ }
139
+ interface SelectSeparatorProps extends PrimitiveDivProps {
140
+ }
141
+ declare const SelectSeparator: React.ForwardRefExoticComponent<SelectSeparatorProps & React.RefAttributes<HTMLDivElement>>;
142
+ type PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;
143
+ interface SelectArrowProps extends PopperArrowProps {
144
+ }
145
+ declare const SelectArrow: React.ForwardRefExoticComponent<SelectArrowProps & React.RefAttributes<SVGSVGElement>>;
146
+ declare const Root: React.FC<SelectProps>;
147
+ declare const Trigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<HTMLDivElement>>;
148
+ declare const Value: React.ForwardRefExoticComponent<SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
149
+ declare const Icon: React.ForwardRefExoticComponent<SelectIconProps & React.RefAttributes<HTMLSpanElement>>;
150
+ declare const Portal: React.FC<SelectPortalProps>;
151
+ declare const Content: React.ForwardRefExoticComponent<SelectContentProps & React.RefAttributes<HTMLDivElement>>;
152
+ declare const Viewport: React.ForwardRefExoticComponent<SelectViewportProps & React.RefAttributes<HTMLDivElement>>;
153
+ declare const Group: React.ForwardRefExoticComponent<SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
154
+ declare const Label: React.ForwardRefExoticComponent<SelectLabelProps & React.RefAttributes<HTMLDivElement>>;
155
+ declare const Item: React.ForwardRefExoticComponent<SelectItemProps & React.RefAttributes<HTMLDivElement>>;
156
+ declare const ItemText: React.ForwardRefExoticComponent<SelectItemTextProps & React.RefAttributes<HTMLSpanElement>>;
157
+ declare const ItemIndicator: React.ForwardRefExoticComponent<SelectItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
158
+ declare const ScrollUpButton: React.ForwardRefExoticComponent<SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>>;
159
+ declare const ScrollDownButton: React.ForwardRefExoticComponent<SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>>;
160
+ declare const Separator: React.ForwardRefExoticComponent<SelectSeparatorProps & React.RefAttributes<HTMLDivElement>>;
161
+ declare const Arrow: React.ForwardRefExoticComponent<SelectArrowProps & React.RefAttributes<SVGSVGElement>>;
162
+ export { createSelectScope, Select, SelectTrigger, SelectValue, SelectIcon, SelectPortal, SelectContent, SelectViewport, SelectGroup, SelectLabel, SelectItem, SelectItemText, SelectItemIndicator, SelectScrollUpButton, SelectScrollDownButton, SelectSeparator, SelectArrow, Root, Trigger, Value, Icon, Portal, Content, Viewport, Group, Label, Item, ItemText, ItemIndicator, ScrollUpButton, ScrollDownButton, Separator, Arrow, };
163
+ export type { SingleSelectProps, MultiSelectProps, SelectProps, SelectTriggerProps, SelectValueProps, SelectValueRenderFn, SelectIconProps, SelectPortalProps, SelectContentProps, SelectViewportProps, SelectGroupProps, SelectLabelProps, SelectItemProps, SelectItemTextProps, SelectItemIndicatorProps, SelectScrollUpButtonProps, SelectScrollDownButtonProps, SelectSeparatorProps, SelectArrowProps, };
@@ -0,0 +1 @@
1
+ export * as Select from './Select';
@@ -0,0 +1 @@
1
+ export { composeEventHandlers } from '@radix-ui/primitive';
@@ -0,0 +1 @@
1
+ export { useCallbackRef } from '@radix-ui/react-use-callback-ref';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Stolen from @react-aria/i18n
3
+ */
4
+ /**
5
+ * Provides localized string collation for the current locale. Automatically updates when the locale changes,
6
+ * and handles caching of the collator for performance.
7
+ * @param options - Collator options.
8
+ */
9
+ export declare function useCollator(locale: string, options?: Intl.CollatorOptions): Intl.Collator;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Stolen from @react-aria/i18n
3
+ */
4
+ export interface Filter {
5
+ /** Returns whether a string starts with a given substring. */
6
+ startsWith(string: string, substring: string): boolean;
7
+ /** Returns whether a string ends with a given substring. */
8
+ endsWith(string: string, substring: string): boolean;
9
+ /** Returns whether a string contains a given substring. */
10
+ contains(string: string, substring: string): boolean;
11
+ }
12
+ /**
13
+ * Provides localized string search functionality that is useful for filtering or matching items
14
+ * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.
15
+ */
16
+ export declare function useFilter(locale: string, options?: Intl.CollatorOptions): Filter;
@@ -0,0 +1 @@
1
+ export declare const usePrev: <T>(value: T) => T | undefined;
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),Pt=require("react"),M=require("@radix-ui/react-compose-refs"),ge=require("@radix-ui/react-context"),Ee=require("@radix-ui/react-slot"),I=require("@radix-ui/primitive"),Qe=require("@radix-ui/react-dismissable-layer"),et=require("@radix-ui/react-focus-guards"),tt=require("@radix-ui/react-focus-scope"),ne=require("@radix-ui/react-id"),Ne=require("@radix-ui/react-popper"),ot=require("@radix-ui/react-portal"),A=require("@radix-ui/react-primitive"),ie=require("@radix-ui/react-use-controllable-state"),k=require("@radix-ui/react-use-layout-effect"),nt=require("aria-hidden"),Vt=require("react-dom"),rt=require("react-remove-scroll"),Je=require("@radix-ui/number"),Rt=require("@radix-ui/react-collection"),_t=require("@radix-ui/react-direction"),Nt=require("@radix-ui/react-use-previous"),At=require("@radix-ui/react-visually-hidden"),Ot=require("@strapi/ui-primitives"),Mt=require("@radix-ui/react-use-callback-ref");function Ae(n){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(l,e,t.get?t:{enumerable:!0,get:()=>n[e]})}}return l.default=n,Object.freeze(l)}const s=Ae(Pt),se=Ae(Ne),Oe=Ae(Vt);function st(n){const l=`${n}CollectionProvider`,[e,t]=ge.createContextScope(l),[o,r]=e(l,{collectionRef:{current:null},itemMap:new Map,listeners:new Set}),i=d=>{const{scope:m,children:b}=d,g=s.useRef(null),C=s.useRef(new Map).current,h=s.useRef(new Set).current;return u.jsx(o,{scope:m,itemMap:C,collectionRef:g,listeners:h,children:b})};i.displayName=l;const c=`${n}CollectionSlot`,a=s.forwardRef((d,m)=>{const{scope:b,children:g}=d,C=r(c,b),h=M.useComposedRefs(m,C.collectionRef);return u.jsx(Ee.Slot,{ref:h,children:g})});a.displayName=c;const x=`${n}CollectionItemSlot`,f="data-radix-collection-item",v=s.forwardRef((d,m)=>{const{scope:b,children:g,...C}=d,h=s.useRef(null),y=M.useComposedRefs(m,h),R=r(x,b);return s.useEffect(()=>{const O=Array.from(R.itemMap.values());return R.itemMap.set(h,{ref:h,...C}),R.listeners.forEach(V=>V(Array.from(R.itemMap.values()),O)),()=>{const V=Array.from(R.itemMap.values());R.itemMap.delete(h),R.listeners.forEach(_=>_(Array.from(R.itemMap.values()),V))}}),u.jsx(Ee.Slot,{[f]:"",ref:y,children:g})});v.displayName=x;function p(d){const m=r(`${n}CollectionConsumer`,d),b=s.useCallback(()=>{const C=m.collectionRef.current;if(!C)return[];const h=Array.from(C.querySelectorAll(`[${f}]`));return Array.from(m.itemMap.values()).sort((O,V)=>h.indexOf(O.ref.current)-h.indexOf(V.ref.current))},[m.collectionRef,m.itemMap]),g=s.useCallback(C=>(m.listeners.add(C),()=>m.listeners.delete(C)),[m.listeners]);return{getItems:b,subscribe:g}}return[{Provider:i,Slot:a,ItemSlot:v},p,t]}let Ie=new Map;function jt(n,l){let e=n+(l?Object.entries(l).sort((o,r)=>o[0]<r[0]?-1:1).join():"");if(Ie.has(e))return Ie.get(e);let t=new Intl.Collator(n,l);return Ie.set(e,t),t}function Me(n,l){let e=jt(n,{usage:"search",...l});return{startsWith(t,o){return o.length===0?!0:(t=t.normalize("NFC"),o=o.normalize("NFC"),e.compare(t.slice(0,o.length),o)===0)},endsWith(t,o){return o.length===0?!0:(t=t.normalize("NFC"),o=o.normalize("NFC"),e.compare(t.slice(-o.length),o)===0)},contains(t,o){if(o.length===0)return!0;t=t.normalize("NFC"),o=o.normalize("NFC");let r=0,i=o.length;for(;r+i<=t.length;r++){let c=t.slice(r,r+i);if(e.compare(o,c)===0)return!0}return!1}}}const Dt=n=>{const l=s.useRef();return s.useEffect(()=>{l.current=n}),l.current},Lt=[" ","Enter","ArrowUp","ArrowDown"],Ft=["Enter"],kt=n=>!!(n.length===1&&n.match(/\S| /)),lt="Combobox",[fe,ve]=st(lt),[Ht,z]=ge.createContext(lt),Bt=({children:n})=>u.jsx(se.Root,{children:u.jsx(fe.Provider,{scope:void 0,children:n})}),Ut=n=>{const{allowCustomValue:l=!1,autocomplete:e="none",children:t,open:o,defaultOpen:r,onOpenChange:i,value:c,defaultValue:a,onValueChange:x,disabled:f,required:v=!1,locale:p="en-EN",onTextValueChange:d,textValue:m,defaultTextValue:b,filterValue:g,defaultFilterValue:C,onFilterValueChange:h,isPrintableCharacter:y=kt}=n,[R,O]=s.useState(null),[V,_]=s.useState(null),[D,Y]=s.useState(null),[$,F]=s.useState(null),[j=!1,H]=ie.useControllableState({prop:o,defaultProp:r,onChange:i}),[L,q]=ie.useControllableState({prop:c,defaultProp:a,onChange:x}),[K,B]=ie.useControllableState({prop:m,defaultProp:l&&!b?c:b,onChange:d}),[X,U]=ie.useControllableState({prop:g,defaultProp:C,onChange:h}),ue=ne.useId(),le=s.useCallback((de,Q)=>{const Z=Q.map(E=>E.ref.current),[ce,...ee]=Z,[S]=ee.slice(-1),T=$??Q.find(E=>E.value===L)?.ref.current;for(const E of de){if(E===T)return;if(E?.scrollIntoView({block:"nearest"}),E===ce&&V&&(V.scrollTop=0),E===S&&V&&(V.scrollTop=V.scrollHeight),F(E),e==="both"){const w=Q.find(P=>P.ref.current===E);w&&B(w.textValue)}if(E!==T)return}},[e,B,V,$,L]);return s.useEffect(()=>{e!=="both"&&F(null)},[K,e]),s.useEffect(()=>{if(D&&R)return nt.hideOthers([D,R])},[D,R]),u.jsx(Bt,{children:u.jsx(Ht,{allowCustomValue:l,autocomplete:e,required:v,trigger:R,onTriggerChange:O,contentId:ue,value:L,onValueChange:q,open:j,onOpenChange:H,disabled:f,locale:p,focusFirst:le,textValue:K,onTextValueChange:B,onViewportChange:_,onContentChange:Y,visuallyFocussedItem:$,filterValue:X,onFilterValueChange:U,onVisuallyFocussedItemChange:F,isPrintableCharacter:y,children:t})})},$t="ComboboxTrigger",qt=s.forwardRef((n,l)=>{const{...e}=n,t=z($t),o=()=>{t.disabled||t.onOpenChange(!0)};return u.jsx(se.Anchor,{asChild:!0,children:u.jsx(tt.FocusScope,{asChild:!0,trapped:t.open,onMountAutoFocus:r=>{r.preventDefault()},onUnmountAutoFocus:r=>{t.trigger?.focus({preventScroll:!0}),document.getSelection()?.empty(),r.preventDefault()},children:u.jsx("div",{ref:l,"data-disabled":t.disabled?"":void 0,...e,onClick:I.composeEventHandlers(e.onClick,()=>{t.trigger?.focus()}),onPointerDown:I.composeEventHandlers(e.onPointerDown,r=>{const i=r.target;i.hasPointerCapture(r.pointerId)&&i.releasePointerCapture(r.pointerId),(i.closest("button")??i.closest("div"))===r.currentTarget&&r.button===0&&r.ctrlKey===!1&&(o(),t.trigger?.focus())})})})})}),ct="ComboboxInput",Kt=s.forwardRef((n,l)=>{const e=z(ct),t=s.useRef(null),{getItems:o}=ve(void 0),{startsWith:r}=Me(e.locale,{sensitivity:"base"}),i=e.disabled,c=M.useComposedRefs(t,l,e.onTriggerChange),a=()=>{i||e.onOpenChange(!0)},x=Dt(e.filterValue);return k.useLayoutEffect(()=>{const f=setTimeout(()=>{if(e.textValue===""||e.textValue===void 0||e.filterValue===""||e.filterValue===void 0)return;const v=o().find(d=>d.type==="option"&&r(d.textValue,e.textValue)),p=bo(x??"",e.filterValue);v&&!e.visuallyFocussedItem&&p===e.filterValue.length&&t.current?.setSelectionRange(e.filterValue.length,e.textValue.length)});return()=>clearTimeout(f)},[e.textValue,e.filterValue,r,e.visuallyFocussedItem,o,x]),u.jsx("input",{type:"text",role:"combobox","aria-controls":e.contentId,"aria-expanded":e.open,"aria-required":e.required,"aria-autocomplete":e.autocomplete,"data-state":e.open?"open":"closed","aria-disabled":i,"aria-activedescendant":e.visuallyFocussedItem?.id,disabled:i,"data-disabled":i?"":void 0,"data-placeholder":e.textValue===void 0?"":void 0,value:e.textValue??"",...n,ref:c,onKeyDown:I.composeEventHandlers(n.onKeyDown,f=>{if(["ArrowUp","ArrowDown","Home","End"].includes(f.key))setTimeout(()=>{let p=o().filter(d=>!d.disabled).map(d=>d.ref.current);if(["ArrowUp","End"].includes(f.key)&&(p=p.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const d=e.visuallyFocussedItem??o().find(m=>m.value===e.value)?.ref.current;if(d){let m=p.indexOf(d);m===p.length-1&&(m=-1),p=p.slice(m+1)}}if(["ArrowDown"].includes(f.key)&&e.autocomplete==="both"&&p.length>1){const[d,...m]=p,b=o().find(g=>g.ref.current===d).textValue;e.textValue===b&&(p=m)}e.focusFirst(p,o())}),f.preventDefault();else if(["Tab"].includes(f.key)&&e.open)f.preventDefault();else if(["Escape"].includes(f.key))e.open?e.onOpenChange(!1):(e.onValueChange(void 0),e.onTextValueChange("")),f.preventDefault();else if(Ft.includes(f.key)){if(e.visuallyFocussedItem){const v=o().find(p=>p.ref.current===e.visuallyFocussedItem);v&&(e.onValueChange(v.value),e.onTextValueChange(v.textValue),e.autocomplete==="both"&&e.onFilterValueChange(v.textValue),v.ref.current?.click())}else{const v=o().find(p=>p.type==="option"&&!p.disabled&&p.textValue===e.textValue);v&&(e.onValueChange(v.value),e.onTextValueChange(v.textValue),e.autocomplete==="both"&&e.onFilterValueChange(v.textValue),v.ref.current?.click())}e.onOpenChange(!1),f.preventDefault()}else e.onVisuallyFocussedItemChange(null)}),onChange:I.composeEventHandlers(n.onChange,f=>{e.onTextValueChange(f.currentTarget.value),e.autocomplete==="both"&&e.onFilterValueChange(f.currentTarget.value)}),onKeyUp:I.composeEventHandlers(n.onKeyUp,f=>{if(!e.open&&(e.isPrintableCharacter(f.key)||["ArrowUp","ArrowDown","Home","End","Backspace"].includes(f.key))&&a(),setTimeout(()=>{if(e.autocomplete==="both"&&e.isPrintableCharacter(f.key)&&e.filterValue!==void 0){const v=e.filterValue,p=o().find(d=>r(d.textValue,v));p&&e.onTextValueChange(p.textValue)}}),e.autocomplete==="none"&&e.isPrintableCharacter(f.key)){const v=e.textValue??"",p=o().find(d=>r(d.textValue,v));p&&(e.onVisuallyFocussedItemChange(p.ref.current),p.ref.current?.scrollIntoView())}}),onBlur:I.composeEventHandlers(n.onBlur,()=>{e.onVisuallyFocussedItemChange(null);const[f]=o().filter(p=>p.textValue===e.textValue&&p.type==="option");if(f){e.onValueChange(f.value),e.autocomplete==="both"&&e.onFilterValueChange(f.textValue);return}if(e.allowCustomValue){e.onValueChange(e.textValue),e.autocomplete==="both"&&e.onFilterValueChange(e.textValue);return}const[v]=o().filter(p=>p.value===e.value&&p.type==="option");v&&e.textValue!==""?(e.onTextValueChange(v.textValue),e.autocomplete==="both"&&e.onFilterValueChange(v.textValue)):(e.onValueChange(void 0),e.onTextValueChange(""))})})}),Wt=s.forwardRef((n,l)=>{const{children:e,...t}=n,o=z(ct),r=o.disabled,i=()=>{r||(o.onOpenChange(!0),o.trigger?.focus())};return u.jsx(A.Primitive.button,{"aria-hidden":!0,type:"button","aria-disabled":r,"aria-controls":o.contentId,"aria-expanded":o.open,disabled:r,"data-disabled":r?"":void 0,...t,tabIndex:-1,ref:l,onClick:I.composeEventHandlers(t.onClick,()=>{o.trigger?.focus()}),onPointerDown:I.composeEventHandlers(t.onPointerDown,c=>{c.button===0&&c.ctrlKey===!1&&(i(),c.preventDefault())}),onKeyDown:I.composeEventHandlers(t.onKeyDown,c=>{Lt.includes(c.key)&&(i(),c.preventDefault())}),children:e||"▼"})}),zt="ComboboxPortal",it=n=>u.jsx(ot.Portal,{asChild:!0,...n});it.displayName=zt;const at="ComboboxContent",Gt=s.forwardRef((n,l)=>{const e=z(at),[t,o]=s.useState();if(k.useLayoutEffect(()=>{o(new DocumentFragment)},[]),!e.open){const r=t;return r?Oe.createPortal(u.jsx(fe.Slot,{scope:void 0,children:u.jsx("div",{children:n.children})}),r):null}return u.jsx(Xt,{...n,ref:l})}),Yt=10,Xt=s.forwardRef((n,l)=>{const{onEscapeKeyDown:e,onPointerDownOutside:t,...o}=n,r=z(at),i=M.useComposedRefs(l,a=>r.onContentChange(a)),{onOpenChange:c}=r;return et.useFocusGuards(),s.useEffect(()=>{const a=()=>{c(!1)};return window.addEventListener("blur",a),window.addEventListener("resize",a),()=>{window.removeEventListener("blur",a),window.removeEventListener("resize",a)}},[c]),u.jsx(rt.RemoveScroll,{allowPinchZoom:!0,children:u.jsx(Qe.DismissableLayer,{asChild:!0,onEscapeKeyDown:e,onPointerDownOutside:t,onFocusOutside:a=>{a.preventDefault()},onDismiss:()=>{r.onOpenChange(!1),r.trigger?.focus({preventScroll:!0})},children:u.jsx(Zt,{role:"listbox",id:r.contentId,"data-state":r.open?"open":"closed",onContextMenu:a=>a.preventDefault(),...o,ref:i,style:{display:"flex",flexDirection:"column",outline:"none",...o.style}})})})}),Zt=s.forwardRef((n,l)=>{const{align:e="start",collisionPadding:t=Yt,...o}=n;return u.jsx(se.Content,{...o,ref:l,align:e,collisionPadding:t,style:{boxSizing:"border-box",...o.style,"--radix-combobox-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-combobox-content-available-width":"var(--radix-popper-available-width)","--radix-combobox-content-available-height":"var(--radix-popper-available-height)","--radix-combobox-trigger-width":"var(--radix-popper-anchor-width)","--radix-combobox-trigger-height":"var(--radix-popper-anchor-height)"}})}),Jt="ComboboxViewport",Qt=s.forwardRef((n,l)=>{const e=z(Jt),t=M.useComposedRefs(l,e.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-combobox-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-combobox-viewport]::-webkit-scrollbar{display:none}"}}),u.jsx(fe.Slot,{scope:void 0,children:u.jsx(A.Primitive.div,{"data-radix-combobox-viewport":"",role:"presentation",...n,ref:t,style:{position:"relative",flex:1,overflow:"auto",...n.style}})})]})}),ut="ComboboxItem",[eo,dt]=ge.createContext(ut),pt=s.forwardRef((n,l)=>{const{value:e,disabled:t=!1,textValue:o,...r}=n,i=s.useRef(null),c=M.useComposedRefs(l,i),{getItems:a}=ve(void 0),{onTextValueChange:x,textValue:f,visuallyFocussedItem:v,...p}=z(ut),d=ne.useId(),[m,b]=s.useState(o??""),g=s.useMemo(()=>v===a().find(V=>V.ref.current===i.current)?.ref.current,[a,v]),C=p.value===e,h=()=>{t||(p.onValueChange(e),x(m),p.onOpenChange(!1),p.autocomplete==="both"&&p.onFilterValueChange(m),p.trigger?.focus({preventScroll:!0}))},{startsWith:y}=Me(p.locale,{sensitivity:"base"}),R=s.useCallback(V=>{b(_=>_||(V?.textContent??"").trim())},[]);s.useEffect(()=>{C&&f===void 0&&m!==""&&x(m)},[m,C,f,x]),k.useLayoutEffect(()=>{p.open&&p.autocomplete==="none"&&setTimeout(()=>{a().find(_=>_.value===p.value)?.ref.current?.scrollIntoView({block:"nearest"})})},[a,p.autocomplete,p.value,p.open]);const O=ne.useId();return p.autocomplete==="list"&&m&&f&&!y(m,f)||p.autocomplete==="both"&&m&&p.filterValue&&!y(m,p.filterValue)?null:u.jsx(eo,{textId:d,onTextValueChange:R,isSelected:C,children:u.jsx(fe.ItemSlot,{scope:void 0,value:e,textValue:m,disabled:t,type:"option",children:u.jsx(A.Primitive.div,{role:"option","aria-labelledby":d,"data-highlighted":g?"":void 0,"aria-selected":C&&g,"data-state":C?"checked":"unchecked","aria-disabled":t||void 0,"data-disabled":t?"":void 0,tabIndex:t?void 0:-1,...r,id:O,ref:c,onPointerUp:I.composeEventHandlers(r.onPointerUp,h)})})})}),to="ComboboxItemText",oo=s.forwardRef((n,l)=>{const{className:e,style:t,...o}=n,r=dt(to),i=M.useComposedRefs(l,r.onTextValueChange);return u.jsx(A.Primitive.span,{id:r.textId,...o,ref:i})}),no="ComboboxItemIndicator",ro=s.forwardRef((n,l)=>{const{isSelected:e}=dt(no);return e?u.jsx(A.Primitive.span,{"aria-hidden":!0,...n,ref:l}):null}),ft="ComboboxNoValueFound",so=s.forwardRef((n,l)=>{const{textValue:e="",locale:t}=z(ft),[o,r]=s.useState([]),{subscribe:i}=ve(void 0),{startsWith:c}=Me(t,{sensitivity:"base"});return s.useEffect(()=>{const a=i(x=>{r(x)});return()=>{a()}},[i]),o.some(a=>c(a.textValue,e))?null:u.jsx(A.Primitive.div,{...n,ref:l})}),lo=s.forwardRef((n,l)=>{const{disabled:e=!1,...t}=n,o=z(ft),{textValue:r,visuallyFocussedItem:i}=o,{getItems:c,subscribe:a}=ve(void 0),x=s.useRef(null),[f,v]=s.useState(!1),p=M.useComposedRefs(l,x),d=s.useMemo(()=>i===c().find(g=>g.ref.current===x.current)?.ref.current,[c,i]),m=ne.useId(),b=()=>{!e&&r&&(o.onValueChange(r),o.onTextValueChange(r),o.onOpenChange(!1),o.autocomplete==="both"&&o.onFilterValueChange(r),o.trigger?.focus({preventScroll:!0}))};return k.useLayoutEffect(()=>{const g=a(C=>{v(!C.some(h=>h.textValue===r&&h.type!=="create"))});return c().length===0&&v(!0),()=>{g()}},[r,a,c]),!r||!f?null:u.jsx(fe.ItemSlot,{scope:void 0,value:r??"",textValue:r??"",disabled:e,type:"create",children:u.jsx(A.Primitive.div,{role:"option",tabIndex:e?void 0:-1,"aria-disabled":e||void 0,"data-disabled":e?"":void 0,"data-highlighted":d?"":void 0,...t,id:m,ref:p,onPointerUp:I.composeEventHandlers(t.onPointerUp,b)})})}),co=Ut,io=qt,ao=Kt,uo=Wt,po=it,fo=Gt,mo=Qt,ho=pt,xo=oo,go=ro,vo=so,Co=lo;function bo(n,l){const e=Math.min(n.length,l.length);for(let t=0;t<e;t++)if(n[t]!==l[t])return t;return e}const So=Object.freeze(Object.defineProperty({__proto__:null,ComboboxItem:pt,Content:fo,CreateItem:Co,Icon:uo,Item:ho,ItemIndicator:go,ItemText:xo,NoValueFound:vo,Portal:po,Root:co,TextInput:ao,Trigger:io,Viewport:mo},Symbol.toStringTag,{value:"Module"})),yo=[" ","Enter","ArrowUp","ArrowDown"],wo=[" ","Enter"],me="Select",[Ce,he,Io]=Rt.createCollection(me),[ae,Eo]=ge.createContextScope(me,[Io,Ne.createPopperScope]),be=Ne.createPopperScope(),[To,G]=ae(me),[Po,Vo]=ae(me),je=n=>{const{__scopeSelect:l,children:e,open:t,defaultOpen:o,onOpenChange:r,value:i,defaultValue:c,onValueChange:a,dir:x,disabled:f,required:v,multi:p=!1}=n,d=be(l),[m,b]=s.useState(null),[g,C]=s.useState(null),[h,y]=s.useState(!1),R=_t.useDirection(x),[O=!1,V]=ie.useControllableState({prop:t,defaultProp:o,onChange:r}),[_,D]=ie.useControllableState({prop:i,defaultProp:c,onChange(j){a&&(Array.isArray(j),a(j))}}),Y=s.useRef(null),[$,F]=s.useState(new Set);return u.jsx(se.Root,{...d,children:u.jsx(To,{required:v,scope:l,trigger:m,onTriggerChange:b,valueNode:g,onValueNodeChange:C,valueNodeHasChildren:h,onValueNodeHasChildrenChange:y,contentId:ne.useId(),value:_,onValueChange:D,open:O,onOpenChange:V,dir:R,triggerPointerDownPosRef:Y,disabled:f,multi:p,children:u.jsx(Ce.Provider,{scope:l,children:u.jsx(Po,{scope:n.__scopeSelect,onNativeOptionAdd:s.useCallback(j=>{F(H=>new Set(H).add(j))},[]),onNativeOptionRemove:s.useCallback(j=>{F(H=>{const L=new Set(H);return L.delete(j),L})},[]),children:e})})})})};je.displayName=me;const mt="SelectTrigger",De=s.forwardRef((n,l)=>{const{__scopeSelect:e,...t}=n,o=be(e),r=G(mt,e),i=r.disabled,c=M.useComposedRefs(l,r.onTriggerChange),a=he(e),[x,f,v]=It(d=>{const m=a().filter(C=>!C.disabled),b=m.find(C=>C.value===r.value),g=Et(m,d,b);if(g!==void 0&&!Array.isArray(g.value)){const C=r.multi?[g.value]:g.value;r.onValueChange(C)}}),p=()=>{i||(r.onOpenChange(!0),v())};return u.jsx(se.Anchor,{asChild:!0,...o,children:u.jsx(A.Primitive.div,{role:"combobox","aria-controls":r.contentId,"aria-expanded":r.open,"aria-required":r.required,"aria-autocomplete":"none",dir:r.dir,"data-state":r.open?"open":"closed","data-disabled":i?"":void 0,"data-placeholder":r.value===void 0?"":void 0,tabIndex:i?void 0:0,...t,ref:c,onClick:I.composeEventHandlers(t.onClick,d=>{d.currentTarget.focus()}),onPointerDown:I.composeEventHandlers(t.onPointerDown,d=>{const m=d.target;m.hasPointerCapture(d.pointerId)&&m.releasePointerCapture(d.pointerId),(m.closest("button")??m.closest("div"))===d.currentTarget&&d.button===0&&d.ctrlKey===!1&&(p(),r.triggerPointerDownPosRef.current={x:Math.round(d.pageX),y:Math.round(d.pageY)},d.preventDefault())}),onKeyDown:I.composeEventHandlers(t.onKeyDown,d=>{const m=x.current!=="",b=d.ctrlKey||d.altKey||d.metaKey,g=d.target;(g.closest("button")??g.closest("div"))===d.currentTarget&&(!b&&d.key.length===1&&f(d.key),!(m&&d.key===" ")&&yo.includes(d.key)&&(p(),d.preventDefault()))})})})});De.displayName=mt;const ht="SelectValue",Le=s.forwardRef((n,l)=>{const{__scopeSelect:e,children:t,placeholder:o,...r}=n,i=G(ht,e),{onValueNodeHasChildrenChange:c}=i,a=t!==void 0,x=M.useComposedRefs(l,i.onValueNodeChange),[f,v]=s.useState([]),p=he(e);k.useLayoutEffect(()=>{c(a)},[c,a]),s.useLayoutEffect(()=>{if(Array.isArray(i.value)&&f.length!==i.value.length){const m=setTimeout(()=>{const b=p().filter(g=>Array.isArray(g.value)?!1:i.value?.includes(g.value));v(b)});return()=>{clearTimeout(m)}}},[i.value,p,f]);let d;if((i.value===void 0||i.value.length===0)&&o!==void 0)d=u.jsx("span",{children:o});else if(typeof t=="function")if(Array.isArray(i.value)){const m=i.value.map(b=>{const g=f.find(C=>C.value===b);return g?t({value:b,textValue:g?.textValue}):null});d=m.every(b=>b===null)?o:m}else d=t(i.value);else d=t;return u.jsx(A.Primitive.span,{...r,ref:x,children:d||null})});Le.displayName=ht;const Ro="SelectIcon",Fe=s.forwardRef((n,l)=>{const{__scopeSelect:e,children:t,...o}=n;return u.jsx(A.Primitive.span,{"aria-hidden":!0,...o,ref:l,children:t||"▼"})});Fe.displayName=Ro;const _o="SelectPortal",ke=n=>u.jsx(ot.Portal,{asChild:!0,...n});ke.displayName=_o;const re="SelectContent",He=s.forwardRef((n,l)=>{const e=G(re,n.__scopeSelect),[t,o]=s.useState();if(k.useLayoutEffect(()=>{o(new DocumentFragment)},[]),!e.open){const r=t;return r?Oe.createPortal(u.jsx(xt,{scope:n.__scopeSelect,children:u.jsx(Ce.Slot,{scope:n.__scopeSelect,children:u.jsx("div",{children:n.children})})}),r):null}return u.jsx(gt,{...n,ref:l})});He.displayName=re;const W=10,[xt,J]=ae(re),No="SelectContentImpl",gt=s.forwardRef((n,l)=>{const{__scopeSelect:e,position:t="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:r,onPointerDownOutside:i,side:c,sideOffset:a,align:x,alignOffset:f,arrowPadding:v,collisionBoundary:p,collisionPadding:d,sticky:m,hideWhenDetached:b,avoidCollisions:g,...C}=n,h=G(re,e),[y,R]=s.useState(null),[O,V]=s.useState(null),_=M.useComposedRefs(l,S=>R(S)),[D,Y]=s.useState(null),[$,F]=s.useState(null),j=he(e),[H,L]=s.useState(!1),q=s.useRef(!1);s.useEffect(()=>{if(y)return nt.hideOthers(y)},[y]),et.useFocusGuards();const K=s.useCallback(S=>{const[T,...E]=j().map(N=>N.ref.current),[w]=E.slice(-1),P=document.activeElement;for(const N of S)if(N===P||(N?.scrollIntoView({block:"nearest"}),N===T&&O&&(O.scrollTop=0),N===w&&O&&(O.scrollTop=O.scrollHeight),N?.focus(),document.activeElement!==P))return},[j,O]),B=s.useCallback(()=>K([D,y]),[K,D,y]);s.useEffect(()=>{H&&B()},[H,B]);const{onOpenChange:X,triggerPointerDownPosRef:U}=h;s.useEffect(()=>{if(y){let S={x:0,y:0};const T=w=>{S={x:Math.abs(Math.round(w.pageX)-(U.current?.x??0)),y:Math.abs(Math.round(w.pageY)-(U.current?.y??0))}},E=w=>{S.x<=10&&S.y<=10?w.preventDefault():y.contains(w.target)||X(!1),document.removeEventListener("pointermove",T),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",E,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",E,{capture:!0})}}},[y,X,U]),s.useEffect(()=>{const S=()=>X(!1);return window.addEventListener("blur",S),window.addEventListener("resize",S),()=>{window.removeEventListener("blur",S),window.removeEventListener("resize",S)}},[X]);const[ue,le]=It(S=>{const T=j().filter(P=>!P.disabled),E=T.find(P=>P.ref.current===document.activeElement),w=Et(T,S,E);w&&setTimeout(()=>w.ref.current.focus())}),de=s.useCallback((S,T,E)=>{const w=!q.current&&!E;(h.value!==void 0&&h.value===T||w)&&(Y(S),w&&(q.current=!0))},[h.value]),Q=s.useCallback(()=>y?.focus(),[y]),Z=s.useCallback((S,T,E)=>{const w=!q.current&&!E;(h.value!==void 0&&(Array.isArray(T)?T.every(N=>h.value?.includes(N)):h.value===T)||w)&&F(S)},[h.value]),ce=t==="popper"?Te:vt,ee=ce===Te?{side:c,sideOffset:a,align:x,alignOffset:f,arrowPadding:v,collisionBoundary:p,collisionPadding:d,sticky:m,hideWhenDetached:b,avoidCollisions:g}:{};return u.jsx(xt,{scope:e,content:y,viewport:O,onViewportChange:V,itemRefCallback:de,selectedItem:D,onItemLeave:Q,itemTextRefCallback:Z,focusSelectedItem:B,selectedItemText:$,position:t,isPositioned:H,searchRef:ue,children:u.jsx(rt.RemoveScroll,{as:Ee.Slot,allowPinchZoom:!0,children:u.jsx(tt.FocusScope,{asChild:!0,trapped:h.open,onMountAutoFocus:S=>{S.preventDefault()},onUnmountAutoFocus:I.composeEventHandlers(o,S=>{h.trigger?.focus({preventScroll:!0}),document.getSelection()?.empty(),S.preventDefault()}),children:u.jsx(Qe.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:S=>S.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:u.jsx(ce,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed","aria-multiselectable":h.multi?"true":void 0,dir:h.dir,onContextMenu:S=>S.preventDefault(),...C,...ee,onPlaced:()=>L(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:I.composeEventHandlers(C.onKeyDown,S=>{const T=S.ctrlKey||S.altKey||S.metaKey;if(S.key==="Tab"&&S.preventDefault(),!T&&S.key.length===1&&le(S.key),["ArrowUp","ArrowDown","Home","End"].includes(S.key)){let w=j().filter(P=>!P.disabled).map(P=>P.ref.current);if(["ArrowUp","End"].includes(S.key)&&(w=w.slice().reverse()),["ArrowUp","ArrowDown"].includes(S.key)){const P=S.target,N=w.indexOf(P);w=w.slice(N+1)}setTimeout(()=>K(w)),S.preventDefault()}})})})})})})});gt.displayName=No;const Ao="SelectItemAlignedPosition",vt=s.forwardRef((n,l)=>{const{__scopeSelect:e,onPlaced:t,...o}=n,r=G(re,e),i=J(re,e),[c,a]=s.useState(null),[x,f]=s.useState(null),v=M.useComposedRefs(l,_=>f(_)),p=he(e),d=s.useRef(!1),m=s.useRef(!0),{viewport:b,selectedItem:g,selectedItemText:C,focusSelectedItem:h}=i,y=s.useCallback(()=>{if(r.trigger&&r.valueNode&&c&&x&&b&&g&&C){const _=r.trigger.getBoundingClientRect(),D=x.getBoundingClientRect(),Y=r.valueNode.getBoundingClientRect(),$=C.getBoundingClientRect();if(r.dir!=="rtl"){const P=$.left-D.left,N=Y.left-P,te=_.left-N,oe=_.width+te,Se=Math.max(oe,D.width),ye=window.innerWidth-W,we=Je.clamp(N,[W,ye-Se]);c.style.minWidth=`${oe}px`,c.style.left=`${we}px`}else{const P=D.right-$.right,N=window.innerWidth-Y.right-P,te=window.innerWidth-_.right-N,oe=_.width+te,Se=Math.max(oe,D.width),ye=window.innerWidth-W,we=Je.clamp(N,[W,ye-Se]);c.style.minWidth=`${oe}px`,c.style.right=`${we}px`}const F=p(),j=window.innerHeight-W*2,H=b.scrollHeight,L=window.getComputedStyle(x),q=parseInt(L.borderTopWidth,10),K=parseInt(L.paddingTop,10),B=parseInt(L.borderBottomWidth,10),X=parseInt(L.paddingBottom,10),U=q+K+H+X+B,ue=Math.min(g.offsetHeight*5,U),le=window.getComputedStyle(b),de=parseInt(le.paddingTop,10),Q=parseInt(le.paddingBottom,10),Z=_.top+_.height/2-W,ce=j-Z,ee=g.offsetHeight/2,S=g.offsetTop+ee,T=q+K+S,E=U-T;if(T<=Z){const P=g===F[F.length-1].ref.current;c.style.bottom="0px";const N=x.clientHeight-b.offsetTop-b.offsetHeight,te=Math.max(ce,ee+(P?Q:0)+N+B),oe=T+te;c.style.height=`${oe}px`}else{const P=g===F[0].ref.current;c.style.top="0px";const te=Math.max(Z,q+b.offsetTop+(P?de:0)+ee)+E;c.style.height=`${te}px`,b.scrollTop=T-Z+b.offsetTop}c.style.margin=`${W}px 0`,c.style.minHeight=`${ue}px`,c.style.maxHeight=`${j}px`,t?.(),requestAnimationFrame(()=>d.current=!0)}},[p,r.trigger,r.valueNode,c,x,b,g,C,r.dir,t]);k.useLayoutEffect(()=>y(),[y]);const[R,O]=s.useState();k.useLayoutEffect(()=>{x&&O(window.getComputedStyle(x).zIndex)},[x]);const V=s.useCallback(_=>{_&&m.current===!0&&(y(),h?.(),m.current=!1)},[y,h]);return u.jsx(Mo,{scope:e,contentWrapper:c,shouldExpandOnScrollRef:d,onScrollButtonChange:V,children:u.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:u.jsx(A.Primitive.div,{...o,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});vt.displayName=Ao;const Oo="SelectPopperPosition",Te=s.forwardRef((n,l)=>{const{__scopeSelect:e,align:t="start",collisionPadding:o=W,...r}=n,i=be(e);return u.jsx(se.Content,{...i,...r,ref:l,align:t,collisionPadding:o,style:{boxSizing:"border-box",...r.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Te.displayName=Oo;const[Mo,Be]=ae(re,{}),Pe="SelectViewport",Ue=s.forwardRef((n,l)=>{const{__scopeSelect:e,...t}=n,o=J(Pe,e),r=Be(Pe,e),i=M.useComposedRefs(l,o.onViewportChange),c=s.useRef(0);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),u.jsx(Ce.Slot,{scope:e,children:u.jsx(A.Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...t,ref:i,style:{position:"relative",flex:1,overflow:"auto",...t.style},onScroll:I.composeEventHandlers(t.onScroll,a=>{const x=a.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:v}=r;if(v?.current&&f){const p=Math.abs(c.current-x.scrollTop);if(p>0){const d=window.innerHeight-W*2,m=parseFloat(f.style.minHeight),b=parseFloat(f.style.height),g=Math.max(m,b);if(g<d){const C=g+p,h=Math.min(d,C),y=C-h;f.style.height=`${h}px`,f.style.bottom==="0px"&&(x.scrollTop=y>0?y:0,f.style.justifyContent="flex-end")}}}c.current=x.scrollTop})})})]})});Ue.displayName=Pe;const Ct="SelectGroup",[jo,Do]=ae(Ct),$e=s.forwardRef((n,l)=>{const{__scopeSelect:e,...t}=n,o=ne.useId();return u.jsx(jo,{scope:e,id:o,children:u.jsx(A.Primitive.div,{role:"group","aria-labelledby":o,...t,ref:l})})});$e.displayName=Ct;const bt="SelectLabel",qe=s.forwardRef((n,l)=>{const{__scopeSelect:e,...t}=n,o=Do(bt,e);return u.jsx(A.Primitive.div,{id:o.id,...t,ref:l})});qe.displayName=bt;const xe="SelectItem",[Lo,St]=ae(xe),Ke=s.forwardRef((n,l)=>{const{__scopeSelect:e,value:t,disabled:o=!1,textValue:r,...i}=n,c=G(xe,e),a=J(xe,e),x=typeof t=="string"?Array.isArray(c.value)?c.value.includes(t):c.value===t:t.every(h=>c.value?.includes(h)),f=Array.isArray(c.value)&&Array.isArray(t)&&t.some(h=>c.value?.includes(h)),[v,p]=s.useState(r??""),[d,m]=s.useState(!1),b=M.useComposedRefs(l,h=>a.itemRefCallback?.(h,t,o)),g=ne.useId(),C=()=>{if(!o){let h=c.multi&&typeof t=="string"?[t]:t;f&&!x?c.onValueChange(h):Array.isArray(c.value)&&(h=Tt(t,c.value)),c.onValueChange(h),c.multi||c.onOpenChange(!1)}};if(!c.multi&&Array.isArray(t))throw new Error("You can only pass an array of values in multi selects");return u.jsx(Lo,{scope:e,value:t,disabled:o,textId:g,isSelected:x,isIntermediate:f,onItemTextChange:s.useCallback(h=>{p(y=>y||(h?.textContent??"").trim())},[]),children:u.jsx(Ce.ItemSlot,{scope:e,value:t,disabled:o,textValue:v,children:u.jsx(A.Primitive.div,{role:"option","aria-labelledby":g,"data-highlighted":d?"":void 0,"aria-selected":c.multi?void 0:x&&d,"aria-checked":c.multi?x:void 0,"data-state":x?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:b,onFocus:I.composeEventHandlers(i.onFocus,()=>m(!0)),onBlur:I.composeEventHandlers(i.onBlur,()=>m(!1)),onPointerUp:I.composeEventHandlers(i.onPointerUp,C),onPointerMove:I.composeEventHandlers(i.onPointerMove,h=>{o?a.onItemLeave?.():h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:I.composeEventHandlers(i.onPointerLeave,h=>{h.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:I.composeEventHandlers(i.onKeyDown,h=>{a.searchRef?.current!==""&&h.key===" "||(wo.includes(h.key)&&C(),h.key===" "&&h.preventDefault())})})})})});Ke.displayName=xe;const pe="SelectItemText",We=s.forwardRef((n,l)=>{const{__scopeSelect:e,className:t,style:o,...r}=n,i=G(pe,e),c=J(pe,e),a=St(pe,e),x=Vo(pe,e),[f,v]=s.useState(null),p=M.useComposedRefs(l,C=>v(C),a.onItemTextChange,C=>c.itemTextRefCallback?.(C,a.value,a.disabled)),d=f?.textContent,m=s.useMemo(()=>u.jsx("option",{value:a.value,disabled:a.disabled,children:d},Array.isArray(a.value)?a.value.join(";"):a.value),[a.disabled,a.value,d]),{onNativeOptionAdd:b,onNativeOptionRemove:g}=x;return k.useLayoutEffect(()=>(b(m),()=>g(m)),[b,g,m]),u.jsxs(u.Fragment,{children:[u.jsx(A.Primitive.span,{id:a.textId,...r,ref:p}),a.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Oe.createPortal(r.children,i.valueNode):null]})});We.displayName=pe;const yt="SelectItemIndicator",ze=s.forwardRef((n,l)=>{const{__scopeSelect:e,children:t,...o}=n,r=St(yt,e);return typeof t=="function"?u.jsx(A.Primitive.span,{"aria-hidden":!0,...o,ref:l,children:t({isSelected:r.isSelected,isIntermediate:r.isIntermediate})}):r.isSelected?u.jsx(A.Primitive.span,{"aria-hidden":!0,...o,ref:l,children:t}):null});ze.displayName=yt;const Ve="SelectScrollUpButton",Ge=s.forwardRef((n,l)=>{const e=J(Ve,n.__scopeSelect),t=Be(Ve,n.__scopeSelect),[o,r]=s.useState(!1),i=M.useComposedRefs(l,t.onScrollButtonChange);return k.useLayoutEffect(()=>{if(e.viewport&&e.isPositioned){const c=e.viewport,a=()=>{const x=c.scrollTop>0;r(x)};return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[e.viewport,e.isPositioned]),o?u.jsx(wt,{...n,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:a}=e;c&&a&&(c.scrollTop-=a.offsetHeight)}}):null});Ge.displayName=Ve;const Re="SelectScrollDownButton",Ye=s.forwardRef((n,l)=>{const e=J(Re,n.__scopeSelect),t=Be(Re,n.__scopeSelect),[o,r]=s.useState(!1),i=M.useComposedRefs(l,t.onScrollButtonChange);return k.useLayoutEffect(()=>{if(e.viewport&&e.isPositioned){const c=e.viewport,a=()=>{const x=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<x;r(f)};return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[e.viewport,e.isPositioned]),o?u.jsx(wt,{...n,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:a}=e;c&&a&&(c.scrollTop+=a.offsetHeight)}}):null});Ye.displayName=Re;const wt=s.forwardRef((n,l)=>{const{__scopeSelect:e,onAutoScroll:t,...o}=n,r=J("SelectScrollButton",e),i=s.useRef(null),c=he(e),a=s.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return s.useEffect(()=>()=>a(),[a]),k.useLayoutEffect(()=>{c().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),u.jsx(A.Primitive.div,{"aria-hidden":!0,...o,ref:l,style:{flexShrink:0,...o.style},onPointerMove:I.composeEventHandlers(o.onPointerMove,()=>{r.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(t,50))}),onPointerLeave:I.composeEventHandlers(o.onPointerLeave,()=>{a()})})}),Fo="SelectSeparator",Xe=s.forwardRef((n,l)=>{const{__scopeSelect:e,...t}=n;return u.jsx(A.Primitive.div,{"aria-hidden":!0,...t,ref:l})});Xe.displayName=Fo;const _e="SelectArrow",Ze=s.forwardRef((n,l)=>{const{__scopeSelect:e,...t}=n,o=be(e),r=G(_e,e),i=J(_e,e);return r.open&&i.position==="popper"?u.jsx(se.Arrow,{...o,...t,ref:l}):null});Ze.displayName=_e;const ko="BubbleSelect",Ho=s.forwardRef((n,l)=>{const{value:e,...t}=n,o=s.useRef(null),r=M.useComposedRefs(l,o),i=Nt.usePrevious(e),c=G(ko,void 0);s.useEffect(()=>{const x=o.current,f=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(f,"value").set;if(i!==e&&p){const d=new Event("change",{bubbles:!0});p.call(x,e),x.dispatchEvent(d)}},[i,e]);let a=e;return c.multi&&!Array.isArray(e)&&(a=[]),u.jsx(At.VisuallyHidden,{asChild:!0,children:u.jsx("select",{...t,multiple:c.multi?!0:void 0,ref:r,defaultValue:a})})});Ho.displayName="BubbleSelect";function It(n){const l=Ot.useCallbackRef(n),e=s.useRef(""),t=s.useRef(0),o=s.useCallback(i=>{const c=e.current+i;l(c),function a(x){e.current=x,window.clearTimeout(t.current),x!==""&&(t.current=window.setTimeout(()=>a(""),1e3))}(c)},[l]),r=s.useCallback(()=>{e.current="",window.clearTimeout(t.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(t.current),[]),[e,o,r]}function Et(n,l,e){const o=l.length>1&&Array.from(l).every(x=>x===l[0])?l[0]:l,r=e?n.indexOf(e):-1;let i=Bo(n,Math.max(r,0));o.length===1&&(i=i.filter(x=>x!==e));const a=i.find(x=>x.textValue.toLowerCase().startsWith(o.toLowerCase()));return a!==e?a:void 0}function Bo(n,l){return n.map((e,t)=>n[(l+t)%n.length])}const Tt=(n,l=[])=>{if(Array.isArray(n))return n.reduce((t,o)=>Tt(o,t),l);const e=l.indexOf(n);return e===-1?[...l,n]:[...l.slice(0,e),...l.slice(e+1)]},Uo=je,$o=De,qo=Le,Ko=Fe,Wo=ke,zo=He,Go=Ue,Yo=$e,Xo=qe,Zo=Ke,Jo=We,Qo=ze,en=Ge,tn=Ye,on=Xe,nn=Ze,rn=Object.freeze(Object.defineProperty({__proto__:null,Arrow:nn,Content:zo,Group:Yo,Icon:Ko,Item:Zo,ItemIndicator:Qo,ItemText:Jo,Label:Xo,Portal:Wo,Root:Uo,ScrollDownButton:tn,ScrollUpButton:en,Select:je,SelectArrow:Ze,SelectContent:He,SelectGroup:$e,SelectIcon:Fe,SelectItem:Ke,SelectItemIndicator:ze,SelectItemText:We,SelectLabel:qe,SelectPortal:ke,SelectScrollDownButton:Ye,SelectScrollUpButton:Ge,SelectSeparator:Xe,SelectTrigger:De,SelectValue:Le,SelectViewport:Ue,Separator:on,Trigger:$o,Value:qo,Viewport:Go,createSelectScope:Eo},Symbol.toStringTag,{value:"Module"}));Object.defineProperty(exports,"composeEventHandlers",{enumerable:!0,get:()=>I.composeEventHandlers});Object.defineProperty(exports,"useCallbackRef",{enumerable:!0,get:()=>Mt.useCallbackRef});exports.Combobox=So;exports.Select=rn;exports.createCollection=st;
@@ -0,0 +1,5 @@
1
+ export * from './components/Collection';
2
+ export * from './components/Combobox';
3
+ export * from './components/Select';
4
+ export * from './helpers/events';
5
+ export * from './hooks/useCallbackRef';