@ape.swap/bonds-sdk 1.0.61 → 1.0.62

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.
Files changed (124) hide show
  1. package/dist/components/uikit/Button/Button.d.ts +4 -0
  2. package/dist/components/uikit/Button/Button.js +91 -0
  3. package/dist/components/uikit/Button/IconButton.d.ts +4 -0
  4. package/dist/components/uikit/Button/IconButton.js +33 -0
  5. package/dist/components/uikit/Button/index.d.ts +2 -0
  6. package/dist/components/uikit/Button/index.js +2 -0
  7. package/dist/components/uikit/Button/styles.d.ts +3 -0
  8. package/dist/components/uikit/Button/styles.js +30 -0
  9. package/dist/components/uikit/Button/types.d.ts +46 -0
  10. package/dist/components/uikit/Button/types.js +37 -0
  11. package/dist/components/uikit/Checkbox/index.d.ts +4 -0
  12. package/dist/components/uikit/Checkbox/index.js +46 -0
  13. package/dist/components/uikit/Checkbox/types.d.ts +11 -0
  14. package/dist/components/uikit/Checkbox/types.js +5 -0
  15. package/dist/components/uikit/Dropdown/Dropdown.d.ts +4 -0
  16. package/dist/components/uikit/Dropdown/Dropdown.js +58 -0
  17. package/dist/components/uikit/Dropdown/DropdownItem.d.ts +4 -0
  18. package/dist/components/uikit/Dropdown/DropdownItem.js +47 -0
  19. package/dist/components/uikit/Dropdown/index.d.ts +3 -0
  20. package/dist/components/uikit/Dropdown/index.js +2 -0
  21. package/dist/components/uikit/Dropdown/styles.d.ts +4 -0
  22. package/dist/components/uikit/Dropdown/styles.js +16 -0
  23. package/dist/components/uikit/Dropdown/types.d.ts +58 -0
  24. package/dist/components/uikit/Dropdown/types.js +22 -0
  25. package/dist/components/uikit/Flex/index.d.ts +3 -0
  26. package/dist/components/uikit/Flex/index.js +29 -0
  27. package/dist/components/uikit/Input/Input.d.ts +4 -0
  28. package/dist/components/uikit/Input/Input.js +72 -0
  29. package/dist/components/uikit/Input/NumericInput.d.ts +10 -0
  30. package/dist/components/uikit/Input/NumericInput.js +35 -0
  31. package/dist/components/uikit/Input/StyledInput.d.ts +11 -0
  32. package/dist/components/uikit/Input/StyledInput.js +37 -0
  33. package/dist/components/uikit/Input/index.d.ts +3 -0
  34. package/dist/components/uikit/Input/index.js +3 -0
  35. package/dist/components/uikit/Link/index.d.ts +9 -0
  36. package/dist/components/uikit/Link/index.js +29 -0
  37. package/dist/components/uikit/Modal/ModalFooter.d.ts +4 -0
  38. package/dist/components/uikit/Modal/ModalFooter.js +32 -0
  39. package/dist/components/uikit/Modal/ModalHeader.d.ts +4 -0
  40. package/dist/components/uikit/Modal/ModalHeader.js +31 -0
  41. package/dist/components/uikit/Modal/index.d.ts +4 -0
  42. package/dist/components/uikit/Modal/index.js +55 -0
  43. package/dist/components/uikit/Modal/styles.d.ts +3 -0
  44. package/dist/components/uikit/Modal/styles.js +62 -0
  45. package/dist/components/uikit/Modal/types.d.ts +17 -0
  46. package/dist/components/uikit/Modal/types.js +1 -0
  47. package/dist/components/uikit/Select/Select.d.ts +4 -0
  48. package/dist/components/uikit/Select/Select.js +61 -0
  49. package/dist/components/uikit/Select/SelectItem.d.ts +4 -0
  50. package/dist/components/uikit/Select/SelectItem.js +40 -0
  51. package/dist/components/uikit/Select/index.d.ts +2 -0
  52. package/dist/components/uikit/Select/index.js +2 -0
  53. package/dist/components/uikit/Select/styles.d.ts +4 -0
  54. package/dist/components/uikit/Select/styles.js +50 -0
  55. package/dist/components/uikit/Select/types.d.ts +55 -0
  56. package/dist/components/uikit/Select/types.js +37 -0
  57. package/dist/components/uikit/Skeleton/index.d.ts +4 -0
  58. package/dist/components/uikit/Skeleton/index.js +31 -0
  59. package/dist/components/uikit/Skeleton/styles.d.ts +5 -0
  60. package/dist/components/uikit/Skeleton/styles.js +40 -0
  61. package/dist/components/uikit/Skeleton/types.d.ts +18 -0
  62. package/dist/components/uikit/Skeleton/types.js +10 -0
  63. package/dist/components/uikit/Spinner/apeSpinner.json +2764 -0
  64. package/dist/components/uikit/Spinner/index.d.ts +5 -0
  65. package/dist/components/uikit/Spinner/index.js +20 -0
  66. package/dist/components/uikit/SwiperDots/index.d.ts +6 -0
  67. package/dist/components/uikit/SwiperDots/index.js +14 -0
  68. package/dist/components/uikit/Tabs/Tab.d.ts +4 -0
  69. package/dist/components/uikit/Tabs/Tab.js +34 -0
  70. package/dist/components/uikit/Tabs/TabPanel.d.ts +4 -0
  71. package/dist/components/uikit/Tabs/TabPanel.js +29 -0
  72. package/dist/components/uikit/Tabs/Tabs.d.ts +4 -0
  73. package/dist/components/uikit/Tabs/Tabs.js +67 -0
  74. package/dist/components/uikit/Tabs/index.d.ts +2 -0
  75. package/dist/components/uikit/Tabs/index.js +2 -0
  76. package/dist/components/uikit/Tabs/styles.d.ts +3 -0
  77. package/dist/components/uikit/Tabs/styles.js +40 -0
  78. package/dist/components/uikit/Tabs/types.d.ts +54 -0
  79. package/dist/components/uikit/Tabs/types.js +22 -0
  80. package/dist/components/uikit/Tag/ListTag.d.ts +4 -0
  81. package/dist/components/uikit/Tag/ListTag.js +20 -0
  82. package/dist/components/uikit/Tag/Tag.d.ts +4 -0
  83. package/dist/components/uikit/Tag/Tag.js +42 -0
  84. package/dist/components/uikit/Tag/index.d.ts +3 -0
  85. package/dist/components/uikit/Tag/index.js +2 -0
  86. package/dist/components/uikit/Tag/styles.d.ts +5 -0
  87. package/dist/components/uikit/Tag/styles.js +44 -0
  88. package/dist/components/uikit/Tag/types.d.ts +48 -0
  89. package/dist/components/uikit/Tag/types.js +34 -0
  90. package/dist/components/uikit/Text/index.d.ts +4 -0
  91. package/dist/components/uikit/Text/index.js +35 -0
  92. package/dist/components/uikit/Text/types.d.ts +23 -0
  93. package/dist/components/uikit/Text/types.js +13 -0
  94. package/dist/components/uikit/Toggle/index.d.ts +4 -0
  95. package/dist/components/uikit/Toggle/index.js +63 -0
  96. package/dist/components/uikit/Toggle/styles.d.ts +3 -0
  97. package/dist/components/uikit/Toggle/styles.js +39 -0
  98. package/dist/components/uikit/Toggle/types.d.ts +31 -0
  99. package/dist/components/uikit/Toggle/types.js +17 -0
  100. package/dist/components/uikit/Tooltip/index.d.ts +4 -0
  101. package/dist/components/uikit/Tooltip/index.js +66 -0
  102. package/dist/components/uikit/Tooltip/styles.d.ts +4 -0
  103. package/dist/components/uikit/Tooltip/styles.js +60 -0
  104. package/dist/components/uikit/Tooltip/types.d.ts +17 -0
  105. package/dist/components/uikit/Tooltip/types.js +8 -0
  106. package/dist/components/uikit/TutorialModal/index.d.ts +4 -0
  107. package/dist/components/uikit/TutorialModal/index.js +52 -0
  108. package/dist/components/uikit/TutorialModal/styles.d.ts +8 -0
  109. package/dist/components/uikit/TutorialModal/styles.js +86 -0
  110. package/dist/components/uikit/TutorialModal/types.d.ts +22 -0
  111. package/dist/components/uikit/TutorialModal/types.js +1 -0
  112. package/dist/components/uikit/TutorialModal/useTutorialModal.d.ts +6 -0
  113. package/dist/components/uikit/TutorialModal/useTutorialModal.js +20 -0
  114. package/dist/components/uikit/index.d.ts +18 -0
  115. package/dist/components/uikit/index.js +20 -0
  116. package/dist/contexts/ModalContext.d.ts +14 -0
  117. package/dist/contexts/ModalContext.js +78 -0
  118. package/dist/hooks/useIsAbond.d.ts +3 -0
  119. package/dist/hooks/useIsAbond.js +10 -0
  120. package/dist/hooks/useModal.d.ts +3 -0
  121. package/dist/hooks/useModal.js +39 -0
  122. package/dist/utils/numbers.d.ts +5 -0
  123. package/dist/utils/numbers.js +111 -0
  124. package/package.json +7 -1
