@platned/ui 1.1.0 → 1.1.2

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.d.ts CHANGED
@@ -6,8 +6,8 @@ import { Avatar as Avatar$1, Label as Label$1, Select as Select$1, Switch as Swi
6
6
  import * as _radix_ui_react_label from '@radix-ui/react-label';
7
7
  import { OTPInputProps } from 'input-otp';
8
8
  export { REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from 'input-otp';
9
- import { V as ValueFormat, a as ValueField, F as FormatOptions } from './data-table-Dec6t8NO.js';
10
- export { B as BADGE_COLORS, b as Badge, c as BadgeColor, d as BadgeProps, e as BadgeVariant, C as ColumnMobileRole, f as ColumnPin, g as CreateSelectColumnOptions, D as DataTable, h as DataTableAlign, i as DataTableButtonFilter, j as DataTableColumnAlign, k as DataTableColumnDef, l as DataTableColumnHeader, m as DataTableColumnHeaderProps, n as DataTableExpand, o as DataTableFacetedFilter, p as DataTableFacetedFilterProps, q as DataTableField, r as DataTableFilterMeta, s as DataTableFilterOptions, t as DataTableGroupBy, u as DataTableManual, v as DataTablePagination, w as DataTablePaginationProps, x as DataTableProps, y as DataTableRowAction, z as DataTableRowLinkProps, A as DataTableRowTone, E as DataTableSearchOptions, G as DataTableState, H as DataTableTabsFilter, I as DataTableViewOptions, J as DataTableViewOptionsProps, K as FieldPath, L as FormatProvider, M as FormatProviderProps, P as Progress, N as ProgressProps, O as ProgressTone, R as ROW_ACTIONS_COLUMN_ID, Q as RowActionLink, S as SELECT_COLUMN_ID, T as TableCellBadge, U as TableCellBadgeProps, W as TableCellLeadText, X as TableCellLeadTextProps, Y as TableCellProgress, Z as TableCellProgressProps, _ as TableCellSize, $ as TableCellText, a0 as TableCellTextProps, a1 as ValueType, a2 as createSelectColumn, a3 as fieldToColumn, a4 as formatDate, a5 as formatRelative, a6 as formatValue, a7 as getValueAt, a8 as humanize, a9 as isEmptyValue, aa as isFieldColumn, ab as isNumericType, ac as toDate, ad as useFormat } from './data-table-Dec6t8NO.js';
9
+ import { V as ValueFormat, a as ValueField, F as FormatOptions } from './data-table-CcIINjPg.js';
10
+ export { B as BADGE_COLORS, b as Badge, c as BadgeColor, d as BadgeProps, e as BadgeVariant, C as ColumnMobileRole, f as ColumnPin, g as CreateSelectColumnOptions, D as DataTable, h as DataTableAlign, i as DataTableButtonFilter, j as DataTableColumnAlign, k as DataTableColumnDef, l as DataTableColumnHeader, m as DataTableColumnHeaderProps, n as DataTableExpand, o as DataTableFacetedFilter, p as DataTableFacetedFilterProps, q as DataTableField, r as DataTableFilterMeta, s as DataTableFilterOptions, t as DataTableGroupBy, u as DataTableManual, v as DataTablePagination, w as DataTablePaginationProps, x as DataTableProps, y as DataTableRowAction, z as DataTableRowLinkProps, A as DataTableRowTone, E as DataTableSearchOptions, G as DataTableState, H as DataTableTabsFilter, I as DataTableViewOptions, J as DataTableViewOptionsProps, K as FieldPath, L as FormatProvider, M as FormatProviderProps, P as Progress, N as ProgressProps, O as ProgressTone, R as ROW_ACTIONS_COLUMN_ID, Q as RowActionLink, S as SELECT_COLUMN_ID, T as TableCellBadge, U as TableCellBadgeProps, W as TableCellLeadText, X as TableCellLeadTextProps, Y as TableCellProgress, Z as TableCellProgressProps, _ as TableCellSize, $ as TableCellText, a0 as TableCellTextProps, a1 as ValueType, a2 as createSelectColumn, a3 as fieldToColumn, a4 as formatDate, a5 as formatRelative, a6 as formatValue, a7 as getValueAt, a8 as humanize, a9 as isEmptyValue, aa as isFieldColumn, ab as isNumericType, ac as toDate, ad as useFormat } from './data-table-CcIINjPg.js';
11
11
  import * as _base_ui_react_combobox from '@base-ui/react/combobox';
12
12
  import { Combobox as Combobox$1 } from '@base-ui/react/combobox';
13
13
  import { DayPicker, DayButton, Locale } from 'react-day-picker';
@@ -2312,7 +2312,10 @@ interface SidebarNavItem {
2312
2312
  disabled?: boolean;
2313
2313
  /** Overrides route matching. */
2314
2314
  isActive?: boolean;
2315
- /** Child rows, one level deep, in a foldable sub-menu. */
2315
+ /**
2316
+ * Child rows, one level deep, in a foldable sub-menu. With a `to` or `href` of its own (from 1.1.1), the row opens
2317
+ * that page (a section's overview, say) and a chevron button beside it folds the children.
2318
+ */
2316
2319
  children?: SidebarNavItem[];
2317
2320
  /** Whether the children start open. Default: open when one of them is the current route. */
2318
2321
  defaultOpen?: boolean;
package/dist/index.js CHANGED
@@ -5786,6 +5786,9 @@ function NavParentRow({ item }) {
5786
5786
  const row = useRow();
5787
5787
  const children = item.children ?? [];
5788
5788
  const childActive = children.some((child) => isRowActive(child, row));
5789
+ const links = Boolean(item.to || item.href);
5790
+ const ownActive = links && !childActive && isRowActive(item, row);
5791
+ const ownCurrent = ownActive ? { "aria-current": "page" } : {};
5789
5792
  if (row.submenus === "dropdown") {
5790
5793
  return /* @__PURE__ */ jsxs23(SidebarMenuItem, { children: [
5791
5794
  /* @__PURE__ */ jsxs23(DropdownMenu, { children: [
@@ -5793,7 +5796,7 @@ function NavParentRow({ item }) {
5793
5796
  SidebarMenuButton,
5794
5797
  {
5795
5798
  tooltip: item.label,
5796
- isActive: childActive,
5799
+ isActive: childActive || ownActive,
5797
5800
  disabled: item.disabled,
5798
5801
  className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
5799
5802
  children: [
@@ -5802,14 +5805,31 @@ function NavParentRow({ item }) {
5802
5805
  ]
5803
5806
  }
5804
5807
  ) }),
5805
- /* @__PURE__ */ jsx27(DropdownMenuContent, { side: row.isMobile ? "bottom" : "right", align: "start", className: "min-w-48", children: children.map((child) => {
5806
- const active = isRowActive(child, row);
5807
- return /* @__PURE__ */ jsx27(DropdownMenuItem, { asChild: true, disabled: child.disabled, children: /* @__PURE__ */ jsx27(RowLink, { item: child, row, ...active ? { "aria-current": "page" } : {}, children: /* @__PURE__ */ jsx27(RowLabel, { item: child }) }) }, itemKey(child));
5808
- }) })
5808
+ /* @__PURE__ */ jsxs23(DropdownMenuContent, { side: row.isMobile ? "bottom" : "right", align: "start", className: "min-w-48", children: [
5809
+ links && /* @__PURE__ */ jsxs23(Fragment11, { children: [
5810
+ /* @__PURE__ */ jsx27(DropdownMenuItem, { asChild: true, disabled: item.disabled, children: /* @__PURE__ */ jsx27(RowLink, { item, row, ...ownCurrent, children: item.label }) }),
5811
+ /* @__PURE__ */ jsx27(DropdownMenuSeparator, {})
5812
+ ] }),
5813
+ children.map((child) => {
5814
+ const active = isRowActive(child, row);
5815
+ return /* @__PURE__ */ jsx27(DropdownMenuItem, { asChild: true, disabled: child.disabled, children: /* @__PURE__ */ jsx27(RowLink, { item: child, row, ...active ? { "aria-current": "page" } : {}, children: /* @__PURE__ */ jsx27(RowLabel, { item: child }) }) }, itemKey(child));
5816
+ })
5817
+ ] })
5809
5818
  ] }),
5810
5819
  rowAction(item)
5811
5820
  ] });
5812
5821
  }
5822
+ const sub = /* @__PURE__ */ jsx27(CollapsibleContent, { children: /* @__PURE__ */ jsx27(SidebarMenuSub, { children: children.map((child) => {
5823
+ const active = isRowActive(child, row);
5824
+ return /* @__PURE__ */ jsx27(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx27(SidebarMenuSubButton, { asChild: true, isActive: active, ...active ? { "aria-current": "page" } : {}, children: /* @__PURE__ */ jsx27(RowLink, { item: child, row, children: /* @__PURE__ */ jsx27(RowLabel, { item: child }) }) }) }, itemKey(child));
5825
+ }) }) });
5826
+ if (links) {
5827
+ return /* @__PURE__ */ jsx27(Collapsible, { asChild: true, defaultOpen: item.defaultOpen ?? (childActive || ownActive), className: "group/collapsible", children: /* @__PURE__ */ jsxs23(SidebarMenuItem, { children: [
5828
+ /* @__PURE__ */ jsx27(SidebarMenuButton, { asChild: true, tooltip: item.label, isActive: childActive || ownActive, ...ownCurrent, children: /* @__PURE__ */ jsx27(RowLink, { item, row, children: /* @__PURE__ */ jsx27(RowLabel, { item }) }) }),
5829
+ /* @__PURE__ */ jsx27(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(SidebarMenuAction, { "aria-label": `${item.label} pages`, disabled: item.disabled, className: "data-[state=open]:[&>svg]:rotate-90", children: /* @__PURE__ */ jsx27(ChevronRightIcon3, { className: "transition-transform duration-200 rtl:rotate-180" }) }) }),
5830
+ sub
5831
+ ] }) });
5832
+ }
5813
5833
  return /* @__PURE__ */ jsx27(Collapsible, { asChild: true, defaultOpen: item.defaultOpen ?? childActive, className: "group/collapsible", children: /* @__PURE__ */ jsxs23(SidebarMenuItem, { children: [
5814
5834
  /* @__PURE__ */ jsx27(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsxs23(
5815
5835
  SidebarMenuButton,
@@ -5824,10 +5844,7 @@ function NavParentRow({ item }) {
5824
5844
  ]
5825
5845
  }
5826
5846
  ) }),
5827
- /* @__PURE__ */ jsx27(CollapsibleContent, { children: /* @__PURE__ */ jsx27(SidebarMenuSub, { children: children.map((child) => {
5828
- const active = isRowActive(child, row);
5829
- return /* @__PURE__ */ jsx27(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx27(SidebarMenuSubButton, { asChild: true, isActive: active, ...active ? { "aria-current": "page" } : {}, children: /* @__PURE__ */ jsx27(RowLink, { item: child, row, children: /* @__PURE__ */ jsx27(RowLabel, { item: child }) }) }) }, itemKey(child));
5830
- }) }) })
5847
+ sub
5831
5848
  ] }) });
5832
5849
  }
5833
5850
  function filterNav(groups, isVisible) {