@codeleap/web 7.0.1 → 7.0.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 +34 -16
- package/dist/components/ActivityIndicator/index.js.map +1 -1
- package/dist/components/ActivityIndicator/styles.js +2 -1
- package/dist/components/ActivityIndicator/types.js +2 -1
- package/dist/components/Badge/index.js +42 -24
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Badge/styles.js +2 -1
- package/dist/components/Badge/types.js +2 -1
- package/dist/components/Button/index.js +36 -19
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Button/styles.js +2 -1
- package/dist/components/Button/types.js +2 -1
- package/dist/components/Calendar/index.js +29 -12
- package/dist/components/Calendar/index.js.map +1 -1
- package/dist/components/Calendar/styles.js +2 -1
- package/dist/components/Calendar/types.js +2 -1
- package/dist/components/Carousel/index.js +82 -40
- package/dist/components/Carousel/index.js.map +1 -1
- package/dist/components/Carousel/styles.js +2 -1
- package/dist/components/Carousel/types.js +2 -1
- package/dist/components/Checkbox/index.js +42 -24
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/styles.js +2 -1
- package/dist/components/Checkbox/types.js +2 -1
- package/dist/components/Collapse/index.js +35 -17
- package/dist/components/Collapse/index.js.map +1 -1
- package/dist/components/Collapse/styles.js +2 -1
- package/dist/components/Collapse/types.js +2 -1
- package/dist/components/ColorPicker/index.js +51 -33
- package/dist/components/ColorPicker/index.js.map +1 -1
- package/dist/components/ColorPicker/styles.js +2 -1
- package/dist/components/ColorPicker/types.js +2 -1
- package/dist/components/CropPicker/hooks.d.ts +2 -2
- package/dist/components/CropPicker/hooks.js +20 -17
- package/dist/components/CropPicker/hooks.js.map +1 -1
- package/dist/components/CropPicker/index.js +40 -22
- package/dist/components/CropPicker/index.js.map +1 -1
- package/dist/components/CropPicker/styles.js +2 -1
- package/dist/components/CropPicker/types.js +2 -1
- package/dist/components/CropPicker/utils.js +9 -3
- package/dist/components/CropPicker/utils.js.map +1 -1
- package/dist/components/DatePicker/index.js +40 -23
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DatePicker/styles.js +2 -1
- package/dist/components/DatePicker/types.js +2 -1
- package/dist/components/Drawer/index.js +40 -22
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Drawer/styles.js +2 -1
- package/dist/components/Drawer/types.js +2 -1
- package/dist/components/Dropzone/context.js +16 -11
- package/dist/components/Dropzone/context.js.map +1 -1
- package/dist/components/Dropzone/elements.js +19 -13
- package/dist/components/Dropzone/elements.js.map +1 -1
- package/dist/components/Dropzone/index.js +53 -35
- package/dist/components/Dropzone/index.js.map +1 -1
- package/dist/components/Dropzone/styles.js +2 -1
- package/dist/components/Dropzone/types.js +2 -1
- package/dist/components/Dropzone/useDropzone.js +6 -3
- package/dist/components/Dropzone/useDropzone.js.map +1 -1
- package/dist/components/EmptyPlaceholder/index.js +61 -40
- package/dist/components/EmptyPlaceholder/index.js.map +1 -1
- package/dist/components/EmptyPlaceholder/styles.js +2 -1
- package/dist/components/EmptyPlaceholder/types.js +2 -1
- package/dist/components/Field/context.js +17 -11
- package/dist/components/Field/context.js.map +1 -1
- package/dist/components/Field/elements.js +39 -31
- package/dist/components/Field/elements.js.map +1 -1
- package/dist/components/Field/index.js +41 -23
- package/dist/components/Field/index.js.map +1 -1
- package/dist/components/Field/styles.js +2 -1
- package/dist/components/Field/types.js +2 -1
- package/dist/components/Field/useFieldInput.d.ts +1 -1
- package/dist/components/Field/useFieldInput.js +11 -8
- package/dist/components/Field/useFieldInput.js.map +1 -1
- package/dist/components/FileInput/index.js +32 -14
- package/dist/components/FileInput/index.js.map +1 -1
- package/dist/components/FileInput/types.js +2 -1
- package/dist/components/Icon/index.js +44 -26
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Icon/styles.js +2 -1
- package/dist/components/Icon/types.js +2 -1
- package/dist/components/List/context.js +25 -20
- package/dist/components/List/context.js.map +1 -1
- package/dist/components/List/elements.js +74 -33
- package/dist/components/List/elements.js.map +1 -1
- package/dist/components/List/index.js +35 -18
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/List/scroll.js +18 -13
- package/dist/components/List/scroll.js.map +1 -1
- package/dist/components/List/styles.js +2 -1
- package/dist/components/List/types.js +2 -1
- package/dist/components/LoadingOverlay/index.js +38 -20
- package/dist/components/LoadingOverlay/index.js.map +1 -1
- package/dist/components/LoadingOverlay/styles.js +2 -1
- package/dist/components/LoadingOverlay/types.js +2 -1
- package/dist/components/MaskedTextInput/index.js +32 -14
- package/dist/components/MaskedTextInput/index.js.map +1 -1
- package/dist/components/MaskedTextInput/mask.js +4 -1
- package/dist/components/MaskedTextInput/mask.js.map +1 -1
- package/dist/components/MaskedTextInput/types.js +2 -1
- package/dist/components/Modal/context.js +14 -9
- package/dist/components/Modal/context.js.map +1 -1
- package/dist/components/Modal/elements.js +31 -23
- package/dist/components/Modal/elements.js.map +1 -1
- package/dist/components/Modal/index.js +40 -22
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/styles.js +2 -1
- package/dist/components/Modal/types.js +2 -1
- package/dist/components/NumberIncrement/index.js +47 -29
- package/dist/components/NumberIncrement/index.js.map +1 -1
- package/dist/components/NumberIncrement/styles.js +2 -1
- package/dist/components/NumberIncrement/types.js +2 -1
- package/dist/components/NumberIncrement/useNumberIncrement.js +24 -21
- package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -1
- package/dist/components/Overlay/index.js +39 -21
- package/dist/components/Overlay/index.js.map +1 -1
- package/dist/components/Overlay/styles.js +2 -1
- package/dist/components/Overlay/types.js +2 -1
- package/dist/components/PaginationButtons/index.js +44 -26
- package/dist/components/PaginationButtons/index.js.map +1 -1
- package/dist/components/PaginationButtons/styles.js +2 -1
- package/dist/components/PaginationButtons/types.js +2 -1
- package/dist/components/PaginationIndicator/index.js +42 -24
- package/dist/components/PaginationIndicator/index.js.map +1 -1
- package/dist/components/PaginationIndicator/styles.js +2 -1
- package/dist/components/PaginationIndicator/types.js +2 -1
- package/dist/components/Progress/Bar/Segmented.js +23 -19
- package/dist/components/Progress/Bar/Segmented.js.map +1 -1
- package/dist/components/Progress/Bar/index.js +47 -29
- package/dist/components/Progress/Bar/index.js.map +1 -1
- package/dist/components/Progress/Bar/styles.js +2 -1
- package/dist/components/Progress/Bar/types.js +2 -1
- package/dist/components/Progress/Circle/Segmented.js +26 -22
- package/dist/components/Progress/Circle/Segmented.js.map +1 -1
- package/dist/components/Progress/Circle/index.js +48 -30
- package/dist/components/Progress/Circle/index.js.map +1 -1
- package/dist/components/Progress/Circle/styles.js +2 -1
- package/dist/components/Progress/Circle/types.js +2 -1
- package/dist/components/Progress/index.js +18 -2
- package/dist/components/Progress/index.js.map +1 -1
- package/dist/components/Progress/utils.js +4 -1
- package/dist/components/Progress/utils.js.map +1 -1
- package/dist/components/RadioInput/index.js +47 -26
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/styles.js +2 -1
- package/dist/components/RadioInput/types.js +2 -1
- package/dist/components/SearchInput/index.js +51 -14
- package/dist/components/SearchInput/index.js.map +1 -1
- package/dist/components/SectionFilters/index.js +56 -38
- package/dist/components/SectionFilters/index.js.map +1 -1
- package/dist/components/SectionFilters/styles.js +2 -1
- package/dist/components/SectionFilters/types.js +2 -1
- package/dist/components/Select/context.js +50 -44
- package/dist/components/Select/context.js.map +1 -1
- package/dist/components/Select/elements.js +29 -23
- package/dist/components/Select/elements.js.map +1 -1
- package/dist/components/Select/index.js +41 -24
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/styles.js +2 -1
- package/dist/components/Select/types.js +2 -1
- package/dist/components/Select/useTriggerWidth.js +9 -6
- package/dist/components/Select/useTriggerWidth.js.map +1 -1
- package/dist/components/Slider/index.js +68 -47
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/styles.js +2 -1
- package/dist/components/Slider/types.js +2 -1
- package/dist/components/Switch/index.js +40 -22
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/styles.js +2 -1
- package/dist/components/Switch/types.js +2 -1
- package/dist/components/Tag/index.js +55 -34
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Tag/styles.js +2 -1
- package/dist/components/Tag/types.js +2 -1
- package/dist/components/Text/index.js +48 -27
- package/dist/components/Text/index.js.map +1 -1
- package/dist/components/Text/styles.js +2 -1
- package/dist/components/Text/types.js +2 -1
- package/dist/components/TextEditor/index.js +50 -29
- package/dist/components/TextEditor/index.js.map +1 -1
- package/dist/components/TextEditor/styles.js +2 -1
- package/dist/components/TextEditor/types.js +2 -1
- package/dist/components/TextInput/index.js +49 -28
- package/dist/components/TextInput/index.js.map +1 -1
- package/dist/components/TextInput/styles.js +2 -1
- package/dist/components/TextInput/types.js +2 -1
- package/dist/components/TextInput/useTextInput.d.ts +2 -2
- package/dist/components/TextInput/useTextInput.js +15 -12
- package/dist/components/TextInput/useTextInput.js.map +1 -1
- package/dist/components/Tooltip/index.js +54 -33
- package/dist/components/Tooltip/index.js.map +1 -1
- package/dist/components/Tooltip/styles.js +2 -1
- package/dist/components/Tooltip/types.js +2 -1
- package/dist/components/Touchable/index.js +41 -21
- package/dist/components/Touchable/index.js.map +1 -1
- package/dist/components/Touchable/styles.js +2 -1
- package/dist/components/Touchable/types.js +2 -1
- package/dist/components/View/index.js +32 -15
- package/dist/components/View/index.js.map +1 -1
- package/dist/components/View/styles.js +2 -1
- package/dist/components/View/types.js +2 -1
- package/dist/components/components.js +57 -41
- package/dist/components/components.js.map +1 -1
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/ListMasonry.js +31 -22
- package/dist/lib/ListMasonry.js.map +1 -1
- package/dist/lib/ThemeVariables.js +11 -6
- package/dist/lib/ThemeVariables.js.map +1 -1
- package/dist/lib/WebStyleRegistry.js +7 -3
- package/dist/lib/WebStyleRegistry.js.map +1 -1
- package/dist/lib/hooks/index.js +38 -22
- package/dist/lib/hooks/index.js.map +1 -1
- package/dist/lib/hooks/useAnimatedStyle.js +9 -5
- package/dist/lib/hooks/useAnimatedStyle.js.map +1 -1
- package/dist/lib/hooks/useAnimatedVariantStyles.js +9 -6
- package/dist/lib/hooks/useAnimatedVariantStyles.js.map +1 -1
- package/dist/lib/hooks/useAsyncSelect.js +11 -8
- package/dist/lib/hooks/useAsyncSelect.js.map +1 -1
- package/dist/lib/hooks/useBreakpointMatch.js +22 -19
- package/dist/lib/hooks/useBreakpointMatch.js.map +1 -1
- package/dist/lib/hooks/useClick.js +10 -7
- package/dist/lib/hooks/useClick.js.map +1 -1
- package/dist/lib/hooks/useClickOutside.js +7 -4
- package/dist/lib/hooks/useClickOutside.js.map +1 -1
- package/dist/lib/hooks/useFileInput.js +7 -3
- package/dist/lib/hooks/useFileInput.js.map +1 -1
- package/dist/lib/hooks/useIsomorphicEffect.js +5 -2
- package/dist/lib/hooks/useIsomorphicEffect.js.map +1 -1
- package/dist/lib/hooks/useKeydown.js +13 -9
- package/dist/lib/hooks/useKeydown.js.map +1 -1
- package/dist/lib/hooks/useListFocus.js +7 -4
- package/dist/lib/hooks/useListFocus.js.map +1 -1
- package/dist/lib/hooks/useMediaQuery.js +11 -8
- package/dist/lib/hooks/useMediaQuery.js.map +1 -1
- package/dist/lib/hooks/usePageExitBlocker.js +10 -6
- package/dist/lib/hooks/usePageExitBlocker.js.map +1 -1
- package/dist/lib/hooks/usePagination.js +13 -10
- package/dist/lib/hooks/usePagination.js.map +1 -1
- package/dist/lib/hooks/usePopState.js +9 -5
- package/dist/lib/hooks/usePopState.js.map +1 -1
- package/dist/lib/hooks/usePopoverDismiss.js +8 -5
- package/dist/lib/hooks/usePopoverDismiss.js.map +1 -1
- package/dist/lib/hooks/useRefresh.js +16 -9
- package/dist/lib/hooks/useRefresh.js.map +1 -1
- package/dist/lib/hooks/useScrollEffect.js +6 -3
- package/dist/lib/hooks/useScrollEffect.js.map +1 -1
- package/dist/lib/hooks/useSearchParams.js +10 -7
- package/dist/lib/hooks/useSearchParams.js.map +1 -1
- package/dist/lib/hooks/useStaticAnimationStyles.js +6 -3
- package/dist/lib/hooks/useStaticAnimationStyles.js.map +1 -1
- package/dist/lib/hooks/useStylesFor.js +13 -9
- package/dist/lib/hooks/useStylesFor.js.map +1 -1
- package/dist/lib/hooks/useTouchableEvents.js +7 -4
- package/dist/lib/hooks/useTouchableEvents.js.map +1 -1
- package/dist/lib/hooks/useWindowFocus.js +11 -7
- package/dist/lib/hooks/useWindowFocus.js.map +1 -1
- package/dist/lib/hooks/useWindowSize.js +10 -7
- package/dist/lib/hooks/useWindowSize.js.map +1 -1
- package/dist/lib/index.js +22 -6
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/tools/index.js +19 -3
- package/dist/lib/tools/index.js.map +1 -1
- package/dist/lib/tools/localStorage.js +12 -8
- package/dist/lib/tools/localStorage.js.map +1 -1
- package/dist/lib/tools/mediaQuery.js +8 -3
- package/dist/lib/tools/mediaQuery.js.map +1 -1
- package/dist/lib/tools/modal.js +18 -13
- package/dist/lib/tools/modal.js.map +1 -1
- package/dist/lib/utils/attributes.js +6 -3
- package/dist/lib/utils/attributes.js.map +1 -1
- package/dist/lib/utils/cache.d.ts +2 -2
- package/dist/lib/utils/cache.js +11 -4
- package/dist/lib/utils/cache.js.map +1 -1
- package/dist/lib/utils/index.js +21 -5
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/pollyfils/scroll.js +5 -1
- package/dist/lib/utils/pollyfils/scroll.js.map +1 -1
- package/dist/lib/utils/stopPropagation.js +4 -1
- package/dist/lib/utils/stopPropagation.js.map +1 -1
- package/dist/lib/utils/test.js +7 -3
- package/dist/lib/utils/test.js.map +1 -1
- package/dist/types/index.js +17 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/utility.js +2 -1
- package/package.json +1 -1
|
@@ -1,28 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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);
|
|
7
24
|
/**
|
|
8
25
|
* Loading spinner whose visual appearance is delegated entirely to style
|
|
9
26
|
* composition; ships no built-in spinner markup.
|
|
10
27
|
* Uses: `useStylesFor`, `WebStyleRegistry`
|
|
11
28
|
*/
|
|
12
|
-
|
|
29
|
+
const ActivityIndicator = (props) => {
|
|
13
30
|
const { style, component: Component, size, ...rest } = {
|
|
14
|
-
...ActivityIndicator.defaultProps,
|
|
31
|
+
...exports.ActivityIndicator.defaultProps,
|
|
15
32
|
...props,
|
|
16
33
|
};
|
|
17
|
-
const styles = useStylesFor(ActivityIndicator.styleRegistryName, style);
|
|
18
|
-
return (
|
|
34
|
+
const styles = (0, useStylesFor_1.useStylesFor)(exports.ActivityIndicator.styleRegistryName, style);
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(Component, { ...rest, css: styles.wrapper }));
|
|
19
36
|
};
|
|
20
|
-
ActivityIndicator
|
|
21
|
-
ActivityIndicator.
|
|
22
|
-
ActivityIndicator.
|
|
23
|
-
ActivityIndicator.
|
|
24
|
-
|
|
37
|
+
exports.ActivityIndicator = ActivityIndicator;
|
|
38
|
+
exports.ActivityIndicator.styleRegistryName = 'ActivityIndicator';
|
|
39
|
+
exports.ActivityIndicator.elements = ['wrapper'];
|
|
40
|
+
exports.ActivityIndicator.rootElement = 'wrapper';
|
|
41
|
+
exports.ActivityIndicator.defaultProps = {
|
|
42
|
+
component: View_1.View,
|
|
25
43
|
size: null,
|
|
26
44
|
};
|
|
27
|
-
WebStyleRegistry.registerComponent(ActivityIndicator);
|
|
45
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.ActivityIndicator);
|
|
28
46
|
//# 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,kCAA8B;AAI9B,+DAA2D;AAC3D,iEAA6D;AAG7D,2CAAwB;AACxB,0CAAuB;AAEvB;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAE,EAAE;IACjE,MAAM,EACJ,KAAK,EACL,SAAS,EAAE,SAAS,EACpB,IAAI,EACJ,GAAG,IAAI,EACR,GAAG;QACF,GAAG,yBAAiB,CAAC,YAAY;QACjC,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,yBAAiB,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAEvE,OAAO,CACL,uBAAC,SAAS,OACJ,IAAI,EACR,GAAG,EAAE,MAAM,CAAC,OAAO,GACnB,CACH,CAAA;AACH,CAAC,CAAA;AAnBY,QAAA,iBAAiB,qBAmB7B;AAED,yBAAiB,CAAC,iBAAiB,GAAG,mBAAmB,CAAA;AACzD,yBAAiB,CAAC,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;AACxC,yBAAiB,CAAC,WAAW,GAAG,SAAS,CAAA;AAIzC,yBAAiB,CAAC,YAAY,GAAG;IAC/B,SAAS,EAAE,WAAI;IACf,IAAI,EAAE,IAAI;CACwB,CAAA;AAEpC,mCAAgB,CAAC,iBAAiB,CAAC,yBAAiB,CAAC,CAAA"}
|
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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.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);
|
|
9
26
|
const defaultGetBadgeContent = ({ count, maxCount }) => {
|
|
10
27
|
if (Number(count) > maxCount) {
|
|
11
28
|
return `${maxCount}+`;
|
|
@@ -20,13 +37,13 @@ const defaultGetBadgeContent = ({ count, maxCount }) => {
|
|
|
20
37
|
* Renders nothing when `badge` is `false` or absent.
|
|
21
38
|
* Uses: `View`, `Text`, `useStylesFor`, `WebStyleRegistry`
|
|
22
39
|
*/
|
|
23
|
-
|
|
40
|
+
const Badge = (props) => {
|
|
24
41
|
const { debugName, innerWrapperProps, textProps, maxCount, minCount, getBadgeContent, renderBadgeContent, disabled, style, badge, ...rest } = {
|
|
25
|
-
...Badge.defaultProps,
|
|
42
|
+
...exports.Badge.defaultProps,
|
|
26
43
|
...props,
|
|
27
44
|
};
|
|
28
|
-
const styles = useStylesFor(Badge.styleRegistryName, style);
|
|
29
|
-
const visible = (TypeGuards.isBoolean(badge) && badge === true) || TypeGuards.isNumber(badge);
|
|
45
|
+
const styles = (0, useStylesFor_1.useStylesFor)(exports.Badge.styleRegistryName, style);
|
|
46
|
+
const visible = (types_1.TypeGuards.isBoolean(badge) && badge === true) || types_1.TypeGuards.isNumber(badge);
|
|
30
47
|
if (!visible)
|
|
31
48
|
return null;
|
|
32
49
|
const wrapperStyles = [
|
|
@@ -43,26 +60,27 @@ export const Badge = (props) => {
|
|
|
43
60
|
(disabled && styles?.['count:disabled']),
|
|
44
61
|
textProps?.style,
|
|
45
62
|
];
|
|
46
|
-
const count = TypeGuards.isNumber(badge) ? badge : null;
|
|
63
|
+
const count = types_1.TypeGuards.isNumber(badge) ? badge : null;
|
|
47
64
|
const content = getBadgeContent({ ...props, maxCount, minCount, count });
|
|
48
|
-
const showContent = TypeGuards.isNumber(count) && count >= minCount;
|
|
49
|
-
const BadgeContent = TypeGuards.isNil(renderBadgeContent) ? () =>
|
|
50
|
-
return (
|
|
51
|
-
?
|
|
65
|
+
const showContent = types_1.TypeGuards.isNumber(count) && count >= minCount;
|
|
66
|
+
const BadgeContent = types_1.TypeGuards.isNil(renderBadgeContent) ? () => (0, jsx_runtime_1.jsx)(Text_1.Text, { text: content, ...textProps }) : renderBadgeContent;
|
|
67
|
+
return ((0, jsx_runtime_1.jsx)(View_1.View, { ...rest, style: wrapperStyles, children: (0, jsx_runtime_1.jsx)(View_1.View, { ...innerWrapperProps, style: innerWrapperStyles, children: showContent
|
|
68
|
+
? (0, jsx_runtime_1.jsx)(BadgeContent, { ...props, style: countStyles, maxCount: maxCount, minCount: minCount, count: count, getBadgeContent: getBadgeContent, content: content })
|
|
52
69
|
: null }) }));
|
|
53
70
|
};
|
|
54
|
-
Badge
|
|
55
|
-
Badge.
|
|
56
|
-
Badge.
|
|
57
|
-
Badge.
|
|
58
|
-
|
|
71
|
+
exports.Badge = Badge;
|
|
72
|
+
exports.Badge.styleRegistryName = 'Badge';
|
|
73
|
+
exports.Badge.elements = ['wrapper', 'innerWrapper', 'count'];
|
|
74
|
+
exports.Badge.rootElement = 'wrapper';
|
|
75
|
+
exports.Badge.withVariantTypes = (styles) => {
|
|
76
|
+
return exports.Badge;
|
|
59
77
|
};
|
|
60
|
-
Badge.defaultProps = {
|
|
78
|
+
exports.Badge.defaultProps = {
|
|
61
79
|
maxCount: 9,
|
|
62
80
|
minCount: 1,
|
|
63
81
|
getBadgeContent: defaultGetBadgeContent,
|
|
64
82
|
disabled: false,
|
|
65
83
|
badge: true,
|
|
66
84
|
};
|
|
67
|
-
WebStyleRegistry.registerComponent(Badge);
|
|
85
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.Badge);
|
|
68
86
|
//# 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,2CAA4C;AAC5C,kCAA8B;AAC9B,kCAA8B;AAE9B,+DAA2D;AAC3D,iEAA6D;AAG7D,2CAAwB;AACxB,0CAAuB;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;AACI,MAAM,KAAK,GAAG,CAAC,KAAiB,EAAE,EAAE;IACzC,MAAM,EACJ,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,KAAK,EACL,KAAK,EACL,GAAG,IAAI,EACR,GAAG;QACF,GAAG,aAAK,CAAC,YAAY;QACrB,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,aAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE3D,MAAM,OAAO,GAAG,CAAC,kBAAU,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,kBAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE7F,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAEzB,MAAM,aAAa,GAAG;QACpB,MAAM,E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BACF,CAAC,CAAC,IAAI,GAEH,GACF,CACR,CAAA;AACH,CAAC,CAAA;AAnEY,QAAA,KAAK,SAmEjB;AAED,aAAK,CAAC,iBAAiB,GAAG,OAAO,CAAA;AACjC,aAAK,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,CAAC,CAAA;AACrD,aAAK,CAAC,WAAW,GAAG,SAAS,CAAA;AAE7B,aAAK,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC1D,OAAO,aAAyE,CAAA;AAClF,CAAC,CAAA;AAED,aAAK,CAAC,YAAY,GAAG;IACnB,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,eAAe,EAAE,sBAAsB;IACvC,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,IAAI;CACW,CAAA;AAExB,mCAAgB,CAAC,iBAAiB,CAAC,aAAK,CAAC,CAAA"}
|
|
@@ -1,23 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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.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) {
|
|
14
31
|
const allProps = {
|
|
15
32
|
...Button.defaultProps,
|
|
16
33
|
...buttonProps,
|
|
17
34
|
};
|
|
18
35
|
const { children, icon, text, loading, loadingShowText, onPress, disabled, rightIcon, selected, loaderProps, debugName, style, context, ...props } = allProps;
|
|
19
|
-
const styles = useStylesFor(Button.styleRegistryName, style);
|
|
20
|
-
const getStyles = (key, partialStyle = null) => mergeStyles([
|
|
36
|
+
const styles = (0, useStylesFor_1.useStylesFor)(Button.styleRegistryName, style);
|
|
37
|
+
const getStyles = (key, partialStyle = null) => (0, styles_1.mergeStyles)([
|
|
21
38
|
partialStyle,
|
|
22
39
|
styles?.[key],
|
|
23
40
|
]);
|
|
@@ -33,12 +50,12 @@ export function Button(buttonProps) {
|
|
|
33
50
|
const isLeftIconHide = componentStyles?.leftIcon?.display === 'none';
|
|
34
51
|
const shouldRenderLeftIcon = !loading && !isLeftIconHide && !!icon;
|
|
35
52
|
const _hideTextOnLoading = !loadingShowText && loading;
|
|
36
|
-
const attrs = toDataAttrs([{ selected, loading }, context]);
|
|
37
|
-
return (
|
|
53
|
+
const attrs = (0, lib_1.toDataAttrs)([{ selected, loading }, context]);
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(Touchable_1.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 ? (0, jsx_runtime_1.jsx)(Icon_1.Icon, { debugName: debugName, icon: icon, style: componentStyles.leftIcon, className: 'button__icon button__left_icon' }) : null, types_1.TypeGuards.isString(text) && !_hideTextOnLoading ? (0, jsx_runtime_1.jsx)(Text_1.Text.Span, { debugName: debugName, text: text, style: componentStyles.text, className: 'button__text' }) : null, children, loading ? (0, jsx_runtime_1.jsx)(ActivityIndicator_1.ActivityIndicator, { debugName: `${debugName} loader`, ...loaderProps, style: componentStyles.loader, className: 'button__loader' }) : null, !!rightIcon ? (0, jsx_runtime_1.jsx)(Icon_1.Icon, { debugName: debugName, icon: rightIcon, style: componentStyles.rightIcon, className: 'button__icon button__right_icon' }) : null] }));
|
|
38
55
|
}
|
|
39
56
|
function TabButton(buttonProps) {
|
|
40
57
|
// @ts-ignore
|
|
41
|
-
return
|
|
58
|
+
return (0, jsx_runtime_1.jsx)(Button, { ...buttonProps, role: 'tab', "aria-pressed": undefined, "aria-selected": buttonProps?.selected || undefined });
|
|
42
59
|
}
|
|
43
60
|
Button.Tab = TabButton;
|
|
44
61
|
Button.styleRegistryName = 'Button';
|
|
@@ -48,5 +65,5 @@ Button.defaultProps = {
|
|
|
48
65
|
debounce: 600,
|
|
49
66
|
loadingShowText: false,
|
|
50
67
|
};
|
|
51
|
-
WebStyleRegistry.registerComponent(Button);
|
|
68
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(Button);
|
|
52
69
|
//# 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":";;;;;;;;;;;;;;;;AAiBA,wBAwEC;;AAxFD,2CAAsD;AACtD,kCAA8B;AAC9B,4CAAwC;AACxC,kCAA8B;AAC9B,4DAAwD;AAGxD,+DAA2D;AAC3D,iEAA6D;AAC7D,6CAAqF;AAErF,mCAAuC;AAEvC,2CAAwB;AACxB,0CAAuB;AAEvB,SAAgB,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,IAAA,2BAAY,EAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE5D,MAAM,SAAS,GAAG,CAAC,GAAgB,EAAE,YAAY,GAAG,IAAI,EAAE,EAAE,CAAC,IAAA,oBAAW,EAAC;QACvE,YAAY;QACZ,MAAM,EAAE,CAAC,GAAG,CAAC;KACd,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;IAEpC,MAAM,eAAe,GAA0B;QAC7C,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC;QAC7B,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC;QACvB,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC;QAC3B,QAAQ,EAAE,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;QAC3C,SAAS,EAAE,SAAS,CAAC,WAAW,EAAE,UA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C,MAAM,EAAE,SAAS,EAAC,gBAAgB,GAAE,CAAC,CAAC,CAAC,IAAI,EAClJ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,uBAAC,WAAI,IAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,CAAC,SAAS,EAAE,SAAS,EAAC,iCAAiC,GAAE,CAAC,CAAC,CAAC,IAAI,IACxI,CACb,CAAA;AACH,CAAC;AACD,SAAS,SAAS,CAAwD,WAA2B;IACnG,aAAa;IACb,OAAO,uBAAC,MAAM,OACR,WAAW,EACf,IAAI,EAAC,KAAK,kBACI,SAAS,mBACR,WAAW,EAAE,QAAQ,IAAI,SAAS,GACjD,CAAA;AACJ,CAAC;AACD,MAAM,CAAC,GAAG,GAAG,SAAS,CAAA;AAEtB,MAAM,CAAC,iBAAiB,GAAG,QAAQ,CAAA;AACnC,MAAM,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAA;AAChF,MAAM,CAAC,WAAW,GAAG,SAAS,CAAA;AAG9B,MAAM,CAAC,YAAY,GAAG;IACpB,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,KAAK;CACM,CAAA;AAE9B,mCAAgB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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);
|
|
8
25
|
function SlotForwader(allProps) {
|
|
9
26
|
let { ref: providedRef, context, render, ...actualProps } = allProps;
|
|
10
|
-
let [props, ref] = useContextProps(actualProps, providedRef, context);
|
|
27
|
+
let [props, ref] = (0, react_aria_components_1.useContextProps)(actualProps, providedRef, context);
|
|
11
28
|
return render(props, ref);
|
|
12
29
|
}
|
|
13
30
|
/**
|
|
@@ -16,14 +33,14 @@ function SlotForwader(allProps) {
|
|
|
16
33
|
* First day of week defaults to Sunday (`'sun'`).
|
|
17
34
|
* Uses: `View`, `Icon`
|
|
18
35
|
*/
|
|
19
|
-
|
|
36
|
+
function Calendar(calendarProps) {
|
|
20
37
|
const { style, prevIcon, nextIcon, debugName, renderNext, renderPrevious, ...props } = {
|
|
21
38
|
...Calendar.defaultProps,
|
|
22
39
|
...calendarProps,
|
|
23
40
|
};
|
|
24
|
-
const styles = useStylesFor(Calendar.styleRegistryName, style);
|
|
41
|
+
const styles = (0, useStylesFor_1.useStylesFor)(Calendar.styleRegistryName, style);
|
|
25
42
|
const s = styles;
|
|
26
|
-
return (
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.Calendar, { ...props, css: s.wrapper, children: [(0, jsx_runtime_1.jsxs)(View_1.View, { component: 'header', style: styles.header, children: [(0, jsx_runtime_1.jsx)(SlotForwader, { context: react_aria_components_1.ButtonContext, slot: 'previous', css: styles.prevButton, render: renderPrevious ?? (() => (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})) }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Heading, { css: s.heading }), (0, jsx_runtime_1.jsx)(SlotForwader, { context: react_aria_components_1.ButtonContext, slot: 'next', css: styles.nextButton, render: renderNext ?? (() => (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})) })] }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.CalendarGrid, { css: s.grid, children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.CalendarGridHeader, { children: (day) => (0, jsx_runtime_1.jsx)(react_aria_components_1.CalendarHeaderCell, { css: s.gridHeaderCell, children: day }) }), (0, jsx_runtime_1.jsx)(react_aria_components_1.CalendarGridBody, { children: (date) => (0, jsx_runtime_1.jsx)(react_aria_components_1.CalendarCell, { date: date, css: s.cell }) })] })] }));
|
|
27
44
|
}
|
|
28
45
|
Calendar.styleRegistryName = 'Calendar';
|
|
29
46
|
Calendar.elements = [
|
|
@@ -46,5 +63,5 @@ Calendar.defaultProps = {
|
|
|
46
63
|
nextIcon: 'chevronRight',
|
|
47
64
|
firstDayOfWeek: 'sun'
|
|
48
65
|
};
|
|
49
|
-
WebStyleRegistry.registerComponent(Calendar);
|
|
66
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(Calendar);
|
|
50
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Calendar/index.tsx"],"names":[],"mappings":"
|
|
1
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";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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 __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);
|
|
12
54
|
const Dots = (params) => {
|
|
13
55
|
const { page, childArray, onPress, styles, dotsDisabled } = params;
|
|
14
|
-
return (
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(View_1.View, { style: styles.dots, children: childArray.map((_, index) => {
|
|
15
57
|
const isSelected = index === page;
|
|
16
58
|
const style = [
|
|
17
59
|
styles.dot,
|
|
18
60
|
isSelected && styles['dot:selected'],
|
|
19
61
|
dotsDisabled && styles['dot:disabled'],
|
|
20
62
|
];
|
|
21
|
-
return (
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(Touchable_1.Touchable, { onPress: () => onPress?.(index), style: style, disabled: dotsDisabled, debugName: 'dots' }, index));
|
|
22
64
|
}) }));
|
|
23
65
|
};
|
|
24
66
|
/**
|
|
@@ -26,22 +68,22 @@ const Dots = (params) => {
|
|
|
26
68
|
* The `page` prop is semi-controlled — it syncs to Embla whenever it changes but internal swipe still updates the active index independently.
|
|
27
69
|
* Uses: `Touchable`
|
|
28
70
|
*/
|
|
29
|
-
|
|
71
|
+
exports.Carousel = (0, react_1.forwardRef)((props, ref) => {
|
|
30
72
|
const { style, children, renderSlideWrapper: SlideWrapper, page, dots, dotsDisabled, infinite, disableSwipe, onChange, footer, dotsProps, slideWrapperProps, autoplay, autoplayDelay, spaceBetween, slidesPerView, ...rest } = {
|
|
31
|
-
...Carousel.defaultProps,
|
|
73
|
+
...exports.Carousel.defaultProps,
|
|
32
74
|
...props,
|
|
33
75
|
};
|
|
34
|
-
const styles = useStylesFor(Carousel.styleRegistryName, style);
|
|
35
|
-
const childArray =
|
|
36
|
-
const [currentIndex, setCurrentIndex] = useState(0);
|
|
37
|
-
const plugins = useMemo(() => {
|
|
76
|
+
const styles = (0, useStylesFor_1.useStylesFor)(exports.Carousel.styleRegistryName, style);
|
|
77
|
+
const childArray = react_1.default.Children.toArray(children);
|
|
78
|
+
const [currentIndex, setCurrentIndex] = (0, react_1.useState)(0);
|
|
79
|
+
const plugins = (0, react_1.useMemo)(() => {
|
|
38
80
|
const pluginList = [];
|
|
39
81
|
if (autoplay) {
|
|
40
|
-
pluginList.push(
|
|
82
|
+
pluginList.push((0, embla_carousel_autoplay_1.default)({ delay: autoplayDelay, stopOnInteraction: false }));
|
|
41
83
|
}
|
|
42
84
|
return pluginList;
|
|
43
85
|
}, [autoplay, autoplayDelay]);
|
|
44
|
-
const [emblaRef, emblaApi] =
|
|
86
|
+
const [emblaRef, emblaApi] = (0, embla_carousel_react_1.default)({
|
|
45
87
|
loop: infinite,
|
|
46
88
|
dragFree: false,
|
|
47
89
|
containScroll: 'trimSnaps',
|
|
@@ -49,28 +91,28 @@ export const Carousel = forwardRef((props, ref) => {
|
|
|
49
91
|
slidesToScroll: 1,
|
|
50
92
|
...(disableSwipe && { watchDrag: false }),
|
|
51
93
|
}, plugins);
|
|
52
|
-
const goTo = useCallback((index) => {
|
|
94
|
+
const goTo = (0, react_1.useCallback)((index) => {
|
|
53
95
|
if (emblaApi) {
|
|
54
96
|
emblaApi.scrollTo(index);
|
|
55
97
|
}
|
|
56
98
|
}, [emblaApi]);
|
|
57
|
-
const next = useCallback(() => {
|
|
99
|
+
const next = (0, react_1.useCallback)(() => {
|
|
58
100
|
if (emblaApi) {
|
|
59
101
|
emblaApi.scrollNext();
|
|
60
102
|
}
|
|
61
103
|
}, [emblaApi]);
|
|
62
|
-
const prev = useCallback(() => {
|
|
104
|
+
const prev = (0, react_1.useCallback)(() => {
|
|
63
105
|
if (emblaApi) {
|
|
64
106
|
emblaApi.scrollPrev();
|
|
65
107
|
}
|
|
66
108
|
}, [emblaApi]);
|
|
67
|
-
useImperativeHandle(ref, () => ({
|
|
109
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
68
110
|
goTo,
|
|
69
111
|
next,
|
|
70
112
|
prev,
|
|
71
113
|
emblaApi,
|
|
72
114
|
}), [goTo, next, prev, emblaApi]);
|
|
73
|
-
useEffect(() => {
|
|
115
|
+
(0, react_1.useEffect)(() => {
|
|
74
116
|
if (!emblaApi)
|
|
75
117
|
return;
|
|
76
118
|
const onSelect = () => {
|
|
@@ -84,46 +126,46 @@ export const Carousel = forwardRef((props, ref) => {
|
|
|
84
126
|
emblaApi.off('select', onSelect);
|
|
85
127
|
};
|
|
86
128
|
}, [emblaApi, onChange]);
|
|
87
|
-
onUpdate(() => {
|
|
129
|
+
(0, hooks_1.onUpdate)(() => {
|
|
88
130
|
if (page !== undefined && page !== currentIndex && emblaApi) {
|
|
89
131
|
goTo(page);
|
|
90
132
|
}
|
|
91
133
|
}, [page]);
|
|
92
|
-
return (
|
|
134
|
+
return ((0, jsx_runtime_1.jsxs)(View_1.View, { style: styles.wrapper, children: [(0, jsx_runtime_1.jsx)(View_1.View, { ref: emblaRef, style: {
|
|
93
135
|
overflow: 'hidden',
|
|
94
|
-
}, children:
|
|
136
|
+
}, children: (0, jsx_runtime_1.jsx)(View_1.View, { style: {
|
|
95
137
|
display: 'flex',
|
|
96
138
|
flexDirection: 'row',
|
|
97
139
|
gap: spaceBetween,
|
|
98
140
|
}, children: childArray.map((child, index) => {
|
|
99
|
-
return (
|
|
141
|
+
return ((0, jsx_runtime_1.jsx)(View_1.View, { style: {
|
|
100
142
|
flex: slidesPerView === 1 ? '0 0 100%' : slidesPerView === 'auto' ? '0 0 auto' : `0 0 ${100 / slidesPerView}%`,
|
|
101
143
|
minWidth: 0,
|
|
102
|
-
}, children:
|
|
103
|
-
}) }) }),
|
|
144
|
+
}, children: (0, jsx_runtime_1.jsx)(SlideWrapper, { style: styles.slideWrapper, ...slideWrapperProps, children: child }) }, index));
|
|
145
|
+
}) }) }), (0, jsx_runtime_1.jsxs)(View_1.View, { style: styles.footerWrapper, children: [footer, dots ? ((0, jsx_runtime_1.jsx)(Dots, { page: currentIndex, onPress: goTo, childArray: childArray, styles: styles, dotsDisabled: dotsDisabled, ...dotsProps })) : null] })] }));
|
|
104
146
|
});
|
|
105
|
-
Carousel.styleRegistryName = 'Carousel';
|
|
106
|
-
Carousel.elements = [
|
|
147
|
+
exports.Carousel.styleRegistryName = 'Carousel';
|
|
148
|
+
exports.Carousel.elements = [
|
|
107
149
|
'wrapper',
|
|
108
150
|
'dot',
|
|
109
151
|
'dots',
|
|
110
152
|
'slideWrapper',
|
|
111
153
|
'footerWrapper',
|
|
112
154
|
];
|
|
113
|
-
Carousel.rootElement = 'wrapper';
|
|
114
|
-
Carousel.withVariantTypes = (styles) => {
|
|
115
|
-
return Carousel;
|
|
155
|
+
exports.Carousel.rootElement = 'wrapper';
|
|
156
|
+
exports.Carousel.withVariantTypes = (styles) => {
|
|
157
|
+
return exports.Carousel;
|
|
116
158
|
};
|
|
117
|
-
Carousel.defaultProps = {
|
|
159
|
+
exports.Carousel.defaultProps = {
|
|
118
160
|
dots: false,
|
|
119
161
|
dotsDisabled: false,
|
|
120
162
|
infinite: false,
|
|
121
163
|
disableSwipe: false,
|
|
122
|
-
renderSlideWrapper: View,
|
|
164
|
+
renderSlideWrapper: View_1.View,
|
|
123
165
|
autoplay: false,
|
|
124
166
|
autoplayDelay: 3000,
|
|
125
167
|
spaceBetween: 0,
|
|
126
168
|
slidesPerView: 1,
|
|
127
169
|
};
|
|
128
|
-
WebStyleRegistry.registerComponent(Carousel);
|
|
170
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.Carousel);
|
|
129
171
|
//# sourceMappingURL=index.js.map
|