@atom-learning/components 4.3.2 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/segmented-control/SegmentedControl.d.ts +743 -368
- package/dist/components/segmented-control/SegmentedControlHeading.d.ts +375 -1
- package/dist/components/segmented-control/SegmentedControlHeading.js +1 -1
- package/dist/components/segmented-control/SegmentedControlHeading.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControlItem.d.ts +368 -369
- package/dist/components/segmented-control/SegmentedControlItem.js +1 -1
- package/dist/components/segmented-control/SegmentedControlItem.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControlItemList.js +1 -1
- package/dist/components/segmented-control/SegmentedControlItemList.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControlRoot.d.ts +14 -15
- package/dist/components/tabs/Tabs.d.ts +14 -15
- package/dist/components/tabs/TabsTrigger.d.ts +357 -360
- package/dist/components/tabs/TabsTrigger.js +1 -1
- package/dist/components/tabs/TabsTrigger.js.map +1 -1
- package/dist/docgen.json +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as e from"react";import{styled as n}from"../../stitches.js";import{Tabs as d}from"../tabs/Tabs.js";import{useSegmentedControl as m}from"./SegmentedControlContext.js";const p=n(d.Trigger,{position:"relative",bg:"transparent",borderRadius:"$2",p:0,zIndex:2,minWidth:"140px",border:"2px solid transparent",variants:{theme:{primary:{"&[data-state=inactive]:hover":{bg:"$primary300"},"&:focus-visible":{borderColor:"$primary800"}},marsh:{"&[data-state=inactive]:hover":{bg:"$marsh300"},"&:focus-visible":{borderColor:"$marsh800"}}},size:{sm:{flex:"unset",p:"$4 $24",gap:"$3"},md:{flex:1,p:"$24 $4",gap:"$4"},lg:{flex:1,p:"$24 $4",gap:"$4"}}},"& > div":{display:"none"},"&[data-state=active]":{boxShadow:"none",border:"2px solid transparent",fontWeight:600,color:"$textBold","&:focus-visible":{boxShadow:"none",borderColor:"$primary800"}},"&[data-state=inactive]":{fontWeight:400,color:"$grey900"},"&[disabled]":{opacity:.3}}),r=e.forwardRef(({children:t,...o},a)=>{const{size:i,theme:s}=m();return e.createElement(p,{...o,theme:s,size:i,ref:a},t)});r.displayName="SegmentedControlItem";export{r as SegmentedControlItem};
|
|
2
2
|
//# sourceMappingURL=SegmentedControlItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControlItem.js","sources":["../../../src/components/segmented-control/SegmentedControlItem.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport {
|
|
1
|
+
{"version":3,"file":"SegmentedControlItem.js","sources":["../../../src/components/segmented-control/SegmentedControlItem.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Tabs } from '../tabs'\nimport { useSegmentedControl } from './SegmentedControlContext'\n\nconst StyledItem = styled(Tabs.Trigger, {\n position: 'relative',\n bg: 'transparent',\n borderRadius: '$2',\n p: 0,\n zIndex: 2,\n minWidth: '140px',\n border: '2px solid transparent',\n variants: {\n theme: {\n primary: {\n '&[data-state=inactive]:hover': {\n bg: '$primary300'\n },\n '&:focus-visible': {\n borderColor: '$primary800'\n }\n },\n marsh: {\n '&[data-state=inactive]:hover': {\n bg: '$marsh300'\n },\n '&:focus-visible': {\n borderColor: '$marsh800'\n }\n }\n },\n size: {\n sm: {\n flex: 'unset',\n p: '$4 $24',\n gap: '$3'\n },\n md: {\n flex: 1,\n p: '$24 $4',\n gap: '$4'\n },\n lg: {\n flex: 1,\n p: '$24 $4',\n gap: '$4'\n }\n }\n },\n '& > div': { display: 'none' },\n '&[data-state=active]': {\n boxShadow: 'none',\n border: '2px solid transparent',\n fontWeight: 600,\n color: '$textBold',\n '&:focus-visible': {\n boxShadow: 'none',\n borderColor: '$primary800'\n }\n },\n '&[data-state=inactive]': {\n fontWeight: 400,\n color: '$grey900'\n },\n '&[disabled]': {\n opacity: 0.3\n }\n})\n\nexport const SegmentedControlItem = React.forwardRef<\n HTMLButtonElement,\n Omit<React.ComponentProps<typeof StyledItem>, 'size'>\n>(({ children, ...props }, ref) => {\n const { size, theme } = useSegmentedControl()\n\n return (\n <StyledItem {...props} theme={theme} size={size} ref={ref}>\n {children}\n </StyledItem>\n )\n})\n\nSegmentedControlItem.displayName = 'SegmentedControlItem'\n"],"names":["StyledItem","styled","Tabs","SegmentedControlItem","React","children","props","ref","size","theme","useSegmentedControl"],"mappings":"6KAMA,MAAMA,EAAaC,EAAOC,EAAK,QAAS,CACtC,SAAU,WACV,GAAI,cACJ,aAAc,KACd,EAAG,EACH,OAAQ,EACR,SAAU,QACV,OAAQ,wBACR,SAAU,CACR,MAAO,CACL,QAAS,CACP,+BAAgC,CAC9B,GAAI,aACN,EACA,kBAAmB,CACjB,YAAa,aACf,CACF,EACA,MAAO,CACL,+BAAgC,CAC9B,GAAI,WACN,EACA,kBAAmB,CACjB,YAAa,WACf,CACF,CACF,EACA,KAAM,CACJ,GAAI,CACF,KAAM,QACN,EAAG,SACH,IAAK,IACP,EACA,GAAI,CACF,KAAM,EACN,EAAG,SACH,IAAK,IACP,EACA,GAAI,CACF,KAAM,EACN,EAAG,SACH,IAAK,IACP,CACF,CACF,EACA,UAAW,CAAE,QAAS,MAAO,EAC7B,uBAAwB,CACtB,UAAW,OACX,OAAQ,wBACR,WAAY,IACZ,MAAO,YACP,kBAAmB,CACjB,UAAW,OACX,YAAa,aACf,CACF,EACA,yBAA0B,CACxB,WAAY,IACZ,MAAO,UACT,EACA,cAAe,CACb,QAAS,EACX,CACF,CAAC,EAEYC,EAAuBC,EAAM,WAGxC,CAAC,CAAE,SAAAC,KAAaC,CAAM,EAAGC,IAAQ,CACjC,KAAM,CAAE,KAAAC,EAAM,MAAAC,CAAM,EAAIC,EAAoB,EAE5C,OACEN,EAAA,cAACJ,EAAA,CAAY,GAAGM,EAAO,MAAOG,EAAO,KAAMD,EAAM,IAAKD,CACnDF,EAAAA,CACH,CAEJ,CAAC,EAEDF,EAAqB,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as e from"react";import{styled as c}from"../../stitches.js";import{Box as f}from"../box/Box.js";import{Tabs as p}from"../tabs/Tabs.js";import{useSegmentedControl as u}from"./SegmentedControlContext.js";const g=c(p.TriggerList,{position:"relative",p:"$1",borderRadius:"$3",overflow:"hidden",variants:{theme:{primary:{bg:"$primary200"},marsh:{bg:"$marsh200"}}}}),w=n=>{const{theme:a}=u(),s=e.useRef([]),[m,d]=e.useState(0),[l,h]=e.useState({left:0,height:0,width:0}),o=()=>{const t=s.current[m];if(!t)return;const{width:r,height:i}=t.getBoundingClientRect();h({left:t.offsetLeft,height:i,width:r})};return e.useEffect(()=>(o(),window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}),[m]),e.createElement(g,{theme:a,...n},e.createElement(f,{css:{content:"",position:"absolute",bg:"white",borderRadius:"$2",transition:"all 0.3s ease",...l}}),e.Children.map(n.children,(t,r)=>e.cloneElement(t,{onClick:()=>d(r),ref:i=>s.current[r]=i})))};export{w as SegmentedControlItemList};
|
|
2
2
|
//# sourceMappingURL=SegmentedControlItemList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControlItemList.js","sources":["../../../src/components/segmented-control/SegmentedControlItemList.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Tabs } from '../tabs'\nimport { useSegmentedControl } from './SegmentedControlContext'\n\nconst StyledTriggerList = styled(Tabs.TriggerList, {\n p: '$1',\n borderRadius: '$3',\n variants: {\n theme: {\n primary: { bg: '$primary200' },\n marsh: { bg: '$marsh200' }\n }\n }\n})\n\nexport const SegmentedControlItemList = (\n props: React.ComponentProps<typeof Tabs.TriggerList>\n): JSX.Element => {\n const { theme } = useSegmentedControl()\n return <StyledTriggerList {...props}
|
|
1
|
+
{"version":3,"file":"SegmentedControlItemList.js","sources":["../../../src/components/segmented-control/SegmentedControlItemList.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../stitches'\nimport { Box } from '../box'\nimport { Tabs } from '../tabs'\nimport { useSegmentedControl } from './SegmentedControlContext'\n\nconst StyledTriggerList = styled(Tabs.TriggerList, {\n position: 'relative',\n p: '$1',\n borderRadius: '$3',\n overflow: 'hidden',\n variants: {\n theme: {\n primary: { bg: '$primary200' },\n marsh: { bg: '$marsh200' }\n }\n }\n})\n\nexport const SegmentedControlItemList = (\n props: React.ComponentProps<typeof Tabs.TriggerList>\n): JSX.Element => {\n const { theme } = useSegmentedControl()\n\n const tabsRef = React.useRef<(HTMLElement | null)[]>([])\n const [selectedIndex, setSelectedIndex] = React.useState(0)\n const [indicatorStyles, setIndicatorStyles] = React.useState({\n left: 0,\n height: 0,\n width: 0\n })\n\n const updateIndicatorPosition = () => {\n const currentTab = tabsRef.current[selectedIndex]\n if (!currentTab) return\n\n const { width, height } = currentTab.getBoundingClientRect()\n setIndicatorStyles({ left: currentTab.offsetLeft, height, width })\n }\n\n React.useEffect(() => {\n updateIndicatorPosition()\n window.addEventListener('resize', updateIndicatorPosition)\n return () => {\n window.removeEventListener('resize', updateIndicatorPosition)\n }\n }, [selectedIndex])\n\n return (\n <StyledTriggerList theme={theme} {...props}>\n <Box\n css={{\n content: '',\n position: 'absolute',\n bg: 'white',\n borderRadius: '$2',\n transition: 'all 0.3s ease',\n ...indicatorStyles\n }}\n />\n {React.Children.map(props.children, (child, index) =>\n React.cloneElement(child as React.ReactElement, {\n onClick: () => setSelectedIndex(index),\n ref: (el) => (tabsRef.current[index] = el)\n })\n )}\n </StyledTriggerList>\n )\n}\n"],"names":["StyledTriggerList","styled","Tabs","SegmentedControlItemList","props","theme","useSegmentedControl","tabsRef","React","selectedIndex","setSelectedIndex","indicatorStyles","setIndicatorStyles","updateIndicatorPosition","currentTab","width","height","Box","child","index","el"],"mappings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stitches-react/
|
|
|
733
733
|
}): React.JSX.Element;
|
|
734
734
|
displayName: string;
|
|
735
735
|
};
|
|
736
|
-
Trigger: {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
736
|
+
Trigger: React.ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-tabs").TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "css"> & import("@atom-learning/stitches-react/types/styled-component").TransformProps<{}, {
|
|
737
|
+
sm: string;
|
|
738
|
+
md: string;
|
|
739
|
+
lg: string;
|
|
740
|
+
xl: string;
|
|
741
|
+
reducedMotion: string;
|
|
742
|
+
allowMotion: string;
|
|
743
|
+
hover: string;
|
|
744
|
+
}> & {
|
|
745
|
+
css?: import("@atom-learning/stitches-react/types/css-util").CSS<{
|
|
746
746
|
sm: string;
|
|
747
747
|
md: string;
|
|
748
748
|
lg: string;
|
|
@@ -1097,11 +1097,10 @@ declare const StyledSegmentedControlRoot: import("@atom-learning/stitches-react/
|
|
|
1097
1097
|
marginTop: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
|
|
1098
1098
|
marginBottom: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
|
|
1099
1099
|
};
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
};
|
|
1100
|
+
}> | undefined;
|
|
1101
|
+
} & {
|
|
1102
|
+
value: string;
|
|
1103
|
+
}, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
1105
1104
|
Content: import("@atom-learning/stitches-react/types/styled-component").StyledComponent<React.ForwardRefExoticComponent<import("@radix-ui/react-tabs").TabsContentProps & React.RefAttributes<HTMLDivElement>>, {}, {
|
|
1106
1105
|
sm: string;
|
|
1107
1106
|
md: string;
|
|
@@ -732,16 +732,16 @@ export declare const Tabs: import("@atom-learning/stitches-react/types/styled-co
|
|
|
732
732
|
}): React.JSX.Element;
|
|
733
733
|
displayName: string;
|
|
734
734
|
};
|
|
735
|
-
Trigger: {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
735
|
+
Trigger: React.ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-tabs").TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "css"> & import("@atom-learning/stitches-react/types/styled-component").TransformProps<{}, {
|
|
736
|
+
sm: string;
|
|
737
|
+
md: string;
|
|
738
|
+
lg: string;
|
|
739
|
+
xl: string;
|
|
740
|
+
reducedMotion: string;
|
|
741
|
+
allowMotion: string;
|
|
742
|
+
hover: string;
|
|
743
|
+
}> & {
|
|
744
|
+
css?: import("@atom-learning/stitches-react/types/css-util").CSS<{
|
|
745
745
|
sm: string;
|
|
746
746
|
md: string;
|
|
747
747
|
lg: string;
|
|
@@ -1096,11 +1096,10 @@ export declare const Tabs: import("@atom-learning/stitches-react/types/styled-co
|
|
|
1096
1096
|
marginTop: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
|
|
1097
1097
|
marginBottom: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
|
|
1098
1098
|
};
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
};
|
|
1099
|
+
}> | undefined;
|
|
1100
|
+
} & {
|
|
1101
|
+
value: string;
|
|
1102
|
+
}, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
1104
1103
|
Content: import("@atom-learning/stitches-react/types/styled-component").StyledComponent<React.ForwardRefExoticComponent<import("@radix-ui/react-tabs").TabsContentProps & React.RefAttributes<HTMLDivElement>>, {}, {
|
|
1105
1104
|
sm: string;
|
|
1106
1105
|
md: string;
|