@0xsquid/ui 0.9.2 → 0.9.4

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, }) {
@@ -3178,13 +3191,14 @@ const dropdownPositionClassMap = {
3178
3191
  bottom: 'tw-right-[calc(100%-10px)] tw-top-7',
3179
3192
  center: 'tw-right-[40px] -tw-top-[55px]',
3180
3193
  };
3181
- function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', dropdownMenuItems, }) {
3194
+ function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', dropdownMenuItems, itemsContainerRef, }) {
3182
3195
  const { isDropdownOpen, dropdownRef, openDropdownButtonRef, openDropdown } = useDropdownMenu();
3183
3196
  const [dropdownPosition, setDropdownPosition] = react.useState(null);
3184
3197
  const itemRef = react.useRef(null);
3185
3198
  const menuRef = react.useRef(null);
3186
3199
  // Effect to find the best position for the dropdown menu, so it's always visible for the user
3187
3200
  react.useEffect(() => {
3201
+ var _a;
3188
3202
  if (!isDropdownOpen) {
3189
3203
  // when the dropdown is closed, we want to reset its position
3190
3204
  // because user may scroll, and the old position may be out of view, so we'll need to recalculate it
@@ -3192,7 +3206,7 @@ function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted,
3192
3206
  return;
3193
3207
  }
3194
3208
  const item = itemRef.current;
3195
- const itemsContainer = item === null || item === void 0 ? void 0 : item.parentElement;
3209
+ const itemsContainer = (_a = itemsContainerRef === null || itemsContainerRef === void 0 ? void 0 : itemsContainerRef.current) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.parentElement;
3196
3210
  const dropdownMenu = menuRef.current;
3197
3211
  if (!item || !dropdownRef.current || !itemsContainer || !dropdownMenu) {
3198
3212
  return;
@@ -3227,7 +3241,7 @@ function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted,
3227
3241
  }
3228
3242
  }, [isDropdownOpen, menuRef, dropdownPosition, itemRef]);
3229
3243
  return (jsxRuntime.jsx("li", { ref: itemRef, className: "tw-h-list-item-large tw-min-w-list-item-small tw-self-stretch tw-bg-grey-900 tw-px-squid-xs tw-text-grey-300", children: jsxRuntime.jsxs("div", { className: "tw-group/history-item tw-relative tw-flex tw-flex-shrink-0 tw-cursor-pointer tw-items-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin", children: [jsxRuntime.jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [isPending ? (jsxRuntime.jsx("span", { className: "tw-absolute -tw-left-[5px] tw-bottom-0 tw-z-30 tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-center tw-rounded-full tw-border tw-border-grey-900 tw-bg-royal-400 tw-p-0.5", children: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, {}) })) : null, jsxRuntime.jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsxRuntime.jsx("img", { src: secondImageUrl, className: "tw-absolute tw-left-5 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center", children: [jsxRuntime.jsx(CaptionText, { children: fromLabel }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronRightSmallIcon, {}) }), jsxRuntime.jsx(CaptionText, { children: toLabel })] }), !!dropdownMenuItems && (jsxRuntime.jsx("button", { className: "tw-peer tw-absolute tw-right-squid-xxs tw-top-squid-xxs tw-flex tw-h-squid-xl tw-w-squid-xl tw-items-center tw-justify-center tw-rounded-squid-xs tw-bg-material-light-thin tw-p-2 tw-text-grey-300 tw-opacity-0 tw-transition-opacity focus:tw-opacity-100 group-hover/history-item:tw-opacity-100", onClick: openDropdown, ref: openDropdownButtonRef, children: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })), jsxRuntime.jsx("div", { className: cn(!!dropdownMenuItems &&
3230
- 'tw-transition-opacity group-hover/history-item:tw-opacity-0 peer-focus:tw-opacity-0'), children: isPending ? (jsxRuntime.jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsxRuntime.jsx(CaptionText, { children: dateCompleted })) })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsxRuntime.jsx(BodyText, { size: "small", children: fromAmount }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), jsxRuntime.jsx(BodyText, { size: "small", children: toAmount })] })] }), isDropdownOpen && !!dropdownMenuItems ? (jsxRuntime.jsx(DropdownMenu, { menuRef: menuRef,
3244
+ 'tw-transition-opacity group-hover/history-item:tw-hidden group-hover/history-item:tw-opacity-0 peer-focus:tw-hidden peer-focus:tw-opacity-0'), children: isPending ? (jsxRuntime.jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsxRuntime.jsx(CaptionText, { children: dateCompleted })) })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsxRuntime.jsx(BodyText, { size: "small", children: fromAmount }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), jsxRuntime.jsx(BodyText, { size: "small", children: toAmount })] })] }), isDropdownOpen && !!dropdownMenuItems ? (jsxRuntime.jsx(DropdownMenu, { menuRef: menuRef,
3231
3245
  // only show dropdown menu if there is a position defined for it
3232
3246
  isHidden: !dropdownPosition, className: cn(!!dropdownPosition && dropdownPositionClassMap[dropdownPosition]), dropdownRef: dropdownRef, items: dropdownMenuItems })) : null] }) }));
