@hanzo/ui 5.3.35 → 5.3.36
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/bin/create-registry.js +0 -0
- package/bin/npx-registry-mcp.js +0 -0
- package/bin/registry-mcp-wrapper.sh +0 -0
- package/bin/registry-mcp.js +0 -0
- package/bin/start-mcp-server.sh +0 -0
- package/bin/test-mcp.sh +0 -0
- package/dist/3d/button.js +1 -297
- package/dist/3d/button.mjs +1 -272
- package/dist/3d/card.js +1 -233
- package/dist/3d/card.mjs +1 -206
- package/dist/3d/carousel.js +1 -370
- package/dist/3d/carousel.mjs +1 -343
- package/dist/3d/grid.js +1 -361
- package/dist/3d/grid.mjs +1 -336
- package/dist/3d/index.js +1 -1517
- package/dist/3d/index.mjs +1 -1471
- package/dist/3d/marquee.js +1 -351
- package/dist/3d/marquee.mjs +1 -326
- package/dist/3d/pin.js +1 -45
- package/dist/3d/pin.mjs +1 -23
- package/dist/accordion.js +1 -79
- package/dist/accordion.mjs +1 -54
- package/dist/alert-dialog.js +1 -224
- package/dist/alert-dialog.mjs +1 -191
- package/dist/alert.js +1 -97
- package/dist/alert.mjs +1 -91
- package/dist/animation/animated-background.js +1 -423
- package/dist/animation/animated-background.mjs +1 -417
- package/dist/animation/animated-beam.js +1 -118
- package/dist/animation/animated-beam.mjs +1 -96
- package/dist/animation/animated-cursor.js +1 -274
- package/dist/animation/animated-cursor.mjs +1 -269
- package/dist/animation/animated-icon.js +2 -356
- package/dist/animation/animated-icon.mjs +2 -350
- package/dist/animation/animated-list.js +1 -338
- package/dist/animation/animated-list.mjs +1 -332
- package/dist/animation/animated-number.js +1 -282
- package/dist/animation/animated-number.mjs +1 -276
- package/dist/animation/animated-testimonials.js +1 -96
- package/dist/animation/animated-testimonials.mjs +1 -74
- package/dist/animation/animated-tooltip.js +1 -66
- package/dist/animation/animated-tooltip.mjs +1 -44
- package/dist/animation/apple-cards-carousel.js +1 -307
- package/dist/animation/apple-cards-carousel.mjs +1 -284
- package/dist/animation/apple-hello-effect.js +1 -59
- package/dist/animation/apple-hello-effect.mjs +1 -37
- package/dist/animation/index.js +2 -1951
- package/dist/animation/index.mjs +2 -1920
- package/dist/avatar.js +1 -70
- package/dist/avatar.mjs +1 -46
- package/dist/badge.js +1 -60
- package/dist/badge.mjs +1 -54
- package/dist/blocks/index.js +2 -1684
- package/dist/blocks/index.mjs +2 -1645
- package/dist/breadcrumb.js +1 -106
- package/dist/breadcrumb.mjs +1 -98
- package/dist/calendar-ext/index.js +1 -207
- package/dist/calendar-ext/index.mjs +1 -169
- package/dist/calendar.js +1 -193
- package/dist/calendar.mjs +1 -168
- package/dist/carousel.js +1 -282
- package/dist/carousel.mjs +1 -253
- package/dist/charts/index.js +6 -5840
- package/dist/charts/index.mjs +6 -5749
- package/dist/checkbox.js +1 -59
- package/dist/checkbox.mjs +1 -34
- package/dist/code/block.js +2 -225
- package/dist/code/block.mjs +2 -202
- package/dist/code/compare.js +5 -444
- package/dist/code/compare.mjs +5 -421
- package/dist/code/diff.js +12 -429
- package/dist/code/diff.mjs +11 -405
- package/dist/code/editor.js +1 -242
- package/dist/code/editor.mjs +1 -217
- package/dist/code/explorer.js +1 -290
- package/dist/code/explorer.mjs +1 -267
- package/dist/code/index.js +26 -2514
- package/dist/code/index.mjs +24 -2471
- package/dist/code/preview.js +6 -363
- package/dist/code/preview.mjs +6 -340
- package/dist/code/snippet.js +2 -273
- package/dist/code/snippet.mjs +2 -249
- package/dist/code/tabs.js +1 -74
- package/dist/code/tabs.mjs +1 -52
- package/dist/code/terminal.js +3 -436
- package/dist/code/terminal.mjs +3 -413
- package/dist/collapsible.js +1 -32
- package/dist/collapsible.mjs +1 -8
- package/dist/command.js +1 -282
- package/dist/command.mjs +1 -251
- package/dist/context-menu.js +1 -206
- package/dist/context-menu.mjs +1 -170
- package/dist/desktop/hooks.js +1 -223
- package/dist/desktop/hooks.mjs +1 -198
- package/dist/desktop/index.js +1 -685
- package/dist/desktop/index.mjs +1 -657
- package/dist/desktop/spotlight.js +1 -260
- package/dist/desktop/spotlight.mjs +1 -235
- package/dist/desktop/window.js +1 -273
- package/dist/desktop/window.mjs +1 -247
- package/dist/device/index.js +1 -2
- package/dist/device/index.mjs +0 -1
- package/dist/dialog.js +1 -245
- package/dist/dialog.mjs +1 -213
- package/dist/dock/basic.js +1 -173
- package/dist/dock/basic.mjs +1 -150
- package/dist/dock/index.js +1 -647
- package/dist/dock/index.mjs +1 -620
- package/dist/dock/limelight-nav.js +1 -314
- package/dist/dock/limelight-nav.mjs +1 -293
- package/dist/dock/macos.js +1 -140
- package/dist/dock/macos.mjs +1 -117
- package/dist/dock/menu.js +1 -69
- package/dist/dock/menu.mjs +1 -47
- package/dist/dock/message.js +1 -148
- package/dist/dock/message.mjs +1 -126
- package/dist/drawer.js +1 -114
- package/dist/drawer.mjs +1 -102
- package/dist/dropdown-menu.js +1 -201
- package/dist/dropdown-menu.mjs +1 -165
- package/dist/finance/AdvancedChart.js +2 -47
- package/dist/finance/AdvancedChart.mjs +2 -45
- package/dist/finance/CompanyProfile.js +2 -47
- package/dist/finance/CompanyProfile.mjs +2 -45
- package/dist/finance/CryptoScreener.js +2 -44
- package/dist/finance/CryptoScreener.mjs +2 -42
- package/dist/finance/Financials.js +2 -51
- package/dist/finance/Financials.mjs +2 -49
- package/dist/finance/ForexScreener.js +2 -45
- package/dist/finance/ForexScreener.mjs +2 -43
- package/dist/finance/MarketOverview.js +2 -103
- package/dist/finance/MarketOverview.mjs +2 -101
- package/dist/finance/NewsTimeline.js +2 -43
- package/dist/finance/NewsTimeline.mjs +2 -41
- package/dist/finance/OrderEntry.js +1 -130
- package/dist/finance/OrderEntry.mjs +1 -128
- package/dist/finance/OrdersHistory.js +1 -63
- package/dist/finance/OrdersHistory.mjs +1 -61
- package/dist/finance/PositionsList.js +1 -79
- package/dist/finance/PositionsList.mjs +1 -77
- package/dist/finance/StockScreener.js +2 -45
- package/dist/finance/StockScreener.mjs +2 -43
- package/dist/finance/SymbolInfo.js +2 -45
- package/dist/finance/SymbolInfo.mjs +2 -43
- package/dist/finance/TechnicalAnalysis.js +2 -53
- package/dist/finance/TechnicalAnalysis.mjs +2 -51
- package/dist/finance/TickerTape.js +2 -55
- package/dist/finance/TickerTape.mjs +2 -53
- package/dist/finance/TradingPanel.js +1 -190
- package/dist/finance/TradingPanel.mjs +1 -188
- package/dist/finance/index.js +2 -929
- package/dist/finance/index.mjs +2 -913
- package/dist/form/index.js +1 -153
- package/dist/form/index.mjs +1 -123
- package/dist/form.js +1 -171
- package/dist/form.mjs +1 -141
- package/dist/hover-card.js +1 -57
- package/dist/hover-card.mjs +1 -33
- package/dist/index.js +192 -9618
- package/dist/index.mjs +192 -9202
- package/dist/input-otp.js +1 -78
- package/dist/input-otp.mjs +1 -53
- package/dist/kanban/index.js +1 -593
- package/dist/kanban/index.mjs +1 -571
- package/dist/lib/utils.js +1 -28
- package/dist/lib/utils.mjs +1 -24
- package/dist/mermaid/index.js +1 -280
- package/dist/mermaid/index.mjs +1 -253
- package/dist/navigation/index.js +1 -97
- package/dist/navigation/index.mjs +1 -78
- package/dist/navigation-menu.js +1 -148
- package/dist/navigation-menu.mjs +1 -115
- package/dist/pattern/grid-pattern.js +3 -325
- package/dist/pattern/grid-pattern.mjs +3 -302
- package/dist/pattern/index.js +3 -325
- package/dist/pattern/index.mjs +3 -302
- package/dist/popover.js +1 -62
- package/dist/popover.mjs +1 -36
- package/dist/progress.js +1 -61
- package/dist/progress.mjs +1 -36
- package/dist/project/gantt.js +1 -64
- package/dist/project/gantt.mjs +1 -42
- package/dist/project/index.js +1 -635
- package/dist/project/index.mjs +1 -610
- package/dist/project/kanban.js +1 -596
- package/dist/project/kanban.mjs +1 -571
- package/dist/project/list.js +1 -34
- package/dist/project/list.mjs +1 -11
- package/dist/radio-group.js +1 -67
- package/dist/radio-group.mjs +1 -44
- package/dist/resizable.js +1 -71
- package/dist/resizable.mjs +1 -47
- package/dist/scroll-area.js +1 -88
- package/dist/scroll-area.mjs +1 -65
- package/dist/select.js +1 -139
- package/dist/select.mjs +1 -110
- package/dist/separator.js +1 -58
- package/dist/separator.mjs +1 -33
- package/dist/sheet.js +1 -147
- package/dist/sheet.mjs +1 -116
- package/dist/skeleton.js +1 -31
- package/dist/skeleton.mjs +1 -26
- package/dist/slider.js +1 -98
- package/dist/slider.mjs +1 -72
- package/dist/sonner.js +1 -33
- package/dist/sonner.mjs +1 -28
- package/dist/spline/index.js +1 -210
- package/dist/spline/index.mjs +1 -201
- package/dist/spline/media-stack.js +1 -192
- package/dist/spline/media-stack.mjs +1 -184
- package/dist/spline/player.js +1 -36
- package/dist/spline/player.mjs +1 -30
- package/dist/switch.js +1 -61
- package/dist/switch.mjs +1 -36
- package/dist/table.js +1 -109
- package/dist/table.mjs +1 -100
- package/dist/tabs.js +1 -127
- package/dist/tabs.mjs +1 -101
- package/dist/tailwind/index.mjs +1 -2011
- package/dist/textarea.js +1 -77
- package/dist/textarea.mjs +1 -55
- package/dist/toggle-group.js +1 -117
- package/dist/toggle-group.mjs +1 -92
- package/dist/toggle.js +1 -70
- package/dist/toggle.mjs +1 -47
- package/dist/tooltip.js +1 -66
- package/dist/tooltip.mjs +1 -39
- package/dist/types/index.mjs +1 -51
- package/dist/ui/announcement.js +1 -133
- package/dist/ui/announcement.mjs +1 -111
- package/dist/ui/avatar-group.js +1 -87
- package/dist/ui/avatar-group.mjs +1 -64
- package/dist/ui/banner.js +1 -84
- package/dist/ui/banner.mjs +1 -61
- package/dist/ui/cursor.js +1 -77
- package/dist/ui/cursor.mjs +1 -55
- package/dist/ui/index.js +1 -494
- package/dist/ui/index.mjs +1 -461
- package/dist/ui/marquee.js +1 -73
- package/dist/ui/marquee.mjs +1 -51
- package/dist/ui/pill.js +1 -84
- package/dist/ui/pill.mjs +1 -61
- package/dist/ui/spinner.js +1 -27
- package/dist/ui/spinner.mjs +1 -25
- package/dist/ui/tags.js +1 -116
- package/dist/ui/tags.mjs +1 -94
- package/dist/ui/ticker.js +1 -72
- package/dist/ui/ticker.mjs +1 -50
- package/dist/util/index.mjs +1 -404
- package/package.json +28 -27
- package/dist/primitives/index.js +0 -9619
- package/dist/primitives/index.mjs +0 -9203
- package/dist/primitives-export.js +0 -9619
- package/dist/primitives-export.mjs +0 -9203
package/dist/form/index.js
CHANGED
|
@@ -1,154 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var React = require('react');
|
|
5
|
-
var reactSlot = require('@radix-ui/react-slot');
|
|
6
|
-
var reactHookForm = require('react-hook-form');
|
|
7
|
-
var clsx = require('clsx');
|
|
8
|
-
var tailwindMerge = require('tailwind-merge');
|
|
9
|
-
var LabelPrimitive = require('@radix-ui/react-label');
|
|
10
|
-
var classVarianceAuthority = require('class-variance-authority');
|
|
11
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
-
|
|
13
|
-
function _interopNamespace(e) {
|
|
14
|
-
if (e && e.__esModule) return e;
|
|
15
|
-
var n = Object.create(null);
|
|
16
|
-
if (e) {
|
|
17
|
-
Object.keys(e).forEach(function (k) {
|
|
18
|
-
if (k !== 'default') {
|
|
19
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return e[k]; }
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
n.default = e;
|
|
28
|
-
return Object.freeze(n);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
32
|
-
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
33
|
-
|
|
34
|
-
var __defProp = Object.defineProperty;
|
|
35
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
36
|
-
function cn(...inputs) {
|
|
37
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
38
|
-
}
|
|
39
|
-
__name(cn, "cn");
|
|
40
|
-
|
|
41
|
-
// utils.ts
|
|
42
|
-
function cn2(...inputs) {
|
|
43
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
44
|
-
}
|
|
45
|
-
__name(cn2, "cn");
|
|
46
|
-
var labelVariants = classVarianceAuthority.cva(
|
|
47
|
-
"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
48
|
-
);
|
|
49
|
-
var Label = /* @__PURE__ */ __name(({
|
|
50
|
-
className,
|
|
51
|
-
...props
|
|
52
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(LabelPrimitive__namespace.Root, { className: cn(labelVariants(), className), ...props }), "Label");
|
|
53
|
-
Label.displayName = LabelPrimitive__namespace.Root.displayName;
|
|
54
|
-
var Form = reactHookForm.FormProvider;
|
|
55
|
-
var FormFieldContext = React__namespace.createContext(null);
|
|
56
|
-
var FormField = /* @__PURE__ */ __name(({
|
|
57
|
-
...props
|
|
58
|
-
}) => {
|
|
59
|
-
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
60
|
-
}, "FormField");
|
|
61
|
-
var useFormField = /* @__PURE__ */ __name(() => {
|
|
62
|
-
const fieldContext = React__namespace.useContext(FormFieldContext);
|
|
63
|
-
const itemContext = React__namespace.useContext(FormItemContext);
|
|
64
|
-
const { getFieldState, formState } = reactHookForm.useFormContext();
|
|
65
|
-
if (!fieldContext) {
|
|
66
|
-
throw new Error("useFormField should be used within <FormField>");
|
|
67
|
-
}
|
|
68
|
-
if (!itemContext) {
|
|
69
|
-
throw new Error("useFormField should be used within <FormItem>");
|
|
70
|
-
}
|
|
71
|
-
const fieldState = getFieldState(fieldContext.name, formState);
|
|
72
|
-
const { id } = itemContext;
|
|
73
|
-
return {
|
|
74
|
-
id,
|
|
75
|
-
name: fieldContext.name,
|
|
76
|
-
formItemId: `${id}-form-item`,
|
|
77
|
-
formDescriptionId: `${id}-form-item-description`,
|
|
78
|
-
formMessageId: `${id}-form-item-message`,
|
|
79
|
-
...fieldState
|
|
80
|
-
};
|
|
81
|
-
}, "useFormField");
|
|
82
|
-
var FormItemContext = React__namespace.createContext(null);
|
|
83
|
-
var FormItem = React__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
84
|
-
const id = React__namespace.useId();
|
|
85
|
-
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn2("space-y-2", className), ...props }) });
|
|
86
|
-
});
|
|
87
|
-
FormItem.displayName = "FormItem";
|
|
88
|
-
var FormLabel = React__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
89
|
-
const { error, formItemId } = useFormField();
|
|
90
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
-
Label,
|
|
92
|
-
{
|
|
93
|
-
ref,
|
|
94
|
-
className: cn2(error && "text-destructive", className),
|
|
95
|
-
htmlFor: formItemId,
|
|
96
|
-
...props
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
});
|
|
100
|
-
FormLabel.displayName = "FormLabel";
|
|
101
|
-
var FormControl = React__namespace.forwardRef(({ ...props }, ref) => {
|
|
102
|
-
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
103
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
104
|
-
reactSlot.Slot,
|
|
105
|
-
{
|
|
106
|
-
ref,
|
|
107
|
-
id: formItemId,
|
|
108
|
-
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
109
|
-
"aria-invalid": !!error,
|
|
110
|
-
...props
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
});
|
|
114
|
-
FormControl.displayName = "FormControl";
|
|
115
|
-
var FormDescription = React__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
116
|
-
const { formDescriptionId } = useFormField();
|
|
117
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
-
"p",
|
|
119
|
-
{
|
|
120
|
-
ref,
|
|
121
|
-
id: formDescriptionId,
|
|
122
|
-
className: cn2("text-sm text-muted-foreground", className),
|
|
123
|
-
...props
|
|
124
|
-
}
|
|
125
|
-
);
|
|
126
|
-
});
|
|
127
|
-
FormDescription.displayName = "FormDescription";
|
|
128
|
-
var FormMessage = React__namespace.forwardRef(({ className, children, ...props }, ref) => {
|
|
129
|
-
const { error, formMessageId } = useFormField();
|
|
130
|
-
const body = error ? String(error?.message ?? "") : children;
|
|
131
|
-
if (!body) {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
135
|
-
"p",
|
|
136
|
-
{
|
|
137
|
-
ref,
|
|
138
|
-
id: formMessageId,
|
|
139
|
-
className: cn2("text-sm font-medium text-destructive", className),
|
|
140
|
-
...props,
|
|
141
|
-
children: body
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
});
|
|
145
|
-
FormMessage.displayName = "FormMessage";
|
|
146
|
-
|
|
147
|
-
exports.Form = Form;
|
|
148
|
-
exports.FormControl = FormControl;
|
|
149
|
-
exports.FormDescription = FormDescription;
|
|
150
|
-
exports.FormField = FormField;
|
|
151
|
-
exports.FormItem = FormItem;
|
|
152
|
-
exports.FormLabel = FormLabel;
|
|
153
|
-
exports.FormMessage = FormMessage;
|
|
154
|
-
exports.useFormField = useFormField;
|
|
2
|
+
'use strict';var r=require('react'),reactSlot=require('@radix-ui/react-slot'),reactHookForm=require('react-hook-form'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),c=require('@radix-ui/react-label'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var r__namespace=/*#__PURE__*/_interopNamespace(r);var c__namespace=/*#__PURE__*/_interopNamespace(c);var x=Object.defineProperty;var m=(e,t)=>x(e,"name",{value:t,configurable:true});function f(...e){return tailwindMerge.twMerge(clsx.clsx(e))}m(f,"cn");function l(...e){return tailwindMerge.twMerge(clsx.clsx(e))}m(l,"cn");var g=classVarianceAuthority.cva("text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),p=m(({className:e,...t})=>jsxRuntime.jsx(c__namespace.Root,{className:f(g(),e),...t}),"Label");p.displayName=c__namespace.Root.displayName;var j=reactHookForm.FormProvider,F=r__namespace.createContext(null),ee=m(({...e})=>jsxRuntime.jsx(F.Provider,{value:{name:e.name},children:jsxRuntime.jsx(reactHookForm.Controller,{...e})}),"FormField"),d=m(()=>{let e=r__namespace.useContext(F),t=r__namespace.useContext(R),{getFieldState:o,formState:a}=reactHookForm.useFormContext();if(!e)throw new Error("useFormField should be used within <FormField>");if(!t)throw new Error("useFormField should be used within <FormItem>");let i=o(e.name,a),{id:n}=t;return {id:n,name:e.name,formItemId:`${n}-form-item`,formDescriptionId:`${n}-form-item-description`,formMessageId:`${n}-form-item-message`,...i}},"useFormField"),R=r__namespace.createContext(null),N=r__namespace.forwardRef(({className:e,...t},o)=>{let a=r__namespace.useId();return jsxRuntime.jsx(R.Provider,{value:{id:a},children:jsxRuntime.jsx("div",{ref:o,className:l("space-y-2",e),...t})})});N.displayName="FormItem";var M=r__namespace.forwardRef(({className:e,...t},o)=>{let{error:a,formItemId:i}=d();return jsxRuntime.jsx(p,{ref:o,className:l(a&&"text-destructive",e),htmlFor:i,...t})});M.displayName="FormLabel";var w=r__namespace.forwardRef(({...e},t)=>{let{error:o,formItemId:a,formDescriptionId:i,formMessageId:n}=d();return jsxRuntime.jsx(reactSlot.Slot,{ref:t,id:a,"aria-describedby":o?`${i} ${n}`:`${i}`,"aria-invalid":!!o,...e})});w.displayName="FormControl";var E=r__namespace.forwardRef(({className:e,...t},o)=>{let{formDescriptionId:a}=d();return jsxRuntime.jsx("p",{ref:o,id:a,className:l("text-sm text-muted-foreground",e),...t})});E.displayName="FormDescription";var D=r__namespace.forwardRef(({className:e,children:t,...o},a)=>{let{error:i,formMessageId:n}=d(),u=i?String(i?.message??""):t;return u?jsxRuntime.jsx("p",{ref:a,id:n,className:l("text-sm font-medium text-destructive",e),...o,children:u}):null});D.displayName="FormMessage";exports.Form=j;exports.FormControl=w;exports.FormDescription=E;exports.FormField=ee;exports.FormItem=N;exports.FormLabel=M;exports.FormMessage=D;exports.useFormField=d;
|
package/dist/form/index.mjs
CHANGED
|
@@ -1,124 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import *
|
|
3
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
-
import { useFormContext, FormProvider, Controller } from 'react-hook-form';
|
|
5
|
-
import { clsx } from 'clsx';
|
|
6
|
-
import { twMerge } from 'tailwind-merge';
|
|
7
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
8
|
-
import { cva } from 'class-variance-authority';
|
|
9
|
-
import { jsx } from 'react/jsx-runtime';
|
|
10
|
-
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
-
function cn(...inputs) {
|
|
14
|
-
return twMerge(clsx(inputs));
|
|
15
|
-
}
|
|
16
|
-
__name(cn, "cn");
|
|
17
|
-
|
|
18
|
-
// utils.ts
|
|
19
|
-
function cn2(...inputs) {
|
|
20
|
-
return twMerge(clsx(inputs));
|
|
21
|
-
}
|
|
22
|
-
__name(cn2, "cn");
|
|
23
|
-
var labelVariants = cva(
|
|
24
|
-
"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
25
|
-
);
|
|
26
|
-
var Label = /* @__PURE__ */ __name(({
|
|
27
|
-
className,
|
|
28
|
-
...props
|
|
29
|
-
}) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { className: cn(labelVariants(), className), ...props }), "Label");
|
|
30
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
31
|
-
var Form = FormProvider;
|
|
32
|
-
var FormFieldContext = React.createContext(null);
|
|
33
|
-
var FormField = /* @__PURE__ */ __name(({
|
|
34
|
-
...props
|
|
35
|
-
}) => {
|
|
36
|
-
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
37
|
-
}, "FormField");
|
|
38
|
-
var useFormField = /* @__PURE__ */ __name(() => {
|
|
39
|
-
const fieldContext = React.useContext(FormFieldContext);
|
|
40
|
-
const itemContext = React.useContext(FormItemContext);
|
|
41
|
-
const { getFieldState, formState } = useFormContext();
|
|
42
|
-
if (!fieldContext) {
|
|
43
|
-
throw new Error("useFormField should be used within <FormField>");
|
|
44
|
-
}
|
|
45
|
-
if (!itemContext) {
|
|
46
|
-
throw new Error("useFormField should be used within <FormItem>");
|
|
47
|
-
}
|
|
48
|
-
const fieldState = getFieldState(fieldContext.name, formState);
|
|
49
|
-
const { id } = itemContext;
|
|
50
|
-
return {
|
|
51
|
-
id,
|
|
52
|
-
name: fieldContext.name,
|
|
53
|
-
formItemId: `${id}-form-item`,
|
|
54
|
-
formDescriptionId: `${id}-form-item-description`,
|
|
55
|
-
formMessageId: `${id}-form-item-message`,
|
|
56
|
-
...fieldState
|
|
57
|
-
};
|
|
58
|
-
}, "useFormField");
|
|
59
|
-
var FormItemContext = React.createContext(null);
|
|
60
|
-
var FormItem = React.forwardRef(({ className, ...props }, ref) => {
|
|
61
|
-
const id = React.useId();
|
|
62
|
-
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { ref, className: cn2("space-y-2", className), ...props }) });
|
|
63
|
-
});
|
|
64
|
-
FormItem.displayName = "FormItem";
|
|
65
|
-
var FormLabel = React.forwardRef(({ className, ...props }, ref) => {
|
|
66
|
-
const { error, formItemId } = useFormField();
|
|
67
|
-
return /* @__PURE__ */ jsx(
|
|
68
|
-
Label,
|
|
69
|
-
{
|
|
70
|
-
ref,
|
|
71
|
-
className: cn2(error && "text-destructive", className),
|
|
72
|
-
htmlFor: formItemId,
|
|
73
|
-
...props
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
FormLabel.displayName = "FormLabel";
|
|
78
|
-
var FormControl = React.forwardRef(({ ...props }, ref) => {
|
|
79
|
-
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
80
|
-
return /* @__PURE__ */ jsx(
|
|
81
|
-
Slot,
|
|
82
|
-
{
|
|
83
|
-
ref,
|
|
84
|
-
id: formItemId,
|
|
85
|
-
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
86
|
-
"aria-invalid": !!error,
|
|
87
|
-
...props
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
FormControl.displayName = "FormControl";
|
|
92
|
-
var FormDescription = React.forwardRef(({ className, ...props }, ref) => {
|
|
93
|
-
const { formDescriptionId } = useFormField();
|
|
94
|
-
return /* @__PURE__ */ jsx(
|
|
95
|
-
"p",
|
|
96
|
-
{
|
|
97
|
-
ref,
|
|
98
|
-
id: formDescriptionId,
|
|
99
|
-
className: cn2("text-sm text-muted-foreground", className),
|
|
100
|
-
...props
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
});
|
|
104
|
-
FormDescription.displayName = "FormDescription";
|
|
105
|
-
var FormMessage = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
106
|
-
const { error, formMessageId } = useFormField();
|
|
107
|
-
const body = error ? String(error?.message ?? "") : children;
|
|
108
|
-
if (!body) {
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
return /* @__PURE__ */ jsx(
|
|
112
|
-
"p",
|
|
113
|
-
{
|
|
114
|
-
ref,
|
|
115
|
-
id: formMessageId,
|
|
116
|
-
className: cn2("text-sm font-medium text-destructive", className),
|
|
117
|
-
...props,
|
|
118
|
-
children: body
|
|
119
|
-
}
|
|
120
|
-
);
|
|
121
|
-
});
|
|
122
|
-
FormMessage.displayName = "FormMessage";
|
|
123
|
-
|
|
124
|
-
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
2
|
+
import*as r from'react';import {Slot}from'@radix-ui/react-slot';import {useFormContext,FormProvider,Controller}from'react-hook-form';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import*as c from'@radix-ui/react-label';import {cva}from'class-variance-authority';import {jsx}from'react/jsx-runtime';var x=Object.defineProperty;var m=(e,t)=>x(e,"name",{value:t,configurable:true});function f(...e){return twMerge(clsx(e))}m(f,"cn");function l(...e){return twMerge(clsx(e))}m(l,"cn");var g=cva("text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),p=m(({className:e,...t})=>jsx(c.Root,{className:f(g(),e),...t}),"Label");p.displayName=c.Root.displayName;var j=FormProvider,F=r.createContext(null),ee=m(({...e})=>jsx(F.Provider,{value:{name:e.name},children:jsx(Controller,{...e})}),"FormField"),d=m(()=>{let e=r.useContext(F),t=r.useContext(R),{getFieldState:o,formState:a}=useFormContext();if(!e)throw new Error("useFormField should be used within <FormField>");if(!t)throw new Error("useFormField should be used within <FormItem>");let i=o(e.name,a),{id:n}=t;return {id:n,name:e.name,formItemId:`${n}-form-item`,formDescriptionId:`${n}-form-item-description`,formMessageId:`${n}-form-item-message`,...i}},"useFormField"),R=r.createContext(null),N=r.forwardRef(({className:e,...t},o)=>{let a=r.useId();return jsx(R.Provider,{value:{id:a},children:jsx("div",{ref:o,className:l("space-y-2",e),...t})})});N.displayName="FormItem";var M=r.forwardRef(({className:e,...t},o)=>{let{error:a,formItemId:i}=d();return jsx(p,{ref:o,className:l(a&&"text-destructive",e),htmlFor:i,...t})});M.displayName="FormLabel";var w=r.forwardRef(({...e},t)=>{let{error:o,formItemId:a,formDescriptionId:i,formMessageId:n}=d();return jsx(Slot,{ref:t,id:a,"aria-describedby":o?`${i} ${n}`:`${i}`,"aria-invalid":!!o,...e})});w.displayName="FormControl";var E=r.forwardRef(({className:e,...t},o)=>{let{formDescriptionId:a}=d();return jsx("p",{ref:o,id:a,className:l("text-sm text-muted-foreground",e),...t})});E.displayName="FormDescription";var D=r.forwardRef(({className:e,children:t,...o},a)=>{let{error:i,formMessageId:n}=d(),u=i?String(i?.message??""):t;return u?jsx("p",{ref:a,id:n,className:l("text-sm font-medium text-destructive",e),...o,children:u}):null});D.displayName="FormMessage";export{j as Form,w as FormControl,E as FormDescription,ee as FormField,N as FormItem,M as FormLabel,D as FormMessage,d as useFormField};
|
package/dist/form.js
CHANGED
|
@@ -1,172 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var reactSlot = require('@radix-ui/react-slot');
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var reactHookForm = require('react-hook-form');
|
|
7
|
-
var clsx = require('clsx');
|
|
8
|
-
var tailwindMerge = require('tailwind-merge');
|
|
9
|
-
var LabelPrimitive = require('@radix-ui/react-label');
|
|
10
|
-
var classVarianceAuthority = require('class-variance-authority');
|
|
11
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
-
|
|
13
|
-
function _interopNamespace(e) {
|
|
14
|
-
if (e && e.__esModule) return e;
|
|
15
|
-
var n = Object.create(null);
|
|
16
|
-
if (e) {
|
|
17
|
-
Object.keys(e).forEach(function (k) {
|
|
18
|
-
if (k !== 'default') {
|
|
19
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return e[k]; }
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
n.default = e;
|
|
28
|
-
return Object.freeze(n);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
32
|
-
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
33
|
-
|
|
34
|
-
var __defProp = Object.defineProperty;
|
|
35
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
36
|
-
function cn(...inputs) {
|
|
37
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
38
|
-
}
|
|
39
|
-
__name(cn, "cn");
|
|
40
|
-
var labelVariants = classVarianceAuthority.cva(
|
|
41
|
-
"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
42
|
-
);
|
|
43
|
-
var Label = /* @__PURE__ */ __name(({
|
|
44
|
-
className,
|
|
45
|
-
...props
|
|
46
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(LabelPrimitive__namespace.Root, { className: cn(labelVariants(), className), ...props }), "Label");
|
|
47
|
-
Label.displayName = LabelPrimitive__namespace.Root.displayName;
|
|
48
|
-
var Form = reactHookForm.FormProvider;
|
|
49
|
-
var FormFieldContext = React__namespace.createContext(
|
|
50
|
-
{}
|
|
51
|
-
);
|
|
52
|
-
var FormField = /* @__PURE__ */ __name(({
|
|
53
|
-
...props
|
|
54
|
-
}) => {
|
|
55
|
-
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
56
|
-
}, "FormField");
|
|
57
|
-
var useFormField = /* @__PURE__ */ __name(() => {
|
|
58
|
-
const fieldContext = React__namespace.useContext(FormFieldContext);
|
|
59
|
-
const itemContext = React__namespace.useContext(FormItemContext);
|
|
60
|
-
const { getFieldState, formState } = reactHookForm.useFormContext();
|
|
61
|
-
const fieldState = getFieldState(fieldContext.name, formState);
|
|
62
|
-
if (!fieldContext) {
|
|
63
|
-
throw new Error("useFormField should be used within <FormField>");
|
|
64
|
-
}
|
|
65
|
-
const { id } = itemContext;
|
|
66
|
-
return {
|
|
67
|
-
id,
|
|
68
|
-
name: fieldContext.name,
|
|
69
|
-
formItemId: `${id}-form-item`,
|
|
70
|
-
formDescriptionId: `${id}-form-item-description`,
|
|
71
|
-
formMessageId: `${id}-form-item-message`,
|
|
72
|
-
...fieldState
|
|
73
|
-
};
|
|
74
|
-
}, "useFormField");
|
|
75
|
-
var FormItemContext = React__namespace.createContext(
|
|
76
|
-
{}
|
|
77
|
-
);
|
|
78
|
-
var FormItem = /* @__PURE__ */ __name(({
|
|
79
|
-
className,
|
|
80
|
-
...props
|
|
81
|
-
}) => {
|
|
82
|
-
const id = React__namespace.useId();
|
|
83
|
-
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative", className), ...props }) });
|
|
84
|
-
}, "FormItem");
|
|
85
|
-
FormItem.displayName = "FormItem";
|
|
86
|
-
var FormLabel = /* @__PURE__ */ __name(({
|
|
87
|
-
className,
|
|
88
|
-
...props
|
|
89
|
-
}) => {
|
|
90
|
-
const { error, formItemId } = useFormField();
|
|
91
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
92
|
-
Label,
|
|
93
|
-
{
|
|
94
|
-
className: cn(
|
|
95
|
-
"text-text-secondary pointer-events-none absolute top-3 left-4 flex text-xs leading-tight font-medium transition-all select-none",
|
|
96
|
-
// input
|
|
97
|
-
"peer-placeholder-shown:text-text-tertiary z-[1] peer-placeholder-shown:text-base peer-placeholder-shown:leading-[2.3]",
|
|
98
|
-
"peer-focus:text-text-secondary peer-disabled:peer-placeholder-shown:text-text-tertiary peer-disabled:text-text-tertiary peer-focus:text-xs peer-focus:leading-tight",
|
|
99
|
-
// select
|
|
100
|
-
"peer-data-[placeholder]/select:top-5 peer-data-[placeholder]/select:text-base",
|
|
101
|
-
// adornment
|
|
102
|
-
"peer-[.adornment]/adornment:text-xs",
|
|
103
|
-
error && "text-red-500",
|
|
104
|
-
className
|
|
105
|
-
),
|
|
106
|
-
htmlFor: formItemId,
|
|
107
|
-
...props
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
}, "FormLabel");
|
|
111
|
-
FormLabel.displayName = "FormLabel";
|
|
112
|
-
var FormControl = /* @__PURE__ */ __name(({ ...props }) => {
|
|
113
|
-
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
114
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
115
|
-
reactSlot.Slot,
|
|
116
|
-
{
|
|
117
|
-
"aria-describedby": error ? `${formDescriptionId} ${formMessageId}` : `${formDescriptionId}`,
|
|
118
|
-
"aria-invalid": !!error,
|
|
119
|
-
id: formItemId,
|
|
120
|
-
...props
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
}, "FormControl");
|
|
124
|
-
FormControl.displayName = "FormControl";
|
|
125
|
-
var FormDescription = /* @__PURE__ */ __name(({
|
|
126
|
-
className,
|
|
127
|
-
...props
|
|
128
|
-
}) => {
|
|
129
|
-
const { formDescriptionId } = useFormField();
|
|
130
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
131
|
-
"p",
|
|
132
|
-
{
|
|
133
|
-
className: cn("text-text-secondary py-1 text-[0.75rem]", className),
|
|
134
|
-
id: formDescriptionId,
|
|
135
|
-
...props
|
|
136
|
-
}
|
|
137
|
-
);
|
|
138
|
-
}, "FormDescription");
|
|
139
|
-
FormDescription.displayName = "FormDescription";
|
|
140
|
-
var FormMessage = /* @__PURE__ */ __name(({
|
|
141
|
-
className,
|
|
142
|
-
children,
|
|
143
|
-
...props
|
|
144
|
-
}) => {
|
|
145
|
-
const { error, formMessageId } = useFormField();
|
|
146
|
-
const body = error ? String(error?.message) : children;
|
|
147
|
-
if (!body) {
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
151
|
-
"p",
|
|
152
|
-
{
|
|
153
|
-
className: cn(
|
|
154
|
-
"text-red text-[0.75rem] font-medium dark:text-red-900",
|
|
155
|
-
className
|
|
156
|
-
),
|
|
157
|
-
id: formMessageId,
|
|
158
|
-
...props,
|
|
159
|
-
children: body
|
|
160
|
-
}
|
|
161
|
-
);
|
|
162
|
-
}, "FormMessage");
|
|
163
|
-
FormMessage.displayName = "FormMessage";
|
|
164
|
-
|
|
165
|
-
exports.Form = Form;
|
|
166
|
-
exports.FormControl = FormControl;
|
|
167
|
-
exports.FormDescription = FormDescription;
|
|
168
|
-
exports.FormField = FormField;
|
|
169
|
-
exports.FormItem = FormItem;
|
|
170
|
-
exports.FormLabel = FormLabel;
|
|
171
|
-
exports.FormMessage = FormMessage;
|
|
172
|
-
exports.useFormField = useFormField;
|
|
2
|
+
'use strict';var reactSlot=require('@radix-ui/react-slot'),i=require('react'),reactHookForm=require('react-hook-form'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),p=require('@radix-ui/react-label'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var i__namespace=/*#__PURE__*/_interopNamespace(i);var p__namespace=/*#__PURE__*/_interopNamespace(p);var x=Object.defineProperty;var r=(e,t)=>x(e,"name",{value:t,configurable:true});function l(...e){return tailwindMerge.twMerge(clsx.clsx(e))}r(l,"cn");var C=classVarianceAuthority.cva("text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=r(({className:e,...t})=>jsxRuntime.jsx(p__namespace.Root,{className:l(C(),e),...t}),"Label");c.displayName=p__namespace.Root.displayName;var q=reactHookForm.FormProvider,u=i__namespace.createContext({}),G=r(({...e})=>jsxRuntime.jsx(u.Provider,{value:{name:e.name},children:jsxRuntime.jsx(reactHookForm.Controller,{...e})}),"FormField"),d=r(()=>{let e=i__namespace.useContext(u),t=i__namespace.useContext(F),{getFieldState:o,formState:a}=reactHookForm.useFormContext(),m=o(e.name,a);if(!e)throw new Error("useFormField should be used within <FormField>");let{id:s}=t;return {id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...m}},"useFormField"),F=i__namespace.createContext({}),v=r(({className:e,...t})=>{let o=i__namespace.useId();return jsxRuntime.jsx(F.Provider,{value:{id:o},children:jsxRuntime.jsx("div",{className:l("relative",e),...t})})},"FormItem");v.displayName="FormItem";var L=r(({className:e,...t})=>{let{error:o,formItemId:a}=d();return jsxRuntime.jsx(c,{className:l("text-text-secondary pointer-events-none absolute top-3 left-4 flex text-xs leading-tight font-medium transition-all select-none","peer-placeholder-shown:text-text-tertiary z-[1] peer-placeholder-shown:text-base peer-placeholder-shown:leading-[2.3]","peer-focus:text-text-secondary peer-disabled:peer-placeholder-shown:text-text-tertiary peer-disabled:text-text-tertiary peer-focus:text-xs peer-focus:leading-tight","peer-data-[placeholder]/select:top-5 peer-data-[placeholder]/select:text-base","peer-[.adornment]/adornment:text-xs",o&&"text-red-500",e),htmlFor:a,...t})},"FormLabel");L.displayName="FormLabel";var R=r(({...e})=>{let{error:t,formItemId:o,formDescriptionId:a,formMessageId:m}=d();return jsxRuntime.jsx(reactSlot.Slot,{"aria-describedby":t?`${a} ${m}`:`${a}`,"aria-invalid":!!t,id:o,...e})},"FormControl");R.displayName="FormControl";var T=r(({className:e,...t})=>{let{formDescriptionId:o}=d();return jsxRuntime.jsx("p",{className:l("text-text-secondary py-1 text-[0.75rem]",e),id:o,...t})},"FormDescription");T.displayName="FormDescription";var N=r(({className:e,children:t,...o})=>{let{error:a,formMessageId:m}=d(),s=a?String(a?.message):t;return s?jsxRuntime.jsx("p",{className:l("text-red text-[0.75rem] font-medium dark:text-red-900",e),id:m,...o,children:s}):null},"FormMessage");N.displayName="FormMessage";exports.Form=q;exports.FormControl=R;exports.FormDescription=T;exports.FormField=G;exports.FormItem=v;exports.FormLabel=L;exports.FormMessage=N;exports.useFormField=d;
|
package/dist/form.mjs
CHANGED
|
@@ -1,142 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { useFormContext, FormProvider, Controller } from 'react-hook-form';
|
|
5
|
-
import { clsx } from 'clsx';
|
|
6
|
-
import { twMerge } from 'tailwind-merge';
|
|
7
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
8
|
-
import { cva } from 'class-variance-authority';
|
|
9
|
-
import { jsx } from 'react/jsx-runtime';
|
|
10
|
-
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
-
function cn(...inputs) {
|
|
14
|
-
return twMerge(clsx(inputs));
|
|
15
|
-
}
|
|
16
|
-
__name(cn, "cn");
|
|
17
|
-
var labelVariants = cva(
|
|
18
|
-
"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
19
|
-
);
|
|
20
|
-
var Label = /* @__PURE__ */ __name(({
|
|
21
|
-
className,
|
|
22
|
-
...props
|
|
23
|
-
}) => /* @__PURE__ */ jsx(LabelPrimitive.Root, { className: cn(labelVariants(), className), ...props }), "Label");
|
|
24
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
25
|
-
var Form = FormProvider;
|
|
26
|
-
var FormFieldContext = React.createContext(
|
|
27
|
-
{}
|
|
28
|
-
);
|
|
29
|
-
var FormField = /* @__PURE__ */ __name(({
|
|
30
|
-
...props
|
|
31
|
-
}) => {
|
|
32
|
-
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
33
|
-
}, "FormField");
|
|
34
|
-
var useFormField = /* @__PURE__ */ __name(() => {
|
|
35
|
-
const fieldContext = React.useContext(FormFieldContext);
|
|
36
|
-
const itemContext = React.useContext(FormItemContext);
|
|
37
|
-
const { getFieldState, formState } = useFormContext();
|
|
38
|
-
const fieldState = getFieldState(fieldContext.name, formState);
|
|
39
|
-
if (!fieldContext) {
|
|
40
|
-
throw new Error("useFormField should be used within <FormField>");
|
|
41
|
-
}
|
|
42
|
-
const { id } = itemContext;
|
|
43
|
-
return {
|
|
44
|
-
id,
|
|
45
|
-
name: fieldContext.name,
|
|
46
|
-
formItemId: `${id}-form-item`,
|
|
47
|
-
formDescriptionId: `${id}-form-item-description`,
|
|
48
|
-
formMessageId: `${id}-form-item-message`,
|
|
49
|
-
...fieldState
|
|
50
|
-
};
|
|
51
|
-
}, "useFormField");
|
|
52
|
-
var FormItemContext = React.createContext(
|
|
53
|
-
{}
|
|
54
|
-
);
|
|
55
|
-
var FormItem = /* @__PURE__ */ __name(({
|
|
56
|
-
className,
|
|
57
|
-
...props
|
|
58
|
-
}) => {
|
|
59
|
-
const id = React.useId();
|
|
60
|
-
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { className: cn("relative", className), ...props }) });
|
|
61
|
-
}, "FormItem");
|
|
62
|
-
FormItem.displayName = "FormItem";
|
|
63
|
-
var FormLabel = /* @__PURE__ */ __name(({
|
|
64
|
-
className,
|
|
65
|
-
...props
|
|
66
|
-
}) => {
|
|
67
|
-
const { error, formItemId } = useFormField();
|
|
68
|
-
return /* @__PURE__ */ jsx(
|
|
69
|
-
Label,
|
|
70
|
-
{
|
|
71
|
-
className: cn(
|
|
72
|
-
"text-text-secondary pointer-events-none absolute top-3 left-4 flex text-xs leading-tight font-medium transition-all select-none",
|
|
73
|
-
// input
|
|
74
|
-
"peer-placeholder-shown:text-text-tertiary z-[1] peer-placeholder-shown:text-base peer-placeholder-shown:leading-[2.3]",
|
|
75
|
-
"peer-focus:text-text-secondary peer-disabled:peer-placeholder-shown:text-text-tertiary peer-disabled:text-text-tertiary peer-focus:text-xs peer-focus:leading-tight",
|
|
76
|
-
// select
|
|
77
|
-
"peer-data-[placeholder]/select:top-5 peer-data-[placeholder]/select:text-base",
|
|
78
|
-
// adornment
|
|
79
|
-
"peer-[.adornment]/adornment:text-xs",
|
|
80
|
-
error && "text-red-500",
|
|
81
|
-
className
|
|
82
|
-
),
|
|
83
|
-
htmlFor: formItemId,
|
|
84
|
-
...props
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
}, "FormLabel");
|
|
88
|
-
FormLabel.displayName = "FormLabel";
|
|
89
|
-
var FormControl = /* @__PURE__ */ __name(({ ...props }) => {
|
|
90
|
-
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
91
|
-
return /* @__PURE__ */ jsx(
|
|
92
|
-
Slot,
|
|
93
|
-
{
|
|
94
|
-
"aria-describedby": error ? `${formDescriptionId} ${formMessageId}` : `${formDescriptionId}`,
|
|
95
|
-
"aria-invalid": !!error,
|
|
96
|
-
id: formItemId,
|
|
97
|
-
...props
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
}, "FormControl");
|
|
101
|
-
FormControl.displayName = "FormControl";
|
|
102
|
-
var FormDescription = /* @__PURE__ */ __name(({
|
|
103
|
-
className,
|
|
104
|
-
...props
|
|
105
|
-
}) => {
|
|
106
|
-
const { formDescriptionId } = useFormField();
|
|
107
|
-
return /* @__PURE__ */ jsx(
|
|
108
|
-
"p",
|
|
109
|
-
{
|
|
110
|
-
className: cn("text-text-secondary py-1 text-[0.75rem]", className),
|
|
111
|
-
id: formDescriptionId,
|
|
112
|
-
...props
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
}, "FormDescription");
|
|
116
|
-
FormDescription.displayName = "FormDescription";
|
|
117
|
-
var FormMessage = /* @__PURE__ */ __name(({
|
|
118
|
-
className,
|
|
119
|
-
children,
|
|
120
|
-
...props
|
|
121
|
-
}) => {
|
|
122
|
-
const { error, formMessageId } = useFormField();
|
|
123
|
-
const body = error ? String(error?.message) : children;
|
|
124
|
-
if (!body) {
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
return /* @__PURE__ */ jsx(
|
|
128
|
-
"p",
|
|
129
|
-
{
|
|
130
|
-
className: cn(
|
|
131
|
-
"text-red text-[0.75rem] font-medium dark:text-red-900",
|
|
132
|
-
className
|
|
133
|
-
),
|
|
134
|
-
id: formMessageId,
|
|
135
|
-
...props,
|
|
136
|
-
children: body
|
|
137
|
-
}
|
|
138
|
-
);
|
|
139
|
-
}, "FormMessage");
|
|
140
|
-
FormMessage.displayName = "FormMessage";
|
|
141
|
-
|
|
142
|
-
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
2
|
+
import {Slot}from'@radix-ui/react-slot';import*as i from'react';import {useFormContext,FormProvider,Controller}from'react-hook-form';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import*as p from'@radix-ui/react-label';import {cva}from'class-variance-authority';import {jsx}from'react/jsx-runtime';var x=Object.defineProperty;var r=(e,t)=>x(e,"name",{value:t,configurable:true});function l(...e){return twMerge(clsx(e))}r(l,"cn");var C=cva("text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=r(({className:e,...t})=>jsx(p.Root,{className:l(C(),e),...t}),"Label");c.displayName=p.Root.displayName;var q=FormProvider,u=i.createContext({}),G=r(({...e})=>jsx(u.Provider,{value:{name:e.name},children:jsx(Controller,{...e})}),"FormField"),d=r(()=>{let e=i.useContext(u),t=i.useContext(F),{getFieldState:o,formState:a}=useFormContext(),m=o(e.name,a);if(!e)throw new Error("useFormField should be used within <FormField>");let{id:s}=t;return {id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...m}},"useFormField"),F=i.createContext({}),v=r(({className:e,...t})=>{let o=i.useId();return jsx(F.Provider,{value:{id:o},children:jsx("div",{className:l("relative",e),...t})})},"FormItem");v.displayName="FormItem";var L=r(({className:e,...t})=>{let{error:o,formItemId:a}=d();return jsx(c,{className:l("text-text-secondary pointer-events-none absolute top-3 left-4 flex text-xs leading-tight font-medium transition-all select-none","peer-placeholder-shown:text-text-tertiary z-[1] peer-placeholder-shown:text-base peer-placeholder-shown:leading-[2.3]","peer-focus:text-text-secondary peer-disabled:peer-placeholder-shown:text-text-tertiary peer-disabled:text-text-tertiary peer-focus:text-xs peer-focus:leading-tight","peer-data-[placeholder]/select:top-5 peer-data-[placeholder]/select:text-base","peer-[.adornment]/adornment:text-xs",o&&"text-red-500",e),htmlFor:a,...t})},"FormLabel");L.displayName="FormLabel";var R=r(({...e})=>{let{error:t,formItemId:o,formDescriptionId:a,formMessageId:m}=d();return jsx(Slot,{"aria-describedby":t?`${a} ${m}`:`${a}`,"aria-invalid":!!t,id:o,...e})},"FormControl");R.displayName="FormControl";var T=r(({className:e,...t})=>{let{formDescriptionId:o}=d();return jsx("p",{className:l("text-text-secondary py-1 text-[0.75rem]",e),id:o,...t})},"FormDescription");T.displayName="FormDescription";var N=r(({className:e,children:t,...o})=>{let{error:a,formMessageId:m}=d(),s=a?String(a?.message):t;return s?jsx("p",{className:l("text-red text-[0.75rem] font-medium dark:text-red-900",e),id:m,...o,children:s}):null},"FormMessage");N.displayName="FormMessage";export{q as Form,R as FormControl,T as FormDescription,G as FormField,v as FormItem,L as FormLabel,N as FormMessage,d as useFormField};
|
package/dist/hover-card.js
CHANGED
|
@@ -1,58 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var HoverCardPrimitive = require('@radix-ui/react-hover-card');
|
|
5
|
-
var clsx = require('clsx');
|
|
6
|
-
var tailwindMerge = require('tailwind-merge');
|
|
7
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
-
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
if (k !== 'default') {
|
|
15
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return e[k]; }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n.default = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var HoverCardPrimitive__namespace = /*#__PURE__*/_interopNamespace(HoverCardPrimitive);
|
|
28
|
-
|
|
29
|
-
var __defProp = Object.defineProperty;
|
|
30
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
31
|
-
function cn(...inputs) {
|
|
32
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
33
|
-
}
|
|
34
|
-
__name(cn, "cn");
|
|
35
|
-
var HoverCard = HoverCardPrimitive__namespace.Root;
|
|
36
|
-
var HoverCardTrigger = HoverCardPrimitive__namespace.Trigger;
|
|
37
|
-
var HoverCardContent = /* @__PURE__ */ __name(({
|
|
38
|
-
className,
|
|
39
|
-
align = "center",
|
|
40
|
-
sideOffset = 4,
|
|
41
|
-
...props
|
|
42
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
43
|
-
HoverCardPrimitive__namespace.Content,
|
|
44
|
-
{
|
|
45
|
-
align,
|
|
46
|
-
className: cn(
|
|
47
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-bg-dark border-divider z-[1500000000] flex flex-col gap-3 rounded-md border pt-1 shadow-none outline-hidden data-[side=top]:flex-col-reverse",
|
|
48
|
-
className
|
|
49
|
-
),
|
|
50
|
-
sideOffset,
|
|
51
|
-
...props
|
|
52
|
-
}
|
|
53
|
-
), "HoverCardContent");
|
|
54
|
-
HoverCardContent.displayName = HoverCardPrimitive__namespace.Content.displayName;
|
|
55
|
-
|
|
56
|
-
exports.HoverCard = HoverCard;
|
|
57
|
-
exports.HoverCardContent = HoverCardContent;
|
|
58
|
-
exports.HoverCardTrigger = HoverCardTrigger;
|
|
2
|
+
'use strict';var e=require('@radix-ui/react-hover-card'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var e__namespace=/*#__PURE__*/_interopNamespace(e);var d=Object.defineProperty;var o=(t,r)=>d(t,"name",{value:r,configurable:true});function a(...t){return tailwindMerge.twMerge(clsx.clsx(t))}o(a,"cn");var P=e__namespace.Root,H=e__namespace.Trigger,l=o(({className:t,align:r="center",sideOffset:i=4,...n})=>jsxRuntime.jsx(e__namespace.Content,{align:r,className:a("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-bg-dark border-divider z-[1500000000] flex flex-col gap-3 rounded-md border pt-1 shadow-none outline-hidden data-[side=top]:flex-col-reverse",t),sideOffset:i,...n}),"HoverCardContent");l.displayName=e__namespace.Content.displayName;exports.HoverCard=P;exports.HoverCardContent=l;exports.HoverCardTrigger=H;
|