@ttoss/ui 4.1.12 → 4.1.14
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/esm/index.js +12 -8
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -8
- package/package.json +5 -5
- package/src/components/Checkbox.tsx +21 -10
package/dist/esm/index.js
CHANGED
|
@@ -494,28 +494,32 @@ import { Slider } from "theme-ui";
|
|
|
494
494
|
import * as React6 from "react";
|
|
495
495
|
import { Checkbox as CheckBoxUi } from "theme-ui";
|
|
496
496
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
497
|
-
var Checkbox = ({
|
|
497
|
+
var Checkbox = /*#__PURE__*/React6.forwardRef(({
|
|
498
498
|
indeterminate = false,
|
|
499
499
|
...rest
|
|
500
|
-
}) => {
|
|
501
|
-
const
|
|
500
|
+
}, ref) => {
|
|
501
|
+
const innerRef = React6.useRef(null);
|
|
502
|
+
React6.useImperativeHandle(ref, () => {
|
|
503
|
+
return innerRef.current;
|
|
504
|
+
});
|
|
502
505
|
React6.useEffect(() => {
|
|
503
|
-
if (
|
|
504
|
-
|
|
506
|
+
if (innerRef.current) {
|
|
507
|
+
innerRef.current.indeterminate = indeterminate;
|
|
505
508
|
}
|
|
506
509
|
}, [indeterminate]);
|
|
507
510
|
if (indeterminate) {
|
|
508
511
|
return /* @__PURE__ */jsx9("input", {
|
|
509
512
|
type: "checkbox",
|
|
510
|
-
ref,
|
|
513
|
+
ref: innerRef,
|
|
511
514
|
...rest
|
|
512
515
|
});
|
|
513
516
|
}
|
|
514
517
|
return /* @__PURE__ */jsx9(CheckBoxUi, {
|
|
515
|
-
ref,
|
|
518
|
+
ref: innerRef,
|
|
516
519
|
...rest
|
|
517
520
|
});
|
|
518
|
-
};
|
|
521
|
+
});
|
|
522
|
+
Checkbox.displayName = "Checkbox";
|
|
519
523
|
|
|
520
524
|
// src/components/InfiniteLinearProgress.tsx
|
|
521
525
|
import * as React7 from "react";
|
package/dist/index.d.mts
CHANGED
|
@@ -92,7 +92,7 @@ declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps,
|
|
|
92
92
|
interface CheckboxProps extends CheckboxProps$1 {
|
|
93
93
|
indeterminate?: boolean;
|
|
94
94
|
}
|
|
95
|
-
declare const Checkbox:
|
|
95
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
96
96
|
|
|
97
97
|
declare const InfiniteLinearProgress: () => react_jsx_runtime.JSX.Element;
|
|
98
98
|
|
package/dist/index.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps,
|
|
|
92
92
|
interface CheckboxProps extends CheckboxProps$1 {
|
|
93
93
|
indeterminate?: boolean;
|
|
94
94
|
}
|
|
95
|
-
declare const Checkbox:
|
|
95
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
96
96
|
|
|
97
97
|
declare const InfiniteLinearProgress: () => react_jsx_runtime.JSX.Element;
|
|
98
98
|
|
package/dist/index.js
CHANGED
|
@@ -570,28 +570,32 @@ var import_theme_ui20 = require("theme-ui");
|
|
|
570
570
|
var React6 = __toESM(require("react"));
|
|
571
571
|
var import_theme_ui21 = require("theme-ui");
|
|
572
572
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
573
|
-
var Checkbox = ({
|
|
573
|
+
var Checkbox = React6.forwardRef(({
|
|
574
574
|
indeterminate = false,
|
|
575
575
|
...rest
|
|
576
|
-
}) => {
|
|
577
|
-
const
|
|
576
|
+
}, ref) => {
|
|
577
|
+
const innerRef = React6.useRef(null);
|
|
578
|
+
React6.useImperativeHandle(ref, () => {
|
|
579
|
+
return innerRef.current;
|
|
580
|
+
});
|
|
578
581
|
React6.useEffect(() => {
|
|
579
|
-
if (
|
|
580
|
-
|
|
582
|
+
if (innerRef.current) {
|
|
583
|
+
innerRef.current.indeterminate = indeterminate;
|
|
581
584
|
}
|
|
582
585
|
}, [indeterminate]);
|
|
583
586
|
if (indeterminate) {
|
|
584
587
|
return /* @__PURE__ */(0, import_jsx_runtime9.jsx)("input", {
|
|
585
588
|
type: "checkbox",
|
|
586
|
-
ref,
|
|
589
|
+
ref: innerRef,
|
|
587
590
|
...rest
|
|
588
591
|
});
|
|
589
592
|
}
|
|
590
593
|
return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_theme_ui21.Checkbox, {
|
|
591
|
-
ref,
|
|
594
|
+
ref: innerRef,
|
|
592
595
|
...rest
|
|
593
596
|
});
|
|
594
|
-
};
|
|
597
|
+
});
|
|
598
|
+
Checkbox.displayName = "Checkbox";
|
|
595
599
|
|
|
596
600
|
// src/components/InfiniteLinearProgress.tsx
|
|
597
601
|
var React7 = __toESM(require("react"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/ui",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.14",
|
|
4
4
|
"description": "Primitive layout, typographic, and other components for styling applications.",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@theme-ui/match-media": "^0.16.2",
|
|
28
28
|
"react-select": "^5.8.0",
|
|
29
29
|
"theme-ui": "^0.16.2",
|
|
30
|
-
"@ttoss/theme": "^1.7.
|
|
30
|
+
"@ttoss/theme": "^1.7.11"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@emotion/react": "^11",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"jest": "^29.7.0",
|
|
43
43
|
"react": "^18.3.1",
|
|
44
44
|
"tsup": "^8.1.0",
|
|
45
|
-
"@ttoss/config": "^1.32.
|
|
46
|
-
"@ttoss/react-icons": "^0.3.
|
|
47
|
-
"@ttoss/test-utils": "^2.1.
|
|
45
|
+
"@ttoss/config": "^1.32.6",
|
|
46
|
+
"@ttoss/react-icons": "^0.3.10",
|
|
47
|
+
"@ttoss/test-utils": "^2.1.10"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"React",
|
|
@@ -8,18 +8,29 @@ export interface CheckboxProps extends CheckboxPropsUi {
|
|
|
8
8
|
indeterminate?: boolean;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const Checkbox =
|
|
12
|
-
|
|
11
|
+
export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
|
|
12
|
+
({ indeterminate = false, ...rest }, ref) => {
|
|
13
|
+
const innerRef = React.useRef<HTMLInputElement>(null);
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* https://stackoverflow.com/a/68163315/8786986
|
|
17
|
+
*/
|
|
18
|
+
React.useImperativeHandle(ref, () => {
|
|
19
|
+
return innerRef.current as HTMLInputElement;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
if (innerRef.current) {
|
|
24
|
+
innerRef.current.indeterminate = indeterminate;
|
|
25
|
+
}
|
|
26
|
+
}, [indeterminate]);
|
|
27
|
+
|
|
28
|
+
if (indeterminate) {
|
|
29
|
+
return <input type="checkbox" ref={innerRef} {...rest} />;
|
|
17
30
|
}
|
|
18
|
-
}, [indeterminate]);
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
return <input type="checkbox" ref={ref} {...rest} />;
|
|
32
|
+
return <CheckBoxUi ref={innerRef} {...rest} />;
|
|
22
33
|
}
|
|
34
|
+
);
|
|
23
35
|
|
|
24
|
-
|
|
25
|
-
};
|
|
36
|
+
Checkbox.displayName = 'Checkbox';
|