@doist/reactist 26.2.4 → 27.0.0

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.
Files changed (45) hide show
  1. package/dist/reactist.cjs.development.js +306 -181
  2. package/dist/reactist.cjs.development.js.map +1 -1
  3. package/dist/reactist.cjs.production.min.js +1 -1
  4. package/dist/reactist.cjs.production.min.js.map +1 -1
  5. package/es/banner/banner.js +96 -33
  6. package/es/banner/banner.js.map +1 -1
  7. package/es/banner/banner.module.css.js +1 -1
  8. package/es/icons/banner-icon.js +115 -0
  9. package/es/icons/banner-icon.js.map +1 -0
  10. package/es/index.js +0 -1
  11. package/es/index.js.map +1 -1
  12. package/es/menu/menu.js +1 -1
  13. package/es/menu/menu.js.map +1 -1
  14. package/es/tabs/tabs.module.css.js +1 -1
  15. package/lib/banner/banner.d.ts +81 -22
  16. package/lib/banner/banner.js +1 -1
  17. package/lib/banner/banner.js.map +1 -1
  18. package/lib/banner/banner.module.css.js +1 -1
  19. package/lib/banner/story-promo-image.d.ts +4 -0
  20. package/lib/icons/banner-icon.d.ts +6 -0
  21. package/lib/icons/banner-icon.js +2 -0
  22. package/lib/icons/banner-icon.js.map +1 -0
  23. package/lib/index.d.ts +0 -1
  24. package/lib/index.js +1 -1
  25. package/lib/menu/menu.js +1 -1
  26. package/lib/menu/menu.js.map +1 -1
  27. package/lib/tabs/tabs.module.css.js +1 -1
  28. package/package.json +1 -1
  29. package/styles/banner.css +5 -2
  30. package/styles/banner.module.css.css +1 -1
  31. package/styles/reactist.css +2 -3
  32. package/styles/tabs.css +1 -1
  33. package/styles/tabs.module.css.css +1 -1
  34. package/es/alert/alert.js +0 -53
  35. package/es/alert/alert.js.map +0 -1
  36. package/es/alert/alert.module.css.js +0 -4
  37. package/es/alert/alert.module.css.js.map +0 -1
  38. package/lib/alert/alert.d.ts +0 -17
  39. package/lib/alert/alert.js +0 -2
  40. package/lib/alert/alert.js.map +0 -1
  41. package/lib/alert/alert.module.css.js +0 -2
  42. package/lib/alert/alert.module.css.js.map +0 -1
  43. package/lib/alert/index.d.ts +0 -1
  44. package/styles/alert.css +0 -10
  45. package/styles/alert.module.css.css +0 -1
@@ -1,61 +1,124 @@
1
1
  import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import * as React from 'react';
3
3
  import { Box } from '../box/box.js';
4
- import { Columns, Column } from '../columns/columns.js';
5
4
  import { useId } from '../utils/common-helpers.js';
6
5
  import modules_afa80466 from './banner.module.css.js';
6
+ import { Button, IconButton } from '../button/button.js';
7
+ import { CloseIcon } from '../icons/close-icon.js';
8
+ import { BannerIcon } from '../icons/banner-icon.js';
9
+ import { TextLink } from '../text-link/text-link.js';
7
10
 
8
- const _excluded = ["id", "tone", "icon", "title", "description", "action"];
11
+ const _excluded = ["id", "type", "title", "description", "action", "icon", "image", "inlineLinks", "closeLabel", "onClose"],
12
+ _excluded2 = ["label"],
13
+ _excluded3 = ["type", "label"],
14
+ _excluded4 = ["type", "label", "variant"];
9
15
  const Banner = /*#__PURE__*/React.forwardRef(function Banner(_ref, ref) {
10
16
  let {
11
17
  id,
12
- tone,
13
- icon,
18
+ type,
14
19
  title,
15
20
  description,
16
- action
21
+ action,
22
+ icon,
23
+ image,
24
+ inlineLinks,
25
+ closeLabel,
26
+ onClose
17
27
  } = _ref,
18
28
  props = _objectWithoutProperties(_ref, _excluded);
19
29
 
20
30
  const titleId = useId();
21
31
  const descriptionId = useId();
32
+ const closeButton = onClose ? /*#__PURE__*/React.createElement(IconButton, {
33
+ exceptionallySetClassName: modules_afa80466.closeButton,
34
+ variant: "quaternary",
35
+ onClick: onClose,
36
+ icon: /*#__PURE__*/React.createElement(CloseIcon, null),
37
+ "aria-label": closeLabel != null ? closeLabel : 'Close banner'
38
+ }) : null;
22
39
  return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
23
40
  ref: ref,
24
41
  id: id,
42
+ display: "flex",
43
+ flexDirection: "column",
44
+ justifyContent: "center",
25
45
  role: "status",
26
- "aria-labelledby": titleId,
27
- "aria-describedby": descriptionId,
46
+ "aria-labelledby": title ? titleId : descriptionId,
47
+ "aria-describedby": title ? descriptionId : undefined,
28
48
  "aria-live": "polite",
29
49
  tabIndex: 0,
30
- borderRadius: "standard",
31
- className: [modules_afa80466.banner, modules_afa80466["banner-" + tone]]
32
- }), /*#__PURE__*/React.createElement(Columns, {
33
- space: "medium",
34
- alignY: "center"
35
- }, /*#__PURE__*/React.createElement(Column, {
36
- width: "content",
37
- "aria-hidden": true,
38
- style: {
39
- /* Make sure the icon is centered vertically */
40
- lineHeight: 0
41
- }
42
- }, icon), /*#__PURE__*/React.createElement(Column, null, /*#__PURE__*/React.createElement(Box, {
43
- paddingY: "xsmall"
44
- }, description ? /*#__PURE__*/React.createElement(Box, {
45
- id: titleId,
46
- className: [modules_afa80466.title, modules_afa80466["title-" + tone]]
47
- }, title) : /*#__PURE__*/React.createElement(Box, {
50
+ borderRadius: "full",
51
+ className: modules_afa80466.banner
52
+ }), image ? /*#__PURE__*/React.createElement(Box, {
53
+ className: modules_afa80466.image
54
+ }, image) : null, /*#__PURE__*/React.createElement(Box, {
55
+ className: modules_afa80466.content,
56
+ display: "flex",
57
+ gap: "small",
58
+ alignItems: "center"
59
+ }, /*#__PURE__*/React.createElement(Box, {
60
+ className: modules_afa80466.staticContent,
61
+ display: "flex",
62
+ gap: "small",
63
+ flexGrow: 1
64
+ }, /*#__PURE__*/React.createElement(Box, {
65
+ className: modules_afa80466.icon
66
+ }, type === 'neutral' ? icon : /*#__PURE__*/React.createElement(BannerIcon, {
67
+ type: type
68
+ }), closeButton), /*#__PURE__*/React.createElement(Box, {
69
+ className: modules_afa80466.copy,
70
+ display: "flex",
71
+ flexDirection: "column"
72
+ }, title ? /*#__PURE__*/React.createElement(Box, {
48
73
  id: titleId,
49
- className: [modules_afa80466.title, // If the banner does not have a description, we need to slightly tweak
50
- // the styling of the title applying an extra css class
51
- modules_afa80466["title-without-description"], modules_afa80466["title-" + tone]]
52
- }, title), description ? /*#__PURE__*/React.createElement(Box, {
74
+ className: modules_afa80466.title
75
+ }, title) : null, /*#__PURE__*/React.createElement(Box, {
53
76
  id: descriptionId,
54
- className: [modules_afa80466.description, modules_afa80466["description-" + tone]]
55
- }, description) : null)), action ? /*#__PURE__*/React.createElement(Column, {
56
- width: "content"
57
- }, action) : null));
77
+ className: [modules_afa80466.description, title ? modules_afa80466.secondary : null]
78
+ }, description, inlineLinks == null ? void 0 : inlineLinks.map((_ref2, index) => {
79
+ let {
80
+ label
81
+ } = _ref2,
82
+ props = _objectWithoutProperties(_ref2, _excluded2);
83
+
84
+ return /*#__PURE__*/React.createElement(React.Fragment, {
85
+ key: index
86
+ }, /*#__PURE__*/React.createElement(TextLink, _objectSpread2(_objectSpread2({}, props), {}, {
87
+ exceptionallySetClassName: modules_afa80466.inlineLink
88
+ }), label), index < inlineLinks.length - 1 ? /*#__PURE__*/React.createElement("span", null, " \u00B7 ") : '');
89
+ })))), action || closeButton ? /*#__PURE__*/React.createElement(Box, {
90
+ className: modules_afa80466.actions,
91
+ display: "flex",
92
+ gap: "small"
93
+ }, (action == null ? void 0 : action.type) === 'button' ? /*#__PURE__*/React.createElement(ActionButton, _objectSpread2({}, action)) : null, (action == null ? void 0 : action.type) === 'link' ? /*#__PURE__*/React.createElement(ActionLink, _objectSpread2({}, action)) : null, closeButton) : null));
58
94
  });
59
95
 
96
+ function ActionButton(_ref3) {
97
+ let {
98
+ type,
99
+ label
100
+ } = _ref3,
101
+ props = _objectWithoutProperties(_ref3, _excluded3);
102
+
103
+ return /*#__PURE__*/React.createElement(Button, _objectSpread2({}, props), label);
104
+ }
105
+
106
+ function ActionLink(_ref4) {
107
+ let {
108
+ type,
109
+ label,
110
+ variant
111
+ } = _ref4,
112
+ props = _objectWithoutProperties(_ref4, _excluded4);
113
+
114
+ return /*#__PURE__*/React.createElement(Button, {
115
+ variant: variant,
116
+ render: /*#__PURE__*/React.createElement("a", _objectSpread2({
117
+ rel: "noopener noreferrer",
118
+ target: "_blank"
119
+ }, props))
120
+ }, label);
121
+ }
122
+
60
123
  export { Banner };
