@storybook/addon-links 9.0.0-beta.1 → 9.0.0-beta.11

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/README.md CHANGED
@@ -80,8 +80,8 @@ export const third = () => <LinkTo story="index">Go back</LinkTo>;
80
80
  If you want to get an URL for a particular story, you may use `hrefTo` function. It returns a promise, which resolves to string containing a relative URL:
81
81
 
82
82
  ```js
83
- import { action } from 'storybook/actions';
84
83
  import { hrefTo } from '@storybook/addon-links';
84
+ import { action } from 'storybook/actions';
85
85
 
86
86
  export default {
87
87
  title: 'Href',
@@ -132,7 +132,7 @@ export const second = () => <LinkTo story="first">Go to First</LinkTo>;
132
132
 
133
133
  It accepts all the props the `a` element does, plus `story` and `kind`. It the `kind` prop is omitted, the current kind will be preserved.
134
134
 
135
- ```js
135
+ ```mdx
136
136
  <LinkTo
137
137
  kind="Toggle"
138
138
  story="off"
@@ -1,6 +1,6 @@
1
1
  import { hrefTo, navigate } from '../chunk-DAF6YNFB.mjs';
2
2
  import React, { PureComponent } from 'react';
3
3
 
4
- var LEFT_BUTTON=0,isPlainLeftClick=e=>e.button===LEFT_BUTTON&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey,cancelled=(e,cb=_e=>{})=>{isPlainLeftClick(e)&&(e.preventDefault(),cb(e));},LinkTo=class extends PureComponent{constructor(){super(...arguments);this.state={href:"/"};this.updateHref=async()=>{let{kind,title=kind,story,name=story}=this.props;if(title&&name){let href=await hrefTo(title,name);this.setState({href});}};this.handleClick=()=>{let{kind,title=kind,story,name=story}=this.props;title&&name&&navigate({title,name});};}static{this.defaultProps={children:void 0};}componentDidMount(){this.updateHref();}componentDidUpdate(prevProps){let{kind,title,story,name}=this.props;(prevProps.kind!==kind||prevProps.story!==story||prevProps.title!==title||prevProps.name!==name)&&this.updateHref();}render(){let{kind,title=kind,story,name=story,children,...rest}=this.props,{href}=this.state;return React.createElement("a",{href,onClick:e=>cancelled(e,this.handleClick),...rest},children)}};var react_default=LinkTo;
4
+ var LEFT_BUTTON=0,isPlainLeftClick=e=>e.button===LEFT_BUTTON&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey,cancelled=(e,cb=_e=>{})=>{isPlainLeftClick(e)&&(e.preventDefault(),cb(e));},LinkTo=class extends PureComponent{constructor(){super(...arguments);this.state={href:"/"};this.updateHref=async()=>{let{kind,title=kind,story,name=story}=this.props;if(title&&name){let href=await hrefTo(title,name);this.setState({href});}};this.handleClick=()=>{let{kind,title=kind,story,name=story}=this.props;title&&name&&navigate({title,name});};}componentDidMount(){this.updateHref();}componentDidUpdate(prevProps){let{kind,title,story,name}=this.props;(prevProps.kind!==kind||prevProps.story!==story||prevProps.title!==title||prevProps.name!==name)&&this.updateHref();}render(){let{kind,title=kind,story,name=story,children,...rest}=this.props,{href}=this.state;return React.createElement("a",{href,onClick:e=>cancelled(e,this.handleClick),...rest},children)}};LinkTo.defaultProps={children:void 0};var react_default=LinkTo;
5
5
 
6
6
  export { react_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-links",
3
- "version": "9.0.0-beta.1",
3
+ "version": "9.0.0-beta.11",
4
4
  "description": "Link stories together to build demos and prototypes with your UI components",
5
5
  "keywords": [
6
6
  "storybook-addons",
@@ -68,15 +68,14 @@
68
68
  "prep": "jiti ../../../scripts/prepare/addon-bundle.ts"
69
69
  },
70
70
  "dependencies": {
71
- "@storybook/global": "^5.0.0",
72
- "ts-dedent": "^2.0.0"
71
+ "@storybook/global": "^5.0.0"
73
72
  },
74
73
  "devDependencies": {
75
- "typescript": "^5.7.3"
74
+ "typescript": "^5.8.3"
76
75
  },
77
76
  "peerDependencies": {
78
77
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
79
- "storybook": "^9.0.0-beta.1"
78
+ "storybook": "^9.0.0-beta.11"
80
79
  },
81
80
  "peerDependenciesMeta": {
82
81
  "react": {