dn-react-router-toolkit 0.5.8 → 0.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.
Files changed (71) hide show
  1. package/dist/auth/cookie_store.d.mts +1 -1
  2. package/dist/auth/cookie_store.d.ts +1 -1
  3. package/dist/auth/cookie_store.js +4 -4
  4. package/dist/auth/cookie_store.mjs +4 -4
  5. package/dist/auth/index.js +4 -4
  6. package/dist/auth/index.mjs +4 -4
  7. package/dist/client/env_loader.d.mts +2 -2
  8. package/dist/client/env_loader.d.ts +2 -2
  9. package/dist/client/file_input.d.mts +10 -0
  10. package/dist/client/file_input.d.ts +10 -0
  11. package/dist/client/file_input.js +80 -0
  12. package/dist/client/file_input.mjs +45 -0
  13. package/dist/client/index.d.mts +4 -0
  14. package/dist/client/index.d.ts +4 -0
  15. package/dist/client/index.js +104 -0
  16. package/dist/client/index.mjs +102 -0
  17. package/dist/client/store_text_editor.d.mts +13 -0
  18. package/dist/client/store_text_editor.d.ts +13 -0
  19. package/dist/client/store_text_editor.js +94 -0
  20. package/dist/client/store_text_editor.mjs +59 -0
  21. package/dist/crud/crud_form.d.mts +4 -6
  22. package/dist/crud/crud_form.d.ts +4 -6
  23. package/dist/crud/crud_form.js +147 -100
  24. package/dist/crud/crud_form.mjs +148 -106
  25. package/dist/crud/crud_form_provider.d.mts +10 -10
  26. package/dist/crud/crud_form_provider.d.ts +10 -10
  27. package/dist/crud/crud_form_provider.js +5 -6
  28. package/dist/crud/crud_form_provider.mjs +4 -5
  29. package/dist/crud/crud_page.d.mts +8 -8
  30. package/dist/crud/crud_page.d.ts +8 -8
  31. package/dist/crud/crud_page.js +203 -160
  32. package/dist/crud/crud_page.mjs +200 -162
  33. package/dist/crud/generate_pages.d.mts +3 -3
  34. package/dist/crud/generate_pages.d.ts +3 -3
  35. package/dist/crud/index.d.mts +1 -1
  36. package/dist/crud/index.d.ts +1 -1
  37. package/dist/crud/index.js +256 -213
  38. package/dist/crud/index.mjs +240 -202
  39. package/dist/form/create_form_component.d.mts +28 -0
  40. package/dist/form/create_form_component.d.ts +28 -0
  41. package/dist/form/create_form_component.js +47 -0
  42. package/dist/form/create_form_component.mjs +12 -0
  43. package/dist/form/form_components.d.mts +7 -0
  44. package/dist/form/form_components.d.ts +7 -0
  45. package/dist/form/form_components.js +64 -0
  46. package/dist/form/form_components.mjs +25 -0
  47. package/dist/form/index.d.mts +3 -0
  48. package/dist/form/index.d.ts +3 -0
  49. package/dist/form/index.js +66 -0
  50. package/dist/form/index.mjs +26 -0
  51. package/dist/post/index.d.mts +2 -0
  52. package/dist/post/index.d.ts +2 -0
  53. package/dist/post/index.js +33 -0
  54. package/dist/post/index.mjs +4 -0
  55. package/dist/post/thumbnail_picker.d.mts +18 -0
  56. package/dist/post/thumbnail_picker.d.ts +18 -0
  57. package/dist/post/thumbnail_picker.js +101 -0
  58. package/dist/post/thumbnail_picker.mjs +70 -0
  59. package/dist/seo/seo.d.mts +2 -2
  60. package/dist/seo/seo.d.ts +2 -2
  61. package/dist/table/buttons.d.mts +2 -2
  62. package/dist/table/buttons.d.ts +2 -2
  63. package/dist/table/index.js +44 -47
  64. package/dist/table/index.mjs +44 -47
  65. package/dist/table/page.d.mts +5 -7
  66. package/dist/table/page.d.ts +5 -7
  67. package/dist/table/page.js +44 -47
  68. package/dist/table/page.mjs +44 -47
  69. package/dist/table/table.d.mts +4 -4
  70. package/dist/table/table.d.ts +4 -4
  71. package/package.json +14 -2
