@atom-learning/components 10.0.1 → 10.2.0-beta.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.
Files changed (118) hide show
  1. package/dist/components/action-icon/ActionIcon.d.ts +4 -3
  2. package/dist/components/action-icon/ActionIcon.js +5 -3
  3. package/dist/components/action-icon/ActionIcon.js.map +1 -1
  4. package/dist/components/badge/BadgeText.js +1 -1
  5. package/dist/components/badge/BadgeText.js.map +1 -1
  6. package/dist/components/banner/BannerContainer.js.map +1 -1
  7. package/dist/components/banner/banner-regular/BannerRegular.d.ts +1 -0
  8. package/dist/components/banner/banner-regular/BannerRegularActions.js +1 -1
  9. package/dist/components/banner/banner-regular/BannerRegularActions.js.map +1 -1
  10. package/dist/components/banner/banner-regular/BannerRegularDismiss.d.ts +5 -3
  11. package/dist/components/banner/banner-slim/BannerSlim.d.ts +9 -2
  12. package/dist/components/banner/banner-slim/BannerSlimDismiss.d.ts +5 -3
  13. package/dist/components/button/Button.d.ts +2 -2
  14. package/dist/components/button/Button.js +21 -17
  15. package/dist/components/button/Button.js.map +1 -1
  16. package/dist/components/calendar/Calendar.js +2 -2
  17. package/dist/components/calendar/Calendar.js.map +1 -1
  18. package/dist/components/carousel/Carousel.js.map +1 -1
  19. package/dist/components/checkbox-group/CheckboxGroupAllItem.js +3 -2
  20. package/dist/components/checkbox-group/CheckboxGroupAllItem.js.map +1 -1
  21. package/dist/components/checkbox-group/CheckboxGroupChecked.context.js +1 -1
  22. package/dist/components/checkbox-group/CheckboxGroupChecked.context.js.map +1 -1
  23. package/dist/components/checkbox-group/CheckboxGroupMounted.context.js +1 -1
  24. package/dist/components/checkbox-group/CheckboxGroupMounted.context.js.map +1 -1
  25. package/dist/components/chip/Chip.js +2 -2
  26. package/dist/components/chip/Chip.js.map +1 -1
  27. package/dist/components/create-password-field/CreatePasswordField.js +5 -5
  28. package/dist/components/create-password-field/CreatePasswordField.js.map +1 -1
  29. package/dist/components/data-table/DataTableHeaderCell.js +8 -8
  30. package/dist/components/data-table/DataTableHeaderCell.js.map +1 -1
  31. package/dist/components/data-table/DataTableSelectAllRowsCheckbox.js.map +1 -1
  32. package/dist/components/data-table/getNewAsyncData.js +1 -1
  33. package/dist/components/data-table/getNewAsyncData.js.map +1 -1
  34. package/dist/components/date-input/DateInput.js.map +1 -1
  35. package/dist/components/dropdown-menu/DropdownMenu.d.ts +2 -1
  36. package/dist/components/dropdown-menu/DropdownMenuLinkItem.d.ts +2 -1
  37. package/dist/components/dropdown-menu/DropdownMenuLinkItem.js +18 -13
  38. package/dist/components/dropdown-menu/DropdownMenuLinkItem.js.map +1 -1
  39. package/dist/components/file-drop/FileDrop.js +2 -2
  40. package/dist/components/file-drop/FileDrop.js.map +1 -1
  41. package/dist/components/form/useFieldError.js +2 -1
  42. package/dist/components/form/useFieldError.js.map +1 -1
  43. package/dist/components/index.d.ts +1 -0
  44. package/dist/components/link/Link.d.ts +2 -2
  45. package/dist/components/link/Link.js +13 -9
  46. package/dist/components/link/Link.js.map +1 -1
  47. package/dist/components/navigation/NavigationMenu.d.ts +2 -1
  48. package/dist/components/navigation/NavigationMenu.js +1 -1
  49. package/dist/components/navigation/NavigationMenu.js.map +1 -1
  50. package/dist/components/navigation/NavigationMenuLink.d.ts +2 -1
  51. package/dist/components/navigation/NavigationMenuLink.js +28 -13
  52. package/dist/components/navigation/NavigationMenuLink.js.map +1 -1
  53. package/dist/components/navigation-menu-vertical/NavigationMenuVertical.d.ts +4 -2
  54. package/dist/components/navigation-menu-vertical/NavigationMenuVerticalLink.d.ts +4 -2
  55. package/dist/components/navigation-menu-vertical/NavigationMenuVerticalLink.js +5 -3
  56. package/dist/components/navigation-menu-vertical/NavigationMenuVerticalLink.js.map +1 -1
  57. package/dist/components/number-input/NumberInputStepper.d.ts +5 -3
  58. package/dist/components/pagination/PaginationItems.js +2 -2
  59. package/dist/components/pagination/PaginationItems.js.map +1 -1
  60. package/dist/components/pagination/PaginationNextButton.d.ts +5 -3
  61. package/dist/components/pagination/PaginationPreviousButton.d.ts +5 -3
  62. package/dist/components/pagination/pagination.helper.js +5 -3
  63. package/dist/components/pagination/pagination.helper.js.map +1 -1
  64. package/dist/components/router-provider/Router.d.ts +9 -0
  65. package/dist/components/router-provider/Router.js +7 -0
  66. package/dist/components/router-provider/Router.js.map +1 -0
  67. package/dist/components/router-provider/RouterProvider.d.ts +16 -0
  68. package/dist/components/router-provider/RouterProvider.js +23 -0
  69. package/dist/components/router-provider/RouterProvider.js.map +1 -0
  70. package/dist/components/select-menu/SelectMenu.d.ts +16 -9
  71. package/dist/components/select-menu/SelectMenu.js +6 -4
  72. package/dist/components/select-menu/SelectMenu.js.map +1 -1
  73. package/dist/components/select-menu/SelectMenuContent.d.ts +5 -3
  74. package/dist/components/select-menu/SelectMenuContent.js +24 -65
  75. package/dist/components/select-menu/SelectMenuContent.js.map +1 -1
  76. package/dist/components/select-menu/SelectMenuItem.d.ts +5 -3
  77. package/dist/components/select-menu/SelectMenuItem.js +15 -15
  78. package/dist/components/select-menu/SelectMenuItem.js.map +1 -1
  79. package/dist/components/select-menu/SelectMenuLabel.d.ts +2 -2
  80. package/dist/components/select-menu/SelectMenuLabel.js +2 -2
  81. package/dist/components/select-menu/SelectMenuLabel.js.map +1 -1
  82. package/dist/components/select-menu/SelectMenuSeparator.d.ts +2 -2
  83. package/dist/components/select-menu/SelectMenuSeparator.js +2 -2
  84. package/dist/components/select-menu/SelectMenuSeparator.js.map +1 -1
  85. package/dist/components/select-menu/SelectMenuTrigger.d.ts +3 -2
  86. package/dist/components/select-menu/SelectMenuTrigger.js +12 -12
  87. package/dist/components/select-menu/SelectMenuTrigger.js.map +1 -1
  88. package/dist/components/select-menu-field/SelectMenuField.js +5 -5
  89. package/dist/components/select-menu-field/SelectMenuField.js.map +1 -1
  90. package/dist/components/slider/Slider.js.map +1 -1
  91. package/dist/components/slider-field/SliderField.js +2 -1
  92. package/dist/components/slider-field/SliderField.js.map +1 -1
  93. package/dist/components/sortable/Handle.d.ts +5 -3
  94. package/dist/components/stepper/Stepper.js +1 -1
  95. package/dist/components/stepper/Stepper.js.map +1 -1
  96. package/dist/components/stepper/StepperSteps.js +7 -5
  97. package/dist/components/stepper/StepperSteps.js.map +1 -1
  98. package/dist/components/table/useStickyColumnsCss.js +1 -1
  99. package/dist/components/table/useStickyColumnsCss.js.map +1 -1
  100. package/dist/components/tile-interactive/TileInteractive.d.ts +5 -3
  101. package/dist/components/tile-interactive/TileInteractive.js +4 -2
  102. package/dist/components/tile-interactive/TileInteractive.js.map +1 -1
  103. package/dist/components/tile-toggle-group/TileToggleGroupItem.d.ts +5 -2
  104. package/dist/components/top-bar/TopBar.d.ts +4 -2
  105. package/dist/docgen.json +1 -1
  106. package/dist/index.cjs.js +239 -218
  107. package/dist/index.cjs.js.map +1 -1
  108. package/dist/index.d.ts +0 -1
  109. package/dist/index.js +2 -1
  110. package/dist/styled.js +15 -11
  111. package/dist/styled.js.map +1 -1
  112. package/dist/utilities/hooks/useResizeObserver.js +1 -3
  113. package/dist/utilities/hooks/useResizeObserver.js.map +1 -1
  114. package/dist/utilities/uri/index.js +2 -1
  115. package/dist/utilities/uri/index.js.map +1 -1
  116. package/package.json +15 -7
  117. package/src/utilities.css +1 -1
  118. package/dist/types/navigatorActions.types.d.ts +0 -5
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationMenuLink.js","names":[],"sources":["../../../src/components/navigation/NavigationMenuLink.tsx"],"sourcesContent":["import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu'\nimport * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { getExternalAnchorProps } from '../../utilities/uri'\nimport { navigationMenuBaseItemStyles } from './NavigationMenu.styles'\n\nconst DisabledButton = styled('button', {\n base: [\n ...navigationMenuBaseItemStyles,\n 'disabled:bg-none',\n 'disabled:cursor-default',\n 'disabled:opacity-30',\n 'disabled:text-text'\n ]\n})\n\nconst ListItem = NavigationMenuPrimitive.Item\n\nconst StyledLink = styled(NavigationMenuPrimitive.Link, {\n base: [\n ...navigationMenuBaseItemStyles,\n 'block',\n 'no-underline',\n 'leading-none'\n ],\n variants: {\n elementType: {\n dropdownItem: [\n 'data-active:bg-background-selected',\n 'data-active:text-text-selected',\n 'data-active:hover:bg-background-selected-hover',\n 'data-active:hover:text-text-selected-hover',\n 'data-active:active:bg-background-selected-pressed',\n 'data-active:active:text-text-selected-pressed',\n 'data-active:focus-visible:shadow-[0_0_0_2px_var(--color-primary-800)]',\n 'data-active:focus-visible:text-text-selected-focus'\n ],\n link: [\n 'data-active:font-semibold',\n 'data-active:text-item-(--background-selected)',\n 'data-active:after:-translate-x-1/2',\n 'data-active:after:absolute',\n 'data-active:after:bg-item-(--background-selected)',\n 'data-active:after:block',\n 'data-active:after:bottom-0',\n 'data-active:after:h-0.5',\n 'data-active:after:left-1/2',\n 'data-active:after:rounded-md',\n 'data-active:after:translate-y-0',\n 'data-active:after:w-6'\n ]\n }\n }\n})\n\nexport const NavigationMenuLink = ({\n ref,\n children,\n href,\n disabled,\n className,\n variant = 'link',\n ...rest\n}: Omit<React.ComponentProps<typeof StyledLink>, 'elementType'> & {\n disabled?: boolean\n variant?: React.ComponentProps<typeof StyledLink>['elementType']\n ref?: React.Ref<HTMLAnchorElement>\n}) => (\n <ListItem>\n {disabled ? (\n <DisabledButton disabled className={className}>\n {children}\n </DisabledButton>\n ) : (\n <StyledLink\n href={href}\n ref={ref}\n elementType={variant}\n className={className}\n {...getExternalAnchorProps(href)}\n {...rest}\n >\n {children}\n </StyledLink>\n )}\n </ListItem>\n)\n"],"mappings":";;;;;;;AAOA,IAAM,iBAAiB,OAAO,UAAU,EACtC,MAAM;CACJ,GAAG;CACH;CACA;CACA;CACA;AACF,EACF,CAAC;AAED,IAAM,WAAW,wBAAwB;AAEzC,IAAM,aAAa,OAAO,wBAAwB,MAAM;CACtD,MAAM;EACJ,GAAG;EACH;EACA;EACA;CACF;CACA,UAAU,EACR,aAAa;EACX,cAAc;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF,EACF;AACF,CAAC;AAED,IAAa,sBAAsB,EACjC,KACA,UACA,MACA,UACA,WACA,UAAU,QACV,GAAG,WAMH,oBAAC,UAAD,EAAA,UACG,WACC,oBAAC,gBAAD;CAAgB,UAAA;CAAoB;CACjC;AACa,CAAA,IAEhB,oBAAC,YAAD;CACQ;CACD;CACL,aAAa;CACF;CACX,GAAI,uBAAuB,IAAI;CAC/B,GAAI;CAEH;AACS,CAAA,EAEN,CAAA"}
1
+ {"version":3,"file":"NavigationMenuLink.js","names":[],"sources":["../../../src/components/navigation/NavigationMenuLink.tsx"],"sourcesContent":["import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu'\nimport * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { getExternalAnchorProps } from '../../utilities/uri'\nimport { useRouterLinkProps } from '../router-provider/RouterProvider'\nimport { navigationMenuBaseItemStyles } from './NavigationMenu.styles'\n\nconst DisabledButton = styled('button', {\n base: [\n ...navigationMenuBaseItemStyles,\n 'disabled:bg-none',\n 'disabled:cursor-default',\n 'disabled:opacity-30',\n 'disabled:text-text'\n ]\n})\n\nconst ListItem = NavigationMenuPrimitive.Item\n\nconst StyledLink = styled(NavigationMenuPrimitive.Link, {\n base: [\n ...navigationMenuBaseItemStyles,\n 'block',\n 'no-underline',\n 'leading-none'\n ],\n variants: {\n elementType: {\n dropdownItem: [\n 'data-active:bg-background-selected',\n 'data-active:text-text-selected',\n 'data-active:hover:bg-background-selected-hover',\n 'data-active:hover:text-text-selected-hover',\n 'data-active:active:bg-background-selected-pressed',\n 'data-active:active:text-text-selected-pressed',\n 'data-active:focus-visible:shadow-[0_0_0_2px_var(--color-primary-800)]',\n 'data-active:focus-visible:text-text-selected-focus'\n ],\n link: [\n 'data-active:font-semibold',\n 'data-active:text-item-(--background-selected)',\n 'data-active:after:-translate-x-1/2',\n 'data-active:after:absolute',\n 'data-active:after:bg-item-(--background-selected)',\n 'data-active:after:block',\n 'data-active:after:bottom-0',\n 'data-active:after:h-0.5',\n 'data-active:after:left-1/2',\n 'data-active:after:rounded-md',\n 'data-active:after:translate-y-0',\n 'data-active:after:w-6'\n ]\n }\n }\n})\n\nexport const NavigationMenuLink = ({\n ref,\n children,\n href,\n disabled,\n className,\n variant = 'link',\n reloadDocument,\n ...rest\n}: Omit<React.ComponentProps<typeof StyledLink>, 'elementType'> & {\n disabled?: boolean\n variant?: React.ComponentProps<typeof StyledLink>['elementType']\n reloadDocument?: boolean\n ref?: React.Ref<HTMLAnchorElement>\n}) => {\n const routerLinkProps = useRouterLinkProps(href, { reloadDocument })\n const RouterLink = routerLinkProps.as\n\n return (\n <ListItem>\n {disabled ? (\n <DisabledButton disabled className={className}>\n {children}\n </DisabledButton>\n ) : RouterLink ? (\n <StyledLink\n href={href}\n ref={ref}\n elementType={variant}\n className={className}\n asChild\n {...rest}\n >\n <RouterLink href={href}>{children}</RouterLink>\n </StyledLink>\n ) : (\n <StyledLink\n href={href}\n ref={ref}\n elementType={variant}\n className={className}\n {...getExternalAnchorProps(href)}\n {...rest}\n >\n {children}\n </StyledLink>\n )}\n </ListItem>\n )\n}\n"],"mappings":";;;;;;;;AAQA,IAAM,iBAAiB,OAAO,UAAU,EACtC,MAAM;CACJ,GAAG;CACH;CACA;CACA;CACA;AACF,EACF,CAAC;AAED,IAAM,WAAW,wBAAwB;AAEzC,IAAM,aAAa,OAAO,wBAAwB,MAAM;CACtD,MAAM;EACJ,GAAG;EACH;EACA;EACA;CACF;CACA,UAAU,EACR,aAAa;EACX,cAAc;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF,EACF;AACF,CAAC;AAED,IAAa,sBAAsB,EACjC,KACA,UACA,MACA,UACA,WACA,UAAU,QACV,gBACA,GAAG,WAMC;CAEJ,MAAM,aADkB,mBAAmB,MAAM,EAAE,eAAe,CAC/C,CAAA,CAAgB;CAEnC,OACE,oBAAC,UAAD,EAAA,UACG,WACC,oBAAC,gBAAD;EAAgB,UAAA;EAAoB;EACjC;CACa,CAAA,IACd,aACF,oBAAC,YAAD;EACQ;EACD;EACL,aAAa;EACF;EACX,SAAA;EACA,GAAI;YAEJ,oBAAC,YAAD;GAAkB;GAAO;EAAqB,CAAA;CACpC,CAAA,IAEZ,oBAAC,YAAD;EACQ;EACD;EACL,aAAa;EACF;EACX,GAAI,uBAAuB,IAAI;EAC/B,GAAI;EAEH;CACS,CAAA,EAEN,CAAA;AAEd"}
@@ -2,11 +2,13 @@ import * as React from 'react';
2
2
  declare const StyledRoot: import("../..").PolymorphicComponent<React.ForwardRefExoticComponent<import("@radix-ui/react-navigation-menu").NavigationMenuProps & React.RefAttributes<HTMLElement>>, unknown>;
