laif-ds 0.2.44 → 0.2.46
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/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +5 -5
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/agent-docs/components/Accordion.md +157 -0
- package/dist/agent-docs/components/Alert.md +95 -0
- package/dist/agent-docs/components/AlertDialog.md +126 -0
- package/dist/agent-docs/components/AppEditor.md +90 -0
- package/dist/agent-docs/components/AppForm.md +291 -0
- package/dist/agent-docs/components/AppMultipleSelectDropdown.md +38 -0
- package/dist/agent-docs/components/AppRadioGroup.md +223 -0
- package/dist/agent-docs/components/AppSelect.md +427 -0
- package/dist/agent-docs/components/AppSidebar.md +122 -0
- package/dist/agent-docs/components/AppStepper.md +77 -0
- package/dist/agent-docs/components/AspectRatio.md +87 -0
- package/dist/agent-docs/components/AsyncSelect.md +127 -0
- package/dist/agent-docs/components/AudioVisualizer.md +41 -0
- package/dist/agent-docs/components/Avatar.md +113 -0
- package/dist/agent-docs/components/Badge.md +118 -0
- package/dist/agent-docs/components/Breadcrumb.md +78 -0
- package/dist/agent-docs/components/Button.md +129 -0
- package/dist/agent-docs/components/Calendar.md +222 -0
- package/dist/agent-docs/components/Card.md +147 -0
- package/dist/agent-docs/components/Carousel.md +129 -0
- package/dist/agent-docs/components/Chart.md +75 -0
- package/dist/agent-docs/components/Chat.md +109 -0
- package/dist/agent-docs/components/ChatMessage.md +61 -0
- package/dist/agent-docs/components/Checkbox.md +135 -0
- package/dist/agent-docs/components/CircularProgress.md +49 -0
- package/dist/agent-docs/components/CodeHighlighter.md +31 -0
- package/dist/agent-docs/components/Collapsible.md +95 -0
- package/dist/agent-docs/components/Command.md +142 -0
- package/dist/agent-docs/components/Confirmer.md +175 -0
- package/dist/agent-docs/components/ContextMenu.md +191 -0
- package/dist/agent-docs/components/CopyButton.md +26 -0
- package/dist/agent-docs/components/DataCrossTable.md +94 -0
- package/dist/agent-docs/components/DataTable.md +254 -0
- package/dist/agent-docs/components/DatePicker.md +109 -0
- package/dist/agent-docs/components/Dialog.md +125 -0
- package/dist/agent-docs/components/Drawer.md +127 -0
- package/dist/agent-docs/components/DropdownMenu.md +57 -0
- package/dist/agent-docs/components/FilePreview.md +99 -0
- package/dist/agent-docs/components/FilePreviewer.md +139 -0
- package/dist/agent-docs/components/FileUploader.md +129 -0
- package/dist/agent-docs/components/Form.md +62 -0
- package/dist/agent-docs/components/FormComposer.md +137 -0
- package/dist/agent-docs/components/GanttChart.md +122 -0
- package/dist/agent-docs/components/HoverCard.md +37 -0
- package/dist/agent-docs/components/Icon.md +99 -0
- package/dist/agent-docs/components/Input.md +138 -0
- package/dist/agent-docs/components/InputOtp.md +40 -0
- package/dist/agent-docs/components/InputSelector.md +97 -0
- package/dist/agent-docs/components/InterruptPrompt.md +32 -0
- package/dist/agent-docs/components/Label.md +28 -0
- package/dist/agent-docs/components/MarkdownRenderer.md +36 -0
- package/dist/agent-docs/components/Menubar.md +164 -0
- package/dist/agent-docs/components/MessageInput.md +131 -0
- package/dist/agent-docs/components/MessageList.md +96 -0
- package/dist/agent-docs/components/MultipleSelector.md +146 -0
- package/dist/agent-docs/components/NavigationMenu.md +51 -0
- package/dist/agent-docs/components/Pagination.md +55 -0
- package/dist/agent-docs/components/Popover.md +103 -0
- package/dist/agent-docs/components/Progress.md +30 -0
- package/dist/agent-docs/components/PromptSuggestions.md +33 -0
- package/dist/agent-docs/components/RadioGroup.md +90 -0
- package/dist/agent-docs/components/Resizable.md +35 -0
- package/dist/agent-docs/components/ResizePrompt.md +13 -0
- package/dist/agent-docs/components/ScrollArea.md +49 -0
- package/dist/agent-docs/components/SecurePdfViewer.md +38 -0
- package/dist/agent-docs/components/Select.md +132 -0
- package/dist/agent-docs/components/Separator.md +32 -0
- package/dist/agent-docs/components/Sheet.md +40 -0
- package/dist/agent-docs/components/ShikiHighlighter.md +31 -0
- package/dist/agent-docs/components/Sidebar.md +85 -0
- package/dist/agent-docs/components/Skeleton.md +29 -0
- package/dist/agent-docs/components/Slider.md +58 -0
- package/dist/agent-docs/components/Sonner.md +21 -0
- package/dist/agent-docs/components/Spinner.md +139 -0
- package/dist/agent-docs/components/Stepper.md +67 -0
- package/dist/agent-docs/components/Switch.md +42 -0
- package/dist/agent-docs/components/Table.md +63 -0
- package/dist/agent-docs/components/TableSkeleton.md +46 -0
- package/dist/agent-docs/components/Tabs.md +86 -0
- package/dist/agent-docs/components/TextArea.md +52 -0
- package/dist/agent-docs/components/ThemeSwitcher.md +69 -0
- package/dist/agent-docs/components/Toaster.md +23 -0
- package/dist/agent-docs/components/Toggle.md +31 -0
- package/dist/agent-docs/components/ToggleGroup.md +30 -0
- package/dist/agent-docs/components/Tooltip.md +91 -0
- package/dist/agent-docs/components/TypingIndicator.md +21 -0
- package/dist/agent-docs/components/Typo.md +65 -0
- package/dist/agent-docs/components/WeeklyCalendar.md +64 -0
- package/dist/agent-docs/components-list.md +144 -0
- package/dist/components/ui/app-form.js +61 -60
- package/dist/components/ui/date-picker.js +6 -5
- package/dist/index.d.ts +4 -3
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +5 -5
- package/dist/node_modules/date-fns/isSameWeek.js +15 -0
- package/dist/node_modules/date-fns/locale/it/_lib/formatDistance.js +71 -0
- package/dist/node_modules/date-fns/locale/it/_lib/formatLong.js +34 -0
- package/dist/node_modules/date-fns/locale/it/_lib/formatRelative.js +50 -0
- package/dist/node_modules/date-fns/locale/it/_lib/localize.js +147 -0
- package/dist/node_modules/date-fns/locale/it/_lib/match.js +111 -0
- package/dist/node_modules/date-fns/locale/it.js +22 -0
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Persona
|
|
2
|
+
|
|
3
|
+
Act as a senior software engineer specializing in React, Next.js, and TypeScript. You have deep knowledge of the laif-dscomponent library. Your goal is to assist developers in using the AppSelect component correctly by providing clear, type-safe code examples and explanations that follow modern React best practices.
|
|
4
|
+
|
|
5
|
+
# Context
|
|
6
|
+
|
|
7
|
+
Each of these components is a key part of the laif-ds library for building accessible and customizable dropdown menus in React applications. Developers will ask for guidance on configuration, props, state management, and event handling. Your answers must be based exclusively on the official documentation provided inside the files.
|
|
8
|
+
Whenever you are asked to provide a component example, you must provide a complete, type-safe example that can be used as a starting point for the developer.
|
|
9
|
+
Whenever you see a deprecated component being used you should suggest to use the new component instead.
|
|
10
|
+
|
|
11
|
+
# Fundamental Rules
|
|
12
|
+
|
|
13
|
+
- TypeScript First: All code examples must use TypeScript and be type-safe.
|
|
14
|
+
- Controlled Components: Always manage state using the value and onValueChange props together. This is the standard pattern in React.
|
|
15
|
+
- Absolute Precision: Provide prop names, types, and default values exactly as defined. Do not invent props.
|
|
16
|
+
- Complete Code Examples: Present code in a complete, working format within a React component.
|
|
17
|
+
- Explain Your Choices: Justify why you are using certain props. For example: "I'm using wrpClassName="w-full" to make the component's wrapper take up the full width of its container."
|
|
18
|
+
|
|
19
|
+
# laif-ds Component Reference
|
|
20
|
+
|
|
21
|
+
This document provides a complete mapping of all components available in the laif-ds library. Each component links to its detailed documentation file located in `/frontend/node_modules/laif-ds/dist/agent-docs/components/{ComponentName}.md`.
|
|
22
|
+
|
|
23
|
+
## UI Components
|
|
24
|
+
|
|
25
|
+
### Form & Input Components
|
|
26
|
+
- **AppForm** - Dynamic form component with multiple field types support
|
|
27
|
+
- **AppRadioGroup** - Enhanced radio group with card and icon support
|
|
28
|
+
- **AsyncSelect** - Select component with asynchronous data loading capabilities
|
|
29
|
+
- **AppSelect** - Enhanced select dropdown with search and multi-select capabilities
|
|
30
|
+
- **Checkbox** - Binary selection input for forms
|
|
31
|
+
- **DatePicker** - Calendar-based date selection input
|
|
32
|
+
- **Form** - Form wrapper component with validation support
|
|
33
|
+
- **Input** - Text input field with multiple variants and features
|
|
34
|
+
- **InputOtp** - One-time password input component
|
|
35
|
+
- **InputSelector** - Combined input with selection capabilities
|
|
36
|
+
- **Label** - Form label component with accessibility features
|
|
37
|
+
- **RadioGroup** - Group of mutually exclusive radio button options
|
|
38
|
+
- **Select** - Standard dropdown selection component
|
|
39
|
+
- **Slider** - Range input slider for numeric values
|
|
40
|
+
- **Switch** - Toggle switch for binary options
|
|
41
|
+
- **TextArea** - Multi-line text input field
|
|
42
|
+
|
|
43
|
+
### Layout & Structure Components
|
|
44
|
+
- **Accordion** - Collapsible content panels for organizing information hierarchically
|
|
45
|
+
- **AppSidebar** - Application sidebar navigation component
|
|
46
|
+
- **AppStepper** - Step-by-step progress indicator for multi-step processes
|
|
47
|
+
- **AspectRatio** - Container that maintains a specific aspect ratio for responsive layouts
|
|
48
|
+
- **Breadcrumb** - Breadcrumb navigation component for hierarchical navigation
|
|
49
|
+
- **Card** - Container component for grouping related content
|
|
50
|
+
- **Collapsible** - Content that can be expanded or collapsed
|
|
51
|
+
- **Resizable** - Resizable panels component for flexible layouts
|
|
52
|
+
- **ScrollArea** - Custom scrollbar component with styling
|
|
53
|
+
- **Separator** - Visual divider between content sections
|
|
54
|
+
- **Sidebar** - Generic sidebar container component
|
|
55
|
+
- **Stepper** - Primitive stepper components for building multi-step flows
|
|
56
|
+
- **Tabs** - Tabbed interface for organizing content
|
|
57
|
+
|
|
58
|
+
### Overlay & Dialog Components
|
|
59
|
+
- **Alert** - Display important messages and notifications to users
|
|
60
|
+
- **AlertDialog** - Modal dialog for critical confirmations and warnings
|
|
61
|
+
- **Command** - Command palette for keyboard-driven navigation
|
|
62
|
+
- **Confirmer** - Confirmation dialog for destructive actions
|
|
63
|
+
- **ContextMenu** - Right-click context menu component
|
|
64
|
+
- **Dialog** - Modal dialog window for focused interactions
|
|
65
|
+
- **Drawer** - Slide-out panel for secondary content
|
|
66
|
+
- **DropdownMenu** - Dropdown menu component with keyboard navigation
|
|
67
|
+
- **HoverCard** - Popover card displayed on hover
|
|
68
|
+
- **Menubar** - Application menu bar component
|
|
69
|
+
- **Popover** - Floating content container triggered by user interaction
|
|
70
|
+
- **Sheet** - Side sheet component for secondary content
|
|
71
|
+
- **Tooltip** - Contextual information displayed on hover
|
|
72
|
+
|
|
73
|
+
### Data Display Components
|
|
74
|
+
- **Avatar** - User profile image display with fallback initials
|
|
75
|
+
- **Badge** - Small status indicator or label for highlighting information
|
|
76
|
+
- **DataCrossTable** - Cross-tabulation data display component
|
|
77
|
+
- **DataTable** - Advanced table component with sorting, filtering, and pagination
|
|
78
|
+
- **Pagination** - Page navigation component for paginated content
|
|
79
|
+
- **Table** - Basic table component with styling
|
|
80
|
+
- **TableSkeleton** - Loading skeleton for table components
|
|
81
|
+
- **Typo** - Typography component for consistent text styling
|
|
82
|
+
|
|
83
|
+
### Content & Media Components
|
|
84
|
+
- **AppEditor** - Rich text editor component for content creation
|
|
85
|
+
- **AudioVisualizer** - Audio waveform visualization component
|
|
86
|
+
- **Calendar** - Date selection and display component
|
|
87
|
+
- **Carousel** - Slideshow component for cycling through content
|
|
88
|
+
- **CodeHighlighter** - Code syntax highlighting component
|
|
89
|
+
- **CopyButton** - Button for copying content to clipboard
|
|
90
|
+
- **FilePreview** - Component for previewing file contents
|
|
91
|
+
- **FilePreviewer** - Enhanced file preview with multiple format support
|
|
92
|
+
- **FileUploader** - Drag-and-drop file upload component
|
|
93
|
+
- **Icon** - Icon component using Feather Icons library
|
|
94
|
+
- **MarkdownRenderer** - Markdown content renderer with syntax highlighting
|
|
95
|
+
- **SecurePdfViewer** - Secure PDF viewer component with protection
|
|
96
|
+
- **ShikiHighlighter** - Code syntax highlighter using Shiki
|
|
97
|
+
|
|
98
|
+
### Messaging & Communication
|
|
99
|
+
- **Chat** - Complete chat interface component
|
|
100
|
+
- **ChatMessage** - Individual message display within chat interfaces
|
|
101
|
+
- **MessageInput** - Text input specifically designed for messaging
|
|
102
|
+
- **MessageList** - Scrollable list of messages
|
|
103
|
+
- **PromptSuggestions** - Suggestion chips for prompt input
|
|
104
|
+
|
|
105
|
+
### Navigation Components
|
|
106
|
+
- **Button** - Primary interactive element for user actions
|
|
107
|
+
- **NavigationMenu** - Navigation menu with dropdown support
|
|
108
|
+
- **ThemeSwitcher** - Component for switching between light/dark themes
|
|
109
|
+
- **WeeklyCalendar** - Week-view calendar component
|
|
110
|
+
|
|
111
|
+
### Utility & Feedback Components
|
|
112
|
+
- **Skeleton** - Loading placeholder component with animation
|
|
113
|
+
- **Sonner** - Toast notification system
|
|
114
|
+
- **Spinner** - Loading spinner indicator
|
|
115
|
+
- **Toaster** - Toast notification container
|
|
116
|
+
- **Toggle** - Toggle button component
|
|
117
|
+
- **ToggleGroup** - Group of toggle buttons with single/multiple selection
|
|
118
|
+
- **TypingIndicator** - Animated typing indicator for chat interfaces
|
|
119
|
+
|
|
120
|
+
## Progress Components
|
|
121
|
+
|
|
122
|
+
- **CircularProgress** - Circular loading indicator
|
|
123
|
+
- **Progress** - Linear loading indicator (progress bar)
|
|
124
|
+
|
|
125
|
+
## Chart Components
|
|
126
|
+
|
|
127
|
+
- **Chart** - Base chart component using Recharts library
|
|
128
|
+
- **GanttChart** - Timeline-based project planning chart
|
|
129
|
+
|
|
130
|
+
## Form Components
|
|
131
|
+
|
|
132
|
+
- **FormComposer** - Dynamic form builder and renderer
|
|
133
|
+
|
|
134
|
+
## Deprecated Components
|
|
135
|
+
|
|
136
|
+
The following components are marked as deprecated and should not be used in new development:
|
|
137
|
+
|
|
138
|
+
- **MultipleSelector** - ~~Use `AppSelect` instead~~
|
|
139
|
+
- **AppMultipleSelectDropdown** - ~~Use `AppSelect` instead~~
|
|
140
|
+
- **ResizePrompt** - ~~Use alternative resize handling methods~~
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
**Note for AI Models**: This list represents the complete component library available in laif-ds. When users reference these components, refer to the corresponding documentation file at `/frontend/node_modules/laif-ds/dist/agent-docs/components/{ComponentName}.md` for detailed implementation guidelines, props, and usage examples.
|
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
3
3
|
import { cn as o } from "../../lib/utils.js";
|
|
4
|
-
import { Controller as
|
|
4
|
+
import { Controller as V } from "../../node_modules/react-hook-form/dist/index.esm.js";
|
|
5
5
|
import { AppSelect as m } from "./app-select.js";
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Checkbox as
|
|
8
|
-
import { DatePicker as
|
|
9
|
-
import { Input as
|
|
6
|
+
import { Button as j } from "./button.js";
|
|
7
|
+
import { Checkbox as A } from "./checkbox.js";
|
|
8
|
+
import { DatePicker as F } from "./date-picker.js";
|
|
9
|
+
import { Input as I } from "./input.js";
|
|
10
10
|
import { Label as t } from "./label.js";
|
|
11
|
-
import { RadioGroup as
|
|
12
|
-
import { Slider as
|
|
13
|
-
import { Switch as
|
|
14
|
-
import { Textarea as
|
|
11
|
+
import { RadioGroup as R, RadioGroupItem as B } from "./radio-group.js";
|
|
12
|
+
import { Slider as $ } from "./slider.js";
|
|
13
|
+
import { Switch as D } from "./switch.js";
|
|
14
|
+
import { Textarea as G } from "./textarea.js";
|
|
15
15
|
import { Typo as i } from "./typo.js";
|
|
16
|
-
const
|
|
16
|
+
const X = ({
|
|
17
17
|
items: h,
|
|
18
18
|
cols: v = "2",
|
|
19
19
|
form: b,
|
|
20
20
|
submitText: g = "Invia",
|
|
21
21
|
onSubmit: x,
|
|
22
|
-
isSubmitting: p = !1
|
|
22
|
+
isSubmitting: p = !1,
|
|
23
|
+
showSubmitButton: C = !1
|
|
23
24
|
}) => {
|
|
24
25
|
const {
|
|
25
|
-
control:
|
|
26
|
-
handleSubmit:
|
|
27
|
-
formState: { errors:
|
|
28
|
-
} = b,
|
|
29
|
-
const c =
|
|
26
|
+
control: N,
|
|
27
|
+
handleSubmit: y,
|
|
28
|
+
formState: { errors: f, isValid: S, isDirty: k }
|
|
29
|
+
} = b, w = (e) => {
|
|
30
|
+
const c = f[e.name]?.message, d = c ? String(c) : void 0;
|
|
30
31
|
return /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
31
|
-
|
|
32
|
+
V,
|
|
32
33
|
{
|
|
33
34
|
name: e.name,
|
|
34
|
-
control:
|
|
35
|
+
control: N,
|
|
35
36
|
render: ({ field: r }) => {
|
|
36
|
-
const s = /* @__PURE__ */
|
|
37
|
+
const s = /* @__PURE__ */ n("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
37
38
|
/* @__PURE__ */ a(t, { children: e.label }),
|
|
38
39
|
d && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: d })
|
|
39
40
|
] });
|
|
40
41
|
switch (e.component) {
|
|
41
42
|
case "input":
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ n("div", { children: [
|
|
43
44
|
s,
|
|
44
45
|
/* @__PURE__ */ a(
|
|
45
|
-
|
|
46
|
+
I,
|
|
46
47
|
{
|
|
47
48
|
...r,
|
|
48
49
|
placeholder: e.placeholder,
|
|
@@ -52,10 +53,10 @@ const U = ({
|
|
|
52
53
|
)
|
|
53
54
|
] });
|
|
54
55
|
case "textarea":
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ n("div", { children: [
|
|
56
57
|
s,
|
|
57
58
|
/* @__PURE__ */ a(
|
|
58
|
-
|
|
59
|
+
G,
|
|
59
60
|
{
|
|
60
61
|
...r,
|
|
61
62
|
placeholder: e.placeholder,
|
|
@@ -65,27 +66,27 @@ const U = ({
|
|
|
65
66
|
)
|
|
66
67
|
] });
|
|
67
68
|
case "radio":
|
|
68
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ n("div", { children: [
|
|
69
70
|
s,
|
|
70
71
|
/* @__PURE__ */ a(
|
|
71
|
-
|
|
72
|
+
R,
|
|
72
73
|
{
|
|
73
74
|
value: r.value != null ? String(r.value) : "",
|
|
74
|
-
onValueChange: (
|
|
75
|
+
onValueChange: (l) => r.onChange(l),
|
|
75
76
|
className: "space-y-2",
|
|
76
77
|
disabled: e.disabled,
|
|
77
|
-
children: (e.options ?? []).map((
|
|
78
|
-
const u = `${e.name}-${
|
|
79
|
-
return /* @__PURE__ */
|
|
78
|
+
children: (e.options ?? []).map((l) => {
|
|
79
|
+
const u = `${e.name}-${l.value}`;
|
|
80
|
+
return /* @__PURE__ */ n(
|
|
80
81
|
"div",
|
|
81
82
|
{
|
|
82
83
|
className: "flex items-center gap-2",
|
|
83
84
|
children: [
|
|
84
85
|
/* @__PURE__ */ a(
|
|
85
|
-
|
|
86
|
+
B,
|
|
86
87
|
{
|
|
87
88
|
id: u,
|
|
88
|
-
value: String(
|
|
89
|
+
value: String(l.value),
|
|
89
90
|
disabled: e.disabled
|
|
90
91
|
}
|
|
91
92
|
),
|
|
@@ -97,25 +98,25 @@ const U = ({
|
|
|
97
98
|
"cursor-pointer",
|
|
98
99
|
e.disabled && "cursor-not-allowed opacity-60"
|
|
99
100
|
),
|
|
100
|
-
children:
|
|
101
|
+
children: l.label
|
|
101
102
|
}
|
|
102
103
|
)
|
|
103
104
|
]
|
|
104
105
|
},
|
|
105
|
-
|
|
106
|
+
l.value
|
|
106
107
|
);
|
|
107
108
|
})
|
|
108
109
|
}
|
|
109
110
|
)
|
|
110
111
|
] });
|
|
111
112
|
case "select":
|
|
112
|
-
return /* @__PURE__ */
|
|
113
|
+
return /* @__PURE__ */ n("div", { children: [
|
|
113
114
|
s,
|
|
114
115
|
/* @__PURE__ */ a(
|
|
115
116
|
m,
|
|
116
117
|
{
|
|
117
118
|
...r,
|
|
118
|
-
onValueChange: (
|
|
119
|
+
onValueChange: (l) => r.onChange(l),
|
|
119
120
|
options: e.options ?? [],
|
|
120
121
|
placeholder: e.placeholder,
|
|
121
122
|
disabled: e.disabled
|
|
@@ -123,14 +124,14 @@ const U = ({
|
|
|
123
124
|
)
|
|
124
125
|
] });
|
|
125
126
|
case "multiselect":
|
|
126
|
-
return /* @__PURE__ */
|
|
127
|
+
return /* @__PURE__ */ n("div", { children: [
|
|
127
128
|
s,
|
|
128
129
|
/* @__PURE__ */ a(
|
|
129
130
|
m,
|
|
130
131
|
{
|
|
131
132
|
...r,
|
|
132
133
|
multiple: !0,
|
|
133
|
-
onValueChange: (
|
|
134
|
+
onValueChange: (l) => r.onChange(l),
|
|
134
135
|
options: e.options ?? [],
|
|
135
136
|
placeholder: e.placeholder,
|
|
136
137
|
disabled: e.disabled
|
|
@@ -138,13 +139,13 @@ const U = ({
|
|
|
138
139
|
)
|
|
139
140
|
] });
|
|
140
141
|
case "datepicker":
|
|
141
|
-
return /* @__PURE__ */
|
|
142
|
+
return /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
142
143
|
s,
|
|
143
144
|
/* @__PURE__ */ a(
|
|
144
|
-
|
|
145
|
+
F,
|
|
145
146
|
{
|
|
146
147
|
value: r.value,
|
|
147
|
-
onChange: e.disabled || e.calendarRange ? void 0 : (
|
|
148
|
+
onChange: e.disabled || e.calendarRange ? void 0 : (l) => r.onChange(l),
|
|
148
149
|
placeholder: e.placeholder,
|
|
149
150
|
disabled: e.disabled,
|
|
150
151
|
customCalendarProps: e.disabled ? {
|
|
@@ -153,20 +154,20 @@ const U = ({
|
|
|
153
154
|
} : e.calendarRange ? {
|
|
154
155
|
mode: "range",
|
|
155
156
|
selected: r.value,
|
|
156
|
-
onSelect: (
|
|
157
|
+
onSelect: (l) => r.onChange(l)
|
|
157
158
|
} : void 0
|
|
158
159
|
}
|
|
159
160
|
)
|
|
160
161
|
] });
|
|
161
162
|
case "checkbox":
|
|
162
|
-
return /* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
163
|
+
return /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
|
|
164
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
164
165
|
/* @__PURE__ */ a(
|
|
165
|
-
|
|
166
|
+
A,
|
|
166
167
|
{
|
|
167
168
|
...r,
|
|
168
169
|
id: e.name,
|
|
169
|
-
onCheckedChange: (
|
|
170
|
+
onCheckedChange: (l) => r.onChange(l),
|
|
170
171
|
defaultChecked: !!e.defaultValue,
|
|
171
172
|
disabled: e.disabled
|
|
172
173
|
}
|
|
@@ -194,9 +195,9 @@ const U = ({
|
|
|
194
195
|
)
|
|
195
196
|
] });
|
|
196
197
|
case "switch":
|
|
197
|
-
return /* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
|
|
199
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between", children: [
|
|
200
|
+
/* @__PURE__ */ n("div", { children: [
|
|
200
201
|
/* @__PURE__ */ a(t, { htmlFor: e.name, children: e.label }),
|
|
201
202
|
e.caption && /* @__PURE__ */ a(
|
|
202
203
|
i,
|
|
@@ -208,11 +209,11 @@ const U = ({
|
|
|
208
209
|
)
|
|
209
210
|
] }),
|
|
210
211
|
/* @__PURE__ */ a(
|
|
211
|
-
|
|
212
|
+
D,
|
|
212
213
|
{
|
|
213
214
|
id: e.name,
|
|
214
215
|
checked: !!r.value,
|
|
215
|
-
onCheckedChange: (
|
|
216
|
+
onCheckedChange: (l) => r.onChange(l),
|
|
216
217
|
disabled: e.disabled
|
|
217
218
|
}
|
|
218
219
|
)
|
|
@@ -220,13 +221,13 @@ const U = ({
|
|
|
220
221
|
d && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: d })
|
|
221
222
|
] });
|
|
222
223
|
case "slider":
|
|
223
|
-
return /* @__PURE__ */
|
|
224
|
+
return /* @__PURE__ */ n("div", { children: [
|
|
224
225
|
s,
|
|
225
226
|
/* @__PURE__ */ a(
|
|
226
|
-
|
|
227
|
+
$,
|
|
227
228
|
{
|
|
228
229
|
value: Array.isArray(r.value) ? r.value : [r.value || e.min || 0],
|
|
229
|
-
onValueChange: (
|
|
230
|
+
onValueChange: (l) => r.onChange(l[0]),
|
|
230
231
|
min: e.min ?? 0,
|
|
231
232
|
max: e.max ?? 100,
|
|
232
233
|
step: e.step ?? 1,
|
|
@@ -248,20 +249,20 @@ const U = ({
|
|
|
248
249
|
}
|
|
249
250
|
) });
|
|
250
251
|
};
|
|
251
|
-
return /* @__PURE__ */
|
|
252
|
+
return /* @__PURE__ */ n("form", { onSubmit: y((e) => x?.(e)), children: [
|
|
252
253
|
/* @__PURE__ */ a("div", { className: o("grid gap-4", `grid-cols-${v}`), children: h.map((e, c) => /* @__PURE__ */ a(
|
|
253
254
|
"div",
|
|
254
255
|
{
|
|
255
256
|
className: o(c === h.length - 1 && "col-span-full"),
|
|
256
|
-
children:
|
|
257
|
+
children: w(e)
|
|
257
258
|
},
|
|
258
259
|
e.name
|
|
259
260
|
)) }),
|
|
260
|
-
/* @__PURE__ */ a("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ a(
|
|
261
|
-
|
|
261
|
+
C && /* @__PURE__ */ a("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ a(
|
|
262
|
+
j,
|
|
262
263
|
{
|
|
263
264
|
type: "submit",
|
|
264
|
-
disabled: !
|
|
265
|
+
disabled: !S || !k || p,
|
|
265
266
|
isLoading: p,
|
|
266
267
|
children: g
|
|
267
268
|
}
|
|
@@ -269,5 +270,5 @@ const U = ({
|
|
|
269
270
|
] });
|
|
270
271
|
};
|
|
271
272
|
export {
|
|
272
|
-
|
|
273
|
+
X as AppForm
|
|
273
274
|
};
|
|
@@ -7,9 +7,10 @@ import { Popover as I, PopoverTrigger as E, PopoverContent as R } from "./popove
|
|
|
7
7
|
import { cn as T } from "../../lib/utils.js";
|
|
8
8
|
import * as x from "react";
|
|
9
9
|
import { useEffect as V } from "react";
|
|
10
|
+
import { it as q } from "../../node_modules/date-fns/locale/it.js";
|
|
10
11
|
import { formatDate as m } from "../../node_modules/date-fns/format.js";
|
|
11
|
-
import { isSameDay as
|
|
12
|
-
function
|
|
12
|
+
import { isSameDay as A } from "../../node_modules/date-fns/isSameDay.js";
|
|
13
|
+
function X({
|
|
13
14
|
value: e,
|
|
14
15
|
onChange: c,
|
|
15
16
|
placeholder: b = "Seleziona data",
|
|
@@ -21,7 +22,7 @@ function U({
|
|
|
21
22
|
firstDate: a,
|
|
22
23
|
lastDate: p,
|
|
23
24
|
availableDates: l,
|
|
24
|
-
locale: C,
|
|
25
|
+
locale: C = q,
|
|
25
26
|
initialCalendarMonth: u,
|
|
26
27
|
customCalendarProps: P
|
|
27
28
|
}) {
|
|
@@ -33,7 +34,7 @@ function U({
|
|
|
33
34
|
let s = [];
|
|
34
35
|
return a && s.push({ before: a }), p && s.push({ after: p }), l?.length && s.push(
|
|
35
36
|
(n) => !l.some(
|
|
36
|
-
(M) =>
|
|
37
|
+
(M) => A(M, n)
|
|
37
38
|
)
|
|
38
39
|
), t && (s = [!0]), V(() => {
|
|
39
40
|
h(r), g(r || u);
|
|
@@ -88,5 +89,5 @@ function U({
|
|
|
88
89
|
] });
|
|
89
90
|
}
|
|
90
91
|
export {
|
|
91
|
-
|
|
92
|
+
X as DatePicker
|
|
92
93
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -146,9 +146,9 @@ declare interface AppEditorProps {
|
|
|
146
146
|
|
|
147
147
|
declare type AppEditorToolbar = "block-format" | "font-format" | "history";
|
|
148
148
|
|
|
149
|
-
export declare const AppForm: ({ items, cols, form, submitText, onSubmit, isSubmitting, }: AppFormProps) => JSX.Element;
|
|
149
|
+
export declare const AppForm: ({ items, cols, form, submitText, onSubmit, isSubmitting, showSubmitButton, }: AppFormProps) => JSX.Element;
|
|
150
150
|
|
|
151
|
-
declare interface AppFormItem {
|
|
151
|
+
export declare interface AppFormItem {
|
|
152
152
|
label: string;
|
|
153
153
|
component: "input" | "select" | "textarea" | "checkbox" | "multiselect" | "datepicker" | "radio" | "switch" | "slider";
|
|
154
154
|
name: string;
|
|
@@ -164,12 +164,13 @@ declare interface AppFormItem {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
declare interface AppFormProps {
|
|
167
|
-
cols?: "
|
|
167
|
+
cols?: "1" | "2" | "3";
|
|
168
168
|
items: AppFormItem[];
|
|
169
169
|
form: UseFormReturn<any>;
|
|
170
170
|
submitText?: string;
|
|
171
171
|
onSubmit?: (data: any) => void;
|
|
172
172
|
isSubmitting?: boolean;
|
|
173
|
+
showSubmitButton?: boolean;
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { constructFrom as e } from "../constructFrom.js";
|
|
3
|
-
function
|
|
4
|
-
const
|
|
3
|
+
function c(o, ...n) {
|
|
4
|
+
const t = e.bind(
|
|
5
5
|
null,
|
|
6
|
-
n.find((
|
|
6
|
+
o || n.find((r) => typeof r == "object")
|
|
7
7
|
);
|
|
8
|
-
return n.map(
|
|
8
|
+
return n.map(t);
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
c as normalizeDates
|
|
12
12
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { normalizeDates as f } from "./_lib/normalizeDates.js";
|
|
3
|
+
import { startOfWeek as r } from "./startOfWeek.js";
|
|
4
|
+
function o(t, a, e) {
|
|
5
|
+
const [i, m] = f(
|
|
6
|
+
e?.in,
|
|
7
|
+
t,
|
|
8
|
+
a
|
|
9
|
+
);
|
|
10
|
+
return +r(i, e) == +r(m, e);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
o as default,
|
|
14
|
+
o as isSameWeek
|
|
15
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const i = {
|
|
3
|
+
lessThanXSeconds: {
|
|
4
|
+
one: "meno di un secondo",
|
|
5
|
+
other: "meno di {{count}} secondi"
|
|
6
|
+
},
|
|
7
|
+
xSeconds: {
|
|
8
|
+
one: "un secondo",
|
|
9
|
+
other: "{{count}} secondi"
|
|
10
|
+
},
|
|
11
|
+
halfAMinute: "alcuni secondi",
|
|
12
|
+
lessThanXMinutes: {
|
|
13
|
+
one: "meno di un minuto",
|
|
14
|
+
other: "meno di {{count}} minuti"
|
|
15
|
+
},
|
|
16
|
+
xMinutes: {
|
|
17
|
+
one: "un minuto",
|
|
18
|
+
other: "{{count}} minuti"
|
|
19
|
+
},
|
|
20
|
+
aboutXHours: {
|
|
21
|
+
one: "circa un'ora",
|
|
22
|
+
other: "circa {{count}} ore"
|
|
23
|
+
},
|
|
24
|
+
xHours: {
|
|
25
|
+
one: "un'ora",
|
|
26
|
+
other: "{{count}} ore"
|
|
27
|
+
},
|
|
28
|
+
xDays: {
|
|
29
|
+
one: "un giorno",
|
|
30
|
+
other: "{{count}} giorni"
|
|
31
|
+
},
|
|
32
|
+
aboutXWeeks: {
|
|
33
|
+
one: "circa una settimana",
|
|
34
|
+
other: "circa {{count}} settimane"
|
|
35
|
+
},
|
|
36
|
+
xWeeks: {
|
|
37
|
+
one: "una settimana",
|
|
38
|
+
other: "{{count}} settimane"
|
|
39
|
+
},
|
|
40
|
+
aboutXMonths: {
|
|
41
|
+
one: "circa un mese",
|
|
42
|
+
other: "circa {{count}} mesi"
|
|
43
|
+
},
|
|
44
|
+
xMonths: {
|
|
45
|
+
one: "un mese",
|
|
46
|
+
other: "{{count}} mesi"
|
|
47
|
+
},
|
|
48
|
+
aboutXYears: {
|
|
49
|
+
one: "circa un anno",
|
|
50
|
+
other: "circa {{count}} anni"
|
|
51
|
+
},
|
|
52
|
+
xYears: {
|
|
53
|
+
one: "un anno",
|
|
54
|
+
other: "{{count}} anni"
|
|
55
|
+
},
|
|
56
|
+
overXYears: {
|
|
57
|
+
one: "più di un anno",
|
|
58
|
+
other: "più di {{count}} anni"
|
|
59
|
+
},
|
|
60
|
+
almostXYears: {
|
|
61
|
+
one: "quasi un anno",
|
|
62
|
+
other: "quasi {{count}} anni"
|
|
63
|
+
}
|
|
64
|
+
}, r = (a, t, o) => {
|
|
65
|
+
let n;
|
|
66
|
+
const e = i[a];
|
|
67
|
+
return typeof e == "string" ? n = e : t === 1 ? n = e.one : n = e.other.replace("{{count}}", t.toString()), o?.addSuffix ? o.comparison && o.comparison > 0 ? "tra " + n : n + " fa" : n;
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
r as formatDistance
|
|
71
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { buildFormatLongFn as t } from "../../_lib/buildFormatLongFn.js";
|
|
3
|
+
const m = {
|
|
4
|
+
full: "EEEE d MMMM y",
|
|
5
|
+
long: "d MMMM y",
|
|
6
|
+
medium: "d MMM y",
|
|
7
|
+
short: "dd/MM/y"
|
|
8
|
+
}, e = {
|
|
9
|
+
full: "HH:mm:ss zzzz",
|
|
10
|
+
long: "HH:mm:ss z",
|
|
11
|
+
medium: "HH:mm:ss",
|
|
12
|
+
short: "HH:mm"
|
|
13
|
+
}, d = {
|
|
14
|
+
full: "{{date}} {{time}}",
|
|
15
|
+
long: "{{date}} {{time}}",
|
|
16
|
+
medium: "{{date}} {{time}}",
|
|
17
|
+
short: "{{date}} {{time}}"
|
|
18
|
+
}, l = {
|
|
19
|
+
date: t({
|
|
20
|
+
formats: m,
|
|
21
|
+
defaultWidth: "full"
|
|
22
|
+
}),
|
|
23
|
+
time: t({
|
|
24
|
+
formats: e,
|
|
25
|
+
defaultWidth: "full"
|
|
26
|
+
}),
|
|
27
|
+
dateTime: t({
|
|
28
|
+
formats: d,
|
|
29
|
+
defaultWidth: "full"
|
|
30
|
+
})
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
l as formatLong
|
|
34
|
+
};
|