@kushagradhawan/kookie-ui 0.1.124 → 0.1.126
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 +93 -0
- package/dist/cjs/components/_internal/base-menu.props.d.ts +52 -1
- package/dist/cjs/components/_internal/base-menu.props.d.ts.map +1 -1
- package/dist/cjs/components/_internal/base-menu.props.js +1 -1
- package/dist/cjs/components/_internal/base-menu.props.js.map +3 -3
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.d.ts +60 -0
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.d.ts.map +1 -0
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.js +2 -0
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.js.map +7 -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/dropdown-menu.d.ts +28 -7
- package/dist/cjs/components/dropdown-menu.d.ts.map +1 -1
- package/dist/cjs/components/dropdown-menu.js +1 -1
- package/dist/cjs/components/dropdown-menu.js.map +3 -3
- package/dist/cjs/components/dropdown-menu.props.d.ts +1 -1
- package/dist/cjs/components/dropdown-menu.props.d.ts.map +1 -1
- package/dist/cjs/components/dropdown-menu.props.js +1 -1
- package/dist/cjs/components/dropdown-menu.props.js.map +2 -2
- package/dist/cjs/components/icons.d.ts +2 -1
- package/dist/cjs/components/icons.d.ts.map +1 -1
- package/dist/cjs/components/icons.js +1 -1
- package/dist/cjs/components/icons.js.map +3 -3
- package/dist/cjs/components/schemas/shell.schema.d.ts +2 -2
- package/dist/esm/components/_internal/base-menu.props.d.ts +52 -1
- package/dist/esm/components/_internal/base-menu.props.d.ts.map +1 -1
- package/dist/esm/components/_internal/base-menu.props.js +1 -1
- package/dist/esm/components/_internal/base-menu.props.js.map +3 -3
- package/dist/esm/components/_internal/dropdown-menu-drill-down.d.ts +60 -0
- package/dist/esm/components/_internal/dropdown-menu-drill-down.d.ts.map +1 -0
- package/dist/esm/components/_internal/dropdown-menu-drill-down.js +2 -0
- package/dist/esm/components/_internal/dropdown-menu-drill-down.js.map +7 -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/dropdown-menu.d.ts +28 -7
- package/dist/esm/components/dropdown-menu.d.ts.map +1 -1
- package/dist/esm/components/dropdown-menu.js +1 -1
- package/dist/esm/components/dropdown-menu.js.map +3 -3
- package/dist/esm/components/dropdown-menu.props.d.ts +1 -1
- package/dist/esm/components/dropdown-menu.props.d.ts.map +1 -1
- package/dist/esm/components/dropdown-menu.props.js +1 -1
- package/dist/esm/components/dropdown-menu.props.js.map +3 -3
- package/dist/esm/components/icons.d.ts +2 -1
- package/dist/esm/components/icons.d.ts.map +1 -1
- package/dist/esm/components/icons.js +1 -1
- package/dist/esm/components/icons.js.map +3 -3
- package/dist/esm/components/schemas/shell.schema.d.ts +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/_internal/base-menu.props.ts +31 -1
- package/src/components/_internal/dropdown-menu-drill-down.tsx +242 -0
- package/src/components/combobox.tsx +176 -80
- package/src/components/dropdown-menu.css +119 -0
- package/src/components/dropdown-menu.props.tsx +2 -0
- package/src/components/dropdown-menu.tsx +217 -27
- package/src/components/icons.tsx +14 -1
- package/styles.css +93 -0
package/components.css
CHANGED
|
@@ -8648,6 +8648,99 @@
|
|
|
8648
8648
|
height: var(--trigger-icon-size-4);
|
|
8649
8649
|
}
|
|
8650
8650
|
}
|
|
8651
|
+
.rt-DropdownMenuDrillDownRoot {
|
|
8652
|
+
display: contents;
|
|
8653
|
+
}
|
|
8654
|
+
.rt-DropdownMenuDrillDownRoot:where([data-drill-down-active]) > * {
|
|
8655
|
+
display: none !important;
|
|
8656
|
+
}
|
|
8657
|
+
.rt-DropdownMenuDrillDownRoot:where([data-drill-down-active]) > :where(.rt-DropdownMenuDrillDownPanel) {
|
|
8658
|
+
display: contents !important;
|
|
8659
|
+
}
|
|
8660
|
+
.rt-DropdownMenuDrillDownPanel {
|
|
8661
|
+
display: contents;
|
|
8662
|
+
}
|
|
8663
|
+
.rt-DropdownMenuDrillDownPanel:where(:not([data-drill-down-active])) > * {
|
|
8664
|
+
display: none !important;
|
|
8665
|
+
}
|
|
8666
|
+
.rt-DropdownMenuDrillDownPanel:where(:not([data-drill-down-active])) > :where(.rt-DropdownMenuDrillDownPanel) {
|
|
8667
|
+
display: contents !important;
|
|
8668
|
+
}
|
|
8669
|
+
.rt-DropdownMenuDrillDownBackItem {
|
|
8670
|
+
display: flex;
|
|
8671
|
+
align-items: center;
|
|
8672
|
+
gap: var(--space-2);
|
|
8673
|
+
min-height: var(--base-menu-item-height);
|
|
8674
|
+
padding-top: var(--base-menu-item-padding-y);
|
|
8675
|
+
padding-bottom: var(--base-menu-item-padding-y);
|
|
8676
|
+
padding-inline-start: var(--base-menu-item-padding-left);
|
|
8677
|
+
padding-inline-end: var(--base-menu-item-padding-right);
|
|
8678
|
+
box-sizing: border-box;
|
|
8679
|
+
outline: none;
|
|
8680
|
+
cursor: var(--cursor-menu-item);
|
|
8681
|
+
-webkit-user-select: none;
|
|
8682
|
+
-moz-user-select: none;
|
|
8683
|
+
user-select: none;
|
|
8684
|
+
transition: var(--transition-menu);
|
|
8685
|
+
font-weight: 500;
|
|
8686
|
+
}
|
|
8687
|
+
.rt-DropdownMenuDrillDownBackItem:where(:focus-visible) {
|
|
8688
|
+
outline: 2px solid var(--focus-8);
|
|
8689
|
+
outline-offset: -2px;
|
|
8690
|
+
}
|
|
8691
|
+
@media (prefers-reduced-motion: reduce) {
|
|
8692
|
+
.rt-DropdownMenuDrillDownBackItem {
|
|
8693
|
+
transition: none;
|
|
8694
|
+
}
|
|
8695
|
+
}
|
|
8696
|
+
.rt-DropdownMenuDrillDownBackIcon {
|
|
8697
|
+
width: var(--indicator-icon-size-2);
|
|
8698
|
+
height: var(--indicator-icon-size-2);
|
|
8699
|
+
flex-shrink: 0;
|
|
8700
|
+
color: var(--gray-12);
|
|
8701
|
+
}
|
|
8702
|
+
.rt-DropdownMenuDrillDownBackLabel {
|
|
8703
|
+
color: var(--gray-12);
|
|
8704
|
+
}
|
|
8705
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:hover),
|
|
8706
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible),
|
|
8707
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:hover),
|
|
8708
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) {
|
|
8709
|
+
background-color: var(--accent-9);
|
|
8710
|
+
color: var(--accent-contrast);
|
|
8711
|
+
}
|
|
8712
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:hover) :where(.rt-DropdownMenuDrillDownBackIcon),
|
|
8713
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible) :where(.rt-DropdownMenuDrillDownBackIcon),
|
|
8714
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:hover) :where(.rt-DropdownMenuDrillDownBackIcon),
|
|
8715
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) :where(.rt-DropdownMenuDrillDownBackIcon),
|
|
8716
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:hover) :where(.rt-DropdownMenuDrillDownBackLabel),
|
|
8717
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible) :where(.rt-DropdownMenuDrillDownBackLabel),
|
|
8718
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:hover) :where(.rt-DropdownMenuDrillDownBackLabel),
|
|
8719
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) :where(.rt-DropdownMenuDrillDownBackLabel),
|
|
8720
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:hover) :where(.rt-BaseMenuSubTriggerIcon),
|
|
8721
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible) :where(.rt-BaseMenuSubTriggerIcon),
|
|
8722
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:hover) :where(.rt-BaseMenuSubTriggerIcon),
|
|
8723
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) :where(.rt-BaseMenuSubTriggerIcon) {
|
|
8724
|
+
color: var(--accent-contrast);
|
|
8725
|
+
}
|
|
8726
|
+
.rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownBackItem:hover),
|
|
8727
|
+
.rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible),
|
|
8728
|
+
.rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownSubTrigger:hover),
|
|
8729
|
+
.rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) {
|
|
8730
|
+
background-color: var(--accent-4);
|
|
8731
|
+
}
|
|
8732
|
+
:where([data-panel-background='translucent']) .rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownBackItem:hover),
|
|
8733
|
+
:where([data-panel-background='translucent']) .rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible),
|
|
8734
|
+
:where([data-panel-background='translucent']) .rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownSubTrigger:hover),
|
|
8735
|
+
:where([data-panel-background='translucent']) .rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) {
|
|
8736
|
+
background-color: var(--accent-a4);
|
|
8737
|
+
}
|
|
8738
|
+
@media (forced-colors: active) {
|
|
8739
|
+
.rt-DropdownMenuDrillDownBackItem:where(:focus-visible) {
|
|
8740
|
+
outline: 2px solid Highlight;
|
|
8741
|
+
outline-offset: 2px;
|
|
8742
|
+
}
|
|
8743
|
+
}
|
|
8651
8744
|
:where([data-panel-background='translucent'], [data-material='translucent']) .rt-TextFieldRoot {
|
|
8652
8745
|
-webkit-backdrop-filter: var(--backdrop-filter-components);
|
|
8653
8746
|
backdrop-filter: var(--backdrop-filter-components);
|
|
@@ -1,4 +1,55 @@
|
|
|
1
|
+
declare const submenuBehaviors: readonly ["cascade", "drill-down"];
|
|
1
2
|
declare const baseMenuContentPropDefs: {
|
|
3
|
+
/**
|
|
4
|
+
* Controls how submenus behave.
|
|
5
|
+
* - `cascade`: Default cascading behavior where submenus open to the side (portal-based)
|
|
6
|
+
* - `drill-down`: Mobile-friendly behavior where submenus replace the content inline
|
|
7
|
+
* Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`
|
|
8
|
+
*/
|
|
9
|
+
submenuBehavior: {
|
|
10
|
+
type: "enum";
|
|
11
|
+
values: readonly ["cascade", "drill-down"];
|
|
12
|
+
default: "cascade";
|
|
13
|
+
responsive: true;
|
|
14
|
+
};
|
|
15
|
+
highContrast: {
|
|
16
|
+
type: "boolean";
|
|
17
|
+
className: string;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
color: {
|
|
21
|
+
type: "enum";
|
|
22
|
+
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"];
|
|
23
|
+
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;
|
|
24
|
+
};
|
|
25
|
+
size: {
|
|
26
|
+
type: "enum";
|
|
27
|
+
className: string;
|
|
28
|
+
values: readonly ["1", "2"];
|
|
29
|
+
default: "2";
|
|
30
|
+
responsive: true;
|
|
31
|
+
};
|
|
32
|
+
variant: {
|
|
33
|
+
type: "enum";
|
|
34
|
+
className: string;
|
|
35
|
+
values: readonly ["solid", "soft"];
|
|
36
|
+
default: "solid";
|
|
37
|
+
};
|
|
38
|
+
material: {
|
|
39
|
+
type: "enum";
|
|
40
|
+
values: readonly ["solid", "translucent"];
|
|
41
|
+
default: undefined;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Use `material` prop instead. This prop will be removed in a future version.
|
|
45
|
+
*/
|
|
46
|
+
panelBackground: {
|
|
47
|
+
type: "enum";
|
|
48
|
+
values: readonly ["solid", "translucent"];
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
declare const baseMenuSubContentPropDefs: {
|
|
2
53
|
highContrast: {
|
|
3
54
|
type: "boolean";
|
|
4
55
|
className: string;
|
|
@@ -66,5 +117,5 @@ declare const baseMenuRadioItemPropDefs: {
|
|
|
66
117
|
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;
|
|
67
118
|
};
|
|
68
119
|
};
|
|
69
|
-
export { baseMenuContentPropDefs, baseMenuItemPropDefs, baseMenuCheckboxItemPropDefs, baseMenuRadioItemPropDefs, };
|
|
120
|
+
export { baseMenuContentPropDefs, baseMenuSubContentPropDefs, baseMenuItemPropDefs, baseMenuCheckboxItemPropDefs, baseMenuRadioItemPropDefs, submenuBehaviors, };
|
|
70
121
|
//# sourceMappingURL=base-menu.props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-menu.props.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/base-menu.props.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-menu.props.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/base-menu.props.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,gBAAgB,oCAAqC,CAAC;AAwC5D,QAAA,MAAM,uBAAuB;IAE3B;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAzBH;;OAEG;;;;;;CAoCJ,CAAC;AAGF,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAzC9B;;OAEG;;;;;;CAuCoD,CAAC;AAE1D,QAAA,MAAM,oBAAoB;;;;;;;;;;;;CAMzB,CAAC;AAEF,QAAA,MAAM,4BAA4B;;;;;;;;;CAKjC,CAAC;AAEF,QAAA,MAAM,yBAAyB;;;;;;CAE9B,CAAC;AAEF,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,4BAA4B,EAC5B,yBAAyB,EACzB,gBAAgB,GACjB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=Object.defineProperty;var
|
|
1
|
+
"use strict";var r=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var o in e)r(t,o,{get:e[o],enumerable:!0})},h=(t,e,o,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of P(e))!y.call(t,s)&&s!==o&&r(t,s,{get:()=>e[s],enumerable:!(u=D(e,s))||u.enumerable});return t};var g=t=>h(r({},"__esModule",{value:!0}),t);var C={};v(C,{baseMenuCheckboxItemPropDefs:()=>l,baseMenuContentPropDefs:()=>c,baseMenuItemPropDefs:()=>d,baseMenuRadioItemPropDefs:()=>b,baseMenuSubContentPropDefs:()=>m,submenuBehaviors:()=>a});module.exports=g(C);var p=require("../../props/as-child.prop.js"),n=require("../../props/color.prop.js"),f=require("../../props/high-contrast.prop.js");const B=["1","2"],k=["solid","soft"],z=["solid","translucent"],M=["solid","translucent"],a=["cascade","drill-down"],i={size:{type:"enum",className:"rt-r-size",values:B,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:k,default:"solid"},material:{type:"enum",values:M,default:void 0},panelBackground:{type:"enum",values:z,default:void 0},...n.colorPropDef,...f.highContrastPropDef},c={...i,submenuBehavior:{type:"enum",values:a,default:"cascade",responsive:!0}},m=i,d={...p.asChildPropDef,...n.colorPropDef,shortcut:{type:"string"}},l={...n.colorPropDef,shortcut:{type:"string"}},b={...n.colorPropDef};
|
|
2
2
|
//# sourceMappingURL=base-menu.props.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/_internal/base-menu.props.ts"],
|
|
4
|
-
"sourcesContent": ["import { asChildPropDef } from '../../props/as-child.prop.js';\nimport { colorPropDef } from '../../props/color.prop.js';\nimport { highContrastPropDef } from '../../props/high-contrast.prop.js';\n\nimport type { PropDef } from '../../props/prop-def.js';\n\nconst contentSizes = ['1', '2'] as const;\nconst contentVariants = ['solid', 'soft'] as const;\nconst panelBackgrounds = ['solid', 'translucent'] as const;\nconst materials = ['solid', 'translucent'] as const;\n\nconst
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,EAAA,4BAAAC,EAAA,yBAAAC,EAAA,8BAAAC,IAAA,eAAAC,
|
|
6
|
-
"names": ["base_menu_props_exports", "__export", "baseMenuCheckboxItemPropDefs", "baseMenuContentPropDefs", "baseMenuItemPropDefs", "baseMenuRadioItemPropDefs", "__toCommonJS", "import_as_child_prop", "import_color_prop", "import_high_contrast_prop", "contentSizes", "contentVariants", "panelBackgrounds", "materials"]
|
|
4
|
+
"sourcesContent": ["import { asChildPropDef } from '../../props/as-child.prop.js';\nimport { colorPropDef } from '../../props/color.prop.js';\nimport { highContrastPropDef } from '../../props/high-contrast.prop.js';\n\nimport type { PropDef } from '../../props/prop-def.js';\n\nconst contentSizes = ['1', '2'] as const;\nconst contentVariants = ['solid', 'soft'] as const;\nconst panelBackgrounds = ['solid', 'translucent'] as const;\nconst materials = ['solid', 'translucent'] as const;\nconst submenuBehaviors = ['cascade', 'drill-down'] as const;\n\n// Base props shared between Content and SubContent\nconst baseMenuSharedPropDefs = {\n size: {\n type: 'enum',\n className: 'rt-r-size',\n values: contentSizes,\n default: '2',\n responsive: true,\n },\n variant: {\n type: 'enum',\n className: 'rt-variant',\n values: contentVariants,\n default: 'solid',\n },\n material: {\n type: 'enum',\n values: materials,\n default: undefined,\n },\n /**\n * @deprecated Use `material` prop instead. This prop will be removed in a future version.\n */\n panelBackground: {\n type: 'enum',\n values: panelBackgrounds,\n default: undefined,\n },\n ...colorPropDef,\n ...highContrastPropDef,\n} satisfies {\n size: PropDef<(typeof contentSizes)[number]>;\n variant: PropDef<(typeof contentVariants)[number]>;\n material: PropDef<(typeof materials)[number] | undefined>;\n panelBackground: PropDef<(typeof panelBackgrounds)[number] | undefined>;\n};\n\n// Content-specific props (includes submenuBehavior)\nconst baseMenuContentPropDefs = {\n ...baseMenuSharedPropDefs,\n /**\n * Controls how submenus behave.\n * - `cascade`: Default cascading behavior where submenus open to the side (portal-based)\n * - `drill-down`: Mobile-friendly behavior where submenus replace the content inline\n * Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`\n */\n submenuBehavior: {\n type: 'enum',\n values: submenuBehaviors,\n default: 'cascade',\n responsive: true,\n },\n} satisfies {\n size: PropDef<(typeof contentSizes)[number]>;\n variant: PropDef<(typeof contentVariants)[number]>;\n material: PropDef<(typeof materials)[number] | undefined>;\n panelBackground: PropDef<(typeof panelBackgrounds)[number] | undefined>;\n submenuBehavior: PropDef<(typeof submenuBehaviors)[number]>;\n};\n\n// SubContent props (no submenuBehavior)\nconst baseMenuSubContentPropDefs = baseMenuSharedPropDefs;\n\nconst baseMenuItemPropDefs = {\n ...asChildPropDef,\n ...colorPropDef,\n shortcut: { type: 'string' },\n} satisfies {\n shortcut: PropDef<string>;\n};\n\nconst baseMenuCheckboxItemPropDefs = {\n ...colorPropDef,\n shortcut: { type: 'string' },\n} satisfies {\n shortcut: PropDef<string>;\n};\n\nconst baseMenuRadioItemPropDefs = {\n ...colorPropDef,\n};\n\nexport {\n baseMenuContentPropDefs,\n baseMenuSubContentPropDefs,\n baseMenuItemPropDefs,\n baseMenuCheckboxItemPropDefs,\n baseMenuRadioItemPropDefs,\n submenuBehaviors,\n};\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,EAAA,4BAAAC,EAAA,yBAAAC,EAAA,8BAAAC,EAAA,+BAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAR,GAAA,IAAAS,EAA+B,wCAC/BC,EAA6B,qCAC7BC,EAAoC,6CAIpC,MAAMC,EAAe,CAAC,IAAK,GAAG,EACxBC,EAAkB,CAAC,QAAS,MAAM,EAClCC,EAAmB,CAAC,QAAS,aAAa,EAC1CC,EAAY,CAAC,QAAS,aAAa,EACnCR,EAAmB,CAAC,UAAW,YAAY,EAG3CS,EAAyB,CAC7B,KAAM,CACJ,KAAM,OACN,UAAW,YACX,OAAQJ,EACR,QAAS,IACT,WAAY,EACd,EACA,QAAS,CACP,KAAM,OACN,UAAW,aACX,OAAQC,EACR,QAAS,OACX,EACA,SAAU,CACR,KAAM,OACN,OAAQE,EACR,QAAS,MACX,EAIA,gBAAiB,CACf,KAAM,OACN,OAAQD,EACR,QAAS,MACX,EACA,GAAG,eACH,GAAG,qBACL,EAQMX,EAA0B,CAC9B,GAAGa,EAOH,gBAAiB,CACf,KAAM,OACN,OAAQT,EACR,QAAS,UACT,WAAY,EACd,CACF,EASMD,EAA6BU,EAE7BZ,EAAuB,CAC3B,GAAG,iBACH,GAAG,eACH,SAAU,CAAE,KAAM,QAAS,CAC7B,EAIMF,EAA+B,CACnC,GAAG,eACH,SAAU,CAAE,KAAM,QAAS,CAC7B,EAIMG,EAA4B,CAChC,GAAG,cACL",
|
|
6
|
+
"names": ["base_menu_props_exports", "__export", "baseMenuCheckboxItemPropDefs", "baseMenuContentPropDefs", "baseMenuItemPropDefs", "baseMenuRadioItemPropDefs", "baseMenuSubContentPropDefs", "submenuBehaviors", "__toCommonJS", "import_as_child_prop", "import_color_prop", "import_high_contrast_prop", "contentSizes", "contentVariants", "panelBackgrounds", "materials", "baseMenuSharedPropDefs"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Breakpoint, Responsive } from '../../props/prop-def.js';
|
|
3
|
+
import type { submenuBehaviors } from './base-menu.props.js';
|
|
4
|
+
type SubmenuBehavior = (typeof submenuBehaviors)[number];
|
|
5
|
+
/**
|
|
6
|
+
* Hook to get the current breakpoint based on window width.
|
|
7
|
+
* Returns 'initial' on the server and during initial hydration.
|
|
8
|
+
* Uses shared breakpoint values from shell.types.js.
|
|
9
|
+
*/
|
|
10
|
+
declare function useBreakpoint(): {
|
|
11
|
+
breakpoint: Breakpoint;
|
|
12
|
+
ready: boolean;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Resolves a responsive value to its current value based on the breakpoint.
|
|
16
|
+
* Falls back through smaller breakpoints if the current one isn't defined.
|
|
17
|
+
*/
|
|
18
|
+
declare function resolveResponsiveValue<T>(value: T | Partial<Record<Breakpoint, T>> | undefined, currentBreakpoint: Breakpoint, defaultValue: T): T;
|
|
19
|
+
interface DrillDownContextValue {
|
|
20
|
+
/** Current submenu behavior mode */
|
|
21
|
+
behavior: SubmenuBehavior;
|
|
22
|
+
/** Whether the breakpoint has been resolved (client-side only) */
|
|
23
|
+
ready: boolean;
|
|
24
|
+
/** Stack of active submenu IDs. Empty means root menu is shown. */
|
|
25
|
+
stack: string[];
|
|
26
|
+
/** Navigate into a submenu */
|
|
27
|
+
push: (id: string) => void;
|
|
28
|
+
/** Navigate back to parent menu */
|
|
29
|
+
pop: () => void;
|
|
30
|
+
/** Reset to root menu */
|
|
31
|
+
reset: () => void;
|
|
32
|
+
/** Check if a specific submenu is the currently active one */
|
|
33
|
+
isActive: (id: string) => boolean;
|
|
34
|
+
/** Check if we're at root level (no submenus open) */
|
|
35
|
+
isRoot: boolean;
|
|
36
|
+
/** The currently active submenu ID (or null if at root) */
|
|
37
|
+
currentId: string | null;
|
|
38
|
+
}
|
|
39
|
+
declare const DrillDownContext: React.Context<DrillDownContextValue | null>;
|
|
40
|
+
interface DrillDownProviderProps {
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
submenuBehavior: Responsive<SubmenuBehavior> | undefined;
|
|
43
|
+
}
|
|
44
|
+
declare function DrillDownProvider({ children, submenuBehavior }: DrillDownProviderProps): React.JSX.Element;
|
|
45
|
+
declare function useDrillDown(): DrillDownContextValue;
|
|
46
|
+
/**
|
|
47
|
+
* Hook to check if drill-down context is available (i.e., we're inside Content)
|
|
48
|
+
*/
|
|
49
|
+
declare function useDrillDownOptional(): DrillDownContextValue | null;
|
|
50
|
+
interface SubContextValue {
|
|
51
|
+
/** Unique ID for this submenu */
|
|
52
|
+
id: string;
|
|
53
|
+
/** Label for the back button */
|
|
54
|
+
label: React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
declare const SubContext: React.Context<SubContextValue | null>;
|
|
57
|
+
declare function useSubContext(): SubContextValue | null;
|
|
58
|
+
export { DrillDownProvider, DrillDownContext, SubContext, useDrillDown, useDrillDownOptional, useSubContext, useBreakpoint, resolveResponsiveValue, };
|
|
59
|
+
export type { SubmenuBehavior, DrillDownContextValue, SubContextValue };
|
|
60
|
+
//# sourceMappingURL=dropdown-menu-drill-down.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-menu-drill-down.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/dropdown-menu-drill-down.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,KAAK,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;GAIG;AACH,iBAAS,aAAa,IAAI;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAsDnE;AAED;;;GAGG;AACH,iBAAS,sBAAsB,CAAC,CAAC,EAC/B,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,EACrD,iBAAiB,EAAE,UAAU,EAC7B,YAAY,EAAE,CAAC,GACd,CAAC,CA6BH;AAMD,UAAU,qBAAqB;IAC7B,oCAAoC;IACpC,QAAQ,EAAE,eAAe,CAAC;IAC1B,kEAAkE;IAClE,KAAK,EAAE,OAAO,CAAC;IACf,mEAAmE;IACnE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,8BAA8B;IAC9B,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,mCAAmC;IACnC,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,yBAAyB;IACzB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,8DAA8D;IAC9D,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,sDAAsD;IACtD,MAAM,EAAE,OAAO,CAAC;IAChB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,QAAA,MAAM,gBAAgB,6CAA0D,CAAC;AAEjF,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,eAAe,EAAE,UAAU,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;CAC1D;AAED,iBAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,sBAAsB,qBAuD/E;AAED,iBAAS,YAAY,0BAMpB;AAED;;GAEG;AACH,iBAAS,oBAAoB,iCAE5B;AAMD,UAAU,eAAe;IACvB,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,QAAA,MAAM,UAAU,uCAAoD,CAAC;AAErE,iBAAS,aAAa,2BAErB;AAED,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,sBAAsB,GACvB,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";var S=Object.create;var v=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var V=(e,n)=>{for(var r in n)v(e,r,{get:n[r],enumerable:!0})},w=(e,n,r,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of L(n))!T.call(e,t)&&t!==r&&v(e,t,{get:()=>n[t],enumerable:!(a=E(n,t))||a.enumerable});return e};var M=(e,n,r)=>(r=e!=null?S(P(e)):{},w(n||!e||!e.__esModule?v(r,"default",{value:e,enumerable:!0}):r,e)),O=e=>w(v({},"__esModule",{value:!0}),e);var N={};V(N,{DrillDownContext:()=>f,DrillDownProvider:()=>g,SubContext:()=>b,resolveResponsiveValue:()=>h,useBreakpoint:()=>m,useDrillDown:()=>y,useDrillDownOptional:()=>C,useSubContext:()=>k});module.exports=O(N);var o=M(require("react")),x=require("../shell.types.js");function m(){const[e,n]=o.useState("initial"),[r,a]=o.useState(!1);return o.useEffect(()=>{if(typeof window>"u")return;const l=Object.entries(x._BREAKPOINTS).map(([u,s])=>[u,window.matchMedia(s)]),i=()=>{const u=l.filter(([,d])=>d.matches).map(([d])=>d),s=u[u.length-1]??"initial";n(s),a(!0)};i();const c=[];return l.forEach(([,u])=>{const s=u;typeof s.addEventListener=="function"?(s.addEventListener("change",i),c.push(()=>s.removeEventListener?.("change",i))):typeof s.addListener=="function"&&(s.addListener(i),c.push(()=>s.removeListener?.(i)))}),()=>{c.forEach(u=>{try{u()}catch{}})}},[]),{breakpoint:e,ready:r}}function h(e,n,r){if(e==null)return r;if(typeof e!="object")return e;const a=e;if(a[n]!==void 0)return a[n];const t=["xl","lg","md","sm","xs","initial"],l=t.indexOf(n);for(let i=l+1;i<t.length;i++){const c=t[i];if(a[c]!==void 0)return a[c]}return r}const f=o.createContext(null);function g({children:e,submenuBehavior:n}){const{breakpoint:r,ready:a}=m(),[t,l]=o.useState([]),i=o.useMemo(()=>h(n,r,"cascade"),[n,r]),c=o.useRef(i);o.useEffect(()=>{c.current==="drill-down"&&i==="cascade"&&l([]),c.current=i},[i]);const u=o.useCallback(p=>{l(R=>[...R,p])},[]),s=o.useCallback(()=>{l(p=>p.slice(0,-1))},[]),d=o.useCallback(()=>{l([])},[]),D=o.useCallback(p=>t.length===0?!1:t[t.length-1]===p,[t]),B=o.useMemo(()=>({behavior:i,ready:a,stack:t,push:u,pop:s,reset:d,isActive:D,isRoot:t.length===0,currentId:t.length>0?t[t.length-1]:null}),[i,a,t,u,s,d,D]);return o.createElement(f.Provider,{value:B},e)}function y(){const e=o.useContext(f);if(!e)throw new Error("useDrillDown must be used within a DropdownMenu.Content");return e}function C(){return o.useContext(f)}const b=o.createContext(null);function k(){return o.useContext(b)}
|
|
2
|
+
//# sourceMappingURL=dropdown-menu-drill-down.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/_internal/dropdown-menu-drill-down.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport type { Breakpoint, Responsive } from '../../props/prop-def.js';\nimport type { submenuBehaviors } from './base-menu.props.js';\nimport { _BREAKPOINTS } from '../shell.types.js';\n\ntype SubmenuBehavior = (typeof submenuBehaviors)[number];\n\n/**\n * Hook to get the current breakpoint based on window width.\n * Returns 'initial' on the server and during initial hydration.\n * Uses shared breakpoint values from shell.types.js.\n */\nfunction useBreakpoint(): { breakpoint: Breakpoint; ready: boolean } {\n const [currentBp, setCurrentBp] = React.useState<Breakpoint>('initial');\n const [ready, setReady] = React.useState(false);\n\n React.useEffect(() => {\n if (typeof window === 'undefined') return;\n\n // Use shared breakpoint media queries from shell.types\n const queries = Object.entries(_BREAKPOINTS) as [keyof typeof _BREAKPOINTS, string][];\n const mqls = queries.map(([k, q]) => [k, window.matchMedia(q)] as const);\n\n const compute = () => {\n // Highest matched breakpoint wins\n const matched = mqls.filter(([, m]) => m.matches).map(([k]) => k);\n const next = (matched[matched.length - 1] as Breakpoint | undefined) ?? 'initial';\n setCurrentBp(next);\n setReady(true);\n };\n\n compute();\n\n const cleanups: Array<() => void> = [];\n mqls.forEach(([, m]) => {\n const mm = m as MediaQueryList & {\n addEventListener?: (type: 'change', listener: () => void) => void;\n removeEventListener?: (type: 'change', listener: () => void) => void;\n addListener?: (listener: () => void) => void;\n removeListener?: (listener: () => void) => void;\n };\n if (typeof mm.addEventListener === 'function') {\n mm.addEventListener('change', compute);\n cleanups.push(() => mm.removeEventListener?.('change', compute));\n } else if (typeof mm.addListener === 'function') {\n mm.addListener(compute);\n cleanups.push(() => mm.removeListener?.(compute));\n }\n });\n\n return () => {\n cleanups.forEach((fn) => {\n try {\n fn();\n } catch (e) {\n // MediaQueryList cleanup can fail in edge cases (e.g., already removed)\n // Log in development to aid debugging\n if (process.env.NODE_ENV !== 'production') {\n console.warn('[DropdownMenu] MediaQueryList cleanup warning:', e);\n }\n }\n });\n };\n }, []);\n\n return { breakpoint: currentBp, ready };\n}\n\n/**\n * Resolves a responsive value to its current value based on the breakpoint.\n * Falls back through smaller breakpoints if the current one isn't defined.\n */\nfunction resolveResponsiveValue<T>(\n value: T | Partial<Record<Breakpoint, T>> | undefined,\n currentBreakpoint: Breakpoint,\n defaultValue: T\n): T {\n if (value === undefined || value === null) {\n return defaultValue;\n }\n\n // Non-object values are returned directly\n if (typeof value !== 'object') {\n return value;\n }\n\n const map = value as Partial<Record<Breakpoint, T>>;\n\n // Check if current breakpoint has a value\n if (map[currentBreakpoint] !== undefined) {\n return map[currentBreakpoint] as T;\n }\n\n // Fall back through smaller breakpoints\n const bpOrder: Breakpoint[] = ['xl', 'lg', 'md', 'sm', 'xs', 'initial'];\n const startIdx = bpOrder.indexOf(currentBreakpoint);\n\n for (let i = startIdx + 1; i < bpOrder.length; i++) {\n const bp = bpOrder[i];\n if (map[bp] !== undefined) {\n return map[bp] as T;\n }\n }\n\n return defaultValue;\n}\n\n// ============================================================================\n// DrillDown Context\n// ============================================================================\n\ninterface DrillDownContextValue {\n /** Current submenu behavior mode */\n behavior: SubmenuBehavior;\n /** Whether the breakpoint has been resolved (client-side only) */\n ready: boolean;\n /** Stack of active submenu IDs. Empty means root menu is shown. */\n stack: string[];\n /** Navigate into a submenu */\n push: (id: string) => void;\n /** Navigate back to parent menu */\n pop: () => void;\n /** Reset to root menu */\n reset: () => void;\n /** Check if a specific submenu is the currently active one */\n isActive: (id: string) => boolean;\n /** Check if we're at root level (no submenus open) */\n isRoot: boolean;\n /** The currently active submenu ID (or null if at root) */\n currentId: string | null;\n}\n\nconst DrillDownContext = React.createContext<DrillDownContextValue | null>(null);\n\ninterface DrillDownProviderProps {\n children: React.ReactNode;\n submenuBehavior: Responsive<SubmenuBehavior> | undefined;\n}\n\nfunction DrillDownProvider({ children, submenuBehavior }: DrillDownProviderProps) {\n const { breakpoint, ready } = useBreakpoint();\n const [stack, setStack] = React.useState<string[]>([]);\n\n // Resolve the current behavior based on breakpoint\n const behavior = React.useMemo(\n () => resolveResponsiveValue(submenuBehavior, breakpoint, 'cascade'),\n [submenuBehavior, breakpoint]\n );\n\n // Reset stack when behavior changes from drill-down to cascade\n const prevBehaviorRef = React.useRef(behavior);\n React.useEffect(() => {\n if (prevBehaviorRef.current === 'drill-down' && behavior === 'cascade') {\n setStack([]);\n }\n prevBehaviorRef.current = behavior;\n }, [behavior]);\n\n const push = React.useCallback((id: string) => {\n setStack((prev) => [...prev, id]);\n }, []);\n\n const pop = React.useCallback(() => {\n setStack((prev) => prev.slice(0, -1));\n }, []);\n\n const reset = React.useCallback(() => {\n setStack([]);\n }, []);\n\n const isActive = React.useCallback(\n (id: string) => {\n if (stack.length === 0) return false;\n return stack[stack.length - 1] === id;\n },\n [stack]\n );\n\n const value = React.useMemo(\n (): DrillDownContextValue => ({\n behavior,\n ready,\n stack,\n push,\n pop,\n reset,\n isActive,\n isRoot: stack.length === 0,\n currentId: stack.length > 0 ? stack[stack.length - 1] : null,\n }),\n [behavior, ready, stack, push, pop, reset, isActive]\n );\n\n return <DrillDownContext.Provider value={value}>{children}</DrillDownContext.Provider>;\n}\n\nfunction useDrillDown() {\n const ctx = React.useContext(DrillDownContext);\n if (!ctx) {\n throw new Error('useDrillDown must be used within a DropdownMenu.Content');\n }\n return ctx;\n}\n\n/**\n * Hook to check if drill-down context is available (i.e., we're inside Content)\n */\nfunction useDrillDownOptional() {\n return React.useContext(DrillDownContext);\n}\n\n// ============================================================================\n// Sub Context (for individual submenu instances)\n// ============================================================================\n\ninterface SubContextValue {\n /** Unique ID for this submenu */\n id: string;\n /** Label for the back button */\n label: React.ReactNode;\n}\n\nconst SubContext = React.createContext<SubContextValue | null>(null);\n\nfunction useSubContext() {\n return React.useContext(SubContext);\n}\n\nexport {\n DrillDownProvider,\n DrillDownContext,\n SubContext,\n useDrillDown,\n useDrillDownOptional,\n useSubContext,\n useBreakpoint,\n resolveResponsiveValue,\n};\n\nexport type { SubmenuBehavior, DrillDownContextValue, SubContextValue };\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,sBAAAC,EAAA,eAAAC,EAAA,2BAAAC,EAAA,kBAAAC,EAAA,iBAAAC,EAAA,yBAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAV,GAEA,IAAAW,EAAuB,oBAGvBC,EAA6B,6BAS7B,SAASN,GAA4D,CACnE,KAAM,CAACO,EAAWC,CAAY,EAAIH,EAAM,SAAqB,SAAS,EAChE,CAACI,EAAOC,CAAQ,EAAIL,EAAM,SAAS,EAAK,EAE9C,OAAAA,EAAM,UAAU,IAAM,CACpB,GAAI,OAAO,OAAW,IAAa,OAInC,MAAMM,EADU,OAAO,QAAQ,cAAY,EACtB,IAAI,CAAC,CAACC,EAAGC,CAAC,IAAM,CAACD,EAAG,OAAO,WAAWC,CAAC,CAAC,CAAU,EAEjEC,EAAU,IAAM,CAEpB,MAAMC,EAAUJ,EAAK,OAAO,CAAC,CAAC,CAAEK,CAAC,IAAMA,EAAE,OAAO,EAAE,IAAI,CAAC,CAACJ,CAAC,IAAMA,CAAC,EAC1DK,EAAQF,EAAQA,EAAQ,OAAS,CAAC,GAAgC,UACxEP,EAAaS,CAAI,EACjBP,EAAS,EAAI,CACf,EAEAI,EAAQ,EAER,MAAMI,EAA8B,CAAC,EACrC,OAAA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cAAsC,IAAI,EAEnE,SAASF,GAAgB,CACvB,OAAOE,EAAM,WAAWP,CAAU,CACpC",
|
|
6
|
+
"names": ["dropdown_menu_drill_down_exports", "__export", "DrillDownContext", "DrillDownProvider", "SubContext", "resolveResponsiveValue", "useBreakpoint", "useDrillDown", "useDrillDownOptional", "useSubContext", "__toCommonJS", "React", "import_shell_types", "currentBp", "setCurrentBp", "ready", "setReady", "mqls", "k", "q", "compute", "matched", "m", "next", "cleanups", "mm", "fn", "value", "currentBreakpoint", "defaultValue", "map", "bpOrder", "startIdx", "bp", "children", "submenuBehavior", "breakpoint", "stack", "setStack", "behavior", "prevBehaviorRef", "push", "id", "prev", "pop", "reset", "isActive", "ctx"]
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../src/components/combobox.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,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;
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../src/components/combobox.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,OAAO,IAAI,gBAAgB,E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nPropertyNames;var Ve=Object.getPrototypeOf,Se=Object.prototype.hasOwnProperty;var Ee=(o,r)=>{for(var t in r)w(o,t,{get:r[t],enumerable:!0})},ce=(o,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Ie(r))!Se.call(o,a)&&a!==t&&w(o,a,{get:()=>r[a],enumerable:!(n=ye(r,a))||n.enumerable});return o};var $=(o,r,t)=>(t=o!=null?he(Ve(o)):{},ce(r||!o||!o.__esModule?w(t,"default",{value:o,enumerable:!0}):t,o)),Re=o=>ce(w({},"__esModule",{value:!0}),o);var Te={};Ee(Te,{Content:()=>J,Empty:()=>X,Group:()=>Y,Input:()=>Q,Item:()=>oe,Label:()=>Z,List:()=>U,Root:()=>K,Separator:()=>ee,Trigger:()=>_,Value:()=>z});module.exports=Re(Te);var e=$(require("react")),b=$(require("classnames")),O=require("radix-ui/internal"),S=require("cmdk"),q=require("../helpers/extract-props.js"),u=require("./combobox.props.js"),fe=require("../props/margin.props.js"),k=require("./icons.js"),F=require("./theme.js"),xe=require("../helpers/require-react-element.js"),j=$(require("./popover.js")),ge=require("./scroll-area.js"),Pe=require("./slot.js"),Le=require("./text-field.props.js");const de=e.createContext(null),T=o=>{const r=e.useContext(de);if(!r)throw new Error(`${o} must be used within Combobox.Root`);return r},ue=e.createContext(null),Ce=()=>e.useContext(ue),K=o=>{const{children:r,size:t=u.comboboxRootPropDefs.size.default,highContrast:n=u.comboboxRootPropDefs.highContrast.default,value:a,defaultValue:s=null,onValueChange:i,open:p,defaultOpen:c=!1,onOpenChange:l,placeholder:m="Select an option",searchPlaceholder:P="Search options...",searchValue:C,defaultSearchValue:f="",onSearchValueChange:x,filter:d,shouldFilter:h=!0,loop:g=!0,disabled:E,resetSearchOnSelect:y=!0,color:R,displayValue:V,...N}=o,te=`combobox-listbox-${e.useId()}`,[re,ne]=e.useState(void 0),[B,L]=(0,O.useControllableState)({prop:p,defaultProp:c,onChange:l}),[v,D]=(0,O.useControllableState)({prop:a,defaultProp:s,onChange:i}),[ae,M]=(0,O.useControllableState)({prop:C,defaultProp:f,onChange:x}),W=e.useRef(new Map),[se,A]=e.useState(void 0),ie=e.useCallback((I,be)=>{W.current.set(I,be),I===v&&A(be)},[v]),le=e.useCallback(I=>{W.current.delete(I)},[]);e.useEffect(()=>{if(v!=null){const I=W.current.get(v);A(I)}else A(void 0)},[v]);const me=e.useCallback(I=>{D(I),L(!1),y&&M("")},[L,M,D,y]);e.useEffect(()=>{},[v]);const pe=e.useMemo(()=>{if(V!=null)return typeof V=="function"?V(v):V},[V,v]),ve=e.useMemo(()=>({size:t,highContrast:n,placeholder:m,searchPlaceholder:P,filter:d,shouldFilter:h,loop:g,disabled:E,resetSearchOnSelect:y,color:R,resolvedDisplayValue:pe,open:B,setOpen:L,value:v,setValue:D,searchValue:ae,setSearchValue:M,selectedLabel:se,registerItemLabel:ie,unregisterItemLabel:le,handleSelect:me,listboxId:te,activeDescendantId:re,setActiveDescendantId:ne}),[t,n,m,P,d,h,g,E,y,R,pe,B,L,v,D,ae,M,se,ie,le,me,te,re,ne]);return e.createElement(de.Provider,{value:ve},e.createElement(j.Root,{open:B,onOpenChange:L,...N},r))};K.displayName="Combobox.Root";const _=e.forwardRef((o,r)=>{const t=T("Combobox.Trigger"),{children:n,className:a,placeholder:s,disabled:i,readOnly:p,error:c,loading:l,color:m,radius:P,...C}=(0,q.extractProps)({size:t.size,highContrast:t.highContrast,...o},{size:u.comboboxRootPropDefs.size,highContrast:u.comboboxRootPropDefs.highContrast},u.comboboxTriggerPropDefs,fe.marginPropDefs),{material:f,panelBackground:x}=o,d=i??t.disabled,h=m??t.color,g=e.useMemo(()=>({role:"combobox","aria-expanded":t.open,"aria-disabled":d||void 0,"aria-haspopup":"listbox","aria-controls":t.open?t.listboxId:void 0,"aria-activedescendant":t.open?t.activeDescendantId:void 0,"aria-autocomplete":"list"}),[t.open,t.listboxId,t.activeDescendantId,d]),E=e.createElement(e.Fragment,null,e.createElement("span",{className:"rt-SelectTriggerInner"},e.createElement(z,{placeholder:s??t.placeholder})),l?e.createElement("div",{className:"rt-SelectIcon rt-SelectLoadingIcon","aria-hidden":"true"},e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},e.createElement("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"6 34",strokeDashoffset:"0",className:"rt-SelectLoadingSpinner"}))):e.createElement(k.ChevronDownIcon,{className:"rt-SelectIcon"})),{type:y,...R}=C,N=e.createElement("button",{"data-accent-color":h,"data-radius":P,"data-panel-background":x,"data-material":f,"data-error":c,"data-loading":l,"data-disabled":d||void 0,"data-read-only":p||void 0,...R,...g,type:y??"button",disabled:d,ref:r,className:(0,b.default)("rt-reset","rt-SelectTrigger","rt-ComboboxTrigger",a)},n?(0,xe.requireReactElement)(n):E);return e.createElement(j.Trigger,{disabled:d},N)});_.displayName="Combobox.Trigger";const z=e.forwardRef(({placeholder:o,children:r,className:t,...n},a)=>{const s=T("Combobox.Value"),i=s.resolvedDisplayValue??s.selectedLabel??s.value??void 0,p=o??s.placeholder;return e.createElement("span",{...n,ref:a,className:(0,b.default)("rt-ComboboxValue",t)},i??r??p)});z.displayName="Combobox.Value";const J=e.forwardRef((o,r)=>{const t=T("Combobox.Content"),n=(0,F.useThemeContext)(),a=n.panelBackground,s=o.size??t.size??u.comboboxContentPropDefs.size.default,i=o.variant??u.comboboxContentPropDefs.variant.default,p=o.highContrast??t.highContrast??u.comboboxContentPropDefs.highContrast.default,{className:c,children:l,color:m,forceMount:P,container:C,...f}=(0,q.extractProps)({...o,size:s,variant:i,highContrast:p},u.comboboxContentPropDefs),x=m||t.color||n.accentColor,d=e.useMemo(()=>typeof s!="string"?c:c?.split(/\s+/).filter(Boolean).filter(g=>!/^rt-r-size-\d$/.test(g)).join(" ")||void 0,[c,s]),h=P===!0?!0:void 0;return e.createElement(j.Content,{size:s,"data-accent-color":x,"data-material":a,"data-panel-background":a,align:"start",sideOffset:4,collisionPadding:10,...f,forceMount:h,container:C,ref:r,className:(0,b.default)("rt-PopperContent","rt-BaseMenuContent","rt-ComboboxContent",d)},e.createElement(F.Theme,{asChild:!0},e.createElement(ue.Provider,{value:{variant:i,size:String(s),color:x,material:a,highContrast:p}},e.createElement(S.Command,{loop:t.loop,shouldFilter:t.shouldFilter,filter:t.filter,className:"rt-ComboboxCommand"},l))))});J.displayName="Combobox.Content";const Q=e.forwardRef(({className:o,startAdornment:r,endAdornment:t,placeholder:n,variant:a,value:s,onValueChange:i,...p},c)=>{const l=T("Combobox.Input"),m=Ce(),P=m?.variant??"solid",C=m?.color,f=m?.material,x=a??(P==="solid"?"surface":"soft"),d=s??l.searchValue,h=i??l.setSearchValue,g=e.createElement("div",{className:(0,b.default)("rt-TextFieldRoot","rt-ComboboxInputRoot",`rt-r-size-${l.size}`,`rt-variant-${x}`),"data-accent-color":C,"data-material":f,"data-panel-background":f},r?e.createElement("div",{className:"rt-TextFieldSlot"},r):null,e.createElement(S.Command.Input,{...p,ref:c,value:d,onValueChange:h,placeholder:n??l.searchPlaceholder,className:(0,b.default)("rt-reset","rt-TextFieldInput",o)}),t?e.createElement("div",{className:"rt-TextFieldSlot","data-side":"right"},t):null);return m?e.createElement("div",{className:"rt-ComboboxSearch"},g):g});Q.displayName="Combobox.Input";const U=e.forwardRef(({className:o,...r},t)=>{const n=T("Combobox.List"),a=e.useRef(null),s=e.useCallback(i=>{a.current=i,typeof t=="function"?t(i):t&&(t.current=i)},[t]);return e.useEffect(()=>{const i=a.current;if(!i)return;const p=()=>{const m=i.querySelector('[data-selected="true"], [aria-selected="true"]')?.id;n.setActiveDescendantId(m||void 0)};p();const c=new MutationObserver(p);return c.observe(i,{attributes:!0,attributeFilter:["data-selected","aria-selected"],subtree:!0}),()=>c.disconnect()},[n.setActiveDescendantId]),e.createElement(ge.ScrollArea,{type:"auto",className:"rt-ComboboxScrollArea",scrollbars:"vertical",size:"1"},e.createElement("div",{className:(0,b.default)("rt-BaseMenuViewport","rt-ComboboxViewport")},e.createElement(S.Command.List,{...r,ref:s,id:n.listboxId,role:"listbox","aria-label":"Options",className:(0,b.default)("rt-ComboboxList",o)})))});U.displayName="Combobox.List";const X=e.forwardRef(({className:o,...r},t)=>e.createElement(S.Command.Empty,{...r,ref:t,className:(0,b.default)("rt-ComboboxEmpty",o)}));X.displayName="Combobox.Empty";const Y=e.forwardRef(({className:o,...r},t)=>e.createElement(S.Command.Group,{...r,ref:t,className:(0,b.default)("rt-BaseMenuGroup","rt-ComboboxGroup",o)}));Y.displayName="Combobox.Group";const Z=e.forwardRef(({className:o,...r},t)=>e.createElement("div",{...r,ref:t,className:(0,b.default)("rt-BaseMenuLabel","rt-ComboboxLabel",o)}));Z.displayName="Combobox.Label";const ee=e.forwardRef(({className:o,...r},t)=>e.createElement(S.Command.Separator,{...r,ref:t,className:(0,b.default)("rt-BaseMenuSeparator","rt-ComboboxSeparator",o)}));ee.displayName="Combobox.Separator";function H(o){if(typeof o=="string")return o;if(typeof o=="number")return String(o);if(o==null||typeof o=="boolean")return"";if(Array.isArray(o))return o.map(H).filter(Boolean).join(" ");if(e.isValidElement(o)){const r=o.props;if(r.children)return H(r.children)}return""}const oe=e.forwardRef(({className:o,children:r,label:t,value:n,disabled:a,onSelect:s,keywords:i,...p},c)=>{const l=T("Combobox.Item"),m=Ce(),P=e.useMemo(()=>H(r),[r]),C=t??(P||String(n)),f=n!=null&&l.value===n,x=m?.size?`rt-r-size-${m.size}`:void 0,d=i??[C],g=`combobox-item-${e.useId()}`,{registerItemLabel:E,unregisterItemLabel:y,handleSelect:R}=l;e.useEffect(()=>{if(n)return E(n,C),()=>y(n)},[E,y,n,C]);const V=e.useCallback(G=>{R(G),s?.(G)},[R,s]),N=a??l.disabled??!1;return e.createElement(S.Command.Item,{...p,id:g,value:n,keywords:d,role:"option","aria-selected":f,...N?{disabled:!0,"aria-disabled":!0}:{},ref:c,onSelect:V,className:(0,b.default)("rt-reset","rt-BaseMenuItem","rt-ComboboxItem",o)},f?e.createElement("span",{className:(0,b.default)("rt-BaseMenuItemIndicator","rt-ComboboxItemIndicator",x)},e.createElement(k.ThickCheckIcon,{className:(0,b.default)("rt-BaseMenuItemIndicatorIcon","rt-ComboboxItemIndicatorIcon",x)})):null,e.createElement(Pe.Slottable,null,r))});oe.displayName="Combobox.Item";
|
|
1
|
+
"use strict";"use client";var wo=Object.create;var M=Object.defineProperty;var Do=Object.getOwnPropertyDescriptor;var Mo=Object.getOwnPropertyNames;var Oo=Object.getPrototypeOf,zo=Object.prototype.hasOwnProperty;var ko=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},Co=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Mo(t))!zo.call(e,a)&&a!==n&&M(e,a,{get:()=>t[a],enumerable:!(r=Do(t,a))||r.enumerable});return e};var j=(e,t,n)=>(n=e!=null?wo(Oo(e)):{},Co(t||!e||!e.__esModule?M(n,"default",{value:e,enumerable:!0}):n,e)),Fo=e=>Co(M({},"__esModule",{value:!0}),e);var Bo={};ko(Bo,{Content:()=>J,Empty:()=>Y,Group:()=>oo,Input:()=>Q,Item:()=>no,Label:()=>eo,List:()=>U,Root:()=>X,Separator:()=>to,Trigger:()=>Z,Value:()=>k});module.exports=Fo(Bo);var o=j(require("react")),p=j(require("classnames")),z=require("radix-ui/internal"),E=require("cmdk"),K=require("../helpers/extract-props.js"),x=require("./combobox.props.js"),Io=require("../props/margin.props.js"),F=require("./icons.js"),G=require("./theme.js"),So=require("../helpers/require-react-element.js"),H=j(require("./popover.js")),Vo=require("./scroll-area.js"),Eo=require("./slot.js"),$o=require("./text-field.props.js");const Go=/^rt-r-size-\d$/,xo=o.createContext(null),fo=o.createContext(null),go=o.createContext(null),ho=o.createContext(null),T=e=>{const t=o.useContext(xo);if(!t)throw new Error(`${e} must be used within Combobox.Root`);return t},O=e=>{const t=o.useContext(fo);if(!t)throw new Error(`${e} must be used within Combobox.Root`);return t},Po=e=>{const t=o.useContext(go);if(!t)throw new Error(`${e} must be used within Combobox.Root`);return t},_=e=>{const t=o.useContext(ho);if(!t)throw new Error(`${e} must be used within Combobox.Root`);return t},jo=e=>{const t=T(e),n=O(e),r=Po(e),a=_(e);return{...t,...n,...r,...a}},vo=o.createContext(null),yo=()=>o.useContext(vo),X=e=>{const{children:t,size:n=x.comboboxRootPropDefs.size.default,highContrast:r=x.comboboxRootPropDefs.highContrast.default,value:a,defaultValue:i=null,onValueChange:l,open:b,defaultOpen:s=!1,onOpenChange:u,placeholder:c="Select an option",searchPlaceholder:m="Search options...",searchValue:f,defaultSearchValue:g="",onSearchValueChange:C,filter:h,shouldFilter:P=!0,loop:d=!0,disabled:I,resetSearchOnSelect:S=!0,color:R,displayValue:v,...L}=e,N=`combobox-listbox-${o.useId()}`,[ro,ao]=o.useState(void 0),[W,w]=(0,z.useControllableState)({prop:b,defaultProp:s,onChange:u}),[y,so]=(0,z.useControllableState)({prop:a,defaultProp:i,onChange:l}),[io,D]=(0,z.useControllableState)({prop:f,defaultProp:g,onChange:C}),$=o.useRef(new Map),[lo,A]=o.useState(void 0),mo=o.useCallback((V,uo)=>{$.current.set(V,uo),V===y&&A(uo)},[y]),bo=o.useCallback(V=>{$.current.delete(V)},[]);o.useEffect(()=>{if(y!=null){const V=$.current.get(y);A(V)}else A(void 0)},[y]);const co=o.useCallback(V=>{so(V),w(!1),S&&D("")},[w,D,so,S]);o.useEffect(()=>{},[y]);const po=o.useMemo(()=>{if(v!=null)return typeof v=="function"?v(y):v},[v,y]),Ro=o.useMemo(()=>({size:n,highContrast:r,placeholder:c,searchPlaceholder:m,filter:h,shouldFilter:P,loop:d,disabled:I,resetSearchOnSelect:S,color:R,listboxId:N}),[n,r,c,m,h,P,d,I,S,R,N]),No=o.useMemo(()=>({open:W,setOpen:w,value:y,selectedLabel:lo,resolvedDisplayValue:po,registerItemLabel:mo,unregisterItemLabel:bo,handleSelect:co}),[W,w,y,lo,po,mo,bo,co]),To=o.useMemo(()=>({searchValue:io,setSearchValue:D}),[io,D]),Lo=o.useMemo(()=>({activeDescendantId:ro,setActiveDescendantId:ao}),[ro,ao]);return o.createElement(xo.Provider,{value:Ro},o.createElement(fo.Provider,{value:No},o.createElement(go.Provider,{value:To},o.createElement(ho.Provider,{value:Lo},o.createElement(H.Root,{open:W,onOpenChange:w,...L},t)))))};X.displayName="Combobox.Root";const Z=o.forwardRef((e,t)=>{const n=T("Combobox.Trigger"),r=O("Combobox.Trigger"),a=_("Combobox.Trigger"),{children:i,className:l,placeholder:b,disabled:s,readOnly:u,error:c,loading:m,color:f,radius:g,...C}=(0,K.extractProps)({size:n.size,highContrast:n.highContrast,...e},{size:x.comboboxRootPropDefs.size,highContrast:x.comboboxRootPropDefs.highContrast},x.comboboxTriggerPropDefs,Io.marginPropDefs),{material:h,panelBackground:P}=e,d=s??n.disabled,I=f??n.color,S=o.useMemo(()=>({role:"combobox","aria-expanded":r.open,"aria-disabled":d||void 0,"aria-haspopup":"listbox","aria-controls":r.open?n.listboxId:void 0,"aria-activedescendant":r.open?a.activeDescendantId:void 0,"aria-autocomplete":"list"}),[r.open,n.listboxId,a.activeDescendantId,d]),R=o.createElement(o.Fragment,null,o.createElement("span",{className:"rt-SelectTriggerInner"},o.createElement(k,{placeholder:b??n.placeholder})),m?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(F.ChevronDownIcon,{className:"rt-SelectIcon"})),{type:v,...L}=C,N=o.createElement("button",{"data-accent-color":I,"data-radius":g,"data-panel-background":P,"data-material":h,"data-error":c,"data-loading":m,"data-disabled":d||void 0,"data-read-only":u||void 0,...L,...S,type:v??"button",disabled:d,ref:t,className:(0,p.default)("rt-reset","rt-SelectTrigger","rt-ComboboxTrigger",l)},i?(0,So.requireReactElement)(i):R);return o.createElement(H.Trigger,{disabled:d},N)});Z.displayName="Combobox.Trigger";const k=o.forwardRef(({placeholder:e,children:t,className:n,...r},a)=>{const i=T("Combobox.Value"),l=O("Combobox.Value"),b=l.resolvedDisplayValue??l.selectedLabel??l.value??void 0,s=e??i.placeholder;return o.createElement("span",{...r,ref:a,className:(0,p.default)("rt-ComboboxValue",n)},b??t??s)});k.displayName="Combobox.Value";const J=o.forwardRef((e,t)=>{const n=T("Combobox.Content"),r=(0,G.useThemeContext)(),a=r.panelBackground,i=e.size??n.size??x.comboboxContentPropDefs.size.default,l=e.variant??x.comboboxContentPropDefs.variant.default,b=e.highContrast??n.highContrast??x.comboboxContentPropDefs.highContrast.default,{className:s,children:u,color:c,forceMount:m,container:f,...g}=(0,K.extractProps)({...e,size:i,variant:l,highContrast:b},x.comboboxContentPropDefs),C=c||n.color||r.accentColor,h=o.useMemo(()=>typeof i!="string"?s:s?.split(/\s+/).filter(Boolean).filter(d=>!Go.test(d)).join(" ")||void 0,[s,i]),P=m===!0?!0:void 0;return o.createElement(H.Content,{size:i,"data-accent-color":C,"data-material":a,"data-panel-background":a,align:"start",sideOffset:4,collisionPadding:10,...g,forceMount:P,container:f,ref:t,className:(0,p.default)("rt-PopperContent","rt-BaseMenuContent","rt-ComboboxContent",h)},o.createElement(G.Theme,{asChild:!0},o.createElement(vo.Provider,{value:{variant:l,size:String(i),color:C,material:a,highContrast:b}},o.createElement(E.Command,{loop:n.loop,shouldFilter:n.shouldFilter,filter:n.filter,className:"rt-ComboboxCommand"},u))))});J.displayName="Combobox.Content";const Q=o.forwardRef(({className:e,startAdornment:t,endAdornment:n,placeholder:r,variant:a,value:i,onValueChange:l,...b},s)=>{const u=T("Combobox.Input"),c=Po("Combobox.Input"),m=yo(),f=m?.variant??"solid",g=m?.color,C=m?.material,h=a??(f==="solid"?"surface":"soft"),P=i??c.searchValue,d=l??c.setSearchValue,I=o.createElement("div",{className:(0,p.default)("rt-TextFieldRoot","rt-ComboboxInputRoot",`rt-r-size-${u.size}`,`rt-variant-${h}`),"data-accent-color":g,"data-material":C,"data-panel-background":C},t?o.createElement("div",{className:"rt-TextFieldSlot"},t):null,o.createElement(E.Command.Input,{...b,ref:s,value:P,onValueChange:d,placeholder:r??u.searchPlaceholder,className:(0,p.default)("rt-reset","rt-TextFieldInput",e)}),n?o.createElement("div",{className:"rt-TextFieldSlot","data-side":"right"},n):null);return m?o.createElement("div",{className:"rt-ComboboxSearch"},I):I});Q.displayName="Combobox.Input";const U=o.forwardRef(({className:e,...t},n)=>{const r=T("Combobox.List"),a=_("Combobox.List"),i=o.useRef(null),l=o.useCallback(s=>{i.current=s,typeof n=="function"?n(s):n&&(n.current=s)},[n]),{setActiveDescendantId:b}=a;return o.useEffect(()=>{const s=i.current;if(!s)return;const u=()=>{const f=s.querySelector('[data-selected="true"], [aria-selected="true"]')?.id;b(f||void 0)};u();const c=new MutationObserver(u);return c.observe(s,{attributes:!0,attributeFilter:["data-selected","aria-selected"],subtree:!0}),()=>c.disconnect()},[b]),o.createElement(Vo.ScrollArea,{type:"auto",className:"rt-ComboboxScrollArea",scrollbars:"vertical",size:"1"},o.createElement("div",{className:(0,p.default)("rt-BaseMenuViewport","rt-ComboboxViewport")},o.createElement(E.Command.List,{...t,ref:l,id:r.listboxId,role:"listbox","aria-label":"Options",className:(0,p.default)("rt-ComboboxList",e)})))});U.displayName="Combobox.List";const Y=o.forwardRef(({className:e,...t},n)=>o.createElement(E.Command.Empty,{...t,ref:n,className:(0,p.default)("rt-ComboboxEmpty",e)}));Y.displayName="Combobox.Empty";const oo=o.forwardRef(({className:e,...t},n)=>o.createElement(E.Command.Group,{...t,ref:n,className:(0,p.default)("rt-BaseMenuGroup","rt-ComboboxGroup",e)}));oo.displayName="Combobox.Group";const eo=o.forwardRef(({className:e,...t},n)=>o.createElement("div",{...t,ref:n,className:(0,p.default)("rt-BaseMenuLabel","rt-ComboboxLabel",e)}));eo.displayName="Combobox.Label";const to=o.forwardRef(({className:e,...t},n)=>o.createElement(E.Command.Separator,{...t,ref:n,className:(0,p.default)("rt-BaseMenuSeparator","rt-ComboboxSeparator",e)}));to.displayName="Combobox.Separator";function q(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(e==null||typeof e=="boolean")return"";if(Array.isArray(e))return e.map(q).filter(Boolean).join(" ");if(o.isValidElement(e)){const t=e.props;if(t.children)return q(t.children)}return""}const no=o.forwardRef(({className:e,children:t,label:n,value:r,disabled:a,onSelect:i,keywords:l,...b},s)=>{const u=T("Combobox.Item"),c=O("Combobox.Item"),m=yo(),f=o.useMemo(()=>q(t),[t]),g=n??(f||String(r)),C=r!=null&&c.value===r,h=m?.size?`rt-r-size-${m.size}`:void 0,P=l??[g],I=`combobox-item-${o.useId()}`,{registerItemLabel:S,unregisterItemLabel:R,handleSelect:v}=c;o.useEffect(()=>{if(r)return S(r,g),()=>R(r)},[S,R,r,g]);const L=o.useCallback(N=>{v(N),i?.(N)},[v,i]),B=a??u.disabled??!1;return o.createElement(E.Command.Item,{...b,id:I,value:r,keywords:P,role:"option","aria-selected":C,...B?{disabled:!0,"aria-disabled":!0}:{},ref:s,onSelect:L,className:(0,p.default)("rt-reset","rt-BaseMenuItem","rt-ComboboxItem",e)},C?o.createElement("span",{className:(0,p.default)("rt-BaseMenuItemIndicator","rt-ComboboxItemIndicator",h)},o.createElement(F.ThickCheckIcon,{className:(0,p.default)("rt-BaseMenuItemIndicatorIcon","rt-ComboboxItemIndicatorIcon",h)})):null,o.createElement(Eo.Slottable,null,t))});no.displayName="Combobox.Item";
|
|
2
2
|
//# sourceMappingURL=combobox.js.map
|