@leafygreen-ui/lib
Advanced tools
Comparing version 13.1.0 to 13.2.0
# @leafygreen-ui/lib | ||
## 13.2.0 | ||
### Minor Changes | ||
- ffd11f24: Updates Typescript signature of `createSyntheticEvent` | ||
- ffd11f24: - Creates new utility functions | ||
- `rollover` | ||
- `truncateStart` | ||
- `cloneReverse` | ||
- `isDefined` | ||
- `isZeroLike` & `isNotZeroLike` | ||
### Patch Changes | ||
- ffd11f24: Updates `target` type in `createSyntheticEvent` to extend `EventTarget` | ||
## 13.1.0 | ||
@@ -4,0 +20,0 @@ |
@@ -1,2 +0,2 @@ | ||
/// <reference types="react" /> | ||
import React from 'react'; | ||
/** | ||
@@ -7,3 +7,3 @@ * Creates a React SyntheticEvent based on the provided native event and target. | ||
*/ | ||
export declare const createSyntheticEvent: <T extends Element, E extends Event>(event: E, target: T) => import("react").SyntheticEvent<T, E>; | ||
export declare const createSyntheticEvent: <ReactEventType extends React.SyntheticEvent<TargetType, NativeEventType>, TargetType extends EventTarget | Element = Element, NativeEventType extends Event = Event>(event: NativeEventType, target: TargetType) => ReactEventType; | ||
//# sourceMappingURL=createSyntheticEvent.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import e from"lodash/omit";import t from"lodash/pick";import n from"lodash/once";import r from"lodash/isObject";import o from"lodash/isUndefined";import i from"react";import{mergeWith as a}from"lodash";function l(e){return l="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},l(e)}function c(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 u(e){return function(e){if(Array.isArray(e))return s(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 s(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 s(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 s(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 p(e){return null!=e&&e.nodeType===Node.ELEMENT_NODE}var d=Object.freeze({__proto__:null,array:function(e){return null!=e&&e instanceof Array},button:function(e){return p(e)&&"button"===e.tagName.toLowerCase()},element:p,input:function(e){return p(e)&&"input"===e.tagName.toLowerCase()}}),f=new Map,m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=function(e){var t,n,r=(null!==(t=null===(n=f.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(f.has(e)){var n=f.get(e);f.set(e,[t].concat(u(n)))}else f.set(e,[t]);return t};function b(e){return"string"==typeof(t=e)||"number"==typeof t?e.toString().trim():Array.isArray(e)?e.map(b).join(" ").trim():function(e){return e&&"object"===l(e)&&e.props}(e)?b(e.props.children):"";var t}var y={Light:"light",Dark:"dark"},h=function(e){return e?y.Dark:y.Light},v=function(n,r){return[t(n,r),e(n,r)]},g={error:n(console.error),warn:n(console.warn),log:n(console.log)};function w(e){return 1==new Set(e).size}function S(e,t){var n;return null!=e&&"object"===l(e)&&"type"in e&&(e.type.displayName===t||r(e.type)&&"render"in e.type&&(null===(n=e.type.render)||void 0===n?void 0:n.displayName)===t)}var C=function(e,t){var n,r=null===(n=i.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!o(e)}));return o(e)||(null==r?void 0:r.length)===i.Children.count(e)||g.error("Children must be one of: ".concat(t.join(", ")),"Received children: ",e),r},A=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}},P=["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"],T={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:P,type:{name:"string"},control:{type:"select"},defaultValue:"button"}},k={"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=["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"],j=function(){return a(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{},(function(e,t){return Array.isArray(e)?e.concat(t):"string"==typeof e?e:void 0}))};function D(e){var t="data-leafygreen-ui";return{prop:c({},t,e),selector:"[".concat(t,'="').concat(e,'"]')}}var L={ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Backspace:"Backspace",BracketLeft:"[",Delete:"Delete",Enter:"Enter",Escape:"Escape",Space:" ",Tab:"Tab"},N={Page:"page",Step:"step",Location:"location",Date:"date",Time:"time",True:"true",Unset:"false"};function O(e){throw Error("Received unhandled value: ".concat(e))}export{N as AriaCurrentValue,P as IntrinsicElements,j as StoryMeta,y as Theme,w as allEqual,g as consoleOnce,D as createDataProp,A as createSyntheticEvent,m as createUniqueClassName,O as enforceExhaustive,b as getNodeTextContent,h as getTheme,S as isComponentType,L as keyMap,v as pickAndOmit,T as storybookArgTypes,k as storybookExcludedArgTypes,E as storybookExcludedControlParams,d as typeIs,C as validateChildren}; | ||
import e from"lodash/once";import t from"lodash/isNull";import r from"lodash/isUndefined";import n from"lodash/omit";import o from"lodash/pick";import i from"lodash/isObject";import a from"react";import{mergeWith as l}from"lodash";function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e){return s="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},s(e)}function p(e,t,r){return t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e){return function(e){if(Array.isArray(e))return d(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 d(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(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(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 d(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 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()}}),y=new Map,h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=function(e){var t,r,n=(null!==(t=null===(r=y.get(e))||void 0===r?void 0:r.length)&&void 0!==t?t:0).toString().padStart(4,"0");return"lg-ui".concat(e?"-".concat(e):"","-").concat(n)}(e);if(y.has(e)){var r=y.get(e);y.set(e,[t].concat(f(r)))}else y.set(e,[t]);return t};function g(e){return"string"==typeof(t=e)||"number"==typeof t?e.toString().trim():Array.isArray(e)?e.map(g).join(" ").trim():function(e){return e&&"object"===s(e)&&e.props}(e)?g(e.props.children):"";var t}var v={Light:"light",Dark:"dark"},w=function(e){return e?v.Dark:v.Light};function S(e){return 1==new Set(e).size}var O=function(e){if(e&&Array.isArray(e)){var t=f(e);return t.reverse(),t}},P={error:e(console.error),warn:e(console.warn),log:e(console.log)},j=function(e){return!r(e)&&!t(e)},C=function(e){return!j(e)||["","0","00",0].includes(e)},A=function(e){return!C(e)},D=function(e,t){return[o(e,t),n(e,t)]},k=function(e,t,r){var n=r-t;return e>r?t+(e-r-1)%n:e<t?r-(t-e-1)%n:e},E={length:30},T=function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:E).length;return e.length<=t?e:e.substring(e.length-t)};function N(e,t){var r;return null!=e&&"object"===s(e)&&"type"in e&&(e.type.displayName===t||i(e.type)&&"render"in e.type&&(null===(r=e.type.render)||void 0===r?void 0:r.displayName)===t)}var L=function(e,t){var n,o=null===(n=a.Children.map(e,(function(e){if(t.some((function(t){return N(e,t)})))return e})))||void 0===n?void 0:n.filter((function(e){return!r(e)}));return r(e)||(null==o?void 0:o.length)===a.Children.count(e)||P.error("Children must be one of: ".concat(t.join(", ")),"Received children: ",e),o},z=function(e,t){Object.defineProperty(e,"target",{writable:!1,value:t});var r=!1,n=!1;return u(u({nativeEvent:e},e),{},{currentTarget:e.currentTarget,target:e.target,bubbles:e.bubbles,cancelable:e.cancelable,defaultPrevented:e.defaultPrevented,eventPhase:e.eventPhase,isTrusted:e.isTrusted,timeStamp:e.timeStamp,type:e.type,preventDefault:function(){r=!0,e.preventDefault()},isDefaultPrevented:function(){return r},stopPropagation:function(){n=!0,e.stopPropagation()},isPropagationStopped:function(){return n},persist:function(){}})},B=["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"],U={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:B,type:{name:"string"},control:{type:"select"},defaultValue:"button"}},I={"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"}},M=["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"],R=function(){return l(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{},(function(e,t){return Array.isArray(e)?e.concat(t):"string"==typeof e?e:void 0}))};function _(e){var t="data-leafygreen-ui";return{prop:p({},t,e),selector:"[".concat(t,'="').concat(e,'"]')}}var x={ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Backspace:"Backspace",BracketLeft:"[",Delete:"Delete",Enter:"Enter",Escape:"Escape",Space:" ",Tab:"Tab"},F={Page:"page",Step:"step",Location:"location",Date:"date",Time:"time",True:"true",Unset:"false"};function q(e){throw Error("Received unhandled value: ".concat(e))}export{F as AriaCurrentValue,B as IntrinsicElements,R as StoryMeta,v as Theme,S as allEqual,O as cloneReverse,P as consoleOnce,_ as createDataProp,z as createSyntheticEvent,h as createUniqueClassName,q as enforceExhaustive,g as getNodeTextContent,w as getTheme,N as isComponentType,j as isDefined,A as isNotZeroLike,C as isZeroLike,x as keyMap,D as pickAndOmit,k as rollover,U as storybookArgTypes,I as storybookExcludedArgTypes,M as storybookExcludedControlParams,T as truncateStart,b as typeIs,L as validateChildren}; | ||
//# sourceMappingURL=index.js.map |
@@ -0,4 +1,9 @@ | ||
export { allEqual } from './allEqual'; | ||
export { cloneReverse } from './cloneReverse'; | ||
export { consoleOnce } from './consoleOnce'; | ||
export { isDefined } from './isDefined'; | ||
export { isNotZeroLike, isZeroLike } from './isZeroLike'; | ||
export { pickAndOmit } from './pickAndOmit'; | ||
export { consoleOnce } from './consoleOnce'; | ||
export { allEqual } from './allEqual'; | ||
export { rollover } from './rollover'; | ||
export { truncateStart } from './truncateStart'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("lodash/omit"),require("lodash/pick"),require("lodash/once"),require("lodash/isObject"),require("lodash/isUndefined"),require("react"),require("lodash")):"function"==typeof define&&define.amd?define(["exports","lodash/omit","lodash/pick","lodash/once","lodash/isObject","lodash/isUndefined","react","lodash"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/lib"]={},e["/omit"],e["/pick"],e["/once"],e["/isObject"],e["/isUndefined"],e.react,e.lodash)}(this,(function(e,t,n,r,o,a,i,l){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(t),s=c(n),d=c(r),p=c(o),f=c(a),m=c(i);function y(e){return y="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},y(e)}function b(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 h(e){return function(e){if(Array.isArray(e))return g(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 g(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 g(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 g(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 v(e){return null!=e&&e.nodeType===Node.ELEMENT_NODE}var C=Object.freeze({__proto__:null,array:function(e){return null!=e&&e instanceof Array},button:function(e){return v(e)&&"button"===e.tagName.toLowerCase()},element:v,input:function(e){return v(e)&&"input"===e.tagName.toLowerCase()}}),w=new Map;var S={Light:"light",Dark:"dark"},A={error:d.default(console.error),warn:d.default(console.warn),log:d.default(console.log)};function T(e,t){var n;return null!=e&&"object"===y(e)&&"type"in e&&(e.type.displayName===t||p.default(e.type)&&"render"in e.type&&(null===(n=e.type.render)||void 0===n?void 0:n.displayName)===t)}var k=["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"],E={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:k,type:{name:"string"},control:{type:"select"},defaultValue:"button"}};e.AriaCurrentValue={Page:"page",Step:"step",Location:"location",Date:"date",Time:"time",True:"true",Unset:"false"},e.IntrinsicElements=k,e.StoryMeta=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l.mergeWith(e,{},(function(e,t){return Array.isArray(e)?e.concat(t):"string"==typeof e?e:void 0}))},e.Theme=S,e.allEqual=function(e){return 1==new Set(e).size},e.consoleOnce=A,e.createDataProp=function(e){var t="data-leafygreen-ui";return{prop:b({},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=w.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(w.has(e)){var n=w.get(e);w.set(e,[t].concat(h(n)))}else w.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"===y(e)&&e.props}(t)?e(t.props.children):"";var n},e.getTheme=function(e){return e?S.Dark:S.Light},e.isComponentType=T,e.keyMap={ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Backspace:"Backspace",BracketLeft:"[",Delete:"Delete",Enter:"Enter",Escape:"Escape",Space:" ",Tab:"Tab"},e.pickAndOmit=function(e,t){return[s.default(e,t),u.default(e,t)]},e.storybookArgTypes=E,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=C,e.validateChildren=function(e,t){var n,r=null===(n=m.default.Children.map(e,(function(e){if(t.some((function(t){return T(e,t)})))return e})))||void 0===n?void 0:n.filter((function(e){return!f.default(e)}));return f.default(e)||(null==r?void 0:r.length)===m.default.Children.count(e)||A.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/once"),require("lodash/isNull"),require("lodash/isUndefined"),require("lodash/omit"),require("lodash/pick"),require("lodash/isObject"),require("react"),require("lodash")):"function"==typeof define&&define.amd?define(["exports","lodash/once","lodash/isNull","lodash/isUndefined","lodash/omit","lodash/pick","lodash/isObject","react","lodash"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/lib"]={},e["/once"],e["/isNull"],e["/isUndefined"],e["/omit"],e["/pick"],e["/isObject"],e.react,e.lodash)}(this,(function(e,t,n,r,o,i,a,l,c){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=u(t),d=u(n),f=u(r),p=u(o),b=u(i),y=u(a),m=u(l);function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function v(e){return v="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},v(e)}function w(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 C(e){return function(e){if(Array.isArray(e))return S(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 S(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 S(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 S(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 O(e){return null!=e&&e.nodeType===Node.ELEMENT_NODE}var j=Object.freeze({__proto__:null,array:function(e){return null!=e&&e instanceof Array},button:function(e){return O(e)&&"button"===e.tagName.toLowerCase()},element:O,input:function(e){return O(e)&&"input"===e.tagName.toLowerCase()}}),A=new Map;var P={Light:"light",Dark:"dark"};var k={error:s.default(console.error),warn:s.default(console.warn),log:s.default(console.log)},T=function(e){return!f.default(e)&&!d.default(e)},E=function(e){return!T(e)||["","0","00",0].includes(e)},D={length:30};function N(e,t){var n;return null!=e&&"object"===v(e)&&"type"in e&&(e.type.displayName===t||y.default(e.type)&&"render"in e.type&&(null===(n=e.type.render)||void 0===n?void 0:n.displayName)===t)}var L=["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"],q={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:L,type:{name:"string"},control:{type:"select"},defaultValue:"button"}};e.AriaCurrentValue={Page:"page",Step:"step",Location:"location",Date:"date",Time:"time",True:"true",Unset:"false"},e.IntrinsicElements=L,e.StoryMeta=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return c.mergeWith(e,{},(function(e,t){return Array.isArray(e)?e.concat(t):"string"==typeof e?e:void 0}))},e.Theme=P,e.allEqual=function(e){return 1==new Set(e).size},e.cloneReverse=function(e){if(e&&Array.isArray(e)){var t=C(e);return t.reverse(),t}},e.consoleOnce=k,e.createDataProp=function(e){var t="data-leafygreen-ui";return{prop:w({},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 g(g({nativeEvent:e},e),{},{currentTarget:e.currentTarget,target:e.target,bubbles:e.bubbles,cancelable:e.cancelable,defaultPrevented:e.defaultPrevented,eventPhase:e.eventPhase,isTrusted:e.isTrusted,timeStamp:e.timeStamp,type:e.type,preventDefault:function(){n=!0,e.preventDefault()},isDefaultPrevented:function(){return n},stopPropagation:function(){r=!0,e.stopPropagation()},isPropagationStopped:function(){return r},persist:function(){}})},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=A.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(A.has(e)){var n=A.get(e);A.set(e,[t].concat(C(n)))}else A.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"===v(e)&&e.props}(t)?e(t.props.children):"";var n},e.getTheme=function(e){return e?P.Dark:P.Light},e.isComponentType=N,e.isDefined=T,e.isNotZeroLike=function(e){return!E(e)},e.isZeroLike=E,e.keyMap={ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Backspace:"Backspace",BracketLeft:"[",Delete:"Delete",Enter:"Enter",Escape:"Escape",Space:" ",Tab:"Tab"},e.pickAndOmit=function(e,t){return[b.default(e,t),p.default(e,t)]},e.rollover=function(e,t,n){var r=n-t;return e>n?t+(e-n-1)%r:e<t?n-(t-e-1)%r:e},e.storybookArgTypes=q,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.truncateStart=function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:D).length;return e.length<=t?e:e.substring(e.length-t)},e.typeIs=j,e.validateChildren=function(e,t){var n,r=null===(n=m.default.Children.map(e,(function(e){if(t.some((function(t){return N(e,t)})))return e})))||void 0===n?void 0:n.filter((function(e){return!f.default(e)}));return f.default(e)||(null==r?void 0:r.length)===m.default.Children.count(e)||k.error("Children must be one of: ".concat(t.join(", ")),"Received children: ",e),r}})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@leafygreen-ui/lib", | ||
"version": "13.1.0", | ||
"version": "13.2.0", | ||
"description": "leafyGreen UI Kit Internal Library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -0,1 +1,3 @@ | ||
import React from 'react'; | ||
/** | ||
@@ -6,6 +8,10 @@ * Creates a React SyntheticEvent based on the provided native event and target. | ||
*/ | ||
export const createSyntheticEvent = <T extends Element, E extends Event>( | ||
event: E, | ||
target: T, | ||
): React.SyntheticEvent<T, E> => { | ||
export const createSyntheticEvent = < | ||
ReactEventType extends React.SyntheticEvent<TargetType, NativeEventType>, | ||
TargetType extends Element | EventTarget = Element, | ||
NativeEventType extends Event = Event, | ||
>( | ||
event: NativeEventType, | ||
target: TargetType, | ||
): ReactEventType => { | ||
// Assign the target property to the event | ||
@@ -27,6 +33,7 @@ Object.defineProperty(event, 'target', { writable: false, value: target }); | ||
return { | ||
const syntheticEvent = { | ||
nativeEvent: event, | ||
currentTarget: event.currentTarget as EventTarget & T, | ||
target: event.target as EventTarget & T, | ||
...event, | ||
currentTarget: event.currentTarget as EventTarget & TargetType, | ||
target: event.target as EventTarget & TargetType, | ||
bubbles: event.bubbles, | ||
@@ -37,2 +44,4 @@ cancelable: event.cancelable, | ||
isTrusted: event.isTrusted, | ||
timeStamp: event.timeStamp, | ||
type: event.type, | ||
preventDefault, | ||
@@ -43,5 +52,5 @@ isDefaultPrevented: () => isDefaultPrevented, | ||
persist: () => {}, | ||
timeStamp: event.timeStamp, | ||
type: event.type, | ||
}; | ||
return syntheticEvent as unknown as ReactEventType; | ||
}; |
@@ -0,3 +1,8 @@ | ||
export { allEqual } from './allEqual'; | ||
export { cloneReverse } from './cloneReverse'; | ||
export { consoleOnce } from './consoleOnce'; | ||
export { isDefined } from './isDefined'; | ||
export { isNotZeroLike, isZeroLike } from './isZeroLike'; | ||
export { pickAndOmit } from './pickAndOmit'; | ||
export { consoleOnce } from './consoleOnce'; | ||
export { allEqual } from './allEqual'; | ||
export { rollover } from './rollover'; | ||
export { truncateStart } from './truncateStart'; |
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
395603
96
8259