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

@blueprintjs/timezone

Package Overview
Dependencies
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blueprintjs/timezone - npm Package Compare versions

Comparing version 3.6.6 to 3.6.7

2

dist/timezone.bundle.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("moment-timezone"),require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames"),require("@blueprintjs/select")):"function"==typeof define&&define.amd?define(["moment-timezone","@blueprintjs/core","tslib","react","classnames","@blueprintjs/select"],t):"object"==typeof exports?exports.Timezone=t(require("moment-timezone"),require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames"),require("@blueprintjs/select")):(e.Blueprint=e.Blueprint||{},e.Blueprint.Timezone=t(e.moment,e.Blueprint.Core,e.window,e.React,e.classNames,e.Blueprint.Select))}(window,(function(e,t,n,o,r,i){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=r},function(e,t){e.exports=i},function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";n.r(t),n.d(t,"Classes",(function(){return a})),n.d(t,"getTimezoneMetadata",(function(){return u})),n.d(t,"TimezoneDisplayFormat",(function(){return S})),n.d(t,"TimezonePicker",(function(){return E}));var o={};n.r(o),n.d(o,"TIMEZONE_PICKER",(function(){return i})),n.d(o,"TIMEZONE_PICKER_POPOVER",(function(){return s}));var r=n(1),i=r.Classes.getClassNamespace()+"-timezone-picker",s=i+"-popover",a=o,l=n(0),c=/^[^-+]/;function u(e,t){void 0===t&&(t=new Date);var n=t.getTime(),o=l.tz.zone(e),r=l.tz(n,e),i=r.utcOffset(),s=r.format("Z"),a=o.abbr(n);return{abbreviation:c.test(a)?a:void 0,offset:i,offsetAsString:s,population:o.population,timezone:e}}var p=n(2),f=n(4),m=n.n(f),d=n(3);function h(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function v(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function y(e,t){try{var n=this.props,o=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,o)}finally{this.props=n,this.state=o}}function b(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,o=null,r=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?o="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(o="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?r="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(r="UNSAFE_componentWillUpdate"),null!==n||null!==o||null!==r){var i=e.displayName||e.name,s="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+i+" uses "+s+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==o?"\n "+o:"")+(null!==r?"\n "+r:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=h,t.componentWillReceiveProps=v),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=y;var a=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var o=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;a.call(this,e,t,o)}}return e}h.__suppressDeprecationWarning=!0,v.__suppressDeprecationWarning=!0,y.__suppressDeprecationWarning=!0;var g=n(5),S={ABBREVIATION:"abbreviation",COMPOSITE:"composite",NAME:"name",OFFSET:"offset"};function _(e,t){var n=function(e){var t=l.tz.names().filter((function(e){return/\//.test(e)&&!/Etc\//.test(e)})),n=t.reduce((function(t,n){return t[n]=u(n,e),t}),{}),o=t.reduce((function(e,t){var o=n[t],r=e[o.offsetAsString];return(null==r||o.population>n[r].population)&&(e[o.offsetAsString]=t),e}),{});return Object.keys(o).map((function(e){return n[o[e]]})).sort((function(e,t){return e.offset-t.offset})).map(P)}(e),o=function(e){var t=l.tz.guess();if(void 0!==t){var n=e.getTime(),o=l.tz(n,t).format("Z");return{iconName:"locate",key:t+"-local",label:o,text:"Current timezone",timezone:t}}return}(e);return t&&void 0!==o?Object(p.__spreadArrays)([o],n):n}function P(e){var t=e.abbreviation,n=e.offsetAsString,o=e.timezone;return{key:o,label:n,text:o+(t?" ("+t+")":""),timezone:o}}var z=g.Select.ofType(),E=function(e){function t(t,n){var o=e.call(this,t,n)||this;o.filterItems=function(e,t){var n=new RegExp(e.replace(/([[()+*?])/g,"\\$1").replace(" ","[ _/\\(\\)]+"),"i");return t.filter((function(e){return n.test(e.text+e.label)}))},o.renderItem=function(e,t){var n=t.handleClick,o=t.modifiers;return o.matchesPredicate?d.createElement(r.MenuItem,{key:e.key,active:o.active,icon:e.iconName,text:e.text,label:e.label,onClick:n,shouldDismissPopover:!1}):null},o.handleItemSelect=function(e){return r.Utils.safeInvoke(o.props.onChange,e.timezone)},o.handleQueryChange=function(e){return o.setState({query:e})};var i=t.date,s=void 0===i?new Date:i,a=t.showLocalTimezone,c=t.inputProps,p=void 0===c?{}:c;return o.state={query:p.value||""},o.timezoneItems=function(e){return l.tz.names().map((function(t){return u(t,e)})).sort((function(e,t){return e.offset-t.offset})).map(P)}(s),o.initialTimezoneItems=_(s,a),o}return Object(p.__extends)(t,e),t.prototype.render=function(){var e=this.props,t=e.children,n=e.className,o=e.disabled,a=e.inputProps,l=e.popoverProps,c=this.state.query,u=Object(p.__assign)({placeholder:"Search for timezones..."},a),f=Object(p.__assign)(Object(p.__assign)({},l),{popoverClassName:m()(s,l.popoverClassName)});return d.createElement(z,{className:m()(i,n),items:c?this.timezoneItems:this.initialTimezoneItems,itemListPredicate:this.filterItems,itemRenderer:this.renderItem,noResults:d.createElement(r.MenuItem,{disabled:!0,text:"No matching timezones."}),onItemSelect:this.handleItemSelect,resetOnSelect:!0,resetOnClose:!0,popoverProps:f,inputProps:u,disabled:o,onQueryChange:this.handleQueryChange},null!=t?t:this.renderButton())},t.prototype.componentDidUpdate=function(t,n,o){e.prototype.componentDidUpdate.call(this,t,n,o);var r=this.props,i=r.date,s=void 0===i?new Date:i,a=r.inputProps,l=void 0===a?{}:a;this.props.showLocalTimezone!==t.showLocalTimezone&&(this.initialTimezoneItems=_(s,this.props.showLocalTimezone)),void 0!==l.value&&this.state.query!==l.value&&this.setState({query:l.value})},t.prototype.validateProps=function(e){d.Children.count(e.children)>1&&console.warn("[Blueprint] <TimezonePicker> supports up to one child; additional children are ignored. If a child is present, it it will be rendered in place of the default button target.")},t.prototype.renderButton=function(){var e=this.props,t=e.buttonProps,n=void 0===t?{}:t,o=e.date,i=e.disabled,s=e.placeholder,a=e.value,c=e.valueDisplayFormat,f=a?function(e,t,n){if(e&&l.tz.zone(e)){var o=u(e,t),r=o.abbreviation,i=o.offsetAsString;switch(n){case S.ABBREVIATION:return void 0!==r?r:i;case S.NAME:return e;case S.OFFSET:return i;case S.COMPOSITE:return e+(r?" ("+r+")":"")+" "+i}}}(a,o,c):d.createElement("span",{className:r.Classes.TEXT_MUTED},s);return d.createElement(r.Button,Object(p.__assign)({rightIcon:"caret-down",disabled:i,text:f},n))},t.displayName=r.DISPLAYNAME_PREFIX+".TimezonePicker",t.defaultProps={date:new Date,disabled:!1,inputProps:{},placeholder:"Select timezone...",popoverProps:{},showLocalTimezone:!0,valueDisplayFormat:S.OFFSET},t=Object(p.__decorate)([b],t)}(r.AbstractPureComponent2)}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("moment-timezone"),require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames"),require("@blueprintjs/select")):"function"==typeof define&&define.amd?define(["moment-timezone","@blueprintjs/core","tslib","react","classnames","@blueprintjs/select"],t):"object"==typeof exports?exports.Timezone=t(require("moment-timezone"),require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames"),require("@blueprintjs/select")):(e.Blueprint=e.Blueprint||{},e.Blueprint.Timezone=t(e.moment,e.Blueprint.Core,e.window,e.React,e.classNames,e.Blueprint.Select))}(window,(function(e,t,n,o,r,i){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=r},function(e,t){e.exports=i},function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";n.r(t),n.d(t,"Classes",(function(){return a})),n.d(t,"getTimezoneMetadata",(function(){return u})),n.d(t,"TimezoneDisplayFormat",(function(){return S})),n.d(t,"TimezonePicker",(function(){return E}));var o={};n.r(o),n.d(o,"TIMEZONE_PICKER",(function(){return i})),n.d(o,"TIMEZONE_PICKER_POPOVER",(function(){return s}));var r=n(1),i=r.Classes.getClassNamespace()+"-timezone-picker",s=i+"-popover",a=o,l=n(0),c=/^[^-+]/;function u(e,t){void 0===t&&(t=new Date);var n=t.getTime(),o=l.tz.zone(e),r=l.tz(n,e),i=r.utcOffset(),s=r.format("Z"),a=o.abbr(n);return{abbreviation:c.test(a)?a:void 0,offset:i,offsetAsString:s,population:o.population,timezone:e}}var p=n(2),f=n(4),m=n.n(f),d=n(3);function h(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function v(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function y(e,t){try{var n=this.props,o=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,o)}finally{this.props=n,this.state=o}}function b(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,o=null,r=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?o="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(o="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?r="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(r="UNSAFE_componentWillUpdate"),null!==n||null!==o||null!==r){var i=e.displayName||e.name,s="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+i+" uses "+s+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==o?"\n "+o:"")+(null!==r?"\n "+r:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=h,t.componentWillReceiveProps=v),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=y;var a=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var o=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;a.call(this,e,t,o)}}return e}h.__suppressDeprecationWarning=!0,v.__suppressDeprecationWarning=!0,y.__suppressDeprecationWarning=!0;var g=n(5),S={ABBREVIATION:"abbreviation",COMPOSITE:"composite",NAME:"name",OFFSET:"offset"};function _(e,t){var n=function(e){var t=l.tz.names().filter((function(e){return/\//.test(e)&&!/Etc\//.test(e)})),n=t.reduce((function(t,n){return t[n]=u(n,e),t}),{}),o=t.reduce((function(e,t){var o=n[t],r=e[o.offsetAsString];return(null==r||o.population>n[r].population)&&(e[o.offsetAsString]=t),e}),{});return Object.keys(o).map((function(e){return n[o[e]]})).sort((function(e,t){return e.offset-t.offset})).map(P)}(e),o=function(e){var t=l.tz.guess();if(void 0!==t){var n=e.getTime(),o=l.tz(n,t).format("Z");return{iconName:"locate",key:t+"-local",label:o,text:"Current timezone",timezone:t}}return}(e);return t&&void 0!==o?Object(p.__spreadArrays)([o],n):n}function P(e){var t=e.abbreviation,n=e.offsetAsString,o=e.timezone;return{key:o,label:n,text:o+(t?" ("+t+")":""),timezone:o}}var z=g.Select.ofType(),E=function(e){function t(t,n){var o=e.call(this,t,n)||this;o.filterItems=function(e,t){var n=new RegExp(e.replace(/([[()+*?])/g,"\\$1").replace(" ","[ _/\\(\\)]+"),"i");return t.filter((function(e){return n.test(e.text+e.label)}))},o.renderItem=function(e,t){var n=t.handleClick,o=t.modifiers;return o.matchesPredicate?d.createElement(r.MenuItem,{key:e.key,active:o.active,icon:e.iconName,text:e.text,label:e.label,onClick:n,shouldDismissPopover:!1}):null},o.handleItemSelect=function(e){return r.Utils.safeInvoke(o.props.onChange,e.timezone)},o.handleQueryChange=function(e){return o.setState({query:e})};var i=t.date,s=void 0===i?new Date:i,a=t.showLocalTimezone,c=t.inputProps,p=void 0===c?{}:c;return o.state={query:p.value||""},o.timezoneItems=function(e){return l.tz.names().map((function(t){return u(t,e)})).sort((function(e,t){return e.offset-t.offset})).map(P)}(s),o.initialTimezoneItems=_(s,a),o}return Object(p.__extends)(t,e),t.prototype.render=function(){var e=this.props,t=e.children,n=e.className,o=e.disabled,a=e.inputProps,l=e.popoverProps,c=this.state.query,u=Object(p.__assign)({placeholder:"Search for timezones..."},a),f=Object(p.__assign)(Object(p.__assign)({},l),{popoverClassName:m()(s,l.popoverClassName)});return d.createElement(z,{className:m()(i,n),items:c?this.timezoneItems:this.initialTimezoneItems,itemListPredicate:this.filterItems,itemRenderer:this.renderItem,noResults:d.createElement(r.MenuItem,{disabled:!0,text:"No matching timezones."}),onItemSelect:this.handleItemSelect,resetOnSelect:!0,resetOnClose:!0,popoverProps:f,inputProps:u,disabled:o,onQueryChange:this.handleQueryChange},null!=t?t:this.renderButton())},t.prototype.componentDidUpdate=function(t,n){e.prototype.componentDidUpdate.call(this,t,n);var o=this.props,r=o.date,i=void 0===r?new Date:r,s=o.inputProps,a=void 0===s?{}:s;this.props.showLocalTimezone!==t.showLocalTimezone&&(this.initialTimezoneItems=_(i,this.props.showLocalTimezone)),void 0!==a.value&&this.state.query!==a.value&&this.setState({query:a.value})},t.prototype.validateProps=function(e){d.Children.count(e.children)>1&&console.warn("[Blueprint] <TimezonePicker> supports up to one child; additional children are ignored. If a child is present, it it will be rendered in place of the default button target.")},t.prototype.renderButton=function(){var e=this.props,t=e.buttonProps,n=void 0===t?{}:t,o=e.date,i=e.disabled,s=e.placeholder,a=e.value,c=e.valueDisplayFormat,f=a?function(e,t,n){if(e&&l.tz.zone(e)){var o=u(e,t),r=o.abbreviation,i=o.offsetAsString;switch(n){case S.ABBREVIATION:return void 0!==r?r:i;case S.NAME:return e;case S.OFFSET:return i;case S.COMPOSITE:return e+(r?" ("+r+")":"")+" "+i}}}(a,o,c):d.createElement("span",{className:r.Classes.TEXT_MUTED},s);return d.createElement(r.Button,Object(p.__assign)({rightIcon:"caret-down",disabled:i,text:f},n))},t.displayName=r.DISPLAYNAME_PREFIX+".TimezonePicker",t.defaultProps={date:new Date,disabled:!1,inputProps:{},placeholder:"Select timezone...",popoverProps:{},showLocalTimezone:!0,valueDisplayFormat:S.OFFSET},t=Object(p.__decorate)([b],t)}(r.AbstractPureComponent2)}])}));

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TIMEZONE_PICKER_POPOVER = exports.TIMEZONE_PICKER = void 0;
var core_1 = require("@blueprintjs/core");

@@ -20,0 +21,0 @@ var NS = core_1.Classes.getClassNamespace();

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TIMEZONE_PICKER_WARN_TOO_MANY_CHILDREN = void 0;
var ns = "[Blueprint]";

@@ -20,0 +21,0 @@ exports.TIMEZONE_PICKER_WARN_TOO_MANY_CHILDREN = ns +

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Classes = void 0;
var tslib_1 = require("tslib");

@@ -20,0 +21,0 @@ var classes = tslib_1.__importStar(require("../common/classes"));

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.formatTimezone = exports.TimezoneDisplayFormat = void 0;
var tslib_1 = require("tslib");

@@ -20,0 +21,0 @@ var moment = tslib_1.__importStar(require("moment-timezone"));

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getLocalTimezoneItem = exports.getInitialTimezoneItems = exports.getTimezoneItems = void 0;
var tslib_1 = require("tslib");

@@ -20,0 +21,0 @@ var moment = tslib_1.__importStar(require("moment-timezone"));

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getTimezoneMetadata = void 0;
var tslib_1 = require("tslib");

@@ -20,0 +21,0 @@ var moment = tslib_1.__importStar(require("moment-timezone"));

@@ -69,3 +69,3 @@ import * as React from "react";

render(): JSX.Element;
componentDidUpdate(prevProps: ITimezonePickerProps, prevState: ITimezonePickerState, snapshot?: {}): void;
componentDidUpdate(prevProps: ITimezonePickerProps, prevState: ITimezonePickerState): void;
protected validateProps(props: IPopoverProps & {

@@ -72,0 +72,0 @@ children?: React.ReactNode;

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TimezonePicker = exports.TimezoneDisplayFormat = void 0;
var tslib_1 = require("tslib");

@@ -28,3 +29,3 @@ var classnames_1 = tslib_1.__importDefault(require("classnames"));

var timezoneDisplayFormat_1 = require("./timezoneDisplayFormat");
exports.TimezoneDisplayFormat = timezoneDisplayFormat_1.TimezoneDisplayFormat;
Object.defineProperty(exports, "TimezoneDisplayFormat", { enumerable: true, get: function () { return timezoneDisplayFormat_1.TimezoneDisplayFormat; } });
var timezoneItems_1 = require("./timezoneItems");

@@ -64,4 +65,4 @@ var TypedSelect = select_1.Select.ofType();

};
TimezonePicker.prototype.componentDidUpdate = function (prevProps, prevState, snapshot) {
_super.prototype.componentDidUpdate.call(this, prevProps, prevState, snapshot);
TimezonePicker.prototype.componentDidUpdate = function (prevProps, prevState) {
_super.prototype.componentDidUpdate.call(this, prevProps, prevState);
var _a = this.props, _b = _a.date, nextDate = _b === void 0 ? new Date() : _b, _c = _a.inputProps, nextInputProps = _c === void 0 ? {} : _c;

@@ -68,0 +69,0 @@ if (this.props.showLocalTimezone !== prevProps.showLocalTimezone) {

@@ -69,3 +69,3 @@ import * as React from "react";

render(): JSX.Element;
componentDidUpdate(prevProps: ITimezonePickerProps, prevState: ITimezonePickerState, snapshot?: {}): void;
componentDidUpdate(prevProps: ITimezonePickerProps, prevState: ITimezonePickerState): void;
protected validateProps(props: IPopoverProps & {

@@ -72,0 +72,0 @@ children?: React.ReactNode;

@@ -60,4 +60,4 @@ /*

};
TimezonePicker.prototype.componentDidUpdate = function (prevProps, prevState, snapshot) {
_super.prototype.componentDidUpdate.call(this, prevProps, prevState, snapshot);
TimezonePicker.prototype.componentDidUpdate = function (prevProps, prevState) {
_super.prototype.componentDidUpdate.call(this, prevProps, prevState);
var _a = this.props, _b = _a.date, nextDate = _b === void 0 ? new Date() : _b, _c = _a.inputProps, nextInputProps = _c === void 0 ? {} : _c;

@@ -64,0 +64,0 @@ if (this.props.showLocalTimezone !== prevProps.showLocalTimezone) {

@@ -69,3 +69,3 @@ import * as React from "react";

render(): JSX.Element;
componentDidUpdate(prevProps: ITimezonePickerProps, prevState: ITimezonePickerState, snapshot?: {}): void;
componentDidUpdate(prevProps: ITimezonePickerProps, prevState: ITimezonePickerState): void;
protected validateProps(props: IPopoverProps & {

@@ -72,0 +72,0 @@ children?: React.ReactNode;

@@ -28,73 +28,76 @@ /*

const TypedSelect = Select.ofType();
let TimezonePicker = class TimezonePicker extends AbstractPureComponent2 {
constructor(props, context) {
super(props, context);
this.filterItems = (query, items) => {
// using list predicate so only one RegExp instance is needed
// escape bad regex characters, let spaces act as any separator
const expr = new RegExp(query.replace(/([[()+*?])/g, "\\$1").replace(" ", "[ _/\\(\\)]+"), "i");
return items.filter(item => expr.test(item.text + item.label));
};
this.renderItem = (item, { handleClick, modifiers }) => {
if (!modifiers.matchesPredicate) {
return null;
let TimezonePicker = /** @class */ (() => {
let TimezonePicker = class TimezonePicker extends AbstractPureComponent2 {
constructor(props, context) {
super(props, context);
this.filterItems = (query, items) => {
// using list predicate so only one RegExp instance is needed
// escape bad regex characters, let spaces act as any separator
const expr = new RegExp(query.replace(/([[()+*?])/g, "\\$1").replace(" ", "[ _/\\(\\)]+"), "i");
return items.filter(item => expr.test(item.text + item.label));
};
this.renderItem = (item, { handleClick, modifiers }) => {
if (!modifiers.matchesPredicate) {
return null;
}
return (React.createElement(MenuItem, { key: item.key, active: modifiers.active, icon: item.iconName, text: item.text, label: item.label, onClick: handleClick, shouldDismissPopover: false }));
};
this.handleItemSelect = (timezone) => Utils.safeInvoke(this.props.onChange, timezone.timezone);
this.handleQueryChange = (query) => this.setState({ query });
const { date = new Date(), showLocalTimezone, inputProps = {} } = props;
this.state = { query: inputProps.value || "" };
this.timezoneItems = getTimezoneItems(date);
this.initialTimezoneItems = getInitialTimezoneItems(date, showLocalTimezone);
}
render() {
const { children, className, disabled, inputProps, popoverProps } = this.props;
const { query } = this.state;
const finalInputProps = {
placeholder: "Search for timezones...",
...inputProps,
};
const finalPopoverProps = {
...popoverProps,
popoverClassName: classNames(Classes.TIMEZONE_PICKER_POPOVER, popoverProps.popoverClassName),
};
return (React.createElement(TypedSelect, { className: classNames(Classes.TIMEZONE_PICKER, className), items: query ? this.timezoneItems : this.initialTimezoneItems, itemListPredicate: this.filterItems, itemRenderer: this.renderItem, noResults: React.createElement(MenuItem, { disabled: true, text: "No matching timezones." }), onItemSelect: this.handleItemSelect, resetOnSelect: true, resetOnClose: true, popoverProps: finalPopoverProps, inputProps: finalInputProps, disabled: disabled, onQueryChange: this.handleQueryChange }, children != null ? children : this.renderButton()));
}
componentDidUpdate(prevProps, prevState) {
super.componentDidUpdate(prevProps, prevState);
const { date: nextDate = new Date(), inputProps: nextInputProps = {} } = this.props;
if (this.props.showLocalTimezone !== prevProps.showLocalTimezone) {
this.initialTimezoneItems = getInitialTimezoneItems(nextDate, this.props.showLocalTimezone);
}
return (React.createElement(MenuItem, { key: item.key, active: modifiers.active, icon: item.iconName, text: item.text, label: item.label, onClick: handleClick, shouldDismissPopover: false }));
};
this.handleItemSelect = (timezone) => Utils.safeInvoke(this.props.onChange, timezone.timezone);
this.handleQueryChange = (query) => this.setState({ query });
const { date = new Date(), showLocalTimezone, inputProps = {} } = props;
this.state = { query: inputProps.value || "" };
this.timezoneItems = getTimezoneItems(date);
this.initialTimezoneItems = getInitialTimezoneItems(date, showLocalTimezone);
}
render() {
const { children, className, disabled, inputProps, popoverProps } = this.props;
const { query } = this.state;
const finalInputProps = {
placeholder: "Search for timezones...",
...inputProps,
};
const finalPopoverProps = {
...popoverProps,
popoverClassName: classNames(Classes.TIMEZONE_PICKER_POPOVER, popoverProps.popoverClassName),
};
return (React.createElement(TypedSelect, { className: classNames(Classes.TIMEZONE_PICKER, className), items: query ? this.timezoneItems : this.initialTimezoneItems, itemListPredicate: this.filterItems, itemRenderer: this.renderItem, noResults: React.createElement(MenuItem, { disabled: true, text: "No matching timezones." }), onItemSelect: this.handleItemSelect, resetOnSelect: true, resetOnClose: true, popoverProps: finalPopoverProps, inputProps: finalInputProps, disabled: disabled, onQueryChange: this.handleQueryChange }, children != null ? children : this.renderButton()));
}
componentDidUpdate(prevProps, prevState, snapshot) {
super.componentDidUpdate(prevProps, prevState, snapshot);
const { date: nextDate = new Date(), inputProps: nextInputProps = {} } = this.props;
if (this.props.showLocalTimezone !== prevProps.showLocalTimezone) {
this.initialTimezoneItems = getInitialTimezoneItems(nextDate, this.props.showLocalTimezone);
if (nextInputProps.value !== undefined && this.state.query !== nextInputProps.value) {
this.setState({ query: nextInputProps.value });
}
}
if (nextInputProps.value !== undefined && this.state.query !== nextInputProps.value) {
this.setState({ query: nextInputProps.value });
validateProps(props) {
const childrenCount = React.Children.count(props.children);
if (childrenCount > 1) {
console.warn(Errors.TIMEZONE_PICKER_WARN_TOO_MANY_CHILDREN);
}
}
}
validateProps(props) {
const childrenCount = React.Children.count(props.children);
if (childrenCount > 1) {
console.warn(Errors.TIMEZONE_PICKER_WARN_TOO_MANY_CHILDREN);
renderButton() {
const { buttonProps = {}, date, disabled, placeholder, value, valueDisplayFormat } = this.props;
const buttonContent = value ? (formatTimezone(value, date, valueDisplayFormat)) : (React.createElement("span", { className: CoreClasses.TEXT_MUTED }, placeholder));
return React.createElement(Button, Object.assign({ rightIcon: "caret-down", disabled: disabled, text: buttonContent }, buttonProps));
}
}
renderButton() {
const { buttonProps = {}, date, disabled, placeholder, value, valueDisplayFormat } = this.props;
const buttonContent = value ? (formatTimezone(value, date, valueDisplayFormat)) : (React.createElement("span", { className: CoreClasses.TEXT_MUTED }, placeholder));
return React.createElement(Button, Object.assign({ rightIcon: "caret-down", disabled: disabled, text: buttonContent }, buttonProps));
}
};
TimezonePicker.displayName = `${DISPLAYNAME_PREFIX}.TimezonePicker`;
TimezonePicker.defaultProps = {
date: new Date(),
disabled: false,
inputProps: {},
placeholder: "Select timezone...",
popoverProps: {},
showLocalTimezone: true,
valueDisplayFormat: TimezoneDisplayFormat.OFFSET,
};
TimezonePicker = __decorate([
polyfill
], TimezonePicker);
};
TimezonePicker.displayName = `${DISPLAYNAME_PREFIX}.TimezonePicker`;
TimezonePicker.defaultProps = {
date: new Date(),
disabled: false,
inputProps: {},
placeholder: "Select timezone...",
popoverProps: {},
showLocalTimezone: true,
valueDisplayFormat: TimezoneDisplayFormat.OFFSET,
};
TimezonePicker = __decorate([
polyfill
], TimezonePicker);
return TimezonePicker;
})();
export { TimezonePicker };
//# sourceMappingURL=timezonePicker.js.map
{
"name": "@blueprintjs/timezone",
"version": "3.6.6",
"description": "Components related to timezone selection and UI",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"esnext": "lib/esnext/index.js",
"typings": "lib/esm/index.d.ts",
"style": "lib/css/blueprint-timezone.css",
"unpkg": "dist/timezone.bundle.js",
"sideEffects": [
"*.css"
],
"scripts": {
"clean": "rm -rf dist/* && rm -rf lib/*",
"compile": "run-p \"compile:*\"",
"compile:esm": "tsc -p ./src",
"compile:cjs": "tsc -p ./src -m commonjs --outDir lib/cjs",
"compile:esnext": "tsc -p ./src -t esnext --outDir lib/esnext",
"compile:css": "sass-compile ./src",
"dev": "run-p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
"dist": "run-s \"dist:*\"",
"dist:bundle": "cross-env NODE_ENV=production webpack",
"dist:css": "css-dist lib/css/*.css",
"dist:verify": "assert-package-layout",
"lint": "run-p lint:scss lint:es",
"lint:scss": "sass-lint",
"lint:es": "es-lint",
"lint-fix": "es-lint --fix && sass-lint --fix",
"test": "run-s test:typeCheck test:iso test:karma",
"test:typeCheck": "tsc -p ./test",
"test:iso": "mocha test/isotest.js",
"test:karma": "karma start",
"test:karma:debug": "karma start --single-run=false --reporters=mocha --debug",
"verify": "npm-run-all compile -p dist test lint"
},
"dependencies": {
"@blueprintjs/core": "^3.28.1",
"@blueprintjs/select": "^3.13.2",
"classnames": "^2.2",
"moment": "^2.24.0",
"moment-timezone": "^0.5.27",
"tslib": "~1.10.0"
},
"peerDependencies": {
"react": "^15.3.0 || 16",
"react-dom": "^15.3.0 || 16"
},
"devDependencies": {
"@blueprintjs/node-build-scripts": "^1.3.1",
"@blueprintjs/test-commons": "^0.10.3",
"@types/moment-timezone": "^0.5.12",
"enzyme": "^3.11.0",
"karma": "^5.0.2",
"npm-run-all": "^4.1.5",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-test-renderer": "^16.8.6",
"typescript": "~3.8.3",
"webpack-cli": "^3.3.11"
},
"repository": {
"type": "git",
"url": "git@github.com:palantir/blueprint.git",
"directory": "packages/timezone"
},
"keywords": [
"palantir",
"blueprint",
"react",
"timezone",
"time",
"select"
],
"author": "Palantir Technologies",
"license": "Apache-2.0"
"name": "@blueprintjs/timezone",
"version": "3.6.7",
"description": "Components related to timezone selection and UI",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"esnext": "lib/esnext/index.js",
"typings": "lib/esm/index.d.ts",
"style": "lib/css/blueprint-timezone.css",
"unpkg": "dist/timezone.bundle.js",
"sideEffects": [
"*.css"
],
"scripts": {
"clean": "rm -rf dist/* && rm -rf lib/*",
"compile": "run-p \"compile:*\"",
"compile:esm": "tsc -p ./src",
"compile:cjs": "tsc -p ./src -m commonjs --outDir lib/cjs",
"compile:esnext": "tsc -p ./src -t esnext --outDir lib/esnext",
"compile:css": "sass-compile ./src",
"dev": "run-p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
"dist": "run-s \"dist:*\"",
"dist:bundle": "cross-env NODE_ENV=production webpack",
"dist:css": "css-dist lib/css/*.css",
"dist:verify": "assert-package-layout",
"lint": "run-p lint:scss lint:es",
"lint:scss": "sass-lint",
"lint:es": "es-lint",
"lint-fix": "es-lint --fix && sass-lint --fix",
"test": "run-s test:typeCheck test:iso test:karma",
"test:typeCheck": "tsc -p ./test",
"test:iso": "mocha test/isotest.js",
"test:karma": "karma start",
"test:karma:debug": "karma start --single-run=false --reporters=mocha --debug",
"verify": "npm-run-all compile -p dist test lint"
},
"dependencies": {
"@blueprintjs/core": "^3.28.2",
"@blueprintjs/select": "^3.13.3",
"classnames": "^2.2",
"moment": "^2.26.0",
"moment-timezone": "^0.5.31",
"react-lifecycles-compat": "^3.0.4",
"tslib": "~1.10.0"
},
"peerDependencies": {
"react": "^15.3.0 || 16",
"react-dom": "^15.3.0 || 16"
},
"devDependencies": {
"@blueprintjs/node-build-scripts": "^1.3.2",
"@blueprintjs/test-commons": "^0.10.4",
"enzyme": "^3.11.0",
"karma": "^5.0.9",
"npm-run-all": "^4.1.5",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-test-renderer": "^16.8.6",
"typescript": "~3.9.3",
"webpack-cli": "^3.3.11"
},
"repository": {
"type": "git",
"url": "git@github.com:palantir/blueprint.git",
"directory": "packages/timezone"
},
"keywords": [
"palantir",
"blueprint",
"react",
"timezone",
"time",
"select"
],
"author": "Palantir Technologies",
"license": "Apache-2.0"
}

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 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 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