61
124
  //# sourceMappingURL=banner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"banner.js","sources":["../../src/banner/banner.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box } from '../box'\nimport { Columns, Column } from '../columns'\nimport { useId } from '../utils/common-helpers'\n\nimport styles from './banner.module.css'\n\nexport type BannerTone = 'info' | 'promotion'\n\ntype BannerProps = {\n id?: string\n\n /**\n * The tone of the Banner. Affects the background color and the outline.\n */\n tone: BannerTone\n\n /**\n * The icon that should be added inside the Banner.\n */\n icon: React.ReactElement | string | number\n\n /**\n * The title to be displayed at the top of the Banner.\n */\n title: React.ReactNode\n\n /**\n * An optional description to be displayed inside the Banner.\n */\n description?: React.ReactNode\n\n /**\n * An optional action to displayed inside the Banner.\n */\n action?: React.ReactElement | string | number\n}\n\nconst Banner = React.forwardRef<HTMLDivElement, BannerProps>(function Banner(\n { id, tone, icon, title, description, action, ...props }: BannerProps,\n ref,\n) {\n const titleId = useId()\n const descriptionId = useId()\n return (\n <Box\n {...props}\n ref={ref}\n id={id}\n role=\"status\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n aria-live=\"polite\"\n tabIndex={0}\n borderRadius=\"standard\"\n className={[styles.banner, styles[`banner-${tone}`]]}\n >\n <Columns space=\"medium\" alignY=\"center\">\n <Column\n width=\"content\"\n aria-hidden\n style={{\n /* Make sure the icon is centered vertically */\n lineHeight: 0,\n }}\n >\n {icon}\n </Column>\n <Column>\n <Box paddingY=\"xsmall\">\n {description ? (\n <Box id={titleId} className={[styles.title, styles[`title-${tone}`]]}>\n {title}\n </Box>\n ) : (\n <Box\n id={titleId}\n className={[\n styles.title,\n // If the banner does not have a description, we need to slightly tweak\n // the styling of the title applying an extra css class\n styles[`title-without-description`],\n styles[`title-${tone}`],\n ]}\n >\n {title}\n </Box>\n )}\n {description ? (\n <Box\n id={descriptionId}\n className={[styles.description, styles[`description-${tone}`]]}\n >\n {description}\n </Box>\n ) : null}\n </Box>\n </Column>\n {action ? <Column width=\"content\">{action}</Column> : null}\n </Columns>\n </Box>\n )\n})\n\nexport { Banner }\nexport type { BannerProps }\n"],"names":["Banner","React","forwardRef","ref","id","tone","icon","title","description","action","props","titleId","useId","descriptionId","Box","role","tabIndex","borderRadius","className","styles","banner","createElement","Columns","space","alignY","Column","width","style","lineHeight","paddingY"],"mappings":";;;;;;;;AAsCMA,MAAAA,MAAM,gBAAGC,KAAK,CAACC,UAAN,CAA8C,SAASF,MAAT,CAEzDG,IAAAA,EAAAA,GAFyD,EAEtD;EAAA,IADH;IAAEC,EAAF;IAAMC,IAAN;IAAYC,IAAZ;IAAkBC,KAAlB;IAAyBC,WAAzB;AAAsCC,IAAAA,MAAAA;GACnC,GAAA,IAAA;AAAA,MAD8CC,KAC9C,GAAA,wBAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;EAEH,MAAMC,OAAO,GAAGC,KAAK,EAArB,CAAA;EACA,MAAMC,aAAa,GAAGD,KAAK,EAA3B,CAAA;AACA,EAAA,oBACIX,mBAAA,CAACa,GAAD,oCACQJ,KADR,CAAA,EAAA,EAAA,EAAA;AAEIP,IAAAA,GAAG,EAAEA,GAFT;AAGIC,IAAAA,EAAE,EAAEA,EAHR;AAIIW,IAAAA,IAAI,EAAC,QAJT;AAKqB,IAAA,iBAAA,EAAAJ,OALrB;wBAMsBE,aANtB;AAMmC,IAAA,WAAA,EACrB,QAPd;AAQIG,IAAAA,QAAQ,EAAE,CARd;AASIC,IAAAA,YAAY,EAAC,UATjB;IAUIC,SAAS,EAAE,CAACC,gBAAM,CAACC,MAAR,EAAgBD,gBAAM,CAAWd,SAAAA,GAAAA,IAAX,CAAtB,CAAA;AAVf,GAAA,CAAA,eAYIJ,KAAC,CAAAoB,aAAD,CAACC,OAAD;AAASC,IAAAA,KAAK,EAA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AA;AA0DH,CAhEc;;;;"}
1
+ {"version":3,"file":"banner.js","sources":["../../src/banner/banner.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box } from '../box'\nimport { useId } from '../utils/common-helpers'\n\nimport styles from './banner.module.css'\nimport { Button, ButtonProps, IconButton } from '../button'\nimport { CloseIcon } from '../icons/close-icon'\nimport { BannerIcon } from '../icons/banner-icon'\nimport { TextLink } from '../text-link'\n\n/**\n * Represents the type of a banner.\n * 'neutral' accepts a custom icon, the rest do not.\n * @default 'neutral'\n */\nexport type BannerType = 'neutral' | SystemBannerType\n\n/**\n * Predefined system types for banners.\n * Each type has its own preset icon.\n */\nexport type SystemBannerType = 'info' | 'upgrade' | 'experiment' | 'warning' | 'error' | 'success'\n\ntype BaseAction = {\n variant: 'primary' | 'tertiary'\n label: string\n} & Pick<ButtonProps, 'loading' | 'disabled'>\ntype ActionButton = BaseAction & { type: 'button' } & Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'className'\n >\ntype ActionLink = BaseAction & { type: 'link' } & Omit<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n 'className'\n >\n/**\n * Represents an action that can be taken from the banner.\n * Can be either a button or a link, sharing common properties from BaseAction.\n */\ntype Action = ActionButton | ActionLink\n\n/**\n * Configuration for inline links within the banner description.\n * Extends TextLink component props with a required label.\n */\ntype InlineLink = { label: string } & React.ComponentProps<typeof TextLink>\n\ntype WithCloseButton = {\n closeLabel?: string\n onClose: () => void\n}\ntype WithoutCloseButton = {\n closeLabel?: never\n onClose?: never\n}\n/**\n * Controls the close button behavior.\n * If none is provided, the banner will not have a close button.\n */\ntype CloseButton = WithCloseButton | WithoutCloseButton\n\ntype BaseBanner = {\n id?: string\n title?: React.ReactNode\n description: Exclude<React.ReactNode, null | undefined | boolean>\n action?: Action\n inlineLinks?: InlineLink[]\n} & CloseButton\n\n/**\n * Configuration for neutral banners.\n * Can include either an image, an icon, or neither, but never both.\n */\ntype NeutralBanner = BaseBanner & {\n type: Extract<BannerType, 'neutral'>\n} & (\n | { image: React.ReactElement; icon?: never }\n | { icon: React.ReactElement; image?: never }\n | { image?: never; icon?: never }\n )\n\n/**\n * Configuration for system banners.\n * Cannot include custom images or icons as they use preset ones.\n */\ntype SystemBanner = BaseBanner & {\n type: SystemBannerType\n image?: never\n icon?: never\n}\n\ntype BannerProps = NeutralBanner | SystemBanner\n\nconst Banner = React.forwardRef<HTMLDivElement, BannerProps>(function Banner(\n {\n id,\n type,\n title,\n description,\n action,\n icon,\n image,\n inlineLinks,\n closeLabel,\n onClose,\n ...props\n }: BannerProps,\n ref,\n) {\n const titleId = useId()\n const descriptionId = useId()\n\n const closeButton = onClose ? (\n <IconButton\n exceptionallySetClassName={styles.closeButton}\n variant=\"quaternary\"\n onClick={onClose}\n icon={<CloseIcon />}\n aria-label={closeLabel ?? 'Close banner'}\n />\n ) : null\n\n return (\n <Box\n {...props}\n ref={ref}\n id={id}\n display=\"flex\"\n flexDirection=\"column\"\n justifyContent=\"center\"\n role=\"status\"\n aria-labelledby={title ? titleId : descriptionId}\n aria-describedby={title ? descriptionId : undefined}\n aria-live=\"polite\"\n tabIndex={0}\n borderRadius=\"full\"\n className={styles.banner}\n >\n {image ? <Box className={styles.image}>{image}</Box> : null}\n\n <Box className={styles.content} display=\"flex\" gap=\"small\" alignItems=\"center\">\n <Box className={styles.staticContent} display=\"flex\" gap=\"small\" flexGrow={1}>\n <Box className={styles.icon}>\n {type === 'neutral' ? icon : <BannerIcon type={type} />}\n {closeButton}\n </Box>\n\n <Box className={styles.copy} display=\"flex\" flexDirection=\"column\">\n {title ? (\n <Box id={titleId} className={styles.title}>\n {title}\n </Box>\n ) : null}\n <Box\n id={descriptionId}\n className={[styles.description, title ? styles.secondary : null]}\n >\n {description}\n {inlineLinks?.map(({ label, ...props }, index) => {\n return (\n <React.Fragment key={index}>\n <TextLink\n {...props}\n exceptionallySetClassName={styles.inlineLink}\n >\n {label}\n </TextLink>\n {index < inlineLinks.length - 1 ? <span> · </span> : ''}\n </React.Fragment>\n )\n })}\n </Box>\n </Box>\n </Box>\n\n {action || closeButton ? (\n <Box className={styles.actions} display=\"flex\" gap=\"small\">\n {action?.type === 'button' ? <ActionButton {...action} /> : null}\n {action?.type === 'link' ? <ActionLink {...action} /> : null}\n {closeButton}\n </Box>\n ) : null}\n </Box>\n </Box>\n )\n})\n\nfunction ActionButton({ type, label, ...props }: ActionButton) {\n return <Button {...props}>{label}</Button>\n}\n\nfunction ActionLink({ type, label, variant, ...props }: ActionLink) {\n return (\n <Button\n variant={variant}\n render={<a rel=\"noopener noreferrer\" target=\"_blank\" {...props} />}\n >\n {label}\n </Button>\n )\n}\n\nexport { Banner }\nexport type { BannerProps }\n"],"names":["Banner","React","forwardRef","ref","id","type","title","description","action","icon","image","inlineLinks","closeLabel","onClose","props","titleId","useId","descriptionId","closeButton","createElement","IconButton","exceptionallySetClassName","styles","variant","onClick","CloseIcon","Box","display","flexDirection","justifyContent","role","undefined","tabIndex","borderRadius","className","banner","content","gap","alignItems","staticContent","flexGrow","BannerIcon","copy","secondary","map","index","label","Fragment","key","TextLink","inlineLink","length","actions","ActionButton","_objectSpread","ActionLink","Button","render","rel","target"],"mappings":";;;;;;;;;;;;;;AA6FMA,MAAAA,MAAM,gBAAGC,KAAK,CAACC,UAAN,CAA8C,SAASF,MAAT,CAczDG,IAAAA,EAAAA,GAdyD,EActD;EAAA,IAbH;IACIC,EADJ;IAEIC,IAFJ;IAGIC,KAHJ;IAIIC,WAJJ;IAKIC,MALJ;IAMIC,IANJ;IAOIC,KAPJ;IAQIC,WARJ;IASIC,UATJ;AAUIC,IAAAA,OAAAA;GAGD,GAAA,IAAA;AAAA,MAFIC,KAEJ,GAAA,wBAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;EAEH,MAAMC,OAAO,GAAGC,KAAK,EAArB,CAAA;EACA,MAAMC,aAAa,GAAGD,KAAK,EAA3B,CAAA;EAEA,MAAME,WAAW,GAAGL,OAAO,gBACvBZ,KAAA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KAAA,EAAA,UAAA,CAAA,CAAA;;EACzD,oBAAOb,mBAAA,CAACuD,MAAD,EAAY1C,cAAAA,CAAAA,EAAAA,EAAAA,KAAZ,CAAoBgC,EAAAA,KAApB,CAAP,CAAA;AACH,CAAA;;AAED,SAASS,UAAT,CAAkE,KAAA,EAAA;EAAA,IAA9C;IAAElD,IAAF;IAAQyC,KAAR;AAAevB,IAAAA,OAAAA;GAA+B,GAAA,KAAA;AAAA,MAAnBT,KAAmB,GAAA,wBAAA,CAAA,KAAA,EAAA,UAAA,CAAA,CAAA;;AAC9D,EAAA,oBACIb,KAAC,CAAAkB,aAAD,CAACqC,MAAD,EACI;AAAAjC,IAAAA,OAAO,EAAEA,OAAT;AACAkC,IAAAA,MAAM,eAAExD,KAAG,CAAAkB,aAAH,CAAG,GAAH,EAAAmC,cAAA,CAAA;AAAGI,MAAAA,GAAG,EAAC,qBAAP;AAA6BC,MAAAA,MAAM,EAAC,QAAA;AAApC,KAAA,EAAiD7C,KAAjD,CAAA,CAAA;GAFZ,EAIKgC,KAJL,CADJ,CAAA;AAQH;;;;"}
@@ -1,4 +1,4 @@
1
- var modules_afa80466 = {"banner":"c1dffd60","banner-info":"_9d552538","banner-promotion":"d797752e","title":"_8cd610da","title-without-description":"_78ea5373","title-info":"_319c73fa","title-promotion":"fc84253f","description":"af4bd758","description-info":"b95a8c07","description-promotion":"_3c33f615"};
1
+ var modules_afa80466 = {"banner":"a3c628a9","image":"b2cb529e","content":"_608df6ce","description":"_7d8d68de","title":"_05e2783a","secondary":"d5e077f5","icon":"dbf93d2e","closeButton":"_22f9ed25","copy":"_99ded674","inlineLink":"fe6dd094","staticContent":"e6ed6d9e","actions":"_51bd96a8"};
2
2
 
