@codeleap/web 7.0.0 → 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 +46 -0
- package/dist/components/ActivityIndicator/index.js.map +1 -0
- package/dist/components/ActivityIndicator/styles.js +3 -0
- package/dist/components/ActivityIndicator/styles.js.map +1 -0
- package/dist/components/ActivityIndicator/types.js +3 -0
- package/dist/components/ActivityIndicator/types.js.map +1 -0
- package/dist/components/Badge/index.js +86 -0
- package/dist/components/Badge/index.js.map +1 -0
- package/dist/components/Badge/styles.js +3 -0
- package/dist/components/Badge/styles.js.map +1 -0
- package/dist/components/Badge/types.js +3 -0
- package/dist/components/Badge/types.js.map +1 -0
- package/dist/components/Button/index.js +69 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Button/styles.js +3 -0
- package/dist/components/Button/styles.js.map +1 -0
- package/dist/components/Button/types.js +3 -0
- package/dist/components/Button/types.js.map +1 -0
- package/dist/components/Calendar/index.js +67 -0
- package/dist/components/Calendar/index.js.map +1 -0
- package/dist/components/Calendar/styles.js +3 -0
- package/dist/components/Calendar/styles.js.map +1 -0
- package/dist/components/Calendar/types.js +3 -0
- package/dist/components/Calendar/types.js.map +1 -0
- package/dist/components/Carousel/index.js +171 -0
- package/dist/components/Carousel/index.js.map +1 -0
- package/dist/components/Carousel/styles.js +3 -0
- package/dist/components/Carousel/styles.js.map +1 -0
- package/dist/components/Carousel/types.js +3 -0
- package/dist/components/Carousel/types.js.map +1 -0
- package/dist/components/Checkbox/index.js +62 -0
- package/dist/components/Checkbox/index.js.map +1 -0
- package/dist/components/Checkbox/styles.js +3 -0
- package/dist/components/Checkbox/styles.js.map +1 -0
- package/dist/components/Checkbox/types.js +3 -0
- package/dist/components/Checkbox/types.js.map +1 -0
- package/dist/components/Collapse/index.js +45 -0
- package/dist/components/Collapse/index.js.map +1 -0
- package/dist/components/Collapse/styles.js +3 -0
- package/dist/components/Collapse/styles.js.map +1 -0
- package/dist/components/Collapse/types.js +3 -0
- package/dist/components/Collapse/types.js.map +1 -0
- package/dist/components/ColorPicker/index.js +83 -0
- package/dist/components/ColorPicker/index.js.map +1 -0
- package/dist/components/ColorPicker/styles.js +3 -0
- package/dist/components/ColorPicker/styles.js.map +1 -0
- package/dist/components/ColorPicker/types.js +3 -0
- package/dist/components/ColorPicker/types.js.map +1 -0
- package/dist/components/CropPicker/hooks.d.ts +2 -2
- package/dist/components/CropPicker/hooks.js +133 -0
- package/dist/components/CropPicker/hooks.js.map +1 -0
- package/dist/components/CropPicker/index.js +56 -0
- package/dist/components/CropPicker/index.js.map +1 -0
- package/dist/components/CropPicker/styles.js +3 -0
- package/dist/components/CropPicker/styles.js.map +1 -0
- package/dist/components/CropPicker/types.js +3 -0
- package/dist/components/CropPicker/types.js.map +1 -0
- package/dist/components/CropPicker/utils.js +76 -0
- package/dist/components/CropPicker/utils.js.map +1 -0
- package/dist/components/DatePicker/index.js +87 -0
- package/dist/components/DatePicker/index.js.map +1 -0
- package/dist/components/DatePicker/styles.js +3 -0
- package/dist/components/DatePicker/styles.js.map +1 -0
- package/dist/components/DatePicker/types.js +3 -0
- package/dist/components/DatePicker/types.js.map +1 -0
- package/dist/components/Drawer/index.js +68 -0
- package/dist/components/Drawer/index.js.map +1 -0
- package/dist/components/Drawer/styles.js +3 -0
- package/dist/components/Drawer/styles.js.map +1 -0
- package/dist/components/Drawer/types.js +3 -0
- package/dist/components/Drawer/types.js.map +1 -0
- package/dist/components/Dropzone/context.js +44 -0
- package/dist/components/Dropzone/context.js.map +1 -0
- package/dist/components/Dropzone/elements.js +57 -0
- package/dist/components/Dropzone/elements.js.map +1 -0
- package/dist/components/Dropzone/index.js +89 -0
- package/dist/components/Dropzone/index.js.map +1 -0
- package/dist/components/Dropzone/styles.js +3 -0
- package/dist/components/Dropzone/styles.js.map +1 -0
- package/dist/components/Dropzone/types.js +3 -0
- package/dist/components/Dropzone/types.js.map +1 -0
- package/dist/components/Dropzone/useDropzone.js +20 -0
- package/dist/components/Dropzone/useDropzone.js.map +1 -0
- package/dist/components/EmptyPlaceholder/index.js +86 -0
- package/dist/components/EmptyPlaceholder/index.js.map +1 -0
- package/dist/components/EmptyPlaceholder/styles.js +3 -0
- package/dist/components/EmptyPlaceholder/styles.js.map +1 -0
- package/dist/components/EmptyPlaceholder/types.js +3 -0
- package/dist/components/EmptyPlaceholder/types.js.map +1 -0
- package/dist/components/Field/context.js +58 -0
- package/dist/components/Field/context.js.map +1 -0
- package/dist/components/Field/elements.js +92 -0
- package/dist/components/Field/elements.js.map +1 -0
- package/dist/components/Field/index.js +55 -0
- package/dist/components/Field/index.js.map +1 -0
- package/dist/components/Field/styles.js +3 -0
- package/dist/components/Field/styles.js.map +1 -0
- package/dist/components/Field/types.js +3 -0
- package/dist/components/Field/types.js.map +1 -0
- package/dist/components/Field/useFieldInput.d.ts +1 -1
- package/dist/components/Field/useFieldInput.js +50 -0
- package/dist/components/Field/useFieldInput.js.map +1 -0
- package/dist/components/FileInput/index.js +73 -0
- package/dist/components/FileInput/index.js.map +1 -0
- package/dist/components/FileInput/types.js +3 -0
- package/dist/components/FileInput/types.js.map +1 -0
- package/dist/components/Icon/index.js +69 -0
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/Icon/styles.js +3 -0
- package/dist/components/Icon/styles.js.map +1 -0
- package/dist/components/Icon/types.js +3 -0
- package/dist/components/Icon/types.js.map +1 -0
- package/dist/components/List/context.js +81 -0
- package/dist/components/List/context.js.map +1 -0
- package/dist/components/List/elements.js +164 -0
- package/dist/components/List/elements.js.map +1 -0
- package/dist/components/List/index.js +52 -0
- package/dist/components/List/index.js.map +1 -0
- package/dist/components/List/scroll.js +80 -0
- package/dist/components/List/scroll.js.map +1 -0
- package/dist/components/List/styles.js +3 -0
- package/dist/components/List/styles.js.map +1 -0
- package/dist/components/List/types.js +3 -0
- package/dist/components/List/types.js.map +1 -0
- package/dist/components/LoadingOverlay/index.js +50 -0
- package/dist/components/LoadingOverlay/index.js.map +1 -0
- package/dist/components/LoadingOverlay/styles.js +3 -0
- package/dist/components/LoadingOverlay/styles.js.map +1 -0
- package/dist/components/LoadingOverlay/types.js +3 -0
- package/dist/components/LoadingOverlay/types.js.map +1 -0
- package/dist/components/MaskedTextInput/index.js +52 -0
- package/dist/components/MaskedTextInput/index.js.map +1 -0
- package/dist/components/MaskedTextInput/mask.js +37 -0
- package/dist/components/MaskedTextInput/mask.js.map +1 -0
- package/dist/components/MaskedTextInput/types.js +3 -0
- package/dist/components/MaskedTextInput/types.js.map +1 -0
- package/dist/components/Modal/context.js +41 -0
- package/dist/components/Modal/context.js.map +1 -0
- package/dist/components/Modal/elements.js +74 -0
- package/dist/components/Modal/elements.js.map +1 -0
- package/dist/components/Modal/index.js +52 -0
- package/dist/components/Modal/index.js.map +1 -0
- package/dist/components/Modal/styles.js +3 -0
- package/dist/components/Modal/styles.js.map +1 -0
- package/dist/components/Modal/types.js +3 -0
- package/dist/components/Modal/types.js.map +1 -0
- package/dist/components/NumberIncrement/index.js +83 -0
- package/dist/components/NumberIncrement/index.js.map +1 -0
- package/dist/components/NumberIncrement/styles.js +3 -0
- package/dist/components/NumberIncrement/styles.js.map +1 -0
- package/dist/components/NumberIncrement/types.js +3 -0
- package/dist/components/NumberIncrement/types.js.map +1 -0
- package/dist/components/NumberIncrement/useNumberIncrement.js +116 -0
- package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -0
- package/dist/components/Overlay/index.js +62 -0
- package/dist/components/Overlay/index.js.map +1 -0
- package/dist/components/Overlay/styles.js +3 -0
- package/dist/components/Overlay/styles.js.map +1 -0
- package/dist/components/Overlay/types.js +3 -0
- package/dist/components/Overlay/types.js.map +1 -0
- package/dist/components/PaginationButtons/index.js +118 -0
- package/dist/components/PaginationButtons/index.js.map +1 -0
- package/dist/components/PaginationButtons/styles.js +3 -0
- package/dist/components/PaginationButtons/styles.js.map +1 -0
- package/dist/components/PaginationButtons/types.js +3 -0
- package/dist/components/PaginationButtons/types.js.map +1 -0
- package/dist/components/PaginationIndicator/index.js +59 -0
- package/dist/components/PaginationIndicator/index.js.map +1 -0
- package/dist/components/PaginationIndicator/styles.js +3 -0
- package/dist/components/PaginationIndicator/styles.js.map +1 -0
- package/dist/components/PaginationIndicator/types.js +3 -0
- package/dist/components/PaginationIndicator/types.js.map +1 -0
- package/dist/components/Progress/Bar/Segmented.js +41 -0
- package/dist/components/Progress/Bar/Segmented.js.map +1 -0
- package/dist/components/Progress/Bar/index.js +62 -0
- package/dist/components/Progress/Bar/index.js.map +1 -0
- package/dist/components/Progress/Bar/styles.js +3 -0
- package/dist/components/Progress/Bar/styles.js.map +1 -0
- package/dist/components/Progress/Bar/types.js +3 -0
- package/dist/components/Progress/Bar/types.js.map +1 -0
- package/dist/components/Progress/Circle/Segmented.js +64 -0
- package/dist/components/Progress/Circle/Segmented.js.map +1 -0
- package/dist/components/Progress/Circle/index.js +83 -0
- package/dist/components/Progress/Circle/index.js.map +1 -0
- package/dist/components/Progress/Circle/styles.js +3 -0
- package/dist/components/Progress/Circle/styles.js.map +1 -0
- package/dist/components/Progress/Circle/types.js +3 -0
- package/dist/components/Progress/Circle/types.js.map +1 -0
- package/dist/components/Progress/index.js +19 -0
- package/dist/components/Progress/index.js.map +1 -0
- package/dist/components/Progress/utils.js +7 -0
- package/dist/components/Progress/utils.js.map +1 -0
- package/dist/components/RadioInput/index.js +68 -0
- package/dist/components/RadioInput/index.js.map +1 -0
- package/dist/components/RadioInput/styles.js +3 -0
- package/dist/components/RadioInput/styles.js.map +1 -0
- package/dist/components/RadioInput/types.js +3 -0
- package/dist/components/RadioInput/types.js.map +1 -0
- package/dist/components/SearchInput/index.js +98 -0
- package/dist/components/SearchInput/index.js.map +1 -0
- package/dist/components/SectionFilters/index.js +166 -0
- package/dist/components/SectionFilters/index.js.map +1 -0
- package/dist/components/SectionFilters/styles.js +3 -0
- package/dist/components/SectionFilters/styles.js.map +1 -0
- package/dist/components/SectionFilters/types.js +3 -0
- package/dist/components/SectionFilters/types.js.map +1 -0
- package/dist/components/Select/context.js +162 -0
- package/dist/components/Select/context.js.map +1 -0
- package/dist/components/Select/elements.js +53 -0
- package/dist/components/Select/elements.js.map +1 -0
- package/dist/components/Select/index.js +70 -0
- package/dist/components/Select/index.js.map +1 -0
- package/dist/components/Select/styles.js +3 -0
- package/dist/components/Select/styles.js.map +1 -0
- package/dist/components/Select/types.js +3 -0
- package/dist/components/Select/types.js.map +1 -0
- package/dist/components/Select/useTriggerWidth.js +30 -0
- package/dist/components/Select/useTriggerWidth.js.map +1 -0
- package/dist/components/Slider/index.js +160 -0
- package/dist/components/Slider/index.js.map +1 -0
- package/dist/components/Slider/styles.js +3 -0
- package/dist/components/Slider/styles.js.map +1 -0
- package/dist/components/Slider/types.js +3 -0
- package/dist/components/Slider/types.js.map +1 -0
- package/dist/components/Switch/index.js +66 -0
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/Switch/styles.js +3 -0
- package/dist/components/Switch/styles.js.map +1 -0
- package/dist/components/Switch/types.js +3 -0
- package/dist/components/Switch/types.js.map +1 -0
- package/dist/components/Tag/index.js +74 -0
- package/dist/components/Tag/index.js.map +1 -0
- package/dist/components/Tag/styles.js +3 -0
- package/dist/components/Tag/styles.js.map +1 -0
- package/dist/components/Tag/types.js +3 -0
- package/dist/components/Tag/types.js.map +1 -0
- package/dist/components/Text/index.js +115 -0
- package/dist/components/Text/index.js.map +1 -0
- package/dist/components/Text/styles.js +3 -0
- package/dist/components/Text/styles.js.map +1 -0
- package/dist/components/Text/types.js +3 -0
- package/dist/components/Text/types.js.map +1 -0
- package/dist/components/TextEditor/index.js +111 -0
- package/dist/components/TextEditor/index.js.map +1 -0
- package/dist/components/TextEditor/styles.js +3 -0
- package/dist/components/TextEditor/styles.js.map +1 -0
- package/dist/components/TextEditor/types.js +3 -0
- package/dist/components/TextEditor/types.js.map +1 -0
- package/dist/components/TextInput/index.js +86 -0
- package/dist/components/TextInput/index.js.map +1 -0
- package/dist/components/TextInput/styles.js +3 -0
- package/dist/components/TextInput/styles.js.map +1 -0
- package/dist/components/TextInput/types.js +3 -0
- package/dist/components/TextInput/types.js.map +1 -0
- package/dist/components/TextInput/useTextInput.d.ts +2 -2
- package/dist/components/TextInput/useTextInput.js +67 -0
- package/dist/components/TextInput/useTextInput.js.map +1 -0
- package/dist/components/Tooltip/index.js +115 -0
- package/dist/components/Tooltip/index.js.map +1 -0
- package/dist/components/Tooltip/styles.js +3 -0
- package/dist/components/Tooltip/styles.js.map +1 -0
- package/dist/components/Tooltip/types.js +3 -0
- package/dist/components/Tooltip/types.js.map +1 -0
- package/dist/components/Touchable/index.js +100 -0
- package/dist/components/Touchable/index.js.map +1 -0
- package/dist/components/Touchable/styles.js +3 -0
- package/dist/components/Touchable/styles.js.map +1 -0
- package/dist/components/Touchable/types.js +3 -0
- package/dist/components/Touchable/types.js.map +1 -0
- package/dist/components/View/index.js +56 -0
- package/dist/components/View/index.js.map +1 -0
- package/dist/components/View/styles.js +3 -0
- package/dist/components/View/styles.js.map +1 -0
- package/dist/components/View/types.js +3 -0
- package/dist/components/View/types.js.map +1 -0
- package/dist/components/components.js +58 -0
- package/dist/components/components.js.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/ListMasonry.js +95 -0
- package/dist/lib/ListMasonry.js.map +1 -0
- package/dist/lib/ThemeVariables.js +27 -0
- package/dist/lib/ThemeVariables.js.map +1 -0
- package/dist/lib/WebStyleRegistry.js +73 -0
- package/dist/lib/WebStyleRegistry.js.map +1 -0
- package/dist/lib/hooks/index.js +39 -0
- package/dist/lib/hooks/index.js.map +1 -0
- package/dist/lib/hooks/useAnimatedStyle.js +27 -0
- package/dist/lib/hooks/useAnimatedStyle.js.map +1 -0
- package/dist/lib/hooks/useAnimatedVariantStyles.js +23 -0
- package/dist/lib/hooks/useAnimatedVariantStyles.js.map +1 -0
- package/dist/lib/hooks/useAsyncSelect.js +60 -0
- package/dist/lib/hooks/useAsyncSelect.js.map +1 -0
- package/dist/lib/hooks/useBreakpointMatch.js +111 -0
- package/dist/lib/hooks/useBreakpointMatch.js.map +1 -0
- package/dist/lib/hooks/useClick.js +41 -0
- package/dist/lib/hooks/useClick.js.map +1 -0
- package/dist/lib/hooks/useClickOutside.js +34 -0
- package/dist/lib/hooks/useClickOutside.js.map +1 -0
- package/dist/lib/hooks/useFileInput.js +21 -0
- package/dist/lib/hooks/useFileInput.js.map +1 -0
- package/dist/lib/hooks/useIsomorphicEffect.js +10 -0
- package/dist/lib/hooks/useIsomorphicEffect.js.map +1 -0
- package/dist/lib/hooks/useKeydown.js +43 -0
- package/dist/lib/hooks/useKeydown.js.map +1 -0
- package/dist/lib/hooks/useListFocus.js +49 -0
- package/dist/lib/hooks/useListFocus.js.map +1 -0
- package/dist/lib/hooks/useMediaQuery.js +28 -0
- package/dist/lib/hooks/useMediaQuery.js.map +1 -0
- package/dist/lib/hooks/usePageExitBlocker.js +48 -0
- package/dist/lib/hooks/usePageExitBlocker.js.map +1 -0
- package/dist/lib/hooks/usePagination.js +93 -0
- package/dist/lib/hooks/usePagination.js.map +1 -0
- package/dist/lib/hooks/usePopState.js +35 -0
- package/dist/lib/hooks/usePopState.js.map +1 -0
- package/dist/lib/hooks/usePopoverDismiss.js +35 -0
- package/dist/lib/hooks/usePopoverDismiss.js.map +1 -0
- package/dist/lib/hooks/useRefresh.js +74 -0
- package/dist/lib/hooks/useRefresh.js.map +1 -0
- package/dist/lib/hooks/useScrollEffect.js +22 -0
- package/dist/lib/hooks/useScrollEffect.js.map +1 -0
- package/dist/lib/hooks/useSearchParams.js +51 -0
- package/dist/lib/hooks/useSearchParams.js.map +1 -0
- package/dist/lib/hooks/useStaticAnimationStyles.js +19 -0
- package/dist/lib/hooks/useStaticAnimationStyles.js.map +1 -0
- package/dist/lib/hooks/useStylesFor.js +40 -0
- package/dist/lib/hooks/useStylesFor.js.map +1 -0
- package/dist/lib/hooks/useTouchableEvents.js +37 -0
- package/dist/lib/hooks/useTouchableEvents.js.map +1 -0
- package/dist/lib/hooks/useWindowFocus.js +34 -0
- package/dist/lib/hooks/useWindowFocus.js.map +1 -0
- package/dist/lib/hooks/useWindowSize.js +32 -0
- package/dist/lib/hooks/useWindowSize.js.map +1 -0
- package/dist/lib/index.js +23 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/tools/index.js +20 -0
- package/dist/lib/tools/index.js.map +1 -0
- package/dist/lib/tools/localStorage.js +159 -0
- package/dist/lib/tools/localStorage.js.map +1 -0
- package/dist/lib/tools/mediaQuery.js +38 -0
- package/dist/lib/tools/mediaQuery.js.map +1 -0
- package/dist/lib/tools/modal.js +60 -0
- package/dist/lib/tools/modal.js.map +1 -0
- package/dist/lib/utils/attributes.js +26 -0
- package/dist/lib/utils/attributes.js.map +1 -0
- package/dist/lib/utils/cache.d.ts +2 -2
- package/dist/lib/utils/cache.js +17 -0
- package/dist/lib/utils/cache.js.map +1 -0
- package/dist/lib/utils/index.js +22 -0
- package/dist/lib/utils/index.js.map +1 -0
- package/dist/lib/utils/pollyfils/scroll.js +70 -0
- package/dist/lib/utils/pollyfils/scroll.js.map +1 -0
- package/dist/lib/utils/stopPropagation.js +22 -0
- package/dist/lib/utils/stopPropagation.js.map +1 -0
- package/dist/lib/utils/test.js +18 -0
- package/dist/lib/utils/test.js.map +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/utility.js +3 -0
- package/dist/types/utility.js.map +1 -0
- package/package.json +18 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/DatePicker/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,68 @@
|
|
|
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.Drawer = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
+
const react_aria_components_1 = require("react-aria-components");
|
|
20
|
+
const context_1 = require("../Modal/context");
|
|
21
|
+
const elements_1 = require("../Modal/elements");
|
|
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);
|
|
26
|
+
const DrawerProvider = ({ children, position: _position, ...props }) => {
|
|
27
|
+
const styles = (0, useStylesFor_1.useStylesFor)(exports.Drawer.styleRegistryName, props.style);
|
|
28
|
+
const close = () => {
|
|
29
|
+
props.toggle?.();
|
|
30
|
+
props.onClose?.();
|
|
31
|
+
};
|
|
32
|
+
const value = {
|
|
33
|
+
props,
|
|
34
|
+
styles: styles,
|
|
35
|
+
close,
|
|
36
|
+
};
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(context_1.ModalContext.Provider, { value: value, children: children }));
|
|
38
|
+
};
|
|
39
|
+
const DrawerBox = ({ children, position }) => {
|
|
40
|
+
const { styles, props } = (0, context_1.useModalContext)();
|
|
41
|
+
const resolvedAriaLabel = !props.title ? (props.debugName ?? 'Dialog') : undefined;
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.Modal, { css: styles.box, "data-position": position, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Dialog, { "aria-label": resolvedAriaLabel, children: children }) }));
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Side-panel overlay that slides in from a configurable edge of the viewport.
|
|
46
|
+
* Shares the same dismiss mechanics as `Modal` (backdrop click, Escape key), controlled by `closable` et al.
|
|
47
|
+
* Uses: `ModalBackdrop`, `ModalBody`, `ModalFooter`, `ModalHeader`
|
|
48
|
+
*/
|
|
49
|
+
const Drawer = (props) => {
|
|
50
|
+
const { children, position, ...rest } = { ...exports.Drawer.defaultProps, ...props };
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)(DrawerProvider, { ...rest, position: position, children: (0, jsx_runtime_1.jsx)(elements_1.ModalBackdrop, { children: (0, jsx_runtime_1.jsxs)(DrawerBox, { position: position, children: [(0, jsx_runtime_1.jsx)(elements_1.ModalHeader, {}), (0, jsx_runtime_1.jsx)(elements_1.ModalBody, { children: children }), (0, jsx_runtime_1.jsx)(elements_1.ModalFooter, {})] }) }) }));
|
|
52
|
+
};
|
|
53
|
+
exports.Drawer = Drawer;
|
|
54
|
+
exports.Drawer.styleRegistryName = 'Drawer';
|
|
55
|
+
exports.Drawer.elements = ['backdrop', 'box', 'header', 'body', 'footer', 'title', 'description'];
|
|
56
|
+
exports.Drawer.rootElement = 'backdrop';
|
|
57
|
+
exports.Drawer.withVariantTypes = (styles) => {
|
|
58
|
+
return exports.Drawer;
|
|
59
|
+
};
|
|
60
|
+
exports.Drawer.defaultProps = {
|
|
61
|
+
position: 'left',
|
|
62
|
+
closable: true,
|
|
63
|
+
showClose: false,
|
|
64
|
+
dismissOnBackdrop: true,
|
|
65
|
+
closeOnEscape: true,
|
|
66
|
+
};
|
|
67
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.Drawer);
|
|
68
|
+
//# sourceMapping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,CAAC,CAAA;AAED;;;;GAIG;AACI,MAAM,MAAM,GAAG,CAAC,KAAkB,EAAE,EAAE;IAC3C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,cAAM,CAAC,YAAY,EAAE,GAAG,KAAK,EAAE,CAAA;IAC5E,OAAO,CACL,uBAAC,cAAc,OAAK,IAAI,EAAE,QAAQ,EAAE,QAAQ,YAC1C,uBAAC,wBAAa,cACZ,wBAAC,SAAS,IAAC,QAAQ,EAAE,QAAQ,aAC3B,uBAAC,sBAAW,KAAG,EACf,uBAAC,oBAAS,cAAE,QAAQ,GAAa,EACjC,uBAAC,sBAAW,KAAG,IACL,GACE,GACD,CAClB,CAAA;AACH,CAAC,CAAA;AAbY,QAAA,MAAM,UAalB;AAED,cAAM,CAAC,iBAAiB,GAAG,QAAQ,CAAA;AACnC,cAAM,CAAC,QAAQ,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,CAAA;AACzF,cAAM,CAAC,WAAW,GAAG,UAAU,CAAA;AAE/B,cAAM,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC3D,OAAO,cAA2E,CAAA;AACpF,CAAC,CAAA;AAED,cAAM,CAAC,YAAY,GAAG;IACpB,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,KAAK;IAChB,iBAAiB,EAAE,IAAI;IACvB,aAAa,EAAE,IAAI;CACI,CAAA;AAEzB,mCAAgB,CAAC,iBAAiB,CAAC,cAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Drawer/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Drawer/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DropzoneProvider = exports.useDropzoneContext = exports.DropzoneContext = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
7
|
+
const useDropzone_1 = require("./useDropzone");
|
|
8
|
+
function useDropzoneProvider(props) {
|
|
9
|
+
const { handle: externalHandle, style, children: _children, extensionProps = {}, ...dropzoneOptions } = props;
|
|
10
|
+
// Always call the hook — satisfies Rules of Hooks.
|
|
11
|
+
// When an external handle is provided its result is discarded.
|
|
12
|
+
const internalHandle = (0, useDropzone_1.useDropzone)(dropzoneOptions);
|
|
13
|
+
const handle = externalHandle ?? internalHandle;
|
|
14
|
+
const styles = (0, useStylesFor_1.useStylesFor)('Dropzone', style);
|
|
15
|
+
return {
|
|
16
|
+
handle,
|
|
17
|
+
styles: styles,
|
|
18
|
+
extensionProps,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
exports.DropzoneContext = (0, react_1.createContext)(null);
|
|
22
|
+
/**
|
|
23
|
+
* Reads the nearest `Dropzone.Provider` context value.
|
|
24
|
+
* Throws if called outside a `Dropzone.Provider` tree.
|
|
25
|
+
*/
|
|
26
|
+
const useDropzoneContext = () => {
|
|
27
|
+
const ctx = (0, react_1.useContext)(exports.DropzoneContext);
|
|
28
|
+
if (!ctx)
|
|
29
|
+
throw new Error('useDropzoneContext must be used inside Dropzone.Provider');
|
|
30
|
+
return ctx;
|
|
31
|
+
};
|
|
32
|
+
exports.useDropzoneContext = useDropzoneContext;
|
|
33
|
+
/**
|
|
34
|
+
* Wires a `DropzoneHandle` and resolved styles into React context for all
|
|
35
|
+
* Dropzone sub-components. Accepts either a pre-built `handle` prop (external
|
|
36
|
+
* control) or raw `UseDropzoneOptions` to have the Provider create a handle
|
|
37
|
+
* internally.
|
|
38
|
+
*/
|
|
39
|
+
const DropzoneProvider = (props) => {
|
|
40
|
+
const value = useDropzoneProvider(props);
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(exports.DropzoneContext.Provider, { value: value, children: props.children }));
|
|
42
|
+
};
|
|
43
|
+
exports.DropzoneProvider = DropzoneProvider;
|
|
44
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/Dropzone/context.tsx"],"names":[],"mappings":";;;;AAAA,iCAAiD;AAIjD,+DAA2D;AAC3D,+CAA2C;AAE3C,SAAS,mBAAmB,CAAC,KAA4B;IACvD,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,GAAG,EAA+B,EAAE,GAAG,eAAe,EAAE,GAAG,KAAK,CAAA;IAE1I,mDAAmD;IACnD,+DAA+D;IAC/D,MAAM,cAAc,GAAG,IAAA,yBAAW,EAAC,eAAe,CAAC,CAAA;IACnD,MAAM,MAAM,GAAG,cAAc,IAAI,cAAc,CAAA;IAE/C,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAE9C,OAAO;QACL,MAAM;QACN,MAAM,EAAE,MAA0C;QAClD,cAAc;KACf,CAAA;AACH,CAAC;AAIY,QAAA,eAAe,GAAG,IAAA,qBAAa,EAA8B,IAAI,CAAC,CAAA;AAE/E;;;GAGG;AACI,MAAM,kBAAkB,GAAG,GAAyB,EAAE;IAC3D,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,uBAAe,CAAC,CAAA;IACvC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAA;IACrF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAJY,QAAA,kBAAkB,sBAI9B;AAED;;;;;GAKG;AACI,MAAM,gBAAgB,GAAG,CAAC,KAA4B,EAAE,EAAE;IAC/D,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAA;IACxC,OAAO,CACL,uBAAC,uBAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACnC,KAAK,CAAC,QAAQ,GACU,CAC5B,CAAA;AACH,CAAC,CAAA;AAPY,QAAA,gBAAgB,oBAO5B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DropzoneFullscreenOverlay = exports.DropzoneOverlay = exports.DropzoneWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const react_dom_1 = require("react-dom");
|
|
6
|
+
const View_1 = require("../View");
|
|
7
|
+
const context_1 = require("./context");
|
|
8
|
+
/**
|
|
9
|
+
* Droppable zone element. Applies `getRootProps` and `getInputProps` from the
|
|
10
|
+
* nearest `Dropzone.Provider` handle to a root `View` and a hidden `<input>`.
|
|
11
|
+
*
|
|
12
|
+
* Must be rendered inside `Dropzone.Provider`.
|
|
13
|
+
*/
|
|
14
|
+
const DropzoneWrapper = ({ children }) => {
|
|
15
|
+
const { handle, styles } = (0, context_1.useDropzoneContext)();
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(View_1.View, { ...handle.dropzone.getRootProps(), style: styles.dropzone, children: [children, (0, jsx_runtime_1.jsx)("input", { ...handle.dropzone.getInputProps() })] }));
|
|
17
|
+
};
|
|
18
|
+
exports.DropzoneWrapper = DropzoneWrapper;
|
|
19
|
+
/**
|
|
20
|
+
* Overlay rendered on top of `Dropzone.Wrapper` while a file is being dragged
|
|
21
|
+
* over this specific zone (`isDragActive`). Place it as a child of
|
|
22
|
+
* `Dropzone.Wrapper` so it inherits the wrapper's positioning context.
|
|
23
|
+
*
|
|
24
|
+
* For a page-wide overlay that activates when dragging anywhere on the
|
|
25
|
+
* document, use `Dropzone.FullscreenOverlay` instead.
|
|
26
|
+
*
|
|
27
|
+
* Must be rendered inside `Dropzone.Provider`.
|
|
28
|
+
*/
|
|
29
|
+
const DropzoneOverlay = ({ children }) => {
|
|
30
|
+
const { handle, styles } = (0, context_1.useDropzoneContext)();
|
|
31
|
+
if (!handle.dropzone.isDragActive)
|
|
32
|
+
return null;
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(View_1.View, { style: styles.overlay, children: (0, jsx_runtime_1.jsx)(View_1.View, { style: styles.overlayInner, children: children }) }));
|
|
34
|
+
};
|
|
35
|
+
exports.DropzoneOverlay = DropzoneOverlay;
|
|
36
|
+
/**
|
|
37
|
+
* Full-page overlay rendered via a React portal into `document.body` while
|
|
38
|
+
* a file is being dragged anywhere on the document (`isDragGlobal`).
|
|
39
|
+
*
|
|
40
|
+
* Unlike `Dropzone.Overlay`, this component is not scoped to the wrapper zone —
|
|
41
|
+
* it activates the moment a drag enters the browser window. Position it with
|
|
42
|
+
* `position: fixed; inset: 0` in the `overlay` style key.
|
|
43
|
+
*
|
|
44
|
+
* Must be rendered inside `Dropzone.Provider`.
|
|
45
|
+
*/
|
|
46
|
+
const DropzoneFullscreenOverlay = ({ children }) => {
|
|
47
|
+
const { handle, styles } = (0, context_1.useDropzoneContext)();
|
|
48
|
+
if (!handle.dropzone.isDragGlobal)
|
|
49
|
+
return null;
|
|
50
|
+
if (typeof document === 'undefined')
|
|
51
|
+
return null;
|
|
52
|
+
// Spread getRootProps (minus ref) so drops on the fullscreen overlay are captured by this dropzone.
|
|
53
|
+
const { ref: _ref, ...rootProps } = handle.dropzone.getRootProps();
|
|
54
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(View_1.View, { ...rootProps, style: styles.fullscreenOverlay, children: (0, jsx_runtime_1.jsx)(View_1.View, { style: styles.fullscreenOverlayInner, children: children }) }), document.body);
|
|
55
|
+
};
|
|
56
|
+
exports.DropzoneFullscreenOverlay = DropzoneFullscreenOverlay;
|
|
57
|
+
//# sourceMappingURL=elements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/components/Dropzone/elements.tsx"],"names":[],"mappings":";;;;AACA,yCAAwC;AAExC,kCAAyC;AACzC,uCAA8C;AAO9C;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAwB,EAAE,EAAE;IACpE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,4BAAkB,GAAE,CAAA;IAC/C,OAAO,CACL,wBAAC,WAAI,OAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAyB,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,aACrF,QAAQ,EACT,qCAAY,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAkC,GAAI,IAC1E,CACR,CAAA;AACH,CAAC,CAAA;AARY,QAAA,eAAe,mBAQ3B;AAED;;;;;;;;;GASG;AACI,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAwB,EAAE,EAAE;IACpE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,4BAAkB,GAAE,CAAA;IAE/C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY;QAAE,OAAO,IAAI,CAAA;IAE9C,OAAO,CACL,uBAAC,WAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,YACzB,uBAAC,WAAI,IAAC,KAAK,EAAE,MAAM,CAAC,YAAY,YAC7B,QAAQ,GACJ,GACF,CACR,CAAA;AACH,CAAC,CAAA;AAZY,QAAA,eAAe,mBAY3B;AAED;;;;;;;;;GASG;AACI,MAAM,yBAAyB,GAAG,CAAC,EAAE,QAAQ,EAAkC,EAAE,EAAE;IACxF,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,4BAAkB,GAAE,CAAA;IAE/C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY;QAAE,OAAO,IAAI,CAAA;IAC9C,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO,IAAI,CAAA;IAEhD,oGAAoG;IACpG,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAA;IAElE,OAAO,IAAA,wBAAY,EACjB,uBAAC,WAAI,OAAM,SAAgC,EAAE,KAAK,EAAE,MAAM,CAAC,iBAAiB,YAC1E,uBAAC,WAAI,IAAC,KAAK,EAAE,MAAM,CAAC,sBAAsB,YACvC,QAAQ,GACJ,GACF,EACP,QAAQ,CAAC,IAAI,CACd,CAAA;AACH,CAAC,CAAA;AAjBY,QAAA,yBAAyB,6BAiBrC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
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.Dropzone = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
const View_1 = require("../View");
|
|
21
|
+
const Icon_1 = require("../Icon");
|
|
22
|
+
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
23
|
+
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
24
|
+
const context_1 = require("./context");
|
|
25
|
+
const elements_1 = require("./elements");
|
|
26
|
+
const useDropzone_1 = require("./useDropzone");
|
|
27
|
+
const context_2 = require("./context");
|
|
28
|
+
__exportStar(require("./styles"), exports);
|
|
29
|
+
__exportStar(require("./types"), exports);
|
|
30
|
+
__exportStar(require("./context"), exports);
|
|
31
|
+
__exportStar(require("./elements"), exports);
|
|
32
|
+
__exportStar(require("./useDropzone"), exports);
|
|
33
|
+
/**
|
|
34
|
+
* Drag-and-drop file upload zone. Stateless — use the `onDrop` callback to
|
|
35
|
+
* receive dropped files and manage your own file state.
|
|
36
|
+
*
|
|
37
|
+
* Assign `Dropzone.Default` to replace the built-in empty-state UI.
|
|
38
|
+
* Augment `DropzonePropsAugmentation` to add app-specific props that flow
|
|
39
|
+
* through to `Dropzone.Default` via context.
|
|
40
|
+
*
|
|
41
|
+
* For custom layouts compose the primitives directly:
|
|
42
|
+
* `Dropzone.Provider` + `Dropzone.Wrapper` + `Dropzone.Overlay` + `Dropzone.FullscreenOverlay`.
|
|
43
|
+
*/
|
|
44
|
+
const Dropzone = (props) => {
|
|
45
|
+
const merged = {
|
|
46
|
+
...exports.Dropzone.defaultProps,
|
|
47
|
+
...props,
|
|
48
|
+
};
|
|
49
|
+
const { icon, children, style, ref, ...dropzoneOptions } = merged;
|
|
50
|
+
const handle = (0, useDropzone_1.useDropzone)(dropzoneOptions);
|
|
51
|
+
const styles = (0, useStylesFor_1.useStylesFor)(exports.Dropzone.styleRegistryName, style);
|
|
52
|
+
const handleRef = (0, react_1.useRef)(handle);
|
|
53
|
+
handleRef.current = handle;
|
|
54
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
55
|
+
open: () => handleRef.current.dropzone.open(),
|
|
56
|
+
}));
|
|
57
|
+
const extensionProps = merged;
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(View_1.View, { style: styles.wrapper, children: (0, jsx_runtime_1.jsx)(context_1.DropzoneProvider, { handle: handle, style: style, extensionProps: extensionProps, children: (0, jsx_runtime_1.jsxs)(elements_1.DropzoneWrapper, { children: [exports.Dropzone.Default ? ((0, jsx_runtime_1.jsx)(exports.Dropzone.Default, {})) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: icon ? ((0, jsx_runtime_1.jsx)(View_1.View, { style: styles.iconWrapper, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { debugName: 'Dropzone:Icon', icon: icon, style: styles.icon }) })) : null })), children] }) }) }));
|
|
59
|
+
};
|
|
60
|
+
exports.Dropzone = Dropzone;
|
|
61
|
+
exports.Dropzone.styleRegistryName = 'Dropzone';
|
|
62
|
+
exports.Dropzone.elements = [
|
|
63
|
+
'wrapper',
|
|
64
|
+
'dropzone',
|
|
65
|
+
'overlay',
|
|
66
|
+
'overlayInner',
|
|
67
|
+
'fullscreenOverlay',
|
|
68
|
+
'fullscreenOverlayInner',
|
|
69
|
+
'icon',
|
|
70
|
+
'iconWrapper',
|
|
71
|
+
'title',
|
|
72
|
+
'placeholder',
|
|
73
|
+
];
|
|
74
|
+
exports.Dropzone.rootElement = 'wrapper';
|
|
75
|
+
exports.Dropzone.withVariantTypes = (styles) => {
|
|
76
|
+
return exports.Dropzone;
|
|
77
|
+
};
|
|
78
|
+
exports.Dropzone.defaultProps = {
|
|
79
|
+
icon: 'file-plus',
|
|
80
|
+
multiple: false,
|
|
81
|
+
};
|
|
82
|
+
exports.Dropzone.Provider = context_1.DropzoneProvider;
|
|
83
|
+
exports.Dropzone.Wrapper = elements_1.DropzoneWrapper;
|
|
84
|
+
exports.Dropzone.Overlay = elements_1.DropzoneOverlay;
|
|
85
|
+
exports.Dropzone.FullscreenOverlay = elements_1.DropzoneFullscreenOverlay;
|
|
86
|
+
exports.Dropzone.useContext = context_2.useDropzoneContext;
|
|
87
|
+
exports.Dropzone.Default = null;
|
|
88
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.Dropzone);
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Dropzone/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,iCAAmD;AACnD,kCAAyC;AAEzC,kCAA8B;AAC9B,+DAA2D;AAC3D,iEAA6D;AAE7D,uCAA4C;AAC5C,yCAAwF;AACxF,+CAA2C;AAC3C,uCAA8C;AAE9C,2CAAwB;AACxB,0CAAuB;AACvB,4CAAyB;AACzB,6CAA0B;AAC1B,gDAA6B;AAE7B;;;;;;;;;;GAUG;AACI,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,EAAE;IAC/C,MAAM,MAAM,GAAG;QACb,GAAG,gBAAQ,CAAC,YAAY;QACxB,GAAG,KAAK;KACT,CAAA;IAED,MAAM,EACJ,IAAI,EAEJ,QAAQ,EACR,KAAK,EACL,GAAG,EACH,GAAG,eAAe,EACnB,GAAG,MAAM,CAAA;IAEV,MAAM,MAAM,GAAG,IAAA,yBAAW,EAAC,eAAe,CAAC,CAAA;IAC3C,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,gBAAQ,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE9D,MAAM,SAAS,GAAG,IAAA,cAAM,EAAC,MAAM,CAAC,CAAA;IAChC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAA;IAE1B,IAAA,2BAAmB,EAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;KAC9C,CAAC,CAAC,CAAA;IAEH,MAAM,cAAc,GAA8B,MAAM,CAAA;IAExD,OAAO,CACL,uBAAC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B,CAAA;AACtD,gBAAQ,CAAC,UAAU,GAAG,4BAAkB,CAAA;AACxC,gBAAQ,CAAC,OAAO,GAAG,IAAkC,CAAA;AAErD,mCAAgB,CAAC,iBAAiB,CAAC,gBAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Dropzone/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Dropzone/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDropzone = useDropzone;
|
|
4
|
+
const react_dropzone_1 = require("react-dropzone");
|
|
5
|
+
/**
|
|
6
|
+
* Creates a `DropzoneHandle` — the service object that owns drag-and-drop
|
|
7
|
+
* mechanics. The returned `dropzone` field is the full react-dropzone state
|
|
8
|
+
* pass-through (`getRootProps`, `getInputProps`, `open`, `isDragActive`,
|
|
9
|
+
* `isDragAccept`, `isDragReject`, `isDragGlobal`, etc.).
|
|
10
|
+
*
|
|
11
|
+
* Pass the handle to `Dropzone.Provider` to wire it into the component tree,
|
|
12
|
+
* or use it directly when you need access to the drag state outside JSX.
|
|
13
|
+
* File management is the caller's responsibility — use the `onDrop` callback
|
|
14
|
+
* to receive accepted and rejected files.
|
|
15
|
+
*/
|
|
16
|
+
function useDropzone(options = {}) {
|
|
17
|
+
const dropzone = (0, react_dropzone_1.useDropzone)(options);
|
|
18
|
+
return { dropzone };
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=useDropzone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDropzone.js","sourceRoot":"","sources":["../../../src/components/Dropzone/useDropzone.ts"],"names":[],"mappings":";;AAcA,kCAGC;AAjBD,mDAAgE;AAGhE;;;;;;;;;;GAUG;AACH,SAAgB,WAAW,CAAC,UAA8B,EAAE;IAC1D,MAAM,QAAQ,GAAG,IAAA,4BAAgB,EAAC,OAAO,CAAC,CAAA;IAC1C,OAAO,EAAE,QAAQ,EAAE,CAAA;AACrB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.EmptyPlaceholder = void 0;
|
|
21
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
22
|
+
const react_1 = __importDefault(require("react"));
|
|
23
|
+
const Icon_1 = require("../Icon");
|
|
24
|
+
const View_1 = require("../View");
|
|
25
|
+
const Text_1 = require("../Text");
|
|
26
|
+
const ActivityIndicator_1 = require("../ActivityIndicator");
|
|
27
|
+
const types_1 = require("@codeleap/types");
|
|
28
|
+
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
29
|
+
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
30
|
+
const styles_1 = require("@codeleap/styles");
|
|
31
|
+
__exportStar(require("./styles"), exports);
|
|
32
|
+
__exportStar(require("./types"), exports);
|
|
33
|
+
/**
|
|
34
|
+
* Communicates an empty or loading state for a content region with an optional icon/image, title, and description.
|
|
35
|
+
* When `loading` is `true`, replaces all content with an `ActivityIndicator`; when `renderEmpty` is provided, it takes over the entire content layout.
|
|
36
|
+
* Uses: `Icon`, `Text`, `ActivityIndicator`
|
|
37
|
+
*/
|
|
38
|
+
const EmptyPlaceholder = (props) => {
|
|
39
|
+
const { itemName, title, loading, description, style, icon: IconEmpty, renderEmpty: RenderEmpty, image, imageProps, wrapperProps, imageWrapperProps, indicatorProps, debugName, ImageComponent, } = {
|
|
40
|
+
...exports.EmptyPlaceholder.defaultProps,
|
|
41
|
+
...props,
|
|
42
|
+
};
|
|
43
|
+
const styles = (0, useStylesFor_1.useStylesFor)(exports.EmptyPlaceholder.styleRegistryName, style);
|
|
44
|
+
const emptyText = title || (itemName && `No ${itemName} found.`) || 'No items.';
|
|
45
|
+
const activityIndicatorStyles = (0, styles_1.useNestedStylesByKey)('loader', styles);
|
|
46
|
+
const _Image = react_1.default.useMemo(() => {
|
|
47
|
+
if (!types_1.TypeGuards.isNil(image)) {
|
|
48
|
+
return (0, jsx_runtime_1.jsx)(ImageComponent, { ...imageProps,
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
source: image, css: styles.image });
|
|
51
|
+
}
|
|
52
|
+
if (types_1.TypeGuards.isNil(IconEmpty))
|
|
53
|
+
return null;
|
|
54
|
+
if (types_1.TypeGuards.isString(IconEmpty)) {
|
|
55
|
+
return (0, jsx_runtime_1.jsx)(Icon_1.Icon, { debugName: debugName, icon: IconEmpty, forceStyle: styles.icon });
|
|
56
|
+
}
|
|
57
|
+
else if (react_1.default.isValidElement(IconEmpty)) {
|
|
58
|
+
return (0, jsx_runtime_1.jsx)(IconEmpty, { ...props });
|
|
59
|
+
}
|
|
60
|
+
}, [IconEmpty, image]);
|
|
61
|
+
if (loading) {
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)(View_1.View, { style: [styles.wrapper, styles['wrapper:loading']], children: (0, jsx_runtime_1.jsx)(ActivityIndicator_1.ActivityIndicator, { debugName: debugName, ...indicatorProps, style: activityIndicatorStyles }) }));
|
|
63
|
+
}
|
|
64
|
+
if (!types_1.TypeGuards.isNil(RenderEmpty)) {
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)(View_1.View, { ...wrapperProps, style: styles.wrapper, children: (0, jsx_runtime_1.jsx)(RenderEmpty, { emptyText: emptyText, emptyIconName: IconEmpty, styles: {
|
|
66
|
+
...styles,
|
|
67
|
+
activityIndicatorStyles,
|
|
68
|
+
} }) }));
|
|
69
|
+
}
|
|
70
|
+
return ((0, jsx_runtime_1.jsxs)(View_1.View, { ...wrapperProps, style: styles.wrapper, children: [(0, jsx_runtime_1.jsx)(View_1.View, { ...imageWrapperProps, style: styles.imageWrapper, children: _Image }), types_1.TypeGuards.isString(emptyText)
|
|
71
|
+
? (0, jsx_runtime_1.jsx)(Text_1.Text, { debugName: debugName, text: emptyText, style: styles.title })
|
|
72
|
+
: react_1.default.isValidElement(emptyText) ? emptyText : null, types_1.TypeGuards.isString(description)
|
|
73
|
+
? (0, jsx_runtime_1.jsx)(Text_1.Text, { debugName: debugName, text: description, style: styles.description })
|
|
74
|
+
: react_1.default.isValidElement(description) ? description : null] }));
|
|
75
|
+
};
|
|
76
|
+
exports.EmptyPlaceholder = EmptyPlaceholder;
|
|
77
|
+
exports.EmptyPlaceholder.styleRegistryName = 'EmptyPlaceholder';
|
|
78
|
+
exports.EmptyPlaceholder.elements = ['wrapper', 'loader', 'title', 'description', 'image', 'imageWrapper', 'icon'];
|
|
79
|
+
exports.EmptyPlaceholder.rootElement = 'wrapper';
|
|
80
|
+
exports.EmptyPlaceholder.ImageComponent = 'img';
|
|
81
|
+
exports.EmptyPlaceholder.withVariantTypes = (styles) => {
|
|
82
|
+
return exports.EmptyPlaceholder;
|
|
83
|
+
};
|
|
84
|
+
exports.EmptyPlaceholder.defaultProps = {};
|
|
85
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.EmptyPlaceholder);
|
|
86
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/EmptyPlaceholder/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,kCAA8B;AAC9B,kCAA8B;AAC9B,kCAA8B;AAC9B,4DAAwD;AACxD,2CAA4C;AAE5C,+DAA2D;AAC3D,iEAA6D;AAC7D,6CAAuG;AAEvG,2CAAwB;AACxB,0CAAuB;AAEvB;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,KAA4B,EAAE,EAAE;IAC/D,MAAM,EACJ,QAAQ,EACR,KAAK,EACL,OAAO,EACP,WAAW,EACX,KAAK,EACL,IAAI,EAAE,SAAS,EACf,WAAW,EAAE,WAAW,EACxB,KAAK,EACL,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,cAAc,GACf,GAAG;QACF,GAAG,wBAAgB,CAAC,YAAY;QAChC,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,wBAAgB,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAEtE,MAAM,SAAS,GAAG,KAAK,IAAI,CAAC,QAAQ,IAAI,MAAM,QAAQ,SAAS,CAAC,IAAI,WAAW,CAAA;IAE/E,MAAM,uBAAuB,GAAG,IAAA,6BAAoB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAEtE,MAAM,MAAM,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAEhC,IAAI,CAAC,kBAAU,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAE7B,OAAO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../../../src/components/EmptyPlaceholder/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/EmptyPlaceholder/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFieldContext = exports.FieldProvider = exports.getFieldIds = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const lib_1 = require("../../lib");
|
|
7
|
+
/** Derives stable ARIA `label` and `helper` element IDs from a base field ID. */
|
|
8
|
+
const getFieldIds = (baseId) => ({
|
|
9
|
+
label: baseId + '-label',
|
|
10
|
+
helper: baseId + '-helper',
|
|
11
|
+
});
|
|
12
|
+
exports.getFieldIds = getFieldIds;
|
|
13
|
+
const useFieldContextProvider = (props) => {
|
|
14
|
+
const generatedId = (0, react_1.useId)();
|
|
15
|
+
const baseId = props.id ?? generatedId;
|
|
16
|
+
const { label: labelId, helper: helperId } = (0, exports.getFieldIds)(baseId);
|
|
17
|
+
const stateContext = {
|
|
18
|
+
disabled: props.context?.disabled,
|
|
19
|
+
error: props.context?.error,
|
|
20
|
+
focused: props.context?.focused,
|
|
21
|
+
hasValue: props.context?.hasValue,
|
|
22
|
+
};
|
|
23
|
+
const styles = (0, lib_1.useStylesFor)('Field', props?.style, stateContext);
|
|
24
|
+
const getClassName = (...suffixes) => {
|
|
25
|
+
const getClasses = (basename) => suffixes.map(s => `${basename}__${s}`).join(' ');
|
|
26
|
+
let classes = getClasses('field');
|
|
27
|
+
if (props?.componentName) {
|
|
28
|
+
classes += ` ${getClasses(props.componentName)}`;
|
|
29
|
+
}
|
|
30
|
+
return classes;
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
props,
|
|
34
|
+
styles,
|
|
35
|
+
stateContext,
|
|
36
|
+
getClassName,
|
|
37
|
+
labelId,
|
|
38
|
+
helperId,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
const FieldContext = (0, react_1.createContext)({});
|
|
42
|
+
/**
|
|
43
|
+
* Context provider for `Field`; computes styles and state data from `FieldProps`
|
|
44
|
+
* and makes them available to all `Field.*` sub-elements.
|
|
45
|
+
* Must wrap any composition that uses `useFieldContext`.
|
|
46
|
+
*/
|
|
47
|
+
const FieldProvider = ({ children, ...props }) => {
|
|
48
|
+
const value = useFieldContextProvider(props);
|
|
49
|
+
return (0, jsx_runtime_1.jsx)(FieldContext.Provider, { value: value, children: children });
|
|
50
|
+
};
|
|
51
|
+
exports.FieldProvider = FieldProvider;
|
|
52
|
+
/**
|
|
53
|
+
* Reads the nearest `FieldProvider` context.
|
|
54
|
+
* Must be called inside a component rendered within `FieldProvider`.
|
|
55
|
+
*/
|
|
56
|
+
const useFieldContext = () => (0, react_1.useContext)(FieldContext);
|
|
57
|
+
exports.useFieldContext = useFieldContext;
|
|
58
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/Field/context.tsx"],"names":[],"mappings":";;;;AAAA,iCAAwD;AAExD,mCAAwC;AAGxC,iFAAiF;AAC1E,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;IAC9C,KAAK,EAAE,MAAM,GAAG,QAAQ;IACxB,MAAM,EAAE,MAAM,GAAG,SAAS;CAC3B,CAAC,CAAA;AAHW,QAAA,WAAW,eAGtB;AAEF,MAAM,uBAAuB,GAAG,CAAC,KAAiB,EAAE,EAAE;IACpD,MAAM,WAAW,GAAG,IAAA,aAAK,GAAE,CAAA;IAC3B,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,IAAI,WAAW,CAAA;IACtC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG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,GACa,CAAA;AAC1B,CAAC,CAAA;AALY,QAAA,aAAa,iBAKzB;AAED;;;GAGG;AACI,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,IAAA,kBAAU,EAAC,YAAY,CAAC,CAAA;AAAhD,QAAA,eAAe,mBAAiC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SectionSlot = exports.FieldWrapper = exports.FieldBox = exports.FieldHelper = exports.FieldHeading = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const types_1 = require("@codeleap/types");
|
|
6
|
+
const Text_1 = require("../Text");
|
|
7
|
+
const View_1 = require("../View");
|
|
8
|
+
const context_1 = require("./context");
|
|
9
|
+
const lib_1 = require("../../lib");
|
|
10
|
+
const Touchable_1 = require("../Touchable");
|
|
11
|
+
/**
|
|
12
|
+
* Renders the field label linked to the input via `aria-labelledby`.
|
|
13
|
+
* Reads content from `FieldProvider` context; renders nothing when no label is present.
|
|
14
|
+
* Must be inside `FieldProvider`.
|
|
15
|
+
*/
|
|
16
|
+
const FieldHeading = (props) => {
|
|
17
|
+
const ctx = (0, context_1.useFieldContext)();
|
|
18
|
+
const label = props?.children ?? ctx?.props?.label;
|
|
19
|
+
if (!label && !props.component)
|
|
20
|
+
return null;
|
|
21
|
+
const Component = props?.component ?? Text_1.Text;
|
|
22
|
+
return (0, jsx_runtime_1.jsx)(Component, { id: ctx.labelId, component: 'label', ref: props.ref, style: [ctx?.styles?.heading, props?.style], className: ctx.getClassName('heading'), children: label });
|
|
23
|
+
};
|
|
24
|
+
exports.FieldHeading = FieldHeading;
|
|
25
|
+
/**
|
|
26
|
+
* Renders the field helper/description text.
|
|
27
|
+
* Reads content from `FieldProvider` context; renders nothing when no helper is present.
|
|
28
|
+
* Must be inside `FieldProvider`.
|
|
29
|
+
*/
|
|
30
|
+
const FieldHelper = (props) => {
|
|
31
|
+
const ctx = (0, context_1.useFieldContext)();
|
|
32
|
+
const label = props?.children ?? ctx?.props?.helper;
|
|
33
|
+
if (!label && !props.component)
|
|
34
|
+
return null;
|
|
35
|
+
const Component = props?.component ?? Text_1.Text.Span;
|
|
36
|
+
return (0, jsx_runtime_1.jsx)(Component, { id: ctx.helperId, ref: props.ref, style: [ctx?.styles?.helper, props?.style], className: ctx.getClassName('helper'), children: label });
|
|
37
|
+
};
|
|
38
|
+
exports.FieldHelper = FieldHelper;
|
|
39
|
+
/**
|
|
40
|
+
* Input container row that receives state `data-*` attributes from context;
|
|
41
|
+
* renders as `Touchable` when `onPress` is provided, otherwise as `View`.
|
|
42
|
+
* Must be inside `FieldProvider`.
|
|
43
|
+
* Uses: `View`, `Touchable`
|
|
44
|
+
*/
|
|
45
|
+
const FieldBox = ({ component = View_1.View, style, ref, children, onPress, ...rest }) => {
|
|
46
|
+
const ctx = (0, context_1.useFieldContext)();
|
|
47
|
+
const attrs = (0, lib_1.toDataAttrs)(ctx.stateContext);
|
|
48
|
+
if (onPress) {
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(Touchable_1.Touchable, { debugName: 'field-box', css: [ctx?.styles?.box, style], onPress: onPress, className: ctx.getClassName('box'), ...attrs, ...rest, ref: ref ?? ctx?.props?.boxRef, children: children }));
|
|
50
|
+
}
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)(View_1.View, { css: [ctx?.styles?.box, style], className: ctx.getClassName('box'), ...attrs, ...rest, ref: ref ?? ctx?.props?.boxRef, children: children }));
|
|
52
|
+
};
|
|
53
|
+
exports.FieldBox = FieldBox;
|
|
54
|
+
/**
|
|
55
|
+
* Outermost container for the full field layout; forwards state `data-*`
|
|
56
|
+
* attributes and resolves the `wrapperRef` from context.
|
|
57
|
+
* Must be inside `FieldProvider`.
|
|
58
|
+
*/
|
|
59
|
+
const FieldWrapper = (props) => {
|
|
60
|
+
const ctx = (0, context_1.useFieldContext)();
|
|
61
|
+
const Component = props?.component ?? View_1.View;
|
|
62
|
+
const attrs = (0, lib_1.toDataAttrs)(ctx.stateContext);
|
|
63
|
+
return (0, jsx_runtime_1.jsx)(Component, { ref: props.ref ?? ctx?.props?.wrapperRef, style: [ctx.styles.wrapper, props?.style], ...attrs, className: ctx.getClassName('wrapper'), children: props?.children });
|
|
64
|
+
};
|
|
65
|
+
exports.FieldWrapper = FieldWrapper;
|
|
66
|
+
/**
|
|
67
|
+
* Renders either the `leftSection` or `rightSection` prop from `FieldProvider`
|
|
68
|
+
* context; supports static ReactNode and render-function forms.
|
|
69
|
+
* Must be inside `FieldProvider`.
|
|
70
|
+
*/
|
|
71
|
+
const SectionSlot = (props) => {
|
|
72
|
+
const ctx = (0, context_1.useFieldContext)();
|
|
73
|
+
const sectionProp = props?.position === 'left' ? ctx.props.leftSection : ctx.props.rightSection;
|
|
74
|
+
const style = props.position === 'left' ? ctx.styles.leftSection : ctx.styles.rightSection;
|
|
75
|
+
let Component = null;
|
|
76
|
+
if (props?.component) {
|
|
77
|
+
Component = props?.component;
|
|
78
|
+
}
|
|
79
|
+
else if (types_1.TypeGuards.isFunction(sectionProp)) {
|
|
80
|
+
Component = sectionProp;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
if (!sectionProp)
|
|
84
|
+
return null;
|
|
85
|
+
return (0, jsx_runtime_1.jsx)(View_1.View, { style: [ctx.styles.section, style], className: ctx.getClassName('section', `${props.position}_section`), children: sectionProp });
|
|
86
|
+
}
|
|
87
|
+
const attrs = (0, lib_1.toDataAttrs)(ctx.stateContext);
|
|
88
|
+
const Render = Component;
|
|
89
|
+
return (0, jsx_runtime_1.jsx)(Render, { ...attrs, "data-section-position": props.position, style: [ctx.styles.section, style], className: ctx.getClassName('section', `${props.position}_section`) });
|
|
90
|
+
};
|
|
91
|
+
exports.SectionSlot = SectionSlot;
|
|
92
|
+
//# sourceMappingURL=elements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot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