untitledui 0.1.3 → 0.1.5
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.mjs +15 -15
- package/package.json +1 -1
- package/templates/default/src/app/home-screen.tsx +1 -1
- package/templates/default/src/app/layout.tsx +2 -2
- package/templates/default/src/components/foundations/featured-icon/featured-icons.tsx +1 -1
- package/templates/default/src/components/marketing/header-navigation/base-components/nav-menu-item.tsx +1 -1
- package/templates/default/src/components/marketing/header-navigation/components/header.tsx +1 -1
- package/templates/default/src/components/shared/avatar/avatar-label-group.tsx +1 -1
- package/templates/default/src/components/shared/avatar/avatar-profile-photo.tsx +1 -1
- package/templates/default/src/components/shared/avatar/avatar.tsx +1 -1
- package/templates/default/src/components/shared/avatar/base-components/avatar-add-button.tsx +1 -1
- package/templates/default/src/components/shared/avatar/base-components/avatar-company-icon.tsx +1 -1
- package/templates/default/src/components/shared/avatar/base-components/avatar-online-indicator.tsx +1 -1
- package/templates/default/src/components/shared/avatar/base-components/verified-tick.tsx +1 -1
- package/templates/default/src/components/shared/badges/badge-groups.tsx +1 -1
- package/templates/default/src/components/shared/badges/badges.tsx +1 -1
- package/templates/default/src/components/shared/button-group/button-group.tsx +1 -1
- package/templates/default/src/components/shared/buttons/app-store-buttons-outline.tsx +1 -1
- package/templates/default/src/components/shared/buttons/app-store-buttons.tsx +1 -1
- package/templates/default/src/components/shared/buttons/button-utility.tsx +1 -1
- package/templates/default/src/components/shared/buttons/button.tsx +1 -1
- package/templates/default/src/components/shared/buttons/close-button.tsx +1 -1
- package/templates/default/src/components/shared/buttons/social-button.tsx +1 -1
- package/templates/default/src/components/shared/checkbox/checkbox.tsx +1 -1
- package/templates/default/src/components/shared/dropdown/dropdown.tsx +1 -1
- package/templates/default/src/components/shared/input/hint-text.tsx +1 -1
- package/templates/default/src/components/shared/input/index.tsx +1 -1
- package/templates/default/src/components/shared/input/input-payment.tsx +1 -1
- package/templates/default/src/components/shared/input/input-with-button.tsx +1 -1
- package/templates/default/src/components/shared/input/input-with-dropdown.tsx +1 -1
- package/templates/default/src/components/shared/input/input-with-prefix.tsx +1 -1
- package/templates/default/src/components/shared/input/label.tsx +1 -1
- package/templates/default/src/components/shared/progress-indicators/progress-circles.tsx +1 -1
- package/templates/default/src/components/shared/progress-indicators/progress-indicators.tsx +3 -3
- package/templates/default/src/components/shared/radio-buttons/radio-buttons.tsx +1 -1
- package/templates/default/src/components/shared/radio-groups/radio-group-avatar.tsx +1 -1
- package/templates/default/src/components/shared/radio-groups/radio-group-checkbox.tsx +1 -1
- package/templates/default/src/components/shared/radio-groups/radio-group-icon-card.tsx +1 -1
- package/templates/default/src/components/shared/radio-groups/radio-group-icon-simple.tsx +1 -1
- package/templates/default/src/components/shared/radio-groups/radio-group-payment-icon.tsx +1 -1
- package/templates/default/src/components/shared/radio-groups/radio-group-radio-button.tsx +1 -1
- package/templates/default/src/components/shared/select/combobox.tsx +1 -1
- package/templates/default/src/components/shared/select/multi-select.tsx +1 -1
- package/templates/default/src/components/shared/select/popover.tsx +1 -1
- package/templates/default/src/components/shared/select/select-item.tsx +1 -1
- package/templates/default/src/components/shared/select/select.tsx +1 -1
- package/templates/default/src/components/shared/slider/slider.tsx +3 -3
- package/templates/default/src/components/shared/tags/base-components/tag-checkbox.tsx +1 -1
- package/templates/default/src/components/shared/tags/base-components/tag-close-x.tsx +1 -1
- package/templates/default/src/components/shared/tags/tags.tsx +1 -1
- package/templates/default/src/components/shared/textarea/textarea.tsx +1 -1
- package/templates/default/src/components/shared/toggle/toggle.tsx +1 -1
- package/templates/default/src/components/shared/tooltips/tooltips.tsx +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as $0}from"commander";import
|
|
3
|
-
"paths": ${JSON.stringify(Y.paths)},`);else
|
|
4
|
-
`),process.exit(1)},
|
|
5
|
-
Failed to add component`),console.error(v.red(
|
|
6
|
-
Following files already exist in the directory.`),
|
|
7
|
-
`),process.exit(1)},
|
|
8
|
-
Creating a new project in ${
|
|
2
|
+
import{Command as $0}from"commander";import N3 from"async-retry";import v from"chalk";import{Command as s3}from"commander";import{execa as p}from"execa";import*as E from"fs";import g from"ora";import n3 from"os";import*as u from"path";import h from"prompts";import{Project as a3}from"ts-morph";import V3 from"node-fetch";import{posix as w3,sep as x3}from"path";import{Readable as T3,pipeline as y3}from"stream";import{x as S3}from"tar";import{promisify as C3}from"util";var k3=C3(y3);async function L3(z,W){try{let Q=await F3(W);await k3(Q,S3({cwd:z,strip:2,filter:(Y)=>{return Y.split(x3).join(w3.sep).includes(W.template||"basic-form")}}))}catch(Q){throw new Error(`Failed to download or extract repository from API: ${Q instanceof Error?Q.message:Q}`)}}async function F3(z){try{let Q=await V3("https://untitledui-docs.vercel.app/api/download-repo",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/octet-stream"},body:JSON.stringify(z)});if(Q.status===403||Q.status===404)throw new Error(z.key?"License key is invalid or expired":"Repository not found");if(!Q.ok)throw new Error(`Failed to download from API. Status: ${Q.status} ${Q.statusText}`);if(!Q.body)throw new Error("Response body is empty");return T3.from(Q.body)}catch(Q){throw new Error(`Error downloading tarball: ${Q instanceof Error?Q.message:Q}`)}}async function P(z){let W=`https://untitledui-docs.vercel.app/api/validate-key?key=${z}`;try{return(await V3(W)).status===200}catch{return!1}}import O3 from"node-fetch";async function z3(z,W,Q){try{return await(await O3("https://untitledui-docs.vercel.app/api/components",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({type:z,components:W,key:Q})})).json()}catch(X){return console.error(X),null}}import J3 from"node-fetch";async function M3(z,W=""){let Q=`https://untitledui-docs.vercel.app/api/components/list?key=${W}&type=${z}`;try{let X=await(await J3(Q)).json();if(!X?.components?.length)return null;return X}catch(Y){return console.error(Y),null}}async function G3(z=""){let W=`https://untitledui-docs.vercel.app/api/components/list?key=${z}`;try{let Y=await(await J3(W)).json();if(!Y?.types?.length)return null;return Y}catch(Q){return console.error(Q),null}}import f3 from"fast-glob";import*as I3 from"fs";import*as Q3 from"path";import{Project as l3}from"ts-morph";import{loadConfig as j3}from"tsconfig-paths";import P3 from"prettier";async function H3(z,W="typescript"){try{return await P3.format(z,{parser:W})}catch(Q){return console.error("Error formatting with Prettier:",Q),z}}import r from"fast-glob";import*as l from"fs";import*as c from"path";import{loadConfig as g3}from"tsconfig-paths";var S=["**/node_modules/**",".next","public","dist","build"];async function s(z){let W=l.existsSync(c.resolve(z,"src")),Q=l.existsSync(c.resolve(z,`${W?"src/":""}app`)),[Y,X,V,Z]=await Promise.all([r.glob("**/{next,vite,astro}.config.*|gatsby-config.*",{cwd:z,deep:2,ignore:S}),h3(z),m3(z),d3(z)]),L={framework:"other",isTsx:X,tailwindFile:V||null,aliasPrefix:Z,isSrcDir:W,isUsingAppDir:Q};if(Y.find((B)=>B.startsWith("next.config."))?.length)return L.framework=Q?"next-app":"next-pages",L;else if(Y?.length||l.existsSync(c.resolve(z,"package.json")))return L.framework="other",L;return null}async function h3(z){return(await r.glob("tsconfig.*",{cwd:z,deep:2,ignore:S})).length>0}async function m3(z){let W=await r.glob("tailwind.config.*",{cwd:z,deep:2,ignore:S});if(!W.length)return null;return W[0]}async function d3(z){let W=await g3(z);if(W?.resultType==="failed"||!Object.keys(W.paths).length)return null;let Q={};for(let[Y,X]of Object.entries(W.paths)){let V=Y.replace(/\/\*$/,"/");if(X.some((Z)=>Z.includes("/app/*")))Q.appPrefix=V;else if(X.some((Z)=>Z.includes("/components/*")))Q.componentsPrefix=V;else if(X.some((Z)=>Z.includes("/utils/*")))Q.utilsPrefix=V;else if(X.some((Z)=>Z.includes("/styles/*")))Q.stylesPrefix=V;else if(X.some((Z)=>Z.includes("./*")||Z.includes("/src/*")))Q.srcPrefix=V}return Q||null}function n(z){let W=j3(z),Q=f3.sync(["tailwind.config.*","**/globals.css","**/{layout,_app}.tsx","package.json"],{cwd:z,deep:4,absolute:!0,onlyFiles:!0,ignore:S}),Y={tailwindFile:Q.find((X)=>X.includes("tailwind.config.")),cssFile:Q.find((X)=>X.includes("globals.css")),layoutFile:Q.find((X)=>X.includes("layout")),appFile:Q.find((X)=>X.includes("_app")),packageJson:Q.find((X)=>X.includes("package.json")),tsConfig:W?.resultType==="success"?W?.configFileAbsolutePath:void 0};if(W.resultType==="failed")throw new Error(`Failed to load tsconfig.json. ${W.message??""}`.trim());return Y}function X3(z,W,Q){if(z.includes("components")){if(W?.componentsPrefix)return z.replace(/@\/components\//,Q3.join(W?.componentsPrefix,Q?Q.replace(/components\//,""):"","/"));if(Q)return z.replace(/@\/components\//,Q3.join(W?.srcPrefix||"@/",Q,"/"))}if(z.includes("app")&&W?.appPrefix)return z.replace(/^@\/app\//,W?.appPrefix);if(z.includes("utils")&&W?.utilsPrefix)return z.replace(/^@\/utils\//,W?.utilsPrefix);if(z.includes("styles")&&W?.stylesPrefix)return z.replace(/^@\/styles\//,W?.stylesPrefix);if(W?.srcPrefix)return z.replace(/^@\//,W?.srcPrefix);return z}async function R3(z,W,Q="@/*"){let Y=await j3(z);if(Y?.resultType==="failed")return null;let X={};if(!Object.keys(Y.paths).length){Y.paths={[Q]:[`./${W?"src/":""}*`]},X.srcPrefix=Q.replace(/\/\*$/,"");let V=await I3.promises.readFile(Y.configFileAbsolutePath,"utf-8"),Z;if(!V.includes('"paths":'))Z=V.replace(/"compilerOptions":\s*{/,`"compilerOptions": {
|
|
3
|
+
"paths": ${JSON.stringify(Y.paths)},`);else Z=V.replace(/"paths":\s*{[^}]*}/,`"paths": ${JSON.stringify(Y.paths)}`);let L=new l3,B=await H3(Z,"json");return L.createSourceFile(Y.configFileAbsolutePath,B,{overwrite:!0}),await L.save(),X}return X||null}import c3 from"node-fetch";async function r3(){try{return await(await c3("https://untitledui-docs.vercel.app/api/get-pkg")).json()}catch(W){return console.error(W),null}}async function a({dependencies:z,devDependencies:W,shouldThrow:Q=!0}){let Y=await r3();if(!Y)if(Q)throw new Error("package.json not found");else return null;let X=[],V=[];if(z)z.forEach((Z)=>{if(Y.dependencies?.[Z])X.push(`${Z}@${Y.dependencies[Z]}`)});if(W)W.forEach((Z)=>{if(Y.devDependencies?.[Z])V.push(`${Z}@${Y.devDependencies[Z]}`)});return{dependencies:X,devDependencies:V}}function D(){if("bun/1.2.4 npm/? node/v22.6.0 darwin arm64".startsWith("yarn"))return"yarn";if("bun/1.2.4 npm/? node/v22.6.0 darwin arm64".startsWith("pnpm"))return"pnpm";if("bun/1.2.4 npm/? node/v22.6.0 darwin arm64".startsWith("bun"))return"bun";return"npm"}var p3=u.join(n3.homedir(),".untitledui"),F=u.join(p3,"config.json"),$={components:[],path:"",type:void 0,license:""};if(E.existsSync(F)){let z=JSON.parse(E.readFileSync(F,"utf-8"));$.license=z.license}var i=(z)=>{if(z.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
|
|
4
|
+
`),process.exit(1)},E3=new s3().name("add").description("add a component to your project").argument("[components...]","the components to add").option("-o, --overwrite","overwrite existing files.",!1).option("-a, --all","add all available components",!1).option("-p, --path <path>","the path to add the component to.").option("-t, --type <shared|marketing|shared-assets|application|foundations>","the type of the component to add.").option("-l, --license <license-key>","Add a license key for adding components.").action(async(z,W)=>{if(z)$.components=z;if(W)$.overwrite=W.overwrite,$.all=W.all,$.path=W.path,$.license=W.license||$.license;try{await i3($)}catch(Q){console.error(v.red(Q))}});async function i3(z){let W=g().start(),Q=process.cwd();if(!E.existsSync(u.resolve(Q,"package.json")))W.warn("This command should be run in a project directory."),process.exit(0);let X=await s(Q);if($.license){let q=await P($.license);if(console.log(q,$),!q)W.fail("Invalid license key"),process.exit(0);if(!E.existsSync(F)){let H=u.dirname(F);E.mkdirSync(H,{recursive:!0}),E.writeFileSync(F,JSON.stringify({license:$.license},null,2))}if(JSON.parse(E.readFileSync(F,"utf-8")).license!==$.license)E.writeFileSync(F,JSON.stringify({license:$.license},null,2))}W.stop();let V=[];if($.components.length){let q=await z3($.type,$.components,$.license);if(q?.pro?.length)q?.pro?.forEach((J)=>console.log(`The ${v.yellowBright(J.split("/")[1])} component is only available for PRO users. Get access to the PRO at ${v.cyan("https://www.untitledui.com/buy/untitled-ui")}`)),process.exit(0);if(!q?.components.length)console.log("No components found"),process.exit(0);V.push(...q.components)}if(!$?.type&&!$?.components.length){let q=await G3($.license);if(!q)console.log("No component types found"),process.exit(0);let J=await h({type:"select",name:"type",onState:i,message:`What type of ${v.cyan("component")} are you adding?`,choices:q?.types.map((H)=>({title:H,value:H}))});$.type=J.type}if(!$?.path){let q=await h({type:"text",name:"path",onState:i,message:`Where would you like to add the ${v.cyan("components")}?`,initial:"components"});$.path=q.path}if(X&&!X?.aliasPrefix){let q=/^[^*"]+\/\*\s*$/,J=await h({type:"text",name:"aliasPrefix",onState:i,initial:"@/*",message:`What is the ${v.cyan("import alias")} for your project?`,validate:(H)=>q.test(H)?!0:"Import alias must follow the pattern <prefix>/*"});X.aliasPrefix=await R3(Q,X?.isSrcDir,J?.aliasPrefix)}if(!$?.components.length){let q=await M3($?.type,$.license);if(!q)console.log("No components found"),process.exit(0);let J=await h({type:"multiselect",name:"components",onState:i,message:`Which ${v.cyan("components")} would you like to add?`,choices:q?.components?.map((H)=>({title:H||"example",value:H||"example",selected:$.components.includes(H)})),instructions:!1,hint:"- Space to select. Return to submit"});if($.components=J.components,!J.components||J.components.length===0)console.log("No option selected. Exiting..."),process.exit(0)}if(!$.components?.length)W.warn("No components selected. Exiting."),process.exit(0);let Z=n(Q),L=new Set,B=new Set,b=new Set,M=new a3({tsConfigFilePath:Z?.tsConfig});if($.type&&$.components.length){let q=await z3($.type,$.components,$.license);if(!q?.components.length)console.log("No components found"),process.exit(0);V.push(...q.components)}V.forEach((q)=>{let J=g(`Adding ${q.name}`).start(),H=q.files;q.dependencies.forEach((_)=>B.add(_)),q.devDependencies.forEach((_)=>b.add(_));try{H?.forEach(async({path:_,code:x})=>{let A=u.join(process.cwd(),`${X?.isSrcDir&&"src"}`,_.replace(/components\//,$.path+"/")),f=u.dirname(A);if(E.existsSync(A)&&!$.overwrite){if(E.readFileSync(A,"utf-8")!==x)L.add({code:x,path:A})}else{E.mkdirSync(f,{recursive:!0}),E.writeFileSync(A,x);let G=M.addSourceFileAtPath(u.resolve(A));G.getImportDeclarations().forEach((T)=>{let y=T.getModuleSpecifierValue();T.setModuleSpecifier(X3(y,X?.aliasPrefix,$.path))}),await G.save()}}),J.succeed(`${v.green(q.name)} is added`)}catch(_){J.fail(`
|
|
5
|
+
Failed to add component`),console.error(v.red(_)),process.exit(0)}});let N=await a({dependencies:Array.from(B),devDependencies:Array.from(b),shouldThrow:!0}),j=D();if(N?.dependencies?.length){let q=g("Installing dependencies").start();await N3(()=>p(j,[j==="npm"?"install":"add",...Array.from(N.dependencies)]).catch(async(J)=>{if(J.message.includes("peer"))q.warn("Dependency conflict detected. Retrying with --legacy-peer-deps..."),q.start("Installing dependencies with --legacy-peer-deps flag"),await p(j,[j==="npm"?"install":"add",...Array.from(N.dependencies),"--legacy-peer-deps"])}),{retries:1}),q.succeed("Dependencies are installed")}if(N?.devDependencies?.length){let q=g("Installing devDependencies").start();await N3(()=>p(j,[j==="npm"?"install":"add",...Array.from(N.devDependencies)]).catch(async(J)=>{if(J.message.includes("peer"))q.warn("DevDependency conflict detected. Retrying with --legacy-peer-deps..."),q.start("Installing devDependencies with --legacy-peer-deps flag"),await p(j,[j==="npm"?"install":"add",...Array.from(N.devDependencies),"--legacy-peer-deps"])}),{retries:1}),q.succeed("DevDependencies are installed")}if(L.size&&!$?.overwrite)if(console.log(`
|
|
6
|
+
Following files already exist in the directory.`),L.forEach((J)=>{console.log(v.green(`- ${u.relative(process.cwd(),J.path)}`))}),(await h({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0})).overwrite){let J=g("Overwriting files").start();L.forEach(async(H)=>{E.writeFileSync(H.path,H.code);let _=M.addSourceFileAtPath(u.resolve(H.path));_.getImportDeclarations().forEach((x)=>{let A=x.getModuleSpecifierValue();x.setModuleSpecifier(X3(A,X?.aliasPrefix,$.path))}),await _.save()}),J.succeed("Files are overwritten"),process.exit(1)}else console.log(`Use ${v.cyan("--overwrite")} or ${v.cyan("-o")} to overwrite existing files, or refer to the documentation ${v.cyan("https://untitled.xyz/docs")} for manual installation. The rest of the files are added.`),process.exit(0)}import u3 from"async-retry";import R from"chalk";import{Command as o3}from"commander";import{execa as e}from"execa";import B3 from"fast-glob";import I from"fs";import m from"ora";import t3 from"os";import*as K from"path";import d from"prompts";import{Project as e3}from"ts-morph";import{fileURLToPath as W0}from"url";import o from"fs";import v3 from"path";function Y3(z,W){if(!o.existsSync(W))o.mkdirSync(W,{recursive:!0});let Q=o.readdirSync(z,{withFileTypes:!0});for(let Y of Q){let X=v3.join(z,Y.name),V=v3.join(W,Y.name);if(Y.isDirectory())Y3(X,V);else o.copyFileSync(X,V)}}import Z3 from"chalk";import*as C from"fs";import*as t from"path";function $3(z){if(!C.existsSync(t.resolve(z)))console.log(Z3.red(`Error: CSS file not found at ${z}`)),process.exit(1);let W=C.readFileSync(t.resolve(z),"utf-8"),Q=/(--color-[a-zA-Z-]+-\d{1,3}):\s*(rgb\([^)]+\))/g,Y={},X;while((X=Q.exec(W))!==null)if(X[1]&&X[2])Y[X[1]]=X[2];return Y}function q3(z,W,Q){let Y=t.resolve(Q);if(!C.existsSync(Y)){console.log(Z3.red(`Error: CSS file not found at ${Y}`));return}let X=C.readFileSync(Y,"utf-8"),V=$3(Q),Z={},L={};for(let[b,M]of Object.entries(V))if(b.startsWith(`--color-${z}-`)){let N=b.replace(`--color-${z}-`,"");Z[N]=b}else if(b.startsWith(`--color-${W}-`)){let N=b.replace(`--color-${W}-`,"");L[N]=M}let B=!1;for(let[b,M]of Object.entries(Z))if(L[b]){let N=L[b],j=new RegExp(`(${M}):\\s*rgb\\([^)]*\\);?`,"g");if(j.test(X))X=X.replace(j,`$1: ${N};`),B=!0;else console.log(Z3.yellow(`No match found for ${M}`))}if(B)C.writeFileSync(Y,X,"utf-8")}var z0=W0(import.meta.url),K3=K.dirname(z0),Q0=K.join(t3.homedir(),".untitledui"),O=K.join(Q0,"config.json"),b3="default",X0=["with-stripe","otp","magic-link"],w="",U={template:"",color:""};if(I.existsSync(O)){let z=JSON.parse(I.readFileSync(O,"utf-8"));U.license=z.license}var W3=(z)=>{if(z.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
|
|
7
|
+
`),process.exit(1)},_3=new o3().name("init").description("initialize a new project").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","Display this help message.").option("-t, --template <starter-kit>","Specify a template for the project.").option("-c, --color <color-name>","Specify a color for the project.").option("-o, --overwrite","Overwrite existing files.",!1).option("-l, --license <license-key>","Add a license key to download the repository.").action(async(z,W)=>{if(z)w=z;if(W)U.color=W.color,U.template=W.template,U.overwrite=W.overwrite,U.license=W.license||U.license;try{await Y0(W)}catch(Q){console.error(R.red(Q))}});async function Y0(z){let W=process.cwd(),Q=I.existsSync(K.resolve(W,"package.json")),Y=K.resolve(K.join(K3,"../templates/default","src/styles/theme.css")),X=$3(Y??""),V=Array.from(new Set(Object.keys(X).map((B)=>B?.split("--color-")?.[1]?.replace(/-\d{1,3}/,"")))),Z=m().start(),L=await s(W);if(U.license){if(!await P(U.license))Z.fail("Invalid license key"),process.exit(0);if(!I.existsSync(O)){let M=K.dirname(O);I.mkdirSync(M,{recursive:!0}),I.writeFileSync(O,JSON.stringify({license:U.license},null,2))}if(JSON.parse(I.readFileSync(O,"utf-8")).license!==U.license)I.writeFileSync(O,JSON.stringify({license:U.license},null,2))}if(!Q){if(Z.stop(),!w){let B=await d({onState:W3,type:"text",name:"path",message:"What is your project named?",initial:"untitled-ui"});if(typeof B.path==="string")w=B.path.trim()}if(I.existsSync(K.resolve(K.join(W,w))))Z.fail(R.red("Directory already exists!")),process.exit(1);if(!U.template){let B=await d({type:"select",name:"template",onState:W3,message:`Which ${R.cyan("starter kit")} would you like to use?`,choices:[{title:"default-template",value:b3},{title:"basic-form",value:"basic-form"},{title:"magic-link",value:"magic-link"},{title:"next-intl",value:"next-intl"},{title:"otp",value:"otp"},{title:"react-hook-form",value:"react-hook-form"},{title:"with-stripe",value:"with-stripe"}]});if(U.template=B.template,X0.includes(U.template)&&!U.license){let b=await d({type:"text",name:"license",onState:W3,message:`Enter the license key to download the ${R.cyan(U.template)} template:`});if(U.license=b.license,!await P(b.license))Z.fail("Invalid license key"),process.exit(0)}}Z.succeed("Template is selected: "+R.green(U.template))}else if(L?.framework==="other")Z.fail("Unsupported project framework"),console.log(`Please refer to the documentation ${R.cyan("https://untitled.xyz/docs")} for supported frameworks or proceed with manual installation.`),process.exit(1);else Z.succeed(R.yellow("Detected Next.js project, proceeding with the setup..."));if(!U.color){let B=await d({type:"select",name:"color",onState:W3,initial:z.color??"",message:`Which ${R.cyan("color")} would you like to use as the ${R.cyanBright("brand")} color?`,choices:V.map((b)=>({title:b,value:b}))});U.color=B.color}if(w&&!Q){let B=K.resolve(w);console.log(`
|
|
8
|
+
Creating a new project in ${R.blue(w)}`);let b=m("Downloading and extracting the repository...").start();try{if(I.mkdirSync(B,{recursive:!0}),U.template===b3){let j=K.resolve(K.join(K3,"../templates/",b3));Y3(j,B)}else await u3(()=>L3(B,{username:"a-peak-works",repo:"starter-kits",branch:"master",template:U.template,key:U.license}),{retries:2});b.succeed("Files are downloaded and extracted successfully!");let M=m({text:"Installing dependencies..."}).start(),N=B3.sync(["**/styles/theme.css"],{cwd:B,absolute:!0,onlyFiles:!0})[0];q3("brand",U.color,N??""),await u3(()=>e("sh",["-c",`cd ${w} && ${D()} install && git init`]).catch(async(j)=>{if(j.message.includes("peer"))M.warn("Dependency conflict detected. Retrying with --legacy-peer-deps..."),M.start("Installing dependencies with --legacy-peer-deps flag"),await e("sh",["-c",`cd ${w} && ${D()==="npm"?"npm --legacy-peer-deps":D()} install && git init`])}),{retries:1}),M.succeed("Dependencies installed"),console.log(`
|
|
9
9
|
Your project is ready, to get staretd run the following commands:
|
|
10
10
|
|
|
11
|
-
cd ${
|
|
12
|
-
${
|
|
13
|
-
Failed to download and extract the repository`)),
|
|
14
|
-
`);
|
|
15
|
-
`),
|
|
11
|
+
cd ${R.cyan(w)}
|
|
12
|
+
${R.cyan(D())} run dev`),process.exit(1)}catch(M){if(b.fail(R.red(`
|
|
13
|
+
Failed to download and extract the repository`)),M instanceof Error)console.error(M.message);else console.error(`
|
|
14
|
+
`);I.rmdirSync(B,{recursive:!0}),process.exit(0)}}else{let B=new Set,b=n(W),M=K.resolve(K.join(K3,"../templates/default")),N=B3.sync(["**/{styles,plugins}/**","postcss.config.*"],{cwd:K.join(M,"src"),onlyFiles:!0,ignore:S.filter((G)=>!G.includes("public"))}),j=await a({dependencies:["tailwindcss","tailwindcss-animate","@tailwindcss/typography","tailwindcss-react-aria-components","@designbycode/tailwindcss-mask-image"],devDependencies:["@tailwindcss/postcss","postcss"]});if(N.forEach((G)=>{let T=G.includes("postcss.config"),y=K.resolve(K.join(M,"src"),G),k=K.resolve(process.cwd(),T?G:`${L?.isSrcDir?"src":""}/${G}`);if(I.existsSync(k)){if(U?.overwrite)I.copyFileSync(y,k);else{let A3=I.readFileSync(k,"utf-8"),D3=I.readFileSync(y,"utf-8");if(A3!==D3)B.add({targetFile:k,sourceFile:y})}return}I.mkdirSync(K.dirname(k),{recursive:!0}),I.writeFileSync(k,""),I.copyFileSync(K.resolve(K.join(M,"src"),G),k)}),B.size&&!U?.overwrite)if(console.log(`
|
|
15
|
+
`),Z.fail("Following files already exist in the directory."),B.forEach((T)=>{console.log(`- ${R.green(T.targetFile)}`)}),(await d({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0})).overwrite){let T=m("Overwriting files").start();B.forEach((y)=>{I.copyFileSync(y.sourceFile,y.targetFile)}),T.succeed("Files are overwritten"),process.exit(1)}else console.log(`Use ${R.cyan("--overwrite")} or ${R.cyan("-o")} to overwrite existing files, or refer to the documentation ${R.cyan("https://untitled.xyz/docs")} for manual installation. The rest of the files are added.`),process.exit(0);if(b?.tailwindFile)console.log(`
|
|
16
16
|
Tailwind config file exists in the project directory. You can add it to your globals.css as follows:`),console.log(`
|
|
17
|
-
${
|
|
18
|
-
`);let
|
|
19
|
-
Your project is ready, you can now start adding components.`),process.exit(1)}}var
|
|
17
|
+
${R.cyan(`@config "../${L?.isSrcDir&&"../"}${K.relative(process.cwd(),b.tailwindFile)}";`)}
|
|
18
|
+
`);let q=b?.layoutFile||b?.appFile||"",H=new e3({tsConfigFilePath:K.resolve(b?.tsConfig||"")}).addSourceFileAtPath(K.resolve(q)),_=["colors.css","globals.css","inter.css","text-styles.css","theme.css","typography.css"];H.getImportDeclarations().filter((G)=>_.includes(G.getModuleSpecifierValue())).forEach((G)=>G.remove());let x=K.relative(K.resolve(process.cwd(),`${L?.isSrcDir&&"src"}`),q).split("/").length;H.addImportDeclarations(N.filter((G)=>G.includes("styles")).map((G)=>({moduleSpecifier:`${L?.aliasPrefix?.stylesPrefix||L?.aliasPrefix?.srcPrefix||"../".repeat(x-1)}${L?.aliasPrefix?.stylesPrefix?G?.split("styles/")[1]:G}`}))),H.saveSync();let A=m(),f=B3.sync(["**/styles/theme.css"],{cwd:W,absolute:!0,onlyFiles:!0,ignore:S});if(!f?.length)return Z.fail("Failed to copy theme.css file");if(q3("brand",U.color,f[0]??""),!j)A.fail("Failed to get dependencies from package.json"),process.exit(1);A.start("Installing dependencies"),await e(D(),[D()==="npm"?"install":"add",...j.dependencies],{}),await e(D(),[D()==="npm"?"install":"add","-D",...j.devDependencies],{}),A.succeed("Dependencies installed"),Z.succeed(R.green("Files are extracted successfully!")),console.log(`
|
|
19
|
+
Your project is ready, you can now start adding components.`),process.exit(1)}}var U3={name:"untitledui",version:"0.1.5",main:"dist/index.mjs",description:"Untitled UI CLI",type:"module",publishConfig:{access:"public"},scripts:{test:'echo "Error: no test specified" && exit 1',dev:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=http://localhost:3000/api --watch",build:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=https://untitledui-docs.vercel.app/api","publish:npm":"bun run build && npm publish --access public",start:"node dist/index.js"},repository:{type:"git",url:"https://github.com/a-peak-works/untitledui-tailwind.git"},bugs:{url:"https://github.com/a-peak-works/untitledui-tailwind/issues"},homepage:"https://github.com/a-peak-works/untitledui-tailwind#readme",keywords:["untitled-ui","cli","tailwindcss","nextjs"],files:["dist","templates"],author:"",license:"MIT",bin:{untitledui:"dist/index.mjs"},exports:"./dist/index.mjs",dependencies:{"async-retry":"^1.3.3",chalk:"^5.4.1",commander:"^13.1.0",execa:"^7.0.0","fast-glob":"^3.3.3","node-fetch":"^3.3.2",ora:"^8.2.0",prettier:"^3.5.3",prompts:"^2.4.2",tar:"^7.4.3","ts-morph":"^25.0.1","tsconfig-paths":"^4.2.0","update-check":"^1.5.4"},devDependencies:{"@types/async-retry":"^1.4.9","@types/prompts":"^2.4.9","@types/tar":"^6.1.13","type-fest":"^4.37.0",typescript:"^5.8.2"}};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function q0(){let z=new $0().name(U3.name).version(U3.version);z.addCommand(_3).addCommand(E3),z.parse()}q0();
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ import { BadgeGroup } from "@/components/shared/badges/badge-groups";
|
|
|
12
12
|
import Button from "@/components/shared/buttons/button";
|
|
13
13
|
import { Form } from "@/components/shared/form/form";
|
|
14
14
|
import { Input } from "@/components/shared/input";
|
|
15
|
-
import { cx } from "@/components/utils";
|
|
15
|
+
import { cx } from "@/components/utils/cx";
|
|
16
16
|
import Spiral from "../../public/marketing/spirals.webp";
|
|
17
17
|
|
|
18
18
|
const Header = dynamic(() => import("@/components/marketing/header-navigation/components/header").then((mod) => mod.Header));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Metadata, Viewport } from "next";
|
|
2
2
|
import { Inter } from "next/font/google";
|
|
3
|
-
import { cx } from "@/components/utils";
|
|
3
|
+
import { cx } from "@/components/utils/cx";
|
|
4
4
|
import { Theme } from "@/providers/theme";
|
|
5
5
|
import "@/styles/globals.css";
|
|
6
6
|
|
|
@@ -26,7 +26,7 @@ export default function RootLayout({
|
|
|
26
26
|
}>) {
|
|
27
27
|
return (
|
|
28
28
|
<html lang="en" suppressHydrationWarning>
|
|
29
|
-
<body className={cx(inter.variable, "light-mode bg-primary antialiased
|
|
29
|
+
<body className={cx(inter.variable, "light-mode dark:dark-mode bg-primary antialiased")}>
|
|
30
30
|
<Theme>{children}</Theme>
|
|
31
31
|
</body>
|
|
32
32
|
</html>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FC, ReactNode, Ref } from "react";
|
|
2
2
|
import { isValidElement } from "react";
|
|
3
|
-
import { cx, sortCx } from "@/components/utils";
|
|
3
|
+
import { cx, sortCx } from "@/components/utils/cx";
|
|
4
4
|
import { isReactComponent } from "@/components/utils/isReactComponent";
|
|
5
5
|
|
|
6
6
|
const iconsSizes = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { type FC, type ReactNode, isValidElement } from "react";
|
|
4
|
-
import { cx } from "@/components/utils";
|
|
4
|
+
import { cx } from "@/components/utils/cx";
|
|
5
5
|
import { isReactComponent } from "@/components/utils/isReactComponent";
|
|
6
6
|
|
|
7
7
|
interface NavMenuItemLinkProps {
|
|
@@ -7,7 +7,7 @@ import { Button as AriaButton, Dialog, DialogTrigger, Popover } from "react-aria
|
|
|
7
7
|
import UntitledLogo from "@/components/foundations/logo/UntitledLogo";
|
|
8
8
|
import UntitledLogoMinimal from "@/components/foundations/logo/UntitledLogoMinimal";
|
|
9
9
|
import Button from "@/components/shared/buttons/button";
|
|
10
|
-
import { cx } from "@/components/utils";
|
|
10
|
+
import { cx } from "@/components/utils/cx";
|
|
11
11
|
import { DropdownMenuSimple } from "../dropdown-header-navigation";
|
|
12
12
|
|
|
13
13
|
type HeaderNavItem = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { User01 } from "@untitledui/icons";
|
|
5
|
-
import { cx } from "@/components/utils";
|
|
5
|
+
import { cx } from "@/components/utils/cx";
|
|
6
6
|
import { type AvatarProps } from "./avatar";
|
|
7
7
|
import { AvatarOnlineIndicator, VerifiedTick } from "./base-components";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { type FC, type ReactNode, useState } from "react";
|
|
4
4
|
import { User01 } from "@untitledui/icons";
|
|
5
|
-
import { cx } from "@/components/utils";
|
|
5
|
+
import { cx } from "@/components/utils/cx";
|
|
6
6
|
import { AvatarOnlineIndicator, VerifiedTick } from "./base-components";
|
|
7
7
|
|
|
8
8
|
type AvatarSize = "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
package/templates/default/src/components/shared/avatar/base-components/avatar-add-button.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Plus } from "@untitledui/icons";
|
|
4
4
|
import type { ButtonProps } from "react-aria-components";
|
|
5
|
-
import { cx } from "@/components/utils";
|
|
5
|
+
import { cx } from "@/components/utils/cx";
|
|
6
6
|
import { Tooltip, TooltipTrigger } from "../../tooltips/tooltips";
|
|
7
7
|
|
|
8
8
|
const sizes = {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { FC, ReactNode } from "react";
|
|
4
4
|
import { isValidElement } from "react";
|
|
5
5
|
import { ArrowRight } from "@untitledui/icons";
|
|
6
|
-
import { cx, sortCx } from "@/components/utils";
|
|
6
|
+
import { cx, sortCx } from "@/components/utils/cx";
|
|
7
7
|
import { isReactComponent } from "@/components/utils/isReactComponent";
|
|
8
8
|
|
|
9
9
|
type Size = "md" | "lg";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { MouseEventHandler, ReactNode } from "react";
|
|
4
4
|
import { X as CloseX } from "@untitledui/icons";
|
|
5
5
|
import Dot from "@/components/foundations/dot-icon";
|
|
6
|
-
import { cx } from "@/components/utils";
|
|
6
|
+
import { cx } from "@/components/utils/cx";
|
|
7
7
|
import type { BadgeColors, BadgeTypeToColorMap, BadgeTypes, FlagTypes, IconComponentType, Sizes } from "./badge-types";
|
|
8
8
|
import { badgeTypes } from "./badge-types";
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { type FC, type PropsWithChildren, type ReactNode, type RefAttributes, createContext, isValidElement, useContext } from "react";
|
|
4
4
|
import { ToggleButton, ToggleButtonGroup, type ToggleButtonGroupProps, type ToggleButtonProps } from "react-aria-components";
|
|
5
|
-
import { cx, sortCx } from "@/components/utils";
|
|
5
|
+
import { cx, sortCx } from "@/components/utils/cx";
|
|
6
6
|
import { isReactComponent } from "@/components/utils/isReactComponent";
|
|
7
7
|
|
|
8
8
|
export const styles = sortCx({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { AnchorHTMLAttributes } from "react";
|
|
4
|
-
import { cx } from "@/components/utils";
|
|
4
|
+
import { cx } from "@/components/utils/cx";
|
|
5
5
|
|
|
6
6
|
export const GooglePlayButton = ({ size = "md", ...props }: AnchorHTMLAttributes<HTMLAnchorElement> & { size?: "md" | "lg" }) => {
|
|
7
7
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { AnchorHTMLAttributes } from "react";
|
|
4
|
-
import { cx } from "@/components/utils";
|
|
4
|
+
import { cx } from "@/components/utils/cx";
|
|
5
5
|
|
|
6
6
|
export const GooglePlayButton = ({ size = "md", ...props }: AnchorHTMLAttributes<HTMLAnchorElement> & { size?: "md" | "lg" }) => {
|
|
7
7
|
return (
|
|
@@ -4,7 +4,7 @@ import type { DetailedHTMLProps, FC, HTMLAttributes, ReactNode } from "react";
|
|
|
4
4
|
import React, { isValidElement } from "react";
|
|
5
5
|
import type { ButtonProps as AriaButtonProps } from "react-aria-components";
|
|
6
6
|
import { Button as AriaButton } from "react-aria-components";
|
|
7
|
-
import { cx, sortCx } from "@/components/utils";
|
|
7
|
+
import { cx, sortCx } from "@/components/utils/cx";
|
|
8
8
|
import { isReactComponent } from "@/components/utils/isReactComponent";
|
|
9
9
|
import { Tooltip } from "../tooltips/tooltips";
|
|
10
10
|
|
|
@@ -5,7 +5,7 @@ import React, { isValidElement } from "react";
|
|
|
5
5
|
import Link from "next/link";
|
|
6
6
|
import type { ButtonProps as AriaButtonProps, PressEvent } from "react-aria-components";
|
|
7
7
|
import { Button as AriaButton } from "react-aria-components";
|
|
8
|
-
import { cx, sortCx } from "@/components/utils";
|
|
8
|
+
import { cx, sortCx } from "@/components/utils/cx";
|
|
9
9
|
import { isReactComponent } from "@/components/utils/isReactComponent";
|
|
10
10
|
|
|
11
11
|
export const styles = sortCx({
|
|
@@ -4,7 +4,7 @@ import type { AnchorHTMLAttributes, ButtonHTMLAttributes, DetailedHTMLProps } fr
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import type { ButtonProps as AriaButtonProps } from "react-aria-components";
|
|
6
6
|
import { Button as AriaButton } from "react-aria-components";
|
|
7
|
-
import { cx, sortCx } from "@/components/utils";
|
|
7
|
+
import { cx, sortCx } from "@/components/utils/cx";
|
|
8
8
|
import { AppleLogo, DribbleLogo, FacebookLogo, FigmaLogo, FigmaLogoOutlined, GoogleLogo, TwitterLogo } from "./social-logos";
|
|
9
9
|
|
|
10
10
|
export const styles = sortCx({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { ReactNode, Ref } from "react";
|
|
4
4
|
import { Checkbox as AriaCheckbox, type CheckboxProps as AriaCheckboxProps } from "react-aria-components";
|
|
5
|
-
import { cx } from "@/components/utils";
|
|
5
|
+
import { cx } from "@/components/utils/cx";
|
|
6
6
|
|
|
7
7
|
export interface CheckboxBaseProps {
|
|
8
8
|
size?: "sm" | "md";
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
SeparatorProps,
|
|
11
11
|
} from "react-aria-components";
|
|
12
12
|
import { Button as AriaButton, Header, Menu, MenuItem, MenuSection, MenuTrigger, Popover, Separator } from "react-aria-components";
|
|
13
|
-
import { cx } from "@/components/utils";
|
|
13
|
+
import { cx } from "@/components/utils/cx";
|
|
14
14
|
|
|
15
15
|
interface DropdownItemProps extends MenuItemProps {
|
|
16
16
|
/** The label of the item to be displayed. */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { ReactNode, Ref } from "react";
|
|
4
4
|
import type { TextProps as AriaTextProps } from "react-aria-components";
|
|
5
5
|
import { Text as AriaText } from "react-aria-components";
|
|
6
|
-
import { cx } from "@/components/utils";
|
|
6
|
+
import { cx } from "@/components/utils/cx";
|
|
7
7
|
|
|
8
8
|
interface HintTextProps extends AriaTextProps {
|
|
9
9
|
children: ReactNode;
|
|
@@ -7,7 +7,7 @@ import { Input as AriaInput, TextField as AriaTextField, Group } from "react-ari
|
|
|
7
7
|
import HintText from "@/components/shared/input/hint-text";
|
|
8
8
|
import Label from "@/components/shared/input/label";
|
|
9
9
|
import { Tooltip, TooltipTrigger } from "@/components/shared/tooltips/tooltips";
|
|
10
|
-
import { cx, sortCx } from "@/components/utils";
|
|
10
|
+
import { cx, sortCx } from "@/components/utils/cx";
|
|
11
11
|
|
|
12
12
|
export interface InputBaseProps extends TextFieldProps {
|
|
13
13
|
label?: string;
|
|
@@ -7,7 +7,7 @@ import type { InputBaseProps } from "@/components/shared/input";
|
|
|
7
7
|
import { InputBase } from "@/components/shared/input";
|
|
8
8
|
import HintText from "@/components/shared/input/hint-text";
|
|
9
9
|
import Label from "@/components/shared/input/label";
|
|
10
|
-
import { cx } from "@/components/utils";
|
|
10
|
+
import { cx } from "@/components/utils/cx";
|
|
11
11
|
|
|
12
12
|
const cardTypes = [
|
|
13
13
|
{
|
|
@@ -10,7 +10,7 @@ import type { InputBaseProps } from "@/components/shared/input";
|
|
|
10
10
|
import { InputBase } from "@/components/shared/input";
|
|
11
11
|
import HintText from "@/components/shared/input/hint-text";
|
|
12
12
|
import Label from "@/components/shared/input/label";
|
|
13
|
-
import { cx } from "@/components/utils";
|
|
13
|
+
import { cx } from "@/components/utils/cx";
|
|
14
14
|
|
|
15
15
|
interface InputWithButtonProps extends Omit<InputBaseProps, "icon"> {
|
|
16
16
|
buttonText: string;
|
|
@@ -8,7 +8,7 @@ import type { InputBaseProps } from "@/components/shared/input";
|
|
|
8
8
|
import { InputBase } from "@/components/shared/input";
|
|
9
9
|
import HintText from "@/components/shared/input/hint-text";
|
|
10
10
|
import Label from "@/components/shared/input/label";
|
|
11
|
-
import { cx, sortCx } from "@/components/utils";
|
|
11
|
+
import { cx, sortCx } from "@/components/utils/cx";
|
|
12
12
|
|
|
13
13
|
interface SelectorComponentProps {
|
|
14
14
|
size: "sm" | "md";
|
|
@@ -5,7 +5,7 @@ import type { InputBaseProps } from "@/components/shared/input";
|
|
|
5
5
|
import { InputBase, TextField } from "@/components/shared/input";
|
|
6
6
|
import HintText from "@/components/shared/input/hint-text";
|
|
7
7
|
import Label from "@/components/shared/input/label";
|
|
8
|
-
import { cx } from "@/components/utils";
|
|
8
|
+
import { cx } from "@/components/utils/cx";
|
|
9
9
|
|
|
10
10
|
interface InputPrefixProps extends HTMLAttributes<HTMLDivElement> {
|
|
11
11
|
position?: "leading" | "trailing";
|
|
@@ -5,7 +5,7 @@ import { HelpCircle } from "@untitledui/icons";
|
|
|
5
5
|
import type { LabelProps as AriaLabelProps } from "react-aria-components";
|
|
6
6
|
import { Label as AriaLabel } from "react-aria-components";
|
|
7
7
|
import { Tooltip, TooltipTrigger } from "@/components/shared/tooltips/tooltips";
|
|
8
|
-
import { cx } from "@/components/utils";
|
|
8
|
+
import { cx } from "@/components/utils/cx";
|
|
9
9
|
|
|
10
10
|
interface LabelProps extends AriaLabelProps {
|
|
11
11
|
children: ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { cx } from "@/components/utils";
|
|
3
|
+
import { cx } from "@/components/utils/cx";
|
|
4
4
|
|
|
5
5
|
export interface ProgressBarProps {
|
|
6
6
|
value: number;
|
|
@@ -61,7 +61,7 @@ export const ProgressBarTextTopFloating = ({ value, min = 0, max = 100, valueFor
|
|
|
61
61
|
<ProgressBar min={min} max={max} value={value} />
|
|
62
62
|
<div
|
|
63
63
|
style={{ left: `${percentage}%` }}
|
|
64
|
-
className="absolute -top-2 -translate-x-1/2 -translate-y-full rounded-lg bg-primary_alt px-3 py-2
|
|
64
|
+
className="absolute -top-2 -translate-x-1/2 -translate-y-full rounded-lg bg-primary_alt px-3 py-2 shadow-lg ring-1 ring-border-secondary_alt"
|
|
65
65
|
>
|
|
66
66
|
<div className="tt-xs-semi text-secondary tabular-nums">{valueFormatter ? valueFormatter(value, percentage) : `${percentage}%`}</div>
|
|
67
67
|
</div>
|
|
@@ -77,7 +77,7 @@ export const ProgressBarTextBottomFloating = ({ value, min = 0, max = 100, value
|
|
|
77
77
|
<ProgressBar min={min} max={max} value={value} />
|
|
78
78
|
<div
|
|
79
79
|
style={{ left: `${percentage}%` }}
|
|
80
|
-
className="absolute -bottom-2 -translate-x-1/2 translate-y-full rounded-lg bg-primary_alt px-3 py-2
|
|
80
|
+
className="absolute -bottom-2 -translate-x-1/2 translate-y-full rounded-lg bg-primary_alt px-3 py-2 shadow-lg ring-1 ring-border-secondary_alt"
|
|
81
81
|
>
|
|
82
82
|
<div className="tt-xs-semi text-secondary">{valueFormatter ? valueFormatter(value, percentage) : `${percentage}%`}</div>
|
|
83
83
|
</div>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { type ReactNode, type Ref, createContext, useContext } from "react";
|
|
4
4
|
import type { RadioGroupProps as AriaRadioGroupProps } from "react-aria-components";
|
|
5
5
|
import { type RadioProps as AriaRadioProps, Radio, RadioGroup } from "react-aria-components";
|
|
6
|
-
import { cx } from "@/components/utils";
|
|
6
|
+
import { cx } from "@/components/utils/cx";
|
|
7
7
|
|
|
8
8
|
export interface RadioButtonGroupContextType {
|
|
9
9
|
size?: "sm" | "md";
|
|
@@ -4,7 +4,7 @@ import type { RadioGroupProps } from "react-aria-components";
|
|
|
4
4
|
import { Label, Radio, RadioGroup, Text } from "react-aria-components";
|
|
5
5
|
import AvatarComponent from "@/components/shared/avatar/avatar";
|
|
6
6
|
import { CheckboxBase } from "@/components/shared/checkbox/checkbox";
|
|
7
|
-
import { cx } from "@/components/utils";
|
|
7
|
+
import { cx } from "@/components/utils/cx";
|
|
8
8
|
|
|
9
9
|
interface AvatarItemType {
|
|
10
10
|
id: string;
|
|
@@ -4,7 +4,7 @@ import type { FC } from "react";
|
|
|
4
4
|
import type { RadioGroupProps } from "react-aria-components";
|
|
5
5
|
import { Label, Radio, RadioGroup, Text } from "react-aria-components";
|
|
6
6
|
import { CheckboxBase } from "@/components/shared/checkbox/checkbox";
|
|
7
|
-
import { cx } from "@/components/utils";
|
|
7
|
+
import { cx } from "@/components/utils/cx";
|
|
8
8
|
|
|
9
9
|
type RadioGroupItemType = {
|
|
10
10
|
value: string;
|
|
@@ -6,7 +6,7 @@ import { Radio, RadioGroup } from "react-aria-components";
|
|
|
6
6
|
import { FeaturedIcon } from "@/components/foundations/featured-icon/featured-icons";
|
|
7
7
|
import { BadgeWithDot } from "@/components/shared/badges/badges";
|
|
8
8
|
import { CheckboxBase } from "@/components/shared/checkbox/checkbox";
|
|
9
|
-
import { cx } from "@/components/utils";
|
|
9
|
+
import { cx } from "@/components/utils/cx";
|
|
10
10
|
|
|
11
11
|
type IconCardItemType = {
|
|
12
12
|
value: string;
|
|
@@ -5,7 +5,7 @@ import type { RadioGroupProps } from "react-aria-components";
|
|
|
5
5
|
import { Label, Radio, RadioGroup, Text } from "react-aria-components";
|
|
6
6
|
import { FeaturedIcon } from "@/components/foundations/featured-icon/featured-icons";
|
|
7
7
|
import { CheckboxBase } from "@/components/shared/checkbox/checkbox";
|
|
8
|
-
import { cx } from "@/components/utils";
|
|
8
|
+
import { cx } from "@/components/utils/cx";
|
|
9
9
|
|
|
10
10
|
type RadioGroupItemType = {
|
|
11
11
|
value: string;
|
|
@@ -5,7 +5,7 @@ import type { RadioGroupProps } from "react-aria-components";
|
|
|
5
5
|
import { Label, Radio, RadioGroup, Text } from "react-aria-components";
|
|
6
6
|
import Button from "@/components/shared/buttons/button";
|
|
7
7
|
import { CheckboxBase } from "@/components/shared/checkbox/checkbox";
|
|
8
|
-
import { cx } from "@/components/utils";
|
|
8
|
+
import { cx } from "@/components/utils/cx";
|
|
9
9
|
|
|
10
10
|
interface PaymentCardItemType {
|
|
11
11
|
value: string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { FC } from "react";
|
|
4
4
|
import type { RadioGroupProps } from "react-aria-components";
|
|
5
5
|
import { Label, Radio, RadioGroup, Text } from "react-aria-components";
|
|
6
|
-
import { cx } from "@/components/utils";
|
|
6
|
+
import { cx } from "@/components/utils/cx";
|
|
7
7
|
|
|
8
8
|
type RadioGroupItemType = {
|
|
9
9
|
value: string;
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
ComboBoxStateContext,
|
|
14
14
|
} from "react-aria-components";
|
|
15
15
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
16
|
-
import { cx } from "@/components/utils";
|
|
16
|
+
import { cx } from "@/components/utils/cx";
|
|
17
17
|
import { useResizeObserver } from "@/hooks/use-resize-observer";
|
|
18
18
|
import HintText from "../input/hint-text";
|
|
19
19
|
import Label from "../input/label";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
17
17
|
import type { ListData } from "react-stately";
|
|
18
18
|
import { useListData } from "react-stately";
|
|
19
|
-
import { cx } from "@/components/utils";
|
|
19
|
+
import { cx } from "@/components/utils/cx";
|
|
20
20
|
import { useResizeObserver } from "@/hooks/use-resize-observer";
|
|
21
21
|
import Avatar from "../avatar/avatar";
|
|
22
22
|
import type { IconComponentType } from "../badges/badge-types";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { RefAttributes } from "react";
|
|
4
4
|
import type { PopoverProps as AriaPopoverProps } from "react-aria-components";
|
|
5
5
|
import { Popover as AriaPopover } from "react-aria-components";
|
|
6
|
-
import { cx } from "@/components/utils";
|
|
6
|
+
import { cx } from "@/components/utils/cx";
|
|
7
7
|
|
|
8
8
|
interface PopoverProps extends AriaPopoverProps, RefAttributes<HTMLElement> {
|
|
9
9
|
size: "sm" | "md";
|
|
@@ -5,7 +5,7 @@ import { Check } from "@untitledui/icons";
|
|
|
5
5
|
import type { ListBoxItemProps as AriaListBoxItemProps } from "react-aria-components";
|
|
6
6
|
import { ListBoxItem as AriaListBoxItem, Text } from "react-aria-components";
|
|
7
7
|
import Avatar from "@/components/shared/avatar/avatar";
|
|
8
|
-
import { cx } from "@/components/utils";
|
|
8
|
+
import { cx } from "@/components/utils/cx";
|
|
9
9
|
import type { SelectItemType } from "./select";
|
|
10
10
|
import { SelectContext } from "./select";
|
|
11
11
|
|
|
@@ -9,7 +9,7 @@ import Avatar from "@/components/shared/avatar/avatar";
|
|
|
9
9
|
import type { IconComponentType } from "@/components/shared/badges/badge-types";
|
|
10
10
|
import HintText from "@/components/shared/input/hint-text";
|
|
11
11
|
import Label from "@/components/shared/input/label";
|
|
12
|
-
import { cx } from "@/components/utils";
|
|
12
|
+
import { cx } from "@/components/utils/cx";
|
|
13
13
|
import { ComboBox } from "./combobox";
|
|
14
14
|
import { Popover } from "./popover";
|
|
15
15
|
import Item from "./select-item";
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import type { SliderProps as AriaSliderProps } from "react-aria-components";
|
|
4
4
|
import { Slider as AriaSlider, Label, SliderOutput, SliderThumb, SliderTrack } from "react-aria-components";
|
|
5
|
-
import { cx, sortCx } from "@/components/utils";
|
|
5
|
+
import { cx, sortCx } from "@/components/utils/cx";
|
|
6
6
|
|
|
7
7
|
const styles = sortCx({
|
|
8
8
|
default: "hidden",
|
|
9
9
|
bottom: "absolute top-2 left-1/2 -translate-x-1/2 translate-y-full text-md leading-md font-medium text-primary",
|
|
10
10
|
"top-floating":
|
|
11
|
-
"absolute -top-2 left-1/2 -translate-x-1/2 -translate-y-full rounded-lg bg-primary px-3 py-2 text-xs leading-xs font-semibold text-secondary
|
|
11
|
+
"absolute -top-2 left-1/2 -translate-x-1/2 -translate-y-full rounded-lg bg-primary px-3 py-2 text-xs leading-xs font-semibold text-secondary shadow-lg ring-1 ring-border-secondary_alt",
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
interface SliderProps extends AriaSliderProps {
|
|
@@ -55,7 +55,7 @@ export const Slider = ({
|
|
|
55
55
|
index={index}
|
|
56
56
|
className={({ isFocusVisible, isDragging }) =>
|
|
57
57
|
cx(
|
|
58
|
-
"absolute top-1/2 z-50 box-border size-6 cursor-grab rounded-full bg-slider-handle-bg
|
|
58
|
+
"absolute top-1/2 z-50 box-border size-6 cursor-grab rounded-full bg-slider-handle-bg shadow-md ring-2 ring-slider-handle-border ring-inset",
|
|
59
59
|
isFocusVisible && "outline-2 outline-offset-2 outline-focus-ring",
|
|
60
60
|
isDragging && "cursor-grabbing",
|
|
61
61
|
)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { RefAttributes } from "react";
|
|
4
4
|
import { XClose } from "@untitledui/icons";
|
|
5
5
|
import { Button as AriaButton, type ButtonProps } from "react-aria-components";
|
|
6
|
-
import { cx } from "@/components/utils";
|
|
6
|
+
import { cx } from "@/components/utils/cx";
|
|
7
7
|
|
|
8
8
|
interface TagCloseXProps extends ButtonProps, RefAttributes<HTMLButtonElement> {
|
|
9
9
|
size?: "sm" | "md" | "lg";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
type TagProps as AriaTagProps,
|
|
10
10
|
} from "react-aria-components";
|
|
11
11
|
import Dot from "@/components/foundations/dot-icon";
|
|
12
|
-
import { cx } from "@/components/utils";
|
|
12
|
+
import { cx } from "@/components/utils/cx";
|
|
13
13
|
import Avatar from "../avatar/avatar";
|
|
14
14
|
import TagCheckbox from "./base-components/tag-checkbox";
|
|
15
15
|
import { TagCloseX } from "./base-components/tag-close-x";
|
|
@@ -6,7 +6,7 @@ import type { TextAreaProps as AriaTextAreaProps, TextFieldProps as AriaTextFiel
|
|
|
6
6
|
import { TextArea as AriaTextArea } from "react-aria-components";
|
|
7
7
|
import HintText from "@/components/shared/input/hint-text";
|
|
8
8
|
import Label from "@/components/shared/input/label";
|
|
9
|
-
import { cx } from "@/components/utils";
|
|
9
|
+
import { cx } from "@/components/utils/cx";
|
|
10
10
|
import { TextField } from "../input";
|
|
11
11
|
|
|
12
12
|
interface TextAreaBaseProps extends AriaTextAreaProps {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { ReactNode } from "react";
|
|
4
4
|
import type { SwitchProps } from "react-aria-components";
|
|
5
5
|
import { Switch } from "react-aria-components";
|
|
6
|
-
import { cx } from "@/components/utils";
|
|
6
|
+
import { cx } from "@/components/utils/cx";
|
|
7
7
|
|
|
8
8
|
interface ToggleBaseProps {
|
|
9
9
|
size?: "sm" | "md";
|
|
@@ -7,7 +7,7 @@ import type { FocusableElement } from "@react-types/shared";
|
|
|
7
7
|
import { mergeProps, useFocusable } from "react-aria";
|
|
8
8
|
import { Tooltip as AriaTooltip, TooltipTrigger as AriaTooltipTrigger, Button, OverlayArrow } from "react-aria-components";
|
|
9
9
|
import type { TooltipProps as AriaTooltipProps, ButtonProps, TooltipTriggerComponentProps } from "react-aria-components";
|
|
10
|
-
import { cx } from "@/components/utils";
|
|
10
|
+
import { cx } from "@/components/utils/cx";
|
|
11
11
|
|
|
12
12
|
const padding: Partial<Record<Placement, string>> = {
|
|
13
13
|
"top left": "px-2.5",
|