Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@leafygreen-ui/lib

Package Overview
Dependencies
Maintainers
3
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafygreen-ui/lib - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

dist/IdAllocator.d.ts

6

CHANGELOG.md
# @leafygreen-ui/lib
## 5.1.0
### Minor Changes
- 6aadc0b: Make id generation deterministic using IdAllocator.create class. This improves the SSR compatibility of these components.
## 5.0.0

@@ -4,0 +10,0 @@

3

dist/index.d.ts
/// <reference types="react" />
import IdAllocator from './IdAllocator';
import * as typeIs from './typeIs';
export { typeIs };
export { IdAllocator, typeIs };
/** Helper type to extract an HTML element's valid props */

@@ -5,0 +6,0 @@ export declare type HTMLElementProps<Element extends keyof JSX.IntrinsicElements> = JSX.IntrinsicElements[Element] extends React.DetailedHTMLProps<infer Props, any> ? Props : never;

@@ -1,61 +0,2 @@

import * as typeIs from './typeIs';
export { typeIs };
/** Helper type to check if element is a specific React Component */
export function isComponentType(element, displayName) {
return (element != null &&
typeof element === 'object' &&
'type' in element &&
element.type.displayName === displayName);
}
/**
* Utility for making it easier to couple a React Component to a css selector.
* Useful when writing css selectors that rely on interactivity, i.e. :hover.
* Example:
* const checkBoxWrapper = createDataProp('checkbox-wrapper');
* // Used as selector:
* css`&:hover ${checkboxWrapper.selector} { }`
* // Used on React Component
* <div {...checkboxWrapper.prop} />
* @param {string} name Name of element we want to reference.
*/
export function createDataProp(name) {
var _a;
// ts:emit throws an error if this is not typed. Usually this can be inferred.
var prefix = 'data-leafygreen-ui';
return {
prop: (_a = {},
_a[prefix] = name,
_a),
selector: "[" + prefix + "=\"" + name + "\"]",
};
}
/** Object mapping keyCodes to keys */
export var keyMap = {
ArrowUp: 38,
ArrowDown: 40,
ArrowLeft: 37,
ArrowRight: 39,
Enter: 13,
Escape: 27,
Space: 32,
Tab: 9,
};
/**
* An enum of accepted values for the "aria-current" attribute, used for
* indicating current/active state across several contexts.
*
* The values "false", the empty string, and an ommission of this attribute
* are all treated identically by user agents and screen readers.
*
* W3C Recommendation: https://www.w3.org/TR/wai-aria-1.1/#aria-current
*/
export var AriaCurrentValue = {
Page: 'page',
Step: 'step',
Location: 'location',
Date: 'date',
Time: 'time',
True: 'true',
Unset: 'false',
};
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isComponentType=function(e,t){return null!=e&&"object"===f(e)&&"type"in e&&e.type.displayName===t},t.createDataProp=function(e){return{prop:a({},"data-leafygreen-ui",e),selector:"[".concat("data-leafygreen-ui",'="').concat(e,'"]')}},Object.defineProperty(t,"IdAllocator",{enumerable:!0,get:function(){return o.default}}),t.typeIs=t.AriaCurrentValue=t.keyMap=void 0;var n,o=(n=r(1))&&n.__esModule?n:{default:n},u=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==f(e)&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var u=n?Object.getOwnPropertyDescriptor(e,o):null;u&&(u.get||u.set)?Object.defineProperty(r,o,u):r[o]=e[o]}r.default=e,t&&t.set(e,r);return r}(r(2));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e){return(f="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})(e)}t.typeIs=u;t.keyMap={ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39,Enter:13,Escape:27,Space:32,Tab:9};t.AriaCurrentValue={Page:"page",Step:"step",Location:"location",Date:"date",Time:"time",True:"true",Unset:"false"}},function(e,t,r){"use strict";function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,u=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw u}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"value",0),i(this,"prefix",void 0),this.prefix=t}var t,r,o;return t=e,o=[{key:"create",value:function(t){var r,n=null!==(r=this.registry.get(t))&&void 0!==r?r:new e(t);return e.registry.set(t,n),n}},{key:"snapshot",value:function(){var e={};return this.registry.forEach((function(t){e[t.prefix]=t.value})),e}},{key:"restore",value:function(e){var t=this;this.registry.forEach((function(t){e&&t.prefix in e||(t.value=0)})),e&&Object.entries(e).forEach((function(e){var r,o=n(e,2),u=o[0],i=o[1];(null!==(r=t.registry.get(u))&&void 0!==r?r:t.create(u)).value=i}))}}],(r=[{key:"generate",value:function(){return"".concat(this.prefix,"-").concat(this.value++)}}])&&u(t.prototype,r),o&&u(t,o),e}();t.default=a,i(a,"registry",new Map)},function(e,t,r){"use strict";function n(e){return null!=e&&e.nodeType===Node.ELEMENT_NODE}Object.defineProperty(t,"__esModule",{value:!0}),t.element=n,t.button=function(e){return n(e)&&"button"===e.tagName.toLowerCase()},t.input=function(e){return n(e)&&"input"===e.tagName.toLowerCase()},t.array=function(e){return null!=e&&e instanceof Array}}])}));
//# sourceMappingURL=index.js.map
{
"name": "@leafygreen-ui/lib",
"version": "5.0.0",
"version": "5.1.0",
"description": "leafyGreen UI Kit Internal Library",
"browser": "./dist/index.web.js",
"main": "./dist/index.node.js",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",

@@ -8,0 +7,0 @@ "scripts": {

@@ -0,4 +1,5 @@

import IdAllocator from './IdAllocator';
import * as typeIs from './typeIs';
export { typeIs };
export { IdAllocator, typeIs };

@@ -5,0 +6,0 @@ /** Helper type to extract an HTML element's valid props */

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc