@kizunacms/ui 0.0.0-stage → 0.1.1
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/LICENSE.MD +9 -0
- package/README.md +18 -2
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/admin.css +2158 -0
- package/dist/client.cjs +99 -0
- package/dist/client.d.cts +46 -0
- package/dist/client.d.mts +46 -0
- package/dist/client.mjs +45 -0
- package/dist/controls/AdminLink.cjs +21 -0
- package/dist/controls/AdminLink.d.cts +16 -0
- package/dist/controls/AdminLink.d.mts +16 -0
- package/dist/controls/AdminLink.mjs +20 -0
- package/dist/controls/Avatar.cjs +15 -0
- package/dist/controls/Avatar.d.cts +17 -0
- package/dist/controls/Avatar.d.mts +17 -0
- package/dist/controls/Avatar.mjs +14 -0
- package/dist/controls/Button.cjs +20 -0
- package/dist/controls/Button.d.cts +18 -0
- package/dist/controls/Button.d.mts +18 -0
- package/dist/controls/Button.mjs +18 -0
- package/dist/controls/ButtonTip.cjs +40 -0
- package/dist/controls/ButtonTip.mjs +39 -0
- package/dist/controls/Checkbox.cjs +27 -0
- package/dist/controls/Checkbox.d.cts +15 -0
- package/dist/controls/Checkbox.d.mts +15 -0
- package/dist/controls/Checkbox.mjs +26 -0
- package/dist/controls/ChipsInput.cjs +145 -0
- package/dist/controls/ChipsInput.mjs +143 -0
- package/dist/controls/ConfirmDialog.cjs +63 -0
- package/dist/controls/ConfirmDialog.d.cts +38 -0
- package/dist/controls/ConfirmDialog.d.mts +38 -0
- package/dist/controls/ConfirmDialog.mjs +62 -0
- package/dist/controls/Counter.cjs +18 -0
- package/dist/controls/Counter.mjs +17 -0
- package/dist/controls/InfoTip.cjs +29 -0
- package/dist/controls/InfoTip.d.cts +11 -0
- package/dist/controls/InfoTip.d.mts +11 -0
- package/dist/controls/InfoTip.mjs +28 -0
- package/dist/controls/LocalTime.cjs +62 -0
- package/dist/controls/LocalTime.d.cts +30 -0
- package/dist/controls/LocalTime.d.mts +30 -0
- package/dist/controls/LocalTime.mjs +61 -0
- package/dist/controls/Logo.cjs +56 -0
- package/dist/controls/Logo.d.cts +13 -0
- package/dist/controls/Logo.d.mts +13 -0
- package/dist/controls/Logo.mjs +54 -0
- package/dist/controls/MenuButton.cjs +118 -0
- package/dist/controls/MenuButton.d.cts +88 -0
- package/dist/controls/MenuButton.d.mts +88 -0
- package/dist/controls/MenuButton.mjs +117 -0
- package/dist/controls/Select.cjs +67 -0
- package/dist/controls/Select.d.cts +42 -0
- package/dist/controls/Select.d.mts +42 -0
- package/dist/controls/Select.mjs +66 -0
- package/dist/controls/Status.cjs +31 -0
- package/dist/controls/Status.d.cts +14 -0
- package/dist/controls/Status.d.mts +14 -0
- package/dist/controls/Status.mjs +30 -0
- package/dist/controls/TrailingButton.cjs +22 -0
- package/dist/controls/TrailingButton.d.cts +18 -0
- package/dist/controls/TrailingButton.d.mts +18 -0
- package/dist/controls/TrailingButton.mjs +21 -0
- package/dist/controls/icon.cjs +42 -0
- package/dist/controls/icon.mjs +38 -0
- package/dist/inputs/Affixed.cjs +49 -0
- package/dist/inputs/Affixed.mjs +47 -0
- package/dist/inputs/CheckboxField.cjs +22 -0
- package/dist/inputs/CheckboxField.d.cts +10 -0
- package/dist/inputs/CheckboxField.d.mts +10 -0
- package/dist/inputs/CheckboxField.mjs +21 -0
- package/dist/inputs/DateField.cjs +22 -0
- package/dist/inputs/DateField.d.cts +10 -0
- package/dist/inputs/DateField.d.mts +10 -0
- package/dist/inputs/DateField.mjs +21 -0
- package/dist/inputs/DateTimeField.cjs +56 -0
- package/dist/inputs/DateTimeField.d.cts +10 -0
- package/dist/inputs/DateTimeField.d.mts +10 -0
- package/dist/inputs/DateTimeField.mjs +55 -0
- package/dist/inputs/EmailField.cjs +20 -0
- package/dist/inputs/EmailField.d.cts +10 -0
- package/dist/inputs/EmailField.d.mts +10 -0
- package/dist/inputs/EmailField.mjs +19 -0
- package/dist/inputs/FallbackReset.cjs +23 -0
- package/dist/inputs/FallbackReset.mjs +21 -0
- package/dist/inputs/FieldFor.cjs +48 -0
- package/dist/inputs/FieldFor.d.cts +16 -0
- package/dist/inputs/FieldFor.d.mts +16 -0
- package/dist/inputs/FieldFor.mjs +46 -0
- package/dist/inputs/FieldFrame.cjs +97 -0
- package/dist/inputs/FieldFrame.d.cts +29 -0
- package/dist/inputs/FieldFrame.d.mts +29 -0
- package/dist/inputs/FieldFrame.mjs +95 -0
- package/dist/inputs/FieldList.cjs +39 -0
- package/dist/inputs/FieldList.d.cts +16 -0
- package/dist/inputs/FieldList.d.mts +16 -0
- package/dist/inputs/FieldList.mjs +38 -0
- package/dist/inputs/FileField.cjs +363 -0
- package/dist/inputs/FileField.d.cts +10 -0
- package/dist/inputs/FileField.d.mts +10 -0
- package/dist/inputs/FileField.mjs +362 -0
- package/dist/inputs/FocalPointPicker.cjs +114 -0
- package/dist/inputs/FocalPointPicker.mjs +113 -0
- package/dist/inputs/JsonField.cjs +21 -0
- package/dist/inputs/JsonField.d.cts +10 -0
- package/dist/inputs/JsonField.d.mts +10 -0
- package/dist/inputs/JsonField.mjs +20 -0
- package/dist/inputs/NumberField.cjs +42 -0
- package/dist/inputs/NumberField.d.cts +10 -0
- package/dist/inputs/NumberField.d.mts +10 -0
- package/dist/inputs/NumberField.mjs +41 -0
- package/dist/inputs/PasswordField.cjs +41 -0
- package/dist/inputs/PasswordField.d.cts +26 -0
- package/dist/inputs/PasswordField.d.mts +26 -0
- package/dist/inputs/PasswordField.mjs +39 -0
- package/dist/inputs/PickerButton.cjs +56 -0
- package/dist/inputs/PickerButton.mjs +55 -0
- package/dist/inputs/RelationshipField.cjs +162 -0
- package/dist/inputs/RelationshipField.d.cts +10 -0
- package/dist/inputs/RelationshipField.d.mts +10 -0
- package/dist/inputs/RelationshipField.mjs +161 -0
- package/dist/inputs/SelectField.cjs +79 -0
- package/dist/inputs/SelectField.d.cts +10 -0
- package/dist/inputs/SelectField.d.mts +10 -0
- package/dist/inputs/SelectField.mjs +78 -0
- package/dist/inputs/SlugField.cjs +71 -0
- package/dist/inputs/SlugField.d.cts +11 -0
- package/dist/inputs/SlugField.d.mts +11 -0
- package/dist/inputs/SlugField.mjs +69 -0
- package/dist/inputs/TextBox.cjs +41 -0
- package/dist/inputs/TextBox.d.cts +35 -0
- package/dist/inputs/TextBox.d.mts +35 -0
- package/dist/inputs/TextBox.mjs +39 -0
- package/dist/inputs/TextField.cjs +61 -0
- package/dist/inputs/TextField.d.cts +10 -0
- package/dist/inputs/TextField.d.mts +10 -0
- package/dist/inputs/TextField.mjs +60 -0
- package/dist/inputs/TitleField.cjs +76 -0
- package/dist/inputs/TitleField.mjs +75 -0
- package/dist/inputs/UrlField.cjs +20 -0
- package/dist/inputs/UrlField.d.cts +10 -0
- package/dist/inputs/UrlField.d.mts +10 -0
- package/dist/inputs/UrlField.mjs +19 -0
- package/dist/inputs/values.cjs +4 -0
- package/dist/inputs/values.d.cts +19 -0
- package/dist/inputs/values.d.mts +19 -0
- package/dist/inputs/values.mjs +4 -0
- package/dist/screens/AccountView.cjs +173 -0
- package/dist/screens/AccountView.d.cts +18 -0
- package/dist/screens/AccountView.d.mts +18 -0
- package/dist/screens/AccountView.mjs +172 -0
- package/dist/screens/AdminShell.cjs +136 -0
- package/dist/screens/AdminShell.d.cts +31 -0
- package/dist/screens/AdminShell.d.mts +31 -0
- package/dist/screens/AdminShell.mjs +135 -0
- package/dist/screens/AuthViews.cjs +260 -0
- package/dist/screens/AuthViews.d.cts +48 -0
- package/dist/screens/AuthViews.d.mts +48 -0
- package/dist/screens/AuthViews.mjs +255 -0
- package/dist/screens/CreateView.cjs +37 -0
- package/dist/screens/CreateView.d.cts +12 -0
- package/dist/screens/CreateView.d.mts +12 -0
- package/dist/screens/CreateView.mjs +36 -0
- package/dist/screens/DashboardView.cjs +39 -0
- package/dist/screens/DashboardView.d.cts +12 -0
- package/dist/screens/DashboardView.d.mts +12 -0
- package/dist/screens/DashboardView.mjs +38 -0
- package/dist/screens/DocumentForm.cjs +214 -0
- package/dist/screens/DocumentForm.d.cts +77 -0
- package/dist/screens/DocumentForm.d.mts +77 -0
- package/dist/screens/DocumentForm.mjs +213 -0
- package/dist/screens/DocumentView.cjs +53 -0
- package/dist/screens/DocumentView.d.cts +17 -0
- package/dist/screens/DocumentView.d.mts +17 -0
- package/dist/screens/DocumentView.mjs +52 -0
- package/dist/screens/FileView.cjs +74 -0
- package/dist/screens/FileView.d.cts +17 -0
- package/dist/screens/FileView.d.mts +17 -0
- package/dist/screens/FileView.mjs +73 -0
- package/dist/screens/FilesView.cjs +212 -0
- package/dist/screens/FilesView.d.cts +34 -0
- package/dist/screens/FilesView.d.mts +34 -0
- package/dist/screens/FilesView.mjs +211 -0
- package/dist/screens/GlobalView.cjs +28 -0
- package/dist/screens/GlobalView.d.cts +16 -0
- package/dist/screens/GlobalView.d.mts +16 -0
- package/dist/screens/GlobalView.mjs +27 -0
- package/dist/screens/ListParts.cjs +138 -0
- package/dist/screens/ListParts.mjs +135 -0
- package/dist/screens/ListView.cjs +155 -0
- package/dist/screens/ListView.d.cts +28 -0
- package/dist/screens/ListView.d.mts +28 -0
- package/dist/screens/ListView.mjs +154 -0
- package/dist/screens/LogoutView.cjs +45 -0
- package/dist/screens/LogoutView.d.cts +10 -0
- package/dist/screens/LogoutView.d.mts +10 -0
- package/dist/screens/LogoutView.mjs +44 -0
- package/dist/screens/MessageView.cjs +13 -0
- package/dist/screens/MessageView.d.cts +12 -0
- package/dist/screens/MessageView.d.mts +12 -0
- package/dist/screens/MessageView.mjs +12 -0
- package/dist/screens/ScreenHeader.cjs +101 -0
- package/dist/screens/ScreenHeader.d.cts +33 -0
- package/dist/screens/ScreenHeader.d.mts +33 -0
- package/dist/screens/ScreenHeader.mjs +98 -0
- package/dist/shared.cjs +55 -0
- package/dist/shared.d.cts +9 -0
- package/dist/shared.d.mts +9 -0
- package/dist/shared.mjs +9 -0
- package/dist/state/AdminProvider.cjs +188 -0
- package/dist/state/AdminProvider.d.cts +106 -0
- package/dist/state/AdminProvider.d.mts +106 -0
- package/dist/state/AdminProvider.mjs +186 -0
- package/dist/state/admin-path.cjs +132 -0
- package/dist/state/admin-path.d.cts +101 -0
- package/dist/state/admin-path.d.mts +101 -0
- package/dist/state/admin-path.mjs +131 -0
- package/dist/state/admin-sections.cjs +49 -0
- package/dist/state/admin-sections.d.cts +39 -0
- package/dist/state/admin-sections.d.mts +39 -0
- package/dist/state/admin-sections.mjs +48 -0
- package/dist/state/choice-search.cjs +95 -0
- package/dist/state/choice-search.mjs +94 -0
- package/dist/state/definition.cjs +53 -0
- package/dist/state/definition.d.cts +123 -0
- package/dist/state/definition.d.mts +123 -0
- package/dist/state/definition.mjs +48 -0
- package/dist/state/form-data.cjs +266 -0
- package/dist/state/form-data.d.cts +123 -0
- package/dist/state/form-data.d.mts +123 -0
- package/dist/state/form-data.mjs +245 -0
- package/dist/state/form-field.cjs +60 -0
- package/dist/state/form-field.d.cts +135 -0
- package/dist/state/form-field.d.mts +135 -0
- package/dist/state/form-field.mjs +56 -0
- package/dist/state/form-state.cjs +11 -0
- package/dist/state/form-state.d.cts +61 -0
- package/dist/state/form-state.d.mts +61 -0
- package/dist/state/form-state.mjs +11 -0
- package/dist/state/kept-focus.cjs +42 -0
- package/dist/state/kept-focus.mjs +41 -0
- package/dist/state/list-query.cjs +116 -0
- package/dist/state/list-query.d.cts +57 -0
- package/dist/state/list-query.d.mts +57 -0
- package/dist/state/list-query.mjs +108 -0
- package/dist/state/picker.cjs +48 -0
- package/dist/state/picker.mjs +47 -0
- package/dist/state/sidebar.cjs +15 -0
- package/dist/state/sidebar.d.cts +7 -0
- package/dist/state/sidebar.d.mts +7 -0
- package/dist/state/sidebar.mjs +14 -0
- package/dist/state/unsaved-guard.cjs +56 -0
- package/dist/state/unsaved-guard.mjs +54 -0
- package/dist/state/uploads.cjs +104 -0
- package/dist/state/uploads.mjs +102 -0
- package/package.json +89 -3
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/inputs/Affixed.tsx
|
|
4
|
+
const hasAffixes = (field) => field.prefix !== void 0 || field.suffix !== void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Returns the input's class, which leaves the frame to `Affixed` when the field has a prefix or a suffix.
|
|
7
|
+
*/
|
|
8
|
+
const inputClassOf = (field) => hasAffixes(field) ? "kz-affixed__input" : "kz-input";
|
|
9
|
+
/**
|
|
10
|
+
* Focuses the input on a press on the prefix or the suffix, as a press anywhere else in the frame does.
|
|
11
|
+
*/
|
|
12
|
+
const focusInput = (event) => {
|
|
13
|
+
if (event.target instanceof HTMLInputElement) return;
|
|
14
|
+
const input = event.currentTarget.querySelector("input");
|
|
15
|
+
if (input === null) return;
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
input.focus();
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Renders the field's frame with its prefix and suffix around the input. Give the input `inputClassOf(field)`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <Affixed field={field}>
|
|
24
|
+
* <Input className={inputClassOf(field)} defaultValue={value} />
|
|
25
|
+
* </Affixed>
|
|
26
|
+
*/
|
|
27
|
+
const Affixed = (props) => {
|
|
28
|
+
const { field } = props;
|
|
29
|
+
if (!hasAffixes(field)) return props.children;
|
|
30
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
31
|
+
className: "kz-input kz-affixed",
|
|
32
|
+
onPointerDown: focusInput,
|
|
33
|
+
children: [
|
|
34
|
+
field.prefix === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
35
|
+
className: "kz-affixed__text",
|
|
36
|
+
children: field.prefix
|
|
37
|
+
}),
|
|
38
|
+
props.children,
|
|
39
|
+
field.suffix === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
40
|
+
className: "kz-affixed__text",
|
|
41
|
+
children: field.suffix
|
|
42
|
+
})
|
|
43
|
+
]
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { Affixed, inputClassOf };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_Checkbox = require("../controls/Checkbox.cjs");
|
|
4
|
+
const require_FieldFrame = require("./FieldFrame.cjs");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
//#region src/inputs/CheckboxField.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Renders a `boolean` field as a checkbox.
|
|
9
|
+
*/
|
|
10
|
+
const CheckboxField = (props) => {
|
|
11
|
+
const { field } = props;
|
|
12
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldFrame.FieldFrame, {
|
|
13
|
+
field,
|
|
14
|
+
inline: true,
|
|
15
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.Checkbox, {
|
|
16
|
+
defaultChecked: props.value === "on",
|
|
17
|
+
readOnly: field.readOnly
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.CheckboxField = CheckboxField;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldProps } from "./values.cjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/inputs/CheckboxField.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Renders a `boolean` field as a checkbox.
|
|
7
|
+
*/
|
|
8
|
+
declare const CheckboxField: (props: FieldProps) => _$react.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CheckboxField };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldProps } from "./values.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/inputs/CheckboxField.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Renders a `boolean` field as a checkbox.
|
|
7
|
+
*/
|
|
8
|
+
declare const CheckboxField: (props: FieldProps) => _$react.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CheckboxField };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Checkbox } from "../controls/Checkbox.mjs";
|
|
3
|
+
import { FieldFrame } from "./FieldFrame.mjs";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/inputs/CheckboxField.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Renders a `boolean` field as a checkbox.
|
|
8
|
+
*/
|
|
9
|
+
const CheckboxField = (props) => {
|
|
10
|
+
const { field } = props;
|
|
11
|
+
return /* @__PURE__ */ jsx(FieldFrame, {
|
|
12
|
+
field,
|
|
13
|
+
inline: true,
|
|
14
|
+
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
15
|
+
defaultChecked: props.value === "on",
|
|
16
|
+
readOnly: field.readOnly
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { CheckboxField };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_FieldFrame = require("./FieldFrame.cjs");
|
|
4
|
+
const require_PickerButton = require("./PickerButton.cjs");
|
|
5
|
+
const require_TextBox = require("./TextBox.cjs");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
//#region src/inputs/DateField.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Renders a `date` field with a button that opens the browser's date picker.
|
|
10
|
+
*/
|
|
11
|
+
const DateField = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldFrame.FieldFrame, {
|
|
12
|
+
field: props.field,
|
|
13
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14
|
+
className: "kz-affix kz-date",
|
|
15
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TextBox.TextBox, {
|
|
16
|
+
...props,
|
|
17
|
+
type: "date"
|
|
18
|
+
}), props.field.readOnly ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PickerButton.PickerButton, {})]
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.DateField = DateField;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldProps } from "./values.cjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/inputs/DateField.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Renders a `date` field with a button that opens the browser's date picker.
|
|
7
|
+
*/
|
|
8
|
+
declare const DateField: (props: FieldProps) => _$react.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DateField };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldProps } from "./values.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/inputs/DateField.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Renders a `date` field with a button that opens the browser's date picker.
|
|
7
|
+
*/
|
|
8
|
+
declare const DateField: (props: FieldProps) => _$react.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DateField };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { FieldFrame } from "./FieldFrame.mjs";
|
|
3
|
+
import { PickerButton } from "./PickerButton.mjs";
|
|
4
|
+
import { TextBox } from "./TextBox.mjs";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/inputs/DateField.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Renders a `date` field with a button that opens the browser's date picker.
|
|
9
|
+
*/
|
|
10
|
+
const DateField = (props) => /* @__PURE__ */ jsx(FieldFrame, {
|
|
11
|
+
field: props.field,
|
|
12
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
className: "kz-affix kz-date",
|
|
14
|
+
children: [/* @__PURE__ */ jsx(TextBox, {
|
|
15
|
+
...props,
|
|
16
|
+
type: "date"
|
|
17
|
+
}), props.field.readOnly ? null : /* @__PURE__ */ jsx(PickerButton, {})]
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { DateField };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_FieldFrame = require("./FieldFrame.cjs");
|
|
4
|
+
const require_PickerButton = require("./PickerButton.cjs");
|
|
5
|
+
const require_values = require("./values.cjs");
|
|
6
|
+
const require_form_data = require("../state/form-data.cjs");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let _base_ui_react_input = require("@base-ui/react/input");
|
|
10
|
+
//#region src/inputs/DateTimeField.tsx
|
|
11
|
+
const toLocalInput = (iso) => {
|
|
12
|
+
if (iso === "") return "";
|
|
13
|
+
const date = new Date(iso);
|
|
14
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
15
|
+
return (/* @__PURE__ */ new Date(date.getTime() - date.getTimezoneOffset() * 6e4)).toISOString().slice(0, 16);
|
|
16
|
+
};
|
|
17
|
+
const toUtc = (local) => {
|
|
18
|
+
if (local === "") return "";
|
|
19
|
+
const date = new Date(local);
|
|
20
|
+
return Number.isNaN(date.getTime()) ? "" : date.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Renders a `dateTime` field in the editor's time zone. The form sends the moment in UTC.
|
|
24
|
+
*/
|
|
25
|
+
const DateTimeField = (props) => {
|
|
26
|
+
const { field } = props;
|
|
27
|
+
const value = require_values.textOf(props.value);
|
|
28
|
+
const [utc, setUtc] = (0, react.useState)(value);
|
|
29
|
+
const [local, setLocal] = (0, react.useState)("");
|
|
30
|
+
(0, react.useEffect)(() => {
|
|
31
|
+
setUtc(value);
|
|
32
|
+
setLocal(toLocalInput(value));
|
|
33
|
+
}, [value]);
|
|
34
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_FieldFrame.FieldFrame, {
|
|
35
|
+
field,
|
|
36
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37
|
+
className: "kz-affix kz-date",
|
|
38
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_input.Input, {
|
|
39
|
+
type: "datetime-local",
|
|
40
|
+
className: "kz-input",
|
|
41
|
+
value: local,
|
|
42
|
+
readOnly: field.readOnly,
|
|
43
|
+
onValueChange: (next) => {
|
|
44
|
+
setLocal(next);
|
|
45
|
+
setUtc(toUtc(next));
|
|
46
|
+
}
|
|
47
|
+
}), field.readOnly ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PickerButton.PickerButton, {})]
|
|
48
|
+
}), field.readOnly ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
49
|
+
type: "hidden",
|
|
50
|
+
name: require_form_data.utcInput(field.name),
|
|
51
|
+
value: utc
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
exports.DateTimeField = DateTimeField;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldProps } from "./values.cjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/inputs/DateTimeField.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Renders a `dateTime` field in the editor's time zone. The form sends the moment in UTC.
|
|
7
|
+
*/
|
|
8
|
+
declare const DateTimeField: (props: FieldProps) => _$react.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DateTimeField };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldProps } from "./values.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/inputs/DateTimeField.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Renders a `dateTime` field in the editor's time zone. The form sends the moment in UTC.
|
|
7
|
+
*/
|
|
8
|
+
declare const DateTimeField: (props: FieldProps) => _$react.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DateTimeField };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { FieldFrame } from "./FieldFrame.mjs";
|
|
3
|
+
import { PickerButton } from "./PickerButton.mjs";
|
|
4
|
+
import { textOf } from "./values.mjs";
|
|
5
|
+
import { utcInput } from "../state/form-data.mjs";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Input } from "@base-ui/react/input";
|
|
9
|
+
//#region src/inputs/DateTimeField.tsx
|
|
10
|
+
const toLocalInput = (iso) => {
|
|
11
|
+
if (iso === "") return "";
|
|
12
|
+
const date = new Date(iso);
|
|
13
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
14
|
+
return (/* @__PURE__ */ new Date(date.getTime() - date.getTimezoneOffset() * 6e4)).toISOString().slice(0, 16);
|
|
15
|
+
};
|
|
16
|
+
const toUtc = (local) => {
|
|
17
|
+
if (local === "") return "";
|
|
18
|
+
const date = new Date(local);
|
|
19
|
+
return Number.isNaN(date.getTime()) ? "" : date.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Renders a `dateTime` field in the editor's time zone. The form sends the moment in UTC.
|
|
23
|
+
*/
|
|
24
|
+
const DateTimeField = (props) => {
|
|
25
|
+
const { field } = props;
|
|
26
|
+
const value = textOf(props.value);
|
|
27
|
+
const [utc, setUtc] = useState(value);
|
|
28
|
+
const [local, setLocal] = useState("");
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setUtc(value);
|
|
31
|
+
setLocal(toLocalInput(value));
|
|
32
|
+
}, [value]);
|
|
33
|
+
return /* @__PURE__ */ jsxs(FieldFrame, {
|
|
34
|
+
field,
|
|
35
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
36
|
+
className: "kz-affix kz-date",
|
|
37
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
38
|
+
type: "datetime-local",
|
|
39
|
+
className: "kz-input",
|
|
40
|
+
value: local,
|
|
41
|
+
readOnly: field.readOnly,
|
|
42
|
+
onValueChange: (next) => {
|
|
43
|
+
setLocal(next);
|
|
44
|
+
setUtc(toUtc(next));
|
|
45
|
+
}
|
|
46
|
+
}), field.readOnly ? null : /* @__PURE__ */ jsx(PickerButton, {})]
|
|
47
|
+
}), field.readOnly ? null : /* @__PURE__ */ jsx("input", {
|
|
48
|
+
type: "hidden",
|
|
49
|
+
name: utcInput(field.name),
|
|
50
|
+
value: utc
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { DateTimeField };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_FieldFrame = require("./FieldFrame.cjs");
|
|
4
|
+
const require_TextBox = require("./TextBox.cjs");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
//#region src/inputs/EmailField.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Renders an `email` field.
|
|
9
|
+
*/
|
|
10
|
+
const EmailField = (props) => {
|
|
11
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldFrame.FieldFrame, {
|
|
12
|
+
field: props.field,
|
|
13
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TextBox.TextBox, {
|
|
14
|
+
...props,
|
|
15
|
+
inputMode: "email"
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.EmailField = EmailField;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldProps } from "./values.cjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/inputs/EmailField.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Renders an `email` field.
|
|
7
|
+
*/
|
|
8
|
+
declare const EmailField: (props: FieldProps) => _$react.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { EmailField };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldProps } from "./values.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/inputs/EmailField.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Renders an `email` field.
|
|
7
|
+
*/
|
|
8
|
+
declare const EmailField: (props: FieldProps) => _$react.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { EmailField };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { FieldFrame } from "./FieldFrame.mjs";
|
|
3
|
+
import { TextBox } from "./TextBox.mjs";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/inputs/EmailField.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Renders an `email` field.
|
|
8
|
+
*/
|
|
9
|
+
const EmailField = (props) => {
|
|
10
|
+
return /* @__PURE__ */ jsx(FieldFrame, {
|
|
11
|
+
field: props.field,
|
|
12
|
+
children: /* @__PURE__ */ jsx(TextBox, {
|
|
13
|
+
...props,
|
|
14
|
+
inputMode: "email"
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { EmailField };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_icon = require("../controls/icon.cjs");
|
|
4
|
+
const require_definition = require("../state/definition.cjs");
|
|
5
|
+
const require_TrailingButton = require("../controls/TrailingButton.cjs");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let lucide_react = require("lucide-react");
|
|
8
|
+
//#region src/inputs/FallbackReset.tsx
|
|
9
|
+
const fallsBack = (field) => field.placeholderFrom !== void 0;
|
|
10
|
+
/**
|
|
11
|
+
* Renders a button that clears the field's own value, so the value it falls back to shows again.
|
|
12
|
+
*/
|
|
13
|
+
const FallbackReset = (props) => props.value === "" || props.field.readOnly || props.field.placeholderFrom === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TrailingButton.TrailingButton, {
|
|
14
|
+
label: `Use the ${require_definition.inSentence(props.field.source ?? props.field.placeholderFrom)}`,
|
|
15
|
+
onClick: props.onReset,
|
|
16
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.RefreshCwIcon, {
|
|
17
|
+
...require_icon.ICON,
|
|
18
|
+
"aria-hidden": true
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.FallbackReset = FallbackReset;
|
|
23
|
+
exports.fallsBack = fallsBack;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ICON } from "../controls/icon.mjs";
|
|
3
|
+
import { inSentence } from "../state/definition.mjs";
|
|
4
|
+
import { TrailingButton } from "../controls/TrailingButton.mjs";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { RefreshCwIcon } from "lucide-react";
|
|
7
|
+
//#region src/inputs/FallbackReset.tsx
|
|
8
|
+
const fallsBack = (field) => field.placeholderFrom !== void 0;
|
|
9
|
+
/**
|
|
10
|
+
* Renders a button that clears the field's own value, so the value it falls back to shows again.
|
|
11
|
+
*/
|
|
12
|
+
const FallbackReset = (props) => props.value === "" || props.field.readOnly || props.field.placeholderFrom === void 0 ? null : /* @__PURE__ */ jsx(TrailingButton, {
|
|
13
|
+
label: `Use the ${inSentence(props.field.source ?? props.field.placeholderFrom)}`,
|
|
14
|
+
onClick: props.onReset,
|
|
15
|
+
children: /* @__PURE__ */ jsx(RefreshCwIcon, {
|
|
16
|
+
...ICON,
|
|
17
|
+
"aria-hidden": true
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { FallbackReset, fallsBack };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_CheckboxField = require("./CheckboxField.cjs");
|
|
4
|
+
const require_DateField = require("./DateField.cjs");
|
|
5
|
+
const require_DateTimeField = require("./DateTimeField.cjs");
|
|
6
|
+
const require_EmailField = require("./EmailField.cjs");
|
|
7
|
+
const require_FileField = require("./FileField.cjs");
|
|
8
|
+
const require_JsonField = require("./JsonField.cjs");
|
|
9
|
+
const require_NumberField = require("./NumberField.cjs");
|
|
10
|
+
const require_RelationshipField = require("./RelationshipField.cjs");
|
|
11
|
+
const require_PasswordField = require("./PasswordField.cjs");
|
|
12
|
+
const require_SelectField = require("./SelectField.cjs");
|
|
13
|
+
const require_SlugField = require("./SlugField.cjs");
|
|
14
|
+
const require_TextField = require("./TextField.cjs");
|
|
15
|
+
const require_UrlField = require("./UrlField.cjs");
|
|
16
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
17
|
+
//#region src/inputs/FieldFor.tsx
|
|
18
|
+
/**
|
|
19
|
+
* The component that renders each kind of form input.
|
|
20
|
+
*/
|
|
21
|
+
const inputComponents = {
|
|
22
|
+
text: require_TextField.TextField,
|
|
23
|
+
textarea: require_TextField.TextField,
|
|
24
|
+
number: require_NumberField.NumberField,
|
|
25
|
+
checkbox: require_CheckboxField.CheckboxField,
|
|
26
|
+
url: require_UrlField.UrlField,
|
|
27
|
+
email: require_EmailField.EmailField,
|
|
28
|
+
slug: require_SlugField.SlugField,
|
|
29
|
+
select: require_SelectField.SelectField,
|
|
30
|
+
selectMany: require_SelectField.SelectField,
|
|
31
|
+
date: require_DateField.DateField,
|
|
32
|
+
dateTime: require_DateTimeField.DateTimeField,
|
|
33
|
+
relationship: require_RelationshipField.RelationshipField,
|
|
34
|
+
relationships: require_RelationshipField.RelationshipField,
|
|
35
|
+
file: require_FileField.FileField,
|
|
36
|
+
json: require_JsonField.JsonField,
|
|
37
|
+
password: require_PasswordField.PasswordInput
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Renders the input a form field's `input` names.
|
|
41
|
+
*/
|
|
42
|
+
const FieldFor = (props) => {
|
|
43
|
+
const Component = inputComponents[props.field.input];
|
|
44
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, { ...props });
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.FieldFor = FieldFor;
|
|
48
|
+
exports.inputComponents = inputComponents;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FormInput } from "../state/form-field.cjs";
|
|
2
|
+
import { FieldProps } from "./values.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
import { ComponentType } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/inputs/FieldFor.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The component that renders each kind of form input.
|
|
9
|
+
*/
|
|
10
|
+
declare const inputComponents: Record<FormInput, ComponentType<FieldProps>>;
|
|
11
|
+
/**
|
|
12
|
+
* Renders the input a form field's `input` names.
|
|
13
|
+
*/
|
|
14
|
+
declare const FieldFor: (props: FieldProps) => _$react.JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { FieldFor, inputComponents };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FormInput } from "../state/form-field.mjs";
|
|
2
|
+
import { FieldProps } from "./values.mjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
import { ComponentType } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/inputs/FieldFor.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The component that renders each kind of form input.
|
|
9
|
+
*/
|
|
10
|
+
declare const inputComponents: Record<FormInput, ComponentType<FieldProps>>;
|
|
11
|
+
/**
|
|
12
|
+
* Renders the input a form field's `input` names.
|
|
13
|
+
*/
|
|
14
|
+
declare const FieldFor: (props: FieldProps) => _$react.JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { FieldFor, inputComponents };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CheckboxField } from "./CheckboxField.mjs";
|
|
3
|
+
import { DateField } from "./DateField.mjs";
|
|
4
|
+
import { DateTimeField } from "./DateTimeField.mjs";
|
|
5
|
+
import { EmailField } from "./EmailField.mjs";
|
|
6
|
+
import { FileField } from "./FileField.mjs";
|
|
7
|
+
import { JsonField } from "./JsonField.mjs";
|
|
8
|
+
import { NumberField } from "./NumberField.mjs";
|
|
9
|
+
import { RelationshipField } from "./RelationshipField.mjs";
|
|
10
|
+
import { PasswordInput } from "./PasswordField.mjs";
|
|
11
|
+
import { SelectField } from "./SelectField.mjs";
|
|
12
|
+
import { SlugField } from "./SlugField.mjs";
|
|
13
|
+
import { TextField } from "./TextField.mjs";
|
|
14
|
+
import { UrlField } from "./UrlField.mjs";
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
//#region src/inputs/FieldFor.tsx
|
|
17
|
+
/**
|
|
18
|
+
* The component that renders each kind of form input.
|
|
19
|
+
*/
|
|
20
|
+
const inputComponents = {
|
|
21
|
+
text: TextField,
|
|
22
|
+
textarea: TextField,
|
|
23
|
+
number: NumberField,
|
|
24
|
+
checkbox: CheckboxField,
|
|
25
|
+
url: UrlField,
|
|
26
|
+
email: EmailField,
|
|
27
|
+
slug: SlugField,
|
|
28
|
+
select: SelectField,
|
|
29
|
+
selectMany: SelectField,
|
|
30
|
+
date: DateField,
|
|
31
|
+
dateTime: DateTimeField,
|
|
32
|
+
relationship: RelationshipField,
|
|
33
|
+
relationships: RelationshipField,
|
|
34
|
+
file: FileField,
|
|
35
|
+
json: JsonField,
|
|
36
|
+
password: PasswordInput
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Renders the input a form field's `input` names.
|
|
40
|
+
*/
|
|
41
|
+
const FieldFor = (props) => {
|
|
42
|
+
const Component = inputComponents[props.field.input];
|
|
43
|
+
return /* @__PURE__ */ jsx(Component, { ...props });
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
export { FieldFor, inputComponents };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_icon = require("../controls/icon.cjs");
|
|
4
|
+
const require_definition = require("../state/definition.cjs");
|
|
5
|
+
const require_InfoTip = require("../controls/InfoTip.cjs");
|
|
6
|
+
let clsx = require("clsx");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let lucide_react = require("lucide-react");
|
|
9
|
+
let _base_ui_react_field = require("@base-ui/react/field");
|
|
10
|
+
//#region src/inputs/FieldFrame.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Renders a field's label, help text and error around its input.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <FieldFrame field={field}>
|
|
16
|
+
* <Input className="kz-input" defaultValue={value} />
|
|
17
|
+
* </FieldFrame>
|
|
18
|
+
*/
|
|
19
|
+
const FieldFrame = (props) => {
|
|
20
|
+
const { field } = props;
|
|
21
|
+
const label = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [field.label, field.required ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
22
|
+
className: "kz-required",
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
children: "*"
|
|
25
|
+
}) : null] });
|
|
26
|
+
const help = field.description === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_field.Field.Description, {
|
|
27
|
+
className: "kz-help",
|
|
28
|
+
children: field.description
|
|
29
|
+
});
|
|
30
|
+
const classes = (0, clsx.clsx)("kz-field", field.readOnly && "kz-read-only");
|
|
31
|
+
if (props.inline === true) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_field.Field.Root, {
|
|
32
|
+
name: field.name,
|
|
33
|
+
className: classes,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_field.Field.Label, {
|
|
36
|
+
className: "kz-choice",
|
|
37
|
+
children: [
|
|
38
|
+
props.children,
|
|
39
|
+
label,
|
|
40
|
+
field.readOnly ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.LockIcon, {
|
|
41
|
+
className: "kz-lock",
|
|
42
|
+
...require_icon.ICON,
|
|
43
|
+
"aria-hidden": true
|
|
44
|
+
}) : null
|
|
45
|
+
]
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldError, {}),
|
|
48
|
+
help
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_field.Field.Root, {
|
|
52
|
+
name: field.name,
|
|
53
|
+
className: classes,
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
56
|
+
className: "kz-field__head",
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_field.Field.Label, {
|
|
59
|
+
className: "kz-field__label",
|
|
60
|
+
children: label
|
|
61
|
+
}),
|
|
62
|
+
field.source === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_InfoTip.InfoTip, { text: `From the ${require_definition.inSentence(field.source)}` }),
|
|
63
|
+
props.aside === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
64
|
+
className: "kz-field__aside",
|
|
65
|
+
children: props.aside
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
70
|
+
className: "kz-field__input",
|
|
71
|
+
children: [props.children, field.readOnly && field.input !== "file" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.LockIcon, {
|
|
72
|
+
className: "kz-lock",
|
|
73
|
+
...require_icon.ICON,
|
|
74
|
+
"aria-hidden": true
|
|
75
|
+
}) : null]
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldError, {}),
|
|
78
|
+
help
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Shows why the value was refused, in a line under the field.
|
|
84
|
+
*/
|
|
85
|
+
const FieldError = () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_field.Field.Error, {
|
|
86
|
+
className: "kz-field__error",
|
|
87
|
+
render: (errorProps) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
88
|
+
...errorProps,
|
|
89
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleAlertIcon, {
|
|
90
|
+
...require_icon.ICON,
|
|
91
|
+
"aria-hidden": true
|
|
92
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: errorProps.children })]
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
//#endregion
|
|
96
|
+
exports.FieldError = FieldError;
|
|
97
|
+
exports.FieldFrame = FieldFrame;
|