@doscientos/ui 0.1.16 → 0.1.17

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.d.cts CHANGED
@@ -519,18 +519,27 @@ declare function SubmitButton({ pendingLabel, loading, children, isDisabled, siz
519
519
  declare const switchSizes: {
520
520
  readonly sm: {
521
521
  readonly control: "h-4 w-[1.875rem] p-0.5";
522
- readonly thumb: "h-3 w-4";
523
- readonly offset: "0.625rem";
522
+ readonly thumb: "h-3";
523
+ readonly idleWidth: "0.75rem";
524
+ readonly activeWidth: "1rem";
525
+ readonly selectedOffset: "0.875rem";
526
+ readonly activeSelectedOffset: "0.625rem";
524
527
  };
525
528
  readonly md: {
526
529
  readonly control: "h-5 w-9 p-0.5";
527
- readonly thumb: "h-4 w-5";
528
- readonly offset: "0.75rem";
530
+ readonly thumb: "h-4";
531
+ readonly idleWidth: "1rem";
532
+ readonly activeWidth: "1.25rem";
533
+ readonly selectedOffset: "1rem";
534
+ readonly activeSelectedOffset: "0.75rem";
529
535
  };
530
536
  readonly lg: {
531
537
  readonly control: "h-6 w-11 p-0.5";
532
- readonly thumb: "h-5 w-6";
533
- readonly offset: "1rem";
538
+ readonly thumb: "h-5";
539
+ readonly idleWidth: "1.25rem";
540
+ readonly activeWidth: "1.5rem";
541
+ readonly selectedOffset: "1.25rem";
542
+ readonly activeSelectedOffset: "1rem";
534
543
  };
535
544
  };
536
545
  type SwitchProps = Omit<SwitchProps$1, "className"> & {
package/dist/index.d.ts CHANGED
@@ -519,18 +519,27 @@ declare function SubmitButton({ pendingLabel, loading, children, isDisabled, siz
519
519
  declare const switchSizes: {
520
520
  readonly sm: {
521
521
  readonly control: "h-4 w-[1.875rem] p-0.5";
522
- readonly thumb: "h-3 w-4";
523
- readonly offset: "0.625rem";
522
+ readonly thumb: "h-3";
523
+ readonly idleWidth: "0.75rem";
524
+ readonly activeWidth: "1rem";
525
+ readonly selectedOffset: "0.875rem";
526
+ readonly activeSelectedOffset: "0.625rem";
524
527
  };
525
528
  readonly md: {
526
529
  readonly control: "h-5 w-9 p-0.5";
527
- readonly thumb: "h-4 w-5";
528
- readonly offset: "0.75rem";
530
+ readonly thumb: "h-4";
531
+ readonly idleWidth: "1rem";
532
+ readonly activeWidth: "1.25rem";
533
+ readonly selectedOffset: "1rem";
534
+ readonly activeSelectedOffset: "0.75rem";
529
535
  };
530
536
  readonly lg: {
531
537
  readonly control: "h-6 w-11 p-0.5";
532
- readonly thumb: "h-5 w-6";
533
- readonly offset: "1rem";
538
+ readonly thumb: "h-5";
539
+ readonly idleWidth: "1.25rem";
540
+ readonly activeWidth: "1.5rem";
541
+ readonly selectedOffset: "1.25rem";
542
+ readonly activeSelectedOffset: "1rem";
534
543
  };
535
544
  };
536
545
  type SwitchProps = Omit<SwitchProps$1, "className"> & {
package/dist/index.js CHANGED
@@ -2455,18 +2455,27 @@ import { Fragment as Fragment10, jsx as jsx42, jsxs as jsxs20 } from "react/jsx-
2455
2455
  var switchSizes = {
2456
2456
  sm: {
2457
2457
  control: "h-4 w-[1.875rem] p-0.5",
2458
- thumb: "h-3 w-4",
2459
- offset: "0.625rem"
2458
+ thumb: "h-3",
2459
+ idleWidth: "0.75rem",
2460
+ activeWidth: "1rem",
2461
+ selectedOffset: "0.875rem",
2462
+ activeSelectedOffset: "0.625rem"
2460
2463
  },
2461
2464
  md: {
2462
2465
  control: "h-5 w-9 p-0.5",
2463
- thumb: "h-4 w-5",
2464
- offset: "0.75rem"
2466
+ thumb: "h-4",
2467
+ idleWidth: "1rem",
2468
+ activeWidth: "1.25rem",
2469
+ selectedOffset: "1rem",
2470
+ activeSelectedOffset: "0.75rem"
2465
2471
  },
2466
2472
  lg: {
2467
2473
  control: "h-6 w-11 p-0.5",
2468
- thumb: "h-5 w-6",
2469
- offset: "1rem"
2474
+ thumb: "h-5",
2475
+ idleWidth: "1.25rem",
2476
+ activeWidth: "1.5rem",
2477
+ selectedOffset: "1.25rem",
2478
+ activeSelectedOffset: "1rem"
2470
2479
  }
2471
2480
  };
2472
2481
  function Switch({
@@ -2512,43 +2521,50 @@ function Switch({
2512
2521
  className
2513
2522
  ),
2514
2523
  ...props,
2515
- children: (state) => /* @__PURE__ */ jsxs20(Fragment10, { children: [
2516
- /* @__PURE__ */ jsx42(
2517
- "span",
2518
- {
2519
- "aria-hidden": "true",
2520
- "data-slot": "switch-control",
2521
- className: cn(
2522
- "relative inline-flex shrink-0 items-center overflow-hidden rounded-full border border-border bg-input shadow-inner",
2523
- "transition-[background-color,border-color,box-shadow] duration-200 ease-out motion-reduce:transition-none",
2524
- "group-data-hovered/switch:bg-muted-foreground/25",
2525
- "group-data-selected/switch:border-primary group-data-selected/switch:bg-primary",
2526
- "group-data-selected/switch:group-data-hovered/switch:bg-primary/85",
2527
- "group-data-focus-visible/switch:ring-3 group-data-focus-visible/switch:ring-ring/50",
2528
- styles.control
2529
- ),
2530
- children: /* @__PURE__ */ jsx42(
2531
- "span",
2532
- {
2533
- "data-slot": "switch-thumb",
2534
- style: { transform: state.isSelected ? `translate3d(${styles.offset}, 0, 0)` : "translate3d(0, 0, 0)" },
2535
- className: cn(
2536
- "grid shrink-0 place-items-center rounded-full border border-border/60 bg-background text-[0.625rem] text-muted-foreground shadow-sm",
2537
- "will-change-transform transition-[transform,background-color,color,border-color] duration-[240ms] ease-[cubic-bezier(0.2,0.8,0.2,1)] motion-reduce:transition-none",
2538
- "group-data-selected/switch:border-primary-foreground/20",
2539
- "group-data-selected/switch:bg-primary-foreground group-data-selected/switch:text-primary",
2540
- styles.thumb
2541
- ),
2542
- children: state.isSelected ? selectedIcon ?? icon : icon
2543
- }
2544
- )
2545
- }
2546
- ),
2547
- children || description ? /* @__PURE__ */ jsxs20("span", { className: "grid gap-0.5 leading-tight", children: [
2548
- children ? /* @__PURE__ */ jsx42("span", { "data-slot": "switch-label", className: "font-medium", children: typeof children === "function" ? children(state) : children }) : null,
2549
- description ? /* @__PURE__ */ jsx42("span", { "data-slot": "switch-description", className: "text-xs font-normal text-muted-foreground", children: description }) : null
2550
- ] }) : null
2551
- ] })
2524
+ children: (state) => {
2525
+ const isThumbActive = state.isHovered || state.isPressed;
2526
+ const thumbOffset = state.isSelected ? isThumbActive ? styles.activeSelectedOffset : styles.selectedOffset : "0";
2527
+ return /* @__PURE__ */ jsxs20(Fragment10, { children: [
2528
+ /* @__PURE__ */ jsx42(
2529
+ "span",
2530
+ {
2531
+ "aria-hidden": "true",
2532
+ "data-slot": "switch-control",
2533
+ className: cn(
2534
+ "relative inline-flex shrink-0 items-center overflow-hidden rounded-full border border-border bg-input shadow-inner",
2535
+ "transition-[background-color,border-color,box-shadow] duration-200 ease-out motion-reduce:transition-none",
2536
+ "group-data-hovered/switch:bg-muted-foreground/25",
2537
+ "group-data-selected/switch:border-primary group-data-selected/switch:bg-primary",
2538
+ "group-data-selected/switch:group-data-hovered/switch:bg-primary/85",
2539
+ "group-data-focus-visible/switch:ring-3 group-data-focus-visible/switch:ring-ring/50",
2540
+ styles.control
2541
+ ),
2542
+ children: /* @__PURE__ */ jsx42(
2543
+ "span",
2544
+ {
2545
+ "data-slot": "switch-thumb",
2546
+ style: {
2547
+ transform: `translate3d(${thumbOffset}, 0, 0)`,
2548
+ width: isThumbActive ? styles.activeWidth : styles.idleWidth
2549
+ },
2550
+ className: cn(
2551
+ "grid shrink-0 place-items-center rounded-full border border-border/60 bg-background text-[0.625rem] text-muted-foreground shadow-sm",
2552
+ "will-change-[transform,width] transition-[transform,width,background-color,color,border-color] duration-[240ms] ease-[cubic-bezier(0.2,0.8,0.2,1)] motion-reduce:transition-none",
2553
+ "group-data-selected/switch:border-primary-foreground/20",
2554
+ "group-data-selected/switch:bg-primary-foreground group-data-selected/switch:text-primary",
2555
+ styles.thumb
2556
+ ),
2557
+ children: state.isSelected ? selectedIcon ?? icon : icon
2558
+ }
2559
+ )
2560
+ }
2561
+ ),
2562
+ children || description ? /* @__PURE__ */ jsxs20("span", { className: "grid gap-0.5 leading-tight", children: [
2563
+ children ? /* @__PURE__ */ jsx42("span", { "data-slot": "switch-label", className: "font-medium", children: typeof children === "function" ? children(state) : children }) : null,
2564
+ description ? /* @__PURE__ */ jsx42("span", { "data-slot": "switch-description", className: "text-xs font-normal text-muted-foreground", children: description }) : null
2565
+ ] }) : null
2566
+ ] });
2567
+ }
2552
2568
  }
2553
2569
  );
2554
2570
  }