@expo/styleguide-search-ui 2.0.0 → 2.1.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export { CommandMenu } from './src/components/CommandMenu';
3
2
  export { CommandMenuTrigger } from './src/components/CommandMenuTrigger';
4
3
  export { CommandItemBaseWithCopy } from './src/components/CommandItemBaseWithCopy';
@@ -7,7 +6,8 @@ export * from './src/types';
7
6
  export declare const CommandItemBase: import("react").ForwardRefExoticComponent<{
8
7
  children?: import("react").ReactNode;
9
8
  } & Omit<import("react").HTMLAttributes<HTMLDivElement>, "value" | "onSelect" | "disabled"> & {
10
- disabled?: boolean | undefined;
11
- onSelect?: ((value: string) => void) | undefined;
12
- value?: string | undefined;
9
+ disabled?: boolean;
10
+ onSelect?: (value: string) => void;
11
+ value?: string;
12
+ forceMount?: boolean;
13
13
  } & import("react").RefAttributes<HTMLDivElement>>;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("cmdk"),t=require("@expo/styleguide-icons/outline/SearchSmIcon"),n=require("@expo/styleguide-icons/outline/XIcon"),r=require("lodash.groupby"),l=require("react"),a=require("@expo/styleguide"),c=require("@expo/styleguide-icons/outline/ArrowUpRightIcon"),o=require("@expo/styleguide-icons/outline/ChevronRightIcon"),i=require("@expo/styleguide-icons/custom/GithubIcon"),s=require("@expo/styleguide-icons/custom/PlanEnterpriseIcon"),u=require("@expo/styleguide-icons/outline/BookOpen02Icon"),m=require("@expo/styleguide-icons/outline/GraduationHat02Icon"),d=require("@expo/styleguide-icons/outline/Hash02Icon"),p=require("@expo/styleguide-icons/outline/Home02Icon"),v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var l in t=arguments[n])Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l]);return e},v.apply(this,arguments)};function f(e,t,n,r){return new(n||(n=Promise))((function(l,a){function c(e){try{i(r.next(e))}catch(e){a(e)}}function o(e){try{i(r.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,o)}i((r=r.apply(e,t||[])).next())}))}function C(e,t){var n,r,l,a,c={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(i){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(c=0)),c;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,r=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(l=c.trys,(l=l.length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){c.label=o[1];break}if(6===o[0]&&c.label<l[1]){c.label=l[1],l=o;break}if(l&&c.label<l[2]){c.label=l[2],c.ops.push(o);break}l[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,i])}}}"function"==typeof SuppressedError&&SuppressedError;var g=function(e){var t=e.isLoading;return l.createElement("div",{role:"progressbar",className:a.mergeClasses("bg-palette-blue9 h-0.5 absolute mt-[11px] left-px",t&&"animate-[searchUIBarLoader_2s_infinite_ease-in-out]")})};function E(){return l.createElement(o.ChevronRightIcon,{className:"icon-xs text-icon-quaternary inline-block relative mx-1 -top-px"})}var x=function(){return l.createElement(c.ArrowUpRightIcon,{className:"text-icon-tertiary self-center ml-auto shrink-0"})},h=function(e){var t=e.className;return l.createElement("svg",{viewBox:"-11.5 -10.23174 23 20.46348",className:a.mergeClasses("icon-md text-icon-secondary",t)},l.createElement("circle",{cx:"0",cy:"0",r:"2.05",fill:"currentColor"}),l.createElement("g",{stroke:"currentColor",strokeWidth:"1",fill:"none"},l.createElement("ellipse",{rx:"11",ry:"4.2"}),l.createElement("ellipse",{rx:"11",ry:"4.2",transform:"rotate(60)"}),l.createElement("ellipse",{rx:"11",ry:"4.2",transform:"rotate(120)"})))},y=function(){return l.createElement("svg",{width:"77",height:"19",viewBox:"0 0 2197 500",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-label":"Algolia",role:"img"},l.createElement("g",{clipPath:"url(#clip0_1_2)"},l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1070.38 275.3V5.90999C1070.38 2.27998 1067.14 -0.480015 1063.56 0.0799852L1013.1 8.01999C1010.23 8.46999 1008.11 10.95 1008.11 13.86L1008.28 287.08C1008.28 300 1008.28 379.78 1104.25 382.57C1107.58 382.67 1110.34 379.99 1110.34 376.66V335.88C1110.34 332.92 1108.15 330.37 1105.22 330.04C1070.37 326.03 1070.37 282.47 1070.37 275.32L1070.38 275.3Z"}),l.createElement("path",{d:"M1902.56 104.73H1851.78C1848.52 104.73 1845.88 107.372 1845.88 110.63V376.73C1845.88 379.988 1848.52 382.63 1851.78 382.63H1902.56C1905.82 382.63 1908.46 379.988 1908.46 376.73V110.63C1908.46 107.372 1905.82 104.73 1902.56 104.73Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1851.78 71.38H1902.55C1905.81 71.38 1908.45 68.74 1908.45 65.48V5.90001C1908.45 2.28001 1905.21 -0.489988 1901.63 0.0700121L1850.86 8.02001C1847.99 8.47001 1845.87 10.94 1845.87 13.85V65.47C1845.87 68.73 1848.51 71.37 1851.77 71.37L1851.78 71.38Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1764.03 275.3V5.90999C1764.03 2.27998 1760.79 -0.480015 1757.21 0.0799852L1706.75 8.01999C1703.88 8.46999 1701.76 10.95 1701.76 13.86L1701.93 287.08C1701.93 300 1701.93 379.78 1797.9 382.57C1801.23 382.67 1803.99 379.99 1803.99 376.66V335.88C1803.99 332.92 1801.8 330.37 1798.87 330.04C1764.02 326.03 1764.02 282.47 1764.02 275.32L1764.03 275.3Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1631.95 142.72C1620.81 130.47 1607.12 121.07 1591.17 114.41C1575.25 107.88 1557.91 104.56 1539.1 104.56C1520.32 104.56 1502.95 107.73 1487.18 114.41C1471.59 121.07 1457.89 130.46 1446.42 142.72C1434.95 154.95 1426.04 169.59 1419.66 186.75C1413.28 203.92 1410.42 224.12 1410.42 245.11C1410.42 266.1 1413.61 281.98 1419.97 299.32C1426.35 316.64 1435.11 331.43 1446.42 343.68C1457.71 355.91 1471.25 365.3 1487.02 372.14C1502.79 378.97 1527.14 382.47 1539.42 382.62C1551.67 382.62 1576.2 378.8 1592.12 372.14C1608.04 365.46 1621.58 355.91 1632.9 343.68C1644.19 331.43 1652.95 316.64 1659.15 299.32C1665.37 281.98 1668.39 266.1 1668.39 245.11C1668.39 224.12 1665.05 203.92 1658.36 186.75C1651.98 169.58 1643.22 154.95 1631.93 142.72H1631.95ZM1587.52 306.47C1576.05 322.22 1559.96 330.17 1539.43 330.17C1518.88 330.17 1502.8 322.37 1491.33 306.47C1479.86 290.72 1474.12 272.46 1474.12 245.27C1474.12 218.38 1479.71 196.13 1491.18 180.4C1502.63 164.65 1518.72 156.88 1539.25 156.88C1559.8 156.88 1575.88 164.66 1587.34 180.4C1598.81 195.97 1604.7 218.38 1604.7 245.27C1604.7 272.46 1598.98 290.57 1587.51 306.47H1587.52Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M894.42 104.73H845.09C796.73 104.73 754.18 130.21 729.34 168.83C714.82 191.41 706.35 218.46 706.35 247.56C706.35 292.45 726.48 332.48 757.94 358.66C760.87 361.26 763.99 363.64 767.25 365.8C780.11 374.29 795.36 379.27 811.77 379.27C813 379.27 814.23 379.24 815.45 379.18C815.81 379.16 816.16 379.13 816.52 379.11C817.39 379.06 818.27 379 819.14 378.91C819.48 378.88 819.82 378.83 820.16 378.79C821.07 378.69 821.98 378.58 822.89 378.45C823.1 378.42 823.31 378.38 823.52 378.35C856.41 373.28 885.08 347.53 894.42 315.54V373.37C894.42 376.63 897.06 379.27 900.32 379.27H950.74C954 379.27 956.64 376.63 956.64 373.37V110.63C956.64 107.37 954 104.73 950.74 104.73H894.42ZM894.42 311.65C882.22 321.81 866.45 325.63 849.58 326.77C849.42 326.78 849.25 326.8 849.09 326.81C847.97 326.88 846.85 326.91 845.73 326.91C803.49 326.91 768.61 291.02 768.61 247.54C768.61 237.29 770.57 227.53 774.03 218.56C785.25 189.44 812.8 168.82 845.09 168.82H894.42V311.65Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2133.97 104.73H2084.64C2036.28 104.73 1993.73 130.21 1968.89 168.83C1954.37 191.41 1945.9 218.46 1945.9 247.56C1945.9 292.45 1966.03 332.48 1997.49 358.66C2000.42 361.26 2003.54 363.64 2006.8 365.8C2019.66 374.29 2034.91 379.27 2051.32 379.27C2052.55 379.27 2053.78 379.24 2055 379.18C2055.36 379.16 2055.71 379.13 2056.07 379.11C2056.94 379.06 2057.82 379 2058.69 378.91C2059.03 378.88 2059.37 378.83 2059.71 378.79C2060.62 378.69 2061.53 378.58 2062.44 378.45C2062.65 378.42 2062.86 378.38 2063.07 378.35C2095.96 373.28 2124.63 347.53 2133.97 315.54V373.37C2133.97 376.63 2136.61 379.27 2139.87 379.27H2190.29C2193.55 379.27 2196.19 376.63 2196.19 373.37V110.63C2196.19 107.37 2193.55 104.73 2190.29 104.73H2133.97ZM2133.97 311.65C2121.77 321.81 2106 325.63 2089.13 326.77C2088.97 326.78 2088.8 326.8 2088.64 326.81C2087.52 326.88 2086.4 326.91 2085.28 326.91C2043.04 326.91 2008.16 291.02 2008.16 247.54C2008.16 237.29 2010.12 227.53 2013.58 218.56C2024.8 189.44 2052.35 168.82 2084.64 168.82H2133.97V311.65Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1314.05 104.73H1264.72C1216.36 104.73 1173.81 130.21 1148.97 168.83C1137.18 187.17 1129.37 208.47 1126.86 231.42C1126.28 236.72 1125.98 242.1 1125.98 247.56C1125.98 253.02 1126.29 258.71 1126.91 264.15C1131.19 302.24 1150.05 335.76 1177.57 358.67C1180.5 361.27 1183.62 363.65 1186.88 365.81C1199.74 374.3 1214.99 379.28 1231.4 379.28C1249.39 379.28 1266.01 373.35 1279.56 363.31C1295.85 351.73 1308.44 334.77 1314.04 315.56V365.82H1313.93V376.9C1313.93 398.74 1308.22 415.17 1296.59 426.26C1284.98 437.34 1265.55 442.89 1238.34 442.89C1227.22 442.89 1209.55 442.3 1191.74 440.48C1188.91 440.19 1186.28 441.98 1185.47 444.7L1172.69 487.81C1171.67 491.27 1173.96 494.83 1177.52 495.34C1199.04 498.42 1220.04 500.02 1232.17 500.02C1281.08 500.02 1317.33 489.27 1341.06 467.81C1362.54 448.4 1374.21 418.92 1376.26 379.29V110.63C1376.26 107.37 1373.62 104.73 1370.36 104.73H1314.04H1314.05ZM1314.05 168.83C1314.05 168.83 1314.7 307.96 1314.05 312.19C1301.97 321.96 1286.94 325.78 1270.56 326.89C1270.4 326.9 1270.23 326.92 1270.07 326.93C1268.95 327 1267.83 327.03 1266.71 327.03C1265.39 327.03 1264.08 327 1262.77 326.93C1222.36 324.82 1188.25 289.67 1188.25 247.55C1188.25 237.3 1190.21 227.54 1193.67 218.57C1204.89 189.45 1232.44 168.83 1264.73 168.83H1314.06H1314.05Z"}),l.createElement("path",{d:"M249.83 0C113.3 0 2.00001 110.09 0.0300098 246.16C-1.96999 384.35 110.15 498.86 248.36 499.66C291.04 499.91 332.15 489.47 368.66 469.63C372.22 467.7 372.77 462.8 369.74 460.12L346.36 439.4C341.61 435.19 334.85 434 329 436.48C303.52 447.32 275.83 452.86 247.29 452.51C135.61 451.14 45.38 358.22 47.16 246.55C48.92 136.29 139.16 47.14 249.83 47.14H452.52V407.41L337.52 305.23C333.8 301.92 328.1 302.57 325.1 306.54C306.64 330.98 276.57 346.18 243.17 343.88C196.84 340.68 159.3 303.38 155.83 257.07C151.68 201.83 195.46 155.55 249.83 155.55C299.01 155.55 339.51 193.4 343.74 241.5C344.12 245.78 346.05 249.77 349.26 252.62L379.21 279.17C382.61 282.18 388 280.34 388.84 275.87C391 264.32 391.76 252.29 390.91 239.95C386.09 169.61 329.11 113.02 258.74 108.69C178.06 103.72 110.61 166.83 108.47 245.94C106.38 323.04 169.55 389.5 246.66 391.2C278.85 391.91 308.69 381.79 332.8 364.25L483.06 497.45C489.5 503.16 499.67 498.59 499.67 489.98V9.48C499.66 4.25 495.42 0 490.18 0H249.83Z"})),l.createElement("defs",null,l.createElement("clipPath",null,l.createElement("rect",{width:2196.2,height:500}))))},N=function(){return l.createElement("div",{className:"flex gap-4 px-4 h-11 items-center"},l.createElement("p",{className:"text-3xs text-tertiary inline-flex gap-2 items-center max-md-gutters:hidden"},l.createElement("kbd",null,"↵"),l.createElement("span",null,"to select")),l.createElement("p",{className:"text-3xs text-tertiary inline-flex gap-2 items-center max-md-gutters:hidden"},l.createElement("kbd",null,"↑"),l.createElement("kbd",null,"↓"),l.createElement("span",null,"to navigate")),l.createElement("p",{className:"text-3xs text-tertiary inline-flex gap-2 items-center max-md-gutters:hidden"},l.createElement("kbd",null,"esc"),l.createElement("span",null,"to close")),l.createElement("p",{className:"text-3xs text-tertiary inline-flex gap-2 items-center ml-auto"},l.createElement("span",null,"Search by"),l.createElement("a",{href:"https://www.algolia.com/developers/?utm_medium=referral&utm_content=powered_by&utm_source=expo.dev.com&utm_campaign=docsearch",target:"_blank"},l.createElement(y,null))))},b=function(e,t,n,r){return f(void 0,void 0,void 0,(function(){var l,a,c;return C(this,(function(o){switch(o.label){case 0:return[4,t(e,r).then((function(e){return e.json()}))];case 1:return l=o.sent(),a=l.hits,c=l.libraries,n(a||c||[]),[2]}}))}))},k=function(e,t,n,r,l,a){return void 0===a&&(a={}),["https://".concat(t,"-dsn.algolia.net/1/indexes/").concat(r,"/query"),{method:"POST",headers:{"X-Algolia-Application-Id":t,"X-Algolia-API-Key":n},body:JSON.stringify(v({params:"query=".concat(e,"&hitsPerPage=").concat(l),highlightPreTag:"<mark>",highlightPostTag:"</mark>"},a))}]},S=function(e,t){return fetch.apply(void 0,k(e,"QEX7PB7D46","6652d26570e8628af4601e1d78ad456b","expo",20,{facetFilters:[["version:none","version:".concat(t)]]}))},I=function(e){return fetch.apply(void 0,k(e,"8TDSE0OHGQ","c9c791d9d5fd7f315d7f3859b32c1f3b","react-native-v2",5,{facetFilters:[["version:current"]]}))},w=function(e){return fetch("https://reactnative.directory/api/libraries?search=".concat(encodeURI(e),"&limit=5"))},H=function(e,t){var n;return{dangerouslySetInnerHTML:{__html:(null===(n=e._highlightResult.hierarchy["".concat(t)])||void 0===n?void 0:n.value)||""}}},q=function(e,t){if(void 0===t&&(t=36),!e||!e.length)return"";var n=Math.max(e.indexOf("<mark>")-t,0),r=Math.min(e.indexOf("</mark>")+t+6,e.length);return"".concat(0!==n?"…":"").concat(e.substring(n,r).trim()).concat(r!==e.length?"…":"")},L=function(e,t){var n,r,l;return void 0===t&&(t=!1),t?{}:{dangerouslySetInnerHTML:{__html:(null===(n=e._highlightResult.content)||void 0===n?void 0:n.value)?q(null===(r=e._highlightResult.content)||void 0===r?void 0:r.value):q((null===(l=e._highlightResult.hierarchy.lvl1)||void 0===l?void 0:l.value)||"",82)}}},R=["/versions/","/more/"],M=function(e){return R.some((function(t){return e.includes(t)}))},_=["/app-signing/","/build/","/build-reference/","/development/","/eas/","/eas/metadata/","/eas-update/","/submit/"],V=function(e){return _.some((function(t){return e.includes(t)}))},P=["/get-started/","/develop/","/deploy/","/faq/","/core-concepts/","/debugging/","/config-plugins/"],K=function(e){return P.some((function(t){return e.includes(t)}))},F=["/tutorial","/ui-programming/","/additional-resources/"],O=function(e){return F.some((function(t){return e.includes(t)}))},T=function(){var e,t,n;return/(Mac|iPhone|iPod|iPad)/i.test(null!==(n=null!==(e=null===navigator||void 0===navigator?void 0:navigator.platform)&&void 0!==e?e:null===(t=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===t?void 0:t.platform)&&void 0!==n?n:"")},U=function(e,t){var n=e.toLowerCase().indexOf(t.toLowerCase());if(-1===n)return e;var r=n+t.length;return e.substring(0,n)+"<mark>"+e.substring(n,r)+"</mark>"+e.substring(r)},Z=function(t){var n=t.children,r=t.url,c=t.isExternalLink,o=t.isNested,i=t.onSelect,s=t.className,u=t.value,m=l.useState(!1),d=m[0],p=m[1];return l.createElement(e.Command.Item,{className:a.mergeClasses("relative",s),value:u,"data-nested":!!o||void 0,onMouseUp:function(e){1!==e.button&&2!==e.button||function(){var e;null===(e=navigator.clipboard)||void 0===e||e.writeText(r),p(!0),setTimeout((function(){return p(!1)}),1500)}()},onSelect:function(){!function(e,t){void 0===t&&(t=!1);var n=document.createElement("a");t&&(n.target="_blank",n.rel="noopener noreferrer"),n.href=e,n.click()}(r,c),i&&i()},onContextMenu:function(e){e.preventDefault()}},n,d&&l.createElement("div",{className:"text-2xs font-medium absolute rounded-full px-2 right-2.5 top-[calc(50%-13px)] border-secondary bg-info text-info"},"Copied!"))},A=new Intl.NumberFormat,D=function(e){var t=e.item,n=e.onSelect,r=e.query;return l.createElement(Z,{value:"rnd-".concat(t.npmPkg),url:t.githubUrl,isExternalLink:!0,onSelect:n},l.createElement("div",{className:"inline-flex gap-3 items-center"},l.createElement(i.GithubIcon,{className:"text-icon-secondary"}),l.createElement("div",null,l.createElement("p",{className:"text-xs font-medium",dangerouslySetInnerHTML:{__html:U(t.npmPkg,r)}}),l.createElement("p",{className:"text-3xs text-quaternary"},A.format(t.github.stats.stars)," stars · ",A.format(t.npm.downloads)," downloads")),l.createElement(x,null)))},G=function(e){var t=e.item,n=e.levelKey,r=void 0===n?"lvl0":n;return t.hierarchy[r]?l.createElement(l.Fragment,null,l.createElement(E,null),l.createElement("span",v({},H(t,r)))):null},B=function(e){var t=e.item,n=e.onSelect,r=t.hierarchy,a=r.lvl0,c=r.lvl1,o=r.lvl2,i=r.lvl3,s=r.lvl4;return l.createElement(Z,{value:"rn-".concat(t.objectID),url:t.url,isExternalLink:!0,onSelect:n},l.createElement("div",{className:"inline-flex gap-3 items-center"},l.createElement(h,{className:"shrink-0"}),l.createElement("div",null,s&&l.createElement(l.Fragment,null,l.createElement("p",v({className:"text-xs font-medium"},H(t,"lvl4"))),l.createElement("p",{className:"text-3xs text-quaternary"},l.createElement("span",v({},H(t,"lvl0"))),l.createElement(G,{item:t,levelKey:"lvl1"}),l.createElement(G,{item:t,levelKey:"lvl2"}),l.createElement(G,{item:t,levelKey:"lvl3"}))),!s&&i&&l.createElement(l.Fragment,null,l.createElement("p",v({className:"text-xs font-medium"},H(t,"lvl3"))),l.createElement("p",{className:"text-3xs text-quaternary"},l.createElement("span",v({},H(t,"lvl0"))),l.createElement(G,{item:t,levelKey:"lvl1"}),l.createElement(G,{item:t,levelKey:"lvl2"}))),!i&&o&&l.createElement(l.Fragment,null,l.createElement("p",v({className:"text-xs font-medium"},H(t,"lvl2"))),l.createElement("p",{className:"text-3xs text-quaternary"},l.createElement("span",v({},H(t,"lvl0"))),l.createElement(G,{item:t,levelKey:"lvl1"}))),!i&&!o&&c&&l.createElement(l.Fragment,null,l.createElement("p",v({className:"text-xs font-medium"},H(t,"lvl1"))),l.createElement("p",v({className:"text-3xs text-quaternary"},H(t,"lvl0")))),!i&&!o&&!c&&a&&l.createElement("p",v({className:"text-xs font-medium"},H(t,"lvl0"))),l.createElement("p",v({className:"text-2xs text-secondary"},L(t,!0)))),l.createElement(x,null)))},j=function(e){var t=e.url,n=e.className;return e.isNested?l.createElement(d.Hash02Icon,{className:a.mergeClasses("icon-sm text-icon-quaternary",n)}):M(t)?l.createElement(a.DocsLogo,{className:a.mergeClasses("text-icon-secondary",n)}):V(t)?l.createElement(s.PlanEnterpriseIcon,{className:a.mergeClasses("text-icon-secondary",n)}):K(t)?l.createElement(p.Home02Icon,{className:a.mergeClasses("text-icon-secondary",n)}):O(t)?l.createElement(m.GraduationHat02Icon,{className:a.mergeClasses("text-icon-secondary",n)}):l.createElement(u.BookOpen02Icon,{className:a.mergeClasses("text-icon-secondary",n)})},X=function(e){return M(e)?"Reference":V(e)?"Expo Application Services":K(e)?"Home":O(e)?"Learn":"Guides"},Q=function(e){var t=e.url,n=e.isNested;return void 0!==n&&n?l.createElement(l.Fragment,null,l.createElement("span",{className:"text-3xs text-quaternary"},X(t)),l.createElement(E,null)):l.createElement("p",{className:"text-3xs text-quaternary"},X(t))},W=function(e){var t=e.item,n=e.onSelect,r=e.isNested,c=e.transformUrl,o=t.hierarchy,i=o.lvl0,s=o.lvl2,u=o.lvl3,m=o.lvl4,d=o.lvl6,p=a.mergeClasses(r?"text-2xs":"text-xs font-medium"),f=a.mergeClasses("text-3xs text-quaternary",r&&"hidden");return l.createElement(Z,{className:a.mergeClasses(r&&"ml-8 !min-h-[32px]"),value:"expodocs-".concat(t.objectID),onSelect:n,url:c?c(t.url):t.url,isNested:r,isExternalLink:!c},l.createElement("div",{className:"flex gap-3 jutify-between"},l.createElement("div",{className:"inline-flex items-center gap-3 break-words"},l.createElement(j,{url:t.url,isNested:r,className:"shrink-0"}),l.createElement("div",null,d&&l.createElement(l.Fragment,null,l.createElement("p",v({className:p},H(t,"lvl6"))),!r&&l.createElement("p",{className:"text-3xs text-quaternary"},l.createElement(Q,{url:t.url,isNested:!0}),l.createElement("span",v({},H(t,"lvl0"))),l.createElement(G,{item:t,levelKey:"lvl2"}),l.createElement(G,{item:t,levelKey:"lvl3"}),l.createElement(G,{item:t,levelKey:"lvl4"}))),!d&&m&&l.createElement(l.Fragment,null,l.createElement("p",v({className:p},H(t,"lvl4"))),!r&&l.createElement("p",{className:f},l.createElement(Q,{url:t.url,isNested:!0}),l.createElement("span",v({},H(t,"lvl0"))),l.createElement(G,{item:t,levelKey:"lvl2"}),l.createElement(G,{item:t,levelKey:"lvl3"}))),!d&&!m&&u&&l.createElement(l.Fragment,null,l.createElement("p",v({className:p},H(t,"lvl3"))),!r&&l.createElement("p",{className:f},l.createElement(Q,{url:t.url,isNested:!0}),l.createElement("span",v({},H(t,"lvl0"))),l.createElement(G,{item:t,levelKey:"lvl2"}))),!d&&!m&&!u&&s&&l.createElement(l.Fragment,null,l.createElement("p",v({className:p},H(t,"lvl2"))),!r&&l.createElement("p",{className:f},l.createElement(Q,{url:t.url,isNested:!0}),l.createElement("span",v({},H(t,"lvl0"))))),!d&&!m&&!u&&!s&&i&&l.createElement(l.Fragment,null,l.createElement("p",v({className:p},H(t,"lvl0"))),l.createElement(Q,{url:t.url})),(!r||t.content)&&l.createElement("p",v({className:a.mergeClasses("text-secondary",r?"text-3xs":"text-2xs")},L(t))))),!c&&l.createElement(x,null)))},J=e.Command.Item;exports.CommandItemBase=J,exports.CommandItemBaseWithCopy=Z,exports.CommandMenu=function(a){var c=a.config,o=c.docsVersion,i=c.docsTransformUrl,s=a.open,u=a.setOpen,m=a.customSections,d=void 0===m?[]:m,p=l.useState(!1),E=p[0],x=p[1],h=l.useState(!0),y=h[0],k=h[1],H=l.useState(""),q=H[0],L=H[1],R=l.useState(null),M=R[0],_=R[1],V=l.useState([]),P=V[0],K=V[1],F=l.useState([]),O=F[0],U=F[1],Z=l.useState([]),A=Z[0],G=Z[1],j=function(){return u(!1)},X=function(e){Promise.all(function(e,t,n){if(n||2===arguments.length)for(var r,l=0,a=t.length;l<a;l++)!r&&l in t||(r||(r=Array.prototype.slice.call(t,0,l)),r[l]=t[l]);return e.concat(r||Array.prototype.slice.call(t))}([f(void 0,void 0,void 0,(function(){return C(this,(function(e){return[2,b(q,S,K,o)]}))})),f(void 0,void 0,void 0,(function(){return C(this,(function(e){return[2,b(q,I,U)]}))})),f(void 0,void 0,void 0,(function(){return C(this,(function(e){return[2,b(q,w,G)]}))}))],d.map((function(e){return e.getItemsAsync(q)})),!0)).then(e)};l.useEffect((function(){_("undefined"!=typeof navigator&&T())}),[]),l.useEffect((function(){if(null!==M){var e=function(e){"k"===e.key&&(M?e.metaKey:e.ctrlKey)&&(e.preventDefault(),u((function(e){return!e})))};return document.addEventListener("keydown",e,!1),function(){return document.removeEventListener("keydown",e)}}}),[M]),l.useEffect((function(){s&&!E&&X((function(){x(!0),k(!1)}))}),[s]),l.useEffect((function(){if(s){k(!0);var e=setTimeout((function(){return X((function(){return k(!1)}))}),150);return function(){return clearTimeout(e)}}}),[q]);var Q=r(P.map((function(e){return v(v({},e),{baseUrl:e.url.replace(/#.+/,"")})})),"baseUrl"),J=[P.length>0&&l.createElement(e.Command.Group,{heading:"Expo documentation",key:"expo-docs-group"},Object.values(Q).map((function(e){return e.sort((function(e,t){return e.url.localeCompare(e.baseUrl)-t.url.localeCompare(t.baseUrl)})).slice(0,6).map((function(e,t){return l.createElement(W,{isNested:0!==t,item:e,onSelect:j,key:"hit-expo-docs-".concat(e.objectID),transformUrl:i})}))}))),O.length>0&&l.createElement(e.Command.Group,{heading:"React Native documentation",key:"rn-docs-group"},O.map((function(e){return l.createElement(B,{item:e,onSelect:j,key:"hit-rn-docs-".concat(e.objectID)})}))),A.length>0&&l.createElement(e.Command.Group,{heading:"React Native directory",key:"rn-directory-group"},A.map((function(e){return l.createElement(D,{item:e,onSelect:j,key:"hit-rn-dir-".concat(e.npmPkg),query:q})})))];return null==d||d.forEach((function(t){var n=t.items,r=t.heading,a=t.sectionIndex;return n.length>0&&J.splice(a,0,l.createElement(e.Command.Group,{heading:r,key:"".concat(a,"-").concat(r)},n))})),l.createElement(e.Command.Dialog,{open:s,onOpenChange:u,label:"Search Menu",shouldFilter:!1},l.createElement(t.SearchSmIcon,{className:"text-icon-secondary absolute top-[29px] left-[29px] transition-opacity duration-200"}),l.createElement("div",{className:"absolute top-[25px] right-[25px] cursor-pointer p-1 rounded-sm hocus:bg-element"},l.createElement(n.XIcon,{className:"text-icon-secondary",onClick:function(){return u(!1)}})),l.createElement(e.Command.Input,{value:q,onValueChange:L,placeholder:"Search…"}),l.createElement(g,{isLoading:y}),l.createElement(e.Command.List,null,E&&J,0===J.filter(Boolean).length&&l.createElement(e.Command.Empty,{key:"no-results-group"},l.createElement("p",{className:"text-secondary text-xs"},"No results found."))),l.createElement(N,null))},exports.CommandMenuTrigger=function(e){var n=e.setOpen,r=e.className,c=l.useState(null),o=c[0],i=c[1];return l.useEffect((function(){i("undefined"!=typeof navigator&&T())}),[]),l.createElement(a.Button,{theme:"secondary",leftSlot:l.createElement(t.SearchSmIcon,{className:"icon-md text-icon-secondary"}),rightSlot:null!==o?l.createElement("div",{className:"ml-auto max-md-gutters:hidden"},l.createElement("kbd",{className:"!h-5 !leading-[19px]"},o?"⌘":"Ctrl")," ",l.createElement("kbd",{className:"!h-5 !leading-[19px]"},"K")):void 0,className:a.mergeClasses("cmdk-trigger bg-default pl-2.5 pr-3 border border-default shadow-xs min-h-[40px]",r),onClick:function(){return n(!0)}},l.createElement("p",{className:"text-secondary font-normal leading-normal text-xs"},"Search"))},exports.addHighlight=U;
1
+ "use strict";var e=require("cmdk"),t=require("@expo/styleguide-icons/outline/SearchSmIcon"),l=require("@expo/styleguide-icons/outline/XIcon"),a=require("lodash.groupby"),n=require("react"),r=require("@expo/styleguide"),s=require("@expo/styleguide-icons/outline/ArrowUpRightIcon"),c=require("@expo/styleguide-icons/outline/ChevronRightIcon"),m=require("@expo/styleguide-icons/custom/GithubIcon"),o=require("@sanity/client"),i=require("@sanity/image-url"),u=require("@expo/styleguide-icons/custom/PlanEnterpriseIcon"),d=require("@expo/styleguide-icons/outline/BookOpen02Icon"),p=require("@expo/styleguide-icons/outline/GraduationHat02Icon"),g=require("@expo/styleguide-icons/outline/Hash02Icon"),C=require("@expo/styleguide-icons/outline/Home02Icon");const E=({isLoading:e})=>n.createElement("div",{role:"progressbar",className:r.mergeClasses("bg-palette-blue9 h-0.5 absolute mt-[11px] left-px",e&&"animate-[searchUIBarLoader_2s_infinite_ease-in-out]")});function x(){return n.createElement(c.ChevronRightIcon,{className:"icon-xs text-icon-quaternary inline-block relative mx-1 -top-px"})}const h=()=>n.createElement(s.ArrowUpRightIcon,{className:"text-icon-tertiary self-center ml-auto shrink-0"}),v=({className:e})=>n.createElement("svg",{viewBox:"-11.5 -10.23174 23 20.46348",className:r.mergeClasses("icon-md text-icon-secondary",e)},n.createElement("circle",{cx:"0",cy:"0",r:"2.05",fill:"currentColor"}),n.createElement("g",{stroke:"currentColor",strokeWidth:"1",fill:"none"},n.createElement("ellipse",{rx:"11",ry:"4.2"}),n.createElement("ellipse",{rx:"11",ry:"4.2",transform:"rotate(60)"}),n.createElement("ellipse",{rx:"11",ry:"4.2",transform:"rotate(120)"}))),y=()=>n.createElement("svg",{width:"77",height:"19",viewBox:"0 0 2197 500",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-label":"Algolia",role:"img"},n.createElement("g",{clipPath:"url(#clip0_1_2)"},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1070.38 275.3V5.90999C1070.38 2.27998 1067.14 -0.480015 1063.56 0.0799852L1013.1 8.01999C1010.23 8.46999 1008.11 10.95 1008.11 13.86L1008.28 287.08C1008.28 300 1008.28 379.78 1104.25 382.57C1107.58 382.67 1110.34 379.99 1110.34 376.66V335.88C1110.34 332.92 1108.15 330.37 1105.22 330.04C1070.37 326.03 1070.37 282.47 1070.37 275.32L1070.38 275.3Z"}),n.createElement("path",{d:"M1902.56 104.73H1851.78C1848.52 104.73 1845.88 107.372 1845.88 110.63V376.73C1845.88 379.988 1848.52 382.63 1851.78 382.63H1902.56C1905.82 382.63 1908.46 379.988 1908.46 376.73V110.63C1908.46 107.372 1905.82 104.73 1902.56 104.73Z"}),n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1851.78 71.38H1902.55C1905.81 71.38 1908.45 68.74 1908.45 65.48V5.90001C1908.45 2.28001 1905.21 -0.489988 1901.63 0.0700121L1850.86 8.02001C1847.99 8.47001 1845.87 10.94 1845.87 13.85V65.47C1845.87 68.73 1848.51 71.37 1851.77 71.37L1851.78 71.38Z"}),n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1764.03 275.3V5.90999C1764.03 2.27998 1760.79 -0.480015 1757.21 0.0799852L1706.75 8.01999C1703.88 8.46999 1701.76 10.95 1701.76 13.86L1701.93 287.08C1701.93 300 1701.93 379.78 1797.9 382.57C1801.23 382.67 1803.99 379.99 1803.99 376.66V335.88C1803.99 332.92 1801.8 330.37 1798.87 330.04C1764.02 326.03 1764.02 282.47 1764.02 275.32L1764.03 275.3Z"}),n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1631.95 142.72C1620.81 130.47 1607.12 121.07 1591.17 114.41C1575.25 107.88 1557.91 104.56 1539.1 104.56C1520.32 104.56 1502.95 107.73 1487.18 114.41C1471.59 121.07 1457.89 130.46 1446.42 142.72C1434.95 154.95 1426.04 169.59 1419.66 186.75C1413.28 203.92 1410.42 224.12 1410.42 245.11C1410.42 266.1 1413.61 281.98 1419.97 299.32C1426.35 316.64 1435.11 331.43 1446.42 343.68C1457.71 355.91 1471.25 365.3 1487.02 372.14C1502.79 378.97 1527.14 382.47 1539.42 382.62C1551.67 382.62 1576.2 378.8 1592.12 372.14C1608.04 365.46 1621.58 355.91 1632.9 343.68C1644.19 331.43 1652.95 316.64 1659.15 299.32C1665.37 281.98 1668.39 266.1 1668.39 245.11C1668.39 224.12 1665.05 203.92 1658.36 186.75C1651.98 169.58 1643.22 154.95 1631.93 142.72H1631.95ZM1587.52 306.47C1576.05 322.22 1559.96 330.17 1539.43 330.17C1518.88 330.17 1502.8 322.37 1491.33 306.47C1479.86 290.72 1474.12 272.46 1474.12 245.27C1474.12 218.38 1479.71 196.13 1491.18 180.4C1502.63 164.65 1518.72 156.88 1539.25 156.88C1559.8 156.88 1575.88 164.66 1587.34 180.4C1598.81 195.97 1604.7 218.38 1604.7 245.27C1604.7 272.46 1598.98 290.57 1587.51 306.47H1587.52Z"}),n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M894.42 104.73H845.09C796.73 104.73 754.18 130.21 729.34 168.83C714.82 191.41 706.35 218.46 706.35 247.56C706.35 292.45 726.48 332.48 757.94 358.66C760.87 361.26 763.99 363.64 767.25 365.8C780.11 374.29 795.36 379.27 811.77 379.27C813 379.27 814.23 379.24 815.45 379.18C815.81 379.16 816.16 379.13 816.52 379.11C817.39 379.06 818.27 379 819.14 378.91C819.48 378.88 819.82 378.83 820.16 378.79C821.07 378.69 821.98 378.58 822.89 378.45C823.1 378.42 823.31 378.38 823.52 378.35C856.41 373.28 885.08 347.53 894.42 315.54V373.37C894.42 376.63 897.06 379.27 900.32 379.27H950.74C954 379.27 956.64 376.63 956.64 373.37V110.63C956.64 107.37 954 104.73 950.74 104.73H894.42ZM894.42 311.65C882.22 321.81 866.45 325.63 849.58 326.77C849.42 326.78 849.25 326.8 849.09 326.81C847.97 326.88 846.85 326.91 845.73 326.91C803.49 326.91 768.61 291.02 768.61 247.54C768.61 237.29 770.57 227.53 774.03 218.56C785.25 189.44 812.8 168.82 845.09 168.82H894.42V311.65Z"}),n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2133.97 104.73H2084.64C2036.28 104.73 1993.73 130.21 1968.89 168.83C1954.37 191.41 1945.9 218.46 1945.9 247.56C1945.9 292.45 1966.03 332.48 1997.49 358.66C2000.42 361.26 2003.54 363.64 2006.8 365.8C2019.66 374.29 2034.91 379.27 2051.32 379.27C2052.55 379.27 2053.78 379.24 2055 379.18C2055.36 379.16 2055.71 379.13 2056.07 379.11C2056.94 379.06 2057.82 379 2058.69 378.91C2059.03 378.88 2059.37 378.83 2059.71 378.79C2060.62 378.69 2061.53 378.58 2062.44 378.45C2062.65 378.42 2062.86 378.38 2063.07 378.35C2095.96 373.28 2124.63 347.53 2133.97 315.54V373.37C2133.97 376.63 2136.61 379.27 2139.87 379.27H2190.29C2193.55 379.27 2196.19 376.63 2196.19 373.37V110.63C2196.19 107.37 2193.55 104.73 2190.29 104.73H2133.97ZM2133.97 311.65C2121.77 321.81 2106 325.63 2089.13 326.77C2088.97 326.78 2088.8 326.8 2088.64 326.81C2087.52 326.88 2086.4 326.91 2085.28 326.91C2043.04 326.91 2008.16 291.02 2008.16 247.54C2008.16 237.29 2010.12 227.53 2013.58 218.56C2024.8 189.44 2052.35 168.82 2084.64 168.82H2133.97V311.65Z"}),n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1314.05 104.73H1264.72C1216.36 104.73 1173.81 130.21 1148.97 168.83C1137.18 187.17 1129.37 208.47 1126.86 231.42C1126.28 236.72 1125.98 242.1 1125.98 247.56C1125.98 253.02 1126.29 258.71 1126.91 264.15C1131.19 302.24 1150.05 335.76 1177.57 358.67C1180.5 361.27 1183.62 363.65 1186.88 365.81C1199.74 374.3 1214.99 379.28 1231.4 379.28C1249.39 379.28 1266.01 373.35 1279.56 363.31C1295.85 351.73 1308.44 334.77 1314.04 315.56V365.82H1313.93V376.9C1313.93 398.74 1308.22 415.17 1296.59 426.26C1284.98 437.34 1265.55 442.89 1238.34 442.89C1227.22 442.89 1209.55 442.3 1191.74 440.48C1188.91 440.19 1186.28 441.98 1185.47 444.7L1172.69 487.81C1171.67 491.27 1173.96 494.83 1177.52 495.34C1199.04 498.42 1220.04 500.02 1232.17 500.02C1281.08 500.02 1317.33 489.27 1341.06 467.81C1362.54 448.4 1374.21 418.92 1376.26 379.29V110.63C1376.26 107.37 1373.62 104.73 1370.36 104.73H1314.04H1314.05ZM1314.05 168.83C1314.05 168.83 1314.7 307.96 1314.05 312.19C1301.97 321.96 1286.94 325.78 1270.56 326.89C1270.4 326.9 1270.23 326.92 1270.07 326.93C1268.95 327 1267.83 327.03 1266.71 327.03C1265.39 327.03 1264.08 327 1262.77 326.93C1222.36 324.82 1188.25 289.67 1188.25 247.55C1188.25 237.3 1190.21 227.54 1193.67 218.57C1204.89 189.45 1232.44 168.83 1264.73 168.83H1314.06H1314.05Z"}),n.createElement("path",{d:"M249.83 0C113.3 0 2.00001 110.09 0.0300098 246.16C-1.96999 384.35 110.15 498.86 248.36 499.66C291.04 499.91 332.15 489.47 368.66 469.63C372.22 467.7 372.77 462.8 369.74 460.12L346.36 439.4C341.61 435.19 334.85 434 329 436.48C303.52 447.32 275.83 452.86 247.29 452.51C135.61 451.14 45.38 358.22 47.16 246.55C48.92 136.29 139.16 47.14 249.83 47.14H452.52V407.41L337.52 305.23C333.8 301.92 328.1 302.57 325.1 306.54C306.64 330.98 276.57 346.18 243.17 343.88C196.84 340.68 159.3 303.38 155.83 257.07C151.68 201.83 195.46 155.55 249.83 155.55C299.01 155.55 339.51 193.4 343.74 241.5C344.12 245.78 346.05 249.77 349.26 252.62L379.21 279.17C382.61 282.18 388 280.34 388.84 275.87C391 264.32 391.76 252.29 390.91 239.95C386.09 169.61 329.11 113.02 258.74 108.69C178.06 103.72 110.61 166.83 108.47 245.94C106.38 323.04 169.55 389.5 246.66 391.2C278.85 391.91 308.69 381.79 332.8 364.25L483.06 497.45C489.5 503.16 499.67 498.59 499.67 489.98V9.48C499.66 4.25 495.42 0 490.18 0H249.83Z"})),n.createElement("defs",null,n.createElement("clipPath",null,n.createElement("rect",{width:2196.2,height:500})))),f=()=>n.createElement("div",{className:"flex gap-4 px-4 h-11 items-center"},n.createElement("p",{className:"text-3xs text-tertiary inline-flex gap-2 items-center max-md-gutters:hidden"},n.createElement("kbd",null,"↵"),n.createElement("span",null,"to select")),n.createElement("p",{className:"text-3xs text-tertiary inline-flex gap-2 items-center max-md-gutters:hidden"},n.createElement("kbd",null,"↑"),n.createElement("kbd",null,"↓"),n.createElement("span",null,"to navigate")),n.createElement("p",{className:"text-3xs text-tertiary inline-flex gap-2 items-center max-md-gutters:hidden"},n.createElement("kbd",null,"esc"),n.createElement("span",null,"to close")),n.createElement("p",{className:"text-3xs text-tertiary inline-flex gap-2 items-center ml-auto"},n.createElement("span",null,"Search by"),n.createElement("a",{href:"https://www.algolia.com/developers/?utm_medium=referral&utm_content=powered_by&utm_source=expo.dev.com&utm_campaign=docsearch",target:"_blank"},n.createElement(y,null)))),N=o.createClient({projectId:"siias52v",dataset:"production",useCdn:!0,apiVersion:"2024-09-03"}),b=i({projectId:"siias52v",dataset:"production"});const k=async(e,t,l,a)=>{const{hits:n,libraries:r}=await t(e,a).then((e=>e.json()));l(n||r||[])},I=(e,t,l,a,n,r={})=>[`https://${t}-dsn.algolia.net/1/indexes/${a}/query`,{method:"POST",headers:{"X-Algolia-Application-Id":t,"X-Algolia-API-Key":l},body:JSON.stringify({params:`query=${e}&hitsPerPage=${n}`,highlightPreTag:"<mark>",highlightPostTag:"</mark>",...r})}],S=(e,t)=>fetch(...I(e,"QEX7PB7D46","6652d26570e8628af4601e1d78ad456b","expo",20,{facetFilters:[["version:none",`version:${t}`]]})),q=e=>fetch(...I(e,"8TDSE0OHGQ","c9c791d9d5fd7f315d7f3859b32c1f3b","react-native-v2",5,{facetFilters:[["version:current"]]})),H=e=>N.fetch(`*[_type == "post" && (title match "${e}*" || metadataDescription match "${e}*")] | order(publishAt desc)[0...10] {\n title,\n slug,\n tags,\n metadataDescription,\n mainImage\n }`),L=e=>fetch(`https://reactnative.directory/api/libraries?search=${encodeURI(e)}&limit=5`),_=(e,t)=>({dangerouslySetInnerHTML:{__html:e._highlightResult.hierarchy[`${t}`]?.value||""}}),w=(e,t=36)=>{if(!e||!e.length)return"";const l=Math.max(e.indexOf("<mark>")-t,0),a=Math.min(e.indexOf("</mark>")+t+6,e.length);return`${0!==l?"…":""}${e.substring(l,a).trim()}${a!==e.length?"…":""}`},M=(e,t=!1)=>t?{}:{dangerouslySetInnerHTML:{__html:e._highlightResult.content?.value?w(e._highlightResult.content?.value):w(e._highlightResult.hierarchy.lvl1?.value||"",82)}},R=["/versions/","/more/"],$=e=>R.some((t=>e.includes(t))),V=["/app-signing/","/build/","/build-reference/","/development/","/eas/","/eas/metadata/","/eas-update/","/submit/"],P=e=>V.some((t=>e.includes(t))),K=["/get-started/","/develop/","/deploy/","/faq/","/core-concepts/","/debugging/","/config-plugins/"],T=e=>K.some((t=>e.includes(t))),F=["/tutorial","/ui-programming/","/additional-resources/"],D=e=>F.some((t=>e.includes(t))),U=()=>/(Mac|iPhone|iPod|iPad)/i.test(navigator?.platform??navigator?.userAgentData?.platform??""),Z=(e,t)=>{if(!e||!e.length)return"";const l=e.toLowerCase().indexOf(t.toLowerCase());if(-1===l)return e;const a=l+t.length;return e.substring(0,l)+"<mark>"+e.substring(l,a)+"</mark>"+e.substring(a)},O=({children:t,url:l,isExternalLink:a,isNested:s,onSelect:c,className:m,value:o})=>{const[i,u]=n.useState(!1);return n.createElement(e.Command.Item,{className:r.mergeClasses("relative",m),value:o,"data-nested":!!s||void 0,onMouseUp:e=>{1!==e.button&&2!==e.button||(navigator.clipboard?.writeText(l),u(!0),setTimeout((()=>u(!1)),1500))},onSelect:()=>{((e,t=!1)=>{const l=document.createElement("a");t&&(l.target="_blank",l.rel="noopener noreferrer"),l.href=e,l.click()})(l,a),c&&c()},onContextMenu:e=>{e.preventDefault()}},t,i&&n.createElement("div",{className:"text-2xs font-medium absolute rounded-full px-2 right-2.5 top-[calc(50%-13px)] border-secondary bg-info text-info"},"Copied!"))},A=new Intl.NumberFormat,G=({item:e,onSelect:t,query:l})=>n.createElement(O,{value:`rnd-${e.npmPkg}`,url:e.githubUrl,isExternalLink:!0,onSelect:t},n.createElement("div",{className:"inline-flex gap-3 items-center"},n.createElement(m.GithubIcon,{className:"text-icon-secondary"}),n.createElement("div",null,n.createElement("p",{className:"text-xs font-medium",dangerouslySetInnerHTML:{__html:Z(e.npmPkg,l)}}),n.createElement("p",{className:"text-3xs text-quaternary"},A.format(e.github.stats.stars)," stars · ",A.format(e.npm.downloads)," downloads")),n.createElement(h,null))),j=({item:e,levelKey:t="lvl0"})=>e.hierarchy[t]?n.createElement(n.Fragment,null,n.createElement(x,null),n.createElement("span",{..._(e,t)})):null,B=({item:e,onSelect:t})=>{const{lvl0:l,lvl1:a,lvl2:r,lvl3:s,lvl4:c}=e.hierarchy;return n.createElement(O,{value:`rn-${e.objectID}`,url:e.url,isExternalLink:!0,onSelect:t},n.createElement("div",{className:"inline-flex gap-3 items-center"},n.createElement(v,{className:"shrink-0"}),n.createElement("div",null,c&&n.createElement(n.Fragment,null,n.createElement("p",{className:"text-xs font-medium",..._(e,"lvl4")}),n.createElement("p",{className:"text-3xs text-quaternary"},n.createElement("span",{..._(e,"lvl0")}),n.createElement(j,{item:e,levelKey:"lvl1"}),n.createElement(j,{item:e,levelKey:"lvl2"}),n.createElement(j,{item:e,levelKey:"lvl3"}))),!c&&s&&n.createElement(n.Fragment,null,n.createElement("p",{className:"text-xs font-medium",..._(e,"lvl3")}),n.createElement("p",{className:"text-3xs text-quaternary"},n.createElement("span",{..._(e,"lvl0")}),n.createElement(j,{item:e,levelKey:"lvl1"}),n.createElement(j,{item:e,levelKey:"lvl2"}))),!s&&r&&n.createElement(n.Fragment,null,n.createElement("p",{className:"text-xs font-medium",..._(e,"lvl2")}),n.createElement("p",{className:"text-3xs text-quaternary"},n.createElement("span",{..._(e,"lvl0")}),n.createElement(j,{item:e,levelKey:"lvl1"}))),!s&&!r&&a&&n.createElement(n.Fragment,null,n.createElement("p",{className:"text-xs font-medium",..._(e,"lvl1")}),n.createElement("p",{className:"text-3xs text-quaternary",..._(e,"lvl0")})),!s&&!r&&!a&&l&&n.createElement("p",{className:"text-xs font-medium",..._(e,"lvl0")}),n.createElement("p",{className:"text-2xs text-secondary",...M(e,!0)})),n.createElement(h,null)))},X=({url:e,className:t,isNested:l})=>l?n.createElement(g.Hash02Icon,{className:r.mergeClasses("icon-sm text-icon-quaternary",t)}):$(e)?n.createElement(r.DocsLogo,{className:r.mergeClasses("text-icon-secondary",t)}):P(e)?n.createElement(u.PlanEnterpriseIcon,{className:r.mergeClasses("text-icon-secondary",t)}):T(e)?n.createElement(C.Home02Icon,{className:r.mergeClasses("text-icon-secondary",t)}):D(e)?n.createElement(p.GraduationHat02Icon,{className:r.mergeClasses("text-icon-secondary",t)}):n.createElement(d.BookOpen02Icon,{className:r.mergeClasses("text-icon-secondary",t)}),Q=e=>$(e)?"Reference":P(e)?"Expo Application Services":T(e)?"Home":D(e)?"Learn":"Guides",W=({url:e,isNested:t=!1})=>t?n.createElement(n.Fragment,null,n.createElement("span",{className:"text-3xs text-quaternary"},Q(e)),n.createElement(x,null)):n.createElement("p",{className:"text-3xs text-quaternary"},Q(e)),z=({item:e,onSelect:t,isNested:l,transformUrl:a})=>{const{lvl0:s,lvl2:c,lvl3:m,lvl4:o,lvl6:i}=e.hierarchy,u=r.mergeClasses(l?"text-2xs":"text-xs font-medium"),d=r.mergeClasses("text-3xs text-quaternary",l&&"hidden");return n.createElement(O,{className:r.mergeClasses(l&&"ml-8 !min-h-[32px]"),value:`expodocs-${e.objectID}`,onSelect:t,url:a?a(e.url):e.url,isNested:l,isExternalLink:!a},n.createElement("div",{className:"flex gap-3 jutify-between"},n.createElement("div",{className:"inline-flex items-center gap-3 break-words"},n.createElement(X,{url:e.url,isNested:l,className:"shrink-0"}),n.createElement("div",null,i&&n.createElement(n.Fragment,null,n.createElement("p",{className:u,..._(e,"lvl6")}),!l&&n.createElement("p",{className:"text-3xs text-quaternary"},n.createElement(W,{url:e.url,isNested:!0}),n.createElement("span",{..._(e,"lvl0")}),n.createElement(j,{item:e,levelKey:"lvl2"}),n.createElement(j,{item:e,levelKey:"lvl3"}),n.createElement(j,{item:e,levelKey:"lvl4"}))),!i&&o&&n.createElement(n.Fragment,null,n.createElement("p",{className:u,..._(e,"lvl4")}),!l&&n.createElement("p",{className:d},n.createElement(W,{url:e.url,isNested:!0}),n.createElement("span",{..._(e,"lvl0")}),n.createElement(j,{item:e,levelKey:"lvl2"}),n.createElement(j,{item:e,levelKey:"lvl3"}))),!i&&!o&&m&&n.createElement(n.Fragment,null,n.createElement("p",{className:u,..._(e,"lvl3")}),!l&&n.createElement("p",{className:d},n.createElement(W,{url:e.url,isNested:!0}),n.createElement("span",{..._(e,"lvl0")}),n.createElement(j,{item:e,levelKey:"lvl2"}))),!i&&!o&&!m&&c&&n.createElement(n.Fragment,null,n.createElement("p",{className:u,..._(e,"lvl2")}),!l&&n.createElement("p",{className:d},n.createElement(W,{url:e.url,isNested:!0}),n.createElement("span",{..._(e,"lvl0")}))),!i&&!o&&!m&&!c&&s&&n.createElement(n.Fragment,null,n.createElement("p",{className:u,..._(e,"lvl0")}),n.createElement(W,{url:e.url})),(!l||e.content)&&n.createElement("p",{className:r.mergeClasses("text-secondary",l?"text-3xs":"text-2xs"),...M(e)}))),!a&&n.createElement(h,null)))},J=({item:e,onSelect:t,query:l})=>{return n.createElement(O,{value:`expo-blog-${e.slug.current}`,url:`https://expo.dev/blog/${e.slug.current}`,isExternalLink:!0,onSelect:t},n.createElement("div",{className:"inline-flex gap-3 items-center"},n.createElement("img",{src:(a=e.mainImage.image.asset._ref,b.image(a).auto("format").height(150).url()),alt:e.mainImage.altText,className:"size-11 object-cover rounded-md my-0.5"}),n.createElement("div",null,n.createElement("p",{className:"text-xs font-medium",dangerouslySetInnerHTML:{__html:Z(e.title,l)}}),n.createElement("p",{className:"text-3xs text-quaternary",dangerouslySetInnerHTML:{__html:Z(e.metadataDescription,l)}})),n.createElement(h,null)));var a},Y=e.Command.Item;exports.CommandItemBase=Y,exports.CommandItemBaseWithCopy=O,exports.CommandMenu=({config:{docsVersion:r,docsTransformUrl:s},open:c,setOpen:m,customSections:o=[]})=>{const[i,u]=n.useState(!1),[d,p]=n.useState(!0),[g,C]=n.useState(""),[x,h]=n.useState(null),[v,y]=n.useState([]),[N,b]=n.useState([]),[I,_]=n.useState([]),[w,M]=n.useState([]),R=async()=>k(g,S,y,r),$=async()=>(async(e,t,l)=>{l(await t(e))})(g,H,b),V=async()=>k(g,q,_),P=async()=>k(g,L,M),K=()=>m(!1),T=e=>{Promise.all([R(),$(),V(),P(),...o?.map((e=>e.getItemsAsync(g)))]).then(e)};n.useEffect((()=>{h("undefined"!=typeof navigator&&U())}),[]),n.useEffect((()=>{if(null!==x){const e=e=>{"k"===e.key&&(x?e.metaKey:e.ctrlKey)&&(e.preventDefault(),m((e=>!e)))};return document.addEventListener("keydown",e,!1),()=>document.removeEventListener("keydown",e)}}),[x]),n.useEffect((()=>{c&&!i&&T((()=>{u(!0),p(!1)}))}),[c]),n.useEffect((()=>{if(c){p(!0);const e=setTimeout((()=>T((()=>p(!1)))),150);return()=>clearTimeout(e)}}),[g]);const F=a(v.map((e=>({...e,baseUrl:e.url.replace(/#.+/,"")}))),"baseUrl"),D=[v.length>0&&n.createElement(e.Command.Group,{heading:"Expo documentation",key:"expo-docs-group"},Object.values(F).map((e=>e.sort(((e,t)=>e.url.localeCompare(e.baseUrl)-t.url.localeCompare(t.baseUrl))).slice(0,6).map(((e,t)=>n.createElement(z,{isNested:0!==t,item:e,onSelect:K,key:`hit-expo-docs-${e.objectID}`,transformUrl:s})))))),N.length>0&&n.createElement(e.Command.Group,{heading:"Expo blog",key:"expo-blog-group"},N.map((e=>n.createElement(J,{item:e,onSelect:K,key:`hit-expo-blog-${e.slug.current}`,query:g})))),I.length>0&&n.createElement(e.Command.Group,{heading:"React Native documentation",key:"rn-docs-group"},I.map((e=>n.createElement(B,{item:e,onSelect:K,key:`hit-rn-docs-${e.objectID}`})))),w.length>0&&n.createElement(e.Command.Group,{heading:"React Native directory",key:"rn-directory-group"},w.map((e=>n.createElement(G,{item:e,onSelect:K,key:`hit-rn-dir-${e.npmPkg}`,query:g}))))];return o?.forEach((({items:t,heading:l,sectionIndex:a})=>t.length>0&&D.splice(a,0,n.createElement(e.Command.Group,{heading:l,key:`${a}-${l}`},t)))),n.createElement(e.Command.Dialog,{open:c,onOpenChange:m,label:"Search Menu",shouldFilter:!1},n.createElement(t.SearchSmIcon,{className:"text-icon-secondary absolute top-[29px] left-[29px] transition-opacity duration-200"}),n.createElement("div",{className:"absolute top-[25px] right-[25px] cursor-pointer p-1 rounded-sm hocus:bg-element"},n.createElement(l.XIcon,{className:"text-icon-secondary",onClick:()=>m(!1)})),n.createElement(e.Command.Input,{value:g,onValueChange:C,placeholder:"Search…"}),n.createElement(E,{isLoading:d}),n.createElement(e.Command.List,null,i&&D,0===D.filter(Boolean).length&&n.createElement(e.Command.Empty,{key:"no-results-group"},n.createElement("p",{className:"text-secondary text-xs"},"No results found."))),n.createElement(f,null))},exports.CommandMenuTrigger=({setOpen:e,className:l})=>{const[a,s]=n.useState(null);return n.useEffect((()=>{s("undefined"!=typeof navigator&&U())}),[]),n.createElement(r.Button,{theme:"secondary",leftSlot:n.createElement(t.SearchSmIcon,{className:"icon-md text-icon-secondary"}),rightSlot:null!==a?n.createElement("div",{className:"ml-auto max-md-gutters:hidden"},n.createElement("kbd",{className:"!h-5 !leading-[19px]"},a?"⌘":"Ctrl")," ",n.createElement("kbd",{className:"!h-5 !leading-[19px]"},"K")):void 0,className:r.mergeClasses("cmdk-trigger bg-default pl-2.5 pr-3 border border-default shadow-xs min-h-[40px]",l),onClick:()=>e(!0)},n.createElement("p",{className:"text-secondary font-normal leading-normal text-xs"},"Search"))},exports.addHighlight=Z;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ExpoBlogItemType } from '../types';
3
+ type Props = {
4
+ item: ExpoBlogItemType;
5
+ query: string;
6
+ onSelect?: () => void;
7
+ };
8
+ export declare const ExpoBlogItem: ({ item, onSelect, query }: Props) => React.JSX.Element;
9
+ export {};
@@ -45,3 +45,19 @@ export type RNDirectoryItemType = {
45
45
  };
46
46
  };
47
47
  };
48
+ export type ExpoBlogItemType = {
49
+ title: string;
50
+ tags: string[];
51
+ metadataDescription: string;
52
+ slug: {
53
+ current: string;
54
+ };
55
+ mainImage: {
56
+ altText: string;
57
+ image: {
58
+ asset: {
59
+ _ref: string;
60
+ };
61
+ };
62
+ };
63
+ };
@@ -1,8 +1,13 @@
1
+ import { ClientReturn } from '@sanity/client';
1
2
  import type { Dispatch, SetStateAction } from 'react';
2
3
  import type { AlgoliaItemHierarchy, AlgoliaItemType } from './types';
4
+ export declare const SANITY_CLIENT: import("@sanity/client").SanityClient;
5
+ export declare function getSanityAsset(source: string): string;
3
6
  export declare const getItemsAsync: <T>(query: string, fetcher: (query: string, version?: string) => Promise<Response>, setter: Dispatch<SetStateAction<T[]>>, version?: string) => Promise<void>;
7
+ export declare const getSanityItemsAsync: <T>(query: string, fetcher: (query: string, version?: string) => Promise<ClientReturn<any>>, setter: Dispatch<SetStateAction<T[]>>) => Promise<void>;
4
8
  export declare const getExpoDocsResults: (query: string, version?: string) => Promise<Response>;
5
9
  export declare const getRNDocsResults: (query: string) => Promise<Response>;
10
+ export declare const getExpoBlogResults: (query: string) => Promise<any>;
6
11
  export declare const getDirectoryResults: (query: string) => Promise<Response>;
7
12
  export declare const getHighlightHTML: (item: AlgoliaItemType, tag: keyof AlgoliaItemHierarchy<string>) => {
8
13
  dangerouslySetInnerHTML: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/styleguide-search-ui",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Expo's common search component for use on the web.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,14 +28,16 @@
28
28
  "url": "https://github.com/expo/styleguide/issues"
29
29
  },
30
30
  "dependencies": {
31
- "@expo/styleguide": "^8.2.4",
32
- "@expo/styleguide-icons": "^2.0.0",
33
- "cmdk": "^0.2.0",
31
+ "@expo/styleguide": "^8.2.6",
32
+ "@expo/styleguide-icons": "^2.0.1",
33
+ "@sanity/client": "^6.21.3",
34
+ "@sanity/image-url": "^1.0.2",
35
+ "cmdk": "^0.2.1",
34
36
  "lodash.groupby": "^4.6.0"
35
37
  },
36
38
  "devDependencies": {
37
39
  "@types/lodash.groupby": "^4.6.9",
38
- "tailwindcss": "^3.4.4",
40
+ "tailwindcss": "^3.4.10",
39
41
  "user-agent-data-types": "^0.4.2"
40
42
  },
41
43
  "peerDependencies": {
@@ -45,5 +47,5 @@
45
47
  "eslintConfig": {
46
48
  "extends": "universe/web"
47
49
  },
48
- "gitHead": "f76cb26921122d10824ad97a3a1adc5357b0700b"
50
+ "gitHead": "a12ce15e2c112cee1aca9aab01c29fbd7128f9be"
49
51
  }