@blinkk/root-cms 1.0.0-beta.50 → 1.0.0-beta.51

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/dist/ui/ui.css CHANGED
@@ -924,6 +924,15 @@
924
924
  .DocEditor__FileField__uploadButton__icon {
925
925
  margin-right: 10px;
926
926
  }
927
+ .DocEditor__DateTimeField input {
928
+ margin-top: 16px;
929
+ display: block;
930
+ width: 100%;
931
+ border: 1px solid #dedede;
932
+ padding: 6px 8px;
933
+ font-family: inherit;
934
+ font-size: 12px;
935
+ }
927
936
 
928
937
  /* ui/pages/DocumentPage/DocumentPage.css */
929
938
  .DocumentPage {
package/dist/ui/ui.js CHANGED
@@ -39853,7 +39853,7 @@ ${this.customData.serverResponse}`;
39853
39853
  // package.json
39854
39854
  var package_default = {
39855
39855
  name: "@blinkk/root-cms",
39856
- version: "1.0.0-beta.50",
39856
+ version: "1.0.0-beta.51",
39857
39857
  author: "s@blinkk.com",
39858
39858
  license: "MIT",
39859
39859
  engines: {
@@ -39958,7 +39958,7 @@ ${this.customData.serverResponse}`;
39958
39958
  vitest: "^0.18.1"
39959
39959
  },
39960
39960
  peerDependencies: {
39961
- "@blinkk/root": "1.0.0-beta.50",
39961
+ "@blinkk/root": "1.0.0-beta.51",
39962
39962
  "firebase-admin": ">=11",
39963
39963
  "firebase-functions": ">=4",
39964
39964
  preact: "10.x",
@@ -43721,7 +43721,7 @@ ${content}</tr>
43721
43721
  /* @__PURE__ */ o4("div", { className: "DocEditor__field__name", children: field.label || field.id }),
43722
43722
  field.help && /* @__PURE__ */ o4("div", { className: "DocEditor__field__help", children: field.help })
43723
43723
  ] }),
43724
- /* @__PURE__ */ o4("div", { className: "DocEditor__field__input", children: field.type === "array" ? /* @__PURE__ */ o4(DocEditor.ArrayField, { ...props }) : field.type === "boolean" ? /* @__PURE__ */ o4(DocEditor.BooleanField, { ...props }) : field.type === "file" ? /* @__PURE__ */ o4(DocEditor.FileField, { ...props }) : field.type === "image" ? /* @__PURE__ */ o4(DocEditor.ImageField, { ...props }) : field.type === "multiselect" ? /* @__PURE__ */ o4(DocEditor.MultiSelectField, { ...props }) : field.type === "object" ? /* @__PURE__ */ o4(DocEditor.ObjectField, { ...props }) : field.type === "oneof" ? /* @__PURE__ */ o4(DocEditor.OneOfField, { ...props }) : field.type === "select" ? /* @__PURE__ */ o4(DocEditor.SelectField, { ...props }) : field.type === "string" ? /* @__PURE__ */ o4(DocEditor.StringField, { ...props }) : /* @__PURE__ */ o4("div", { className: "DocEditor__field__input__unknown", children: [
43724
+ /* @__PURE__ */ o4("div", { className: "DocEditor__field__input", children: field.type === "array" ? /* @__PURE__ */ o4(DocEditor.ArrayField, { ...props }) : field.type === "boolean" ? /* @__PURE__ */ o4(DocEditor.BooleanField, { ...props }) : field.type === "datetime" ? /* @__PURE__ */ o4(DocEditor.DateTimeField, { ...props }) : field.type === "file" ? /* @__PURE__ */ o4(DocEditor.FileField, { ...props }) : field.type === "image" ? /* @__PURE__ */ o4(DocEditor.ImageField, { ...props }) : field.type === "multiselect" ? /* @__PURE__ */ o4(DocEditor.MultiSelectField, { ...props }) : field.type === "object" ? /* @__PURE__ */ o4(DocEditor.ObjectField, { ...props }) : field.type === "oneof" ? /* @__PURE__ */ o4(DocEditor.OneOfField, { ...props }) : field.type === "select" ? /* @__PURE__ */ o4(DocEditor.SelectField, { ...props }) : field.type === "string" ? /* @__PURE__ */ o4(DocEditor.StringField, { ...props }) : /* @__PURE__ */ o4("div", { className: "DocEditor__field__input__unknown", children: [
43725
43725
  "Unknown field type: ",
43726
43726
  field.type
43727
43727
  ] }) })
@@ -44573,6 +44573,50 @@ ${content}</tr>
44573
44573
  }
44574
44574
  ) });
44575
44575
  };
44576
+ DocEditor.DateTimeField = (props) => {
44577
+ const [dateStr, setDateStr] = y2("");
44578
+ function onChange(newDateStr) {
44579
+ if (newDateStr) {
44580
+ const millis = Math.floor(new Date(newDateStr).getTime());
44581
+ const newValue = nt.fromMillis(millis);
44582
+ setDateStr(toDateStr(newValue));
44583
+ props.draft.updateKey(props.deepKey, newValue);
44584
+ } else {
44585
+ setDateStr("");
44586
+ props.draft.removeKey(props.deepKey);
44587
+ }
44588
+ }
44589
+ function toDateStr(ts2) {
44590
+ const date = ts2.toDate();
44591
+ date.setMinutes(date.getMinutes() - date.getTimezoneOffset());
44592
+ return date.toISOString().slice(0, 16);
44593
+ }
44594
+ s2(() => {
44595
+ const unsubscribe = props.draft.subscribe(
44596
+ props.deepKey,
44597
+ (newValue) => {
44598
+ if (newValue) {
44599
+ setDateStr(toDateStr(newValue));
44600
+ } else {
44601
+ setDateStr("");
44602
+ }
44603
+ }
44604
+ );
44605
+ return unsubscribe;
44606
+ }, []);
44607
+ return /* @__PURE__ */ o4("div", { className: "DocEditor__DateTimeField", children: /* @__PURE__ */ o4(
44608
+ "input",
44609
+ {
44610
+ type: "datetime-local",
44611
+ value: dateStr,
44612
+ onChange: (e3) => {
44613
+ const target = e3.target;
44614
+ const newDateStr = target.value;
44615
+ onChange(newDateStr);
44616
+ }
44617
+ }
44618
+ ) });
44619
+ };
44576
44620
  function arraySwap(arr, index1, index22) {
44577
44621
  if (arr.length <= 1) {
44578
44622
  return arr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkk/root-cms",
3
- "version": "1.0.0-beta.50",
3
+ "version": "1.0.0-beta.51",
4
4
  "author": "s@blinkk.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -57,7 +57,7 @@
57
57
  "//": "NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",
58
58
  "devDependencies": {
59
59
  "@babel/core": "^7.17.9",
60
- "@blinkk/root": "1.0.0-beta.50",
60
+ "@blinkk/root": "1.0.0-beta.51",
61
61
  "@emotion/react": "^11.10.5",
62
62
  "@firebase/app-compat": "^0.1.33",
63
63
  "@firebase/app-types": "^0.7.0",
@@ -92,7 +92,7 @@
92
92
  "vitest": "^0.18.1"
93
93
  },
94
94
  "peerDependencies": {
95
- "@blinkk/root": "1.0.0-beta.50",
95
+ "@blinkk/root": "1.0.0-beta.51",
96
96
  "firebase-admin": ">=11",
97
97
  "firebase-functions": ">=4",
98
98
  "preact": "10.x",