@gbmtech/aurora-ui 0.1.1 → 0.1.2
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/cjs/components/input.cjs +1 -1
- package/dist/cjs/components/input.cjs.map +1 -1
- package/dist/cjs/components/spinner.cjs +2 -0
- package/dist/cjs/components/spinner.cjs.map +1 -0
- package/dist/esm/components/input.js +1 -1
- package/dist/esm/components/input.js.map +1 -1
- package/dist/esm/components/spinner.js +2 -0
- package/dist/esm/components/spinner.js.map +1 -0
- package/dist/types/components/input.d.ts +6 -7
- package/dist/types/components/spinner.d.ts +5 -0
- package/package.json +2 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Input:()=>Input});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Input:()=>Input});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),utils_cjs_namespaceObject=require("../lib/utils.cjs"),external_spinner_cjs_namespaceObject=require("./spinner.cjs");function Input({className:e,type:_,disabled:r,prefix:t,suffix:n,inputClassName:a,loading:c,loaderPosition:s="prefix",spinner:i,...p}){return(0,jsx_runtime_namespaceObject.jsxs)("div",{className:(0,utils_cjs_namespaceObject.cn)("flex h-12 w-full items-center rounded-md border border-zinc-200 bg-background ring-offset-background placeholder:text-zinc-400 focus-within:outline-none focus-within:ring-2 focus-within:ring-gbm-sky focus-within:ring-offset-2 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",e),"data-disabled":r,children:[c&&"prefix"===s?i||(0,jsx_runtime_namespaceObject.jsx)(external_spinner_cjs_namespaceObject.Spinner,{}):(0,jsx_runtime_namespaceObject.jsx)("span",{className:"ml-4",children:t}),(0,jsx_runtime_namespaceObject.jsx)("input",{className:(0,utils_cjs_namespaceObject.cn)("peer h-full w-full flex-1 overflow-hidden bg-transparent px-4 text-base outline-none placeholder:text-zinc-400",a),type:_,disabled:r,onKeyDown:e=>{"number"===_&&["e","E","+","-"].includes(e.key)&&e.preventDefault()},onFocus:e=>{"number"===_&&e.target.addEventListener("wheel",e=>{e.preventDefault()},{passive:!1})},...p}),c&&"suffix"===s?i||(0,jsx_runtime_namespaceObject.jsx)(external_spinner_cjs_namespaceObject.Spinner,{}):(0,jsx_runtime_namespaceObject.jsx)("span",{className:"mx-4",children:n})]})}for(var __webpack_i__ in exports.Input=__webpack_exports__.Input,__webpack_exports__)-1===["Input"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
3
3
|
//# sourceMappingURL=input.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\input.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/input.tsx"],"sourcesContent":["\r\n\r\nimport {
|
|
1
|
+
{"version":3,"file":"components\\input.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/input.tsx"],"sourcesContent":["\r\n\r\nimport { ComponentProps, JSX, ReactNode } from 'react'\r\n\r\nimport { cn } from '../lib/utils'\r\nimport { Spinner } from './spinner'\r\n\r\nexport type InputProps = Omit<ComponentProps<'input'>, 'prefix'> & {\r\n prefix?: ReactNode\r\n suffix?: ReactNode\r\n inputClassName?: string\r\n loaderPosition?: 'prefix' | 'suffix'\r\n loading?: boolean\r\n spinner?: ReactNode\r\n}\r\n\r\nfunction Input({\r\n className,\r\n type,\r\n disabled,\r\n prefix,\r\n suffix,\r\n inputClassName,\r\n loading,\r\n loaderPosition = 'prefix',\r\n spinner,\r\n ...props\r\n}: InputProps): JSX.Element {\r\n return (\r\n <div\r\n className={cn(\r\n 'flex h-12 w-full items-center rounded-md border border-zinc-200 bg-background ring-offset-background placeholder:text-zinc-400 focus-within:outline-none focus-within:ring-2 focus-within:ring-gbm-sky focus-within:ring-offset-2 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50',\r\n className\r\n )}\r\n data-disabled={disabled}\r\n >\r\n {loading && loaderPosition === 'prefix' ? (\r\n spinner || <Spinner />\r\n ) : (\r\n <span className=\"ml-4\">{prefix}</span>\r\n )}\r\n\r\n <input\r\n className={cn(\r\n 'peer h-full w-full flex-1 overflow-hidden bg-transparent px-4 text-base outline-none placeholder:text-zinc-400',\r\n inputClassName\r\n )}\r\n type={type}\r\n disabled={disabled}\r\n onKeyDown={e => {\r\n if (type === 'number' && ['e', 'E', '+', '-'].includes(e.key)) {\r\n e.preventDefault()\r\n }\r\n }}\r\n onFocus={e => {\r\n if (type === 'number') {\r\n e.target.addEventListener(\r\n 'wheel',\r\n e => {\r\n e.preventDefault()\r\n },\r\n { passive: false }\r\n )\r\n }\r\n }}\r\n {...props}\r\n />\r\n\r\n {loading && loaderPosition === 'suffix' ? (\r\n spinner || <Spinner />\r\n ) : (\r\n <span className=\"mx-4\">{suffix}</span>\r\n )}\r\n </div>\r\n )\r\n}\r\n\r\nexport { Input }\r\n"],"names":["Input","className","type","disabled","prefix","suffix","inputClassName","loading","loaderPosition","spinner","props","cn","Spinner","e"],"mappings":";+8BAgBA,SAASA,MAAM,CACbC,UAAAA,CAAS,CACTC,KAAAA,CAAI,CACJC,SAAAA,CAAQ,CACRC,OAAAA,CAAM,CACNC,OAAAA,CAAM,CACNC,eAAAA,CAAc,CACdC,QAAAA,CAAO,CACPC,eAAAA,EAAiB,QAAQ,CACzBC,QAAAA,CAAO,CACP,GAAGC,EACQ,EACX,MACE,qCAAC,OACC,UAAWC,GAAAA,0BAAAA,EAAAA,EACT,4SACAV,GAEF,gBAAeE,E,UAEdI,GAAWC,WAAAA,EACVC,GAAW,oCAACG,qCAAAA,OAAOA,CAAAA,CAAAA,GAEnB,oCAAC,QAAK,UAAU,O,SAAQR,C,GAG1B,oCAAC,SACC,UAAWO,GAAAA,0BAAAA,EAAAA,EACT,iHACAL,GAEF,KAAMJ,EACN,SAAUC,EACV,UAAWU,IACLX,WAAAA,GAAqB,CAAC,IAAK,IAAK,IAAK,IAAI,CAAC,QAAQ,CAACW,EAAE,GAAG,GAC1DA,EAAE,cAAc,EAEpB,EACA,QAASA,IACHX,WAAAA,GACFW,EAAE,MAAM,CAAC,gBAAgB,CACvB,QACAA,IACEA,EAAE,cAAc,EAClB,EACA,CAAE,QAAS,EAAM,EAGvB,EACC,GAAGH,CAAK,GAGVH,GAAWC,WAAAA,EACVC,GAAW,oCAACG,qCAAAA,OAAOA,CAAAA,CAAAA,GAEnB,oCAAC,QAAK,UAAU,O,SAAQP,C,KAIhC,C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,r)=>{for(var _ in r)__webpack_require__.o(r,_)&&!__webpack_require__.o(e,_)&&Object.defineProperty(e,_,{enumerable:!0,get:r[_]})},__webpack_require__.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Spinner:()=>Spinner});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),react_visually_hidden_namespaceObject=require("@radix-ui/react-visually-hidden"),utils_cjs_namespaceObject=require("../lib/utils.cjs"),SPINNER_COUNT=8;function Spinner({children:e,className:r,loading:_=!0,...n}){if(!_)return e;let t=(0,jsx_runtime_namespaceObject.jsx)("span",{className:(0,utils_cjs_namespaceObject.cn)("relative flex size-4 items-center justify-center opacity-60",r),...n,children:Array.from({length:8},(e,r)=>(0,jsx_runtime_namespaceObject.jsx)("span",{className:(0,utils_cjs_namespaceObject.cn)("before:fade-out-25 before:animation-repeat-infinite before:animation-delay-(--spinner-delay) before:animation-duration-(--spinner-duration) absolute h-full rotate-(--spinner-rotate) before:block before:h-1/3 before:w-full before:animate-out before:rounded-full before:bg-current"),style:{"--spinner-delay":`-${((8-r)*100).toString()}ms`,"--spinner-duration":"800ms","--spinner-rotate":`${(45*r).toString()}deg`,width:"12.5%"}},r))});return void 0===e?t:(0,jsx_runtime_namespaceObject.jsxs)("span",{className:"relative",children:[(0,jsx_runtime_namespaceObject.jsx)("span",{"aria-hidden":!0,className:"invisible contents",children:e}),(0,jsx_runtime_namespaceObject.jsx)(react_visually_hidden_namespaceObject.VisuallyHidden,{children:e}),(0,jsx_runtime_namespaceObject.jsx)("span",{className:"absolute inset-0 flex items-center justify-center",children:t})]})}for(var __webpack_i__ in exports.Spinner=__webpack_exports__.Spinner,__webpack_exports__)-1===["Spinner"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
2
|
+
//# sourceMappingURL=spinner.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components\\spinner.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/spinner.tsx"],"sourcesContent":["import { VisuallyHidden } from '@radix-ui/react-visually-hidden'\nimport type { CSSProperties, ComponentProps, ReactNode } from 'react'\n\nimport { cn } from '../lib/utils'\n\n/* -----------------------------------------------------------------------------\n * Component: Spinner\n * -------------------------------------------------------------------------- */\n\nconst SPINNER_COUNT = 8\n\nfunction Spinner({\n children,\n className,\n loading = true,\n ...props\n}: ComponentProps<'span'> & {\n loading?: boolean\n}): ReactNode {\n if (!loading) {\n return children\n }\n\n const spinner = (\n <span\n className={cn(\n 'relative flex size-4 items-center justify-center opacity-60',\n className\n )}\n {...props}\n >\n {Array.from({ length: SPINNER_COUNT }, (_, i) => (\n <span\n key={i}\n className={cn(\n 'before:fade-out-25 before:animation-repeat-infinite before:animation-delay-(--spinner-delay) before:animation-duration-(--spinner-duration) absolute h-full rotate-(--spinner-rotate) before:block before:h-1/3 before:w-full before:animate-out before:rounded-full before:bg-current'\n )}\n style={\n {\n '--spinner-delay': `-${((SPINNER_COUNT - i) * 100).toString()}ms`,\n '--spinner-duration': `${(SPINNER_COUNT * 100).toString()}ms`,\n '--spinner-rotate': `${((360 / SPINNER_COUNT) * i).toString()}deg`,\n width: `${(100 / SPINNER_COUNT).toString()}%`,\n } as CSSProperties\n }\n />\n ))}\n </span>\n )\n\n if (children === undefined) {\n return spinner\n }\n\n return (\n <span className=\"relative\">\n <span aria-hidden className=\"invisible contents\">\n {children}\n </span>\n <VisuallyHidden>{children}</VisuallyHidden>\n <span className=\"absolute inset-0 flex items-center justify-center\">\n {spinner}\n </span>\n </span>\n )\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport { Spinner }\n"],"names":["SPINNER_COUNT","Spinner","children","className","loading","props","spinner","cn","Array","_","i","undefined","VisuallyHidden"],"mappings":"s+BASMA,cAAgB,EAEtB,SAASC,QAAQ,CACfC,SAAAA,CAAQ,CACRC,UAAAA,CAAS,CACTC,QAAAA,EAAU,EAAI,CACd,GAAGC,EAGJ,EACC,GAAI,CAACD,EACH,OAAOF,EAGT,IAAMI,EACJ,oCAAC,QACC,UAAWC,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EACT,8DACAJ,GAED,GAAGE,CAAK,C,SAERG,MAAM,IAAI,CAAC,CAAE,OAtBE,CAsBoB,EAAG,CAACC,EAAGC,IACzC,oCAAC,QAEC,UAAWH,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EACT,0RAEF,MACE,CACE,kBAAmB,CAAC,CAAC,EAAG,AAACP,CAAAA,CAAAA,AA9BjB,EA8BiCU,CAAAA,EAAK,GAAE,EAAG,QAAQ,GAAG,EAAE,CAAC,CACjE,qBAAsB,QACtB,mBAAoB,CAAC,EAAG,AAAC,IAAuBA,CAAAA,EAAG,QAAQ,GAAG,GAAG,CAAC,CAClE,MAAO,OACT,C,EAVGA,G,UAiBb,AAAIR,AAAaS,KAAAA,IAAbT,EACKI,EAIP,qCAAC,QAAK,UAAU,W,UACd,oCAAC,QAAK,cAAW,GAAC,UAAU,qB,SACzBJ,C,GAEH,oCAACU,sCAAAA,cAAcA,CAAAA,C,SAAEV,C,GACjB,oCAAC,QAAK,UAAU,oD,SACbI,C,KAIT,C"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import*as e from"react/jsx-runtime";import*as n from"
|
|
2
|
+
import*as e from"react/jsx-runtime";import*as n from"../lib/utils.js";import*as r from"./spinner.js";function s({className:s,type:i,disabled:t,prefix:a,suffix:l,inputClassName:o,loading:d,loaderPosition:u="prefix",spinner:c,...f}){return(0,e.jsxs)("div",{className:(0,n.cn)("flex h-12 w-full items-center rounded-md border border-zinc-200 bg-background ring-offset-background placeholder:text-zinc-400 focus-within:outline-none focus-within:ring-2 focus-within:ring-gbm-sky focus-within:ring-offset-2 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",s),"data-disabled":t,children:[d&&"prefix"===u?c||(0,e.jsx)(r.Spinner,{}):(0,e.jsx)("span",{className:"ml-4",children:a}),(0,e.jsx)("input",{className:(0,n.cn)("peer h-full w-full flex-1 overflow-hidden bg-transparent px-4 text-base outline-none placeholder:text-zinc-400",o),type:i,disabled:t,onKeyDown:e=>{"number"===i&&["e","E","+","-"].includes(e.key)&&e.preventDefault()},onFocus:e=>{"number"===i&&e.target.addEventListener("wheel",e=>{e.preventDefault()},{passive:!1})},...f}),d&&"suffix"===u?c||(0,e.jsx)(r.Spinner,{}):(0,e.jsx)("span",{className:"mx-4",children:l})]})}export{s as Input};
|
|
3
3
|
//# sourceMappingURL=input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\input.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/input.tsx"],"sourcesContent":["\r\n\r\nimport {
|
|
1
|
+
{"version":3,"file":"components\\input.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/input.tsx"],"sourcesContent":["\r\n\r\nimport { ComponentProps, JSX, ReactNode } from 'react'\r\n\r\nimport { cn } from '../lib/utils'\r\nimport { Spinner } from './spinner'\r\n\r\nexport type InputProps = Omit<ComponentProps<'input'>, 'prefix'> & {\r\n prefix?: ReactNode\r\n suffix?: ReactNode\r\n inputClassName?: string\r\n loaderPosition?: 'prefix' | 'suffix'\r\n loading?: boolean\r\n spinner?: ReactNode\r\n}\r\n\r\nfunction Input({\r\n className,\r\n type,\r\n disabled,\r\n prefix,\r\n suffix,\r\n inputClassName,\r\n loading,\r\n loaderPosition = 'prefix',\r\n spinner,\r\n ...props\r\n}: InputProps): JSX.Element {\r\n return (\r\n <div\r\n className={cn(\r\n 'flex h-12 w-full items-center rounded-md border border-zinc-200 bg-background ring-offset-background placeholder:text-zinc-400 focus-within:outline-none focus-within:ring-2 focus-within:ring-gbm-sky focus-within:ring-offset-2 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50',\r\n className\r\n )}\r\n data-disabled={disabled}\r\n >\r\n {loading && loaderPosition === 'prefix' ? (\r\n spinner || <Spinner />\r\n ) : (\r\n <span className=\"ml-4\">{prefix}</span>\r\n )}\r\n\r\n <input\r\n className={cn(\r\n 'peer h-full w-full flex-1 overflow-hidden bg-transparent px-4 text-base outline-none placeholder:text-zinc-400',\r\n inputClassName\r\n )}\r\n type={type}\r\n disabled={disabled}\r\n onKeyDown={e => {\r\n if (type === 'number' && ['e', 'E', '+', '-'].includes(e.key)) {\r\n e.preventDefault()\r\n }\r\n }}\r\n onFocus={e => {\r\n if (type === 'number') {\r\n e.target.addEventListener(\r\n 'wheel',\r\n e => {\r\n e.preventDefault()\r\n },\r\n { passive: false }\r\n )\r\n }\r\n }}\r\n {...props}\r\n />\r\n\r\n {loading && loaderPosition === 'suffix' ? (\r\n spinner || <Spinner />\r\n ) : (\r\n <span className=\"mx-4\">{suffix}</span>\r\n )}\r\n </div>\r\n )\r\n}\r\n\r\nexport { Input }\r\n"],"names":["Input","className","type","disabled","prefix","suffix","inputClassName","loading","loaderPosition","spinner","props","cn","Spinner","e"],"mappings":";qGAgBA,SAASA,EAAM,CACbC,UAAAA,CAAS,CACTC,KAAAA,CAAI,CACJC,SAAAA,CAAQ,CACRC,OAAAA,CAAM,CACNC,OAAAA,CAAM,CACNC,eAAAA,CAAc,CACdC,QAAAA,CAAO,CACPC,eAAAA,EAAiB,QAAQ,CACzBC,QAAAA,CAAO,CACP,GAAGC,EACQ,EACX,MACE,WAAC,OACC,UAAWC,GAAAA,EAAAA,EAAAA,EACT,4SACAV,GAEF,gBAAeE,E,UAEdI,GAAWC,WAAAA,EACVC,GAAW,UAACG,EAAAA,OAAOA,CAAAA,CAAAA,GAEnB,UAAC,QAAK,UAAU,O,SAAQR,C,GAG1B,UAAC,SACC,UAAWO,GAAAA,EAAAA,EAAAA,EACT,iHACAL,GAEF,KAAMJ,EACN,SAAUC,EACV,UAAWU,IACLX,WAAAA,GAAqB,CAAC,IAAK,IAAK,IAAK,IAAI,CAAC,QAAQ,CAACW,EAAE,GAAG,GAC1DA,EAAE,cAAc,EAEpB,EACA,QAASA,IACHX,WAAAA,GACFW,EAAE,MAAM,CAAC,gBAAgB,CACvB,QACAA,IACEA,EAAE,cAAc,EAClB,EACA,CAAE,QAAS,EAAM,EAGvB,EACC,GAAGH,CAAK,GAGVH,GAAWC,WAAAA,EACVC,GAAW,UAACG,EAAAA,OAAOA,CAAAA,CAAAA,GAEnB,UAAC,QAAK,UAAU,O,SAAQP,C,KAIhC,Q"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as e from"react/jsx-runtime";import*as n from"@radix-ui/react-visually-hidden";import*as r from"../lib/utils.js";function i({children:i,className:t,loading:a=!0,...s}){if(!a)return i;let o=(0,e.jsx)("span",{className:(0,r.cn)("relative flex size-4 items-center justify-center opacity-60",t),...s,children:Array.from({length:8},(n,i)=>(0,e.jsx)("span",{className:(0,r.cn)("before:fade-out-25 before:animation-repeat-infinite before:animation-delay-(--spinner-delay) before:animation-duration-(--spinner-duration) absolute h-full rotate-(--spinner-rotate) before:block before:h-1/3 before:w-full before:animate-out before:rounded-full before:bg-current"),style:{"--spinner-delay":`-${((8-i)*100).toString()}ms`,"--spinner-duration":"800ms","--spinner-rotate":`${(45*i).toString()}deg`,width:"12.5%"}},i))});return void 0===i?o:(0,e.jsxs)("span",{className:"relative",children:[(0,e.jsx)("span",{"aria-hidden":!0,className:"invisible contents",children:i}),(0,e.jsx)(n.VisuallyHidden,{children:i}),(0,e.jsx)("span",{className:"absolute inset-0 flex items-center justify-center",children:o})]})}export{i as Spinner};
|
|
2
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components\\spinner.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/spinner.tsx"],"sourcesContent":["import { VisuallyHidden } from '@radix-ui/react-visually-hidden'\nimport type { CSSProperties, ComponentProps, ReactNode } from 'react'\n\nimport { cn } from '../lib/utils'\n\n/* -----------------------------------------------------------------------------\n * Component: Spinner\n * -------------------------------------------------------------------------- */\n\nconst SPINNER_COUNT = 8\n\nfunction Spinner({\n children,\n className,\n loading = true,\n ...props\n}: ComponentProps<'span'> & {\n loading?: boolean\n}): ReactNode {\n if (!loading) {\n return children\n }\n\n const spinner = (\n <span\n className={cn(\n 'relative flex size-4 items-center justify-center opacity-60',\n className\n )}\n {...props}\n >\n {Array.from({ length: SPINNER_COUNT }, (_, i) => (\n <span\n key={i}\n className={cn(\n 'before:fade-out-25 before:animation-repeat-infinite before:animation-delay-(--spinner-delay) before:animation-duration-(--spinner-duration) absolute h-full rotate-(--spinner-rotate) before:block before:h-1/3 before:w-full before:animate-out before:rounded-full before:bg-current'\n )}\n style={\n {\n '--spinner-delay': `-${((SPINNER_COUNT - i) * 100).toString()}ms`,\n '--spinner-duration': `${(SPINNER_COUNT * 100).toString()}ms`,\n '--spinner-rotate': `${((360 / SPINNER_COUNT) * i).toString()}deg`,\n width: `${(100 / SPINNER_COUNT).toString()}%`,\n } as CSSProperties\n }\n />\n ))}\n </span>\n )\n\n if (children === undefined) {\n return spinner\n }\n\n return (\n <span className=\"relative\">\n <span aria-hidden className=\"invisible contents\">\n {children}\n </span>\n <VisuallyHidden>{children}</VisuallyHidden>\n <span className=\"absolute inset-0 flex items-center justify-center\">\n {spinner}\n </span>\n </span>\n )\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport { Spinner }\n"],"names":["Spinner","children","className","loading","props","spinner","cn","Array","_","i","SPINNER_COUNT","undefined","VisuallyHidden"],"mappings":"wHAWA,SAASA,EAAQ,CACfC,SAAAA,CAAQ,CACRC,UAAAA,CAAS,CACTC,QAAAA,EAAU,EAAI,CACd,GAAGC,EAGJ,EACC,GAAI,CAACD,EACH,OAAOF,EAGT,IAAMI,EACJ,UAAC,QACC,UAAWC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EACT,8DACAJ,GAED,GAAGE,CAAK,C,SAERG,MAAM,IAAI,CAAC,CAAE,OAtBE,CAsBoB,EAAG,CAACC,EAAGC,IACzC,UAAC,QAEC,UAAWH,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EACT,0RAEF,MACE,CACE,kBAAmB,CAAC,CAAC,EAAG,AAACI,CAAAA,CAAAA,AA9BjB,EA8BiCD,CAAAA,EAAK,GAAE,EAAG,QAAQ,GAAG,EAAE,CAAC,CACjE,qBAAsB,QACtB,mBAAoB,CAAC,EAAG,AAAC,IAAuBA,CAAAA,EAAG,QAAQ,GAAG,GAAG,CAAC,CAClE,MAAO,OACT,C,EAVGA,G,UAiBb,AAAIR,AAAaU,KAAAA,IAAbV,EACKI,EAIP,WAAC,QAAK,UAAU,W,UACd,UAAC,QAAK,cAAW,GAAC,UAAU,qB,SACzBJ,C,GAEH,UAACW,EAAAA,cAAcA,CAAAA,C,SAAEX,C,GACjB,UAAC,QAAK,UAAU,oD,SACbI,C,KAIT,Q"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type InputProps = Omit<
|
|
1
|
+
import { ComponentProps, JSX, ReactNode } from 'react';
|
|
2
|
+
export type InputProps = Omit<ComponentProps<'input'>, 'prefix'> & {
|
|
3
3
|
prefix?: ReactNode;
|
|
4
4
|
suffix?: ReactNode;
|
|
5
5
|
inputClassName?: string;
|
|
6
|
+
loaderPosition?: 'prefix' | 'suffix';
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
spinner?: ReactNode;
|
|
6
9
|
};
|
|
7
|
-
declare
|
|
8
|
-
prefix?: ReactNode;
|
|
9
|
-
suffix?: ReactNode;
|
|
10
|
-
inputClassName?: string;
|
|
11
|
-
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
10
|
+
declare function Input({ className, type, disabled, prefix, suffix, inputClassName, loading, loaderPosition, spinner, ...props }: InputProps): JSX.Element;
|
|
12
11
|
export { Input };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gbmtech/aurora-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"main": "./dist/cjs/index.cjs",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"@radix-ui/react-switch": "^1.0.3",
|
|
62
62
|
"@radix-ui/react-tabs": "^1.0.4",
|
|
63
63
|
"@radix-ui/react-tooltip": "^1.0.7",
|
|
64
|
+
"@radix-ui/react-visually-hidden": "^1.2.0",
|
|
64
65
|
"clsx": "^2.1.1",
|
|
65
66
|
"cmdk": "^1.0.0",
|
|
66
67
|
"date-fns": "^4.1.0",
|