react-animated-select 0.7.0 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.cts +165 -0
- package/dist/index.es.js +1229 -1642
- package/index.d.ts +165 -88
- package/package.json +71 -55
- package/dist/index.cjs.js +0 -16
package/index.d.ts
CHANGED
|
@@ -1,88 +1,165 @@
|
|
|
1
|
-
import {FC, ReactNode, CSSProperties, ElementType} from 'react'
|
|
2
|
-
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
import {FC, FunctionComponent, ReactNode, CSSProperties, ElementType, Ref, FocusEvent, AriaAttributes} from 'react'
|
|
2
|
+
|
|
3
|
+
export interface SelectTexts {
|
|
4
|
+
empty: string
|
|
5
|
+
disabled: string
|
|
6
|
+
loading: string
|
|
7
|
+
error: string
|
|
8
|
+
clear: string
|
|
9
|
+
remove: string
|
|
10
|
+
loadMore: string
|
|
11
|
+
loadingMore: string
|
|
12
|
+
emptyOption: string
|
|
13
|
+
invalidOption: string
|
|
14
|
+
disabledOption: string
|
|
15
|
+
emptyGroup: string
|
|
16
|
+
list: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type SelectIcon = ElementType | string | ReactNode | null | false
|
|
20
|
+
|
|
21
|
+
export interface SelectIcons {
|
|
22
|
+
arrow: SelectIcon
|
|
23
|
+
clear: SelectIcon
|
|
24
|
+
remove: SelectIcon
|
|
25
|
+
check: SelectIcon
|
|
26
|
+
checkbox: SelectIcon
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface SelectProps extends AriaAttributes {
|
|
30
|
+
[key: `data-${string}`]: string | number | boolean | undefined
|
|
31
|
+
|
|
32
|
+
ref?: Ref<HTMLDivElement>
|
|
33
|
+
children?: ReactNode
|
|
34
|
+
|
|
35
|
+
options?: any[] | Record<string, any>
|
|
36
|
+
value?: any
|
|
37
|
+
defaultValue?: any
|
|
38
|
+
onChange?: (value: any, ids: any) => void
|
|
39
|
+
multiple?: boolean
|
|
40
|
+
childrenFirst?: boolean
|
|
41
|
+
groupsClosed?: boolean
|
|
42
|
+
|
|
43
|
+
disabled?: boolean
|
|
44
|
+
loading?: boolean
|
|
45
|
+
error?: boolean
|
|
46
|
+
|
|
47
|
+
open?: boolean
|
|
48
|
+
onOpenChange?: (open: boolean) => void
|
|
49
|
+
onFocus?: (e: FocusEvent<HTMLDivElement>) => void
|
|
50
|
+
onBlur?: (e: FocusEvent<HTMLDivElement>) => void
|
|
51
|
+
|
|
52
|
+
id?: string
|
|
53
|
+
name?: string
|
|
54
|
+
required?: boolean
|
|
55
|
+
|
|
56
|
+
hasMore?: boolean
|
|
57
|
+
loadMore?: () => void | Promise<unknown>
|
|
58
|
+
loadButton?: boolean
|
|
59
|
+
loadOffset?: number
|
|
60
|
+
loadAhead?: number
|
|
61
|
+
|
|
62
|
+
placeholder?: string
|
|
63
|
+
selectedText?: string
|
|
64
|
+
texts?: Partial<SelectTexts>
|
|
65
|
+
renderOption?: (item: any, state: {selected: boolean, disabled: boolean}) => ReactNode
|
|
66
|
+
valueAsOption?: boolean
|
|
67
|
+
|
|
68
|
+
icons?: Partial<SelectIcons>
|
|
69
|
+
deleteInline?: boolean
|
|
70
|
+
deleteAlways?: boolean
|
|
71
|
+
|
|
72
|
+
className?: string
|
|
73
|
+
optionsClassName?: string
|
|
74
|
+
style?: CSSProperties
|
|
75
|
+
container?: HTMLElement | null | (() => HTMLElement | null)
|
|
76
|
+
duration?: number
|
|
77
|
+
easing?: string
|
|
78
|
+
offset?: number
|
|
79
|
+
animateOpacity?: boolean
|
|
80
|
+
keepMounted?: boolean
|
|
81
|
+
|
|
82
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `open`. */
|
|
83
|
+
visibility?: boolean
|
|
84
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `onOpenChange`. */
|
|
85
|
+
setVisibility?: (open: boolean) => void
|
|
86
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `open` without `onOpenChange`. */
|
|
87
|
+
ownBehavior?: boolean
|
|
88
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `onOpenChange`. */
|
|
89
|
+
onOpen?: () => void
|
|
90
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `onOpenChange`. */
|
|
91
|
+
onClose?: () => void
|
|
92
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `keepMounted` (inverted). */
|
|
93
|
+
unmount?: boolean
|
|
94
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `deleteAlways`. */
|
|
95
|
+
showDelete?: boolean
|
|
96
|
+
|
|
97
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `icons.arrow`. */
|
|
98
|
+
OpenIcon?: ElementType | string | ReactNode | boolean
|
|
99
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `icons.clear`. */
|
|
100
|
+
ClearIcon?: ElementType | string | ReactNode | boolean
|
|
101
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `icons.remove`. */
|
|
102
|
+
DelIcon?: ElementType | string | ReactNode | boolean
|
|
103
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `icons.check`. */
|
|
104
|
+
Checkmark?: ElementType | string | ReactNode | boolean
|
|
105
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `icons.checkbox`. */
|
|
106
|
+
Checkbox?: ElementType | string | ReactNode | boolean
|
|
107
|
+
|
|
108
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.empty`. */
|
|
109
|
+
emptyText?: string
|
|
110
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.disabled`. */
|
|
111
|
+
disabledText?: string
|
|
112
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.loading`. */
|
|
113
|
+
loadingText?: string
|
|
114
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.error`. */
|
|
115
|
+
errorText?: string
|
|
116
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.clear`. */
|
|
117
|
+
clearText?: string
|
|
118
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.remove`. */
|
|
119
|
+
removeText?: string
|
|
120
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.loadMore`. */
|
|
121
|
+
loadButtonText?: string
|
|
122
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.loadingMore`. */
|
|
123
|
+
loadMoreText?: string
|
|
124
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.emptyOption`. */
|
|
125
|
+
emptyOption?: string
|
|
126
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.invalidOption`. */
|
|
127
|
+
invalidOption?: string
|
|
128
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.disabledOption`. */
|
|
129
|
+
disabledOption?: string
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const Select: FC<SelectProps>
|
|
133
|
+
|
|
134
|
+
export interface OptionProps {
|
|
135
|
+
value?: any
|
|
136
|
+
id?: any
|
|
137
|
+
label?: any
|
|
138
|
+
name?: any
|
|
139
|
+
group?: string
|
|
140
|
+
children?: ReactNode
|
|
141
|
+
disabled?: boolean
|
|
142
|
+
className?: string
|
|
143
|
+
style?: CSSProperties
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const Option: FC<OptionProps>
|
|
147
|
+
|
|
148
|
+
export interface OptGroupProps {
|
|
149
|
+
value?: any
|
|
150
|
+
id?: any
|
|
151
|
+
name?: any
|
|
152
|
+
label?: any
|
|
153
|
+
children?: ReactNode
|
|
154
|
+
disabled?: boolean
|
|
155
|
+
className?: string
|
|
156
|
+
style?: CSSProperties
|
|
157
|
+
|
|
158
|
+
/** @deprecated Removed in v0.7.5, has no effect. Use `texts.emptyGroup` on the `<Select/>`. */
|
|
159
|
+
emptyGroupText?: string
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export const OptGroup: FC<OptGroupProps>
|
|
163
|
+
|
|
164
|
+
/** Makes a reusable option component that `<Select/>` reads as data. `render` must be pure: no hooks. */
|
|
165
|
+
export function defineOption<P>(render: (props: P) => ReactNode): FunctionComponent<P>
|
package/package.json
CHANGED
|
@@ -1,55 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-animated-select",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "l1nway",
|
|
7
|
-
"email": "l1nway@icloud.com",
|
|
8
|
-
"url": "https://github.com/l1nway/"
|
|
9
|
-
|
|
10
|
-
"description": "Animated, accessible
|
|
11
|
-
"files": [
|
|
12
|
-
"dist",
|
|
13
|
-
"index.d.ts"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "react-animated-select",
|
|
3
|
+
"version": "0.7.7",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "l1nway",
|
|
7
|
+
"email": "l1nway@icloud.com",
|
|
8
|
+
"url": "https://github.com/l1nway/"
|
|
9
|
+
},
|
|
10
|
+
"description": "Animated, accessible and deeply customizable select for React: single and multiple choice, groups, chips, async loading, keyboard, touch and SSR, with zero dependencies",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"index.d.ts"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"react",
|
|
17
|
+
"select",
|
|
18
|
+
"multiselect",
|
|
19
|
+
"combobox",
|
|
20
|
+
"dropdown",
|
|
21
|
+
"chips",
|
|
22
|
+
"animated",
|
|
23
|
+
"accessible",
|
|
24
|
+
"ssr",
|
|
25
|
+
"ui-components"
|
|
26
|
+
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/l1nway/react-animated-select.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/l1nway/react-animated-select/issues"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"homepage": "https://l1nway.github.io/react-animated-select-docs/",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "vite build",
|
|
38
|
+
"dev": "vite build --watch",
|
|
39
|
+
"prepublishOnly": "npm run build"
|
|
40
|
+
},
|
|
41
|
+
"main": "./dist/index.cjs",
|
|
42
|
+
"module": "./dist/index.es.js",
|
|
43
|
+
"types": "./index.d.ts",
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"import": {
|
|
47
|
+
"types": "./index.d.ts",
|
|
48
|
+
"default": "./dist/index.es.js"
|
|
49
|
+
},
|
|
50
|
+
"require": {
|
|
51
|
+
"types": "./dist/index.d.cts",
|
|
52
|
+
"default": "./dist/index.cjs"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"./style.css": "./dist/index.css",
|
|
56
|
+
"./package.json": "./package.json"
|
|
57
|
+
},
|
|
58
|
+
"sideEffects": [
|
|
59
|
+
"**/*.css"
|
|
60
|
+
],
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"react": ">=19.2.0",
|
|
63
|
+
"react-dom": ">=19.2.0"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@types/react": "^19.2.9",
|
|
67
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
68
|
+
"vite": "^7.3.1",
|
|
69
|
+
"vite-plugin-lib-inject-css": "^2.2.2"
|
|
70
|
+
}
|
|
71
|
+
}
|
package/dist/index.cjs.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const n=require("react"),he=require("react-transition-group"),Me=require("react-dom");var Ee={exports:{}},me={};var Ce;function Fe(){if(Ce)return me;Ce=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(a,i,h){var u=null;if(h!==void 0&&(u=""+h),i.key!==void 0&&(u=""+i.key),"key"in i){h={};for(var S in i)S!=="key"&&(h[S]=i[S])}else h=i;return i=h.ref,{$$typeof:e,type:a,key:u,ref:i!==void 0?i:null,props:h}}return me.Fragment=t,me.jsx=s,me.jsxs=s,me}var ye={};var Ie;function We(){return Ie||(Ie=1,process.env.NODE_ENV!=="production"&&(function(){function e(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===K?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case D:return"Fragment";case J:return"Profiler";case X:return"StrictMode";case q:return"Suspense";case c:return"SuspenseList";case I: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 C:return"Portal";case Z:return r.displayName||"Context";case W:return(r._context.displayName||"Context")+".Consumer";case y:var v=r.render;return r=r.displayName,r||(r=v.displayName||v.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case w:return v=r.displayName||null,v!==null?v:e(r.type)||"Memo";case z:v=r._payload,r=r._init;try{return e(r(v))}catch{}}return null}function t(r){return""+r}function s(r){try{t(r);var v=!1}catch{v=!0}if(v){v=console;var _=v.error,Y=typeof Symbol=="function"&&Symbol.toStringTag&&r[Symbol.toStringTag]||r.constructor.name||"Object";return _.call(v,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Y),t(r)}}function a(r){if(r===D)return"<>";if(typeof r=="object"&&r!==null&&r.$$typeof===z)return"<...>";try{var v=e(r);return v?"<"+v+">":"<...>"}catch{return"<...>"}}function i(){var r=L.A;return r===null?null:r.getOwner()}function h(){return Error("react-stack-top-frame")}function u(r){if(B.call(r,"key")){var v=Object.getOwnPropertyDescriptor(r,"key").get;if(v&&v.isReactWarning)return!1}return r.key!==void 0}function S(r,v){function _(){P||(P=!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)",v))}_.isReactWarning=!0,Object.defineProperty(r,"key",{get:_,configurable:!0})}function j(){var r=e(this.type);return G[r]||(G[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 E(r,v,_,Y,Q,o){var p=_.ref;return r={$$typeof:k,type:r,key:v,props:_,_owner:Y},(p!==void 0?p: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:Q}),Object.defineProperty(r,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:o}),Object.freeze&&(Object.freeze(r.props),Object.freeze(r)),r}function l(r,v,_,Y,Q,o){var p=v.children;if(p!==void 0)if(Y)if(V(p)){for(Y=0;Y<p.length;Y++)R(p[Y]);Object.freeze&&Object.freeze(p)}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 R(p);if(B.call(v,"key")){p=e(r);var b=Object.keys(v).filter(function(A){return A!=="key"});Y=0<b.length?"{key: someKey, "+b.join(": ..., ")+": ...}":"{key: someKey}",O[p+Y]||(b=0<b.length?"{"+b.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
-
let props = %s;
|
|
3
|
-
<%s {...props} />
|
|
4
|
-
React keys must be passed directly to JSX without using spread:
|
|
5
|
-
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,Y,p,b,p),O[p+Y]=!0)}if(p=null,_!==void 0&&(s(_),p=""+_),u(v)&&(s(v.key),p=""+v.key),"key"in v){_={};for(var T in v)T!=="key"&&(_[T]=v[T])}else _=v;return p&&S(_,typeof r=="function"?r.displayName||r.name||"Unknown":r),E(r,p,_,i(),Q,o)}function R(r){g(r)?r._store&&(r._store.validated=1):typeof r=="object"&&r!==null&&r.$$typeof===z&&(r._payload.status==="fulfilled"?g(r._payload.value)&&r._payload.value._store&&(r._payload.value._store.validated=1):r._store&&(r._store.validated=1))}function g(r){return typeof r=="object"&&r!==null&&r.$$typeof===k}var N=n,k=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),X=Symbol.for("react.strict_mode"),J=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),Z=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),L=N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=Object.prototype.hasOwnProperty,V=Array.isArray,x=console.createTask?console.createTask:function(){return null};N={react_stack_bottom_frame:function(r){return r()}};var P,G={},F=N.react_stack_bottom_frame.bind(N,h)(),d=x(a(h)),O={};ye.Fragment=D,ye.jsx=function(r,v,_){var Y=1e4>L.recentlyCreatedOwnerStacks++;return l(r,v,_,!1,Y?Error("react-stack-top-frame"):F,Y?x(a(r)):d)},ye.jsxs=function(r,v,_){var Y=1e4>L.recentlyCreatedOwnerStacks++;return l(r,v,_,!0,Y?Error("react-stack-top-frame"):F,Y?x(a(r)):d)}})()),ye}var $e;function ze(){return $e||($e=1,process.env.NODE_ENV==="production"?Ee.exports=Fe():Ee.exports=We()),Ee.exports}var f=ze();const Ne=({className:e="",...t})=>f.jsx("svg",{xmlns:"http://w3.org/2000/svg","aria-label":"Clear selection",className:e,viewBox:"0 0 320 512",fill:"currentColor",role:"button",height:"1em",width:"1em",...t,children:f.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"})}),Be=({className:e="",...t})=>f.jsx("svg",{xmlns:"http://w3.org/2000/svg",className:e,viewBox:"0 0 448 512",fill:"currentColor",height:"1em",width:"1em",...t,children:f.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"})}),Ge=({className:e="",...t})=>f.jsx("svg",{xmlns:"http://w3.org/2000/svg",className:e,viewBox:"0 0 24 24",fill:"currentColor",height:"1em",width:"1em",...t,children:f.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"})}),Ye=e=>({loadingTitle:e.loadButton?e.loadButtonText:e.loadMoreText,internalVisibility:!1,animationFinished:!1,deleting:!1,jsxOptions:[]}),Ve=(e,t)=>{if(t.type==="SET"){const s=t.payload;return{...e,...typeof s=="function"?s(e):s}}return e},fe=(e,t)=>{if(!e)return null;const s=(a={})=>({...t,...a,style:{...t?.style,...a?.style}});if(typeof e=="string")return f.jsx("img",{src:e,...s(),alt:""});if(n.isValidElement(e))return n.cloneElement(e,s(e.props));if(typeof e=="function"||typeof e=="object"&&e.$$typeof){const a=e;return f.jsx(a,{...s()})}return null},Je=(e,t,s,a,i,h,u,S)=>{const j=S?.some(E=>E.id===e.id);return e.groupHeader?"rac-select-option rac-group-option":["rac-select-option",e.className,(j||a===e.id)&&"rac-selected",t===s&&"rac-highlighted",(e.disabled||e.loading)&&"rac-disabled-option",(e.invalid||e.name===u)&&"rac-invalid-option",e.loadMore&&i===h&&"rac-loading-option",typeof e.raw=="boolean"&&(e.raw?"rac-true-option":"rac-false-option")].filter(Boolean).join(" ")},Se=n.createContext(null),Te=e=>{const t=window.getComputedStyle(e);return parseFloat(t.marginLeft)+parseFloat(t.marginRight)},Oe=e=>e.reduce((t,s)=>{const a=s.getBoundingClientRect(),i=a.top,h=a.width;return t[i]=(t[i]||0)+h,t},{}),qe={bottomDirection:!1,selectHeight:null,spacer:{state:!1,id:null,width:0},activeHoverId:null,hoverRowTop:null,spacerWidths:{},entering:!1,swipedId:null,leaving:!1,rowEndIds:[],delWidth:0};function Ue(e,t){switch(t.type){case"SET":return{...e,...t.payload};case"SET_SPACER_WIDTH":return{...e,spacerWidths:{...e.spacerWidths,[t.id]:t.width}};default:return e}}const Xe=e=>{const{selectedIDs:t,deleting:s,setDeleting:a,toggleVisibility:i,visibility:h,removeOption:u,setselectedIDs:S,selectRef:j,deleteInline:E}=e,[l,R]=n.useReducer(Ue,qe),{spacerWidths:g,spacer:N,delWidth:k}=l,C=n.useCallback(c=>R({type:"SET",payload:c}),[]),D=n.useRef(t?.length||0),X=n.useRef(!0),J=n.useRef(null),W=n.useRef(null),Z=n.useCallback(c=>{u?u(c):S(w=>w.filter(z=>z.id!==c))},[u,S]),y=n.useCallback(c=>{if(s){c.stopPropagation(),c.preventDefault(),a(!1);return}i(c)},[s,i]),q=n.useCallback((c,w)=>{g[c]!==w&&R({type:"SET_SPACER_WIDTH",id:c,width:w})},[g]);return n.useLayoutEffect(()=>{const c=J.current;if(!c)return;const w=()=>{C({selectHeight:c.offsetHeight});const I=Array.from(c.children).filter(B=>B.classList.contains("rac-multiple-option"));if(!I.length){C({rowEndIds:[]});return}const K=new Set(t.map(B=>B.id)),L={};I.forEach(B=>{K.has(B.id)&&(L[B.offsetTop]=B.id)}),C({rowEndIds:Object.values(L)})};w();const z=new ResizeObserver(()=>w());return z.observe(c),()=>z.disconnect()},[t]),n.useEffect(()=>{X.current=!1,j&&(typeof j=="function"?j(j.current):j.current=j.current)},[j]),n.useEffect(()=>{s&&h&&i()&&i?.()(s&&t?.length===0)&&a(!1),C({activeHoverId:null})},[t?.length,s]),n.useLayoutEffect(()=>{const c=J.current,w=t?.length||0,z=t[w-1]?.id;if(!c||!t?.length||s){t?.length||C({spacer:{state:!1,id:null,width:0},entering:null});return}const I=Array.from(c.children).filter(V=>V.classList.contains("rac-multiple-option")),K=w!==D.current||I.length!==w||z&&g[z]&&!D.currentWidths?.[z];if(!c||!w||s||!K){!w&&K&&C({spacer:{state:!1,id:null,width:0},entering:null}),D.current=w,D.currentWidths=g;return}D.current=w,D.currentWidths=g;const L=c.getBoundingClientRect().width;if(I.length>t.length){const V=new Set(t.map(Q=>Q.id)),x=I.findIndex(Q=>!V.has(Q.id));if(x===-1)return;const P=I[x],G=I[x-1];if(!(G&&P.getBoundingClientRect().top!==G.getBoundingClientRect().top)){C({spacer:{state:!1,id:null,width:0},entering:null});return}const d=Oe(I),O=Object.keys(d).map(Number).sort((Q,o)=>Q-o),r=O.indexOf(P.getBoundingClientRect().top);if(r<=0){C({spacer:{state:!1,id:null,width:0},entering:null});return}const v=O[r-1],_=d[v],Y=L-_;B(G?.id||null,!0,Y)}else if(I.length===t.length){const V=I[I.length-1],x=t[t.length-1]?.id,P=g[x];if(!P)return;const G=V?.firstElementChild||V,F=Te(G),d=Te(V),O=I.slice(0,-1),r=Oe(O),v=Object.keys(r).map(Number).sort((o,p)=>o-p);let _=L;if(v.length>0){const o=Math.max(...v);_=L-(r[o]||0)}const Y=P+F+d>_-k+.1,Q=t[t.length-2]?.id;B(Q,Y,_)}function B(V,x,P){N.id===V&&N.state===x&&N.width===P||C({spacer:{state:x,id:V,width:P},entering:x?V:null})}},[t,g,s]),n.useLayoutEffect(()=>{if(W.current){const c=W.current.getBoundingClientRect(),w=Te(W.current.firstElementChild||W.current);C({delWidth:c.width+w})}},[W]),{state:l,setState:C,optionRef:J,firstMount:X,remove:Z,safeToggle:y,registerItemWidth:q,delIcon:W,delWidth:k}},pe=n.forwardRef(({className:e="",visibility:t=void 0,setLeaving:s,setEntering:a,setSpacer:i,children:h,duration:u=300,unmount:S,style:j,exit:E=!0,...l},R)=>{const g=n.useRef(null),N=t!==void 0?t:l.in;n.useImperativeHandle(R,()=>g.current),n.useEffect(()=>{!N&&g.current&&(g.current.style.width="0px")},[]);const k=n.useCallback(()=>{if(!g.current)return{left:"0px",right:"0px"};const C=window.getComputedStyle(g.current);return{left:C.marginLeft,right:C.marginRight}},[]);return f.jsx(he.CSSTransition,{onEnter:()=>{g.current.style.transition="none",g.current.style.marginRight="0px",g.current.style.marginLeft="0px",g.current.style.width="0px",a?.(!0)},onEntering:()=>{const{left:C,right:D}=k();requestAnimationFrame(()=>{requestAnimationFrame(()=>{g.current&&(g.current.style.transition=`width ${u}ms, color ${u}ms, background-color ${u}ms, margin ${u}ms ease`,g.current.style.width=g.current.scrollWidth+"px",g.current.style.marginRight=D,g.current.style.marginLeft=C)})})},onEntered:()=>{g.current.style.width="auto",i?.(!1),a?.(!1)},onExit:()=>{const{left:C,right:D}=k();g.current.style.width=g.current.scrollWidth+"px",g.current.style.marginRight=D,g.current.style.marginLeft=C,g.current.offsetHeight,s?.(!0)},onExiting:()=>{g.current.style.marginRight="0px",g.current.style.marginLeft="0px",g.current.style.width="0px"},onExited:()=>{S?.(),s?.(!1),i?.(!1)},classNames:"rac-slide-left",unmountOnExit:E,timeout:u,nodeRef:g,in:N,...l,children:f.jsx("div",{className:e,ref:g,style:{transition:`width ${u}ms, color ${u}ms, background-color ${u}ms, margin ${u}ms ease`,willChange:"width",overflow:"hidden",...j},children:h})})}),Ke=n.memo(({element:e,setState:t,spacer:s,delWidth:a,selectRef:i,setVisibility:h,activeHoverId:u,hoverRowTop:S,swipedId:j,deleteInline:E,remove:l,DelIcon:R,normalizedOptions:g,swiped:N,deleting:k,entering:C,setDeleting:D,onRender:X,duration:J,rowEnd:W,showDelete:Z})=>{const y=n.useRef({longPressTimer:null,hoverTimer:null,longPress:!1,swiping:!1,touchStart:0}),q=n.useRef(null),c=n.useCallback(d=>{y.current.touchStart=d.touches[0].clientX,y.current.longPress=!1,y.current.longPressTimer&&clearTimeout(y.current.longPressTimer),y.current.longPressTimer=setTimeout(()=>{D(!0),y.current.longPress=!0,i.current?.focus(),h(!1),window.navigator.vibrate&&window.navigator.vibrate(50)},600),d.preventDefault()},[]),w=n.useCallback(d=>{y.current.longPressTimer&&clearTimeout(y.current.longPressTimer);const O=d.touches[0].clientX,r=y.current.touchStart-O;Math.abs(r)>10&&(y.current.swiping=!0,r>30&&!N?t({activeHoverId:null,swipedId:e.id}):r<-30&&N&&t({swipedId:null}))},[e.id,N]),z=n.useCallback(d=>{y.current.longPressTimer&&clearTimeout(y.current.longPressTimer),y.current.longPress&&d.preventDefault()},[]),I=n.useCallback(()=>{s?.state||(y.current.hoverTimer&&clearTimeout(y.current.hoverTimer),y.current.hoverTimer=setTimeout(()=>{t({hoverRowTop:q.current?.getBoundingClientRect().top,activeHoverId:e.id,swipedId:null})},100))},[e.id,s?.state]),K=n.useCallback(()=>{y.current.hoverTimer&&clearTimeout(y.current.hoverTimer),y.current.hoverTimer=setTimeout(()=>t({activeHoverId:null,hoverRowTop:null}),100)},[]);n.useEffect(()=>{!s?.state&&q.current&&q.current.matches(":hover")&&I()},[s?.state,I]),n.useEffect(()=>()=>{y.current.hoverTimer&&clearTimeout(y.current.hoverTimer),y.current.longPressTimer&&clearTimeout(y.current.longPressTimer)},[]);let L=null;if(e?.jsx)L=e.jsx;else if(e?.name)L=e.name;else if(e?.raw!==void 0){const d=g.find(O=>O.raw===e.raw||O.original===e.raw||O.userId===e.raw);d&&(L=d.jsx??d.name)}L==null&&(L=typeof e=="object"?e.label??e.name??e.value??"Selected item":String(e));const B=n.useCallback(d=>{d.stopPropagation(),d.preventDefault()},[]),V=n.useCallback(d=>{t({swipedId:null}),l(e.id),B(d)},[e.id,l]),x=n.useCallback(d=>{B(d),y.current.longPress?y.current.longPress=!1:k&&V(d)},[k,V]);n.useLayoutEffect(()=>{if(q.current&&X){const{width:d}=q.current.getBoundingClientRect();X(d)}},[X,L]);const P=Z?!0:u===e.id||j===e.id||k,G=S===q.current?.getBoundingClientRect().top,F=(u||j)&&G;return f.jsxs(n.Fragment,{children:[f.jsxs("div",{className:`rac-multiple-selected-option ${k?"--deleting-shake":""}`,onTouchStart:c,onTouchMove:w,onTouchEnd:z,onMouseEnter:I,onMouseLeave:K,onClick:x,ref:q,children:[L,f.jsx(pe,{style:{backgroundColor:k||E?"transparent":"--rac-multiple-del-bg",position:k||E?"relative":"absolute"},setEntering:d=>t({entering:d}),setLeaving:d=>t({leaving:d}),setSpacer:d=>t({spacer:d}),className:"rac-multiple-del",visibility:P,duration:J,children:fe(R,{onClick:V,onMouseDown:B})})]}),!Z&&!k&&E&&W&&C!==e.id&&f.jsx("div",{style:{minWidth:F?"0px":`${a}px`,transition:`min-width ${J}ms ease`,"--del-width":`${a}px`,flexBasis:"0px",height:"1px",flexShrink:1},className:"rac-del-spacer"})]})}),Ae=({children:e,setLeaving:t,duration:s,setSpacer:a,setEntering:i,id:h=null,widthMode:u=!1,...S})=>{const j=n.useRef(null),E=n.useCallback(()=>{if(!j.current)return{t:0,b:0,l:0,r:0};const l=window.getComputedStyle(j.current);return{t:l.marginTop,b:l.marginBottom,l:l.marginLeft,r:l.marginRight}},[]);return f.jsx(he.CSSTransition,{classNames:"rac-slide-left",timeout:s,nodeRef:j,unmountOnExit:!0,...S,onEnter:()=>{const l=j.current;l&&(u?(l.style.width="0px",l.style.marginLeft="0px",l.style.marginRight="0px"):(l.style.height="0px",l.style.marginTop="0px",l.style.marginBottom="0px",l.style.transform="translateY(-10px)"),l.style.opacity="0")},onEntering:()=>{const l=j.current,R=E();l.offsetHeight,u?(l.style.width=l.scrollWidth+"px",l.style.marginRight=R.r,l.style.marginLeft=R.l):(l.style.height=l.scrollHeight+"px",l.style.transform="translateY(0)",l.style.marginBottom=R.b,l.style.marginTop=R.t),l.style.opacity="1"},onEntered:()=>{const l=j.current;l.style.width=u?"auto":"",l.style.height=u?"":"100%",l.style.opacity="1",l.style.transform="",i?.(!1),a?.(!1)},onExit:()=>{const l=j.current,R=E();u?(l.style.width=l.offsetWidth+"px",l.style.marginRight=R.r,l.style.marginLeft=R.l):(l.style.height=l.offsetHeight+"px",l.style.position="absolute",l.style.marginBottom=R.b,l.style.marginTop=R.t),l.style.opacity="1",t?.(!0)},onExiting:()=>{const l=j.current;u?(l.style.marginRight="0px",l.style.marginLeft="0px",l.style.width="0px"):(l.style.transform="translateY(10px)",l.style.marginBottom="0px",l.style.marginTop="0px",l.style.height="0px"),l.style.opacity="0"},onExited:()=>{a?.(!1),t?.(!1)},children:f.jsx("div",{ref:j,id:h,style:{transition:`all ${s}ms ease`,alignItems:"center",whiteSpace:"nowrap",overflow:"hidden",display:"flex",left:0,top:0},children:e})})},Ze=n.memo(({element:e,index:t,spacer:s,duration:a,setState:i,...h})=>f.jsxs(n.Fragment,{children:[f.jsx(Ae,{setEntering:u=>i({entering:u}),setLeaving:u=>i({leaving:u}),setSpacer:u=>i({spacer:u}),className:"rac-multiple-option",onEnter:h.onEnter,onExit:h.onExit,duration:a,id:e.id,in:h.in,widthMode:!0,children:f.jsx(Ke,{onRender:u=>h.registerItemWidth(e.id,u),setState:i,duration:a,element:e,spacer:s,index:t,...h})}),s.state&&s.id===e.id&&f.jsx("div",{style:{width:s.width},className:"rac-spacer"})]}));function Qe({visibility:e,selectRef:t,setBottomDirection:s}){const a=n.useRef(250);n.useLayoutEffect(()=>{if(!t.current)return;const i=document.createElement("div");i.className="rac-select-list",i.style.visibility="hidden",i.style.position="absolute",document.body.appendChild(i);const h=parseInt(window.getComputedStyle(i).maxHeight);h&&(a.current=h),document.body.removeChild(i);const u=new ResizeObserver(j=>{for(let E of j){const l=E.borderBoxSize?.[0]?.blockSize||E.contentRect.height;l>0&&(a.current=l)}}),S=new IntersectionObserver(j=>{e||j.forEach(E=>{const l=E.boundingClientRect,R=window.innerHeight-l.bottom;s(R<a.current)})},{threshold:[0,1]});return S.observe(t.current),()=>{S.disconnect(),u.disconnect()}},[t,e,s])}function et({visibility:e,bottomDirection:t,children:s,selectRef:a,onAnimationDone:i,unmount:h=!0,duration:u,easing:S,offset:j,animateOpacity:E,style:l,className:R,setBottomDirection:g=()=>{}}){const N=n.useRef(null),k=n.useCallback(()=>{if(!a?.current||!N.current)return;const c=a.current.getBoundingClientRect(),w=N.current,z=w.scrollHeight||250,I=window.innerHeight-c.bottom,K=I<z&&c.top>I;K!==t&&g(K),w.style.width=`${c.width}px`,w.style.left=`${c.left}px`,K?(w.style.top="auto",w.style.bottom=`${window.innerHeight-c.top+j}px`,w.style.transformOrigin="bottom"):(w.style.bottom="auto",w.style.top=`${c.bottom+j}px`,w.style.transformOrigin="top")},[a,t,j,g]);n.useLayoutEffect(()=>{if(e){k(),window.addEventListener("scroll",k,{capture:!0,passive:!0}),window.addEventListener("resize",k);const c=new ResizeObserver(k);return a.current&&c.observe(a.current),()=>{window.removeEventListener("scroll",k,{capture:!0,passive:!0}),window.removeEventListener("resize",k),c.disconnect()}}},[e,k,a]);const C=`height var(--rac-duration) ${S}${E?`, opacity var(--rac-duration) ${S}`:""}`,D={opacity:E?e?1:0:1,transformOrigin:t?"bottom":"top",pointerEvents:e?"all":"none",height:e?"auto":"0px","--rac-duration":`${u}ms`,boxSizing:"border-box","--rac-easing":S,zIndex:"2147483647",overflow:"hidden",position:"fixed",...Object.fromEntries(Object.entries(l||{}).map(([c,w])=>[c.startsWith("--")?c:`--rac-${c.replace(/([A-Z])/g,"-$1").toLowerCase()}`,w]))},X=n.useCallback(()=>{const c=N.current;c&&(c.style.height="0px",E&&(c.style.opacity="0"),c.style.transition="")},[E]),J=n.useCallback(()=>{const c=N.current;c&&(c.style.transition=C,c.style.height=`${c.scrollHeight}px`,E&&(c.style.opacity="1"))},[C,E]),W=n.useCallback(()=>{const c=N.current;c&&(c.style.height="auto",c.style.transition="",i&&i())},[i]),Z=n.useCallback(()=>{const c=N.current;c&&(c.style.height=`${c.scrollHeight}px`,E&&(c.style.opacity="1"),c.offsetHeight,c.style.transition=C)},[C,E]),y=n.useCallback(()=>{const c=N.current;c&&(c.style.height="0px",E&&(c.style.opacity="0"))},[E]),q=n.useCallback(()=>{const c=N.current;c&&(c.style.transition="")},[]);return Me.createPortal(f.jsx(he.CSSTransition,{classNames:"rac-options",unmountOnExit:h,onEntering:J,onExiting:y,onEntered:W,onExited:q,timeout:u,nodeRef:N,onEnter:X,in:e,onExit:Z,children:f.jsx("div",{style:{...D,"--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":`${u}ms`},className:`rac-options ${R||""}`,onMouseDown:c=>c.preventDefault(),ref:N,children:s})}),document.body)}const tt=n.memo(et,(e,t)=>e.visibility===t.visibility&&e.duration===t.duration&&e.easing===t.easing&&e.offset===t.offset&&e.animateOpacity===t.animateOpacity&&e.selectRef===t.selectRef&&e.children===t.children&&JSON.stringify(e.style)===JSON.stringify(t.style)),rt=n.memo(e=>{const{state:t,setState:s,optionRef:a,firstMount:i,remove:h,safeToggle:u,registerItemWidth:S,delIcon:j}=Xe(e),{bottomDirection:E,selectHeight:l,swipedId:R,rowEndIds:g,delWidth:N}=t,{selectRef:k,selectId:C,renderOptions:D,selected:X,selectedIDs:J,normalizedOptions:W,title:Z,visibility:y,active:q,hasOptions:c,hasActualValue:w,optionsClassName:z,selectedText:I,disabled:K,loading:L,error:B,registerOption:V,unregisterOption:x,handleBlur:P,handleFocus:G,handleKeyDown:F,handleListScroll:d,setAnimationFinished:O,clear:r,children:v,placeholder:_,className:Y,style:Q,duration:o,easing:p,offset:b,animateOpacity:T,unmount:A,OpenIcon:H,ClearIcon:ee,DelIcon:re,hasMore:le,loadButton:se,deleting:m}=e;Qe({visibility:y,selectRef:k,setBottomDirection:M=>s({bottomDirection:M})});const U=ee&&w&&c&&!K&&!L&&!B&&!m,te=H&&q&&!m,ie=J?.map((M,ue)=>f.jsx(Ze,{rowEnd:g.includes(M.id),registerItemWidth:S,swiped:R===M.id,setState:s,element:M,remove:h,index:ue,...e,...t},M.id));return f.jsxs(Se.Provider,{value:{registerOption:V,unregisterOption:x},children:[v,f.jsxs("div",{ref:k,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":`${o}ms`,...Q},className:`
|
|
7
|
-
${!c||K?"rac-disabled-style":""}
|
|
8
|
-
${L?"rac-loading-style":""}
|
|
9
|
-
${B?"rac-error-style":""}
|
|
10
|
-
${Y}
|
|
11
|
-
rac-select
|
|
12
|
-
`,...q&&{onKeyDown:F,onFocus:G,onClick:u,onBlur:P},"aria-disabled":K||!c,"aria-controls":`${C}-listbox`,tabIndex:q?0:-1,"aria-expanded":y,"aria-label":_,"aria-haspopup":"listbox",role:"combobox",children:[f.jsx("div",{className:`rac-select-title-wrapper
|
|
13
|
-
${!B&&!L&&X?.type==="boolean"?X.raw?"rac-true-option":"rac-false-option":""}
|
|
14
|
-
`,style:{alignItems:J?.length&&!I?"flex-start":"center",height:l?`${l}px`:"auto"},children:f.jsx("div",{style:{alignItems:J?.length&&!I?"flex-start":"center",height:L?"100%":"auto"},className:"rac-select-title",ref:a,children:f.jsx(he.TransitionGroup,{enter:!i.current,component:null,appear:!1,children:J?.length&&!I&&!L?ie:f.jsxs(Ae,{className:"rac-title-container",duration:o,widthMode:!0,children:[f.jsx("span",{className:"rac-title-text",children:Z}),f.jsx(pe,{className:"rac-loading-container",visibility:L&&!B,duration:o,children:f.jsxs("span",{className:"rac-loading-dots",children:[f.jsx("i",{}),f.jsx("i",{}),f.jsx("i",{})]})})]},Z)})})}),f.jsx(pe,{visibility:U||te,className:"rac-select-buttons",children:f.jsxs(he.TransitionGroup,{component:null,children:[U&&f.jsx(pe,{style:{display:"grid"},duration:o,children:fe(ee,{className:"rac-select-cancel",onMouseDown:M=>{M.stopPropagation(),M.preventDefault()},onClick:r})},"clear-icon")," ",te&&f.jsx(pe,{style:{display:"grid"},duration:o,children:fe(H,{className:`rac-select-arrow ${y?"--open":""} ${E?"":"--up"}`})},"open-button")]})}),f.jsx(tt,{setBottomDirection:M=>s({bottomDirection:M}),style:{"--rac-duration":`${o}ms`,...Q},visibility:y&&W.length,onAnimationDone:()=>O(!0),bottomDirection:t.bottomDirection,animateOpacity:T,className:z,selectRef:k,duration:o,unmount:A,easing:p,offset:b,children:f.jsxs("div",{onScroll:d,className:"rac-select-list","aria-label":"Options",role:"listbox",tabIndex:"-1",children:[D,!se&&le&&f.jsxs("div",{className:"rac-select-option rac-disabled-option rac-loading-option",style:{justifyContent:"initial",alignItems:"end",gap:0},onClick:M=>M.stopPropagation(),children:[f.jsx("span",{className:"rac-loading-option-title",children:"Loading"}),f.jsx("div",{className:"rac-loading-container",children:f.jsxs("span",{className:"rac-loading-dots",children:[f.jsx("i",{}),f.jsx("i",{}),f.jsx("i",{})]})})]})]})})]}),!N&&f.jsx("div",{style:{position:"absolute",visibility:"hidden",pointerEvents:"none",zIndex:-1},children:f.jsx("div",{ref:j,children:fe(re)})})]})});function nt({disabled:e,open:t,setOpen:s,options:a=[],selectOption:i,setState:h,selected:u,selectedIDs:S,multiple:j,hasMore:E,loadMore:l,loadButton:R,loadButtonText:g,loadOffset:N,loadAhead:k,expandedGroups:C,onOpen:D,onClose:X,deleting:J}){const[W,Z]=n.useState(-1),y=n.useRef({loadingTriggered:!1,lastWindowFocusTime:0,justFocused:!1,focusTimeout:null});n.useEffect(()=>{y.current.loadingTriggered=!1,R&&h({loadingTitle:g})},[a.length,E,R,g]);const q=n.useCallback(()=>{!E||y.current.loadingTriggered||(y.current.loadingTriggered=!0,l())},[E,l]),c=n.useCallback(x=>{if(R||!E||y.current.loadingTriggered)return;const{scrollTop:P,scrollHeight:G,clientHeight:F}=x.currentTarget(G-P<=F+N)&&q()},[R,E,N,q]);n.useEffect(()=>{!R&&t&&E&&W>=a.length-k&&q()},[W,t,E,a.length,k,R,q]),n.useEffect(()=>{const x=()=>y.current.lastWindowFocusTime=Date.now();return window.addEventListener("focus",x),()=>{window.removeEventListener("focus",x),clearTimeout(y.current.focusTimeout)}},[]),n.useEffect(()=>{if(!t){Z(-1);return}const x=a[W],P=x&&!x.hidden&&!x.groupHeader;if(W>=0&&W<a.length&&P)return;let G=-1;if(u&&!j){const F=j?u[0]:u;F&&(G=a.findIndex(d=>d.id===F.id&&!d.disabled&&!d.hidden&&!d.groupHeader))}if(j&&S.length){const F=new Set(S.map(d=>d.id));G=a.findIndex(d=>F.has(d.id)&&!d.disabled&&!d.hidden&&!d.groupHeader)}G===-1&&(G=a.findIndex(F=>!F.disabled&&!F.hidden&&!F.groupHeader)),Z(G)},[t,a,u]);const w=n.useCallback((x,P)=>{const G=O=>O&&!O?.groupHeader&&(!O?.group||C?.has(O?.group))&&!O?.disabled&&!O?.loading,F=a.length;if(F===0)return-1;let d=x;for(let O=0;O<F;O++){if(d=(d+P+F)%F,!R&&E&&(P>0&&d===0||P<0&&d===F-1))return x;if(G(a[d]))return d}return x},[a,E,R,C]),z=n.useCallback(x=>{const P=x.relatedTarget?.closest(".rac-options");!x.currentTarget.contains(x.relatedTarget)&&!P&&(J&&h({deleting:!1}),t&&s(!1))},[J,t,h,s]),I=n.useCallback(()=>{e||J||document.hidden||Date.now()-y.current.lastWindowFocusTime<100||t||(clearTimeout(y.current.focusTimeout),y.current.focusTimeout=setTimeout(()=>y.current.justFocused=!1,200),y.current.justFocused=!0,s(!0))},[e,t,s,J]),K=n.useEffectEvent(()=>D?.()),L=n.useEffectEvent(()=>X?.());n.useEffect(()=>{t?K():L()},[t]);const B=n.useCallback(x=>{e||J||x?.target?.closest(".rac-select-cancel")||y.current.justFocused||s(!t)},[e,t,s,D,X,J]),V=n.useCallback(x=>{if(!e)switch(x.key){case"Enter":case" ":x.preventDefault(),t?W!==-1&&a[W]&&i(a[W],x):s(!0);break;case"Escape":x.preventDefault(),s(!1);break;case"ArrowDown":x.preventDefault(),t?Z(P=>w(P,1)):s(!0);break;case"ArrowUp":x.preventDefault(),t?Z(P=>w(P,-1)):s(!0);break;case"Tab":t&&s(!1);break}},[e,t,s,W,a,i,w]);return n.useMemo(()=>({handleBlur:z,handleFocus:I,toggleVisibility:B,handleKeyDown:V,highlightedIndex:W,setHighlightedIndex:Z,handleListScroll:c}),[z,I,B,V,W,c])}const st=["group","disabled","options","items","children"],we=["name","label","id","value"],_e=[],be=(e,t=!1)=>{if(t&&typeof e.group=="string")return e.group;const s=we.find(i=>e[i]!=null&&e[i]!=="");if(s)return String(e[s]);const a=Object.entries(e).find(([i,h])=>!st.includes(i)&&h!=null&&h!=="");return a?String(a[1]):null};function it({options:e=_e,jsxOptions:t=_e,value:s,onChange:a,disabled:i=!1,loading:h=!1,error:u=!1,multiple:S=!1,placeholder:j="Choose option",emptyText:E="No options",disabledText:l="Disabled",loadingText:R="Loading",errorText:g="Failed to load",disabledOption:N="Disabled option",emptyOption:k="Empty option",invalidOption:C="Invalid option",setVisibility:D,hasMore:X,loadButton:J,setState:W,loadingTitle:Z,loadMoreText:y,loadMore:q,childrenFirst:c=!1,groupsClosed:w=!1}){const z=s!==void 0,[I,K]=n.useState(()=>{const o=new Set;if(w)return o;const p=b=>{Array.isArray(b)&&b.forEach(T=>{if(T&&typeof T=="object"){if(("options"in T||"group"in T&&!we.some(H=>H in T))&&!T.disabled){const H=be(T,!0)||"Empty group";o.add(H)}T.options&&p(T.options)}})};return p(e),o}),L=n.useRef(null),B=n.useCallback(o=>{K(p=>{const b=new Set(p);return b.has(o)?b.delete(o):b.add(o),b})},[]),V=n.useCallback((o,p,b="n",T=null,A=!1)=>{const H=`${b}-${p}`;if(o==null||o===""||o===void 0)return{name:k,disabled:!0,type:"normal",groupDisabled:A,userId:null,raw:o,group:T,id:H};if(typeof o=="function")return{id:H,userId:null,name:C,raw:o,disabled:!0,invalid:!0,type:"normal",group:T};if(typeof o=="object"&&!Array.isArray(o)){const ee=T||o.group||null,re=A||o.disabled===!0,le=o.id??o.value??o.name??o.label,se=o.value!==void 0?o.value:o.id!==void 0?o.id:o;let m=be(o)||(re?N:k);return{id:H,userId:le,name:m,raw:se,original:o,disabled:re||m===k&&!re,type:typeof se=="boolean"?"boolean":"normal",group:ee,groupDisabled:A}}return{id:H,userId:o,name:String(o),raw:o,original:o,disabled:A,type:typeof o=="boolean"?"boolean":"normal",group:T}},[k,C,N]),x=n.useMemo(()=>{const o=new Map,p=[],b=t.map((m,U)=>{if(m.isGroupMarker)return{...m,type:"group-marker"};const te=!m.label&&!m.userId&&!m.value&&(m.value===void 0||m.value===null||m.value==="")&&!m.hasJsx;return{...m,id:`jsx-${m.id}`,index:U,userId:m.userId,raw:m.value,original:m.value,name:te?k:m.label||m.userId||String(m.value||""),disabled:!!m.disabled||te,type:typeof m.value=="boolean"?"boolean":"normal",group:m.group||null}});let T=0;const A=(m,U=null,te=!1,ie="0")=>{Array.isArray(m)||(m=[m]),m.forEach((M,ue)=>{const oe=`${ie}-${ue}`,ae=M!=null&&typeof M=="object"&&!Array.isArray(M);if(ae&&("options"in M||"group"in M&&!we.some(ne=>ne in M))){const ne=be(M,!0)||"Empty group";o.has(ne)||o.set(ne,{disabled:!!M.disabled,closedByDefault:!!M.disabled||w,items:[]}),M.options?A(M.options,ne,te||!!M.disabled,oe):p.push({id:`empty-${ne}-${oe}`,name:ne,group:ne,isPlaceholder:!0,type:"group-marker",index:T++})}else if(ae&&!we.some(ne=>ne in M)&&!M.group)Object.entries(M).forEach(([ne,xe],ve)=>{const $=V(xe,`${oe}-${ve}`,"default",U,te);p.push({...$,index:T++})});else{const ne=V(M,oe,"default",U,te);p.push({...ne,index:T++})}})};A(e);const H=c?[...b,...p]:[...p,...b];if(!L.current)L.current=new Map(H.map((m,U)=>[m.id,U]));else{let m=!1;if(H.forEach(U=>{L.current.has(U.id)||(m=!0)}),m){const U=new Map;H.forEach((te,ie)=>{U.set(te.id,ie)}),L.current=U}}const ee=[...H].sort((m,U)=>{const te=L.current.get(m.id)??999999,ie=L.current.get(U.id)??999999;return te-ie}),re=[],le=new Set;ee.forEach(m=>{if(!m.group)re.push({type:"item",data:m});else{le.has(m.group)||(le.add(m.group),re.push({type:"group",name:m.group}));const U=o.get(m.group)||{items:[]};o.has(m.group)||o.set(m.group,U),m.isGroupMarker?(U.className=m.className,U.style=m.style,m.disabled&&(U.disabled=!0)):m.isPlaceholder||U.items.push(m)}});const se=[];return re.forEach(m=>{if(m.type==="item")se.push(m.data);else{const U=m.name,te=o.get(U),ie=I.has(U);se.push({className:te?.className||"",id:`group-header-${U}`,disabled:!!te?.disabled,style:te?.style||{},groupHeader:!0,name:U,type:"group",hidden:!1,expanded:ie}),te?.items.forEach(M=>{const ue=I.size>0?!ie:!!w;se.push({...M,hidden:ue})})}}),X&&J&&se.push({id:"special-load-more-id",name:Z,loadMore:!0,loading:Z===y,type:"special"}),se},[e,t,V,c,X,J,Z,y,w,I,k]),P=n.useCallback(()=>{if(s==null||Array.isArray(s)&&s.length===0)return{initialId:null,initialIDs:[]};const o=new Set,p=(b,T)=>{let A=x.find(ee=>ee.original===b&&!o.has(ee.id));if(!A&&typeof b=="object")try{const ee=JSON.stringify(b);A=x.find(re=>re.original&&typeof re.original=="object"&&JSON.stringify(re.original)===ee&&!o.has(re.id))}catch{}if(A)return o.add(A.id),A;const H=typeof b=="object"?b.id||b.value||JSON.stringify(b):String(b);return typeof b=="object"&&b!==null?{id:`virtual-${H}-${T}`,name:be(b)||String(b.id||"Selected Object"),raw:b.value??b.id??b,original:b,userId:b.id??b.value??null,virtual:!0}:{id:`virtual-${H}-${T}`,name:String(b),raw:b,original:b,userId:b,virtual:!0}};if(S)return{initialId:null,initialIDs:(Array.isArray(s)?s:[s]).map((A,H)=>p(A,H))};{const b=Array.isArray(s)?s[0]:s;return{initialId:p(b,0).id,initialIDs:[]}}},[z,s,x,S]),[G,F]=n.useState(()=>P().initialId),[d,O]=n.useState(()=>P().initialIDs),r=n.useMemo(()=>{const o=x.find(p=>p.id===G);if(o)return o;if(!S&&G?.startsWith("virtual-")){const p=Array.isArray(s)?s[0]:s;if(p)return{id:G,name:typeof p=="object"?be(p):String(p),original:p}}return null},[G,x,S,z,s]),v=n.useCallback((o,p)=>{if(o.groupHeader){_(p),o.disabled||B(o.name);return}if(o.disabled||o.loadMore){_(p),o.loadMore&&!o.loading&&(W({loadingTitle:y}),q());return}if(S){if(o.disabled||o.groupHeader||o.loadMore){_(p);return}_(p);const T=d?.some(A=>A.id===o.id)?d.filter(A=>A.id!==o.id):[...d,o];O(T),a?.(T.map(A=>A.original),T.map(A=>A.userId));return}a?.(o.original,o.userId),F(o.id),D(!1)},[a,D,q,y,B,S,d]),_=n.useCallback(o=>{o?.stopPropagation(),o?.preventDefault()},[]),Y=n.useCallback(()=>{a?.(null,null),F(null),O([])},[a]),Q=n.useCallback(o=>{const p=d.filter(b=>b.id!==o);O(p),a?.(p.map(b=>b.original),p.map(b=>b.userId))},[d,a]);return{normalizedOptions:x,selected:r,selectOption:v,clear:Y,removeOption:Q,hasOptions:x.length>0,active:!u&&!h&&!i&&x.length>0,selectedValue:s,placeholder:j,emptyText:E,disabledText:l,loadingText:R,errorText:g,disabledOption:N,emptyOption:k,invalidOption:C,disabled:i,loading:h,error:u,expandedGroups:I,toggleGroup:B,selectedIDs:d,multiple:S,setselectedIDs:O}}const Re=(e,t="invalid-option",s="")=>{const a=s?s.replace(/:/g,""):"";if(typeof e!="string"||!e.trim())return a?`${t}-${a}`:`${t}-${Math.random().toString(36).slice(2,8)}`;const i=e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"-").replace(/[^\p{L}\p{N}-]+/gu,"").toLowerCase();return i?i||`${t}-${Math.random().toString(36).slice(2,8)}`:a?`${t}-${a}`:`${t}-${Math.random().toString(36).slice(2,8)}`};function ot({setExternalVisibility:e,externalVisibility:t,loadButtonText:s,loadMoreText:a,ownBehavior:i,loadButton:h,loadOffset:u,loadAhead:S,loadMore:j,hasMore:E,onOpen:l,onClose:R,props:g,ref:N}){const k=n.useId(),C=n.useMemo(()=>k.replace(/:/g,""),[k]),D=n.useRef(null);n.useImperativeHandle(N,()=>D.current);const[X,J]=n.useReducer(Ve,{loadButton:h,loadButtonText:s,loadMoreText:a},Ye),{internalVisibility:W,animationFinished:Z,jsxOptions:y,deleting:q,loadingTitle:c}=X,w=n.useCallback(T=>J({type:"SET",payload:T}),[]),z=t!==void 0,I=n.useMemo(()=>i||z?!!t:W,[i,z,t,W]),K=n.useCallback(T=>{i||(!z&&w({internalVisibility:T}),e?.(T))},[i,z,e]),L=n.useCallback(T=>{w(A=>{const H=A.jsxOptions.findIndex(ee=>ee.id===T.id);if(H!==-1){const ee=A[H];if(ee.label===T.label&&ee.value===T.value&&ee.disabled===T.disabled&&ee.group===T.group)return A;const re=[...A];return re[H]=T,{jsxOptions:re}}return{jsxOptions:[...A.jsxOptions,T]}})},[w]),B=n.useCallback(T=>w(A=>({jsxOptions:A.jsxOptions.filter(H=>H.id!==T)})),[]),V=it({...g,setVisibility:K,jsxOptions:y,hasMore:E,loadButton:h,loadingTitle:c,loadMore:j,loadMoreText:a,setState:w}),{multiple:x,normalizedOptions:P,selected:G,selectOption:F,hasOptions:d,selectedValue:O,disabled:r,loading:v,error:_,expandedGroups:Y,selectedIDs:Q}=V,o=nt({setState:w,loadButton:h,loadButtonText:s,hasMore:E,loadMore:j,disabled:r,multiple:x,open:I,setOpen:K,options:P,selectOption:F,selected:G,loadOffset:u,loadAhead:S,expandedGroups:Y,selectedIDs:Q,onOpen:l,onClose:R,deleting:q}),{highlightedIndex:p}=o;n.useEffect(()=>{I&&D.current&&document.activeElement!==D.current&&D.current.focus(),!I&&w({animationFinished:!1})},[I]),n.useEffect(()=>{(_||r||v||!d)&&K(!1)},[_,r,v,d,K]),n.useEffect(()=>{z&&w({internalVisibility:!!t})},[t,z]),n.useEffect(()=>{if(I&&Z&&p!==-1){const T=P[p];T&&document.getElementById(`${C}-${Re(T.id)}`)?.scrollIntoView({block:"nearest"})}},[p,I,Z,P,C]);const b=n.useMemo(()=>O!=null&&!(Array.isArray(O)&&O.length===0)&&!(typeof O=="object"&&Object.keys(O).length===0),[O]);return{selectId:C,selectRef:D,visibility:I,setVisibility:K,animationFinished:Z,setAnimationFinished:T=>w({animationFinished:T}),deleting:q,loadingTitle:c,jsxOptions:y,registerOption:L,unregisterOption:B,logic:V,behavior:o,hasActualValue:b}}function lt({visibility:e,children:t,duration:s=300,className:a}){const i=n.useRef(null),h=n.useCallback(()=>{if(!i.current)return{top:"0px",bottom:"0px"};const u=window.getComputedStyle(i.current);return{top:u.marginTop,bottom:u.marginBottom}},[]);return f.jsx(he.CSSTransition,{onEnter:()=>{i.current.style.height="0px",i.current.style.marginTop="0px",i.current.style.marginBottom="0px"},onEntering:()=>{const{top:u,bottom:S}=h();i.current.style.height=i.current.scrollHeight+"px",i.current.style.marginBottom=S,i.current.style.marginTop=u},onEntered:()=>i.current.style.height="auto",onExit:()=>{const{top:u,bottom:S}=h();i.current.style.height=i.current.scrollHeight+"px",i.current.style.marginBottom=S,i.current.style.marginTop=u,i.current.offsetHeight},onExiting:()=>{i.current.style.height="0px",i.current.style.marginTop="0px",i.current.style.marginBottom="0px"},classNames:"rac-slide-down",timeout:s,nodeRef:i,in:e,unmountOnExit:!0,children:f.jsx("div",{style:{transition:`height ${s}ms ease, margin ${s}ms ease`,overflow:"hidden"},className:`${a} rac-slide-down-enter-done`,ref:i,tabIndex:-1,children:t})})}const at=n.forwardRef(({loadMore:e=()=>console.warn("loadMore not implemented"),setVisibility:t=()=>{},visibility:s,loadButtonText:a="Load more",Checkmark:i=Ge,loadMoreText:h="Loading",selectedText:u=void 0,OpenIcon:S=Be,animateOpacity:j=!0,ClearIcon:E=Ne,optionsClassName:l="",Checkbox:R=void 0,deleteInline:g=!1,ownBehavior:N=!1,DelIcon:k=Ne,onClose:C=()=>{},showDelete:D=!1,easing:X="ease-in",loadButton:J=!1,onOpen:W=()=>{},loadOffset:Z=100,hasMore:y=!1,className:q="",duration:c=300,loadAhead:w=3,offset:z=1,style:I={},children:K,unmount:L,...B},V)=>{const x=ot({externalVisibility:s,setExternalVisibility:t,ownBehavior:N,loadButton:J,loadButtonText:a,loadMoreText:h,loadMore:e,loadOffset:Z,loadAhead:w,hasMore:y,onOpen:W,onClose:C,ref:V,props:B}),{logic:P,behavior:G,selectId:F,hasActualValue:d,loadingTitle:O}=x,{normalizedOptions:r,selected:v,multiple:_,selectedIDs:Y,invalidOption:Q,selectOption:o,hasOptions:p,error:b,loading:T,disabled:A,selectedValue:H,expandedGroups:ee,placeholder:re,emptyText:le,errorText:se,loadingText:m,disabledText:U}=P,{highlightedIndex:te,setHighlightedIndex:ie}=G,M=n.useMemo(()=>{if(b)return se;if(T)return m;if(A)return U;if(d&&u)return u;if(v)return v.jsx??v.name;if(d){const oe=r.find(ae=>ae.raw===H);return oe?oe.name:typeof H=="object"&&H!==null?H.name??H.label??"Selected Object":String(H)}return p?re:le},[A,T,b,p,v,H,re,se,m,U,le,d,r]),ue=n.useMemo(()=>{const oe=[];let ae=[],ge=null;const ne=r.reduce(($,ce)=>(ce.group&&($[ce.group]=($[ce.group]||0)+1),$),{}),xe=$=>{$===null||ae.length===0||(oe.push(f.jsx(lt,{visibility:ee.has($),className:"rac-group-container",duration:c,children:ae},`slide-${$}`)),ae=[])},ve=($,ce)=>f.jsxs("div",{className:Je($,ce,te,v?.id,O,h,Q,Y),style:{...$.style,...$.loading?{justifyContent:"initial",alignItems:"end",gap:0}:{}},onMouseEnter:()=>!$.disabled&&!$.loading&&ie(ce),onClick:de=>!$.loading&&o($,de),"aria-disabled":$.disabled||$.loading,"aria-selected":v?.id===$.id,id:`${F}-${Re($.id)}`,role:"option",children:[$.jsx?f.jsx("div",{className:"rac-jsx-option",children:$.jsx}):f.jsx("span",{className:"rac-option-title",children:$.name}),$.loading&&f.jsxs("span",{style:{paddingBottom:"0.1em"},className:"rac-loading-dots",children:[f.jsx("i",{}),f.jsx("i",{}),f.jsx("i",{})]}),_&&!$.disabled&&f.jsxs("div",{className:`rac-checkbox${R?"":"-default"}`,children:[fe(i,{style:{position:R?"":"relative"},className:`
|
|
15
|
-
rac-checkmark
|
|
16
|
-
${Y?.some(de=>de.id===$.id)?"--checked":""}`}),fe(R,{className:"rac-check-box"})]})]},$.id);return r.forEach(($,ce)=>{const de=$.groupHeader,ke=!!$.group;if((de||!ke&&ge!==null)&&(xe(ge),de||(ge=null)),de){ge=$.name;const Le=ee.has($.name),De=ne[$.name]>0;oe.push(f.jsxs("div",{className:["rac-group-header",$.disabled&&"rac-disabled-group",$.className].filter(Boolean).join(" "),onClick:He=>o($,He),style:$.style,id:$.id,children:[f.jsx("span",{className:"rac-group-title-text",children:$.name}),f.jsx(pe,{visibility:De&&!$.disabled,style:{display:"grid"},duration:c,children:fe(S,{className:`rac-group-arrow ${Le?"--open":""}`})})]},$.id))}else ke?ae.push(ve($,ce)):oe.push(ve($,ce))}),xe(ge),oe},[r,o,F,v,te,O,h,Q,ie,ee,S]);return f.jsx(rt,{optionsClassName:l,animateOpacity:j,renderOptions:ue,deleteInline:g,showDelete:D,className:q,ClearIcon:E,Checkmark:i,OpenIcon:S,Checkbox:R,duration:c,children:K,DelIcon:k,unmount:L,...x,easing:X,offset:z,title:M,style:I,...G,...P})}),Pe=n.createContext(null);function ct({children:e,name:t,label:s,value:a,id:i,disabled:h,emptyGroupText:u="Empty group",className:S="",style:j={}}){const E=n.useContext(Se),l=n.useMemo(()=>{const g=t??s??i??a;return g!=null&&g!==""?String(g):u},[t,s,a,i,u]),R=n.useMemo(()=>`group-marker-${Re(l)}`,[l]);return n.useEffect(()=>{if(!E)return;const g={disabled:!!h,isGroupMarker:!0,group:l,id:R,className:S,style:j};return E.registerOption(g),()=>E.unregisterOption(R)},[E.registerOption,E.unregisterOption,R,l]),f.jsx(Pe.Provider,{value:l,children:e})}const je=e=>e?typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(je).join(" ").replace(/\s+/g," ").trim():n.isValidElement(e)?je(e.props.children):"":"";function ut({name:e,label:t,id:s,value:a,className:i,style:h,children:u,disabled:S,group:j}){const E=n.useContext(Se),l=n.useContext(Pe),R=E?.registerOption,g=E?.unregisterOption,N=n.useId(),k=n.useMemo(()=>s?String(s):N.replace(/:/g,""),[s,N]);return n.useEffect(()=>{if(!R)return;const C=je(u),D=u!=null;let X="";return t!=null&&t!==""?X=String(t):e!=null&&e!==""?X=String(e):C?X=C:s!=null&&s!==""&&(X=String(s)),R({id:k,value:a!==void 0?a:C,label:X,jsx:u,hasJsx:D,className:i,style:h,disabled:!!S,group:j||l||null}),()=>g(k)},[k,e,t,a,u,i,h,S,j,l,R,g]),null}exports.OptGroup=ct;exports.Option=ut;exports.Select=at;
|