3233
3247
  }
@@ -3262,7 +3276,7 @@ function HelpIcon({ size = '20', className, }) {
3262
3276
  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
3277
  }
3264
3278
 
3265
- function SettingsItem({ icon, label, controls, transparentControls = false, showHelpIcon = true, link, transparent = false, helpTooltip, }) {
3279
+ function SettingsItem({ icon, label, controls = [], link, transparent = false, helpTooltip, }) {
3266
3280
  const ContentTag = link ? 'a' : 'div';
3267
3281
  const contentTagProps = link
3268
3282
  ? {
@@ -3270,11 +3284,26 @@ function SettingsItem({ icon, label, controls, transparentControls = false, show
3270
3284
  target: '_blank',
3271
3285
  }
3272
3286
  : {};
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 })] })) }));
3287
+ 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') }));
3288
+ const showDetailsBorder = controls.length > 0 &&
3289
+ !link &&
3290
+ !controls.some((control) => control.type === 'switch');
3291
+ 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 &&
3292
+ '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) => {
3293
+ if (control.type === 'switch') {
3294
+ const switchControl = (jsxRuntime.jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange, disabled: control.disabled }, index));
3295
+ if (control.tooltip) {
3296
+ return jsxRuntime.jsx(Tooltip, Object.assign({}, control.tooltip, { children: switchControl }));
3297
+ }
3298
+ return switchControl;
3299
+ }
3300
+ if (control.type === 'percentage') {
3301
+ 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" })] }));
3302
+ }
3303
+ if (control.type === 'amount') {
3304
+ 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 })] }));
3305
+ }
3306
+ })) })] })) }));
3278
3307
  }
3279
3308
 
3280
3309
  function SwapDetailListItem({ label, detail, icon, isLoading = false, }) {
@@ -3354,8 +3383,11 @@ const borderTypeClassMap = {
3354
3383
  border: 'tw-border tw-border-material-light-thin',
3355
3384
  outline: 'tw-outline tw-outline-1 -tw-outline-offset-[1px] tw-outline-material-light-thin',
3356
3385
  };
3357
- function ModalContent({ children, addGap = false, borderType = 'border', }) {
3358
- 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-overflow-auto tw-rounded-squid-l tw-bg-grey-800 tw-text-grey-300', addGap && 'tw-gap-squid-xxs tw-pt-squid-xxs', borderTypeClassMap[borderType]), children: children }));
3386
+ function ModalContent({ children, addGap = false, paddingY = false, borderType = 'border', }) {
3387
+ 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 }));
3388
+ }
3389
+ function ModalContentDivider() {
3390
+ 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" }) }));
3359
3391
  }
3360
3392
 
3361
3393
  function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, actions, }) {
@@ -3552,6 +3584,7 @@ exports.Menu = Menu;
3552
3584
  exports.MenuItem = MenuItem;
3553
3585
  exports.Modal = Modal;
3554
3586
  exports.ModalContent = ModalContent;
3587
+ exports.ModalContentDivider = ModalContentDivider;
3555
3588
  exports.NavigationBar = NavigationBar;
3556
3589
  exports.NumericInput = NumericInput;
3557
3590
  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 {};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DropdownMenuItemProps } from './DropdownMenuItem';