3
3
  export { modules_afa80466 as default };
4
4
  //# sourceMappingURL=banner.module.css.js.map
@@ -0,0 +1,115 @@
1
+ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
2
+ import * as React from 'react';
3
+
4
+ const _excluded = ["type"];
5
+ const bannerIconForType = {
6
+ info: BannerInfoIcon,
7
+ upgrade: BannerUpgradeIcon,
8
+ experiment: BannerExperimentIcon,
9
+ warning: BannerWarningIcon,
10
+ error: BannerErrorIcon,
11
+ success: BannerSuccessIcon
12
+ };
13
+
14
+ function BannerIcon(_ref) {
15
+ let {
16
+ type
17
+ } = _ref,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+
20
+ const Icon = bannerIconForType[type];
21
+ return Icon ? /*#__PURE__*/React.createElement(Icon, _objectSpread2(_objectSpread2({}, props), {}, {
22
+ "data-testid": "banner-icon-" + type,
23
+ "aria-hidden": true
24
+ })) : null;
25
+ }
26
+
27
+ function BannerInfoIcon(props) {
28
+ return /*#__PURE__*/React.createElement("svg", _objectSpread2({
29
+ xmlns: "http://www.w3.org/2000/svg",
30
+ width: "24",
31
+ height: "24",
32
+ fill: "none"
33
+ }, props), /*#__PURE__*/React.createElement("path", {
34
+ fill: "#316FEA",
35
+ fillRule: "evenodd",
36
+ d: "M21 12.25a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-8-3.94a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-2.75 1.94a.75.75 0 0 0 0 1.5h1.25v3.5h-1.25a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5H13V11a.752.752 0 0 0-.75-.75h-2Z",
37
+ clipRule: "evenodd"
38
+ }));
39
+ }
40
+
41
+ function BannerUpgradeIcon(props) {
42
+ return /*#__PURE__*/React.createElement("svg", _objectSpread2({
43
+ xmlns: "http://www.w3.org/2000/svg",
44
+ width: "24",
45
+ height: "24",
46
+ fill: "none"
47
+ }, props), /*#__PURE__*/React.createElement("path", {
48
+ fill: "#F48318",
49
+ fillRule: "evenodd",
50
+ d: "M13.974 4.226a2.485 2.485 0 0 0-3.948 0 2.485 2.485 0 0 1-2.304.954A2.485 2.485 0 0 0 4.93 7.972a2.485 2.485 0 0 1-.954 2.304 2.485 2.485 0 0 0 0 3.948 2.485 2.485 0 0 1 .954 2.304 2.485 2.485 0 0 0 2.792 2.792 2.485 2.485 0 0 1 2.304.954 2.485 2.485 0 0 0 3.948 0 2.485 2.485 0 0 1 2.304-.954 2.485 2.485 0 0 0 2.792-2.792 2.485 2.485 0 0 1 .954-2.304 2.485 2.485 0 0 0 0-3.948 2.485 2.485 0 0 1-.954-2.304 2.485 2.485 0 0 0-2.792-2.792 2.485 2.485 0 0 1-2.304-.954ZM11.228 7.08c-.297-.581-1.177-.345-1.144.306l.125 2.437a.605.605 0 0 1-.635.635l-2.437-.125c-.651-.033-.887.847-.306 1.144l2.172 1.11c.32.163.428.567.233.868L7.91 15.503c-.355.548.289 1.192.837.837l2.047-1.326a.605.605 0 0 1 .868.233l1.11 2.172c.297.581 1.177.345 1.144-.306l-.125-2.437a.605.605 0 0 1 .635-.635l2.437.125c.651.033.887-.847.306-1.144l-2.172-1.11a.605.605 0 0 1-.233-.868l1.326-2.047c.355-.548-.289-1.192-.837-.837l-2.047 1.326a.605.605 0 0 1-.868-.233l-1.11-2.172Z",
51
+ clipRule: "evenodd"
52
+ }), /*#__PURE__*/React.createElement("path", {
53
+ fill: "#fff",
54
+ d: "M10.084 7.387c-.033-.651.847-.887 1.144-.306l1.11 2.172c.163.32.567.428.868.233l2.047-1.326c.548-.355 1.192.289.837.837l-1.326 2.047a.605.605 0 0 0 .233.868l2.172 1.11c.581.297.345 1.177-.306 1.144l-2.437-.125a.605.605 0 0 0-.635.635l.125 2.437c.033.651-.847.887-1.144.306l-1.11-2.172a.605.605 0 0 0-.868-.233L8.747 16.34c-.548.355-1.192-.289-.837-.837l1.326-2.047a.605.605 0 0 0-.233-.868l-2.172-1.11c-.581-.297-.345-1.177.306-1.144l2.437.125a.605.605 0 0 0 .635-.635l-.125-2.437Z"
55
+ }));
56
+ }
57
+
58
+ function BannerExperimentIcon(props) {
59
+ return /*#__PURE__*/React.createElement("svg", _objectSpread2({
60
+ xmlns: "http://www.w3.org/2000/svg",
61
+ width: "24",
62
+ height: "25",
63
+ fill: "none"
64
+ }, props), /*#__PURE__*/React.createElement("path", {
65
+ fill: "#F48318",
66
+ fillRule: "evenodd",
67
+ d: "M12 3.25a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm-3 4.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1H14v4.333a2 2 0 0 0 .4 1.2l4.4 5.867a1 1 0 0 1-.8 1.6H6a1 1 0 0 1-.8-1.6l4.4-5.867a2 2 0 0 0 .4-1.2V8.25h-.5a.5.5 0 0 1-.5-.5Zm1.5-2.5a.5.5 0 1 1 0-1 .5.5 0 0 1 0 1Zm4.5 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-4 3v4.333a3 3 0 0 1-.6 1.8l-.752 1.003c.11.078.245.16.403.226.41.173.985.253 1.682-.188.808-.51 1.547-.67 2.142-.674l-.275-.367a3 3 0 0 1-.6-1.8V8.25h-2Z",
68
+ clipRule: "evenodd"
69
+ }));
70
+ }
71
+
72
+ function BannerWarningIcon(props) {
73
+ return /*#__PURE__*/React.createElement("svg", _objectSpread2({
74
+ xmlns: "http://www.w3.org/2000/svg",
75
+ width: "24",
76
+ height: "24",
77
+ fill: "none"
78
+ }, props), /*#__PURE__*/React.createElement("path", {
79
+ fill: "#EB8909",
80
+ fillRule: "evenodd",
81
+ d: "m10.272 5.212-7.018 12.03a2 2 0 0 0 1.728 3.008h14.036a2 2 0 0 0 1.727-3.008l-7.018-12.03a2 2 0 0 0-3.455 0ZM13 16.75a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-.014-7.014A.987.987 0 0 0 12 8.75h-.027l-.028.002a.987.987 0 0 0-.93 1.04l.236 4.25c.053.944 1.445.944 1.498 0l.236-4.25.001-.028v-.028Z",
82
+ clipRule: "evenodd"
83
+ }));
84
+ }
85
+
86
+ function BannerErrorIcon(props) {
87
+ return /*#__PURE__*/React.createElement("svg", _objectSpread2({
88
+ xmlns: "http://www.w3.org/2000/svg",
89
+ width: "24",
90
+ height: "24",
91
+ fill: "none"
92
+ }, props), /*#__PURE__*/React.createElement("path", {
93
+ fill: "#DC4C3E",
94
+ fillRule: "evenodd",
95
+ d: "M12.987 2.5a2.07 2.07 0 0 0-1.974 0L4.048 6.287A1.989 1.989 0 0 0 3 8.032v7.436c0 .725.401 1.393 1.048 1.745L11.013 21a2.07 2.07 0 0 0 1.974 0l6.965-3.787A1.989 1.989 0 0 0 21 15.468V8.032c0-.725-.401-1.393-1.048-1.745L12.987 2.5ZM12 7.25a.987.987 0 0 1 .986 1.014l-.001.027-.236 4.25c-.053.945-1.445.945-1.498 0l-.236-4.25a.987.987 0 0 1 .93-1.04h.028L12 7.25Zm1 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",
96
+ clipRule: "evenodd"
97
+ }));
98
+ }
99
+
100
+ function BannerSuccessIcon(props) {
101
+ return /*#__PURE__*/React.createElement("svg", _objectSpread2({
102
+ xmlns: "http://www.w3.org/2000/svg",
103
+ width: "24",
104
+ height: "24",
105
+ fill: "none"
106
+ }, props), /*#__PURE__*/React.createElement("path", {
107
+ fill: "#058527",
108
+ fillRule: "evenodd",
109
+ d: "M21 12.25a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-5.555-2.99a.75.75 0 0 1 1.06 1.06l-5.303 5.303a.748.748 0 0 1-1.061 0L7.666 13.15a.75.75 0 1 1 1.06-1.06l1.945 1.944 4.774-4.773Z",
110
+ clipRule: "evenodd"
111
+ }));
112
+ }
113
+
114
+ export { BannerIcon };
115
+ //# sourceMappingURL=banner-icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banner-icon.js","sources":["../../src/icons/banner-icon.tsx"],"sourcesContent":["import * as React from 'react'\nimport type { SystemBannerType } from '../banner/banner'\n\nconst bannerIconForType: Record<SystemBannerType, typeof BannerInfoIcon> = {\n info: BannerInfoIcon,\n upgrade: BannerUpgradeIcon,\n experiment: BannerExperimentIcon,\n warning: BannerWarningIcon,\n error: BannerErrorIcon,\n success: BannerSuccessIcon,\n}\n\nfunction BannerIcon({ type, ...props }: JSX.IntrinsicElements['svg'] & { type: SystemBannerType }) {\n const Icon = bannerIconForType[type]\n return Icon ? <Icon {...props} data-testid={`banner-icon-${type}`} aria-hidden /> : null\n}\n\nfunction BannerInfoIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\" {...props}>\n <path\n fill=\"#316FEA\"\n fillRule=\"evenodd\"\n d=\"M21 12.25a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-8-3.94a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-2.75 1.94a.75.75 0 0 0 0 1.5h1.25v3.5h-1.25a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5H13V11a.752.752 0 0 0-.75-.75h-2Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n\nfunction BannerUpgradeIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\" {...props}>\n <path\n fill=\"#F48318\"\n fillRule=\"evenodd\"\n d=\"M13.974 4.226a2.485 2.485 0 0 0-3.948 0 2.485 2.485 0 0 1-2.304.954A2.485 2.485 0 0 0 4.93 7.972a2.485 2.485 0 0 1-.954 2.304 2.485 2.485 0 0 0 0 3.948 2.485 2.485 0 0 1 .954 2.304 2.485 2.485 0 0 0 2.792 2.792 2.485 2.485 0 0 1 2.304.954 2.485 2.485 0 0 0 3.948 0 2.485 2.485 0 0 1 2.304-.954 2.485 2.485 0 0 0 2.792-2.792 2.485 2.485 0 0 1 .954-2.304 2.485 2.485 0 0 0 0-3.948 2.485 2.485 0 0 1-.954-2.304 2.485 2.485 0 0 0-2.792-2.792 2.485 2.485 0 0 1-2.304-.954ZM11.228 7.08c-.297-.581-1.177-.345-1.144.306l.125 2.437a.605.605 0 0 1-.635.635l-2.437-.125c-.651-.033-.887.847-.306 1.144l2.172 1.11c.32.163.428.567.233.868L7.91 15.503c-.355.548.289 1.192.837.837l2.047-1.326a.605.605 0 0 1 .868.233l1.11 2.172c.297.581 1.177.345 1.144-.306l-.125-2.437a.605.605 0 0 1 .635-.635l2.437.125c.651.033.887-.847.306-1.144l-2.172-1.11a.605.605 0 0 1-.233-.868l1.326-2.047c.355-.548-.289-1.192-.837-.837l-2.047 1.326a.605.605 0 0 1-.868-.233l-1.11-2.172Z\"\n clipRule=\"evenodd\"\n />\n <path\n fill=\"#fff\"\n d=\"M10.084 7.387c-.033-.651.847-.887 1.144-.306l1.11 2.172c.163.32.567.428.868.233l2.047-1.326c.548-.355 1.192.289.837.837l-1.326 2.047a.605.605 0 0 0 .233.868l2.172 1.11c.581.297.345 1.177-.306 1.144l-2.437-.125a.605.605 0 0 0-.635.635l.125 2.437c.033.651-.847.887-1.144.306l-1.11-2.172a.605.605 0 0 0-.868-.233L8.747 16.34c-.548.355-1.192-.289-.837-.837l1.326-2.047a.605.605 0 0 0-.233-.868l-2.172-1.11c-.581-.297-.345-1.177.306-1.144l2.437.125a.605.605 0 0 0 .635-.635l-.125-2.437Z\"\n />\n </svg>\n )\n}\n\nfunction BannerExperimentIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"25\" fill=\"none\" {...props}>\n <path\n fill=\"#F48318\"\n fillRule=\"evenodd\"\n d=\"M12 3.25a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm-3 4.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1H14v4.333a2 2 0 0 0 .4 1.2l4.4 5.867a1 1 0 0 1-.8 1.6H6a1 1 0 0 1-.8-1.6l4.4-5.867a2 2 0 0 0 .4-1.2V8.25h-.5a.5.5 0 0 1-.5-.5Zm1.5-2.5a.5.5 0 1 1 0-1 .5.5 0 0 1 0 1Zm4.5 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-4 3v4.333a3 3 0 0 1-.6 1.8l-.752 1.003c.11.078.245.16.403.226.41.173.985.253 1.682-.188.808-.51 1.547-.67 2.142-.674l-.275-.367a3 3 0 0 1-.6-1.8V8.25h-2Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n\nfunction BannerWarningIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\" {...props}>\n <path\n fill=\"#EB8909\"\n fillRule=\"evenodd\"\n d=\"m10.272 5.212-7.018 12.03a2 2 0 0 0 1.728 3.008h14.036a2 2 0 0 0 1.727-3.008l-7.018-12.03a2 2 0 0 0-3.455 0ZM13 16.75a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-.014-7.014A.987.987 0 0 0 12 8.75h-.027l-.028.002a.987.987 0 0 0-.93 1.04l.236 4.25c.053.944 1.445.944 1.498 0l.236-4.25.001-.028v-.028Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n\nfunction BannerErrorIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\" {...props}>\n <path\n fill=\"#DC4C3E\"\n fillRule=\"evenodd\"\n d=\"M12.987 2.5a2.07 2.07 0 0 0-1.974 0L4.048 6.287A1.989 1.989 0 0 0 3 8.032v7.436c0 .725.401 1.393 1.048 1.745L11.013 21a2.07 2.07 0 0 0 1.974 0l6.965-3.787A1.989 1.989 0 0 0 21 15.468V8.032c0-.725-.401-1.393-1.048-1.745L12.987 2.5ZM12 7.25a.987.987 0 0 1 .986 1.014l-.001.027-.236 4.25c-.053.945-1.445.945-1.498 0l-.236-4.25a.987.987 0 0 1 .93-1.04h.028L12 7.25Zm1 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n\nfunction BannerSuccessIcon(props: JSX.IntrinsicElements['svg']) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\" {...props}>\n <path\n fill=\"#058527\"\n fillRule=\"evenodd\"\n d=\"M21 12.25a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-5.555-2.99a.75.75 0 0 1 1.06 1.06l-5.303 5.303a.748.748 0 0 1-1.061 0L7.666 13.15a.75.75 0 1 1 1.06-1.06l1.945 1.944 4.774-4.773Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n\nexport { BannerIcon }\n"],"names":["bannerIconForType","info","BannerInfoIcon","upgrade","BannerUpgradeIcon","experiment","BannerExperimentIcon","warning","BannerWarningIcon","error","BannerErrorIcon","success","BannerSuccessIcon","BannerIcon","type","props","Icon","React","createElement","_objectSpread","xmlns","width","height","fill","fillRule","d","clipRule"],"mappings":";;;;AAGA,MAAMA,iBAAiB,GAAoD;AACvEC,EAAAA,IAAI,EAAEC,cADiE;AAEvEC,EAAAA,OAAO,EAAEC,iBAF8D;AAGvEC,EAAAA,UAAU,EAAEC,oBAH2D;AAIvEC,EAAAA,OAAO,EAAEC,iBAJ8D;AAKvEC,EAAAA,KAAK,EAAEC,eALgE;AAMvEC,EAAAA,OAAO,EAAEC,iBAAAA;AAN8D,CAA3E,CAAA;;AASA,SAASC,UAAT,CAAiG,IAAA,EAAA;EAAA,IAA7E;AAAEC,IAAAA,IAAAA;GAA2E,GAAA,IAAA;AAAA,MAAlEC,KAAkE,GAAA,wBAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AAC7F,EAAA,MAAMC,IAAI,GAAGhB,iBAAiB,CAACc,IAAD,CAA9B,CAAA;EACA,OAAOE,IAAI,gBAAGC,KAAA,CAAAC,aAAA,CAACF,IAAD,oCAAUD,KAAV,CAAA,EAAA,EAAA,EAAA;AAA8B,IAAA,aAAA,EAAA,cAAA,GAAeD,IAA7C;IAAmD,aAAA,EAAA,IAAA;AAAnD,GAAA,CAAA,CAAH,GAAyE,IAApF,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,MAAA,EAAA;AACIK,IAAAA,IAAI,EAAC,SADT;AAEIC,IAAAA,QAAQ,EAAC,SAFb;AAGIC,IAAAA,CAAC,EAAC,4YAHN;AAIIC,IAAAA,QAAQ,EAAC,SAAA;AAJb,GAAA,CADJ,CADJ,CAAA;AAUH,CAAA;;AAED,SAASd,iBAAT,CAA2BG,KAA3B,EAA8D;AAC1D,EAAA,oBACIE,KAAK,CAAAC,aAAL,CAAK,KAAL,EAAAC,cAAA,CAAA;AAAKC,IAAAA,KAAK,EAAC,4BAAX;AAAwCC,IAAAA,KAAK,EAAC,IAA9C;AAAmDC,IAAAA,MAAM,EAAC,IAA1D;AAA+DC,IAAAA,IAAI,EAAC,MAAA;AAApE,GAAA,EAA+ER,KAA/E,CACIE,eAAAA,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AACIK,IAAAA,IAAI,EAAC,SADT;AAEIC,IAAAA,QAAQ,EAAC,SAFb;AAGIC,IAAAA,CAAC,EAAC,6KAHN;AAIIC,IAAAA,QAAQ,EAAC,SAAA;AAJb,GAAA,CADJ,CADJ,CAAA;AAUH;;;;"}
package/es/index.js CHANGED
@@ -5,7 +5,6 @@ export { Inline } from './inline/inline.js';
5
5
  export { Stack } from './stack/stack.js';
