@toptal/picasso-link 3.0.1-alpha-fx-5880-page-head-2-241fef4ab.34 → 3.0.2

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.
@@ -1,8 +1,10 @@
1
1
  import type { ReactNode, AnchorHTMLAttributes, ElementType } from 'react';
2
2
  import React from 'react';
3
3
  import type { BaseProps, OverridableComponent } from '@toptal/picasso-shared';
4
- declare type VariantType = 'action' | 'anchor';
5
- declare type ColorType = 'white' | 'blue';
4
+ declare const supportedColors: readonly ["white", "blue"];
5
+ declare const supportedVariants: readonly ["action", "anchor"];
6
+ declare type VariantType = (typeof supportedVariants)[number];
7
+ declare type ColorType = (typeof supportedColors)[number];
6
8
  export declare type Props = BaseProps & AnchorHTMLAttributes<HTMLAnchorElement> & {
7
9
  /** Content of the component */
8
10
  children?: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/Link/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACzE,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAG7E,aAAK,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAA;AACtC,aAAK,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;AA0CjC,oBAAY,KAAK,GAAG,SAAS,GAC3B,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACxC,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iDAAiD;IACjD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC9D;;;OAGG;IACH,EA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E,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC9D;;;OAGG;IACH,EAAE,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAA;IACnD,qDAAqD;IACrD,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,iCAAiC;IACjC,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAKH,eAAO,MAAM,IAAI,EAAE,oBAAoB,CAAC,KAAK,CA8D3C,CAAA;AAWF,eAAe,IAAI,CAAA"}
@@ -12,6 +12,8 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React, { forwardRef } from 'react';
13
13
  import { twMerge } from '@toptal/picasso-tailwind-merge';
14
14
  import { Typography } from '@toptal/picasso-typography';
15
+ const supportedColors = ['white', 'blue'];
16
+ const supportedVariants = ['action', 'anchor'];
15
17
  const sanitizeRel = (rel, target) => {
16
18
  if (target !== '_blank') {
17
19
  return rel;
@@ -44,10 +46,17 @@ const COLOR_DISABLED_MAP = {
44
46
  },
45
47
  },
46
48
  };
49
+ const defaultColor = 'blue';
50
+ const defaultVariant = 'anchor';
47
51
  export const Link = forwardRef(function Link(props, ref) {
48
- const { href, onClick, children, className, color = 'blue', style, as = 'a', variant = 'anchor', tabIndex, target, rel, disabled, visited = false, noUnderline, 'aria-disabled': ariaDisabled } = props, rest = __rest(props, ["href", "onClick", "children", "className", "color", "style", "as", "variant", "tabIndex", "target", "rel", "disabled", "visited", "noUnderline", 'aria-disabled']);
52
+ const { href, onClick, children, className, color: inputColor = 'blue', style, as = 'a', variant: inputVariant = 'anchor', tabIndex, target, rel, disabled, visited = false, noUnderline, 'aria-disabled': ariaDisabled } = props, rest = __rest(props, ["href", "onClick", "children", "className", "color", "style", "as", "variant", "tabIndex", "target", "rel", "disabled", "visited", "noUnderline", 'aria-disabled']);
49
53
  const nativeHTMLAttributes = rest;
50
54
  const sanitizedRel = sanitizeRel(rel, target);
55
+ // When Link is used as={Link}, TypeScript can't ensure the input to the Link is compatible with its Props type.
56
+ const color = supportedColors.includes(inputColor) ? inputColor : defaultColor;
57
+ const variant = supportedVariants.includes(inputVariant)
58
+ ? inputVariant
59
+ : defaultVariant;
51
60
  return (React.createElement(Typography, Object.assign({}, nativeHTMLAttributes, { ref: ref, as: as,
52
61
  // @ts-expect-error Typography is incompatible with href prop
53
62
  href: disabled ? undefined : href, target: disabled ? undefined : target, rel: sanitizedRel, onClick: disabled ? undefined : onClick, color: 'inherit', weight: variant === 'action' ? 'semibold' : 'inherit', className: twMerge('focus:outline-none hover:underline leading-[inherit]', COLOR_DISABLED_MAP[color][variant][disabled ? 'disabled' : 'normal'], disabled ? 'cursor-not-allowed' : '', noUnderline ? '!no-underline' : '', visited
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../src/Link/Link.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAKvD,MAAM,WAAW,GAAG,CAAC,GAAuB,EAAE,MAA0B,EAAE,EAAE;IAC1E,IAAI,MAAM,KAAK,QAAQ,EAAE;QACvB,OAAO,GAAG,CAAA;KACX;IAED,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,UAAU,CAAA;KAClB;IAED,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,QA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,CAAC,CAAC,CAAC,EAAE,EACpC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAClC,OAAO;YACL,CAAC,CAAC,KAAK,KAAK,MAAM;gBAChB,CAAC,CAAC,yBAAyB;gBAC3B,CAAC,CAAC,uBAAuB;YAC3B,CAAC,CAAC,EAAE,EACN,SAAS,CACV,EACD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,mBACH,QAAQ,IAAI,YAAY,KAEtC,QAAQ,CACE,CACd,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,YAAY,GAAG;IAClB,EAAE,EAAE,GAAG;IACP,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,QAAQ;IACjB,WAAW,EAAE,KAAK;CACnB,CAAA;AAED,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA;AAEzB,eAAe,IAAI,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/picasso-link",
3
- "version": "3.0.1-alpha-fx-5880-page-head-2-241fef4ab.34+241fef4ab",
3
+ "version": "3.0.2",
4
4
  "description": "Toptal UI components library - Link",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,31 +22,30 @@
22
22
  },
23
23
  "homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
24
24
  "dependencies": {
25
- "@toptal/picasso-typography": "4.0.1-alpha-fx-5880-page-head-2-241fef4ab.34+241fef4ab",
26
- "@toptal/picasso-utils": "1.0.4-alpha-fx-5880-page-head-2-241fef4ab.196+241fef4ab"
25
+ "@toptal/picasso-utils": "2.0.0",
26
+ "@toptal/picasso-typography": "4.0.1"
27
27
  },
28
28
  "sideEffects": [
29
29
  "**/styles.ts",
30
30
  "**/styles.js"
31
31
  ],
32
32
  "peerDependencies": {
33
- "@toptal/picasso-provider": "*",
34
- "@toptal/picasso-tailwind": ">=2.5.0",
35
33
  "@toptal/picasso-tailwind-merge": "^2.0.0",
34
+ "@toptal/picasso-tailwind": ">=2.5.0",
35
+ "@toptal/picasso-provider": "*",
36
36
  "react": ">=16.12.0 < 19.0.0"
37
37
  },
38
38
  "exports": {
39
39
  ".": "./dist-package/src/index.js"
40
40
  },
41
41
  "devDependencies": {
42
- "@toptal/picasso-provider": "5.0.1-alpha-fx-5880-page-head-2-241fef4ab.117+241fef4ab",
43
- "@toptal/picasso-tailwind-merge": "2.0.1-alpha-fx-5880-page-head-2-241fef4ab.34+241fef4ab",
44
- "@toptal/picasso-test-utils": "1.1.2-alpha-fx-5880-page-head-2-241fef4ab.196+241fef4ab"
42
+ "@toptal/picasso-tailwind-merge": "2.0.1",
43
+ "@toptal/picasso-provider": "5.0.0",
44
+ "@toptal/picasso-test-utils": "1.1.1"
45
45
  },
46
46
  "files": [
47
47
  "dist-package/**",
48
48
  "!dist-package/tsconfig.tsbuildinfo",
49
49
  "src"
50
- ],
51
- "gitHead": "241fef4abd970386116acad79b109b78b2086e3c"
50
+ ]
52
51
  }
package/src/Link/Link.tsx CHANGED
@@ -4,8 +4,11 @@ import { twMerge } from '@toptal/picasso-tailwind-merge'
4
4
  import type { BaseProps, OverridableComponent } from '@toptal/picasso-shared'
5
5
  import { Typography } from '@toptal/picasso-typography'
6
6
 
7
- type VariantType = 'action' | 'anchor'
8
- type ColorType = 'white' | 'blue'
7
+ const supportedColors = ['white', 'blue'] as const
8
+ const supportedVariants = ['action', 'anchor'] as const
9
+
10
+ type VariantType = (typeof supportedVariants)[number]
11
+ type ColorType = (typeof supportedColors)[number]
9
12
 
10
13
  const sanitizeRel = (rel: string | undefined, target: string | undefined) => {
11
14
  if (target !== '_blank') {
@@ -77,6 +80,9 @@ export type Props = BaseProps &
77
80
  'aria-disabled'?: boolean
78
81
  }
79
82
 
83
+ const defaultColor = 'blue'
84
+ const defaultVariant = 'anchor'
85
+
80
86
  export const Link: OverridableComponent<Props> = forwardRef<
81
87
  HTMLAnchorElement,
82
88
  Props
@@ -86,10 +92,10 @@ export const Link: OverridableComponent<Props> = forwardRef<
86
92
  onClick,
87
93
  children,
88
94
  className,
89
- color = 'blue',
95
+ color: inputColor = 'blue',
90
96
  style,
91
97
  as = 'a',
92
- variant = 'anchor',
98
+ variant: inputVariant = 'anchor',
93
99
  tabIndex,
94
100
  target,
95
101
  rel,
@@ -102,6 +108,12 @@ export const Link: OverridableComponent<Props> = forwardRef<
102
108
  const nativeHTMLAttributes = rest
103
109
  const sanitizedRel = sanitizeRel(rel, target)
104
110
 
111
+ // When Link is used as={Link}, TypeScript can't ensure the input to the Link is compatible with its Props type.
112
+ const color = supportedColors.includes(inputColor) ? inputColor : defaultColor
113
+ const variant = supportedVariants.includes(inputVariant)
114
+ ? inputVariant
115
+ : defaultVariant
116
+
105
117
  return (
106
118
  <Typography
107
119
  {...nativeHTMLAttributes}
package/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021-2022 Toptal, LLC
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the “Software”), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.