@0xsquid/ui 0.9.1 → 0.9.3

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/cjs/index.js CHANGED
@@ -2662,6 +2662,9 @@ function ArrowLeftIcon({ className, size = '24', }) {
2662
2662
  function ChevronGrabberVerticalIcon({ size = '16', className, }) {
2663
2663
  return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M5.33301 6.00002L7.52827 3.80476C7.78862 3.54441 8.21073 3.54441 8.47108 3.80476L10.6663 6.00002M5.33301 10L7.52827 12.1953C7.78862 12.4556 8.21073 12.4556 8.47108 12.1953L10.6663 10", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
2664
2664
  }
2665
+ function SquareArrowTopRight2Icon({ className, size = '16', }) {
2666
+ return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M6.00033 2.66663H4.80033C4.05359 2.66663 3.68022 2.66663 3.395 2.81195C3.14412 2.93978 2.94015 3.14376 2.81232 3.39464C2.66699 3.67985 2.66699 4.05322 2.66699 4.79996L2.66699 11.2C2.66699 11.9467 2.66699 12.3201 2.81232 12.6053C2.94015 12.8562 3.14412 13.0601 3.395 13.188C3.68022 13.3333 4.05359 13.3333 4.80033 13.3333L11.2003 13.3333C11.9471 13.3333 12.3204 13.3333 12.6056 13.188C12.8565 13.0601 13.0605 12.8562 13.1883 12.6053C13.3337 12.3201 13.3337 11.9467 13.3337 11.2V9.99996M9.33366 2.66663L13.3337 2.66663M13.3337 2.66663V6.66663M13.3337 2.66663L7.33366 8.66663", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
2667
+ }
2665
2668
 
2666
2669
  function ArrowButton(_a) {
2667
2670
  var { label, disabled } = _a, props = __rest(_a, ["label", "disabled"]);
@@ -2810,7 +2813,7 @@ function SearchIcon() {
2810
2813
 
2811
2814
  function Input(_a) {
2812
2815
  var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon, isError = false, onPasteButtonClick } = _a, props = __rest(_a, ["placeholder", "showIcon", "showPasteButton", "className", "icon", "isError", "onPasteButtonClick"]);
2813
- return (jsxRuntime.jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsxRuntime.jsx("input", Object.assign({}, props, { className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-medium tw-text-grey-300 tw-outline-none tw-outline-offset-0 placeholder:tw-text-grey-600 focus:tw-outline-2', showIcon ? 'tw-pl-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[70px]' : 'tw-pr-2.5', isError ? 'tw-outline-status-negative' : 'focus:tw-outline-royal-500', className), placeholder: placeholder })), showIcon ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsxRuntime.jsx(SearchIcon, {}) })) : null, showPasteButton ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsxRuntime.jsx(PasteButton, { onClick: onPasteButtonClick }) })) : null] }));
2816
+ return (jsxRuntime.jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsxRuntime.jsx("input", Object.assign({}, props, { "aria-invalid": isError, className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-medium tw-text-grey-300 placeholder:tw-text-grey-600 invalid:tw-outline-status-negative', showIcon ? 'tw-pl-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[70px]' : 'tw-pr-2.5', isError && '!tw-outline-status-negative', className), placeholder: placeholder })), showIcon ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsxRuntime.jsx(SearchIcon, {}) })) : null, showPasteButton ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsxRuntime.jsx(PasteButton, { onClick: onPasteButtonClick }) })) : null] }));
2814
2817
  }
2815
2818
  const PasteButton = ({ onClick }) => {
2816
2819
  return (jsxRuntime.jsx("button", { onClick: onClick, className: "tw-h-[30px] tw-rounded-full tw-border tw-border-grey-700 tw-bg-grey-800 tw-px-2 tw-text-grey-300", children: jsxRuntime.jsx(CaptionText, { children: "Paste" }) }));
@@ -2958,8 +2961,18 @@ function HeadingText({ children, bold, size }) {
2958
2961
  return (jsxRuntime.jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
2959
2962
  }
2960
2963
 
2961
- function SettingsSlider({ value, type }) {
2962
- return (jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-xs tw-border-royal-500 tw-p-squid-xs", children: [jsxRuntime.jsx("span", { className: "tw-flex tw-items-center tw-justify-center", children: type === 'percentage' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-600", children: String(value) }), jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-300", children: "%" })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-300", children: "$" }), jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-600", children: String(value) })] })) }), jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
2964
+ function SettingsSlider({ value, type, onChange }) {
2965
+ return (jsxRuntime.jsxs("div", { className: "tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-rounded-squid-xs", children: [jsxRuntime.jsx("input", { min: 0, max: 99, placeholder: "0", type: "number", onChange: (e) => {
2966
+ onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
2967
+ }, className: cn('tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-bg-transparent tw-p-squid-xs tw-text-caption !tw-font-medium tw-leading-[10px] tw-text-grey-300 placeholder-shown:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', type === 'percentage'
2968
+ ? 'tw-w-[80px] tw-pr-[52px] tw-text-right'
2969
+ : 'tw-w-[76px] tw-pl-[20px] tw-pr-[32px] tw-text-left'), value: value }), type === 'percentage' && jsxRuntime.jsx(PercentageDecorator, {}), type === 'amount' && jsxRuntime.jsx(AmountDecorator, {})] }));
2970
+ }
2971
+ function PercentageDecorator() {
2972
+ return (jsxRuntime.jsxs("div", { className: "tw-absolute tw-right-squid-xs tw-flex tw-items-center tw-justify-center tw-gap-squid-xs !tw-font-medium tw-leading-[10px]", children: [jsxRuntime.jsx(CaptionText, { className: "tw-translate-y-[0.5px] !tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: "%" }), jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
2973
+ }
2974
+ function AmountDecorator() {
2975
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { className: "tw-absolute tw-left-squid-xs tw-translate-y-[0.5px] !tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: "$" }), jsxRuntime.jsx("div", { className: "tw-absolute tw-right-squid-xs tw-flex tw-items-center tw-justify-center tw-gap-squid-xs !tw-font-medium tw-leading-[10px]", children: jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) }) })] }));
2963
2976
  }
2964
2977
 
2965
2978
  const switchSizeClassMap = {
@@ -3093,8 +3106,8 @@ function FeeButton(_a) {
3093
3106
  return (jsxRuntime.jsxs("button", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-xl tw-w-full tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin', className), children: [jsxRuntime.jsx(Chip, { label: chipLabel }), jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(EthereumIcon, {}) }), jsxRuntime.jsx(UsdAmount, { usdAmount: feeInUsd })] })] })));
3094
3107
  }
3095
3108
 
3096
- function SettingsButton({ label }) {
3097
- return (jsxRuntime.jsx("button", { className: "tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs", children: jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
3109
+ function SettingsButton({ label, isSelected = false, }) {
3110
+ return (jsxRuntime.jsx("button", { className: cn('tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', isSelected && 'tw-outline-royal-500'), children: jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
3098
3111
  }
3099
3112
 
3100
3113
  function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, }) {
@@ -3262,7 +3275,7 @@ function HelpIcon({ size = '20', className, }) {
3262
3275
  return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_457_36778)", children: jsxRuntime.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10ZM6 7C6 4.46214 8.03736 3 10 3C12.1193 3 14 4.66531 14 7C14 7.93746 13.7596 8.6603 13.368 9.2586C13.0353 9.76679 12.6034 10.1601 12.2697 10.4639L12.1757 10.5497C11.8041 10.8904 11.534 11.1593 11.337 11.504C11.1513 11.8288 11 12.2794 11 13C11 13.5523 10.5523 14 10 14C9.44772 14 9 13.5523 9 13C9 11.9706 9.22366 11.1712 9.60051 10.5117C9.96604 9.87199 10.4459 9.42214 10.8243 9.07535L10.8834 9.02116L10.8834 9.02116L10.8834 9.02115C11.2572 8.67885 11.5066 8.45039 11.6945 8.16328C11.8654 7.9022 12 7.56254 12 7C12 5.83469 11.0807 5 10 5C8.96264 5 8 5.73786 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7ZM10 15C9.44771 15 9 15.4477 9 16C9 16.5523 9.44771 17 10 17C10.5523 17 11 16.5523 11 16C11 15.4477 10.5523 15 10 15Z", fill: "currentColor" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_457_36778", children: jsxRuntime.jsx("rect", { width: "20", height: "20", fill: "white" }) }) })] }));
3263
3276
  }
3264
3277
 
3265
- function SettingsItem({ icon, label, controls, transparentControls = false, showHelpIcon = true, link, transparent = false, helpTooltip, }) {
3278
+ function SettingsItem({ icon, label, controls = [], link, transparent = false, helpTooltip, }) {
3266
3279
  const ContentTag = link ? 'a' : 'div';
3267
3280
  const contentTagProps = link
3268
3281
  ? {
@@ -3270,11 +3283,26 @@ function SettingsItem({ icon, label, controls, transparentControls = false, show
3270
3283
  target: '_blank',
3271
3284
  }
3272
3285
  : {};
3273
- const helpIcon = showHelpIcon && (jsxRuntime.jsx(HelpIcon, { className: cn('tw-text-grey-600',
3274
- // only add hover styles if helpTooltip is provided
3275
- !!helpTooltip &&
3276
- 'tw-cursor-help tw-transition-colors tw-duration-200 hover:tw-text-grey-400') }));
3277
- return (jsxRuntime.jsx("li", { className: cn('tw-h-[50px] tw-self-stretch tw-px-squid-xs', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-900 '), children: jsxRuntime.jsxs(ContentTag, Object.assign({ className: cn('tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xs tw-text-grey-300', link && 'hover:tw-bg-material-light-thin') }, contentTagProps, { children: [icon, jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-1 tw-items-center tw-gap-squid-xxs tw-self-stretch", children: [jsxRuntime.jsx(BodyText, { size: "small", children: label }), helpTooltip ? (jsxRuntime.jsx(Tooltip, Object.assign({}, helpTooltip, { children: helpIcon }))) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: helpIcon }))] }), jsxRuntime.jsx("div", { className: cn('tw-flex tw-h-squid-l tw-items-center tw-justify-center tw-rounded-squid-xs', transparentControls ? '' : 'tw-bg-grey-800'), children: controls })] })) }));
3286
+ const helpIcon = !!helpTooltip && (jsxRuntime.jsx(HelpIcon, { className: cn('tw-text-grey-600', 'tw-cursor-help tw-transition-colors tw-duration-200 hover:tw-text-grey-400') }));
3287
+ const showDetailsBorder = controls.length > 0 &&
3288
+ !link &&
3289
+ !controls.some((control) => control.type === 'switch');
3290
+ return (jsxRuntime.jsx("li", { className: cn('tw-h-[50px] tw-self-stretch tw-px-squid-xs', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-800'), children: jsxRuntime.jsxs(ContentTag, Object.assign({ className: cn('tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xs tw-text-grey-300', link && 'hover:tw-bg-material-light-thin') }, contentTagProps, { children: [icon, jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-1 tw-items-center tw-gap-squid-xxs tw-self-stretch", children: [jsxRuntime.jsx(BodyText, { size: "small", children: label }), helpTooltip ? (jsxRuntime.jsx(Tooltip, Object.assign({}, helpTooltip, { children: helpIcon }))) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: helpIcon }))] }), jsxRuntime.jsx("div", { className: cn('tw-flex tw-h-squid-l tw-items-center tw-justify-center tw-rounded-squid-xs', showDetailsBorder &&
3291
+ 'tw-rounded-squid-xs tw-border tw-border-solid tw-border-material-light-thin tw-bg-material-dark-thin'), children: !!link ? (jsxRuntime.jsx(SquareArrowTopRight2Icon, { className: "tw-text-material-light-average" })) : (controls.map((control, index) => {
3292
+ if (control.type === 'switch') {
3293
+ const switchControl = (jsxRuntime.jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange }, index));
3294
+ if (control.tooltip) {
3295
+ return jsxRuntime.jsx(Tooltip, Object.assign({}, control.tooltip, { children: switchControl }));
3296
+ }
3297
+ return switchControl;
3298
+ }
3299
+ if (control.type === 'percentage') {
3300
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(SettingsButton, { label: control.resetValueControl.label, isSelected: control.resetValueControl.isSelected }), jsxRuntime.jsx(SettingsSlider, { value: control.value, type: "percentage" })] }));
3301
+ }
3302
+ if (control.type === 'amount') {
3303
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(SettingsButton, { label: control.resetValueControl.label, isSelected: control.resetValueControl.isSelected }), control.options.map(({ value, isSelected }, index, _controls) => (jsxRuntime.jsx(SettingsButton, { label: '$' + value, isSelected: isSelected }, index))), jsxRuntime.jsx(SettingsSlider, { type: control.type, value: 0 })] }));
3304
+ }
3305
+ })) })] })) }));
3278
3306
  }
3279
3307
 
3280
3308
  function SwapDetailListItem({ label, detail, icon, isLoading = false, }) {
@@ -3350,6 +3378,17 @@ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, m
3350
3378
  : undefined, className: cn('tw-absolute tw-inset-0 tw-z-40 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-average tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m tw-transition-all', _isOpen ? 'tw-animate-blur-in' : 'tw-animate-blur-out'), children: jsxRuntime.jsx("div", { className: cn('tw-relative tw-flex tw-max-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end', className, _isOpen ? 'tw-animate-slide-to-top' : 'tw-animate-slide-to-bottom', maxHeight && 'tw-h-full'), children: children }) })));
3351
3379
  }
3352
3380
 
3381
+ const borderTypeClassMap = {
3382
+ border: 'tw-border tw-border-material-light-thin',
3383
+ outline: 'tw-outline tw-outline-1 -tw-outline-offset-[1px] tw-outline-material-light-thin',
3384
+ };
3385
+ function ModalContent({ children, addGap = false, paddingY = false, borderType = 'border', }) {
3386
+ return (jsxRuntime.jsx("div", { className: cn('tw-flex tw-h-full tw-max-h-[535px] tw-w-full tw-flex-col tw-self-stretch tw-rounded-squid-l tw-bg-grey-800 tw-text-grey-300', addGap && 'tw-gap-squid-xxs tw-pt-squid-xxs', borderTypeClassMap[borderType], paddingY && 'tw-py-squid-xxs'), children: children }));
3387
+ }
3388
+ function ModalContentDivider() {
3389
+ return (jsxRuntime.jsx("svg", { width: "100%", height: "11", viewBox: "0 0 400 11", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("rect", { x: "1", y: "5", width: "398", height: "1", fill: "currentColor" }) }));
3390
+ }
3391
+
3353
3392
  function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, actions, }) {
3354
3393
  return (jsxRuntime.jsxs("nav", { className: cn('tw-flex tw-max-h-[120px] tw-min-w-96 tw-flex-col tw-text-grey-300', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-900'), children: [jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-xxl tw-items-center tw-justify-end tw-gap-x-squid-xs', displayBackButton ? 'tw-px-squid-m' : 'tw-pl-squid-l tw-pr-squid-m'), children: [displayBackButton ? (jsxRuntime.jsx(Button, { className: displayButtonShadows
3355
3394
  ? 'group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2'
@@ -3543,6 +3582,8 @@ exports.LoadingSkeleton = LoadingSkeleton;
3543
3582
  exports.Menu = Menu;
3544
3583
  exports.MenuItem = MenuItem;
3545
3584
  exports.Modal = Modal;
3585
+ exports.ModalContent = ModalContent;
3586
+ exports.ModalContentDivider = ModalContentDivider;
3546
3587
  exports.NavigationBar = NavigationBar;
3547
3588
  exports.NumericInput = NumericInput;
3548
3589
  exports.ProductCard = ProductCard;
@@ -1,4 +1,5 @@
1
1
  export interface SettingsButtonProps {
2
2
  label: string;
3
+ isSelected?: boolean;
3
4
  }
4
- export declare function SettingsButton({ label }: SettingsButtonProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function SettingsButton({ label, isSelected, }: SettingsButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  export interface SettingsSliderProps {
2
2
  value: number;
3
3
  type: 'percentage' | 'amount';
4
+ onChange?: (value: string) => void;
4
5
  }
5
- export declare function SettingsSlider({ value, type }: SettingsSliderProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function SettingsSlider({ value, type, onChange }: SettingsSliderProps): import("react/jsx-runtime").JSX.Element;
@@ -10,3 +10,7 @@ export declare const SettingsGearIcon: ({ size, className, }: {
10
10
  className?: string;
11
11
  size?: string;
12
12
  }) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const ExplosionIcon: ({ size, className, }: {
14
+ className?: string;
15
+ size?: string;
16
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  type ModalContentBorderType = 'border' | 'outline';
3
- export declare function ModalContent({ children, addGap, borderType, }: {
3
+ export declare function ModalContent({ children, addGap, paddingY, borderType, }: {
4
4
  children?: React.ReactNode;
5
5
  addGap?: boolean;
6
+ paddingY?: boolean;
6
7
  borderType?: ModalContentBorderType;
7
8
  }): import("react/jsx-runtime").JSX.Element;
9
+ export declare function ModalContentDivider(): import("react/jsx-runtime").JSX.Element;
8
10
  export {};
@@ -5,6 +5,7 @@ export * from './ErrorMessage';
5
5
  export * from './InfoBox';
6
6
  export * from './Menu';
7
7
  export * from './Modal';
8
+ export * from './ModalContent';
8
9
  export * from './NavigationBar';
9
10
  export * from './ProductCard';
10
11
  export * from './ProfileHeaderBackground';
@@ -1,13 +1,38 @@
1
1
  /// <reference types="react" />
2
2
  import { TooltipProps } from '../controls';
3
+ export type SettingsControl = {
4
+ type: 'percentage';
5
+ value: number;
6
+ onChange: (value: number) => void;
7
+ resetValueControl: {
8
+ label: string;
9
+ onSelect: () => void;
10
+ isSelected?: boolean;
11
+ };
12
+ } | {
13
+ type: 'amount';
14
+ options: {
15
+ value: number;
16
+ isSelected?: boolean;
17
+ onSelect?: () => void;
18
+ }[];
19
+ resetValueControl: {
20
+ label: string;
21
+ onSelect: () => void;
22
+ isSelected?: boolean;
23
+ };
24
+ } | {
25
+ type: 'switch';
26
+ checked: boolean;
27
+ onChange: (checked: boolean) => void;
28
+ tooltip?: Omit<TooltipProps, 'children'>;
29
+ };
3
30
  export interface SettingsItemProps {
4
31
  icon: React.ReactNode;
5
32
  label: string;
6
- controls?: React.ReactNode;
7
- transparentControls?: boolean;
8
- showHelpIcon?: boolean;
33
+ controls?: SettingsControl[];
9
34
  link?: string;
10
35
  transparent?: boolean;
11
36
  helpTooltip?: Omit<TooltipProps, 'children'>;
12
37
  }
13
- export declare function SettingsItem({ icon, label, controls, transparentControls, showHelpIcon, link, transparent, helpTooltip, }: SettingsItemProps): import("react/jsx-runtime").JSX.Element;
38
+ export declare function SettingsItem({ icon, label, controls, link, transparent, helpTooltip, }: SettingsItemProps): import("react/jsx-runtime").JSX.Element;
@@ -4,3 +4,4 @@ declare const meta: Meta<typeof SettingsButton>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
+ export declare const Selected: Story;
@@ -6,3 +6,4 @@ type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
7
  export declare const WithBorder: Story;
8
8
  export declare const WithOutline: Story;
9
+ export declare const VerticalPadding: Story;
@@ -5,8 +5,10 @@ export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
7
  export declare const WithControls: Story;
8
- export declare const WithoutHelpIcon: Story;
9
- export declare const TransparentControls: Story;
10
8
  export declare const Link: Story;
11
9
  export declare const Transparent: Story;
12
10
  export declare const WithHelpTooltip: Story;
11
+ export declare const SwitchControl: Story;
12
+ export declare const SwitchControlWithTooltip: Story;
13
+ export declare const AmountControls: Story;
14
+ export declare const PercentageControls: Story;
package/dist/esm/index.js CHANGED
@@ -2660,6 +2660,9 @@ function ArrowLeftIcon({ className, size = '24', }) {
2660
2660
  function ChevronGrabberVerticalIcon({ size = '16', className, }) {
2661
2661
  return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsx("path", { d: "M5.33301 6.00002L7.52827 3.80476C7.78862 3.54441 8.21073 3.54441 8.47108 3.80476L10.6663 6.00002M5.33301 10L7.52827 12.1953C7.78862 12.4556 8.21073 12.4556 8.47108 12.1953L10.6663 10", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
2662
2662
  }
2663
+ function SquareArrowTopRight2Icon({ className, size = '16', }) {
2664
+ return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsx("path", { d: "M6.00033 2.66663H4.80033C4.05359 2.66663 3.68022 2.66663 3.395 2.81195C3.14412 2.93978 2.94015 3.14376 2.81232 3.39464C2.66699 3.67985 2.66699 4.05322 2.66699 4.79996L2.66699 11.2C2.66699 11.9467 2.66699 12.3201 2.81232 12.6053C2.94015 12.8562 3.14412 13.0601 3.395 13.188C3.68022 13.3333 4.05359 13.3333 4.80033 13.3333L11.2003 13.3333C11.9471 13.3333 12.3204 13.3333 12.6056 13.188C12.8565 13.0601 13.0605 12.8562 13.1883 12.6053C13.3337 12.3201 13.3337 11.9467 13.3337 11.2V9.99996M9.33366 2.66663L13.3337 2.66663M13.3337 2.66663V6.66663M13.3337 2.66663L7.33366 8.66663", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
2665
+ }
2663
2666
 
2664
2667
  function ArrowButton(_a) {
2665
2668
  var { label, disabled } = _a, props = __rest(_a, ["label", "disabled"]);
@@ -2808,7 +2811,7 @@ function SearchIcon() {
2808
2811
 
2809
2812
  function Input(_a) {
2810
2813
  var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon, isError = false, onPasteButtonClick } = _a, props = __rest(_a, ["placeholder", "showIcon", "showPasteButton", "className", "icon", "isError", "onPasteButtonClick"]);
2811
- return (jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsx("input", Object.assign({}, props, { className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-medium tw-text-grey-300 tw-outline-none tw-outline-offset-0 placeholder:tw-text-grey-600 focus:tw-outline-2', showIcon ? 'tw-pl-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[70px]' : 'tw-pr-2.5', isError ? 'tw-outline-status-negative' : 'focus:tw-outline-royal-500', className), placeholder: placeholder })), showIcon ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsx(SearchIcon, {}) })) : null, showPasteButton ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsx(PasteButton, { onClick: onPasteButtonClick }) })) : null] }));
2814
+ return (jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsx("input", Object.assign({}, props, { "aria-invalid": isError, className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-medium tw-text-grey-300 placeholder:tw-text-grey-600 invalid:tw-outline-status-negative', showIcon ? 'tw-pl-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[70px]' : 'tw-pr-2.5', isError && '!tw-outline-status-negative', className), placeholder: placeholder })), showIcon ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsx(SearchIcon, {}) })) : null, showPasteButton ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsx(PasteButton, { onClick: onPasteButtonClick }) })) : null] }));
2812
2815
  }
2813
2816
  const PasteButton = ({ onClick }) => {
2814
2817
  return (jsx("button", { onClick: onClick, className: "tw-h-[30px] tw-rounded-full tw-border tw-border-grey-700 tw-bg-grey-800 tw-px-2 tw-text-grey-300", children: jsx(CaptionText, { children: "Paste" }) }));
@@ -2956,8 +2959,18 @@ function HeadingText({ children, bold, size }) {
2956
2959
  return (jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
2957
2960
  }
2958
2961
 
2959
- function SettingsSlider({ value, type }) {
2960
- return (jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-xs tw-border-royal-500 tw-p-squid-xs", children: [jsx("span", { className: "tw-flex tw-items-center tw-justify-center", children: type === 'percentage' ? (jsxs(Fragment, { children: [jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-600", children: String(value) }), jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-300", children: "%" })] })) : (jsxs(Fragment, { children: [jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-300", children: "$" }), jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-600", children: String(value) })] })) }), jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
2962
+ function SettingsSlider({ value, type, onChange }) {
2963
+ return (jsxs("div", { className: "tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-rounded-squid-xs", children: [jsx("input", { min: 0, max: 99, placeholder: "0", type: "number", onChange: (e) => {
2964
+ onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
2965
+ }, className: cn('tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-bg-transparent tw-p-squid-xs tw-text-caption !tw-font-medium tw-leading-[10px] tw-text-grey-300 placeholder-shown:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', type === 'percentage'
2966
+ ? 'tw-w-[80px] tw-pr-[52px] tw-text-right'
2967
+ : 'tw-w-[76px] tw-pl-[20px] tw-pr-[32px] tw-text-left'), value: value }), type === 'percentage' && jsx(PercentageDecorator, {}), type === 'amount' && jsx(AmountDecorator, {})] }));
2968
+ }
2969
+ function PercentageDecorator() {
2970
+ return (jsxs("div", { className: "tw-absolute tw-right-squid-xs tw-flex tw-items-center tw-justify-center tw-gap-squid-xs !tw-font-medium tw-leading-[10px]", children: [jsx(CaptionText, { className: "tw-translate-y-[0.5px] !tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: "%" }), jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
2971
+ }
2972
+ function AmountDecorator() {
2973
+ return (jsxs(Fragment, { children: [jsx(CaptionText, { className: "tw-absolute tw-left-squid-xs tw-translate-y-[0.5px] !tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: "$" }), jsx("div", { className: "tw-absolute tw-right-squid-xs tw-flex tw-items-center tw-justify-center tw-gap-squid-xs !tw-font-medium tw-leading-[10px]", children: jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) }) })] }));
2961
2974
  }
2962
2975
 
2963
2976
  const switchSizeClassMap = {
@@ -3091,8 +3104,8 @@ function FeeButton(_a) {
3091
3104
  return (jsxs("button", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-xl tw-w-full tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin', className), children: [jsx(Chip, { label: chipLabel }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: feeInUsd })] })] })));
3092
3105
  }
3093
3106
 
3094
- function SettingsButton({ label }) {
3095
- return (jsx("button", { className: "tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs", children: jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
3107
+ function SettingsButton({ label, isSelected = false, }) {
3108
+ return (jsx("button", { className: cn('tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', isSelected && 'tw-outline-royal-500'), children: jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
3096
3109
  }
3097
3110
 
3098
3111
  function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, }) {
@@ -3260,7 +3273,7 @@ function HelpIcon({ size = '20', className, }) {
3260
3273
  return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsx("g", { "clip-path": "url(#clip0_457_36778)", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10ZM6 7C6 4.46214 8.03736 3 10 3C12.1193 3 14 4.66531 14 7C14 7.93746 13.7596 8.6603 13.368 9.2586C13.0353 9.76679 12.6034 10.1601 12.2697 10.4639L12.1757 10.5497C11.8041 10.8904 11.534 11.1593 11.337 11.504C11.1513 11.8288 11 12.2794 11 13C11 13.5523 10.5523 14 10 14C9.44772 14 9 13.5523 9 13C9 11.9706 9.22366 11.1712 9.60051 10.5117C9.96604 9.87199 10.4459 9.42214 10.8243 9.07535L10.8834 9.02116L10.8834 9.02116L10.8834 9.02115C11.2572 8.67885 11.5066 8.45039 11.6945 8.16328C11.8654 7.9022 12 7.56254 12 7C12 5.83469 11.0807 5 10 5C8.96264 5 8 5.73786 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7ZM10 15C9.44771 15 9 15.4477 9 16C9 16.5523 9.44771 17 10 17C10.5523 17 11 16.5523 11 16C11 15.4477 10.5523 15 10 15Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_457_36778", children: jsx("rect", { width: "20", height: "20", fill: "white" }) }) })] }));
3261
3274
  }
3262
3275
 
3263
- function SettingsItem({ icon, label, controls, transparentControls = false, showHelpIcon = true, link, transparent = false, helpTooltip, }) {
3276
+ function SettingsItem({ icon, label, controls = [], link, transparent = false, helpTooltip, }) {
3264
3277
  const ContentTag = link ? 'a' : 'div';
3265
3278
  const contentTagProps = link
3266
3279
  ? {
@@ -3268,11 +3281,26 @@ function SettingsItem({ icon, label, controls, transparentControls = false, show
3268
3281
  target: '_blank',
3269
3282
  }
3270
3283
  : {};
3271
- const helpIcon = showHelpIcon && (jsx(HelpIcon, { className: cn('tw-text-grey-600',
3272
- // only add hover styles if helpTooltip is provided
3273
- !!helpTooltip &&
3274
- 'tw-cursor-help tw-transition-colors tw-duration-200 hover:tw-text-grey-400') }));
3275
- return (jsx("li", { className: cn('tw-h-[50px] tw-self-stretch tw-px-squid-xs', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-900 '), children: jsxs(ContentTag, Object.assign({ className: cn('tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xs tw-text-grey-300', link && 'hover:tw-bg-material-light-thin') }, contentTagProps, { children: [icon, jsxs("div", { className: "tw-flex tw-flex-1 tw-items-center tw-gap-squid-xxs tw-self-stretch", children: [jsx(BodyText, { size: "small", children: label }), helpTooltip ? (jsx(Tooltip, Object.assign({}, helpTooltip, { children: helpIcon }))) : (jsx(Fragment, { children: helpIcon }))] }), jsx("div", { className: cn('tw-flex tw-h-squid-l tw-items-center tw-justify-center tw-rounded-squid-xs', transparentControls ? '' : 'tw-bg-grey-800'), children: controls })] })) }));
3284
+ const helpIcon = !!helpTooltip && (jsx(HelpIcon, { className: cn('tw-text-grey-600', 'tw-cursor-help tw-transition-colors tw-duration-200 hover:tw-text-grey-400') }));
3285
+ const showDetailsBorder = controls.length > 0 &&
3286
+ !link &&
3287
+ !controls.some((control) => control.type === 'switch');
3288
+ return (jsx("li", { className: cn('tw-h-[50px] tw-self-stretch tw-px-squid-xs', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-800'), children: jsxs(ContentTag, Object.assign({ className: cn('tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xs tw-text-grey-300', link && 'hover:tw-bg-material-light-thin') }, contentTagProps, { children: [icon, jsxs("div", { className: "tw-flex tw-flex-1 tw-items-center tw-gap-squid-xxs tw-self-stretch", children: [jsx(BodyText, { size: "small", children: label }), helpTooltip ? (jsx(Tooltip, Object.assign({}, helpTooltip, { children: helpIcon }))) : (jsx(Fragment, { children: helpIcon }))] }), jsx("div", { className: cn('tw-flex tw-h-squid-l tw-items-center tw-justify-center tw-rounded-squid-xs', showDetailsBorder &&
3289
+ 'tw-rounded-squid-xs tw-border tw-border-solid tw-border-material-light-thin tw-bg-material-dark-thin'), children: !!link ? (jsx(SquareArrowTopRight2Icon, { className: "tw-text-material-light-average" })) : (controls.map((control, index) => {
3290
+ if (control.type === 'switch') {
3291
+ const switchControl = (jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange }, index));
3292
+ if (control.tooltip) {
3293
+ return jsx(Tooltip, Object.assign({}, control.tooltip, { children: switchControl }));
3294
+ }
3295
+ return switchControl;
3296
+ }
3297
+ if (control.type === 'percentage') {
3298
+ return (jsxs(Fragment, { children: [jsx(SettingsButton, { label: control.resetValueControl.label, isSelected: control.resetValueControl.isSelected }), jsx(SettingsSlider, { value: control.value, type: "percentage" })] }));
3299
+ }
3300
+ if (control.type === 'amount') {
3301
+ return (jsxs(Fragment, { children: [jsx(SettingsButton, { label: control.resetValueControl.label, isSelected: control.resetValueControl.isSelected }), control.options.map(({ value, isSelected }, index, _controls) => (jsx(SettingsButton, { label: '$' + value, isSelected: isSelected }, index))), jsx(SettingsSlider, { type: control.type, value: 0 })] }));
3302
+ }
3303
+ })) })] })) }));
3276
3304
  }
3277
3305
 
3278
3306
  function SwapDetailListItem({ label, detail, icon, isLoading = false, }) {
@@ -3348,6 +3376,17 @@ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, m
3348
3376
  : undefined, className: cn('tw-absolute tw-inset-0 tw-z-40 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-average tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m tw-transition-all', _isOpen ? 'tw-animate-blur-in' : 'tw-animate-blur-out'), children: jsx("div", { className: cn('tw-relative tw-flex tw-max-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end', className, _isOpen ? 'tw-animate-slide-to-top' : 'tw-animate-slide-to-bottom', maxHeight && 'tw-h-full'), children: children }) })));
3349
3377
  }
3350
3378
 
3379
+ const borderTypeClassMap = {
3380
+ border: 'tw-border tw-border-material-light-thin',
3381
+ outline: 'tw-outline tw-outline-1 -tw-outline-offset-[1px] tw-outline-material-light-thin',
3382
+ };
3383
+ function ModalContent({ children, addGap = false, paddingY = false, borderType = 'border', }) {
3384
+ return (jsx("div", { className: cn('tw-flex tw-h-full tw-max-h-[535px] tw-w-full tw-flex-col tw-self-stretch tw-rounded-squid-l tw-bg-grey-800 tw-text-grey-300', addGap && 'tw-gap-squid-xxs tw-pt-squid-xxs', borderTypeClassMap[borderType], paddingY && 'tw-py-squid-xxs'), children: children }));
3385
+ }
3386
+ function ModalContentDivider() {
3387
+ return (jsx("svg", { width: "100%", height: "11", viewBox: "0 0 400 11", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("rect", { x: "1", y: "5", width: "398", height: "1", fill: "currentColor" }) }));
3388
+ }
3389
+
3351
3390
  function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, actions, }) {
3352
3391
  return (jsxs("nav", { className: cn('tw-flex tw-max-h-[120px] tw-min-w-96 tw-flex-col tw-text-grey-300', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-900'), children: [jsxs("div", { className: cn('tw-flex tw-h-squid-xxl tw-items-center tw-justify-end tw-gap-x-squid-xs', displayBackButton ? 'tw-px-squid-m' : 'tw-pl-squid-l tw-pr-squid-m'), children: [displayBackButton ? (jsx(Button, { className: displayButtonShadows
3353
3392
  ? 'group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2'
@@ -3517,4 +3556,4 @@ function SquidConfigProvider({ theme, children, themeType = 'light', }) {
3517
3556
  return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-group tw-relative tw-font-geist", children: children }));
3518
3557
  }
3519
3558
 
3520
- export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, ErrorMessage, FeeButton, HeadingText, HistoryItem, InfoBox, Input, ListItem, LoadingSkeleton, Menu, MenuItem, Modal, NavigationBar, NumericInput, ProductCard, ProfileHeaderBackground, SectionTitle, SettingsButton, SettingsItem, SettingsSlider, SquidConfigProvider, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, UsdAmount, useDropdownMenu };
3559
+ export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, ErrorMessage, FeeButton, HeadingText, HistoryItem, InfoBox, Input, ListItem, LoadingSkeleton, Menu, MenuItem, Modal, ModalContent, ModalContentDivider, NavigationBar, NumericInput, ProductCard, ProfileHeaderBackground, SectionTitle, SettingsButton, SettingsItem, SettingsSlider, SquidConfigProvider, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, UsdAmount, useDropdownMenu };
@@ -1,4 +1,5 @@
1
1
  export interface SettingsButtonProps {
2
2
  label: string;
3
+ isSelected?: boolean;
3
4
  }
4
- export declare function SettingsButton({ label }: SettingsButtonProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function SettingsButton({ label, isSelected, }: SettingsButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  export interface SettingsSliderProps {
2
2
  value: number;
3
3
  type: 'percentage' | 'amount';
4
+ onChange?: (value: string) => void;
4
5
  }
5
- export declare function SettingsSlider({ value, type }: SettingsSliderProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function SettingsSlider({ value, type, onChange }: SettingsSliderProps): import("react/jsx-runtime").JSX.Element;
@@ -10,3 +10,7 @@ export declare const SettingsGearIcon: ({ size, className, }: {
10
10
  className?: string;
11
11
  size?: string;
12
12
  }) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const ExplosionIcon: ({ size, className, }: {
14
+ className?: string;
15
+ size?: string;
16
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  type ModalContentBorderType = 'border' | 'outline';
3
- export declare function ModalContent({ children, addGap, borderType, }: {
3
+ export declare function ModalContent({ children, addGap, paddingY, borderType, }: {
4
4
  children?: React.ReactNode;
5
5
  addGap?: boolean;
6
+ paddingY?: boolean;
6
7
  borderType?: ModalContentBorderType;
7
8
  }): import("react/jsx-runtime").JSX.Element;
9
+ export declare function ModalContentDivider(): import("react/jsx-runtime").JSX.Element;
8
10
  export {};
@@ -5,6 +5,7 @@ export * from './ErrorMessage';
5
5
  export * from './InfoBox';
6
6
  export * from './Menu';
7
7
  export * from './Modal';
8
+ export * from './ModalContent';
8
9
  export * from './NavigationBar';
9
10
  export * from './ProductCard';
10
11
  export * from './ProfileHeaderBackground';
@@ -1,13 +1,38 @@
1
1
  /// <reference types="react" />
2
2
  import { TooltipProps } from '../controls';
3
+ export type SettingsControl = {
4
+ type: 'percentage';
5
+ value: number;
6
+ onChange: (value: number) => void;
7
+ resetValueControl: {
8
+ label: string;
9
+ onSelect: () => void;
10
+ isSelected?: boolean;
11
+ };
12
+ } | {
13
+ type: 'amount';
14
+ options: {
15
+ value: number;
16
+ isSelected?: boolean;
17
+ onSelect?: () => void;
18
+ }[];
19
+ resetValueControl: {
20
+ label: string;
21
+ onSelect: () => void;
22
+ isSelected?: boolean;
23
+ };
24
+ } | {
25
+ type: 'switch';
26
+ checked: boolean;
27
+ onChange: (checked: boolean) => void;
28
+ tooltip?: Omit<TooltipProps, 'children'>;
29
+ };
3
30
  export interface SettingsItemProps {
4
31
  icon: React.ReactNode;
5
32
  label: string;
6
- controls?: React.ReactNode;
7
- transparentControls?: boolean;
8
- showHelpIcon?: boolean;
33
+ controls?: SettingsControl[];
9
34
  link?: string;
10
35
  transparent?: boolean;
11
36
  helpTooltip?: Omit<TooltipProps, 'children'>;
12
37
  }
13
- export declare function SettingsItem({ icon, label, controls, transparentControls, showHelpIcon, link, transparent, helpTooltip, }: SettingsItemProps): import("react/jsx-runtime").JSX.Element;
38
+ export declare function SettingsItem({ icon, label, controls, link, transparent, helpTooltip, }: SettingsItemProps): import("react/jsx-runtime").JSX.Element;
@@ -4,3 +4,4 @@ declare const meta: Meta<typeof SettingsButton>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
+ export declare const Selected: Story;
@@ -6,3 +6,4 @@ type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
7
  export declare const WithBorder: Story;
8
8
  export declare const WithOutline: Story;
9
+ export declare const VerticalPadding: Story;
@@ -5,8 +5,10 @@ export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
7
  export declare const WithControls: Story;
8
- export declare const WithoutHelpIcon: Story;
9
- export declare const TransparentControls: Story;
10
8
  export declare const Link: Story;
11
9
  export declare const Transparent: Story;
12
10
  export declare const WithHelpTooltip: Story;
11
+ export declare const SwitchControl: Story;
12
+ export declare const SwitchControlWithTooltip: Story;
13
+ export declare const AmountControls: Story;
14
+ export declare const PercentageControls: Story;
package/dist/index.css CHANGED
@@ -685,6 +685,10 @@ video {
685
685
  left: calc(50% - 1.5px);
686
686
  }
687
687
 
688
+ .tw-left-squid-xs {
689
+ left: 0.625rem;
690
+ }
691
+
688
692
  .tw-right-0 {
689
693
  right: 0px;
690
694
  }
@@ -709,6 +713,10 @@ video {
709
713
  right: calc(100% - 10px);
710
714
  }
711
715
 
716
+ .tw-right-squid-xs {
717
+ right: 0.625rem;
718
+ }
719
+
712
720
  .tw-right-squid-xxs {
713
721
  right: 0.3125rem;
714
722
  }
@@ -1184,6 +1192,14 @@ video {
1184
1192
  width: 72px;
1185
1193
  }
1186
1194
 
1195
+ .tw-w-\[76px\] {
1196
+ width: 76px;
1197
+ }
1198
+
1199
+ .tw-w-\[80px\] {
1200
+ width: 80px;
1201
+ }
1202
+
1187
1203
  .tw-w-\[90px\] {
1188
1204
  width: 90px;
1189
1205
  }
@@ -1345,6 +1361,11 @@ video {
1345
1361
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1346
1362
  }
1347
1363
 
1364
+ .tw-translate-y-\[0\.5px\] {
1365
+ --tw-translate-y: 0.5px;
1366
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1367
+ }
1368
+
1348
1369
  .tw-rotate-180 {
1349
1370
  --tw-rotate: 180deg;
1350
1371
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
@@ -1783,10 +1804,6 @@ video {
1783
1804
  border-color: var(--squid-theme-material-light-thin);
1784
1805
  }
1785
1806
 
1786
- .tw-border-royal-500 {
1787
- border-color: var(--squid-theme-royal-500);
1788
- }
1789
-
1790
1807
  .tw-border-slate-800 {
1791
1808
  --tw-border-opacity: 1;
1792
1809
  border-color: rgb(30 41 59 / var(--tw-border-opacity));
@@ -1854,6 +1871,10 @@ video {
1854
1871
  background-color: var(--squid-theme-material-dark-thick);
1855
1872
  }
1856
1873
 
1874
+ .tw-bg-material-dark-thin {
1875
+ background-color: var(--squid-theme-material-dark-thin);
1876
+ }
1877
+
1857
1878
  .tw-bg-material-light-thick {
1858
1879
  background-color: var(--squid-theme-material-light-thick);
1859
1880
  }
@@ -2108,6 +2129,10 @@ video {
2108
2129
  padding-left: 0.25rem;
2109
2130
  }
2110
2131
 
2132
+ .tw-pl-\[20px\] {
2133
+ padding-left: 20px;
2134
+ }
2135
+
2111
2136
  .tw-pl-\[44px\] {
2112
2137
  padding-left: 44px;
2113
2138
  }
@@ -2140,6 +2165,14 @@ video {
2140
2165
  padding-right: 1rem;
2141
2166
  }
2142
2167
 
2168
+ .tw-pr-\[32px\] {
2169
+ padding-right: 32px;
2170
+ }
2171
+
2172
+ .tw-pr-\[52px\] {
2173
+ padding-right: 52px;
2174
+ }
2175
+
2143
2176
  .tw-pr-squid-m {
2144
2177
  padding-right: 1.25rem;
2145
2178
  }
@@ -2172,6 +2205,10 @@ video {
2172
2205
  padding-top: 0.3125rem;
2173
2206
  }
2174
2207
 
2208
+ .tw-text-left {
2209
+ text-align: left;
2210
+ }
2211
+
2175
2212
  .tw-text-center {
2176
2213
  text-align: center;
2177
2214
  }
@@ -2429,11 +2466,6 @@ video {
2429
2466
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
2430
2467
  }
2431
2468
 
2432
- .tw-outline-none {
2433
- outline: 2px solid transparent;
2434
- outline-offset: 2px;
2435
- }
2436
-
2437
2469
  .tw-outline {
2438
2470
  outline-style: solid;
2439
2471
  }
@@ -2450,16 +2482,16 @@ video {
2450
2482
  outline-offset: -1px;
2451
2483
  }
2452
2484
 
2453
- .tw-outline-offset-0 {
2454
- outline-offset: 0px;
2485
+ .\!tw-outline-status-negative {
2486
+ outline-color: var(--squid-theme-status-negative) !important;
2455
2487
  }
2456
2488
 
2457
2489
  .tw-outline-material-light-thin {
2458
2490
  outline-color: var(--squid-theme-material-light-thin);
2459
2491
  }
2460
2492
 
2461
- .tw-outline-status-negative {
2462
- outline-color: var(--squid-theme-status-negative);
2493
+ .tw-outline-royal-500 {
2494
+ outline-color: var(--squid-theme-royal-500);
2463
2495
  }
2464
2496
 
2465
2497
  .tw-backdrop-blur-2xl {
@@ -2570,6 +2602,32 @@ li {
2570
2602
  );
2571
2603
  }
2572
2604
 
2605
+ button,
2606
+ input {
2607
+ outline: 2px solid transparent;
2608
+ outline-offset: -1px;
2609
+ }
2610
+
2611
+ button:focus,
2612
+ input:focus {
2613
+ outline-width: 2px;
2614
+ outline-color: var(--squid-theme-royal-500);
2615
+ }
2616
+
2617
+ /* Chrome, Safari, Edge, Opera */
2618
+
2619
+ input::-webkit-outer-spin-button,
2620
+ input::-webkit-inner-spin-button {
2621
+ -webkit-appearance: none;
2622
+ margin: 0;
2623
+ }
2624
+
2625
+ /* Firefox */
2626
+
2627
+ input[type='number'] {
2628
+ -moz-appearance: textfield;
2629
+ }
2630
+
2573
2631
  .placeholder\:tw-text-grey-600::-moz-placeholder {
2574
2632
  color: var(--squid-theme-grey-600);
2575
2633
  }
@@ -2578,6 +2636,18 @@ li {
2578
2636
  color: var(--squid-theme-grey-600);
2579
2637
  }
2580
2638
 
2639
+ .placeholder-shown\:tw-text-grey-600:-moz-placeholder-shown {
2640
+ color: var(--squid-theme-grey-600);
2641
+ }
2642
+
2643
+ .placeholder-shown\:tw-text-grey-600:placeholder-shown {
2644
+ color: var(--squid-theme-grey-600);
2645
+ }
2646
+
2647
+ .invalid\:tw-outline-status-negative:invalid {
2648
+ outline-color: var(--squid-theme-status-negative);
2649
+ }
2650
+
2581
2651
  .hover\:tw-block:hover {
2582
2652
  display: block;
2583
2653
  }
@@ -2607,14 +2677,6 @@ li {
2607
2677
  outline-offset: 2px;
2608
2678
  }
2609
2679
 
2610
- .focus\:tw-outline-2:focus {
2611
- outline-width: 2px;
2612
- }
2613
-
2614
- .focus\:tw-outline-royal-500:focus {
2615
- outline-color: var(--squid-theme-royal-500);
2616
- }
2617
-
2618
2680
  .disabled\:tw-bg-grey-800:disabled {
2619
2681
  background-color: var(--squid-theme-grey-800);
2620
2682
  }
package/dist/index.d.ts CHANGED
@@ -98,8 +98,9 @@ declare function FeeButton({ feeInUsd, chipLabel, className, ...props }: FeeButt
98
98
 
99
99
  interface SettingsButtonProps {
100
100
  label: string;
101
+ isSelected?: boolean;
101
102
  }
102
- declare function SettingsButton({ label }: SettingsButtonProps): react_jsx_runtime.JSX.Element;
103
+ declare function SettingsButton({ label, isSelected, }: SettingsButtonProps): react_jsx_runtime.JSX.Element;
103
104
 
104
105
  interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
105
106
  placeholder?: string;
@@ -124,8 +125,9 @@ declare const NumericInput: ({ onParsedValueChanged, initialValue, forcedUpdateV
124
125
  interface SettingsSliderProps {
125
126
  value: number;
126
127
  type: 'percentage' | 'amount';
128
+ onChange?: (value: string) => void;
127
129
  }
128
- declare function SettingsSlider({ value, type }: SettingsSliderProps): react_jsx_runtime.JSX.Element;
130
+ declare function SettingsSlider({ value, type, onChange }: SettingsSliderProps): react_jsx_runtime.JSX.Element;
129
131
 
130
132
  interface SwitchProps {
131
133
  checked?: boolean;
@@ -241,17 +243,42 @@ interface SectionTitleProps {
241
243
  }
242
244
  declare function SectionTitle({ title, icon, accessory, actionIcon, className, }: SectionTitleProps): react_jsx_runtime.JSX.Element;
243
245
 
246
+ type SettingsControl = {
247
+ type: 'percentage';
248
+ value: number;
249
+ onChange: (value: number) => void;
250
+ resetValueControl: {
251
+ label: string;
252
+ onSelect: () => void;
253
+ isSelected?: boolean;
254
+ };
255
+ } | {
256
+ type: 'amount';
257
+ options: {
258
+ value: number;
259
+ isSelected?: boolean;
260
+ onSelect?: () => void;
261
+ }[];
262
+ resetValueControl: {
263
+ label: string;
264
+ onSelect: () => void;
265
+ isSelected?: boolean;
266
+ };
267
+ } | {
268
+ type: 'switch';
269
+ checked: boolean;
270
+ onChange: (checked: boolean) => void;
271
+ tooltip?: Omit<TooltipProps, 'children'>;
272
+ };
244
273
  interface SettingsItemProps {
245
274
  icon: React.ReactNode;
246
275
  label: string;
247
- controls?: React.ReactNode;
248
- transparentControls?: boolean;
249
- showHelpIcon?: boolean;
276
+ controls?: SettingsControl[];
250
277
  link?: string;
251
278
  transparent?: boolean;
252
279
  helpTooltip?: Omit<TooltipProps, 'children'>;
253
280
  }
254
- declare function SettingsItem({ icon, label, controls, transparentControls, showHelpIcon, link, transparent, helpTooltip, }: SettingsItemProps): react_jsx_runtime.JSX.Element;
281
+ declare function SettingsItem({ icon, label, controls, link, transparent, helpTooltip, }: SettingsItemProps): react_jsx_runtime.JSX.Element;
255
282
 
256
283
  interface SwapDetailListItemProps {
257
284
  label: string;
@@ -313,6 +340,15 @@ interface ModalProps {
313
340
  }
314
341
  declare function Modal({ children, className, onBackdropClick, isOpen: _isOpen, maxHeight, }: ModalProps): false | react_jsx_runtime.JSX.Element;
315
342
 
343
+ type ModalContentBorderType = 'border' | 'outline';
344
+ declare function ModalContent({ children, addGap, paddingY, borderType, }: {
345
+ children?: React.ReactNode;
346
+ addGap?: boolean;
347
+ paddingY?: boolean;
348
+ borderType?: ModalContentBorderType;
349
+ }): react_jsx_runtime.JSX.Element;
350
+ declare function ModalContentDivider(): react_jsx_runtime.JSX.Element;
351
+
316
352
  type ActionButton = {
317
353
  labelOrIcon: string | React.ReactNode;
318
354
  onClick?: () => void;
@@ -457,4 +493,4 @@ declare function useDropdownMenu(props?: {
457
493
  openDropdownButtonRef: React.RefObject<HTMLButtonElement>;
458
494
  };
459
495
 
460
- export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, ErrorMessage, FeeButton, HeadingText, HistoryItem, InfoBox, Input, ListItem, LoadingSkeleton, Menu, MenuItem, Modal, NavigationBar, NumericInput, ProductCard, ProfileHeaderBackground, SectionTitle, SettingsButton, type SettingsButtonProps, SettingsItem, type SettingsItemProps, SettingsSlider, type SettingsSliderProps, SquidConfigProvider, type SquidTheme, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, type TooltipProps, type TooltipThreshold, type TooltipWidth, UsdAmount, useDropdownMenu };
496
+ export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, ErrorMessage, FeeButton, HeadingText, HistoryItem, InfoBox, Input, ListItem, LoadingSkeleton, Menu, MenuItem, Modal, ModalContent, ModalContentDivider, NavigationBar, NumericInput, ProductCard, ProfileHeaderBackground, SectionTitle, SettingsButton, type SettingsButtonProps, type SettingsControl, SettingsItem, type SettingsItemProps, SettingsSlider, type SettingsSliderProps, SquidConfigProvider, type SquidTheme, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, type TooltipProps, type TooltipThreshold, type TooltipWidth, UsdAmount, useDropdownMenu };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git+https://github.com/0xsquid/squid-ui.git"
6
6
  },
7
7
  "description": "Squid's UI components",
8
- "version": "0.9.1",
8
+ "version": "0.9.3",
9
9
  "author": "",
10
10
  "license": "MIT",
11
11
  "scripts": {