@fluentui/react-link 9.0.0-rc.9 → 9.0.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.json +255 -1
- package/CHANGELOG.md +82 -2
- package/MIGRATION.md +12 -16
- package/README.md +19 -12
- package/SPEC.md +2 -67
- package/dist/index.d.ts +4 -10
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/Link/Link.types.js.map +1 -1
- package/lib/components/Link/renderLink.js.map +1 -1
- package/lib/components/Link/useLink.js +4 -4
- package/lib/components/Link/useLink.js.map +1 -1
- package/lib/components/Link/useLinkState.js +2 -1
- package/lib/components/Link/useLinkState.js.map +1 -1
- package/lib/components/Link/useLinkStyles.js +9 -8
- package/lib/components/Link/useLinkStyles.js.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/Link/Link.js.map +1 -1
- package/lib-commonjs/components/Link/renderLink.js.map +1 -1
- package/lib-commonjs/components/Link/useLink.js +4 -4
- package/lib-commonjs/components/Link/useLink.js.map +1 -1
- package/lib-commonjs/components/Link/useLinkState.js +2 -1
- package/lib-commonjs/components/Link/useLinkState.js.map +1 -1
- package/lib-commonjs/components/Link/useLinkStyles.js +10 -9
- package/lib-commonjs/components/Link/useLinkStyles.js.map +1 -1
- package/lib-commonjs/index.js +1 -8
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +9 -11
- package/lib/Link.d.ts +0 -1
- package/lib/components/Link/Link.d.ts +0 -6
- package/lib/components/Link/Link.types.d.ts +0 -33
- package/lib/components/Link/index.d.ts +0 -6
- package/lib/components/Link/renderLink.d.ts +0 -5
- package/lib/components/Link/useLink.d.ts +0 -8
- package/lib/components/Link/useLinkState.d.ts +0 -6
- package/lib/components/Link/useLinkStyles.d.ts +0 -8
- package/lib/index.d.ts +0 -2
- package/lib-commonjs/Link.d.ts +0 -1
- package/lib-commonjs/components/Link/Link.d.ts +0 -6
- package/lib-commonjs/components/Link/Link.types.d.ts +0 -33
- package/lib-commonjs/components/Link/index.d.ts +0 -6
- package/lib-commonjs/components/Link/renderLink.d.ts +0 -5
- package/lib-commonjs/components/Link/useLink.d.ts +0 -8
- package/lib-commonjs/components/Link/useLinkState.d.ts +0 -6
- package/lib-commonjs/components/Link/useLinkStyles.d.ts +0 -8
- package/lib-commonjs/index.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Link/useLinkState.ts"],"names":[],"mappings":"AACA,SAAS,KAAT,EAAgB,KAAhB,QAA6B,yBAA7B;AAGA;;;AAGG;;AACH,OAAO,MAAM,qBAAqB,GAAI,KAAD,IAAgC;
|
|
1
|
+
{"version":3,"sources":["components/Link/useLinkState.ts"],"names":[],"mappings":"AACA,SAAS,KAAT,EAAgB,KAAhB,QAA6B,yBAA7B;AAGA;;;AAGG;;AACH,OAAO,MAAM,qBAAqB,GAAI,KAAD,IAAgC;EACnE,MAAM;IAAE,QAAF;IAAY;EAAZ,IAAkC,KAAxC;EACA,MAAM;IAAE,OAAF;IAAW,SAAX;IAAsB,IAAtB;IAA4B;EAA5B,IAAqC,KAAK,CAAC,IAAjD,CAFmE,CAInE;;EACA,IAAI,KAAK,CAAC,IAAN,CAAW,EAAX,KAAkB,GAAtB,EAA2B;IACzB,KAAK,CAAC,IAAN,CAAW,IAAX,GAAkB,QAAQ,GAAG,SAAH,GAAe,KAAK,CAAC,IAAN,CAAW,IAApD;IACA,KAAK,CAAC,IAAN,CAAW,QAAX,GAAsB,QAAQ,IAAI,CAAC,iBAAb,GAAiC,SAAjC,GAA6C,CAAnE,CAFyB,CAIzB;;IACA,IAAI,QAAQ,IAAI,iBAAhB,EAAmC;MACjC,KAAK,CAAC,IAAN,CAAW,IAAX,GAAkB,IAAI,IAAI,MAA1B;IACD;EACF,CARD,CASA;EATA,KAUK;IACH,KAAK,CAAC,IAAN,CAAW,IAAX,GAAkB,IAAI,IAAI,QAA1B;EACD,CAjBkE,CAmBnE;;;EACA,KAAK,CAAC,IAAN,CAAW,OAAX,GAAsB,EAAD,IAAgE;IACnF,IAAI,QAAQ,IAAI,iBAAhB,EAAmC;MACjC,EAAE,CAAC,cAAH;IACD,CAFD,MAEO;MACL,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAG,EAAH,CAAP;IACD;EACF,CAND,CApBmE,CA4BnE;;;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAwB,EAAD,IAAmE;IACxF,IAAI,CAAC,QAAQ,IAAI,iBAAb,MAAoC,EAAE,CAAC,GAAH,KAAW,KAAX,IAAoB,EAAE,CAAC,GAAH,KAAW,KAAnE,CAAJ,EAA+E;MAC7E,EAAE,CAAC,cAAH;MACA,EAAE,CAAC,eAAH;IACD,CAHD,MAGO;MACL,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,EAAH,CAAT;IACD;EACF,CAPD,CA7BmE,CAsCnE;;;EACA,KAAK,CAAC,QAAN,GAAiB,QAAQ,IAAI,iBAA7B;EACA,KAAK,CAAC,IAAN,CAAW,eAAX,IAA8B,QAAQ,IAAI,iBAAZ,IAAiC,SAA/D;;EACA,IAAI,KAAK,CAAC,IAAN,CAAW,EAAX,KAAkB,QAAtB,EAAgC;IAC9B,KAAK,CAAC,IAAN,CAAW,QAAX,GAAsB,QAAQ,IAAI,CAAC,iBAAnC;EACD;;EAED,OAAO,KAAP;AACD,CA9CM","sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport type { LinkState } from './Link.types';\n\n/**\n * The useLinkState_unstable hook processes the Link state.\n * @param state - Link state to mutate.\n */\nexport const useLinkState_unstable = (state: LinkState): LinkState => {\n const { disabled, disabledFocusable } = state;\n const { onClick, onKeyDown, role, type } = state.root;\n\n // Add href and tabIndex=0 for anchor elements.\n if (state.root.as === 'a') {\n state.root.href = disabled ? undefined : state.root.href;\n state.root.tabIndex = disabled && !disabledFocusable ? undefined : 0;\n\n // Add role=\"link\" for disabled and disabledFocusable links.\n if (disabled || disabledFocusable) {\n state.root.role = role || 'link';\n }\n }\n // Add type=\"button\" for button elements.\n else {\n state.root.type = type || 'button';\n }\n\n // Disallow click event when component is disabled and eat events when disabledFocusable is set to true.\n state.root.onClick = (ev: React.MouseEvent<HTMLAnchorElement & HTMLButtonElement>) => {\n if (disabled || disabledFocusable) {\n ev.preventDefault();\n } else {\n onClick?.(ev);\n }\n };\n\n // Disallow keydown event when component is disabled and eat events when disabledFocusable is set to true.\n state.root.onKeyDown = (ev: React.KeyboardEvent<HTMLAnchorElement & HTMLButtonElement>) => {\n if ((disabled || disabledFocusable) && (ev.key === Enter || ev.key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onKeyDown?.(ev);\n }\n };\n\n // Set the aria-disabled and disabled props correctly.\n state.disabled = disabled || disabledFocusable;\n state.root['aria-disabled'] = disabled || disabledFocusable || undefined;\n if (state.root.as === 'button') {\n state.root.disabled = disabled && !disabledFocusable;\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { shorthands, __styles, mergeClasses } from '@griffel/react';
|
|
2
2
|
import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
|
|
3
3
|
import { tokens } from '@fluentui/react-theme';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Use `linkClassNames.root` instead.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export const linkClassName = 'fui-Link';
|
|
9
4
|
export const linkClassNames = {
|
|
10
5
|
root: 'fui-Link'
|
|
11
6
|
};
|
|
12
7
|
|
|
13
8
|
const useStyles = /*#__PURE__*/__styles({
|
|
14
9
|
"focusIndicator": {
|
|
15
|
-
"
|
|
10
|
+
"Brovlpu": "ftqa4ok",
|
|
16
11
|
"hhrs2v": "f50u1b5",
|
|
17
12
|
"F2u7y": "fs3pq8b",
|
|
18
13
|
"Bfv9iwi": "f1hghxdh",
|
|
@@ -78,7 +73,7 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
78
73
|
"lj723h": "f19wldhg"
|
|
79
74
|
}
|
|
80
75
|
}, {
|
|
81
|
-
"
|
|
76
|
+
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
|
82
77
|
"d": ["[data-keyboard-nav] .f50u1b5:focus{border-bottom-color:transparent;}", "[data-keyboard-nav] .fs3pq8b:focus{text-decoration-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .f1hghxdh:focus{text-decoration-line:underline;}", "[data-keyboard-nav] .f1tymzes:focus{text-decoration-style:double;}", ".f3rmtva{background-color:transparent;}", ".f1ern45e{border-top-style:none;}", ".f1deefiw{border-left-style:none;}", ".f1n71otn{border-right-style:none;}", ".f1q5o8ev{border-bottom-color:transparent;}", ".fg706s2{border-bottom-style:solid;}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".f1ewtqcl{box-sizing:border-box;}", ".fyind8e{color:var(--colorBrandForegroundLink);}", ".f1k6fduh{cursor:pointer;}", ".f1w7gpdv{display:inline;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1hu3pq6{margin-top:0;}", ".f11qmguv{margin-right:0;}", ".f1tyq0we{margin-left:0;}", ".f19f4twv{margin-bottom:0;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".fqv5qza{overflow-x:inherit;}", ".f1vmzxwi{overflow-y:inherit;}", ".f1o700av{text-align:left;}", ".fes3tcz{text-align:right;}", ".f1iuv45f{text-decoration-line:none;}", ".f9n3di6{text-overflow:inherit;}", ".f1ids18y{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;}", ".fjoy568{font-size:inherit;}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".f8eylhe{border-bottom-color:var(--colorBrandForegroundLink);}", ".fskmnqw{border-bottom-color:var(--colorNeutralForeground2);}", ".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".fdrzuqr{cursor:not-allowed;}"],
|
|
83
78
|
"h": [".fygtlnl:hover{border-bottom-color:var(--colorBrandForegroundLinkHover);}", ".f1deo86v:hover{color:var(--colorBrandForegroundLinkHover);}", ".fnlxxs1:hover{border-bottom-color:var(--colorNeutralForeground2Hover);}", ".fnwyq0v:hover{color:var(--colorNeutralForeground2Hover);}", ".f1ukrpxl:hover{border-bottom-color:transparent;}", ".fvgxktp:hover{color:var(--colorNeutralForegroundDisabled);}"],
|
|
84
79
|
"a": [".f12x56k7:active{border-bottom-color:var(--colorBrandForegroundLinkPressed);}", ".f1iescvh:active{color:var(--colorBrandForegroundLinkPressed);}", ".ffmwprl:active{border-bottom-color:var(--colorNeutralForeground2Pressed);}", ".flvvhsy:active{color:var(--colorNeutralForeground2Pressed);}", ".fggejwh:active{border-bottom-color:transparent;}", ".f19wldhg:active{color:var(--colorNeutralForegroundDisabled);}"]
|
|
@@ -86,7 +81,13 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
86
81
|
|
|
87
82
|
export const useLinkStyles_unstable = state => {
|
|
88
83
|
const styles = useStyles();
|
|
89
|
-
|
|
84
|
+
const {
|
|
85
|
+
appearance,
|
|
86
|
+
disabled,
|
|
87
|
+
inline,
|
|
88
|
+
root
|
|
89
|
+
} = state;
|
|
90
|
+
state.root.className = mergeClasses(linkClassNames.root, styles.root, styles.focusIndicator, root.as === 'a' && root.href && styles.href, appearance === 'subtle' && styles.subtle, inline && styles.inline, appearance === 'subtle' && inline && styles.inlineSubtle, disabled && styles.disabled, state.root.className);
|
|
90
91
|
return state;
|
|
91
92
|
};
|
|
92
93
|
//# sourceMappingURL=useLinkStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Link/useLinkStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,YAAiC,YAAjC,QAAqD,gBAArD;AACA,SAAS,+BAAT,QAAgD,yBAAhD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA
|
|
1
|
+
{"version":3,"sources":["components/Link/useLinkStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,YAAiC,YAAjC,QAAqD,gBAArD;AACA,SAAS,+BAAT,QAAgD,yBAAhD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA,OAAO,MAAM,cAAc,GAA8B;EACvD,IAAI,EAAE;AADiD,CAAlD;;AAIP,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;EAAA;EAAA;EAAA;AAAA,EAAlB;;AAqFA,OAAO,MAAM,sBAAsB,GAAI,KAAD,IAAgC;EACpE,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,MAAM;IAAE,UAAF;IAAc,QAAd;IAAwB,MAAxB;IAAgC;EAAhC,IAAyC,KAA/C;EAEA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,cAAc,CAAC,IADkB,EAEjC,MAAM,CAAC,IAF0B,EAGjC,MAAM,CAAC,cAH0B,EAIjC,IAAI,CAAC,EAAL,KAAY,GAAZ,IAAmB,IAAI,CAAC,IAAxB,IAAgC,MAAM,CAAC,IAJN,EAKjC,UAAU,KAAK,QAAf,IAA2B,MAAM,CAAC,MALD,EAMjC,MAAM,IAAI,MAAM,CAAC,MANgB,EAOjC,UAAU,KAAK,QAAf,IAA2B,MAA3B,IAAqC,MAAM,CAAC,YAPX,EAQjC,QAAQ,IAAI,MAAM,CAAC,QARc,EASjC,KAAK,CAAC,IAAN,CAAW,SATsB,CAAnC;EAYA,OAAO,KAAP;AACD,CAjBM","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport type { LinkSlots, LinkState } from './Link.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const linkClassNames: SlotClassNames<LinkSlots> = {\n root: 'fui-Link',\n};\n\nconst useStyles = makeStyles({\n focusIndicator: createCustomFocusIndicatorStyle({\n borderBottomColor: 'transparent',\n textDecorationColor: tokens.colorStrokeFocus2,\n textDecorationLine: 'underline',\n textDecorationStyle: 'double',\n }),\n // Common styles.\n root: {\n backgroundColor: 'transparent',\n borderTopStyle: 'none',\n borderLeftStyle: 'none',\n borderRightStyle: 'none',\n borderBottomColor: 'transparent',\n borderBottomStyle: 'solid',\n borderBottomWidth: tokens.strokeWidthThin,\n boxSizing: 'border-box',\n color: tokens.colorBrandForegroundLink,\n cursor: 'pointer',\n display: 'inline',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightRegular,\n ...shorthands.margin(0),\n ...shorthands.padding(0),\n ...shorthands.overflow('inherit'),\n textAlign: 'left',\n textDecorationLine: 'none',\n textOverflow: 'inherit',\n userSelect: 'text',\n\n ':hover': {\n borderBottomColor: tokens.colorBrandForegroundLinkHover,\n color: tokens.colorBrandForegroundLinkHover,\n },\n\n ':active': {\n borderBottomColor: tokens.colorBrandForegroundLinkPressed,\n color: tokens.colorBrandForegroundLinkPressed,\n },\n },\n // Overrides when an href is present so the Link renders as an anchor.\n href: {\n fontSize: 'inherit',\n },\n // Overrides when the Link appears subtle.\n subtle: {\n color: tokens.colorNeutralForeground2,\n\n ':hover': {\n borderBottomColor: tokens.colorNeutralForeground2Hover,\n color: tokens.colorNeutralForeground2Hover,\n },\n\n ':active': {\n borderBottomColor: tokens.colorNeutralForeground2Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n // Overrides when the Link is rendered inline within text.\n inline: {\n borderBottomColor: tokens.colorBrandForegroundLink,\n },\n // Overrides when the Link is rendered inline within text and appears subtle.\n inlineSubtle: {\n borderBottomColor: tokens.colorNeutralForeground2,\n },\n // Overrides when the Link is disabled.\n disabled: {\n borderBottomColor: 'transparent',\n color: tokens.colorNeutralForegroundDisabled,\n cursor: 'not-allowed',\n\n ':hover': {\n borderBottomColor: 'transparent',\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n ':active': {\n borderBottomColor: 'transparent',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nexport const useLinkStyles_unstable = (state: LinkState): LinkState => {\n const styles = useStyles();\n const { appearance, disabled, inline, root } = state;\n\n state.root.className = mergeClasses(\n linkClassNames.root,\n styles.root,\n styles.focusIndicator,\n root.as === 'a' && root.href && styles.href,\n appearance === 'subtle' && styles.subtle,\n inline && styles.inline,\n appearance === 'subtle' && inline && styles.inlineSubtle,\n disabled && styles.disabled,\n state.root.className,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export { Link,
|
|
2
|
-
linkClassName, linkClassNames, renderLink_unstable, useLinkState_unstable, useLinkStyles_unstable, useLink_unstable } from './Link';
|
|
1
|
+
export { Link, linkClassNames, renderLink_unstable, useLinkState_unstable, useLinkStyles_unstable, useLink_unstable } from './Link';
|
|
3
2
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,IADF,EAEE
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,IADF,EAEE,cAFF,EAGE,mBAHF,EAIE,qBAJF,EAKE,sBALF,EAME,gBANF,QAOO,QAPP","sourcesContent":["export {\n Link,\n linkClassNames,\n renderLink_unstable,\n useLinkState_unstable,\n useLinkStyles_unstable,\n useLink_unstable,\n} from './Link';\nexport type { LinkProps, LinkSlots, LinkState } from './Link';\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Link/Link.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,SAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,IAAA,gBAAuC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;
|
|
1
|
+
{"version":3,"sources":["components/Link/Link.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,SAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,IAAA,gBAAuC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAClF,MAAM,KAAK,GAAG,SAAA,CAAA,gBAAA,CAAiB,KAAjB,EAAwB,GAAxB,CAAd;EAEA,eAAA,CAAA,sBAAA,CAAuB,KAAvB;EAEA,OAAO,YAAA,CAAA,mBAAA,CAAoB,KAApB,CAAP,CALkF,CAMlF;AACD,CAPmD,CAAvC;AASb,OAAA,CAAA,IAAA,CAAK,WAAL,GAAmB,MAAnB","sourcesContent":["import * as React from 'react';\nimport { useLink_unstable } from './useLink';\nimport { useLinkStyles_unstable } from './useLinkStyles';\nimport { renderLink_unstable } from './renderLink';\nimport type { LinkProps } from './Link.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * A Link is a reference to data that a user can follow by clicking or tapping it.\n */\nexport const Link: ForwardRefComponent<LinkProps> = React.forwardRef((props, ref) => {\n const state = useLink_unstable(props, ref);\n\n useLinkStyles_unstable(state);\n\n return renderLink_unstable(state);\n // Work around some small mismatches in inferred types which don't matter in practice\n}) as ForwardRefComponent<LinkProps>;\n\nLink.displayName = 'Link';\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Link/renderLink.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,mBAAmB,GAAI,KAAD,IAAqB;
|
|
1
|
+
{"version":3,"sources":["components/Link/renderLink.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,mBAAmB,GAAI,KAAD,IAAqB;EACtD,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAAoB,KAApB,CAA7B;EAEA,OAAO,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { LinkSlots, LinkState } from './Link.types';\n\n/**\n * Renders a Link component by passing the state defined props to the appropriate slots.\n */\nexport const renderLink_unstable = (state: LinkState) => {\n const { slots, slotProps } = getSlots<LinkSlots>(state);\n\n return <slots.root {...slotProps.root} />;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -17,10 +17,10 @@ const useLinkState_1 = /*#__PURE__*/require("./useLinkState");
|
|
|
17
17
|
|
|
18
18
|
const useLink_unstable = (props, ref) => {
|
|
19
19
|
const {
|
|
20
|
-
appearance,
|
|
21
|
-
disabled,
|
|
22
|
-
disabledFocusable,
|
|
23
|
-
inline
|
|
20
|
+
appearance = 'default',
|
|
21
|
+
disabled = false,
|
|
22
|
+
disabledFocusable = false,
|
|
23
|
+
inline = false
|
|
24
24
|
} = props;
|
|
25
25
|
const as = props.as || (props.href ? 'a' : 'button');
|
|
26
26
|
const state = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Link/useLink.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;AAGA;;;;AAIG;;;AACI,MAAM,gBAAgB,GAAG,CAC9B,KAD8B,EAE9B,GAF8B,KAGjB;
|
|
1
|
+
{"version":3,"sources":["components/Link/useLink.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;AAGA;;;;AAIG;;;AACI,MAAM,gBAAgB,GAAG,CAC9B,KAD8B,EAE9B,GAF8B,KAGjB;EACb,MAAM;IAAE,UAAU,GAAG,SAAf;IAA0B,QAAQ,GAAG,KAArC;IAA4C,iBAAiB,GAAG,KAAhE;IAAuE,MAAM,GAAG;EAAhF,IAA0F,KAAhG;EACA,MAAM,EAAE,GAAG,KAAK,CAAC,EAAN,KAAa,KAAK,CAAC,IAAN,GAAa,GAAb,GAAmB,QAAhC,CAAX;EAEA,MAAM,KAAK,GAAc;IACvB;IACA,UAFuB;IAGvB,QAHuB;IAIvB,iBAJuB;IAKvB,MALuB;IAOvB;IACA,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CARW;IAYvB,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,EAAtB,EAA0B;MAC9B,GAD8B;MAE9B,GAAG,KAF2B;MAG9B;IAH8B,CAA1B;EAZiB,CAAzB;EAmBA,cAAA,CAAA,qBAAA,CAAsB,KAAtB;EAEA,OAAO,KAAP;AACD,CA7BM;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport { useLinkState_unstable } from './useLinkState';\nimport type { LinkProps, LinkState } from './Link.types';\n\n/**\n * Given user props, defines default props for the Link, calls useLinkState_unstable, and returns processed state.\n * @param props - User provided props to the Link component.\n * @param ref - User provided ref to be passed to the Link component.\n */\nexport const useLink_unstable = (\n props: LinkProps,\n ref: React.Ref<HTMLAnchorElement | HTMLButtonElement>,\n): LinkState => {\n const { appearance = 'default', disabled = false, disabledFocusable = false, inline = false } = props;\n const as = props.as || (props.href ? 'a' : 'button');\n\n const state: LinkState = {\n // Props passed at the top-level\n appearance,\n disabled,\n disabledFocusable,\n inline,\n\n // Slots definition\n components: {\n root: 'a',\n },\n\n root: getNativeElementProps(as, {\n ref,\n ...props,\n as,\n }),\n };\n\n useLinkState_unstable(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -56,7 +56,8 @@ const useLinkState_unstable = state => {
|
|
|
56
56
|
}; // Set the aria-disabled and disabled props correctly.
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
state.
|
|
59
|
+
state.disabled = disabled || disabledFocusable;
|
|
60
|
+
state.root['aria-disabled'] = disabled || disabledFocusable || undefined;
|
|
60
61
|
|
|
61
62
|
if (state.root.as === 'button') {
|
|
62
63
|
state.root.disabled = disabled && !disabledFocusable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Link/useLinkState.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAGA;;;AAGG;;;AACI,MAAM,qBAAqB,GAAI,KAAD,IAAgC;
|
|
1
|
+
{"version":3,"sources":["components/Link/useLinkState.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAGA;;;AAGG;;;AACI,MAAM,qBAAqB,GAAI,KAAD,IAAgC;EACnE,MAAM;IAAE,QAAF;IAAY;EAAZ,IAAkC,KAAxC;EACA,MAAM;IAAE,OAAF;IAAW,SAAX;IAAsB,IAAtB;IAA4B;EAA5B,IAAqC,KAAK,CAAC,IAAjD,CAFmE,CAInE;;EACA,IAAI,KAAK,CAAC,IAAN,CAAW,EAAX,KAAkB,GAAtB,EAA2B;IACzB,KAAK,CAAC,IAAN,CAAW,IAAX,GAAkB,QAAQ,GAAG,SAAH,GAAe,KAAK,CAAC,IAAN,CAAW,IAApD;IACA,KAAK,CAAC,IAAN,CAAW,QAAX,GAAsB,QAAQ,IAAI,CAAC,iBAAb,GAAiC,SAAjC,GAA6C,CAAnE,CAFyB,CAIzB;;IACA,IAAI,QAAQ,IAAI,iBAAhB,EAAmC;MACjC,KAAK,CAAC,IAAN,CAAW,IAAX,GAAkB,IAAI,IAAI,MAA1B;IACD;EACF,CARD,CASA;EATA,KAUK;IACH,KAAK,CAAC,IAAN,CAAW,IAAX,GAAkB,IAAI,IAAI,QAA1B;EACD,CAjBkE,CAmBnE;;;EACA,KAAK,CAAC,IAAN,CAAW,OAAX,GAAsB,EAAD,IAAgE;IACnF,IAAI,QAAQ,IAAI,iBAAhB,EAAmC;MACjC,EAAE,CAAC,cAAH;IACD,CAFD,MAEO;MACL,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAG,EAAH,CAAP;IACD;EACF,CAND,CApBmE,CA4BnE;;;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAwB,EAAD,IAAmE;IACxF,IAAI,CAAC,QAAQ,IAAI,iBAAb,MAAoC,EAAE,CAAC,GAAH,KAAW,eAAA,CAAA,KAAX,IAAoB,EAAE,CAAC,GAAH,KAAW,eAAA,CAAA,KAAnE,CAAJ,EAA+E;MAC7E,EAAE,CAAC,cAAH;MACA,EAAE,CAAC,eAAH;IACD,CAHD,MAGO;MACL,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,EAAH,CAAT;IACD;EACF,CAPD,CA7BmE,CAsCnE;;;EACA,KAAK,CAAC,QAAN,GAAiB,QAAQ,IAAI,iBAA7B;EACA,KAAK,CAAC,IAAN,CAAW,eAAX,IAA8B,QAAQ,IAAI,iBAAZ,IAAiC,SAA/D;;EACA,IAAI,KAAK,CAAC,IAAN,CAAW,EAAX,KAAkB,QAAtB,EAAgC;IAC9B,KAAK,CAAC,IAAN,CAAW,QAAX,GAAsB,QAAQ,IAAI,CAAC,iBAAnC;EACD;;EAED,OAAO,KAAP;AACD,CA9CM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport type { LinkState } from './Link.types';\n\n/**\n * The useLinkState_unstable hook processes the Link state.\n * @param state - Link state to mutate.\n */\nexport const useLinkState_unstable = (state: LinkState): LinkState => {\n const { disabled, disabledFocusable } = state;\n const { onClick, onKeyDown, role, type } = state.root;\n\n // Add href and tabIndex=0 for anchor elements.\n if (state.root.as === 'a') {\n state.root.href = disabled ? undefined : state.root.href;\n state.root.tabIndex = disabled && !disabledFocusable ? undefined : 0;\n\n // Add role=\"link\" for disabled and disabledFocusable links.\n if (disabled || disabledFocusable) {\n state.root.role = role || 'link';\n }\n }\n // Add type=\"button\" for button elements.\n else {\n state.root.type = type || 'button';\n }\n\n // Disallow click event when component is disabled and eat events when disabledFocusable is set to true.\n state.root.onClick = (ev: React.MouseEvent<HTMLAnchorElement & HTMLButtonElement>) => {\n if (disabled || disabledFocusable) {\n ev.preventDefault();\n } else {\n onClick?.(ev);\n }\n };\n\n // Disallow keydown event when component is disabled and eat events when disabledFocusable is set to true.\n state.root.onKeyDown = (ev: React.KeyboardEvent<HTMLAnchorElement & HTMLButtonElement>) => {\n if ((disabled || disabledFocusable) && (ev.key === Enter || ev.key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onKeyDown?.(ev);\n }\n };\n\n // Set the aria-disabled and disabled props correctly.\n state.disabled = disabled || disabledFocusable;\n state.root['aria-disabled'] = disabled || disabledFocusable || undefined;\n if (state.root.as === 'button') {\n state.root.disabled = disabled && !disabledFocusable;\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -3,26 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useLinkStyles_unstable = exports.linkClassNames =
|
|
6
|
+
exports.useLinkStyles_unstable = exports.linkClassNames = void 0;
|
|
7
7
|
|
|
8
8
|
const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
9
9
|
|
|
10
10
|
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
11
11
|
|
|
12
12
|
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Use `linkClassNames.root` instead.
|
|
15
|
-
*/
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
exports.linkClassName = 'fui-Link';
|
|
19
14
|
exports.linkClassNames = {
|
|
20
15
|
root: 'fui-Link'
|
|
21
16
|
};
|
|
22
17
|
|
|
23
18
|
const useStyles = /*#__PURE__*/react_1.__styles({
|
|
24
19
|
"focusIndicator": {
|
|
25
|
-
"
|
|
20
|
+
"Brovlpu": "ftqa4ok",
|
|
26
21
|
"hhrs2v": "f50u1b5",
|
|
27
22
|
"F2u7y": "fs3pq8b",
|
|
28
23
|
"Bfv9iwi": "f1hghxdh",
|
|
@@ -88,7 +83,7 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
88
83
|
"lj723h": "f19wldhg"
|
|
89
84
|
}
|
|
90
85
|
}, {
|
|
91
|
-
"
|
|
86
|
+
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
|
92
87
|
"d": ["[data-keyboard-nav] .f50u1b5:focus{border-bottom-color:transparent;}", "[data-keyboard-nav] .fs3pq8b:focus{text-decoration-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .f1hghxdh:focus{text-decoration-line:underline;}", "[data-keyboard-nav] .f1tymzes:focus{text-decoration-style:double;}", ".f3rmtva{background-color:transparent;}", ".f1ern45e{border-top-style:none;}", ".f1deefiw{border-left-style:none;}", ".f1n71otn{border-right-style:none;}", ".f1q5o8ev{border-bottom-color:transparent;}", ".fg706s2{border-bottom-style:solid;}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".f1ewtqcl{box-sizing:border-box;}", ".fyind8e{color:var(--colorBrandForegroundLink);}", ".f1k6fduh{cursor:pointer;}", ".f1w7gpdv{display:inline;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1hu3pq6{margin-top:0;}", ".f11qmguv{margin-right:0;}", ".f1tyq0we{margin-left:0;}", ".f19f4twv{margin-bottom:0;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".fqv5qza{overflow-x:inherit;}", ".f1vmzxwi{overflow-y:inherit;}", ".f1o700av{text-align:left;}", ".fes3tcz{text-align:right;}", ".f1iuv45f{text-decoration-line:none;}", ".f9n3di6{text-overflow:inherit;}", ".f1ids18y{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;}", ".fjoy568{font-size:inherit;}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".f8eylhe{border-bottom-color:var(--colorBrandForegroundLink);}", ".fskmnqw{border-bottom-color:var(--colorNeutralForeground2);}", ".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".fdrzuqr{cursor:not-allowed;}"],
|
|
93
88
|
"h": [".fygtlnl:hover{border-bottom-color:var(--colorBrandForegroundLinkHover);}", ".f1deo86v:hover{color:var(--colorBrandForegroundLinkHover);}", ".fnlxxs1:hover{border-bottom-color:var(--colorNeutralForeground2Hover);}", ".fnwyq0v:hover{color:var(--colorNeutralForeground2Hover);}", ".f1ukrpxl:hover{border-bottom-color:transparent;}", ".fvgxktp:hover{color:var(--colorNeutralForegroundDisabled);}"],
|
|
94
89
|
"a": [".f12x56k7:active{border-bottom-color:var(--colorBrandForegroundLinkPressed);}", ".f1iescvh:active{color:var(--colorBrandForegroundLinkPressed);}", ".ffmwprl:active{border-bottom-color:var(--colorNeutralForeground2Pressed);}", ".flvvhsy:active{color:var(--colorNeutralForeground2Pressed);}", ".fggejwh:active{border-bottom-color:transparent;}", ".f19wldhg:active{color:var(--colorNeutralForegroundDisabled);}"]
|
|
@@ -96,7 +91,13 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
96
91
|
|
|
97
92
|
const useLinkStyles_unstable = state => {
|
|
98
93
|
const styles = useStyles();
|
|
99
|
-
|
|
94
|
+
const {
|
|
95
|
+
appearance,
|
|
96
|
+
disabled,
|
|
97
|
+
inline,
|
|
98
|
+
root
|
|
99
|
+
} = state;
|
|
100
|
+
state.root.className = react_1.mergeClasses(exports.linkClassNames.root, styles.root, styles.focusIndicator, root.as === 'a' && root.href && styles.href, appearance === 'subtle' && styles.subtle, inline && styles.inline, appearance === 'subtle' && inline && styles.inlineSubtle, disabled && styles.disabled, state.root.className);
|
|
100
101
|
return state;
|
|
101
102
|
};
|
|
102
103
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Link/useLinkStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA
|
|
1
|
+
{"version":3,"sources":["components/Link/useLinkStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAIa,OAAA,CAAA,cAAA,GAA4C;EACvD,IAAI,EAAE;AADiD,CAA5C;;AAIb,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;EAAA;EAAA;EAAA;AAAA,EAAlB;;AAqFO,MAAM,sBAAsB,GAAI,KAAD,IAAgC;EACpE,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,MAAM;IAAE,UAAF;IAAc,QAAd;IAAwB,MAAxB;IAAgC;EAAhC,IAAyC,KAA/C;EAEA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CACrB,OAAA,CAAA,cAAA,CAAe,IADM,EAErB,MAAM,CAAC,IAFc,EAGrB,MAAM,CAAC,cAHc,EAIrB,IAAI,CAAC,EAAL,KAAY,GAAZ,IAAmB,IAAI,CAAC,IAAxB,IAAgC,MAAM,CAAC,IAJlB,EAKrB,UAAU,KAAK,QAAf,IAA2B,MAAM,CAAC,MALb,EAMrB,MAAM,IAAI,MAAM,CAAC,MANI,EAOrB,UAAU,KAAK,QAAf,IAA2B,MAA3B,IAAqC,MAAM,CAAC,YAPvB,EAQrB,QAAQ,IAAI,MAAM,CAAC,QARE,EASrB,KAAK,CAAC,IAAN,CAAW,SATU,CAAvB;EAYA,OAAO,KAAP;AACD,CAjBM;;AAAM,OAAA,CAAA,sBAAA,GAAsB,sBAAtB","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport type { LinkSlots, LinkState } from './Link.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const linkClassNames: SlotClassNames<LinkSlots> = {\n root: 'fui-Link',\n};\n\nconst useStyles = makeStyles({\n focusIndicator: createCustomFocusIndicatorStyle({\n borderBottomColor: 'transparent',\n textDecorationColor: tokens.colorStrokeFocus2,\n textDecorationLine: 'underline',\n textDecorationStyle: 'double',\n }),\n // Common styles.\n root: {\n backgroundColor: 'transparent',\n borderTopStyle: 'none',\n borderLeftStyle: 'none',\n borderRightStyle: 'none',\n borderBottomColor: 'transparent',\n borderBottomStyle: 'solid',\n borderBottomWidth: tokens.strokeWidthThin,\n boxSizing: 'border-box',\n color: tokens.colorBrandForegroundLink,\n cursor: 'pointer',\n display: 'inline',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightRegular,\n ...shorthands.margin(0),\n ...shorthands.padding(0),\n ...shorthands.overflow('inherit'),\n textAlign: 'left',\n textDecorationLine: 'none',\n textOverflow: 'inherit',\n userSelect: 'text',\n\n ':hover': {\n borderBottomColor: tokens.colorBrandForegroundLinkHover,\n color: tokens.colorBrandForegroundLinkHover,\n },\n\n ':active': {\n borderBottomColor: tokens.colorBrandForegroundLinkPressed,\n color: tokens.colorBrandForegroundLinkPressed,\n },\n },\n // Overrides when an href is present so the Link renders as an anchor.\n href: {\n fontSize: 'inherit',\n },\n // Overrides when the Link appears subtle.\n subtle: {\n color: tokens.colorNeutralForeground2,\n\n ':hover': {\n borderBottomColor: tokens.colorNeutralForeground2Hover,\n color: tokens.colorNeutralForeground2Hover,\n },\n\n ':active': {\n borderBottomColor: tokens.colorNeutralForeground2Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n // Overrides when the Link is rendered inline within text.\n inline: {\n borderBottomColor: tokens.colorBrandForegroundLink,\n },\n // Overrides when the Link is rendered inline within text and appears subtle.\n inlineSubtle: {\n borderBottomColor: tokens.colorNeutralForeground2,\n },\n // Overrides when the Link is disabled.\n disabled: {\n borderBottomColor: 'transparent',\n color: tokens.colorNeutralForegroundDisabled,\n cursor: 'not-allowed',\n\n ':hover': {\n borderBottomColor: 'transparent',\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n ':active': {\n borderBottomColor: 'transparent',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nexport const useLinkStyles_unstable = (state: LinkState): LinkState => {\n const styles = useStyles();\n const { appearance, disabled, inline, root } = state;\n\n state.root.className = mergeClasses(\n linkClassNames.root,\n styles.root,\n styles.focusIndicator,\n root.as === 'a' && root.href && styles.href,\n appearance === 'subtle' && styles.subtle,\n inline && styles.inline,\n appearance === 'subtle' && inline && styles.inlineSubtle,\n disabled && styles.disabled,\n state.root.className,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useLink_unstable = exports.useLinkStyles_unstable = exports.useLinkState_unstable = exports.renderLink_unstable = exports.linkClassNames = exports.
|
|
6
|
+
exports.useLink_unstable = exports.useLinkStyles_unstable = exports.useLinkState_unstable = exports.renderLink_unstable = exports.linkClassNames = exports.Link = void 0;
|
|
7
7
|
|
|
8
8
|
var Link_1 = /*#__PURE__*/require("./Link");
|
|
9
9
|
|
|
@@ -12,13 +12,6 @@ Object.defineProperty(exports, "Link", {
|
|
|
12
12
|
get: function () {
|
|
13
13
|
return Link_1.Link;
|
|
14
14
|
}
|
|
15
|
-
}); // eslint-disable-next-line deprecation/deprecation
|
|
16
|
-
|
|
17
|
-
Object.defineProperty(exports, "linkClassName", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () {
|
|
20
|
-
return Link_1.linkClassName;
|
|
21
|
-
}
|
|
22
15
|
});
|
|
23
16
|
Object.defineProperty(exports, "linkClassNames", {
|
|
24
17
|
enumerable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,MAAA,gBAAA,OAAA,CAAA,QAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,MAAA,EAAA;
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,MAAA,gBAAA,OAAA,CAAA,QAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,MAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,MAAA,CAAA,IAAA;EAAI;AAAJ,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,gBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,MAAA,CAAA,cAAA;EAAc;AAAd,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,qBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,MAAA,CAAA,mBAAA;EAAmB;AAAnB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,uBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,MAAA,CAAA,qBAAA;EAAqB;AAArB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,wBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,MAAA,CAAA,sBAAA;EAAsB;AAAtB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,MAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA","sourcesContent":["export {\n Link,\n linkClassNames,\n renderLink_unstable,\n useLinkState_unstable,\n useLinkStyles_unstable,\n useLink_unstable,\n} from './Link';\nexport type { LinkProps, LinkSlots, LinkState } from './Link';\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-link",
|
|
3
|
-
"version": "9.0.0
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Fluent UI React Link component",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
7
|
-
"typings": "
|
|
7
|
+
"typings": "dist/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"@fluentui/a11y-testing": "^0.1.0",
|
|
30
30
|
"@fluentui/eslint-plugin": "*",
|
|
31
31
|
"@fluentui/react-conformance": "*",
|
|
32
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
|
32
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.9",
|
|
33
33
|
"@fluentui/scripts": "^1.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@fluentui/keyboard-keys": "9.0.0
|
|
37
|
-
"@fluentui/react-tabster": "9.0.0
|
|
38
|
-
"@fluentui/react-theme": "9.0.0
|
|
39
|
-
"@fluentui/react-utilities": "9.0.0
|
|
40
|
-
"@griffel/react": "1.0
|
|
36
|
+
"@fluentui/keyboard-keys": "^9.0.0",
|
|
37
|
+
"@fluentui/react-tabster": "^9.0.0",
|
|
38
|
+
"@fluentui/react-theme": "^9.0.0",
|
|
39
|
+
"@fluentui/react-utilities": "^9.0.0",
|
|
40
|
+
"@griffel/react": "1.2.0",
|
|
41
41
|
"tslib": "^2.1.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -48,9 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"beachball": {
|
|
50
50
|
"disallowedChangeTypes": [
|
|
51
|
-
"major"
|
|
52
|
-
"minor",
|
|
53
|
-
"patch"
|
|
51
|
+
"major"
|
|
54
52
|
]
|
|
55
53
|
},
|
|
56
54
|
"exports": {
|
package/lib/Link.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components/Link/index';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { LinkProps } from './Link.types';
|
|
2
|
-
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
3
|
-
/**
|
|
4
|
-
* A Link is a reference to data that a user can follow by clicking or tapping it.
|
|
5
|
-
*/
|
|
6
|
-
export declare const Link: ForwardRefComponent<LinkProps>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
|
2
|
-
export declare type LinkSlots = {
|
|
3
|
-
/**
|
|
4
|
-
* Root of the component that renders as either an <a> or a <button> tag.
|
|
5
|
-
*/
|
|
6
|
-
root: Slot<'a', 'button'>;
|
|
7
|
-
};
|
|
8
|
-
declare type LinkCommons = {
|
|
9
|
-
/**
|
|
10
|
-
* A link can appear either with its default style or subtle.
|
|
11
|
-
* If not specified, the link appears with its default styling.
|
|
12
|
-
*/
|
|
13
|
-
appearance?: 'subtle';
|
|
14
|
-
/**
|
|
15
|
-
* Whether the link is disabled.
|
|
16
|
-
* @default false
|
|
17
|
-
*/
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* When set, allows the link to be focusable even when it has been disabled. This is used in scenarios where it is
|
|
21
|
-
* important to keep a consistent tab order for screen reader and keyboard users.
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
disabledFocusable?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* If true, changes styling when the link is being used alongside other text content.
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
inline?: boolean;
|
|
30
|
-
};
|
|
31
|
-
export declare type LinkProps = ComponentProps<LinkSlots> & LinkCommons;
|
|
32
|
-
export declare type LinkState = ComponentState<LinkSlots> & LinkCommons;
|
|
33
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { LinkProps, LinkState } from './Link.types';
|
|
3
|
-
/**
|
|
4
|
-
* Given user props, defines default props for the Link, calls useLinkState_unstable, and returns processed state.
|
|
5
|
-
* @param props - User provided props to the Link component.
|
|
6
|
-
* @param ref - User provided ref to be passed to the Link component.
|
|
7
|
-
*/
|
|
8
|
-
export declare const useLink_unstable: (props: LinkProps, ref: React.Ref<HTMLAnchorElement | HTMLButtonElement>) => LinkState;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { LinkSlots, LinkState } from './Link.types';
|
|
2
|
-
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Use `linkClassNames.root` instead.
|
|
5
|
-
*/
|
|
6
|
-
export declare const linkClassName = "fui-Link";
|
|
7
|
-
export declare const linkClassNames: SlotClassNames<LinkSlots>;
|
|
8
|
-
export declare const useLinkStyles_unstable: (state: LinkState) => LinkState;
|
package/lib/index.d.ts
DELETED
package/lib-commonjs/Link.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components/Link/index';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { LinkProps } from './Link.types';
|
|
2
|
-
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
3
|
-
/**
|
|
4
|
-
* A Link is a reference to data that a user can follow by clicking or tapping it.
|
|
5
|
-
*/
|
|
6
|
-
export declare const Link: ForwardRefComponent<LinkProps>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
|
2
|
-
export declare type LinkSlots = {
|
|
3
|
-
/**
|
|
4
|
-
* Root of the component that renders as either an <a> or a <button> tag.
|
|
5
|
-
*/
|
|
6
|
-
root: Slot<'a', 'button'>;
|
|
7
|
-
};
|
|
8
|
-
declare type LinkCommons = {
|
|
9
|
-
/**
|
|
10
|
-
* A link can appear either with its default style or subtle.
|
|
11
|
-
* If not specified, the link appears with its default styling.
|
|
12
|
-
*/
|
|
13
|
-
appearance?: 'subtle';
|
|
14
|
-
/**
|
|
15
|
-
* Whether the link is disabled.
|
|
16
|
-
* @default false
|
|
17
|
-
*/
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* When set, allows the link to be focusable even when it has been disabled. This is used in scenarios where it is
|
|
21
|
-
* important to keep a consistent tab order for screen reader and keyboard users.
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
disabledFocusable?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* If true, changes styling when the link is being used alongside other text content.
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
inline?: boolean;
|
|
30
|
-
};
|
|
31
|
-
export declare type LinkProps = ComponentProps<LinkSlots> & LinkCommons;
|
|
32
|
-
export declare type LinkState = ComponentState<LinkSlots> & LinkCommons;
|
|
33
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { LinkProps, LinkState } from './Link.types';
|
|
3
|
-
/**
|
|
4
|
-
* Given user props, defines default props for the Link, calls useLinkState_unstable, and returns processed state.
|
|
5
|
-
* @param props - User provided props to the Link component.
|
|
6
|
-
* @param ref - User provided ref to be passed to the Link component.
|
|
7
|
-
*/
|
|
8
|
-
export declare const useLink_unstable: (props: LinkProps, ref: React.Ref<HTMLAnchorElement | HTMLButtonElement>) => LinkState;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { LinkSlots, LinkState } from './Link.types';
|
|
2
|
-
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Use `linkClassNames.root` instead.
|
|
5
|
-
*/
|
|
6
|
-
export declare const linkClassName = "fui-Link";
|
|
7
|
-
export declare const linkClassNames: SlotClassNames<LinkSlots>;
|
|
8
|
-
export declare const useLinkStyles_unstable: (state: LinkState) => LinkState;
|
package/lib-commonjs/index.d.ts
DELETED