@px-ui/core 3.0.0 → 3.1.1

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
@@ -1,28 +1,28 @@
1
1
  import { n as __reExport, t as __export } from "./chunk-CYeTv9WL.js";
2
2
  import * as React$1 from "react";
3
- import React, { useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
4
- import { Collapsible, Dialog } from "@base-ui-components/react";
3
+ import React, { createContext, useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
4
+ import { Collapsible, Dialog, Toast } from "@base-ui/react";
5
5
  import classnames from "classnames";
6
6
  import { extendTailwindMerge } from "tailwind-merge";
7
7
  import { cva } from "class-variance-authority";
8
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
- import { Popover } from "@base-ui-components/react/popover";
10
- import { Combobox } from "@base-ui-components/react/combobox";
9
+ import { Popover } from "@base-ui/react/popover";
10
+ import { Combobox } from "@base-ui/react/combobox";
11
11
  import { useInfiniteQuery } from "@tanstack/react-query";
12
- import { Select } from "@base-ui-components/react/select";
13
- import { Menu } from "@base-ui-components/react/menu";
14
- import { Progress } from "@base-ui-components/react/progress";
15
- import { Radio } from "@base-ui-components/react/radio";
16
- import { RadioGroup } from "@base-ui-components/react/radio-group";
17
- import { Tabs } from "@base-ui-components/react/tabs";
18
- import { Tooltip } from "@base-ui-components/react/tooltip";
19
- import { CheckboxGroup } from "@base-ui-components/react/checkbox-group";
20
- import { Checkbox as Checkbox$1 } from "@base-ui-components/react/checkbox";
21
- import { useRender } from "@base-ui-components/react/use-render";
22
- import { mergeProps } from "@base-ui-components/react/merge-props";
12
+ import { Select } from "@base-ui/react/select";
13
+ import { Menu } from "@base-ui/react/menu";
14
+ import { Progress } from "@base-ui/react/progress";
15
+ import { Radio } from "@base-ui/react/radio";
16
+ import { RadioGroup } from "@base-ui/react/radio-group";
17
+ import { Tabs } from "@base-ui/react/tabs";
18
+ import { Tooltip } from "@base-ui/react/tooltip";
19
+ import { CheckboxGroup } from "@base-ui/react/checkbox-group";
20
+ import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
21
+ import { useRender } from "@base-ui/react/use-render";
22
+ import { mergeProps } from "@base-ui/react/merge-props";
23
23
  import { DayPicker, getDefaultClassNames } from "react-day-picker";
24
- import { Avatar as Avatar$1 } from "@base-ui-components/react/avatar";
25
- import { Switch as Switch$1 } from "@base-ui-components/react/switch";
24
+ import { Avatar as Avatar$1 } from "@base-ui/react/avatar";
25
+ import { Switch as Switch$1 } from "@base-ui/react/switch";
26
26
  import { format } from "date-fns";
27
27
 
28
28
  export * from "class-variance-authority"
@@ -82,7 +82,7 @@ const buttonVariants = cva("inline-flex items-center justify-center gap-2 whites
82
82
  default: "px-4 py-2 h-10 has-[>svg]:px-3 text-ppx-base",
83
83
  sm: "gap-1.5 px-3 has-[>svg]:px-2.5 h-8 text-ppx-sm",
84
84
  lg: "px-6 h-12 text-ppx-base font-sans-sb has-[>svg]:px-4",
85
- "icon-sm": "h-8 size-8",
85
+ "icon-sm": "size-8",
86
86
  icon: "size-10 px-2"
87
87
  }
88
88
  },
@@ -1203,7 +1203,7 @@ var segmented_control_exports = /* @__PURE__ */ __export({
1203
1203
  Item: () => Item$4,
1204
1204
  Root: () => Root$4
1205
1205
  });
1206
- const segmentedControlItemVariants = cva("relative flex items-center justify-center px-4 py-2 text-sm font-medium transition-all duration-200 ease-in-out cursor-pointer rounded-full whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ppx-primary-5 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", {
1206
+ const segmentedControlItemVariants = cva("relative flex items-center justify-center px-4 py-2 text-sm font-medium transition-all duration-200 ease-in-out cursor-pointer rounded-full whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ppx-primary-5 focus-visible:ring-offset-2 data-disabled:cursor-not-allowed data-disabled:opacity-50", {
1207
1207
  variants: {
1208
1208
  variant: { default: "text-ppx-neutral-11 data-checked:bg-ppx-primary-5 data-checked:text-white data-checked:shadow-sm hover:text-ppx-neutral-12" },
1209
1209
  size: {
@@ -1220,7 +1220,7 @@ const segmentedControlItemVariants = cva("relative flex items-center justify-cen
1220
1220
  function Root$4({ className, ...props }) {
1221
1221
  return /* @__PURE__ */ jsx(RadioGroup, {
1222
1222
  "data-slot": "segmented-control",
1223
- className: cn("p-1 inline-flex items-center rounded-full bg-ppx-neutral-3", className),
1223
+ className: cn("bg-ppx-neutral-3 inline-flex items-center rounded-full p-1", className),
1224
1224
  ...props
1225
1225
  });
1226
1226
  }
@@ -1374,7 +1374,7 @@ function Content({ className, align = "center", sideOffset = 8, side = "top", ch
1374
1374
 
1375
1375
  //#endregion
1376
1376
  //#region src/components/checkbox.tsx
1377
- const checkboxVariants = cva("peer aria-invalid:border-ppx-red-5 aria-invalid:text-shadow-ppx-red-5 flex items-center justify-center rounded-sm border transition-colors duration-150 outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50", {
1377
+ const checkboxVariants = cva("peer aria-invalid:border-ppx-red-5 aria-invalid:text-shadow-ppx-red-5 flex items-center justify-center rounded-sm border transition-colors duration-150 outline-none focus-visible:ring-2 data-disabled:cursor-not-allowed data-disabled:opacity-50", {
1378
1378
  variants: {
1379
1379
  variant: { default: "bg-white data-checked:bg-ppx-primary-5 data-[indeterminate]:bg-ppx-primary-5 data-checked:text-white data-[indeterminate]:text-white border-ppx-neutral-10 data-checked:border-ppx-primary-5 data-[indeterminate]:border-ppx-primary-5" },
1380
1380
  size: {
@@ -1439,13 +1439,13 @@ var block_checkbox_group_exports = /* @__PURE__ */ __export({
1439
1439
  });
1440
1440
  function Group$2({ className, ...props }) {
1441
1441
  return /* @__PURE__ */ jsx(CheckboxGroup, {
1442
- className: cn("gap-4 flex", className),
1442
+ className: cn("flex gap-4", className),
1443
1443
  ...props
1444
1444
  });
1445
1445
  }
1446
1446
  function Item$3({ className, invalid, children, ...rest }) {
1447
1447
  return /* @__PURE__ */ jsxs("label", {
1448
- className: cn("gap-2 p-5 flex min-h-[155px] justify-between rounded-ppx-s border-2 border-ppx-neutral-3 shadow-[0px_0px_12px_#0000001F] transition-colors duration-300 has-not-disabled:hover:border-ppx-neutral-6 has-disabled:cursor-not-allowed has-disabled:opacity-60 has-disabled:hover:border-ppx-neutral-3 has-aria-invalid:shadow-ppx-red-2 has-data-checked:border-ppx-primary-5!", className),
1448
+ className: cn("rounded-ppx-s border-ppx-neutral-3 has-not-data-disabled:hover:border-ppx-neutral-6 has-data-disabled:cursor-not-allowed has-data-disabled:opacity-60 has-data-disabled:hover:border-ppx-neutral-3 has-aria-invalid:shadow-ppx-red-2 has-data-checked:border-ppx-primary-5! flex min-h-[155px] justify-between gap-2 border-2 p-5 shadow-[0px_0px_12px_#0000001F] transition-colors duration-300", className),
1449
1449
  children: [/* @__PURE__ */ jsx("div", {
1450
1450
  className: "flex-1",
1451
1451
  children
@@ -1459,7 +1459,7 @@ function Item$3({ className, invalid, children, ...rest }) {
1459
1459
  }
1460
1460
  function Header$1(props) {
1461
1461
  return /* @__PURE__ */ jsx("div", {
1462
- className: cn("mb-5 gap-2 flex items-center", props.className),
1462
+ className: cn("mb-5 flex items-center gap-2", props.className),
1463
1463
  children: props.children
1464
1464
  });
1465
1465
  }
@@ -1471,7 +1471,7 @@ function Title$1(props) {
1471
1471
  }
1472
1472
  function Description$1(props) {
1473
1473
  return /* @__PURE__ */ jsx("p", {
1474
- className: cn("mb-5 text-ppx-sm text-ppx-muted-foreground", props.className),
1474
+ className: cn("text-ppx-sm text-ppx-muted-foreground mb-5", props.className),
1475
1475
  children: props.children
1476
1476
  });
1477
1477
  }
@@ -1489,7 +1489,7 @@ function Group$1({ className, ...props }) {
1489
1489
  ...props
1490
1490
  });
1491
1491
  }
1492
- const radioVariants = cva("bg-white aria-invalid:border-ppx-red-5 aspect-square shrink-0 rounded-full border border-ppx-neutral-10 shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 ", {
1492
+ const radioVariants = cva("relative inline-flex bg-ppx-background aria-invalid:border-ppx-red-5 aspect-square shrink-0 rounded-full border border-ppx-neutral-10 shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] data-disabled:cursor-not-allowed data-disabled:opacity-50 items-center justify-center", {
1493
1493
  variants: {
1494
1494
  variant: { default: "data-checked:border-ppx-primary-5 text-ppx-primary-5" },
1495
1495
  size: {
@@ -1525,7 +1525,7 @@ function Item$1({ className, variant, size, ...props }) {
1525
1525
  strokeWidth: "2",
1526
1526
  strokeLinecap: "round",
1527
1527
  strokeLinejoin: "round",
1528
- className: cn("absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2", size === "sm" && "size-2", size === void 0 && "size-3", size === "lg" && "size-3.5"),
1528
+ className: cn("absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2", size === "sm" && "size-2", size === void 0 || size === "default" ? "size-3" : "", size === "lg" && "size-3.5"),
1529
1529
  children: /* @__PURE__ */ jsx("circle", {
1530
1530
  cx: "12",
1531
1531
  cy: "12",
@@ -1554,7 +1554,7 @@ function Group({ className, ...props }) {
1554
1554
  }
1555
1555
  function Item$2({ className, invalid, children, ...rest }) {
1556
1556
  return /* @__PURE__ */ jsxs("label", {
1557
- className: cn("rounded-ppx-s border-ppx-neutral-3 has-not-disabled:hover:border-ppx-neutral-6 has-disabled:cursor-not-allowed has-disabled:opacity-60 has-disabled:hover:border-ppx-neutral-3 has-aria-invalid:shadow-ppx-red-2 has-data-checked:border-ppx-primary-5! flex min-h-[155px] justify-between gap-2 border-2 p-5 shadow-[0px_0px_12px_#0000001F] transition-colors duration-300", className),
1557
+ className: cn("rounded-ppx-s border-ppx-neutral-3 has-not-data-disabled:hover:border-ppx-neutral-6 has-data-disabled:cursor-not-allowed has-data-disabled:opacity-60 has-data-disabled:hover:border-ppx-neutral-3 has-aria-invalid:shadow-ppx-red-2 has-data-checked:border-ppx-primary-5! flex min-h-[155px] justify-between gap-2 border-2 p-5 shadow-[0px_0px_12px_#0000001F] transition-colors duration-300", className),
1558
1558
  children: [/* @__PURE__ */ jsx("div", {
1559
1559
  className: "flex-1",
1560
1560
  children
@@ -1776,12 +1776,291 @@ function CalendarDayButton({ className, day, modifiers, ...props }) {
1776
1776
  });
1777
1777
  }
1778
1778
 
1779
+ //#endregion
1780
+ //#region src/icons/circle-alert-icon.tsx
1781
+ function CircleAlertIcon(props) {
1782
+ return /* @__PURE__ */ jsxs("svg", {
1783
+ xmlns: "http://www.w3.org/2000/svg",
1784
+ width: "24",
1785
+ height: "24",
1786
+ viewBox: "0 0 24 24",
1787
+ fill: "none",
1788
+ stroke: "currentColor",
1789
+ strokeWidth: "2",
1790
+ strokeLinecap: "round",
1791
+ strokeLinejoin: "round",
1792
+ ...props,
1793
+ className: cn("size-4 shrink-0", props.className),
1794
+ children: [
1795
+ /* @__PURE__ */ jsx("circle", {
1796
+ cx: "12",
1797
+ cy: "12",
1798
+ r: "10"
1799
+ }),
1800
+ /* @__PURE__ */ jsx("line", {
1801
+ x1: "12",
1802
+ x2: "12",
1803
+ y1: "8",
1804
+ y2: "12"
1805
+ }),
1806
+ /* @__PURE__ */ jsx("line", {
1807
+ x1: "12",
1808
+ x2: "12.01",
1809
+ y1: "16",
1810
+ y2: "16"
1811
+ })
1812
+ ]
1813
+ });
1814
+ }
1815
+
1816
+ //#endregion
1817
+ //#region src/icons/circle-check-icon.tsx
1818
+ function CircleCheckIcon(props) {
1819
+ return /* @__PURE__ */ jsxs("svg", {
1820
+ xmlns: "http://www.w3.org/2000/svg",
1821
+ width: "24",
1822
+ height: "24",
1823
+ viewBox: "0 0 24 24",
1824
+ fill: "none",
1825
+ stroke: "currentColor",
1826
+ strokeWidth: "2",
1827
+ strokeLinecap: "round",
1828
+ strokeLinejoin: "round",
1829
+ ...props,
1830
+ className: cn("size-4 shrink-0", props.className),
1831
+ children: [/* @__PURE__ */ jsx("circle", {
1832
+ cx: "12",
1833
+ cy: "12",
1834
+ r: "10"
1835
+ }), /* @__PURE__ */ jsx("path", { d: "m9 12 2 2 4-4" })]
1836
+ });
1837
+ }
1838
+
1839
+ //#endregion
1840
+ //#region src/icons/info-icon.tsx
1841
+ function InfoIcon(props) {
1842
+ return /* @__PURE__ */ jsxs("svg", {
1843
+ xmlns: "http://www.w3.org/2000/svg",
1844
+ width: "24",
1845
+ height: "24",
1846
+ viewBox: "0 0 24 24",
1847
+ fill: "none",
1848
+ stroke: "currentColor",
1849
+ "stroke-width": "2",
1850
+ strokeLinecap: "round",
1851
+ strokeLinejoin: "round",
1852
+ ...props,
1853
+ className: cn("size-4 shrink-0", props.className),
1854
+ children: [
1855
+ /* @__PURE__ */ jsx("circle", {
1856
+ cx: "12",
1857
+ cy: "12",
1858
+ r: "10"
1859
+ }),
1860
+ /* @__PURE__ */ jsx("path", { d: "M12 16v-4" }),
1861
+ /* @__PURE__ */ jsx("path", { d: "M12 8h.01" })
1862
+ ]
1863
+ });
1864
+ }
1865
+
1866
+ //#endregion
1867
+ //#region src/icons/triangle-alert-icon.tsx
1868
+ function TriangleAlertIcon(props) {
1869
+ return /* @__PURE__ */ jsxs("svg", {
1870
+ xmlns: "http://www.w3.org/2000/svg",
1871
+ width: "24",
1872
+ height: "24",
1873
+ viewBox: "0 0 24 24",
1874
+ fill: "none",
1875
+ stroke: "currentColor",
1876
+ strokeWidth: "2",
1877
+ strokeLinecap: "round",
1878
+ strokeLinejoin: "round",
1879
+ ...props,
1880
+ className: cn("size-4 shrink-0", props.className),
1881
+ children: [
1882
+ /* @__PURE__ */ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
1883
+ /* @__PURE__ */ jsx("path", { d: "M12 9v4" }),
1884
+ /* @__PURE__ */ jsx("path", { d: "M12 17h.01" })
1885
+ ]
1886
+ });
1887
+ }
1888
+
1889
+ //#endregion
1890
+ //#region src/icons/spinner-icon.tsx
1891
+ function SpinnerIcon(props) {
1892
+ return /* @__PURE__ */ jsx("svg", {
1893
+ xmlns: "http://www.w3.org/2000/svg",
1894
+ viewBox: "0 0 24 24",
1895
+ fill: "none",
1896
+ stroke: "currentColor",
1897
+ strokeWidth: 2,
1898
+ strokeLinecap: "round",
1899
+ strokeLinejoin: "round",
1900
+ ...props,
1901
+ className: cn("shrink-0", props.className),
1902
+ children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
1903
+ });
1904
+ }
1905
+
1906
+ //#endregion
1907
+ //#region src/components/toast.tsx
1908
+ const toast = Toast.createToastManager();
1909
+ const anchoredToast = Toast.createToastManager();
1910
+ const TOAST_ICONS = {
1911
+ error: CircleAlertIcon,
1912
+ info: InfoIcon,
1913
+ loading: SpinnerIcon,
1914
+ success: CircleCheckIcon,
1915
+ warning: TriangleAlertIcon
1916
+ };
1917
+ function ToastProvider({ children, position = "top-center", ...props }) {
1918
+ return /* @__PURE__ */ jsxs(Toast.Provider, {
1919
+ toastManager: toast,
1920
+ ...props,
1921
+ children: [children, /* @__PURE__ */ jsx(Toasts, { position })]
1922
+ });
1923
+ }
1924
+ function Toasts(props) {
1925
+ const { position = "top-center" } = props;
1926
+ const { toasts } = Toast.useToastManager();
1927
+ const isTop = position.startsWith("top");
1928
+ const hasLoadingToast = toasts.some((t) => t.type === "loading");
1929
+ return /* @__PURE__ */ jsxs(Toast.Portal, {
1930
+ "data-slot": "toast-portal",
1931
+ children: [hasLoadingToast && /* @__PURE__ */ jsx("div", {
1932
+ className: "bg-ppx-foreground/20 fixed inset-0 z-40 transition-opacity",
1933
+ "data-slot": "toast-backdrop"
1934
+ }), /* @__PURE__ */ jsx(Toast.Viewport, {
1935
+ className: cn("max-w-90 fixed z-50 mx-auto flex w-[calc(100%-var(--toast-inset)*2)] [--toast-inset:--spacing(4)] sm:[--toast-inset:--spacing(8)]", "data-[position*=top]:top-(--toast-inset)", "data-[position*=bottom]:bottom-(--toast-inset)", "data-[position*=left]:left-(--toast-inset)", "data-[position*=right]:right-(--toast-inset)", "data-[position*=center]:left-1/2 data-[position*=center]:-translate-x-1/2"),
1936
+ "data-position": position,
1937
+ "data-slot": "toast-viewport",
1938
+ children: toasts.map((toast$1) => {
1939
+ const Icon = toast$1.type ? TOAST_ICONS[toast$1.type] : null;
1940
+ return /* @__PURE__ */ jsx(Toast.Root, {
1941
+ className: cn("h-(--toast-calc-height) bg-ppx-background text-ppx-foreground rounded-ppx-m border-ppx-neutral-4 absolute z-[calc(9999-var(--toast-index))] w-full select-none border bg-clip-padding shadow-lg [transition:transform_.5s_cubic-bezier(.22,1,.36,1),opacity_.5s,height_.15s] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-ppx-m)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)]", "data-[position*=right]:left-auto data-[position*=right]:right-0", "data-[position*=left]:left-0 data-[position*=left]:right-auto", "data-[position*=center]:left-0 data-[position*=center]:right-0", "data-[position*=top]:bottom-auto data-[position*=top]:top-0 data-[position*=top]:origin-top", "data-[position*=bottom]:bottom-0 data-[position*=bottom]:top-auto data-[position*=bottom]:origin-bottom", "after:absolute after:left-0 after:h-[calc(var(--toast-gap)+1px)] after:w-full", "data-[position*=top]:after:top-full", "data-[position*=bottom]:after:bottom-full", "[--toast-calc-height:var(--toast-frontmost-height,var(--toast-height))] [--toast-gap:--spacing(3)] [--toast-peek:--spacing(3)] [--toast-scale:calc(max(0,1-(var(--toast-index)*.1)))] [--toast-shrink:calc(1-var(--toast-scale))]", "data-[position*=top]:[--toast-calc-offset-y:calc(var(--toast-offset-y)+var(--toast-index)*var(--toast-gap)+var(--toast-swipe-movement-y))]", "data-[position*=bottom]:[--toast-calc-offset-y:calc(var(--toast-offset-y)*-1+var(--toast-index)*var(--toast-gap)*-1+var(--toast-swipe-movement-y))]", "data-[position*=top]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--toast-peek))+(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]", "data-[position*=bottom]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--toast-peek))-(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]", "data-limited:opacity-0", "data-expanded:h-(--toast-height)", "data-position:data-expanded:transform-[translateX(var(--toast-swipe-movement-x))_translateY(var(--toast-calc-offset-y))]", "data-[position*=top]:data-starting-style:transform-[translateY(calc(-100%-var(--toast-inset)))]", "data-[position*=bottom]:data-starting-style:transform-[translateY(calc(100%+var(--toast-inset)))]", "data-ending-style:opacity-0", "data-[position*=top]:data-ending-style:not-data-limited:not-data-swipe-direction:transform-[translateY(calc(-100%-var(--toast-inset)))]", "data-[position*=bottom]:data-ending-style:not-data-limited:not-data-swipe-direction:transform-[translateY(calc(100%+var(--toast-inset)))]", "data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]", "data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]", "data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]", "data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]", "data-expanded:data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]", "data-expanded:data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]", "data-expanded:data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]", "data-expanded:data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]", toast$1.type === "success" && "bg-ppx-green-1", toast$1.type === "info" && "bg-ppx-primary-b-1", toast$1.type === "warning" && "bg-ppx-yellow-1", toast$1.type === "error" && "bg-ppx-red-1"),
1942
+ "data-position": position,
1943
+ swipeDirection: position.includes("center") ? [isTop ? "up" : "down"] : position.includes("left") ? ["left", isTop ? "up" : "down"] : ["right", isTop ? "up" : "down"],
1944
+ toast: toast$1,
1945
+ children: /* @__PURE__ */ jsxs(Toast.Content, {
1946
+ className: "duration-250 data-behind:pointer-events-none data-behind:opacity-0 data-expanded:opacity-100 text-ppx-sm pointer-events-auto flex flex-col gap-2.5 overflow-hidden px-3.5 py-4 transition-opacity",
1947
+ children: [/* @__PURE__ */ jsxs("div", {
1948
+ className: "flex gap-2",
1949
+ children: [Icon && /* @__PURE__ */ jsx("div", {
1950
+ className: "[&>svg]:h-lh [&>svg]:w-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
1951
+ "data-slot": "toast-icon",
1952
+ children: /* @__PURE__ */ jsx(Icon, { className: "in-data-[type=loading]:animate-spin in-data-[type=error]:text-ppx-red-5 in-data-[type=info]:text-ppx-primary-b-5 in-data-[type=success]:text-ppx-green-5 in-data-[type=warning]:text-ppx-yellow-5 in-data-[type=loading]:opacity-80" })
1953
+ }), /* @__PURE__ */ jsxs("div", {
1954
+ className: "flex flex-col gap-1.5",
1955
+ children: [
1956
+ /* @__PURE__ */ jsx(Toast.Title, {
1957
+ className: "text-ppx-base font-medium leading-none",
1958
+ "data-slot": "toast-title"
1959
+ }),
1960
+ /* @__PURE__ */ jsx(Toast.Description, {
1961
+ className: "text-ppx-muted-foreground",
1962
+ "data-slot": "toast-description"
1963
+ }),
1964
+ toast$1.type === "loading" ? null : /* @__PURE__ */ jsx(Toast.Close, {
1965
+ className: buttonVariants({
1966
+ size: "icon-sm",
1967
+ variant: "ghost",
1968
+ className: "absolute right-2 top-2 shrink-0"
1969
+ }),
1970
+ "aria-label": "Close",
1971
+ children: /* @__PURE__ */ jsx(CloseIcon, { className: "size-4" })
1972
+ })
1973
+ ]
1974
+ })]
1975
+ }), toast$1.actionProps && /* @__PURE__ */ jsx(Toast.Action, {
1976
+ className: buttonVariants({ size: "sm" }),
1977
+ "data-slot": "toast-action",
1978
+ children: toast$1.actionProps.children
1979
+ })]
1980
+ })
1981
+ }, toast$1.id);
1982
+ })
1983
+ })]
1984
+ });
1985
+ }
1986
+ function AnchoredToastProvider({ children, ...props }) {
1987
+ return /* @__PURE__ */ jsxs(Toast.Provider, {
1988
+ toastManager: anchoredToast,
1989
+ ...props,
1990
+ children: [children, /* @__PURE__ */ jsx(AnchoredToasts, {})]
1991
+ });
1992
+ }
1993
+ function AnchoredToasts() {
1994
+ const { toasts } = Toast.useToastManager();
1995
+ return /* @__PURE__ */ jsx(Toast.Portal, {
1996
+ "data-slot": "toast-portal-anchored",
1997
+ children: /* @__PURE__ */ jsx(Toast.Viewport, {
1998
+ className: "outline-none",
1999
+ "data-slot": "toast-viewport-anchored",
2000
+ children: toasts.map((toast$1) => {
2001
+ const Icon = toast$1.type ? TOAST_ICONS[toast$1.type] : null;
2002
+ const tooltipStyle = toast$1.data?.tooltipStyle ?? false;
2003
+ const positionerProps = toast$1.positionerProps;
2004
+ if (!positionerProps?.anchor) return null;
2005
+ return /* @__PURE__ */ jsx(Toast.Positioner, {
2006
+ className: "z-50 max-w-[min(--spacing(64),var(--available-width))]",
2007
+ "data-slot": "toast-positioner",
2008
+ sideOffset: positionerProps.sideOffset ?? 4,
2009
+ toast: toast$1,
2010
+ children: /* @__PURE__ */ jsx(Toast.Root, {
2011
+ className: cn("bg-ppx-background text-ppx-foreground data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 text-ppx-sm relative text-balance border bg-clip-padding transition-[scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:shadow-[0_1px_--theme(--color-black/4%)]", tooltipStyle ? "rounded-ppx-m shadow-md shadow-black/5 before:rounded-[calc(var(--radius-ppx-s)-1px)]" : "rounded-ppx-l shadow-lg before:rounded-[calc(var(--radius-ppx-m)-1px)]", toast$1.type === "success" && "bg-ppx-green-1", toast$1.type === "info" && "bg-ppx-primary-b-1", toast$1.type === "warning" && "bg-ppx-yellow-1", toast$1.type === "error" && "bg-ppx-red-1"),
2012
+ "data-slot": "toast-popup",
2013
+ toast: toast$1,
2014
+ children: tooltipStyle ? /* @__PURE__ */ jsx(Toast.Content, {
2015
+ className: "pointer-events-auto px-2 py-1",
2016
+ children: /* @__PURE__ */ jsx(Toast.Title, { "data-slot": "toast-title" })
2017
+ }) : /* @__PURE__ */ jsxs(Toast.Content, {
2018
+ className: "text-ppx-sm pointer-events-auto relative flex items-center justify-between gap-1.5 overflow-hidden px-3.5 py-3",
2019
+ children: [/* @__PURE__ */ jsxs("div", {
2020
+ className: "flex gap-2",
2021
+ children: [Icon && /* @__PURE__ */ jsx("div", {
2022
+ className: "[&>svg]:h-lh [&>svg]:w-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
2023
+ "data-slot": "toast-icon",
2024
+ children: /* @__PURE__ */ jsx(Icon, { className: "in-data-[type=loading]:animate-spin in-data-[type=error]:text-ppx-red-5 in-data-[type=info]:text-ppx-primary-b-5 in-data-[type=success]:text-ppx-green-5 in-data-[type=warning]:text-ppx-yellow-5 in-data-[type=loading]:opacity-80" })
2025
+ }), /* @__PURE__ */ jsxs("div", {
2026
+ className: "flex flex-col gap-0.5",
2027
+ children: [/* @__PURE__ */ jsx(Toast.Title, {
2028
+ className: "text-ppx-base font-medium leading-none",
2029
+ "data-slot": "toast-title"
2030
+ }), /* @__PURE__ */ jsx(Toast.Description, {
2031
+ className: "text-ppx-muted-foreground",
2032
+ "data-slot": "toast-description"
2033
+ })]
2034
+ })]
2035
+ }), toast$1.actionProps && /* @__PURE__ */ jsx(Toast.Action, {
2036
+ className: buttonVariants({ size: "sm" }),
2037
+ "data-slot": "toast-action",
2038
+ children: toast$1.actionProps.children
2039
+ })]
2040
+ })
2041
+ })
2042
+ }, toast$1.id);
2043
+ })
2044
+ })
2045
+ });
2046
+ }
2047
+
2048
+ //#endregion
2049
+ //#region src/providers/px-ui-provider.tsx
2050
+ const PXUIContext = createContext(null);
2051
+ function PXUIProvider(props) {
2052
+ return /* @__PURE__ */ jsx(PXUIContext.Provider, {
2053
+ value: null,
2054
+ children: /* @__PURE__ */ jsx(ToastProvider, { children: /* @__PURE__ */ jsx(AnchoredToastProvider, { children: props.children }) })
2055
+ });
2056
+ }
2057
+
1779
2058
  //#endregion
1780
2059
  //#region src/components/label.tsx
1781
2060
  function Label({ className, ...props }) {
1782
2061
  return /* @__PURE__ */ jsx("label", {
1783
2062
  "data-slot": "label",
1784
- className: cn("gap-2 font-medium flex items-center text-ppx-sm leading-none select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
2063
+ className: cn("text-ppx-sm peer-data-disabled:cursor-not-allowed peer-data-disabled:opacity-50 group-data-disabled:pointer-events-none group-data-disabled:opacity-50 flex select-none items-center gap-2 font-medium leading-none", className),
1785
2064
  ...props
1786
2065
  });
1787
2066
  }
@@ -1966,9 +2245,9 @@ function AvatarGroup({ max = 4, avatars, className }) {
1966
2245
  marginLeft: `-${parseInt(avatars[0].size ?? "100px") * .25}px`,
1967
2246
  zIndex: 0
1968
2247
  },
1969
- children: /* @__PURE__ */ jsxs(Root$10, {
2248
+ children: /* @__PURE__ */ jsxs(Root$10, { children: [/* @__PURE__ */ jsx(Trigger$7, {
1970
2249
  openOnHover: true,
1971
- children: [/* @__PURE__ */ jsx(Trigger$7, { children: /* @__PURE__ */ jsxs("div", {
2250
+ children: /* @__PURE__ */ jsxs("div", {
1972
2251
  className: cn("bg-ppx-neutral-3 text-ppx-neutral-18 hover:bg-ppx-neutral-4 flex cursor-pointer items-center justify-center font-medium transition-colors", avatars[0].variant === "rounded" ? "rounded-full" : "rounded-ppx-s"),
1973
2252
  style: {
1974
2253
  width: avatars[0].size ?? "100px",
@@ -1976,28 +2255,28 @@ function AvatarGroup({ max = 4, avatars, className }) {
1976
2255
  fontSize: `${parseInt(avatars[0].size ?? "100px") * .3}px`
1977
2256
  },
1978
2257
  children: ["+", overflowAvatars.length]
1979
- }) }), /* @__PURE__ */ jsx(Content$5, {
1980
- className: "w-80",
1981
- positionerProps: {
1982
- align: "start",
1983
- side: "top"
1984
- },
1985
- children: /* @__PURE__ */ jsx("div", {
1986
- className: "max-h-64 space-y-2 overflow-y-auto",
1987
- children: overflowAvatars.map((avatar) => /* @__PURE__ */ jsxs("div", {
1988
- className: "flex items-center gap-3 rounded-md p-2",
1989
- children: [/* @__PURE__ */ jsx(Avatar, {
1990
- ...avatar,
1991
- size: "24px",
1992
- hideTooltip: true
1993
- }), /* @__PURE__ */ jsx("span", {
1994
- className: "text-ppx-neutral-18 text-sm font-medium",
1995
- children: avatar.name
1996
- })]
1997
- }, avatar.name))
1998
- })
1999
- })]
2000
- })
2258
+ })
2259
+ }), /* @__PURE__ */ jsx(Content$5, {
2260
+ className: "w-80",
2261
+ positionerProps: {
2262
+ align: "start",
2263
+ side: "top"
2264
+ },
2265
+ children: /* @__PURE__ */ jsx("div", {
2266
+ className: "max-h-64 space-y-2 overflow-y-auto",
2267
+ children: overflowAvatars.map((avatar) => /* @__PURE__ */ jsxs("div", {
2268
+ className: "flex items-center gap-3 rounded-md p-2",
2269
+ children: [/* @__PURE__ */ jsx(Avatar, {
2270
+ ...avatar,
2271
+ size: "24px",
2272
+ hideTooltip: true
2273
+ }), /* @__PURE__ */ jsx("span", {
2274
+ className: "text-ppx-neutral-18 text-sm font-medium",
2275
+ children: avatar.name
2276
+ })]
2277
+ }, avatar.name))
2278
+ })
2279
+ })] })
2001
2280
  })]
2002
2281
  }) });
2003
2282
  }
@@ -2007,11 +2286,11 @@ function AvatarGroup({ max = 4, avatars, className }) {
2007
2286
  function Switch({ className, size, ...props }) {
2008
2287
  return /* @__PURE__ */ jsx(Switch$1.Root, {
2009
2288
  "data-slot": "switch",
2010
- className: cn("peer shadow-xs inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:ring-3 focus-visible:ring-ppx-neutral-17/30 disabled:cursor-not-allowed disabled:opacity-50 data-checked:bg-ppx-primary-5 data-unchecked:bg-ppx-neutral-4", size === "sm" && "h-4 w-8", size === void 0 && "h-5 w-10", size === "lg" && "h-6 w-12", className),
2289
+ className: cn("shadow-xs focus-visible:ring-3 focus-visible:ring-ppx-neutral-17/30 data-checked:bg-ppx-primary-5 data-unchecked:bg-ppx-neutral-4 data-disabled:cursor-not-allowed data-disabled:opacity-50 peer inline-flex shrink-0 items-center rounded-full border border-transparent outline-none transition-all", size === "sm" && "h-4 w-8", size === void 0 || size === "default" ? "h-5 w-10" : "", size === "lg" && "h-6 w-12", className),
2011
2290
  ...props,
2012
2291
  children: /* @__PURE__ */ jsx(Switch$1.Thumb, {
2013
2292
  "data-slot": "switch-thumb",
2014
- className: cn("ease-in-out pointer-events-none block rounded-full bg-ppx-neutral-1 ring-0 transition-transform duration-300", size === "sm" && "size-3.5 data-checked:translate-x-[calc(100%+2px)]", size === void 0 && "size-4 data-checked:translate-x-[calc(100%+5px)] data-unchecked:translate-x-px", size === "lg" && "size-5 data-checked:translate-x-[calc(100%+5px)] data-unchecked:translate-x-px")
2293
+ className: cn("bg-ppx-neutral-1 pointer-events-none block rounded-full ring-0 transition-transform duration-300 ease-in-out", size === "sm" && "data-checked:translate-x-[calc(100%+2px)] size-3.5", size === void 0 || size === "default" ? "data-checked:translate-x-[calc(100%+5px)] data-unchecked:translate-x-px size-4" : "", size === "lg" && "data-checked:translate-x-[calc(100%+5px)] data-unchecked:translate-x-px size-5")
2015
2294
  })
2016
2295
  });
2017
2296
  }
@@ -2126,23 +2405,6 @@ function RetryIcon(props) {
2126
2405
  });
2127
2406
  }
2128
2407
 
2129
- //#endregion
2130
- //#region src/icons/spinner-icon.tsx
2131
- function SpinnerIcon(props) {
2132
- return /* @__PURE__ */ jsx("svg", {
2133
- xmlns: "http://www.w3.org/2000/svg",
2134
- viewBox: "0 0 24 24",
2135
- fill: "none",
2136
- stroke: "currentColor",
2137
- strokeWidth: 2,
2138
- strokeLinecap: "round",
2139
- strokeLinejoin: "round",
2140
- ...props,
2141
- className: cn("shrink-0", props.className),
2142
- children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
2143
- });
2144
- }
2145
-
2146
2408
  //#endregion
2147
2409
  //#region src/icons/upload-icon.tsx
2148
2410
  function UploadIcon(props) {
@@ -2896,6 +3158,23 @@ const FileUpload = {
2896
3158
  ImageGridItem
2897
3159
  };
2898
3160
 
3161
+ //#endregion
3162
+ //#region src/hooks/use-mobile.ts
3163
+ const MOBILE_BREAKPOINT = 768;
3164
+ function useIsMobile() {
3165
+ const [isMobile, setIsMobile] = React$1.useState(void 0);
3166
+ React$1.useEffect(() => {
3167
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
3168
+ const onChange = () => {
3169
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
3170
+ };
3171
+ mql.addEventListener("change", onChange);
3172
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
3173
+ return () => mql.removeEventListener("change", onChange);
3174
+ }, []);
3175
+ return !!isMobile;
3176
+ }
3177
+
2899
3178
  //#endregion
2900
3179
  //#region src/index.ts
2901
3180
  var src_exports = /* @__PURE__ */ __export({
@@ -2918,6 +3197,7 @@ var src_exports = /* @__PURE__ */ __export({
2918
3197
  InputGroup: () => input_group_exports,
2919
3198
  Label: () => Label,
2920
3199
  Menu: () => menu_exports,
3200
+ PXUIProvider: () => PXUIProvider,
2921
3201
  Popover: () => popover_exports,
2922
3202
  Progress: () => progress_exports,
2923
3203
  RadioGroup: () => radio_group_exports,
@@ -2930,15 +3210,18 @@ var src_exports = /* @__PURE__ */ __export({
2930
3210
  Textarea: () => Textarea,
2931
3211
  Tooltip: () => tooltip_exports,
2932
3212
  UploadIcon: () => UploadIcon,
3213
+ anchoredToast: () => anchoredToast,
2933
3214
  buttonVariants: () => buttonVariants,
2934
3215
  cn: () => cn,
2935
3216
  defineLoadOptions: () => defineLoadOptions,
2936
3217
  formatBytes: () => formatBytes,
3218
+ toast: () => toast,
2937
3219
  useAsyncOptions: () => useAsyncOptions,
2938
3220
  useFileUpload: () => useFileUpload,
2939
- useIntersectionObserver: () => useIntersectionObserver
3221
+ useIntersectionObserver: () => useIntersectionObserver,
3222
+ useIsMobile: () => useIsMobile
2940
3223
  });
2941
3224
 
2942
3225
  //#endregion
2943
- export { Avatar, AvatarGroup, AvatarImpl, block_checkbox_group_exports as BlockCheckboxGroup, block_radio_group_exports as BlockRadioGroup, breadcrumbs_exports as Breadcrumbs, Button, Calendar, Checkbox, collapsible_exports as Collapsible, combobox_exports as Combobox, DatePicker, dialog_exports as Dialog, FileIcon, FileUpload, Input, input_group_exports as InputGroup, Label, menu_exports as Menu, popover_exports as Popover, progress_exports as Progress, radio_group_exports as RadioGroup, segmented_control_exports as SegmentedControl, select_exports as Select, Separator, Spinner, Switch, tabs_exports as Tabs, Textarea, tooltip_exports as Tooltip, UploadIcon, buttonVariants, cn, defineLoadOptions, formatBytes, useAsyncOptions, useFileUpload, useIntersectionObserver };
3226
+ export { Avatar, AvatarGroup, AvatarImpl, block_checkbox_group_exports as BlockCheckboxGroup, block_radio_group_exports as BlockRadioGroup, breadcrumbs_exports as Breadcrumbs, Button, Calendar, Checkbox, collapsible_exports as Collapsible, combobox_exports as Combobox, DatePicker, dialog_exports as Dialog, FileIcon, FileUpload, Input, input_group_exports as InputGroup, Label, menu_exports as Menu, PXUIProvider, popover_exports as Popover, progress_exports as Progress, radio_group_exports as RadioGroup, segmented_control_exports as SegmentedControl, select_exports as Select, Separator, Spinner, Switch, tabs_exports as Tabs, Textarea, tooltip_exports as Tooltip, UploadIcon, anchoredToast, buttonVariants, cn, defineLoadOptions, formatBytes, toast, useAsyncOptions, useFileUpload, useIntersectionObserver, useIsMobile };
2944
3227
  //# sourceMappingURL=index.js.map