@atom-learning/components 2.54.2 → 2.55.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,9 @@
1
- ## [2.54.2](https://github.com/Atom-Learning/components/compare/v2.54.1...v2.54.2) (2023-05-10)
1
+ # [2.55.0](https://github.com/Atom-Learning/components/compare/v2.54.3...v2.55.0) (2023-05-16)
2
2
 
3
3
 
4
- ### Bug Fixes
4
+ ### Features
5
5
 
6
- * added line height to input for md and sm sizes, updated lots of snapshots ([297e29b](https://github.com/Atom-Learning/components/commit/297e29bc5e8e3ce07bc4ad0f18230f13c9101345))
6
+ * added new badge theme variant ([5d7556a](https://github.com/Atom-Learning/components/commit/5d7556a00dd30085ebc75270298341a81f9c92a5))
7
7
 
8
8
  # [1.4.0](https://github.com/Atom-Learning/components/compare/v1.3.0...v1.4.0) (2022-04-11)
9
9
 
@@ -1,2 +1,2 @@
1
- import{darken as o}from"color2k";import b from"invariant";import*as e from"react";import{styled as v,theme as n}from"../../stitches.js";import{Icon as u}from"../icon/Icon.js";import{Tooltip as $}from"../tooltip/Tooltip.js";import{ActionIconSizeMap as M}from"./ActionIcon.constants.js";const l=(r,a,s)=>({bg:"transparent",color:r,"&:not(:disabled):hover, &:not(:disabled):focus":{color:a},"&:not(:disabled):active":{color:s},"&[disabled]":{color:"$tonal400",cursor:"not-allowed"}}),c=(r,a,s)=>({bg:r,color:"white","&:not(:disabled):hover, &:not(:disabled):focus":{bg:a,color:"white"},"&:not(:disabled):active":{bg:s},"&[disabled]":{bg:"$tonal100",color:"$tonal400",cursor:"not-allowed"}}),p=(r,a,s)=>({border:"1px solid",borderColor:"currentColor",color:r,"&:not(:disabled):hover, &:not(:disabled):focus":{color:a},"&:not(:disabled):active":{color:s},"&[disabled]":{borderColor:"$tonal400",color:"$tonal400",cursor:"not-allowed"}}),C=v("button",{alignItems:"center",appearance:"none",bg:"white",border:"unset",borderRadius:"$0",boxSizing:"border-box",cursor:"pointer",display:"flex",justifyContent:"center",p:"unset",transition:"all 100ms ease-out",variants:{theme:{neutral:{},primary:{},success:{},warning:{},danger:{}},appearance:{simple:{},outline:{},solid:{}},size:{xs:{size:"$2"},sm:{size:"$3"},md:{size:"$4"},lg:{size:"$5"}},isRounded:{true:{borderRadius:"$round"}}},compoundVariants:[{theme:"neutral",appearance:"simple",css:l("$tonal300","$primaryMid","$primaryDark")},{theme:"primary",appearance:"simple",css:l("$primary","$primaryMid","$primaryDark")},{theme:"primaryDark",appearance:"simple",css:l("$primaryDark",o(n.colors.primaryDark.value,.1),o(n.colors.primaryDark.value,.15))},{theme:"success",appearance:"simple",css:l("$success","$successMid","$successDark")},{theme:"warning",appearance:"simple",css:l("$warning","$warningMid","$warningDark")},{theme:"danger",appearance:"simple",css:l("$danger","$dangerMid","$dangerDark")},{theme:"primary",appearance:"solid",css:c("$primary","$primaryMid","$primaryDark")},{theme:"primaryDark",appearance:"solid",css:c("$primaryDark",o(n.colors.primaryDark.value,.1),o(n.colors.primaryDark.value,.15))},{theme:"success",appearance:"solid",css:c("$success","$successMid","$successDark")},{theme:"warning",appearance:"solid",css:c("$warning","$warningMid","$warningDark")},{theme:"danger",appearance:"solid",css:c("$danger","$dangerMid","$dangerDark")},{theme:"primary",appearance:"outline",css:p("$primary","$primaryMid","$primaryDark")},{theme:"primaryDark",appearance:"outline",css:p("$primaryDark",o(n.colors.primaryDark.value,.1),o(n.colors.primaryDark.value,.15))},{theme:"success",appearance:"outline",css:p("$success","$successMid","$successDark")},{theme:"warning",appearance:"outline",css:p("$warning","$warningMid","$warningDark")},{theme:"danger",appearance:"outline",css:p("$danger","$dangerMid","$dangerDark")}]}),z=({hasTooltip:r,label:a,tooltipSide:s,children:t})=>r?e.createElement($,null,e.createElement($.Trigger,{asChild:!0},t),e.createElement($.Content,{side:s},a)):e.createElement(e.Fragment,null,t),d=e.forwardRef(({children:r,theme:a="primary",appearance:s="simple",size:t="sm",label:y,href:h,disabled:m,hasTooltip:k=!0,tooltipSide:D,...w},f)=>{const g=`A single ${u.displayName} component is permitted as a child of ${d.displayName}`;return b(e.Children.count(r)===1,g),e.createElement(z,{hasTooltip:k,label:y,tooltipSide:D},e.createElement(C,{...w,...h?{as:"a",href:m?null:h,onClick:void 0,"aria-disabled":!!m}:{type:"button"},"aria-label":y,theme:a,appearance:s,size:t,ref:f,disabled:m},e.Children.map(r,i=>{if(!e.isValidElement(i))throw new Error(g);return b(i.type===u,`Children of type ${i==null?void 0:i.type} aren't permitted. Only an ${u.displayName} component is allowed in ${d.displayName}`),e.cloneElement(i,{size:M[t],css:{...i.props.css?i.props.css:{}}})})))});d.displayName="ActionIcon";export{d as ActionIcon};
1
+ import{darken as o}from"color2k";import b from"invariant";import*as e from"react";import{styled as v,theme as n}from"../../stitches.js";import{Icon as u}from"../icon/Icon.js";import{Tooltip as $}from"../tooltip/Tooltip.js";import{ActionIconSizeMap as M}from"./ActionIcon.constants.js";const l=(r,a,s)=>({bg:"transparent",color:r,"&:not(:disabled):hover, &:not(:disabled):focus":{color:a},"&:not(:disabled):active":{color:s},"&[disabled]":{color:"$tonal400",cursor:"not-allowed"}}),c=(r,a,s)=>({bg:r,color:"white","&:not(:disabled):hover, &:not(:disabled):focus":{bg:a,color:"white"},"&:not(:disabled):active":{bg:s},"&[disabled]":{bg:"$tonal100",color:"$tonal400",cursor:"not-allowed"}}),p=(r,a,s)=>({border:"1px solid",borderColor:"currentColor",color:r,"&:not(:disabled):hover, &:not(:disabled):focus":{color:a},"&:not(:disabled):active":{color:s},"&[disabled]":{borderColor:"$tonal400",color:"$tonal400",cursor:"not-allowed"}}),C=v("button",{alignItems:"center",appearance:"none",bg:"white",border:"unset",borderRadius:"$0",boxSizing:"border-box",cursor:"pointer",display:"flex",justifyContent:"center",p:"unset",transition:"all 100ms ease-out",variants:{theme:{neutral:{},primary:{},success:{},warning:{},danger:{}},appearance:{simple:{},outline:{},solid:{}},size:{xs:{size:"$2"},sm:{size:"$3"},md:{size:"$4"},lg:{size:"$5"}},isRounded:{true:{borderRadius:"$round"}}},compoundVariants:[{theme:"neutral",appearance:"simple",css:l("$tonal300","$primaryMid","$primaryDark")},{theme:"primary",appearance:"simple",css:l("$primary","$primaryMid","$primaryDark")},{theme:"primaryDark",appearance:"simple",css:l("$primaryDark",o(n.colors.primaryDark.value,.1),o(n.colors.primaryDark.value,.15))},{theme:"success",appearance:"simple",css:l("$success","$successMid","$successDark")},{theme:"warning",appearance:"simple",css:l("$warning","$warningMid","$warningDark")},{theme:"danger",appearance:"simple",css:l("$danger","$dangerMid","$dangerDark")},{theme:"primary",appearance:"solid",css:c("$primary","$primaryMid","$primaryDark")},{theme:"primaryDark",appearance:"solid",css:c("$primaryDark",o(n.colors.primaryDark.value,.1),o(n.colors.primaryDark.value,.15))},{theme:"success",appearance:"solid",css:c("$success","$successMid","$successDark")},{theme:"warning",appearance:"solid",css:c("$warning","$warningMid","$warningDark")},{theme:"danger",appearance:"solid",css:c("$danger","$dangerMid","$dangerDark")},{theme:"primary",appearance:"outline",css:p("$primary","$primaryMid","$primaryDark")},{theme:"primaryDark",appearance:"outline",css:p("$primaryDark",o(n.colors.primaryDark.value,.1),o(n.colors.primaryDark.value,.15))},{theme:"success",appearance:"outline",css:p("$success","$successMid","$successDark")},{theme:"warning",appearance:"outline",css:p("$warning","$warningMid","$warningDark")},{theme:"danger",appearance:"outline",css:p("$danger","$dangerMid","$dangerDark")}]}),z=({hasTooltip:r,label:a,tooltipSide:s,children:t})=>r?e.createElement($,null,e.createElement($.Trigger,{asChild:!0},t),e.createElement($.Content,{side:s},a)):e.createElement(e.Fragment,null,t),d=e.forwardRef(({children:r,theme:a="primary",appearance:s="simple",size:t="sm",label:y,href:h,disabled:m,hasTooltip:k=!0,tooltipSide:D,...w},f)=>{const g=`A single ${u.displayName} component is permitted as a child of ${d.displayName}`;return b(e.Children.count(r)===1,g),e.createElement(z,{hasTooltip:k,label:y,tooltipSide:D},e.createElement(C,{...h?{as:"a",href:m?null:h,onClick:void 0,"aria-disabled":!!m}:{type:"button"},...w,"aria-label":y,theme:a,appearance:s,size:t,ref:f,disabled:m},e.Children.map(r,i=>{if(!e.isValidElement(i))throw new Error(g);return b(i.type===u,`Children of type ${i==null?void 0:i.type} aren't permitted. Only an ${u.displayName} component is allowed in ${d.displayName}`),e.cloneElement(i,{size:M[t],css:{...i.props.css?i.props.css:{}}})})))});d.displayName="ActionIcon";export{d as ActionIcon};
2
2
  //# sourceMappingURL=ActionIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionIcon.js","sources":["../../../src/components/action-icon/ActionIcon.tsx"],"sourcesContent":["import type { VariantProps } from '@stitches/react'\nimport { darken } from 'color2k'\nimport invariant from 'invariant'\nimport * as React from 'react'\n\nimport { styled, theme } from '~/stitches'\nimport { NavigatorActions } from '~/types'\nimport { Override } from '~/utilities'\n\nimport { Icon } from '../icon/Icon'\nimport { Tooltip } from '../tooltip/Tooltip'\nimport { ActionIconSizeMap } from './ActionIcon.constants'\n\nconst getSimpleVariant = (base: string, interact: string, active: string) => ({\n bg: 'transparent',\n color: base,\n '&:not(:disabled):hover, &:not(:disabled):focus': {\n color: interact\n },\n '&:not(:disabled):active': {\n color: active\n },\n '&[disabled]': {\n color: '$tonal400',\n cursor: 'not-allowed'\n }\n})\n\nconst getSolidVariant = (base: string, interact: string, active: string) => ({\n bg: base,\n color: 'white',\n '&:not(:disabled):hover, &:not(:disabled):focus': {\n bg: interact,\n color: 'white'\n },\n '&:not(:disabled):active': {\n bg: active\n },\n '&[disabled]': {\n bg: '$tonal100',\n color: '$tonal400',\n cursor: 'not-allowed'\n }\n})\n\nconst getOutlineVariant = (base: string, interact: string, active: string) => ({\n border: '1px solid',\n borderColor: 'currentColor',\n color: base,\n '&:not(:disabled):hover, &:not(:disabled):focus': {\n color: interact\n },\n '&:not(:disabled):active': {\n color: active\n },\n '&[disabled]': {\n borderColor: '$tonal400',\n color: '$tonal400',\n cursor: 'not-allowed'\n }\n})\n\nconst StyledButton = styled('button', {\n alignItems: 'center',\n appearance: 'none',\n bg: 'white',\n border: 'unset',\n borderRadius: '$0',\n boxSizing: 'border-box',\n cursor: 'pointer',\n display: 'flex',\n justifyContent: 'center',\n p: 'unset',\n transition: 'all 100ms ease-out',\n variants: {\n theme: {\n neutral: {},\n primary: {},\n success: {},\n warning: {},\n danger: {}\n },\n appearance: {\n simple: {},\n outline: {},\n solid: {}\n },\n size: {\n xs: { size: '$2' },\n sm: { size: '$3' },\n md: { size: '$4' },\n lg: { size: '$5' }\n },\n isRounded: {\n true: {\n borderRadius: '$round'\n }\n }\n },\n compoundVariants: [\n // Appearance Simple\n {\n theme: 'neutral',\n appearance: 'simple',\n css: getSimpleVariant('$tonal300', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'primary',\n appearance: 'simple',\n css: getSimpleVariant('$primary', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'primaryDark',\n appearance: 'simple',\n css: getSimpleVariant(\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: 'simple',\n css: getSimpleVariant('$success', '$successMid', '$successDark')\n },\n {\n theme: 'warning',\n appearance: 'simple',\n css: getSimpleVariant('$warning', '$warningMid', '$warningDark')\n },\n {\n theme: 'danger',\n appearance: 'simple',\n css: getSimpleVariant('$danger', '$dangerMid', '$dangerDark')\n },\n\n // Appearance Solid\n {\n theme: 'primary',\n appearance: 'solid',\n css: getSolidVariant('$primary', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'primaryDark',\n appearance: 'solid',\n css: getSolidVariant(\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: getSolidVariant('$success', '$successMid', '$successDark')\n },\n {\n theme: 'warning',\n appearance: 'solid',\n css: getSolidVariant('$warning', '$warningMid', '$warningDark')\n },\n {\n theme: 'danger',\n appearance: 'solid',\n css: getSolidVariant('$danger', '$dangerMid', '$dangerDark')\n },\n\n // Appearance Outline\n {\n theme: 'primary',\n appearance: 'outline',\n css: getOutlineVariant('$primary', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'primaryDark',\n appearance: 'outline',\n css: getOutlineVariant(\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: 'outline',\n css: getOutlineVariant('$success', '$successMid', '$successDark')\n },\n {\n theme: 'warning',\n appearance: 'outline',\n css: getOutlineVariant('$warning', '$warningMid', '$warningDark')\n },\n {\n theme: 'danger',\n appearance: 'outline',\n css: getOutlineVariant('$danger', '$dangerMid', '$dangerDark')\n }\n ]\n})\n\ntype ConditionallyWrapWithTooltipProps = {\n hasTooltip: boolean\n label: string\n tooltipSide?: 'bottom' | 'left' | 'right' | 'top'\n children: React.ReactNode\n}\n\nconst ConditionallyWrapWithTooltip: React.FC<\n ConditionallyWrapWithTooltipProps\n> = ({ hasTooltip, label, tooltipSide, children }) => {\n if (hasTooltip) {\n return (\n <Tooltip>\n <Tooltip.Trigger asChild>{children}</Tooltip.Trigger>\n <Tooltip.Content side={tooltipSide}>{label}</Tooltip.Content>\n </Tooltip>\n )\n }\n\n // Ignore fragment error as this is the one place we will allow it\n // eslint-disable-next-line\n return <>{children}</>\n}\n\ntype ActionIconProps = Override<\n React.ComponentProps<typeof StyledButton>,\n VariantProps<typeof StyledButton> & {\n as?: string | React.ReactNode\n children: React.ReactNode\n label: string\n hasTooltip?: boolean\n tooltipSide?: 'bottom' | 'left' | 'right' | 'top'\n } & NavigatorActions\n>\n\nexport const ActionIcon = React.forwardRef<HTMLButtonElement, ActionIconProps>(\n (\n {\n children,\n theme = 'primary',\n appearance = 'simple',\n size = 'sm',\n label,\n href,\n disabled,\n hasTooltip = true,\n tooltipSide,\n ...remainingProps\n },\n ref\n ) => {\n const INVALID_CHILDREN_MESSAGE = `A single ${Icon.displayName} component is permitted as a child of ${ActionIcon.displayName}`\n\n invariant(React.Children.count(children) === 1, INVALID_CHILDREN_MESSAGE)\n\n const optionalLinkProps = href\n ? ({\n as: 'a',\n href: disabled ? null : href,\n onClick: undefined,\n 'aria-disabled': !!disabled\n } as const)\n : ({ type: 'button' } as const)\n\n return (\n <ConditionallyWrapWithTooltip\n hasTooltip={hasTooltip}\n label={label}\n tooltipSide={tooltipSide}\n >\n <StyledButton\n {...remainingProps}\n {...optionalLinkProps}\n aria-label={label}\n theme={theme}\n appearance={appearance}\n size={size}\n ref={ref}\n disabled={disabled}\n >\n {React.Children.map(children, (child) => {\n // TS needs this check for any following code to access child.type\n // even with optional chaining\n if (!React.isValidElement(child)) {\n throw new Error(INVALID_CHILDREN_MESSAGE)\n }\n\n invariant(\n child.type === Icon,\n `Children of type ${child?.type} aren't permitted. Only an ${Icon.displayName} component is allowed in ${ActionIcon.displayName}`\n )\n\n return React.cloneElement(child, {\n size: ActionIconSizeMap[size as string],\n css: { ...(child.props.css ? child.props.css : {}) }\n })\n })}\n </StyledButton>\n </ConditionallyWrapWithTooltip>\n )\n }\n)\n\nActionIcon.displayName = 'ActionIcon'\n"],"names":["getSimpleVariant","base","interact","active","getSolidVariant","getOutlineVariant","StyledButton","styled","darken","theme","ConditionallyWrapWithTooltip","hasTooltip","label","tooltipSide","children","React","Tooltip","ActionIcon","appearance","size","href","disabled","remainingProps","ref","INVALID_CHILDREN_MESSAGE","Icon","invariant","child","ActionIconSizeMap"],"mappings":"6RAaA,MAAMA,EAAmB,CAACC,EAAcC,EAAkBC,KAAoB,CAC5E,GAAI,cACJ,MAAOF,EACP,iDAAkD,CAChD,MAAOC,CACT,EACA,0BAA2B,CACzB,MAAOC,CACT,EACA,cAAe,CACb,MAAO,YACP,OAAQ,aACV,CACF,GAEMC,EAAkB,CAACH,EAAcC,EAAkBC,KAAoB,CAC3E,GAAIF,EACJ,MAAO,QACP,iDAAkD,CAChD,GAAIC,EACJ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EAMGG,EAAA,cAAAA,EAAA,SAAGD,KAAAA,CAAS,EAcRG,EAAaF,EAAM,WAC9B,CACE,CACE,SAAAD,EACA,MAAAL,EAAQ,UACR,WAAAS,EAAa,SACb,KAAAC,EAAO,KACP,MAAAP,EACA,KAAAQ,EACA,SAAAC,EACA,WAAAV,EAAa,GACb,YAAAE,KACGS,CACL,EACAC,IACG,CACH,MAAMC,EAA2B,YAAYC,EAAK,oDAAoDR,EAAW,cAEjH,OAAAS,EAAUX,EAAM,SAAS,MAAMD,CAAQ,IAAM,EAAGU,CAAwB,EAYtET,EAAA,cAACL,EAAA,CACC,WAAYC,EACZ,MAAOC,EACP,YAAaC,CAAAA,EAEbE,EAAA,cAACT,EAAA,CACE,GAAGgB,EACH,GAjBmBF,EACrB,CACC,GAAI,IACJ,KAAMC,EAAW,KAAOD,EACxB,QAAS,OACT,gBAAiB,CAAC,CAACC,CACrB,EACC,CAAE,KAAM,QAAS,EAWhB,aAAYT,EACZ,MAAOH,EACP,WAAYS,EACZ,KAAMC,EACN,IAAKI,EACL,SAAUF,CAETN,EAAAA,EAAM,SAAS,IAAID,EAAWa,GAAU,CAGvC,GAAI,CAACZ,EAAM,eAAeY,CAAK,EAC7B,MAAM,IAAI,MAAMH,CAAwB,EAG1C,OAAAE,EACEC,EAAM,OAASF,EACf,oBAAoBE,GAAA,KAAAA,OAAAA,EAAO,kCAAkCF,EAAK,uCAAuCR,EAAW,aACtH,EAEOF,EAAM,aAAaY,EAAO,CAC/B,KAAMC,EAAkBT,GACxB,IAAK,CAAE,GAAIQ,EAAM,MAAM,IAAMA,EAAM,MAAM,IAAM,CAAI,CAAA,CACrD,CAAC,CACH,CAAC,CACH,CACF,CAEJ,CACF,EAEAV,EAAW,YAAc"}
1
+ {"version":3,"file":"ActionIcon.js","sources":["../../../src/components/action-icon/ActionIcon.tsx"],"sourcesContent":["import type { VariantProps } from '@stitches/react'\nimport { darken } from 'color2k'\nimport invariant from 'invariant'\nimport * as React from 'react'\n\nimport { styled, theme } from '~/stitches'\nimport { NavigatorActions } from '~/types'\nimport { Override } from '~/utilities'\n\nimport { Icon } from '../icon/Icon'\nimport { Tooltip } from '../tooltip/Tooltip'\nimport { ActionIconSizeMap } from './ActionIcon.constants'\n\nconst getSimpleVariant = (base: string, interact: string, active: string) => ({\n bg: 'transparent',\n color: base,\n '&:not(:disabled):hover, &:not(:disabled):focus': {\n color: interact\n },\n '&:not(:disabled):active': {\n color: active\n },\n '&[disabled]': {\n color: '$tonal400',\n cursor: 'not-allowed'\n }\n})\n\nconst getSolidVariant = (base: string, interact: string, active: string) => ({\n bg: base,\n color: 'white',\n '&:not(:disabled):hover, &:not(:disabled):focus': {\n bg: interact,\n color: 'white'\n },\n '&:not(:disabled):active': {\n bg: active\n },\n '&[disabled]': {\n bg: '$tonal100',\n color: '$tonal400',\n cursor: 'not-allowed'\n }\n})\n\nconst getOutlineVariant = (base: string, interact: string, active: string) => ({\n border: '1px solid',\n borderColor: 'currentColor',\n color: base,\n '&:not(:disabled):hover, &:not(:disabled):focus': {\n color: interact\n },\n '&:not(:disabled):active': {\n color: active\n },\n '&[disabled]': {\n borderColor: '$tonal400',\n color: '$tonal400',\n cursor: 'not-allowed'\n }\n})\n\nconst StyledButton = styled('button', {\n alignItems: 'center',\n appearance: 'none',\n bg: 'white',\n border: 'unset',\n borderRadius: '$0',\n boxSizing: 'border-box',\n cursor: 'pointer',\n display: 'flex',\n justifyContent: 'center',\n p: 'unset',\n transition: 'all 100ms ease-out',\n variants: {\n theme: {\n neutral: {},\n primary: {},\n success: {},\n warning: {},\n danger: {}\n },\n appearance: {\n simple: {},\n outline: {},\n solid: {}\n },\n size: {\n xs: { size: '$2' },\n sm: { size: '$3' },\n md: { size: '$4' },\n lg: { size: '$5' }\n },\n isRounded: {\n true: {\n borderRadius: '$round'\n }\n }\n },\n compoundVariants: [\n // Appearance Simple\n {\n theme: 'neutral',\n appearance: 'simple',\n css: getSimpleVariant('$tonal300', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'primary',\n appearance: 'simple',\n css: getSimpleVariant('$primary', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'primaryDark',\n appearance: 'simple',\n css: getSimpleVariant(\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: 'simple',\n css: getSimpleVariant('$success', '$successMid', '$successDark')\n },\n {\n theme: 'warning',\n appearance: 'simple',\n css: getSimpleVariant('$warning', '$warningMid', '$warningDark')\n },\n {\n theme: 'danger',\n appearance: 'simple',\n css: getSimpleVariant('$danger', '$dangerMid', '$dangerDark')\n },\n\n // Appearance Solid\n {\n theme: 'primary',\n appearance: 'solid',\n css: getSolidVariant('$primary', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'primaryDark',\n appearance: 'solid',\n css: getSolidVariant(\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: getSolidVariant('$success', '$successMid', '$successDark')\n },\n {\n theme: 'warning',\n appearance: 'solid',\n css: getSolidVariant('$warning', '$warningMid', '$warningDark')\n },\n {\n theme: 'danger',\n appearance: 'solid',\n css: getSolidVariant('$danger', '$dangerMid', '$dangerDark')\n },\n\n // Appearance Outline\n {\n theme: 'primary',\n appearance: 'outline',\n css: getOutlineVariant('$primary', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'primaryDark',\n appearance: 'outline',\n css: getOutlineVariant(\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: 'outline',\n css: getOutlineVariant('$success', '$successMid', '$successDark')\n },\n {\n theme: 'warning',\n appearance: 'outline',\n css: getOutlineVariant('$warning', '$warningMid', '$warningDark')\n },\n {\n theme: 'danger',\n appearance: 'outline',\n css: getOutlineVariant('$danger', '$dangerMid', '$dangerDark')\n }\n ]\n})\n\ntype ConditionallyWrapWithTooltipProps = {\n hasTooltip: boolean\n label: string\n tooltipSide?: 'bottom' | 'left' | 'right' | 'top'\n children: React.ReactNode\n}\n\nconst ConditionallyWrapWithTooltip: React.FC<\n ConditionallyWrapWithTooltipProps\n> = ({ hasTooltip, label, tooltipSide, children }) => {\n if (hasTooltip) {\n return (\n <Tooltip>\n <Tooltip.Trigger asChild>{children}</Tooltip.Trigger>\n <Tooltip.Content side={tooltipSide}>{label}</Tooltip.Content>\n </Tooltip>\n )\n }\n\n // Ignore fragment error as this is the one place we will allow it\n // eslint-disable-next-line\n return <>{children}</>\n}\n\ntype ActionIconProps = Override<\n React.ComponentProps<typeof StyledButton>,\n VariantProps<typeof StyledButton> & {\n as?: string | React.ReactNode\n children: React.ReactNode\n label: string\n hasTooltip?: boolean\n tooltipSide?: 'bottom' | 'left' | 'right' | 'top'\n } & NavigatorActions\n>\n\nexport const ActionIcon = React.forwardRef<HTMLButtonElement, ActionIconProps>(\n (\n {\n children,\n theme = 'primary',\n appearance = 'simple',\n size = 'sm',\n label,\n href,\n disabled,\n hasTooltip = true,\n tooltipSide,\n ...remainingProps\n },\n ref\n ) => {\n const INVALID_CHILDREN_MESSAGE = `A single ${Icon.displayName} component is permitted as a child of ${ActionIcon.displayName}`\n\n invariant(React.Children.count(children) === 1, INVALID_CHILDREN_MESSAGE)\n\n const optionalLinkProps = href\n ? ({\n as: 'a',\n href: disabled ? null : href,\n onClick: undefined,\n 'aria-disabled': !!disabled\n } as const)\n : ({ type: 'button' } as const)\n\n return (\n <ConditionallyWrapWithTooltip\n hasTooltip={hasTooltip}\n label={label}\n tooltipSide={tooltipSide}\n >\n <StyledButton\n {...optionalLinkProps}\n {...remainingProps}\n aria-label={label}\n theme={theme}\n appearance={appearance}\n size={size}\n ref={ref}\n disabled={disabled}\n >\n {React.Children.map(children, (child) => {\n // TS needs this check for any following code to access child.type\n // even with optional chaining\n if (!React.isValidElement(child)) {\n throw new Error(INVALID_CHILDREN_MESSAGE)\n }\n\n invariant(\n child.type === Icon,\n `Children of type ${child?.type} aren't permitted. Only an ${Icon.displayName} component is allowed in ${ActionIcon.displayName}`\n )\n\n return React.cloneElement(child, {\n size: ActionIconSizeMap[size as string],\n css: { ...(child.props.css ? child.props.css : {}) }\n })\n })}\n </StyledButton>\n </ConditionallyWrapWithTooltip>\n )\n }\n)\n\nActionIcon.displayName = 'ActionIcon'\n"],"names":["getSimpleVariant","base","interact","active","getSolidVariant","getOutlineVariant","StyledButton","styled","darken","theme","ConditionallyWrapWithTooltip","hasTooltip","label","tooltipSide","children","React","Tooltip","ActionIcon","appearance","size","href","disabled","remainingProps","ref","INVALID_CHILDREN_MESSAGE","Icon","invariant","child","ActionIconSizeMap"],"mappings":"6RAaA,MAAMA,EAAmB,CAACC,EAAcC,EAAkBC,KAAoB,CAC5E,GAAI,cACJ,MAAOF,EACP,iDAAkD,CAChD,MAAOC,CACT,EACA,0BAA2B,CACzB,MAAOC,CACT,EACA,cAAe,CACb,MAAO,YACP,OAAQ,aACV,CACF,GAEMC,EAAkB,CAACH,EAAcC,EAAkBC,KAAoB,CAC3E,GAAIF,EACJ,MAAO,QACP,iDAAkD,CAChD,GAAIC,EACJ,MAAO,OACT,EACA,0BAA2B,CACzB,GAAIC,CACN,EACA,cAAe,CACb,GAAI,YACJ,MAAO,YACP,OAAQ,aACV,CACF,GAEME,EAAoB,CAACJ,EAAcC,EAAkBC,KAAoB,CAC7E,OAAQ,YACR,YAAa,eACb,MAAOF,EACP,iDAAkD,CAChD,MAAOC,CACT,EACA,0BAA2B,CACzB,MAAOC,CACT,EACA,cAAe,CACb,YAAa,YACb,MAAO,YACP,OAAQ,aACV,CACF,GAEMG,EAAeC,EAAO,SAAU,CACpC,WAAY,SACZ,WAAY,OACZ,GAAI,QACJ,OAAQ,QACR,aAAc,KACd,UAAW,aACX,OAAQ,UACR,QAAS,OACT,eAAgB,SAChB,EAAG,QACH,WAAY,qBACZ,SAAU,CACR,MAAO,CACL,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J,KAAMC,EAAW,KAAOD,EACxB,QAAS,OACT,gBAAiB,CAAC,CAACC,CACrB,EACC,CAAE,KAAM,QAAS,EAUf,GAAGC,EACJ,aAAYV,EACZ,MAAOH,EACP,WAAYS,EACZ,KAAMC,EACN,IAAKI,EACL,SAAUF,CAETN,EAAAA,EAAM,SAAS,IAAID,EAAWa,GAAU,CAGvC,GAAI,CAACZ,EAAM,eAAeY,CAAK,EAC7B,MAAM,IAAI,MAAMH,CAAwB,EAG1C,OAAAE,EACEC,EAAM,OAASF,EACf,oBAAoBE,GAAA,KAAAA,OAAAA,EAAO,kCAAkCF,EAAK,uCAAuCR,EAAW,aACtH,EAEOF,EAAM,aAAaY,EAAO,CAC/B,KAAMC,EAAkBT,GACxB,IAAK,CAAE,GAAIQ,EAAM,MAAM,IAAMA,EAAM,MAAM,IAAM,CAAI,CAAA,CACrD,CAAC,CACH,CAAC,CACH,CACF,CAEJ,CACF,EAEAV,EAAW,YAAc"}
@@ -219,7 +219,7 @@ declare const StyledBadge: import("@stitches/react/types/styled-component").Styl
219
219
  marginBottom: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
220
220
  };
221
221
  }>>, {
222
- theme?: "success" | "danger" | "warning" | "neutral" | "info" | undefined;
222
+ theme?: "success" | "danger" | "warning" | "purple" | "neutral" | "info" | undefined;
223
223
  size?: "sm" | "md" | "xs" | undefined;
224
224
  }, {
225
225
  sm: string;
@@ -1,2 +1,2 @@
1
- import*as t from"react";import{styled as m}from"../../stitches.js";import{Box as l}from"../box/Box.js";import{Flex as a}from"../flex/Flex.js";import{Icon as c}from"../icon/Icon.js";const d=m(a,{justifyContent:"center",alignItems:"center",borderRadius:"$0",minWidth:0,border:"1px solid #FFFFFF",fontFamily:"$body","& > *:not(:last-child)":{mr:"$1"},variants:{theme:{success:{bg:"$successLight",color:"$successMid"},warning:{bg:"$warningLight",color:"$warningText"},danger:{bg:"$dangerLight",color:"$dangerMid"},neutral:{bg:"$tonal50",color:"$tonal400"},info:{bg:"$primaryLight",color:"$primaryMid"}},size:{xs:{fontSize:"$sm",px:"$1",height:"$2"},sm:{fontSize:"$md",px:"$1",height:"$3"},md:{fontSize:"$md",px:"$2",height:"$4"}}}}),i=({theme:r="info",size:o="sm",children:n,...s})=>t.createElement(d,{role:"status",theme:r,size:o,...s},t.Children.map(n,e=>{if(typeof e=="string"||typeof e=="number")return t.createElement(l,{css:{whiteSpace:"nowrap",overflowX:"hidden",textOverflow:"ellipsis",py:"$0"}},e);if(t.isValidElement(e)&&e.type===c)return t.cloneElement(e,{size:"sm",css:{...e.props.css,flexShrink:0}})}));i.displayName="Badge";export{i as Badge};
1
+ import*as r from"react";import{styled as l}from"../../stitches.js";import{Box as m}from"../box/Box.js";import{Flex as a}from"../flex/Flex.js";import{Icon as p}from"../icon/Icon.js";const c=l(a,{justifyContent:"center",alignItems:"center",borderRadius:"$0",minWidth:0,border:"1px solid #FFFFFF",fontFamily:"$body","& > *:not(:last-child)":{mr:"$1"},variants:{theme:{success:{bg:"$successLight",color:"$successMid"},warning:{bg:"$warningLight",color:"$warningText"},danger:{bg:"$dangerLight",color:"$dangerMid"},neutral:{bg:"$tonal50",color:"$tonal400"},info:{bg:"$primaryLight",color:"$primaryMid"},purple:{bg:"$purple200",color:"$purple1000"}},size:{xs:{fontSize:"$sm",px:"$1",height:"$2"},sm:{fontSize:"$md",px:"$1",height:"$3"},md:{fontSize:"$md",px:"$2",height:"$4"}}}}),t=({theme:i="info",size:o="sm",children:n,...s})=>r.createElement(c,{role:"status",theme:i,size:o,...s},r.Children.map(n,e=>{if(typeof e=="string"||typeof e=="number")return r.createElement(m,{css:{whiteSpace:"nowrap",overflowX:"hidden",textOverflow:"ellipsis",py:"$0"}},e);if(r.isValidElement(e)&&e.type===p)return r.cloneElement(e,{size:"sm",css:{...e.props.css,flexShrink:0}})}));t.displayName="Badge";export{t as Badge};
2
2
  //# sourceMappingURL=Badge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","sources":["../../../src/components/badge/Badge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '~/stitches'\n\nimport { Box } from '../box'\nimport { Flex } from '../flex'\nimport { Icon } from '../icon'\n\nconst StyledBadge = styled(Flex, {\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: '$0',\n minWidth: 0,\n border: '1px solid #FFFFFF',\n fontFamily: '$body',\n '& > *:not(:last-child)': {\n mr: '$1'\n },\n variants: {\n theme: {\n success: {\n bg: '$successLight',\n color: '$successMid'\n },\n warning: {\n bg: '$warningLight',\n color: '$warningText'\n },\n danger: {\n bg: '$dangerLight',\n color: '$dangerMid'\n },\n neutral: {\n bg: '$tonal50',\n color: '$tonal400'\n },\n info: {\n bg: '$primaryLight',\n color: '$primaryMid'\n }\n },\n size: {\n xs: {\n fontSize: '$sm',\n px: '$1',\n height: '$2'\n },\n sm: {\n fontSize: '$md',\n px: '$1',\n height: '$3'\n },\n md: {\n fontSize: '$md',\n px: '$2',\n height: '$4'\n }\n }\n }\n})\n\ntype BadgeProps = React.ComponentProps<typeof StyledBadge>\n\nexport const Badge: React.FC<BadgeProps> = ({\n theme = 'info',\n size = 'sm',\n children,\n ...rest\n}) => {\n return (\n <StyledBadge role=\"status\" theme={theme} size={size} {...rest}>\n {React.Children.map(children, (child) => {\n if (typeof child === 'string' || typeof child === 'number') {\n return (\n <Box\n css={{\n whiteSpace: 'nowrap',\n overflowX: 'hidden',\n textOverflow: 'ellipsis',\n py: '$0'\n }}\n >\n {child}\n </Box>\n )\n }\n\n if (React.isValidElement(child) && child.type === Icon) {\n return React.cloneElement(\n child as React.ReactElement<React.ComponentProps<typeof Icon>>,\n {\n size: 'sm',\n css: { ...child.props.css, flexShrink: 0 }\n }\n )\n }\n })}\n </StyledBadge>\n )\n}\n\nBadge.displayName = 'Badge'\n"],"names":["StyledBadge","styled","Flex","Badge","theme","size","children","rest","React","child","Box","Icon"],"mappings":"qLAQA,MAAMA,EAAcC,EAAOC,EAAM,CAC/B,eAAgB,SAChB,WAAY,SACZ,aAAc,KACd,SAAU,EACV,OAAQ,oBACR,WAAY,QACZ,yBAA0B,CACxB,GAAI,IACN,EACA,SAAU,CACR,MAAO,CACL,QAAS,CACP,GAAI,gBACJ,MAAO,aACT,EACA,QAAS,CACP,GAAI,gBACJ,MAAO,cACT,EACA,OAAQ,CACN,GAAI,eACJ,MAAO,YACT,EACA,QAAS,CACP,GAAI,WACJ,MAAO,WACT,EACA,KAAM,CACJ,GAAI,gBACJ,MAAO,aACT,CACF,EACA,KAAM,CACJ,GAAI,CACF,SAAU,MACV,GAAI,KACJ,OAAQ,IACV,EACA,GAAI,CACF,SAAU,MACV,GAAI,KACJ,OAAQ,IACV,EACA,GAAI,CACF,SAAU,MACV,GAAI,KACJ,OAAQ,IACV,CACF,CACF,CACF,CAAC,EAIYC,EAA8B,CAAC,CAC1C,MAAAC,EAAQ,OACR,KAAAC,EAAO,KACP,SAAAC,KACGC,CACL,IAEIC,EAAA,cAACR,EAAA,CAAY,KAAK,SAAS,MAAOI,EAAO,KAAMC,EAAO,GAAGE,GACtDC,EAAM,SAAS,IAAIF,EAAWG,GAAU,CACvC,GAAI,OAAOA,GAAU,UAAY,OAAOA,GAAU,SAChD,OACED,EAAA,cAACE,EAAA,CACC,IAAK,CACH,WAAY,SACZ,UAAW,SACX,aAAc,WACd,GAAI,IACN,CAECD,EAAAA,CACH,EAIJ,GAAID,EAAM,eAAeC,CAAK,GAAKA,EAAM,OAASE,EAChD,OAAOH,EAAM,aACXC,EACA,CACE,KAAM,KACN,IAAK,CAAE,GAAGA,EAAM,MAAM,IAAK,WAAY,CAAE,CAC3C,CACF,CAEJ,CAAC,CACH,EAIJN,EAAM,YAAc"}
1
+ {"version":3,"file":"Badge.js","sources":["../../../src/components/badge/Badge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '~/stitches'\n\nimport { Box } from '../box'\nimport { Flex } from '../flex'\nimport { Icon } from '../icon'\n\nconst StyledBadge = styled(Flex, {\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: '$0',\n minWidth: 0,\n border: '1px solid #FFFFFF',\n fontFamily: '$body',\n '& > *:not(:last-child)': {\n mr: '$1'\n },\n variants: {\n theme: {\n success: {\n bg: '$successLight',\n color: '$successMid'\n },\n warning: {\n bg: '$warningLight',\n color: '$warningText'\n },\n danger: {\n bg: '$dangerLight',\n color: '$dangerMid'\n },\n neutral: {\n bg: '$tonal50',\n color: '$tonal400'\n },\n info: {\n bg: '$primaryLight',\n color: '$primaryMid'\n },\n purple: {\n bg: '$purple200',\n color: '$purple1000'\n }\n },\n size: {\n xs: {\n fontSize: '$sm',\n px: '$1',\n height: '$2'\n },\n sm: {\n fontSize: '$md',\n px: '$1',\n height: '$3'\n },\n md: {\n fontSize: '$md',\n px: '$2',\n height: '$4'\n }\n }\n }\n})\n\ntype BadgeProps = React.ComponentProps<typeof StyledBadge>\n\nexport const Badge: React.FC<BadgeProps> = ({\n theme = 'info',\n size = 'sm',\n children,\n ...rest\n}) => {\n return (\n <StyledBadge role=\"status\" theme={theme} size={size} {...rest}>\n {React.Children.map(children, (child) => {\n if (typeof child === 'string' || typeof child === 'number') {\n return (\n <Box\n css={{\n whiteSpace: 'nowrap',\n overflowX: 'hidden',\n textOverflow: 'ellipsis',\n py: '$0'\n }}\n >\n {child}\n </Box>\n )\n }\n\n if (React.isValidElement(child) && child.type === Icon) {\n return React.cloneElement(\n child as React.ReactElement<React.ComponentProps<typeof Icon>>,\n {\n size: 'sm',\n css: { ...child.props.css, flexShrink: 0 }\n }\n )\n }\n })}\n </StyledBadge>\n )\n}\n\nBadge.displayName = 'Badge'\n"],"names":["StyledBadge","styled","Flex","Badge","theme","size","children","rest","React","child","Box","Icon"],"mappings":"qLAQA,MAAMA,EAAcC,EAAOC,EAAM,CAC/B,eAAgB,SAChB,WAAY,SACZ,aAAc,KACd,SAAU,EACV,OAAQ,oBACR,WAAY,QACZ,yBAA0B,CACxB,GAAI,IACN,EACA,SAAU,CACR,MAAO,CACL,QAAS,CACP,GAAI,gBACJ,MAAO,aACT,EACA,QAAS,CACP,GAAI,gBACJ,MAAO,cACT,EACA,OAAQ,CACN,GAAI,eACJ,MAAO,YACT,EACA,QAAS,CACP,GAAI,WACJ,MAAO,WACT,EACA,KAAM,CACJ,GAAI,gBACJ,MAAO,aACT,EACA,OAAQ,CACN,GAAI,aACJ,MAAO,aACT,CACF,EACA,KAAM,CACJ,GAAI,CACF,SAAU,MACV,GAAI,KACJ,OAAQ,IACV,EACA,GAAI,CACF,SAAU,MACV,GAAI,KACJ,OAAQ,IACV,EACA,GAAI,CACF,SAAU,MACV,GAAI,KACJ,OAAQ,IACV,CACF,CACF,CACF,CAAC,EAIYC,EAA8B,CAAC,CAC1C,MAAAC,EAAQ,OACR,KAAAC,EAAO,KACP,SAAAC,KACGC,CACL,IAEIC,EAAA,cAACR,EAAA,CAAY,KAAK,SAAS,MAAOI,EAAO,KAAMC,EAAO,GAAGE,CACtDC,EAAAA,EAAM,SAAS,IAAIF,EAAWG,GAAU,CACvC,GAAI,OAAOA,GAAU,UAAY,OAAOA,GAAU,SAChD,OACED,EAAA,cAACE,EAAA,CACC,IAAK,CACH,WAAY,SACZ,UAAW,SACX,aAAc,WACd,GAAI,IACN,CAAA,EAECD,CACH,EAIJ,GAAID,EAAM,eAAeC,CAAK,GAAKA,EAAM,OAASE,EAChD,OAAOH,EAAM,aACXC,EACA,CACE,KAAM,KACN,IAAK,CAAE,GAAGA,EAAM,MAAM,IAAK,WAAY,CAAE,CAC3C,CACF,CAEJ,CAAC,CACH,EAIJN,EAAM,YAAc"}