@partrunner-ai/ui 2.0.1 → 2.2.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.cjs CHANGED
@@ -4040,6 +4040,7 @@ var TableRoot = react.forwardRef(function TableRoot2({
4040
4040
  density = "default",
4041
4041
  stickyFirstColumn = false,
4042
4042
  maxHeight,
4043
+ bare = false,
4043
4044
  className,
4044
4045
  children,
4045
4046
  "aria-label": ariaLabel,
@@ -4074,6 +4075,7 @@ var TableRoot = react.forwardRef(function TableRoot2({
4074
4075
  className: classes(
4075
4076
  "pr-table__scroll",
4076
4077
  "pr-table__scroll--compound",
4078
+ bare && "pr-table__scroll--bare",
4077
4079
  maxHeight !== void 0 && "pr-table__scroll--capped",
4078
4080
  containerClassName
4079
4081
  ),
@@ -4783,6 +4785,7 @@ function Popover({
4783
4785
  defaultOpen,
4784
4786
  onOpenChange,
4785
4787
  maxHeight,
4788
+ minimumSpace,
4786
4789
  matchTriggerWidth = false
4787
4790
  }) {
4788
4791
  const align = react.useMemo(() => alignFromChildren2(children), [children]);
@@ -4792,7 +4795,8 @@ function Popover({
4792
4795
  onOpenChange,
4793
4796
  align: ANCHOR_ALIGN2[align],
4794
4797
  matchTriggerWidth,
4795
- maxHeight
4798
+ maxHeight,
4799
+ minimumSpace
4796
4800
  });
4797
4801
  const close = react.useCallback(
4798
4802
  (options) => {
@@ -5549,6 +5553,787 @@ function Tooltip({
5549
5553
  ) : null
5550
5554
  ] });
5551
5555
  }
5556
+ var PageHeader = react.forwardRef(
5557
+ function PageHeader2({ eyebrow, title, subtitle, actions, className, ...rest }, ref) {
5558
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5559
+ "header",
5560
+ {
5561
+ ref,
5562
+ ...rest,
5563
+ className: ["pr-page-header", className].filter(Boolean).join(" "),
5564
+ children: [
5565
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pr-page-header__text", children: [
5566
+ eyebrow != null && eyebrow !== false ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pr-page-header__eyebrow", children: eyebrow }) : null,
5567
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "pr-page-header__title", children: title }),
5568
+ subtitle != null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pr-page-header__subtitle", children: subtitle }) : null
5569
+ ] }),
5570
+ actions != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pr-page-header__actions", children: actions }) : null
5571
+ ]
5572
+ }
5573
+ );
5574
+ }
5575
+ );
5576
+ var StatTile = react.forwardRef(
5577
+ function StatTile2({ label, value, hint, icon: Icon, tone = "neutral", trendValue, footer, className, ...rest }, ref) {
5578
+ const showTrend = typeof trendValue === "number" && Number.isFinite(trendValue);
5579
+ const trendUp = showTrend && trendValue >= 0;
5580
+ const TrendIcon = trendUp ? lucideReact.TrendingUp : lucideReact.TrendingDown;
5581
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5582
+ "div",
5583
+ {
5584
+ ref,
5585
+ ...rest,
5586
+ className: [
5587
+ "pr-stat-tile",
5588
+ `pr-stat-tile--${tone}`,
5589
+ className
5590
+ ].filter(Boolean).join(" "),
5591
+ children: [
5592
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pr-stat-tile__body", children: [
5593
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pr-stat-tile__main", children: [
5594
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pr-stat-tile__label", children: label }),
5595
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pr-stat-tile__value", children: value }),
5596
+ hint != null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pr-stat-tile__hint", children: hint }) : null
5597
+ ] }),
5598
+ Icon ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pr-stat-tile__icon", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { "aria-hidden": true, strokeWidth: 2.25 }) }) : null
5599
+ ] }),
5600
+ showTrend || footer != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pr-stat-tile__meta", children: [
5601
+ showTrend ? /* @__PURE__ */ jsxRuntime.jsxs(
5602
+ "span",
5603
+ {
5604
+ className: [
5605
+ "pr-stat-tile__trend",
5606
+ trendUp ? "pr-stat-tile__trend--up" : "pr-stat-tile__trend--down"
5607
+ ].filter(Boolean).join(" "),
5608
+ children: [
5609
+ /* @__PURE__ */ jsxRuntime.jsx(TrendIcon, { "aria-hidden": true, strokeWidth: 2.5 }),
5610
+ trendUp ? "+" : "",
5611
+ trendValue,
5612
+ "%"
5613
+ ]
5614
+ }
5615
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
5616
+ footer != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pr-stat-tile__footer", children: footer }) : null
5617
+ ] }) : null
5618
+ ]
5619
+ }
5620
+ );
5621
+ }
5622
+ );
5623
+ var Toolbar = react.forwardRef(function Toolbar2({ className, ...rest }, ref) {
5624
+ return /* @__PURE__ */ jsxRuntime.jsx(
5625
+ "div",
5626
+ {
5627
+ ref,
5628
+ ...rest,
5629
+ className: ["pr-toolbar", className].filter(Boolean).join(" ")
5630
+ }
5631
+ );
5632
+ });
5633
+ var ToolbarGroup = react.forwardRef(function ToolbarGroup2({ className, ...rest }, ref) {
5634
+ return /* @__PURE__ */ jsxRuntime.jsx(
5635
+ "div",
5636
+ {
5637
+ ref,
5638
+ ...rest,
5639
+ "data-slot": "toolbar-group",
5640
+ className: ["pr-toolbar__group", className].filter(Boolean).join(" ")
5641
+ }
5642
+ );
5643
+ });
5644
+ var ToolbarSpacer = react.forwardRef(
5645
+ function ToolbarSpacer2({ className, ...rest }, ref) {
5646
+ return /* @__PURE__ */ jsxRuntime.jsx(
5647
+ "div",
5648
+ {
5649
+ ref,
5650
+ ...rest,
5651
+ "aria-hidden": true,
5652
+ "data-slot": "toolbar-spacer",
5653
+ className: ["pr-toolbar__spacer", className].filter(Boolean).join(" ")
5654
+ }
5655
+ );
5656
+ }
5657
+ );
5658
+ var IconButton = react.forwardRef(
5659
+ function IconButton2({
5660
+ label,
5661
+ icon,
5662
+ size = "md",
5663
+ variant = "default",
5664
+ compact = false,
5665
+ className,
5666
+ title,
5667
+ type = "button",
5668
+ ...rest
5669
+ }, ref) {
5670
+ return /* @__PURE__ */ jsxRuntime.jsx(
5671
+ "button",
5672
+ {
5673
+ ref,
5674
+ ...rest,
5675
+ type,
5676
+ "aria-label": label,
5677
+ title: title ?? label,
5678
+ className: [
5679
+ "pr-icon-btn",
5680
+ `pr-icon-btn--${size}`,
5681
+ `pr-icon-btn--${variant}`,
5682
+ compact ? "pr-icon-btn--compact" : null,
5683
+ className
5684
+ ].filter(Boolean).join(" "),
5685
+ children: icon
5686
+ }
5687
+ );
5688
+ }
5689
+ );
5690
+ function ConfirmDialog({
5691
+ open,
5692
+ onOpenChange,
5693
+ title,
5694
+ description,
5695
+ confirmLabel = "Confirmar",
5696
+ cancelLabel = "Cancelar",
5697
+ onConfirm,
5698
+ loading = false,
5699
+ destructive = false,
5700
+ icon: Icon,
5701
+ size = "sm"
5702
+ }) {
5703
+ return /* @__PURE__ */ jsxRuntime.jsx(
5704
+ Dialog,
5705
+ {
5706
+ open,
5707
+ onClose: () => onOpenChange(false),
5708
+ size,
5709
+ title,
5710
+ description,
5711
+ dismissible: !destructive,
5712
+ footer: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pr-confirm-dialog__actions", children: [
5713
+ /* @__PURE__ */ jsxRuntime.jsx(
5714
+ Button,
5715
+ {
5716
+ variant: "ghost",
5717
+ onClick: () => onOpenChange(false),
5718
+ disabled: loading,
5719
+ children: cancelLabel
5720
+ }
5721
+ ),
5722
+ /* @__PURE__ */ jsxRuntime.jsx(
5723
+ Button,
5724
+ {
5725
+ variant: destructive ? "danger" : "primary",
5726
+ onClick: onConfirm,
5727
+ loading,
5728
+ children: confirmLabel
5729
+ }
5730
+ )
5731
+ ] }),
5732
+ children: Icon ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pr-confirm-dialog__icon-row", children: /* @__PURE__ */ jsxRuntime.jsx(
5733
+ "span",
5734
+ {
5735
+ className: [
5736
+ "pr-confirm-dialog__icon",
5737
+ destructive ? "pr-confirm-dialog__icon--danger" : "pr-confirm-dialog__icon--accent"
5738
+ ].filter(Boolean).join(" "),
5739
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { "aria-hidden": true, strokeWidth: 2.25 })
5740
+ }
5741
+ ) }) : null
5742
+ }
5743
+ );
5744
+ }
5745
+
5746
+ // src/tone.ts
5747
+ var TINT_TONES = [
5748
+ "yellow",
5749
+ "blue",
5750
+ "amber",
5751
+ "purple",
5752
+ "green",
5753
+ "rose"
5754
+ ];
5755
+ function toneFromString(seed, palette = TINT_TONES) {
5756
+ if (palette.length === 0) return "blue";
5757
+ let hash = 2166136261;
5758
+ for (let index = 0; index < seed.length; index += 1) {
5759
+ hash ^= seed.charCodeAt(index);
5760
+ hash = Math.imul(hash, 16777619) >>> 0;
5761
+ }
5762
+ return palette[hash % palette.length] ?? palette[0];
5763
+ }
5764
+ var StatusDot = react.forwardRef(function StatusDot2({ tone, size = "sm", label, className, ...rest }, ref) {
5765
+ return /* @__PURE__ */ jsxRuntime.jsx(
5766
+ "span",
5767
+ {
5768
+ ref,
5769
+ ...rest,
5770
+ role: label ? "img" : void 0,
5771
+ "aria-label": label,
5772
+ "aria-hidden": label ? void 0 : true,
5773
+ "data-slot": "status-dot",
5774
+ className: ["pr-status-dot", `pr-status-dot--${tone}`, `pr-status-dot--${size}`, className].filter(Boolean).join(" ")
5775
+ }
5776
+ );
5777
+ });
5778
+ var ICON_PX = { sm: 14, md: 18, lg: 22 };
5779
+ var IconTile = react.forwardRef(function IconTile2({ icon: Icon, tone = "neutral", size = "md", className, ...rest }, ref) {
5780
+ return /* @__PURE__ */ jsxRuntime.jsx(
5781
+ "span",
5782
+ {
5783
+ ref,
5784
+ ...rest,
5785
+ "aria-hidden": true,
5786
+ "data-slot": "icon-tile",
5787
+ className: ["pr-icon-tile", `pr-icon-tile--${tone}`, `pr-icon-tile--${size}`, className].filter(Boolean).join(" "),
5788
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: ICON_PX[size], strokeWidth: 2, "aria-hidden": true })
5789
+ }
5790
+ );
5791
+ });
5792
+ function avatarInitials(name, locale) {
5793
+ const words = name.trim().split(/\s+/).filter(Boolean).slice(0, 2);
5794
+ return words.map((word) => {
5795
+ const first = Array.from(word)[0] ?? "";
5796
+ return locale ? first.toLocaleUpperCase(locale) : first.toLocaleUpperCase();
5797
+ }).join("");
5798
+ }
5799
+ var Avatar = react.forwardRef(function Avatar2({ name, src, size = "sm", tone, decorative = false, locale, className, ...rest }, ref) {
5800
+ const [imageFailed, setImageFailed] = react.useState(false);
5801
+ react.useEffect(() => {
5802
+ setImageFailed(false);
5803
+ }, [src]);
5804
+ const resolvedTone = tone ?? toneFromString(name);
5805
+ const showImage = Boolean(src) && !imageFailed;
5806
+ return /* @__PURE__ */ jsxRuntime.jsx(
5807
+ "span",
5808
+ {
5809
+ ref,
5810
+ ...rest,
5811
+ role: decorative ? void 0 : "img",
5812
+ "aria-label": decorative ? void 0 : name,
5813
+ "aria-hidden": decorative ? true : void 0,
5814
+ "data-slot": "avatar",
5815
+ className: ["pr-avatar", `pr-avatar--${resolvedTone}`, `pr-avatar--${size}`, className].filter(Boolean).join(" "),
5816
+ children: showImage ? /* @__PURE__ */ jsxRuntime.jsx(
5817
+ "img",
5818
+ {
5819
+ className: "pr-avatar__image",
5820
+ src,
5821
+ alt: "",
5822
+ onError: () => setImageFailed(true)
5823
+ }
5824
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pr-avatar__initials", "aria-hidden": true, children: avatarInitials(name, locale) })
5825
+ }
5826
+ );
5827
+ });
5828
+ var Page = react.forwardRef(function Page2({ width = "default", className, ...rest }, ref) {
5829
+ return /* @__PURE__ */ jsxRuntime.jsx(
5830
+ "div",
5831
+ {
5832
+ ref,
5833
+ ...rest,
5834
+ "data-slot": "page",
5835
+ className: ["pr-page", width === "default" ? null : `pr-page--${width}`, className].filter(Boolean).join(" ")
5836
+ }
5837
+ );
5838
+ });
5839
+ var SectionHeading = react.forwardRef(
5840
+ function SectionHeading2({ eyebrow, title, description, actions, headingLevel = 2, className, ...rest }, ref) {
5841
+ const Heading = headingLevel === 3 ? "h3" : "h2";
5842
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5843
+ "header",
5844
+ {
5845
+ ref,
5846
+ ...rest,
5847
+ "data-slot": "section-heading",
5848
+ className: ["pr-section-heading", className].filter(Boolean).join(" "),
5849
+ children: [
5850
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pr-section-heading__text", children: [
5851
+ eyebrow != null && eyebrow !== false ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pr-section-heading__eyebrow", children: eyebrow }) : null,
5852
+ /* @__PURE__ */ jsxRuntime.jsx(Heading, { className: "pr-section-heading__title", children: title }),
5853
+ description != null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pr-section-heading__description", children: description }) : null
5854
+ ] }),
5855
+ actions != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pr-section-heading__actions", children: actions }) : null
5856
+ ]
5857
+ }
5858
+ );
5859
+ }
5860
+ );
5861
+ var StatTileGrid = react.forwardRef(function StatTileGrid2({ columns = 4, className, ...rest }, ref) {
5862
+ return /* @__PURE__ */ jsxRuntime.jsx(
5863
+ "div",
5864
+ {
5865
+ ref,
5866
+ ...rest,
5867
+ "data-slot": "stat-tile-grid",
5868
+ className: ["pr-stat-grid", `pr-stat-grid--cols-${columns}`, className].filter(Boolean).join(" ")
5869
+ }
5870
+ );
5871
+ });
5872
+ var SearchField = react.forwardRef(function SearchField2({ inputSize = "sm", fullWidth = false, containerClassName, ...rest }, ref) {
5873
+ return /* @__PURE__ */ jsxRuntime.jsx(
5874
+ Input,
5875
+ {
5876
+ ref,
5877
+ type: "search",
5878
+ inputSize,
5879
+ leading: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { size: 14, "aria-hidden": true }),
5880
+ fullWidth,
5881
+ containerClassName: [
5882
+ "pr-search-field",
5883
+ fullWidth ? "pr-search-field--block" : null,
5884
+ containerClassName
5885
+ ].filter(Boolean).join(" "),
5886
+ ...rest
5887
+ }
5888
+ );
5889
+ });
5890
+ var FilterChip = react.forwardRef(function FilterChip2({
5891
+ active = false,
5892
+ count,
5893
+ tone = "neutral",
5894
+ dot = false,
5895
+ icon: Icon,
5896
+ type = "button",
5897
+ className,
5898
+ children,
5899
+ ...rest
5900
+ }, ref) {
5901
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5902
+ "button",
5903
+ {
5904
+ ref,
5905
+ ...rest,
5906
+ type,
5907
+ "aria-pressed": active,
5908
+ "data-slot": "filter-chip",
5909
+ "data-state": active ? "active" : "inactive",
5910
+ className: ["pr-filter-chip", className].filter(Boolean).join(" "),
5911
+ children: [
5912
+ dot ? /* @__PURE__ */ jsxRuntime.jsx(StatusDot, { tone, className: "pr-filter-chip__dot" }) : Icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 14, "aria-hidden": true, className: "pr-filter-chip__icon" }) : null,
5913
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pr-filter-chip__label", children }),
5914
+ typeof count === "number" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pr-filter-chip__count", children: count }) : null
5915
+ ]
5916
+ }
5917
+ );
5918
+ });
5919
+ var FilterChipRow = react.forwardRef(function FilterChipRow2({ className, ...rest }, ref) {
5920
+ return /* @__PURE__ */ jsxRuntime.jsx(
5921
+ "div",
5922
+ {
5923
+ ref,
5924
+ role: "group",
5925
+ ...rest,
5926
+ "data-slot": "filter-chip-row",
5927
+ className: ["pr-filter-chip-row", className].filter(Boolean).join(" ")
5928
+ }
5929
+ );
5930
+ });
5931
+ function SegmentedControl({
5932
+ value,
5933
+ onChange,
5934
+ options,
5935
+ size = "md",
5936
+ fullWidth = false,
5937
+ className,
5938
+ id,
5939
+ dir = "ltr",
5940
+ "aria-label": ariaLabel,
5941
+ "aria-labelledby": ariaLabelledBy
5942
+ }) {
5943
+ const generatedId = react.useId();
5944
+ const groupId = id ?? generatedId;
5945
+ const refs = react.useRef(/* @__PURE__ */ new Map());
5946
+ const enabled = options.filter((option) => !option.disabled);
5947
+ const checked = enabled.find((option) => option.value === value) ?? null;
5948
+ const focusable = checked ?? enabled[0] ?? null;
5949
+ const allDisabled = enabled.length === 0;
5950
+ const select = (option) => {
5951
+ refs.current.get(option.value)?.focus();
5952
+ if (option.value !== value) onChange(option.value);
5953
+ };
5954
+ const step = (from, delta) => {
5955
+ if (enabled.length === 0) return;
5956
+ const index = enabled.findIndex((option) => option.value === from);
5957
+ const next = enabled[(index + delta + enabled.length) % enabled.length];
5958
+ if (next) select(next);
5959
+ };
5960
+ const onKeyDown = (event, option) => {
5961
+ const forward = dir === "rtl" ? "ArrowLeft" : "ArrowRight";
5962
+ const backward = dir === "rtl" ? "ArrowRight" : "ArrowLeft";
5963
+ if (event.key === forward || event.key === "ArrowDown") {
5964
+ event.preventDefault();
5965
+ step(option.value, 1);
5966
+ } else if (event.key === backward || event.key === "ArrowUp") {
5967
+ event.preventDefault();
5968
+ step(option.value, -1);
5969
+ } else if (event.key === "Home") {
5970
+ event.preventDefault();
5971
+ if (enabled[0]) select(enabled[0]);
5972
+ } else if (event.key === "End") {
5973
+ event.preventDefault();
5974
+ const last = enabled[enabled.length - 1];
5975
+ if (last) select(last);
5976
+ }
5977
+ };
5978
+ return /* @__PURE__ */ jsxRuntime.jsx(
5979
+ "div",
5980
+ {
5981
+ id: groupId,
5982
+ role: "radiogroup",
5983
+ "aria-label": ariaLabel,
5984
+ "aria-labelledby": ariaLabelledBy,
5985
+ "aria-disabled": allDisabled || void 0,
5986
+ dir,
5987
+ "data-slot": "segmented-control",
5988
+ className: [
5989
+ "pr-segmented",
5990
+ `pr-segmented--${size}`,
5991
+ fullWidth ? "pr-segmented--block" : null,
5992
+ className
5993
+ ].filter(Boolean).join(" "),
5994
+ children: options.map((option) => {
5995
+ const isChecked = checked?.value === option.value;
5996
+ const Icon = option.icon;
5997
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5998
+ "button",
5999
+ {
6000
+ ref: (node) => {
6001
+ if (node) refs.current.set(option.value, node);
6002
+ else refs.current.delete(option.value);
6003
+ },
6004
+ id: `${groupId}-${option.value}`,
6005
+ type: "button",
6006
+ role: "radio",
6007
+ "aria-checked": isChecked,
6008
+ tabIndex: !option.disabled && focusable?.value === option.value ? 0 : -1,
6009
+ disabled: option.disabled,
6010
+ "data-slot": "segmented-option",
6011
+ "data-state": isChecked ? "checked" : "unchecked",
6012
+ className: "pr-segmented__option",
6013
+ onClick: () => {
6014
+ if (!option.disabled) select(option);
6015
+ },
6016
+ onKeyDown: (event) => onKeyDown(event, option),
6017
+ children: [
6018
+ Icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 14, "aria-hidden": true, className: "pr-segmented__icon" }) : null,
6019
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pr-segmented__label", children: option.label }),
6020
+ typeof option.count === "number" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pr-segmented__count", children: option.count }) : null
6021
+ ]
6022
+ },
6023
+ option.value
6024
+ );
6025
+ })
6026
+ }
6027
+ );
6028
+ }
6029
+ var TableFrame = react.forwardRef(function TableFrame2({
6030
+ title,
6031
+ description,
6032
+ count,
6033
+ countLabel,
6034
+ icon: Icon,
6035
+ actions,
6036
+ footer,
6037
+ shadow = true,
6038
+ className,
6039
+ children,
6040
+ ...rest
6041
+ }, ref) {
6042
+ const hasHeader = title != null || description != null || actions != null;
6043
+ const showCount = title != null && typeof count === "number";
6044
+ const heading = hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pr-table-frame__title", children: [
6045
+ Icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 16, "aria-hidden": true, className: "pr-table-frame__icon" }) : null,
6046
+ title != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pr-table-frame__title-text", children: title }) : null,
6047
+ showCount ? /* @__PURE__ */ jsxRuntime.jsx(
6048
+ Badge,
6049
+ {
6050
+ tone: "neutral",
6051
+ size: "sm",
6052
+ className: "pr-table-frame__count",
6053
+ role: countLabel ? "img" : void 0,
6054
+ "aria-label": countLabel ? countLabel(count) : void 0,
6055
+ children: count
6056
+ }
6057
+ ) : null
6058
+ ] }) : null;
6059
+ return /* @__PURE__ */ jsxRuntime.jsxs(
6060
+ Card,
6061
+ {
6062
+ ref,
6063
+ padding: "md",
6064
+ shadow,
6065
+ ...rest,
6066
+ "data-slot": "table-frame",
6067
+ className: ["pr-table-frame", className].filter(Boolean).join(" "),
6068
+ children: [
6069
+ hasHeader ? /* @__PURE__ */ jsxRuntime.jsx(
6070
+ CardHeader,
6071
+ {
6072
+ className: "pr-table-frame__header",
6073
+ title: title != null || Icon || showCount ? heading : void 0,
6074
+ description,
6075
+ actions
6076
+ }
6077
+ ) : null,
6078
+ /* @__PURE__ */ jsxRuntime.jsx(CardContent, { bleed: true, className: "pr-table-frame__body", children }),
6079
+ footer != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pr-table-frame__footer", children: footer }) : null
6080
+ ]
6081
+ }
6082
+ );
6083
+ });
6084
+ var TableSkeleton = react.forwardRef(function TableSkeleton2({ rows = 6, columns = 5, label, className, ...rest }, ref) {
6085
+ return /* @__PURE__ */ jsxRuntime.jsxs(
6086
+ "div",
6087
+ {
6088
+ ref,
6089
+ role: "status",
6090
+ "aria-live": "polite",
6091
+ "aria-busy": "true",
6092
+ ...rest,
6093
+ "data-slot": "table-skeleton",
6094
+ className: ["pr-table-skeleton", className].filter(Boolean).join(" "),
6095
+ children: [
6096
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pr-visually-hidden", children: label }),
6097
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pr-table__skeleton", "aria-hidden": true, children: Array.from({ length: rows }, (_, row) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pr-table__skeleton-row", children: Array.from({ length: columns }, (_2, column) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pr-table__skeleton-cell" }, column)) }, row)) })
6098
+ ]
6099
+ }
6100
+ );
6101
+ });
6102
+ var EMPTY_DATE_RANGE = { from: "", to: "" };
6103
+ function isSameDateRange(a, b) {
6104
+ return a.from === b.from && a.to === b.to;
6105
+ }
6106
+ function isValidDateRange(value, limits = {}) {
6107
+ const from = value.from ? parseCalendarDate(value.from) : null;
6108
+ const to = value.to ? parseCalendarDate(value.to) : null;
6109
+ if (value.from && !from) return false;
6110
+ if (value.to && !to) return false;
6111
+ if (to && !from) return false;
6112
+ if (from && to && from.getTime() > to.getTime()) return false;
6113
+ const min = limits.min ? parseCalendarDate(limits.min) : null;
6114
+ const max = limits.max ? parseCalendarDate(limits.max) : null;
6115
+ for (const bound of [from, to]) {
6116
+ if (!bound) continue;
6117
+ if (min && bound.getTime() < min.getTime()) return false;
6118
+ if (max && bound.getTime() > max.getTime()) return false;
6119
+ }
6120
+ return true;
6121
+ }
6122
+ var DEFAULT_LOCALE = "es-MX";
6123
+ function formatDateRange(range, locale, labels) {
6124
+ if (!isValidDateRange(range)) return labels.allTime;
6125
+ const from = range.from ? parseCalendarDate(range.from) : null;
6126
+ const to = range.to ? parseCalendarDate(range.to) : null;
6127
+ if (!from) return labels.allTime;
6128
+ const resolved = locale ?? DEFAULT_LOCALE;
6129
+ const dayMonth = new Intl.DateTimeFormat(resolved, {
6130
+ day: "numeric",
6131
+ month: "short",
6132
+ timeZone: "UTC"
6133
+ });
6134
+ const dayMonthYear = new Intl.DateTimeFormat(resolved, {
6135
+ day: "numeric",
6136
+ month: "short",
6137
+ year: "numeric",
6138
+ timeZone: "UTC"
6139
+ });
6140
+ if (!to) return `${labels.from} ${dayMonthYear.format(from)}`;
6141
+ const sameYear = from.getUTCFullYear() === to.getUTCFullYear();
6142
+ return `${(sameYear ? dayMonth : dayMonthYear).format(from)} \u2013 ${dayMonthYear.format(to)}`;
6143
+ }
6144
+ function toCalendarRange(value) {
6145
+ return { start: value.from || null, end: value.to || null };
6146
+ }
6147
+ function fromCalendarRange(range) {
6148
+ return { from: range.start ?? "", to: range.end ?? "" };
6149
+ }
6150
+ function DateRangeFilter({
6151
+ value,
6152
+ onChange,
6153
+ presets,
6154
+ labels,
6155
+ locale,
6156
+ size = "sm",
6157
+ min,
6158
+ max,
6159
+ calendar,
6160
+ className,
6161
+ id: providedId,
6162
+ "aria-label": ariaLabel
6163
+ }) {
6164
+ const generatedId = react.useId();
6165
+ const id = providedId ?? generatedId;
6166
+ const triggerRef = react.useRef(null);
6167
+ const [open, setOpen] = react.useState(false);
6168
+ const [draft, setDraft] = react.useState(value);
6169
+ const limits = react.useMemo(() => ({ min, max }), [min, max]);
6170
+ const valueValid = isValidDateRange(value, limits);
6171
+ const isEmpty = valueValid && !value.from && !value.to;
6172
+ const presetStates = react.useMemo(
6173
+ () => presets.map((preset) => ({
6174
+ preset,
6175
+ valid: isValidDateRange(preset.range, limits)
6176
+ })),
6177
+ [presets, limits]
6178
+ );
6179
+ const activePreset = react.useMemo(
6180
+ () => valueValid ? presetStates.find(({ preset, valid }) => valid && isSameDateRange(preset.range, value))?.preset : void 0,
6181
+ [presetStates, value, valueValid]
6182
+ );
6183
+ const triggerLabel = !valueValid ? labels.allTime : isEmpty ? labels.allTime : activePreset?.label ?? formatDateRange(value, locale, labels);
6184
+ const handleOpenChange = react.useCallback(
6185
+ (next) => {
6186
+ if (next) setDraft(isValidDateRange(value, limits) ? value : EMPTY_DATE_RANGE);
6187
+ setOpen(next);
6188
+ },
6189
+ [limits, value]
6190
+ );
6191
+ const commit = (next) => {
6192
+ if (!isValidDateRange(next, limits)) return;
6193
+ if (!isSameDateRange(next, value)) onChange(next);
6194
+ setOpen(false);
6195
+ queueMicrotask(() => triggerRef.current?.focus());
6196
+ };
6197
+ const draftValid = isValidDateRange(draft, limits);
6198
+ const draftFrom = draft.from ? parseCalendarDate(draft.from) : null;
6199
+ const draftTo = draft.to ? parseCalendarDate(draft.to) : null;
6200
+ const resolvedLocale = locale ?? DEFAULT_LOCALE;
6201
+ const boundFormat = new Intl.DateTimeFormat(resolvedLocale, {
6202
+ day: "numeric",
6203
+ month: "short",
6204
+ year: "numeric",
6205
+ timeZone: "UTC"
6206
+ });
6207
+ return /* @__PURE__ */ jsxRuntime.jsx(
6208
+ "div",
6209
+ {
6210
+ className: ["pr-date-range", className].filter(Boolean).join(" "),
6211
+ "data-slot": "date-range-filter",
6212
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: handleOpenChange, maxHeight: 520, minimumSpace: 400, children: [
6213
+ /* @__PURE__ */ jsxRuntime.jsxs(
6214
+ PopoverTrigger,
6215
+ {
6216
+ ref: triggerRef,
6217
+ id,
6218
+ "aria-label": ariaLabel,
6219
+ "data-state": open ? "open" : "closed",
6220
+ "data-active": valueValid && !isEmpty ? "" : void 0,
6221
+ "data-invalid": valueValid ? void 0 : "",
6222
+ className: [
6223
+ "pr-date-range__trigger",
6224
+ `pr-date-range__trigger--${size}`,
6225
+ valueValid && !isEmpty ? "pr-date-range__trigger--active" : null,
6226
+ open ? "pr-date-range__trigger--open" : null
6227
+ ].filter(Boolean).join(" "),
6228
+ children: [
6229
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarDays, { size: 14, "aria-hidden": true, className: "pr-date-range__icon" }),
6230
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pr-date-range__value", children: triggerLabel }),
6231
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { size: 14, "aria-hidden": true, className: "pr-date-range__chevron" })
6232
+ ]
6233
+ }
6234
+ ),
6235
+ /* @__PURE__ */ jsxRuntime.jsxs(
6236
+ PopoverContent,
6237
+ {
6238
+ align: "start",
6239
+ padding: "none",
6240
+ "aria-label": labels.dialog,
6241
+ className: "pr-date-range__content",
6242
+ children: [
6243
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "group", "aria-label": ariaLabel, className: "pr-date-range__presets", children: [
6244
+ /* @__PURE__ */ jsxRuntime.jsx(PresetOption, { active: isEmpty, onSelect: () => commit(EMPTY_DATE_RANGE), children: labels.allTime }),
6245
+ presetStates.map(({ preset, valid }) => /* @__PURE__ */ jsxRuntime.jsx(
6246
+ PresetOption,
6247
+ {
6248
+ active: activePreset?.id === preset.id,
6249
+ disabled: !valid,
6250
+ onSelect: () => commit(preset.range),
6251
+ children: preset.label
6252
+ },
6253
+ preset.id
6254
+ ))
6255
+ ] }),
6256
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pr-date-range__custom", children: [
6257
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pr-date-range__custom-title", id: `${id}-custom`, children: labels.custom }),
6258
+ /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "pr-date-range__bounds", children: [
6259
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pr-date-range__bound", children: [
6260
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { children: labels.from }),
6261
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { children: draftFrom ? boundFormat.format(draftFrom) : "\u2014" })
6262
+ ] }),
6263
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pr-date-range__bound", children: [
6264
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { children: labels.to }),
6265
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { children: draftTo ? boundFormat.format(draftTo) : "\u2014" })
6266
+ ] })
6267
+ ] }),
6268
+ /* @__PURE__ */ jsxRuntime.jsx(
6269
+ Calendar,
6270
+ {
6271
+ mode: "range",
6272
+ value: toCalendarRange(draft),
6273
+ onValueChange: (next) => setDraft(fromCalendarRange(next)),
6274
+ locale: resolvedLocale,
6275
+ min,
6276
+ max,
6277
+ "aria-labelledby": `${id}-custom`,
6278
+ className: "pr-date-range__calendar",
6279
+ ...calendar
6280
+ }
6281
+ ),
6282
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pr-date-range__actions", children: [
6283
+ /* @__PURE__ */ jsxRuntime.jsx(
6284
+ Button,
6285
+ {
6286
+ type: "button",
6287
+ variant: "ghost",
6288
+ size: "sm",
6289
+ disabled: !draft.from && !draft.to,
6290
+ onClick: () => setDraft(EMPTY_DATE_RANGE),
6291
+ children: labels.clear
6292
+ }
6293
+ ),
6294
+ /* @__PURE__ */ jsxRuntime.jsx(
6295
+ Button,
6296
+ {
6297
+ type: "button",
6298
+ variant: "secondary",
6299
+ size: "sm",
6300
+ disabled: !draftValid,
6301
+ onClick: () => commit(draft),
6302
+ children: labels.apply
6303
+ }
6304
+ )
6305
+ ] })
6306
+ ] })
6307
+ ]
6308
+ }
6309
+ )
6310
+ ] })
6311
+ }
6312
+ );
6313
+ }
6314
+ function PresetOption({
6315
+ active,
6316
+ disabled = false,
6317
+ onSelect,
6318
+ children
6319
+ }) {
6320
+ return /* @__PURE__ */ jsxRuntime.jsxs(
6321
+ "button",
6322
+ {
6323
+ type: "button",
6324
+ "aria-pressed": active,
6325
+ "aria-disabled": disabled || void 0,
6326
+ disabled,
6327
+ "data-state": active ? "active" : "inactive",
6328
+ className: "pr-date-range__preset",
6329
+ onClick: disabled ? void 0 : onSelect,
6330
+ children: [
6331
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pr-date-range__preset-label", children }),
6332
+ active ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: 14, "aria-hidden": true, className: "pr-date-range__check" }) : null
6333
+ ]
6334
+ }
6335
+ );
6336
+ }
5552
6337
 
