react-animated-select 0.6.0 → 0.6.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.
package/README.md CHANGED
@@ -2,299 +2,39 @@
2
2
 
3
3
  A lightweight, high-performance, and fully customizable Select component for React. Featuring smooth CSS animations, accessible keyboard navigation, and flexible option rendering.
4
4
 
5
- **Try it out:**
6
-
7
- [![Demo](https://img.shields.io/badge/demo-live_preview-brightgreen?style=for-the-badge&logo=vercel)](https://l1nway.github.io/react-animated-select/)
8
-
9
- ## Features
10
-
11
- - **Smooth Animations**
12
- Powered by `react-transition-group` with height-expanding dropdowns and sliding side-elements.
13
-
14
- - **Accessible**
15
- Full keyboard support (Arrow keys, Enter, Space, Escape, Tab) and ARIA attributes built-in.
16
-
17
- - **Flexible Data**
18
- Supports simple arrays, objects, or declarative JSX children (`<Option />`). **Smart deep parsing** extracts labels from any available object key.
19
-
20
- - **Smart Auto-Positioning**
21
- Recalculates dropdown position using `ResizeObserver`.
22
-
23
- - **Zero-Config Styles**
24
- The minimum styles required for the select to work are built into the project, but you can add your own on top of the basic ones.
25
-
26
- - **Search & Clear**
27
- Built-in “Clear” button and intelligent state handling (loading, error, empty, disabled).
5
+ [![Docs](https://img.shields.io/badge/docs-documentation-blue?style=for-the-badge&logo=gitbook)](https://l1nway.github.io/react-animated-select-docs/)
28
6
 
29
7
  ## Installation
30
8
  ```jsx
31
- npm install react-animated-select
9
+ npm install react-animated-select
32
10
  ```
33
- ### Basic Usage (Array of Strings)
34
11
 
12
+ ### Basic Usage
35
13
  ```jsx
36
- import {Select} from 'react-animated-select'
37
- import {useState} from 'react'
38
-
39
- function App() {
40
- const options = ['Apple', 'Banana', 'Orange']
14
+ import {Select, Option} from 'react-animated-select'
15
+ import {useState} from 'react'
16
+
17
+ function App() {
18
+ const options = ['Option 1', {name: 'Option 2', id: 2}, 'Option 3']
41
19
  const [value, setValue] = useState('')
42
20
 
43
21
  return (
44
- <Select
45
- options={options}
46
- onChange={setValue}
47
- value={value}
48
- placeholder='Pick a fruit'
49
- />
50
- )}
51
- ```
52
- ### Advanced Usage (JSX Children)
53
- ```jsx
54
- import {Select, Option} from 'react-animated-select'
55
-
56
- function App() {
57
- return (
58
- <Select defaultValue='react'>
59
- <Option id='react'>React</Option>
60
- <Option id='vue' disabled>Vue (Coming soon)</Option>
61
- <Option id='svelte' className='custom-svelte-style'>
62
- <b>Svelte</b> - The compiler
63
- </Option>
64
- </Select>
65
- )
66
- }
22
+ <Select
23
+ placeholder='Pick a option'
24
+ onChange={setValue}
25
+ options={options}
26
+ value={value}
27
+ >
28
+ <Option id='4'>Option 4</Option>
29
+ <Option id='5' disabled>Option 5</Option>
30
+ <Option id='6' className='custom-style'>
31
+ <b>Option 6</b> - Custom JSX
32
+ </Option>
33
+ </Select>
34
+ )}
67
35
  ```
68
- ## Props API
69
-
70
- ### `<Select />`
71
-
72
- | Prop | Type | Default | Description |
73
- |------|------|---------|-------------|
74
- | `options` | `Array \| Object` | `[]` | Data source for options. The recommended format is an array of objects with `id`, `name`, and optional `disabled`. For compatibility, `value` may be used instead of `id`, and `label` instead of `name`. |
75
- | `value` | `any` | `undefined` | The current value for a controlled component. |
76
- | `defaultValue` | `any` | `undefined` | Initial value for an uncontrolled component. |
77
- | `onChange` | `function` | `undefined` | Callback called when an option is selected. Arguments: (data, id). |
78
- | `multiple` | `boolean` | `false` | Allows select multiple options. |
79
- | `placeholder` | `string` | `"Choose option"` | Text shown when no option is selected. |
80
- | `disabled` | `boolean` | `false` | Disables the entire component. |
81
- | `loading` | `boolean` | `false` | Shows a loading animation and disables interaction. |
82
- | `error` | `boolean` | `false` | Shows the error state and `errorText`. |
83
- | `style` | `object` | `{}` | Inline styles for the root container. |
84
- | `className` | `string` | '' | Additional CSS class for the root container .rac-select. |
85
- | `ArrowIcon` | `ElementType \ string \ JSX` | Default icon | Custom arrow icon. Accepts a component, image path, or JSX. |
86
- | `ClearIcon` | `ElementType \ string \ JSX` | Default icon | Custom clear icon. Accepts a component, image path, or JSX. |
87
-
88
- ---
89
-
90
- ### Animation Controls
91
-
92
- | Prop | Type | Default | Description |
93
- |------|------|---------|-------------|
94
- | `duration` | `number` | `300` | Speed of all transitions in milliseconds (mapped to CSS variable `--rac-duration`). |
95
- | `easing` | `string` | `'ease-out'` | CSS transition timing function (e.g., `cubic-bezier(.4,0,.2,1)`). |
96
- | `offset` | `number` | `1` | Vertical gap (in pixels) between the select trigger and the dropdown list. |
97
- | `animateOpacity` | `boolean` | `true` | Enables or disables the fade effect during opening and closing. |
98
-
99
- ---
100
-
101
- ### Behavioral Props
102
-
103
- | Prop | Type | Default | Description |
104
- | --------------- | ---------- | ---------- | ------------------------------------------------------------------------------------------------------- |
105
- | `visibility` | `boolean` | `false` | Manually controls the visibility of the list (used with `ownBehavior`). |
106
- | `ownBehavior` | `boolean` | `false` | If `true`, the component stops managing its own open/close state and relies on the `visibility` prop. |
107
- | `alwaysOpen` | `boolean` | `false` | Keeps the list permanently visible. Primarily used for debugging or specific UI layouts. |
108
- | `unmount` | `boolean` | `true` | When `true`, the list is removed from the DOM when closed. When `false`, it stays invisible in the DOM. |
109
- | `hasMore` | `boolean` | `false` | Indicates whether more options are available for loading (used for infinite loading). |
110
- | `loadMore` | `function` | `() => {}` | Callback triggered when more options need to be loaded. |
111
- | `loadMoreText` | `string` | `'Loading'` | Text displayed inside the options list during loading. |
112
- | `loadOffset` | `number` | `100` | Distance (in pixels) from the bottom of the list that triggers `loadMore`. |
113
- | `loadAhead` | `number` | `3` | Number of remaining options before the end at which loading is triggered during keyboard navigation. |
114
- | `loadButton` | `boolean` | `false` | Enables a manual “Load more” button instead of automatic loading. |
115
- | `loadButtonText` | `string` | `'Load more'` | Text displayed on the load button. |
116
- | `childrenFirst` | `boolean` | `false` | Determines priority of JSX `<Option />` children over options passed via props. |
117
- | `groupsClosed` | `boolean` | `false` | Default open status of groups. |
118
- | `deleteInline` | `boolean` | `false` | Determines whether the delete button takes up space in the layout or overlays the option content. |
119
- | `onClose` | `function` | `() => {}` | Callback triggered when select opened. |
120
- | `onOpen` | `function` | `() => {}` | Callback triggered when select closed. |
121
-
122
- ---
123
-
124
- ### Text Customization
125
-
126
- | Prop | Default | Description |
127
- |------|---------|-------------|
128
- | `emptyText` | `'No options'` | Text shown when the list is empty. |
129
- | `loadingText` | `'Loading'` | Text shown in the title during the loading state. |
130
- | `errorText` | `'Failed to load'` | Text shown when `error={true}`. |
131
- | `disabledText` | `'Disabled'` | Text shown when `disabled={true}`. |
132
-
133
- ---
134
-
135
- ### `<Option />`
136
-
137
- | Prop | Type | Description |
138
- |------|------|-------------|
139
- | `id` | `string` | Optional unique ID (generated automatically if not provided). value may be used instead of id (lower priority). |
140
- | `disabled` | `boolean` | If true, this option cannot be selected or highlighted. |
141
- | `className` | `string` | Custom class for individual option styling. |
142
-
143
- ---
144
-
145
- ### `<OptGroup />`
146
-
147
- | Prop | Type | Description |
148
- |------|------|-------------|
149
- | `id` | `string` | Optional unique ID (generated automatically if not provided). value may be used instead of id (lower priority). |
150
- | `name` | `string` | OptGroup title. label may be used instead of id (lower priority). |
151
-
152
- ---
153
-
154
- ## Keyboard Support
155
-
156
- | Key | Action |
157
- |-----|--------|
158
- | `ArrowDown` | Open dropdown / Move highlight down. |
159
- | `ArrowUp` | Open dropdown / Move highlight up. |
160
- | `Enter` / `Space` | Select highlighted option / Open dropdown. |
161
- | `Escape` | Close dropdown. |
162
- | `Tab` | Close dropdown and move focus to next element. |
163
-
164
- ## Custom Styling
165
-
166
- The component is built with a consistent BEM-like naming convention using the `rac-` prefix. You can easily override these classes in your CSS.
167
-
168
- ### CSS Variables (Theming)
169
-
170
- The component uses CSS variables for deep styling. These are based on system colors and `color-mix` for automatic theme adaptation. You can override these in your `:root` or on a specific `.rac-select` instance.
171
-
172
- | Variable | Default Value / Calculation | Description |
173
- |:---|:---|:---|
174
- | **Durations** | | |
175
- | `--rac-duration-fast` | `calc(var(--rac-duration) * 0.5)` | Used for micro-interactions. |
176
- | `--rac-duration-base` | `var(--rac-duration)` | Main transition speed. |
177
- | `--rac-duration-slow` | `calc(var(--rac-duration) * 1.3)` | Used for larger list transitions. |
178
- | **Colors** | | |
179
- | `--rac-base-red` | `#e7000b` | Base semantic red. |
180
- | `--rac-base-green` | `#4caf50` | Base semantic green. |
181
- | `--rac-base-yellow` | `#ffc107` | Base semantic yellow. |
182
- | **Select Trigger** | | |
183
- | `--rac-select-background`| `color-mix(in srgb, Canvas 98%, CanvasText 2%)` | Main background. |
184
- | `--rac-select-color` | `CanvasText` | Title text color. |
185
- | `--rac-select-hover| `color-mix` | Color of select hover. |
186
- | `--rac-select-border` | `2px solid ...` | Default border style. |
187
- | `--rac-select-border-error`| `2px solid ...` | Border style in error state. |
188
- | `--rac-select-min-height` | `2em` | Fixed minimal height of the select. |
189
- | `--rac-select-padding` | `0em 0.5em` | Internal horizontal padding. |
190
- | `--rac-disabled-opacity` | `0.75` | Opacity when `disabled={true}`. |
191
- | `--rac-title-anim-shift` | 4px | Vertical offset for title change animation. |
192
- | `--rac-title-anim-entry-ease` | cubic-bezier(0.34, 1.56, 0.64, 1) | Easing function for text entry. |
193
- | **Loading Dots** | | |
194
- | `--rac-dots-color` | `currentColor` | Color of the loader dots. |
195
- | `--rac-dots-animation-duration`| `1.4s` | Full cycle of the dots animation. |
196
- | `--rac-dots-gap` | `3px` | Space between points. |
197
- | `--rac-dots-height` | `3px` | Diameter of the loader dots. |
198
- | `--rac-dots-width` | `3px` | Width of the loader dots. |
199
- | `--rac-dots-padding-left` | `0.25em` | Space between the title text and the dots. |
200
- | `--rac-dots-align` | `end` | Vertical alignment of the dots. |
201
- | `--rac-dots-animation-delay-1`| `0s` | Start delay for the first dot. |
202
- | `--rac-dots-animation-delay-2`| `0.2s` | Start delay for the second dot. |
203
- | `--rac-dots-animation-delay-3`| `0.4s` | Start delay for the third dot. |
204
- | **Icons & Buttons** | | |
205
- | `--rac-cancel-height` | `0.9em` | Clear icon size. |
206
- | `--rac-cancel-width` | `0.9em` | Clear icon width. |
207
- | `--rac-arrow-height` | `1em` | Dropdown arrow size. |
208
- | `--rac-arrow-width` | `1em` | Dropdown arrow width. |
209
- | `--rac-arrow-padding` | `1px 0 2px` | Internal padding for arrow alignment. |
210
- | **Dropdown & Scroll** | | |
211
- | `--rac-list-background` | `color-mix(in srgb, Canvas 98%, CanvasText 2%)` | Dropdown list background. |
212
- | `--rac-list-max-height` | `250px` | Maximum height before scrolling. |
213
- | `--rac-scroll-color` | `color-mix(...)` | Scrollbar thumb color. |
214
- | `--rac-scroll-track` | `color-mix(...)` | Background color of the scrollbar track. |
215
- | `--rac-scroll-padding-top` | `0.5em` | Internal top padding of the list. |
216
- | `--rac-scroll-padding-bottom` | `0.5em` | Internal bottom padding of the list. |
217
- | `--rac-list-color` | `CanvasText` | Text color inside the dropdown list. |
218
- | **Options State** | | |
219
- | `--rac-option-hover` | `color-mix(...)` | Background on mouse hover. |
220
- | `--rac-option-highlight` | `color-mix(...)` | Background when keyboard navigating. |
221
- | `--rac-option-selected` | `color-mix(...)` | Background of the active option. |
222
- | `--rac-disabled-option-color`| `color-mix(...)` | Text color for disabled items. |
223
- | `--rac-true-option-color` | `color-mix(...)` | Text color for "Boolean True" items. |
224
- | `--rac-false-option-color` | `color-mix(...)` | Text color for "Boolean False" items. |
225
- | `--rac-option-padding` | `0.5em` | Internal padding for each option item. |
226
- | `--rac-option-min-height` | `1em` | Minimum option height. |
227
- | `--rac-invalid-option-color` | `color-mix(...)` | Text color for invalid options. |
228
- | `--rac-warning-option-color` | `color-mix(...)` | Text color for warning/caution options. |
229
- | **Group Headers** | | |
230
- | `--rac-group-header-font-size` | `1.25em` | Font size of the group header label. |
231
- | `--rac-group-header-font-weight` | `bold` | Font weight of the group header text. |
232
- | `--rac-group-header-min-height` | `1em` | Minimum height of the group header item. |
233
- | `--rac-group-header-padding` | `0.5em` | Internal padding for the group header. |
234
- | `--rac-group-arrow-height` | `1em` | Height of the group expand/collapse arrow icon. |
235
- | `--rac-group-arrow-width` | `1em` | Width of the group expand/collapse arrow icon. |
236
- | `--rac-group-arrow-padding` | `1px 0 2px` | Padding applied to the group arrow icon. |
237
- | `--rac-group-container-padding-left | `1em` | Left padding for container of options in group. |
238
-
239
- ---
240
-
241
- ### CSS Class Hierarchy
242
-
243
- | Class Name | Target Element | Description |
244
- |:---|:---|:---|
245
- | `.rac-select` | **Main Wrapper** | The primary container of the select. |
246
- | `.rac-select-title` | **Value Display** | The area showing the selected option or placeholder. |
247
- | `.rac-title-text` | **Title text itself** | The container for the title text itself. |
248
- | `.rac-loading-dots` | **Loader** | Wrapper for the loading animation. |
249
- | `.rac-loading-dots i` | **Loader Point** | Directly target animated points for styling. |
250
- | `.rac-select-buttons` | **Action Group** | Wrapper for the Clear (X) and Arrow icons. |
251
- | `.rac-select-cancel` | **Clear Button** | The "X" icon for clearing the selection. |
252
- | `.rac-select-arrow-wrapper` | **Arrow Icon** | Container for the dropdown arrow. |
253
- | `.rac-select-list` | **Dropdown List** | The `listbox` container that holds all options. |
254
- | `.rac-select-option` | **Option Item** | Individual item within the dropdown list. |
255
-
256
- **Note on Animation:** The Clear button and Dropdown List use `react-transition-group`.
257
- Customizing `rac-slide-left-*` (Clear button) and `rac-options-*` (Dropdown) classes is possible, but do so with caution to maintain sync with the JS logic.
258
-
259
- ### Component States
260
-
261
- The select and its options react to internal states by applying the following classes:
262
-
263
- #### Main Select States (applied to `.rac-select`)
264
- - `.rac-disabled-style`: Applied when `disabled={true}` or when the options list is empty.
265
- - `.rac-loading-style`: Applied during the `loading={true}` state.
266
- - `.rac-error-style`: Applied when `error={true}`.
267
-
268
- #### Option States (applied to `.rac-select-option`)
269
- - `.rac-selected`: Indicates the currently selected item.
270
- - `.rac-highlighted`: The option currently focused via keyboard or mouse hover.
271
- - `.rac-disabled-option`: Applied to options that have their own `disabled: true` property.
272
- - `.rac-invalid-option`: Applied to items that are not valid data types (e.g., functions).
273
- - `.rac-true-option`: Specialized styling when the option's raw value is exactly `true`.
274
- - `.rac-false-option`: Specialized styling when the option's raw value is exactly `false`.
275
- #### Group Header States (applied to group-related elements)
276
- - `.rac-group-header`: Base class for the group header container.
277
- - `.rac-group-title-text`: Applied to the text/label inside the group header.
278
- - `.rac-group-arrow-wrapper`: Wrapper class for the group expand/collapse arrow icon.
279
-
280
- #### Trigger States
281
- - `.rac-select-arrow-wrapper.--open`: Applied to the arrow icon when the dropdown is expanded.
282
-
283
- ## Change log
284
- ### 0.6.0
285
- ### New Features
286
- - **Swipe-to-Action**: You can now reveal the delete button by simply swiping an option left or right.
287
-
288
- - **Long-Press Interaction**: A sustained press on any option triggers the Global Delete Mode, activating a shake animation and allowing for quick cleanup.
289
-
290
- - **Layout Stability**: We’ve introduced Spacer Logic to mitigate layout shifts. This ensures that when actions are triggered, the surrounding elements remain stable.
291
-
292
- - **Precision Sizing**: Fixed several bugs related to unstable element dimensions, ensuring consistent rendering across different screen sizes and orientations.
293
-
294
- - **New Configuration Props**: deleteInline, onOpen and onClose.
295
36
 
296
37
  ## License
297
-
298
38
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
299
39
 
300
40
  Copyright (c) 2026 l1nway
package/dist/index.cjs.js CHANGED
@@ -1,16 +1,16 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const t=require("react"),We=require("react-transition-group"),cr=require("react-dom");var Ge={exports:{}},He={};var Ke;function ur(){if(Ke)return He;Ke=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function a(i,c,p){var y=null;if(p!==void 0&&(y=""+p),c.key!==void 0&&(y=""+c.key),"key"in c){p={};for(var f in c)f!=="key"&&(p[f]=c[f])}else p=c;return c=p.ref,{$$typeof:e,type:i,key:y,ref:c!==void 0?c:null,props:p}}return He.Fragment=n,He.jsx=a,He.jsxs=a,He}var Me={};var Be;function dr(){return Be||(Be=1,process.env.NODE_ENV!=="production"&&(function(){function e(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===re?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case O:return"Fragment";case W:return"Profiler";case F:return"StrictMode";case X:return"Suspense";case Y:return"SuspenseList";case ee:return"Activity"}if(typeof r=="object")switch(typeof r.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),r.$$typeof){case I:return"Portal";case G:return r.displayName||"Context";case P:return(r._context.displayName||"Context")+".Consumer";case se:var u=r.render;return r=r.displayName,r||(r=u.displayName||u.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case T:return u=r.displayName||null,u!==null?u:e(r.type)||"Memo";case l:u=r._payload,r=r._init;try{return e(r(u))}catch{}}return null}function n(r){return""+r}function a(r){try{n(r);var u=!1}catch{u=!0}if(u){u=console;var x=u.error,w=typeof Symbol=="function"&&Symbol.toStringTag&&r[Symbol.toStringTag]||r.constructor.name||"Object";return x.call(u,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",w),n(r)}}function i(r){if(r===O)return"<>";if(typeof r=="object"&&r!==null&&r.$$typeof===l)return"<...>";try{var u=e(r);return u?"<"+u+">":"<...>"}catch{return"<...>"}}function c(){var r=q.A;return r===null?null:r.getOwner()}function p(){return Error("react-stack-top-frame")}function y(r){if(K.call(r,"key")){var u=Object.getOwnPropertyDescriptor(r,"key").get;if(u&&u.isReactWarning)return!1}return r.key!==void 0}function f(r,u){function x(){_||(_=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",u))}x.isReactWarning=!0,Object.defineProperty(r,"key",{get:x,configurable:!0})}function o(){var r=e(this.type);return B[r]||(B[r]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),r=this.props.ref,r!==void 0?r:null}function v(r,u,x,w,de,ye){var s=x.ref;return r={$$typeof:M,type:r,key:u,props:x,_owner:w},(s!==void 0?s:null)!==null?Object.defineProperty(r,"ref",{enumerable:!1,get:o}):Object.defineProperty(r,"ref",{enumerable:!1,value:null}),r._store={},Object.defineProperty(r._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(r,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(r,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:de}),Object.defineProperty(r,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ye}),Object.freeze&&(Object.freeze(r.props),Object.freeze(r)),r}function E(r,u,x,w,de,ye){var s=u.children;if(s!==void 0)if(w)if(le(s)){for(w=0;w<s.length;w++)C(s[w]);Object.freeze&&Object.freeze(s)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else C(s);if(K.call(u,"key")){s=e(r);var b=Object.keys(u).filter(function(h){return h!=="key"});w=0<b.length?"{key: someKey, "+b.join(": ..., ")+": ...}":"{key: someKey}",m[s+w]||(b=0<b.length?"{"+b.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const t=require("react"),Me=require("react-transition-group"),ct=require("react-dom");var De={exports:{}},Ie={};var Ke;function ut(){if(Ke)return Ie;Ke=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(c,l,x){var b=null;if(x!==void 0&&(b=""+x),l.key!==void 0&&(b=""+l.key),"key"in l){x={};for(var g in l)g!=="key"&&(x[g]=l[g])}else x=l;return l=x.ref,{$$typeof:e,type:c,key:b,ref:l!==void 0?l:null,props:x}}return Ie.Fragment=n,Ie.jsx=s,Ie.jsxs=s,Ie}var He={};var Ze;function dt(){return Ze||(Ze=1,process.env.NODE_ENV!=="production"&&(function(){function e(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===le?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case C:return"Fragment";case L:return"Profiler";case O:return"StrictMode";case Q:return"Suspense";case G:return"SuspenseList";case D:return"Activity"}if(typeof r=="object")switch(typeof r.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),r.$$typeof){case _:return"Portal";case H:return r.displayName||"Context";case I:return(r._context.displayName||"Context")+".Consumer";case Z:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case U:return o=r.displayName||null,o!==null?o:e(r.type)||"Memo";case u:o=r._payload,r=r._init;try{return e(r(o))}catch{}}return null}function n(r){return""+r}function s(r){try{n(r);var o=!1}catch{o=!0}if(o){o=console;var m=o.error,S=typeof Symbol=="function"&&Symbol.toStringTag&&r[Symbol.toStringTag]||r.constructor.name||"Object";return m.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",S),n(r)}}function c(r){if(r===C)return"<>";if(typeof r=="object"&&r!==null&&r.$$typeof===u)return"<...>";try{var o=e(r);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function l(){var r=F.A;return r===null?null:r.getOwner()}function x(){return Error("react-stack-top-frame")}function b(r){if(q.call(r,"key")){var o=Object.getOwnPropertyDescriptor(r,"key").get;if(o&&o.isReactWarning)return!1}return r.key!==void 0}function g(r,o){function m(){re||(re=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",o))}m.isReactWarning=!0,Object.defineProperty(r,"key",{get:m,configurable:!0})}function j(){var r=e(this.type);return P[r]||(P[r]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),r=this.props.ref,r!==void 0?r:null}function i(r,o,m,S,ce,a){var y=m.ref;return r={$$typeof:N,type:r,key:o,props:m,_owner:S},(y!==void 0?y:null)!==null?Object.defineProperty(r,"ref",{enumerable:!1,get:j}):Object.defineProperty(r,"ref",{enumerable:!1,value:null}),r._store={},Object.defineProperty(r._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(r,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(r,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ce}),Object.defineProperty(r,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(r.props),Object.freeze(r)),r}function v(r,o,m,S,ce,a){var y=o.children;if(y!==void 0)if(S)if(fe(y)){for(S=0;S<y.length;S++)k(y[S]);Object.freeze&&Object.freeze(y)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else k(y);if(q.call(o,"key")){y=e(r);var p=Object.keys(o).filter(function(T){return T!=="key"});S=0<p.length?"{key: someKey, "+p.join(": ..., ")+": ...}":"{key: someKey}",W[y+S]||(p=0<p.length?"{"+p.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,w,s,b,s),m[s+w]=!0)}if(s=null,x!==void 0&&(a(x),s=""+x),y(u)&&(a(u.key),s=""+u.key),"key"in u){x={};for(var j in u)j!=="key"&&(x[j]=u[j])}else x=u;return s&&f(x,typeof r=="function"?r.displayName||r.name||"Unknown":r),v(r,s,x,c(),de,ye)}function C(r){$(r)?r._store&&(r._store.validated=1):typeof r=="object"&&r!==null&&r.$$typeof===l&&(r._payload.status==="fulfilled"?$(r._payload.value)&&r._payload.value._store&&(r._payload.value._store.validated=1):r._store&&(r._store.validated=1))}function $(r){return typeof r=="object"&&r!==null&&r.$$typeof===M}var N=t,M=Symbol.for("react.transitional.element"),I=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),W=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),G=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),re=Symbol.for("react.client.reference"),q=N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=Object.prototype.hasOwnProperty,le=Array.isArray,oe=console.createTask?console.createTask:function(){return null};N={react_stack_bottom_frame:function(r){return r()}};var _,B={},ne=N.react_stack_bottom_frame.bind(N,p)(),S=oe(i(p)),m={};Me.Fragment=O,Me.jsx=function(r,u,x){var w=1e4>q.recentlyCreatedOwnerStacks++;return E(r,u,x,!1,w?Error("react-stack-top-frame"):ne,w?oe(i(r)):S)},Me.jsxs=function(r,u,x){var w=1e4>q.recentlyCreatedOwnerStacks++;return E(r,u,x,!0,w?Error("react-stack-top-frame"):ne,w?oe(i(r)):S)}})()),Me}var Ze;function fr(){return Ze||(Ze=1,process.env.NODE_ENV==="production"?Ge.exports=ur():Ge.exports=dr()),Ge.exports}var d=fr();const Qe=({className:e="",...n})=>d.jsx("svg",{className:e,role:"button","aria-label":"Clear selection",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",width:"1em",height:"1em",fill:"currentColor",...n,children:d.jsx("path",{d:"M310.6 361.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L160 301.3 54.6 406.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L114.7 256 9.4 150.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 210.7 265.4 105.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3L205.3 256l105.3 105.4z"})}),hr=({className:e="",...n})=>d.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:"1em",height:"1em",fill:"currentColor",...n,children:d.jsx("path",{d:"M34.9 289.5l175.9-175.8c9.4-9.4 24.6-9.4 33.9 0L420.1 289.5c15.1 15.1 4.4 41-17 41H51.9c-21.4 0-32.1-25.9-17-41z"})}),er=({className:e="",...n})=>d.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"currentColor",...n,children:d.jsx("path",{d:"M20.285 6.708a1 1 0 0 0-1.414-1.416l-9.192 9.192-4.243-4.244a1 1 0 1 0-1.414 1.416l5 5a1 1 0 0 0 1.414 0l9.849-9.948z"})}),Je=(e,n="invalid-option",a="")=>{const i=a?a.replace(/:/g,""):"";if(typeof e!="string"||!e.trim())return i?`${n}-${i}`:`${n}-${Math.random().toString(36).slice(2,8)}`;const c=e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"-").replace(/[^\p{L}\p{N}-]+/gu,"").toLowerCase();return c?c||`${n}-${Math.random().toString(36).slice(2,8)}`:i?`${n}-${i}`:`${n}-${Math.random().toString(36).slice(2,8)}`},qe=t.createContext(null),Pe=t.forwardRef(({className:e="",visibility:n,setLeaving:a,setSpacer:i,children:c,duration:p=300,unmount:y,style:f,exit:o=!0},v)=>{const E=t.useRef(null);return t.useImperativeHandle(v,()=>E.current),t.useEffect(()=>{!n&&E.current&&(E.current.style.width="0px")},[]),d.jsx(We.CSSTransition,{onEnter:()=>{E.current.style.transition="none",E.current.style.width="0px"},onEntering:()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{E.current&&(E.current.style.transition=`width ${p}ms, color ${p}ms, background-color ${p}ms`,E.current.style.width=E.current.scrollWidth+"px")})})},onEntered:()=>{E.current.style.width="auto",i?.(!1)},onExit:()=>{E.current.style.width=E.current.scrollWidth+"px",E.current.offsetHeight,a?.(!0)},onExiting:()=>E.current.style.width="0px",onExited:()=>{y?.(),a?.(!1),i?.(!1)},classNames:"rac-slide-left",unmountOnExit:o,timeout:p,nodeRef:E,in:n,children:d.jsx("div",{className:e,ref:E,style:{transition:`width ${p}ms, color ${p}ms, background-color ${p}ms`,willChange:"width",overflow:"hidden",...f},children:c})})}),gr=t.memo(({element:e,index:n,leaving:a,setLeaving:i,setSpacer:c,selectRef:p,spacer:y,delSpacer:f,setVisibility:o,setActiveHoverId:v,activeHoverId:E,swipedId:C,setSwipedId:$,deleteInline:N,remove:M,renderIcon:I,DelIcon:O,normalizedOptions:F,swiped:W,onSwipe:P,deleting:G,setDeleting:se,onRender:X,duration:Y})=>{const T=t.useRef(null),l=t.useRef(!1),ee=t.useRef(!1),re=t.useRef(0),q=t.useRef(null),K=t.useCallback(m=>{re.current=m.touches[0].clientX,l.current=!1,T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{se(!0),l.current=!0,p.current?.focus(),o(!1),window.navigator.vibrate&&window.navigator.vibrate(50)},600),m.preventDefault()},[]),le=t.useCallback(m=>{T.current&&clearTimeout(T.current);const r=m.touches[0].clientX,u=re.current-r;Math.abs(u)>10&&(ee.current=!0,u>30&&!W?P(e.id):u<-30&&W&&P(null))},[e.id,W,P]),oe=t.useCallback(m=>{T.current&&clearTimeout(T.current),l.current&&m.preventDefault()},[]);let _=null;if(e?.jsx)_=e.jsx;else if(e?.name)_=e.name;else if(e?.raw!==void 0){const m=F.find(r=>r.raw===e.raw||r.original===e.raw||r.userId===e.raw);m&&(_=m.jsx??m.name)}_==null&&(_=typeof e=="object"?e.label??e.name??e.value??"Selected item":String(e));const B=t.useCallback(m=>{m.stopPropagation(),m.preventDefault()},[]),ne=t.useCallback(m=>{B(m),M(e.id),P(null)},[e.id,M,P]),S=t.useCallback(m=>{if(B(m),l.current){l.current=!1;return}if(G){ne(m);return}},[G,ne]);return t.useLayoutEffect(()=>{if(q.current&&X){const m=q.current.offsetWidth;X(m)}},[X,_]),d.jsxs(t.Fragment,{children:[d.jsxs("div",{className:`rac-multiple-selected-option ${G?"--deleting-shake":""}`,onMouseEnter:()=>v(e.id),onMouseLeave:()=>v(null),onTouchStart:K,onTouchMove:le,onTouchEnd:oe,onClick:S,ref:q,children:[_,d.jsx(Pe,{style:{backgroundColor:G||N?"transparent":"--rac-multiple-del-bg",position:G||N?"relative":"absolute"},visibility:E===e.id||C===e.id||G,className:"rac-multiple-del",setLeaving:i,setSpacer:c,duration:Y,children:I(O,{onClick:ne,onMouseDown:B})})]}),d.jsx(Pe,{visibility:!a&&!y?.state&&!E&&!C&&!G&&N&&f,className:"rac-multiple-option",style:{visibility:"hidden"},children:d.jsx("div",{style:{padding:0,marginRight:0,marginLeft:0},className:"rac-multiple-selected-option",children:I(O)})})]})}),sr=({children:e,setLeaving:n,duration:a,setSpacer:i,id:c=null,widthMode:p=!1,...y})=>{const f=t.useRef(null);return d.jsx(We.CSSTransition,{classNames:"rac-slide-left",timeout:a,nodeRef:f,unmountOnExit:!0,...y,onEnter:()=>{const o=f.current;o&&(p?o.style.width="0px":(o.style.height="0px",o.style.transform="translateY(-10px)"),o.style.opacity="0")},onEntering:()=>{const o=f.current;o.offsetHeight,p?o.style.width=o.scrollWidth+"px":(o.style.height=o.scrollHeight+"px",o.style.transform="translateY(0)"),o.style.opacity="1"},onEntered:()=>{const o=f.current;o.style.width=p?"auto":"",o.style.height=p?"":"100%",o.style.opacity="1",o.style.transform="",i?.(!1)},onExit:()=>{const o=f.current;p?o.style.width=o.offsetWidth+"px":(o.style.height=o.offsetHeight+"px",o.style.position="absolute"),o.style.opacity="1",n?.(!0)},onExiting:()=>{const o=f.current;p?o.style.width="0px":(o.style.height="0px",o.style.transform="translateY(10px)"),o.style.opacity="0"},onExited:()=>{i?.(!1),n?.(!1)},children:d.jsx("div",{ref:f,id:c,style:{transition:`all ${a}ms ease`,alignItems:"center",whiteSpace:"nowrap",overflow:"hidden",display:"flex",left:0,top:0},children:e})})},pr=t.memo(({element:e,index:n,leaving:a,setLeaving:i,selectRef:c,setVisibility:p,setActiveHoverId:y,delSpacer:f,swiped:o,swipedId:v,setSwipedId:E,onSwipe:C,activeHoverId:$,deleteInline:N,spacer:M,duration:I,normalizedOptions:O,setDeleting:F,renderIcon:W,deleting:P,DelIcon:G,remove:se,registerItemWidth:X,setSpacer:Y,...T})=>d.jsxs(t.Fragment,{children:[d.jsx(sr,{className:"rac-multiple-option",onEnter:T.onEnter,setLeaving:i,setSpacer:Y,onExit:T.onExit,duration:I,in:T.in,id:e.id,widthMode:!0,children:d.jsx(gr,{onRender:l=>X(e.id,l),normalizedOptions:O,setActiveHoverId:y,activeHoverId:$,setVisibility:p,deleteInline:N,setDeleting:F,setSwipedId:E,setLeaving:i,renderIcon:W,setSpacer:Y,selectRef:c,delSpacer:f,duration:I,deleting:P,swipedId:v,onSwipe:C,element:e,DelIcon:G,leaving:a,swiped:o,remove:se,spacer:M,index:n},e.id??n)}),M.state&&M.id===e.id&&d.jsx("div",{style:{width:M.width-2},className:"rac-spacer"})]}));function br({visibility:e,children:n,selectRef:a,onAnimationDone:i,unmount:c=!0,duration:p,easing:y,offset:f,animateOpacity:o,style:v,className:E,setBottomDirection:C=()=>{}}){const $=t.useRef(null),[N,M]=t.useState({top:0,left:0,width:0}),I=t.useRef(N);t.useEffect(()=>{I.current=N},[N]);const O=t.useCallback(()=>{if(a?.current){const l=a.current.getBoundingClientRect(),ee=window.innerHeight,re=$.current?.scrollHeight||250,q=ee-l.bottom,K=q<re&&l.top>q;C(K),M({top:l.top,bottom:l.bottom,left:l.left,width:l.width,isUpward:K})}},[a]);t.useEffect(()=>{if(e)return O(),window.addEventListener("scroll",O,!0),window.addEventListener("resize",O),()=>{window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",O)}},[e,O]);const F=`height var(--rac-duration) ${y}${o?`, opacity var(--rac-duration) ${y}`:""}`;t.useLayoutEffect(()=>{if(!a?.current)return;const l=new ResizeObserver(ee=>{for(let re of ee)if(e&&$.current&&a.current){const q=a.current.getBoundingClientRect(),{isUpward:K}=I.current;$.current.style.width=`${q.width}px`,$.current.style.left=`${q.left}px`,K?$.current.style.bottom=`${window.innerHeight-q.top+f}px`:$.current.style.top=`${q.bottom+f}px`}});return l.observe(a.current),()=>l.disconnect()},[a,e,f]);const W={position:"fixed","--rac-duration":`${p}ms`,"--rac-easing":y,left:`${N.left}px`,width:`${N.width}px`,overflow:"hidden",zIndex:"2147483647",height:e?"auto":"0px",opacity:o?e?1:0:1,pointerEvents:e?"all":"none",boxSizing:"border-box",transformOrigin:N.isUpward?"bottom":"top",...N.isUpward?{bottom:`${window.innerHeight-N.top+f}px`,top:"auto"}:{top:`${N.bottom+f}px`,bottom:"auto"},...Object.fromEntries(Object.entries(v||{}).map(([l,ee])=>[l.startsWith("--")?l:`--rac-${l.replace(/([A-Z])/g,"-$1").toLowerCase()}`,ee]))},P=t.useCallback(()=>{const l=$.current;l&&(l.style.height="0px",o&&(l.style.opacity="0"),l.style.transition="")},[o]),G=t.useCallback(()=>{const l=$.current;l&&(l.style.transition=F,l.style.height=`${l.scrollHeight}px`,o&&(l.style.opacity="1"))},[F,o]),se=t.useCallback(()=>{const l=$.current;l&&(l.style.height="auto",l.style.transition="",i&&i())},[i]),X=t.useCallback(()=>{const l=$.current;l&&(l.style.height=`${l.scrollHeight}px`,o&&(l.style.opacity="1"),l.offsetHeight,l.style.transition=F)},[F,o]),Y=t.useCallback(()=>{const l=$.current;l&&(l.style.height="0px",o&&(l.style.opacity="0"))},[o]),T=t.useCallback(()=>{const l=$.current;l&&(l.style.transition="")},[]);return cr.createPortal(d.jsx(We.CSSTransition,{in:e,timeout:p,classNames:"rac-options",unmountOnExit:c,nodeRef:$,onEnter:P,onEntering:G,onEntered:se,onExit:X,onExiting:Y,onExited:T,children:d.jsx("div",{ref:$,className:`rac-options ${E||""}`,style:{...W,"--rac-duration":`${p}ms`,"--rac-duration-fast":"calc(var(--rac-duration) * 0.5)","--rac-duration-base":"var(--rac-duration)","--rac-duration-slow":"calc(var(--rac-duration) * 1.3)"},onMouseDown:l=>l.preventDefault(),children:n})}),document.body)}const mr=t.memo(br,(e,n)=>e.visibility===n.visibility&&e.duration===n.duration&&e.easing===n.easing&&e.offset===n.offset&&e.animateOpacity===n.animateOpacity&&e.selectRef===n.selectRef&&e.children===n.children&&JSON.stringify(e.style)===JSON.stringify(n.style)),rr=e=>{const n=window.getComputedStyle(e);return parseFloat(n.marginLeft)+parseFloat(n.marginRight)},tr=e=>e.reduce((n,a)=>{const i=a.offsetTop,c=a.getBoundingClientRect().width;return n[i]=(n[i]||0)+c,n},{}),xr=t.memo(({deleteInline:e,selectRef:n,setVisibility:a,selectId:i,removeOption:c,renderOptions:p,selected:y,selectedIDs:f,setSelectedIds:o,normalizedOptions:v,title:E,visibility:C,active:$,hasOptions:N,hasActualValue:M,optionsClassName:I,selectedText:O,disabled:F,loading:W,error:P,registerOption:G,unregisterOption:se,handleBlur:X,handleFocus:Y,toggleVisibility:T,handleKeyDown:l,handleListScroll:ee,setAnimationFinished:re,clear:q,children:K,placeholder:le,className:oe,style:_,duration:B,easing:ne,offset:S,animateOpacity:m,unmount:r,ArrowIcon:u,ClearIcon:x,DelIcon:w,renderIcon:de,hasMore:ye,loadButton:s,deleting:b,setDeleting:j})=>{const[h,L]=t.useState(!1),[D,ce]=t.useState(null),[V,U]=t.useState(!1),[ae,g]=t.useState({}),[z,Q]=t.useState(null),[fe,R]=t.useState(null),[he,ge]=t.useState(!1),me=t.useRef(!0),Re=t.useRef(null),ie=t.useCallback(H=>{c?c(H):o(J=>J.filter(te=>te.id!==H))},[c,o]),Ne=t.useCallback(H=>{if(b){H.stopPropagation(),H.preventDefault(),j(!1);return}T(H)},[b,T]),Te=t.useCallback((H,J)=>{g(te=>te[H]===J?te:{...te,[H]:J})},[]);t.useLayoutEffect(()=>{const H=Re.current;if(!H)return;const J=new ResizeObserver(te=>{window.requestAnimationFrame(()=>{if(!Array.isArray(te)||!te.length)return;const Ae=te[0].contentRect.height;ce(Ae)})});return J.observe(H),()=>J.disconnect()},[]),t.useEffect(()=>{me.current=!1,n&&(typeof n=="function"?n(n.current):n.current=n.current)},[n]),t.useEffect(()=>{b&&C&&T()&&T?.()(b&&f?.length===0)&&j(!1),R(null)},[f?.length,b]),t.useLayoutEffect(()=>{const H=Re.current;if(!H||!f?.length||b){f?.length||U({state:!1,id:null,width:0});return}const J=Array.from(H.children).filter(pe=>pe.classList.contains("rac-multiple-option")),te=H.clientWidth;if(J.length>f.length){const pe=new Set(f.map(A=>A.id)),Ee=J.findIndex(A=>!pe.has(A.id));if(Ee===-1)return;const we=J[Ee],be=J[Ee-1];if(!(be&&we.offsetTop!==be.offsetTop)){U({state:!1,id:null,width:0});return}const Oe=tr(J),xe=Object.keys(Oe).map(Number).sort((A,Z)=>A-Z),Se=xe.indexOf(we.offsetTop);if(Se<=0){U({state:!1,id:null,width:0});return}const je=xe[Se-1],$e=Oe[je],Le=te-$e;Ae(be?.id||null,!0,Le)}else if(J.length===f.length){const pe=J[J.length-1],Ee=f[f.length-1]?.id,we=ae[Ee];if(!we)return;const be=pe?.firstElementChild||pe,Ye=rr(be),Oe=rr(pe),xe=J.slice(0,-1),Se=tr(xe),je=Object.keys(Se).map(Number).sort((Z,ue)=>Z-ue);let $e=te;if(je.length>0){const Z=Math.max(...je);$e=te-(Se[Z]||0)}const Le=we+Ye+Oe>$e,A=f[f.length-2]?.id;Ae(A,Le,$e)}function Ae(pe,Ee,we){U(be=>be.id===pe&&be.state===Ee&&be.width===we?be:{state:Ee,id:pe,width:we})}},[f,ae,b]);const _e=f?.map((H,J)=>{const te=J===f.length-1;return d.jsx(pr,{normalizedOptions:v,registerItemWidth:Te,setActiveHoverId:R,swiped:z===H.id,activeHoverId:fe,setVisibility:a,deleteInline:e,setDeleting:j,setSwipedId:Q,setLeaving:ge,renderIcon:de,selectRef:n,setSpacer:U,onSwipe:Q,delSpacer:te,duration:B,deleting:b,swipedId:z,leaving:he,element:H,DelIcon:w,spacer:V,remove:ie,index:J},H.id??J)});return d.jsxs(qe.Provider,{value:{registerOption:G,unregisterOption:se},children:[K,d.jsxs("div",{ref:n,style:{"--rac-duration-fast":"calc(var(--rac-duration) * 0.5)","--rac-duration-slow":"calc(var(--rac-duration) * 1.3)","--rac-duration-base":"var(--rac-duration)","--rac-duration":`${B}ms`,..._},className:`
7
- ${!N||F?"rac-disabled-style":""}
8
- ${W?"rac-loading-style":""}
9
- ${P?"rac-error-style":""}
10
- ${oe}
6
+ <%s key={someKey} {...props} />`,S,y,p,y),W[y+S]=!0)}if(y=null,m!==void 0&&(s(m),y=""+m),b(o)&&(s(o.key),y=""+o.key),"key"in o){m={};for(var $ in o)$!=="key"&&(m[$]=o[$])}else m=o;return y&&g(m,typeof r=="function"?r.displayName||r.name||"Unknown":r),i(r,y,m,l(),ce,a)}function k(r){d(r)?r._store&&(r._store.validated=1):typeof r=="object"&&r!==null&&r.$$typeof===u&&(r._payload.status==="fulfilled"?d(r._payload.value)&&r._payload.value._store&&(r._payload.value._store.validated=1):r._store&&(r._store.validated=1))}function d(r){return typeof r=="object"&&r!==null&&r.$$typeof===N}var R=t,N=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),H=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),le=Symbol.for("react.client.reference"),F=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,fe=Array.isArray,V=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(r){return r()}};var re,P={},ie=R.react_stack_bottom_frame.bind(R,x)(),E=V(c(x)),W={};He.Fragment=C,He.jsx=function(r,o,m){var S=1e4>F.recentlyCreatedOwnerStacks++;return v(r,o,m,!1,S?Error("react-stack-top-frame"):ie,S?V(c(r)):E)},He.jsxs=function(r,o,m){var S=1e4>F.recentlyCreatedOwnerStacks++;return v(r,o,m,!0,S?Error("react-stack-top-frame"):ie,S?V(c(r)):E)}})()),He}var Qe;function ft(){return Qe||(Qe=1,process.env.NODE_ENV==="production"?De.exports=ut():De.exports=dt()),De.exports}var h=ft();const et=({className:e="",...n})=>h.jsx("svg",{className:e,role:"button","aria-label":"Clear selection",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",width:"1em",height:"1em",fill:"currentColor",...n,children:h.jsx("path",{d:"M310.6 361.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L160 301.3 54.6 406.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L114.7 256 9.4 150.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 210.7 265.4 105.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3L205.3 256l105.3 105.4z"})}),gt=({className:e="",...n})=>h.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:"1em",height:"1em",fill:"currentColor",...n,children:h.jsx("path",{d:"M34.9 289.5l175.9-175.8c9.4-9.4 24.6-9.4 33.9 0L420.1 289.5c15.1 15.1 4.4 41-17 41H51.9c-21.4 0-32.1-25.9-17-41z"})}),pt=({className:e="",...n})=>h.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"currentColor",...n,children:h.jsx("path",{d:"M20.285 6.708a1 1 0 0 0-1.414-1.416l-9.192 9.192-4.243-4.244a1 1 0 1 0-1.414 1.416l5 5a1 1 0 0 0 1.414 0l9.849-9.948z"})}),Ve=t.createContext(null),Ae=t.forwardRef(({className:e="",visibility:n=void 0,setLeaving:s,setEntering:c,setSpacer:l,children:x,duration:b=300,unmount:g,style:j,exit:i=!0,...v},k)=>{const d=t.useRef(null),R=n!==void 0?n:v.in;t.useImperativeHandle(k,()=>d.current),t.useEffect(()=>{!R&&d.current&&(d.current.style.width="0px")},[]);const N=t.useCallback(()=>{if(!d.current)return{left:"0px",right:"0px"};const _=window.getComputedStyle(d.current);return{left:_.marginLeft,right:_.marginRight}},[]);return h.jsx(Me.CSSTransition,{onEnter:()=>{d.current.style.transition="none",d.current.style.marginRight="0px",d.current.style.marginLeft="0px",d.current.style.width="0px",c?.(!0)},onEntering:()=>{const{left:_,right:C}=N();requestAnimationFrame(()=>{requestAnimationFrame(()=>{d.current&&(d.current.style.transition=`width ${b}ms, color ${b}ms, background-color ${b}ms, margin ${b}ms ease`,d.current.style.width=d.current.scrollWidth+"px",d.current.style.marginRight=C,d.current.style.marginLeft=_)})})},onEntered:()=>{d.current.style.width="auto",l?.(!1),c?.(!1)},onExit:()=>{const{left:_,right:C}=N();d.current.style.width=d.current.scrollWidth+"px",d.current.style.marginRight=C,d.current.style.marginLeft=_,d.current.offsetHeight,s?.(!0)},onExiting:()=>{d.current.style.marginRight="0px",d.current.style.marginLeft="0px",d.current.style.width="0px"},onExited:()=>{g?.(),s?.(!1),l?.(!1)},classNames:"rac-slide-left",unmountOnExit:i,timeout:b,nodeRef:d,in:R,...v,children:h.jsx("div",{className:e,ref:d,style:{transition:`width ${b}ms, color ${b}ms, background-color ${b}ms, margin ${b}ms ease`,willChange:"width",overflow:"hidden",...j},children:x})})}),ht=t.memo(({element:e,index:n,setEntering:s,leaving:c,setLeaving:l,setSpacer:x,selectRef:b,spacer:g,delSpacer:j,setVisibility:i,setActiveHoverId:v,activeHoverId:k,swipedId:d,deleteInline:R,remove:N,renderIcon:_,DelIcon:C,normalizedOptions:O,swiped:L,onSwipe:I,deleting:H,setDeleting:Z,onRender:Q,duration:G,showDelete:U})=>{const u=t.useRef(null),D=t.useRef(!1),le=t.useRef(!1),F=t.useRef(0),q=t.useRef(null),fe=t.useCallback(o=>{F.current=o.touches[0].clientX,D.current=!1,u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{Z(!0),D.current=!0,b.current?.focus(),i(!1),window.navigator.vibrate&&window.navigator.vibrate(50)},600),o.preventDefault()},[]),V=t.useCallback(o=>{u.current&&clearTimeout(u.current);const m=o.touches[0].clientX,S=F.current-m;Math.abs(S)>10&&(le.current=!0,S>30&&!L?(v(null),I(e.id)):S<-30&&L&&I(null))},[e.id,L,I]),re=t.useCallback(o=>{u.current&&clearTimeout(u.current),D.current&&o.preventDefault()},[]);let P=null;if(e?.jsx)P=e.jsx;else if(e?.name)P=e.name;else if(e?.raw!==void 0){const o=O.find(m=>m.raw===e.raw||m.original===e.raw||m.userId===e.raw);o&&(P=o.jsx??o.name)}P==null&&(P=typeof e=="object"?e.label??e.name??e.value??"Selected item":String(e));const ie=t.useCallback(o=>{o.stopPropagation(),o.preventDefault()},[]),E=t.useCallback(o=>{ie(o),N(e.id),I(null)},[e.id,N,I]),W=t.useCallback(o=>{if(ie(o),D.current){D.current=!1;return}if(H){E(o);return}},[H,E]);t.useLayoutEffect(()=>{if(q.current&&Q){const o=q.current.offsetWidth;Q(o)}},[Q,P]);const r=U?!0:k===e.id||d===e.id||H;return h.jsxs(t.Fragment,{children:[h.jsxs("div",{className:`rac-multiple-selected-option ${H?"--deleting-shake":""}`,onMouseEnter:()=>{v(e.id),I(null)},onMouseLeave:()=>v(null),onTouchStart:fe,onTouchMove:V,onTouchEnd:re,onClick:W,ref:q,children:[P,h.jsx(Ae,{style:{backgroundColor:H||R?"transparent":"--rac-multiple-del-bg",position:H||R?"relative":"absolute"},className:"rac-multiple-del",visibility:r,setEntering:s,setLeaving:l,setSpacer:x,duration:G,children:_(C,{onClick:E,onMouseDown:ie})})]}),h.jsx(Ae,{visibility:!c&&!g?.state&&!k&&!d&&!H&&R&&j,className:"rac-multiple-option",style:{visibility:"hidden"},children:h.jsx("div",{style:{padding:0,marginRight:0,marginLeft:0},className:"rac-multiple-selected-option",children:_(C)})})]})}),st=({children:e,setLeaving:n,duration:s,setSpacer:c,id:l=null,widthMode:x=!1,...b})=>{const g=t.useRef(null),j=t.useCallback(()=>{if(!g.current)return{t:0,b:0,l:0,r:0};const i=window.getComputedStyle(g.current);return{t:i.marginTop,b:i.marginBottom,l:i.marginLeft,r:i.marginRight}},[]);return h.jsx(Me.CSSTransition,{classNames:"rac-slide-left",timeout:s,nodeRef:g,unmountOnExit:!0,...b,onEnter:()=>{const i=g.current;i&&(x?(i.style.width="0px",i.style.marginLeft="0px",i.style.marginRight="0px"):(i.style.height="0px",i.style.marginTop="0px",i.style.marginBottom="0px",i.style.transform="translateY(-10px)"),i.style.opacity="0")},onEntering:()=>{const i=g.current,v=j();i.offsetHeight,x?(i.style.width=i.scrollWidth+"px",i.style.marginRight=v.r,i.style.marginLeft=v.l):(i.style.height=i.scrollHeight+"px",i.style.transform="translateY(0)",i.style.marginBottom=v.b,i.style.marginTop=v.t),i.style.opacity="1"},onEntered:()=>{const i=g.current;i.style.width=x?"auto":"",i.style.height=x?"":"100%",i.style.opacity="1",i.style.transform="",c?.(!1)},onExit:()=>{const i=g.current,v=j();x?(i.style.width=i.offsetWidth+"px",i.style.marginRight=v.r,i.style.marginLeft=v.l):(i.style.height=i.offsetHeight+"px",i.style.position="absolute",i.style.marginBottom=v.b,i.style.marginTop=v.t),i.style.opacity="1",n?.(!0)},onExiting:()=>{const i=g.current;x?(i.style.marginRight="0px",i.style.marginLeft="0px",i.style.width="0px"):(i.style.transform="translateY(10px)",i.style.marginBottom="0px",i.style.marginTop="0px",i.style.height="0px"),i.style.opacity="0"},onExited:()=>{c?.(!1),n?.(!1)},children:h.jsx("div",{ref:g,id:l,style:{transition:`all ${s}ms ease`,alignItems:"center",whiteSpace:"nowrap",overflow:"hidden",display:"flex",left:0,top:0},children:e})})},mt=t.memo(({element:e,index:n,setEntering:s,leaving:c,setLeaving:l,selectRef:x,setVisibility:b,setActiveHoverId:g,delSpacer:j,swiped:i,swipedId:v,onSwipe:k,activeHoverId:d,deleteInline:R,spacer:N,duration:_,normalizedOptions:C,setDeleting:O,renderIcon:L,deleting:I,DelIcon:H,remove:Z,registerItemWidth:Q,setSpacer:G,showDelete:U,...u})=>h.jsxs(t.Fragment,{children:[h.jsx(st,{className:"rac-multiple-option",onEnter:u.onEnter,setLeaving:l,setSpacer:G,onExit:u.onExit,duration:_,id:e.id,in:u.in,widthMode:!0,children:h.jsx(ht,{onRender:D=>Q(e.id,D),normalizedOptions:C,setActiveHoverId:g,activeHoverId:d,setVisibility:b,deleteInline:R,setDeleting:O,setEntering:s,setLeaving:l,renderIcon:L,showDelete:U,setSpacer:G,selectRef:x,delSpacer:j,duration:_,deleting:I,swipedId:v,onSwipe:k,element:e,DelIcon:H,leaving:c,swiped:i,remove:Z,spacer:N,index:n},e.id??n)}),N.state&&N.id===e.id&&h.jsx("div",{style:{width:N.width-2},className:"rac-spacer"})]}));function yt({visibility:e,children:n,selectRef:s,onAnimationDone:c,unmount:l=!0,duration:x,easing:b,offset:g,animateOpacity:j,style:i,className:v,setBottomDirection:k=()=>{}}){const d=t.useRef(null),[R,N]=t.useState({top:0,left:0,width:0}),_=t.useRef(R);t.useLayoutEffect(()=>{_.current=R},[R]);const C=t.useCallback(()=>{if(s?.current){const u=s.current.getBoundingClientRect(),D=window.innerHeight,le=d.current?.scrollHeight||250,F=D-u.bottom,q=F<le&&u.top>F;k(q),N({top:u.top,bottom:u.bottom,left:u.left,width:u.width,isUpward:q})}},[s]);t.useLayoutEffect(()=>{if(e)return C(),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[e,C]);const O=`height var(--rac-duration) ${b}${j?`, opacity var(--rac-duration) ${b}`:""}`;t.useLayoutEffect(()=>{if(!s?.current)return;const u=new ResizeObserver(D=>{for(let le of D)if(e&&d.current&&s.current){const F=s.current.getBoundingClientRect(),{isUpward:q}=_.current;d.current.style.width=`${F.width}px`,d.current.style.left=`${F.left}px`,q?d.current.style.bottom=`${window.innerHeight-F.top+g}px`:d.current.style.top=`${F.bottom+g}px`}});return u.observe(s.current),()=>u.disconnect()},[s,e,g]);const L={position:"fixed","--rac-duration":`${x}ms`,"--rac-easing":b,left:`${R.left}px`,width:`${R.width}px`,overflow:"hidden",zIndex:"2147483647",height:e?"auto":"0px",opacity:j?e?1:0:1,pointerEvents:e?"all":"none",boxSizing:"border-box",transformOrigin:R.isUpward?"bottom":"top",...R.isUpward?{bottom:`${window.innerHeight-R.top+g}px`,top:"auto"}:{top:`${R.bottom+g}px`,bottom:"auto"},...Object.fromEntries(Object.entries(i||{}).map(([u,D])=>[u.startsWith("--")?u:`--rac-${u.replace(/([A-Z])/g,"-$1").toLowerCase()}`,D]))},I=t.useCallback(()=>{const u=d.current;u&&(u.style.height="0px",j&&(u.style.opacity="0"),u.style.transition="")},[j]),H=t.useCallback(()=>{const u=d.current;u&&(u.style.transition=O,u.style.height=`${u.scrollHeight}px`,j&&(u.style.opacity="1"))},[O,j]),Z=t.useCallback(()=>{const u=d.current;u&&(u.style.height="auto",u.style.transition="",c&&c())},[c]),Q=t.useCallback(()=>{const u=d.current;u&&(u.style.height=`${u.scrollHeight}px`,j&&(u.style.opacity="1"),u.offsetHeight,u.style.transition=O)},[O,j]),G=t.useCallback(()=>{const u=d.current;u&&(u.style.height="0px",j&&(u.style.opacity="0"))},[j]),U=t.useCallback(()=>{const u=d.current;u&&(u.style.transition="")},[]);return ct.createPortal(h.jsx(Me.CSSTransition,{in:e,timeout:x,classNames:"rac-options",unmountOnExit:l,nodeRef:d,onEnter:I,onEntering:H,onEntered:Z,onExit:Q,onExiting:G,onExited:U,children:h.jsx("div",{ref:d,className:`rac-options ${v||""}`,style:{...L,"--rac-duration":`${x}ms`,"--rac-duration-fast":"calc(var(--rac-duration) * 0.5)","--rac-duration-base":"var(--rac-duration)","--rac-duration-slow":"calc(var(--rac-duration) * 1.3)"},onMouseDown:u=>u.preventDefault(),children:n})}),document.body)}const bt=t.memo(yt,(e,n)=>e.visibility===n.visibility&&e.duration===n.duration&&e.easing===n.easing&&e.offset===n.offset&&e.animateOpacity===n.animateOpacity&&e.selectRef===n.selectRef&&e.children===n.children&&JSON.stringify(e.style)===JSON.stringify(n.style)),tt=e=>{const n=window.getComputedStyle(e);return parseFloat(n.marginLeft)+parseFloat(n.marginRight)},rt=e=>e.reduce((n,s)=>{const c=s.offsetTop,l=s.getBoundingClientRect().width;return n[c]=(n[c]||0)+l,n},{}),xt=t.memo(({deleteInline:e,selectRef:n,setVisibility:s,selectId:c,removeOption:l,renderOptions:x,selected:b,selectedIDs:g,setSelectedIds:j,normalizedOptions:i,title:v,visibility:k,active:d,hasOptions:R,hasActualValue:N,optionsClassName:_,selectedText:C,disabled:O,loading:L,error:I,registerOption:H,unregisterOption:Z,handleBlur:Q,handleFocus:G,toggleVisibility:U,handleKeyDown:u,handleListScroll:D,setAnimationFinished:le,clear:F,children:q,placeholder:fe,className:V,style:re,duration:P,easing:ie,offset:E,animateOpacity:W,unmount:r,OpenIcon:o,ClearIcon:m,DelIcon:S,renderIcon:ce,hasMore:a,loadButton:y,deleting:p,setDeleting:$,showDelete:T})=>{const[Y,ue]=t.useState(!1),[oe,xe]=t.useState(null),[ee,f]=t.useState(!1),[A,ne]=t.useState({}),[he,z]=t.useState(null),[ke,X]=t.useState(null),[be,ve]=t.useState(!1),[te,Re]=t.useState(!1),$e=t.useRef(!0),Se=t.useRef(null),We=t.useCallback(J=>{l?l(J):j(B=>B.filter(ae=>ae.id!==J))},[l,j]),Ye=t.useCallback(J=>{if(p){J.stopPropagation(),J.preventDefault(),$(!1);return}U(J)},[p,U]),Ge=t.useCallback((J,B)=>{ne(ae=>ae[J]===B?ae:{...ae,[J]:B})},[]);t.useLayoutEffect(()=>{const J=Se.current;if(!J)return;const B=new ResizeObserver(ae=>{window.requestAnimationFrame(()=>{if(!Array.isArray(ae)||!ae.length)return;const Oe=ae[0].contentRect.height;xe(Oe)})});return B.observe(J),()=>B.disconnect()},[]),t.useEffect(()=>{$e.current=!1,n&&(typeof n=="function"?n(n.current):n.current=n.current)},[n]),t.useEffect(()=>{p&&k&&U()&&U?.()(p&&g?.length===0)&&$(!1),X(null)},[g?.length,p]),t.useLayoutEffect(()=>{const J=Se.current;if(!J||!g?.length||p){g?.length||f({state:!1,id:null,width:0});return}const B=Array.from(J.children).filter(ye=>ye.classList.contains("rac-multiple-option")),ae=J.clientWidth;if(B.length>g.length){const ye=new Set(g.map(me=>me.id)),Ee=B.findIndex(me=>!ye.has(me.id));if(Ee===-1)return;const de=B[Ee],ge=B[Ee-1];if(!(ge&&de.offsetTop!==ge.offsetTop)){f({state:!1,id:null,width:0});return}const Le=rt(B),Pe=Object.keys(Le).map(Number).sort((me,je)=>me-je),M=Pe.indexOf(de.offsetTop);if(M<=0){f({state:!1,id:null,width:0});return}const K=Pe[M-1],se=Le[K],pe=ae-se;Oe(ge?.id||null,!0,pe)}else if(B.length===g.length){const ye=B[B.length-1],Ee=g[g.length-1]?.id,de=A[Ee];if(!de)return;const ge=ye?.firstElementChild||ye,Ne=tt(ge),Le=tt(ye),Pe=B.slice(0,-1),M=rt(Pe),K=Object.keys(M).map(Number).sort((je,w)=>je-w);let se=ae;if(K.length>0){const je=Math.max(...K);se=ae-(M[je]||0)}const pe=de+Ne+Le>se,me=g[g.length-2]?.id;Oe(me,pe,se)}function Oe(ye,Ee,de){f(ge=>ge.id===ye&&ge.state===Ee&&ge.width===de?ge:{state:Ee,id:ye,width:de})}},[g,A,p]);const Ce=m&&N&&R&&!O&&!L&&!I&&!p,Te=o&&d&&!p,Ue=g?.map((J,B)=>{const ae=B===g.length-1;return h.jsx(mt,{normalizedOptions:i,registerItemWidth:Ge,setActiveHoverId:X,swiped:he===J.id,activeHoverId:ke,setVisibility:s,deleteInline:e,setDeleting:$,setEntering:Re,setLeaving:ve,renderIcon:ce,showDelete:T,selectRef:n,setSpacer:f,onSwipe:z,delSpacer:ae,duration:P,deleting:p,swipedId:he,leaving:be,element:J,DelIcon:S,spacer:ee,remove:We,index:B},J.id??B)});return h.jsxs(Ve.Provider,{value:{registerOption:H,unregisterOption:Z},children:[q,h.jsxs("div",{ref:n,style:{"--rac-duration-fast":"calc(var(--rac-duration) * 0.5)","--rac-duration-slow":"calc(var(--rac-duration) * 1.3)","--rac-duration-base":"var(--rac-duration)","--rac-duration":`${P}ms`,...re},className:`
7
+ ${!R||O?"rac-disabled-style":""}
8
+ ${L?"rac-loading-style":""}
9
+ ${I?"rac-error-style":""}
10
+ ${V}
11
11
  rac-select
12
- `,...$&&{onKeyDown:l,onFocus:Y,onClick:Ne,onBlur:X},"aria-disabled":F||!N,"aria-controls":`${i}-listbox`,tabIndex:$?0:-1,"aria-expanded":C,"aria-label":le,"aria-haspopup":"listbox",role:"combobox",children:[d.jsx("div",{className:`rac-select-title-wrapper
13
- ${!P&&!W&&y?.type==="boolean"?y.raw?"rac-true-option":"rac-false-option":""}
14
- `,style:{alignItems:f?.length&&!O?"flex-start":"center",height:D?`${D}px`:"auto"},children:d.jsx("div",{style:{alignItems:f?.length&&!O?"flex-start":"center",height:W?"100%":"auto"},className:"rac-select-title",ref:Re,children:d.jsx(We.TransitionGroup,{enter:!me.current,component:null,appear:!1,children:f?.length&&!O&&!W?_e:d.jsxs(sr,{className:"rac-title-container",duration:B,widthMode:!0,children:[d.jsx("span",{className:"rac-title-text",children:E}),d.jsx(Pe,{className:"rac-loading-container",visibility:W&&!P,duration:B,children:d.jsxs("span",{className:"rac-loading-dots",children:[d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{})]})})]},E)})})}),d.jsxs("div",{className:"rac-select-buttons",children:[d.jsx(Pe,{visibility:M&&N&&!F&&!W&&!P&&!b,style:{display:"grid"},duration:B,children:de(x,{className:"rac-select-cancel",onMouseDown:H=>{H.preventDefault(),H.stopPropagation()},onClick:q})}),d.jsx(Pe,{visibility:$&&!b,style:{display:"grid"},duration:B,children:d.jsx("span",{className:`rac-select-arrow-wrapper ${C?"--open":""}`,children:de(u,{className:"rac-select-arrow-wrapper"})})})]}),d.jsx(mr,{style:{"--rac-duration":`${B}ms`,..._},onAnimationDone:()=>re(!0),setBottomDirection:L,animateOpacity:m,className:I,visibility:C,selectRef:n,duration:B,unmount:r,easing:ne,offset:S,children:d.jsxs("div",{onScroll:ee,className:"rac-select-list","aria-label":"Options",role:"listbox",tabIndex:"-1",children:[p,!s&&ye&&d.jsxs("div",{className:"rac-select-option rac-disabled-option rac-loading-option",onClick:H=>H.stopPropagation(),children:[d.jsx("span",{className:"rac-loading-option-title",children:"Loading"}),d.jsxs("span",{className:"rac-loading-dots",children:[d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{})]})]})]})})]})]})}),yr=["group","disabled","options","items","children"],De=["name","label","id","value"],nr=[],Fe=(e,n=!1)=>{if(n&&typeof e.group=="string")return e.group;const a=De.find(c=>e[c]!=null&&e[c]!=="");if(a)return String(e[a]);const i=Object.entries(e).find(([c,p])=>!yr.includes(c)&&p!=null&&p!=="");return i?String(i[1]):null};function Er({options:e=nr,jsxOptions:n=nr,value:a,defaultValue:i,onChange:c,disabled:p=!1,loading:y=!1,error:f=!1,multiple:o=!1,placeholder:v="Choose option",emptyText:E="No options",disabledText:C="Disabled",loadingText:$="Loading",errorText:N="Failed to load",disabledOption:M="Disabled option",emptyOption:I="Empty option",invalidOption:O="Invalid option",setVisibility:F,hasMore:W,loadButton:P,setLoadingTitle:G,loadingTitle:se,loadMoreText:X,loadMore:Y,childrenFirst:T,groupsClosed:l}){const ee=a!==void 0,[re,q]=t.useState(()=>{const s=new Set;if(l)return s;const b=j=>{Array.isArray(j)&&j.forEach(h=>{if(h&&typeof h=="object"){if(("options"in h||"group"in h&&!De.some(D=>D in h))&&!h.disabled){const D=Fe(h,!0)||"Empty group";s.add(D)}h.options&&b(h.options)}})};return b(e),s}),K=t.useRef(null),le=t.useCallback(s=>{q(b=>{const j=new Set(b);return j.has(s)?j.delete(s):j.add(s),j})},[]),oe=t.useCallback((s,b,j="n",h=null,L=!1)=>{const D=`${j}-${b}`;if(s==null||s==="")return{id:D,userId:null,name:I,raw:null,disabled:!0,type:"normal",group:h,groupDisabled:L};if(typeof s=="function")return{id:D,userId:null,name:O,raw:s,disabled:!0,invalid:!0,type:"normal",group:h};if(typeof s=="object"&&!Array.isArray(s)){const ce=h||s.group||null,V=L||s.disabled===!0,U=s.id??s.value??s.name??s.label,ae=s.value!==void 0?s.value:s.id!==void 0?s.id:s;let g=Fe(s)||(V?M:I);return{id:D,userId:U,name:g,raw:ae,original:s,disabled:V||g===I&&!V,type:typeof ae=="boolean"?"boolean":"normal",group:ce,groupDisabled:L}}return{id:D,userId:s,name:String(s),raw:s,original:s,disabled:L,type:typeof s=="boolean"?"boolean":"normal",group:h}},[I,O,M]),_=t.useMemo(()=>{const s=new Map,b=[],j=n.map((g,z)=>{if(g.isGroupMarker)return{...g,type:"group-marker"};const Q=!g.label&&!g.userId&&!g.value&&(g.value===void 0||g.value===null||g.value==="")&&!g.hasJsx;return{...g,id:`jsx-${g.id}`,index:z,userId:g.userId,raw:g.value,original:g.value,name:Q?I:g.label||g.userId||String(g.value||""),disabled:!!g.disabled||Q,type:typeof g.value=="boolean"?"boolean":"normal",group:g.group||null}});let h=0;const L=(g,z=null,Q=!1,fe="0")=>{Array.isArray(g)||(g=[g]),g.forEach((R,he)=>{if(!R)return;const ge=`${fe}-${he}`,me=typeof R=="object"&&!Array.isArray(R);if(me&&("options"in R||"group"in R&&!De.some(ie=>ie in R))){const ie=Fe(R,!0)||"Empty group";s.has(ie)||s.set(ie,{disabled:!!R.disabled,closedByDefault:!!R.disabled||l,items:[]}),R.options?L(R.options,ie,Q||!!R.disabled,ge):b.push({id:`empty-${ie}-${ge}`,name:ie,group:ie,isPlaceholder:!0,type:"group-marker",index:h++})}else if(me&&!De.some(ie=>ie in R)&&!R.group)Object.entries(R).forEach(([ie,Ne],Te)=>{const _e=oe(Ne,`${ge}-${Te}`,"default",z,Q);b.push({..._e,index:h++})});else{const ie=oe(R,ge,"default",z,Q);b.push({...ie,index:h++})}})};L(e);const D=T?[...j,...b]:[...b,...j];if(!K.current)K.current=new Map(D.map((g,z)=>[g.id,z]));else{let g=!1;if(D.forEach(z=>{K.current.has(z.id)||(g=!0)}),g){const z=new Map;D.forEach((Q,fe)=>{z.set(Q.id,fe)}),K.current=z}}const ce=[...D].sort((g,z)=>{const Q=K.current.get(g.id)??999999,fe=K.current.get(z.id)??999999;return Q-fe}),V=[],U=new Set;ce.forEach(g=>{if(!g.group)V.push({type:"item",data:g});else if(U.has(g.group)||(U.add(g.group),V.push({type:"group",name:g.group})),!g.isPlaceholder&&!g.isGroupMarker){const z=s.get(g.group)||{items:[]};s.has(g.group)||s.set(g.group,z),z.items.push(g)}});const ae=[];return V.forEach(g=>{if(g.type==="item")ae.push(g.data);else{const z=g.name,Q=s.get(z),fe=re.has(z);ae.push({id:`group-header-${z}`,name:z,disabled:!!Q?.disabled,groupHeader:!0,expanded:fe,type:"group",hidden:!1}),Q?.items.forEach(R=>{const he=re.size>0?!fe:!!l;ae.push({...R,hidden:he})})}}),W&&P&&ae.push({id:"special-load-more-id",name:se,loadMore:!0,loading:se===X,type:"special"}),ae},[e,n,oe,T,W,P,se,X,l,re,I]),B=t.useCallback(()=>{const s=ee?a:i;if(s==null||Array.isArray(s)&&s.length===0)return{initialId:null,initialIDs:[]};const b=new Set,j=(h,L)=>{let D=_.find(V=>V.original===h&&!b.has(V.id));if(!D&&typeof h=="object")try{const V=JSON.stringify(h);D=_.find(U=>U.original&&typeof U.original=="object"&&JSON.stringify(U.original)===V&&!b.has(U.id))}catch{}if(D)return b.add(D.id),D;const ce=typeof h=="object"?h.id||h.value||JSON.stringify(h):String(h);return typeof h=="object"&&h!==null?{id:`virtual-${ce}-${L}`,name:Fe(h)||String(h.id||"Selected Object"),raw:h.value??h.id??h,original:h,userId:h.id??h.value??null,virtual:!0}:{id:`virtual-${ce}-${L}`,name:String(h),raw:h,original:h,userId:h,virtual:!0}};if(o)return{initialId:null,initialIDs:(Array.isArray(s)?s:[s]).map((D,ce)=>j(D,ce))};{const h=Array.isArray(s)?s[0]:s;return{initialId:j(h,0).id,initialIDs:[]}}},[ee,a,i,_,o]),[ne,S]=t.useState(()=>B().initialId),[m,r]=t.useState(()=>B().initialIDs),u=t.useMemo(()=>{const s=_.find(b=>b.id===ne);if(s)return s;if(!o&&ne?.startsWith("virtual-")){const b=ee?a:i,j=Array.isArray(b)?b[0]:b;if(j)return{id:ne,name:typeof j=="object"?Fe(j):String(j),original:j}}return null},[ne,_,o,ee,a,i]),x=t.useCallback((s,b)=>{if(s.groupHeader){w(b),s.disabled||le(s.name);return}if(s.disabled||s.loadMore){w(b),s.loadMore&&!s.loading&&(G(X),Y());return}if(o){if(s.disabled||s.groupHeader||s.loadMore){w(b);return}w(b);const h=m?.some(L=>L.id===s.id)?m.filter(L=>L.id!==s.id):[...m,s];r(h),c?.(h.map(L=>L.original),h.map(L=>L.userId));return}S(s.id),c?.(s.original,s.userId),F(!1)},[c,F,Y,X,G,le,o,m]),w=t.useCallback(s=>{s?.stopPropagation(),s?.preventDefault()},[]),de=t.useCallback(()=>{c?.(null,null),S(null),r([])},[c]),ye=t.useCallback(s=>{const b=m.filter(j=>j.id!==s);r(b),c?.(b.map(j=>j.original),b.map(j=>j.userId))},[m,c]);return{normalizedOptions:_,selected:u,selectOption:x,clear:de,removeOption:ye,hasOptions:_.length>0,active:!f&&!y&&!p&&_.length>0,selectedValue:a??i,placeholder:v,emptyText:E,disabledText:C,loadingText:$,errorText:N,disabledOption:M,emptyOption:I,invalidOption:O,disabled:p,loading:y,error:f,expandedGroups:re,toggleGroup:le,selectedIDs:m,multiple:o,setSelectedIds:r}}function wr({disabled:e,open:n,setOpen:a,options:i=[],selectOption:c,setDeleting:p,selected:y,selectedIDs:f,multiple:o,hasMore:v,loadMore:E,loadButton:C,loadButtonText:$,setLoadingTitle:N,loadOffset:M,loadAhead:I,expandedGroups:O,onOpen:F,onClose:W,deleting:P}){const G=t.useRef(!1),se=t.useRef(0),X=t.useRef(!1),[Y,T]=t.useState(-1);t.useEffect(()=>{X.current=!1,C&&N($)},[i.length,v,C,$,N]);const l=t.useCallback(()=>{!v||X.current||(X.current=!0,E())},[v,E]),ee=t.useCallback(S=>{if(C||!v||X.current)return;const{scrollTop:m,scrollHeight:r,clientHeight:u}=S.currentTarget(r-m<=u+M)&&l()},[C,v,M,l]);t.useEffect(()=>{!C&&n&&v&&Y>=i.length-I&&l()},[Y,n,v,i.length,I,C,l]),t.useEffect(()=>{const S=()=>{se.current=Date.now()};return window.addEventListener("focus",S),()=>window.removeEventListener("focus",S)},[]),t.useEffect(()=>{if(!n){T(-1);return}const S=i[Y],m=S&&!S.hidden&&!S.groupHeader;if(Y>=0&&Y<i.length&&m)return;let r=-1;if(y&&!o){const u=o?y[0]:y;u&&(r=i.findIndex(x=>x.id===u.id&&!x.disabled&&!x.hidden&&!x.groupHeader))}if(o&&f.length){const u=new Set(f.map(x=>x.id));r=i.findIndex(x=>u.has(x.id)&&!x.disabled&&!x.hidden&&!x.groupHeader)}r===-1&&(r=i.findIndex(u=>!u.disabled&&!u.hidden&&!u.groupHeader)),T(r)},[n,i,y]);const re=t.useCallback((S,m)=>{const r=w=>w&&!w?.groupHeader&&(!w?.group||O?.has(w?.group))&&!w?.disabled&&!w?.loading,u=i.length;if(u===0)return-1;let x=S;for(let w=0;w<u;w++){if(x=(x+m+u)%u,!C&&v&&(m>0&&x===0||m<0&&x===u-1))return S;if(r(i[x]))return x}return S},[i,v,C,O]),q=t.useCallback(S=>{const m=S.relatedTarget?.closest(".rac-options");!S.currentTarget.contains(S.relatedTarget)&&!m&&(a(!1),p(!1))},[a]),K=t.useCallback(()=>{e||P||document.hidden||Date.now()-se.current<100||n||(a(!0),G.current=!0,setTimeout(()=>G.current=!1,200))},[e,n,a,P]),le=t.useRef(n),oe=t.useRef(F),_=t.useRef(W);t.useEffect(()=>{oe.current=F,_.current=W},[F,W]),t.useEffect(()=>{le.current!==n&&(n?oe.current?.():_.current?.(),le.current=n)},[n]);const B=t.useCallback(S=>{e||P||S?.target?.closest(".rac-select-cancel")||G.current||a(!n)},[e,n,a,F,W,P]),ne=t.useCallback(S=>{if(!e)switch(S.key){case"Enter":case" ":S.preventDefault(),n?Y!==-1&&i[Y]&&c(i[Y],S):a(!0);break;case"Escape":S.preventDefault(),a(!1);break;case"ArrowDown":S.preventDefault(),n?T(m=>re(m,1)):a(!0);break;case"ArrowUp":S.preventDefault(),n?T(m=>re(m,-1)):a(!0);break;case"Tab":n&&a(!1);break}},[e,n,a,Y,i,c,re]);return t.useMemo(()=>({handleBlur:q,handleFocus:K,toggleVisibility:B,handleKeyDown:ne,highlightedIndex:Y,setHighlightedIndex:T,handleListScroll:ee}),[q,K,B,ne,Y,ee])}function vr({visibility:e,children:n,duration:a=300,className:i}){const c=t.useRef(null);return d.jsx(We.CSSTransition,{onEntering:()=>c.current.style.height=c.current.scrollHeight+"px",onExit:()=>c.current.style.height=c.current.scrollHeight+"px",onEntered:()=>c.current.style.height="auto",onExiting:()=>c.current.style.height="0px",onEnter:()=>c.current.style.height="0px",classNames:"rac-slide-down",timeout:a,nodeRef:c,in:e,unmountOnExit:!0,children:d.jsx("div",{style:{transition:`height ${a}ms ease`,overflow:"hidden"},className:`${i} rac-slide-down-enter-done`,ref:c,tabIndex:-1,children:n})})}const ze=(e,n)=>{if(!e)return null;const a=(i={})=>({...n,...i,style:{...n?.style,...i?.style}});if(typeof e=="string")return d.jsx("img",{src:e,...a(),alt:""});if(t.isValidElement(e))return t.cloneElement(e,a(e.props));if(typeof e=="function"||typeof e=="object"&&e.$$typeof){const i=e;return d.jsx(i,{...a()})}return null},Sr=(e,n,a,i,c,p,y,f)=>{const o=f?.some(v=>v.id===e.id);return e.groupHeader?"rac-select-option rac-group-option":["rac-select-option",e.className,(o||i===e.id)&&"rac-selected",n===a&&"rac-highlighted",(e.disabled||e.loading)&&"rac-disabled-option",(e.invalid||e.name===y)&&"rac-invalid-option",e.loadMore&&c===p&&"rac-loading-option",typeof e.raw=="boolean"&&(e.raw?"rac-true-option":"rac-false-option")].filter(Boolean).join(" ")},jr=t.forwardRef(({unmount:e,children:n,visibility:a,ownBehavior:i=!1,alwaysOpen:c=!1,duration:p=300,easing:y="ease-out",offset:f=1,animateOpacity:o=!0,style:v={},className:E="",ArrowIcon:C=hr,ClearIcon:$=Qe,DelIcon:N=Qe,CheckIcon:M=er,hasMore:I=!1,loadMore:O=()=>{console.warn("loadMore not implemented")},loadButton:F=!1,loadButtonText:W="Load more",loadMoreText:P="Loading",selectedText:G=void 0,loadOffset:se=100,loadAhead:X=3,childrenFirst:Y=!1,groupsClosed:T=!1,optionsClassName:l="",onOpen:ee=()=>{},onClose:re=()=>{},deleteInline:q=!1,...K},le)=>{const oe=t.useId(),_=t.useMemo(()=>oe.replace(/:/g,""),[oe]),[B,ne]=t.useState([]),[S,m]=t.useState(!1),[r,u]=t.useState(F?W:P),[x,w]=t.useState(!1),de=t.useRef(null),[ye,s]=t.useState(!1),b=t.useCallback(A=>{ne(Z=>{const ue=Z.findIndex(ve=>ve.id===A.id);if(ue!==-1){const ve=Z[ue];if(ve.label===A.label&&ve.value===A.value&&ve.disabled===A.disabled&&ve.group===A.group)return Z;const Ie=[...Z];return Ie[ue]=A,Ie}return[...Z,A]})},[]),j=t.useCallback(A=>{ne(Z=>{const ue=Z.filter(ve=>ve.id!==A);return ue.length===Z.length?Z:ue})},[]),h=c?!0:i?!!a:S,L=t.useCallback(A=>{c||i||m(A)},[c,i]),D=Er({...K,setVisibility:L,jsxOptions:B,hasMore:I,loadButton:F,loadingTitle:r,loadMore:O,loadMoreText:P,setLoadingTitle:u,childrenFirst:Y,groupsClosed:T}),{multiple:ce,normalizedOptions:V,selected:U,selectOption:ae,clear:g,removeOption:z,hasOptions:Q,active:fe,selectedValue:R,disabled:he,loading:ge,error:me,placeholder:Re,invalidOption:ie,emptyText:Ne,disabledText:Te,loadingText:_e,errorText:H,expandedGroups:J,selectedIDs:te,setSelectedIds:Ae}=D,pe=wr({setDeleting:s,setLoadingTitle:u,loadButton:F,loadButtonText:W,hasMore:I,loadMore:O,disabled:he,multiple:ce,open:h,setOpen:L,options:V,selectOption:ae,selected:U,loadOffset:se,loadAhead:X,expandedGroups:J,selectedIDs:te,onOpen:ee,onClose:re,deleting:ye}),{handleListScroll:Ee,handleBlur:we,handleFocus:be,toggleVisibility:Ye,handleKeyDown:Oe,highlightedIndex:xe,setHighlightedIndex:Se}=pe;t.useImperativeHandle(le,()=>de.current),t.useEffect(()=>{!h&&w(!1)},[h]),t.useEffect(()=>{(me||he||ge||!Q)&&L(!1)},[me,he,ge,Q,L]),t.useEffect(()=>{if(h&&x&&xe!==-1){const A=V[xe];A&&document.getElementById(`${_}-${Je(A.id)}`)?.scrollIntoView({block:"nearest"})}},[xe,h,x,V,_]);const je=t.useMemo(()=>R!=null&&!(Array.isArray(R)&&R.length===0)&&!(typeof R=="object"&&Object.keys(R).length===0),[R]),$e=t.useMemo(()=>{if(me)return H;if(ge)return _e;if(he)return Te;if(je&&G)return G;if(U)return U.jsx??U.name;if(je){const A=V.find(Z=>Z.raw===R);return A?A.name:typeof R=="object"&&R!==null?R.name??R.label??"Selected Object":String(R)}return Q?Re:Ne},[he,ge,me,Q,U,R,Re,H,_e,Te,Ne,je,V]),Le=t.useMemo(()=>{const A=[];let Z=[],ue=null;const ve=V.reduce((k,ke)=>(ke.group&&(k[ke.group]=(k[ke.group]||0)+1),k),{}),Ie=k=>{k===null||Z.length===0||(A.push(d.jsx(vr,{visibility:J.has(k),className:"rac-group-container",children:Z},`slide-${k}`)),Z=[])},Ve=(k,ke)=>d.jsxs("div",{className:Sr(k,ke,xe,U?.id,r,P,ie,te),onMouseEnter:()=>!k.disabled&&!k.loading&&Se(ke),onClick:Ce=>!k.loading&&ae(k,Ce),"aria-disabled":k.disabled||k.loading,"aria-selected":U?.id===k.id,id:`${_}-${Je(k.id)}`,role:"option",children:[k.jsx??d.jsx("span",{className:"rac-option-title",children:k.name}),k.loading&&d.jsxs("span",{className:"rac-loading-dots",children:[d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{})]}),ce&&!k.disabled&&d.jsx("div",{className:"rac-checkbox",children:ze(er,{className:`
15
- rac-checkmark
16
- ${te?.some(Ce=>Ce.id===k.id)?"--checked":""}`})})]},k.id);return V.forEach((k,ke)=>{const Ce=k.groupHeader,Xe=!!k.group;if((Ce||!Xe&&ue!==null)&&(Ie(ue),Ce||(ue=null)),Ce){ue=k.name;const or=J.has(k.name),ar=ve[k.name]>0;A.push(d.jsxs("div",{id:k.id,className:["rac-group-header",k.disabled&&"rac-disabled-group"].filter(Boolean).join(" "),onClick:lr=>ae(k,lr),children:[d.jsx("span",{className:"rac-group-title-text",children:k.name}),d.jsx(Pe,{visibility:ar&&!k.disabled,style:{display:"grid"},duration:p,children:d.jsx("span",{className:`rac-group-arrow-wrapper ${or?"open":""}`,children:ze(C,{className:"rac-select-arrow-wrapper"})})})]},k.id))}else Xe?Z.push(Ve(k,ke)):A.push(Ve(k,ke))}),Ie(ue),A},[V,ae,_,U,xe,r,P,ie,Se,J,C]);return d.jsx(xr,{setDeleting:s,deleting:ye,selectedText:G,selectRef:de,selectId:_,selectedIDs:te,setSelectedIds:Ae,multiple:ce,removeOption:z,optionsClassName:l,renderIcon:ze,normalizedOptions:V,renderOptions:Le,selected:U,title:$e,visibility:h,active:fe,hasOptions:Q,hasActualValue:je,highlightedIndex:xe,animationFinished:x,disabled:he,loading:ge,error:me,setVisibility:L,setHighlightedIndex:Se,setAnimationFinished:w,handleBlur:we,handleFocus:be,toggleVisibility:Ye,handleKeyDown:Oe,handleListScroll:Ee,selectOption:ae,clear:g,registerOption:b,unregisterOption:j,children:n,placeholder:Re,className:E,style:v,duration:p,easing:y,offset:f,animateOpacity:o,unmount:e,ArrowIcon:C,ClearIcon:$,DelIcon:N,hasMore:I,loadButton:F,deleteInline:q})}),ir=t.createContext(null);function kr({children:e,name:n,label:a,value:i,id:c,emptyGroupText:p="Empty group"}){const y=t.useContext(qe),f=t.useMemo(()=>{const v=n??a??i??c;return v!=null&&v!==""?String(v):p},[n,a,i,c,p]),o=t.useMemo(()=>`group-marker-${Je(f)}`,[f]);return t.useEffect(()=>{if(!y)return;const v={id:o,group:f,isGroupMarker:!0,disabled:!0};return y.registerOption(v),()=>y.unregisterOption(o)},[y.registerOption,y.unregisterOption,o,f]),d.jsx(ir.Provider,{value:f,children:e})}const Ue=e=>e?typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(Ue).join(" ").replace(/\s+/g," ").trim():t.isValidElement(e)?Ue(e.props.children):"":"";function Rr({value:e,id:n,className:a,children:i,disabled:c,group:p}){const y=t.useContext(qe),f=t.useContext(ir),o=y?.registerOption,v=y?.unregisterOption,E=t.useId(),C=t.useMemo(()=>n?String(n):E.replace(/:/g,""),[n,E]);return t.useEffect(()=>{if(!o)return;const $=Ue(i),N=i!=null;let M="";return $?M=$:n!=null&&n!==""?M=String(n):e!=null&&e!==""&&(M=String(e)),o({id:C,value:e!==void 0?e:$,label:M,jsx:i,hasJsx:N,className:a,disabled:!!c,group:p||f||null}),()=>v(C)},[C,e,i,a,c,p,f,o,v]),null}exports.OptGroup=kr;exports.Option=Rr;exports.Select=jr;
12
+ `,...d&&{onKeyDown:u,onFocus:G,onClick:Ye,onBlur:Q},"aria-disabled":O||!R,"aria-controls":`${c}-listbox`,tabIndex:d?0:-1,"aria-expanded":k,"aria-label":fe,"aria-haspopup":"listbox",role:"combobox",children:[h.jsx("div",{className:`rac-select-title-wrapper
13
+ ${!I&&!L&&b?.type==="boolean"?b.raw?"rac-true-option":"rac-false-option":""}
14
+ `,style:{alignItems:g?.length&&!C?"flex-start":"center",height:oe?`${oe}px`:"auto"},children:h.jsx("div",{style:{alignItems:g?.length&&!C?"flex-start":"center",height:L?"100%":"auto"},className:"rac-select-title",ref:Se,children:h.jsx(Me.TransitionGroup,{enter:!$e.current,component:null,appear:!1,children:g?.length&&!C&&!L?Ue:h.jsxs(st,{className:"rac-title-container",duration:P,widthMode:!0,children:[h.jsx("span",{className:"rac-title-text",children:v}),h.jsx(Ae,{className:"rac-loading-container",visibility:L&&!I,duration:P,children:h.jsxs("span",{className:"rac-loading-dots",children:[h.jsx("i",{}),h.jsx("i",{}),h.jsx("i",{})]})})]},v)})})}),h.jsx(Ae,{visibility:Ce||Te,className:"rac-select-buttons",children:h.jsxs(Me.TransitionGroup,{component:null,children:[Ce&&h.jsx(Ae,{style:{display:"grid"},duration:P,children:ce(m,{className:"rac-select-cancel",onMouseDown:J=>{J.preventDefault(),J.stopPropagation()},onClick:F})},"clear-icon")," ",Te&&h.jsx(Ae,{style:{display:"grid"},duration:P,children:ce(o,{className:`rac-select-arrow ${k?"--open":""} ${Y?"":"--up"}`})},"open-button")]})}),h.jsx(bt,{style:{"--rac-duration":`${P}ms`,...re},visibility:k&&i.length,onAnimationDone:()=>le(!0),setBottomDirection:ue,animateOpacity:W,className:_,selectRef:n,duration:P,unmount:r,easing:ie,offset:E,children:h.jsxs("div",{onScroll:D,className:"rac-select-list","aria-label":"Options",role:"listbox",tabIndex:"-1",children:[x,!y&&a&&h.jsxs("div",{className:"rac-select-option rac-disabled-option rac-loading-option",style:{justifyContent:"initial",alignItems:"end",gap:0},onClick:J=>J.stopPropagation(),children:[h.jsx("span",{className:"rac-loading-option-title",children:"Loading"}),h.jsx("div",{className:"rac-loading-container",children:h.jsxs("span",{style:{paddingBottom:"0.1em"},className:"rac-loading-dots",children:[h.jsx("i",{}),h.jsx("i",{}),h.jsx("i",{})]})})]})]})})]})]})}),Et=["group","disabled","options","items","children"],Je=["name","label","id","value"],nt=[],Fe=(e,n=!1)=>{if(n&&typeof e.group=="string")return e.group;const s=Je.find(l=>e[l]!=null&&e[l]!=="");if(s)return String(e[s]);const c=Object.entries(e).find(([l,x])=>!Et.includes(l)&&x!=null&&x!=="");return c?String(c[1]):null};function wt({options:e=nt,jsxOptions:n=nt,value:s,onChange:c,disabled:l=!1,loading:x=!1,error:b=!1,multiple:g=!1,placeholder:j="Choose option",emptyText:i="No options",disabledText:v="Disabled",loadingText:k="Loading",errorText:d="Failed to load",disabledOption:R="Disabled option",emptyOption:N="Empty option",invalidOption:_="Invalid option",setVisibility:C,hasMore:O,loadButton:L,setLoadingTitle:I,loadingTitle:H,loadMoreText:Z,loadMore:Q,childrenFirst:G=!1,groupsClosed:U=!1}){const u=s!==void 0,[D,le]=t.useState(()=>{const a=new Set;if(U)return a;const y=p=>{Array.isArray(p)&&p.forEach($=>{if($&&typeof $=="object"){if(("options"in $||"group"in $&&!Je.some(Y=>Y in $))&&!$.disabled){const Y=Fe($,!0)||"Empty group";a.add(Y)}$.options&&y($.options)}})};return y(e),a}),F=t.useRef(null),q=t.useCallback(a=>{le(y=>{const p=new Set(y);return p.has(a)?p.delete(a):p.add(a),p})},[]),fe=t.useCallback((a,y,p="n",$=null,T=!1)=>{const Y=`${p}-${y}`;if(a==null||a===""||a===void 0)return{name:N,disabled:!0,type:"normal",groupDisabled:T,userId:null,raw:a,group:$,id:Y};if(typeof a=="function")return{id:Y,userId:null,name:_,raw:a,disabled:!0,invalid:!0,type:"normal",group:$};if(typeof a=="object"&&!Array.isArray(a)){const ue=$||a.group||null,oe=T||a.disabled===!0,xe=a.id??a.value??a.name??a.label,ee=a.value!==void 0?a.value:a.id!==void 0?a.id:a;let f=Fe(a)||(oe?R:N);return{id:Y,userId:xe,name:f,raw:ee,original:a,disabled:oe||f===N&&!oe,type:typeof ee=="boolean"?"boolean":"normal",group:ue,groupDisabled:T}}return{id:Y,userId:a,name:String(a),raw:a,original:a,disabled:T,type:typeof a=="boolean"?"boolean":"normal",group:$}},[N,_,R]),V=t.useMemo(()=>{const a=new Map,y=[],p=n.map((f,A)=>{if(f.isGroupMarker)return{...f,type:"group-marker"};const ne=!f.label&&!f.userId&&!f.value&&(f.value===void 0||f.value===null||f.value==="")&&!f.hasJsx;return{...f,id:`jsx-${f.id}`,index:A,userId:f.userId,raw:f.value,original:f.value,name:ne?N:f.label||f.userId||String(f.value||""),disabled:!!f.disabled||ne,type:typeof f.value=="boolean"?"boolean":"normal",group:f.group||null}});let $=0;const T=(f,A=null,ne=!1,he="0")=>{Array.isArray(f)||(f=[f]),f.forEach((z,ke)=>{const X=`${he}-${ke}`,be=z!=null&&typeof z=="object"&&!Array.isArray(z);if(be&&("options"in z||"group"in z&&!Je.some(te=>te in z))){const te=Fe(z,!0)||"Empty group";a.has(te)||a.set(te,{disabled:!!z.disabled,closedByDefault:!!z.disabled||U,items:[]}),z.options?T(z.options,te,ne||!!z.disabled,X):y.push({id:`empty-${te}-${X}`,name:te,group:te,isPlaceholder:!0,type:"group-marker",index:$++})}else if(be&&!Je.some(te=>te in z)&&!z.group)Object.entries(z).forEach(([te,Re],$e)=>{const Se=fe(Re,`${X}-${$e}`,"default",A,ne);y.push({...Se,index:$++})});else{const te=fe(z,X,"default",A,ne);y.push({...te,index:$++})}})};T(e);const Y=G?[...p,...y]:[...y,...p];if(!F.current)F.current=new Map(Y.map((f,A)=>[f.id,A]));else{let f=!1;if(Y.forEach(A=>{F.current.has(A.id)||(f=!0)}),f){const A=new Map;Y.forEach((ne,he)=>{A.set(ne.id,he)}),F.current=A}}const ue=[...Y].sort((f,A)=>{const ne=F.current.get(f.id)??999999,he=F.current.get(A.id)??999999;return ne-he}),oe=[],xe=new Set;ue.forEach(f=>{if(!f.group)oe.push({type:"item",data:f});else{xe.has(f.group)||(xe.add(f.group),oe.push({type:"group",name:f.group}));const A=a.get(f.group)||{items:[]};a.has(f.group)||a.set(f.group,A),f.isGroupMarker?(A.className=f.className,A.style=f.style,f.disabled&&(A.disabled=!0)):f.isPlaceholder||A.items.push(f)}});const ee=[];return oe.forEach(f=>{if(f.type==="item")ee.push(f.data);else{const A=f.name,ne=a.get(A),he=D.has(A);ee.push({className:ne?.className||"",id:`group-header-${A}`,disabled:!!ne?.disabled,style:ne?.style||{},groupHeader:!0,name:A,type:"group",hidden:!1,expanded:he}),ne?.items.forEach(z=>{const ke=D.size>0?!he:!!U;ee.push({...z,hidden:ke})})}}),O&&L&&ee.push({id:"special-load-more-id",name:H,loadMore:!0,loading:H===Z,type:"special"}),ee},[e,n,fe,G,O,L,H,Z,U,D,N]),re=t.useCallback(()=>{if(s==null||Array.isArray(s)&&s.length===0)return{initialId:null,initialIDs:[]};const a=new Set,y=(p,$)=>{let T=V.find(ue=>ue.original===p&&!a.has(ue.id));if(!T&&typeof p=="object")try{const ue=JSON.stringify(p);T=V.find(oe=>oe.original&&typeof oe.original=="object"&&JSON.stringify(oe.original)===ue&&!a.has(oe.id))}catch{}if(T)return a.add(T.id),T;const Y=typeof p=="object"?p.id||p.value||JSON.stringify(p):String(p);return typeof p=="object"&&p!==null?{id:`virtual-${Y}-${$}`,name:Fe(p)||String(p.id||"Selected Object"),raw:p.value??p.id??p,original:p,userId:p.id??p.value??null,virtual:!0}:{id:`virtual-${Y}-${$}`,name:String(p),raw:p,original:p,userId:p,virtual:!0}};if(g)return{initialId:null,initialIDs:(Array.isArray(s)?s:[s]).map((T,Y)=>y(T,Y))};{const p=Array.isArray(s)?s[0]:s;return{initialId:y(p,0).id,initialIDs:[]}}},[u,s,V,g]),[P,ie]=t.useState(()=>re().initialId),[E,W]=t.useState(()=>re().initialIDs),r=t.useMemo(()=>{const a=V.find(y=>y.id===P);if(a)return a;if(!g&&P?.startsWith("virtual-")){const y=Array.isArray(s)?s[0]:s;if(y)return{id:P,name:typeof y=="object"?Fe(y):String(y),original:y}}return null},[P,V,g,u,s]),o=t.useCallback((a,y)=>{if(a.groupHeader){m(y),a.disabled||q(a.name);return}if(a.disabled||a.loadMore){m(y),a.loadMore&&!a.loading&&(I(Z),Q());return}if(g){if(a.disabled||a.groupHeader||a.loadMore){m(y);return}m(y);const $=E?.some(T=>T.id===a.id)?E.filter(T=>T.id!==a.id):[...E,a];W($),c?.($.map(T=>T.original),$.map(T=>T.userId));return}ie(a.id),c?.(a.original,a.userId),C(!1)},[c,C,Q,Z,I,q,g,E]),m=t.useCallback(a=>{a?.stopPropagation(),a?.preventDefault()},[]),S=t.useCallback(()=>{c?.(null,null),ie(null),W([])},[c]),ce=t.useCallback(a=>{const y=E.filter(p=>p.id!==a);W(y),c?.(y.map(p=>p.original),y.map(p=>p.userId))},[E,c]);return{normalizedOptions:V,selected:r,selectOption:o,clear:S,removeOption:ce,hasOptions:V.length>0,active:!b&&!x&&!l&&V.length>0,selectedValue:s,placeholder:j,emptyText:i,disabledText:v,loadingText:k,errorText:d,disabledOption:R,emptyOption:N,invalidOption:_,disabled:l,loading:x,error:b,expandedGroups:D,toggleGroup:q,selectedIDs:E,multiple:g,setSelectedIds:W}}function vt({disabled:e,open:n,setOpen:s,options:c=[],selectOption:l,setDeleting:x,selected:b,selectedIDs:g,multiple:j,hasMore:i,loadMore:v,loadButton:k,loadButtonText:d,setLoadingTitle:R,loadOffset:N,loadAhead:_,expandedGroups:C,onOpen:O,onClose:L,deleting:I}){const H=t.useRef(!1),Z=t.useRef(0),Q=t.useRef(!1),[G,U]=t.useState(-1);t.useEffect(()=>{Q.current=!1,k&&R(d)},[c.length,i,k,d,R]);const u=t.useCallback(()=>{!i||Q.current||(Q.current=!0,v())},[i,v]),D=t.useCallback(E=>{if(k||!i||Q.current)return;const{scrollTop:W,scrollHeight:r,clientHeight:o}=E.currentTarget(r-W<=o+N)&&u()},[k,i,N,u]);t.useEffect(()=>{!k&&n&&i&&G>=c.length-_&&u()},[G,n,i,c.length,_,k,u]),t.useEffect(()=>{const E=()=>{Z.current=Date.now()};return window.addEventListener("focus",E),()=>window.removeEventListener("focus",E)},[]),t.useEffect(()=>{if(!n){U(-1);return}const E=c[G],W=E&&!E.hidden&&!E.groupHeader;if(G>=0&&G<c.length&&W)return;let r=-1;if(b&&!j){const o=j?b[0]:b;o&&(r=c.findIndex(m=>m.id===o.id&&!m.disabled&&!m.hidden&&!m.groupHeader))}if(j&&g.length){const o=new Set(g.map(m=>m.id));r=c.findIndex(m=>o.has(m.id)&&!m.disabled&&!m.hidden&&!m.groupHeader)}r===-1&&(r=c.findIndex(o=>!o.disabled&&!o.hidden&&!o.groupHeader)),U(r)},[n,c,b]);const le=t.useCallback((E,W)=>{const r=S=>S&&!S?.groupHeader&&(!S?.group||C?.has(S?.group))&&!S?.disabled&&!S?.loading,o=c.length;if(o===0)return-1;let m=E;for(let S=0;S<o;S++){if(m=(m+W+o)%o,!k&&i&&(W>0&&m===0||W<0&&m===o-1))return E;if(r(c[m]))return m}return E},[c,i,k,C]),F=t.useCallback(E=>{const W=E.relatedTarget?.closest(".rac-options");!E.currentTarget.contains(E.relatedTarget)&&!W&&(s(!1),x(!1))},[s]),q=t.useCallback(()=>{e||I||document.hidden||Date.now()-Z.current<100||n||(s(!0),H.current=!0,setTimeout(()=>H.current=!1,200))},[e,n,s,I]),fe=t.useRef(n),V=t.useRef(O),re=t.useRef(L);t.useEffect(()=>{V.current=O,re.current=L},[O,L]),t.useEffect(()=>{fe.current!==n&&(n?V.current?.():re.current?.(),fe.current=n)},[n]);const P=t.useCallback(E=>{e||I||E?.target?.closest(".rac-select-cancel")||H.current||s(!n)},[e,n,s,O,L,I]),ie=t.useCallback(E=>{if(!e)switch(E.key){case"Enter":case" ":E.preventDefault(),n?G!==-1&&c[G]&&l(c[G],E):s(!0);break;case"Escape":E.preventDefault(),s(!1);break;case"ArrowDown":E.preventDefault(),n?U(W=>le(W,1)):s(!0);break;case"ArrowUp":E.preventDefault(),n?U(W=>le(W,-1)):s(!0);break;case"Tab":n&&s(!1);break}},[e,n,s,G,c,l,le]);return t.useMemo(()=>({handleBlur:F,handleFocus:q,toggleVisibility:P,handleKeyDown:ie,highlightedIndex:G,setHighlightedIndex:U,handleListScroll:D}),[F,q,P,ie,G,D])}function St({visibility:e,children:n,duration:s=300,className:c}){const l=t.useRef(null),x=t.useCallback(()=>{if(!l.current)return{top:"0px",bottom:"0px"};const b=window.getComputedStyle(l.current);return{top:b.marginTop,bottom:b.marginBottom}},[]);return h.jsx(Me.CSSTransition,{onEnter:()=>{l.current.style.height="0px",l.current.style.marginTop="0px",l.current.style.marginBottom="0px"},onEntering:()=>{const{top:b,bottom:g}=x();l.current.style.height=l.current.scrollHeight+"px",l.current.style.marginBottom=g,l.current.style.marginTop=b},onEntered:()=>l.current.style.height="auto",onExit:()=>{const{top:b,bottom:g}=x();l.current.style.height=l.current.scrollHeight+"px",l.current.style.marginBottom=g,l.current.style.marginTop=b,l.current.offsetHeight},onExiting:()=>{l.current.style.height="0px",l.current.style.marginTop="0px",l.current.style.marginBottom="0px"},classNames:"rac-slide-down",timeout:s,nodeRef:l,in:e,unmountOnExit:!0,children:h.jsx("div",{style:{transition:`height ${s}ms ease, margin ${s}ms ease`,overflow:"hidden"},className:`${c} rac-slide-down-enter-done`,ref:l,tabIndex:-1,children:n})})}const Be=(e,n="invalid-option",s="")=>{const c=s?s.replace(/:/g,""):"";if(typeof e!="string"||!e.trim())return c?`${n}-${c}`:`${n}-${Math.random().toString(36).slice(2,8)}`;const l=e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"-").replace(/[^\p{L}\p{N}-]+/gu,"").toLowerCase();return l?l||`${n}-${Math.random().toString(36).slice(2,8)}`:c?`${n}-${c}`:`${n}-${Math.random().toString(36).slice(2,8)}`},ze=(e,n)=>{if(!e)return null;const s=(c={})=>({...n,...c,style:{...n?.style,...c?.style}});if(typeof e=="string")return h.jsx("img",{src:e,...s(),alt:""});if(t.isValidElement(e))return t.cloneElement(e,s(e.props));if(typeof e=="function"||typeof e=="object"&&e.$$typeof){const c=e;return h.jsx(c,{...s()})}return null},jt=(e,n,s,c,l,x,b,g)=>{const j=g?.some(i=>i.id===e.id);return e.groupHeader?"rac-select-option rac-group-option":["rac-select-option",e.className,(j||c===e.id)&&"rac-selected",n===s&&"rac-highlighted",(e.disabled||e.loading)&&"rac-disabled-option",(e.invalid||e.name===b)&&"rac-invalid-option",e.loadMore&&l===x&&"rac-loading-option",typeof e.raw=="boolean"&&(e.raw?"rac-true-option":"rac-false-option")].filter(Boolean).join(" ")},kt=t.forwardRef(({unmount:e,children:n,visibility:s,setVisibility:c=()=>{},ownBehavior:l=!1,duration:x=300,easing:b="ease-in",offset:g=1,animateOpacity:j=!0,style:i={},className:v="",OpenIcon:k=gt,ClearIcon:d=et,DelIcon:R=et,Checkmark:N=pt,Checkbox:_=void 0,hasMore:C=!1,loadMore:O=()=>console.warn("loadMore not implemented"),loadButton:L=!1,loadButtonText:I="Load more",loadMoreText:H="Loading",selectedText:Z=void 0,loadOffset:Q=100,loadAhead:G=3,optionsClassName:U="",onOpen:u=()=>{},onClose:D=()=>{},deleteInline:le=!1,showDelete:F=!1,...q},fe)=>{const V=t.useId(),re=t.useMemo(()=>V.replace(/:/g,""),[V]),[P,ie]=t.useState([]),[E,W]=t.useState(!1),[r,o]=t.useState(L?I:H),[m,S]=t.useState(!1),ce=t.useRef(null),[a,y]=t.useState(!1),p=t.useCallback(M=>{ie(K=>{const se=K.findIndex(pe=>pe.id===M.id);if(se!==-1){const pe=K[se];if(pe.label===M.label&&pe.value===M.value&&pe.disabled===M.disabled&&pe.group===M.group)return K;const me=[...K];return me[se]=M,me}return[...K,M]})},[]),$=t.useCallback(M=>{ie(K=>{const se=K.filter(pe=>pe.id!==M);return se.length===K.length?K:se})},[]),T=s!==void 0,Y=t.useMemo(()=>l||T?!!s:E,[l,T,s,E]),ue=t.useCallback(M=>{l||(!T&&W(M),c?.(M))},[l,T,c]),oe=wt({...q,setVisibility:ue,jsxOptions:P,hasMore:C,loadButton:L,loadingTitle:r,loadMore:O,loadMoreText:H,setLoadingTitle:o}),{multiple:xe,normalizedOptions:ee,selected:f,selectOption:A,clear:ne,removeOption:he,hasOptions:z,active:ke,selectedValue:X,disabled:be,loading:ve,error:te,placeholder:Re,invalidOption:$e,emptyText:Se,disabledText:We,loadingText:Ye,errorText:Ge,expandedGroups:Ce,selectedIDs:Te,setSelectedIds:Ue}=oe,J=vt({setDeleting:y,setLoadingTitle:o,loadButton:L,loadButtonText:I,hasMore:C,loadMore:O,disabled:be,multiple:xe,open:Y,setOpen:ue,options:ee,selectOption:A,selected:f,loadOffset:Q,loadAhead:G,expandedGroups:Ce,selectedIDs:Te,onOpen:u,onClose:D,deleting:a}),{handleListScroll:B,handleBlur:ae,handleFocus:Oe,toggleVisibility:ye,handleKeyDown:Ee,highlightedIndex:de,setHighlightedIndex:ge}=J;t.useImperativeHandle(fe,()=>ce.current),t.useEffect(()=>{if(!Y){S(!1);return}Y&&ce.current&&document.activeElement!==ce.current&&ce.current.focus()},[Y]),t.useEffect(()=>{(te||be||ve||!z)&&ue(!1)},[te,be,ve,z,ue]),t.useEffect(()=>{T&&W(!!s)},[s,T]),t.useEffect(()=>{if(Y&&m&&de!==-1){const M=ee[de];M&&document.getElementById(`${re}-${Be(M.id)}`)?.scrollIntoView({block:"nearest"})}},[de,Y,m,ee,re]);const Ne=t.useMemo(()=>X!=null&&!(Array.isArray(X)&&X.length===0)&&!(typeof X=="object"&&Object.keys(X).length===0),[X]),Le=t.useMemo(()=>{if(te)return Ge;if(ve)return Ye;if(be)return We;if(Ne&&Z)return Z;if(f)return f.jsx??f.name;if(Ne){const M=ee.find(K=>K.raw===X);return M?M.name:typeof X=="object"&&X!==null?X.name??X.label??"Selected Object":String(X)}return z?Re:Se},[be,ve,te,z,f,X,Re,Ge,Ye,We,Se,Ne,ee]),Pe=t.useMemo(()=>{const M=[];let K=[],se=null;const pe=ee.reduce((w,we)=>(we.group&&(w[we.group]=(w[we.group]||0)+1),w),{}),me=w=>{w===null||K.length===0||(M.push(h.jsx(St,{visibility:Ce.has(w),className:"rac-group-container",children:K},`slide-${w}`)),K=[])},je=(w,we)=>h.jsxs("div",{className:jt(w,we,de,f?.id,r,H,$e,Te),style:{...w.style,...w.loading?{justifyContent:"initial",alignItems:"end",gap:0}:{}},onMouseEnter:()=>!w.disabled&&!w.loading&&ge(we),onClick:_e=>!w.loading&&A(w,_e),"aria-disabled":w.disabled||w.loading,"aria-selected":f?.id===w.id,id:`${re}-${Be(w.id)}`,role:"option",children:[w.jsx?h.jsx("div",{className:"rac-jsx-option",children:w.jsx}):h.jsx("span",{className:"rac-option-title",children:w.name}),w.loading&&h.jsxs("span",{style:{paddingBottom:"0.1em"},className:"rac-loading-dots",children:[h.jsx("i",{}),h.jsx("i",{}),h.jsx("i",{})]}),xe&&!w.disabled&&h.jsxs("div",{className:`rac-checkbox${_?"":"-default"}`,children:[ze(N,{style:{position:_?"":"relative"},className:`
15
+ rac-checkmark
16
+ ${Te?.some(_e=>_e.id===w.id)?"--checked":""}`}),ze(_,{className:"rac-check-box"})]})]},w.id);return ee.forEach((w,we)=>{const _e=w.groupHeader,Xe=!!w.group;if((_e||!Xe&&se!==null)&&(me(se),_e||(se=null)),_e){se=w.name;const ot=Ce.has(w.name),at=pe[w.name]>0;M.push(h.jsxs("div",{className:["rac-group-header",w.disabled&&"rac-disabled-group",w.className].filter(Boolean).join(" "),onClick:lt=>A(w,lt),style:w.style,id:w.id,children:[h.jsx("span",{className:"rac-group-title-text",children:w.name}),h.jsx(Ae,{visibility:at&&!w.disabled,style:{display:"grid"},duration:x,children:ze(k,{className:`rac-group-arrow ${ot?"--open":""}`})})]},w.id))}else Xe?K.push(je(w,we)):M.push(je(w,we))}),me(se),M},[ee,A,re,f,de,r,H,$e,ge,Ce,k]);return h.jsx(xt,{setDeleting:y,deleting:a,selectedText:Z,selectRef:ce,selectId:re,selectedIDs:Te,setSelectedIds:Ue,multiple:xe,removeOption:he,optionsClassName:U,renderIcon:ze,normalizedOptions:ee,renderOptions:Pe,selected:f,title:Le,visibility:Y,active:ke,hasOptions:z,hasActualValue:Ne,highlightedIndex:de,animationFinished:m,disabled:be,loading:ve,error:te,setVisibility:ue,setHighlightedIndex:ge,setAnimationFinished:S,handleBlur:ae,handleFocus:Oe,toggleVisibility:ye,handleKeyDown:Ee,handleListScroll:B,selectOption:A,clear:ne,registerOption:p,unregisterOption:$,children:n,placeholder:Re,className:v,style:i,duration:x,easing:b,offset:g,animateOpacity:j,unmount:e,OpenIcon:k,ClearIcon:d,DelIcon:R,hasMore:C,loadButton:L,deleteInline:le,showDelete:F})}),it=t.createContext(null);function Rt({children:e,name:n,label:s,value:c,id:l,disabled:x,emptyGroupText:b="Empty group",className:g="",style:j={}}){const i=t.useContext(Ve),v=t.useMemo(()=>{const d=n??s??l??c;return d!=null&&d!==""?String(d):b},[n,s,c,l,b]),k=t.useMemo(()=>`group-marker-${Be(v)}`,[v]);return t.useEffect(()=>{if(!i)return;const d={disabled:!!x,isGroupMarker:!0,group:v,id:k,className:g,style:j};return i.registerOption(d),()=>i.unregisterOption(k)},[i.registerOption,i.unregisterOption,k,v]),h.jsx(it.Provider,{value:v,children:e})}const qe=e=>e?typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(qe).join(" ").replace(/\s+/g," ").trim():t.isValidElement(e)?qe(e.props.children):"":"";function $t({name:e,label:n,id:s,value:c,className:l,style:x,children:b,disabled:g,group:j}){const i=t.useContext(Ve),v=t.useContext(it),k=i?.registerOption,d=i?.unregisterOption,R=t.useId(),N=t.useMemo(()=>s?String(s):R.replace(/:/g,""),[s,R]);return t.useEffect(()=>{if(!k)return;const _=qe(b),C=b!=null;let O="";return n!=null&&n!==""?O=String(n):e!=null&&e!==""?O=String(e):_?O=_:s!=null&&s!==""&&(O=String(s)),k({id:N,value:c!==void 0?c:_,label:O,jsx:b,hasJsx:C,className:l,style:x,disabled:!!g,group:j||v||null}),()=>d(N)},[N,e,n,c,b,l,x,g,j,v,k,d]),null}exports.OptGroup=Rt;exports.Option=$t;exports.Select=kt;
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- @media(prefers-reduced-motion:reduce){.rac-select{--rac-duration: 1ms}}:root{--rac-base-red: #e7000b;--rac-base-green: #4caf50;--rac-base-yellow: #ffc107;--rac-select-background: color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-select-hover: color-mix(in srgb, Canvas 95%, CanvasText 5%);--rac-select-color: CanvasText;--rac-select-border: 2px solid color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-select-border-error: 2px solid color-mix(in srgb, var(--rac-base-red), CanvasText 15%);--rac-select-padding: 0em .5em;--rac-select-min-height: 2em;--rac-disabled-opacity: .75;--rac-title-anim-shift: 4px;--rac-title-anim-entry-ease: cubic-bezier(.34, 1.56, .64, 1);--rac-title-font-size: 1em;--rac-dots-color: currentColor;--rac-dots-gap: 3px;--rac-dots-padding-left: .25em;--rac-dots-align: end;--rac-dots-animation-duration: 1.4s;--rac-dots-animation-delay-1: 0s;--rac-dots-animation-delay-2: .2s;--rac-dots-animation-delay-3: .4s;--rac-arrow-height: 1em;--rac-arrow-width: 1em;--rac-arrow-padding: 1px 0 2px;--rac-cancel-height: .9em;--rac-cancel-width: .9em;--rac-scroll-color: color-mix(in srgb, CanvasText 10%, Canvas);--rac-scroll-track: color-mix(in srgb, CanvasText 5%, Canvas);--rac-scroll-padding-top: .5em;--rac-scroll-padding-bottom: .5em;--rac-option-hover: color-mix(in srgb, CanvasText 6%, Canvas);--rac-option-highlight: color-mix(in srgb, CanvasText 10%, Canvas);--rac-option-selected: color-mix(in srgb, CanvasText 14%, Canvas);--rac-list-background: color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-list-color: CanvasText;--rac-list-max-height: 250px;--rac-option-padding: .5em;--rac-option-min-height: 1em;--rac-option-gap: .5em;--rac-disabled-option-color: color-mix(in srgb, GrayText, CanvasText 20%);--rac-invalid-option-color: color-mix(in srgb, var(--rac-base-red), CanvasText 10%);--rac-true-option-color: color-mix(in srgb, var(--rac-base-green), CanvasText 10%);--rac-false-option-color: color-mix(in srgb, var(--rac-base-red), CanvasText 10%);--rac-warning-option-color: color-mix(in srgb, var(--rac-base-yellow), CanvasText 10%);--rac-group-header-font-size: 1.25em;--rac-group-header-font-weight: bold;--rac-group-header-min-height: 1em;--rac-group-header-padding: .5em;--rac-group-arrow-height: 1em;--rac-group-arrow-width: 1em;--rac-group-arrow-padding: 1px 0 2px;--rac-group-container-padding-left: 1em;--rac-disabled-group-color: color-mix(in srgb, GrayText, CanvasText 20%);--rac-multiple-selected-border: .1em solid gray;--rac-multiple-selected-radius: 5px;--rac-checkbox-border: 1px solid gray;--rac-multiple-selected-padding: 0em .25em;--rac-multiple-selected-margin: .25em .5em .25em 0;--rac-multiple-selected-gap: .5em 0;--rac-multiple-deleting-bg: color-mix(in srgb, var(--rac-base-red) 15%, Canvas);--rac-checkbox-margin-right: .2em;--rac-multiple-selected-min-height: 1.5em;--rac-checkbox-size: var(--rac-option-min-height);--rac-multiple-del-bg: color-mix(in srgb, var(--rac-base-red) 30%, Canvas);--rac-multiple-del-hover-color: var(--rac-base-red)}.rac-select{background:var(--rac-select-background);padding:var(--rac-select-padding);border:var(--rac-select-border);color:var(--rac-select-color);min-height:var(--rac-select-min-height);interpolate-size:allow-keywords;transition:background-color var(--rac-duration-base) ease,border-color var(--rac-duration-base) ease,height var(--rac-duration-base) ease;justify-content:space-between;box-sizing:border-box;cursor:pointer;display:flex}.rac-select:hover{background-color:var(--rac-select-hover);border-color:var(--rac-select-hover)}.rac-loading-style,.rac-disabled-style{opacity:var(--rac-disabled-opacity);transition:border-color var(--rac-duration-base),filter var(--rac-duration-base),opacity var(--rac-duration-base);cursor:wait}.rac-disabled-style{cursor:not-allowed}.rac-error-style{border:var(--rac-select-border-error);cursor:help}.rac-select-title-wrapper{transition:height var(--rac-duration-base) cubic-bezier(.4,0,.2,1);display:flex;width:100%}.rac-select-title{min-height:var(--rac-select-min-height);position:relative;flex-wrap:wrap;display:flex;width:100%}.rac-spacer{min-height:var(--rac-select-min-height)}.rac-title-container{height:100%}.rac-title-text{font-size:var(--rac-title-font-size);align-content:center;display:block;height:100%}@keyframes rac-fade-in{0%{opacity:0;transform:translateY(var(--rac-title-anim-shift))}to{opacity:1;transform:translateY(0)}}.rac-loading-container{align-items:end;display:grid;height:100%}.rac-loading-dots{display:inline-flex;--rac-dots-size: calc(var(--rac-title-font-size) / 4);--rac-dots-gap: calc(var(--rac-title-font-size) / 6);--rac-dots-padding-left: calc(var(--rac-title-font-size) / 4);--rac-dots-padding-bottom: .5em;gap:var(--rac-dots-gap);padding-left:var(--rac-dots-padding-left);padding-bottom:var(--rac-dots-padding-bottom)}.rac-loading-dots i{width:var(--rac-dots-size);height:var(--rac-dots-size);background:var(--rac-dots-color, currentColor);border-radius:50%;animation:blink var(--rac-dots-animation-duration) infinite both}.rac-loading-dots i:nth-child(1){animation-delay:var(--rac-dots-animation-delay-1)}.rac-loading-dots i:nth-child(2){animation-delay:var(--rac-dots-animation-delay-2)}.rac-loading-dots i:nth-child(3){animation-delay:var(--rac-dots-animation-delay-3)}@keyframes blink{0%{opacity:.2}20%{opacity:1}to{opacity:.2}}.rac-select-buttons{display:flex;align-items:center}.rac-select-cancel{height:var(--rac-cancel-height);width:var(--rac-cancel-width);transition:opacity var(--rac-duration-fast),border-color var(--rac-duration-fast)}.rac-select-arrow-wrapper{padding:var(--rac-arrow-padding);height:var(--rac-arrow-height);width:var(--rac-arrow-width);will-change:transform;display:block;transition:transform var(--rac-duration-base) cubic-bezier(.4,0,.2,1),padding var(--rac-duration-fast);transform-origin:50% 50%;transform:translateZ(0)}.rac-select-arrow-wrapper.--open{transform:rotate(180deg)}.rac-select-arrow,.rac-select-cancel{object-fit:contain}.rac-select-list{background-color:var(--rac-list-background);color:var(--rac-list-color);max-height:var(--rac-list-max-height);overflow-x:hidden;overflow-y:auto;scrollbar-color:var(--rac-scroll-color) var(--rac-scroll-track);scrollbar-width:thin;scrollbar-gutter:stable;scroll-behavior:smooth;scroll-padding-top:var(--rac-scroll-padding-top);scroll-padding-bottom:var(--rac-scroll-padding-bottom);transition:border-color var(--rac-duration-fast),background-color var(--rac-duration-fast),opacity var(--rac-duration-base)}.rac-select-option{transition:background-color var(--rac-duration-fast) cubic-bezier(.4,0,.2,1);min-height:var(--rac-option-min-height);padding:var(--rac-option-padding);justify-content:space-between;gap:var(--rac-option-gap);overflow-wrap:anywhere;word-break:break-all;scrollbar-width:thin;align-items:center;overflow-x:auto;cursor:pointer;display:flex}.rac-select-option:not(.rac-disabled-option):not(.rac-group-option):hover{background-color:var(--rac-option-hover)}.rac-select-option.rac-highlighted{background-color:var(--rac-option-highlight)}.rac-select-option.rac-selected,.rac-select-option.rac-selected.rac-highlighted{background-color:var(--rac-option-selected)}.rac-option-title{text-overflow:ellipsis;overflow-wrap:anywhere;word-break:break-all;text-wrap:wrap}.rac-disabled-option{cursor:not-allowed;color:var(--rac-disabled-option-color)}.rac-invalid-option{color:var(--rac-invalid-option-color)}.rac-true-option{color:var(--rac-true-option-color)}.rac-false-option{color:var(--rac-false-option-color)}.rac-loading-option{cursor:wait}.rac-group-header{cursor:pointer;min-height:var(--rac-group-header-min-height);padding:var(--rac-group-header-padding);transition:background-color var(--rac-duration-fast) cubic-bezier(.4,0,.2,1);display:flex;justify-content:space-between;align-items:center;font-weight:var(--rac-group-header-font-weight);font-size:var(--rac-group-header-font-size)}.rac-group-container{padding-left:var(--rac-group-container-padding-left)}.rac-group-arrow-wrapper{display:block;height:var(--rac-group-arrow-height);width:var(--rac-group-arrow-width);padding:var(--rac-group-arrow-padding);will-change:transform;transition:transform var(--rac-duration-base) cubic-bezier(.4,0,.2,1),padding var(--rac-duration-fast);transform-origin:50% 50%;transform:translateZ(0)}.rac-group-arrow-wrapper.--open{transform:rotate(180deg)}.rac-disabled-group{cursor:not-allowed;color:var(--rac-disabled-group-color)}.rac-select-selected{display:flex;align-items:center}.rac-multiple-selected-option{transition:background-color var(--rac-duration-fast, --rac-duration) cubic-bezier(.4,0,.2,1),transform var(--rac-duration) ease;background-color:color-mix(in srgb,CanvasText 10%,Canvas);min-height:var(--rac-multiple-selected-min-height);position:relative;display:inline-flex;align-items:center;vertical-align:middle;line-height:normal;padding:var(--rac-multiple-selected-padding);margin:var(--rac-multiple-selected-margin);white-space:nowrap;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;touch-action:none}@media(hover:hover){.rac-multiple-selected-option:hover{background-color:color-mix(in srgb,CanvasText 25%,Canvas)}}.rac-multiple-del{background-color:var(--rac-multiple-del-bg);-webkit-tap-highlight-color:transparent;align-items:center;position:absolute;-webkit-user-select:none;user-select:none;display:grid;height:100%;right:0}.rac-multiple-del:hover{color:var(--rac-multiple-del-hover-color)}.rac-multiple-option{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}.rac-multiple-selected-option.--deleting-shake{background-color:var(--rac-multiple-deleting-bg);animation:rac-shake .3s infinite}@keyframes rac-shake{0%{transform:rotate(0)}25%{transform:rotate(-1deg)}75%{transform:rotate(1deg)}to{transform:rotate(0)}}.rac-checkbox{margin-right:var(--rac-checkbox-margin-right);min-height:var(--rac-option-min-height);min-width:var(--rac-option-min-height);border:var(--rac-checkbox-border);justify-content:center;align-items:center;display:flex;height:100%}.rac-checkmark{color:var(--rac-base-green);opacity:0;max-width:0;max-height:0;transition:max-height var(--rac-duration-base),max-width var(--rac-duration-base),opacity var(--rac-duration-base)}.rac-checkmark.--checked{max-height:var(--rac-option-min-height);max-width:var(--rac-option-min-height);opacity:1}
1
+ @media(prefers-reduced-motion:reduce){.rac-select{--rac-duration: 1ms}}:root{--rac-base-red: #e7000b;--rac-base-green: #4caf50;--rac-base-yellow: #ffc107;--rac-select-background: color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-select-hover: color-mix(in srgb, Canvas 95%, CanvasText 5%);--rac-select-color: CanvasText;--rac-select-border: 2px solid color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-select-border-error: 2px solid color-mix(in srgb, var(--rac-base-red), CanvasText 15%);--rac-select-padding: 0em .5em;--rac-select-min-height: 2em;--rac-disabled-opacity: .75;--rac-title-anim-shift: 4px;--rac-title-anim-entry-ease: cubic-bezier(.34, 1.56, .64, 1);--rac-title-font-size: 1em;--rac-dots-color: currentColor;--rac-dots-gap: 3px;--rac-dots-padding-left: .25em;--rac-dots-align: end;--rac-dots-animation-duration: 1.4s;--rac-dots-animation-delay-1: 0s;--rac-dots-animation-delay-2: .2s;--rac-dots-animation-delay-3: .4s;--rac-arrow-height: 1em;--rac-arrow-width: 1em;--rac-arrow-padding: 1px 0 2px;--rac-cancel-height: .9em;--rac-cancel-width: .9em;--rac-scroll-color: color-mix(in srgb, CanvasText 10%, Canvas);--rac-scroll-track: color-mix(in srgb, CanvasText 5%, Canvas);--rac-scroll-padding-top: .5em;--rac-scroll-padding-bottom: .5em;--rac-option-hover: color-mix(in srgb, CanvasText 6%, Canvas);--rac-option-highlight: color-mix(in srgb, CanvasText 10%, Canvas);--rac-option-selected: color-mix(in srgb, CanvasText 14%, Canvas);--rac-list-background: color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-list-color: CanvasText;--rac-list-max-height: 250px;--rac-option-padding: .5em;--rac-option-min-height: 1em;--rac-option-gap: .5em;--rac-disabled-option-color: color-mix(in srgb, GrayText, CanvasText 20%);--rac-invalid-option-color: color-mix(in srgb, var(--rac-base-red), CanvasText 10%);--rac-true-option-color: color-mix(in srgb, var(--rac-base-green), CanvasText 10%);--rac-false-option-color: color-mix(in srgb, var(--rac-base-red), CanvasText 10%);--rac-warning-option-color: color-mix(in srgb, var(--rac-base-yellow), CanvasText 10%);--rac-group-header-font-size: 1.25em;--rac-group-header-font-weight: bold;--rac-group-header-min-height: 1em;--rac-group-header-padding: .5em;--rac-group-arrow-height: 1em;--rac-group-arrow-width: 1em;--rac-group-arrow-padding: 1px 0 2px;--rac-group-container-padding-left: 1em;--rac-disabled-group-color: color-mix(in srgb, GrayText, CanvasText 20%);--rac-multiple-selected-border: .1em solid gray;--rac-multiple-selected-radius: 5px;--rac-checkbox-border: 1px solid gray;--rac-multiple-selected-padding: 0em .25em;--rac-multiple-selected-margin: .25em .5em .25em 0;--rac-multiple-selected-gap: .5em 0;--rac-multiple-deleting-bg: color-mix(in srgb, var(--rac-base-red) 15%, Canvas);--rac-checkbox-margin-right: .2em;--rac-multiple-selected-min-height: 1.5em;--rac-checkbox-size: var(--rac-option-min-height);--rac-multiple-del-bg: color-mix(in srgb, var(--rac-base-red) 30%, Canvas);--rac-multiple-del-hover-color: var(--rac-base-red)}.rac-select{background:var(--rac-select-background);padding:var(--rac-select-padding);border:var(--rac-select-border);color:var(--rac-select-color);min-height:var(--rac-select-min-height);interpolate-size:allow-keywords;transition:background-color var(--rac-duration-base) ease,border-color var(--rac-duration-base) ease,height var(--rac-duration-base) ease;justify-content:space-between;box-sizing:border-box;cursor:pointer;display:flex}.rac-select:hover{background-color:var(--rac-select-hover);border-color:var(--rac-select-hover)}.rac-loading-style,.rac-disabled-style{opacity:var(--rac-disabled-opacity);transition:border-color var(--rac-duration-base),filter var(--rac-duration-base),opacity var(--rac-duration-base);cursor:wait}.rac-disabled-style{cursor:not-allowed}.rac-error-style{border:var(--rac-select-border-error);cursor:help}.rac-select-title-wrapper{transition:height var(--rac-duration-base) cubic-bezier(.4,0,.2,1);display:flex;width:100%}.rac-select-title{min-height:var(--rac-select-min-height);position:relative;flex-wrap:wrap;display:flex;width:100%}.rac-spacer{min-height:var(--rac-select-min-height)}.rac-title-container{height:100%}.rac-title-text{font-size:var(--rac-title-font-size);align-content:center;display:block;height:100%}@keyframes rac-fade-in{0%{opacity:0;transform:translateY(var(--rac-title-anim-shift))}to{opacity:1;transform:translateY(0)}}.rac-loading-container{align-items:end;display:grid;height:100%}.rac-loading-dots{display:inline-flex;--rac-dots-size: calc(var(--rac-title-font-size) / 4);--rac-dots-gap: calc(var(--rac-title-font-size) / 6);--rac-dots-padding-left: calc(var(--rac-title-font-size) / 4);--rac-dots-padding-bottom: .5em;gap:var(--rac-dots-gap);padding-left:var(--rac-dots-padding-left);padding-bottom:var(--rac-dots-padding-bottom)}.rac-loading-dots i{width:var(--rac-dots-size);height:var(--rac-dots-size);background:var(--rac-dots-color, currentColor);border-radius:50%;animation:blink var(--rac-dots-animation-duration) infinite both}.rac-loading-dots i:nth-child(1){animation-delay:var(--rac-dots-animation-delay-1)}.rac-loading-dots i:nth-child(2){animation-delay:var(--rac-dots-animation-delay-2)}.rac-loading-dots i:nth-child(3){animation-delay:var(--rac-dots-animation-delay-3)}@keyframes blink{0%{opacity:.2}20%{opacity:1}to{opacity:.2}}.rac-select-buttons{display:flex;align-items:center}.rac-select-cancel{height:var(--rac-cancel-height);width:var(--rac-cancel-width);transition:opacity var(--rac-duration-fast),border-color var(--rac-duration-fast)}.rac-select-arrow{transition:transform var(--rac-duration-base) cubic-bezier(.4,0,.2,1);transform-origin:50% 50%;transform:rotate(0);will-change:transform;display:block}.rac-select-arrow.--up,.rac-select-arrow.--open{transform:rotate(180deg)}.rac-select-arrow.--up.--open{transform:rotate(0)}.rac-select-arrow,.rac-select-cancel{object-fit:contain}.rac-select-list{background-color:var(--rac-list-background);color:var(--rac-list-color);max-height:var(--rac-list-max-height);overflow-x:hidden;overflow-y:auto;scrollbar-color:var(--rac-scroll-color) var(--rac-scroll-track);scrollbar-width:thin;scrollbar-gutter:stable;scroll-behavior:smooth;scroll-padding-top:var(--rac-scroll-padding-top);scroll-padding-bottom:var(--rac-scroll-padding-bottom);transition:border-color var(--rac-duration-fast),background-color var(--rac-duration-fast),opacity var(--rac-duration-base)}.rac-select-option{transition:background-color var(--rac-duration-fast) cubic-bezier(.4,0,.2,1);min-height:var(--rac-option-min-height);padding:var(--rac-option-padding);justify-content:space-between;gap:var(--rac-option-gap);overflow-wrap:anywhere;word-break:break-all;scrollbar-width:thin;align-items:center;overflow-x:auto;cursor:pointer;display:flex}.rac-select-option:not(.rac-disabled-option):not(.rac-group-option):hover{background-color:var(--rac-option-hover)}.rac-select-option.rac-highlighted{background-color:var(--rac-option-highlight)}.rac-select-option.rac-selected,.rac-select-option.rac-selected.rac-highlighted{background-color:var(--rac-option-selected)}.rac-option-title{text-overflow:ellipsis;overflow-wrap:anywhere;word-break:break-all;text-wrap:wrap}.rac-disabled-option{cursor:not-allowed;color:var(--rac-disabled-option-color)}.rac-invalid-option{color:var(--rac-invalid-option-color)}.rac-true-option{color:var(--rac-true-option-color)}.rac-false-option{color:var(--rac-false-option-color)}.rac-loading-option{cursor:wait}.rac-group-header{cursor:pointer;min-height:var(--rac-group-header-min-height);padding:var(--rac-group-header-padding);transition:background-color var(--rac-duration-fast) cubic-bezier(.4,0,.2,1);display:flex;justify-content:space-between;align-items:center;font-weight:var(--rac-group-header-font-weight);font-size:var(--rac-group-header-font-size)}.rac-group-container{padding-left:var(--rac-group-container-padding-left)}.rac-group-arrow{display:block;will-change:transform;transition:transform var(--rac-duration-base) cubic-bezier(.4,0,.2,1),padding var(--rac-duration-fast);transform-origin:50% 50%;transform:translateZ(0)}.rac-group-arrow.--open{transform:rotate(180deg)}.rac-disabled-group{cursor:not-allowed;color:var(--rac-disabled-group-color)}.rac-select-selected{display:flex;align-items:center}.rac-multiple-selected-option{transition:background-color var(--rac-duration-fast, --rac-duration) cubic-bezier(.4,0,.2,1),transform var(--rac-duration) ease;background-color:color-mix(in srgb,CanvasText 10%,Canvas);min-height:var(--rac-multiple-selected-min-height);position:relative;display:inline-flex;align-items:center;vertical-align:middle;line-height:normal;padding:var(--rac-multiple-selected-padding);margin:var(--rac-multiple-selected-margin);white-space:nowrap;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;touch-action:none}@media(hover:hover){.rac-multiple-selected-option:hover{background-color:color-mix(in srgb,CanvasText 25%,Canvas)}}.rac-multiple-del{background-color:var(--rac-multiple-del-bg);-webkit-tap-highlight-color:transparent;align-items:center;position:absolute;-webkit-user-select:none;user-select:none;display:grid;height:100%;right:0}.rac-multiple-del:hover{color:var(--rac-multiple-del-hover-color)}.rac-multiple-option{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}.rac-multiple-selected-option.--deleting-shake{background-color:var(--rac-multiple-deleting-bg);animation:rac-shake .3s infinite}@keyframes rac-shake{0%{transform:rotate(0)}25%{transform:rotate(-1deg)}75%{transform:rotate(1deg)}to{transform:rotate(0)}}.rac-checkbox-default{margin-right:var(--rac-checkbox-margin-right);min-height:var(--rac-option-min-height);min-width:var(--rac-option-min-height);border:var(--rac-checkbox-border);justify-content:center;align-items:center;position:relative;display:flex;height:100%}.rac-checkbox{margin-right:var(--rac-checkbox-margin-right);justify-content:center;align-items:center;position:relative;display:flex}.rac-checkmark{transition:max-height var(--rac-duration-base),max-width var(--rac-duration-base),opacity var(--rac-duration-base);position:absolute;max-height:0;opacity:0}.rac-checkmark.--checked{max-height:var(--rac-option-min-height);opacity:1}