@charcoal-ui/react 4.0.0-beta.11 → 4.0.0-beta.13
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/components/IconButton/index.d.ts +1 -2
- package/dist/components/IconButton/index.d.ts.map +1 -1
- package/dist/components/Modal/useCustomModalOverlay.d.ts +1 -1
- package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
- package/dist/index.cjs.js +8 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -6
- package/dist/index.esm.js.map +1 -1
- package/package.json +11 -15
- package/src/_lib/index.ts +1 -1
- package/src/components/Button/__snapshots__/index.story.storyshot +9 -9
- package/src/components/Checkbox/CheckboxInput/__snapshots__/index.story.storyshot +6 -6
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +6 -6
- package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +3 -3
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +3 -3
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +5 -5
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +53 -53
- package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
- package/src/components/IconButton/__snapshots__/index.story.storyshot +3 -3
- package/src/components/IconButton/index.tsx +3 -6
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +8 -8
- package/src/components/Modal/__snapshots__/index.story.storyshot +45 -28
- package/src/components/Modal/index.story.tsx +2 -0
- package/src/components/Modal/index.tsx +1 -1
- package/src/components/Modal/useCustomModalOverlay.tsx +7 -1
- package/src/components/Radio/__snapshots__/index.story.storyshot +10 -10
- package/src/components/Radio/index.test.tsx +4 -3
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +2 -2
- package/src/components/Switch/__snapshots__/index.story.storyshot +4 -4
- package/src/components/TagItem/__snapshots__/index.story.storyshot +16 -16
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +31 -31
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +25 -25
package/dist/index.esm.js
CHANGED
|
@@ -65,14 +65,13 @@ var IconButton = forwardRef3(function IconButtonInner({
|
|
|
65
65
|
size = "M",
|
|
66
66
|
icon,
|
|
67
67
|
isActive = false,
|
|
68
|
-
|
|
69
|
-
as,
|
|
68
|
+
component,
|
|
70
69
|
...rest
|
|
71
70
|
}, ref) {
|
|
72
71
|
validateIconSize(size, icon);
|
|
73
|
-
const Component = useMemo4(() =>
|
|
72
|
+
const Component = useMemo4(() => component ?? "button", [component]);
|
|
74
73
|
const classNames = useClassNames("charcoal-icon-button", rest.className);
|
|
75
|
-
return /* @__PURE__ */ jsx4(Component, { ...rest,
|
|
74
|
+
return /* @__PURE__ */ jsx4(Component, { ...rest, ref, className: classNames, "data-size": size, "data-active": isActive, "data-variant": variant, children: /* @__PURE__ */ jsx4("pixiv-icon", { name: icon }) });
|
|
76
75
|
});
|
|
77
76
|
var IconButton_default = IconButton;
|
|
78
77
|
function validateIconSize(size, icon) {
|
|
@@ -579,8 +578,11 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
579
578
|
underlayProps
|
|
580
579
|
};
|
|
581
580
|
}
|
|
581
|
+
function isWindowDefined() {
|
|
582
|
+
return typeof window !== "undefined";
|
|
583
|
+
}
|
|
582
584
|
function useWindowWidth() {
|
|
583
|
-
const [width, setWidth] = React11.useState(window.innerWidth);
|
|
585
|
+
const [width, setWidth] = React11.useState(isWindowDefined() ? window.innerWidth : null);
|
|
584
586
|
React11.useEffect(() => {
|
|
585
587
|
const handleResize = () => {
|
|
586
588
|
setWidth(window.innerWidth);
|
|
@@ -623,7 +625,7 @@ var Modal = forwardRef15(function ModalInner({
|
|
|
623
625
|
onClose,
|
|
624
626
|
isOpen
|
|
625
627
|
}, ref);
|
|
626
|
-
const isMobile = useWindowWidth() < 744;
|
|
628
|
+
const isMobile = (useWindowWidth() ?? Infinity) < 744;
|
|
627
629
|
const transitionEnabled = isMobile && bottomSheet !== false;
|
|
628
630
|
const showDismiss = !isMobile || bottomSheet !== true;
|
|
629
631
|
const transition = useTransition(isOpen, {
|