@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,55 @@
|
|
|
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.Field = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
+
const context_1 = require("./context");
|
|
20
|
+
const elements_1 = require("./elements");
|
|
21
|
+
const lib_1 = require("../../lib");
|
|
22
|
+
/**
|
|
23
|
+
* Form field layout shell that composes a label, input box, helper text, and
|
|
24
|
+
* left/right section slots around any input child; distributes state (disabled,
|
|
25
|
+
* error, focused, hasValue) via context to all sub-elements.
|
|
26
|
+
* Exposes: `Field.Wrapper`, `Field.Box`, `Field.Heading`, `Field.Helper`,
|
|
27
|
+
* `Field.SectionSlot`, `Field.Provider`, `Field.getIds`.
|
|
28
|
+
* Uses: `FieldProvider`, `FieldWrapper`, `FieldHeading`, `FieldBox`, `FieldHelper`,
|
|
29
|
+
* `SectionSlot`, `WebStyleRegistry`
|
|
30
|
+
*/
|
|
31
|
+
const Field = (props) => {
|
|
32
|
+
return (0, jsx_runtime_1.jsx)(context_1.FieldProvider, { ...props, children: (0, jsx_runtime_1.jsxs)(elements_1.FieldWrapper, { children: [(0, jsx_runtime_1.jsx)(elements_1.FieldHeading, {}), (0, jsx_runtime_1.jsxs)(elements_1.FieldBox, { children: [(0, jsx_runtime_1.jsx)(elements_1.SectionSlot, { position: 'left' }), props?.children, (0, jsx_runtime_1.jsx)(elements_1.SectionSlot, { position: 'right' })] }), (0, jsx_runtime_1.jsx)(elements_1.FieldHelper, {})] }) });
|
|
33
|
+
};
|
|
34
|
+
exports.Field = Field;
|
|
35
|
+
exports.Field.withVariantTypes = (styles) => {
|
|
36
|
+
return exports.Field;
|
|
37
|
+
};
|
|
38
|
+
exports.Field.styleRegistryName = 'Field';
|
|
39
|
+
exports.Field.rootElement = 'wrapper';
|
|
40
|
+
exports.Field.elements = [
|
|
41
|
+
'wrapper', 'box', 'heading', 'helper', 'section', 'leftSection', 'rightSection',
|
|
42
|
+
];
|
|
43
|
+
exports.Field.SectionSlot = elements_1.SectionSlot;
|
|
44
|
+
exports.Field.Box = elements_1.FieldBox;
|
|
45
|
+
exports.Field.Wrapper = elements_1.FieldWrapper;
|
|
46
|
+
exports.Field.Heading = elements_1.FieldHeading;
|
|
47
|
+
exports.Field.Helper = elements_1.FieldHelper;
|
|
48
|
+
exports.Field.Provider = context_1.FieldProvider;
|
|
49
|
+
exports.Field.getIds = context_1.getFieldIds;
|
|
50
|
+
lib_1.WebStyleRegistry.registerComponent(exports.Field);
|
|
51
|
+
__exportStar(require("./context"), exports);
|
|
52
|
+
__exportStar(require("./styles"), exports);
|
|
53
|
+
__exportStar(require("./types"), exports);
|
|
54
|
+
__exportStar(require("./useFieldInput"), exports);
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Field/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,uCAAsD;AACtD,yCAA2F;AAG3F,mCAA4C;AAE5C;;;;;;;;GAQG;AACI,MAAM,KAAK,GAAG,CAAC,KAA0C,EAAE,EAAE;IAElE,OAAO,uBAAC,uBAAa,OAAK,KAAK,YAC7B,wBAAC,uBAAY,eACX,uBAAC,uBAAY,KAAG,EAChB,wBAAC,mBAAQ,eACP,uBAAC,sBAAW,IAAC,QAAQ,EAAC,MAAM,GAAE,EAC7B,KAAK,EAAE,QAAQ,EAChB,uBAAC,sBAAW,IAAC,QAAQ,EAAC,OAAO,GAAE,IACtB,EACX,uBAAC,sBAAW,KAAG,IACF,GACD,CAAA;AAClB,CAAC,CAAA;AAbY,QAAA,KAAK,SAajB;AAED,aAAK,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC1D,OAAO,aAAyE,CAAA;AAClF,CAAC,CAAA;AAED,aAAK,CAAC,iBAAiB,GAAG,OAAO,CAAA;AACjC,aAAK,CAAC,WAAW,GAAG,SAAS,CAAA;AAC7B,aAAK,CAAC,QAAQ,GAAG;IACf,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc;CAChF,CAAA;AAED,aAAK,CAAC,WAAW,GAAG,sBAAW,CAAA;AAC/B,aAAK,CAAC,GAAG,GAAG,mBAAQ,CAAA;AACpB,aAAK,CAAC,OAAO,GAAG,uBAAY,CAAA;AAC5B,aAAK,CAAC,OAAO,GAAG,uBAAY,CAAA;AAC5B,aAAK,CAAC,MAAM,GAAG,sBAAW,CAAA;AAC1B,aAAK,CAAC,QAAQ,GAAG,uBAAa,CAAA;AAC9B,aAAK,CAAC,MAAM,GAAG,qBAAW,CAAA;AAE1B,sBAAgB,CAAC,iBAAiB,CAAC,aAAK,CAAC,CAAA;AAEzC,4CAAyB;AACzB,2CAAwB;AACxB,0CAAuB;AACvB,kDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Field/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Field/types.ts"],"names":[],"mappings":""}
|
|
@@ -47,7 +47,7 @@ export declare function useFieldInput<V, T extends Field<V, any, any, any> = Fie
|
|
|
47
47
|
showError: boolean;
|
|
48
48
|
isUnset: boolean;
|
|
49
49
|
validation: import("@codeleap/form").ValidationResult<any, any>;
|
|
50
|
-
value: V | import("nanostores").StoreValue<V extends object ? import("nanostores").MapStore<V> : never>;
|
|
50
|
+
value: V | import("nanostores", { with: { "resolution-mode": "import" } }).StoreValue<V extends object ? import("nanostores", { with: { "resolution-mode": "import" } }).MapStore<V> : never>;
|
|
51
51
|
} | {
|
|
52
52
|
onInputBlurred(): void;
|
|
53
53
|
hasBlurred: boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFieldInput = useFieldInput;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const form_1 = require("@codeleap/form");
|
|
6
|
+
const types_1 = require("@codeleap/types");
|
|
7
|
+
/**
|
|
8
|
+
* Bridges a `@codeleap/form` `Field` instance with an input element's DOM ref,
|
|
9
|
+
* or falls back to uncontrolled internal state when `onValueChange` and `value`
|
|
10
|
+
* are both provided.
|
|
11
|
+
*
|
|
12
|
+
* When a `field` instance is used, the hook registers blur/focus/getValue
|
|
13
|
+
* callbacks so the form layer can drive the input programmatically.
|
|
14
|
+
*
|
|
15
|
+
* Requires a `@codeleap/form` `Field` instance; does not need a React context.
|
|
16
|
+
*/
|
|
17
|
+
function useFieldInput(field, defaultField = form_1.fields.text, internalState, params = {}, deps = []) {
|
|
18
|
+
const { value, onValueChange } = internalState;
|
|
19
|
+
const hasInternalState = (0, react_1.useMemo)(() => types_1.TypeGuards.isFunction(onValueChange) && !types_1.TypeGuards.isNil(value), []);
|
|
20
|
+
const wrapperRef = (0, react_1.useRef)(undefined);
|
|
21
|
+
const innerInputRef = (0, react_1.useRef)(null);
|
|
22
|
+
const fieldHandle = hasInternalState ? {} : (0, form_1.useField)(field, [
|
|
23
|
+
{
|
|
24
|
+
blur() {
|
|
25
|
+
innerInputRef.current.blur();
|
|
26
|
+
},
|
|
27
|
+
focus() {
|
|
28
|
+
innerInputRef.current.focus();
|
|
29
|
+
},
|
|
30
|
+
getValue() {
|
|
31
|
+
return innerInputRef.current.value;
|
|
32
|
+
},
|
|
33
|
+
scrollIntoView() {
|
|
34
|
+
return;
|
|
35
|
+
},
|
|
36
|
+
...params,
|
|
37
|
+
},
|
|
38
|
+
deps
|
|
39
|
+
], defaultField);
|
|
40
|
+
const validation = fieldHandle?.validation;
|
|
41
|
+
return {
|
|
42
|
+
fieldHandle,
|
|
43
|
+
validation,
|
|
44
|
+
wrapperRef,
|
|
45
|
+
innerInputRef,
|
|
46
|
+
inputValue: (hasInternalState ? value : fieldHandle?.value),
|
|
47
|
+
onInputValueChange: hasInternalState ? onValueChange : fieldHandle?.setValue,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=useFieldInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFieldInput.js","sourceRoot":"","sources":["../../../src/components/Field/useFieldInput.ts"],"names":[],"mappings":";;AAcA,sCA4CC;AA1DD,iCAAuC;AACvC,yCAAmE;AACnE,2CAAuD;AAEvD;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAC3B,KAAQ,EACR,eAA2C,aAAM,CAAC,IAAe,EACjE,aAA8D,EAC9D,SAAgC,EAAE,EAClC,OAAc,EAAE;IAEhB,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,aAAa,CAAA;IAE9C,MAAM,gBAAgB,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,kBAAU,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,kBAAU,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;IAE5G,MAAM,UAAU,GAAG,IAAA,cAAM,EAAiB,SAAS,CAAC,CAAA;IAEpD,MAAM,aAAa,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAA;IAEpD,MAAM,WAAW,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAA0C,CAAC,CAAC,CAAC,IAAA,eAAQ,EAAO,KAAU,EAAE;QAC7G;YACE,IAAI;gBACF,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;YAC9B,CAAC;YACD,KAAK;gBACH,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;YAC/B,CAAC;YACD,QAAQ;gBACN,OAAO,aAAa,CAAC,OAAO,CAAC,KAAU,CAAA;YACzC,CAAC;YACD,cAAc;gBACZ,OAAM;YACR,CAAC;YACD,GAAG,MAAM;SACV;QACD,IAAI;KAC8B,EAAE,YAAY,CAAC,CAAA;IAEnD,MAAM,UAAU,GAAG,WAAW,EAAE,UAAU,CAAA;IAE1C,OAAO;QACL,WAAW;QACX,UAAU;QACV,UAAU;QACV,aAAa;QACb,UAAU,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,CAAM;QAChE,kBAAkB,EAAE,gBAAgB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,EAAE,QAAQ;KAC7E,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
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.FileInput = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
const types_1 = require("@codeleap/types");
|
|
21
|
+
const hooks_1 = require("@codeleap/hooks");
|
|
22
|
+
__exportStar(require("./types"), exports);
|
|
23
|
+
/**
|
|
24
|
+
* Invisible file-input that delegates file selection to the browser's native picker, exposed imperatively via `ref`.
|
|
25
|
+
* Renders a zero-size hidden `<input type="file">` — pair with a visible trigger that calls `ref.current.openFilePicker()`.
|
|
26
|
+
* Uses: `FileInputRef`
|
|
27
|
+
*/
|
|
28
|
+
const FileInput = (props) => {
|
|
29
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
30
|
+
const { onFileSelect, autoClear, onChange, ref, ...inputProps } = {
|
|
31
|
+
...exports.FileInput.defaultProps,
|
|
32
|
+
...props,
|
|
33
|
+
};
|
|
34
|
+
const resolveWithFile = (0, react_1.useRef)(undefined);
|
|
35
|
+
const clearInput = (0, hooks_1.useCallback)(() => {
|
|
36
|
+
if (!inputRef.current)
|
|
37
|
+
return;
|
|
38
|
+
inputRef.current.value = null;
|
|
39
|
+
}, []);
|
|
40
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
41
|
+
openFilePicker: () => {
|
|
42
|
+
inputRef.current.click();
|
|
43
|
+
return new Promise((resolve) => {
|
|
44
|
+
resolveWithFile.current = resolve;
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
clear: clearInput,
|
|
48
|
+
}));
|
|
49
|
+
async function handleChange(e) {
|
|
50
|
+
if (!e.target.files.length)
|
|
51
|
+
return;
|
|
52
|
+
if (types_1.TypeGuards.isFunction(onChange))
|
|
53
|
+
onChange(e);
|
|
54
|
+
const fileArray = Array.from(e.target?.files || []);
|
|
55
|
+
const files = fileArray.map((obj) => ({
|
|
56
|
+
file: obj,
|
|
57
|
+
preview: URL.createObjectURL(obj),
|
|
58
|
+
}));
|
|
59
|
+
onFileSelect && onFileSelect(files);
|
|
60
|
+
if (resolveWithFile.current) {
|
|
61
|
+
await resolveWithFile.current(files);
|
|
62
|
+
resolveWithFile.current = undefined;
|
|
63
|
+
}
|
|
64
|
+
if (autoClear)
|
|
65
|
+
clearInput();
|
|
66
|
+
}
|
|
67
|
+
return ((0, jsx_runtime_1.jsx)("input", { type: 'file', style: { visibility: 'hidden', width: 0, height: 0, opacity: 0, display: 'none' }, ...inputProps, ref: inputRef, onChange: handleChange }));
|
|
68
|
+
};
|
|
69
|
+
exports.FileInput = FileInput;
|
|
70
|
+
exports.FileInput.defaultProps = {
|
|
71
|
+
autoClear: true,
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FileInput/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iCAA0D;AAC1D,2CAA0D;AAC1D,2CAA6C;AAG7C,0CAAuB;AAEvB;;;;GAIG;AACI,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE,EAAE;IACjD,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAA;IAE/C,MAAM,EACJ,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,EACH,GAAG,UAAU,EACd,GAAG;QACF,GAAG,iBAAS,CAAC,YAAY;QACzB,GAAG,KAAK;KACT,CAAA;IAED,MAAM,eAAe,GAAG,IAAA,cAAM,EAAgC,SAAS,CAAC,CAAA;IAExE,MAAM,UAAU,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAClC,IAAI,CAAC,QAAQ,CAAC,OAAO;YAAE,OAAM;QAC7B,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAA;IAC/B,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,IAAA,2BAAmB,EAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,cAAc,EAAE,GAAG,EAAE;YACnB,QAAQ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CAAC,CAAA;AA9DY,QAAA,SAAS,aA8DrB;AAED,iBAAS,CAAC,YAAY,GAAG;IACvB,SAAS,EAAE,IAAI;CACW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/FileInput/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
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.Icon = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
+
const View_1 = require("../View");
|
|
20
|
+
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
21
|
+
const styles_1 = require("@codeleap/styles");
|
|
22
|
+
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
23
|
+
const types_1 = require("@codeleap/types");
|
|
24
|
+
const Touchable_1 = require("../Touchable");
|
|
25
|
+
__exportStar(require("./styles"), exports);
|
|
26
|
+
__exportStar(require("./types"), exports);
|
|
27
|
+
/**
|
|
28
|
+
* Renders a theme-registered SVG icon; automatically wraps in `Touchable` when
|
|
29
|
+
* `onPress` is provided, and can render a sized empty placeholder when `icon` is absent.
|
|
30
|
+
* Uses: `Touchable`, `View`, `useStylesFor`, `WebStyleRegistry`
|
|
31
|
+
*/
|
|
32
|
+
const Icon = (props) => {
|
|
33
|
+
const { icon, style, onPress, renderEmptySpace, debugName, ...otherProps } = {
|
|
34
|
+
...exports.Icon.defaultProps,
|
|
35
|
+
...props,
|
|
36
|
+
};
|
|
37
|
+
const themeIcons = (0, styles_1.useTheme)(store => store.theme?.icons);
|
|
38
|
+
const styles = (0, useStylesFor_1.useStylesFor)(exports.Icon.styleRegistryName, style);
|
|
39
|
+
const Component = themeIcons?.[icon];
|
|
40
|
+
if (!icon) {
|
|
41
|
+
const iconStyle = styles.icon;
|
|
42
|
+
return renderEmptySpace ? ((0, jsx_runtime_1.jsx)(View_1.View, { style: {
|
|
43
|
+
height: iconStyle.size ?? iconStyle.height,
|
|
44
|
+
width: iconStyle.size ?? iconStyle.width,
|
|
45
|
+
} })) : null;
|
|
46
|
+
}
|
|
47
|
+
if (!Component)
|
|
48
|
+
return null;
|
|
49
|
+
if (types_1.TypeGuards.isFunction(onPress)) {
|
|
50
|
+
return (0, jsx_runtime_1.jsx)(Touchable_1.Touchable, { debugName: debugName, component: Component, onPress: onPress, ...otherProps, css: styles.icon });
|
|
51
|
+
}
|
|
52
|
+
return (0, jsx_runtime_1.jsx)(Component, { ...otherProps, css: styles.icon });
|
|
53
|
+
};
|
|
54
|
+
exports.Icon = Icon;
|
|
55
|
+
exports.Icon.Accessory = (props) => {
|
|
56
|
+
const AcessoryIcon = (renderProps) => {
|
|
57
|
+
return (0, jsx_runtime_1.jsx)(exports.Icon, { ...renderProps, ...props });
|
|
58
|
+
};
|
|
59
|
+
return AcessoryIcon;
|
|
60
|
+
};
|
|
61
|
+
exports.Icon.styleRegistryName = 'Icon';
|
|
62
|
+
exports.Icon.elements = ['icon'];
|
|
63
|
+
exports.Icon.rootElement = 'icon';
|
|
64
|
+
exports.Icon.withVariantTypes = (styles) => {
|
|
65
|
+
return exports.Icon;
|
|
66
|
+
};
|
|
67
|
+
exports.Icon.defaultProps = {};
|
|
68
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.Icon);
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Icon/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,kCAA8B;AAC9B,+DAA2D;AAC3D,6CAA2F;AAC3F,iEAA6D;AAE7D,2CAA4C;AAC5C,4CAAwC;AAExC,2CAAwB;AACxB,0CAAuB;AAEvB;;;;GAIG;AACI,MAAM,IAAI,GAAG,CAAC,KAAe,EAAE,EAAE;IACtC,MAAM,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,GAAG,UAAU,EACd,GAAG;QACF,GAAG,YAAI,CAAC,YAAY;QACpB,GAAG,KAAK;KACT,CAAA;IAED,MAAM,UAAU,GAAG,IAAA,iBAAQ,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAExD,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,YAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE1D,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC,IAAI,CAAC,CAAA;IAEpC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,SAAS,GAAG,MAAM,CAAC,IAA8C,CAAA;QAEvE,OAAO,gBAAgB,CAAC,CAAC,CAAC,CACxB,uBAAC,WAAI,IACH,KAAK,EAAE;gBACL,MAAM,EAAE,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,MAAM;gBAC1C,KAAK,EAAE,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,KAAK;aACzC,GACD,CACH,CAAC,CAAC,CAAC,IAAI,CAAA;IACV,CAAC;IAED,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAA;IAE3B,IAAI,kBAAU,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACnC,OAAO,uBAAC,qBAAS,IACf,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,KACZ,UAAU,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,GAChC,CAAA;IACJ,CAAC;IAED,OAAO,uBAAC,SAAS,OAAK,UAAU,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,GAAI,CAAA;AACxD,CAAC,CAAA;AA5CY,QAAA,IAAI,QA4ChB;AAED,YAAI,CAAC,SAAS,GAAG,CAAC,KAAe,EAAE,EAAE;IACnC,MAAM,YAAY,GAAI,CAAC,WAA+B,EAAE,EAAE;QACxD,OAAO,uBAAC,YAAI,OACN,WAAW,KACX,KAAK,GACT,CAAA;IACJ,CAAC,CAAA;IACD,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAED,YAAI,CAAC,iBAAiB,GAAG,MAAM,CAAA;AAC/B,YAAI,CAAC,QAAQ,GAAG,CAAC,MAAM,CAAC,CAAA;AACxB,YAAI,CAAC,WAAW,GAAG,MAAM,CAAA;AAEzB,YAAI,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACzD,OAAO,YAAuE,CAAA;AAChF,CAAC,CAAA;AAED,YAAI,CAAC,YAAY,GAAG,EAAwB,CAAA;AAE5C,mCAAgB,CAAC,iBAAiB,CAAC,YAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Icon/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Icon/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListProvider = exports.useListContext = exports.ListContext = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const hooks_1 = require("@codeleap/hooks");
|
|
7
|
+
const utils_1 = require("@codeleap/utils");
|
|
8
|
+
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
9
|
+
const useIsomorphicEffect_1 = require("../../lib/hooks/useIsomorphicEffect");
|
|
10
|
+
const scroll_1 = require("./scroll");
|
|
11
|
+
const LIST_STYLE_REGISTRY_NAME = 'List';
|
|
12
|
+
function resolvePadding(props, stylePositioner) {
|
|
13
|
+
const get = (key) => props[key] ?? stylePositioner?.[key];
|
|
14
|
+
const p = get('padding') ?? 0;
|
|
15
|
+
const ph = get('paddingHorizontal') ?? p;
|
|
16
|
+
const pv = get('paddingVertical') ?? p;
|
|
17
|
+
return {
|
|
18
|
+
paddingTop: get('paddingTop') ?? pv,
|
|
19
|
+
paddingBottom: get('paddingBottom') ?? pv,
|
|
20
|
+
paddingLeft: get('paddingLeft') ?? ph,
|
|
21
|
+
paddingRight: get('paddingRight') ?? ph,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function useListProvider(props) {
|
|
25
|
+
const wrapperRef = (0, react_1.useRef)(null);
|
|
26
|
+
const [wrapperLayout, setWrapperLayout] = (0, react_1.useState)(null);
|
|
27
|
+
const styles = (0, useStylesFor_1.useStylesFor)(LIST_STYLE_REGISTRY_NAME, props.style);
|
|
28
|
+
const stylePositioner = styles?.positioner ?? {};
|
|
29
|
+
const update = (0, react_1.useCallback)((target) => {
|
|
30
|
+
const rect = target.getBoundingClientRect();
|
|
31
|
+
const next = { width: rect.width, offsetHeight: target.offsetHeight };
|
|
32
|
+
setWrapperLayout(current => (0, utils_1.deepEqual)(next, current) ? current : next);
|
|
33
|
+
}, []);
|
|
34
|
+
const { debounce: updateDebounced } = (0, hooks_1.useDebounceCallback)(update, 200);
|
|
35
|
+
(0, useIsomorphicEffect_1.useIsomorphicEffect)(() => {
|
|
36
|
+
if (typeof window === 'undefined')
|
|
37
|
+
return;
|
|
38
|
+
const el = wrapperRef.current;
|
|
39
|
+
if (!el)
|
|
40
|
+
return;
|
|
41
|
+
update(el);
|
|
42
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
43
|
+
updateDebounced(entry.target);
|
|
44
|
+
});
|
|
45
|
+
observer.observe(el);
|
|
46
|
+
return () => observer.disconnect();
|
|
47
|
+
}, [wrapperRef.current, update, updateDebounced]);
|
|
48
|
+
const scrollHook = props.scrollHook ?? (props.windowScroll ? scroll_1.useWindowScroll : scroll_1.useElementScroll);
|
|
49
|
+
const ready = !!wrapperLayout;
|
|
50
|
+
return {
|
|
51
|
+
wrapperRef,
|
|
52
|
+
wrapperLayout,
|
|
53
|
+
styles: styles,
|
|
54
|
+
props,
|
|
55
|
+
scrollHook,
|
|
56
|
+
ready,
|
|
57
|
+
padding: resolvePadding(props, stylePositioner),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
exports.ListContext = (0, react_1.createContext)(null);
|
|
61
|
+
/**
|
|
62
|
+
* Returns the nearest `List.Provider` context value.
|
|
63
|
+
* Throws when `required` is `true` (default) and no provider is found; pass `false` to allow optional usage.
|
|
64
|
+
*/
|
|
65
|
+
const useListContext = (required = true) => {
|
|
66
|
+
const ctx = (0, react_1.useContext)(exports.ListContext);
|
|
67
|
+
if (!ctx && required)
|
|
68
|
+
throw new Error('useListContext must be used inside List.Provider');
|
|
69
|
+
return ctx;
|
|
70
|
+
};
|
|
71
|
+
exports.useListContext = useListContext;
|
|
72
|
+
/**
|
|
73
|
+
* Provides layout measurements, resolved styles, scroll state, and positioner config to all List sub-components.
|
|
74
|
+
* Must wrap `List.Wrapper` / `List.Items`; `List` renders this automatically when used as the top-level component.
|
|
75
|
+
*/
|
|
76
|
+
const ListProvider = (props) => {
|
|
77
|
+
const value = useListProvider(props);
|
|
78
|
+
return ((0, jsx_runtime_1.jsx)(exports.ListContext, { value: value, children: props.children }));
|
|
79
|
+
};
|
|
80
|
+
exports.ListProvider = ListProvider;
|
|
81
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/List/context.tsx"],"names":[],"mappings":";;;;AAAA,iCAAkG;AAClG,2CAAqD;AACrD,2CAA2C;AAC3C,+DAA2D;AAC3D,6EAAyE;AACzE,qCAA4D;AAI5D,MAAM,wBAAwB,GAAG,MAAM,CAAA;AAEvC,SAAS,cAAc,CAAC,KAAwB,EAAE,eAAoC;IACpF,MAAM,GAAG,GAAG,CAAC,GAA2B,EAAE,EAAE,CAAE,KAAa,CAAC,GAAG,CAAC,IAAI,eAAe,EAAE,CAAC,GAAG,CAAC,CAAA;IAE1F,MAAM,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAC7B,MAAM,EAAE,GAAG,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACxC,MAAM,EAAE,GAAG,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;IAEtC,OAAO;QACL,UAAU,EAAE,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE;QACnC,aAAa,EAAE,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE;QACzC,WAAW,EAAE,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE;QACrC,YAAY,EAAE,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE;KACxC,CAAA;AACH,CAAC;AAED,SAAS,eAAe,CAAC,KAAwB;IAC/C,MAAM,UAAU,GAAG,IAAA,cAAM,EAAc,IAAI,CAAC,CAAA;IAC5C,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAA2B,IAAI,CAAC,CAAA;IAElF,MAAM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U,GACd,KAAK,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,wBAAe,CAAC,CAAC,CAAC,yBAAgB,CAAC,CAAA;IAE/E,MAAM,KAAK,GAAG,CAAC,CAAC,aAAa,CAAA;IAE7B,OAAO;QACL,UAAU;QACV,aAAa;QACb,MAAM,EAAE,MAAsC;QAC9C,KAAK;QACL,UAAU;QACV,KAAK;QACL,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,eAAe,CAAC;KAChD,CAAA;AACH,CAAC;AAIY,QAAA,WAAW,GAAG,IAAA,qBAAa,EAA0B,IAAI,CAAC,CAAA;AAEvE;;;GAGG;AACI,MAAM,cAAc,GAAG,CAAC,QAAQ,GAAC,IAAI,EAAoB,EAAE;IAChE,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,mBAAW,CAAC,CAAA;IACnC,IAAI,CAAC,GAAG,IAAI,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;IACzF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAJY,QAAA,cAAc,kBAI1B;AAED;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,KAAwB,EAAE,EAAE;IACvD,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IACpC,OAAO,CACL,uBAAC,mBAAW,IAAC,KAAK,EAAE,KAAK,YACtB,KAAK,CAAC,QAAQ,GACH,CACf,CAAA;AACH,CAAC,CAAA;AAPY,QAAA,YAAY,gBAOxB"}
|
|
@@ -0,0 +1,164 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ListPlaceholder = exports.ListFooter = exports.ListHeader = exports.ListWrapper = void 0;
|
|
37
|
+
exports.ListItems = ListItems;
|
|
38
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const masonic_1 = require("masonic");
|
|
41
|
+
const types_1 = require("@codeleap/types");
|
|
42
|
+
const View_1 = require("../View");
|
|
43
|
+
const context_1 = require("./context");
|
|
44
|
+
/**
|
|
45
|
+
* Outer `View` that measures its own dimensions for the Masonic positioner via a `ResizeObserver`.
|
|
46
|
+
* Must be rendered inside `List.Provider`; forwards extra `ViewProps` to the underlying `View`.
|
|
47
|
+
*/
|
|
48
|
+
const ListWrapper = ({ children, ...viewProps }) => {
|
|
49
|
+
const { wrapperRef, styles, padding } = (0, context_1.useListContext)();
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(View_1.View, { ...viewProps, css: [styles.wrapper, padding, viewProps.css], ref: wrapperRef, children: children }));
|
|
51
|
+
};
|
|
52
|
+
exports.ListWrapper = ListWrapper;
|
|
53
|
+
function _ListItemsContent({ data, renderItem: providedRenderItem, fetchNextPage: itemsFetchNextPage, hasNextPage: itemsHasNextPage, ref, }) {
|
|
54
|
+
const { wrapperRef, wrapperLayout, scrollHook, styles, props, padding } = (0, context_1.useListContext)();
|
|
55
|
+
const fetchNextPage = itemsFetchNextPage ?? props.fetchNextPage;
|
|
56
|
+
const hasNextPage = itemsHasNextPage ?? props.hasNextPage;
|
|
57
|
+
const { scrollTop, isScrolling, height, width, scrollElement } = scrollHook(wrapperRef, wrapperLayout);
|
|
58
|
+
const innerWidth = width - padding.paddingLeft - padding.paddingRight;
|
|
59
|
+
const stylePositioner = styles.positioner ?? {};
|
|
60
|
+
const positionerConfig = {
|
|
61
|
+
columnCount: props.columnCount ?? stylePositioner.columnCount ?? 1,
|
|
62
|
+
columnGutter: props.columnGutter ?? stylePositioner.columnGutter,
|
|
63
|
+
columnWidth: props.columnWidth ?? stylePositioner.columnWidth,
|
|
64
|
+
maxColumnCount: props.maxColumnCount ?? stylePositioner.maxColumnCount,
|
|
65
|
+
maxColumnWidth: props.maxColumnWidth ?? stylePositioner.maxColumnWidth,
|
|
66
|
+
rowGutter: props.rowGutter ?? stylePositioner.rowGutter,
|
|
67
|
+
};
|
|
68
|
+
const positioner = (0, masonic_1.usePositioner)({ width: Math.max(0, innerWidth), ...positionerConfig }, [data]);
|
|
69
|
+
const resizeObserver = (0, masonic_1.useResizeObserver)(positioner);
|
|
70
|
+
const scrollToIndexFn = (0, masonic_1.useScrollToIndex)(positioner, {
|
|
71
|
+
element: scrollElement,
|
|
72
|
+
height,
|
|
73
|
+
});
|
|
74
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
75
|
+
scrollToIndex: (index, options) => {
|
|
76
|
+
scrollToIndexFn(index);
|
|
77
|
+
},
|
|
78
|
+
}), [scrollToIndexFn]);
|
|
79
|
+
const maybeLoadMore = (0, masonic_1.useInfiniteLoader)(async () => {
|
|
80
|
+
if (hasNextPage)
|
|
81
|
+
fetchNextPage?.();
|
|
82
|
+
}, {
|
|
83
|
+
isItemLoaded: (index, items) => !!items?.[index],
|
|
84
|
+
...props.infiniteLoaderProps,
|
|
85
|
+
});
|
|
86
|
+
const separator = (0, react_1.useMemo)(() => {
|
|
87
|
+
if (!props.separators)
|
|
88
|
+
return null;
|
|
89
|
+
return props.ItemSeparatorComponent ?? null;
|
|
90
|
+
}, [props.separators, props.ItemSeparatorComponent]);
|
|
91
|
+
const dataLength = data?.length ?? 0;
|
|
92
|
+
const wrappedRenderItem = (0, react_1.useCallback)((masonryProps) => {
|
|
93
|
+
if (!providedRenderItem)
|
|
94
|
+
return null;
|
|
95
|
+
const { index, data: item } = masonryProps;
|
|
96
|
+
const isFirst = index === 0;
|
|
97
|
+
const isLast = index === dataLength - 1;
|
|
98
|
+
const isOnly = dataLength === 1;
|
|
99
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isFirst ? null : separator, providedRenderItem({
|
|
100
|
+
...masonryProps,
|
|
101
|
+
item,
|
|
102
|
+
isFirst,
|
|
103
|
+
isLast,
|
|
104
|
+
isOnly,
|
|
105
|
+
})] });
|
|
106
|
+
}, [providedRenderItem, separator, dataLength]);
|
|
107
|
+
return (0, masonic_1.useMasonry)({
|
|
108
|
+
positioner,
|
|
109
|
+
resizeObserver,
|
|
110
|
+
height: Math.max(1, height),
|
|
111
|
+
scrollTop,
|
|
112
|
+
isScrolling,
|
|
113
|
+
items: data ?? [],
|
|
114
|
+
render: wrappedRenderItem,
|
|
115
|
+
onRender: maybeLoadMore,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Renders the virtualized Masonic grid once the `List.Wrapper` layout is ready; returns `null` until then.
|
|
120
|
+
* Handles infinite loading via Masonic's `useInfiniteLoader`, item separators, and exposes a `scrollToIndex` imperative handle via `ref`.
|
|
121
|
+
* Must be rendered inside `List.Provider`.
|
|
122
|
+
*/
|
|
123
|
+
function ListItems(props) {
|
|
124
|
+
const { ready } = (0, context_1.useListContext)();
|
|
125
|
+
if (!ready)
|
|
126
|
+
return null;
|
|
127
|
+
return (0, jsx_runtime_1.jsx)(_ListItemsContent, { ...props });
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Styled slot rendered above `List.Items`; applies the `header` composition style from the list's style sheet.
|
|
131
|
+
* Must be rendered inside `List.Provider`.
|
|
132
|
+
*/
|
|
133
|
+
const ListHeader = ({ children, ...viewProps }) => {
|
|
134
|
+
const { styles } = (0, context_1.useListContext)();
|
|
135
|
+
return ((0, jsx_runtime_1.jsx)(View_1.View, { ...viewProps, css: [styles.header, viewProps.css], children: children }));
|
|
136
|
+
};
|
|
137
|
+
exports.ListHeader = ListHeader;
|
|
138
|
+
/**
|
|
139
|
+
* Styled slot rendered below `List.Items`; falls back to `ListProviderProps.ListFooterComponent` when no `children` are given.
|
|
140
|
+
* Renders nothing when both sources are empty. Must be rendered inside `List.Provider`.
|
|
141
|
+
*/
|
|
142
|
+
const ListFooter = ({ children, ...viewProps }) => {
|
|
143
|
+
const { styles, props } = (0, context_1.useListContext)();
|
|
144
|
+
const footer = children ?? (types_1.TypeGuards.isFunction(props.ListFooterComponent)
|
|
145
|
+
? props.ListFooterComponent()
|
|
146
|
+
: props.ListFooterComponent);
|
|
147
|
+
if (!footer)
|
|
148
|
+
return null;
|
|
149
|
+
return ((0, jsx_runtime_1.jsx)(View_1.View, { ...viewProps, css: [styles.footer, viewProps.css], children: footer }));
|
|
150
|
+
};
|
|
151
|
+
exports.ListFooter = ListFooter;
|
|
152
|
+
/**
|
|
153
|
+
* Renders `ListProviderProps.placeholder` when it is a valid React element; otherwise renders nothing.
|
|
154
|
+
* Typically used to show an `EmptyPlaceholder` when the list has no data. Must be rendered inside `List.Provider`.
|
|
155
|
+
*/
|
|
156
|
+
const ListPlaceholder = () => {
|
|
157
|
+
const { props } = (0, context_1.useListContext)();
|
|
158
|
+
const { placeholder } = props;
|
|
159
|
+
if (react_1.default.isValidElement(placeholder))
|
|
160
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: placeholder });
|
|
161
|
+
return null;
|
|
162
|
+
};
|
|
163
|
+
exports.ListPlaceholder = ListPlaceholder;
|
|
164
|
+
//# sourceMappingURL=elements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/components/List/elements.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,8BAIC;;AAjID,+CAAwE;AACxE,qCAOgB;AAChB,2CAA4C;AAC5C,kCAAyC;AACzC,uCAA0C;AAG1C;;;GAGG;AACI,MAAM,WAAW,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAa,EAAE,EAAE;IACnE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,wBAAc,GAAE,CAAA;IACxD,OAAO,CACL,uBAAC,WAAI,OAAK,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAG,SAAiB,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,UAA6C,YAC5H,QAAQ,GACJ,CACR,CAAA;AACH,CAAC,CAAA;AAPY,QAAA,WAAW,eAOvB;AAED,SAAS,iBAAiB,CAAqB,EAC7C,IAAI,EACJ,UAAU,EAAE,kBAAkB,EAC9B,aAAa,EAAE,kBAAkB,EACjC,WAAW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GAAG,IAAA,wBAAc,GAAE,CAAA;IAC1C,MAAM,MAAM,GAAG,QAAQ,IAAI,CACzB,kBAAU,CAAC,UAAU,CAAC,KAAK,CAAC,mBAAmB,CAAC;QAC9C,CAAC,CAAC,KAAK,CAAC,mBAAmB,EAAE;QAC7B,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAC9B,CAAA;IACD,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IACxB,OAAO,CACL,uBAAC,WAAI,OAAK,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAG,SAAiB,CAAC,GAAG,CAAC,YAC9D,MAAM,GACF,CACR,CAAA;AACH,CAAC,CAAA;AAbY,QAAA,UAAU,cAatB;AAED;;;GAGG;AACI,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,wBAAc,GAAE,CAAA;IAClC,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAA;IAC7B,IAAI,eAAK,CAAC,cAAc,CAAC,WAAW,CAAC;QAAE,OAAO,2DAAG,WAAW,GAAI,CAAA;IAChE,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AALY,QAAA,eAAe,mBAK3B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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.List = List;
|
|
18
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
+
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
20
|
+
const context_1 = require("./context");
|
|
21
|
+
const elements_1 = require("./elements");
|
|
22
|
+
__exportStar(require("./styles"), exports);
|
|
23
|
+
__exportStar(require("./types"), exports);
|
|
24
|
+
__exportStar(require("./context"), exports);
|
|
25
|
+
__exportStar(require("./elements"), exports);
|
|
26
|
+
__exportStar(require("./scroll"), exports);
|
|
27
|
+
/**
|
|
28
|
+
* Virtualized, optionally multi-column list with built-in infinite scroll, item separators, and a programmable scroll handle.
|
|
29
|
+
* Rendering is powered by Masonic; the list measures its container via `ResizeObserver` and will not render items until layout is ready.
|
|
30
|
+
* Uses: `List.Provider`, `List.Wrapper`, `List.Items`, `List.Footer`, `List.Placeholder`
|
|
31
|
+
*/
|
|
32
|
+
function List(props) {
|
|
33
|
+
const { data, renderItem, fetchNextPage, hasNextPage, ...providerProps } = { ...List.defaultProps, ...props };
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(context_1.ListProvider, { ...providerProps, children: (0, jsx_runtime_1.jsxs)(elements_1.ListWrapper, { children: [(0, jsx_runtime_1.jsx)(elements_1.ListPlaceholder, {}), (0, jsx_runtime_1.jsx)(elements_1.ListItems, { data: data, renderItem: renderItem, fetchNextPage: fetchNextPage, hasNextPage: hasNextPage }), (0, jsx_runtime_1.jsx)(elements_1.ListFooter, {})] }) }));
|
|
35
|
+
}
|
|
36
|
+
List.Provider = context_1.ListProvider;
|
|
37
|
+
List.Wrapper = elements_1.ListWrapper;
|
|
38
|
+
List.Items = elements_1.ListItems;
|
|
39
|
+
List.Header = elements_1.ListHeader;
|
|
40
|
+
List.Footer = elements_1.ListFooter;
|
|
41
|
+
List.Placeholder = elements_1.ListPlaceholder;
|
|
42
|
+
List.styleRegistryName = 'List';
|
|
43
|
+
List.elements = ['wrapper', 'list', 'header', 'footer', 'separator', 'placeholder', 'positioner'];
|
|
44
|
+
List.rootElement = 'wrapper';
|
|
45
|
+
List.withVariantTypes = (styles) => {
|
|
46
|
+
return List;
|
|
47
|
+
};
|
|
48
|
+
List.defaultProps = {
|
|
49
|
+
separators: true,
|
|
50
|
+
};
|
|
51
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(List);
|
|
52
|
+
//# sourceMappingURL=index.js.map
|