@acusti/uikit-docs 0.2.0 → 0.3.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 (84) hide show
  1. package/.storybook/main.ts +4 -8
  2. package/.storybook/manager.ts +1 -1
  3. package/.storybook/preview.ts +1 -1
  4. package/CHANGELOG.md +26 -0
  5. package/dist/assets/CSSValueInput-BgAgo3f9.css +1 -0
  6. package/dist/assets/CSSValueInput-BoZriUnh.js +1 -0
  7. package/dist/assets/CSSValueInput.stories-D1VcYZJ0.js +113 -0
  8. package/dist/assets/Color-AVL7NMMY-BeW0C7pE.js +1 -0
  9. package/dist/assets/DatePicker-l5oaNCVE.css +1 -0
  10. package/dist/assets/DatePicker.stories-BSWV31FV.js +244 -0
  11. package/dist/assets/DocsRenderer-PQXLIZUC-D92GwNti.js +2 -0
  12. package/dist/assets/Dropdown-D5cyjefk.css +1 -0
  13. package/dist/assets/Dropdown-DUP_ybXe.js +84 -0
  14. package/dist/assets/Dropdown.stories-2Wtw1otE.js +336 -0
  15. package/dist/assets/InputText-Tkbh5amB.css +1 -0
  16. package/dist/assets/InputText.stories-BYt2Aj0_.js +90 -0
  17. package/dist/assets/Introduction-nSE2hjmb.js +183 -0
  18. package/dist/assets/MonthCalendar.stories-IJrL6wIl.js +169 -0
  19. package/dist/assets/accessibility-W_h2acOZ.png +0 -0
  20. package/dist/assets/addon-library-BWUCAmyN.png +0 -0
  21. package/dist/assets/blocks-Du178fXa.js +658 -0
  22. package/dist/assets/client-B2qWCcIR.js +25 -0
  23. package/dist/assets/clsx-hXifHU8N.js +9 -0
  24. package/dist/assets/context-C0qIqeS4.png +0 -0
  25. package/dist/assets/docs---vsFbMi.png +0 -0
  26. package/dist/assets/figma-plugin-CH2hELiO.png +0 -0
  27. package/dist/assets/iframe-ByGa_ItU.js +1102 -0
  28. package/dist/assets/index-BRXcJgsA.js +1 -0
  29. package/dist/assets/index-BVajFqaV.js +1 -0
  30. package/dist/assets/index-DwJ-mRZ2.js +9 -0
  31. package/dist/assets/jsx-runtime-D_zvdyIk.js +9 -0
  32. package/dist/assets/react-18-djOrgGe8.js +1 -0
  33. package/dist/assets/share-DGA-UcQf.png +0 -0
  34. package/dist/assets/styling-Bk6zjRzU.png +0 -0
  35. package/dist/assets/testing-cbzR9l9r.png +0 -0
  36. package/dist/assets/theming-D6WJLNoW.png +0 -0
  37. package/dist/assets/useIsOutOfBounds--pZPDsvJ.css +1 -0
  38. package/dist/assets/useIsOutOfBounds.stories-e48KZd_G.js +105 -0
  39. package/dist/assets/useKeyboardEvents-BH4Zd7d3.css +1 -0
  40. package/dist/assets/useKeyboardEvents.stories-CJbDuGfk.js +3 -0
  41. package/dist/favicon.svg +1 -0
  42. package/dist/iframe.html +685 -0
  43. package/dist/index.html +152 -0
  44. package/dist/index.json +1 -0
  45. package/dist/nunito-sans-bold-italic.woff2 +0 -0
  46. package/dist/nunito-sans-bold.woff2 +0 -0
  47. package/dist/nunito-sans-italic.woff2 +0 -0
  48. package/dist/nunito-sans-regular.woff2 +0 -0
  49. package/dist/project.json +1 -0
  50. package/dist/sb-addons/docs-1/manager-bundle.js +151 -0
  51. package/dist/sb-addons/storybook-2/manager-bundle.js +3 -0
  52. package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +188 -0
  53. package/dist/sb-common-assets/favicon.svg +1 -0
  54. package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  55. package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  56. package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  57. package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  58. package/dist/sb-manager/globals-module-info.js +797 -0
  59. package/dist/sb-manager/globals-runtime.js +72053 -0
  60. package/dist/sb-manager/globals.js +34 -0
  61. package/dist/sb-manager/runtime.js +13001 -0
  62. package/package.json +14 -10
  63. package/stories/CSSValueInput.stories.tsx +3 -3
  64. package/stories/DatePicker.stories.tsx +3 -3
  65. package/stories/Dropdown.css +119 -71
  66. package/stories/Dropdown.stories.tsx +3 -3
  67. package/stories/InputText.css +12 -1
  68. package/stories/InputText.stories.tsx +29 -6
  69. package/stories/Introduction.mdx +1 -1
  70. package/stories/MonthCalendar.stories.ts +1 -1
  71. package/stories/useIsOutOfBounds.css +1 -1
  72. package/stories/useIsOutOfBounds.stories.tsx +8 -5
  73. package/stories/useKeyboardEvents.stories.tsx +1 -1
  74. package/tsconfig.json +13 -1
  75. package/tsconfig.tsbuildinfo +1 -0
  76. package/stories/Button.stories.ts +0 -50
  77. package/stories/Button.tsx +0 -48
  78. package/stories/Header.stories.ts +0 -27
  79. package/stories/Header.tsx +0 -66
  80. package/stories/Page.stories.ts +0 -29
  81. package/stories/Page.tsx +0 -91
  82. package/stories/button.css +0 -30
  83. package/stories/header.css +0 -32
  84. package/stories/page.css +0 -69
