@pedidopago/ui 1.4.5 → 1.5.0
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 +5 -2
- 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/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 +52 -35
- 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 +25 -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 +15 -45
- package/dist/components/Progress/types.d.ts +16 -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 +14 -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/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/utils/colorToGray.d.ts +1 -1
- package/dist/utils/colorToGray.d.ts.map +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
|
@@ -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 undefined;
|
|
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"}
|
|
@@ -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"}
|
|
@@ -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"}
|