art-bd-ui 1.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/README.md +1 -0
- package/dist/cjs/components/buttons/button/button.js +43 -0
- package/dist/cjs/components/buttons/icon-button/icon-button.js +33 -0
- package/dist/cjs/components/buttons/toggle/toggle.js +34 -0
- package/dist/cjs/components/buttons/toggle-group/toggle-group.js +31 -0
- package/dist/cjs/components/forms/checkbox/checkbox.js +52 -0
- package/dist/cjs/components/forms/input/input.js +38 -0
- package/dist/cjs/components/forms/label/label.js +38 -0
- package/dist/cjs/components/forms/radio/radio.js +22 -0
- package/dist/cjs/components/forms/select/select.js +72 -0
- package/dist/cjs/components/forms/switch/switch.js +51 -0
- package/dist/cjs/components/forms/textarea/textarea.js +37 -0
- package/dist/cjs/components/layout/box/box.js +19 -0
- package/dist/cjs/components/layout/flex/flex.js +14 -0
- package/dist/cjs/components/layout/grid/grid.js +14 -0
- package/dist/cjs/components/media/aspect-ratio/aspect-ratio.js +31 -0
- package/dist/cjs/components/media/avatar/avatar.js +27 -0
- package/dist/cjs/components/media/icon/icon.js +27 -0
- package/dist/cjs/components/popovers/dialog/dialog.js +69 -0
- package/dist/cjs/components/popovers/drawer/drawer.js +82 -0
- package/dist/cjs/components/popovers/popover/popover.js +66 -0
- package/dist/cjs/components/popovers/sheet/sheet.js +94 -0
- package/dist/cjs/components/popovers/toast/toast.js +75 -0
- package/dist/cjs/components/popovers/tooltip/tooltip.js +45 -0
- package/dist/cjs/components/typography/heading/heading.js +55 -0
- package/dist/cjs/components/typography/text/text.js +57 -0
- package/dist/cjs/components/ui/alert/alert.js +34 -0
- package/dist/cjs/components/ui/badge/badge.js +31 -0
- package/dist/cjs/components/ui/button/button.js +42 -0
- package/dist/cjs/components/ui/calendar/calendar.js +24 -0
- package/dist/cjs/components/ui/command/command.js +83 -0
- package/dist/cjs/components/ui/data-table/components/cell.js +24 -0
- package/dist/cjs/components/ui/data-table/components/column-group.js +45 -0
- package/dist/cjs/components/ui/data-table/components/table-body.js +47 -0
- package/dist/cjs/components/ui/data-table/components/table-fallback.js +28 -0
- package/dist/cjs/components/ui/data-table/components/table-head.js +56 -0
- package/dist/cjs/components/ui/data-table/components/table-placeholder.js +18 -0
- package/dist/cjs/components/ui/data-table/data-table.js +97 -0
- package/dist/cjs/components/ui/data-table/hooks/contextHooks.js +75 -0
- package/dist/cjs/components/ui/data-table/hooks/useStickyColumns.js +98 -0
- package/dist/cjs/components/ui/data-table/utils.js +26 -0
- package/dist/cjs/components/ui/date-picker/date-picker.js +15 -0
- package/dist/cjs/components/ui/dropdown-menu/dropdown-menu.js +100 -0
- package/dist/cjs/components/ui/icon/icon.js +27 -0
- package/dist/cjs/components/ui/link/link.js +32 -0
- package/dist/cjs/components/ui/pagination/pagination.js +51 -0
- package/dist/cjs/components/ui/progress/progress.js +13 -0
- package/dist/cjs/components/ui/sidebar/sidebar.js +331 -0
- package/dist/cjs/components/ui/table/components/cell.js +30 -0
- package/dist/cjs/components/ui/table/components/row.js +25 -0
- package/dist/cjs/components/ui/table/components/table-body.js +13 -0
- package/dist/cjs/components/ui/table/components/table-caption.js +13 -0
- package/dist/cjs/components/ui/table/components/table-footer.js +13 -0
- package/dist/cjs/components/ui/table/components/table-head.js +30 -0
- package/dist/cjs/components/ui/table/components/table-header.js +13 -0
- package/dist/cjs/components/ui/table/table.js +36 -0
- package/dist/cjs/components/ui/tabs/tabs.js +47 -0
- package/dist/cjs/components/utility/empty-state/empty-state.js +29 -0
- package/dist/cjs/components/utility/separator/separator.js +14 -0
- package/dist/cjs/components/utility/skeleton/skeleton.js +13 -0
- package/dist/cjs/components/utility/status-controller/status-controller.js +12 -0
- package/dist/cjs/hooks/use-mobile.js +21 -0
- package/dist/cjs/hooks/useControlled.js +19 -0
- package/dist/cjs/hooks/useFirstMountState.js +16 -0
- package/dist/cjs/hooks/useForkRef.js +23 -0
- package/dist/cjs/hooks/useLatest.js +12 -0
- package/dist/cjs/hooks/usePrevious.js +14 -0
- package/dist/cjs/hooks/useScrollState.js +39 -0
- package/dist/cjs/hooks/useStateRef.js +12 -0
- package/dist/cjs/hooks/useUpdateEffect.js +17 -0
- package/dist/cjs/index.js +237 -0
- package/dist/cjs/lib/utils.js +16 -0
- package/dist/cjs/styles/responsive.js +84 -0
- package/dist/cjs/styles/typography.js +25 -0
- package/dist/cjs/utils/addIf.js +5 -0
- package/dist/cjs/utils/chain.js +30 -0
- package/dist/cjs/utils/getBoundingRect.js +19 -0
- package/dist/cjs/utils/mergeProps.js +42 -0
- package/dist/cjs/utils/mergeRefs.js +18 -0
- package/dist/cjs/utils/toggle.js +16 -0
- package/dist/esm/components/buttons/button/button.js +40 -0
- package/dist/esm/components/buttons/icon-button/icon-button.js +31 -0
- package/dist/esm/components/buttons/toggle/toggle.js +31 -0
- package/dist/esm/components/buttons/toggle-group/toggle-group.js +28 -0
- package/dist/esm/components/forms/checkbox/checkbox.js +50 -0
- package/dist/esm/components/forms/input/input.js +36 -0
- package/dist/esm/components/forms/label/label.js +36 -0
- package/dist/esm/components/forms/radio/radio.js +19 -0
- package/dist/esm/components/forms/select/select.js +61 -0
- package/dist/esm/components/forms/switch/switch.js +49 -0
- package/dist/esm/components/forms/textarea/textarea.js +35 -0
- package/dist/esm/components/layout/box/box.js +17 -0
- package/dist/esm/components/layout/flex/flex.js +12 -0
- package/dist/esm/components/layout/grid/grid.js +12 -0
- package/dist/esm/components/media/aspect-ratio/aspect-ratio.js +10 -0
- package/dist/esm/components/media/avatar/avatar.js +23 -0
- package/dist/esm/components/media/icon/icon.js +25 -0
- package/dist/esm/components/popovers/dialog/dialog.js +60 -0
- package/dist/esm/components/popovers/drawer/drawer.js +74 -0
- package/dist/esm/components/popovers/popover/popover.js +61 -0
- package/dist/esm/components/popovers/sheet/sheet.js +86 -0
- package/dist/esm/components/popovers/toast/toast.js +67 -0
- package/dist/esm/components/popovers/tooltip/tooltip.js +40 -0
- package/dist/esm/components/typography/heading/heading.js +53 -0
- package/dist/esm/components/typography/text/text.js +55 -0
- package/dist/esm/components/ui/alert/alert.js +30 -0
- package/dist/esm/components/ui/badge/badge.js +28 -0
- package/dist/esm/components/ui/button/button.js +40 -0
- package/dist/esm/components/ui/calendar/calendar.js +22 -0
- package/dist/esm/components/ui/command/command.js +73 -0
- package/dist/esm/components/ui/data-table/components/cell.js +22 -0
- package/dist/esm/components/ui/data-table/components/column-group.js +43 -0
- package/dist/esm/components/ui/data-table/components/table-body.js +45 -0
- package/dist/esm/components/ui/data-table/components/table-fallback.js +26 -0
- package/dist/esm/components/ui/data-table/components/table-head.js +54 -0
- package/dist/esm/components/ui/data-table/components/table-placeholder.js +16 -0
- package/dist/esm/components/ui/data-table/data-table.js +95 -0
- package/dist/esm/components/ui/data-table/hooks/contextHooks.js +60 -0
- package/dist/esm/components/ui/data-table/hooks/useStickyColumns.js +96 -0
- package/dist/esm/components/ui/data-table/utils.js +22 -0
- package/dist/esm/components/ui/date-picker/date-picker.js +13 -0
- package/dist/esm/components/ui/dropdown-menu/dropdown-menu.js +84 -0
- package/dist/esm/components/ui/icon/icon.js +25 -0
- package/dist/esm/components/ui/link/link.js +30 -0
- package/dist/esm/components/ui/pagination/pagination.js +43 -0
- package/dist/esm/components/ui/progress/progress.js +11 -0
- package/dist/esm/components/ui/sidebar/sidebar.js +306 -0
- package/dist/esm/components/ui/table/components/cell.js +28 -0
- package/dist/esm/components/ui/table/components/row.js +23 -0
- package/dist/esm/components/ui/table/components/table-body.js +11 -0
- package/dist/esm/components/ui/table/components/table-caption.js +11 -0
- package/dist/esm/components/ui/table/components/table-footer.js +11 -0
- package/dist/esm/components/ui/table/components/table-head.js +28 -0
- package/dist/esm/components/ui/table/components/table-header.js +11 -0
- package/dist/esm/components/ui/table/table.js +26 -0
- package/dist/esm/components/ui/tabs/tabs.js +23 -0
- package/dist/esm/components/utility/empty-state/empty-state.js +27 -0
- package/dist/esm/components/utility/separator/separator.js +12 -0
- package/dist/esm/components/utility/skeleton/skeleton.js +11 -0
- package/dist/esm/components/utility/status-controller/status-controller.js +10 -0
- package/dist/esm/hooks/use-mobile.js +19 -0
- package/dist/esm/hooks/useControlled.js +17 -0
- package/dist/esm/hooks/useFirstMountState.js +14 -0
- package/dist/esm/hooks/useForkRef.js +21 -0
- package/dist/esm/hooks/useLatest.js +10 -0
- package/dist/esm/hooks/usePrevious.js +12 -0
- package/dist/esm/hooks/useScrollState.js +37 -0
- package/dist/esm/hooks/useStateRef.js +10 -0
- package/dist/esm/hooks/useUpdateEffect.js +15 -0
- package/dist/esm/index.js +63 -0
- package/dist/esm/lib/utils.js +13 -0
- package/dist/esm/styles/responsive.js +81 -0
- package/dist/esm/styles/typography.js +21 -0
- package/dist/esm/utils/addIf.js +3 -0
- package/dist/esm/utils/chain.js +28 -0
- package/dist/esm/utils/getBoundingRect.js +16 -0
- package/dist/esm/utils/mergeProps.js +40 -0
- package/dist/esm/utils/mergeRefs.js +15 -0
- package/dist/esm/utils/toggle.js +14 -0
- package/dist/styles.css +1 -0
- package/dist/types/index.d.ts +1418 -0
- package/package.json +114 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('react');
|
|
5
|
+
|
|
6
|
+
const MOBILE_BREAKPOINT = 768;
|
|
7
|
+
function useIsMobile() {
|
|
8
|
+
const [isMobile, setIsMobile] = react.useState(undefined);
|
|
9
|
+
react.useEffect(() => {
|
|
10
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
11
|
+
const onChange = () => {
|
|
12
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
13
|
+
};
|
|
14
|
+
mql.addEventListener("change", onChange);
|
|
15
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
16
|
+
return () => mql.removeEventListener("change", onChange);
|
|
17
|
+
}, []);
|
|
18
|
+
return !!isMobile;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.useIsMobile = useIsMobile;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('react');
|
|
5
|
+
|
|
6
|
+
const useControlled = (controlledValue, defaultValue) => {
|
|
7
|
+
const controlledRef = react.useRef(false);
|
|
8
|
+
controlledRef.current = controlledValue !== undefined;
|
|
9
|
+
const [uncontrolledValue, setUncontrolledValue] = react.useState(defaultValue);
|
|
10
|
+
const value = (controlledRef.current ? controlledValue : uncontrolledValue);
|
|
11
|
+
const setValue = react.useCallback((nextValue) => {
|
|
12
|
+
if (!controlledRef.current) {
|
|
13
|
+
setUncontrolledValue(nextValue);
|
|
14
|
+
}
|
|
15
|
+
}, [controlledRef]);
|
|
16
|
+
return [value, setValue, controlledRef.current];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.useControlled = useControlled;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('react');
|
|
5
|
+
|
|
6
|
+
// Read more - https://github.com/streamich/react-use/blob/master/src/useFirstMountState.ts
|
|
7
|
+
const useFirstMountState = () => {
|
|
8
|
+
const isFirst = react.useRef(true);
|
|
9
|
+
if (isFirst.current) {
|
|
10
|
+
isFirst.current = false;
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return isFirst.current;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.useFirstMountState = useFirstMountState;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('react');
|
|
5
|
+
require('clsx');
|
|
6
|
+
var mergeRefs = require('../utils/mergeRefs.js');
|
|
7
|
+
|
|
8
|
+
function useForkRef(...refs) {
|
|
9
|
+
return react.useMemo(() => {
|
|
10
|
+
if (refs.every((ref) => ref == null)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return (instance) => {
|
|
14
|
+
refs.forEach((ref) => {
|
|
15
|
+
if (ref) {
|
|
16
|
+
mergeRefs.assignRef(ref, instance);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
}, [refs]);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.useForkRef = useForkRef;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('react');
|
|
5
|
+
|
|
6
|
+
const usePrevious = (value) => {
|
|
7
|
+
const ref = react.useRef(value);
|
|
8
|
+
react.useEffect(() => {
|
|
9
|
+
ref.current = value;
|
|
10
|
+
}, [value]);
|
|
11
|
+
return ref.current;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.usePrevious = usePrevious;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var throttle = require('lodash/throttle');
|
|
6
|
+
|
|
7
|
+
const useScrollState = (containerRef) => {
|
|
8
|
+
const [isScrolledToLeftCorner, setLeftScrollCornerReached] = react.useState(true);
|
|
9
|
+
const [isScrolledToRightCorner, setRightScrollCornerReached] = react.useState(true);
|
|
10
|
+
const [isScrolledToTopCorner, setTopScrollCornerReached] = react.useState(true);
|
|
11
|
+
const [isScrolledToBottomCorner, setBottomScrollCornerReached] = react.useState(true);
|
|
12
|
+
const throttledUpdate = react.useMemo(() => throttle(() => {
|
|
13
|
+
if (!containerRef.current)
|
|
14
|
+
return;
|
|
15
|
+
const { scrollLeft, scrollTop, scrollWidth, scrollHeight, clientWidth, clientHeight } = containerRef.current;
|
|
16
|
+
setLeftScrollCornerReached(scrollLeft === 0);
|
|
17
|
+
setRightScrollCornerReached(scrollWidth - (scrollLeft + clientWidth) <= 1);
|
|
18
|
+
setTopScrollCornerReached(scrollTop === 0);
|
|
19
|
+
setBottomScrollCornerReached(scrollHeight - (scrollTop + clientHeight) <= 1);
|
|
20
|
+
}, 150, { trailing: true }), []);
|
|
21
|
+
react.useLayoutEffect(() => {
|
|
22
|
+
const container = containerRef.current;
|
|
23
|
+
if (!container)
|
|
24
|
+
return;
|
|
25
|
+
throttledUpdate();
|
|
26
|
+
container.addEventListener("scroll", throttledUpdate);
|
|
27
|
+
return () => {
|
|
28
|
+
container.removeEventListener("scroll", throttledUpdate);
|
|
29
|
+
};
|
|
30
|
+
}, [containerRef]);
|
|
31
|
+
return {
|
|
32
|
+
isScrolledToLeftCorner,
|
|
33
|
+
isScrolledToRightCorner,
|
|
34
|
+
isScrolledToTopCorner,
|
|
35
|
+
isScrolledToBottomCorner,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.useScrollState = useScrollState;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('react');
|
|
5
|
+
|
|
6
|
+
const useStateRef = (defaultValue) => {
|
|
7
|
+
const [node, setNode] = react.useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : null);
|
|
8
|
+
const setRef = react.useCallback((newNode) => setNode(newNode), []);
|
|
9
|
+
return [node, setRef];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.useStateRef = useStateRef;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var useFirstMountState = require('./useFirstMountState.js');
|
|
6
|
+
|
|
7
|
+
// Read more -> https://github.com/streamich/react-use/blob/master/src/useUpdateEffect.ts
|
|
8
|
+
const useUpdateEffect = (effect, deps) => {
|
|
9
|
+
const isFirstMount = useFirstMountState.useFirstMountState();
|
|
10
|
+
react.useEffect(() => {
|
|
11
|
+
if (!isFirstMount) {
|
|
12
|
+
return effect();
|
|
13
|
+
}
|
|
14
|
+
}, deps);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.useUpdateEffect = useUpdateEffect;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var box = require('./components/layout/box/box.js');
|
|
4
|
+
var flex = require('./components/layout/flex/flex.js');
|
|
5
|
+
var grid = require('./components/layout/grid/grid.js');
|
|
6
|
+
var button = require('./components/buttons/button/button.js');
|
|
7
|
+
var iconButton = require('./components/buttons/icon-button/icon-button.js');
|
|
8
|
+
var toggle = require('./components/buttons/toggle/toggle.js');
|
|
9
|
+
var toggleGroup = require('./components/buttons/toggle-group/toggle-group.js');
|
|
10
|
+
var checkbox = require('./components/forms/checkbox/checkbox.js');
|
|
11
|
+
var input = require('./components/forms/input/input.js');
|
|
12
|
+
var label = require('./components/forms/label/label.js');
|
|
13
|
+
var radio = require('./components/forms/radio/radio.js');
|
|
14
|
+
var select = require('./components/forms/select/select.js');
|
|
15
|
+
var _switch = require('./components/forms/switch/switch.js');
|
|
16
|
+
var textarea = require('./components/forms/textarea/textarea.js');
|
|
17
|
+
var icon = require('./components/media/icon/icon.js');
|
|
18
|
+
var avatar = require('./components/media/avatar/avatar.js');
|
|
19
|
+
var aspectRatio = require('./components/media/aspect-ratio/aspect-ratio.js');
|
|
20
|
+
var dialog = require('./components/popovers/dialog/dialog.js');
|
|
21
|
+
var drawer = require('./components/popovers/drawer/drawer.js');
|
|
22
|
+
var popover = require('./components/popovers/popover/popover.js');
|
|
23
|
+
var sheet = require('./components/popovers/sheet/sheet.js');
|
|
24
|
+
var toast = require('./components/popovers/toast/toast.js');
|
|
25
|
+
var tooltip = require('./components/popovers/tooltip/tooltip.js');
|
|
26
|
+
var heading = require('./components/typography/heading/heading.js');
|
|
27
|
+
var text = require('./components/typography/text/text.js');
|
|
28
|
+
var alert = require('./components/ui/alert/alert.js');
|
|
29
|
+
var badge = require('./components/ui/badge/badge.js');
|
|
30
|
+
var calendar = require('./components/ui/calendar/calendar.js');
|
|
31
|
+
var command = require('./components/ui/command/command.js');
|
|
32
|
+
var dataTable = require('./components/ui/data-table/data-table.js');
|
|
33
|
+
var datePicker = require('./components/ui/date-picker/date-picker.js');
|
|
34
|
+
var dropdownMenu = require('./components/ui/dropdown-menu/dropdown-menu.js');
|
|
35
|
+
var link = require('./components/ui/link/link.js');
|
|
36
|
+
var pagination = require('./components/ui/pagination/pagination.js');
|
|
37
|
+
var progress = require('./components/ui/progress/progress.js');
|
|
38
|
+
var sidebar = require('./components/ui/sidebar/sidebar.js');
|
|
39
|
+
var table = require('./components/ui/table/table.js');
|
|
40
|
+
var tabs = require('./components/ui/tabs/tabs.js');
|
|
41
|
+
var emptyState = require('./components/utility/empty-state/empty-state.js');
|
|
42
|
+
var separator = require('./components/utility/separator/separator.js');
|
|
43
|
+
var skeleton = require('./components/utility/skeleton/skeleton.js');
|
|
44
|
+
var statusController = require('./components/utility/status-controller/status-controller.js');
|
|
45
|
+
var useFirstMountState = require('./hooks/useFirstMountState.js');
|
|
46
|
+
var useUpdateEffect = require('./hooks/useUpdateEffect.js');
|
|
47
|
+
var useForkRef = require('./hooks/useForkRef.js');
|
|
48
|
+
var useStateRef = require('./hooks/useStateRef.js');
|
|
49
|
+
var useControlled = require('./hooks/useControlled.js');
|
|
50
|
+
var usePrevious = require('./hooks/usePrevious.js');
|
|
51
|
+
var useLatest = require('./hooks/useLatest.js');
|
|
52
|
+
var useScrollState = require('./hooks/useScrollState.js');
|
|
53
|
+
var chain = require('./utils/chain.js');
|
|
54
|
+
var mergeProps = require('./utils/mergeProps.js');
|
|
55
|
+
var mergeRefs = require('./utils/mergeRefs.js');
|
|
56
|
+
var toggle$1 = require('./utils/toggle.js');
|
|
57
|
+
var addIf = require('./utils/addIf.js');
|
|
58
|
+
var getBoundingRect = require('./utils/getBoundingRect.js');
|
|
59
|
+
var tableHeader = require('./components/ui/table/components/table-header.js');
|
|
60
|
+
var tableBody = require('./components/ui/table/components/table-body.js');
|
|
61
|
+
var tableFooter = require('./components/ui/table/components/table-footer.js');
|
|
62
|
+
var tableHead = require('./components/ui/table/components/table-head.js');
|
|
63
|
+
var row = require('./components/ui/table/components/row.js');
|
|
64
|
+
var cell = require('./components/ui/table/components/cell.js');
|
|
65
|
+
var tableCaption = require('./components/ui/table/components/table-caption.js');
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
exports.Box = box.Box;
|
|
70
|
+
exports.Flex = flex.Flex;
|
|
71
|
+
exports.Grid = grid.Grid;
|
|
72
|
+
exports.Button = button.Button;
|
|
73
|
+
exports.buttonVariants = button.buttonVariants;
|
|
74
|
+
exports.IconButton = iconButton.IconButton;
|
|
75
|
+
exports.Toggle = toggle.Toggle;
|
|
76
|
+
exports.toggleVariants = toggle.toggleVariants;
|
|
77
|
+
exports.ToggleGroup = toggleGroup.ToggleGroup;
|
|
78
|
+
exports.ToggleGroupItem = toggleGroup.ToggleGroupItem;
|
|
79
|
+
exports.Checkbox = checkbox.Checkbox;
|
|
80
|
+
exports.Input = input.Input;
|
|
81
|
+
exports.Label = label.Label;
|
|
82
|
+
exports.RadioGroup = radio.RadioGroup;
|
|
83
|
+
exports.RadioGroupItem = radio.RadioGroupItem;
|
|
84
|
+
exports.Select = select.Select;
|
|
85
|
+
exports.SelectContent = select.SelectContent;
|
|
86
|
+
exports.SelectGroup = select.SelectGroup;
|
|
87
|
+
exports.SelectItem = select.SelectItem;
|
|
88
|
+
exports.SelectLabel = select.SelectLabel;
|
|
89
|
+
exports.SelectScrollDownButton = select.SelectScrollDownButton;
|
|
90
|
+
exports.SelectScrollUpButton = select.SelectScrollUpButton;
|
|
91
|
+
exports.SelectSeparator = select.SelectSeparator;
|
|
92
|
+
exports.SelectTrigger = select.SelectTrigger;
|
|
93
|
+
exports.SelectValue = select.SelectValue;
|
|
94
|
+
exports.Switch = _switch.Switch;
|
|
95
|
+
exports.Textarea = textarea.Textarea;
|
|
96
|
+
exports.Icon = icon.Icon;
|
|
97
|
+
exports.Avatar = avatar.Avatar;
|
|
98
|
+
exports.AvatarFallback = avatar.AvatarFallback;
|
|
99
|
+
exports.AvatarImage = avatar.AvatarImage;
|
|
100
|
+
exports.AspectRatio = aspectRatio.AspectRatio;
|
|
101
|
+
exports.Dialog = dialog.Dialog;
|
|
102
|
+
exports.DialogClose = dialog.DialogClose;
|
|
103
|
+
exports.DialogContent = dialog.DialogContent;
|
|
104
|
+
exports.DialogDescription = dialog.DialogDescription;
|
|
105
|
+
exports.DialogFooter = dialog.DialogFooter;
|
|
106
|
+
exports.DialogHeader = dialog.DialogHeader;
|
|
107
|
+
exports.DialogTitle = dialog.DialogTitle;
|
|
108
|
+
exports.DialogTrigger = dialog.DialogTrigger;
|
|
109
|
+
exports.Drawer = drawer.Drawer;
|
|
110
|
+
exports.DrawerClose = drawer.DrawerClose;
|
|
111
|
+
exports.DrawerContent = drawer.DrawerContent;
|
|
112
|
+
exports.DrawerDescription = drawer.DrawerDescription;
|
|
113
|
+
exports.DrawerFooter = drawer.DrawerFooter;
|
|
114
|
+
exports.DrawerHeader = drawer.DrawerHeader;
|
|
115
|
+
exports.DrawerTitle = drawer.DrawerTitle;
|
|
116
|
+
exports.Popover = popover.Popover;
|
|
117
|
+
exports.PopoverAnchor = popover.PopoverAnchor;
|
|
118
|
+
exports.PopoverContent = popover.PopoverContent;
|
|
119
|
+
exports.PopoverTrigger = popover.PopoverTrigger;
|
|
120
|
+
exports.Sheet = sheet.Sheet;
|
|
121
|
+
exports.SheetClose = sheet.SheetClose;
|
|
122
|
+
exports.SheetContent = sheet.SheetContent;
|
|
123
|
+
exports.SheetDescription = sheet.SheetDescription;
|
|
124
|
+
exports.SheetFooter = sheet.SheetFooter;
|
|
125
|
+
exports.SheetHeader = sheet.SheetHeader;
|
|
126
|
+
exports.SheetTitle = sheet.SheetTitle;
|
|
127
|
+
exports.Toast = toast.Toast;
|
|
128
|
+
exports.ToastAction = toast.ToastAction;
|
|
129
|
+
exports.ToastClose = toast.ToastClose;
|
|
130
|
+
exports.ToastDescription = toast.ToastDescription;
|
|
131
|
+
exports.ToastProvider = toast.ToastProvider;
|
|
132
|
+
exports.ToastTitle = toast.ToastTitle;
|
|
133
|
+
exports.ToastViewport = toast.ToastViewport;
|
|
134
|
+
exports.Tooltip = tooltip.Tooltip;
|
|
135
|
+
exports.TooltipContent = tooltip.TooltipContent;
|
|
136
|
+
exports.TooltipProvider = tooltip.TooltipProvider;
|
|
137
|
+
exports.TooltipTrigger = tooltip.TooltipTrigger;
|
|
138
|
+
exports.Heading = heading.Heading;
|
|
139
|
+
exports.Text = text.Text;
|
|
140
|
+
exports.Alert = alert.Alert;
|
|
141
|
+
exports.AlertDescription = alert.AlertDescription;
|
|
142
|
+
exports.AlertTitle = alert.AlertTitle;
|
|
143
|
+
exports.Badge = badge.Badge;
|
|
144
|
+
exports.badgeVariants = badge.badgeVariants;
|
|
145
|
+
exports.Calendar = calendar.Calendar;
|
|
146
|
+
exports.Command = command.Command;
|
|
147
|
+
exports.CommandDialog = command.CommandDialog;
|
|
148
|
+
exports.CommandEmpty = command.CommandEmpty;
|
|
149
|
+
exports.CommandGroup = command.CommandGroup;
|
|
150
|
+
exports.CommandInput = command.CommandInput;
|
|
151
|
+
exports.CommandItem = command.CommandItem;
|
|
152
|
+
exports.CommandList = command.CommandList;
|
|
153
|
+
exports.CommandSeparator = command.CommandSeparator;
|
|
154
|
+
exports.CommandShortcut = command.CommandShortcut;
|
|
155
|
+
exports.DataTable = dataTable.DataTable;
|
|
156
|
+
exports.DatePicker = datePicker.DatePicker;
|
|
157
|
+
exports.DropdownMenu = dropdownMenu.DropdownMenu;
|
|
158
|
+
exports.DropdownMenuCheckboxItem = dropdownMenu.DropdownMenuCheckboxItem;
|
|
159
|
+
exports.DropdownMenuContent = dropdownMenu.DropdownMenuContent;
|
|
160
|
+
exports.DropdownMenuGroup = dropdownMenu.DropdownMenuGroup;
|
|
161
|
+
exports.DropdownMenuItem = dropdownMenu.DropdownMenuItem;
|
|
162
|
+
exports.DropdownMenuLabel = dropdownMenu.DropdownMenuLabel;
|
|
163
|
+
exports.DropdownMenuPortal = dropdownMenu.DropdownMenuPortal;
|
|
164
|
+
exports.DropdownMenuRadioGroup = dropdownMenu.DropdownMenuRadioGroup;
|
|
165
|
+
exports.DropdownMenuRadioItem = dropdownMenu.DropdownMenuRadioItem;
|
|
166
|
+
exports.DropdownMenuSeparator = dropdownMenu.DropdownMenuSeparator;
|
|
167
|
+
exports.DropdownMenuShortcut = dropdownMenu.DropdownMenuShortcut;
|
|
168
|
+
exports.DropdownMenuSub = dropdownMenu.DropdownMenuSub;
|
|
169
|
+
exports.DropdownMenuSubContent = dropdownMenu.DropdownMenuSubContent;
|
|
170
|
+
exports.DropdownMenuSubTrigger = dropdownMenu.DropdownMenuSubTrigger;
|
|
171
|
+
exports.DropdownMenuTrigger = dropdownMenu.DropdownMenuTrigger;
|
|
172
|
+
exports.Link = link.Link;
|
|
173
|
+
exports.Pagination = pagination.Pagination;
|
|
174
|
+
exports.PaginationContent = pagination.PaginationContent;
|
|
175
|
+
exports.PaginationEllipsis = pagination.PaginationEllipsis;
|
|
176
|
+
exports.PaginationItem = pagination.PaginationItem;
|
|
177
|
+
exports.PaginationLink = pagination.PaginationLink;
|
|
178
|
+
exports.PaginationNext = pagination.PaginationNext;
|
|
179
|
+
exports.PaginationPrevious = pagination.PaginationPrevious;
|
|
180
|
+
exports.Progress = progress.Progress;
|
|
181
|
+
exports.Sidebar = sidebar.Sidebar;
|
|
182
|
+
exports.SidebarContent = sidebar.SidebarContent;
|
|
183
|
+
exports.SidebarFooter = sidebar.SidebarFooter;
|
|
184
|
+
exports.SidebarGroup = sidebar.SidebarGroup;
|
|
185
|
+
exports.SidebarGroupAction = sidebar.SidebarGroupAction;
|
|
186
|
+
exports.SidebarGroupContent = sidebar.SidebarGroupContent;
|
|
187
|
+
exports.SidebarGroupLabel = sidebar.SidebarGroupLabel;
|
|
188
|
+
exports.SidebarHeader = sidebar.SidebarHeader;
|
|
189
|
+
exports.SidebarInput = sidebar.SidebarInput;
|
|
190
|
+
exports.SidebarInset = sidebar.SidebarInset;
|
|
191
|
+
exports.SidebarMenu = sidebar.SidebarMenu;
|
|
192
|
+
exports.SidebarMenuAction = sidebar.SidebarMenuAction;
|
|
193
|
+
exports.SidebarMenuBadge = sidebar.SidebarMenuBadge;
|
|
194
|
+
exports.SidebarMenuButton = sidebar.SidebarMenuButton;
|
|
195
|
+
exports.SidebarMenuItem = sidebar.SidebarMenuItem;
|
|
196
|
+
exports.SidebarMenuSkeleton = sidebar.SidebarMenuSkeleton;
|
|
197
|
+
exports.SidebarMenuSub = sidebar.SidebarMenuSub;
|
|
198
|
+
exports.SidebarMenuSubButton = sidebar.SidebarMenuSubButton;
|
|
199
|
+
exports.SidebarMenuSubItem = sidebar.SidebarMenuSubItem;
|
|
200
|
+
exports.SidebarProvider = sidebar.SidebarProvider;
|
|
201
|
+
exports.SidebarRail = sidebar.SidebarRail;
|
|
202
|
+
exports.SidebarSeparator = sidebar.SidebarSeparator;
|
|
203
|
+
exports.SidebarTrigger = sidebar.SidebarTrigger;
|
|
204
|
+
exports.useSidebar = sidebar.useSidebar;
|
|
205
|
+
exports.Table = table.Table;
|
|
206
|
+
exports.TableContainer = table.TableContainer;
|
|
207
|
+
exports.Tabs = tabs.Tabs;
|
|
208
|
+
exports.TabsContent = tabs.TabsContent;
|
|
209
|
+
exports.TabsList = tabs.TabsList;
|
|
210
|
+
exports.TabsTrigger = tabs.TabsTrigger;
|
|
211
|
+
exports.EmptyState = emptyState.EmptyState;
|
|
212
|
+
exports.Separator = separator.Separator;
|
|
213
|
+
exports.Skeleton = skeleton.Skeleton;
|
|
214
|
+
exports.StatusController = statusController.StatusController;
|
|
215
|
+
exports.useFirstMountState = useFirstMountState.useFirstMountState;
|
|
216
|
+
exports.useUpdateEffect = useUpdateEffect.useUpdateEffect;
|
|
217
|
+
exports.useForkRef = useForkRef.useForkRef;
|
|
218
|
+
exports.useStateRef = useStateRef.useStateRef;
|
|
219
|
+
exports.useControlled = useControlled.useControlled;
|
|
220
|
+
exports.usePrevious = usePrevious.usePrevious;
|
|
221
|
+
exports.useLatest = useLatest.useLatest;
|
|
222
|
+
exports.useScrollState = useScrollState.useScrollState;
|
|
223
|
+
exports.chain = chain.chain;
|
|
224
|
+
exports.mergeProps = mergeProps.mergeProps;
|
|
225
|
+
exports.assignRef = mergeRefs.assignRef;
|
|
226
|
+
exports.mergeRefs = mergeRefs.mergeRefs;
|
|
227
|
+
exports.toggle = toggle$1.toggle;
|
|
228
|
+
exports.addIf = addIf.addIf;
|
|
229
|
+
exports.DEFAULT_RECT = getBoundingRect.DEFAULT_RECT;
|
|
230
|
+
exports.getBoundingRect = getBoundingRect.getBoundingRect;
|
|
231
|
+
exports.TableHeader = tableHeader.TableHeader;
|
|
232
|
+
exports.TableBody = tableBody.TableBody;
|
|
233
|
+
exports.TableFooter = tableFooter.TableFooter;
|
|
234
|
+
exports.TableHead = tableHead.TableHead;
|
|
235
|
+
exports.TableRow = row.TableRow;
|
|
236
|
+
exports.TableCell = cell.TableCell;
|
|
237
|
+
exports.TableCaption = tableCaption.TableCaption;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var clsx = require('clsx');
|
|
5
|
+
var tailwindMerge = require('tailwind-merge');
|
|
6
|
+
|
|
7
|
+
function cn(...inputs) {
|
|
8
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
9
|
+
}
|
|
10
|
+
function forwardRefWithGeneric(render) {
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
return react.forwardRef(render);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.cn = cn;
|
|
16
|
+
exports.forwardRefWithGeneric = forwardRefWithGeneric;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const responsiveProps = {
|
|
4
|
+
// Display
|
|
5
|
+
display: "",
|
|
6
|
+
// Position
|
|
7
|
+
position: "",
|
|
8
|
+
// Dimensions
|
|
9
|
+
width: "w",
|
|
10
|
+
minWidth: "min-w",
|
|
11
|
+
maxWidth: "max-w",
|
|
12
|
+
height: "h",
|
|
13
|
+
minHeight: "min-h",
|
|
14
|
+
maxHeight: "max-h",
|
|
15
|
+
// Padding
|
|
16
|
+
p: "p",
|
|
17
|
+
px: "px",
|
|
18
|
+
py: "py",
|
|
19
|
+
pt: "pt",
|
|
20
|
+
pr: "pr",
|
|
21
|
+
pb: "pb",
|
|
22
|
+
pl: "pl",
|
|
23
|
+
// Margin
|
|
24
|
+
m: "m",
|
|
25
|
+
mx: "mx",
|
|
26
|
+
my: "my",
|
|
27
|
+
mt: "mt",
|
|
28
|
+
mr: "mr",
|
|
29
|
+
mb: "mb",
|
|
30
|
+
ml: "ml",
|
|
31
|
+
// Gap
|
|
32
|
+
gap: "gap",
|
|
33
|
+
gapX: "gap-x",
|
|
34
|
+
gapY: "gap-y",
|
|
35
|
+
// Overflow
|
|
36
|
+
overflow: "overflow",
|
|
37
|
+
overflowX: "overflow-x",
|
|
38
|
+
overflowY: "overflow-y",
|
|
39
|
+
// Grid
|
|
40
|
+
columns: "grid-cols",
|
|
41
|
+
rows: "grid-rows",
|
|
42
|
+
flow: "grid-flow",
|
|
43
|
+
// Flex
|
|
44
|
+
direction: "flex",
|
|
45
|
+
wrap: "flex",
|
|
46
|
+
// Flex & Grid
|
|
47
|
+
items: "items",
|
|
48
|
+
justify: "justify",
|
|
49
|
+
};
|
|
50
|
+
function getResponsiveClass(props) {
|
|
51
|
+
const classes = [];
|
|
52
|
+
Object.entries(props).forEach(([prop, value]) => {
|
|
53
|
+
if (!value)
|
|
54
|
+
return;
|
|
55
|
+
if (!(prop in responsiveProps))
|
|
56
|
+
return;
|
|
57
|
+
const responsiveValue = typeof value === "object" ? value : { initial: value };
|
|
58
|
+
for (const [breakpoint, val] of Object.entries(responsiveValue)) {
|
|
59
|
+
if (!val)
|
|
60
|
+
continue;
|
|
61
|
+
const bpPrefix = breakpoint === "initial" ? "" : `${breakpoint}:`;
|
|
62
|
+
const prefix = responsiveProps[prop] ? `${responsiveProps[prop]}-` : "";
|
|
63
|
+
classes.push(`${bpPrefix}${prefix}${val}`);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return classes.join(" ");
|
|
67
|
+
}
|
|
68
|
+
function extractResponsiveProps(props) {
|
|
69
|
+
const classesProps = {};
|
|
70
|
+
const restProps = {};
|
|
71
|
+
for (const key in props) {
|
|
72
|
+
if (key in responsiveProps) {
|
|
73
|
+
classesProps[key] = props[key];
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
restProps[key] = props[key];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return { classesProps, restProps };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
exports.extractResponsiveProps = extractResponsiveProps;
|
|
84
|
+
exports.getResponsiveClass = getResponsiveClass;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fontWeights = {
|
|
4
|
+
light: "font-light",
|
|
5
|
+
regular: "font-normal",
|
|
6
|
+
medium: "font-medium",
|
|
7
|
+
bold: "font-bold",
|
|
8
|
+
};
|
|
9
|
+
const textColors = {
|
|
10
|
+
default: "text-foreground",
|
|
11
|
+
muted: "text-muted-foreground",
|
|
12
|
+
primary: "text-primary",
|
|
13
|
+
secondary: "text-secondary",
|
|
14
|
+
accent: "text-accent",
|
|
15
|
+
destructive: "text-destructive",
|
|
16
|
+
};
|
|
17
|
+
const textAlignment = {
|
|
18
|
+
left: "text-left",
|
|
19
|
+
center: "text-center",
|
|
20
|
+
right: "text-right",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.fontWeights = fontWeights;
|
|
24
|
+
exports.textAlignment = textAlignment;
|
|
25
|
+
exports.textColors = textColors;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates function that execute callback functions together so that they are invoked in sequence
|
|
5
|
+
* with the same set of arguments.
|
|
6
|
+
*
|
|
7
|
+
* @param {...Function} callbacks - A series of callback functions to chain together.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const sum = (a, b) => console.log(`${a} + ${b} = ${a + b}`);
|
|
11
|
+
* const multiply = (a, b) => console.log(`${a} * ${b} = ${a * b}`);
|
|
12
|
+
* const log = (...args) => console.log(`I received following arguments: ${args.join(', ')}`);
|
|
13
|
+
*
|
|
14
|
+
* const chained = chain(sum, multiply, log);
|
|
15
|
+
* chained(1, 2); // Logs:
|
|
16
|
+
* // "1 + 2 = 3"
|
|
17
|
+
* // "1 * 2 = 2"
|
|
18
|
+
* // "I received following arguments: 1, 2"
|
|
19
|
+
*/
|
|
20
|
+
function chain(...callbacks) {
|
|
21
|
+
return (...args) => {
|
|
22
|
+
for (const callback of callbacks) {
|
|
23
|
+
if (typeof callback === "function") {
|
|
24
|
+
callback(...args);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.chain = chain;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_RECT = {
|
|
4
|
+
x: 0,
|
|
5
|
+
y: 0,
|
|
6
|
+
width: 0,
|
|
7
|
+
height: 0,
|
|
8
|
+
top: 0,
|
|
9
|
+
right: 0,
|
|
10
|
+
bottom: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
};
|
|
13
|
+
const getBoundingRect = (node) => {
|
|
14
|
+
const rect = node && node.getBoundingClientRect ? node.getBoundingClientRect() : DEFAULT_RECT;
|
|
15
|
+
return rect;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.DEFAULT_RECT = DEFAULT_RECT;
|
|
19
|
+
exports.getBoundingRect = getBoundingRect;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var clsx = require('clsx');
|
|
4
|
+
var chain = require('./chain.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Merges multiple props objects together. Event handlers are chained,
|
|
8
|
+
* classNames are combined, all other props, the last prop object overrides all previous ones.
|
|
9
|
+
* @param args - Multiple sets of props to merge together.
|
|
10
|
+
*/
|
|
11
|
+
function mergeProps(...args) {
|
|
12
|
+
// Start with a base clone of the first argument. This is a lot faster than starting
|
|
13
|
+
// with an empty object and adding properties as we go.
|
|
14
|
+
const result = Object.assign({}, args[0]);
|
|
15
|
+
for (let i = 1; i < args.length; i++) {
|
|
16
|
+
const props = args[i];
|
|
17
|
+
for (const key in props) {
|
|
18
|
+
const a = result[key];
|
|
19
|
+
const b = props[key];
|
|
20
|
+
// Chain events
|
|
21
|
+
if (typeof a === "function" &&
|
|
22
|
+
typeof b === "function" &&
|
|
23
|
+
// This is a lot faster than a regex.
|
|
24
|
+
key[0] === "o" &&
|
|
25
|
+
key[1] === "n" &&
|
|
26
|
+
key.charCodeAt(2) >= /* 'A' */ 65 &&
|
|
27
|
+
key.charCodeAt(2) <= /* 'Z' */ 90) {
|
|
28
|
+
result[key] = chain.chain(a, b);
|
|
29
|
+
// Merge classnames, sometimes classNames are empty string which eval to false, so we just need to do a type check
|
|
30
|
+
}
|
|
31
|
+
else if ((key === "className" || key === "UNSAFE_className") && typeof a === "string" && typeof b === "string") {
|
|
32
|
+
result[key] = clsx.clsx(a, b);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
result[key] = b !== undefined ? b : a;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.mergeProps = mergeProps;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function assignRef(ref, value) {
|
|
4
|
+
if (typeof ref === "function") {
|
|
5
|
+
ref(value);
|
|
6
|
+
}
|
|
7
|
+
else if (ref) {
|
|
8
|
+
ref.current = value;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function mergeRefs(...refs) {
|
|
12
|
+
return (value) => {
|
|
13
|
+
refs.forEach((ref) => assignRef(ref, value));
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.assignRef = assignRef;
|
|
18
|
+
exports.mergeRefs = mergeRefs;
|