@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.
Files changed (255) hide show
  1. package/LICENSE.MD +9 -0
  2. package/README.md +18 -2
  3. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  4. package/dist/admin.css +2158 -0
  5. package/dist/client.cjs +99 -0
  6. package/dist/client.d.cts +46 -0
  7. package/dist/client.d.mts +46 -0
  8. package/dist/client.mjs +45 -0
  9. package/dist/controls/AdminLink.cjs +21 -0
  10. package/dist/controls/AdminLink.d.cts +16 -0
  11. package/dist/controls/AdminLink.d.mts +16 -0
  12. package/dist/controls/AdminLink.mjs +20 -0
  13. package/dist/controls/Avatar.cjs +15 -0
  14. package/dist/controls/Avatar.d.cts +17 -0
  15. package/dist/controls/Avatar.d.mts +17 -0
  16. package/dist/controls/Avatar.mjs +14 -0
  17. package/dist/controls/Button.cjs +20 -0
  18. package/dist/controls/Button.d.cts +18 -0
  19. package/dist/controls/Button.d.mts +18 -0
  20. package/dist/controls/Button.mjs +18 -0
  21. package/dist/controls/ButtonTip.cjs +40 -0
  22. package/dist/controls/ButtonTip.mjs +39 -0
  23. package/dist/controls/Checkbox.cjs +27 -0
  24. package/dist/controls/Checkbox.d.cts +15 -0
  25. package/dist/controls/Checkbox.d.mts +15 -0
  26. package/dist/controls/Checkbox.mjs +26 -0
  27. package/dist/controls/ChipsInput.cjs +145 -0
  28. package/dist/controls/ChipsInput.mjs +143 -0
  29. package/dist/controls/ConfirmDialog.cjs +63 -0
  30. package/dist/controls/ConfirmDialog.d.cts +38 -0
  31. package/dist/controls/ConfirmDialog.d.mts +38 -0
  32. package/dist/controls/ConfirmDialog.mjs +62 -0
  33. package/dist/controls/Counter.cjs +18 -0
  34. package/dist/controls/Counter.mjs +17 -0
  35. package/dist/controls/InfoTip.cjs +29 -0
  36. package/dist/controls/InfoTip.d.cts +11 -0
  37. package/dist/controls/InfoTip.d.mts +11 -0
  38. package/dist/controls/InfoTip.mjs +28 -0
  39. package/dist/controls/LocalTime.cjs +62 -0
  40. package/dist/controls/LocalTime.d.cts +30 -0
  41. package/dist/controls/LocalTime.d.mts +30 -0
  42. package/dist/controls/LocalTime.mjs +61 -0
  43. package/dist/controls/Logo.cjs +56 -0
  44. package/dist/controls/Logo.d.cts +13 -0
  45. package/dist/controls/Logo.d.mts +13 -0
  46. package/dist/controls/Logo.mjs +54 -0
  47. package/dist/controls/MenuButton.cjs +118 -0
  48. package/dist/controls/MenuButton.d.cts +88 -0
  49. package/dist/controls/MenuButton.d.mts +88 -0
  50. package/dist/controls/MenuButton.mjs +117 -0
  51. package/dist/controls/Select.cjs +67 -0
  52. package/dist/controls/Select.d.cts +42 -0
  53. package/dist/controls/Select.d.mts +42 -0
  54. package/dist/controls/Select.mjs +66 -0
  55. package/dist/controls/Status.cjs +31 -0
  56. package/dist/controls/Status.d.cts +14 -0
  57. package/dist/controls/Status.d.mts +14 -0
  58. package/dist/controls/Status.mjs +30 -0
  59. package/dist/controls/TrailingButton.cjs +22 -0
  60. package/dist/controls/TrailingButton.d.cts +18 -0
  61. package/dist/controls/TrailingButton.d.mts +18 -0
  62. package/dist/controls/TrailingButton.mjs +21 -0
  63. package/dist/controls/icon.cjs +42 -0
  64. package/dist/controls/icon.mjs +38 -0
  65. package/dist/inputs/Affixed.cjs +49 -0
  66. package/dist/inputs/Affixed.mjs +47 -0
  67. package/dist/inputs/CheckboxField.cjs +22 -0
  68. package/dist/inputs/CheckboxField.d.cts +10 -0
  69. package/dist/inputs/CheckboxField.d.mts +10 -0
  70. package/dist/inputs/CheckboxField.mjs +21 -0
  71. package/dist/inputs/DateField.cjs +22 -0
  72. package/dist/inputs/DateField.d.cts +10 -0
  73. package/dist/inputs/DateField.d.mts +10 -0
  74. package/dist/inputs/DateField.mjs +21 -0
  75. package/dist/inputs/DateTimeField.cjs +56 -0
  76. package/dist/inputs/DateTimeField.d.cts +10 -0
  77. package/dist/inputs/DateTimeField.d.mts +10 -0
  78. package/dist/inputs/DateTimeField.mjs +55 -0
  79. package/dist/inputs/EmailField.cjs +20 -0
  80. package/dist/inputs/EmailField.d.cts +10 -0
  81. package/dist/inputs/EmailField.d.mts +10 -0
  82. package/dist/inputs/EmailField.mjs +19 -0
  83. package/dist/inputs/FallbackReset.cjs +23 -0
  84. package/dist/inputs/FallbackReset.mjs +21 -0
  85. package/dist/inputs/FieldFor.cjs +48 -0
  86. package/dist/inputs/FieldFor.d.cts +16 -0
  87. package/dist/inputs/FieldFor.d.mts +16 -0
  88. package/dist/inputs/FieldFor.mjs +46 -0
  89. package/dist/inputs/FieldFrame.cjs +97 -0
  90. package/dist/inputs/FieldFrame.d.cts +29 -0
  91. package/dist/inputs/FieldFrame.d.mts +29 -0
  92. package/dist/inputs/FieldFrame.mjs +95 -0
  93. package/dist/inputs/FieldList.cjs +39 -0
  94. package/dist/inputs/FieldList.d.cts +16 -0
  95. package/dist/inputs/FieldList.d.mts +16 -0
  96. package/dist/inputs/FieldList.mjs +38 -0
  97. package/dist/inputs/FileField.cjs +363 -0
  98. package/dist/inputs/FileField.d.cts +10 -0
  99. package/dist/inputs/FileField.d.mts +10 -0
  100. package/dist/inputs/FileField.mjs +362 -0
  101. package/dist/inputs/FocalPointPicker.cjs +114 -0
  102. package/dist/inputs/FocalPointPicker.mjs +113 -0
  103. package/dist/inputs/JsonField.cjs +21 -0
  104. package/dist/inputs/JsonField.d.cts +10 -0
  105. package/dist/inputs/JsonField.d.mts +10 -0
  106. package/dist/inputs/JsonField.mjs +20 -0
  107. package/dist/inputs/NumberField.cjs +42 -0
  108. package/dist/inputs/NumberField.d.cts +10 -0
  109. package/dist/inputs/NumberField.d.mts +10 -0
  110. package/dist/inputs/NumberField.mjs +41 -0
  111. package/dist/inputs/PasswordField.cjs +41 -0
  112. package/dist/inputs/PasswordField.d.cts +26 -0
  113. package/dist/inputs/PasswordField.d.mts +26 -0
  114. package/dist/inputs/PasswordField.mjs +39 -0
  115. package/dist/inputs/PickerButton.cjs +56 -0
  116. package/dist/inputs/PickerButton.mjs +55 -0
  117. package/dist/inputs/RelationshipField.cjs +162 -0
  118. package/dist/inputs/RelationshipField.d.cts +10 -0
  119. package/dist/inputs/RelationshipField.d.mts +10 -0
  120. package/dist/inputs/RelationshipField.mjs +161 -0
  121. package/dist/inputs/SelectField.cjs +79 -0
  122. package/dist/inputs/SelectField.d.cts +10 -0
  123. package/dist/inputs/SelectField.d.mts +10 -0
  124. package/dist/inputs/SelectField.mjs +78 -0
  125. package/dist/inputs/SlugField.cjs +71 -0
  126. package/dist/inputs/SlugField.d.cts +11 -0
  127. package/dist/inputs/SlugField.d.mts +11 -0
  128. package/dist/inputs/SlugField.mjs +69 -0
  129. package/dist/inputs/TextBox.cjs +41 -0
  130. package/dist/inputs/TextBox.d.cts +35 -0
  131. package/dist/inputs/TextBox.d.mts +35 -0
  132. package/dist/inputs/TextBox.mjs +39 -0
  133. package/dist/inputs/TextField.cjs +61 -0
  134. package/dist/inputs/TextField.d.cts +10 -0
  135. package/dist/inputs/TextField.d.mts +10 -0
  136. package/dist/inputs/TextField.mjs +60 -0
  137. package/dist/inputs/TitleField.cjs +76 -0
  138. package/dist/inputs/TitleField.mjs +75 -0
  139. package/dist/inputs/UrlField.cjs +20 -0
  140. package/dist/inputs/UrlField.d.cts +10 -0
  141. package/dist/inputs/UrlField.d.mts +10 -0
  142. package/dist/inputs/UrlField.mjs +19 -0
  143. package/dist/inputs/values.cjs +4 -0
  144. package/dist/inputs/values.d.cts +19 -0
  145. package/dist/inputs/values.d.mts +19 -0
  146. package/dist/inputs/values.mjs +4 -0
  147. package/dist/screens/AccountView.cjs +173 -0
  148. package/dist/screens/AccountView.d.cts +18 -0
  149. package/dist/screens/AccountView.d.mts +18 -0
  150. package/dist/screens/AccountView.mjs +172 -0
  151. package/dist/screens/AdminShell.cjs +136 -0
  152. package/dist/screens/AdminShell.d.cts +31 -0
  153. package/dist/screens/AdminShell.d.mts +31 -0
  154. package/dist/screens/AdminShell.mjs +135 -0
  155. package/dist/screens/AuthViews.cjs +260 -0
  156. package/dist/screens/AuthViews.d.cts +48 -0
  157. package/dist/screens/AuthViews.d.mts +48 -0
  158. package/dist/screens/AuthViews.mjs +255 -0
  159. package/dist/screens/CreateView.cjs +37 -0
  160. package/dist/screens/CreateView.d.cts +12 -0
  161. package/dist/screens/CreateView.d.mts +12 -0
  162. package/dist/screens/CreateView.mjs +36 -0
  163. package/dist/screens/DashboardView.cjs +39 -0
  164. package/dist/screens/DashboardView.d.cts +12 -0
  165. package/dist/screens/DashboardView.d.mts +12 -0
  166. package/dist/screens/DashboardView.mjs +38 -0
  167. package/dist/screens/DocumentForm.cjs +214 -0
  168. package/dist/screens/DocumentForm.d.cts +77 -0
  169. package/dist/screens/DocumentForm.d.mts +77 -0
  170. package/dist/screens/DocumentForm.mjs +213 -0
  171. package/dist/screens/DocumentView.cjs +53 -0
  172. package/dist/screens/DocumentView.d.cts +17 -0
  173. package/dist/screens/DocumentView.d.mts +17 -0
  174. package/dist/screens/DocumentView.mjs +52 -0
  175. package/dist/screens/FileView.cjs +74 -0
  176. package/dist/screens/FileView.d.cts +17 -0
  177. package/dist/screens/FileView.d.mts +17 -0
  178. package/dist/screens/FileView.mjs +73 -0
  179. package/dist/screens/FilesView.cjs +212 -0
  180. package/dist/screens/FilesView.d.cts +34 -0
  181. package/dist/screens/FilesView.d.mts +34 -0
  182. package/dist/screens/FilesView.mjs +211 -0
  183. package/dist/screens/GlobalView.cjs +28 -0
  184. package/dist/screens/GlobalView.d.cts +16 -0
  185. package/dist/screens/GlobalView.d.mts +16 -0
  186. package/dist/screens/GlobalView.mjs +27 -0
  187. package/dist/screens/ListParts.cjs +138 -0
  188. package/dist/screens/ListParts.mjs +135 -0
  189. package/dist/screens/ListView.cjs +155 -0
  190. package/dist/screens/ListView.d.cts +28 -0
  191. package/dist/screens/ListView.d.mts +28 -0
  192. package/dist/screens/ListView.mjs +154 -0
  193. package/dist/screens/LogoutView.cjs +45 -0
  194. package/dist/screens/LogoutView.d.cts +10 -0
  195. package/dist/screens/LogoutView.d.mts +10 -0
  196. package/dist/screens/LogoutView.mjs +44 -0
  197. package/dist/screens/MessageView.cjs +13 -0
  198. package/dist/screens/MessageView.d.cts +12 -0
  199. package/dist/screens/MessageView.d.mts +12 -0
  200. package/dist/screens/MessageView.mjs +12 -0
  201. package/dist/screens/ScreenHeader.cjs +101 -0
  202. package/dist/screens/ScreenHeader.d.cts +33 -0
  203. package/dist/screens/ScreenHeader.d.mts +33 -0
  204. package/dist/screens/ScreenHeader.mjs +98 -0
  205. package/dist/shared.cjs +55 -0
  206. package/dist/shared.d.cts +9 -0
  207. package/dist/shared.d.mts +9 -0
  208. package/dist/shared.mjs +9 -0
  209. package/dist/state/AdminProvider.cjs +188 -0
  210. package/dist/state/AdminProvider.d.cts +106 -0
  211. package/dist/state/AdminProvider.d.mts +106 -0
  212. package/dist/state/AdminProvider.mjs +186 -0
  213. package/dist/state/admin-path.cjs +132 -0
  214. package/dist/state/admin-path.d.cts +101 -0
  215. package/dist/state/admin-path.d.mts +101 -0
  216. package/dist/state/admin-path.mjs +131 -0
  217. package/dist/state/admin-sections.cjs +49 -0
  218. package/dist/state/admin-sections.d.cts +39 -0
  219. package/dist/state/admin-sections.d.mts +39 -0
  220. package/dist/state/admin-sections.mjs +48 -0
  221. package/dist/state/choice-search.cjs +95 -0
  222. package/dist/state/choice-search.mjs +94 -0
  223. package/dist/state/definition.cjs +53 -0
  224. package/dist/state/definition.d.cts +123 -0
  225. package/dist/state/definition.d.mts +123 -0
  226. package/dist/state/definition.mjs +48 -0
  227. package/dist/state/form-data.cjs +266 -0
  228. package/dist/state/form-data.d.cts +123 -0
  229. package/dist/state/form-data.d.mts +123 -0
  230. package/dist/state/form-data.mjs +245 -0
  231. package/dist/state/form-field.cjs +60 -0
  232. package/dist/state/form-field.d.cts +135 -0
  233. package/dist/state/form-field.d.mts +135 -0
  234. package/dist/state/form-field.mjs +56 -0
  235. package/dist/state/form-state.cjs +11 -0
  236. package/dist/state/form-state.d.cts +61 -0
  237. package/dist/state/form-state.d.mts +61 -0
  238. package/dist/state/form-state.mjs +11 -0
  239. package/dist/state/kept-focus.cjs +42 -0
  240. package/dist/state/kept-focus.mjs +41 -0
  241. package/dist/state/list-query.cjs +116 -0
  242. package/dist/state/list-query.d.cts +57 -0
  243. package/dist/state/list-query.d.mts +57 -0
  244. package/dist/state/list-query.mjs +108 -0
  245. package/dist/state/picker.cjs +48 -0
  246. package/dist/state/picker.mjs +47 -0
  247. package/dist/state/sidebar.cjs +15 -0
  248. package/dist/state/sidebar.d.cts +7 -0
  249. package/dist/state/sidebar.d.mts +7 -0
  250. package/dist/state/sidebar.mjs +14 -0
  251. package/dist/state/unsaved-guard.cjs +56 -0
  252. package/dist/state/unsaved-guard.mjs +54 -0
  253. package/dist/state/uploads.cjs +104 -0
  254. package/dist/state/uploads.mjs +102 -0
  255. package/package.json +89 -3