2
3
  interface HistoryItemProps {
3
4
  firstImageUrl: string;
@@ -10,6 +11,7 @@ interface HistoryItemProps {
10
11
  fromAmount: string;
11
12
  toAmount: string;
12
13
  dropdownMenuItems?: DropdownMenuItemProps[];
14
+ itemsContainerRef?: React.RefObject<HTMLElement>;
13
15
  }
14
- export declare function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel, dropdownMenuItems, }: HistoryItemProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel, dropdownMenuItems, itemsContainerRef, }: HistoryItemProps): import("react/jsx-runtime").JSX.Element;
15
17
  export {};
@@ -1,13 +1,39 @@
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
+ disabled?: boolean;
30
+ };
3
31
  export interface SettingsItemProps {
4
32
  icon: React.ReactNode;
5
33
  label: string;
6
- controls?: React.ReactNode;
7
- transparentControls?: boolean;
8
- showHelpIcon?: boolean;
34
+ controls?: SettingsControl[];
9
35
  link?: string;
10
36
  transparent?: boolean;
11
37
  helpTooltip?: Omit<TooltipProps, 'children'>;
12
38
  }
13
- export declare function SettingsItem({ icon, label, controls, transparentControls, showHelpIcon, link, transparent, helpTooltip, }: SettingsItemProps): import("react/jsx-runtime").JSX.Element;
39
+ 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, }) {
@@ -3176,13 +3189,14 @@ const dropdownPositionClassMap = {
3176
3189
  bottom: 'tw-right-[calc(100%-10px)] tw-top-7',
3177
3190
  center: 'tw-right-[40px] -tw-top-[55px]',
3178
3191
  };
3179
- function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', dropdownMenuItems, }) {
3192
+ function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', dropdownMenuItems, itemsContainerRef, }) {
3180
3193
  const { isDropdownOpen, dropdownRef, openDropdownButtonRef, openDropdown } = useDropdownMenu();
3181
3194
  const [dropdownPosition, setDropdownPosition] = useState(null);
3182
3195
  const itemRef = useRef(null);
3183
3196
  const menuRef = useRef(null);
3184
3197
  // Effect to find the best position for the dropdown menu, so it's always visible for the user
3185
3198
  useEffect(() => {
3199
+ var _a;
3186
3200
  if (!isDropdownOpen) {
3187
3201
  // when the dropdown is closed, we want to reset its position
3188
3202
  // because user may scroll, and the old position may be out of view, so we'll need to recalculate it
@@ -3190,7 +3204,7 @@ function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted,
3190
3204
  return;
3191
3205
  }
3192
3206
  const item = itemRef.current;
3193
- const itemsContainer = item === null || item === void 0 ? void 0 : item.parentElement;
3207
+ const itemsContainer = (_a = itemsContainerRef === null || itemsContainerRef === void 0 ? void 0 : itemsContainerRef.current) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.parentElement;
3194
3208
  const dropdownMenu = menuRef.current;
3195
3209
  if (!item || !dropdownRef.current || !itemsContainer || !dropdownMenu) {
3196
3210
  return;
@@ -3225,7 +3239,7 @@ function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted,
3225
3239
  }
3226
3240
  }, [isDropdownOpen, menuRef, dropdownPosition, itemRef]);
3227
3241
  return (jsx("li", { ref: itemRef, className: "tw-h-list-item-large tw-min-w-list-item-small tw-self-stretch tw-bg-grey-900 tw-px-squid-xs tw-text-grey-300", children: jsxs("div", { className: "tw-group/history-item tw-relative tw-flex tw-flex-shrink-0 tw-cursor-pointer tw-items-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin", children: [jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [isPending ? (jsx("span", { className: "tw-absolute -tw-left-[5px] tw-bottom-0 tw-z-30 tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-center tw-rounded-full tw-border tw-border-grey-900 tw-bg-royal-400 tw-p-0.5", children: jsx(DotGrid1x3HorizontalIcon, {}) })) : null, jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsx("img", { src: secondImageUrl, className: "tw-absolute tw-left-5 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" })] }), jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-items-center", children: [jsx(CaptionText, { children: fromLabel }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronRightSmallIcon, {}) }), jsx(CaptionText, { children: toLabel })] }), !!dropdownMenuItems && (jsx("button", { className: "tw-peer tw-absolute tw-right-squid-xxs tw-top-squid-xxs tw-flex tw-h-squid-xl tw-w-squid-xl tw-items-center tw-justify-center tw-rounded-squid-xs tw-bg-material-light-thin tw-p-2 tw-text-grey-300 tw-opacity-0 tw-transition-opacity focus:tw-opacity-100 group-hover/history-item:tw-opacity-100", onClick: openDropdown, ref: openDropdownButtonRef, children: jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })), jsx("div", { className: cn(!!dropdownMenuItems &&
3228
- 'tw-transition-opacity group-hover/history-item:tw-opacity-0 peer-focus:tw-opacity-0'), children: isPending ? (jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsx(CaptionText, { children: dateCompleted })) })] }), jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsx(BodyText, { size: "small", children: fromAmount }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronLargeRightIcon, {}) }), jsx(BodyText, { size: "small", children: toAmount })] })] }), isDropdownOpen && !!dropdownMenuItems ? (jsx(DropdownMenu, { menuRef: menuRef,
3242
+ 'tw-transition-opacity group-hover/history-item:tw-hidden group-hover/history-item:tw-opacity-0 peer-focus:tw-hidden peer-focus:tw-opacity-0'), children: isPending ? (jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsx(CaptionText, { children: dateCompleted })) })] }), jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsx(BodyText, { size: "small", children: fromAmount }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronLargeRightIcon, {}) }), jsx(BodyText, { size: "small", children: toAmount })] })] }), isDropdownOpen && !!dropdownMenuItems ? (jsx(DropdownMenu, { menuRef: menuRef,
3229
3243
  // only show dropdown menu if there is a position defined for it
3230
3244
  isHidden: !dropdownPosition, className: cn(!!dropdownPosition && dropdownPositionClassMap[dropdownPosition]), dropdownRef: dropdownRef, items: dropdownMenuItems })) : null] }) }));