5553
6338
  exports.AlertDialogAction = AlertDialogAction;
5554
6339
  exports.AlertDialogCancel = AlertDialogCancel;
@@ -5561,6 +6346,7 @@ exports.AlertDialogRoot = AlertDialogRoot;
5561
6346
  exports.AlertDialogTitle = AlertDialogTitle;
5562
6347
  exports.AlertDialogTrigger = AlertDialogTrigger;
5563
6348
  exports.AmbientBackground = AmbientBackground;
6349
+ exports.Avatar = Avatar;
5564
6350
  exports.Badge = Badge;
5565
6351
  exports.Button = Button;
5566
6352
  exports.Calendar = Calendar;
@@ -5572,9 +6358,11 @@ exports.CardTitle = CardTitle;
5572
6358
  exports.Checkbox = Checkbox;
5573
6359
  exports.CheckboxGroup = CheckboxGroup;
5574
6360
  exports.Combobox = Combobox;
6361
+ exports.ConfirmDialog = ConfirmDialog;
5575
6362
  exports.CopyField = CopyField;
5576
6363
  exports.DataTable = DataTable;
5577
6364
  exports.DatePicker = DatePicker;
6365
+ exports.DateRangeFilter = DateRangeFilter;
5578
6366
  exports.Dialog = Dialog;