3
3
  type NavigationVerticalProps = Omit<React.ComponentProps<typeof StyledRoot>, 'delayDuration' | 'skipDelayDuration' | 'defaultValue' | 'value' | 'onValueChange'>;
4
4
  export declare const NavigationMenuVertical: (({ children, ...rest }: NavigationVerticalProps) => React.JSX.Element) & {
5
- Link: ({ as, href, children, ...rest }: {
5
+ Link: ({ as, href, children, reloadDocument, ...rest }: {
6
6
  size?: "lg" | "md" | undefined;
7
7
  } & {
8
8
  as?: never;
9
- } & Omit<import("@radix-ui/react-navigation-menu").NavigationMenuLinkProps & React.RefAttributes<HTMLAnchorElement>, "as" | "size">) => React.JSX.Element;
9
+ } & Omit<import("@radix-ui/react-navigation-menu").NavigationMenuLinkProps & React.RefAttributes<HTMLAnchorElement>, "as" | "size"> & {
10
+ reloadDocument?: boolean;
11
+ }) => React.JSX.Element;
10
12
  Accordion: ({ defaultOpen, open, onOpenChange, disabled, ...rest }: import("@radix-ui/react-collapsible").CollapsibleProps & React.RefAttributes<HTMLDivElement> & {
11
13
  key?: React.Key | null | undefined;
12
14
  ref?: React.Ref<HTMLLIElement> | undefined;
@@ -2,6 +2,8 @@ import * as React from 'react';
2
2
  declare const StyledNavigationMenuVerticalLink: import("../..").PolymorphicComponent<React.ForwardRefExoticComponent<import("@radix-ui/react-navigation-menu").NavigationMenuLinkProps & React.RefAttributes<HTMLAnchorElement>>, {
3
3
  size?: "lg" | "md" | undefined;
4
4
  }>;
5
- type NavigationMenuVerticalItemProps = React.ComponentProps<typeof StyledNavigationMenuVerticalLink>;
6
- export declare const NavigationMenuVerticalLink: ({ as, href, children, ...rest }: NavigationMenuVerticalItemProps) => React.JSX.Element;
5
+ type NavigationMenuVerticalItemProps = React.ComponentProps<typeof StyledNavigationMenuVerticalLink> & {
6
+ reloadDocument?: boolean;
7
+ };
8
+ export declare const NavigationMenuVerticalLink: ({ as, href, children, reloadDocument, ...rest }: NavigationMenuVerticalItemProps) => React.JSX.Element;
7
9
  export {};
@@ -1,5 +1,6 @@
1
1
  import { styled } from "../../styled.js";
2
2
  import { getExternalAnchorProps } from "../../utilities/uri/index.js";
3
+ import { useRouterLinkProps } from "../router-provider/RouterProvider.js";
3
4
  import { preventEvent } from "../../utilities/event/preventEvent.js";
4
5
  import { NavigationMenuVerticalItem } from "./NavigationMenuVerticalItem.js";
5
6
  import { navigationMenuVerticalItemStyles } from "./NavigationMenuVertical.styles.js";
@@ -15,9 +16,10 @@ var StyledNavigationMenuVerticalLink = styled(Link, {
15
16
  lg: ["min-h-12"]
16
17
  } }
17
18
  });
18
- var NavigationMenuVerticalLink = ({ as, href, children, ...rest }) => {
19
- const Component = as || (href ? "a" : "button");
20
- const componentProps = as ? {} : href ? getExternalAnchorProps(href) : { type: "button" };
19
+ var NavigationMenuVerticalLink = ({ as, href, children, reloadDocument, ...rest }) => {
20
+ const routerLinkProps = useRouterLinkProps(href, { reloadDocument });
21
+ const Component = as || routerLinkProps.as || (href ? "a" : "button");
22
+ const componentProps = as || routerLinkProps.as ? {} : href ? getExternalAnchorProps(href) : { type: "button" };
21
23
  return /* @__PURE__ */ jsx(NavigationMenuVerticalItem, { children: /* @__PURE__ */ jsx(StyledNavigationMenuVerticalLink, {
22
24
  size: "lg",
23
25
  href,
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationMenuVerticalLink.js","names":[],"sources":["../../../src/components/navigation-menu-vertical/NavigationMenuVerticalLink.tsx"],"sourcesContent":["import { Link } from '@radix-ui/react-navigation-menu'\nimport * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { preventEvent } from '../../utilities/event/preventEvent'\nimport { getExternalAnchorProps } from '../../utilities/uri'\nimport { navigationMenuVerticalItemStyles } from './NavigationMenuVertical.styles'\nimport { NavigationMenuVerticalItem } from './NavigationMenuVerticalItem'\nimport { NavigationMenuVerticalItemContent } from './NavigationMenuVerticalItemContent'\n\nconst StyledNavigationMenuVerticalLink = styled(Link, {\n base: navigationMenuVerticalItemStyles,\n variants: {\n size: {\n md: ['min-h-10'],\n lg: ['min-h-12']\n }\n }\n})\n\ntype NavigationMenuVerticalItemProps = React.ComponentProps<\n typeof StyledNavigationMenuVerticalLink\n>\n\nexport const NavigationMenuVerticalLink = ({\n as,\n href,\n children,\n ...rest\n}: NavigationMenuVerticalItemProps) => {\n const Component = (as || (href ? 'a' : 'button')) as React.ElementType\n const componentProps = as\n ? {}\n : href\n ? getExternalAnchorProps(href)\n : { type: 'button' }\n\n return (\n <NavigationMenuVerticalItem>\n <StyledNavigationMenuVerticalLink\n size=\"lg\"\n href={href}\n {...rest}\n {...componentProps}\n onSelect={preventEvent}\n asChild // ?: Can't use `as` for this as we lose `data-active` etc. attributes when we try to. Using `asChild` and `Component` as a workaround.\n >\n <Component>\n <NavigationMenuVerticalItemContent>\n {children}\n </NavigationMenuVerticalItemContent>\n </Component>\n </StyledNavigationMenuVerticalLink>\n </NavigationMenuVerticalItem>\n )\n}\n"],"mappings":";;;;;;;;;;AAUA,IAAM,mCAAmC,OAAO,MAAM;CACpD,MAAM;CACN,UAAU,EACR,MAAM;EACJ,IAAI,CAAC,UAAU;EACf,IAAI,CAAC,UAAU;CACjB,EACF;AACF,CAAC;AAMD,IAAa,8BAA8B,EACzC,IACA,MACA,UACA,GAAG,WACkC;CACrC,MAAM,YAAa,OAAO,OAAO,MAAM;CACvC,MAAM,iBAAiB,KACnB,CAAC,IACD,OACE,uBAAuB,IAAI,IAC3B,EAAE,MAAM,SAAS;CAEvB,OACE,oBAAC,4BAAD,EAAA,UACE,oBAAC,kCAAD;EACE,MAAK;EACC;EACN,GAAI;EACJ,GAAI;EACJ,UAAU;EACV,SAAA;YAEA,oBAAC,WAAD,EAAA,UACE,oBAAC,mCAAD,EACG,SACgC,CAAA,EAC1B,CAAA;CACqB,CAAA,EACR,CAAA;AAEhC"}
1
+ {"version":3,"file":"NavigationMenuVerticalLink.js","names":[],"sources":["../../../src/components/navigation-menu-vertical/NavigationMenuVerticalLink.tsx"],"sourcesContent":["import { Link } from '@radix-ui/react-navigation-menu'\nimport * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { preventEvent } from '../../utilities/event/preventEvent'\nimport { getExternalAnchorProps } from '../../utilities/uri'\nimport { useRouterLinkProps } from '../router-provider/RouterProvider'\nimport { navigationMenuVerticalItemStyles } from './NavigationMenuVertical.styles'\nimport { NavigationMenuVerticalItem } from './NavigationMenuVerticalItem'\nimport { NavigationMenuVerticalItemContent } from './NavigationMenuVerticalItemContent'\n\nconst StyledNavigationMenuVerticalLink = styled(Link, {\n base: navigationMenuVerticalItemStyles,\n variants: {\n size: {\n md: ['min-h-10'],\n lg: ['min-h-12']\n }\n }\n})\n\ntype NavigationMenuVerticalItemProps = React.ComponentProps<\n typeof StyledNavigationMenuVerticalLink\n> & { reloadDocument?: boolean }\n\nexport const NavigationMenuVerticalLink = ({\n as,\n href,\n children,\n reloadDocument,\n ...rest\n}: NavigationMenuVerticalItemProps) => {\n const routerLinkProps = useRouterLinkProps(href, { reloadDocument })\n const Component = as || routerLinkProps.as || (href ? 'a' : 'button')\n const componentProps =\n as || routerLinkProps.as\n ? {}\n : href\n ? getExternalAnchorProps(href)\n : { type: 'button' }\n\n return (\n <NavigationMenuVerticalItem>\n <StyledNavigationMenuVerticalLink\n size=\"lg\"\n href={href}\n {...rest}\n {...componentProps}\n onSelect={preventEvent}\n asChild // ?: Can't use `as` for this as we lose `data-active` etc. attributes when we try to. Using `asChild` and `Component` as a workaround.\n >\n <Component>\n <NavigationMenuVerticalItemContent>\n {children}\n </NavigationMenuVerticalItemContent>\n </Component>\n </StyledNavigationMenuVerticalLink>\n </NavigationMenuVerticalItem>\n )\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAM,mCAAmC,OAAO,MAAM;CACpD,MAAM;CACN,UAAU,EACR,MAAM;EACJ,IAAI,CAAC,UAAU;EACf,IAAI,CAAC,UAAU;CACjB,EACF;AACF,CAAC;AAMD,IAAa,8BAA8B,EACzC,IACA,MACA,UACA,gBACA,GAAG,WACkC;CACrC,MAAM,kBAAkB,mBAAmB,MAAM,EAAE,eAAe,CAAC;CACnE,MAAM,YAAY,MAAM,gBAAgB,OAAO,OAAO,MAAM;CAC5D,MAAM,iBACJ,MAAM,gBAAgB,KAClB,CAAC,IACD,OACE,uBAAuB,IAAI,IAC3B,EAAE,MAAM,SAAS;CAEzB,OACE,oBAAC,4BAAD,EAAA,UACE,oBAAC,kCAAD;EACE,MAAK;EACC;EACN,GAAI;EACJ,GAAI;EACJ,UAAU;EACV,SAAA;YAEA,oBAAC,WAAD,EAAA,UACE,oBAAC,mCAAD,EACG,SACgC,CAAA,EAC1B,CAAA;CACqB,CAAA,EACR,CAAA;AAEhC"}
@@ -1,17 +1,19 @@
1
1
  import * as React from 'react';
2
2
  import { ActionIcon } from '../action-icon/ActionIcon';
3
- declare const StyledStepperButton: import("../..").PolymorphicComponent<({ ref, children, theme, appearance, size, label, href, disabled, hasTooltip, tooltipSide, ...rest }: Omit<{
3
+ declare const StyledStepperButton: import("../..").PolymorphicComponent<({ ref, children, theme, appearance, size, label, href, disabled, hasTooltip, tooltipSide, reloadDocument, ...rest }: Omit<{
4
4
  theme?: ("danger" | "neutral" | "primary" | "primaryDark" | "success" | "warning" | "white" | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", "danger" | "neutral" | "primary" | "primaryDark" | "success" | "warning" | "white">>) | undefined;
5
5
  appearance?: ("outline" | "simple" | "solid" | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", "outline" | "simple" | "solid">>) | undefined;
6
6
  size?: ("lg" | "md" | "sm" | "xs" | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", "lg" | "md" | "sm" | "xs">>) | undefined;
7
7
  isRounded?: (boolean | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", boolean>>) | undefined;
8
8
  } & {
9
9
  as?: never;
10
- } & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "appearance" | "as" | "isRounded" | "size" | "theme">, "as" | "children" | "hasTooltip" | "label" | "tooltipSide" | keyof import("../..").NavigatorActions> & {
10
+ } & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "appearance" | "as" | "isRounded" | "size" | "theme">, "as" | "children" | "hasTooltip" | "href" | "label" | "reloadDocument" | "tooltipSide"> & {
11
11
  as?: React.ElementType;
12
12
  children: React.ReactNode;
13
+ href?: string;
13
14
  label: string;
14
- } & Omit<import("../..").OptionalTooltipWrapperProps, "label"> & import("../..").NavigatorActions) => React.JSX.Element, {
15
+ reloadDocument?: boolean;
16
+ } & Omit<import("../..").OptionalTooltipWrapperProps, "label">) => React.JSX.Element, {
15
17
  fieldAppearance?: "modern" | "standard" | undefined;
16
18
  fieldTheme?: "grey" | "white" | undefined;
17
19
  emphasis?: "bold" | undefined;
@@ -9,9 +9,9 @@ import { Fragment, jsx } from "react/jsx-runtime";
9
9
  //#region src/components/pagination/PaginationItems.tsx
10
10
  var PaginationItems = () => {
11
11
  const { paginationItems } = usePagination();
12
- return /* @__PURE__ */ jsx(Fragment, { children: paginationItems.map((paginationItem, i) => {
12
+ return /* @__PURE__ */ jsx(Fragment, { children: paginationItems.map((paginationItem) => {
13
13
  switch (paginationItem) {
14
- case VIEW_ALL_POPOVER: return /* @__PURE__ */ jsx(PaginationPopover, {}, paginationItem + i);
14
+ case VIEW_ALL_POPOVER: return /* @__PURE__ */ jsx(PaginationPopover, {}, paginationItem);
15
15
  case GO_TO_PREVIOUS_PAGE: return /* @__PURE__ */ jsx(PaginationPreviousButton, {}, paginationItem);
16
16
  case GO_TO_NEXT_PAGE: return /* @__PURE__ */ jsx(PaginationNextButton, {}, paginationItem);
17
17
  default: return /* @__PURE__ */ jsx(PaginationPage, { pageNumber: paginationItem }, paginationItem);
@@ -1 +1 @@
1
- {"version":3,"file":"PaginationItems.js","names":[],"sources":["../../../src/components/pagination/PaginationItems.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {\n GO_TO_NEXT_PAGE,\n GO_TO_PREVIOUS_PAGE,\n VIEW_ALL_POPOVER\n} from './pagination.constants'\nimport { PaginationNextButton } from './PaginationNextButton'\nimport { PaginationPage } from './PaginationPage'\nimport { PaginationPopover } from './PaginationPopover'\nimport { PaginationPreviousButton } from './PaginationPreviousButton'\nimport { usePagination } from './usePagination'\n\nexport const PaginationItems = () => {\n const { paginationItems } = usePagination()\n\n return (\n <>\n {paginationItems.map((paginationItem, i) => {\n switch (paginationItem) {\n case VIEW_ALL_POPOVER:\n return <PaginationPopover key={paginationItem + i} />\n case GO_TO_PREVIOUS_PAGE:\n return <PaginationPreviousButton key={paginationItem} />\n case GO_TO_NEXT_PAGE:\n return <PaginationNextButton key={paginationItem} />\n default:\n return (\n <PaginationPage\n key={paginationItem}\n pageNumber={paginationItem}\n />\n )\n }\n })}\n </>\n )\n}\n"],"mappings":";;;;;;;;;AAaA,IAAa,wBAAwB;CACnC,MAAM,EAAE,oBAAoB,cAAc;CAE1C,OACE,oBAAA,UAAA,EAAA,UACG,gBAAgB,KAAK,gBAAgB,MAAM;EAC1C,QAAQ,gBAAR;GACE,KAAK,kBACH,OAAO,oBAAC,mBAAD,CAA6C,GAArB,iBAAiB,CAAI;GACtD,KAAK,qBACH,OAAO,oBAAC,0BAAD,CAAgD,GAAjB,cAAiB;GACzD,KAAK,iBACH,OAAO,oBAAC,sBAAD,CAA4C,GAAjB,cAAiB;GACrD,SACE,OACE,oBAAC,gBAAD,EAEE,YAAY,eACb,GAFM,cAEN;EAEP;CACF,CAAC,EACD,CAAA;AAEN"}
1
+ {"version":3,"file":"PaginationItems.js","names":[],"sources":["../../../src/components/pagination/PaginationItems.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {\n GO_TO_NEXT_PAGE,\n GO_TO_PREVIOUS_PAGE,\n VIEW_ALL_POPOVER\n} from './pagination.constants'\nimport { PaginationNextButton } from './PaginationNextButton'\nimport { PaginationPage } from './PaginationPage'\nimport { PaginationPopover } from './PaginationPopover'\nimport { PaginationPreviousButton } from './PaginationPreviousButton'\nimport { usePagination } from './usePagination'\n\nexport const PaginationItems = () => {\n const { paginationItems } = usePagination()\n\n return (\n <>\n {paginationItems.map((paginationItem) => {\n switch (paginationItem) {\n case VIEW_ALL_POPOVER:\n return <PaginationPopover key={paginationItem} />\n case GO_TO_PREVIOUS_PAGE:\n return <PaginationPreviousButton key={paginationItem} />\n case GO_TO_NEXT_PAGE:\n return <PaginationNextButton key={paginationItem} />\n default:\n return (\n <PaginationPage\n key={paginationItem}\n pageNumber={paginationItem}\n />\n )\n }\n })}\n </>\n )\n}\n"],"mappings":";;;;;;;;;AAaA,IAAa,wBAAwB;CACnC,MAAM,EAAE,oBAAoB,cAAc;CAE1C,OACE,oBAAA,UAAA,EAAA,UACG,gBAAgB,KAAK,mBAAmB;EACvC,QAAQ,gBAAR;GACE,KAAK,kBACH,OAAO,oBAAC,mBAAD,CAAyC,GAAjB,cAAiB;GAClD,KAAK,qBACH,OAAO,oBAAC,0BAAD,CAAgD,GAAjB,cAAiB;GACzD,KAAK,iBACH,OAAO,oBAAC,sBAAD,CAA4C,GAAjB,cAAiB;GACrD,SACE,OACE,oBAAC,gBAAD,EAEE,YAAY,eACb,GAFM,cAEN;EAEP;CACF,CAAC,EACD,CAAA;AAEN"}
@@ -1,15 +1,17 @@
1
1
  import * as React from 'react';
2
- declare const StyledActionIcon: import("../..").PolymorphicComponent<({ ref, children, theme, appearance, size, label, href, disabled, hasTooltip, tooltipSide, ...rest }: Omit<{
2
+ declare const StyledActionIcon: import("../..").PolymorphicComponent<({ ref, children, theme, appearance, size, label, href, disabled, hasTooltip, tooltipSide, reloadDocument, ...rest }: Omit<{
3
3
  theme?: ("danger" | "neutral" | "primary" | "primaryDark" | "success" | "warning" | "white" | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", "danger" | "neutral" | "primary" | "primaryDark" | "success" | "warning" | "white">>) | undefined;
4
4
  appearance?: ("outline" | "simple" | "solid" | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", "outline" | "simple" | "solid">>) | undefined;
5
5
  size?: ("lg" | "md" | "sm" | "xs" | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", "lg" | "md" | "sm" | "xs">>) | undefined;
6
6
  isRounded?: (boolean | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", boolean>>) | undefined;
7
7
  } & {
8
8
  as?: never;
9
- } & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "appearance" | "as" | "isRounded" | "size" | "theme">, "as" | "children" | "hasTooltip" | "label" | "tooltipSide" | keyof import("../..").NavigatorActions> & {
9
+ } & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "appearance" | "as" | "isRounded" | "size" | "theme">, "as" | "children" | "hasTooltip" | "href" | "label" | "reloadDocument" | "tooltipSide"> & {
10
10
  as?: React.ElementType;
11
11
  children: React.ReactNode;
12
+ href?: string;
12
13
  label: string;
13
- } & Omit<import("../..").OptionalTooltipWrapperProps, "label"> & import("../..").NavigatorActions) => React.JSX.Element, unknown>;
14
+ reloadDocument?: boolean;
15
+ } & Omit<import("../..").OptionalTooltipWrapperProps, "label">) => React.JSX.Element, unknown>;
14
16
  export declare const PaginationNextButton: (props: Partial<React.ComponentProps<typeof StyledActionIcon>>) => React.JSX.Element;
15
17
  export {};
@@ -1,15 +1,17 @@
1
1
  import * as React from 'react';
2
- declare const StyledActionIcon: import("../..").PolymorphicComponent<({ ref, children, theme, appearance, size, label, href, disabled, hasTooltip, tooltipSide, ...rest }: Omit<{
2
+ declare const StyledActionIcon: import("../..").PolymorphicComponent<({ ref, children, theme, appearance, size, label, href, disabled, hasTooltip, tooltipSide, reloadDocument, ...rest }: Omit<{
3
3
  theme?: ("danger" | "neutral" | "primary" | "primaryDark" | "success" | "warning" | "white" | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", "danger" | "neutral" | "primary" | "primaryDark" | "success" | "warning" | "white">>) | undefined;
4
4
  appearance?: ("outline" | "simple" | "solid" | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", "outline" | "simple" | "solid">>) | undefined;
5
5
  size?: ("lg" | "md" | "sm" | "xs" | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", "lg" | "md" | "sm" | "xs">>) | undefined;
6
6
  isRounded?: (boolean | Partial<Record<"@initial" | "@lg" | "@md" | "@sm" | "@xl", boolean>>) | undefined;
7
7
  } & {
8
8
  as?: never;
9
- } & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "appearance" | "as" | "isRounded" | "size" | "theme">, "as" | "children" | "hasTooltip" | "label" | "tooltipSide" | keyof import("../..").NavigatorActions> & {
9
+ } & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "appearance" | "as" | "isRounded" | "size" | "theme">, "as" | "children" | "hasTooltip" | "href" | "label" | "reloadDocument" | "tooltipSide"> & {
10
10
  as?: React.ElementType;
11
11
  children: React.ReactNode;
12
+ href?: string;
12
13
  label: string;
13
- } & Omit<import("../..").OptionalTooltipWrapperProps, "label"> & import("../..").NavigatorActions) => React.JSX.Element, unknown>;
14
+ reloadDocument?: boolean;
15
+ } & Omit<import("../..").OptionalTooltipWrapperProps, "label">) => React.JSX.Element, unknown>;
14
16
  export declare const PaginationPreviousButton: (props: Partial<React.ComponentProps<typeof StyledActionIcon>>) => React.JSX.Element;
15
17
  export {};
@@ -29,7 +29,7 @@ var getPaginationElementsToRender = (currentPage, pagesCount, visibleElementsCou
29
29
  if (canFitViewAllPopover) visiblePagesCount -= 1;
30
30
  if (canFitEdgePage) visiblePagesCount -= 1;
31
31
  const firstPage = paginationPages[0];
32
- const lastPage = paginationPages[paginationPages.length - 1];
32
+ const lastPage = paginationPages.at(-1);
33
33
  /**
34
34
  * If we're truncating and current page is at the start of the page list,
35
35
  * render the initial truncated page list, e.g.
@@ -104,14 +104,16 @@ var getPaginationElementsToRender = (currentPage, pagesCount, visibleElementsCou
104
104
  };
105
105
  var findNextAvailablePage = (startPage, disabledPages, pagesCount) => {
106
106
  if (startPage > pagesCount) return;
107
+ const disabledSet = new Set(disabledPages);
107
108
  let nextPage = startPage;
108
- while (disabledPages.includes(nextPage)) nextPage++;
109
+ while (disabledSet.has(nextPage)) nextPage++;
109
110
  return nextPage;
110
111
  };
111
112
  var findPreviousAvailablePage = (startPage, disabledPages) => {
112
113
  if (startPage < 1) return;
114
+ const disabledSet = new Set(disabledPages);
113
115
  let previousPage = startPage;
114
- while (disabledPages.includes(previousPage)) previousPage--;
116
+ while (disabledSet.has(previousPage)) previousPage--;
115
117
  return previousPage;
116
118
  };
117
119
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.helper.js","names":[],"sources":["../../../src/components/pagination/pagination.helper.ts"],"sourcesContent":["import {\n GO_TO_NEXT_PAGE,\n GO_TO_PREVIOUS_PAGE,\n VIEW_ALL_POPOVER\n} from './pagination.constants'\nimport type { PaginationItemsToRender } from './types'\n\nexport const getPaginationElementsToRender = (\n currentPage: number,\n pagesCount: number,\n visibleElementsCount: number\n): PaginationItemsToRender => {\n const paginationPages = Array.from(\n { length: pagesCount },\n (_, index) => index + 1\n )\n\n /*\n * As we always show the `<` `>` arrows,\n * subtract 2 from `visibleElementsCount` (one for each of the GO_TO_PREVIOUS/NEXT_PAGE arrows)\n * to get the `visiblePagesCount`\n */\n let visiblePagesCount = visibleElementsCount - 2\n const withPreviousNextPageArrows = (paginationPages) => [\n GO_TO_PREVIOUS_PAGE,\n ...paginationPages,\n GO_TO_NEXT_PAGE\n ]\n\n /**\n * If fewer pages than threshold for truncating render them all.\n *\n * pagesCount: 6\n * visibleElementsCount: >=6\n * returns [GO_TO_PREVIOUS_PAGE, 1, 2, 3, 4, GO_TO_NEXT_PAGE]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | 2 | | 3 | | 4 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n */\n if (pagesCount <= visiblePagesCount) {\n return withPreviousNextPageArrows(paginationPages)\n }\n\n /**\n * If current page is either at the very start or at the very end of the pages\n */\n const canFitEdgePage = visibleElementsCount >= 5\n const canFitViewAllPopover = visibleElementsCount >= 4\n const canFitPages = visibleElementsCount >= 3\n\n if (canFitViewAllPopover) {\n // Subtract one from visiblePagesCount to accomodate for us adding the `[…]` VIEW_ALL_POPOVER\n visiblePagesCount -= 1\n }\n\n if (canFitEdgePage) {\n // Subtract one more from visiblePagesCount to accomodate for us adding the GO_TO_PREVIOUS/NEXT_PAGE arrows\n visiblePagesCount -= 1\n }\n\n const firstPage = paginationPages[0]\n const lastPage = paginationPages[paginationPages.length - 1]\n\n /**\n * If we're truncating and current page is at the start of the page list,\n * render the initial truncated page list, e.g.\n *\n * pagesCount: 8\n * currentPage: 1/2\n * visibleElementsCount: 6\n * returns [GO_TO_PREVIOUS_PAGE, 1, 2, VIEW_ALL_POPOVER, 6, GO_TO_NEXT_PAGE]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | 2 | | … | | 8 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n */\n if (currentPage < visiblePagesCount) {\n const newPaginationItems = [] as PaginationItemsToRender\n if (canFitPages) {\n newPaginationItems.push(...paginationPages.slice(0, visiblePagesCount))\n }\n if (canFitViewAllPopover) {\n newPaginationItems.push(VIEW_ALL_POPOVER)\n }\n if (canFitEdgePage) {\n newPaginationItems.push(lastPage)\n }\n return withPreviousNextPageArrows(newPaginationItems)\n }\n\n /**\n * If we're truncating and the current page is towards the end of the\n * page list (depending on visibleElementsCount),\n * render a truncated page list from the end, e.g.\n *\n * pagesCount: 8\n * currentPage: 7/8\n * visibleElementsCount: 6\n * returns [GO_TO_PREVIOUS_PAGE, 1, VIEW_ALL_POPOVER, 7, 8, GO_TO_NEXT_PAGE]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | … | | 7 | | 8 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n */\n if (currentPage > pagesCount - visiblePagesCount) {\n const newPaginationItems = [] as PaginationItemsToRender\n if (canFitEdgePage) {\n newPaginationItems.push(firstPage)\n }\n if (canFitViewAllPopover) {\n newPaginationItems.push(VIEW_ALL_POPOVER)\n }\n if (canFitPages) {\n newPaginationItems.push(\n ...paginationPages.slice(pagesCount - visiblePagesCount, pagesCount)\n )\n }\n return withPreviousNextPageArrows(newPaginationItems)\n }\n\n /**\n * If we're truncating and the current page doesn't meet any of the previous conditions\n * (we're in the middle)\n * render a truncated page list from a specific index relative to `currentPage`, e.g.\n *\n * currentPage: 4\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [GO_TO_PREVIOUS_PAGE, 3, 4, VIEW_ALL_POPOVER, 6, GO_TO_NEXT_PAGE]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 3 | | 4 | | … | | 6 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n * currentPage: 6\n * visibleElementsCount: 8 // VisibleElementsAmount.MORE\n * returns [GO_TO_PREVIOUS_PAGE, 4, 5, 6, 7, VIEW_ALL_POPOVER, 10, GO_TO_NEXT_PAGE]\n * +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 4 | | 5 | | 6 | | 7 | | … | | 10 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+\n */\n const canFitCurrentPage = canFitPages\n const canFitCurrentPageAndPreviousPage = visibleElementsCount >= 6\n const canFitCurrentPageAndPreviousPageAndNextPage = visibleElementsCount >= 7\n const canFitLastPage = canFitEdgePage\n\n const newPaginationItems = [] as PaginationItemsToRender\n if (canFitCurrentPageAndPreviousPageAndNextPage) {\n newPaginationItems.push(\n ...paginationPages.slice(\n currentPage + 1 - visiblePagesCount,\n currentPage + 1\n )\n )\n } else if (canFitCurrentPageAndPreviousPage) {\n newPaginationItems.push(\n ...paginationPages.slice(currentPage - visiblePagesCount, currentPage)\n )\n } else if (canFitCurrentPage) {\n newPaginationItems.push(\n ...paginationPages.slice(currentPage - 1, currentPage - 1 + 1)\n )\n }\n if (canFitViewAllPopover) {\n newPaginationItems.push(VIEW_ALL_POPOVER)\n }\n if (canFitLastPage) {\n newPaginationItems.push(lastPage)\n }\n return withPreviousNextPageArrows(newPaginationItems)\n}\n\nexport const findNextAvailablePage = (\n startPage: number,\n disabledPages: number[],\n pagesCount: number\n): number | undefined => {\n if (startPage > pagesCount) return\n let nextPage = startPage\n while (disabledPages.includes(nextPage)) {\n nextPage++\n }\n return nextPage\n}\n\nexport const findPreviousAvailablePage = (\n startPage: number,\n disabledPages: number[]\n): number | undefined => {\n if (startPage < 1) return\n let previousPage = startPage\n while (disabledPages.includes(previousPage)) {\n previousPage--\n }\n return previousPage\n}\n"],"mappings":";;AAOA,IAAa,iCACX,aACA,YACA,yBAC4B;CAC5B,MAAM,kBAAkB,MAAM,KAC5B,EAAE,QAAQ,WAAW,IACpB,GAAG,UAAU,QAAQ,CACxB;CAOA,IAAI,oBAAoB,uBAAuB;CAC/C,MAAM,8BAA8B,oBAAoB;EACtD;EACA,GAAG;EACH;CACF;;;;;;;;;;;;CAaA,IAAI,cAAc,mBAChB,OAAO,2BAA2B,eAAe;;;;CAMnD,MAAM,iBAAiB,wBAAwB;CAC/C,MAAM,uBAAuB,wBAAwB;CACrD,MAAM,cAAc,wBAAwB;CAE5C,IAAI,sBAEF,qBAAqB;CAGvB,IAAI,gBAEF,qBAAqB;CAGvB,MAAM,YAAY,gBAAgB;CAClC,MAAM,WAAW,gBAAgB,gBAAgB,SAAS;;;;;;;;;;;;;;CAe1D,IAAI,cAAc,mBAAmB;EACnC,MAAM,qBAAqB,CAAC;EAC5B,IAAI,aACF,mBAAmB,KAAK,GAAG,gBAAgB,MAAM,GAAG,iBAAiB,CAAC;EAExE,IAAI,sBACF,mBAAmB,KAAK,gBAAgB;EAE1C,IAAI,gBACF,mBAAmB,KAAK,QAAQ;EAElC,OAAO,2BAA2B,kBAAkB;CACtD;;;;;;;;;;;;;;;CAgBA,IAAI,cAAc,aAAa,mBAAmB;EAChD,MAAM,qBAAqB,CAAC;EAC5B,IAAI,gBACF,mBAAmB,KAAK,SAAS;EAEnC,IAAI,sBACF,mBAAmB,KAAK,gBAAgB;EAE1C,IAAI,aACF,mBAAmB,KACjB,GAAG,gBAAgB,MAAM,aAAa,mBAAmB,UAAU,CACrE;EAEF,OAAO,2BAA2B,kBAAkB;CACtD;;;;;;;;;;;;;;;;;;;;CAqBA,MAAM,oBAAoB;CAC1B,MAAM,mCAAmC,wBAAwB;CACjE,MAAM,8CAA8C,wBAAwB;CAC5E,MAAM,iBAAiB;CAEvB,MAAM,qBAAqB,CAAC;CAC5B,IAAI,6CACF,mBAAmB,KACjB,GAAG,gBAAgB,MACjB,cAAc,IAAI,mBAClB,cAAc,CAChB,CACF;MACK,IAAI,kCACT,mBAAmB,KACjB,GAAG,gBAAgB,MAAM,cAAc,mBAAmB,WAAW,CACvE;MACK,IAAI,mBACT,mBAAmB,KACjB,GAAG,gBAAgB,MAAM,cAAc,GAAG,cAAc,IAAI,CAAC,CAC/D;CAEF,IAAI,sBACF,mBAAmB,KAAK,gBAAgB;CAE1C,IAAI,gBACF,mBAAmB,KAAK,QAAQ;CAElC,OAAO,2BAA2B,kBAAkB;AACtD;AAEA,IAAa,yBACX,WACA,eACA,eACuB;CACvB,IAAI,YAAY,YAAY;CAC5B,IAAI,WAAW;CACf,OAAO,cAAc,SAAS,QAAQ,GACpC;CAEF,OAAO;AACT;AAEA,IAAa,6BACX,WACA,kBACuB;CACvB,IAAI,YAAY,GAAG;CACnB,IAAI,eAAe;CACnB,OAAO,cAAc,SAAS,YAAY,GACxC;CAEF,OAAO;AACT"}
1
+ {"version":3,"file":"pagination.helper.js","names":[],"sources":["../../../src/components/pagination/pagination.helper.ts"],"sourcesContent":["import {\n GO_TO_NEXT_PAGE,\n GO_TO_PREVIOUS_PAGE,\n VIEW_ALL_POPOVER\n} from './pagination.constants'\nimport type { PaginationItemsToRender } from './types'\n\nexport const getPaginationElementsToRender = (\n currentPage: number,\n pagesCount: number,\n visibleElementsCount: number\n): PaginationItemsToRender => {\n const paginationPages = Array.from(\n { length: pagesCount },\n (_, index) => index + 1\n )\n\n /*\n * As we always show the `<` `>` arrows,\n * subtract 2 from `visibleElementsCount` (one for each of the GO_TO_PREVIOUS/NEXT_PAGE arrows)\n * to get the `visiblePagesCount`\n */\n let visiblePagesCount = visibleElementsCount - 2\n const withPreviousNextPageArrows = (paginationPages) => [\n GO_TO_PREVIOUS_PAGE,\n ...paginationPages,\n GO_TO_NEXT_PAGE\n ]\n\n /**\n * If fewer pages than threshold for truncating render them all.\n *\n * pagesCount: 6\n * visibleElementsCount: >=6\n * returns [GO_TO_PREVIOUS_PAGE, 1, 2, 3, 4, GO_TO_NEXT_PAGE]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | 2 | | 3 | | 4 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n */\n if (pagesCount <= visiblePagesCount) {\n return withPreviousNextPageArrows(paginationPages)\n }\n\n /**\n * If current page is either at the very start or at the very end of the pages\n */\n const canFitEdgePage = visibleElementsCount >= 5\n const canFitViewAllPopover = visibleElementsCount >= 4\n const canFitPages = visibleElementsCount >= 3\n\n if (canFitViewAllPopover) {\n // Subtract one from visiblePagesCount to accomodate for us adding the `[…]` VIEW_ALL_POPOVER\n visiblePagesCount -= 1\n }\n\n if (canFitEdgePage) {\n // Subtract one more from visiblePagesCount to accomodate for us adding the GO_TO_PREVIOUS/NEXT_PAGE arrows\n visiblePagesCount -= 1\n }\n\n const firstPage = paginationPages[0]\n // Non-null: this line is only reached when pagesCount exceeds the visible\n // threshold, so paginationPages always has a last element. `.at()` widens to\n // `T | undefined`, which the index access it replaced did not.\n const lastPage = paginationPages.at(-1)!\n\n /**\n * If we're truncating and current page is at the start of the page list,\n * render the initial truncated page list, e.g.\n *\n * pagesCount: 8\n * currentPage: 1/2\n * visibleElementsCount: 6\n * returns [GO_TO_PREVIOUS_PAGE, 1, 2, VIEW_ALL_POPOVER, 6, GO_TO_NEXT_PAGE]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | 2 | | … | | 8 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n */\n if (currentPage < visiblePagesCount) {\n const newPaginationItems = [] as PaginationItemsToRender\n if (canFitPages) {\n newPaginationItems.push(...paginationPages.slice(0, visiblePagesCount))\n }\n if (canFitViewAllPopover) {\n newPaginationItems.push(VIEW_ALL_POPOVER)\n }\n if (canFitEdgePage) {\n newPaginationItems.push(lastPage)\n }\n return withPreviousNextPageArrows(newPaginationItems)\n }\n\n /**\n * If we're truncating and the current page is towards the end of the\n * page list (depending on visibleElementsCount),\n * render a truncated page list from the end, e.g.\n *\n * pagesCount: 8\n * currentPage: 7/8\n * visibleElementsCount: 6\n * returns [GO_TO_PREVIOUS_PAGE, 1, VIEW_ALL_POPOVER, 7, 8, GO_TO_NEXT_PAGE]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | … | | 7 | | 8 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n */\n if (currentPage > pagesCount - visiblePagesCount) {\n const newPaginationItems = [] as PaginationItemsToRender\n if (canFitEdgePage) {\n newPaginationItems.push(firstPage)\n }\n if (canFitViewAllPopover) {\n newPaginationItems.push(VIEW_ALL_POPOVER)\n }\n if (canFitPages) {\n newPaginationItems.push(\n ...paginationPages.slice(pagesCount - visiblePagesCount, pagesCount)\n )\n }\n return withPreviousNextPageArrows(newPaginationItems)\n }\n\n /**\n * If we're truncating and the current page doesn't meet any of the previous conditions\n * (we're in the middle)\n * render a truncated page list from a specific index relative to `currentPage`, e.g.\n *\n * currentPage: 4\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [GO_TO_PREVIOUS_PAGE, 3, 4, VIEW_ALL_POPOVER, 6, GO_TO_NEXT_PAGE]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 3 | | 4 | | … | | 6 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n * currentPage: 6\n * visibleElementsCount: 8 // VisibleElementsAmount.MORE\n * returns [GO_TO_PREVIOUS_PAGE, 4, 5, 6, 7, VIEW_ALL_POPOVER, 10, GO_TO_NEXT_PAGE]\n * +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 4 | | 5 | | 6 | | 7 | | … | | 10 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+\n */\n const canFitCurrentPage = canFitPages\n const canFitCurrentPageAndPreviousPage = visibleElementsCount >= 6\n const canFitCurrentPageAndPreviousPageAndNextPage = visibleElementsCount >= 7\n const canFitLastPage = canFitEdgePage\n\n const newPaginationItems = [] as PaginationItemsToRender\n if (canFitCurrentPageAndPreviousPageAndNextPage) {\n newPaginationItems.push(\n ...paginationPages.slice(\n currentPage + 1 - visiblePagesCount,\n currentPage + 1\n )\n )\n } else if (canFitCurrentPageAndPreviousPage) {\n newPaginationItems.push(\n ...paginationPages.slice(currentPage - visiblePagesCount, currentPage)\n )\n } else if (canFitCurrentPage) {\n newPaginationItems.push(\n ...paginationPages.slice(currentPage - 1, currentPage - 1 + 1)\n )\n }\n if (canFitViewAllPopover) {\n newPaginationItems.push(VIEW_ALL_POPOVER)\n }\n if (canFitLastPage) {\n newPaginationItems.push(lastPage)\n }\n return withPreviousNextPageArrows(newPaginationItems)\n}\n\nexport const findNextAvailablePage = (\n startPage: number,\n disabledPages: number[],\n pagesCount: number\n): number | undefined => {\n if (startPage > pagesCount) return\n const disabledSet = new Set(disabledPages)\n let nextPage = startPage\n while (disabledSet.has(nextPage)) {\n nextPage++\n }\n return nextPage\n}\n\nexport const findPreviousAvailablePage = (\n startPage: number,\n disabledPages: number[]\n): number | undefined => {\n if (startPage < 1) return\n const disabledSet = new Set(disabledPages)\n let previousPage = startPage\n while (disabledSet.has(previousPage)) {\n previousPage--\n }\n return previousPage\n}\n"],"mappings":";;AAOA,IAAa,iCACX,aACA,YACA,yBAC4B;CAC5B,MAAM,kBAAkB,MAAM,KAC5B,EAAE,QAAQ,WAAW,IACpB,GAAG,UAAU,QAAQ,CACxB;CAOA,IAAI,oBAAoB,uBAAuB;CAC/C,MAAM,8BAA8B,oBAAoB;EACtD;EACA,GAAG;EACH;CACF;;;;;;;;;;;;CAaA,IAAI,cAAc,mBAChB,OAAO,2BAA2B,eAAe;;;;CAMnD,MAAM,iBAAiB,wBAAwB;CAC/C,MAAM,uBAAuB,wBAAwB;CACrD,MAAM,cAAc,wBAAwB;CAE5C,IAAI,sBAEF,qBAAqB;CAGvB,IAAI,gBAEF,qBAAqB;CAGvB,MAAM,YAAY,gBAAgB;CAIlC,MAAM,WAAW,gBAAgB,GAAG,EAAE;;;;;;;;;;;;;;CAetC,IAAI,cAAc,mBAAmB;EACnC,MAAM,qBAAqB,CAAC;EAC5B,IAAI,aACF,mBAAmB,KAAK,GAAG,gBAAgB,MAAM,GAAG,iBAAiB,CAAC;EAExE,IAAI,sBACF,mBAAmB,KAAK,gBAAgB;EAE1C,IAAI,gBACF,mBAAmB,KAAK,QAAQ;EAElC,OAAO,2BAA2B,kBAAkB;CACtD;;;;;;;;;;;;;;;CAgBA,IAAI,cAAc,aAAa,mBAAmB;EAChD,MAAM,qBAAqB,CAAC;EAC5B,IAAI,gBACF,mBAAmB,KAAK,SAAS;EAEnC,IAAI,sBACF,mBAAmB,KAAK,gBAAgB;EAE1C,IAAI,aACF,mBAAmB,KACjB,GAAG,gBAAgB,MAAM,aAAa,mBAAmB,UAAU,CACrE;EAEF,OAAO,2BAA2B,kBAAkB;CACtD;;;;;;;;;;;;;;;;;;;;CAqBA,MAAM,oBAAoB;CAC1B,MAAM,mCAAmC,wBAAwB;CACjE,MAAM,8CAA8C,wBAAwB;CAC5E,MAAM,iBAAiB;CAEvB,MAAM,qBAAqB,CAAC;CAC5B,IAAI,6CACF,mBAAmB,KACjB,GAAG,gBAAgB,MACjB,cAAc,IAAI,mBAClB,cAAc,CAChB,CACF;MACK,IAAI,kCACT,mBAAmB,KACjB,GAAG,gBAAgB,MAAM,cAAc,mBAAmB,WAAW,CACvE;MACK,IAAI,mBACT,mBAAmB,KACjB,GAAG,gBAAgB,MAAM,cAAc,GAAG,cAAc,IAAI,CAAC,CAC/D;CAEF,IAAI,sBACF,mBAAmB,KAAK,gBAAgB;CAE1C,IAAI,gBACF,mBAAmB,KAAK,QAAQ;CAElC,OAAO,2BAA2B,kBAAkB;AACtD;AAEA,IAAa,yBACX,WACA,eACA,eACuB;CACvB,IAAI,YAAY,YAAY;CAC5B,MAAM,cAAc,IAAI,IAAI,aAAa;CACzC,IAAI,WAAW;CACf,OAAO,YAAY,IAAI,QAAQ,GAC7B;CAEF,OAAO;AACT;AAEA,IAAa,6BACX,WACA,kBACuB;CACvB,IAAI,YAAY,GAAG;CACnB,MAAM,cAAc,IAAI,IAAI,aAAa;CACzC,IAAI,eAAe;CACnB,OAAO,YAAY,IAAI,YAAY,GACjC;CAEF,OAAO;AACT"}
@@ -0,0 +1,9 @@
1
+ export declare const Router: {
2
+ Provider: {
3
+ ({ link, children }: {
4
+ link: import("react").ComponentClass<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, any> | import("react").FunctionComponent<import("react").AnchorHTMLAttributes<HTMLAnchorElement>>;
5
+ children: React.ReactNode;
6
+ }): import("react").JSX.Element;
7
+ displayName: string;
8
+ };
9
+ };
@@ -0,0 +1,7 @@
1
+ import { RouterProvider } from "./RouterProvider.js";
2
+ //#region src/components/router-provider/Router.ts
3
+ var Router = { Provider: RouterProvider };
4
+ //#endregion
5
+ export { Router };
6
+
7
+ //# sourceMappingURL=Router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Router.js","names":[],"sources":["../../../src/components/router-provider/Router.ts"],"sourcesContent":["import { RouterProvider } from './RouterProvider'\n\n// The router integration lives under the `Router` name; there is no root\n// component to render, only the context provider. This compound must live in\n// its own module, not the components barrel — a value declared in the barrel\n// forces the root barrel's `export *` to pull the whole barrel (all components)\n// into the eager entry chunk instead of resolving each export to its individual\n// module.\nexport const Router = { Provider: RouterProvider }\n"],"mappings":";;AAQA,IAAa,SAAS,EAAE,UAAU,eAAe"}
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ type LinkComponent = React.ComponentType<React.AnchorHTMLAttributes<HTMLAnchorElement>>;
3
+ type RouterProviderProps = {
4
+ link: LinkComponent;
5
+ children: React.ReactNode;
6
+ };
7
+ export declare function RouterProvider({ link, children }: RouterProviderProps): React.JSX.Element;
8
+ export declare namespace RouterProvider {
9
+ var displayName: string;
10
+ }
11
+ export declare const useRouterLinkProps: (href?: string, { reloadDocument }?: {
12
+ reloadDocument?: boolean;
13
+ }) => {
14
+ as?: React.ElementType;
15
+ };
16
+ export {};
@@ -0,0 +1,23 @@
1
+ import * as React$1 from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/components/router-provider/RouterProvider.tsx
4
+ var RouterContext = React$1.createContext({});
5
+ var RouterProvider = ({ link, children }) => {
6
+ const value = React$1.useMemo(() => ({ link }), [link]);
7
+ return /* @__PURE__ */ jsx(RouterContext.Provider, {
8
+ value,
9
+ children
10
+ });
11
+ };
12
+ var isAbsoluteUrl = (url) => /^https?:\/\//.test(url || "");
13
+ var EMPTY = {};
14
+ var useRouterLinkProps = (href, { reloadDocument } = {}) => {
15
+ const { link } = React$1.useContext(RouterContext);
16
+ if (!link || !href || isAbsoluteUrl(href) || reloadDocument) return EMPTY;
17
+ return { as: link };
18
+ };
19
+ RouterProvider.displayName = "Router.Provider";
20
+ //#endregion
21
+ export { RouterProvider, useRouterLinkProps };
22
+
23
+ //# sourceMappingURL=RouterProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouterProvider.js","names":[],"sources":["../../../src/components/router-provider/RouterProvider.tsx"],"sourcesContent":["import * as React from 'react'\n\ntype LinkComponent = React.ComponentType<\n React.AnchorHTMLAttributes<HTMLAnchorElement>\n>\n\ntype RouterContextValue = {\n link?: LinkComponent\n}\n\nconst RouterContext = React.createContext<RouterContextValue>({})\n\ntype RouterProviderProps = {\n link: LinkComponent\n children: React.ReactNode\n}\n\nexport const RouterProvider = ({ link, children }: RouterProviderProps) => {\n const value = React.useMemo<RouterContextValue>(() => ({ link }), [link])\n return (\n <RouterContext.Provider value={value}>{children}</RouterContext.Provider>\n )\n}\n\nconst isAbsoluteUrl = (url?: string) => /^https?:\\/\\//.test(url || '')\n\n// `as` is surfaced as the broad `React.ElementType` (not the narrower\n// `LinkComponent`) so it feeds straight into styled()'s polymorphic `as` prop:\n// a concrete component type makes TS infer element-specific props and reject the\n// call, whereas `ElementType` lets inference land on the polymorphic signature.\nconst EMPTY: { as?: React.ElementType } = {}\n\nexport const useRouterLinkProps = (\n href?: string,\n { reloadDocument }: { reloadDocument?: boolean } = {}\n): { as?: React.ElementType } => {\n const { link } = React.useContext(RouterContext)\n\n if (!link || !href || isAbsoluteUrl(href) || reloadDocument) {\n return EMPTY\n }\n\n return { as: link }\n}\n\nRouterProvider.displayName = 'Router.Provider'\n"],"mappings":";;;AAUA,IAAM,gBAAgB,QAAM,cAAkC,CAAC,CAAC;AAOhE,IAAa,kBAAkB,EAAE,MAAM,eAAoC;CACzE,MAAM,QAAQ,QAAM,eAAmC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC;CACxE,OACE,oBAAC,cAAc,UAAf;EAA+B;EAAQ;CAAiC,CAAA;AAE5E;AAEA,IAAM,iBAAiB,QAAiB,eAAe,KAAK,OAAO,EAAE;AAMrE,IAAM,QAAoC,CAAC;AAE3C,IAAa,sBACX,MACA,EAAE,mBAAiD,CAAC,MACrB;CAC/B,MAAM,EAAE,SAAS,QAAM,WAAW,aAAa;CAE/C,IAAI,CAAC,QAAQ,CAAC,QAAQ,cAAc,IAAI,KAAK,gBAC3C,OAAO;CAGT,OAAO,EAAE,IAAI,KAAK;AACpB;AAEA,eAAe,cAAc"}
@@ -1,21 +1,28 @@
1
- import * as RadixSelect from '@radix-ui/react-select';
2
1
  import * as React from 'react';
3
- type SelectMenuProps = React.ComponentProps<typeof RadixSelect.Root> & {
2
+ import * as AriaComponents from 'react-aria-components';
3
+ type SelectMenuProps = Omit<AriaComponents.SelectProps<object>, 'className' | 'style' | 'children'> & {
4
4
  size?: 'sm' | 'md' | 'lg';
5
5
  theme?: 'white' | 'grey';
6
6
  state?: 'error';
7
+ className?: string;
8
+ children?: React.ReactNode;
7
9
  };
8
- export declare const SelectMenu: (({ size, theme, state, children, ...rest }: SelectMenuProps) => React.JSX.Element) & {
9
- Trigger: ({ ref, placeholder, children, ...rest }: RadixSelect.SelectTriggerProps & React.RefAttributes<HTMLButtonElement> & {
10
+ export declare const SelectMenu: (({ size, theme, state, className, children, ...rest }: SelectMenuProps) => React.JSX.Element) & {
11
+ Trigger: ({ ref, placeholder, children, ...rest }: Omit<AriaComponents.ButtonProps & React.RefAttributes<HTMLButtonElement>, "aria-label" | "aria-labelledby" | "children"> & {
10
12
  placeholder?: string;
13
+ children?: React.ReactNode;
11
14
  }) => React.JSX.Element;
12
- Content: ({ ref, children, position, sideOffset, ...rest }: RadixSelect.SelectContentProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element;
13
- Item: ({ ref, children, ...rest }: RadixSelect.SelectItemProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element;
14
- Group: React.ForwardRefExoticComponent<RadixSelect.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
15
+ Content: ({ ref, children, offset, ...rest }: Omit<AriaComponents.PopoverProps & React.RefAttributes<HTMLElement>, "children"> & {
16
+ children?: React.ReactNode;
17
+ }) => React.JSX.Element;
18
+ Item: ({ children, textValue, ...rest }: Omit<AriaComponents.ListBoxItemProps<object>, "children"> & {
19
+ children?: React.ReactNode;
20
+ }) => React.JSX.Element;
21
+ Group: <T>(props: AriaComponents.ListBoxSectionProps<T> & React.RefAttributes<HTMLElement>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
15
22
  Label: {
16
- ({ className, ...rest }: RadixSelect.SelectLabelProps & React.RefAttributes<HTMLDivElement>): React.JSX.Element;
23
+ ({ className, ...rest }: AriaComponents.HeaderProps & React.RefAttributes<HTMLElement>): React.JSX.Element;
17
24
  displayName: string;
18
25
  };
19
- Separator: import("../..").StyledComponent<React.ForwardRefExoticComponent<RadixSelect.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>>, unknown>;
26
+ Separator: import("../..").StyledComponent<(props: AriaComponents.SeparatorProps & React.RefAttributes<HTMLElement>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null, unknown>;
20
27
  };
21
28
  export {};
@@ -1,3 +1,4 @@
1
+ import { cn } from "../../styled.js";
1
2
  import { SelectMenuContext } from "./SelectMenu.context.js";
2
3
  import { SelectMenuContent } from "./SelectMenuContent.js";
3
4
  import { SelectMenuItem } from "./SelectMenuItem.js";
@@ -6,9 +7,9 @@ import { SelectMenuSeparator } from "./SelectMenuSeparator.js";
6
7
  import { SelectMenuTrigger } from "./SelectMenuTrigger.js";
7
8
  import * as React$1 from "react";
8
9
  import { jsx } from "react/jsx-runtime";
9
- import * as RadixSelect from "@radix-ui/react-select";
10
+ import * as AriaComponents from "react-aria-components";
10
11
  //#region src/components/select-menu/SelectMenu.tsx
11
- var SelectMenuRoot = ({ size = "md", theme = "grey", state, children, ...rest }) => {
12
+ var SelectMenuRoot = ({ size = "md", theme = "grey", state, className, children, ...rest }) => {
12
13
  return /* @__PURE__ */ jsx(SelectMenuContext, {
13
14
  value: React$1.useMemo(() => ({
14
15
  size,
@@ -19,7 +20,8 @@ var SelectMenuRoot = ({ size = "md", theme = "grey", state, children, ...rest })
19
20
  theme,
20
21
  state
21
22
  ]),
22
- children: /* @__PURE__ */ jsx(RadixSelect.Root, {
23
+ children: /* @__PURE__ */ jsx(AriaComponents.Select, {
24
+ className: cn("w-full", className),
23
25
  ...rest,
24
26
  children
25
27
  })
@@ -29,7 +31,7 @@ var SelectMenu = /* @__PURE__ */ Object.assign(SelectMenuRoot, {
29
31
  Trigger: SelectMenuTrigger,
30
32
  Content: SelectMenuContent,
31
33
  Item: SelectMenuItem,
32
- Group: RadixSelect.Group,
34
+ Group: AriaComponents.ListBoxSection,
33
35
  Label: SelectMenuLabel,
34
36
  Separator: SelectMenuSeparator
35
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SelectMenu.js","names":[],"sources":["../../../src/components/select-menu/SelectMenu.tsx"],"sourcesContent":["import * as RadixSelect from '@radix-ui/react-select'\nimport * as React from 'react'\n\nimport { SelectMenuContext } from './SelectMenu.context'\nimport { SelectMenuContent } from './SelectMenuContent'\nimport { SelectMenuItem } from './SelectMenuItem'\nimport { SelectMenuLabel } from './SelectMenuLabel'\nimport { SelectMenuSeparator } from './SelectMenuSeparator'\nimport { SelectMenuTrigger } from './SelectMenuTrigger'\n\ntype SelectMenuProps = React.ComponentProps<typeof RadixSelect.Root> & {\n size?: 'sm' | 'md' | 'lg'\n theme?: 'white' | 'grey'\n state?: 'error'\n}\n\nconst SelectMenuRoot = ({\n size = 'md',\n theme = 'grey',\n state,\n children,\n ...rest\n}: SelectMenuProps) => {\n const value = React.useMemo(\n () => ({ size, theme, state }),\n [size, theme, state]\n )\n return (\n <SelectMenuContext value={value}>\n <RadixSelect.Root {...rest}>{children}</RadixSelect.Root>\n </SelectMenuContext>\n )\n}\n\nexport const SelectMenu = /* @__PURE__ */ Object.assign(SelectMenuRoot, {\n Trigger: SelectMenuTrigger,\n Content: SelectMenuContent,\n Item: SelectMenuItem,\n Group: RadixSelect.Group,\n Label: SelectMenuLabel,\n Separator: SelectMenuSeparator\n})\n"],"mappings":";;;;;;;;;;AAgBA,IAAM,kBAAkB,EACtB,OAAO,MACP,QAAQ,QACR,OACA,UACA,GAAG,WACkB;CAKrB,OACE,oBAAC,mBAAD;EAA0B,OALd,QAAM,eACX;GAAE;GAAM;GAAO;EAAM,IAC5B;GAAC;GAAM;GAAO;EAAK,CAGO;YACxB,oBAAC,YAAY,MAAb;GAAkB,GAAI;GAAO;EAA2B,CAAA;CACvC,CAAA;AAEvB;AAEA,IAAa,aAA6B,uBAAO,OAAO,gBAAgB;CACtE,SAAS;CACT,SAAS;CACT,MAAM;CACN,OAAO,YAAY;CACnB,OAAO;CACP,WAAW;AACb,CAAC"}
1
+ {"version":3,"file":"SelectMenu.js","names":[],"sources":["../../../src/components/select-menu/SelectMenu.tsx"],"sourcesContent":["import * as React from 'react'\nimport * as AriaComponents from 'react-aria-components'\n\nimport { cn } from '../../styled'\nimport { SelectMenuContext } from './SelectMenu.context'\nimport { SelectMenuContent } from './SelectMenuContent'\nimport { SelectMenuItem } from './SelectMenuItem'\nimport { SelectMenuLabel } from './SelectMenuLabel'\nimport { SelectMenuSeparator } from './SelectMenuSeparator'\nimport { SelectMenuTrigger } from './SelectMenuTrigger'\n\ntype SelectMenuProps = Omit<\n AriaComponents.SelectProps<object>,\n 'className' | 'style' | 'children'\n> & {\n size?: 'sm' | 'md' | 'lg'\n theme?: 'white' | 'grey'\n state?: 'error'\n className?: string\n children?: React.ReactNode\n}\n\nconst SelectMenuRoot = ({\n size = 'md',\n theme = 'grey',\n state,\n className,\n children,\n ...rest\n}: SelectMenuProps) => {\n const value = React.useMemo(\n () => ({ size, theme, state }),\n [size, theme, state]\n )\n return (\n <SelectMenuContext value={value}>\n {/* w-full so the trigger fills its container even in flex/inline layouts\n (react-aria wraps the trigger in an extra div). Consumers can override\n the width — or anything else — via className, e.g. w-auto / w-64. */}\n <AriaComponents.Select className={cn('w-full', className)} {...rest}>\n {children}\n </AriaComponents.Select>\n </SelectMenuContext>\n )\n}\n\nexport const SelectMenu = /* @__PURE__ */ Object.assign(SelectMenuRoot, {\n Trigger: SelectMenuTrigger,\n Content: SelectMenuContent,\n Item: SelectMenuItem,\n Group: AriaComponents.ListBoxSection,\n Label: SelectMenuLabel,\n Separator: SelectMenuSeparator\n})\n"],"mappings":";;;;;;;;;;;AAsBA,IAAM,kBAAkB,EACtB,OAAO,MACP,QAAQ,QACR,OACA,WACA,UACA,GAAG,WACkB;CAKrB,OACE,oBAAC,mBAAD;EAA0B,OALd,QAAM,eACX;GAAE;GAAM;GAAO;EAAM,IAC5B;GAAC;GAAM;GAAO;EAAK,CAGO;YAIxB,oBAAC,eAAe,QAAhB;GAAuB,WAAW,GAAG,UAAU,SAAS;GAAG,GAAI;GAC5D;EACoB,CAAA;CACN,CAAA;AAEvB;AAEA,IAAa,aAA6B,uBAAO,OAAO,gBAAgB;CACtE,SAAS;CACT,SAAS;CACT,MAAM;CACN,OAAO,eAAe;CACtB,OAAO;CACP,WAAW;AACb,CAAC"}
@@ -1,5 +1,7 @@
1
- import * as RadixSelect from '@radix-ui/react-select';
2
1
  import * as React from 'react';
3
- type SelectMenuContentProps = React.ComponentPropsWithRef<typeof RadixSelect.Content>;
4
- export declare const SelectMenuContent: ({ ref, children, position, sideOffset, ...rest }: SelectMenuContentProps) => React.JSX.Element;
2
+ import * as AriaComponents from 'react-aria-components';
3
+ type SelectMenuContentProps = Omit<React.ComponentPropsWithRef<typeof AriaComponents.Popover>, 'children'> & {
4
+ children?: React.ReactNode;
5
+ };
6
+ export declare const SelectMenuContent: ({ ref, children, offset, ...rest }: SelectMenuContentProps) => React.JSX.Element;
5
7
  export {};
@@ -1,73 +1,32 @@
1
1
  import { styled } from "../../styled.js";
2
- import { Icon } from "../icon/Icon.js";
3
2
  import "react";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- import { ChevronDown, ChevronUp } from "@atom-learning/icons";
6
- import * as RadixSelect from "@radix-ui/react-select";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import * as AriaComponents from "react-aria-components";
7
5
  //#region src/components/select-menu/SelectMenuContent.tsx
8
- var Content = styled(RadixSelect.Content, {
9
- base: [
10
- "bg-white",
11
- "rounded-md",
12
- "shadow-lg",
13
- "z-10",
14
- "overflow-hidden",
15
- "will-change-transform",
16
- "will-change-opacity",
17
- "[--slide-opacity-out:0]",
18
- "data-[side=top]:[--slide-direction-out-y:-4px]",
19
- "data-[side=right]:[--slide-direction-out-x:4px]",
20
- "data-[side=bottom]:[--slide-direction-out-y:4px]",
21
- "data-[side=left]:[--slide-direction-out-x:-4px]",
22
- "motion-safe:data-[state=open]:animate-slide-direction-in",
23
- "motion-safe:data-[state=closed]:animate-slide-direction-out"
24
- ],
25
- variants: { position: {
26
- popper: ["max-h-(--radix-select-content-available-height)", "min-w-(--radix-select-trigger-width)"],
27
- "item-aligned": []
28
- } }
29
- });
30
- var Viewport = styled(RadixSelect.Viewport, {
31
- base: ["p-1", "w-full"],
32
- variants: { position: {
33
- popper: ["h-(--radix-select-content-available-height)"],
34
- "item-aligned": []
35
- } }
36
- });
37
- var ScrollUpButton = styled(RadixSelect.ScrollUpButton, { base: [
38
- "flex",
39
- "items-center",
40
- "justify-center",
41
- "h-6",
42
- "cursor-default"
43
- ] });
44
- var ScrollDownButton = styled(RadixSelect.ScrollDownButton, { base: [
45
- "flex",
46
- "items-center",
47
- "justify-center",
48
- "h-6",
49
- "cursor-default"
50
- ] });
51
- var SelectMenuContent = ({ ref, children, position = "popper", sideOffset = 4, ...rest }) => /* @__PURE__ */ jsx(RadixSelect.Portal, { children: /* @__PURE__ */ jsxs(Content, {
6
+ var Content = styled(AriaComponents.Popover, { base: [
7
+ "bg-white",
8
+ "rounded-md",
9
+ "shadow-lg",
10
+ "z-10",
11
+ "overflow-hidden",
12
+ "will-change-transform",
13
+ "min-w-[var(--trigger-width)]",
14
+ "max-w-[min(calc(100vw-(--spacing(4))),--spacing(100))]"
15
+ ] }, { enablePolymorphism: false });
16
+ var Viewport = styled(AriaComponents.ListBox, { base: [
17
+ "max-h-[inherit]",
18
+ "w-full",
19
+ "overflow-auto",
20
+ "p-1",
21
+ "outline-none"
22
+ ] }, { enablePolymorphism: false });
23
+ var SelectMenuContent = ({ ref, children, offset = 4, ...rest }) => /* @__PURE__ */ jsx(Content, {
52
24
  ref,
53
- position,
54
- sideOffset,
25
+ offset,
26
+ containerPadding: 8,
55
27
  ...rest,
56
- children: [
57
- /* @__PURE__ */ jsx(ScrollUpButton, { children: /* @__PURE__ */ jsx(Icon, {
58
- is: ChevronUp,
59
- className: "text-grey-700 size-4"
60
- }) }),
61
- /* @__PURE__ */ jsx(Viewport, {
62
- position,
63
- children
64
- }),
65
- /* @__PURE__ */ jsx(ScrollDownButton, { children: /* @__PURE__ */ jsx(Icon, {
66
- is: ChevronDown,
67
- className: "text-grey-700 size-4"
68
- }) })
69
- ]
70
- }) });
28
+ children: /* @__PURE__ */ jsx(Viewport, { children })
29
+ });
71
30
  //#endregion
72
31
  export { SelectMenuContent };
73
32
 
@@ -1 +1 @@
1
- {"version":3,"file":"SelectMenuContent.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuContent.tsx"],"sourcesContent":["import { ChevronDown, ChevronUp } from '@atom-learning/icons'\nimport * as RadixSelect from '@radix-ui/react-select'\nimport * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { Icon } from '../icon/Icon'\n\nconst Content = styled(RadixSelect.Content, {\n base: [\n 'bg-white',\n 'rounded-md',\n 'shadow-lg',\n 'z-10',\n 'overflow-hidden',\n 'will-change-transform',\n 'will-change-opacity',\n '[--slide-opacity-out:0]',\n 'data-[side=top]:[--slide-direction-out-y:-4px]',\n 'data-[side=right]:[--slide-direction-out-x:4px]',\n 'data-[side=bottom]:[--slide-direction-out-y:4px]',\n 'data-[side=left]:[--slide-direction-out-x:-4px]',\n 'motion-safe:data-[state=open]:animate-slide-direction-in',\n 'motion-safe:data-[state=closed]:animate-slide-direction-out'\n ],\n variants: {\n position: {\n popper: [\n 'max-h-(--radix-select-content-available-height)',\n 'min-w-(--radix-select-trigger-width)'\n ],\n 'item-aligned': []\n }\n }\n})\n\nconst Viewport = styled(RadixSelect.Viewport, {\n base: ['p-1', 'w-full'],\n variants: {\n position: {\n popper: ['h-(--radix-select-content-available-height)'],\n 'item-aligned': []\n }\n }\n})\n\nconst ScrollUpButton = styled(RadixSelect.ScrollUpButton, {\n base: ['flex', 'items-center', 'justify-center', 'h-6', 'cursor-default']\n})\n\nconst ScrollDownButton = styled(RadixSelect.ScrollDownButton, {\n base: ['flex', 'items-center', 'justify-center', 'h-6', 'cursor-default']\n})\n\ntype SelectMenuContentProps = React.ComponentPropsWithRef<\n typeof RadixSelect.Content\n>\n\nexport const SelectMenuContent = ({\n ref,\n children,\n position = 'popper',\n sideOffset = 4,\n ...rest\n}: SelectMenuContentProps) => (\n <RadixSelect.Portal>\n <Content ref={ref} position={position} sideOffset={sideOffset} {...rest}>\n <ScrollUpButton>\n <Icon is={ChevronUp} className=\"text-grey-700 size-4\" />\n </ScrollUpButton>\n <Viewport position={position}>{children}</Viewport>\n <ScrollDownButton>\n <Icon is={ChevronDown} className=\"text-grey-700 size-4\" />\n </ScrollDownButton>\n </Content>\n </RadixSelect.Portal>\n)\n"],"mappings":";;;;;;;AAOA,IAAM,UAAU,OAAO,YAAY,SAAS;CAC1C,MAAM;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,UAAU,EACR,UAAU;EACR,QAAQ,CACN,mDACA,sCACF;EACA,gBAAgB,CAAC;CACnB,EACF;AACF,CAAC;AAED,IAAM,WAAW,OAAO,YAAY,UAAU;CAC5C,MAAM,CAAC,OAAO,QAAQ;CACtB,UAAU,EACR,UAAU;EACR,QAAQ,CAAC,6CAA6C;EACtD,gBAAgB,CAAC;CACnB,EACF;AACF,CAAC;AAED,IAAM,iBAAiB,OAAO,YAAY,gBAAgB,EACxD,MAAM;CAAC;CAAQ;CAAgB;CAAkB;CAAO;AAAgB,EAC1E,CAAC;AAED,IAAM,mBAAmB,OAAO,YAAY,kBAAkB,EAC5D,MAAM;CAAC;CAAQ;CAAgB;CAAkB;CAAO;AAAgB,EAC1E,CAAC;AAMD,IAAa,qBAAqB,EAChC,KACA,UACA,WAAW,UACX,aAAa,GACb,GAAG,WAEH,oBAAC,YAAY,QAAb,EAAA,UACE,qBAAC,SAAD;CAAc;CAAe;CAAsB;CAAY,GAAI;WAAnE;EACE,oBAAC,gBAAD,EAAA,UACE,oBAAC,MAAD;GAAM,IAAI;GAAW,WAAU;EAAwB,CAAA,EACzC,CAAA;EAChB,oBAAC,UAAD;GAAoB;GAAW;EAAmB,CAAA;EAClD,oBAAC,kBAAD,EAAA,UACE,oBAAC,MAAD;GAAM,IAAI;GAAa,WAAU;EAAwB,CAAA,EACzC,CAAA;CACX;GACS,CAAA"}
1
+ {"version":3,"file":"SelectMenuContent.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuContent.tsx"],"sourcesContent":["import * as React from 'react'\nimport * as AriaComponents from 'react-aria-components'\n\nimport { styled } from '../../styled'\n\nconst Content = styled(\n AriaComponents.Popover,\n {\n base: [\n 'bg-white',\n 'rounded-md',\n 'shadow-lg',\n 'z-10',\n 'overflow-hidden',\n 'will-change-transform',\n // Floors at the trigger width; caps at min(viewport − 8px per edge, 400px)\n // on the --spacing() scale: --spacing(4)=16px (2×8px), --spacing(100)=400px.\n 'min-w-[var(--trigger-width)]',\n 'max-w-[min(calc(100vw-(--spacing(4))),--spacing(100))]'\n ]\n },\n { enablePolymorphism: false }\n)\n\nconst Viewport = styled(\n AriaComponents.ListBox,\n {\n base: ['max-h-[inherit]', 'w-full', 'overflow-auto', 'p-1', 'outline-none']\n },\n { enablePolymorphism: false }\n)\n\ntype SelectMenuContentProps = Omit<\n React.ComponentPropsWithRef<typeof AriaComponents.Popover>,\n 'children'\n> & {\n children?: React.ReactNode\n}\n\nexport const SelectMenuContent = ({\n ref,\n children,\n offset = 4,\n ...rest\n}: SelectMenuContentProps) => (\n // offset/containerPadding are react-aria positioner props in px (JS numbers,\n // not CSS), so they can't use the --spacing() scale: 4px gap from the trigger,\n // 8px minimum inset from every viewport edge (the 2×8px behind the max-width).\n <Content ref={ref} offset={offset} containerPadding={8} {...rest}>\n <Viewport>{children}</Viewport>\n </Content>\n)\n"],"mappings":";;;;;AAKA,IAAM,UAAU,OACd,eAAe,SACf,EACE,MAAM;CACJ;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;AACF,EACF,GACA,EAAE,oBAAoB,MAAM,CAC9B;AAEA,IAAM,WAAW,OACf,eAAe,SACf,EACE,MAAM;CAAC;CAAmB;CAAU;CAAiB;CAAO;AAAc,EAC5E,GACA,EAAE,oBAAoB,MAAM,CAC9B;AASA,IAAa,qBAAqB,EAChC,KACA,UACA,SAAS,GACT,GAAG,WAKH,oBAAC,SAAD;CAAc;CAAa;CAAQ,kBAAkB;CAAG,GAAI;WAC1D,oBAAC,UAAD,EAAW,SAAmB,CAAA;AACvB,CAAA"}
@@ -1,5 +1,7 @@
1
- import * as RadixSelect from '@radix-ui/react-select';
2
1
  import * as React from 'react';
3
- type SelectMenuItemProps = React.ComponentPropsWithRef<typeof RadixSelect.Item>;
4
- export declare const SelectMenuItem: ({ ref, children, ...rest }: SelectMenuItemProps) => React.JSX.Element;
2
+ import * as AriaComponents from 'react-aria-components';
3
+ type SelectMenuItemProps = Omit<AriaComponents.ListBoxItemProps, 'children'> & {
4
+ children?: React.ReactNode;
5
+ };
6
+ export declare const SelectMenuItem: ({ children, textValue, ...rest }: SelectMenuItemProps) => React.JSX.Element;
5
7
  export {};