sliftutils 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -135,7 +135,6 @@ declare module "sliftutils/render-utils/Input" {
135
135
  declare module "sliftutils/render-utils/InputLabel" {
136
136
  import preact from "preact";
137
137
  import { InputProps } from "./Input";
138
- import { URLParamStr } from "./URLParam";
139
138
  export type InputLabelProps = Omit<InputProps, "label" | "title"> & {
140
139
  label?: preact.ComponentChild;
141
140
  number?: boolean;
@@ -164,7 +163,9 @@ declare module "sliftutils/render-utils/InputLabel" {
164
163
  render(): preact.JSX.Element;
165
164
  }
166
165
  export declare class InputLabelURL extends preact.Component<InputLabelProps & {
167
- persisted: URLParamStr;
166
+ persisted: {
167
+ value: unknown;
168
+ };
168
169
  }> {
169
170
  render(): preact.JSX.Element;
170
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -1,6 +1,5 @@
1
1
  import preact from "preact";
2
2
  import { InputProps } from "./Input";
3
- import { URLParamStr } from "./URLParam";
4
3
  export type InputLabelProps = Omit<InputProps, "label" | "title"> & {
5
4
  label?: preact.ComponentChild;
6
5
  number?: boolean;
@@ -29,7 +28,9 @@ export declare class InputLabel extends preact.Component<InputLabelProps> {
29
28
  render(): preact.JSX.Element;
30
29
  }
31
30
  export declare class InputLabelURL extends preact.Component<InputLabelProps & {
32
- persisted: URLParamStr;
31
+ persisted: {
32
+ value: unknown;
33
+ };
33
34
  }> {
34
35
  render(): preact.JSX.Element;
35
36
  }
@@ -1,7 +1,6 @@
1
1
  import preact from "preact";
2
2
  import { Input, InputProps } from "./Input";
3
3
  import { css } from "typesafecss";
4
- import { URLParamStr } from "./URLParam";
5
4
  import { lazy } from "socket-function/src/caching";
6
5
  import { observer } from "./observer";
7
6
  import { observable } from "mobx";
@@ -83,29 +82,21 @@ export class InputLabel extends preact.Component<InputLabelProps> {
83
82
 
84
83
  if ((!props.type || props.type === "number") && props.useDateUI) {
85
84
  let value = String(props.value);
86
- if (
87
- value === "date-1be2200d-9742-4e90-a6c2-e8a790277414"
88
- || isJSNumber(value) && startGuessDateRange < +value && +value < endGuessDateRange
89
- // NOTE: Showing the date selector is a problem, as there is not an easy way to undo this. So if the
90
- // user typed in "2020", it would return the input into a selector and not let them keeping type.
91
- // || startGuessDateRange < +new Date(String(value)) && +new Date(String(value)) < endGuessDateRange
92
- ) {
93
- props.type = "datetime-local";
94
- props.edit = false;
95
- props.textarea = false;
96
- props.number = false;
97
- props.forceInputValueUpdatesWhenFocused = true;
98
- // NOTE: When using forceInputValueUpdatesWhenFocused we need hot, otherwise the user's updates
99
- // won't be visible.
100
- props.hot = true;
101
- if (isJSNumber(value)) {
102
- value = formatDateTimeForInput(+value);
103
- } else {
104
- value = "";
105
- }
106
- props.value = value;
107
- addValueMapping(value => (+new Date(value).getTime() || "") + "");
85
+ props.type = "datetime-local";
86
+ props.edit = false;
87
+ props.textarea = false;
88
+ props.number = false;
89
+ props.forceInputValueUpdatesWhenFocused = true;
90
+ // NOTE: When using forceInputValueUpdatesWhenFocused we need hot, otherwise the user's updates
91
+ // won't be visible.
92
+ props.hot = true;
93
+ if (isJSNumber(value)) {
94
+ value = formatDateTimeForInput(+value);
95
+ } else {
96
+ value = "";
108
97
  }
98
+ props.value = value;
99
+ addValueMapping(value => (+new Date(value).getTime() || "") + "");
109
100
  }
110
101
  if (props.fontSize !== undefined) {
111
102
  props.style = { ...props.style as any, fontSize: props.fontSize };
@@ -260,7 +251,7 @@ const pencilSVG = lazy(() => {
260
251
 
261
252
  @observer
262
253
  export class InputLabelURL extends preact.Component<InputLabelProps & {
263
- persisted: URLParamStr;
254
+ persisted: { value: unknown };
264
255
  }> {
265
256
  render() {
266
257
  this.props.persisted.value;