3231
3245
  }
@@ -3260,7 +3274,7 @@ function HelpIcon({ size = '20', className, }) {
3260
3274
  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
3275
  }
3262
3276
 
3263
- function SettingsItem({ icon, label, controls, transparentControls = false, showHelpIcon = true, link, transparent = false, helpTooltip, }) {
3277
+ function SettingsItem({ icon, label, controls = [], link, transparent = false, helpTooltip, }) {
3264
3278
  const ContentTag = link ? 'a' : 'div';
3265
3279
  const contentTagProps = link
3266
3280
  ? {
@@ -3268,11 +3282,26 @@ function SettingsItem({ icon, label, controls, transparentControls = false, show
3268
3282
  target: '_blank',
3269
3283
  }
3270
3284
  : {};
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 })] })) }));
3285
+ 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') }));
3286
+ const showDetailsBorder = controls.length > 0 &&
3287
+ !link &&
3288
+ !controls.some((control) => control.type === 'switch');
3289
+ 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 &&
3290
+ '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) => {
3291
+ if (control.type === 'switch') {
3292
+ const switchControl = (jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange, disabled: control.disabled }, index));
3293
+ if (control.tooltip) {
3294
+ return jsx(Tooltip, Object.assign({}, control.tooltip, { children: switchControl }));
3295
+ }
3296
+ return switchControl;
3297
+ }
3298
+ if (control.type === 'percentage') {
3299
+ return (jsxs(Fragment, { children: [jsx(SettingsButton, { label: control.resetValueControl.label, isSelected: control.resetValueControl.isSelected }), jsx(SettingsSlider, { value: control.value, type: "percentage" })] }));
3300
+ }
3301
+ if (control.type === 'amount') {
3302
+ 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 })] }));
3303
+ }
3304
+ })) })] })) }));
3276
3305
  }
