@codeleap/web 7.0.1 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ActivityIndicator/index.js +34 -16
- package/dist/components/ActivityIndicator/index.js.map +1 -1
- package/dist/components/ActivityIndicator/styles.js +2 -1
- package/dist/components/ActivityIndicator/types.js +2 -1
- package/dist/components/Badge/index.js +42 -24
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Badge/styles.js +2 -1
- package/dist/components/Badge/types.js +2 -1
- package/dist/components/Button/index.js +36 -19
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Button/styles.js +2 -1
- package/dist/components/Button/types.js +2 -1
- package/dist/components/Calendar/index.js +29 -12
- package/dist/components/Calendar/index.js.map +1 -1
- package/dist/components/Calendar/styles.js +2 -1
- package/dist/components/Calendar/types.js +2 -1
- package/dist/components/Carousel/index.js +82 -40
- package/dist/components/Carousel/index.js.map +1 -1
- package/dist/components/Carousel/styles.js +2 -1
- package/dist/components/Carousel/types.js +2 -1
- package/dist/components/Checkbox/index.js +42 -24
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/styles.js +2 -1
- package/dist/components/Checkbox/types.js +2 -1
- package/dist/components/Collapse/index.js +35 -17
- package/dist/components/Collapse/index.js.map +1 -1
- package/dist/components/Collapse/styles.js +2 -1
- package/dist/components/Collapse/types.js +2 -1
- package/dist/components/ColorPicker/index.js +51 -33
- package/dist/components/ColorPicker/index.js.map +1 -1
- package/dist/components/ColorPicker/styles.js +2 -1
- package/dist/components/ColorPicker/types.js +2 -1
- package/dist/components/CropPicker/hooks.d.ts +2 -2
- package/dist/components/CropPicker/hooks.js +20 -17
- package/dist/components/CropPicker/hooks.js.map +1 -1
- package/dist/components/CropPicker/index.js +40 -22
- package/dist/components/CropPicker/index.js.map +1 -1
- package/dist/components/CropPicker/styles.js +2 -1
- package/dist/components/CropPicker/types.js +2 -1
- package/dist/components/CropPicker/utils.js +9 -3
- package/dist/components/CropPicker/utils.js.map +1 -1
- package/dist/components/DatePicker/index.js +40 -23
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DatePicker/styles.js +2 -1
- package/dist/components/DatePicker/types.js +2 -1
- package/dist/components/Drawer/index.js +40 -22
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Drawer/styles.js +2 -1
- package/dist/components/Drawer/types.js +2 -1
- package/dist/components/Dropzone/context.js +16 -11
- package/dist/components/Dropzone/context.js.map +1 -1
- package/dist/components/Dropzone/elements.js +19 -13
- package/dist/components/Dropzone/elements.js.map +1 -1
- package/dist/components/Dropzone/index.js +53 -35
- package/dist/components/Dropzone/index.js.map +1 -1
- package/dist/components/Dropzone/styles.js +2 -1
- package/dist/components/Dropzone/types.js +2 -1
- package/dist/components/Dropzone/useDropzone.js +6 -3
- package/dist/components/Dropzone/useDropzone.js.map +1 -1
- package/dist/components/EmptyPlaceholder/index.js +61 -40
- package/dist/components/EmptyPlaceholder/index.js.map +1 -1
- package/dist/components/EmptyPlaceholder/styles.js +2 -1
- package/dist/components/EmptyPlaceholder/types.js +2 -1
- package/dist/components/Field/context.js +17 -11
- package/dist/components/Field/context.js.map +1 -1
- package/dist/components/Field/elements.js +39 -31
- package/dist/components/Field/elements.js.map +1 -1
- package/dist/components/Field/index.js +41 -23
- package/dist/components/Field/index.js.map +1 -1
- package/dist/components/Field/styles.js +2 -1
- package/dist/components/Field/types.js +2 -1
- package/dist/components/Field/useFieldInput.d.ts +1 -1
- package/dist/components/Field/useFieldInput.js +11 -8
- package/dist/components/Field/useFieldInput.js.map +1 -1
- package/dist/components/FileInput/index.js +32 -14
- package/dist/components/FileInput/index.js.map +1 -1
- package/dist/components/FileInput/types.js +2 -1
- package/dist/components/Icon/index.js +44 -26
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Icon/styles.js +2 -1
- package/dist/components/Icon/types.js +2 -1
- package/dist/components/List/context.js +25 -20
- package/dist/components/List/context.js.map +1 -1
- package/dist/components/List/elements.js +74 -33
- package/dist/components/List/elements.js.map +1 -1
- package/dist/components/List/index.js +35 -18
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/List/scroll.js +18 -13
- package/dist/components/List/scroll.js.map +1 -1
- package/dist/components/List/styles.js +2 -1
- package/dist/components/List/types.js +2 -1
- package/dist/components/LoadingOverlay/index.js +38 -20
- package/dist/components/LoadingOverlay/index.js.map +1 -1
- package/dist/components/LoadingOverlay/styles.js +2 -1
- package/dist/components/LoadingOverlay/types.js +2 -1
- package/dist/components/MaskedTextInput/index.js +32 -14
- package/dist/components/MaskedTextInput/index.js.map +1 -1
- package/dist/components/MaskedTextInput/mask.js +4 -1
- package/dist/components/MaskedTextInput/mask.js.map +1 -1
- package/dist/components/MaskedTextInput/types.js +2 -1
- package/dist/components/Modal/context.js +14 -9
- package/dist/components/Modal/context.js.map +1 -1
- package/dist/components/Modal/elements.js +31 -23
- package/dist/components/Modal/elements.js.map +1 -1
- package/dist/components/Modal/index.js +40 -22
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/styles.js +2 -1
- package/dist/components/Modal/types.js +2 -1
- package/dist/components/NumberIncrement/index.js +47 -29
- package/dist/components/NumberIncrement/index.js.map +1 -1
- package/dist/components/NumberIncrement/styles.js +2 -1
- package/dist/components/NumberIncrement/types.js +2 -1
- package/dist/components/NumberIncrement/useNumberIncrement.js +24 -21
- package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -1
- package/dist/components/Overlay/index.js +39 -21
- package/dist/components/Overlay/index.js.map +1 -1
- package/dist/components/Overlay/styles.js +2 -1
- package/dist/components/Overlay/types.js +2 -1
- package/dist/components/PaginationButtons/index.js +44 -26
- package/dist/components/PaginationButtons/index.js.map +1 -1
- package/dist/components/PaginationButtons/styles.js +2 -1
- package/dist/components/PaginationButtons/types.js +2 -1
- package/dist/components/PaginationIndicator/index.js +42 -24
- package/dist/components/PaginationIndicator/index.js.map +1 -1
- package/dist/components/PaginationIndicator/styles.js +2 -1
- package/dist/components/PaginationIndicator/types.js +2 -1
- package/dist/components/Progress/Bar/Segmented.js +23 -19
- package/dist/components/Progress/Bar/Segmented.js.map +1 -1
- package/dist/components/Progress/Bar/index.js +47 -29
- package/dist/components/Progress/Bar/index.js.map +1 -1
- package/dist/components/Progress/Bar/styles.js +2 -1
- package/dist/components/Progress/Bar/types.js +2 -1
- package/dist/components/Progress/Circle/Segmented.js +26 -22
- package/dist/components/Progress/Circle/Segmented.js.map +1 -1
- package/dist/components/Progress/Circle/index.js +48 -30
- package/dist/components/Progress/Circle/index.js.map +1 -1
- package/dist/components/Progress/Circle/styles.js +2 -1
- package/dist/components/Progress/Circle/types.js +2 -1
- package/dist/components/Progress/index.js +18 -2
- package/dist/components/Progress/index.js.map +1 -1
- package/dist/components/Progress/utils.js +4 -1
- package/dist/components/Progress/utils.js.map +1 -1
- package/dist/components/RadioInput/index.js +47 -26
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/styles.js +2 -1
- package/dist/components/RadioInput/types.js +2 -1
- package/dist/components/SearchInput/index.js +51 -14
- package/dist/components/SearchInput/index.js.map +1 -1
- package/dist/components/SectionFilters/index.js +56 -38
- package/dist/components/SectionFilters/index.js.map +1 -1
- package/dist/components/SectionFilters/styles.js +2 -1
- package/dist/components/SectionFilters/types.js +2 -1
- package/dist/components/Select/context.js +50 -44
- package/dist/components/Select/context.js.map +1 -1
- package/dist/components/Select/elements.js +29 -23
- package/dist/components/Select/elements.js.map +1 -1
- package/dist/components/Select/index.js +41 -24
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/styles.js +2 -1
- package/dist/components/Select/types.js +2 -1
- package/dist/components/Select/useTriggerWidth.js +9 -6
- package/dist/components/Select/useTriggerWidth.js.map +1 -1
- package/dist/components/Slider/index.js +68 -47
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/styles.js +2 -1
- package/dist/components/Slider/types.js +2 -1
- package/dist/components/Switch/index.js +40 -22
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/styles.js +2 -1
- package/dist/components/Switch/types.js +2 -1
- package/dist/components/Tag/index.js +55 -34
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Tag/styles.js +2 -1
- package/dist/components/Tag/types.js +2 -1
- package/dist/components/Text/index.js +48 -27
- package/dist/components/Text/index.js.map +1 -1
- package/dist/components/Text/styles.js +2 -1
- package/dist/components/Text/types.js +2 -1
- package/dist/components/TextEditor/index.js +50 -29
- package/dist/components/TextEditor/index.js.map +1 -1
- package/dist/components/TextEditor/styles.js +2 -1
- package/dist/components/TextEditor/types.js +2 -1
- package/dist/components/TextInput/index.js +49 -28
- package/dist/components/TextInput/index.js.map +1 -1
- package/dist/components/TextInput/styles.js +2 -1
- package/dist/components/TextInput/types.js +2 -1
- package/dist/components/TextInput/useTextInput.d.ts +2 -2
- package/dist/components/TextInput/useTextInput.js +15 -12
- package/dist/components/TextInput/useTextInput.js.map +1 -1
- package/dist/components/Tooltip/index.js +54 -33
- package/dist/components/Tooltip/index.js.map +1 -1
- package/dist/components/Tooltip/styles.js +2 -1
- package/dist/components/Tooltip/types.js +2 -1
- package/dist/components/Touchable/index.js +41 -21
- package/dist/components/Touchable/index.js.map +1 -1
- package/dist/components/Touchable/styles.js +2 -1
- package/dist/components/Touchable/types.js +2 -1
- package/dist/components/View/index.js +32 -15
- package/dist/components/View/index.js.map +1 -1
- package/dist/components/View/styles.js +2 -1
- package/dist/components/View/types.js +2 -1
- package/dist/components/components.js +57 -41
- package/dist/components/components.js.map +1 -1
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/ListMasonry.js +31 -22
- package/dist/lib/ListMasonry.js.map +1 -1
- package/dist/lib/ThemeVariables.js +11 -6
- package/dist/lib/ThemeVariables.js.map +1 -1
- package/dist/lib/WebStyleRegistry.js +7 -3
- package/dist/lib/WebStyleRegistry.js.map +1 -1
- package/dist/lib/hooks/index.js +38 -22
- package/dist/lib/hooks/index.js.map +1 -1
- package/dist/lib/hooks/useAnimatedStyle.js +9 -5
- package/dist/lib/hooks/useAnimatedStyle.js.map +1 -1
- package/dist/lib/hooks/useAnimatedVariantStyles.js +9 -6
- package/dist/lib/hooks/useAnimatedVariantStyles.js.map +1 -1
- package/dist/lib/hooks/useAsyncSelect.js +11 -8
- package/dist/lib/hooks/useAsyncSelect.js.map +1 -1
- package/dist/lib/hooks/useBreakpointMatch.js +22 -19
- package/dist/lib/hooks/useBreakpointMatch.js.map +1 -1
- package/dist/lib/hooks/useClick.js +10 -7
- package/dist/lib/hooks/useClick.js.map +1 -1
- package/dist/lib/hooks/useClickOutside.js +7 -4
- package/dist/lib/hooks/useClickOutside.js.map +1 -1
- package/dist/lib/hooks/useFileInput.js +7 -3
- package/dist/lib/hooks/useFileInput.js.map +1 -1
- package/dist/lib/hooks/useIsomorphicEffect.js +5 -2
- package/dist/lib/hooks/useIsomorphicEffect.js.map +1 -1
- package/dist/lib/hooks/useKeydown.js +13 -9
- package/dist/lib/hooks/useKeydown.js.map +1 -1
- package/dist/lib/hooks/useListFocus.js +7 -4
- package/dist/lib/hooks/useListFocus.js.map +1 -1
- package/dist/lib/hooks/useMediaQuery.js +11 -8
- package/dist/lib/hooks/useMediaQuery.js.map +1 -1
- package/dist/lib/hooks/usePageExitBlocker.js +10 -6
- package/dist/lib/hooks/usePageExitBlocker.js.map +1 -1
- package/dist/lib/hooks/usePagination.js +13 -10
- package/dist/lib/hooks/usePagination.js.map +1 -1
- package/dist/lib/hooks/usePopState.js +9 -5
- package/dist/lib/hooks/usePopState.js.map +1 -1
- package/dist/lib/hooks/usePopoverDismiss.js +8 -5
- package/dist/lib/hooks/usePopoverDismiss.js.map +1 -1
- package/dist/lib/hooks/useRefresh.js +16 -9
- package/dist/lib/hooks/useRefresh.js.map +1 -1
- package/dist/lib/hooks/useScrollEffect.js +6 -3
- package/dist/lib/hooks/useScrollEffect.js.map +1 -1
- package/dist/lib/hooks/useSearchParams.js +10 -7
- package/dist/lib/hooks/useSearchParams.js.map +1 -1
- package/dist/lib/hooks/useStaticAnimationStyles.js +6 -3
- package/dist/lib/hooks/useStaticAnimationStyles.js.map +1 -1
- package/dist/lib/hooks/useStylesFor.js +13 -9
- package/dist/lib/hooks/useStylesFor.js.map +1 -1
- package/dist/lib/hooks/useTouchableEvents.js +7 -4
- package/dist/lib/hooks/useTouchableEvents.js.map +1 -1
- package/dist/lib/hooks/useWindowFocus.js +11 -7
- package/dist/lib/hooks/useWindowFocus.js.map +1 -1
- package/dist/lib/hooks/useWindowSize.js +10 -7
- package/dist/lib/hooks/useWindowSize.js.map +1 -1
- package/dist/lib/index.js +22 -6
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/tools/index.js +19 -3
- package/dist/lib/tools/index.js.map +1 -1
- package/dist/lib/tools/localStorage.js +12 -8
- package/dist/lib/tools/localStorage.js.map +1 -1
- package/dist/lib/tools/mediaQuery.js +8 -3
- package/dist/lib/tools/mediaQuery.js.map +1 -1
- package/dist/lib/tools/modal.js +18 -13
- package/dist/lib/tools/modal.js.map +1 -1
- package/dist/lib/utils/attributes.js +6 -3
- package/dist/lib/utils/attributes.js.map +1 -1
- package/dist/lib/utils/cache.d.ts +2 -2
- package/dist/lib/utils/cache.js +11 -4
- package/dist/lib/utils/cache.js.map +1 -1
- package/dist/lib/utils/index.js +21 -5
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/pollyfils/scroll.js +5 -1
- package/dist/lib/utils/pollyfils/scroll.js.map +1 -1
- package/dist/lib/utils/stopPropagation.js +4 -1
- package/dist/lib/utils/stopPropagation.js.map +1 -1
- package/dist/lib/utils/test.js +7 -3
- package/dist/lib/utils/test.js.map +1 -1
- package/dist/types/index.js +17 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/utility.js +2 -1
- package/package.json +1 -1
|
@@ -1,18 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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);
|
|
16
33
|
/**
|
|
17
34
|
* Drag-and-drop file upload zone. Stateless — use the `onDrop` callback to
|
|
18
35
|
* receive dropped files and manage your own file state.
|
|
@@ -24,24 +41,25 @@ export * from './useDropzone';
|
|
|
24
41
|
* For custom layouts compose the primitives directly:
|
|
25
42
|
* `Dropzone.Provider` + `Dropzone.Wrapper` + `Dropzone.Overlay` + `Dropzone.FullscreenOverlay`.
|
|
26
43
|
*/
|
|
27
|
-
|
|
44
|
+
const Dropzone = (props) => {
|
|
28
45
|
const merged = {
|
|
29
|
-
...Dropzone.defaultProps,
|
|
46
|
+
...exports.Dropzone.defaultProps,
|
|
30
47
|
...props,
|
|
31
48
|
};
|
|
32
49
|
const { icon, children, style, ref, ...dropzoneOptions } = merged;
|
|
33
|
-
const handle = useDropzone(dropzoneOptions);
|
|
34
|
-
const styles = useStylesFor(Dropzone.styleRegistryName, style);
|
|
35
|
-
const handleRef = useRef(handle);
|
|
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);
|
|
36
53
|
handleRef.current = handle;
|
|
37
|
-
useImperativeHandle(ref, () => ({
|
|
54
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
38
55
|
open: () => handleRef.current.dropzone.open(),
|
|
39
56
|
}));
|
|
40
57
|
const extensionProps = merged;
|
|
41
|
-
return (
|
|
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] }) }) }));
|
|
42
59
|
};
|
|
43
|
-
Dropzone
|
|
44
|
-
Dropzone.
|
|
60
|
+
exports.Dropzone = Dropzone;
|
|
61
|
+
exports.Dropzone.styleRegistryName = 'Dropzone';
|
|
62
|
+
exports.Dropzone.elements = [
|
|
45
63
|
'wrapper',
|
|
46
64
|
'dropzone',
|
|
47
65
|
'overlay',
|
|
@@ -53,19 +71,19 @@ Dropzone.elements = [
|
|
|
53
71
|
'title',
|
|
54
72
|
'placeholder',
|
|
55
73
|
];
|
|
56
|
-
Dropzone.rootElement = 'wrapper';
|
|
57
|
-
Dropzone.withVariantTypes = (styles) => {
|
|
58
|
-
return Dropzone;
|
|
74
|
+
exports.Dropzone.rootElement = 'wrapper';
|
|
75
|
+
exports.Dropzone.withVariantTypes = (styles) => {
|
|
76
|
+
return exports.Dropzone;
|
|
59
77
|
};
|
|
60
|
-
Dropzone.defaultProps = {
|
|
78
|
+
exports.Dropzone.defaultProps = {
|
|
61
79
|
icon: 'file-plus',
|
|
62
80
|
multiple: false,
|
|
63
81
|
};
|
|
64
|
-
Dropzone.Provider = DropzoneProvider;
|
|
65
|
-
Dropzone.Wrapper = DropzoneWrapper;
|
|
66
|
-
Dropzone.Overlay = DropzoneOverlay;
|
|
67
|
-
Dropzone.FullscreenOverlay = DropzoneFullscreenOverlay;
|
|
68
|
-
Dropzone.useContext = useDropzoneContext;
|
|
69
|
-
Dropzone.Default = null;
|
|
70
|
-
WebStyleRegistry.registerComponent(Dropzone);
|
|
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);
|
|
71
89
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Dropzone/index.tsx"],"names":[],"mappings":"
|
|
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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CAAA;AAClC,gBAAQ,CAAC,OAAO,GAAG,0BAAe,CAAA;AAClC,gBAAQ,CAAC,iBAAiB,GAAG,oCAAyB,CAAA;AACtD,gBAAQ,CAAC,UAAU,GAAG,4BAAkB,CAAA;AACxC,gBAAQ,CAAC,OAAO,GAAG,IAAkC,CAAA;AAErD,mCAAgB,CAAC,iBAAiB,CAAC,gBAAQ,CAAC,CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDropzone = useDropzone;
|
|
4
|
+
const react_dropzone_1 = require("react-dropzone");
|
|
2
5
|
/**
|
|
3
6
|
* Creates a `DropzoneHandle` — the service object that owns drag-and-drop
|
|
4
7
|
* mechanics. The returned `dropzone` field is the full react-dropzone state
|
|
@@ -10,8 +13,8 @@ import { useDropzone as useReactDropzone } from 'react-dropzone';
|
|
|
10
13
|
* File management is the caller's responsibility — use the `onDrop` callback
|
|
11
14
|
* to receive accepted and rejected files.
|
|
12
15
|
*/
|
|
13
|
-
|
|
14
|
-
const dropzone =
|
|
16
|
+
function useDropzone(options = {}) {
|
|
17
|
+
const dropzone = (0, react_dropzone_1.useDropzone)(options);
|
|
15
18
|
return { dropzone };
|
|
16
19
|
}
|
|
17
20
|
//# sourceMappingURL=useDropzone.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDropzone.js","sourceRoot":"","sources":["../../../src/components/Dropzone/useDropzone.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,65 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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);
|
|
13
33
|
/**
|
|
14
34
|
* Communicates an empty or loading state for a content region with an optional icon/image, title, and description.
|
|
15
35
|
* When `loading` is `true`, replaces all content with an `ActivityIndicator`; when `renderEmpty` is provided, it takes over the entire content layout.
|
|
16
36
|
* Uses: `Icon`, `Text`, `ActivityIndicator`
|
|
17
37
|
*/
|
|
18
|
-
|
|
38
|
+
const EmptyPlaceholder = (props) => {
|
|
19
39
|
const { itemName, title, loading, description, style, icon: IconEmpty, renderEmpty: RenderEmpty, image, imageProps, wrapperProps, imageWrapperProps, indicatorProps, debugName, ImageComponent, } = {
|
|
20
|
-
...EmptyPlaceholder.defaultProps,
|
|
40
|
+
...exports.EmptyPlaceholder.defaultProps,
|
|
21
41
|
...props,
|
|
22
42
|
};
|
|
23
|
-
const styles = useStylesFor(EmptyPlaceholder.styleRegistryName, style);
|
|
43
|
+
const styles = (0, useStylesFor_1.useStylesFor)(exports.EmptyPlaceholder.styleRegistryName, style);
|
|
24
44
|
const emptyText = title || (itemName && `No ${itemName} found.`) || 'No items.';
|
|
25
|
-
const activityIndicatorStyles = useNestedStylesByKey('loader', styles);
|
|
26
|
-
const _Image =
|
|
27
|
-
if (!TypeGuards.isNil(image)) {
|
|
28
|
-
return
|
|
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,
|
|
29
49
|
// @ts-ignore
|
|
30
50
|
source: image, css: styles.image });
|
|
31
51
|
}
|
|
32
|
-
if (TypeGuards.isNil(IconEmpty))
|
|
52
|
+
if (types_1.TypeGuards.isNil(IconEmpty))
|
|
33
53
|
return null;
|
|
34
|
-
if (TypeGuards.isString(IconEmpty)) {
|
|
35
|
-
return
|
|
54
|
+
if (types_1.TypeGuards.isString(IconEmpty)) {
|
|
55
|
+
return (0, jsx_runtime_1.jsx)(Icon_1.Icon, { debugName: debugName, icon: IconEmpty, forceStyle: styles.icon });
|
|
36
56
|
}
|
|
37
|
-
else if (
|
|
38
|
-
return
|
|
57
|
+
else if (react_1.default.isValidElement(IconEmpty)) {
|
|
58
|
+
return (0, jsx_runtime_1.jsx)(IconEmpty, { ...props });
|
|
39
59
|
}
|
|
40
60
|
}, [IconEmpty, image]);
|
|
41
61
|
if (loading) {
|
|
42
|
-
return (
|
|
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 }) }));
|
|
43
63
|
}
|
|
44
|
-
if (!TypeGuards.isNil(RenderEmpty)) {
|
|
45
|
-
return (
|
|
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: {
|
|
46
66
|
...styles,
|
|
47
67
|
activityIndicatorStyles,
|
|
48
68
|
} }) }));
|
|
49
69
|
}
|
|
50
|
-
return (
|
|
51
|
-
?
|
|
52
|
-
:
|
|
53
|
-
?
|
|
54
|
-
:
|
|
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] }));
|
|
55
75
|
};
|
|
56
|
-
EmptyPlaceholder
|
|
57
|
-
EmptyPlaceholder.
|
|
58
|
-
EmptyPlaceholder.
|
|
59
|
-
EmptyPlaceholder.
|
|
60
|
-
EmptyPlaceholder.
|
|
61
|
-
|
|
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;
|
|
62
83
|
};
|
|
63
|
-
EmptyPlaceholder.defaultProps = {};
|
|
64
|
-
WebStyleRegistry.registerComponent(EmptyPlaceholder);
|
|
84
|
+
exports.EmptyPlaceholder.defaultProps = {};
|
|
85
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.EmptyPlaceholder);
|
|
65
86
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/EmptyPlaceholder/index.tsx"],"names":[],"mappings":"
|
|
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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SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,GAAI;gBAC9E,CAAC,CAAC,eAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAErD,CACR,CAAA;AACH,CAAC,CAAA;AAzFY,QAAA,gBAAgB,oBAyF5B;AAED,wBAAgB,CAAC,iBAAiB,GAAG,kBAAkB,CAAA;AACvD,wBAAgB,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,CAAC,CAAA;AAC1G,wBAAgB,CAAC,WAAW,GAAG,SAAS,CAAA;AACxC,wBAAgB,CAAC,cAAc,GAAG,KAAK,CAAA;AACvC,wBAAgB,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACrE,OAAO,wBAA+F,CAAA;AACxG,CAAC,CAAA;AAED,wBAAgB,CAAC,YAAY,GAAG,EAAoC,CAAA;AAEpE,mCAAgB,CAAC,iBAAiB,CAAC,wBAAgB,CAAC,CAAA"}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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");
|
|
4
7
|
/** Derives stable ARIA `label` and `helper` element IDs from a base field ID. */
|
|
5
|
-
|
|
8
|
+
const getFieldIds = (baseId) => ({
|
|
6
9
|
label: baseId + '-label',
|
|
7
10
|
helper: baseId + '-helper',
|
|
8
11
|
});
|
|
12
|
+
exports.getFieldIds = getFieldIds;
|
|
9
13
|
const useFieldContextProvider = (props) => {
|
|
10
|
-
const generatedId = useId();
|
|
14
|
+
const generatedId = (0, react_1.useId)();
|
|
11
15
|
const baseId = props.id ?? generatedId;
|
|
12
|
-
const { label: labelId, helper: helperId } = getFieldIds(baseId);
|
|
16
|
+
const { label: labelId, helper: helperId } = (0, exports.getFieldIds)(baseId);
|
|
13
17
|
const stateContext = {
|
|
14
18
|
disabled: props.context?.disabled,
|
|
15
19
|
error: props.context?.error,
|
|
16
20
|
focused: props.context?.focused,
|
|
17
21
|
hasValue: props.context?.hasValue,
|
|
18
22
|
};
|
|
19
|
-
const styles = useStylesFor('Field', props?.style, stateContext);
|
|
23
|
+
const styles = (0, lib_1.useStylesFor)('Field', props?.style, stateContext);
|
|
20
24
|
const getClassName = (...suffixes) => {
|
|
21
25
|
const getClasses = (basename) => suffixes.map(s => `${basename}__${s}`).join(' ');
|
|
22
26
|
let classes = getClasses('field');
|
|
@@ -34,19 +38,21 @@ const useFieldContextProvider = (props) => {
|
|
|
34
38
|
helperId,
|
|
35
39
|
};
|
|
36
40
|
};
|
|
37
|
-
const FieldContext = createContext({});
|
|
41
|
+
const FieldContext = (0, react_1.createContext)({});
|
|
38
42
|
/**
|
|
39
43
|
* Context provider for `Field`; computes styles and state data from `FieldProps`
|
|
40
44
|
* and makes them available to all `Field.*` sub-elements.
|
|
41
45
|
* Must wrap any composition that uses `useFieldContext`.
|
|
42
46
|
*/
|
|
43
|
-
|
|
47
|
+
const FieldProvider = ({ children, ...props }) => {
|
|
44
48
|
const value = useFieldContextProvider(props);
|
|
45
|
-
return
|
|
49
|
+
return (0, jsx_runtime_1.jsx)(FieldContext.Provider, { value: value, children: children });
|
|
46
50
|
};
|
|
51
|
+
exports.FieldProvider = FieldProvider;
|
|
47
52
|
/**
|
|
48
53
|
* Reads the nearest `FieldProvider` context.
|
|
49
54
|
* Must be called inside a component rendered within `FieldProvider`.
|
|
50
55
|
*/
|
|
51
|
-
|
|
56
|
+
const useFieldContext = () => (0, react_1.useContext)(FieldContext);
|
|
57
|
+
exports.useFieldContext = useFieldContext;
|
|
52
58
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/Field/context.tsx"],"names":[],"mappings":"
|
|
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,IAAA,mBAAW,EAAC,MAAM,CAAC,CAAA;IAEhE,MAAM,YAAY,GAAqB;QACrC,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ;QACjC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK;QAC3B,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO;QAC/B,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ;KAClC,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,kBAAY,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,CAAA;IAEhE,MAAM,YAAY,GAAG,CAAC,GAAG,QAAkB,EAAE,EAAE;QAC7C,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAEjF,IAAI,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;QAEjC,IAAI,KAAK,EAAE,aAAa,EAAE,CAAC;YACzB,OAAO,IAAI,IAAI,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAA;QAClD,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;IACD,OAAO;QACL,KAAK;QACL,MAAM;QACN,YAAY;QACZ,YAAY;QACZ,OAAO;QACP,QAAQ;KACT,CAAA;AACH,CAAC,CAAA;AAGD,MAAM,YAAY,GAAG,IAAA,qBAAa,EAAC,EAAmB,CAAC,CAAA;AAEvD;;;;GAIG;AACI,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAsC,EAAE,EAAE;IAC1F,MAAM,KAAK,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAA;IAC5C,OAAO,uBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACvC,QAAQ,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"}
|
|
@@ -1,84 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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");
|
|
8
11
|
/**
|
|
9
12
|
* Renders the field label linked to the input via `aria-labelledby`.
|
|
10
13
|
* Reads content from `FieldProvider` context; renders nothing when no label is present.
|
|
11
14
|
* Must be inside `FieldProvider`.
|
|
12
15
|
*/
|
|
13
|
-
|
|
14
|
-
const ctx = useFieldContext();
|
|
16
|
+
const FieldHeading = (props) => {
|
|
17
|
+
const ctx = (0, context_1.useFieldContext)();
|
|
15
18
|
const label = props?.children ?? ctx?.props?.label;
|
|
16
19
|
if (!label && !props.component)
|
|
17
20
|
return null;
|
|
18
|
-
const Component = props?.component ?? Text;
|
|
19
|
-
return
|
|
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 });
|
|
20
23
|
};
|
|
24
|
+
exports.FieldHeading = FieldHeading;
|
|
21
25
|
/**
|
|
22
26
|
* Renders the field helper/description text.
|
|
23
27
|
* Reads content from `FieldProvider` context; renders nothing when no helper is present.
|
|
24
28
|
* Must be inside `FieldProvider`.
|
|
25
29
|
*/
|
|
26
|
-
|
|
27
|
-
const ctx = useFieldContext();
|
|
30
|
+
const FieldHelper = (props) => {
|
|
31
|
+
const ctx = (0, context_1.useFieldContext)();
|
|
28
32
|
const label = props?.children ?? ctx?.props?.helper;
|
|
29
33
|
if (!label && !props.component)
|
|
30
34
|
return null;
|
|
31
|
-
const Component = props?.component ?? Text.Span;
|
|
32
|
-
return
|
|
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 });
|
|
33
37
|
};
|
|
38
|
+
exports.FieldHelper = FieldHelper;
|
|
34
39
|
/**
|
|
35
40
|
* Input container row that receives state `data-*` attributes from context;
|
|
36
41
|
* renders as `Touchable` when `onPress` is provided, otherwise as `View`.
|
|
37
42
|
* Must be inside `FieldProvider`.
|
|
38
43
|
* Uses: `View`, `Touchable`
|
|
39
44
|
*/
|
|
40
|
-
|
|
41
|
-
const ctx = useFieldContext();
|
|
42
|
-
const attrs = toDataAttrs(ctx.stateContext);
|
|
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);
|
|
43
48
|
if (onPress) {
|
|
44
|
-
return (
|
|
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 }));
|
|
45
50
|
}
|
|
46
|
-
return (
|
|
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 }));
|
|
47
52
|
};
|
|
53
|
+
exports.FieldBox = FieldBox;
|
|
48
54
|
/**
|
|
49
55
|
* Outermost container for the full field layout; forwards state `data-*`
|
|
50
56
|
* attributes and resolves the `wrapperRef` from context.
|
|
51
57
|
* Must be inside `FieldProvider`.
|
|
52
58
|
*/
|
|
53
|
-
|
|
54
|
-
const ctx = useFieldContext();
|
|
55
|
-
const Component = props?.component ?? View;
|
|
56
|
-
const attrs = toDataAttrs(ctx.stateContext);
|
|
57
|
-
return
|
|
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 });
|
|
58
64
|
};
|
|
65
|
+
exports.FieldWrapper = FieldWrapper;
|
|
59
66
|
/**
|
|
60
67
|
* Renders either the `leftSection` or `rightSection` prop from `FieldProvider`
|
|
61
68
|
* context; supports static ReactNode and render-function forms.
|
|
62
69
|
* Must be inside `FieldProvider`.
|
|
63
70
|
*/
|
|
64
|
-
|
|
65
|
-
const ctx = useFieldContext();
|
|
71
|
+
const SectionSlot = (props) => {
|
|
72
|
+
const ctx = (0, context_1.useFieldContext)();
|
|
66
73
|
const sectionProp = props?.position === 'left' ? ctx.props.leftSection : ctx.props.rightSection;
|
|
67
74
|
const style = props.position === 'left' ? ctx.styles.leftSection : ctx.styles.rightSection;
|
|
68
75
|
let Component = null;
|
|
69
76
|
if (props?.component) {
|
|
70
77
|
Component = props?.component;
|
|
71
78
|
}
|
|
72
|
-
else if (TypeGuards.isFunction(sectionProp)) {
|
|
79
|
+
else if (types_1.TypeGuards.isFunction(sectionProp)) {
|
|
73
80
|
Component = sectionProp;
|
|
74
81
|
}
|
|
75
82
|
else {
|
|
76
83
|
if (!sectionProp)
|
|
77
84
|
return null;
|
|
78
|
-
return
|
|
85
|
+
return (0, jsx_runtime_1.jsx)(View_1.View, { style: [ctx.styles.section, style], className: ctx.getClassName('section', `${props.position}_section`), children: sectionProp });
|
|
79
86
|
}
|
|
80
|
-
const attrs = toDataAttrs(ctx.stateContext);
|
|
87
|
+
const attrs = (0, lib_1.toDataAttrs)(ctx.stateContext);
|
|
81
88
|
const Render = Component;
|
|
82
|
-
return
|
|
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`) });
|
|
83
90
|
};
|
|
91
|
+
exports.SectionSlot = SectionSlot;
|
|
84
92
|
//# sourceMappingURL=elements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/components/Field/elements.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/components/Field/elements.tsx"],"names":[],"mappings":";;;;AACA,2CAA4C;AAC5C,kCAA8B;AAC9B,kCAA8B;AAC9B,uCAA2C;AAG3C,mCAAuC;AACvC,4CAAwC;AAQxC;;;;GAIG;AACI,MAAM,YAAY,GAAG,CAAC,KAAmB,EAAE,EAAE;IAClD,MAAM,GAAG,GAAG,IAAA,yBAAe,GAAE,CAAA;IAE7B,MAAM,KAAK,GAAG,KAAK,EAAE,QAAQ,IAAI,GAAG,EAAE,KAAK,EAAE,KAAK,CAAA;IAElD,IAAG,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS;QAAE,OAAO,IAAI,CAAA;IAE1C,MAAM,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,WAAI,CAAA;IAG1C,OAAO,uBAAC,SAAS,IAAC,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,SAAS,CAAC,YACvJ,KAAK,GACI,CAAA;AACd,CAAC,CAAA;AAbY,QAAA,YAAY,gBAaxB;AAQD;;;;GAIG;AACI,MAAM,WAAW,GAAG,CAAC,KAAkB,EAAE,EAAE;IAChD,MAAM,GAAG,GAAG,IAAA,yBAAe,GAAE,CAAA;IAE7B,MAAM,KAAK,GAAG,KAAK,EAAE,QAAQ,IAAI,GAAG,EAAE,KAAK,EAAE,MAAM,CAAA;IAEnD,IAAG,CAAC,KAAK,IAAI,C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