react-asc 22.0.0 → 23.0.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/components/FloatingActionButton/FloatingActionButton.d.ts +1 -0
- package/hooks/index.d.ts +4 -3
- package/hooks/useMobileDetect.d.ts +3 -0
- package/index.es.js +54 -39
- package/index.js +53 -37
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export interface IFloatingActionButtonProps extends React.DetailedHTMLProps<Reac
|
|
|
7
7
|
fixed?: boolean;
|
|
8
8
|
isActive?: boolean;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
+
position?: 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
|
|
10
11
|
onClick?: (e: React.MouseEvent) => void;
|
|
11
12
|
}
|
|
12
13
|
export declare const FloatingActionButton: (props: IFloatingActionButtonProps) => JSX.Element;
|
package/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from './useWindowSize';
|
|
2
|
-
export * from './useHover';
|
|
3
|
-
export * from './useConstructor';
|
|
4
1
|
export * from './useDebounce';
|
|
2
|
+
export * from './useConstructor';
|
|
5
3
|
export * from './useCssClasses';
|
|
4
|
+
export * from './useHover';
|
|
5
|
+
export * from './useMobileDetect';
|
|
6
|
+
export * from './useWindowSize';
|
package/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useRef, useEffect, useState, Fragment, Component, createRef, cloneElement, createContext, useContext } from 'react';
|
|
2
2
|
import { createPortal, render, unmountComponentAtNode } from 'react-dom';
|
|
3
3
|
import { createPopper } from '@popperjs/core';
|
|
4
4
|
|
|
@@ -224,23 +224,26 @@ const CircleSolidIcon = () => (React.createElement("svg", { "aria-hidden": "true
|
|
|
224
224
|
const ChevronLeftSolidIcon = () => (React.createElement("svg", { "aria-hidden": "true", focusable: "false", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 320 512" },
|
|
225
225
|
React.createElement("path", { fill: "currentColor", d: "M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z" })));
|
|
226
226
|
|
|
227
|
-
function
|
|
228
|
-
const
|
|
229
|
-
width: 0,
|
|
230
|
-
height: 0,
|
|
231
|
-
});
|
|
227
|
+
function useDebounce(callback, timeout, deps) {
|
|
228
|
+
const timeoutId = useRef();
|
|
232
229
|
useEffect(() => {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
230
|
+
clearTimeout(timeoutId.current);
|
|
231
|
+
timeoutId.current = setTimeout(callback, timeout);
|
|
232
|
+
return () => clearTimeout(timeoutId.current);
|
|
233
|
+
}, deps);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const useConstructor = (callBack) => {
|
|
237
|
+
const [hasBeenCalled, setHasBeenCalled] = useState(false);
|
|
238
|
+
if (hasBeenCalled)
|
|
239
|
+
return;
|
|
240
|
+
callBack();
|
|
241
|
+
setHasBeenCalled(true);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
function useCssClasses(cssClasses) {
|
|
245
|
+
const cssClassName = (cssClasses === null || cssClasses === void 0 ? void 0 : cssClasses.filter(css => css).join(' ')) || '';
|
|
246
|
+
return [cssClassName];
|
|
244
247
|
}
|
|
245
248
|
|
|
246
249
|
function useHover() {
|
|
@@ -265,26 +268,37 @@ function useHover() {
|
|
|
265
268
|
return [ref, value];
|
|
266
269
|
}
|
|
267
270
|
|
|
268
|
-
|
|
269
|
-
const [
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
setHasBeenCalled(true);
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
function useDebounce(callback, timeout, deps) {
|
|
277
|
-
const timeoutId = useRef();
|
|
271
|
+
function useWindowSize() {
|
|
272
|
+
const [windowSize, setWindowSize] = useState({
|
|
273
|
+
width: 0,
|
|
274
|
+
height: 0,
|
|
275
|
+
});
|
|
278
276
|
useEffect(() => {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
277
|
+
function handleResize() {
|
|
278
|
+
setWindowSize({
|
|
279
|
+
width: window.innerWidth,
|
|
280
|
+
height: window.innerHeight,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
window.addEventListener("resize", handleResize);
|
|
284
|
+
handleResize();
|
|
285
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
286
|
+
}, []);
|
|
287
|
+
return windowSize;
|
|
283
288
|
}
|
|
284
289
|
|
|
285
|
-
function
|
|
286
|
-
const
|
|
287
|
-
|
|
290
|
+
function useMobileDetect() {
|
|
291
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
292
|
+
const windowSize = useWindowSize();
|
|
293
|
+
const checkIsMobile = (height, width) => {
|
|
294
|
+
if (height > 0 && width > 0) {
|
|
295
|
+
setIsMobile(!(width >= 1024));
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
useEffect(() => {
|
|
299
|
+
windowSize && checkIsMobile(windowSize.height, windowSize.width);
|
|
300
|
+
}, [windowSize]);
|
|
301
|
+
return { isMobile };
|
|
288
302
|
}
|
|
289
303
|
|
|
290
304
|
var css_248z$X = ".Backdrop-module_backdrop__IRMoL {\n height: 100%;\n width: 100%;\n position: absolute;\n opacity: 0.5;\n z-index: 1040;\n top: 0;\n left: 0;\n background-color: #000; }\n .Backdrop-module_backdrop__IRMoL.Backdrop-module_isTransparent__F5nA5 {\n opacity: 0; }\n";
|
|
@@ -1674,16 +1688,17 @@ const ExpansionPanel = (props) => {
|
|
|
1674
1688
|
React.createElement(ExpansionPanelContent, null, children)));
|
|
1675
1689
|
};
|
|
1676
1690
|
|
|
1677
|
-
var css_248z$m = ".FloatingActionButton-module_fab__Rw3kd {\n box-shadow: var(--shadow); }\n .FloatingActionButton-
|
|
1678
|
-
var styles$m = {"fab":"FloatingActionButton-module_fab__Rw3kd","fixed":"FloatingActionButton-module_fixed__XQOkG"};
|
|
1691
|
+
var css_248z$m = ".FloatingActionButton-module_fab__Rw3kd {\n box-shadow: var(--shadow); }\n\n.FloatingActionButton-module_fixed__XQOkG {\n position: fixed;\n z-index: 1000; }\n .FloatingActionButton-module_fixed__XQOkG.FloatingActionButton-module_leftTop__ZiHQN {\n top: 16px;\n left: 16px; }\n .FloatingActionButton-module_fixed__XQOkG.FloatingActionButton-module_leftBottom__210sl {\n bottom: 16px;\n left: 16px; }\n .FloatingActionButton-module_fixed__XQOkG.FloatingActionButton-module_rightTop__VUsvT {\n top: 64px;\n right: 16px; }\n .FloatingActionButton-module_fixed__XQOkG.FloatingActionButton-module_rightBottom__FaUFl {\n bottom: 16px;\n right: 16px; }\n";
|
|
1692
|
+
var styles$m = {"fab":"FloatingActionButton-module_fab__Rw3kd","fixed":"FloatingActionButton-module_fixed__XQOkG","leftTop":"FloatingActionButton-module_leftTop__ZiHQN","leftBottom":"FloatingActionButton-module_leftBottom__210sl","rightTop":"FloatingActionButton-module_rightTop__VUsvT","rightBottom":"FloatingActionButton-module_rightBottom__FaUFl"};
|
|
1679
1693
|
styleInject(css_248z$m);
|
|
1680
1694
|
|
|
1681
1695
|
const FloatingActionButton = (props) => {
|
|
1682
|
-
const { className, icon, color = COLOR.primary, fixed, size = SIZE.lg, isActive, disabled, onClick } = props;
|
|
1696
|
+
const { className, icon, color = COLOR.primary, fixed, position = 'rightBottom', size = SIZE.lg, isActive, disabled, onClick } = props;
|
|
1683
1697
|
const getCssClasses = () => {
|
|
1684
1698
|
const cssClasses = [];
|
|
1685
1699
|
cssClasses.push(styles$m.fab);
|
|
1686
|
-
fixed && cssClasses.push(styles$m
|
|
1700
|
+
fixed && cssClasses.push(styles$m.fixed);
|
|
1701
|
+
position && fixed && cssClasses.push(styles$m[position]);
|
|
1687
1702
|
className && cssClasses.push(className);
|
|
1688
1703
|
return cssClasses.filter(css => css).join(' ');
|
|
1689
1704
|
};
|
|
@@ -2716,4 +2731,4 @@ const TreeItem = (props) => {
|
|
|
2716
2731
|
children && _isExpanded ? React.createElement("ul", null, children) : null));
|
|
2717
2732
|
};
|
|
2718
2733
|
|
|
2719
|
-
export { Alert, AppBar, AppBarTitle, AutoComplete, Backdrop, Badge, Breadcrumb, BreadcrumbItem, Button, ButtonGroup, COLOR, Card, CardBody, CardFooter, CardImage, CardSubtitle, CardText, CardTitle, CaretDownSolidIcon, CheckSolidIcon, CheckSquareRegularIcon, Checkbox, ChevronDownSolidIcon, ChevronLeftSolidIcon, ChevronRightSolidIcon, ChevronUpSolidIcon, Chip, CircleSolidIcon, Column, ConditionalWrapper, CssTransition, DATEMODE, DateSelect, DaySelect, Drawer, EmailValidator, ExpansionPanel, ExpansionPanelContent, ExpansionPanelHeader, FileInput, FloatingActionButton, Form, FormControl, FormError, FormGroup, FormHint, FormInput, FormLabel, GlobalModal, HomeSolidIcon, HourSelect, Icon, IconButton, IsEmptyValidator, IsEqualValidator, Link, List, ListItem, ListItemAction, ListItemAvatar, ListItemIcon, ListItemText, LoadingIndicator, LoadingIndicatorContainer, MODALBUTTONTYPE, MODALTYPE, Menu, MenuBody, MenuDivider, MenuItem, MenuToggle, MilliSecondSelect, MinuteSelect, Modal, ModalBody, ModalFooter, ModalHeader, MonthSelect, NumberSelect, POSITION, PlusSolidIcon, Row, SIZE, STATUS, SecondSelect, Select, Sidebar, Snackbar, SpeedDial, SpeedDialAction, SpeedDialIcon, SpinnerSolidIcon, SquareRegularIcon, Step, Stepper, StepperActions, TIMEMODE, Tab, TabPanel, Table, TableBody, TableCell, TableHead, TableRow, Tabs, Textarea, TimeSelect, TimesCircleSolidIcon, TimesSolidIcon, Tooltip, TreeItem, TreeView, Typography, VARIANT, YearSelect, loadingIndicatorService, modalService, snackbarService, useConstructor, useCssClasses, useDebounce, useHover, useWindowSize };
|
|
2734
|
+
export { Alert, AppBar, AppBarTitle, AutoComplete, Backdrop, Badge, Breadcrumb, BreadcrumbItem, Button, ButtonGroup, COLOR, Card, CardBody, CardFooter, CardImage, CardSubtitle, CardText, CardTitle, CaretDownSolidIcon, CheckSolidIcon, CheckSquareRegularIcon, Checkbox, ChevronDownSolidIcon, ChevronLeftSolidIcon, ChevronRightSolidIcon, ChevronUpSolidIcon, Chip, CircleSolidIcon, Column, ConditionalWrapper, CssTransition, DATEMODE, DateSelect, DaySelect, Drawer, EmailValidator, ExpansionPanel, ExpansionPanelContent, ExpansionPanelHeader, FileInput, FloatingActionButton, Form, FormControl, FormError, FormGroup, FormHint, FormInput, FormLabel, GlobalModal, HomeSolidIcon, HourSelect, Icon, IconButton, IsEmptyValidator, IsEqualValidator, Link, List, ListItem, ListItemAction, ListItemAvatar, ListItemIcon, ListItemText, LoadingIndicator, LoadingIndicatorContainer, MODALBUTTONTYPE, MODALTYPE, Menu, MenuBody, MenuDivider, MenuItem, MenuToggle, MilliSecondSelect, MinuteSelect, Modal, ModalBody, ModalFooter, ModalHeader, MonthSelect, NumberSelect, POSITION, PlusSolidIcon, Row, SIZE, STATUS, SecondSelect, Select, Sidebar, Snackbar, SpeedDial, SpeedDialAction, SpeedDialIcon, SpinnerSolidIcon, SquareRegularIcon, Step, Stepper, StepperActions, TIMEMODE, Tab, TabPanel, Table, TableBody, TableCell, TableHead, TableRow, Tabs, Textarea, TimeSelect, TimesCircleSolidIcon, TimesSolidIcon, Tooltip, TreeItem, TreeView, Typography, VARIANT, YearSelect, loadingIndicatorService, modalService, snackbarService, useConstructor, useCssClasses, useDebounce, useHover, useMobileDetect, useWindowSize };
|
package/index.js
CHANGED
|
@@ -232,23 +232,26 @@ const CircleSolidIcon = () => (React__default["default"].createElement("svg", {
|
|
|
232
232
|
const ChevronLeftSolidIcon = () => (React__default["default"].createElement("svg", { "aria-hidden": "true", focusable: "false", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 320 512" },
|
|
233
233
|
React__default["default"].createElement("path", { fill: "currentColor", d: "M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z" })));
|
|
234
234
|
|
|
235
|
-
function
|
|
236
|
-
const
|
|
237
|
-
width: 0,
|
|
238
|
-
height: 0,
|
|
239
|
-
});
|
|
235
|
+
function useDebounce(callback, timeout, deps) {
|
|
236
|
+
const timeoutId = React.useRef();
|
|
240
237
|
React.useEffect(() => {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
238
|
+
clearTimeout(timeoutId.current);
|
|
239
|
+
timeoutId.current = setTimeout(callback, timeout);
|
|
240
|
+
return () => clearTimeout(timeoutId.current);
|
|
241
|
+
}, deps);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const useConstructor = (callBack) => {
|
|
245
|
+
const [hasBeenCalled, setHasBeenCalled] = React.useState(false);
|
|
246
|
+
if (hasBeenCalled)
|
|
247
|
+
return;
|
|
248
|
+
callBack();
|
|
249
|
+
setHasBeenCalled(true);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
function useCssClasses(cssClasses) {
|
|
253
|
+
const cssClassName = (cssClasses === null || cssClasses === void 0 ? void 0 : cssClasses.filter(css => css).join(' ')) || '';
|
|
254
|
+
return [cssClassName];
|
|
252
255
|
}
|
|
253
256
|
|
|
254
257
|
function useHover() {
|
|
@@ -273,26 +276,37 @@ function useHover() {
|
|
|
273
276
|
return [ref, value];
|
|
274
277
|
}
|
|
275
278
|
|
|
276
|
-
|
|
277
|
-
const [
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
setHasBeenCalled(true);
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
function useDebounce(callback, timeout, deps) {
|
|
285
|
-
const timeoutId = React.useRef();
|
|
279
|
+
function useWindowSize() {
|
|
280
|
+
const [windowSize, setWindowSize] = React.useState({
|
|
281
|
+
width: 0,
|
|
282
|
+
height: 0,
|
|
283
|
+
});
|
|
286
284
|
React.useEffect(() => {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
285
|
+
function handleResize() {
|
|
286
|
+
setWindowSize({
|
|
287
|
+
width: window.innerWidth,
|
|
288
|
+
height: window.innerHeight,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
window.addEventListener("resize", handleResize);
|
|
292
|
+
handleResize();
|
|
293
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
294
|
+
}, []);
|
|
295
|
+
return windowSize;
|
|
291
296
|
}
|
|
292
297
|
|
|
293
|
-
function
|
|
294
|
-
const
|
|
295
|
-
|
|
298
|
+
function useMobileDetect() {
|
|
299
|
+
const [isMobile, setIsMobile] = React.useState(false);
|
|
300
|
+
const windowSize = useWindowSize();
|
|
301
|
+
const checkIsMobile = (height, width) => {
|
|
302
|
+
if (height > 0 && width > 0) {
|
|
303
|
+
setIsMobile(!(width >= 1024));
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
React.useEffect(() => {
|
|
307
|
+
windowSize && checkIsMobile(windowSize.height, windowSize.width);
|
|
308
|
+
}, [windowSize]);
|
|
309
|
+
return { isMobile };
|
|
296
310
|
}
|
|
297
311
|
|
|
298
312
|
var css_248z$X = ".Backdrop-module_backdrop__IRMoL {\n height: 100%;\n width: 100%;\n position: absolute;\n opacity: 0.5;\n z-index: 1040;\n top: 0;\n left: 0;\n background-color: #000; }\n .Backdrop-module_backdrop__IRMoL.Backdrop-module_isTransparent__F5nA5 {\n opacity: 0; }\n";
|
|
@@ -1682,16 +1696,17 @@ const ExpansionPanel = (props) => {
|
|
|
1682
1696
|
React__default["default"].createElement(ExpansionPanelContent, null, children)));
|
|
1683
1697
|
};
|
|
1684
1698
|
|
|
1685
|
-
var css_248z$m = ".FloatingActionButton-module_fab__Rw3kd {\n box-shadow: var(--shadow); }\n .FloatingActionButton-
|
|
1686
|
-
var styles$m = {"fab":"FloatingActionButton-module_fab__Rw3kd","fixed":"FloatingActionButton-module_fixed__XQOkG"};
|
|
1699
|
+
var css_248z$m = ".FloatingActionButton-module_fab__Rw3kd {\n box-shadow: var(--shadow); }\n\n.FloatingActionButton-module_fixed__XQOkG {\n position: fixed;\n z-index: 1000; }\n .FloatingActionButton-module_fixed__XQOkG.FloatingActionButton-module_leftTop__ZiHQN {\n top: 16px;\n left: 16px; }\n .FloatingActionButton-module_fixed__XQOkG.FloatingActionButton-module_leftBottom__210sl {\n bottom: 16px;\n left: 16px; }\n .FloatingActionButton-module_fixed__XQOkG.FloatingActionButton-module_rightTop__VUsvT {\n top: 64px;\n right: 16px; }\n .FloatingActionButton-module_fixed__XQOkG.FloatingActionButton-module_rightBottom__FaUFl {\n bottom: 16px;\n right: 16px; }\n";
|
|
1700
|
+
var styles$m = {"fab":"FloatingActionButton-module_fab__Rw3kd","fixed":"FloatingActionButton-module_fixed__XQOkG","leftTop":"FloatingActionButton-module_leftTop__ZiHQN","leftBottom":"FloatingActionButton-module_leftBottom__210sl","rightTop":"FloatingActionButton-module_rightTop__VUsvT","rightBottom":"FloatingActionButton-module_rightBottom__FaUFl"};
|
|
1687
1701
|
styleInject(css_248z$m);
|
|
1688
1702
|
|
|
1689
1703
|
const FloatingActionButton = (props) => {
|
|
1690
|
-
const { className, icon, color = exports.COLOR.primary, fixed, size = exports.SIZE.lg, isActive, disabled, onClick } = props;
|
|
1704
|
+
const { className, icon, color = exports.COLOR.primary, fixed, position = 'rightBottom', size = exports.SIZE.lg, isActive, disabled, onClick } = props;
|
|
1691
1705
|
const getCssClasses = () => {
|
|
1692
1706
|
const cssClasses = [];
|
|
1693
1707
|
cssClasses.push(styles$m.fab);
|
|
1694
|
-
fixed && cssClasses.push(styles$m
|
|
1708
|
+
fixed && cssClasses.push(styles$m.fixed);
|
|
1709
|
+
position && fixed && cssClasses.push(styles$m[position]);
|
|
1695
1710
|
className && cssClasses.push(className);
|
|
1696
1711
|
return cssClasses.filter(css => css).join(' ');
|
|
1697
1712
|
};
|
|
@@ -2838,4 +2853,5 @@ exports.useConstructor = useConstructor;
|
|
|
2838
2853
|
exports.useCssClasses = useCssClasses;
|
|
2839
2854
|
exports.useDebounce = useDebounce;
|
|
2840
2855
|
exports.useHover = useHover;
|
|
2856
|
+
exports.useMobileDetect = useMobileDetect;
|
|
2841
2857
|
exports.useWindowSize = useWindowSize;
|