6
6
  export { Hidden } from './hidden/hidden.js';
7
7
  export { HiddenVisually } from './hidden-visually/hidden-visually.js';
8
- export { Alert } from './alert/alert.js';
9
8
  export { Banner } from './banner/banner.js';
10
9
  export { Loading } from './loading/loading.js';
11
10
  export { Notice } from './notice/notice.js';
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/es/menu/menu.js CHANGED
@@ -138,7 +138,7 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(_ref4, ref) {
138
138
  className: classNames('reactist_menulist', exceptionallySetClassName),
139
139
  getAnchorRect: getAnchorRect != null ? getAnchorRect : undefined,
140
140
  modal: modal,
141
- flip: flip != null ? flip : isSubMenu ? 'bottom' : undefined
141
+ flip: flip != null ? flip : isSubMenu ? 'left bottom' : undefined
142
142
  }))) : null;
143
143
  });
144
144
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sources":["../../src/menu/menu.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\n\nimport {\n Portal,\n MenuStore,\n MenuStoreProps,\n useMenuStore,\n MenuProps as AriakitMenuProps,\n Menu as AriakitMenu,\n MenuGroup as AriakitMenuGroup,\n MenuItem as AriakitMenuItem,\n MenuItemProps as AriakitMenuItemProps,\n MenuButton as AriakitMenuButton,\n MenuButtonProps as AriakitMenuButtonProps,\n Role,\n RoleProps,\n} from '@ariakit/react'\n\nimport './menu.less'\nimport type { ObfuscatedClassName } from '../utils/common-types'\n\ntype MenuContextState = {\n menuStore: MenuStore | null\n handleItemSelect?: (value: string | null | undefined) => void\n getAnchorRect: (() => { x: number; y: number }) | null\n setAnchorRect: (rect: { x: number; y: number } | null) => void\n}\n\nconst MenuContext = React.createContext<MenuContextState>({\n menuStore: null,\n handleItemSelect: () => undefined,\n getAnchorRect: null,\n setAnchorRect: () => undefined,\n})\n\nconst SubMenuContext = React.createContext<{ isSubMenu: boolean }>({ isSubMenu: false })\n\n//\n// Menu\n//\n\ninterface MenuProps extends Omit<MenuStoreProps, 'visible'> {\n /**\n * The `Menu` must contain a `MenuList` that defines the menu options. It must also contain a\n * `MenuButton` that triggers the menu to be opened or closed.\n */\n children: React.ReactNode\n\n /**\n * An optional callback that will be called back whenever a menu item is selected. It receives\n * the `value` of the selected `MenuItem`.\n *\n * If you pass down this callback, it is recommended that you properly memoize it so it does not\n * change on every render.\n */\n onItemSelect?: (value: string | null | undefined) => void\n}\n\n/**\n * Wrapper component to control a menu. It does not render anything, only providing the state\n * management for the menu components inside it.\n */\nfunction Menu({ children, onItemSelect, ...props }: MenuProps) {\n const [anchorRect, setAnchorRect] = React.useState<{ x: number; y: number } | null>(null)\n const getAnchorRect = React.useMemo(() => (anchorRect ? () => anchorRect : null), [anchorRect])\n const menuStore = useMenuStore({ focusLoop: true, ...props })\n\n const value: MenuContextState = React.useMemo(\n () => ({ menuStore, handleItemSelect: onItemSelect, getAnchorRect, setAnchorRect }),\n [menuStore, onItemSelect, getAnchorRect, setAnchorRect],\n )\n\n return <MenuContext.Provider value={value}>{children}</MenuContext.Provider>\n}\n\n//\n// MenuButton\n//\n\ninterface MenuButtonProps\n extends Omit<AriakitMenuButtonProps, 'store' | 'className' | 'as'>,\n ObfuscatedClassName {}\n\n/**\n * A button to toggle a dropdown menu open or closed.\n */\nconst MenuButton = React.forwardRef<HTMLButtonElement, MenuButtonProps>(function MenuButton(\n { exceptionallySetClassName, ...props },\n ref,\n) {\n const { menuStore } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('MenuButton must be wrapped in <Menu/>')\n }\n return (\n <AriakitMenuButton\n {...props}\n store={menuStore}\n ref={ref}\n className={classNames('reactist_menubutton', exceptionallySetClassName)}\n />\n )\n})\n\n//\n// ContextMenuTrigger\n//\n\ninterface ContextMenuTriggerProps\n extends ObfuscatedClassName,\n React.HTMLAttributes<HTMLDivElement>,\n Pick<RoleProps, 'render'> {}\n\nconst ContextMenuTrigger = React.forwardRef<HTMLDivElement, ContextMenuTriggerProps>(\n function ContextMenuTrigger({ render, ...props }, ref) {\n const { setAnchorRect, menuStore } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('ContextMenuTrigger must be wrapped in <Menu/>')\n }\n\n const handleContextMenu = React.useCallback(\n function handleContextMenu(event: React.MouseEvent) {\n event.preventDefault()\n setAnchorRect({ x: event.clientX, y: event.clientY })\n menuStore.show()\n },\n [setAnchorRect, menuStore],\n )\n\n const isOpen = menuStore.useState('open')\n React.useEffect(() => {\n if (!isOpen) setAnchorRect(null)\n }, [isOpen, setAnchorRect])\n\n return <Role.div {...props} onContextMenu={handleContextMenu} ref={ref} render={render} />\n },\n)\n\n//\n// MenuList\n//\n\ninterface MenuListProps\n extends Omit<AriakitMenuProps, 'store' | 'className'>,\n ObfuscatedClassName {}\n\n/**\n * The dropdown menu itself, containing a list of menu items.\n */\nconst MenuList = React.forwardRef<HTMLDivElement, MenuListProps>(function MenuList(\n { exceptionallySetClassName, modal = true, flip, ...props },\n ref,\n) {\n const { menuStore, getAnchorRect } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('MenuList must be wrapped in <Menu/>')\n }\n\n const { isSubMenu } = React.useContext(SubMenuContext)\n\n const isOpen = menuStore.useState('open')\n\n return isOpen ? (\n <Portal preserveTabOrder>\n <AriakitMenu\n {...props}\n store={menuStore}\n gutter={8}\n shift={4}\n ref={ref}\n className={classNames('reactist_menulist', exceptionallySetClassName)}\n getAnchorRect={getAnchorRect ?? undefined}\n modal={modal}\n flip={flip ?? (isSubMenu ? 'bottom' : undefined)}\n />\n </Portal>\n ) : null\n})\n\n//\n// MenuItem\n//\n\ninterface MenuItemProps extends AriakitMenuItemProps, ObfuscatedClassName {\n /**\n * An optional value given to this menu item. It is passed on to the parent `Menu`'s\n * `onItemSelect` when you provide that instead of (or alongside) providing individual\n * `onSelect` callbacks to each menu item.\n */\n value?: string\n\n /**\n * When `true` the menu item is disabled and won't be selectable or be part of the keyboard\n * navigation across the menu options.\n *\n * @default true\n */\n disabled?: boolean\n\n /**\n * When `true` the menu will close when the menu item is selected, in addition to performing the\n * action that the menu item is set out to do.\n *\n * Set this to `false` to make sure that a given menu item does not auto-closes the menu when\n * selected. This should be the exception and not the norm, as the default is to auto-close.\n *\n * @default true\n */\n hideOnSelect?: boolean\n\n /**\n * The action to perform when the menu item is selected.\n *\n * If you return `false` from this function, the menu will not auto-close when this menu item\n * is selected. Though you should use `hideOnSelect` for this purpose, this allows you to\n * achieve the same effect conditionally and dynamically deciding at run time.\n */\n onSelect?: () => unknown\n\n /**\n * The event handler called when the menu item is clicked.\n *\n * This is similar to `onSelect`, but a bit different. You can certainly use it to trigger the\n * action that the menu item represents. But in general you should prefer `onSelect` for that.\n *\n * The main use for this handler is to get access to the click event. This can be used, for\n * example, to call `event.preventDefault()`, which will effectively prevent the rest of the\n * consequences of the click, including preventing `onSelect` from being called. In particular,\n * this is useful in menu items that are links, and you want the click to not trigger navigation\n * under some circumstances.\n */\n onClick?: (event: React.MouseEvent) => void\n}\n\n/**\n * A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`\n * callback.\n */\nconst MenuItem = React.forwardRef<HTMLDivElement, MenuItemProps>(function MenuItem(\n {\n value,\n children,\n onSelect,\n hideOnSelect = true,\n onClick,\n exceptionallySetClassName,\n ...props\n },\n ref,\n) {\n const { handleItemSelect, menuStore } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('MenuItem must be wrapped in <Menu/>')\n }\n\n const { hide } = menuStore\n const handleClick = React.useCallback(\n function handleClick(event: React.MouseEvent) {\n onClick?.(event)\n const onSelectResult: unknown =\n onSelect && !event.defaultPrevented ? onSelect() : undefined\n const shouldClose = onSelectResult !== false && hideOnSelect\n handleItemSelect?.(value)\n if (shouldClose) hide()\n },\n [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value],\n )\n\n return (\n <AriakitMenuItem\n {...props}\n store={menuStore}\n ref={ref}\n onClick={handleClick}\n className={exceptionallySetClassName}\n hideOnClick={false}\n >\n {children}\n </AriakitMenuItem>\n )\n})\n\n//\n// SubMenu\n//\n\ntype SubMenuProps = Pick<MenuProps, 'children' | 'onItemSelect'>\n\n/**\n * This component can be rendered alongside other `MenuItem` inside a `MenuList` in order to have\n * a sub-menu.\n *\n * Its children are expected to have the structure of a first level menu (a `MenuButton` and a\n * `MenuList`).\n *\n * ```jsx\n * <MenuItem label=\"Edit profile\" />\n * <SubMenu>\n * <MenuButton>More options</MenuButton>\n * <MenuList>\n * <MenuItem label=\"Preferences\" />\n * <MenuItem label=\"Sign out\" />\n * </MenuList>\n * </SubMenu>\n * ```\n *\n * The `MenuButton` will become a menu item in the current menu items list, and it will lead to\n * opening a sub-menu with the menu items list below it.\n */\nconst SubMenu = React.forwardRef<HTMLDivElement, SubMenuProps>(function SubMenu(\n { children, onItemSelect },\n ref,\n) {\n const { handleItemSelect: parentMenuItemSelect, menuStore } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('SubMenu must be wrapped in <Menu/>')\n }\n\n const { hide: parentMenuHide } = menuStore\n const handleSubItemSelect = React.useCallback(\n function handleSubItemSelect(value: string | null | undefined) {\n onItemSelect?.(value)\n parentMenuItemSelect?.(value)\n parentMenuHide()\n },\n [parentMenuHide, parentMenuItemSelect, onItemSelect],\n )\n\n const [button, list] = React.Children.toArray(children)\n const buttonElement = button as React.ReactElement<MenuButtonProps>\n const subMenuContextValue = React.useMemo(() => ({ isSubMenu: true }), [])\n\n return (\n <Menu onItemSelect={handleSubItemSelect}>\n <AriakitMenuItem store={menuStore} ref={ref} hideOnClick={false} render={buttonElement}>\n {buttonElement.props.children}\n </AriakitMenuItem>\n <SubMenuContext.Provider value={subMenuContextValue}>{list}</SubMenuContext.Provider>\n </Menu>\n )\n})\n\n//\n// MenuGroup\n//\n\ninterface MenuGroupProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'className'>,\n ObfuscatedClassName {\n /**\n * A label to be shown visually and also used to semantically label the group.\n */\n label: string\n}\n\n/**\n * A way to semantically group some menu items.\n *\n * This group does not add any visual separator. You can do that yourself adding `<hr />` elements\n * before and/or after the group if you so wish.\n */\nconst MenuGroup = React.forwardRef<HTMLDivElement, MenuGroupProps>(function MenuGroup(\n { label, children, exceptionallySetClassName, ...props },\n ref,\n) {\n const { menuStore } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('MenuGroup must be wrapped in <Menu/>')\n }\n\n return (\n <AriakitMenuGroup\n {...props}\n ref={ref}\n store={menuStore}\n className={exceptionallySetClassName}\n >\n {label ? (\n <div role=\"presentation\" className=\"reactist_menugroup__label\">\n {label}\n </div>\n ) : null}\n {children}\n </AriakitMenuGroup>\n )\n})\n\nexport { ContextMenuTrigger, Menu, MenuButton, MenuList, MenuItem, SubMenu, MenuGroup }\nexport type { MenuButtonProps, MenuListProps, MenuItemProps, MenuGroupProps }\n"],"names":["MenuContext","React","createContext","menuStore","handleItemSelect","undefined","getAnchorRect","setAnchorRect","SubMenuContext","isSubMenu","Menu","children","onItemSelect","props","anchorRect","useState","useMemo","useMenuStore","_objectSpread","focusLoop","value","createElement","Provider","MenuButton","forwardRef","ref","exceptionallySetClassName","useContext","Error","AriakitMenuButton","store","className","classNames","ContextMenuTrigger","render","handleContextMenu","useCallback","event","preventDefault","x","clientX","y","clientY","show","isOpen","useEffect","Role","div","onContextMenu","MenuList","modal","flip","Portal","preserveTabOrder","AriakitMenu","gutter","shift","MenuItem","onSelect","hideOnSelect","onClick","hide","handleClick","onSelectResult","defaultPrevented","shouldClose","AriakitMenuItem","hideOnClick","SubMenu","parentMenuItemSelect","parentMenuHide","handleSubItemSelect","button","list","Children","toArray","buttonElement","subMenuContextValue","MenuGroup","label","AriakitMenuGroup","role"],"mappings":";;;;;;;;;;;AA6BA,MAAMA,WAAW,gBAAGC,KAAK,CAACC,aAAN,CAAsC;AACtDC,EAAAA,SAAS,EAAE,IAD2C;EAEtDC,gBAAgB,EAAE,MAAMC,SAF8B;AAGtDC,EAAAA,aAAa,EAAE,IAHuC;AAItDC,EAAAA,aAAa,EAAE,MAAMF,SAAAA;AAJiC,CAAtC,CAApB,CAAA;AAOA,MAAMG,cAAc,gBAAGP,KAAK,CAACC,aAAN,CAA4C;AAAEO,EAAAA,SAAS,EAAE,KAAA;AAAb,CAA5C,CAAvB,CAAA;AAuBA;;;AAGG;;AACH,SAASC,IAAT,CAA6D,IAAA,EAAA;EAAA,IAA/C;IAAEC,QAAF;AAAYC,IAAAA,YAAAA;GAAmC,GAAA,IAAA;AAAA,MAAlBC,KAAkB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IV,KAAA,CAAAoB,aAAA,CAACb,cAAc,CAACc,QAAhB,EAAwB;AAACF,IAAAA,KAAK,EAAEyD,mBAAAA;GAAhC,EAAsDJ,IAAtD,CAJJ,CADJ,CAAA;AAQH,CA/Be,EAAhB;AA8CA;;;;;AAKG;;AACGK,MAAAA,SAAS,gBAAG7E,KAAK,CAACuB,UAAN,CAAiD,SAASsD,SAAT,CAE/DrD,KAAAA,EAAAA,GAF+D,EAE5D;EAAA,IADH;IAAEsD,KAAF;IAASpE,QAAT;AAAmBe,IAAAA,yBAAAA;GAChB,GAAA,KAAA;AAAA,MAD8Cb,KAC9C,GAAA,wBAAA,CAAA,KAAA,EAAA,UAAA,CAAA,CAAA;;EAEH,MAAM;AAAEV,IAAAA,SAAAA;AAAF,GAAA,GAAgBF,KAAK,CAAC0B,UAAN,CAAiB3B,WAAjB,CAAtB,CAAA;;EACA,IAAI,CAACG,SAAL,EAAgB;AACZ,IAAA,MAAM,IAAIyB,KAAJ,CAAU,sCAAV,CAAN,CAAA;AACH,GAAA;;AAED,EAAA,oBACI3B,KAAC,CAAAoB,aAAD,CAAC2D,WAAD,oCACQnE,KADR,CAAA,EAAA,EAAA,EAAA;AAEIY,IAAAA,GAAG,EAAEA,GAFT;AAGIK,IAAAA,KAAK,EAAE3B,SAHX;AAII4B,IAAAA,SAAS,EAAEL,yBAAAA;AAJf,GAAA,CAAA,EAMKqD,KAAK,gBACF9E,KAAK,CAAAoB,aAAL,CAAK,KAAL,EAAK;AAAA4D,IAAAA,IAAI,EAAC,cAAL;AAAoBlD,IAAAA,SAAS,EAAC,2BAAA;AAA9B,GAAL,EACKgD,KADL,CADE,GAIF,IAVR,EAWKpE,QAXL,CADJ,CAAA;AAeH,CAxBiB;;;;"}
1
+ {"version":3,"file":"menu.js","sources":["../../src/menu/menu.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\n\nimport {\n Portal,\n MenuStore,\n MenuStoreProps,\n useMenuStore,\n MenuProps as AriakitMenuProps,\n Menu as AriakitMenu,\n MenuGroup as AriakitMenuGroup,\n MenuItem as AriakitMenuItem,\n MenuItemProps as AriakitMenuItemProps,\n MenuButton as AriakitMenuButton,\n MenuButtonProps as AriakitMenuButtonProps,\n Role,\n RoleProps,\n} from '@ariakit/react'\n\nimport './menu.less'\nimport type { ObfuscatedClassName } from '../utils/common-types'\n\ntype MenuContextState = {\n menuStore: MenuStore | null\n handleItemSelect?: (value: string | null | undefined) => void\n getAnchorRect: (() => { x: number; y: number }) | null\n setAnchorRect: (rect: { x: number; y: number } | null) => void\n}\n\nconst MenuContext = React.createContext<MenuContextState>({\n menuStore: null,\n handleItemSelect: () => undefined,\n getAnchorRect: null,\n setAnchorRect: () => undefined,\n})\n\nconst SubMenuContext = React.createContext<{ isSubMenu: boolean }>({ isSubMenu: false })\n\n//\n// Menu\n//\n\ninterface MenuProps extends Omit<MenuStoreProps, 'visible'> {\n /**\n * The `Menu` must contain a `MenuList` that defines the menu options. It must also contain a\n * `MenuButton` that triggers the menu to be opened or closed.\n */\n children: React.ReactNode\n\n /**\n * An optional callback that will be called back whenever a menu item is selected. It receives\n * the `value` of the selected `MenuItem`.\n *\n * If you pass down this callback, it is recommended that you properly memoize it so it does not\n * change on every render.\n */\n onItemSelect?: (value: string | null | undefined) => void\n}\n\n/**\n * Wrapper component to control a menu. It does not render anything, only providing the state\n * management for the menu components inside it.\n */\nfunction Menu({ children, onItemSelect, ...props }: MenuProps) {\n const [anchorRect, setAnchorRect] = React.useState<{ x: number; y: number } | null>(null)\n const getAnchorRect = React.useMemo(() => (anchorRect ? () => anchorRect : null), [anchorRect])\n const menuStore = useMenuStore({ focusLoop: true, ...props })\n\n const value: MenuContextState = React.useMemo(\n () => ({ menuStore, handleItemSelect: onItemSelect, getAnchorRect, setAnchorRect }),\n [menuStore, onItemSelect, getAnchorRect, setAnchorRect],\n )\n\n return <MenuContext.Provider value={value}>{children}</MenuContext.Provider>\n}\n\n//\n// MenuButton\n//\n\ninterface MenuButtonProps\n extends Omit<AriakitMenuButtonProps, 'store' | 'className' | 'as'>,\n ObfuscatedClassName {}\n\n/**\n * A button to toggle a dropdown menu open or closed.\n */\nconst MenuButton = React.forwardRef<HTMLButtonElement, MenuButtonProps>(function MenuButton(\n { exceptionallySetClassName, ...props },\n ref,\n) {\n const { menuStore } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('MenuButton must be wrapped in <Menu/>')\n }\n return (\n <AriakitMenuButton\n {...props}\n store={menuStore}\n ref={ref}\n className={classNames('reactist_menubutton', exceptionallySetClassName)}\n />\n )\n})\n\n//\n// ContextMenuTrigger\n//\n\ninterface ContextMenuTriggerProps\n extends ObfuscatedClassName,\n React.HTMLAttributes<HTMLDivElement>,\n Pick<RoleProps, 'render'> {}\n\nconst ContextMenuTrigger = React.forwardRef<HTMLDivElement, ContextMenuTriggerProps>(\n function ContextMenuTrigger({ render, ...props }, ref) {\n const { setAnchorRect, menuStore } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('ContextMenuTrigger must be wrapped in <Menu/>')\n }\n\n const handleContextMenu = React.useCallback(\n function handleContextMenu(event: React.MouseEvent) {\n event.preventDefault()\n setAnchorRect({ x: event.clientX, y: event.clientY })\n menuStore.show()\n },\n [setAnchorRect, menuStore],\n )\n\n const isOpen = menuStore.useState('open')\n React.useEffect(() => {\n if (!isOpen) setAnchorRect(null)\n }, [isOpen, setAnchorRect])\n\n return <Role.div {...props} onContextMenu={handleContextMenu} ref={ref} render={render} />\n },\n)\n\n//\n// MenuList\n//\n\ninterface MenuListProps\n extends Omit<AriakitMenuProps, 'store' | 'className'>,\n ObfuscatedClassName {}\n\n/**\n * The dropdown menu itself, containing a list of menu items.\n */\nconst MenuList = React.forwardRef<HTMLDivElement, MenuListProps>(function MenuList(\n { exceptionallySetClassName, modal = true, flip, ...props },\n ref,\n) {\n const { menuStore, getAnchorRect } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('MenuList must be wrapped in <Menu/>')\n }\n\n const { isSubMenu } = React.useContext(SubMenuContext)\n\n const isOpen = menuStore.useState('open')\n\n return isOpen ? (\n <Portal preserveTabOrder>\n <AriakitMenu\n {...props}\n store={menuStore}\n gutter={8}\n shift={4}\n ref={ref}\n className={classNames('reactist_menulist', exceptionallySetClassName)}\n getAnchorRect={getAnchorRect ?? undefined}\n modal={modal}\n flip={flip ?? (isSubMenu ? 'left bottom' : undefined)}\n />\n </Portal>\n ) : null\n})\n\n//\n// MenuItem\n//\n\ninterface MenuItemProps extends AriakitMenuItemProps, ObfuscatedClassName {\n /**\n * An optional value given to this menu item. It is passed on to the parent `Menu`'s\n * `onItemSelect` when you provide that instead of (or alongside) providing individual\n * `onSelect` callbacks to each menu item.\n */\n value?: string\n\n /**\n * When `true` the menu item is disabled and won't be selectable or be part of the keyboard\n * navigation across the menu options.\n *\n * @default true\n */\n disabled?: boolean\n\n /**\n * When `true` the menu will close when the menu item is selected, in addition to performing the\n * action that the menu item is set out to do.\n *\n * Set this to `false` to make sure that a given menu item does not auto-closes the menu when\n * selected. This should be the exception and not the norm, as the default is to auto-close.\n *\n * @default true\n */\n hideOnSelect?: boolean\n\n /**\n * The action to perform when the menu item is selected.\n *\n * If you return `false` from this function, the menu will not auto-close when this menu item\n * is selected. Though you should use `hideOnSelect` for this purpose, this allows you to\n * achieve the same effect conditionally and dynamically deciding at run time.\n */\n onSelect?: () => unknown\n\n /**\n * The event handler called when the menu item is clicked.\n *\n * This is similar to `onSelect`, but a bit different. You can certainly use it to trigger the\n * action that the menu item represents. But in general you should prefer `onSelect` for that.\n *\n * The main use for this handler is to get access to the click event. This can be used, for\n * example, to call `event.preventDefault()`, which will effectively prevent the rest of the\n * consequences of the click, including preventing `onSelect` from being called. In particular,\n * this is useful in menu items that are links, and you want the click to not trigger navigation\n * under some circumstances.\n */\n onClick?: (event: React.MouseEvent) => void\n}\n\n/**\n * A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`\n * callback.\n */\nconst MenuItem = React.forwardRef<HTMLDivElement, MenuItemProps>(function MenuItem(\n {\n value,\n children,\n onSelect,\n hideOnSelect = true,\n onClick,\n exceptionallySetClassName,\n ...props\n },\n ref,\n) {\n const { handleItemSelect, menuStore } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('MenuItem must be wrapped in <Menu/>')\n }\n\n const { hide } = menuStore\n const handleClick = React.useCallback(\n function handleClick(event: React.MouseEvent) {\n onClick?.(event)\n const onSelectResult: unknown =\n onSelect && !event.defaultPrevented ? onSelect() : undefined\n const shouldClose = onSelectResult !== false && hideOnSelect\n handleItemSelect?.(value)\n if (shouldClose) hide()\n },\n [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value],\n )\n\n return (\n <AriakitMenuItem\n {...props}\n store={menuStore}\n ref={ref}\n onClick={handleClick}\n className={exceptionallySetClassName}\n hideOnClick={false}\n >\n {children}\n </AriakitMenuItem>\n )\n})\n\n//\n// SubMenu\n//\n\ntype SubMenuProps = Pick<MenuProps, 'children' | 'onItemSelect'>\n\n/**\n * This component can be rendered alongside other `MenuItem` inside a `MenuList` in order to have\n * a sub-menu.\n *\n * Its children are expected to have the structure of a first level menu (a `MenuButton` and a\n * `MenuList`).\n *\n * ```jsx\n * <MenuItem label=\"Edit profile\" />\n * <SubMenu>\n * <MenuButton>More options</MenuButton>\n * <MenuList>\n * <MenuItem label=\"Preferences\" />\n * <MenuItem label=\"Sign out\" />\n * </MenuList>\n * </SubMenu>\n * ```\n *\n * The `MenuButton` will become a menu item in the current menu items list, and it will lead to\n * opening a sub-menu with the menu items list below it.\n */\nconst SubMenu = React.forwardRef<HTMLDivElement, SubMenuProps>(function SubMenu(\n { children, onItemSelect },\n ref,\n) {\n const { handleItemSelect: parentMenuItemSelect, menuStore } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('SubMenu must be wrapped in <Menu/>')\n }\n\n const { hide: parentMenuHide } = menuStore\n const handleSubItemSelect = React.useCallback(\n function handleSubItemSelect(value: string | null | undefined) {\n onItemSelect?.(value)\n parentMenuItemSelect?.(value)\n parentMenuHide()\n },\n [parentMenuHide, parentMenuItemSelect, onItemSelect],\n )\n\n const [button, list] = React.Children.toArray(children)\n const buttonElement = button as React.ReactElement<MenuButtonProps>\n const subMenuContextValue = React.useMemo(() => ({ isSubMenu: true }), [])\n\n return (\n <Menu onItemSelect={handleSubItemSelect}>\n <AriakitMenuItem store={menuStore} ref={ref} hideOnClick={false} render={buttonElement}>\n {buttonElement.props.children}\n </AriakitMenuItem>\n <SubMenuContext.Provider value={subMenuContextValue}>{list}</SubMenuContext.Provider>\n </Menu>\n )\n})\n\n//\n// MenuGroup\n//\n\ninterface MenuGroupProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'className'>,\n ObfuscatedClassName {\n /**\n * A label to be shown visually and also used to semantically label the group.\n */\n label: string\n}\n\n/**\n * A way to semantically group some menu items.\n *\n * This group does not add any visual separator. You can do that yourself adding `<hr />` elements\n * before and/or after the group if you so wish.\n */\nconst MenuGroup = React.forwardRef<HTMLDivElement, MenuGroupProps>(function MenuGroup(\n { label, children, exceptionallySetClassName, ...props },\n ref,\n) {\n const { menuStore } = React.useContext(MenuContext)\n if (!menuStore) {\n throw new Error('MenuGroup must be wrapped in <Menu/>')\n }\n\n return (\n <AriakitMenuGroup\n {...props}\n ref={ref}\n store={menuStore}\n className={exceptionallySetClassName}\n >\n {label ? (\n <div role=\"presentation\" className=\"reactist_menugroup__label\">\n {label}\n </div>\n ) : null}\n {children}\n </AriakitMenuGroup>\n )\n})\n\nexport { ContextMenuTrigger, Menu, MenuButton, MenuList, MenuItem, SubMenu, MenuGroup }\nexport type { MenuButtonProps, MenuListProps, MenuItemProps, MenuGroupProps }\n"],"names":["MenuContext","React","createContext","menuStore","handleItemSelect","undefined","getAnchorRect","setAnchorRect","SubMenuContext","isSubMenu","Menu","children","onItemSelect","props","anchorRect","useState","useMemo","useMenuStore","_objectSpread","focusLoop","value","createElement","Provider","MenuButton","forwardRef","ref","exceptionallySetClassName","useContext","Error","AriakitMenuButton","store","className","classNames","ContextMenuTrigger","render","handleContextMenu","useCallback","event","preventDefault","x","clientX","y","clientY","show","isOpen","useEffect","Role","div","onContextMenu","MenuList","modal","flip","Portal","preserveTabOrder","AriakitMenu","gutter","shift","MenuItem","onSelect","hideOnSelect","onClick","hide","handleClick","onSelectResult","defaultPrevented","shouldClose","AriakitMenuItem","hideOnClick","SubMenu","parentMenuItemSelect","parentMenuHide","handleSubItemSelect","button","list","Children","toArray","buttonElement","subMenuContextValue","MenuGroup","label","AriakitMenuGroup","role"],"mappings":";;;;;;;;;;;AA6BA,MAAMA,WAAW,gBAAGC,KAAK,CAACC,aAAN,CAAsC;AACtDC,EAAAA,SAAS,EAAE,IAD2C;EAEtDC,gBAAgB,EAAE,MAAMC,SAF8B;AAGtDC,EAAAA,aAAa,EAAE,IAHuC;AAItDC,EAAAA,aAAa,EAAE,MAAMF,SAAAA;AAJiC,CAAtC,CAApB,CAAA;AAOA,MAAMG,cAAc,gBAAGP,KAAK,CAACC,aAAN,CAA4C;AAAEO,EAAAA,SAAS,EAAE,KAAA;AAAb,CAA5C,CAAvB,CAAA;AAuBA;;;AAGG;;AACH,SAASC,IAAT,CAA6D,IAAA,EAAA;EAAA,IAA/C;IAAEC,QAAF;AAAYC,IAAAA,YAAAA;GAAmC,GAAA,IAAA;AAAA,MAAlBC,KAAkB,GAAA,wBAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;EACzD,MAAM,CAACC,UAAD,EAAaP,aAAb,CAAA,GAA8BN,KAAK,CAACc,QAAN,CAAgD,IAAhD,CAApC,CAAA;AACA,EAAA,MAAMT,aAAa,GAAGL,KAAK,CAACe,OAAN,CAAc,MAAOF,UAAU,GAAG,MAAMA,UAAT,GAAsB,IAArD,EAA4D,CAACA,UAAD,CAA5D,CAAtB,CAAA;EACA,MAAMX,SAAS,GAAGc,YAAY,CAAAC,cAAA,CAAA;AAAGC,IAAAA,SAAS,EAAE,IAAA;AAAd,GAAA,EAAuBN,KAAvB,CAA9B,CAAA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,EAAA,UAAA,CAAA,CAAA;;EAEH,MAAM;AAAEV,IAAAA,SAAAA;AAAF,GAAA,GAAgBF,KAAK,CAAC0B,UAAN,CAAiB3B,WAAjB,CAAtB,CAAA;;EACA,IAAI,CAACG,SAAL,EAAgB;AACZ,IAAA,MAAM,IAAIyB,KAAJ,CAAU,sCAAV,CAAN,CAAA;AACH,GAAA;;AAED,EAAA,oBACI3B,KAAC,CAAAoB,aAAD,CAAC2D,WAAD,oCACQnE,KADR,CAAA,EAAA,EAAA,EAAA;AAEIY,IAAAA,GAAG,EAAEA,GAFT;AAGIK,IAAAA,KAAK,EAAE3B,SAHX;AAII4B,IAAAA,SAAS,EAAEL,yBAAAA;AAJf,GAAA,CAAA,EAMKqD,KAAK,gBACF9E,KAAK,CAAAoB,aAAL,CAAK,KAAL,EAAK;AAAA4D,IAAAA,IAAI,EAAC,cAAL;AAAoBlD,IAAAA,SAAS,EAAC,2BAAA;AAA9B,GAAL,EACKgD,KADL,CADE,GAIF,IAVR,EAWKpE,QAXL,CADJ,CAAA;AAeH,CAxBiB;;;;"}
@@ -1,4 +1,4 @@
1
- var modules_40c67f5b = {"tab":"_2308f55f","track":"d173fedb","tab-neutral":"_4d1ad155","tab-themed":"_138c6c8b","track-neutral":"ee766342","track-themed":"cecb68f0"};
1
+ var modules_40c67f5b = {"tab":"faa5b46e","track":"_93de0ded","tab-neutral":"_82a91995","tab-themed":"f150e9da","track-neutral":"_10f229b4","track-themed":"_54f03992"};
2
2
 
