pejay-ui 1.4.2 → 1.5.0
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/README.md +26 -0
- package/bin/cli.js +45 -15
- package/package.json +77 -54
- package/registry/buttons.json +3 -2
- package/registry/dropdowns.json +3 -1
- package/registry/forms.json +51 -23
- package/registry/hotkeys.json +12 -0
- package/registry/overlays.json +18 -2
- package/registry/panels.json +21 -0
- package/registry/skeleton.json +20 -0
- package/registry/spinner.json +13 -0
- package/templates/button/Button.tsx +8 -7
- package/templates/button/README.md +81 -0
- package/templates/button/index.ts +1 -2
- package/templates/form/{checkbox-group.tsx → choices/checkbox-group.tsx} +1 -1
- package/templates/form/{checkbox.tsx → choices/checkbox.tsx} +1 -1
- package/templates/form/{radio-group.tsx → choices/radio-group.tsx} +1 -1
- package/templates/form/{radio.tsx → choices/radio.tsx} +1 -1
- package/templates/form/choices/readme.checkbox-group.md +27 -0
- package/templates/form/choices/readme.checkbox.md +26 -0
- package/templates/form/choices/readme.radio-group.md +26 -0
- package/templates/form/choices/readme.radio.md +24 -0
- package/templates/form/choices/readme.switch.md +26 -0
- package/templates/form/{switch.tsx → choices/switch.tsx} +1 -1
- package/templates/form/{file-input.tsx → file/file-input.tsx} +2 -2
- package/templates/form/file/readme.file-input.md +26 -0
- package/templates/form/index.ts +19 -22
- package/templates/form/{amount-input.tsx → numeric/amount-input.tsx} +2 -2
- package/templates/form/{number-input.tsx → numeric/number-input.tsx} +2 -2
- package/templates/form/{range-slider.tsx → numeric/range-slider.tsx} +1 -1
- package/templates/form/numeric/readme.amount-input.md +27 -0
- package/templates/form/numeric/readme.number-input.md +26 -0
- package/templates/form/numeric/readme.range-slider.md +27 -0
- package/templates/form/{date-picker.tsx → pickers/date-picker.tsx} +2 -2
- package/templates/form/{date-range-picker.tsx → pickers/date-range-picker.tsx} +2 -2
- package/templates/form/pickers/readme.date-picker.md +26 -0
- package/templates/form/pickers/readme.date-range-picker.md +25 -0
- package/templates/form/pickers/readme.time-picker.md +25 -0
- package/templates/form/pickers/readme.time-range-picker.md +25 -0
- package/templates/form/{time-picker.tsx → pickers/time-picker.tsx} +1 -1
- package/templates/form/{time-range-picker.tsx → pickers/time-range-picker.tsx} +1 -1
- package/templates/form/{input.tsx → text-inputs/input.tsx} +1 -1
- package/templates/form/{password-input.tsx → text-inputs/password-input.tsx} +1 -1
- package/templates/form/text-inputs/readme.email-input.md +24 -0
- package/templates/form/text-inputs/readme.input.md +28 -0
- package/templates/form/text-inputs/readme.password-input.md +24 -0
- package/templates/form/text-inputs/readme.phone-input.md +24 -0
- package/templates/form/text-inputs/readme.textarea.md +24 -0
- package/templates/form/text-inputs/readme.url-input.md +23 -0
- package/templates/form/{textarea.tsx → text-inputs/textarea.tsx} +1 -1
- package/templates/hotkeys/README.md +134 -0
- package/templates/hotkeys/components/HotkeyProvider.tsx +78 -0
- package/templates/hotkeys/components/HotkeysHelpModal.tsx +102 -0
- package/templates/hotkeys/core/key-matcher.ts +106 -0
- package/templates/hotkeys/core/registry.ts +39 -0
- package/templates/hotkeys/core/types.ts +15 -0
- package/templates/hotkeys/hooks/useHotkey.ts +43 -0
- package/templates/hotkeys/index.ts +6 -0
- package/templates/layouts/lv1/app-layout.tsx +1 -1
- package/templates/layouts/lv1/sidebar-menu.tsx +1 -1
- package/templates/notes/app-provider/app-provider-side-panel-modals-roadmap.md +606 -0
- package/templates/notes/app-provider/manual-open-close-side-panel-and-modal.md +913 -0
- package/templates/notes/app-provider/side-panel-card-hooks-and-complexity.md +578 -0
- package/templates/notes/under-dev/AppProvider.tsx +92 -0
- package/templates/notes/under-dev/app-context.ts +14 -0
- package/templates/notes/under-dev/card/base-card.tsx +35 -0
- package/templates/notes/under-dev/card/index.ts +4 -0
- package/templates/notes/under-dev/card/modal-card.tsx +88 -0
- package/templates/notes/under-dev/card/side-panel-card.tsx +127 -0
- package/templates/notes/under-dev/form-overlay-registry.ts +42 -0
- package/templates/notes/under-dev/keyboard-shortcuts-help.tsx +79 -0
- package/templates/notes/under-dev/keyboard-utils.ts +22 -0
- package/templates/notes/under-dev/overlay/backdrop.tsx +95 -0
- package/templates/notes/under-dev/overlay/index.ts +4 -0
- package/templates/notes/under-dev/overlay/modal.tsx +43 -0
- package/templates/notes/under-dev/overlay/side-panel.tsx +126 -0
- package/templates/notes/under-dev/overlay-close.ts +50 -0
- package/templates/notes/under-dev/page-shortcut-registry.ts +9 -0
- package/templates/notes/under-dev/unsaved-changes-notify.ts +11 -0
- package/templates/notes/under-dev/use-keyboard-shortcuts.tsx +110 -0
- package/templates/notes/under-dev/useFormDirty.ts +6 -0
- package/templates/notes/under-dev/useFormOverlayRegistration.ts +47 -0
- package/templates/notes/under-dev/useFormPanel.tsx +18 -0
- package/templates/notes/under-dev/useFormTabHandler.ts +22 -0
- package/templates/notes/under-dev/useHorizontalWheelScroll.ts +27 -0
- package/templates/notes/under-dev/useOverlay.ts +41 -0
- package/templates/overlays/index.ts +2 -1
- package/templates/overlays/portal/portal.tsx +26 -0
- package/templates/overlays/tooltip/readme.tooltip.md +26 -0
- package/templates/{button → overlays/tooltip}/tooltip.tsx +1 -1
- package/templates/panels/COMPONENTS.md +103 -0
- package/templates/panels/README.md +702 -0
- package/templates/panels/components/base-card.tsx +33 -0
- package/templates/panels/components/index.ts +8 -0
- package/templates/panels/components/modal/backdrop.tsx +88 -0
- package/templates/panels/components/modal/modal-card.tsx +139 -0
- package/templates/panels/components/modal/modal-raw.tsx +36 -0
- package/templates/panels/components/modal/modal.tsx +49 -0
- package/templates/panels/components/side-panel/side-panel-card.tsx +123 -0
- package/templates/panels/components/side-panel/side-panel-raw.tsx +25 -0
- package/templates/panels/components/side-panel/side-panel.tsx +135 -0
- package/templates/panels/core/PanelProvider.tsx +145 -0
- package/templates/panels/core/constants.ts +9 -0
- package/templates/panels/core/form-overlay-registry.ts +35 -0
- package/templates/panels/core/index.ts +6 -0
- package/templates/panels/core/overlay-close.ts +11 -0
- package/templates/panels/core/panel-context.ts +41 -0
- package/templates/panels/core/types.ts +41 -0
- package/templates/panels/hooks/index.ts +7 -0
- package/templates/panels/hooks/useFormDirty.ts +6 -0
- package/templates/panels/hooks/useFormOverlayRegistration.ts +92 -0
- package/templates/panels/hooks/useFormPanel.tsx +18 -0
- package/templates/panels/hooks/useFormTabHandler.ts +25 -0
- package/templates/panels/hooks/useHorizontalWheelScroll.ts +31 -0
- package/templates/panels/hooks/useModalForm.tsx +22 -0
- package/templates/panels/hooks/useOverlay.ts +65 -0
- package/templates/panels/index.ts +3 -0
- package/templates/panels/vendor-example/by-using-modal/VendorModalPage.tsx +47 -0
- package/templates/panels/vendor-example/by-using-modal/useVendorModalForm.tsx +19 -0
- package/templates/panels/vendor-example/by-using-modal/vendor-modal-form.tsx +112 -0
- package/templates/panels/vendor-example/by-using-modal/vendor-types.ts +29 -0
- package/templates/panels/vendor-example/by-using-sidepanel/VendorsPage.tsx +47 -0
- package/templates/panels/vendor-example/by-using-sidepanel/useVendorFormPanel.tsx +15 -0
- package/templates/panels/vendor-example/by-using-sidepanel/vendor-form.tsx +108 -0
- package/templates/panels/vendor-example/by-using-sidepanel/vendor-types.ts +29 -0
- package/templates/select-dropdown/README.md +62 -0
- package/templates/select-dropdown/multiselect-input.tsx +2 -2
- package/templates/select-dropdown/select-input.tsx +2 -2
- package/templates/skeleton/README.md +53 -0
- package/templates/skeleton/index.ts +2 -0
- package/templates/skeleton/skeleton.css +36 -0
- package/templates/skeleton/skeleton.tsx +40 -0
- package/templates/skeleton/types.ts +12 -0
- package/templates/spinner/README.md +51 -0
- package/templates/spinner/index.ts +1 -0
- package/templates/spinner/spinner.css +58 -0
- package/templates/spinner/spinner.tsx +263 -0
- package/templates/toast/container.tsx +2 -2
- package/templates/utilities/formater.dateTime.md +74 -0
- package/templates/utilities/formater.dateTime.ts +310 -0
- package/templates/utilities/formater.phoneNumber.md +32 -0
- package/templates/utilities/formater.phoneNumber.ts +143 -0
- package/templates/utilities/sanitize.md +23 -0
- package/templates/utilities/sanitize.ts +148 -0
- /package/templates/form/{email-input.tsx → text-inputs/email-input.tsx} +0 -0
- /package/templates/form/{phone-input.tsx → text-inputs/phone-input.tsx} +0 -0
- /package/templates/form/{url-input.tsx → text-inputs/url-input.tsx} +0 -0
- /package/templates/{overlays → notes/under-dev/overlay}/portal.tsx +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
2
|
+
import { cn } from "@/pejay-ui/utils/cn";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Spinner } from "@/pejay-ui/spinner";
|
|
5
|
+
import { Tooltip } from "@/pejay-ui/components/overlays";
|
|
5
6
|
|
|
6
7
|
/* ─────────────────────────────────────────────
|
|
7
8
|
Types
|
|
@@ -28,7 +29,8 @@ export type ButtonVariant =
|
|
|
28
29
|
| "success-ghost"
|
|
29
30
|
| "warning-ghost"
|
|
30
31
|
| "black-ghost"
|
|
31
|
-
| "white-ghost"
|
|
32
|
+
| "white-ghost"
|
|
33
|
+
| "soft";
|
|
32
34
|
export type RoundedStyle = "full" | "lg" | "md" | "sm" | "none";
|
|
33
35
|
|
|
34
36
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -67,6 +69,7 @@ const variantMap: Record<ButtonVariant, string> = {
|
|
|
67
69
|
warning: "bg-amber-500 hover:bg-amber-600 active:bg-amber-700 text-white",
|
|
68
70
|
black: "bg-black hover:bg-black/80 active:bg-black/70 text-white",
|
|
69
71
|
white: "bg-white hover:bg-white/80 active:bg-white/70 text-black",
|
|
72
|
+
soft: "bg-sky-500/10 hover:bg-sky-500/20 active:bg-sky-500/30 text-sky-500",
|
|
70
73
|
|
|
71
74
|
/* ── Soft (coloured text, always-visible tint) ───────── */
|
|
72
75
|
"primary-soft": "text-sky-500 bg-current/10 hover:bg-current/15 active:bg-current/20",
|
|
@@ -119,10 +122,8 @@ export const Button = ({
|
|
|
119
122
|
? stripInteractive(variantMap[variant])
|
|
120
123
|
: variantMap[variant];
|
|
121
124
|
|
|
122
|
-
/* Render content: loader node /
|
|
123
|
-
const content = isLoading
|
|
124
|
-
? (loader ?? <span className="text-sm font-medium">Loading…</span>)
|
|
125
|
-
: children;
|
|
125
|
+
/* Render content: loader node / spinner / normal children */
|
|
126
|
+
const content = isLoading ? (loader ?? <Spinner size="sm" />) : children;
|
|
126
127
|
|
|
127
128
|
return (
|
|
128
129
|
<Tooltip content={tooltipContent}>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Button & Tooltip Components
|
|
2
|
+
|
|
3
|
+
A highly flexible button component with built-in loading states, visual style presets (variants), size options, prefix/suffix icon slots, and hover tooltip support.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Button Usage & API
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Button } from "@/pejay-ui/components/button";
|
|
11
|
+
|
|
12
|
+
// Basic Button
|
|
13
|
+
<Button onClick={handleClick}>Click Me</Button>
|
|
14
|
+
|
|
15
|
+
// Custom Styling & Icons
|
|
16
|
+
<Button variant="danger" size="lg" icon={TrashIcon} loading={isDeleting}>
|
|
17
|
+
Delete Record
|
|
18
|
+
</Button>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Component Props
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| :--- | :--- | :--- | :--- |
|
|
25
|
+
| `children` | `ReactNode` | — | Text or elements inside the button. |
|
|
26
|
+
| `variant` | `ButtonVariant` | `"primary"` | Visual preset theme style. (See options below) |
|
|
27
|
+
| `rounded` | `"none" \| "sm" \| "md" \| "lg" \| "full"` | `"lg"` | Controls the button border radius. |
|
|
28
|
+
| `disableHoverEffect` | `boolean` | `false` | Removes hover/active style transforms (keeps it static). |
|
|
29
|
+
| `isLoading` | `boolean` | `false` | Displays a loading spinner and disables clicks. |
|
|
30
|
+
| `loader` | `ReactNode` | — | Custom loading component override. |
|
|
31
|
+
| `fullWidth` | `boolean` | `false` | Sets button width to `w-full` (100% parent container width). |
|
|
32
|
+
| `tooltipContent` | `ReactNode \| string` | — | Display a hover tooltip panel with this content. |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 2. Visual Variants & Color Palette Reference
|
|
37
|
+
|
|
38
|
+
We categorize button variants into 3 distinct styling structures. Colors are predefined and tailored for dark/light contrast:
|
|
39
|
+
|
|
40
|
+
### A. Solid Variants (Filled background, white/black text)
|
|
41
|
+
* **`primary`** : Sky Blue (`bg-sky-500` $\rightarrow$ hover `bg-sky-600` $\rightarrow$ active `bg-sky-700`)
|
|
42
|
+
* **`danger`** : Red (`bg-red-600` $\rightarrow$ hover `bg-red-700` $\rightarrow$ active `bg-red-800`)
|
|
43
|
+
* **`success`** : Emerald (`bg-emerald-600` $\rightarrow$ hover `bg-emerald-700` $\rightarrow$ active `bg-emerald-800`)
|
|
44
|
+
* **`warning`** : Amber (`bg-amber-500` $\rightarrow$ hover `bg-amber-600` $\rightarrow$ active `bg-amber-700`)
|
|
45
|
+
* **`black`** : Black (`bg-black` $\rightarrow$ hover `bg-black/80` $\rightarrow$ active `bg-black/70`)
|
|
46
|
+
* **`white`** : White (`bg-white`, text black $\rightarrow$ hover `bg-white/80` $\rightarrow$ active `bg-white/70`)
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
### B. Soft Variants (Always-visible colored tint background + matching text color)
|
|
51
|
+
*Soft variants use `bg-current` opacity mappings, meaning the background tint color automatically inherits and matches the text color:*
|
|
52
|
+
* **`primary-soft`** / **`soft`** : Sky Blue text + 10% opacity Sky Blue background.
|
|
53
|
+
* **`danger-soft`** : Red text + 10% opacity Red background.
|
|
54
|
+
* **`success-soft`** : Emerald text + 10% opacity Emerald background.
|
|
55
|
+
* **`warning-soft`** : Amber text + 10% opacity Amber background.
|
|
56
|
+
* **`black-soft`** : Black text + 10% opacity Black background.
|
|
57
|
+
* **`white-soft`** : White text + 10% opacity White background.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### C. Ghost Variants (Transparent background $\rightarrow$ fades in soft tint on hover)
|
|
62
|
+
* **`primary-ghost`** : Sky Blue text.
|
|
63
|
+
* **`danger-ghost`** : Red text.
|
|
64
|
+
* **`success-ghost`** : Emerald text.
|
|
65
|
+
* **`warning-ghost`** : Amber text.
|
|
66
|
+
* **`black-ghost`** : Black text.
|
|
67
|
+
* **`white-ghost`** : White text.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 3. Tooltip Component
|
|
72
|
+
|
|
73
|
+
A standalone utility to show extra info bubbles on hover for any parent component.
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { Tooltip } from "@/pejay-ui/components/overlays/tooltip";
|
|
77
|
+
|
|
78
|
+
<Tooltip content="Upload CSV file" placement="bottom">
|
|
79
|
+
<div className="p-2 border rounded">Hover Over Me</div>
|
|
80
|
+
</Tooltip>
|
|
81
|
+
```
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./Button";
|
|
2
|
-
export * from "./tooltip";
|
|
1
|
+
export * from "./Button";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# CheckboxGroup Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { CheckboxGroup } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<CheckboxGroup
|
|
13
|
+
label="Hobbies"
|
|
14
|
+
options={[{ label: "Sports", value: "sports" }, { label: "Music", value: "music" }]}
|
|
15
|
+
value={hobbies}
|
|
16
|
+
onChange={setHobbies}
|
|
17
|
+
/>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
| :--- | :--- | :--- | :--- |
|
|
26
|
+
| `options` | `Array<{ label: string, value: string }>` | — | Option items list. |
|
|
27
|
+
| `value` | `string[]` | — | Selected values list. |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Checkbox Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Checkbox } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<Checkbox
|
|
13
|
+
label="I agree to terms"
|
|
14
|
+
checked={agreed}
|
|
15
|
+
onChange={(e) => setAgreed(e.target.checked)}
|
|
16
|
+
/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| :--- | :--- | :--- | :--- |
|
|
25
|
+
| `label` | `string` | — | Description text displayed next to the checkbox box. |
|
|
26
|
+
| `checked` | `boolean` | `false` | Checked state. |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# RadioGroup Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { RadioGroup } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<RadioGroup
|
|
13
|
+
label="Preferred Mode"
|
|
14
|
+
options={[{ label: "Dark", value: "dark" }, { label: "Light", value: "light" }]}
|
|
15
|
+
value={theme}
|
|
16
|
+
onChange={setTheme}
|
|
17
|
+
/>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
| :--- | :--- | :--- | :--- |
|
|
26
|
+
| `options` | `Array<{ label: string, value: string }>` | — | Group items lists. |
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Radio Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Radio } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<Radio
|
|
13
|
+
label="Option Item"
|
|
14
|
+
name="group-1"
|
|
15
|
+
/>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Props
|
|
21
|
+
|
|
22
|
+
| Prop | Type | Default | Description |
|
|
23
|
+
| :--- | :--- | :--- | :--- |
|
|
24
|
+
| `label` | `string` | — | Option description text. |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Switch Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Switch } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<Switch
|
|
13
|
+
label="Enable Notifications"
|
|
14
|
+
checked={isEnabled}
|
|
15
|
+
onChange={setIsEnabled}
|
|
16
|
+
/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| :--- | :--- | :--- | :--- |
|
|
25
|
+
| `label` | `string` | — | Helper label text. |
|
|
26
|
+
| `checked` | `boolean` | `false` | Toggles checkbox status on/off. |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useRef } from "react";
|
|
2
2
|
import { Upload, X, FileText, Image as ImageIcon } from "lucide-react";
|
|
3
|
-
import { cn } from "@/utils/cn";
|
|
4
|
-
import { Input } from "
|
|
3
|
+
import { cn } from "@/pejay-ui/utils/cn";
|
|
4
|
+
import { Input } from "../text-inputs/input";
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* ============================================================================
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# FileInput Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { FileInput } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<FileInput
|
|
13
|
+
label="Upload Resume"
|
|
14
|
+
accept=".pdf,.docx"
|
|
15
|
+
onChange={(files) => console.log(files)}
|
|
16
|
+
/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| :--- | :--- | :--- | :--- |
|
|
25
|
+
| `multiple` | `boolean` | `false` | Allows multiple file select upload. |
|
|
26
|
+
| `accept` | `string` | — | Accepted file formats. |
|
package/templates/form/index.ts
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
export * from "./input";
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./range-
|
|
9
|
-
export * from "./
|
|
10
|
-
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./
|
|
19
|
-
export * from "./
|
|
20
|
-
|
|
21
|
-
export * from "./email-input";
|
|
22
|
-
export * from "./file-input";
|
|
1
|
+
export * from "./text-inputs/input";
|
|
2
|
+
export * from "./text-inputs/textarea";
|
|
3
|
+
export * from "./text-inputs/email-input";
|
|
4
|
+
export * from "./text-inputs/password-input";
|
|
5
|
+
export * from "./text-inputs/phone-input";
|
|
6
|
+
export * from "./text-inputs/url-input";
|
|
7
|
+
export * from "./pickers/date-picker";
|
|
8
|
+
export * from "./pickers/date-range-picker";
|
|
9
|
+
export * from "./pickers/time-picker";
|
|
10
|
+
export * from "./pickers/time-range-picker";
|
|
11
|
+
export * from "./numeric/number-input";
|
|
12
|
+
export * from "./numeric/amount-input";
|
|
13
|
+
export * from "./numeric/range-slider";
|
|
14
|
+
export * from "./choices/checkbox";
|
|
15
|
+
export * from "./choices/checkbox-group";
|
|
16
|
+
export * from "./choices/radio";
|
|
17
|
+
export * from "./choices/radio-group";
|
|
18
|
+
export * from "./choices/switch";
|
|
19
|
+
export * from "./file/file-input";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
|
2
|
-
import { Input } from "
|
|
2
|
+
import { Input } from "../text-inputs/input";
|
|
3
3
|
import { Plus, Minus } from "lucide-react";
|
|
4
|
-
import { cn } from "@/utils/cn";
|
|
4
|
+
import { cn } from "@/pejay-ui/utils/cn";
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* ============================================================================
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
|
2
|
-
import { Input } from "
|
|
2
|
+
import { Input } from "../text-inputs/input";
|
|
3
3
|
import { Plus, Minus } from "lucide-react";
|
|
4
|
-
import { cn } from "@/utils/cn";
|
|
4
|
+
import { cn } from "@/pejay-ui/utils/cn";
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* ============================================================================
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# AmountInput Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { AmountInput } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<AmountInput
|
|
13
|
+
label="Price Value"
|
|
14
|
+
currency="USD"
|
|
15
|
+
value={amount}
|
|
16
|
+
onChange={setAmount}
|
|
17
|
+
/>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
| :--- | :--- | :--- | :--- |
|
|
26
|
+
| `currency` | `string` | `"$"` | Currency prefix symbol. |
|
|
27
|
+
| `allowDecimals` | `boolean` | `true` | Allows float decimals. |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# NumberInput Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { NumberInput } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<NumberInput
|
|
13
|
+
label="Age"
|
|
14
|
+
min={18}
|
|
15
|
+
max={99}
|
|
16
|
+
/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| :--- | :--- | :--- | :--- |
|
|
25
|
+
| `min` | `number` | — | Minimum value allowed. |
|
|
26
|
+
| `max` | `number` | — | Maximum value allowed. |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# RangeSlider Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { RangeSlider } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<RangeSlider
|
|
13
|
+
min={0}
|
|
14
|
+
max={100}
|
|
15
|
+
value={val}
|
|
16
|
+
onChange={setVal}
|
|
17
|
+
/>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
| :--- | :--- | :--- | :--- |
|
|
26
|
+
| `min` | `number` | `0` | Minimum range. |
|
|
27
|
+
| `max` | `number` | `100` | Maximum range. |
|
|
@@ -5,14 +5,14 @@ import React, {
|
|
|
5
5
|
useEffect,
|
|
6
6
|
useLayoutEffect,
|
|
7
7
|
} from "react";
|
|
8
|
-
import { cn } from "@/utils/cn";
|
|
8
|
+
import { cn } from "@/pejay-ui/utils/cn";
|
|
9
9
|
import {
|
|
10
10
|
Calendar as CalendarIcon,
|
|
11
11
|
ChevronLeft,
|
|
12
12
|
ChevronRight,
|
|
13
13
|
ChevronDown,
|
|
14
14
|
} from "lucide-react";
|
|
15
|
-
import { SelectInput } from "
|
|
15
|
+
import { SelectInput } from "../../select-dropdown/select-input";
|
|
16
16
|
const DateUtils = {};
|
|
17
17
|
import {
|
|
18
18
|
useFloating,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useMemo } from "react";
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
2
|
+
import { cn } from "@/pejay-ui/utils/cn";
|
|
3
3
|
import {
|
|
4
4
|
Calendar as CalendarIcon,
|
|
5
5
|
ChevronLeft,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
PanelLeftClose,
|
|
9
9
|
PanelLeft,
|
|
10
10
|
} from "lucide-react";
|
|
11
|
-
import { SelectInput } from "
|
|
11
|
+
import { SelectInput } from "../../select-dropdown/select-input";
|
|
12
12
|
const DateUtils = {};
|
|
13
13
|
import {
|
|
14
14
|
useFloating,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# DatePicker Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { DatePicker } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<DatePicker
|
|
13
|
+
label="Date of Birth"
|
|
14
|
+
value={birthDate}
|
|
15
|
+
onChange={setBirthDate}
|
|
16
|
+
/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| :--- | :--- | :--- | :--- |
|
|
25
|
+
| `value` | `Date` | — | Selected date object. |
|
|
26
|
+
| `onChange` | `(date: Date) => void` | — | Callback when date is selected. |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# DateRangePicker Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { DateRangePicker } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<DateRangePicker
|
|
13
|
+
label="Booking Duration"
|
|
14
|
+
value={range}
|
|
15
|
+
onChange={setRange}
|
|
16
|
+
/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| :--- | :--- | :--- | :--- |
|
|
25
|
+
| `value` | `{ start: Date, end: Date }` | — | Date range values. |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# TimePicker Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { TimePicker } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<TimePicker
|
|
13
|
+
label="Start Time"
|
|
14
|
+
value={time}
|
|
15
|
+
onChange={setTime}
|
|
16
|
+
/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| :--- | :--- | :--- | :--- |
|
|
25
|
+
| `value` | `string` | — | Time string value (e.g. "12:00 AM"). |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# TimeRangePicker Component
|
|
2
|
+
|
|
3
|
+
A styled form input component optimized for Tailwind.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { TimeRangePicker } from "@/pejay-ui/components/form";
|
|
11
|
+
|
|
12
|
+
<TimeRangePicker
|
|
13
|
+
label="Shift Duration"
|
|
14
|
+
value={range}
|
|
15
|
+
onChange={setRange}
|
|
16
|
+
/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| :--- | :--- | :--- | :--- |
|
|
25
|
+
| `value` | `{ start: string, end: string }` | — | Time range selector values. |
|