@khanacademy/wonder-blocks-link 9.1.4 → 9.1.6
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 +31 -0
- package/dist/es/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-link
|
|
2
2
|
|
|
3
|
+
## 9.1.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [8468d8d]
|
|
8
|
+
- Updated dependencies [308696e]
|
|
9
|
+
- Updated dependencies [dc34e0c]
|
|
10
|
+
- Updated dependencies [2cace08]
|
|
11
|
+
- Updated dependencies [f714517]
|
|
12
|
+
- Updated dependencies [8468d8d]
|
|
13
|
+
- @khanacademy/wonder-blocks-tokens@10.5.0
|
|
14
|
+
- @khanacademy/wonder-blocks-icon@5.2.0
|
|
15
|
+
- @khanacademy/wonder-blocks-clickable@7.1.6
|
|
16
|
+
|
|
17
|
+
## 9.1.5
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 1c3c335: Use `semanticColor.link` tokens
|
|
22
|
+
- 9bacc1a: Replaces all existing `semanticColor.border` references to use `semanticColor.core.border`
|
|
23
|
+
- 7abcccf: Replace call sites to use `core.background` instead of `action`.
|
|
24
|
+
- Updated dependencies [b1ee2b4]
|
|
25
|
+
- Updated dependencies [7abcccf]
|
|
26
|
+
- Updated dependencies [9bacc1a]
|
|
27
|
+
- Updated dependencies [9bacc1a]
|
|
28
|
+
- Updated dependencies [7abcccf]
|
|
29
|
+
- Updated dependencies [1c3c335]
|
|
30
|
+
- Updated dependencies [689f5d3]
|
|
31
|
+
- @khanacademy/wonder-blocks-tokens@10.4.0
|
|
32
|
+
- @khanacademy/wonder-blocks-clickable@7.1.5
|
|
33
|
+
|
|
3
34
|
## 9.1.4
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/dist/es/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { spacing, semanticColor, color, border } from '@khanacademy/wonder-block
|
|
|
8
8
|
import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
9
9
|
import externalLinkIcon from '@phosphor-icons/core/bold/arrow-square-out-bold.svg';
|
|
10
10
|
|
|
11
|
-
const StyledA=addStyle("a");const StyledLink=addStyle(Link$1);const LinkCore=React.forwardRef(function LinkCore(props,ref){const inRouterContext=useInRouterContext();const{children,skipClientNav,focused,hovered,href,inline=false,light=false,pressed,style,testId,waiting:_,target,startIcon,endIcon,viewTransition,...restProps}=props;const linkStyles=_generateStyles(inline,light);const defaultStyles=[sharedStyles.shared,linkStyles.rest,inline&&linkStyles.restInline,!pressed&&focused&&linkStyles.focus];const commonProps={"data-testid":testId,style:[defaultStyles,style],target,...restProps};const linkUrl=new URL(href,window.location.origin);const isExternalLink=linkUrl.origin!==window.location.origin;const externalIcon=jsx(PhosphorIcon,{icon:externalLinkIcon,size:"small",style:[linkContentStyles.endIcon,linkContentStyles.centered],testId:"external-icon"});let startIconElement;let endIconElement;if(startIcon){startIconElement=React.cloneElement(startIcon,{style:[linkContentStyles.startIcon,linkContentStyles.centered],testId:"start-icon","aria-hidden":"true",...startIcon.props});}if(endIcon){endIconElement=React.cloneElement(endIcon,{style:[linkContentStyles.endIcon,linkContentStyles.centered],testId:"end-icon","aria-hidden":"true",...endIcon.props});}const linkContent=jsxs(Fragment,{children:[startIcon&&startIconElement,children,endIcon?endIconElement:isExternalLink&&target==="_blank"&&externalIcon]});return inRouterContext&&!skipClientNav&&isClientSideUrl(href)?jsx(StyledLink,{...commonProps,to:href,ref:ref,viewTransition:viewTransition,children:linkContent}):jsx(StyledA,{...commonProps,href:href,ref:ref,children:linkContent})});const styles={};const linkContentStyles=StyleSheet.create({startIcon:{marginInlineEnd:spacing.xxxSmall_4},endIcon:{marginInlineStart:spacing.xxxSmall_4},centered:{verticalAlign:"-10%"}});const sharedStyles=StyleSheet.create({shared:{cursor:"pointer",textDecoration:"none",outline:"none",alignItems:"center"}});const
|
|
11
|
+
const StyledA=addStyle("a");const StyledLink=addStyle(Link$1);const LinkCore=React.forwardRef(function LinkCore(props,ref){const inRouterContext=useInRouterContext();const{children,skipClientNav,focused,hovered,href,inline=false,light=false,pressed,style,testId,waiting:_,target,startIcon,endIcon,viewTransition,...restProps}=props;const linkStyles=_generateStyles(inline,light);const defaultStyles=[sharedStyles.shared,linkStyles.rest,inline&&linkStyles.restInline,!pressed&&focused&&linkStyles.focus];const commonProps={"data-testid":testId,style:[defaultStyles,style],target,...restProps};const linkUrl=new URL(href,window.location.origin);const isExternalLink=linkUrl.origin!==window.location.origin;const externalIcon=jsx(PhosphorIcon,{icon:externalLinkIcon,size:"small",style:[linkContentStyles.endIcon,linkContentStyles.centered],testId:"external-icon"});let startIconElement;let endIconElement;if(startIcon){startIconElement=React.cloneElement(startIcon,{style:[linkContentStyles.startIcon,linkContentStyles.centered],testId:"start-icon","aria-hidden":"true",...startIcon.props});}if(endIcon){endIconElement=React.cloneElement(endIcon,{style:[linkContentStyles.endIcon,linkContentStyles.centered],testId:"end-icon","aria-hidden":"true",...endIcon.props});}const linkContent=jsxs(Fragment,{children:[startIcon&&startIconElement,children,endIcon?endIconElement:isExternalLink&&target==="_blank"&&externalIcon]});return inRouterContext&&!skipClientNav&&isClientSideUrl(href)?jsx(StyledLink,{...commonProps,to:href,ref:ref,viewTransition:viewTransition,children:linkContent}):jsx(StyledA,{...commonProps,href:href,ref:ref,children:linkContent})});const styles={};const linkContentStyles=StyleSheet.create({startIcon:{marginInlineEnd:spacing.xxxSmall_4},endIcon:{marginInlineStart:spacing.xxxSmall_4},centered:{verticalAlign:"-10%"}});const sharedStyles=StyleSheet.create({shared:{cursor:"pointer",textDecoration:"none",outline:"none",alignItems:"center"}});const theme={color:{default:{rest:{foreground:semanticColor.link.rest},hover:{foreground:semanticColor.link.hover},focus:{border:semanticColor.focus.outer},press:{foreground:semanticColor.link.press}},inverse:{rest:{foreground:semanticColor.core.foreground.inverse.strong},hover:{foreground:semanticColor.core.foreground.inverse.strong},focus:{border:semanticColor.core.border.inverse.strong},press:{foreground:color.fadedBlue}}}};const _generateStyles=(inline,light)=>{const buttonType=`${inline.toString()}-${light.toString()}`;if(styles[buttonType]){return styles[buttonType]}const variant=light?theme.color.inverse:theme.color.default;const focusStyling={outline:`${border.width.thin} solid ${variant.focus.border}`,borderRadius:border.radius.radius_040,outlineOffset:border.width.medium};const pressStyling={color:variant.press.foreground,textDecoration:"underline currentcolor solid"};const newStyles={rest:{color:variant.rest.foreground,":hover":{textDecoration:"underline currentcolor solid",color:variant.hover.foreground},":focus-visible":focusStyling,":active":pressStyling},restInline:{textDecoration:"underline currentcolor solid",textUnderlineOffset:border.width.medium},focus:focusStyling,press:pressStyling};styles[buttonType]=StyleSheet.create(newStyles);return styles[buttonType]};
|
|
12
12
|
|
|
13
13
|
const Link=React.forwardRef(function Link(props,ref){const{onClick,beforeNav=undefined,safeWithNav,href,skipClientNav,children,tabIndex,onKeyDown,onKeyUp,target=undefined,inline=false,light=false,viewTransition=false,...sharedProps}=props;const inRouterContext=useInRouterContext();const ClickableBehavior=getClickableBehavior(href,skipClientNav,inRouterContext);if(beforeNav){return jsx(ClickableBehavior,{disabled:false,href:href,role:"link",onClick:onClick,beforeNav:beforeNav,safeWithNav:safeWithNav,onKeyDown:onKeyDown,onKeyUp:onKeyUp,viewTransition:viewTransition,children:(state,{...childrenProps})=>{return jsx(LinkCore,{...sharedProps,...state,...childrenProps,skipClientNav:skipClientNav,href:href,target:target,tabIndex:tabIndex,inline:inline,light:light,ref:ref,viewTransition:viewTransition,children:children})}})}else {return jsx(ClickableBehavior,{disabled:false,href:href,role:"link",onClick:onClick,safeWithNav:safeWithNav,target:target,onKeyDown:onKeyDown,onKeyUp:onKeyUp,viewTransition:viewTransition,children:(state,{...childrenProps})=>{return jsx(LinkCore,{...sharedProps,...state,...childrenProps,skipClientNav:skipClientNav,href:href,target:target,tabIndex:tabIndex,inline:inline,light:light,ref:ref,viewTransition:viewTransition,children:children})}})}});
|
|
14
14
|
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ function _interopNamespace(e) {
|
|
|
33
33
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
34
|
var externalLinkIcon__default = /*#__PURE__*/_interopDefaultLegacy(externalLinkIcon);
|
|
35
35
|
|
|
36
|
-
const StyledA=wonderBlocksCore.addStyle("a");const StyledLink=wonderBlocksCore.addStyle(reactRouterDomV5Compat.Link);const LinkCore=React__namespace.forwardRef(function LinkCore(props,ref){const inRouterContext=reactRouterDomV5Compat.useInRouterContext();const{children,skipClientNav,focused,hovered,href,inline=false,light=false,pressed,style,testId,waiting:_,target,startIcon,endIcon,viewTransition,...restProps}=props;const linkStyles=_generateStyles(inline,light);const defaultStyles=[sharedStyles.shared,linkStyles.rest,inline&&linkStyles.restInline,!pressed&&focused&&linkStyles.focus];const commonProps={"data-testid":testId,style:[defaultStyles,style],target,...restProps};const linkUrl=new URL(href,window.location.origin);const isExternalLink=linkUrl.origin!==window.location.origin;const externalIcon=jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{icon:externalLinkIcon__default["default"],size:"small",style:[linkContentStyles.endIcon,linkContentStyles.centered],testId:"external-icon"});let startIconElement;let endIconElement;if(startIcon){startIconElement=React__namespace.cloneElement(startIcon,{style:[linkContentStyles.startIcon,linkContentStyles.centered],testId:"start-icon","aria-hidden":"true",...startIcon.props});}if(endIcon){endIconElement=React__namespace.cloneElement(endIcon,{style:[linkContentStyles.endIcon,linkContentStyles.centered],testId:"end-icon","aria-hidden":"true",...endIcon.props});}const linkContent=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[startIcon&&startIconElement,children,endIcon?endIconElement:isExternalLink&&target==="_blank"&&externalIcon]});return inRouterContext&&!skipClientNav&&wonderBlocksClickable.isClientSideUrl(href)?jsxRuntime.jsx(StyledLink,{...commonProps,to:href,ref:ref,viewTransition:viewTransition,children:linkContent}):jsxRuntime.jsx(StyledA,{...commonProps,href:href,ref:ref,children:linkContent})});const styles={};const linkContentStyles=aphrodite.StyleSheet.create({startIcon:{marginInlineEnd:wonderBlocksTokens.spacing.xxxSmall_4},endIcon:{marginInlineStart:wonderBlocksTokens.spacing.xxxSmall_4},centered:{verticalAlign:"-10%"}});const sharedStyles=aphrodite.StyleSheet.create({shared:{cursor:"pointer",textDecoration:"none",outline:"none",alignItems:"center"}});const
|
|
36
|
+
const StyledA=wonderBlocksCore.addStyle("a");const StyledLink=wonderBlocksCore.addStyle(reactRouterDomV5Compat.Link);const LinkCore=React__namespace.forwardRef(function LinkCore(props,ref){const inRouterContext=reactRouterDomV5Compat.useInRouterContext();const{children,skipClientNav,focused,hovered,href,inline=false,light=false,pressed,style,testId,waiting:_,target,startIcon,endIcon,viewTransition,...restProps}=props;const linkStyles=_generateStyles(inline,light);const defaultStyles=[sharedStyles.shared,linkStyles.rest,inline&&linkStyles.restInline,!pressed&&focused&&linkStyles.focus];const commonProps={"data-testid":testId,style:[defaultStyles,style],target,...restProps};const linkUrl=new URL(href,window.location.origin);const isExternalLink=linkUrl.origin!==window.location.origin;const externalIcon=jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{icon:externalLinkIcon__default["default"],size:"small",style:[linkContentStyles.endIcon,linkContentStyles.centered],testId:"external-icon"});let startIconElement;let endIconElement;if(startIcon){startIconElement=React__namespace.cloneElement(startIcon,{style:[linkContentStyles.startIcon,linkContentStyles.centered],testId:"start-icon","aria-hidden":"true",...startIcon.props});}if(endIcon){endIconElement=React__namespace.cloneElement(endIcon,{style:[linkContentStyles.endIcon,linkContentStyles.centered],testId:"end-icon","aria-hidden":"true",...endIcon.props});}const linkContent=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[startIcon&&startIconElement,children,endIcon?endIconElement:isExternalLink&&target==="_blank"&&externalIcon]});return inRouterContext&&!skipClientNav&&wonderBlocksClickable.isClientSideUrl(href)?jsxRuntime.jsx(StyledLink,{...commonProps,to:href,ref:ref,viewTransition:viewTransition,children:linkContent}):jsxRuntime.jsx(StyledA,{...commonProps,href:href,ref:ref,children:linkContent})});const styles={};const linkContentStyles=aphrodite.StyleSheet.create({startIcon:{marginInlineEnd:wonderBlocksTokens.spacing.xxxSmall_4},endIcon:{marginInlineStart:wonderBlocksTokens.spacing.xxxSmall_4},centered:{verticalAlign:"-10%"}});const sharedStyles=aphrodite.StyleSheet.create({shared:{cursor:"pointer",textDecoration:"none",outline:"none",alignItems:"center"}});const theme={color:{default:{rest:{foreground:wonderBlocksTokens.semanticColor.link.rest},hover:{foreground:wonderBlocksTokens.semanticColor.link.hover},focus:{border:wonderBlocksTokens.semanticColor.focus.outer},press:{foreground:wonderBlocksTokens.semanticColor.link.press}},inverse:{rest:{foreground:wonderBlocksTokens.semanticColor.core.foreground.inverse.strong},hover:{foreground:wonderBlocksTokens.semanticColor.core.foreground.inverse.strong},focus:{border:wonderBlocksTokens.semanticColor.core.border.inverse.strong},press:{foreground:wonderBlocksTokens.color.fadedBlue}}}};const _generateStyles=(inline,light)=>{const buttonType=`${inline.toString()}-${light.toString()}`;if(styles[buttonType]){return styles[buttonType]}const variant=light?theme.color.inverse:theme.color.default;const focusStyling={outline:`${wonderBlocksTokens.border.width.thin} solid ${variant.focus.border}`,borderRadius:wonderBlocksTokens.border.radius.radius_040,outlineOffset:wonderBlocksTokens.border.width.medium};const pressStyling={color:variant.press.foreground,textDecoration:"underline currentcolor solid"};const newStyles={rest:{color:variant.rest.foreground,":hover":{textDecoration:"underline currentcolor solid",color:variant.hover.foreground},":focus-visible":focusStyling,":active":pressStyling},restInline:{textDecoration:"underline currentcolor solid",textUnderlineOffset:wonderBlocksTokens.border.width.medium},focus:focusStyling,press:pressStyling};styles[buttonType]=aphrodite.StyleSheet.create(newStyles);return styles[buttonType]};
|
|
37
37
|
|
|
38
38
|
const Link=React__namespace.forwardRef(function Link(props,ref){const{onClick,beforeNav=undefined,safeWithNav,href,skipClientNav,children,tabIndex,onKeyDown,onKeyUp,target=undefined,inline=false,light=false,viewTransition=false,...sharedProps}=props;const inRouterContext=reactRouterDomV5Compat.useInRouterContext();const ClickableBehavior=wonderBlocksClickable.getClickableBehavior(href,skipClientNav,inRouterContext);if(beforeNav){return jsxRuntime.jsx(ClickableBehavior,{disabled:false,href:href,role:"link",onClick:onClick,beforeNav:beforeNav,safeWithNav:safeWithNav,onKeyDown:onKeyDown,onKeyUp:onKeyUp,viewTransition:viewTransition,children:(state,{...childrenProps})=>{return jsxRuntime.jsx(LinkCore,{...sharedProps,...state,...childrenProps,skipClientNav:skipClientNav,href:href,target:target,tabIndex:tabIndex,inline:inline,light:light,ref:ref,viewTransition:viewTransition,children:children})}})}else {return jsxRuntime.jsx(ClickableBehavior,{disabled:false,href:href,role:"link",onClick:onClick,safeWithNav:safeWithNav,target:target,onKeyDown:onKeyDown,onKeyUp:onKeyUp,viewTransition:viewTransition,children:(state,{...childrenProps})=>{return jsxRuntime.jsx(LinkCore,{...sharedProps,...state,...childrenProps,skipClientNav:skipClientNav,href:href,target:target,tabIndex:tabIndex,inline:inline,light:light,ref:ref,viewTransition:viewTransition,children:children})}})}});
|
|
39
39
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-link",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.6",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"author": "",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@khanacademy/wonder-blocks-clickable": "7.1.
|
|
15
|
+
"@khanacademy/wonder-blocks-clickable": "7.1.6",
|
|
16
16
|
"@khanacademy/wonder-blocks-core": "12.3.0",
|
|
17
|
-
"@khanacademy/wonder-blocks-icon": "5.
|
|
18
|
-
"@khanacademy/wonder-blocks-tokens": "10.
|
|
17
|
+
"@khanacademy/wonder-blocks-icon": "5.2.0",
|
|
18
|
+
"@khanacademy/wonder-blocks-tokens": "10.5.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@phosphor-icons/core": "^2.0.2",
|