@codeleap/web 7.0.2 → 7.1.1
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 +17 -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,50 +1,32 @@
|
|
|
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.LoadingOverlay = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
-
const View_1 = require("../View");
|
|
20
|
-
const ActivityIndicator_1 = require("../ActivityIndicator");
|
|
21
|
-
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
22
|
-
const styles_1 = require("@codeleap/styles");
|
|
23
|
-
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
24
|
-
__exportStar(require("./styles"), exports);
|
|
25
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { View } from '../View';
|
|
3
|
+
import { ActivityIndicator } from '../ActivityIndicator';
|
|
4
|
+
import { useStylesFor } from '../../lib/hooks/useStylesFor';
|
|
5
|
+
import { useNestedStylesByKey } from '@codeleap/styles';
|
|
6
|
+
import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
|
|
7
|
+
export * from './styles';
|
|
8
|
+
export * from './types';
|
|
26
9
|
/**
|
|
27
10
|
* `View` wrapper that renders an `ActivityIndicator` alongside its children;
|
|
28
11
|
* use `visible` to toggle the `wrapper:visible` style variant to show or hide
|
|
29
12
|
* the spinner layer.
|
|
30
13
|
* Uses: `View`, `ActivityIndicator`, `useStylesFor`, `WebStyleRegistry`
|
|
31
14
|
*/
|
|
32
|
-
const LoadingOverlay = (props) => {
|
|
15
|
+
export const LoadingOverlay = (props) => {
|
|
33
16
|
const { visible, children, style, indicatorProps, debugName, ...rest } = {
|
|
34
|
-
...
|
|
17
|
+
...LoadingOverlay.defaultProps,
|
|
35
18
|
...props,
|
|
36
19
|
};
|
|
37
|
-
const styles =
|
|
38
|
-
const indicatorStyles =
|
|
39
|
-
return ((
|
|
20
|
+
const styles = useStylesFor(LoadingOverlay.styleRegistryName, style);
|
|
21
|
+
const indicatorStyles = useNestedStylesByKey('indicator', styles);
|
|
22
|
+
return (_jsxs(View, { ...rest, style: [styles.wrapper, visible && styles['wrapper:visible']], children: [_jsx(ActivityIndicator, { debugName: debugName, ...indicatorProps, style: indicatorStyles }), children] }));
|
|
40
23
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return exports.LoadingOverlay;
|
|
24
|
+
LoadingOverlay.styleRegistryName = 'LoadingOverlay';
|
|
25
|
+
LoadingOverlay.elements = ['wrapper', 'indicator'];
|
|
26
|
+
LoadingOverlay.rootElement = 'wrapper';
|
|
27
|
+
LoadingOverlay.withVariantTypes = (styles) => {
|
|
28
|
+
return LoadingOverlay;
|
|
47
29
|
};
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
LoadingOverlay.defaultProps = {};
|
|
31
|
+
WebStyleRegistry.registerComponent(LoadingOverlay);
|
|
50
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LoadingOverlay/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LoadingOverlay/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAyC,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE7D,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA0B,EAAE,EAAE;IAC3D,MAAM,EACJ,OAAO,EACP,QAAQ,EACR,KAAK,EACL,cAAc,EACd,SAAS,EACT,GAAG,IAAI,EACR,GAAG;QACF,GAAG,cAAc,CAAC,YAAY;QAC9B,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,cAAc,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAEpE,MAAM,eAAe,GAAG,oBAAoB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;IAEjE,OAAO,CACL,MAAC,IAAI,OAAK,IAAI,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC,aAC3E,KAAC,iBAAiB,IAAC,SAAS,EAAE,SAAS,KAAM,cAAc,EAAE,KAAK,EAAE,eAAe,GAAI,EACtF,QAAQ,IACJ,CACR,CAAA;AACH,CAAC,CAAA;AAED,cAAc,CAAC,iBAAiB,GAAG,gBAAgB,CAAA;AACnD,cAAc,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAClD,cAAc,CAAC,WAAW,GAAG,SAAS,CAAA;AAEtC,cAAc,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACnE,OAAO,cAA2F,CAAA;AACpG,CAAC,CAAA;AAED,cAAc,CAAC,YAAY,GAAG,EAAkC,CAAA;AAEhE,gBAAgB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAA"}
|
|
@@ -1,52 +1,34 @@
|
|
|
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.MaskedTextInput = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
-
const react_imask_1 = require("react-imask");
|
|
20
|
-
const TextInput_1 = require("../TextInput");
|
|
21
|
-
const mask_1 = require("./mask");
|
|
22
|
-
const react_1 = require("react");
|
|
23
|
-
const types_1 = require("@codeleap/types");
|
|
24
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useIMask } from 'react-imask';
|
|
3
|
+
import { TextInput } from '../TextInput';
|
|
4
|
+
import { maskPresets } from './mask';
|
|
5
|
+
import { useMemo, useCallback } from 'react';
|
|
6
|
+
import { TypeGuards } from '@codeleap/types';
|
|
7
|
+
export * from './types';
|
|
25
8
|
/**
|
|
26
9
|
* `TextInput` variant that applies a `react-imask` pattern mask via a set of named presets or a custom `react-imask` configuration.
|
|
27
10
|
* The `placeholder` defaults to the mask pattern string when none is provided.
|
|
28
11
|
* Uses: `TextInput`
|
|
29
12
|
*/
|
|
30
|
-
const MaskedTextInput = (props) => {
|
|
13
|
+
export const MaskedTextInput = (props) => {
|
|
31
14
|
const { maskType, maskOptions: customMaskOptions, onAccept, onComplete, unmask = false, onValueChange, value, ...textInputProps } = props;
|
|
32
|
-
const maskOptions =
|
|
33
|
-
const preset = maskType ?
|
|
15
|
+
const maskOptions = useMemo(() => {
|
|
16
|
+
const preset = maskType ? maskPresets[maskType] : {};
|
|
34
17
|
return {
|
|
35
18
|
...preset,
|
|
36
19
|
...customMaskOptions,
|
|
37
20
|
unmask,
|
|
38
21
|
};
|
|
39
22
|
}, [maskType, customMaskOptions, unmask]);
|
|
40
|
-
const handleAccept =
|
|
23
|
+
const handleAccept = useCallback((value, maskRef, e) => {
|
|
41
24
|
onAccept?.(value, maskRef, e);
|
|
42
25
|
onValueChange?.(value);
|
|
43
26
|
}, [onAccept, onValueChange]);
|
|
44
|
-
const { ref: maskRef } =
|
|
27
|
+
const { ref: maskRef } = useIMask(maskOptions, {
|
|
45
28
|
onAccept: handleAccept,
|
|
46
29
|
onComplete,
|
|
47
30
|
});
|
|
48
|
-
const placeholder = textInputProps?.placeholder ?? (
|
|
49
|
-
return ((
|
|
31
|
+
const placeholder = textInputProps?.placeholder ?? (TypeGuards.isString(maskOptions?.mask) ? maskOptions?.mask : undefined);
|
|
32
|
+
return (_jsx(TextInput, { ...textInputProps, placeholder: placeholder, ref: maskRef, value: value, onValueChange: onValueChange }));
|
|
50
33
|
};
|
|
51
|
-
exports.MaskedTextInput = MaskedTextInput;
|
|
52
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/MaskedTextInput/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/MaskedTextInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAGtC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,cAAc,SAAS,CAAA;AAEvB;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC7D,MAAM,EACJ,QAAQ,EACR,WAAW,EAAE,iBAAiB,EAC9B,QAAQ,EACR,UAAU,EACV,MAAM,GAAG,KAAK,EACd,aAAa,EACb,KAAK,EACL,GAAG,cAAc,EAClB,GAAG,KAAK,CAAA;IAET,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE;QAC/B,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QAEpD,OAAO;YACL,GAAG,MAAM;YACT,GAAG,iBAAiB;YACpB,MAAM;SACP,CAAA;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAA;IAEzC,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,KAAa,EAAE,OAAY,EAAE,CAAc,EAAE,EAAE;QAC/E,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;QAC7B,aAAa,EAAE,CAAC,KAAK,CAAC,CAAA;IACxB,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAA;IAE7B,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,WAAkB,EAAE;QACpD,QAAQ,EAAE,YAAY;QACtB,UAAU;KACX,CAAC,CAAA;IAEF,MAAM,WAAW,GAAG,cAAc,EAAE,WAAW,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IAE3H,OAAO,CACL,KAAC,SAAS,OACJ,cAAc,EAClB,WAAW,EAAE,WAAW,EACxB,GAAG,EAAE,OAAc,EACnB,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,GAC5B,CACH,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask.js","sourceRoot":"","sources":["../../../src/components/MaskedTextInput/mask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mask.js","sourceRoot":"","sources":["../../../src/components/MaskedTextInput/mask.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,WAAW,GAAkE;IACxF,aAAa,EAAE;QACb,IAAI,EAAE,qBAAqB;QAC3B,IAAI,EAAE,KAAK;QACX,eAAe,EAAE,GAAG;KACrB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,KAAK;QACX,eAAe,EAAE,GAAG;KACrB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,KAAK;QACX,eAAe,EAAE,GAAG;KACrB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,KAAK;QACX,eAAe,EAAE,GAAG;KACrB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,KAAK;QACX,eAAe,EAAE,GAAG;KACrB;IACD,eAAe,EAAE;QACf,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,KAAK;QACX,eAAe,EAAE,GAAG;KACrB;IACD,QAAQ,EAAE,EAAE;CACb,CAAA"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
import { useStylesFor } from '../../lib/hooks/useStylesFor';
|
|
7
4
|
function useModalProvider({ children: _children, ...props }) {
|
|
8
|
-
const styles =
|
|
5
|
+
const styles = useStylesFor('Modal', props.style);
|
|
9
6
|
const close = () => {
|
|
10
7
|
props.toggle?.();
|
|
11
8
|
props.onClose?.();
|
|
@@ -16,26 +13,24 @@ function useModalProvider({ children: _children, ...props }) {
|
|
|
16
13
|
close,
|
|
17
14
|
};
|
|
18
15
|
}
|
|
19
|
-
|
|
16
|
+
export const ModalContext = createContext(null);
|
|
20
17
|
/**
|
|
21
18
|
* Reads the nearest `Modal.Provider` context value.
|
|
22
19
|
* Throws if called outside a `Modal.Provider` tree.
|
|
23
20
|
*/
|
|
24
|
-
const useModalContext = () => {
|
|
25
|
-
const ctx =
|
|
21
|
+
export const useModalContext = () => {
|
|
22
|
+
const ctx = useContext(ModalContext);
|
|
26
23
|
if (!ctx)
|
|
27
24
|
throw new Error('useModalContext must be used inside Modal.Provider');
|
|
28
25
|
return ctx;
|
|
29
26
|
};
|
|
30
|
-
exports.useModalContext = useModalContext;
|
|
31
27
|
/**
|
|
32
28
|
* Shares resolved styles and the `close` callback with all sub-components in a custom `Modal` layout.
|
|
33
29
|
* Required by `Modal.Backdrop`, `Modal.Box`, `Modal.Header`, `Modal.Body`, and `Modal.Footer` when composed manually.
|
|
34
30
|
* Uses: `useStylesFor`
|
|
35
31
|
*/
|
|
36
|
-
const ModalProvider = (props) => {
|
|
32
|
+
export const ModalProvider = (props) => {
|
|
37
33
|
const value = useModalProvider(props);
|
|
38
|
-
return ((
|
|
34
|
+
return (_jsx(ModalContext.Provider, { value: value, children: props.children }));
|
|
39
35
|
};
|
|
40
|
-
exports.ModalProvider = ModalProvider;
|
|
41
36
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/Modal/context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/Modal/context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAIjD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAE3D,SAAS,gBAAgB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAc;IACrE,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IAEjD,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,KAAK,CAAC,MAAM,EAAE,EAAE,CAAA;QAChB,KAAK,CAAC,OAAO,EAAE,EAAE,CAAA;IACnB,CAAC,CAAA;IAED,OAAO;QACL,KAAK;QACL,MAAM,EAAE,MAAuC;QAC/C,KAAK;KACN,CAAA;AACH,CAAC;AAID,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAA;AAEzE;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAsB,EAAE;IACrD,MAAM,GAAG,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;IACpC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;IAC/E,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAiB,EAAE,EAAE;IACjD,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACrC,OAAO,CACL,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAChC,KAAK,CAAC,QAAQ,GACO,CACzB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,74 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const View_1 = require("../View");
|
|
8
|
-
const Text_1 = require("../Text");
|
|
9
|
-
const context_1 = require("./context");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { ModalOverlay, Modal as RACModal, Dialog, Heading, } from 'react-aria-components';
|
|
3
|
+
import { TypeGuards } from '@codeleap/types';
|
|
4
|
+
import { View } from '../View';
|
|
5
|
+
import { Text } from '../Text';
|
|
6
|
+
import { useModalContext } from './context';
|
|
10
7
|
/**
|
|
11
8
|
* Full-screen overlay that controls open/close state and dismiss gestures for the modal.
|
|
12
9
|
* Backdrop click dismissal and Escape-key dismissal are each gated by `closable` + their respective props.
|
|
13
10
|
* Must be rendered inside `Modal.Provider`.
|
|
14
11
|
*/
|
|
15
|
-
const ModalBackdrop = ({ children }) => {
|
|
16
|
-
const { styles, close, props } =
|
|
17
|
-
return ((
|
|
12
|
+
export const ModalBackdrop = ({ children }) => {
|
|
13
|
+
const { styles, close, props } = useModalContext();
|
|
14
|
+
return (_jsx(ModalOverlay, { isOpen: !!props.visible, onOpenChange: (open) => { if (!open)
|
|
18
15
|
close(); }, isDismissable: !!(props.closable && props.dismissOnBackdrop), isKeyboardDismissDisabled: !props.closeOnEscape, css: styles.backdrop, children: children }));
|
|
19
16
|
};
|
|
20
|
-
exports.ModalBackdrop = ModalBackdrop;
|
|
21
17
|
/**
|
|
22
18
|
* Scoped dialog container that wraps children in a react-aria `Modal` + `Dialog` pair.
|
|
23
19
|
* Falls back to `debugName` or `"Dialog"` as the accessible label when no `title` is provided.
|
|
24
20
|
* Must be rendered inside `Modal.Backdrop`.
|
|
25
21
|
*/
|
|
26
|
-
const ModalBox = ({ children, 'aria-label': ariaLabel }) => {
|
|
27
|
-
const { styles, props } =
|
|
22
|
+
export const ModalBox = ({ children, 'aria-label': ariaLabel }) => {
|
|
23
|
+
const { styles, props } = useModalContext();
|
|
28
24
|
const resolvedAriaLabel = ariaLabel ?? (!props.title ? (props.debugName ?? 'Dialog') : undefined);
|
|
29
|
-
return ((
|
|
25
|
+
return (_jsx(RACModal, { css: styles.box, children: _jsx(Dialog, { "aria-label": resolvedAriaLabel, children: children }) }));
|
|
30
26
|
};
|
|
31
|
-
exports.ModalBox = ModalBox;
|
|
32
27
|
/**
|
|
33
28
|
* Renders the modal title, description, and optional close button; returns `null` when none of those are present.
|
|
34
29
|
* Props passed directly override values inherited from `Modal.Provider` context.
|
|
35
30
|
* Uses: `Text`, `View`
|
|
36
31
|
*/
|
|
37
|
-
const ModalHeader = ({ title, description, showClose, renderClose } = {}) => {
|
|
38
|
-
const { styles, close, props: ctxProps } =
|
|
32
|
+
export const ModalHeader = ({ title, description, showClose, renderClose } = {}) => {
|
|
33
|
+
const { styles, close, props: ctxProps } = useModalContext();
|
|
39
34
|
const resolvedTitle = title ?? ctxProps.title;
|
|
40
35
|
const resolvedDescription = description ?? ctxProps.description;
|
|
41
36
|
const resolvedShowClose = showClose ?? ctxProps.showClose;
|
|
42
37
|
const resolvedRenderClose = renderClose ?? ctxProps.renderClose;
|
|
43
|
-
const showCloseButton = resolvedShowClose !== false &&
|
|
38
|
+
const showCloseButton = resolvedShowClose !== false && TypeGuards.isFunction(resolvedRenderClose);
|
|
44
39
|
const hasHeader = !!resolvedTitle || !!resolvedDescription || showCloseButton;
|
|
45
40
|
if (!hasHeader)
|
|
46
41
|
return null;
|
|
47
|
-
const titleElement =
|
|
48
|
-
return ((
|
|
42
|
+
const titleElement = TypeGuards.isString(resolvedTitle) ? (_jsx(Text, { component: Heading, text: resolvedTitle, slot: 'title', css: styles.title })) : (resolvedTitle ?? null);
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsxs(View, { component: 'header', style: styles.header, children: [titleElement, resolvedRenderClose?.({ close }) ?? null] }), resolvedDescription && (TypeGuards.isString(resolvedDescription) ? (_jsx(Text, { text: resolvedDescription, style: styles.description })) : resolvedDescription)] }));
|
|
49
44
|
};
|
|
50
|
-
exports.ModalHeader = ModalHeader;
|
|
51
45
|
/**
|
|
52
46
|
* Scrollable content area of the modal.
|
|
53
47
|
* Must be rendered inside `Modal.Provider`.
|
|
54
48
|
* Uses: `View`
|
|
55
49
|
*/
|
|
56
|
-
const ModalBody = ({ children }) => {
|
|
57
|
-
const { styles } =
|
|
58
|
-
return (
|
|
50
|
+
export const ModalBody = ({ children }) => {
|
|
51
|
+
const { styles } = useModalContext();
|
|
52
|
+
return _jsx(View, { style: styles.body, children: children });
|
|
59
53
|
};
|
|
60
|
-
exports.ModalBody = ModalBody;
|
|
61
54
|
/**
|
|
62
55
|
* Sticky action area rendered below `Modal.Body`; falls back to the `footer` prop from context when no `children` are supplied.
|
|
63
56
|
* Returns `null` when no content is available.
|
|
64
57
|
* Uses: `View`
|
|
65
58
|
*/
|
|
66
|
-
const ModalFooter = ({ children }) => {
|
|
67
|
-
const { styles, props } =
|
|
59
|
+
export const ModalFooter = ({ children }) => {
|
|
60
|
+
const { styles, props } = useModalContext();
|
|
68
61
|
const content = children ?? props.footer;
|
|
69
62
|
if (!content)
|
|
70
63
|
return null;
|
|
71
|
-
return (
|
|
64
|
+
return _jsx(View, { component: 'footer', style: styles.footer, children: content });
|
|
72
65
|
};
|
|
73
|
-
exports.ModalFooter = ModalFooter;
|
|
74
66
|
//# sourceMappingURL=elements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/components/Modal/elements.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/components/Modal/elements.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,52 +1,34 @@
|
|
|
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.Modal = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
-
const context_1 = require("./context");
|
|
20
|
-
const elements_1 = require("./elements");
|
|
21
|
-
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
22
|
-
__exportStar(require("./styles"), exports);
|
|
23
|
-
__exportStar(require("./types"), exports);
|
|
24
|
-
__exportStar(require("./context"), exports);
|
|
25
|
-
__exportStar(require("./elements"), exports);
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { ModalProvider } from './context';
|
|
3
|
+
import { ModalBackdrop, ModalBox, ModalHeader, ModalBody, ModalFooter, } from './elements';
|
|
4
|
+
import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
|
|
5
|
+
export * from './styles';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export * from './context';
|
|
8
|
+
export * from './elements';
|
|
26
9
|
/**
|
|
27
10
|
* Accessible dialog that blocks page interaction while open, with backdrop-click and Escape-key dismissal.
|
|
28
11
|
* Controlled via `visible` / `toggle`; defaults to `closable`, `dismissOnBackdrop`, and `closeOnEscape` all `true`.
|
|
29
12
|
* Uses: `Modal.Provider`, `Modal.Backdrop`, `Modal.Box`, `Modal.Header`, `Modal.Body`, `Modal.Footer`
|
|
30
13
|
*/
|
|
31
|
-
const Modal = (props) => {
|
|
32
|
-
const { children, ...providerProps } = { ...
|
|
33
|
-
return ((
|
|
14
|
+
export const Modal = (props) => {
|
|
15
|
+
const { children, ...providerProps } = { ...Modal.defaultProps, ...props };
|
|
16
|
+
return (_jsx(ModalProvider, { ...providerProps, children: _jsx(ModalBackdrop, { children: _jsxs(ModalBox, { children: [_jsx(ModalHeader, {}), _jsx(ModalBody, { children: children }), _jsx(ModalFooter, {})] }) }) }));
|
|
34
17
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
exports.Modal.defaultProps = {
|
|
18
|
+
Modal.Provider = ModalProvider;
|
|
19
|
+
Modal.Backdrop = ModalBackdrop;
|
|
20
|
+
Modal.Box = ModalBox;
|
|
21
|
+
Modal.Header = ModalHeader;
|
|
22
|
+
Modal.Body = ModalBody;
|
|
23
|
+
Modal.Footer = ModalFooter;
|
|
24
|
+
Modal.styleRegistryName = 'Modal';
|
|
25
|
+
Modal.elements = ['backdrop', 'box', 'header', 'body', 'footer', 'title', 'description'];
|
|
26
|
+
Modal.rootElement = 'backdrop';
|
|
27
|
+
Modal.defaultProps = {
|
|
46
28
|
closable: true,
|
|
47
29
|
showClose: true,
|
|
48
30
|
dismissOnBackdrop: true,
|
|
49
31
|
closeOnEscape: true,
|
|
50
32
|
};
|
|
51
|
-
|
|
33
|
+
WebStyleRegistry.registerComponent(Modal);
|
|
52
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EACL,aAAa,EACb,QAAQ,EACR,WAAW,EACX,SAAS,EACT,WAAW,GACZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE7D,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAE1B;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAiB,EAAE,EAAE;IACzC,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,YAAY,EAAE,GAAG,KAAK,EAAE,CAAA;IAE1E,OAAO,CACL,KAAC,aAAa,OAAK,aAAa,YAC9B,KAAC,aAAa,cACZ,MAAC,QAAQ,eACP,KAAC,WAAW,KAAG,EACf,KAAC,SAAS,cAAE,QAAQ,GAAa,EACjC,KAAC,WAAW,KAAG,IACN,GACG,GACF,CACjB,CAAA;AACH,CAAC,CAAA;AAED,KAAK,CAAC,QAAQ,GAAG,aAAa,CAAA;AAC9B,KAAK,CAAC,QAAQ,GAAG,aAAa,CAAA;AAC9B,KAAK,CAAC,GAAG,GAAG,QAAQ,CAAA;AACpB,KAAK,CAAC,MAAM,GAAG,WAAW,CAAA;AAC1B,KAAK,CAAC,IAAI,GAAG,SAAS,CAAA;AACtB,KAAK,CAAC,MAAM,GAAG,WAAW,CAAA;AAE1B,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAA;AACjC,KAAK,CAAC,QAAQ,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,CAAA;AACxF,KAAK,CAAC,WAAW,GAAG,UAAU,CAAA;AAE9B,KAAK,CAAC,YAAY,GAAG;IACnB,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,iBAAiB,EAAE,IAAI;IACvB,aAAa,EAAE,IAAI;CACG,CAAA;AAExB,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -1,74 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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.NumberIncrement = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
-
const types_1 = require("@codeleap/types");
|
|
20
|
-
const react_number_format_1 = require("react-number-format");
|
|
21
|
-
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
22
|
-
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
23
|
-
const useNumberIncrement_1 = require("./useNumberIncrement");
|
|
24
|
-
const Field_1 = require("../Field");
|
|
25
|
-
const lib_1 = require("../../lib");
|
|
26
|
-
const Icon_1 = require("../Icon");
|
|
27
|
-
__exportStar(require("./types"), exports);
|
|
28
|
-
__exportStar(require("./styles"), exports);
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { TypeGuards } from '@codeleap/types';
|
|
3
|
+
import { PatternFormat, NumericFormat, NumberFormatBase } from 'react-number-format';
|
|
4
|
+
import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
|
|
5
|
+
import { useStylesFor } from '../../lib/hooks/useStylesFor';
|
|
6
|
+
import { useNumberIncrement } from './useNumberIncrement';
|
|
7
|
+
import { Field } from '../Field';
|
|
8
|
+
import { toDataAttrs } from '../../lib';
|
|
9
|
+
import { Icon } from '../Icon';
|
|
10
|
+
export * from './types';
|
|
11
|
+
export * from './styles';
|
|
29
12
|
/**
|
|
30
13
|
* Numeric stepper field with `Icon`-driven increment/decrement buttons, optional direct keyboard entry, and `Field` layout (label, helper, left/right sections).
|
|
31
14
|
* Arrow-left/right keyboard events increment or decrement the value while the field is focused; clicking outside closes focus.
|
|
32
15
|
* Uses: `Field.Provider`, `Field.Wrapper`, `Field.Box`, `Field.Heading`, `Field.Helper`, `Field.SectionSlot`, `Icon`, `useNumberIncrement`
|
|
33
16
|
*/
|
|
34
|
-
const NumberIncrement = (props) => {
|
|
17
|
+
export const NumberIncrement = (props) => {
|
|
35
18
|
const allProps = {
|
|
36
|
-
...
|
|
19
|
+
...NumberIncrement.defaultProps,
|
|
37
20
|
...props,
|
|
38
21
|
};
|
|
39
22
|
const { style, disabled, editable, hasSeparator, format, mask, suffix, separator, prefix, formatter, placeholder, label, helper, } = allProps;
|
|
40
|
-
const { isFocused, hasError, hasValue, errorMessage, incrementDisabled, decrementDisabled, innerInputRef, innerWrapperRef, wrapperRef, handleBlur, handleFocus, handleChange, handleChangeInput, onPressInnerWrapper, inputValue, } =
|
|
23
|
+
const { isFocused, hasError, hasValue, errorMessage, incrementDisabled, decrementDisabled, innerInputRef, innerWrapperRef, wrapperRef, handleBlur, handleFocus, handleChange, handleChangeInput, onPressInnerWrapper, inputValue, } = useNumberIncrement(allProps);
|
|
41
24
|
const fieldContext = {
|
|
42
25
|
disabled: !!disabled,
|
|
43
26
|
hasValue: !!hasValue,
|
|
44
27
|
error: !!hasError,
|
|
45
28
|
focused: !!isFocused,
|
|
46
29
|
};
|
|
47
|
-
const styles =
|
|
48
|
-
const stateAttrs =
|
|
49
|
-
const InputFormat =
|
|
50
|
-
?
|
|
51
|
-
:
|
|
52
|
-
const shouldUseBaseInput =
|
|
30
|
+
const styles = useStylesFor(NumberIncrement.styleRegistryName, style, fieldContext);
|
|
31
|
+
const stateAttrs = toDataAttrs({ disabled: !!disabled, error: !!hasError, focused: !!isFocused });
|
|
32
|
+
const InputFormat = TypeGuards.isString(format) || TypeGuards.isString(mask)
|
|
33
|
+
? PatternFormat
|
|
34
|
+
: NumericFormat;
|
|
35
|
+
const shouldUseBaseInput = TypeGuards.isFunction(formatter);
|
|
53
36
|
const Input = shouldUseBaseInput
|
|
54
|
-
?
|
|
37
|
+
? NumberFormatBase
|
|
55
38
|
: InputFormat;
|
|
56
39
|
const thousandProps = !shouldUseBaseInput ? {
|
|
57
40
|
thousandSeparator: separator,
|
|
58
|
-
thousandsGroupStyle: hasSeparator ||
|
|
41
|
+
thousandsGroupStyle: hasSeparator || TypeGuards.isString(separator) ? 'thousand' : 'none',
|
|
59
42
|
} : {};
|
|
60
|
-
return ((
|
|
43
|
+
return (_jsx(Field.Provider, { context: fieldContext, label: label, helper: hasError ? errorMessage : helper, componentName: 'number_increment', leftSection: _jsx(Icon, { icon: 'minus', onPress: () => handleChange('decrement'), disabled: disabled || decrementDisabled, style: styles.leftSection }), rightSection: _jsx(Icon, { icon: 'plus', onPress: () => handleChange('increment'), disabled: disabled || incrementDisabled, style: styles.rightSection }), children: _jsxs(Field.Wrapper, { ref: wrapperRef, style: styles.wrapper, children: [_jsx(Field.Heading, { style: styles.heading }), _jsxs(Field.Box, { ref: innerWrapperRef, style: [styles.box, editable ? styles['box:cursor'] : undefined], onClick: onPressInnerWrapper, ...stateAttrs, children: [_jsx(Field.SectionSlot, { position: 'left' }), _jsx(Input, { displayType: 'input', css: [
|
|
61
44
|
styles.input,
|
|
62
45
|
{
|
|
63
46
|
'&:focus': { outline: 'none', borderWidth: 0, borderColor: 'transparent' },
|
|
64
47
|
},
|
|
65
|
-
], inputMode: 'numeric', onValueChange: handleChangeInput, onBlur: handleBlur, onFocus: handleFocus, value: inputValue, ...thousandProps, suffix: suffix, prefix: prefix, format:
|
|
48
|
+
], inputMode: 'numeric', onValueChange: handleChangeInput, onBlur: handleBlur, onFocus: handleFocus, value: inputValue, ...thousandProps, suffix: suffix, prefix: prefix, format: TypeGuards.isFunction(formatter) ? formatter : format, mask: mask, placeholder: placeholder, getInputRef: innerInputRef, disabled: disabled }), _jsx(Field.SectionSlot, { position: 'right' })] }), _jsx(Field.Helper, { style: styles.helper })] }) }));
|
|
66
49
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
exports.NumberIncrement.defaultProps = {
|
|
50
|
+
NumberIncrement.styleRegistryName = 'NumberIncrement';
|
|
51
|
+
NumberIncrement.elements = [...Field.elements, 'input', 'placeholder'];
|
|
52
|
+
NumberIncrement.rootElement = 'wrapper';
|
|
53
|
+
NumberIncrement.defaultProps = {
|
|
72
54
|
max: 1000000000,
|
|
73
55
|
min: 0,
|
|
74
56
|
step: 1,
|
|
@@ -79,5 +61,5 @@ exports.NumberIncrement.defaultProps = {
|
|
|
79
61
|
format: null,
|
|
80
62
|
formatter: null,
|
|
81
63
|
};
|
|
82
|
-
|
|
64
|
+
WebStyleRegistry.registerComponent(NumberIncrement);
|
|
83
65
|
//# sourceMappingURL=index.js.map
|