@gravity-ui/page-constructor 8.13.2 → 8.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/build/cjs/blocks/Footer/Footer.css +53 -0
  2. package/build/cjs/blocks/Footer/Footer.d.ts +5 -0
  3. package/build/cjs/blocks/Footer/Footer.js +34 -0
  4. package/build/cjs/blocks/Footer/Footer.js.map +1 -0
  5. package/build/cjs/blocks/Footer/components/CopyrightFloor/CopyrightFloor.css +201 -0
  6. package/build/cjs/blocks/Footer/components/CopyrightFloor/CopyrightFloor.d.ts +6 -0
  7. package/build/cjs/blocks/Footer/components/CopyrightFloor/CopyrightFloor.js +142 -0
  8. package/build/cjs/blocks/Footer/components/CopyrightFloor/CopyrightFloor.js.map +1 -0
  9. package/build/cjs/blocks/Footer/components/CopyrightFloor/index.d.ts +1 -0
  10. package/build/cjs/blocks/Footer/components/CopyrightFloor/index.js +6 -0
  11. package/build/cjs/blocks/Footer/components/CopyrightFloor/index.js.map +1 -0
  12. package/build/cjs/blocks/Footer/components/DisclaimerFloor/DisclaimerFloor.css +28 -0
  13. package/build/cjs/blocks/Footer/components/DisclaimerFloor/DisclaimerFloor.d.ts +6 -0
  14. package/build/cjs/blocks/Footer/components/DisclaimerFloor/DisclaimerFloor.js +18 -0
  15. package/build/cjs/blocks/Footer/components/DisclaimerFloor/DisclaimerFloor.js.map +1 -0
  16. package/build/cjs/blocks/Footer/components/DisclaimerFloor/index.d.ts +1 -0
  17. package/build/cjs/blocks/Footer/components/DisclaimerFloor/index.js +6 -0
  18. package/build/cjs/blocks/Footer/components/DisclaimerFloor/index.js.map +1 -0
  19. package/build/cjs/blocks/Footer/components/LangSwitcher/LangSwitcher.css +14 -0
  20. package/build/cjs/blocks/Footer/components/LangSwitcher/LangSwitcher.d.ts +11 -0
  21. package/build/cjs/blocks/Footer/components/LangSwitcher/LangSwitcher.js +38 -0
  22. package/build/cjs/blocks/Footer/components/LangSwitcher/LangSwitcher.js.map +1 -0
  23. package/build/cjs/blocks/Footer/components/LangSwitcher/index.d.ts +1 -0
  24. package/build/cjs/blocks/Footer/components/LangSwitcher/index.js +6 -0
  25. package/build/cjs/blocks/Footer/components/LangSwitcher/index.js.map +1 -0
  26. package/build/cjs/blocks/Footer/components/NavigationFloor/NavigationFloor.css +93 -0
  27. package/build/cjs/blocks/Footer/components/NavigationFloor/NavigationFloor.d.ts +12 -0
  28. package/build/cjs/blocks/Footer/components/NavigationFloor/NavigationFloor.js +37 -0
  29. package/build/cjs/blocks/Footer/components/NavigationFloor/NavigationFloor.js.map +1 -0
  30. package/build/cjs/blocks/Footer/components/NavigationFloor/index.d.ts +1 -0
  31. package/build/cjs/blocks/Footer/components/NavigationFloor/index.js +6 -0
  32. package/build/cjs/blocks/Footer/components/NavigationFloor/index.js.map +1 -0
  33. package/build/cjs/blocks/Footer/components/SocialFloor/SocialFloor.css +77 -0
  34. package/build/cjs/blocks/Footer/components/SocialFloor/SocialFloor.d.ts +6 -0
  35. package/build/cjs/blocks/Footer/components/SocialFloor/SocialFloor.js +38 -0
  36. package/build/cjs/blocks/Footer/components/SocialFloor/SocialFloor.js.map +1 -0
  37. package/build/cjs/blocks/Footer/components/SocialFloor/index.d.ts +1 -0
  38. package/build/cjs/blocks/Footer/components/SocialFloor/index.js +6 -0
  39. package/build/cjs/blocks/Footer/components/SocialFloor/index.js.map +1 -0
  40. package/build/cjs/blocks/Footer/hooks/useLogoImageProps.d.ts +2 -0
  41. package/build/cjs/blocks/Footer/hooks/useLogoImageProps.js +21 -0
  42. package/build/cjs/blocks/Footer/hooks/useLogoImageProps.js.map +1 -0
  43. package/build/cjs/blocks/Footer/hooks/useOverflowListItems.d.ts +18 -0
  44. package/build/cjs/blocks/Footer/hooks/useOverflowListItems.js +108 -0
  45. package/build/cjs/blocks/Footer/hooks/useOverflowListItems.js.map +1 -0
  46. package/build/cjs/blocks/Footer/schema.d.ts +347 -0
  47. package/build/cjs/blocks/Footer/schema.js +123 -0
  48. package/build/cjs/blocks/Footer/schema.js.map +1 -0
  49. package/build/cjs/blocks/index.d.ts +1 -0
  50. package/build/cjs/blocks/index.js +3 -1
  51. package/build/cjs/blocks/index.js.map +1 -1
  52. package/build/cjs/blocks/validators.d.ts +1 -0
  53. package/build/cjs/blocks/validators.js +1 -0
  54. package/build/cjs/blocks/validators.js.map +1 -1
  55. package/build/cjs/components/BrandFooter/BrandFooter.css +2 -2
  56. package/build/cjs/constructor-items.d.ts +2 -1
  57. package/build/cjs/constructor-items.js +1 -0
  58. package/build/cjs/constructor-items.js.map +1 -1
  59. package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +0 -1
  60. package/build/cjs/containers/PageConstructor/PageConstructor.js +0 -1
  61. package/build/cjs/containers/PageConstructor/PageConstructor.js.map +1 -1
  62. package/build/cjs/models/constructor-items/blocks.d.ts +77 -2
  63. package/build/cjs/models/constructor-items/blocks.js +1 -0
  64. package/build/cjs/models/constructor-items/blocks.js.map +1 -1
  65. package/build/cjs/models/navigation.d.ts +1 -0
  66. package/build/cjs/models/navigation.js.map +1 -1
  67. package/build/cjs/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.d.ts +1 -1
  68. package/build/cjs/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +2 -2
  69. package/build/cjs/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js.map +1 -1
  70. package/build/cjs/navigation/components/NavigationItem/hooks/useNavigationItemMap.d.ts +1 -1
  71. package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.d.ts +1 -1
  72. package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.js +2 -2
  73. package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.js.map +1 -1
  74. package/build/cjs/navigation/hooks/useActiveNavItem.d.ts +2 -0
  75. package/build/cjs/navigation/models.d.ts +1 -0
  76. package/build/cjs/navigation/models.js.map +1 -1
  77. package/build/cjs/navigation/utils.d.ts +1 -0
  78. package/build/cjs/schema/constants.js +2 -0
  79. package/build/cjs/schema/constants.js.map +1 -1
  80. package/build/cjs/schema/validators/blocks.d.ts +1 -0
  81. package/build/cjs/schema/validators/blocks.js +1 -0
  82. package/build/cjs/schema/validators/blocks.js.map +1 -1
  83. package/build/cjs/text-transform/config.js +13 -0
  84. package/build/cjs/text-transform/config.js.map +1 -1
  85. package/build/cjs/utils/url.js +1 -1
  86. package/build/cjs/utils/url.js.map +1 -1
  87. package/build/cjs/utils/url.test.js +2 -0
  88. package/build/cjs/utils/url.test.js.map +1 -1
  89. package/build/esm/blocks/Footer/Footer.css +53 -0
  90. package/build/esm/blocks/Footer/Footer.d.ts +6 -0
  91. package/build/esm/blocks/Footer/Footer.js +31 -0
  92. package/build/esm/blocks/Footer/Footer.js.map +1 -0
  93. package/build/esm/blocks/Footer/components/CopyrightFloor/CopyrightFloor.css +201 -0
  94. package/build/esm/blocks/Footer/components/CopyrightFloor/CopyrightFloor.d.ts +7 -0
  95. package/build/esm/blocks/Footer/components/CopyrightFloor/CopyrightFloor.js +138 -0
  96. package/build/esm/blocks/Footer/components/CopyrightFloor/CopyrightFloor.js.map +1 -0
  97. package/build/esm/blocks/Footer/components/CopyrightFloor/index.d.ts +1 -0
  98. package/build/esm/blocks/Footer/components/CopyrightFloor/index.js +2 -0
  99. package/build/esm/blocks/Footer/components/CopyrightFloor/index.js.map +1 -0
  100. package/build/esm/blocks/Footer/components/DisclaimerFloor/DisclaimerFloor.css +28 -0
  101. package/build/esm/blocks/Footer/components/DisclaimerFloor/DisclaimerFloor.d.ts +7 -0
  102. package/build/esm/blocks/Footer/components/DisclaimerFloor/DisclaimerFloor.js +15 -0
  103. package/build/esm/blocks/Footer/components/DisclaimerFloor/DisclaimerFloor.js.map +1 -0
  104. package/build/esm/blocks/Footer/components/DisclaimerFloor/index.d.ts +1 -0
  105. package/build/esm/blocks/Footer/components/DisclaimerFloor/index.js +2 -0
  106. package/build/esm/blocks/Footer/components/DisclaimerFloor/index.js.map +1 -0
  107. package/build/esm/blocks/Footer/components/LangSwitcher/LangSwitcher.css +14 -0
  108. package/build/esm/blocks/Footer/components/LangSwitcher/LangSwitcher.d.ts +12 -0
  109. package/build/esm/blocks/Footer/components/LangSwitcher/LangSwitcher.js +34 -0
  110. package/build/esm/blocks/Footer/components/LangSwitcher/LangSwitcher.js.map +1 -0
  111. package/build/esm/blocks/Footer/components/LangSwitcher/index.d.ts +1 -0
  112. package/build/esm/blocks/Footer/components/LangSwitcher/index.js +2 -0
  113. package/build/esm/blocks/Footer/components/LangSwitcher/index.js.map +1 -0
  114. package/build/esm/blocks/Footer/components/NavigationFloor/NavigationFloor.css +93 -0
  115. package/build/esm/blocks/Footer/components/NavigationFloor/NavigationFloor.d.ts +13 -0
  116. package/build/esm/blocks/Footer/components/NavigationFloor/NavigationFloor.js +33 -0
  117. package/build/esm/blocks/Footer/components/NavigationFloor/NavigationFloor.js.map +1 -0
  118. package/build/esm/blocks/Footer/components/NavigationFloor/index.d.ts +1 -0
  119. package/build/esm/blocks/Footer/components/NavigationFloor/index.js +2 -0
  120. package/build/esm/blocks/Footer/components/NavigationFloor/index.js.map +1 -0
  121. package/build/esm/blocks/Footer/components/SocialFloor/SocialFloor.css +77 -0
  122. package/build/esm/blocks/Footer/components/SocialFloor/SocialFloor.d.ts +7 -0
  123. package/build/esm/blocks/Footer/components/SocialFloor/SocialFloor.js +35 -0
  124. package/build/esm/blocks/Footer/components/SocialFloor/SocialFloor.js.map +1 -0
  125. package/build/esm/blocks/Footer/components/SocialFloor/index.d.ts +1 -0
  126. package/build/esm/blocks/Footer/components/SocialFloor/index.js +2 -0
  127. package/build/esm/blocks/Footer/components/SocialFloor/index.js.map +1 -0
  128. package/build/esm/blocks/Footer/hooks/useLogoImageProps.d.ts +2 -0
  129. package/build/esm/blocks/Footer/hooks/useLogoImageProps.js +17 -0
  130. package/build/esm/blocks/Footer/hooks/useLogoImageProps.js.map +1 -0
  131. package/build/esm/blocks/Footer/hooks/useOverflowListItems.d.ts +18 -0
  132. package/build/esm/blocks/Footer/hooks/useOverflowListItems.js +104 -0
  133. package/build/esm/blocks/Footer/hooks/useOverflowListItems.js.map +1 -0
  134. package/build/esm/blocks/Footer/schema.d.ts +347 -0
  135. package/build/esm/blocks/Footer/schema.js +120 -0
  136. package/build/esm/blocks/Footer/schema.js.map +1 -0
  137. package/build/esm/blocks/index.d.ts +1 -0
  138. package/build/esm/blocks/index.js +1 -0
  139. package/build/esm/blocks/index.js.map +1 -1
  140. package/build/esm/blocks/validators.d.ts +1 -0
  141. package/build/esm/blocks/validators.js +1 -0
  142. package/build/esm/blocks/validators.js.map +1 -1
  143. package/build/esm/components/BrandFooter/BrandFooter.css +2 -2
  144. package/build/esm/constructor-items.d.ts +2 -1
  145. package/build/esm/constructor-items.js +2 -1
  146. package/build/esm/constructor-items.js.map +1 -1
  147. package/build/esm/containers/PageConstructor/PageConstructor.d.ts +0 -1
  148. package/build/esm/containers/PageConstructor/PageConstructor.js +0 -1
  149. package/build/esm/containers/PageConstructor/PageConstructor.js.map +1 -1
  150. package/build/esm/models/constructor-items/blocks.d.ts +77 -2
  151. package/build/esm/models/constructor-items/blocks.js +1 -0
  152. package/build/esm/models/constructor-items/blocks.js.map +1 -1
  153. package/build/esm/models/navigation.d.ts +1 -0
  154. package/build/esm/models/navigation.js.map +1 -1
  155. package/build/esm/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.d.ts +1 -1
  156. package/build/esm/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +2 -2
  157. package/build/esm/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js.map +1 -1
  158. package/build/esm/navigation/components/NavigationItem/hooks/useNavigationItemMap.d.ts +1 -1
  159. package/build/esm/navigation/components/NavigationPopup/NavigationPopup.d.ts +1 -1
  160. package/build/esm/navigation/components/NavigationPopup/NavigationPopup.js +2 -2
  161. package/build/esm/navigation/components/NavigationPopup/NavigationPopup.js.map +1 -1
  162. package/build/esm/navigation/hooks/useActiveNavItem.d.ts +2 -0
  163. package/build/esm/navigation/models.d.ts +1 -0
  164. package/build/esm/navigation/models.js.map +1 -1
  165. package/build/esm/navigation/utils.d.ts +1 -0
  166. package/build/esm/schema/constants.js +3 -1
  167. package/build/esm/schema/constants.js.map +1 -1
  168. package/build/esm/schema/validators/blocks.d.ts +1 -0
  169. package/build/esm/schema/validators/blocks.js +1 -0
  170. package/build/esm/schema/validators/blocks.js.map +1 -1
  171. package/build/esm/text-transform/config.js +13 -0
  172. package/build/esm/text-transform/config.js.map +1 -1
  173. package/build/esm/utils/url.js +1 -1
  174. package/build/esm/utils/url.js.map +1 -1
  175. package/build/esm/utils/url.test.js +2 -0
  176. package/build/esm/utils/url.test.js.map +1 -1
  177. package/package.json +1 -1
  178. package/schema/index.js +1 -1
  179. package/server/models/constructor-items/blocks.d.ts +77 -2
  180. package/server/models/constructor-items/blocks.js +1 -0
  181. package/server/models/navigation.d.ts +1 -0
  182. package/server/text-transform/config.js +10 -0
  183. package/server/utils/url.js +1 -1
  184. package/widget/index.js +1 -1
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Flex, Link, Tooltip } from '@gravity-ui/uikit';
3
+ import { Image } from "../../../../components/index.js";
4
+ import { useTheme } from "../../../../context/theme/index.js";
5
+ import { Col } from "../../../../grid/index.js";
6
+ import { block, getThemedValue } from "../../../../utils/index.js";
7
+ import { useLogoImageProps } from "../../hooks/useLogoImageProps.js";
8
+ import './SocialFloor.css';
9
+ const b = block('footer-block');
10
+ const SocialIconItem = ({ contact, theme }) => {
11
+ const iconResolved = contact.icon && getThemedValue(contact.icon, theme);
12
+ const iconProps = useLogoImageProps(iconResolved);
13
+ if (!iconProps) {
14
+ return null;
15
+ }
16
+ const content = (_jsx("li", { className: b('social-icons-item'), children: _jsx(Link, { className: b('social-icon-link'), href: contact.url, target: "_blank", rel: "noopener noreferrer", children: _jsx(Flex, { direction: "column", alignItems: "center", gap: 2, children: _jsx(Image, { ...iconProps, alt: contact.urlTitle ?? '', className: b('social-icon-item') }) }) }) }));
17
+ return contact.urlTitle ? (_jsx(Tooltip, { content: contact.urlTitle, openDelay: 500, children: content })) : (content);
18
+ };
19
+ const SocialIcons = ({ links, theme }) => {
20
+ if (!links?.length)
21
+ return null;
22
+ return (_jsx("ul", { className: b('social-icons-list'), children: links.map((contact, index) => (_jsx(SocialIconItem, { contact: contact, theme: theme }, index))) }));
23
+ };
24
+ export const SocialFloor = ({ contacts }) => {
25
+ const theme = useTheme();
26
+ if (!contacts.links?.length) {
27
+ return null;
28
+ }
29
+ return (_jsx(Col, { sizes: { all: 12 }, className: b('floor', { social: true }), children: _jsxs("div", { className: b('social-floor-inner', {
30
+ 'title-position': contacts.titlePosition || 'top',
31
+ 'links-position': contacts.linksPosition || 'left',
32
+ size: contacts.iconsSize ?? 'l',
33
+ }), children: [contacts.title && _jsx("h3", { className: b('social-floor-title'), children: contacts.title }), _jsx(SocialIcons, { links: contacts.links, theme: theme })] }) }));
34
+ };
35
+ //# sourceMappingURL=SocialFloor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SocialFloor.js","sourceRoot":"../../../../../../src","sources":["blocks/Footer/components/SocialFloor/SocialFloor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAC,KAAK,EAAC,wCAA+B;AAC7C,OAAO,EAAC,QAAQ,EAAC,2CAAkC;AACnD,OAAO,EAAC,GAAG,EAAC,kCAAyB;AAErC,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,mCAA0B;AACxD,OAAO,EAAC,iBAAiB,EAAC,yCAAsC;AAEhE,OAAO,mBAAmB,CAAC;AAE3B,MAAM,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAgBhC,MAAM,cAAc,GAAG,CAAC,EAAC,OAAO,EAAE,KAAK,EAAsB,EAAE,EAAE;I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,EAAE,KAAK,IAArC,KAAK,CAAoC,CACjE,CAAC,GACD,CACR,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAC,QAAQ,EAAmB,EAAE,EAAE;IACxD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CACH,KAAC,GAAG,IAAC,KAAK,EAAE,EAAC,GAAG,EAAE,EAAE,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,YACxD,eACI,SAAS,EAAE,CAAC,CAAC,oBAAoB,EAAE;gBAC/B,gBAAgB,EAAE,QAAQ,CAAC,aAAa,IAAI,KAAK;gBACjD,gBAAgB,EAAE,QAAQ,CAAC,aAAa,IAAI,MAAM;gBAClD,IAAI,EAAE,QAAQ,CAAC,SAAS,IAAI,GAAG;aAClC,CAAC,aAED,QAAQ,CAAC,KAAK,IAAI,aAAI,SAAS,EAAE,CAAC,CAAC,oBAAoB,CAAC,YAAG,QAAQ,CAAC,KAAK,GAAM,EAChF,KAAC,WAAW,IAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,GAAI,IAClD,GACJ,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {Flex, Link, Tooltip} from '@gravity-ui/uikit';\n\nimport {Image} from '../../../../components';\nimport {useTheme} from '../../../../context/theme';\nimport {Col} from '../../../../grid';\nimport type {FooterBlockProps, FooterContactItem} from '../../../../models';\nimport {block, getThemedValue} from '../../../../utils';\nimport {useLogoImageProps} from '../../hooks/useLogoImageProps';\n\nimport './SocialFloor.scss';\n\nconst b = block('footer-block');\n\ntype SocialFloorProps = {\n contacts: NonNullable<FooterBlockProps['contacts']>;\n};\n\ntype SocialIconsProps = {\n links: SocialFloorProps['contacts']['links'];\n theme: ReturnType<typeof useTheme>;\n};\n\ntype SocialIconItemProps = {\n contact: FooterContactItem;\n theme: ReturnType<typeof useTheme>;\n};\n\nconst SocialIconItem = ({contact, theme}: SocialIconItemProps) => {\n const iconResolved = contact.icon && getThemedValue(contact.icon, theme);\n const iconProps = useLogoImageProps(iconResolved);\n\n if (!iconProps) {\n return null;\n }\n\n const content = (\n <li className={b('social-icons-item')}>\n <Link\n className={b('social-icon-link')}\n href={contact.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <Flex direction=\"column\" alignItems=\"center\" gap={2}>\n <Image\n {...iconProps}\n alt={contact.urlTitle ?? ''}\n className={b('social-icon-item')}\n />\n </Flex>\n </Link>\n </li>\n );\n\n return contact.urlTitle ? (\n <Tooltip content={contact.urlTitle} openDelay={500}>\n {content}\n </Tooltip>\n ) : (\n content\n );\n};\n\nconst SocialIcons = ({links, theme}: SocialIconsProps) => {\n if (!links?.length) return null;\n\n return (\n <ul className={b('social-icons-list')}>\n {links.map((contact, index) => (\n <SocialIconItem key={index} contact={contact} theme={theme} />\n ))}\n </ul>\n );\n};\n\nexport const SocialFloor = ({contacts}: SocialFloorProps) => {\n const theme = useTheme();\n\n if (!contacts.links?.length) {\n return null;\n }\n\n return (\n <Col sizes={{all: 12}} className={b('floor', {social: true})}>\n <div\n className={b('social-floor-inner', {\n 'title-position': contacts.titlePosition || 'top',\n 'links-position': contacts.linksPosition || 'left',\n size: contacts.iconsSize ?? 'l',\n })}\n >\n {contacts.title && <h3 className={b('social-floor-title')}>{contacts.title}</h3>}\n <SocialIcons links={contacts.links} theme={theme} />\n </div>\n </Col>\n );\n};\n"]}
@@ -0,0 +1 @@
1
+ export { SocialFloor } from "./SocialFloor.js";
@@ -0,0 +1,2 @@
1
+ export { SocialFloor } from "./SocialFloor.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../../../../../../src","sources":["blocks/Footer/components/SocialFloor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,yBAAsB","sourcesContent":["export {SocialFloor} from './SocialFloor';\n"]}
@@ -0,0 +1,2 @@
1
+ import type { ImageProps as ModelImageProps } from "../../../models/index.js";
2
+ export declare function useLogoImageProps(logoImage?: ModelImageProps | null): Record<string, unknown> | null;
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { getMediaImage } from "../../../components/Media/Image/utils.js";
3
+ export function useLogoImageProps(logoImage) {
4
+ return React.useMemo(() => {
5
+ if (!logoImage) {
6
+ return null;
7
+ }
8
+ const resolved = getMediaImage(logoImage);
9
+ if (typeof resolved === 'string') {
10
+ return { src: resolved };
11
+ }
12
+ return resolved && typeof resolved === 'object'
13
+ ? resolved
14
+ : null;
15
+ }, [logoImage]);
16
+ }
17
+ //# sourceMappingURL=useLogoImageProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLogoImageProps.js","sourceRoot":"../../../../../src","sources":["blocks/Footer/hooks/useLogoImageProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,aAAa,EAAC,iDAA8C;AAGpE,MAAM,UAAU,iBAAiB,CAC7B,SAAkC;IAElC,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACtB,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,QAAQ,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAC,CAAC;QAC3B,CAAC;QAED,OAAO,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ;YAC3C,CAAC,CAAE,QAA+C;YAClD,CAAC,CAAC,IAAI,CAAC;IACf,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;AACpB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {getMediaImage} from '../../../components/Media/Image/utils';\nimport type {ImageProps as ModelImageProps} from '../../../models';\n\nexport function useLogoImageProps(\n logoImage?: ModelImageProps | null,\n): Record<string, unknown> | null {\n return React.useMemo(() => {\n if (!logoImage) {\n return null;\n }\n\n const resolved = getMediaImage(logoImage);\n if (typeof resolved === 'string') {\n return {src: resolved};\n }\n\n return resolved && typeof resolved === 'object'\n ? (resolved as unknown as Record<string, unknown>)\n : null;\n }, [logoImage]);\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import { DropdownMenuItem } from '@gravity-ui/uikit';
3
+ import { LinkProps } from "../../../models/index.js";
4
+ export type LinkItem = Required<Pick<LinkProps, 'text' | 'url'>>;
5
+ type UseOverflowListItemsProps = {
6
+ isDropdown?: boolean;
7
+ containerRef: React.RefObject<HTMLElement>;
8
+ items?: LinkItem[];
9
+ itemSelector: string;
10
+ moreButtonWidth?: number;
11
+ };
12
+ type OverflowListItemsResult = {
13
+ visibleItems: LinkItem[];
14
+ hiddenItems: DropdownMenuItem[];
15
+ measured: boolean;
16
+ };
17
+ export declare function useOverflowListItems({ isDropdown, containerRef, items, itemSelector, moreButtonWidth, }: UseOverflowListItemsProps): OverflowListItemsResult;
18
+ export {};
@@ -0,0 +1,104 @@
1
+ import * as React from 'react';
2
+ import { useResizeObserver } from '@gravity-ui/uikit';
3
+ import throttleFn from "lodash/throttle.js";
4
+ function parseCssPixelValue(value) {
5
+ const parsedValue = parseFloat(value);
6
+ return Number.isNaN(parsedValue) ? 0 : parsedValue;
7
+ }
8
+ function getElementWidth(element) {
9
+ return Math.ceil(Math.max(element.scrollWidth, element.getBoundingClientRect().width));
10
+ }
11
+ export function useOverflowListItems({ isDropdown = false, containerRef, items, itemSelector, moreButtonWidth = 0, }) {
12
+ const [containerWidth, setContainerWidth] = React.useState(0);
13
+ const [itemWidths, setItemWidths] = React.useState([]);
14
+ const [itemGap, setItemGap] = React.useState(0);
15
+ const itemsCount = items?.length ?? 0;
16
+ const areItemsMeasured = !isDropdown || itemWidths.length === itemsCount;
17
+ const updateItemWidths = React.useCallback(() => {
18
+ if (!containerRef.current || !itemsCount) {
19
+ setItemWidths([]);
20
+ return;
21
+ }
22
+ const itemElements = Array.from(containerRef.current.querySelectorAll(itemSelector));
23
+ if (itemElements.length !== itemsCount) {
24
+ return;
25
+ }
26
+ const listElement = itemElements[0]?.parentElement;
27
+ setItemWidths(itemElements.map(getElementWidth));
28
+ if (listElement) {
29
+ const listStyles = window.getComputedStyle(listElement);
30
+ setItemGap(parseCssPixelValue(listStyles.columnGap));
31
+ }
32
+ }, [containerRef, itemSelector, itemsCount]);
33
+ React.useEffect(() => {
34
+ setItemWidths((currentItemWidths) => (currentItemWidths.length ? [] : currentItemWidths));
35
+ }, [items, isDropdown]);
36
+ React.useLayoutEffect(() => {
37
+ if (isDropdown && !areItemsMeasured) {
38
+ updateItemWidths();
39
+ }
40
+ }, [areItemsMeasured, isDropdown, updateItemWidths]);
41
+ React.useEffect(() => {
42
+ if (!isDropdown || typeof document === 'undefined' || !('fonts' in document)) {
43
+ return undefined;
44
+ }
45
+ let cancelled = false;
46
+ document.fonts.ready.then(() => {
47
+ if (!cancelled) {
48
+ setItemWidths((currentItemWidths) => currentItemWidths.length ? [] : currentItemWidths);
49
+ }
50
+ });
51
+ return () => {
52
+ cancelled = true;
53
+ };
54
+ }, [items, isDropdown]);
55
+ const updateContainerSize = React.useMemo(() => throttleFn(() => {
56
+ if (!containerRef.current) {
57
+ return;
58
+ }
59
+ setContainerWidth(containerRef.current.clientWidth);
60
+ }, 100), [containerRef]);
61
+ useResizeObserver({ ref: containerRef, onResize: updateContainerSize });
62
+ const isMeasured = containerWidth > 0 && areItemsMeasured;
63
+ const { visibleItems, hiddenItems } = React.useMemo(() => {
64
+ if (!isDropdown) {
65
+ return {
66
+ visibleItems: items ?? [],
67
+ hiddenItems: [],
68
+ };
69
+ }
70
+ if (!isMeasured) {
71
+ return {
72
+ visibleItems: items ?? [],
73
+ hiddenItems: [],
74
+ };
75
+ }
76
+ const linksCount = itemWidths.length;
77
+ let visibleItemsCount = 0;
78
+ let remainingContainerWidth = containerWidth;
79
+ for (const width of itemWidths) {
80
+ const isMoreThanOneItemLeft = linksCount !== visibleItemsCount + 1;
81
+ const currentItemWidth = width + (visibleItemsCount === 0 ? 0 : itemGap);
82
+ remainingContainerWidth -= currentItemWidth;
83
+ const hasNoSpaceForTheLastItem = remainingContainerWidth < 0;
84
+ if (remainingContainerWidth < moreButtonWidth &&
85
+ (isMoreThanOneItemLeft || hasNoSpaceForTheLastItem)) {
86
+ break;
87
+ }
88
+ visibleItemsCount++;
89
+ }
90
+ visibleItemsCount = Math.max(visibleItemsCount, 1);
91
+ return {
92
+ visibleItems: items?.slice(0, visibleItemsCount) ?? [],
93
+ hiddenItems: transformItemsToDropdownMenuItems(items?.slice(visibleItemsCount) ?? []),
94
+ };
95
+ }, [containerWidth, isMeasured, itemGap, itemWidths, items, moreButtonWidth, isDropdown]);
96
+ return { visibleItems, hiddenItems, measured: isMeasured };
97
+ }
98
+ function transformItemsToDropdownMenuItems(items) {
99
+ return items.map((item) => ({
100
+ text: item.text,
101
+ href: item.url,
102
+ }));
103
+ }
104
+ //# sourceMappingURL=useOverflowListItems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOverflowListItems.js","sourceRoot":"../../../../../src","sources":["blocks/Footer/hooks/useOverflowListItems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAmB,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AACtE,OAAO,UAAU,2BAAwB;AAoBzC,SAAS,kBAAkB,CAAC,KAAa;IACrC,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAEtC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,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C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YAEzE,uBAAuB,IAAI,gBAAgB,CAAC;YAE5C,MAAM,wBAAwB,GAAG,uBAAuB,GAAG,CAAC,CAAC;YAC7D,IACI,uBAAuB,GAAG,eAAe;gBACzC,CAAC,qBAAqB,IAAI,wBAAwB,CAAC,EACrD,CAAC;gBACC,MAAM;YACV,CAAC;YAED,iBAAiB,EAAE,CAAC;QACxB,CAAC;QAED,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;QAEnD,OAAO;YACH,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,IAAI,EAAE;YACtD,WAAW,EAAE,iCAAiC,CAAC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;SACxF,CAAC;IACN,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC,CAAC;IAE1F,OAAO,EAAC,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAC,CAAC;AAC7D,CAAC;AAED,SAAS,iCAAiC,CACtC,KAAiB;IAEjB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACxB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI,CAAC,GAAG;KACjB,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {DropdownMenuItem, useResizeObserver} from '@gravity-ui/uikit';\nimport throttleFn from 'lodash/throttle';\n\nimport {LinkProps} from '../../../models';\n\nexport type LinkItem = Required<Pick<LinkProps, 'text' | 'url'>>;\n\ntype UseOverflowListItemsProps = {\n isDropdown?: boolean;\n containerRef: React.RefObject<HTMLElement>;\n items?: LinkItem[];\n itemSelector: string;\n moreButtonWidth?: number;\n};\n\ntype OverflowListItemsResult = {\n visibleItems: LinkItem[];\n hiddenItems: DropdownMenuItem[];\n measured: boolean;\n};\n\nfunction parseCssPixelValue(value: string) {\n const parsedValue = parseFloat(value);\n\n return Number.isNaN(parsedValue) ? 0 : parsedValue;\n}\n\nfunction getElementWidth(element: HTMLElement) {\n return Math.ceil(Math.max(element.scrollWidth, element.getBoundingClientRect().width));\n}\n\nexport function useOverflowListItems({\n isDropdown = false,\n containerRef,\n items,\n itemSelector,\n moreButtonWidth = 0,\n}: UseOverflowListItemsProps): OverflowListItemsResult {\n const [containerWidth, setContainerWidth] = React.useState<number>(0);\n const [itemWidths, setItemWidths] = React.useState<number[]>([]);\n const [itemGap, setItemGap] = React.useState<number>(0);\n const itemsCount = items?.length ?? 0;\n const areItemsMeasured = !isDropdown || itemWidths.length === itemsCount;\n\n const updateItemWidths = React.useCallback(() => {\n if (!containerRef.current || !itemsCount) {\n setItemWidths([]);\n return;\n }\n\n const itemElements = Array.from(\n containerRef.current.querySelectorAll(itemSelector),\n ) as HTMLElement[];\n\n if (itemElements.length !== itemsCount) {\n return;\n }\n\n const listElement = itemElements[0]?.parentElement;\n\n setItemWidths(itemElements.map(getElementWidth));\n\n if (listElement) {\n const listStyles = window.getComputedStyle(listElement);\n setItemGap(parseCssPixelValue(listStyles.columnGap));\n }\n }, [containerRef, itemSelector, itemsCount]);\n\n React.useEffect(() => {\n setItemWidths((currentItemWidths) => (currentItemWidths.length ? [] : currentItemWidths));\n }, [items, isDropdown]);\n\n React.useLayoutEffect(() => {\n if (isDropdown && !areItemsMeasured) {\n updateItemWidths();\n }\n }, [areItemsMeasured, isDropdown, updateItemWidths]);\n\n React.useEffect(() => {\n if (!isDropdown || typeof document === 'undefined' || !('fonts' in document)) {\n return undefined;\n }\n\n let cancelled = false;\n\n document.fonts.ready.then(() => {\n if (!cancelled) {\n setItemWidths((currentItemWidths) =>\n currentItemWidths.length ? [] : currentItemWidths,\n );\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [items, isDropdown]);\n\n const updateContainerSize = React.useMemo(\n () =>\n throttleFn(() => {\n if (!containerRef.current) {\n return;\n }\n\n setContainerWidth(containerRef.current.clientWidth);\n }, 100),\n [containerRef],\n );\n\n useResizeObserver({ref: containerRef, onResize: updateContainerSize});\n\n const isMeasured = containerWidth > 0 && areItemsMeasured;\n\n const {visibleItems, hiddenItems} = React.useMemo(() => {\n if (!isDropdown) {\n return {\n visibleItems: items ?? [],\n hiddenItems: [],\n };\n }\n\n if (!isMeasured) {\n return {\n visibleItems: items ?? [],\n hiddenItems: [],\n };\n }\n\n const linksCount = itemWidths.length;\n let visibleItemsCount = 0;\n let remainingContainerWidth = containerWidth;\n\n for (const width of itemWidths) {\n const isMoreThanOneItemLeft = linksCount !== visibleItemsCount + 1;\n const currentItemWidth = width + (visibleItemsCount === 0 ? 0 : itemGap);\n\n remainingContainerWidth -= currentItemWidth;\n\n const hasNoSpaceForTheLastItem = remainingContainerWidth < 0;\n if (\n remainingContainerWidth < moreButtonWidth &&\n (isMoreThanOneItemLeft || hasNoSpaceForTheLastItem)\n ) {\n break;\n }\n\n visibleItemsCount++;\n }\n\n visibleItemsCount = Math.max(visibleItemsCount, 1);\n\n return {\n visibleItems: items?.slice(0, visibleItemsCount) ?? [],\n hiddenItems: transformItemsToDropdownMenuItems(items?.slice(visibleItemsCount) ?? []),\n };\n }, [containerWidth, isMeasured, itemGap, itemWidths, items, moreButtonWidth, isDropdown]);\n\n return {visibleItems, hiddenItems, measured: isMeasured};\n}\n\nfunction transformItemsToDropdownMenuItems<ItemType extends {text: string; url: string}>(\n items: ItemType[],\n): DropdownMenuItem[] {\n return items.map((item) => ({\n text: item.text,\n href: item.url,\n }));\n}\n"]}
@@ -0,0 +1,347 @@
1
+ export declare const FooterBlock: {
2
+ 'footer-block': {
3
+ additionalProperties: boolean;
4
+ properties: {
5
+ backgroundColor: {
6
+ oneOf: (({
7
+ type: string;
8
+ } & {
9
+ optionName: string;
10
+ }) | {
11
+ type: string;
12
+ additionalProperties: boolean;
13
+ required: import("../../index.js").Theme[];
14
+ properties: {};
15
+ optionName: string;
16
+ })[];
17
+ };
18
+ indentTop: {
19
+ type: string;
20
+ enum: string[];
21
+ };
22
+ navigation: {
23
+ type: string;
24
+ additionalProperties: boolean;
25
+ required: string[];
26
+ properties: {
27
+ logo: {
28
+ properties: {
29
+ placement: {
30
+ type: string;
31
+ enum: string[];
32
+ };
33
+ image: {
34
+ oneOf: (({
35
+ oneOf: ({
36
+ type: string;
37
+ properties: {
38
+ when: {
39
+ type: string;
40
+ };
41
+ };
42
+ } | {
43
+ type: string;
44
+ pattern: string;
45
+ optionName: string;
46
+ items?: undefined;
47
+ } | {
48
+ type: string;
49
+ items: {
50
+ type: string;
51
+ properties: {
52
+ when: {
53
+ type: string;
54
+ };
55
+ };
56
+ };
57
+ optionName: string;
58
+ pattern?: undefined;
59
+ })[];
60
+ } & {
61
+ optionName: string;
62
+ }) | {
63
+ type: string;
64
+ additionalProperties: boolean;
65
+ required: import("../../index.js").Theme[];
66
+ properties: {};
67
+ optionName: string;
68
+ })[];
69
+ };
70
+ url: {
71
+ type: string;
72
+ };
73
+ alt: {
74
+ type: string;
75
+ contentType: string;
76
+ };
77
+ };
78
+ type: string;
79
+ additionalProperties: boolean;
80
+ required: string[];
81
+ };
82
+ columns: {
83
+ type: string;
84
+ items: {
85
+ type: string;
86
+ properties: {
87
+ when: {
88
+ type: string;
89
+ };
90
+ };
91
+ };
92
+ };
93
+ colSizes: {
94
+ type: string;
95
+ additionalProperties: boolean;
96
+ properties: {};
97
+ };
98
+ columnsPerRow: {
99
+ type: string;
100
+ minimum: number;
101
+ maximum: number;
102
+ };
103
+ };
104
+ };
105
+ contacts: {
106
+ type: string;
107
+ additionalProperties: boolean;
108
+ required: never[];
109
+ properties: {
110
+ title: {
111
+ type: string;
112
+ contentType: string;
113
+ };
114
+ iconsSize: {
115
+ type: string;
116
+ enum: string[];
117
+ };
118
+ links: {
119
+ type: string;
120
+ items: {
121
+ type: string;
122
+ properties: {
123
+ when: {
124
+ type: string;
125
+ };
126
+ };
127
+ };
128
+ };
129
+ linksPosition: {
130
+ type: string;
131
+ enum: string[];
132
+ };
133
+ titlePosition: {
134
+ type: string;
135
+ enum: string[];
136
+ };
137
+ };
138
+ };
139
+ disclaimer: {
140
+ type: string;
141
+ additionalProperties: boolean;
142
+ required: string[];
143
+ properties: {
144
+ text: {
145
+ type: string;
146
+ contentType: string;
147
+ };
148
+ align: {
149
+ type: string;
150
+ enum: string[];
151
+ };
152
+ };
153
+ };
154
+ copyright: {
155
+ type: string;
156
+ additionalProperties: boolean;
157
+ required: never[];
158
+ properties: {
159
+ links: {
160
+ type: string;
161
+ items: {
162
+ type: string;
163
+ properties: {
164
+ when: {
165
+ type: string;
166
+ };
167
+ };
168
+ };
169
+ };
170
+ linksOverflowStrategy: {
171
+ type: string;
172
+ enum: string[];
173
+ };
174
+ languageSwitcher: {
175
+ type: string;
176
+ additionalProperties: boolean;
177
+ required: string[];
178
+ properties: {
179
+ items: {
180
+ type: string;
181
+ items: {
182
+ type: string;
183
+ properties: {
184
+ when: {
185
+ type: string;
186
+ };
187
+ };
188
+ };
189
+ };
190
+ buttonText: {
191
+ type: string;
192
+ contentType: string;
193
+ };
194
+ image: {
195
+ oneOf: (({
196
+ oneOf: ({
197
+ type: string;
198
+ properties: {
199
+ when: {
200
+ type: string;
201
+ };
202
+ };
203
+ } | {
204
+ type: string;
205
+ pattern: string;
206
+ optionName: string;
207
+ items?: undefined;
208
+ } | {
209
+ type: string;
210
+ items: {
211
+ type: string;
212
+ properties: {
213
+ when: {
214
+ type: string;
215
+ };
216
+ };
217
+ };
218
+ optionName: string;
219
+ pattern?: undefined;
220
+ })[];
221
+ } & {
222
+ optionName: string;
223
+ }) | {
224
+ type: string;
225
+ additionalProperties: boolean;
226
+ required: import("../../index.js").Theme[];
227
+ properties: {};
228
+ optionName: string;
229
+ })[];
230
+ };
231
+ };
232
+ };
233
+ copyrightText: {
234
+ type: string;
235
+ contentType: string;
236
+ };
237
+ logo: {
238
+ type: string;
239
+ additionalProperties: boolean;
240
+ required: string[];
241
+ properties: {
242
+ image: {
243
+ oneOf: (({
244
+ oneOf: ({
245
+ type: string;
246
+ properties: {
247
+ when: {
248
+ type: string;
249
+ };
250
+ };
251
+ } | {
252
+ type: string;
253
+ pattern: string;
254
+ optionName: string;
255
+ items?: undefined;
256
+ } | {
257
+ type: string;
258
+ items: {
259
+ type: string;
260
+ properties: {
261
+ when: {
262
+ type: string;
263
+ };
264
+ };
265
+ };
266
+ optionName: string;
267
+ pattern?: undefined;
268
+ })[];
269
+ } & {
270
+ optionName: string;
271
+ }) | {
272
+ type: string;
273
+ additionalProperties: boolean;
274
+ required: import("../../index.js").Theme[];
275
+ properties: {};
276
+ optionName: string;
277
+ })[];
278
+ };
279
+ url: {
280
+ type: string;
281
+ };
282
+ alt: {
283
+ type: string;
284
+ contentType: string;
285
+ };
286
+ };
287
+ };
288
+ };
289
+ };
290
+ attribution: {
291
+ type: string;
292
+ };
293
+ anchor: {
294
+ type: string;
295
+ additionalProperties: boolean;
296
+ required: string[];
297
+ properties: {
298
+ text: {
299
+ type: string;
300
+ contentType: string;
301
+ };
302
+ url: {
303
+ type: string;
304
+ };
305
+ urlTitle: {
306
+ type: string;
307
+ };
308
+ };
309
+ };
310
+ visible: {
311
+ oneOf: ({
312
+ type: string;
313
+ enum: string[];
314
+ additionalProperties?: undefined;
315
+ properties?: undefined;
316
+ } | {
317
+ type: string;
318
+ additionalProperties: boolean;
319
+ properties: {};
320
+ enum?: undefined;
321
+ })[];
322
+ };
323
+ resetPaddings: {
324
+ type: string;
325
+ };
326
+ context: {
327
+ type: string;
328
+ };
329
+ indent: {
330
+ type: string;
331
+ additionalProperties: boolean;
332
+ properties: {
333
+ top: {
334
+ enum: string[];
335
+ };
336
+ bottom: {
337
+ enum: string[];
338
+ };
339
+ };
340
+ };
341
+ type: {};
342
+ when: {
343
+ type: string;
344
+ };
345
+ };
346
+ };
347
+ };