@acusti/uikit-docs 0.4.4 → 0.4.6

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 +19 -4
  2. package/CHANGELOG.md +60 -0
  3. package/dist/assets/CSSValueInput-B69U5DrZ.js +5 -0
  4. package/dist/assets/{CSSValueInput-BgAgo3f9.css → CSSValueInput-DKgB9IQs.css} +1 -1
  5. package/dist/assets/CSSValueInput.stories-vCftVQHX.js +113 -0
  6. package/dist/assets/Color-6BZIO3FS-BHsDhiaJ.js +1 -0
  7. package/dist/assets/DatePicker.stories-X2JO2cn6.js +585 -0
  8. package/dist/assets/DocsRenderer-LL677BLK-i2bqAbNY.js +2 -0
  9. package/dist/assets/Dropdown-QkqMQiyU.css +1 -0
  10. package/dist/assets/Dropdown-_IIsqrAA.js +101 -0
  11. package/dist/assets/Dropdown.stories-msGED41R.js +364 -0
  12. package/dist/assets/InputText-_BMv0r1n.css +1 -0
  13. package/dist/assets/InputText.stories-CG1EnzrQ.js +148 -0
  14. package/dist/assets/Introduction-orXeKug7.js +184 -0
  15. package/dist/assets/MonthCalendar.stories-CJT-JiqF.js +177 -0
  16. package/dist/assets/WithTooltip-65CFNBJE-DlgYg9W2.js +9 -0
  17. package/dist/assets/blocks-C4xgyV4X.js +46 -0
  18. package/dist/assets/chunk-242VQQM5-DEt_wvrI.js +1 -0
  19. package/dist/assets/chunk-YKABRMAI-BpCcWWoG.js +18 -0
  20. package/dist/assets/client-Bvdml6v2.js +9 -0
  21. package/dist/assets/clsx-Bdud1Ih_.js +1 -0
  22. package/dist/assets/compiler-runtime-BOsKKfMw.js +1 -0
  23. package/dist/assets/components-CuDS54ZU.js +92 -0
  24. package/dist/assets/dist-6e4YoSiG.js +1 -0
  25. package/dist/assets/dist-BreUZhw6.js +1 -0
  26. package/dist/assets/formatter-EIJCOSYU-4RP_9NAI.js +1 -0
  27. package/dist/assets/iframe-BsC6HWDY.js +1221 -0
  28. package/dist/assets/jsx-runtime-CZwoFFIL.js +1 -0
  29. package/dist/assets/lib-WXkUx4TK.js +1 -0
  30. package/dist/assets/preload-helper-Bhb7V-Yo.js +1 -0
  31. package/dist/assets/react-18-6aLPZbD-.js +1 -0
  32. package/dist/assets/react-DcwytXSz.js +1 -0
  33. package/dist/assets/react-dom-CFVoDXTy.js +1 -0
  34. package/dist/assets/syntaxhighlighter-ED5Y7EFY-BQSv6pbL.js +6 -0
  35. package/dist/assets/theming-DLDZLcJn.js +39 -0
  36. package/dist/assets/useIsOutOfBounds.stories-CI4DMSUD.js +105 -0
  37. package/dist/assets/{useKeyboardEvents-BH4Zd7d3.css → useKeyboardEvents-CKMYGqVT.css} +1 -1
  38. package/dist/assets/useKeyboardEvents.stories-CNX299tr.js +3 -0
  39. package/dist/favicon-wrapper.svg +46 -0
  40. package/dist/favicon.svg +1 -1
  41. package/dist/iframe.html +59 -40
  42. package/dist/index.html +8 -16
  43. package/dist/index.json +1 -1
  44. package/dist/project.json +1 -1
  45. package/dist/sb-addons/docs-1/manager-bundle.js +1 -149
  46. package/dist/sb-addons/storybook-2/manager-bundle.js +1 -1
  47. package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +548 -108
  48. package/dist/sb-common-assets/favicon-wrapper.svg +46 -0
  49. package/dist/sb-common-assets/favicon.svg +1 -1
  50. package/dist/sb-manager/globals-runtime.js +73064 -67182
  51. package/dist/sb-manager/globals.js +6 -16
  52. package/dist/sb-manager/manager-stores.js +23 -0
  53. package/dist/sb-manager/runtime.js +17712 -10309
  54. package/dist/vite-inject-mocker-entry.js +2 -0
  55. package/package.json +11 -9
  56. package/stories/CSSValueInput.stories.tsx +1 -1
  57. package/stories/DatePicker.stories.tsx +182 -45
  58. package/stories/InputText.stories.tsx +36 -0
  59. package/tsconfig.json +1 -0
  60. package/tsconfig.tsbuildinfo +1 -1
  61. package/dist/assets/CSSValueInput-BoZriUnh.js +0 -1
  62. package/dist/assets/CSSValueInput.stories-D1VcYZJ0.js +0 -113
  63. package/dist/assets/Color-AVL7NMMY-BeW0C7pE.js +0 -1
  64. package/dist/assets/DatePicker.stories-BSWV31FV.js +0 -244
  65. package/dist/assets/DocsRenderer-PQXLIZUC-D92GwNti.js +0 -2
  66. package/dist/assets/Dropdown-D5cyjefk.css +0 -1
  67. package/dist/assets/Dropdown-DUP_ybXe.js +0 -84
  68. package/dist/assets/Dropdown.stories-2Wtw1otE.js +0 -336
  69. package/dist/assets/InputText-Tkbh5amB.css +0 -1
  70. package/dist/assets/InputText.stories-BYt2Aj0_.js +0 -90
  71. package/dist/assets/Introduction-nSE2hjmb.js +0 -183
  72. package/dist/assets/MonthCalendar.stories-IJrL6wIl.js +0 -169
  73. package/dist/assets/blocks-Du178fXa.js +0 -658
  74. package/dist/assets/client-B2qWCcIR.js +0 -25
  75. package/dist/assets/clsx-hXifHU8N.js +0 -9
  76. package/dist/assets/iframe-ByGa_ItU.js +0 -1102
  77. package/dist/assets/index-BRXcJgsA.js +0 -1
  78. package/dist/assets/index-BVajFqaV.js +0 -1
  79. package/dist/assets/index-DwJ-mRZ2.js +0 -9
  80. package/dist/assets/jsx-runtime-D_zvdyIk.js +0 -9
  81. package/dist/assets/react-18-djOrgGe8.js +0 -1
  82. package/dist/assets/useIsOutOfBounds.stories-e48KZd_G.js +0 -105
  83. package/dist/assets/useKeyboardEvents.stories-CJbDuGfk.js +0 -3
  84. package/dist/sb-manager/globals-module-info.js +0 -797
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
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};
@@ -1,9 +0,0 @@
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};
@@ -1,9 +0,0 @@
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};
@@ -1 +0,0 @@
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};
@@ -1,105 +0,0 @@
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};
@@ -1,3 +0,0 @@
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};