rockin 0.0.27 → 0.0.29

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.
@@ -4,16 +4,16 @@ import { cva } from "class-variance-authority";
4
4
  import { cn } from "cn";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  var buttonVariants = cva(
7
- "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-[background-color,border-color,color,box-shadow,opacity,transform] duration-150 ease-[var(--ease-out)] outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 motion-reduce:transition-none dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:opacity-70 [&_svg:not([class*='size-'])]:size-4",
7
+ "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-[background-color,border-color,color,box-shadow,opacity,transform] duration-150 ease-[var(--ease-out)] outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 not-data-disabled:active:not-aria-[haspopup]:translate-y-px disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 motion-reduce:transition-none dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-disabled:cursor-not-allowed data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:opacity-70 [&_svg:not([class*='size-'])]:size-4",
8
8
  {
9
9
  variants: {
10
10
  variant: {
11
- default: "bg-primary text-primary-foreground hover:bg-primary/80",
12
- outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
13
- secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
14
- ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
15
- destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
16
- link: "text-primary underline-offset-4 hover:underline"
11
+ default: "bg-primary text-primary-foreground not-data-disabled:hover:bg-primary/80",
12
+ outline: "border-border bg-background not-data-disabled:hover:bg-muted not-data-disabled:hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:not-data-disabled:hover:bg-input/50",
13
+ secondary: "bg-secondary text-secondary-foreground not-data-disabled:hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
14
+ ghost: "not-data-disabled:hover:bg-muted not-data-disabled:hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:not-data-disabled:hover:bg-muted/50",
15
+ destructive: "bg-destructive/10 text-destructive not-data-disabled:hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:not-data-disabled:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
16
+ link: "text-primary underline-offset-4 not-data-disabled:hover:underline"
17
17
  },
18
18
  size: {
19
19
  default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
@@ -17,7 +17,7 @@ import {
17
17
  useDataTableSearch,
18
18
  useMediaQuery,
19
19
  useMounted
20
- } from "../chunk-WVPRWHFY.js";
20
+ } from "../chunk-4KFB6AJH.js";
21
21
  import "../chunk-ATPUW3SQ.js";
22
22
 
23
23
  // src/hooks/useSearchParams.ts
@@ -811,6 +811,18 @@ declare const sizeStyles: {
811
811
  readonly icon: "size-4";
812
812
  };
813
813
  };
814
+ declare const variantStyles: {
815
+ readonly pill: {
816
+ readonly container: "shadow-raised rounded-full";
817
+ readonly button: "rounded-full text-foreground enabled:hover:bg-foreground/6 enabled:active:scale-[0.96] disabled:opacity-35";
818
+ readonly text: "font-medium";
819
+ };
820
+ readonly outline: {
821
+ readonly container: "rounded-lg bg-background p-0! transition-[border-color,box-shadow] duration-150 ease-out focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/15";
822
+ readonly button: "rounded-md text-foreground enabled:hover:bg-muted enabled:active:scale-[0.94] disabled:text-muted-foreground/40";
823
+ readonly text: "font-mono font-medium tracking-tight";
824
+ };
825
+ };
814
826
  declare function RollingNumber({ value, format, className, }: {
815
827
  value: number;
816
828
  format?: (value: number) => string;
@@ -825,7 +837,11 @@ type NumberStepperProps = {
825
837
  step?: number;
826
838
  className?: string;
827
839
  size?: keyof typeof sizeStyles;
840
+ variant?: keyof typeof variantStyles;
828
841
  disabled?: boolean;
842
+ /** When set, the − button becomes a delete button once the value is at `min`. */
843
+ onRemove?: () => void;
844
+ removeLabel?: string;
829
845
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
830
846
  onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
831
847
  onKeyDownCapture?: React.KeyboardEventHandler<HTMLInputElement>;
package/dist/ui/index.js CHANGED
@@ -45,7 +45,7 @@ import {
45
45
  useDataTableSearch,
46
46
  useMediaQuery,
47
47
  useMounted
48
- } from "../chunk-WVPRWHFY.js";
48
+ } from "../chunk-4KFB6AJH.js";
49
49
  import {
50
50
  Tooltip,
51
51
  TooltipContent,
@@ -6329,6 +6329,18 @@ var sizeStyles = {
6329
6329
  icon: "size-4"
6330
6330
  }
6331
6331
  };
6332
+ var variantStyles = {
6333
+ pill: {
6334
+ container: "shadow-raised rounded-full",
6335
+ button: "rounded-full text-foreground enabled:hover:bg-foreground/6 enabled:active:scale-[0.96] disabled:opacity-35",
6336
+ text: "font-medium"
6337
+ },
6338
+ outline: {
6339
+ container: "rounded-lg bg-background p-0! transition-[border-color,box-shadow] duration-150 ease-out focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/15",
6340
+ button: "rounded-md text-foreground enabled:hover:bg-muted enabled:active:scale-[0.94] disabled:text-muted-foreground/40",
6341
+ text: "font-mono font-medium tracking-tight"
6342
+ }
6343
+ };
6332
6344
  function useDirection(value) {
6333
6345
  const [previous, setPrevious] = useState8(value);
6334
6346
  const [direction, setDirection] = useState8(1);
@@ -6421,7 +6433,10 @@ var NumberStepper = forwardRef4(
6421
6433
  step = 1,
6422
6434
  className,
6423
6435
  size = "default",
6436
+ variant = "pill",
6424
6437
  disabled = false,
6438
+ onRemove,
6439
+ removeLabel = "Remove",
6425
6440
  onFocus,
6426
6441
  onKeyDown,
6427
6442
  onKeyDownCapture
@@ -6507,6 +6522,8 @@ var NumberStepper = forwardRef4(
6507
6522
  if (Number.isNaN(parsed)) return;
6508
6523
  setTo(parsed, parsed > latest.current.value ? 1 : -1);
6509
6524
  };
6525
+ const styles = sizeStyles[size];
6526
+ const look = variantStyles[variant];
6510
6527
  const button = (delta, atLimit, name, path) => /* @__PURE__ */ jsx42(
6511
6528
  "button",
6512
6529
  {
@@ -6532,10 +6549,10 @@ var NumberStepper = forwardRef4(
6532
6549
  }
6533
6550
  },
6534
6551
  className: cn39(
6535
- "flex shrink-0 touch-manipulation items-center justify-center rounded-full text-foreground outline-hidden select-none",
6552
+ "flex shrink-0 touch-manipulation items-center justify-center outline-hidden select-none disabled:cursor-not-allowed",
6536
6553
  styles.button,
6537
- "transition-[scale,opacity,background-color] duration-150 ease-out hover:bg-foreground/6 active:scale-[0.96] motion-reduce:transition-[opacity,background-color]",
6538
- (disabled || atLimit) && "opacity-35 hover:bg-transparent"
6554
+ "transition-[scale,opacity,background-color,color] duration-150 ease-out motion-reduce:transition-[opacity,background-color,color]",
6555
+ look.button
6539
6556
  ),
6540
6557
  children: /* @__PURE__ */ jsx42(
6541
6558
  "svg",
@@ -6552,20 +6569,54 @@ var NumberStepper = forwardRef4(
6552
6569
  )
6553
6570
  }
6554
6571
  );
6572
+ const removeButton = /* @__PURE__ */ jsx42(
6573
+ "button",
6574
+ {
6575
+ type: "button",
6576
+ disabled,
6577
+ "aria-label": removeLabel,
6578
+ onClick: () => {
6579
+ if (!disabled) onRemove?.();
6580
+ },
6581
+ className: cn39(
6582
+ "flex shrink-0 touch-manipulation items-center justify-center outline-hidden select-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed",
6583
+ styles.button,
6584
+ "transition-[scale,background-color,color] duration-150 ease-out motion-reduce:transition-[background-color,color]",
6585
+ look.button,
6586
+ "enabled:hover:bg-destructive/10 enabled:hover:text-destructive"
6587
+ ),
6588
+ children: /* @__PURE__ */ jsx42(
6589
+ "svg",
6590
+ {
6591
+ viewBox: "0 0 16 16",
6592
+ "aria-hidden": true,
6593
+ className: styles.icon,
6594
+ fill: "none",
6595
+ stroke: "currentColor",
6596
+ strokeWidth: 1.5,
6597
+ strokeLinecap: "round",
6598
+ strokeLinejoin: "round",
6599
+ children: /* @__PURE__ */ jsx42("path", { d: "M2.75 4.5h10.5M6.25 4.5V3h3.5v1.5M4.25 4.5l.6 8.5h6.3l.6-8.5M6.75 7v3.5M9.25 7v3.5" })
6600
+ }
6601
+ )
6602
+ },
6603
+ "remove"
6604
+ );
6555
6605
  const editing = draft !== null;
6556
- const styles = sizeStyles[size];
6557
6606
  return /* @__PURE__ */ jsxs25(
6558
6607
  "div",
6559
6608
  {
6560
6609
  "data-slot": "input-group",
6610
+ "data-variant": variant,
6561
6611
  className: cn39(
6562
- "shadow-raised inline-flex items-center rounded-full border",
6563
- disabled && "opacity-50",
6612
+ "inline-flex items-center border",
6613
+ disabled && "cursor-not-allowed opacity-50",
6564
6614
  styles.container,
6615
+ look.container,
6565
6616
  className
6566
6617
  ),
6567
6618
  children: [
6568
- button(-step, value <= min, "Decrease", "M3.5 8h9"),
6619
+ onRemove && value <= min ? removeButton : button(-step, value <= min, "Decrease", "M3.5 8h9"),
6569
6620
  /* @__PURE__ */ jsxs25(
6570
6621
  "span",
6571
6622
  {
@@ -6624,8 +6675,9 @@ var NumberStepper = forwardRef4(
6624
6675
  }
6625
6676
  },
6626
6677
  className: cn39(
6627
- "col-start-1 row-start-1 w-full bg-transparent text-center font-medium tabular-nums caret-foreground outline-hidden",
6678
+ "col-start-1 row-start-1 w-full bg-transparent text-center tabular-nums caret-foreground outline-hidden selection:bg-ring/25 selection:text-foreground disabled:cursor-not-allowed",
6628
6679
  styles.text,
6680
+ look.text,
6629
6681
  editing ? "text-foreground" : "text-transparent"
6630
6682
  )
6631
6683
  }
@@ -6635,8 +6687,9 @@ var NumberStepper = forwardRef4(
6635
6687
  {
6636
6688
  value,
6637
6689
  className: cn39(
6638
- "pointer-events-none col-start-1 row-start-1 font-medium text-foreground",
6639
- styles.text
6690
+ "pointer-events-none col-start-1 row-start-1 text-foreground",
6691
+ styles.text,
6692
+ look.text
6640
6693
  )
6641
6694
  }
6642
6695
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rockin",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "description": "Reusable React UI components, hooks, icons, utilities, and styles for Rock Star projects.",
5
5
  "keywords": [
6
6
  "react",