Grabbed dndbeyond's source code
``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
This commit is contained in:
+115
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
var BaseConfig = {
|
||||
earlyRefresh: 30
|
||||
};
|
||||
|
||||
var getAuthorizationHeader = function getAuthorizationHeader(token) {
|
||||
return "Bearer ".concat(token);
|
||||
};
|
||||
/**
|
||||
* Requests a short term token from the DDB Auth API using the Cobalt session cookie to authorize the user
|
||||
* @param {string} authUrl The URL to the cobalt-token auth endpoint
|
||||
* @param {boolean} throwOnHttpStatusError Option to transform error status codes (4xx/5xx) to exceptions
|
||||
* @returns {Promise<object>} A promise that resolves to the JSON object returned by the Auth API
|
||||
*/
|
||||
|
||||
|
||||
var getShortTermToken = function getShortTermToken(_ref) {
|
||||
var _ref$authUrl = _ref.authUrl,
|
||||
authUrl = _ref$authUrl === void 0 ? 'https://auth-service.dndbeyond.com/v1/cobalt-token' : _ref$authUrl,
|
||||
_ref$throwOnHttpStatu = _ref.throwOnHttpStatusError,
|
||||
throwOnHttpStatusError = _ref$throwOnHttpStatu === void 0 ? true : _ref$throwOnHttpStatu;
|
||||
return fetch(authUrl, {
|
||||
credentials: 'include',
|
||||
method: 'POST'
|
||||
}).then(function (response) {
|
||||
// eslint-disable-next-line no-magic-numbers, `Copied from https://github.com/whatwg/fetch/issues/18#issuecomment-68273579`
|
||||
if (throwOnHttpStatusError && response.status >= 400 && response.status < 600) {
|
||||
throw new Error('Bad response from server');
|
||||
}
|
||||
|
||||
return response.json();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Makes a getter function that will return a promise that resolves to a short term token (JWT) if signed in, null otherwise
|
||||
* @param {object} options Options object that is passed on to internally called methods
|
||||
* @returns {function(): (Promise<object>)} A promise that resolves to a short term token (JWT) if signed in, null otherwise
|
||||
*/
|
||||
|
||||
|
||||
var makeGetShortTermToken = function makeGetShortTermToken(options) {
|
||||
var _options$earlyRefresh = options.earlyRefresh,
|
||||
earlyRefresh = _options$earlyRefresh === void 0 ? BaseConfig.earlyRefresh : _options$earlyRefresh,
|
||||
_options$getShortTerm = options.getShortTermTokenFunc,
|
||||
getShortTermTokenFunc = _options$getShortTerm === void 0 ? getShortTermToken : _options$getShortTerm;
|
||||
var timeOfRequest;
|
||||
var lastSessionToken;
|
||||
var timeToLive = 0;
|
||||
var pendingRequest = null;
|
||||
return function () {
|
||||
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
||||
_ref2$ignoreAnonymous = _ref2.ignoreAnonymousTimeToLive,
|
||||
ignoreAnonymousTimeToLive = _ref2$ignoreAnonymous === void 0 ? false : _ref2$ignoreAnonymous;
|
||||
|
||||
if (pendingRequest) {
|
||||
return pendingRequest;
|
||||
}
|
||||
|
||||
var shouldUseTimeToLive = ignoreAnonymousTimeToLive ? lastSessionToken != null : true;
|
||||
|
||||
if (shouldUseTimeToLive && timeToLive && timeOfRequest + timeToLive > Date.now()) {
|
||||
return new Promise(function (resolve) {
|
||||
return resolve(lastSessionToken);
|
||||
});
|
||||
}
|
||||
|
||||
timeOfRequest = Date.now();
|
||||
pendingRequest = getShortTermTokenFunc(options).then(function (data) {
|
||||
lastSessionToken = data.token; // eslint-disable-next-line no-magic-numbers, "multiply by 1000 because TTL is measured in seconds"
|
||||
|
||||
timeToLive = (data.ttl - earlyRefresh) * 1000;
|
||||
pendingRequest = null;
|
||||
return data.token;
|
||||
})["catch"](function (error) {
|
||||
timeToLive = 0;
|
||||
lastSessionToken = null;
|
||||
pendingRequest = null;
|
||||
throw error;
|
||||
});
|
||||
return pendingRequest;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Makes a getter function that will return a promise that resolves to auth headers if signed in, an empty object otherwise
|
||||
* @param {object} options Options object that is passed on to internally called methods
|
||||
* @param {function} options.madeGetShortTermToken Optional function to use instead of calling makeGetShortTermToken so the same function instance can be shared
|
||||
* @returns {function(): (Promise<object>)} A promise that resolves to a headers object if signed in, an empty object otherwise
|
||||
*/
|
||||
|
||||
|
||||
var makeGetAuthorizationHeaders = function makeGetAuthorizationHeaders(options) {
|
||||
var getShortTermTokenFunc = options.madeGetShortTermToken || makeGetShortTermToken(options);
|
||||
return function () {
|
||||
return getShortTermTokenFunc.apply(void 0, arguments).then(function (shortTermToken) {
|
||||
if (!shortTermToken) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {
|
||||
Authorization: getAuthorizationHeader(shortTermToken)
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _default = {
|
||||
makeGetShortTermToken: makeGetShortTermToken,
|
||||
makeGetAuthorizationHeaders: makeGetAuthorizationHeaders
|
||||
};
|
||||
exports["default"] = _default;
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
||||
|
||||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
||||
|
||||
// Manually implement reselect/createSelector without memoization so we don't force the dependency,
|
||||
// because this object is simple enough to not need memoization and the interface makes it easier to share null handling logic
|
||||
var createSelector = function createSelector(deps, selector) {
|
||||
return function (state) {
|
||||
return selector.apply(void 0, _toConsumableArray(deps.map(function (dep) {
|
||||
return dep(state);
|
||||
})));
|
||||
};
|
||||
};
|
||||
|
||||
var getUser = function getUser(user) {
|
||||
return user || {};
|
||||
};
|
||||
|
||||
var getId = createSelector([getUser], function (_ref) {
|
||||
var id = _ref.id;
|
||||
return id;
|
||||
});
|
||||
var getName = createSelector([getUser], function (_ref2) {
|
||||
var name = _ref2.name;
|
||||
return name;
|
||||
});
|
||||
var getRoles = createSelector([getUser], function (_ref3) {
|
||||
var roles = _ref3.roles;
|
||||
return roles || [];
|
||||
});
|
||||
var getSubscriptions = createSelector([getUser], function (_ref4) {
|
||||
var subscriptions = _ref4.subscriptions;
|
||||
return subscriptions || [];
|
||||
});
|
||||
var getSubscriptionTier = createSelector([getUser], function (_ref5) {
|
||||
var subscriptionTier = _ref5.subscriptionTier;
|
||||
return subscriptionTier;
|
||||
});
|
||||
/**
|
||||
* Converts a decoded JWT object to a simple user object
|
||||
* @param {object} jwt, A decoded JWT from the Auth API
|
||||
* @returns {object} A user object with simple property names instead of JWT schema links
|
||||
*/
|
||||
|
||||
var jwtToUser = function jwtToUser(jwt) {
|
||||
return jwt ? {
|
||||
id: jwt['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier'],
|
||||
name: jwt['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name'],
|
||||
roles: jwt['http://schemas.microsoft.com/ws/2008/06/identity/claims/role'],
|
||||
subscription: jwt['http://schemas.dndbeyond.com/ws/2019/08/identity/claims/subscriber'],
|
||||
subscriptionTier: jwt['http://schemas.dndbeyond.com/ws/2019/08/identity/claims/subscriptiontier'],
|
||||
avatarUrl: jwt.avatarUrl
|
||||
} : null;
|
||||
};
|
||||
|
||||
var _default = {
|
||||
getId: getId,
|
||||
getName: getName,
|
||||
getRoles: getRoles,
|
||||
getSubscriptions: getSubscriptions,
|
||||
getSubscriptionTier: getSubscriptionTier,
|
||||
jwtToUser: jwtToUser
|
||||
};
|
||||
exports["default"] = _default;
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AuthUtils", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _AuthUtils["default"];
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "UserUtils", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _UserUtils["default"];
|
||||
}
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _AuthUtils = _interopRequireDefault(require("./AuthUtils"));
|
||||
|
||||
var _UserUtils = _interopRequireDefault(require("./UserUtils"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
// Export AuthUtils as default for backwards compatibility
|
||||
var _default = _AuthUtils["default"];
|
||||
exports["default"] = _default;
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// extracted by mini-css-extract-plugin
|
||||
export default {"$black":"#10161a","$white":"#fff","$gray-dark1":"#182026","$gray-dark2":"#202b33","$gray-dark3":"#293742","$gray-dark4":"#30404d","$gray-dark5":"#394b59","$gray1":"#5c7080","$gray2":"#738694","$gray3":"#8a9ba8","$gray4":"#a7b6c2","$gray5":"#bfccd6","$gray-light1":"#ced9e0","$gray-light2":"#d8e1e8","$gray-light3":"#e1e8ed","$gray-light4":"#ebf1f5","$gray-light5":"#f5f8fa","$blue1":"#1b9af0","$blue2":"#35adff","$blue3":"#5ebeff","$blue4":"#86ceff","$blue5":"#aedeff","$red-brand":"#e40712","$red1":"#bc0f0f","$red2":"#c93f3f","$red3":"#d54f4f","$red4":"#df7b7b","$red5":"#e79c9c","$green1":"#00c797","$green2":"#00daa6","$green3":"#33e1b8","$green4":"#66e9ca","$green5":"#99f0db","$yellow-orange1":"#f5a623","$yellow-orange2":"#f7b84f","$yellow-orange3":"#f9ca7b","$yellow-orange4":"#fbdba7","$yellow-orange5":"#fdedd3","$red-orange1":"#e45a1d","$red-orange2":"#e97b4a","$red-orange3":"#ef9c77","$red-orange4":"#f4bda5","$red-orange5":"#faded2","$alpha":"#e40712","$beta":"#1b9af0","$comingsoon":"#e45a1d","$newrelease":"#66e9ca"};
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// extracted by mini-css-extract-plugin
|
||||
export default {"TinyBelow":"(max-width: 640px)","TinyAbove":"(min-width: 641px)","TinyToSmall":"(min-width: 641px) and (max-width: 768px)","TinyToMedium":"(min-width: 641px) and (max-width: 1024px)","TinyToLarge":"(min-width: 641px) and (max-width: 1200px)","SmallBelow":"(max-width: 768px)","SmallAbove":"(min-width: 769px)","SmallToMedium":"(min-width: 769px) and (max-width: 1024px)","SmallToLarge":"(min-width: 769px) and (max-width: 1200px)","MediumBelow":"(max-width: 1024px)","MediumAbove":"(min-width: 1025px)","MediumToLarge":"(min-width: 1025px) and (max-width: 1200px)","LargeBelow":"(max-width: 1200px)","LargeAbove":"(min-width: 1201px)"};
|
||||
+2666
File diff suppressed because it is too large
Load Diff
+75
File diff suppressed because one or more lines are too long
+2
File diff suppressed because one or more lines are too long
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgYoutube(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 576 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgYoutube);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgPen(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M395.8 39.6c9.4-9.4 24.6-9.4 33.9 0l42.6 42.6c9.4 9.4 9.4 24.6 0 33.9L417.6 171 341 94.4l54.8-54.8zM318.4 117L395 193.6 159.6 428.9c-7.6 7.6-16.9 13.1-27.2 16.1L39.6 472.4l27.3-92.8c3-10.3 8.6-19.6 16.1-27.2L318.4 117zM452.4 17c-21.9-21.9-57.3-21.9-79.2 0L60.4 329.7c-11.4 11.4-19.7 25.4-24.2 40.8L.7 491.5c-1.7 5.6-.1 11.7 4 15.8s10.2 5.7 15.8 4l121-35.6c15.4-4.5 29.4-12.9 40.8-24.2L495 138.8c21.9-21.9 21.9-57.3 0-79.2L452.4 17z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgPen);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgAngleDown(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 448 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M241 337c-9.4 9.4-24.6 9.4-33.9 0L47 177c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l143 143L367 143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L241 337z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgAngleDown);
|
||||
export default ForwardRef;
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgArrowDownToLine(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 384 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M360 480c13.3 0 24-10.7 24-24s-10.7-24-24-24L24 432c-13.3 0-24 10.7-24 24s10.7 24 24 24l336 0zM174.5 344.4c4.5 4.8 10.9 7.6 17.5 7.6s12.9-2.7 17.5-7.6l128-136c9.1-9.7 8.6-24.8-1-33.9s-24.8-8.6-33.9 1L216 267.5l0-83.5 0-128c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 128 0 83.5L81.5 175.6c-9.1-9.7-24.3-10.1-33.9-1s-10.1 24.3-1 33.9l128 136z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgArrowDownToLine);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgArrowRight(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 448 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M440.6 273.4c4.7-4.5 7.4-10.8 7.4-17.4s-2.7-12.8-7.4-17.4l-176-168c-9.6-9.2-24.8-8.8-33.9 .8s-8.8 24.8 .8 33.9L364.1 232 24 232c-13.3 0-24 10.7-24 24s10.7 24 24 24l340.1 0L231.4 406.6c-9.6 9.2-9.9 24.3-.8 33.9s24.3 9.9 33.9 .8l176-168z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgArrowRight);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgCircleInfo(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336c-13.3 0-24 10.7-24 24s10.7 24 24 24h80c13.3 0 24-10.7 24-24s-10.7-24-24-24h-8V248c0-13.3-10.7-24-24-24H216c-13.3 0-24 10.7-24 24s10.7 24 24 24h24v64H216zm40-144a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgCircleInfo);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgDiceD6(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 448 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M243.9 7.7c-12.4-7-27.6-6.9-39.9 .3L19.8 115.6C7.5 122.8 0 135.9 0 150.1V366.6c0 14.5 7.8 27.8 20.5 34.9l184 103c12.1 6.8 26.9 6.8 39.1 0l184-103c12.6-7.1 20.5-20.4 20.5-34.9V146.8c0-14.4-7.7-27.7-20.3-34.8L243.9 7.7zM71.8 140.8L224.2 51.7l152 86.2L223.8 228.2l-152-87.4zM48 182.4l152 87.4V447.1L48 361.9V182.4zM248 447.1V269.7l152-90.1V361.9L248 447.1z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgDiceD6);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgGear(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M256 0c17 0 33.6 1.7 49.8 4.8c7.9 1.5 21.8 6.1 29.4 20.1c2 3.7 3.6 7.6 4.6 11.8l9.3 38.5C350.5 81 360.3 86.7 366 85l38-11.2c4-1.2 8.1-1.8 12.2-1.9c16.1-.5 27 9.4 32.3 15.4c22.1 25.1 39.1 54.6 49.9 86.3c2.6 7.6 5.6 21.8-2.7 35.4c-2.2 3.6-4.9 7-8 10L459 246.3c-4.2 4-4.2 15.5 0 19.5l28.7 27.3c3.1 3 5.8 6.4 8 10c8.2 13.6 5.2 27.8 2.7 35.4c-10.8 31.7-27.8 61.1-49.9 86.3c-5.3 6-16.3 15.9-32.3 15.4c-4.1-.1-8.2-.8-12.2-1.9L366 427c-5.7-1.7-15.5 4-16.9 9.8l-9.3 38.5c-1 4.2-2.6 8.2-4.6 11.8c-7.7 14-21.6 18.5-29.4 20.1C289.6 510.3 273 512 256 512s-33.6-1.7-49.8-4.8c-7.9-1.5-21.8-6.1-29.4-20.1c-2-3.7-3.6-7.6-4.6-11.8l-9.3-38.5c-1.4-5.8-11.2-11.5-16.9-9.8l-38 11.2c-4 1.2-8.1 1.8-12.2 1.9c-16.1 .5-27-9.4-32.3-15.4c-22-25.1-39.1-54.6-49.9-86.3c-2.6-7.6-5.6-21.8 2.7-35.4c2.2-3.6 4.9-7 8-10L53 265.7c4.2-4 4.2-15.5 0-19.5L24.2 218.9c-3.1-3-5.8-6.4-8-10C8 195.3 11 181.1 13.6 173.6c10.8-31.7 27.8-61.1 49.9-86.3c5.3-6 16.3-15.9 32.3-15.4c4.1 .1 8.2 .8 12.2 1.9L146 85c5.7 1.7 15.5-4 16.9-9.8l9.3-38.5c1-4.2 2.6-8.2 4.6-11.8c7.7-14 21.6-18.5 29.4-20.1C222.4 1.7 239 0 256 0zM218.1 51.4l-8.5 35.1c-7.8 32.3-45.3 53.9-77.2 44.6L97.9 120.9c-16.5 19.3-29.5 41.7-38 65.7l26.2 24.9c24 22.8 24 66.2 0 89L59.9 325.4c8.5 24 21.5 46.4 38 65.7l34.6-10.2c31.8-9.4 69.4 12.3 77.2 44.6l8.5 35.1c24.6 4.5 51.3 4.5 75.9 0l8.5-35.1c7.8-32.3 45.3-53.9 77.2-44.6l34.6 10.2c16.5-19.3 29.5-41.7 38-65.7l-26.2-24.9c-24-22.8-24-66.2 0-89l26.2-24.9c-8.5-24-21.5-46.4-38-65.7l-34.6 10.2c-31.8 9.4-69.4-12.3-77.2-44.6l-8.5-35.1c-24.6-4.5-51.3-4.5-75.9 0zM208 256a48 48 0 1 0 96 0 48 48 0 1 0 -96 0zm48 96a96 96 0 1 1 0-192 96 96 0 1 1 0 192z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgGear);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgLock(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 448 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M144 128v64H304V128c0-44.2-35.8-80-80-80s-80 35.8-80 80zM96 192V128C96 57.3 153.3 0 224 0s128 57.3 128 128v64h32c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H96zM48 256V448c0 8.8 7.2 16 16 16H384c8.8 0 16-7.2 16-16V256c0-8.8-7.2-16-16-16H64c-8.8 0-16 7.2-16 16z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgLock);
|
||||
export default ForwardRef;
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgMagnifyingGlass(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M368 208A160 160 0 1 0 48 208a160 160 0 1 0 320 0zM337.1 371.1C301.7 399.2 256.8 416 208 416C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208c0 48.8-16.8 93.7-44.9 129.1L505 471c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L337.1 371.1z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgMagnifyingGlass);
|
||||
export default ForwardRef;
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgSpinnerThird(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M457 372c11.5 6.6 26.3 2.7 31.8-9.3C503.7 330.2 512 294.1 512 256C512 122.7 410.1 13.2 280 1.1C266.8-.1 256 10.7 256 24v0c0 13.3 10.8 23.9 24 25.4C383.5 61.2 464 149.2 464 256c0 29.3-6.1 57.3-17 82.6c-5.3 12.2-1.5 26.8 10 33.5v0z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgSpinnerThird);
|
||||
export default ForwardRef;
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgTriangleExclamation(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M248.4 84.3c1.6-2.7 4.5-4.3 7.6-4.3s6 1.6 7.6 4.3L461.9 410c1.4 2.3 2.1 4.9 2.1 7.5c0 8-6.5 14.5-14.5 14.5H62.5c-8 0-14.5-6.5-14.5-14.5c0-2.7 .7-5.3 2.1-7.5L248.4 84.3zm-41-25L9.1 385c-6 9.8-9.1 21-9.1 32.5C0 452 28 480 62.5 480h387c34.5 0 62.5-28 62.5-62.5c0-11.5-3.2-22.7-9.1-32.5L304.6 59.3C294.3 42.4 275.9 32 256 32s-38.3 10.4-48.6 27.3zM288 368a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm-8-184c0-13.3-10.7-24-24-24s-24 10.7-24 24v96c0 13.3 10.7 24 24 24s24-10.7 24-24V184z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgTriangleExclamation);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgWrench(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M322.3 268c9.4 2.6 19.3 4 29.7 4c60.5 0 109.8-48 111.9-108l-25.3 25.3c-12 12-28.3 18.7-45.3 18.7H368c-35.3 0-64-28.7-64-64V118.6c0-17 6.7-33.3 18.7-45.3l0 0L348 48.1C288 50.1 240 99.5 240 160c0 10.3 1.4 20.3 4 29.7c4.6 16.6-.2 34.4-12.4 46.6L57.1 410.7c-5.9 5.8-9.1 13.8-9.1 22.1C48 450 62 464 79.2 464c8.3 0 16.2-3.3 22.1-9.1L275.7 280.4c12.2-12.2 30-16.9 46.6-12.4zM424.6 39.4l-67.9 67.9c-3 3-4.7 7.1-4.7 11.3V144c0 8.8 7.2 16 16 16h25.4c4.2 0 8.3-1.7 11.3-4.7l67.9-67.9c7.2-7.2 19.3-5.9 23.7 3.3c10.1 21 15.7 44.5 15.7 69.3c0 88.4-71.6 160-160 160c-14.7 0-28.9-2-42.3-5.7L135.2 488.8c-14.9 14.9-35 23.2-56 23.2C35.5 512 0 476.5 0 432.8c0-21 8.3-41.1 23.2-56L197.7 202.3C194 188.9 192 174.7 192 160C192 71.6 263.6 0 352 0c24.8 0 48.3 5.7 69.3 15.7c9.2 4.4 10.5 16.5 3.3 23.7zM88 408a16 16 0 1 1 0 32 16 16 0 1 1 0-32z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgWrench);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgXmark(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 384 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M345 137c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-119 119L73 103c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l119 119L39 375c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l119-119L311 409c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-119-119L345 137z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgXmark);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgCheck(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 448 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M448 130L431 147 177.5 399.2l-16.9 16.9-16.9-16.9L17 273.1 0 256.2l33.9-34 17 16.9L160.6 348.3 397.1 112.9l17-16.9L448 130z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgCheck);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgArrowRight(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 448 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgArrowRight);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgChevronDown(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgChevronDown);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgChevronLeft(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 320 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgChevronLeft);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgChevronRight(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 320 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgChevronRight);
|
||||
export default ForwardRef;
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgCircleExclamation(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgCircleExclamation);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgCircleXmark(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgCircleXmark);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgGrid(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 448 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M0 72C0 49.9 17.9 32 40 32H88c22.1 0 40 17.9 40 40v48c0 22.1-17.9 40-40 40H40c-22.1 0-40-17.9-40-40V72zM0 232c0-22.1 17.9-40 40-40H88c22.1 0 40 17.9 40 40v48c0 22.1-17.9 40-40 40H40c-22.1 0-40-17.9-40-40V232zM128 392v48c0 22.1-17.9 40-40 40H40c-22.1 0-40-17.9-40-40V392c0-22.1 17.9-40 40-40H88c22.1 0 40 17.9 40 40zM160 72c0-22.1 17.9-40 40-40h48c22.1 0 40 17.9 40 40v48c0 22.1-17.9 40-40 40H200c-22.1 0-40-17.9-40-40V72zM288 232v48c0 22.1-17.9 40-40 40H200c-22.1 0-40-17.9-40-40V232c0-22.1 17.9-40 40-40h48c22.1 0 40 17.9 40 40zM160 392c0-22.1 17.9-40 40-40h48c22.1 0 40 17.9 40 40v48c0 22.1-17.9 40-40 40H200c-22.1 0-40-17.9-40-40V392zM448 72v48c0 22.1-17.9 40-40 40H360c-22.1 0-40-17.9-40-40V72c0-22.1 17.9-40 40-40h48c22.1 0 40 17.9 40 40zM320 232c0-22.1 17.9-40 40-40h48c22.1 0 40 17.9 40 40v48c0 22.1-17.9 40-40 40H360c-22.1 0-40-17.9-40-40V232zM448 392v48c0 22.1-17.9 40-40 40H360c-22.1 0-40-17.9-40-40V392c0-22.1 17.9-40 40-40h48c22.1 0 40 17.9 40 40z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgGrid);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgLock(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 448 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgLock);
|
||||
export default ForwardRef;
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgMagnifyingGlass(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgMagnifyingGlass);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgShuffle(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M403.8 34.4c12-5 25.7-2.2 34.9 6.9l64 64c6 6 9.4 14.1 9.4 22.6s-3.4 16.6-9.4 22.6l-64 64c-9.2 9.2-22.9 11.9-34.9 6.9s-19.8-16.6-19.8-29.6V160H352c-10.1 0-19.6 4.7-25.6 12.8L284 229.3 244 176l31.2-41.6C293.3 110.2 321.8 96 352 96h32V64c0-12.9 7.8-24.6 19.8-29.6zM164 282.7L204 336l-31.2 41.6C154.7 401.8 126.2 416 96 416H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H96c10.1 0 19.6-4.7 25.6-12.8L164 282.7zm274.6 188c-9.2 9.2-22.9 11.9-34.9 6.9s-19.8-16.6-19.8-29.6V416H352c-30.2 0-58.7-14.2-76.8-38.4L121.6 172.8c-6-8.1-15.5-12.8-25.6-12.8H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H96c30.2 0 58.7 14.2 76.8 38.4L326.4 339.2c6 8.1 15.5 12.8 25.6 12.8h32V320c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l64 64c6 6 9.4 14.1 9.4 22.6s-3.4 16.6-9.4 22.6l-64 64z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgShuffle);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgSpinnerThird(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M224 32c0-17.7 14.3-32 32-32C397.4 0 512 114.6 512 256c0 46.6-12.5 90.4-34.3 128c-8.8 15.3-28.4 20.5-43.7 11.7s-20.5-28.4-11.7-43.7c16.3-28.2 25.7-61 25.7-96c0-106-86-192-192-192c-17.7 0-32-14.3-32-32z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgSpinnerThird);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgStar(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 576 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgStar);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgUnlock(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 448 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M144 144c0-44.2 35.8-80 80-80c31.9 0 59.4 18.6 72.3 45.7c7.6 16 26.7 22.8 42.6 15.2s22.8-26.7 15.2-42.6C331 33.7 281.5 0 224 0C144.5 0 80 64.5 80 144v48H64c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V256c0-35.3-28.7-64-64-64H144V144z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgUnlock);
|
||||
export default ForwardRef;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
var _path;
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from "react";
|
||||
function SvgX(_ref, svgRef) {
|
||||
let {
|
||||
title,
|
||||
titleId,
|
||||
...props
|
||||
} = _ref;
|
||||
return /*#__PURE__*/React.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 384 512",
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
ref: svgRef,
|
||||
"aria-labelledby": titleId
|
||||
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
||||
id: titleId
|
||||
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
||||
d: "M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z"
|
||||
})));
|
||||
}
|
||||
const ForwardRef = /*#__PURE__*/React.forwardRef(SvgX);
|
||||
export default ForwardRef;
|
||||
+3879
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
export default function addLeadingZeros(number, targetLength) {
|
||||
var sign = number < 0 ? '-' : '';
|
||||
var output = Math.abs(number).toString();
|
||||
while (output.length < targetLength) {
|
||||
output = '0' + output;
|
||||
}
|
||||
return sign + output;
|
||||
}
|
||||
Generated
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
export default function assign(target, object) {
|
||||
if (target == null) {
|
||||
throw new TypeError('assign requires that input parameter not be null or undefined');
|
||||
}
|
||||
for (var property in object) {
|
||||
if (Object.prototype.hasOwnProperty.call(object, property)) {
|
||||
;
|
||||
target[property] = object[property];
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import assign from "../assign/index.js";
|
||||
export default function cloneObject(object) {
|
||||
return assign({}, object);
|
||||
}
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
import defaultLocale from "../../locale/en-US/index.js";
|
||||
export default defaultLocale;
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
var defaultOptions = {};
|
||||
export function getDefaultOptions() {
|
||||
return defaultOptions;
|
||||
}
|
||||
export function setDefaultOptions(newOptions) {
|
||||
defaultOptions = newOptions;
|
||||
}
|
||||
Generated
Vendored
+80
@@ -0,0 +1,80 @@
|
||||
import addLeadingZeros from "../../addLeadingZeros/index.js";
|
||||
/*
|
||||
* | | Unit | | Unit |
|
||||
* |-----|--------------------------------|-----|--------------------------------|
|
||||
* | a | AM, PM | A* | |
|
||||
* | d | Day of month | D | |
|
||||
* | h | Hour [1-12] | H | Hour [0-23] |
|
||||
* | m | Minute | M | Month |
|
||||
* | s | Second | S | Fraction of second |
|
||||
* | y | Year (abs) | Y | |
|
||||
*
|
||||
* Letters marked by * are not implemented but reserved by Unicode standard.
|
||||
*/
|
||||
var formatters = {
|
||||
// Year
|
||||
y: function y(date, token) {
|
||||
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
|
||||
// | Year | y | yy | yyy | yyyy | yyyyy |
|
||||
// |----------|-------|----|-------|-------|-------|
|
||||
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
||||
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
||||
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
||||
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
||||
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
||||
|
||||
var signedYear = date.getUTCFullYear();
|
||||
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
||||
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
||||
return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
|
||||
},
|
||||
// Month
|
||||
M: function M(date, token) {
|
||||
var month = date.getUTCMonth();
|
||||
return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
||||
},
|
||||
// Day of the month
|
||||
d: function d(date, token) {
|
||||
return addLeadingZeros(date.getUTCDate(), token.length);
|
||||
},
|
||||
// AM or PM
|
||||
a: function a(date, token) {
|
||||
var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
|
||||
switch (token) {
|
||||
case 'a':
|
||||
case 'aa':
|
||||
return dayPeriodEnumValue.toUpperCase();
|
||||
case 'aaa':
|
||||
return dayPeriodEnumValue;
|
||||
case 'aaaaa':
|
||||
return dayPeriodEnumValue[0];
|
||||
case 'aaaa':
|
||||
default:
|
||||
return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
|
||||
}
|
||||
},
|
||||
// Hour [1-12]
|
||||
h: function h(date, token) {
|
||||
return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
|
||||
},
|
||||
// Hour [0-23]
|
||||
H: function H(date, token) {
|
||||
return addLeadingZeros(date.getUTCHours(), token.length);
|
||||
},
|
||||
// Minute
|
||||
m: function m(date, token) {
|
||||
return addLeadingZeros(date.getUTCMinutes(), token.length);
|
||||
},
|
||||
// Second
|
||||
s: function s(date, token) {
|
||||
return addLeadingZeros(date.getUTCSeconds(), token.length);
|
||||
},
|
||||
// Fraction of second
|
||||
S: function S(date, token) {
|
||||
var numberOfDigits = token.length;
|
||||
var milliseconds = date.getUTCMilliseconds();
|
||||
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
|
||||
return addLeadingZeros(fractionalSeconds, token.length);
|
||||
}
|
||||
};
|
||||
export default formatters;
|
||||
Generated
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
||||
* They usually appear for dates that denote time before the timezones were introduced
|
||||
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
||||
* and GMT+01:00:00 after that date)
|
||||
*
|
||||
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
||||
* which would lead to incorrect calculations.
|
||||
*
|
||||
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
||||
*/
|
||||
export default function getTimezoneOffsetInMilliseconds(date) {
|
||||
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
||||
utcDate.setUTCFullYear(date.getFullYear());
|
||||
return date.getTime() - utcDate.getTime();
|
||||
}
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export default function requiredArgs(required, args) {
|
||||
if (args.length < required) {
|
||||
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
var roundingMap = {
|
||||
ceil: Math.ceil,
|
||||
round: Math.round,
|
||||
floor: Math.floor,
|
||||
trunc: function trunc(value) {
|
||||
return value < 0 ? Math.ceil(value) : Math.floor(value);
|
||||
} // Math.trunc is not supported by IE
|
||||
};
|
||||
|
||||
var defaultRoundingMethod = 'trunc';
|
||||
export function getRoundingMethod(method) {
|
||||
return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
|
||||
}
|
||||
Generated
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
export default function toInteger(dirtyNumber) {
|
||||
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
|
||||
return NaN;
|
||||
}
|
||||
var number = Number(dirtyNumber);
|
||||
if (isNaN(number)) {
|
||||
return number;
|
||||
}
|
||||
return number < 0 ? Math.ceil(number) : Math.floor(number);
|
||||
}
|
||||
Generated
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
import toInteger from "../_lib/toInteger/index.js";
|
||||
import toDate from "../toDate/index.js";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
/**
|
||||
* @name addMilliseconds
|
||||
* @category Millisecond Helpers
|
||||
* @summary Add the specified number of milliseconds to the given date.
|
||||
*
|
||||
* @description
|
||||
* Add the specified number of milliseconds to the given date.
|
||||
*
|
||||
* @param {Date|Number} date - the date to be changed
|
||||
* @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
|
||||
* @returns {Date} the new date with the milliseconds added
|
||||
* @throws {TypeError} 2 arguments required
|
||||
*
|
||||
* @example
|
||||
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
|
||||
* const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
||||
* //=> Thu Jul 10 2014 12:45:30.750
|
||||
*/
|
||||
export default function addMilliseconds(dirtyDate, dirtyAmount) {
|
||||
requiredArgs(2, arguments);
|
||||
var timestamp = toDate(dirtyDate).getTime();
|
||||
var amount = toInteger(dirtyAmount);
|
||||
return new Date(timestamp + amount);
|
||||
}
|
||||
Generated
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
import toDate from "../toDate/index.js";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
/**
|
||||
* @name compareAsc
|
||||
* @category Common Helpers
|
||||
* @summary Compare the two dates and return -1, 0 or 1.
|
||||
*
|
||||
* @description
|
||||
* Compare the two dates and return 1 if the first date is after the second,
|
||||
* -1 if the first date is before the second or 0 if dates are equal.
|
||||
*
|
||||
* @param {Date|Number} dateLeft - the first date to compare
|
||||
* @param {Date|Number} dateRight - the second date to compare
|
||||
* @returns {Number} the result of the comparison
|
||||
* @throws {TypeError} 2 arguments required
|
||||
*
|
||||
* @example
|
||||
* // Compare 11 February 1987 and 10 July 1989:
|
||||
* const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
|
||||
* //=> -1
|
||||
*
|
||||
* @example
|
||||
* // Sort the array of dates:
|
||||
* const result = [
|
||||
* new Date(1995, 6, 2),
|
||||
* new Date(1987, 1, 11),
|
||||
* new Date(1989, 6, 10)
|
||||
* ].sort(compareAsc)
|
||||
* //=> [
|
||||
* // Wed Feb 11 1987 00:00:00,
|
||||
* // Mon Jul 10 1989 00:00:00,
|
||||
* // Sun Jul 02 1995 00:00:00
|
||||
* // ]
|
||||
*/
|
||||
export default function compareAsc(dirtyDateLeft, dirtyDateRight) {
|
||||
requiredArgs(2, arguments);
|
||||
var dateLeft = toDate(dirtyDateLeft);
|
||||
var dateRight = toDate(dirtyDateRight);
|
||||
var diff = dateLeft.getTime() - dateRight.getTime();
|
||||
if (diff < 0) {
|
||||
return -1;
|
||||
} else if (diff > 0) {
|
||||
return 1;
|
||||
// Return 0 if diff is 0; return NaN if diff is NaN
|
||||
} else {
|
||||
return diff;
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+183
@@ -0,0 +1,183 @@
|
||||
/**
|
||||
* Days in 1 week.
|
||||
*
|
||||
* @name daysInWeek
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var daysInWeek = 7;
|
||||
|
||||
/**
|
||||
* Days in 1 year
|
||||
* One years equals 365.2425 days according to the formula:
|
||||
*
|
||||
* > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.
|
||||
* > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
|
||||
*
|
||||
* @name daysInYear
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var daysInYear = 365.2425;
|
||||
|
||||
/**
|
||||
* Maximum allowed time.
|
||||
*
|
||||
* @name maxTime
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
|
||||
|
||||
/**
|
||||
* Milliseconds in 1 minute
|
||||
*
|
||||
* @name millisecondsInMinute
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var millisecondsInMinute = 60000;
|
||||
|
||||
/**
|
||||
* Milliseconds in 1 hour
|
||||
*
|
||||
* @name millisecondsInHour
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var millisecondsInHour = 3600000;
|
||||
|
||||
/**
|
||||
* Milliseconds in 1 second
|
||||
*
|
||||
* @name millisecondsInSecond
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var millisecondsInSecond = 1000;
|
||||
|
||||
/**
|
||||
* Minimum allowed time.
|
||||
*
|
||||
* @name minTime
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var minTime = -maxTime;
|
||||
|
||||
/**
|
||||
* Minutes in 1 hour
|
||||
*
|
||||
* @name minutesInHour
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var minutesInHour = 60;
|
||||
|
||||
/**
|
||||
* Months in 1 quarter
|
||||
*
|
||||
* @name monthsInQuarter
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var monthsInQuarter = 3;
|
||||
|
||||
/**
|
||||
* Months in 1 year
|
||||
*
|
||||
* @name monthsInYear
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var monthsInYear = 12;
|
||||
|
||||
/**
|
||||
* Quarters in 1 year
|
||||
*
|
||||
* @name quartersInYear
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var quartersInYear = 4;
|
||||
|
||||
/**
|
||||
* Seconds in 1 hour
|
||||
*
|
||||
* @name secondsInHour
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var secondsInHour = 3600;
|
||||
|
||||
/**
|
||||
* Seconds in 1 minute
|
||||
*
|
||||
* @name secondsInMinute
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var secondsInMinute = 60;
|
||||
|
||||
/**
|
||||
* Seconds in 1 day
|
||||
*
|
||||
* @name secondsInDay
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var secondsInDay = secondsInHour * 24;
|
||||
|
||||
/**
|
||||
* Seconds in 1 week
|
||||
*
|
||||
* @name secondsInWeek
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var secondsInWeek = secondsInDay * 7;
|
||||
|
||||
/**
|
||||
* Seconds in 1 year
|
||||
*
|
||||
* @name secondsInYear
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var secondsInYear = secondsInDay * daysInYear;
|
||||
|
||||
/**
|
||||
* Seconds in 1 month
|
||||
*
|
||||
* @name secondsInMonth
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var secondsInMonth = secondsInYear / 12;
|
||||
|
||||
/**
|
||||
* Seconds in 1 quarter
|
||||
*
|
||||
* @name secondsInQuarter
|
||||
* @constant
|
||||
* @type {number}
|
||||
* @default
|
||||
*/
|
||||
export var secondsInQuarter = secondsInMonth * 3;
|
||||
Generated
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
import { millisecondsInHour } from "../constants/index.js";
|
||||
import differenceInMilliseconds from "../differenceInMilliseconds/index.js";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
import { getRoundingMethod } from "../_lib/roundingMethods/index.js";
|
||||
/**
|
||||
* @name differenceInHours
|
||||
* @category Hour Helpers
|
||||
* @summary Get the number of hours between the given dates.
|
||||
*
|
||||
* @description
|
||||
* Get the number of hours between the given dates.
|
||||
*
|
||||
* @param {Date|Number} dateLeft - the later date
|
||||
* @param {Date|Number} dateRight - the earlier date
|
||||
* @param {Object} [options] - an object with options.
|
||||
* @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
|
||||
* @returns {Number} the number of hours
|
||||
* @throws {TypeError} 2 arguments required
|
||||
*
|
||||
* @example
|
||||
* // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?
|
||||
* const result = differenceInHours(
|
||||
* new Date(2014, 6, 2, 19, 0),
|
||||
* new Date(2014, 6, 2, 6, 50)
|
||||
* )
|
||||
* //=> 12
|
||||
*/
|
||||
export default function differenceInHours(dateLeft, dateRight, options) {
|
||||
requiredArgs(2, arguments);
|
||||
var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;
|
||||
return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
|
||||
}
|
||||
Generated
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
import toDate from "../toDate/index.js";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
/**
|
||||
* @name differenceInMilliseconds
|
||||
* @category Millisecond Helpers
|
||||
* @summary Get the number of milliseconds between the given dates.
|
||||
*
|
||||
* @description
|
||||
* Get the number of milliseconds between the given dates.
|
||||
*
|
||||
* @param {Date|Number} dateLeft - the later date
|
||||
* @param {Date|Number} dateRight - the earlier date
|
||||
* @returns {Number} the number of milliseconds
|
||||
* @throws {TypeError} 2 arguments required
|
||||
*
|
||||
* @example
|
||||
* // How many milliseconds are between
|
||||
* // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
|
||||
* const result = differenceInMilliseconds(
|
||||
* new Date(2014, 6, 2, 12, 30, 21, 700),
|
||||
* new Date(2014, 6, 2, 12, 30, 20, 600)
|
||||
* )
|
||||
* //=> 1100
|
||||
*/
|
||||
export default function differenceInMilliseconds(dateLeft, dateRight) {
|
||||
requiredArgs(2, arguments);
|
||||
return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
|
||||
}
|
||||
Generated
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
import { millisecondsInMinute } from "../constants/index.js";
|
||||
import differenceInMilliseconds from "../differenceInMilliseconds/index.js";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
import { getRoundingMethod } from "../_lib/roundingMethods/index.js";
|
||||
/**
|
||||
* @name differenceInMinutes
|
||||
* @category Minute Helpers
|
||||
* @summary Get the number of minutes between the given dates.
|
||||
*
|
||||
* @description
|
||||
* Get the signed number of full (rounded towards 0) minutes between the given dates.
|
||||
*
|
||||
* @param {Date|Number} dateLeft - the later date
|
||||
* @param {Date|Number} dateRight - the earlier date
|
||||
* @param {Object} [options] - an object with options.
|
||||
* @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
|
||||
* @returns {Number} the number of minutes
|
||||
* @throws {TypeError} 2 arguments required
|
||||
*
|
||||
* @example
|
||||
* // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?
|
||||
* const result = differenceInMinutes(
|
||||
* new Date(2014, 6, 2, 12, 20, 0),
|
||||
* new Date(2014, 6, 2, 12, 7, 59)
|
||||
* )
|
||||
* //=> 12
|
||||
*
|
||||
* @example
|
||||
* // How many minutes are between 10:01:59 and 10:00:00
|
||||
* const result = differenceInMinutes(
|
||||
* new Date(2000, 0, 1, 10, 0, 0),
|
||||
* new Date(2000, 0, 1, 10, 1, 59)
|
||||
* )
|
||||
* //=> -1
|
||||
*/
|
||||
export default function differenceInMinutes(dateLeft, dateRight, options) {
|
||||
requiredArgs(2, arguments);
|
||||
var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;
|
||||
return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
|
||||
}
|
||||
Generated
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
import differenceInMilliseconds from "../differenceInMilliseconds/index.js";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
import { getRoundingMethod } from "../_lib/roundingMethods/index.js";
|
||||
/**
|
||||
* @name differenceInSeconds
|
||||
* @category Second Helpers
|
||||
* @summary Get the number of seconds between the given dates.
|
||||
*
|
||||
* @description
|
||||
* Get the number of seconds between the given dates.
|
||||
*
|
||||
* @param {Date|Number} dateLeft - the later date
|
||||
* @param {Date|Number} dateRight - the earlier date
|
||||
* @param {Object} [options] - an object with options.
|
||||
* @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
|
||||
* @returns {Number} the number of seconds
|
||||
* @throws {TypeError} 2 arguments required
|
||||
*
|
||||
* @example
|
||||
* // How many seconds are between
|
||||
* // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
|
||||
* const result = differenceInSeconds(
|
||||
* new Date(2014, 6, 2, 12, 30, 20, 0),
|
||||
* new Date(2014, 6, 2, 12, 30, 7, 999)
|
||||
* )
|
||||
* //=> 12
|
||||
*/
|
||||
export default function differenceInSeconds(dateLeft, dateRight, options) {
|
||||
requiredArgs(2, arguments);
|
||||
var diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;
|
||||
return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
|
||||
}
|
||||
Generated
Vendored
+190
@@ -0,0 +1,190 @@
|
||||
import { getDefaultOptions } from "../_lib/defaultOptions/index.js";
|
||||
import getTimezoneOffsetInMilliseconds from "../_lib/getTimezoneOffsetInMilliseconds/index.js";
|
||||
import compareAsc from "../compareAsc/index.js";
|
||||
import toDate from "../toDate/index.js";
|
||||
import cloneObject from "../_lib/cloneObject/index.js";
|
||||
import assign from "../_lib/assign/index.js";
|
||||
import defaultLocale from "../_lib/defaultLocale/index.js";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
var MILLISECONDS_IN_MINUTE = 1000 * 60;
|
||||
var MINUTES_IN_DAY = 60 * 24;
|
||||
var MINUTES_IN_MONTH = MINUTES_IN_DAY * 30;
|
||||
var MINUTES_IN_YEAR = MINUTES_IN_DAY * 365;
|
||||
|
||||
/**
|
||||
* @name formatDistanceStrict
|
||||
* @category Common Helpers
|
||||
* @summary Return the distance between the given dates in words.
|
||||
*
|
||||
* @description
|
||||
* Return the distance between the given dates in words, using strict units.
|
||||
* This is like `formatDistance`, but does not use helpers like 'almost', 'over',
|
||||
* 'less than' and the like.
|
||||
*
|
||||
* | Distance between dates | Result |
|
||||
* |------------------------|---------------------|
|
||||
* | 0 ... 59 secs | [0..59] seconds |
|
||||
* | 1 ... 59 mins | [1..59] minutes |
|
||||
* | 1 ... 23 hrs | [1..23] hours |
|
||||
* | 1 ... 29 days | [1..29] days |
|
||||
* | 1 ... 11 months | [1..11] months |
|
||||
* | 1 ... N years | [1..N] years |
|
||||
*
|
||||
* @param {Date|Number} date - the date
|
||||
* @param {Date|Number} baseDate - the date to compare with
|
||||
* @param {Object} [options] - an object with options.
|
||||
* @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first
|
||||
* @param {'second'|'minute'|'hour'|'day'|'month'|'year'} [options.unit] - if specified, will force a unit
|
||||
* @param {'floor'|'ceil'|'round'} [options.roundingMethod='round'] - which way to round partial units
|
||||
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
|
||||
* @returns {String} the distance in words
|
||||
* @throws {TypeError} 2 arguments required
|
||||
* @throws {RangeError} `date` must not be Invalid Date
|
||||
* @throws {RangeError} `baseDate` must not be Invalid Date
|
||||
* @throws {RangeError} `options.roundingMethod` must be 'floor', 'ceil' or 'round'
|
||||
* @throws {RangeError} `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'
|
||||
* @throws {RangeError} `options.locale` must contain `formatDistance` property
|
||||
*
|
||||
* @example
|
||||
* // What is the distance between 2 July 2014 and 1 January 2015?
|
||||
* const result = formatDistanceStrict(new Date(2014, 6, 2), new Date(2015, 0, 2))
|
||||
* //=> '6 months'
|
||||
*
|
||||
* @example
|
||||
* // What is the distance between 1 January 2015 00:00:15
|
||||
* // and 1 January 2015 00:00:00?
|
||||
* const result = formatDistanceStrict(
|
||||
* new Date(2015, 0, 1, 0, 0, 15),
|
||||
* new Date(2015, 0, 1, 0, 0, 0)
|
||||
* )
|
||||
* //=> '15 seconds'
|
||||
*
|
||||
* @example
|
||||
* // What is the distance from 1 January 2016
|
||||
* // to 1 January 2015, with a suffix?
|
||||
* const result = formatDistanceStrict(new Date(2015, 0, 1), new Date(2016, 0, 1), {
|
||||
* addSuffix: true
|
||||
* })
|
||||
* //=> '1 year ago'
|
||||
*
|
||||
* @example
|
||||
* // What is the distance from 1 January 2016
|
||||
* // to 1 January 2015, in minutes?
|
||||
* const result = formatDistanceStrict(new Date(2016, 0, 1), new Date(2015, 0, 1), {
|
||||
* unit: 'minute'
|
||||
* })
|
||||
* //=> '525600 minutes'
|
||||
*
|
||||
* @example
|
||||
* // What is the distance from 1 January 2015
|
||||
* // to 28 January 2015, in months, rounded up?
|
||||
* const result = formatDistanceStrict(new Date(2015, 0, 28), new Date(2015, 0, 1), {
|
||||
* unit: 'month',
|
||||
* roundingMethod: 'ceil'
|
||||
* })
|
||||
* //=> '1 month'
|
||||
*
|
||||
* @example
|
||||
* // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?
|
||||
* import { eoLocale } from 'date-fns/locale/eo'
|
||||
* const result = formatDistanceStrict(new Date(2016, 7, 1), new Date(2015, 0, 1), {
|
||||
* locale: eoLocale
|
||||
* })
|
||||
* //=> '1 jaro'
|
||||
*/
|
||||
|
||||
export default function formatDistanceStrict(dirtyDate, dirtyBaseDate, options) {
|
||||
var _ref, _options$locale, _options$roundingMeth;
|
||||
requiredArgs(2, arguments);
|
||||
var defaultOptions = getDefaultOptions();
|
||||
var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
|
||||
if (!locale.formatDistance) {
|
||||
throw new RangeError('locale must contain localize.formatDistance property');
|
||||
}
|
||||
var comparison = compareAsc(dirtyDate, dirtyBaseDate);
|
||||
if (isNaN(comparison)) {
|
||||
throw new RangeError('Invalid time value');
|
||||
}
|
||||
var localizeOptions = assign(cloneObject(options), {
|
||||
addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix),
|
||||
comparison: comparison
|
||||
});
|
||||
var dateLeft;
|
||||
var dateRight;
|
||||
if (comparison > 0) {
|
||||
dateLeft = toDate(dirtyBaseDate);
|
||||
dateRight = toDate(dirtyDate);
|
||||
} else {
|
||||
dateLeft = toDate(dirtyDate);
|
||||
dateRight = toDate(dirtyBaseDate);
|
||||
}
|
||||
var roundingMethod = String((_options$roundingMeth = options === null || options === void 0 ? void 0 : options.roundingMethod) !== null && _options$roundingMeth !== void 0 ? _options$roundingMeth : 'round');
|
||||
var roundingMethodFn;
|
||||
if (roundingMethod === 'floor') {
|
||||
roundingMethodFn = Math.floor;
|
||||
} else if (roundingMethod === 'ceil') {
|
||||
roundingMethodFn = Math.ceil;
|
||||
} else if (roundingMethod === 'round') {
|
||||
roundingMethodFn = Math.round;
|
||||
} else {
|
||||
throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'");
|
||||
}
|
||||
var milliseconds = dateRight.getTime() - dateLeft.getTime();
|
||||
var minutes = milliseconds / MILLISECONDS_IN_MINUTE;
|
||||
var timezoneOffset = getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft);
|
||||
|
||||
// Use DST-normalized difference in minutes for years, months and days;
|
||||
// use regular difference in minutes for hours, minutes and seconds.
|
||||
var dstNormalizedMinutes = (milliseconds - timezoneOffset) / MILLISECONDS_IN_MINUTE;
|
||||
var defaultUnit = options === null || options === void 0 ? void 0 : options.unit;
|
||||
var unit;
|
||||
if (!defaultUnit) {
|
||||
if (minutes < 1) {
|
||||
unit = 'second';
|
||||
} else if (minutes < 60) {
|
||||
unit = 'minute';
|
||||
} else if (minutes < MINUTES_IN_DAY) {
|
||||
unit = 'hour';
|
||||
} else if (dstNormalizedMinutes < MINUTES_IN_MONTH) {
|
||||
unit = 'day';
|
||||
} else if (dstNormalizedMinutes < MINUTES_IN_YEAR) {
|
||||
unit = 'month';
|
||||
} else {
|
||||
unit = 'year';
|
||||
}
|
||||
} else {
|
||||
unit = String(defaultUnit);
|
||||
}
|
||||
|
||||
// 0 up to 60 seconds
|
||||
if (unit === 'second') {
|
||||
var seconds = roundingMethodFn(milliseconds / 1000);
|
||||
return locale.formatDistance('xSeconds', seconds, localizeOptions);
|
||||
|
||||
// 1 up to 60 mins
|
||||
} else if (unit === 'minute') {
|
||||
var roundedMinutes = roundingMethodFn(minutes);
|
||||
return locale.formatDistance('xMinutes', roundedMinutes, localizeOptions);
|
||||
|
||||
// 1 up to 24 hours
|
||||
} else if (unit === 'hour') {
|
||||
var hours = roundingMethodFn(minutes / 60);
|
||||
return locale.formatDistance('xHours', hours, localizeOptions);
|
||||
|
||||
// 1 up to 30 days
|
||||
} else if (unit === 'day') {
|
||||
var days = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_DAY);
|
||||
return locale.formatDistance('xDays', days, localizeOptions);
|
||||
|
||||
// 1 up to 12 months
|
||||
} else if (unit === 'month') {
|
||||
var months = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_MONTH);
|
||||
return months === 12 && defaultUnit !== 'month' ? locale.formatDistance('xYears', 1, localizeOptions) : locale.formatDistance('xMonths', months, localizeOptions);
|
||||
|
||||
// 1 year up to max Date
|
||||
} else if (unit === 'year') {
|
||||
var years = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_YEAR);
|
||||
return locale.formatDistance('xYears', years, localizeOptions);
|
||||
}
|
||||
throw new RangeError("unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'");
|
||||
}
|
||||
Generated
Vendored
+100
@@ -0,0 +1,100 @@
|
||||
import toDate from "../toDate/index.js";
|
||||
import addLeadingZeros from "../_lib/addLeadingZeros/index.js";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
/**
|
||||
* @name formatISO
|
||||
* @category Common Helpers
|
||||
* @summary Format the date according to the ISO 8601 standard (https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm).
|
||||
*
|
||||
* @description
|
||||
* Return the formatted date string in ISO 8601 format. Options may be passed to control the parts and notations of the date.
|
||||
*
|
||||
* @param {Date|Number} date - the original date
|
||||
* @param {Object} [options] - an object with options.
|
||||
* @param {'extended'|'basic'} [options.format='extended'] - if 'basic', hide delimiters between date and time values.
|
||||
* @param {'complete'|'date'|'time'} [options.representation='complete'] - format date, time with local time zone, or both.
|
||||
* @returns {String} the formatted date string (in local time zone)
|
||||
* @throws {TypeError} 1 argument required
|
||||
* @throws {RangeError} `date` must not be Invalid Date
|
||||
* @throws {RangeError} `options.format` must be 'extended' or 'basic'
|
||||
* @throws {RangeError} `options.representation` must be 'date', 'time' or 'complete'
|
||||
*
|
||||
* @example
|
||||
* // Represent 18 September 2019 in ISO 8601 format (local time zone is UTC):
|
||||
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52))
|
||||
* //=> '2019-09-18T19:00:52Z'
|
||||
*
|
||||
* @example
|
||||
* // Represent 18 September 2019 in ISO 8601, short format (local time zone is UTC):
|
||||
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' })
|
||||
* //=> '20190918T190052'
|
||||
*
|
||||
* @example
|
||||
* // Represent 18 September 2019 in ISO 8601 format, date only:
|
||||
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' })
|
||||
* //=> '2019-09-18'
|
||||
*
|
||||
* @example
|
||||
* // Represent 18 September 2019 in ISO 8601 format, time only (local time zone is UTC):
|
||||
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' })
|
||||
* //=> '19:00:52Z'
|
||||
*/
|
||||
export default function formatISO(date, options) {
|
||||
var _options$format, _options$representati;
|
||||
requiredArgs(1, arguments);
|
||||
var originalDate = toDate(date);
|
||||
if (isNaN(originalDate.getTime())) {
|
||||
throw new RangeError('Invalid time value');
|
||||
}
|
||||
var format = String((_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : 'extended');
|
||||
var representation = String((_options$representati = options === null || options === void 0 ? void 0 : options.representation) !== null && _options$representati !== void 0 ? _options$representati : 'complete');
|
||||
if (format !== 'extended' && format !== 'basic') {
|
||||
throw new RangeError("format must be 'extended' or 'basic'");
|
||||
}
|
||||
if (representation !== 'date' && representation !== 'time' && representation !== 'complete') {
|
||||
throw new RangeError("representation must be 'date', 'time', or 'complete'");
|
||||
}
|
||||
var result = '';
|
||||
var tzOffset = '';
|
||||
var dateDelimiter = format === 'extended' ? '-' : '';
|
||||
var timeDelimiter = format === 'extended' ? ':' : '';
|
||||
|
||||
// Representation is either 'date' or 'complete'
|
||||
if (representation !== 'time') {
|
||||
var day = addLeadingZeros(originalDate.getDate(), 2);
|
||||
var month = addLeadingZeros(originalDate.getMonth() + 1, 2);
|
||||
var year = addLeadingZeros(originalDate.getFullYear(), 4);
|
||||
|
||||
// yyyyMMdd or yyyy-MM-dd.
|
||||
result = "".concat(year).concat(dateDelimiter).concat(month).concat(dateDelimiter).concat(day);
|
||||
}
|
||||
|
||||
// Representation is either 'time' or 'complete'
|
||||
if (representation !== 'date') {
|
||||
// Add the timezone.
|
||||
var offset = originalDate.getTimezoneOffset();
|
||||
if (offset !== 0) {
|
||||
var absoluteOffset = Math.abs(offset);
|
||||
var hourOffset = addLeadingZeros(Math.floor(absoluteOffset / 60), 2);
|
||||
var minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);
|
||||
// If less than 0, the sign is +, because it is ahead of time.
|
||||
var sign = offset < 0 ? '+' : '-';
|
||||
tzOffset = "".concat(sign).concat(hourOffset, ":").concat(minuteOffset);
|
||||
} else {
|
||||
tzOffset = 'Z';
|
||||
}
|
||||
var hour = addLeadingZeros(originalDate.getHours(), 2);
|
||||
var minute = addLeadingZeros(originalDate.getMinutes(), 2);
|
||||
var second = addLeadingZeros(originalDate.getSeconds(), 2);
|
||||
|
||||
// If there's also date, separate it with time with 'T'
|
||||
var separator = result === '' ? '' : 'T';
|
||||
|
||||
// Creates a time string consisting of hour, minute, and second, separated by delimiters, if defined.
|
||||
var time = [hour, minute, second].join(timeDelimiter);
|
||||
|
||||
// HHmmss or HH:mm:ss.
|
||||
result = "".concat(result).concat(separator).concat(time).concat(tzOffset);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Generated
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
/**
|
||||
* @name isDate
|
||||
* @category Common Helpers
|
||||
* @summary Is the given value a date?
|
||||
*
|
||||
* @description
|
||||
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
||||
*
|
||||
* @param {*} value - the value to check
|
||||
* @returns {boolean} true if the given value is a date
|
||||
* @throws {TypeError} 1 arguments required
|
||||
*
|
||||
* @example
|
||||
* // For a valid date:
|
||||
* const result = isDate(new Date())
|
||||
* //=> true
|
||||
*
|
||||
* @example
|
||||
* // For an invalid date:
|
||||
* const result = isDate(new Date(NaN))
|
||||
* //=> true
|
||||
*
|
||||
* @example
|
||||
* // For some value:
|
||||
* const result = isDate('2014-02-31')
|
||||
* //=> false
|
||||
*
|
||||
* @example
|
||||
* // For an object:
|
||||
* const result = isDate({})
|
||||
* //=> false
|
||||
*/
|
||||
export default function isDate(value) {
|
||||
requiredArgs(1, arguments);
|
||||
return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
|
||||
}
|
||||
Generated
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
import isDate from "../isDate/index.js";
|
||||
import toDate from "../toDate/index.js";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
/**
|
||||
* @name isValid
|
||||
* @category Common Helpers
|
||||
* @summary Is the given date valid?
|
||||
*
|
||||
* @description
|
||||
* Returns false if argument is Invalid Date and true otherwise.
|
||||
* Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
||||
* Invalid Date is a Date, whose time value is NaN.
|
||||
*
|
||||
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
||||
*
|
||||
* @param {*} date - the date to check
|
||||
* @returns {Boolean} the date is valid
|
||||
* @throws {TypeError} 1 argument required
|
||||
*
|
||||
* @example
|
||||
* // For the valid date:
|
||||
* const result = isValid(new Date(2014, 1, 31))
|
||||
* //=> true
|
||||
*
|
||||
* @example
|
||||
* // For the value, convertable into a date:
|
||||
* const result = isValid(1393804800000)
|
||||
* //=> true
|
||||
*
|
||||
* @example
|
||||
* // For the invalid date:
|
||||
* const result = isValid(new Date(''))
|
||||
* //=> false
|
||||
*/
|
||||
export default function isValid(dirtyDate) {
|
||||
requiredArgs(1, arguments);
|
||||
if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
|
||||
return false;
|
||||
}
|
||||
var date = toDate(dirtyDate);
|
||||
return !isNaN(Number(date));
|
||||
}
|
||||
Generated
Vendored
+118
@@ -0,0 +1,118 @@
|
||||
import toDate from "../toDate/index.js";
|
||||
import formatters from "../_lib/format/lightFormatters/index.js";
|
||||
import getTimezoneOffsetInMilliseconds from "../_lib/getTimezoneOffsetInMilliseconds/index.js";
|
||||
import isValid from "../isValid/index.js";
|
||||
import subMilliseconds from "../subMilliseconds/index.js";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js"; // This RegExp consists of three parts separated by `|`:
|
||||
// - (\w)\1* matches any sequences of the same letter
|
||||
// - '' matches two quote characters in a row
|
||||
// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
|
||||
// except a single quote symbol, which ends the sequence.
|
||||
// Two quote characters do not end the sequence.
|
||||
// If there is no matching single quote
|
||||
// then the sequence will continue until the end of the string.
|
||||
// - . matches any single character unmatched by previous parts of the RegExps
|
||||
var formattingTokensRegExp = /(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
||||
var escapedStringRegExp = /^'([^]*?)'?$/;
|
||||
var doubleQuoteRegExp = /''/g;
|
||||
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
||||
|
||||
/**
|
||||
* @name lightFormat
|
||||
* @category Common Helpers
|
||||
* @summary Format the date.
|
||||
*
|
||||
* @description
|
||||
* Return the formatted date string in the given format. Unlike `format`,
|
||||
* `lightFormat` doesn't use locales and outputs date using the most popular tokens.
|
||||
*
|
||||
* > ⚠️ Please note that the `lightFormat` tokens differ from Moment.js and other libraries.
|
||||
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
||||
*
|
||||
* The characters wrapped between two single quotes characters (') are escaped.
|
||||
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
||||
*
|
||||
* Format of the string is based on Unicode Technical Standard #35:
|
||||
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
||||
*
|
||||
* Accepted patterns:
|
||||
* | Unit | Pattern | Result examples |
|
||||
* |---------------------------------|---------|-----------------------------------|
|
||||
* | AM, PM | a..aaa | AM, PM |
|
||||
* | | aaaa | a.m., p.m. |
|
||||
* | | aaaaa | a, p |
|
||||
* | Calendar year | y | 44, 1, 1900, 2017 |
|
||||
* | | yy | 44, 01, 00, 17 |
|
||||
* | | yyy | 044, 001, 000, 017 |
|
||||
* | | yyyy | 0044, 0001, 1900, 2017 |
|
||||
* | Month (formatting) | M | 1, 2, ..., 12 |
|
||||
* | | MM | 01, 02, ..., 12 |
|
||||
* | Day of month | d | 1, 2, ..., 31 |
|
||||
* | | dd | 01, 02, ..., 31 |
|
||||
* | Hour [1-12] | h | 1, 2, ..., 11, 12 |
|
||||
* | | hh | 01, 02, ..., 11, 12 |
|
||||
* | Hour [0-23] | H | 0, 1, 2, ..., 23 |
|
||||
* | | HH | 00, 01, 02, ..., 23 |
|
||||
* | Minute | m | 0, 1, ..., 59 |
|
||||
* | | mm | 00, 01, ..., 59 |
|
||||
* | Second | s | 0, 1, ..., 59 |
|
||||
* | | ss | 00, 01, ..., 59 |
|
||||
* | Fraction of second | S | 0, 1, ..., 9 |
|
||||
* | | SS | 00, 01, ..., 99 |
|
||||
* | | SSS | 000, 001, ..., 999 |
|
||||
* | | SSSS | ... |
|
||||
*
|
||||
* @param {Date|Number} date - the original date
|
||||
* @param {String} format - the string of tokens
|
||||
* @returns {String} the formatted date string
|
||||
* @throws {TypeError} 2 arguments required
|
||||
* @throws {RangeError} format string contains an unescaped latin alphabet character
|
||||
*
|
||||
* @example
|
||||
* const result = lightFormat(new Date(2014, 1, 11), 'yyyy-MM-dd')
|
||||
* //=> '2014-02-11'
|
||||
*/
|
||||
|
||||
export default function lightFormat(dirtyDate, formatStr) {
|
||||
requiredArgs(2, arguments);
|
||||
var originalDate = toDate(dirtyDate);
|
||||
if (!isValid(originalDate)) {
|
||||
throw new RangeError('Invalid time value');
|
||||
}
|
||||
|
||||
// Convert the date in system timezone to the same date in UTC+00:00 timezone.
|
||||
// This ensures that when UTC functions will be implemented, locales will be compatible with them.
|
||||
// See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
|
||||
var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
|
||||
var utcDate = subMilliseconds(originalDate, timezoneOffset);
|
||||
var tokens = formatStr.match(formattingTokensRegExp);
|
||||
|
||||
// The only case when formattingTokensRegExp doesn't match the string is when it's empty
|
||||
if (!tokens) return '';
|
||||
var result = tokens.map(function (substring) {
|
||||
// Replace two single quote characters with one single quote character
|
||||
if (substring === "''") {
|
||||
return "'";
|
||||
}
|
||||
var firstCharacter = substring[0];
|
||||
if (firstCharacter === "'") {
|
||||
return cleanEscapedString(substring);
|
||||
}
|
||||
var formatter = formatters[firstCharacter];
|
||||
if (formatter) {
|
||||
return formatter(utcDate, substring);
|
||||
}
|
||||
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
||||
throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
|
||||
}
|
||||
return substring;
|
||||
}).join('');
|
||||
return result;
|
||||
}
|
||||
function cleanEscapedString(input) {
|
||||
var matches = input.match(escapedStringRegExp);
|
||||
if (!matches) {
|
||||
return input;
|
||||
}
|
||||
return matches[1].replace(doubleQuoteRegExp, "'");
|
||||
}
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
export default function buildFormatLongFn(args) {
|
||||
return function () {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
// TODO: Remove String()
|
||||
var width = options.width ? String(options.width) : args.defaultWidth;
|
||||
var format = args.formats[width] || args.formats[args.defaultWidth];
|
||||
return format;
|
||||
};
|
||||
}
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
export default function buildLocalizeFn(args) {
|
||||
return function (dirtyIndex, options) {
|
||||
var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
|
||||
var valuesArray;
|
||||
if (context === 'formatting' && args.formattingValues) {
|
||||
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
||||
var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
|
||||
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
||||
} else {
|
||||
var _defaultWidth = args.defaultWidth;
|
||||
var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
|
||||
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
||||
}
|
||||
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
|
||||
// @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
|
||||
return valuesArray[index];
|
||||
};
|
||||
}
|
||||
Generated
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
export default function buildMatchFn(args) {
|
||||
return function (string) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var width = options.width;
|
||||
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
||||
var matchResult = string.match(matchPattern);
|
||||
if (!matchResult) {
|
||||
return null;
|
||||
}
|
||||
var matchedString = matchResult[0];
|
||||
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
||||
var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
|
||||
return pattern.test(matchedString);
|
||||
}) : findKey(parsePatterns, function (pattern) {
|
||||
return pattern.test(matchedString);
|
||||
});
|
||||
var value;
|
||||
value = args.valueCallback ? args.valueCallback(key) : key;
|
||||
value = options.valueCallback ? options.valueCallback(value) : value;
|
||||
var rest = string.slice(matchedString.length);
|
||||
return {
|
||||
value: value,
|
||||
rest: rest
|
||||
};
|
||||
};
|
||||
}
|
||||
function findKey(object, predicate) {
|
||||
for (var key in object) {
|
||||
if (object.hasOwnProperty(key) && predicate(object[key])) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function findIndex(array, predicate) {
|
||||
for (var key = 0; key < array.length; key++) {
|
||||
if (predicate(array[key])) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
export default function buildMatchPatternFn(args) {
|
||||
return function (string) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var matchResult = string.match(args.matchPattern);
|
||||
if (!matchResult) return null;
|
||||
var matchedString = matchResult[0];
|
||||
var parseResult = string.match(args.parsePattern);
|
||||
if (!parseResult) return null;
|
||||
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
||||
value = options.valueCallback ? options.valueCallback(value) : value;
|
||||
var rest = string.slice(matchedString.length);
|
||||
return {
|
||||
value: value,
|
||||
rest: rest
|
||||
};
|
||||
};
|
||||
}
|
||||
Generated
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
var formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: 'less than a second',
|
||||
other: 'less than {{count}} seconds'
|
||||
},
|
||||
xSeconds: {
|
||||
one: '1 second',
|
||||
other: '{{count}} seconds'
|
||||
},
|
||||
halfAMinute: 'half a minute',
|
||||
lessThanXMinutes: {
|
||||
one: 'less than a minute',
|
||||
other: 'less than {{count}} minutes'
|
||||
},
|
||||
xMinutes: {
|
||||
one: '1 minute',
|
||||
other: '{{count}} minutes'
|
||||
},
|
||||
aboutXHours: {
|
||||
one: 'about 1 hour',
|
||||
other: 'about {{count}} hours'
|
||||
},
|
||||
xHours: {
|
||||
one: '1 hour',
|
||||
other: '{{count}} hours'
|
||||
},
|
||||
xDays: {
|
||||
one: '1 day',
|
||||
other: '{{count}} days'
|
||||
},
|
||||
aboutXWeeks: {
|
||||
one: 'about 1 week',
|
||||
other: 'about {{count}} weeks'
|
||||
},
|
||||
xWeeks: {
|
||||
one: '1 week',
|
||||
other: '{{count}} weeks'
|
||||
},
|
||||
aboutXMonths: {
|
||||
one: 'about 1 month',
|
||||
other: 'about {{count}} months'
|
||||
},
|
||||
xMonths: {
|
||||
one: '1 month',
|
||||
other: '{{count}} months'
|
||||
},
|
||||
aboutXYears: {
|
||||
one: 'about 1 year',
|
||||
other: 'about {{count}} years'
|
||||
},
|
||||
xYears: {
|
||||
one: '1 year',
|
||||
other: '{{count}} years'
|
||||
},
|
||||
overXYears: {
|
||||
one: 'over 1 year',
|
||||
other: 'over {{count}} years'
|
||||
},
|
||||
almostXYears: {
|
||||
one: 'almost 1 year',
|
||||
other: 'almost {{count}} years'
|
||||
}
|
||||
};
|
||||
var formatDistance = function formatDistance(token, count, options) {
|
||||
var result;
|
||||
var tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === 'string') {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
result = tokenValue.one;
|
||||
} else {
|
||||
result = tokenValue.other.replace('{{count}}', count.toString());
|
||||
}
|
||||
if (options !== null && options !== void 0 && options.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return 'in ' + result;
|
||||
} else {
|
||||
return result + ' ago';
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
export default formatDistance;
|
||||
Generated
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
import buildFormatLongFn from "../../../_lib/buildFormatLongFn/index.js";
|
||||
var dateFormats = {
|
||||
full: 'EEEE, MMMM do, y',
|
||||
long: 'MMMM do, y',
|
||||
medium: 'MMM d, y',
|
||||
short: 'MM/dd/yyyy'
|
||||
};
|
||||
var timeFormats = {
|
||||
full: 'h:mm:ss a zzzz',
|
||||
long: 'h:mm:ss a z',
|
||||
medium: 'h:mm:ss a',
|
||||
short: 'h:mm a'
|
||||
};
|
||||
var dateTimeFormats = {
|
||||
full: "{{date}} 'at' {{time}}",
|
||||
long: "{{date}} 'at' {{time}}",
|
||||
medium: '{{date}}, {{time}}',
|
||||
short: '{{date}}, {{time}}'
|
||||
};
|
||||
var formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: 'full'
|
||||
}),
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: 'full'
|
||||
}),
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: 'full'
|
||||
})
|
||||
};
|
||||
export default formatLong;
|
||||
Generated
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
var formatRelativeLocale = {
|
||||
lastWeek: "'last' eeee 'at' p",
|
||||
yesterday: "'yesterday at' p",
|
||||
today: "'today at' p",
|
||||
tomorrow: "'tomorrow at' p",
|
||||
nextWeek: "eeee 'at' p",
|
||||
other: 'P'
|
||||
};
|
||||
var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
|
||||
return formatRelativeLocale[token];
|
||||
};
|
||||
export default formatRelative;
|
||||
Generated
Vendored
+143
@@ -0,0 +1,143 @@
|
||||
import buildLocalizeFn from "../../../_lib/buildLocalizeFn/index.js";
|
||||
var eraValues = {
|
||||
narrow: ['B', 'A'],
|
||||
abbreviated: ['BC', 'AD'],
|
||||
wide: ['Before Christ', 'Anno Domini']
|
||||
};
|
||||
var quarterValues = {
|
||||
narrow: ['1', '2', '3', '4'],
|
||||
abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
|
||||
wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
|
||||
};
|
||||
|
||||
// Note: in English, the names of days of the week and months are capitalized.
|
||||
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
|
||||
// Generally, formatted dates should look like they are in the middle of a sentence,
|
||||
// e.g. in Spanish language the weekdays and months should be in the lowercase.
|
||||
var monthValues = {
|
||||
narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
|
||||
abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
||||
};
|
||||
var dayValues = {
|
||||
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
||||
short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
||||
abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
||||
wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
||||
};
|
||||
var dayPeriodValues = {
|
||||
narrow: {
|
||||
am: 'a',
|
||||
pm: 'p',
|
||||
midnight: 'mi',
|
||||
noon: 'n',
|
||||
morning: 'morning',
|
||||
afternoon: 'afternoon',
|
||||
evening: 'evening',
|
||||
night: 'night'
|
||||
},
|
||||
abbreviated: {
|
||||
am: 'AM',
|
||||
pm: 'PM',
|
||||
midnight: 'midnight',
|
||||
noon: 'noon',
|
||||
morning: 'morning',
|
||||
afternoon: 'afternoon',
|
||||
evening: 'evening',
|
||||
night: 'night'
|
||||
},
|
||||
wide: {
|
||||
am: 'a.m.',
|
||||
pm: 'p.m.',
|
||||
midnight: 'midnight',
|
||||
noon: 'noon',
|
||||
morning: 'morning',
|
||||
afternoon: 'afternoon',
|
||||
evening: 'evening',
|
||||
night: 'night'
|
||||
}
|
||||
};
|
||||
var formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: 'a',
|
||||
pm: 'p',
|
||||
midnight: 'mi',
|
||||
noon: 'n',
|
||||
morning: 'in the morning',
|
||||
afternoon: 'in the afternoon',
|
||||
evening: 'in the evening',
|
||||
night: 'at night'
|
||||
},
|
||||
abbreviated: {
|
||||
am: 'AM',
|
||||
pm: 'PM',
|
||||
midnight: 'midnight',
|
||||
noon: 'noon',
|
||||
morning: 'in the morning',
|
||||
afternoon: 'in the afternoon',
|
||||
evening: 'in the evening',
|
||||
night: 'at night'
|
||||
},
|
||||
wide: {
|
||||
am: 'a.m.',
|
||||
pm: 'p.m.',
|
||||
midnight: 'midnight',
|
||||
noon: 'noon',
|
||||
morning: 'in the morning',
|
||||
afternoon: 'in the afternoon',
|
||||
evening: 'in the evening',
|
||||
night: 'at night'
|
||||
}
|
||||
};
|
||||
var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
|
||||
var number = Number(dirtyNumber);
|
||||
|
||||
// If ordinal numbers depend on context, for example,
|
||||
// if they are different for different grammatical genders,
|
||||
// use `options.unit`.
|
||||
//
|
||||
// `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
|
||||
// 'day', 'hour', 'minute', 'second'.
|
||||
|
||||
var rem100 = number % 100;
|
||||
if (rem100 > 20 || rem100 < 10) {
|
||||
switch (rem100 % 10) {
|
||||
case 1:
|
||||
return number + 'st';
|
||||
case 2:
|
||||
return number + 'nd';
|
||||
case 3:
|
||||
return number + 'rd';
|
||||
}
|
||||
}
|
||||
return number + 'th';
|
||||
};
|
||||
var localize = {
|
||||
ordinalNumber: ordinalNumber,
|
||||
era: buildLocalizeFn({
|
||||
values: eraValues,
|
||||
defaultWidth: 'wide'
|
||||
}),
|
||||
quarter: buildLocalizeFn({
|
||||
values: quarterValues,
|
||||
defaultWidth: 'wide',
|
||||
argumentCallback: function argumentCallback(quarter) {
|
||||
return quarter - 1;
|
||||
}
|
||||
}),
|
||||
month: buildLocalizeFn({
|
||||
values: monthValues,
|
||||
defaultWidth: 'wide'
|
||||
}),
|
||||
day: buildLocalizeFn({
|
||||
values: dayValues,
|
||||
defaultWidth: 'wide'
|
||||
}),
|
||||
dayPeriod: buildLocalizeFn({
|
||||
values: dayPeriodValues,
|
||||
defaultWidth: 'wide',
|
||||
formattingValues: formattingDayPeriodValues,
|
||||
defaultFormattingWidth: 'wide'
|
||||
})
|
||||
};
|
||||
export default localize;
|
||||
Generated
Vendored
+98
@@ -0,0 +1,98 @@
|
||||
import buildMatchFn from "../../../_lib/buildMatchFn/index.js";
|
||||
import buildMatchPatternFn from "../../../_lib/buildMatchPatternFn/index.js";
|
||||
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
||||
var parseOrdinalNumberPattern = /\d+/i;
|
||||
var matchEraPatterns = {
|
||||
narrow: /^(b|a)/i,
|
||||
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
||||
wide: /^(before christ|before common era|anno domini|common era)/i
|
||||
};
|
||||
var parseEraPatterns = {
|
||||
any: [/^b/i, /^(a|c)/i]
|
||||
};
|
||||
var matchQuarterPatterns = {
|
||||
narrow: /^[1234]/i,
|
||||
abbreviated: /^q[1234]/i,
|
||||
wide: /^[1234](th|st|nd|rd)? quarter/i
|
||||
};
|
||||
var parseQuarterPatterns = {
|
||||
any: [/1/i, /2/i, /3/i, /4/i]
|
||||
};
|
||||
var matchMonthPatterns = {
|
||||
narrow: /^[jfmasond]/i,
|
||||
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
||||
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
||||
};
|
||||
var parseMonthPatterns = {
|
||||
narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
|
||||
any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
|
||||
};
|
||||
var matchDayPatterns = {
|
||||
narrow: /^[smtwf]/i,
|
||||
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
||||
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
||||
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
||||
};
|
||||
var parseDayPatterns = {
|
||||
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
||||
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
||||
};
|
||||
var matchDayPeriodPatterns = {
|
||||
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
||||
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
||||
};
|
||||
var parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^a/i,
|
||||
pm: /^p/i,
|
||||
midnight: /^mi/i,
|
||||
noon: /^no/i,
|
||||
morning: /morning/i,
|
||||
afternoon: /afternoon/i,
|
||||
evening: /evening/i,
|
||||
night: /night/i
|
||||
}
|
||||
};
|
||||
var match = {
|
||||
ordinalNumber: buildMatchPatternFn({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: function valueCallback(value) {
|
||||
return parseInt(value, 10);
|
||||
}
|
||||
}),
|
||||
era: buildMatchFn({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: 'wide',
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: 'any'
|
||||
}),
|
||||
quarter: buildMatchFn({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: 'wide',
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: 'any',
|
||||
valueCallback: function valueCallback(index) {
|
||||
return index + 1;
|
||||
}
|
||||
}),
|
||||
month: buildMatchFn({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: 'wide',
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: 'any'
|
||||
}),
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: 'wide',
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: 'any'
|
||||
}),
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: 'any',
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: 'any'
|
||||
})
|
||||
};
|
||||
export default match;
|
||||
ddb_main/node_modules/@dndbeyond/game-log-components/node_modules/date-fns/esm/locale/en-US/index.js
Generated
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
import formatDistance from "./_lib/formatDistance/index.js";
|
||||
import formatLong from "./_lib/formatLong/index.js";
|
||||
import formatRelative from "./_lib/formatRelative/index.js";
|
||||
import localize from "./_lib/localize/index.js";
|
||||
import match from "./_lib/match/index.js";
|
||||
/**
|
||||
* @type {Locale}
|
||||
* @category Locales
|
||||
* @summary English locale (United States).
|
||||
* @language English
|
||||
* @iso-639-2 eng
|
||||
* @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
|
||||
* @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
|
||||
*/
|
||||
var locale = {
|
||||
code: 'en-US',
|
||||
formatDistance: formatDistance,
|
||||
formatLong: formatLong,
|
||||
formatRelative: formatRelative,
|
||||
localize: localize,
|
||||
match: match,
|
||||
options: {
|
||||
weekStartsOn: 0 /* Sunday */,
|
||||
firstWeekContainsDate: 1
|
||||
}
|
||||
};
|
||||
export default locale;
|
||||
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
import addMilliseconds from "../addMilliseconds/index.js";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
import toInteger from "../_lib/toInteger/index.js";
|
||||
/**
|
||||
* @name subMilliseconds
|
||||
* @category Millisecond Helpers
|
||||
* @summary Subtract the specified number of milliseconds from the given date.
|
||||
*
|
||||
* @description
|
||||
* Subtract the specified number of milliseconds from the given date.
|
||||
*
|
||||
* @param {Date|Number} date - the date to be changed
|
||||
* @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
|
||||
* @returns {Date} the new date with the milliseconds subtracted
|
||||
* @throws {TypeError} 2 arguments required
|
||||
*
|
||||
* @example
|
||||
* // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
|
||||
* const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
||||
* //=> Thu Jul 10 2014 12:45:29.250
|
||||
*/
|
||||
export default function subMilliseconds(dirtyDate, dirtyAmount) {
|
||||
requiredArgs(2, arguments);
|
||||
var amount = toInteger(dirtyAmount);
|
||||
return addMilliseconds(dirtyDate, -amount);
|
||||
}
|
||||
Generated
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
||||
import requiredArgs from "../_lib/requiredArgs/index.js";
|
||||
/**
|
||||
* @name toDate
|
||||
* @category Common Helpers
|
||||
* @summary Convert the given argument to an instance of Date.
|
||||
*
|
||||
* @description
|
||||
* Convert the given argument to an instance of Date.
|
||||
*
|
||||
* If the argument is an instance of Date, the function returns its clone.
|
||||
*
|
||||
* If the argument is a number, it is treated as a timestamp.
|
||||
*
|
||||
* If the argument is none of the above, the function returns Invalid Date.
|
||||
*
|
||||
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
||||
*
|
||||
* @param {Date|Number} argument - the value to convert
|
||||
* @returns {Date} the parsed date in the local time zone
|
||||
* @throws {TypeError} 1 argument required
|
||||
*
|
||||
* @example
|
||||
* // Clone the date:
|
||||
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
||||
* //=> Tue Feb 11 2014 11:30:30
|
||||
*
|
||||
* @example
|
||||
* // Convert the timestamp to date:
|
||||
* const result = toDate(1392098430000)
|
||||
* //=> Tue Feb 11 2014 11:30:30
|
||||
*/
|
||||
export default function toDate(argument) {
|
||||
requiredArgs(1, arguments);
|
||||
var argStr = Object.prototype.toString.call(argument);
|
||||
|
||||
// Clone the date
|
||||
if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
|
||||
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
||||
return new Date(argument.getTime());
|
||||
} else if (typeof argument === 'number' || argStr === '[object Number]') {
|
||||
return new Date(argument);
|
||||
} else {
|
||||
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(new Error().stack);
|
||||
}
|
||||
return new Date(NaN);
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
"use client";
|
||||
|
||||
import clsx from "clsx";
|
||||
import type {
|
||||
AllHTMLAttributes,
|
||||
ButtonHTMLAttributes,
|
||||
FC,
|
||||
PropsWithChildren,
|
||||
} from "react";
|
||||
import styles from "./styles/Button.module.css";
|
||||
import sizeStyles from "./styles/ButtonSizes.module.css";
|
||||
import variantStyles from "./styles/ButtonVariants.module.css";
|
||||
|
||||
export interface ButtonProps
|
||||
extends PropsWithChildren,
|
||||
Omit<
|
||||
AllHTMLAttributes<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>,
|
||||
"size" | "type"
|
||||
>,
|
||||
Pick<ButtonHTMLAttributes<HTMLButtonElement>, "type"> {
|
||||
className?: string;
|
||||
color?: "primary" | "secondary" | "success" | "info" | "warning" | "error";
|
||||
variant?: "solid" | "outline" | "text";
|
||||
size?: "x-small" | "small" | "medium" | "large" | "x-large";
|
||||
isDiv?: boolean;
|
||||
}
|
||||
|
||||
export const Button: FC<ButtonProps> = ({
|
||||
className,
|
||||
color = "primary",
|
||||
variant = "solid",
|
||||
size = "medium",
|
||||
isDiv,
|
||||
...props
|
||||
}) => {
|
||||
const Element = props.href ? "a" : isDiv ? "div" : "button";
|
||||
|
||||
return (
|
||||
<Element
|
||||
className={clsx([
|
||||
styles.button,
|
||||
color && variantStyles[color],
|
||||
variant && variantStyles[variant],
|
||||
size && sizeStyles[size],
|
||||
className,
|
||||
])}
|
||||
aria-disabled={props.disabled}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
import clsx from "clsx";
|
||||
import type { ChangeEvent, FC, ReactNode } from "react";
|
||||
import styles from "./Checkbox.module.css";
|
||||
|
||||
export interface CheckboxProps {
|
||||
id?: string;
|
||||
label?: ReactNode;
|
||||
defaultChecked?: boolean;
|
||||
checked?: boolean;
|
||||
value?: string | number | readonly string[];
|
||||
name?: string;
|
||||
disabled?: boolean;
|
||||
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export const Checkbox: FC<CheckboxProps> = ({
|
||||
id,
|
||||
label,
|
||||
defaultChecked,
|
||||
checked,
|
||||
value,
|
||||
name,
|
||||
disabled,
|
||||
onChange,
|
||||
className,
|
||||
}) => (
|
||||
<div className={clsx([styles.container, className])}>
|
||||
<span className={clsx(styles.inputContainer)}>
|
||||
<input
|
||||
className={styles.checkbox}
|
||||
id={id}
|
||||
type="checkbox"
|
||||
defaultChecked={defaultChecked}
|
||||
checked={checked}
|
||||
value={value}
|
||||
name={name}
|
||||
aria-disabled={disabled}
|
||||
onChange={onChange ? (e) => !disabled && onChange?.(e) : undefined}
|
||||
/>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
fill="none"
|
||||
>
|
||||
<path
|
||||
stroke="currentColor"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
d="M3.5 7.47 6.833 11 12.5 5"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
{label && (
|
||||
<label
|
||||
className={clsx([styles.label, disabled && styles.disabled])}
|
||||
htmlFor={id}
|
||||
>
|
||||
{label}
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
import clsx from "clsx";
|
||||
import { useEffect, useRef, type HTMLAttributes, type MouseEvent } from "react";
|
||||
|
||||
import styles from "./Dialog.module.css";
|
||||
|
||||
/**
|
||||
* A generic dialog component to display content in a dialog (non-blocking) or
|
||||
* a modal (blocking) way. This has built-in functionality like backdrop
|
||||
* clicking and escape key handling. It also accepts a trigger element which
|
||||
* will open the dialog when clicked. This is to allow focus to be returned to
|
||||
* the trigger when the element is closed (for accessibility).
|
||||
*/
|
||||
|
||||
export interface DialogProps extends HTMLAttributes<HTMLDialogElement> {
|
||||
open: boolean;
|
||||
onClose: (e?: MouseEvent) => void;
|
||||
modal?: boolean;
|
||||
}
|
||||
|
||||
export const Dialog: React.FC<DialogProps> = ({
|
||||
open,
|
||||
onClose,
|
||||
modal,
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
const dialogRef = useRef<HTMLDialogElement>(null);
|
||||
const triggerRef = useRef<Element | null>(null);
|
||||
|
||||
const handleClose = () => {
|
||||
onClose();
|
||||
dialogRef.current?.close();
|
||||
// Returns focus to trigger after close for accessibility
|
||||
(triggerRef.current as HTMLButtonElement)?.focus();
|
||||
};
|
||||
|
||||
const handleClickBackdrop = (e?: MouseEvent) => {
|
||||
if (!e) return;
|
||||
|
||||
const rect = dialogRef.current?.getBoundingClientRect();
|
||||
const isClickInDialog =
|
||||
rect &&
|
||||
rect.top <= e.clientY &&
|
||||
e.clientY <= rect.top + rect.height &&
|
||||
rect.left <= e.clientX &&
|
||||
e.clientX <= rect.left + rect.width;
|
||||
|
||||
if (!isClickInDialog) handleClose();
|
||||
};
|
||||
|
||||
const handleEsc = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape" && open) {
|
||||
handleClose();
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(
|
||||
() => {
|
||||
// Get the element that was clicked to open the dialog
|
||||
triggerRef.current = document.activeElement;
|
||||
|
||||
if (modal && open) dialogRef.current?.showModal();
|
||||
if (open) dialogRef.current?.focus();
|
||||
|
||||
if (!open) {
|
||||
handleClose();
|
||||
}
|
||||
},
|
||||
//eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[dialogRef.current, open, modal],
|
||||
);
|
||||
|
||||
useEffect(
|
||||
() => {
|
||||
document.addEventListener("keydown", handleEsc);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener("keydown", handleEsc);
|
||||
};
|
||||
},
|
||||
//eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[modal, open],
|
||||
);
|
||||
|
||||
return (
|
||||
<dialog
|
||||
className={clsx([styles.dialog, className])}
|
||||
ref={dialogRef}
|
||||
onClick={modal ? handleClickBackdrop : undefined}
|
||||
open={modal ? undefined : open}
|
||||
aria-modal={modal}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</dialog>
|
||||
);
|
||||
};
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
import clsx from "clsx";
|
||||
import type { FC, HTMLAttributes } from "react";
|
||||
import styles from "./InfoItem.module.css";
|
||||
|
||||
interface InfoItemProps extends HTMLAttributes<HTMLDivElement> {
|
||||
center?: boolean;
|
||||
color?: "primary" | "secondary" | "success" | "info" | "warning" | "error";
|
||||
label: string;
|
||||
inline?: boolean;
|
||||
italic?: boolean;
|
||||
}
|
||||
|
||||
export const InfoItem: FC<InfoItemProps> = ({
|
||||
center,
|
||||
color,
|
||||
className,
|
||||
inline,
|
||||
italic,
|
||||
label,
|
||||
children,
|
||||
...props
|
||||
}) => (
|
||||
<div
|
||||
className={clsx([
|
||||
center && styles.center,
|
||||
inline && styles.inline,
|
||||
className,
|
||||
])}
|
||||
{...props}
|
||||
>
|
||||
<p
|
||||
className={clsx([
|
||||
styles.label,
|
||||
color && styles[color],
|
||||
italic && styles.italic,
|
||||
])}
|
||||
>
|
||||
{label}
|
||||
</p>
|
||||
{typeof children === "string" ? (
|
||||
<p
|
||||
className={clsx([styles.value, color && styles[color]])}
|
||||
dangerouslySetInnerHTML={{ __html: children }}
|
||||
/>
|
||||
) : (
|
||||
<p className={clsx([styles.value, color && styles[color]])}>{children}</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import clsx from "clsx";
|
||||
import type { HTMLAttributes, ReactNode } from "react";
|
||||
import { Tooltip } from "../Tooltip";
|
||||
import styles from "./LabelChip.module.css";
|
||||
|
||||
interface LabelChipProps extends HTMLAttributes<HTMLSpanElement> {
|
||||
tooltipContent?: ReactNode;
|
||||
tooltipClickable?: boolean;
|
||||
}
|
||||
|
||||
export const LabelChip = ({
|
||||
className = "",
|
||||
children,
|
||||
tooltipContent,
|
||||
tooltipClickable,
|
||||
...props
|
||||
}: LabelChipProps) => (
|
||||
<>
|
||||
<span className={clsx([styles.labelChip, className])} {...props}>
|
||||
{children}
|
||||
</span>
|
||||
{props["data-tooltip-id"] && (
|
||||
<Tooltip id={props["data-tooltip-id"]} clickable={tooltipClickable}>
|
||||
{tooltipContent}
|
||||
</Tooltip>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
Generated
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
const ddbImageBase = "https://media.dndbeyond.com/mega-menu";
|
||||
|
||||
export const cardList = [
|
||||
{
|
||||
label: "Classes",
|
||||
imageUrl: `${ddbImageBase}/aef3e4b2ac24457aa251c761d41ff07b.jpg`,
|
||||
link: "https://www.dndbeyond.com/classes",
|
||||
},
|
||||
{
|
||||
label: "Backgrounds",
|
||||
imageUrl: `${ddbImageBase}/6e31ff6ea1f04ca2af9896f3f6d1b383.jpg`,
|
||||
link: "https://www.dndbeyond.com/backgrounds",
|
||||
},
|
||||
{
|
||||
label: "Species",
|
||||
imageUrl: `${ddbImageBase}/8b551f9a1c2c4db09d65cdd7c139f9d5.jpg`,
|
||||
link: `https://www.dndbeyond.com/species`,
|
||||
},
|
||||
{
|
||||
label: "Feats",
|
||||
imageUrl: `${ddbImageBase}/a69ab5bf67b03308893b582dbef700e9.jpg`,
|
||||
link: "https://www.dndbeyond.com/feats",
|
||||
},
|
||||
{
|
||||
label: "Spells",
|
||||
imageUrl: `${ddbImageBase}/a9eac9081b6240ca8d6325ca4766345e.png`,
|
||||
link: "https://www.dndbeyond.com/spells",
|
||||
},
|
||||
{
|
||||
label: "Equipment",
|
||||
imageUrl: `${ddbImageBase}/b778ff3ca3f18e5f75ad4b348615cab5.jpg`,
|
||||
link: "https://www.dndbeyond.com/equipment",
|
||||
},
|
||||
{
|
||||
label: "Magic Items",
|
||||
imageUrl: `${ddbImageBase}/c06b79eae8ee234d1cea4688e117152b.jpg`,
|
||||
link: "https://www.dndbeyond.com/magic-items",
|
||||
},
|
||||
{
|
||||
label: "Monsters",
|
||||
imageUrl: `${ddbImageBase}/36ee49066331fc36e3b37147d123463a.jpg`,
|
||||
imagePosition: "center 11%",
|
||||
link: "https://www.dndbeyond.com/monsters",
|
||||
},
|
||||
];
|
||||
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
import { twitchUrl, youtubeUrl } from "../../../shared/constants";
|
||||
|
||||
const ddbImageBase = "https://media.dndbeyond.com/mega-menu";
|
||||
|
||||
export const primaryItems = [
|
||||
{
|
||||
label: "Community Update",
|
||||
imageUrl: `${ddbImageBase}/c2979f81837d8ee7c113a874da2909db.png`,
|
||||
link: "https://www.dndbeyond.com/community-update",
|
||||
},
|
||||
{
|
||||
label: "Twitch",
|
||||
imageUrl: `${ddbImageBase}/443085c3173d345e90d29881d8442a59.png`,
|
||||
link: twitchUrl,
|
||||
},
|
||||
{
|
||||
label: "Youtube",
|
||||
imageUrl: `${ddbImageBase}/d5e1b6d07482834ebfcbc1f04bd6476d.png`,
|
||||
link: youtubeUrl,
|
||||
},
|
||||
{
|
||||
label: "Changelog",
|
||||
imageUrl: `${ddbImageBase}/4af3d4c196428ab0809cf71d332d540d.png`,
|
||||
link: "https://www.dndbeyond.com/changelog",
|
||||
},
|
||||
];
|
||||
Generated
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
import type { MegaMenuCardProps } from "../MegaMenuCard";
|
||||
|
||||
const ddbImageBase = "https://media.dndbeyond.com/mega-menu";
|
||||
|
||||
export const characterBuilder: MegaMenuCardProps = {
|
||||
label: "Character Builder",
|
||||
imageUrl: `${ddbImageBase}/323a928e32eff87dee85dfbe0793ce12.jpg`,
|
||||
link: "https://www.dndbeyond.com/characters/builder",
|
||||
};
|
||||
|
||||
export const primaryItems: MegaMenuCardProps[] = [
|
||||
{
|
||||
label: "Maps",
|
||||
imageUrl: `${ddbImageBase}/049ddb9085342521d25c5230451cfd45.jpg`,
|
||||
link: "https://www.dndbeyond.com/games",
|
||||
flags: [{ label: "Beta", variant: "info" }],
|
||||
},
|
||||
{
|
||||
label: "Encounters",
|
||||
imageUrl: `${ddbImageBase}/e434a8385f9619f0d52480c3c3987059.jpg`,
|
||||
link: "https://www.dndbeyond.com/encounter-builder",
|
||||
flags: [{ label: "Beta", variant: "info" }],
|
||||
},
|
||||
];
|
||||
|
||||
export const secondaryItems: MegaMenuCardProps[] = [
|
||||
{
|
||||
label: "Mobile App",
|
||||
imageUrl: `${ddbImageBase}/3aa58aac2d02bb52d62204e158b48ce6.jpg`,
|
||||
link: "https://www.dndbeyond.com/player-app",
|
||||
},
|
||||
{
|
||||
label: "Avrae Discord Bot",
|
||||
imageUrl: `${ddbImageBase}/28d923cd45ad209411ef1ff07993721b.jpg`,
|
||||
link: "https://avrae.io/",
|
||||
},
|
||||
];
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
"use client";
|
||||
|
||||
import AngleDown from "@dndbeyond/fontawesome-cache/svgs/regular/angle-down.svg";
|
||||
import XMark from "@dndbeyond/fontawesome-cache/svgs/regular/xmark.svg";
|
||||
import clsx from "clsx";
|
||||
import type { FC, MouseEvent, SelectHTMLAttributes } from "react";
|
||||
import { useIsVisible } from "../../hooks/useIsVisible/useIsVisible";
|
||||
import { Checkbox } from "../Checkbox";
|
||||
import styles from "./Select.module.css";
|
||||
|
||||
interface Option {
|
||||
value: string | number;
|
||||
label: string;
|
||||
}
|
||||
|
||||
interface SelectProps
|
||||
extends Omit<SelectHTMLAttributes<HTMLDivElement>, "value"> {
|
||||
label: string;
|
||||
options: Array<Option>;
|
||||
value: string | string[] | number[];
|
||||
placeholder?: string;
|
||||
onDelete?: (e: MouseEvent) => void;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export const Select: FC<SelectProps> = ({
|
||||
className = "",
|
||||
placeholder,
|
||||
name,
|
||||
label,
|
||||
onChange,
|
||||
onDelete,
|
||||
options,
|
||||
value,
|
||||
disabled,
|
||||
error,
|
||||
...props
|
||||
}) => {
|
||||
const { ref, isVisible, setIsVisible } = useIsVisible(false);
|
||||
const multiple = Array.isArray(value) || false;
|
||||
const handleDelete = (e: MouseEvent) => {
|
||||
if (onDelete) {
|
||||
e.stopPropagation();
|
||||
onDelete(e);
|
||||
}
|
||||
};
|
||||
const getDisplay = () => {
|
||||
// If value is an array, show tags
|
||||
if (multiple && Array.isArray(value) && value.length) {
|
||||
return (
|
||||
<span className={styles.tags}>
|
||||
{value.map((v) => (
|
||||
<span
|
||||
className={styles.tag}
|
||||
onClick={(e: MouseEvent) => handleDelete(e)}
|
||||
key={v}
|
||||
>
|
||||
{v}
|
||||
<XMark />
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
// If value is string, show string
|
||||
else if (!multiple && value) {
|
||||
return value;
|
||||
}
|
||||
// If there is no value, show the placeholder
|
||||
else {
|
||||
return <span className={styles.placeholder}>{placeholder}</span>;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div ref={ref} className={clsx([styles.container, className])} {...props}>
|
||||
<label id={`${name}Label`}>{label}</label>
|
||||
<button
|
||||
className={clsx([styles.button, error && styles.buttonError])}
|
||||
id={`${name}Button`}
|
||||
onClick={() => setIsVisible(!isVisible)}
|
||||
role="combobox"
|
||||
aria-haspopup="listbox"
|
||||
aria-controls={`${name}Dropdown`}
|
||||
aria-labelledby={`${name}Label`}
|
||||
aria-expanded={isVisible}
|
||||
tabIndex={0}
|
||||
disabled={disabled || false}
|
||||
>
|
||||
{getDisplay()}
|
||||
<AngleDown />
|
||||
</button>
|
||||
<div
|
||||
className={styles.options}
|
||||
role="group"
|
||||
id={`${name}Dropdown`}
|
||||
tabIndex={-1}
|
||||
>
|
||||
{options.map((option) =>
|
||||
multiple ? (
|
||||
<Checkbox
|
||||
id={`checkbox-${option.value}`}
|
||||
label={option.label}
|
||||
key={option.value}
|
||||
name={name}
|
||||
value={option.value}
|
||||
onChange={(e) => onChange?.(e)}
|
||||
checked={value.includes(option.value as never)}
|
||||
/>
|
||||
) : (
|
||||
<label className={styles.option} key={option.value}>
|
||||
<input
|
||||
type="radio"
|
||||
name={name}
|
||||
value={option.value}
|
||||
onChange={(e) => onChange?.(e)}
|
||||
checked={value === option.value}
|
||||
/>
|
||||
{option.label}
|
||||
</label>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{error && <p className={styles.error}>{error}</p>}
|
||||
</>
|
||||
);
|
||||
};
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
import clsx from "clsx";
|
||||
import { useEffect, useRef, type DialogHTMLAttributes, type FC } from "react";
|
||||
import styles from "./Toast.module.css";
|
||||
|
||||
/**
|
||||
* Toast Usage
|
||||
* const [open, setOpen] = useState(false);
|
||||
*
|
||||
* const onClick = () => {
|
||||
* setOpen(true);
|
||||
* };
|
||||
*
|
||||
* const onClose = () => {
|
||||
* setOpen(false);
|
||||
* };
|
||||
*
|
||||
* <Button onClick={onClick}>Toast</Button>
|
||||
* <Toast
|
||||
* open={open}
|
||||
* autoHideDuration={6000}
|
||||
* onClose={onClose}
|
||||
* message="Note Archived"
|
||||
* />
|
||||
**/
|
||||
|
||||
interface ToastProps extends DialogHTMLAttributes<HTMLDialogElement> {
|
||||
align?: "left" | "right";
|
||||
autoHideDuration?: number;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
let timer: NodeJS.Timeout | undefined;
|
||||
|
||||
export const Toast: FC<ToastProps> = ({
|
||||
align = "left",
|
||||
autoHideDuration = 6000,
|
||||
children,
|
||||
className,
|
||||
onClose,
|
||||
open,
|
||||
...props
|
||||
}) => {
|
||||
const ref = useRef<HTMLDialogElement | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
// Prevent the Toast from grabbing focus
|
||||
ref.current?.setAttribute("open", "open");
|
||||
timer = setTimeout(onClose, autoHideDuration);
|
||||
} else {
|
||||
ref.current?.close?.();
|
||||
timer = undefined;
|
||||
}
|
||||
return () => clearTimeout(timer);
|
||||
}, [autoHideDuration, onClose, open]);
|
||||
|
||||
return (
|
||||
<dialog
|
||||
className={clsx([styles.toast, styles[align], className])}
|
||||
ref={ref}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</dialog>
|
||||
);
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import type { FC } from "react";
|
||||
import { Tooltip as ReactTooltip, type ITooltip } from "react-tooltip";
|
||||
import styles from "./Tooltip.module.css";
|
||||
|
||||
export interface TooltipProps extends ITooltip {
|
||||
id: string;
|
||||
"data-testid"?: string;
|
||||
}
|
||||
|
||||
export const Tooltip: FC<TooltipProps> = ({
|
||||
id,
|
||||
"data-testid": testId,
|
||||
children,
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
<div
|
||||
className={styles.container}
|
||||
{...(testId && { "data-testid": testId })}
|
||||
>
|
||||
<ReactTooltip id={id} className={styles.tooltip} {...props}>
|
||||
{children}
|
||||
</ReactTooltip>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
import { useEffect, useRef, useState, type MutableRefObject } from "react";
|
||||
|
||||
/**
|
||||
* A hook to use for determining open and closed states
|
||||
* @param initialValue Whether the component should start visible or not
|
||||
*
|
||||
* @returns {ref} A ref to be given to parent object
|
||||
* @returns {isVisible} Boolean value to decide whether to show
|
||||
* element or not
|
||||
* @returns {setIsVisible} Dispatch function to update the value of
|
||||
* isVisible
|
||||
*/
|
||||
|
||||
interface Return<T> {
|
||||
ref: MutableRefObject<T | null>;
|
||||
isVisible: boolean;
|
||||
setIsVisible: (value: boolean) => void;
|
||||
}
|
||||
|
||||
export const useIsVisible = <T = HTMLDivElement>(
|
||||
initialValue: boolean,
|
||||
): Return<T> => {
|
||||
const [isVisible, setIsVisible] = useState(initialValue);
|
||||
const ref = useRef<T | null>(null);
|
||||
|
||||
// Handles clicks outside the parent ref
|
||||
const handleClickOutside = (e: MouseEvent) => {
|
||||
const containsElement =
|
||||
e.composedPath().indexOf(ref.current as EventTarget) !== -1;
|
||||
|
||||
if (ref.current && !containsElement) setIsVisible(false);
|
||||
};
|
||||
|
||||
useEffect(
|
||||
() => {
|
||||
document.addEventListener("click", handleClickOutside, true);
|
||||
return () => {
|
||||
document.removeEventListener("click", handleClickOutside, true);
|
||||
};
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[],
|
||||
);
|
||||
|
||||
return { ref, isVisible, setIsVisible };
|
||||
};
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
import { ThemeOptions } from "@mui/material";
|
||||
|
||||
export const components: ThemeOptions["components"] = {
|
||||
MuiButtonBase: {
|
||||
defaultProps: {
|
||||
disableRipple: true,
|
||||
},
|
||||
},
|
||||
MuiDialog: {
|
||||
styleOverrides: {
|
||||
paper: ({ theme }) => ({
|
||||
minWidth: 320,
|
||||
"&.MuiPaper-rounded": {
|
||||
borderRadius: "8px",
|
||||
},
|
||||
"&.MuiPaper-outlined": {
|
||||
borderColor: theme.palette.primary.main,
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
MuiGrid: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
/**
|
||||
* n.b. this is a workaround for bad types on the DialogTitle component,
|
||||
* what I really want there is a Grid, but I don't want to enforce these
|
||||
* styles on any other Grid components that might be passed in, so I add
|
||||
* the className "DdbDialogTitle-root" to target this specific component
|
||||
*/
|
||||
"&.DdbDialogTitle-root": {
|
||||
padding: "16px 20px 8px",
|
||||
"& .MuiIconButton-root": {
|
||||
padding: "4px",
|
||||
marginRight: "-8px",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiIconButton: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
transition: "none",
|
||||
"&:hover": {
|
||||
transition: "none",
|
||||
borderRadius: "3px",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiDialogContent: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: "16px 20px 0",
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiDialogContentText: {
|
||||
styleOverrides: {
|
||||
root: ({ theme }) => ({
|
||||
color: theme.palette.text.primary,
|
||||
letterSpacing: "0.15px",
|
||||
marginBottom: "12px",
|
||||
}),
|
||||
},
|
||||
},
|
||||
MuiButton: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
fontSize: "15px",
|
||||
lineHeight: 26 / 15,
|
||||
letterSpacing: "0.45px",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
import { ThemeOptions } from "@mui/material";
|
||||
|
||||
export const palette: ThemeOptions["palette"] = {
|
||||
mode: "dark",
|
||||
text: {
|
||||
primary: "#ecedeeff",
|
||||
secondary: "#ecedeea3",
|
||||
disabled: "#ecedee5c",
|
||||
},
|
||||
primary: {
|
||||
main: "#dcdfe1ff",
|
||||
dark: "#75838bff",
|
||||
light: "#f9fafaff",
|
||||
contrastText: "#000000ff",
|
||||
},
|
||||
secondary: {
|
||||
main: "#00daa6ff",
|
||||
dark: "#00b674ff",
|
||||
light: "#b3efd9ff",
|
||||
contrastText: "#000000ff",
|
||||
},
|
||||
action: {
|
||||
active: "#dcdfe1a3",
|
||||
hover: "#dcdfe11f",
|
||||
selected: "#dcdfe12e",
|
||||
disabled: "#dcdfe166",
|
||||
disabledBackground: "#dcdfe133",
|
||||
focus: "#dcdfe133",
|
||||
},
|
||||
error: {
|
||||
main: "#ed6c02ff",
|
||||
dark: "#c77700ff",
|
||||
light: "#ffb547ff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
warning: {
|
||||
main: "#ed6c02ff",
|
||||
dark: "#c77700ff",
|
||||
light: "#ffb547ff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
info: {
|
||||
main: "#2196f3ff",
|
||||
dark: "#0b79d0ff",
|
||||
light: "#64b6f7ff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
success: {
|
||||
main: "#4caf50ff",
|
||||
dark: "#3b873eff",
|
||||
light: "#7bc67eff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
background: {
|
||||
paper: "#12181cff",
|
||||
default: "#232b2fff",
|
||||
pane: "#12181cdb",
|
||||
},
|
||||
common: { white: "#ffffffff", black: "#000000ff" },
|
||||
grey: {
|
||||
"50": "#f4f5f5ff",
|
||||
"100": "#ecedeeff",
|
||||
"200": "#dcdfe1ff",
|
||||
"300": "#c4cbceff",
|
||||
"400": "#a2acb2ff",
|
||||
"500": "#75838bff",
|
||||
"600": "#525c63ff",
|
||||
"700": "#374045ff",
|
||||
"800": "#232b2fff",
|
||||
"900": "#12181cff",
|
||||
},
|
||||
rarity: {
|
||||
uncommon: "#7ebe15ff",
|
||||
rare: "#41a9f2ff",
|
||||
veryRare: "#c364e7ff",
|
||||
legendary: "#ffb62aff",
|
||||
artifact: "#f77558ff",
|
||||
contrastText: "#000000ff",
|
||||
},
|
||||
reference: {
|
||||
magicItem: "#41a9f2ff",
|
||||
monster: "#f77558ff",
|
||||
skill: "#7ebe15ff",
|
||||
spell: "#c364e7ff",
|
||||
contrastText: "#000000ff",
|
||||
},
|
||||
message: {
|
||||
check: "#c364e7ff",
|
||||
custom: "#ecedeea3",
|
||||
damage: "#f77558ff",
|
||||
healSave: "#7ebe15ff",
|
||||
initiative: "#ffb62aff",
|
||||
toHit: "#41a9f2ff",
|
||||
},
|
||||
};
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
import { ThemeOptions } from "@mui/material";
|
||||
|
||||
export const palette: ThemeOptions["palette"] = {
|
||||
mode: "light",
|
||||
text: {
|
||||
primary: "#12181cff",
|
||||
secondary: "#12181ca3",
|
||||
disabled: "#12181c5c",
|
||||
},
|
||||
primary: {
|
||||
main: "#374045ff",
|
||||
dark: "#12181cff",
|
||||
light: "#75838bff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
secondary: {
|
||||
main: "#e40712ff",
|
||||
dark: "#9f271dff",
|
||||
light: "#f77558ff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
action: {
|
||||
active: "#12181ca3",
|
||||
hover: "#12181c14",
|
||||
selected: "#12181c1f",
|
||||
disabled: "#12181c5c",
|
||||
disabledBackground: "#12181c29",
|
||||
focus: "#12181c29",
|
||||
},
|
||||
error: {
|
||||
main: "#ed6c02ff",
|
||||
dark: "#c77700ff",
|
||||
light: "#ffb547ff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
warning: {
|
||||
main: "#ed6c02ff",
|
||||
dark: "#c77700ff",
|
||||
light: "#ffb547ff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
info: {
|
||||
main: "#2196f3ff",
|
||||
dark: "#0b79d0ff",
|
||||
light: "#64b6f7ff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
success: {
|
||||
main: "#4caf50ff",
|
||||
dark: "#3b873eff",
|
||||
light: "#7bc67eff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
background: {
|
||||
paper: "#ffffffff",
|
||||
default: "#f4f5f5ff",
|
||||
parchment: "#f9f6efff",
|
||||
scroll: "#eee8dbff",
|
||||
},
|
||||
common: { white: "#ffffffff", black: "#000000ff" },
|
||||
grey: {
|
||||
"50": "#f4f5f5ff",
|
||||
"100": "#ecedeeff",
|
||||
"200": "#dcdfe1ff",
|
||||
"300": "#c4cbceff",
|
||||
"400": "#a2acb2ff",
|
||||
"500": "#75838bff",
|
||||
"600": "#525c63ff",
|
||||
"700": "#374045ff",
|
||||
"800": "#232b2fff",
|
||||
"900": "#12181cff",
|
||||
},
|
||||
rarity: {
|
||||
uncommon: "#009158ff",
|
||||
rare: "#077bd0ff",
|
||||
veryRare: "#9605d4ff",
|
||||
legendary: "#ae5e21ff",
|
||||
artifact: "#c81e18ff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
reference: {
|
||||
character: "#ee8600ff",
|
||||
magicItem: "#077bd0ff",
|
||||
monster: "#c60000ff",
|
||||
skill: "#009158ff",
|
||||
spell: "#9605d4ff",
|
||||
contrastText: "#ffffffff",
|
||||
},
|
||||
};
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
import { ThemeOptions } from "@mui/material";
|
||||
|
||||
export const typography: ThemeOptions["typography"] = {
|
||||
h1: {
|
||||
fontSize: "64px",
|
||||
fontFamily: "Tiamat Condensed SC",
|
||||
fontWeight: 400,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: 1,
|
||||
lineHeight: "64px",
|
||||
},
|
||||
h2: {
|
||||
fontSize: "48px",
|
||||
fontFamily: "Roboto",
|
||||
fontWeight: 400,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: "normal",
|
||||
lineHeight: "52.8px",
|
||||
},
|
||||
h3: {
|
||||
fontSize: "36px",
|
||||
fontFamily: "Roboto",
|
||||
fontWeight: 400,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: "normal",
|
||||
lineHeight: "43.2px",
|
||||
},
|
||||
h4: {
|
||||
fontSize: "26px",
|
||||
fontFamily: "Roboto",
|
||||
fontWeight: 400,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: "normal",
|
||||
lineHeight: "32.5px",
|
||||
},
|
||||
h5: {
|
||||
fontSize: "20px",
|
||||
fontFamily: "Roboto",
|
||||
fontWeight: 500,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: "normal",
|
||||
lineHeight: "25px",
|
||||
},
|
||||
h6: {
|
||||
fontSize: "16px",
|
||||
fontFamily: "Roboto",
|
||||
fontWeight: 500,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: "normal",
|
||||
lineHeight: "22.4px",
|
||||
},
|
||||
body1: {
|
||||
fontSize: "16px",
|
||||
fontFamily: "Roboto",
|
||||
fontWeight: 400,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: 0.15,
|
||||
lineHeight: "24px",
|
||||
},
|
||||
body2: {
|
||||
fontSize: "14px",
|
||||
fontFamily: "Roboto",
|
||||
fontWeight: 400,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: 0.15,
|
||||
lineHeight: "20.02px",
|
||||
},
|
||||
subtitle1: {
|
||||
fontSize: "16px",
|
||||
fontFamily: "Roboto",
|
||||
fontWeight: 400,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: 0.15,
|
||||
lineHeight: "28px",
|
||||
},
|
||||
subtitle2: {
|
||||
fontSize: "14px",
|
||||
fontFamily: "Roboto",
|
||||
fontWeight: 500,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: 0.1,
|
||||
lineHeight: "21.98px",
|
||||
},
|
||||
overline: {
|
||||
fontSize: "12px",
|
||||
fontFamily: "Roboto",
|
||||
fontWeight: 400,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: 1,
|
||||
lineHeight: "31.92px",
|
||||
textTransform: "uppercase",
|
||||
},
|
||||
caption: {
|
||||
fontSize: "12px",
|
||||
fontFamily: "Roboto",
|
||||
fontWeight: 400,
|
||||
fontStyle: "normal",
|
||||
fontStretch: "normal",
|
||||
letterSpacing: 0.4,
|
||||
lineHeight: "19.92px",
|
||||
},
|
||||
};
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
import { createTheme, ThemeOptions } from "@mui/material";
|
||||
import { deepmerge } from "@mui/utils";
|
||||
import { components } from "./config/components";
|
||||
import { palette as darkThemePalette } from "./config/palette-dark";
|
||||
import { palette as lightThemePalette } from "./config/palette-light";
|
||||
import { typography } from "./config/typography";
|
||||
|
||||
export const createLightTheme = (options: ThemeOptions = {}) =>
|
||||
createTheme(
|
||||
deepmerge(
|
||||
{
|
||||
components,
|
||||
palette: lightThemePalette,
|
||||
typography,
|
||||
},
|
||||
options,
|
||||
),
|
||||
);
|
||||
|
||||
export const createDarkTheme = (options: ThemeOptions = {}) =>
|
||||
createTheme(
|
||||
deepmerge(
|
||||
{
|
||||
components,
|
||||
palette: darkThemePalette,
|
||||
typography,
|
||||
},
|
||||
options,
|
||||
),
|
||||
);
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
export const signInLabel = "Sign In";
|
||||
export const signUpLabel = "Sign Up";
|
||||
export const signOutLabel = "Sign Out";
|
||||
|
||||
// Social Media Links
|
||||
export const discordUrl = "https://www.dndbeyond.com/discord";
|
||||
export const facebookUrl = "https://www.facebook.com/dndbeyond";
|
||||
export const instagramUrl = "https://www.instagram.com/dndbeyond";
|
||||
export const tiktokUrl = "https://www.tiktok.com/@dnd_beyond";
|
||||
export const twitchUrl = "https://www.twitch.tv/dndbeyond";
|
||||
export const twitterUrl = "https://twitter.com/dndbeyond";
|
||||
export const youtubeUrl =
|
||||
"https://www.youtube.com/channel/UCPy-338BEVgDkQade0qJmkw";
|
||||
export const googleStoreUrl =
|
||||
"https://play.google.com/store/apps/details?id=com.fandom.playercompanion";
|
||||
export const appleStoreUrl =
|
||||
"https://apps.apple.com/us/app/d-d-beyond/id1501810129";
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
// this implementation is temporary until we can natively dynamically import css files
|
||||
// ref: https://react.dev/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022#asset-loading
|
||||
const wayOfLight = /* css */ `
|
||||
:root {
|
||||
--ttui_color-primary--main: #374045;
|
||||
--ttui_color-primary--dark: #12181c;
|
||||
--ttui_color-primary--light: #75838b;
|
||||
--ttui_color-primary--contrast: #ffffff;
|
||||
|
||||
--ttui_color-secondary--main: var(--ttui_red-500);
|
||||
--ttui_color-secondary--dark: var(--ttui_red-700);
|
||||
--ttui_color-secondary--light: var(--ttui_red-300);
|
||||
--ttui_color-secondary--contrast: var(--ttui_common-0);
|
||||
|
||||
--ttui_color-error--main: #ed6c02;
|
||||
--ttui_color-error--dark: #c77700;
|
||||
--ttui_color-error--light: #ffb547;
|
||||
--ttui_color-error--contrast: #ffffff;
|
||||
|
||||
--ttui_color-warning--main: #ed6c02;
|
||||
--ttui_color-warning--dark: #c77700;
|
||||
--ttui_color-warning--light: #ffb547;
|
||||
--ttui_color-warning--contrast: #ffffff;
|
||||
|
||||
--ttui_color-info--main: #2196f3;
|
||||
--ttui_color-info--dark: #0b79d0;
|
||||
--ttui_color-info--light: #64b6f7;
|
||||
--ttui_color-info--contrast: #ffffff;
|
||||
|
||||
--ttui_color-success--main: #4caf50;
|
||||
--ttui_color-success--dark: #3b873e;
|
||||
--ttui_color-success--light: #7bc67e;
|
||||
--ttui_color-success--contrast: #ffffff;
|
||||
|
||||
--ttui_color-bg--paper: #ffffff;
|
||||
--ttui_color-bg--default: #f4f5f5;
|
||||
--ttui_color-bg--pane: #f9f6ef;
|
||||
--ttui_color-bg--scroll: #eee8db;
|
||||
|
||||
--ttui_color-rarity--uncommon: #7ebe15;
|
||||
--ttui_color-rarity--rare: #41a9f2;
|
||||
--ttui_color-rarity--veryRare: #c364e7;
|
||||
--ttui_color-rarity--legendary: #ffb62a;
|
||||
--ttui_color-rarity--artifact: #f77558;
|
||||
--ttui_color-rarity--contrast: #000000;
|
||||
|
||||
--ttui_color-reference--character: #ee8600;
|
||||
--ttui_color-reference--magicItem: #41a9f2;
|
||||
--ttui_color-reference--monster: #c60000;
|
||||
--ttui_color-reference--skill: #7ebe15;
|
||||
--ttui_color-reference--spell: #c364e7;
|
||||
--ttui_color-reference--contrast: #000000;
|
||||
|
||||
--ttui_color-message--check: #c364e7;
|
||||
--ttui_color-message--custom: #ecedee;
|
||||
--ttui_color-message--damage: #f77558;
|
||||
--ttui_color-message--healSave: #7ebe15;
|
||||
--ttui_color-message--initiative: #ffb62a;
|
||||
--ttui_color-message--toHit: #41a9f2;
|
||||
|
||||
--ttui_color-text--primary: #12181cff;
|
||||
--ttui_color-text--secondary: #12181ca3;
|
||||
--ttui_color-text--disabled: #12181c5c;
|
||||
|
||||
--ttui_color-action--hover: var(--ttui_grey-100);
|
||||
--ttui_color-action--active: var(--ttui_grey-200);
|
||||
--ttui_color-action--selected: var(--ttui_grey-200);
|
||||
|
||||
--ttui_color-megamenu--main: #26282a;
|
||||
--ttui_color-megamenu--dark: #1c1d1e;
|
||||
--ttui_color-megamenu--contrast: var(--ttui_common-0);
|
||||
}
|
||||
`;
|
||||
|
||||
export default wayOfLight;
|
||||
Reference in New Issue
Block a user