5579
6367
  exports.DialogClose = DialogClose;
5580
6368
  exports.DialogContent = DialogContent;
@@ -5595,14 +6383,21 @@ exports.DropdownMenuRadioGroup = DropdownMenuRadioGroup;
5595
6383
  exports.DropdownMenuRadioItem = DropdownMenuRadioItem;
5596
6384
  exports.DropdownMenuSeparator = DropdownMenuSeparator;
5597
6385
  exports.DropdownMenuTrigger = DropdownMenuTrigger;
6386
+ exports.EMPTY_DATE_RANGE = EMPTY_DATE_RANGE;
5598
6387
  exports.EmptyState = EmptyState;
5599
6388
  exports.FileDropzone = FileDropzone;
6389
+ exports.FilterChip = FilterChip;
6390
+ exports.FilterChipRow = FilterChipRow;
5600
6391
  exports.FormField = FormField;
6392
+ exports.IconButton = IconButton;
6393
+ exports.IconTile = IconTile;
5601
6394
  exports.Input = Input;
5602
6395
  exports.Label = Label;
5603
6396
  exports.MultiSelect = MultiSelect;
5604
6397
  exports.NavigationTabs = NavigationTabs;
5605
6398
  exports.OtpInput = OtpInput;
6399
+ exports.Page = Page;
6400
+ exports.PageHeader = PageHeader;
5606
6401
  exports.Pagination = Pagination;
