@codeleap/web 7.0.2 → 7.1.2
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/ActivityIndicator/index.js +16 -34
- package/dist/components/ActivityIndicator/index.js.map +1 -1
- package/dist/components/ActivityIndicator/styles.js +1 -2
- package/dist/components/ActivityIndicator/types.js +1 -2
- package/dist/components/Badge/index.js +24 -42
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Badge/styles.js +1 -2
- package/dist/components/Badge/types.js +1 -2
- package/dist/components/Button/index.js +19 -36
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Button/styles.js +1 -2
- package/dist/components/Button/types.js +1 -2
- package/dist/components/Calendar/index.js +12 -29
- package/dist/components/Calendar/index.js.map +1 -1
- package/dist/components/Calendar/styles.js +1 -2
- package/dist/components/Calendar/types.js +1 -2
- package/dist/components/Carousel/index.js +40 -82
- package/dist/components/Carousel/index.js.map +1 -1
- package/dist/components/Carousel/styles.js +1 -2
- package/dist/components/Carousel/types.js +1 -2
- package/dist/components/Checkbox/index.js +24 -42
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/styles.js +1 -2
- package/dist/components/Checkbox/types.js +1 -2
- package/dist/components/Collapse/index.js +17 -35
- package/dist/components/Collapse/index.js.map +1 -1
- package/dist/components/Collapse/styles.js +1 -2
- package/dist/components/Collapse/types.js +1 -2
- package/dist/components/ColorPicker/index.js +33 -51
- package/dist/components/ColorPicker/index.js.map +1 -1
- package/dist/components/ColorPicker/styles.js +1 -2
- package/dist/components/ColorPicker/types.js +1 -2
- package/dist/components/CropPicker/hooks.d.ts +2 -2
- package/dist/components/CropPicker/hooks.js +17 -20
- package/dist/components/CropPicker/hooks.js.map +1 -1
- package/dist/components/CropPicker/index.js +22 -40
- package/dist/components/CropPicker/index.js.map +1 -1
- package/dist/components/CropPicker/styles.js +1 -2
- package/dist/components/CropPicker/types.js +1 -2
- package/dist/components/CropPicker/utils.js +3 -9
- package/dist/components/CropPicker/utils.js.map +1 -1
- package/dist/components/DatePicker/index.js +23 -40
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DatePicker/styles.js +1 -2
- package/dist/components/DatePicker/types.js +1 -2
- package/dist/components/Drawer/index.js +22 -40
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Drawer/styles.js +1 -2
- package/dist/components/Drawer/types.js +1 -2
- package/dist/components/Dropzone/context.js +11 -16
- package/dist/components/Dropzone/context.js.map +1 -1
- package/dist/components/Dropzone/elements.js +13 -19
- package/dist/components/Dropzone/elements.js.map +1 -1
- package/dist/components/Dropzone/index.js +35 -53
- package/dist/components/Dropzone/index.js.map +1 -1
- package/dist/components/Dropzone/styles.js +1 -2
- package/dist/components/Dropzone/types.js +1 -2
- package/dist/components/Dropzone/useDropzone.js +3 -6
- package/dist/components/Dropzone/useDropzone.js.map +1 -1
- package/dist/components/EmptyPlaceholder/index.js +40 -61
- package/dist/components/EmptyPlaceholder/index.js.map +1 -1
- package/dist/components/EmptyPlaceholder/styles.js +1 -2
- package/dist/components/EmptyPlaceholder/types.js +1 -2
- package/dist/components/Field/context.js +11 -17
- package/dist/components/Field/context.js.map +1 -1
- package/dist/components/Field/elements.js +31 -39
- package/dist/components/Field/elements.js.map +1 -1
- package/dist/components/Field/index.js +23 -41
- package/dist/components/Field/index.js.map +1 -1
- package/dist/components/Field/styles.js +1 -2
- package/dist/components/Field/types.js +1 -2
- package/dist/components/Field/useFieldInput.d.ts +1 -1
- package/dist/components/Field/useFieldInput.js +8 -11
- package/dist/components/Field/useFieldInput.js.map +1 -1
- package/dist/components/FileInput/index.js +14 -32
- package/dist/components/FileInput/index.js.map +1 -1
- package/dist/components/FileInput/types.js +1 -2
- package/dist/components/Icon/index.js +26 -44
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Icon/styles.js +1 -2
- package/dist/components/Icon/types.js +1 -2
- package/dist/components/List/context.js +20 -25
- package/dist/components/List/context.js.map +1 -1
- package/dist/components/List/elements.d.ts.map +1 -1
- package/dist/components/List/elements.js +58 -82
- package/dist/components/List/elements.js.map +1 -1
- package/dist/components/List/index.d.ts.map +1 -1
- package/dist/components/List/index.js +19 -36
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/List/scroll.d.ts.map +1 -1
- package/dist/components/List/scroll.js +20 -20
- package/dist/components/List/scroll.js.map +1 -1
- package/dist/components/List/styles.js +1 -2
- package/dist/components/List/types.d.ts +13 -4
- package/dist/components/List/types.d.ts.map +1 -1
- package/dist/components/List/types.js +1 -2
- package/dist/components/List/useScrollEdgeDetection.d.ts +12 -0
- package/dist/components/List/useScrollEdgeDetection.d.ts.map +1 -0
- package/dist/components/List/useScrollEdgeDetection.js +37 -0
- package/dist/components/List/useScrollEdgeDetection.js.map +1 -0
- package/dist/components/LoadingOverlay/index.js +20 -38
- package/dist/components/LoadingOverlay/index.js.map +1 -1
- package/dist/components/LoadingOverlay/styles.js +1 -2
- package/dist/components/LoadingOverlay/types.js +1 -2
- package/dist/components/MaskedTextInput/index.js +14 -32
- package/dist/components/MaskedTextInput/index.js.map +1 -1
- package/dist/components/MaskedTextInput/mask.js +1 -4
- package/dist/components/MaskedTextInput/mask.js.map +1 -1
- package/dist/components/MaskedTextInput/types.js +1 -2
- package/dist/components/Modal/context.js +9 -14
- package/dist/components/Modal/context.js.map +1 -1
- package/dist/components/Modal/elements.js +23 -31
- package/dist/components/Modal/elements.js.map +1 -1
- package/dist/components/Modal/index.js +22 -40
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/styles.js +1 -2
- package/dist/components/Modal/types.js +1 -2
- package/dist/components/NumberIncrement/index.js +29 -47
- package/dist/components/NumberIncrement/index.js.map +1 -1
- package/dist/components/NumberIncrement/styles.js +1 -2
- package/dist/components/NumberIncrement/types.js +1 -2
- package/dist/components/NumberIncrement/useNumberIncrement.js +21 -24
- package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -1
- package/dist/components/Overlay/index.js +21 -39
- package/dist/components/Overlay/index.js.map +1 -1
- package/dist/components/Overlay/styles.js +1 -2
- package/dist/components/Overlay/types.js +1 -2
- package/dist/components/PaginationButtons/index.js +26 -44
- package/dist/components/PaginationButtons/index.js.map +1 -1
- package/dist/components/PaginationButtons/styles.js +1 -2
- package/dist/components/PaginationButtons/types.js +1 -2
- package/dist/components/PaginationIndicator/ImperativePaginationIndicator.d.ts +13 -0
- package/dist/components/PaginationIndicator/ImperativePaginationIndicator.d.ts.map +1 -0
- package/dist/components/PaginationIndicator/ImperativePaginationIndicator.js +20 -0
- package/dist/components/PaginationIndicator/ImperativePaginationIndicator.js.map +1 -0
- package/dist/components/PaginationIndicator/index.d.ts +1 -0
- package/dist/components/PaginationIndicator/index.d.ts.map +1 -1
- package/dist/components/PaginationIndicator/index.js +25 -42
- package/dist/components/PaginationIndicator/index.js.map +1 -1
- package/dist/components/PaginationIndicator/styles.js +1 -2
- package/dist/components/PaginationIndicator/types.d.ts +9 -0
- package/dist/components/PaginationIndicator/types.d.ts.map +1 -1
- package/dist/components/PaginationIndicator/types.js +1 -2
- package/dist/components/Progress/Bar/Segmented.js +19 -23
- package/dist/components/Progress/Bar/Segmented.js.map +1 -1
- package/dist/components/Progress/Bar/index.js +29 -47
- package/dist/components/Progress/Bar/index.js.map +1 -1
- package/dist/components/Progress/Bar/styles.js +1 -2
- package/dist/components/Progress/Bar/types.js +1 -2
- package/dist/components/Progress/Circle/Segmented.js +22 -26
- package/dist/components/Progress/Circle/Segmented.js.map +1 -1
- package/dist/components/Progress/Circle/index.js +30 -48
- package/dist/components/Progress/Circle/index.js.map +1 -1
- package/dist/components/Progress/Circle/styles.js +1 -2
- package/dist/components/Progress/Circle/types.js +1 -2
- package/dist/components/Progress/index.js +2 -18
- package/dist/components/Progress/index.js.map +1 -1
- package/dist/components/Progress/utils.js +1 -4
- package/dist/components/Progress/utils.js.map +1 -1
- package/dist/components/RadioInput/index.js +26 -47
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/styles.js +1 -2
- package/dist/components/RadioInput/types.js +1 -2
- package/dist/components/SearchInput/index.js +14 -51
- package/dist/components/SearchInput/index.js.map +1 -1
- package/dist/components/SectionFilters/index.js +38 -56
- package/dist/components/SectionFilters/index.js.map +1 -1
- package/dist/components/SectionFilters/styles.js +1 -2
- package/dist/components/SectionFilters/types.js +1 -2
- package/dist/components/Select/context.js +44 -50
- package/dist/components/Select/context.js.map +1 -1
- package/dist/components/Select/elements.js +23 -29
- package/dist/components/Select/elements.js.map +1 -1
- package/dist/components/Select/index.js +24 -41
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/styles.js +1 -2
- package/dist/components/Select/types.js +1 -2
- package/dist/components/Select/useTriggerWidth.js +6 -9
- package/dist/components/Select/useTriggerWidth.js.map +1 -1
- package/dist/components/Slider/index.js +47 -68
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/styles.js +1 -2
- package/dist/components/Slider/types.js +1 -2
- package/dist/components/Switch/index.js +22 -40
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/styles.js +1 -2
- package/dist/components/Switch/types.js +1 -2
- package/dist/components/Tag/index.js +34 -55
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Tag/styles.js +1 -2
- package/dist/components/Tag/types.js +1 -2
- package/dist/components/Text/index.js +27 -48
- package/dist/components/Text/index.js.map +1 -1
- package/dist/components/Text/styles.js +1 -2
- package/dist/components/Text/types.js +1 -2
- package/dist/components/TextEditor/index.js +29 -50
- package/dist/components/TextEditor/index.js.map +1 -1
- package/dist/components/TextEditor/styles.js +1 -2
- package/dist/components/TextEditor/types.js +1 -2
- package/dist/components/TextInput/index.js +28 -49
- package/dist/components/TextInput/index.js.map +1 -1
- package/dist/components/TextInput/styles.js +1 -2
- package/dist/components/TextInput/types.js +1 -2
- package/dist/components/TextInput/useTextInput.d.ts +2 -2
- package/dist/components/TextInput/useTextInput.js +12 -15
- package/dist/components/TextInput/useTextInput.js.map +1 -1
- package/dist/components/Tooltip/index.js +33 -54
- package/dist/components/Tooltip/index.js.map +1 -1
- package/dist/components/Tooltip/styles.js +1 -2
- package/dist/components/Tooltip/types.js +1 -2
- package/dist/components/Touchable/index.js +23 -42
- package/dist/components/Touchable/index.js.map +1 -1
- package/dist/components/Touchable/styles.js +1 -2
- package/dist/components/Touchable/types.js +1 -2
- package/dist/components/View/index.js +15 -32
- package/dist/components/View/index.js.map +1 -1
- package/dist/components/View/styles.js +1 -2
- package/dist/components/View/types.js +1 -2
- package/dist/components/components.js +41 -57
- package/dist/components/components.js.map +1 -1
- package/dist/index.js +4 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/ListMasonry.js +22 -31
- package/dist/lib/ListMasonry.js.map +1 -1
- package/dist/lib/ThemeVariables.js +6 -11
- package/dist/lib/ThemeVariables.js.map +1 -1
- package/dist/lib/WebStyleRegistry.js +3 -7
- package/dist/lib/WebStyleRegistry.js.map +1 -1
- package/dist/lib/hooks/index.js +22 -38
- package/dist/lib/hooks/index.js.map +1 -1
- package/dist/lib/hooks/useAnimatedStyle.js +5 -9
- package/dist/lib/hooks/useAnimatedStyle.js.map +1 -1
- package/dist/lib/hooks/useAnimatedVariantStyles.js +6 -9
- package/dist/lib/hooks/useAnimatedVariantStyles.js.map +1 -1
- package/dist/lib/hooks/useAsyncSelect.js +8 -11
- package/dist/lib/hooks/useAsyncSelect.js.map +1 -1
- package/dist/lib/hooks/useBreakpointMatch.js +19 -22
- package/dist/lib/hooks/useBreakpointMatch.js.map +1 -1
- package/dist/lib/hooks/useClick.js +7 -10
- package/dist/lib/hooks/useClick.js.map +1 -1
- package/dist/lib/hooks/useClickOutside.js +4 -7
- package/dist/lib/hooks/useClickOutside.js.map +1 -1
- package/dist/lib/hooks/useFileInput.js +3 -7
- package/dist/lib/hooks/useFileInput.js.map +1 -1
- package/dist/lib/hooks/useIsomorphicEffect.js +2 -5
- package/dist/lib/hooks/useIsomorphicEffect.js.map +1 -1
- package/dist/lib/hooks/useKeydown.js +9 -13
- package/dist/lib/hooks/useKeydown.js.map +1 -1
- package/dist/lib/hooks/useListFocus.js +4 -7
- package/dist/lib/hooks/useListFocus.js.map +1 -1
- package/dist/lib/hooks/useMediaQuery.js +8 -11
- package/dist/lib/hooks/useMediaQuery.js.map +1 -1
- package/dist/lib/hooks/usePageExitBlocker.js +6 -10
- package/dist/lib/hooks/usePageExitBlocker.js.map +1 -1
- package/dist/lib/hooks/usePagination.js +10 -13
- package/dist/lib/hooks/usePagination.js.map +1 -1
- package/dist/lib/hooks/usePopState.js +5 -9
- package/dist/lib/hooks/usePopState.js.map +1 -1
- package/dist/lib/hooks/usePopoverDismiss.js +5 -8
- package/dist/lib/hooks/usePopoverDismiss.js.map +1 -1
- package/dist/lib/hooks/useRefresh.js +9 -16
- package/dist/lib/hooks/useRefresh.js.map +1 -1
- package/dist/lib/hooks/useScrollEffect.js +3 -6
- package/dist/lib/hooks/useScrollEffect.js.map +1 -1
- package/dist/lib/hooks/useSearchParams.js +7 -10
- package/dist/lib/hooks/useSearchParams.js.map +1 -1
- package/dist/lib/hooks/useStaticAnimationStyles.js +3 -6
- package/dist/lib/hooks/useStaticAnimationStyles.js.map +1 -1
- package/dist/lib/hooks/useStylesFor.js +9 -13
- package/dist/lib/hooks/useStylesFor.js.map +1 -1
- package/dist/lib/hooks/useTouchableEvents.js +4 -7
- package/dist/lib/hooks/useTouchableEvents.js.map +1 -1
- package/dist/lib/hooks/useWindowFocus.js +7 -11
- package/dist/lib/hooks/useWindowFocus.js.map +1 -1
- package/dist/lib/hooks/useWindowSize.js +7 -10
- package/dist/lib/hooks/useWindowSize.js.map +1 -1
- package/dist/lib/index.js +6 -22
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/tools/index.js +3 -19
- package/dist/lib/tools/index.js.map +1 -1
- package/dist/lib/tools/localStorage.js +8 -12
- package/dist/lib/tools/localStorage.js.map +1 -1
- package/dist/lib/tools/mediaQuery.js +3 -8
- package/dist/lib/tools/mediaQuery.js.map +1 -1
- package/dist/lib/tools/modal.js +13 -18
- package/dist/lib/tools/modal.js.map +1 -1
- package/dist/lib/utils/attributes.js +3 -6
- package/dist/lib/utils/attributes.js.map +1 -1
- package/dist/lib/utils/cache.d.ts +2 -2
- package/dist/lib/utils/cache.js +4 -11
- package/dist/lib/utils/cache.js.map +1 -1
- package/dist/lib/utils/index.js +5 -21
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/pollyfils/scroll.js +1 -5
- package/dist/lib/utils/pollyfils/scroll.js.map +1 -1
- package/dist/lib/utils/stopPropagation.js +1 -4
- package/dist/lib/utils/stopPropagation.js.map +1 -1
- package/dist/lib/utils/test.js +3 -7
- package/dist/lib/utils/test.js.map +1 -1
- package/dist/types/index.js +1 -17
- package/dist/types/index.js.map +1 -1
- package/dist/types/utility.js +1 -2
- package/package.json +18 -17
- package/src/components/List/elements.tsx +35 -13
- package/src/components/List/index.tsx +12 -4
- package/src/components/List/scroll.ts +8 -3
- package/src/components/List/types.ts +13 -4
- package/src/components/List/useScrollEdgeDetection.ts +59 -0
- package/src/components/PaginationIndicator/ImperativePaginationIndicator.tsx +35 -0
- package/src/components/PaginationIndicator/index.tsx +1 -0
- package/src/components/PaginationIndicator/types.ts +11 -0
- package/src/components/Touchable/index.tsx +2 -1
|
@@ -1,46 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ActivityIndicator = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
-
const View_1 = require("../View");
|
|
20
|
-
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
21
|
-
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
22
|
-
__exportStar(require("./styles"), exports);
|
|
23
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { View } from '../View';
|
|
3
|
+
import { useStylesFor } from '../../lib/hooks/useStylesFor';
|
|
4
|
+
import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
|
|
5
|
+
export * from './styles';
|
|
6
|
+
export * from './types';
|
|
24
7
|
/**
|
|
25
8
|
* Loading spinner whose visual appearance is delegated entirely to style
|
|
26
9
|
* composition; ships no built-in spinner markup.
|
|
27
10
|
* Uses: `useStylesFor`, `WebStyleRegistry`
|
|
28
11
|
*/
|
|
29
|
-
const ActivityIndicator = (props) => {
|
|
12
|
+
export const ActivityIndicator = (props) => {
|
|
30
13
|
const { style, component: Component, size, ...rest } = {
|
|
31
|
-
...
|
|
14
|
+
...ActivityIndicator.defaultProps,
|
|
32
15
|
...props,
|
|
33
16
|
};
|
|
34
|
-
const styles =
|
|
35
|
-
return ((
|
|
17
|
+
const styles = useStylesFor(ActivityIndicator.styleRegistryName, style);
|
|
18
|
+
return (_jsx(Component, { ...rest, css: styles.wrapper }));
|
|
36
19
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
component: View_1.View,
|
|
20
|
+
ActivityIndicator.styleRegistryName = 'ActivityIndicator';
|
|
21
|
+
ActivityIndicator.elements = ['wrapper'];
|
|
22
|
+
ActivityIndicator.rootElement = 'wrapper';
|
|
23
|
+
ActivityIndicator.defaultProps = {
|
|
24
|
+
component: View,
|
|
43
25
|
size: null,
|
|
44
26
|
};
|
|
45
|
-
|
|
27
|
+
WebStyleRegistry.registerComponent(ActivityIndicator);
|
|
46
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ActivityIndicator/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ActivityIndicator/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAI9B,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAG7D,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAE,EAAE;IACjE,MAAM,EACJ,KAAK,EACL,SAAS,EAAE,SAAS,EACpB,IAAI,EACJ,GAAG,IAAI,EACR,GAAG;QACF,GAAG,iBAAiB,CAAC,YAAY;QACjC,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAEvE,OAAO,CACL,KAAC,SAAS,OACJ,IAAI,EACR,GAAG,EAAE,MAAM,CAAC,OAAO,GACnB,CACH,CAAA;AACH,CAAC,CAAA;AAED,iBAAiB,CAAC,iBAAiB,GAAG,mBAAmB,CAAA;AACzD,iBAAiB,CAAC,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;AACxC,iBAAiB,CAAC,WAAW,GAAG,SAAS,CAAA;AAIzC,iBAAiB,CAAC,YAAY,GAAG;IAC/B,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,IAAI;CACwB,CAAA;AAEpC,gBAAgB,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAA"}
|
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Badge = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
-
const types_1 = require("@codeleap/types");
|
|
20
|
-
const Text_1 = require("../Text");
|
|
21
|
-
const View_1 = require("../View");
|
|
22
|
-
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
23
|
-
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
24
|
-
__exportStar(require("./styles"), exports);
|
|
25
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { TypeGuards } from '@codeleap/types';
|
|
3
|
+
import { Text } from '../Text';
|
|
4
|
+
import { View } from '../View';
|
|
5
|
+
import { useStylesFor } from '../../lib/hooks/useStylesFor';
|
|
6
|
+
import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
|
|
7
|
+
export * from './styles';
|
|
8
|
+
export * from './types';
|
|
26
9
|
const defaultGetBadgeContent = ({ count, maxCount }) => {
|
|
27
10
|
if (Number(count) > maxCount) {
|
|
28
11
|
return `${maxCount}+`;
|
|
@@ -37,13 +20,13 @@ const defaultGetBadgeContent = ({ count, maxCount }) => {
|
|
|
37
20
|
* Renders nothing when `badge` is `false` or absent.
|
|
38
21
|
* Uses: `View`, `Text`, `useStylesFor`, `WebStyleRegistry`
|
|
39
22
|
*/
|
|
40
|
-
const Badge = (props) => {
|
|
23
|
+
export const Badge = (props) => {
|
|
41
24
|
const { debugName, innerWrapperProps, textProps, maxCount, minCount, getBadgeContent, renderBadgeContent, disabled, style, badge, ...rest } = {
|
|
42
|
-
...
|
|
25
|
+
...Badge.defaultProps,
|
|
43
26
|
...props,
|
|
44
27
|
};
|
|
45
|
-
const styles =
|
|
46
|
-
const visible = (
|
|
28
|
+
const styles = useStylesFor(Badge.styleRegistryName, style);
|
|
29
|
+
const visible = (TypeGuards.isBoolean(badge) && badge === true) || TypeGuards.isNumber(badge);
|
|
47
30
|
if (!visible)
|
|
48
31
|
return null;
|
|
49
32
|
const wrapperStyles = [
|
|
@@ -60,27 +43,26 @@ const Badge = (props) => {
|
|
|
60
43
|
(disabled && styles?.['count:disabled']),
|
|
61
44
|
textProps?.style,
|
|
62
45
|
];
|
|
63
|
-
const count =
|
|
46
|
+
const count = TypeGuards.isNumber(badge) ? badge : null;
|
|
64
47
|
const content = getBadgeContent({ ...props, maxCount, minCount, count });
|
|
65
|
-
const showContent =
|
|
66
|
-
const BadgeContent =
|
|
67
|
-
return ((
|
|
68
|
-
? (
|
|
48
|
+
const showContent = TypeGuards.isNumber(count) && count >= minCount;
|
|
49
|
+
const BadgeContent = TypeGuards.isNil(renderBadgeContent) ? () => _jsx(Text, { text: content, ...textProps }) : renderBadgeContent;
|
|
50
|
+
return (_jsx(View, { ...rest, style: wrapperStyles, children: _jsx(View, { ...innerWrapperProps, style: innerWrapperStyles, children: showContent
|
|
51
|
+
? _jsx(BadgeContent, { ...props, style: countStyles, maxCount: maxCount, minCount: minCount, count: count, getBadgeContent: getBadgeContent, content: content })
|
|
69
52
|
: null }) }));
|
|
70
53
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return exports.Badge;
|
|
54
|
+
Badge.styleRegistryName = 'Badge';
|
|
55
|
+
Badge.elements = ['wrapper', 'innerWrapper', 'count'];
|
|
56
|
+
Badge.rootElement = 'wrapper';
|
|
57
|
+
Badge.withVariantTypes = (styles) => {
|
|
58
|
+
return Badge;
|
|
77
59
|
};
|
|
78
|
-
|
|
60
|
+
Badge.defaultProps = {
|
|
79
61
|
maxCount: 9,
|
|
80
62
|
minCount: 1,
|
|
81
63
|
getBadgeContent: defaultGetBadgeContent,
|
|
82
64
|
disabled: false,
|
|
83
65
|
badge: true,
|
|
84
66
|
};
|
|
85
|
-
|
|
67
|
+
WebStyleRegistry.registerComponent(Badge);
|
|
86
68
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAG7D,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,MAAM,sBAAsB,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAgB,EAAE,EAAE;IACnE,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,EAAE,CAAC;QAC7B,OAAO,GAAG,QAAQ,GAAG,CAAA;IACvB,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC;AACH,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAiB,EAAE,EAAE;IACzC,MAAM,EACJ,SAAS,EACT,iBAAi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(var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Button = Button;
|
|
18
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
-
const types_1 = require("@codeleap/types");
|
|
20
|
-
const Text_1 = require("../Text");
|
|
21
|
-
const Touchable_1 = require("../Touchable");
|
|
22
|
-
const Icon_1 = require("../Icon");
|
|
23
|
-
const ActivityIndicator_1 = require("../ActivityIndicator");
|
|
24
|
-
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
25
|
-
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
26
|
-
const styles_1 = require("@codeleap/styles");
|
|
27
|
-
const lib_1 = require("../../lib");
|
|
28
|
-
__exportStar(require("./styles"), exports);
|
|
29
|
-
__exportStar(require("./types"), exports);
|
|
30
|
-
function Button(buttonProps) {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { TypeGuards } from '@codeleap/types';
|
|
3
|
+
import { Text } from '../Text';
|
|
4
|
+
import { Touchable } from '../Touchable';
|
|
5
|
+
import { Icon } from '../Icon';
|
|
6
|
+
import { ActivityIndicator } from '../ActivityIndicator';
|
|
7
|
+
import { useStylesFor } from '../../lib/hooks/useStylesFor';
|
|
8
|
+
import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
|
|
9
|
+
import { mergeStyles } from '@codeleap/styles';
|
|
10
|
+
import { toDataAttrs } from '../../lib';
|
|
11
|
+
export * from './styles';
|
|
12
|
+
export * from './types';
|
|
13
|
+
export function Button(buttonProps) {
|
|
31
14
|
const allProps = {
|
|
32
15
|
...Button.defaultProps,
|
|
33
16
|
...buttonProps,
|
|
34
17
|
};
|
|
35
18
|
const { children, icon, text, loading, loadingShowText, onPress, disabled, rightIcon, selected, loaderProps, debugName, style, context, ...props } = allProps;
|
|
36
|
-
const styles =
|
|
37
|
-
const getStyles = (key, partialStyle = null) =>
|
|
19
|
+
const styles = useStylesFor(Button.styleRegistryName, style);
|
|
20
|
+
const getStyles = (key, partialStyle = null) => mergeStyles([
|
|
38
21
|
partialStyle,
|
|
39
22
|
styles?.[key],
|
|
40
23
|
]);
|
|
@@ -50,12 +33,12 @@ function Button(buttonProps) {
|
|
|
50
33
|
const isLeftIconHide = componentStyles?.leftIcon?.display === 'none';
|
|
51
34
|
const shouldRenderLeftIcon = !loading && !isLeftIconHide && !!icon;
|
|
52
35
|
const _hideTextOnLoading = !loadingShowText && loading;
|
|
53
|
-
const attrs =
|
|
54
|
-
return ((
|
|
36
|
+
const attrs = toDataAttrs([{ selected, loading }, context]);
|
|
37
|
+
return (_jsxs(Touchable, { component: 'button', debugComponent: 'Button', disabled: disabled, "aria-pressed": selected || undefined, "aria-busy": loading || undefined, onPress: onPress, debugName: debugName, ...props, ...attrs, style: componentStyles.wrapper, className: 'button__wrapper', children: [shouldRenderLeftIcon ? _jsx(Icon, { debugName: debugName, icon: icon, style: componentStyles.leftIcon, className: 'button__icon button__left_icon' }) : null, TypeGuards.isString(text) && !_hideTextOnLoading ? _jsx(Text.Span, { debugName: debugName, text: text, style: componentStyles.text, className: 'button__text' }) : null, children, loading ? _jsx(ActivityIndicator, { debugName: `${debugName} loader`, ...loaderProps, style: componentStyles.loader, className: 'button__loader' }) : null, !!rightIcon ? _jsx(Icon, { debugName: debugName, icon: rightIcon, style: componentStyles.rightIcon, className: 'button__icon button__right_icon' }) : null] }));
|
|
55
38
|
}
|
|
56
39
|
function TabButton(buttonProps) {
|
|
57
40
|
// @ts-ignore
|
|
58
|
-
return (
|
|
41
|
+
return _jsx(Button, { ...buttonProps, role: 'tab', "aria-pressed": undefined, "aria-selected": buttonProps?.selected || undefined });
|
|
59
42
|
}
|
|
60
43
|
Button.Tab = TabButton;
|
|
61
44
|
Button.styleRegistryName = 'Button';
|
|
@@ -65,5 +48,5 @@ Button.defaultProps = {
|
|
|
65
48
|
debounce: 600,
|
|
66
49
|
loadingShowText: false,
|
|
67
50
|
};
|
|
68
|
-
|
|
51
|
+
WebStyleRegistry.registerComponent(Button);
|
|
69
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAY,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAGxD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAmB,WAAW,EAAwB,MAAM,kBAAkB,CAAA;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,MAAM,UAAU,MAAM,CAAwD,WAA2B;IACvG,MAAM,QAAQ,GAAG;QACf,GAAG,MAAM,CAAC,YAAY;QACtB,GAAG,WAAW;KACf,CAAA;IAED,MAAM,EACJ,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,eAAe,EACf,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,WAAW,EACX,SAAS,EACT,KAAK,EACL,OAAO,EACP,GAAG,KAAK,EACT,GAAG,QAAQ,CAAA;IAEZ,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,iBAAiB,EAAE,K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GAAG;IACb,eAAe,EAAE,KAAK;CACM,CAAA;AAE9B,gBAAgB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Calendar = Calendar;
|
|
18
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
-
const react_aria_components_1 = require("react-aria-components");
|
|
20
|
-
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
21
|
-
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
22
|
-
const View_1 = require("../View");
|
|
23
|
-
__exportStar(require("./styles"), exports);
|
|
24
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Calendar as AriaCalendar, CalendarGrid, CalendarGridHeader as AriaCalendarGridHeader, CalendarGridBody, CalendarHeaderCell, CalendarCell, Heading, useContextProps, ButtonContext, } from 'react-aria-components';
|
|
3
|
+
import { useStylesFor } from '../../lib/hooks/useStylesFor';
|
|
4
|
+
import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
|
|
5
|
+
import { View } from '../View';
|
|
6
|
+
export * from './styles';
|
|
7
|
+
export * from './types';
|
|
25
8
|
function SlotForwader(allProps) {
|
|
26
9
|
let { ref: providedRef, context, render, ...actualProps } = allProps;
|
|
27
|
-
let [props, ref] =
|
|
10
|
+
let [props, ref] = useContextProps(actualProps, providedRef, context);
|
|
28
11
|
return render(props, ref);
|
|
29
12
|
}
|
|
30
13
|
/**
|
|
@@ -33,14 +16,14 @@ function SlotForwader(allProps) {
|
|
|
33
16
|
* First day of week defaults to Sunday (`'sun'`).
|
|
34
17
|
* Uses: `View`, `Icon`
|
|
35
18
|
*/
|
|
36
|
-
function Calendar(calendarProps) {
|
|
19
|
+
export function Calendar(calendarProps) {
|
|
37
20
|
const { style, prevIcon, nextIcon, debugName, renderNext, renderPrevious, ...props } = {
|
|
38
21
|
...Calendar.defaultProps,
|
|
39
22
|
...calendarProps,
|
|
40
23
|
};
|
|
41
|
-
const styles =
|
|
24
|
+
const styles = useStylesFor(Calendar.styleRegistryName, style);
|
|
42
25
|
const s = styles;
|
|
43
|
-
return ((
|
|
26
|
+
return (_jsxs(AriaCalendar, { ...props, css: s.wrapper, children: [_jsxs(View, { component: 'header', style: styles.header, children: [_jsx(SlotForwader, { context: ButtonContext, slot: 'previous', css: styles.prevButton, render: renderPrevious ?? (() => _jsx(_Fragment, {})) }), _jsx(Heading, { css: s.heading }), _jsx(SlotForwader, { context: ButtonContext, slot: 'next', css: styles.nextButton, render: renderNext ?? (() => _jsx(_Fragment, {})) })] }), _jsxs(CalendarGrid, { css: s.grid, children: [_jsx(AriaCalendarGridHeader, { children: (day) => _jsx(CalendarHeaderCell, { css: s.gridHeaderCell, children: day }) }), _jsx(CalendarGridBody, { children: (date) => _jsx(CalendarCell, { date: date, css: s.cell }) })] })] }));
|
|
44
27
|
}
|
|
45
28
|
Calendar.styleRegistryName = 'Calendar';
|
|
46
29
|
Calendar.elements = [
|
|
@@ -63,5 +46,5 @@ Calendar.defaultProps = {
|
|
|
63
46
|
nextIcon: 'chevronRight',
|
|
64
47
|
firstDayOfWeek: 'sun'
|
|
65
48
|
};
|
|
66
|
-
|
|
49
|
+
WebStyleRegistry.registerComponent(Calendar);
|
|
67
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Calendar/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Calendar/index.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,YAAY,EACZ,kBAAkB,IAAI,sBAAsB,EAC5C,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,OAAO,EAIP,eAAe,EAIf,aAAa,GACd,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAI7D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAG9B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AASvB,SAAS,YAAY,CAA4C,QAAkC;IACjG,IAAI,EAAE,GAAG,EAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,EAAC,GAAG,QAAQ,CAAA;IAElE,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;IAGrE,OAAO,MAAM,CAAC,KAAc,EAAE,GAAG,CAAC,CAAA;AAEpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAkC,aAA+B;IACvF,MAAM,EAAE,KAAK,EAAI,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAC,GAAG,KAAK,EAAE,GAAG;QACtF,GAAG,QAAQ,CAAC,YAAY;QACxB,GAAG,aAAa;KACG,CAAA;IAErB,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,iBAAiB,EAAE,KAAK,CAAC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AAS,CAAA;AAIhC,QAAQ,CAAC,YAAY,GAAG;IACtB,SAAS,EAAE,UAAU;IACrB,QAAQ,EAAE,aAAwB;IAClC,QAAQ,EAAE,cAAyB;IACnC,cAAc,EAAE,KAAK;CACI,CAAA;AAE3B,gBAAgB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -1,66 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.Carousel = void 0;
|
|
43
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
44
|
-
const hooks_1 = require("@codeleap/hooks");
|
|
45
|
-
const react_1 = __importStar(require("react"));
|
|
46
|
-
const embla_carousel_react_1 = __importDefault(require("embla-carousel-react"));
|
|
47
|
-
const embla_carousel_autoplay_1 = __importDefault(require("embla-carousel-autoplay"));
|
|
48
|
-
const View_1 = require("../View");
|
|
49
|
-
const Touchable_1 = require("../Touchable");
|
|
50
|
-
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
51
|
-
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
52
|
-
__exportStar(require("./styles"), exports);
|
|
53
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { onUpdate } from '@codeleap/hooks';
|
|
3
|
+
import React, { forwardRef, useCallback, useImperativeHandle, useEffect, useState, useMemo } from 'react';
|
|
4
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
5
|
+
import Autoplay from 'embla-carousel-autoplay';
|
|
6
|
+
import { View } from '../View';
|
|
7
|
+
import { Touchable } from '../Touchable';
|
|
8
|
+
import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
|
|
9
|
+
import { useStylesFor } from '../../lib/hooks/useStylesFor';
|
|
10
|
+
export * from './styles';
|
|
11
|
+
export * from './types';
|
|
54
12
|
const Dots = (params) => {
|
|
55
13
|
const { page, childArray, onPress, styles, dotsDisabled } = params;
|
|
56
|
-
return ((
|
|
14
|
+
return (_jsx(View, { style: styles.dots, children: childArray.map((_, index) => {
|
|
57
15
|
const isSelected = index === page;
|
|
58
16
|
const style = [
|
|
59
17
|
styles.dot,
|
|
60
18
|
isSelected && styles['dot:selected'],
|
|
61
19
|
dotsDisabled && styles['dot:disabled'],
|
|
62
20
|
];
|
|
63
|
-
return ((
|
|
21
|
+
return (_jsx(Touchable, { onPress: () => onPress?.(index), style: style, disabled: dotsDisabled, debugName: 'dots' }, index));
|
|
64
22
|
}) }));
|
|
65
23
|
};
|
|
66
24
|
/**
|
|
@@ -68,22 +26,22 @@ const Dots = (params) => {
|
|
|
68
26
|
* The `page` prop is semi-controlled — it syncs to Embla whenever it changes but internal swipe still updates the active index independently.
|
|
69
27
|
* Uses: `Touchable`
|
|
70
28
|
*/
|
|
71
|
-
|
|
29
|
+
export const Carousel = forwardRef((props, ref) => {
|
|
72
30
|
const { style, children, renderSlideWrapper: SlideWrapper, page, dots, dotsDisabled, infinite, disableSwipe, onChange, footer, dotsProps, slideWrapperProps, autoplay, autoplayDelay, spaceBetween, slidesPerView, ...rest } = {
|
|
73
|
-
...
|
|
31
|
+
...Carousel.defaultProps,
|
|
74
32
|
...props,
|
|
75
33
|
};
|
|
76
|
-
const styles =
|
|
77
|
-
const childArray =
|
|
78
|
-
const [currentIndex, setCurrentIndex] =
|
|
79
|
-
const plugins =
|
|
34
|
+
const styles = useStylesFor(Carousel.styleRegistryName, style);
|
|
35
|
+
const childArray = React.Children.toArray(children);
|
|
36
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
37
|
+
const plugins = useMemo(() => {
|
|
80
38
|
const pluginList = [];
|
|
81
39
|
if (autoplay) {
|
|
82
|
-
pluginList.push((
|
|
40
|
+
pluginList.push(Autoplay({ delay: autoplayDelay, stopOnInteraction: false }));
|
|
83
41
|
}
|
|
84
42
|
return pluginList;
|
|
85
43
|
}, [autoplay, autoplayDelay]);
|
|
86
|
-
const [emblaRef, emblaApi] = (
|
|
44
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
87
45
|
loop: infinite,
|
|
88
46
|
dragFree: false,
|
|
89
47
|
containScroll: 'trimSnaps',
|
|
@@ -91,28 +49,28 @@ exports.Carousel = (0, react_1.forwardRef)((props, ref) => {
|
|
|
91
49
|
slidesToScroll: 1,
|
|
92
50
|
...(disableSwipe && { watchDrag: false }),
|
|
93
51
|
}, plugins);
|
|
94
|
-
const goTo =
|
|
52
|
+
const goTo = useCallback((index) => {
|
|
95
53
|
if (emblaApi) {
|
|
96
54
|
emblaApi.scrollTo(index);
|
|
97
55
|
}
|
|
98
56
|
}, [emblaApi]);
|
|
99
|
-
const next =
|
|
57
|
+
const next = useCallback(() => {
|
|
100
58
|
if (emblaApi) {
|
|
101
59
|
emblaApi.scrollNext();
|
|
102
60
|
}
|
|
103
61
|
}, [emblaApi]);
|
|
104
|
-
const prev =
|
|
62
|
+
const prev = useCallback(() => {
|
|
105
63
|
if (emblaApi) {
|
|
106
64
|
emblaApi.scrollPrev();
|
|
107
65
|
}
|
|
108
66
|
}, [emblaApi]);
|
|
109
|
-
|
|
67
|
+
useImperativeHandle(ref, () => ({
|
|
110
68
|
goTo,
|
|
111
69
|
next,
|
|
112
70
|
prev,
|
|
113
71
|
emblaApi,
|
|
114
72
|
}), [goTo, next, prev, emblaApi]);
|
|
115
|
-
|
|
73
|
+
useEffect(() => {
|
|
116
74
|
if (!emblaApi)
|
|
117
75
|
return;
|
|
118
76
|
const onSelect = () => {
|
|
@@ -126,46 +84,46 @@ exports.Carousel = (0, react_1.forwardRef)((props, ref) => {
|
|
|
126
84
|
emblaApi.off('select', onSelect);
|
|
127
85
|
};
|
|
128
86
|
}, [emblaApi, onChange]);
|
|
129
|
-
|
|
87
|
+
onUpdate(() => {
|
|
130
88
|
if (page !== undefined && page !== currentIndex && emblaApi) {
|
|
131
89
|
goTo(page);
|
|
132
90
|
}
|
|
133
91
|
}, [page]);
|
|
134
|
-
return ((
|
|
92
|
+
return (_jsxs(View, { style: styles.wrapper, children: [_jsx(View, { ref: emblaRef, style: {
|
|
135
93
|
overflow: 'hidden',
|
|
136
|
-
}, children: (
|
|
94
|
+
}, children: _jsx(View, { style: {
|
|
137
95
|
display: 'flex',
|
|
138
96
|
flexDirection: 'row',
|
|
139
97
|
gap: spaceBetween,
|
|
140
98
|
}, children: childArray.map((child, index) => {
|
|
141
|
-
return ((
|
|
99
|
+
return (_jsx(View, { style: {
|
|
142
100
|
flex: slidesPerView === 1 ? '0 0 100%' : slidesPerView === 'auto' ? '0 0 auto' : `0 0 ${100 / slidesPerView}%`,
|
|
143
101
|
minWidth: 0,
|
|
144
|
-
}, children: (
|
|
145
|
-
}) }) }), (
|
|
102
|
+
}, children: _jsx(SlideWrapper, { style: styles.slideWrapper, ...slideWrapperProps, children: child }) }, index));
|
|
103
|
+
}) }) }), _jsxs(View, { style: styles.footerWrapper, children: [footer, dots ? (_jsx(Dots, { page: currentIndex, onPress: goTo, childArray: childArray, styles: styles, dotsDisabled: dotsDisabled, ...dotsProps })) : null] })] }));
|
|
146
104
|
});
|
|
147
|
-
|
|
148
|
-
|
|
105
|
+
Carousel.styleRegistryName = 'Carousel';
|
|
106
|
+
Carousel.elements = [
|
|
149
107
|
'wrapper',
|
|
150
108
|
'dot',
|
|
151
109
|
'dots',
|
|
152
110
|
'slideWrapper',
|
|
153
111
|
'footerWrapper',
|
|
154
112
|
];
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return
|
|
113
|
+
Carousel.rootElement = 'wrapper';
|
|
114
|
+
Carousel.withVariantTypes = (styles) => {
|
|
115
|
+
return Carousel;
|
|
158
116
|
};
|
|
159
|
-
|
|
117
|
+
Carousel.defaultProps = {
|
|
160
118
|
dots: false,
|
|
161
119
|
dotsDisabled: false,
|
|
162
120
|
infinite: false,
|
|
163
121
|
disableSwipe: false,
|
|
164
|
-
renderSlideWrapper:
|
|
122
|
+
renderSlideWrapper: View,
|
|
165
123
|
autoplay: false,
|
|
166
124
|
autoplayDelay: 3000,
|
|
167
125
|
spaceBetween: 0,
|
|
168
126
|
slidesPerView: 1,
|
|
169
127
|
};
|
|
170
|
-
|
|
128
|
+
WebStyleRegistry.registerComponent(Carousel);
|
|
171
129
|
//# sourceMappingURL=index.js.map
|