@consta/header 0.3.0 → 0.3.3

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Languages/Languages.tsx"],"names":["React","forwardRef","useState","withDefaultGetters","SelectMenu","LanguagesRender","props","ref","value","valueProp","onChange","otherProps","setValue","items","args","item","getItemLabel","Languages"],"mappings":"qFAAA,MAAOA,CAAAA,KAAP,EAAgBC,UAAhB,CAA4BC,QAA5B,KAA4C,OAA5C,CAGA,OAASC,kBAAT,iBAEA,OAASC,UAAT,qBAEA,KAAMC,CAAAA,eAAe,CAAG,CAACC,CAAD,CAAwBC,CAAxB,GAA2D,SAC3BJ,kBAAkB,CAACG,CAAD,CADS,CAC3E,CAAEE,KAAK,CAAEC,CAAT,CAAoBC,QAAQ,CAARA,CAApB,CAD2E,GAC1CC,CAD0C,kDAE3E,CAACH,CAAD,CAAQI,CAAR,EAAoBV,QAAQ,CAA0BO,CAAS,EAAIE,CAAU,CAACE,KAAX,CAAiB,CAAjB,CAAvC,CAF+C,CAIjF,MACE,qBAAC,UAAD,kBACMF,CADN,EAEE,WAAW,CAAEG,CAAI,EAAI,QACnBJ,CADmB,WACnBA,CADmB,QACnBA,CAAQ,CAAGI,CAAH,CADW,CAEnBF,CAAQ,CAACE,CAAI,CAACC,IAAN,CACT,CALH,CAME,KAAK,CAAEP,CAAK,CAAGG,CAAU,CAACK,YAAX,CAAwBR,CAAxB,CAAH,CAAoC,EANlD,CAOE,GAAG,CAAED,CAPP,GAUH,CAfD,CAiBA,MAAO,MAAMU,CAAAA,SAAS,CAAGhB,UAAU,CAACI,eAAD,CAA5B,CAEP","sourcesContent":["import React, { forwardRef, useState } from 'react'\n\nimport { LanguagesProps, LanguagesComponent, DefaultItem } from './types'\nimport { withDefaultGetters } from './helpers'\n\nimport { SelectMenu } from '@/SelectMenu'\n\nconst LanguagesRender = (props: LanguagesProps, ref: React.Ref<HTMLDivElement>) => {\n const { value: valueProp, onChange, ...otherProps } = withDefaultGetters(props)\n const [value, setValue] = useState<DefaultItem | undefined>(valueProp || otherProps.items[0])\n\n return (\n <SelectMenu\n {...otherProps}\n onItemClick={args => {\n onChange?.(args)\n setValue(args.item)\n }}\n label={value ? otherProps.getItemLabel(value) : ''}\n ref={ref}\n />\n )\n}\n\nexport const Languages = forwardRef(LanguagesRender) as LanguagesComponent\n\nexport * from './types'\n"],"file":"Languages.js"}
1
+ {"version":3,"sources":["../../src/Languages/Languages.tsx"],"names":["React","forwardRef","useState","withDefaultGetters","SelectMenu","LanguagesRender","props","ref","value","valueProp","onChange","otherProps","setValue","items","args","item","getItemLabel","Languages"],"mappings":"qFAAA,MAAOA,CAAAA,KAAP,EAAgBC,UAAhB,CAA4BC,QAA5B,KAA4C,OAA5C,CAGA,OAASC,kBAAT,iBAEA,OAASC,UAAT,qBAEA,KAAMC,CAAAA,eAAe,CAAG,CAACC,CAAD,CAAwBC,CAAxB,GAA2D,SAC3BJ,kBAAkB,CAACG,CAAD,CADS,CAC3E,CAAEE,KAAK,CAAEC,CAAT,CAAoBC,QAAQ,CAARA,CAApB,CAD2E,GAC1CC,CAD0C,kDAE3E,CAACH,CAAD,CAAQI,CAAR,EAAoBV,QAAQ,CAChCO,CAAS,EAAIE,CAAU,CAACE,KAAX,CAAiB,CAAjB,CADmB,CAF+C,CAMjF,MACE,qBAAC,UAAD,kBACMF,CADN,EAEE,WAAW,CAAEG,CAAI,EAAI,QACnBJ,CADmB,WACnBA,CADmB,QACnBA,CAAQ,CAAGI,CAAH,CADW,CAEnBF,CAAQ,CAACE,CAAI,CAACC,IAAN,CACT,CALH,CAME,KAAK,CAAEP,CAAK,CAAGG,CAAU,CAACK,YAAX,CAAwBR,CAAxB,CAAH,CAAoC,EANlD,CAOE,GAAG,CAAED,CAPP,GAUH,CAjBD,CAmBA,MAAO,MAAMU,CAAAA,SAAS,CAAGhB,UAAU,CAACI,eAAD,CAA5B,CAEP","sourcesContent":["import React, { forwardRef, useState } from 'react'\n\nimport { LanguagesProps, LanguagesComponent, LanguagesDefaultItem } from './types'\nimport { withDefaultGetters } from './helpers'\n\nimport { SelectMenu } from '@/SelectMenu'\n\nconst LanguagesRender = (props: LanguagesProps, ref: React.Ref<HTMLDivElement>) => {\n const { value: valueProp, onChange, ...otherProps } = withDefaultGetters(props)\n const [value, setValue] = useState<LanguagesDefaultItem | undefined>(\n valueProp || otherProps.items[0]\n )\n\n return (\n <SelectMenu\n {...otherProps}\n onItemClick={args => {\n onChange?.(args)\n setValue(args.item)\n }}\n label={value ? otherProps.getItemLabel(value) : ''}\n ref={ref}\n />\n )\n}\n\nexport const Languages = forwardRef(LanguagesRender) as LanguagesComponent\n\nexport * from './types'\n"],"file":"Languages.js"}
@@ -13,8 +13,8 @@ export declare function withDefaultGetters<ITEM>(props: LanguagesProps<ITEM>): {
13
13
  } ? {} : {
14
14
  getItemLabel: import("../SelectMenu/index").SelectMenuPropGetItemLabel<ITEM>;
15
15
  }) & {
16
- getItemLabel: import("../SelectMenu/index").SelectMenuPropGetItemLabel<import("../SelectMenu").DefaultItem> | import("../SelectMenu/index").SelectMenuPropGetItemLabel<ITEM>;
17
- getItemHref: import("../SelectMenu/index").SelectMenuPropGetItemHref<import("../SelectMenu").DefaultItem> | import("../SelectMenu/index").SelectMenuPropGetItemHref<ITEM>;
18
- getItemOnClick: import("../SelectMenu/index").SelectMenuPropGetItemOnClick<import("../SelectMenu").DefaultItem> | import("../SelectMenu/index").SelectMenuPropGetItemOnClick<ITEM>;
19
- getItemTarget: import("../SelectMenu/index").SelectMenuPropGetItemTarget<import("../SelectMenu").DefaultItem> | import("../SelectMenu/index").SelectMenuPropGetItemTarget<ITEM>;
16
+ getItemLabel: import("../SelectMenu/index").SelectMenuPropGetItemLabel<import("../SelectMenu").SelectMenuDefaultItem> | import("../SelectMenu/index").SelectMenuPropGetItemLabel<ITEM>;
17
+ getItemHref: import("../SelectMenu/index").SelectMenuPropGetItemHref<import("../SelectMenu").SelectMenuDefaultItem> | import("../SelectMenu/index").SelectMenuPropGetItemHref<ITEM>;
18
+ getItemOnClick: import("../SelectMenu/index").SelectMenuPropGetItemOnClick<import("../SelectMenu").SelectMenuDefaultItem> | import("../SelectMenu/index").SelectMenuPropGetItemOnClick<ITEM>;
19
+ getItemTarget: import("../SelectMenu/index").SelectMenuPropGetItemTarget<import("../SelectMenu").SelectMenuDefaultItem> | import("../SelectMenu/index").SelectMenuPropGetItemTarget<ITEM>;
20
20
  };
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { SelectMenuPropGetItemHref, SelectMenuPropGetItemLabel, SelectMenuPropGetItemOnClick, SelectMenuPropGetItemTarget, SelectMenuPropOnItemClick } from "../SelectMenu/index";
3
3
  import { PropsWithHTMLAttributesAndRef } from "../__private__/utils/types/PropsWithHTMLAttributes";
