shelving 1.258.8 → 1.258.10
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/api/cache/EndpointCache.js +1 -1
- package/db/store/QueryStore.js +1 -1
- package/package.json +1 -1
- package/store/URLStore.d.ts +1 -1
- package/ui/form/CheckboxInput.d.ts +1 -1
- package/ui/form/CheckboxInput.js +3 -5
- package/ui/form/CheckboxInput.tsx +10 -13
- package/ui/form/RadioInput.js +2 -4
- package/ui/form/RadioInput.tsx +5 -7
- package/util/array.js +1 -1
|
@@ -96,7 +96,7 @@ export class EndpointCache {
|
|
|
96
96
|
* @example await cache.refresh({ id: "abc" })
|
|
97
97
|
* @see https://shelving.cc/api/EndpointCache/refresh
|
|
98
98
|
*/
|
|
99
|
-
async refresh(payload, maxAge, caller = this.
|
|
99
|
+
async refresh(payload, maxAge, caller = this.refresh) {
|
|
100
100
|
await this.get(payload, caller)?.refresh(maxAge);
|
|
101
101
|
}
|
|
102
102
|
/**
|
package/db/store/QueryStore.js
CHANGED
package/package.json
CHANGED
package/store/URLStore.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export declare class URLStore extends BusyStore<ImmutableURL, PossibleURL> {
|
|
|
103
103
|
* @example store.requireParam("page");
|
|
104
104
|
* @see https://shelving.cc/store/URLStore/requireParam
|
|
105
105
|
*/
|
|
106
|
-
requireParam(key: string): string
|
|
106
|
+
requireParam(key: string): string;
|
|
107
107
|
/**
|
|
108
108
|
* Set all params in this URL (all current params are cleared first).
|
|
109
109
|
*
|
|
@@ -17,4 +17,4 @@ export interface CheckboxProps extends ValueInputProps<boolean>, OptionalChildPr
|
|
|
17
17
|
* @example <CheckboxInput name="agree" value={agree} onValue={setAgree}>I agree</CheckboxInput>
|
|
18
18
|
* @see https://shelving.cc/ui/CheckboxInput
|
|
19
19
|
*/
|
|
20
|
-
export declare function CheckboxInput({ name, title, placeholder, required, disabled, message, value, onValue, children, ...
|
|
20
|
+
export declare function CheckboxInput({ name, title, placeholder, required, disabled, message, value, onValue, children, ...props }: CheckboxProps): ReactElement;
|
package/ui/form/CheckboxInput.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { notNullish } from "../../util/null.js";
|
|
3
2
|
import { getFlexClass } from "../style/Flex.js";
|
|
4
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
5
4
|
import { getInputClass } from "./Input.js";
|
|
@@ -14,8 +13,7 @@ const INPUT_PLACEHOLDER_CLASS = getModuleClass(INPUT_CSS, "placeholder");
|
|
|
14
13
|
* @example <CheckboxInput name="agree" value={agree} onValue={setAgree}>I agree</CheckboxInput>
|
|
15
14
|
* @see https://shelving.cc/ui/CheckboxInput
|
|
16
15
|
*/
|
|
17
|
-
export function CheckboxInput({ name, title, placeholder = "Yes", required = false, disabled = false, message = "", value = false, onValue, children =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
getFlexClass(variants), INPUT_LABEL_CLASS, !hasChildren && INPUT_PLACEHOLDER_CLASS), "aria-invalid": !!message, children: [_jsx("input", { name: name, type: "checkbox", defaultChecked: !!value, onChange: e => onValue?.(!!e.currentTarget.checked), required: required, disabled: disabled, title: message, className: getModuleClass(INPUT_CSS, "radio") }), _jsx("span", { children: hasChildren ? children : placeholder })] }));
|
|
16
|
+
export function CheckboxInput({ name, title, placeholder = title || "Yes", required = false, disabled = false, message = "", value = false, onValue, children = placeholder, ...props }) {
|
|
17
|
+
return (_jsxs("label", { className: getClass(getInputClass(props), //
|
|
18
|
+
getFlexClass(props), INPUT_LABEL_CLASS), children: [_jsx("input", { className: getModuleClass(INPUT_CSS, "radio"), type: "checkbox", name: name, defaultChecked: !!value, onChange: e => onValue?.(!!e.currentTarget.checked), disabled: disabled, required: required, title: message, "aria-invalid": !!message }), _jsx("span", { children: children })] }));
|
|
21
19
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import { notNullish } from "../../util/null.js";
|
|
3
2
|
import { type FlexVariants, getFlexClass } from "../style/Flex.js";
|
|
4
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
5
4
|
import type { OptionalChildProps } from "../util/props.js";
|
|
@@ -27,37 +26,35 @@ export interface CheckboxProps extends ValueInputProps<boolean>, OptionalChildPr
|
|
|
27
26
|
export function CheckboxInput({
|
|
28
27
|
name,
|
|
29
28
|
title,
|
|
30
|
-
placeholder = "Yes",
|
|
29
|
+
placeholder = title || "Yes",
|
|
31
30
|
required = false,
|
|
32
31
|
disabled = false,
|
|
33
32
|
message = "",
|
|
34
33
|
value = false,
|
|
35
34
|
onValue,
|
|
36
|
-
children =
|
|
37
|
-
...
|
|
35
|
+
children = placeholder,
|
|
36
|
+
...props
|
|
38
37
|
}: CheckboxProps): ReactElement {
|
|
39
|
-
const hasChildren = notNullish(children);
|
|
40
38
|
return (
|
|
41
39
|
<label
|
|
42
40
|
className={getClass(
|
|
43
|
-
getInputClass(
|
|
44
|
-
getFlexClass(
|
|
41
|
+
getInputClass(props), //
|
|
42
|
+
getFlexClass(props),
|
|
45
43
|
INPUT_LABEL_CLASS,
|
|
46
|
-
!hasChildren && INPUT_PLACEHOLDER_CLASS,
|
|
47
44
|
)}
|
|
48
|
-
aria-invalid={!!message}
|
|
49
45
|
>
|
|
50
46
|
<input
|
|
51
|
-
|
|
47
|
+
className={getModuleClass(INPUT_CSS, "radio")}
|
|
52
48
|
type="checkbox"
|
|
49
|
+
name={name}
|
|
53
50
|
defaultChecked={!!value}
|
|
54
51
|
onChange={e => onValue?.(!!e.currentTarget.checked)}
|
|
55
|
-
required={required}
|
|
56
52
|
disabled={disabled}
|
|
53
|
+
required={required}
|
|
57
54
|
title={message}
|
|
58
|
-
|
|
55
|
+
aria-invalid={!!message}
|
|
59
56
|
/>
|
|
60
|
-
<span>{
|
|
57
|
+
<span>{children}</span>
|
|
61
58
|
</label>
|
|
62
59
|
);
|
|
63
60
|
}
|
package/ui/form/RadioInput.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { notNullish } from "../../util/null.js";
|
|
3
2
|
import { getFlexClass } from "../style/Flex.js";
|
|
4
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
5
4
|
import { getInputClass } from "./Input.js";
|
|
@@ -14,8 +13,7 @@ const INPUT_PLACEHOLDER_CLASS = getModuleClass(INPUT_CSS, "placeholder");
|
|
|
14
13
|
* @example <RadioInput name="plan" value={isPro} onValue={selectPro}>Pro</RadioInput>
|
|
15
14
|
* @see https://shelving.cc/ui/RadioInput
|
|
16
15
|
*/
|
|
17
|
-
export function RadioInput({ name, title, placeholder = "Choose", required = false, disabled = false, message = "", value = false, onValue, children =
|
|
18
|
-
const hasChildren = notNullish(children);
|
|
16
|
+
export function RadioInput({ name, title, placeholder = title || "Choose", required = false, disabled = false, message = "", value = false, onValue, children = placeholder, ...props }) {
|
|
19
17
|
return (_jsxs("label", { className: getClass(getInputClass(props), //
|
|
20
|
-
getFlexClass(props), INPUT_LABEL_CLASS
|
|
18
|
+
getFlexClass(props), INPUT_LABEL_CLASS), children: [_jsx("input", { className: getModuleClass(INPUT_CSS, "radio"), type: "radio", name: name, defaultChecked: !!value, onChange: () => onValue(true), disabled: disabled, required: required, title: message, "aria-invalid": !!message }), _jsx("span", { children: children })] }));
|
|
21
19
|
}
|
package/ui/form/RadioInput.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import { notNullish } from "../../util/null.js";
|
|
3
2
|
import { type FlexVariants, getFlexClass } from "../style/Flex.js";
|
|
4
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
5
4
|
import type { OptionalChildProps } from "../util/props.js";
|
|
@@ -27,36 +26,35 @@ export interface RadioInputProps extends ValueInputProps<boolean>, OptionalChild
|
|
|
27
26
|
export function RadioInput({
|
|
28
27
|
name,
|
|
29
28
|
title,
|
|
30
|
-
placeholder = "Choose",
|
|
29
|
+
placeholder = title || "Choose",
|
|
31
30
|
required = false,
|
|
32
31
|
disabled = false,
|
|
33
32
|
message = "",
|
|
34
33
|
value = false,
|
|
35
34
|
onValue,
|
|
36
|
-
children =
|
|
35
|
+
children = placeholder,
|
|
37
36
|
...props
|
|
38
37
|
}: RadioInputProps): ReactElement {
|
|
39
|
-
const hasChildren = notNullish(children);
|
|
40
38
|
return (
|
|
41
39
|
<label
|
|
42
40
|
className={getClass(
|
|
43
41
|
getInputClass(props), //
|
|
44
42
|
getFlexClass(props),
|
|
45
43
|
INPUT_LABEL_CLASS,
|
|
46
|
-
!hasChildren && INPUT_PLACEHOLDER_CLASS,
|
|
47
44
|
)}
|
|
48
45
|
>
|
|
49
46
|
<input
|
|
50
47
|
className={getModuleClass(INPUT_CSS, "radio")}
|
|
51
48
|
type="radio"
|
|
52
49
|
name={name}
|
|
53
|
-
defaultChecked={value}
|
|
50
|
+
defaultChecked={!!value}
|
|
54
51
|
onChange={() => onValue(true)}
|
|
55
52
|
disabled={disabled}
|
|
56
53
|
required={required}
|
|
54
|
+
title={message}
|
|
57
55
|
aria-invalid={!!message}
|
|
58
56
|
/>
|
|
59
|
-
{
|
|
57
|
+
<span>{children}</span>
|
|
60
58
|
</label>
|
|
61
59
|
);
|
|
62
60
|
}
|
package/util/array.js
CHANGED