3277
3306
 
3278
3307
  function SwapDetailListItem({ label, detail, icon, isLoading = false, }) {
@@ -3352,8 +3381,11 @@ const borderTypeClassMap = {
3352
3381
  border: 'tw-border tw-border-material-light-thin',
3353
3382
  outline: 'tw-outline tw-outline-1 -tw-outline-offset-[1px] tw-outline-material-light-thin',
3354
3383
  };
3355
- function ModalContent({ children, addGap = false, borderType = 'border', }) {
3356
- return (jsx("div", { className: cn('tw-flex tw-h-full tw-max-h-[535px] tw-w-full tw-flex-col tw-self-stretch tw-overflow-auto tw-rounded-squid-l tw-bg-grey-800 tw-text-grey-300', addGap && 'tw-gap-squid-xxs tw-pt-squid-xxs', borderTypeClassMap[borderType]), children: children }));
3384
+ function ModalContent({ children, addGap = false, paddingY = false, borderType = 'border', }) {
3385
+ 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 }));
3386
+ }
3387
+ function ModalContentDivider() {
3388
+ 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" }) }));
3357
3389
  }
3358
3390
 
3359
3391
  function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, actions, }) {
@@ -3525,4 +3557,4 @@ function SquidConfigProvider({ theme, children, themeType = 'light', }) {
3525
3557
  return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-group tw-relative tw-font-geist", children: children }));
3526
3558
  }
3527
3559
 
3528
- 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, NavigationBar, NumericInput, ProductCard, ProfileHeaderBackground, SectionTitle, SettingsButton, SettingsItem, SettingsSlider, SquidConfigProvider, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, UsdAmount, useDropdownMenu };
3560
+ 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 {};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DropdownMenuItemProps } from './DropdownMenuItem';
2
3
  interface HistoryItemProps {
3
4
  firstImageUrl: string;
@@ -10,6 +11,7 @@ interface HistoryItemProps {
10
11
  fromAmount: string;
11
12
  toAmount: string;
12
13
  dropdownMenuItems?: DropdownMenuItemProps[];
14
+ itemsContainerRef?: React.RefObject<HTMLElement>;
13
15
  }
14
- export declare function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel, dropdownMenuItems, }: HistoryItemProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel, dropdownMenuItems, itemsContainerRef, }: HistoryItemProps): import("react/jsx-runtime").JSX.Element;
15
17
  export {};
@@ -1,13 +1,39 @@
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
+ disabled?: boolean;
30
+ };
3
31
  export interface SettingsItemProps {
4
32
  icon: React.ReactNode;
5
33
  label: string;
6
- controls?: React.ReactNode;
7
- transparentControls?: boolean;
8
- showHelpIcon?: boolean;
34
+ controls?: SettingsControl[];
9
35
  link?: string;
10
36
  transparent?: boolean;
11
37
  helpTooltip?: Omit<TooltipProps, 'children'>;
12
38
  }
13
- export declare function SettingsItem({ icon, label, controls, transparentControls, showHelpIcon, link, transparent, helpTooltip, }: SettingsItemProps): import("react/jsx-runtime").JSX.Element;
39
+ 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
  }
@@ -2635,6 +2697,10 @@ li {
2635
2697
  display: flex;
2636
2698
  }
2637
2699
 
2700
+ .tw-group\/history-item:hover .group-hover\/history-item\:tw-hidden {
2701
+ display: none;
2702
+ }
2703
+
2638
2704
  .tw-group\/history-item:hover .group-hover\/history-item\:tw-opacity-0 {
2639
2705
  opacity: 0;
2640
2706
  }
@@ -2652,6 +2718,10 @@ li {
2652
2718
  display: block;
2653
2719
  }
2654
2720
 
