lecom-ui 4.1.9 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.js +5 -0
- package/dist/_virtual/index.js +7 -0
- package/dist/components/Accordion/Accordion.js +40 -37
- package/dist/components/Button/Button.js +10 -9
- package/dist/components/Button/CustomButton.js +6 -5
- package/dist/components/Card/Card.js +7 -6
- package/dist/components/Checkbox/Checkbox.js +35 -30
- package/dist/components/CustomIcon/Icons/CadastroFacil.js +15 -5
- package/dist/components/CustomIcon/Icons/LogoLecom.js +15 -12
- package/dist/components/CustomIcon/Icons/LogoLecomBrand.js +8 -5
- package/dist/components/CustomIcon/Icons/ModoTeste.js +13 -5
- package/dist/components/CustomIcon/Icons/Rpa.js +17 -5
- package/dist/components/DataTable/DataTable.js +33 -158
- package/dist/components/Dialog/Dialog.js +40 -31
- package/dist/components/DropdownMenu/DropdownMenu.js +55 -46
- package/dist/components/Header/Header.js +51 -35
- package/dist/components/Header/HelpMenu.js +52 -41
- package/dist/components/Header/ImgBrand.js +5 -8
- package/dist/components/Header/ModulesMenu.js +63 -50
- package/dist/components/Header/SocialMenu.js +5 -6
- package/dist/components/Header/UserMenu.js +81 -51
- package/dist/components/Input/Input.js +11 -2
- package/dist/components/Layout/Layout.js +62 -45
- package/dist/components/Notification/Notification.js +9 -8
- package/dist/components/Notification/NotificationBase.js +5 -5
- package/dist/components/Notification/NotificationCallout.js +33 -27
- package/dist/components/Notification/NotificationCloseButton.js +4 -3
- package/dist/components/Notification/NotificationContent.js +24 -18
- package/dist/components/Notification/NotificationIcon.js +9 -6
- package/dist/components/Notification/NotificationInline.js +23 -20
- package/dist/components/Notification/NotificationToast.js +28 -25
- package/dist/components/Notification/useNotificationToast.js +0 -1
- package/dist/components/Popover/Popover.js +8 -7
- package/dist/components/ScrollArea/ScrollArea.js +18 -15
- package/dist/components/Select/Select.js +63 -54
- package/dist/components/Separator/Separator.js +5 -4
- package/dist/components/Sheet/Sheet.js +35 -26
- package/dist/components/Sidebar/Sidebar.js +112 -95
- package/dist/components/Skeleton/Skeleton.js +2 -2
- package/dist/components/Table/Table.js +15 -26
- package/dist/components/Tag/Tag.js +6 -5
- package/dist/components/Tooltip/Tooltip.js +17 -15
- package/dist/components/Typography/Typography.js +6 -7
- package/dist/hooks/use-mobile.js +1 -1
- package/dist/i18n/index.js +4 -53
- package/dist/i18n/locales/en_us.js +4 -3
- package/dist/i18n/locales/es_es.js +4 -3
- package/dist/i18n/locales/index.js +4 -4
- package/dist/i18n/locales/pt_br.js +4 -3
- package/dist/index.d.ts +108 -304
- package/dist/index.js +1 -12
- package/dist/lib/utils.js +2 -2
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +806 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +726 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +347 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +154 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +136 -0
- package/dist/node_modules/@radix-ui/number/dist/index.js +6 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +303 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +157 -0
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +144 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +68 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +79 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +319 -0
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +211 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +265 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +207 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +831 -0
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +296 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +278 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +41 -0
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +220 -0
- package/dist/node_modules/@radix-ui/react-scroll-area/dist/index.js +718 -0
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +1143 -0
- package/dist/node_modules/@radix-ui/react-separator/dist/index.js +30 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +81 -0
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +476 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +35 -0
- package/dist/node_modules/@tanstack/react-table/build/lib/index.js +74 -0
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +3023 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +136 -0
- package/dist/node_modules/class-variance-authority/dist/index.js +44 -0
- package/dist/node_modules/clsx/dist/clsx.js +3 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +8 -0
- package/dist/node_modules/hex-color-opacity/lib/index.js +22 -0
- package/dist/node_modules/i18next/dist/esm/i18next.js +2228 -0
- package/dist/node_modules/lucide-react/dist/esm/Icon.js +44 -0
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +26 -0
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +20 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/check.js +13 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +13 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-alert.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-help.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/info.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/menu.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/message-square.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/minus.js +13 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/panel-left.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/triangle-alert.js +23 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/user.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/x.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +13 -0
- package/dist/node_modules/react-i18next/dist/es/context.js +18 -0
- package/dist/node_modules/react-i18next/dist/es/defaults.js +21 -0
- package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +7 -0
- package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +12 -0
- package/dist/node_modules/react-i18next/dist/es/unescape.js +27 -0
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js +112 -0
- package/dist/node_modules/react-i18next/dist/es/utils.js +63 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +160 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +109 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +2493 -0
- package/dist/node_modules/tslib/tslib.es6.js +56 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
- package/dist/node_modules/use-color-luminance/index.es.js +105 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
- package/dist/plugin/typographies.ts +146 -152
- package/dist/style.min.css +1 -1
- package/dist/utils/cookie.js +9 -6
- package/package.json +11 -3
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var __assign = function() {
|
|
19
|
+
__assign = Object.assign || function __assign(t) {
|
|
20
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
21
|
+
s = arguments[i];
|
|
22
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function __rest(s, e) {
|
|
30
|
+
var t = {};
|
|
31
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
32
|
+
t[p] = s[p];
|
|
33
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
34
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
35
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
36
|
+
t[p[i]] = s[p[i]];
|
|
37
|
+
}
|
|
38
|
+
return t;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function __spreadArray(to, from, pack) {
|
|
42
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
43
|
+
if (ar || !(i in from)) {
|
|
44
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
45
|
+
ar[i] = from[i];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
52
|
+
var e = new Error(message);
|
|
53
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { __assign, __rest, __spreadArray };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assigns a value for a given ref, no matter of the ref format
|
|
3
|
+
* @param {RefObject} ref - a callback function or ref object
|
|
4
|
+
* @param value - a new value
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/theKashey/use-callback-ref#assignref
|
|
7
|
+
* @example
|
|
8
|
+
* const refObject = useRef();
|
|
9
|
+
* const refFn = (ref) => {....}
|
|
10
|
+
*
|
|
11
|
+
* assignRef(refObject, "refValue");
|
|
12
|
+
* assignRef(refFn, "refValue");
|
|
13
|
+
*/
|
|
14
|
+
function assignRef(ref, value) {
|
|
15
|
+
if (typeof ref === 'function') {
|
|
16
|
+
ref(value);
|
|
17
|
+
}
|
|
18
|
+
else if (ref) {
|
|
19
|
+
ref.current = value;
|
|
20
|
+
}
|
|
21
|
+
return ref;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { assignRef };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { assignRef } from './assignRef.js';
|
|
3
|
+
import { useCallbackRef } from './useRef.js';
|
|
4
|
+
|
|
5
|
+
var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
6
|
+
var currentValues = new WeakMap();
|
|
7
|
+
/**
|
|
8
|
+
* Merges two or more refs together providing a single interface to set their value
|
|
9
|
+
* @param {RefObject|Ref} refs
|
|
10
|
+
* @returns {MutableRefObject} - a new ref, which translates all changes to {refs}
|
|
11
|
+
*
|
|
12
|
+
* @see {@link mergeRefs} a version without buit-in memoization
|
|
13
|
+
* @see https://github.com/theKashey/use-callback-ref#usemergerefs
|
|
14
|
+
* @example
|
|
15
|
+
* const Component = React.forwardRef((props, ref) => {
|
|
16
|
+
* const ownRef = useRef();
|
|
17
|
+
* const domRef = useMergeRefs([ref, ownRef]); // 👈 merge together
|
|
18
|
+
* return <div ref={domRef}>...</div>
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
function useMergeRefs(refs, defaultValue) {
|
|
22
|
+
var callbackRef = useCallbackRef(null, function (newValue) {
|
|
23
|
+
return refs.forEach(function (ref) { return assignRef(ref, newValue); });
|
|
24
|
+
});
|
|
25
|
+
// handle refs changes - added or removed
|
|
26
|
+
useIsomorphicLayoutEffect(function () {
|
|
27
|
+
var oldValue = currentValues.get(callbackRef);
|
|
28
|
+
if (oldValue) {
|
|
29
|
+
var prevRefs_1 = new Set(oldValue);
|
|
30
|
+
var nextRefs_1 = new Set(refs);
|
|
31
|
+
var current_1 = callbackRef.current;
|
|
32
|
+
prevRefs_1.forEach(function (ref) {
|
|
33
|
+
if (!nextRefs_1.has(ref)) {
|
|
34
|
+
assignRef(ref, null);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
nextRefs_1.forEach(function (ref) {
|
|
38
|
+
if (!prevRefs_1.has(ref)) {
|
|
39
|
+
assignRef(ref, current_1);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
currentValues.set(callbackRef, refs);
|
|
44
|
+
}, [refs]);
|
|
45
|
+
return callbackRef;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { useMergeRefs };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* creates a MutableRef with ref change callback
|
|
5
|
+
* @param initialValue - initial ref value
|
|
6
|
+
* @param {Function} callback - a callback to run when value changes
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);
|
|
10
|
+
* ref.current = 1;
|
|
11
|
+
* // prints 0 -> 1
|
|
12
|
+
*
|
|
13
|
+
* @see https://reactjs.org/docs/hooks-reference.html#useref
|
|
14
|
+
* @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref
|
|
15
|
+
* @returns {MutableRefObject}
|
|
16
|
+
*/
|
|
17
|
+
function useCallbackRef(initialValue, callback) {
|
|
18
|
+
var ref = useState(function () { return ({
|
|
19
|
+
// value
|
|
20
|
+
value: initialValue,
|
|
21
|
+
// last callback
|
|
22
|
+
callback: callback,
|
|
23
|
+
// "memoized" public interface
|
|
24
|
+
facade: {
|
|
25
|
+
get current() {
|
|
26
|
+
return ref.value;
|
|
27
|
+
},
|
|
28
|
+
set current(value) {
|
|
29
|
+
var last = ref.value;
|
|
30
|
+
if (last !== value) {
|
|
31
|
+
ref.value = value;
|
|
32
|
+
ref.callback(value, last);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
}); })[0];
|
|
37
|
+
// update callback
|
|
38
|
+
ref.callback = callback;
|
|
39
|
+
return ref.facade;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { useCallbackRef };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
|
|
3
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var RGBA_PATTERN = /rgba?\(([0-9]+),([0-9]+),([0-9]+)(?:,(1|0|0?\.[0-9]*))?\)/;
|
|
17
|
+
var CACHE = {};
|
|
18
|
+
/**
|
|
19
|
+
* Calculates the color's luminance
|
|
20
|
+
*
|
|
21
|
+
* @param color #rgb, #rrggbb[FF], rgb(r,g,b), rgba(r,g,b,1) or [r, g, b]
|
|
22
|
+
*/
|
|
23
|
+
function colorLuminance(color, cache) {
|
|
24
|
+
if (cache === void 0) { cache = true; }
|
|
25
|
+
if (typeof color === 'string') {
|
|
26
|
+
if (cache && CACHE[color]) {
|
|
27
|
+
return CACHE[color];
|
|
28
|
+
}
|
|
29
|
+
if (color[0] === '#') {
|
|
30
|
+
var rgb = color.slice(1);
|
|
31
|
+
if (rgb.length === 3) {
|
|
32
|
+
return (CACHE[color] = colorLuminance([
|
|
33
|
+
hexToByte(rgb[0] + rgb[0]),
|
|
34
|
+
hexToByte(rgb[1] + rgb[1]),
|
|
35
|
+
hexToByte(rgb[2] + rgb[2]),
|
|
36
|
+
]));
|
|
37
|
+
}
|
|
38
|
+
if (rgb.length === 8) {
|
|
39
|
+
var alpha = hexToByte(rgb.slice(6, 8));
|
|
40
|
+
if (alpha !== 255) {
|
|
41
|
+
throw new NeedsAlphaBlending(color, alpha);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (rgb.length === 6 || rgb.length === 8) {
|
|
45
|
+
return (CACHE[color] = colorLuminance([
|
|
46
|
+
hexToByte(rgb.slice(0, 2)),
|
|
47
|
+
hexToByte(rgb.slice(2, 4)),
|
|
48
|
+
hexToByte(rgb.slice(4, 6)),
|
|
49
|
+
]));
|
|
50
|
+
}
|
|
51
|
+
throw new UnsupportedFormat(color);
|
|
52
|
+
}
|
|
53
|
+
var matches = color.replace(/ /g, '').match(RGBA_PATTERN);
|
|
54
|
+
if (matches) {
|
|
55
|
+
if (matches[4] && matches[4] !== '1') {
|
|
56
|
+
throw new NeedsAlphaBlending(color, Number(matches[4]));
|
|
57
|
+
}
|
|
58
|
+
return (CACHE[color] = colorLuminance([
|
|
59
|
+
Number(matches[1]),
|
|
60
|
+
Number(matches[2]),
|
|
61
|
+
Number(matches[3]),
|
|
62
|
+
]));
|
|
63
|
+
}
|
|
64
|
+
throw new UnsupportedFormat(color);
|
|
65
|
+
}
|
|
66
|
+
assertRgbColor(color);
|
|
67
|
+
return componentsToLuminance(color[0] / 255, color[1] / 255, color[2] / 255);
|
|
68
|
+
}
|
|
69
|
+
function hexToByte(hex) {
|
|
70
|
+
return parseInt(hex, 16);
|
|
71
|
+
}
|
|
72
|
+
function componentsToLuminance(r, g, b) {
|
|
73
|
+
var rl = r > 0.03928 ? Math.pow(((r + 0.055) / 1.055), 2.4) : r / 12.92;
|
|
74
|
+
var gl = g > 0.03928 ? Math.pow(((g + 0.055) / 1.055), 2.4) : g / 12.92;
|
|
75
|
+
var bl = b > 0.03928 ? Math.pow(((b + 0.055) / 1.055), 2.4) : b / 12.92;
|
|
76
|
+
// https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
|
|
77
|
+
// https://en.wikipedia.org/wiki/Relative_luminance
|
|
78
|
+
return 0.2126 * rl + 0.7152 * gl + 0.0722 * bl;
|
|
79
|
+
}
|
|
80
|
+
function assertRgbColor(color) {
|
|
81
|
+
if (color.length < 3 ||
|
|
82
|
+
color.length > 4 ||
|
|
83
|
+
color.some(function (d) { return d < 0 || d > 255; })) {
|
|
84
|
+
throw new UnsupportedFormat("[" + color.join(', ') + "]");
|
|
85
|
+
}
|
|
86
|
+
if (color.length == 4 && color[3] !== 1) {
|
|
87
|
+
throw new NeedsAlphaBlending("[" + color.join(', ') + "]", color[3]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
var UnsupportedFormat = /** @class */ (function (_super) {
|
|
91
|
+
__extends(UnsupportedFormat, _super);
|
|
92
|
+
function UnsupportedFormat(color) {
|
|
93
|
+
return _super.call(this, ("\nExpected color to be in a supported format, actual: " + color + ".\n\nSupported formats for string input are:\n\n- #rgb\n- #rrggbb\n- #rrggbbFF\n- rgb(r, g, b) (0 <= rgb <= 255)\n- rgba(r, g, b, 1) (0 <= rgb <= 255)\n\nSupported formats for array input are:\n\n - [r, g, b] (0 <= rgb <= 255)\n - [r, g, b, 1] (0 <= rgb <= 255)\n\nKeyword/system colors are not supported (nor consistent across environments).\n ").trim()) || this;
|
|
94
|
+
}
|
|
95
|
+
return UnsupportedFormat;
|
|
96
|
+
}(Error));
|
|
97
|
+
var NeedsAlphaBlending = /** @class */ (function (_super) {
|
|
98
|
+
__extends(NeedsAlphaBlending, _super);
|
|
99
|
+
function NeedsAlphaBlending(color, alpha) {
|
|
100
|
+
return _super.call(this, ("\nExpected a fully opaque color, actual: " + color + ", with alpha: " + alpha + ".\n\nColors with that are (semi-)translucent need to be alpha-blended, which means\nthat you need to know the background color(s) in order to calculate the color\nthat will show on screen.\n\nThe package use-alpha-blended-color has both a React hook as well as a general\nutility function to premultiply colors.\n\n import { useAlphaBlendedColor } from 'use-alpha-blended-color'\n\n const prepared = useAlphaBlendedColor(" + color + ", '#<background-color>')\n const luminance = useColorLuminance(prepared)\n ").trim()) || this;
|
|
101
|
+
}
|
|
102
|
+
return NeedsAlphaBlending;
|
|
103
|
+
}(Error));
|
|
104
|
+
|
|
105
|
+
export { NeedsAlphaBlending, UnsupportedFormat, colorLuminance };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __rest, __assign } from '../../../tslib/tslib.es6.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
var SideCar = function (_a) {
|
|
5
|
+
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
6
|
+
if (!sideCar) {
|
|
7
|
+
throw new Error('Sidecar: please provide `sideCar` property to import the right car');
|
|
8
|
+
}
|
|
9
|
+
var Target = sideCar.read();
|
|
10
|
+
if (!Target) {
|
|
11
|
+
throw new Error('Sidecar medium not found');
|
|
12
|
+
}
|
|
13
|
+
return React.createElement(Target, __assign({}, rest));
|
|
14
|
+
};
|
|
15
|
+
SideCar.isSideCarExport = true;
|
|
16
|
+
function exportSidecar(medium, exported) {
|
|
17
|
+
medium.useMedium(exported);
|
|
18
|
+
return SideCar;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { exportSidecar };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { __assign } from '../../../tslib/tslib.es6.js';
|
|
2
|
+
|
|
3
|
+
function ItoI(a) {
|
|
4
|
+
return a;
|
|
5
|
+
}
|
|
6
|
+
function innerCreateMedium(defaults, middleware) {
|
|
7
|
+
if (middleware === void 0) { middleware = ItoI; }
|
|
8
|
+
var buffer = [];
|
|
9
|
+
var assigned = false;
|
|
10
|
+
var medium = {
|
|
11
|
+
read: function () {
|
|
12
|
+
if (assigned) {
|
|
13
|
+
throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.');
|
|
14
|
+
}
|
|
15
|
+
if (buffer.length) {
|
|
16
|
+
return buffer[buffer.length - 1];
|
|
17
|
+
}
|
|
18
|
+
return defaults;
|
|
19
|
+
},
|
|
20
|
+
useMedium: function (data) {
|
|
21
|
+
var item = middleware(data, assigned);
|
|
22
|
+
buffer.push(item);
|
|
23
|
+
return function () {
|
|
24
|
+
buffer = buffer.filter(function (x) { return x !== item; });
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
assignSyncMedium: function (cb) {
|
|
28
|
+
assigned = true;
|
|
29
|
+
while (buffer.length) {
|
|
30
|
+
var cbs = buffer;
|
|
31
|
+
buffer = [];
|
|
32
|
+
cbs.forEach(cb);
|
|
33
|
+
}
|
|
34
|
+
buffer = {
|
|
35
|
+
push: function (x) { return cb(x); },
|
|
36
|
+
filter: function () { return buffer; },
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
assignMedium: function (cb) {
|
|
40
|
+
assigned = true;
|
|
41
|
+
var pendingQueue = [];
|
|
42
|
+
if (buffer.length) {
|
|
43
|
+
var cbs = buffer;
|
|
44
|
+
buffer = [];
|
|
45
|
+
cbs.forEach(cb);
|
|
46
|
+
pendingQueue = buffer;
|
|
47
|
+
}
|
|
48
|
+
var executeQueue = function () {
|
|
49
|
+
var cbs = pendingQueue;
|
|
50
|
+
pendingQueue = [];
|
|
51
|
+
cbs.forEach(cb);
|
|
52
|
+
};
|
|
53
|
+
var cycle = function () { return Promise.resolve().then(executeQueue); };
|
|
54
|
+
cycle();
|
|
55
|
+
buffer = {
|
|
56
|
+
push: function (x) {
|
|
57
|
+
pendingQueue.push(x);
|
|
58
|
+
cycle();
|
|
59
|
+
},
|
|
60
|
+
filter: function (filter) {
|
|
61
|
+
pendingQueue = pendingQueue.filter(filter);
|
|
62
|
+
return buffer;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
return medium;
|
|
68
|
+
}
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
70
|
+
function createSidecarMedium(options) {
|
|
71
|
+
if (options === void 0) { options = {}; }
|
|
72
|
+
var medium = innerCreateMedium(null);
|
|
73
|
+
medium.options = __assign({ async: true, ssr: false }, options);
|
|
74
|
+
return medium;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { createSidecarMedium };
|
|
@@ -1,152 +1,146 @@
|
|
|
1
|
-
const montSerrat = { fontFamily: 'Montserrat, sans-serif' };
|
|
2
|
-
const roboto = { fontFamily: 'Roboto, sans-serif' };
|
|
3
|
-
const ibm = { fontFamily: 'IBM Plex Mono, sans-serif' };
|
|
4
|
-
const fontWeight700 = { fontWeight: '700' };
|
|
5
|
-
const fontWeight600 = { fontWeight: '600' };
|
|
6
|
-
const fontWeight500 = { fontWeight: '500' };
|
|
7
|
-
const fontWeight400 = { fontWeight: '400' };
|
|
8
|
-
const fontSize3 = { fontSize: '3rem' };
|
|
9
|
-
const fontSize2 = { fontSize: '2rem' };
|
|
10
|
-
const fontSize25 = { fontSize: '2.5rem' };
|
|
11
|
-
const fontSize15 = { fontSize: '1.5rem' };
|
|
12
|
-
const fontSize125 = { fontSize: '1.25rem' };
|
|
13
|
-
const fontSize1 = { fontSize: '1rem' };
|
|
14
|
-
const fontSize0875 = { fontSize: '0.875rem' };
|
|
15
|
-
const fontSize075 = { fontSize: '0.75rem' };
|
|
16
|
-
|
|
17
|
-
const typographies = {
|
|
18
|
-
'.heading-xxlarge-500': {
|
|
19
|
-
...montSerrat,
|
|
20
|
-
...fontSize3,
|
|
21
|
-
...fontWeight500,
|
|
22
|
-
lineHeight: '3.25rem',
|
|
23
|
-
},
|
|
24
|
-
'.heading-xlarge-500': {
|
|
25
|
-
...montSerrat,
|
|
26
|
-
...fontSize25,
|
|
27
|
-
...fontWeight500,
|
|
28
|
-
lineHeight: '2.75rem',
|
|
29
|
-
},
|
|
30
|
-
'.heading-large-600': {
|
|
31
|
-
...montSerrat,
|
|
32
|
-
...fontSize2,
|
|
33
|
-
...fontWeight600,
|
|
34
|
-
lineHeight: '2.25rem',
|
|
35
|
-
},
|
|
36
|
-
'.heading-large-500': {
|
|
37
|
-
...montSerrat,
|
|
38
|
-
...fontSize2,
|
|
39
|
-
...fontWeight500,
|
|
40
|
-
lineHeight: '2.25rem',
|
|
41
|
-
},
|
|
42
|
-
'.heading-medium-600': {
|
|
43
|
-
...montSerrat,
|
|
44
|
-
...fontSize15,
|
|
45
|
-
...fontWeight600,
|
|
46
|
-
lineHeight: '1.75rem',
|
|
47
|
-
},
|
|
48
|
-
'.heading-medium-500': {
|
|
49
|
-
...montSerrat,
|
|
50
|
-
...fontSize15,
|
|
51
|
-
...fontWeight500,
|
|
52
|
-
lineHeight: '1.75rem',
|
|
53
|
-
},
|
|
54
|
-
'.heading-small-600': {
|
|
55
|
-
...montSerrat,
|
|
56
|
-
...fontSize125,
|
|
57
|
-
...fontWeight600,
|
|
58
|
-
lineHeight: '1.5rem',
|
|
59
|
-
},
|
|
60
|
-
'.heading-small-500': {
|
|
61
|
-
...montSerrat,
|
|
62
|
-
...fontSize125,
|
|
63
|
-
...fontWeight500,
|
|
64
|
-
lineHeight: '1.5rem',
|
|
65
|
-
},
|
|
66
|
-
'.heading-xsmall-600': {
|
|
67
|
-
...montSerrat,
|
|
68
|
-
...fontSize1,
|
|
69
|
-
...fontWeight600,
|
|
70
|
-
lineHeight: '1.25rem',
|
|
71
|
-
},
|
|
72
|
-
'.heading-xsmall-500': {
|
|
73
|
-
...montSerrat,
|
|
74
|
-
...fontSize1,
|
|
75
|
-
...fontWeight500,
|
|
76
|
-
lineHeight: '1.25rem',
|
|
77
|
-
},
|
|
78
|
-
'.heading-xxsmall-
|
|
79
|
-
...montSerrat,
|
|
80
|
-
...fontSize0875,
|
|
81
|
-
lineHeight: '1.25rem',
|
|
82
|
-
...
|
|
83
|
-
},
|
|
84
|
-
'.
|
|
85
|
-
...
|
|
86
|
-
...
|
|
87
|
-
lineHeight: '1.
|
|
88
|
-
...
|
|
89
|
-
},
|
|
90
|
-
'.body-large-
|
|
91
|
-
...roboto,
|
|
92
|
-
...fontSize1,
|
|
93
|
-
lineHeight: '1.5rem',
|
|
94
|
-
...
|
|
95
|
-
},
|
|
96
|
-
'.body-large-
|
|
97
|
-
...roboto,
|
|
98
|
-
...fontSize1,
|
|
99
|
-
lineHeight: '1.5rem',
|
|
100
|
-
...
|
|
101
|
-
},
|
|
102
|
-
'.body-
|
|
103
|
-
...roboto,
|
|
104
|
-
...
|
|
105
|
-
lineHeight: '1.
|
|
106
|
-
...
|
|
107
|
-
},
|
|
108
|
-
'.body-medium-
|
|
109
|
-
...roboto,
|
|
110
|
-
...fontSize0875,
|
|
111
|
-
lineHeight: '1.25rem',
|
|
112
|
-
...
|
|
113
|
-
},
|
|
114
|
-
'.body-medium-
|
|
115
|
-
...roboto,
|
|
116
|
-
...fontSize0875,
|
|
117
|
-
lineHeight: '1.25rem',
|
|
118
|
-
...
|
|
119
|
-
},
|
|
120
|
-
'.body-
|
|
121
|
-
...roboto,
|
|
122
|
-
...
|
|
123
|
-
lineHeight: '
|
|
124
|
-
...
|
|
125
|
-
},
|
|
126
|
-
'.body-small-
|
|
127
|
-
...roboto,
|
|
128
|
-
...fontSize075,
|
|
129
|
-
lineHeight: '1rem',
|
|
130
|
-
...
|
|
131
|
-
},
|
|
132
|
-
'.body-small-
|
|
133
|
-
...roboto,
|
|
134
|
-
...fontSize075,
|
|
135
|
-
lineHeight: '1rem',
|
|
136
|
-
...
|
|
137
|
-
},
|
|
138
|
-
'.
|
|
139
|
-
...
|
|
140
|
-
...
|
|
141
|
-
lineHeight: '
|
|
142
|
-
...fontWeight400,
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
lineHeight: '1.25rem',
|
|
148
|
-
...fontWeight400,
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
export { typographies };
|
|
1
|
+
const montSerrat = { fontFamily: 'Montserrat, sans-serif' };
|
|
2
|
+
const roboto = { fontFamily: 'Roboto, sans-serif' };
|
|
3
|
+
const ibm = { fontFamily: 'IBM Plex Mono, sans-serif' };
|
|
4
|
+
const fontWeight700 = { fontWeight: '700' };
|
|
5
|
+
const fontWeight600 = { fontWeight: '600' };
|
|
6
|
+
const fontWeight500 = { fontWeight: '500' };
|
|
7
|
+
const fontWeight400 = { fontWeight: '400' };
|
|
8
|
+
const fontSize3 = { fontSize: '3rem' };
|
|
9
|
+
const fontSize2 = { fontSize: '2rem' };
|
|
10
|
+
const fontSize25 = { fontSize: '2.5rem' };
|
|
11
|
+
const fontSize15 = { fontSize: '1.5rem' };
|
|
12
|
+
const fontSize125 = { fontSize: '1.25rem' };
|
|
13
|
+
const fontSize1 = { fontSize: '1rem' };
|
|
14
|
+
const fontSize0875 = { fontSize: '0.875rem' };
|
|
15
|
+
const fontSize075 = { fontSize: '0.75rem' };
|
|
16
|
+
|
|
17
|
+
const typographies = {
|
|
18
|
+
'.heading-xxlarge-500': {
|
|
19
|
+
...montSerrat,
|
|
20
|
+
...fontSize3,
|
|
21
|
+
...fontWeight500,
|
|
22
|
+
lineHeight: '3.25rem',
|
|
23
|
+
},
|
|
24
|
+
'.heading-xlarge-500': {
|
|
25
|
+
...montSerrat,
|
|
26
|
+
...fontSize25,
|
|
27
|
+
...fontWeight500,
|
|
28
|
+
lineHeight: '2.75rem',
|
|
29
|
+
},
|
|
30
|
+
'.heading-large-600': {
|
|
31
|
+
...montSerrat,
|
|
32
|
+
...fontSize2,
|
|
33
|
+
...fontWeight600,
|
|
34
|
+
lineHeight: '2.25rem',
|
|
35
|
+
},
|
|
36
|
+
'.heading-large-500': {
|
|
37
|
+
...montSerrat,
|
|
38
|
+
...fontSize2,
|
|
39
|
+
...fontWeight500,
|
|
40
|
+
lineHeight: '2.25rem',
|
|
41
|
+
},
|
|
42
|
+
'.heading-medium-600': {
|
|
43
|
+
...montSerrat,
|
|
44
|
+
...fontSize15,
|
|
45
|
+
...fontWeight600,
|
|
46
|
+
lineHeight: '1.75rem',
|
|
47
|
+
},
|
|
48
|
+
'.heading-medium-500': {
|
|
49
|
+
...montSerrat,
|
|
50
|
+
...fontSize15,
|
|
51
|
+
...fontWeight500,
|
|
52
|
+
lineHeight: '1.75rem',
|
|
53
|
+
},
|
|
54
|
+
'.heading-small-600': {
|
|
55
|
+
...montSerrat,
|
|
56
|
+
...fontSize125,
|
|
57
|
+
...fontWeight600,
|
|
58
|
+
lineHeight: '1.5rem',
|
|
59
|
+
},
|
|
60
|
+
'.heading-small-500': {
|
|
61
|
+
...montSerrat,
|
|
62
|
+
...fontSize125,
|
|
63
|
+
...fontWeight500,
|
|
64
|
+
lineHeight: '1.5rem',
|
|
65
|
+
},
|
|
66
|
+
'.heading-xsmall-600': {
|
|
67
|
+
...montSerrat,
|
|
68
|
+
...fontSize1,
|
|
69
|
+
...fontWeight600,
|
|
70
|
+
lineHeight: '1.25rem',
|
|
71
|
+
},
|
|
72
|
+
'.heading-xsmall-500': {
|
|
73
|
+
...montSerrat,
|
|
74
|
+
...fontSize1,
|
|
75
|
+
...fontWeight500,
|
|
76
|
+
lineHeight: '1.25rem',
|
|
77
|
+
},
|
|
78
|
+
'.heading-xxsmall-500': {
|
|
79
|
+
...montSerrat,
|
|
80
|
+
...fontSize0875,
|
|
81
|
+
lineHeight: '1.25rem',
|
|
82
|
+
...fontWeight500,
|
|
83
|
+
},
|
|
84
|
+
'.body-large-700': {
|
|
85
|
+
...roboto,
|
|
86
|
+
...fontSize1,
|
|
87
|
+
lineHeight: '1.5rem',
|
|
88
|
+
...fontWeight700,
|
|
89
|
+
},
|
|
90
|
+
'.body-large-500': {
|
|
91
|
+
...roboto,
|
|
92
|
+
...fontSize1,
|
|
93
|
+
lineHeight: '1.5rem',
|
|
94
|
+
...fontWeight500,
|
|
95
|
+
},
|
|
96
|
+
'.body-large-400': {
|
|
97
|
+
...roboto,
|
|
98
|
+
...fontSize1,
|
|
99
|
+
lineHeight: '1.5rem',
|
|
100
|
+
...fontWeight400,
|
|
101
|
+
},
|
|
102
|
+
'.body-medium-700': {
|
|
103
|
+
...roboto,
|
|
104
|
+
...fontSize0875,
|
|
105
|
+
lineHeight: '1.25rem',
|
|
106
|
+
...fontWeight700,
|
|
107
|
+
},
|
|
108
|
+
'.body-medium-500': {
|
|
109
|
+
...roboto,
|
|
110
|
+
...fontSize0875,
|
|
111
|
+
lineHeight: '1.25rem',
|
|
112
|
+
...fontWeight500,
|
|
113
|
+
},
|
|
114
|
+
'.body-medium-400': {
|
|
115
|
+
...roboto,
|
|
116
|
+
...fontSize0875,
|
|
117
|
+
lineHeight: '1.25rem',
|
|
118
|
+
...fontWeight400,
|
|
119
|
+
},
|
|
120
|
+
'.body-small-700': {
|
|
121
|
+
...roboto,
|
|
122
|
+
...fontSize075,
|
|
123
|
+
lineHeight: '1rem',
|
|
124
|
+
...fontWeight700,
|
|
125
|
+
},
|
|
126
|
+
'.body-small-500': {
|
|
127
|
+
...roboto,
|
|
128
|
+
...fontSize075,
|
|
129
|
+
lineHeight: '1rem',
|
|
130
|
+
...fontWeight500,
|
|
131
|
+
},
|
|
132
|
+
'.body-small-400': {
|
|
133
|
+
...roboto,
|
|
134
|
+
...fontSize075,
|
|
135
|
+
lineHeight: '1rem',
|
|
136
|
+
...fontWeight400,
|
|
137
|
+
},
|
|
138
|
+
'.code-medium-400': {
|
|
139
|
+
...ibm,
|
|
140
|
+
...fontSize0875,
|
|
141
|
+
lineHeight: '1.25rem',
|
|
142
|
+
...fontWeight400,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export { typographies };
|