@stevederico/skateboard-ui 3.0.2 → 3.6.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/App.jsx +13 -13
- package/CHANGELOG.md +64 -0
- package/README.md +59 -65
- package/components/AuthOverlay.jsx +4 -4
- package/components/ProtectedRoute.jsx +1 -1
- package/components/ThemeToggle.jsx +1 -1
- package/components/UpgradeSheet.jsx +2 -2
- package/{core → components/core}/DynamicIcon.jsx +1 -1
- package/{layout → components/layout}/Header.jsx +4 -4
- package/{layout → components/layout}/Layout.jsx +1 -1
- package/{layout → components/layout}/Sidebar.jsx +2 -2
- package/{layout → components/layout}/TabBar.jsx +1 -1
- package/{views → components/views}/LandingView.jsx +5 -5
- package/{views → components/views}/NotFound.jsx +2 -2
- package/{views → components/views}/PaymentView.jsx +1 -1
- package/{views → components/views}/SettingsView.jsx +6 -6
- package/{views → components/views}/SignInView.jsx +6 -6
- package/{views → components/views}/SignOutView.jsx +1 -1
- package/{views → components/views}/SignUpView.jsx +6 -6
- package/{views → components/views}/TextView.jsx +3 -3
- package/hooks/useAuthGate.js +1 -1
- package/index.js +1 -1
- package/package.json +32 -50
- package/shadcn/lib/base-ui/LICENSE +21 -0
- package/shadcn/lib/base-ui/_chunk-01rqe37g.js +70 -0
- package/shadcn/lib/base-ui/_chunk-0h5sskyw.js +347 -0
- package/shadcn/lib/base-ui/_chunk-0xhx4g7r.js +57 -0
- package/shadcn/lib/base-ui/_chunk-1e6khrvm.js +218 -0
- package/shadcn/lib/base-ui/_chunk-1s41sngz.js +302 -0
- package/shadcn/lib/base-ui/_chunk-20rtfsz9.js +23 -0
- package/shadcn/lib/base-ui/_chunk-2tyt8f8r.js +6034 -0
- package/shadcn/lib/base-ui/_chunk-3f31ka8n.js +11 -0
- package/shadcn/lib/base-ui/_chunk-3h6zpchb.js +89 -0
- package/shadcn/lib/base-ui/_chunk-4s0k3h7t.js +114 -0
- package/shadcn/lib/base-ui/_chunk-502wngfc.js +598 -0
- package/shadcn/lib/base-ui/_chunk-536jvgeq.js +68 -0
- package/shadcn/lib/base-ui/_chunk-611pz5sm.js +10 -0
- package/shadcn/lib/base-ui/_chunk-65zw5gs2.js +15 -0
- package/shadcn/lib/base-ui/_chunk-6b17g8t7.js +34 -0
- package/shadcn/lib/base-ui/_chunk-6xevjepc.js +15 -0
- package/shadcn/lib/base-ui/_chunk-71zm6zgv.js +16 -0
- package/shadcn/lib/base-ui/_chunk-7fmjymvh.js +32 -0
- package/shadcn/lib/base-ui/_chunk-7jjzay8b.js +176 -0
- package/shadcn/lib/base-ui/_chunk-7v1t86x1.js +43 -0
- package/shadcn/lib/base-ui/_chunk-85vrgzwr.js +227 -0
- package/shadcn/lib/base-ui/_chunk-8jz3hb7q.js +9 -0
- package/shadcn/lib/base-ui/_chunk-8kh3xk78.js +35 -0
- package/shadcn/lib/base-ui/_chunk-97tas84n.js +67 -0
- package/shadcn/lib/base-ui/_chunk-9nyxkvte.js +13 -0
- package/shadcn/lib/base-ui/_chunk-a8fwg9d0.js +52 -0
- package/shadcn/lib/base-ui/_chunk-agc6ew3g.js +29 -0
- package/shadcn/lib/base-ui/_chunk-aqwsk46c.js +64 -0
- package/shadcn/lib/base-ui/_chunk-atd5kq5q.js +803 -0
- package/shadcn/lib/base-ui/_chunk-atnkefgd.js +104 -0
- package/shadcn/lib/base-ui/_chunk-b40erthe.js +7 -0
- package/shadcn/lib/base-ui/_chunk-b5jsqt97.js +50 -0
- package/shadcn/lib/base-ui/_chunk-bk7n9s9e.js +15 -0
- package/shadcn/lib/base-ui/_chunk-c3572b5x.js +19 -0
- package/shadcn/lib/base-ui/_chunk-cwr896nf.js +25 -0
- package/shadcn/lib/base-ui/_chunk-drfb9kp2.js +27 -0
- package/shadcn/lib/base-ui/_chunk-ds8fnpjj.js +0 -0
- package/shadcn/lib/base-ui/_chunk-ek863ta9.js +82 -0
- package/shadcn/lib/base-ui/_chunk-f09cp81f.js +12 -0
- package/shadcn/lib/base-ui/_chunk-f5d01bp9.js +0 -0
- package/shadcn/lib/base-ui/_chunk-f9tgee1q.js +21 -0
- package/shadcn/lib/base-ui/_chunk-fch5cba8.js +84 -0
- package/shadcn/lib/base-ui/_chunk-gfce3j3z.js +18 -0
- package/shadcn/lib/base-ui/_chunk-ha06w2pp.js +2391 -0
- package/shadcn/lib/base-ui/_chunk-hzgetm70.js +23 -0
- package/shadcn/lib/base-ui/_chunk-j0eqdjta.js +39 -0
- package/shadcn/lib/base-ui/_chunk-k1e5fvcj.js +48 -0
- package/shadcn/lib/base-ui/_chunk-k4mc2kan.js +81 -0
- package/shadcn/lib/base-ui/_chunk-kfz96xv1.js +128 -0
- package/shadcn/lib/base-ui/_chunk-m45547cc.js +15 -0
- package/shadcn/lib/base-ui/_chunk-mbn76q14.js +184 -0
- package/shadcn/lib/base-ui/_chunk-mvv30fkv.js +9 -0
- package/shadcn/lib/base-ui/_chunk-mznt6ktj.js +33 -0
- package/shadcn/lib/base-ui/_chunk-n7dnqnbw.js +7 -0
- package/shadcn/lib/base-ui/_chunk-nya71ccw.js +546 -0
- package/shadcn/lib/base-ui/_chunk-p6qynd6r.js +146 -0
- package/shadcn/lib/base-ui/_chunk-q3nee19r.js +323 -0
- package/shadcn/lib/base-ui/_chunk-q7yw9mz4.js +385 -0
- package/shadcn/lib/base-ui/_chunk-qce0xt57.js +107 -0
- package/shadcn/lib/base-ui/_chunk-qgzhcjsj.js +14 -0
- package/shadcn/lib/base-ui/_chunk-qt6r015s.js +38 -0
- package/shadcn/lib/base-ui/_chunk-r0vsdknk.js +4 -0
- package/shadcn/lib/base-ui/_chunk-sx6vkz01.js +150 -0
- package/shadcn/lib/base-ui/_chunk-szcr6mhk.js +6 -0
- package/shadcn/lib/base-ui/_chunk-t7j3rbpv.js +67 -0
- package/shadcn/lib/base-ui/_chunk-tmfmrzwe.js +39 -0
- package/shadcn/lib/base-ui/_chunk-v92ycsfj.js +9 -0
- package/shadcn/lib/base-ui/_chunk-vdc01ss3.js +6 -0
- package/shadcn/lib/base-ui/_chunk-vjbnhhg1.js +26 -0
- package/shadcn/lib/base-ui/_chunk-w68yxg9d.js +21 -0
- package/shadcn/lib/base-ui/_chunk-wana68v3.js +477 -0
- package/shadcn/lib/base-ui/_chunk-wtw745qd.js +12 -0
- package/shadcn/lib/base-ui/_chunk-xb7ph1ka.js +6 -0
- package/shadcn/lib/base-ui/_chunk-xfagb0fq.js +28 -0
- package/shadcn/lib/base-ui/_chunk-xxhqanfd.js +16 -0
- package/shadcn/lib/base-ui/_chunk-y887e46p.js +15 -0
- package/shadcn/lib/base-ui/_chunk-ymj1dpqg.js +14 -0
- package/shadcn/lib/base-ui/accordion.js +650 -0
- package/shadcn/lib/base-ui/alert-dialog.js +138 -0
- package/shadcn/lib/base-ui/avatar.js +235 -0
- package/shadcn/lib/base-ui/button.js +52 -0
- package/shadcn/lib/base-ui/checkbox.js +454 -0
- package/shadcn/lib/base-ui/collapsible.js +283 -0
- package/shadcn/lib/base-ui/context-menu.js +324 -0
- package/shadcn/lib/base-ui/dialog.js +71 -0
- package/shadcn/lib/base-ui/input.js +1028 -0
- package/shadcn/lib/base-ui/menu.js +61 -0
- package/shadcn/lib/base-ui/menubar.js +157 -0
- package/shadcn/lib/base-ui/merge-props.js +15 -0
- package/shadcn/lib/base-ui/navigation-menu.js +1854 -0
- package/shadcn/lib/base-ui/popover.js +1090 -0
- package/shadcn/lib/base-ui/preview-card.js +709 -0
- package/shadcn/lib/base-ui/progress.js +278 -0
- package/shadcn/lib/base-ui/radio-group.js +247 -0
- package/shadcn/lib/base-ui/radio.js +382 -0
- package/shadcn/lib/base-ui/scroll-area.js +1061 -0
- package/shadcn/lib/base-ui/select.js +2438 -0
- package/shadcn/lib/base-ui/separator.js +11 -0
- package/shadcn/lib/base-ui/slider.js +1595 -0
- package/shadcn/lib/base-ui/switch.js +333 -0
- package/shadcn/lib/base-ui/tabs.js +892 -0
- package/shadcn/lib/base-ui/toggle-group.js +152 -0
- package/shadcn/lib/base-ui/toggle.js +133 -0
- package/shadcn/lib/base-ui/tooltip.js +791 -0
- package/shadcn/lib/base-ui/use-render.js +15 -0
- package/shadcn/lib/tailwind-merge.js +3312 -0
- package/shadcn/lib/utils.js +1 -1
- package/shadcn/ui/accordion.jsx +1 -1
- package/shadcn/ui/alert-dialog.jsx +1 -1
- package/shadcn/ui/avatar.jsx +1 -1
- package/shadcn/ui/badge.jsx +2 -2
- package/shadcn/ui/breadcrumb.jsx +2 -2
- package/shadcn/ui/button-group.jsx +2 -2
- package/shadcn/ui/button.jsx +1 -1
- package/shadcn/ui/calendar.jsx +1 -1
- package/shadcn/ui/checkbox.jsx +1 -1
- package/shadcn/ui/collapsible.jsx +1 -1
- package/shadcn/ui/command.jsx +1 -1
- package/shadcn/ui/context-menu.jsx +1 -1
- package/shadcn/ui/dialog.jsx +1 -1
- package/shadcn/ui/drawer.jsx +176 -74
- package/shadcn/ui/dropdown-menu.jsx +1 -1
- package/shadcn/ui/hover-card.jsx +1 -1
- package/shadcn/ui/input.jsx +1 -1
- package/shadcn/ui/item.jsx +2 -2
- package/shadcn/ui/menubar.jsx +2 -2
- package/shadcn/ui/navigation-menu.jsx +1 -1
- package/shadcn/ui/popover.jsx +1 -1
- package/shadcn/ui/progress.jsx +1 -1
- package/shadcn/ui/radio-group.jsx +2 -2
- package/shadcn/ui/scroll-area.jsx +1 -1
- package/shadcn/ui/select.jsx +1 -1
- package/shadcn/ui/separator.jsx +1 -1
- package/shadcn/ui/sheet.jsx +1 -1
- package/shadcn/ui/sidebar.jsx +3 -3
- package/shadcn/ui/slider.jsx +1 -1
- package/shadcn/ui/switch.jsx +1 -1
- package/shadcn/ui/tabs.jsx +1 -1
- package/shadcn/ui/toggle-group.jsx +2 -2
- package/shadcn/ui/toggle.jsx +1 -1
- package/shadcn/ui/tooltip.jsx +1 -1
- package/styles.css +31 -0
- package/MIGRATION.md +0 -230
- package/shadcn/ui/carousel.jsx +0 -195
- package/shadcn/ui/chart.jsx +0 -312
- package/shadcn/ui/resizable.jsx +0 -47
- /package/{core → components/core}/Calendar.jsx +0 -0
- /package/{core → components/core}/Command.jsx +0 -0
- /package/{core → components/core}/Context.jsx +0 -0
- /package/{core → components/core}/ThemeProvider.jsx +0 -0
- /package/{core → components/core}/Utilities.js +0 -0
|
@@ -0,0 +1,1028 @@
|
|
|
1
|
+
/* @base-ui/react 1.4.1 — vendored (MIT — MUI Inc).
|
|
2
|
+
* Refresh: scripts/vendor-base-ui.js (see header for instructions).
|
|
3
|
+
* Do not edit by hand. */
|
|
4
|
+
import {
|
|
5
|
+
useFieldsetRootContext
|
|
6
|
+
} from "./_chunk-c3572b5x.js";
|
|
7
|
+
import {
|
|
8
|
+
useLabel
|
|
9
|
+
} from "./_chunk-fch5cba8.js";
|
|
10
|
+
import {
|
|
11
|
+
useLabelableId
|
|
12
|
+
} from "./_chunk-k4mc2kan.js";
|
|
13
|
+
import"./_chunk-w68yxg9d.js";
|
|
14
|
+
import {
|
|
15
|
+
useCheckboxGroupContext
|
|
16
|
+
} from "./_chunk-bk7n9s9e.js";
|
|
17
|
+
import {
|
|
18
|
+
FieldItemContext
|
|
19
|
+
} from "./_chunk-qgzhcjsj.js";
|
|
20
|
+
import {
|
|
21
|
+
useFormContext,
|
|
22
|
+
useRegisterFieldControl
|
|
23
|
+
} from "./_chunk-97tas84n.js";
|
|
24
|
+
import {
|
|
25
|
+
DEFAULT_VALIDITY_STATE,
|
|
26
|
+
FieldRootContext,
|
|
27
|
+
LabelableContext,
|
|
28
|
+
fieldValidityMapping,
|
|
29
|
+
useFieldRootContext,
|
|
30
|
+
useLabelableContext
|
|
31
|
+
} from "./_chunk-kfz96xv1.js";
|
|
32
|
+
import"./_chunk-ds8fnpjj.js";
|
|
33
|
+
import {
|
|
34
|
+
useControlled
|
|
35
|
+
} from "./_chunk-01rqe37g.js";
|
|
36
|
+
import {
|
|
37
|
+
ownerDocument
|
|
38
|
+
} from "./_chunk-xb7ph1ka.js";
|
|
39
|
+
import {
|
|
40
|
+
activeElement
|
|
41
|
+
} from "./_chunk-atnkefgd.js";
|
|
42
|
+
import"./_chunk-t7j3rbpv.js";
|
|
43
|
+
import {
|
|
44
|
+
useTimeout
|
|
45
|
+
} from "./_chunk-7v1t86x1.js";
|
|
46
|
+
import {
|
|
47
|
+
createChangeEventDetails,
|
|
48
|
+
exports_reason_parts
|
|
49
|
+
} from "./_chunk-4s0k3h7t.js";
|
|
50
|
+
import {
|
|
51
|
+
useBaseUiId
|
|
52
|
+
} from "./_chunk-8kh3xk78.js";
|
|
53
|
+
import {
|
|
54
|
+
transitionStatusMapping,
|
|
55
|
+
useOpenChangeComplete,
|
|
56
|
+
useTransitionStatus
|
|
57
|
+
} from "./_chunk-mbn76q14.js";
|
|
58
|
+
import"./_chunk-v92ycsfj.js";
|
|
59
|
+
import"./_chunk-3h6zpchb.js";
|
|
60
|
+
import"./_chunk-8jz3hb7q.js";
|
|
61
|
+
import {
|
|
62
|
+
error
|
|
63
|
+
} from "./_chunk-71zm6zgv.js";
|
|
64
|
+
import"./_chunk-sx6vkz01.js";
|
|
65
|
+
import {
|
|
66
|
+
SafeReact
|
|
67
|
+
} from "./_chunk-n7dnqnbw.js";
|
|
68
|
+
import {
|
|
69
|
+
useStableCallback
|
|
70
|
+
} from "./_chunk-mznt6ktj.js";
|
|
71
|
+
import {
|
|
72
|
+
useIsoLayoutEffect
|
|
73
|
+
} from "./_chunk-b40erthe.js";
|
|
74
|
+
import {
|
|
75
|
+
EMPTY_OBJECT,
|
|
76
|
+
useRefWithInit,
|
|
77
|
+
useRenderElement
|
|
78
|
+
} from "./_chunk-1s41sngz.js";
|
|
79
|
+
import {
|
|
80
|
+
__export,
|
|
81
|
+
mergeProps
|
|
82
|
+
} from "./_chunk-1e6khrvm.js";
|
|
83
|
+
|
|
84
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/input/Input.js
|
|
85
|
+
import * as React11 from "react";
|
|
86
|
+
|
|
87
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/index.parts.js
|
|
88
|
+
var exports_index_parts = {};
|
|
89
|
+
__export(exports_index_parts, {
|
|
90
|
+
Validity: () => FieldValidity,
|
|
91
|
+
Root: () => FieldRoot,
|
|
92
|
+
Label: () => FieldLabel,
|
|
93
|
+
Item: () => FieldItem,
|
|
94
|
+
Error: () => FieldError,
|
|
95
|
+
Description: () => FieldDescription,
|
|
96
|
+
Control: () => FieldControl
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/root/FieldRoot.js
|
|
100
|
+
import * as React4 from "react";
|
|
101
|
+
|
|
102
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/internals/labelable-provider/LabelableProvider.js
|
|
103
|
+
import * as React from "react";
|
|
104
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
105
|
+
"use client";
|
|
106
|
+
var LabelableProvider = function LabelableProvider2(props) {
|
|
107
|
+
const defaultId = useBaseUiId();
|
|
108
|
+
const initialControlId = props.controlId === undefined ? defaultId : props.controlId;
|
|
109
|
+
const [controlId, setControlIdState] = React.useState(initialControlId);
|
|
110
|
+
const [labelId, setLabelId] = React.useState(props.labelId);
|
|
111
|
+
const [messageIds, setMessageIds] = React.useState([]);
|
|
112
|
+
const registrationsRef = useRefWithInit(() => new Map);
|
|
113
|
+
const {
|
|
114
|
+
messageIds: parentMessageIds
|
|
115
|
+
} = useLabelableContext();
|
|
116
|
+
const registerControlId = useStableCallback((source, nextId) => {
|
|
117
|
+
const registrations = registrationsRef.current;
|
|
118
|
+
if (nextId === undefined) {
|
|
119
|
+
registrations.delete(source);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
registrations.set(source, nextId);
|
|
123
|
+
setControlIdState((prev) => {
|
|
124
|
+
if (registrations.size === 0) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
let nextControlId;
|
|
128
|
+
for (const id of registrations.values()) {
|
|
129
|
+
if (prev !== undefined && id === prev) {
|
|
130
|
+
return prev;
|
|
131
|
+
}
|
|
132
|
+
if (nextControlId === undefined) {
|
|
133
|
+
nextControlId = id;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return nextControlId;
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
const getDescriptionProps = React.useCallback((externalProps) => {
|
|
140
|
+
return mergeProps({
|
|
141
|
+
"aria-describedby": parentMessageIds.concat(messageIds).join(" ") || undefined
|
|
142
|
+
}, externalProps);
|
|
143
|
+
}, [parentMessageIds, messageIds]);
|
|
144
|
+
const contextValue = React.useMemo(() => ({
|
|
145
|
+
controlId,
|
|
146
|
+
registerControlId,
|
|
147
|
+
labelId,
|
|
148
|
+
setLabelId,
|
|
149
|
+
messageIds,
|
|
150
|
+
setMessageIds,
|
|
151
|
+
getDescriptionProps
|
|
152
|
+
}), [controlId, registerControlId, labelId, setLabelId, messageIds, setMessageIds, getDescriptionProps]);
|
|
153
|
+
return /* @__PURE__ */ _jsx(LabelableContext.Provider, {
|
|
154
|
+
value: contextValue,
|
|
155
|
+
children: props.children
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
if (true)
|
|
159
|
+
LabelableProvider.displayName = "LabelableProvider";
|
|
160
|
+
|
|
161
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/root/useFieldValidation.js
|
|
162
|
+
import * as React2 from "react";
|
|
163
|
+
|
|
164
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/utils/getCombinedFieldValidityData.js
|
|
165
|
+
function getCombinedFieldValidityData(validityData, invalid) {
|
|
166
|
+
return {
|
|
167
|
+
...validityData,
|
|
168
|
+
state: {
|
|
169
|
+
...validityData.state,
|
|
170
|
+
valid: !invalid && validityData.state.valid
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/root/useFieldValidation.js
|
|
176
|
+
"use client";
|
|
177
|
+
var validityKeys = Object.keys(DEFAULT_VALIDITY_STATE);
|
|
178
|
+
function isOnlyValueMissing(state) {
|
|
179
|
+
if (!state || state.valid || !state.valueMissing) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
let onlyValueMissing = false;
|
|
183
|
+
for (const key of validityKeys) {
|
|
184
|
+
if (key === "valid") {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (key === "valueMissing") {
|
|
188
|
+
onlyValueMissing = state[key];
|
|
189
|
+
}
|
|
190
|
+
if (state[key]) {
|
|
191
|
+
onlyValueMissing = false;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return onlyValueMissing;
|
|
195
|
+
}
|
|
196
|
+
function useFieldValidation(params) {
|
|
197
|
+
const {
|
|
198
|
+
formRef,
|
|
199
|
+
clearErrors
|
|
200
|
+
} = useFormContext();
|
|
201
|
+
const {
|
|
202
|
+
setValidityData,
|
|
203
|
+
validate,
|
|
204
|
+
validityData,
|
|
205
|
+
validationDebounceTime,
|
|
206
|
+
invalid,
|
|
207
|
+
markedDirtyRef,
|
|
208
|
+
state,
|
|
209
|
+
name,
|
|
210
|
+
shouldValidateOnChange
|
|
211
|
+
} = params;
|
|
212
|
+
const {
|
|
213
|
+
controlId,
|
|
214
|
+
getDescriptionProps
|
|
215
|
+
} = useLabelableContext();
|
|
216
|
+
const timeout = useTimeout();
|
|
217
|
+
const inputRef = React2.useRef(null);
|
|
218
|
+
const commit = useStableCallback(async (value, revalidate = false) => {
|
|
219
|
+
const element = inputRef.current;
|
|
220
|
+
if (!element) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (revalidate) {
|
|
224
|
+
if (state.valid !== false) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const currentNativeValidity = element.validity;
|
|
228
|
+
if (!currentNativeValidity.valueMissing) {
|
|
229
|
+
const nextValidityData2 = {
|
|
230
|
+
value,
|
|
231
|
+
state: {
|
|
232
|
+
...DEFAULT_VALIDITY_STATE,
|
|
233
|
+
valid: true
|
|
234
|
+
},
|
|
235
|
+
error: "",
|
|
236
|
+
errors: [],
|
|
237
|
+
initialValue: validityData.initialValue
|
|
238
|
+
};
|
|
239
|
+
element.setCustomValidity("");
|
|
240
|
+
if (controlId) {
|
|
241
|
+
const currentFieldData = formRef.current.fields.get(controlId);
|
|
242
|
+
if (currentFieldData) {
|
|
243
|
+
formRef.current.fields.set(controlId, {
|
|
244
|
+
...currentFieldData,
|
|
245
|
+
...getCombinedFieldValidityData(nextValidityData2, false)
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
setValidityData(nextValidityData2);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const currentNativeValidityObject = validityKeys.reduce((acc, key) => {
|
|
253
|
+
acc[key] = currentNativeValidity[key];
|
|
254
|
+
return acc;
|
|
255
|
+
}, {});
|
|
256
|
+
if (!currentNativeValidityObject.valid && !isOnlyValueMissing(currentNativeValidityObject)) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function getState(el) {
|
|
261
|
+
const computedState = validityKeys.reduce((acc, key) => {
|
|
262
|
+
acc[key] = el.validity[key];
|
|
263
|
+
return acc;
|
|
264
|
+
}, {});
|
|
265
|
+
let hasOnlyValueMissingError = false;
|
|
266
|
+
for (const key of validityKeys) {
|
|
267
|
+
if (key === "valid") {
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (key === "valueMissing" && computedState[key]) {
|
|
271
|
+
hasOnlyValueMissingError = true;
|
|
272
|
+
} else if (computedState[key]) {
|
|
273
|
+
return computedState;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
if (hasOnlyValueMissingError && !markedDirtyRef.current) {
|
|
277
|
+
computedState.valid = true;
|
|
278
|
+
computedState.valueMissing = false;
|
|
279
|
+
}
|
|
280
|
+
return computedState;
|
|
281
|
+
}
|
|
282
|
+
timeout.clear();
|
|
283
|
+
let result = null;
|
|
284
|
+
let validationErrors = [];
|
|
285
|
+
const nextState = getState(element);
|
|
286
|
+
let defaultValidationMessage;
|
|
287
|
+
const validateOnChange = shouldValidateOnChange();
|
|
288
|
+
if (element.validationMessage && !validateOnChange) {
|
|
289
|
+
defaultValidationMessage = element.validationMessage;
|
|
290
|
+
validationErrors = [element.validationMessage];
|
|
291
|
+
} else {
|
|
292
|
+
const formValues = Array.from(formRef.current.fields.values()).reduce((acc, field) => {
|
|
293
|
+
if (field.name) {
|
|
294
|
+
acc[field.name] = field.getValue();
|
|
295
|
+
}
|
|
296
|
+
return acc;
|
|
297
|
+
}, {});
|
|
298
|
+
const resultOrPromise = validate(value, formValues);
|
|
299
|
+
if (typeof resultOrPromise === "object" && resultOrPromise !== null && "then" in resultOrPromise) {
|
|
300
|
+
result = await resultOrPromise;
|
|
301
|
+
} else {
|
|
302
|
+
result = resultOrPromise;
|
|
303
|
+
}
|
|
304
|
+
if (result !== null) {
|
|
305
|
+
nextState.valid = false;
|
|
306
|
+
nextState.customError = true;
|
|
307
|
+
if (Array.isArray(result)) {
|
|
308
|
+
validationErrors = result;
|
|
309
|
+
element.setCustomValidity(result.join(`
|
|
310
|
+
`));
|
|
311
|
+
} else if (result) {
|
|
312
|
+
validationErrors = [result];
|
|
313
|
+
element.setCustomValidity(result);
|
|
314
|
+
}
|
|
315
|
+
} else if (validateOnChange) {
|
|
316
|
+
element.setCustomValidity("");
|
|
317
|
+
nextState.customError = false;
|
|
318
|
+
if (element.validationMessage) {
|
|
319
|
+
defaultValidationMessage = element.validationMessage;
|
|
320
|
+
validationErrors = [element.validationMessage];
|
|
321
|
+
} else if (element.validity.valid && !nextState.valid) {
|
|
322
|
+
nextState.valid = true;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const nextValidityData = {
|
|
327
|
+
value,
|
|
328
|
+
state: nextState,
|
|
329
|
+
error: defaultValidationMessage ?? (Array.isArray(result) ? result[0] : result ?? ""),
|
|
330
|
+
errors: validationErrors,
|
|
331
|
+
initialValue: validityData.initialValue
|
|
332
|
+
};
|
|
333
|
+
if (controlId) {
|
|
334
|
+
const currentFieldData = formRef.current.fields.get(controlId);
|
|
335
|
+
if (currentFieldData) {
|
|
336
|
+
formRef.current.fields.set(controlId, {
|
|
337
|
+
...currentFieldData,
|
|
338
|
+
...getCombinedFieldValidityData(nextValidityData, invalid)
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
setValidityData(nextValidityData);
|
|
343
|
+
});
|
|
344
|
+
const getValidationProps = React2.useCallback((externalProps = {}) => mergeProps(getDescriptionProps, state.valid === false ? {
|
|
345
|
+
"aria-invalid": true
|
|
346
|
+
} : EMPTY_OBJECT, externalProps), [getDescriptionProps, state.valid]);
|
|
347
|
+
const getInputValidationProps = React2.useCallback((externalProps = {}) => mergeProps({
|
|
348
|
+
onChange(event) {
|
|
349
|
+
if (event.nativeEvent.defaultPrevented) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
clearErrors(name);
|
|
353
|
+
if (!shouldValidateOnChange()) {
|
|
354
|
+
commit(event.currentTarget.value, true);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const element = event.currentTarget;
|
|
358
|
+
if (element.value === "") {
|
|
359
|
+
commit(element.value);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
timeout.clear();
|
|
363
|
+
if (validationDebounceTime) {
|
|
364
|
+
timeout.start(validationDebounceTime, () => {
|
|
365
|
+
commit(element.value);
|
|
366
|
+
});
|
|
367
|
+
} else {
|
|
368
|
+
commit(element.value);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}, getValidationProps(externalProps)), [getValidationProps, clearErrors, name, timeout, commit, validationDebounceTime, shouldValidateOnChange]);
|
|
372
|
+
return React2.useMemo(() => ({
|
|
373
|
+
getValidationProps,
|
|
374
|
+
getInputValidationProps,
|
|
375
|
+
inputRef,
|
|
376
|
+
commit
|
|
377
|
+
}), [getValidationProps, getInputValidationProps, commit]);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/internals/field-register-control/useFieldControlRegistration.js
|
|
381
|
+
import * as React3 from "react";
|
|
382
|
+
import * as ReactDOM from "react-dom";
|
|
383
|
+
"use client";
|
|
384
|
+
function useFieldControlRegistration(params) {
|
|
385
|
+
const {
|
|
386
|
+
commit,
|
|
387
|
+
invalid,
|
|
388
|
+
markedDirtyRef,
|
|
389
|
+
name,
|
|
390
|
+
setValidityData,
|
|
391
|
+
validityData
|
|
392
|
+
} = params;
|
|
393
|
+
const {
|
|
394
|
+
formRef
|
|
395
|
+
} = useFormContext();
|
|
396
|
+
const activeFieldControlSourceRef = React3.useRef(null);
|
|
397
|
+
const registrationRef = React3.useRef(null);
|
|
398
|
+
const fallbackControlRef = React3.useRef(null);
|
|
399
|
+
const getValue = useStableCallback(() => {
|
|
400
|
+
const registration = registrationRef.current;
|
|
401
|
+
if (!registration) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (registration.getValue) {
|
|
405
|
+
return registration.getValue();
|
|
406
|
+
}
|
|
407
|
+
return registration.value;
|
|
408
|
+
});
|
|
409
|
+
const validate = useStableCallback((flushSync2 = true) => {
|
|
410
|
+
const registration = registrationRef.current;
|
|
411
|
+
if (!registration) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
let nextValue = registration.value;
|
|
415
|
+
if (nextValue === undefined) {
|
|
416
|
+
nextValue = getValue();
|
|
417
|
+
}
|
|
418
|
+
markedDirtyRef.current = true;
|
|
419
|
+
if (!flushSync2) {
|
|
420
|
+
commit(nextValue);
|
|
421
|
+
} else {
|
|
422
|
+
ReactDOM.flushSync(() => commit(nextValue));
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
function refreshRegistration() {
|
|
426
|
+
const registration = registrationRef.current;
|
|
427
|
+
if (!registration || !registration.id) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
formRef.current.fields.set(registration.id, {
|
|
431
|
+
getValue,
|
|
432
|
+
name,
|
|
433
|
+
controlRef: registration.controlRef ?? fallbackControlRef,
|
|
434
|
+
validityData: getCombinedFieldValidityData(validityData, invalid),
|
|
435
|
+
validate
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
function deleteRegistration(id = registrationRef.current?.id) {
|
|
439
|
+
if (id) {
|
|
440
|
+
formRef.current.fields.delete(id);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
function syncInitialValue() {
|
|
444
|
+
const registration = registrationRef.current;
|
|
445
|
+
if (!registration) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
let initialValue = registration.value;
|
|
449
|
+
if (initialValue === undefined) {
|
|
450
|
+
initialValue = getValue();
|
|
451
|
+
}
|
|
452
|
+
if (validityData.initialValue === null && initialValue !== null) {
|
|
453
|
+
setValidityData((prev) => ({
|
|
454
|
+
...prev,
|
|
455
|
+
initialValue
|
|
456
|
+
}));
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
useIsoLayoutEffect(() => {
|
|
460
|
+
const registration = registrationRef.current;
|
|
461
|
+
if (!registration || !registration.id) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
formRef.current.fields.set(registration.id, {
|
|
465
|
+
getValue,
|
|
466
|
+
name,
|
|
467
|
+
controlRef: registration.controlRef ?? fallbackControlRef,
|
|
468
|
+
validityData: getCombinedFieldValidityData(validityData, invalid),
|
|
469
|
+
validate
|
|
470
|
+
});
|
|
471
|
+
}, [formRef, getValue, invalid, name, validate, validityData]);
|
|
472
|
+
useIsoLayoutEffect(() => {
|
|
473
|
+
const fields = formRef.current.fields;
|
|
474
|
+
return () => {
|
|
475
|
+
const id = registrationRef.current?.id;
|
|
476
|
+
if (id) {
|
|
477
|
+
fields.delete(id);
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
}, [formRef]);
|
|
481
|
+
return useStableCallback((source, registration) => {
|
|
482
|
+
if (!registration) {
|
|
483
|
+
if (activeFieldControlSourceRef.current === source) {
|
|
484
|
+
activeFieldControlSourceRef.current = null;
|
|
485
|
+
deleteRegistration();
|
|
486
|
+
registrationRef.current = null;
|
|
487
|
+
}
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
const previousId = registrationRef.current?.id;
|
|
491
|
+
activeFieldControlSourceRef.current = source;
|
|
492
|
+
registrationRef.current = registration;
|
|
493
|
+
if (previousId && previousId !== registration.id) {
|
|
494
|
+
deleteRegistration(previousId);
|
|
495
|
+
}
|
|
496
|
+
syncInitialValue();
|
|
497
|
+
refreshRegistration();
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/root/FieldRoot.js
|
|
502
|
+
import { jsx as _jsx2 } from "react/jsx-runtime";
|
|
503
|
+
"use client";
|
|
504
|
+
var FieldRootInner = /* @__PURE__ */ React4.forwardRef(function FieldRootInner2(componentProps, forwardedRef) {
|
|
505
|
+
const {
|
|
506
|
+
errors,
|
|
507
|
+
validationMode: formValidationMode,
|
|
508
|
+
submitAttemptedRef
|
|
509
|
+
} = useFormContext();
|
|
510
|
+
const {
|
|
511
|
+
render,
|
|
512
|
+
className,
|
|
513
|
+
validate: validateProp,
|
|
514
|
+
validationDebounceTime = 0,
|
|
515
|
+
validationMode = formValidationMode,
|
|
516
|
+
name,
|
|
517
|
+
disabled: disabledProp = false,
|
|
518
|
+
invalid: invalidProp,
|
|
519
|
+
dirty: dirtyProp,
|
|
520
|
+
touched: touchedProp,
|
|
521
|
+
actionsRef,
|
|
522
|
+
style,
|
|
523
|
+
...elementProps
|
|
524
|
+
} = componentProps;
|
|
525
|
+
const {
|
|
526
|
+
disabled: disabledFieldset
|
|
527
|
+
} = useFieldsetRootContext();
|
|
528
|
+
const validate = useStableCallback(validateProp || (() => null));
|
|
529
|
+
const disabled = disabledFieldset || disabledProp;
|
|
530
|
+
const [touchedState, setTouchedUnwrapped] = React4.useState(false);
|
|
531
|
+
const [dirtyState, setDirtyUnwrapped] = React4.useState(false);
|
|
532
|
+
const [filled, setFilled] = React4.useState(false);
|
|
533
|
+
const [focused, setFocused] = React4.useState(false);
|
|
534
|
+
const dirty = dirtyProp ?? dirtyState;
|
|
535
|
+
const touched = touchedProp ?? touchedState;
|
|
536
|
+
const markedDirtyRef = React4.useRef(false);
|
|
537
|
+
const setDirty = useStableCallback((value) => {
|
|
538
|
+
if (dirtyProp !== undefined) {
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
if (value) {
|
|
542
|
+
markedDirtyRef.current = true;
|
|
543
|
+
}
|
|
544
|
+
setDirtyUnwrapped(value);
|
|
545
|
+
});
|
|
546
|
+
const setTouched = useStableCallback((value) => {
|
|
547
|
+
if (touchedProp !== undefined) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
setTouchedUnwrapped(value);
|
|
551
|
+
});
|
|
552
|
+
const shouldValidateOnChange = useStableCallback(() => validationMode === "onChange" || validationMode === "onSubmit" && submitAttemptedRef.current);
|
|
553
|
+
const hasFormError = !!name && Object.hasOwn(errors, name) && errors[name] !== undefined;
|
|
554
|
+
const invalid = invalidProp === true || hasFormError;
|
|
555
|
+
const [validityData, setValidityData] = React4.useState({
|
|
556
|
+
state: DEFAULT_VALIDITY_STATE,
|
|
557
|
+
error: "",
|
|
558
|
+
errors: [],
|
|
559
|
+
value: null,
|
|
560
|
+
initialValue: null
|
|
561
|
+
});
|
|
562
|
+
const valid = !invalid && validityData.state.valid;
|
|
563
|
+
const state = React4.useMemo(() => ({
|
|
564
|
+
disabled,
|
|
565
|
+
touched,
|
|
566
|
+
dirty,
|
|
567
|
+
valid,
|
|
568
|
+
filled,
|
|
569
|
+
focused
|
|
570
|
+
}), [disabled, touched, dirty, valid, filled, focused]);
|
|
571
|
+
const validation = useFieldValidation({
|
|
572
|
+
setValidityData,
|
|
573
|
+
validate,
|
|
574
|
+
validityData,
|
|
575
|
+
validationDebounceTime,
|
|
576
|
+
invalid,
|
|
577
|
+
markedDirtyRef,
|
|
578
|
+
state,
|
|
579
|
+
name,
|
|
580
|
+
shouldValidateOnChange
|
|
581
|
+
});
|
|
582
|
+
const handleImperativeValidate = React4.useCallback(() => {
|
|
583
|
+
markedDirtyRef.current = true;
|
|
584
|
+
validation.commit(validityData.value);
|
|
585
|
+
}, [validation, validityData]);
|
|
586
|
+
const registerFieldControl = useFieldControlRegistration({
|
|
587
|
+
commit: validation.commit,
|
|
588
|
+
invalid,
|
|
589
|
+
markedDirtyRef,
|
|
590
|
+
name,
|
|
591
|
+
setValidityData,
|
|
592
|
+
validityData
|
|
593
|
+
});
|
|
594
|
+
React4.useImperativeHandle(actionsRef, () => ({
|
|
595
|
+
validate: handleImperativeValidate
|
|
596
|
+
}), [handleImperativeValidate]);
|
|
597
|
+
const contextValue = React4.useMemo(() => ({
|
|
598
|
+
invalid,
|
|
599
|
+
name,
|
|
600
|
+
validityData,
|
|
601
|
+
setValidityData,
|
|
602
|
+
disabled,
|
|
603
|
+
touched,
|
|
604
|
+
setTouched,
|
|
605
|
+
dirty,
|
|
606
|
+
setDirty,
|
|
607
|
+
filled,
|
|
608
|
+
setFilled,
|
|
609
|
+
focused,
|
|
610
|
+
setFocused,
|
|
611
|
+
validate,
|
|
612
|
+
validationMode,
|
|
613
|
+
validationDebounceTime,
|
|
614
|
+
shouldValidateOnChange,
|
|
615
|
+
state,
|
|
616
|
+
markedDirtyRef,
|
|
617
|
+
registerFieldControl,
|
|
618
|
+
validation
|
|
619
|
+
}), [invalid, name, validityData, disabled, touched, setTouched, dirty, setDirty, filled, setFilled, focused, setFocused, validate, validationMode, validationDebounceTime, shouldValidateOnChange, state, registerFieldControl, validation]);
|
|
620
|
+
const element = useRenderElement("div", componentProps, {
|
|
621
|
+
ref: forwardedRef,
|
|
622
|
+
state,
|
|
623
|
+
props: elementProps,
|
|
624
|
+
stateAttributesMapping: fieldValidityMapping
|
|
625
|
+
});
|
|
626
|
+
return /* @__PURE__ */ _jsx2(FieldRootContext.Provider, {
|
|
627
|
+
value: contextValue,
|
|
628
|
+
children: element
|
|
629
|
+
});
|
|
630
|
+
});
|
|
631
|
+
if (true)
|
|
632
|
+
FieldRootInner.displayName = "FieldRootInner";
|
|
633
|
+
var FieldRoot = /* @__PURE__ */ React4.forwardRef(function FieldRoot2(componentProps, forwardedRef) {
|
|
634
|
+
return /* @__PURE__ */ _jsx2(LabelableProvider, {
|
|
635
|
+
children: /* @__PURE__ */ _jsx2(FieldRootInner, {
|
|
636
|
+
...componentProps,
|
|
637
|
+
ref: forwardedRef
|
|
638
|
+
})
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
if (true)
|
|
642
|
+
FieldRoot.displayName = "FieldRoot";
|
|
643
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/label/FieldLabel.js
|
|
644
|
+
import * as React5 from "react";
|
|
645
|
+
"use client";
|
|
646
|
+
var FieldLabel = /* @__PURE__ */ React5.forwardRef(function FieldLabel2(componentProps, forwardedRef) {
|
|
647
|
+
const {
|
|
648
|
+
render,
|
|
649
|
+
className,
|
|
650
|
+
style,
|
|
651
|
+
id: idProp,
|
|
652
|
+
nativeLabel = true,
|
|
653
|
+
...elementProps
|
|
654
|
+
} = componentProps;
|
|
655
|
+
const fieldRootContext = useFieldRootContext(false);
|
|
656
|
+
const {
|
|
657
|
+
labelId
|
|
658
|
+
} = useLabelableContext();
|
|
659
|
+
const labelRef = React5.useRef(null);
|
|
660
|
+
const labelProps = useLabel({
|
|
661
|
+
id: labelId ?? idProp,
|
|
662
|
+
native: nativeLabel
|
|
663
|
+
});
|
|
664
|
+
if (true) {
|
|
665
|
+
React5.useEffect(() => {
|
|
666
|
+
if (!labelRef.current) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
const isLabelTag = labelRef.current.tagName === "LABEL";
|
|
670
|
+
if (nativeLabel) {
|
|
671
|
+
if (!isLabelTag) {
|
|
672
|
+
const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
|
|
673
|
+
const message = "<Field.Label> expected a <label> element because the `nativeLabel` prop is true. " + "Rendering a non-<label> disables native label association, so `htmlFor` will not " + "work. Use a real <label> in the `render` prop, or set `nativeLabel` to `false`.";
|
|
674
|
+
error(`${message}${ownerStackMessage}`);
|
|
675
|
+
}
|
|
676
|
+
} else if (isLabelTag) {
|
|
677
|
+
const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
|
|
678
|
+
const message = "<Field.Label> expected a non-<label> element because the `nativeLabel` prop is false. " + "Rendering a <label> assumes native label behavior while Base UI treats it as " + "non-native, which can cause unexpected pointer behavior. Use a non-<label> in the " + "`render` prop, or set `nativeLabel` to `true`.";
|
|
679
|
+
error(`${message}${ownerStackMessage}`);
|
|
680
|
+
}
|
|
681
|
+
}, [nativeLabel]);
|
|
682
|
+
}
|
|
683
|
+
const element = useRenderElement("label", componentProps, {
|
|
684
|
+
ref: [forwardedRef, labelRef],
|
|
685
|
+
state: fieldRootContext.state,
|
|
686
|
+
props: [labelProps, elementProps],
|
|
687
|
+
stateAttributesMapping: fieldValidityMapping
|
|
688
|
+
});
|
|
689
|
+
return element;
|
|
690
|
+
});
|
|
691
|
+
if (true)
|
|
692
|
+
FieldLabel.displayName = "FieldLabel";
|
|
693
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/error/FieldError.js
|
|
694
|
+
import * as React6 from "react";
|
|
695
|
+
import { jsx as _jsx3 } from "react/jsx-runtime";
|
|
696
|
+
"use client";
|
|
697
|
+
var stateAttributesMapping = {
|
|
698
|
+
...fieldValidityMapping,
|
|
699
|
+
...transitionStatusMapping
|
|
700
|
+
};
|
|
701
|
+
var FieldError = /* @__PURE__ */ React6.forwardRef(function FieldError2(componentProps, forwardedRef) {
|
|
702
|
+
const {
|
|
703
|
+
render,
|
|
704
|
+
id: idProp,
|
|
705
|
+
className,
|
|
706
|
+
match,
|
|
707
|
+
style,
|
|
708
|
+
...elementProps
|
|
709
|
+
} = componentProps;
|
|
710
|
+
const id = useBaseUiId(idProp);
|
|
711
|
+
const {
|
|
712
|
+
validityData,
|
|
713
|
+
state: fieldState,
|
|
714
|
+
name
|
|
715
|
+
} = useFieldRootContext(false);
|
|
716
|
+
const {
|
|
717
|
+
setMessageIds
|
|
718
|
+
} = useLabelableContext();
|
|
719
|
+
const {
|
|
720
|
+
errors
|
|
721
|
+
} = useFormContext();
|
|
722
|
+
const formError = name ? errors[name] : null;
|
|
723
|
+
const hasSpecificMatch = typeof match === "string";
|
|
724
|
+
let rendered = false;
|
|
725
|
+
if (match === true) {
|
|
726
|
+
rendered = true;
|
|
727
|
+
} else if (hasSpecificMatch) {
|
|
728
|
+
rendered = Boolean(validityData.state[match]);
|
|
729
|
+
} else {
|
|
730
|
+
rendered = Boolean(formError) || validityData.state.valid === false;
|
|
731
|
+
}
|
|
732
|
+
const {
|
|
733
|
+
mounted,
|
|
734
|
+
transitionStatus,
|
|
735
|
+
setMounted
|
|
736
|
+
} = useTransitionStatus(rendered);
|
|
737
|
+
useIsoLayoutEffect(() => {
|
|
738
|
+
if (!rendered || !id) {
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
setMessageIds((v) => v.concat(id));
|
|
742
|
+
return () => {
|
|
743
|
+
setMessageIds((v) => v.filter((item) => item !== id));
|
|
744
|
+
};
|
|
745
|
+
}, [rendered, id, setMessageIds]);
|
|
746
|
+
const errorRef = React6.useRef(null);
|
|
747
|
+
const [lastRenderedMessage, setLastRenderedMessage] = React6.useState(null);
|
|
748
|
+
const [lastRenderedMessageKey, setLastRenderedMessageKey] = React6.useState(null);
|
|
749
|
+
const clientErrorMessage = validityData.errors.length > 1 ? /* @__PURE__ */ _jsx3("ul", {
|
|
750
|
+
children: validityData.errors.map((message) => /* @__PURE__ */ _jsx3("li", {
|
|
751
|
+
children: message
|
|
752
|
+
}, message))
|
|
753
|
+
}) : validityData.error;
|
|
754
|
+
const errorMessage = hasSpecificMatch ? clientErrorMessage : formError || clientErrorMessage;
|
|
755
|
+
let errorKey = validityData.error;
|
|
756
|
+
if (formError != null) {
|
|
757
|
+
errorKey = Array.isArray(formError) ? JSON.stringify(formError) : formError;
|
|
758
|
+
} else if (validityData.errors.length > 1) {
|
|
759
|
+
errorKey = JSON.stringify(validityData.errors);
|
|
760
|
+
}
|
|
761
|
+
if (rendered && errorKey !== lastRenderedMessageKey) {
|
|
762
|
+
setLastRenderedMessageKey(errorKey);
|
|
763
|
+
setLastRenderedMessage(errorMessage);
|
|
764
|
+
}
|
|
765
|
+
useOpenChangeComplete({
|
|
766
|
+
open: rendered,
|
|
767
|
+
ref: errorRef,
|
|
768
|
+
onComplete() {
|
|
769
|
+
if (!rendered) {
|
|
770
|
+
setMounted(false);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
const state = {
|
|
775
|
+
...fieldState,
|
|
776
|
+
transitionStatus
|
|
777
|
+
};
|
|
778
|
+
const element = useRenderElement("div", componentProps, {
|
|
779
|
+
ref: [forwardedRef, errorRef],
|
|
780
|
+
state,
|
|
781
|
+
props: [{
|
|
782
|
+
id,
|
|
783
|
+
children: rendered ? errorMessage : lastRenderedMessage
|
|
784
|
+
}, elementProps],
|
|
785
|
+
stateAttributesMapping,
|
|
786
|
+
enabled: mounted
|
|
787
|
+
});
|
|
788
|
+
if (!mounted) {
|
|
789
|
+
return null;
|
|
790
|
+
}
|
|
791
|
+
return element;
|
|
792
|
+
});
|
|
793
|
+
if (true)
|
|
794
|
+
FieldError.displayName = "FieldError";
|
|
795
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/description/FieldDescription.js
|
|
796
|
+
import * as React7 from "react";
|
|
797
|
+
"use client";
|
|
798
|
+
var FieldDescription = /* @__PURE__ */ React7.forwardRef(function FieldDescription2(componentProps, forwardedRef) {
|
|
799
|
+
const {
|
|
800
|
+
render,
|
|
801
|
+
id: idProp,
|
|
802
|
+
className,
|
|
803
|
+
style,
|
|
804
|
+
...elementProps
|
|
805
|
+
} = componentProps;
|
|
806
|
+
const id = useBaseUiId(idProp);
|
|
807
|
+
const fieldRootContext = useFieldRootContext(false);
|
|
808
|
+
const {
|
|
809
|
+
setMessageIds
|
|
810
|
+
} = useLabelableContext();
|
|
811
|
+
useIsoLayoutEffect(() => {
|
|
812
|
+
if (!id) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
setMessageIds((v) => v.concat(id));
|
|
816
|
+
return () => {
|
|
817
|
+
setMessageIds((v) => v.filter((item) => item !== id));
|
|
818
|
+
};
|
|
819
|
+
}, [id, setMessageIds]);
|
|
820
|
+
const element = useRenderElement("p", componentProps, {
|
|
821
|
+
ref: forwardedRef,
|
|
822
|
+
state: fieldRootContext.state,
|
|
823
|
+
props: [{
|
|
824
|
+
id
|
|
825
|
+
}, elementProps],
|
|
826
|
+
stateAttributesMapping: fieldValidityMapping
|
|
827
|
+
});
|
|
828
|
+
return element;
|
|
829
|
+
});
|
|
830
|
+
if (true)
|
|
831
|
+
FieldDescription.displayName = "FieldDescription";
|
|
832
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/control/FieldControl.js
|
|
833
|
+
import * as React8 from "react";
|
|
834
|
+
"use client";
|
|
835
|
+
var FieldControl = /* @__PURE__ */ React8.forwardRef(function FieldControl2(componentProps, forwardedRef) {
|
|
836
|
+
const {
|
|
837
|
+
render,
|
|
838
|
+
className,
|
|
839
|
+
id: idProp,
|
|
840
|
+
name: nameProp,
|
|
841
|
+
value: valueProp,
|
|
842
|
+
disabled: disabledProp = false,
|
|
843
|
+
onValueChange,
|
|
844
|
+
defaultValue,
|
|
845
|
+
autoFocus = false,
|
|
846
|
+
style,
|
|
847
|
+
...elementProps
|
|
848
|
+
} = componentProps;
|
|
849
|
+
const {
|
|
850
|
+
state: fieldState,
|
|
851
|
+
name: fieldName,
|
|
852
|
+
disabled: fieldDisabled,
|
|
853
|
+
setTouched,
|
|
854
|
+
setDirty,
|
|
855
|
+
validityData,
|
|
856
|
+
setFocused,
|
|
857
|
+
setFilled,
|
|
858
|
+
validationMode,
|
|
859
|
+
validation
|
|
860
|
+
} = useFieldRootContext();
|
|
861
|
+
const disabled = fieldDisabled || disabledProp;
|
|
862
|
+
const name = fieldName ?? nameProp;
|
|
863
|
+
const state = {
|
|
864
|
+
...fieldState,
|
|
865
|
+
disabled
|
|
866
|
+
};
|
|
867
|
+
const {
|
|
868
|
+
labelId
|
|
869
|
+
} = useLabelableContext();
|
|
870
|
+
const id = useLabelableId({
|
|
871
|
+
id: idProp
|
|
872
|
+
});
|
|
873
|
+
useIsoLayoutEffect(() => {
|
|
874
|
+
const hasExternalValue = valueProp != null;
|
|
875
|
+
if (validation.inputRef.current?.value || hasExternalValue && valueProp !== "") {
|
|
876
|
+
setFilled(true);
|
|
877
|
+
} else if (hasExternalValue && valueProp === "") {
|
|
878
|
+
setFilled(false);
|
|
879
|
+
}
|
|
880
|
+
}, [validation.inputRef, setFilled, valueProp]);
|
|
881
|
+
const inputRef = React8.useRef(null);
|
|
882
|
+
useIsoLayoutEffect(() => {
|
|
883
|
+
if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) {
|
|
884
|
+
setFocused(true);
|
|
885
|
+
}
|
|
886
|
+
}, [autoFocus, setFocused]);
|
|
887
|
+
const [valueUnwrapped] = useControlled({
|
|
888
|
+
controlled: valueProp,
|
|
889
|
+
default: defaultValue,
|
|
890
|
+
name: "FieldControl",
|
|
891
|
+
state: "value"
|
|
892
|
+
});
|
|
893
|
+
const isControlled = valueProp !== undefined;
|
|
894
|
+
const value = isControlled ? valueUnwrapped : undefined;
|
|
895
|
+
const getFieldValue = useStableCallback(() => validation.inputRef.current?.value);
|
|
896
|
+
useRegisterFieldControl(validation.inputRef, {
|
|
897
|
+
id,
|
|
898
|
+
value,
|
|
899
|
+
getValue: getFieldValue
|
|
900
|
+
});
|
|
901
|
+
const element = useRenderElement("input", componentProps, {
|
|
902
|
+
ref: [forwardedRef, inputRef],
|
|
903
|
+
state,
|
|
904
|
+
props: [{
|
|
905
|
+
id,
|
|
906
|
+
disabled,
|
|
907
|
+
name,
|
|
908
|
+
ref: validation.inputRef,
|
|
909
|
+
"aria-labelledby": labelId,
|
|
910
|
+
autoFocus,
|
|
911
|
+
...isControlled ? {
|
|
912
|
+
value
|
|
913
|
+
} : {
|
|
914
|
+
defaultValue
|
|
915
|
+
},
|
|
916
|
+
onChange(event) {
|
|
917
|
+
const inputValue = event.currentTarget.value;
|
|
918
|
+
onValueChange?.(inputValue, createChangeEventDetails(exports_reason_parts.none, event.nativeEvent));
|
|
919
|
+
setDirty(inputValue !== validityData.initialValue);
|
|
920
|
+
setFilled(inputValue !== "");
|
|
921
|
+
},
|
|
922
|
+
onFocus() {
|
|
923
|
+
setFocused(true);
|
|
924
|
+
},
|
|
925
|
+
onBlur(event) {
|
|
926
|
+
setTouched(true);
|
|
927
|
+
setFocused(false);
|
|
928
|
+
if (validationMode === "onBlur") {
|
|
929
|
+
validation.commit(event.currentTarget.value);
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
onKeyDown(event) {
|
|
933
|
+
if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") {
|
|
934
|
+
setTouched(true);
|
|
935
|
+
validation.commit(event.currentTarget.value);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}, validation.getInputValidationProps(), elementProps],
|
|
939
|
+
stateAttributesMapping: fieldValidityMapping
|
|
940
|
+
});
|
|
941
|
+
return element;
|
|
942
|
+
});
|
|
943
|
+
if (true)
|
|
944
|
+
FieldControl.displayName = "FieldControl";
|
|
945
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/validity/FieldValidity.js
|
|
946
|
+
import * as React9 from "react";
|
|
947
|
+
import { jsx as _jsx4 } from "react/jsx-runtime";
|
|
948
|
+
"use client";
|
|
949
|
+
var FieldValidity = function FieldValidity2(props) {
|
|
950
|
+
const {
|
|
951
|
+
children
|
|
952
|
+
} = props;
|
|
953
|
+
const {
|
|
954
|
+
validityData,
|
|
955
|
+
invalid
|
|
956
|
+
} = useFieldRootContext(false);
|
|
957
|
+
const combinedFieldValidityData = React9.useMemo(() => getCombinedFieldValidityData(validityData, invalid), [validityData, invalid]);
|
|
958
|
+
const isInvalid = combinedFieldValidityData.state.valid === false;
|
|
959
|
+
const {
|
|
960
|
+
transitionStatus
|
|
961
|
+
} = useTransitionStatus(isInvalid);
|
|
962
|
+
const fieldValidityState = React9.useMemo(() => {
|
|
963
|
+
return {
|
|
964
|
+
...combinedFieldValidityData,
|
|
965
|
+
validity: combinedFieldValidityData.state,
|
|
966
|
+
transitionStatus
|
|
967
|
+
};
|
|
968
|
+
}, [combinedFieldValidityData, transitionStatus]);
|
|
969
|
+
return /* @__PURE__ */ _jsx4(React9.Fragment, {
|
|
970
|
+
children: children(fieldValidityState)
|
|
971
|
+
});
|
|
972
|
+
};
|
|
973
|
+
if (true)
|
|
974
|
+
FieldValidity.displayName = "FieldValidity";
|
|
975
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/field/item/FieldItem.js
|
|
976
|
+
import * as React10 from "react";
|
|
977
|
+
import { jsx as _jsx5 } from "react/jsx-runtime";
|
|
978
|
+
"use client";
|
|
979
|
+
var FieldItem = /* @__PURE__ */ React10.forwardRef(function FieldItem2(componentProps, forwardedRef) {
|
|
980
|
+
const {
|
|
981
|
+
render,
|
|
982
|
+
className,
|
|
983
|
+
style,
|
|
984
|
+
disabled: disabledProp = false,
|
|
985
|
+
...elementProps
|
|
986
|
+
} = componentProps;
|
|
987
|
+
const {
|
|
988
|
+
state,
|
|
989
|
+
disabled: rootDisabled
|
|
990
|
+
} = useFieldRootContext(false);
|
|
991
|
+
const disabled = rootDisabled || disabledProp;
|
|
992
|
+
const checkboxGroupContext = useCheckboxGroupContext();
|
|
993
|
+
const parentId = checkboxGroupContext?.parent.id;
|
|
994
|
+
const hasParentCheckbox = checkboxGroupContext?.allValues !== undefined;
|
|
995
|
+
const controlId = hasParentCheckbox ? parentId : undefined;
|
|
996
|
+
const fieldItemContext = React10.useMemo(() => ({
|
|
997
|
+
disabled
|
|
998
|
+
}), [disabled]);
|
|
999
|
+
const element = useRenderElement("div", componentProps, {
|
|
1000
|
+
ref: forwardedRef,
|
|
1001
|
+
state,
|
|
1002
|
+
props: elementProps,
|
|
1003
|
+
stateAttributesMapping: fieldValidityMapping
|
|
1004
|
+
});
|
|
1005
|
+
return /* @__PURE__ */ _jsx5(LabelableProvider, {
|
|
1006
|
+
controlId,
|
|
1007
|
+
children: /* @__PURE__ */ _jsx5(FieldItemContext.Provider, {
|
|
1008
|
+
value: fieldItemContext,
|
|
1009
|
+
children: element
|
|
1010
|
+
})
|
|
1011
|
+
});
|
|
1012
|
+
});
|
|
1013
|
+
if (true)
|
|
1014
|
+
FieldItem.displayName = "FieldItem";
|
|
1015
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/input/Input.js
|
|
1016
|
+
import { jsx as _jsx6 } from "react/jsx-runtime";
|
|
1017
|
+
"use client";
|
|
1018
|
+
var Input = /* @__PURE__ */ React11.forwardRef(function Input2(props, forwardedRef) {
|
|
1019
|
+
return /* @__PURE__ */ _jsx6(exports_index_parts.Control, {
|
|
1020
|
+
ref: forwardedRef,
|
|
1021
|
+
...props
|
|
1022
|
+
});
|
|
1023
|
+
});
|
|
1024
|
+
if (true)
|
|
1025
|
+
Input.displayName = "Input";
|
|
1026
|
+
export {
|
|
1027
|
+
Input
|
|
1028
|
+
};
|