5607
6402
  exports.Popover = Popover;
5608
6403
  exports.PopoverContent = PopoverContent;
@@ -5624,6 +6419,9 @@ exports.RichSelectSearch = RichSelectSearch;
5624
6419
  exports.RichSelectSeparator = RichSelectSeparator;
5625
6420
  exports.RichSelectTrigger = RichSelectTrigger;
5626
6421
  exports.RichSelectValue = RichSelectValue;
6422
+ exports.SearchField = SearchField;
6423
+ exports.SectionHeading = SectionHeading;
6424
+ exports.SegmentedControl = SegmentedControl;
5627
6425
  exports.Select = Select;
5628
6426
  exports.Separator = Separator;
5629
6427
  exports.SheetClose = SheetClose;
@@ -5637,30 +6435,44 @@ exports.SheetTrigger = SheetTrigger;
5637
6435
  exports.Skeleton = Skeleton;
5638
6436
  exports.Slot = Slot;
5639
6437
  exports.Spinner = Spinner;
6438
+ exports.StatTile = StatTile;
6439
+ exports.StatTileGrid = StatTileGrid;
6440
+ exports.StatusDot = StatusDot;
5640
6441
  exports.Stepper = Stepper;
5641
6442
  exports.Switch = Switch;
6443
+ exports.TINT_TONES = TINT_TONES;
5642
6444
  exports.Table = Table2;
