@pedidopago/ui 1.4.4 → 1.5.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/components/Badge/styles.d.ts.map +1 -1
- package/dist/components/Badge/styles.js +1 -1
- package/dist/components/Button/styles.d.ts.map +1 -1
- package/dist/components/Button/styles.js +1 -1
- package/dist/components/DateInput/index.d.ts.map +1 -1
- package/dist/components/DateInput/index.js +1 -0
- package/dist/components/Dialog/index.js +2 -2
- package/dist/components/Icon/data/dash.d.ts.map +1 -1
- package/dist/components/Icon/data/dash.js +1 -1
- package/dist/components/Icon/types.d.ts +1 -1
- package/dist/components/Icon/types.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.js +6 -3
- package/dist/components/MultipleSelect/components/OptionsArea/styles.d.ts.map +1 -1
- package/dist/components/MultipleSelect/components/OptionsArea/styles.js +1 -1
- package/dist/components/MultipleSelect/components/SelectArea/SelectAreaWrapper.d.ts.map +1 -1
- package/dist/components/MultipleSelect/components/SelectArea/SelectAreaWrapper.js +1 -1
- package/dist/components/MultipleSelect/components/SelectArea/SelectedOptionsArea.d.ts +3 -1
- package/dist/components/MultipleSelect/components/SelectArea/SelectedOptionsArea.d.ts.map +1 -1
- package/dist/components/MultipleSelect/components/SelectArea/SelectedOptionsArea.js +29 -21
- package/dist/components/MultipleSelect/components/SelectArea/index.d.ts.map +1 -1
- package/dist/components/MultipleSelect/components/SelectArea/index.js +2 -0
- package/dist/components/Pagination/styles.d.ts.map +1 -1
- package/dist/components/Pagination/styles.js +1 -1
- package/dist/components/Progress/Circle/index.d.ts +2 -2
- package/dist/components/Progress/Circle/index.d.ts.map +1 -1
- package/dist/components/Progress/Circle/index.js +53 -36
- package/dist/components/Progress/Circle/styles.d.ts +28 -0
- package/dist/components/Progress/Circle/styles.d.ts.map +1 -0
- package/dist/components/Progress/Circle/styles.js +83 -0
- package/dist/components/Progress/Circle/types.d.ts +19 -0
- package/dist/components/Progress/Circle/types.d.ts.map +1 -0
- package/dist/components/Progress/Circle/types.js +1 -0
- package/dist/components/Progress/Linear/index.d.ts +2 -2
- package/dist/components/Progress/Linear/index.d.ts.map +1 -1
- package/dist/components/Progress/Linear/index.js +28 -25
- package/dist/components/Progress/Linear/styles.d.ts +16 -0
- package/dist/components/Progress/Linear/styles.d.ts.map +1 -0
- package/dist/components/Progress/Linear/styles.js +79 -0
- package/dist/components/Progress/Linear/types.d.ts +14 -0
- package/dist/components/Progress/Linear/types.d.ts.map +1 -0
- package/dist/components/Progress/Linear/types.js +1 -0
- package/dist/components/Progress/index.d.ts +2 -2
- package/dist/components/Progress/index.d.ts.map +1 -1
- package/dist/components/Progress/index.js +18 -45
- package/dist/components/Progress/types.d.ts +28 -0
- package/dist/components/Progress/types.d.ts.map +1 -0
- package/dist/components/Progress/types.js +1 -0
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +18 -0
- package/dist/components/Tabs/TabsExample.js +1 -0
- package/dist/components/Tabs/components/TabPanel.d.ts.map +1 -1
- package/dist/components/Tabs/components/TabPanel.js +3 -1
- package/dist/components/Tabs/styles.d.ts +2 -0
- package/dist/components/Tabs/styles.d.ts.map +1 -1
- package/dist/components/Tabs/styles.js +3 -1
- package/dist/components/Tabs/types.d.ts +1 -0
- package/dist/components/Tabs/types.d.ts.map +1 -1
- package/dist/components/Tooltip/index.d.ts.map +1 -1
- package/dist/components/Tooltip/index.js +10 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +55 -1
- package/dist/shared/hooks/devices.d.ts +9 -0
- package/dist/shared/hooks/devices.d.ts.map +1 -0
- package/dist/shared/hooks/devices.js +14 -0
- package/dist/shared/hooks/useBreakpoints.d.ts +26 -0
- package/dist/shared/hooks/useBreakpoints.d.ts.map +1 -0
- package/dist/shared/hooks/useBreakpoints.js +129 -0
- package/dist/shared/hooks/useDevices.d.ts +9 -0
- package/dist/shared/hooks/useDevices.d.ts.map +1 -0
- package/dist/shared/hooks/useDevices.js +61 -0
- package/dist/shared/hooks/useWindowSize.d.ts +4 -0
- package/dist/shared/hooks/useWindowSize.d.ts.map +1 -1
- package/dist/shared/theme/theme.types.d.ts +1 -1
- package/dist/shared/theme/theme.types.d.ts.map +1 -1
- package/dist/utils/colorToGray.d.ts +1 -1
- package/dist/utils/colorToGray.d.ts.map +1 -1
- package/dist/utils/getSvg.js +1 -1
- package/dist/utils/getValuesBySize.d.ts +7 -0
- package/dist/utils/getValuesBySize.d.ts.map +1 -0
- package/dist/utils/getValuesBySize.js +10 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46,7 +46,13 @@ var _exportNames = {
|
|
|
46
46
|
Radio: true,
|
|
47
47
|
Switch: true,
|
|
48
48
|
useToast: true,
|
|
49
|
-
ToastProvider: true
|
|
49
|
+
ToastProvider: true,
|
|
50
|
+
useDevices: true,
|
|
51
|
+
useBreakpoints: true,
|
|
52
|
+
useDisableBodyScroll: true,
|
|
53
|
+
useKeyPress: true,
|
|
54
|
+
useOnClickOutside: true,
|
|
55
|
+
useWindowSize: true
|
|
50
56
|
};
|
|
51
57
|
Object.defineProperty(exports, "Alert", {
|
|
52
58
|
enumerable: true,
|
|
@@ -300,12 +306,48 @@ Object.defineProperty(exports, "Typography", {
|
|
|
300
306
|
return _Typography.default;
|
|
301
307
|
}
|
|
302
308
|
});
|
|
309
|
+
Object.defineProperty(exports, "useBreakpoints", {
|
|
310
|
+
enumerable: true,
|
|
311
|
+
get: function get() {
|
|
312
|
+
return _useBreakpoints.useBreakpoints;
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
Object.defineProperty(exports, "useDevices", {
|
|
316
|
+
enumerable: true,
|
|
317
|
+
get: function get() {
|
|
318
|
+
return _useDevices.useDevices;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
Object.defineProperty(exports, "useDisableBodyScroll", {
|
|
322
|
+
enumerable: true,
|
|
323
|
+
get: function get() {
|
|
324
|
+
return _useDisableBodyScroll.useDisableBodyScroll;
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
Object.defineProperty(exports, "useKeyPress", {
|
|
328
|
+
enumerable: true,
|
|
329
|
+
get: function get() {
|
|
330
|
+
return _useKeyPress.useKeyPress;
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
Object.defineProperty(exports, "useOnClickOutside", {
|
|
334
|
+
enumerable: true,
|
|
335
|
+
get: function get() {
|
|
336
|
+
return _useOnClickOutside.useOnClickOutside;
|
|
337
|
+
}
|
|
338
|
+
});
|
|
303
339
|
Object.defineProperty(exports, "useToast", {
|
|
304
340
|
enumerable: true,
|
|
305
341
|
get: function get() {
|
|
306
342
|
return _useToast.default;
|
|
307
343
|
}
|
|
308
344
|
});
|
|
345
|
+
Object.defineProperty(exports, "useWindowSize", {
|
|
346
|
+
enumerable: true,
|
|
347
|
+
get: function get() {
|
|
348
|
+
return _useWindowSize.useWindowSize;
|
|
349
|
+
}
|
|
350
|
+
});
|
|
309
351
|
|
|
310
352
|
var _Alert = _interopRequireDefault(require("./components/Alert"));
|
|
311
353
|
|
|
@@ -421,6 +463,18 @@ var _useToast = _interopRequireDefault(require("./components/Toast/hooks/useToas
|
|
|
421
463
|
|
|
422
464
|
var _ToastProvider = _interopRequireDefault(require("./components/Toast/contexts/ToastProvider"));
|
|
423
465
|
|
|
466
|
+
var _useDevices = require("./shared/hooks/useDevices");
|
|
467
|
+
|
|
468
|
+
var _useBreakpoints = require("./shared/hooks/useBreakpoints");
|
|
469
|
+
|
|
470
|
+
var _useDisableBodyScroll = require("./shared/hooks/useDisableBodyScroll");
|
|
471
|
+
|
|
472
|
+
var _useKeyPress = require("./shared/hooks/useKeyPress");
|
|
473
|
+
|
|
474
|
+
var _useOnClickOutside = require("./shared/hooks/useOnClickOutside");
|
|
475
|
+
|
|
476
|
+
var _useWindowSize = require("./shared/hooks/useWindowSize");
|
|
477
|
+
|
|
424
478
|
var _theme = require("./shared/theme");
|
|
425
479
|
|
|
426
480
|
Object.keys(_theme).forEach(function (key) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const devices: {
|
|
2
|
+
mobile: number;
|
|
3
|
+
tablet: number;
|
|
4
|
+
'monitor-small': number;
|
|
5
|
+
'monitor-wide': number;
|
|
6
|
+
'monitor-ultra': number;
|
|
7
|
+
};
|
|
8
|
+
export declare type DeviceTypes = 'mobile' | 'tablet' | 'monitor-small' | 'monitor-wide' | 'monitor-ultra' | number;
|
|
9
|
+
//# sourceMappingURL=devices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devices.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/devices.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;CAMnB,CAAC;AAEF,oBAAY,WAAW,GACnB,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,cAAc,GACd,eAAe,GACf,MAAM,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.devices = void 0;
|
|
7
|
+
var devices = {
|
|
8
|
+
mobile: 425,
|
|
9
|
+
tablet: 768,
|
|
10
|
+
'monitor-small': 1024,
|
|
11
|
+
'monitor-wide': 1440,
|
|
12
|
+
'monitor-ultra': 2560
|
|
13
|
+
};
|
|
14
|
+
exports.devices = devices;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare type BreakpointsConfig = {
|
|
3
|
+
base: number;
|
|
4
|
+
sm: number;
|
|
5
|
+
md: number;
|
|
6
|
+
lg: number;
|
|
7
|
+
xl: number;
|
|
8
|
+
xxl: number;
|
|
9
|
+
};
|
|
10
|
+
declare type BreakpointName = 'base' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
11
|
+
declare type BreakpointValue = {
|
|
12
|
+
[key in BreakpointName]?: ReactNode | string | number | undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* It returns a function that takes a breakpoint value object and returns the value
|
|
16
|
+
* of the closest breakpoint to the current window size
|
|
17
|
+
* @param {BreakpointsConfig} [breakpointsConfig] - This is an optional parameter
|
|
18
|
+
* that allows you to pass in your own breakpoints.
|
|
19
|
+
* @returns a `breakpointPicker` function, which receives an object with breakpoint keys and values.
|
|
20
|
+
* @example const flexDirection = breapointPicker({ sm: 'column', lg: 'row' });
|
|
21
|
+
*/
|
|
22
|
+
export declare const useBreakpoints: (breakpointsConfig?: BreakpointsConfig | undefined) => {
|
|
23
|
+
breakpointPicker: (breakpointValues: BreakpointValue) => ReactNode;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=useBreakpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBreakpoints.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useBreakpoints.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AAGvD,aAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,aAAK,cAAc,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAEjE,aAAK,eAAe,GAAG;KAEpB,GAAG,IAAI,cAAc,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS;CAClE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;yCAcmB,eAAe;CAkF5D,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useBreakpoints = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _useWindowSize = require("./useWindowSize");
|
|
11
|
+
|
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
+
|
|
14
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
+
|
|
16
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
+
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
19
|
+
|
|
20
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
21
|
+
|
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* It returns a function that takes a breakpoint value object and returns the value
|
|
26
|
+
* of the closest breakpoint to the current window size
|
|
27
|
+
* @param {BreakpointsConfig} [breakpointsConfig] - This is an optional parameter
|
|
28
|
+
* that allows you to pass in your own breakpoints.
|
|
29
|
+
* @returns a `breakpointPicker` function, which receives an object with breakpoint keys and values.
|
|
30
|
+
* @example const flexDirection = breapointPicker({ sm: 'column', lg: 'row' });
|
|
31
|
+
*/
|
|
32
|
+
var useBreakpoints = function useBreakpoints(breakpointsConfig) {
|
|
33
|
+
var _useState = (0, _react.useState)(null),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
breakpoint = _useState2[0],
|
|
36
|
+
setBreakpoint = _useState2[1];
|
|
37
|
+
|
|
38
|
+
var defaultBreakpoints = {
|
|
39
|
+
base: 0,
|
|
40
|
+
sm: 480,
|
|
41
|
+
md: 768,
|
|
42
|
+
lg: 1024,
|
|
43
|
+
xl: 1280,
|
|
44
|
+
xxl: 1600
|
|
45
|
+
};
|
|
46
|
+
var breakpoints = breakpointsConfig || defaultBreakpoints;
|
|
47
|
+
var windowSize = (0, _useWindowSize.useWindowSize)();
|
|
48
|
+
|
|
49
|
+
function breakpointPicker(breakpointValues) {
|
|
50
|
+
if (!breakpoint) return;
|
|
51
|
+
var closestBreakpoint = getClosestBreakpointName(breakpoint, breakpointValues, breakpoints);
|
|
52
|
+
if (!closestBreakpoint) return;
|
|
53
|
+
return breakpointValues[closestBreakpoint];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function currentBreakpointWidth(windowSize, breakpoints) {
|
|
57
|
+
var response;
|
|
58
|
+
|
|
59
|
+
if (breakpoints.base < windowSize.width) {
|
|
60
|
+
response = breakpoints.base;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (breakpoints.sm < windowSize.width) {
|
|
64
|
+
response = breakpoints.sm;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (breakpoints.md < windowSize.width) {
|
|
68
|
+
response = breakpoints.md;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (breakpoints.lg < windowSize.width) {
|
|
72
|
+
response = breakpoints.lg;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (breakpoints.xl < windowSize.width) {
|
|
76
|
+
response = breakpoints.xl;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (breakpoints.xxl < windowSize.width) {
|
|
80
|
+
response = breakpoints.xxl;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return response;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function getClosestBreakpointName(activeBreakpoint, breakpointValues, breakpoints) {
|
|
87
|
+
var breakpointIndex = Object.keys(breakpointValues).findIndex(function (breakpoint) {
|
|
88
|
+
return breakpoint === activeBreakpoint;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
if (breakpointIndex !== -1) {
|
|
92
|
+
return activeBreakpoint;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
var stopIndex = Object.keys(breakpoints).indexOf(activeBreakpoint);
|
|
96
|
+
|
|
97
|
+
while (stopIndex >= 0) {
|
|
98
|
+
var key = Object.keys(breakpoints)[stopIndex];
|
|
99
|
+
|
|
100
|
+
if (Object.prototype.hasOwnProperty.call(breakpointValues, key)) {
|
|
101
|
+
breakpointIndex = stopIndex;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
stopIndex -= 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (breakpointIndex !== -1) {
|
|
109
|
+
var _key = Object.keys(breakpoints)[breakpointIndex];
|
|
110
|
+
return _key;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return Object.keys(breakpointValues)[0];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
(0, _react.useEffect)(function () {
|
|
117
|
+
var breakpointWidth = currentBreakpointWidth(windowSize, breakpoints);
|
|
118
|
+
if (!breakpointWidth) return;
|
|
119
|
+
var activeBreakpoint = Object.keys(breakpoints).filter(function (activeBreakpoint) {
|
|
120
|
+
return breakpoints[activeBreakpoint] === breakpointWidth;
|
|
121
|
+
})[0];
|
|
122
|
+
setBreakpoint(activeBreakpoint);
|
|
123
|
+
}, [breakpoints, windowSize]);
|
|
124
|
+
return {
|
|
125
|
+
breakpointPicker: breakpointPicker
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
exports.useBreakpoints = useBreakpoints;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DeviceTypes } from './devices';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the screen width matches the device in a certain direction everytime the screen resizes.
|
|
4
|
+
* @param device The target device to compare. Can use one of the specified devices or a custom one passing a number.
|
|
5
|
+
* @param direction The direction to compare. "Down" will return true if the screen width is shorter than the device. "Up" will return true if it's larger.
|
|
6
|
+
* @returns If the screen width matches the device in a certain direction.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useDevices(device: DeviceTypes, direction?: 'up' | 'down'): boolean;
|
|
9
|
+
//# sourceMappingURL=useDevices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDevices.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useDevices.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,WAAW,EAAE,MAAM,WAAW,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,GAAE,IAAI,GAAG,MAAe,WA4BhF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useDevices = useDevices;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _devices = require("./devices");
|
|
11
|
+
|
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
+
|
|
14
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
+
|
|
16
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
+
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
19
|
+
|
|
20
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
21
|
+
|
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Checks if the screen width matches the device in a certain direction everytime the screen resizes.
|
|
26
|
+
* @param device The target device to compare. Can use one of the specified devices or a custom one passing a number.
|
|
27
|
+
* @param direction The direction to compare. "Down" will return true if the screen width is shorter than the device. "Up" will return true if it's larger.
|
|
28
|
+
* @returns If the screen width matches the device in a certain direction.
|
|
29
|
+
*/
|
|
30
|
+
function useDevices(device) {
|
|
31
|
+
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'down';
|
|
32
|
+
|
|
33
|
+
var _useState = (0, _react.useState)(false),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
match = _useState2[0],
|
|
36
|
+
setMatch = _useState2[1];
|
|
37
|
+
|
|
38
|
+
var onWindowResize = (0, _react.useCallback)(function () {
|
|
39
|
+
var point = typeof device === 'number' ? device : _devices.devices[device];
|
|
40
|
+
|
|
41
|
+
switch (direction) {
|
|
42
|
+
case 'up':
|
|
43
|
+
setMatch(window.innerWidth >= point);
|
|
44
|
+
break;
|
|
45
|
+
|
|
46
|
+
case 'down':
|
|
47
|
+
setMatch(window.innerWidth <= point);
|
|
48
|
+
break;
|
|
49
|
+
|
|
50
|
+
default:
|
|
51
|
+
throw new Error("\"".concat(direction, "\" is not a valid device direction."));
|
|
52
|
+
}
|
|
53
|
+
}, [device, direction]);
|
|
54
|
+
(0, _react.useEffect)(function () {
|
|
55
|
+
window.addEventListener('resize', onWindowResize);
|
|
56
|
+
return function () {
|
|
57
|
+
window.removeEventListener('resize', onWindowResize);
|
|
58
|
+
};
|
|
59
|
+
}, [onWindowResize]);
|
|
60
|
+
return match;
|
|
61
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowSize.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useWindowSize.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa;WACe,MAAM;YAAU,MAAM;EAuBjE"}
|
|
1
|
+
{"version":3,"file":"useWindowSize.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useWindowSize.ts"],"names":[],"mappings":"AAEA,oBAAY,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,aAAa;WACe,MAAM;YAAU,MAAM;EAuBjE"}
|
|
@@ -11,5 +11,5 @@ export declare type CustomThemeProps = {
|
|
|
11
11
|
export declare type ExtendMethodProps = (customTheme: (CustomThemeProps & {
|
|
12
12
|
[key: string]: any;
|
|
13
13
|
})) => ExtendThemeProps;
|
|
14
|
-
export declare type GlobalColorsProps = 'body.light' | 'body.dark' | 'primary.alert' | 'primary.alert' | 'primary.disabled' | 'primary.default' | 'primary.hover' | 'primary.focus' | 'secondary.disabled' | 'secondary.default' | 'secondary.hover' | 'secondary.focus' | 'tertiary.disabled' | 'tertiary.default' | 'tertiary.hover' | 'tertiary.focus' | 'neutral.white' | 'neutral.neutral1' | 'neutral.neutral2' | 'neutral.neutral3' | 'neutral.neutral4' | 'neutral.neutral5' | 'neutral.black' | 'background.linear1' | 'background.linear2' | 'background.linear3' | 'background.light' | 'informative.default' | 'informative.blurred' | 'informative.gradient' | 'success.default' | 'success.blurred' | 'success.gradient' | 'success_secondary.default' | 'success_secondary.blurred' | 'success_secondary.gradient' | 'warning.default' | 'warning.blurred' | 'warning.gradient' | 'warning_secondary.default' | 'warning_secondary.blurred' | 'warning_secondary.gradient' | 'error.default' | 'error.blurred' | 'error.gradient' | 'critical.default' | 'critical.blurred' | 'critical.gradient';
|
|
14
|
+
export declare type GlobalColorsProps = 'body.light' | 'body.dark' | 'primary.alert' | 'primary.alert' | 'primary.disabled' | 'primary.default' | 'primary.hover' | 'primary.focus' | 'secondary.disabled' | 'secondary.default' | 'secondary.hover' | 'secondary.focus' | 'tertiary.disabled' | 'tertiary.default' | 'tertiary.hover' | 'tertiary.focus' | 'neutral.white' | 'neutral.neutral1' | 'neutral.neutral2' | 'neutral.neutral3' | 'neutral.neutral4' | 'neutral.neutral5' | 'neutral.neutral6' | 'neutral.black' | 'background.linear1' | 'background.linear2' | 'background.linear3' | 'background.light' | 'informative.default' | 'informative.blurred' | 'informative.gradient' | 'success.default' | 'success.blurred' | 'success.gradient' | 'success_secondary.default' | 'success_secondary.blurred' | 'success_secondary.gradient' | 'warning.default' | 'warning.blurred' | 'warning.gradient' | 'warning_secondary.default' | 'warning_secondary.blurred' | 'warning_secondary.gradient' | 'error.default' | 'error.blurred' | 'error.gradient' | 'critical.default' | 'critical.blurred' | 'critical.gradient';
|
|
15
15
|
//# sourceMappingURL=theme.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.types.d.ts","sourceRoot":"","sources":["../../../src/shared/theme/theme.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;AAEjC,oBAAY,gBAAgB,GAAG,OAAO,YAAY,CAAC;AAEnD,oBAAY,UAAU,GAAG,gBAAgB,GAAG;IAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF,oBAAY,gBAAgB,GAAG;KAC5B,GAAG,IAAI,MAAM,gBAAgB,CAAC,CAAC,EAAE,OAAO,CACrC,gBAAgB,CAAC,GAAG,CAAC,GACrB;SACG,IAAI,IAAI,MAAM,gBAAgB,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM;KACrF,CACJ;CACF,CAAC;AAEF,oBAAY,iBAAiB,GAAG,CAC9B,WAAW,EACT,CAAE,gBAAgB,GAAG;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAA,KACF,gBAAgB,CAAC;AAEtB,oBAAY,iBAAiB,GACzB,YAAY,GACZ,WAAW,GACX,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,oBAAoB,GACpB,mBAAmB,GACnB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,eAAe,GACf,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,kBAAkB,GAClB,qBAAqB,GACrB,qBAAqB,GACrB,sBAAsB,GACtB,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,2BAA2B,GAC3B,2BAA2B,GAC3B,4BAA4B,GAC5B,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,2BAA2B,GAC3B,2BAA2B,GAC3B,4BAA4B,GAC5B,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"theme.types.d.ts","sourceRoot":"","sources":["../../../src/shared/theme/theme.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;AAEjC,oBAAY,gBAAgB,GAAG,OAAO,YAAY,CAAC;AAEnD,oBAAY,UAAU,GAAG,gBAAgB,GAAG;IAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF,oBAAY,gBAAgB,GAAG;KAC5B,GAAG,IAAI,MAAM,gBAAgB,CAAC,CAAC,EAAE,OAAO,CACrC,gBAAgB,CAAC,GAAG,CAAC,GACrB;SACG,IAAI,IAAI,MAAM,gBAAgB,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM;KACrF,CACJ;CACF,CAAC;AAEF,oBAAY,iBAAiB,GAAG,CAC9B,WAAW,EACT,CAAE,gBAAgB,GAAG;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAA,KACF,gBAAgB,CAAC;AAEtB,oBAAY,iBAAiB,GACzB,YAAY,GACZ,WAAW,GACX,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,oBAAoB,GACpB,mBAAmB,GACnB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,eAAe,GACf,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,kBAAkB,GAClB,qBAAqB,GACrB,qBAAqB,GACrB,sBAAsB,GACtB,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,2BAA2B,GAC3B,2BAA2B,GAC3B,4BAA4B,GAC5B,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,2BAA2B,GAC3B,2BAA2B,GAC3B,4BAA4B,GAC5B,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayColor, objectGray } from '../components/Progress/
|
|
1
|
+
import { ArrayColor, objectGray } from '../components/Progress/types';
|
|
2
2
|
export declare function numberToHex(c: number): string;
|
|
3
3
|
export declare function rgbToHex(color: ArrayColor): string;
|
|
4
4
|
export declare function convertColor(color: string | ArrayColor): objectGray;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorToGray.d.ts","sourceRoot":"","sources":["../../src/utils/colorToGray.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"colorToGray.d.ts","sourceRoot":"","sources":["../../src/utils/colorToGray.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEtE,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,UAGpC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,UAEzC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAoCnE;AAED,eAAO,MAAM,qBAAqB,UAAW,MAAM,EAAE,KAAG,MAIvD,CAAC"}
|
package/dist/utils/getSvg.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare type SizeName = 'base' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | string;
|
|
2
|
+
declare type Sizes = {
|
|
3
|
+
[key in SizeName | string]: string | number;
|
|
4
|
+
};
|
|
5
|
+
export declare function getValuesBySize(sizes: Sizes, conditional?: SizeName): string | number;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=getValuesBySize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getValuesBySize.d.ts","sourceRoot":"","sources":["../../src/utils/getValuesBySize.ts"],"names":[],"mappings":"AAAA,aAAK,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;AAEpE,aAAK,KAAK,GAAG;KAEV,GAAG,IAAI,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM;CAC5C,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,EAAE,QAAQ,mBAEnE"}
|