@atom-learning/components 2.66.11 → 2.66.12-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.
- package/dist/components/button/Button.d.ts +7 -9
- package/dist/components/button/Button.js +1 -1
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/link/Link.d.ts +7 -6
- package/dist/components/link/Link.js +1 -1
- package/dist/components/link/Link.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
- package/CHANGELOG.md +0 -207
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { VariantProps } from '@stitches/react';
|
|
1
|
+
import type { CSS, VariantProps } from '@stitches/react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { Override } from '../../utilities';
|
|
3
|
+
import { PolymorphicComponentPropWithRef } from '../../types';
|
|
5
4
|
export declare const StyledButton: import("@stitches/react/types/styled-component").StyledComponent<"button", {
|
|
6
5
|
theme?: "primary" | "secondary" | "success" | "danger" | "warning" | "neutral" | undefined;
|
|
7
6
|
appearance?: "outline" | "solid" | undefined;
|
|
@@ -327,11 +326,10 @@ export declare const StyledButton: import("@stitches/react/types/styled-componen
|
|
|
327
326
|
marginBottom: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
328
327
|
};
|
|
329
328
|
}>>;
|
|
330
|
-
declare type ButtonProps
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
href?: string;
|
|
329
|
+
declare type ButtonProps<H extends string | undefined, C extends React.ElementType> = PolymorphicComponentPropWithRef<C, VariantProps<typeof StyledButton> & {
|
|
330
|
+
css?: CSS;
|
|
331
|
+
href?: H;
|
|
334
332
|
isLoading?: boolean;
|
|
335
|
-
}
|
|
336
|
-
export declare const Button: React.
|
|
333
|
+
}>;
|
|
334
|
+
export declare const Button: <H extends string | undefined = undefined, C extends React.ElementType = H extends string ? 'a' : typeof StyledButton>(props: ButtonProps<H, C>) => React.ReactElement | null;
|
|
337
335
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{darken as n,opacify as s}from"color2k";import*as t from"react";import{StyledIcon as c}from"../icon/Icon.js";import{Loader as
|
|
1
|
+
import{darken as n,opacify as s}from"color2k";import*as t from"react";import{StyledIcon as c}from"../icon/Icon.js";import{Loader as y}from"../loader/Loader.js";import{styled as m,theme as l}from"../../stitches.js";import{isExternalLink as f}from"../../utilities/uri/index.js";const d=(e,a,r)=>({border:"1px solid",borderColor:"currentColor",color:e,"&[disabled]":{borderColor:"$tonal400",color:"$tonal400",cursor:"not-allowed"},"&:not([disabled]):hover, &:not([disabled]):focus":{textDecoration:"none",color:a},"&:not([disabled]):active":{color:r}}),i=(e,a,r,o="white")=>({bg:e,color:o,"&[disabled]":{bg:"$tonal100",color:"$tonal400",cursor:"not-allowed"},"&:not([disabled]):hover, &:not([disabled]):focus":{bg:a,color:o},"&:not([disabled]):active":{bg:r}}),u=m("button",{alignItems:"center",bg:"unset",border:"unset",borderRadius:"$0",cursor:"pointer",display:"flex",fontFamily:"$body",fontWeight:600,justifyContent:"center",p:"unset",textDecoration:"none",transition:"all 100ms ease-out",whiteSpace:"nowrap",width:"max-content",variants:{theme:{primary:{},secondary:{},success:{},warning:{},danger:{},neutral:{}},appearance:{solid:{},outline:{}},size:{sm:{fontSize:"$sm",lineHeight:1.53,height:"$3",px:"$4",gap:"$2",[`& ${c}`]:{size:16}},md:{fontSize:"$md",lineHeight:1.5,height:"$4",px:"$5",gap:"$3",[`& ${c}`]:{size:20}},lg:{fontSize:"$lg",lineHeight:1.5,height:"$5",px:"$5",gap:"$3",[`& ${c}`]:{size:22}}},isLoading:{true:{cursor:"not-allowed",opacity:.6,pointerEvents:"none"}},fullWidth:{false:{width:"max-content"},true:{width:"100%"}}},compoundVariants:[{theme:"primary",appearance:"solid",css:i("$primary","$primaryMid","$primaryDark")},{theme:"secondary",appearance:"solid",css:i("$primaryDark",n(l.colors.primaryDark.value,.1),n(l.colors.primaryDark.value,.15))},{theme:"success",appearance:"solid",css:i("$success","$successMid","$successDark")},{theme:"warning",appearance:"solid",css:i("$warning","$warningMid","$warningDark","$tonal500")},{theme:"danger",appearance:"solid",css:i("$danger","$dangerMid","$dangerDark")},{theme:"neutral",appearance:"solid",css:i("white",s("white",-.1),s("white",-.25),"$primary")},{theme:"primary",appearance:"outline",css:d("$primary","$primaryMid","$primaryDark")},{theme:"neutral",appearance:"outline",css:d("white",s("white",-.2),s("white",-.35))},{theme:"secondary",appearance:"outline",css:d("$primaryDark",n(l.colors.primaryDark.value,.1),n(l.colors.primaryDark.value,.15))}],defaultVariants:{appearance:"solid",size:"md",theme:"primary"}}),b=m("span",{alignItems:"center",display:"flex",justifyContent:"center",visibility:"hidden",variants:{size:{sm:{gap:"$2"},md:{gap:"$3"},lg:{gap:"$3"}}},defaultVariants:{size:"md"}}),w=({size:e,children:a})=>t.createElement(t.Fragment,null,t.createElement(y,{css:{position:"absolute"}}),t.createElement(b,{size:e},a)),k=t.forwardRef(({children:e,as:a,href:r,isLoading:o=!1,onClick:h,...p},$)=>{const g=f(r)?{target:"_blank",rel:"noopener noreferrer"}:{};return t.createElement(u,{as:a||(r?"a":void 0),href:r,isLoading:o,onClick:o?void 0:h,type:r?void 0:"button",...p,...g,ref:$},o?t.createElement(w,{size:p.size},e):e)});export{k as Button,u as StyledButton};
|
|
2
2
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import type { VariantProps } from '@stitches/react'\nimport { darken, opacify } from 'color2k'\nimport * as React from 'react'\n\nimport {
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import type { CSS, VariantProps } from '@stitches/react'\nimport { darken, opacify } from 'color2k'\nimport * as React from 'react'\n\nimport { StyledIcon } from '~/components/icon'\nimport { Loader } from '~/components/loader'\nimport { styled, theme } from '~/stitches'\nimport { isExternalLink } from '~/utilities/uri'\nimport { PolymorphicComponentPropWithRef } from '~/types'\n\nconst getButtonOutlineVariant = (\n base: string,\n interact: string,\n active: string\n) => ({\n border: '1px solid',\n borderColor: 'currentColor',\n color: base,\n '&[disabled]': {\n borderColor: '$tonal400',\n color: '$tonal400',\n cursor: 'not-allowed'\n },\n '&:not([disabled]):hover, &:not([disabled]):focus': {\n textDecoration: 'none',\n color: interact\n },\n '&:not([disabled]):active': {\n color: active\n }\n})\n\nconst getButtonSolidVariant = (\n base: string,\n interact: string,\n active: string,\n text = 'white'\n) => ({\n bg: base,\n color: text,\n '&[disabled]': {\n bg: '$tonal100',\n color: '$tonal400',\n cursor: 'not-allowed'\n },\n '&:not([disabled]):hover, &:not([disabled]):focus': {\n bg: interact,\n color: text\n },\n '&:not([disabled]):active': {\n bg: active\n }\n})\n\nexport const StyledButton = styled('button', {\n alignItems: 'center',\n bg: 'unset',\n border: 'unset',\n borderRadius: '$0',\n cursor: 'pointer',\n display: 'flex',\n fontFamily: '$body',\n fontWeight: 600,\n justifyContent: 'center',\n p: 'unset',\n textDecoration: 'none',\n transition: 'all 100ms ease-out',\n whiteSpace: 'nowrap',\n width: 'max-content',\n variants: {\n theme: {\n primary: {},\n secondary: {},\n success: {},\n warning: {},\n danger: {},\n neutral: {}\n },\n appearance: {\n solid: {},\n outline: {}\n },\n size: {\n sm: {\n fontSize: '$sm',\n lineHeight: 1.53,\n height: '$3',\n px: '$4',\n gap: '$2',\n [`& ${StyledIcon}`]: { size: 16 }\n },\n md: {\n fontSize: '$md',\n lineHeight: 1.5,\n height: '$4',\n px: '$5',\n gap: '$3',\n [`& ${StyledIcon}`]: { size: 20 }\n },\n lg: {\n fontSize: '$lg',\n lineHeight: 1.5,\n height: '$5',\n px: '$5',\n gap: '$3',\n [`& ${StyledIcon}`]: { size: 22 }\n }\n },\n isLoading: {\n true: {\n cursor: 'not-allowed',\n opacity: 0.6,\n pointerEvents: 'none'\n }\n },\n fullWidth: {\n false: {\n width: 'max-content'\n },\n true: {\n width: '100%'\n }\n }\n },\n\n compoundVariants: [\n {\n theme: 'primary',\n appearance: 'solid',\n css: getButtonSolidVariant('$primary', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'secondary',\n appearance: 'solid',\n css: getButtonSolidVariant(\n '$primaryDark',\n darken(theme.colors.primaryDark.value, 0.1),\n darken(theme.colors.primaryDark.value, 0.15)\n )\n },\n {\n theme: 'success',\n appearance: 'solid',\n css: getButtonSolidVariant('$success', '$successMid', '$successDark')\n },\n {\n theme: 'warning',\n appearance: 'solid',\n css: getButtonSolidVariant(\n '$warning',\n '$warningMid',\n '$warningDark',\n '$tonal500'\n )\n },\n {\n theme: 'danger',\n appearance: 'solid',\n css: getButtonSolidVariant('$danger', '$dangerMid', '$dangerDark')\n },\n {\n theme: 'neutral',\n appearance: 'solid',\n css: getButtonSolidVariant(\n 'white',\n opacify('white', -0.1),\n opacify('white', -0.25),\n '$primary'\n )\n },\n {\n theme: 'primary',\n appearance: 'outline',\n css: getButtonOutlineVariant('$primary', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'neutral',\n appearance: 'outline',\n css: getButtonOutlineVariant(\n 'white',\n opacify('white', -0.2),\n opacify('white', -0.35)\n )\n },\n {\n theme: 'secondary',\n appearance: 'outline',\n css: getButtonOutlineVariant(\n '$primaryDark',\n darken(theme.colors.primaryDark.value, 0.1),\n darken(theme.colors.primaryDark.value, 0.15)\n )\n }\n ],\n\n defaultVariants: {\n appearance: 'solid',\n size: 'md',\n theme: 'primary'\n }\n})\n\nconst LoaderContentsWrapper = styled('span', {\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'center',\n visibility: 'hidden',\n variants: {\n size: {\n sm: { gap: '$2' },\n md: { gap: '$3' },\n lg: { gap: '$3' }\n }\n },\n defaultVariants: {\n size: 'md'\n }\n})\n\nconst WithLoader = ({\n size,\n children\n}: React.ComponentProps<typeof LoaderContentsWrapper>) => (\n <>\n <Loader css={{ position: 'absolute' }} />\n <LoaderContentsWrapper size={size}>{children}</LoaderContentsWrapper>\n </>\n)\n\ntype ButtonProps<\n H extends string | undefined,\n C extends React.ElementType\n> = PolymorphicComponentPropWithRef<\n C,\n VariantProps<typeof StyledButton> & {\n css?: CSS\n href?: H\n isLoading?: boolean\n }\n>\n\nexport const Button: <\n H extends string | undefined = undefined,\n C extends React.ElementType = H extends string ? 'a' : typeof StyledButton\n>(\n props: ButtonProps<H, C>\n) => React.ReactElement | null = React.forwardRef(\n <\n H extends string | undefined = undefined,\n C extends React.ElementType = H extends string ? 'a' : typeof StyledButton\n >(\n {\n children,\n as,\n href,\n isLoading = false,\n onClick,\n ...rest\n }: ButtonProps<H, C>,\n ref?: ButtonProps<H, C>['ref']\n ) => {\n const externalLinkProps = isExternalLink(href)\n ? { target: '_blank', rel: 'noopener noreferrer' }\n : {}\n\n return (\n <StyledButton\n as={as || (href ? 'a' : undefined)}\n href={href}\n isLoading={isLoading}\n onClick={!isLoading ? onClick : undefined}\n type={!href ? 'button' : undefined}\n {...rest}\n {...externalLinkProps}\n ref={ref}\n >\n {isLoading ? (\n <WithLoader size={rest.size}>{children}</WithLoader>\n ) : (\n children\n )}\n </StyledButton>\n )\n }\n)\n"],"names":["getButtonOutlineVariant","base","interact","active","getButtonSolidVariant","text","StyledButton","styled","StyledIcon","darken","theme","opacify","LoaderContentsWrapper","WithLoader","size","children","React","Loader","Button","as","href","isLoading","onClick","rest","ref","externalLinkProps","isExternalLink"],"mappings":"oRAUA,MAAMA,EAA0B,CAC9BC,EACAC,EACAC,KACI,CACJ,OAAQ,YACR,YAAa,eACb,MAAOF,EACP,cAAe,CACb,YAAa,YACb,MAAO,YACP,OAAQ,aACV,EACA,mDAAoD,CAClD,eAAgB,OAChB,MAAOC,CACT,EACA,2BAA4B,CAC1B,MAAOC,CACT,CACF,GAEMC,EAAwB,CAC5BH,EACAC,EACAC,EACAE,EAAO,WACH,CACJ,GAAIJ,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E,SAAAD,EACA,GAAAI,EACA,KAAAC,EACA,UAAAC,EAAY,GACZ,QAAAC,KACGC,CACL,EACAC,IACG,CACH,MAAMC,EAAoBC,EAAeN,CAAI,EACzC,CAAE,OAAQ,SAAU,IAAK,qBAAsB,EAC/C,CAAA,EAEJ,OACEJ,EAAA,cAACV,GACC,GAAIa,IAAOC,EAAO,IAAM,QACxB,KAAMA,EACN,UAAWC,EACX,QAAUA,EAAsB,OAAVC,EACtB,KAAOF,EAAkB,OAAX,SACb,GAAGG,EACH,GAAGE,EACJ,IAAKD,CAAAA,EAEJH,EACCL,EAAA,cAACH,EAAA,CAAW,KAAMU,EAAK,IAAOR,EAAAA,CAAS,EAEvCA,CAEJ,CAEJ,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { CSS, VariantProps } from '@stitches/react';
|
|
3
|
+
import { PolymorphicComponentPropWithRef } from '../../types';
|
|
4
4
|
export declare const StyledLink: import("@stitches/react/types/styled-component").StyledComponent<"a", {
|
|
5
5
|
size?: "sm" | "md" | "lg" | "xl" | "xs" | undefined;
|
|
6
6
|
noCapsize?: boolean | "true" | undefined;
|
|
@@ -323,8 +323,9 @@ export declare const StyledLink: import("@stitches/react/types/styled-component"
|
|
|
323
323
|
marginBottom: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
324
324
|
};
|
|
325
325
|
}>>;
|
|
326
|
-
declare type LinkProps
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
326
|
+
declare type LinkProps<H extends string | undefined, C extends React.ElementType> = PolymorphicComponentPropWithRef<C, VariantProps<typeof StyledLink> & {
|
|
327
|
+
css?: CSS;
|
|
328
|
+
href?: H;
|
|
329
|
+
}>;
|
|
330
|
+
export declare const Link: <H extends string | undefined = undefined, C extends React.ElementType = H extends string ? typeof StyledLink : 'button'>(props: LinkProps<H, C>) => React.ReactElement | null;
|
|
330
331
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as o from"react";import{styled as
|
|
1
|
+
import*as o from"react";import{styled as m}from"../../stitches.js";import{isExternalLink as p}from"../../utilities/uri/index.js";import{StyledHeading as f}from"../heading/Heading.js";import{StyledLi as s}from"../list/List.js";import"../markdown-content/components/MarkdownCode.js";import{StyledMarkdownEmphasis as d}from"../markdown-content/components/MarkdownEmphasis.js";import"../markdown-content/components/MarkdownInlineCode.js";import"../image/Image.js";import{StyledText as l,textVariants as c}from"../text/Text.js";import"../markdown-content/components/MarkdownStrong.js";import"../divider/Divider.js";const t=m("a",{bg:"unset",border:"unset",p:"unset",color:"$primary",cursor:"pointer",fontFamily:"$body",textDecoration:"none","&:focus, &:hover":{color:"$primaryMid",textDecoration:"underline"},"&:active":{color:"$primaryDark"},[`${l} > &, ${f} > &, ${s} > &, ${d} > &`]:{fontSize:"100%",lineHeight:1,"&::before, &::after":{content:"none"}},variants:c,defaultVariants:{size:"md"}}),y=o.forwardRef(({as:e,href:r,...i},n)=>{const a=p(r)?{target:"_blank",rel:"noopener noreferrer"}:{};return o.createElement(t,{as:e||(r?void 0:"button"),noCapsize:r?void 0:!0,href:r,...i,...a,ref:n})});export{y as Link,t as StyledLink};
|
|
2
2
|
//# sourceMappingURL=Link.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sources":["../../../src/components/link/Link.tsx"],"sourcesContent":["import * as React from 'react'\
|
|
1
|
+
{"version":3,"file":"Link.js","sources":["../../../src/components/link/Link.tsx"],"sourcesContent":["import * as React from 'react'\nimport type { CSS, VariantProps } from '@stitches/react'\nimport { styled } from '~/stitches'\nimport { NavigatorActions } from '~/types'\nimport { Override } from '~/utilities'\nimport { isExternalLink } from '~/utilities/uri'\n\nimport { StyledHeading } from '../heading/Heading'\nimport { StyledLi } from '../list/List'\nimport { StyledMarkdownEmphasis } from '../markdown-content/components'\nimport { StyledText, textVariants } from '../text/Text'\nimport { PolymorphicComponentPropWithRef } from '~/types'\nexport const StyledLink = styled('a', {\n bg: 'unset',\n border: 'unset',\n p: 'unset',\n color: '$primary',\n cursor: 'pointer',\n fontFamily: '$body',\n textDecoration: 'none',\n '&:focus, &:hover': {\n color: '$primaryMid',\n textDecoration: 'underline'\n },\n '&:active': {\n color: '$primaryDark'\n },\n [`${StyledText} > &, ${StyledHeading} > &, ${StyledLi} > &, ${StyledMarkdownEmphasis} > &`]:\n {\n fontSize: '100%',\n lineHeight: 1,\n '&::before, &::after': {\n content: 'none'\n }\n },\n variants: textVariants,\n defaultVariants: {\n size: 'md'\n }\n})\n\ntype LinkProps<\n H extends string | undefined,\n C extends React.ElementType\n> = PolymorphicComponentPropWithRef<\n C,\n VariantProps<typeof StyledLink> & {\n css?: CSS\n href?: H\n }\n>\n\nexport const Link: <\n H extends string | undefined = undefined,\n C extends React.ElementType = H extends string ? typeof StyledLink : 'button'\n>(\n props: LinkProps<H, C>\n) => React.ReactElement | null = React.forwardRef(\n <\n H extends string | undefined = undefined,\n C extends React.ElementType = H extends string\n ? typeof StyledLink\n : 'button'\n >(\n { as, href, ...rest }: LinkProps<H, C>,\n ref?: LinkProps<H, C>['ref']\n ) => {\n const externalLinkProps = isExternalLink(href)\n ? { target: '_blank', rel: 'noopener noreferrer' }\n : {}\n\n return (\n <StyledLink\n as={as || (!href ? 'button' : undefined)}\n noCapsize={!href ? true : undefined}\n href={href}\n {...rest}\n {...externalLinkProps}\n ref={ref}\n />\n )\n }\n)\n"],"names":["StyledLink","styled","StyledText","StyledHeading","StyledLi","StyledMarkdownEmphasis","textVariants","Link","React","as","href","rest","ref","externalLinkProps","isExternalLink"],"mappings":"kmBAYO,MAAMA,EAAaC,EAAO,IAAK,CACpC,GAAI,QACJ,OAAQ,QACR,EAAG,QACH,MAAO,WACP,OAAQ,UACR,WAAY,QACZ,eAAgB,OAChB,mBAAoB,CAClB,MAAO,cACP,eAAgB,WAClB,EACA,WAAY,CACV,MAAO,cACT,EACA,CAAC,GAAGC,UAAmBC,UAAsBC,UAAiBC,SAC5D,CACE,SAAU,OACV,WAAY,EACZ,sBAAuB,CACrB,QAAS,MACX,CACF,EACF,SAAUC,EACV,gBAAiB,CACf,KAAM,IACR,CACF,CAAC,EAaYC,EAKoBC,EAAM,WACrC,CAME,CAAE,GAAAC,EAAI,KAAAC,KAASC,CAAK,EACpBC,IACG,CACH,MAAMC,EAAoBC,EAAeJ,CAAI,EACzC,CAAE,OAAQ,SAAU,IAAK,qBAAsB,EAC/C,CAEJ,EAAA,OACEF,EAAA,cAACR,GACC,GAAIS,IAAQC,EAAkB,OAAX,UACnB,UAAYA,EAAc,OAAP,GACnB,KAAMA,EACL,GAAGC,EACH,GAAGE,EACJ,IAAKD,CAAAA,CACP,CAEJ,CACF"}
|