@kushagradhawan/kookie-ui 0.1.65 → 0.1.66
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/components.css +15 -7
- package/dist/cjs/components/combobox.d.ts +45 -0
- package/dist/cjs/components/combobox.d.ts.map +1 -1
- package/dist/cjs/components/combobox.js +1 -1
- package/dist/cjs/components/combobox.js.map +3 -3
- package/dist/cjs/components/combobox.props.d.ts +26 -17
- package/dist/cjs/components/combobox.props.d.ts.map +1 -1
- package/dist/cjs/components/combobox.props.js +1 -1
- package/dist/cjs/components/combobox.props.js.map +2 -2
- package/dist/esm/components/combobox.d.ts +45 -0
- package/dist/esm/components/combobox.d.ts.map +1 -1
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/combobox.js.map +3 -3
- package/dist/esm/components/combobox.props.d.ts +26 -17
- package/dist/esm/components/combobox.props.d.ts.map +1 -1
- package/dist/esm/components/combobox.props.js +1 -1
- package/dist/esm/components/combobox.props.js.map +2 -2
- package/package.json +1 -1
- package/schemas/base-button.json +1 -1
- package/schemas/button.json +1 -1
- package/schemas/icon-button.json +1 -1
- package/schemas/index.json +6 -6
- package/schemas/toggle-button.json +1 -1
- package/schemas/toggle-icon-button.json +1 -1
- package/src/components/combobox.css +19 -9
- package/src/components/combobox.props.tsx +11 -2
- package/src/components/combobox.tsx +132 -27
- package/styles.css +15 -7
package/components.css
CHANGED
|
@@ -10211,6 +10211,17 @@
|
|
|
10211
10211
|
.rt-ComboboxContent {
|
|
10212
10212
|
padding: 0 !important;
|
|
10213
10213
|
max-height: var(--radix-popover-content-available-height);
|
|
10214
|
+
display: flex;
|
|
10215
|
+
flex-direction: column;
|
|
10216
|
+
}
|
|
10217
|
+
.rt-ComboboxCommand {
|
|
10218
|
+
display: flex;
|
|
10219
|
+
flex-direction: column;
|
|
10220
|
+
flex: 1;
|
|
10221
|
+
min-height: 0;
|
|
10222
|
+
}
|
|
10223
|
+
.rt-ComboboxViewport {
|
|
10224
|
+
padding-top: 0 !important;
|
|
10214
10225
|
}
|
|
10215
10226
|
.rt-BaseMenuContent:where(.rt-r-size-1) :where(.rt-ComboboxItem) {
|
|
10216
10227
|
--base-menu-item-padding-left: calc(var(--space-5) / 1.2);
|
|
@@ -10231,18 +10242,11 @@
|
|
|
10231
10242
|
color: inherit !important;
|
|
10232
10243
|
cursor: var(--cursor-menu-item) !important;
|
|
10233
10244
|
}
|
|
10234
|
-
.rt-ComboboxCommand {
|
|
10235
|
-
display: flex;
|
|
10236
|
-
flex-direction: column;
|
|
10237
|
-
gap: var(--space-2);
|
|
10238
|
-
}
|
|
10239
10245
|
.rt-ComboboxSearch {
|
|
10240
10246
|
position: sticky;
|
|
10241
10247
|
top: 0;
|
|
10242
10248
|
z-index: 1;
|
|
10243
10249
|
padding: var(--base-menu-content-padding);
|
|
10244
|
-
padding-bottom: var(--space-2);
|
|
10245
|
-
border-bottom: 1px solid var(--gray-a3);
|
|
10246
10250
|
background-color: var(--color-panel);
|
|
10247
10251
|
}
|
|
10248
10252
|
:where([data-panel-background='translucent']) .rt-ComboboxSearch {
|
|
@@ -10253,6 +10257,10 @@
|
|
|
10253
10257
|
.rt-ComboboxSearch :where(.rt-ComboboxInputRoot) {
|
|
10254
10258
|
width: 100%;
|
|
10255
10259
|
}
|
|
10260
|
+
.rt-ScrollAreaRoot:where(.rt-ComboboxScrollArea) {
|
|
10261
|
+
flex: 1;
|
|
10262
|
+
min-height: 0;
|
|
10263
|
+
}
|
|
10256
10264
|
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-BaseMenuItem.rt-ComboboxItem[data-selected='true']),
|
|
10257
10265
|
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-BaseMenuItem.rt-ComboboxItem[aria-selected='true']) {
|
|
10258
10266
|
background-color: var(--accent-9);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Combobox is a compound component built on top of Popover and cmdk's Command list.
|
|
3
|
+
* It mirrors the Select API while adding search-first behaviors including filtering,
|
|
4
|
+
* async-friendly state management, and design token support for trigger, content,
|
|
5
|
+
* and input variants.
|
|
6
|
+
*/
|
|
1
7
|
import * as React from 'react';
|
|
2
8
|
import { Command as CommandPrimitive } from 'cmdk';
|
|
3
9
|
import { comboboxRootPropDefs, comboboxTriggerPropDefs, comboboxContentPropDefs } from './combobox.props.js';
|
|
@@ -9,6 +15,9 @@ import type { GetPropDefTypes } from '../props/prop-def.js';
|
|
|
9
15
|
type TextFieldVariant = (typeof textFieldRootPropDefs.variant.values)[number];
|
|
10
16
|
type ComboboxValue = string | null;
|
|
11
17
|
type CommandFilter = (value: string, search: string, keywords?: string[]) => number;
|
|
18
|
+
/**
|
|
19
|
+
* Additional props supported by Combobox.Root beyond the Radix Popover surface.
|
|
20
|
+
*/
|
|
12
21
|
type ComboboxRootOwnProps = GetPropDefTypes<typeof comboboxRootPropDefs> & {
|
|
13
22
|
value?: ComboboxValue;
|
|
14
23
|
defaultValue?: ComboboxValue;
|
|
@@ -29,46 +38,82 @@ type ComboboxRootOwnProps = GetPropDefTypes<typeof comboboxRootPropDefs> & {
|
|
|
29
38
|
type PopoverRootProps = React.ComponentPropsWithoutRef<typeof Popover.Root>;
|
|
30
39
|
interface ComboboxRootProps extends PopoverRootProps, ComboboxRootOwnProps {
|
|
31
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Root component that wires up Popover behavior, controllable state,
|
|
43
|
+
* and shared context for trigger/content/input sub-components.
|
|
44
|
+
*/
|
|
32
45
|
declare const ComboboxRoot: React.FC<ComboboxRootProps>;
|
|
33
46
|
type ComboboxTriggerOwnProps = GetPropDefTypes<typeof comboboxTriggerPropDefs>;
|
|
34
47
|
type NativeTriggerProps = Omit<React.ComponentPropsWithoutRef<'button'>, 'color'>;
|
|
35
48
|
interface ComboboxTriggerProps extends NativeTriggerProps, MarginProps, ComboboxTriggerOwnProps {
|
|
36
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Trigger behaves like a styled button that opens the Popover,
|
|
52
|
+
* syncing size/highContrast from Root while exposing select-like states.
|
|
53
|
+
*/
|
|
37
54
|
declare const ComboboxTrigger: React.ForwardRefExoticComponent<ComboboxTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
38
55
|
interface ComboboxValueProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
39
56
|
placeholder?: string;
|
|
40
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Value mirrors Select.Value by showing the selected item's label
|
|
60
|
+
* or falling back to placeholder text supplied by the consumer or context.
|
|
61
|
+
*/
|
|
41
62
|
declare const ComboboxValue: React.ForwardRefExoticComponent<ComboboxValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
42
63
|
type ComboboxContentOwnProps = GetPropDefTypes<typeof comboboxContentPropDefs> & {
|
|
43
64
|
container?: React.ComponentPropsWithoutRef<typeof Popover.Content>['container'];
|
|
44
65
|
};
|
|
45
66
|
interface ComboboxContentProps extends Omit<ComponentPropsWithout<typeof Popover.Content, RemovedProps>, 'size'>, ComboboxContentOwnProps {
|
|
46
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Content renders the dropdown surface, syncing tokens from the current Theme
|
|
70
|
+
* and instantiating cmdk's Command list for roving focus + filtering.
|
|
71
|
+
*/
|
|
47
72
|
declare const ComboboxContent: React.ForwardRefExoticComponent<ComboboxContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
48
73
|
interface ComboboxInputProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input> {
|
|
49
74
|
startAdornment?: React.ReactNode;
|
|
50
75
|
endAdornment?: React.ReactNode;
|
|
51
76
|
variant?: TextFieldVariant;
|
|
52
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Input composes TextField tokens with cmdk's Command.Input to provide
|
|
80
|
+
* automatic focus management and optional adornments.
|
|
81
|
+
*/
|
|
53
82
|
declare const ComboboxInput: React.ForwardRefExoticComponent<ComboboxInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
54
83
|
interface ComboboxListProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.List> {
|
|
55
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* List wraps cmdk's Command.List to inherit base menu styles and provides ScrollArea for the items.
|
|
87
|
+
*/
|
|
56
88
|
declare const ComboboxList: React.ForwardRefExoticComponent<ComboboxListProps & React.RefAttributes<HTMLDivElement>>;
|
|
57
89
|
interface ComboboxEmptyProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty> {
|
|
58
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Empty renders when no options match the search query.
|
|
93
|
+
*/
|
|
59
94
|
declare const ComboboxEmpty: React.ForwardRefExoticComponent<ComboboxEmptyProps & React.RefAttributes<HTMLDivElement>>;
|
|
60
95
|
interface ComboboxGroupProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group> {
|
|
61
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Group and Label mirror menu semantics for subheadings inside the list.
|
|
99
|
+
*/
|
|
62
100
|
declare const ComboboxGroup: React.ForwardRefExoticComponent<ComboboxGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
63
101
|
interface ComboboxLabelProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
64
102
|
}
|
|
65
103
|
declare const ComboboxLabel: React.ForwardRefExoticComponent<ComboboxLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
66
104
|
interface ComboboxSeparatorProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator> {
|
|
67
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Separator visually divides logical sections of the option list.
|
|
108
|
+
*/
|
|
68
109
|
declare const ComboboxSeparator: React.ForwardRefExoticComponent<ComboboxSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
69
110
|
interface ComboboxItemProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item> {
|
|
70
111
|
label?: string;
|
|
71
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Item wires cmdk's selection handling with Kookie UI tokens and
|
|
115
|
+
* ensures labels are registered for displaying the current value.
|
|
116
|
+
*/
|
|
72
117
|
declare const ComboboxItem: React.ForwardRefExoticComponent<ComboboxItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
73
118
|
export { ComboboxRoot as Root, ComboboxTrigger as Trigger, ComboboxValue as Value, ComboboxContent as Content, ComboboxInput as Input, ComboboxList as List, ComboboxEmpty as Empty, ComboboxGroup as Group, ComboboxLabel as Label, ComboboxSeparator as Separator, ComboboxItem as Item, };
|
|
74
119
|
export type { ComboboxRootProps as RootProps, ComboboxTriggerProps as TriggerProps, ComboboxContentProps as ContentProps, ComboboxInputProps as InputProps, ComboboxListProps as ListProps, ComboboxEmptyProps as EmptyProps, ComboboxGroupProps as GroupProps, ComboboxLabelProps as LabelProps, ComboboxSeparatorProps as SeparatorProps, ComboboxItemProps as ItemProps, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../src/components/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAC;AAGnD,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAK7G,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAGxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,KAAK,gBAAgB,GAAG,CAAC,OAAO,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM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I,KAAK,EACtB,iBAAiB,IAAI,SAAS,EAC9B,YAAY,IAAI,IAAI,GACrB,CAAC;AACF,YAAY,EACV,iBAAiB,IAAI,SAAS,EAC9B,oBAAoB,IAAI,YAAY,EACpC,oBAAoB,IAAI,YAAY,EACpC,kBAAkB,IAAI,UAAU,EAChC,iBAAiB,IAAI,SAAS,EAC9B,kBAAkB,IAAI,UAAU,EAChC,kBAAkB,IAAI,UAAU,EAChC,kBAAkB,IAAI,UAAU,EAChC,sBAAsB,IAAI,cAAc,EACxC,iBAAiB,IAAI,SAAS,GAC/B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var bo=Object.create;var T=Object.defineProperty;var po=Object.getOwnPropertyDescriptor;var co=Object.getOwnPropertyNames;var Co=Object.getPrototypeOf,uo=Object.prototype.hasOwnProperty;var xo=(e,r)=>{for(var t in r)T(e,t,{get:r[t],enumerable:!0})},oo=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of co(r))!uo.call(e,n)&&n!==t&&T(e,n,{get:()=>r[n],enumerable:!(a=po(r,n))||a.enumerable});return e};var D=(e,r,t)=>(t=e!=null?bo(Co(e)):{},oo(r||!e||!e.__esModule?T(t,"default",{value:e,enumerable:!0}):t,e)),fo=e=>oo(T({},"__esModule",{value:!0}),e);var Po={};xo(Po,{Content:()=>A,Empty:()=>H,Group:()=>q,Input:()=>j,Item:()=>Q,Label:()=>J,List:()=>$,Root:()=>B,Separator:()=>K,Trigger:()=>W,Value:()=>w});module.exports=fo(Po);var o=D(require("react")),p=D(require("classnames")),L=require("radix-ui/internal"),v=require("cmdk"),G=require("../helpers/extract-props.js"),d=require("./combobox.props.js"),ao=require("../props/margin.props.js"),z=require("./icons.js"),M=require("./theme.js"),no=require("../helpers/require-react-element.js"),F=D(require("./popover.js")),so=require("./scroll-area.js"),io=require("./slot.js"),ho=require("./text-field.props.js");const eo=o.createContext(null),E=e=>{const r=o.useContext(eo);if(!r)throw new Error(`${e} must be used within Combobox.Root`);return r},to=o.createContext(null),ro=()=>o.useContext(to),B=e=>{const{children:r,size:t=d.comboboxRootPropDefs.size.default,highContrast:a=d.comboboxRootPropDefs.highContrast.default,value:n,defaultValue:l=null,onValueChange:c,open:m,defaultOpen:i=!1,onOpenChange:C,placeholder:u="Select an option",searchPlaceholder:x="Search options...",searchValue:f,defaultSearchValue:P="",onSearchValueChange:g,filter:b,shouldFilter:h=!0,loop:s=!0,disabled:y,...O}=e,[R,I]=(0,L.useControllableState)({prop:m,defaultProp:i,onChange:C}),[S,V]=(0,L.useControllableState)({prop:n,defaultProp:l,onChange:c}),[U,N]=(0,L.useControllableState)({prop:f,defaultProp:P,onChange:g}),X=o.useRef(new Map),Y=o.useCallback((k,mo)=>{X.current.set(k,mo)},[]),Z=S!=null?X.current.get(S):void 0,_=o.useCallback(k=>{V(k),I(!1),N("")},[I,N,V]),lo=o.useMemo(()=>({size:t,highContrast:a,placeholder:u,searchPlaceholder:x,filter:b,shouldFilter:h,loop:s,disabled:y,open:R,setOpen:I,value:S,setValue:V,searchValue:U,setSearchValue:N,selectedLabel:Z,registerItemLabel:Y,handleSelect:_}),[t,a,u,x,b,h,s,y,R,I,S,V,U,N,Z,Y,_]);return o.createElement(eo.Provider,{value:lo},o.createElement(F.Root,{open:R,onOpenChange:I,...O},r))};B.displayName="Combobox.Root";const W=o.forwardRef((e,r)=>{const t=E("Combobox.Trigger"),{children:a,className:n,placeholder:l,disabled:c,readOnly:m,error:i,loading:C,color:u,radius:x,...f}=(0,G.extractProps)({size:t.size,highContrast:t.highContrast,...e},{size:d.comboboxRootPropDefs.size,highContrast:d.comboboxRootPropDefs.highContrast},d.comboboxTriggerPropDefs,ao.marginPropDefs),{material:P,panelBackground:g}=e,b=c??t.disabled,h=o.useMemo(()=>({"aria-expanded":t.open,"aria-disabled":b||void 0,"aria-haspopup":"listbox"}),[t.open,b]),s=o.createElement(o.Fragment,null,o.createElement("span",{className:"rt-SelectTriggerInner"},o.createElement(w,{placeholder:l??t.placeholder})),C?o.createElement("div",{className:"rt-SelectIcon rt-SelectLoadingIcon","aria-hidden":"true"},o.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},o.createElement("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"6 34",strokeDashoffset:"0",className:"rt-SelectLoadingSpinner"}))):o.createElement(z.ChevronDownIcon,{className:"rt-SelectIcon"})),{type:y,...O}=f,I=o.createElement("button",{"data-accent-color":u,"data-radius":x,"data-panel-background":g,"data-material":P,"data-error":i,"data-loading":C,"data-disabled":b||void 0,"data-read-only":m||void 0,...O,...h,type:y??"button",disabled:b,ref:r,className:(0,p.default)("rt-reset","rt-SelectTrigger","rt-ComboboxTrigger",n)},a?(0,no.requireReactElement)(a):s);return o.createElement(F.Trigger,{disabled:b},I)});W.displayName="Combobox.Trigger";const w=o.forwardRef(({placeholder:e,children:r,className:t,...a},n)=>{const l=E("Combobox.Value"),c=l.selectedLabel??l.value??void 0,m=e??l.placeholder;return o.createElement("span",{...a,ref:n,className:(0,p.default)("rt-ComboboxValue",t)},c??r??m)});w.displayName="Combobox.Value";const A=o.forwardRef((e,r)=>{const t=E("Combobox.Content"),a=(0,M.useThemeContext)(),n=a.panelBackground,l=e.size??t.size??d.comboboxContentPropDefs.size.default,c=e.variant??d.comboboxContentPropDefs.variant.default,m=e.highContrast??t.highContrast??d.comboboxContentPropDefs.highContrast.default,{className:i,children:C,color:u,forceMount:x,container:f,...P}=(0,G.extractProps)({...e,size:l,variant:c,highContrast:m},d.comboboxContentPropDefs),g=u||a.accentColor;let b=i;return typeof l=="string"&&(b=i?.split(/\s+/).filter(Boolean).filter(h=>!/^rt-r-size-\d$/.test(h)).join(" ")||void 0),o.createElement(F.Content,{size:l,"data-accent-color":g,"data-material":n,"data-panel-background":n,align:"start",sideOffset:4,collisionPadding:10,...P,forceMount:x,container:f,ref:r,className:(0,p.default)("rt-PopperContent","rt-BaseMenuContent","rt-ComboboxContent",b)},o.createElement(M.Theme,{asChild:!0},o.createElement(to.Provider,{value:{variant:c,size:String(l),color:g,material:n,highContrast:m}},o.createElement(v.Command,{loop:t.loop,value:t.searchValue,onValueChange:t.setSearchValue,shouldFilter:t.shouldFilter,filter:t.filter,className:"rt-ComboboxCommand"},C))))});A.displayName="Combobox.Content";const j=o.forwardRef(({className:e,startAdornment:r,endAdornment:t,placeholder:a,variant:n,...l},c)=>{const m=E("Combobox.Input"),i=ro(),C=i?.variant??"solid",u=i?.color,x=i?.material,f=n??(C==="solid"?"surface":"soft"),P=o.createElement("div",{className:(0,p.default)("rt-TextFieldRoot","rt-ComboboxInputRoot",`rt-r-size-${m.size}`,`rt-variant-${f}`),"data-accent-color":u,"data-material":x,"data-panel-background":x},r?o.createElement("div",{className:"rt-TextFieldSlot"},r):null,o.createElement(v.Command.Input,{...l,ref:c,placeholder:a??m.searchPlaceholder,className:(0,p.default)("rt-reset","rt-TextFieldInput",e)}),t?o.createElement("div",{className:"rt-TextFieldSlot","data-side":"right"},t):null);return i?o.createElement("div",{className:"rt-ComboboxSearch"},P):P});j.displayName="Combobox.Input";const $=o.forwardRef(({className:e,...r},t)=>o.createElement(so.ScrollArea,{type:"auto",className:"rt-ComboboxScrollArea",scrollbars:"vertical",size:"1"},o.createElement("div",{className:(0,p.default)("rt-BaseMenuViewport","rt-ComboboxViewport")},o.createElement(v.Command.List,{...r,ref:t,className:(0,p.default)("rt-ComboboxList",e)}))));$.displayName="Combobox.List";const H=o.forwardRef(({className:e,...r},t)=>o.createElement(v.Command.Empty,{...r,ref:t,className:(0,p.default)("rt-ComboboxEmpty",e)}));H.displayName="Combobox.Empty";const q=o.forwardRef(({className:e,...r},t)=>o.createElement(v.Command.Group,{...r,ref:t,className:(0,p.default)("rt-BaseMenuGroup","rt-ComboboxGroup",e)}));q.displayName="Combobox.Group";const J=o.forwardRef(({className:e,...r},t)=>o.createElement("div",{...r,ref:t,className:(0,p.default)("rt-BaseMenuLabel","rt-ComboboxLabel",e)}));J.displayName="Combobox.Label";const K=o.forwardRef(({className:e,...r},t)=>o.createElement(v.Command.Separator,{...r,ref:t,className:(0,p.default)("rt-BaseMenuSeparator","rt-ComboboxSeparator",e)}));K.displayName="Combobox.Separator";const Q=o.forwardRef(({className:e,children:r,label:t,value:a,disabled:n,onSelect:l,...c},m)=>{const i=E("Combobox.Item"),C=ro(),u=t??(typeof r=="string"?r:String(a)),x=a!=null&&i.value===a,f=C?.size?`rt-r-size-${C.size}`:void 0;o.useEffect(()=>{a&&i.registerItemLabel(a,u)},[i,a,u]);const P=o.useCallback(s=>{i.handleSelect(s),l?.(s)},[i,l]),g=n??i.disabled??!1,b=o.useRef(null),h=o.useCallback(s=>{b.current=s,typeof m=="function"?m(s):m&&(m.current=s)},[m]);return o.useEffect(()=>{if(!g&&b.current){const s=b.current;(s.getAttribute("data-disabled")==="false"||s.getAttribute("data-disabled")==="")&&s.removeAttribute("data-disabled");const y=new MutationObserver(()=>{(s.getAttribute("data-disabled")==="false"||s.getAttribute("data-disabled")==="")&&s.removeAttribute("data-disabled")});return y.observe(s,{attributes:!0,attributeFilter:["data-disabled"]}),()=>y.disconnect()}},[g]),o.createElement(v.Command.Item,{...c,value:a,...g?{disabled:!0}:{},ref:h,onSelect:P,className:(0,p.default)("rt-reset","rt-BaseMenuItem","rt-ComboboxItem",e)},x?o.createElement("span",{className:(0,p.default)("rt-BaseMenuItemIndicator","rt-ComboboxItemIndicator",f)},o.createElement(z.ThickCheckIcon,{className:(0,p.default)("rt-BaseMenuItemIndicatorIcon","rt-ComboboxItemIndicatorIcon",f)})):null,o.createElement(io.Slottable,null,r))});Q.displayName="Combobox.Item";
|
|
2
2
|
//# sourceMappingURL=combobox.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/combobox.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useControllableState } from 'radix-ui/internal';\nimport { Command as CommandPrimitive } from 'cmdk';\n\nimport { extractProps } from '../helpers/extract-props.js';\nimport { comboboxRootPropDefs, comboboxTriggerPropDefs, comboboxContentPropDefs } from './combobox.props.js';\nimport { marginPropDefs } from '../props/margin.props.js';\nimport { ChevronDownIcon, ThickCheckIcon } from './icons.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport * as Popover from './popover.js';\nimport { ScrollArea } from './scroll-area.js';\nimport { Slottable } from './slot.js';\nimport { textFieldRootPropDefs } from './text-field.props.js';\n\nimport type { MarginProps } from '../props/margin.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype TextFieldVariant = (typeof textFieldRootPropDefs.variant.values)[number];\ntype ComboboxValue = string | null;\ntype CommandFilter = (value: string, search: string, keywords?: string[]) => number;\n\ntype ComboboxRootOwnProps = GetPropDefTypes<typeof comboboxRootPropDefs> & {\n value?: ComboboxValue;\n defaultValue?: ComboboxValue;\n onValueChange?: (value: ComboboxValue) => void;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n placeholder?: string;\n searchPlaceholder?: string;\n searchValue?: string;\n defaultSearchValue?: string;\n onSearchValueChange?: (value: string) => void;\n filter?: CommandFilter;\n shouldFilter?: boolean;\n loop?: boolean;\n disabled?: boolean;\n};\n\ninterface ComboboxContextValue extends ComboboxRootOwnProps {\n open: boolean;\n setOpen: (open: boolean) => void;\n value: ComboboxValue;\n setValue: (value: ComboboxValue) => void;\n searchValue: string;\n setSearchValue: (value: string) => void;\n selectedLabel?: string;\n registerItemLabel: (value: string, label: string) => void;\n handleSelect: (value: string) => void;\n}\n\nconst ComboboxContext = React.createContext<ComboboxContextValue | null>(null);\nconst useComboboxContext = (caller: string) => {\n const ctx = React.useContext(ComboboxContext);\n if (!ctx) {\n throw new Error(`${caller} must be used within Combobox.Root`);\n }\n return ctx;\n};\n\nconst ComboboxContentContext = React.createContext<{ variant: 'solid' | 'soft'; size?: string; color?: string; material?: string } | null>(null);\nconst useComboboxContentContext = () => {\n const ctx = React.useContext(ComboboxContentContext);\n return ctx; // Optional - Input might not always be in Content\n};\n\ntype PopoverRootProps = React.ComponentPropsWithoutRef<typeof Popover.Root>;\ninterface ComboboxRootProps extends PopoverRootProps, ComboboxRootOwnProps {}\nconst ComboboxRoot: React.FC<ComboboxRootProps> = (props) => {\n const {\n children,\n size = comboboxRootPropDefs.size.default,\n value: valueProp,\n defaultValue = null,\n onValueChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n placeholder = 'Select an option',\n searchPlaceholder = 'Search options...',\n searchValue: searchValueProp,\n defaultSearchValue = '',\n onSearchValueChange,\n filter,\n shouldFilter = true,\n loop = true,\n disabled,\n ...rootProps\n } = props;\n\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const [value, setValue] = useControllableState<ComboboxValue>({\n prop: valueProp ?? null,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n const [searchValue, setSearchValue] = useControllableState<string>({\n prop: searchValueProp,\n defaultProp: defaultSearchValue,\n onChange: onSearchValueChange,\n });\n\n const labelMapRef = React.useRef(new Map<string, string>());\n const registerItemLabel = React.useCallback((itemValue: string, label: string) => {\n labelMapRef.current.set(itemValue, label);\n }, []);\n\n const selectedLabel = value != null ? labelMapRef.current.get(value) : undefined;\n\n const handleSelect = React.useCallback(\n (nextValue: string) => {\n setValue(nextValue);\n setOpen(false);\n setSearchValue('');\n },\n [setOpen, setSearchValue, setValue],\n );\n\n const contextValue = React.useMemo<ComboboxContextValue>(\n () => ({\n size,\n placeholder,\n searchPlaceholder,\n filter,\n shouldFilter,\n loop,\n disabled,\n open,\n setOpen,\n value,\n setValue,\n searchValue,\n setSearchValue,\n selectedLabel,\n registerItemLabel,\n handleSelect,\n }),\n [size, placeholder, searchPlaceholder, filter, shouldFilter, loop, disabled, open, setOpen, value, setValue, searchValue, setSearchValue, selectedLabel, registerItemLabel, handleSelect],\n );\n\n return (\n <ComboboxContext.Provider value={contextValue}>\n <Popover.Root open={open} onOpenChange={setOpen} {...rootProps}>\n {children}\n </Popover.Root>\n </ComboboxContext.Provider>\n );\n};\nComboboxRoot.displayName = 'Combobox.Root';\n\ntype ComboboxTriggerElement = HTMLButtonElement;\ntype ComboboxTriggerOwnProps = GetPropDefTypes<typeof comboboxTriggerPropDefs>;\ntype NativeTriggerProps = Omit<React.ComponentPropsWithoutRef<'button'>, 'color'>;\ninterface ComboboxTriggerProps extends NativeTriggerProps, MarginProps, ComboboxTriggerOwnProps {}\nconst ComboboxTrigger = React.forwardRef<ComboboxTriggerElement, ComboboxTriggerProps>((props, forwardedRef) => {\n const context = useComboboxContext('Combobox.Trigger');\n const { children, className, placeholder, disabled, readOnly, ...triggerProps } = extractProps(\n { size: context.size, ...props },\n { size: comboboxRootPropDefs.size },\n comboboxTriggerPropDefs,\n marginPropDefs,\n );\n\n const isDisabled = disabled ?? context.disabled;\n const ariaProps = React.useMemo(\n () => ({\n 'aria-expanded': context.open,\n 'aria-disabled': isDisabled || undefined,\n 'aria-haspopup': 'listbox' as const,\n }),\n [context.open, isDisabled],\n );\n\n const defaultContent = (\n <>\n <span className=\"rt-SelectTriggerInner\">\n <ComboboxValue placeholder={placeholder ?? context.placeholder} />\n </span>\n <ChevronDownIcon className=\"rt-SelectIcon\" />\n </>\n );\n\n const triggerChild = (\n <button\n data-disabled={isDisabled || undefined}\n data-read-only={readOnly || undefined}\n {...triggerProps}\n {...ariaProps}\n ref={forwardedRef}\n className={classNames('rt-reset', 'rt-SelectTrigger', 'rt-ComboboxTrigger', className)}\n >\n {children ? requireReactElement(children) : defaultContent}\n </button>\n );\n\n return <Popover.Trigger disabled={isDisabled}>{triggerChild}</Popover.Trigger>;\n});\nComboboxTrigger.displayName = 'Combobox.Trigger';\n\ntype ComboboxValueElement = HTMLSpanElement;\ninterface ComboboxValueProps extends React.ComponentPropsWithoutRef<'span'> {\n placeholder?: string;\n}\nconst ComboboxValue = React.forwardRef<ComboboxValueElement, ComboboxValueProps>(({ placeholder, children, className, ...valueProps }, forwardedRef) => {\n const context = useComboboxContext('Combobox.Value');\n const displayValue = context.selectedLabel ?? context.value ?? undefined;\n const fallback = placeholder ?? context.placeholder;\n return (\n <span {...valueProps} ref={forwardedRef} className={classNames('rt-ComboboxValue', className)}>\n {displayValue ?? children ?? fallback}\n </span>\n );\n});\nComboboxValue.displayName = 'Combobox.Value';\n\ntype ComboboxContentElement = React.ElementRef<typeof Popover.Content>;\ntype ComboboxContentOwnProps = GetPropDefTypes<typeof comboboxContentPropDefs> & {\n container?: React.ComponentPropsWithoutRef<typeof Popover.Content>['container'];\n};\ninterface ComboboxContentProps extends Omit<ComponentPropsWithout<typeof Popover.Content, RemovedProps>, 'size'>, ComboboxContentOwnProps {}\nconst ComboboxContent = React.forwardRef<ComboboxContentElement, ComboboxContentProps>((props, forwardedRef) => {\n const context = useComboboxContext('Combobox.Content');\n const themeContext = useThemeContext();\n const effectiveMaterial = themeContext.panelBackground;\n\n const sizeProp = props.size ?? context.size ?? comboboxContentPropDefs.size.default;\n const variantProp = props.variant ?? comboboxContentPropDefs.variant.default;\n const highContrastProp = props.highContrast ?? comboboxContentPropDefs.highContrast.default;\n\n const { className, children, color, forceMount, container, ...contentProps } = extractProps(\n { ...props, size: sizeProp, variant: variantProp, highContrast: highContrastProp },\n comboboxContentPropDefs,\n );\n const resolvedColor = color || themeContext.accentColor;\n let sanitizedClassName = className;\n if (typeof sizeProp === 'string') {\n sanitizedClassName =\n className\n ?.split(/\\s+/)\n .filter(Boolean)\n .filter((token) => !/^rt-r-size-\\d$/.test(token))\n .join(' ') || undefined;\n }\n\n return (\n <Popover.Content\n size={sizeProp}\n data-accent-color={resolvedColor}\n data-material={effectiveMaterial}\n data-panel-background={effectiveMaterial}\n align=\"start\"\n sideOffset={4}\n collisionPadding={10}\n {...contentProps}\n forceMount={forceMount}\n container={container}\n ref={forwardedRef}\n className={classNames('rt-PopperContent', 'rt-BaseMenuContent', 'rt-ComboboxContent', sanitizedClassName)}\n >\n <Theme asChild>\n <ScrollArea type=\"auto\">\n <div className={classNames('rt-BaseMenuViewport', 'rt-ComboboxViewport')}>\n <ComboboxContentContext.Provider value={{ variant: variantProp, size: String(sizeProp), color: resolvedColor, material: effectiveMaterial }}>\n <CommandPrimitive\n loop={context.loop}\n value={context.searchValue}\n onValueChange={context.setSearchValue}\n shouldFilter={context.shouldFilter}\n filter={context.filter}\n className=\"rt-ComboboxCommand\"\n >\n {children}\n </CommandPrimitive>\n </ComboboxContentContext.Provider>\n </div>\n </ScrollArea>\n </Theme>\n </Popover.Content>\n );\n});\nComboboxContent.displayName = 'Combobox.Content';\n\ntype ComboboxInputElement = React.ElementRef<typeof CommandPrimitive.Input>;\ninterface ComboboxInputProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input> {\n startAdornment?: React.ReactNode;\n endAdornment?: React.ReactNode;\n variant?: TextFieldVariant;\n}\nconst ComboboxInput = React.forwardRef<ComboboxInputElement, ComboboxInputProps>(({ className, startAdornment, endAdornment, placeholder, variant: inputVariant, ...inputProps }, forwardedRef) => {\n const context = useComboboxContext('Combobox.Input');\n const contentContext = useComboboxContentContext();\n const contentVariant = contentContext?.variant ?? 'solid';\n const color = contentContext?.color;\n const material = contentContext?.material;\n\n // Map combobox variant to textfield variant: solid -> surface, soft -> soft unless overridden\n const textFieldVariant = inputVariant ?? (contentVariant === 'solid' ? 'surface' : 'soft');\n\n return (\n <div\n className={classNames('rt-TextFieldRoot', 'rt-ComboboxInputRoot', `rt-r-size-${context.size}`, `rt-variant-${textFieldVariant}`)}\n data-accent-color={color}\n data-material={material}\n data-panel-background={material}\n >\n {startAdornment ? <div className=\"rt-TextFieldSlot\">{startAdornment}</div> : null}\n <CommandPrimitive.Input {...inputProps} ref={forwardedRef} placeholder={placeholder ?? context.searchPlaceholder} className={classNames('rt-reset', 'rt-TextFieldInput', className)} />\n {endAdornment ? (\n <div className=\"rt-TextFieldSlot\" data-side=\"right\">\n {endAdornment}\n </div>\n ) : null}\n </div>\n );\n});\nComboboxInput.displayName = 'Combobox.Input';\n\ntype ComboboxListElement = React.ElementRef<typeof CommandPrimitive.List>;\ninterface ComboboxListProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.List> {}\nconst ComboboxList = React.forwardRef<ComboboxListElement, ComboboxListProps>(({ className, ...listProps }, forwardedRef) => (\n <CommandPrimitive.List {...listProps} ref={forwardedRef} className={classNames('rt-ComboboxList', className)} />\n));\nComboboxList.displayName = 'Combobox.List';\n\ntype ComboboxEmptyElement = React.ElementRef<typeof CommandPrimitive.Empty>;\ninterface ComboboxEmptyProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty> {}\nconst ComboboxEmpty = React.forwardRef<ComboboxEmptyElement, ComboboxEmptyProps>(({ className, ...emptyProps }, forwardedRef) => (\n <CommandPrimitive.Empty {...emptyProps} ref={forwardedRef} className={classNames('rt-ComboboxEmpty', className)} />\n));\nComboboxEmpty.displayName = 'Combobox.Empty';\n\ntype ComboboxGroupElement = React.ElementRef<typeof CommandPrimitive.Group>;\ninterface ComboboxGroupProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group> {}\nconst ComboboxGroup = React.forwardRef<ComboboxGroupElement, ComboboxGroupProps>(({ className, ...groupProps }, forwardedRef) => (\n <CommandPrimitive.Group {...groupProps} ref={forwardedRef} className={classNames('rt-BaseMenuGroup', 'rt-ComboboxGroup', className)} />\n));\nComboboxGroup.displayName = 'Combobox.Group';\n\ntype ComboboxLabelElement = React.ElementRef<'div'>;\ninterface ComboboxLabelProps extends React.ComponentPropsWithoutRef<'div'> {}\nconst ComboboxLabel = React.forwardRef<ComboboxLabelElement, ComboboxLabelProps>(({ className, ...labelProps }, forwardedRef) => (\n <div {...labelProps} ref={forwardedRef} className={classNames('rt-BaseMenuLabel', 'rt-ComboboxLabel', className)} />\n));\nComboboxLabel.displayName = 'Combobox.Label';\n\ntype ComboboxSeparatorElement = React.ElementRef<typeof CommandPrimitive.Separator>;\ninterface ComboboxSeparatorProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator> {}\nconst ComboboxSeparator = React.forwardRef<ComboboxSeparatorElement, ComboboxSeparatorProps>(({ className, ...separatorProps }, forwardedRef) => (\n <CommandPrimitive.Separator {...separatorProps} ref={forwardedRef} className={classNames('rt-BaseMenuSeparator', 'rt-ComboboxSeparator', className)} />\n));\nComboboxSeparator.displayName = 'Combobox.Separator';\n\ntype ComboboxItemElement = React.ElementRef<typeof CommandPrimitive.Item>;\ninterface ComboboxItemProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item> {\n label?: string;\n}\nconst ComboboxItem = React.forwardRef<ComboboxItemElement, ComboboxItemProps>(({ className, children, label, value, disabled, onSelect, ...itemProps }, forwardedRef) => {\n const context = useComboboxContext('Combobox.Item');\n const contentContext = useComboboxContentContext();\n const itemLabel = label ?? (typeof children === 'string' ? children : String(value));\n const isSelected = value != null && context.value === value;\n const sizeClass = contentContext?.size ? `rt-r-size-${contentContext.size}` : undefined;\n\n React.useEffect(() => {\n if (value) {\n context.registerItemLabel(value, itemLabel);\n }\n }, [context, value, itemLabel]);\n\n const handleSelect = React.useCallback(\n (selectedValue: string) => {\n context.handleSelect(selectedValue);\n onSelect?.(selectedValue);\n },\n [context, onSelect],\n );\n\n const isDisabled = disabled ?? context.disabled ?? false;\n\n // Internal ref to clean up data-disabled attribute\n const internalRef = React.useRef<ComboboxItemElement | null>(null);\n\n // Ref callback to handle both forwarded ref and internal ref\n const itemRef = React.useCallback(\n (node: ComboboxItemElement | null) => {\n internalRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n (forwardedRef as React.MutableRefObject<ComboboxItemElement | null>).current = node;\n }\n },\n [forwardedRef],\n );\n\n // Remove data-disabled attribute if cmdk sets it incorrectly\n React.useEffect(() => {\n if (!isDisabled && internalRef.current) {\n const node = internalRef.current;\n // Check and remove immediately\n if (node.getAttribute('data-disabled') === 'false' || node.getAttribute('data-disabled') === '') {\n node.removeAttribute('data-disabled');\n }\n // Also watch for changes\n const observer = new MutationObserver(() => {\n if (node.getAttribute('data-disabled') === 'false' || node.getAttribute('data-disabled') === '') {\n node.removeAttribute('data-disabled');\n }\n });\n observer.observe(node, { attributes: true, attributeFilter: ['data-disabled'] });\n return () => observer.disconnect();\n }\n }, [isDisabled]);\n\n return (\n <CommandPrimitive.Item\n {...itemProps}\n value={value}\n {...(isDisabled ? { disabled: true } : {})}\n ref={itemRef}\n onSelect={handleSelect}\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-ComboboxItem', className)}\n >\n {isSelected ? (\n <span className={classNames('rt-BaseMenuItemIndicator', 'rt-ComboboxItemIndicator', sizeClass)}>\n <ThickCheckIcon className={classNames('rt-BaseMenuItemIndicatorIcon', 'rt-ComboboxItemIndicatorIcon', sizeClass)} />\n </span>\n ) : null}\n <Slottable>{children}</Slottable>\n </CommandPrimitive.Item>\n );\n});\nComboboxItem.displayName = 'Combobox.Item';\n\nexport {\n ComboboxRoot as Root,\n ComboboxTrigger as Trigger,\n ComboboxValue as Value,\n ComboboxContent as Content,\n ComboboxInput as Input,\n ComboboxList as List,\n ComboboxEmpty as Empty,\n ComboboxGroup as Group,\n ComboboxLabel as Label,\n ComboboxSeparator as Separator,\n ComboboxItem as Item,\n};\nexport type {\n ComboboxRootProps as RootProps,\n ComboboxTriggerProps as TriggerProps,\n ComboboxContentProps as ContentProps,\n ComboboxInputProps as InputProps,\n ComboboxListProps as ListProps,\n ComboboxEmptyProps as EmptyProps,\n ComboboxGroupProps as GroupProps,\n ComboboxLabelProps as LabelProps,\n ComboboxSeparatorProps as SeparatorProps,\n ComboboxItemProps as ItemProps,\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["combobox_exports", "__export", "ComboboxContent", "ComboboxEmpty", "ComboboxGroup", "ComboboxInput", "ComboboxItem", "ComboboxLabel", "ComboboxList", "ComboboxRoot", "ComboboxSeparator", "ComboboxTrigger", "ComboboxValue", "__toCommonJS", "React", "import_classnames", "import_internal", "import_cmdk", "import_extract_props", "import_combobox_props", "import_margin_props", "import_icons", "import_theme", "import_require_react_element", "Popover", "import_scroll_area", "import_slot", "import_text_field_props", "ComboboxContext", "useComboboxContext", "caller", "ctx", "ComboboxContentContext", "useComboboxContentContext", "props", "children", "size", "valueProp", "defaultValue", "onValueChange", "openProp", "defaultOpen", "onOpenChange", "placeholder", "searchPlaceholder", "searchValueProp", "defaultSearchValue", "onSearchValueChange", "filter", "shouldFilter", "loop", "disabled", "rootProps", "open", "setOpen", "value", "setValue", "searchValue", "setSearchValue", "labelMapRef", "registerItemLabel", "itemValue", "label", "selectedLabel", "handleSelect", "nextValue", "contextValue", "forwardedRef", "context", "className", "readOnly", "triggerProps", "isDisabled", "ariaProps", "defaultContent", "triggerChild", "classNames", "valueProps", "displayValue", "fallback", "themeContext", "effectiveMaterial", "sizeProp", "variantProp", "highContrastProp", "
|
|
4
|
+
"sourcesContent": ["'use client';\n\n/**\n * Combobox is a compound component built on top of Popover and cmdk's Command list.\n * It mirrors the Select API while adding search-first behaviors including filtering,\n * async-friendly state management, and design token support for trigger, content,\n * and input variants.\n */\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useControllableState } from 'radix-ui/internal';\nimport { Command as CommandPrimitive } from 'cmdk';\n\nimport { extractProps } from '../helpers/extract-props.js';\nimport { comboboxRootPropDefs, comboboxTriggerPropDefs, comboboxContentPropDefs } from './combobox.props.js';\nimport { marginPropDefs } from '../props/margin.props.js';\nimport { ChevronDownIcon, ThickCheckIcon } from './icons.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport * as Popover from './popover.js';\nimport { ScrollArea } from './scroll-area.js';\nimport { Slottable } from './slot.js';\nimport { textFieldRootPropDefs } from './text-field.props.js';\n\nimport type { MarginProps } from '../props/margin.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype TextFieldVariant = (typeof textFieldRootPropDefs.variant.values)[number];\ntype ComboboxValue = string | null;\ntype CommandFilter = (value: string, search: string, keywords?: string[]) => number;\n\n/**\n * Additional props supported by Combobox.Root beyond the Radix Popover surface.\n */\ntype ComboboxRootOwnProps = GetPropDefTypes<typeof comboboxRootPropDefs> & {\n value?: ComboboxValue;\n defaultValue?: ComboboxValue;\n onValueChange?: (value: ComboboxValue) => void;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n placeholder?: string;\n searchPlaceholder?: string;\n searchValue?: string;\n defaultSearchValue?: string;\n onSearchValueChange?: (value: string) => void;\n filter?: CommandFilter;\n shouldFilter?: boolean;\n loop?: boolean;\n disabled?: boolean;\n};\n\n/**\n * Internal context shared by all sub-components to avoid prop drilling.\n */\ninterface ComboboxContextValue extends ComboboxRootOwnProps {\n open: boolean;\n setOpen: (open: boolean) => void;\n value: ComboboxValue;\n setValue: (value: ComboboxValue) => void;\n searchValue: string;\n setSearchValue: (value: string) => void;\n selectedLabel?: string;\n registerItemLabel: (value: string, label: string) => void;\n handleSelect: (value: string) => void;\n}\n\nconst ComboboxContext = React.createContext<ComboboxContextValue | null>(null);\n\n/**\n * Utility hook that ensures consumers are wrapped in Combobox.Root.\n */\nconst useComboboxContext = (caller: string) => {\n const ctx = React.useContext(ComboboxContext);\n if (!ctx) {\n throw new Error(`${caller} must be used within Combobox.Root`);\n }\n return ctx;\n};\n\n/**\n * Context for values that are only available inside Content (e.g., variant, color)\n * so that Input/Item can style themselves consistently.\n */\nconst ComboboxContentContext = React.createContext<{ variant: 'solid' | 'soft'; size?: string; color?: string; material?: string; highContrast?: boolean } | null>(null);\nconst useComboboxContentContext = () => {\n const ctx = React.useContext(ComboboxContentContext);\n return ctx; // Optional - Input might not always be in Content\n};\n\ntype PopoverRootProps = React.ComponentPropsWithoutRef<typeof Popover.Root>;\ninterface ComboboxRootProps extends PopoverRootProps, ComboboxRootOwnProps {}\n/**\n * Root component that wires up Popover behavior, controllable state,\n * and shared context for trigger/content/input sub-components.\n */\nconst ComboboxRoot: React.FC<ComboboxRootProps> = (props) => {\n const {\n children,\n size = comboboxRootPropDefs.size.default,\n highContrast = comboboxRootPropDefs.highContrast.default,\n value: valueProp,\n defaultValue = null,\n onValueChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n placeholder = 'Select an option',\n searchPlaceholder = 'Search options...',\n searchValue: searchValueProp,\n defaultSearchValue = '',\n onSearchValueChange,\n filter,\n shouldFilter = true,\n loop = true,\n disabled,\n ...rootProps\n } = props;\n\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const [value, setValue] = useControllableState<ComboboxValue>({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n const [searchValue, setSearchValue] = useControllableState<string>({\n prop: searchValueProp,\n defaultProp: defaultSearchValue,\n onChange: onSearchValueChange,\n });\n\n const labelMapRef = React.useRef(new Map<string, string>());\n const registerItemLabel = React.useCallback((itemValue: string, label: string) => {\n labelMapRef.current.set(itemValue, label);\n }, []);\n\n const selectedLabel = value != null ? labelMapRef.current.get(value) : undefined;\n\n const handleSelect = React.useCallback(\n (nextValue: string) => {\n setValue(nextValue);\n setOpen(false);\n setSearchValue('');\n },\n [setOpen, setSearchValue, setValue],\n );\n\n const contextValue = React.useMemo<ComboboxContextValue>(\n () => ({\n size,\n highContrast,\n placeholder,\n searchPlaceholder,\n filter,\n shouldFilter,\n loop,\n disabled,\n open,\n setOpen,\n value,\n setValue,\n searchValue,\n setSearchValue,\n selectedLabel,\n registerItemLabel,\n handleSelect,\n }),\n [\n size,\n highContrast,\n placeholder,\n searchPlaceholder,\n filter,\n shouldFilter,\n loop,\n disabled,\n open,\n setOpen,\n value,\n setValue,\n searchValue,\n setSearchValue,\n selectedLabel,\n registerItemLabel,\n handleSelect,\n ],\n );\n\n return (\n <ComboboxContext.Provider value={contextValue}>\n <Popover.Root open={open} onOpenChange={setOpen} {...rootProps}>\n {children}\n </Popover.Root>\n </ComboboxContext.Provider>\n );\n};\nComboboxRoot.displayName = 'Combobox.Root';\n\ntype ComboboxTriggerElement = HTMLButtonElement;\ntype ComboboxTriggerOwnProps = GetPropDefTypes<typeof comboboxTriggerPropDefs>;\ntype NativeTriggerProps = Omit<React.ComponentPropsWithoutRef<'button'>, 'color'>;\ninterface ComboboxTriggerProps extends NativeTriggerProps, MarginProps, ComboboxTriggerOwnProps {}\n/**\n * Trigger behaves like a styled button that opens the Popover,\n * syncing size/highContrast from Root while exposing select-like states.\n */\nconst ComboboxTrigger = React.forwardRef<ComboboxTriggerElement, ComboboxTriggerProps>((props, forwardedRef) => {\n const context = useComboboxContext('Combobox.Trigger');\n const { children, className, placeholder, disabled, readOnly, error, loading, color, radius, ...triggerProps } = extractProps(\n { size: context.size, highContrast: context.highContrast, ...props },\n { size: comboboxRootPropDefs.size, highContrast: comboboxRootPropDefs.highContrast },\n comboboxTriggerPropDefs,\n marginPropDefs,\n );\n\n // Extract material and panelBackground separately since they need to be passed as data attributes\n const { material, panelBackground } = props;\n\n const isDisabled = disabled ?? context.disabled;\n const ariaProps = React.useMemo(\n () => ({\n 'aria-expanded': context.open,\n 'aria-disabled': isDisabled || undefined,\n 'aria-haspopup': 'listbox' as const,\n }),\n [context.open, isDisabled],\n );\n\n const defaultContent = (\n <>\n <span className=\"rt-SelectTriggerInner\">\n <ComboboxValue placeholder={placeholder ?? context.placeholder} />\n </span>\n {loading ? (\n <div className=\"rt-SelectIcon rt-SelectLoadingIcon\" aria-hidden=\"true\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <circle cx=\"8\" cy=\"8\" r=\"6.5\" stroke=\"currentColor\" strokeWidth=\"1\" strokeLinecap=\"round\" strokeDasharray=\"6 34\" strokeDashoffset=\"0\" className=\"rt-SelectLoadingSpinner\" />\n </svg>\n </div>\n ) : (\n <ChevronDownIcon className=\"rt-SelectIcon\" />\n )}\n </>\n );\n\n const { type: buttonType, ...restTriggerProps } = triggerProps;\n const resolvedButtonType = buttonType ?? 'button';\n\n const triggerChild = (\n <button\n data-accent-color={color}\n data-radius={radius}\n data-panel-background={panelBackground}\n data-material={material}\n data-error={error}\n data-loading={loading}\n data-disabled={isDisabled || undefined}\n data-read-only={readOnly || undefined}\n {...restTriggerProps}\n {...ariaProps}\n type={resolvedButtonType}\n disabled={isDisabled}\n ref={forwardedRef}\n className={classNames('rt-reset', 'rt-SelectTrigger', 'rt-ComboboxTrigger', className)}\n >\n {children ? requireReactElement(children) : defaultContent}\n </button>\n );\n\n return <Popover.Trigger disabled={isDisabled}>{triggerChild}</Popover.Trigger>;\n});\nComboboxTrigger.displayName = 'Combobox.Trigger';\n\ntype ComboboxValueElement = HTMLSpanElement;\ninterface ComboboxValueProps extends React.ComponentPropsWithoutRef<'span'> {\n placeholder?: string;\n}\n/**\n * Value mirrors Select.Value by showing the selected item's label\n * or falling back to placeholder text supplied by the consumer or context.\n */\nconst ComboboxValue = React.forwardRef<ComboboxValueElement, ComboboxValueProps>(({ placeholder, children, className, ...valueProps }, forwardedRef) => {\n const context = useComboboxContext('Combobox.Value');\n const displayValue = context.selectedLabel ?? context.value ?? undefined;\n const fallback = placeholder ?? context.placeholder;\n return (\n <span {...valueProps} ref={forwardedRef} className={classNames('rt-ComboboxValue', className)}>\n {displayValue ?? children ?? fallback}\n </span>\n );\n});\nComboboxValue.displayName = 'Combobox.Value';\n\ntype ComboboxContentElement = React.ElementRef<typeof Popover.Content>;\ntype ComboboxContentOwnProps = GetPropDefTypes<typeof comboboxContentPropDefs> & {\n container?: React.ComponentPropsWithoutRef<typeof Popover.Content>['container'];\n};\ninterface ComboboxContentProps extends Omit<ComponentPropsWithout<typeof Popover.Content, RemovedProps>, 'size'>, ComboboxContentOwnProps {}\n/**\n * Content renders the dropdown surface, syncing tokens from the current Theme\n * and instantiating cmdk's Command list for roving focus + filtering.\n */\nconst ComboboxContent = React.forwardRef<ComboboxContentElement, ComboboxContentProps>((props, forwardedRef) => {\n const context = useComboboxContext('Combobox.Content');\n const themeContext = useThemeContext();\n const effectiveMaterial = themeContext.panelBackground;\n\n const sizeProp = props.size ?? context.size ?? comboboxContentPropDefs.size.default;\n const variantProp = props.variant ?? comboboxContentPropDefs.variant.default;\n const highContrastProp = props.highContrast ?? context.highContrast ?? comboboxContentPropDefs.highContrast.default;\n\n const { className, children, color, forceMount, container, ...contentProps } = extractProps(\n { ...props, size: sizeProp, variant: variantProp, highContrast: highContrastProp },\n comboboxContentPropDefs,\n );\n const resolvedColor = color || themeContext.accentColor;\n let sanitizedClassName = className;\n if (typeof sizeProp === 'string') {\n sanitizedClassName =\n className\n ?.split(/\\s+/)\n .filter(Boolean)\n .filter((token) => !/^rt-r-size-\\d$/.test(token))\n .join(' ') || undefined;\n }\n\n return (\n <Popover.Content\n size={sizeProp}\n data-accent-color={resolvedColor}\n data-material={effectiveMaterial}\n data-panel-background={effectiveMaterial}\n align=\"start\"\n sideOffset={4}\n collisionPadding={10}\n {...contentProps}\n forceMount={forceMount}\n container={container}\n ref={forwardedRef}\n className={classNames('rt-PopperContent', 'rt-BaseMenuContent', 'rt-ComboboxContent', sanitizedClassName)}\n >\n <Theme asChild>\n <ComboboxContentContext.Provider value={{ variant: variantProp, size: String(sizeProp), color: resolvedColor, material: effectiveMaterial, highContrast: highContrastProp }}>\n <CommandPrimitive\n loop={context.loop}\n value={context.searchValue}\n onValueChange={context.setSearchValue}\n shouldFilter={context.shouldFilter}\n filter={context.filter}\n className=\"rt-ComboboxCommand\"\n >\n {children}\n </CommandPrimitive>\n </ComboboxContentContext.Provider>\n </Theme>\n </Popover.Content>\n );\n});\nComboboxContent.displayName = 'Combobox.Content';\n\ntype ComboboxInputElement = React.ElementRef<typeof CommandPrimitive.Input>;\ninterface ComboboxInputProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input> {\n startAdornment?: React.ReactNode;\n endAdornment?: React.ReactNode;\n variant?: TextFieldVariant;\n}\n/**\n * Input composes TextField tokens with cmdk's Command.Input to provide\n * automatic focus management and optional adornments.\n */\nconst ComboboxInput = React.forwardRef<ComboboxInputElement, ComboboxInputProps>(({ className, startAdornment, endAdornment, placeholder, variant: inputVariant, ...inputProps }, forwardedRef) => {\n const context = useComboboxContext('Combobox.Input');\n const contentContext = useComboboxContentContext();\n const contentVariant = contentContext?.variant ?? 'solid';\n const color = contentContext?.color;\n const material = contentContext?.material;\n\n // Map combobox variant to textfield variant: solid -> surface, soft -> soft unless overridden\n const textFieldVariant = inputVariant ?? (contentVariant === 'solid' ? 'surface' : 'soft');\n\n const inputField = (\n <div\n className={classNames('rt-TextFieldRoot', 'rt-ComboboxInputRoot', `rt-r-size-${context.size}`, `rt-variant-${textFieldVariant}`)}\n data-accent-color={color}\n data-material={material}\n data-panel-background={material}\n >\n {startAdornment ? <div className=\"rt-TextFieldSlot\">{startAdornment}</div> : null}\n <CommandPrimitive.Input {...inputProps} ref={forwardedRef} placeholder={placeholder ?? context.searchPlaceholder} className={classNames('rt-reset', 'rt-TextFieldInput', className)} />\n {endAdornment ? (\n <div className=\"rt-TextFieldSlot\" data-side=\"right\">\n {endAdornment}\n </div>\n ) : null}\n </div>\n );\n\n if (contentContext) {\n return <div className=\"rt-ComboboxSearch\">{inputField}</div>;\n }\n\n return inputField;\n});\nComboboxInput.displayName = 'Combobox.Input';\n\ntype ComboboxListElement = React.ElementRef<typeof CommandPrimitive.List>;\ninterface ComboboxListProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.List> {}\n/**\n * List wraps cmdk's Command.List to inherit base menu styles and provides ScrollArea for the items.\n */\nconst ComboboxList = React.forwardRef<ComboboxListElement, ComboboxListProps>(({ className, ...listProps }, forwardedRef) => (\n <ScrollArea type=\"auto\" className=\"rt-ComboboxScrollArea\" scrollbars=\"vertical\" size=\"1\">\n <div className={classNames('rt-BaseMenuViewport', 'rt-ComboboxViewport')}>\n <CommandPrimitive.List {...listProps} ref={forwardedRef} className={classNames('rt-ComboboxList', className)} />\n </div>\n </ScrollArea>\n));\nComboboxList.displayName = 'Combobox.List';\n\ntype ComboboxEmptyElement = React.ElementRef<typeof CommandPrimitive.Empty>;\ninterface ComboboxEmptyProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty> {}\n/**\n * Empty renders when no options match the search query.\n */\nconst ComboboxEmpty = React.forwardRef<ComboboxEmptyElement, ComboboxEmptyProps>(({ className, ...emptyProps }, forwardedRef) => (\n <CommandPrimitive.Empty {...emptyProps} ref={forwardedRef} className={classNames('rt-ComboboxEmpty', className)} />\n));\nComboboxEmpty.displayName = 'Combobox.Empty';\n\ntype ComboboxGroupElement = React.ElementRef<typeof CommandPrimitive.Group>;\ninterface ComboboxGroupProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group> {}\n/**\n * Group and Label mirror menu semantics for subheadings inside the list.\n */\nconst ComboboxGroup = React.forwardRef<ComboboxGroupElement, ComboboxGroupProps>(({ className, ...groupProps }, forwardedRef) => (\n <CommandPrimitive.Group {...groupProps} ref={forwardedRef} className={classNames('rt-BaseMenuGroup', 'rt-ComboboxGroup', className)} />\n));\nComboboxGroup.displayName = 'Combobox.Group';\n\ntype ComboboxLabelElement = React.ElementRef<'div'>;\ninterface ComboboxLabelProps extends React.ComponentPropsWithoutRef<'div'> {}\nconst ComboboxLabel = React.forwardRef<ComboboxLabelElement, ComboboxLabelProps>(({ className, ...labelProps }, forwardedRef) => (\n <div {...labelProps} ref={forwardedRef} className={classNames('rt-BaseMenuLabel', 'rt-ComboboxLabel', className)} />\n));\nComboboxLabel.displayName = 'Combobox.Label';\n\ntype ComboboxSeparatorElement = React.ElementRef<typeof CommandPrimitive.Separator>;\ninterface ComboboxSeparatorProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator> {}\n/**\n * Separator visually divides logical sections of the option list.\n */\nconst ComboboxSeparator = React.forwardRef<ComboboxSeparatorElement, ComboboxSeparatorProps>(({ className, ...separatorProps }, forwardedRef) => (\n <CommandPrimitive.Separator {...separatorProps} ref={forwardedRef} className={classNames('rt-BaseMenuSeparator', 'rt-ComboboxSeparator', className)} />\n));\nComboboxSeparator.displayName = 'Combobox.Separator';\n\ntype ComboboxItemElement = React.ElementRef<typeof CommandPrimitive.Item>;\ninterface ComboboxItemProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item> {\n label?: string;\n}\n/**\n * Item wires cmdk's selection handling with Kookie UI tokens and\n * ensures labels are registered for displaying the current value.\n */\nconst ComboboxItem = React.forwardRef<ComboboxItemElement, ComboboxItemProps>(({ className, children, label, value, disabled, onSelect, ...itemProps }, forwardedRef) => {\n const context = useComboboxContext('Combobox.Item');\n const contentContext = useComboboxContentContext();\n const itemLabel = label ?? (typeof children === 'string' ? children : String(value));\n const isSelected = value != null && context.value === value;\n const sizeClass = contentContext?.size ? `rt-r-size-${contentContext.size}` : undefined;\n\n React.useEffect(() => {\n if (value) {\n context.registerItemLabel(value, itemLabel);\n }\n }, [context, value, itemLabel]);\n\n const handleSelect = React.useCallback(\n (selectedValue: string) => {\n context.handleSelect(selectedValue);\n onSelect?.(selectedValue);\n },\n [context, onSelect],\n );\n\n const isDisabled = disabled ?? context.disabled ?? false;\n\n // Internal ref to clean up data-disabled attribute\n const internalRef = React.useRef<ComboboxItemElement | null>(null);\n\n // Ref callback to handle both forwarded ref and internal ref\n const itemRef = React.useCallback(\n (node: ComboboxItemElement | null) => {\n internalRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n (forwardedRef as React.MutableRefObject<ComboboxItemElement | null>).current = node;\n }\n },\n [forwardedRef],\n );\n\n // Remove data-disabled attribute if cmdk sets it incorrectly\n React.useEffect(() => {\n if (!isDisabled && internalRef.current) {\n const node = internalRef.current;\n // Check and remove immediately\n if (node.getAttribute('data-disabled') === 'false' || node.getAttribute('data-disabled') === '') {\n node.removeAttribute('data-disabled');\n }\n // Also watch for changes\n const observer = new MutationObserver(() => {\n if (node.getAttribute('data-disabled') === 'false' || node.getAttribute('data-disabled') === '') {\n node.removeAttribute('data-disabled');\n }\n });\n observer.observe(node, { attributes: true, attributeFilter: ['data-disabled'] });\n return () => observer.disconnect();\n }\n }, [isDisabled]);\n\n return (\n <CommandPrimitive.Item\n {...itemProps}\n value={value}\n {...(isDisabled ? { disabled: true } : {})}\n ref={itemRef}\n onSelect={handleSelect}\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-ComboboxItem', className)}\n >\n {isSelected ? (\n <span className={classNames('rt-BaseMenuItemIndicator', 'rt-ComboboxItemIndicator', sizeClass)}>\n <ThickCheckIcon className={classNames('rt-BaseMenuItemIndicatorIcon', 'rt-ComboboxItemIndicatorIcon', sizeClass)} />\n </span>\n ) : null}\n <Slottable>{children}</Slottable>\n </CommandPrimitive.Item>\n );\n});\nComboboxItem.displayName = 'Combobox.Item';\n\nexport {\n ComboboxRoot as Root,\n ComboboxTrigger as Trigger,\n ComboboxValue as Value,\n ComboboxContent as Content,\n ComboboxInput as Input,\n ComboboxList as List,\n ComboboxEmpty as Empty,\n ComboboxGroup as Group,\n ComboboxLabel as Label,\n ComboboxSeparator as Separator,\n ComboboxItem as Item,\n};\nexport type {\n ComboboxRootProps as RootProps,\n ComboboxTriggerProps as TriggerProps,\n ComboboxContentProps as ContentProps,\n ComboboxInputProps as InputProps,\n ComboboxListProps as ListProps,\n ComboboxEmptyProps as EmptyProps,\n ComboboxGroupProps as GroupProps,\n ComboboxLabelProps as LabelProps,\n ComboboxSeparatorProps as SeparatorProps,\n ComboboxItemProps as ItemProps,\n};\n"],
|
|
5
|
+
"mappings": "slBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,EAAA,UAAAC,EAAA,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,GAAcyC,EAAY,QAAS,CACtC,MAAME,EAAOF,EAAY,SAErBE,EAAK,aAAa,eAAe,IAAM,SAAWA,EAAK,aAAa,eAAe,IAAM,KAC3FA,EAAK,gBAAgB,eAAe,EAGtC,MAAMC,EAAW,IAAI,iBAAiB,IAAM,EACtCD,EAAK,aAAa,eAAe,IAAM,SAAWA,EAAK,aAAa,eAAe,IAAM,KAC3FA,EAAK,gBAAgB,eAAe,CAExC,CAAC,EACD,OAAAC,EAAS,QAAQD,EAAM,CAAE,WAAY,GAAM,gBAAiB,CAAC,eAAe,CAAE,CAAC,EACxE,IAAMC,EAAS,WAAW,CACnC,CACF,EAAG,CAAC5C,CAAU,CAAC,EAGbjE,EAAA,cAAC,EAAAsF,QAAiB,KAAjB,CACE,GAAGe,EACJ,MAAO3D,EACN,GAAIuB,EAAa,CAAE,SAAU,EAAK,EAAI,CAAC,EACxC,IAAK0C,EACL,SAAUxD,EACV,aAAW,EAAAoB,SAAW,WAAY,kBAAmB,kBAAmBf,CAAS,GAEhF+C,EACCvG,EAAA,cAAC,QAAK,aAAW,EAAAuE,SAAW,2BAA4B,2BAA4BiC,CAAS,GAC3FxG,EAAA,cAAC,kBAAe,aAAW,EAAAuE,SAAW,+BAAgC,+BAAgCiC,CAAS,EAAG,CACpH,EACE,KACJxG,EAAA,cAAC,kBAAWqB,CAAS,CACvB,CAEJ,CAAC,EACD7B,EAAa,YAAc",
|
|
6
|
+
"names": ["combobox_exports", "__export", "ComboboxContent", "ComboboxEmpty", "ComboboxGroup", "ComboboxInput", "ComboboxItem", "ComboboxLabel", "ComboboxList", "ComboboxRoot", "ComboboxSeparator", "ComboboxTrigger", "ComboboxValue", "__toCommonJS", "React", "import_classnames", "import_internal", "import_cmdk", "import_extract_props", "import_combobox_props", "import_margin_props", "import_icons", "import_theme", "import_require_react_element", "Popover", "import_scroll_area", "import_slot", "import_text_field_props", "ComboboxContext", "useComboboxContext", "caller", "ctx", "ComboboxContentContext", "useComboboxContentContext", "props", "children", "size", "highContrast", "valueProp", "defaultValue", "onValueChange", "openProp", "defaultOpen", "onOpenChange", "placeholder", "searchPlaceholder", "searchValueProp", "defaultSearchValue", "onSearchValueChange", "filter", "shouldFilter", "loop", "disabled", "rootProps", "open", "setOpen", "value", "setValue", "searchValue", "setSearchValue", "labelMapRef", "registerItemLabel", "itemValue", "label", "selectedLabel", "handleSelect", "nextValue", "contextValue", "forwardedRef", "context", "className", "readOnly", "error", "loading", "color", "radius", "triggerProps", "material", "panelBackground", "isDisabled", "ariaProps", "defaultContent", "buttonType", "restTriggerProps", "triggerChild", "classNames", "valueProps", "displayValue", "fallback", "themeContext", "effectiveMaterial", "sizeProp", "variantProp", "highContrastProp", "forceMount", "container", "contentProps", "resolvedColor", "sanitizedClassName", "token", "CommandPrimitive", "startAdornment", "endAdornment", "inputVariant", "inputProps", "contentContext", "contentVariant", "textFieldVariant", "inputField", "listProps", "emptyProps", "groupProps", "labelProps", "separatorProps", "onSelect", "itemProps", "itemLabel", "isSelected", "sizeClass", "selectedValue", "internalRef", "itemRef", "node", "observer"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared responsive sizing + high contrast support inherited by Combobox.Root.
|
|
3
|
+
*/
|
|
1
4
|
declare const comboboxRootPropDefs: {
|
|
5
|
+
highContrast: {
|
|
6
|
+
type: "boolean";
|
|
7
|
+
className: string;
|
|
8
|
+
default: undefined;
|
|
9
|
+
};
|
|
2
10
|
size: {
|
|
3
11
|
type: "enum";
|
|
4
12
|
className: string;
|
|
@@ -7,6 +15,9 @@ declare const comboboxRootPropDefs: {
|
|
|
7
15
|
responsive: true;
|
|
8
16
|
};
|
|
9
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Token-aware props specific to Combobox.Trigger.
|
|
20
|
+
*/
|
|
10
21
|
declare const comboboxTriggerPropDefs: {
|
|
11
22
|
width: {
|
|
12
23
|
type: "string";
|
|
@@ -27,23 +38,6 @@ declare const comboboxTriggerPropDefs: {
|
|
|
27
38
|
values: readonly ["gray", "gold", "bronze", "brown", "yellow", "amber", "orange", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "lime", "mint", "sky"];
|
|
28
39
|
default: ("gray" | "gold" | "bronze" | "brown" | "yellow" | "amber" | "orange" | "tomato" | "red" | "ruby" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "indigo" | "blue" | "cyan" | "teal" | "jade" | "green" | "grass" | "lime" | "mint" | "sky") | undefined;
|
|
29
40
|
};
|
|
30
|
-
error: {
|
|
31
|
-
type: "boolean";
|
|
32
|
-
};
|
|
33
|
-
loading: {
|
|
34
|
-
type: "boolean";
|
|
35
|
-
};
|
|
36
|
-
disabled: {
|
|
37
|
-
type: "boolean";
|
|
38
|
-
};
|
|
39
|
-
readOnly: {
|
|
40
|
-
type: "boolean";
|
|
41
|
-
};
|
|
42
|
-
highContrast: {
|
|
43
|
-
type: "boolean";
|
|
44
|
-
className: string;
|
|
45
|
-
default: undefined;
|
|
46
|
-
};
|
|
47
41
|
variant: {
|
|
48
42
|
type: "enum";
|
|
49
43
|
className: string;
|
|
@@ -59,7 +53,22 @@ declare const comboboxTriggerPropDefs: {
|
|
|
59
53
|
type: "enum";
|
|
60
54
|
values: ("solid" | "translucent")[];
|
|
61
55
|
};
|
|
56
|
+
error: {
|
|
57
|
+
type: "boolean";
|
|
58
|
+
};
|
|
59
|
+
loading: {
|
|
60
|
+
type: "boolean";
|
|
61
|
+
};
|
|
62
|
+
disabled: {
|
|
63
|
+
type: "boolean";
|
|
64
|
+
};
|
|
65
|
+
readOnly: {
|
|
66
|
+
type: "boolean";
|
|
67
|
+
};
|
|
62
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* Styling props for the dropdown surface rendered by Combobox.Content.
|
|
71
|
+
*/
|
|
63
72
|
declare const comboboxContentPropDefs: {
|
|
64
73
|
highContrast: {
|
|
65
74
|
type: "boolean";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.props.d.ts","sourceRoot":"","sources":["../../../src/components/combobox.props.tsx"],"names":[],"mappings":"AASA,QAAA,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"combobox.props.d.ts","sourceRoot":"","sources":["../../../src/components/combobox.props.tsx"],"names":[],"mappings":"AASA;;GAEG;AACH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;CAMzB,CAAC;AAIF;;GAEG;AACH,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B5B,CAAC;AAIF;;GAEG;AACH,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;CAQ5B,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var P=(o,e)=>{for(var t in e)s(o,t,{get:e[t],enumerable:!0})},y=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of b(e))!D.call(o,r)&&r!==t&&s(o,r,{get:()=>e[r],enumerable:!(i=d(e,r))||i.enumerable});return o};var g=o=>y(s({},"__esModule",{value:!0}),o);var z={};P(z,{comboboxContentPropDefs:()=>m,comboboxRootPropDefs:()=>c,comboboxTriggerPropDefs:()=>u});module.exports=g(z);var a=require("../props/color.prop.js"),n=require("../props/high-contrast.prop.js"),l=require("../props/radius.prop.js"),f=require("../props/width.props.js");const p=["1","2","3"],c={size:{type:"enum",className:"rt-r-size",values:p,default:"2",responsive:!0}},v=["classic","surface","soft","outline","ghost"],u={variant:{type:"enum",className:"rt-variant",values:v,default:"surface"},panelBackground:{type:"enum",className:"rt-panel-background",values:["solid","translucent"]},material:{type:"enum",values:["solid","translucent"]}
|
|
1
|
+
"use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var P=(o,e)=>{for(var t in e)s(o,t,{get:e[t],enumerable:!0})},y=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of b(e))!D.call(o,r)&&r!==t&&s(o,r,{get:()=>e[r],enumerable:!(i=d(e,r))||i.enumerable});return o};var g=o=>y(s({},"__esModule",{value:!0}),o);var z={};P(z,{comboboxContentPropDefs:()=>m,comboboxRootPropDefs:()=>c,comboboxTriggerPropDefs:()=>u});module.exports=g(z);var a=require("../props/color.prop.js"),n=require("../props/high-contrast.prop.js"),l=require("../props/radius.prop.js"),f=require("../props/width.props.js");const p=["1","2","3"],c={size:{type:"enum",className:"rt-r-size",values:p,default:"2",responsive:!0},...n.highContrastPropDef},v=["classic","surface","soft","outline","ghost"],u={variant:{type:"enum",className:"rt-variant",values:v,default:"surface"},panelBackground:{type:"enum",className:"rt-panel-background",values:["solid","translucent"]},material:{type:"enum",values:["solid","translucent"]},error:{type:"boolean"},loading:{type:"boolean"},disabled:{type:"boolean"},readOnly:{type:"boolean"},...a.colorPropDef,...l.radiusPropDef,width:f.widthPropDefs.width,placeholder:{type:"string"}},h=["solid","soft"],m={size:{type:"enum",className:"rt-r-size",values:p,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:h,default:"solid"},...a.colorPropDef,...n.highContrastPropDef};
|
|
2
2
|
//# sourceMappingURL=combobox.props.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/combobox.props.tsx"],
|
|
4
|
-
"sourcesContent": ["import { colorPropDef } from '../props/color.prop.js';\nimport { highContrastPropDef } from '../props/high-contrast.prop.js';\nimport { radiusPropDef } from '../props/radius.prop.js';\nimport { widthPropDefs } from '../props/width.props.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst sizes = ['1', '2', '3'] as const;\n\nconst comboboxRootPropDefs = {\n size: { type: 'enum', className: 'rt-r-size', values: sizes, default: '2', responsive: true },\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n};\n\nconst triggerVariants = ['classic', 'surface', 'soft', 'outline', 'ghost'] as const;\n\nconst comboboxTriggerPropDefs = {\n variant: { type: 'enum', className: 'rt-variant', values: triggerVariants, default: 'surface' },\n panelBackground: {\n type: 'enum',\n className: 'rt-panel-background',\n values: ['solid', 'translucent'],\n },\n material: { type: 'enum', values: ['solid', 'translucent'] },\n
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,yBAAAC,EAAA,4BAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAA6B,kCAC7BC,EAAoC,0CACpCC,EAA8B,mCAC9BC,EAA8B,mCAI9B,MAAMC,EAAQ,CAAC,IAAK,IAAK,GAAG,
|
|
4
|
+
"sourcesContent": ["import { colorPropDef } from '../props/color.prop.js';\nimport { highContrastPropDef } from '../props/high-contrast.prop.js';\nimport { radiusPropDef } from '../props/radius.prop.js';\nimport { widthPropDefs } from '../props/width.props.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst sizes = ['1', '2', '3'] as const;\n\n/**\n * Shared responsive sizing + high contrast support inherited by Combobox.Root.\n */\nconst comboboxRootPropDefs = {\n size: { type: 'enum', className: 'rt-r-size', values: sizes, default: '2', responsive: true },\n ...highContrastPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n highContrast: PropDef<boolean>;\n};\n\nconst triggerVariants = ['classic', 'surface', 'soft', 'outline', 'ghost'] as const;\n\n/**\n * Token-aware props specific to Combobox.Trigger.\n */\nconst comboboxTriggerPropDefs = {\n variant: { type: 'enum', className: 'rt-variant', values: triggerVariants, default: 'surface' },\n panelBackground: {\n type: 'enum',\n className: 'rt-panel-background',\n values: ['solid', 'translucent'],\n },\n material: { type: 'enum', values: ['solid', 'translucent'] },\n error: { type: 'boolean' },\n loading: { type: 'boolean' },\n disabled: { type: 'boolean' },\n readOnly: { type: 'boolean' },\n ...colorPropDef,\n ...radiusPropDef,\n width: widthPropDefs.width,\n placeholder: { type: 'string' },\n} satisfies {\n variant: PropDef<(typeof triggerVariants)[number]>;\n panelBackground: PropDef<'solid' | 'translucent'>;\n material: PropDef<'solid' | 'translucent'>;\n error: PropDef<boolean>;\n loading: PropDef<boolean>;\n disabled: PropDef<boolean>;\n readOnly: PropDef<boolean>;\n width: PropDef<string>;\n placeholder: PropDef<string>;\n};\n\nconst contentVariants = ['solid', 'soft'] as const;\n\n/**\n * Styling props for the dropdown surface rendered by Combobox.Content.\n */\nconst comboboxContentPropDefs = {\n size: { type: 'enum', className: 'rt-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'rt-variant', values: contentVariants, default: 'solid' },\n ...colorPropDef,\n ...highContrastPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof contentVariants)[number]>;\n};\n\nexport { comboboxRootPropDefs, comboboxTriggerPropDefs, comboboxContentPropDefs };\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,yBAAAC,EAAA,4BAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAA6B,kCAC7BC,EAAoC,0CACpCC,EAA8B,mCAC9BC,EAA8B,mCAI9B,MAAMC,EAAQ,CAAC,IAAK,IAAK,GAAG,EAKtBP,EAAuB,CAC3B,KAAM,CAAE,KAAM,OAAQ,UAAW,YAAa,OAAQO,EAAO,QAAS,IAAK,WAAY,EAAK,EAC5F,GAAG,qBACL,EAKMC,EAAkB,CAAC,UAAW,UAAW,OAAQ,UAAW,OAAO,EAKnEP,EAA0B,CAC9B,QAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,OAAQO,EAAiB,QAAS,SAAU,EAC9F,gBAAiB,CACf,KAAM,OACN,UAAW,sBACX,OAAQ,CAAC,QAAS,aAAa,CACjC,EACA,SAAU,CAAE,KAAM,OAAQ,OAAQ,CAAC,QAAS,aAAa,CAAE,EAC3D,MAAO,CAAE,KAAM,SAAU,EACzB,QAAS,CAAE,KAAM,SAAU,EAC3B,SAAU,CAAE,KAAM,SAAU,EAC5B,SAAU,CAAE,KAAM,SAAU,EAC5B,GAAG,eACH,GAAG,gBACH,MAAO,gBAAc,MACrB,YAAa,CAAE,KAAM,QAAS,CAChC,EAYMC,EAAkB,CAAC,QAAS,MAAM,EAKlCV,EAA0B,CAC9B,KAAM,CAAE,KAAM,OAAQ,UAAW,YAAa,OAAQQ,EAAO,QAAS,IAAK,WAAY,EAAK,EAC5F,QAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,OAAQE,EAAiB,QAAS,OAAQ,EAC5F,GAAG,eACH,GAAG,qBACL",
|
|
6
6
|
"names": ["combobox_props_exports", "__export", "comboboxContentPropDefs", "comboboxRootPropDefs", "comboboxTriggerPropDefs", "__toCommonJS", "import_color_prop", "import_high_contrast_prop", "import_radius_prop", "import_width_props", "sizes", "triggerVariants", "contentVariants"]
|
|
7
7
|
}
|