@orderly.network/ui 2.8.5-alpha.0 → 2.8.6-alpha.0

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/index.js CHANGED
@@ -4347,7 +4347,7 @@ var NumType = (props) => {
4347
4347
  const renderChild = () => {
4348
4348
  switch (numType) {
4349
4349
  case "roi":
4350
- return utils.formatNum.roi(children);
4350
+ return utils.formatNum.roi(children, props.rule === "percentages" ? 4 : 2)?.toString();
4351
4351
  case "pnl":
4352
4352
  return utils.formatNum.pnl(children);
4353
4353
  case "notional":
@@ -4529,10 +4529,10 @@ var BaseInput = React67.forwardRef(
4529
4529
  [innerFormatters]
4530
4530
  );
4531
4531
  const formattedValue = React67.useMemo(() => {
4532
- if (typeof value === "undefined")
4533
- return value;
4532
+ if (typeof value === "undefined" || value === null)
4533
+ return "";
4534
4534
  return formatToRender(value);
4535
- }, [value]);
4535
+ }, [value, formatToRender]);
4536
4536
  React67.useEffect(() => {
4537
4537
  if (document.activeElement !== innerInputRef.current)
4538
4538
  return;
@@ -5455,7 +5455,7 @@ var SelectWithOptions = (props) => {
5455
5455
  }) }) });
5456
5456
  };
5457
5457
  var TokenSelect = (props) => {
5458
- const { tokens, showIcon = true, iconSize, ...rest } = props;
5458
+ const { tokens, showIcon = true, iconSize, showCaret, ...rest } = props;
5459
5459
  const { icon } = selectVariants();
5460
5460
  const options = React67.useMemo(() => {
5461
5461
  return tokens.map((token) => {
@@ -5493,7 +5493,7 @@ var TokenSelect = (props) => {
5493
5493
  SelectWithOptions,
5494
5494
  {
5495
5495
  ...rest,
5496
- showCaret: selectable,
5496
+ showCaret: typeof showCaret === "boolean" ? showCaret : selectable,
5497
5497
  options,
5498
5498
  valueFormatter: showIcon ? valueRenderer : void 0,
5499
5499
  optionRenderer,
@@ -11244,6 +11244,80 @@ __export(tailwind_exports, {
11244
11244
  default: () => tailwind_default
11245
11245
  });
11246
11246
  var tailwind_default = {};
11247
+ var dotStatusVariants = tailwindVariants.tv({
11248
+ slots: {
11249
+ root: "oui-flex oui-items-center oui-justify-center oui-gap-1",
11250
+ dot: "oui-flex-shrink-0 oui-rounded-full",
11251
+ label: "oui-text-2xs"
11252
+ },
11253
+ variants: {
11254
+ color: {
11255
+ primary: {
11256
+ dot: "oui-bg-primary-darken",
11257
+ label: "oui-text-primary-darken"
11258
+ },
11259
+ warning: {
11260
+ dot: "oui-bg-warning-darken",
11261
+ label: "oui-text-warning-darken"
11262
+ },
11263
+ profit: {
11264
+ dot: "oui-bg-profit-darken",
11265
+ label: "oui-text-profit-darken"
11266
+ },
11267
+ loss: {
11268
+ dot: "oui-bg-loss-darken",
11269
+ label: "oui-text-loss-darken"
11270
+ },
11271
+ secondary: {
11272
+ dot: "oui-bg-secondary-darken",
11273
+ label: "oui-text-secondary-darken"
11274
+ }
11275
+ },
11276
+ size: {
11277
+ xs: {
11278
+ dot: "oui-w-1 oui-h-1",
11279
+ label: "oui-text-2xs"
11280
+ },
11281
+ sm: {
11282
+ dot: "oui-w-2 oui-h-2",
11283
+ label: "oui-text-2xs"
11284
+ },
11285
+ md: {
11286
+ dot: "oui-w-3 oui-h-3",
11287
+ label: "oui-text-2xs"
11288
+ },
11289
+ lg: {
11290
+ dot: "oui-w-4 oui-h-4",
11291
+ label: "oui-text-2xs"
11292
+ }
11293
+ }
11294
+ },
11295
+ defaultVariants: {
11296
+ color: "primary",
11297
+ size: "xs"
11298
+ }
11299
+ });
11300
+ var DotStatus = (props) => {
11301
+ const { color, size, label, classNames } = props;
11302
+ const { root, dot, label: labelSlot } = dotStatusVariants({ color, size });
11303
+ if (!label) {
11304
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { r: "full", className: dot({ className: classNames?.dot }) });
11305
+ }
11306
+ return /* @__PURE__ */ jsxRuntime.jsxs(
11307
+ Flex,
11308
+ {
11309
+ itemAlign: "center",
11310
+ justify: "center",
11311
+ gapX: 1,
11312
+ className: root({ className: classNames?.root }),
11313
+ children: [
11314
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { r: "full", className: dot({ className: classNames?.dot }) }),
11315
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { size: "2xs", className: labelSlot({ className: classNames?.label }), children: label })
11316
+ ]
11317
+ }
11318
+ );
11319
+ };
11320
+ DotStatus.displayName = "DotStatus";
11247
11321
 
11248
11322
  Object.defineProperty(exports, "cn", {
11249
11323
  enumerable: true,
@@ -11341,6 +11415,7 @@ exports.DialogPortal = DialogPortal;
11341
11415
  exports.DialogTitle = DialogTitle;
11342
11416
  exports.DialogTrigger = DialogTrigger;
11343
11417
  exports.Divider = Divider;
11418
+ exports.DotStatus = DotStatus;
11344
11419
  exports.DropdownMenuContent = DropdownMenuContent;
11345
11420
  exports.DropdownMenuGroup = DropdownMenuGroup;
11346
11421
  exports.DropdownMenuItem = DropdownMenuItem;
@@ -11486,6 +11561,7 @@ exports.boxVariants = boxVariants;
11486
11561
  exports.buttonVariants = buttonVariants;
11487
11562
  exports.capitalizeFirstLetter = capitalizeFirstLetter;
11488
11563
  exports.convertValueToPercentage = convertValueToPercentage;
11564
+ exports.dotStatusVariants = dotStatusVariants;
11489
11565
  exports.formatAddress = formatAddress;
11490
11566
  exports.gradientTextVariants = gradientTextVariants;
11491
11567
  exports.inputFormatter = formatter_exports;