@zonos/amino 5.1.15 → 5.1.16

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.
@@ -1,11 +1,14 @@
1
1
  import type { ReactNode } from 'react';
2
2
  export type SwitchProps = {
3
3
  checked: boolean;
4
+ className?: string;
4
5
  disabled?: boolean;
5
- icon?: ReactNode;
6
6
  label?: string;
7
7
  labelDescription?: string;
8
+ labelIcon?: ReactNode;
8
9
  subtitle?: string;
10
+ switchIconLeft?: ReactNode;
11
+ switchIconRight?: ReactNode;
9
12
  onChange: (checked: boolean) => void;
10
13
  };
11
- export declare const Switch: ({ checked, disabled, icon, label, labelDescription, onChange, subtitle, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const Switch: ({ checked, className, disabled, label, labelDescription, labelIcon, onChange, subtitle, switchIconLeft, switchIconRight, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- "use strict";var n=require("../../_tslib-ccfac372.js"),e=require("react/jsx-runtime"),t=require("styled-components"),i=require("../text/Text.js"),r=require("../../styles/constants/theme.js");function a(n){return n&&n.__esModule?n:{default:n}}var o,l,s,p,c,d,h,x=a(t),m=x.default.div(o||(o=n.__makeTemplateObject(["\n background: ",";\n box-shadow: ",";\n height: 14px;\n width: 14px;\n border-radius: 50%;\n transition: ",";\n position: absolute;\n top: 1px;\n left: ",";\n [data-theme='night'] & {\n background: ",";\n }\n"],["\n background: ",";\n box-shadow: ",";\n height: 14px;\n width: 14px;\n border-radius: 50%;\n transition: ",";\n position: absolute;\n top: 1px;\n left: ",";\n [data-theme='night'] & {\n background: ",";\n }\n"])),r.theme.gray0,(function(n){return n.checked?"0px -1px 1px 0px rgba(68, 94, 238, 0.08) inset, 0px 1px 3px 0px rgba(0, 0, 0, 0.20)":"0px -1px 1px 0px rgba(0, 0, 0, 0.08) inset, 0px 1px 3px 0px rgba(0, 0, 0, 0.20)"}),r.theme.transition,(function(n){return n.checked?"calc(100% - 15px)":"1px"}),r.theme.gray1200),g=x.default.div(l||(l=n.__makeTemplateObject(["\n margin-right: ",";\n width: 32px;\n height: 16px;\n min-width: 32px;\n min-height: 16px;\n line-height: 16px;\n border-radius: 20px;\n background: ",";\n box-shadow: ",";\n display: block;\n user-select: none;\n margin-right: ",";\n position: relative;\n"],["\n margin-right: ",";\n width: 32px;\n height: 16px;\n min-width: 32px;\n min-height: 16px;\n line-height: 16px;\n border-radius: 20px;\n background: ",";\n box-shadow: ",";\n display: block;\n user-select: none;\n margin-right: ",";\n position: relative;\n"])),r.theme.space16,(function(n){return n.checked?r.theme.primary:r.theme.gray100}),r.theme.v3ShadowInset,r.theme.space16),u=x.default(i.Text)(s||(s=n.__makeTemplateObject(["\n margin-bottom: 0;\n"],["\n margin-bottom: 0;\n"]))),b=x.default(i.Text)(p||(p=n.__makeTemplateObject([""],[""]))),f=x.default.span(c||(c=n.__makeTemplateObject(["\n margin-left: 4px;\n color: ",";\n"],["\n margin-left: 4px;\n color: ",";\n"])),r.theme.gray600),k=x.default.div(d||(d=n.__makeTemplateObject(["\n display: flex;\n align-items: center;\n line-height: 16px;\n\n svg {\n margin-right: 4px;\n }\n"],["\n display: flex;\n align-items: center;\n line-height: 16px;\n\n svg {\n margin-right: 4px;\n }\n"]))),y=x.default.label(h||(h=n.__makeTemplateObject(["\n display: flex;\n flex-direction: row;\n cursor: pointer;\n\n &.disabled {\n "," {\n opacity: 0.6;\n }\n "," {\n opacity: 0.95;\n }\n "," {\n color: ",";\n }\n "," {\n color: ",";\n }\n\n cursor: not-allowed;\n }\n"],["\n display: flex;\n flex-direction: row;\n cursor: pointer;\n\n &.disabled {\n "," {\n opacity: 0.6;\n }\n "," {\n opacity: 0.95;\n }\n "," {\n color: ",";\n }\n "," {\n color: ",";\n }\n\n cursor: not-allowed;\n }\n"])),g,m,u,r.theme.gray600,b,r.theme.gray400);exports.Switch=function(n){var t=n.checked,i=n.disabled,r=n.icon,a=n.label,o=n.labelDescription,l=n.onChange,s=n.subtitle,p=null==a?void 0:a.replace(/\s/g,"-").toLowerCase();return e.jsxs(y,{checked:t,className:i?"disabled":"",htmlFor:p,onClick:function(){return!i&&l(!t)},children:[e.jsx(g,{checked:t,children:e.jsx(m,{checked:t,id:p})}),e.jsxs("div",{children:[e.jsxs(k,{children:[r,e.jsxs(u,{type:"input-label",children:[a,o&&e.jsx(f,{children:o})]})]}),s&&e.jsx(b,{type:"subtitle",children:s})]})]})};
1
+ "use strict";var n=require("../../_tslib-ccfac372.js"),e=require("react/jsx-runtime"),t=require("clsx"),i=require("styled-components"),a=require("../text/Text.js"),r=require("../../styles/constants/theme.js");function p(n){return n&&n.__esModule?n:{default:n}}var o,l,x,h,c,d,s,u,g,m,b=p(t),f=p(i),k=f.default.div(o||(o=n.__makeTemplateObject(["\n background: ",";\n box-shadow: ",";\n height: 14px;\n width: 14px;\n border-radius: 50%;\n transition: ",";\n position: absolute;\n top: 1px;\n left: ",";\n [data-theme='night'] & {\n background: ",";\n }\n"],["\n background: ",";\n box-shadow: ",";\n height: 14px;\n width: 14px;\n border-radius: 50%;\n transition: ",";\n position: absolute;\n top: 1px;\n left: ",";\n [data-theme='night'] & {\n background: ",";\n }\n"])),r.theme.gray0,(function(n){return n.checked?"0px -1px 1px 0px rgba(68, 94, 238, 0.08) inset, 0px 1px 3px 0px rgba(0, 0, 0, 0.20)":"0px -1px 1px 0px rgba(0, 0, 0, 0.08) inset, 0px 1px 3px 0px rgba(0, 0, 0, 0.20)"}),r.theme.transition,(function(n){return n.checked?"calc(100% - 15px)":"1px"}),r.theme.gray200),w=f.default(k)(l||(l=n.__makeTemplateObject(["\n height: 28px;\n width: 28px;\n top: 2px;\n left: ",";\n box-shadow:\n 0px -1px 1px 0px rgba(0, 0, 0, 0.2) inset,\n 0px 1px 3px 0px rgba(0, 0, 0, 0.4);\n"],["\n height: 28px;\n width: 28px;\n top: 2px;\n left: ",";\n box-shadow:\n 0px -1px 1px 0px rgba(0, 0, 0, 0.2) inset,\n 0px 1px 3px 0px rgba(0, 0, 0, 0.4);\n"])),(function(n){return n.checked?"calc(100% - 30px)":"2px"})),j=f.default.div(x||(x=n.__makeTemplateObject(["\n margin-right: ",";\n width: 32px;\n height: 16px;\n min-width: 32px;\n min-height: 16px;\n line-height: 16px;\n border-radius: 20px;\n background: ",";\n box-shadow: ",";\n display: block;\n user-select: none;\n position: relative;\n"],["\n margin-right: ",";\n width: 32px;\n height: 16px;\n min-width: 32px;\n min-height: 16px;\n line-height: 16px;\n border-radius: 20px;\n background: ",";\n box-shadow: ",";\n display: block;\n user-select: none;\n position: relative;\n"])),r.theme.space16,(function(n){return n.checked?r.theme.gray0:r.theme.gray100}),r.theme.v3ShadowInset),_=f.default(j)(h||(h=n.__makeTemplateObject(["\n width: 62px;\n height: 32px;\n min-width: 24px;\n background: ",";\n"],["\n width: 62px;\n height: 32px;\n min-width: 24px;\n background: ",";\n"])),r.theme.gray50),y=f.default(a.Text)(c||(c=n.__makeTemplateObject(["\n margin-bottom: 0;\n"],["\n margin-bottom: 0;\n"]))),v=f.default(a.Text)(d||(d=n.__makeTemplateObject([""],[""]))),T=f.default.span(s||(s=n.__makeTemplateObject(["\n margin-left: 4px;\n color: ",";\n"],["\n margin-left: 4px;\n color: ",";\n"])),r.theme.gray600),O=f.default.div(u||(u=n.__makeTemplateObject(["\n display: flex;\n align-items: center;\n line-height: 16px;\n\n svg {\n margin-right: 4px;\n }\n"],["\n display: flex;\n align-items: center;\n line-height: 16px;\n\n svg {\n margin-right: 4px;\n }\n"]))),q=f.default.label(g||(g=n.__makeTemplateObject(["\n display: flex;\n flex-direction: row;\n cursor: pointer;\n\n &.disabled {\n "," {\n opacity: 0.6;\n }\n "," {\n opacity: 0.95;\n }\n "," {\n color: ",";\n }\n "," {\n color: ",";\n }\n\n cursor: not-allowed;\n }\n"],["\n display: flex;\n flex-direction: row;\n cursor: pointer;\n\n &.disabled {\n "," {\n opacity: 0.6;\n }\n "," {\n opacity: 0.95;\n }\n "," {\n color: ",";\n }\n "," {\n color: ",";\n }\n\n cursor: not-allowed;\n }\n"])),j,k,y,r.theme.gray600,v,r.theme.gray400),I=f.default.div(m||(m=n.__makeTemplateObject(["\n position: absolute;\n top: 6px;\n left: ",";\n right: ",";\n svg {\n height: 20px;\n width: 20px;\n }\n"],["\n position: absolute;\n top: 6px;\n left: ",";\n right: ",";\n svg {\n height: 20px;\n width: 20px;\n }\n"])),(function(n){return n.left?"5.8px":"auto"}),(function(n){return n.left?"auto":"5.6px"}));exports.Switch=function(n){var t=n.checked,i=n.className,a=n.disabled,r=n.label,p=n.labelDescription,o=n.labelIcon,l=n.onChange,x=n.subtitle,h=n.switchIconLeft,c=n.switchIconRight,d=null==r?void 0:r.replace(/\s/g,"-").toLowerCase(),s=Boolean(h||c);return e.jsxs(q,{checked:t,className:b.default(i,{disabled:a}),htmlFor:d,onClick:function(){return!a&&l(!t)},children:[s?e.jsxs(_,{checked:t,children:[e.jsx(w,{checked:t,id:d}),e.jsx(I,{left:!0,children:h}),e.jsx(I,{children:c})]}):e.jsx(j,{checked:t,children:e.jsx(k,{checked:t,id:d})}),e.jsxs("div",{children:[e.jsxs(O,{children:[o,e.jsxs(y,{type:"input-label",children:[r,p&&e.jsx(T,{children:p})]})]}),x&&e.jsx(v,{type:"subtitle",children:x})]})]})};
@@ -1 +1 @@
1
- "use strict";var e=require("../../_tslib-ccfac372.js"),n=require("react/jsx-runtime"),t=require("styled-components"),i=require("../card/Card.js"),r=require("../select/Select.js"),o=require("../stack/HStack.js"),s=require("../text/Text.js"),a=require("../../icons/custom/theme/ThemeDarkIcon.js"),c=require("../../icons/custom/theme/ThemeLightIcon.js"),l=require("../../icons/NightIcon.js"),u=require("../../icons/SunnyIcon.js"),d=require("../../styles/constants/theme.js"),h=require("../../utils/hooks/useAminoTheme.js");function m(e){return e&&e.__esModule?e:{default:e}}require("../help-text/HelpText.js"),require("../select/_StyledReactSelect.js"),require("react"),require("react-select"),require("../checkbox/Checkbox.js"),require("framer-motion"),require("../../icons/CheckmarkIcon.js"),require("../../icons/icon-base/_IconBase.js"),require("../../utils/getTestId.js"),require("../../icons/CheckCircleIcon.js"),require("../../icons/DoubleChevronIcon.js"),require("../../icons/RemoveCircleIcon.js"),require("../../icons/RemoveIcon.js"),require("../stack/Stack.js"),require("../../icons/flag-icon/useStableUniqueId.js"),require("uuid"),require("../../icons/icon-base/_ThemeIconBase.js"),require("../../Theme-61f4342c.js"),require("zod"),require("../../utils/hooks/useStorage.js"),require("../../utils/storage.js"),require("swr");var p,x,b,g,j,k,f,q=m(t),y=q.default.button(p||(p=e.__makeTemplateObject(["\n border: ",";\n color: ",";\n border-radius: ",";\n\n &:not([disabled]) {\n &:active,\n &:focus {\n outline: none;\n }\n }\n"],["\n border: ",";\n color: ",";\n border-radius: ",";\n\n &:not([disabled]) {\n &:active,\n &:focus {\n outline: none;\n }\n }\n"])),(function(e){return"2px solid ".concat(e.isActive?d.theme.blue400:"transparent")}),(function(e){return e.isActive?d.theme.primary:d.theme.textColor}),d.theme.radius8),v=q.default(i.Card)(x||(x=e.__makeTemplateObject(["\n background: ",";\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: ",";\n\n svg {\n height: 64px;\n width: 110px;\n box-shadow: ",";\n margin-bottom: ",";\n }\n"],["\n background: ",";\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: ",";\n\n svg {\n height: 64px;\n width: 110px;\n box-shadow: ",";\n margin-bottom: ",";\n }\n"])),d.theme.gray0,d.theme.space16,d.theme.v3ShadowLarge,d.theme.space16),T=q.default.div(b||(b=e.__makeTemplateObject(["\n background: ",";\n height: 28px;\n width: 28px;\n border-radius: 50%;\n transition: ",";\n position: absolute;\n top: 2px;\n left: ",";\n"],["\n background: ",";\n height: 28px;\n width: 28px;\n border-radius: 50%;\n transition: ",";\n position: absolute;\n top: 2px;\n left: ",";\n"])),d.theme.primary,d.theme.transition,(function(e){return e.checked?"calc(100% - 30px)":"2px"})),w=q.default(u.SunnyIcon)(g||(g=e.__makeTemplateObject(["\n position: absolute;\n top: 6px;\n right: 5.8px;\n color: ",";\n"],["\n position: absolute;\n top: 6px;\n right: 5.8px;\n color: ",";\n"])),(function(e){return e.isActive?d.theme.gray0:d.theme.gray1200})),I=q.default(l.NightIcon)(j||(j=e.__makeTemplateObject(["\n position: absolute;\n top: 6px;\n left: 6px;\n color: ",";\n"],["\n position: absolute;\n top: 6px;\n left: 6px;\n color: ",";\n"])),(function(e){return e.isActive?d.theme.gray0:d.theme.gray1200})),_=q.default.div(k||(k=e.__makeTemplateObject(["\n margin-right: ",";\n width: 62px;\n height: 32px;\n min-width: 24px;\n min-height: 16px;\n line-height: 16px;\n border-radius: 20px;\n background: ",";\n box-shadow: ",";\n display: block;\n user-select: none;\n position: relative;\n"],["\n margin-right: ",";\n width: 62px;\n height: 32px;\n min-width: 24px;\n min-height: 16px;\n line-height: 16px;\n border-radius: 20px;\n background: ",";\n box-shadow: ",";\n display: block;\n user-select: none;\n position: relative;\n"])),d.theme.space16,d.theme.gray50,d.theme.v3ShadowInset),S=q.default.label(f||(f=e.__makeTemplateObject(["\n display: flex;\n flex-direction: row;\n cursor: pointer;\n\n &.disabled {\n "," {\n background: ",";\n }\n cursor: not-allowed;\n }\n"],["\n display: flex;\n flex-direction: row;\n cursor: pointer;\n\n &.disabled {\n "," {\n background: ",";\n }\n cursor: not-allowed;\n }\n"])),_,(function(e){return e.checked?d.theme.gray300:""})),C=[{label:"Light",value:"day"},{label:"Dark",value:"night"}];exports.ThemeSelect=function(e){var t=e.className,i=e.disabled,d=void 0!==i&&i,m=e.type,p=void 0===m?"select":m,x=h.useAminoTheme(),b=x.aminoTheme,g=x.setAminoTheme,j="day"===b;return n.jsxs(n.Fragment,{children:["cards"===p&&n.jsxs(o.HStack,{className:t,children:[n.jsx(y,{"data-theme":"day",isActive:"day"===b,onClick:function(){return g("day")},type:"button",children:n.jsxs(v,{children:[n.jsx(c.ThemeLightIcon,{}),n.jsx(s.Text,{type:"bold-label",children:"Light"})]})}),n.jsx(y,{"data-theme":"night",isActive:"night"===b,onClick:function(){return g("night")},type:"button",children:n.jsxs(v,{children:[n.jsx(a.ThemeDarkIcon,{}),n.jsx(s.Text,{type:"bold-label",children:"Dark"})]})})]}),"select"===p&&n.jsx(r.Select,{className:t,icon:function(){switch(b){case"day":default:return n.jsx(u.SunnyIcon,{});case"night":return n.jsx(l.NightIcon,{})}}(),isClearable:!1,isDisabled:d,onChange:function(e){return g((null==e?void 0:e.value)||"day")},options:C,value:C.filter((function(e){return e.value===b}))}),"toggle"===p&&n.jsx(S,{checked:j,className:"".concat(t," ").concat(d?"disabled":""),onClick:function(){return!d&&g("day"===b?"night":"day")},children:n.jsxs(_,{checked:j,children:[n.jsx(T,{checked:j,id:"amino-theme-switch"}),n.jsx(w,{isActive:"day"===b,size:20}),n.jsx(I,{isActive:"night"===b,size:20})]})})]})};
1
+ "use strict";var e=require("../../_tslib-ccfac372.js"),n=require("react/jsx-runtime"),r=require("styled-components"),t=require("../card/Card.js"),i=require("../select/Select.js"),s=require("../stack/HStack.js"),c=require("../switch/Switch.js"),o=require("../text/Text.js"),a=require("../../icons/custom/theme/ThemeDarkIcon.js"),u=require("../../icons/custom/theme/ThemeLightIcon.js"),l=require("../../icons/NightIcon.js"),d=require("../../icons/SunnyIcon.js"),h=require("../../styles/constants/theme.js"),m=require("../../utils/hooks/useAminoTheme.js");function j(e){return e&&e.__esModule?e:{default:e}}require("../help-text/HelpText.js"),require("../select/_StyledReactSelect.js"),require("react"),require("react-select"),require("../checkbox/Checkbox.js"),require("framer-motion"),require("../../icons/CheckmarkIcon.js"),require("../../icons/icon-base/_IconBase.js"),require("../../utils/getTestId.js"),require("../../icons/CheckCircleIcon.js"),require("../../icons/DoubleChevronIcon.js"),require("../../icons/RemoveCircleIcon.js"),require("../../icons/RemoveIcon.js"),require("../stack/Stack.js"),require("clsx"),require("../../icons/flag-icon/useStableUniqueId.js"),require("uuid"),require("../../icons/icon-base/_ThemeIconBase.js"),require("../../Theme-61f4342c.js"),require("zod"),require("../../utils/hooks/useStorage.js"),require("../../utils/storage.js"),require("swr");var x,q,g=j(r),b=g.default.button(x||(x=e.__makeTemplateObject(["\n border: ",";\n color: ",";\n border-radius: ",";\n\n &:not([disabled]) {\n &:active,\n &:focus {\n outline: none;\n }\n }\n"],["\n border: ",";\n color: ",";\n border-radius: ",";\n\n &:not([disabled]) {\n &:active,\n &:focus {\n outline: none;\n }\n }\n"])),(function(e){return"2px solid ".concat(e.isActive?h.theme.blue400:"transparent")}),(function(e){return e.isActive?h.theme.primary:h.theme.textColor}),h.theme.radius8),p=g.default(t.Card)(q||(q=e.__makeTemplateObject(["\n background: ",";\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: ",";\n\n svg {\n height: 64px;\n width: 110px;\n box-shadow: ",";\n margin-bottom: ",";\n }\n"],["\n background: ",";\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: ",";\n\n svg {\n height: 64px;\n width: 110px;\n box-shadow: ",";\n margin-bottom: ",";\n }\n"])),h.theme.gray0,h.theme.space16,h.theme.v3ShadowLarge,h.theme.space16),f=[{label:"Light",value:"day"},{label:"Dark",value:"night"}];exports.ThemeSelect=function(e){var r=e.className,t=e.disabled,h=void 0!==t&&t,j=e.type,x=void 0===j?"select":j,q=m.useAminoTheme(),g=q.aminoTheme,y=q.setAminoTheme,k="day"===g;return n.jsxs(n.Fragment,{children:["cards"===x&&n.jsxs(s.HStack,{className:r,children:[n.jsx(b,{"data-theme":"day",isActive:"day"===g,onClick:function(){return y("day")},type:"button",children:n.jsxs(p,{children:[n.jsx(u.ThemeLightIcon,{}),n.jsx(o.Text,{type:"bold-label",children:"Light"})]})}),n.jsx(b,{"data-theme":"night",isActive:"night"===g,onClick:function(){return y("night")},type:"button",children:n.jsxs(p,{children:[n.jsx(a.ThemeDarkIcon,{}),n.jsx(o.Text,{type:"bold-label",children:"Dark"})]})})]}),"select"===x&&n.jsx(i.Select,{className:r,icon:function(){switch(g){case"day":default:return n.jsx(d.SunnyIcon,{});case"night":return n.jsx(l.NightIcon,{})}}(),isClearable:!1,isDisabled:h,onChange:function(e){return y((null==e?void 0:e.value)||"day")},options:f,value:f.filter((function(e){return e.value===g}))}),"toggle"===x&&n.jsx(c.Switch,{checked:k,className:r,disabled:h,onChange:function(){return!h&&y("day"===g?"night":"day")},switchIconLeft:n.jsx(l.NightIcon,{}),switchIconRight:n.jsx(d.SunnyIcon,{})})]})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zonos/amino",
3
- "version": "5.1.15",
3
+ "version": "5.1.16",
4
4
  "description": "Core UI components for Amino",
5
5
  "repository": "git@github.com:Zonos/amino.git",
6
6
  "license": "MIT",
@@ -21,6 +21,7 @@
21
21
  "@mui/material": "^5.14.0",
22
22
  "@radix-ui/react-slider": "^1.1.2",
23
23
  "@types/topojson-client": "^3.1.1",
24
+ "clsx": "^2.0.0",
24
25
  "d3-geo": "^2.0.2",
25
26
  "fuse.js": "^6.6.2",
26
27
  "highlight.js": "^11.8.0",
@@ -41,6 +42,7 @@
41
42
  "@emotion/styled": "^11.x",
42
43
  "@graphiql/plugin-explorer": "^0.3",
43
44
  "@graphiql/react": "^0.19",
45
+ "dayjs": "*",
44
46
  "framer-motion": "^10.x",
45
47
  "graphiql": "^3.0.1",
46
48
  "graphql": "^16.x",
@@ -50,8 +52,7 @@
50
52
  "react-dom": "^17.x || ^18.x",
51
53
  "react-tooltip": "^4.x",
52
54
  "styled-components": "^5.x",
53
- "swr": "2.x",
54
- "dayjs": "*"
55
+ "swr": "2.x"
55
56
  },
56
57
  "types": "all.d.ts"
57
58
  }