@atom-learning/components 2.15.0 → 2.17.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/CHANGELOG.md CHANGED
@@ -1,9 +1,14 @@
1
- # [2.15.0](https://github.com/Atom-Learning/components/compare/v2.14.0...v2.15.0) (2022-11-11)
1
+ # [2.17.0](https://github.com/Atom-Learning/components/compare/v2.16.0...v2.17.0) (2022-11-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * workaround to only render first page of rows ([559b469](https://github.com/Atom-Learning/components/commit/559b469fb986fcdc3f50567e182253a15731ecbf))
2
7
 
3
8
 
4
9
  ### Features
5
10
 
6
- * pass onClick prop onto anchor links ([b44883d](https://github.com/Atom-Learning/components/commit/b44883d05b4a72814640155c443b3f4a10eb4303))
11
+ * accept initialState for DataTable ([f230794](https://github.com/Atom-Learning/components/commit/f230794aaf57174145efd2609bdb6f0a6dcdecf0))
7
12
 
8
13
  # [1.4.0](https://github.com/Atom-Learning/components/compare/v1.3.0...v1.4.0) (2022-04-11)
9
14
 
@@ -1,11 +1,12 @@
1
1
  import * as React from 'react';
2
- import type { Table } from '@tanstack/react-table';
2
+ import type { VisibilityTableState, ColumnOrderTableState, ColumnPinningTableState, FiltersTableState, SortingTableState, ExpandedTableState, GroupingTableState, ColumnSizingTableState, PaginationTableState, RowSelectionTableState, Table } from '@tanstack/react-table';
3
3
  declare type DataTableContextType<T = unknown> = Table<T> & {
4
4
  setIsSortable: React.Dispatch<React.SetStateAction<boolean>>;
5
5
  applyPagination: () => void;
6
6
  getTotalRows: () => number;
7
7
  isSortable: boolean;
8
8
  };
9
+ declare type InitialState = Partial<VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationTableState & RowSelectionTableState>;
9
10
  declare type TableProviderProps = {
10
11
  columns: any;
11
12
  data: Array<Record<string, unknown>>;
@@ -14,7 +15,8 @@ declare type TableProviderProps = {
14
15
  direction: 'asc' | 'desc';
15
16
  };
16
17
  children: React.ReactNode;
18
+ initialState?: InitialState;
17
19
  };
18
- export declare const DataTableProvider: ({ columns, data, defaultSort, children }: TableProviderProps) => JSX.Element;
20
+ export declare const DataTableProvider: ({ columns, data, defaultSort, initialState, children }: TableProviderProps) => JSX.Element;
19
21
  export declare const useDataTable: <T extends Record<string, unknown>>() => DataTableContextType<T>;
20
22
  export {};
@@ -1 +1 @@
1
- import*as e from"react";import{useReactTable as R,getCoreRowModel as M,getPaginationRowModel as S,getSortedRowModel as T,getFilteredRowModel as p}from"@tanstack/react-table";const s=e.createContext(null),v=({columns:t,data:l,defaultSort:o,children:g})=>{const[u,c]=e.useState(!1),[a,w]=e.useState(!1),[r,b]=e.useState(o?[{id:o.column,desc:o.direction==="desc"}]:[]),n=e.useCallback(()=>{c(!0)},[]),d=()=>l.length,i=R({columns:t,data:l,getCoreRowModel:M(),getPaginationRowModel:u?S():void 0,getSortedRowModel:a||r.length?T():void 0,state:{sorting:r},onSortingChange:b,getFilteredRowModel:p()}),m=e.useMemo(()=>({...i,setIsSortable:w,applyPagination:n,getTotalRows:d,isSortable:a}),[i,n,d,a]);return e.createElement(s.Provider,{value:m},g)},C=()=>{const t=e.useContext(s);if(!t)throw new Error("useDataTable can only be called from inside a DataTableProvider");return t};export{v as DataTableProvider,C as useDataTable};
1
+ import*as e from"react";import{useReactTable as R,getCoreRowModel as M,getPaginationRowModel as p,getSortedRowModel as v,getFilteredRowModel as C}from"@tanstack/react-table";const g=e.createContext(null),P=({columns:t,data:n,defaultSort:o,initialState:a=void 0,children:u})=>{const[c,S]=e.useState(!!(a!=null&&a.pagination)),[l,w]=e.useState(!1),[r,b]=e.useState(o?[{id:o.column,desc:o.direction==="desc"}]:[]),i=e.useCallback(()=>{S(!0)},[]),d=()=>n.length,s=R({columns:t,data:n,getCoreRowModel:M(),getPaginationRowModel:c?p():void 0,getSortedRowModel:l||r.length?v():void 0,initialState:a,state:{sorting:r},onSortingChange:b,getFilteredRowModel:C()}),m=e.useMemo(()=>({...s,setIsSortable:w,applyPagination:i,getTotalRows:d,isSortable:l}),[s,i,d,l]);return e.createElement(g.Provider,{value:m},u)},T=()=>{const t=e.useContext(g);if(!t)throw new Error("useDataTable can only be called from inside a DataTableProvider");return t};export{P as DataTableProvider,T as useDataTable};
@@ -1,13 +1,17 @@
1
1
  import React from 'react';
2
2
  import { CSS } from '../../stitches';
3
3
  import { NavigationMenuDropdown } from './NavigationMenuDropdown';
4
- import { NavigationMenuDropdownContent, NavigationMenuDropdownItem, NavigationMenuDropdownItemTitle, NavigationMenuLink } from './NavigationMenuItem';
4
+ import { NavigationMenuDropdownContent } from './NavigationMenuDropdownContent';
5
+ import { NavigationMenuDropdownItem, NavigationMenuDropdownItemTitle } from './NavigationMenuDropdownItem';
6
+ import { NavigationMenuDropdownTrigger } from './NavigationMenuDropdownTrigger';
7
+ import { NavigationMenuLink } from './NavigationMenuLink';
5
8
  declare type NavigationMenuSubComponents = {
6
9
  Link: typeof NavigationMenuLink;
7
10
  Dropdown: typeof NavigationMenuDropdown;
8
11
  DropdownContent: typeof NavigationMenuDropdownContent;
9
12
  DropdownItem: typeof NavigationMenuDropdownItem;
10
13
  DropdownItemTitle: typeof NavigationMenuDropdownItemTitle;
14
+ DropdownTrigger: typeof NavigationMenuDropdownTrigger;
11
15
  };
12
16
  declare type NavigationMenuProps = {
13
17
  css?: CSS;
@@ -1 +1 @@
1
- import*as l from"@radix-ui/react-navigation-menu";import t from"react";import{MAX_Z_INDEX as N}from"../../constants/zIndices.js";import{keyframes as w,styled as n}from"../../stitches.js";import{fadeOut as D}from"../../utilities/style/keyframe-animations.js";import{NavigationMenuContext as x}from"./NavigationMenuContext.js";import{NavigationMenuDropdown as E}from"./NavigationMenuDropdown.js";import{NavigationMenuLink as h,NavigationMenuDropdownContent as C,NavigationMenuDropdownItem as I,NavigationMenuDropdownItemTitle as $}from"./NavigationMenuItem.js";const L=w({"0%, 50%":{opacity:0},"100%":{opacity:1}}),T=n(l.Root,{display:"flex",justifyContent:"center",position:"relative"}),_=n(l.List,{all:"unset",display:"flex",justifyContent:"center",alignItems:"center",gap:"$1",listStyle:"none"}),k=n(l.Viewport,{zIndex:N}),S=n("div",{position:"absolute",left:0,top:"100%",width:"100%",display:"flex",justifyContent:"center"}),o=({children:f,css:m})=>{const[p,u]=t.useState(),[a,d]=t.useState(),[i,c]=t.useState(0),r=t.useRef(null),s=200;t.useLayoutEffect(()=>{r.current&&c(r.current.offsetWidth)},[]),t.useEffect(()=>{let e;return a===""&&(e=setTimeout(()=>u(null),s)),()=>{e!==null&&clearTimeout(e)}},[a]);const y=(e,v)=>{if(e&&i&&a===v){const g=i/2,M=i-e.offsetLeft-e.offsetWidth+e.offsetWidth/2;u(Math.round(g-M))}return e};return t.createElement(x.Provider,{value:{onNodeUpdate:y}},t.createElement(T,{onValueChange:d,css:m},t.createElement(_,{ref:r},f),t.createElement(S,null,t.createElement(k,{css:{transform:`translateX(${p||0}px)`,'&[data-state="open"]':{animation:`${L} ${s}ms ease`},'&[data-state="closed"]':{animation:`${D} ${s}ms ease-out`}}}))))};o.Link=h,o.Dropdown=E,o.DropdownContent=C,o.DropdownItem=I,o.DropdownItemTitle=$,o.displayName="NavigationMenu";export{o as NavigationMenu};
1
+ import*as m from"@radix-ui/react-navigation-menu";import t from"react";import{MAX_Z_INDEX as N}from"../../constants/zIndices.js";import{keyframes as D,styled as n}from"../../stitches.js";import{fadeOut as M}from"../../utilities/style/keyframe-animations.js";import{NavigationMenuContext as E}from"./NavigationMenuContext.js";import{NavigationMenuDropdown as x}from"./NavigationMenuDropdown.js";import{NavigationMenuDropdownContent as h}from"./NavigationMenuDropdownContent.js";import{NavigationMenuDropdownItem as C,NavigationMenuDropdownItemTitle as I}from"./NavigationMenuDropdownItem.js";import{NavigationMenuDropdownTrigger as $}from"./NavigationMenuDropdownTrigger.js";import{NavigationMenuLink as T}from"./NavigationMenuLink.js";const L=D({"0%, 50%":{opacity:0},"100%":{opacity:1}}),_=n(m.Root,{display:"flex",justifyContent:"center",position:"relative"}),k=n(m.List,{all:"unset",display:"flex",justifyContent:"center",alignItems:"center",gap:"$1",listStyle:"none"}),S=n(m.Viewport,{zIndex:N}),j=n("div",{position:"absolute",left:0,top:"100%",width:"100%",display:"flex",justifyContent:"center"}),o=({children:f,css:u})=>{const[p,l]=t.useState(),[r,d]=t.useState(),[i,c]=t.useState(0),a=t.useRef(null),s=200;t.useLayoutEffect(()=>{a.current&&c(a.current.offsetWidth)},[]),t.useEffect(()=>{let e;return r===""&&(e=setTimeout(()=>l(null),s)),()=>{e!==null&&clearTimeout(e)}},[r]);const g=(e,y)=>{if(e&&i&&r===y){const v=i/2,w=i-e.offsetLeft-e.offsetWidth+e.offsetWidth/2;l(Math.round(v-w))}return e};return t.createElement(E.Provider,{value:{onNodeUpdate:g}},t.createElement(_,{onValueChange:d,css:u},t.createElement(k,{ref:a},f),t.createElement(j,null,t.createElement(S,{css:{transform:`translateX(${p||0}px)`,'&[data-state="open"]':{animation:`${L} ${s}ms ease`},'&[data-state="closed"]':{animation:`${M} ${s}ms ease-out`}}}))))};o.Link=T,o.Dropdown=x,o.DropdownContent=h,o.DropdownItem=C,o.DropdownItemTitle=I,o.DropdownTrigger=$,o.displayName="NavigationMenu";export{o as NavigationMenu};
@@ -0,0 +1,50 @@
1
+ export declare const navigationMenuDisabledItemStyles: {
2
+ background: string;
3
+ color: string;
4
+ opacity: string;
5
+ cursor: string;
6
+ };
7
+ export declare const navigationMenuBaseItemStyles: {
8
+ all: string;
9
+ position: string;
10
+ color: string;
11
+ outline: string;
12
+ cursor: string;
13
+ fontFamily: string;
14
+ userSelect: string;
15
+ padding: string;
16
+ borderRadius: string;
17
+ '&:hover': {
18
+ background: string;
19
+ color: string;
20
+ };
21
+ '&:active': {
22
+ background: string;
23
+ color: string;
24
+ };
25
+ '&:focus-visible': {
26
+ boxShadow: string;
27
+ };
28
+ '&:disabled': {
29
+ background: string;
30
+ color: string;
31
+ opacity: string;
32
+ cursor: string;
33
+ };
34
+ };
35
+ export declare const navigationMenuActiveItemStyles: {
36
+ fontWeight: string;
37
+ color: string;
38
+ '&::after': {
39
+ backgroundColor: string;
40
+ borderRadius: string;
41
+ bottom: number;
42
+ content: string;
43
+ display: string;
44
+ height: string;
45
+ left: string;
46
+ position: string;
47
+ transform: string;
48
+ width: string;
49
+ };
50
+ };
@@ -0,0 +1 @@
1
+ const o={background:"none",color:"$tonal400",opacity:"30%",cursor:"default"},t={all:"unset",position:"relative",color:"$tonal400",outline:"none",cursor:"pointer",fontFamily:"$body",userSelect:"none",padding:"$3",borderRadius:"$1","&:hover":{background:"$tonal50",color:"$tonal600"},"&:active":{background:"$tonal100",color:"$tonal600"},"&:focus-visible":{boxShadow:"inset 0 0 0 2px $colors$primary"},"&:disabled":{...o}},n={fontWeight:"600",color:"$tonal500","&::after":{backgroundColor:"$tonal500",borderRadius:"$1",bottom:0,content:"",display:"block",height:"2px",left:"50%",position:"absolute",transform:"translate(-50%,0)",width:"$2"}};export{n as navigationMenuActiveItemStyles,t as navigationMenuBaseItemStyles,o as navigationMenuDisabledItemStyles};
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
+ import { CSS } from '../../stitches';
2
3
  declare type NavigationMenuDropdownProps = {
3
- title: string;
4
4
  active?: boolean;
5
+ css?: CSS;
6
+ id: string;
5
7
  } & React.HTMLProps<HTMLButtonElement>;
6
8
  export declare const NavigationMenuDropdown: React.FC<NavigationMenuDropdownProps>;
7
9
  export {};
@@ -1 +1 @@
1
- import*as o from"@radix-ui/react-navigation-menu";import t from"react";import{styled as p}from"../../stitches.js";import{useNavigationMenuContext as m}from"./NavigationMenuContext.js";import{NavigationMenuDropdownTrigger as d}from"./NavigationMenuItem.js";const l=p(o.Content,{p:"$3",bg:"white",mt:"4px",boxShadow:"0px 3px 6px rgba(51, 51, 51, 0.15), 0px 3px 6px rgba(51, 51, 51, 0.2)",borderRadius:"$1"}),u=({children:r,title:e,...n})=>{const{onNodeUpdate:a}=m();return t.createElement(o.Item,{value:e},t.createElement(d,{...n,ref:i=>a(i,e)},e),t.createElement(l,null,r))};export{u as NavigationMenuDropdown};
1
+ import*as l from"@radix-ui/react-navigation-menu";import n from"react";import{useNavigationMenuContext as u}from"./NavigationMenuContext.js";import{NavigationMenuDropdownContent as g}from"./NavigationMenuDropdownContent.js";import{NavigationMenuDropdownTrigger as s}from"./NavigationMenuDropdownTrigger.js";const i=({children:r,id:t,...a})=>{const{onNodeUpdate:p}=u();return n.createElement(l.Item,{value:t},n.Children.map(r,e=>{const o=n.isValidElement(e)&&e.type===s,d=n.isValidElement(e)&&e.type===g;if(!o&&!d)throw new Error('Only NavigationMenu.Trigger and NavigationMenu.Content can be the passed as a "children" of NavigationMenu.Dropdown');return o?n.cloneElement(e,{...a,ref:m=>p(m,t)}):e}))};i.displayName="NavigationMenuDropdown";export{i as NavigationMenuDropdown};
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const NavigationMenuDropdownContent: {
3
+ ({ children }: {
4
+ children: any;
5
+ }): JSX.Element;
6
+ displayName: string;
7
+ };
@@ -0,0 +1 @@
1
+ import*as p from"@radix-ui/react-navigation-menu";import t from"react";import{styled as o}from"../../stitches.js";const r=o("ul",{listStyle:"none"}),a=o(p.Content,{p:"$3",bg:"white",mt:"4px",boxShadow:"0px 3px 6px rgba(51, 51, 51, 0.15), 0px 3px 6px rgba(51, 51, 51, 0.2)",borderRadius:"$1"}),e=({children:n})=>t.createElement(a,null,t.createElement(r,null,n));e.displayName="NavigationMenuDropdownContent";export{e as NavigationMenuDropdownContent};
@@ -1,5 +1,19 @@
1
1
  import React from 'react';
2
- import { CSS } from '../../stitches';
2
+ export declare const NavigationMenuDropdownItem: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<{
3
+ href: string;
4
+ active?: boolean | undefined;
5
+ disabled?: boolean | undefined;
6
+ variant?: "link" | "dropdownItem" | undefined;
7
+ css?: import("../../stitches").CSS | undefined;
8
+ } & {
9
+ children?: React.ReactNode;
10
+ } & React.RefAttributes<HTMLAnchorElement>>, "key" | "children" | keyof {
11
+ href: string;
12
+ active?: boolean | undefined;
13
+ disabled?: boolean | undefined;
14
+ variant?: "link" | "dropdownItem" | undefined;
15
+ css?: import("../../stitches").CSS | undefined;
16
+ }> & React.RefAttributes<HTMLAnchorElement>>;
3
17
  export declare const NavigationMenuDropdownItemTitle: import("@stitches/react/types/styled-component").StyledComponent<React.ForwardRefExoticComponent<Omit<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "key" | keyof React.HTMLAttributes<HTMLParagraphElement>> & {
4
18
  ref?: ((instance: HTMLParagraphElement | null) => void) | React.RefObject<HTMLParagraphElement> | null | undefined;
5
19
  }, "size" | "css" | "noCapsize"> & import("@stitches/react/types/styled-component").TransformProps<{
@@ -540,288 +554,3 @@ export declare const NavigationMenuDropdownItemTitle: import("@stitches/react/ty
540
554
  };
541
555
  };
542
556
  }>>;
543
- export declare const NavigationMenuDropdownTrigger: React.ForwardRefExoticComponent<{
544
- active?: boolean | undefined;
545
- } & {
546
- children?: React.ReactNode;
547
- } & React.RefAttributes<HTMLButtonElement>>;
548
- export declare const NavigationMenuDropdownContent: import("@stitches/react/types/styled-component").StyledComponent<"ul", {}, {
549
- sm: string;
550
- md: string;
551
- lg: string;
552
- xl: string;
553
- reducedMotion: string;
554
- allowMotion: string;
555
- hover: string;
556
- }, import("@stitches/react/types/css-util").CSS<{
557
- sm: string;
558
- md: string;
559
- lg: string;
560
- xl: string;
561
- reducedMotion: string;
562
- allowMotion: string;
563
- hover: string;
564
- }, {
565
- colors: {
566
- textForeground: any;
567
- textSubtle: any;
568
- textPlaceholder: any;
569
- background: any;
570
- backgroundAccent: any;
571
- tonal50: any;
572
- tonal100: any;
573
- tonal200: any;
574
- tonal300: any;
575
- tonal400: any;
576
- tonal500: any;
577
- tonal600: any;
578
- alpha100: any;
579
- alpha150: any;
580
- alpha200: any;
581
- alpha250: any;
582
- alpha600: any;
583
- primaryLight: any;
584
- primary: any;
585
- primaryMid: any;
586
- primaryDark: any;
587
- secondary: any;
588
- brandRed: any;
589
- brandRedAccent: any;
590
- brandGreen: any;
591
- brandGreenAccent: any;
592
- brandPurple: any;
593
- brandPurpleAccent: any;
594
- brandYellow: any;
595
- brandYellowAccent: any;
596
- successLight: any;
597
- success: any;
598
- successMid: any;
599
- successDark: any;
600
- dangerLight: any;
601
- danger: any;
602
- dangerMid: any;
603
- dangerDark: any;
604
- warningLight: any;
605
- warning: any;
606
- warningMid: any;
607
- warningDark: any;
608
- warningText: any;
609
- subjectEnglish: any;
610
- subjectMaths: any;
611
- subjectScience: any;
612
- subjectVerbalReasoning: any;
613
- subjectNonVerbalReasoning: any;
614
- subjectCreativeWriting: any;
615
- subjectExamSkills: any;
616
- };
617
- space: {
618
- "0": any;
619
- "1": any;
620
- "2": any;
621
- "3": any;
622
- "4": any;
623
- "5": any;
624
- "6": any;
625
- "7": any;
626
- "8": any;
627
- "9": any;
628
- };
629
- fontSizes: {
630
- xs: any;
631
- sm: any;
632
- md: any;
633
- lg: any;
634
- xl: any;
635
- "2xl": any;
636
- "3xl": any;
637
- "4xl": any;
638
- };
639
- fonts: {
640
- sans: any;
641
- mono: any;
642
- display: any;
643
- body: any;
644
- };
645
- sizes: {
646
- "0": any;
647
- "1": any;
648
- "2": any;
649
- "3": any;
650
- "4": any;
651
- "5": any;
652
- "6": any;
653
- "7": any;
654
- "8": any;
655
- };
656
- radii: {
657
- "0": any;
658
- "1": any;
659
- "2": any;
660
- "3": any;
661
- round: any;
662
- };
663
- shadows: {
664
- "0": any;
665
- "1": any;
666
- "2": any;
667
- "3": any;
668
- };
669
- }, import("@stitches/react/types/config").DefaultThemeMap, {
670
- bg: (value: {
671
- readonly [$$PropertyValue]: "background";
672
- }) => {
673
- background: {
674
- readonly [$$PropertyValue]: "background";
675
- };
676
- };
677
- inset: (value: string | number | {
678
- readonly [$$ScaleValue]: "space";
679
- }) => {
680
- top: string | number | {
681
- readonly [$$ScaleValue]: "space";
682
- };
683
- right: string | number | {
684
- readonly [$$ScaleValue]: "space";
685
- };
686
- bottom: string | number | {
687
- readonly [$$ScaleValue]: "space";
688
- };
689
- left: string | number | {
690
- readonly [$$ScaleValue]: "space";
691
- };
692
- };
693
- size: (value: string | number | {
694
- readonly [$$ScaleValue]: "size";
695
- }) => {
696
- height: string | number | {
697
- readonly [$$ScaleValue]: "size";
698
- };
699
- width: string | number | {
700
- readonly [$$ScaleValue]: "size";
701
- };
702
- };
703
- p: (value: string | number | {
704
- readonly [$$ScaleValue]: "space";
705
- }) => {
706
- padding: string | number | {
707
- readonly [$$ScaleValue]: "space";
708
- };
709
- };
710
- pt: (value: string | number | {
711
- readonly [$$ScaleValue]: "space";
712
- }) => {
713
- paddingTop: string | number | {
714
- readonly [$$ScaleValue]: "space";
715
- };
716
- };
717
- pr: (value: string | number | {
718
- readonly [$$ScaleValue]: "space";
719
- }) => {
720
- paddingRight: string | number | {
721
- readonly [$$ScaleValue]: "space";
722
- };
723
- };
724
- pb: (value: string | number | {
725
- readonly [$$ScaleValue]: "space";
726
- }) => {
727
- paddingBottom: string | number | {
728
- readonly [$$ScaleValue]: "space";
729
- };
730
- };
731
- pl: (value: string | number | {
732
- readonly [$$ScaleValue]: "space";
733
- }) => {
734
- paddingLeft: string | number | {
735
- readonly [$$ScaleValue]: "space";
736
- };
737
- };
738
- px: (value: string | number | {
739
- readonly [$$ScaleValue]: "space";
740
- }) => {
741
- paddingLeft: string | number | {
742
- readonly [$$ScaleValue]: "space";
743
- };
744
- paddingRight: string | number | {
745
- readonly [$$ScaleValue]: "space";
746
- };
747
- };
748
- py: (value: string | number | {
749
- readonly [$$ScaleValue]: "space";
750
- }) => {
751
- paddingTop: string | number | {
752
- readonly [$$ScaleValue]: "space";
753
- };
754
- paddingBottom: string | number | {
755
- readonly [$$ScaleValue]: "space";
756
- };
757
- };
758
- m: (value: string | number | {
759
- readonly [$$ScaleValue]: "space";
760
- }) => {
761
- margin: string | number | {
762
- readonly [$$ScaleValue]: "space";
763
- };
764
- };
765
- mt: (value: string | number | {
766
- readonly [$$ScaleValue]: "space";
767
- }) => {
768
- marginTop: string | number | {
769
- readonly [$$ScaleValue]: "space";
770
- };
771
- };
772
- mr: (value: string | number | {
773
- readonly [$$ScaleValue]: "space";
774
- }) => {
775
- marginRight: string | number | {
776
- readonly [$$ScaleValue]: "space";
777
- };
778
- };
779
- mb: (value: string | number | {
780
- readonly [$$ScaleValue]: "space";
781
- }) => {
782
- marginBottom: string | number | {
783
- readonly [$$ScaleValue]: "space";
784
- };
785
- };
786
- ml: (value: string | number | {
787
- readonly [$$ScaleValue]: "space";
788
- }) => {
789
- marginLeft: string | number | {
790
- readonly [$$ScaleValue]: "space";
791
- };
792
- };
793
- mx: (value: string | number | {
794
- readonly [$$ScaleValue]: "space";
795
- }) => {
796
- marginLeft: string | number | {
797
- readonly [$$ScaleValue]: "space";
798
- };
799
- marginRight: string | number | {
800
- readonly [$$ScaleValue]: "space";
801
- };
802
- };
803
- my: (value: string | number | {
804
- readonly [$$ScaleValue]: "space";
805
- }) => {
806
- marginTop: string | number | {
807
- readonly [$$ScaleValue]: "space";
808
- };
809
- marginBottom: string | number | {
810
- readonly [$$ScaleValue]: "space";
811
- };
812
- };
813
- }>>;
814
- declare type NavigationMenuLinkProps = {
815
- href: string;
816
- active?: boolean;
817
- disabled?: boolean;
818
- variant?: 'link' | 'dropdownItem';
819
- css?: CSS;
820
- };
821
- export declare const NavigationMenuLink: React.ForwardRefExoticComponent<NavigationMenuLinkProps & {
822
- children?: React.ReactNode;
823
- } & React.RefAttributes<HTMLAnchorElement>>;
824
- export declare const NavigationMenuDropdownItem: React.ForwardRefExoticComponent<NavigationMenuLinkProps & {
825
- children?: React.ReactNode;
826
- } & React.RefAttributes<HTMLAnchorElement>>;
827
- export {};
@@ -0,0 +1 @@
1
+ import o from"react";import{styled as a}from"../../stitches.js";import{Text as r}from"../text/Text.js";import{NavigationMenuLink as m}from"./NavigationMenuLink.js";const t=o.forwardRef((i,n)=>o.createElement(m,{ref:n,variant:"dropdownItem",...i})),e=a(r,{color:"$tonal500",fontWeight:600});t.displayName="NavigationMenuDropdownItem",e.displayName="NavigationMenuDropdownItemTitle";export{t as NavigationMenuDropdownItem,e as NavigationMenuDropdownItemTitle};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare const NavigationMenuDropdownTrigger: React.ForwardRefExoticComponent<{
3
+ active?: boolean | undefined;
4
+ } & {
5
+ children?: React.ReactNode;
6
+ } & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1 @@
1
+ import{ChevronDown as i}from"@atom-learning/icons";import*as s from"@radix-ui/react-navigation-menu";import e from"react";import{styled as m}from"../../stitches.js";import{Icon as p}from"../icon/Icon.js";import{navigationMenuBaseItemStyles as d,navigationMenuActiveItemStyles as c}from"./NavigationMenu.styles.js";const f=m(s.Trigger,d,{display:"flex",alignItems:"center",borderRadius:"$1",justifyContent:"space-between",gap:"$1",'&[data-state="open"]':{background:"$tonal100"},variants:{active:{true:{...c}}}}),t=e.forwardRef(({children:r,active:o,...a},n)=>e.createElement(f,{active:o,...a,ref:n},r,e.createElement(p,{is:i,css:{"[data-state=open] &":{transform:"rotate(-180deg)"},"@media (prefers-reduced-motion: no-preference)":{transition:"transform .2s ease"}},size:"sm"})));t.displayName="NavigationMenuDropdownTrigger";export{t as NavigationMenuDropdownTrigger};
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { CSS } from '../../stitches';
3
+ declare type NavigationMenuLinkProps = {
4
+ href: string;
5
+ active?: boolean;
6
+ disabled?: boolean;
7
+ variant?: 'link' | 'dropdownItem';
8
+ css?: CSS;
9
+ };
10
+ export declare const NavigationMenuLink: React.ForwardRefExoticComponent<NavigationMenuLinkProps & {
11
+ children?: React.ReactNode;
12
+ } & React.RefAttributes<HTMLAnchorElement>>;
13
+ export {};
@@ -0,0 +1 @@
1
+ import*as o from"@radix-ui/react-navigation-menu";import e from"react";import{styled as t}from"../../stitches.js";import{navigationMenuBaseItemStyles as n,navigationMenuDisabledItemStyles as p,navigationMenuActiveItemStyles as v}from"./NavigationMenu.styles.js";const u=t("button",{...n,...p}),y=t(o.Item),f=t(o.Link,n,{display:"block",textDecoration:"none",lineHeight:1,variants:{elementType:{dropdownItem:{"&[data-active]":{background:"$primaryLight",color:"$primary","*":{color:"$primary"},"&:hover":{background:"$tonal50"},"&:active":{background:"$tonal100"},"&:focus-visible":{boxShadow:"0 0 0 2px $colors$primary"}}},link:{"&[data-active]":{...v}}}}}),r=e.forwardRef(({children:a,href:l,disabled:m,css:s,variant:c="link",...i},d)=>m?e.createElement(u,{disabled:!0,...i},a):e.createElement(y,null,e.createElement(f,{href:l,ref:d,elementType:c,css:s,...i},a)));r.displayName="NavigationMenuLink";export{r as NavigationMenuLink};