@@ -0,0 +1,79 @@
1
+ "use client";
2
+ require("../_virtual/_rolldown/runtime.cjs");
3
+ const require_icon = require("../controls/icon.cjs");
4
+ const require_Select = require("../controls/Select.cjs");
5
+ const require_FieldFrame = require("./FieldFrame.cjs");
6
+ const require_picker = require("../state/picker.cjs");
7
+ const require_ChipsInput = require("../controls/ChipsInput.cjs");
8
+ let react_jsx_runtime = require("react/jsx-runtime");
9
+ let lucide_react = require("lucide-react");
10
+ let _base_ui_react_combobox = require("@base-ui/react/combobox");
11
+ //#region src/inputs/SelectField.tsx
12
+ const listOf = (value) => Array.isArray(value) ? value : value === void 0 || value === "" ? [] : [value];
13
+ const SelectMany = (props) => {
14
+ const { field } = props;
15
+ const options = field.options ?? [];
16
+ const labels = new Map(options.map((option) => [option.value, option.label]));
17
+ const labelOf = (value) => labels.get(value) ?? value;
18
+ const picker = require_picker.usePicker({ many: true });
19
+ const { reorder, ...chips } = require_ChipsInput.useChipsValue(listOf(props.value));
20
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_combobox.Combobox.Root, {
21
+ items: options.map((option) => option.value),
22
+ multiple: true,
23
+ ...chips,
24
+ itemToStringLabel: labelOf,
25
+ readOnly: field.readOnly,
26
+ ...picker.root,
27
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChipsInput.ChipsInput, {
28
+ label: field.label,
29
+ labelOf,
30
+ placeholder: "None",
31
+ readOnly: field.readOnly,
32
+ clearable: !field.required,
33
+ onReorder: reorder
34
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.Positioner, {
35
+ className: "kz-layer",
36
+ sideOffset: 8,
37
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_combobox.Combobox.Popup, {
38
+ className: "kz-popup kz-menu kz-menu--select",
39
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.Empty, {
40
+ className: "kz-menu__note",
41
+ children: "Nothing matches."
42
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.List, { children: (value) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_combobox.Combobox.Item, {
43
+ value,
44
+ className: "kz-menu__item",
45
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
46
+ className: "kz-menu__label",
47
+ children: labelOf(value)
48
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.ItemIndicator, {
49
+ className: "kz-menu__check",
50
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
51
+ ...require_icon.ICON,
52
+ "aria-hidden": true
53
+ })
54
+ })]
55
+ }, value) })]
56
+ })
57
+ }) })]
58
+ });
59
+ };
60
+ /**
61
+ * Renders a `select` field, with a chip for each choice when it takes several.
62
+ */
63
+ const SelectField = (props) => {
64
+ const { field } = props;
65
+ const options = field.options ?? [];
66
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldFrame.FieldFrame, {
67
+ field,
68
+ children: field.input === "selectMany" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectMany, { ...props }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Select.Select, {
69
+ defaultValue: props.value,
70
+ items: [{
71
+ value: null,
72
+ label: "None"
73
+ }, ...options],
74
+ readOnly: field.readOnly
75
+ })
76
+ });
77
+ };
78
+ //#endregion
79
+ exports.SelectField = SelectField;
@@ -0,0 +1,10 @@
1
+ import { FieldProps } from "./values.cjs";
2
+ import * as _$react from "react";
3
+
4
+ //#region src/inputs/SelectField.d.ts
5
+ /**
6
+ * Renders a `select` field, with a chip for each choice when it takes several.
7
+ */
8
+ declare const SelectField: (props: FieldProps) => _$react.JSX.Element;
9
+ //#endregion
10
+ export { SelectField };
@@ -0,0 +1,10 @@
1
+ import { FieldProps } from "./values.mjs";
2
+ import * as _$react from "react";
3
+
4
+ //#region src/inputs/SelectField.d.ts
5
+ /**
6
+ * Renders a `select` field, with a chip for each choice when it takes several.
7
+ */
8
+ declare const SelectField: (props: FieldProps) => _$react.JSX.Element;
9
+ //#endregion
10
+ export { SelectField };
@@ -0,0 +1,78 @@
1
+ "use client";
2
+ import { ICON } from "../controls/icon.mjs";
3
+ import { Select } from "../controls/Select.mjs";
4
+ import { FieldFrame } from "./FieldFrame.mjs";
5
+ import { usePicker } from "../state/picker.mjs";
6
+ import { ChipsInput, useChipsValue } from "../controls/ChipsInput.mjs";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { CheckIcon } from "lucide-react";
9
+ import { Combobox } from "@base-ui/react/combobox";
10
+ //#region src/inputs/SelectField.tsx
11
+ const listOf = (value) => Array.isArray(value) ? value : value === void 0 || value === "" ? [] : [value];
12
+ const SelectMany = (props) => {
13
+ const { field } = props;
14
+ const options = field.options ?? [];
15
+ const labels = new Map(options.map((option) => [option.value, option.label]));
16
+ const labelOf = (value) => labels.get(value) ?? value;
17
+ const picker = usePicker({ many: true });
18
+ const { reorder, ...chips } = useChipsValue(listOf(props.value));
19
+ return /* @__PURE__ */ jsxs(Combobox.Root, {
20
+ items: options.map((option) => option.value),
21
+ multiple: true,
22
+ ...chips,
23
+ itemToStringLabel: labelOf,
24
+ readOnly: field.readOnly,
25
+ ...picker.root,
26
+ children: [/* @__PURE__ */ jsx(ChipsInput, {
27
+ label: field.label,
28
+ labelOf,
29
+ placeholder: "None",
30
+ readOnly: field.readOnly,
31
+ clearable: !field.required,
32
+ onReorder: reorder
33
+ }), /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(Combobox.Positioner, {
34
+ className: "kz-layer",
35
+ sideOffset: 8,
36
+ children: /* @__PURE__ */ jsxs(Combobox.Popup, {
37
+ className: "kz-popup kz-menu kz-menu--select",
38
+ children: [/* @__PURE__ */ jsx(Combobox.Empty, {
39
+ className: "kz-menu__note",
40
+ children: "Nothing matches."
41
+ }), /* @__PURE__ */ jsx(Combobox.List, { children: (value) => /* @__PURE__ */ jsxs(Combobox.Item, {
42
+ value,
43
+ className: "kz-menu__item",
44
+ children: [/* @__PURE__ */ jsx("span", {
45
+ className: "kz-menu__label",
46
+ children: labelOf(value)
47
+ }), /* @__PURE__ */ jsx(Combobox.ItemIndicator, {
48
+ className: "kz-menu__check",
49
+ children: /* @__PURE__ */ jsx(CheckIcon, {
50
+ ...ICON,
51
+ "aria-hidden": true
52
+ })
53
+ })]
54
+ }, value) })]
55
+ })
56
+ }) })]
57
+ });
58
+ };
59
+ /**
60
+ * Renders a `select` field, with a chip for each choice when it takes several.
61
+ */
62
+ const SelectField = (props) => {
63
+ const { field } = props;
64
+ const options = field.options ?? [];
65
+ return /* @__PURE__ */ jsx(FieldFrame, {
66
+ field,
67
+ children: field.input === "selectMany" ? /* @__PURE__ */ jsx(SelectMany, { ...props }) : /* @__PURE__ */ jsx(Select, {
68
+ defaultValue: props.value,
69
+ items: [{
70
+ value: null,
71
+ label: "None"
72
+ }, ...options],
73
+ readOnly: field.readOnly
74
+ })
75
+ });
76
+ };
77
+ //#endregion
78
+ export { SelectField };
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
3
+ const require_icon = require("../controls/icon.cjs");
4
+ const require_TrailingButton = require("../controls/TrailingButton.cjs");
5
+ const require_FieldFrame = require("./FieldFrame.cjs");
6
+ const require_values = require("./values.cjs");
7
+ let react = require("react");
8
+ let react_jsx_runtime = require("react/jsx-runtime");
9
+ let lucide_react = require("lucide-react");
10
+ let _base_ui_react_input = require("@base-ui/react/input");
11
+ let _sindresorhus_slugify = require("@sindresorhus/slugify");
12
+ _sindresorhus_slugify = require_runtime.__toESM(_sindresorhus_slugify);
13
+ //#region src/inputs/SlugField.tsx
14
+ /**
15
+ * Renders a `slug` field. It turns what is typed into a slug when the input loses focus. While a new document has no
16
+ * slug, it shows the one the CMS will make from the title.
17
+ */
18
+ const SlugField = (props) => {
19
+ const { field } = props;
20
+ const options = field.slug;
21
+ const slugOf = (text) => (0, _sindresorhus_slugify.default)(text, {
22
+ ...options?.locale === void 0 ? {} : { locale: options.locale },
23
+ ...options?.replacements === void 0 ? {} : { customReplacements: options.replacements }
24
+ });
25
+ const input = (0, react.useRef)(null);
26
+ const [value, setValue] = (0, react.useState)(require_values.textOf(props.value));
27
+ const sourceOf = () => {
28
+ const source = options?.generateFrom === void 0 ? void 0 : input.current?.form?.elements.namedItem(options.generateFrom);
29
+ return source instanceof HTMLInputElement || source instanceof HTMLTextAreaElement ? source : void 0;
30
+ };
31
+ const [startedEmpty] = (0, react.useState)(value === "");
32
+ const [madeSlug, setMadeSlug] = (0, react.useState)("");
33
+ (0, react.useEffect)(() => {
34
+ const source = sourceOf();
35
+ if (!startedEmpty || options?.made !== true || source === void 0) return;
36
+ const update = () => setMadeSlug(slugOf(source.value));
37
+ update();
38
+ source.addEventListener("input", update);
39
+ return () => source.removeEventListener("input", update);
40
+ }, []);
41
+ const canRemake = options?.generateFrom !== void 0 && !field.readOnly;
42
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldFrame.FieldFrame, {
43
+ field,
44
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
45
+ className: "kz-affix",
46
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_input.Input, {
47
+ ref: input,
48
+ className: "kz-input",
49
+ value,
50
+ onValueChange: setValue,
51
+ onBlur: () => setValue((current) => slugOf(current)),
52
+ placeholder: madeSlug === "" ? field.placeholder : madeSlug,
53
+ readOnly: field.readOnly,
54
+ spellCheck: false,
55
+ autoCapitalize: "off"
56
+ }), canRemake ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TrailingButton.TrailingButton, {
57
+ label: "Regenerate",
58
+ onClick: () => {
59
+ const source = sourceOf();
60
+ if (source !== void 0) setValue(slugOf(source.value));
61
+ },
62
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.RefreshCwIcon, {
63
+ ...require_icon.ICON,
64
+ "aria-hidden": true
65
+ })
66
+ }) : null]
67
+ })
68
+ });
69
+ };
70
+ //#endregion
71
+ exports.SlugField = SlugField;
@@ -0,0 +1,11 @@
1
+ import { FieldProps } from "./values.cjs";
2
+ import * as _$react from "react";
3
+
4
+ //#region src/inputs/SlugField.d.ts
5
+ /**
6
+ * Renders a `slug` field. It turns what is typed into a slug when the input loses focus. While a new document has no
7
+ * slug, it shows the one the CMS will make from the title.
8
+ */
9
+ declare const SlugField: (props: FieldProps) => _$react.JSX.Element;
10
+ //#endregion
11
+ export { SlugField };
@@ -0,0 +1,11 @@
1
+ import { FieldProps } from "./values.mjs";
2
+ import * as _$react from "react";
3
+
4
+ //#region src/inputs/SlugField.d.ts
5
+ /**
6
+ * Renders a `slug` field. It turns what is typed into a slug when the input loses focus. While a new document has no
7
+ * slug, it shows the one the CMS will make from the title.
8
+ */
9
+ declare const SlugField: (props: FieldProps) => _$react.JSX.Element;
10
+ //#endregion
11
+ export { SlugField };
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ import { ICON } from "../controls/icon.mjs";
3
+ import { TrailingButton } from "../controls/TrailingButton.mjs";
4
+ import { FieldFrame } from "./FieldFrame.mjs";
5
+ import { textOf } from "./values.mjs";
6
+ import { useEffect, useRef, useState } from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { RefreshCwIcon } from "lucide-react";
9
+ import { Input } from "@base-ui/react/input";
10
+ import slugify from "@sindresorhus/slugify";
11
+ //#region src/inputs/SlugField.tsx
12
+ /**
13
+ * Renders a `slug` field. It turns what is typed into a slug when the input loses focus. While a new document has no
14
+ * slug, it shows the one the CMS will make from the title.
15
+ */
16
+ const SlugField = (props) => {
17
+ const { field } = props;
18
+ const options = field.slug;
19
+ const slugOf = (text) => slugify(text, {
20
+ ...options?.locale === void 0 ? {} : { locale: options.locale },
21
+ ...options?.replacements === void 0 ? {} : { customReplacements: options.replacements }
22
+ });
23
+ const input = useRef(null);
24
+ const [value, setValue] = useState(textOf(props.value));
25
+ const sourceOf = () => {
26
+ const source = options?.generateFrom === void 0 ? void 0 : input.current?.form?.elements.namedItem(options.generateFrom);
27
+ return source instanceof HTMLInputElement || source instanceof HTMLTextAreaElement ? source : void 0;
28
+ };
29
+ const [startedEmpty] = useState(value === "");
30
+ const [madeSlug, setMadeSlug] = useState("");
31
+ useEffect(() => {
32
+ const source = sourceOf();
33
+ if (!startedEmpty || options?.made !== true || source === void 0) return;
34
+ const update = () => setMadeSlug(slugOf(source.value));
35
+ update();
36
+ source.addEventListener("input", update);
37
+ return () => source.removeEventListener("input", update);
38
+ }, []);
39
+ const canRemake = options?.generateFrom !== void 0 && !field.readOnly;
40
+ return /* @__PURE__ */ jsx(FieldFrame, {
41
+ field,
42
+ children: /* @__PURE__ */ jsxs("div", {
43
+ className: "kz-affix",
44
+ children: [/* @__PURE__ */ jsx(Input, {
45
+ ref: input,
46
+ className: "kz-input",
47
+ value,
48
+ onValueChange: setValue,
49
+ onBlur: () => setValue((current) => slugOf(current)),
50
+ placeholder: madeSlug === "" ? field.placeholder : madeSlug,
51
+ readOnly: field.readOnly,
52
+ spellCheck: false,
53
+ autoCapitalize: "off"
54
+ }), canRemake ? /* @__PURE__ */ jsx(TrailingButton, {
55
+ label: "Regenerate",
56
+ onClick: () => {
57
+ const source = sourceOf();
58
+ if (source !== void 0) setValue(slugOf(source.value));
59
+ },
60
+ children: /* @__PURE__ */ jsx(RefreshCwIcon, {
61
+ ...ICON,
62
+ "aria-hidden": true
63
+ })
64
+ }) : null]
65
+ })
66
+ });
67
+ };
68
+ //#endregion
69
+ export { SlugField };
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ require("../_virtual/_rolldown/runtime.cjs");
3
+ const require_Affixed = require("./Affixed.cjs");
4
+ const require_values = require("./values.cjs");
5
+ let clsx = require("clsx");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ let _base_ui_react_input = require("@base-ui/react/input");
8
+ //#region src/inputs/TextBox.tsx
9
+ /**
10
+ * Renders a field's one-line text input, with its prefix and suffix.
11
+ */
12
+ const TextBox = (props) => {
13
+ const literal = props.literal === true || props.inputMode === "url" || props.inputMode === "email";
14
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Affixed.Affixed, {
15
+ field: props.field,
16
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_input.Input, {
17
+ type: props.type ?? "text",
18
+ inputMode: props.inputMode,
19
+ className: (0, clsx.clsx)(require_Affixed.inputClassOf(props.field), props.literal === true && "kz-code"),
20
+ defaultValue: require_values.textOf(props.value),
21
+ placeholder: props.field.placeholder,
22
+ readOnly: props.field.readOnly,
23
+ spellCheck: literal ? false : void 0,
24
+ autoCapitalize: literal ? "off" : void 0
25
+ })
26
+ });
27
+ };
28
+ /**
29
+ * Renders a field's text box of several lines.
30
+ */
31
+ const TextAreaBox = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_input.Input, {
32
+ className: (0, clsx.clsx)("kz-input", props.code === true && "kz-code"),
33
+ render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", { rows: props.rows }),
34
+ defaultValue: require_values.textOf(props.value),
35
+ placeholder: props.field.placeholder,
36
+ readOnly: props.field.readOnly,
37
+ spellCheck: props.code !== true
38
+ });
39
+ //#endregion
40
+ exports.TextAreaBox = TextAreaBox;
41
+ exports.TextBox = TextBox;
@@ -0,0 +1,35 @@
1
+ import { FieldProps } from "./values.cjs";
2
+ import * as _$react from "react";
3
+ import { HTMLAttributes } from "react";
4
+
5
+ //#region src/inputs/TextBox.d.ts
6
+ /**
7
+ * Renders a field's one-line text input, with its prefix and suffix.
8
+ */
9
+ declare const TextBox: (props: FieldProps & {
10
+ /**
11
+ * @default 'text'
12
+ */
13
+ type?: "text" | "date";
14
+ inputMode?: HTMLAttributes<HTMLInputElement>["inputMode"];
15
+ /**
16
+ * Shows the value as code, without spell checking.
17
+ *
18
+ * @default false
19
+ */
20
+ literal?: boolean;
21
+ }) => _$react.JSX.Element;
22
+ /**
23
+ * Renders a field's text box of several lines.
24
+ */
25
+ declare const TextAreaBox: (props: FieldProps & {
26
+ rows: number;
27
+ /**
28
+ * Shows the value as code, without spell checking.
29
+ *
30
+ * @default false
31
+ */
32
+ code?: boolean;
33
+ }) => _$react.JSX.Element;
34
+ //#endregion
35
+ export { TextAreaBox, TextBox };
@@ -0,0 +1,35 @@
1
+ import { FieldProps } from "./values.mjs";
2
+ import * as _$react from "react";
3
+ import { HTMLAttributes } from "react";
4
+
5
+ //#region src/inputs/TextBox.d.ts
6
+ /**
7
+ * Renders a field's one-line text input, with its prefix and suffix.
8
+ */
9
+ declare const TextBox: (props: FieldProps & {
10
+ /**
11
+ * @default 'text'
12
+ */
13
+ type?: "text" | "date";
14
+ inputMode?: HTMLAttributes<HTMLInputElement>["inputMode"];
15
+ /**
16
+ * Shows the value as code, without spell checking.
17
+ *
18
+ * @default false
19
+ */
20
+ literal?: boolean;
21
+ }) => _$react.JSX.Element;
22
+ /**
23
+ * Renders a field's text box of several lines.
24
+ */
25
+ declare const TextAreaBox: (props: FieldProps & {
26
+ rows: number;
27
+ /**
28
+ * Shows the value as code, without spell checking.
29
+ *
30
+ * @default false
31
+ */
32
+ code?: boolean;
33
+ }) => _$react.JSX.Element;
34
+ //#endregion
35
+ export { TextAreaBox, TextBox };
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import { Affixed, inputClassOf } from "./Affixed.mjs";
3
+ import { textOf } from "./values.mjs";
4
+ import { clsx } from "clsx";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { Input } from "@base-ui/react/input";
7
+ //#region src/inputs/TextBox.tsx
8
+ /**
9
+ * Renders a field's one-line text input, with its prefix and suffix.
10
+ */
11
+ const TextBox = (props) => {
12
+ const literal = props.literal === true || props.inputMode === "url" || props.inputMode === "email";
13
+ return /* @__PURE__ */ jsx(Affixed, {
14
+ field: props.field,
15
+ children: /* @__PURE__ */ jsx(Input, {
16
+ type: props.type ?? "text",
17
+ inputMode: props.inputMode,
18
+ className: clsx(inputClassOf(props.field), props.literal === true && "kz-code"),
19
+ defaultValue: textOf(props.value),
20
+ placeholder: props.field.placeholder,
21
+ readOnly: props.field.readOnly,
22
+ spellCheck: literal ? false : void 0,
23
+ autoCapitalize: literal ? "off" : void 0
24
+ })
25
+ });
26
+ };
27
+ /**
28
+ * Renders a field's text box of several lines.
29
+ */
30
+ const TextAreaBox = (props) => /* @__PURE__ */ jsx(Input, {
31
+ className: clsx("kz-input", props.code === true && "kz-code"),
32
+ render: /* @__PURE__ */ jsx("textarea", { rows: props.rows }),
33
+ defaultValue: textOf(props.value),
34
+ placeholder: props.field.placeholder,
35
+ readOnly: props.field.readOnly,
36
+ spellCheck: props.code !== true
37
+ });
38
+ //#endregion
39
+ export { TextAreaBox, TextBox };
@@ -0,0 +1,61 @@
1
+ "use client";
2
+ require("../_virtual/_rolldown/runtime.cjs");
3
+ const require_FieldFrame = require("./FieldFrame.cjs");
4
+ const require_values = require("./values.cjs");
5
+ const require_TextBox = require("./TextBox.cjs");
6
+ const require_Counter = require("../controls/Counter.cjs");
7
+ const require_FallbackReset = require("./FallbackReset.cjs");
8
+ const require_TitleField = require("./TitleField.cjs");
9
+ let react = require("react");
10
+ let clsx = require("clsx");
11
+ let react_jsx_runtime = require("react/jsx-runtime");
12
+ let _base_ui_react_input = require("@base-ui/react/input");
13
+ //#region src/inputs/TextField.tsx
14
+ /**
15
+ * Renders a text field that counts its characters, falls back to another field's value, or both.
16
+ */
17
+ const WatchedTextField = (props) => {
18
+ const { field } = props;
19
+ const [value, setValue] = (0, react.useState)(require_values.textOf(props.value));
20
+ const counted = value === "" ? field.placeholder ?? "" : value;
21
+ const falls = require_FallbackReset.fallsBack(field);
22
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldFrame.FieldFrame, {
23
+ field,
24
+ ...field.showsInFull === void 0 ? {} : { aside: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Counter.Counter, {
25
+ count: counted.length,
26
+ limit: field.showsInFull
27
+ }) },
28
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
29
+ className: (0, clsx.clsx)(falls && "kz-affix"),
30
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_input.Input, {
31
+ className: "kz-input",
32
+ ...field.input === "textarea" ? { render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", { rows: 3 }) } : {},
33
+ value,
34
+ onValueChange: setValue,
35
+ placeholder: field.placeholder,
36
+ readOnly: field.readOnly
37
+ }), falls ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FallbackReset.FallbackReset, {
38
+ field,
39
+ value,
40
+ onReset: () => setValue("")
41
+ }) : null]
42
+ })
43
+ });
44
+ };
45
+ /**
46
+ * Renders a `text` field, on one line or several.
47
+ */
48
+ const TextField = (props) => {
49
+ const { field } = props;
50
+ if (field.ending !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TitleField.TitleField, { ...props });
51
+ if (field.showsInFull !== void 0 || require_FallbackReset.fallsBack(field)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WatchedTextField, { ...props });
52
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldFrame.FieldFrame, {
53
+ field,
54
+ children: field.input === "textarea" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TextBox.TextAreaBox, {
55
+ ...props,
56
+ rows: 3
57
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TextBox.TextBox, { ...props })
58
+ });
59
+ };
60
+ //#endregion
61
+ exports.TextField = TextField;
@@ -0,0 +1,10 @@
1
+ import { FieldProps } from "./values.cjs";
2
+ import * as _$react from "react";
3
+
4
+ //#region src/inputs/TextField.d.ts
5
+ /**
6
+ * Renders a `text` field, on one line or several.
7
+ */
8
+ declare const TextField: (props: FieldProps) => _$react.JSX.Element;
9
+ //#endregion
10
+ export { TextField };
@@ -0,0 +1,10 @@
1
+ import { FieldProps } from "./values.mjs";
2
+ import * as _$react from "react";
3
+
4
+ //#region src/inputs/TextField.d.ts
5
+ /**
6
+ * Renders a `text` field, on one line or several.
7
+ */
8
+ declare const TextField: (props: FieldProps) => _$react.JSX.Element;
9
+ //#endregion
10
+ export { TextField };
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { FieldFrame } from "./FieldFrame.mjs";
3
+ import { textOf } from "./values.mjs";
4
+ import { TextAreaBox, TextBox } from "./TextBox.mjs";
5
+ import { Counter } from "../controls/Counter.mjs";
6
+ import { FallbackReset, fallsBack } from "./FallbackReset.mjs";
7
+ import { TitleField } from "./TitleField.mjs";
8
+ import { useState } from "react";
9
+ import { clsx } from "clsx";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ import { Input } from "@base-ui/react/input";
12
+ //#region src/inputs/TextField.tsx
13
+ /**
14
+ * Renders a text field that counts its characters, falls back to another field's value, or both.
15
+ */
16
+ const WatchedTextField = (props) => {
17
+ const { field } = props;
18
+ const [value, setValue] = useState(textOf(props.value));
19
+ const counted = value === "" ? field.placeholder ?? "" : value;
20
+ const falls = fallsBack(field);
21
+ return /* @__PURE__ */ jsx(FieldFrame, {
22
+ field,
23
+ ...field.showsInFull === void 0 ? {} : { aside: /* @__PURE__ */ jsx(Counter, {
24
+ count: counted.length,
25
+ limit: field.showsInFull
26
+ }) },
27
+ children: /* @__PURE__ */ jsxs("div", {
28
+ className: clsx(falls && "kz-affix"),
29
+ children: [/* @__PURE__ */ jsx(Input, {
30
+ className: "kz-input",
31
+ ...field.input === "textarea" ? { render: /* @__PURE__ */ jsx("textarea", { rows: 3 }) } : {},
32
+ value,
33
+ onValueChange: setValue,
34
+ placeholder: field.placeholder,
35
+ readOnly: field.readOnly
36
+ }), falls ? /* @__PURE__ */ jsx(FallbackReset, {
37
+ field,
38
+ value,
39
+ onReset: () => setValue("")
40
+ }) : null]
41
+ })
42
+ });
43
+ };
44
+ /**
45
+ * Renders a `text` field, on one line or several.
46
+ */
47
+ const TextField = (props) => {
48
+ const { field } = props;
49
+ if (field.ending !== void 0) return /* @__PURE__ */ jsx(TitleField, { ...props });
50
+ if (field.showsInFull !== void 0 || fallsBack(field)) return /* @__PURE__ */ jsx(WatchedTextField, { ...props });
51
+ return /* @__PURE__ */ jsx(FieldFrame, {
52
+ field,
53
+ children: field.input === "textarea" ? /* @__PURE__ */ jsx(TextAreaBox, {
54
+ ...props,
55
+ rows: 3
56
+ }) : /* @__PURE__ */ jsx(TextBox, { ...props })
57
+ });
58
+ };
59
+ //#endregion
60
+ export { TextField };