@nqlib/nqui 0.4.0 → 0.4.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/INSTALLATION.md +215 -0
- package/README.md +2 -1
- package/dist/command-palette-BuYcxPCc.cjs +5 -0
- package/dist/command-palette-dEJ9aEk4.js +694 -0
- package/dist/command.cjs.js +1 -1
- package/dist/command.es.js +1 -1
- package/dist/components/custom/enhanced-badge.d.ts +1 -1
- package/dist/components/custom/enhanced-button.d.ts +6 -1
- package/dist/components/custom/enhanced-button.d.ts.map +1 -1
- package/dist/components/custom/enhanced-checkbox.d.ts +11 -0
- package/dist/components/custom/enhanced-checkbox.d.ts.map +1 -1
- package/dist/components/custom/enhanced-radio-group.d.ts +13 -4
- package/dist/components/custom/enhanced-radio-group.d.ts.map +1 -1
- package/dist/components/custom/enhanced-sonner.d.ts +5 -6
- package/dist/components/custom/enhanced-sonner.d.ts.map +1 -1
- package/dist/components/custom/enhanced-tabs.d.ts.map +1 -1
- package/dist/components/error-boundary.d.ts +20 -0
- package/dist/components/error-boundary.d.ts.map +1 -0
- package/dist/components/index.d.ts +102 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/checkbox.d.ts +4 -1
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/input-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group.d.ts +3 -1
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/debug-panel-AjzBdMMz.js +9198 -0
- package/dist/debug-panel-NaOmD68t.cjs +171 -0
- package/dist/debug.cjs.js +1 -0
- package/dist/debug.es.js +7 -0
- package/dist/drawer-Cqq0Ozb2.cjs +1 -0
- package/dist/{drawer-CU4lkcz7.js → drawer-pUXPg3lF.js} +2 -2
- package/dist/drawer.cjs.js +1 -1
- package/dist/drawer.es.js +1 -1
- package/dist/entries/debug.d.ts +14 -0
- package/dist/entries/debug.d.ts.map +1 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -1
- package/dist/hooks/use-scroll-spy.d.ts.map +1 -1
- package/dist/index-CI756mSv.cjs +41 -0
- package/dist/index-CgfzsUO6.js +1069 -0
- package/dist/index.d.ts +2 -98
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/index.d.ts +9 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/nqui.cjs.js +42 -212
- package/dist/nqui.es.js +8589 -17780
- package/dist/sonner-BtzU00r3.js +248 -0
- package/dist/sonner-Dfk26eds.cjs +54 -0
- package/dist/sonner.cjs.js +1 -1
- package/dist/sonner.es.js +1 -1
- package/dist/styles.css +3 -0
- package/docs/components/README.md +99 -1
- package/docs/components/nqui-card.md +7 -0
- package/docs/components/nqui-checkbox.md +23 -1
- package/docs/components/nqui-radio-group.md +45 -2
- package/docs/components/nqui-tabs.md +11 -1
- package/docs/nqui-skills/SKILL.md +95 -0
- package/docs/nqui-skills/design-system.md +130 -0
- package/docs/nqui-skills/rules/composition.md +183 -0
- package/docs/nqui-skills/rules/forms.md +190 -0
- package/docs/nqui-skills/rules/icons.md +158 -0
- package/docs/nqui-skills/rules/styling.md +192 -0
- package/package.json +23 -10
- package/scripts/cli.js +1 -0
- package/scripts/download-skills.js +91 -0
- package/scripts/examples/nextjs-layout-sidebar.tsx +100 -0
- package/scripts/examples/nextjs-page-sidebar.tsx +81 -0
- package/scripts/examples/vite-app.tsx +135 -0
- package/scripts/examples/vite-main.tsx +17 -0
- package/scripts/examples.js +92 -6
- package/scripts/generate-docs.js +169 -0
- package/scripts/init-css.js +34 -14
- package/scripts/init-cursor.js +8 -0
- package/scripts/post-install.js +41 -9
- package/scripts/resolve-target-dir.js +20 -1
- package/scripts/wizard.js +12 -7
- package/dist/command-palette-UHk8zZOg.cjs +0 -45
- package/dist/command-palette-d-TrdBsM.js +0 -1778
- package/dist/drawer-BcIxWRN8.cjs +0 -1
- package/dist/sonner-Co6YpYVs.js +0 -546
- package/dist/sonner-DbQhVp8m.cjs +0 -330
package/INSTALLATION.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# nqui – Installation & CLI reference
|
|
2
|
+
|
|
3
|
+
Developer guide: what runs on install, available commands, and the recommended setup sequence.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## What runs on `npm install`
|
|
8
|
+
|
|
9
|
+
When you add `@nqlib/nqui` to a project and run `npm install` (or pnpm/yarn/bun):
|
|
10
|
+
|
|
11
|
+
1. **Postinstall script** runs: `node scripts/post-install.js` (same as `npx @nqlib/nqui setup`).
|
|
12
|
+
2. **Behavior:**
|
|
13
|
+
- If your project has a `package.json` and no `nqui:init` script, a **`nqui:init`** script is added to run the full setup in one command.
|
|
14
|
+
- **Cursor rules** are written into your project’s `.cursor/` directory:
|
|
15
|
+
- `.cursor/rules/nqui-components.mdc`
|
|
16
|
+
- `.cursor/skills/nqui-install/`
|
|
17
|
+
- `.cursor/skills/nqui-components/`
|
|
18
|
+
- A **next-steps message** is printed (run `npx nqui-setup` anytime to see it again).
|
|
19
|
+
3. **Not done on install:** Peer packages are not installed, `.cursor/nqui-skills/` is not created, and CSS is not set up. Run the full setup (see below) for that.
|
|
20
|
+
4. **CI:** Postinstall is skipped when `CI=true` or `CI=1`.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## CLI commands
|
|
25
|
+
|
|
26
|
+
All commands are run from your **project root** (where `package.json` lives).
|
|
27
|
+
|
|
28
|
+
| Command | Description |
|
|
29
|
+
|--------|-------------|
|
|
30
|
+
| `npx @nqlib/nqui setup` | Re-run postinstall: print next steps and write Cursor rules (no peers/skills/CSS). Same as `npx nqui-setup`. |
|
|
31
|
+
| `npx @nqlib/nqui install-peers` | Install `@nqlib/nqui` and all required + optional peer dependencies (icons, cmdk, dnd-kit, etc.). |
|
|
32
|
+
| `npx @nqlib/nqui init-cursor` | Write `.cursor/rules` and `.cursor/skills`, and **download nqui-skills** (copy `docs/nqui-skills` → `.cursor/nqui-skills`, create `AGENTS.md`). |
|
|
33
|
+
| `npx @nqlib/nqui init-skills` | Only download skills: copy to `.cursor/nqui-skills`, (re)create `AGENTS.md`. Use `--force` to overwrite. |
|
|
34
|
+
| `npx @nqlib/nqui init-css` | Detect framework, create `nqui/index.css` and `nqui/nqui-setup.css`, optionally copy example layouts. Options: `--sidebar`, `--force`, `--wizard`. |
|
|
35
|
+
| `npx @nqlib/nqui` _(no args)_ | Runs **init-css** with default output `nqui/index.css`. |
|
|
36
|
+
| `npx @nqlib/nqui init-debug` / `init-debug-css` | Initialize debug CSS for `DebugPanel`. |
|
|
37
|
+
| `npm run nqui:init` | One-shot full setup (only after install added the script): install-peers → init-cursor → init-skills → init-css --sidebar --force. |
|
|
38
|
+
|
|
39
|
+
**Monorepos:** Cursor rules and skills are written to the package that has `@nqlib/nqui` in `node_modules` or in its `package.json`. Open that package folder in Cursor for skills to resolve.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Recommended sequence
|
|
44
|
+
|
|
45
|
+
### Option A: One command (after install)
|
|
46
|
+
|
|
47
|
+
If postinstall added the script:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm run nqui:init
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This runs: **install-peers** → **init-cursor** → **init-skills** → **init-css --sidebar --force**.
|
|
54
|
+
|
|
55
|
+
Then **manually** add the nqui CSS import to your main CSS file (see [Step 2: Setup CSS](#step-2-setup-css-required) below).
|
|
56
|
+
|
|
57
|
+
### Option B: Step by step
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# 1. Install nqui + minimal deps (or use install-peers for full)
|
|
61
|
+
npm install @nqlib/nqui @hugeicons/react @hugeicons/core-free-icons
|
|
62
|
+
# or: npx @nqlib/nqui install-peers
|
|
63
|
+
|
|
64
|
+
# 2. Cursor rules + nqui-skills
|
|
65
|
+
npx @nqlib/nqui init-cursor
|
|
66
|
+
|
|
67
|
+
# 3. (Optional) Refresh skills only
|
|
68
|
+
npx @nqlib/nqui init-skills
|
|
69
|
+
|
|
70
|
+
# 4. CSS setup
|
|
71
|
+
npx @nqlib/nqui init-css --sidebar
|
|
72
|
+
# Then add the import to your main CSS (see Step 2 below)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Requirements
|
|
78
|
+
|
|
79
|
+
- **React 18 or 19** (peer: `^18.0.0 || ^19.0.0`)
|
|
80
|
+
- **Tailwind CSS v4**
|
|
81
|
+
- **Node.js** per your framework
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Step 1: Install nqui + peers
|
|
86
|
+
|
|
87
|
+
**Minimal (icons required for most components):**
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm install @nqlib/nqui @hugeicons/react @hugeicons/core-free-icons
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Full (all optional peers for Sortable, Carousel, DataTable, Calendar, etc.):**
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npx @nqlib/nqui install-peers
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Step 2: Setup CSS (required)
|
|
102
|
+
|
|
103
|
+
### 2a. Run init-css
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npx @nqlib/nqui init-css
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Creates:
|
|
110
|
+
|
|
111
|
+
- `nqui/index.css` — imports `@nqlib/nqui/styles`
|
|
112
|
+
- `nqui/nqui-setup.css` — framework-specific Tailwind + nqui snippet
|
|
113
|
+
|
|
114
|
+
### 2b. Add import to main CSS (manual)
|
|
115
|
+
|
|
116
|
+
Add the nqui import to your **main CSS file**:
|
|
117
|
+
|
|
118
|
+
| Framework | Main CSS file |
|
|
119
|
+
|-----------|----------------|
|
|
120
|
+
| Next.js | `app/globals.css` |
|
|
121
|
+
| Vite | `src/index.css` |
|
|
122
|
+
| Remix | `app/root.css` |
|
|
123
|
+
|
|
124
|
+
**Option A (recommended):** After `@import "tailwindcss"`:
|
|
125
|
+
|
|
126
|
+
```css
|
|
127
|
+
@import "@nqlib/nqui/styles";
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Option B:** Copy the **entire contents** of `nqui/nqui-setup.css` to the **very top** of your main CSS file.
|
|
131
|
+
|
|
132
|
+
### 2c. Next.js + Tailwind v4
|
|
133
|
+
|
|
134
|
+
Include these in your main CSS:
|
|
135
|
+
|
|
136
|
+
```css
|
|
137
|
+
@source "./**/*.{js,ts,jsx,tsx,mdx}";
|
|
138
|
+
@source "../components/**/*.{js,ts,jsx,tsx,mdx}";
|
|
139
|
+
@source "../node_modules/@nqlib/nqui/dist/**/*.js";
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 2d. Custom path
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npx @nqlib/nqui init-css app/styles/nqui.css
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Step 3: Use components
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import { Button, Input, Card } from "@nqlib/nqui";
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Next.js App Router pages that use nqui need `"use client"`.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Step 4: Debug tools (optional)
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npx @nqlib/nqui init-debug-css
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Then in your app:
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
import { DebugPanel } from "@nqlib/nqui";
|
|
170
|
+
import "./nqui-debug.css"; // or path from init-debug-css
|
|
171
|
+
|
|
172
|
+
// In your root/layout: render when NODE_ENV === 'development'
|
|
173
|
+
<DebugPanel />
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Step 5: Cursor / IDE rules
|
|
179
|
+
|
|
180
|
+
On install, basic rules are written to `.cursor/rules/nqui-components.mdc`. For the full **nqui-skills** set (`.cursor/nqui-skills/` and `AGENTS.md`), run:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
npx @nqlib/nqui init-cursor
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Component docs index: `node_modules/@nqlib/nqui/docs/components/README.md`.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Optional: Local vs published nqui
|
|
191
|
+
|
|
192
|
+
To switch between a **local** (linked) build and the **published** npm package during development, you can add a `scripts/toggle-nqui.js` script to your app and wire it to your `dev` script. This is optional and not created by nqui. See the nqui skill **nqui-local-published-toggle** for the script and usage (e.g. `USE_LOCAL_NQUI=true node scripts/toggle-nqui.js && next dev`).
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Troubleshooting
|
|
197
|
+
|
|
198
|
+
**"Module not found: '@nqlib/nqui/styles'" or CSS not loading**
|
|
199
|
+
|
|
200
|
+
1. Run `npx @nqlib/nqui init-css`.
|
|
201
|
+
2. Add `@import "@nqlib/nqui/styles";` near the **top** of your main CSS file.
|
|
202
|
+
3. Ensure it appears **before** other app styles.
|
|
203
|
+
|
|
204
|
+
**Components render without styles**
|
|
205
|
+
|
|
206
|
+
Your main CSS is missing the nqui import. Add `@import "@nqlib/nqui/styles";` or paste the contents of `nqui/nqui-setup.css` at the top of your main CSS.
|
|
207
|
+
|
|
208
|
+
**Debug Panel not showing**
|
|
209
|
+
|
|
210
|
+
- Ensure `NODE_ENV !== 'production'`.
|
|
211
|
+
- Import the debug CSS and render `<DebugPanel />` in your app tree.
|
|
212
|
+
|
|
213
|
+
**Package name**
|
|
214
|
+
|
|
215
|
+
Use `@nqlib/nqui` (the published package name).
|
package/README.md
CHANGED
|
@@ -24,7 +24,8 @@ Hugeicons is required for icon display in components (Button, Accordion, Select,
|
|
|
24
24
|
npx @nqlib/nqui install-peers
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
**After install:** A post-install message will show the next steps. Run `npx nqui-setup` anytime to see them again.
|
|
27
|
+
**After install:** A post-install message will show the next steps. Run `npx nqui-setup` anytime to see them again.
|
|
28
|
+
**Full setup & CLI reference:** See [INSTALLATION.md](./INSTALLATION.md) (what runs on install, all commands, recommended sequence).
|
|
28
29
|
|
|
29
30
|
**Alternative:** Install from GitHub Packages (requires GitHub account + token):
|
|
30
31
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),ge=require("react"),x=require("cmdk"),d=require("./utils-IjLH3w2e.cjs"),I=require("./button-CYFTFDKe.cjs"),N=require("@hugeicons/react"),_=require("@hugeicons/core-free-icons"),i=require("./index-CI756mSv.cjs"),me=require("@radix-ui/react-slot"),O=require("class-variance-authority"),j=require("./keyboard-BapbM2wb.cjs");function fe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const l=fe(ge);var D="Dialog",[T,xe]=i.createContextScope(D),[he,p]=T(D),S=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:s,onOpenChange:r,modal:u=!0}=e,c=l.useRef(null),m=l.useRef(null),[h,g]=i.useControllableState({prop:a,defaultProp:s??!1,onChange:r,caller:D});return o.jsx(he,{scope:t,triggerRef:c,contentRef:m,contentId:i.useId(),titleId:i.useId(),descriptionId:i.useId(),open:h,onOpenChange:g,onOpenToggle:l.useCallback(()=>g(v=>!v),[g]),modal:u,children:n})};S.displayName=D;var A="DialogTrigger",G=l.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=p(A,n),r=i.useComposedRefs(t,s.triggerRef);return o.jsx(i.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":w(s.open),...a,ref:r,onClick:i.composeEventHandlers(e.onClick,s.onOpenToggle)})});G.displayName=A;var k="DialogPortal",[ve,M]=T(k,{forceMount:void 0}),z=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,r=p(k,t);return o.jsx(ve,{scope:t,forceMount:n,children:l.Children.map(a,u=>o.jsx(i.Presence,{present:n||r.open,children:o.jsx(i.Portal,{asChild:!0,container:s,children:u})}))})};z.displayName=k;var C="DialogOverlay",F=l.forwardRef((e,t)=>{const n=M(C,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,r=p(C,e.__scopeDialog);return r.modal?o.jsx(i.Presence,{present:a||r.open,children:o.jsx(Ce,{...s,ref:t})}):null});F.displayName=C;var be=me.createSlot("DialogOverlay.RemoveScroll"),Ce=l.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=p(C,n);return o.jsx(i.ReactRemoveScroll,{as:be,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx(i.Primitive.div,{"data-state":w(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),f="DialogContent",W=l.forwardRef((e,t)=>{const n=M(f,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,r=p(f,e.__scopeDialog);return o.jsx(i.Presence,{present:a||r.open,children:r.modal?o.jsx(De,{...s,ref:t}):o.jsx(ye,{...s,ref:t})})});W.displayName=f;var De=l.forwardRef((e,t)=>{const n=p(f,e.__scopeDialog),a=l.useRef(null),s=i.useComposedRefs(t,n.contentRef,a);return l.useEffect(()=>{const r=a.current;if(r)return i.hideOthers(r)},[]),o.jsx($,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:i.composeEventHandlers(e.onCloseAutoFocus,r=>{r.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:i.composeEventHandlers(e.onPointerDownOutside,r=>{const u=r.detail.originalEvent,c=u.button===0&&u.ctrlKey===!0;(u.button===2||c)&&r.preventDefault()}),onFocusOutside:i.composeEventHandlers(e.onFocusOutside,r=>r.preventDefault())})}),ye=l.forwardRef((e,t)=>{const n=p(f,e.__scopeDialog),a=l.useRef(!1),s=l.useRef(!1);return o.jsx($,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{e.onCloseAutoFocus?.(r),r.defaultPrevented||(a.current||n.triggerRef.current?.focus(),r.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:r=>{e.onInteractOutside?.(r),r.defaultPrevented||(a.current=!0,r.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const u=r.target;n.triggerRef.current?.contains(u)&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&s.current&&r.preventDefault()}})}),$=l.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:r,...u}=e,c=p(f,n),m=l.useRef(null),h=i.useComposedRefs(t,m);return i.useFocusGuards(),o.jsxs(o.Fragment,{children:[o.jsx(i.FocusScope,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:r,children:o.jsx(i.DismissableLayer,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":w(c.open),...u,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Ie,{titleId:c.titleId}),o.jsx(_e,{contentRef:m,descriptionId:c.descriptionId})]})]})}),R="DialogTitle",q=l.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=p(R,n);return o.jsx(i.Primitive.h2,{id:s.titleId,...a,ref:t})});q.displayName=R;var L="DialogDescription",H=l.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=p(L,n);return o.jsx(i.Primitive.p,{id:s.descriptionId,...a,ref:t})});H.displayName=L;var B="DialogClose",V=l.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=p(B,n);return o.jsx(i.Primitive.button,{type:"button",...a,ref:t,onClick:i.composeEventHandlers(e.onClick,()=>s.onOpenChange(!1))})});V.displayName=B;function w(e){return e?"open":"closed"}var K="DialogTitleWarning",[je,U]=i.createContext2(K,{contentName:f,titleName:R,docsSlug:"dialog"}),Ie=({titleId:e})=>{const t=U(K),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
|
+
|
|
3
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
|
+
|
|
5
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return l.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ne="DialogDescriptionWarning",_e=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${U(Ne).contentName}}.`;return l.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},Y=S,Z=G,J=z,Q=F,X=W,ee=q,te=H,y=V;function oe({...e}){return o.jsx(Y,{"data-slot":"dialog",...e})}function ke({...e}){return o.jsx(Z,{"data-slot":"dialog-trigger",...e})}function ne({...e}){return o.jsx(J,{"data-slot":"dialog-portal",...e})}function Re({...e}){return o.jsx(y,{"data-slot":"dialog-close",...e})}function ae({className:e,...t}){return o.jsx(Q,{"data-slot":"dialog-overlay",className:d.cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-[var(--z-modal-backdrop)]",e),...t})}function re({className:e,children:t,showCloseButton:n=!0,...a}){return o.jsxs(ne,{children:[o.jsx(ae,{}),o.jsxs(X,{"data-slot":"dialog-content",className:d.cn("bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-xs ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-[var(--z-modal)] w-full -translate-x-1/2 -translate-y-1/2",e),...a,children:[t,n&&o.jsx(y,{"data-slot":"dialog-close",asChild:!0,children:o.jsxs(I.Button,{variant:"ghost",className:"absolute top-2 right-2",size:"icon",children:[o.jsx(N.HugeiconsIcon,{icon:_.Cancel01Icon,strokeWidth:2}),o.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})}function se({className:e,...t}){return o.jsx("div",{"data-slot":"dialog-header",className:d.cn("gap-1 flex flex-col",e),...t})}function we({className:e,showCloseButton:t=!1,children:n,...a}){return o.jsxs("div",{"data-slot":"dialog-footer",className:d.cn("gap-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...a,children:[n,t&&o.jsx(y,{asChild:!0,children:o.jsx(I.Button,{variant:"outline",children:"Close"})})]})}function ie({className:e,...t}){return o.jsx(ee,{"data-slot":"dialog-title",className:d.cn("text-sm font-medium",e),...t})}function le({className:e,...t}){return o.jsx(te,{"data-slot":"dialog-description",className:d.cn("text-muted-foreground *:[a]:hover:text-foreground text-xs *:[a]:underline *:[a]:underline-offset-3",e),...t})}function de({className:e,...t}){return o.jsx("div",{"data-slot":"input-group",role:"group",className:d.cn("border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-disabled:bg-input/50 dark:has-disabled:bg-input/80 h-8 rounded-lg border transition-colors in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 group/input-group relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto",e),...t})}const Pe=O.cva("text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none",{variants:{align:{"inline-start":"pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem] order-first","inline-end":"pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem] order-last","block-start":"px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start","block-end":"px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start"}},defaultVariants:{align:"inline-start"}});function ce({className:e,align:t="inline-start",...n}){return o.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:d.cn(Pe({align:t}),e),onClick:a=>{a.target.closest("button")||a.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const Ee=O.cva("gap-2 text-sm flex items-center shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function Oe({className:e,type:t="button",variant:n="ghost",size:a="xs",...s}){return o.jsx(I.Button,{type:t,"data-size":a,variant:n,className:d.cn(Ee({size:a}),e),...s})}function Te({className:e,...t}){return o.jsx("span",{className:d.cn("text-muted-foreground gap-2 text-sm [&_svg:not([class*='size-'])]:size-4 flex items-center [&_svg]:pointer-events-none",e),...t})}function Se({className:e,...t}){return o.jsx("input",{"data-slot":"input-group-control",className:d.cn("flex h-7 w-full rounded-none border-0 bg-transparent px-3 py-1.5 text-sm shadow-none ring-0 outline-none file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent dark:placeholder:text-muted-foreground/70 flex-1",e),...t})}function Ae({className:e,...t}){return o.jsx("textarea",{"data-slot":"input-group-control",className:d.cn("flex h-auto w-full min-h-[2.5rem] rounded-none resize-none border-0 bg-transparent px-3 py-1.5 text-sm shadow-none ring-0 outline-none placeholder:text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent dark:placeholder:text-muted-foreground/70",e),...t})}function ue({className:e,...t}){return o.jsx(x.Command,{"data-slot":"command",className:d.cn("bg-popover text-popover-foreground rounded-xl p-1 flex size-full flex-col overflow-hidden",e),...t})}function pe({title:e="Command Palette",description:t="Search for a command to run...",children:n,className:a,showCloseButton:s=!1,...r}){return o.jsxs(oe,{...r,children:[o.jsxs(se,{className:"sr-only",children:[o.jsx(ie,{children:e}),o.jsx(le,{children:t})]}),o.jsx(re,{className:d.cn("rounded-xl! p-0 overflow-hidden p-0",a),showCloseButton:s,children:n})]})}function Ge({className:e,...t}){return o.jsx("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:o.jsxs(de,{className:"bg-input/20 dark:bg-input/30",children:[o.jsx(x.Command.Input,{"data-slot":"command-input",className:d.cn("w-full text-xs outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t}),o.jsx(ce,{children:o.jsx(N.HugeiconsIcon,{icon:_.SearchIcon,strokeWidth:2,className:"size-3.5 shrink-0 opacity-50"})})]})})}function Me({className:e,...t}){return o.jsx(x.Command.List,{"data-slot":"command-list",className:d.cn("no-scrollbar max-h-72 scroll-py-1 outline-none overflow-x-hidden overflow-y-auto",e),...t})}function ze({className:e,...t}){return o.jsx(x.Command.Empty,{"data-slot":"command-empty",className:d.cn("py-6 text-center text-xs",e),...t})}function Fe({className:e,...t}){return o.jsx(x.Command.Group,{"data-slot":"command-group",className:d.cn("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function We({className:e,...t}){return o.jsx(x.Command.Separator,{"data-slot":"command-separator",className:d.cn("bg-border/50 -mx-1 my-1 h-px",e),...t})}function $e({className:e,children:t,...n}){return o.jsxs(x.Command.Item,{"data-slot":"command-item",className:d.cn("data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2.5 py-1.5 text-xs outline-hidden select-none [&_svg:not([class*='size-'])]:size-3.5 [[data-slot=dialog-content]_&]:rounded-md group/command-item data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[t,o.jsx(N.HugeiconsIcon,{icon:_.Tick02Icon,strokeWidth:2,className:"ml-auto opacity-0 group-has-[[data-slot=command-shortcut]]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}function qe({className:e,...t}){return o.jsx("span",{"data-slot":"command-shortcut",className:d.cn("text-muted-foreground group-data-selected/command-item:text-foreground ml-auto text-[0.625rem] tracking-widest",e),...t})}function Le({title:e="Command Palette",description:t="Search for a command to run...",shortcutEnabled:n=!0,open:a,onOpenChange:s,children:r,...u}){const[c,m]=l.useState(!1),h=a!==void 0,g=h?a:c,v=h?s:m,P=l.useRef(g);return l.useEffect(()=>{P.current=g},[g]),l.useEffect(()=>{if(!n)return;const E=b=>{j.shouldIgnoreKeyboardShortcut(b.target)||b.key===j.SHORTCUT_KEYS.commandPalette&&j.isMod(b)&&(b.preventDefault(),v?.(!P.current))};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[n,v]),o.jsx(pe,{...u,title:e,description:t,open:g,onOpenChange:v,children:o.jsx(ue,{children:r})})}exports.Close=y;exports.Command=ue;exports.CommandDialog=pe;exports.CommandEmpty=ze;exports.CommandGroup=Fe;exports.CommandInput=Ge;exports.CommandItem=$e;exports.CommandList=Me;exports.CommandPalette=Le;exports.CommandSeparator=We;exports.CommandShortcut=qe;exports.Content=X;exports.Description=te;exports.Dialog=oe;exports.DialogClose=Re;exports.DialogContent=re;exports.DialogDescription=le;exports.DialogFooter=we;exports.DialogHeader=se;exports.DialogOverlay=ae;exports.DialogPortal=ne;exports.DialogTitle=ie;exports.DialogTrigger=ke;exports.InputGroup=de;exports.InputGroupAddon=ce;exports.InputGroupButton=Oe;exports.InputGroupInput=Se;exports.InputGroupText=Te;exports.InputGroupTextarea=Ae;exports.Overlay=Q;exports.Portal=J;exports.Root=Y;exports.Title=ee;exports.Trigger=Z;exports.WarningProvider=je;exports.createDialogScope=xe;
|