@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
|
@@ -8,8 +8,7 @@ export type IconButtonProps<T extends React.ElementType = 'button'> = {
|
|
|
8
8
|
readonly size?: Size;
|
|
9
9
|
readonly icon: keyof KnownIconType;
|
|
10
10
|
readonly isActive?: boolean;
|
|
11
|
-
|
|
12
|
-
componentAs?: React.ComponentPropsWithRef<T>['as'];
|
|
11
|
+
component?: T;
|
|
13
12
|
} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'as'>;
|
|
14
13
|
declare const IconButton: <T extends React.ElementType<any> = "button">(p: IconButtonProps<T>) => JSX.Element;
|
|
15
14
|
export default IconButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/IconButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAA;AAEhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,aAAa,CAAA;AAEpB,KAAK,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AACpC,KAAK,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,CAAA;AAE5B,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,aAAa,CAAA;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/IconButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAA;AAEhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,aAAa,CAAA;AAEpB,KAAK,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AACpC,KAAK,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,CAAA;AAE5B,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,aAAa,CAAA;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,SAAS,CAAC,EAAE,CAAC,CAAA;CACd,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC,CAAA;AAE3D,QAAA,MAAM,UAAU,0EA+BX,WAAW,CAAA;AAEhB,eAAe,UAAU,CAAA"}
|
|
@@ -9,5 +9,5 @@ export declare function useCharcoalModalOverlay(props: AriaModalOverlayProps, st
|
|
|
9
9
|
isOpen: boolean;
|
|
10
10
|
onClose: () => void;
|
|
11
11
|
}, ref: React.RefObject<HTMLElement>): ModalOverlayAria;
|
|
12
|
-
export declare function useWindowWidth(): number;
|
|
12
|
+
export declare function useWindowWidth(): number | null;
|
|
13
13
|
//# sourceMappingURL=useCustomModalOverlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCustomModalOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/useCustomModalOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAIjB,MAAM,sBAAsB,CAAA;AAG7B;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,qBAAqB,EAC5B,KAAK,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,EAC/C,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAChC,gBAAgB,CA4BlB;
|
|
1
|
+
{"version":3,"file":"useCustomModalOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/useCustomModalOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAIjB,MAAM,sBAAsB,CAAA;AAG7B;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,qBAAqB,EAC5B,KAAK,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,EAC/C,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAChC,gBAAgB,CA4BlB;AAMD,wBAAgB,cAAc,kBAc7B"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -122,14 +122,13 @@ var IconButton = (0, import_react5.forwardRef)(function IconButtonInner({
|
|
|
122
122
|
size = "M",
|
|
123
123
|
icon,
|
|
124
124
|
isActive = false,
|
|
125
|
-
|
|
126
|
-
as,
|
|
125
|
+
component,
|
|
127
126
|
...rest
|
|
128
127
|
}, ref) {
|
|
129
128
|
validateIconSize(size, icon);
|
|
130
|
-
const Component = (0, import_react5.useMemo)(() =>
|
|
129
|
+
const Component = (0, import_react5.useMemo)(() => component ?? "button", [component]);
|
|
131
130
|
const classNames = useClassNames("charcoal-icon-button", rest.className);
|
|
132
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ...rest,
|
|
131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ...rest, ref, className: classNames, "data-size": size, "data-active": isActive, "data-variant": variant, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pixiv-icon", { name: icon }) });
|
|
133
132
|
});
|
|
134
133
|
var IconButton_default = IconButton;
|
|
135
134
|
function validateIconSize(size, icon) {
|
|
@@ -636,8 +635,11 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
636
635
|
underlayProps
|
|
637
636
|
};
|
|
638
637
|
}
|
|
638
|
+
function isWindowDefined() {
|
|
639
|
+
return typeof window !== "undefined";
|
|
640
|
+
}
|
|
639
641
|
function useWindowWidth() {
|
|
640
|
-
const [width, setWidth] = React11.useState(window.innerWidth);
|
|
642
|
+
const [width, setWidth] = React11.useState(isWindowDefined() ? window.innerWidth : null);
|
|
641
643
|
React11.useEffect(() => {
|
|
642
644
|
const handleResize = () => {
|
|
643
645
|
setWidth(window.innerWidth);
|
|
@@ -680,7 +682,7 @@ var Modal = (0, import_react17.forwardRef)(function ModalInner({
|
|
|
680
682
|
onClose,
|
|
681
683
|
isOpen
|
|
682
684
|
}, ref);
|
|
683
|
-
const isMobile = useWindowWidth() < 744;
|
|
685
|
+
const isMobile = (useWindowWidth() ?? Infinity) < 744;
|
|
684
686
|
const transitionEnabled = isMobile && bottomSheet !== false;
|
|
685
687
|
const showDismiss = !isMobile || bottomSheet !== true;
|
|
686
688
|
const transition = (0, import_react_spring.useTransition)(isOpen, {
|