@leafygreen-ui/lib
Advanced tools
Comparing version 11.0.0-alpha.1 to 11.0.0
# @leafygreen-ui/lib | ||
## 11.0.0-alpha.1 | ||
## 11.0.0 | ||
### Major Changes | ||
- d40674fe1: Updates build tooling. No functional changes | ||
- 4fcf2e94: Modified the React peerDependency to ensure compatibility with either version 17 or 18. | ||
## 11.0.0-alpha.0 | ||
### Patch Changes | ||
### Major Changes | ||
- 4fcf2e94: Updates helper function, `isComponentType` and updates `ExtendedComponentProps` type. | ||
- 4fcf2e94: Updates types with `React.PropsWithChildren` | ||
- d40674fe1: Updates build tooling. No functional changes | ||
## 10.4.3 | ||
### Patch Changes | ||
- c11bbc29: Fixes problem with ts-docs not being available in bundle. | ||
## 10.4.2 | ||
### Patch Changes | ||
- c15ee2ac: Fixes missing documentation file | ||
## 10.4.1 | ||
### Patch Changes | ||
- 215268ff: Updates build tooling. No functional changes | ||
## 10.4.0 | ||
@@ -16,0 +33,0 @@ |
@@ -1,5 +0,5 @@ | ||
/// <reference types="react" /> | ||
import React from 'react'; | ||
export declare const TestComponent: ({ ...props }: { | ||
[x: string]: any; | ||
}) => JSX.Element; | ||
}) => React.JSX.Element; | ||
//# sourceMappingURL=testComponent.d.ts.map |
@@ -14,3 +14,3 @@ /// <reference types="react" /> | ||
/** Helper type to extract an HTML element's valid props */ | ||
export declare type HTMLElementProps<Element extends keyof JSX.IntrinsicElements, RefType extends HTMLElement = never> = Omit<JSX.IntrinsicElements[Element], 'ref'> & { | ||
export declare type HTMLElementProps<Element extends keyof JSX.IntrinsicElements, RefType extends HTMLElement = never> = React.PropsWithChildren<Omit<JSX.IntrinsicElements[Element], 'ref'>> & { | ||
ref?: [RefType] extends [never] ? never : React.Ref<RefType>; | ||
@@ -59,3 +59,3 @@ key?: React.Key | null; | ||
/** Helper type to check if element is a specific React Component */ | ||
export declare function isComponentType<T = React.ReactElement>(element: React.ReactNode, displayName: string): element is T; | ||
export declare function isComponentType<T extends React.ReactElement = React.ReactElement>(element: React.ReactNode, displayName: string): element is T; | ||
/** | ||
@@ -62,0 +62,0 @@ * Utility for making it easier to couple a React Component to a css selector. |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("lodash/isObject"),require("lodash/once"),require("lodash/isUndefined"),require("react"),require("lodash")):"function"==typeof define&&define.amd?define(["exports","lodash/isObject","lodash/once","lodash/isUndefined","react","lodash"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/lib"]={},e.isObject,e.once,e.isUndefined,e.react,e.lodash)}(this,(function(e,t,n,r,o,a){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=i(t),c=i(n),u=i(r),s=i(o);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function f(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function m(e){return null!=e&&e.nodeType===Node.ELEMENT_NODE}var b=Object.freeze({__proto__:null,array:function(e){return null!=e&&e instanceof Array},button:function(e){return m(e)&&"button"===e.tagName.toLowerCase()},element:m,input:function(e){return m(e)&&"input"===e.tagName.toLowerCase()}}),h=new Map;var v={Light:"light",Dark:"dark"};var g=["small","button","a","abbr","address","article","aside","b","big","blockquote","caption","cite","code","dd","del","details","dfn","dialog","div","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","i","ins","kbd","keygen","label","legend","li","main","map","mark","menu","menuitem","meter","nav","noscript","ol","p","picture","pre","progress","q","rp","rt","ruby","s","samp","slot","script","section","select","span","strong","style","sub","summary","sup","template","tbody","td","tfoot","th","thead","time","title","tr","u","ul"],C={baseFontSize:{description:"The base font size passed to the LeafyGreenProvider that wraps the component",control:{type:"radio"},options:[14,16]},updatedBaseFontSize:{description:"The base font size passed to the LeafyGreenProvider that wraps the component. Uses the updated font size values for Euclid Circular A.",control:{type:"radio"},options:[13,16]},darkMode:{description:"Render the component in dark mode.",control:"boolean"},children:{description:"Element rendered inside the component",control:"text"},as:{description:"The component will be rendered in HTML as the element selected here",options:g,type:{name:"string"},control:{type:"select"},defaultValue:"button"}};function S(e,t){var n;return null!=e&&"object"===d(e)&&"type"in e&&(e.type.displayName===t||l.default(e.type)&&"render"in e.type&&(null===(n=e.type.render)||void 0===n?void 0:n.displayName)===t)}var T={error:c.default(console.error),warn:c.default(console.warn),log:c.default(console.log)};e.AriaCurrentValue={Page:"page",Step:"step",Location:"location",Date:"date",Time:"time",True:"true",Unset:"false"},e.IntrinsicElements=g,e.StoryMeta=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a.mergeWith(e,{},(function(e,t){return Array.isArray(e)?e.concat(t):"string"==typeof e?e:void 0}))},e.Theme=v,e.allEqual=function(e){return 1==new Set(e).size},e.consoleOnce=T,e.createDataProp=function(e){var t="data-leafygreen-ui";return{prop:f({},t,e),selector:"[".concat(t,'="').concat(e,'"]')}},e.createSyntheticEvent=function(e,t){Object.defineProperty(e,"target",{writable:!1,value:t});var n=!1,r=!1;return{nativeEvent:e,currentTarget:e.currentTarget,target:e.target,bubbles:e.bubbles,cancelable:e.cancelable,defaultPrevented:e.defaultPrevented,eventPhase:e.eventPhase,isTrusted:e.isTrusted,preventDefault:function(){n=!0,e.preventDefault()},isDefaultPrevented:function(){return n},stopPropagation:function(){r=!0,e.stopPropagation()},isPropagationStopped:function(){return r},persist:function(){},timeStamp:e.timeStamp,type:e.type}},e.createUniqueClassName=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=function(e){var t,n,r=(null!==(t=null===(n=h.get(e))||void 0===n?void 0:n.length)&&void 0!==t?t:0).toString().padStart(4,"0");return"lg-ui".concat(e?"-".concat(e):"","-").concat(r)}(e);if(h.has(e)){var n=h.get(e);h.set(e,[t].concat(p(n)))}else h.set(e,[t]);return t},e.enforceExhaustive=function(e){throw Error("Received unhandled value: ".concat(e))},e.getNodeTextContent=function e(t){return"string"==typeof(n=t)||"number"==typeof n?t.toString().trim():Array.isArray(t)?t.map(e).join(" ").trim():function(e){return e&&"object"===d(e)&&e.props}(t)?e(t.props.children):"";var n},e.getTheme=function(e){return e?v.Dark:v.Light},e.isComponentType=S,e.keyMap={ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39,Backspace:8,BracketLeft:91,Delete:46,Enter:13,Escape:27,Space:32,Tab:9},e.storybookArgTypes=C,e.storybookExcludedArgTypes={"aria-controls":{control:"none"},"aria-describedby":{control:"none"},"aria-label":{control:"none"},"aria-labelledby":{control:"none"},className:{control:"none"},id:{control:"none"},onBlur:{control:"none"},onCancel:{control:"none"},onChange:{control:"none"},onClear:{control:"none"},onClick:{control:"none"},onClose:{control:"none"},onConfirm:{control:"none"},onDismiss:{control:"none"},onFilter:{control:"none"},onSubmit:{control:"none"},portalClassName:{control:"none"},portalContainer:{control:"none"},popoverZIndex:{control:"none"},ref:{control:"none"},scrollContainer:{control:"none"},usePortal:{control:"none"}},e.storybookExcludedControlParams=["aria-controls","aria-describedby","aria-label","aria-labelledby","aria-describedby","className","id","onBlur","onCancel","onChange","onClear","onClick","onConfirm","onDismiss","onFilter","popoverZIndex","portalClassName","portalContainer","ref","setOpen","scrollContainer","usePortal"],e.typeIs=b,e.validateChildren=function(e,t){var n,r=null===(n=s.default.Children.map(e,(function(e){if(t.some((function(t){return S(e,t)})))return e})))||void 0===n?void 0:n.filter((function(e){return!u.default(e)}));return u.default(e)||(null==r?void 0:r.length)===s.default.Children.count(e)||T.error("Children must be one of: ".concat(t.join(", ")),"Received children: ",e),r}})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("lodash/isObject"),require("lodash/once"),require("lodash/isUndefined"),require("react"),require("lodash")):"function"==typeof define&&define.amd?define(["exports","lodash/isObject","lodash/once","lodash/isUndefined","react","lodash"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/lib"]={},e["/isObject"],e["/once"],e["/isUndefined"],e.react,e.lodash)}(this,(function(e,t,n,r,o,a){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=i(t),c=i(n),u=i(r),s=i(o);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function f(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function m(e){return null!=e&&e.nodeType===Node.ELEMENT_NODE}var b=Object.freeze({__proto__:null,array:function(e){return null!=e&&e instanceof Array},button:function(e){return m(e)&&"button"===e.tagName.toLowerCase()},element:m,input:function(e){return m(e)&&"input"===e.tagName.toLowerCase()}}),h=new Map;var v={Light:"light",Dark:"dark"};var g=["small","button","a","abbr","address","article","aside","b","big","blockquote","caption","cite","code","dd","del","details","dfn","dialog","div","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","i","ins","kbd","keygen","label","legend","li","main","map","mark","menu","menuitem","meter","nav","noscript","ol","p","picture","pre","progress","q","rp","rt","ruby","s","samp","slot","script","section","select","span","strong","style","sub","summary","sup","template","tbody","td","tfoot","th","thead","time","title","tr","u","ul"],C={baseFontSize:{description:"The base font size passed to the LeafyGreenProvider that wraps the component",control:{type:"radio"},options:[14,16]},updatedBaseFontSize:{description:"The base font size passed to the LeafyGreenProvider that wraps the component. Uses the updated font size values for Euclid Circular A.",control:{type:"radio"},options:[13,16]},darkMode:{description:"Render the component in dark mode.",control:"boolean"},children:{description:"Element rendered inside the component",control:"text"},as:{description:"The component will be rendered in HTML as the element selected here",options:g,type:{name:"string"},control:{type:"select"},defaultValue:"button"}};function S(e,t){var n;return null!=e&&"object"===d(e)&&"type"in e&&(e.type.displayName===t||l.default(e.type)&&"render"in e.type&&(null===(n=e.type.render)||void 0===n?void 0:n.displayName)===t)}var T={error:c.default(console.error),warn:c.default(console.warn),log:c.default(console.log)};e.AriaCurrentValue={Page:"page",Step:"step",Location:"location",Date:"date",Time:"time",True:"true",Unset:"false"},e.IntrinsicElements=g,e.StoryMeta=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a.mergeWith(e,{},(function(e,t){return Array.isArray(e)?e.concat(t):"string"==typeof e?e:void 0}))},e.Theme=v,e.allEqual=function(e){return 1==new Set(e).size},e.consoleOnce=T,e.createDataProp=function(e){var t="data-leafygreen-ui";return{prop:f({},t,e),selector:"[".concat(t,'="').concat(e,'"]')}},e.createSyntheticEvent=function(e,t){Object.defineProperty(e,"target",{writable:!1,value:t});var n=!1,r=!1;return{nativeEvent:e,currentTarget:e.currentTarget,target:e.target,bubbles:e.bubbles,cancelable:e.cancelable,defaultPrevented:e.defaultPrevented,eventPhase:e.eventPhase,isTrusted:e.isTrusted,preventDefault:function(){n=!0,e.preventDefault()},isDefaultPrevented:function(){return n},stopPropagation:function(){r=!0,e.stopPropagation()},isPropagationStopped:function(){return r},persist:function(){},timeStamp:e.timeStamp,type:e.type}},e.createUniqueClassName=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=function(e){var t,n,r=(null!==(t=null===(n=h.get(e))||void 0===n?void 0:n.length)&&void 0!==t?t:0).toString().padStart(4,"0");return"lg-ui".concat(e?"-".concat(e):"","-").concat(r)}(e);if(h.has(e)){var n=h.get(e);h.set(e,[t].concat(p(n)))}else h.set(e,[t]);return t},e.enforceExhaustive=function(e){throw Error("Received unhandled value: ".concat(e))},e.getNodeTextContent=function e(t){return"string"==typeof(n=t)||"number"==typeof n?t.toString().trim():Array.isArray(t)?t.map(e).join(" ").trim():function(e){return e&&"object"===d(e)&&e.props}(t)?e(t.props.children):"";var n},e.getTheme=function(e){return e?v.Dark:v.Light},e.isComponentType=S,e.keyMap={ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39,Backspace:8,BracketLeft:91,Delete:46,Enter:13,Escape:27,Space:32,Tab:9},e.storybookArgTypes=C,e.storybookExcludedArgTypes={"aria-controls":{control:"none"},"aria-describedby":{control:"none"},"aria-label":{control:"none"},"aria-labelledby":{control:"none"},className:{control:"none"},id:{control:"none"},onBlur:{control:"none"},onCancel:{control:"none"},onChange:{control:"none"},onClear:{control:"none"},onClick:{control:"none"},onClose:{control:"none"},onConfirm:{control:"none"},onDismiss:{control:"none"},onFilter:{control:"none"},onSubmit:{control:"none"},portalClassName:{control:"none"},portalContainer:{control:"none"},popoverZIndex:{control:"none"},ref:{control:"none"},scrollContainer:{control:"none"},usePortal:{control:"none"}},e.storybookExcludedControlParams=["aria-controls","aria-describedby","aria-label","aria-labelledby","aria-describedby","className","id","onBlur","onCancel","onChange","onClear","onClick","onConfirm","onDismiss","onFilter","popoverZIndex","portalClassName","portalContainer","ref","setOpen","scrollContainer","usePortal"],e.typeIs=b,e.validateChildren=function(e,t){var n,r=null===(n=s.default.Children.map(e,(function(e){if(t.some((function(t){return S(e,t)})))return e})))||void 0===n?void 0:n.filter((function(e){return!u.default(e)}));return u.default(e)||(null==r?void 0:r.length)===s.default.Children.count(e)||T.error("Children must be one of: ".concat(t.join(", ")),"Received children: ",e),r}})); | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ import { Args } from '@storybook/csf'; | ||
import { StoryMetaType, type LeafyGreenProviderProps } from './StoryMeta.types'; | ||
export declare type ExtendedComponentProps<T extends React.ElementType, XP extends Record<string, any> = {}> = ComponentProps<T> & LeafyGreenProviderProps; | ||
export declare type ExtendedComponentProps<T extends React.ElementType, XP extends Record<string, any> = {}> = ComponentProps<T> & LeafyGreenProviderProps & XP; | ||
interface InstanceContext { | ||
@@ -8,0 +8,0 @@ args: Args; |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
declare const IntrinsicElements: Array<keyof JSX.IntrinsicElements>; | ||
export default IntrinsicElements; | ||
//# sourceMappingURL=IntrinsicElements.d.ts.map |
{ | ||
"name": "@leafygreen-ui/lib", | ||
"version": "11.0.0-alpha.1", | ||
"version": "11.0.0", | ||
"description": "leafyGreen UI Kit Internal Library", | ||
@@ -16,4 +16,5 @@ "main": "./dist/index.js", | ||
"scripts": { | ||
"build": "rollup --config rollup.config.mjs", | ||
"tsc": "tsc --build tsconfig.json" | ||
"build": "lg build-package", | ||
"tsc": "lg build-ts", | ||
"docs": "lg build-tsdoc" | ||
}, | ||
@@ -26,3 +27,3 @@ "keywords": [], | ||
"peerDependencies": { | ||
"react": "^17.0.0" | ||
"react": "^17.0.0 || ^18.0.0" | ||
}, | ||
@@ -44,2 +45,2 @@ "dependencies": { | ||
} | ||
} | ||
} |
@@ -41,3 +41,3 @@ import isObject from 'lodash/isObject'; | ||
RefType extends HTMLElement = never, | ||
> = Omit<JSX.IntrinsicElements[Element], 'ref'> & { | ||
> = React.PropsWithChildren<Omit<JSX.IntrinsicElements[Element], 'ref'>> & { | ||
ref?: [RefType] extends [never] ? never : React.Ref<RefType>; | ||
@@ -92,6 +92,5 @@ key?: React.Key | null; | ||
/** Helper type to check if element is a specific React Component */ | ||
export function isComponentType<T = React.ReactElement>( | ||
element: React.ReactNode, | ||
displayName: string, | ||
): element is T { | ||
export function isComponentType< | ||
T extends React.ReactElement = React.ReactElement, | ||
>(element: React.ReactNode, displayName: string): element is T { | ||
return ( | ||
@@ -98,0 +97,0 @@ element != null && |
@@ -10,3 +10,3 @@ import { Args } from '@storybook/csf'; | ||
XP extends Record<string, any> = {}, | ||
> = ComponentProps<T> & LeafyGreenProviderProps; | ||
> = ComponentProps<T> & LeafyGreenProviderProps & XP; | ||
@@ -13,0 +13,0 @@ interface InstanceContext { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
352130
69
7648