3
3
  export { modules_40c67f5b as default };
4
4
  //# sourceMappingURL=tabs.module.css.js.map
@@ -1,28 +1,87 @@
1
1
  import * as React from 'react';
2
- export type BannerTone = 'info' | 'promotion';
3
- type BannerProps = {
2
+ import { ButtonProps } from '../button';
3
+ import { TextLink } from '../text-link';
4
+ /**
5
+ * Represents the type of a banner.
6
+ * 'neutral' accepts a custom icon, the rest do not.
7
+ * @default 'neutral'
8
+ */
9
+ export type BannerType = 'neutral' | SystemBannerType;
10
+ /**
11
+ * Predefined system types for banners.
12
+ * Each type has its own preset icon.
13
+ */
14
+ export type SystemBannerType = 'info' | 'upgrade' | 'experiment' | 'warning' | 'error' | 'success';
15
+ type BaseAction = {
16
+ variant: 'primary' | 'tertiary';
17
+ label: string;
18
+ } & Pick<ButtonProps, 'loading' | 'disabled'>;
19
+ type ActionButton = BaseAction & {
20
+ type: 'button';
21
+ } & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'className'>;
22
+ type ActionLink = BaseAction & {
23
+ type: 'link';
24
+ } & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'className'>;
25
+ /**
26
+ * Represents an action that can be taken from the banner.
27
+ * Can be either a button or a link, sharing common properties from BaseAction.
28
+ */
29
+ type Action = ActionButton | ActionLink;
30
+ /**
31
+ * Configuration for inline links within the banner description.
32
+ * Extends TextLink component props with a required label.
33
+ */
34
+ type InlineLink = {
35
+ label: string;
36
+ } & React.ComponentProps<typeof TextLink>;
37
+ type WithCloseButton = {
38
+ closeLabel?: string;
39
+ onClose: () => void;
40
+ };
41
+ type WithoutCloseButton = {
42
+ closeLabel?: never;
43
+ onClose?: never;
44
+ };
45
+ /**
46
+ * Controls the close button behavior.
47
+ * If none is provided, the banner will not have a close button.
48
+ */
49
+ type CloseButton = WithCloseButton | WithoutCloseButton;
50
+ type BaseBanner = {
4
51
  id?: string;
5
- /**
6
- * The tone of the Banner. Affects the background color and the outline.
7
- */
8
- tone: BannerTone;
9
- /**
10
- * The icon that should be added inside the Banner.
11
- */
12
- icon: React.ReactElement | string | number;
13
- /**
14
- * The title to be displayed at the top of the Banner.
15
- */
16
- title: React.ReactNode;
17
- /**
18
- * An optional description to be displayed inside the Banner.
19
- */
20
- description?: React.ReactNode;
21
- /**
22
- * An optional action to displayed inside the Banner.
23
- */
24
- action?: React.ReactElement | string | number;
52
+ title?: React.ReactNode;
53
+ description: Exclude<React.ReactNode, null | undefined | boolean>;
54
+ action?: Action;
55
+ inlineLinks?: InlineLink[];
56
+ } & CloseButton;
57
+ /**
58
+ * Configuration for neutral banners.
59
+ * Can include either an image, an icon, or neither, but never both.
60
+ */
61
+ type NeutralBanner = BaseBanner & {
62
+ type: Extract<BannerType, 'neutral'>;
63
+ } & ({
64
+ image: React.ReactElement;
65
+ icon?: never;
66
+ } | {
67
+ icon: React.ReactElement;
68
+ image?: never;
69
+ } | {
70
+ image?: never;
71
+ icon?: never;
72
+ });
73
+ /**
74
+ * Configuration for system banners.
75
+ * Cannot include custom images or icons as they use preset ones.
76
+ */
77
+ type SystemBanner = BaseBanner & {
78
+ type: SystemBannerType;
79
+ image?: never;
80
+ icon?: never;
25
81
  };
82
+ type BannerProps = NeutralBanner | SystemBanner;
26
83
  declare const Banner: React.ForwardRefExoticComponent<BannerProps & React.RefAttributes<HTMLDivElement>>;
84
+ declare function ActionButton({ type, label, ...props }: ActionButton): React.JSX.Element;
85
+ declare function ActionLink({ type, label, variant, ...props }: ActionLink): React.JSX.Element;
27
86
  export { Banner };
28
87
  export type { BannerProps };