2721
+ .tw-peer:focus ~ .peer-focus\:tw-hidden {
2722
+ display: none;
2723
+ }
2724
+
2655
2725
  .tw-peer:focus ~ .peer-focus\:tw-opacity-0 {
2656
2726
  opacity: 0;
2657
2727
  }
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;
@@ -200,8 +202,9 @@ interface HistoryItemProps {
200
202
  fromAmount: string;
201
203
  toAmount: string;
202
204
  dropdownMenuItems?: DropdownMenuItemProps[];
205
+ itemsContainerRef?: React.RefObject<HTMLElement>;
203
206
  }
204
- declare function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel, dropdownMenuItems, }: HistoryItemProps): react_jsx_runtime.JSX.Element;
207
+ declare function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel, dropdownMenuItems, itemsContainerRef, }: HistoryItemProps): react_jsx_runtime.JSX.Element;
205
208
 
206
209
  interface ListItemProps extends React.HTMLAttributes<HTMLLIElement> {
207
210
  itemTitle: string | React.ReactNode;
@@ -241,17 +244,43 @@ interface SectionTitleProps {
241
244
  }
242
245
  declare function SectionTitle({ title, icon, accessory, actionIcon, className, }: SectionTitleProps): react_jsx_runtime.JSX.Element;
243
246
 
247
+ type SettingsControl = {
248
+ type: 'percentage';
249
+ value: number;
250
+ onChange: (value: number) => void;
251
+ resetValueControl: {
252
+ label: string;
253
+ onSelect: () => void;
254
+ isSelected?: boolean;
255
+ };
256
+ } | {
257
+ type: 'amount';
258
+ options: {
259
+ value: number;
260
+ isSelected?: boolean;
261
+ onSelect?: () => void;
262
+ }[];
263
+ resetValueControl: {
264
+ label: string;
265
+ onSelect: () => void;
266
+ isSelected?: boolean;
267
+ };
268
+ } | {
269
+ type: 'switch';
270
+ checked: boolean;
271
+ onChange: (checked: boolean) => void;
272
+ tooltip?: Omit<TooltipProps, 'children'>;
273
+ disabled?: boolean;
274
+ };
244
275
  interface SettingsItemProps {
245
276
  icon: React.ReactNode;
246
277
  label: string;
247
- controls?: React.ReactNode;
248
- transparentControls?: boolean;
249
- showHelpIcon?: boolean;
278
+ controls?: SettingsControl[];
250
279
  link?: string;
251
280
  transparent?: boolean;
252
281
  helpTooltip?: Omit<TooltipProps, 'children'>;
253
282
  }
254
- declare function SettingsItem({ icon, label, controls, transparentControls, showHelpIcon, link, transparent, helpTooltip, }: SettingsItemProps): react_jsx_runtime.JSX.Element;
283
+ declare function SettingsItem({ icon, label, controls, link, transparent, helpTooltip, }: SettingsItemProps): react_jsx_runtime.JSX.Element;
255
284
 
256
285
  interface SwapDetailListItemProps {
257
286
  label: string;
@@ -314,11 +343,13 @@ interface ModalProps {
314
343
  declare function Modal({ children, className, onBackdropClick, isOpen: _isOpen, maxHeight, }: ModalProps): false | react_jsx_runtime.JSX.Element;
315
344
 
316
345
  type ModalContentBorderType = 'border' | 'outline';
317
- declare function ModalContent({ children, addGap, borderType, }: {
346
+ declare function ModalContent({ children, addGap, paddingY, borderType, }: {
318
347
  children?: React.ReactNode;
319
348
  addGap?: boolean;
349
+ paddingY?: boolean;
320
350
  borderType?: ModalContentBorderType;
321
351
  }): react_jsx_runtime.JSX.Element;
352
+ declare function ModalContentDivider(): react_jsx_runtime.JSX.Element;
322
353
 
323
354
  type ActionButton = {
324
355
  labelOrIcon: string | React.ReactNode;
@@ -464,4 +495,4 @@ declare function useDropdownMenu(props?: {
464
495
  openDropdownButtonRef: React.RefObject<HTMLButtonElement>;
465
496
  };
466
497
 
467
- 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, 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 };
498
+ 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.2",
8
+ "version": "0.9.4",
9
9
  "author": "",
10
10
  "license": "MIT",
11
11
  "scripts": {