4
- export declare type DefaultItem = {
4
+ export declare type LanguagesDefaultItem = {
5
5
  label: string;
6
6
  href?: string;
7
7
  target?: string;
8
8
  onClick?: React.EventHandler<React.MouseEvent>;
9
9
  };
10
- export declare type LanguagesProps<ITEM = DefaultItem> = PropsWithHTMLAttributesAndRef<{
10
+ export declare type LanguagesProps<ITEM = LanguagesDefaultItem> = PropsWithHTMLAttributesAndRef<{
11
11
  items: ITEM[];
12
12
  value?: ITEM;
13
13
  onChange?: SelectMenuPropOnItemClick<ITEM>;
@@ -16,8 +16,8 @@ export declare type LanguagesProps<ITEM = DefaultItem> = PropsWithHTMLAttributes
16
16
  getItemTarget?: SelectMenuPropGetItemTarget<ITEM>;
17
17
  getItemOnClick?: SelectMenuPropGetItemOnClick<ITEM>;
18
18
  }, HTMLDivElement> & (ITEM extends {
19
- label: DefaultItem['label'];
19
+ label: LanguagesDefaultItem['label'];
20
20
  } ? {} : {
21
21
  getItemLabel: SelectMenuPropGetItemLabel<ITEM>;
22
22
  });
23
- export declare type LanguagesComponent = <ITEM = DefaultItem>(props: LanguagesProps<ITEM>) => React.ReactElement | null;
23
+ export declare type LanguagesComponent = <ITEM = LanguagesDefaultItem>(props: LanguagesProps<ITEM>) => React.ReactElement | null;
package/Menu/helpers.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
- import { DefaultItem, MenuProps, MenuPropGetItemActive, MenuPropGetItemHref, MenuPropGetItemLabel, MenuPropGetItemOnClick, MenuPropGetItemSubMenu, MenuPropGetItemTarget } from "./types";
3
- export declare const defaultGetItemLabel: MenuPropGetItemLabel<DefaultItem>;
4
- export declare const defaultGetItemActive: MenuPropGetItemActive<DefaultItem>;
5
- export declare const defaultGetItemHref: MenuPropGetItemHref<DefaultItem>;
6
- export declare const defaultGetItemOnClick: MenuPropGetItemOnClick<DefaultItem>;
7
- export declare const defaultGetItemTarget: MenuPropGetItemTarget<DefaultItem>;
8
- export declare const defaultGetItemSubMenu: MenuPropGetItemSubMenu<DefaultItem>;
2
+ import { MenuDefaultItem, MenuProps, MenuPropGetItemActive, MenuPropGetItemHref, MenuPropGetItemLabel, MenuPropGetItemOnClick, MenuPropGetItemSubMenu, MenuPropGetItemTarget } from "./types";
3
+ export declare const defaultGetItemLabel: MenuPropGetItemLabel<MenuDefaultItem>;
4
+ export declare const defaultGetItemActive: MenuPropGetItemActive<MenuDefaultItem>;
5
+ export declare const defaultGetItemHref: MenuPropGetItemHref<MenuDefaultItem>;
6
+ export declare const defaultGetItemOnClick: MenuPropGetItemOnClick<MenuDefaultItem>;
7
+ export declare const defaultGetItemTarget: MenuPropGetItemTarget<MenuDefaultItem>;
8
+ export declare const defaultGetItemSubMenu: MenuPropGetItemSubMenu<MenuDefaultItem>;
9
9
  export declare const getGetters: <ITEM>(props: {
10
10
  getItemLabel?: MenuPropGetItemLabel<ITEM> | undefined;
11
11
  getItemActive?: MenuPropGetItemActive<ITEM> | undefined;
@@ -14,12 +14,12 @@ export declare const getGetters: <ITEM>(props: {
14
14
  getItemTarget?: MenuPropGetItemTarget<ITEM> | undefined;
15
15
  getItemSubMenu?: MenuPropGetItemSubMenu<ITEM> | undefined;
16
16
  }) => {
17
- getItemLabel: MenuPropGetItemLabel<DefaultItem> | MenuPropGetItemLabel<ITEM>;
18
- getItemActive: MenuPropGetItemActive<DefaultItem> | MenuPropGetItemActive<ITEM>;
19
- getItemHref: MenuPropGetItemHref<DefaultItem> | MenuPropGetItemHref<ITEM>;
20
- getItemOnClick: MenuPropGetItemOnClick<DefaultItem> | MenuPropGetItemOnClick<ITEM>;
21
- getItemTarget: MenuPropGetItemTarget<DefaultItem> | MenuPropGetItemTarget<ITEM>;
22
- getItemSubMenu: MenuPropGetItemSubMenu<DefaultItem> | MenuPropGetItemSubMenu<ITEM>;
17
+ getItemLabel: MenuPropGetItemLabel<MenuDefaultItem> | MenuPropGetItemLabel<ITEM>;
18
+ getItemActive: MenuPropGetItemActive<MenuDefaultItem> | MenuPropGetItemActive<ITEM>;
19
+ getItemHref: MenuPropGetItemHref<MenuDefaultItem> | MenuPropGetItemHref<ITEM>;
20
+ getItemOnClick: MenuPropGetItemOnClick<MenuDefaultItem> | MenuPropGetItemOnClick<ITEM>;
21
+ getItemTarget: MenuPropGetItemTarget<MenuDefaultItem> | MenuPropGetItemTarget<ITEM>;
22
+ getItemSubMenu: MenuPropGetItemSubMenu<MenuDefaultItem> | MenuPropGetItemSubMenu<ITEM>;
23
23
  };
24
24
  export declare function withDefaultGetters<ITEM>(props: MenuProps<ITEM>): {
25
25
  items: ITEM[];
@@ -35,10 +35,10 @@ export declare function withDefaultGetters<ITEM>(props: MenuProps<ITEM>): {
35
35
  } ? {} : {
36
36
  getItemLabel: MenuPropGetItemLabel<ITEM>;
37
37
  }) & {
38
- getItemLabel: MenuPropGetItemLabel<DefaultItem> | MenuPropGetItemLabel<ITEM>;
39
- getItemActive: MenuPropGetItemActive<DefaultItem> | MenuPropGetItemActive<ITEM>;
40
- getItemHref: MenuPropGetItemHref<DefaultItem> | MenuPropGetItemHref<ITEM>;
41
- getItemOnClick: MenuPropGetItemOnClick<DefaultItem> | MenuPropGetItemOnClick<ITEM>;
42
- getItemTarget: MenuPropGetItemTarget<DefaultItem> | MenuPropGetItemTarget<ITEM>;
43
- getItemSubMenu: MenuPropGetItemSubMenu<DefaultItem> | MenuPropGetItemSubMenu<ITEM>;
38
+ getItemLabel: MenuPropGetItemLabel<MenuDefaultItem> | MenuPropGetItemLabel<ITEM>;
39
+ getItemActive: MenuPropGetItemActive<MenuDefaultItem> | MenuPropGetItemActive<ITEM>;
40
+ getItemHref: MenuPropGetItemHref<MenuDefaultItem> | MenuPropGetItemHref<ITEM>;
41
+ getItemOnClick: MenuPropGetItemOnClick<MenuDefaultItem> | MenuPropGetItemOnClick<ITEM>;
42
+ getItemTarget: MenuPropGetItemTarget<MenuDefaultItem> | MenuPropGetItemTarget<ITEM>;
43
+ getItemSubMenu: MenuPropGetItemSubMenu<MenuDefaultItem> | MenuPropGetItemSubMenu<ITEM>;
44
44
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Menu/helpers.ts"],"names":["defaultGetItemLabel","item","label","defaultGetItemActive","active","defaultGetItemHref","href","defaultGetItemOnClick","onClick","defaultGetItemTarget","target","defaultGetItemSubMenu","subMenu","getGetters","props","getItemLabel","getItemActive","getItemHref","getItemOnClick","getItemTarget","getItemSubMenu","withDefaultGetters"],"mappings":"+DAWA,MAAO,MAAMA,CAAAA,mBAAsD,CAAGC,CAAI,EAAIA,CAAI,CAACC,KAA5E,CACP,MAAO,MAAMC,CAAAA,oBAAwD,CAAGF,CAAI,EAAIA,CAAI,CAACG,MAA9E,CACP,MAAO,MAAMC,CAAAA,kBAAoD,CAAGJ,CAAI,EAAIA,CAAI,CAACK,IAA1E,CACP,MAAO,MAAMC,CAAAA,qBAA0D,CAAGN,CAAI,EAAIA,CAAI,CAACO,OAAhF,CACP,MAAO,MAAMC,CAAAA,oBAAwD,CAAGR,CAAI,EAAIA,CAAI,CAACS,MAA9E,CACP,MAAO,MAAMC,CAAAA,qBAA0D,CAAGV,CAAI,EAAIA,CAAI,CAACW,OAAhF,CAEP,MAAO,MAAMC,CAAAA,UAAU,CAAUC,CAAP,GAQjB,CACLC,YAAY,CAAE,QAAAD,CAAK,WAALA,SAAAA,CAAK,CAAEC,YAAP,GAAuBf,mBADhC,CAELgB,aAAa,CAAE,QAAAF,CAAK,WAALA,SAAAA,CAAK,CAAEE,aAAP,GAAwBb,oBAFlC,CAGLc,WAAW,CAAE,QAAAH,CAAK,WAALA,SAAAA,CAAK,CAAEG,WAAP,GAAsBZ,kBAH9B,CAILa,cAAc,CAAE,QAAAJ,CAAK,WAALA,SAAAA,CAAK,CAAEI,cAAP,GAAyBX,qBAJpC,CAKLY,aAAa,CAAE,QAAAL,CAAK,WAALA,SAAAA,CAAK,CAAEK,aAAP,GAAwBV,oBALlC,CAMLW,cAAc,CAAE,QAAAN,CAAK,WAALA,SAAAA,CAAK,CAAEM,cAAP,GAAyBT,qBANpC,CARiB,CAAnB,CAkBP,MAAO,SAASU,CAAAA,kBAAT,CAAkCP,CAAlC,CAA0D,CAC/D,wBACKA,CADL,CAEKD,UAAU,CAACC,CAAD,CAFf,CAID","sourcesContent":["import {\n DefaultItem,\n MenuProps,\n MenuPropGetItemActive,\n MenuPropGetItemHref,\n MenuPropGetItemLabel,\n MenuPropGetItemOnClick,\n MenuPropGetItemSubMenu,\n MenuPropGetItemTarget,\n} from './types'\n\nexport const defaultGetItemLabel: MenuPropGetItemLabel<DefaultItem> = item => item.label\nexport const defaultGetItemActive: MenuPropGetItemActive<DefaultItem> = item => item.active\nexport const defaultGetItemHref: MenuPropGetItemHref<DefaultItem> = item => item.href\nexport const defaultGetItemOnClick: MenuPropGetItemOnClick<DefaultItem> = item => item.onClick\nexport const defaultGetItemTarget: MenuPropGetItemTarget<DefaultItem> = item => item.target\nexport const defaultGetItemSubMenu: MenuPropGetItemSubMenu<DefaultItem> = item => item.subMenu\n\nexport const getGetters = <ITEM>(props: {\n getItemLabel?: MenuPropGetItemLabel<ITEM>\n getItemActive?: MenuPropGetItemActive<ITEM>\n getItemHref?: MenuPropGetItemHref<ITEM>\n getItemOnClick?: MenuPropGetItemOnClick<ITEM>\n getItemTarget?: MenuPropGetItemTarget<ITEM>\n getItemSubMenu?: MenuPropGetItemSubMenu<ITEM>\n}) => {\n return {\n getItemLabel: props?.getItemLabel || defaultGetItemLabel,\n getItemActive: props?.getItemActive || defaultGetItemActive,\n getItemHref: props?.getItemHref || defaultGetItemHref,\n getItemOnClick: props?.getItemOnClick || defaultGetItemOnClick,\n getItemTarget: props?.getItemTarget || defaultGetItemTarget,\n getItemSubMenu: props?.getItemSubMenu || defaultGetItemSubMenu,\n }\n}\n\nexport function withDefaultGetters<ITEM>(props: MenuProps<ITEM>) {\n return {\n ...props,\n ...getGetters(props),\n }\n}\n"],"file":"helpers.js"}
1
+ {"version":3,"sources":["../../src/Menu/helpers.ts"],"names":["defaultGetItemLabel","item","label","defaultGetItemActive","active","defaultGetItemHref","href","defaultGetItemOnClick","onClick","defaultGetItemTarget","target","defaultGetItemSubMenu","subMenu","getGetters","props","getItemLabel","getItemActive","getItemHref","getItemOnClick","getItemTarget","getItemSubMenu","withDefaultGetters"],"mappings":"+DAWA,MAAO,MAAMA,CAAAA,mBAA0D,CAAGC,CAAI,EAAIA,CAAI,CAACC,KAAhF,CACP,MAAO,MAAMC,CAAAA,oBAA4D,CAAGF,CAAI,EAAIA,CAAI,CAACG,MAAlF,CACP,MAAO,MAAMC,CAAAA,kBAAwD,CAAGJ,CAAI,EAAIA,CAAI,CAACK,IAA9E,CACP,MAAO,MAAMC,CAAAA,qBAA8D,CAAGN,CAAI,EAAIA,CAAI,CAACO,OAApF,CACP,MAAO,MAAMC,CAAAA,oBAA4D,CAAGR,CAAI,EAAIA,CAAI,CAACS,MAAlF,CACP,MAAO,MAAMC,CAAAA,qBAA8D,CAAGV,CAAI,EAAIA,CAAI,CAACW,OAApF,CAEP,MAAO,MAAMC,CAAAA,UAAU,CAAUC,CAAP,GAQjB,CACLC,YAAY,CAAE,QAAAD,CAAK,WAALA,SAAAA,CAAK,CAAEC,YAAP,GAAuBf,mBADhC,CAELgB,aAAa,CAAE,QAAAF,CAAK,WAALA,SAAAA,CAAK,CAAEE,aAAP,GAAwBb,oBAFlC,CAGLc,WAAW,CAAE,QAAAH,CAAK,WAALA,SAAAA,CAAK,CAAEG,WAAP,GAAsBZ,kBAH9B,CAILa,cAAc,CAAE,QAAAJ,CAAK,WAALA,SAAAA,CAAK,CAAEI,cAAP,GAAyBX,qBAJpC,CAKLY,aAAa,CAAE,QAAAL,CAAK,WAALA,SAAAA,CAAK,CAAEK,aAAP,GAAwBV,oBALlC,CAMLW,cAAc,CAAE,QAAAN,CAAK,WAALA,SAAAA,CAAK,CAAEM,cAAP,GAAyBT,qBANpC,CARiB,CAAnB,CAkBP,MAAO,SAASU,CAAAA,kBAAT,CAAkCP,CAAlC,CAA0D,CAC/D,wBACKA,CADL,CAEKD,UAAU,CAACC,CAAD,CAFf,CAID","sourcesContent":["import {\n MenuDefaultItem,\n MenuProps,\n MenuPropGetItemActive,\n MenuPropGetItemHref,\n MenuPropGetItemLabel,\n MenuPropGetItemOnClick,\n MenuPropGetItemSubMenu,\n MenuPropGetItemTarget,\n} from './types'\n\nexport const defaultGetItemLabel: MenuPropGetItemLabel<MenuDefaultItem> = item => item.label\nexport const defaultGetItemActive: MenuPropGetItemActive<MenuDefaultItem> = item => item.active\nexport const defaultGetItemHref: MenuPropGetItemHref<MenuDefaultItem> = item => item.href\nexport const defaultGetItemOnClick: MenuPropGetItemOnClick<MenuDefaultItem> = item => item.onClick\nexport const defaultGetItemTarget: MenuPropGetItemTarget<MenuDefaultItem> = item => item.target\nexport const defaultGetItemSubMenu: MenuPropGetItemSubMenu<MenuDefaultItem> = item => item.subMenu\n\nexport const getGetters = <ITEM>(props: {\n getItemLabel?: MenuPropGetItemLabel<ITEM>\n getItemActive?: MenuPropGetItemActive<ITEM>\n getItemHref?: MenuPropGetItemHref<ITEM>\n getItemOnClick?: MenuPropGetItemOnClick<ITEM>\n getItemTarget?: MenuPropGetItemTarget<ITEM>\n getItemSubMenu?: MenuPropGetItemSubMenu<ITEM>\n}) => {\n return {\n getItemLabel: props?.getItemLabel || defaultGetItemLabel,\n getItemActive: props?.getItemActive || defaultGetItemActive,\n getItemHref: props?.getItemHref || defaultGetItemHref,\n getItemOnClick: props?.getItemOnClick || defaultGetItemOnClick,\n getItemTarget: props?.getItemTarget || defaultGetItemTarget,\n getItemSubMenu: props?.getItemSubMenu || defaultGetItemSubMenu,\n }\n}\n\nexport function withDefaultGetters<ITEM>(props: MenuProps<ITEM>) {\n return {\n ...props,\n ...getGetters(props),\n }\n}\n"],"file":"helpers.js"}
package/Menu/types.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { PropsWithHTMLAttributesAndRef } from "../__private__/utils/types/PropsWithHTMLAttributes";
3
- export declare type DefaultItem = {
3
+ export declare type MenuDefaultItem = {
4
4
  label: string;
5
5
  href?: string;
6
6
  target?: string;
7
7
  active?: boolean;
8
8
  onClick?: React.EventHandler<React.MouseEvent>;
9
- subMenu?: DefaultItem[];
9
+ subMenu?: MenuDefaultItem[];
10
10
  };
11
11
  export declare type MenuPropGetItemLabel<ITEM> = (item: ITEM) => string;
12
12
  export declare type MenuPropGetItemHref<ITEM> = (item: ITEM) => string | undefined;
@@ -18,7 +18,7 @@ export declare type MenuPropOnItemClick<ITEM> = (props: {
18
18
  e: React.MouseEvent;
19
19
  item: ITEM;
20
20
  }) => void;
21
- export declare type MenuProps<ITEM = DefaultItem> = PropsWithHTMLAttributesAndRef<{
21
+ export declare type MenuProps<ITEM = MenuDefaultItem> = PropsWithHTMLAttributesAndRef<{
22
22
  items: ITEM[];
23
23
  onItemClick?: MenuPropOnItemClick<ITEM>;
24
24
  getItemHref?: MenuPropGetItemHref<ITEM>;
@@ -28,8 +28,8 @@ export declare type MenuProps<ITEM = DefaultItem> = PropsWithHTMLAttributesAndRe
28
28
  getItemOnClick?: MenuPropGetItemOnClick<ITEM>;
29
29
  getItemSubMenu?: MenuPropGetItemSubMenu<ITEM>;
30
30
  }, HTMLDivElement> & (ITEM extends {
31
- label: DefaultItem['label'];
31
+ label: MenuDefaultItem['label'];
32
32
  } ? {} : {
33
33
  getItemLabel: MenuPropGetItemLabel<ITEM>;
34
34
  });
35
- export declare type MenuComponent = <ITEM = DefaultItem>(props: MenuProps<ITEM>) => React.ReactElement | null;
35
+ export declare type MenuComponent = <ITEM = MenuDefaultItem>(props: MenuProps<ITEM>) => React.ReactElement | null;
@@ -1 +1 @@
1
- .che--Notifications-Popover{--popover-bg-color:var(--color-bg-default);--popover-arrow-bg-color:var(--popover-bg-color);position:relative;width:90vw;max-width:450px;border-radius:var(--control-radius);background:var(--popover-bg-color);box-shadow:var(--shadow-layer)}.che--Notifications-List{height:100%}
1
+ .che--Notifications-Popover{--popover-bg-color:var(--color-bg-default);--popover-arrow-bg-color:var(--popover-bg-color);width:90vw;max-width:450px;border-radius:var(--control-radius);background:var(--popover-bg-color);box-shadow:var(--shadow-layer)}.che--Notifications-List{height:100%}
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { Props, DefaultAction, DefaultItem, DefaultGroup } from "../NotificationsList/index";
2
+ import { Props, NotificationsDefaultAction, NotificationsDefaultItem, NotificationsDefaultGroup } from "../NotificationsList/index";
3
3
  import { PropsWithHTMLAttributesAndRef } from "../__private__/utils/types/PropsWithHTMLAttributes";
4
- export declare type NotificationsProps<ITEM = DefaultItem, GROUP = DefaultGroup, ACTION = DefaultAction, GROUP_BY_DAY extends boolean = false> = PropsWithHTMLAttributesAndRef<Omit<Props<ITEM, GROUP, ACTION, GROUP_BY_DAY>, 'onClose'> & {
4
+ export declare type NotificationsProps<ITEM = NotificationsDefaultItem, GROUP = NotificationsDefaultGroup, ACTION = NotificationsDefaultAction, GROUP_BY_DAY extends boolean = false> = PropsWithHTMLAttributesAndRef<Omit<Props<ITEM, GROUP, ACTION, GROUP_BY_DAY>, 'onClose'> & {
5
5
  listClassName?: string;
6
6
  isMobile?: boolean;
7
7
  }, HTMLButtonElement>;
8
- export declare type NotificationsComponent = <ITEM = DefaultItem, GROUP = DefaultGroup, ACTION = DefaultAction, GROUP_BY_DAY extends boolean = false>(props: NotificationsProps<ITEM, GROUP, ACTION, GROUP_BY_DAY>) => React.ReactElement | null;
8
+ export declare type NotificationsComponent = <ITEM = NotificationsDefaultItem, GROUP = NotificationsDefaultGroup, ACTION = NotificationsDefaultAction, GROUP_BY_DAY extends boolean = false>(props: NotificationsProps<ITEM, GROUP, ACTION, GROUP_BY_DAY>) => React.ReactElement | null;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { NotificationsListPropGetActionIcon, NotificationsListPropGetActionLabel, NotificationsListPropGetActionOnClick, NotificationsListPropGetGroupId, NotificationsListPropGetGroupLabel, NotificationsListPropGetItemActions, NotificationsListPropGetItemBadges, NotificationsListPropGetItemDate, NotificationsListPropGetItemDescription, NotificationsListPropGetItemGroup, NotificationsListPropGetItemImage, NotificationsListPropGetItemLabel, NotificationsListPropGetItemRead, NotificationsListPropGetItemView, DefaultAction, DefaultGroup, DefaultItem, NotificationsListProps, NotificationsListPropGroupLabelFormat } from "./types";
2
+ import { NotificationsListPropGetActionIcon, NotificationsListPropGetActionLabel, NotificationsListPropGetActionOnClick, NotificationsListPropGetGroupId, NotificationsListPropGetGroupLabel, NotificationsListPropGetItemActions, NotificationsListPropGetItemBadges, NotificationsListPropGetItemDate, NotificationsListPropGetItemDescription, NotificationsListPropGetItemGroup, NotificationsListPropGetItemImage, NotificationsListPropGetItemLabel, NotificationsListPropGetItemRead, NotificationsListPropGetItemView, NotificationsDefaultAction, NotificationsDefaultGroup, NotificationsDefaultItem, NotificationsListProps, NotificationsListPropGroupLabelFormat } from "./types";
3
3
  export declare function withDefaultGetters<ITEM, GROUP, ACTION>(props: NotificationsListProps<ITEM, GROUP, ACTION>): {
4
4
  children?: undefined;
5
5
  items: ITEM[];
@@ -4121,20 +4121,20 @@ export declare function withDefaultGetters<ITEM, GROUP, ACTION>(props: Notificat
4121
4121
  } ? {} : {
4122
4122
  getItemLabel: NotificationsListPropGetItemLabel<ITEM>;
4123
4123
  })>> & {
4124
- getActionIcon: NotificationsListPropGetActionIcon<DefaultAction> | NotificationsListPropGetActionIcon<ACTION>;
4125
- getActionLabel: NotificationsListPropGetActionLabel<DefaultAction> | NotificationsListPropGetActionLabel<ACTION>;
4126
- getActionOnClick: NotificationsListPropGetActionOnClick<DefaultAction> | NotificationsListPropGetActionOnClick<ACTION>;
4127
- getGroupId: NotificationsListPropGetGroupId<DefaultGroup> | NotificationsListPropGetGroupId<GROUP>;
4128
- getGroupLabel: NotificationsListPropGetGroupLabel<DefaultGroup> | NotificationsListPropGetGroupLabel<GROUP>;
4129
- getItemActions: NotificationsListPropGetItemActions<DefaultItem> | NotificationsListPropGetItemActions<ITEM>;
4130
- getItemBadges: NotificationsListPropGetItemBadges<DefaultItem> | NotificationsListPropGetItemBadges<ITEM>;
4131
- getItemDate: NotificationsListPropGetItemDate<DefaultItem> | NotificationsListPropGetItemDate<ITEM>;
4132
- getItemDescription: NotificationsListPropGetItemDescription<DefaultItem> | NotificationsListPropGetItemDescription<ITEM>;
4133
- getItemGroup: NotificationsListPropGetItemGroup<DefaultItem> | NotificationsListPropGetItemGroup<ITEM>;
4134
- getItemImage: NotificationsListPropGetItemImage<DefaultItem> | NotificationsListPropGetItemImage<ITEM>;
4135
- getItemLabel: NotificationsListPropGetItemLabel<DefaultItem> | NotificationsListPropGetItemLabel<ITEM>;
4136
- getItemRead: NotificationsListPropGetItemRead<DefaultItem> | NotificationsListPropGetItemRead<ITEM>;
4137
- getItemView: NotificationsListPropGetItemView<DefaultItem> | NotificationsListPropGetItemView<ITEM>;
4124
+ getActionIcon: NotificationsListPropGetActionIcon<NotificationsDefaultAction> | NotificationsListPropGetActionIcon<ACTION>;
4125
+ getActionLabel: NotificationsListPropGetActionLabel<NotificationsDefaultAction> | NotificationsListPropGetActionLabel<ACTION>;
4126
+ getActionOnClick: NotificationsListPropGetActionOnClick<NotificationsDefaultAction> | NotificationsListPropGetActionOnClick<ACTION>;
4127
+ getGroupId: NotificationsListPropGetGroupId<NotificationsDefaultGroup> | NotificationsListPropGetGroupId<GROUP>;
4128
+ getGroupLabel: NotificationsListPropGetGroupLabel<NotificationsDefaultGroup> | NotificationsListPropGetGroupLabel<GROUP>;
4129
+ getItemActions: NotificationsListPropGetItemActions<NotificationsDefaultItem> | NotificationsListPropGetItemActions<ITEM>;
4130
+ getItemBadges: NotificationsListPropGetItemBadges<NotificationsDefaultItem> | NotificationsListPropGetItemBadges<ITEM>;
4131
+ getItemDate: NotificationsListPropGetItemDate<NotificationsDefaultItem> | NotificationsListPropGetItemDate<ITEM>;
4132
+ getItemDescription: NotificationsListPropGetItemDescription<NotificationsDefaultItem> | NotificationsListPropGetItemDescription<ITEM>;
4133
+ getItemGroup: NotificationsListPropGetItemGroup<NotificationsDefaultItem> | NotificationsListPropGetItemGroup<ITEM>;
4134
+ getItemImage: NotificationsListPropGetItemImage<NotificationsDefaultItem> | NotificationsListPropGetItemImage<ITEM>;
4135
+ getItemLabel: NotificationsListPropGetItemLabel<NotificationsDefaultItem> | NotificationsListPropGetItemLabel<ITEM>;
4136
+ getItemRead: NotificationsListPropGetItemRead<NotificationsDefaultItem> | NotificationsListPropGetItemRead<ITEM>;
4137
+ getItemView: NotificationsListPropGetItemView<NotificationsDefaultItem> | NotificationsListPropGetItemView<ITEM>;
4138
4138
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
4139
4139
  key?: string | number | undefined;
4140
4140
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/NotificationsList/helpers.ts"],"names":["getGroups","constaGetGroups","format","isToday","isYesterday","startOfDay","defaultGetActionIcon","action","icon","defaultGetActionLabel","label","defaultGetActionOnClick","onClick","defaultGetGroupId","group","id","defaultGetGroupLabel","defaultGetItemActions","item","actions","defaultGetItemBadges","badges","defaultGetItemDate","date","defaultGetItemDescription","description","defaultGetItemGroup","defaultGetItemImage","image","defaultGetItemLabel","defaultGetItemRead","read","defaultGetItemView","view","withDefaultGetters","props","getActionIcon","getActionLabel","getActionOnClick","getGroupId","getGroupLabel","getItemActions","getItemBadges","getItemDate","getItemDescription","getItemGroup","getItemImage","getItemLabel","getItemRead","getItemView","noGroupKey","defaultGroupLabelFormat","timestamp","sortGroup","a","b","key","items","groups","groupByDay","getTime"],"mappings":"+DAsBA,OAASA,SAAS,GAAIC,CAAAA,eAAtB,KAA6C,gDAA7C,CACA,OAASC,MAAT,CAAiBC,OAAjB,CAA0BC,WAA1B,CAAuCC,UAAvC,KAAyD,UAAzD,C,KAEMC,CAAAA,oBAAuE,CAAGC,CAAM,EACpFA,CAAM,CAACC,I,CACHC,qBAAyE,CAAGF,CAAM,EACtFA,CAAM,CAACG,K,CACHC,uBAA6E,CAAGJ,CAAM,EAC1FA,CAAM,CAACK,O,CACHC,iBAAgE,CAAGC,CAAK,EAAIA,CAAK,CAACC,E,CAClFC,oBAAsE,CAAGF,CAAK,EAAIA,CAAK,CAACJ,K,CACxFO,qBAAuE,CAAGC,CAAI,EAAIA,CAAI,CAACC,O,CACvFC,oBAAqE,CAAGF,CAAI,EAAIA,CAAI,CAACG,M,CACrFC,kBAAiE,CAAGJ,CAAI,EAAIA,CAAI,CAACK,I,CACjFC,yBAA+E,CAAGN,CAAI,EAC1FA,CAAI,CAACO,W,CACDC,mBAAmE,CAAGR,CAAI,EAAIA,CAAI,CAACJ,K,CACnFa,mBAAmE,CAAGT,CAAI,EAAIA,CAAI,CAACU,K,CACnFC,mBAAmE,CAAGX,CAAI,EAAIA,CAAI,CAACR,K,CACnFoB,kBAAiE,CAAGZ,CAAI,EAAIA,CAAI,CAACa,I,CACjFC,kBAAiE,CAAGd,CAAI,EAAIA,CAAI,CAACe,I,CAEvF,MAAO,SAASC,CAAAA,kBAAT,CACLC,CADK,CAEL,CACA,wBACKA,CADL,EAEEC,aAAa,CAAED,CAAK,CAACC,aAAN,E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AAMxD,CAAAA,SAAS,CAAG,CACvByD,CADuB,CAEvBC,CAFuB,CAGvBC,CAHuB,CAIvBd,CAJuB,CAKvBF,CALuB,CAMvBJ,CANuB,GAOe,CACtC,GAAIoB,CAAJ,CAAgB,CAMd,MAAO1D,CAAAA,eAAe,CACpBwD,CADoB,CALMvC,CAAD,EAAgB,CACzC,KAAMK,CAAAA,CAAI,CAAGoB,CAAW,CAACzB,CAAD,CAAxB,CACA,MAAOK,CAAAA,CAAI,CAAGlB,UAAU,CAACkB,CAAD,CAAV,CAAiBqC,OAAjB,EAAH,OACZ,CAEqB,eAKpBP,SALoB,CAMpBH,UANoB,CAQvB,CACD,MAAOjD,CAAAA,eAAe,CAACwD,CAAD,CAAQZ,CAAR,CAAsBa,CAAtB,CAA8BnB,CAA9B,QAAqDW,UAArD,CACvB,CAxBM","sourcesContent":["import {\n NotificationsListPropGetActionIcon,\n NotificationsListPropGetActionLabel,\n NotificationsListPropGetActionOnClick,\n NotificationsListPropGetGroupId,\n NotificationsListPropGetGroupLabel,\n NotificationsListPropGetItemActions,\n NotificationsListPropGetItemBadges,\n NotificationsListPropGetItemDate,\n NotificationsListPropGetItemDescription,\n NotificationsListPropGetItemGroup,\n NotificationsListPropGetItemImage,\n NotificationsListPropGetItemLabel,\n NotificationsListPropGetItemRead,\n NotificationsListPropGetItemView,\n DefaultAction,\n DefaultGroup,\n DefaultItem,\n NotificationsListProps,\n NotificationsListPropGroupLabelFormat,\n} from './types'\n\nimport { getGroups as constaGetGroups } from '@consta/uikit/__internal__/src/utils/getGroups'\nimport { format, isToday, isYesterday, startOfDay } from 'date-fns'\n\nconst defaultGetActionIcon: NotificationsListPropGetActionIcon<DefaultAction> = action =>\n action.icon\nconst defaultGetActionLabel: NotificationsListPropGetActionLabel<DefaultAction> = action =>\n action.label\nconst defaultGetActionOnClick: NotificationsListPropGetActionOnClick<DefaultAction> = action =>\n action.onClick\nconst defaultGetGroupId: NotificationsListPropGetGroupId<DefaultGroup> = group => group.id\nconst defaultGetGroupLabel: NotificationsListPropGetGroupLabel<DefaultGroup> = group => group.label\nconst defaultGetItemActions: NotificationsListPropGetItemActions<DefaultItem> = item => item.actions\nconst defaultGetItemBadges: NotificationsListPropGetItemBadges<DefaultItem> = item => item.badges\nconst defaultGetItemDate: NotificationsListPropGetItemDate<DefaultItem> = item => item.date\nconst defaultGetItemDescription: NotificationsListPropGetItemDescription<DefaultItem> = item =>\n item.description\nconst defaultGetItemGroup: NotificationsListPropGetItemGroup<DefaultItem> = item => item.group\nconst defaultGetItemImage: NotificationsListPropGetItemImage<DefaultItem> = item => item.image\nconst defaultGetItemLabel: NotificationsListPropGetItemLabel<DefaultItem> = item => item.label\nconst defaultGetItemRead: NotificationsListPropGetItemRead<DefaultItem> = item => item.read\nconst defaultGetItemView: NotificationsListPropGetItemView<DefaultItem> = item => item.view\n\nexport function withDefaultGetters<ITEM, GROUP, ACTION>(\n props: NotificationsListProps<ITEM, GROUP, ACTION>\n) {\n return {\n ...props,\n getActionIcon: props.getActionIcon || defaultGetActionIcon,\n getActionLabel: props.getActionLabel || defaultGetActionLabel,\n getActionOnClick: props.getActionOnClick || defaultGetActionOnClick,\n getGroupId: props.getGroupId || defaultGetGroupId,\n getGroupLabel: props.getGroupLabel || defaultGetGroupLabel,\n getItemActions: props.getItemActions || defaultGetItemActions,\n getItemBadges: props.getItemBadges || defaultGetItemBadges,\n getItemDate: props.getItemDate || defaultGetItemDate,\n getItemDescription: props.getItemDescription || defaultGetItemDescription,\n getItemGroup: props.getItemGroup || defaultGetItemGroup,\n getItemImage: props.getItemImage || defaultGetItemImage,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemRead: props.getItemRead || defaultGetItemRead,\n getItemView: props.getItemView || defaultGetItemView,\n }\n}\n\ntype ReturnedGroup<ITEM, GROUP> = {\n items: ITEM[]\n key: string | number\n group?: GROUP\n groupIndex: number\n}\n\nexport const noGroupKey = 'no-group'\n\nexport const defaultGroupLabelFormat: NotificationsListPropGroupLabelFormat<true> = timestamp => {\n if (isToday(timestamp)) {\n return 'Сегодня'\n }\n if (isYesterday(timestamp)) {\n return 'Вчера'\n }\n return format(timestamp, 'dd.MM.yyyy')\n}\n\nconst sortGroup = (a: { key: string | number }, b: { key: string | number }) => {\n if (a.key < b.key) {\n return 1\n }\n if (a.key > b.key) {\n return -1\n }\n return 0\n}\n\nexport const getGroups = <ITEM, GROUP>(\n items: ITEM[],\n groups: GROUP[] | undefined,\n groupByDay: boolean,\n getItemGroup: NotificationsListPropGetItemGroup<ITEM>,\n getItemDate: NotificationsListPropGetItemDate<ITEM>,\n getGroupId: NotificationsListPropGetGroupId<GROUP>\n): Array<ReturnedGroup<ITEM, GROUP>> => {\n if (groupByDay) {\n const getItemGroupByDate = (item: ITEM) => {\n const date = getItemDate(item)\n return date ? startOfDay(date).getTime() : undefined\n }\n\n return constaGetGroups<ITEM, GROUP>(\n items,\n getItemGroupByDate,\n undefined,\n undefined,\n sortGroup,\n noGroupKey\n )\n }\n return constaGetGroups(items, getItemGroup, groups, getGroupId, undefined, noGroupKey)\n}\n"],"file":"helpers.js"}
1
+ {"version":3,"sources":["../../src/NotificationsList/helpers.ts"],"names":["getGroups","constaGetGroups","format","isToday","isYesterday","startOfDay","defaultGetActionIcon","action","icon","defaultGetActionLabel","label","defaultGetActionOnClick","onClick","defaultGetGroupId","group","id","defaultGetGroupLabel","defaultGetItemActions","item","actions","defaultGetItemBadges","badges","defaultGetItemDate","date","defaultGetItemDescription","description","defaultGetItemGroup","defaultGetItemImage","image","defaultGetItemLabel","defaultGetItemRead","read","defaultGetItemView","view","withDefaultGetters","props","getActionIcon","getActionLabel","getActionOnClick","getGroupId","getGroupLabel","getItemActions","getItemBadges","getItemDate","getItemDescription","getItemGroup","getItemImage","getItemLabel","getItemRead","getItemView","noGroupKey","defaultGroupLabelFormat","timestamp","sortGroup","a","b","key","items","groups","groupByDay","getTime"],"mappings":"+DAsBA,OAASA,SAAS,GAAIC,CAAAA,eAAtB,KAA6C,gD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,CAAV,CAAiBqC,OAAjB,EAAH,OACZ,CAEqB,eAKpBP,SALoB,CAMpBH,UANoB,CAQvB,CACD,MAAOjD,CAAAA,eAAe,CAACwD,CAAD,CAAQZ,CAAR,CAAsBa,CAAtB,CAA8BnB,CAA9B,QAAqDW,UAArD,CACvB,CAxBM","sourcesContent":["import {\n NotificationsListPropGetActionIcon,\n NotificationsListPropGetActionLabel,\n NotificationsListPropGetActionOnClick,\n NotificationsListPropGetGroupId,\n NotificationsListPropGetGroupLabel,\n NotificationsListPropGetItemActions,\n NotificationsListPropGetItemBadges,\n NotificationsListPropGetItemDate,\n NotificationsListPropGetItemDescription,\n NotificationsListPropGetItemGroup,\n NotificationsListPropGetItemImage,\n NotificationsListPropGetItemLabel,\n NotificationsListPropGetItemRead,\n NotificationsListPropGetItemView,\n NotificationsDefaultAction,\n NotificationsDefaultGroup,\n NotificationsDefaultItem,\n NotificationsListProps,\n NotificationsListPropGroupLabelFormat,\n} from './types'\n\nimport { getGroups as constaGetGroups } from '@consta/uikit/__internal__/src/utils/getGroups'\nimport { format, isToday, isYesterday, startOfDay } from 'date-fns'\n\nconst defaultGetActionIcon: NotificationsListPropGetActionIcon<NotificationsDefaultAction> = action =>\n action.icon\nconst defaultGetActionLabel: NotificationsListPropGetActionLabel<NotificationsDefaultAction> = action =>\n action.label\nconst defaultGetActionOnClick: NotificationsListPropGetActionOnClick<NotificationsDefaultAction> = action =>\n action.onClick\nconst defaultGetGroupId: NotificationsListPropGetGroupId<NotificationsDefaultGroup> = group =>\n group.id\nconst defaultGetGroupLabel: NotificationsListPropGetGroupLabel<NotificationsDefaultGroup> = group =>\n group.label\nconst defaultGetItemActions: NotificationsListPropGetItemActions<NotificationsDefaultItem> = item =>\n item.actions\nconst defaultGetItemBadges: NotificationsListPropGetItemBadges<NotificationsDefaultItem> = item =>\n item.badges\nconst defaultGetItemDate: NotificationsListPropGetItemDate<NotificationsDefaultItem> = item =>\n item.date\nconst defaultGetItemDescription: NotificationsListPropGetItemDescription<NotificationsDefaultItem> = item =>\n item.description\nconst defaultGetItemGroup: NotificationsListPropGetItemGroup<NotificationsDefaultItem> = item =>\n item.group\nconst defaultGetItemImage: NotificationsListPropGetItemImage<NotificationsDefaultItem> = item =>\n item.image\nconst defaultGetItemLabel: NotificationsListPropGetItemLabel<NotificationsDefaultItem> = item =>\n item.label\nconst defaultGetItemRead: NotificationsListPropGetItemRead<NotificationsDefaultItem> = item =>\n item.read\nconst defaultGetItemView: NotificationsListPropGetItemView<NotificationsDefaultItem> = item =>\n item.view\n\nexport function withDefaultGetters<ITEM, GROUP, ACTION>(\n props: NotificationsListProps<ITEM, GROUP, ACTION>\n) {\n return {\n ...props,\n getActionIcon: props.getActionIcon || defaultGetActionIcon,\n getActionLabel: props.getActionLabel || defaultGetActionLabel,\n getActionOnClick: props.getActionOnClick || defaultGetActionOnClick,\n getGroupId: props.getGroupId || defaultGetGroupId,\n getGroupLabel: props.getGroupLabel || defaultGetGroupLabel,\n getItemActions: props.getItemActions || defaultGetItemActions,\n getItemBadges: props.getItemBadges || defaultGetItemBadges,\n getItemDate: props.getItemDate || defaultGetItemDate,\n getItemDescription: props.getItemDescription || defaultGetItemDescription,\n getItemGroup: props.getItemGroup || defaultGetItemGroup,\n getItemImage: props.getItemImage || defaultGetItemImage,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemRead: props.getItemRead || defaultGetItemRead,\n getItemView: props.getItemView || defaultGetItemView,\n }\n}\n\ntype ReturnedGroup<ITEM, GROUP> = {\n items: ITEM[]\n key: string | number\n group?: GROUP\n groupIndex: number\n}\n\nexport const noGroupKey = 'no-group'\n\nexport const defaultGroupLabelFormat: NotificationsListPropGroupLabelFormat<true> = timestamp => {\n if (isToday(timestamp)) {\n return 'Сегодня'\n }\n if (isYesterday(timestamp)) {\n return 'Вчера'\n }\n return format(timestamp, 'dd.MM.yyyy')\n}\n\nconst sortGroup = (a: { key: string | number }, b: { key: string | number }) => {\n if (a.key < b.key) {\n return 1\n }\n if (a.key > b.key) {\n return -1\n }\n return 0\n}\n\nexport const getGroups = <ITEM, GROUP>(\n items: ITEM[],\n groups: GROUP[] | undefined,\n groupByDay: boolean,\n getItemGroup: NotificationsListPropGetItemGroup<ITEM>,\n getItemDate: NotificationsListPropGetItemDate<ITEM>,\n getGroupId: NotificationsListPropGetGroupId<GROUP>\n): Array<ReturnedGroup<ITEM, GROUP>> => {\n if (groupByDay) {\n const getItemGroupByDate = (item: ITEM) => {\n const date = getItemDate(item)\n return date ? startOfDay(date).getTime() : undefined\n }\n\n return constaGetGroups<ITEM, GROUP>(\n items,\n getItemGroupByDate,\n undefined,\n undefined,\n sortGroup,\n noGroupKey\n )\n }\n return constaGetGroups(items, getItemGroup, groups, getGroupId, undefined, noGroupKey)\n}\n"],"file":"helpers.js"}
@@ -2,7 +2,7 @@
2
2
  import { BadgePropStatus } from '@consta/uikit/Badge';
3
3
  import { IconProps } from '@consta/uikit/Icon';
4
4
  import { PropsWithHTMLAttributesAndRef } from "../__private__/utils/types/PropsWithHTMLAttributes";
5
- export declare type DefaultAction = {
5
+ export declare type NotificationsDefaultAction = {
6
6
  label: string;
7
7
  onClick?: React.EventHandler<React.MouseEvent>;
8
8
  icon?: React.FC<IconProps>;
@@ -11,18 +11,18 @@ export declare type Badge = {
11
11
  label: string;
12
12
  status?: BadgePropStatus;
13
13
  };
14
- export declare type DefaultGroup = {
14
+ export declare type NotificationsDefaultGroup = {
15
15
  label: string;
16
16
  id: string;
17
17
  };
18
- export declare type DefaultItem = {
18
+ export declare type NotificationsDefaultItem = {
19
19
  label: string;
20
20
  description?: string;
21
21
  image?: string;
22
22
  read?: boolean;
23
23
  date?: Date;
24
24
  badges?: Badge[];
25
- actions?: DefaultAction[];
25
+ actions?: NotificationsDefaultAction[];
26
26
  onClick?: React.EventHandler<React.MouseEvent>;
27
27
  group?: string;
28
28
  view?: 'default' | 'user';
@@ -33,7 +33,7 @@ export declare type NotificationsListPropGetItemImage<ITEM> = (item: ITEM) => st
33
33
  export declare type NotificationsListPropGetItemRead<ITEM> = (item: ITEM) => boolean | undefined;
34
34
  export declare type NotificationsListPropGetItemDate<ITEM> = (item: ITEM) => Date | undefined;
35
35
  export declare type NotificationsListPropGetItemBadges<ITEM> = (item: ITEM) => Badge[] | undefined;
36
- export declare type NotificationsListPropGetItemActions<ITEM> = (item: ITEM) => DefaultAction[] | undefined;
36
+ export declare type NotificationsListPropGetItemActions<ITEM> = (item: ITEM) => NotificationsDefaultAction[] | undefined;
37
37
  export declare type NotificationsListPropGetItemGroup<ITEM> = (item: ITEM) => string | undefined;
38
38
  export declare type NotificationsListPropGetItemView<ITEM> = (item: ITEM) => 'default' | 'user' | undefined;
39
39
  export declare type NotificationsListPropItemDateFormat = (date: Date) => string;
@@ -68,21 +68,21 @@ export declare type Props<ITEM, GROUP, ACTION, GROUP_BY_DAY extends boolean> = {
68
68
  groups?: GROUP_BY_DAY extends true ? never : GROUP[];
69
69
  onClose?: React.EventHandler<React.MouseEvent>;
70
70
  } & (ACTION extends {
71
- label: DefaultAction['label'];
71
+ label: NotificationsDefaultAction['label'];
72
72
  } ? {} : {
73
73
  getActionLabel: NotificationsListPropGetItemActions<ACTION>;
74
74
  }) & (GROUP extends {
75
- label: DefaultGroup['label'];
75
+ label: NotificationsDefaultGroup['label'];
76
76
  } ? {} : {
77
77
  getGroupLabel: NotificationsListPropGetGroupLabel<GROUP>;
78
78
  }) & (GROUP extends {
79
- id: DefaultGroup['id'];
79
+ id: NotificationsDefaultGroup['id'];
80
80
  } ? {} : {
81
81
  getGroupId: NotificationsListPropGetGroupId<GROUP>;
82
82
  }) & (ITEM extends {
83
- label: DefaultItem['label'];
83
+ label: NotificationsDefaultItem['label'];
84
84
  } ? {} : {
85
85
  getItemLabel: NotificationsListPropGetItemLabel<ITEM>;
86
86
  });
87
- export declare type NotificationsListProps<ITEM = DefaultItem, GROUP = DefaultGroup, ACTION = DefaultAction, GROUP_BY_DAY extends boolean = false> = PropsWithHTMLAttributesAndRef<Props<ITEM, GROUP, ACTION, GROUP_BY_DAY>, HTMLDivElement>;
88
- export declare type NotificationsListComponent = <ITEM = DefaultItem, GROUP = DefaultGroup, ACTION = DefaultAction, GROUP_BY_DAY extends boolean = false>(props: NotificationsListProps<ITEM, GROUP, ACTION, GROUP_BY_DAY>) => React.ReactElement | null;
87
+ export declare type NotificationsListProps<ITEM = NotificationsDefaultItem, GROUP = NotificationsDefaultGroup, ACTION = NotificationsDefaultAction, GROUP_BY_DAY extends boolean = false> = PropsWithHTMLAttributesAndRef<Props<ITEM, GROUP, ACTION, GROUP_BY_DAY>, HTMLDivElement>;
88
+ export declare type NotificationsListComponent = <ITEM = NotificationsDefaultItem, GROUP = NotificationsDefaultGroup, ACTION = NotificationsDefaultAction, GROUP_BY_DAY extends boolean = false>(props: NotificationsListProps<ITEM, GROUP, ACTION, GROUP_BY_DAY>) => React.ReactElement | null;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/SelectMenu/SelectMenu.tsx"],"names":["React","useRef","useCallback","forwardRef","cn","withDefaultGetters","Text","IconSelect","useFlag","useMutableRef","useForkRef","AnimatedContextMenu","cnSelectMenu","SelectMenuRender","props","componentRef","items","className","getItemHref","getItemLabel","getItemOnClick","getItemTarget","onItemClick","label","onClick","onClickProp","getItemSubMenu","style","otherProps","open","setOpen","ref","getItemHrefRef","getItemTargetRef","onClickRef","getItemAs","item","current","getItemHTMLAttributes","href","target","e","toogle","off","zIndex","SelectMenu"],"mappings":"iMAAA,MAAOA,CAAAA,KAAP,EAAgBC,MAAhB,CAAwBC,WAAxB,CAAqCC,UAArC,KAAuD,OAAvD,CAEA,OAASC,EAAT,gCAEA,OAASC,kBAAT,iBAEA,yBACA,OAASC,IAAT,KAAqB,oBAArB,CACA,OAASC,UAAT,KAA2B,0BAA3B,CACA,OAASC,OAAT,KAAwB,uBAAxB,CACA,OAASC,aAAT,KAA8B,6BAA9B,CACA,OAASC,UAAT,KAA2B,0BAA3B,CACA,OAASC,mBAAT,8DAEA,MAAO,M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,CAAK,CAAEiB,MAAd,EAAoCjB,CAAK,CAACiB,MAAN,CAAe,CAAnD,CAAuD,MAAjE,CAdT,EAhBJ,CAmCH,CAlFD,CAoFA,MAAO,MAAMC,CAAAA,UAAU,CAAG1C,UAAU,CAACU,gBAAD,CAA7B,CAEP","sourcesContent":["import React, { useRef, useCallback, forwardRef } from 'react'\n\nimport { cn } from '@/__private__/utils/bem'\n\nimport { withDefaultGetters } from './helpers'\nimport { SelectMenuComponent, SelectMenuProps, DefaultItem } from './types'\nimport './SelectMenu.css'\nimport { Text } from '@consta/uikit/Text'\nimport { IconSelect } from '@consta/uikit/IconSelect'\nimport { useFlag } from '@consta/uikit/useFlag'\nimport { useMutableRef } from '@consta/uikit/useMutableRef'\nimport { useForkRef } from '@consta/uikit/useForkRef'\nimport { AnimatedContextMenu } from '@/__private__/AnimatedContextMenu/AnimatedContextMenu'\n\nexport const cnSelectMenu = cn('SelectMenu')\n\nconst SelectMenuRender = (props: SelectMenuProps, componentRef: React.Ref<HTMLDivElement>) => {\n const {\n items,\n className,\n getItemHref,\n getItemLabel,\n getItemOnClick,\n getItemTarget,\n onItemClick,\n label,\n onClick: onClickProp,\n getItemSubMenu,\n style,\n ...otherProps\n } = withDefaultGetters(props)\n\n const [open, setOpen] = useFlag()\n\n const ref = useRef<HTMLDivElement>(null)\n\n const getItemHrefRef = useMutableRef(getItemHref)\n const getItemTargetRef = useMutableRef(getItemTarget)\n const onClickRef = useMutableRef(onClickProp)\n\n const getItemAs = useCallback((item: DefaultItem) => {\n if (!!getItemHrefRef.current(item)) {\n return 'a'\n }\n return 'span'\n }, [])\n\n const getItemHTMLAttributes = useCallback((item: DefaultItem) => {\n const href = getItemHrefRef.current(item)\n const target = getItemTargetRef.current(item)\n\n return {\n ...(href && { href: getItemHrefRef.current(item) }),\n ...(target && { href: getItemTargetRef.current(item) }),\n }\n }, [])\n\n const onClick = useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n onClickRef.current?.(e)\n setOpen.toogle()\n }, [])\n\n return (\n <>\n <div\n {...otherProps}\n className={cnSelectMenu(null, [className])}\n ref={useForkRef([ref, componentRef])}\n onClick={onClick}\n style={style}\n >\n <Text className={cnSelectMenu('Label')} size=\"s\">\n {label}\n </Text>\n <span className={cnSelectMenu('ArrowBox', { open })}>\n <IconSelect size=\"xs\" />\n </span>\n </div>\n {items && (\n <AnimatedContextMenu\n className={cnSelectMenu('Menu')}\n anchorRef={ref}\n isOpen={open}\n items={items}\n getLabel={getItemLabel}\n getItemOnClick={getItemOnClick}\n getItemAs={getItemAs}\n getItemHTMLAttributes={getItemHTMLAttributes}\n onClickOutside={setOpen.off}\n onItemClick={onItemClick}\n direction=\"rightStartDown\"\n possibleDirections={['downStartLeft', 'upStartLeft', 'downStartRight', 'upStartRight']}\n getSubItems={getItemSubMenu}\n style={{ zIndex: typeof style?.zIndex === 'number' ? style.zIndex + 1 : 'auto' }}\n />\n )}\n </>\n )\n}\n\nexport const SelectMenu = forwardRef(SelectMenuRender) as SelectMenuComponent\n\nexport * from './types'\n"],"file":"SelectMenu.js"}
1
+ {"version":3,"sources":["../../src/SelectMenu/SelectMenu.tsx"],"names":["React","useRef","useCallback","forwardRef","cn","withDefaultGetters","Text","IconSelect","useFlag","useMutableRef","useForkRef","AnimatedContextMenu","cnSelectMenu","SelectMenuRender","props","componentRef","items","className","getItemHref","getItemLabel","getItemOnClick","getItemTarget","onItemClick","label","onClick","onClickProp","getItemSubMenu","style","otherProps","open","setOpen","ref","getItemHrefRef","getItemTargetRef","onClickRef","getItemAs","item","current","getItemHTMLAttributes","href","target","e","toogle","off","zIndex","SelectMenu"],"mappings":"iMAAA,MAAOA,CAAAA,KAAP,EAAgBC,MAAhB,CAAwBC,WAAxB,CAAqCC,UAArC,KAAuD,OAAvD,CAEA,OAASC,EAAT,gCAEA,OAASC,kBAAT,iBAEA,yBACA,OAASC,IAAT,KAAqB,oBAArB,CACA,OAASC,UAAT,KAA2B,0BAA3B,CACA,OAASC,OAAT,KAAwB,u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AaE,WAAW,CAAEI,CAbf,CAcE,KAAK,CAAE,CAAEkB,MAAM,CAA2B,QAAzB,gBAAOjB,CAAP,WAAOA,CAAP,QAAOA,CAAK,CAAEiB,MAAd,EAAoCjB,CAAK,CAACiB,MAAN,CAAe,CAAnD,CAAuD,MAAjE,CAdT,EAhBJ,CAmCH,CAlFD,CAoFA,MAAO,MAAMC,CAAAA,UAAU,CAAG1C,UAAU,CAACU,gBAAD,CAA7B,CAEP","sourcesContent":["import React, { useRef, useCallback, forwardRef } from 'react'\n\nimport { cn } from '@/__private__/utils/bem'\n\nimport { withDefaultGetters } from './helpers'\nimport { SelectMenuComponent, SelectMenuProps, SelectMenuDefaultItem } from './types'\nimport './SelectMenu.css'\nimport { Text } from '@consta/uikit/Text'\nimport { IconSelect } from '@consta/uikit/IconSelect'\nimport { useFlag } from '@consta/uikit/useFlag'\nimport { useMutableRef } from '@consta/uikit/useMutableRef'\nimport { useForkRef } from '@consta/uikit/useForkRef'\nimport { AnimatedContextMenu } from '@/__private__/AnimatedContextMenu/AnimatedContextMenu'\n\nexport const cnSelectMenu = cn('SelectMenu')\n\nconst SelectMenuRender = (props: SelectMenuProps, componentRef: React.Ref<HTMLDivElement>) => {\n const {\n items,\n className,\n getItemHref,\n getItemLabel,\n getItemOnClick,\n getItemTarget,\n onItemClick,\n label,\n onClick: onClickProp,\n getItemSubMenu,\n style,\n ...otherProps\n } = withDefaultGetters(props)\n\n const [open, setOpen] = useFlag()\n\n const ref = useRef<HTMLDivElement>(null)\n\n const getItemHrefRef = useMutableRef(getItemHref)\n const getItemTargetRef = useMutableRef(getItemTarget)\n const onClickRef = useMutableRef(onClickProp)\n\n const getItemAs = useCallback((item: SelectMenuDefaultItem) => {\n if (!!getItemHrefRef.current(item)) {\n return 'a'\n }\n return 'span'\n }, [])\n\n const getItemHTMLAttributes = useCallback((item: SelectMenuDefaultItem) => {\n const href = getItemHrefRef.current(item)\n const target = getItemTargetRef.current(item)\n\n return {\n ...(href && { href: getItemHrefRef.current(item) }),\n ...(target && { href: getItemTargetRef.current(item) }),\n }\n }, [])\n\n const onClick = useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n onClickRef.current?.(e)\n setOpen.toogle()\n }, [])\n\n return (\n <>\n <div\n {...otherProps}\n className={cnSelectMenu(null, [className])}\n ref={useForkRef([ref, componentRef])}\n onClick={onClick}\n style={style}\n >\n <Text className={cnSelectMenu('Label')} size=\"s\">\n {label}\n </Text>\n <span className={cnSelectMenu('ArrowBox', { open })}>\n <IconSelect size=\"xs\" />\n </span>\n </div>\n {items && (\n <AnimatedContextMenu\n className={cnSelectMenu('Menu')}\n anchorRef={ref}\n isOpen={open}\n items={items}\n getLabel={getItemLabel}\n getItemOnClick={getItemOnClick}\n getItemAs={getItemAs}\n getItemHTMLAttributes={getItemHTMLAttributes}\n onClickOutside={setOpen.off}\n onItemClick={onItemClick}\n direction=\"rightStartDown\"\n possibleDirections={['downStartLeft', 'upStartLeft', 'downStartRight', 'upStartRight']}\n getSubItems={getItemSubMenu}\n style={{ zIndex: typeof style?.zIndex === 'number' ? style.zIndex + 1 : 'auto' }}\n />\n )}\n </>\n )\n}\n\nexport const SelectMenu = forwardRef(SelectMenuRender) as SelectMenuComponent\n\nexport * from './types'\n"],"file":"SelectMenu.js"}
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { DefaultItem, SelectMenuProps, SelectMenuPropGetItemHref, SelectMenuPropGetItemLabel, SelectMenuPropGetItemOnClick, SelectMenuPropGetItemTarget, SelectMenuPropGetItemSubMenu } from "./types";
3
- export declare const defaultGetItemLabel: SelectMenuPropGetItemLabel<DefaultItem>;
4
- export declare const defaultGetItemHref: SelectMenuPropGetItemHref<DefaultItem>;
5
- export declare const defaultGetItemOnClick: SelectMenuPropGetItemOnClick<DefaultItem>;
6
- export declare const defaultGetItemTarget: SelectMenuPropGetItemTarget<DefaultItem>;
7
- export declare const defaultGetItemSubMenu: SelectMenuPropGetItemSubMenu<DefaultItem>;
2
+ import { SelectMenuDefaultItem, SelectMenuProps, SelectMenuPropGetItemHref, SelectMenuPropGetItemLabel, SelectMenuPropGetItemOnClick, SelectMenuPropGetItemTarget, SelectMenuPropGetItemSubMenu } from "./types";
3
+ export declare const defaultGetItemLabel: SelectMenuPropGetItemLabel<SelectMenuDefaultItem>;
4
+ export declare const defaultGetItemHref: SelectMenuPropGetItemHref<SelectMenuDefaultItem>;
5
+ export declare const defaultGetItemOnClick: SelectMenuPropGetItemOnClick<SelectMenuDefaultItem>;
6
+ export declare const defaultGetItemTarget: SelectMenuPropGetItemTarget<SelectMenuDefaultItem>;
7
+ export declare const defaultGetItemSubMenu: SelectMenuPropGetItemSubMenu<SelectMenuDefaultItem>;
8
8
  export declare const getGetters: <ITEM>(props: {
9
9
  getItemLabel?: SelectMenuPropGetItemLabel<ITEM> | undefined;
10
10
  getItemHref?: SelectMenuPropGetItemHref<ITEM> | undefined;
@@ -12,11 +12,11 @@ export declare const getGetters: <ITEM>(props: {
12
12
  getItemTarget?: SelectMenuPropGetItemTarget<ITEM> | undefined;
13
13
  getItemSubMenu?: SelectMenuPropGetItemSubMenu<ITEM> | undefined;
14
14
  }) => {
15
- getItemLabel: SelectMenuPropGetItemLabel<DefaultItem> | SelectMenuPropGetItemLabel<ITEM>;
16
- getItemHref: SelectMenuPropGetItemHref<DefaultItem> | SelectMenuPropGetItemHref<ITEM>;
17
- getItemOnClick: SelectMenuPropGetItemOnClick<DefaultItem> | SelectMenuPropGetItemOnClick<ITEM>;
18
- getItemTarget: SelectMenuPropGetItemTarget<DefaultItem> | SelectMenuPropGetItemTarget<ITEM>;
19
- getItemSubMenu: SelectMenuPropGetItemSubMenu<DefaultItem> | SelectMenuPropGetItemSubMenu<ITEM>;
15
+ getItemLabel: SelectMenuPropGetItemLabel<SelectMenuDefaultItem> | SelectMenuPropGetItemLabel<ITEM>;
16
+ getItemHref: SelectMenuPropGetItemHref<SelectMenuDefaultItem> | SelectMenuPropGetItemHref<ITEM>;
17
+ getItemOnClick: SelectMenuPropGetItemOnClick<SelectMenuDefaultItem> | SelectMenuPropGetItemOnClick<ITEM>;
18
+ getItemTarget: SelectMenuPropGetItemTarget<SelectMenuDefaultItem> | SelectMenuPropGetItemTarget<ITEM>;
19
+ getItemSubMenu: SelectMenuPropGetItemSubMenu<SelectMenuDefaultItem> | SelectMenuPropGetItemSubMenu<ITEM>;
20
20
  };
21
21
  export declare function withDefaultGetters<ITEM>(props: SelectMenuProps<ITEM>): {
22
22
  items: ITEM[];
@@ -32,9 +32,9 @@ export declare function withDefaultGetters<ITEM>(props: SelectMenuProps<ITEM>):
32
32
  } ? {} : {
33
33
  getItemLabel: SelectMenuPropGetItemLabel<ITEM>;
34
34
  }) & {
35
- getItemLabel: SelectMenuPropGetItemLabel<DefaultItem> | SelectMenuPropGetItemLabel<ITEM>;
36
- getItemHref: SelectMenuPropGetItemHref<DefaultItem> | SelectMenuPropGetItemHref<ITEM>;
37
- getItemOnClick: SelectMenuPropGetItemOnClick<DefaultItem> | SelectMenuPropGetItemOnClick<ITEM>;
38
- getItemTarget: SelectMenuPropGetItemTarget<DefaultItem> | SelectMenuPropGetItemTarget<ITEM>;
39
- getItemSubMenu: SelectMenuPropGetItemSubMenu<DefaultItem> | SelectMenuPropGetItemSubMenu<ITEM>;
35
+ getItemLabel: SelectMenuPropGetItemLabel<SelectMenuDefaultItem> | SelectMenuPropGetItemLabel<ITEM>;
36
+ getItemHref: SelectMenuPropGetItemHref<SelectMenuDefaultItem> | SelectMenuPropGetItemHref<ITEM>;
37
+ getItemOnClick: SelectMenuPropGetItemOnClick<SelectMenuDefaultItem> | SelectMenuPropGetItemOnClick<ITEM>;
38
+ getItemTarget: SelectMenuPropGetItemTarget<SelectMenuDefaultItem> | SelectMenuPropGetItemTarget<ITEM>;
39
+ getItemSubMenu: SelectMenuPropGetItemSubMenu<SelectMenuDefaultItem> | SelectMenuPropGetItemSubMenu<ITEM>;
40
40
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/SelectMenu/helpers.ts"],"names":["defaultGetItemLabel","item","label","defaultGetItemHref","href","defaultGetItemOnClick","onClick","defaultGetItemTarget","target","defaultGetItemSubMenu","subMenu","getGetters","props","getItemLabel","getItemHref","getItemOnClick","getItemTarget","getItemSubMenu","withDefaultGetters"],"mappings":"+DAUA,MAAO,MAAMA,CAAAA,mBAA4D,CAAGC,CAAI,EAAIA,CAAI,CAACC,KAAlF,CACP,MAAO,MAAMC,CAAAA,kBAA0D,CAAGF,CAAI,EAAIA,CAAI,CAACG,IAAhF,CACP,MAAO,MAAMC,CAAAA,qBAAgE,CAAGJ,CAAI,EAAIA,CAAI,CAACK,OAAtF,CACP,MAAO,MAAMC,CAAAA,oBAA8D,CAAGN,CAAI,EAAIA,CAAI,CAACO,MAApF,CACP,MAAO,MAAMC,CAAAA,qBAAgE,CAAGR,CAAI,EAAIA,CAAI,CAACS,OAAtF,CAEP,MAAO,MAAMC,CAAAA,UAAU,CAAUC,CAAP,GAOjB,CACLC,YAAY,CAAED,CAAK,CAACC,YAAN,EAAsBb,mBAD/B,CAELc,WAAW,CAAEF,CAAK,CAACE,WAAN,EAAqBX,kBAF7B,CAGLY,cAAc,CAAEH,CAAK,CAACG,cAAN,EAAwBV,qBAHnC,CAILW,aAAa,CAAEJ,CAAK,CAACI,aAAN,EAAuBT,oBAJjC,CAKLU,cAAc,CAAEL,CAAK,CAACK,cAAN,EAAwBR,qBALnC,CAPiB,CAAnB,CAgBP,MAAO,SAASS,CAAAA,kBAAT,CAAkCN,CAAlC,CAAgE,CACrE,wBACKA,CADL,CAEKD,UAAU,CAACC,CAAD,CAFf,CAID","sourcesContent":["import {\n DefaultItem,\n SelectMenuProps,\n SelectMenuPropGetItemHref,\n SelectMenuPropGetItemLabel,\n SelectMenuPropGetItemOnClick,\n SelectMenuPropGetItemTarget,\n SelectMenuPropGetItemSubMenu,\n} from './types'\n\nexport const defaultGetItemLabel: SelectMenuPropGetItemLabel<DefaultItem> = item => item.label\nexport const defaultGetItemHref: SelectMenuPropGetItemHref<DefaultItem> = item => item.href\nexport const defaultGetItemOnClick: SelectMenuPropGetItemOnClick<DefaultItem> = item => item.onClick\nexport const defaultGetItemTarget: SelectMenuPropGetItemTarget<DefaultItem> = item => item.target\nexport const defaultGetItemSubMenu: SelectMenuPropGetItemSubMenu<DefaultItem> = item => item.subMenu\n\nexport const getGetters = <ITEM>(props: {\n getItemLabel?: SelectMenuPropGetItemLabel<ITEM>\n getItemHref?: SelectMenuPropGetItemHref<ITEM>\n getItemOnClick?: SelectMenuPropGetItemOnClick<ITEM>\n getItemTarget?: SelectMenuPropGetItemTarget<ITEM>\n getItemSubMenu?: SelectMenuPropGetItemSubMenu<ITEM>\n}) => {\n return {\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemHref: props.getItemHref || defaultGetItemHref,\n getItemOnClick: props.getItemOnClick || defaultGetItemOnClick,\n getItemTarget: props.getItemTarget || defaultGetItemTarget,\n getItemSubMenu: props.getItemSubMenu || defaultGetItemSubMenu,\n }\n}\n\nexport function withDefaultGetters<ITEM>(props: SelectMenuProps<ITEM>) {\n return {\n ...props,\n ...getGetters(props),\n }\n}\n"],"file":"helpers.js"}
1
+ {"version":3,"sources":["../../src/SelectMenu/helpers.ts"],"names":["defaultGetItemLabel","item","label","defaultGetItemHref","href","defaultGetItemOnClick","onClick","defaultGetItemTarget","target","defaultGetItemSubMenu","subMenu","getGetters","props","getItemLabel","getItemHref","getItemOnClick","getItemTarget","getItemSubMenu","withDefaultGetters"],"mappings":"+DAUA,MAAO,MAAMA,CAAAA,mBAAsE,CAAGC,CAAI,EACxFA,CAAI,CAACC,KADA,CAEP,MAAO,MAAMC,CAAAA,kBAAoE,CAAGF,CAAI,EACtFA,CAAI,CAACG,IADA,CAEP,MAAO,MAAMC,CAAAA,qBAA0E,CAAGJ,CAAI,EAC5FA,CAAI,CAACK,OADA,CAEP,MAAO,MAAMC,CAAAA,oBAAwE,CAAGN,CAAI,EAC1FA,CAAI,CAACO,MADA,CAEP,MAAO,MAAMC,CAAAA,qBAA0E,CAAGR,CAAI,EAC5FA,CAAI,CAACS,OADA,CAGP,MAAO,MAAMC,CAAAA,UAAU,CAAUC,CAAP,GAOjB,CACLC,YAAY,CAAED,CAAK,CAACC,YAAN,EAAsBb,mBAD/B,CAELc,WAAW,CAAEF,CAAK,CAACE,WAAN,EAAqBX,kBAF7B,CAGLY,cAAc,CAAEH,CAAK,CAACG,cAAN,EAAwBV,qBAHnC,CAILW,aAAa,CAAEJ,CAAK,CAACI,aAAN,EAAuBT,oBAJjC,CAKLU,cAAc,CAAEL,CAAK,CAACK,cAAN,EAAwBR,qBALnC,CAPiB,CAAnB,CAgBP,MAAO,SAASS,CAAAA,kBAAT,CAAkCN,CAAlC,CAAgE,CACrE,wBACKA,CADL,CAEKD,UAAU,CAACC,CAAD,CAFf,CAID","sourcesContent":["import {\n SelectMenuDefaultItem,\n SelectMenuProps,\n SelectMenuPropGetItemHref,\n SelectMenuPropGetItemLabel,\n SelectMenuPropGetItemOnClick,\n SelectMenuPropGetItemTarget,\n SelectMenuPropGetItemSubMenu,\n} from './types'\n\nexport const defaultGetItemLabel: SelectMenuPropGetItemLabel<SelectMenuDefaultItem> = item =>\n item.label\nexport const defaultGetItemHref: SelectMenuPropGetItemHref<SelectMenuDefaultItem> = item =>\n item.href\nexport const defaultGetItemOnClick: SelectMenuPropGetItemOnClick<SelectMenuDefaultItem> = item =>\n item.onClick\nexport const defaultGetItemTarget: SelectMenuPropGetItemTarget<SelectMenuDefaultItem> = item =>\n item.target\nexport const defaultGetItemSubMenu: SelectMenuPropGetItemSubMenu<SelectMenuDefaultItem> = item =>\n item.subMenu\n\nexport const getGetters = <ITEM>(props: {\n getItemLabel?: SelectMenuPropGetItemLabel<ITEM>\n getItemHref?: SelectMenuPropGetItemHref<ITEM>\n getItemOnClick?: SelectMenuPropGetItemOnClick<ITEM>\n getItemTarget?: SelectMenuPropGetItemTarget<ITEM>\n getItemSubMenu?: SelectMenuPropGetItemSubMenu<ITEM>\n}) => {\n return {\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemHref: props.getItemHref || defaultGetItemHref,\n getItemOnClick: props.getItemOnClick || defaultGetItemOnClick,\n getItemTarget: props.getItemTarget || defaultGetItemTarget,\n getItemSubMenu: props.getItemSubMenu || defaultGetItemSubMenu,\n }\n}\n\nexport function withDefaultGetters<ITEM>(props: SelectMenuProps<ITEM>) {\n return {\n ...props,\n ...getGetters(props),\n }\n}\n"],"file":"helpers.js"}
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { PropsWithHTMLAttributesAndRef } from "../__private__/utils/types/PropsWithHTMLAttributes";
3
- export declare type DefaultItem = {
3
+ export declare type SelectMenuDefaultItem = {
4
4
  label: string;
5
5
  href?: string;
6
6
  target?: string;
7
7
  onClick?: React.EventHandler<React.MouseEvent>;
8
- subMenu?: DefaultItem[];
8
+ subMenu?: SelectMenuDefaultItem[];
9
9
  };
10
10
  export declare type SelectMenuPropGetItemLabel<ITEM> = (item: ITEM) => string;
11
11
  export declare type SelectMenuPropGetItemHref<ITEM> = (item: ITEM) => string | undefined;
@@ -16,7 +16,7 @@ export declare type SelectMenuPropOnItemClick<ITEM> = (props: {
16
16
  item: ITEM;
17
17
  }) => void;
18
18
  export declare type SelectMenuPropGetItemSubMenu<ITEM> = (item: ITEM) => ITEM[] | undefined;
19
- export declare type SelectMenuProps<ITEM = DefaultItem> = PropsWithHTMLAttributesAndRef<{
19
+ export declare type SelectMenuProps<ITEM = SelectMenuDefaultItem> = PropsWithHTMLAttributesAndRef<{
20
20
  items: ITEM[];
21
21
  onItemClick?: SelectMenuPropOnItemClick<ITEM>;
22
22
  getItemHref?: SelectMenuPropGetItemHref<ITEM>;
@@ -26,8 +26,8 @@ export declare type SelectMenuProps<ITEM = DefaultItem> = PropsWithHTMLAttribute
26
26
  getItemSubMenu?: SelectMenuPropGetItemSubMenu<ITEM>;
27
27
  label: string;
28
28
  }, HTMLDivElement> & (ITEM extends {
29
- label: DefaultItem['label'];
29
+ label: SelectMenuDefaultItem['label'];
30
30
  } ? {} : {
31
31
  getItemLabel: SelectMenuPropGetItemLabel<ITEM>;
32
32
  });
33
- export declare type SelectMenuComponent = <ITEM = DefaultItem>(props: SelectMenuProps<ITEM>) => React.ReactElement | null;
33
+ export declare type SelectMenuComponent = <ITEM = SelectMenuDefaultItem>(props: SelectMenuProps<ITEM>) => React.ReactElement | null;
@@ -1 +1 @@
1
- .che--TileMenu-List{display:grid}.che--TileMenu-List_view_cards{grid-template-columns:repeat(3,1fr);grid-row-gap:var(--space-2xs);grid-column-gap:var(--space-2xs)}.che--TileMenu-List_view_lines{grid-template-columns:repeat(1,1fr)}.che--TileMenu-List_view_twoLines{grid-template-columns:repeat(2,1fr);grid-column-gap:calc(var(--space-xl) + var(--space-2xs))}.che--TileMenu-Popover{--popover-bg-color:var(--color-bg-default);--popover-arrow-bg-color:var(--popover-bg-color);position:relative;width:calc(100vw - var(--space-l));max-width:var(--popover-max-width);border-radius:var(--control-radius);background:var(--popover-bg-color);box-shadow:var(--shadow-layer)}.che--TileMenu-Popover_view_cards{--popover-max-width:320px}.che--TileMenu-Popover_view_lines{--popover-max-width:520px}.che--TileMenu-Popover_view_twoLines{--popover-max-width:1000px}.che--TileMenu-ListWrapper{overflow:hidden;border-radius:var(--control-radius)}
1
+ .che--TileMenu-List{display:grid}.che--TileMenu-List_view_cards{grid-template-columns:repeat(3,1fr);grid-row-gap:var(--space-2xs);grid-column-gap:var(--space-2xs)}.che--TileMenu-List_view_lines{grid-template-columns:repeat(1,1fr)}.che--TileMenu-List_view_twoLines{grid-template-columns:repeat(2,1fr);grid-column-gap:calc(var(--space-xl) + var(--space-2xs))}.che--TileMenu-Popover{--popover-bg-color:var(--color-bg-default);--popover-arrow-bg-color:var(--popover-bg-color);width:calc(100vw - var(--space-l));max-width:var(--popover-max-width);border-radius:var(--control-radius);background:var(--popover-bg-color);box-shadow:var(--shadow-layer)}.che--TileMenu-Popover_view_cards{--popover-max-width:320px}.che--TileMenu-Popover_view_lines{--popover-max-width:520px}.che--TileMenu-Popover_view_twoLines{--popover-max-width:1000px}.che--TileMenu-ListWrapper{overflow:hidden;border-radius:var(--control-radius)}
@@ -1,16 +1,16 @@
1
1
  /// <reference types="react" />
2
- import { TileMenuPropGetItemDescription, TileMenuPropGetItemImage, TileMenuPropGetItemLabel, DefaultItem, TileMenuListProps, TileMenuPropGetItemHref, TileMenuPropGetItemOnClick } from "./types";
3
- export declare const defaultGetItemImage: TileMenuPropGetItemImage<DefaultItem>;
4
- export declare const defaultGetItemLabel: TileMenuPropGetItemLabel<DefaultItem>;
5
- export declare const defaultGetItemHref: TileMenuPropGetItemHref<DefaultItem>;
6
- export declare const defaultGetItemOnClick: TileMenuPropGetItemOnClick<DefaultItem>;
7
- export declare const defaultGetItemDescription: TileMenuPropGetItemDescription<DefaultItem>;
2
+ import { TileMenuPropGetItemDescription, TileMenuPropGetItemImage, TileMenuPropGetItemLabel, TileMenuDefaultItem, TileMenuListProps, TileMenuPropGetItemHref, TileMenuPropGetItemOnClick } from "./types";
3
+ export declare const defaultGetItemImage: TileMenuPropGetItemImage<TileMenuDefaultItem>;
4
+ export declare const defaultGetItemLabel: TileMenuPropGetItemLabel<TileMenuDefaultItem>;
5
+ export declare const defaultGetItemHref: TileMenuPropGetItemHref<TileMenuDefaultItem>;
6
+ export declare const defaultGetItemOnClick: TileMenuPropGetItemOnClick<TileMenuDefaultItem>;
7
+ export declare const defaultGetItemDescription: TileMenuPropGetItemDescription<TileMenuDefaultItem>;
8
8
  export declare function withDefaultGetters<ITEM>(props: TileMenuListProps<ITEM>): {
9
- getItemDescription: TileMenuPropGetItemDescription<DefaultItem> | TileMenuPropGetItemDescription<ITEM>;
10
- getItemLabel: TileMenuPropGetItemLabel<DefaultItem> | TileMenuPropGetItemLabel<ITEM>;
11
- getItemImage: TileMenuPropGetItemImage<DefaultItem> | TileMenuPropGetItemImage<ITEM>;
12
- getItemHref: TileMenuPropGetItemHref<DefaultItem> | TileMenuPropGetItemHref<ITEM>;
13
- getItemOnClick: TileMenuPropGetItemOnClick<DefaultItem> | TileMenuPropGetItemOnClick<ITEM>;
9
+ getItemDescription: TileMenuPropGetItemDescription<TileMenuDefaultItem> | TileMenuPropGetItemDescription<ITEM>;
10
+ getItemLabel: TileMenuPropGetItemLabel<TileMenuDefaultItem> | TileMenuPropGetItemLabel<ITEM>;
11
+ getItemImage: TileMenuPropGetItemImage<TileMenuDefaultItem> | TileMenuPropGetItemImage<ITEM>;
12
+ getItemHref: TileMenuPropGetItemHref<TileMenuDefaultItem> | TileMenuPropGetItemHref<ITEM>;
13
+ getItemOnClick: TileMenuPropGetItemOnClick<TileMenuDefaultItem> | TileMenuPropGetItemOnClick<ITEM>;
14
14
  view?: "lines" | "twoLines" | "cards" | undefined;
15
15
  items: ITEM[];
16
16
  isMobile?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TileMenu/helpers.ts"],"names":["defaultGetItemImage","item","image","defaultGetItemLabel","label","defaultGetItemHref","href","defaultGetItemOnClick","onClick","defaultGetItemDescription","description","withDefaultGetters","props","getItemDescription","getItemLabel","getItemImage","getItemHref","getItemOnClick"],"mappings":"+DAUA,MAAO,MAAMA,CAAAA,mBAA0D,CAAGC,CAAI,EAAIA,CAAI,CAACC,KAAhF,CACP,MAAO,MAAMC,CAAAA,mBAA0D,CAAGF,CAAI,EAAIA,CAAI,CAACG,KAAhF,CACP,MAAO,MAAMC,CAAAA,kBAAwD,CAAGJ,CAAI,EAAIA,CAAI,CAACK,IAA9E,CACP,MAAO,MAAMC,CAAAA,qBAA8D,CAAGN,CAAI,EAAIA,CAAI,CAACO,OAApF,CACP,MAAO,MAAMC,CAAAA,yBAAsE,CAAGR,CAAI,EACxFA,CAAI,CAACS,WADA,CAGP,MAAO,SAASC,CAAAA,kBAAT,CAAkCC,CAAlC,CAAkE,CACvE,wBACKA,CADL,EAEEC,kBAAkB,CAAED,CAAK,CAACC,kBAAN,EAA4BJ,yBAFlD,CAGEK,YAAY,CAAEF,CAAK,CAACE,YAAN,EAAsBX,mBAHtC,CAIEY,YAAY,CAAEH,CAAK,CAACG,YAAN,EAAsBf,mBAJtC,CAKEgB,WAAW,CAAEJ,CAAK,CAACI,WAAN,EAAqBX,kBALpC,CAMEY,cAAc,CAAEL,CAAK,CAACK,cAAN,EAAwBV,qBAN1C,EAQD","sourcesContent":["import {\n TileMenuPropGetItemDescription,\n TileMenuPropGetItemImage,\n TileMenuPropGetItemLabel,\n DefaultItem,\n TileMenuListProps,\n TileMenuPropGetItemHref,\n TileMenuPropGetItemOnClick,\n} from './types'\n\nexport const defaultGetItemImage: TileMenuPropGetItemImage<DefaultItem> = item => item.image\nexport const defaultGetItemLabel: TileMenuPropGetItemLabel<DefaultItem> = item => item.label\nexport const defaultGetItemHref: TileMenuPropGetItemHref<DefaultItem> = item => item.href\nexport const defaultGetItemOnClick: TileMenuPropGetItemOnClick<DefaultItem> = item => item.onClick\nexport const defaultGetItemDescription: TileMenuPropGetItemDescription<DefaultItem> = item =>\n item.description\n\nexport function withDefaultGetters<ITEM>(props: TileMenuListProps<ITEM>) {\n return {\n ...props,\n getItemDescription: props.getItemDescription || defaultGetItemDescription,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemImage: props.getItemImage || defaultGetItemImage,\n getItemHref: props.getItemHref || defaultGetItemHref,\n getItemOnClick: props.getItemOnClick || defaultGetItemOnClick,\n }\n}\n"],"file":"helpers.js"}
1
+ {"version":3,"sources":["../../src/TileMenu/helpers.ts"],"names":["defaultGetItemImage","item","image","defaultGetItemLabel","label","defaultGetItemHref","href","defaultGetItemOnClick","onClick","defaultGetItemDescription","description","withDefaultGetters","props","getItemDescription","getItemLabel","getItemImage","getItemHref","getItemOnClick"],"mappings":"+DAUA,MAAO,MAAMA,CAAAA,mBAAkE,CAAGC,CAAI,EAAIA,CAAI,CAACC,KAAxF,CACP,MAAO,MAAMC,CAAAA,mBAAkE,CAAGF,CAAI,EAAIA,CAAI,CAACG,KAAxF,CACP,MAAO,MAAMC,CAAAA,kBAAgE,CAAGJ,CAAI,EAAIA,CAAI,CAACK,IAAtF,CACP,MAAO,MAAMC,CAAAA,qBAAsE,CAAGN,CAAI,EACxFA,CAAI,CAACO,OADA,CAEP,MAAO,MAAMC,CAAAA,yBAA8E,CAAGR,CAAI,EAChGA,CAAI,CAACS,WADA,CAGP,MAAO,SAASC,CAAAA,kBAAT,CAAkCC,CAAlC,CAAkE,CACvE,wBACKA,CADL,EAEEC,kBAAkB,CAAED,CAAK,CAACC,kBAAN,EAA4BJ,yBAFlD,CAGEK,YAAY,CAAEF,CAAK,CAACE,YAAN,EAAsBX,mBAHtC,CAIEY,YAAY,CAAEH,CAAK,CAACG,YAAN,EAAsBf,mBAJtC,CAKEgB,WAAW,CAAEJ,CAAK,CAACI,WAAN,EAAqBX,kBALpC,CAMEY,cAAc,CAAEL,CAAK,CAACK,cAAN,EAAwBV,qBAN1C,EAQD","sourcesContent":["import {\n TileMenuPropGetItemDescription,\n TileMenuPropGetItemImage,\n TileMenuPropGetItemLabel,\n TileMenuDefaultItem,\n TileMenuListProps,\n TileMenuPropGetItemHref,\n TileMenuPropGetItemOnClick,\n} from './types'\n\nexport const defaultGetItemImage: TileMenuPropGetItemImage<TileMenuDefaultItem> = item => item.image\nexport const defaultGetItemLabel: TileMenuPropGetItemLabel<TileMenuDefaultItem> = item => item.label\nexport const defaultGetItemHref: TileMenuPropGetItemHref<TileMenuDefaultItem> = item => item.href\nexport const defaultGetItemOnClick: TileMenuPropGetItemOnClick<TileMenuDefaultItem> = item =>\n item.onClick\nexport const defaultGetItemDescription: TileMenuPropGetItemDescription<TileMenuDefaultItem> = item =>\n item.description\n\nexport function withDefaultGetters<ITEM>(props: TileMenuListProps<ITEM>) {\n return {\n ...props,\n getItemDescription: props.getItemDescription || defaultGetItemDescription,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemImage: props.getItemImage || defaultGetItemImage,\n getItemHref: props.getItemHref || defaultGetItemHref,\n getItemOnClick: props.getItemOnClick || defaultGetItemOnClick,\n }\n}\n"],"file":"helpers.js"}
@@ -3,7 +3,7 @@ import { PropsWithHTMLAttributesAndRef, PropsWithHTMLAttributes } from "../__pri
3
3
  export declare const tileMenuPropView: readonly ["lines", "twoLines", "cards"];
4
4
  export declare type TileMenuPropView = typeof tileMenuPropView[number];
5
5
  export declare const tileMenuPropViewDefault: "lines";
6
- export declare type DefaultItem = {
6
+ export declare type TileMenuDefaultItem = {
7
7
  label: string;
8
8
  image?: string;
9
9
  description?: string;
@@ -34,15 +34,15 @@ declare type CommonProps<ITEM> = {
34
34
  getItemHref?: TileMenuPropGetItemHref<ITEM>;
35
35
  getItemOnClick?: TileMenuPropGetItemOnClick<ITEM>;
36
36
  };
37
- export declare type TileMenuProps<ITEM = DefaultItem> = PropsWithHTMLAttributesAndRef<CommonProps<ITEM> & {
37
+ export declare type TileMenuProps<ITEM = TileMenuDefaultItem> = PropsWithHTMLAttributesAndRef<CommonProps<ITEM> & {
38
38
  listClassName?: string;
39
39
  title?: string;
40
40
  }, HTMLButtonElement> & (ITEM extends {
41
- label: DefaultItem['label'];
41
+ label: TileMenuDefaultItem['label'];
42
42
  } ? {} : {
43
43
  getItemLabel: TileMenuPropGetItemLabel<ITEM>;
44
44
  });
45
- export declare type TileMenuListProps<ITEM = DefaultItem> = PropsWithHTMLAttributes<CommonProps<ITEM>, HTMLDivElement>;
46
- export declare type TileMenuListComponent = <ITEM = DefaultItem>(props: TileMenuListProps<ITEM>) => React.ReactElement | null;
47
- export declare type TileMenuComponent = <ITEM = DefaultItem>(props: TileMenuProps<ITEM>) => React.ReactElement | null;
45
+ export declare type TileMenuListProps<ITEM = TileMenuDefaultItem> = PropsWithHTMLAttributes<CommonProps<ITEM>, HTMLDivElement>;
46
+ export declare type TileMenuListComponent = <ITEM = TileMenuDefaultItem>(props: TileMenuListProps<ITEM>) => React.ReactElement | null;
47
+ export declare type TileMenuComponent = <ITEM = TileMenuDefaultItem>(props: TileMenuProps<ITEM>) => React.ReactElement | null;
48
48
  export {};
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TileMenu/types.ts"],"names":["tileMenuPropView","tileMenuPropViewDefault"],"mappings":"AAKA,MAAO,MAAMA,CAAAA,gBAAgB,CAAG,CAAC,OAAD,CAAU,UAAV,CAAsB,OAAtB,CAAzB,CAEP,MAAO,MAAMC,CAAAA,uBAAuB,CAAGD,gBAAgB,CAAC,CAAD,CAAhD","sourcesContent":["import {\n PropsWithHTMLAttributesAndRef,\n PropsWithHTMLAttributes,\n} from '@/__private__/utils/types/PropsWithHTMLAttributes'\n\nexport const tileMenuPropView = ['lines', 'twoLines', 'cards'] as const\nexport type TileMenuPropView = typeof tileMenuPropView[number]\nexport const tileMenuPropViewDefault = tileMenuPropView[0]\n\nexport type DefaultItem = {\n label: string\n image?: string\n description?: string\n href?: string\n onClick?: React.MouseEventHandler<HTMLAnchorElement>\n}\n\nexport type TileMenuPropGetItemImage<ITEM> = (item: ITEM) => string | React.FC | undefined\nexport type TileMenuPropGetItemLabel<ITEM> = (item: ITEM) => string\nexport type TileMenuPropGetItemDescription<ITEM> = (item: ITEM) => string | undefined\nexport type TileMenuPropGetItemHref<ITEM> = (item: ITEM) => string | undefined\nexport type TileMenuPropGetItemOnClick<ITEM> = (\n item: ITEM\n) => React.MouseEventHandler<HTMLAnchorElement> | undefined\nexport type TileMenuPropOnItemClick<ITEM> = (props: {\n e: React.MouseEvent<HTMLAnchorElement>\n item: ITEM\n}) => void\nexport type TileMenuOnItemClick<ITEM> = (props: {\n e: React.MouseEvent<HTMLAnchorElement>\n item: ITEM\n}) => void\n\ntype CommonProps<ITEM> = {\n view?: TileMenuPropView\n items: ITEM[]\n isMobile?: boolean\n onItemClick?: TileMenuOnItemClick<ITEM>\n getItemImage?: TileMenuPropGetItemImage<ITEM>\n getItemLabel?: TileMenuPropGetItemLabel<ITEM>\n getItemDescription?: TileMenuPropGetItemDescription<ITEM>\n getItemHref?: TileMenuPropGetItemHref<ITEM>\n getItemOnClick?: TileMenuPropGetItemOnClick<ITEM>\n}\n\nexport type TileMenuProps<ITEM = DefaultItem> = PropsWithHTMLAttributesAndRef<\n CommonProps<ITEM> & { listClassName?: string; title?: string },\n HTMLButtonElement\n> &\n (ITEM extends { label: DefaultItem['label'] }\n ? {}\n : { getItemLabel: TileMenuPropGetItemLabel<ITEM> })\n\nexport type TileMenuListProps<ITEM = DefaultItem> = PropsWithHTMLAttributes<\n CommonProps<ITEM>,\n HTMLDivElement\n>\n\nexport type TileMenuListComponent = <ITEM = DefaultItem>(\n props: TileMenuListProps<ITEM>\n) => React.ReactElement | null\n\nexport type TileMenuComponent = <ITEM = DefaultItem>(\n props: TileMenuProps<ITEM>\n) => React.ReactElement | null\n"],"file":"types.js"}
1
+ {"version":3,"sources":["../../src/TileMenu/types.ts"],"names":["tileMenuPropView","tileMenuPropViewDefault"],"mappings":"AAKA,MAAO,MAAMA,CAAAA,gBAAgB,CAAG,CAAC,OAAD,CAAU,UAAV,CAAsB,OAAtB,CAAzB,CAEP,MAAO,MAAMC,CAAAA,uBAAuB,CAAGD,gBAAgB,CAAC,CAAD,CAAhD","sourcesContent":["import {\n PropsWithHTMLAttributesAndRef,\n PropsWithHTMLAttributes,\n} from '@/__private__/utils/types/PropsWithHTMLAttributes'\n\nexport const tileMenuPropView = ['lines', 'twoLines', 'cards'] as const\nexport type TileMenuPropView = typeof tileMenuPropView[number]\nexport const tileMenuPropViewDefault = tileMenuPropView[0]\n\nexport type TileMenuDefaultItem = {\n label: string\n image?: string\n description?: string\n href?: string\n onClick?: React.MouseEventHandler<HTMLAnchorElement>\n}\n\nexport type TileMenuPropGetItemImage<ITEM> = (item: ITEM) => string | React.FC | undefined\nexport type TileMenuPropGetItemLabel<ITEM> = (item: ITEM) => string\nexport type TileMenuPropGetItemDescription<ITEM> = (item: ITEM) => string | undefined\nexport type TileMenuPropGetItemHref<ITEM> = (item: ITEM) => string | undefined\nexport type TileMenuPropGetItemOnClick<ITEM> = (\n item: ITEM\n) => React.MouseEventHandler<HTMLAnchorElement> | undefined\nexport type TileMenuPropOnItemClick<ITEM> = (props: {\n e: React.MouseEvent<HTMLAnchorElement>\n item: ITEM\n}) => void\nexport type TileMenuOnItemClick<ITEM> = (props: {\n e: React.MouseEvent<HTMLAnchorElement>\n item: ITEM\n}) => void\n\ntype CommonProps<ITEM> = {\n view?: TileMenuPropView\n items: ITEM[]\n isMobile?: boolean\n onItemClick?: TileMenuOnItemClick<ITEM>\n getItemImage?: TileMenuPropGetItemImage<ITEM>\n getItemLabel?: TileMenuPropGetItemLabel<ITEM>\n getItemDescription?: TileMenuPropGetItemDescription<ITEM>\n getItemHref?: TileMenuPropGetItemHref<ITEM>\n getItemOnClick?: TileMenuPropGetItemOnClick<ITEM>\n}\n\nexport type TileMenuProps<ITEM = TileMenuDefaultItem> = PropsWithHTMLAttributesAndRef<\n CommonProps<ITEM> & { listClassName?: string; title?: string },\n HTMLButtonElement\n> &\n (ITEM extends { label: TileMenuDefaultItem['label'] }\n ? {}\n : { getItemLabel: TileMenuPropGetItemLabel<ITEM> })\n\nexport type TileMenuListProps<ITEM = TileMenuDefaultItem> = PropsWithHTMLAttributes<\n CommonProps<ITEM>,\n HTMLDivElement\n>\n\nexport type TileMenuListComponent = <ITEM = TileMenuDefaultItem>(\n props: TileMenuListProps<ITEM>\n) => React.ReactElement | null\n\nexport type TileMenuComponent = <ITEM = TileMenuDefaultItem>(\n props: TileMenuProps<ITEM>\n) => React.ReactElement | null\n"],"file":"types.js"}