@px-ui/core 2.1.0 → 3.0.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
@@ -1,7 +1,7 @@
1
1
  import { n as __reExport, t as __export } from "./chunk-CYeTv9WL.js";
2
2
  import * as React$1 from "react";
3
3
  import React, { useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
4
- import { Dialog } from "@base-ui-components/react";
4
+ import { Collapsible, Dialog } from "@base-ui-components/react";
5
5
  import classnames from "classnames";
6
6
  import { extendTailwindMerge } from "tailwind-merge";
7
7
  import { cva } from "class-variance-authority";
@@ -133,11 +133,11 @@ var dialog_exports = /* @__PURE__ */ __export({
133
133
  HeaderIcon: () => HeaderIcon,
134
134
  Overlay: () => Overlay,
135
135
  Portal: () => Portal$1,
136
- Root: () => Root$10,
136
+ Root: () => Root$11,
137
137
  Title: () => Title$3,
138
- Trigger: () => Trigger$7
138
+ Trigger: () => Trigger$8
139
139
  });
140
- function Root$10({ ...props }) {
140
+ function Root$11({ ...props }) {
141
141
  return /* @__PURE__ */ jsx(Dialog.Root, {
142
142
  "data-slot": "dialog",
143
143
  ...props
@@ -149,7 +149,7 @@ function Portal$1({ ...props }) {
149
149
  ...props
150
150
  });
151
151
  }
152
- function Trigger$7({ ...props }) {
152
+ function Trigger$8({ ...props }) {
153
153
  return /* @__PURE__ */ jsx(Dialog.Trigger, {
154
154
  "data-slot": "dialog-trigger",
155
155
  ...props
@@ -242,11 +242,11 @@ var popover_exports = /* @__PURE__ */ __export({
242
242
  Description: () => Description$2,
243
243
  Footer: () => Footer,
244
244
  Header: () => Header$2,
245
- Root: () => Root$9,
245
+ Root: () => Root$10,
246
246
  Title: () => Title$2,
247
- Trigger: () => Trigger$6
247
+ Trigger: () => Trigger$7
248
248
  });
249
- function Root$9(props) {
249
+ function Root$10(props) {
250
250
  return /* @__PURE__ */ jsx(Popover.Root, {
251
251
  "data-slot": "popover",
252
252
  ...props
@@ -258,7 +258,7 @@ function Portal(props) {
258
258
  ...props
259
259
  });
260
260
  }
261
- function Trigger$6(props) {
261
+ function Trigger$7(props) {
262
262
  return /* @__PURE__ */ jsx(Popover.Trigger, {
263
263
  "data-slot": "popover-trigger",
264
264
  ...props
@@ -531,7 +531,7 @@ var input_group_exports = /* @__PURE__ */ __export({
531
531
  Addon: () => Addon,
532
532
  Button: () => Button$1,
533
533
  Input: () => Input$1,
534
- Root: () => Root$8,
534
+ Root: () => Root$9,
535
535
  Text: () => Text
536
536
  });
537
537
  const inputGroupVariants = cva("group/input-group relative flex items-center border border-ppx-neutral-5 bg-ppx-neutral-1 outline-transparent has-[[data-slot=input-group-control]:focus-visible]:outline-2 has-[[data-slot=input-group-control]:focus-visible]:-outline-offset-1 has-[[data-slot=input-group-control]:focus-visible]:bg-ppx-background has-[[data-slot=input-group-control]:focus-visible]:outline-ppx-primary-focus has-[[data-slot][aria-invalid=true]]:outline-ppx-red-4 has-[[data-slot][aria-invalid=true]]:outline has-[[data-slot][aria-invalid=true]]:-outline-offset-1 has-[[data-slot][aria-invalid=true]]:bg-ppx-red-1 has-[[data-slot=input-group-control]:disabled]:*:cursor-not-allowed has-[[data-slot=input-group-control]:disabled]:border-ppx-neutral-3 has-[[data-slot=input-group-control]:disabled]:bg-ppx-neutral-3 has-[[data-slot=input-group-control]:disabled]:text-ppx-neutral-11 has-[>[data-align=inline-start]]:[&>input]:pl-input has-[>[data-align=inline-end]]:[&>input]:pr-input", {
@@ -551,7 +551,7 @@ const inputGroupVariants = cva("group/input-group relative flex items-center bor
551
551
  widthVariant: "full"
552
552
  }
553
553
  });
554
- function Root$8({ className, size, disabled, widthVariant, ...props }) {
554
+ function Root$9({ className, size, disabled, widthVariant, ...props }) {
555
555
  return /* @__PURE__ */ jsx("div", {
556
556
  "data-slot": "input-group",
557
557
  role: "group",
@@ -692,18 +692,18 @@ var combobox_exports = /* @__PURE__ */ __export({
692
692
  List: () => List$2,
693
693
  LoadingIndicator: () => LoadingIndicator,
694
694
  MultiItem: () => MultiItem$1,
695
- Root: () => Root$7,
695
+ Root: () => Root$8,
696
696
  Search: () => Search,
697
697
  SearchableTrigger: () => SearchableTrigger,
698
698
  SearchableTriggerDropdownAddon: () => SearchableTriggerDropdownAddon,
699
- Trigger: () => Trigger$5,
699
+ Trigger: () => Trigger$6,
700
700
  Value: () => Value$2,
701
701
  useComboboxContext: () => useComboboxContext
702
702
  });
703
703
  const SINGLE_TEXT_CONTENT_CN = "px-4 py-2 text-ppx-sm min-h-11 flex items-center justify-center text-ppx-muted-foreground";
704
704
  const List$2 = Combobox.List;
705
705
  const ComboboxContext = React$1.createContext({});
706
- function Root$7({ children, ...props }) {
706
+ function Root$8({ children, ...props }) {
707
707
  const chipsTriggerRef = React$1.useRef(null);
708
708
  const searchableTriggerRef = React$1.useRef(null);
709
709
  const [isOpen, setIsOpen] = React$1.useState(false);
@@ -821,7 +821,7 @@ function LoadingIndicator(props) {
821
821
  }
822
822
  function SearchableTrigger(props) {
823
823
  const { invalid, disabled, searchableTriggerRef } = useComboboxContext();
824
- return /* @__PURE__ */ jsxs(Root$8, {
824
+ return /* @__PURE__ */ jsxs(Root$9, {
825
825
  ...props,
826
826
  disabled,
827
827
  ref: searchableTriggerRef,
@@ -860,7 +860,7 @@ function SearchableTriggerDropdownAddon() {
860
860
  ]
861
861
  });
862
862
  }
863
- function Trigger$5({ size, widthVariant, children, className, ...props }) {
863
+ function Trigger$6({ size, widthVariant, children, className, ...props }) {
864
864
  const { isLoading, invalid } = useComboboxContext();
865
865
  return /* @__PURE__ */ jsxs(Combobox.Trigger, {
866
866
  "aria-label": "Open popup",
@@ -970,15 +970,15 @@ var select_exports = /* @__PURE__ */ __export({
970
970
  List: () => List$1,
971
971
  MultiItem: () => MultiItem,
972
972
  MultiSelectedValue: () => MultiSelectedValue,
973
- Root: () => Root$6,
974
- Trigger: () => Trigger$4,
973
+ Root: () => Root$7,
974
+ Trigger: () => Trigger$5,
975
975
  Value: () => Value$1
976
976
  });
977
977
  const SelectContext = React$1.createContext({});
978
978
  function useSelectContext() {
979
979
  return React$1.useContext(SelectContext);
980
980
  }
981
- function Root$6({ children, invalid, ...props }) {
981
+ function Root$7({ children, invalid, ...props }) {
982
982
  const value = React$1.useMemo(() => ({ invalid }), [invalid]);
983
983
  return /* @__PURE__ */ jsx(SelectContext.Provider, {
984
984
  value,
@@ -1028,7 +1028,7 @@ function ItemIndicator(props) {
1028
1028
  children: /* @__PURE__ */ jsx(Select.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
1029
1029
  });
1030
1030
  }
1031
- function Trigger$4({ size, widthVariant, ...props }) {
1031
+ function Trigger$5({ size, widthVariant, ...props }) {
1032
1032
  const { invalid } = useSelectContext();
1033
1033
  return /* @__PURE__ */ jsxs(Select.Trigger, {
1034
1034
  "aria-label": "Open popup",
@@ -1086,12 +1086,12 @@ var menu_exports = /* @__PURE__ */ __export({
1086
1086
  Item: () => Item$5,
1087
1087
  RadioGroup: () => RadioGroup$1,
1088
1088
  RadioItem: () => RadioItem,
1089
- Root: () => Root$5,
1089
+ Root: () => Root$6,
1090
1090
  Separator: () => Separator$1,
1091
- Trigger: () => Trigger$3
1091
+ Trigger: () => Trigger$4
1092
1092
  });
1093
- const Root$5 = Menu.Root;
1094
- function Trigger$3({ className, children, size, widthVariant = "fit", ...props }) {
1093
+ const Root$6 = Menu.Root;
1094
+ function Trigger$4({ className, children, size, widthVariant = "fit", ...props }) {
1095
1095
  return /* @__PURE__ */ jsxs(Menu.Trigger, {
1096
1096
  className: cn(triggerVariants({
1097
1097
  size,
@@ -1157,7 +1157,7 @@ var progress_exports = /* @__PURE__ */ __export({
1157
1157
  BaseProgress: () => BaseProgress,
1158
1158
  Indicator: () => Indicator$1,
1159
1159
  Label: () => Label$1,
1160
- Root: () => Root$4,
1160
+ Root: () => Root$5,
1161
1161
  Track: () => Track,
1162
1162
  Value: () => Value
1163
1163
  });
@@ -1169,7 +1169,7 @@ const progressTrackVariants = cva("relative h-2 w-full overflow-hidden rounded-f
1169
1169
  } },
1170
1170
  defaultVariants: { size: "default" }
1171
1171
  });
1172
- const Root$4 = Progress.Root;
1172
+ const Root$5 = Progress.Root;
1173
1173
  function Track({ className, size, children, ...props }) {
1174
1174
  return /* @__PURE__ */ jsx(Progress.Track, {
1175
1175
  className: cn(progressTrackVariants({ size }), className),
@@ -1201,7 +1201,7 @@ const BaseProgress = Progress;
1201
1201
  //#region src/components/segmented-control.tsx
1202
1202
  var segmented_control_exports = /* @__PURE__ */ __export({
1203
1203
  Item: () => Item$4,
1204
- Root: () => Root$3
1204
+ Root: () => Root$4
1205
1205
  });
1206
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", {
1207
1207
  variants: {
@@ -1217,7 +1217,7 @@ const segmentedControlItemVariants = cva("relative flex items-center justify-cen
1217
1217
  size: "default"
1218
1218
  }
1219
1219
  });
1220
- function Root$3({ className, ...props }) {
1220
+ function Root$4({ className, ...props }) {
1221
1221
  return /* @__PURE__ */ jsx(RadioGroup, {
1222
1222
  "data-slot": "segmented-control",
1223
1223
  className: cn("p-1 inline-flex items-center rounded-full bg-ppx-neutral-3", className),
@@ -1242,8 +1242,8 @@ function Item$4({ children, className, variant, size, ...props }) {
1242
1242
  var tabs_exports = /* @__PURE__ */ __export({
1243
1243
  Content: () => Content$1,
1244
1244
  List: () => List,
1245
- Root: () => Root$2,
1246
- Trigger: () => Trigger$2
1245
+ Root: () => Root$3,
1246
+ Trigger: () => Trigger$3
1247
1247
  });
1248
1248
  const TabsContext = React$1.createContext(null);
1249
1249
  const useTabs = () => {
@@ -1251,7 +1251,7 @@ const useTabs = () => {
1251
1251
  if (!context) throw new Error("useTabs must be used within a Tabs");
1252
1252
  return context;
1253
1253
  };
1254
- function Root$2({ variant = "underline", className, ...props }) {
1254
+ function Root$3({ variant = "underline", className, ...props }) {
1255
1255
  return /* @__PURE__ */ jsx(TabsContext.Provider, {
1256
1256
  value: { variant },
1257
1257
  children: /* @__PURE__ */ jsx(Tabs.Root, {
@@ -1273,7 +1273,7 @@ function List({ className, children, ...props }) {
1273
1273
  ]
1274
1274
  });
1275
1275
  }
1276
- function Trigger$2({ className, ...props }) {
1276
+ function Trigger$3({ className, ...props }) {
1277
1277
  return /* @__PURE__ */ jsx(Tabs.Tab, {
1278
1278
  "data-slot": "tabs-trigger",
1279
1279
  className: cn("focus-visible:ring-ring/50 [&_svg:not([class*='size-'])] gap-1.5 px-2 py-1 text-sm font-medium z-[1] flex-1 items-center justify-center text-nowrap whitespace-nowrap text-ppx-neutral-18 not-data-selected:hover:text-ppx-neutral-12 focus-visible:ring-[3px] data-selected:text-ppx-primary-b-5 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
@@ -1302,8 +1302,8 @@ var tooltip_exports = /* @__PURE__ */ __export({
1302
1302
  BaseProvider: () => BaseProvider,
1303
1303
  BaseRoot: () => BaseRoot,
1304
1304
  Content: () => Content,
1305
- Root: () => Root$1,
1306
- Trigger: () => Trigger$1
1305
+ Root: () => Root$2,
1306
+ Trigger: () => Trigger$2
1307
1307
  });
1308
1308
  function TooltipProvider(props) {
1309
1309
  return /* @__PURE__ */ jsx(Tooltip.Provider, {
@@ -1329,7 +1329,7 @@ function TooltipArrow({ ...props }) {
1329
1329
  ...props
1330
1330
  });
1331
1331
  }
1332
- function Root$1({ ...props }) {
1332
+ function Root$2({ ...props }) {
1333
1333
  return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(Tooltip.Root, {
1334
1334
  "data-slot": "tooltip",
1335
1335
  ...props
@@ -1337,7 +1337,7 @@ function Root$1({ ...props }) {
1337
1337
  }
1338
1338
  const BaseRoot = Tooltip.Root;
1339
1339
  const BaseProvider = Tooltip.Provider;
1340
- function Trigger$1({ ...props }) {
1340
+ function Trigger$2({ ...props }) {
1341
1341
  return /* @__PURE__ */ jsx(Tooltip.Trigger, {
1342
1342
  "data-slot": "tooltip-trigger",
1343
1343
  ...props
@@ -1644,6 +1644,39 @@ function BreadcrumbSeparator({ children, className, ...props }) {
1644
1644
  });
1645
1645
  }
1646
1646
 
1647
+ //#endregion
1648
+ //#region src/components/collapsible.tsx
1649
+ var collapsible_exports = /* @__PURE__ */ __export({
1650
+ Panel: () => Panel,
1651
+ Root: () => Root$1,
1652
+ ToggleIcon: () => ToggleIcon,
1653
+ Trigger: () => Trigger$1
1654
+ });
1655
+ function Root$1({ className, ...props }) {
1656
+ return /* @__PURE__ */ jsx(Collapsible.Root, {
1657
+ "data-slot": "collapsible",
1658
+ className: cn("flex flex-col", className),
1659
+ ...props
1660
+ });
1661
+ }
1662
+ function Trigger$1(props) {
1663
+ return /* @__PURE__ */ jsx(Collapsible.Trigger, {
1664
+ "data-slot": "collapsible-trigger",
1665
+ ...props,
1666
+ className: cn("group flex items-center gap-2", props.className)
1667
+ });
1668
+ }
1669
+ function Panel({ className, ...props }) {
1670
+ return /* @__PURE__ */ jsx(Collapsible.Panel, {
1671
+ "data-slot": "collapsible-content",
1672
+ className: cn("flex h-[var(--collapsible-panel-height)] w-full flex-col overflow-hidden transition-all duration-150 ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 [&[hidden]:not([hidden='until-found'])]:hidden", className),
1673
+ ...props
1674
+ });
1675
+ }
1676
+ function ToggleIcon() {
1677
+ return /* @__PURE__ */ jsx(ChevronDownIcon, { className: "rotate-270 group-data-[panel-open]:rotate-360 transition-all ease-out" });
1678
+ }
1679
+
1647
1680
  //#endregion
1648
1681
  //#region src/components/calendar.tsx
1649
1682
  function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", formatters, components, ...props }) {
@@ -1869,9 +1902,9 @@ const replaceSizeInUrl = (url, size) => {
1869
1902
  return url.replace("/SIZE/", `/${newSize}/`);
1870
1903
  };
1871
1904
  function Avatar(props) {
1872
- return /* @__PURE__ */ jsxs(Root$1, {
1905
+ return /* @__PURE__ */ jsxs(Root$2, {
1873
1906
  disabled: props.hideTooltip,
1874
- children: [/* @__PURE__ */ jsx(Trigger$1, { render: (tooltipProps) => /* @__PURE__ */ jsx(AvatarImpl, {
1907
+ children: [/* @__PURE__ */ jsx(Trigger$2, { render: (tooltipProps) => /* @__PURE__ */ jsx(AvatarImpl, {
1875
1908
  ...props,
1876
1909
  avatarRootProps: tooltipProps
1877
1910
  }) }), /* @__PURE__ */ jsx(Content, { children: props.name })]
@@ -1916,7 +1949,7 @@ function AvatarGroup({ max = 4, avatars, className }) {
1916
1949
  return /* @__PURE__ */ jsx(BaseProvider, { children: /* @__PURE__ */ jsxs("div", {
1917
1950
  className: cn("flex items-center", className),
1918
1951
  "data-slot": "avatar-group",
1919
- children: [avatars.map((avatar, index) => /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsxs(BaseRoot, { children: [/* @__PURE__ */ jsx(Trigger$1, { render: (tooltipProps) => /* @__PURE__ */ jsx("div", {
1952
+ children: [avatars.map((avatar, index) => /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsxs(BaseRoot, { children: [/* @__PURE__ */ jsx(Trigger$2, { render: (tooltipProps) => /* @__PURE__ */ jsx("div", {
1920
1953
  className: "relative",
1921
1954
  style: {
1922
1955
  marginLeft: index > 0 ? `-${parseInt(avatar.size ?? "100px") * .25}px` : "0",
@@ -1933,9 +1966,9 @@ function AvatarGroup({ max = 4, avatars, className }) {
1933
1966
  marginLeft: `-${parseInt(avatars[0].size ?? "100px") * .25}px`,
1934
1967
  zIndex: 0
1935
1968
  },
1936
- children: /* @__PURE__ */ jsxs(Root$9, {
1969
+ children: /* @__PURE__ */ jsxs(Root$10, {
1937
1970
  openOnHover: true,
1938
- children: [/* @__PURE__ */ jsx(Trigger$6, { children: /* @__PURE__ */ jsxs("div", {
1971
+ children: [/* @__PURE__ */ jsx(Trigger$7, { children: /* @__PURE__ */ jsxs("div", {
1939
1972
  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"),
1940
1973
  style: {
1941
1974
  width: avatars[0].size ?? "100px",
@@ -2023,11 +2056,11 @@ function DatePicker({ triggerProps, placeholder = "Pick a date", format: format$
2023
2056
  calendarProps.onSelect(...args);
2024
2057
  !calendarProps.mode || calendarProps.mode === "single" && setOpen(false);
2025
2058
  };
2026
- return /* @__PURE__ */ jsxs(Root$9, {
2059
+ return /* @__PURE__ */ jsxs(Root$10, {
2027
2060
  open,
2028
2061
  onOpenChange: setOpen,
2029
2062
  ...popoverRootProps,
2030
- children: [/* @__PURE__ */ jsxs(Trigger$6, {
2063
+ children: [/* @__PURE__ */ jsxs(Trigger$7, {
2031
2064
  disabled: triggerProps?.disabled,
2032
2065
  className: cn(triggerVariants({
2033
2066
  size: triggerProps?.size,
@@ -2875,6 +2908,7 @@ var src_exports = /* @__PURE__ */ __export({
2875
2908
  Button: () => Button,
2876
2909
  Calendar: () => Calendar,
2877
2910
  Checkbox: () => Checkbox,
2911
+ Collapsible: () => collapsible_exports,
2878
2912
  Combobox: () => combobox_exports,
2879
2913
  DatePicker: () => DatePicker,
2880
2914
  Dialog: () => dialog_exports,
@@ -2906,5 +2940,5 @@ var src_exports = /* @__PURE__ */ __export({
2906
2940
  });
2907
2941
 
2908
2942
  //#endregion
2909
- export { Avatar, AvatarGroup, AvatarImpl, block_checkbox_group_exports as BlockCheckboxGroup, block_radio_group_exports as BlockRadioGroup, breadcrumbs_exports as Breadcrumbs, Button, Calendar, Checkbox, 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 };
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 };
2910
2944
  //# sourceMappingURL=index.js.map