@@ -0,0 +1,72 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
24
+ import { Input as ThemeInput, Spinner } from 'theme-ui';
25
+ import { Text } from '../../uikit';
26
+ import Flex from '../Flex';
27
+ import Svg from '../Svg';
28
+ var colorScheme = {
29
+ default: 'gray',
30
+ error: 'red',
31
+ success: 'green',
32
+ };
33
+ var Input = function (_a) {
34
+ var variant = _a.variant, width = _a.width, status = _a.status, isLoading = _a.isLoading, props = __rest(_a, ["variant", "width", "status", "isLoading"]);
35
+ switch (variant) {
36
+ case 'search':
37
+ return (_jsxs(Flex, __assign({ sx: { position: 'relative', width: width ? width : 'unset' } }, { children: [_jsx(ThemeInput, __assign({}, props, { sx: {
38
+ background: 'white3',
39
+ border: 'none',
40
+ pl: '10px',
41
+ borderRadius: '10px',
42
+ ':focus': { outline: 'none' },
43
+ } })), _jsx(Flex, __assign({ sx: { position: 'absolute', right: 5, justifyContent: 'center', height: '100%' } }, { children: _jsx(Svg, { icon: "search" }) }))] })));
44
+ case 'password':
45
+ var statusColor = colorScheme[status];
46
+ return (_jsxs(Flex, __assign({ sx: {
47
+ width: width ? width : '100%',
48
+ flexDirection: 'column',
49
+ alignItems: 'center',
50
+ gap: '5px',
51
+ position: 'relative',
52
+ } }, { children: [_jsx(ThemeInput, __assign({}, props, { type: "password", sx: {
53
+ position: 'relative',
54
+ background: 'white3',
55
+ border: 'none',
56
+ borderBottom: "2px solid ".concat(statusColor),
57
+ color: statusColor,
58
+ pl: '10px',
59
+ borderRadius: '10px',
60
+ ':focus': { outline: 'none' },
61
+ } })), isLoading && (_jsx(Flex, __assign({ sx: { position: 'absolute', top: '5px', right: '5px', justifyContent: 'center', height: '100%' } }, { children: _jsx(Spinner, { width: "20px", height: "20px" }) }))), _jsx(Text, __assign({ sx: { fontSize: '10px', color: statusColor, visibility: status === 'default' ? 'hidden' : 'visible' } }, { children: status === 'error' ? 'Wrong Password' : 'Correct Password' }))] })));
62
+ default:
63
+ return (_jsx(ThemeInput, __assign({}, props, { sx: {
64
+ background: 'white3',
65
+ border: 'none',
66
+ pl: '10px',
67
+ borderRadius: '10px',
68
+ ':focus': { outline: 'none' },
69
+ } })));
70
+ }
71
+ };
72
+ export default Input;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { ThemeUIStyleObject } from 'theme-ui';
3
+ declare const NumericInput: ({ onUserInput, value, disabled, style, placeholder, }: {
4
+ onUserInput?: ((input: string) => void) | undefined;
5
+ value: string;
6
+ disabled?: boolean | undefined;
7
+ style?: ThemeUIStyleObject<import("@theme-ui/css").Theme<{}>> | undefined;
8
+ placeholder?: string | undefined;
9
+ }) => import("react").JSX.Element;
10
+ export default NumericInput;
@@ -0,0 +1,35 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "theme-ui/jsx-runtime";
13
+ import { isNumber } from '../../../utils/numbers';
14
+ import Input from './Input';
15
+ var NumericInput = function (_a) {
16
+ var onUserInput = _a.onUserInput, value = _a.value, disabled = _a.disabled, style = _a.style, _b = _a.placeholder, placeholder = _b === void 0 ? '0.0' : _b;
17
+ return (_jsx(Input, { sx: __assign({ border: 'none', padding: '0px 0px', position: 'relative', width: '100%', display: 'inline-block', fontSize: ['19px', '19px', '22px', '22px'], ':focus': { outline: 'none' } }, style), disabled: disabled, value: value, onChange: function (e) {
18
+ onUserInput && onUserInput(e.target.value);
19
+ }, placeholder: placeholder, pattern: "^[0-9]*[.,]?[0-9]*$", onInput: function (v) {
20
+ if (v.currentTarget.value.includes(',')) {
21
+ v.currentTarget.value = v.currentTarget.value.replace(/,/g, '.');
22
+ }
23
+ if (v.currentTarget.value.includes('%')) {
24
+ v.currentTarget.value = v.currentTarget.value.replace(/[^0-9]/g, '');
25
+ }
26
+ if (v.currentTarget.value === '.') {
27
+ v.currentTarget.value = '0.';
28
+ }
29
+ v.currentTarget.value =
30
+ !!v.currentTarget.value && isNumber(v.currentTarget.value) && parseFloat(v.currentTarget.value) >= 0
31
+ ? v.currentTarget.value
32
+ : v.currentTarget.value.slice(0, v.currentTarget.value.length - 1);
33
+ } }));
34
+ };
35
+ export default NumericInput;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export interface InputProps {
3
+ endAdornment?: React.ReactNode;
4
+ onChange: (e: React.FormEvent<HTMLInputElement>) => void;
5
+ placeholder?: string;
6
+ startAdornment?: React.ReactNode;
7
+ value: string;
8
+ height?: string;
9
+ }
10
+ declare const StyledInput: React.FC<InputProps>;
11
+ export default StyledInput;
@@ -0,0 +1,37 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
17
+ //@ts-nocheck
18
+ import styled from '@emotion/styled';
19
+ import Flex from '../Flex';
20
+ import Input from './Input';
21
+ var StyledInputWrapper = styled(Flex)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n background: ", ";\n border-radius: 10px;\n height: 72px;\n padding: 0px 16px;\n"], ["\n align-items: center;\n background: ", ";\n border-radius: 10px;\n height: 72px;\n padding: 0px 16px;\n"])), function (_a) {
22
+ var theme = _a.theme;
23
+ return theme.colors.white4;
24
+ });
25
+ var StyledInputComponent = styled(Input)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n background: none;\n border: 0;\n color: ", ";\n flex: 1;\n height: 56px;\n margin: 0;\n padding: 0;\n outline: none;\n font-weight: 800;\n font-size: 22px;\n\n &::placeholder {\n color: ", ";\n }\n"], ["\n width: 100%;\n background: none;\n border: 0;\n color: ", ";\n flex: 1;\n height: 56px;\n margin: 0;\n padding: 0;\n outline: none;\n font-weight: 800;\n font-size: 22px;\n\n &::placeholder {\n color: ", ";\n }\n"])), function (_a) {
26
+ var theme = _a.theme;
27
+ return (theme.isDark ? theme.colors.primaryBright : theme.colors.primary);
28
+ }, function (_a) {
29
+ var theme = _a.theme;
30
+ return !theme.isDark && theme.colors.gray;
31
+ });
32
+ var StyledInput = function (_a) {
33
+ var endAdornment = _a.endAdornment, onChange = _a.onChange, placeholder = _a.placeholder, startAdornment = _a.startAdornment, value = _a.value, height = _a.height;
34
+ return (_jsxs(StyledInputWrapper, __assign({ sx: { height: height !== null && height !== void 0 ? height : null } }, { children: [!!startAdornment && startAdornment, _jsx(StyledInputComponent, { placeholder: placeholder, value: value, onChange: onChange }), !!endAdornment && endAdornment] })));
35
+ };
36
+ export default StyledInput;
37
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,3 @@
1
+ export { default as NumericInput } from './NumericInput';
2
+ export { default as Input } from './Input';
3
+ export { default as StyledInput } from './StyledInput';
@@ -0,0 +1,3 @@
1
+ export { default as NumericInput } from './NumericInput';
2
+ export { default as Input } from './Input';
3
+ export { default as StyledInput } from './StyledInput';
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { LinkProps } from 'next/link';
3
+ import { ThemeUIStyleObject } from 'theme-ui';
4
+ interface LinkTypes extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps>, LinkProps {
5
+ children: React.ReactNode;
6
+ sx?: ThemeUIStyleObject;
7
+ }
8
+ declare const Link: ({ children, ...props }: LinkTypes | any) => import("react").JSX.Element;
9
+ export default Link;
@@ -0,0 +1,29 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx } from "theme-ui/jsx-runtime";
24
+ import { default as NextLink } from 'next/link';
25
+ var Link = function (_a) {
26
+ var children = _a.children, props = __rest(_a, ["children"]);
27
+ return (_jsx(NextLink, __assign({}, props, { sx: __assign(__assign({}, props === null || props === void 0 ? void 0 : props.sx), { color: 'text', textDecoration: 'underline', border: 'none', ':visited': { textDecoration: 'none' }, ':active': { textDecoration: 'none' } }) }, { children: children })));
28
+ };
29
+ export default Link;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { InternalProps } from './types';
3
+ declare const ModalFooter: ({ children, onDismiss, t }: InternalProps) => React.JSX.Element;
4
+ export default ModalFooter;
@@ -0,0 +1,32 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
13
+ import { useContext } from 'react';
14
+ import { Flex } from 'theme-ui';
15
+ import styles from './styles';
16
+ import Text from '../Text';
17
+ import { Context as ModalContext } from '../../../contexts/ModalContext';
18
+ var ModalFooter = function (_a) {
19
+ var children = _a.children, onDismiss = _a.onDismiss, t = _a.t;
20
+ var handleClose = useContext(ModalContext).handleClose;
21
+ var onClose = function () {
22
+ onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
23
+ handleClose();
24
+ };
25
+ return (_jsxs(Flex, __assign({ sx: styles.modalFooter }, { children: [children, _jsx(Text, __assign({ onClick: onClose, sx: {
26
+ textDecoration: 'underline',
27
+ color: 'text',
28
+ cursor: 'pointer',
29
+ fontSize: '16px',
30
+ } }, { children: t ? t('Cancel') : 'Cancel' }))] })));
31
+ };
32
+ export default ModalFooter;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { InternalProps } from './types';
3
+ declare const ModalHeader: React.FC<InternalProps>;
4
+ export default ModalHeader;
@@ -0,0 +1,31 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "theme-ui/jsx-runtime";
24
+ import { Divider, Flex } from 'theme-ui';
25
+ import style from './styles';
26
+ import { IconButton } from '../Button';
27
+ var ModalHeader = function (_a) {
28
+ var children = _a.children, onDismiss = _a.onDismiss, hideDivider = _a.hideDivider, props = __rest(_a, ["children", "onDismiss", "hideDivider"]);
29
+ return (_jsxs(_Fragment, { children: [_jsxs(Flex, __assign({}, props, { sx: style.modalHead }, { children: [children, onDismiss && _jsx(IconButton, { icon: "close", color: "text", variant: "transparent", onClick: onDismiss })] })), !hideDivider && _jsx(Divider, {})] }));
30
+ };
31
+ export default ModalHeader;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ModalProps } from './types';
3
+ declare const Modal: ({ children, onDismiss, open, title, zIndex, onAnimationComplete, backdrop, ...props }: ModalProps) => React.JSX.Element;
4
+ export default Modal;
@@ -0,0 +1,55 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
24
+ import React, { useContext } from 'react';
25
+ import { Box } from 'theme-ui';
26
+ import { AnimatePresence, motion } from 'framer-motion';
27
+ import style from './styles';
28
+ import ModalHeader from './ModalHeader';
29
+ import { Context as ModalContext } from '../../../contexts/ModalContext';
30
+ import Text from '../Text';
31
+ var Modal = function (_a) {
32
+ var children = _a.children, onDismiss = _a.onDismiss, _b = _a.open, open = _b === void 0 ? true : _b, title = _a.title, _c = _a.zIndex, zIndex = _c === void 0 ? 'modal' : _c, onAnimationComplete = _a.onAnimationComplete, backdrop = _a.backdrop, props = __rest(_a, ["children", "onDismiss", "open", "title", "zIndex", "onAnimationComplete", "backdrop"]);
33
+ var handleClose = useContext(ModalContext).handleClose;
34
+ var onClose = onDismiss || handleClose;
35
+ return (_jsxs(Box, __assign({ id: title, sx: { zIndex: zIndex } }, { children: [_jsx(AnimatePresence, { children: open && (_jsxs(motion.div, __assign({ initial: {
36
+ opacity: 0,
37
+ transform: 'translate(-50%, -50%) scale(0.1)',
38
+ }, animate: {
39
+ opacity: 1,
40
+ transform: 'translate(-50%, -50%) scale(1.0)',
41
+ }, transition: {
42
+ opacity: { duration: 0.2 },
43
+ transform: { duration: 0.2 },
44
+ }, exit: { opacity: 0, transform: 'translate(-50%, -50%) scale(0)' } }, props, { sx: __assign(__assign({}, style.container), { zIndex: zIndex }), onAnimationComplete: onAnimationComplete }, { children: [title && (_jsx(ModalHeader, __assign({ onDismiss: onClose }, { children: _jsx(Text, __assign({ sx: { fontSize: '22px', fontWeight: 700, lineHeight: '33px' } }, { children: title })) }))), React.Children.map(children, function (child) {
45
+ if (React.isValidElement(child)) {
46
+ return React.cloneElement(child, __assign(__assign({}, child === null || child === void 0 ? void 0 : child.props), { onDismiss: function () {
47
+ var _a, _b;
48
+ ;
49
+ (_b = (_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onDismiss) === null || _b === void 0 ? void 0 : _b.call(_a), onClose();
50
+ } }));
51
+ }
52
+ return child;
53
+ })] }))) }), open && _jsx(Box, { sx: __assign(__assign({}, style.backdrop), backdrop), onClick: onClose })] })));
54
+ };
55
+ export default Modal;
@@ -0,0 +1,3 @@
1
+ import { ThemeUIStyleObject } from 'theme-ui';
2
+ declare const styles: Record<string, ThemeUIStyleObject>;
3
+ export default styles;
@@ -0,0 +1,62 @@
1
+ var styles = {
2
+ container: {
3
+ padding: '20px',
4
+ background: 'white2',
5
+ borderRadius: 'normal',
6
+ color: 'text',
7
+ hr: {
8
+ background: '#DCD9D9',
9
+ },
10
+ position: 'fixed',
11
+ display: 'block',
12
+ top: '50%',
13
+ left: '50%',
14
+ transform: 'translate(-50%, -50%)',
15
+ width: '380px',
16
+ minWidth: ['95%', 'min(360px, 90%)', '320px'],
17
+ overflowY: 'auto',
18
+ maxHeight: 'calc(100% - 30px)',
19
+ maxWidth: '95vw',
20
+ },
21
+ backdrop: {
22
+ position: 'fixed',
23
+ top: 0,
24
+ bottom: 0,
25
+ left: 0,
26
+ right: 0,
27
+ background: 'modalOverlay',
28
+ width: '100%',
29
+ height: '100%',
30
+ zIndex: 100,
31
+ transition: 'all 1s ease',
32
+ },
33
+ modalHead: {
34
+ justifyContent: 'space-between',
35
+ alignItems: 'center',
36
+ svg: {
37
+ fill: 'text',
38
+ marginLeft: 'auto',
39
+ cursor: 'pointer',
40
+ },
41
+ button: {
42
+ ml: 'auto',
43
+ },
44
+ },
45
+ modalFooter: {
46
+ flexDirection: 'column',
47
+ justifyContent: 'center',
48
+ alignItems: 'center',
49
+ pt: 9,
50
+ gap: 4,
51
+ },
52
+ cancelButton: {
53
+ background: 'transparent',
54
+ textDecoration: 'underline',
55
+ color: 'text',
56
+ cursor: 'pointer',
57
+ fontSize: 0,
58
+ fontWeight: 'normal',
59
+ p: 0,
60
+ },
61
+ };
62
+ export default styles;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ThemeUIStyleObject, SxProp } from 'theme-ui';
3
+ export interface InternalProps {
4
+ children?: React.ReactNode;
5
+ onDismiss?: () => void;
6
+ onAnimationComplete?: () => void;
7
+ t?: (key: string) => string;
8
+ hideDivider?: boolean;
9
+ }
10
+ export interface ModalProps extends InternalProps {
11
+ children: React.ReactNode;
12
+ open?: boolean;
13
+ title?: string;
14
+ zIndex?: string | number;
15
+ sx?: ThemeUIStyleObject;
16
+ backdrop?: SxProp['sx'];
17
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { SelectProps } from './types';
3
+ declare const Select: ({ children, active, width, size, position, className, label, ...props }: SelectProps) => React.JSX.Element;
4
+ export default Select;
@@ -0,0 +1,61 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "theme-ui/jsx-runtime";
24
+ import React, { useRef, useState } from 'react';
25
+ import { Box, Flex } from 'theme-ui';
26
+ import { AnimatePresence, motion } from 'framer-motion';
27
+ import { selectPadding, sizes, positions, selectedExtraPadding } from './types';
28
+ import Svg from '../Svg';
29
+ import styles from './styles';
30
+ var Select = function (_a) {
31
+ var children = _a.children, active = _a.active, _b = _a.width, width = _b === void 0 ? 'fit-content' : _b, _c = _a.size, size = _c === void 0 ? sizes.MEDIUM : _c, _d = _a.position, position = _d === void 0 ? positions.BOTTOM : _d, className = _a.className, label = _a.label, props = __rest(_a, ["children", "active", "width", "size", "position", "className", "label"]);
32
+ var inputRef = useRef(null);
33
+ var _e = useState(false), open = _e[0], setOpen = _e[1];
34
+ var handleClick = function () { return setOpen(function (prev) { return !prev; }); };
35
+ var setNativeInput = function (val) {
36
+ var _a, _b, _c;
37
+ var input = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current;
38
+ if (input) {
39
+ (_c = (_b = (_a = Object === null || Object === void 0 ? void 0 : Object.getOwnPropertyDescriptor) === null || _a === void 0 ? void 0 : _a.call(Object, window.HTMLInputElement.prototype, 'value')) === null || _b === void 0 ? void 0 : _b.set) === null || _c === void 0 ? void 0 : _c.call(input, val);
40
+ input.dispatchEvent(new Event('change', { bubbles: true }));
41
+ }
42
+ };
43
+ return (_jsxs(_Fragment, { children: [_jsxs(Box, __assign({ sx: __assign(__assign({}, styles.container), { width: width }), onClick: handleClick, className: className }, { children: [_jsxs(Flex, __assign({ sx: {
44
+ padding: selectedExtraPadding[size],
45
+ pr: selectPadding[size],
46
+ columnGap: '10px',
47
+ alignItems: 'center',
48
+ justifyContent: 'space-between',
49
+ width: '100%',
50
+ overflow: 'hidden',
51
+ } }, { children: [label ? (_jsx(Box, { children: label })) : (React.Children.map(children, function (child) {
52
+ var _a;
53
+ if (((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.value) !== active) {
54
+ return null;
55
+ }
56
+ return React.cloneElement(child, __assign(__assign({}, child === null || child === void 0 ? void 0 : child.props), { active: true }));
57
+ })), _jsx(Flex, __assign({ sx: { minWidth: '10px' } }, { children: _jsx(Svg, { icon: "caret", direction: open ? 'up' : 'down' }) }))] })), _jsx(AnimatePresence, { children: open && (_jsx(motion.div, __assign({ initial: { opacity: 0, height: 0 }, animate: { opacity: 1, height: 'fit-content' }, transition: { opacity: { duration: 0.2 } }, exit: { opacity: 0, height: 0 }, sx: __assign(__assign({}, styles.ul), { zIndex: 10, top: position === positions.BOTTOM ? 'calc(100% + 5px)' : undefined, bottom: position === positions.TOP ? 'calc(100% + 5px)' : undefined }) }, { children: React.Children.map(children, function (child) {
58
+ return React.cloneElement(child, __assign(__assign({}, child === null || child === void 0 ? void 0 : child.props), { active: false, onClick: function () { var _a; return setNativeInput((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.value); } }));
59
+ }) }))) }), _jsx("input", __assign({ ref: inputRef, value: active || '', "aria-hidden": "true", tabIndex: -1 }, props, { sx: styles.input }))] })), open && _jsx("div", { "aria-hidden": "true", onClick: function () { return setOpen(false); }, sx: styles.backdrop })] }));
60
+ };
61
+ export default Select;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { SelectItemProps } from './types';
3
+ declare const SelectItem: ({ onClick, value, active, size, children, ...props }: SelectItemProps) => import("react").JSX.Element;
4
+ export default SelectItem;
@@ -0,0 +1,40 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx } from "theme-ui/jsx-runtime";
24
+ import { selectItemPadding, sizes } from './types';
25
+ import { dynamicStyles } from './styles';
26
+ import Flex from '../Flex';
27
+ var SelectItem = function (_a) {
28
+ var onClick = _a.onClick, value = _a.value, active = _a.active, _b = _a.size, size = _b === void 0 ? sizes.MEDIUM : _b, children = _a.children, props = __rest(_a, ["onClick", "value", "active", "size", "children"]);
29
+ var style = dynamicStyles.dropdownItem({ size: size });
30
+ return (_jsx(Flex, __assign({ as: "li" }, props, { onClick: function () { return onClick === null || onClick === void 0 ? void 0 : onClick(value); }, sx: {
31
+ padding: selectItemPadding[size],
32
+ listStyleType: 'none',
33
+ cursor: 'pointer',
34
+ borderRadius: '10px',
35
+ '&:hover': {
36
+ backgroundColor: !active ? 'white3' : undefined,
37
+ },
38
+ } }, { children: _jsx(Flex, __assign({ sx: style }, { children: children })) })));
39
+ };
40
+ export default SelectItem;
@@ -0,0 +1,2 @@
1
+ export { default as Select } from './Select';
2
+ export { default as SelectItem } from './SelectItem';
@@ -0,0 +1,2 @@
1
+ export { default as Select } from './Select';
2
+ export { default as SelectItem } from './SelectItem';
@@ -0,0 +1,4 @@
1
+ import { ThemeUIStyleObject } from 'theme-ui';
2
+ declare const styles: Record<'container' | 'ul' | 'backdrop' | 'input', ThemeUIStyleObject>;
3
+ export declare const dynamicStyles: Record<string, (props: any) => ThemeUIStyleObject>;
4
+ export default styles;
@@ -0,0 +1,50 @@
1
+ import { fontSizes } from './types';
2
+ var styles = {
3
+ container: {
4
+ background: 'white3',
5
+ borderRadius: '10px',
6
+ cursor: 'pointer',
7
+ width: 'fit-content',
8
+ height: 'fit-content',
9
+ position: 'relative',
10
+ },
11
+ ul: {
12
+ position: 'absolute',
13
+ background: 'white2',
14
+ borderRadius: '10px',
15
+ cursor: 'pointer',
16
+ minWidth: '100%',
17
+ width: 'max-content',
18
+ overflow: 'hidden',
19
+ boxShadow: 'rgba(0, 0, 0, 0.16) 0px 1px 4px',
20
+ },
21
+ backdrop: {
22
+ width: '98vw',
23
+ height: '100vh',
24
+ position: 'fixed',
25
+ background: 'transparent',
26
+ top: 0,
27
+ left: 0,
28
+ },
29
+ input: {
30
+ bottom: 0,
31
+ left: 0,
32
+ position: 'absolute',
33
+ opacity: 0,
34
+ pointerEvents: 'none',
35
+ width: '100%',
36
+ },
37
+ };
38
+ export var dynamicStyles = {
39
+ dropdownItem: function (_a) {
40
+ var size = _a.size;
41
+ return ({
42
+ width: '100%',
43
+ fontSize: fontSizes[size],
44
+ '*': {
45
+ fontSize: fontSizes[size],
46
+ },
47
+ });
48
+ },
49
+ };
50
+ export default styles;