@kushagradhawan/kookie-ui 0.1.125 → 0.1.127
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 +124 -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 +63 -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/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 +63 -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/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 +2 -2
- 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 +252 -0
- package/src/components/animations.css +11 -0
- package/src/components/dropdown-menu.css +141 -0
- package/src/components/dropdown-menu.props.tsx +2 -0
- package/src/components/dropdown-menu.tsx +219 -27
- package/src/components/icons.tsx +14 -1
- package/styles.css +124 -0
package/components.css
CHANGED
|
@@ -351,6 +351,26 @@
|
|
|
351
351
|
animation: rt-tab-indicator-appear var(--motion-duration-small) var(--motion-spring-snappy);
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
+
@keyframes rt-drill-down-enter-from-right {
|
|
355
|
+
from {
|
|
356
|
+
opacity: 0;
|
|
357
|
+
transform: translateX(30%);
|
|
358
|
+
}
|
|
359
|
+
to {
|
|
360
|
+
opacity: 1;
|
|
361
|
+
transform: translateX(0);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
@keyframes rt-drill-down-enter-from-left {
|
|
365
|
+
from {
|
|
366
|
+
opacity: 0;
|
|
367
|
+
transform: translateX(-30%);
|
|
368
|
+
}
|
|
369
|
+
to {
|
|
370
|
+
opacity: 1;
|
|
371
|
+
transform: translateX(0);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
354
374
|
@keyframes rt-dialog-overlay-no-op {
|
|
355
375
|
from {
|
|
356
376
|
opacity: 1;
|
|
@@ -8648,6 +8668,110 @@
|
|
|
8648
8668
|
height: var(--trigger-icon-size-4);
|
|
8649
8669
|
}
|
|
8650
8670
|
}
|
|
8671
|
+
.rt-DropdownMenuDrillDownRoot {
|
|
8672
|
+
display: contents;
|
|
8673
|
+
}
|
|
8674
|
+
.rt-DropdownMenuDrillDownRoot:where([data-drill-down-active]) > * {
|
|
8675
|
+
display: none !important;
|
|
8676
|
+
}
|
|
8677
|
+
.rt-DropdownMenuDrillDownRoot:where([data-drill-down-active]) > :where(.rt-DropdownMenuDrillDownPanel) {
|
|
8678
|
+
display: contents !important;
|
|
8679
|
+
}
|
|
8680
|
+
.rt-DropdownMenuDrillDownPanel {
|
|
8681
|
+
display: contents;
|
|
8682
|
+
}
|
|
8683
|
+
.rt-DropdownMenuDrillDownPanel:where(:not([data-drill-down-active])) > * {
|
|
8684
|
+
display: none !important;
|
|
8685
|
+
}
|
|
8686
|
+
.rt-DropdownMenuDrillDownPanel:where(:not([data-drill-down-active])) > :where(.rt-DropdownMenuDrillDownPanel) {
|
|
8687
|
+
display: contents !important;
|
|
8688
|
+
}
|
|
8689
|
+
.rt-DropdownMenuDrillDownBackItem {
|
|
8690
|
+
display: flex;
|
|
8691
|
+
align-items: center;
|
|
8692
|
+
gap: var(--space-2);
|
|
8693
|
+
min-height: var(--base-menu-item-height);
|
|
8694
|
+
padding-top: var(--base-menu-item-padding-y);
|
|
8695
|
+
padding-bottom: var(--base-menu-item-padding-y);
|
|
8696
|
+
padding-inline-start: var(--base-menu-item-padding-left);
|
|
8697
|
+
padding-inline-end: var(--base-menu-item-padding-right);
|
|
8698
|
+
box-sizing: border-box;
|
|
8699
|
+
outline: none;
|
|
8700
|
+
cursor: var(--cursor-menu-item);
|
|
8701
|
+
-webkit-user-select: none;
|
|
8702
|
+
-moz-user-select: none;
|
|
8703
|
+
user-select: none;
|
|
8704
|
+
transition: var(--transition-menu);
|
|
8705
|
+
font-weight: 500;
|
|
8706
|
+
}
|
|
8707
|
+
.rt-DropdownMenuDrillDownBackItem:where(:focus-visible) {
|
|
8708
|
+
outline: 2px solid var(--focus-8);
|
|
8709
|
+
outline-offset: -2px;
|
|
8710
|
+
}
|
|
8711
|
+
@media (prefers-reduced-motion: reduce) {
|
|
8712
|
+
.rt-DropdownMenuDrillDownBackItem {
|
|
8713
|
+
transition: none;
|
|
8714
|
+
}
|
|
8715
|
+
}
|
|
8716
|
+
.rt-DropdownMenuDrillDownBackIcon {
|
|
8717
|
+
width: var(--indicator-icon-size-2);
|
|
8718
|
+
height: var(--indicator-icon-size-2);
|
|
8719
|
+
flex-shrink: 0;
|
|
8720
|
+
color: var(--gray-12);
|
|
8721
|
+
}
|
|
8722
|
+
.rt-DropdownMenuDrillDownBackLabel {
|
|
8723
|
+
color: var(--gray-12);
|
|
8724
|
+
}
|
|
8725
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:hover),
|
|
8726
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible),
|
|
8727
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:hover),
|
|
8728
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) {
|
|
8729
|
+
background-color: var(--accent-9);
|
|
8730
|
+
color: var(--accent-contrast);
|
|
8731
|
+
}
|
|
8732
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:hover) :where(.rt-DropdownMenuDrillDownBackIcon),
|
|
8733
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible) :where(.rt-DropdownMenuDrillDownBackIcon),
|
|
8734
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:hover) :where(.rt-DropdownMenuDrillDownBackIcon),
|
|
8735
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) :where(.rt-DropdownMenuDrillDownBackIcon),
|
|
8736
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:hover) :where(.rt-DropdownMenuDrillDownBackLabel),
|
|
8737
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible) :where(.rt-DropdownMenuDrillDownBackLabel),
|
|
8738
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:hover) :where(.rt-DropdownMenuDrillDownBackLabel),
|
|
8739
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) :where(.rt-DropdownMenuDrillDownBackLabel),
|
|
8740
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:hover) :where(.rt-BaseMenuSubTriggerIcon),
|
|
8741
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible) :where(.rt-BaseMenuSubTriggerIcon),
|
|
8742
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:hover) :where(.rt-BaseMenuSubTriggerIcon),
|
|
8743
|
+
.rt-BaseMenuContent:where(.rt-variant-solid) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) :where(.rt-BaseMenuSubTriggerIcon) {
|
|
8744
|
+
color: var(--accent-contrast);
|
|
8745
|
+
}
|
|
8746
|
+
.rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownBackItem:hover),
|
|
8747
|
+
.rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible),
|
|
8748
|
+
.rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownSubTrigger:hover),
|
|
8749
|
+
.rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) {
|
|
8750
|
+
background-color: var(--accent-4);
|
|
8751
|
+
}
|
|
8752
|
+
:where([data-panel-background='translucent']) .rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownBackItem:hover),
|
|
8753
|
+
:where([data-panel-background='translucent']) .rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownBackItem:focus-visible),
|
|
8754
|
+
:where([data-panel-background='translucent']) .rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownSubTrigger:hover),
|
|
8755
|
+
:where([data-panel-background='translucent']) .rt-BaseMenuContent:where(.rt-variant-soft) :where(.rt-DropdownMenuDrillDownSubTrigger:focus-visible) {
|
|
8756
|
+
background-color: var(--accent-a4);
|
|
8757
|
+
}
|
|
8758
|
+
@media (forced-colors: active) {
|
|
8759
|
+
.rt-DropdownMenuDrillDownBackItem:where(:focus-visible) {
|
|
8760
|
+
outline: 2px solid Highlight;
|
|
8761
|
+
outline-offset: 2px;
|
|
8762
|
+
}
|
|
8763
|
+
}
|
|
8764
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
8765
|
+
.rt-DropdownMenuDrillDownPanel:where([data-drill-down-active][data-animation-direction='forward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)) {
|
|
8766
|
+
animation: rt-drill-down-enter-from-right var(--motion-duration-small) var(--motion-ease-smooth);
|
|
8767
|
+
}
|
|
8768
|
+
.rt-DropdownMenuDrillDownPanel:where([data-drill-down-active][data-animation-direction='backward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)) {
|
|
8769
|
+
animation: rt-drill-down-enter-from-left var(--motion-duration-small) var(--motion-ease-smooth);
|
|
8770
|
+
}
|
|
8771
|
+
.rt-DropdownMenuDrillDownRoot:where(:not([data-drill-down-active])[data-animation-direction='backward']) > :where(*:not(.rt-DropdownMenuDrillDownPanel)) {
|
|
8772
|
+
animation: rt-drill-down-enter-from-left var(--motion-duration-small) var(--motion-ease-smooth);
|
|
8773
|
+
}
|
|
8774
|
+
}
|
|
8651
8775
|
:where([data-panel-background='translucent'], [data-material='translucent']) .rt-TextFieldRoot {
|
|
8652
8776
|
-webkit-backdrop-filter: var(--backdrop-filter-components);
|
|
8653
8777
|
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,63 @@
|
|
|
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
|
+
type AnimationDirection = 'forward' | 'backward' | null;
|
|
20
|
+
interface DrillDownContextValue {
|
|
21
|
+
/** Current submenu behavior mode */
|
|
22
|
+
behavior: SubmenuBehavior;
|
|
23
|
+
/** Whether the breakpoint has been resolved (client-side only) */
|
|
24
|
+
ready: boolean;
|
|
25
|
+
/** Stack of active submenu IDs. Empty means root menu is shown. */
|
|
26
|
+
stack: string[];
|
|
27
|
+
/** Navigate into a submenu */
|
|
28
|
+
push: (id: string) => void;
|
|
29
|
+
/** Navigate back to parent menu */
|
|
30
|
+
pop: () => void;
|
|
31
|
+
/** Reset to root menu */
|
|
32
|
+
reset: () => void;
|
|
33
|
+
/** Check if a specific submenu is the currently active one */
|
|
34
|
+
isActive: (id: string) => boolean;
|
|
35
|
+
/** Check if we're at root level (no submenus open) */
|
|
36
|
+
isRoot: boolean;
|
|
37
|
+
/** The currently active submenu ID (or null if at root) */
|
|
38
|
+
currentId: string | null;
|
|
39
|
+
/** Current animation direction for transitions */
|
|
40
|
+
animationDirection: AnimationDirection;
|
|
41
|
+
}
|
|
42
|
+
declare const DrillDownContext: React.Context<DrillDownContextValue | null>;
|
|
43
|
+
interface DrillDownProviderProps {
|
|
44
|
+
children: React.ReactNode;
|
|
45
|
+
submenuBehavior: Responsive<SubmenuBehavior> | undefined;
|
|
46
|
+
}
|
|
47
|
+
declare function DrillDownProvider({ children, submenuBehavior }: DrillDownProviderProps): React.JSX.Element;
|
|
48
|
+
declare function useDrillDown(): DrillDownContextValue;
|
|
49
|
+
/**
|
|
50
|
+
* Hook to check if drill-down context is available (i.e., we're inside Content)
|
|
51
|
+
*/
|
|
52
|
+
declare function useDrillDownOptional(): DrillDownContextValue | null;
|
|
53
|
+
interface SubContextValue {
|
|
54
|
+
/** Unique ID for this submenu */
|
|
55
|
+
id: string;
|
|
56
|
+
/** Label for the back button */
|
|
57
|
+
label: React.ReactNode;
|
|
58
|
+
}
|
|
59
|
+
declare const SubContext: React.Context<SubContextValue | null>;
|
|
60
|
+
declare function useSubContext(): SubContextValue | null;
|
|
61
|
+
export { DrillDownProvider, DrillDownContext, SubContext, useDrillDown, useDrillDownOptional, useSubContext, useBreakpoint, resolveResponsiveValue, };
|
|
62
|
+
export type { SubmenuBehavior, DrillDownContextValue, SubContextValue, AnimationDirection };
|
|
63
|
+
//# 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,KAAK,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,IAAI,CAAC;AAExD,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;IACzB,kDAAkD;IAClD,kBAAkB,EAAE,kBAAkB,CAAC;CACxC;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,qBA6D/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,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";var L=Object.create;var m=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var r in t)m(e,r,{get:t[r],enumerable:!0})},y=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of A(t))!V.call(e,n)&&n!==r&&m(e,n,{get:()=>t[n],enumerable:!(a=P(t,n))||a.enumerable});return e};var O=(e,t,r)=>(r=e!=null?L(T(e)):{},y(t||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e)),N=e=>y(m({},"__esModule",{value:!0}),e);var I={};M(I,{DrillDownContext:()=>f,DrillDownProvider:()=>C,SubContext:()=>D,resolveResponsiveValue:()=>b,useBreakpoint:()=>v,useDrillDown:()=>k,useDrillDownOptional:()=>B,useSubContext:()=>R});module.exports=N(I);var o=O(require("react")),g=require("../shell.types.js");function v(){const[e,t]=o.useState("initial"),[r,a]=o.useState(!1);return o.useEffect(()=>{if(typeof window>"u")return;const c=Object.entries(g._BREAKPOINTS).map(([i,s])=>[i,window.matchMedia(s)]),u=()=>{const i=c.filter(([,d])=>d.matches).map(([d])=>d),s=i[i.length-1]??"initial";t(s),a(!0)};u();const l=[];return c.forEach(([,i])=>{const s=i;typeof s.addEventListener=="function"?(s.addEventListener("change",u),l.push(()=>s.removeEventListener?.("change",u))):typeof s.addListener=="function"&&(s.addListener(u),l.push(()=>s.removeListener?.(u)))}),()=>{l.forEach(i=>{try{i()}catch{}})}},[]),{breakpoint:e,ready:r}}function b(e,t,r){if(e==null)return r;if(typeof e!="object")return e;const a=e;if(a[t]!==void 0)return a[t];const n=["xl","lg","md","sm","xs","initial"],c=n.indexOf(t);for(let u=c+1;u<n.length;u++){const l=n[u];if(a[l]!==void 0)return a[l]}return r}const f=o.createContext(null);function C({children:e,submenuBehavior:t}){const{breakpoint:r,ready:a}=v(),[n,c]=o.useState([]),[u,l]=o.useState(null),i=o.useMemo(()=>b(t,r,"cascade"),[t,r]),s=o.useRef(i);o.useEffect(()=>{s.current==="drill-down"&&i==="cascade"&&(c([]),l(null)),s.current=i},[i]);const d=o.useCallback(p=>{l("forward"),c(E=>[...E,p])},[]),h=o.useCallback(()=>{l("backward"),c(p=>p.slice(0,-1))},[]),w=o.useCallback(()=>{c([]),l(null)},[]),x=o.useCallback(p=>n.length===0?!1:n[n.length-1]===p,[n]),S=o.useMemo(()=>({behavior:i,ready:a,stack:n,push:d,pop:h,reset:w,isActive:x,isRoot:n.length===0,currentId:n.length>0?n[n.length-1]:null,animationDirection:u}),[i,a,n,d,h,w,x,u]);return o.createElement(f.Provider,{value:S},e)}function k(){const e=o.useContext(f);if(!e)throw new Error("useDrillDown must be used within a DropdownMenu.Content");return e}function B(){return o.useContext(f)}const D=o.createContext(null);function R(){return o.useContext(D)}
|
|
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\ntype AnimationDirection = 'forward' | 'backward' | null;\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 /** Current animation direction for transitions */\n animationDirection: AnimationDirection;\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 const [animationDirection, setAnimationDirection] = React.useState<AnimationDirection>(null);\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 setAnimationDirection(null);\n }\n prevBehaviorRef.current = behavior;\n }, [behavior]);\n\n const push = React.useCallback((id: string) => {\n setAnimationDirection('forward');\n setStack((prev) => [...prev, id]);\n }, []);\n\n const pop = React.useCallback(() => {\n setAnimationDirection('backward');\n setStack((prev) => prev.slice(0, -1));\n }, []);\n\n const reset = React.useCallback(() => {\n setStack([]);\n setAnimationDirection(null);\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 animationDirection,\n }),\n [behavior, ready, stack, push, pop, reset, isActive, animationDirection]\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, AnimationDirection };\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,EAE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,EAAM,OAAS,EAAIA,EAAMA,EAAM,OAAS,CAAC,EAAI,KACxD,mBAAAE,CACF,GACA,CAACE,EAAU3B,EAAOuB,EAAOM,EAAMG,EAAKC,EAAOC,EAAUT,CAAkB,CACzE,EAEA,OAAO7B,EAAA,cAACT,EAAiB,SAAjB,CAA0B,MAAOyB,GAAQQ,CAAS,CAC5D,CAEA,SAAS5B,GAAe,CACtB,MAAM2C,EAAMvC,EAAM,WAAWT,CAAgB,EAC7C,GAAI,CAACgD,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT,CAKA,SAAS1C,GAAuB,CAC9B,OAAOG,EAAM,WAAWT,CAAgB,CAC1C,CAaA,MAAME,EAAaO,EAAM,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", "i", "bp", "children", "submenuBehavior", "breakpoint", "stack", "setStack", "animationDirection", "setAnimationDirection", "behavior", "prevBehaviorRef", "push", "id", "prev", "pop", "reset", "isActive", "ctx"]
|
|
7
|
+
}
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';
|
|
3
3
|
import { dropdownMenuContentPropDefs, dropdownMenuItemPropDefs, dropdownMenuCheckboxItemPropDefs, dropdownMenuRadioItemPropDefs } from './dropdown-menu.props.js';
|
|
4
|
+
import type { SubmenuBehavior } from './_internal/dropdown-menu-drill-down.js';
|
|
4
5
|
import type { IconProps } from './icons.js';
|
|
5
6
|
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
|
|
6
|
-
import type { GetPropDefTypes } from '../props/prop-def.js';
|
|
7
|
+
import type { GetPropDefTypes, Responsive } from '../props/prop-def.js';
|
|
7
8
|
interface DropdownMenuRootProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root> {
|
|
8
9
|
}
|
|
9
10
|
declare const DropdownMenuRoot: React.FC<DropdownMenuRootProps>;
|
|
10
11
|
interface DropdownMenuTriggerProps extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Trigger, RemovedProps> {
|
|
11
12
|
}
|
|
12
13
|
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
-
type DropdownMenuContentOwnProps = GetPropDefTypes<typeof dropdownMenuContentPropDefs
|
|
14
|
-
|
|
14
|
+
type DropdownMenuContentOwnProps = GetPropDefTypes<typeof dropdownMenuContentPropDefs> & {
|
|
15
|
+
/**
|
|
16
|
+
* Controls how submenus behave.
|
|
17
|
+
* - `cascade`: Default cascading behavior where submenus open to the side (portal-based)
|
|
18
|
+
* - `drill-down`: Mobile-friendly behavior where submenus replace the content inline
|
|
19
|
+
* Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`
|
|
20
|
+
*/
|
|
21
|
+
submenuBehavior?: Responsive<SubmenuBehavior>;
|
|
22
|
+
};
|
|
23
|
+
type DropdownMenuContentContextValue = Omit<DropdownMenuContentOwnProps, 'submenuBehavior'>;
|
|
15
24
|
interface DropdownMenuContentProps extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Content, RemovedProps>, DropdownMenuContentContextValue {
|
|
16
25
|
container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];
|
|
26
|
+
/**
|
|
27
|
+
* Controls how submenus behave.
|
|
28
|
+
* - `cascade`: Default cascading behavior where submenus open to the side (portal-based)
|
|
29
|
+
* - `drill-down`: Mobile-friendly behavior where submenus replace the content inline
|
|
30
|
+
* Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`
|
|
31
|
+
*/
|
|
32
|
+
submenuBehavior?: Responsive<SubmenuBehavior>;
|
|
17
33
|
}
|
|
18
34
|
declare const DropdownMenuContent: React.ForwardRefExoticComponent<DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
35
|
interface DropdownMenuLabelProps extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Label, RemovedProps> {
|
|
@@ -38,21 +54,26 @@ interface DropdownMenuCheckboxItemProps extends ComponentPropsWithout<typeof Dro
|
|
|
38
54
|
}
|
|
39
55
|
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
40
56
|
interface DropdownMenuSubProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Sub> {
|
|
57
|
+
/**
|
|
58
|
+
* Label displayed in the back button when using drill-down mode.
|
|
59
|
+
* If not provided, defaults to "Back".
|
|
60
|
+
*/
|
|
61
|
+
label?: React.ReactNode;
|
|
41
62
|
}
|
|
42
63
|
declare const DropdownMenuSub: React.FC<DropdownMenuSubProps>;
|
|
43
64
|
interface DropdownMenuSubTriggerProps extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubTrigger, RemovedProps> {
|
|
44
65
|
}
|
|
45
66
|
declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
interface DropdownMenuSeparatorProps extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Separator, RemovedProps> {
|
|
68
|
+
}
|
|
69
|
+
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
46
70
|
interface DropdownMenuSubContentProps extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubContent, RemovedProps>, DropdownMenuContentContextValue {
|
|
47
71
|
container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];
|
|
48
72
|
}
|
|
49
73
|
declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
-
interface DropdownMenuSeparatorProps extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Separator, RemovedProps> {
|
|
51
|
-
}
|
|
52
|
-
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
74
|
interface DropdownMenuTriggerIconProps extends IconProps {
|
|
54
75
|
}
|
|
55
76
|
declare const DropdownMenuTriggerIcon: React.ForwardRefExoticComponent<DropdownMenuTriggerIconProps & React.RefAttributes<SVGSVGElement>>;
|
|
56
77
|
export { DropdownMenuRoot as Root, DropdownMenuTrigger as Trigger, DropdownMenuTriggerIcon as TriggerIcon, DropdownMenuContent as Content, DropdownMenuLabel as Label, DropdownMenuItem as Item, DropdownMenuGroup as Group, DropdownMenuRadioGroup as RadioGroup, DropdownMenuRadioItem as RadioItem, DropdownMenuCheckboxItem as CheckboxItem, DropdownMenuSub as Sub, DropdownMenuSubTrigger as SubTrigger, DropdownMenuSubContent as SubContent, DropdownMenuSeparator as Separator, };
|
|
57
|
-
export type { DropdownMenuRootProps as RootProps, DropdownMenuTriggerProps as TriggerProps, DropdownMenuTriggerIconProps as TriggerIconProps, DropdownMenuContentProps as ContentProps, DropdownMenuLabelProps as LabelProps, DropdownMenuItemProps as ItemProps, DropdownMenuGroupProps as GroupProps, DropdownMenuRadioGroupProps as RadioGroupProps, DropdownMenuRadioItemProps as RadioItemProps, DropdownMenuCheckboxItemProps as CheckboxItemProps, DropdownMenuSubProps as SubProps, DropdownMenuSubTriggerProps as SubTriggerProps, DropdownMenuSubContentProps as SubContentProps, DropdownMenuSeparatorProps as SeparatorProps, };
|
|
78
|
+
export type { DropdownMenuRootProps as RootProps, DropdownMenuTriggerProps as TriggerProps, DropdownMenuTriggerIconProps as TriggerIconProps, DropdownMenuContentProps as ContentProps, DropdownMenuLabelProps as LabelProps, DropdownMenuItemProps as ItemProps, DropdownMenuGroupProps as GroupProps, DropdownMenuRadioGroupProps as RadioGroupProps, DropdownMenuRadioItemProps as RadioItemProps, DropdownMenuCheckboxItemProps as CheckboxItemProps, DropdownMenuSubProps as SubProps, DropdownMenuSubTriggerProps as SubTriggerProps, DropdownMenuSubContentProps as SubContentProps, DropdownMenuSeparatorProps as SeparatorProps, SubmenuBehavior, };
|
|
58
79
|
//# sourceMappingURL=dropdown-menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAQ,MAAM,UAAU,CAAC;AAGvE,OAAO,EACL,2BAA2B,
|
|
1
|
+
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAQ,MAAM,UAAU,CAAC;AAGvE,OAAO,EACL,2BAA2B,EAE3B,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAWlC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAI/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAExE,UAAU,qBACR,SAAQ,KAAK,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AK,CAAC,wBAAwB,CAAC,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC;CAC9F;AACD,QAAA,MAAM,sBAAsB,oGAkF1B,CAAC;AAIH,UAAU,4BAA6B,SAAQ,SAAS;CAAG;AAC3D,QAAA,MAAM,uBAAuB,oGAK3B,CAAC;AAGH,OAAO,EACL,gBAAgB,IAAI,IAAI,EACxB,mBAAmB,IAAI,OAAO,EAC9B,uBAAuB,IAAI,WAAW,EACtC,mBAAmB,IAAI,OAAO,EAC9B,iBAAiB,IAAI,KAAK,EAC1B,gBAAgB,IAAI,IAAI,EACxB,iBAAiB,IAAI,KAAK,EAC1B,sBAAsB,IAAI,UAAU,EACpC,qBAAqB,IAAI,SAAS,EAClC,wBAAwB,IAAI,YAAY,EACxC,eAAe,IAAI,GAAG,EACtB,sBAAsB,IAAI,UAAU,EACpC,sBAAsB,IAAI,UAAU,EACpC,qBAAqB,IAAI,SAAS,GACnC,CAAC;AAEF,YAAY,EACV,qBAAqB,IAAI,SAAS,EAClC,wBAAwB,IAAI,YAAY,EACxC,4BAA4B,IAAI,gBAAgB,EAChD,wBAAwB,IAAI,YAAY,EACxC,sBAAsB,IAAI,UAAU,EACpC,qBAAqB,IAAI,SAAS,EAClC,sBAAsB,IAAI,UAAU,EACpC,2BAA2B,IAAI,eAAe,EAC9C,0BAA0B,IAAI,cAAc,EAC5C,6BAA6B,IAAI,iBAAiB,EAClD,oBAAoB,IAAI,QAAQ,EAChC,2BAA2B,IAAI,eAAe,EAC9C,2BAA2B,IAAI,eAAe,EAC9C,0BAA0B,IAAI,cAAc,EAC5C,eAAe,GAChB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var Q=Object.create;var v=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var ee=(o,n)=>{for(var r in n)v(o,r,{get:n[r],enumerable:!0})},K=(o,n,r,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of Y(n))!$.call(o,t)&&t!==r&&v(o,t,{get:()=>n[t],enumerable:!(p=X(n,t))||p.enumerable});return o};var j=(o,n,r)=>(r=o!=null?Q(Z(o)):{},K(n||!o||!o.__esModule?v(r,"default",{value:o,enumerable:!0}):r,o)),oe=o=>K(v({},"__esModule",{value:!0}),o);var pe={};ee(pe,{CheckboxItem:()=>L,Content:()=>x,Group:()=>k,Item:()=>B,Label:()=>N,RadioGroup:()=>E,RadioItem:()=>G,Root:()=>R,Separator:()=>b,Sub:()=>W,SubContent:()=>V,SubTrigger:()=>O,Trigger:()=>T,TriggerIcon:()=>_});module.exports=oe(pe);var e=j(require("react")),a=j(require("classnames")),i=require("radix-ui"),h=require("./scroll-area.js"),m=require("./dropdown-menu.props.js"),M=require("./theme.js"),c=require("./icons.js"),S=require("../helpers/extract-props.js"),u=require("./_internal/dropdown-menu-drill-down.js"),q=require("../helpers/require-react-element.js"),y=require("./kbd.js");const R=o=>e.createElement(i.DropdownMenu.Root,{...o});R.displayName="DropdownMenu.Root";const T=e.forwardRef(({children:o,...n},r)=>e.createElement(i.DropdownMenu.Trigger,{...n,ref:r,asChild:!0},(0,q.requireReactElement)(o)));T.displayName="DropdownMenu.Trigger";function ne({children:o}){const n=(0,u.useDrillDownOptional)();return!n||n.behavior==="cascade"?e.createElement(e.Fragment,null,o):e.createElement("div",{className:"rt-DropdownMenuDrillDownRoot","data-drill-down-active":n.isRoot?void 0:!0,"data-animation-direction":n.animationDirection??void 0},o)}const F=e.createContext({}),x=e.forwardRef((o,n)=>{const r=(0,M.useThemeContext)();e.useEffect(()=>{o.panelBackground!==void 0&&console.warn("Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.")},[o.panelBackground]);const p=o.material??o.panelBackground??r.panelBackground,t=e.useMemo(()=>({material:p,accentColor:r.accentColor}),[p,r.accentColor]),{size:d=m.dropdownMenuContentPropDefs.size.default,variant:l=m.dropdownMenuContentPropDefs.variant.default,highContrast:w=m.dropdownMenuContentPropDefs.highContrast.default,material:D=t.material,submenuBehavior:s}=o,{className:f,children:P,color:C,container:I,forceMount:H,material:U,panelBackground:z,submenuBehavior:A,...J}=(0,S.extractProps)(o,m.dropdownMenuContentPropDefs),g=e.useMemo(()=>C||t.accentColor,[C,t.accentColor]);return e.createElement(i.DropdownMenu.Portal,{container:I,forceMount:H},e.createElement(M.Theme,{asChild:!0},e.createElement(i.DropdownMenu.Content,{"data-accent-color":g,"data-material":D,"data-panel-background":D,align:"start",sideOffset:4,collisionPadding:10,...J,asChild:!1,ref:n,className:(0,a.default)("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",f)},e.createElement(h.ScrollArea,{type:"auto"},e.createElement("div",{className:(0,a.default)("rt-BaseMenuViewport","rt-DropdownMenuViewport")},e.createElement(F.Provider,{value:e.useMemo(()=>({size:d,variant:l,color:g,highContrast:w,material:D}),[d,l,g,w,D])},e.createElement(u.DrillDownProvider,{submenuBehavior:s},e.createElement(ne,null,P))))))))});x.displayName="DropdownMenu.Content";const N=e.forwardRef(({className:o,...n},r)=>e.createElement(i.DropdownMenu.Label,{...n,asChild:!1,ref:r,className:(0,a.default)("rt-BaseMenuLabel","rt-DropdownMenuLabel",o)}));N.displayName="DropdownMenu.Label";const B=e.forwardRef((o,n)=>{const{className:r,children:p,color:t=m.dropdownMenuItemPropDefs.color.default,shortcut:d,...l}=o;return e.createElement(i.DropdownMenu.Item,{"data-accent-color":t,...l,ref:n,className:(0,a.default)("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},e.createElement(i.Slot.Slottable,null,p),d&&e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(y.Kbd,{size:"1"},d)))});B.displayName="DropdownMenu.Item";const k=e.forwardRef(({className:o,...n},r)=>e.createElement(i.DropdownMenu.Group,{...n,asChild:!1,ref:r,className:(0,a.default)("rt-BaseMenuGroup","rt-DropdownMenuGroup",o)}));k.displayName="DropdownMenu.Group";const E=e.forwardRef(({className:o,...n},r)=>e.createElement(i.DropdownMenu.RadioGroup,{...n,asChild:!1,ref:r,className:(0,a.default)("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",o)}));E.displayName="DropdownMenu.RadioGroup";const G=e.forwardRef((o,n)=>{const{children:r,className:p,color:t=m.dropdownMenuRadioItemPropDefs.color.default,...d}=o;return e.createElement(i.DropdownMenu.RadioItem,{...d,asChild:!1,ref:n,"data-accent-color":t,className:(0,a.default)("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",p)},r,e.createElement(i.DropdownMenu.ItemIndicator,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},e.createElement(c.ThickDotIcon,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});G.displayName="DropdownMenu.RadioItem";const L=e.forwardRef((o,n)=>{const{children:r,className:p,shortcut:t,color:d=m.dropdownMenuCheckboxItemPropDefs.color.default,...l}=o;return e.createElement(i.DropdownMenu.CheckboxItem,{...l,asChild:!1,ref:n,"data-accent-color":d,className:(0,a.default)("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",p)},r,e.createElement(i.DropdownMenu.ItemIndicator,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},e.createElement(c.ThickCheckIcon,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),t&&e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(y.Kbd,{size:"1"},t)))});L.displayName="DropdownMenu.CheckboxItem";function re(){return e.useId()}const W=({label:o="Back",...n})=>{const r=(0,u.useDrillDownOptional)(),p=re(),t=e.useMemo(()=>({id:p,label:o}),[p,o]);return r?.behavior==="drill-down"?e.createElement(u.SubContext.Provider,{value:t},n.children):e.createElement(u.SubContext.Provider,{value:t},e.createElement(i.DropdownMenu.Sub,{...n}))};W.displayName="DropdownMenu.Sub";const O=e.forwardRef((o,n)=>{const{className:r,children:p,onClick:t,...d}=o,l=(0,u.useDrillDownOptional)(),w=(0,u.useSubContext)();return l?.behavior==="drill-down"&&w?e.createElement("div",{role:"menuitem",tabIndex:0,ref:n,onClick:s=>{s.preventDefault(),l.push(w.id),t?.(s)},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),l.push(w.id))},className:(0,a.default)("rt-reset","rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger","rt-DropdownMenuDrillDownSubTrigger",r)},p,e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(c.ThickChevronRightIcon,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"}))):e.createElement(i.DropdownMenu.SubTrigger,{...d,onClick:t,asChild:!1,ref:n,className:(0,a.default)("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},p,e.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},e.createElement(c.ThickChevronRightIcon,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});O.displayName="DropdownMenu.SubTrigger";const b=e.forwardRef(({className:o,...n},r)=>e.createElement(i.DropdownMenu.Separator,{...n,asChild:!1,ref:r,className:(0,a.default)("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",o)}));b.displayName="DropdownMenu.Separator";function te({label:o}){const n=(0,u.useDrillDown)();return e.createElement("div",{role:"menuitem",tabIndex:0,onClick:r=>{r.preventDefault(),n.pop()},onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),n.pop())},className:(0,a.default)("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem","rt-DropdownMenuDrillDownBackItem")},e.createElement(c.ThickChevronLeftIcon,{className:"rt-DropdownMenuDrillDownBackIcon"}),e.createElement("span",{className:"rt-DropdownMenuDrillDownBackLabel"},o))}const V=e.forwardRef((o,n)=>{const r=e.useContext(F),{size:p,variant:t,color:d,highContrast:l,material:w}=e.useMemo(()=>r,[r]),D=(0,u.useDrillDownOptional)(),s=(0,u.useSubContext)(),{className:f,children:P,container:C,forceMount:I,material:H,panelBackground:U,...z}=(0,S.extractProps)({size:p,variant:t,color:d,highContrast:l,material:w,...o},m.dropdownMenuSubContentPropDefs);if(D?.behavior==="drill-down"&&s){const A=D.isActive(s.id);return e.createElement("div",{ref:n,role:"menu","aria-label":typeof s.label=="string"?s.label:void 0,"data-drill-down-active":A?!0:void 0,"data-animation-direction":D.animationDirection??void 0,className:(0,a.default)("rt-DropdownMenuDrillDownPanel",f)},e.createElement(te,{label:s.label}),e.createElement(b,null),P)}return e.createElement(i.DropdownMenu.Portal,{container:C,forceMount:I},e.createElement(M.Theme,{asChild:!0},e.createElement(i.DropdownMenu.SubContent,{"data-accent-color":d,"data-material":w,"data-panel-background":w,alignOffset:-Number(p)*4,sideOffset:1,collisionPadding:10,...z,asChild:!1,ref:n,className:(0,a.default)("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",f)},e.createElement(h.ScrollArea,{type:"auto"},e.createElement("div",{className:(0,a.default)("rt-BaseMenuViewport","rt-DropdownMenuViewport")},P)))))});V.displayName="DropdownMenu.SubContent";const _=e.forwardRef((o,n)=>e.createElement(c.ChevronDownIcon,{...o,ref:n,className:"rt-DropdownMenuTriggerIcon"}));_.displayName="DropdownMenu.TriggerIcon";
|
|
2
2
|
//# sourceMappingURL=dropdown-menu.js.map
|