5643
6445
  exports.TableBody = TableBody;
5644
6446
  exports.TableCaption = TableCaption;
5645
6447
  exports.TableCell = TableCell;
5646
6448
  exports.TableFooter = TableFooter;
6449
+ exports.TableFrame = TableFrame;
5647
6450
  exports.TableHead = TableHead;
5648
6451
  exports.TableHeader = TableHeader;
5649
6452
  exports.TableRow = TableRow;
6453
+ exports.TableSkeleton = TableSkeleton;
5650
6454
  exports.Tabs = Tabs;
5651
6455
  exports.TabsContent = TabsContent;
5652
6456
  exports.TabsList = TabsList;
5653
6457
  exports.TabsTrigger = TabsTrigger;
5654
6458
  exports.Textarea = Textarea;
6459
+ exports.Toolbar = Toolbar;
6460
+ exports.ToolbarGroup = ToolbarGroup;
6461
+ exports.ToolbarSpacer = ToolbarSpacer;
5655
6462
  exports.Tooltip = Tooltip;
5656
6463
  exports.ValidationSummary = ValidationSummary;
6464
+ exports.avatarInitials = avatarInitials;
5657
6465
  exports.formatCalendarDate = formatCalendarDate;
6466
+ exports.formatDateRange = formatDateRange;
5658
6467
  exports.isCalendarDate = isCalendarDate;
6468
+ exports.isSameDateRange = isSameDateRange;
6469
+ exports.isValidDateRange = isValidDateRange;
5659
6470
  exports.menuStyle = menuStyle;
5660
6471
  exports.parseCalendarDate = parseCalendarDate;
5661
6472
  exports.registerDialogLayerPortal = registerDialogLayerPortal;
5662
6473
  exports.resolveActiveNavigationHref = resolveActiveNavigationHref;
5663
6474
  exports.serializeCalendarDate = serializeCalendarDate;
6475
+ exports.toneFromString = toneFromString;
5664
6476
  exports.useAnchoredMenu = useAnchoredMenu;
5665
6477
  //# sourceMappingURL=index.cjs.map
5666
6478
  //# sourceMappingURL=index.cjs.map