@economic/taco 1.0.8 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Menu/Context.d.ts +0 -5
- package/dist/components/Menu/Menu.d.ts +0 -3
- package/dist/components/Table/hooks/useTable.d.ts +3 -0
- package/dist/components/Table/types.d.ts +3 -0
- package/dist/esm/components/Button/util.js +6 -6
- package/dist/esm/components/Button/util.js.map +1 -1
- package/dist/esm/components/Menu/Context.js.map +1 -1
- package/dist/esm/components/Menu/Menu.js +9 -18
- package/dist/esm/components/Menu/Menu.js.map +1 -1
- package/dist/esm/components/Menu/components/Content.js +1 -22
- package/dist/esm/components/Menu/components/Content.js.map +1 -1
- package/dist/esm/components/Menu/components/Header.js +1 -21
- package/dist/esm/components/Menu/components/Header.js.map +1 -1
- package/dist/esm/components/Menu/components/Item.js +2 -50
- package/dist/esm/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/components/Menu/components/Separator.js +1 -25
- package/dist/esm/components/Menu/components/Separator.js.map +1 -1
- package/dist/esm/components/Menu/components/Trigger.js +1 -13
- package/dist/esm/components/Menu/components/Trigger.js.map +1 -1
- package/dist/esm/components/Table/components/WindowedTable.js +16 -10
- package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js +8 -3
- package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +1 -1
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/index.css +2 -2
- package/dist/index.css +2 -2
- package/dist/taco.cjs.development.js +46 -167
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +3 -2
- package/types.json +390 -346
@@ -1,8 +1,5 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import { Appearance } from '../..';
|
3
2
|
export declare const MenuContext: React.Context<{
|
4
|
-
appearance?: "default" | "primary" | "danger" | "ghost" | "discrete" | undefined;
|
5
|
-
setAppearance: (appearance: Appearance) => void;
|
6
3
|
indented: boolean;
|
7
4
|
registerIndentation: () => void;
|
8
5
|
minWidth?: number | undefined;
|
@@ -10,8 +7,6 @@ export declare const MenuContext: React.Context<{
|
|
10
7
|
close: () => void;
|
11
8
|
} | undefined>;
|
12
9
|
export declare const useCurrentMenu: () => {
|
13
|
-
appearance?: "default" | "primary" | "danger" | "ghost" | "discrete" | undefined;
|
14
|
-
setAppearance: (appearance: Appearance) => void;
|
15
10
|
indented: boolean;
|
16
11
|
registerIndentation: () => void;
|
17
12
|
minWidth?: number | undefined;
|
@@ -1,9 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
3
|
-
import { Appearance } from '../..';
|
4
3
|
export declare type MenuProps = {
|
5
|
-
/** Appearance will change the style of the button */
|
6
|
-
appearance?: Appearance;
|
7
4
|
children: React.ReactNode;
|
8
5
|
id?: string;
|
9
6
|
/** A trigger to be used for the menu, should not be set if `children` already contains a trigger */
|
@@ -13,6 +13,9 @@ export declare const useTable: <T extends {}>(props: React.HTMLAttributes<HTMLDi
|
|
13
13
|
rowExpansionRenderer?: ((row: import("../types").TableRow<T>) => React.ReactNode) | undefined;
|
14
14
|
rowHeight?: number | undefined;
|
15
15
|
selectedRows?: Record<number, boolean> | undefined;
|
16
|
+
activeIndex?: number | undefined;
|
17
|
+
defaultActiveIndex?: number | undefined;
|
18
|
+
onChangeActiveIndex?: ((activeIndex: number) => void) | undefined;
|
16
19
|
disableSorting?: boolean | undefined;
|
17
20
|
onSort?: SortHandler<T> | undefined;
|
18
21
|
manualSorting?: boolean | undefined;
|
@@ -177,6 +177,9 @@ export declare type TableProps<TRow> = React.HTMLAttributes<HTMLDivElement> & {
|
|
177
177
|
* To enable row selection, you have to use both `selectedRows` and `onSelectedRows` - you can use standard `useState` for this
|
178
178
|
*/
|
179
179
|
selectedRows?: SelectedRowsState;
|
180
|
+
activeIndex?: number;
|
181
|
+
defaultActiveIndex?: number;
|
182
|
+
onChangeActiveIndex?: (activeIndex: number) => void;
|
180
183
|
/** Disable sorting on the entire table */
|
181
184
|
disableSorting?: boolean;
|
182
185
|
/**
|
@@ -5,7 +5,7 @@ import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
5
5
|
|
6
6
|
var _excluded = ["dialog", "hanger", "menu", "popover", "tooltip"];
|
7
7
|
var getButtonClasses = function getButtonClasses() {
|
8
|
-
return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center
|
8
|
+
return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center';
|
9
9
|
};
|
10
10
|
var getAppearanceClasses = function getAppearanceClasses(value, icon) {
|
11
11
|
if (icon === void 0) {
|
@@ -14,13 +14,13 @@ var getAppearanceClasses = function getAppearanceClasses(value, icon) {
|
|
14
14
|
|
15
15
|
switch (value) {
|
16
16
|
case 'primary':
|
17
|
-
return "yt-blue-solid
|
17
|
+
return "yt-blue-solid focus:bg-blue focus:text-white focus:yt-focus active:bg-blue-dark active:text-white hover:bg-blue-light hover:text-white hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white disabled:hover:yt-blue-solid disabled:hover:hover:border-blue";
|
18
18
|
|
19
19
|
case 'danger':
|
20
|
-
return "yt-red-solid
|
20
|
+
return "yt-red-solid focus:bg-red focus:text-white focus:yt-focus-red active:bg-red-dark active:text-white hover:bg-red-light hover:text-white hover:focus:bg-red-light hover:focus:text-white disabled:hover:yt-red-solid";
|
21
21
|
|
22
22
|
case 'ghost':
|
23
|
-
return "
|
23
|
+
return "bg-white shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT)] text-blue focus:bg-transparent focus:text-blue active:bg-blue-lightest focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT),0_0_0_2px_rgba(0,99,255,0.25)] active:text-blue-dark hover:bg-blue-lightest hover:shadow-[inset_0_0_0_1px_theme(colors.blue.light)] hover:text-blue-light hover:focus:bg-blue-lightest hover:focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.light),0_0_0_2px_rgba(0,99,255,0.25)] hover:focus:text-blue-light";
|
24
24
|
|
25
25
|
case 'discrete':
|
26
26
|
{
|
@@ -28,11 +28,11 @@ var getAppearanceClasses = function getAppearanceClasses(value, icon) {
|
|
28
28
|
return "bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-darkest hover:focus:text-grey-darkest disabled:hover:text-black ";
|
29
29
|
}
|
30
30
|
|
31
|
-
return "yt-transparent
|
31
|
+
return "yt-transparent focus:text-blue focus:yt-focus active:text-blue-dark hover:text-blue-light hover:focus:text-blue-light disabled:hover:yt-transparent";
|
32
32
|
}
|
33
33
|
|
34
34
|
default:
|
35
|
-
return "yt-grey-solid
|
35
|
+
return "yt-grey-solid focus:bg-grey focus:yt-focus active:bg-grey-dark active:text-black hover:bg-grey-light hover:text-grey-darkest hover:focus:bg-grey-light hover:focus:text-grey-darkest disabled:hover:yt-grey-solid";
|
36
36
|
}
|
37
37
|
};
|
38
38
|
var createButton = function createButton(props, className, ref) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport const getButtonClasses = () => {\n return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport const getButtonClasses = () => {\n return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `yt-blue-solid focus:bg-blue focus:text-white focus:yt-focus active:bg-blue-dark active:text-white hover:bg-blue-light hover:text-white hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white disabled:hover:yt-blue-solid disabled:hover:hover:border-blue`;\n\n case 'danger':\n return `yt-red-solid focus:bg-red focus:text-white focus:yt-focus-red active:bg-red-dark active:text-white hover:bg-red-light hover:text-white hover:focus:bg-red-light hover:focus:text-white disabled:hover:yt-red-solid`;\n\n case 'ghost':\n return `bg-white shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT)] text-blue focus:bg-transparent focus:text-blue active:bg-blue-lightest focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT),0_0_0_2px_rgba(0,99,255,0.25)] active:text-blue-dark hover:bg-blue-lightest hover:shadow-[inset_0_0_0_1px_theme(colors.blue.light)] hover:text-blue-light hover:focus:bg-blue-lightest hover:focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.light),0_0_0_2px_rgba(0,99,255,0.25)] hover:focus:text-blue-light`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-darkest hover:focus:text-grey-darkest disabled:hover:text-black `;\n }\n\n return `yt-transparent focus:text-blue focus:yt-focus active:text-blue-dark hover:text-blue-light hover:focus:text-blue-light disabled:hover:yt-transparent`;\n }\n\n default:\n return `yt-grey-solid focus:bg-grey focus:yt-focus active:bg-grey-dark active:text-black hover:bg-grey-light hover:text-grey-darkest hover:focus:bg-grey-light hover:focus:text-grey-darkest disabled:hover:yt-grey-solid`;\n }\n};\n\nexport const createButton = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { dialog, hanger, menu, popover, tooltip, ...otherProps } = props;\n\n let button = <ButtonPrimitive.Button {...otherProps} className={className} ref={ref} />;\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n } else if (typeof menu === 'function') {\n button = menu({ trigger: button, appearance: otherProps.appearance });\n } else if (typeof popover === 'function') {\n button = popover({ trigger: button });\n }\n\n if (typeof hanger === 'function') {\n button = hanger({ anchor: button });\n }\n\n if (tooltip) {\n button = <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButton","props","className","ref","dialog","hanger","menu","popover","tooltip","otherProps","button","React","ButtonPrimitive","trigger","appearance","anchor","Tooltip","title"],"mappings":";;;;;;IAKaA,gBAAgB,GAAG,SAAnBA,gBAAmB;AAC5B,SAAO,iHAAP;AACH;IAEYC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,KAAD,EAAgCC,IAAhC;MAAgCA;AAAAA,IAAAA,OAAO;;;AACvE,UAAQD,KAAR;AACI,SAAK,SAAL;AACI;;AAEJ,SAAK,QAAL;AACI;;AAEJ,SAAK,OAAL;AACI;;AAEJ,SAAK,UAAL;AAAiB;AACb,YAAIC,IAAJ,EAAU;AACN;AACH;;AAED;AACH;;AAED;AACI;AAnBR;AAqBH;IAEYC,YAAY,GAAG,SAAfA,YAAe,CACxBC,KADwB,EAExBC,SAFwB,EAGxBC,GAHwB;AAKxB,MAAQC,MAAR,GAAkEH,KAAlE,CAAQG,MAAR;AAAA,MAAgBC,MAAhB,GAAkEJ,KAAlE,CAAgBI,MAAhB;AAAA,MAAwBC,IAAxB,GAAkEL,KAAlE,CAAwBK,IAAxB;AAAA,MAA8BC,OAA9B,GAAkEN,KAAlE,CAA8BM,OAA9B;AAAA,MAAuCC,OAAvC,GAAkEP,KAAlE,CAAuCO,OAAvC;AAAA,MAAmDC,UAAnD,iCAAkER,KAAlE;;AAEA,MAAIS,MAAM,GAAGC,4BAAA,CAACC,MAAD,oBAA4BH;AAAYP,IAAAA,SAAS,EAAEA;AAAWC,IAAAA,GAAG,EAAEA;IAAnE,CAAb;;AAEA,MAAI,OAAOC,MAAP,KAAkB,UAAtB,EAAkC;AAC9BM,IAAAA,MAAM,GAAGN,MAAM,CAAC;AAAES,MAAAA,OAAO,EAAEH;AAAX,KAAD,CAAf;AACH,GAFD,MAEO,IAAI,OAAOJ,IAAP,KAAgB,UAApB,EAAgC;AACnCI,IAAAA,MAAM,GAAGJ,IAAI,CAAC;AAAEO,MAAAA,OAAO,EAAEH,MAAX;AAAmBI,MAAAA,UAAU,EAAEL,UAAU,CAACK;AAA1C,KAAD,CAAb;AACH,GAFM,MAEA,IAAI,OAAOP,OAAP,KAAmB,UAAvB,EAAmC;AACtCG,IAAAA,MAAM,GAAGH,OAAO,CAAC;AAAEM,MAAAA,OAAO,EAAEH;AAAX,KAAD,CAAhB;AACH;;AAED,MAAI,OAAOL,MAAP,KAAkB,UAAtB,EAAkC;AAC9BK,IAAAA,MAAM,GAAGL,MAAM,CAAC;AAAEU,MAAAA,MAAM,EAAEL;AAAV,KAAD,CAAf;AACH;;AAED,MAAIF,OAAJ,EAAa;AACTE,IAAAA,MAAM,GAAGC,4BAAA,CAACK,OAAD;AAASC,MAAAA,KAAK,EAAET;KAAhB,EAA0BE,MAA1B,CAAT;AACH;;AAED,SAAOA,MAAP;AACH;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Context.js","sources":["../../../../src/components/Menu/Context.tsx"],"sourcesContent":["import * as React from 'react';\
|
1
|
+
{"version":3,"file":"Context.js","sources":["../../../../src/components/Menu/Context.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport const MenuContext = React.createContext<\n | {\n indented: boolean;\n registerIndentation: () => void;\n minWidth?: number;\n setMinWidth: (width: number) => void;\n close: () => void;\n }\n | undefined\n>(undefined);\n\nexport const useCurrentMenu = () => {\n return React.useContext(MenuContext);\n};\n"],"names":["MenuContext","React","undefined","useCurrentMenu"],"mappings":";;IAEaA,WAAW,gBAAGC,aAAA,CASzBC,SATyB;IAWdC,cAAc,GAAG,SAAjBA,cAAiB;AAC1B,SAAOF,UAAA,CAAiBD,WAAjB,CAAP;AACH;;;;"}
|
@@ -11,10 +11,9 @@ import { RadioGroup } from './components/RadioGroup.js';
|
|
11
11
|
import { Separator } from './components/Separator.js';
|
12
12
|
import { Header } from './components/Header.js';
|
13
13
|
|
14
|
-
var _excluded = ["
|
14
|
+
var _excluded = ["children", "trigger"];
|
15
15
|
var Menu = function Menu(externalProps) {
|
16
|
-
var
|
17
|
-
children = externalProps.children,
|
16
|
+
var children = externalProps.children,
|
18
17
|
trigger = externalProps.trigger,
|
19
18
|
props = _objectWithoutPropertiesLoose(externalProps, _excluded);
|
20
19
|
|
@@ -22,24 +21,16 @@ var Menu = function Menu(externalProps) {
|
|
22
21
|
open = _React$useState[0],
|
23
22
|
setOpen = _React$useState[1];
|
24
23
|
|
25
|
-
var _React$useState2 = useState(
|
26
|
-
|
27
|
-
|
24
|
+
var _React$useState2 = useState(false),
|
25
|
+
indented = _React$useState2[0],
|
26
|
+
setIndented = _React$useState2[1];
|
28
27
|
|
29
|
-
var _React$useState3 = useState(
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
var _React$useState4 = useState(undefined),
|
34
|
-
minWidth = _React$useState4[0],
|
35
|
-
_setMinWidth = _React$useState4[1];
|
28
|
+
var _React$useState3 = useState(undefined),
|
29
|
+
minWidth = _React$useState3[0],
|
30
|
+
_setMinWidth = _React$useState3[1];
|
36
31
|
|
37
32
|
var context = useMemo(function () {
|
38
33
|
return {
|
39
|
-
appearance: appearance,
|
40
|
-
setAppearance: function setAppearance(appearance) {
|
41
|
-
return _setAppearance(appearance);
|
42
|
-
},
|
43
34
|
indented: indented,
|
44
35
|
registerIndentation: function registerIndentation() {
|
45
36
|
return setIndented(true);
|
@@ -52,7 +43,7 @@ var Menu = function Menu(externalProps) {
|
|
52
43
|
return setOpen(false);
|
53
44
|
}
|
54
45
|
};
|
55
|
-
}, [indented, minWidth
|
46
|
+
}, [indented, minWidth]);
|
56
47
|
return createElement(MenuContext.Provider, {
|
57
48
|
value: context
|
58
49
|
}, createElement(Root, Object.assign({}, props, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Menu.js","sources":["../../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { MenuContext } from './Context';\nimport { Content } from './components/Content';\nimport { Item } from './components/Item';\nimport { Link } from './components/Link';\nimport { Trigger } from './components/Trigger';\nimport { Checkbox } from './components/Checkbox';\nimport { RadioGroup } from './components/RadioGroup';\nimport { Separator } from './components/Separator';\nimport { Header } from './components/Header';\
|
1
|
+
{"version":3,"file":"Menu.js","sources":["../../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { MenuContext } from './Context';\nimport { Content } from './components/Content';\nimport { Item } from './components/Item';\nimport { Link } from './components/Link';\nimport { Trigger } from './components/Trigger';\nimport { Checkbox } from './components/Checkbox';\nimport { RadioGroup } from './components/RadioGroup';\nimport { Separator } from './components/Separator';\nimport { Header } from './components/Header';\n\nexport type MenuProps = {\n children: React.ReactNode;\n id?: string;\n /** A trigger to be used for the menu, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n};\n\nexport const Menu = (externalProps: MenuProps): JSX.Element => {\n const { children, trigger, ...props } = externalProps;\n const [open, setOpen] = React.useState(false);\n const [indented, setIndented] = React.useState(false);\n const [minWidth, setMinWidth] = React.useState<number | undefined>(undefined);\n\n const context = React.useMemo(\n () => ({\n indented,\n registerIndentation: () => setIndented(true),\n minWidth,\n setMinWidth: (width: number) => setMinWidth(width),\n close: () => setOpen(false),\n }),\n [indented, minWidth]\n );\n\n return (\n <MenuContext.Provider value={context}>\n <DropdownMenuPrimitive.Root {...props} modal={false} open={open} onOpenChange={setOpen}>\n {trigger && <Trigger>{trigger}</Trigger>}\n {children}\n </DropdownMenuPrimitive.Root>\n </MenuContext.Provider>\n );\n};\nMenu.Trigger = Trigger;\nMenu.Content = Content;\nMenu.Item = Item;\nMenu.Link = Link;\nMenu.Checkbox = Checkbox;\nMenu.Separator = Separator;\nMenu.Header = Header;\nMenu.RadioGroup = RadioGroup;\n"],"names":["Menu","externalProps","children","trigger","props","React","open","setOpen","indented","setIndented","undefined","minWidth","setMinWidth","context","registerIndentation","width","close","MenuContext","Provider","value","DropdownMenuPrimitive","modal","onOpenChange","Trigger","Content","Item","Link","Checkbox","Separator","Header","RadioGroup"],"mappings":";;;;;;;;;;;;;;IAmBaA,IAAI,GAAG,SAAPA,IAAO,CAACC,aAAD;AAChB,MAAQC,QAAR,GAAwCD,aAAxC,CAAQC,QAAR;AAAA,MAAkBC,OAAlB,GAAwCF,aAAxC,CAAkBE,OAAlB;AAAA,MAA8BC,KAA9B,iCAAwCH,aAAxC;;AACA,wBAAwBI,QAAA,CAAe,KAAf,CAAxB;AAAA,MAAOC,IAAP;AAAA,MAAaC,OAAb;;AACA,yBAAgCF,QAAA,CAAe,KAAf,CAAhC;AAAA,MAAOG,QAAP;AAAA,MAAiBC,WAAjB;;AACA,yBAAgCJ,QAAA,CAAmCK,SAAnC,CAAhC;AAAA,MAAOC,QAAP;AAAA,MAAiBC,YAAjB;;AAEA,MAAMC,OAAO,GAAGR,OAAA,CACZ;AAAA,WAAO;AACHG,MAAAA,QAAQ,EAARA,QADG;AAEHM,MAAAA,mBAAmB,EAAE;AAAA,eAAML,WAAW,CAAC,IAAD,CAAjB;AAAA,OAFlB;AAGHE,MAAAA,QAAQ,EAARA,QAHG;AAIHC,MAAAA,WAAW,EAAE,qBAACG,KAAD;AAAA,eAAmBH,YAAW,CAACG,KAAD,CAA9B;AAAA,OAJV;AAKHC,MAAAA,KAAK,EAAE;AAAA,eAAMT,OAAO,CAAC,KAAD,CAAb;AAAA;AALJ,KAAP;AAAA,GADY,EAQZ,CAACC,QAAD,EAAWG,QAAX,CARY,CAAhB;AAWA,SACIN,aAAA,CAACY,WAAW,CAACC,QAAb;AAAsBC,IAAAA,KAAK,EAAEN;GAA7B,EACIR,aAAA,CAACe,IAAD,oBAAgChB;AAAOiB,IAAAA,KAAK,EAAE;AAAOf,IAAAA,IAAI,EAAEA;AAAMgB,IAAAA,YAAY,EAAEf;IAA/E,EACKJ,OAAO,IAAIE,aAAA,CAACkB,OAAD,MAAA,EAAUpB,OAAV,CADhB,EAEKD,QAFL,CADJ,CADJ;AAQH;AACDF,IAAI,CAACuB,OAAL,GAAeA,OAAf;AACAvB,IAAI,CAACwB,OAAL,GAAeA,OAAf;AACAxB,IAAI,CAACyB,IAAL,GAAYA,IAAZ;AACAzB,IAAI,CAAC0B,IAAL,GAAYA,IAAZ;AACA1B,IAAI,CAAC2B,QAAL,GAAgBA,QAAhB;AACA3B,IAAI,CAAC4B,SAAL,GAAiBA,SAAjB;AACA5B,IAAI,CAAC6B,MAAL,GAAcA,MAAd;AACA7B,IAAI,CAAC8B,UAAL,GAAkBA,UAAlB;;;;"}
|
@@ -6,27 +6,6 @@ import { useCurrentMenu } from '../Context.js';
|
|
6
6
|
import { Content as Content$1 } from '@radix-ui/react-dropdown-menu';
|
7
7
|
|
8
8
|
var _excluded = ["children", "placement"];
|
9
|
-
|
10
|
-
var getAppearanceClasses = function getAppearanceClasses(appearance) {
|
11
|
-
switch (appearance) {
|
12
|
-
case 'primary':
|
13
|
-
return 'wcag-blue border-blue';
|
14
|
-
|
15
|
-
case 'danger':
|
16
|
-
return 'wcag-red border-red';
|
17
|
-
|
18
|
-
case 'ghost':
|
19
|
-
return 'bg-white text-blue border-blue yt-shadow-blue';
|
20
|
-
|
21
|
-
case 'discrete':
|
22
|
-
return 'wcag-white border-grey yt-shadow';
|
23
|
-
|
24
|
-
case 'default':
|
25
|
-
default:
|
26
|
-
return 'wcag-grey-light border-grey';
|
27
|
-
}
|
28
|
-
};
|
29
|
-
|
30
9
|
var Content = /*#__PURE__*/forwardRef(function MenuContent(props, ref) {
|
31
10
|
var internalRef = useProxiedRef(ref);
|
32
11
|
var menu = useCurrentMenu();
|
@@ -35,7 +14,7 @@ var Content = /*#__PURE__*/forwardRef(function MenuContent(props, ref) {
|
|
35
14
|
side = props.placement,
|
36
15
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
37
16
|
|
38
|
-
var className = cn('border rounded block outline-none p-1
|
17
|
+
var className = cn('border rounded block outline-none p-1 wcag-white border-grey yt-shadow', props.className);
|
39
18
|
return createElement(Content$1, Object.assign({}, otherProps, {
|
40
19
|
align: "start",
|
41
20
|
className: className,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Content.js","sources":["../../../../../src/components/Menu/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport {
|
1
|
+
{"version":3,"file":"Content.js","sources":["../../../../../src/components/Menu/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { Placement } from '../../../types';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuContentProps = Omit<DropdownMenuPrimitive.DropdownMenuContentProps, 'children' | 'side'> & {\n children: React.ReactNode;\n /** Set the position of the Menu relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\n\nexport const Content = React.forwardRef(function MenuContent(props: MenuContentProps, ref: React.Ref<HTMLDivElement>) {\n const internalRef = useProxiedRef<any>(ref);\n const menu = useCurrentMenu();\n const { children, placement: side, ...otherProps } = props;\n const className = cn('border rounded block outline-none p-1 wcag-white border-grey yt-shadow', props.className);\n\n return (\n <DropdownMenuPrimitive.Content\n {...otherProps}\n align=\"start\"\n className={className}\n data-taco=\"menu\"\n side={side}\n sideOffset={2}\n style={{ minWidth: menu?.minWidth }}\n ref={internalRef}\n >\n {children}\n </DropdownMenuPrimitive.Content>\n );\n});\n"],"names":["Content","React","MenuContent","props","ref","internalRef","useProxiedRef","menu","useCurrentMenu","children","side","placement","otherProps","className","cn","DropdownMenuPrimitive","align","sideOffset","style","minWidth"],"mappings":";;;;;;;;IAaaA,OAAO,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;AACpC,MAAMC,WAAW,GAAGC,aAAa,CAAMF,GAAN,CAAjC;AACA,MAAMG,IAAI,GAAGC,cAAc,EAA3B;;AACA,MAAQC,QAAR,GAAqDN,KAArD,CAAQM,QAAR;AAAA,MAA6BC,IAA7B,GAAqDP,KAArD,CAAkBQ,SAAlB;AAAA,MAAsCC,UAAtC,iCAAqDT,KAArD;;AACA,MAAMU,SAAS,GAAGC,EAAE,CAAC,wEAAD,EAA2EX,KAAK,CAACU,SAAjF,CAApB;AAEA,SACIZ,aAAA,CAACc,SAAD,oBACQH;AACJI,IAAAA,KAAK,EAAC;AACNH,IAAAA,SAAS,EAAEA;iBACD;AACVH,IAAAA,IAAI,EAAEA;AACNO,IAAAA,UAAU,EAAE;AACZC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,QAAQ,EAAEZ,IAAF,aAAEA,IAAF,uBAAEA,IAAI,CAAEY;AAAlB;AACPf,IAAAA,GAAG,EAAEC;IART,EAUKI,QAVL,CADJ;AAcH,CApBsB;;;;"}
|
@@ -3,29 +3,9 @@ import cn from 'classnames';
|
|
3
3
|
import { useCurrentMenu } from '../Context.js';
|
4
4
|
import { Label } from '@radix-ui/react-dropdown-menu';
|
5
5
|
|
6
|
-
var getAppearanceClasses = function getAppearanceClasses(appearance) {
|
7
|
-
switch (appearance) {
|
8
|
-
case 'primary':
|
9
|
-
return 'text-blue-lighest';
|
10
|
-
|
11
|
-
case 'danger':
|
12
|
-
return 'text-red-lightest';
|
13
|
-
|
14
|
-
case 'ghost':
|
15
|
-
return 'text-blue-light';
|
16
|
-
|
17
|
-
case 'discrete':
|
18
|
-
return 'text-grey-darkest';
|
19
|
-
|
20
|
-
case 'default':
|
21
|
-
default:
|
22
|
-
return 'text-grey-darkest';
|
23
|
-
}
|
24
|
-
};
|
25
|
-
|
26
6
|
var Header = function Header(props) {
|
27
7
|
var menu = useCurrentMenu();
|
28
|
-
var className = cn('flex items-center justify-start h-
|
8
|
+
var className = cn('flex items-center justify-start h-7 pr-1.5 text-xs text-grey-darkest', {
|
29
9
|
'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
|
30
10
|
'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented)
|
31
11
|
}, props.className);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Header.js","sources":["../../../../../src/components/Menu/components/Header.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { useCurrentMenu } from '../Context';\
|
1
|
+
{"version":3,"file":"Header.js","sources":["../../../../../src/components/Menu/components/Header.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuHeaderProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const Header = (props: MenuHeaderProps) => {\n const menu = useCurrentMenu();\n const className = cn(\n 'flex items-center justify-start h-7 pr-1.5 text-xs text-grey-darkest',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n },\n props.className\n );\n\n return <DropdownMenuPrimitive.Label {...props} className={className} />;\n};\n"],"names":["Header","props","menu","useCurrentMenu","className","cn","indented","React","DropdownMenuPrimitive"],"mappings":";;;;;IAOaA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAClB,MAAMC,IAAI,GAAGC,cAAc,EAA3B;AACA,MAAMC,SAAS,GAAGC,EAAE,CAChB,sEADgB,EAEhB;AACI,YAAQH,IAAR,aAAQA,IAAR,uBAAQA,IAAI,CAAEI,QADlB;AAEI,cAAU,EAACJ,IAAD,aAACA,IAAD,eAACA,IAAI,CAAEI,QAAP;AAFd,GAFgB,EAMhBL,KAAK,CAACG,SANU,CAApB;AASA,SAAOG,aAAA,CAACC,KAAD,oBAAiCP;AAAOG,IAAAA,SAAS,EAAEA;IAAnD,CAAP;AACH;;;;"}
|
@@ -15,27 +15,6 @@ var Icon = function Icon(_ref) {
|
|
15
15
|
name: name
|
16
16
|
}));
|
17
17
|
};
|
18
|
-
|
19
|
-
var getAppearanceClasses = function getAppearanceClasses(appearance) {
|
20
|
-
switch (appearance) {
|
21
|
-
case 'primary':
|
22
|
-
return 'wcag-blue aria-disabled:text-blue-dark hover:wcag-blue-light focus:wcag-blue-light';
|
23
|
-
|
24
|
-
case 'danger':
|
25
|
-
return 'wcag-red aria-disabled:text-red-dark hover:wcag-red-light focus:wcag-red-light';
|
26
|
-
|
27
|
-
case 'ghost':
|
28
|
-
return 'text-blue aria-disabled:text-grey hover:wcag-blue focus:wcag-blue';
|
29
|
-
|
30
|
-
case 'discrete':
|
31
|
-
return 'text-black aria-disabled:text-grey hover:wcag-blue-lightest focus:wcag-blue-lightest';
|
32
|
-
|
33
|
-
case 'default':
|
34
|
-
default:
|
35
|
-
return 'wcag-grey-light aria-disabled:text-grey-darker hover:wcag-grey-dark focus:wcag-grey-dark';
|
36
|
-
}
|
37
|
-
};
|
38
|
-
|
39
18
|
var useItemStyling = function useItemStyling(_ref2) {
|
40
19
|
var disabled = _ref2.disabled,
|
41
20
|
indented = _ref2.indented,
|
@@ -46,7 +25,7 @@ var useItemStyling = function useItemStyling(_ref2) {
|
|
46
25
|
menu === null || menu === void 0 ? void 0 : menu.registerIndentation();
|
47
26
|
}
|
48
27
|
}, [indented]);
|
49
|
-
return cn('flex items-center justify-start h-
|
28
|
+
return cn('flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group', 'text-black aria-disabled:text-grey hover:bg-grey-light hover:text-black', {
|
50
29
|
'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
|
51
30
|
'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented),
|
52
31
|
'cursor-pointer': !disabled,
|
@@ -54,35 +33,8 @@ var useItemStyling = function useItemStyling(_ref2) {
|
|
54
33
|
}, className);
|
55
34
|
};
|
56
35
|
var Shortcut = function Shortcut(props) {
|
57
|
-
var menu = useCurrentMenu();
|
58
|
-
var appearance;
|
59
|
-
|
60
|
-
switch (menu === null || menu === void 0 ? void 0 : menu.appearance) {
|
61
|
-
case 'primary':
|
62
|
-
appearance = 'text-blue-lightest group-focus:text-black';
|
63
|
-
break;
|
64
|
-
|
65
|
-
case 'danger':
|
66
|
-
appearance = 'text-red-lightest group-focus:text-white';
|
67
|
-
break;
|
68
|
-
|
69
|
-
case 'ghost':
|
70
|
-
appearance = 'text-blue-light group-focus:text-blue-lightest';
|
71
|
-
break;
|
72
|
-
|
73
|
-
case 'discrete':
|
74
|
-
appearance = 'text-grey-darker group-focus:text-blue-light';
|
75
|
-
break;
|
76
|
-
|
77
|
-
case 'default':
|
78
|
-
default:
|
79
|
-
appearance = 'text-grey-darkest';
|
80
|
-
break;
|
81
|
-
}
|
82
|
-
|
83
|
-
var className = cn('ml-auto pl-3', appearance);
|
84
36
|
return createElement("span", Object.assign({}, props, {
|
85
|
-
className:
|
37
|
+
className: "text-grey-darkest ml-auto pl-3"
|
86
38
|
}));
|
87
39
|
};
|
88
40
|
var Item = /*#__PURE__*/forwardRef(function MenuItem(props, ref) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Item.js","sources":["../../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport {
|
1
|
+
{"version":3,"file":"Item.js","sources":["../../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { DialogProps } from '../../Dialog/Dialog';\n\nexport const Icon = ({ name }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\n </span>\n);\n\nexport const useItemStyling = ({ disabled, indented, className }) => {\n const menu = useCurrentMenu();\n\n React.useEffect(() => {\n if (indented && !menu?.indented) {\n menu?.registerIndentation();\n }\n }, [indented]);\n\n return cn(\n 'flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group',\n 'text-black aria-disabled:text-grey hover:bg-grey-light hover:text-black',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n 'cursor-pointer': !disabled,\n 'cursor-not-allowed': disabled,\n },\n className\n );\n};\n\nexport const Shortcut = props => {\n return <span {...props} className=\"text-grey-darkest ml-auto pl-3\" />;\n};\n\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n disabled?: boolean;\n icon?: IconName;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n shortcut?: string;\n};\n\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\n const { dialog, icon, onClick, shortcut, ...otherProps } = props;\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n const disabled = props.disabled ?? props['aria-disabled'];\n\n let handleClick;\n\n // radix has a bug that does not disable clicks when disabled is set on items\n if (disabled) {\n handleClick = event => {\n event.preventDefault();\n event.stopPropagation();\n };\n }\n\n const handleSelect = event => {\n if (onClick) {\n onClick(event);\n }\n\n if (props['aria-haspopup'] || typeof dialog === 'function') {\n event.preventDefault();\n }\n };\n\n let button = (\n <DropdownMenuPrimitive.Item {...otherProps} className={className} onClick={handleClick} onSelect={handleSelect} ref={ref}>\n {icon && <Icon name={icon} />}\n {props.children}\n {shortcut && <Shortcut>{shortcut}</Shortcut>}\n </DropdownMenuPrimitive.Item>\n );\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n }\n\n return button;\n});\n"],"names":["Icon","name","React","className","IconPrimitive","useItemStyling","disabled","indented","menu","useCurrentMenu","registerIndentation","cn","Shortcut","props","Item","MenuItem","ref","dialog","icon","onClick","shortcut","otherProps","handleClick","event","preventDefault","stopPropagation","handleSelect","button","DropdownMenuPrimitive","onSelect","children","trigger"],"mappings":"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"}
|
@@ -1,33 +1,9 @@
|
|
1
1
|
import { createElement } from 'react';
|
2
|
-
import cn from 'classnames';
|
3
|
-
import { useCurrentMenu } from '../Context.js';
|
4
2
|
import { Separator as Separator$1 } from '@radix-ui/react-dropdown-menu';
|
5
3
|
|
6
|
-
var getAppearanceClasses = function getAppearanceClasses(appearance) {
|
7
|
-
switch (appearance) {
|
8
|
-
case 'primary':
|
9
|
-
return 'bg-blue-lighe';
|
10
|
-
|
11
|
-
case 'danger':
|
12
|
-
return 'bg-red-light';
|
13
|
-
|
14
|
-
case 'ghost':
|
15
|
-
return 'bg-blue-light';
|
16
|
-
|
17
|
-
case 'discrete':
|
18
|
-
return 'bg-grey-dark';
|
19
|
-
|
20
|
-
case 'default':
|
21
|
-
default:
|
22
|
-
return 'bg-grey-dark';
|
23
|
-
}
|
24
|
-
};
|
25
|
-
|
26
4
|
var Separator = function Separator() {
|
27
|
-
var menu = useCurrentMenu();
|
28
|
-
var className = cn('h-px my-1', getAppearanceClasses(menu === null || menu === void 0 ? void 0 : menu.appearance));
|
29
5
|
return createElement(Separator$1, {
|
30
|
-
className:
|
6
|
+
className: "bg-grey-dark my-1 h-px"
|
31
7
|
});
|
32
8
|
};
|
33
9
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Separator.js","sources":["../../../../../src/components/Menu/components/Separator.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\
|
1
|
+
{"version":3,"file":"Separator.js","sources":["../../../../../src/components/Menu/components/Separator.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\n\nexport const Separator = () => {\n return <DropdownMenuPrimitive.Separator className=\"bg-grey-dark my-1 h-px\" />;\n};\n"],"names":["Separator","React","DropdownMenuPrimitive","className"],"mappings":";;;IAGaA,SAAS,GAAG,SAAZA,SAAY;AACrB,SAAOC,aAAA,CAACC,WAAD;AAAiCC,IAAAA,SAAS,EAAC;GAA3C,CAAP;AACH;;;;"}
|
@@ -4,25 +4,13 @@ import { useCurrentMenu } from '../Context.js';
|
|
4
4
|
import { Trigger as Trigger$1 } from '@radix-ui/react-dropdown-menu';
|
5
5
|
|
6
6
|
var Trigger = /*#__PURE__*/forwardRef(function MenuTrigger(props, ref) {
|
7
|
-
var _props$children3, _props$children3$prop;
|
8
|
-
|
9
7
|
var menu = useCurrentMenu();
|
10
8
|
var internalRef = useProxiedRef(ref);
|
11
9
|
useEffect(function () {
|
12
10
|
if (internalRef.current) {
|
13
11
|
menu === null || menu === void 0 ? void 0 : menu.setMinWidth(internalRef.current.getBoundingClientRect().width);
|
14
12
|
}
|
15
|
-
}, [internalRef]);
|
16
|
-
|
17
|
-
useEffect(function () {
|
18
|
-
var _props$children, _props$children$props;
|
19
|
-
|
20
|
-
if ((_props$children = props.children) !== null && _props$children !== void 0 && (_props$children$props = _props$children.props) !== null && _props$children$props !== void 0 && _props$children$props.appearance) {
|
21
|
-
var _props$children2, _props$children2$prop;
|
22
|
-
|
23
|
-
menu === null || menu === void 0 ? void 0 : menu.setAppearance((_props$children2 = props.children) === null || _props$children2 === void 0 ? void 0 : (_props$children2$prop = _props$children2.props) === null || _props$children2$prop === void 0 ? void 0 : _props$children2$prop.appearance);
|
24
|
-
}
|
25
|
-
}, [(_props$children3 = props.children) === null || _props$children3 === void 0 ? void 0 : (_props$children3$prop = _props$children3.props) === null || _props$children3$prop === void 0 ? void 0 : _props$children3$prop.appearance]);
|
13
|
+
}, [internalRef]);
|
26
14
|
return createElement(Trigger$1, Object.assign({}, props, {
|
27
15
|
asChild: true,
|
28
16
|
ref: internalRef
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Trigger.js","sources":["../../../../../src/components/Menu/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuTriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children'> & {\n children: React.ReactElement;\n};\n\nexport const Trigger = React.forwardRef(function MenuTrigger(props: MenuTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const menu = useCurrentMenu();\n const internalRef = useProxiedRef<HTMLButtonElement>(ref);\n\n React.useEffect(() => {\n if (internalRef.current) {\n menu?.setMinWidth(internalRef.current.getBoundingClientRect().width);\n }\n }, [internalRef]);\n\n
|
1
|
+
{"version":3,"file":"Trigger.js","sources":["../../../../../src/components/Menu/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuTriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children'> & {\n children: React.ReactElement;\n};\n\nexport const Trigger = React.forwardRef(function MenuTrigger(props: MenuTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const menu = useCurrentMenu();\n const internalRef = useProxiedRef<HTMLButtonElement>(ref);\n\n React.useEffect(() => {\n if (internalRef.current) {\n menu?.setMinWidth(internalRef.current.getBoundingClientRect().width);\n }\n }, [internalRef]);\n\n return <DropdownMenuPrimitive.Trigger {...props} asChild ref={internalRef} />;\n});\n"],"names":["Trigger","React","MenuTrigger","props","ref","menu","useCurrentMenu","internalRef","useProxiedRef","current","setMinWidth","getBoundingClientRect","width","DropdownMenuPrimitive","asChild"],"mappings":";;;;;IASaA,OAAO,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;AACpC,MAAMC,IAAI,GAAGC,cAAc,EAA3B;AACA,MAAMC,WAAW,GAAGC,aAAa,CAAoBJ,GAApB,CAAjC;AAEAH,EAAAA,SAAA,CAAgB;AACZ,QAAIM,WAAW,CAACE,OAAhB,EAAyB;AACrBJ,MAAAA,IAAI,SAAJ,IAAAA,IAAI,WAAJ,YAAAA,IAAI,CAAEK,WAAN,CAAkBH,WAAW,CAACE,OAAZ,CAAoBE,qBAApB,GAA4CC,KAA9D;AACH;AACJ,GAJD,EAIG,CAACL,WAAD,CAJH;AAMA,SAAON,aAAA,CAACY,SAAD,oBAAmCV;AAAOW,IAAAA,OAAO;AAACV,IAAAA,GAAG,EAAEG;IAAvD,CAAP;AACH,CAXsB;;;;"}
|
@@ -93,7 +93,11 @@ var WindowedTable = /*#__PURE__*/React__default.forwardRef(function WindowedTabl
|
|
93
93
|
|
94
94
|
|
95
95
|
var headerRef = React__default.useRef(null);
|
96
|
-
|
96
|
+
|
97
|
+
var _React$useState = React__default.useState(null),
|
98
|
+
rowsRef = _React$useState[0],
|
99
|
+
setRowsRef = _React$useState[1];
|
100
|
+
|
97
101
|
var tableDimensions = useBoundingClientRectListener(tableRef);
|
98
102
|
var headerDimensions = useBoundingClientRectListener(headerRef);
|
99
103
|
var height = tableDimensions && headerDimensions ? tableDimensions.height - headerDimensions.height : null; // variable row height calculations
|
@@ -106,8 +110,8 @@ var WindowedTable = /*#__PURE__*/React__default.forwardRef(function WindowedTabl
|
|
106
110
|
|
107
111
|
rowHeights.current = _extends({}, rowHeights.current, (_extends2 = {}, _extends2[index] = size, _extends2));
|
108
112
|
|
109
|
-
if (rowsRef
|
110
|
-
rowsRef.
|
113
|
+
if (rowsRef) {
|
114
|
+
rowsRef.resetAfterIndex(0);
|
111
115
|
}
|
112
116
|
}
|
113
117
|
}, []);
|
@@ -115,16 +119,16 @@ var WindowedTable = /*#__PURE__*/React__default.forwardRef(function WindowedTabl
|
|
115
119
|
return rowHeights.current[index] || estimatedRowHeight;
|
116
120
|
}, []);
|
117
121
|
React__default.useEffect(function () {
|
118
|
-
if (rowsRef &&
|
119
|
-
rowsRef.
|
122
|
+
if (rowsRef && rowProps.activeIndex !== undefined) {
|
123
|
+
rowsRef.scrollToItem(rowProps.activeIndex, 'start');
|
120
124
|
}
|
121
|
-
}, [rowProps.activeIndex]); // trigger recalculation of variable row heights if the data changes
|
125
|
+
}, [rowsRef, rowProps.activeIndex]); // trigger recalculation of variable row heights if the data changes
|
122
126
|
|
123
127
|
React__default.useEffect(function () {
|
124
128
|
rowHeights.current = {};
|
125
129
|
|
126
|
-
if (rowsRef
|
127
|
-
rowsRef.
|
130
|
+
if (rowsRef) {
|
131
|
+
rowsRef.resetAfterIndex(0);
|
128
132
|
}
|
129
133
|
}, [rows.length]);
|
130
134
|
var contentHeight = estimatedRowHeight * props.data.length || 0;
|
@@ -171,14 +175,16 @@ var WindowedTable = /*#__PURE__*/React__default.forwardRef(function WindowedTabl
|
|
171
175
|
ref: function ref(list) {
|
172
176
|
_ref3(list);
|
173
177
|
|
174
|
-
|
178
|
+
setRowsRef(list);
|
175
179
|
}
|
176
180
|
}), VariableRow);
|
177
181
|
});
|
178
182
|
} else {
|
179
183
|
list = React__default.createElement(VariableSizeList, Object.assign({}, listProps, {
|
180
184
|
itemCount: rows.length,
|
181
|
-
ref:
|
185
|
+
ref: function ref(_ref4) {
|
186
|
+
setRowsRef(_ref4);
|
187
|
+
}
|
182
188
|
}), VariableRow);
|
183
189
|
}
|
184
190
|
}
|