@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,7 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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");
|
|
5
22
|
/**
|
|
6
23
|
* Form field layout shell that composes a label, input box, helper text, and
|
|
7
24
|
* left/right section slots around any input child; distributes state (disabled,
|
|
@@ -11,27 +28,28 @@ import { WebStyleRegistry } from '../../lib';
|
|
|
11
28
|
* Uses: `FieldProvider`, `FieldWrapper`, `FieldHeading`, `FieldBox`, `FieldHelper`,
|
|
12
29
|
* `SectionSlot`, `WebStyleRegistry`
|
|
13
30
|
*/
|
|
14
|
-
|
|
15
|
-
return
|
|
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, {})] }) });
|
|
16
33
|
};
|
|
17
|
-
Field
|
|
18
|
-
|
|
34
|
+
exports.Field = Field;
|
|
35
|
+
exports.Field.withVariantTypes = (styles) => {
|
|
36
|
+
return exports.Field;
|
|
19
37
|
};
|
|
20
|
-
Field.styleRegistryName = 'Field';
|
|
21
|
-
Field.rootElement = 'wrapper';
|
|
22
|
-
Field.elements = [
|
|
38
|
+
exports.Field.styleRegistryName = 'Field';
|
|
39
|
+
exports.Field.rootElement = 'wrapper';
|
|
40
|
+
exports.Field.elements = [
|
|
23
41
|
'wrapper', 'box', 'heading', 'helper', 'section', 'leftSection', 'rightSection',
|
|
24
42
|
];
|
|
25
|
-
Field.SectionSlot = SectionSlot;
|
|
26
|
-
Field.Box = FieldBox;
|
|
27
|
-
Field.Wrapper = FieldWrapper;
|
|
28
|
-
Field.Heading = FieldHeading;
|
|
29
|
-
Field.Helper = FieldHelper;
|
|
30
|
-
Field.Provider = FieldProvider;
|
|
31
|
-
Field.getIds = getFieldIds;
|
|
32
|
-
WebStyleRegistry.registerComponent(Field);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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);
|
|
37
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Field/index.tsx"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -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;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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");
|
|
4
7
|
/**
|
|
5
8
|
* Bridges a `@codeleap/form` `Field` instance with an input element's DOM ref,
|
|
6
9
|
* or falls back to uncontrolled internal state when `onValueChange` and `value`
|
|
@@ -11,12 +14,12 @@ import { TypeGuards } from '@codeleap/types';
|
|
|
11
14
|
*
|
|
12
15
|
* Requires a `@codeleap/form` `Field` instance; does not need a React context.
|
|
13
16
|
*/
|
|
14
|
-
|
|
17
|
+
function useFieldInput(field, defaultField = form_1.fields.text, internalState, params = {}, deps = []) {
|
|
15
18
|
const { value, onValueChange } = internalState;
|
|
16
|
-
const hasInternalState = useMemo(() => TypeGuards.isFunction(onValueChange) && !TypeGuards.isNil(value), []);
|
|
17
|
-
const wrapperRef = useRef(undefined);
|
|
18
|
-
const innerInputRef = useRef(null);
|
|
19
|
-
const fieldHandle = hasInternalState ? {} : useField(field, [
|
|
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, [
|
|
20
23
|
{
|
|
21
24
|
blur() {
|
|
22
25
|
innerInputRef.current.blur();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFieldInput.js","sourceRoot":"","sources":["../../../src/components/Field/useFieldInput.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,26 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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);
|
|
6
23
|
/**
|
|
7
24
|
* Invisible file-input that delegates file selection to the browser's native picker, exposed imperatively via `ref`.
|
|
8
25
|
* Renders a zero-size hidden `<input type="file">` — pair with a visible trigger that calls `ref.current.openFilePicker()`.
|
|
9
26
|
* Uses: `FileInputRef`
|
|
10
27
|
*/
|
|
11
|
-
|
|
12
|
-
const inputRef = useRef(null);
|
|
28
|
+
const FileInput = (props) => {
|
|
29
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
13
30
|
const { onFileSelect, autoClear, onChange, ref, ...inputProps } = {
|
|
14
|
-
...FileInput.defaultProps,
|
|
31
|
+
...exports.FileInput.defaultProps,
|
|
15
32
|
...props,
|
|
16
33
|
};
|
|
17
|
-
const resolveWithFile = useRef(undefined);
|
|
18
|
-
const clearInput = useCallback(() => {
|
|
34
|
+
const resolveWithFile = (0, react_1.useRef)(undefined);
|
|
35
|
+
const clearInput = (0, hooks_1.useCallback)(() => {
|
|
19
36
|
if (!inputRef.current)
|
|
20
37
|
return;
|
|
21
38
|
inputRef.current.value = null;
|
|
22
39
|
}, []);
|
|
23
|
-
useImperativeHandle(ref, () => ({
|
|
40
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
24
41
|
openFilePicker: () => {
|
|
25
42
|
inputRef.current.click();
|
|
26
43
|
return new Promise((resolve) => {
|
|
@@ -32,7 +49,7 @@ export const FileInput = (props) => {
|
|
|
32
49
|
async function handleChange(e) {
|
|
33
50
|
if (!e.target.files.length)
|
|
34
51
|
return;
|
|
35
|
-
if (TypeGuards.isFunction(onChange))
|
|
52
|
+
if (types_1.TypeGuards.isFunction(onChange))
|
|
36
53
|
onChange(e);
|
|
37
54
|
const fileArray = Array.from(e.target?.files || []);
|
|
38
55
|
const files = fileArray.map((obj) => ({
|
|
@@ -47,9 +64,10 @@ export const FileInput = (props) => {
|
|
|
47
64
|
if (autoClear)
|
|
48
65
|
clearInput();
|
|
49
66
|
}
|
|
50
|
-
return (
|
|
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 }));
|
|
51
68
|
};
|
|
52
|
-
FileInput
|
|
69
|
+
exports.FileInput = FileInput;
|
|
70
|
+
exports.FileInput.defaultProps = {
|
|
53
71
|
autoClear: true,
|
|
54
72
|
};
|
|
55
73
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FileInput/index.tsx"],"names":[],"mappings":"
|
|
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,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AAS;YAAE,UAAU,EAAE,CAAA;IAC7B,CAAC;IAED,OAAO,CACL,kCACE,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAC7E,UAAU,EACd,GAAG,EAAE,QAAQ,EACb,QAAQ,EAAE,YAAY,GACtB,CACH,CAAA;AACH,CAAC,CAAA;AA9DY,QAAA,SAAS,aA8DrB;AAED,iBAAS,CAAC,YAAY,GAAG;IACvB,SAAS,EAAE,IAAI;CACW,CAAA"}
|
|
@@ -1,51 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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);
|
|
10
27
|
/**
|
|
11
28
|
* Renders a theme-registered SVG icon; automatically wraps in `Touchable` when
|
|
12
29
|
* `onPress` is provided, and can render a sized empty placeholder when `icon` is absent.
|
|
13
30
|
* Uses: `Touchable`, `View`, `useStylesFor`, `WebStyleRegistry`
|
|
14
31
|
*/
|
|
15
|
-
|
|
32
|
+
const Icon = (props) => {
|
|
16
33
|
const { icon, style, onPress, renderEmptySpace, debugName, ...otherProps } = {
|
|
17
|
-
...Icon.defaultProps,
|
|
34
|
+
...exports.Icon.defaultProps,
|
|
18
35
|
...props,
|
|
19
36
|
};
|
|
20
|
-
const themeIcons = useTheme(store => store.theme?.icons);
|
|
21
|
-
const styles = useStylesFor(Icon.styleRegistryName, style);
|
|
37
|
+
const themeIcons = (0, styles_1.useTheme)(store => store.theme?.icons);
|
|
38
|
+
const styles = (0, useStylesFor_1.useStylesFor)(exports.Icon.styleRegistryName, style);
|
|
22
39
|
const Component = themeIcons?.[icon];
|
|
23
40
|
if (!icon) {
|
|
24
41
|
const iconStyle = styles.icon;
|
|
25
|
-
return renderEmptySpace ? (
|
|
42
|
+
return renderEmptySpace ? ((0, jsx_runtime_1.jsx)(View_1.View, { style: {
|
|
26
43
|
height: iconStyle.size ?? iconStyle.height,
|
|
27
44
|
width: iconStyle.size ?? iconStyle.width,
|
|
28
45
|
} })) : null;
|
|
29
46
|
}
|
|
30
47
|
if (!Component)
|
|
31
48
|
return null;
|
|
32
|
-
if (TypeGuards.isFunction(onPress)) {
|
|
33
|
-
return
|
|
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 });
|
|
34
51
|
}
|
|
35
|
-
return
|
|
52
|
+
return (0, jsx_runtime_1.jsx)(Component, { ...otherProps, css: styles.icon });
|
|
36
53
|
};
|
|
37
|
-
Icon
|
|
54
|
+
exports.Icon = Icon;
|
|
55
|
+
exports.Icon.Accessory = (props) => {
|
|
38
56
|
const AcessoryIcon = (renderProps) => {
|
|
39
|
-
return
|
|
57
|
+
return (0, jsx_runtime_1.jsx)(exports.Icon, { ...renderProps, ...props });
|
|
40
58
|
};
|
|
41
59
|
return AcessoryIcon;
|
|
42
60
|
};
|
|
43
|
-
Icon.styleRegistryName = 'Icon';
|
|
44
|
-
Icon.elements = ['icon'];
|
|
45
|
-
Icon.rootElement = 'icon';
|
|
46
|
-
Icon.withVariantTypes = (styles) => {
|
|
47
|
-
return Icon;
|
|
61
|
+
exports.Icon.styleRegistryName = 'Icon';
|
|
62
|
+
exports.Icon.elements = ['icon'];
|
|
63
|
+
exports.Icon.rootElement = 'icon';
|
|
64
|
+
exports.Icon.withVariantTypes = (styles) => {
|
|
65
|
+
return exports.Icon;
|
|
48
66
|
};
|
|
49
|
-
Icon.defaultProps = {};
|
|
50
|
-
WebStyleRegistry.registerComponent(Icon);
|
|
67
|
+
exports.Icon.defaultProps = {};
|
|
68
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.Icon);
|
|
51
69
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Icon/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Icon/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,kCAA8B;AAC9B,+DAA2D;AAC3D,6CAA2F;AAC3F,iEAA6D;A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AAI,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"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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");
|
|
8
11
|
const LIST_STYLE_REGISTRY_NAME = 'List';
|
|
9
12
|
function resolvePadding(props, stylePositioner) {
|
|
10
13
|
const get = (key) => props[key] ?? stylePositioner?.[key];
|
|
@@ -19,17 +22,17 @@ function resolvePadding(props, stylePositioner) {
|
|
|
19
22
|
};
|
|
20
23
|
}
|
|
21
24
|
function useListProvider(props) {
|
|
22
|
-
const wrapperRef = useRef(null);
|
|
23
|
-
const [wrapperLayout, setWrapperLayout] = useState(null);
|
|
24
|
-
const styles = useStylesFor(LIST_STYLE_REGISTRY_NAME, props.style);
|
|
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);
|
|
25
28
|
const stylePositioner = styles?.positioner ?? {};
|
|
26
|
-
const update = useCallback((target) => {
|
|
29
|
+
const update = (0, react_1.useCallback)((target) => {
|
|
27
30
|
const rect = target.getBoundingClientRect();
|
|
28
31
|
const next = { width: rect.width, offsetHeight: target.offsetHeight };
|
|
29
|
-
setWrapperLayout(current => deepEqual(next, current) ? current : next);
|
|
32
|
+
setWrapperLayout(current => (0, utils_1.deepEqual)(next, current) ? current : next);
|
|
30
33
|
}, []);
|
|
31
|
-
const { debounce: updateDebounced } = useDebounceCallback(update, 200);
|
|
32
|
-
useIsomorphicEffect(() => {
|
|
34
|
+
const { debounce: updateDebounced } = (0, hooks_1.useDebounceCallback)(update, 200);
|
|
35
|
+
(0, useIsomorphicEffect_1.useIsomorphicEffect)(() => {
|
|
33
36
|
if (typeof window === 'undefined')
|
|
34
37
|
return;
|
|
35
38
|
const el = wrapperRef.current;
|
|
@@ -42,7 +45,7 @@ function useListProvider(props) {
|
|
|
42
45
|
observer.observe(el);
|
|
43
46
|
return () => observer.disconnect();
|
|
44
47
|
}, [wrapperRef.current, update, updateDebounced]);
|
|
45
|
-
const scrollHook = props.scrollHook ?? (props.windowScroll ? useWindowScroll : useElementScroll);
|
|
48
|
+
const scrollHook = props.scrollHook ?? (props.windowScroll ? scroll_1.useWindowScroll : scroll_1.useElementScroll);
|
|
46
49
|
const ready = !!wrapperLayout;
|
|
47
50
|
return {
|
|
48
51
|
wrapperRef,
|
|
@@ -54,23 +57,25 @@ function useListProvider(props) {
|
|
|
54
57
|
padding: resolvePadding(props, stylePositioner),
|
|
55
58
|
};
|
|
56
59
|
}
|
|
57
|
-
|
|
60
|
+
exports.ListContext = (0, react_1.createContext)(null);
|
|
58
61
|
/**
|
|
59
62
|
* Returns the nearest `List.Provider` context value.
|
|
60
63
|
* Throws when `required` is `true` (default) and no provider is found; pass `false` to allow optional usage.
|
|
61
64
|
*/
|
|
62
|
-
|
|
63
|
-
const ctx = useContext(ListContext);
|
|
65
|
+
const useListContext = (required = true) => {
|
|
66
|
+
const ctx = (0, react_1.useContext)(exports.ListContext);
|
|
64
67
|
if (!ctx && required)
|
|
65
68
|
throw new Error('useListContext must be used inside List.Provider');
|
|
66
69
|
return ctx;
|
|
67
70
|
};
|
|
71
|
+
exports.useListContext = useListContext;
|
|
68
72
|
/**
|
|
69
73
|
* Provides layout measurements, resolved styles, scroll state, and positioner config to all List sub-components.
|
|
70
74
|
* Must wrap `List.Wrapper` / `List.Items`; `List` renders this automatically when used as the top-level component.
|
|
71
75
|
*/
|
|
72
|
-
|
|
76
|
+
const ListProvider = (props) => {
|
|
73
77
|
const value = useListProvider(props);
|
|
74
|
-
return (
|
|
78
|
+
return ((0, jsx_runtime_1.jsx)(exports.ListContext, { value: value, children: props.children }));
|
|
75
79
|
};
|
|
80
|
+
exports.ListProvider = ListProvider;
|
|
76
81
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/List/context.tsx"],"names":[],"mappings":"
|
|
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;AAI5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