@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
|
@@ -46,9 +46,9 @@ export declare function useTextInput(props: Props): {
|
|
|
46
46
|
showError: boolean;
|
|
47
47
|
isUnset: boolean;
|
|
48
48
|
validation: import("@codeleap/form").ValidationResult<any, any>;
|
|
49
|
-
value: V | import("nanostores").StoreValue<V extends object ? import("nanostores").MapStore<V> : never>;
|
|
49
|
+
value: V | import("nanostores", { with: { "resolution-mode": "import" } }).StoreValue<V extends object ? import("nanostores", { with: { "resolution-mode": "import" } }).MapStore<V> : never>;
|
|
50
50
|
};
|
|
51
|
-
value: V | import("nanostores").StoreValue<V extends object ? import("nanostores").MapStore<V> : never>;
|
|
51
|
+
value: V | import("nanostores", { with: { "resolution-mode": "import" } }).StoreValue<V extends object ? import("nanostores", { with: { "resolution-mode": "import" } }).MapStore<V> : never>;
|
|
52
52
|
setValue: (to: V) => void;
|
|
53
53
|
changed: boolean;
|
|
54
54
|
representation: any;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTextInput = useTextInput;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const types_1 = require("@codeleap/types");
|
|
6
|
+
const Field_1 = require("../Field");
|
|
7
|
+
const form_1 = require("@codeleap/form");
|
|
5
8
|
/**
|
|
6
9
|
* Manages focus state, change handling, and form-field validation wiring for `TextInput`.
|
|
7
10
|
* Bridges the native `onChange` event with both controlled `onValueChange` and `@codeleap/form` field APIs.
|
|
8
11
|
* No provider required; designed to be called only inside `TextInput`.
|
|
9
12
|
*/
|
|
10
|
-
|
|
13
|
+
function useTextInput(props) {
|
|
11
14
|
const { onFocus, onBlur, field, multiline: isMultiline, forceError, value, onValueChange, onChangeText, } = props;
|
|
12
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
13
|
-
const [secureTextEntry, setSecureTextEntry] = useState(true);
|
|
15
|
+
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
16
|
+
const [secureTextEntry, setSecureTextEntry] = (0, react_1.useState)(true);
|
|
14
17
|
const toggleSecureTextEntry = () => setSecureTextEntry(s => !s);
|
|
15
|
-
const { fieldHandle, validation, innerInputRef, wrapperRef, onInputValueChange, inputValue, } = useFieldInput(field, fields.text, { value, onValueChange: onValueChange ?? onChangeText }, {
|
|
18
|
+
const { fieldHandle, validation, innerInputRef, wrapperRef, onInputValueChange, inputValue, } = (0, Field_1.useFieldInput)(field, form_1.fields.text, { value, onValueChange: onValueChange ?? onChangeText }, {
|
|
16
19
|
revealValue() {
|
|
17
20
|
setSecureTextEntry(false);
|
|
18
21
|
},
|
|
@@ -23,17 +26,17 @@ export function useTextInput(props) {
|
|
|
23
26
|
toggleSecureTextEntry();
|
|
24
27
|
},
|
|
25
28
|
}, [setSecureTextEntry]);
|
|
26
|
-
const handleBlur = useCallback((e) => {
|
|
29
|
+
const handleBlur = (0, react_1.useCallback)((e) => {
|
|
27
30
|
validation?.onInputBlurred?.();
|
|
28
31
|
setIsFocused(false);
|
|
29
32
|
onBlur?.(e);
|
|
30
33
|
}, [validation?.onInputBlurred, onBlur]);
|
|
31
|
-
const handleFocus = useCallback((e) => {
|
|
34
|
+
const handleFocus = (0, react_1.useCallback)((e) => {
|
|
32
35
|
setIsFocused(true);
|
|
33
36
|
onFocus?.(e);
|
|
34
37
|
}, [onFocus]);
|
|
35
|
-
const handleChange = useCallback((event) => {
|
|
36
|
-
if (TypeGuards.isFunction(onChangeText))
|
|
38
|
+
const handleChange = (0, react_1.useCallback)((event) => {
|
|
39
|
+
if (types_1.TypeGuards.isFunction(onChangeText))
|
|
37
40
|
return onChangeText(event);
|
|
38
41
|
const inputValue = event?.target?.value;
|
|
39
42
|
onInputValueChange(inputValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTextInput.js","sourceRoot":"","sources":["../../../src/components/TextInput/useTextInput.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTextInput.js","sourceRoot":"","sources":["../../../src/components/TextInput/useTextInput.ts"],"names":[],"mappings":";;AAsBA,oCAqFC;AA3GD,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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.Tooltip = void 0;
|
|
21
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
22
|
+
const react_1 = __importDefault(require("react"));
|
|
23
|
+
const react_tooltip_1 = require("@radix-ui/react-tooltip");
|
|
24
|
+
const hooks_1 = require("@codeleap/hooks");
|
|
25
|
+
const types_1 = require("@codeleap/types");
|
|
26
|
+
const View_1 = require("../View");
|
|
27
|
+
const lib_1 = require("../../lib");
|
|
28
|
+
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
29
|
+
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
30
|
+
__exportStar(require("./styles"), exports);
|
|
31
|
+
__exportStar(require("./types"), exports);
|
|
12
32
|
/**
|
|
13
33
|
* Contextual bubble that floats near a trigger element, supporting hover and/or press to open.
|
|
14
34
|
* Visibility can be fully controlled via `visible` / `toggle` or left to internal state.
|
|
15
35
|
* Uses: `View`, `useStylesFor`
|
|
16
36
|
*/
|
|
17
|
-
|
|
37
|
+
const Tooltip = (props) => {
|
|
18
38
|
const allProps = {
|
|
19
|
-
...Tooltip.defaultProps,
|
|
39
|
+
...exports.Tooltip.defaultProps,
|
|
20
40
|
...props,
|
|
21
41
|
};
|
|
22
42
|
const { toggle: _toggle, visible: _visible, children, content: Content, triggerWrapperProps, triggerWrapper: TriggerWrapper, side, disabled, delayDuration, openOnPress, openOnHover, onOpen, onClose, onValueChange, onHover, onPress, contentProps, portalProps, arrowProps, triggerProps, providerProps, closeOnClickOutside, style, ...rest } = allProps;
|
|
23
|
-
const styles = useStylesFor(Tooltip.styleRegistryName, style);
|
|
24
|
-
const [visible, toggle] = useConditionalState(_visible, _toggle, { initialValue: false });
|
|
25
|
-
const tooltipDirectionStyle =
|
|
43
|
+
const styles = (0, useStylesFor_1.useStylesFor)(exports.Tooltip.styleRegistryName, style);
|
|
44
|
+
const [visible, toggle] = (0, hooks_1.useConditionalState)(_visible, _toggle, { initialValue: false });
|
|
45
|
+
const tooltipDirectionStyle = react_1.default.useMemo(() => {
|
|
26
46
|
return side ? styles[`content:${side}`] : styles.content;
|
|
27
47
|
}, [side, styles]);
|
|
28
48
|
function handleToggle(_value, isToggle = true) {
|
|
@@ -36,10 +56,10 @@ export const Tooltip = (props) => {
|
|
|
36
56
|
}
|
|
37
57
|
if (isToggle)
|
|
38
58
|
toggle(_value);
|
|
39
|
-
if (TypeGuards.isFunction(onValueChange))
|
|
59
|
+
if (types_1.TypeGuards.isFunction(onValueChange))
|
|
40
60
|
onValueChange?.(_value);
|
|
41
61
|
}
|
|
42
|
-
const onOpenChange =
|
|
62
|
+
const onOpenChange = react_1.default.useCallback((_open) => {
|
|
43
63
|
handleToggle(_open, false);
|
|
44
64
|
}, [handleToggle]);
|
|
45
65
|
const _onHover = (type) => {
|
|
@@ -49,7 +69,7 @@ export const Tooltip = (props) => {
|
|
|
49
69
|
if (type === 'leave' && visible === false)
|
|
50
70
|
return;
|
|
51
71
|
handleToggle(value);
|
|
52
|
-
if (TypeGuards.isFunction(onHover))
|
|
72
|
+
if (types_1.TypeGuards.isFunction(onHover))
|
|
53
73
|
onHover?.(type, value);
|
|
54
74
|
};
|
|
55
75
|
const _onPress = () => {
|
|
@@ -57,38 +77,39 @@ export const Tooltip = (props) => {
|
|
|
57
77
|
return;
|
|
58
78
|
const value = !visible;
|
|
59
79
|
handleToggle(value);
|
|
60
|
-
if (TypeGuards.isFunction(onPress))
|
|
80
|
+
if (types_1.TypeGuards.isFunction(onPress))
|
|
61
81
|
onPress?.(value);
|
|
62
82
|
};
|
|
63
|
-
const triggerRef =
|
|
64
|
-
const contentRef = useClickOutsideElement((isOutside) => {
|
|
83
|
+
const triggerRef = react_1.default.useRef(null);
|
|
84
|
+
const contentRef = (0, lib_1.useClickOutsideElement)((isOutside) => {
|
|
65
85
|
if (isOutside && closeOnClickOutside && !openOnHover && visible) {
|
|
66
86
|
handleToggle(false);
|
|
67
87
|
}
|
|
68
88
|
}, [triggerRef]);
|
|
69
|
-
return (
|
|
70
|
-
?
|
|
71
|
-
: Content,
|
|
89
|
+
return ((0, jsx_runtime_1.jsx)(react_tooltip_1.Provider, { ...providerProps, children: (0, jsx_runtime_1.jsxs)(react_tooltip_1.Root, { delayDuration: delayDuration, open: visible, onOpenChange: onOpenChange, ...rest, children: [(0, jsx_runtime_1.jsx)(react_tooltip_1.Trigger, { onClick: _onPress, onMouseEnter: () => _onHover('enter'), onMouseLeave: () => _onHover('leave'), asChild: true, ref: triggerRef, ...triggerProps, css: styles.triggerWrapper, children: (0, jsx_runtime_1.jsx)(TriggerWrapper, { ...allProps, ...triggerWrapperProps, css: styles.triggerInnerWrapper, children: children }) }), (0, jsx_runtime_1.jsx)(react_tooltip_1.Portal, { ...portalProps, children: (0, jsx_runtime_1.jsxs)(react_tooltip_1.Content, { ref: contentRef, css: [tooltipDirectionStyle, styles.content], sideOffset: 2, side: side, ...contentProps, children: [types_1.TypeGuards.isFunction(Content)
|
|
90
|
+
? (0, jsx_runtime_1.jsx)(Content, { ...allProps, visible: visible, toggle: toggle, variantsStyles: styles })
|
|
91
|
+
: Content, (0, jsx_runtime_1.jsx)(react_tooltip_1.Arrow, { ...arrowProps, css: styles.arrow })] }) })] }) }));
|
|
72
92
|
};
|
|
73
|
-
Tooltip
|
|
74
|
-
Tooltip.
|
|
93
|
+
exports.Tooltip = Tooltip;
|
|
94
|
+
exports.Tooltip.styleRegistryName = 'Tooltip';
|
|
95
|
+
exports.Tooltip.elements = [
|
|
75
96
|
'content',
|
|
76
97
|
'arrow',
|
|
77
98
|
'triggerWrapper',
|
|
78
99
|
'triggerInnerWrapper',
|
|
79
100
|
];
|
|
80
|
-
Tooltip.rootElement = 'content';
|
|
81
|
-
Tooltip.withVariantTypes = (styles) => {
|
|
82
|
-
return Tooltip;
|
|
101
|
+
exports.Tooltip.rootElement = 'content';
|
|
102
|
+
exports.Tooltip.withVariantTypes = (styles) => {
|
|
103
|
+
return exports.Tooltip;
|
|
83
104
|
};
|
|
84
|
-
Tooltip.defaultProps = {
|
|
105
|
+
exports.Tooltip.defaultProps = {
|
|
85
106
|
openOnPress: true,
|
|
86
107
|
openOnHover: true,
|
|
87
108
|
disabled: false,
|
|
88
109
|
delayDuration: 0,
|
|
89
110
|
closeOnClickOutside: false,
|
|
90
111
|
side: 'bottom',
|
|
91
|
-
triggerWrapper: View,
|
|
112
|
+
triggerWrapper: View_1.View,
|
|
92
113
|
};
|
|
93
|
-
WebStyleRegistry.registerComponent(Tooltip);
|
|
114
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.Tooltip);
|
|
94
115
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tooltip/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"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B,IACa,GACH,IACD,GAEA,CACpB,CAAA;AACH,CAAC,CAAA;AAvIY,QAAA,OAAO,WAuInB;AAED,eAAO,CAAC,iBAAiB,GAAG,SAAS,CAAA;AAErC,eAAO,CAAC,QAAQ,GAAG;IACjB,SAAS;IACT,OAAO;IACP,gBAAgB;IAChB,qBAAqB;CACtB,CAAA;AAED,eAAO,CAAC,WAAW,GAAG,SAAS,CAAA;AAE/B,eAAO,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC5D,OAAO,eAA6E,CAAA;AACtF,CAAC,CAAA;AAED,eAAO,CAAC,YAAY,GAAG;IACrB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,KAAK;IACf,aAAa,EAAE,CAAC;IAChB,mBAAmB,EAAE,KAAK;IAC1B,IAAI,EAAE,QAAQ;IACd,cAAc,EAAE,WAAoC;CAC5B,CAAA;AAE1B,mCAAgB,CAAC,iBAAiB,CAAC,eAAO,CAAC,CAAA"}
|
|
@@ -1,27 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.Touchable = Touchable;
|
|
21
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
22
|
+
const hooks_1 = require("@codeleap/hooks");
|
|
23
|
+
const types_1 = require("@codeleap/types");
|
|
24
|
+
const react_1 = __importDefault(require("react"));
|
|
25
|
+
const lib_1 = require("../../lib");
|
|
26
|
+
const test_1 = require("../../lib/utils/test");
|
|
27
|
+
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
28
|
+
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
29
|
+
__exportStar(require("./styles"), exports);
|
|
30
|
+
__exportStar(require("./types"), exports);
|
|
11
31
|
/**
|
|
12
32
|
* Click wrapper that normalises keyboard Enter presses as clicks, debounces
|
|
13
33
|
* repeated presses, propagates analytics events, and applies disabled state.
|
|
14
34
|
* Uses: `useStylesFor`, `WebStyleRegistry`
|
|
15
35
|
*/
|
|
16
|
-
|
|
36
|
+
function Touchable(touchableProps) {
|
|
17
37
|
const allProps = {
|
|
18
38
|
...Touchable.defaultProps,
|
|
19
39
|
...touchableProps,
|
|
20
40
|
};
|
|
21
41
|
const { propagate, debounce, leadingDebounce, component, disabled, onPress, onClick, debugName, debugComponent, style, analyticsEnabled, analyticsName, analyticsData, ref, ...props } = allProps;
|
|
22
|
-
const styles = useStylesFor(Touchable.styleRegistryName, style);
|
|
23
|
-
const pressed =
|
|
24
|
-
onMount(() => {
|
|
42
|
+
const styles = (0, useStylesFor_1.useStylesFor)(Touchable.styleRegistryName, style);
|
|
43
|
+
const pressed = react_1.default.useRef(!!leadingDebounce);
|
|
44
|
+
(0, hooks_1.onMount)(() => {
|
|
25
45
|
if (!!leadingDebounce && !!debounce) {
|
|
26
46
|
setTimeout(() => {
|
|
27
47
|
pressed.current = false;
|
|
@@ -29,22 +49,22 @@ export function Touchable(touchableProps) {
|
|
|
29
49
|
}
|
|
30
50
|
});
|
|
31
51
|
const Component = component;
|
|
32
|
-
const notPressable = !TypeGuards.isFunction(onPress) && !TypeGuards.isFunction(onClick);
|
|
52
|
+
const notPressable = !types_1.TypeGuards.isFunction(onPress) && !types_1.TypeGuards.isFunction(onClick);
|
|
33
53
|
const handleClick = (event) => {
|
|
34
54
|
if (disabled)
|
|
35
55
|
return;
|
|
36
56
|
if (!propagate)
|
|
37
|
-
stopPropagation(event);
|
|
57
|
+
(0, lib_1.stopPropagation)(event);
|
|
38
58
|
if (notPressable)
|
|
39
59
|
return;
|
|
40
60
|
const _onPress = () => {
|
|
41
61
|
if (event && (event?.type !== 'click' && event?.keyCode !== 13 && event?.key !== 'Enter'))
|
|
42
62
|
return null;
|
|
43
|
-
if (TypeGuards.isFunction(onClick))
|
|
63
|
+
if (types_1.TypeGuards.isFunction(onClick))
|
|
44
64
|
onClick?.(event);
|
|
45
65
|
onPress?.();
|
|
46
66
|
};
|
|
47
|
-
if (TypeGuards.isNumber(debounce)) {
|
|
67
|
+
if (types_1.TypeGuards.isNumber(debounce)) {
|
|
48
68
|
if (pressed.current) {
|
|
49
69
|
return;
|
|
50
70
|
}
|
|
@@ -58,8 +78,8 @@ export function Touchable(touchableProps) {
|
|
|
58
78
|
_onPress();
|
|
59
79
|
}
|
|
60
80
|
};
|
|
61
|
-
const testId = getTestId(allProps);
|
|
62
|
-
return (
|
|
81
|
+
const testId = (0, test_1.getTestId)(allProps);
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)(Component, { ...props, disabled: disabled, onClick: handleClick, onKeyDown: handleClick, "aria-disabled": disabled || undefined, ref: ref, css: [
|
|
63
83
|
styles.wrapper,
|
|
64
84
|
disabled && styles?.['wrapper:disabled'],
|
|
65
85
|
], "data-testid": testId }));
|
|
@@ -76,5 +96,5 @@ Touchable.defaultProps = {
|
|
|
76
96
|
analyticsData: {},
|
|
77
97
|
tabIndex: 0,
|
|
78
98
|
};
|
|
79
|
-
WebStyleRegistry.registerComponent(Touchable);
|
|
99
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(Touchable);
|
|
80
100
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Touchable/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Touchable/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,8BA2FC;;AA9GD,2CAAyC;AACzC,2CAA4C;AAC5C,kDAAyE;AACzE,mCAA2C;AAC3C,+CAAgD;AAEhD,+DAA2D;AAC3D,iEAA6D;AAI7D,2CAAwB;AACxB,0CAAuB;AAEvB;;;;GAIG;AACH,SAAgB,SAAS,CAAwB,cAAiC;IAChF,MAAM,QAAQ,GAAG;QACf,GAAG,SAAS,CAAC,YAAY;QACzB,GAAG,cAAc;KAClB,CAAA;IAED,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,cAAc,EACd,KAAK,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,GAAG,EACH,GAAG,KAAK,EACT,GAAG,QAAQ,CAAA;IAIZ,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,SAAS,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE/D,MAAM,OAAO,GAAG,eAAK,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAA;IAE/C,IAAA,eAAO,EAAC,GAAG,EAAE;QACX,IAAI,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,QAAQ,EAAE,C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AAG,IAAA,gBAAS,EAAC,QAAQ,CAAC,CAAA;IAElC,OAAO,CACL,uBAAC,SAAS,OACJ,KAAK,EACT,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,WAAW,mBACP,QAAQ,IAAI,SAAS,EACpC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE;YACH,MAAM,CAAC,OAAO;YAEd,QAAQ,IAAI,MAAM,EAAE,CAAC,kBAAkB,CAAC;SACzC,iBACY,MAAM,GACnB,CACH,CAAA;AACH,CAAC;AAED,SAAS,CAAC,iBAAiB,GAAG,WAAW,CAAA;AACzC,SAAS,CAAC,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;AAChC,SAAS,CAAC,WAAW,GAAG,SAAS,CAAA;AAGjC,SAAS,CAAC,YAAY,GAAG;IACvB,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,QAAQ;IACnB,gBAAgB,EAAE,KAAK;IACvB,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,EAAE;IACjB,QAAQ,EAAE,CAAC;CACe,CAAA;AAE5B,mCAAgB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA"}
|
|
@@ -1,32 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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.View = View;
|
|
18
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
19
|
+
const types_1 = require("@codeleap/types");
|
|
20
|
+
const react_1 = require("motion/react");
|
|
21
|
+
const test_1 = require("../../lib/utils/test");
|
|
22
|
+
const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
|
|
23
|
+
const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
|
|
24
|
+
__exportStar(require("./styles"), exports);
|
|
25
|
+
__exportStar(require("./types"), exports);
|
|
9
26
|
/**
|
|
10
27
|
* Generic layout wrapper that renders any DOM element with responsive styling,
|
|
11
28
|
* hover callbacks, and optional Framer Motion animation.
|
|
12
29
|
* Uses: `useStylesFor`, `WebStyleRegistry`
|
|
13
30
|
*/
|
|
14
|
-
|
|
31
|
+
function View(viewProps) {
|
|
15
32
|
const { component, children, is, not, up, onHover, debugName, down, style, animated, animatedProps, ref, ...props } = {
|
|
16
33
|
...View.defaultProps,
|
|
17
34
|
...viewProps,
|
|
18
35
|
};
|
|
19
|
-
const styles = useStylesFor(View.styleRegistryName, style);
|
|
20
|
-
const Component = animated ? (motion?.[component] || motion.div) : (component || 'div');
|
|
36
|
+
const styles = (0, useStylesFor_1.useStylesFor)(View.styleRegistryName, style);
|
|
37
|
+
const Component = animated ? (react_1.motion?.[component] || react_1.motion.div) : (component || 'div');
|
|
21
38
|
function handleHover(isMouseOverElement) {
|
|
22
39
|
onHover?.(isMouseOverElement);
|
|
23
40
|
}
|
|
24
|
-
const hoverProps = TypeGuards.isFunction(onHover) && {
|
|
41
|
+
const hoverProps = types_1.TypeGuards.isFunction(onHover) && {
|
|
25
42
|
onMouseEnter: () => handleHover(true),
|
|
26
43
|
onMouseLeave: () => handleHover(false),
|
|
27
44
|
};
|
|
28
|
-
const testId = getTestId(viewProps);
|
|
29
|
-
return (
|
|
45
|
+
const testId = (0, test_1.getTestId)(viewProps);
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(Component, { ...hoverProps, ...props, ...animatedProps, ref: ref, "data-testid": testId, css: styles.wrapper, children: children }));
|
|
30
47
|
}
|
|
31
48
|
View.styleRegistryName = 'View';
|
|
32
49
|
View.elements = ['wrapper'];
|
|
@@ -35,5 +52,5 @@ View.defaultProps = {
|
|
|
35
52
|
component: 'div',
|
|
36
53
|
animated: false,
|
|
37
54
|
};
|
|
38
|
-
WebStyleRegistry.registerComponent(View);
|
|
55
|
+
WebStyleRegistry_1.WebStyleRegistry.registerComponent(View);
|
|
39
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/View/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/View/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiBA,oBA+CC;;AAhED,2CAA4C;AAE5C,wCAAqC;AAErC,+CAAgD;AAChD,+DAA2D;AAC3D,iEAA6D;AAG7D,2CAAwB;AACxB,0CAAuB;AAEvB;;;;GAIG;AACH,SAAgB,IAAI,CAAwB,SAAuB;IACjE,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,EAAE,EACF,GAAG,EACH,EAAE,EACF,OAAO,EACP,SAAS,EACT,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,aAAa,EACb,GAAG,EACH,GAAG,KAAK,EACT,GAAG;QACF,GAAG,IAAI,CAAC,YAAY;QACpB,GAAG,SAAS;KACb,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,IAAI,CAAC,iBAA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16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
+
__exportStar(require("./View"), exports);
|
|
18
|
+
__exportStar(require("./Icon"), exports);
|
|
19
|
+
__exportStar(require("./Touchable"), exports);
|
|
20
|
+
__exportStar(require("./Text"), exports);
|
|
21
|
+
__exportStar(require("./Slider"), exports);
|
|
22
|
+
__exportStar(require("./List"), exports);
|
|
23
|
+
__exportStar(require("./ActivityIndicator"), exports);
|
|
24
|
+
__exportStar(require("./Button"), exports);
|
|
25
|
+
__exportStar(require("./Modal"), exports);
|
|
26
|
+
__exportStar(require("./Checkbox"), exports);
|
|
27
|
+
__exportStar(require("./Collapse"), exports);
|
|
28
|
+
__exportStar(require("./Drawer"), exports);
|
|
29
|
+
__exportStar(require("./Overlay"), exports);
|
|
30
|
+
__exportStar(require("./TextInput"), exports);
|
|
31
|
+
__exportStar(require("./MaskedTextInput"), exports);
|
|
32
|
+
__exportStar(require("./RadioInput"), exports);
|
|
33
|
+
__exportStar(require("./Select"), exports);
|
|
34
|
+
__exportStar(require("./FileInput"), exports);
|
|
35
|
+
__exportStar(require("./Slider"), exports);
|
|
36
|
+
__exportStar(require("./List"), exports);
|
|
37
|
+
__exportStar(require("./LoadingOverlay"), exports);
|
|
38
|
+
__exportStar(require("./Switch"), exports);
|
|
39
|
+
__exportStar(require("./NumberIncrement"), exports);
|
|
40
|
+
__exportStar(require("./SearchInput"), exports);
|
|
41
|
+
__exportStar(require("./Tooltip"), exports);
|
|
42
|
+
__exportStar(require("./Field"), exports);
|
|
43
|
+
__exportStar(require("./Carousel"), exports);
|
|
44
|
+
__exportStar(require("./EmptyPlaceholder"), exports);
|
|
45
|
+
__exportStar(require("./Badge"), exports);
|
|
46
|
+
__exportStar(require("./CropPicker"), exports);
|
|
47
|
+
__exportStar(require("./Calendar"), exports);
|
|
48
|
+
__exportStar(require("./DatePicker"), exports);
|
|
49
|
+
__exportStar(require("./Dropzone"), exports);
|
|
50
|
+
__exportStar(require("./Progress"), exports);
|
|
51
|
+
__exportStar(require("./Tag"), exports);
|
|
52
|
+
__exportStar(require("./TextEditor"), exports);
|
|
53
|
+
__exportStar(require("./ColorPicker"), exports);
|
|
54
|
+
__exportStar(require("./PaginationButtons"), exports);
|
|
55
|
+
__exportStar(require("./SectionFilters"), exports);
|
|
56
|
+
__exportStar(require("./PaginationIndicator"), exports);
|
|
57
|
+
__exportStar(require("./Carousel"), exports);
|
|
42
58
|
//# sourceMappingURL=components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/components/components.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/components/components.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,yCAAsB;AACtB,8CAA2B;AAC3B,yCAAsB;AACtB,2CAAwB;AACxB,yCAAsB;AACtB,sDAAmC;AACnC,2CAAwB;AACxB,0CAAuB;AACvB,6CAA0B;AAC1B,6CAA0B;AAC1B,2CAAwB;AACxB,4CAAyB;AACzB,8CAA2B;AAC3B,oDAAiC;AACjC,+CAA4B;AAC5B,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,yCAAsB;AACtB,mDAAgC;AAChC,2CAAwB;AACxB,oDAAiC;AACjC,gDAA6B;AAC7B,4CAAyB;AACzB,0CAAuB;AACvB,6CAA0B;AAC1B,qDAAkC;AAClC,0CAAuB;AACvB,+CAA4B;AAC5B,6CAA0B;AAC1B,+CAA4B;AAC5B,6CAA0B;AAC1B,6CAA0B;AAC1B,wCAAqB;AACrB,+CAA4B;AAC5B,gDAA6B;AAC7B,sDAAmC;AACnC,mDAAgC;AAChC,wDAAqC;AACrC,6CAA0B"}
|