rockin 0.0.26 → 0.0.28

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
@@ -35,7 +35,7 @@ import * as React from "react";
35
35
  var SEARCH_DELAY = 500;
36
36
  var PRODUCT_SEARCH_DELAY = 800;
37
37
  function isSearchPath(pathname) {
38
- return pathname === "/" || pathname === "/pos" || pathname === "/orders" || pathname.startsWith("/pos/") || pathname.startsWith("/orders/");
38
+ return pathname === "/" || pathname === "/pos" || pathname === "/orders" || pathname === "/bin" || pathname.startsWith("/pos/") || pathname.startsWith("/orders/") || pathname.startsWith("/bin/");
39
39
  }
40
40
  var pendingSearchFocus = false;
41
41
  function searchFocus() {
@@ -811,6 +811,20 @@ 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 hover:bg-foreground/6 active:scale-[0.96]";
818
+ readonly limit: "opacity-35 hover:bg-transparent";
819
+ readonly text: "font-medium";
820
+ };
821
+ readonly outline: {
822
+ 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";
823
+ readonly button: "rounded-md text-muted-foreground hover:bg-muted hover:text-foreground active:scale-[0.94]";
824
+ readonly limit: "text-muted-foreground/35 hover:bg-transparent hover:text-muted-foreground/35";
825
+ readonly text: "font-mono font-medium tracking-tight";
826
+ };
827
+ };
814
828
  declare function RollingNumber({ value, format, className, }: {
815
829
  value: number;
816
830
  format?: (value: number) => string;
@@ -825,7 +839,11 @@ type NumberStepperProps = {
825
839
  step?: number;
826
840
  className?: string;
827
841
  size?: keyof typeof sizeStyles;
842
+ variant?: keyof typeof variantStyles;
828
843
  disabled?: boolean;
844
+ /** When set, the − button becomes a delete button once the value is at `min`. */
845
+ onRemove?: () => void;
846
+ removeLabel?: string;
829
847
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
830
848
  onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
831
849
  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,20 @@ 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 hover:bg-foreground/6 active:scale-[0.96]",
6336
+ limit: "opacity-35 hover:bg-transparent",
6337
+ text: "font-medium"
6338
+ },
6339
+ outline: {
6340
+ 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",
6341
+ button: "rounded-md text-muted-foreground hover:bg-muted hover:text-foreground active:scale-[0.94]",
6342
+ limit: "text-muted-foreground/35 hover:bg-transparent hover:text-muted-foreground/35",
6343
+ text: "font-mono font-medium tracking-tight"
6344
+ }
6345
+ };
6332
6346
  function useDirection(value) {
6333
6347
  const [previous, setPrevious] = useState8(value);
6334
6348
  const [direction, setDirection] = useState8(1);
@@ -6421,7 +6435,10 @@ var NumberStepper = forwardRef4(
6421
6435
  step = 1,
6422
6436
  className,
6423
6437
  size = "default",
6438
+ variant = "pill",
6424
6439
  disabled = false,
6440
+ onRemove,
6441
+ removeLabel = "Remove",
6425
6442
  onFocus,
6426
6443
  onKeyDown,
6427
6444
  onKeyDownCapture
@@ -6507,6 +6524,8 @@ var NumberStepper = forwardRef4(
6507
6524
  if (Number.isNaN(parsed)) return;
6508
6525
  setTo(parsed, parsed > latest.current.value ? 1 : -1);
6509
6526
  };
6527
+ const styles = sizeStyles[size];
6528
+ const look = variantStyles[variant];
6510
6529
  const button = (delta, atLimit, name, path) => /* @__PURE__ */ jsx42(
6511
6530
  "button",
6512
6531
  {
@@ -6532,10 +6551,11 @@ var NumberStepper = forwardRef4(
6532
6551
  }
6533
6552
  },
6534
6553
  className: cn39(
6535
- "flex shrink-0 touch-manipulation items-center justify-center rounded-full text-foreground outline-hidden select-none",
6554
+ "flex shrink-0 touch-manipulation items-center justify-center outline-hidden select-none disabled:cursor-not-allowed",
6536
6555
  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"
6556
+ "transition-[scale,opacity,background-color,color] duration-150 ease-out motion-reduce:transition-[opacity,background-color,color]",
6557
+ look.button,
6558
+ (disabled || atLimit) && look.limit
6539
6559
  ),
6540
6560
  children: /* @__PURE__ */ jsx42(
6541
6561
  "svg",
@@ -6552,20 +6572,54 @@ var NumberStepper = forwardRef4(
6552
6572
  )
6553
6573
  }
6554
6574
  );
6575
+ const removeButton = /* @__PURE__ */ jsx42(
6576
+ "button",
6577
+ {
6578
+ type: "button",
6579
+ disabled,
6580
+ "aria-label": removeLabel,
6581
+ onClick: () => {
6582
+ if (!disabled) onRemove?.();
6583
+ },
6584
+ className: cn39(
6585
+ "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",
6586
+ styles.button,
6587
+ "transition-[scale,background-color,color] duration-150 ease-out motion-reduce:transition-[background-color,color]",
6588
+ look.button,
6589
+ "hover:bg-destructive/10 hover:text-destructive"
6590
+ ),
6591
+ children: /* @__PURE__ */ jsx42(
6592
+ "svg",
6593
+ {
6594
+ viewBox: "0 0 16 16",
6595
+ "aria-hidden": true,
6596
+ className: styles.icon,
6597
+ fill: "none",
6598
+ stroke: "currentColor",
6599
+ strokeWidth: 1.5,
6600
+ strokeLinecap: "round",
6601
+ strokeLinejoin: "round",
6602
+ 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" })
6603
+ }
6604
+ )
6605
+ },
6606
+ "remove"
6607
+ );
6555
6608
  const editing = draft !== null;
6556
- const styles = sizeStyles[size];
6557
6609
  return /* @__PURE__ */ jsxs25(
6558
6610
  "div",
6559
6611
  {
6560
6612
  "data-slot": "input-group",
6613
+ "data-variant": variant,
6561
6614
  className: cn39(
6562
- "shadow-raised inline-flex items-center rounded-full border",
6563
- disabled && "opacity-50",
6615
+ "inline-flex items-center border",
6616
+ disabled && "cursor-not-allowed opacity-50",
6564
6617
  styles.container,
6618
+ look.container,
6565
6619
  className
6566
6620
  ),
6567
6621
  children: [
6568
- button(-step, value <= min, "Decrease", "M3.5 8h9"),
6622
+ onRemove && value <= min ? removeButton : button(-step, value <= min, "Decrease", "M3.5 8h9"),
6569
6623
  /* @__PURE__ */ jsxs25(
6570
6624
  "span",
6571
6625
  {
@@ -6624,8 +6678,9 @@ var NumberStepper = forwardRef4(
6624
6678
  }
6625
6679
  },
6626
6680
  className: cn39(
6627
- "col-start-1 row-start-1 w-full bg-transparent text-center font-medium tabular-nums caret-foreground outline-hidden",
6681
+ "col-start-1 row-start-1 w-full bg-transparent text-center tabular-nums caret-foreground outline-hidden selection:bg-ring/25 disabled:cursor-not-allowed",
6628
6682
  styles.text,
6683
+ look.text,
6629
6684
  editing ? "text-foreground" : "text-transparent"
6630
6685
  )
6631
6686
  }
@@ -6635,8 +6690,9 @@ var NumberStepper = forwardRef4(
6635
6690
  {
6636
6691
  value,
6637
6692
  className: cn39(
6638
- "pointer-events-none col-start-1 row-start-1 font-medium text-foreground",
6639
- styles.text
6693
+ "pointer-events-none col-start-1 row-start-1 text-foreground",
6694
+ styles.text,
6695
+ look.text
6640
6696
  )
6641
6697
  }
6642
6698
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rockin",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "Reusable React UI components, hooks, icons, utilities, and styles for Rock Star projects.",
5
5
  "keywords": [
6
6
  "react",