@nimbus-ds/link 4.0.0 → 4.1.0-rc.1

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
@@ -2,6 +2,12 @@
2
2
 
3
3
  The Link component allows us to navigate to external addresses.
4
4
 
5
+ ## 2023-03-24 `4.1.0`
6
+
7
+ ### 💡 Others
8
+
9
+ - Adjusted the component properties interface to use `ComponentPropsWithRef` and include the `as` prop in the output interface. ([#132](https://github.com/TiendaNube/nimbus-design-system/pull/132) by [@juniorconquista](https://github.com/juniorconquista))
10
+
5
11
  ## 2023-03-13 `4.0.0`
6
12
 
7
13
  ### 🛠 Breaking changes
@@ -86,6 +92,7 @@ The Link component allows us to navigate to external addresses.
86
92
  - Removed `terser-webpack-plugin@5.3.5`. ([#63](https://github.com/TiendaNube/nimbus-design-system/pull/63) by [@juniorconquista](https://github.com/juniorconquista))
87
93
  - Removed `ts-loader@9.3.1`. ([#63](https://github.com/TiendaNube/nimbus-design-system/pull/63) by [@juniorconquista](https://github.com/juniorconquista))
88
94
  - Removed `webpack-cli@4.10.0`. ([#63](https://github.com/TiendaNube/nimbus-design-system/pull/63) by [@juniorconquista](https://github.com/juniorconquista))
95
+ - Removed `webpack@5.74.0`. ([#63](https://github.com/TiendaNube/nimbus-design-system/pull/63) by [@juniorconquista](https://github.com/juniorconquista))
89
96
  - Removed `typescript@4.7.4`. ([#63](https://github.com/TiendaNube/nimbus-design-system/pull/63) by [@juniorconquista](https://github.com/juniorconquista))
90
97
 
91
98
  ## 2022-12-01 `2.0.0`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimbus-ds/link",
3
- "version": "4.0.0",
3
+ "version": "4.1.0-rc.1",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "sideEffects": false,
11
11
  "scripts": {
12
- "build": "webpack",
12
+ "build": "yarn g:webpack",
13
13
  "clean": "rm -rf dist",
14
14
  "version": "yarn version"
15
15
  },
@@ -30,6 +30,7 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@nimbus-ds/icons": "^1.1.0",
33
- "webpack": "^5.74.0"
34
- }
33
+ "@nimbus-ds/webpack": "^1.1.0"
34
+ },
35
+ "stableVersion": "4.0.0"
35
36
  }
package/dist/index.d.ts DELETED
@@ -1,92 +0,0 @@
1
- // Generated by dts-bundle-generator v7.1.0
2
-
3
- import React from 'react';
4
- import { HTMLAttributes, ReactNode } from 'react';
5
-
6
- export type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;
7
- export type ForwardRefExoticComponent<E, OwnProps> = React.ForwardRefExoticComponent<Merge<E extends React.ElementType ? React.ComponentPropsWithRef<E> : never, OwnProps & {
8
- as?: E;
9
- }>>;
10
- export interface PolymorphicForwardRefComponent<IntrinsicElementString, OwnProps = {}
11
- /**
12
- * Extends original type to ensure built in React types play nice
13
- * with polymorphic components still e.g. `React.ElementRef` etc.
14
- */
15
- > extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> {
16
- /**
17
- * When `as` prop is passed, use this overload.
18
- * Merges original own props (without DOM props) and the inferred props
19
- * from `as` element with the own props taking precendence.
20
- *
21
- * We explicitly avoid `React.ElementType` and manually narrow the prop types
22
- * so that events are typed when using JSX.IntrinsicElements.
23
- */
24
- <As = IntrinsicElementString>(props: As extends "" ? {
25
- as: keyof JSX.IntrinsicElements;
26
- } : As extends React.ComponentType<infer P> ? Merge<P, OwnProps & {
27
- as: As;
28
- }> : As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & {
29
- as: As;
30
- }> : never): React.ReactElement | null;
31
- }
32
- export type TextDecoration = "none" | "underline";
33
- declare const link: {
34
- sprinkle: ((props: {
35
- textDecoration?: TextDecoration | undefined;
36
- fontSize?: "base" | "caption" | "highlight" | undefined;
37
- lineHeight?: "base" | "caption" | "highlight" | undefined;
38
- }) => string) & {
39
- properties: Set<"fontSize" | "textDecoration" | "lineHeight">;
40
- };
41
- properties: {
42
- textDecoration: TextDecoration[];
43
- fontSize: {
44
- caption: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
45
- base: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
46
- highlight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
47
- };
48
- lineHeight: {
49
- readonly caption: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
50
- readonly base: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
51
- readonly highlight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
52
- };
53
- };
54
- classnames: {
55
- base: string;
56
- appearance: Record<"primary" | "danger" | "neutral" | "neutral-background", string>;
57
- };
58
- };
59
- export interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
60
- /** width alignment in content */
61
- width: string;
62
- /** height alignment in content */
63
- height: string;
64
- /** borderRadius alignment in content */
65
- borderRadius?: string;
66
- }
67
- export type LinkSkeletonProps = Partial<Pick<SkeletonProps, "width">> & {
68
- "data-testid"?: string;
69
- };
70
- declare const LinkSkeleton: React.FC<LinkSkeletonProps>;
71
- export interface LinkComponents {
72
- Skeleton: typeof LinkSkeleton;
73
- }
74
- export interface LinkProps extends HTMLAttributes<HTMLElement> {
75
- /** Text to be displayed on link */
76
- children: ReactNode;
77
- /** Link appearance */
78
- appearance?: "primary" | "danger" | "neutral" | "neutral-background";
79
- /** Decoration for the link text */
80
- textDecoration?: typeof link.properties.textDecoration[number];
81
- /** Size of the link text */
82
- fontSize?: keyof typeof link.properties.fontSize;
83
- /** Link text line height */
84
- lineHeight?: keyof typeof link.properties.lineHeight;
85
- }
86
- export declare const Link: PolymorphicForwardRefComponent<"a" | "button", LinkProps> & LinkComponents;
87
-
88
- export {
89
- Link as default,
90
- };
91
-
92
- export {};
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nimbus-ds/styles"),require("@nimbus-ds/skeleton")):"function"==typeof define&&define.amd?define(["react","@nimbus-ds/styles","@nimbus-ds/skeleton"],t):"object"==typeof exports?exports["@nimbus-ds/link"]=t(require("react"),require("@nimbus-ds/styles"),require("@nimbus-ds/skeleton")):e["@nimbus-ds/link"]=t(e.react,e["@nimbus-ds/styles"],e["@nimbus-ds/skeleton"])}(global,((e,t,r)=>(()=>{"use strict";var n={607:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Link=void 0;const n=r(15).__importStar(r(156)),o=r(990),a=r(612),i=(0,n.forwardRef)((({className:e,style:t,as:r="a",appearance:a="neutral",textDecoration:i="underline",fontSize:c="base",lineHeight:u="base",children:l,...f},s)=>{const p=(0,n.createRef)();return(0,n.useImperativeHandle)(s,(()=>p?.current)),(0,n.useEffect)((()=>{!p.current||p.current instanceof HTMLButtonElement||p.current instanceof HTMLAnchorElement||console.error("Error: Found `Link` component that renders an inaccessible element",p.current,"Please ensure `Link` always renders as <a> or <button>")}),[p]),n.default.createElement(r,{...f,className:[o.link.classnames.appearance[a],o.link.sprinkle({textDecoration:i,fontSize:c,lineHeight:u})].join(" "),ref:p},l)}));t.Link=i,i.Skeleton=a.LinkSkeleton,i.displayName="Link",i.Skeleton.displayName="Link.Skeleton"},2:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkSkeleton=void 0;const n=r(15).__importDefault(r(156)),o=r(678);t.LinkSkeleton=({width:e,"data-testid":t})=>n.default.createElement(o.Skeleton,{width:e??"4.75rem",height:"1.125rem",borderRadius:"0.25rem","data-testid":t})},526:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkSkeleton=void 0;const n=r(2);var o=r(2);Object.defineProperty(t,"LinkSkeleton",{enumerable:!0,get:function(){return o.LinkSkeleton}}),t.default=n.LinkSkeleton},612:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});r(15).__exportStar(r(526),t)},15:(e,t,r)=>{r.r(t),r.d(t,{__assign:()=>a,__asyncDelegator:()=>O,__asyncGenerator:()=>w,__asyncValues:()=>j,__await:()=>m,__awaiter:()=>f,__classPrivateFieldGet:()=>x,__classPrivateFieldIn:()=>E,__classPrivateFieldSet:()=>L,__createBinding:()=>p,__decorate:()=>c,__exportStar:()=>y,__extends:()=>o,__generator:()=>s,__importDefault:()=>P,__importStar:()=>S,__makeTemplateObject:()=>g,__metadata:()=>l,__param:()=>u,__read:()=>b,__rest:()=>i,__spread:()=>v,__spreadArray:()=>_,__spreadArrays:()=>h,__values:()=>d});var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function i(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function c(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function u(e,t){return function(r,n){t(r,n,e)}}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{u(n.next(e))}catch(e){a(e)}}function c(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,c)}u((n=n.apply(e,t||[])).next())}))}function s(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var p=Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function y(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||p(t,e,r)}function d(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function v(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e}function h(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var a=arguments[t],i=0,c=a.length;i<c;i++,o++)n[o]=a[i];return n}function _(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function w(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),a=[];return n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n;function i(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){a.push([e,t,r,n])>1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,l):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function u(e){c("next",e)}function l(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:"return"===n}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=d(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function g(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var k=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function S(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&p(t,e,r);return k(t,e),t}function P(e){return e&&e.__esModule?e:{default:e}}function x(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function L(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}function E(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}},678:e=>{e.exports=r},990:e=>{e.exports=t},156:t=>{t.exports=e}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0}),e.Link=void 0;const t=a(607);var r=a(607);Object.defineProperty(e,"Link",{enumerable:!0,get:function(){return r.Link}}),e.default=t.Link})(),i})()));