@@ -0,0 +1 @@
1
+ import{j as d}from"./jsx-runtime-D_zvdyIk.js";import{c as C}from"./clsx-hXifHU8N.js";import{r as E}from"./iframe-ByGa_ItU.js";function f(e){const n=[],_=[],u=e.length;let p=0,i="",o=0,l="";for(;(o=e.indexOf("/*",o))>=0;)p=e.indexOf("*/",o+2),p<0&&(p=u),l=e.slice(o+2,p),_.push(l),e=e.slice(0,o+2)+"___PRESERVE_CANDIDATE_COMMENT_"+(_.length-1)+"___"+e.slice(p),o+=2;e=e.replace(/("([^\\"]|\\.|\\)*")|('([^\\']|\\.|\\)*')/g,function(r){const t=r.substring(0,1);if(r=r.slice(1,-1),r.indexOf("___PRESERVE_CANDIDATE_COMMENT_")>=0)for(let a=0,S=_.length;a<S;a++)r=r.replace("___PRESERVE_CANDIDATE_COMMENT_"+a+"___",_[a]);return n.push(r),t+"___PRESERVED_TOKEN_"+(n.length-1)+"___"+t});for(let r=0,t=_.length;r<t;r=r+1){if(l=_[r],i="___PRESERVE_CANDIDATE_COMMENT_"+r+"___",l.charAt(0)==="!"){n.push(l),e=e.replace(i,"___PRESERVED_TOKEN_"+(n.length-1)+"___");continue}e=e.replace("/*"+i+"*/","")}e=e.replace(/\s+/g," "),e=e.replace(/(^|\})(([^{:])+:)+([^{]*\{)/g,function(r){return r.replace(/:/g,"___PSEUDOCLASSCOLON___")}),e=e.replace(/calc\s*\(\s*(.*?)\s*\)/g,function(r,t){return r.replace(t,t.replace(/\s+/g,"___SPACE_IN_CALC___"))}),e=e.replace(/\s+([!{};:>+()\],])/g,"$1"),e=e.replace(/___PSEUDOCLASSCOLON___/g,":"),e=e.replace(/\*\/ /g,"*/"),e=e.replace(/^(.*)(@charset "[^"]*";)/gi,"$2$1"),e=e.replace(/^(\s*@charset [^;]+;\s*)+/gi,"$1"),e=e.replace(/\band\(/gi,"and ("),e=e.replace(/([!{}:;>+([,])\s+/g,"$1"),e=e.replace(/___SPACE_IN_CALC___/g," "),e=e.replace(/;+\}/g,"}"),e=e.replace(/([\s:])(0)(px|em|%|in|cm|mm|pc|pt|ex)/gi,"$1$2"),e=e.replace(/:0 0 0 0(;|\})/g,":0$1"),e=e.replace(/:0 0 0(;|\})/g,":0$1"),e=e.replace(/:0 0(;|\})/g,":0$1"),e=e.replace(/(background-position|transform-origin):0(;|\})/gi,function(r,t,a){return t.toLowerCase()+":0 0"+a}),e=e.replace(/(:|\s)0+\.(\d+)/g,"$1.$2"),e=e.replace(/(border|border-top|border-right|border-bottom|border-right|outline|background):none(;|\})/gi,function(r,t,a){return t.toLowerCase()+":0"+a}),e=e.replace(/[^};{/]+\{\}/g,""),e=e.replace(/;;+/g,";");for(let r=0,t=n.length;r<t;r=r+1)e=e.replace("___PRESERVED_TOKEN_"+r+"___",n[r]);return e.trim()}const g=new Map,m={href:"",referenceCount:0,styles:""};function h(e,n){const _=C.c(7);let u;_[0]!==n||_[1]!==e?(u=()=>{if(!e)return m;const r=n??e;let t=g.get(r);if(t)t.referenceCount=t.referenceCount+1;else{const a=f(e);t={href:c(n??a),referenceCount:1,styles:a},g.set(r,t)}return t},_[0]=n,_[1]=e,_[2]=u):u=_[2];const[p,i]=E.useState(u);let o,l;return _[3]!==n||_[4]!==e?(o=()=>{if(!e)return;const r=n??e;if(!g.get(r)){const t=f(e),a={href:c(n??t),referenceCount:1,styles:t};g.set(r,a),i(a)}return()=>{const t=g.get(e);t&&(t.referenceCount=t.referenceCount-1,t.referenceCount||g.delete(e))}},l=[n,e],_[3]=n,_[4]=e,_[5]=o,_[6]=l):(o=_[5],l=_[6]),E.useEffect(o,l),p}function c(e){return e.replace(/-/g,"")}const R=e=>{const n=C.c(4),{children:_,href:u,precedence:p}=e,i=p===void 0?"medium":p,{href:o,styles:l}=h(_,u);let r;return n[0]!==o||n[1]!==i||n[2]!==l?(r=d.jsx("style",{href:o,precedence:i,children:l}),n[0]=o,n[1]=i,n[2]=l,n[3]=r):r=n[3],r},T='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif';export{R as S,T as a};
@@ -0,0 +1 @@
1
+ import{e}from"./iframe-ByGa_ItU.js";const o={},c=e.createContext(o);function u(n){const t=e.useContext(c);return e.useMemo(function(){return typeof n=="function"?n(t):{...t,...n}},[t,n])}function m(n){let t;return n.disableParentContext?t=typeof n.components=="function"?n.components(o):n.components||o:t=u(n.components),e.createElement(c.Provider,{value:t},n.children)}export{m as MDXProvider,u as useMDXComponents};
@@ -0,0 +1,9 @@
1
+ import{a as O}from"./iframe-ByGa_ItU.js";var y={exports:{}},n={};/**
2
+ * @license React
3
+ * react-dom.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var o;function S(){if(o)return n;o=1;var u=O();function g(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var i={d:{f:a,r:function(){throw Error(g(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},m=Symbol.for("react.portal");function v(r,e,t){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:m,key:c==null?null:""+c,children:r,containerInfo:e,implementation:t}}var f=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}return n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,n.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(g(299));return v(r,e,null,t)},n.flushSync=function(r){var e=f.T,t=i.p;try{if(f.T=null,i.p=2,r)return r()}finally{f.T=e,i.p=t,i.d.f()}},n.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,i.d.C(r,e))},n.prefetchDNS=function(r){typeof r=="string"&&i.d.D(r)},n.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,c=d(t,e.crossOrigin),s=typeof e.integrity=="string"?e.integrity:void 0,l=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?i.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:c,integrity:s,fetchPriority:l}):t==="script"&&i.d.X(r,{crossOrigin:c,integrity:s,fetchPriority:l,nonce:typeof e.nonce=="string"?e.nonce:void 0})}},n.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=d(e.as,e.crossOrigin);i.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&i.d.M(r)},n.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,c=d(t,e.crossOrigin);i.d.L(r,t,{crossOrigin:c,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}},n.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=d(e.as,e.crossOrigin);i.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else i.d.m(r)},n.requestFormReset=function(r){i.d.r(r)},n.unstable_batchedUpdates=function(r,e){return r(e)},n.useFormState=function(r,e,t){return f.H.useFormState(r,e,t)},n.useFormStatus=function(){return f.H.useHostTransitionStatus()},n.version="19.1.0",n}var _;function T(){if(_)return y.exports;_=1;function u(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u)}catch(g){console.error(g)}}return u(),y.exports=S(),y.exports}export{T as r};
@@ -0,0 +1,9 @@
1
+ var s={exports:{}},e={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var o;function d(){if(o)return e;o=1;var R=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function i(v,r,t){var u=null;if(t!==void 0&&(u=""+t),r.key!==void 0&&(u=""+r.key),"key"in r){t={};for(var n in r)n!=="key"&&(t[n]=r[n])}else t=r;return r=t.ref,{$$typeof:R,type:v,key:u,ref:r!==void 0?r:null,props:t}}return e.Fragment=a,e.jsx=i,e.jsxs=i,e}var x;function l(){return x||(x=1,s.exports=d()),s.exports}var p=l();export{p as j};
@@ -0,0 +1 @@
1
+ import{r as s}from"./iframe-ByGa_ItU.js";import{c as l}from"./client-B2qWCcIR.js";import"./index-DwJ-mRZ2.js";var n=new Map;function m(){return globalThis.IS_REACT_ACT_ENVIRONMENT}var a=({callback:e,children:r})=>{let t=s.useRef();return s.useLayoutEffect(()=>{t.current!==e&&(t.current=e,e())},[e]),r};typeof Promise.withResolvers>"u"&&(Promise.withResolvers=()=>{let e=null,r=null;return{promise:new Promise((t,o)=>{e=t,r=o}),resolve:e,reject:r}});var v=async(e,r,t)=>{let o=await c(r,t);if(m()){o.render(e);return}let{promise:i,resolve:u}=Promise.withResolvers();return o.render(s.createElement(a,{callback:u},e)),i},f=(e,r)=>{let t=n.get(e);t&&(t.unmount(),n.delete(e))},c=async(e,r)=>{let t=n.get(e);return t||(t=l.createRoot(e,r),n.set(e,t)),t};export{v as renderElement,f as unmountElement};
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ .out-of-bounds-example.uktdropdown{position:absolute;bottom:50px}.out-of-bounds-example input{width:150px}.out-of-bounds-example .uktdropdown-body{width:250px}.position-right.uktdropdown{position:absolute;right:65px}
@@ -0,0 +1,105 @@
1
+ import{r as e}from"./iframe-ByGa_ItU.js";import{D as g}from"./Dropdown-DUP_ybXe.js";import"./index-BRXcJgsA.js";import"./jsx-runtime-D_zvdyIk.js";import"./clsx-hXifHU8N.js";const y={argTypes:{element:{description:"The HTMLElement that will be checked to see if it is out of bounds and in what direction. Can be null or undefined.",table:{type:{summary:"object"}}}},component:g,parameters:{controls:{exclude:/.*/g},docs:{description:{component:`\`useIsOutOfBounds\` is a React hook that returns an object indicating if the
2
+ current component is out of the bounds of its nearest ancestor that doesn’t have overflow: visible. In other words,
3
+ it provides collision detection between an element and its bounds. The return value is
4
+
5
+ \`\`\`
6
+ type OutOfBounds = {
7
+ bottom: boolean;
8
+ hasLayout: boolean;
9
+ left: boolean;
10
+ maxHeight: null | number;
11
+ maxWidth: null | number;
12
+ right: boolean;
13
+ top: boolean;
14
+ };
15
+ \`\`\`
16
+
17
+ It is used in @acusti/dropdown to automatically position the dropdown in the direction
18
+ where there is room for it to render, so this story uses \`<Dropdown>\` to illustrate that behavior.`}}},tags:["autodocs"],title:"UIKit/Hooks/useIsOutOfBounds"},i=e.createElement("ul",null,e.createElement("li",null,"Brunei Darussalam"),e.createElement("li",null,"Cambodia"),e.createElement("li",null,"Indonesia"),e.createElement("li",null,"Laos"),e.createElement("li",null,"Malaysia"),e.createElement("li",null,"Myanmar (Burma)"),e.createElement("li",null,"Philippines"),e.createElement("li",null,"Singapore"),e.createElement("li",null,"Thailand"),e.createElement("li",null,"Timor-Leste (East Timor)"),e.createElement("li",null,"Vietnam")),l={args:{children:i,className:"not-out-of-bounds-example",isSearchable:!0,name:"notoutofbounds",placeholder:"Default behavior"}},n={args:{children:i,className:"out-of-bounds-example",isSearchable:!0,name:"outofboundsatbottom",placeholder:"Show above"}},t={args:{children:i,className:"out-of-bounds-example position-right",isSearchable:!0,name:"outofboundsatright",placeholder:"Show above & to the left"}},a={args:{children:e.createElement("ul",null,e.createElement("li",null,"Algeria"),e.createElement("li",null,"Angola"),e.createElement("li",null,"Benin"),e.createElement("li",null,"Botswana"),e.createElement("li",null,"Burkina Faso"),e.createElement("li",null,"Burundi"),e.createElement("li",null,"Cabo Verde"),e.createElement("li",null,"Cameroon"),e.createElement("li",null,"Central African Republic"),e.createElement("li",null,"Chad"),e.createElement("li",null,"Comoros"),e.createElement("li",null,"Congo, Democratic Republic of the"),e.createElement("li",null,"Congo, Republic of the"),e.createElement("li",null,"Cote d’Ivoire"),e.createElement("li",null,"Djibouti"),e.createElement("li",null,"Egypt"),e.createElement("li",null,"Equatorial Guinea"),e.createElement("li",null,"Eritrea"),e.createElement("li",null,"Eswatini"),e.createElement("li",null,"Ethiopia"),e.createElement("li",null,"Gabon"),e.createElement("li",null,"Gambia"),e.createElement("li",null,"Ghana"),e.createElement("li",null,"Guinea"),e.createElement("li",null,"Guinea-Bissau"),e.createElement("li",null,"Kenya"),e.createElement("li",null,"Lesotho"),e.createElement("li",null,"Liberia"),e.createElement("li",null,"Libya"),e.createElement("li",null,"Madagascar"),e.createElement("li",null,"Malawi"),e.createElement("li",null,"Mali"),e.createElement("li",null,"Mauritania"),e.createElement("li",null,"Mauritius"),e.createElement("li",null,"Morocco"),e.createElement("li",null,"Mozambique"),e.createElement("li",null,"Namibia"),e.createElement("li",null,"Niger"),e.createElement("li",null,"Nigeria"),e.createElement("li",null,"Rwanda"),e.createElement("li",null,"Sao Tome and Principe"),e.createElement("li",null,"Senegal"),e.createElement("li",null,"Seychelles"),e.createElement("li",null,"Sierra Leone"),e.createElement("li",null,"Somalia"),e.createElement("li",null,"South Africa"),e.createElement("li",null,"South Sudan"),e.createElement("li",null,"Sudan"),e.createElement("li",null,"Tanzania"),e.createElement("li",null,"Togo"),e.createElement("li",null,"Tunisia"),e.createElement("li",null,"Uganda"),e.createElement("li",null,"Zambia"),e.createElement("li",null,"Zimbabwe")),className:"out-of-bounds-top-and-bottom-example",isSearchable:!0,name:"outofboundstopandbottom",placeholder:"long list"}};var o,r,u;l.parameters={...l.parameters,docs:{...(o=l.parameters)==null?void 0:o.docs,source:{originalSource:`{
19
+ args: {
20
+ children: list,
21
+ className: 'not-out-of-bounds-example',
22
+ isSearchable: true,
23
+ name: 'notoutofbounds',
24
+ placeholder: 'Default behavior'
25
+ }
26
+ }`,...(u=(r=l.parameters)==null?void 0:r.docs)==null?void 0:u.source}}};var s,c,m;n.parameters={...n.parameters,docs:{...(s=n.parameters)==null?void 0:s.docs,source:{originalSource:`{
27
+ args: {
28
+ children: list,
29
+ className: 'out-of-bounds-example',
30
+ isSearchable: true,
31
+ name: 'outofboundsatbottom',
32
+ placeholder: 'Show above'
33
+ }
34
+ }`,...(m=(c=n.parameters)==null?void 0:c.docs)==null?void 0:m.source}}};var d,b,h;t.parameters={...t.parameters,docs:{...(d=t.parameters)==null?void 0:d.docs,source:{originalSource:`{
35
+ args: {
36
+ children: list,
37
+ className: 'out-of-bounds-example position-right',
38
+ isSearchable: true,
39
+ name: 'outofboundsatright',
40
+ placeholder: 'Show above & to the left'
41
+ }
42
+ }`,...(h=(b=t.parameters)==null?void 0:b.docs)==null?void 0:h.source}}};var E,p,f;a.parameters={...a.parameters,docs:{...(E=a.parameters)==null?void 0:E.docs,source:{originalSource:`{
43
+ args: {
44
+ children: <ul>
45
+ <li>Algeria</li>
46
+ <li>Angola</li>
47
+ <li>Benin</li>
48
+ <li>Botswana</li>
49
+ <li>Burkina Faso</li>
50
+ <li>Burundi</li>
51
+ <li>Cabo Verde</li>
52
+ <li>Cameroon</li>
53
+ <li>Central African Republic</li>
54
+ <li>Chad</li>
55
+ <li>Comoros</li>
56
+ <li>Congo, Democratic Republic of the</li>
57
+ <li>Congo, Republic of the</li>
58
+ <li>Cote d’Ivoire</li>
59
+ <li>Djibouti</li>
60
+ <li>Egypt</li>
61
+ <li>Equatorial Guinea</li>
62
+ <li>Eritrea</li>
63
+ <li>Eswatini</li>
64
+ <li>Ethiopia</li>
65
+ <li>Gabon</li>
66
+ <li>Gambia</li>
67
+ <li>Ghana</li>
68
+ <li>Guinea</li>
69
+ <li>Guinea-Bissau</li>
70
+ <li>Kenya</li>
71
+ <li>Lesotho</li>
72
+ <li>Liberia</li>
73
+ <li>Libya</li>
74
+ <li>Madagascar</li>
75
+ <li>Malawi</li>
76
+ <li>Mali</li>
77
+ <li>Mauritania</li>
78
+ <li>Mauritius</li>
79
+ <li>Morocco</li>
80
+ <li>Mozambique</li>
81
+ <li>Namibia</li>
82
+ <li>Niger</li>
83
+ <li>Nigeria</li>
84
+ <li>Rwanda</li>
85
+ <li>Sao Tome and Principe</li>
86
+ <li>Senegal</li>
87
+ <li>Seychelles</li>
88
+ <li>Sierra Leone</li>
89
+ <li>Somalia</li>
90
+ <li>South Africa</li>
91
+ <li>South Sudan</li>
92
+ <li>Sudan</li>
93
+ <li>Tanzania</li>
94
+ <li>Togo</li>
95
+ <li>Tunisia</li>
96
+ <li>Uganda</li>
97
+ <li>Zambia</li>
98
+ <li>Zimbabwe</li>
99
+ </ul>,
100
+ className: 'out-of-bounds-top-and-bottom-example',
101
+ isSearchable: true,
102
+ name: 'outofboundstopandbottom',
103
+ placeholder: 'long list'
104
+ }
105
+ }`,...(f=(p=a.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const M=["NotOutOfBounds","OutOfBoundsAtBottom","OutOfBoundsAtRight","OutOfBoundsTopAndBottom"];export{l as NotOutOfBounds,n as OutOfBoundsAtBottom,t as OutOfBoundsAtRight,a as OutOfBoundsTopAndBottom,M as __namedExportsOrder,y as default};
@@ -0,0 +1 @@
1
+ .keyboard-event-row{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.keyboard-event-row .label{display:inline-block;min-width:90px}.keyboard-event-row input{font-size:1.2rem;width:100px}.keyboard-event-row .code{font-family:SF Mono,Monaco,Inconsolata,Fira Mono,Droid Sans Mono,Source Code Pro,monospace}
@@ -0,0 +1,3 @@
1
+ import{r as s,R as E}from"./iframe-ByGa_ItU.js";const c={config:new Map,keydown:[],keypress:[],keyup:[]},w=-50,g=50,m=w*-1,k=()=>{};function y({eventType:e,handler:t,ignoreUsedKeyboardEvents:r=!0,priority:l}){if(!t)return k;const n=Math.min(g+m,Math.max(0,(l??0)+m)),a=c[e];return a[n]??(a[n]=new Set),a[n].add(t),c.config.set(t,{ignoreUsedKeyboardEvents:r,priority:n}),()=>{if(c.config.delete(t),a[n]!=null&&(a[n].delete(t),!a[n].size)){delete a[n];for(let o=n;o>-1&&a[o]==null&&a.length===o+1;o--)a.length=o}}}const v=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),_=new Set([" ","ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter"]),K=e=>e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="INPUT",T=e=>{const t=e.target;return t==null||!K(t)?!1:t.tagName!=="INPUT"||!v.has(t.type)?!0:_.has(e.key)};function f(e){if(!(!(e!=null&&e.defaultView)||e.defaultView.__useKeyboardEventsAttached__))return e.defaultView.__useKeyboardEventsAttached__=!0,e.addEventListener("keydown",i),e.addEventListener("keypress",i),e.addEventListener("keyup",i),()=>{e.defaultView&&(e.defaultView.__useKeyboardEventsAttached__=!1),e.removeEventListener("keydown",i),e.removeEventListener("keypress",i),e.removeEventListener("keyup",i)}}function i(e){const t=e.type,r=c[t];let l=r.length;const n=T(e);for(;l--;){const a=r[l];if(a!=null)for(const o of a){const d=c.config.get(o);if((!n||(d==null?void 0:d.ignoreUsedKeyboardEvents)===!1)&&o(e)===!1)return}}}function N({ignoreUsedKeyboardEvents:e,onKeyDown:t,onKeyPress:r,onKeyUp:l,priority:n}){s.useEffect(()=>{f(document),document.querySelectorAll("iframe").forEach(a=>{!I(a)||!a.contentDocument||f(a.contentDocument)})},[]),s.useEffect(()=>y({eventType:"keydown",handler:t,ignoreUsedKeyboardEvents:e,priority:n}),[e,t,n]),s.useEffect(()=>y({eventType:"keypress",handler:r,ignoreUsedKeyboardEvents:e,priority:n}),[e,r,n]),s.useEffect(()=>y({eventType:"keyup",handler:l,ignoreUsedKeyboardEvents:e,priority:n}),[e,l,n])}function I(e){try{return typeof e.contentWindow.location.href=="string"}catch{return!1}}const{Fragment:A,useState:P}=E;function R(){const[e,t]=P(null);N({onKeyDown:t,onKeyUp:t});const r=[e!=null&&e.shiftKey?"⇧ ":"",e!=null&&e.ctrlKey?"⌃ ":"",e!=null&&e.altKey?"⌥ ":"",e!=null&&e.metaKey?"⌘ ":""].join("");return s.createElement(A,null,s.createElement("p",{className:"keyboard-event-row"},s.createElement("span",{className:"label"},"Event:"),s.createElement("input",{className:"code",disabled:!0,value:e==null?void 0:e.type})),s.createElement("p",{className:"keyboard-event-row"},s.createElement("span",{className:"label"},"Key:"),s.createElement("input",{className:"code",disabled:!0,value:e==null?void 0:e.key})),s.createElement("p",{className:"keyboard-event-row"},s.createElement("span",{className:"label"},"Modifiers:"),s.createElement("input",{disabled:!0,value:r})))}const S={argTypes:{ignoreUsedKeyboardEvents:{control:"boolean",description:"If the prop is true, the keyboard event target is an input, textarea, or contenteditable element, and the keyboard event is usable by the element, your keyboard event listeners will not be triggered",table:{defaultValue:{summary:!0},type:{summary:"boolean"}}},priority:{control:"number",description:"Priority defines what order handlers should be invoked and defaults to 0. It can be any number between -50 (lowest priority) and 50 (highest priority).",table:{defaultValue:{summary:0},type:{summary:"number"}}},onKeyDown:{action:"onKeyDown",description:"A function that will be called when a key is pressed down",table:{type:{summary:"function"}}},onKeyPress:{action:"onKeyPress",description:"A function that will be called when a key that produces a character value is pressed down",table:{type:{summary:"function"}}},onKeyUp:{action:"onKeyUp",description:"A function that will be called when a key is released",table:{type:{summary:"function"}}}},component:R,parameters:{docs:{description:{component:"`useKeyboardEvents` is a React hook that uses keyboard event listeners on the document to trigger the onKey(Down|Press|Up) functions in order to ensure that all key events are captured regardless of whether there is currently a focused element in the DOM (i.e. `document.activeElement` is set). This solves the problem where keyboard event handlers attached via React’s `onKey(Down|Press|Up)` props miss any keyboard events that occur when the target element and its descendants aren’t focused."}}},tags:["autodocs"],title:"UIKit/Hooks/useKeyboardEvents"},u={args:{}};var p,h,b;u.parameters={...u.parameters,docs:{...(p=u.parameters)==null?void 0:p.docs,source:{originalSource:`{
2
+ args: {}
3
+ }`,...(b=(h=u.parameters)==null?void 0:h.docs)==null?void 0:b.source}}};const O=["UseKeyboardEvents"];export{u as UseKeyboardEvents,O as __namedExportsOrder,S as default};
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:svgjs="http://svgjs.com/svgjs" xmlns:xlink="http://www.w3.org/1999/xlink" width="164" height="164" version="1.1"><svg xmlns="http://www.w3.org/2000/svg" width="164" height="164" fill="none" viewBox="0 0 164 164"><path fill="#FF4785" d="M22.467 147.762 17.5 15.402a8.062 8.062 0 0 1 7.553-8.35L137.637.016a8.061 8.061 0 0 1 8.565 8.047v144.23a8.063 8.063 0 0 1-8.424 8.054l-107.615-4.833a8.062 8.062 0 0 1-7.695-7.752Z"/><path fill="#fff" fill-rule="evenodd" d="m128.785.57-15.495.968-.755 18.172a1.203 1.203 0 0 0 1.928 1.008l7.06-5.354 5.962 4.697a1.202 1.202 0 0 0 1.946-.987L128.785.569Zm-12.059 60.856c-2.836 2.203-23.965 3.707-23.965.57.447-11.969-4.912-12.494-7.889-12.494-2.828 0-7.59.855-7.59 7.267 0 6.534 6.96 10.223 15.13 14.553 11.607 6.15 25.654 13.594 25.654 32.326 0 17.953-14.588 27.871-33.194 27.871-19.201 0-35.981-7.769-34.086-34.702.744-3.163 25.156-2.411 25.156 0-.298 11.114 2.232 14.383 8.633 14.383 4.912 0 7.144-2.708 7.144-7.267 0-6.9-7.252-10.973-15.595-15.657C64.827 81.933 51.53 74.468 51.53 57.34c0-17.098 11.76-28.497 32.747-28.497 20.988 0 32.449 11.224 32.449 32.584Z" clip-rule="evenodd"/></svg><style>@media (prefers-color-scheme:light){:root{filter:none}}</style></svg>