@@ -1,6 +1,6 @@
1
1
  // src/crud/crud_form_provider.tsx
2
2
  import { useNavigate } from "react-router";
3
- import { useStore } from "dn-react-toolkit/store";
3
+ import { useStore } from "react-store-input";
4
4
  import { createContext, useContext } from "react";
5
5
  import React from "react";
6
6
  var FormContext = createContext({});
@@ -66,10 +66,9 @@ function CrudFormProvider({
66
66
  return value2.map((v) => converter(v));
67
67
  }
68
68
  if (typeof value2 === "object") {
69
- return Object.entries(value2).reduce(
70
- reducer,
71
- {}
72
- );
69
+ return Object.entries(
70
+ value2
71
+ ).reduce(reducer, {});
73
72
  }
74
73
  };
75
74
  return {
@@ -117,119 +116,161 @@ function CrudFormProvider({
117
116
  }
118
117
 
119
118
  // src/crud/crud_form.tsx
120
- import {
121
- SyncInput,
122
- SyncSelect,
123
- SyncSwitch,
124
- useSyncTextEditor
125
- } from "dn-react-toolkit/store";
119
+ import React6 from "react";
120
+ import { createTextEditor } from "dn-react-text-editor";
121
+ import { Input, Select } from "react-store-input";
122
+
123
+ // src/client/env_loader.tsx
126
124
  import React2 from "react";
127
- import { moment } from "dn-react-toolkit/utils";
128
- import { createTextEditor } from "dn-react-toolkit/text_editor";
129
- var textarea = createTextEditor();
130
- function CrudForm({ AdminLayout }) {
125
+ import { useRouteLoaderData } from "react-router";
126
+
127
+ // src/client/file_input.tsx
128
+ import "react";
129
+ import React3 from "react";
130
+
131
+ // src/client/use_user_agent.tsx
132
+ import { useRouteLoaderData as useRouteLoaderData2 } from "react-router";
133
+
134
+ // src/client/store_text_editor.tsx
135
+ import "dn-react-text-editor";
136
+ import { useStoreController } from "react-store-input";
137
+ import React4 from "react";
138
+ function createStoreTextEditor(TextEditor2) {
139
+ function StoreComponent({
140
+ store,
141
+ name,
142
+ defaultValue,
143
+ ...props
144
+ }) {
145
+ const { ref, onChange } = useStoreController(
146
+ store,
147
+ {
148
+ ref: props.ref,
149
+ onSubscribe: (state, element) => {
150
+ const result = (props.getter ? props.getter(state) : name ? state[name] : "") || "";
151
+ if (element.value !== result) {
152
+ element.value = result;
153
+ }
154
+ },
155
+ onDispatch: (state, element) => {
156
+ if (props.setter) {
157
+ props.setter(state, element.value);
158
+ return;
159
+ }
160
+ if (name) {
161
+ state[name] = element.value;
162
+ }
163
+ }
164
+ }
165
+ );
166
+ const getDefaultValue = () => {
167
+ if (props.getter) {
168
+ return props.getter(store.state);
169
+ }
170
+ if (name) {
171
+ return store.state[name];
172
+ }
173
+ return void 0;
174
+ };
175
+ return /* @__PURE__ */ React4.createElement(
176
+ TextEditor2,
177
+ {
178
+ ...props,
179
+ ref,
180
+ defaultValue: defaultValue ?? getDefaultValue(),
181
+ onChange: (e) => {
182
+ onChange();
183
+ props.onChange?.(e);
184
+ }
185
+ }
186
+ );
187
+ }
188
+ return StoreComponent;
189
+ }
190
+
191
+ // src/form/create_form_component.tsx
192
+ import { cn } from "dn-react-toolkit/utils";
193
+ import React5 from "react";
194
+ function createComponent(tag, options) {
195
+ return function FormComponent({ className, ...props }) {
196
+ const Tag = tag;
197
+ return /* @__PURE__ */ React5.createElement(Tag, { ...props, className: cn(options.className, className) });
198
+ };
199
+ }
200
+
201
+ // src/form/form_components.tsx
202
+ var FormEntry = createComponent("div", {
203
+ className: "flex-1"
204
+ });
205
+ var FormRow = createComponent("div", {
206
+ className: "flex-1 flex gap-4 mb-6"
207
+ });
208
+ var FormLabel = createComponent("label", {
209
+ className: "flex-1 font-semibold mb-2.5 block"
210
+ });
211
+
212
+ // src/crud/crud_form.tsx
213
+ var TextEditor = createStoreTextEditor(createTextEditor());
214
+ function CrudForm({ AdminHeader }) {
131
215
  const form = useFormContext();
132
- return /* @__PURE__ */ React2.createElement(
133
- AdminLayout,
216
+ return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
217
+ AdminHeader,
134
218
  {
135
219
  title: `${form.name} ${form.item ? "\uC218\uC815" : "\uCD94\uAC00"}`,
136
- actions: /* @__PURE__ */ React2.createElement("button", { type: "button", className: "button-primary", onClick: form.submit }, "\uC800\uC7A5\uD558\uAE30"),
137
- className: "max-w-3xl mx-auto"
138
- },
139
- Object.keys(form.columns).length > 0 && /* @__PURE__ */ React2.createElement(React2.Fragment, null, Object.entries(
140
- form.columns
141
- ).map(([key, value]) => {
142
- const createComponent = () => {
143
- if (value.component) {
144
- return /* @__PURE__ */ React2.createElement(value.component, { store: form.store, property: key });
145
- }
146
- if (value.type === "checkbox") {
147
- return /* @__PURE__ */ React2.createElement(SyncSwitch, { store: form.store, property: key });
148
- }
149
- if (value.type === "number") {
150
- return /* @__PURE__ */ React2.createElement(
151
- SyncInput,
152
- {
153
- store: form.store,
154
- property: key,
155
- className: "input-form",
156
- type: "number",
157
- serializer: (value2) => {
158
- if (value2 === void 0 || value2 === null) {
159
- return "";
160
- }
161
- return String(value2);
162
- },
163
- deserializer: (value2) => {
164
- const parsed = Number(value2);
165
- if (isNaN(parsed)) {
166
- return void 0;
167
- }
168
- return parsed;
169
- }
170
- }
171
- );
172
- }
173
- if (value.type === "datetime") {
174
- return /* @__PURE__ */ React2.createElement(
175
- SyncInput,
176
- {
177
- store: form.store,
178
- property: key,
179
- className: "input-form",
180
- type: "datetime-local",
181
- serializer: (value2) => {
182
- if (value2 instanceof Date) {
183
- return moment(value2).toISOString(true).slice(0, 16);
184
- }
185
- return String(value2);
186
- },
187
- deserializer: (value2) => {
188
- if (!value2) {
189
- return void 0;
190
- }
191
- return moment(value2).toDate();
192
- }
193
- }
194
- );
195
- }
196
- if (value.type === "textarea") {
197
- const Editor = useSyncTextEditor(textarea);
198
- return /* @__PURE__ */ React2.createElement(
199
- Editor.SyncTextEditor,
200
- {
201
- store: form.store,
202
- property: key
203
- }
204
- );
205
- }
206
- if (value.options) {
207
- const Component = value.options;
208
- return /* @__PURE__ */ React2.createElement(SyncSelect, { store: form.store, property: key }, /* @__PURE__ */ React2.createElement(Component, null));
209
- }
210
- return /* @__PURE__ */ React2.createElement(
211
- SyncInput,
220
+ actions: /* @__PURE__ */ React6.createElement(
221
+ "button",
222
+ {
223
+ type: "button",
224
+ className: "button-primary",
225
+ onClick: form.submit
226
+ },
227
+ "\uC800\uC7A5\uD558\uAE30"
228
+ )
229
+ }
230
+ ), /* @__PURE__ */ React6.createElement("div", { className: "max-w-2xl mx-auto" }, Object.keys(form.columns).length > 0 && /* @__PURE__ */ React6.createElement(React6.Fragment, null, Object.entries(
231
+ form.columns
232
+ ).map(([key, value]) => {
233
+ function InputComponent() {
234
+ if (value.type === "textarea") {
235
+ return /* @__PURE__ */ React6.createElement(TextEditor, { store: form.store, name: key });
236
+ }
237
+ if (value.options) {
238
+ const Component = value.options;
239
+ return /* @__PURE__ */ React6.createElement(
240
+ Select,
212
241
  {
213
242
  store: form.store,
214
- property: key,
215
- type: value.type,
216
- className: "input-form"
217
- }
243
+ name: key,
244
+ className: "select-form"
245
+ },
246
+ /* @__PURE__ */ React6.createElement(Component, null)
218
247
  );
219
- };
220
- return /* @__PURE__ */ React2.createElement("label", { key }, value.label, createComponent());
221
- })),
222
- form.item && /* @__PURE__ */ React2.createElement(
223
- "button",
224
- {
225
- className: "button-dangerous mt-8",
226
- onClick: () => {
227
- form.delete();
248
+ }
249
+ return /* @__PURE__ */ React6.createElement(
250
+ Input,
251
+ {
252
+ store: form.store,
253
+ name: key,
254
+ type: value.type,
255
+ className: "input-form"
228
256
  }
229
- },
230
- "\uC0AD\uC81C\uD558\uAE30"
231
- )
232
- );
257
+ );
258
+ }
259
+ const v = form.store.state[key];
260
+ if (typeof v === "boolean") {
261
+ return /* @__PURE__ */ React6.createElement("div", { className: "flex" }, value.label, /* @__PURE__ */ React6.createElement("div", { className: "ml-auto" }, /* @__PURE__ */ React6.createElement(InputComponent, null)));
262
+ }
263
+ return /* @__PURE__ */ React6.createElement(FormRow, null, /* @__PURE__ */ React6.createElement(FormEntry, null, /* @__PURE__ */ React6.createElement(FormLabel, { key }, value.label), /* @__PURE__ */ React6.createElement(InputComponent, null)));
264
+ })), form.item && /* @__PURE__ */ React6.createElement(
265
+ "button",
266
+ {
267
+ className: "button-dangerous mt-8",
268
+ onClick: () => {
269
+ form.delete();
270
+ }
271
+ },
272
+ "\uC0AD\uC81C\uD558\uAE30"
273
+ )));
233
274
  }
234
275
 
235
276
  // src/table/loader.tsx
@@ -530,10 +571,10 @@ import {
530
571
  } from "react-router";
531
572
 
532
573
  // node_modules/react-icons/lib/iconBase.mjs
533
- import React4 from "react";
574
+ import React8 from "react";
534
575
 
535
576
  // node_modules/react-icons/lib/iconContext.mjs
536
- import React3 from "react";
577
+ import React7 from "react";
537
578
  var DefaultContext = {
538
579
  color: void 0,
539
580
  size: void 0,
@@ -541,7 +582,7 @@ var DefaultContext = {
541
582
  style: void 0,
542
583
  attr: void 0
543
584
  };
544
- var IconContext = React3.createContext && /* @__PURE__ */ React3.createContext(DefaultContext);
585
+ var IconContext = React7.createContext && /* @__PURE__ */ React7.createContext(DefaultContext);
545
586
 
546
587
  // node_modules/react-icons/lib/iconBase.mjs
547
588
  var _excluded = ["attr", "size", "title"];
@@ -630,12 +671,12 @@ function _toPrimitive(t, r) {
630
671
  return ("string" === r ? String : Number)(t);
631
672
  }
632
673
  function Tree2Element(tree) {
633
- return tree && tree.map((node, i) => /* @__PURE__ */ React4.createElement(node.tag, _objectSpread({
674
+ return tree && tree.map((node, i) => /* @__PURE__ */ React8.createElement(node.tag, _objectSpread({
634
675
  key: i
635
676
  }, node.attr), Tree2Element(node.child)));
636
677
  }
637
678
  function GenIcon(data) {
638
- return (props) => /* @__PURE__ */ React4.createElement(IconBase, _extends({
679
+ return (props) => /* @__PURE__ */ React8.createElement(IconBase, _extends({
639
680
  attr: _objectSpread({}, data.attr)
640
681
  }, props), Tree2Element(data.child));
641
682
  }
@@ -650,7 +691,7 @@ function IconBase(props) {
650
691
  var className;
651
692
  if (conf.className) className = conf.className;
652
693
  if (props.className) className = (className ? className + " " : "") + props.className;
653
- return /* @__PURE__ */ React4.createElement("svg", _extends({
694
+ return /* @__PURE__ */ React8.createElement("svg", _extends({
654
695
  stroke: "currentColor",
655
696
  fill: "currentColor",
656
697
  strokeWidth: "0"
@@ -662,9 +703,9 @@ function IconBase(props) {
662
703
  height: computedSize,
663
704
  width: computedSize,
664
705
  xmlns: "http://www.w3.org/2000/svg"
665
- }), title && /* @__PURE__ */ React4.createElement("title", null, title), props.children);
706
+ }), title && /* @__PURE__ */ React8.createElement("title", null, title), props.children);
666
707
  };
667
- return IconContext !== void 0 ? /* @__PURE__ */ React4.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
708
+ return IconContext !== void 0 ? /* @__PURE__ */ React8.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
668
709
  }
669
710
 
670
711
  // node_modules/react-icons/go/index.mjs
@@ -679,9 +720,9 @@ function GoSearch(props) {
679
720
  }
680
721
 
681
722
  // src/table/buttons.tsx
682
- import { cn } from "dn-react-toolkit/utils";
723
+ import { cn as cn2 } from "dn-react-toolkit/utils";
683
724
  import { Link, useLocation, useSearchParams } from "react-router";
684
- import React5 from "react";
725
+ import React9 from "react";
685
726
  function TablePageButtons({
686
727
  MAX_PAGES_TO_SHOW,
687
728
  total,
@@ -694,7 +735,7 @@ function TablePageButtons({
694
735
  const currentPage = Math.floor(offset / limit) + 1;
695
736
  const startButton = (Math.ceil(currentPage / MAX_PAGES_TO_SHOW) - 1) * MAX_PAGES_TO_SHOW;
696
737
  const endButton = Math.min(startButton + MAX_PAGES_TO_SHOW - 1, pages);
697
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, pages > 1 && /* @__PURE__ */ React5.createElement("div", { className: "flex justify-center items-center my-8 gap-4 text-neutral-400" }, startButton > 1 && /* @__PURE__ */ React5.createElement(
738
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, pages > 1 && /* @__PURE__ */ React9.createElement("div", { className: "flex justify-center items-center my-8 gap-4 text-neutral-400" }, startButton > 1 && /* @__PURE__ */ React9.createElement(
698
739
  Link,
699
740
  {
700
741
  to: (() => {
@@ -713,7 +754,7 @@ function TablePageButtons({
713
754
  pages - startButton
714
755
  )
715
756
  }).map((_, index2) => {
716
- return /* @__PURE__ */ React5.createElement(
757
+ return /* @__PURE__ */ React9.createElement(
717
758
  Link,
718
759
  {
719
760
  key: index2,
@@ -724,14 +765,14 @@ function TablePageButtons({
724
765
  );
725
766
  return `${pathname}?${searchParams.toString()}`;
726
767
  })(),
727
- className: cn(
768
+ className: cn2(
728
769
  "w-6 block text-center transition-colors",
729
770
  currentPage === startButton + index2 + 1 ? "font-bold text-primary" : "hover:text-primary"
730
771
  )
731
772
  },
732
773
  startButton + index2 + 1
733
774
  );
734
- }), endButton < pages && /* @__PURE__ */ React5.createElement(
775
+ }), endButton < pages && /* @__PURE__ */ React9.createElement(
735
776
  Link,
736
777
  {
737
778
  to: (() => {
@@ -748,9 +789,9 @@ function TablePageButtons({
748
789
  }
749
790
 
750
791
  // src/table/table.tsx
751
- import { cn as cn2 } from "dn-react-toolkit/utils";
792
+ import { cn as cn3 } from "dn-react-toolkit/utils";
752
793
  import { Link as Link2, useSearchParams as useSearchParams2 } from "react-router";
753
- import React6 from "react";
794
+ import React10 from "react";
754
795
  function Table({
755
796
  className = "min-w-full whitespace-nowrap",
756
797
  data,
@@ -765,15 +806,15 @@ function Table({
765
806
  const keys = Object.entries(columns).filter((entry) => entry[1]).map(([key]) => key);
766
807
  const sortedArray = [...data];
767
808
  const [_, setSearchParams] = useSearchParams2();
768
- return /* @__PURE__ */ React6.createElement(
809
+ return /* @__PURE__ */ React10.createElement(
769
810
  "table",
770
811
  {
771
- className: cn2(
812
+ className: cn3(
772
813
  className,
773
814
  "text-[15px] border-separate border-spacing-0"
774
815
  )
775
816
  },
776
- /* @__PURE__ */ React6.createElement("thead", null, /* @__PURE__ */ React6.createElement("tr", null, keys.map((key) => {
817
+ /* @__PURE__ */ React10.createElement("thead", null, /* @__PURE__ */ React10.createElement("tr", null, keys.map((key) => {
777
818
  const value = columns[key];
778
819
  function getReactNode() {
779
820
  if (value && typeof value === "object" && "label" in value) {
@@ -784,10 +825,10 @@ function Table({
784
825
  function Head() {
785
826
  const reactNode = getReactNode();
786
827
  if (typeof reactNode === "string") {
787
- return /* @__PURE__ */ React6.createElement(
828
+ return /* @__PURE__ */ React10.createElement(
788
829
  "button",
789
830
  {
790
- className: cn2(
831
+ className: cn3(
791
832
  orderBy === key ? "text-neutral-900 font-medium" : "text-neutral-500",
792
833
  "px-4 h-14 flex items-center w-full"
793
834
  ),
@@ -803,28 +844,28 @@ function Table({
803
844
  }
804
845
  },
805
846
  reactNode,
806
- orderBy === key && /* @__PURE__ */ React6.createElement("div", { className: "ml-0.5" }, direction === "asc" ? /* @__PURE__ */ React6.createElement(GoArrowUp, null) : /* @__PURE__ */ React6.createElement(GoArrowDown, null))
847
+ orderBy === key && /* @__PURE__ */ React10.createElement("div", { className: "ml-0.5" }, direction === "asc" ? /* @__PURE__ */ React10.createElement(GoArrowUp, null) : /* @__PURE__ */ React10.createElement(GoArrowDown, null))
807
848
  );
808
849
  }
809
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, reactNode);
850
+ return /* @__PURE__ */ React10.createElement(React10.Fragment, null, reactNode);
810
851
  }
811
- return /* @__PURE__ */ React6.createElement(
852
+ return /* @__PURE__ */ React10.createElement(
812
853
  "th",
813
854
  {
814
855
  key,
815
- className: cn2("border-y font-normal")
856
+ className: cn3("border-y font-normal")
816
857
  },
817
- /* @__PURE__ */ React6.createElement(Head, null)
858
+ /* @__PURE__ */ React10.createElement(Head, null)
818
859
  );
819
860
  }))),
820
- /* @__PURE__ */ React6.createElement("tbody", null, sortedArray.length === 0 && /* @__PURE__ */ React6.createElement("tr", null, /* @__PURE__ */ React6.createElement(
861
+ /* @__PURE__ */ React10.createElement("tbody", null, sortedArray.length === 0 && /* @__PURE__ */ React10.createElement("tr", null, /* @__PURE__ */ React10.createElement(
821
862
  "td",
822
863
  {
823
864
  colSpan: keys.length,
824
865
  className: "px-4 h-14 text-neutral-400 text-center"
825
866
  },
826
867
  "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
827
- )), sortedArray.map((item, i) => /* @__PURE__ */ React6.createElement("tr", { key: i, className: "hover:bg-gray-50 transition-colors" }, keys.map((key, i2) => {
868
+ )), sortedArray.map((item, i) => /* @__PURE__ */ React10.createElement("tr", { key: i, className: "hover:bg-gray-50 transition-colors" }, keys.map((key, i2) => {
828
869
  const value = item[key];
829
870
  function Content() {
830
871
  if (key in columns) {
@@ -832,35 +873,35 @@ function Table({
832
873
  if (column && typeof column === "object" && "mapper" in column) {
833
874
  const mapper = column.mapper;
834
875
  if (mapper) {
835
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, mapper(item));
876
+ return /* @__PURE__ */ React10.createElement(React10.Fragment, null, mapper(item));
836
877
  }
837
878
  }
838
879
  }
839
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, String(value));
880
+ return /* @__PURE__ */ React10.createElement(React10.Fragment, null, String(value));
840
881
  }
841
- const linkedContent = getLink ? /* @__PURE__ */ React6.createElement(
882
+ const linkedContent = getLink ? /* @__PURE__ */ React10.createElement(
842
883
  Link2,
843
884
  {
844
885
  to: getLink(item),
845
886
  className: "block content-center px-4 w-full h-full"
846
887
  },
847
- /* @__PURE__ */ React6.createElement(Content, null)
848
- ) : /* @__PURE__ */ React6.createElement(Content, null);
849
- const cell = Mapper ? /* @__PURE__ */ React6.createElement(Mapper, { item, index: i2 }, linkedContent) : linkedContent;
850
- return /* @__PURE__ */ React6.createElement("td", { key, className: "px-0 h-14 border-b" }, cell);
888
+ /* @__PURE__ */ React10.createElement(Content, null)
889
+ ) : /* @__PURE__ */ React10.createElement(Content, null);
890
+ const cell = Mapper ? /* @__PURE__ */ React10.createElement(Mapper, { item, index: i2 }, linkedContent) : linkedContent;
891
+ return /* @__PURE__ */ React10.createElement("td", { key, className: "px-0 h-14 border-b" }, cell);
851
892
  }))))
852
893
  );
853
894
  }
854
895
 
855
896
  // src/table/page.tsx
856
- import React7 from "react";
897
+ import React11 from "react";
857
898
  function createTablePage({
858
899
  name,
859
900
  columns,
860
901
  primaryKey = "id"
861
902
  }) {
862
903
  return function TablePage({
863
- AdminLayout
904
+ AdminHeader
864
905
  }) {
865
906
  const { pathname } = useLocation2();
866
907
  const { table } = useLoaderData();
@@ -873,73 +914,70 @@ function createTablePage({
873
914
  navigate(`${pathname}?${searchParams2.toString()}`);
874
915
  };
875
916
  const [searchParams] = useSearchParams3();
876
- return /* @__PURE__ */ React7.createElement(
877
- AdminLayout,
917
+ return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
918
+ AdminHeader,
878
919
  {
879
920
  title: name,
880
- actions: /* @__PURE__ */ React7.createElement(Link3, { to: `${pathname}/new`, className: "button-primary" }, name, " \uCD94\uAC00")
921
+ actions: /* @__PURE__ */ React11.createElement(Link3, { to: `${pathname}/new`, className: "button-primary" }, name, " \uCD94\uAC00")
922
+ }
923
+ ), /* @__PURE__ */ React11.createElement("div", { className: "max-w-7xl mx-auto" }, searchKey && /* @__PURE__ */ React11.createElement(
924
+ "form",
925
+ {
926
+ className: "h-18 px-4 flex items-center border-t",
927
+ onSubmit: (e) => {
928
+ e.preventDefault();
929
+ const formData = new FormData(e.currentTarget);
930
+ const query = formData.get("query");
931
+ search(query);
932
+ }
881
933
  },
882
- searchKey && /* @__PURE__ */ React7.createElement(
883
- "form",
934
+ /* @__PURE__ */ React11.createElement(
935
+ "button",
884
936
  {
885
- className: "h-18 px-4 flex items-center border-t",
886
- onSubmit: (e) => {
887
- e.preventDefault();
888
- const formData = new FormData(e.currentTarget);
889
- const query = formData.get("query");
890
- search(query);
891
- }
937
+ type: "submit",
938
+ className: "w-10 h-10 flex justify-center items-center"
892
939
  },
893
- /* @__PURE__ */ React7.createElement(
894
- "button",
895
- {
896
- type: "submit",
897
- className: "w-10 h-10 flex justify-center items-center"
898
- },
899
- /* @__PURE__ */ React7.createElement(GoSearch, { className: "text-xl mr-4" })
900
- ),
901
- /* @__PURE__ */ React7.createElement(
902
- "input",
903
- {
904
- className: "outline-none h-full flex-1",
905
- placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
906
- name: "query",
907
- defaultValue: searchParams.get("query") ?? ""
908
- }
909
- )
910
- ),
911
- /* @__PURE__ */ React7.createElement(
912
- Table,
913
- {
914
- data: items,
915
- columns,
916
- getLink: primaryKey ? (item) => `${pathname}/${item[primaryKey]}` : void 0,
917
- limit,
918
- offset,
919
- orderBy,
920
- direction
921
- }
940
+ /* @__PURE__ */ React11.createElement(GoSearch, { className: "text-xl mr-4" })
922
941
  ),
923
- /* @__PURE__ */ React7.createElement(
924
- TablePageButtons,
942
+ /* @__PURE__ */ React11.createElement(
943
+ "input",
925
944
  {
926
- total,
927
- limit,
928
- offset,
929
- MAX_PAGES_TO_SHOW: 10
945
+ className: "outline-none h-full flex-1",
946
+ placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
947
+ name: "query",
948
+ defaultValue: searchParams.get("query") ?? ""
930
949
  }
931
950
  )
932
- );
951
+ ), /* @__PURE__ */ React11.createElement(
952
+ Table,
953
+ {
954
+ data: items,
955
+ columns,
956
+ getLink: primaryKey ? (item) => `${pathname}/${item[primaryKey]}` : void 0,
957
+ limit,
958
+ offset,
959
+ orderBy,
960
+ direction
961
+ }
962
+ ), /* @__PURE__ */ React11.createElement(
963
+ TablePageButtons,
964
+ {
965
+ total,
966
+ limit,
967
+ offset,
968
+ MAX_PAGES_TO_SHOW: 10
969
+ }
970
+ )));
933
971
  };
934
972
  }
935
973
 
936
974
  // src/crud/crud_page.tsx
937
- import React8 from "react";
975
+ import React12 from "react";
938
976
  function crudPage({
939
977
  name,
940
978
  tablePageOptions,
941
979
  formOptions,
942
- AdminLayout
980
+ AdminHeader
943
981
  }) {
944
982
  return (prefix2) => {
945
983
  return function Page() {
@@ -950,10 +988,10 @@ function crudPage({
950
988
  ...tablePageOptions,
951
989
  name
952
990
  });
953
- return /* @__PURE__ */ React8.createElement(Component, { AdminLayout });
991
+ return /* @__PURE__ */ React12.createElement(Component, { AdminHeader });
954
992
  }
955
993
  if (pathname.startsWith(prefix2)) {
956
- return /* @__PURE__ */ React8.createElement(
994
+ return /* @__PURE__ */ React12.createElement(
957
995
  CrudFormProvider,
958
996
  {
959
997
  item: data?.item,
@@ -961,7 +999,7 @@ function crudPage({
961
999
  name,
962
1000
  columns: formOptions.columns
963
1001
  },
964
- formOptions.form ? /* @__PURE__ */ React8.createElement(formOptions.form, null) : /* @__PURE__ */ React8.createElement(CrudForm, { AdminLayout })
1002
+ formOptions.form ? /* @__PURE__ */ React12.createElement(formOptions.form, null) : /* @__PURE__ */ React12.createElement(CrudForm, { AdminHeader })
965
1003
  );
966
1004
  }
967
1005
  };
@@ -982,14 +1020,14 @@ var generateHandlers = (handlers) => {
982
1020
 
983
1021
  // src/crud/generate_pages.tsx
984
1022
  import { useLocation as useLocation4 } from "react-router";
985
- import React9 from "react";
1023
+ import React13 from "react";
986
1024
  var generatePages = (pages) => {
987
1025
  return function Page() {
988
1026
  const { pathname } = useLocation4();
989
1027
  for (const route2 of Object.keys(pages)) {
990
1028
  if (pathname.startsWith(route2)) {
991
1029
  const Page2 = pages[route2](route2);
992
- return /* @__PURE__ */ React9.createElement(Page2, null);
1030
+ return /* @__PURE__ */ React13.createElement(Page2, null);
993
1031
  }
994
1032
  }
995
1033
  };